aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Hu <austin.hu@intel.com>2017-05-09 21:30:20 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-09 21:30:20 +0000
commitda6d3dc398551ff80f662903ecc2891c53d2c8cc (patch)
tree2436d19571bab986c8493462625eaa16695dbc0c
parent18819ff03a047be97b7246cff6e9188d0f6d12c3 (diff)
parent1c6ccfd91bac95e2623aa511838fef0d94f45b96 (diff)
downloadomx-components-da6d3dc398551ff80f662903ecc2891c53d2c8cc.tar.gz
Fixed the Klocwork issue.
am: 1c6ccfd91b Change-Id: I98897724fbc6e17c615f87cc90adc20d45f9a213
-rw-r--r--Android.mk1
-rwxr-xr-xvideocodec/Android.mk61
-rw-r--r--videocodec/OMXVideoDecoderVP9HWR.cpp836
-rw-r--r--videocodec/OMXVideoDecoderVP9HWR.h127
-rw-r--r--videocodec/libvpx_internal/Android.mk9
-rw-r--r--videocodec/libvpx_internal/NOTICE31
-rw-r--r--videocodec/libvpx_internal/UPDATING49
-rw-r--r--videocodec/libvpx_internal/armv7a-neon/libvpx_srcs.txt347
-rw-r--r--videocodec/libvpx_internal/armv7a-neon/vp8_rtcd.h403
-rw-r--r--videocodec/libvpx_internal/armv7a-neon/vp9_rtcd.h322
-rw-r--r--videocodec/libvpx_internal/armv7a-neon/vpx_config.c9
-rw-r--r--videocodec/libvpx_internal/armv7a-neon/vpx_config.h93
-rw-r--r--videocodec/libvpx_internal/armv7a-neon/vpx_scale_rtcd.h65
-rw-r--r--videocodec/libvpx_internal/armv7a-neon/vpx_version.h7
-rw-r--r--videocodec/libvpx_internal/armv7a/libvpx_srcs.txt284
-rw-r--r--videocodec/libvpx_internal/armv7a/vp8_rtcd.h349
-rw-r--r--videocodec/libvpx_internal/armv7a/vp9_rtcd.h296
-rw-r--r--videocodec/libvpx_internal/armv7a/vpx_config.c9
-rw-r--r--videocodec/libvpx_internal/armv7a/vpx_config.h93
-rw-r--r--videocodec/libvpx_internal/armv7a/vpx_scale_rtcd.h62
-rw-r--r--videocodec/libvpx_internal/armv7a/vpx_version.h7
-rw-r--r--videocodec/libvpx_internal/generic/libvpx_srcs.txt242
-rw-r--r--videocodec/libvpx_internal/generic/vp8_rtcd.h301
-rw-r--r--videocodec/libvpx_internal/generic/vp9_rtcd.h291
-rw-r--r--videocodec/libvpx_internal/generic/vpx_config.c9
-rw-r--r--videocodec/libvpx_internal/generic/vpx_config.h93
-rw-r--r--videocodec/libvpx_internal/generic/vpx_scale_rtcd.h57
-rw-r--r--videocodec/libvpx_internal/generic/vpx_version.h7
-rw-r--r--videocodec/libvpx_internal/libvpx.mk166
-rw-r--r--videocodec/libvpx_internal/libvpx/.mailmap18
-rw-r--r--videocodec/libvpx_internal/libvpx/AUTHORS100
-rw-r--r--videocodec/libvpx_internal/libvpx/CHANGELOG584
-rw-r--r--videocodec/libvpx_internal/libvpx/LICENSE31
-rw-r--r--videocodec/libvpx_internal/libvpx/PATENTS22
-rw-r--r--videocodec/libvpx_internal/libvpx/README139
-rw-r--r--videocodec/libvpx_internal/libvpx/args.c238
-rw-r--r--videocodec/libvpx_internal/libvpx/args.h59
-rw-r--r--videocodec/libvpx_internal/libvpx/build/.gitattributes2
-rw-r--r--videocodec/libvpx_internal/libvpx/build/.gitignore1
-rw-r--r--videocodec/libvpx_internal/libvpx/build/arm-msvs/obj_int_extract.bat18
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/Android.mk216
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/Makefile434
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/ads2armasm_ms.pl39
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/ads2gas.pl236
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/ads2gas_apple.pl235
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/armlink_adapter.sh54
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/configure.sh1349
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/gen_asm_deps.sh64
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/gen_msvs_def.sh83
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/gen_msvs_proj.sh591
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/gen_msvs_sln.sh324
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/gen_msvs_vcxproj.sh563
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/obj_int_extract.c857
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/rtcd.pl414
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/thumb.pm70
-rw-r--r--videocodec/libvpx_internal/libvpx/build/make/version.sh76
-rw-r--r--videocodec/libvpx_internal/libvpx/build/x86-msvs/obj_int_extract.bat15
-rw-r--r--videocodec/libvpx_internal/libvpx/configure748
-rw-r--r--videocodec/libvpx_internal/libvpx/docs.mk54
-rw-r--r--videocodec/libvpx_internal/libvpx/examples.mk332
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/decode_to_md5.c139
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/decode_with_drops.c154
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/decode_with_partial_drops.c328
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/example_xma.c193
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/postproc.c140
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/resize_util.c120
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/set_maps.c243
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/simple_decoder.c158
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/simple_encoder.c252
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/twopass_encoder.c230
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/vp8_multi_resolution_encoder.c471
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/vp8cx_set_ref.c187
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/vp9_spatial_scalable_encoder.c391
-rw-r--r--videocodec/libvpx_internal/libvpx/examples/vpx_temporal_scalable_patterns.c667
-rw-r--r--videocodec/libvpx_internal/libvpx/ivfdec.c112
-rw-r--r--videocodec/libvpx_internal/libvpx/ivfdec.h28
-rw-r--r--videocodec/libvpx_internal/libvpx/ivfenc.c53
-rw-r--r--videocodec/libvpx_internal/libvpx/ivfenc.h35
-rw-r--r--videocodec/libvpx_internal/libvpx/keywords.dox51
-rw-r--r--videocodec/libvpx_internal/libvpx/libs.doxy_template1308
-rw-r--r--videocodec/libvpx_internal/libvpx/libs.mk533
-rw-r--r--videocodec/libvpx_internal/libvpx/mainpage.dox53
-rw-r--r--videocodec/libvpx_internal/libvpx/md5_utils.c241
-rw-r--r--videocodec/libvpx_internal/libvpx/md5_utils.h49
-rw-r--r--videocodec/libvpx_internal/libvpx/rate_hist.c282
-rw-r--r--videocodec/libvpx_internal/libvpx/rate_hist.h40
-rw-r--r--videocodec/libvpx_internal/libvpx/solution.mk32
-rw-r--r--videocodec/libvpx_internal/libvpx/test/acm_random.h67
-rw-r--r--videocodec/libvpx_internal/libvpx/test/active_map_test.cc92
-rw-r--r--videocodec/libvpx_internal/libvpx/test/altref_test.cc69
-rw-r--r--videocodec/libvpx_internal/libvpx/test/android/Android.mk42
-rw-r--r--videocodec/libvpx_internal/libvpx/test/android/README32
-rw-r--r--videocodec/libvpx_internal/libvpx/test/android/get_files.py118
-rw-r--r--videocodec/libvpx_internal/libvpx/test/android/scrape_gtest_log.py28
-rw-r--r--videocodec/libvpx_internal/libvpx/test/aq_segment_test.cc119
-rw-r--r--videocodec/libvpx_internal/libvpx/test/borders_test.cc83
-rw-r--r--videocodec/libvpx_internal/libvpx/test/clear_system_state.h29
-rw-r--r--videocodec/libvpx_internal/libvpx/test/codec_factory.h232
-rw-r--r--videocodec/libvpx_internal/libvpx/test/config_test.cc60
-rw-r--r--videocodec/libvpx_internal/libvpx/test/convolve_test.cc689
-rw-r--r--videocodec/libvpx_internal/libvpx/test/cpu_speed_test.cc113
-rw-r--r--videocodec/libvpx_internal/libvpx/test/cq_test.cc108
-rw-r--r--videocodec/libvpx_internal/libvpx/test/datarate_test.cc587
-rw-r--r--videocodec/libvpx_internal/libvpx/test/dct16x16_test.cc537
-rw-r--r--videocodec/libvpx_internal/libvpx/test/dct32x32_test.cc280
-rw-r--r--videocodec/libvpx_internal/libvpx/test/decode_perf_test.cc105
-rw-r--r--videocodec/libvpx_internal/libvpx/test/decode_test_driver.cc50
-rw-r--r--videocodec/libvpx_internal/libvpx/test/decode_test_driver.h131
-rw-r--r--videocodec/libvpx_internal/libvpx/test/encode_test_driver.cc225
-rw-r--r--videocodec/libvpx_internal/libvpx/test/encode_test_driver.h242
-rw-r--r--videocodec/libvpx_internal/libvpx/test/error_resilience_test.cc242
-rw-r--r--videocodec/libvpx_internal/libvpx/test/external_frame_buffer_test.cc468
-rw-r--r--videocodec/libvpx_internal/libvpx/test/fdct4x4_test.cc319
-rw-r--r--videocodec/libvpx_internal/libvpx/test/fdct8x8_test.cc343
-rw-r--r--videocodec/libvpx_internal/libvpx/test/i420_video_source.h118
-rw-r--r--videocodec/libvpx_internal/libvpx/test/idct8x8_test.cc138
-rw-r--r--videocodec/libvpx_internal/libvpx/test/idct_test.cc116
-rw-r--r--videocodec/libvpx_internal/libvpx/test/intrapred_test.cc386
-rw-r--r--videocodec/libvpx_internal/libvpx/test/ivf_video_source.h111
-rw-r--r--videocodec/libvpx_internal/libvpx/test/keyframe_test.cc145
-rw-r--r--videocodec/libvpx_internal/libvpx/test/md5_helper.h68
-rw-r--r--videocodec/libvpx_internal/libvpx/test/partial_idct_test.cc193
-rw-r--r--videocodec/libvpx_internal/libvpx/test/pp_filter_test.cc112
-rw-r--r--videocodec/libvpx_internal/libvpx/test/register_state_check.h150
-rw-r--r--videocodec/libvpx_internal/libvpx/test/resize_test.cc266
-rw-r--r--videocodec/libvpx_internal/libvpx/test/sad_test.cc556
-rw-r--r--videocodec/libvpx_internal/libvpx/test/set_roi.cc184
-rw-r--r--videocodec/libvpx_internal/libvpx/test/sixtap_predict_test.cc240
-rw-r--r--videocodec/libvpx_internal/libvpx/test/subtract_test.cc123
-rw-r--r--videocodec/libvpx_internal/libvpx/test/superframe_test.cc97
-rw-r--r--videocodec/libvpx_internal/libvpx/test/svc_test.cc472
-rw-r--r--videocodec/libvpx_internal/libvpx/test/test-data.sha1593
-rw-r--r--videocodec/libvpx_internal/libvpx/test/test.mk740
-rw-r--r--videocodec/libvpx_internal/libvpx/test/test_libvpx.cc69
-rw-r--r--videocodec/libvpx_internal/libvpx/test/test_vector_test.cc100
-rw-r--r--videocodec/libvpx_internal/libvpx/test/test_vectors.cc172
-rw-r--r--videocodec/libvpx_internal/libvpx/test/test_vectors.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/test/tile_independence_test.cc107
-rw-r--r--videocodec/libvpx_internal/libvpx/test/tools_common.sh437
-rw-r--r--videocodec/libvpx_internal/libvpx/test/util.h47
-rw-r--r--videocodec/libvpx_internal/libvpx/test/variance_test.cc709
-rw-r--r--videocodec/libvpx_internal/libvpx/test/video_source.h194
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vp8_boolcoder_test.cc120
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vp8_decrypt_test.cc73
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vp8_fdct4x4_test.cc164
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vp9_boolcoder_test.cc89
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vp9_lossless_test.cc95
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vp9_subtract_test.cc98
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vp9_thread_test.cc158
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vpxdec.sh65
-rw-r--r--videocodec/libvpx_internal/libvpx/test/vpxenc.sh96
-rw-r--r--videocodec/libvpx_internal/libvpx/test/webm_video_source.h191
-rw-r--r--videocodec/libvpx_internal/libvpx/test/y4m_video_source.h111
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/README.webm15
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/gtest.mk1
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/src/CHANGES157
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/src/CONTRIBUTORS37
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/src/LICENSE28
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/src/README435
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/src/include/gtest/gtest.h20061
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest-all.cc9592
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest_main.cc38
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.c52
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.h19
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlIDs.h231
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.c157
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.h42
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/Makefile25
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.c217
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.h32
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libmkv/testlibmkv.c62
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/AUTHORS.TXT4
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/LICENSE.TXT30
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/PATENTS.TXT22
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/README.webm7
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/RELEASE.TXT34
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.cpp3245
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.hpp1403
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxertypes.hpp30
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.cpp713
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.hpp151
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.cpp9617
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.hpp1079
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.cpp128
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.hpp38
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.cpp97
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.hpp51
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libwebm/webmids.hpp141
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libyuv/README.webm17
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/basic_types.h73
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/cpu_id.h49
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/scale.h70
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libyuv/source/cpu_id.c81
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libyuv/source/row.h264
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/libyuv/source/scale.c3884
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/0001-include-paths.diff41
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/0002-ne_read_simple-uninitialized_variable.diff21
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/AUTHORS3
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/INSTALL8
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/LICENSE13
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/README6
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/README.webm24
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/TODO21
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/README45
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/halloc.h43
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/align.h36
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/halloc.c254
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/hlist.h136
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/macros.h36
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/include/nestegg/nestegg.h353
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/src/nestegg.c2323
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/nestegg/test/test.c250
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/x86inc/LICENSE18
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/x86inc/README.webm11
-rw-r--r--videocodec/libvpx_internal/libvpx/third_party/x86inc/x86inc.asm1199
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/all_builds.py72
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/author_first_release.sh15
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/cpplint.py4756
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/diff.py130
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/ftfy.sh160
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/gen_authors.sh13
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/intersect-diffs.py76
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/lint-hunks.py144
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/vpx-astyle.sh27
-rw-r--r--videocodec/libvpx_internal/libvpx/tools/wrap-commit-msg.py70
-rw-r--r--videocodec/libvpx_internal/libvpx/tools_common.c267
-rw-r--r--videocodec/libvpx_internal/libvpx/tools_common.h153
-rw-r--r--videocodec/libvpx_internal/libvpx/usage.dox208
-rw-r--r--videocodec/libvpx_internal/libvpx/usage_cx.dox13
-rw-r--r--videocodec/libvpx_internal/libvpx/usage_dx.dox62
-rw-r--r--videocodec/libvpx_internal/libvpx/video_common.h23
-rw-r--r--videocodec/libvpx_internal/libvpx/video_reader.c83
-rw-r--r--videocodec/libvpx_internal/libvpx/video_reader.h52
-rw-r--r--videocodec/libvpx_internal/libvpx/video_writer.c80
-rw-r--r--videocodec/libvpx_internal/libvpx/video_writer.h47
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.c189
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.h31
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/bilinearfilter_v6.asm237
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem16x16_v6.asm186
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x4_v6.asm128
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x8_v6.asm128
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dc_only_idct_add_v6.asm70
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequant_idct_v6.asm190
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequantize_v6.asm69
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/filter_v6.asm624
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_blk_v6.c115
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_v6.asm202
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/intra4x4_predict_v6.asm611
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/iwalsh_v6.asm136
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/loopfilter_v6.asm1282
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/simpleloopfilter_v6.asm286
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm273
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_sad16x16_armv6.asm96
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance16x16_armv6.asm154
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance8x8_armv6.asm101
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm182
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm222
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm184
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.c113
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.h43
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/dequantize_arm.c42
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/filter_arm.c221
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/loopfilter_arm.c181
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/bilinearpredict_neon.c696
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm584
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/copymem_neon.c59
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dc_only_idct_add_neon.c42
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequant_idct_neon.c142
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequantizeb_neon.c27
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_blk_neon.c96
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_0_2x_neon.asm79
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_full_2x_neon.asm196
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/iwalsh_neon.asm87
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfilter_neon.asm397
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm117
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm154
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm469
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad16_neon.asm207
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad8_neon.asm209
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/save_reg_neon.asm36
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm139
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm490
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm422
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm473
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm524
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/variance_neon.asm276
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm423
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm572
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm222
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/reconintra_arm.c58
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/arm/variance_arm.c132
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/blockd.c22
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/blockd.h308
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/coefupdateprobs.h197
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/common.h48
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/context.c399
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/debugmodes.c157
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/default_coef_probs.h200
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/dequantize.c43
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/entropy.c189
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/entropy.h109
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/entropymode.c171
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/entropymode.h88
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/entropymv.c49
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/entropymv.h52
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/extend.c188
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/extend.h33
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/filter.c492
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/filter.h32
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.c193
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.h190
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/generic/systemdependent.c98
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/header.h51
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/idct_blk.c90
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/idctllm.c204
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/invtrans.h70
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.c663
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.h113
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/loopfilter_filters.c430
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mbpitch.c68
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mfqe.c385
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/dequantize_dspr2.c33
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/filter_dspr2.c2823
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idct_blk_dspr2.c88
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idctllm_dspr2.c369
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/loopfilter_filters_dspr2.c2622
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/reconinter_dspr2.c121
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/modecont.c40
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/modecont.h25
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/mv.h36
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/onyx.h270
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/onyxc_int.h185
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/onyxd.h63
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/postproc.c1201
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/postproc.h58
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/copy_altivec.asm47
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_altivec.asm1013
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_bilinear_altivec.asm677
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/idctllm_altivec.asm189
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_altivec.c135
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_filters_altivec.asm1253
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/platform_altivec.asm59
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/recon_altivec.asm175
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/sad_altivec.asm277
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/systemdependent.c165
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_altivec.asm375
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_subpixel_altivec.asm865
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/ppflags.h49
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/pragmas.h29
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/quant_common.c135
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/quant_common.h34
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/reconinter.c587
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/reconinter.h43
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/reconintra.c280
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.c297
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.h40
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/rtcd.c21
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/rtcd_defs.pl541
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/sad_c.c302
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.c39
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.h45
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.c34
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.h27
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/systemdependent.h27
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/textblit.c130
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/threading.h194
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/treecoder.c143
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/treecoder.h98
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/variance.h123
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/variance_c.c458
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/vp8_entropymodedata.h254
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/dequantize_mmx.asm258
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.c35
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.h33
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_mmx.c128
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_sse2.c89
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_mmx.asm295
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_sse2.asm708
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_mmx.asm140
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_sse2.asm121
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_block_sse2.asm815
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_mmx.asm1753
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_sse2.asm1640
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_x86.c198
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/mfqe_sse2.asm287
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_mmx.asm316
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_sse2.asm724
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_x86.c24
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_mmx.asm274
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_sse2.asm1082
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_wrapper_sse2.c186
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_mmx.asm427
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse2.asm410
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse3.asm960
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse4.asm353
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_ssse3.asm370
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_mmx.asm702
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_sse2.asm1372
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_ssse3.asm1508
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_mmx.asm851
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_sse2.asm1359
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_ssse3.asm364
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_mmx.c398
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_sse2.c558
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_ssse3.c166
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/common/x86/vp8_asm_stubs.c625
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.c75
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.h146
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/decodeframe.c1389
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.c667
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.h26
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/decoderthreading.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.c245
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.h27
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/ec_types.h58
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.c598
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.h49
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_if.c529
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_int.h159
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/threading.c910
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/decoder/treereader.h48
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm310
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm317
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm352
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm471
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm225
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm138
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm262
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_subtract_armv6.asm272
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/walsh_v6.asm212
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/boolhuff_arm.c41
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/dct_arm.c22
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/denoising_neon.c167
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm258
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/picklpf_arm.c46
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/shortfdct_neon.asm221
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/subtract_neon.asm199
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_memcpy_neon.asm70
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm116
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm103
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/arm/quantize_arm.c64
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.c1738
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.h54
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/block.h171
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.c70
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.h136
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/dct.c116
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_cost.h371
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_tokens.h712
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/defaultcoefcounts.h236
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.c306
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.h50
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.c1405
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.h35
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.c138
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.h29
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.c648
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.h34
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.c380
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.h29
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ethreading.c655
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.c3370
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.h32
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.c230
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.h117
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.c2031
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.h115
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.c54
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.h25
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.c236
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.h28
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_if.c5605
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_int.h732
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.c1299
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.h35
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/picklpf.c407
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/csystemdependent.c160
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/encodemb_altivec.asm153
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/fdct_altivec.asm205
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/rdopt_altivec.asm51
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.c815
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.h31
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.c1555
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.h37
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.c2644
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.h141
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.c66
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.h28
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/ssim.c233
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/temporal_filter.c518
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.c608
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.h58
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.c43
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.h134
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/vp8_asm_enc_offsets.c93
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_mmx.asm241
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_sse2.asm432
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/denoising_sse2.c121
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/encodeopt.asm386
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/fwalsh_sse2.asm164
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_mmx.asm286
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse2.c229
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse4.asm256
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_ssse3.asm138
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/ssim_opt.asm216
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_mmx.asm223
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_sse2.asm245
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm207
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_mmx.c78
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_sse2.c43
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/exports_dec2
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/exports_enc2
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/vp8_common.mk192
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/vp8_cx_iface.c1316
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/vp8_dx_iface.c951
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/vp8cx.mk112
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/vp8cx_arm.mk45
-rw-r--r--videocodec/libvpx_internal/libvpx/vp8/vp8dx.mk39
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_avg_neon.asm116
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_avg_neon.asm302
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_neon.asm280
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve_neon.c78
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_copy_neon.asm84
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_dc_only_idct_add_neon.asm69
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.asm198
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_add_neon.asm1179
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_neon.c172
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.asm144
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_add_neon.asm1299
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.asm68
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_add_neon.asm190
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.asm88
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_add_neon.asm519
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht4x4_add_neon.asm237
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht8x8_add_neon.asm698
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.asm199
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.c52
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_neon.asm708
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_mb_lpf_neon.asm606
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_reconintra_neon.asm634
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_save_reg_neon.asm36
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_common_dspr2.h125
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_dspr2.c281
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_horiz_dspr2.c833
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_dspr2.c784
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_horiz_dspr2.c713
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_vert_dspr2.c266
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_dspr2.c695
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_horiz_dspr2.c1038
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_dspr2.c1284
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_horiz_dspr2.c923
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_vert_dspr2.c396
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred16_dspr2.c332
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred4_dspr2.c232
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred8_dspr2.c610
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c1315
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c1073
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_dspr2.c1076
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c438
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c745
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.c362
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h763
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h478
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h373
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mbloop_loopfilter_dspr2.c652
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_horiz_loopfilter_dspr2.c795
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_vert_loopfilter_dspr2.c840
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.c253
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.h37
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.c155
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.h329
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_common.h95
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.c156
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.h39
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.c270
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_debugmodes.c80
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.c783
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.h192
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.c476
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.h113
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.c233
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.h132
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_enums.h107
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.c106
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.h60
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.c81
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.h53
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.c1406
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.h114
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.c1252
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.h137
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter_filters.c339
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_mv.h47
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.c365
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.h52
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_onyxc_int.h343
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.c977
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.h45
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_ppflags.h46
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_pragmas.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.c385
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.h141
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.c61
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.h93
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.c144
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.h37
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.c445
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.h71
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.c454
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd.c20
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd_defs.pl778
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.c122
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.h57
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.c387
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.h47
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.c75
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.h82
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_systemdependent.h83
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_tapify.py106
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.c120
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.h27
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.c51
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.h37
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_asm_stubs.c339
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_copy_sse2.asm152
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_idct_intrin_sse2.c4158
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_sse2.asm357
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_ssse3.asm1036
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_avx2.c943
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_sse2.c1716
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_mmx.asm626
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_mmx.asm534
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_sse2.asm695
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_x86.h72
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c543
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c490
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_sse2.asm987
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_ssse3.asm1060
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_sse2.asm448
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_ssse3.asm422
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.c1343
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.h32
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.c543
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.c442
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.h95
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.c211
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.c92
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.h27
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.c277
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.h59
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.c41
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.h45
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.c88
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.h111
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.c141
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.h207
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.c104
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.h34
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c324
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.h50
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.c148
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.h34
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.c1215
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.h29
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_block.h238
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.c62
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.h55
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_dct.c1386
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.c3511
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.h33
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.c627
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.h43
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.c265
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.h37
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.c143
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.h33
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.c2348
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.h103
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.c204
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.h107
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.c422
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.h40
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.c1751
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.h142
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_if.c3504
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_int.h640
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.c155
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.h30
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.c371
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.h31
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.c286
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.h59
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.c1329
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.h170
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.c4471
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.h88
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.c576
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.h68
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_sad.c324
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.c301
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.h56
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.c390
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.h330
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ssim.c142
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.c193
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.h42
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.c212
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.h77
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.c541
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.h27
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.c334
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.h61
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.c58
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.h51
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.c1111
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.h110
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.c34
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.h38
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.c35
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.h103
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_avx2.c2710
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_sse2.c2688
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_avx2.c2592
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_sse2.c2693
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_error_sse2.asm74
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_mcomp_x86.h48
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_quantize_ssse3.asm219
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_intrin_avx2.c167
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_sse2.asm231
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_mmx.asm427
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse2.asm267
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse3.asm378
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse4.asm359
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_ssse3.asm370
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_ssim_opt.asm216
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance.asm1420
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_intrin_avx2.c539
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_sse2.asm337
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subtract_sse2.asm127
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_temporal_filter_apply_sse2.asm207
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_avx2.c268
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_intrin_avx2.c213
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_mmx.asm510
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_sse2.asm734
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_mmx.c153
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_sse2.c551
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/exports_dec2
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/exports_enc2
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/vp9_common.mk147
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/vp9_cx_iface.c1199
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/vp9_dx_iface.c606
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/vp9_iface_common.h88
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/vp9cx.mk125
-rw-r--r--videocodec/libvpx_internal/libvpx/vp9/vp9dx.mk39
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/exports_com16
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/exports_dec10
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/exports_enc25
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/internal/vpx_codec_internal.h542
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/internal/vpx_psnr.h34
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/src/svc_encodeframe.c1144
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/src/vpx_codec.c184
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/src/vpx_decoder.c250
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/src/vpx_encoder.c405
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/src/vpx_image.c279
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/src/vpx_psnr.c24
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/svc_context.h153
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vp8.h138
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vp8cx.h375
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vp8dx.h118
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vpx_codec.h558
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vpx_codec.mk45
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vpx_decoder.h382
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vpx_encoder.h944
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vpx_frame_buffer.h84
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vpx_image.h248
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx/vpx_integer.h57
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_intrnl.h95
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_tracker.h179
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_alloc.c58
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_base.c405
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_dflt_abort.c53
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_grow.c49
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_largest.c57
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_resize.c114
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_shrink.c103
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_true.c31
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_if.h228
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_impl.h1152
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/heapmm.h155
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_cnfg.h120
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_intrnl.h159
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.c657
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.h173
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.mk22
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem_tracker.c740
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/arm.h35
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/arm_cpudetect.c192
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/asm_offsets.h31
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/config.h16
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/emmintrin_compat.h55
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/emms.asm38
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/mem.h47
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops.h226
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops_aligned.h163
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/vpx_once.h103
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/vpx_ports.mk25
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/vpx_timer.h117
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/x86.h266
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_ports/x86_abi_support.asm395
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm233
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm259
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm308
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/yv12extend_arm.c21
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/generic/gen_scalers.c240
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/generic/vpx_scale.c530
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12config.c287
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12extend.c177
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/mips/dspr2/yv12extend_dspr2.c148
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.h27
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.mk26
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_asm_offsets.c40
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.c18
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.pl34
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/win32/scaleopt.c525
-rw-r--r--videocodec/libvpx_internal/libvpx/vpx_scale/yv12config.h88
-rw-r--r--videocodec/libvpx_internal/libvpx/vpxdec.c994
-rw-r--r--videocodec/libvpx_internal/libvpx/vpxenc.c1815
-rw-r--r--videocodec/libvpx_internal/libvpx/vpxenc.h56
-rw-r--r--videocodec/libvpx_internal/libvpx/vpxstats.c122
-rw-r--r--videocodec/libvpx_internal/libvpx/vpxstats.h43
-rw-r--r--videocodec/libvpx_internal/libvpx/warnings.c115
-rw-r--r--videocodec/libvpx_internal/libvpx/warnings.h33
-rw-r--r--videocodec/libvpx_internal/libvpx/webmdec.c198
-rw-r--r--videocodec/libvpx_internal/libvpx/webmdec.h48
-rw-r--r--videocodec/libvpx_internal/libvpx/webmenc.c331
-rw-r--r--videocodec/libvpx_internal/libvpx/webmenc.h95
-rw-r--r--videocodec/libvpx_internal/libvpx/y4menc.c27
-rw-r--r--videocodec/libvpx_internal/libvpx/y4menc.h33
-rw-r--r--videocodec/libvpx_internal/libvpx/y4minput.c941
-rw-r--r--videocodec/libvpx_internal/libvpx/y4minput.h73
-rw-r--r--videocodec/libvpx_internal/libwebm.mk9
-rw-r--r--videocodec/libvpx_internal/libwebm/mkvparser.cpp8626
-rw-r--r--videocodec/libvpx_internal/libwebm/mkvparser.hpp896
-rw-r--r--videocodec/libvpx_internal/mips-dspr2/libvpx_srcs.txt275
-rw-r--r--videocodec/libvpx_internal/mips-dspr2/vp8_rtcd.h329
-rw-r--r--videocodec/libvpx_internal/mips-dspr2/vp9_rtcd.h337
-rw-r--r--videocodec/libvpx_internal/mips-dspr2/vpx_config.c9
-rw-r--r--videocodec/libvpx_internal/mips-dspr2/vpx_config.h93
-rw-r--r--videocodec/libvpx_internal/mips-dspr2/vpx_scale_rtcd.h69
-rw-r--r--videocodec/libvpx_internal/mips-dspr2/vpx_version.h7
-rw-r--r--videocodec/libvpx_internal/mips/libvpx_srcs.txt242
-rw-r--r--videocodec/libvpx_internal/mips/vp8_rtcd.h311
-rw-r--r--videocodec/libvpx_internal/mips/vp9_rtcd.h301
-rw-r--r--videocodec/libvpx_internal/mips/vpx_config.c9
-rw-r--r--videocodec/libvpx_internal/mips/vpx_config.h93
-rw-r--r--videocodec/libvpx_internal/mips/vpx_scale_rtcd.h67
-rw-r--r--videocodec/libvpx_internal/mips/vpx_version.h7
-rw-r--r--videocodec/libvpx_internal/x86/cpu-features.h56
-rw-r--r--videocodec/libvpx_internal/x86/libvpx_srcs.txt310
-rw-r--r--videocodec/libvpx_internal/x86/trace_conf.h9
-rw-r--r--videocodec/libvpx_internal/x86/vp8_asm_enc_offsets.asm44
-rw-r--r--videocodec/libvpx_internal/x86/vp8_rtcd.h843
-rw-r--r--videocodec/libvpx_internal/x86/vp9_rtcd.h614
-rw-r--r--videocodec/libvpx_internal/x86/vpx_config.asm80
-rw-r--r--videocodec/libvpx_internal/x86/vpx_config.c9
-rw-r--r--videocodec/libvpx_internal/x86/vpx_config.h93
-rw-r--r--videocodec/libvpx_internal/x86/vpx_scale_rtcd.h68
-rw-r--r--videocodec/libvpx_internal/x86/vpx_version.h7
872 files changed, 0 insertions, 336743 deletions
diff --git a/Android.mk b/Android.mk
index 72b0253..824d0da 100644
--- a/Android.mk
+++ b/Android.mk
@@ -7,5 +7,4 @@ INTEL_OMX_COMPONENT_ROOT := $(LOCAL_PATH)
#intel video codecs
include $(INTEL_OMX_COMPONENT_ROOT)/videocodec/Android.mk
-include $(INTEL_OMX_COMPONENT_ROOT)/videocodec/libvpx_internal/Android.mk
endif #BOARD_USES_MRST_OMX
diff --git a/videocodec/Android.mk b/videocodec/Android.mk
index 2c5a9ef..4917dd8 100755
--- a/videocodec/Android.mk
+++ b/videocodec/Android.mk
@@ -144,67 +144,6 @@ include $(BUILD_SHARED_LIBRARY)
endif
################################################################################
-
-# VP9 with SW decode and HW Render
-include $(CLEAR_VARS)
-
-ifeq ($(TARGET_HAS_ISV),true)
-LOCAL_CFLAGS += -DTARGET_HAS_ISV
-endif
-
-LOCAL_SHARED_LIBRARIES := \
- libwrs_omxil_common \
- libva_videodecoder \
- liblog \
- libva \
- libva-android \
- libva-tpi
-
-LOCAL_STATIC_LIBRARIES := \
- libvpx_internal
-
-LOCAL_C_INCLUDES := \
- $(TARGET_OUT_HEADERS)/wrs_omxil_core \
- $(TARGET_OUT_HEADERS)/khronos/openmax \
- $(TARGET_OUT_HEADERS)/libmix_videodecoder \
- $(TARGET_OUT_HEADERS)/libva \
- $(LOCAL_PATH)/libvpx_internal/libvpx \
- $(LOCAL_PATH)/libvpx_internal/libvpx/vpx_codec \
- $(LOCAL_PATH)/libvpx_internal/libvpx/vpx_ports \
- $(call include-path-for, frameworks-native)/media/hardware \
- $(call include-path-for, frameworks-native)/media/openmax \
- $(call include-path-for, libhardware)
-
-ifeq ($(TARGET_BOARD_PLATFORM),baytrail)
-LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/ufo
-endif
-
-LOCAL_SRC_FILES := \
- OMXComponentCodecBase.cpp \
- OMXVideoDecoderBase.cpp \
- OMXVideoDecoderVP9HWR.cpp
-
-LOCAL_CFLAGS += -Werror
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := libOMXVideoDecoderVP9HWR
-
-ifeq ($(TARGET_BOARD_PLATFORM),merrifield)
-LOCAL_CFLAGS += -DVED_TILING
-endif
-
-ifeq ($(TARGET_BOARD_PLATFORM),moorefield)
-LOCAL_CFLAGS += -DVED_TILING
-endif
-
-ifeq ($(TARGET_BOARD_PLATFORM),baytrail)
-LOCAL_CFLAGS += -DUSE_GEN_HW
-endif
-
-# TODO: Fix this.
-LOCAL_CFLAGS += -Wno-error=unused-variable
-
-include $(BUILD_SHARED_LIBRARY)
-
# VP9 hybrid decoder and HW Render
ifeq ($(TARGET_BOARD_PLATFORM),moorefield)
include $(CLEAR_VARS)
diff --git a/videocodec/OMXVideoDecoderVP9HWR.cpp b/videocodec/OMXVideoDecoderVP9HWR.cpp
deleted file mode 100644
index 684993d..0000000
--- a/videocodec/OMXVideoDecoderVP9HWR.cpp
+++ /dev/null
@@ -1,836 +0,0 @@
-/*
-* Copyright (c) 2012 Intel Corporation. All rights reserved.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "OMXVideoDecoderVP9HWR"
-#include <wrs_omxil_core/log.h>
-#include "OMXVideoDecoderVP9HWR.h"
-
-#include <system/window.h>
-#include <HardwareAPI.h>
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-#include <system/graphics.h>
-
-static const char* VP9_MIME_TYPE = "video/x-vnd.on2.vp9";
-
-static int GetCPUCoreCount()
-{
- int cpuCoreCount = 1;
-#if defined(_SC_NPROCESSORS_ONLN)
- cpuCoreCount = sysconf(_SC_NPROCESSORS_ONLN);
-#else
- // _SC_NPROC_ONLN must be defined...
- cpuCoreCount = sysconf(_SC_NPROC_ONLN);
-#endif
- if (cpuCoreCount < 1) {
- LOGW("Get CPU Core Count error.");
- cpuCoreCount = 1;
- }
- LOGV("Number of CPU cores: %d", cpuCoreCount);
- return cpuCoreCount;
-}
-
-
-OMXVideoDecoderVP9HWR::OMXVideoDecoderVP9HWR()
-{
- LOGV("OMXVideoDecoderVP9HWR is constructed.");
-
- mNumFrameBuffer = 0;
- mCtx = NULL;
-
- mNativeBufferCount = OUTPORT_NATIVE_BUFFER_COUNT;
- extUtilBufferCount = 0;
- extMappedNativeBufferCount = 0;
- BuildHandlerList();
-
- mDecodedImageWidth = 0;
- mDecodedImageHeight = 0;
- mDecodedImageNewWidth = 0;
- mDecodedImageNewHeight = 0;
-
-#ifdef DECODE_WITH_GRALLOC_BUFFER
- // setup va
- VAStatus vaStatus = VA_STATUS_SUCCESS;
- mDisplay = new Display;
- *mDisplay = ANDROID_DISPLAY_HANDLE;
-
- mVADisplay = vaGetDisplay(mDisplay);
- if (mVADisplay == NULL) {
- LOGE("vaGetDisplay failed.");
- }
-
- int majorVersion, minorVersion;
- vaStatus = vaInitialize(mVADisplay, &majorVersion, &minorVersion);
- if (vaStatus != VA_STATUS_SUCCESS) {
- LOGE("vaInitialize failed.");
- } else {
- LOGV("va majorVersion=%d, minorVersion=%d", majorVersion, minorVersion);
- }
-#endif
-}
-
-OMXVideoDecoderVP9HWR::~OMXVideoDecoderVP9HWR()
-{
- LOGV("OMXVideoDecoderVP9HWR is destructed.");
-
- if (mVADisplay) {
- vaTerminate(mVADisplay);
- mVADisplay = NULL;
- }
-}
-
-
-// Callback func for vpx decoder to get decode buffer
-// Now we map from the vaSurface to deploy gralloc buffer
-// as decode buffer
-int getVP9FrameBuffer(void *user_priv,
- unsigned int new_size,
- vpx_codec_frame_buffer_t *fb)
-{
- OMXVideoDecoderVP9HWR * p = (OMXVideoDecoderVP9HWR *)user_priv;
- if (fb == NULL) {
- return -1;
- }
-
- // TODO: Adaptive playback case needs to reconsider
- if (p->extNativeBufferSize < new_size) {
- LOGE("Provided frame buffer size < requesting min size.");
- return -1;
- }
-
- int i;
- for (i = 0; i < p->extMappedNativeBufferCount; i++ ) {
- if ((p->extMIDs[i]->m_render_done == true) &&
- (p->extMIDs[i]->m_released == true)) {
- fb->data = p->extMIDs[i]->m_usrAddr;
- fb->size = p->extNativeBufferSize;
- fb->fb_stride = p->extActualBufferStride;
- fb->fb_height_stride = p->extActualBufferHeightStride;
- fb->fb_index = i;
- p->extMIDs[i]->m_released = false;
- break;
- }
- }
-
- if (i == p->extMappedNativeBufferCount) {
- LOGE("No available frame buffer in pool.");
- return -1;
- }
- return 0;
-}
-
-// call back function from libvpx to inform frame buffer
-// not used anymore.
-int releaseVP9FrameBuffer(void *user_priv, vpx_codec_frame_buffer_t *fb)
-{
- int i;
- OMXVideoDecoderVP9HWR * p = (OMXVideoDecoderVP9HWR *)user_priv;
- if (fb == NULL) {
- return -1;
- }
- for (i = 0; i < p->extMappedNativeBufferCount; i++ ) {
- if (fb->data == p->extMIDs[i]->m_usrAddr) {
- p->extMIDs[i]->m_released = true;
- break;
- }
- }
-
- if (i == p->extMappedNativeBufferCount) {
- LOGE("Not found matching frame buffer in pool, libvpx's wrong?");
- return -1;
- }
- return 0;
-}
-
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::initDecoder()
-{
- mCtx = new vpx_codec_ctx_t;
- vpx_codec_err_t vpx_err;
- vpx_codec_dec_cfg_t cfg;
- memset(&cfg, 0, sizeof(vpx_codec_dec_cfg_t));
- cfg.threads = GetCPUCoreCount();
- if ((vpx_err = vpx_codec_dec_init(
- (vpx_codec_ctx_t *)mCtx,
- &vpx_codec_vp9_dx_algo,
- &cfg, 0))) {
- LOGE("on2 decoder failed to initialize. (%d)", vpx_err);
- return OMX_ErrorNotReady;
- }
-
- mNumFrameBuffer = OUTPORT_NATIVE_BUFFER_COUNT;
-
- if (vpx_codec_set_frame_buffer_functions((vpx_codec_ctx_t *)mCtx,
- getVP9FrameBuffer,
- releaseVP9FrameBuffer,
- this)) {
- LOGE("Failed to configure external frame buffers");
- return OMX_ErrorNotReady;
- }
-
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::destroyDecoder()
-{
- vpx_codec_destroy((vpx_codec_ctx_t *)mCtx);
- delete (vpx_codec_ctx_t *)mCtx;
- mCtx = NULL;
- return OMX_ErrorNone;
-}
-
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::InitInputPortFormatSpecific(
- OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput)
-{
- paramPortDefinitionInput->nBufferCountActual = INPORT_ACTUAL_BUFFER_COUNT;
- paramPortDefinitionInput->nBufferCountMin = INPORT_MIN_BUFFER_COUNT;
- paramPortDefinitionInput->nBufferSize = INPORT_BUFFER_SIZE;
- paramPortDefinitionInput->format.video.cMIMEType = (OMX_STRING)VP9_MIME_TYPE;
- paramPortDefinitionInput->format.video.eCompressionFormat = OMX_VIDEO_CodingVP9;
-
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorInit(void)
-{
- unsigned int i = 0;
-
- for (i = 0; i < MAX_NATIVE_BUFFER_COUNT; i++) {
- extMIDs[i] = (vaapiMemId*)malloc(sizeof(vaapiMemId));
- extMIDs[i]->m_usrAddr = NULL;
- extMIDs[i]->m_surface = new VASurfaceID;
- }
-
- initDecoder();
-
- if (RAWDATA_MODE == mWorkingMode) {
- OMX_PARAM_PORTDEFINITIONTYPE paramPortDefinitionInput;
-
- memcpy(&paramPortDefinitionInput,
- this->ports[INPORT_INDEX]->GetPortDefinition(),
- sizeof(paramPortDefinitionInput));
-
- extNativeBufferSize = INTERNAL_MAX_FRAME_WIDTH *
- INTERNAL_MAX_FRAME_HEIGHT * 1.5;
- extActualBufferStride = INTERNAL_MAX_FRAME_WIDTH;
- extActualBufferHeightStride = INTERNAL_MAX_FRAME_HEIGHT;
-
- for (i = 0; i < OUTPORT_ACTUAL_BUFFER_COUNT; i++ ) {
- extMIDs[i]->m_usrAddr = (unsigned char*)malloc(sizeof(unsigned char) *
- extNativeBufferSize);
- extMIDs[i]->m_render_done = true;
- extMIDs[i]->m_released = true;
- }
- extMappedNativeBufferCount = OUTPORT_ACTUAL_BUFFER_COUNT;
- return OMX_ErrorNone;
- }
-
-#ifdef DECODE_WITH_GRALLOC_BUFFER
- if (mOMXBufferHeaderTypePtrNum > MAX_NATIVE_BUFFER_COUNT) {
- LOGE("Actual OMX outport buffer header type num (%d) > MAX_NATIVE_BUFFER_COUNT (%d)",
- mOMXBufferHeaderTypePtrNum, MAX_NATIVE_BUFFER_COUNT);
- return OMX_ErrorOverflow;
- }
-
- OMX_PARAM_PORTDEFINITIONTYPE paramPortDefinitionInput;
-
- memcpy(&paramPortDefinitionInput,
- this->ports[INPORT_INDEX]->GetPortDefinition(),
- sizeof(paramPortDefinitionInput));
-
- int surfaceWidth = mGraphicBufferParam.graphicBufferWidth;
- int surfaceHeight = mGraphicBufferParam.graphicBufferHeight;
- int surfaceHStride = mGraphicBufferParam.graphicBufferHStride;
- int surfaceVStride = mGraphicBufferParam.graphicBufferVStride;
- extNativeBufferSize = mGraphicBufferParam.graphicBufferHStride *
- mGraphicBufferParam.graphicBufferVStride * 1.5;
- extActualBufferStride = surfaceHStride;
- extActualBufferHeightStride = surfaceVStride;
-
- for (i = 0; i < mOMXBufferHeaderTypePtrNum; i++) {
- OMX_BUFFERHEADERTYPE *buf_hdr = mOMXBufferHeaderTypePtrArray[i];
-
- extMIDs[i]->m_key = (unsigned int)(buf_hdr->pBuffer);
- extMIDs[i]->m_render_done = false;
- extMIDs[i]->m_released = true;
-
- VAStatus va_res;
- unsigned int buffer;
- VASurfaceAttrib attribs[2];
- VASurfaceAttribExternalBuffers* surfExtBuf = new VASurfaceAttribExternalBuffers;
- int32_t format = VA_RT_FORMAT_YUV420;
-
- surfExtBuf->buffers= (unsigned long *)&buffer;
- surfExtBuf->num_buffers = 1;
- surfExtBuf->pixel_format = VA_FOURCC_NV12;
- surfExtBuf->width = surfaceWidth;
- surfExtBuf->height = surfaceHeight;
- surfExtBuf->data_size = surfaceHStride * surfaceVStride * 1.5;
- surfExtBuf->num_planes = 2;
- surfExtBuf->pitches[0] = surfaceHStride;
- surfExtBuf->pitches[1] = surfaceHStride;
- surfExtBuf->pitches[2] = 0;
- surfExtBuf->pitches[3] = 0;
- surfExtBuf->offsets[0] = 0;
- surfExtBuf->offsets[1] = surfaceHStride * surfaceVStride;
- surfExtBuf->offsets[2] = 0;
- surfExtBuf->offsets[3] = 0;
- surfExtBuf->flags = VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC;
-
- surfExtBuf->buffers[0] = (unsigned int)buf_hdr->pBuffer;
-
- attribs[0].type = (VASurfaceAttribType)VASurfaceAttribMemoryType;
- attribs[0].flags = VA_SURFACE_ATTRIB_SETTABLE;
- attribs[0].value.type = VAGenericValueTypeInteger;
- attribs[0].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC;
-
- attribs[1].type = (VASurfaceAttribType)VASurfaceAttribExternalBufferDescriptor;
- attribs[1].flags = VA_SURFACE_ATTRIB_SETTABLE;
- attribs[1].value.type = VAGenericValueTypePointer;
- attribs[1].value.value.p = (void *)surfExtBuf;
-
- va_res = vaCreateSurfaces(mVADisplay,
- format,
- surfaceWidth,
- surfaceHeight,
- extMIDs[i]->m_surface,
- 1,
- attribs,
- 2);
-
- if (va_res != VA_STATUS_SUCCESS) {
- LOGE("Failed to create vaSurface!");
- return OMX_ErrorUndefined;
- }
-
- delete surfExtBuf;
-
- VAImage image;
- unsigned char* usrptr;
-
- va_res = vaDeriveImage(mVADisplay, *(extMIDs[i]->m_surface), &image);
- if (VA_STATUS_SUCCESS == va_res) {
- va_res = vaMapBuffer(mVADisplay, image.buf, (void **) &usrptr);
- if (VA_STATUS_SUCCESS == va_res) {
- extMIDs[i]->m_usrAddr = usrptr;
- vaUnmapBuffer(mVADisplay, image.buf);
- }
- vaDestroyImage(mVADisplay, image.image_id);
- }
- extMappedNativeBufferCount++;
- }
- return OMX_ErrorNone;
-#endif
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorDeinit(void)
-{
- destroyDecoder();
- unsigned int i = 0;
- if (mWorkingMode == GRAPHICBUFFER_MODE) {
- for (i = 0; i < mOMXBufferHeaderTypePtrNum; i++) {
- if (extMIDs[i]->m_surface != NULL) {
- vaDestroySurfaces(mVADisplay, extMIDs[i]->m_surface, 1);
- }
- }
-
- } else if (mWorkingMode == RAWDATA_MODE) {
- for (i = 0; i < OUTPORT_ACTUAL_BUFFER_COUNT; i++ ) {
- if (extMIDs[i]->m_usrAddr != NULL) {
- free(extMIDs[i]->m_usrAddr);
- extMIDs[i]->m_usrAddr = NULL;
- }
- }
- }
- mOMXBufferHeaderTypePtrNum = 0;
- memset(&mGraphicBufferParam, 0, sizeof(mGraphicBufferParam));
- for (i = 0; i < MAX_NATIVE_BUFFER_COUNT; i++) {
- delete extMIDs[i]->m_surface;
- free(extMIDs[i]);
- }
- return OMXComponentCodecBase::ProcessorDeinit();
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorStop(void)
-{
- return OMXComponentCodecBase::ProcessorStop();
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorFlush(OMX_U32)
-{
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorPreFillBuffer(OMX_BUFFERHEADERTYPE* buffer)
-{
- unsigned int handle = (unsigned int)buffer->pBuffer;
- unsigned int i = 0;
-
- if (buffer->nOutputPortIndex == OUTPORT_INDEX){
- for (i = 0; i < mOMXBufferHeaderTypePtrNum; i++) {
- if (handle == extMIDs[i]->m_key) {
- extMIDs[i]->m_render_done = true;
- break;
- }
- }
- }
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorProcess(
- OMX_BUFFERHEADERTYPE ***pBuffers,
- buffer_retain_t *retains,
- OMX_U32)
-{
- OMX_ERRORTYPE ret;
- OMX_BUFFERHEADERTYPE *inBuffer = *pBuffers[INPORT_INDEX];
- OMX_BOOL isResolutionChange = OMX_FALSE;
-
- if (inBuffer->pBuffer == NULL) {
- LOGE("Buffer to decode is empty.");
- return OMX_ErrorBadParameter;
- }
-
- if (inBuffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
- LOGI("Buffer has OMX_BUFFERFLAG_CODECCONFIG flag.");
- }
-
- if (inBuffer->nFlags & OMX_BUFFERFLAG_DECODEONLY) {
- LOGW("Buffer has OMX_BUFFERFLAG_DECODEONLY flag.");
- }
-
- if (inBuffer->nFlags & OMX_BUFFERFLAG_EOS) {
- if (inBuffer->nFilledLen == 0) {
- (*pBuffers[OUTPORT_INDEX])->nFilledLen = 0;
- (*pBuffers[OUTPORT_INDEX])->nFlags = OMX_BUFFERFLAG_EOS;
- return OMX_ErrorNone;
- }
- }
-
- if (vpx_codec_decode((vpx_codec_ctx_t *)mCtx,
- inBuffer->pBuffer + inBuffer->nOffset,
- inBuffer->nFilledLen,
- NULL,
- 0)) {
- LOGE("on2 decoder failed to decode frame.");
- return OMX_ErrorBadParameter;
- }
-
- ret = FillRenderBuffer(pBuffers[OUTPORT_INDEX],
- &retains[OUTPORT_INDEX],
- ((*pBuffers[INPORT_INDEX]))->nFlags,
- &isResolutionChange);
-
- if (ret == OMX_ErrorNone) {
- (*pBuffers[OUTPORT_INDEX])->nTimeStamp = inBuffer->nTimeStamp;
- }
-
- if (isResolutionChange) {
- HandleFormatChange();
- }
-
- bool inputEoS = ((*pBuffers[INPORT_INDEX])->nFlags & OMX_BUFFERFLAG_EOS);
- bool outputEoS = ((*pBuffers[OUTPORT_INDEX])->nFlags & OMX_BUFFERFLAG_EOS);
- // if output port is not eos, retain the input buffer
- // until all the output buffers are drained.
- if (inputEoS && !outputEoS) {
- retains[INPORT_INDEX] = BUFFER_RETAIN_GETAGAIN;
- // the input buffer is retained for draining purpose.
- // Set nFilledLen to 0 so buffer will not be decoded again.
- (*pBuffers[INPORT_INDEX])->nFilledLen = 0;
- }
-
- if (ret == OMX_ErrorNotReady) {
- retains[OUTPORT_INDEX] = BUFFER_RETAIN_GETAGAIN;
- ret = OMX_ErrorNone;
- }
-
- return ret;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorReset(void)
-{
- return OMX_ErrorNone;
-}
-
-static int ALIGN(int x, int y)
-{
- // y must be a power of 2.
- return (x + y - 1) & ~(y - 1);
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::HandleFormatChange(void)
-{
- mDecodedImageWidth = mDecodedImageNewWidth;
- mDecodedImageHeight = mDecodedImageNewHeight;
-
- // Sync port definition as it may change.
- OMX_PARAM_PORTDEFINITIONTYPE paramPortDefinitionInput, paramPortDefinitionOutput;
-
- memcpy(&paramPortDefinitionInput,
- this->ports[INPORT_INDEX]->GetPortDefinition(),
- sizeof(paramPortDefinitionInput));
-
- memcpy(&paramPortDefinitionOutput,
- this->ports[OUTPORT_INDEX]->GetPortDefinition(),
- sizeof(paramPortDefinitionOutput));
-
- uint32_t width = mDecodedImageWidth;
- uint32_t height = mDecodedImageHeight;
- uint32_t stride = mDecodedImageWidth;
- uint32_t sliceHeight = mDecodedImageHeight;
-
- uint32_t widthCropped = mDecodedImageWidth;
- uint32_t heightCropped = mDecodedImageHeight;
- uint32_t strideCropped = widthCropped;
- uint32_t sliceHeightCropped = heightCropped;
-
- if (widthCropped == paramPortDefinitionOutput.format.video.nFrameWidth &&
- heightCropped == paramPortDefinitionOutput.format.video.nFrameHeight) {
- if (mWorkingMode == RAWDATA_MODE) {
- LOGW("Change of portsetting is not reported as size is not changed.");
- return OMX_ErrorNone;
- }
- }
-
- paramPortDefinitionInput.format.video.nFrameWidth = width;
- paramPortDefinitionInput.format.video.nFrameHeight = height;
- paramPortDefinitionInput.format.video.nStride = stride;
- paramPortDefinitionInput.format.video.nSliceHeight = sliceHeight;
-
- if (mWorkingMode == RAWDATA_MODE) {
- paramPortDefinitionOutput.format.video.nFrameWidth = widthCropped;
- paramPortDefinitionOutput.format.video.nFrameHeight = heightCropped;
- paramPortDefinitionOutput.format.video.nStride = strideCropped;
- paramPortDefinitionOutput.format.video.nSliceHeight = sliceHeightCropped;
- } else if (mWorkingMode == GRAPHICBUFFER_MODE) {
- // when the width and height ES parse are not larger than allocated graphic buffer in outport,
- // there is no need to reallocate graphic buffer,just report the crop info to omx client
- if (width <= mGraphicBufferParam.graphicBufferWidth &&
- height <= mGraphicBufferParam.graphicBufferHeight) {
- this->ports[INPORT_INDEX]->SetPortDefinition(&paramPortDefinitionInput, true);
- this->ports[OUTPORT_INDEX]->ReportOutputCrop();
- return OMX_ErrorNone;
- }
-
- if (width > mGraphicBufferParam.graphicBufferWidth ||
- height > mGraphicBufferParam.graphicBufferHeight) {
- // update the real decoded resolution to outport instead of display resolution
- // for graphic buffer reallocation
- // when the width and height parsed from ES are larger than allocated graphic buffer in outport,
- paramPortDefinitionOutput.format.video.nFrameWidth = width;
- paramPortDefinitionOutput.format.video.nFrameHeight = (height + 0x1f) & ~0x1f;
- paramPortDefinitionOutput.format.video.eColorFormat = GetOutputColorFormat(
- paramPortDefinitionOutput.format.video.nFrameWidth);
- paramPortDefinitionOutput.format.video.nStride = stride;
- paramPortDefinitionOutput.format.video.nSliceHeight = sliceHeight;
- }
- }
-
- paramPortDefinitionOutput.bEnabled = (OMX_BOOL)false;
- mOMXBufferHeaderTypePtrNum = 0;
- memset(&mGraphicBufferParam, 0, sizeof(mGraphicBufferParam));
-
- this->ports[INPORT_INDEX]->SetPortDefinition(&paramPortDefinitionInput, true);
- this->ports[OUTPORT_INDEX]->SetPortDefinition(&paramPortDefinitionOutput, true);
-
- this->ports[OUTPORT_INDEX]->ReportPortSettingsChanged();
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::FillRenderBuffer(OMX_BUFFERHEADERTYPE **pBuffer,
- buffer_retain_t *retain,
- OMX_U32 inportBufferFlags,
- OMX_BOOL *isResolutionChange)
-{
- OMX_BUFFERHEADERTYPE *buffer = *pBuffer;
- OMX_BUFFERHEADERTYPE *buffer_orign = buffer;
-
- OMX_ERRORTYPE ret = OMX_ErrorNone;
-
- vpx_codec_iter_t iter = NULL;
- vpx_image_t *img = NULL;
- img = vpx_codec_get_frame((vpx_codec_ctx_t *)mCtx, &iter);
-
- if (img != NULL) {
- if ((mDecodedImageWidth == 0) && (mDecodedImageHeight == 0)) { // init value
- mDecodedImageWidth = img->d_w;
- mDecodedImageHeight = img->d_h;
- }
- if ((mDecodedImageWidth != img->d_w) && (mDecodedImageHeight != img->d_h)) {
- mDecodedImageNewWidth = img->d_w;
- mDecodedImageNewHeight = img->d_h;
- *isResolutionChange = OMX_TRUE;
- }
- }
-
- if (mWorkingMode == RAWDATA_MODE) {
- if (img == NULL) {
- LOGE("vpx_codec_get_frame return NULL.");
- return OMX_ErrorNotReady;
- }
-
- // in Raw data mode, this flag should be always true
- extMIDs[img->fb_index]->m_render_done = true;
-
- void *dst = buffer->pBuffer;
- uint8_t *dst_y = (uint8_t *)dst;
-
- const OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionOutput
- = this->ports[OUTPORT_INDEX]->GetPortDefinition();
-
- size_t dst_y_size = paramPortDefinitionOutput->format.video.nStride *
- paramPortDefinitionOutput->format.video.nFrameHeight;
- size_t dst_c_stride = ALIGN(paramPortDefinitionOutput->format.video.nStride / 2, 16);
- size_t dst_c_size = dst_c_stride * paramPortDefinitionOutput->format.video.nFrameHeight / 2;
- uint8_t *dst_v = dst_y + dst_y_size;
- uint8_t *dst_u = dst_v + dst_c_size;
-
- //test border
- dst_y += VPX_DECODE_BORDER * paramPortDefinitionOutput->format.video.nStride + VPX_DECODE_BORDER;
- dst_v += (VPX_DECODE_BORDER/2) * dst_c_stride + (VPX_DECODE_BORDER/2);
- dst_u += (VPX_DECODE_BORDER/2) * dst_c_stride + (VPX_DECODE_BORDER/2);
-
- const uint8_t *srcLine = (const uint8_t *)img->planes[PLANE_Y];
-
- for (size_t i = 0; i < img->d_h; ++i) {
- memcpy(dst_y, srcLine, img->d_w);
-
- srcLine += img->stride[PLANE_Y];
- dst_y += paramPortDefinitionOutput->format.video.nStride;
- }
-
- srcLine = (const uint8_t *)img->planes[PLANE_U];
- for (size_t i = 0; i < img->d_h / 2; ++i) {
- memcpy(dst_u, srcLine, img->d_w / 2);
-
- srcLine += img->stride[PLANE_U];
- dst_u += dst_c_stride;
- }
-
- srcLine = (const uint8_t *)img->planes[PLANE_V];
- for (size_t i = 0; i < img->d_h / 2; ++i) {
- memcpy(dst_v, srcLine, img->d_w / 2);
-
- srcLine += img->stride[PLANE_V];
- dst_v += dst_c_stride;
- }
-
- buffer->nOffset = 0;
- buffer->nFilledLen = dst_y_size + dst_c_size * 2;
- if (inportBufferFlags & OMX_BUFFERFLAG_EOS) {
- buffer->nFlags = OMX_BUFFERFLAG_EOS;
- }
-
- if (buffer_orign != buffer) {
- *retain = BUFFER_RETAIN_OVERRIDDEN;
- }
- ret = OMX_ErrorNone;
-
- return ret;
-
- }
-
-#ifdef DECODE_WITH_GRALLOC_BUFFER
- if (NULL != img) {
- buffer = *pBuffer = mOMXBufferHeaderTypePtrArray[img->fb_index];
-
- if ((unsigned int)(buffer->pBuffer) != extMIDs[img->fb_index]->m_key) {
- LOGE("There is gralloc handle mismatching between pool\
- and mOMXBufferHeaderTypePtrArray.");
- return OMX_ErrorNotReady;
- }
-
- extMIDs[img->fb_index]->m_render_done = false;
-
- buffer->nOffset = 0;
-
- size_t dst_y_size = img->d_w * img->d_h;
-
- buffer->nFilledLen = dst_y_size * 1.5; // suport only 4:2:0 for now
-
- if (inportBufferFlags & OMX_BUFFERFLAG_EOS) {
- buffer->nFlags = OMX_BUFFERFLAG_EOS;
- }
-
- if (buffer_orign != buffer) {
- *retain = BUFFER_RETAIN_OVERRIDDEN;
- }
-
- return OMX_ErrorNone;
- } else {
- LOGE("vpx_codec_get_frame return NULL.");
- return OMX_ErrorNotReady;
- }
-#endif
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::PrepareConfigBuffer(VideoConfigBuffer *)
-{
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::PrepareDecodeBuffer(OMX_BUFFERHEADERTYPE *,
- buffer_retain_t *,
- VideoDecodeBuffer *)
-{
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::BuildHandlerList(void)
-{
- OMXVideoDecoderBase::BuildHandlerList();
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::GetParamVideoVp9(OMX_PTR)
-{
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::SetParamVideoVp9(OMX_PTR)
-{
- return OMX_ErrorNone;
-}
-
-OMX_COLOR_FORMATTYPE OMXVideoDecoderVP9HWR::GetOutputColorFormat(int)
-{
- LOGV("Output color format is OMX_INTEL_COLOR_FormatHalYV12.");
- return (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YV12;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::GetDecoderOutputCropSpecific(OMX_PTR pStructure)
-{
- OMX_ERRORTYPE ret = OMX_ErrorNone;
- OMX_CONFIG_RECTTYPE *rectParams = (OMX_CONFIG_RECTTYPE *)pStructure;
-
- CHECK_TYPE_HEADER(rectParams);
-
- if (rectParams->nPortIndex != OUTPORT_INDEX) {
- return OMX_ErrorUndefined;
- }
-
- const OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput
- = this->ports[INPORT_INDEX]->GetPortDefinition();
-
- rectParams->nLeft = VPX_DECODE_BORDER;
- rectParams->nTop = VPX_DECODE_BORDER;
- rectParams->nWidth = paramPortDefinitionInput->format.video.nFrameWidth;
- rectParams->nHeight = paramPortDefinitionInput->format.video.nFrameHeight;
-
- return ret;
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::GetNativeBufferUsageSpecific(OMX_PTR pStructure)
-{
- OMX_ERRORTYPE ret;
- android::GetAndroidNativeBufferUsageParams *param =
- (android::GetAndroidNativeBufferUsageParams*)pStructure;
- CHECK_TYPE_HEADER(param);
-
- param->nUsage |= (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_NEVER \
- | GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_EXTERNAL_DISP);
- return OMX_ErrorNone;
-
-}
-
-OMX_ERRORTYPE OMXVideoDecoderVP9HWR::SetNativeBufferModeSpecific(OMX_PTR pStructure)
-{
- OMX_ERRORTYPE ret;
- EnableAndroidNativeBuffersParams *param =
- (EnableAndroidNativeBuffersParams*)pStructure;
-
- CHECK_TYPE_HEADER(param);
- CHECK_PORT_INDEX_RANGE(param);
- CHECK_SET_PARAM_STATE();
-
- if (!param->enable) {
- mWorkingMode = RAWDATA_MODE;
- return OMX_ErrorNone;
- }
- mWorkingMode = GRAPHICBUFFER_MODE;
- PortVideo *port = NULL;
- port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
-
-
- OMX_PARAM_PORTDEFINITIONTYPE port_def;
- memcpy(&port_def,port->GetPortDefinition(),sizeof(port_def));
- port_def.nBufferCountMin = mNativeBufferCount;
- port_def.nBufferCountActual = mNativeBufferCount;
- port_def.format.video.cMIMEType = (OMX_STRING)VA_VED_RAW_MIME_TYPE;
- port_def.format.video.eColorFormat = OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar;
-
- // add borders for libvpx decode need.
- port_def.format.video.nFrameHeight += VPX_DECODE_BORDER * 2;
- port_def.format.video.nFrameWidth += VPX_DECODE_BORDER * 2;
- // make heigth 32bit align
- port_def.format.video.nFrameHeight = (port_def.format.video.nFrameHeight + 0x1f) & ~0x1f;
- port_def.format.video.eColorFormat = GetOutputColorFormat(
- port_def.format.video.nFrameWidth);
- port->SetPortDefinition(&port_def,true);
-
- return OMX_ErrorNone;
-}
-
-
-bool OMXVideoDecoderVP9HWR::IsAllBufferAvailable(void)
-{
- bool b = ComponentBase::IsAllBufferAvailable();
- if (b == false) {
- return false;
- }
-
- PortVideo *port = NULL;
- port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
- const OMX_PARAM_PORTDEFINITIONTYPE* port_def = port->GetPortDefinition();
- // if output port is disabled, retain the input buffer
- if (!port_def->bEnabled) {
- return false;
- }
-
- unsigned int i = 0;
- int found = 0;
-
- if (RAWDATA_MODE == mWorkingMode) {
- for (i = 0; i < OUTPORT_ACTUAL_BUFFER_COUNT; i++) {
- if (extMIDs[i]->m_released == true) {
- found ++;
- if (found > 1) { //libvpx sometimes needs 2 buffer when calling decode once.
- return true;
- }
- }
- }
- } else { // graphic buffer mode
- for (i = 0; i < mOMXBufferHeaderTypePtrNum; i++) {
- if ((extMIDs[i]->m_render_done == true) && (extMIDs[i]->m_released == true)) {
- found ++;
- if (found > 1) { //libvpx sometimes needs 2 buffer when calling decode once.
- return true;
- }
- }
- }
- }
-
- b = false;
-
- return b;
-}
-
-DECLARE_OMX_COMPONENT("OMX.Intel.VideoDecoder.VP9.hwr", "video_decoder.vp9", OMXVideoDecoderVP9HWR);
-
diff --git a/videocodec/OMXVideoDecoderVP9HWR.h b/videocodec/OMXVideoDecoderVP9HWR.h
deleted file mode 100644
index e55f54e..0000000
--- a/videocodec/OMXVideoDecoderVP9HWR.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-* Copyright (c) 2012 Intel Corporation. All rights reserved.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-#ifndef OMX_VIDEO_DECODER_VP9HWR_H_
-#define OMX_VIDEO_DECODER_VP9HWR_H_
-
-#include "OMXVideoDecoderBase.h"
-#include "vpx/vpx_decoder.h"
-#include "vpx/vpx_codec.h"
-#include "vpx/vp8dx.h"
-#include <va/va.h>
-#include <va/va_android.h>
-#include <va/va_tpi.h>
-
-// VAAPI Allocator internal Mem ID
-typedef struct vaapiMemId
-{
- VASurfaceID* m_surface;
- unsigned int m_key; //Gralloc handle from which this srf was created
- unsigned char* m_usrAddr;
- bool m_render_done;
- bool m_released;
-}vaapiMemId;
-
-typedef unsigned int Display;
-#define ANDROID_DISPLAY_HANDLE 0x18c34078
-
-#define DECODE_WITH_GRALLOC_BUFFER
-#define VPX_DECODE_BORDER 0
-
-#define MAX_NATIVE_BUFFER_COUNT 64
-
-class OMXVideoDecoderVP9HWR : public OMXVideoDecoderBase {
-public:
- OMXVideoDecoderVP9HWR();
- virtual ~OMXVideoDecoderVP9HWR();
- vaapiMemId* extMIDs[MAX_NATIVE_BUFFER_COUNT];
- int extUtilBufferCount;
- int extMappedNativeBufferCount;
- unsigned int extNativeBufferSize;
- // (or mapped from vaSurface) to a pre-set max size.
- int extActualBufferStride;
- int extActualBufferHeightStride;
-
-protected:
- virtual OMX_ERRORTYPE InitInputPortFormatSpecific(OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput);
- virtual OMX_ERRORTYPE ProcessorInit(void);
- virtual OMX_ERRORTYPE ProcessorDeinit(void);
- virtual OMX_ERRORTYPE ProcessorStop(void);
- virtual OMX_ERRORTYPE ProcessorFlush(OMX_U32 portIndex);
- virtual OMX_ERRORTYPE ProcessorProcess(
- OMX_BUFFERHEADERTYPE ***pBuffers,
- buffer_retain_t *retains,
- OMX_U32 numberBuffers);
- virtual OMX_ERRORTYPE ProcessorReset(void);
-
- virtual OMX_ERRORTYPE ProcessorPreFillBuffer(OMX_BUFFERHEADERTYPE* buffer);
- virtual bool IsAllBufferAvailable(void);
-
- virtual OMX_ERRORTYPE PrepareConfigBuffer(VideoConfigBuffer *p);
- virtual OMX_ERRORTYPE PrepareDecodeBuffer(OMX_BUFFERHEADERTYPE *buffer, buffer_retain_t *retain, VideoDecodeBuffer *p);
-
- virtual OMX_ERRORTYPE BuildHandlerList(void);
-
- virtual OMX_ERRORTYPE FillRenderBuffer(OMX_BUFFERHEADERTYPE **pBuffer,
- buffer_retain_t *retain,
- OMX_U32 inportBufferFlags,
- OMX_BOOL *isResolutionChange);
-
- virtual OMX_ERRORTYPE HandleFormatChange(void);
-
- virtual OMX_COLOR_FORMATTYPE GetOutputColorFormat(int width);
- virtual OMX_ERRORTYPE GetDecoderOutputCropSpecific(OMX_PTR pStructure);
- virtual OMX_ERRORTYPE GetNativeBufferUsageSpecific(OMX_PTR pStructure);
- virtual OMX_ERRORTYPE SetNativeBufferModeSpecific(OMX_PTR pStructure);
-
- friend int reallocVP9FrameBuffer(void *user_priv, unsigned int new_size, vpx_codec_frame_buffer_t *fb);
-
- DECLARE_HANDLER(OMXVideoDecoderVP9HWR, ParamVideoVp9);
-private:
- OMX_ERRORTYPE initDecoder();
- OMX_ERRORTYPE destroyDecoder();
-
- enum {
- // OMX_PARAM_PORTDEFINITIONTYPE
- INPORT_MIN_BUFFER_COUNT = 1,
- INPORT_ACTUAL_BUFFER_COUNT = 5,
- INPORT_BUFFER_SIZE = 1382400,
- OUTPORT_NATIVE_BUFFER_COUNT = 12, // 8 reference + 1 current + 3 for asynchronized mode
- OUTPORT_ACTUAL_BUFFER_COUNT = 12, // for raw data mode
- INTERNAL_MAX_FRAME_WIDTH = 1920,
- INTERNAL_MAX_FRAME_HEIGHT = 1088,
- };
-
- void *mCtx;
-
- //OMX_VIDEO_PARAM_VP9TYPE mParamVp9;
- vpx_codec_frame_buffer_t* mFrameBuffers;
- int mNumFrameBuffer;
-
- // These members are for Adaptive playback
- uint32_t mDecodedImageWidth;
- uint32_t mDecodedImageHeight;
- uint32_t mDecodedImageNewWidth;
- uint32_t mDecodedImageNewHeight;
-
- Display* mDisplay;
- VADisplay mVADisplay;
-};
-
-#endif /* OMX_VIDEO_DECODER_VP9HWR_H_ */
-
diff --git a/videocodec/libvpx_internal/Android.mk b/videocodec/libvpx_internal/Android.mk
deleted file mode 100644
index 327dce5..0000000
--- a/videocodec/libvpx_internal/Android.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# libvpx
-# if ARMv7 + NEON etc blah blah
-include $(LOCAL_PATH)/libvpx.mk
-
-# libwebm
-#include $(LOCAL_PATH)/libwebm.mk
diff --git a/videocodec/libvpx_internal/NOTICE b/videocodec/libvpx_internal/NOTICE
deleted file mode 100644
index 1ce4434..0000000
--- a/videocodec/libvpx_internal/NOTICE
+++ /dev/null
@@ -1,31 +0,0 @@
-Copyright (c) 2010, The WebM Project authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- * Neither the name of Google, nor the WebM Project, nor the names
- of its contributors may be used to endorse or promote products
- derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/videocodec/libvpx_internal/UPDATING b/videocodec/libvpx_internal/UPDATING
deleted file mode 100644
index 1c9f863..0000000
--- a/videocodec/libvpx_internal/UPDATING
+++ /dev/null
@@ -1,49 +0,0 @@
-Pull the new libvpx checkout into external/libvpx/libvpx:
-$ cd external/libvpx/
-$ rm -rf libvpx
-$ git clone http://git.chromium.org/webm/libvpx.git
-$ cd libvpx
-$ git checkout <branch>
-$ rm -rf .git*
-
-Enter the subdirectory for the relevant platform. For example, armv7-neon for
-armv7 targets with neon extensions. We disable many features. Some for
-functional reasons and some for aesthetic ones.
-
-Functional:
---force-target=$TARGET
- The "Android" support in libvpx is targeted at the NDK and does not yet
- include support for architectures such as MIPS. However, we can still generate
- the necessary files for them.
---disable-runtime-cpu-detect
---disable-neon
- The platform knows at build time what extensions are supported.
---sdk-path=$SDK_PATH
- For configuration we do some compiler tests. It is much easier to accept them
- than to work around them. This uses the compilers included in the NDK.
---enable-realtime-only
- Reduce binary size when building the encoder.
-
-Aesthetic:
---disable-examples
---disable-docs
- Skip unnecessary extra makefiles.
-
-Example:
-$ cd external/libvpx/armv7a
-$ ../libvpx/configure --target=armv7-android-gcc --disable-runtime-cpu-detect \
- --disable-neon --sdk-path=$ANDROID_NDK_ROOT --disable-vp9-encoder \
- --disable-examples --disable-docs
-
-Run 'make libvpx_srcs.txt'
-This will generate a file listing all of the required sources. It will also
-generate vpx_rtcd.h and vpx_version.h
-
-Remove the unused files leaving only:
-libvpx_srcs.txt
-vpx_config.c
-vpx_config.h
-vpx_scale_rtcd.h
-vp8_rtcd.h
-vp9_rtcd.h
-vpx_version.h
diff --git a/videocodec/libvpx_internal/armv7a-neon/libvpx_srcs.txt b/videocodec/libvpx_internal/armv7a-neon/libvpx_srcs.txt
deleted file mode 100644
index fe24a3f..0000000
--- a/videocodec/libvpx_internal/armv7a-neon/libvpx_srcs.txt
+++ /dev/null
@@ -1,347 +0,0 @@
-build/make/rtcd.sh
-build/make/version.sh
-CHANGELOG
-libs.mk
-vp8/common/alloccommon.c
-vp8/common/alloccommon.h
-vp8/common/arm/armv6/bilinearfilter_v6.asm.s
-vp8/common/arm/armv6/copymem16x16_v6.asm.s
-vp8/common/arm/armv6/copymem8x4_v6.asm.s
-vp8/common/arm/armv6/copymem8x8_v6.asm.s
-vp8/common/arm/armv6/dc_only_idct_add_v6.asm.s
-vp8/common/arm/armv6/dequant_idct_v6.asm.s
-vp8/common/arm/armv6/dequantize_v6.asm.s
-vp8/common/arm/armv6/filter_v6.asm.s
-vp8/common/arm/armv6/idct_blk_v6.c
-vp8/common/arm/armv6/idct_v6.asm.s
-vp8/common/arm/armv6/intra4x4_predict_v6.asm.s
-vp8/common/arm/armv6/iwalsh_v6.asm.s
-vp8/common/arm/armv6/loopfilter_v6.asm.s
-vp8/common/arm/armv6/simpleloopfilter_v6.asm.s
-vp8/common/arm/armv6/sixtappredict8x4_v6.asm.s
-vp8/common/arm/armv6/vp8_sad16x16_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance16x16_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance8x8_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm.s
-vp8/common/arm/bilinearfilter_arm.c
-vp8/common/arm/bilinearfilter_arm.h
-vp8/common/arm/dequantize_arm.c
-vp8/common/arm/filter_arm.c
-vp8/common/arm/loopfilter_arm.c
-vp8/common/arm/neon/bilinearpredict16x16_neon.asm.s
-vp8/common/arm/neon/bilinearpredict4x4_neon.asm.s
-vp8/common/arm/neon/bilinearpredict8x4_neon.asm.s
-vp8/common/arm/neon/bilinearpredict8x8_neon.asm.s
-vp8/common/arm/neon/buildintrapredictorsmby_neon.asm.s
-vp8/common/arm/neon/copymem16x16_neon.asm.s
-vp8/common/arm/neon/copymem8x4_neon.asm.s
-vp8/common/arm/neon/copymem8x8_neon.asm.s
-vp8/common/arm/neon/dc_only_idct_add_neon.asm.s
-vp8/common/arm/neon/dequant_idct_neon.asm.s
-vp8/common/arm/neon/dequantizeb_neon.asm.s
-vp8/common/arm/neon/idct_blk_neon.c
-vp8/common/arm/neon/idct_dequant_0_2x_neon.asm.s
-vp8/common/arm/neon/idct_dequant_full_2x_neon.asm.s
-vp8/common/arm/neon/iwalsh_neon.asm.s
-vp8/common/arm/neon/loopfilter_neon.asm.s
-vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm.s
-vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm.s
-vp8/common/arm/neon/mbloopfilter_neon.asm.s
-vp8/common/arm/neon/sad16_neon.asm.s
-vp8/common/arm/neon/sad8_neon.asm.s
-vp8/common/arm/neon/save_reg_neon.asm.s
-vp8/common/arm/neon/shortidct4x4llm_neon.asm.s
-vp8/common/arm/neon/sixtappredict16x16_neon.asm.s
-vp8/common/arm/neon/sixtappredict4x4_neon.asm.s
-vp8/common/arm/neon/sixtappredict8x4_neon.asm.s
-vp8/common/arm/neon/sixtappredict8x8_neon.asm.s
-vp8/common/arm/neon/variance_neon.asm.s
-vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm.s
-vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm.s
-vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm.s
-vp8/common/arm/reconintra_arm.c
-vp8/common/arm/variance_arm.c
-vp8/common/blockd.c
-vp8/common/blockd.h
-vp8/common/coefupdateprobs.h
-vp8/common/common.h
-vp8/common/debugmodes.c
-vp8/common/default_coef_probs.h
-vp8/common/dequantize.c
-vp8/common/entropy.c
-vp8/common/entropy.h
-vp8/common/entropymode.c
-vp8/common/entropymode.h
-vp8/common/entropymv.c
-vp8/common/entropymv.h
-vp8/common/extend.c
-vp8/common/extend.h
-vp8/common/filter.c
-vp8/common/filter.h
-vp8/common/findnearmv.c
-vp8/common/findnearmv.h
-vp8/common/generic/systemdependent.c
-vp8/common/header.h
-vp8/common/idct_blk.c
-vp8/common/idctllm.c
-vp8/common/invtrans.h
-vp8/common/loopfilter.c
-vp8/common/loopfilter_filters.c
-vp8/common/loopfilter.h
-vp8/common/mbpitch.c
-vp8/common/modecont.c
-vp8/common/modecont.h
-vp8/common/mv.h
-vp8/common/onyxc_int.h
-vp8/common/onyxd.h
-vp8/common/onyx.h
-vp8/common/ppflags.h
-vp8/common/pragmas.h
-vp8/common/quant_common.c
-vp8/common/quant_common.h
-vp8/common/reconinter.c
-vp8/common/reconinter.h
-vp8/common/reconintra4x4.c
-vp8/common/reconintra4x4.h
-vp8/common/reconintra.c
-vp8/common/rtcd.c
-vp8/common/rtcd_defs.sh
-vp8/common/sad_c.c
-vp8/common/setupintrarecon.c
-vp8/common/setupintrarecon.h
-vp8/common/swapyv12buffer.c
-vp8/common/swapyv12buffer.h
-vp8/common/systemdependent.h
-vp8/common/threading.h
-vp8/common/treecoder.c
-vp8/common/treecoder.h
-vp8/common/variance_c.c
-vp8/common/variance.h
-vp8/common/vp8_entropymodedata.h
-vp8/decoder/dboolhuff.c
-vp8/decoder/dboolhuff.h
-vp8/decoder/decodemv.c
-vp8/decoder/decodemv.h
-vp8/decoder/decoderthreading.h
-vp8/decoder/decodframe.c
-vp8/decoder/detokenize.c
-vp8/decoder/detokenize.h
-vp8/decoder/onyxd_if.c
-vp8/decoder/onyxd_int.h
-vp8/decoder/threading.c
-vp8/decoder/treereader.h
-vp8/encoder/arm/armv5te/boolhuff_armv5te.asm.s
-vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm.s
-vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm.s
-vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm.s
-vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm.s
-vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm.s
-vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm.s
-vp8/encoder/arm/armv6/vp8_subtract_armv6.asm.s
-vp8/encoder/arm/armv6/walsh_v6.asm.s
-vp8/encoder/arm/boolhuff_arm.c
-vp8/encoder/arm/dct_arm.c
-vp8/encoder/arm/neon/fastquantizeb_neon.asm.s
-vp8/encoder/arm/neon/picklpf_arm.c
-vp8/encoder/arm/neon/shortfdct_neon.asm.s
-vp8/encoder/arm/neon/subtract_neon.asm.s
-vp8/encoder/arm/neon/vp8_memcpy_neon.asm.s
-vp8/encoder/arm/neon/vp8_mse16x16_neon.asm.s
-vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm.s
-vp8/encoder/arm/quantize_arm.c
-vp8/encoder/bitstream.c
-vp8/encoder/bitstream.h
-vp8/encoder/block.h
-vp8/encoder/boolhuff.h
-vp8/encoder/dct.c
-vp8/encoder/dct_value_cost.h
-vp8/encoder/dct_value_tokens.h
-vp8/encoder/defaultcoefcounts.h
-vp8/encoder/denoising.c
-vp8/encoder/denoising.h
-vp8/encoder/encodeframe.c
-vp8/encoder/encodeframe.h
-vp8/encoder/encodeintra.c
-vp8/encoder/encodeintra.h
-vp8/encoder/encodemb.c
-vp8/encoder/encodemb.h
-vp8/encoder/encodemv.c
-vp8/encoder/encodemv.h
-vp8/encoder/ethreading.c
-vp8/encoder/firstpass.h
-vp8/encoder/lookahead.c
-vp8/encoder/lookahead.h
-vp8/encoder/mcomp.c
-vp8/encoder/mcomp.h
-vp8/encoder/modecosts.c
-vp8/encoder/modecosts.h
-vp8/encoder/onyx_if.c
-vp8/encoder/onyx_int.h
-vp8/encoder/pickinter.c
-vp8/encoder/pickinter.h
-vp8/encoder/picklpf.c
-vp8/encoder/psnr.c
-vp8/encoder/psnr.h
-vp8/encoder/quantize.c
-vp8/encoder/quantize.h
-vp8/encoder/ratectrl.c
-vp8/encoder/ratectrl.h
-vp8/encoder/rdopt.c
-vp8/encoder/rdopt.h
-vp8/encoder/segmentation.c
-vp8/encoder/segmentation.h
-vp8/encoder/tokenize.c
-vp8/encoder/tokenize.h
-vp8/encoder/treewriter.c
-vp8/encoder/treewriter.h
-vp8/encoder/vp8_asm_enc_offsets.c
-vp8/vp8_common.mk
-vp8/vp8cx_arm.mk
-vp8/vp8_cx_iface.c
-vp8/vp8cx.mk
-vp8/vp8_dx_iface.c
-vp8/vp8dx.mk
-vp9/common/arm/neon/vp9_avg_neon.asm.s
-vp9/common/arm/neon/vp9_convolve8_avg_neon.asm.s
-vp9/common/arm/neon/vp9_convolve8_neon.asm.s
-vp9/common/arm/neon/vp9_convolve_neon.c
-vp9/common/arm/neon/vp9_copy_neon.asm.s
-vp9/common/arm/neon/vp9_dc_only_idct_add_neon.asm.s
-vp9/common/arm/neon/vp9_idct16x16_neon.c
-vp9/common/arm/neon/vp9_loopfilter_neon.asm.s
-vp9/common/arm/neon/vp9_mb_lpf_neon.asm.s
-vp9/common/arm/neon/vp9_save_reg_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct16x16_1_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct16x16_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct32x32_1_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct32x32_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct4x4_1_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct4x4_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct8x8_1_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_idct8x8_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_iht4x4_add_neon.asm.s
-vp9/common/arm/neon/vp9_short_iht8x8_add_neon.asm.s
-vp9/common/generic/vp9_systemdependent.c
-vp9/common/vp9_alloccommon.c
-vp9/common/vp9_alloccommon.h
-vp9/common/vp9_blockd.h
-vp9/common/vp9_common_data.c
-vp9/common/vp9_common_data.h
-vp9/common/vp9_common.h
-vp9/common/vp9_convolve.c
-vp9/common/vp9_convolve.h
-vp9/common/vp9_debugmodes.c
-vp9/common/vp9_default_coef_probs.h
-vp9/common/vp9_entropy.c
-vp9/common/vp9_entropy.h
-vp9/common/vp9_entropymode.c
-vp9/common/vp9_entropymode.h
-vp9/common/vp9_entropymv.c
-vp9/common/vp9_entropymv.h
-vp9/common/vp9_enums.h
-vp9/common/vp9_extend.c
-vp9/common/vp9_extend.h
-vp9/common/vp9_filter.c
-vp9/common/vp9_filter.h
-vp9/common/vp9_findnearmv.c
-vp9/common/vp9_findnearmv.h
-vp9/common/vp9_idct.c
-vp9/common/vp9_idct.h
-vp9/common/vp9_loopfilter.c
-vp9/common/vp9_loopfilter_filters.c
-vp9/common/vp9_loopfilter.h
-vp9/common/vp9_mv.h
-vp9/common/vp9_mvref_common.c
-vp9/common/vp9_mvref_common.h
-vp9/common/vp9_onyxc_int.h
-vp9/common/vp9_onyx.h
-vp9/common/vp9_ppflags.h
-vp9/common/vp9_pragmas.h
-vp9/common/vp9_pred_common.c
-vp9/common/vp9_pred_common.h
-vp9/common/vp9_quant_common.c
-vp9/common/vp9_quant_common.h
-vp9/common/vp9_reconinter.c
-vp9/common/vp9_reconinter.h
-vp9/common/vp9_reconintra.c
-vp9/common/vp9_reconintra.h
-vp9/common/vp9_rtcd.c
-vp9/common/vp9_rtcd_defs.sh
-vp9/common/vp9_sadmxn.h
-vp9/common/vp9_scale.c
-vp9/common/vp9_scale.h
-vp9/common/vp9_scan.c
-vp9/common/vp9_scan.h
-vp9/common/vp9_seg_common.c
-vp9/common/vp9_seg_common.h
-vp9/common/vp9_systemdependent.h
-vp9/common/vp9_textblit.h
-vp9/common/vp9_tile_common.c
-vp9/common/vp9_tile_common.h
-vp9/common/vp9_treecoder.c
-vp9/common/vp9_treecoder.h
-vp9/decoder/vp9_dboolhuff.c
-vp9/decoder/vp9_dboolhuff.h
-vp9/decoder/vp9_decodemv.c
-vp9/decoder/vp9_decodemv.h
-vp9/decoder/vp9_decodframe.c
-vp9/decoder/vp9_decodframe.h
-vp9/decoder/vp9_detokenize.c
-vp9/decoder/vp9_detokenize.h
-vp9/decoder/vp9_dsubexp.c
-vp9/decoder/vp9_dsubexp.h
-vp9/decoder/vp9_onyxd.h
-vp9/decoder/vp9_onyxd_if.c
-vp9/decoder/vp9_onyxd_int.h
-vp9/decoder/vp9_read_bit_buffer.h
-vp9/decoder/vp9_thread.c
-vp9/decoder/vp9_thread.h
-vp9/decoder/vp9_treereader.h
-vp9/vp9_common.mk
-vp9/vp9_dx_iface.c
-vp9/vp9dx.mk
-vp9/vp9_iface_common.h
-vpx_config.c
-vpx/internal/vpx_codec_internal.h
-vpx_mem/include/vpx_mem_intrnl.h
-vpx_mem/vpx_mem.c
-vpx_mem/vpx_mem.h
-vpx_mem/vpx_mem.mk
-vpx_ports/arm_cpudetect.c
-vpx_ports/arm.h
-vpx_ports/asm_offsets.h
-vpx_ports/emmintrin_compat.h
-vpx_ports/mem.h
-vpx_ports/vpx_once.h
-vpx_ports/vpx_ports.mk
-vpx_ports/vpx_timer.h
-vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm.s
-vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm.s
-vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm.s
-vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm.s
-vpx_scale/arm/neon/yv12extend_arm.c
-vpx_scale/generic/gen_scalers.c
-vpx_scale/generic/vpx_scale.c
-vpx_scale/generic/yv12config.c
-vpx_scale/generic/yv12extend.c
-vpx_scale/vpx_scale_asm_offsets.c
-vpx_scale/vpx_scale.h
-vpx_scale/vpx_scale.mk
-vpx_scale/vpx_scale_rtcd.c
-vpx_scale/vpx_scale_rtcd.sh
-vpx_scale/yv12config.h
-vpx/src/vpx_codec.c
-vpx/src/vpx_decoder.c
-vpx/src/vpx_encoder.c
-vpx/src/vpx_image.c
-vpx/vp8cx.h
-vpx/vp8dx.h
-vpx/vp8.h
-vpx/vpx_codec.h
-vpx/vpx_codec.mk
-vpx/vpx_decoder.h
-vpx/vpx_encoder.h
-vpx/vpx_image.h
-vpx/vpx_integer.h
diff --git a/videocodec/libvpx_internal/armv7a-neon/vp8_rtcd.h b/videocodec/libvpx_internal/armv7a-neon/vp8_rtcd.h
deleted file mode 100644
index 9cad64a..0000000
--- a/videocodec/libvpx_internal/armv7a-neon/vp8_rtcd.h
+++ /dev/null
@@ -1,403 +0,0 @@
-#ifndef VP8_RTCD_H_
-#define VP8_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP8
- */
-
-struct blockd;
-struct macroblockd;
-struct loop_filter_info;
-
-/* Encoder forward decls */
-struct block;
-struct macroblock;
-struct variance_vtable;
-union int_mv;
-struct yv12_buffer_config;
-
-void vp8_clear_system_state_c();
-#define vp8_clear_system_state vp8_clear_system_state_c
-
-void vp8_dequantize_b_c(struct blockd*, short *dqc);
-void vp8_dequantize_b_v6(struct blockd*, short *dqc);
-void vp8_dequantize_b_neon(struct blockd*, short *dqc);
-#define vp8_dequantize_b vp8_dequantize_b_neon
-
-void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *output, int stride);
-void vp8_dequant_idct_add_v6(short *input, short *dq, unsigned char *output, int stride);
-void vp8_dequant_idct_add_neon(short *input, short *dq, unsigned char *output, int stride);
-#define vp8_dequant_idct_add vp8_dequant_idct_add_neon
-
-void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-void vp8_dequant_idct_add_y_block_v6(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-void vp8_dequant_idct_add_y_block_neon(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_neon
-
-void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-void vp8_dequant_idct_add_uv_block_v6(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-void vp8_dequant_idct_add_uv_block_neon(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_neon
-
-void vp8_loop_filter_mbv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbv_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbv_neon(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbv vp8_loop_filter_mbv_neon
-
-void vp8_loop_filter_bv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bv_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bv_neon(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bv vp8_loop_filter_bv_neon
-
-void vp8_loop_filter_mbh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbh_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbh_neon(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbh vp8_loop_filter_mbh_neon
-
-void vp8_loop_filter_bh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bh_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bh_neon(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bh vp8_loop_filter_bh_neon
-
-void vp8_loop_filter_simple_vertical_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_vertical_edge_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_mbvs_neon(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbv vp8_loop_filter_mbvs_neon
-
-void vp8_loop_filter_simple_horizontal_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_horizontal_edge_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_mbhs_neon(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbh vp8_loop_filter_mbhs_neon
-
-void vp8_loop_filter_bvs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bvs_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bvs_neon(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bv vp8_loop_filter_bvs_neon
-
-void vp8_loop_filter_bhs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bhs_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bhs_neon(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bh vp8_loop_filter_bhs_neon
-
-void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-void vp8_short_idct4x4llm_v6_dual(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-void vp8_short_idct4x4llm_neon(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-#define vp8_short_idct4x4llm vp8_short_idct4x4llm_neon
-
-void vp8_short_inv_walsh4x4_1_c(short *input, short *output);
-#define vp8_short_inv_walsh4x4_1 vp8_short_inv_walsh4x4_1_c
-
-void vp8_short_inv_walsh4x4_c(short *input, short *output);
-void vp8_short_inv_walsh4x4_v6(short *input, short *output);
-void vp8_short_inv_walsh4x4_neon(short *input, short *output);
-#define vp8_short_inv_walsh4x4 vp8_short_inv_walsh4x4_neon
-
-void vp8_dc_only_idct_add_c(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-void vp8_dc_only_idct_add_v6(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-void vp8_dc_only_idct_add_neon(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-#define vp8_dc_only_idct_add vp8_dc_only_idct_add_neon
-
-void vp8_copy_mem16x16_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem16x16_v6(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem16x16_neon(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem16x16 vp8_copy_mem16x16_neon
-
-void vp8_copy_mem8x8_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x8_v6(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x8_neon(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x8 vp8_copy_mem8x8_neon
-
-void vp8_copy_mem8x4_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x4_v6(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x4_neon(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x4 vp8_copy_mem8x4_neon
-
-void vp8_build_intra_predictors_mby_s_c(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-#define vp8_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_c
-
-void vp8_build_intra_predictors_mbuv_s_c(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-#define vp8_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s_c
-
-void vp8_intra4x4_predict_c(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-void vp8_intra4x4_predict_armv6(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-#define vp8_intra4x4_predict vp8_intra4x4_predict_armv6
-
-void vp8_sixtap_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict16x16_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict16x16_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict16x16 vp8_sixtap_predict16x16_neon
-
-void vp8_sixtap_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x8_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x8_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x8 vp8_sixtap_predict8x8_neon
-
-void vp8_sixtap_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x4_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x4 vp8_sixtap_predict8x4_neon
-
-void vp8_sixtap_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict4x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict4x4_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict4x4 vp8_sixtap_predict4x4_neon
-
-void vp8_bilinear_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict16x16_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict16x16_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict16x16 vp8_bilinear_predict16x16_neon
-
-void vp8_bilinear_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x8_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x8_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x8 vp8_bilinear_predict8x8_neon
-
-void vp8_bilinear_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x4_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x4 vp8_bilinear_predict8x4_neon
-
-void vp8_bilinear_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict4x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict4x4_neon(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict4x4 vp8_bilinear_predict4x4_neon
-
-unsigned int vp8_variance4x4_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance4x4 vp8_variance4x4_c
-
-unsigned int vp8_variance8x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x8_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x8_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x8 vp8_variance8x8_neon
-
-unsigned int vp8_variance8x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x16_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x16 vp8_variance8x16_neon
-
-unsigned int vp8_variance16x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x8_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x8 vp8_variance16x8_neon
-
-unsigned int vp8_variance16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x16_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x16_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x16 vp8_variance16x16_neon
-
-unsigned int vp8_sub_pixel_variance4x4_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance4x4 vp8_sub_pixel_variance4x4_c
-
-unsigned int vp8_sub_pixel_variance8x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance8x8_armv6(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance8x8_neon(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x8 vp8_sub_pixel_variance8x8_neon
-
-unsigned int vp8_sub_pixel_variance8x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x16 vp8_sub_pixel_variance8x16_c
-
-unsigned int vp8_sub_pixel_variance16x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x8 vp8_sub_pixel_variance16x8_c
-
-unsigned int vp8_sub_pixel_variance16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x16_armv6(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x16_neon(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x16 vp8_sub_pixel_variance16x16_neon
-
-unsigned int vp8_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_h_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_h_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_h vp8_variance_halfpixvar16x16_h_neon
-
-unsigned int vp8_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_v_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_v_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_v vp8_variance_halfpixvar16x16_v_neon
-
-unsigned int vp8_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_hv_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_hv_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_hv vp8_variance_halfpixvar16x16_hv_neon
-
-unsigned int vp8_sad4x4_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad4x4_neon(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad4x4 vp8_sad4x4_neon
-
-unsigned int vp8_sad8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad8x8_neon(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x8 vp8_sad8x8_neon
-
-unsigned int vp8_sad8x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad8x16_neon(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x16 vp8_sad8x16_neon
-
-unsigned int vp8_sad16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x8_neon(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x8 vp8_sad16x8_neon
-
-unsigned int vp8_sad16x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x16_armv6(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x16_neon(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x16 vp8_sad16x16_neon
-
-void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x3 vp8_sad4x4x3_c
-
-void vp8_sad8x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x3 vp8_sad8x8x3_c
-
-void vp8_sad8x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x3 vp8_sad8x16x3_c
-
-void vp8_sad16x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x3 vp8_sad16x8x3_c
-
-void vp8_sad16x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x3 vp8_sad16x16x3_c
-
-void vp8_sad4x4x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad4x4x8 vp8_sad4x4x8_c
-
-void vp8_sad8x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x8x8 vp8_sad8x8x8_c
-
-void vp8_sad8x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x16x8 vp8_sad8x16x8_c
-
-void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x8x8 vp8_sad16x8x8_c
-
-void vp8_sad16x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x16x8 vp8_sad16x16x8_c
-
-void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x4d vp8_sad4x4x4d_c
-
-void vp8_sad8x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x4d vp8_sad8x8x4d_c
-
-void vp8_sad8x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x4d vp8_sad8x16x4d_c
-
-void vp8_sad16x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x4d vp8_sad16x8x4d_c
-
-void vp8_sad16x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x4d vp8_sad16x16x4d_c
-
-unsigned int vp8_get_mb_ss_c(const short *);
-#define vp8_get_mb_ss vp8_get_mb_ss_c
-
-unsigned int vp8_sub_pixel_mse16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_mse16x16 vp8_sub_pixel_mse16x16_c
-
-unsigned int vp8_mse16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_mse16x16_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_mse16x16_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_mse16x16 vp8_mse16x16_neon
-
-unsigned int vp8_get4x4sse_cs_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-unsigned int vp8_get4x4sse_cs_neon(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-#define vp8_get4x4sse_cs vp8_get4x4sse_cs_neon
-
-void vp8_short_fdct4x4_c(short *input, short *output, int pitch);
-void vp8_short_fdct4x4_armv6(short *input, short *output, int pitch);
-void vp8_short_fdct4x4_neon(short *input, short *output, int pitch);
-#define vp8_short_fdct4x4 vp8_short_fdct4x4_neon
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch);
-void vp8_short_fdct8x4_armv6(short *input, short *output, int pitch);
-void vp8_short_fdct8x4_neon(short *input, short *output, int pitch);
-#define vp8_short_fdct8x4 vp8_short_fdct8x4_neon
-
-void vp8_short_walsh4x4_c(short *input, short *output, int pitch);
-void vp8_short_walsh4x4_armv6(short *input, short *output, int pitch);
-void vp8_short_walsh4x4_neon(short *input, short *output, int pitch);
-#define vp8_short_walsh4x4 vp8_short_walsh4x4_neon
-
-void vp8_regular_quantize_b_c(struct block *, struct blockd *);
-#define vp8_regular_quantize_b vp8_regular_quantize_b_c
-
-void vp8_fast_quantize_b_c(struct block *, struct blockd *);
-void vp8_fast_quantize_b_armv6(struct block *, struct blockd *);
-void vp8_fast_quantize_b_neon(struct block *, struct blockd *);
-#define vp8_fast_quantize_b vp8_fast_quantize_b_neon
-
-void vp8_regular_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_regular_quantize_b_pair vp8_regular_quantize_b_pair_c
-
-void vp8_fast_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-void vp8_fast_quantize_b_pair_neon(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_fast_quantize_b_pair vp8_fast_quantize_b_pair_neon
-
-void vp8_quantize_mb_c(struct macroblock *);
-void vp8_quantize_mb_neon(struct macroblock *);
-#define vp8_quantize_mb vp8_quantize_mb_neon
-
-void vp8_quantize_mby_c(struct macroblock *);
-void vp8_quantize_mby_neon(struct macroblock *);
-#define vp8_quantize_mby vp8_quantize_mby_neon
-
-void vp8_quantize_mbuv_c(struct macroblock *);
-void vp8_quantize_mbuv_neon(struct macroblock *);
-#define vp8_quantize_mbuv vp8_quantize_mbuv_neon
-
-int vp8_block_error_c(short *coeff, short *dqcoeff);
-#define vp8_block_error vp8_block_error_c
-
-int vp8_mbblock_error_c(struct macroblock *mb, int dc);
-#define vp8_mbblock_error vp8_mbblock_error_c
-
-int vp8_mbuverror_c(struct macroblock *mb);
-#define vp8_mbuverror vp8_mbuverror_c
-
-void vp8_subtract_b_c(struct block *be, struct blockd *bd, int pitch);
-void vp8_subtract_b_armv6(struct block *be, struct blockd *bd, int pitch);
-void vp8_subtract_b_neon(struct block *be, struct blockd *bd, int pitch);
-#define vp8_subtract_b vp8_subtract_b_neon
-
-void vp8_subtract_mby_c(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-void vp8_subtract_mby_armv6(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-void vp8_subtract_mby_neon(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-#define vp8_subtract_mby vp8_subtract_mby_neon
-
-void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-void vp8_subtract_mbuv_armv6(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-void vp8_subtract_mbuv_neon(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-#define vp8_subtract_mbuv vp8_subtract_mbuv_neon
-
-int vp8_full_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_full_search_sad vp8_full_search_sad_c
-
-int vp8_refining_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_refining_search_sad vp8_refining_search_sad_c
-
-int vp8_diamond_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_diamond_search_sad vp8_diamond_search_sad_c
-
-void vp8_yv12_copy_partial_frame_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-void vp8_yv12_copy_partial_frame_neon(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_partial_frame vp8_yv12_copy_partial_frame_neon
-
-int vp8_denoiser_filter_c(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-#define vp8_denoiser_filter vp8_denoiser_filter_c
-
-void vp8_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-#include "vpx_ports/arm.h"
-static void setup_rtcd_internal(void)
-{
- int flags = arm_cpu_caps();
-
- (void)flags;
-
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/armv7a-neon/vp9_rtcd.h b/videocodec/libvpx_internal/armv7a-neon/vp9_rtcd.h
deleted file mode 100644
index 847f8c8..0000000
--- a/videocodec/libvpx_internal/armv7a-neon/vp9_rtcd.h
+++ /dev/null
@@ -1,322 +0,0 @@
-#ifndef VP9_RTCD_H_
-#define VP9_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP9
- */
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_enums.h"
-
-struct macroblockd;
-
-/* Encoder forward decls */
-struct macroblock;
-struct vp9_variance_vtable;
-
-#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
-union int_mv;
-struct yv12_buffer_config;
-
-void vp9_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_4x4 vp9_d207_predictor_4x4_c
-
-void vp9_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_4x4 vp9_d45_predictor_4x4_c
-
-void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_4x4 vp9_d63_predictor_4x4_c
-
-void vp9_h_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_4x4 vp9_h_predictor_4x4_c
-
-void vp9_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_4x4 vp9_d117_predictor_4x4_c
-
-void vp9_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_4x4 vp9_d135_predictor_4x4_c
-
-void vp9_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_4x4 vp9_d153_predictor_4x4_c
-
-void vp9_v_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_4x4 vp9_v_predictor_4x4_c
-
-void vp9_tm_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_4x4 vp9_tm_predictor_4x4_c
-
-void vp9_dc_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_4x4 vp9_dc_predictor_4x4_c
-
-void vp9_dc_top_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_4x4 vp9_dc_top_predictor_4x4_c
-
-void vp9_dc_left_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_4x4 vp9_dc_left_predictor_4x4_c
-
-void vp9_dc_128_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_4x4 vp9_dc_128_predictor_4x4_c
-
-void vp9_d207_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_8x8 vp9_d207_predictor_8x8_c
-
-void vp9_d45_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_8x8 vp9_d45_predictor_8x8_c
-
-void vp9_d63_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_8x8 vp9_d63_predictor_8x8_c
-
-void vp9_h_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_8x8 vp9_h_predictor_8x8_c
-
-void vp9_d117_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_8x8 vp9_d117_predictor_8x8_c
-
-void vp9_d135_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_8x8 vp9_d135_predictor_8x8_c
-
-void vp9_d153_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_8x8 vp9_d153_predictor_8x8_c
-
-void vp9_v_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_8x8 vp9_v_predictor_8x8_c
-
-void vp9_tm_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_8x8 vp9_tm_predictor_8x8_c
-
-void vp9_dc_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_8x8 vp9_dc_predictor_8x8_c
-
-void vp9_dc_top_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_8x8 vp9_dc_top_predictor_8x8_c
-
-void vp9_dc_left_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_8x8 vp9_dc_left_predictor_8x8_c
-
-void vp9_dc_128_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_8x8 vp9_dc_128_predictor_8x8_c
-
-void vp9_d207_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_16x16 vp9_d207_predictor_16x16_c
-
-void vp9_d45_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_16x16 vp9_d45_predictor_16x16_c
-
-void vp9_d63_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_16x16 vp9_d63_predictor_16x16_c
-
-void vp9_h_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_16x16 vp9_h_predictor_16x16_c
-
-void vp9_d117_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_16x16 vp9_d117_predictor_16x16_c
-
-void vp9_d135_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_16x16 vp9_d135_predictor_16x16_c
-
-void vp9_d153_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_16x16 vp9_d153_predictor_16x16_c
-
-void vp9_v_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_16x16 vp9_v_predictor_16x16_c
-
-void vp9_tm_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_16x16 vp9_tm_predictor_16x16_c
-
-void vp9_dc_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_16x16 vp9_dc_predictor_16x16_c
-
-void vp9_dc_top_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_16x16 vp9_dc_top_predictor_16x16_c
-
-void vp9_dc_left_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_16x16 vp9_dc_left_predictor_16x16_c
-
-void vp9_dc_128_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_16x16 vp9_dc_128_predictor_16x16_c
-
-void vp9_d207_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_32x32 vp9_d207_predictor_32x32_c
-
-void vp9_d45_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_32x32 vp9_d45_predictor_32x32_c
-
-void vp9_d63_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_32x32 vp9_d63_predictor_32x32_c
-
-void vp9_h_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_32x32 vp9_h_predictor_32x32_c
-
-void vp9_d117_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_32x32 vp9_d117_predictor_32x32_c
-
-void vp9_d135_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_32x32 vp9_d135_predictor_32x32_c
-
-void vp9_d153_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_32x32 vp9_d153_predictor_32x32_c
-
-void vp9_v_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_32x32 vp9_v_predictor_32x32_c
-
-void vp9_tm_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_32x32 vp9_tm_predictor_32x32_c
-
-void vp9_dc_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_32x32 vp9_dc_predictor_32x32_c
-
-void vp9_dc_top_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_32x32 vp9_dc_top_predictor_32x32_c
-
-void vp9_dc_left_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_32x32 vp9_dc_left_predictor_32x32_c
-
-void vp9_dc_128_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_32x32 vp9_dc_128_predictor_32x32_c
-
-void vp9_mb_lpf_vertical_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-void vp9_mb_lpf_vertical_edge_w_neon(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-#define vp9_mb_lpf_vertical_edge_w vp9_mb_lpf_vertical_edge_w_neon
-
-void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_mbloop_filter_vertical_edge_neon(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_vertical_edge vp9_mbloop_filter_vertical_edge_neon
-
-void vp9_loop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_loop_filter_vertical_edge_neon(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_vertical_edge vp9_loop_filter_vertical_edge_neon
-
-void vp9_mb_lpf_horizontal_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_mb_lpf_horizontal_edge_w_neon(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mb_lpf_horizontal_edge_w vp9_mb_lpf_horizontal_edge_w_neon
-
-void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_mbloop_filter_horizontal_edge_neon(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_horizontal_edge vp9_mbloop_filter_horizontal_edge_neon
-
-void vp9_loop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_loop_filter_horizontal_edge_neon(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_horizontal_edge vp9_loop_filter_horizontal_edge_neon
-
-void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_inner vp9_blend_mb_inner_c
-
-void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_outer vp9_blend_mb_outer_c
-
-void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_b vp9_blend_b_c
-
-void vp9_convolve_copy_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);
-void vp9_convolve_copy_neon(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);
-#define vp9_convolve_copy vp9_convolve_copy_neon
-
-void vp9_convolve_avg_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);
-void vp9_convolve_avg_neon(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);
-#define vp9_convolve_avg vp9_convolve_avg_neon
-
-void vp9_convolve8_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);
-void vp9_convolve8_neon(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);
-#define vp9_convolve8 vp9_convolve8_neon
-
-void vp9_convolve8_horiz_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);
-void vp9_convolve8_horiz_neon(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);
-#define vp9_convolve8_horiz vp9_convolve8_horiz_neon
-
-void vp9_convolve8_vert_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);
-void vp9_convolve8_vert_neon(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);
-#define vp9_convolve8_vert vp9_convolve8_vert_neon
-
-void vp9_convolve8_avg_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);
-void vp9_convolve8_avg_neon(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);
-#define vp9_convolve8_avg vp9_convolve8_avg_neon
-
-void vp9_convolve8_avg_horiz_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);
-void vp9_convolve8_avg_horiz_neon(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);
-#define vp9_convolve8_avg_horiz vp9_convolve8_avg_horiz_neon
-
-void vp9_convolve8_avg_vert_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);
-void vp9_convolve8_avg_vert_neon(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);
-#define vp9_convolve8_avg_vert vp9_convolve8_avg_vert_neon
-
-void vp9_idct4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct4x4_1_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_1_add vp9_idct4x4_1_add_neon
-
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct4x4_16_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_16_add vp9_idct4x4_16_add_neon
-
-void vp9_idct8x8_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_1_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_1_add vp9_idct8x8_1_add_neon
-
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_64_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_64_add vp9_idct8x8_64_add_neon
-
-void vp9_idct8x8_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_10_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_10_add vp9_idct8x8_10_add_neon
-
-void vp9_idct16x16_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_1_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_1_add vp9_idct16x16_1_add_neon
-
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_256_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_256_add vp9_idct16x16_256_add_neon
-
-void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_10_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_10_add vp9_idct16x16_10_add_neon
-
-void vp9_idct32x32_1024_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_1024_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1024_add vp9_idct32x32_1024_add_neon
-
-void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_34_add vp9_idct32x32_34_add_c
-
-void vp9_idct32x32_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_1_add_neon(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1_add vp9_idct32x32_1_add_neon
-
-void vp9_iht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-void vp9_iht4x4_16_add_neon(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht4x4_16_add vp9_iht4x4_16_add_neon
-
-void vp9_iht8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-void vp9_iht8x8_64_add_neon(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht8x8_64_add vp9_iht8x8_64_add_neon
-
-void vp9_iht16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-#define vp9_iht16x16_256_add vp9_iht16x16_256_add_c
-
-void vp9_iwht4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_1_add vp9_iwht4x4_1_add_c
-
-void vp9_iwht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_16_add vp9_iwht4x4_16_add_c
-
-void vp9_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-#include "vpx_ports/arm.h"
-static void setup_rtcd_internal(void)
-{
- int flags = arm_cpu_caps();
-
- (void)flags;
-
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/armv7a-neon/vpx_config.c b/videocodec/libvpx_internal/armv7a-neon/vpx_config.c
deleted file mode 100644
index dc64ce3..0000000
--- a/videocodec/libvpx_internal/armv7a-neon/vpx_config.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-static const char* const cfg = "--target=armv7-android-gcc --disable-runtime-cpu-detect --sdk-path=/usr/local/google/home/hkuang/Downloads/android-ndk-r8e --disable-vp9-encoder --disable-examples --disable-docs --enable-realtime-only";
-const char *vpx_codec_build_config(void) {return cfg;}
diff --git a/videocodec/libvpx_internal/armv7a-neon/vpx_config.h b/videocodec/libvpx_internal/armv7a-neon/vpx_config.h
deleted file mode 100644
index 3a1f95d..0000000
--- a/videocodec/libvpx_internal/armv7a-neon/vpx_config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-/* This file automatically generated by configure. Do not edit! */
-#ifndef VPX_CONFIG_H
-#define VPX_CONFIG_H
-#define RESTRICT
-#define INLINE __inline__ __attribute__((always_inline))
-#define ARCH_ARM 1
-#define ARCH_MIPS 0
-#define ARCH_X86_32 0
-#define ARCH_X86_64 0
-#define ARCH_PPC32 0
-#define ARCH_PPC64 0
-#define HAVE_EDSP 1
-#define HAVE_MEDIA 1
-#define HAVE_NEON 1
-#define HAVE_MIPS32 0
-#define HAVE_DSPR2 0
-#define HAVE_MMX 0
-#define HAVE_SSE 0
-#define HAVE_SSE2 0
-#define HAVE_SSE3 0
-#define HAVE_SSSE3 0
-#define HAVE_SSE4_1 0
-#define HAVE_AVX 0
-#define HAVE_AVX2 0
-#define HAVE_ALTIVEC 0
-#define HAVE_VPX_PORTS 1
-#define HAVE_STDINT_H 1
-#define HAVE_ALT_TREE_LAYOUT 0
-#define HAVE_PTHREAD_H 1
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_UNISTD_H 1
-#define CONFIG_EXTERNAL_BUILD 0
-#define CONFIG_INSTALL_DOCS 0
-#define CONFIG_INSTALL_BINS 1
-#define CONFIG_INSTALL_LIBS 1
-#define CONFIG_INSTALL_SRCS 0
-#define CONFIG_USE_X86INC 1
-#define CONFIG_DEBUG 0
-#define CONFIG_GPROF 0
-#define CONFIG_GCOV 0
-#define CONFIG_RVCT 0
-#define CONFIG_GCC 1
-#define CONFIG_MSVS 0
-#define CONFIG_PIC 1
-#define CONFIG_BIG_ENDIAN 0
-#define CONFIG_CODEC_SRCS 0
-#define CONFIG_DEBUG_LIBS 0
-#define CONFIG_FAST_UNALIGNED 1
-#define CONFIG_MEM_MANAGER 0
-#define CONFIG_MEM_TRACKER 0
-#define CONFIG_MEM_CHECKS 0
-#define CONFIG_MD5 1
-#define CONFIG_DEQUANT_TOKENS 0
-#define CONFIG_DC_RECON 0
-#define CONFIG_RUNTIME_CPU_DETECT 0
-#define CONFIG_POSTPROC 0
-#define CONFIG_VP9_POSTPROC 0
-#define CONFIG_MULTITHREAD 1
-#define CONFIG_INTERNAL_STATS 0
-#define CONFIG_VP8_ENCODER 1
-#define CONFIG_VP8_DECODER 1
-#define CONFIG_VP9_ENCODER 0
-#define CONFIG_VP9_DECODER 1
-#define CONFIG_VP8 1
-#define CONFIG_VP9 1
-#define CONFIG_ENCODERS 1
-#define CONFIG_DECODERS 1
-#define CONFIG_STATIC_MSVCRT 0
-#define CONFIG_SPATIAL_RESAMPLING 1
-#define CONFIG_REALTIME_ONLY 1
-#define CONFIG_ONTHEFLY_BITPACKING 0
-#define CONFIG_ERROR_CONCEALMENT 0
-#define CONFIG_SHARED 0
-#define CONFIG_STATIC 1
-#define CONFIG_SMALL 0
-#define CONFIG_POSTPROC_VISUALIZER 0
-#define CONFIG_OS_SUPPORT 1
-#define CONFIG_UNIT_TESTS 0
-#define CONFIG_MULTI_RES_ENCODING 0
-#define CONFIG_TEMPORAL_DENOISING 1
-#define CONFIG_EXPERIMENTAL 0
-#define CONFIG_DECRYPT 0
-#define CONFIG_MULTIPLE_ARF 0
-#define CONFIG_NON420 0
-#define CONFIG_ALPHA 0
-#endif /* VPX_CONFIG_H */
diff --git a/videocodec/libvpx_internal/armv7a-neon/vpx_scale_rtcd.h b/videocodec/libvpx_internal/armv7a-neon/vpx_scale_rtcd.h
deleted file mode 100644
index 8c2ab2f..0000000
--- a/videocodec/libvpx_internal/armv7a-neon/vpx_scale_rtcd.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef VPX_SCALE_RTCD_H_
-#define VPX_SCALE_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-struct yv12_buffer_config;
-
-void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
-
-void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
-
-void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
-
-void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
-
-void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
-
-void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
-void vp8_yv12_extend_frame_borders_neon(struct yv12_buffer_config *ybf);
-#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_neon
-
-void vp8_yv12_copy_frame_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-void vp8_yv12_copy_frame_neon(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_frame vp8_yv12_copy_frame_neon
-
-void vpx_yv12_copy_y_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-void vpx_yv12_copy_y_neon(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vpx_yv12_copy_y vpx_yv12_copy_y_neon
-
-void vp9_extend_frame_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_borders vp9_extend_frame_borders_c
-
-void vp9_extend_frame_inner_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_inner_borders vp9_extend_frame_inner_borders_c
-
-void vpx_scale_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-#include "vpx_ports/arm.h"
-static void setup_rtcd_internal(void)
-{
- int flags = arm_cpu_caps();
-
- (void)flags;
-
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/armv7a-neon/vpx_version.h b/videocodec/libvpx_internal/armv7a-neon/vpx_version.h
deleted file mode 100644
index 9a354bb..0000000
--- a/videocodec/libvpx_internal/armv7a-neon/vpx_version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 2
-#define VERSION_PATCH 0
-#define VERSION_EXTRA "5082-g58f7543"
-#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define VERSION_STRING_NOSP "v1.2.0-5082-g58f7543"
-#define VERSION_STRING " v1.2.0-5082-g58f7543"
diff --git a/videocodec/libvpx_internal/armv7a/libvpx_srcs.txt b/videocodec/libvpx_internal/armv7a/libvpx_srcs.txt
deleted file mode 100644
index 0ca8a96..0000000
--- a/videocodec/libvpx_internal/armv7a/libvpx_srcs.txt
+++ /dev/null
@@ -1,284 +0,0 @@
-build/make/rtcd.sh
-build/make/version.sh
-CHANGELOG
-libs.mk
-vp8/common/alloccommon.c
-vp8/common/alloccommon.h
-vp8/common/arm/armv6/bilinearfilter_v6.asm.s
-vp8/common/arm/armv6/copymem16x16_v6.asm.s
-vp8/common/arm/armv6/copymem8x4_v6.asm.s
-vp8/common/arm/armv6/copymem8x8_v6.asm.s
-vp8/common/arm/armv6/dc_only_idct_add_v6.asm.s
-vp8/common/arm/armv6/dequant_idct_v6.asm.s
-vp8/common/arm/armv6/dequantize_v6.asm.s
-vp8/common/arm/armv6/filter_v6.asm.s
-vp8/common/arm/armv6/idct_blk_v6.c
-vp8/common/arm/armv6/idct_v6.asm.s
-vp8/common/arm/armv6/intra4x4_predict_v6.asm.s
-vp8/common/arm/armv6/iwalsh_v6.asm.s
-vp8/common/arm/armv6/loopfilter_v6.asm.s
-vp8/common/arm/armv6/simpleloopfilter_v6.asm.s
-vp8/common/arm/armv6/sixtappredict8x4_v6.asm.s
-vp8/common/arm/armv6/vp8_sad16x16_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance16x16_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance8x8_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm.s
-vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm.s
-vp8/common/arm/bilinearfilter_arm.c
-vp8/common/arm/bilinearfilter_arm.h
-vp8/common/arm/dequantize_arm.c
-vp8/common/arm/filter_arm.c
-vp8/common/arm/loopfilter_arm.c
-vp8/common/arm/reconintra_arm.c
-vp8/common/arm/variance_arm.c
-vp8/common/blockd.c
-vp8/common/blockd.h
-vp8/common/coefupdateprobs.h
-vp8/common/common.h
-vp8/common/debugmodes.c
-vp8/common/default_coef_probs.h
-vp8/common/dequantize.c
-vp8/common/entropy.c
-vp8/common/entropy.h
-vp8/common/entropymode.c
-vp8/common/entropymode.h
-vp8/common/entropymv.c
-vp8/common/entropymv.h
-vp8/common/extend.c
-vp8/common/extend.h
-vp8/common/filter.c
-vp8/common/filter.h
-vp8/common/findnearmv.c
-vp8/common/findnearmv.h
-vp8/common/generic/systemdependent.c
-vp8/common/header.h
-vp8/common/idct_blk.c
-vp8/common/idctllm.c
-vp8/common/invtrans.h
-vp8/common/loopfilter.c
-vp8/common/loopfilter_filters.c
-vp8/common/loopfilter.h
-vp8/common/mbpitch.c
-vp8/common/modecont.c
-vp8/common/modecont.h
-vp8/common/mv.h
-vp8/common/onyxc_int.h
-vp8/common/onyxd.h
-vp8/common/onyx.h
-vp8/common/ppflags.h
-vp8/common/pragmas.h
-vp8/common/quant_common.c
-vp8/common/quant_common.h
-vp8/common/reconinter.c
-vp8/common/reconinter.h
-vp8/common/reconintra4x4.c
-vp8/common/reconintra4x4.h
-vp8/common/reconintra.c
-vp8/common/rtcd.c
-vp8/common/rtcd_defs.sh
-vp8/common/sad_c.c
-vp8/common/setupintrarecon.c
-vp8/common/setupintrarecon.h
-vp8/common/swapyv12buffer.c
-vp8/common/swapyv12buffer.h
-vp8/common/systemdependent.h
-vp8/common/threading.h
-vp8/common/treecoder.c
-vp8/common/treecoder.h
-vp8/common/variance_c.c
-vp8/common/variance.h
-vp8/common/vp8_entropymodedata.h
-vp8/decoder/dboolhuff.c
-vp8/decoder/dboolhuff.h
-vp8/decoder/decodemv.c
-vp8/decoder/decodemv.h
-vp8/decoder/decoderthreading.h
-vp8/decoder/decodframe.c
-vp8/decoder/detokenize.c
-vp8/decoder/detokenize.h
-vp8/decoder/onyxd_if.c
-vp8/decoder/onyxd_int.h
-vp8/decoder/threading.c
-vp8/decoder/treereader.h
-vp8/encoder/arm/armv5te/boolhuff_armv5te.asm.s
-vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm.s
-vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm.s
-vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm.s
-vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm.s
-vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm.s
-vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm.s
-vp8/encoder/arm/armv6/vp8_subtract_armv6.asm.s
-vp8/encoder/arm/armv6/walsh_v6.asm.s
-vp8/encoder/arm/boolhuff_arm.c
-vp8/encoder/arm/dct_arm.c
-vp8/encoder/arm/quantize_arm.c
-vp8/encoder/bitstream.c
-vp8/encoder/bitstream.h
-vp8/encoder/block.h
-vp8/encoder/boolhuff.h
-vp8/encoder/dct.c
-vp8/encoder/dct_value_cost.h
-vp8/encoder/dct_value_tokens.h
-vp8/encoder/defaultcoefcounts.h
-vp8/encoder/denoising.c
-vp8/encoder/denoising.h
-vp8/encoder/encodeframe.c
-vp8/encoder/encodeframe.h
-vp8/encoder/encodeintra.c
-vp8/encoder/encodeintra.h
-vp8/encoder/encodemb.c
-vp8/encoder/encodemb.h
-vp8/encoder/encodemv.c
-vp8/encoder/encodemv.h
-vp8/encoder/ethreading.c
-vp8/encoder/firstpass.h
-vp8/encoder/lookahead.c
-vp8/encoder/lookahead.h
-vp8/encoder/mcomp.c
-vp8/encoder/mcomp.h
-vp8/encoder/modecosts.c
-vp8/encoder/modecosts.h
-vp8/encoder/onyx_if.c
-vp8/encoder/onyx_int.h
-vp8/encoder/pickinter.c
-vp8/encoder/pickinter.h
-vp8/encoder/picklpf.c
-vp8/encoder/psnr.c
-vp8/encoder/psnr.h
-vp8/encoder/quantize.c
-vp8/encoder/quantize.h
-vp8/encoder/ratectrl.c
-vp8/encoder/ratectrl.h
-vp8/encoder/rdopt.c
-vp8/encoder/rdopt.h
-vp8/encoder/segmentation.c
-vp8/encoder/segmentation.h
-vp8/encoder/tokenize.c
-vp8/encoder/tokenize.h
-vp8/encoder/treewriter.c
-vp8/encoder/treewriter.h
-vp8/encoder/vp8_asm_enc_offsets.c
-vp8/vp8_common.mk
-vp8/vp8cx_arm.mk
-vp8/vp8_cx_iface.c
-vp8/vp8cx.mk
-vp8/vp8_dx_iface.c
-vp8/vp8dx.mk
-vp9/common/generic/vp9_systemdependent.c
-vp9/common/vp9_alloccommon.c
-vp9/common/vp9_alloccommon.h
-vp9/common/vp9_blockd.h
-vp9/common/vp9_common_data.c
-vp9/common/vp9_common_data.h
-vp9/common/vp9_common.h
-vp9/common/vp9_convolve.c
-vp9/common/vp9_convolve.h
-vp9/common/vp9_debugmodes.c
-vp9/common/vp9_default_coef_probs.h
-vp9/common/vp9_entropy.c
-vp9/common/vp9_entropy.h
-vp9/common/vp9_entropymode.c
-vp9/common/vp9_entropymode.h
-vp9/common/vp9_entropymv.c
-vp9/common/vp9_entropymv.h
-vp9/common/vp9_enums.h
-vp9/common/vp9_extend.c
-vp9/common/vp9_extend.h
-vp9/common/vp9_filter.c
-vp9/common/vp9_filter.h
-vp9/common/vp9_findnearmv.c
-vp9/common/vp9_findnearmv.h
-vp9/common/vp9_idct.c
-vp9/common/vp9_idct.h
-vp9/common/vp9_loopfilter.c
-vp9/common/vp9_loopfilter_filters.c
-vp9/common/vp9_loopfilter.h
-vp9/common/vp9_mv.h
-vp9/common/vp9_mvref_common.c
-vp9/common/vp9_mvref_common.h
-vp9/common/vp9_onyxc_int.h
-vp9/common/vp9_onyx.h
-vp9/common/vp9_ppflags.h
-vp9/common/vp9_pragmas.h
-vp9/common/vp9_pred_common.c
-vp9/common/vp9_pred_common.h
-vp9/common/vp9_quant_common.c
-vp9/common/vp9_quant_common.h
-vp9/common/vp9_reconinter.c
-vp9/common/vp9_reconinter.h
-vp9/common/vp9_reconintra.c
-vp9/common/vp9_reconintra.h
-vp9/common/vp9_rtcd.c
-vp9/common/vp9_rtcd_defs.sh
-vp9/common/vp9_sadmxn.h
-vp9/common/vp9_scale.c
-vp9/common/vp9_scale.h
-vp9/common/vp9_scan.c
-vp9/common/vp9_scan.h
-vp9/common/vp9_seg_common.c
-vp9/common/vp9_seg_common.h
-vp9/common/vp9_systemdependent.h
-vp9/common/vp9_textblit.h
-vp9/common/vp9_tile_common.c
-vp9/common/vp9_tile_common.h
-vp9/common/vp9_treecoder.c
-vp9/common/vp9_treecoder.h
-vp9/decoder/vp9_dboolhuff.c
-vp9/decoder/vp9_dboolhuff.h
-vp9/decoder/vp9_decodemv.c
-vp9/decoder/vp9_decodemv.h
-vp9/decoder/vp9_decodframe.c
-vp9/decoder/vp9_decodframe.h
-vp9/decoder/vp9_detokenize.c
-vp9/decoder/vp9_detokenize.h
-vp9/decoder/vp9_dsubexp.c
-vp9/decoder/vp9_dsubexp.h
-vp9/decoder/vp9_onyxd.h
-vp9/decoder/vp9_onyxd_if.c
-vp9/decoder/vp9_onyxd_int.h
-vp9/decoder/vp9_read_bit_buffer.h
-vp9/decoder/vp9_thread.c
-vp9/decoder/vp9_thread.h
-vp9/decoder/vp9_treereader.h
-vp9/vp9_common.mk
-vp9/vp9_dx_iface.c
-vp9/vp9dx.mk
-vp9/vp9_iface_common.h
-vpx_config.c
-vpx/internal/vpx_codec_internal.h
-vpx_mem/include/vpx_mem_intrnl.h
-vpx_mem/vpx_mem.c
-vpx_mem/vpx_mem.h
-vpx_mem/vpx_mem.mk
-vpx_ports/arm_cpudetect.c
-vpx_ports/arm.h
-vpx_ports/asm_offsets.h
-vpx_ports/emmintrin_compat.h
-vpx_ports/mem.h
-vpx_ports/vpx_once.h
-vpx_ports/vpx_ports.mk
-vpx_ports/vpx_timer.h
-vpx_scale/generic/gen_scalers.c
-vpx_scale/generic/vpx_scale.c
-vpx_scale/generic/yv12config.c
-vpx_scale/generic/yv12extend.c
-vpx_scale/vpx_scale_asm_offsets.c
-vpx_scale/vpx_scale.h
-vpx_scale/vpx_scale.mk
-vpx_scale/vpx_scale_rtcd.c
-vpx_scale/vpx_scale_rtcd.sh
-vpx_scale/yv12config.h
-vpx/src/vpx_codec.c
-vpx/src/vpx_decoder.c
-vpx/src/vpx_encoder.c
-vpx/src/vpx_image.c
-vpx/vp8cx.h
-vpx/vp8dx.h
-vpx/vp8.h
-vpx/vpx_codec.h
-vpx/vpx_codec.mk
-vpx/vpx_decoder.h
-vpx/vpx_encoder.h
-vpx/vpx_image.h
-vpx/vpx_integer.h
diff --git a/videocodec/libvpx_internal/armv7a/vp8_rtcd.h b/videocodec/libvpx_internal/armv7a/vp8_rtcd.h
deleted file mode 100644
index fa79b13..0000000
--- a/videocodec/libvpx_internal/armv7a/vp8_rtcd.h
+++ /dev/null
@@ -1,349 +0,0 @@
-#ifndef VP8_RTCD_H_
-#define VP8_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP8
- */
-
-struct blockd;
-struct macroblockd;
-struct loop_filter_info;
-
-/* Encoder forward decls */
-struct block;
-struct macroblock;
-struct variance_vtable;
-union int_mv;
-struct yv12_buffer_config;
-
-void vp8_clear_system_state_c();
-#define vp8_clear_system_state vp8_clear_system_state_c
-
-void vp8_dequantize_b_c(struct blockd*, short *dqc);
-void vp8_dequantize_b_v6(struct blockd*, short *dqc);
-#define vp8_dequantize_b vp8_dequantize_b_v6
-
-void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *output, int stride);
-void vp8_dequant_idct_add_v6(short *input, short *dq, unsigned char *output, int stride);
-#define vp8_dequant_idct_add vp8_dequant_idct_add_v6
-
-void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-void vp8_dequant_idct_add_y_block_v6(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_v6
-
-void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-void vp8_dequant_idct_add_uv_block_v6(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_v6
-
-void vp8_loop_filter_mbv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbv_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbv vp8_loop_filter_mbv_armv6
-
-void vp8_loop_filter_bv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bv_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bv vp8_loop_filter_bv_armv6
-
-void vp8_loop_filter_mbh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbh_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbh vp8_loop_filter_mbh_armv6
-
-void vp8_loop_filter_bh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bh_armv6(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bh vp8_loop_filter_bh_armv6
-
-void vp8_loop_filter_simple_vertical_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_vertical_edge_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbv vp8_loop_filter_simple_vertical_edge_armv6
-
-void vp8_loop_filter_simple_horizontal_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_horizontal_edge_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbh vp8_loop_filter_simple_horizontal_edge_armv6
-
-void vp8_loop_filter_bvs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bvs_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bv vp8_loop_filter_bvs_armv6
-
-void vp8_loop_filter_bhs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bhs_armv6(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bh vp8_loop_filter_bhs_armv6
-
-void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-void vp8_short_idct4x4llm_v6_dual(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-#define vp8_short_idct4x4llm vp8_short_idct4x4llm_v6_dual
-
-void vp8_short_inv_walsh4x4_1_c(short *input, short *output);
-#define vp8_short_inv_walsh4x4_1 vp8_short_inv_walsh4x4_1_c
-
-void vp8_short_inv_walsh4x4_c(short *input, short *output);
-void vp8_short_inv_walsh4x4_v6(short *input, short *output);
-#define vp8_short_inv_walsh4x4 vp8_short_inv_walsh4x4_v6
-
-void vp8_dc_only_idct_add_c(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-void vp8_dc_only_idct_add_v6(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-#define vp8_dc_only_idct_add vp8_dc_only_idct_add_v6
-
-void vp8_copy_mem16x16_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem16x16_v6(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem16x16 vp8_copy_mem16x16_v6
-
-void vp8_copy_mem8x8_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x8_v6(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x8 vp8_copy_mem8x8_v6
-
-void vp8_copy_mem8x4_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x4_v6(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x4 vp8_copy_mem8x4_v6
-
-void vp8_build_intra_predictors_mby_s_c(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-#define vp8_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_c
-
-void vp8_build_intra_predictors_mbuv_s_c(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-#define vp8_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s_c
-
-void vp8_intra4x4_predict_c(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-void vp8_intra4x4_predict_armv6(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-#define vp8_intra4x4_predict vp8_intra4x4_predict_armv6
-
-void vp8_sixtap_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict16x16_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict16x16 vp8_sixtap_predict16x16_armv6
-
-void vp8_sixtap_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x8_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x8 vp8_sixtap_predict8x8_armv6
-
-void vp8_sixtap_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x4 vp8_sixtap_predict8x4_armv6
-
-void vp8_sixtap_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict4x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict4x4 vp8_sixtap_predict4x4_armv6
-
-void vp8_bilinear_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict16x16_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict16x16 vp8_bilinear_predict16x16_armv6
-
-void vp8_bilinear_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x8_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x8 vp8_bilinear_predict8x8_armv6
-
-void vp8_bilinear_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x4 vp8_bilinear_predict8x4_armv6
-
-void vp8_bilinear_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict4x4_armv6(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict4x4 vp8_bilinear_predict4x4_armv6
-
-unsigned int vp8_variance4x4_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance4x4 vp8_variance4x4_c
-
-unsigned int vp8_variance8x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x8_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x8 vp8_variance8x8_armv6
-
-unsigned int vp8_variance8x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x16 vp8_variance8x16_c
-
-unsigned int vp8_variance16x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x8 vp8_variance16x8_c
-
-unsigned int vp8_variance16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x16_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x16 vp8_variance16x16_armv6
-
-unsigned int vp8_sub_pixel_variance4x4_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance4x4 vp8_sub_pixel_variance4x4_c
-
-unsigned int vp8_sub_pixel_variance8x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance8x8_armv6(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x8 vp8_sub_pixel_variance8x8_armv6
-
-unsigned int vp8_sub_pixel_variance8x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x16 vp8_sub_pixel_variance8x16_c
-
-unsigned int vp8_sub_pixel_variance16x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x8 vp8_sub_pixel_variance16x8_c
-
-unsigned int vp8_sub_pixel_variance16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x16_armv6(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x16 vp8_sub_pixel_variance16x16_armv6
-
-unsigned int vp8_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_h_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_h vp8_variance_halfpixvar16x16_h_armv6
-
-unsigned int vp8_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_v_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_v vp8_variance_halfpixvar16x16_v_armv6
-
-unsigned int vp8_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_hv_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_hv vp8_variance_halfpixvar16x16_hv_armv6
-
-unsigned int vp8_sad4x4_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad4x4 vp8_sad4x4_c
-
-unsigned int vp8_sad8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x8 vp8_sad8x8_c
-
-unsigned int vp8_sad8x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x16 vp8_sad8x16_c
-
-unsigned int vp8_sad16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x8 vp8_sad16x8_c
-
-unsigned int vp8_sad16x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x16_armv6(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x16 vp8_sad16x16_armv6
-
-void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x3 vp8_sad4x4x3_c
-
-void vp8_sad8x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x3 vp8_sad8x8x3_c
-
-void vp8_sad8x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x3 vp8_sad8x16x3_c
-
-void vp8_sad16x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x3 vp8_sad16x8x3_c
-
-void vp8_sad16x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x3 vp8_sad16x16x3_c
-
-void vp8_sad4x4x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad4x4x8 vp8_sad4x4x8_c
-
-void vp8_sad8x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x8x8 vp8_sad8x8x8_c
-
-void vp8_sad8x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x16x8 vp8_sad8x16x8_c
-
-void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x8x8 vp8_sad16x8x8_c
-
-void vp8_sad16x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x16x8 vp8_sad16x16x8_c
-
-void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x4d vp8_sad4x4x4d_c
-
-void vp8_sad8x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x4d vp8_sad8x8x4d_c
-
-void vp8_sad8x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x4d vp8_sad8x16x4d_c
-
-void vp8_sad16x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x4d vp8_sad16x8x4d_c
-
-void vp8_sad16x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x4d vp8_sad16x16x4d_c
-
-unsigned int vp8_get_mb_ss_c(const short *);
-#define vp8_get_mb_ss vp8_get_mb_ss_c
-
-unsigned int vp8_sub_pixel_mse16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_mse16x16 vp8_sub_pixel_mse16x16_c
-
-unsigned int vp8_mse16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_mse16x16_armv6(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_mse16x16 vp8_mse16x16_armv6
-
-unsigned int vp8_get4x4sse_cs_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-#define vp8_get4x4sse_cs vp8_get4x4sse_cs_c
-
-void vp8_short_fdct4x4_c(short *input, short *output, int pitch);
-void vp8_short_fdct4x4_armv6(short *input, short *output, int pitch);
-#define vp8_short_fdct4x4 vp8_short_fdct4x4_armv6
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch);
-void vp8_short_fdct8x4_armv6(short *input, short *output, int pitch);
-#define vp8_short_fdct8x4 vp8_short_fdct8x4_armv6
-
-void vp8_short_walsh4x4_c(short *input, short *output, int pitch);
-void vp8_short_walsh4x4_armv6(short *input, short *output, int pitch);
-#define vp8_short_walsh4x4 vp8_short_walsh4x4_armv6
-
-void vp8_regular_quantize_b_c(struct block *, struct blockd *);
-#define vp8_regular_quantize_b vp8_regular_quantize_b_c
-
-void vp8_fast_quantize_b_c(struct block *, struct blockd *);
-void vp8_fast_quantize_b_armv6(struct block *, struct blockd *);
-#define vp8_fast_quantize_b vp8_fast_quantize_b_armv6
-
-void vp8_regular_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_regular_quantize_b_pair vp8_regular_quantize_b_pair_c
-
-void vp8_fast_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_fast_quantize_b_pair vp8_fast_quantize_b_pair_c
-
-void vp8_quantize_mb_c(struct macroblock *);
-#define vp8_quantize_mb vp8_quantize_mb_c
-
-void vp8_quantize_mby_c(struct macroblock *);
-#define vp8_quantize_mby vp8_quantize_mby_c
-
-void vp8_quantize_mbuv_c(struct macroblock *);
-#define vp8_quantize_mbuv vp8_quantize_mbuv_c
-
-int vp8_block_error_c(short *coeff, short *dqcoeff);
-#define vp8_block_error vp8_block_error_c
-
-int vp8_mbblock_error_c(struct macroblock *mb, int dc);
-#define vp8_mbblock_error vp8_mbblock_error_c
-
-int vp8_mbuverror_c(struct macroblock *mb);
-#define vp8_mbuverror vp8_mbuverror_c
-
-void vp8_subtract_b_c(struct block *be, struct blockd *bd, int pitch);
-void vp8_subtract_b_armv6(struct block *be, struct blockd *bd, int pitch);
-#define vp8_subtract_b vp8_subtract_b_armv6
-
-void vp8_subtract_mby_c(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-void vp8_subtract_mby_armv6(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-#define vp8_subtract_mby vp8_subtract_mby_armv6
-
-void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-void vp8_subtract_mbuv_armv6(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-#define vp8_subtract_mbuv vp8_subtract_mbuv_armv6
-
-int vp8_full_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_full_search_sad vp8_full_search_sad_c
-
-int vp8_refining_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_refining_search_sad vp8_refining_search_sad_c
-
-int vp8_diamond_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_diamond_search_sad vp8_diamond_search_sad_c
-
-void vp8_yv12_copy_partial_frame_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_partial_frame vp8_yv12_copy_partial_frame_c
-
-int vp8_denoiser_filter_c(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-#define vp8_denoiser_filter vp8_denoiser_filter_c
-
-void vp8_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-#include "vpx_ports/arm.h"
-static void setup_rtcd_internal(void)
-{
- int flags = arm_cpu_caps();
-
- (void)flags;
-
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/armv7a/vp9_rtcd.h b/videocodec/libvpx_internal/armv7a/vp9_rtcd.h
deleted file mode 100644
index abcb56a..0000000
--- a/videocodec/libvpx_internal/armv7a/vp9_rtcd.h
+++ /dev/null
@@ -1,296 +0,0 @@
-#ifndef VP9_RTCD_H_
-#define VP9_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP9
- */
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_enums.h"
-
-struct macroblockd;
-
-/* Encoder forward decls */
-struct macroblock;
-struct vp9_variance_vtable;
-
-#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
-union int_mv;
-struct yv12_buffer_config;
-
-void vp9_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_4x4 vp9_d207_predictor_4x4_c
-
-void vp9_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_4x4 vp9_d45_predictor_4x4_c
-
-void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_4x4 vp9_d63_predictor_4x4_c
-
-void vp9_h_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_4x4 vp9_h_predictor_4x4_c
-
-void vp9_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_4x4 vp9_d117_predictor_4x4_c
-
-void vp9_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_4x4 vp9_d135_predictor_4x4_c
-
-void vp9_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_4x4 vp9_d153_predictor_4x4_c
-
-void vp9_v_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_4x4 vp9_v_predictor_4x4_c
-
-void vp9_tm_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_4x4 vp9_tm_predictor_4x4_c
-
-void vp9_dc_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_4x4 vp9_dc_predictor_4x4_c
-
-void vp9_dc_top_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_4x4 vp9_dc_top_predictor_4x4_c
-
-void vp9_dc_left_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_4x4 vp9_dc_left_predictor_4x4_c
-
-void vp9_dc_128_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_4x4 vp9_dc_128_predictor_4x4_c
-
-void vp9_d207_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_8x8 vp9_d207_predictor_8x8_c
-
-void vp9_d45_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_8x8 vp9_d45_predictor_8x8_c
-
-void vp9_d63_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_8x8 vp9_d63_predictor_8x8_c
-
-void vp9_h_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_8x8 vp9_h_predictor_8x8_c
-
-void vp9_d117_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_8x8 vp9_d117_predictor_8x8_c
-
-void vp9_d135_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_8x8 vp9_d135_predictor_8x8_c
-
-void vp9_d153_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_8x8 vp9_d153_predictor_8x8_c
-
-void vp9_v_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_8x8 vp9_v_predictor_8x8_c
-
-void vp9_tm_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_8x8 vp9_tm_predictor_8x8_c
-
-void vp9_dc_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_8x8 vp9_dc_predictor_8x8_c
-
-void vp9_dc_top_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_8x8 vp9_dc_top_predictor_8x8_c
-
-void vp9_dc_left_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_8x8 vp9_dc_left_predictor_8x8_c
-
-void vp9_dc_128_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_8x8 vp9_dc_128_predictor_8x8_c
-
-void vp9_d207_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_16x16 vp9_d207_predictor_16x16_c
-
-void vp9_d45_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_16x16 vp9_d45_predictor_16x16_c
-
-void vp9_d63_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_16x16 vp9_d63_predictor_16x16_c
-
-void vp9_h_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_16x16 vp9_h_predictor_16x16_c
-
-void vp9_d117_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_16x16 vp9_d117_predictor_16x16_c
-
-void vp9_d135_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_16x16 vp9_d135_predictor_16x16_c
-
-void vp9_d153_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_16x16 vp9_d153_predictor_16x16_c
-
-void vp9_v_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_16x16 vp9_v_predictor_16x16_c
-
-void vp9_tm_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_16x16 vp9_tm_predictor_16x16_c
-
-void vp9_dc_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_16x16 vp9_dc_predictor_16x16_c
-
-void vp9_dc_top_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_16x16 vp9_dc_top_predictor_16x16_c
-
-void vp9_dc_left_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_16x16 vp9_dc_left_predictor_16x16_c
-
-void vp9_dc_128_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_16x16 vp9_dc_128_predictor_16x16_c
-
-void vp9_d207_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_32x32 vp9_d207_predictor_32x32_c
-
-void vp9_d45_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_32x32 vp9_d45_predictor_32x32_c
-
-void vp9_d63_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_32x32 vp9_d63_predictor_32x32_c
-
-void vp9_h_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_32x32 vp9_h_predictor_32x32_c
-
-void vp9_d117_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_32x32 vp9_d117_predictor_32x32_c
-
-void vp9_d135_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_32x32 vp9_d135_predictor_32x32_c
-
-void vp9_d153_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_32x32 vp9_d153_predictor_32x32_c
-
-void vp9_v_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_32x32 vp9_v_predictor_32x32_c
-
-void vp9_tm_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_32x32 vp9_tm_predictor_32x32_c
-
-void vp9_dc_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_32x32 vp9_dc_predictor_32x32_c
-
-void vp9_dc_top_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_32x32 vp9_dc_top_predictor_32x32_c
-
-void vp9_dc_left_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_32x32 vp9_dc_left_predictor_32x32_c
-
-void vp9_dc_128_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_32x32 vp9_dc_128_predictor_32x32_c
-
-void vp9_mb_lpf_vertical_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-#define vp9_mb_lpf_vertical_edge_w vp9_mb_lpf_vertical_edge_w_c
-
-void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_vertical_edge vp9_mbloop_filter_vertical_edge_c
-
-void vp9_loop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_vertical_edge vp9_loop_filter_vertical_edge_c
-
-void vp9_mb_lpf_horizontal_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mb_lpf_horizontal_edge_w vp9_mb_lpf_horizontal_edge_w_c
-
-void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_horizontal_edge vp9_mbloop_filter_horizontal_edge_c
-
-void vp9_loop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_horizontal_edge vp9_loop_filter_horizontal_edge_c
-
-void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_inner vp9_blend_mb_inner_c
-
-void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_outer vp9_blend_mb_outer_c
-
-void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_b vp9_blend_b_c
-
-void vp9_convolve_copy_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);
-#define vp9_convolve_copy vp9_convolve_copy_c
-
-void vp9_convolve_avg_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);
-#define vp9_convolve_avg vp9_convolve_avg_c
-
-void vp9_convolve8_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);
-#define vp9_convolve8 vp9_convolve8_c
-
-void vp9_convolve8_horiz_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);
-#define vp9_convolve8_horiz vp9_convolve8_horiz_c
-
-void vp9_convolve8_vert_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);
-#define vp9_convolve8_vert vp9_convolve8_vert_c
-
-void vp9_convolve8_avg_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);
-#define vp9_convolve8_avg vp9_convolve8_avg_c
-
-void vp9_convolve8_avg_horiz_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);
-#define vp9_convolve8_avg_horiz vp9_convolve8_avg_horiz_c
-
-void vp9_convolve8_avg_vert_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);
-#define vp9_convolve8_avg_vert vp9_convolve8_avg_vert_c
-
-void vp9_idct4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_1_add vp9_idct4x4_1_add_c
-
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_16_add vp9_idct4x4_16_add_c
-
-void vp9_idct8x8_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_1_add vp9_idct8x8_1_add_c
-
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_64_add vp9_idct8x8_64_add_c
-
-void vp9_idct8x8_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_10_add vp9_idct8x8_10_add_c
-
-void vp9_idct16x16_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_1_add vp9_idct16x16_1_add_c
-
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_256_add vp9_idct16x16_256_add_c
-
-void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_10_add vp9_idct16x16_10_add_c
-
-void vp9_idct32x32_1024_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1024_add vp9_idct32x32_1024_add_c
-
-void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_34_add vp9_idct32x32_34_add_c
-
-void vp9_idct32x32_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1_add vp9_idct32x32_1_add_c
-
-void vp9_iht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht4x4_16_add vp9_iht4x4_16_add_c
-
-void vp9_iht8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht8x8_64_add vp9_iht8x8_64_add_c
-
-void vp9_iht16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-#define vp9_iht16x16_256_add vp9_iht16x16_256_add_c
-
-void vp9_iwht4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_1_add vp9_iwht4x4_1_add_c
-
-void vp9_iwht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_16_add vp9_iwht4x4_16_add_c
-
-void vp9_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-#include "vpx_ports/arm.h"
-static void setup_rtcd_internal(void)
-{
- int flags = arm_cpu_caps();
-
- (void)flags;
-
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/armv7a/vpx_config.c b/videocodec/libvpx_internal/armv7a/vpx_config.c
deleted file mode 100644
index ecdb0cf..0000000
--- a/videocodec/libvpx_internal/armv7a/vpx_config.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-static const char* const cfg = "--target=armv7-android-gcc --disable-runtime-cpu-detect --sdk-path=/usr/local/google/home/hkuang/Downloads/android-ndk-r8e --disable-vp9-encoder --disable-neon --disable-examples --disable-docs --enable-realtime-only";
-const char *vpx_codec_build_config(void) {return cfg;}
diff --git a/videocodec/libvpx_internal/armv7a/vpx_config.h b/videocodec/libvpx_internal/armv7a/vpx_config.h
deleted file mode 100644
index 3c31203..0000000
--- a/videocodec/libvpx_internal/armv7a/vpx_config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-/* This file automatically generated by configure. Do not edit! */
-#ifndef VPX_CONFIG_H
-#define VPX_CONFIG_H
-#define RESTRICT
-#define INLINE __inline__ __attribute__((always_inline))
-#define ARCH_ARM 1
-#define ARCH_MIPS 0
-#define ARCH_X86_32 0
-#define ARCH_X86_64 0
-#define ARCH_PPC32 0
-#define ARCH_PPC64 0
-#define HAVE_EDSP 1
-#define HAVE_MEDIA 1
-#define HAVE_NEON 0
-#define HAVE_MIPS32 0
-#define HAVE_DSPR2 0
-#define HAVE_MMX 0
-#define HAVE_SSE 0
-#define HAVE_SSE2 0
-#define HAVE_SSE3 0
-#define HAVE_SSSE3 0
-#define HAVE_SSE4_1 0
-#define HAVE_AVX 0
-#define HAVE_AVX2 0
-#define HAVE_ALTIVEC 0
-#define HAVE_VPX_PORTS 1
-#define HAVE_STDINT_H 1
-#define HAVE_ALT_TREE_LAYOUT 0
-#define HAVE_PTHREAD_H 1
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_UNISTD_H 1
-#define CONFIG_EXTERNAL_BUILD 0
-#define CONFIG_INSTALL_DOCS 0
-#define CONFIG_INSTALL_BINS 1
-#define CONFIG_INSTALL_LIBS 1
-#define CONFIG_INSTALL_SRCS 0
-#define CONFIG_USE_X86INC 1
-#define CONFIG_DEBUG 0
-#define CONFIG_GPROF 0
-#define CONFIG_GCOV 0
-#define CONFIG_RVCT 0
-#define CONFIG_GCC 1
-#define CONFIG_MSVS 0
-#define CONFIG_PIC 1
-#define CONFIG_BIG_ENDIAN 0
-#define CONFIG_CODEC_SRCS 0
-#define CONFIG_DEBUG_LIBS 0
-#define CONFIG_FAST_UNALIGNED 1
-#define CONFIG_MEM_MANAGER 0
-#define CONFIG_MEM_TRACKER 0
-#define CONFIG_MEM_CHECKS 0
-#define CONFIG_MD5 1
-#define CONFIG_DEQUANT_TOKENS 0
-#define CONFIG_DC_RECON 0
-#define CONFIG_RUNTIME_CPU_DETECT 0
-#define CONFIG_POSTPROC 0
-#define CONFIG_VP9_POSTPROC 0
-#define CONFIG_MULTITHREAD 1
-#define CONFIG_INTERNAL_STATS 0
-#define CONFIG_VP8_ENCODER 1
-#define CONFIG_VP8_DECODER 1
-#define CONFIG_VP9_ENCODER 0
-#define CONFIG_VP9_DECODER 1
-#define CONFIG_VP8 1
-#define CONFIG_VP9 1
-#define CONFIG_ENCODERS 1
-#define CONFIG_DECODERS 1
-#define CONFIG_STATIC_MSVCRT 0
-#define CONFIG_SPATIAL_RESAMPLING 1
-#define CONFIG_REALTIME_ONLY 1
-#define CONFIG_ONTHEFLY_BITPACKING 0
-#define CONFIG_ERROR_CONCEALMENT 0
-#define CONFIG_SHARED 0
-#define CONFIG_STATIC 1
-#define CONFIG_SMALL 0
-#define CONFIG_POSTPROC_VISUALIZER 0
-#define CONFIG_OS_SUPPORT 1
-#define CONFIG_UNIT_TESTS 0
-#define CONFIG_MULTI_RES_ENCODING 0
-#define CONFIG_TEMPORAL_DENOISING 1
-#define CONFIG_EXPERIMENTAL 0
-#define CONFIG_DECRYPT 0
-#define CONFIG_MULTIPLE_ARF 0
-#define CONFIG_NON420 0
-#define CONFIG_ALPHA 0
-#endif /* VPX_CONFIG_H */
diff --git a/videocodec/libvpx_internal/armv7a/vpx_scale_rtcd.h b/videocodec/libvpx_internal/armv7a/vpx_scale_rtcd.h
deleted file mode 100644
index 0df8b37..0000000
--- a/videocodec/libvpx_internal/armv7a/vpx_scale_rtcd.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef VPX_SCALE_RTCD_H_
-#define VPX_SCALE_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-struct yv12_buffer_config;
-
-void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
-
-void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
-
-void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
-
-void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
-
-void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
-
-void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
-#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_c
-
-void vp8_yv12_copy_frame_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_frame vp8_yv12_copy_frame_c
-
-void vpx_yv12_copy_y_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vpx_yv12_copy_y vpx_yv12_copy_y_c
-
-void vp9_extend_frame_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_borders vp9_extend_frame_borders_c
-
-void vp9_extend_frame_inner_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_inner_borders vp9_extend_frame_inner_borders_c
-
-void vpx_scale_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-#include "vpx_ports/arm.h"
-static void setup_rtcd_internal(void)
-{
- int flags = arm_cpu_caps();
-
- (void)flags;
-
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/armv7a/vpx_version.h b/videocodec/libvpx_internal/armv7a/vpx_version.h
deleted file mode 100644
index 9a354bb..0000000
--- a/videocodec/libvpx_internal/armv7a/vpx_version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 2
-#define VERSION_PATCH 0
-#define VERSION_EXTRA "5082-g58f7543"
-#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define VERSION_STRING_NOSP "v1.2.0-5082-g58f7543"
-#define VERSION_STRING " v1.2.0-5082-g58f7543"
diff --git a/videocodec/libvpx_internal/generic/libvpx_srcs.txt b/videocodec/libvpx_internal/generic/libvpx_srcs.txt
deleted file mode 100644
index e07d5af..0000000
--- a/videocodec/libvpx_internal/generic/libvpx_srcs.txt
+++ /dev/null
@@ -1,242 +0,0 @@
-build/make/rtcd.sh
-build/make/version.sh
-CHANGELOG
-libs.mk
-vp8/common/alloccommon.c
-vp8/common/alloccommon.h
-vp8/common/blockd.c
-vp8/common/blockd.h
-vp8/common/coefupdateprobs.h
-vp8/common/common.h
-vp8/common/debugmodes.c
-vp8/common/default_coef_probs.h
-vp8/common/dequantize.c
-vp8/common/entropy.c
-vp8/common/entropy.h
-vp8/common/entropymode.c
-vp8/common/entropymode.h
-vp8/common/entropymv.c
-vp8/common/entropymv.h
-vp8/common/extend.c
-vp8/common/extend.h
-vp8/common/filter.c
-vp8/common/filter.h
-vp8/common/findnearmv.c
-vp8/common/findnearmv.h
-vp8/common/generic/systemdependent.c
-vp8/common/header.h
-vp8/common/idct_blk.c
-vp8/common/idctllm.c
-vp8/common/invtrans.h
-vp8/common/loopfilter.c
-vp8/common/loopfilter_filters.c
-vp8/common/loopfilter.h
-vp8/common/mbpitch.c
-vp8/common/modecont.c
-vp8/common/modecont.h
-vp8/common/mv.h
-vp8/common/onyxc_int.h
-vp8/common/onyxd.h
-vp8/common/onyx.h
-vp8/common/ppflags.h
-vp8/common/pragmas.h
-vp8/common/quant_common.c
-vp8/common/quant_common.h
-vp8/common/reconinter.c
-vp8/common/reconinter.h
-vp8/common/reconintra4x4.c
-vp8/common/reconintra4x4.h
-vp8/common/reconintra.c
-vp8/common/rtcd.c
-vp8/common/rtcd_defs.sh
-vp8/common/sad_c.c
-vp8/common/setupintrarecon.c
-vp8/common/setupintrarecon.h
-vp8/common/swapyv12buffer.c
-vp8/common/swapyv12buffer.h
-vp8/common/systemdependent.h
-vp8/common/threading.h
-vp8/common/treecoder.c
-vp8/common/treecoder.h
-vp8/common/variance_c.c
-vp8/common/variance.h
-vp8/common/vp8_entropymodedata.h
-vp8/decoder/dboolhuff.c
-vp8/decoder/dboolhuff.h
-vp8/decoder/decodemv.c
-vp8/decoder/decodemv.h
-vp8/decoder/decoderthreading.h
-vp8/decoder/decodframe.c
-vp8/decoder/detokenize.c
-vp8/decoder/detokenize.h
-vp8/decoder/onyxd_if.c
-vp8/decoder/onyxd_int.h
-vp8/decoder/threading.c
-vp8/decoder/treereader.h
-vp8/encoder/bitstream.c
-vp8/encoder/bitstream.h
-vp8/encoder/block.h
-vp8/encoder/boolhuff.c
-vp8/encoder/boolhuff.h
-vp8/encoder/dct.c
-vp8/encoder/dct_value_cost.h
-vp8/encoder/dct_value_tokens.h
-vp8/encoder/defaultcoefcounts.h
-vp8/encoder/denoising.c
-vp8/encoder/denoising.h
-vp8/encoder/encodeframe.c
-vp8/encoder/encodeframe.h
-vp8/encoder/encodeintra.c
-vp8/encoder/encodeintra.h
-vp8/encoder/encodemb.c
-vp8/encoder/encodemb.h
-vp8/encoder/encodemv.c
-vp8/encoder/encodemv.h
-vp8/encoder/ethreading.c
-vp8/encoder/firstpass.h
-vp8/encoder/lookahead.c
-vp8/encoder/lookahead.h
-vp8/encoder/mcomp.c
-vp8/encoder/mcomp.h
-vp8/encoder/modecosts.c
-vp8/encoder/modecosts.h
-vp8/encoder/onyx_if.c
-vp8/encoder/onyx_int.h
-vp8/encoder/pickinter.c
-vp8/encoder/pickinter.h
-vp8/encoder/picklpf.c
-vp8/encoder/psnr.c
-vp8/encoder/psnr.h
-vp8/encoder/quantize.c
-vp8/encoder/quantize.h
-vp8/encoder/ratectrl.c
-vp8/encoder/ratectrl.h
-vp8/encoder/rdopt.c
-vp8/encoder/rdopt.h
-vp8/encoder/segmentation.c
-vp8/encoder/segmentation.h
-vp8/encoder/tokenize.c
-vp8/encoder/tokenize.h
-vp8/encoder/treewriter.c
-vp8/encoder/treewriter.h
-vp8/encoder/vp8_asm_enc_offsets.c
-vp8/vp8_common.mk
-vp8/vp8_cx_iface.c
-vp8/vp8cx.mk
-vp8/vp8_dx_iface.c
-vp8/vp8dx.mk
-vp9/common/generic/vp9_systemdependent.c
-vp9/common/vp9_alloccommon.c
-vp9/common/vp9_alloccommon.h
-vp9/common/vp9_blockd.h
-vp9/common/vp9_common_data.c
-vp9/common/vp9_common_data.h
-vp9/common/vp9_common.h
-vp9/common/vp9_convolve.c
-vp9/common/vp9_convolve.h
-vp9/common/vp9_debugmodes.c
-vp9/common/vp9_default_coef_probs.h
-vp9/common/vp9_entropy.c
-vp9/common/vp9_entropy.h
-vp9/common/vp9_entropymode.c
-vp9/common/vp9_entropymode.h
-vp9/common/vp9_entropymv.c
-vp9/common/vp9_entropymv.h
-vp9/common/vp9_enums.h
-vp9/common/vp9_extend.c
-vp9/common/vp9_extend.h
-vp9/common/vp9_filter.c
-vp9/common/vp9_filter.h
-vp9/common/vp9_findnearmv.c
-vp9/common/vp9_findnearmv.h
-vp9/common/vp9_idct.c
-vp9/common/vp9_idct.h
-vp9/common/vp9_loopfilter.c
-vp9/common/vp9_loopfilter_filters.c
-vp9/common/vp9_loopfilter.h
-vp9/common/vp9_mv.h
-vp9/common/vp9_mvref_common.c
-vp9/common/vp9_mvref_common.h
-vp9/common/vp9_onyxc_int.h
-vp9/common/vp9_onyx.h
-vp9/common/vp9_ppflags.h
-vp9/common/vp9_pragmas.h
-vp9/common/vp9_pred_common.c
-vp9/common/vp9_pred_common.h
-vp9/common/vp9_quant_common.c
-vp9/common/vp9_quant_common.h
-vp9/common/vp9_reconinter.c
-vp9/common/vp9_reconinter.h
-vp9/common/vp9_reconintra.c
-vp9/common/vp9_reconintra.h
-vp9/common/vp9_rtcd.c
-vp9/common/vp9_rtcd_defs.sh
-vp9/common/vp9_sadmxn.h
-vp9/common/vp9_scale.c
-vp9/common/vp9_scale.h
-vp9/common/vp9_scan.c
-vp9/common/vp9_scan.h
-vp9/common/vp9_seg_common.c
-vp9/common/vp9_seg_common.h
-vp9/common/vp9_systemdependent.h
-vp9/common/vp9_textblit.h
-vp9/common/vp9_tile_common.c
-vp9/common/vp9_tile_common.h
-vp9/common/vp9_treecoder.c
-vp9/common/vp9_treecoder.h
-vp9/decoder/vp9_dboolhuff.c
-vp9/decoder/vp9_dboolhuff.h
-vp9/decoder/vp9_decodemv.c
-vp9/decoder/vp9_decodemv.h
-vp9/decoder/vp9_decodframe.c
-vp9/decoder/vp9_decodframe.h
-vp9/decoder/vp9_detokenize.c
-vp9/decoder/vp9_detokenize.h
-vp9/decoder/vp9_dsubexp.c
-vp9/decoder/vp9_dsubexp.h
-vp9/decoder/vp9_onyxd.h
-vp9/decoder/vp9_onyxd_if.c
-vp9/decoder/vp9_onyxd_int.h
-vp9/decoder/vp9_read_bit_buffer.h
-vp9/decoder/vp9_thread.c
-vp9/decoder/vp9_thread.h
-vp9/decoder/vp9_treereader.h
-vp9/vp9_common.mk
-vp9/vp9_dx_iface.c
-vp9/vp9dx.mk
-vp9/vp9_iface_common.h
-vpx_config.c
-vpx/internal/vpx_codec_internal.h
-vpx_mem/include/vpx_mem_intrnl.h
-vpx_mem/vpx_mem.c
-vpx_mem/vpx_mem.h
-vpx_mem/vpx_mem.mk
-vpx_ports/asm_offsets.h
-vpx_ports/emmintrin_compat.h
-vpx_ports/mem.h
-vpx_ports/vpx_once.h
-vpx_ports/vpx_ports.mk
-vpx_ports/vpx_timer.h
-vpx_scale/generic/gen_scalers.c
-vpx_scale/generic/vpx_scale.c
-vpx_scale/generic/yv12config.c
-vpx_scale/generic/yv12extend.c
-vpx_scale/vpx_scale_asm_offsets.c
-vpx_scale/vpx_scale.h
-vpx_scale/vpx_scale.mk
-vpx_scale/vpx_scale_rtcd.c
-vpx_scale/vpx_scale_rtcd.sh
-vpx_scale/yv12config.h
-vpx/src/vpx_codec.c
-vpx/src/vpx_decoder.c
-vpx/src/vpx_encoder.c
-vpx/src/vpx_image.c
-vpx/vp8cx.h
-vpx/vp8dx.h
-vpx/vp8.h
-vpx/vpx_codec.h
-vpx/vpx_codec.mk
-vpx/vpx_decoder.h
-vpx/vpx_encoder.h
-vpx/vpx_image.h
-vpx/vpx_integer.h
diff --git a/videocodec/libvpx_internal/generic/vp8_rtcd.h b/videocodec/libvpx_internal/generic/vp8_rtcd.h
deleted file mode 100644
index 97ef714..0000000
--- a/videocodec/libvpx_internal/generic/vp8_rtcd.h
+++ /dev/null
@@ -1,301 +0,0 @@
-#ifndef VP8_RTCD_H_
-#define VP8_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP8
- */
-
-struct blockd;
-struct macroblockd;
-struct loop_filter_info;
-
-/* Encoder forward decls */
-struct block;
-struct macroblock;
-struct variance_vtable;
-union int_mv;
-struct yv12_buffer_config;
-
-void vp8_clear_system_state_c();
-#define vp8_clear_system_state vp8_clear_system_state_c
-
-void vp8_dequantize_b_c(struct blockd*, short *dqc);
-#define vp8_dequantize_b vp8_dequantize_b_c
-
-void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *output, int stride);
-#define vp8_dequant_idct_add vp8_dequant_idct_add_c
-
-void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_c
-
-void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_c
-
-void vp8_loop_filter_mbv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbv vp8_loop_filter_mbv_c
-
-void vp8_loop_filter_bv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bv vp8_loop_filter_bv_c
-
-void vp8_loop_filter_mbh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbh vp8_loop_filter_mbh_c
-
-void vp8_loop_filter_bh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bh vp8_loop_filter_bh_c
-
-void vp8_loop_filter_simple_vertical_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbv vp8_loop_filter_simple_vertical_edge_c
-
-void vp8_loop_filter_simple_horizontal_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbh vp8_loop_filter_simple_horizontal_edge_c
-
-void vp8_loop_filter_bvs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bv vp8_loop_filter_bvs_c
-
-void vp8_loop_filter_bhs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bh vp8_loop_filter_bhs_c
-
-void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-#define vp8_short_idct4x4llm vp8_short_idct4x4llm_c
-
-void vp8_short_inv_walsh4x4_1_c(short *input, short *output);
-#define vp8_short_inv_walsh4x4_1 vp8_short_inv_walsh4x4_1_c
-
-void vp8_short_inv_walsh4x4_c(short *input, short *output);
-#define vp8_short_inv_walsh4x4 vp8_short_inv_walsh4x4_c
-
-void vp8_dc_only_idct_add_c(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-#define vp8_dc_only_idct_add vp8_dc_only_idct_add_c
-
-void vp8_copy_mem16x16_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem16x16 vp8_copy_mem16x16_c
-
-void vp8_copy_mem8x8_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x8 vp8_copy_mem8x8_c
-
-void vp8_copy_mem8x4_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x4 vp8_copy_mem8x4_c
-
-void vp8_build_intra_predictors_mby_s_c(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-#define vp8_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_c
-
-void vp8_build_intra_predictors_mbuv_s_c(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-#define vp8_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s_c
-
-void vp8_intra4x4_predict_c(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-#define vp8_intra4x4_predict vp8_intra4x4_predict_c
-
-void vp8_sixtap_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict16x16 vp8_sixtap_predict16x16_c
-
-void vp8_sixtap_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x8 vp8_sixtap_predict8x8_c
-
-void vp8_sixtap_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x4 vp8_sixtap_predict8x4_c
-
-void vp8_sixtap_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict4x4 vp8_sixtap_predict4x4_c
-
-void vp8_bilinear_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict16x16 vp8_bilinear_predict16x16_c
-
-void vp8_bilinear_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x8 vp8_bilinear_predict8x8_c
-
-void vp8_bilinear_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x4 vp8_bilinear_predict8x4_c
-
-void vp8_bilinear_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict4x4 vp8_bilinear_predict4x4_c
-
-unsigned int vp8_variance4x4_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance4x4 vp8_variance4x4_c
-
-unsigned int vp8_variance8x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x8 vp8_variance8x8_c
-
-unsigned int vp8_variance8x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x16 vp8_variance8x16_c
-
-unsigned int vp8_variance16x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x8 vp8_variance16x8_c
-
-unsigned int vp8_variance16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x16 vp8_variance16x16_c
-
-unsigned int vp8_sub_pixel_variance4x4_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance4x4 vp8_sub_pixel_variance4x4_c
-
-unsigned int vp8_sub_pixel_variance8x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x8 vp8_sub_pixel_variance8x8_c
-
-unsigned int vp8_sub_pixel_variance8x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x16 vp8_sub_pixel_variance8x16_c
-
-unsigned int vp8_sub_pixel_variance16x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x8 vp8_sub_pixel_variance16x8_c
-
-unsigned int vp8_sub_pixel_variance16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x16 vp8_sub_pixel_variance16x16_c
-
-unsigned int vp8_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_h vp8_variance_halfpixvar16x16_h_c
-
-unsigned int vp8_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_v vp8_variance_halfpixvar16x16_v_c
-
-unsigned int vp8_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_hv vp8_variance_halfpixvar16x16_hv_c
-
-unsigned int vp8_sad4x4_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad4x4 vp8_sad4x4_c
-
-unsigned int vp8_sad8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x8 vp8_sad8x8_c
-
-unsigned int vp8_sad8x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x16 vp8_sad8x16_c
-
-unsigned int vp8_sad16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x8 vp8_sad16x8_c
-
-unsigned int vp8_sad16x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x16 vp8_sad16x16_c
-
-void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x3 vp8_sad4x4x3_c
-
-void vp8_sad8x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x3 vp8_sad8x8x3_c
-
-void vp8_sad8x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x3 vp8_sad8x16x3_c
-
-void vp8_sad16x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x3 vp8_sad16x8x3_c
-
-void vp8_sad16x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x3 vp8_sad16x16x3_c
-
-void vp8_sad4x4x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad4x4x8 vp8_sad4x4x8_c
-
-void vp8_sad8x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x8x8 vp8_sad8x8x8_c
-
-void vp8_sad8x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x16x8 vp8_sad8x16x8_c
-
-void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x8x8 vp8_sad16x8x8_c
-
-void vp8_sad16x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x16x8 vp8_sad16x16x8_c
-
-void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x4d vp8_sad4x4x4d_c
-
-void vp8_sad8x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x4d vp8_sad8x8x4d_c
-
-void vp8_sad8x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x4d vp8_sad8x16x4d_c
-
-void vp8_sad16x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x4d vp8_sad16x8x4d_c
-
-void vp8_sad16x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x4d vp8_sad16x16x4d_c
-
-unsigned int vp8_get_mb_ss_c(const short *);
-#define vp8_get_mb_ss vp8_get_mb_ss_c
-
-unsigned int vp8_sub_pixel_mse16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_mse16x16 vp8_sub_pixel_mse16x16_c
-
-unsigned int vp8_mse16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_mse16x16 vp8_mse16x16_c
-
-unsigned int vp8_get4x4sse_cs_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-#define vp8_get4x4sse_cs vp8_get4x4sse_cs_c
-
-void vp8_short_fdct4x4_c(short *input, short *output, int pitch);
-#define vp8_short_fdct4x4 vp8_short_fdct4x4_c
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch);
-#define vp8_short_fdct8x4 vp8_short_fdct8x4_c
-
-void vp8_short_walsh4x4_c(short *input, short *output, int pitch);
-#define vp8_short_walsh4x4 vp8_short_walsh4x4_c
-
-void vp8_regular_quantize_b_c(struct block *, struct blockd *);
-#define vp8_regular_quantize_b vp8_regular_quantize_b_c
-
-void vp8_fast_quantize_b_c(struct block *, struct blockd *);
-#define vp8_fast_quantize_b vp8_fast_quantize_b_c
-
-void vp8_regular_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_regular_quantize_b_pair vp8_regular_quantize_b_pair_c
-
-void vp8_fast_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_fast_quantize_b_pair vp8_fast_quantize_b_pair_c
-
-void vp8_quantize_mb_c(struct macroblock *);
-#define vp8_quantize_mb vp8_quantize_mb_c
-
-void vp8_quantize_mby_c(struct macroblock *);
-#define vp8_quantize_mby vp8_quantize_mby_c
-
-void vp8_quantize_mbuv_c(struct macroblock *);
-#define vp8_quantize_mbuv vp8_quantize_mbuv_c
-
-int vp8_block_error_c(short *coeff, short *dqcoeff);
-#define vp8_block_error vp8_block_error_c
-
-int vp8_mbblock_error_c(struct macroblock *mb, int dc);
-#define vp8_mbblock_error vp8_mbblock_error_c
-
-int vp8_mbuverror_c(struct macroblock *mb);
-#define vp8_mbuverror vp8_mbuverror_c
-
-void vp8_subtract_b_c(struct block *be, struct blockd *bd, int pitch);
-#define vp8_subtract_b vp8_subtract_b_c
-
-void vp8_subtract_mby_c(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-#define vp8_subtract_mby vp8_subtract_mby_c
-
-void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-#define vp8_subtract_mbuv vp8_subtract_mbuv_c
-
-int vp8_full_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_full_search_sad vp8_full_search_sad_c
-
-int vp8_refining_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_refining_search_sad vp8_refining_search_sad_c
-
-int vp8_diamond_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_diamond_search_sad vp8_diamond_search_sad_c
-
-void vp8_yv12_copy_partial_frame_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_partial_frame vp8_yv12_copy_partial_frame_c
-
-int vp8_denoiser_filter_c(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-#define vp8_denoiser_filter vp8_denoiser_filter_c
-
-void vp8_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/generic/vp9_rtcd.h b/videocodec/libvpx_internal/generic/vp9_rtcd.h
deleted file mode 100644
index d9e1b0b..0000000
--- a/videocodec/libvpx_internal/generic/vp9_rtcd.h
+++ /dev/null
@@ -1,291 +0,0 @@
-#ifndef VP9_RTCD_H_
-#define VP9_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP9
- */
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_enums.h"
-
-struct macroblockd;
-
-/* Encoder forward decls */
-struct macroblock;
-struct vp9_variance_vtable;
-
-#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
-union int_mv;
-struct yv12_buffer_config;
-
-void vp9_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_4x4 vp9_d207_predictor_4x4_c
-
-void vp9_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_4x4 vp9_d45_predictor_4x4_c
-
-void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_4x4 vp9_d63_predictor_4x4_c
-
-void vp9_h_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_4x4 vp9_h_predictor_4x4_c
-
-void vp9_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_4x4 vp9_d117_predictor_4x4_c
-
-void vp9_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_4x4 vp9_d135_predictor_4x4_c
-
-void vp9_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_4x4 vp9_d153_predictor_4x4_c
-
-void vp9_v_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_4x4 vp9_v_predictor_4x4_c
-
-void vp9_tm_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_4x4 vp9_tm_predictor_4x4_c
-
-void vp9_dc_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_4x4 vp9_dc_predictor_4x4_c
-
-void vp9_dc_top_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_4x4 vp9_dc_top_predictor_4x4_c
-
-void vp9_dc_left_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_4x4 vp9_dc_left_predictor_4x4_c
-
-void vp9_dc_128_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_4x4 vp9_dc_128_predictor_4x4_c
-
-void vp9_d207_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_8x8 vp9_d207_predictor_8x8_c
-
-void vp9_d45_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_8x8 vp9_d45_predictor_8x8_c
-
-void vp9_d63_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_8x8 vp9_d63_predictor_8x8_c
-
-void vp9_h_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_8x8 vp9_h_predictor_8x8_c
-
-void vp9_d117_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_8x8 vp9_d117_predictor_8x8_c
-
-void vp9_d135_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_8x8 vp9_d135_predictor_8x8_c
-
-void vp9_d153_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_8x8 vp9_d153_predictor_8x8_c
-
-void vp9_v_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_8x8 vp9_v_predictor_8x8_c
-
-void vp9_tm_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_8x8 vp9_tm_predictor_8x8_c
-
-void vp9_dc_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_8x8 vp9_dc_predictor_8x8_c
-
-void vp9_dc_top_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_8x8 vp9_dc_top_predictor_8x8_c
-
-void vp9_dc_left_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_8x8 vp9_dc_left_predictor_8x8_c
-
-void vp9_dc_128_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_8x8 vp9_dc_128_predictor_8x8_c
-
-void vp9_d207_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_16x16 vp9_d207_predictor_16x16_c
-
-void vp9_d45_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_16x16 vp9_d45_predictor_16x16_c
-
-void vp9_d63_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_16x16 vp9_d63_predictor_16x16_c
-
-void vp9_h_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_16x16 vp9_h_predictor_16x16_c
-
-void vp9_d117_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_16x16 vp9_d117_predictor_16x16_c
-
-void vp9_d135_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_16x16 vp9_d135_predictor_16x16_c
-
-void vp9_d153_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_16x16 vp9_d153_predictor_16x16_c
-
-void vp9_v_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_16x16 vp9_v_predictor_16x16_c
-
-void vp9_tm_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_16x16 vp9_tm_predictor_16x16_c
-
-void vp9_dc_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_16x16 vp9_dc_predictor_16x16_c
-
-void vp9_dc_top_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_16x16 vp9_dc_top_predictor_16x16_c
-
-void vp9_dc_left_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_16x16 vp9_dc_left_predictor_16x16_c
-
-void vp9_dc_128_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_16x16 vp9_dc_128_predictor_16x16_c
-
-void vp9_d207_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_32x32 vp9_d207_predictor_32x32_c
-
-void vp9_d45_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_32x32 vp9_d45_predictor_32x32_c
-
-void vp9_d63_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_32x32 vp9_d63_predictor_32x32_c
-
-void vp9_h_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_32x32 vp9_h_predictor_32x32_c
-
-void vp9_d117_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_32x32 vp9_d117_predictor_32x32_c
-
-void vp9_d135_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_32x32 vp9_d135_predictor_32x32_c
-
-void vp9_d153_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_32x32 vp9_d153_predictor_32x32_c
-
-void vp9_v_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_32x32 vp9_v_predictor_32x32_c
-
-void vp9_tm_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_32x32 vp9_tm_predictor_32x32_c
-
-void vp9_dc_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_32x32 vp9_dc_predictor_32x32_c
-
-void vp9_dc_top_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_32x32 vp9_dc_top_predictor_32x32_c
-
-void vp9_dc_left_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_32x32 vp9_dc_left_predictor_32x32_c
-
-void vp9_dc_128_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_32x32 vp9_dc_128_predictor_32x32_c
-
-void vp9_mb_lpf_vertical_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-#define vp9_mb_lpf_vertical_edge_w vp9_mb_lpf_vertical_edge_w_c
-
-void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_vertical_edge vp9_mbloop_filter_vertical_edge_c
-
-void vp9_loop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_vertical_edge vp9_loop_filter_vertical_edge_c
-
-void vp9_mb_lpf_horizontal_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mb_lpf_horizontal_edge_w vp9_mb_lpf_horizontal_edge_w_c
-
-void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_horizontal_edge vp9_mbloop_filter_horizontal_edge_c
-
-void vp9_loop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_horizontal_edge vp9_loop_filter_horizontal_edge_c
-
-void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_inner vp9_blend_mb_inner_c
-
-void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_outer vp9_blend_mb_outer_c
-
-void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_b vp9_blend_b_c
-
-void vp9_convolve_copy_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);
-#define vp9_convolve_copy vp9_convolve_copy_c
-
-void vp9_convolve_avg_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);
-#define vp9_convolve_avg vp9_convolve_avg_c
-
-void vp9_convolve8_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);
-#define vp9_convolve8 vp9_convolve8_c
-
-void vp9_convolve8_horiz_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);
-#define vp9_convolve8_horiz vp9_convolve8_horiz_c
-
-void vp9_convolve8_vert_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);
-#define vp9_convolve8_vert vp9_convolve8_vert_c
-
-void vp9_convolve8_avg_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);
-#define vp9_convolve8_avg vp9_convolve8_avg_c
-
-void vp9_convolve8_avg_horiz_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);
-#define vp9_convolve8_avg_horiz vp9_convolve8_avg_horiz_c
-
-void vp9_convolve8_avg_vert_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);
-#define vp9_convolve8_avg_vert vp9_convolve8_avg_vert_c
-
-void vp9_idct4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_1_add vp9_idct4x4_1_add_c
-
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_16_add vp9_idct4x4_16_add_c
-
-void vp9_idct8x8_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_1_add vp9_idct8x8_1_add_c
-
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_64_add vp9_idct8x8_64_add_c
-
-void vp9_idct8x8_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_10_add vp9_idct8x8_10_add_c
-
-void vp9_idct16x16_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_1_add vp9_idct16x16_1_add_c
-
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_256_add vp9_idct16x16_256_add_c
-
-void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_10_add vp9_idct16x16_10_add_c
-
-void vp9_idct32x32_1024_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1024_add vp9_idct32x32_1024_add_c
-
-void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_34_add vp9_idct32x32_34_add_c
-
-void vp9_idct32x32_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1_add vp9_idct32x32_1_add_c
-
-void vp9_iht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht4x4_16_add vp9_iht4x4_16_add_c
-
-void vp9_iht8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht8x8_64_add vp9_iht8x8_64_add_c
-
-void vp9_iht16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-#define vp9_iht16x16_256_add vp9_iht16x16_256_add_c
-
-void vp9_iwht4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_1_add vp9_iwht4x4_1_add_c
-
-void vp9_iwht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_16_add vp9_iwht4x4_16_add_c
-
-void vp9_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/generic/vpx_config.c b/videocodec/libvpx_internal/generic/vpx_config.c
deleted file mode 100644
index c87cb91..0000000
--- a/videocodec/libvpx_internal/generic/vpx_config.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-static const char* const cfg = "--force-target=generic-gnu --disable-vp9-encoder --disable-examples --disable-docs --enable-realtime-only";
-const char *vpx_codec_build_config(void) {return cfg;}
diff --git a/videocodec/libvpx_internal/generic/vpx_config.h b/videocodec/libvpx_internal/generic/vpx_config.h
deleted file mode 100644
index 45d33e6..0000000
--- a/videocodec/libvpx_internal/generic/vpx_config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-/* This file automatically generated by configure. Do not edit! */
-#ifndef VPX_CONFIG_H
-#define VPX_CONFIG_H
-#define RESTRICT
-#define INLINE __inline__ __attribute__((always_inline))
-#define ARCH_ARM 0
-#define ARCH_MIPS 0
-#define ARCH_X86_32 0
-#define ARCH_X86_64 0
-#define ARCH_PPC32 0
-#define ARCH_PPC64 0
-#define HAVE_EDSP 0
-#define HAVE_MEDIA 0
-#define HAVE_NEON 0
-#define HAVE_MIPS32 0
-#define HAVE_DSPR2 0
-#define HAVE_MMX 0
-#define HAVE_SSE 0
-#define HAVE_SSE2 0
-#define HAVE_SSE3 0
-#define HAVE_SSSE3 0
-#define HAVE_SSE4_1 0
-#define HAVE_AVX 0
-#define HAVE_AVX2 0
-#define HAVE_ALTIVEC 0
-#define HAVE_VPX_PORTS 1
-#define HAVE_STDINT_H 1
-#define HAVE_ALT_TREE_LAYOUT 0
-#define HAVE_PTHREAD_H 1
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_UNISTD_H 1
-#define CONFIG_EXTERNAL_BUILD 0
-#define CONFIG_INSTALL_DOCS 0
-#define CONFIG_INSTALL_BINS 1
-#define CONFIG_INSTALL_LIBS 1
-#define CONFIG_INSTALL_SRCS 0
-#define CONFIG_USE_X86INC 1
-#define CONFIG_DEBUG 0
-#define CONFIG_GPROF 0
-#define CONFIG_GCOV 0
-#define CONFIG_RVCT 0
-#define CONFIG_GCC 1
-#define CONFIG_MSVS 0
-#define CONFIG_PIC 0
-#define CONFIG_BIG_ENDIAN 0
-#define CONFIG_CODEC_SRCS 0
-#define CONFIG_DEBUG_LIBS 0
-#define CONFIG_FAST_UNALIGNED 1
-#define CONFIG_MEM_MANAGER 0
-#define CONFIG_MEM_TRACKER 0
-#define CONFIG_MEM_CHECKS 0
-#define CONFIG_MD5 1
-#define CONFIG_DEQUANT_TOKENS 0
-#define CONFIG_DC_RECON 0
-#define CONFIG_RUNTIME_CPU_DETECT 0
-#define CONFIG_POSTPROC 0
-#define CONFIG_VP9_POSTPROC 0
-#define CONFIG_MULTITHREAD 1
-#define CONFIG_INTERNAL_STATS 0
-#define CONFIG_VP8_ENCODER 1
-#define CONFIG_VP8_DECODER 1
-#define CONFIG_VP9_ENCODER 0
-#define CONFIG_VP9_DECODER 1
-#define CONFIG_VP8 1
-#define CONFIG_VP9 1
-#define CONFIG_ENCODERS 1
-#define CONFIG_DECODERS 1
-#define CONFIG_STATIC_MSVCRT 0
-#define CONFIG_SPATIAL_RESAMPLING 1
-#define CONFIG_REALTIME_ONLY 1
-#define CONFIG_ONTHEFLY_BITPACKING 0
-#define CONFIG_ERROR_CONCEALMENT 0
-#define CONFIG_SHARED 0
-#define CONFIG_STATIC 1
-#define CONFIG_SMALL 0
-#define CONFIG_POSTPROC_VISUALIZER 0
-#define CONFIG_OS_SUPPORT 1
-#define CONFIG_UNIT_TESTS 1
-#define CONFIG_MULTI_RES_ENCODING 0
-#define CONFIG_TEMPORAL_DENOISING 1
-#define CONFIG_EXPERIMENTAL 0
-#define CONFIG_DECRYPT 0
-#define CONFIG_MULTIPLE_ARF 0
-#define CONFIG_NON420 0
-#define CONFIG_ALPHA 0
-#endif /* VPX_CONFIG_H */
diff --git a/videocodec/libvpx_internal/generic/vpx_scale_rtcd.h b/videocodec/libvpx_internal/generic/vpx_scale_rtcd.h
deleted file mode 100644
index 472a290..0000000
--- a/videocodec/libvpx_internal/generic/vpx_scale_rtcd.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef VPX_SCALE_RTCD_H_
-#define VPX_SCALE_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-struct yv12_buffer_config;
-
-void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
-
-void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
-
-void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
-
-void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
-
-void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
-
-void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
-#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_c
-
-void vp8_yv12_copy_frame_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_frame vp8_yv12_copy_frame_c
-
-void vpx_yv12_copy_y_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vpx_yv12_copy_y vpx_yv12_copy_y_c
-
-void vp9_extend_frame_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_borders vp9_extend_frame_borders_c
-
-void vp9_extend_frame_inner_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_inner_borders vp9_extend_frame_inner_borders_c
-
-void vpx_scale_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/generic/vpx_version.h b/videocodec/libvpx_internal/generic/vpx_version.h
deleted file mode 100644
index 9a354bb..0000000
--- a/videocodec/libvpx_internal/generic/vpx_version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 2
-#define VERSION_PATCH 0
-#define VERSION_EXTRA "5082-g58f7543"
-#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define VERSION_STRING_NOSP "v1.2.0-5082-g58f7543"
-#define VERSION_STRING " v1.2.0-5082-g58f7543"
diff --git a/videocodec/libvpx_internal/libvpx.mk b/videocodec/libvpx_internal/libvpx.mk
deleted file mode 100644
index a23cc26..0000000
--- a/videocodec/libvpx_internal/libvpx.mk
+++ /dev/null
@@ -1,166 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-ifeq ($(ARCH_ARM_HAVE_NEON),true)
- libvpx_target := armv7a-neon
- libvpx_asm := .asm.s
-else ifeq ($(ARCH_ARM_HAVE_ARMV7A),true)
- libvpx_target := armv7a
- libvpx_asm := .asm.s
-endif
-
-ifeq ($(TARGET_ARCH),x86)
- libvpx_target := x86
- libvpx_asm := .asm
-endif
-
-ifeq ($(TARGET_ARCH),mips)
- ifneq ($(ARCH_HAS_BIGENDIAN),true)
- ifeq ($(ARCH_MIPS_DSP_REV),2)
- libvpx_target := mips-dspr2
- LOCAL_CFLAGS += -DMIPS_DSP_REV=$(ARCH_MIPS_DSP_REV)
- else
- libvpx_target := mips
- ifeq ($(ARCH_MIPS_DSP_REV),1)
- LOCAL_CFLAGS += -DMIPS_DSP_REV=$(ARCH_MIPS_DSP_REV)
- else
- LOCAL_CFLAGS += -DMIPS_DSP_REV=0
- endif #mips_dsp_rev1
- endif #mips_dsp_rev2
- endif #bigendian
-endif #mips
-
-# Un-optimized targets
-libvpx_target ?= generic
-libvpx_asm ?= .asm
-
-libvpx_config_dir := $(LOCAL_PATH)/$(libvpx_target)
-libvpx_source_dir := $(LOCAL_PATH)/libvpx
-
-libvpx_codec_srcs := $(shell cat $(libvpx_config_dir)/libvpx_srcs.txt)
-
-LOCAL_SHARED_LIBRARIES += liblog
-LOCAL_CFLAGS := -DHAVE_CONFIG_H=vpx_config.h
-
-# Static functions declared in headers. b/18632512
-LOCAL_CFLAGS += -Wno-unused-function
-
-# Clang complains about every partial initialized structure,
-# in vp[89]_[cd]x_iface.c
-LOCAL_CLANG_CFLAGS += -Wno-missing-field-initializers
-
-LOCAL_CFLAGS += -Werror
-LOCAL_MODULE := libvpx_internal
-
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-libvpx_intermediates := $(call local-intermediates-dir)
-
-# Extract the C files from the list and add them to LOCAL_SRC_FILES.
-libvpx_codec_srcs_unique := $(sort $(libvpx_codec_srcs))
-libvpx_codec_srcs_c := $(filter %.c, $(libvpx_codec_srcs_unique))
-ifeq ($(libvpx_target),x86)
-x86_asm_src_files := $(filter %.asm, $(libvpx_codec_srcs_unique))
-X86_ASM_SRCS := $(addprefix $(LOCAL_PATH)/libvpx/, $(x86_asm_src_files))
-X86_ASM_OBJS := $(addprefix $(libvpx_intermediates)/, $(x86_asm_src_files:%.asm=%.asm.o))
-endif
-# vpx_config.c is an auto-generated file in $(config_dir)
-libvpx_codec_srcs_c_static := $(filter-out vpx_config.c, $(libvpx_codec_srcs_c))
-LOCAL_SRC_FILES += $(addprefix libvpx/, $(libvpx_codec_srcs_c_static))
-LOCAL_SRC_FILES += $(libvpx_target)/vpx_config.c
-
-# ARM and x86 use an 'offsets' file in the assembly. It is generated by
-# tricking the compiler and generating non-functional output which is then
-# processed with grep. For ARM, this must be additionally converted from
-# RVCT (ARM's in-house compiler) format to GNU Assembler Format for gcc.
-
-# Offset files are currently used in vpx_scale for NEON and some encoder
-# functions used in both ARM and x86. These files can not be compiled and need
-# to be named accordingly to avoid auto-build rules. The encoder files are not
-# used yet but are included in the comments for future reference.
-
-ifneq ($(libvpx_target),x86)
-libvpx_asm_offsets_intermediates := \
- vp8/encoder/vp8_asm_enc_offsets.intermediate \
- vpx_scale/vpx_scale_asm_offsets.intermediate \
-
-libvpx_asm_offsets_files := \
- vp8/encoder/vp8_asm_enc_offsets.asm \
- vpx_scale/vpx_scale_asm_offsets.asm \
-
-endif
-# Build the S files with inline assembly.
-COMPILE_TO_S := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_intermediates))
-$(COMPILE_TO_S) : PRIVATE_INTERMEDIATES := $(libvpx_intermediates)
-$(COMPILE_TO_S) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir)
-$(COMPILE_TO_S) : PRIVATE_CONFIG_DIR := $(libvpx_config_dir)
-$(COMPILE_TO_S) : PRIVATE_CUSTOM_TOOL = $(TARGET_CC) -S $(addprefix -I, $(TARGET_C_INCLUDES)) -I $(PRIVATE_INTERMEDIATES) -I $(PRIVATE_SOURCE_DIR) -I $(PRIVATE_CONFIG_DIR) -DINLINE_ASM -o $@ $<
-$(COMPILE_TO_S) : $(libvpx_intermediates)/%.intermediate : $(libvpx_source_dir)/%.c
- $(transform-generated-source)
-
-# Extract the offsets from the inline assembly.
-OFFSETS_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_offsets_files))
-$(OFFSETS_GEN) : PRIVATE_OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU'
-$(OFFSETS_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir)
-$(OFFSETS_GEN) : PRIVATE_CUSTOM_TOOL = grep $(PRIVATE_OFFSET_PATTERN) $< | tr -d '$$\#' | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@
-$(OFFSETS_GEN) : %.asm : %.intermediate
- $(transform-generated-source)
-
-LOCAL_GENERATED_SOURCES += $(OFFSETS_GEN)
-
-# This step is only required for ARM. MIPS uses intrinsics and x86 requires an
-# assembler to pre-process its assembly files.
-libvpx_asm_srcs := $(filter %.asm.s, $(libvpx_codec_srcs_unique))
-
-# The ARM assembly sources must be converted from ADS to GAS compatible format.
-VPX_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_asm_srcs))
-$(VPX_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir)
-$(VPX_GEN) : PRIVATE_CUSTOM_TOOL = cat $< | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@
-$(VPX_GEN) : $(libvpx_intermediates)/%.s : $(libvpx_source_dir)/%
- $(transform-generated-source)
-
-LOCAL_GENERATED_SOURCES += $(VPX_GEN)
-
-ifeq ($(libvpx_target),x86)
-libvpx_x86_asm_src_files := $(filter %.asm, $(libvpx_codec_srcs_unique))
-libvpx_x86_yasm_dir := prebuilts/misc/$(HOST_OS)-$(HOST_PREBUILT_ARCH)/yasm
-
-X86_ASM_GEN := $(addprefix $(libvpx_intermediates)/, $(libvpx_x86_asm_src_files:%.asm=%.asm.o))
-
-# Adding dependency on yasm generation
-$(X86_ASM_GEN) : $(libvpx_x86_yasm_dir)/yasm
-
-$(X86_ASM_GEN) : PRIVATE_YASM := $(libvpx_x86_yasm_dir)/yasm
-$(X86_ASM_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir)
-$(X86_ASM_GEN) : PRIVATE_CONFIG_DIR := $(libvpx_config_dir)
-$(X86_ASM_GEN) : PRIVATE_CUSTOM_TOOL = $(PRIVATE_YASM) -f elf32 -I $(PRIVATE_SOURCE_DIR) -I $(PRIVATE_CONFIG_DIR) -o $@ $<
-$(X86_ASM_GEN) : $(libvpx_intermediates)/%.o : $(libvpx_source_dir)/%
- $(transform-generated-source)
-
-LOCAL_GENERATED_SOURCES += $(X86_ASM_GEN)
-
-libvpx_x86_yasm_dir :=
-x86_asm_src_files :=
-endif
-
-LOCAL_C_INCLUDES := \
- $(libvpx_source_dir) \
- $(libvpx_config_dir) \
- $(libvpx_intermediates)/vp8/common \
- $(libvpx_intermediates)/vp8/decoder \
- $(libvpx_intermediates)/vp8/encoder \
- $(libvpx_intermediates)/vpx_scale \
-
-libvpx_target :=
-libvpx_asm :=
-libvpx_config_dir :=
-libvpx_source_dir :=
-libvpx_codec_srcs :=
-libvpx_intermediates :=
-libvpx_codec_srcs_unique :=
-libvpx_codec_srcs_c :=
-libvpx_codec_srcs_c_static :=
-libvpx_asm_offsets_intermediates :=
-libvpx_asm_offsets_files :=
-libvpx_asm_srcs :=
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/videocodec/libvpx_internal/libvpx/.mailmap b/videocodec/libvpx_internal/libvpx/.mailmap
deleted file mode 100644
index fb82a24..0000000
--- a/videocodec/libvpx_internal/libvpx/.mailmap
+++ /dev/null
@@ -1,18 +0,0 @@
-Adrian Grange <agrange@google.com>
-Alexis Ballier <aballier@gentoo.org> <alexis.ballier@gmail.com>
-Hangyu Kuang <hkuang@google.com>
-Jim Bankoski <jimbankoski@google.com>
-John Koleszar <jkoleszar@google.com>
-Johann Koenig <johannkoenig@google.com>
-Johann Koenig <johannkoenig@google.com> <johann.koenig@duck.com>
-Johann Koenig <johannkoenig@google.com> <johannkoenig@dhcp-172-19-7-52.mtv.corp.google.com>
-Pascal Massimino <pascal.massimino@gmail.com>
-Sami Pietilä <samipietila@google.com>
-Tero Rintaluoma <teror@google.com> <tero.rintaluoma@on2.com>
-Timothy B. Terriberry <tterribe@xiph.org> Tim Terriberry <tterriberry@mozilla.com>
-Tom Finegan <tomfinegan@google.com>
-Ralph Giles <giles@xiph.org> <giles@entropywave.com>
-Ralph Giles <giles@xiph.org> <giles@mozilla.com>
-Alpha Lam <hclam@google.com> <hclam@chromium.org>
-Deb Mukherjee <debargha@google.com>
-Yaowu Xu <yaowu@google.com> <yaowu@xuyaowu.com>
diff --git a/videocodec/libvpx_internal/libvpx/AUTHORS b/videocodec/libvpx_internal/libvpx/AUTHORS
deleted file mode 100644
index a9aa481..0000000
--- a/videocodec/libvpx_internal/libvpx/AUTHORS
+++ /dev/null
@@ -1,100 +0,0 @@
-# This file is automatically generated from the git commit history
-# by tools/gen_authors.sh.
-
-Aaron Watry <awatry@gmail.com>
-Abo Talib Mahfoodh <ab.mahfoodh@gmail.com>
-Adrian Grange <agrange@google.com>
-Ahmad Sharif <asharif@google.com>
-Alexander Voronov <avoronov@graphics.cs.msu.ru>
-Alex Converse <alex.converse@gmail.com>
-Alexis Ballier <aballier@gentoo.org>
-Alok Ahuja <waveletcoeff@gmail.com>
-Alpha Lam <hclam@google.com>
-A.Mahfoodh <ab.mahfoodh@gmail.com>
-Ami Fischman <fischman@chromium.org>
-Andoni Morales Alastruey <ylatuya@gmail.com>
-Andres Mejia <mcitadel@gmail.com>
-Aron Rosenberg <arosenberg@logitech.com>
-Attila Nagy <attilanagy@google.com>
-changjun.yang <changjun.yang@intel.com>
-chm <chm@rock-chips.com>
-Christian Duvivier <cduvivier@google.com>
-Daniel Kang <ddkang@google.com>
-Deb Mukherjee <debargha@google.com>
-Dmitry Kovalev <dkovalev@google.com>
-Dragan Mrdjan <dmrdjan@mips.com>
-Erik Niemeyer <erik.a.niemeyer@gmail.com>
-Fabio Pedretti <fabio.ped@libero.it>
-Frank Galligan <fgalligan@google.com>
-Fredrik Söderquist <fs@opera.com>
-Fritz Koenig <frkoenig@google.com>
-Gaute Strokkenes <gaute.strokkenes@broadcom.com>
-Giuseppe Scrivano <gscrivano@gnu.org>
-Guillaume Martres <gmartres@google.com>
-Guillermo Ballester Valor <gbvalor@gmail.com>
-Hangyu Kuang <hkuang@google.com>
-Henrik Lundin <hlundin@google.com>
-Hui Su <huisu@google.com>
-Ivan Maltz <ivanmaltz@google.com>
-James Berry <jamesberry@google.com>
-James Zern <jzern@google.com>
-Jan Kratochvil <jan.kratochvil@redhat.com>
-Janne Salonen <jsalonen@google.com>
-Jeff Faust <jfaust@google.com>
-Jeff Muizelaar <jmuizelaar@mozilla.com>
-Jeff Petkau <jpet@chromium.org>
-Jim Bankoski <jimbankoski@google.com>
-Jingning Han <jingning@google.com>
-Johann Koenig <johannkoenig@google.com>
-John Koleszar <jkoleszar@google.com>
-Joshua Bleecher Snyder <josh@treelinelabs.com>
-Joshua Litt <joshualitt@google.com>
-Justin Clift <justin@salasaga.org>
-Justin Lebar <justin.lebar@gmail.com>
-KO Myung-Hun <komh@chollian.net>
-Lou Quillio <louquillio@google.com>
-Luca Barbato <lu_zero@gentoo.org>
-Makoto Kato <makoto.kt@gmail.com>
-Mans Rullgard <mans@mansr.com>
-Marco Paniconi <marpan@google.com>
-Mark Mentovai <mark@chromium.org>
-Martin Ettl <ettl.martin78@googlemail.com>
-Martin Storsjo <martin@martin.st>
-Matthew Heaney <matthewjheaney@chromium.org>
-Michael Kohler <michaelkohler@live.com>
-Mike Frysinger <vapier@chromium.org>
-Mike Hommey <mhommey@mozilla.com>
-Mikhal Shemer <mikhal@google.com>
-Morton Jonuschat <yabawock@gmail.com>
-Parag Salasakar <img.mips1@gmail.com>
-Pascal Massimino <pascal.massimino@gmail.com>
-Patrik Westin <patrik.westin@gmail.com>
-Paul Wilkins <paulwilkins@google.com>
-Pavol Rusnak <stick@gk2.sk>
-Paweł Hajdan <phajdan@google.com>
-Philip Jägenstedt <philipj@opera.com>
-Priit Laes <plaes@plaes.org>
-Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
-Rafaël Carré <funman@videolan.org>
-Ralph Giles <giles@xiph.org>
-Rob Bradford <rob@linux.intel.com>
-Ronald S. Bultje <rbultje@google.com>
-Sami Pietilä <samipietila@google.com>
-Scott Graham <scottmg@chromium.org>
-Scott LaVarnway <slavarnway@google.com>
-Shimon Doodkin <helpmepro1@gmail.com>
-Stefan Holmer <holmer@google.com>
-Suman Sunkara <sunkaras@google.com>
-Taekhyun Kim <takim@nvidia.com>
-Takanori MATSUURA <t.matsuu@gmail.com>
-Tamar Levy <tamar.levy@intel.com>
-Tero Rintaluoma <teror@google.com>
-Thijs Vermeir <thijsvermeir@gmail.com>
-Timothy B. Terriberry <tterribe@xiph.org>
-Tom Finegan <tomfinegan@google.com>
-Vignesh Venkatasubramanian <vigneshv@google.com>
-Yaowu Xu <yaowu@google.com>
-Yunqing Wang <yunqingwang@google.com>
-Google Inc.
-The Mozilla Foundation
-The Xiph.Org Foundation
diff --git a/videocodec/libvpx_internal/libvpx/CHANGELOG b/videocodec/libvpx_internal/libvpx/CHANGELOG
deleted file mode 100644
index 97c9a7b..0000000
--- a/videocodec/libvpx_internal/libvpx/CHANGELOG
+++ /dev/null
@@ -1,584 +0,0 @@
-2013-11-15 v1.3.0 "Forest"
- This release introduces the VP9 codec in a backward-compatible way.
- All existing users of VP8 can continue to use the library without
- modification. However, some VP8 options do not map to VP9 in the same manner.
-
- The VP9 encoder in this release is not feature complete. Users interested in
- the encoder are advised to use the git master branch and discuss issues on
- libvpx mailing lists.
-
- - Upgrading:
- This release is ABI and API compatible with Duclair (v1.0.0). Users
- of older releases should refer to the Upgrading notes in this document
- for that release.
-
- - Enhancements:
- Get rid of bashisms in the main build scripts
- Added usage info on command line options
- Add lossless compression mode
- Dll build of libvpx
- Add additional Mac OS X targets: 10.7, 10.8 and 10.9 (darwin11-13)
- Add option to disable documentation
- configure: add --enable-external-build support
- make: support V=1 as short form of verbose=yes
- configure: support mingw-w64
- configure: support hardfloat armv7 CHOSTS
- configure: add support for android x86
- Add estimated completion time to vpxenc
- Don't exit on decode errors in vpxenc
- vpxenc: support scaling prior to encoding
- vpxdec: support scaling output
- vpxenc: improve progress indicators with --skip
- msvs: Don't link to winmm.lib
- Add a new script for producing vcxproj files
- Produce Visual Studio 10 and 11 project files
- Produce Windows Phone project files
- msvs-build: use msbuild for vs >= 2005
- configure: default configure log to config.log
- Add encoding option --static-thresh
-
- - Speed:
- Miscellaneous speed optimizations for VP8 and VP9.
-
- - Quality:
- In general, quality is consistent with the Eider release.
-
- - Bug Fixes:
- This release represents approximately a year of engineering effort,
- and contains multiple bug fixes. Please refer to git history for details.
-
-
-2012-12-21 v1.2.0
- This release acts as a checkpoint for a large amount of internal refactoring
- and testing. It also contains a number of small bugfixes, so all users are
- encouraged to upgrade.
-
- - Upgrading:
- This release is ABI and API compatible with Duclair (v1.0.0). Users
- of older releases should refer to the Upgrading notes in this
- document for that release.
-
- - Enhancements:
- VP8 optimizations for MIPS dspr2
- vpxenc: add -quiet option
-
- - Speed:
- Encoder and decoder speed is consistent with the Eider release.
-
- - Quality:
- In general, quality is consistent with the Eider release.
-
- Minor tweaks to ARNR filtering
- Minor improvements to real time encoding with multiple temporal layers
-
- - Bug Fixes:
- Fixes multithreaded encoder race condition in loopfilter
- Fixes multi-resolution threaded encoding
- Fix potential encoder dead-lock after picture resize
-
-
-2012-05-09 v1.1.0 "Eider"
- This introduces a number of enhancements, mostly focused on real-time
- encoding. In addition, it fixes a decoder bug (first introduced in
- Duclair) so all users of that release are encouraged to upgrade.
-
- - Upgrading:
- This release is ABI and API compatible with Duclair (v1.0.0). Users
- of older releases should refer to the Upgrading notes in this
- document for that release.
-
- This release introduces a new temporal denoiser, controlled by the
- VP8E_SET_NOISE_SENSITIVITY control. The temporal denoiser does not
- currently take a strength parameter, so the control is effectively
- a boolean - zero (off) or non-zero (on). For compatibility with
- existing applications, the values accepted are the same as those
- for the spatial denoiser (0-6). The temporal denoiser is enabled
- by default, and the older spatial denoiser may be restored by
- configuring with --disable-temporal-denoising. The temporal denoiser
- is more computationally intensive than the spatial one.
-
- This release removes support for a legacy, decode only API that was
- supported, but deprecated, at the initial release of libvpx
- (v0.9.0). This is not expected to have any impact. If you are
- impacted, you can apply a reversion to commit 2bf8fb58 locally.
- Please update to the latest libvpx API if you are affected.
-
- - Enhancements:
- Adds a motion compensated temporal denoiser to the encoder, which
- gives higher quality than the older spatial denoiser. (See above
- for notes on upgrading).
-
- In addition, support for new compilers and platforms were added,
- including:
- improved support for XCode
- Android x86 NDK build
- OS/2 support
- SunCC support
-
- Changing resolution with vpx_codec_enc_config_set() is now
- supported. Previously, reinitializing the codec was required to
- change the input resolution.
-
- The vpxenc application has initial support for producing multiple
- encodes from the same input in one call. Resizing is not yet
- supported, but varying other codec parameters is. Use -- to
- delineate output streams. Options persist from one stream to the
- next.
-
- Also, the vpxenc application will now use a keyframe interval of
- 5 seconds by default. Use the --kf-max-dist option to override.
-
- - Speed:
- Decoder performance improved 2.5% versus Duclair. Encoder speed is
- consistent with Duclair for most material. Two pass encoding of
- slideshow-like material will see significant improvements.
-
- Large realtime encoding speed gains at a small quality expense are
- possible by configuring the on-the-fly bitpacking experiment with
- --enable-onthefly-bitpacking. Realtime encoder can be up to 13%
- faster (ARM) depending on the number of threads and bitrate
- settings. This technique sees constant gain over the 5-16 speed
- range. For VC style input the loss seen is up to 0.2dB. See commit
- 52cf4dca for further details.
-
- - Quality:
- On the whole, quality is consistent with the Duclair release. Some
- tweaks:
-
- Reduced blockiness in easy sections by applying a penalty to
- intra modes.
-
- Improved quality of static sections (like slideshows) with
- two pass encoding.
-
- Improved keyframe sizing with multiple temporal layers
-
- - Bug Fixes:
- Corrected alt-ref contribution to frame rate for visible updates
- to the alt-ref buffer. This affected applications making manual
- usage of the frame reference flags, or temporal layers.
-
- Additional constraints were added to disable multi-frame quality
- enhancement (MFQE) in sections of the frame where there is motion.
- (#392)
-
- Fixed corruption issues when vpx_codec_enc_config_set() was called
- with spatial resampling enabled.
-
- Fixed a decoder error introduced in Duclair where the segmentation
- map was not being reinitialized on keyframes (#378)
-
-
-2012-01-27 v1.0.0 "Duclair"
- Our fourth named release, focused on performance and features related to
- real-time encoding. It also fixes a decoder crash bug introduced in
- v0.9.7, so all users of that release are encouraged to upgrade.
-
- - Upgrading:
- This release is ABI incompatible with prior releases of libvpx, so the
- "major" version number has been bumped to 1. You must recompile your
- applications against the latest version of the libvpx headers. The
- API remains compatible, and this should not require code changes in most
- applications.
-
- - Enhancements:
- This release introduces several substantial new features to the encoder,
- of particular interest to real time streaming applications.
-
- Temporal scalability allows the encoder to produce a stream that can
- be decimated to different frame rates, with independent rate targetting
- for each substream.
-
- Multiframe quality enhancement postprocessing can make visual quality
- more consistent in the presence of frames that are substantially
- different quality than the surrounding frames, as in the temporal
- scalability case and in some forced keyframe scenarios.
-
- Multiple-resolution encoding support allows the encoding of the
- same content at different resolutions faster than encoding them
- separately.
-
- - Speed:
- Optimization targets for this release included the decoder and the real-
- time modes of the encoder. Decoder speed on x86 has improved 10.5% with
- this release. Encoder improvements followed a curve where speeds 1-3
- improved 4.0%-1.5%, speeds 4-8 improved <1%, and speeds 9-16 improved
- 1.5% to 10.5%, respectively. "Best" mode speed is consistent with the
- Cayuga release.
-
- - Quality:
- Encoder quality in the single stream case is consistent with the Cayuga
- release.
-
- - Bug Fixes:
- This release fixes an OOB read decoder crash bug present in v0.9.7
- related to the clamping of motion vectors in SPLITMV blocks. This
- behavior could be triggered by corrupt input or by starting
- decoding from a P-frame.
-
-
-2011-08-15 v0.9.7-p1 "Cayuga" patch 1
- This is an incremental bugfix release against Cayuga. All users of that
- release are strongly encouraged to upgrade.
-
- - Fix potential OOB reads (cdae03a)
-
- An unbounded out of bounds read was discovered when the
- decoder was requested to perform error concealment (new in
- Cayuga) given a frame with corrupt partition sizes.
-
- A bounded out of bounds read was discovered affecting all
- versions of libvpx. Given an multipartition input frame that
- is truncated between the mode/mv partition and the first
- residiual paritition (in the block of partition offsets), up
- to 3 extra bytes could have been read from the source buffer.
- The code will not take any action regardless of the contents
- of these undefined bytes, as the truncated buffer is detected
- immediately following the read based on the calculated
- starting position of the coefficient partition.
-
- - Fix potential error concealment crash when the very first frame
- is missing or corrupt (a609be5)
-
- - Fix significant artifacts in error concealment (a4c2211, 99d870a)
-
- - Revert 1-pass CBR rate control changes (e961317)
- Further testing showed this change produced undesirable visual
- artifacts, rolling back for now.
-
-
-2011-08-02 v0.9.7 "Cayuga"
- Our third named release, focused on a faster, higher quality, encoder.
-
- - Upgrading:
- This release is backwards compatible with Aylesbury (v0.9.5) and
- Bali (v0.9.6). Users of older releases should refer to the Upgrading
- notes in this document for that release.
-
- - Enhancements:
- Stereo 3D format support for vpxenc
- Runtime detection of available processor cores.
- Allow specifying --end-usage by enum name
- vpxdec: test for frame corruption
- vpxenc: add quantizer histogram display
- vpxenc: add rate histogram display
- Set VPX_FRAME_IS_DROPPABLE
- update configure for ios sdk 4.3
- Avoid text relocations in ARM vp8 decoder
- Generate a vpx.pc file for pkg-config.
- New ways of passing encoded data between encoder and decoder.
-
- - Speed:
- This release includes across-the-board speed improvements to the
- encoder. On x86, these measure at approximately 11.5% in Best mode,
- 21.5% in Good mode (speed 0), and 22.5% in Realtime mode (speed 6).
- On ARM Cortex A9 with Neon extensions, real-time encoding of video
- telephony content is 35% faster than Bali on single core and 48%
- faster on multi-core. On the NVidia Tegra2 platform, real time
- encoding is 40% faster than Bali.
-
- Decoder speed was not a priority for this release, but improved
- approximately 8.4% on x86.
-
- Reduce motion vector search on alt-ref frame.
- Encoder loopfilter running in its own thread
- Reworked loopfilter to precalculate more parameters
- SSE2/SSSE3 optimizations for build_predictors_mbuv{,_s}().
- Make hor UV predict ~2x faster (73 vs 132 cycles) using SSSE3.
- Removed redundant checks
- Reduced structure sizes
- utilize preload in ARMv6 MC/LPF/Copy routines
- ARM optimized quantization, dfct, variance, subtract
- Increase chrow row alignment to 16 bytes.
- disable trellis optimization for first pass
- Write SSSE3 sub-pixel filter function
- Improve SSE2 half-pixel filter funtions
- Add vp8_sub_pixel_variance16x8_ssse3 function
- Reduce unnecessary distortion computation
- Use diamond search to replace full search
- Preload reference area in sub-pixel motion search (real-time mode)
-
- - Quality:
- This release focused primarily on one-pass use cases, including
- video conferencing. Low latency data rate control was significantly
- improved, improving streamability over bandwidth constrained links.
- Added support for error concealment, allowing frames to maintain
- visual quality in the presence of substantial packet loss.
-
- Add rc_max_intra_bitrate_pct control
- Limit size of initial keyframe in one-pass.
- Improve framerate adaptation
- Improved 1-pass CBR rate control
- Improved KF insertion after fades to still.
- Improved key frame detection.
- Improved activity masking (lower PSNR impact for same SSIM boost)
- Improved interaction between GF and ARFs
- Adding error-concealment to the decoder.
- Adding support for independent partitions
- Adjusted rate-distortion constants
-
-
- - Bug Fixes:
- Removed firstpass motion map
- Fix parallel make install
- Fix multithreaded encoding for 1 MB wide frame
- Fixed iwalsh_neon build problems with RVDS4.1
- Fix semaphore emulation, spin-wait intrinsics on Windows
- Fix build with xcode4 and simplify GLOBAL.
- Mark ARM asm objects as allowing a non-executable stack.
- Fix vpxenc encoding incorrect webm file header on big endian
-
-
-2011-03-07 v0.9.6 "Bali"
- Our second named release, focused on a faster, higher quality, encoder.
-
- - Upgrading:
- This release is backwards compatible with Aylesbury (v0.9.5). Users
- of older releases should refer to the Upgrading notes in this
- document for that release.
-
- - Enhancements:
- vpxenc --psnr shows a summary when encode completes
- --tune=ssim option to enable activity masking
- improved postproc visualizations for development
- updated support for Apple iOS to SDK 4.2
- query decoder to determine which reference frames were updated
- implemented error tracking in the decoder
- fix pipe support on windows
-
- - Speed:
- Primary focus was on good quality mode, speed 0. Average improvement
- on x86 about 40%, up to 100% on user-generated content at that speed.
- Best quality mode speed improved 35%, and realtime speed 10-20%. This
- release also saw significant improvement in realtime encoding speed
- on ARM platforms.
-
- Improved encoder threading
- Dont pick encoder filter level when loopfilter is disabled.
- Avoid double copying of key frames into alt and golden buffer
- FDCT optimizations.
- x86 sse2 temporal filter
- SSSE3 version of fast quantizer
- vp8_rd_pick_best_mbsegmentation code restructure
- Adjusted breakout RD for SPLITMV
- Changed segmentation check order
- Improved rd_pick_intra4x4block
- Adds armv6 optimized variance calculation
- ARMv6 optimized sad16x16
- ARMv6 optimized half pixel variance calculations
- Full search SAD function optimization in SSE4.1
- Improve MV prediction accuracy to achieve performance gain
- Improve MV prediction in vp8_pick_inter_mode() for speed>3
-
- - Quality:
- Best quality mode improved PSNR 6.3%, and SSIM 6.1%. This release
- also includes support for "activity masking," which greatly improves
- SSIM at the expense of PSNR. For now, this feature is available with
- the --tune=ssim option. Further experimentation in this area
- is ongoing. This release also introduces a new rate control mode
- called "CQ," which changes the allocation of bits within a clip to
- the sections where they will have the most visual impact.
-
- Tuning for the more exact quantizer.
- Relax rate control for last few frames
- CQ Mode
- Limit key frame quantizer for forced key frames.
- KF/GF Pulsing
- Add simple version of activity masking.
- make rdmult adaptive for intra in quantizer RDO
- cap the best quantizer for 2nd order DC
- change the threshold of DC check for encode breakout
-
- - Bug Fixes:
- Fix crash on Sparc Solaris.
- Fix counter of fixed keyframe distance
- ARNR filter pointer update bug fix
- Fixed use of motion percentage in KF/GF group calc
- Changed condition for using RD in Intra Mode
- Fix encoder real-time only configuration.
- Fix ARM encoder crash with multiple token partitions
- Fixed bug first cluster timecode of webm file is wrong.
- Fixed various encoder bugs with odd-sized images
- vp8e_get_preview fixed when spatial resampling enabled
- quantizer: fix assertion in fast quantizer path
- Allocate source buffers to be multiples of 16
- Fix for manual Golden frame frequency
- Fix drastic undershoot in long form content
-
-
-2010-10-28 v0.9.5 "Aylesbury"
- Our first named release, focused on a faster decoder, and a better encoder.
-
- - Upgrading:
- This release incorporates backwards-incompatible changes to the
- ivfenc and ivfdec tools. These tools are now called vpxenc and vpxdec.
-
- vpxdec
- * the -q (quiet) option has been removed, and replaced with
- -v (verbose). the output is quiet by default. Use -v to see
- the version number of the binary.
-
- * The default behavior is now to write output to a single file
- instead of individual frames. The -y option has been removed.
- Y4M output is the default.
-
- * For raw I420/YV12 output instead of Y4M, the --i420 or --yv12
- options must be specified.
-
- $ ivfdec -o OUTPUT INPUT
- $ vpxdec --i420 -o OUTPUT INPUT
-
- * If an output file is not specified, the default is to write
- Y4M to stdout. This makes piping more natural.
-
- $ ivfdec -y -o - INPUT | ...
- $ vpxdec INPUT | ...
-
- * The output file has additional flexibility for formatting the
- filename. It supports escape characters for constructing a
- filename from the width, height, and sequence number. This
- replaces the -p option. To get the equivalent:
-
- $ ivfdec -p frame INPUT
- $ vpxdec --i420 -o frame-%wx%h-%4.i420 INPUT
-
- vpxenc
- * The output file must be specified with -o, rather than as the
- last argument.
-
- $ ivfenc <options> INPUT OUTPUT
- $ vpxenc <options> -o OUTPUT INPUT
-
- * The output defaults to webm. To get IVF output, use the --ivf
- option.
-
- $ ivfenc <options> INPUT OUTPUT.ivf
- $ vpxenc <options> -o OUTPUT.ivf --ivf INPUT
-
-
- - Enhancements:
- ivfenc and ivfdec have been renamed to vpxenc, vpxdec.
- vpxdec supports .webm input
- vpxdec writes .y4m by default
- vpxenc writes .webm output by default
- vpxenc --psnr now shows the average/overall PSNR at the end
- ARM platforms now support runtime cpu detection
- vpxdec visualizations added for motion vectors, block modes, references
- vpxdec now silent by default
- vpxdec --progress shows frame-by-frame timing information
- vpxenc supports the distinction between --fps and --timebase
- NASM is now a supported assembler
- configure: enable PIC for shared libs by default
- configure: add --enable-small
- configure: support for ppc32-linux-gcc
- configure: support for sparc-solaris-gcc
-
- - Bugs:
- Improve handling of invalid frames
- Fix valgrind errors in the NEON loop filters.
- Fix loopfilter delta zero transitions
- Fix valgrind errors in vp8_sixtap_predict8x4_armv6().
- Build fixes for darwin-icc
-
- - Speed:
- 20-40% (average 28%) improvement in libvpx decoder speed,
- including:
- Rewrite vp8_short_walsh4x4_sse2()
- Optimizations on the loopfilters.
- Miscellaneous improvements for Atom
- Add 4-tap version of 2nd-pass ARMv6 MC filter.
- Improved multithread utilization
- Better instruction choices on x86
- reorder data to use wider instructions
- Update NEON wide idcts
- Make block access to frame buffer sequential
- Improved subset block search
- Bilinear subpixel optimizations for ssse3.
- Decrease memory footprint
-
- Encoder speed improvements (percentage gain not measured):
- Skip unnecessary search of identical frames
- Add SSE2 subtract functions
- Improve bounds checking in vp8_diamond_search_sadx4()
- Added vp8_fast_quantize_b_sse2
-
- - Quality:
- Over 7% overall PSNR improvement (6.3% SSIM) in "best" quality
- encoding mode, and up to 60% improvement on very noisy, still
- or slow moving source video
-
- Motion compensated temporal filter for Alt-Ref Noise Reduction
- Improved use of trellis quantization on 2nd order Y blocks
- Tune effect of motion on KF/GF boost in two pass
- Allow coefficient optimization for good quality speed 0.
- Improved control of active min quantizer for two pass.
- Enable ARFs for non-lagged compress
-
-2010-09-02 v0.9.2
- - Enhancements:
- Disable frame dropping by default
- Improved multithreaded performance
- Improved Force Key Frame Behaviour
- Increased rate control buffer level precision
- Fix bug in 1st pass motion compensation
- ivfenc: correct fixed kf interval, --disable-kf
- - Speed:
- Changed above and left context data layout
- Rework idct calling structure.
- Removed unnecessary MB_MODE_INFO copies
- x86: SSSE3 sixtap prediction
- Reworked IDCT to include reconstruction (add) step
- Swap alt/gold/new/last frame buffer ptrs instead of copying.
- Improve SSE2 loopfilter functions
- Change bitreader to use a larger window.
- Avoid loopfilter reinitialization when possible
- - Quality:
- Normalize quantizer's zero bin and rounding factors
- Add trellis quantization.
- Make the quantizer exact.
- Updates to ARNR filtering algorithm
- Fix breakout thresh computation for golden & AltRef frames
- Redo the forward 4x4 dct
- Improve the accuracy of forward walsh-hadamard transform
- Further adjustment of RD behaviour with Q and Zbin.
- - Build System:
- Allow linking of libs built with MinGW to MSVC
- Fix target auto-detection on mingw32
- Allow --cpu= to work for x86.
- configure: pass original arguments through to make dist
- Fix builds without runtime CPU detection
- msvs: fix install of codec sources
- msvs: Change devenv.com command line for better msys support
- msvs: Add vs9 targets.
- Add x86_64-linux-icc target
- - Bugs:
- Potential crashes on older MinGW builds
- Fix two-pass framrate for Y4M input.
- Fixed simple loop filter, other crashes on ARM v6
- arm: fix missing dependency with --enable-shared
- configure: support directories containing .o
- Replace pinsrw (SSE) with MMX instructions
- apple: include proper mach primatives
- Fixed rate control bug with long key frame interval.
- Fix DSO link errors on x86-64 when not using a version script
- Fixed buffer selection for UV in AltRef filtering
-
-
-2010-06-17 v0.9.1
- - Enhancements:
- * ivfenc/ivfdec now support YUV4MPEG2 input and pipe I/O
- * Speed optimizations
- - Bugfixes:
- * Rate control
- * Prevent out-of-bounds accesses on invalid data
- - Build system updates:
- * Detect toolchain to be used automatically for native builds
- * Support building shared libraries
- * Better autotools emulation (--prefix, --libdir, DESTDIR)
- - Updated LICENSE
- * http://webmproject.blogspot.com/2010/06/changes-to-webm-open-source-license.html
-
-
-2010-05-18 v0.9.0
- - Initial open source release. Welcome to WebM and VP8!
-
diff --git a/videocodec/libvpx_internal/libvpx/LICENSE b/videocodec/libvpx_internal/libvpx/LICENSE
deleted file mode 100644
index 1ce4434..0000000
--- a/videocodec/libvpx_internal/libvpx/LICENSE
+++ /dev/null
@@ -1,31 +0,0 @@
-Copyright (c) 2010, The WebM Project authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- * Neither the name of Google, nor the WebM Project, nor the names
- of its contributors may be used to endorse or promote products
- derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/videocodec/libvpx_internal/libvpx/PATENTS b/videocodec/libvpx_internal/libvpx/PATENTS
deleted file mode 100644
index 4414d83..0000000
--- a/videocodec/libvpx_internal/libvpx/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the WebM Project.
-
-Google hereby grants to you a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer, and otherwise run, modify and propagate the contents of this
-implementation of VP8, where such license applies only to those patent
-claims, both currently owned by Google and acquired in the future,
-licensable by Google that are necessarily infringed by this
-implementation of VP8. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of VP8 or any code incorporated within this
-implementation of VP8 constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of VP8
-shall terminate as of the date such litigation is filed.
diff --git a/videocodec/libvpx_internal/libvpx/README b/videocodec/libvpx_internal/libvpx/README
deleted file mode 100644
index ce9c1c6..0000000
--- a/videocodec/libvpx_internal/libvpx/README
+++ /dev/null
@@ -1,139 +0,0 @@
-vpx Multi-Format Codec SDK
-README - 1 August 2013
-
-Welcome to the WebM VP8/VP9 Codec SDK!
-
-COMPILING THE APPLICATIONS/LIBRARIES:
- The build system used is similar to autotools. Building generally consists of
- "configuring" with your desired build options, then using GNU make to build
- the application.
-
- 1. Prerequisites
-
- * All x86 targets require the Yasm[1] assembler be installed.
- * All Windows builds require that Cygwin[2] be installed.
- * Building the documentation requires PHP[3] and Doxygen[4]. If you do not
- have these packages, you must pass --disable-install-docs to the
- configure script.
- * Downloading the data for the unit tests requires curl[5] and sha1sum.
- sha1sum is provided via the GNU coreutils, installed by default on
- many *nix platforms, as well as MinGW and Cygwin. If coreutils is not
- available, a compatible version of sha1sum can be built from
- source[6]. These requirements are optional if not running the unit
- tests.
-
- [1]: http://www.tortall.net/projects/yasm
- [2]: http://www.cygwin.com
- [3]: http://php.net
- [4]: http://www.doxygen.org
- [5]: http://curl.haxx.se
- [6]: http://www.microbrew.org/tools/md5sha1sum/
-
- 2. Out-of-tree builds
- Out of tree builds are a supported method of building the application. For
- an out of tree build, the source tree is kept separate from the object
- files produced during compilation. For instance:
-
- $ mkdir build
- $ cd build
- $ ../libvpx/configure <options>
- $ make
-
- 3. Configuration options
- The 'configure' script supports a number of options. The --help option can be
- used to get a list of supported options:
- $ ../libvpx/configure --help
-
- 4. Cross development
- For cross development, the most notable option is the --target option. The
- most up-to-date list of supported targets can be found at the bottom of the
- --help output of the configure script. As of this writing, the list of
- available targets is:
-
- armv5te-android-gcc
- armv5te-linux-rvct
- armv5te-linux-gcc
- armv5te-none-rvct
- armv6-darwin-gcc
- armv6-linux-rvct
- armv6-linux-gcc
- armv6-none-rvct
- armv7-android-gcc
- armv7-darwin-gcc
- armv7-linux-rvct
- armv7-linux-gcc
- armv7-none-rvct
- armv7-win32-vs11
- armv7-win32-vs12
- mips32-linux-gcc
- ppc32-darwin8-gcc
- ppc32-darwin9-gcc
- ppc32-linux-gcc
- ppc64-darwin8-gcc
- ppc64-darwin9-gcc
- ppc64-linux-gcc
- sparc-solaris-gcc
- x86-android-gcc
- x86-darwin8-gcc
- x86-darwin8-icc
- x86-darwin9-gcc
- x86-darwin9-icc
- x86-darwin10-gcc
- x86-darwin11-gcc
- x86-darwin12-gcc
- x86-darwin13-gcc
- x86-linux-gcc
- x86-linux-icc
- x86-os2-gcc
- x86-solaris-gcc
- x86-win32-gcc
- x86-win32-vs7
- x86-win32-vs8
- x86-win32-vs9
- x86-win32-vs10
- x86-win32-vs11
- x86-win32-vs12
- x86_64-darwin9-gcc
- x86_64-darwin10-gcc
- x86_64-darwin11-gcc
- x86_64-darwin12-gcc
- x86_64-darwin13-gcc
- x86_64-linux-gcc
- x86_64-linux-icc
- x86_64-solaris-gcc
- x86_64-win64-gcc
- x86_64-win64-vs8
- x86_64-win64-vs9
- x86_64-win64-vs10
- x86_64-win64-vs11
- x86_64-win64-vs12
- universal-darwin8-gcc
- universal-darwin9-gcc
- universal-darwin10-gcc
- universal-darwin11-gcc
- universal-darwin12-gcc
- universal-darwin13-gcc
- generic-gnu
-
- The generic-gnu target, in conjunction with the CROSS environment variable,
- can be used to cross compile architectures that aren't explicitly listed, if
- the toolchain is a cross GNU (gcc/binutils) toolchain. Other POSIX toolchains
- will likely work as well. For instance, to build using the mipsel-linux-uclibc
- toolchain, the following command could be used (note, POSIX SH syntax, adapt
- to your shell as necessary):
-
- $ CROSS=mipsel-linux-uclibc- ../libvpx/configure
-
- In addition, the executables to be invoked can be overridden by specifying the
- environment variables: CC, AR, LD, AS, STRIP, NM. Additional flags can be
- passed to these executables with CFLAGS, LDFLAGS, and ASFLAGS.
-
- 5. Configuration errors
- If the configuration step fails, the first step is to look in the error log.
- This defaults to config.log. This should give a good indication of what went
- wrong. If not, contact us for support.
-
-SUPPORT
- This library is an open source project supported by its community. Please
- please email webm-discuss@webmproject.org for help.
-
diff --git a/videocodec/libvpx_internal/libvpx/args.c b/videocodec/libvpx_internal/libvpx/args.c
deleted file mode 100644
index 9dabc9b..0000000
--- a/videocodec/libvpx_internal/libvpx/args.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include "args.h"
-
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
-#if defined(__GNUC__) && __GNUC__
-extern void die(const char *fmt, ...) __attribute__((noreturn));
-#else
-extern void die(const char *fmt, ...);
-#endif
-
-
-struct arg arg_init(char **argv) {
- struct arg a;
-
- a.argv = argv;
- a.argv_step = 1;
- a.name = NULL;
- a.val = NULL;
- a.def = NULL;
- return a;
-}
-
-int arg_match(struct arg *arg_, const struct arg_def *def, char **argv) {
- struct arg arg;
-
- if (!argv[0] || argv[0][0] != '-')
- return 0;
-
- arg = arg_init(argv);
-
- if (def->short_name
- && strlen(arg.argv[0]) == strlen(def->short_name) + 1
- && !strcmp(arg.argv[0] + 1, def->short_name)) {
-
- arg.name = arg.argv[0] + 1;
- arg.val = def->has_val ? arg.argv[1] : NULL;
- arg.argv_step = def->has_val ? 2 : 1;
- } else if (def->long_name) {
- const size_t name_len = strlen(def->long_name);
-
- if (strlen(arg.argv[0]) >= name_len + 2
- && arg.argv[0][1] == '-'
- && !strncmp(arg.argv[0] + 2, def->long_name, name_len)
- && (arg.argv[0][name_len + 2] == '='
- || arg.argv[0][name_len + 2] == '\0')) {
-
- arg.name = arg.argv[0] + 2;
- arg.val = arg.name[name_len] == '=' ? arg.name + name_len + 1 : NULL;
- arg.argv_step = 1;
- }
- }
-
- if (arg.name && !arg.val && def->has_val)
- die("Error: option %s requires argument.\n", arg.name);
-
- if (arg.name && arg.val && !def->has_val)
- die("Error: option %s requires no argument.\n", arg.name);
-
- if (arg.name
- && (arg.val || !def->has_val)) {
- arg.def = def;
- *arg_ = arg;
- return 1;
- }
-
- return 0;
-}
-
-
-const char *arg_next(struct arg *arg) {
- if (arg->argv[0])
- arg->argv += arg->argv_step;
-
- return *arg->argv;
-}
-
-
-char **argv_dup(int argc, const char **argv) {
- char **new_argv = malloc((argc + 1) * sizeof(*argv));
-
- memcpy(new_argv, argv, argc * sizeof(*argv));
- new_argv[argc] = NULL;
- return new_argv;
-}
-
-
-void arg_show_usage(FILE *fp, const struct arg_def *const *defs) {
- char option_text[40] = {0};
-
- for (; *defs; defs++) {
- const struct arg_def *def = *defs;
- char *short_val = def->has_val ? " <arg>" : "";
- char *long_val = def->has_val ? "=<arg>" : "";
-
- if (def->short_name && def->long_name) {
- char *comma = def->has_val ? "," : ", ";
-
- snprintf(option_text, 37, "-%s%s%s --%s%6s",
- def->short_name, short_val, comma,
- def->long_name, long_val);
- } else if (def->short_name)
- snprintf(option_text, 37, "-%s%s",
- def->short_name, short_val);
- else if (def->long_name)
- snprintf(option_text, 37, " --%s%s",
- def->long_name, long_val);
-
- fprintf(fp, " %-37s\t%s\n", option_text, def->desc);
-
- if (def->enums) {
- const struct arg_enum_list *listptr;
-
- fprintf(fp, " %-37s\t ", "");
-
- for (listptr = def->enums; listptr->name; listptr++)
- fprintf(fp, "%s%s", listptr->name,
- listptr[1].name ? ", " : "\n");
- }
- }
-}
-
-
-unsigned int arg_parse_uint(const struct arg *arg) {
- long int rawval;
- char *endptr;
-
- rawval = strtol(arg->val, &endptr, 10);
-
- if (arg->val[0] != '\0' && endptr[0] == '\0') {
- if (rawval >= 0 && rawval <= UINT_MAX)
- return rawval;
-
- die("Option %s: Value %ld out of range for unsigned int\n",
- arg->name, rawval);
- }
-
- die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
- return 0;
-}
-
-
-int arg_parse_int(const struct arg *arg) {
- long int rawval;
- char *endptr;
-
- rawval = strtol(arg->val, &endptr, 10);
-
- if (arg->val[0] != '\0' && endptr[0] == '\0') {
- if (rawval >= INT_MIN && rawval <= INT_MAX)
- return rawval;
-
- die("Option %s: Value %ld out of range for signed int\n",
- arg->name, rawval);
- }
-
- die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
- return 0;
-}
-
-
-struct vpx_rational {
- int num; /**< fraction numerator */
- int den; /**< fraction denominator */
-};
-struct vpx_rational arg_parse_rational(const struct arg *arg) {
- long int rawval;
- char *endptr;
- struct vpx_rational rat;
-
- /* parse numerator */
- rawval = strtol(arg->val, &endptr, 10);
-
- if (arg->val[0] != '\0' && endptr[0] == '/') {
- if (rawval >= INT_MIN && rawval <= INT_MAX)
- rat.num = rawval;
- else die("Option %s: Value %ld out of range for signed int\n",
- arg->name, rawval);
- } else die("Option %s: Expected / at '%c'\n", arg->name, *endptr);
-
- /* parse denominator */
- rawval = strtol(endptr + 1, &endptr, 10);
-
- if (arg->val[0] != '\0' && endptr[0] == '\0') {
- if (rawval >= INT_MIN && rawval <= INT_MAX)
- rat.den = rawval;
- else die("Option %s: Value %ld out of range for signed int\n",
- arg->name, rawval);
- } else die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
-
- return rat;
-}
-
-
-int arg_parse_enum(const struct arg *arg) {
- const struct arg_enum_list *listptr;
- long int rawval;
- char *endptr;
-
- /* First see if the value can be parsed as a raw value */
- rawval = strtol(arg->val, &endptr, 10);
- if (arg->val[0] != '\0' && endptr[0] == '\0') {
- /* Got a raw value, make sure it's valid */
- for (listptr = arg->def->enums; listptr->name; listptr++)
- if (listptr->val == rawval)
- return rawval;
- }
-
- /* Next see if it can be parsed as a string */
- for (listptr = arg->def->enums; listptr->name; listptr++)
- if (!strcmp(arg->val, listptr->name))
- return listptr->val;
-
- die("Option %s: Invalid value '%s'\n", arg->name, arg->val);
- return 0;
-}
-
-
-int arg_parse_enum_or_int(const struct arg *arg) {
- if (arg->def->enums)
- return arg_parse_enum(arg);
- return arg_parse_int(arg);
-}
diff --git a/videocodec/libvpx_internal/libvpx/args.h b/videocodec/libvpx_internal/libvpx/args.h
deleted file mode 100644
index 04e0acd..0000000
--- a/videocodec/libvpx_internal/libvpx/args.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef ARGS_H_
-#define ARGS_H_
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct arg {
- char **argv;
- const char *name;
- const char *val;
- unsigned int argv_step;
- const struct arg_def *def;
-};
-
-struct arg_enum_list {
- const char *name;
- int val;
-};
-#define ARG_ENUM_LIST_END {0}
-
-typedef struct arg_def {
- const char *short_name;
- const char *long_name;
- int has_val;
- const char *desc;
- const struct arg_enum_list *enums;
-} arg_def_t;
-#define ARG_DEF(s,l,v,d) {s,l,v,d, NULL}
-#define ARG_DEF_ENUM(s,l,v,d,e) {s,l,v,d,e}
-#define ARG_DEF_LIST_END {0}
-
-struct arg arg_init(char **argv);
-int arg_match(struct arg *arg_, const struct arg_def *def, char **argv);
-const char *arg_next(struct arg *arg);
-void arg_show_usage(FILE *fp, const struct arg_def *const *defs);
-char **argv_dup(int argc, const char **argv);
-
-unsigned int arg_parse_uint(const struct arg *arg);
-int arg_parse_int(const struct arg *arg);
-struct vpx_rational arg_parse_rational(const struct arg *arg);
-int arg_parse_enum_or_int(const struct arg *arg);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // ARGS_H_
diff --git a/videocodec/libvpx_internal/libvpx/build/.gitattributes b/videocodec/libvpx_internal/libvpx/build/.gitattributes
deleted file mode 100644
index 03db79b..0000000
--- a/videocodec/libvpx_internal/libvpx/build/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-*-vs8/*.rules -crlf
-*-msvs/*.rules -crlf
diff --git a/videocodec/libvpx_internal/libvpx/build/.gitignore b/videocodec/libvpx_internal/libvpx/build/.gitignore
deleted file mode 100644
index 1350fcb..0000000
--- a/videocodec/libvpx_internal/libvpx/build/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-x86*-win32-vs*
diff --git a/videocodec/libvpx_internal/libvpx/build/arm-msvs/obj_int_extract.bat b/videocodec/libvpx_internal/libvpx/build/arm-msvs/obj_int_extract.bat
deleted file mode 100644
index 267ed61..0000000
--- a/videocodec/libvpx_internal/libvpx/build/arm-msvs/obj_int_extract.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-REM Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-REM
-REM Use of this source code is governed by a BSD-style license
-REM that can be found in the LICENSE file in the root of the source
-REM tree. An additional intellectual property rights grant can be found
-REM in the file PATENTS. All contributing project authors may
-REM be found in the AUTHORS file in the root of the source tree.
-echo on
-
-REM Arguments:
-REM %1 - Relative path to the directory containing the vp8 and vpx_scale
-REM source directories.
-REM %2 - Path to obj_int_extract.exe.
-cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vp8/encoder/vp8_asm_enc_offsets.c"
-%2\obj_int_extract.exe rvds "vp8_asm_enc_offsets.obj" > "vp8_asm_enc_offsets.asm"
-
-cl /I "./" /I "%1" /nologo /c /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP "%1/vpx_scale/vpx_scale_asm_offsets.c"
-%2\obj_int_extract.exe rvds "vpx_scale_asm_offsets.obj" > "vpx_scale_asm_offsets.asm"
diff --git a/videocodec/libvpx_internal/libvpx/build/make/Android.mk b/videocodec/libvpx_internal/libvpx/build/make/Android.mk
deleted file mode 100644
index 48a0dd7..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/Android.mk
+++ /dev/null
@@ -1,216 +0,0 @@
-##
-## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-#
-# This file is to be used for compiling libvpx for Android using the NDK.
-# In an Android project place a libvpx checkout in the jni directory.
-# Run the configure script from the jni directory. Base libvpx
-# encoder/decoder configuration will look similar to:
-# ./libvpx/configure --target=armv7-android-gcc --disable-examples \
-# --sdk-path=/opt/android-ndk-r6b/
-#
-# When targeting Android, realtime-only is enabled by default. This can
-# be overridden by adding the command line flag:
-# --disable-realtime-only
-#
-# This will create .mk files that contain variables that contain the
-# source files to compile.
-#
-# Place an Android.mk file in the jni directory that references the
-# Android.mk file in the libvpx directory:
-# LOCAL_PATH := $(call my-dir)
-# include $(CLEAR_VARS)
-# include jni/libvpx/build/make/Android.mk
-#
-# There are currently two TARGET_ARCH_ABI targets for ARM.
-# armeabi and armeabi-v7a. armeabi-v7a is selected by creating an
-# Application.mk in the jni directory that contains:
-# APP_ABI := armeabi-v7a
-#
-# By default libvpx will detect at runtime the existance of NEON extension.
-# For this we import the 'cpufeatures' module from the NDK sources.
-# libvpx can also be configured without this runtime detection method.
-# Configuring with --disable-runtime-cpu-detect will assume presence of NEON.
-# Configuring with --disable-runtime-cpu-detect --disable-neon will remove any
-# NEON dependency.
-
-# To change to building armeabi, run ./libvpx/configure again, but with
-# --target=arm5te-android-gcc and modify the Application.mk file to
-# set APP_ABI := armeabi
-#
-# Running ndk-build will build libvpx and include it in your project.
-#
-
-CONFIG_DIR := $(LOCAL_PATH)/
-LIBVPX_PATH := $(LOCAL_PATH)/libvpx
-ASM_CNV_PATH_LOCAL := $(TARGET_ARCH_ABI)/ads2gas
-ASM_CNV_PATH := $(LOCAL_PATH)/$(ASM_CNV_PATH_LOCAL)
-
-# Makefiles created by the libvpx configure process
-# This will need to be fixed to handle x86.
-ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
- include $(CONFIG_DIR)libs-armv7-android-gcc.mk
-else
- include $(CONFIG_DIR)libs-armv5te-android-gcc.mk
-endif
-
-# Rule that is normally in Makefile created by libvpx
-# configure. Used to filter out source files based on configuration.
-enabled=$(filter-out $($(1)-no),$($(1)-yes))
-
-# Override the relative path that is defined by the libvpx
-# configure process
-SRC_PATH_BARE := $(LIBVPX_PATH)
-
-# Include the list of files to be built
-include $(LIBVPX_PATH)/libs.mk
-
-# Want arm, not thumb, optimized
-LOCAL_ARM_MODE := arm
-LOCAL_CFLAGS := -O3
-
-# -----------------------------------------------------------------------------
-# Template : asm_offsets_template
-# Arguments : 1: assembly offsets file to be created
-# 2: c file to base assembly offsets on
-# Returns : None
-# Usage : $(eval $(call asm_offsets_template,<asmfile>, <srcfile>
-# Rationale : Create offsets at compile time using for structures that are
-# defined in c, but used in assembly functions.
-# -----------------------------------------------------------------------------
-define asm_offsets_template
-
-_SRC:=$(2)
-_OBJ:=$(ASM_CNV_PATH)/$$(notdir $(2)).S
-
-_FLAGS = $$($$(my)CFLAGS) \
- $$(call get-src-file-target-cflags,$(2)) \
- $$(call host-c-includes,$$(LOCAL_C_INCLUDES) $$(CONFIG_DIR)) \
- $$(LOCAL_CFLAGS) \
- $$(NDK_APP_CFLAGS) \
- $$(call host-c-includes,$$($(my)C_INCLUDES)) \
- -DINLINE_ASM \
- -S \
-
-_TEXT = "Compile $$(call get-src-file-text,$(2))"
-_CC = $$(TARGET_CC)
-
-$$(eval $$(call ev-build-file))
-
-$(1) : $$(_OBJ) $(2)
- @mkdir -p $$(dir $$@)
- @grep $(OFFSET_PATTERN) $$< | tr -d '\#' | $(CONFIG_DIR)$(ASM_CONVERSION) > $$@
-endef
-
-# Use ads2gas script to convert from RVCT format to GAS format. This passes
-# puts the processed file under $(ASM_CNV_PATH). Local clean rule
-# to handle removing these
-ifeq ($(CONFIG_VP8_ENCODER), yes)
- ASM_CNV_OFFSETS_DEPEND += $(ASM_CNV_PATH)/vp8_asm_enc_offsets.asm
-endif
-ifeq ($(HAVE_NEON), yes)
- ASM_CNV_OFFSETS_DEPEND += $(ASM_CNV_PATH)/vpx_scale_asm_offsets.asm
-endif
-
-.PRECIOUS: %.asm.s
-$(ASM_CNV_PATH)/libvpx/%.asm.s: $(LIBVPX_PATH)/%.asm $(ASM_CNV_OFFSETS_DEPEND)
- @mkdir -p $(dir $@)
- @$(CONFIG_DIR)$(ASM_CONVERSION) <$< > $@
-
-# For building *_rtcd.h, which have rules in libs.mk
-TGT_ISA:=$(word 1, $(subst -, ,$(TOOLCHAIN)))
-target := libs
-
-LOCAL_SRC_FILES += vpx_config.c
-
-# Remove duplicate entries
-CODEC_SRCS_UNIQUE = $(sort $(CODEC_SRCS))
-
-# Pull out C files. vpx_config.c is in the immediate directory and
-# so it does not need libvpx/ prefixed like the rest of the source files.
-# The neon files with intrinsics need to have .neon appended so the proper
-# flags are applied.
-CODEC_SRCS_C = $(filter %.c, $(CODEC_SRCS_UNIQUE))
-LOCAL_NEON_SRCS_C = $(filter %_neon.c, $(CODEC_SRCS_C))
-LOCAL_CODEC_SRCS_C = $(filter-out vpx_config.c %_neon.c, $(CODEC_SRCS_C))
-
-LOCAL_SRC_FILES += $(foreach file, $(LOCAL_CODEC_SRCS_C), libvpx/$(file))
-LOCAL_SRC_FILES += $(foreach file, $(LOCAL_NEON_SRCS_C), libvpx/$(file).neon)
-
-# Pull out assembly files, splitting NEON from the rest. This is
-# done to specify that the NEON assembly files use NEON assembler flags.
-CODEC_SRCS_ASM_ALL = $(filter %.asm.s, $(CODEC_SRCS_UNIQUE))
-CODEC_SRCS_ASM = $(foreach v, \
- $(CODEC_SRCS_ASM_ALL), \
- $(if $(findstring neon,$(v)),,$(v)))
-CODEC_SRCS_ASM_ADS2GAS = $(patsubst %.s, \
- $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
- $(CODEC_SRCS_ASM))
-LOCAL_SRC_FILES += $(CODEC_SRCS_ASM_ADS2GAS)
-
-ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
- CODEC_SRCS_ASM_NEON = $(foreach v, \
- $(CODEC_SRCS_ASM_ALL),\
- $(if $(findstring neon,$(v)),$(v),))
- CODEC_SRCS_ASM_NEON_ADS2GAS = $(patsubst %.s, \
- $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
- $(CODEC_SRCS_ASM_NEON))
- LOCAL_SRC_FILES += $(patsubst %.s, \
- %.s.neon, \
- $(CODEC_SRCS_ASM_NEON_ADS2GAS))
-endif
-
-LOCAL_CFLAGS += \
- -DHAVE_CONFIG_H=vpx_config.h \
- -I$(LIBVPX_PATH) \
- -I$(ASM_CNV_PATH)
-
-LOCAL_MODULE := libvpx
-
-LOCAL_LDLIBS := -llog
-
-ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
- LOCAL_STATIC_LIBRARIES := cpufeatures
-endif
-
-# Add a dependency to force generation of the RTCD files.
-ifeq ($(CONFIG_VP8), yes)
-$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vp8_rtcd.h
-endif
-ifeq ($(CONFIG_VP9), yes)
-$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vp9_rtcd.h
-endif
-$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_scale_rtcd.h
-
-.PHONY: clean
-clean:
- @echo "Clean: ads2gas files [$(TARGET_ARCH_ABI)]"
- @$(RM) $(CODEC_SRCS_ASM_ADS2GAS) $(CODEC_SRCS_ASM_NEON_ADS2GAS)
- @$(RM) $(patsubst %.asm, %.*, $(ASM_CNV_OFFSETS_DEPEND))
- @$(RM) -r $(ASM_CNV_PATH)
- @$(RM) $(CLEAN-OBJS)
-
-include $(BUILD_SHARED_LIBRARY)
-
-ifeq ($(HAVE_NEON), yes)
- $(eval $(call asm_offsets_template,\
- $(ASM_CNV_PATH)/vpx_scale_asm_offsets.asm, \
- $(LIBVPX_PATH)/vpx_scale/vpx_scale_asm_offsets.c))
-endif
-
-ifeq ($(CONFIG_VP8_ENCODER), yes)
- $(eval $(call asm_offsets_template,\
- $(ASM_CNV_PATH)/vp8_asm_enc_offsets.asm, \
- $(LIBVPX_PATH)/vp8/encoder/vp8_asm_enc_offsets.c))
-endif
-
-ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
-$(call import-module,cpufeatures)
-endif
diff --git a/videocodec/libvpx_internal/libvpx/build/make/Makefile b/videocodec/libvpx_internal/libvpx/build/make/Makefile
deleted file mode 100644
index dd7fb4a..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/Makefile
+++ /dev/null
@@ -1,434 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-include config.mk
-quiet?=true
-ifeq ($(target),)
-# If a target wasn't specified, invoke for all enabled targets.
-.DEFAULT:
- @for t in $(ALL_TARGETS); do \
- $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
- done
-all: .DEFAULT
-clean:: .DEFAULT
-install:: .DEFAULT
-test:: .DEFAULT
-testdata:: .DEFAULT
-
-
-# Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
-# installed on cygwin, so we need to autodetect here.
-md5sum := $(firstword $(wildcard \
- $(foreach e,md5sum openssl,\
- $(foreach p,$(subst :, ,$(PATH)),$(p)/$(e)*))\
- ))
-md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum))
-
-TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
-dist:
- @for t in $(ALL_TARGETS); do \
- $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
- done
- # Run configure for the user with the current toolchain.
- @if [ -d "$(DIST_DIR)/src" ]; then \
- mkdir -p "$(DIST_DIR)/build"; \
- cd "$(DIST_DIR)/build"; \
- echo "Rerunning configure $(CONFIGURE_ARGS)"; \
- ../src/configure $(CONFIGURE_ARGS); \
- $(if $(filter vs%,$(TGT_CC)),make NO_LAUNCH_DEVENV=1;) \
- fi
- @if [ -d "$(DIST_DIR)" ]; then \
- echo " [MD5SUM] $(DIST_DIR)"; \
- cd $(DIST_DIR) && \
- $(md5sum) `find . -name md5sums.txt -prune -o -type f -print` \
- | sed -e 's/MD5(\(.*\))= \([0-9a-f]\{32\}\)/\2 \1/' \
- > md5sums.txt;\
- fi
-
-
-endif
-
-ifneq ($(target),)
-# Normally, we want to build the filename from the target and the toolchain.
-# This disambiguates from the $(target).mk file that exists in the source tree.
-# However, the toolchain is part of the target in universal builds, so we
-# don't want to include TOOLCHAIN in that case. FAT_ARCHS is used to test
-# if we're in the universal case.
-include $(target)$(if $(FAT_ARCHS),,-$(TOOLCHAIN)).mk
-endif
-BUILD_ROOT?=.
-VPATH=$(SRC_PATH_BARE)
-CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
-CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
-ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/
-DIST_DIR?=dist
-HOSTCC?=gcc
-TGT_ISA:=$(word 1, $(subst -, ,$(TOOLCHAIN)))
-TGT_OS:=$(word 2, $(subst -, ,$(TOOLCHAIN)))
-TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
-quiet:=$(if $(or $(verbose), $(V)),, yes)
-qexec=$(if $(quiet),@)
-
-# Cancel built-in implicit rules
-%: %.o
-%.asm:
-%.a:
-%: %.cc
-
-#
-# Common rules"
-#
-.PHONY: all
-all:
-
-.PHONY: clean
-clean::
- rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s)
- rm -f $(CLEAN-OBJS)
-
-.PHONY: clean
-distclean: clean
- if [ -z "$(target)" ]; then \
- rm -f Makefile; \
- rm -f config.log config.mk; \
- rm -f vpx_config.[hc] vpx_config.asm; \
- else \
- rm -f $(target)-$(TOOLCHAIN).mk; \
- fi
-
-.PHONY: dist
-dist:
-.PHONY: install
-install::
-.PHONY: test
-test::
-.PHONY: testdata
-testdata::
-
-# Add compiler flags for intrinsic files
-$(BUILD_PFX)%_mmx.c.d: CFLAGS += -mmmx
-$(BUILD_PFX)%_mmx.c.o: CFLAGS += -mmmx
-$(BUILD_PFX)%_sse2.c.d: CFLAGS += -msse2
-$(BUILD_PFX)%_sse2.c.o: CFLAGS += -msse2
-$(BUILD_PFX)%_sse3.c.d: CFLAGS += -msse3
-$(BUILD_PFX)%_sse3.c.o: CFLAGS += -msse3
-$(BUILD_PFX)%_ssse3.c.d: CFLAGS += -mssse3
-$(BUILD_PFX)%_ssse3.c.o: CFLAGS += -mssse3
-$(BUILD_PFX)%_sse4.c.d: CFLAGS += -msse4.1
-$(BUILD_PFX)%_sse4.c.o: CFLAGS += -msse4.1
-$(BUILD_PFX)%_avx.c.d: CFLAGS += -mavx
-$(BUILD_PFX)%_avx.c.o: CFLAGS += -mavx
-$(BUILD_PFX)%_avx2.c.d: CFLAGS += -mavx2
-$(BUILD_PFX)%_avx2.c.o: CFLAGS += -mavx2
-
-$(BUILD_PFX)%.c.d: %.c
- $(if $(quiet),@echo " [DEP] $@")
- $(qexec)mkdir -p $(dir $@)
- $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@
-
-$(BUILD_PFX)%.c.o: %.c
- $(if $(quiet),@echo " [CC] $@")
- $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
-
-$(BUILD_PFX)%.cc.d: %.cc
- $(if $(quiet),@echo " [DEP] $@")
- $(qexec)mkdir -p $(dir $@)
- $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@
-
-$(BUILD_PFX)%.cc.o: %.cc
- $(if $(quiet),@echo " [CXX] $@")
- $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
-
-$(BUILD_PFX)%.asm.d: %.asm
- $(if $(quiet),@echo " [DEP] $@")
- $(qexec)mkdir -p $(dir $@)
- $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \
- --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@
-
-$(BUILD_PFX)%.asm.o: %.asm
- $(if $(quiet),@echo " [AS] $@")
- $(qexec)$(AS) $(ASFLAGS) -o $@ $<
-
-$(BUILD_PFX)%.s.d: %.s
- $(if $(quiet),@echo " [DEP] $@")
- $(qexec)mkdir -p $(dir $@)
- $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \
- --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@
-
-$(BUILD_PFX)%.s.o: %.s
- $(if $(quiet),@echo " [AS] $@")
- $(qexec)$(AS) $(ASFLAGS) -o $@ $<
-
-.PRECIOUS: %.c.S
-%.c.S: CFLAGS += -DINLINE_ASM
-$(BUILD_PFX)%.c.S: %.c
- $(if $(quiet),@echo " [GEN] $@")
- $(qexec)$(CC) -S $(CFLAGS) -o $@ $<
-
-.PRECIOUS: %.asm.s
-$(BUILD_PFX)%.asm.s: %.asm
- $(if $(quiet),@echo " [ASM CONVERSION] $@")
- $(qexec)mkdir -p $(dir $@)
- $(qexec)$(ASM_CONVERSION) <$< >$@
-
-# If we're in debug mode, pretend we don't have GNU strip, to fall back to
-# the copy implementation
-HAVE_GNU_STRIP := $(if $(CONFIG_DEBUG),,$(HAVE_GNU_STRIP))
-ifeq ($(HAVE_GNU_STRIP),yes)
-# Older binutils strip global sybols not needed for relocation processing
-# when given --strip-unneeded. Use nm and awk to identify globals and
-# keep them.
-%.a: %_g.a
- $(if $(quiet),@echo " [STRIP] $@ < $<")
- $(qexec)$(STRIP) --strip-unneeded \
- `$(NM) $< | grep ' [A-TV-Z] ' | awk '{print "-K"$$3'}`\
- -o $@ $<
-else
-%.a: %_g.a
- $(if $(quiet),@echo " [CP] $@ < $<")
- $(qexec)cp $< $@
-endif
-
-#
-# Rule to extract assembly constants from C sources
-#
-obj_int_extract: build/make/obj_int_extract.c
- $(if $(quiet),@echo " [HOSTCC] $@")
- $(qexec)$(HOSTCC) -I. -I$(SRC_PATH_BARE) -o $@ $<
-CLEAN-OBJS += obj_int_extract
-
-#
-# Utility functions
-#
-pairmap=$(if $(strip $(2)),\
- $(call $(1),$(word 1,$(2)),$(word 2,$(2)))\
- $(call pairmap,$(1),$(wordlist 3,$(words $(2)),$(2)))\
-)
-
-enabled=$(filter-out $($(1)-no),$($(1)-yes))
-cond_enabled=$(if $(filter yes,$($(1))), $(call enabled,$(2)))
-
-find_file1=$(word 1,$(wildcard $(subst //,/,$(addsuffix /$(1),$(2)))))
-find_file=$(foreach f,$(1),$(call find_file1,$(strip $(f)),$(strip $(2))) )
-obj_pats=.c=.c.o $(AS_SFX)=$(AS_SFX).o .cc=.cc.o
-objs=$(addprefix $(BUILD_PFX),$(foreach p,$(obj_pats),$(filter %.o,$(1:$(p))) ))
-
-install_map_templates=$(eval $(call install_map_template,$(1),$(2)))
-
-not=$(subst yes,no,$(1))
-
-ifeq ($(CONFIG_MSVS),yes)
-lib_file_name=$(1).lib
-else
-lib_file_name=lib$(1).a
-endif
-#
-# Rule Templates
-#
-define linker_template
-$(1): $(filter-out -%,$(2))
-$(1):
- $(if $(quiet),@echo " [LD] $$@")
- $(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
-endef
-define linkerxx_template
-$(1): $(filter-out -%,$(2))
-$(1):
- $(if $(quiet),@echo " [LD] $$@")
- $(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
-endef
-# make-3.80 has a bug with expanding large input strings to the eval function,
-# which was triggered in some cases by the following component of
-# linker_template:
-# $(1): $$(call find_file, $(patsubst -l%,lib%.a,$(filter -l%,$(2))),\
-# $$(patsubst -L%,%,$$(filter -L%,$$(LDFLAGS) $(2))))
-# This may be useful to revisit in the future (it tries to locate libraries
-# in a search path and add them as prerequisites
-
-define install_map_template
-$(DIST_DIR)/$(1): $(2)
- $(if $(quiet),@echo " [INSTALL] $$@")
- $(qexec)mkdir -p $$(dir $$@)
- $(qexec)cp -p $$< $$@
-endef
-
-define archive_template
-# Not using a pattern rule here because we don't want to generate empty
-# archives when they are listed as a dependency in files not responsible
-# for creating them.
-$(1):
- $(if $(quiet),@echo " [AR] $$@")
- $(qexec)$$(AR) $$(ARFLAGS) $$@ $$?
-endef
-
-define so_template
-# Not using a pattern rule here because we don't want to generate empty
-# archives when they are listed as a dependency in files not responsible
-# for creating them.
-#
-# This needs further abstraction for dealing with non-GNU linkers.
-$(1):
- $(if $(quiet),@echo " [LD] $$@")
- $(qexec)$$(LD) -shared $$(LDFLAGS) \
- -Wl,--no-undefined -Wl,-soname,$$(SONAME) \
- -Wl,--version-script,$$(EXPORTS_FILE) -o $$@ \
- $$(filter %.o,$$^) $$(extralibs)
-endef
-
-define dl_template
-# Not using a pattern rule here because we don't want to generate empty
-# archives when they are listed as a dependency in files not responsible
-# for creating them.
-$(1):
- $(if $(quiet),@echo " [LD] $$@")
- $(qexec)$$(LD) -dynamiclib $$(LDFLAGS) \
- -exported_symbols_list $$(EXPORTS_FILE) \
- -Wl,-headerpad_max_install_names,-compatibility_version,1.0,-current_version,$$(VERSION_MAJOR) \
- -o $$@ \
- $$(filter %.o,$$^) $$(extralibs)
-endef
-
-
-
-define lipo_lib_template
-$(1): $(addsuffix /$(1),$(FAT_ARCHS))
- $(if $(quiet),@echo " [LIPO] $$@")
- $(qexec)libtool -static -o $$@ $$?
-endef
-
-define lipo_bin_template
-$(1): $(addsuffix /$(1),$(FAT_ARCHS))
- $(if $(quiet),@echo " [LIPO] $$@")
- $(qexec)lipo -output $$@ -create $$?
-endef
-
-
-#
-# Get current configuration
-#
-ifneq ($(target),)
-include $(SRC_PATH_BARE)/$(target:-$(TOOLCHAIN)=).mk
-endif
-ifeq ($(filter %clean,$(MAKECMDGOALS)),)
- # Older versions of make don't like -include directives with no arguments
- ifneq ($(filter %.d,$(OBJS-yes:.o=.d)),)
- -include $(filter %.d,$(OBJS-yes:.o=.d))
- endif
-endif
-
-#
-# Configuration dependent rules
-#
-$(call pairmap,install_map_templates,$(INSTALL_MAPS))
-
-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS)
-.docs: $(DOCS)
- @touch $@
-
-INSTALL-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,INSTALL-DOCS)
-ifeq ($(MAKECMDGOALS),dist)
-INSTALL-DOCS+=$(call cond_enabled,CONFIG_INSTALL_DOCS,DIST-DOCS)
-endif
-.install-docs: .docs $(addprefix $(DIST_DIR)/,$(INSTALL-DOCS))
- @touch $@
-
-clean::
- rm -f .docs .install-docs $(DOCS)
-
-BINS=$(call enabled,BINS)
-.bins: $(BINS)
- @touch $@
-
-INSTALL-BINS=$(call cond_enabled,CONFIG_INSTALL_BINS,INSTALL-BINS)
-ifeq ($(MAKECMDGOALS),dist)
-INSTALL-BINS+=$(call cond_enabled,CONFIG_INSTALL_BINS,DIST-BINS)
-endif
-.install-bins: .bins $(addprefix $(DIST_DIR)/,$(INSTALL-BINS))
- @touch $@
-
-clean::
- rm -f .bins .install-bins $(BINS)
-
-LIBS=$(call enabled,LIBS)
-.libs: $(LIBS)
- @touch $@
-$(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
-$(foreach lib,$(filter %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
-$(foreach lib,$(filter %$(VERSION_MAJOR).dylib,$(LIBS)),$(eval $(call dl_template,$(lib))))
-
-INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS)
-ifeq ($(MAKECMDGOALS),dist)
-INSTALL-LIBS+=$(call cond_enabled,CONFIG_INSTALL_LIBS,DIST-LIBS)
-endif
-.install-libs: .libs $(addprefix $(DIST_DIR)/,$(INSTALL-LIBS))
- @touch $@
-
-clean::
- rm -f .libs .install-libs $(LIBS)
-
-ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
-PROJECTS=$(call enabled,PROJECTS)
-.projects: $(PROJECTS)
- @touch $@
-
-INSTALL-PROJECTS=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,INSTALL-PROJECTS)
-ifeq ($(MAKECMDGOALS),dist)
-INSTALL-PROJECTS+=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,DIST-PROJECTS)
-endif
-.install-projects: .projects $(addprefix $(DIST_DIR)/,$(INSTALL-PROJECTS))
- @touch $@
-
-clean::
- rm -f .projects .install-projects $(PROJECTS)
-endif
-
-# If there are any source files to be distributed, then include the build
-# system too.
-ifneq ($(call enabled,DIST-SRCS),)
- DIST-SRCS-yes += configure
- DIST-SRCS-yes += build/make/configure.sh
- DIST-SRCS-yes += build/make/gen_asm_deps.sh
- DIST-SRCS-yes += build/make/Makefile
- DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
- DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
- DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
- DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_vcxproj.sh
- DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/obj_int_extract.bat
- DIST-SRCS-$(CONFIG_MSVS) += build/arm-msvs/obj_int_extract.bat
- DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
- # Include obj_int_extract if we use offsets from *_asm_*_offsets
- DIST-SRCS-$(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64) += build/make/obj_int_extract.c
- DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
- DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas_apple.pl
- DIST-SRCS-$(ARCH_ARM) += build/make/ads2armasm_ms.pl
- DIST-SRCS-$(ARCH_ARM) += build/make/thumb.pm
- DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
-endif
-INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS)
-ifeq ($(MAKECMDGOALS),dist)
-INSTALL-SRCS += $(call cond_enabled,CONFIG_INSTALL_SRCS,DIST-SRCS)
-endif
-.install-srcs: $(addprefix $(DIST_DIR)/src/,$(INSTALL-SRCS))
- @touch $@
-
-clean::
- rm -f .install-srcs
-
-ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
- BUILD_TARGETS += .projects
- INSTALL_TARGETS += .install-projects
-endif
-BUILD_TARGETS += .docs .libs .bins
-INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
-all: $(BUILD_TARGETS)
-install:: $(INSTALL_TARGETS)
-dist: $(INSTALL_TARGETS)
-test::
diff --git a/videocodec/libvpx_internal/libvpx/build/make/ads2armasm_ms.pl b/videocodec/libvpx_internal/libvpx/build/make/ads2armasm_ms.pl
deleted file mode 100644
index 2a2c470..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/ads2armasm_ms.pl
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env perl
-##
-## Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-use FindBin;
-use lib $FindBin::Bin;
-use thumb;
-
-print "; This file was created from a .asm file\n";
-print "; using the ads2armasm_ms.pl script.\n";
-
-while (<STDIN>)
-{
- undef $comment;
- undef $line;
-
- s/REQUIRE8//;
- s/PRESERVE8//;
- s/^\s*ARM\s*$//;
- s/AREA\s+\|\|(.*)\|\|/AREA |$1|/;
- s/qsubaddx/qsax/i;
- s/qaddsubx/qasx/i;
-
- thumb::FixThumbInstructions($_, 1);
-
- s/ldrneb/ldrbne/i;
- s/ldrneh/ldrhne/i;
- s/^(\s*)ENDP.*/$&\n$1ALIGN 4/;
-
- print;
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/build/make/ads2gas.pl b/videocodec/libvpx_internal/libvpx/build/make/ads2gas.pl
deleted file mode 100644
index 7272424..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/ads2gas.pl
+++ /dev/null
@@ -1,236 +0,0 @@
-#!/usr/bin/env perl
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-# ads2gas.pl
-# Author: Eric Fung (efung (at) acm.org)
-#
-# Convert ARM Developer Suite 1.0.1 syntax assembly source to GNU as format
-#
-# Usage: cat inputfile | perl ads2gas.pl > outputfile
-#
-
-use FindBin;
-use lib $FindBin::Bin;
-use thumb;
-
-my $thumb = 0;
-
-foreach my $arg (@ARGV) {
- $thumb = 1 if ($arg eq "-thumb");
-}
-
-print "@ This file was created from a .asm file\n";
-print "@ using the ads2gas.pl script.\n";
-print "\t.equ DO1STROUNDING, 0\n";
-if ($thumb) {
- print "\t.syntax unified\n";
- print "\t.thumb\n";
-}
-
-# Stack of procedure names.
-@proc_stack = ();
-
-while (<STDIN>)
-{
- undef $comment;
- undef $line;
- $comment_char = ";";
- $comment_sub = "@";
-
- # Handle comments.
- if (/$comment_char/)
- {
- $comment = "";
- ($line, $comment) = /(.*?)$comment_char(.*)/;
- $_ = $line;
- }
-
- # Load and store alignment
- s/@/,:/g;
-
- # Hexadecimal constants prefaced by 0x
- s/#&/#0x/g;
-
- # Convert :OR: to |
- s/:OR:/ | /g;
-
- # Convert :AND: to &
- s/:AND:/ & /g;
-
- # Convert :NOT: to ~
- s/:NOT:/ ~ /g;
-
- # Convert :SHL: to <<
- s/:SHL:/ << /g;
-
- # Convert :SHR: to >>
- s/:SHR:/ >> /g;
-
- # Convert ELSE to .else
- s/\bELSE\b/.else/g;
-
- # Convert ENDIF to .endif
- s/\bENDIF\b/.endif/g;
-
- # Convert ELSEIF to .elseif
- s/\bELSEIF\b/.elseif/g;
-
- # Convert LTORG to .ltorg
- s/\bLTORG\b/.ltorg/g;
-
- # Convert endfunc to nothing.
- s/\bendfunc\b//ig;
-
- # Convert FUNCTION to nothing.
- s/\bFUNCTION\b//g;
- s/\bfunction\b//g;
-
- s/\bENTRY\b//g;
- s/\bMSARMASM\b/0/g;
- s/^\s+end\s+$//g;
-
- # Convert IF :DEF:to .if
- # gcc doesn't have the ability to do a conditional
- # if defined variable that is set by IF :DEF: on
- # armasm, so convert it to a normal .if and then
- # make sure to define a value elesewhere
- if (s/\bIF :DEF:\b/.if /g)
- {
- s/=/==/g;
- }
-
- # Convert IF to .if
- if (s/\bIF\b/.if/g)
- {
- s/=+/==/g;
- }
-
- # Convert INCLUDE to .INCLUDE "file"
- s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/;
-
- # Code directive (ARM vs Thumb)
- s/CODE([0-9][0-9])/.code $1/;
-
- # No AREA required
- # But ALIGNs in AREA must be obeyed
- s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/;
- # If no ALIGN, strip the AREA and align to 4 bytes
- s/^\s*AREA.*$/.text\n.p2align 2/;
-
- # DCD to .word
- # This one is for incoming symbols
- s/DCD\s+\|(\w*)\|/.long $1/;
-
- # DCW to .short
- s/DCW\s+\|(\w*)\|/.short $1/;
- s/DCW(.*)/.short $1/;
-
- # Constants defined in scope
- s/DCD(.*)/.long $1/;
- s/DCB(.*)/.byte $1/;
-
- # RN to .req
- if (s/RN\s+([Rr]\d+|lr)/.req $1/)
- {
- print;
- print "$comment_sub$comment\n" if defined $comment;
- next;
- }
-
- # Make function visible to linker, and make additional symbol with
- # prepended underscore
- s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/;
- s/IMPORT\s+\|([\$\w]*)\|/.global $1/;
-
- s/EXPORT\s+([\$\w]*)/.global $1/;
- s/export\s+([\$\w]*)/.global $1/;
-
- # No vertical bars required; make additional symbol with prepended
- # underscore
- s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
-
- # Labels need trailing colon
-# s/^(\w+)/$1:/ if !/EQU/;
- # put the colon at the end of the line in the macro
- s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
-
- # ALIGN directive
- s/\bALIGN\b/.balign/g;
-
- if ($thumb) {
- # ARM code - we force everything to thumb with the declaration in the header
- s/\sARM//g;
- } else {
- # ARM code
- s/\sARM/.arm/g;
- }
-
- # push/pop
- s/(push\s+)(r\d+)/stmdb sp\!, \{$2\}/g;
- s/(pop\s+)(r\d+)/ldmia sp\!, \{$2\}/g;
-
- # NEON code
- s/(vld1.\d+\s+)(q\d+)/$1\{$2\}/g;
- s/(vtbl.\d+\s+[^,]+),([^,]+)/$1,\{$2\}/g;
-
- if ($thumb) {
- thumb::FixThumbInstructions($_, 0);
- }
-
- # eabi_attributes numerical equivalents can be found in the
- # "ARM IHI 0045C" document.
-
- # REQUIRE8 Stack is required to be 8-byte aligned
- s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g;
-
- # PRESERVE8 Stack 8-byte align is preserved
- s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g;
-
- # Use PROC and ENDP to give the symbols a .size directive.
- # This makes them show up properly in debugging tools like gdb and valgrind.
- if (/\bPROC\b/)
- {
- my $proc;
- /^_([\.0-9A-Z_a-z]\w+)\b/;
- $proc = $1;
- push(@proc_stack, $proc) if ($proc);
- s/\bPROC\b/@ $&/;
- }
- if (/\bENDP\b/)
- {
- my $proc;
- s/\bENDP\b/@ $&/;
- $proc = pop(@proc_stack);
- $_ = "\t.size $proc, .-$proc".$_ if ($proc);
- }
-
- # EQU directive
- s/(\S+\s+)EQU(\s+\S+)/.equ $1, $2/;
-
- # Begin macro definition
- if (/\bMACRO\b/) {
- $_ = <STDIN>;
- s/^/.macro/;
- s/\$//g; # remove formal param reference
- s/;/@/g; # change comment characters
- }
-
- # For macros, use \ to reference formal params
- s/\$/\\/g; # End macro definition
- s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
- next if /^\s*END\s*$/;
- print;
- print "$comment_sub$comment\n" if defined $comment;
-}
-
-# Mark that this object doesn't need an executable stack.
-printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n");
diff --git a/videocodec/libvpx_internal/libvpx/build/make/ads2gas_apple.pl b/videocodec/libvpx_internal/libvpx/build/make/ads2gas_apple.pl
deleted file mode 100644
index a82f3eb..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/ads2gas_apple.pl
+++ /dev/null
@@ -1,235 +0,0 @@
-#!/usr/bin/env perl
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-# ads2gas_apple.pl
-# Author: Eric Fung (efung (at) acm.org)
-#
-# Convert ARM Developer Suite 1.0.1 syntax assembly source to GNU as format
-#
-# Usage: cat inputfile | perl ads2gas_apple.pl > outputfile
-#
-
-my $chromium = 0;
-
-foreach my $arg (@ARGV) {
- $chromium = 1 if ($arg eq "-chromium");
-}
-
-print "@ This file was created from a .asm file\n";
-print "@ using the ads2gas_apple.pl script.\n\n";
-print "\t.set WIDE_REFERENCE, 0\n";
-print "\t.set ARCHITECTURE, 5\n";
-print "\t.set DO1STROUNDING, 0\n";
-
-my %register_aliases;
-my %macro_aliases;
-
-my @mapping_list = ("\$0", "\$1", "\$2", "\$3", "\$4", "\$5", "\$6", "\$7", "\$8", "\$9");
-
-my @incoming_array;
-
-my @imported_functions;
-
-# Perl trim function to remove whitespace from the start and end of the string
-sub trim($)
-{
- my $string = shift;
- $string =~ s/^\s+//;
- $string =~ s/\s+$//;
- return $string;
-}
-
-while (<STDIN>)
-{
- # Load and store alignment
- s/@/,:/g;
-
- # Comment character
- s/;/ @/g;
-
- # Hexadecimal constants prefaced by 0x
- s/#&/#0x/g;
-
- # Convert :OR: to |
- s/:OR:/ | /g;
-
- # Convert :AND: to &
- s/:AND:/ & /g;
-
- # Convert :NOT: to ~
- s/:NOT:/ ~ /g;
-
- # Convert :SHL: to <<
- s/:SHL:/ << /g;
-
- # Convert :SHR: to >>
- s/:SHR:/ >> /g;
-
- # Convert ELSE to .else
- s/\bELSE\b/.else/g;
-
- # Convert ENDIF to .endif
- s/\bENDIF\b/.endif/g;
-
- # Convert ELSEIF to .elseif
- s/\bELSEIF\b/.elseif/g;
-
- # Convert LTORG to .ltorg
- s/\bLTORG\b/.ltorg/g;
-
- # Convert IF :DEF:to .if
- # gcc doesn't have the ability to do a conditional
- # if defined variable that is set by IF :DEF: on
- # armasm, so convert it to a normal .if and then
- # make sure to define a value elesewhere
- if (s/\bIF :DEF:\b/.if /g)
- {
- s/=/==/g;
- }
-
- # Convert IF to .if
- if (s/\bIF\b/.if/g)
- {
- s/=/==/g;
- }
-
- # Convert INCLUDE to .INCLUDE "file"
- s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/;
-
- # Code directive (ARM vs Thumb)
- s/CODE([0-9][0-9])/.code $1/;
-
- # No AREA required
- # But ALIGNs in AREA must be obeyed
- s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/;
- # If no ALIGN, strip the AREA and align to 4 bytes
- s/^\s*AREA.*$/.text\n.p2align 2/;
-
- # DCD to .word
- # This one is for incoming symbols
- s/DCD\s+\|(\w*)\|/.long $1/;
-
- # DCW to .short
- s/DCW\s+\|(\w*)\|/.short $1/;
- s/DCW(.*)/.short $1/;
-
- # Constants defined in scope
- s/DCD(.*)/.long $1/;
- s/DCB(.*)/.byte $1/;
-
- # Build a hash of all the register - alias pairs.
- if (s/(.*)RN(.*)/$1 .req $2/g)
- {
- $register_aliases{trim($1)} = trim($2);
- next;
- }
-
- while (($key, $value) = each(%register_aliases))
- {
- s/\b$key\b/$value/g;
- }
-
- # Make function visible to linker, and make additional symbol with
- # prepended underscore
- s/EXPORT\s+\|([\$\w]*)\|/.globl _$1\n\t.globl $1/;
-
- # Prepend imported functions with _
- if (s/IMPORT\s+\|([\$\w]*)\|/.globl $1/)
- {
- $function = trim($1);
- push(@imported_functions, $function);
- }
-
- foreach $function (@imported_functions)
- {
- s/$function/_$function/;
- }
-
- # No vertical bars required; make additional symbol with prepended
- # underscore
- s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
-
- # Labels need trailing colon
-# s/^(\w+)/$1:/ if !/EQU/;
- # put the colon at the end of the line in the macro
- s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
-
- # ALIGN directive
- s/\bALIGN\b/.balign/g;
-
- # Strip ARM
- s/\sARM/@ ARM/g;
-
- # Strip REQUIRE8
- #s/\sREQUIRE8/@ REQUIRE8/g;
- s/\sREQUIRE8/@ /g;
-
- # Strip PRESERVE8
- s/\sPRESERVE8/@ PRESERVE8/g;
-
- # Strip PROC and ENDPROC
- s/\bPROC\b/@/g;
- s/\bENDP\b/@/g;
-
- # EQU directive
- s/(.*)EQU(.*)/.set $1, $2/;
-
- # Begin macro definition
- if (/\bMACRO\b/)
- {
- # Process next line down, which will be the macro definition
- $_ = <STDIN>;
-
- $trimmed = trim($_);
-
- # remove commas that are separating list
- $trimmed =~ s/,//g;
-
- # string to array
- @incoming_array = split(/\s+/, $trimmed);
-
- print ".macro @incoming_array[0]\n";
-
- # remove the first element, as that is the name of the macro
- shift (@incoming_array);
-
- @macro_aliases{@incoming_array} = @mapping_list;
-
- next;
- }
-
- while (($key, $value) = each(%macro_aliases))
- {
- $key =~ s/\$/\\\$/;
- s/$key\b/$value/g;
- }
-
- # For macros, use \ to reference formal params
-# s/\$/\\/g; # End macro definition
- s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
- next if /^\s*END\s*$/;
-
- # Clang used by Chromium differs slightly from clang in XCode in what it
- # will accept in the assembly.
- if ($chromium) {
- s/qsubaddx/qsax/i;
- s/qaddsubx/qasx/i;
- s/ldrneb/ldrbne/i;
- s/ldrneh/ldrhne/i;
- s/(vqshrun\.s16 .*, \#)0$/${1}8/i;
-
- # http://llvm.org/bugs/show_bug.cgi?id=16022
- s/\.include/#include/;
- }
-
- print;
-}
diff --git a/videocodec/libvpx_internal/libvpx/build/make/armlink_adapter.sh b/videocodec/libvpx_internal/libvpx/build/make/armlink_adapter.sh
deleted file mode 100644
index 75c342e..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/armlink_adapter.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-verbose=0
-set -- $*
-for i; do
- if [ "$i" = "-o" ]; then
- on_of=1
- elif [ "$i" = "-v" ]; then
- verbose=1
- elif [ "$i" = "-g" ]; then
- args="${args} --debug"
- elif [ "$on_of" = "1" ]; then
- outfile=$i
- on_of=0
- elif [ -f "$i" ]; then
- infiles="$infiles $i"
- elif [ "${i#-l}" != "$i" ]; then
- libs="$libs ${i#-l}"
- elif [ "${i#-L}" != "$i" ]; then
- libpaths="${libpaths} ${i#-L}"
- else
- args="${args} ${i}"
- fi
- shift
-done
-
-# Absolutize library file names
-for f in $libs; do
- found=0
- for d in $libpaths; do
- [ -f "$d/$f" ] && infiles="$infiles $d/$f" && found=1 && break
- [ -f "$d/lib${f}.so" ] && infiles="$infiles $d/lib${f}.so" && found=1 && break
- [ -f "$d/lib${f}.a" ] && infiles="$infiles $d/lib${f}.a" && found=1 && break
- done
- [ $found -eq 0 ] && infiles="$infiles $f"
-done
-for d in $libpaths; do
- [ -n "$libsearchpath" ] && libsearchpath="${libsearchpath},"
- libsearchpath="${libsearchpath}$d"
-done
-
-cmd="armlink $args --userlibpath=$libsearchpath --output=$outfile $infiles"
-[ $verbose -eq 1 ] && echo $cmd
-$cmd
diff --git a/videocodec/libvpx_internal/libvpx/build/make/configure.sh b/videocodec/libvpx_internal/libvpx/build/make/configure.sh
deleted file mode 100644
index 514c442..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/configure.sh
+++ /dev/null
@@ -1,1349 +0,0 @@
-#!/bin/sh
-##
-## configure.sh
-##
-## This script is sourced by the main configure script and contains
-## utility functions and other common bits that aren't strictly libvpx
-## related.
-##
-## This build system is based in part on the FFmpeg configure script.
-##
-
-
-#
-# Logging / Output Functions
-#
-die_unknown(){
- echo "Unknown option \"$1\"."
- echo "See $0 --help for available options."
- clean_temp_files
- exit 1
-}
-
-
-die() {
- echo "$@"
- echo
- echo "Configuration failed. This could reflect a misconfiguration of your"
- echo "toolchains, improper options selected, or another problem. If you"
- echo "don't see any useful error messages above, the next step is to look"
- echo "at the configure error log file ($logfile) to determine what"
- echo "configure was trying to do when it died."
- clean_temp_files
- exit 1
-}
-
-
-log(){
- echo "$@" >>$logfile
-}
-
-
-log_file(){
- log BEGIN $1
- cat -n $1 >>$logfile
- log END $1
-}
-
-
-log_echo() {
- echo "$@"
- log "$@"
-}
-
-
-fwrite () {
- outfile=$1
- shift
- echo "$@" >> ${outfile}
-}
-
-
-show_help_pre(){
- for opt in ${CMDLINE_SELECT}; do
- opt2=`echo $opt | sed -e 's;_;-;g'`
- if enabled $opt; then
- eval "toggle_${opt}=\"--disable-${opt2}\""
- else
- eval "toggle_${opt}=\"--enable-${opt2} \""
- fi
- done
-
- cat <<EOF
-Usage: configure [options]
-Options:
-
-Build options:
- --help print this message
- --log=yes|no|FILE file configure log is written to [config.log]
- --target=TARGET target platform tuple [generic-gnu]
- --cpu=CPU optimize for a specific cpu rather than a family
- --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
- ${toggle_extra_warnings} emit harmless warnings (always non-fatal)
- ${toggle_werror} treat warnings as errors, if possible
- (not available with all compilers)
- ${toggle_optimizations} turn on/off compiler optimization flags
- ${toggle_pic} turn on/off Position Independent Code
- ${toggle_ccache} turn on/off compiler cache
- ${toggle_debug} enable/disable debug mode
- ${toggle_gprof} enable/disable gprof profiling instrumentation
- ${toggle_gcov} enable/disable gcov coverage instrumentation
- ${toggle_thumb} enable/disable building arm assembly in thumb mode
-
-Install options:
- ${toggle_install_docs} control whether docs are installed
- ${toggle_install_bins} control whether binaries are installed
- ${toggle_install_libs} control whether libraries are installed
- ${toggle_install_srcs} control whether sources are installed
-
-
-EOF
-}
-
-
-show_help_post(){
- cat <<EOF
-
-
-NOTES:
- Object files are built at the place where configure is launched.
-
- All boolean options can be negated. The default value is the opposite
- of that shown above. If the option --disable-foo is listed, then
- the default value for foo is enabled.
-
-Supported targets:
-EOF
- show_targets ${all_platforms}
- echo
- exit 1
-}
-
-
-show_targets() {
- while [ -n "$*" ]; do
- if [ "${1%%-*}" = "${2%%-*}" ]; then
- if [ "${2%%-*}" = "${3%%-*}" ]; then
- printf " %-24s %-24s %-24s\n" "$1" "$2" "$3"
- shift; shift; shift
- else
- printf " %-24s %-24s\n" "$1" "$2"
- shift; shift
- fi
- else
- printf " %-24s\n" "$1"
- shift
- fi
- done
-}
-
-
-show_help() {
- show_help_pre
- show_help_post
-}
-
-#
-# List Processing Functions
-#
-set_all(){
- value=$1
- shift
- for var in $*; do
- eval $var=$value
- done
-}
-
-
-is_in(){
- value=$1
- shift
- for var in $*; do
- [ $var = $value ] && return 0
- done
- return 1
-}
-
-
-add_cflags() {
- CFLAGS="${CFLAGS} $@"
- CXXFLAGS="${CXXFLAGS} $@"
-}
-
-
-add_cflags_only() {
- CFLAGS="${CFLAGS} $@"
-}
-
-
-add_cxxflags_only() {
- CXXFLAGS="${CXXFLAGS} $@"
-}
-
-
-add_ldflags() {
- LDFLAGS="${LDFLAGS} $@"
-}
-
-
-add_asflags() {
- ASFLAGS="${ASFLAGS} $@"
-}
-
-
-add_extralibs() {
- extralibs="${extralibs} $@"
-}
-
-#
-# Boolean Manipulation Functions
-#
-enable_feature(){
- set_all yes $*
-}
-
-disable_feature(){
- set_all no $*
-}
-
-enabled(){
- eval test "x\$$1" = "xyes"
-}
-
-disabled(){
- eval test "x\$$1" = "xno"
-}
-
-
-soft_enable() {
- for var in $*; do
- if ! disabled $var; then
- log_echo " enabling $var"
- enable_feature $var
- fi
- done
-}
-
-soft_disable() {
- for var in $*; do
- if ! enabled $var; then
- log_echo " disabling $var"
- disable_feature $var
- fi
- done
-}
-
-
-#
-# Text Processing Functions
-#
-toupper(){
- echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
-}
-
-
-tolower(){
- echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
-}
-
-
-#
-# Temporary File Functions
-#
-source_path=${0%/*}
-enable_feature source_path_used
-if test -z "$source_path" -o "$source_path" = "." ; then
- source_path="`pwd`"
- disable_feature source_path_used
-fi
-
-if test ! -z "$TMPDIR" ; then
- TMPDIRx="${TMPDIR}"
-elif test ! -z "$TEMPDIR" ; then
- TMPDIRx="${TEMPDIR}"
-else
- TMPDIRx="/tmp"
-fi
-RAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}')
-TMP_H="${TMPDIRx}/vpx-conf-$$-${RAND}.h"
-TMP_C="${TMPDIRx}/vpx-conf-$$-${RAND}.c"
-TMP_CC="${TMPDIRx}/vpx-conf-$$-${RAND}.cc"
-TMP_O="${TMPDIRx}/vpx-conf-$$-${RAND}.o"
-TMP_X="${TMPDIRx}/vpx-conf-$$-${RAND}.x"
-TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RAND}.asm"
-
-clean_temp_files() {
- rm -f ${TMP_C} ${TMP_CC} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM}
- enabled gcov && rm -f ${TMP_C%.c}.gcno ${TMP_CC%.cc}.gcno
-}
-
-#
-# Toolchain Check Functions
-#
-check_cmd() {
- enabled external_build && return
- log "$@"
- "$@" >>${logfile} 2>&1
-}
-
-check_cc() {
- log check_cc "$@"
- cat >${TMP_C}
- log_file ${TMP_C}
- check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}
-}
-
-check_cxx() {
- log check_cxx "$@"
- cat >${TMP_CC}
- log_file ${TMP_CC}
- check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC}
-}
-
-check_cpp() {
- log check_cpp "$@"
- cat > ${TMP_C}
- log_file ${TMP_C}
- check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C}
-}
-
-check_ld() {
- log check_ld "$@"
- check_cc $@ \
- && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs}
-}
-
-check_header(){
- log check_header "$@"
- header=$1
- shift
- var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
- disable_feature $var
- check_cpp "$@" <<EOF && enable_feature $var
-#include "$header"
-int x;
-EOF
-}
-
-
-check_cflags() {
- log check_cflags "$@"
- check_cc -Werror "$@" <<EOF
-int x;
-EOF
-}
-
-check_cxxflags() {
- log check_cxxflags "$@"
-
- # Catch CFLAGS that trigger CXX warnings
- case "$CXX" in
- *c++-analyzer|*clang++|*g++*) check_cxx -Werror "$@" <<EOF
-int x;
-EOF
- ;;
- *) check_cxx -Werror "$@" <<EOF
-int x;
-EOF
- ;;
- esac
-}
-
-check_add_cflags() {
- check_cxxflags "$@" && add_cxxflags_only "$@"
- check_cflags "$@" && add_cflags_only "$@"
-}
-
-check_add_asflags() {
- log add_asflags "$@"
- add_asflags "$@"
-}
-
-check_add_ldflags() {
- log add_ldflags "$@"
- add_ldflags "$@"
-}
-
-check_asm_align() {
- log check_asm_align "$@"
- cat >${TMP_ASM} <<EOF
-section .rodata
-align 16
-EOF
- log_file ${TMP_ASM}
- check_cmd ${AS} ${ASFLAGS} -o ${TMP_O} ${TMP_ASM}
- readelf -WS ${TMP_O} >${TMP_X}
- log_file ${TMP_X}
- if ! grep -q '\.rodata .* 16$' ${TMP_X}; then
- die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)"
- fi
-}
-
-# tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used.
-check_gcc_machine_option() {
- local opt="$1"
- local feature="$2"
- [ -n "$feature" ] || feature="$opt"
-
- if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then
- RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature "
- else
- soft_enable "$feature"
- fi
-}
-
-write_common_config_banner() {
- print_webm_license config.mk "##" ""
- echo '# This file automatically generated by configure. Do not edit!' >> config.mk
- echo "TOOLCHAIN := ${toolchain}" >> config.mk
-
- case ${toolchain} in
- *-linux-rvct)
- echo "ALT_LIBC := ${alt_libc}" >> config.mk
- ;;
- esac
-}
-
-write_common_config_targets() {
- for t in ${all_targets}; do
- if enabled ${t}; then
- if enabled universal || enabled child; then
- fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}"
- else
- fwrite config.mk "ALL_TARGETS += ${t}"
- fi
- fi
- true;
- done
-true
-}
-
-write_common_target_config_mk() {
- local CC="${CC}"
- local CXX="${CXX}"
- enabled ccache && CC="ccache ${CC}"
- enabled ccache && CXX="ccache ${CXX}"
- print_webm_license $1 "##" ""
-
- cat >> $1 << EOF
-# This file automatically generated by configure. Do not edit!
-SRC_PATH="$source_path"
-SRC_PATH_BARE=$source_path
-BUILD_PFX=${BUILD_PFX}
-TOOLCHAIN=${toolchain}
-ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl}
-GEN_VCPROJ=${gen_vcproj_cmd}
-MSVS_ARCH_DIR=${msvs_arch_dir}
-
-CC=${CC}
-CXX=${CXX}
-AR=${AR}
-LD=${LD}
-AS=${AS}
-STRIP=${STRIP}
-NM=${NM}
-
-CFLAGS = ${CFLAGS}
-CXXFLAGS = ${CXXFLAGS}
-ARFLAGS = -rus\$(if \$(quiet),c,v)
-LDFLAGS = ${LDFLAGS}
-ASFLAGS = ${ASFLAGS}
-extralibs = ${extralibs}
-AS_SFX = ${AS_SFX:-.asm}
-EXE_SFX = ${EXE_SFX}
-VCPROJ_SFX = ${VCPROJ_SFX}
-RTCD_OPTIONS = ${RTCD_OPTIONS}
-EOF
-
- if enabled rvct; then cat >> $1 << EOF
-fmt_deps = sed -e 's;^__image.axf;\${@:.d=.o} \$@;' #hide
-EOF
- else cat >> $1 << EOF
-fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o;\${@:.d=.o} \$@;'
-EOF
- fi
-
- print_config_mk ARCH "${1}" ${ARCH_LIST}
- print_config_mk HAVE "${1}" ${HAVE_LIST}
- print_config_mk CONFIG "${1}" ${CONFIG_LIST}
- print_config_mk HAVE "${1}" gnu_strip
-
- enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}"
-
-}
-
-
-write_common_target_config_h() {
- print_webm_license ${TMP_H} "/*" " */"
- cat >> ${TMP_H} << EOF
-/* This file automatically generated by configure. Do not edit! */
-#ifndef VPX_CONFIG_H
-#define VPX_CONFIG_H
-#define RESTRICT ${RESTRICT}
-#define INLINE ${INLINE}
-EOF
- print_config_h ARCH "${TMP_H}" ${ARCH_LIST}
- print_config_h HAVE "${TMP_H}" ${HAVE_LIST}
- print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST}
- echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H}
- mkdir -p `dirname "$1"`
- cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1"
-}
-
-process_common_cmdline() {
- for opt in "$@"; do
- optval="${opt#*=}"
- case "$opt" in
- --child) enable_feature child
- ;;
- --log*)
- logging="$optval"
- if ! disabled logging ; then
- enabled logging || logfile="$logging"
- else
- logfile=/dev/null
- fi
- ;;
- --target=*) toolchain="${toolchain:-${optval}}"
- ;;
- --force-target=*) toolchain="${toolchain:-${optval}}"; enable_feature force_toolchain
- ;;
- --cpu)
- ;;
- --cpu=*) tune_cpu="$optval"
- ;;
- --extra-cflags=*)
- extra_cflags="${optval}"
- ;;
- --enable-?*|--disable-?*)
- eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
- if echo "${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null; then
- [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}${opt} "
- elif [ $action = "disable" ] && ! disabled $option ; then
- echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null ||
- die_unknown $opt
- elif [ $action = "enable" ] && ! enabled $option ; then
- echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null ||
- die_unknown $opt
- fi
- ${action}_feature $option
- ;;
- --require-?*)
- eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
- if echo "${ARCH_EXT_LIST}" none | grep "^ *$option\$" >/dev/null; then
- RTCD_OPTIONS="${RTCD_OPTIONS}${opt} "
- else
- die_unknown $opt
- fi
- ;;
- --force-enable-?*|--force-disable-?*)
- eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'`
- ${action}_feature $option
- ;;
- --libc=*)
- [ -d "${optval}" ] || die "Not a directory: ${optval}"
- disable_feature builtin_libc
- alt_libc="${optval}"
- ;;
- --as=*)
- [ "${optval}" = yasm -o "${optval}" = nasm -o "${optval}" = auto ] \
- || die "Must be yasm, nasm or auto: ${optval}"
- alt_as="${optval}"
- ;;
- --prefix=*)
- prefix="${optval}"
- ;;
- --libdir=*)
- libdir="${optval}"
- ;;
- --sdk-path=*)
- [ -d "${optval}" ] || die "Not a directory: ${optval}"
- sdk_path="${optval}"
- ;;
- --libc|--as|--prefix|--libdir|--sdk-path)
- die "Option ${opt} requires argument"
- ;;
- --help|-h) show_help
- ;;
- *) die_unknown $opt
- ;;
- esac
- done
-}
-
-process_cmdline() {
- for opt do
- optval="${opt#*=}"
- case "$opt" in
- *) process_common_cmdline $opt
- ;;
- esac
- done
-}
-
-
-post_process_common_cmdline() {
- prefix="${prefix:-/usr/local}"
- prefix="${prefix%/}"
- libdir="${libdir:-${prefix}/lib}"
- libdir="${libdir%/}"
- if [ "${libdir#${prefix}}" = "${libdir}" ]; then
- die "Libdir ${libdir} must be a subdirectory of ${prefix}"
- fi
-}
-
-
-post_process_cmdline() {
- true;
-}
-
-setup_gnu_toolchain() {
- CC=${CC:-${CROSS}gcc}
- CXX=${CXX:-${CROSS}g++}
- AR=${AR:-${CROSS}ar}
- LD=${LD:-${CROSS}${link_with_cc:-ld}}
- AS=${AS:-${CROSS}as}
- STRIP=${STRIP:-${CROSS}strip}
- NM=${NM:-${CROSS}nm}
- AS_SFX=.s
- EXE_SFX=
-}
-
-process_common_toolchain() {
- if [ -z "$toolchain" ]; then
- gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}"
-
- # detect tgt_isa
- case "$gcctarget" in
- armv6*)
- tgt_isa=armv6
- ;;
- armv7*-hardfloat*)
- tgt_isa=armv7
- float_abi=hard
- ;;
- armv7*)
- tgt_isa=armv7
- float_abi=softfp
- ;;
- armv5te*)
- tgt_isa=armv5te
- ;;
- *x86_64*|*amd64*)
- tgt_isa=x86_64
- ;;
- *i[3456]86*)
- tgt_isa=x86
- ;;
- *powerpc64*)
- tgt_isa=ppc64
- ;;
- *powerpc*)
- tgt_isa=ppc32
- ;;
- *sparc*)
- tgt_isa=sparc
- ;;
- esac
-
- # detect tgt_os
- case "$gcctarget" in
- *darwin8*)
- tgt_isa=universal
- tgt_os=darwin8
- ;;
- *darwin9*)
- tgt_isa=universal
- tgt_os=darwin9
- ;;
- *darwin10*)
- tgt_isa=x86_64
- tgt_os=darwin10
- ;;
- *darwin11*)
- tgt_isa=x86_64
- tgt_os=darwin11
- ;;
- *darwin12*)
- tgt_isa=x86_64
- tgt_os=darwin12
- ;;
- *darwin13*)
- tgt_isa=x86_64
- tgt_os=darwin13
- ;;
- x86_64*mingw32*)
- tgt_os=win64
- ;;
- *mingw32*|*cygwin*)
- [ -z "$tgt_isa" ] && tgt_isa=x86
- tgt_os=win32
- ;;
- *linux*|*bsd*)
- tgt_os=linux
- ;;
- *solaris2.10)
- tgt_os=solaris
- ;;
- *os2*)
- tgt_os=os2
- ;;
- esac
-
- if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then
- toolchain=${tgt_isa}-${tgt_os}-gcc
- fi
- fi
-
- toolchain=${toolchain:-generic-gnu}
-
- is_in ${toolchain} ${all_platforms} || enabled force_toolchain \
- || die "Unrecognized toolchain '${toolchain}'"
-
- enabled child || log_echo "Configuring for target '${toolchain}'"
-
- #
- # Set up toolchain variables
- #
- tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}')
- tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}')
- tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}')
-
- # Mark the specific ISA requested as enabled
- soft_enable ${tgt_isa}
- enable_feature ${tgt_os}
- enable_feature ${tgt_cc}
-
- # Enable the architecture family
- case ${tgt_isa} in
- arm*) enable_feature arm;;
- mips*) enable_feature mips;;
- esac
-
- # PIC is probably what we want when building shared libs
- enabled shared && soft_enable pic
-
- # Handle darwin variants. Newer SDKs allow targeting older
- # platforms, so find the newest SDK available.
- case ${toolchain} in
- *-darwin*)
- if [ -z "${DEVELOPER_DIR}" ]; then
- DEVELOPER_DIR=`xcode-select -print-path 2> /dev/null`
- [ $? -ne 0 ] && OSX_SKIP_DIR_CHECK=1
- fi
- if [ -z "${OSX_SKIP_DIR_CHECK}" ]; then
- OSX_SDK_ROOTS="${DEVELOPER_DIR}/SDKs"
- OSX_SDK_VERSIONS="MacOSX10.4u.sdk MacOSX10.5.sdk MacOSX10.6.sdk"
- OSX_SDK_VERSIONS="${OSX_SDK_VERSIONS} MacOSX10.7.sdk"
- for v in ${OSX_SDK_VERSIONS}; do
- if [ -d "${OSX_SDK_ROOTS}/${v}" ]; then
- osx_sdk_dir="${OSX_SDK_ROOTS}/${v}"
- fi
- done
- fi
- ;;
- esac
-
- if [ -d "${osx_sdk_dir}" ]; then
- add_cflags "-isysroot ${osx_sdk_dir}"
- add_ldflags "-isysroot ${osx_sdk_dir}"
- fi
-
- case ${toolchain} in
- *-darwin8-*)
- add_cflags "-mmacosx-version-min=10.4"
- add_ldflags "-mmacosx-version-min=10.4"
- ;;
- *-darwin9-*)
- add_cflags "-mmacosx-version-min=10.5"
- add_ldflags "-mmacosx-version-min=10.5"
- ;;
- *-darwin10-*)
- add_cflags "-mmacosx-version-min=10.6"
- add_ldflags "-mmacosx-version-min=10.6"
- ;;
- *-darwin11-*)
- add_cflags "-mmacosx-version-min=10.7"
- add_ldflags "-mmacosx-version-min=10.7"
- ;;
- *-darwin12-*)
- add_cflags "-mmacosx-version-min=10.8"
- add_ldflags "-mmacosx-version-min=10.8"
- ;;
- *-darwin13-*)
- add_cflags "-mmacosx-version-min=10.9"
- add_ldflags "-mmacosx-version-min=10.9"
- ;;
- esac
-
- # Handle Solaris variants. Solaris 10 needs -lposix4
- case ${toolchain} in
- sparc-solaris-*)
- add_extralibs -lposix4
- disable_feature fast_unaligned
- ;;
- *-solaris-*)
- add_extralibs -lposix4
- ;;
- esac
-
- # Process ARM architecture variants
- case ${toolchain} in
- arm*)
- # on arm, isa versions are supersets
- case ${tgt_isa} in
- armv7)
- soft_enable neon
- soft_enable media
- soft_enable edsp
- soft_enable fast_unaligned
- ;;
- armv6)
- soft_enable media
- soft_enable edsp
- soft_enable fast_unaligned
- ;;
- armv5te)
- soft_enable edsp
- disable_feature fast_unaligned
- ;;
- esac
-
- asm_conversion_cmd="cat"
-
- case ${tgt_cc} in
- gcc)
- CROSS=${CROSS:-arm-none-linux-gnueabi-}
- link_with_cc=gcc
- setup_gnu_toolchain
- arch_int=${tgt_isa##armv}
- arch_int=${arch_int%%te}
- check_add_asflags --defsym ARCHITECTURE=${arch_int}
- tune_cflags="-mtune="
- if [ ${tgt_isa} = "armv7" ]; then
- if [ -z "${float_abi}" ]; then
- check_cpp <<EOF && float_abi=hard || float_abi=softfp
-#ifndef __ARM_PCS_VFP
-#error "not hardfp"
-#endif
-EOF
- fi
- check_add_cflags -march=armv7-a -mfloat-abi=${float_abi}
- check_add_asflags -march=armv7-a -mfloat-abi=${float_abi}
-
- if enabled neon
- then
- check_add_cflags -mfpu=neon #-ftree-vectorize
- check_add_asflags -mfpu=neon
- fi
-
- if [ -z "${tune_cpu}" ]; then
- tune_cpu=cortex-a8
- fi
- else
- check_add_cflags -march=${tgt_isa}
- check_add_asflags -march=${tgt_isa}
- fi
-
- enabled debug && add_asflags -g
- asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
- if enabled thumb; then
- asm_conversion_cmd="$asm_conversion_cmd -thumb"
- check_add_cflags -mthumb
- check_add_asflags -mthumb -mimplicit-it=always
- fi
- ;;
- vs*)
- asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl"
- AS_SFX=.s
- msvs_arch_dir=arm-msvs
- disable_feature multithread
- disable_feature unit_tests
- ;;
- rvct)
- CC=armcc
- AR=armar
- AS=armasm
- LD=${source_path}/build/make/armlink_adapter.sh
- STRIP=arm-none-linux-gnueabi-strip
- NM=arm-none-linux-gnueabi-nm
- tune_cflags="--cpu="
- tune_asflags="--cpu="
- if [ -z "${tune_cpu}" ]; then
- if [ ${tgt_isa} = "armv7" ]; then
- if enabled neon
- then
- check_add_cflags --fpu=softvfp+vfpv3
- check_add_asflags --fpu=softvfp+vfpv3
- fi
- check_add_cflags --cpu=Cortex-A8
- check_add_asflags --cpu=Cortex-A8
- else
- check_add_cflags --cpu=${tgt_isa##armv}
- check_add_asflags --cpu=${tgt_isa##armv}
- fi
- fi
- arch_int=${tgt_isa##armv}
- arch_int=${arch_int%%te}
- check_add_asflags --pd "\"ARCHITECTURE SETA ${arch_int}\""
- enabled debug && add_asflags -g
- add_cflags --gnu
- add_cflags --enum_is_int
- add_cflags --wchar32
- ;;
- esac
-
- case ${tgt_os} in
- none*)
- disable_feature multithread
- disable_feature os_support
- ;;
-
- android*)
- SDK_PATH=${sdk_path}
- COMPILER_LOCATION=`find "${SDK_PATH}" \
- -name "arm-linux-androideabi-gcc*" -print -quit`
- TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi-
- CC=${TOOLCHAIN_PATH}gcc
- CXX=${TOOLCHAIN_PATH}g++
- AR=${TOOLCHAIN_PATH}ar
- LD=${TOOLCHAIN_PATH}gcc
- AS=${TOOLCHAIN_PATH}as
- STRIP=${TOOLCHAIN_PATH}strip
- NM=${TOOLCHAIN_PATH}nm
-
- if [ -z "${alt_libc}" ]; then
- alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \
- awk '{n = split($0,a,"/"); \
- split(a[n-1],b,"-"); \
- print $0 " " b[2]}' | \
- sort -g -k 2 | \
- awk '{ print $1 }' | tail -1`
- fi
-
- add_cflags "--sysroot=${alt_libc}"
- add_ldflags "--sysroot=${alt_libc}"
-
- # linker flag that routes around a CPU bug in some
- # Cortex-A8 implementations (NDK Dev Guide)
- add_ldflags "-Wl,--fix-cortex-a8"
-
- enable_feature pic
- soft_enable realtime_only
- if [ ${tgt_isa} = "armv7" ]; then
- soft_enable runtime_cpu_detect
- fi
- if enabled runtime_cpu_detect; then
- add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
- fi
- ;;
-
- darwin*)
-
- XCRUN_FIND="xcrun --sdk iphoneos -find"
- CXX="$(${XCRUN_FIND} clang++)"
- CC="$(${XCRUN_FIND} clang)"
- AR="$(${XCRUN_FIND} ar)"
- LD="$(${XCRUN_FIND} ld)"
- AS="$(${XCRUN_FIND} as)"
- STRIP="$(${XCRUN_FIND} strip)"
- NM="$(${XCRUN_FIND} nm)"
- RANLIB="$(${XCRUN_FIND} ranlib)"
- AS_SFX=.s
-
- # ASFLAGS is written here instead of using check_add_asflags
- # because we need to overwrite all of ASFLAGS and purge the
- # options that were put in above
- ASFLAGS="-arch ${tgt_isa} -g"
-
- alt_libc="$(xcrun --sdk iphoneos --show-sdk-path)"
- add_cflags -arch ${tgt_isa} -isysroot ${alt_libc}
- add_ldflags -arch ${tgt_isa} -ios_version_min 7.0
-
- for d in lib usr/lib usr/lib/system; do
- try_dir="${alt_libc}/${d}"
- [ -d "${try_dir}" ] && add_ldflags -L"${try_dir}"
- done
-
- asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl"
- ;;
-
- linux*)
- enable_feature linux
- if enabled rvct; then
- # Check if we have CodeSourcery GCC in PATH. Needed for
- # libraries
- hash arm-none-linux-gnueabi-gcc 2>&- || \
- die "Couldn't find CodeSourcery GCC from PATH"
-
- # Use armcc as a linker to enable translation of
- # some gcc specific options such as -lm and -lpthread.
- LD="armcc --translate_gcc"
-
- # create configuration file (uses path to CodeSourcery GCC)
- armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cfg
-
- add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg
- add_asflags --no_hide_all --apcs=/interwork
- add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg
- enabled pic && add_cflags --apcs=/fpic
- enabled pic && add_asflags --apcs=/fpic
- enabled shared && add_cflags --shared
- fi
- ;;
-
- esac
- ;;
- mips*)
- link_with_cc=gcc
- setup_gnu_toolchain
- tune_cflags="-mtune="
- if enabled dspr2; then
- check_add_cflags -mips32r2 -mdspr2
- disable_feature fast_unaligned
- fi
- check_add_cflags -march=${tgt_isa}
- check_add_asflags -march=${tgt_isa}
- check_add_asflags -KPIC
- ;;
- ppc*)
- enable_feature ppc
- bits=${tgt_isa##ppc}
- link_with_cc=gcc
- setup_gnu_toolchain
- add_asflags -force_cpusubtype_ALL -I"\$(dir \$<)darwin"
- soft_enable altivec
- enabled altivec && add_cflags -maltivec
-
- case "$tgt_os" in
- linux*)
- add_asflags -maltivec -mregnames -I"\$(dir \$<)linux"
- ;;
- darwin*)
- darwin_arch="-arch ppc"
- enabled ppc64 && darwin_arch="${darwin_arch}64"
- add_cflags ${darwin_arch} -m${bits} -fasm-blocks
- add_asflags ${darwin_arch} -force_cpusubtype_ALL -I"\$(dir \$<)darwin"
- add_ldflags ${darwin_arch} -m${bits}
- enabled altivec && add_cflags -faltivec
- ;;
- esac
- ;;
- x86*)
- bits=32
- enabled x86_64 && bits=64
- check_cpp <<EOF && bits=x32
-#ifndef __ILP32__
-#error "not x32"
-#endif
-EOF
-
- case ${tgt_os} in
- win*)
- enabled gcc && add_cflags -fno-common
- ;;
- solaris*)
- CC=${CC:-${CROSS}gcc}
- CXX=${CXX:-${CROSS}g++}
- LD=${LD:-${CROSS}gcc}
- CROSS=${CROSS:-g}
- ;;
- os2)
- AS=${AS:-nasm}
- ;;
- esac
-
- AS="${alt_as:-${AS:-auto}}"
- case ${tgt_cc} in
- icc*)
- CC=${CC:-icc}
- LD=${LD:-icc}
- setup_gnu_toolchain
- add_cflags -use-msasm # remove -use-msasm too?
- # add -no-intel-extensions to suppress warning #10237
- # refer to http://software.intel.com/en-us/forums/topic/280199
- add_ldflags -i-static -no-intel-extensions
- enabled x86_64 && add_cflags -ipo -static -O3 -no-prec-div
- enabled x86_64 && AR=xiar
- case ${tune_cpu} in
- atom*)
- tune_cflags="-x"
- tune_cpu="SSE3_ATOM"
- ;;
- *)
- tune_cflags="-march="
- ;;
- esac
- ;;
- gcc*)
- add_cflags -m${bits}
- add_ldflags -m${bits}
- link_with_cc=gcc
- tune_cflags="-march="
- setup_gnu_toolchain
- #for 32 bit x86 builds, -O3 did not turn on this flag
- enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer
- ;;
- vs*)
- # When building with Microsoft Visual Studio the assembler is
- # invoked directly. Checking at configure time is unnecessary.
- # Skip the check by setting AS arbitrarily
- AS=msvs
- msvs_arch_dir=x86-msvs
- vc_version=${tgt_cc##vs}
- case $vc_version in
- 7|8|9|10)
- echo "${tgt_cc} does not support avx/avx2, disabling....."
- RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx --disable-avx2 "
- soft_disable avx
- soft_disable avx2
- ;;
- esac
- ;;
- esac
-
- soft_enable runtime_cpu_detect
- # We can't use 'check_cflags' until the compiler is configured and CC is
- # populated.
- check_gcc_machine_option mmx
- check_gcc_machine_option sse
- check_gcc_machine_option sse2
- check_gcc_machine_option sse3
- check_gcc_machine_option ssse3
- check_gcc_machine_option sse4 sse4_1
- check_gcc_machine_option avx
- check_gcc_machine_option avx2
-
- case "${AS}" in
- auto|"")
- which nasm >/dev/null 2>&1 && AS=nasm
- which yasm >/dev/null 2>&1 && AS=yasm
- [ "${AS}" = auto -o -z "${AS}" ] \
- && die "Neither yasm nor nasm have been found"
- ;;
- esac
- log_echo " using $AS"
- [ "${AS##*/}" = nasm ] && add_asflags -Ox
- AS_SFX=.asm
- case ${tgt_os} in
- win32)
- add_asflags -f win32
- enabled debug && add_asflags -g cv8
- EXE_SFX=.exe
- ;;
- win64)
- add_asflags -f x64
- enabled debug && add_asflags -g cv8
- EXE_SFX=.exe
- ;;
- linux*|solaris*|android*)
- add_asflags -f elf${bits}
- enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2
- enabled debug && [ "${AS}" = nasm ] && add_asflags -g
- [ "${AS##*/}" = nasm ] && check_asm_align
- ;;
- darwin*)
- add_asflags -f macho${bits}
- enabled x86 && darwin_arch="-arch i386" || darwin_arch="-arch x86_64"
- add_cflags ${darwin_arch}
- add_ldflags ${darwin_arch}
- # -mdynamic-no-pic is still a bit of voodoo -- it was required at
- # one time, but does not seem to be now, and it breaks some of the
- # code that still relies on inline assembly.
- # enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic
- enabled icc && ! enabled pic && add_cflags -fno-pic
- ;;
- os2)
- add_asflags -f aout
- enabled debug && add_asflags -g
- EXE_SFX=.exe
- ;;
- *) log "Warning: Unknown os $tgt_os while setting up $AS flags"
- ;;
- esac
- ;;
- universal*|*-gcc|generic-gnu)
- link_with_cc=gcc
- enable_feature gcc
- setup_gnu_toolchain
- ;;
- esac
-
- # Try to enable CPU specific tuning
- if [ -n "${tune_cpu}" ]; then
- if [ -n "${tune_cflags}" ]; then
- check_add_cflags ${tune_cflags}${tune_cpu} || \
- die "Requested CPU '${tune_cpu}' not supported by compiler"
- fi
- if [ -n "${tune_asflags}" ]; then
- check_add_asflags ${tune_asflags}${tune_cpu} || \
- die "Requested CPU '${tune_cpu}' not supported by assembler"
- fi
- if [ -z "${tune_cflags}${tune_asflags}" ]; then
- log_echo "Warning: CPU tuning not supported by this toolchain"
- fi
- fi
-
- enabled debug && check_add_cflags -g && check_add_ldflags -g
- enabled gprof && check_add_cflags -pg && check_add_ldflags -pg
- enabled gcov &&
- check_add_cflags -fprofile-arcs -ftest-coverage &&
- check_add_ldflags -fprofile-arcs -ftest-coverage
-
- if enabled optimizations; then
- if enabled rvct; then
- enabled small && check_add_cflags -Ospace || check_add_cflags -Otime
- else
- enabled small && check_add_cflags -O2 || check_add_cflags -O3
- fi
- fi
-
- # default use_x86inc to yes if pic is no or 64bit or we are not on darwin
- if [ ${tgt_isa} = x86_64 -o ! "$pic" = "yes" -o \
- "${tgt_os#darwin}" = "${tgt_os}" ]; then
- soft_enable use_x86inc
- fi
-
- # Position Independent Code (PIC) support, for building relocatable
- # shared objects
- enabled gcc && enabled pic && check_add_cflags -fPIC
-
- # Work around longjmp interception on glibc >= 2.11, to improve binary
- # compatibility. See http://code.google.com/p/webm/issues/detail?id=166
- enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
-
- # Check for strip utility variant
- ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip
-
- # Try to determine target endianness
- check_cc <<EOF
- unsigned int e = 'O'<<24 | '2'<<16 | 'B'<<8 | 'E';
-EOF
- [ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' |
- grep '4f *32 *42 *45' >/dev/null 2>&1 && enable_feature big_endian
-
- # Try to find which inline keywords are supported
- check_cc <<EOF && INLINE="inline"
- static inline function() {}
-EOF
- check_cc <<EOF && INLINE="__inline__ __attribute__((always_inline))"
- static __attribute__((always_inline)) function() {}
-EOF
-
- # Almost every platform uses pthreads.
- if enabled multithread; then
- case ${toolchain} in
- *-win*-vs*);;
- *-android-gcc);;
- *) check_header pthread.h && add_extralibs -lpthread
- esac
- fi
-
- # only for MIPS platforms
- case ${toolchain} in
- mips*)
- if enabled dspr2; then
- if enabled big_endian; then
- echo "dspr2 optimizations are available only for little endian platforms"
- disable_feature dspr2
- fi
- fi
- ;;
- esac
-
- # glibc needs these
- if enabled linux; then
- add_cflags -D_LARGEFILE_SOURCE
- add_cflags -D_FILE_OFFSET_BITS=64
- fi
-
- # append any user defined extra cflags
- if [ -n "${extra_cflags}" ] ; then
- check_add_cflags ${extra_cflags} || \
- die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler"
- fi
-}
-
-process_toolchain() {
- process_common_toolchain
-}
-
-print_config_mk() {
- local prefix=$1
- local makefile=$2
- shift 2
- for cfg; do
- upname="`toupper $cfg`"
- if enabled $cfg; then
- echo "${prefix}_${upname}=yes" >> $makefile
- fi
- done
-}
-
-print_config_h() {
- local prefix=$1
- local header=$2
- shift 2
- for cfg; do
- upname="`toupper $cfg`"
- if enabled $cfg; then
- echo "#define ${prefix}_${upname} 1" >> $header
- else
- echo "#define ${prefix}_${upname} 0" >> $header
- fi
- done
-}
-
-print_webm_license() {
- local destination=$1
- local prefix="$2"
- local suffix="$3"
- shift 3
- cat <<EOF > ${destination}
-${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suffix}
-${prefix} ${suffix}
-${prefix} Use of this source code is governed by a BSD-style license${suffix}
-${prefix} that can be found in the LICENSE file in the root of the source${suffix}
-${prefix} tree. An additional intellectual property rights grant can be found${suffix}
-${prefix} in the file PATENTS. All contributing project authors may${suffix}
-${prefix} be found in the AUTHORS file in the root of the source tree.${suffix}
-EOF
-}
-
-process_targets() {
- true;
-}
-
-process_detect() {
- true;
-}
-
-enable_feature logging
-logfile="config.log"
-self=$0
-process() {
- cmdline_args="$@"
- process_cmdline "$@"
- if enabled child; then
- echo "# ${self} $@" >> ${logfile}
- else
- echo "# ${self} $@" > ${logfile}
- fi
- post_process_common_cmdline
- post_process_cmdline
- process_toolchain
- process_detect
- process_targets
-
- OOT_INSTALLS="${OOT_INSTALLS}"
- if enabled source_path_used; then
- # Prepare the PWD for building.
- for f in ${OOT_INSTALLS}; do
- install -D ${source_path}/$f $f
- done
- fi
- cp ${source_path}/build/make/Makefile .
-
- clean_temp_files
- true
-}
diff --git a/videocodec/libvpx_internal/libvpx/build/make/gen_asm_deps.sh b/videocodec/libvpx_internal/libvpx/build/make/gen_asm_deps.sh
deleted file mode 100644
index 6a7bff9..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/gen_asm_deps.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-self=$0
-show_help() {
- echo "usage: $self [options] <srcfile>"
- echo
- echo "Generate Makefile dependency information from assembly code source"
- echo
- exit 1
-}
-die_unknown(){
- echo "Unknown option \"$1\"."
- echo "See $0 --help for available options."
- exit 1
-}
-for opt do
- optval="${opt#*=}"
- case "$opt" in
- --build-pfx=*) pfx="${optval}"
- ;;
- --depfile=*) out="${optval}"
- ;;
- -I*) raw_inc_paths="${raw_inc_paths} ${opt}"
- inc_path="${inc_path} ${opt#-I}"
- ;;
- -h|--help) show_help
- ;;
- *) [ -f "$opt" ] && srcfile="$opt"
- ;;
- esac
-done
-
-[ -n "$srcfile" ] || show_help
-sfx=${sfx:-asm}
-includes=$(LC_ALL=C egrep -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
- perl -p -e "s;.*?([a-z0-9_/]+.${sfx}).*;\1;")
-#" restore editor state
-for inc in ${includes}; do
- found_inc_path=
- for idir in ${inc_path}; do
- [ -f "${idir}/${inc}" ] && found_inc_path="${idir}" && break
- done
- if [ -f `dirname $srcfile`/$inc ]; then
- # Handle include files in the same directory as the source
- $self --build-pfx=$pfx --depfile=$out ${raw_inc_paths} `dirname $srcfile`/$inc
- elif [ -n "${found_inc_path}" ]; then
- # Handle include files on the include path
- $self --build-pfx=$pfx --depfile=$out ${raw_inc_paths} "${found_inc_path}/$inc"
- else
- # Handle generated includes in the build root (which may not exist yet)
- echo ${out} ${out%d}o: "${pfx}${inc}"
- fi
-done
-echo ${out} ${out%d}o: $srcfile
diff --git a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_def.sh b/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_def.sh
deleted file mode 100644
index 4defcc2..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_def.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-self=$0
-self_basename=${self##*/}
-EOL=$'\n'
-
-show_help() {
- cat <<EOF
-Usage: ${self_basename} [options] file1 [file2 ...]
-
-This script generates a MSVC module definition file containing a list of symbols
-to export from a DLL. Source files are technically bash scripts (and thus may
-use #comment syntax) but in general, take the form of a list of symbols:
-
- <kind> symbol1 [symbol2, symbol3, ...]
-
-where <kind> is either 'text' or 'data'
-
-
-Options:
- --help Print this message
- --out=filename Write output to a file [stdout]
- --name=project_name Name of the library (required)
-EOF
- exit 1
-}
-
-die() {
- echo "${self_basename}: $@"
- exit 1
-}
-
-die_unknown(){
- echo "Unknown option \"$1\"."
- echo "See ${self_basename} --help for available options."
- exit 1
-}
-
-text() {
- for sym in "$@"; do
- echo " $sym" >> ${outfile}
- done
-}
-
-data() {
- for sym in "$@"; do
- printf " %-40s DATA\n" "$sym" >> ${outfile}
- done
-}
-
-# Process command line
-for opt in "$@"; do
- optval="${opt#*=}"
- case "$opt" in
- --help|-h) show_help
- ;;
- --out=*) outfile="$optval"
- ;;
- --name=*) name="${optval}"
- ;;
- -*) die_unknown $opt
- ;;
- *) file_list[${#file_list[@]}]="$opt"
- esac
-done
-outfile=${outfile:-/dev/stdout}
-[ -n "$name" ] || die "Library name (--name) must be specified!"
-
-echo "LIBRARY ${name}" > ${outfile}
-echo "EXPORTS" >> ${outfile}
-for f in "${file_list[@]}"; do
- . $f
-done
diff --git a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_proj.sh b/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_proj.sh
deleted file mode 100644
index df91435..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_proj.sh
+++ /dev/null
@@ -1,591 +0,0 @@
-#!/bin/bash
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-self=$0
-self_basename=${self##*/}
-self_dirname=$(dirname "$0")
-EOL=$'\n'
-
-show_help() {
- cat <<EOF
-Usage: ${self_basename} --name=projname [options] file1 [file2 ...]
-
-This script generates a Visual Studio project file from a list of source
-code files.
-
-Options:
- --help Print this message
- --exe Generate a project for building an Application
- --lib Generate a project for creating a static library
- --dll Generate a project for creating a dll
- --static-crt Use the static C runtime (/MT)
- --target=isa-os-cc Target specifier (required)
- --out=filename Write output to a file [stdout]
- --name=project_name Name of the project (required)
- --proj-guid=GUID GUID to use for the project
- --module-def=filename File containing export definitions (for DLLs)
- --ver=version Version (7,8,9) of visual studio to generate for
- --src-path-bare=dir Path to root of source tree
- -Ipath/to/include Additional include directories
- -DFLAG[=value] Preprocessor macros to define
- -Lpath/to/lib Additional library search paths
- -llibname Library to link against
-EOF
- exit 1
-}
-
-die() {
- echo "${self_basename}: $@" >&2
- exit 1
-}
-
-die_unknown(){
- echo "Unknown option \"$1\"." >&2
- echo "See ${self_basename} --help for available options." >&2
- exit 1
-}
-
-generate_uuid() {
- local hex="0123456789ABCDEF"
- local i
- local uuid=""
- local j
- #93995380-89BD-4b04-88EB-625FBE52EBFB
- for ((i=0; i<32; i++)); do
- (( j = $RANDOM % 16 ))
- uuid="${uuid}${hex:$j:1}"
- done
- echo "${uuid:0:8}-${uuid:8:4}-${uuid:12:4}-${uuid:16:4}-${uuid:20:12}"
-}
-
-indent1=" "
-indent=""
-indent_push() {
- indent="${indent}${indent1}"
-}
-indent_pop() {
- indent="${indent%${indent1}}"
-}
-
-tag_attributes() {
- for opt in "$@"; do
- optval="${opt#*=}"
- [ -n "${optval}" ] ||
- die "Missing attribute value in '$opt' while generating $tag tag"
- echo "${indent}${opt%%=*}=\"${optval}\""
- done
-}
-
-open_tag() {
- local tag=$1
- shift
- if [ $# -ne 0 ]; then
- echo "${indent}<${tag}"
- indent_push
- tag_attributes "$@"
- echo "${indent}>"
- else
- echo "${indent}<${tag}>"
- indent_push
- fi
-}
-
-close_tag() {
- local tag=$1
- indent_pop
- echo "${indent}</${tag}>"
-}
-
-tag() {
- local tag=$1
- shift
- if [ $# -ne 0 ]; then
- echo "${indent}<${tag}"
- indent_push
- tag_attributes "$@"
- indent_pop
- echo "${indent}/>"
- else
- echo "${indent}<${tag}/>"
- fi
-}
-
-generate_filter() {
- local var=$1
- local name=$2
- local pats=$3
- local file_list_sz
- local i
- local f
- local saveIFS="$IFS"
- local pack
- echo "generating filter '$name' from ${#file_list[@]} files" >&2
- IFS=*
-
- open_tag Filter \
- Name=$name \
- Filter=$pats \
- UniqueIdentifier=`generate_uuid` \
-
- file_list_sz=${#file_list[@]}
- for i in ${!file_list[@]}; do
- f=${file_list[i]}
- for pat in ${pats//;/$IFS}; do
- if [ "${f##*.}" == "$pat" ]; then
- unset file_list[i]
-
- objf=$(echo ${f%.*}.obj | sed -e 's/^[\./]\+//g' -e 's,/,_,g')
- open_tag File RelativePath="./$f"
-
- if [ "$pat" == "asm" ] && $asm_use_custom_step; then
- for plat in "${platforms[@]}"; do
- for cfg in Debug Release; do
- open_tag FileConfiguration \
- Name="${cfg}|${plat}" \
-
- tag Tool \
- Name="VCCustomBuildTool" \
- Description="Assembling \$(InputFileName)" \
- CommandLine="$(eval echo \$asm_${cfg}_cmdline) -o \$(IntDir)\\$objf" \
- Outputs="\$(IntDir)\\$objf" \
-
- close_tag FileConfiguration
- done
- done
- fi
- if [ "$pat" == "c" ] || \
- [ "$pat" == "cc" ] || [ "$pat" == "cpp" ]; then
- for plat in "${platforms[@]}"; do
- for cfg in Debug Release; do
- open_tag FileConfiguration \
- Name="${cfg}|${plat}" \
-
- tag Tool \
- Name="VCCLCompilerTool" \
- ObjectFile="\$(IntDir)\\$objf" \
-
- close_tag FileConfiguration
- done
- done
- fi
- close_tag File
-
- break
- fi
- done
- done
-
- close_tag Filter
- IFS="$saveIFS"
-}
-
-# Process command line
-unset target
-for opt in "$@"; do
- optval="${opt#*=}"
- case "$opt" in
- --help|-h) show_help
- ;;
- --target=*) target="${optval}"
- ;;
- --out=*) outfile="$optval"
- ;;
- --name=*) name="${optval}"
- ;;
- --proj-guid=*) guid="${optval}"
- ;;
- --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}"
- ;;
- --exe) proj_kind="exe"
- ;;
- --dll) proj_kind="dll"
- ;;
- --lib) proj_kind="lib"
- ;;
- --src-path-bare=*) src_path_bare="$optval"
- ;;
- --static-crt) use_static_runtime=true
- ;;
- --ver=*)
- vs_ver="$optval"
- case "$optval" in
- [789])
- ;;
- *) die Unrecognized Visual Studio Version in $opt
- ;;
- esac
- ;;
- -I*)
- opt="${opt%/}"
- incs="${incs}${incs:+;}&quot;${opt##-I}&quot;"
- yasmincs="${yasmincs} ${opt}"
- ;;
- -D*) defines="${defines}${defines:+;}${opt##-D}"
- ;;
- -L*) # fudge . to $(OutDir)
- if [ "${opt##-L}" == "." ]; then
- libdirs="${libdirs}${libdirs:+;}&quot;\$(OutDir)&quot;"
- else
- # Also try directories for this platform/configuration
- libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}&quot;"
- libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)/\$(ConfigurationName)&quot;"
- libdirs="${libdirs}${libdirs:+;}&quot;${opt##-L}/\$(PlatformName)&quot;"
- fi
- ;;
- -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
- ;;
- -*) die_unknown $opt
- ;;
- *)
- file_list[${#file_list[@]}]="$opt"
- case "$opt" in
- *.asm) uses_asm=true
- ;;
- esac
- ;;
- esac
-done
-outfile=${outfile:-/dev/stdout}
-guid=${guid:-`generate_uuid`}
-asm_use_custom_step=false
-uses_asm=${uses_asm:-false}
-case "${vs_ver:-8}" in
- 7) vs_ver_id="7.10"
- asm_use_custom_step=$uses_asm
- warn_64bit='Detect64BitPortabilityProblems=true'
- ;;
- 8) vs_ver_id="8.00"
- asm_use_custom_step=$uses_asm
- warn_64bit='Detect64BitPortabilityProblems=true'
- ;;
- 9) vs_ver_id="9.00"
- asm_use_custom_step=$uses_asm
- warn_64bit='Detect64BitPortabilityProblems=false'
- ;;
-esac
-
-[ -n "$name" ] || die "Project name (--name) must be specified!"
-[ -n "$target" ] || die "Target (--target) must be specified!"
-
-if ${use_static_runtime:-false}; then
- release_runtime=0
- debug_runtime=1
- lib_sfx=mt
-else
- release_runtime=2
- debug_runtime=3
- lib_sfx=md
-fi
-
-# Calculate debug lib names: If a lib ends in ${lib_sfx}.lib, then rename
-# it to ${lib_sfx}d.lib. This precludes linking to release libs from a
-# debug exe, so this may need to be refactored later.
-for lib in ${libs}; do
- if [ "$lib" != "${lib%${lib_sfx}.lib}" ]; then
- lib=${lib%.lib}d.lib
- fi
- debug_libs="${debug_libs}${debug_libs:+ }${lib}"
-done
-
-
-# List Keyword for this target
-case "$target" in
- x86*) keyword="ManagedCProj"
- ;;
- *) die "Unsupported target $target!"
-esac
-
-# List of all platforms supported for this target
-case "$target" in
- x86_64*)
- platforms[0]="x64"
- asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
- asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
- ;;
- x86*)
- platforms[0]="Win32"
- asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
- asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
- ;;
- *) die "Unsupported target $target!"
- ;;
-esac
-
-generate_vcproj() {
- case "$proj_kind" in
- exe) vs_ConfigurationType=1
- ;;
- dll) vs_ConfigurationType=2
- ;;
- *) vs_ConfigurationType=4
- ;;
- esac
-
- echo "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>"
- open_tag VisualStudioProject \
- ProjectType="Visual C++" \
- Version="${vs_ver_id}" \
- Name="${name}" \
- ProjectGUID="{${guid}}" \
- RootNamespace="${name}" \
- Keyword="${keyword}" \
-
- open_tag Platforms
- for plat in "${platforms[@]}"; do
- tag Platform Name="$plat"
- done
- close_tag Platforms
-
- open_tag Configurations
- for plat in "${platforms[@]}"; do
- plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'`
- open_tag Configuration \
- Name="Debug|$plat" \
- OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
- IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
- ConfigurationType="$vs_ConfigurationType" \
- CharacterSet="1" \
-
- case "$target" in
- x86*)
- case "$name" in
- obj_int_extract)
- tag Tool \
- Name="VCCLCompilerTool" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" \
- RuntimeLibrary="$debug_runtime" \
- WarningLevel="3" \
- DebugInformationFormat="1" \
- $warn_64bit \
- ;;
- vpx)
- tag Tool \
- Name="VCPreBuildEventTool" \
- CommandLine="call obj_int_extract.bat $src_path_bare $plat_no_ws\\\$(ConfigurationName)" \
-
- tag Tool \
- Name="VCCLCompilerTool" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
- RuntimeLibrary="$debug_runtime" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="2" \
- $warn_64bit \
-
- $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="true"
- ;;
- *)
- tag Tool \
- Name="VCCLCompilerTool" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
- RuntimeLibrary="$debug_runtime" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="2" \
- $warn_64bit \
-
- $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="true"
- ;;
- esac
- ;;
- esac
-
- case "$proj_kind" in
- exe)
- case "$target" in
- x86*)
- case "$name" in
- obj_int_extract)
- tag Tool \
- Name="VCLinkerTool" \
- GenerateDebugInformation="true" \
- ;;
- *)
- tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="$debug_libs \$(NoInherit)" \
- AdditionalLibraryDirectories="$libdirs" \
- GenerateDebugInformation="true" \
- ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
- ;;
- esac
- ;;
- esac
- ;;
- lib)
- case "$target" in
- x86*)
- tag Tool \
- Name="VCLibrarianTool" \
- OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
-
- ;;
- esac
- ;;
- dll)
- tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="\$(NoInherit)" \
- LinkIncremental="2" \
- GenerateDebugInformation="true" \
- AssemblyDebug="1" \
- TargetMachine="1" \
- $link_opts \
-
- ;;
- esac
-
- close_tag Configuration
-
- open_tag Configuration \
- Name="Release|$plat" \
- OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
- IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
- ConfigurationType="$vs_ConfigurationType" \
- CharacterSet="1" \
- WholeProgramOptimization="0" \
-
- case "$target" in
- x86*)
- case "$name" in
- obj_int_extract)
- tag Tool \
- Name="VCCLCompilerTool" \
- Optimization="2" \
- FavorSizeorSpeed="1" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" \
- RuntimeLibrary="$release_runtime" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="0" \
- $warn_64bit \
- ;;
- vpx)
- tag Tool \
- Name="VCPreBuildEventTool" \
- CommandLine="call obj_int_extract.bat $src_path_bare $plat_no_ws\\\$(ConfigurationName)" \
-
- tag Tool \
- Name="VCCLCompilerTool" \
- Optimization="2" \
- FavorSizeorSpeed="1" \
- AdditionalIncludeDirectories="$incs" \
- PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
- RuntimeLibrary="$release_runtime" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="0" \
- $warn_64bit \
-
- $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
- ;;
- *)
- tag Tool \
- Name="VCCLCompilerTool" \
- AdditionalIncludeDirectories="$incs" \
- Optimization="2" \
- FavorSizeorSpeed="1" \
- PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
- RuntimeLibrary="$release_runtime" \
- UsePrecompiledHeader="0" \
- WarningLevel="3" \
- DebugInformationFormat="0" \
- $warn_64bit \
-
- $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
- ;;
- esac
- ;;
- esac
-
- case "$proj_kind" in
- exe)
- case "$target" in
- x86*)
- case "$name" in
- obj_int_extract)
- tag Tool \
- Name="VCLinkerTool" \
- GenerateDebugInformation="true" \
- ;;
- *)
- tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="$libs \$(NoInherit)" \
- AdditionalLibraryDirectories="$libdirs" \
-
- ;;
- esac
- ;;
- esac
- ;;
- lib)
- case "$target" in
- x86*)
- tag Tool \
- Name="VCLibrarianTool" \
- OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
-
- ;;
- esac
- ;;
- dll) # note differences to debug version: LinkIncremental, AssemblyDebug
- tag Tool \
- Name="VCLinkerTool" \
- AdditionalDependencies="\$(NoInherit)" \
- LinkIncremental="1" \
- GenerateDebugInformation="true" \
- TargetMachine="1" \
- $link_opts \
-
- ;;
- esac
-
- close_tag Configuration
- done
- close_tag Configurations
-
- open_tag Files
- generate_filter srcs "Source Files" "c;cc;cpp;def;odl;idl;hpj;bat;asm;asmx"
- generate_filter hdrs "Header Files" "h;hm;inl;inc;xsd"
- generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- generate_filter resrcs "Build Files" "mk"
- close_tag Files
-
- tag Globals
- close_tag VisualStudioProject
-
- # This must be done from within the {} subshell
- echo "Ignored files list (${#file_list[@]} items) is:" >&2
- for f in "${file_list[@]}"; do
- echo " $f" >&2
- done
-}
-
-generate_vcproj |
- sed -e '/"/s;\([^ "]\)/;\1\\;g' > ${outfile}
-
-exit
-<!--
-TODO: Add any files not captured by filters.
- <File
- RelativePath=".\ReadMe.txt"
- >
- </File>
--->
diff --git a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_sln.sh b/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_sln.sh
deleted file mode 100644
index ffa3706..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_sln.sh
+++ /dev/null
@@ -1,324 +0,0 @@
-#!/bin/bash
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-self=$0
-self_basename=${self##*/}
-EOL=$'\n'
-EOLDOS=$'\r'
-
-show_help() {
- cat <<EOF
-Usage: ${self_basename} [options] file1 [file2 ...]
-
-This script generates a Visual Studio 2005 solution file from a list of project
-files.
-
-Options:
- --help Print this message
- --out=outfile Redirect output to a file
- --ver=version Version (7,8,9,10,11) of visual studio to generate for
- --target=isa-os-cc Target specifier
-EOF
- exit 1
-}
-
-die() {
- echo "${self_basename}: $@" >&2
- [ -f "${outfile}" ] && rm -f ${outfile}{,.mk}
- exit 1
-}
-
-die_unknown(){
- echo "Unknown option \"$1\"." >&2
- echo "See ${self_basename} --help for available options." >&2
- [ -f "${outfile}" ] && rm -f ${outfile}{,.mk}
- exit 1
-}
-
-indent1=$'\t'
-indent=""
-indent_push() {
- indent="${indent}${indent1}"
-}
-indent_pop() {
- indent="${indent%${indent1}}"
-}
-
-parse_project() {
- local file=$1
- if [ "$sfx" = "vcproj" ]; then
- local name=`grep Name "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
- local guid=`grep ProjectGUID "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
- else
- local name=`grep RootNamespace "$file" | sed 's,.*<.*>\(.*\)</.*>.*,\1,'`
- local guid=`grep ProjectGuid "$file" | sed 's,.*<.*>\(.*\)</.*>.*,\1,'`
- fi
-
- # save the project GUID to a varaible, normalizing to the basename of the
- # vcproj file without the extension
- local var
- var=${file##*/}
- var=${var%%.${sfx}}
- eval "${var}_file=\"$1\""
- eval "${var}_name=$name"
- eval "${var}_guid=$guid"
-
- if [ "$sfx" = "vcproj" ]; then
- cur_config_list=`grep -A1 '<Configuration' $file |
- grep Name | cut -d\" -f2`
- else
- cur_config_list=`grep -B1 'Label="Configuration"' $file |
- grep Condition | cut -d\' -f4`
- fi
- new_config_list=$(for i in $config_list $cur_config_list; do
- echo $i
- done | sort | uniq)
- if [ "$config_list" != "" ] && [ "$config_list" != "$new_config_list" ]; then
- mixed_platforms=1
- fi
- config_list="$new_config_list"
- eval "${var}_config_list=\"$cur_config_list\""
- proj_list="${proj_list} ${var}"
-}
-
-process_project() {
- eval "local file=\${$1_file}"
- eval "local name=\${$1_name}"
- eval "local guid=\${$1_guid}"
-
- # save the project GUID to a varaible, normalizing to the basename of the
- # vcproj file without the extension
- local var
- var=${file##*/}
- var=${var%%.${sfx}}
- eval "${var}_guid=$guid"
-
- echo "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"$name\", \"$file\", \"$guid\""
- indent_push
-
- eval "local deps=\"\${${var}_deps}\""
- if [ -n "$deps" ] && [ "$sfx" = "vcproj" ]; then
- echo "${indent}ProjectSection(ProjectDependencies) = postProject"
- indent_push
-
- for dep in $deps; do
- eval "local dep_guid=\${${dep}_guid}"
- [ -z "${dep_guid}" ] && die "Unknown GUID for $dep (dependency of $var)"
- echo "${indent}$dep_guid = $dep_guid"
- done
-
- indent_pop
- echo "${indent}EndProjectSection"
-
- fi
-
- indent_pop
- echo "EndProject"
-}
-
-process_global() {
- echo "Global"
- indent_push
-
- #
- # Solution Configuration Platforms
- #
- echo "${indent}GlobalSection(SolutionConfigurationPlatforms) = preSolution"
- indent_push
- IFS_bak=${IFS}
- IFS=$'\r'$'\n'
- if [ "$mixed_platforms" != "" ]; then
- config_list="
-Release|Mixed Platforms
-Debug|Mixed Platforms"
- fi
- for config in ${config_list}; do
- echo "${indent}$config = $config"
- done
- IFS=${IFS_bak}
- indent_pop
- echo "${indent}EndGlobalSection"
-
- #
- # Project Configuration Platforms
- #
- echo "${indent}GlobalSection(ProjectConfigurationPlatforms) = postSolution"
- indent_push
- for proj in ${proj_list}; do
- eval "local proj_guid=\${${proj}_guid}"
- eval "local proj_config_list=\${${proj}_config_list}"
- IFS=$'\r'$'\n'
- for config in ${proj_config_list}; do
- if [ "$mixed_platforms" != "" ]; then
- local c=${config%%|*}
- echo "${indent}${proj_guid}.${c}|Mixed Platforms.ActiveCfg = ${config}"
- echo "${indent}${proj_guid}.${c}|Mixed Platforms.Build.0 = ${config}"
- else
- echo "${indent}${proj_guid}.${config}.ActiveCfg = ${config}"
- echo "${indent}${proj_guid}.${config}.Build.0 = ${config}"
- fi
-
- done
- IFS=${IFS_bak}
- done
- indent_pop
- echo "${indent}EndGlobalSection"
-
- #
- # Solution Properties
- #
- echo "${indent}GlobalSection(SolutionProperties) = preSolution"
- indent_push
- echo "${indent}HideSolutionNode = FALSE"
- indent_pop
- echo "${indent}EndGlobalSection"
-
- indent_pop
- echo "EndGlobal"
-}
-
-process_makefile() {
- IFS_bak=${IFS}
- IFS=$'\r'$'\n'
- local TAB=$'\t'
- cat <<EOF
-ifeq (\$(CONFIG_VS_VERSION),7)
-MSBUILD_TOOL := devenv.com
-else
-MSBUILD_TOOL := msbuild.exe
-endif
-found_devenv := \$(shell which \$(MSBUILD_TOOL) >/dev/null 2>&1 && echo yes)
-.nodevenv.once:
-${TAB}@echo " * \$(MSBUILD_TOOL) not found in path."
-${TAB}@echo " * "
-${TAB}@echo " * You will have to build all configurations manually using the"
-${TAB}@echo " * Visual Studio IDE. To allow make to build them automatically,"
-${TAB}@echo " * add the Common7/IDE directory of your Visual Studio"
-${TAB}@echo " * installation to your path, eg:"
-${TAB}@echo " * C:\Program Files\Microsoft Visual Studio 8\Common7\IDE"
-${TAB}@echo " * "
-${TAB}@touch \$@
-CLEAN-OBJS += \$(if \$(found_devenv),,.nodevenv.once)
-
-EOF
-
- for sln_config in ${config_list}; do
- local config=${sln_config%%|*}
- local platform=${sln_config##*|}
- local nows_sln_config=`echo $sln_config | sed -e 's/[^a-zA-Z0-9]/_/g'`
- cat <<EOF
-BUILD_TARGETS += \$(if \$(NO_LAUNCH_DEVENV),,$nows_sln_config)
-clean::
-${TAB}rm -rf "$platform"/"$config"
-.PHONY: $nows_sln_config
-ifneq (\$(found_devenv),)
- ifeq (\$(CONFIG_VS_VERSION),7)
-$nows_sln_config: $outfile
-${TAB}\$(MSBUILD_TOOL) $outfile -build "$config"
-
- else
-$nows_sln_config: $outfile
-${TAB}\$(MSBUILD_TOOL) $outfile -m -t:Build \\
-${TAB}${TAB}-p:Configuration="$config" -p:Platform="$platform"
-
- endif
-else
-$nows_sln_config: $outfile .nodevenv.once
-${TAB}@echo " * Skipping build of $sln_config (\$(MSBUILD_TOOL) not in path)."
-${TAB}@echo " * "
-endif
-
-EOF
- done
- IFS=${IFS_bak}
-}
-
-# Process command line
-outfile=/dev/stdout
-for opt in "$@"; do
- optval="${opt#*=}"
- case "$opt" in
- --help|-h) show_help
- ;;
- --out=*) outfile="${optval}"; mkoutfile="${optval}".mk
- ;;
- --dep=*) eval "${optval%%:*}_deps=\"\${${optval%%:*}_deps} ${optval##*:}\""
- ;;
- --ver=*) vs_ver="$optval"
- case $optval in
- [789]|10|11|12)
- ;;
- *) die Unrecognized Visual Studio Version in $opt
- ;;
- esac
- ;;
- --ver=*) vs_ver="$optval"
- case $optval in
- 7) sln_vers="8.00"
- sln_vers_str="Visual Studio .NET 2003"
- ;;
- [89])
- ;;
- *) die "Unrecognized Visual Studio Version '$optval' in $opt"
- ;;
- esac
- ;;
- --target=*) target="${optval}"
- ;;
- -*) die_unknown $opt
- ;;
- *) file_list[${#file_list[@]}]="$opt"
- esac
-done
-outfile=${outfile:-/dev/stdout}
-mkoutfile=${mkoutfile:-/dev/stdout}
-case "${vs_ver:-8}" in
- 7) sln_vers="8.00"
- sln_vers_str="Visual Studio .NET 2003"
- ;;
- 8) sln_vers="9.00"
- sln_vers_str="Visual Studio 2005"
- ;;
- 9) sln_vers="10.00"
- sln_vers_str="Visual Studio 2008"
- ;;
- 10) sln_vers="11.00"
- sln_vers_str="Visual Studio 2010"
- ;;
- 11) sln_vers="12.00"
- sln_vers_str="Visual Studio 2012"
- ;;
- 12) sln_vers="12.00"
- sln_vers_str="Visual Studio 2013"
- ;;
-esac
-case "${vs_ver:-8}" in
- [789])
- sfx=vcproj
- ;;
- 10|11|12)
- sfx=vcxproj
- ;;
-esac
-
-for f in "${file_list[@]}"; do
- parse_project $f
-done
-cat >${outfile} <<EOF
-Microsoft Visual Studio Solution File, Format Version $sln_vers${EOLDOS}
-# $sln_vers_str${EOLDOS}
-EOF
-for proj in ${proj_list}; do
- process_project $proj >>${outfile}
-done
-process_global >>${outfile}
-process_makefile >${mkoutfile}
diff --git a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_vcxproj.sh b/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_vcxproj.sh
deleted file mode 100644
index 23990a4..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/gen_msvs_vcxproj.sh
+++ /dev/null
@@ -1,563 +0,0 @@
-#!/bin/bash
-##
-## Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-self=$0
-self_basename=${self##*/}
-self_dirname=$(dirname "$0")
-EOL=$'\n'
-
-show_help() {
- cat <<EOF
-Usage: ${self_basename} --name=projname [options] file1 [file2 ...]
-
-This script generates a Visual Studio project file from a list of source
-code files.
-
-Options:
- --help Print this message
- --exe Generate a project for building an Application
- --lib Generate a project for creating a static library
- --dll Generate a project for creating a dll
- --static-crt Use the static C runtime (/MT)
- --enable-werror Treat warnings as errors (/WX)
- --target=isa-os-cc Target specifier (required)
- --out=filename Write output to a file [stdout]
- --name=project_name Name of the project (required)
- --proj-guid=GUID GUID to use for the project
- --module-def=filename File containing export definitions (for DLLs)
- --ver=version Version (10,11,12) of visual studio to generate for
- --src-path-bare=dir Path to root of source tree
- -Ipath/to/include Additional include directories
- -DFLAG[=value] Preprocessor macros to define
- -Lpath/to/lib Additional library search paths
- -llibname Library to link against
-EOF
- exit 1
-}
-
-die() {
- echo "${self_basename}: $@" >&2
- exit 1
-}
-
-die_unknown(){
- echo "Unknown option \"$1\"." >&2
- echo "See ${self_basename} --help for available options." >&2
- exit 1
-}
-
-generate_uuid() {
- local hex="0123456789ABCDEF"
- local i
- local uuid=""
- local j
- #93995380-89BD-4b04-88EB-625FBE52EBFB
- for ((i=0; i<32; i++)); do
- (( j = $RANDOM % 16 ))
- uuid="${uuid}${hex:$j:1}"
- done
- echo "${uuid:0:8}-${uuid:8:4}-${uuid:12:4}-${uuid:16:4}-${uuid:20:12}"
-}
-
-indent1=" "
-indent=""
-indent_push() {
- indent="${indent}${indent1}"
-}
-indent_pop() {
- indent="${indent%${indent1}}"
-}
-
-tag_attributes() {
- for opt in "$@"; do
- optval="${opt#*=}"
- [ -n "${optval}" ] ||
- die "Missing attribute value in '$opt' while generating $tag tag"
- echo "${indent}${opt%%=*}=\"${optval}\""
- done
-}
-
-open_tag() {
- local tag=$1
- shift
- if [ $# -ne 0 ]; then
- echo "${indent}<${tag}"
- indent_push
- tag_attributes "$@"
- echo "${indent}>"
- else
- echo "${indent}<${tag}>"
- indent_push
- fi
-}
-
-close_tag() {
- local tag=$1
- indent_pop
- echo "${indent}</${tag}>"
-}
-
-tag() {
- local tag=$1
- shift
- if [ $# -ne 0 ]; then
- echo "${indent}<${tag}"
- indent_push
- tag_attributes "$@"
- indent_pop
- echo "${indent}/>"
- else
- echo "${indent}<${tag}/>"
- fi
-}
-
-tag_content() {
- local tag=$1
- local content=$2
- shift
- shift
- if [ $# -ne 0 ]; then
- echo "${indent}<${tag}"
- indent_push
- tag_attributes "$@"
- echo "${indent}>${content}</${tag}>"
- indent_pop
- else
- echo "${indent}<${tag}>${content}</${tag}>"
- fi
-}
-
-generate_filter() {
- local name=$1
- local pats=$2
- local file_list_sz
- local i
- local f
- local saveIFS="$IFS"
- local pack
- echo "generating filter '$name' from ${#file_list[@]} files" >&2
- IFS=*
-
- file_list_sz=${#file_list[@]}
- for i in ${!file_list[@]}; do
- f=${file_list[i]}
- for pat in ${pats//;/$IFS}; do
- if [ "${f##*.}" == "$pat" ]; then
- unset file_list[i]
-
- objf=$(echo ${f%.*}.obj | sed -e 's/^[\./]\+//g' -e 's,/,_,g')
-
- if ([ "$pat" == "asm" ] || [ "$pat" == "s" ]) && $asm_use_custom_step; then
- # Avoid object file name collisions, i.e. vpx_config.c and
- # vpx_config.asm produce the same object file without
- # this additional suffix.
- objf=${objf%.obj}_asm.obj
- open_tag CustomBuild \
- Include=".\\$f"
- for plat in "${platforms[@]}"; do
- for cfg in Debug Release; do
- tag_content Message "Assembling %(Filename)%(Extension)" \
- Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
- tag_content Command "$(eval echo \$asm_${cfg}_cmdline) -o \$(IntDir)$objf" \
- Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
- tag_content Outputs "\$(IntDir)$objf" \
- Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
- done
- done
- close_tag CustomBuild
- elif [ "$pat" == "c" ] || \
- [ "$pat" == "cc" ] || [ "$pat" == "cpp" ]; then
- open_tag ClCompile \
- Include=".\\$f"
- # Separate file names with Condition?
- tag_content ObjectFileName "\$(IntDir)$objf"
- # Check for AVX and turn it on to avoid warnings.
- if [[ $f =~ avx.?\.c$ ]]; then
- tag_content AdditionalOptions "/arch:AVX"
- fi
- close_tag ClCompile
- elif [ "$pat" == "h" ] ; then
- tag ClInclude \
- Include=".\\$f"
- elif [ "$pat" == "vcxproj" ] ; then
- open_tag ProjectReference \
- Include="$f"
- depguid=`grep ProjectGuid "$f" | sed 's,.*<.*>\(.*\)</.*>.*,\1,'`
- tag_content Project "$depguid"
- tag_content ReferenceOutputAssembly false
- close_tag ProjectReference
- else
- tag None \
- Include=".\\$f"
- fi
-
- break
- fi
- done
- done
-
- IFS="$saveIFS"
-}
-
-# Process command line
-unset target
-for opt in "$@"; do
- optval="${opt#*=}"
- case "$opt" in
- --help|-h) show_help
- ;;
- --target=*) target="${optval}"
- ;;
- --out=*) outfile="$optval"
- ;;
- --name=*) name="${optval}"
- ;;
- --proj-guid=*) guid="${optval}"
- ;;
- --module-def=*) module_def="${optval}"
- ;;
- --exe) proj_kind="exe"
- ;;
- --dll) proj_kind="dll"
- ;;
- --lib) proj_kind="lib"
- ;;
- --src-path-bare=*) src_path_bare="$optval"
- ;;
- --static-crt) use_static_runtime=true
- ;;
- --enable-werror) werror=true
- ;;
- --ver=*)
- vs_ver="$optval"
- case "$optval" in
- 10|11|12)
- ;;
- *) die Unrecognized Visual Studio Version in $opt
- ;;
- esac
- ;;
- -I*)
- opt="${opt%/}"
- incs="${incs}${incs:+;}${opt##-I}"
- yasmincs="${yasmincs} ${opt}"
- ;;
- -D*) defines="${defines}${defines:+;}${opt##-D}"
- ;;
- -L*) # fudge . to $(OutDir)
- if [ "${opt##-L}" == "." ]; then
- libdirs="${libdirs}${libdirs:+;}\$(OutDir)"
- else
- # Also try directories for this platform/configuration
- libdirs="${libdirs}${libdirs:+;}${opt##-L}"
- libdirs="${libdirs}${libdirs:+;}${opt##-L}/\$(PlatformName)/\$(Configuration)"
- libdirs="${libdirs}${libdirs:+;}${opt##-L}/\$(PlatformName)"
- fi
- ;;
- -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
- ;;
- -*) die_unknown $opt
- ;;
- *)
- file_list[${#file_list[@]}]="$opt"
- case "$opt" in
- *.asm|*.s) uses_asm=true
- ;;
- esac
- ;;
- esac
-done
-outfile=${outfile:-/dev/stdout}
-guid=${guid:-`generate_uuid`}
-asm_use_custom_step=false
-uses_asm=${uses_asm:-false}
-case "${vs_ver:-11}" in
- 10|11|12)
- asm_use_custom_step=$uses_asm
- ;;
-esac
-
-[ -n "$name" ] || die "Project name (--name) must be specified!"
-[ -n "$target" ] || die "Target (--target) must be specified!"
-
-if ${use_static_runtime:-false}; then
- release_runtime=MultiThreaded
- debug_runtime=MultiThreadedDebug
- lib_sfx=mt
-else
- release_runtime=MultiThreadedDLL
- debug_runtime=MultiThreadedDebugDLL
- lib_sfx=md
-fi
-
-# Calculate debug lib names: If a lib ends in ${lib_sfx}.lib, then rename
-# it to ${lib_sfx}d.lib. This precludes linking to release libs from a
-# debug exe, so this may need to be refactored later.
-for lib in ${libs}; do
- if [ "$lib" != "${lib%${lib_sfx}.lib}" ]; then
- lib=${lib%.lib}d.lib
- fi
- debug_libs="${debug_libs}${debug_libs:+ }${lib}"
-done
-debug_libs=${debug_libs// /;}
-libs=${libs// /;}
-
-
-# List of all platforms supported for this target
-case "$target" in
- x86_64*)
- platforms[0]="x64"
- asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
- asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
- ;;
- x86*)
- platforms[0]="Win32"
- asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
- asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;%(FullPath)&quot;"
- ;;
- arm*)
- asm_Debug_cmdline="armasm -nologo &quot;%(FullPath)&quot;"
- asm_Release_cmdline="armasm -nologo &quot;%(FullPath)&quot;"
- if [ "$name" = "obj_int_extract" ]; then
- # We don't want to build this tool for the target architecture,
- # but for an architecture we can run locally during the build.
- platforms[0]="Win32"
- else
- platforms[0]="ARM"
- fi
- ;;
- *) die "Unsupported target $target!"
- ;;
-esac
-
-generate_vcxproj() {
- echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
- open_tag Project \
- DefaultTargets="Build" \
- ToolsVersion="4.0" \
- xmlns="http://schemas.microsoft.com/developer/msbuild/2003" \
-
- open_tag ItemGroup \
- Label="ProjectConfigurations"
- for plat in "${platforms[@]}"; do
- for config in Debug Release; do
- open_tag ProjectConfiguration \
- Include="$config|$plat"
- tag_content Configuration $config
- tag_content Platform $plat
- close_tag ProjectConfiguration
- done
- done
- close_tag ItemGroup
-
- open_tag PropertyGroup \
- Label="Globals"
- tag_content ProjectGuid "{${guid}}"
- tag_content RootNamespace ${name}
- tag_content Keyword ManagedCProj
- close_tag PropertyGroup
-
- tag Import \
- Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props"
-
- for plat in "${platforms[@]}"; do
- for config in Release Debug; do
- open_tag PropertyGroup \
- Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'" \
- Label="Configuration"
- if [ "$proj_kind" = "exe" ]; then
- tag_content ConfigurationType Application
- elif [ "$proj_kind" = "dll" ]; then
- tag_content ConfigurationType DynamicLibrary
- else
- tag_content ConfigurationType StaticLibrary
- fi
- if [ "$vs_ver" = "11" ]; then
- if [ "$plat" = "ARM" ]; then
- # Setting the wp80 toolchain automatically sets the
- # WINAPI_FAMILY define, which is required for building
- # code for arm with the windows headers. Alternatively,
- # one could add AppContainerApplication=true in the Globals
- # section and add PrecompiledHeader=NotUsing and
- # CompileAsWinRT=false in ClCompile and SubSystem=Console
- # in Link.
- tag_content PlatformToolset v110_wp80
- else
- tag_content PlatformToolset v110
- fi
- fi
- if [ "$vs_ver" = "12" ]; then
- if [ "$plat" = "ARM" ]; then
- # Setting the wp80 toolchain automatically sets the
- # WINAPI_FAMILY define, which is required for building
- # code for arm with the windows headers. Alternatively,
- # one could add AppContainerApplication=true in the Globals
- # section and add PrecompiledHeader=NotUsing and
- # CompileAsWinRT=false in ClCompile and SubSystem=Console
- # in Link.
- tag_content PlatformToolset v120_wp80
- else
- tag_content PlatformToolset v120
- fi
- fi
- tag_content CharacterSet Unicode
- if [ "$config" = "Release" ]; then
- tag_content WholeProgramOptimization true
- fi
- close_tag PropertyGroup
- done
- done
-
- tag Import \
- Project="\$(VCTargetsPath)\\Microsoft.Cpp.props"
-
- open_tag ImportGroup \
- Label="PropertySheets"
- tag Import \
- Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" \
- Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" \
- Label="LocalAppDataPlatform"
- close_tag ImportGroup
-
- tag PropertyGroup \
- Label="UserMacros"
-
- for plat in "${platforms[@]}"; do
- plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'`
- for config in Debug Release; do
- open_tag PropertyGroup \
- Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'"
- tag_content OutDir "\$(SolutionDir)$plat_no_ws\\\$(Configuration)\\"
- tag_content IntDir "$plat_no_ws\\\$(Configuration)\\${name}\\"
- if [ "$proj_kind" == "lib" ]; then
- if [ "$config" == "Debug" ]; then
- config_suffix=d
- else
- config_suffix=""
- fi
- tag_content TargetName "${name}${lib_sfx}${config_suffix}"
- fi
- close_tag PropertyGroup
- done
- done
-
- for plat in "${platforms[@]}"; do
- for config in Debug Release; do
- open_tag ItemDefinitionGroup \
- Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'"
- if [ "$name" == "vpx" ]; then
- hostplat=$plat
- if [ "$hostplat" == "ARM" ]; then
- hostplat=Win32
- fi
- open_tag PreBuildEvent
- tag_content Command "call obj_int_extract.bat $src_path_bare $hostplat\\\$(Configuration)"
- close_tag PreBuildEvent
- fi
- open_tag ClCompile
- if [ "$config" = "Debug" ]; then
- opt=Disabled
- runtime=$debug_runtime
- curlibs=$debug_libs
- case "$name" in
- obj_int_extract)
- debug=DEBUG
- ;;
- *)
- debug=_DEBUG
- ;;
- esac
- else
- opt=MaxSpeed
- runtime=$release_runtime
- curlibs=$libs
- tag_content FavorSizeOrSpeed Speed
- debug=NDEBUG
- fi
- case "$name" in
- obj_int_extract)
- extradefines=";_CONSOLE"
- ;;
- *)
- extradefines=";$defines"
- ;;
- esac
- tag_content Optimization $opt
- tag_content AdditionalIncludeDirectories "$incs;%(AdditionalIncludeDirectories)"
- tag_content PreprocessorDefinitions "WIN32;$debug;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE$extradefines;%(PreprocessorDefinitions)"
- tag_content RuntimeLibrary $runtime
- tag_content WarningLevel Level3
- if ${werror:-false}; then
- tag_content TreatWarningAsError true
- fi
- close_tag ClCompile
- case "$proj_kind" in
- exe)
- open_tag Link
- if [ "$name" != "obj_int_extract" ]; then
- tag_content AdditionalDependencies "$curlibs"
- tag_content AdditionalLibraryDirectories "$libdirs;%(AdditionalLibraryDirectories)"
- fi
- tag_content GenerateDebugInformation true
- close_tag Link
- ;;
- dll)
- open_tag Link
- tag_content GenerateDebugInformation true
- tag_content ModuleDefinitionFile $module_def
- close_tag Link
- ;;
- lib)
- ;;
- esac
- close_tag ItemDefinitionGroup
- done
-
- done
-
- open_tag ItemGroup
- generate_filter "Source Files" "c;cc;cpp;def;odl;idl;hpj;bat;asm;asmx;s"
- close_tag ItemGroup
- open_tag ItemGroup
- generate_filter "Header Files" "h;hm;inl;inc;xsd"
- close_tag ItemGroup
- open_tag ItemGroup
- generate_filter "Build Files" "mk"
- close_tag ItemGroup
- open_tag ItemGroup
- generate_filter "References" "vcxproj"
- close_tag ItemGroup
-
- tag Import \
- Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets"
-
- open_tag ImportGroup \
- Label="ExtensionTargets"
- close_tag ImportGroup
-
- close_tag Project
-
- # This must be done from within the {} subshell
- echo "Ignored files list (${#file_list[@]} items) is:" >&2
- for f in "${file_list[@]}"; do
- echo " $f" >&2
- done
-}
-
-# This regexp doesn't catch most of the strings in the vcxproj format,
-# since they're like <tag>path</tag> instead of <tag attr="path" />
-# as previously. It still seems to work ok despite this.
-generate_vcxproj |
- sed -e '/"/s;\([^ "]\)/;\1\\;g' |
- sed -e '/xmlns/s;\\;/;g' > ${outfile}
-
-exit
diff --git a/videocodec/libvpx_internal/libvpx/build/make/obj_int_extract.c b/videocodec/libvpx_internal/libvpx/build/make/obj_int_extract.c
deleted file mode 100644
index 2e50f38..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/obj_int_extract.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vpx_config.h"
-#include "vpx/vpx_integer.h"
-
-typedef enum {
- OUTPUT_FMT_PLAIN,
- OUTPUT_FMT_RVDS,
- OUTPUT_FMT_GAS,
- OUTPUT_FMT_C_HEADER,
-} output_fmt_t;
-
-int log_msg(const char *fmt, ...) {
- int res;
- va_list ap;
- va_start(ap, fmt);
- res = vfprintf(stderr, fmt, ap);
- va_end(ap);
- return res;
-}
-
-#if defined(__GNUC__) && __GNUC__
-
-#if defined(FORCE_PARSE_ELF)
-
-#if defined(__MACH__)
-#undef __MACH__
-#endif
-
-#if !defined(__ELF__)
-#define __ELF__
-#endif
-#endif
-
-#if defined(__MACH__)
-
-#include <mach-o/loader.h>
-#include <mach-o/nlist.h>
-
-int print_macho_equ(output_fmt_t mode, uint8_t* name, int val) {
- switch (mode) {
- case OUTPUT_FMT_RVDS:
- printf("%-40s EQU %5d\n", name, val);
- return 0;
- case OUTPUT_FMT_GAS:
- printf(".set %-40s, %5d\n", name, val);
- return 0;
- case OUTPUT_FMT_C_HEADER:
- printf("#define %-40s %5d\n", name, val);
- return 0;
- default:
- log_msg("Unsupported mode: %d", mode);
- return 1;
- }
-}
-
-int parse_macho(uint8_t *base_buf, size_t sz, output_fmt_t mode) {
- int i, j;
- struct mach_header header;
- uint8_t *buf = base_buf;
- int base_data_section = 0;
- int bits = 0;
-
- /* We can read in mach_header for 32 and 64 bit architectures
- * because it's identical to mach_header_64 except for the last
- * element (uint32_t reserved), which we don't use. Then, when
- * we know which architecture we're looking at, increment buf
- * appropriately.
- */
- memcpy(&header, buf, sizeof(struct mach_header));
-
- if (header.magic == MH_MAGIC) {
- if (header.cputype == CPU_TYPE_ARM
- || header.cputype == CPU_TYPE_X86) {
- bits = 32;
- buf += sizeof(struct mach_header);
- } else {
- log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_[ARM|X86].\n");
- goto bail;
- }
- } else if (header.magic == MH_MAGIC_64) {
- if (header.cputype == CPU_TYPE_X86_64) {
- bits = 64;
- buf += sizeof(struct mach_header_64);
- } else {
- log_msg("Bad cputype for object file. Currently only tested for CPU_TYPE_X86_64.\n");
- goto bail;
- }
- } else {
- log_msg("Bad magic number for object file. 0x%x or 0x%x expected, 0x%x found.\n",
- MH_MAGIC, MH_MAGIC_64, header.magic);
- goto bail;
- }
-
- if (header.filetype != MH_OBJECT) {
- log_msg("Bad filetype for object file. Currently only tested for MH_OBJECT.\n");
- goto bail;
- }
-
- for (i = 0; i < header.ncmds; i++) {
- struct load_command lc;
-
- memcpy(&lc, buf, sizeof(struct load_command));
-
- if (lc.cmd == LC_SEGMENT) {
- uint8_t *seg_buf = buf;
- struct section s;
- struct segment_command seg_c;
-
- memcpy(&seg_c, seg_buf, sizeof(struct segment_command));
- seg_buf += sizeof(struct segment_command);
-
- /* Although each section is given it's own offset, nlist.n_value
- * references the offset of the first section. This isn't
- * apparent without debug information because the offset of the
- * data section is the same as the first section. However, with
- * debug sections mixed in, the offset of the debug section
- * increases but n_value still references the first section.
- */
- if (seg_c.nsects < 1) {
- log_msg("Not enough sections\n");
- goto bail;
- }
-
- memcpy(&s, seg_buf, sizeof(struct section));
- base_data_section = s.offset;
- } else if (lc.cmd == LC_SEGMENT_64) {
- uint8_t *seg_buf = buf;
- struct section_64 s;
- struct segment_command_64 seg_c;
-
- memcpy(&seg_c, seg_buf, sizeof(struct segment_command_64));
- seg_buf += sizeof(struct segment_command_64);
-
- /* Explanation in LG_SEGMENT */
- if (seg_c.nsects < 1) {
- log_msg("Not enough sections\n");
- goto bail;
- }
-
- memcpy(&s, seg_buf, sizeof(struct section_64));
- base_data_section = s.offset;
- } else if (lc.cmd == LC_SYMTAB) {
- if (base_data_section != 0) {
- struct symtab_command sc;
- uint8_t *sym_buf = base_buf;
- uint8_t *str_buf = base_buf;
-
- memcpy(&sc, buf, sizeof(struct symtab_command));
-
- if (sc.cmdsize != sizeof(struct symtab_command)) {
- log_msg("Can't find symbol table!\n");
- goto bail;
- }
-
- sym_buf += sc.symoff;
- str_buf += sc.stroff;
-
- for (j = 0; j < sc.nsyms; j++) {
- /* Location of string is cacluated each time from the
- * start of the string buffer. On darwin the symbols
- * are prefixed by "_", so we bump the pointer by 1.
- * The target value is defined as an int in *_asm_*_offsets.c,
- * which is 4 bytes on all targets we currently use.
- */
- if (bits == 32) {
- struct nlist nl;
- int val;
-
- memcpy(&nl, sym_buf, sizeof(struct nlist));
- sym_buf += sizeof(struct nlist);
-
- memcpy(&val, base_buf + base_data_section + nl.n_value,
- sizeof(val));
- print_macho_equ(mode, str_buf + nl.n_un.n_strx + 1, val);
- } else { /* if (bits == 64) */
- struct nlist_64 nl;
- int val;
-
- memcpy(&nl, sym_buf, sizeof(struct nlist_64));
- sym_buf += sizeof(struct nlist_64);
-
- memcpy(&val, base_buf + base_data_section + nl.n_value,
- sizeof(val));
- print_macho_equ(mode, str_buf + nl.n_un.n_strx + 1, val);
- }
- }
- }
- }
-
- buf += lc.cmdsize;
- }
-
- return 0;
-bail:
- return 1;
-
-}
-
-#elif defined(__ELF__)
-#include "elf.h"
-
-#define COPY_STRUCT(dst, buf, ofst, sz) do {\
- if(ofst + sizeof((*(dst))) > sz) goto bail;\
- memcpy(dst, buf+ofst, sizeof((*(dst))));\
- } while(0)
-
-#define ENDIAN_ASSIGN(val, memb) do {\
- if(!elf->le_data) {log_msg("Big Endian data not supported yet!\n");goto bail;}\
- (val) = (memb);\
- } while(0)
-
-#define ENDIAN_ASSIGN_IN_PLACE(memb) do {\
- ENDIAN_ASSIGN(memb, memb);\
- } while(0)
-
-typedef struct {
- uint8_t *buf; /* Buffer containing ELF data */
- size_t sz; /* Buffer size */
- int le_data; /* Data is little-endian */
- unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
- int bits; /* 32 or 64 */
- Elf32_Ehdr hdr32;
- Elf64_Ehdr hdr64;
-} elf_obj_t;
-
-int parse_elf_header(elf_obj_t *elf) {
- int res;
- /* Verify ELF Magic numbers */
- COPY_STRUCT(&elf->e_ident, elf->buf, 0, elf->sz);
- res = elf->e_ident[EI_MAG0] == ELFMAG0;
- res &= elf->e_ident[EI_MAG1] == ELFMAG1;
- res &= elf->e_ident[EI_MAG2] == ELFMAG2;
- res &= elf->e_ident[EI_MAG3] == ELFMAG3;
- res &= elf->e_ident[EI_CLASS] == ELFCLASS32
- || elf->e_ident[EI_CLASS] == ELFCLASS64;
- res &= elf->e_ident[EI_DATA] == ELFDATA2LSB;
-
- if (!res) goto bail;
-
- elf->le_data = elf->e_ident[EI_DATA] == ELFDATA2LSB;
-
- /* Read in relevant values */
- if (elf->e_ident[EI_CLASS] == ELFCLASS32) {
- elf->bits = 32;
- COPY_STRUCT(&elf->hdr32, elf->buf, 0, elf->sz);
-
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_type);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_machine);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_version);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_entry);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phoff);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shoff);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_flags);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_ehsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phentsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_phnum);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shentsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shnum);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr32.e_shstrndx);
- } else { /* if (elf->e_ident[EI_CLASS] == ELFCLASS64) */
- elf->bits = 64;
- COPY_STRUCT(&elf->hdr64, elf->buf, 0, elf->sz);
-
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_type);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_machine);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_version);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_entry);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phoff);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shoff);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_flags);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_ehsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phentsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_phnum);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shentsize);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shnum);
- ENDIAN_ASSIGN_IN_PLACE(elf->hdr64.e_shstrndx);
- }
-
- return 0;
-bail:
- log_msg("Failed to parse ELF file header");
- return 1;
-}
-
-int parse_elf_section(elf_obj_t *elf, int idx, Elf32_Shdr *hdr32, Elf64_Shdr *hdr64) {
- if (hdr32) {
- if (idx >= elf->hdr32.e_shnum)
- goto bail;
-
- COPY_STRUCT(hdr32, elf->buf, elf->hdr32.e_shoff + idx * elf->hdr32.e_shentsize,
- elf->sz);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_name);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_type);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_flags);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addr);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_offset);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_size);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_link);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_info);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_addralign);
- ENDIAN_ASSIGN_IN_PLACE(hdr32->sh_entsize);
- } else { /* if (hdr64) */
- if (idx >= elf->hdr64.e_shnum)
- goto bail;
-
- COPY_STRUCT(hdr64, elf->buf, elf->hdr64.e_shoff + idx * elf->hdr64.e_shentsize,
- elf->sz);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_name);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_type);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_flags);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addr);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_offset);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_size);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_link);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_info);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_addralign);
- ENDIAN_ASSIGN_IN_PLACE(hdr64->sh_entsize);
- }
-
- return 0;
-bail:
- return 1;
-}
-
-const char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) {
- if (elf->bits == 32) {
- Elf32_Shdr shdr;
-
- if (parse_elf_section(elf, s_idx, &shdr, NULL)) {
- log_msg("Failed to parse ELF string table: section %d, index %d\n",
- s_idx, idx);
- return "";
- }
-
- return (char *)(elf->buf + shdr.sh_offset + idx);
- } else { /* if (elf->bits == 64) */
- Elf64_Shdr shdr;
-
- if (parse_elf_section(elf, s_idx, NULL, &shdr)) {
- log_msg("Failed to parse ELF string table: section %d, index %d\n",
- s_idx, idx);
- return "";
- }
-
- return (char *)(elf->buf + shdr.sh_offset + idx);
- }
-}
-
-int parse_elf_symbol(elf_obj_t *elf, unsigned int ofst, Elf32_Sym *sym32, Elf64_Sym *sym64) {
- if (sym32) {
- COPY_STRUCT(sym32, elf->buf, ofst, elf->sz);
- ENDIAN_ASSIGN_IN_PLACE(sym32->st_name);
- ENDIAN_ASSIGN_IN_PLACE(sym32->st_value);
- ENDIAN_ASSIGN_IN_PLACE(sym32->st_size);
- ENDIAN_ASSIGN_IN_PLACE(sym32->st_info);
- ENDIAN_ASSIGN_IN_PLACE(sym32->st_other);
- ENDIAN_ASSIGN_IN_PLACE(sym32->st_shndx);
- } else { /* if (sym64) */
- COPY_STRUCT(sym64, elf->buf, ofst, elf->sz);
- ENDIAN_ASSIGN_IN_PLACE(sym64->st_name);
- ENDIAN_ASSIGN_IN_PLACE(sym64->st_value);
- ENDIAN_ASSIGN_IN_PLACE(sym64->st_size);
- ENDIAN_ASSIGN_IN_PLACE(sym64->st_info);
- ENDIAN_ASSIGN_IN_PLACE(sym64->st_other);
- ENDIAN_ASSIGN_IN_PLACE(sym64->st_shndx);
- }
- return 0;
-bail:
- return 1;
-}
-
-int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode) {
- elf_obj_t elf;
- unsigned int ofst;
- int i;
- Elf32_Off strtab_off32;
- Elf64_Off strtab_off64; /* save String Table offset for later use */
-
- memset(&elf, 0, sizeof(elf));
- elf.buf = buf;
- elf.sz = sz;
-
- /* Parse Header */
- if (parse_elf_header(&elf))
- goto bail;
-
- if (elf.bits == 32) {
- Elf32_Shdr shdr;
- for (i = 0; i < elf.hdr32.e_shnum; i++) {
- parse_elf_section(&elf, i, &shdr, NULL);
-
- if (shdr.sh_type == SHT_STRTAB) {
- char strtsb_name[128];
-
- strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
-
- if (!(strcmp(strtsb_name, ".shstrtab"))) {
- /* log_msg("found section: %s\n", strtsb_name); */
- strtab_off32 = shdr.sh_offset;
- break;
- }
- }
- }
- } else { /* if (elf.bits == 64) */
- Elf64_Shdr shdr;
- for (i = 0; i < elf.hdr64.e_shnum; i++) {
- parse_elf_section(&elf, i, NULL, &shdr);
-
- if (shdr.sh_type == SHT_STRTAB) {
- char strtsb_name[128];
-
- strcpy(strtsb_name, (char *)(elf.buf + shdr.sh_offset + shdr.sh_name));
-
- if (!(strcmp(strtsb_name, ".shstrtab"))) {
- /* log_msg("found section: %s\n", strtsb_name); */
- strtab_off64 = shdr.sh_offset;
- break;
- }
- }
- }
- }
-
- /* Parse all Symbol Tables */
- if (elf.bits == 32) {
- Elf32_Shdr shdr;
- for (i = 0; i < elf.hdr32.e_shnum; i++) {
- parse_elf_section(&elf, i, &shdr, NULL);
-
- if (shdr.sh_type == SHT_SYMTAB) {
- for (ofst = shdr.sh_offset;
- ofst < shdr.sh_offset + shdr.sh_size;
- ofst += shdr.sh_entsize) {
- Elf32_Sym sym;
-
- parse_elf_symbol(&elf, ofst, &sym, NULL);
-
- /* For all OBJECTS (data objects), extract the value from the
- * proper data segment.
- */
- /* if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
- log_msg("found data object %s\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name));
- */
-
- if (ELF32_ST_TYPE(sym.st_info) == STT_OBJECT
- && sym.st_size == 4) {
- Elf32_Shdr dhdr;
- int val = 0;
- char section_name[128];
-
- parse_elf_section(&elf, sym.st_shndx, &dhdr, NULL);
-
- /* For explanition - refer to _MSC_VER version of code */
- strcpy(section_name, (char *)(elf.buf + strtab_off32 + dhdr.sh_name));
- /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */
-
- if (strcmp(section_name, ".bss")) {
- if (sizeof(val) != sym.st_size) {
- /* The target value is declared as an int in
- * *_asm_*_offsets.c, which is 4 bytes on all
- * targets we currently use. Complain loudly if
- * this is not true.
- */
- log_msg("Symbol size is wrong\n");
- goto bail;
- }
-
- memcpy(&val,
- elf.buf + dhdr.sh_offset + sym.st_value,
- sym.st_size);
- }
-
- if (!elf.le_data) {
- log_msg("Big Endian data not supported yet!\n");
- goto bail;
- }
-
- switch (mode) {
- case OUTPUT_FMT_RVDS:
- printf("%-40s EQU %5d\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- break;
- case OUTPUT_FMT_GAS:
- printf(".equ %-40s, %5d\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- break;
- case OUTPUT_FMT_C_HEADER:
- printf("#define %-40s %5d\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- break;
- default:
- printf("%s = %d\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- }
- }
- }
- }
- }
- } else { /* if (elf.bits == 64) */
- Elf64_Shdr shdr;
- for (i = 0; i < elf.hdr64.e_shnum; i++) {
- parse_elf_section(&elf, i, NULL, &shdr);
-
- if (shdr.sh_type == SHT_SYMTAB) {
- for (ofst = shdr.sh_offset;
- ofst < shdr.sh_offset + shdr.sh_size;
- ofst += shdr.sh_entsize) {
- Elf64_Sym sym;
-
- parse_elf_symbol(&elf, ofst, NULL, &sym);
-
- /* For all OBJECTS (data objects), extract the value from the
- * proper data segment.
- */
- /* if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT && sym.st_name)
- log_msg("found data object %s\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name));
- */
-
- if (ELF64_ST_TYPE(sym.st_info) == STT_OBJECT
- && sym.st_size == 4) {
- Elf64_Shdr dhdr;
- int val = 0;
- char section_name[128];
-
- parse_elf_section(&elf, sym.st_shndx, NULL, &dhdr);
-
- /* For explanition - refer to _MSC_VER version of code */
- strcpy(section_name, (char *)(elf.buf + strtab_off64 + dhdr.sh_name));
- /* log_msg("Section_name: %s, Section_type: %d\n", section_name, dhdr.sh_type); */
-
- if ((strcmp(section_name, ".bss"))) {
- if (sizeof(val) != sym.st_size) {
- /* The target value is declared as an int in
- * *_asm_*_offsets.c, which is 4 bytes on all
- * targets we currently use. Complain loudly if
- * this is not true.
- */
- log_msg("Symbol size is wrong\n");
- goto bail;
- }
-
- memcpy(&val,
- elf.buf + dhdr.sh_offset + sym.st_value,
- sym.st_size);
- }
-
- if (!elf.le_data) {
- log_msg("Big Endian data not supported yet!\n");
- goto bail;
- }
-
- switch (mode) {
- case OUTPUT_FMT_RVDS:
- printf("%-40s EQU %5d\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- break;
- case OUTPUT_FMT_GAS:
- printf(".equ %-40s, %5d\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- break;
- default:
- printf("%s = %d\n",
- parse_elf_string_table(&elf,
- shdr.sh_link,
- sym.st_name),
- val);
- }
- }
- }
- }
- }
- }
-
- if (mode == OUTPUT_FMT_RVDS)
- printf(" END\n");
-
- return 0;
-bail:
- log_msg("Parse error: File does not appear to be valid ELF32 or ELF64\n");
- return 1;
-}
-
-#endif
-#endif /* defined(__GNUC__) && __GNUC__ */
-
-
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
-/* See "Microsoft Portable Executable and Common Object File Format Specification"
- for reference.
-*/
-#define get_le32(x) ((*(x)) | (*(x+1)) << 8 |(*(x+2)) << 16 | (*(x+3)) << 24 )
-#define get_le16(x) ((*(x)) | (*(x+1)) << 8)
-
-int parse_coff(uint8_t *buf, size_t sz) {
- unsigned int nsections, symtab_ptr, symtab_sz, strtab_ptr;
- unsigned int sectionrawdata_ptr;
- unsigned int i;
- uint8_t *ptr;
- uint32_t symoffset;
-
- char **sectionlist; // this array holds all section names in their correct order.
- // it is used to check if the symbol is in .bss or .rdata section.
-
- nsections = get_le16(buf + 2);
- symtab_ptr = get_le32(buf + 8);
- symtab_sz = get_le32(buf + 12);
- strtab_ptr = symtab_ptr + symtab_sz * 18;
-
- if (nsections > 96) {
- log_msg("Too many sections\n");
- return 1;
- }
-
- sectionlist = malloc(nsections * sizeof(sectionlist));
-
- if (sectionlist == NULL) {
- log_msg("Allocating first level of section list failed\n");
- return 1;
- }
-
- // log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections);
-
- /*
- The size of optional header is always zero for an obj file. So, the section header
- follows the file header immediately.
- */
-
- ptr = buf + 20; // section header
-
- for (i = 0; i < nsections; i++) {
- char sectionname[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
- strncpy(sectionname, ptr, 8);
- // log_msg("COFF: Parsing section %s\n",sectionname);
-
- sectionlist[i] = malloc(strlen(sectionname) + 1);
-
- if (sectionlist[i] == NULL) {
- log_msg("Allocating storage for %s failed\n", sectionname);
- goto bail;
- }
- strcpy(sectionlist[i], sectionname);
-
- // check if it's .rdata and is not a COMDAT section.
- if (!strcmp(sectionname, ".rdata") &&
- (get_le32(ptr + 36) & 0x1000) == 0) {
- sectionrawdata_ptr = get_le32(ptr + 20);
- }
-
- ptr += 40;
- }
-
- // log_msg("COFF: Symbol table at offset %u\n", symtab_ptr);
- // log_msg("COFF: raw data pointer ofset for section .rdata is %u\n", sectionrawdata_ptr);
-
- /* The compiler puts the data with non-zero offset in .rdata section, but puts the data with
- zero offset in .bss section. So, if the data in in .bss section, set offset=0.
- Note from Wiki: In an object module compiled from C, the bss section contains
- the local variables (but not functions) that were declared with the static keyword,
- except for those with non-zero initial values. (In C, static variables are initialized
- to zero by default.) It also contains the non-local (both extern and static) variables
- that are also initialized to zero (either explicitly or by default).
- */
- // move to symbol table
- /* COFF symbol table:
- offset field
- 0 Name(*)
- 8 Value
- 12 SectionNumber
- 14 Type
- 16 StorageClass
- 17 NumberOfAuxSymbols
- */
- ptr = buf + symtab_ptr;
-
- for (i = 0; i < symtab_sz; i++) {
- int16_t section = get_le16(ptr + 12); // section number
-
- if (section > 0 && ptr[16] == 2) {
- // if(section > 0 && ptr[16] == 3 && get_le32(ptr+8)) {
-
- if (get_le32(ptr)) {
- char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
- strncpy(name, ptr, 8);
- // log_msg("COFF: Parsing symbol %s\n",name);
- /* The 64bit Windows compiler doesn't prefix with an _.
- * Check what's there, and bump if necessary
- */
- if (name[0] == '_')
- printf("%-40s EQU ", name + 1);
- else
- printf("%-40s EQU ", name);
- } else {
- // log_msg("COFF: Parsing symbol %s\n",
- // buf + strtab_ptr + get_le32(ptr+4));
- if ((buf + strtab_ptr + get_le32(ptr + 4))[0] == '_')
- printf("%-40s EQU ",
- buf + strtab_ptr + get_le32(ptr + 4) + 1);
- else
- printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4));
- }
-
- if (!(strcmp(sectionlist[section - 1], ".bss"))) {
- symoffset = 0;
- } else {
- symoffset = get_le32(buf + sectionrawdata_ptr + get_le32(ptr + 8));
- }
-
- // log_msg(" Section: %d\n",section);
- // log_msg(" Class: %d\n",ptr[16]);
- // log_msg(" Address: %u\n",get_le32(ptr+8));
- // log_msg(" Offset: %u\n", symoffset);
-
- printf("%5d\n", symoffset);
- }
-
- ptr += 18;
- }
-
- printf(" END\n");
-
- for (i = 0; i < nsections; i++) {
- free(sectionlist[i]);
- }
-
- free(sectionlist);
-
- return 0;
-bail:
-
- for (i = 0; i < nsections; i++) {
- free(sectionlist[i]);
- }
-
- free(sectionlist);
-
- return 1;
-}
-#endif /* defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) */
-
-int main(int argc, char **argv) {
- output_fmt_t mode = OUTPUT_FMT_PLAIN;
- const char *f;
- uint8_t *file_buf;
- int res;
- FILE *fp;
- long int file_size;
-
- if (argc < 2 || argc > 3) {
- fprintf(stderr, "Usage: %s [output format] <obj file>\n\n", argv[0]);
- fprintf(stderr, " <obj file>\tobject file to parse\n");
- fprintf(stderr, "Output Formats:\n");
- fprintf(stderr, " gas - compatible with GNU assembler\n");
- fprintf(stderr, " rvds - compatible with armasm\n");
- fprintf(stderr, " cheader - c/c++ header file\n");
- goto bail;
- }
-
- f = argv[2];
-
- if (!strcmp(argv[1], "rvds"))
- mode = OUTPUT_FMT_RVDS;
- else if (!strcmp(argv[1], "gas"))
- mode = OUTPUT_FMT_GAS;
- else if (!strcmp(argv[1], "cheader"))
- mode = OUTPUT_FMT_C_HEADER;
- else
- f = argv[1];
-
- fp = fopen(f, "rb");
-
- if (!fp) {
- perror("Unable to open file");
- goto bail;
- }
-
- if (fseek(fp, 0, SEEK_END)) {
- perror("stat");
- goto bail;
- }
-
- file_size = ftell(fp);
- file_buf = malloc(file_size);
-
- if (!file_buf) {
- perror("malloc");
- goto bail;
- }
-
- rewind(fp);
-
- if (fread(file_buf, sizeof(char), file_size, fp) != file_size) {
- perror("read");
- goto bail;
- }
-
- if (fclose(fp)) {
- perror("close");
- goto bail;
- }
-
-#if defined(__GNUC__) && __GNUC__
-#if defined(__MACH__)
- res = parse_macho(file_buf, file_size, mode);
-#elif defined(__ELF__)
- res = parse_elf(file_buf, file_size, mode);
-#endif
-#endif
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
- res = parse_coff(file_buf, file_size);
-#endif
-
- free(file_buf);
-
- if (!res)
- return EXIT_SUCCESS;
-
-bail:
- return EXIT_FAILURE;
-}
diff --git a/videocodec/libvpx_internal/libvpx/build/make/rtcd.pl b/videocodec/libvpx_internal/libvpx/build/make/rtcd.pl
deleted file mode 100644
index 18ee80d..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/rtcd.pl
+++ /dev/null
@@ -1,414 +0,0 @@
-#!/usr/bin/env perl
-
-no strict 'refs';
-use warnings;
-use Getopt::Long;
-Getopt::Long::Configure("auto_help");
-
-my %ALL_FUNCS = ();
-my @ALL_ARCHS;
-my @ALL_FORWARD_DECLS;
-my @REQUIRES;
-
-my %opts = ();
-my %disabled = ();
-my %required = ();
-
-my @argv;
-foreach (@ARGV) {
- $disabled{$1} = 1, next if /--disable-(.*)/;
- $required{$1} = 1, next if /--require-(.*)/;
- push @argv, $_;
-}
-
-# NB: use GetOptions() instead of GetOptionsFromArray() for compatibility.
-@ARGV = @argv;
-GetOptions(
- \%opts,
- 'arch=s',
- 'sym=s',
- 'config=s',
-);
-
-foreach my $opt (qw/arch config/) {
- if (!defined($opts{$opt})) {
- warn "--$opt is required!\n";
- Getopt::Long::HelpMessage('-exit' => 1);
- }
-}
-
-foreach my $defs_file (@ARGV) {
- if (!-f $defs_file) {
- warn "$defs_file: $!\n";
- Getopt::Long::HelpMessage('-exit' => 1);
- }
-}
-
-open CONFIG_FILE, $opts{config} or
- die "Error opening config file '$opts{config}': $!\n";
-
-my %config = ();
-while (<CONFIG_FILE>) {
- next if !/^CONFIG_/;
- chomp;
- my @pair = split /=/;
- $config{$pair[0]} = $pair[1];
-}
-close CONFIG_FILE;
-
-#
-# Routines for the RTCD DSL to call
-#
-sub vpx_config($) {
- return (defined $config{$_[0]}) ? $config{$_[0]} : "";
-}
-
-sub specialize {
- my $fn=$_[0];
- shift;
- foreach my $opt (@_) {
- eval "\$${fn}_${opt}=${fn}_${opt}";
- }
-}
-
-sub add_proto {
- my $fn = splice(@_, -2, 1);
- $ALL_FUNCS{$fn} = \@_;
- specialize $fn, "c";
-}
-
-sub require {
- foreach my $fn (keys %ALL_FUNCS) {
- foreach my $opt (@_) {
- my $ofn = eval "\$${fn}_${opt}";
- next if !$ofn;
-
- # if we already have a default, then we can disable it, as we know
- # we can do better.
- my $best = eval "\$${fn}_default";
- if ($best) {
- my $best_ofn = eval "\$${best}";
- if ($best_ofn && "$best_ofn" ne "$ofn") {
- eval "\$${best}_link = 'false'";
- }
- }
- eval "\$${fn}_default=${fn}_${opt}";
- eval "\$${fn}_${opt}_link='true'";
- }
- }
-}
-
-sub forward_decls {
- push @ALL_FORWARD_DECLS, @_;
-}
-
-#
-# Include the user's directives
-#
-foreach my $f (@ARGV) {
- open FILE, "<", $f or die "cannot open $f: $!\n";
- my $contents = join('', <FILE>);
- close FILE;
- eval $contents or warn "eval failed: $@\n";
-}
-
-#
-# Process the directives according to the command line
-#
-sub process_forward_decls() {
- foreach (@ALL_FORWARD_DECLS) {
- $_->();
- }
-}
-
-sub determine_indirection {
- vpx_config("CONFIG_RUNTIME_CPU_DETECT") eq "yes" or &require(@ALL_ARCHS);
- foreach my $fn (keys %ALL_FUNCS) {
- my $n = "";
- my @val = @{$ALL_FUNCS{$fn}};
- my $args = pop @val;
- my $rtyp = "@val";
- my $dfn = eval "\$${fn}_default";
- $dfn = eval "\$${dfn}";
- foreach my $opt (@_) {
- my $ofn = eval "\$${fn}_${opt}";
- next if !$ofn;
- my $link = eval "\$${fn}_${opt}_link";
- next if $link && $link eq "false";
- $n .= "x";
- }
- if ($n eq "x") {
- eval "\$${fn}_indirect = 'false'";
- } else {
- eval "\$${fn}_indirect = 'true'";
- }
- }
-}
-
-sub declare_function_pointers {
- foreach my $fn (sort keys %ALL_FUNCS) {
- my @val = @{$ALL_FUNCS{$fn}};
- my $args = pop @val;
- my $rtyp = "@val";
- my $dfn = eval "\$${fn}_default";
- $dfn = eval "\$${dfn}";
- foreach my $opt (@_) {
- my $ofn = eval "\$${fn}_${opt}";
- next if !$ofn;
- print "$rtyp ${ofn}($args);\n";
- }
- if (eval "\$${fn}_indirect" eq "false") {
- print "#define ${fn} ${dfn}\n";
- } else {
- print "RTCD_EXTERN $rtyp (*${fn})($args);\n";
- }
- print "\n";
- }
-}
-
-sub set_function_pointers {
- foreach my $fn (sort keys %ALL_FUNCS) {
- my @val = @{$ALL_FUNCS{$fn}};
- my $args = pop @val;
- my $rtyp = "@val";
- my $dfn = eval "\$${fn}_default";
- $dfn = eval "\$${dfn}";
- if (eval "\$${fn}_indirect" eq "true") {
- print " $fn = $dfn;\n";
- foreach my $opt (@_) {
- my $ofn = eval "\$${fn}_${opt}";
- next if !$ofn;
- next if "$ofn" eq "$dfn";
- my $link = eval "\$${fn}_${opt}_link";
- next if $link && $link eq "false";
- my $cond = eval "\$have_${opt}";
- print " if (${cond}) $fn = $ofn;\n"
- }
- }
- }
-}
-
-sub filter {
- my @filtered;
- foreach (@_) { push @filtered, $_ unless $disabled{$_}; }
- return @filtered;
-}
-
-#
-# Helper functions for generating the arch specific RTCD files
-#
-sub common_top() {
- my $include_guard = uc($opts{sym})."_H_";
- print <<EOF;
-#ifndef ${include_guard}
-#define ${include_guard}
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-
-process_forward_decls();
-print "\n";
-declare_function_pointers("c", @ALL_ARCHS);
-
-print <<EOF;
-void $opts{sym}(void);
-
-EOF
-}
-
-sub common_bottom() {
- print <<EOF;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif
-EOF
-}
-
-sub x86() {
- determine_indirection("c", @ALL_ARCHS);
-
- # Assign the helper variable for each enabled extension
- foreach my $opt (@ALL_ARCHS) {
- my $opt_uc = uc $opt;
- eval "\$have_${opt}=\"flags & HAS_${opt_uc}\"";
- }
-
- common_top;
- print <<EOF;
-#ifdef RTCD_C
-#include "vpx_ports/x86.h"
-static void setup_rtcd_internal(void)
-{
- int flags = x86_simd_caps();
-
- (void)flags;
-
-EOF
-
- set_function_pointers("c", @ALL_ARCHS);
-
- print <<EOF;
-}
-#endif
-EOF
- common_bottom;
-}
-
-sub arm() {
- determine_indirection("c", @ALL_ARCHS);
-
- # Assign the helper variable for each enabled extension
- foreach my $opt (@ALL_ARCHS) {
- my $opt_uc = uc $opt;
- eval "\$have_${opt}=\"flags & HAS_${opt_uc}\"";
- }
-
- common_top;
- print <<EOF;
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-#include "vpx_ports/arm.h"
-static void setup_rtcd_internal(void)
-{
- int flags = arm_cpu_caps();
-
- (void)flags;
-
-EOF
-
- set_function_pointers("c", @ALL_ARCHS);
-
- print <<EOF;
-}
-#endif
-EOF
- common_bottom;
-}
-
-sub mips() {
- determine_indirection("c", @ALL_ARCHS);
- common_top;
-
- print <<EOF;
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-EOF
-
- set_function_pointers("c", @ALL_ARCHS);
-
- print <<EOF;
-#if HAVE_DSPR2
-#if CONFIG_VP8
-void dsputil_static_init();
-dsputil_static_init();
-#endif
-#if CONFIG_VP9
-void vp9_dsputil_static_init();
-vp9_dsputil_static_init();
-#endif
-#endif
-}
-#endif
-EOF
- common_bottom;
-}
-
-sub unoptimized() {
- determine_indirection "c";
- common_top;
- print <<EOF;
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-EOF
-
- set_function_pointers "c";
-
- print <<EOF;
-}
-#endif
-EOF
- common_bottom;
-}
-
-#
-# Main Driver
-#
-
-&require("c");
-if ($opts{arch} eq 'x86') {
- @ALL_ARCHS = filter(qw/mmx sse sse2 sse3 ssse3 sse4_1 avx avx2/);
- x86;
-} elsif ($opts{arch} eq 'x86_64') {
- @ALL_ARCHS = filter(qw/mmx sse sse2 sse3 ssse3 sse4_1 avx avx2/);
- @REQUIRES = filter(keys %required ? keys %required : qw/mmx sse sse2/);
- &require(@REQUIRES);
- x86;
-} elsif ($opts{arch} eq 'mips32') {
- @ALL_ARCHS = filter(qw/mips32/);
- open CONFIG_FILE, $opts{config} or
- die "Error opening config file '$opts{config}': $!\n";
- while (<CONFIG_FILE>) {
- if (/HAVE_DSPR2=yes/) {
- @ALL_ARCHS = filter(qw/mips32 dspr2/);
- last;
- }
- }
- close CONFIG_FILE;
- mips;
-} elsif ($opts{arch} eq 'armv5te') {
- @ALL_ARCHS = filter(qw/edsp/);
- arm;
-} elsif ($opts{arch} eq 'armv6') {
- @ALL_ARCHS = filter(qw/edsp media/);
- arm;
-} elsif ($opts{arch} eq 'armv7') {
- @ALL_ARCHS = filter(qw/edsp media neon/);
- arm;
-} else {
- unoptimized;
-}
-
-__END__
-
-=head1 NAME
-
-rtcd -
-
-=head1 SYNOPSIS
-
-Usage: rtcd.pl [options] FILE
-
-See 'perldoc rtcd.pl' for more details.
-
-=head1 DESCRIPTION
-
-Reads the Run Time CPU Detections definitions from FILE and generates a
-C header file on stdout.
-
-=head1 OPTIONS
-
-Options:
- --arch=ARCH Architecture to generate defs for (required)
- --disable-EXT Disable support for EXT extensions
- --require-EXT Require support for EXT extensions
- --sym=SYMBOL Unique symbol to use for RTCD initialization function
- --config=FILE File with CONFIG_FOO=yes lines to parse
diff --git a/videocodec/libvpx_internal/libvpx/build/make/thumb.pm b/videocodec/libvpx_internal/libvpx/build/make/thumb.pm
deleted file mode 100644
index 483c253..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/thumb.pm
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env perl
-##
-## Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-package thumb;
-
-sub FixThumbInstructions($$)
-{
- my $short_branches = $_[1];
- my $branch_shift_offset = $short_branches ? 1 : 0;
-
- # Write additions with shifts, such as "add r10, r11, lsl #8",
- # in three operand form, "add r10, r10, r11, lsl #8".
- s/(add\s+)(r\d+),\s*(r\d+),\s*(lsl #\d+)/$1$2, $2, $3, $4/g;
-
- # Convert additions with a non-constant shift into a sequence
- # with left shift, addition and a right shift (to restore the
- # register to the original value). Currently the right shift
- # isn't necessary in the code base since the values in these
- # registers aren't used, but doing the shift for consistency.
- # This converts instructions such as "add r12, r12, r5, lsl r4"
- # into the sequence "lsl r5, r4", "add r12, r12, r5", "lsr r5, r4".
- s/^(\s*)(add)(\s+)(r\d+),\s*(r\d+),\s*(r\d+),\s*lsl (r\d+)/$1lsl$3$6, $7\n$1$2$3$4, $5, $6\n$1lsr$3$6, $7/g;
-
- # Convert loads with right shifts in the indexing into a
- # sequence of an add, load and sub. This converts
- # "ldrb r4, [r9, lr, asr #1]" into "add r9, r9, lr, asr #1",
- # "ldrb r9, [r9]", "sub r9, r9, lr, asr #1".
- s/^(\s*)(ldrb)(\s+)(r\d+),\s*\[(\w+),\s*(\w+),\s*(asr #\d+)\]/$1add $3$5, $5, $6, $7\n$1$2$3$4, [$5]\n$1sub $3$5, $5, $6, $7/g;
-
- # Convert register indexing with writeback into a separate add
- # instruction. This converts "ldrb r12, [r1, r2]!" into
- # "ldrb r12, [r1, r2]", "add r1, r1, r2".
- s/^(\s*)(ldrb)(\s+)(r\d+),\s*\[(\w+),\s*(\w+)\]!/$1$2$3$4, [$5, $6]\n$1add $3$5, $6/g;
-
- # Convert negative register indexing into separate sub/add instructions.
- # This converts "ldrne r4, [src, -pstep, lsl #1]" into
- # "subne src, src, pstep, lsl #1", "ldrne r4, [src]",
- # "addne src, src, pstep, lsl #1". In a couple of cases where
- # this is used, it's used for two subsequent load instructions,
- # where a hand-written version of it could merge two subsequent
- # add and sub instructions.
- s/^(\s*)((ldr|str|pld)(ne)?)(\s+)(r\d+,\s*)?\[(\w+), -([^\]]+)\]/$1sub$4$5$7, $7, $8\n$1$2$5$6\[$7\]\n$1add$4$5$7, $7, $8/g;
-
- # Convert register post indexing to a separate add instruction.
- # This converts "ldrneb r9, [r0], r2" into "ldrneb r9, [r0]",
- # "addne r0, r0, r2".
- s/^(\s*)((ldr|str)(ne)?[bhd]?)(\s+)(\w+),(\s*\w+,)?\s*\[(\w+)\],\s*(\w+)/$1$2$5$6,$7 [$8]\n$1add$4$5$8, $8, $9/g;
-
- # Convert a conditional addition to the pc register into a series of
- # instructions. This converts "addlt pc, pc, r3, lsl #2" into
- # "itttt lt", "movlt.n r12, pc", "addlt.w r12, #12",
- # "addlt.w r12, r12, r3, lsl #2", "movlt.n pc, r12".
- # This assumes that r12 is free at this point.
- s/^(\s*)addlt(\s+)pc,\s*pc,\s*(\w+),\s*lsl\s*#(\d+)/$1itttt$2lt\n$1movlt.n$2r12, pc\n$1addlt.w$2r12, #12\n$1addlt.w$2r12, r12, $3, lsl #($4-$branch_shift_offset)\n$1movlt.n$2pc, r12/g;
-
- # Convert "mov pc, lr" into "bx lr", since the former only works
- # for switching from arm to thumb (and only in armv7), but not
- # from thumb to arm.
- s/mov(\s*)pc\s*,\s*lr/bx$1lr/g;
-}
-
-1;
diff --git a/videocodec/libvpx_internal/libvpx/build/make/version.sh b/videocodec/libvpx_internal/libvpx/build/make/version.sh
deleted file mode 100644
index e31e568..0000000
--- a/videocodec/libvpx_internal/libvpx/build/make/version.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-
-for opt in "$@"; do
- optval="${opt#*=}"
- case "$opt" in
- --bare) bare=true ;;
- *) break ;;
- esac
- shift
-done
-source_path=${1:-.}
-out_file=${2}
-id=${3:-VERSION_STRING}
-
-git_version_id=""
-if [ -d ${source_path}/.git ]; then
- # Source Path is a git working copy. Check for local modifications.
- export GIT_DIR=${source_path}/.git
- 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="${changelog_version}"
- break
- fi
-done
-version_str="${changelog_version}${git_version_id}"
-bare_version=${version_str#v}
-major_version=${bare_version%%.*}
-bare_version=${bare_version#*.}
-minor_version=${bare_version%%.*}
-bare_version=${bare_version#*.}
-patch_version=${bare_version%%-*}
-bare_version=${bare_version#${patch_version}}
-extra_version=${bare_version##-}
-
-#since they'll be used as integers below make sure they are or force to 0
-for v in major_version minor_version patch_version; do
- if eval echo \$$v |grep -E -q '[^[:digit:]]'; then
- eval $v=0
- fi
-done
-
-if [ ${bare} ]; then
- echo "${changelog_version}${git_version_id}" > $$.tmp
-else
- cat<<EOF>$$.tmp
-#define VERSION_MAJOR $major_version
-#define VERSION_MINOR $minor_version
-#define VERSION_PATCH $patch_version
-#define VERSION_EXTRA "$extra_version"
-#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define ${id}_NOSP "${version_str}"
-#define ${id} " ${version_str}"
-EOF
-fi
-if [ -n "$out_file" ]; then
-diff $$.tmp ${out_file} >/dev/null 2>&1 || cat $$.tmp > ${out_file}
-else
-cat $$.tmp
-fi
-rm $$.tmp
diff --git a/videocodec/libvpx_internal/libvpx/build/x86-msvs/obj_int_extract.bat b/videocodec/libvpx_internal/libvpx/build/x86-msvs/obj_int_extract.bat
deleted file mode 100644
index 44d095d..0000000
--- a/videocodec/libvpx_internal/libvpx/build/x86-msvs/obj_int_extract.bat
+++ /dev/null
@@ -1,15 +0,0 @@
-REM Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-REM
-REM Use of this source code is governed by a BSD-style license
-REM that can be found in the LICENSE file in the root of the source
-REM tree. An additional intellectual property rights grant can be found
-REM in the file PATENTS. All contributing project authors may
-REM be found in the AUTHORS file in the root of the source tree.
-echo on
-
-REM Arguments:
-REM %1 - Relative path to the directory containing the vp8 source directory.
-REM %2 - Path to obj_int_extract.exe.
-cl /I "./" /I "%1" /nologo /c "%1/vp8/encoder/vp8_asm_enc_offsets.c"
-%2\obj_int_extract.exe rvds "vp8_asm_enc_offsets.obj" > "vp8_asm_enc_offsets.asm"
-
diff --git a/videocodec/libvpx_internal/libvpx/configure b/videocodec/libvpx_internal/libvpx/configure
deleted file mode 100644
index ff350cc..0000000
--- a/videocodec/libvpx_internal/libvpx/configure
+++ /dev/null
@@ -1,748 +0,0 @@
-#!/bin/sh
-##
-## configure
-##
-## This script is the front-end to the build system. It provides a similar
-## interface to standard configure scripts with some extra bits for dealing
-## with toolchains that differ from the standard POSIX interface and
-## for extracting subsets of the source tree. In theory, reusable parts
-## of this script were intended to live in build/make/configure.sh,
-## but in practice, the line is pretty blurry.
-##
-## This build system is based in part on the FFmpeg configure script.
-##
-
-#source_path="`dirname \"$0\"`"
-source_path=${0%/*}
-. "${source_path}/build/make/configure.sh"
-
-show_help(){
- show_help_pre
- cat << EOF
-Advanced options:
- ${toggle_libs} libraries
- ${toggle_examples} examples
- ${toggle_docs} documentation
- ${toggle_unit_tests} unit tests
- ${toggle_decode_perf_tests} build decoder perf tests with unit tests
- --libc=PATH path to alternate libc
- --as={yasm|nasm|auto} use specified assembler [auto, yasm preferred]
- --sdk-path=PATH path to root of sdk (android builds only)
- ${toggle_fast_unaligned} don't use unaligned accesses, even when
- supported by hardware [auto]
- ${toggle_codec_srcs} in/exclude codec library source code
- ${toggle_debug_libs} in/exclude debug version of libraries
- ${toggle_static_msvcrt} use static MSVCRT (VS builds only)
- ${toggle_vp8} VP8 codec support
- ${toggle_vp9} VP9 codec support
- ${toggle_internal_stats} output of encoder internal stats for debug, if supported (encoders)
- ${toggle_mem_tracker} track memory usage
- ${toggle_postproc} postprocessing
- ${toggle_vp9_postproc} vp9 specific postprocessing
- ${toggle_multithread} multithreaded encoding and decoding
- ${toggle_spatial_resampling} spatial sampling (scaling) support
- ${toggle_realtime_only} enable this option while building for real-time encoding
- ${toggle_onthefly_bitpacking} enable on-the-fly bitpacking in real-time encoding
- ${toggle_error_concealment} enable this option to get a decoder which is able to conceal losses
- ${toggle_runtime_cpu_detect} runtime cpu detection
- ${toggle_shared} shared library support
- ${toggle_static} static library support
- ${toggle_small} favor smaller size over speed
- ${toggle_postproc_visualizer} macro block / block level visualizers
- ${toggle_multi_res_encoding} enable multiple-resolution encoding
- ${toggle_temporal_denoising} enable temporal denoising and disable the spatial denoiser
- ${toggle_webm_io} enable input from and output to WebM container
-
-Codecs:
- Codecs can be selectively enabled or disabled individually, or by family:
- --disable-<codec>
- is equivalent to:
- --disable-<codec>-encoder
- --disable-<codec>-decoder
-
- Codecs available in this distribution:
-EOF
-#restore editor state '
-
- local family;
- local last_family;
- local c;
- local str;
- for c in ${CODECS}; do
- family=${c%_*}
- if [ "${family}" != "${last_family}" ]; then
- [ -z "${str}" ] || echo "${str}"
- str="$(printf ' %10s:' ${family})"
- fi
- str="${str} $(printf '%10s' ${c#*_})"
- last_family=${family}
- done
- echo "${str}"
- show_help_post
-}
-
-##
-## BEGIN APPLICATION SPECIFIC CONFIGURATION
-##
-
-# all_platforms is a list of all supported target platforms. Maintain
-# alphabetically by architecture, generic-gnu last.
-all_platforms="${all_platforms} armv5te-android-gcc"
-all_platforms="${all_platforms} armv5te-linux-rvct"
-all_platforms="${all_platforms} armv5te-linux-gcc"
-all_platforms="${all_platforms} armv5te-none-rvct"
-all_platforms="${all_platforms} armv6-darwin-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
-all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8
-all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
-all_platforms="${all_platforms} armv7-win32-vs11"
-all_platforms="${all_platforms} armv7-win32-vs12"
-all_platforms="${all_platforms} mips32-linux-gcc"
-all_platforms="${all_platforms} ppc32-darwin8-gcc"
-all_platforms="${all_platforms} ppc32-darwin9-gcc"
-all_platforms="${all_platforms} ppc32-linux-gcc"
-all_platforms="${all_platforms} ppc64-darwin8-gcc"
-all_platforms="${all_platforms} ppc64-darwin9-gcc"
-all_platforms="${all_platforms} ppc64-linux-gcc"
-all_platforms="${all_platforms} sparc-solaris-gcc"
-all_platforms="${all_platforms} x86-android-gcc"
-all_platforms="${all_platforms} x86-darwin8-gcc"
-all_platforms="${all_platforms} x86-darwin8-icc"
-all_platforms="${all_platforms} x86-darwin9-gcc"
-all_platforms="${all_platforms} x86-darwin9-icc"
-all_platforms="${all_platforms} x86-darwin10-gcc"
-all_platforms="${all_platforms} x86-darwin11-gcc"
-all_platforms="${all_platforms} x86-darwin12-gcc"
-all_platforms="${all_platforms} x86-darwin13-gcc"
-all_platforms="${all_platforms} x86-linux-gcc"
-all_platforms="${all_platforms} x86-linux-icc"
-all_platforms="${all_platforms} x86-os2-gcc"
-all_platforms="${all_platforms} x86-solaris-gcc"
-all_platforms="${all_platforms} x86-win32-gcc"
-all_platforms="${all_platforms} x86-win32-vs7"
-all_platforms="${all_platforms} x86-win32-vs8"
-all_platforms="${all_platforms} x86-win32-vs9"
-all_platforms="${all_platforms} x86-win32-vs10"
-all_platforms="${all_platforms} x86-win32-vs11"
-all_platforms="${all_platforms} x86-win32-vs12"
-all_platforms="${all_platforms} x86_64-darwin9-gcc"
-all_platforms="${all_platforms} x86_64-darwin10-gcc"
-all_platforms="${all_platforms} x86_64-darwin11-gcc"
-all_platforms="${all_platforms} x86_64-darwin12-gcc"
-all_platforms="${all_platforms} x86_64-darwin13-gcc"
-all_platforms="${all_platforms} x86_64-linux-gcc"
-all_platforms="${all_platforms} x86_64-linux-icc"
-all_platforms="${all_platforms} x86_64-solaris-gcc"
-all_platforms="${all_platforms} x86_64-win64-gcc"
-all_platforms="${all_platforms} x86_64-win64-vs8"
-all_platforms="${all_platforms} x86_64-win64-vs9"
-all_platforms="${all_platforms} x86_64-win64-vs10"
-all_platforms="${all_platforms} x86_64-win64-vs11"
-all_platforms="${all_platforms} x86_64-win64-vs12"
-all_platforms="${all_platforms} universal-darwin8-gcc"
-all_platforms="${all_platforms} universal-darwin9-gcc"
-all_platforms="${all_platforms} universal-darwin10-gcc"
-all_platforms="${all_platforms} universal-darwin11-gcc"
-all_platforms="${all_platforms} universal-darwin12-gcc"
-all_platforms="${all_platforms} universal-darwin13-gcc"
-all_platforms="${all_platforms} generic-gnu"
-
-# all_targets is a list of all targets that can be configured
-# note that these should be in dependency order for now.
-all_targets="libs examples docs"
-
-# all targets available are enabled, by default.
-for t in ${all_targets}; do
- [ -f ${source_path}/${t}.mk ] && enable_feature ${t}
-done
-
-if ! perl --version >/dev/null; then
- die "Perl is required to build"
-fi
-
-
-if [ "`cd ${source_path} && pwd`" != "`pwd`" ]; then
- # test to see if source_path already configured
- if [ -f ${source_path}/vpx_config.h ]; then
- die "source directory already configured; run 'make distclean' there first"
- fi
-fi
-
-# check installed doxygen version
-doxy_version=$(doxygen --version 2>/dev/null)
-doxy_major=${doxy_version%%.*}
-if [ ${doxy_major:-0} -ge 1 ]; then
- doxy_version=${doxy_version#*.}
- doxy_minor=${doxy_version%%.*}
- doxy_patch=${doxy_version##*.}
-
- [ $doxy_major -gt 1 ] && enable_feature doxygen
- [ $doxy_minor -gt 5 ] && enable_feature doxygen
- [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable_feature doxygen
-fi
-
-# install everything except the sources, by default. sources will have
-# to be enabled when doing dist builds, since that's no longer a common
-# case.
-enabled doxygen && php -v >/dev/null 2>&1 && enable_feature install_docs
-enable_feature install_bins
-enable_feature install_libs
-
-enable_feature static
-enable_feature optimizations
-enable_feature fast_unaligned #allow unaligned accesses, if supported by hw
-enable_feature spatial_resampling
-enable_feature multithread
-enable_feature os_support
-enable_feature temporal_denoising
-
-[ -d ${source_path}/../include ] && enable_feature alt_tree_layout
-for d in vp8 vp9; do
- [ -d ${source_path}/${d} ] && disable_feature alt_tree_layout;
-done
-
-if ! enabled alt_tree_layout; then
-# development environment
-[ -d ${source_path}/vp8 ] && CODECS="${CODECS} vp8_encoder vp8_decoder"
-[ -d ${source_path}/vp9 ] && CODECS="${CODECS} vp9_encoder vp9_decoder"
-else
-# customer environment
-[ -f ${source_path}/../include/vpx/vp8cx.h ] && CODECS="${CODECS} vp8_encoder"
-[ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
-[ -f ${source_path}/../include/vpx/vp9cx.h ] && CODECS="${CODECS} vp9_encoder"
-[ -f ${source_path}/../include/vpx/vp9dx.h ] && CODECS="${CODECS} vp9_decoder"
-[ -f ${source_path}/../include/vpx/vp8cx.h ] || disable_feature vp8_encoder
-[ -f ${source_path}/../include/vpx/vp8dx.h ] || disable_feature vp8_decoder
-[ -f ${source_path}/../include/vpx/vp9cx.h ] || disable_feature vp9_encoder
-[ -f ${source_path}/../include/vpx/vp9dx.h ] || disable_feature vp9_decoder
-
-[ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt
-fi
-
-CODECS="$(echo ${CODECS} | tr ' ' '\n')"
-CODEC_FAMILIES="$(for c in ${CODECS}; do echo ${c%_*}; done | sort | uniq)"
-
-ARCH_LIST="
- arm
- mips
- x86
- x86_64
- ppc32
- ppc64
-"
-ARCH_EXT_LIST="
- edsp
- media
- neon
-
- mips32
- dspr2
-
- mmx
- sse
- sse2
- sse3
- ssse3
- sse4_1
- avx
- avx2
-
- altivec
-"
-HAVE_LIST="
- ${ARCH_EXT_LIST}
- vpx_ports
- stdint_h
- alt_tree_layout
- pthread_h
- sys_mman_h
- unistd_h
-"
-EXPERIMENT_LIST="
- multiple_arf
- alpha
-"
-CONFIG_LIST="
- external_build
- install_docs
- install_bins
- install_libs
- install_srcs
- use_x86inc
- debug
- gprof
- gcov
- rvct
- gcc
- msvs
- pic
- big_endian
-
- codec_srcs
- debug_libs
- fast_unaligned
- mem_manager
- mem_tracker
- mem_checks
-
- dequant_tokens
- dc_recon
- runtime_cpu_detect
- postproc
- vp9_postproc
- multithread
- internal_stats
- ${CODECS}
- ${CODEC_FAMILIES}
- encoders
- decoders
- static_msvcrt
- spatial_resampling
- realtime_only
- onthefly_bitpacking
- error_concealment
- shared
- static
- small
- postproc_visualizer
- os_support
- unit_tests
- webm_io
- decode_perf_tests
- multi_res_encoding
- temporal_denoising
- experimental
- decrypt
- ${EXPERIMENT_LIST}
-"
-CMDLINE_SELECT="
- external_build
- extra_warnings
- werror
- install_docs
- install_bins
- install_libs
- install_srcs
- debug
- gprof
- gcov
- pic
- use_x86inc
- optimizations
- ccache
- runtime_cpu_detect
- thumb
-
- libs
- examples
- docs
- libc
- as
- fast_unaligned
- codec_srcs
- debug_libs
-
- dequant_tokens
- dc_recon
- postproc
- vp9_postproc
- multithread
- internal_stats
- ${CODECS}
- ${CODEC_FAMILIES}
- static_msvcrt
- mem_tracker
- spatial_resampling
- realtime_only
- onthefly_bitpacking
- error_concealment
- shared
- static
- small
- postproc_visualizer
- unit_tests
- webm_io
- decode_perf_tests
- multi_res_encoding
- temporal_denoising
- experimental
- decrypt
-"
-
-process_cmdline() {
- for opt do
- optval="${opt#*=}"
- case "$opt" in
- --disable-codecs) for c in ${CODECS}; do disable_feature $c; done ;;
- --enable-?*|--disable-?*)
- eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
- if echo "${EXPERIMENT_LIST}" | grep "^ *$option\$" >/dev/null; then
- if enabled experimental; then
- ${action}_feature $option
- else
- log_echo "Ignoring $opt -- not in experimental mode."
- fi
- else
- process_common_cmdline $opt
- fi
- ;;
- *) process_common_cmdline "$opt"
- ;;
- esac
- done
-}
-
-post_process_cmdline() {
- local c
-
- # If the codec family is disabled, disable all components of that family.
- # If the codec family is enabled, enable all components of that family.
- log_echo "Configuring selected codecs"
- for c in ${CODECS}; do
- disabled ${c%%_*} && disable_feature ${c}
- enabled ${c%%_*} && enable_feature ${c}
- done
-
- # Enable all detected codecs, if they haven't been disabled
- for c in ${CODECS}; do soft_enable $c; done
-
- # Enable the codec family if any component of that family is enabled
- for c in ${CODECS}; do
- enabled $c && enable_feature ${c%_*}
- done
-
- # Set the {en,de}coders variable if any algorithm in that class is enabled
- for c in ${CODECS}; do
- enabled ${c} && enable_feature ${c##*_}s
- done
-}
-
-
-process_targets() {
- enabled child || write_common_config_banner
- enabled universal || write_common_target_config_h ${BUILD_PFX}vpx_config.h
-
- # TODO: add host tools target (obj_int_extract, etc)
-
- # For fat binaries, call configure recursively to configure for each
- # binary architecture to be included.
- if enabled universal; then
- # Call configure (ourselves) for each subarchitecture
- for arch in $fat_bin_archs; do
- BUILD_PFX=${arch}/ toolchain=${arch} $self --child $cmdline_args || exit $?
- done
- fi
-
- # The write_common_config (config.mk) logic is deferred until after the
- # recursive calls to configure complete, because we want our universal
- # targets to be executed last.
- write_common_config_targets
- enabled universal && echo "FAT_ARCHS=${fat_bin_archs}" >> config.mk
-
- # Calculate the default distribution name, based on the enabled features
- local cf
- local DIST_DIR=vpx
- for cf in $CODEC_FAMILIES; do
- if enabled ${cf}_encoder && enabled ${cf}_decoder; then
- DIST_DIR="${DIST_DIR}-${cf}"
- elif enabled ${cf}_encoder; then
- DIST_DIR="${DIST_DIR}-${cf}cx"
- elif enabled ${cf}_decoder; then
- DIST_DIR="${DIST_DIR}-${cf}dx"
- fi
- done
- enabled debug_libs && DIST_DIR="${DIST_DIR}-debug"
- enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
- ! enabled postproc && ! enabled vp9_postproc && DIST_DIR="${DIST_DIR}-nopost"
- ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
- ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
- DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
- case "${tgt_os}" in
- win*) enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
- DIST_DIR="${DIST_DIR}-${tgt_cc}"
- ;;
- esac
- if [ -f "${source_path}/build/make/version.sh" ]; then
- local ver=`"$source_path/build/make/version.sh" --bare $source_path`
- DIST_DIR="${DIST_DIR}-${ver}"
- VERSION_STRING=${ver}
- ver=${ver%%-*}
- VERSION_PATCH=${ver##*.}
- ver=${ver%.*}
- VERSION_MINOR=${ver##*.}
- ver=${ver#v}
- VERSION_MAJOR=${ver%.*}
- fi
- enabled child || cat <<EOF >> config.mk
-
-PREFIX=${prefix}
-ifeq (\$(MAKECMDGOALS),dist)
-DIST_DIR?=${DIST_DIR}
-else
-DIST_DIR?=\$(DESTDIR)${prefix}
-endif
-LIBSUBDIR=${libdir##${prefix}/}
-
-VERSION_STRING=${VERSION_STRING}
-
-VERSION_MAJOR=${VERSION_MAJOR}
-VERSION_MINOR=${VERSION_MINOR}
-VERSION_PATCH=${VERSION_PATCH}
-
-CONFIGURE_ARGS=${CONFIGURE_ARGS}
-EOF
- enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
-
- #
- # Write makefiles for all enabled targets
- #
- for tgt in libs examples docs solution; do
- local tgt_fn="$tgt-$toolchain.mk"
-
- if enabled $tgt; then
- echo "Creating makefiles for ${toolchain} ${tgt}"
- write_common_target_config_mk $tgt_fn ${BUILD_PFX}vpx_config.h
- #write_${tgt}_config
- fi
- done
-
-}
-
-process_detect() {
- if enabled shared; then
- # Can only build shared libs on a subset of platforms. Doing this check
- # here rather than at option parse time because the target auto-detect
- # magic happens after the command line has been parsed.
- if ! enabled linux; then
- if enabled gnu; then
- echo "--enable-shared is only supported on ELF; assuming this is OK"
- else
- die "--enable-shared only supported on ELF for now"
- fi
- fi
- fi
- if [ -z "$CC" ] || enabled external_build; then
- echo "Bypassing toolchain for environment detection."
- enable_feature external_build
- check_header() {
- log fake_check_header "$@"
- header=$1
- shift
- var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
- disable_feature $var
- # Headers common to all environments
- case $header in
- stdio.h)
- true;
- ;;
- *)
- local result=false
- for d in "$@"; do
- [ -f "${d##-I}/$header" ] && result=true && break
- done
- ${result:-true}
- esac && enable_feature $var
-
- # Specialize windows and POSIX environments.
- case $toolchain in
- *-win*-*)
- case $header-$toolchain in
- stdint*-gcc) true;;
- *) false;;
- esac && enable_feature $var
- ;;
- *)
- case $header in
- stdint.h) true;;
- pthread.h) true;;
- sys/mman.h) true;;
- unistd.h) true;;
- *) false;;
- esac && enable_feature $var
- esac
- enabled $var
- }
- check_ld() {
- true
- }
- fi
- check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}"
- check_ld <<EOF || die "Toolchain is unable to link executables"
-int main(void) {return 0;}
-EOF
- # check system headers
- check_header stdint.h
- check_header pthread.h
- check_header sys/mman.h
- check_header unistd.h # for sysconf(3) and friends.
-
- check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports
-}
-
-process_toolchain() {
- process_common_toolchain
-
- # Handle universal binaries for this architecture
- case $toolchain in
- universal-darwin*)
- local darwin_ver=${tgt_os##darwin}
-
- # Snow Leopard (10.6/darwin10) dropped support for PPC
- # Include PPC support for all prior versions
- if [ $darwin_ver -lt 10 ]; then
- fat_bin_archs="$fat_bin_archs ppc32-${tgt_os}-gcc"
- fi
-
- # Tiger (10.4/darwin8) brought support for x86
- if [ $darwin_ver -ge 8 ]; then
- fat_bin_archs="$fat_bin_archs x86-${tgt_os}-${tgt_cc}"
- fi
-
- # Leopard (10.5/darwin9) brought 64 bit support
- if [ $darwin_ver -ge 9 ]; then
- fat_bin_archs="$fat_bin_archs x86_64-${tgt_os}-${tgt_cc}"
- fi
- ;;
- esac
-
-
- # Enable some useful compiler flags
- if enabled gcc; then
- enabled werror && check_add_cflags -Werror
- check_add_cflags -Wall
- check_add_cflags -Wdeclaration-after-statement
- check_add_cflags -Wdisabled-optimization
- check_add_cflags -Wpointer-arith
- check_add_cflags -Wtype-limits
- check_add_cflags -Wcast-qual
- check_add_cflags -Wvla
- check_add_cflags -Wimplicit-function-declaration
- check_add_cflags -Wuninitialized
- check_add_cflags -Wunused-variable
- case ${CC} in
- *clang*)
- # libvpx and/or clang have issues with aliasing:
- # https://code.google.com/p/webm/issues/detail?id=603
- # work around them until they are fixed
- check_add_cflags -fno-strict-aliasing
- ;;
- *) check_add_cflags -Wunused-but-set-variable ;;
- esac
- enabled extra_warnings || check_add_cflags -Wno-unused-function
- fi
-
- if enabled icc; then
- enabled werror && check_add_cflags -Werror
- check_add_cflags -Wall
- check_add_cflags -Wpointer-arith
-
- # ICC has a number of floating point optimizations that we disable
- # in favor of deterministic output WRT to other compilers
- add_cflags -fp-model precise
- fi
-
- # Enable extra, harmless warnings. These might provide additional insight
- # to what the compiler is doing and why, but in general, but they shouldn't
- # be treated as fatal, even if we're treating warnings as errors.
- GCC_EXTRA_WARNINGS="
- -Wdisabled-optimization
- -Winline
- "
- enabled gcc && EXTRA_WARNINGS="${GCC_EXTRA_WARNINGS}"
- RVCT_EXTRA_WARNINGS="
- --remarks
- "
- enabled rvct && EXTRA_WARNINGS="${RVCT_EXTRA_WARNINGS}"
- if enabled extra_warnings; then
- for w in ${EXTRA_WARNINGS}; do
- check_add_cflags ${w}
- enabled gcc && enabled werror && check_add_cflags -Wno-error=${w}
- done
- fi
-
- # ccache only really works on gcc toolchains
- enabled gcc || soft_disable ccache
- if enabled mips; then
- enable_feature dequant_tokens
- enable_feature dc_recon
- fi
-
- if enabled internal_stats; then
- enable_feature vp9_postproc
- fi
-
- # Enable the postbuild target if building for visual studio.
- case "$tgt_cc" in
- vs*) enable_feature msvs
- enable_feature solution
- vs_version=${tgt_cc##vs}
- case $vs_version in
- [789])
- VCPROJ_SFX=vcproj
- gen_vcproj_cmd=${source_path}/build/make/gen_msvs_proj.sh
- ;;
- 10|11|12)
- VCPROJ_SFX=vcxproj
- gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh
- enabled werror && gen_vcproj_cmd="${gen_vcproj_cmd} --enable-werror"
- ;;
- esac
- all_targets="${all_targets} solution"
- INLINE="__forceinline"
- ;;
- esac
-
- # Other toolchain specific defaults
- case $toolchain in x86*|ppc*|universal*) soft_enable postproc;; esac
-
- if enabled postproc_visualizer; then
- enabled postproc || die "postproc_visualizer requires postproc to be enabled"
- fi
-
- # Enable WebM IO by default.
- soft_enable webm_io
-
- # Enable unit tests by default if we have a working C++ compiler.
- case "$toolchain" in
- *-vs*)
- soft_enable unit_tests
- ;;
- *-android-*)
- # GTestLog must be modified to use Android logging utilities.
- ;;
- *-darwin-*)
- # iOS/ARM builds do not work with gtest. This does not match
- # x86 targets.
- ;;
- *-win*)
- # Some mingw toolchains don't have pthread available by default.
- # Treat these more like visual studio where threading in gtest
- # would be disabled for the same reason.
- check_cxx "$@" <<EOF && soft_enable unit_tests
-int z;
-EOF
- ;;
- *)
- enabled pthread_h && check_cxx "$@" <<EOF && soft_enable unit_tests
-int z;
-EOF
- ;;
- esac
-}
-
-
-##
-## END APPLICATION SPECIFIC CONFIGURATION
-##
-CONFIGURE_ARGS="$@"
-process "$@"
-print_webm_license ${BUILD_PFX}vpx_config.c "/*" " */"
-cat <<EOF >> ${BUILD_PFX}vpx_config.c
-static const char* const cfg = "$CONFIGURE_ARGS";
-const char *vpx_codec_build_config(void) {return cfg;}
-EOF
diff --git a/videocodec/libvpx_internal/libvpx/docs.mk b/videocodec/libvpx_internal/libvpx/docs.mk
deleted file mode 100644
index 797b466..0000000
--- a/videocodec/libvpx_internal/libvpx/docs.mk
+++ /dev/null
@@ -1,54 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-INSTALL_MAPS += docs/% docs/%
-INSTALL_MAPS += src/% %
-INSTALL_MAPS += % %
-
-# Static documentation authored in doxygen
-CODEC_DOX := mainpage.dox \
- keywords.dox \
- usage.dox \
- usage_cx.dox \
- usage_dx.dox \
-
-# Other doxy files sourced in Markdown
-TXT_DOX = $(call enabled,TXT_DOX)
-
-%.dox: %.txt
- @echo " [DOXY] $@"
- @$(SRC_PATH_BARE)/examples/gen_example_doxy.php \
- $(@:.dox=) "$($@.DESC)" > $@ < $<
-
-
-EXAMPLE_PATH += $(SRC_PATH_BARE) #for CHANGELOG, README, etc
-EXAMPLE_PATH += $(SRC_PATH_BARE)/examples
-
-doxyfile: $(if $(findstring examples, $(ALL_TARGETS)),examples.doxy)
-doxyfile: libs.doxy_template libs.doxy
- @echo " [CREATE] $@"
- @cat $^ > $@
- @echo "STRIP_FROM_PATH += $(SRC_PATH_BARE) $(BUILD_ROOT)" >> $@
- @echo "INPUT += $(addprefix $(SRC_PATH_BARE)/,$(CODEC_DOX))" >> $@;
- @echo "INPUT += $(TXT_DOX)" >> $@;
- @echo "EXAMPLE_PATH += $(EXAMPLE_PATH)" >> $@
-
-CLEAN-OBJS += doxyfile $(wildcard docs/html/*)
-docs/html/index.html: doxyfile $(CODEC_DOX) $(TXT_DOX)
- @echo " [DOXYGEN] $<"
- @doxygen $<
-DOCS-yes += docs/html/index.html
-
-DIST-DOCS-yes = $(wildcard docs/html/*)
-DIST-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX))
-DIST-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template
-DIST-DOCS-yes += CHANGELOG
-DIST-DOCS-yes += README
diff --git a/videocodec/libvpx_internal/libvpx/examples.mk b/videocodec/libvpx_internal/libvpx/examples.mk
deleted file mode 100644
index fa5d66c..0000000
--- a/videocodec/libvpx_internal/libvpx/examples.mk
+++ /dev/null
@@ -1,332 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-LIBYUV_SRCS += third_party/libyuv/include/libyuv/basic_types.h \
- third_party/libyuv/include/libyuv/cpu_id.h \
- third_party/libyuv/include/libyuv/scale.h \
- third_party/libyuv/source/row.h \
- third_party/libyuv/source/scale.c \
- third_party/libyuv/source/cpu_id.c
-
-# List of examples to build. UTILS are tools meant for distribution
-# while EXAMPLES demonstrate specific portions of the API.
-UTILS-$(CONFIG_DECODERS) += vpxdec.c
-vpxdec.SRCS += md5_utils.c md5_utils.h
-vpxdec.SRCS += vpx_ports/mem_ops.h
-vpxdec.SRCS += vpx_ports/mem_ops_aligned.h
-vpxdec.SRCS += vpx_ports/vpx_timer.h
-vpxdec.SRCS += vpx/vpx_integer.h
-vpxdec.SRCS += args.c args.h
-vpxdec.SRCS += ivfdec.c ivfdec.h
-vpxdec.SRCS += tools_common.c tools_common.h
-vpxdec.SRCS += y4menc.c y4menc.h
-vpxdec.SRCS += $(LIBYUV_SRCS)
-ifeq ($(CONFIG_WEBM_IO),yes)
- vpxdec.SRCS += third_party/nestegg/halloc/halloc.h
- vpxdec.SRCS += third_party/nestegg/halloc/src/align.h
- vpxdec.SRCS += third_party/nestegg/halloc/src/halloc.c
- vpxdec.SRCS += third_party/nestegg/halloc/src/hlist.h
- vpxdec.SRCS += third_party/nestegg/halloc/src/macros.h
- vpxdec.SRCS += third_party/nestegg/include/nestegg/nestegg.h
- vpxdec.SRCS += third_party/nestegg/src/nestegg.c
- vpxdec.SRCS += webmdec.c webmdec.h
-endif
-vpxdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
-vpxdec.DESCRIPTION = Full featured decoder
-UTILS-$(CONFIG_ENCODERS) += vpxenc.c
-vpxenc.SRCS += args.c args.h y4minput.c y4minput.h vpxenc.h
-vpxenc.SRCS += ivfdec.c ivfdec.h
-vpxenc.SRCS += ivfenc.c ivfenc.h
-vpxenc.SRCS += rate_hist.c rate_hist.h
-vpxenc.SRCS += tools_common.c tools_common.h
-vpxenc.SRCS += warnings.c warnings.h
-vpxenc.SRCS += vpx_ports/mem_ops.h
-vpxenc.SRCS += vpx_ports/mem_ops_aligned.h
-vpxenc.SRCS += vpx_ports/vpx_timer.h
-vpxenc.SRCS += vpxstats.c vpxstats.h
-vpxenc.SRCS += $(LIBYUV_SRCS)
-ifeq ($(CONFIG_WEBM_IO),yes)
- vpxenc.SRCS += third_party/libmkv/EbmlIDs.h
- vpxenc.SRCS += third_party/libmkv/EbmlWriter.c
- vpxenc.SRCS += third_party/libmkv/EbmlWriter.h
- vpxenc.SRCS += webmenc.c webmenc.h
-endif
-vpxenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
-vpxenc.DESCRIPTION = Full featured encoder
-EXAMPLES-$(CONFIG_VP9_ENCODER) += vp9_spatial_scalable_encoder.c
-vp9_spatial_scalable_encoder.SRCS += args.c args.h
-vp9_spatial_scalable_encoder.SRCS += ivfenc.c ivfenc.h
-vp9_spatial_scalable_encoder.SRCS += tools_common.c tools_common.h
-vp9_spatial_scalable_encoder.SRCS += video_common.h
-vp9_spatial_scalable_encoder.SRCS += video_writer.h video_writer.c
-vp9_spatial_scalable_encoder.SRCS += vpxstats.c vpxstats.h
-vp9_spatial_scalable_encoder.GUID = 4A38598D-627D-4505-9C7B-D4020C84100D
-vp9_spatial_scalable_encoder.DESCRIPTION = Spatial Scalable Encoder
-
-ifneq ($(CONFIG_SHARED),yes)
-EXAMPLES-$(CONFIG_VP9_ENCODER) += resize_util.c
-endif
-
-# XMA example disabled for now, not used in VP8
-#UTILS-$(CONFIG_DECODERS) += example_xma.c
-#example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022
-#example_xma.DESCRIPTION = External Memory Allocation mode usage
-
-EXAMPLES-$(CONFIG_ENCODERS) += vpx_temporal_scalable_patterns.c
-vpx_temporal_scalable_patterns.SRCS += ivfenc.c ivfenc.h
-vpx_temporal_scalable_patterns.SRCS += tools_common.c tools_common.h
-vpx_temporal_scalable_patterns.SRCS += video_common.h
-vpx_temporal_scalable_patterns.SRCS += video_writer.h video_writer.c
-vpx_temporal_scalable_patterns.GUID = B18C08F2-A439-4502-A78E-849BE3D60947
-vpx_temporal_scalable_patterns.DESCRIPTION = Temporal Scalability Encoder
-EXAMPLES-$(CONFIG_VP8_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
-simple_decoder.SRCS += video_common.h
-simple_decoder.SRCS += video_reader.h video_reader.c
-simple_decoder.SRCS += vpx_ports/mem_ops.h
-simple_decoder.SRCS += vpx_ports/mem_ops_aligned.h
-simple_decoder.DESCRIPTION = Simplified decoder loop
-EXAMPLES-$(CONFIG_VP8_DECODER) += postproc.c
-postproc.SRCS += ivfdec.h ivfdec.c
-postproc.SRCS += tools_common.h tools_common.c
-postproc.SRCS += video_common.h
-postproc.SRCS += video_reader.h video_reader.c
-postproc.SRCS += vpx_ports/mem_ops.h
-postproc.SRCS += vpx_ports/mem_ops_aligned.h
-postproc.GUID = 65E33355-F35E-4088-884D-3FD4905881D7
-postproc.DESCRIPTION = Decoder postprocessor control
-EXAMPLES-$(CONFIG_VP8_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
-decode_to_md5.SRCS += video_common.h
-decode_to_md5.SRCS += video_reader.h video_reader.c
-decode_to_md5.SRCS += vpx_ports/mem_ops.h
-decode_to_md5.SRCS += vpx_ports/mem_ops_aligned.h
-decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
-decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
-EXAMPLES-$(CONFIG_VP8_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
-simple_encoder.SRCS += video_writer.h video_writer.c
-simple_encoder.GUID = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
-simple_encoder.DESCRIPTION = Simplified encoder loop
-EXAMPLES-$(CONFIG_VP8_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
-twopass_encoder.SRCS += video_writer.h video_writer.c
-twopass_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
-twopass_encoder.DESCRIPTION = Two-pass encoder loop
-ifeq ($(CONFIG_DECODERS),yes)
-EXAMPLES-$(CONFIG_VP8_ENCODER) += 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
-decode_with_drops.SRCS += video_reader.h video_reader.c
-decode_with_drops.SRCS += vpx_ports/mem_ops.h
-decode_with_drops.SRCS += vpx_ports/mem_ops_aligned.h
-endif
-decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
-decode_with_drops.DESCRIPTION = Drops frames while decoding
-ifeq ($(CONFIG_VP8_DECODER),yes)
-EXAMPLES-$(CONFIG_ERROR_CONCEALMENT) += decode_with_partial_drops.c
-endif
-decode_with_partial_drops.GUID = 61C2D026-5754-46AC-916F-1343ECC5537E
-decode_with_partial_drops.DESCRIPTION = Drops parts of frames while decoding
-EXAMPLES-$(CONFIG_ENCODERS) += 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
-set_maps.SRCS += video_writer.h video_writer.c
-set_maps.GUID = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
-set_maps.DESCRIPTION = Set active and ROI maps
-EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8cx_set_ref.c
-vp8cx_set_ref.SRCS += ivfenc.h ivfenc.c
-vp8cx_set_ref.SRCS += tools_common.h tools_common.c
-vp8cx_set_ref.SRCS += video_common.h
-vp8cx_set_ref.SRCS += video_writer.h video_writer.c
-vp8cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
-vp8cx_set_ref.DESCRIPTION = VP8 set encoder reference frame
-
-
-ifeq ($(CONFIG_MULTI_RES_ENCODING),yes)
-EXAMPLES-$(CONFIG_VP8_DECODER) += vp8_multi_resolution_encoder.c
-vp8_multi_resolution_encoder.SRCS += $(LIBYUV_SRCS)
-vp8_multi_resolution_encoder.GUID = 04f8738e-63c8-423b-90fa-7c2703a374de
-vp8_multi_resolution_encoder.DESCRIPTION = VP8 Multiple-resolution Encoding
-endif
-
-# Handle extra library flags depending on codec configuration
-
-# We should not link to math library (libm) on RVCT
-# when building for bare-metal targets
-ifeq ($(CONFIG_OS_SUPPORT), yes)
-CODEC_EXTRA_LIBS-$(CONFIG_VP8) += m
-CODEC_EXTRA_LIBS-$(CONFIG_VP9) += m
-else
- ifeq ($(CONFIG_GCC), yes)
- CODEC_EXTRA_LIBS-$(CONFIG_VP8) += m
- CODEC_EXTRA_LIBS-$(CONFIG_VP9) += m
- endif
-endif
-#
-# End of specified files. The rest of the build rules should happen
-# automagically from here.
-#
-
-
-# Examples need different flags based on whether we're building
-# from an installed tree or a version controlled tree. Determine
-# the proper paths.
-ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
- LIB_PATH := $(SRC_PATH_BARE)/../lib
- INC_PATH := $(SRC_PATH_BARE)/../include
-else
- LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
- INC_PATH-$(CONFIG_VP8_DECODER) += $(SRC_PATH_BARE)/vp8
- INC_PATH-$(CONFIG_VP8_ENCODER) += $(SRC_PATH_BARE)/vp8
- INC_PATH-$(CONFIG_VP9_DECODER) += $(SRC_PATH_BARE)/vp9
- INC_PATH-$(CONFIG_VP9_ENCODER) += $(SRC_PATH_BARE)/vp9
- LIB_PATH := $(call enabled,LIB_PATH)
- INC_PATH := $(call enabled,INC_PATH)
-endif
-INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
-INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
-
-
-# Expand list of selected examples to build (as specified above)
-UTILS = $(call enabled,UTILS)
-EXAMPLES = $(addprefix examples/,$(call enabled,EXAMPLES))
-ALL_EXAMPLES = $(UTILS) $(EXAMPLES)
-UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
-ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(notdir $(ex:.c=)).SRCS))
-CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
-
-
-# Expand all example sources into a variable containing all sources
-# for that example (not just them main one specified in UTILS/EXAMPLES)
-# and add this file to the list (for MSVS workspace generation)
-$(foreach ex,$(ALL_EXAMPLES),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
-
-
-# If this is a universal (fat) binary, then all the subarchitectures have
-# already been built and our job is to stitch them together. The
-# BUILD_OBJS variable indicates whether we should be building
-# (compiling, linking) the library. The LIPO_OBJS variable indicates
-# that we're stitching.
-$(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_OBJS,BUILD_OBJS):=yes)
-
-
-# Create build/install dependencies for all examples. The common case
-# is handled here. The MSVS case is handled below.
-NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
-DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
-INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
-DIST-SRCS-yes += $(ALL_SRCS)
-INSTALL-SRCS-yes += $(UTIL_SRCS)
-OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
-BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
-
-
-# Instantiate linker template for all examples.
-CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
-SHARED_LIB_SUF=$(if $(filter darwin%,$(TGT_OS)),.dylib,.so)
-CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
-$(foreach bin,$(BINS-yes),\
- $(if $(BUILD_OBJS),$(eval $(bin):\
- $(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF)))\
- $(if $(BUILD_OBJS),$(eval $(call linker_template,$(bin),\
- $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
- -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
- )))\
- $(if $(LIPO_OBJS),$(eval $(call lipo_bin_template,$(bin))))\
- )
-
-
-# The following pairs define a mapping of locations in the distribution
-# tree to locations in the source/build trees.
-INSTALL_MAPS += src/%.c %.c
-INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
-INSTALL_MAPS += bin/% %
-INSTALL_MAPS += % %
-
-
-# Set up additional MSVS environment
-ifeq ($(CONFIG_MSVS),yes)
-CODEC_LIB=$(if $(CONFIG_SHARED),vpx,$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd))
-# This variable uses deferred expansion intentionally, since the results of
-# $(wildcard) may change during the course of the Make.
-VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
-INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/% $(p)/Release/%)
-endif
-
-# Build Visual Studio Projects. We use a template here to instantiate
-# explicit rules rather than using an implicit rule because we want to
-# leverage make's VPATH searching rather than specifying the paths on
-# each file in ALL_EXAMPLES. This has the unfortunate side effect that
-# touching the source files trigger a rebuild of the project files
-# even though there is no real dependency there (the dependency is on
-# the makefiles). We may want to revisit this.
-define vcproj_template
-$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
- @echo " [vcproj] $$@"
- $$(GEN_VCPROJ)\
- --exe\
- --target=$$(TOOLCHAIN)\
- --name=$$(@:.$(VCPROJ_SFX)=)\
- --ver=$$(CONFIG_VS_VERSION)\
- --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
- $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
- --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
- $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
-endef
-ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
-PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
-INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
- $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
-$(foreach proj,$(call enabled,PROJECTS),\
- $(eval $(call vcproj_template,$(proj))))
-
-#
-# Documentation Rules
-#
-%.dox: %.c
- @echo " [DOXY] $@"
- @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
- @echo " \includelineno $(<F)" >> $@
- @echo "*/" >> $@
-
-samples.dox: examples.mk
- @echo " [DOXY] $@"
- @echo "/*!\page samples Sample Code" > $@
- @echo " 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: ">>$@
- @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
- echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
- @echo >> $@
- @echo " 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:" >> $@
- @$(foreach ex,$(sort $(UTILS:.c=)),\
- echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
- @echo "*/" >> $@
-
-CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
-DOCS-yes += examples.doxy samples.dox
-examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
- @echo "INPUT += $^" > $@
diff --git a/videocodec/libvpx_internal/libvpx/examples/decode_to_md5.c b/videocodec/libvpx_internal/libvpx/examples/decode_to_md5.c
deleted file mode 100644
index 28d1ad5..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/decode_to_md5.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// Frame-by-frame MD5 Checksum
-// ===========================
-//
-// This example builds upon the simple decoder loop to show how checksums
-// of the decoded output can be generated. These are used for validating
-// decoder implementations against the reference implementation, for example.
-//
-// MD5 algorithm
-// -------------
-// The Message-Digest 5 (MD5) is a well known hash function. We have provided
-// an implementation derived from the RSA Data Security, Inc. MD5 Message-Digest
-// Algorithm for your use. Our implmentation only changes the interface of this
-// reference code. You must include the `md5_utils.h` header for access to these
-// functions.
-//
-// Processing The Decoded Data
-// ---------------------------
-// Each row of the image is passed to the MD5 accumulator. First the Y plane
-// is processed, then U, then V. It is important to honor the image's `stride`
-// values.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-
-#include "vpx/vp8dx.h"
-#include "vpx/vpx_decoder.h"
-
-#include "./md5_utils.h"
-#include "./tools_common.h"
-#include "./video_reader.h"
-#include "./vpx_config.h"
-
-static void get_image_md5(const vpx_image_t *img, unsigned char digest[16]) {
- int plane, y;
- MD5Context md5;
-
- MD5Init(&md5);
-
- for (plane = 0; plane < 3; ++plane) {
- const unsigned char *buf = img->planes[plane];
- const int stride = img->stride[plane];
- const int w = plane ? (img->d_w + 1) >> 1 : img->d_w;
- const int h = plane ? (img->d_h + 1) >> 1 : img->d_h;
-
- for (y = 0; y < h; ++y) {
- MD5Update(&md5, buf, w);
- buf += stride;
- }
- }
-
- MD5Final(digest, &md5);
-}
-
-static void print_md5(FILE *stream, unsigned char digest[16]) {
- int i;
-
- for (i = 0; i < 16; ++i)
- fprintf(stream, "%02x", digest[i]);
-}
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <infile> <outfile>\n", exec_name);
- exit(EXIT_FAILURE);
-}
-
-int main(int argc, char **argv) {
- int frame_cnt = 0;
- FILE *outfile = NULL;
- vpx_codec_ctx_t codec;
- VpxVideoReader *reader = NULL;
- const VpxVideoInfo *info = NULL;
- const VpxInterface *decoder = NULL;
-
- exec_name = argv[0];
-
- if (argc != 3)
- die("Invalid number of arguments.");
-
- reader = vpx_video_reader_open(argv[1]);
- if (!reader)
- die("Failed to open %s for reading.", argv[1]);
-
- if (!(outfile = fopen(argv[2], "wb")))
- die("Failed to open %s for writing.", argv[2]);
-
- info = vpx_video_reader_get_info(reader);
-
- decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
- if (!decoder)
- die("Unknown input codec.");
-
- printf("Using %s\n", vpx_codec_iface_name(decoder->interface()));
-
- if (vpx_codec_dec_init(&codec, decoder->interface(), NULL, 0))
- die_codec(&codec, "Failed to initialize decoder");
-
- while (vpx_video_reader_read_frame(reader)) {
- vpx_codec_iter_t iter = NULL;
- vpx_image_t *img = NULL;
- size_t frame_size = 0;
- const unsigned char *frame = vpx_video_reader_get_frame(reader,
- &frame_size);
- if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
- die_codec(&codec, "Failed to decode frame");
-
- while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
- unsigned char digest[16];
-
- get_image_md5(img, digest);
- print_md5(outfile, digest);
- fprintf(outfile, " img-%dx%d-%04d.i420\n",
- img->d_w, img->d_h, ++frame_cnt);
- }
- }
-
- printf("Processed %d frames.\n", frame_cnt);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec.");
-
- vpx_video_reader_close(reader);
-
- fclose(outfile);
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/decode_with_drops.c b/videocodec/libvpx_internal/libvpx/examples/decode_with_drops.c
deleted file mode 100644
index af1aa63..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/decode_with_drops.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// Decode With Drops Example
-// =========================
-//
-// This is an example utility which drops a series of frames, as specified
-// on the command line. This is useful for observing the error recovery
-// features of the codec.
-//
-// Usage
-// -----
-// This example adds a single argument to the `simple_decoder` example,
-// which specifies the range or pattern of frames to drop. The parameter is
-// parsed as follows:
-//
-// Dropping A Range Of Frames
-// --------------------------
-// To drop a range of frames, specify the starting frame and the ending
-// frame to drop, separated by a dash. The following command will drop
-// frames 5 through 10 (base 1).
-//
-// $ ./decode_with_drops in.ivf out.i420 5-10
-//
-//
-// Dropping A Pattern Of Frames
-// ----------------------------
-// To drop a pattern of frames, specify the number of frames to drop and
-// the number of frames after which to repeat the pattern, separated by
-// a forward-slash. The following command will drop 3 of 7 frames.
-// Specifically, it will decode 4 frames, then drop 3 frames, and then
-// repeat.
-//
-// $ ./decode_with_drops in.ivf out.i420 3/7
-//
-//
-// Extra Variables
-// ---------------
-// This example maintains the pattern passed on the command line in the
-// `n`, `m`, and `is_range` variables:
-//
-//
-// Making The Drop Decision
-// ------------------------
-// The example decides whether to drop the frame based on the current
-// frame number, immediately before decoding the frame.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-
-#include "vpx/vp8dx.h"
-#include "vpx/vpx_decoder.h"
-
-#include "./tools_common.h"
-#include "./video_reader.h"
-#include "./vpx_config.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <infile> <outfile> <N-M|N/M>\n", exec_name);
- exit(EXIT_FAILURE);
-}
-
-int main(int argc, char **argv) {
- int frame_cnt = 0;
- FILE *outfile = NULL;
- vpx_codec_ctx_t codec;
- const VpxInterface *decoder = NULL;
- VpxVideoReader *reader = NULL;
- const VpxVideoInfo *info = NULL;
- int n = 0;
- int m = 0;
- int is_range = 0;
- char *nptr = NULL;
-
- exec_name = argv[0];
-
- if (argc != 4)
- die("Invalid number of arguments.");
-
- reader = vpx_video_reader_open(argv[1]);
- if (!reader)
- die("Failed to open %s for reading.", argv[1]);
-
- if (!(outfile = fopen(argv[2], "wb")))
- die("Failed to open %s for writing.", argv[2]);
-
- n = strtol(argv[3], &nptr, 0);
- m = strtol(nptr + 1, NULL, 0);
- is_range = (*nptr == '-');
- if (!n || !m || (*nptr != '-' && *nptr != '/'))
- die("Couldn't parse pattern %s.\n", argv[3]);
-
- info = vpx_video_reader_get_info(reader);
-
- decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
- if (!decoder)
- die("Unknown input codec.");
-
- printf("Using %s\n", vpx_codec_iface_name(decoder->interface()));
-
- if (vpx_codec_dec_init(&codec, decoder->interface(), NULL, 0))
- die_codec(&codec, "Failed to initialize decoder.");
-
- while (vpx_video_reader_read_frame(reader)) {
- vpx_codec_iter_t iter = NULL;
- vpx_image_t *img = NULL;
- size_t frame_size = 0;
- int skip;
- const unsigned char *frame = vpx_video_reader_get_frame(reader,
- &frame_size);
- if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
- die_codec(&codec, "Failed to decode frame.");
-
- ++frame_cnt;
-
- skip = (is_range && frame_cnt >= n && frame_cnt <= m) ||
- (!is_range && m - (frame_cnt - 1) % m <= n);
-
- if (!skip) {
- putc('.', stdout);
-
- while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL)
- vpx_img_write(img, outfile);
- } else {
- putc('X', stdout);
- }
-
- fflush(stdout);
- }
-
- printf("Processed %d frames.\n", frame_cnt);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec.");
-
- printf("Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
- info->frame_width, info->frame_height, argv[2]);
-
- vpx_video_reader_close(reader);
- fclose(outfile);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/decode_with_partial_drops.c b/videocodec/libvpx_internal/libvpx/examples/decode_with_partial_drops.c
deleted file mode 100644
index d7132de..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/decode_with_partial_drops.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// Decode With Partial Drops Example
-// =========================
-//
-// This is an example utility which drops a series of frames (or parts of
-// frames), as specified on the command line. This is useful for observing the
-// error recovery features of the codec.
-//
-// Usage
-// -----
-// This example adds a single argument to the `simple_decoder` example,
-// which specifies the range or pattern of frames to drop. The parameter is
-// parsed as follows.
-//
-// Dropping A Range Of Frames
-// --------------------------
-// To drop a range of frames, specify the starting frame and the ending
-// frame to drop, separated by a dash. The following command will drop
-// frames 5 through 10 (base 1).
-//
-// $ ./decode_with_partial_drops in.ivf out.i420 5-10
-//
-//
-// Dropping A Pattern Of Frames
-// ----------------------------
-// To drop a pattern of frames, specify the number of frames to drop and
-// the number of frames after which to repeat the pattern, separated by
-// a forward-slash. The following command will drop 3 of 7 frames.
-// Specifically, it will decode 4 frames, then drop 3 frames, and then
-// repeat.
-//
-// $ ./decode_with_partial_drops in.ivf out.i420 3/7
-//
-// Dropping Random Parts Of Frames
-// -------------------------------
-// A third argument tuple is available to split the frame into 1500 bytes pieces
-// and randomly drop pieces rather than frames. The frame will be split at
-// partition boundaries where possible. The following example will seed the RNG
-// with the seed 123 and drop approximately 5% of the pieces. Pieces which
-// are depending on an already dropped piece will also be dropped.
-//
-// $ ./decode_with_partial_drops in.ivf out.i420 5,123
-//
-// Extra Variables
-// ---------------
-// This example maintains the pattern passed on the command line in the
-// `n`, `m`, and `is_range` variables:
-//
-// Making The Drop Decision
-// ------------------------
-// The example decides whether to drop the frame based on the current
-// frame number, immediately before decoding the frame.
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "./vpx_config.h"
-#include "vpx/vp8dx.h"
-#include "vpx/vpx_decoder.h"
-#define interface (vpx_codec_vp8_dx())
-#include <time.h>
-
-
-#define IVF_FILE_HDR_SZ (32)
-#define IVF_FRAME_HDR_SZ (12)
-
-static unsigned int mem_get_le32(const unsigned char *mem) {
- return (mem[3] << 24)|(mem[2] << 16)|(mem[1] << 8)|(mem[0]);
-}
-
-static void die(const char *fmt, ...) {
- va_list ap;
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- if(fmt[strlen(fmt)-1] != '\n')
- printf("\n");
- exit(EXIT_FAILURE);
-}
-
-static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
- const char *detail = vpx_codec_error_detail(ctx);
-
- printf("%s: %s\n", s, vpx_codec_error(ctx));
- if(detail)
- printf(" %s\n",detail);
- exit(EXIT_FAILURE);
-}
-
-struct parsed_header
-{
- char key_frame;
- int version;
- char show_frame;
- int first_part_size;
-};
-
-int next_packet(struct parsed_header* hdr, int pos, int length, int mtu)
-{
- int size = 0;
- int remaining = length - pos;
- /* Uncompressed part is 3 bytes for P frames and 10 bytes for I frames */
- int uncomp_part_size = (hdr->key_frame ? 10 : 3);
- /* number of bytes yet to send from header and the first partition */
- int remainFirst = uncomp_part_size + hdr->first_part_size - pos;
- if (remainFirst > 0)
- {
- if (remainFirst <= mtu)
- {
- size = remainFirst;
- }
- else
- {
- size = mtu;
- }
-
- return size;
- }
-
- /* second partition; just slot it up according to MTU */
- if (remaining <= mtu)
- {
- size = remaining;
- return size;
- }
- return mtu;
-}
-
-void throw_packets(unsigned char* frame, int* size, int loss_rate,
- int* thrown, int* kept)
-{
- unsigned char loss_frame[256*1024];
- int pkg_size = 1;
- int pos = 0;
- int loss_pos = 0;
- struct parsed_header hdr;
- unsigned int tmp;
- int mtu = 1500;
-
- if (*size < 3)
- {
- return;
- }
- putc('|', stdout);
- /* parse uncompressed 3 bytes */
- tmp = (frame[2] << 16) | (frame[1] << 8) | frame[0];
- hdr.key_frame = !(tmp & 0x1); /* inverse logic */
- hdr.version = (tmp >> 1) & 0x7;
- hdr.show_frame = (tmp >> 4) & 0x1;
- hdr.first_part_size = (tmp >> 5) & 0x7FFFF;
-
- /* don't drop key frames */
- if (hdr.key_frame)
- {
- int i;
- *kept = *size/mtu + ((*size % mtu > 0) ? 1 : 0); /* approximate */
- for (i=0; i < *kept; i++)
- putc('.', stdout);
- return;
- }
-
- while ((pkg_size = next_packet(&hdr, pos, *size, mtu)) > 0)
- {
- int loss_event = ((rand() + 1.0)/(RAND_MAX + 1.0) < loss_rate/100.0);
- if (*thrown == 0 && !loss_event)
- {
- memcpy(loss_frame + loss_pos, frame + pos, pkg_size);
- loss_pos += pkg_size;
- (*kept)++;
- putc('.', stdout);
- }
- else
- {
- (*thrown)++;
- putc('X', stdout);
- }
- pos += pkg_size;
- }
- memcpy(frame, loss_frame, loss_pos);
- memset(frame + loss_pos, 0, *size - loss_pos);
- *size = loss_pos;
-}
-
-int main(int argc, char **argv) {
- FILE *infile, *outfile;
- vpx_codec_ctx_t codec;
- int flags = 0, frame_cnt = 0;
- unsigned char file_hdr[IVF_FILE_HDR_SZ];
- unsigned char frame_hdr[IVF_FRAME_HDR_SZ];
- unsigned char frame[256*1024];
- vpx_codec_err_t res;
- int n, m, mode;
- unsigned int seed;
- int thrown=0, kept=0;
- int thrown_frame=0, kept_frame=0;
- vpx_codec_dec_cfg_t dec_cfg = {0};
-
- (void)res;
- /* Open files */
- if(argc < 4 || argc > 6)
- die("Usage: %s <infile> <outfile> [-t <num threads>] <N-M|N/M|L,S>\n",
- argv[0]);
- {
- char *nptr;
- int arg_num = 3;
- if (argc == 6 && strncmp(argv[arg_num++], "-t", 2) == 0)
- dec_cfg.threads = strtol(argv[arg_num++], NULL, 0);
- n = strtol(argv[arg_num], &nptr, 0);
- mode = (*nptr == '\0' || *nptr == ',') ? 2 : (*nptr == '-') ? 1 : 0;
-
- m = strtol(nptr+1, NULL, 0);
- if((!n && !m) || (*nptr != '-' && *nptr != '/' &&
- *nptr != '\0' && *nptr != ','))
- die("Couldn't parse pattern %s\n", argv[3]);
- }
- seed = (m > 0) ? m : (unsigned int)time(NULL);
- srand(seed);thrown_frame = 0;
- printf("Seed: %u\n", seed);
- printf("Threads: %d\n", dec_cfg.threads);
- if(!(infile = fopen(argv[1], "rb")))
- die("Failed to open %s for reading", argv[1]);
- if(!(outfile = fopen(argv[2], "wb")))
- die("Failed to open %s for writing", argv[2]);
-
- /* Read file header */
- if(!(fread(file_hdr, 1, IVF_FILE_HDR_SZ, infile) == IVF_FILE_HDR_SZ
- && file_hdr[0]=='D' && file_hdr[1]=='K' && file_hdr[2]=='I'
- && file_hdr[3]=='F'))
- die("%s is not an IVF file.", argv[1]);
-
- printf("Using %s\n",vpx_codec_iface_name(interface));
- /* Initialize codec */
- flags = VPX_CODEC_USE_ERROR_CONCEALMENT;
- res = vpx_codec_dec_init(&codec, interface, &dec_cfg, flags);
- if(res)
- die_codec(&codec, "Failed to initialize decoder");
-
-
- /* Read each frame */
- while(fread(frame_hdr, 1, IVF_FRAME_HDR_SZ, infile) == IVF_FRAME_HDR_SZ) {
- int frame_sz = mem_get_le32(frame_hdr);
- vpx_codec_iter_t iter = NULL;
- vpx_image_t *img;
-
-
- frame_cnt++;
- if(frame_sz > sizeof(frame))
- die("Frame %d data too big for example code buffer", frame_sz);
- if(fread(frame, 1, frame_sz, infile) != frame_sz)
- die("Frame %d failed to read complete frame", frame_cnt);
-
- /* Decide whether to throw parts of the frame or the whole frame
- depending on the drop mode */
- thrown_frame = 0;
- kept_frame = 0;
- switch (mode)
- {
- case 0:
- if (m - (frame_cnt-1)%m <= n)
- {
- frame_sz = 0;
- }
- break;
- case 1:
- if (frame_cnt >= n && frame_cnt <= m)
- {
- frame_sz = 0;
- }
- break;
- case 2:
- throw_packets(frame, &frame_sz, n, &thrown_frame, &kept_frame);
- break;
- default: break;
- }
- if (mode < 2)
- {
- if (frame_sz == 0)
- {
- putc('X', stdout);
- thrown_frame++;
- }
- else
- {
- putc('.', stdout);
- kept_frame++;
- }
- }
- thrown += thrown_frame;
- kept += kept_frame;
- fflush(stdout);
- /* Decode the frame */
- if(vpx_codec_decode(&codec, frame, frame_sz, NULL, 0))
- die_codec(&codec, "Failed to decode frame");
-
- /* Write decoded data to disk */
- while((img = vpx_codec_get_frame(&codec, &iter))) {
- unsigned int plane, y;
-
- for(plane=0; plane < 3; plane++) {
- unsigned char *buf =img->planes[plane];
-
- for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
- (void) fwrite(buf, 1, (plane ? (img->d_w + 1) >> 1 : img->d_w),
- outfile);
- buf += img->stride[plane];
- }
- }
- }
- }
- printf("Processed %d frames.\n",frame_cnt);
- if(vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec");
-
- fclose(outfile);
- fclose(infile);
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/example_xma.c b/videocodec/libvpx_internal/libvpx/examples/example_xma.c
deleted file mode 100644
index c960c28..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/example_xma.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This is a simple program showing how to initialize the decoder in XMA mode */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "vpx_config.h"
-#include "vpx/vpx_decoder.h"
-#include "vpx/vpx_integer.h"
-#if CONFIG_VP9_DECODER
-#include "vpx/vp8dx.h"
-#endif
-
-static char *exec_name;
-static int verbose = 0;
-
-static const struct {
- const char *name;
- vpx_codec_iface_t *iface;
-} ifaces[] = {
-#if CONFIG_VP9_DECODER
- {"vp9", &vpx_codec_vp8_dx_algo},
-#endif
-};
-
-static void usage_exit(void) {
- int i;
-
- printf("Usage: %s <options>\n\n"
- "Options:\n"
- "\t--codec <name>\tCodec to use (default=%s)\n"
- "\t-h <height>\tHeight of the simulated video frame, in pixels\n"
- "\t-w <width> \tWidth of the simulated video frame, in pixels\n"
- "\t-v \tVerbose mode (show individual segment sizes)\n"
- "\t--help \tShow this message\n"
- "\n"
- "Included decoders:\n"
- "\n",
- exec_name,
- ifaces[0].name);
-
- for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
- printf(" %-6s - %s\n",
- ifaces[i].name,
- vpx_codec_iface_name(ifaces[i].iface));
-
- exit(EXIT_FAILURE);
-}
-
-static void usage_error(const char *fmt, ...) {
- va_list ap;
- va_start(ap, fmt);
- vprintf(fmt, ap);
- printf("\n");
- usage_exit();
-}
-
-void my_mem_dtor(vpx_codec_mmap_t *mmap) {
- if (verbose)
- printf("freeing segment %d\n", mmap->id);
-
- free(mmap->priv);
-}
-
-int main(int argc, char **argv) {
- vpx_codec_ctx_t decoder;
- vpx_codec_iface_t *iface = ifaces[0].iface;
- vpx_codec_iter_t iter;
- vpx_codec_dec_cfg_t cfg;
- vpx_codec_err_t res = VPX_CODEC_OK;
- unsigned int alloc_sz = 0;
- unsigned int w = 352;
- unsigned int h = 288;
- int i;
-
- exec_name = argv[0];
-
- for (i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "--codec")) {
- if (i + 1 < argc) {
- int j, k = -1;
-
- i++;
-
- for (j = 0; j < sizeof(ifaces) / sizeof(ifaces[0]); j++)
- if (!strcmp(ifaces[j].name, argv[i]))
- k = j;
-
- if (k >= 0)
- iface = ifaces[k].iface;
- else
- usage_error("Error: Unrecognized argument (%s) to --codec\n",
- argv[i]);
- } else
- usage_error("Error: Option --codec requires argument.\n");
- } else if (!strcmp(argv[i], "-v"))
- verbose = 1;
- else if (!strcmp(argv[i], "-h"))
- if (i + 1 < argc) {
- h = atoi(argv[++i]);
- } else
- usage_error("Error: Option -h requires argument.\n");
- else if (!strcmp(argv[i], "-w"))
- if (i + 1 < argc) {
- w = atoi(argv[++i]);
- } else
- usage_error("Error: Option -w requires argument.\n");
- else if (!strcmp(argv[i], "--help"))
- usage_exit();
- else
- usage_error("Error: Unrecognized option %s\n\n", argv[i]);
- }
-
- if (argc == 1)
- printf("Using built-in defaults. For options, rerun with --help\n\n");
-
- /* XMA mode is not supported on all decoders! */
- if (!(vpx_codec_get_caps(iface) & VPX_CODEC_CAP_XMA)) {
- printf("%s does not support XMA mode!\n", vpx_codec_iface_name(iface));
- return EXIT_FAILURE;
- }
-
- /* The codec knows how much memory to allocate based on the size of the
- * encoded frames. This data can be parsed from the bitstream with
- * vpx_codec_peek_stream_info() if a bitstream is available. Otherwise,
- * a fixed size can be used that will be the upper limit on the frame
- * size the decoder can decode.
- */
- cfg.w = w;
- cfg.h = h;
-
- /* Initialize the decoder in XMA mode. */
- if (vpx_codec_dec_init(&decoder, iface, &cfg, VPX_CODEC_USE_XMA)) {
- printf("Failed to initialize decoder in XMA mode: %s\n",
- vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-
- /* Iterate through the list of memory maps, allocating them with the
- * requested alignment.
- */
- iter = NULL;
-
- do {
- vpx_codec_mmap_t mmap;
- unsigned int align;
-
- res = vpx_codec_get_mem_map(&decoder, &mmap, &iter);
- align = mmap.align ? mmap.align - 1 : 0;
-
- if (!res) {
- if (verbose)
- printf("Allocating segment %u, size %lu, align %u %s\n",
- mmap.id, mmap.sz, mmap.align,
- mmap.flags & VPX_CODEC_MEM_ZERO ? "(ZEROED)" : "");
-
- if (mmap.flags & VPX_CODEC_MEM_ZERO)
- mmap.priv = calloc(1, mmap.sz + align);
- else
- mmap.priv = malloc(mmap.sz + align);
-
- mmap.base = (void *)((((uintptr_t)mmap.priv) + align) &
- ~(uintptr_t)align);
- mmap.dtor = my_mem_dtor;
- alloc_sz += mmap.sz + align;
-
- if (vpx_codec_set_mem_map(&decoder, &mmap, 1)) {
- printf("Failed to set mmap: %s\n", vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
- } else if (res != VPX_CODEC_LIST_END) {
- printf("Failed to get mmap: %s\n", vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
- } while (res != VPX_CODEC_LIST_END);
-
- printf("%s\n %d bytes external memory required for %dx%d.\n",
- decoder.name, alloc_sz, cfg.w, cfg.h);
- vpx_codec_destroy(&decoder);
- return EXIT_SUCCESS;
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/postproc.c b/videocodec/libvpx_internal/libvpx/examples/postproc.c
deleted file mode 100644
index be08e92..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/postproc.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// Postprocessing Decoder
-// ======================
-//
-// This example adds postprocessing to the simple decoder loop.
-//
-// Initializing Postprocessing
-// ---------------------------
-// You must inform the codec that you might request postprocessing at
-// initialization time. This is done by passing the VPX_CODEC_USE_POSTPROC
-// flag to `vpx_codec_dec_init`. If the codec does not support
-// postprocessing, this call will return VPX_CODEC_INCAPABLE. For
-// demonstration purposes, we also fall back to default initialization if
-// the codec does not provide support.
-//
-// Using Adaptive Postprocessing
-// -----------------------------
-// VP6 provides "adaptive postprocessing." It will automatically select the
-// best postprocessing filter on a frame by frame basis based on the amount
-// of time remaining before the user's specified deadline expires. The
-// special value 0 indicates that the codec should take as long as
-// necessary to provide the best quality frame. This example gives the
-// codec 15ms (15000us) to return a frame. Remember that this is a soft
-// deadline, and the codec may exceed it doing its regular processing. In
-// these cases, no additional postprocessing will be done.
-//
-// Codec Specific Postprocessing Controls
-// --------------------------------------
-// Some codecs provide fine grained controls over their built-in
-// postprocessors. VP8 is one example. The following sample code toggles
-// postprocessing on and off every 15 frames.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-
-#include "vpx/vp8dx.h"
-#include "vpx/vpx_decoder.h"
-
-#include "./tools_common.h"
-#include "./video_reader.h"
-#include "./vpx_config.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <infile> <outfile>\n", exec_name);
- exit(EXIT_FAILURE);
-}
-
-int main(int argc, char **argv) {
- int frame_cnt = 0;
- FILE *outfile = NULL;
- vpx_codec_ctx_t codec;
- vpx_codec_err_t res;
- VpxVideoReader *reader = NULL;
- const VpxInterface *decoder = NULL;
- const VpxVideoInfo *info = NULL;
-
- exec_name = argv[0];
-
- if (argc != 3)
- die("Invalid number of arguments.");
-
- reader = vpx_video_reader_open(argv[1]);
- if (!reader)
- die("Failed to open %s for reading.", argv[1]);
-
- if (!(outfile = fopen(argv[2], "wb")))
- die("Failed to open %s for writing", argv[2]);
-
- info = vpx_video_reader_get_info(reader);
-
- decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
- if (!decoder)
- die("Unknown input codec.");
-
- printf("Using %s\n", vpx_codec_iface_name(decoder->interface()));
-
- res = vpx_codec_dec_init(&codec, decoder->interface(), NULL,
- VPX_CODEC_USE_POSTPROC);
- if (res == VPX_CODEC_INCAPABLE)
- die_codec(&codec, "Postproc not supported by this decoder.");
-
- if (res)
- die_codec(&codec, "Failed to initialize decoder.");
-
- while (vpx_video_reader_read_frame(reader)) {
- vpx_codec_iter_t iter = NULL;
- vpx_image_t *img = NULL;
- size_t frame_size = 0;
- const unsigned char *frame = vpx_video_reader_get_frame(reader,
- &frame_size);
-
- ++frame_cnt;
-
- if (frame_cnt % 30 == 1) {
- vp8_postproc_cfg_t pp = {0, 0, 0};
-
- if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp))
- die_codec(&codec, "Failed to turn off postproc.");
- } else if (frame_cnt % 30 == 16) {
- vp8_postproc_cfg_t pp = {VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE,
- 4, 0};
- if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp))
- die_codec(&codec, "Failed to turn on postproc.");
- };
-
- // Decode the frame with 15ms deadline
- if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 15000))
- die_codec(&codec, "Failed to decode frame");
-
- while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
- vpx_img_write(img, outfile);
- }
- }
-
- printf("Processed %d frames.\n", frame_cnt);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec");
-
- printf("Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
- info->frame_width, info->frame_height, argv[2]);
-
- vpx_video_reader_close(reader);
-
- fclose(outfile);
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/resize_util.c b/videocodec/libvpx_internal/libvpx/examples/resize_util.c
deleted file mode 100644
index b068f55..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/resize_util.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "./vp9/encoder/vp9_resize.h"
-
-static void usage(char *progname) {
- printf("Usage:\n");
- printf("%s <input_yuv> <width>x<height> <target_width>x<target_height> ",
- progname);
- printf("<output_yuv> [<frames>]\n");
-}
-
-static int parse_dim(char *v, int *width, int *height) {
- char *x = strchr(v, 'x');
- if (x == NULL)
- x = strchr(v, 'X');
- if (x == NULL)
- return 0;
- *width = atoi(v);
- *height = atoi(&x[1]);
- if (*width <= 0 || *height <= 0)
- return 0;
- else
- return 1;
-}
-
-int main(int argc, char *argv[]) {
- char *fin, *fout;
- FILE *fpin, *fpout;
- uint8_t *inbuf, *outbuf;
- uint8_t *inbuf_u, *outbuf_u;
- uint8_t *inbuf_v, *outbuf_v;
- int f, frames;
- int width, height, target_width, target_height;
-
- if (argc < 5) {
- printf("Incorrect parameters:\n");
- usage(argv[0]);
- return 1;
- }
-
- fin = argv[1];
- fout = argv[4];
- if (!parse_dim(argv[2], &width, &height)) {
- printf("Incorrect parameters: %s\n", argv[2]);
- usage(argv[0]);
- return 1;
- }
- if (!parse_dim(argv[3], &target_width, &target_height)) {
- printf("Incorrect parameters: %s\n", argv[3]);
- usage(argv[0]);
- return 1;
- }
-
- fpin = fopen(fin, "rb");
- if (fpin == NULL) {
- printf("Can't open file %s to read\n", fin);
- usage(argv[0]);
- return 1;
- }
- fpout = fopen(fout, "wb");
- if (fpout == NULL) {
- printf("Can't open file %s to write\n", fout);
- usage(argv[0]);
- return 1;
- }
- if (argc >= 6)
- frames = atoi(argv[5]);
- else
- frames = INT_MAX;
-
- printf("Input size: %dx%d\n",
- width, height);
- printf("Target size: %dx%d, Frames: ",
- target_width, target_height);
- if (frames == INT_MAX)
- printf("All\n");
- else
- printf("%d\n", frames);
-
- inbuf = (uint8_t*)malloc(width * height * 3 / 2);
- outbuf = (uint8_t*)malloc(target_width * target_height * 3 / 2);
- inbuf_u = inbuf + width * height;
- inbuf_v = inbuf_u + width * height / 4;
- outbuf_u = outbuf + target_width * target_height;
- outbuf_v = outbuf_u + target_width * target_height / 4;
- f = 0;
- while (f < frames) {
- if (fread(inbuf, width * height * 3 / 2, 1, fpin) != 1)
- break;
- vp9_resize_frame420(inbuf, width, inbuf_u, inbuf_v, width / 2,
- height, width,
- outbuf, target_width, outbuf_u, outbuf_v,
- target_width / 2,
- target_height, target_width);
- fwrite(outbuf, target_width * target_height * 3 / 2, 1, fpout);
- f++;
- }
- printf("%d frames processed\n", f);
- fclose(fpin);
- fclose(fpout);
-
- free(inbuf);
- free(outbuf);
- return 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/set_maps.c b/videocodec/libvpx_internal/libvpx/examples/set_maps.c
deleted file mode 100644
index 4343832..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/set_maps.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-// VP8 Set Active and ROI Maps
-// ===========================
-//
-// This is an example demonstrating how to control the VP8 encoder's
-// ROI and Active maps.
-//
-// ROI (Reigon of Interest) maps are a way for the application to assign
-// each macroblock in the image to a region, and then set quantizer and
-// filtering parameters on that image.
-//
-// Active maps are a way for the application to specify on a
-// macroblock-by-macroblock basis whether there is any activity in that
-// macroblock.
-//
-//
-// Configuration
-// -------------
-// An ROI map is set on frame 22. If the width of the image in macroblocks
-// is evenly divisble by 4, then the output will appear to have distinct
-// columns, where the quantizer, loopfilter, and static threshold differ
-// from column to column.
-//
-// An active map is set on frame 33. If the width of the image in macroblocks
-// is evenly divisble by 4, then the output will appear to have distinct
-// columns, where one column will have motion and the next will not.
-//
-// The active map is cleared on frame 44.
-//
-// Observing The Effects
-// ---------------------
-// Use the `simple_decoder` example to decode this sample, and observe
-// the change in the image at frames 22, 33, and 44.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
-
-#include "./tools_common.h"
-#include "./video_writer.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <codec> <width> <height> <infile> <outfile>\n",
- exec_name);
- exit(EXIT_FAILURE);
-}
-
-static void set_roi_map(const vpx_codec_enc_cfg_t *cfg,
- vpx_codec_ctx_t *codec) {
- unsigned int i;
- vpx_roi_map_t roi = {0};
-
- roi.rows = (cfg->g_h + 15) / 16;
- roi.cols = (cfg->g_w + 15) / 16;
-
- roi.delta_q[0] = 0;
- roi.delta_q[1] = -2;
- roi.delta_q[2] = -4;
- roi.delta_q[3] = -6;
-
- roi.delta_lf[0] = 0;
- roi.delta_lf[1] = 1;
- roi.delta_lf[2] = 2;
- roi.delta_lf[3] = 3;
-
- roi.static_threshold[0] = 1500;
- roi.static_threshold[1] = 1000;
- roi.static_threshold[2] = 500;
- roi.static_threshold[3] = 0;
-
- roi.roi_map = (uint8_t *)malloc(roi.rows * roi.cols);
- for (i = 0; i < roi.rows * roi.cols; ++i)
- roi.roi_map[i] = i % 4;
-
- if (vpx_codec_control(codec, VP8E_SET_ROI_MAP, &roi))
- die_codec(codec, "Failed to set ROI map");
-
- free(roi.roi_map);
-}
-
-static void set_active_map(const vpx_codec_enc_cfg_t *cfg,
- vpx_codec_ctx_t *codec) {
- unsigned int i;
- vpx_active_map_t map = {0};
-
- map.rows = (cfg->g_h + 15) / 16;
- map.cols = (cfg->g_w + 15) / 16;
-
- map.active_map = (uint8_t *)malloc(map.rows * map.cols);
- for (i = 0; i < map.rows * map.cols; ++i)
- map.active_map[i] = i % 2;
-
- if (vpx_codec_control(codec, VP8E_SET_ACTIVEMAP, &map))
- die_codec(codec, "Failed to set active map");
-
- free(map.active_map);
-}
-
-static void unset_active_map(const vpx_codec_enc_cfg_t *cfg,
- vpx_codec_ctx_t *codec) {
- vpx_active_map_t map = {0};
-
- map.rows = (cfg->g_h + 15) / 16;
- map.cols = (cfg->g_w + 15) / 16;
- map.active_map = NULL;
-
- if (vpx_codec_control(codec, VP8E_SET_ACTIVEMAP, &map))
- die_codec(codec, "Failed to set active map");
-}
-
-static void encode_frame(vpx_codec_ctx_t *codec,
- vpx_image_t *img,
- int frame_index,
- VpxVideoWriter *writer) {
- vpx_codec_iter_t iter = NULL;
- const vpx_codec_cx_pkt_t *pkt = NULL;
- const vpx_codec_err_t res = vpx_codec_encode(codec, img, frame_index, 1, 0,
- VPX_DL_GOOD_QUALITY);
- if (res != VPX_CODEC_OK)
- die_codec(codec, "Failed to encode frame");
-
- while ((pkt = vpx_codec_get_cx_data(codec, &iter)) != NULL) {
- if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
- const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
- if (!vpx_video_writer_write_frame(writer,
- pkt->data.frame.buf,
- pkt->data.frame.sz,
- pkt->data.frame.pts)) {
- die_codec(codec, "Failed to write compressed frame");
- }
-
- printf(keyframe ? "K" : ".");
- fflush(stdout);
- }
- }
-}
-
-int main(int argc, char **argv) {
- FILE *infile = NULL;
- vpx_codec_ctx_t codec = {0};
- vpx_codec_enc_cfg_t cfg = {0};
- int frame_count = 0;
- vpx_image_t raw = {0};
- vpx_codec_err_t res;
- VpxVideoInfo info = {0};
- VpxVideoWriter *writer = NULL;
- const VpxInterface *encoder = NULL;
- const int fps = 2; // TODO(dkovalev) add command line argument
- const double bits_per_pixel_per_frame = 0.067;
-
- exec_name = argv[0];
-
- if (argc != 6)
- die("Invalid number of arguments");
-
- encoder = get_vpx_encoder_by_name(argv[1]);
- if (!encoder)
- die("Unsupported codec.");
-
- info.codec_fourcc = encoder->fourcc;
- info.frame_width = strtol(argv[2], NULL, 0);
- info.frame_height = strtol(argv[3], NULL, 0);
- info.time_base.numerator = 1;
- info.time_base.denominator = fps;
-
- if (info.frame_width <= 0 ||
- info.frame_height <= 0 ||
- (info.frame_width % 2) != 0 ||
- (info.frame_height % 2) != 0) {
- die("Invalid frame size: %dx%d", info.frame_width, info.frame_height);
- }
-
- if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, info.frame_width,
- info.frame_height, 1)) {
- die("Failed to allocate image.");
- }
-
- printf("Using %s\n", vpx_codec_iface_name(encoder->interface()));
-
- res = vpx_codec_enc_config_default(encoder->interface(), &cfg, 0);
- if (res)
- die_codec(&codec, "Failed to get default codec config.");
-
- cfg.g_w = info.frame_width;
- cfg.g_h = info.frame_height;
- cfg.g_timebase.num = info.time_base.numerator;
- cfg.g_timebase.den = info.time_base.denominator;
- cfg.rc_target_bitrate = (unsigned int)(bits_per_pixel_per_frame * cfg.g_w *
- cfg.g_h * fps / 1000);
- cfg.g_lag_in_frames = 0;
-
- writer = vpx_video_writer_open(argv[5], kContainerIVF, &info);
- if (!writer)
- die("Failed to open %s for writing.", argv[5]);
-
- if (!(infile = fopen(argv[4], "rb")))
- die("Failed to open %s for reading.", argv[4]);
-
- if (vpx_codec_enc_init(&codec, encoder->interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
-
- while (vpx_img_read(&raw, infile)) {
- ++frame_count;
-
- if (frame_count == 22 && encoder->fourcc == VP8_FOURCC) {
- set_roi_map(&cfg, &codec);
- } else if (frame_count == 33) {
- set_active_map(&cfg, &codec);
- } else if (frame_count == 44) {
- unset_active_map(&cfg, &codec);
- }
-
- encode_frame(&codec, &raw, frame_count, writer);
- }
- encode_frame(&codec, NULL, -1, writer);
- printf("\n");
- fclose(infile);
- printf("Processed %d frames.\n", frame_count);
-
- vpx_img_free(&raw);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec.");
-
- vpx_video_writer_close(writer);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/simple_decoder.c b/videocodec/libvpx_internal/libvpx/examples/simple_decoder.c
deleted file mode 100644
index 8c15051..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/simple_decoder.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-// Simple Decoder
-// ==============
-//
-// This is an example of a simple decoder loop. It takes an input file
-// containing the compressed data (in IVF format), passes it through the
-// decoder, and writes the decompressed frames to disk. Other decoder
-// examples build upon this one.
-//
-// The details of the IVF format have been elided from this example for
-// simplicity of presentation, as IVF files will not generally be used by
-// your application. In general, an IVF file consists of a file header,
-// followed by a variable number of frames. Each frame consists of a frame
-// header followed by a variable length payload. The length of the payload
-// is specified in the first four bytes of the frame header. The payload is
-// the raw compressed data.
-//
-// Standard Includes
-// -----------------
-// For decoders, you only have to include `vpx_decoder.h` and then any
-// header files for the specific codecs you use. In this case, we're using
-// vp8. The `VPX_CODEC_DISABLE_COMPAT` macro can be defined to ensure
-// strict compliance with the latest SDK by disabling some backwards
-// compatibility features. Defining this macro is encouraged.
-//
-// Initializing The Codec
-// ----------------------
-// The decoder is initialized by the following code. This is an example for
-// the VP8 decoder, but the code is analogous for all algorithms. Replace
-// `vpx_codec_vp8_dx()` with a pointer to the interface exposed by the
-// algorithm you want to use. The `cfg` argument is left as NULL in this
-// example, because we want the algorithm to determine the stream
-// configuration (width/height) and allocate memory automatically. This
-// parameter is generally only used if you need to preallocate memory,
-// particularly in External Memory Allocation mode.
-//
-// Decoding A Frame
-// ----------------
-// Once the frame has been read into memory, it is decoded using the
-// `vpx_codec_decode` function. The call takes a pointer to the data
-// (`frame`) and the length of the data (`frame_sz`). No application data
-// is associated with the frame in this example, so the `user_priv`
-// parameter is NULL. The `deadline` parameter is left at zero for this
-// example. This parameter is generally only used when doing adaptive
-// postprocessing.
-//
-// Codecs may produce a variable number of output frames for every call to
-// `vpx_codec_decode`. These frames are retrieved by the
-// `vpx_codec_get_frame` iterator function. The iterator variable `iter` is
-// initialized to NULL each time `vpx_codec_decode` is called.
-// `vpx_codec_get_frame` is called in a loop, returning a pointer to a
-// decoded image or NULL to indicate the end of list.
-//
-// Processing The Decoded Data
-// ---------------------------
-// In this example, we simply write the encoded data to disk. It is
-// important to honor the image's `stride` values.
-//
-// Cleanup
-// -------
-// The `vpx_codec_destroy` call frees any memory allocated by the codec.
-//
-// Error Handling
-// --------------
-// This example does not special case any error return codes. If there was
-// an error, a descriptive message is printed and the program exits. With
-// few exeptions, vpx_codec functions return an enumerated error status,
-// with the value `0` indicating success.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-
-#include "vpx/vp8dx.h"
-#include "vpx/vpx_decoder.h"
-
-#include "./tools_common.h"
-#include "./video_reader.h"
-#include "./vpx_config.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <infile> <outfile>\n", exec_name);
- exit(EXIT_FAILURE);
-}
-
-int main(int argc, char **argv) {
- int frame_cnt = 0;
- FILE *outfile = NULL;
- vpx_codec_ctx_t codec;
- VpxVideoReader *reader = NULL;
- const VpxInterface *decoder = NULL;
- const VpxVideoInfo *info = NULL;
-
- exec_name = argv[0];
-
- if (argc != 3)
- die("Invalid number of arguments.");
-
- reader = vpx_video_reader_open(argv[1]);
- if (!reader)
- die("Failed to open %s for reading.", argv[1]);
-
- if (!(outfile = fopen(argv[2], "wb")))
- die("Failed to open %s for writing.", argv[2]);
-
- info = vpx_video_reader_get_info(reader);
-
- decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
- if (!decoder)
- die("Unknown input codec.");
-
- printf("Using %s\n", vpx_codec_iface_name(decoder->interface()));
-
- if (vpx_codec_dec_init(&codec, decoder->interface(), NULL, 0))
- die_codec(&codec, "Failed to initialize decoder.");
-
- while (vpx_video_reader_read_frame(reader)) {
- vpx_codec_iter_t iter = NULL;
- vpx_image_t *img = NULL;
- size_t frame_size = 0;
- const unsigned char *frame = vpx_video_reader_get_frame(reader,
- &frame_size);
- if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
- die_codec(&codec, "Failed to decode frame.");
-
- while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
- vpx_img_write(img, outfile);
- ++frame_cnt;
- }
- }
-
- printf("Processed %d frames.\n", frame_cnt);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec");
-
- printf("Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
- info->frame_width, info->frame_height, argv[2]);
-
- vpx_video_reader_close(reader);
-
- fclose(outfile);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/simple_encoder.c b/videocodec/libvpx_internal/libvpx/examples/simple_encoder.c
deleted file mode 100644
index af58091..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/simple_encoder.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// Simple Encoder
-// ==============
-//
-// This is an example of a simple encoder loop. It takes an input file in
-// YV12 format, passes it through the encoder, and writes the compressed
-// frames to disk in IVF format. Other decoder examples build upon this
-// one.
-//
-// The details of the IVF format have been elided from this example for
-// simplicity of presentation, as IVF files will not generally be used by
-// your application. In general, an IVF file consists of a file header,
-// followed by a variable number of frames. Each frame consists of a frame
-// header followed by a variable length payload. The length of the payload
-// is specified in the first four bytes of the frame header. The payload is
-// the raw compressed data.
-//
-// Standard Includes
-// -----------------
-// For encoders, you only have to include `vpx_encoder.h` and then any
-// header files for the specific codecs you use. In this case, we're using
-// vp8. The `VPX_CODEC_DISABLE_COMPAT` macro can be defined to ensure
-// strict compliance with the latest SDK by disabling some backwards
-// compatibility features. Defining this macro is encouraged.
-//
-// Getting The Default Configuration
-// ---------------------------------
-// Encoders have the notion of "usage profiles." For example, an encoder
-// may want to publish default configurations for both a video
-// conferencing application and a best quality offline encoder. These
-// obviously have very different default settings. Consult the
-// documentation for your codec to see if it provides any default
-// configurations. All codecs provide a default configuration, number 0,
-// which is valid for material in the vacinity of QCIF/QVGA.
-//
-// Updating The Configuration
-// ---------------------------------
-// Almost all applications will want to update the default configuration
-// with settings specific to their usage. Here we set the width and height
-// of the video file to that specified on the command line. We also scale
-// the default bitrate based on the ratio between the default resolution
-// and the resolution specified on the command line.
-//
-// Initializing The Codec
-// ----------------------
-// The encoder is initialized by the following code.
-//
-// Encoding A Frame
-// ----------------
-// The frame is read as a continuous block (size width * height * 3 / 2)
-// from the input file. If a frame was read (the input file has not hit
-// EOF) then the frame is passed to the encoder. Otherwise, a NULL
-// is passed, indicating the End-Of-Stream condition to the encoder. The
-// `frame_cnt` is reused as the presentation time stamp (PTS) and each
-// frame is shown for one frame-time in duration. The flags parameter is
-// unused in this example. The deadline is set to VPX_DL_REALTIME to
-// make the example run as quickly as possible.
-
-// Forced Keyframes
-// ----------------
-// Keyframes can be forced by setting the VPX_EFLAG_FORCE_KF bit of the
-// flags passed to `vpx_codec_control()`. In this example, we force a
-// keyframe every <keyframe-interval> frames. Note, the output stream can
-// contain additional keyframes beyond those that have been forced using the
-// VPX_EFLAG_FORCE_KF flag because of automatic keyframe placement by the
-// encoder.
-//
-// Processing The Encoded Data
-// ---------------------------
-// Each packet of type `VPX_CODEC_CX_FRAME_PKT` contains the encoded data
-// for this frame. We write a IVF frame header, followed by the raw data.
-//
-// Cleanup
-// -------
-// The `vpx_codec_destroy` call frees any memory allocated by the codec.
-//
-// Error Handling
-// --------------
-// This example does not special case any error return codes. If there was
-// an error, a descriptive message is printed and the program exits. With
-// few exeptions, vpx_codec functions return an enumerated error status,
-// with the value `0` indicating success.
-//
-// Error Resiliency Features
-// -------------------------
-// Error resiliency is controlled by the g_error_resilient member of the
-// configuration structure. Use the `decode_with_drops` example to decode with
-// frames 5-10 dropped. Compare the output for a file encoded with this example
-// versus one encoded with the `simple_encoder` example.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "vpx/vpx_encoder.h"
-
-#include "./tools_common.h"
-#include "./video_writer.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr,
- "Usage: %s <codec> <width> <height> <infile> <outfile> "
- "<keyframe-interval> [<error-resilient>]\nSee comments in "
- "simple_encoder.c for more information.\n",
- exec_name);
- exit(EXIT_FAILURE);
-}
-
-static void encode_frame(vpx_codec_ctx_t *codec,
- vpx_image_t *img,
- int frame_index,
- int flags,
- VpxVideoWriter *writer) {
- vpx_codec_iter_t iter = NULL;
- const vpx_codec_cx_pkt_t *pkt = NULL;
- const vpx_codec_err_t res = vpx_codec_encode(codec, img, frame_index, 1,
- flags, VPX_DL_GOOD_QUALITY);
- if (res != VPX_CODEC_OK)
- die_codec(codec, "Failed to encode frame");
-
- while ((pkt = vpx_codec_get_cx_data(codec, &iter)) != NULL) {
- if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
- const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
- if (!vpx_video_writer_write_frame(writer,
- pkt->data.frame.buf,
- pkt->data.frame.sz,
- pkt->data.frame.pts)) {
- die_codec(codec, "Failed to write compressed frame");
- }
-
- printf(keyframe ? "K" : ".");
- fflush(stdout);
- }
- }
-}
-
-int main(int argc, char **argv) {
- FILE *infile = NULL;
- vpx_codec_ctx_t codec;
- vpx_codec_enc_cfg_t cfg;
- int frame_count = 0;
- vpx_image_t raw;
- vpx_codec_err_t res;
- VpxVideoInfo info = {0};
- VpxVideoWriter *writer = NULL;
- const VpxInterface *encoder = NULL;
- const int fps = 30; // TODO(dkovalev) add command line argument
- const int bitrate = 200; // kbit/s TODO(dkovalev) add command line argument
- int keyframe_interval = 0;
-
- // TODO(dkovalev): Add some simple command line parsing code to make the
- // command line more flexible.
- const char *codec_arg = NULL;
- const char *width_arg = NULL;
- const char *height_arg = NULL;
- const char *infile_arg = NULL;
- const char *outfile_arg = NULL;
- const char *keyframe_interval_arg = NULL;
-
- exec_name = argv[0];
-
- if (argc < 7)
- die("Invalid number of arguments");
-
- codec_arg = argv[1];
- width_arg = argv[2];
- height_arg = argv[3];
- infile_arg = argv[4];
- outfile_arg = argv[5];
- keyframe_interval_arg = argv[6];
-
- encoder = get_vpx_encoder_by_name(codec_arg);
- if (!encoder)
- die("Unsupported codec.");
-
- info.codec_fourcc = encoder->fourcc;
- info.frame_width = strtol(width_arg, NULL, 0);
- info.frame_height = strtol(height_arg, NULL, 0);
- info.time_base.numerator = 1;
- info.time_base.denominator = fps;
-
- if (info.frame_width <= 0 ||
- info.frame_height <= 0 ||
- (info.frame_width % 2) != 0 ||
- (info.frame_height % 2) != 0) {
- die("Invalid frame size: %dx%d", info.frame_width, info.frame_height);
- }
-
- if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, info.frame_width,
- info.frame_height, 1)) {
- die("Failed to allocate image.");
- }
-
- keyframe_interval = strtol(keyframe_interval_arg, NULL, 0);
- if (keyframe_interval < 0)
- die("Invalid keyframe interval value.");
-
- printf("Using %s\n", vpx_codec_iface_name(encoder->interface()));
-
- res = vpx_codec_enc_config_default(encoder->interface(), &cfg, 0);
- if (res)
- die_codec(&codec, "Failed to get default codec config.");
-
- cfg.g_w = info.frame_width;
- cfg.g_h = info.frame_height;
- cfg.g_timebase.num = info.time_base.numerator;
- cfg.g_timebase.den = info.time_base.denominator;
- cfg.rc_target_bitrate = bitrate;
- cfg.g_error_resilient = argc > 7 ? strtol(argv[7], NULL, 0) : 0;
-
- writer = vpx_video_writer_open(outfile_arg, kContainerIVF, &info);
- if (!writer)
- die("Failed to open %s for writing.", outfile_arg);
-
- if (!(infile = fopen(infile_arg, "rb")))
- die("Failed to open %s for reading.", infile_arg);
-
- if (vpx_codec_enc_init(&codec, encoder->interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
-
- while (vpx_img_read(&raw, infile)) {
- int flags = 0;
- if (keyframe_interval > 0 && frame_count % keyframe_interval == 0)
- flags |= VPX_EFLAG_FORCE_KF;
- encode_frame(&codec, &raw, frame_count++, flags, writer);
- }
- encode_frame(&codec, NULL, -1, 0, writer); // flush the encoder
-
- printf("\n");
- fclose(infile);
- printf("Processed %d frames.\n", frame_count);
-
- vpx_img_free(&raw);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec.");
-
- vpx_video_writer_close(writer);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/twopass_encoder.c b/videocodec/libvpx_internal/libvpx/examples/twopass_encoder.c
deleted file mode 100644
index 8bca18c..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/twopass_encoder.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// Two Pass Encoder
-// ================
-//
-// This is an example of a two pass encoder loop. It takes an input file in
-// YV12 format, passes it through the encoder twice, and writes the compressed
-// frames to disk in IVF format. It builds upon the simple_encoder example.
-//
-// Twopass Variables
-// -----------------
-// Twopass mode needs to track the current pass number and the buffer of
-// statistics packets.
-//
-// Updating The Configuration
-// ---------------------------------
-// In two pass mode, the configuration has to be updated on each pass. The
-// statistics buffer is passed on the last pass.
-//
-// Encoding A Frame
-// ----------------
-// Encoding a frame in two pass mode is identical to the simple encoder
-// example, except the deadline is set to VPX_DL_BEST_QUALITY to get the
-// best quality possible. VPX_DL_GOOD_QUALITY could also be used.
-//
-//
-// Processing Statistics Packets
-// -----------------------------
-// Each packet of type `VPX_CODEC_CX_FRAME_PKT` contains the encoded data
-// for this frame. We write a IVF frame header, followed by the raw data.
-//
-//
-// Pass Progress Reporting
-// -----------------------------
-// It's sometimes helpful to see when each pass completes.
-//
-//
-// Clean-up
-// -----------------------------
-// Destruction of the encoder instance must be done on each pass. The
-// raw image should be destroyed at the end as usual.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "vpx/vpx_encoder.h"
-
-#include "./tools_common.h"
-#include "./video_writer.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <codec> <width> <height> <infile> <outfile>\n",
- exec_name);
- exit(EXIT_FAILURE);
-}
-
-static void get_frame_stats(vpx_codec_ctx_t *ctx,
- const vpx_image_t *img,
- vpx_codec_pts_t pts,
- unsigned int duration,
- vpx_enc_frame_flags_t flags,
- unsigned int deadline,
- vpx_fixed_buf_t *stats) {
- vpx_codec_iter_t iter = NULL;
- const vpx_codec_cx_pkt_t *pkt = NULL;
- const vpx_codec_err_t res = vpx_codec_encode(ctx, img, pts, duration, flags,
- deadline);
- if (res != VPX_CODEC_OK)
- die_codec(ctx, "Failed to get frame stats.");
-
- while ((pkt = vpx_codec_get_cx_data(ctx, &iter)) != NULL) {
- if (pkt->kind == VPX_CODEC_STATS_PKT) {
- const uint8_t *const pkt_buf = pkt->data.twopass_stats.buf;
- const size_t pkt_size = pkt->data.twopass_stats.sz;
- stats->buf = realloc(stats->buf, stats->sz + pkt_size);
- memcpy((uint8_t *)stats->buf + stats->sz, pkt_buf, pkt_size);
- stats->sz += pkt_size;
- }
- }
-}
-
-static void encode_frame(vpx_codec_ctx_t *ctx,
- const vpx_image_t *img,
- vpx_codec_pts_t pts,
- unsigned int duration,
- vpx_enc_frame_flags_t flags,
- unsigned int deadline,
- VpxVideoWriter *writer) {
- vpx_codec_iter_t iter = NULL;
- const vpx_codec_cx_pkt_t *pkt = NULL;
- const vpx_codec_err_t res = vpx_codec_encode(ctx, img, pts, duration, flags,
- deadline);
- if (res != VPX_CODEC_OK)
- die_codec(ctx, "Failed to encode frame.");
-
- while ((pkt = vpx_codec_get_cx_data(ctx, &iter)) != NULL) {
- if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
- const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
-
- if (!vpx_video_writer_write_frame(writer, pkt->data.frame.buf,
- pkt->data.frame.sz,
- pkt->data.frame.pts))
- die_codec(ctx, "Failed to write compressed frame.");
- printf(keyframe ? "K" : ".");
- fflush(stdout);
- }
- }
-}
-
-int main(int argc, char **argv) {
- FILE *infile = NULL;
- VpxVideoWriter *writer = NULL;
- vpx_codec_ctx_t codec;
- vpx_codec_enc_cfg_t cfg;
- vpx_image_t raw;
- vpx_codec_err_t res;
- vpx_fixed_buf_t stats = {0};
- VpxVideoInfo info = {0};
- const VpxInterface *encoder = NULL;
- int pass;
- const int fps = 30; // TODO(dkovalev) add command line argument
- const int bitrate = 200; // kbit/s TODO(dkovalev) add command line argument
- const char *const codec_arg = argv[1];
- const char *const width_arg = argv[2];
- const char *const height_arg = argv[3];
- const char *const infile_arg = argv[4];
- const char *const outfile_arg = argv[5];
- exec_name = argv[0];
-
- if (argc != 6)
- die("Invalid number of arguments.");
-
- encoder = get_vpx_encoder_by_name(codec_arg);
- if (!encoder)
- die("Unsupported codec.");
-
- info.codec_fourcc = encoder->fourcc;
- info.time_base.numerator = 1;
- info.time_base.denominator = fps;
- info.frame_width = strtol(width_arg, NULL, 0);
- info.frame_height = strtol(height_arg, NULL, 0);
-
- if (info.frame_width <= 0 ||
- info.frame_height <= 0 ||
- (info.frame_width % 2) != 0 ||
- (info.frame_height % 2) != 0) {
- die("Invalid frame size: %dx%d", info.frame_width, info.frame_height);
- }
-
- if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, info.frame_width,
- info.frame_height, 1)) {
- die("Failed to allocate image", info.frame_width, info.frame_height);
- }
-
- writer = vpx_video_writer_open(outfile_arg, kContainerIVF, &info);
- if (!writer)
- die("Failed to open %s for writing", outfile_arg);
-
- printf("Using %s\n", vpx_codec_iface_name(encoder->interface()));
-
- res = vpx_codec_enc_config_default(encoder->interface(), &cfg, 0);
- if (res)
- die_codec(&codec, "Failed to get default codec config.");
-
- cfg.g_w = info.frame_width;
- cfg.g_h = info.frame_height;
- cfg.g_timebase.num = info.time_base.numerator;
- cfg.g_timebase.den = info.time_base.denominator;
- cfg.rc_target_bitrate = bitrate;
-
- for (pass = 0; pass < 2; ++pass) {
- int frame_count = 0;
-
- if (pass == 0) {
- cfg.g_pass = VPX_RC_FIRST_PASS;
- } else {
- cfg.g_pass = VPX_RC_LAST_PASS;
- cfg.rc_twopass_stats_in = stats;
- }
-
- if (!(infile = fopen(infile_arg, "rb")))
- die("Failed to open %s for reading", infile_arg);
-
- if (vpx_codec_enc_init(&codec, encoder->interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
-
- while (vpx_img_read(&raw, infile)) {
- ++frame_count;
-
- if (pass == 0) {
- get_frame_stats(&codec, &raw, frame_count, 1, 0, VPX_DL_BEST_QUALITY,
- &stats);
- } else {
- encode_frame(&codec, &raw, frame_count, 1, 0, VPX_DL_BEST_QUALITY,
- writer);
- }
- }
-
- if (pass == 0) {
- get_frame_stats(&codec, NULL, frame_count, 1, 0, VPX_DL_BEST_QUALITY,
- &stats);
- } else {
- printf("\n");
- }
-
- fclose(infile);
- printf("Pass %d complete. Processed %d frames.\n", pass + 1, frame_count);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec.");
- }
-
- vpx_img_free(&raw);
- free(stats.buf);
-
- vpx_video_writer_close(writer);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/vp8_multi_resolution_encoder.c b/videocodec/libvpx_internal/libvpx/examples/vp8_multi_resolution_encoder.c
deleted file mode 100644
index 1fef7db..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/vp8_multi_resolution_encoder.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-/*
- * This is an example demonstrating multi-resolution encoding in VP8.
- * High-resolution input video is down-sampled to lower-resolutions. The
- * encoder then encodes the video and outputs multiple bitstreams with
- * different resolutions.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <math.h>
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "vpx/vpx_encoder.h"
-#include "vpx/vp8cx.h"
-#include "vpx_ports/mem_ops.h"
-#include "./tools_common.h"
-#define interface (vpx_codec_vp8_cx())
-#define fourcc 0x30385056
-
-#define IVF_FILE_HDR_SZ (32)
-#define IVF_FRAME_HDR_SZ (12)
-
-/*
- * The input video frame is downsampled several times to generate a multi-level
- * hierarchical structure. NUM_ENCODERS is defined as the number of encoding
- * levels required. For example, if the size of input video is 1280x720,
- * NUM_ENCODERS is 3, and down-sampling factor is 2, the encoder outputs 3
- * bitstreams with resolution of 1280x720(level 0), 640x360(level 1), and
- * 320x180(level 2) respectively.
- */
-#define NUM_ENCODERS 3
-
-/* This example uses the scaler function in libyuv. */
-#include "third_party/libyuv/include/libyuv/basic_types.h"
-#include "third_party/libyuv/include/libyuv/scale.h"
-#include "third_party/libyuv/include/libyuv/cpu_id.h"
-
-static void die(const char *fmt, ...) {
- va_list ap;
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- if(fmt[strlen(fmt)-1] != '\n')
- printf("\n");
- exit(EXIT_FAILURE);
-}
-
-static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
- const char *detail = vpx_codec_error_detail(ctx);
-
- printf("%s: %s\n", s, vpx_codec_error(ctx));
- if(detail)
- printf(" %s\n",detail);
- exit(EXIT_FAILURE);
-}
-
-int (*read_frame_p)(FILE *f, vpx_image_t *img);
-
-static int read_frame(FILE *f, vpx_image_t *img) {
- size_t nbytes, to_read;
- int res = 1;
-
- to_read = img->w*img->h*3/2;
- nbytes = fread(img->planes[0], 1, to_read, f);
- if(nbytes != to_read) {
- res = 0;
- if(nbytes > 0)
- printf("Warning: Read partial frame. Check your width & height!\n");
- }
- return res;
-}
-
-static int read_frame_by_row(FILE *f, vpx_image_t *img) {
- size_t nbytes, to_read;
- int res = 1;
- int plane;
-
- for (plane = 0; plane < 3; plane++)
- {
- unsigned char *ptr;
- int w = (plane ? (1 + img->d_w) / 2 : img->d_w);
- int h = (plane ? (1 + img->d_h) / 2 : img->d_h);
- int r;
-
- /* Determine the correct plane based on the image format. The for-loop
- * always counts in Y,U,V order, but this may not match the order of
- * the data on disk.
- */
- switch (plane)
- {
- case 1:
- ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12? VPX_PLANE_V : VPX_PLANE_U];
- break;
- case 2:
- ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12?VPX_PLANE_U : VPX_PLANE_V];
- break;
- default:
- ptr = img->planes[plane];
- }
-
- for (r = 0; r < h; r++)
- {
- to_read = w;
-
- nbytes = fread(ptr, 1, to_read, f);
- if(nbytes != to_read) {
- res = 0;
- if(nbytes > 0)
- printf("Warning: Read partial frame. Check your width & height!\n");
- break;
- }
-
- ptr += img->stride[plane];
- }
- if (!res)
- break;
- }
-
- return res;
-}
-
-static void write_ivf_file_header(FILE *outfile,
- const vpx_codec_enc_cfg_t *cfg,
- int frame_cnt) {
- char header[32];
-
- if(cfg->g_pass != VPX_RC_ONE_PASS && cfg->g_pass != VPX_RC_LAST_PASS)
- return;
- header[0] = 'D';
- header[1] = 'K';
- header[2] = 'I';
- header[3] = 'F';
- mem_put_le16(header+4, 0); /* version */
- mem_put_le16(header+6, 32); /* headersize */
- mem_put_le32(header+8, fourcc); /* headersize */
- mem_put_le16(header+12, cfg->g_w); /* width */
- mem_put_le16(header+14, cfg->g_h); /* height */
- mem_put_le32(header+16, cfg->g_timebase.den); /* rate */
- mem_put_le32(header+20, cfg->g_timebase.num); /* scale */
- mem_put_le32(header+24, frame_cnt); /* length */
- mem_put_le32(header+28, 0); /* unused */
-
- (void) fwrite(header, 1, 32, outfile);
-}
-
-static void write_ivf_frame_header(FILE *outfile,
- const vpx_codec_cx_pkt_t *pkt)
-{
- char header[12];
- vpx_codec_pts_t pts;
-
- if(pkt->kind != VPX_CODEC_CX_FRAME_PKT)
- return;
-
- pts = pkt->data.frame.pts;
- mem_put_le32(header, pkt->data.frame.sz);
- mem_put_le32(header+4, pts&0xFFFFFFFF);
- mem_put_le32(header+8, pts >> 32);
-
- (void) fwrite(header, 1, 12, outfile);
-}
-
-int main(int argc, char **argv)
-{
- FILE *infile, *outfile[NUM_ENCODERS];
- vpx_codec_ctx_t codec[NUM_ENCODERS];
- vpx_codec_enc_cfg_t cfg[NUM_ENCODERS];
- vpx_codec_pts_t frame_cnt = 0;
- vpx_image_t raw[NUM_ENCODERS];
- vpx_codec_err_t res[NUM_ENCODERS];
-
- int i;
- long width;
- long height;
- int frame_avail;
- int got_data;
- int flags = 0;
-
- /*Currently, only realtime mode is supported in multi-resolution encoding.*/
- int arg_deadline = VPX_DL_REALTIME;
-
- /* Set show_psnr to 1/0 to show/not show PSNR. Choose show_psnr=0 if you
- don't need to know PSNR, which will skip PSNR calculation and save
- encoding time. */
- int show_psnr = 0;
- uint64_t psnr_sse_total[NUM_ENCODERS] = {0};
- uint64_t psnr_samples_total[NUM_ENCODERS] = {0};
- double psnr_totals[NUM_ENCODERS][4] = {{0,0}};
- int psnr_count[NUM_ENCODERS] = {0};
-
- /* Set the required target bitrates for each resolution level.
- * If target bitrate for highest-resolution level is set to 0,
- * (i.e. target_bitrate[0]=0), we skip encoding at that level.
- */
- unsigned int target_bitrate[NUM_ENCODERS]={1000, 500, 100};
- /* Enter the frame rate of the input video */
- int framerate = 30;
- /* Set down-sampling factor for each resolution level.
- dsf[0] controls down sampling from level 0 to level 1;
- dsf[1] controls down sampling from level 1 to level 2;
- dsf[2] is not used. */
- vpx_rational_t dsf[NUM_ENCODERS] = {{2, 1}, {2, 1}, {1, 1}};
-
- if(argc!= (5+NUM_ENCODERS))
- die("Usage: %s <width> <height> <infile> <outfile(s)> <output psnr?>\n",
- argv[0]);
-
- printf("Using %s\n",vpx_codec_iface_name(interface));
-
- width = strtol(argv[1], NULL, 0);
- height = strtol(argv[2], NULL, 0);
-
- if(width < 16 || width%2 || height <16 || height%2)
- die("Invalid resolution: %ldx%ld", width, height);
-
- /* Open input video file for encoding */
- if(!(infile = fopen(argv[3], "rb")))
- die("Failed to open %s for reading", argv[3]);
-
- /* Open output file for each encoder to output bitstreams */
- for (i=0; i< NUM_ENCODERS; i++)
- {
- if(!target_bitrate[i])
- {
- outfile[i] = NULL;
- continue;
- }
-
- if(!(outfile[i] = fopen(argv[i+4], "wb")))
- die("Failed to open %s for writing", argv[i+4]);
- }
-
- show_psnr = strtol(argv[NUM_ENCODERS + 4], NULL, 0);
-
- /* Populate default encoder configuration */
- for (i=0; i< NUM_ENCODERS; i++)
- {
- res[i] = vpx_codec_enc_config_default(interface, &cfg[i], 0);
- if(res[i]) {
- printf("Failed to get config: %s\n", vpx_codec_err_to_string(res[i]));
- return EXIT_FAILURE;
- }
- }
-
- /*
- * Update the default configuration according to needs of the application.
- */
- /* Highest-resolution encoder settings */
- cfg[0].g_w = width;
- cfg[0].g_h = height;
- cfg[0].g_threads = 1; /* number of threads used */
- cfg[0].rc_dropframe_thresh = 30;
- cfg[0].rc_end_usage = VPX_CBR;
- cfg[0].rc_resize_allowed = 0;
- cfg[0].rc_min_quantizer = 4;
- cfg[0].rc_max_quantizer = 56;
- cfg[0].rc_undershoot_pct = 98;
- cfg[0].rc_overshoot_pct = 100;
- cfg[0].rc_buf_initial_sz = 500;
- cfg[0].rc_buf_optimal_sz = 600;
- cfg[0].rc_buf_sz = 1000;
- cfg[0].g_error_resilient = 1; /* Enable error resilient mode */
- cfg[0].g_lag_in_frames = 0;
-
- /* Disable automatic keyframe placement */
- /* Note: These 3 settings are copied to all levels. But, except the lowest
- * resolution level, all other levels are set to VPX_KF_DISABLED internally.
- */
- //cfg[0].kf_mode = VPX_KF_DISABLED;
- cfg[0].kf_mode = VPX_KF_AUTO;
- cfg[0].kf_min_dist = 3000;
- cfg[0].kf_max_dist = 3000;
-
- cfg[0].rc_target_bitrate = target_bitrate[0]; /* Set target bitrate */
- cfg[0].g_timebase.num = 1; /* Set fps */
- cfg[0].g_timebase.den = framerate;
-
- /* Other-resolution encoder settings */
- for (i=1; i< NUM_ENCODERS; i++)
- {
- memcpy(&cfg[i], &cfg[0], sizeof(vpx_codec_enc_cfg_t));
-
- cfg[i].g_threads = 1; /* number of threads used */
- cfg[i].rc_target_bitrate = target_bitrate[i];
-
- /* Note: Width & height of other-resolution encoders are calculated
- * from the highest-resolution encoder's size and the corresponding
- * down_sampling_factor.
- */
- {
- unsigned int iw = cfg[i-1].g_w*dsf[i-1].den + dsf[i-1].num - 1;
- unsigned int ih = cfg[i-1].g_h*dsf[i-1].den + dsf[i-1].num - 1;
- cfg[i].g_w = iw/dsf[i-1].num;
- cfg[i].g_h = ih/dsf[i-1].num;
- }
-
- /* Make width & height to be multiplier of 2. */
- // Should support odd size ???
- if((cfg[i].g_w)%2)cfg[i].g_w++;
- if((cfg[i].g_h)%2)cfg[i].g_h++;
- }
-
- /* Allocate image for each encoder */
- for (i=0; i< NUM_ENCODERS; i++)
- if(!vpx_img_alloc(&raw[i], VPX_IMG_FMT_I420, cfg[i].g_w, cfg[i].g_h, 32))
- die("Failed to allocate image", cfg[i].g_w, cfg[i].g_h);
-
- if (raw[0].stride[VPX_PLANE_Y] == raw[0].d_w)
- read_frame_p = read_frame;
- else
- read_frame_p = read_frame_by_row;
-
- for (i=0; i< NUM_ENCODERS; i++)
- if(outfile[i])
- write_ivf_file_header(outfile[i], &cfg[i], 0);
-
- /* Initialize multi-encoder */
- if(vpx_codec_enc_init_multi(&codec[0], interface, &cfg[0], NUM_ENCODERS,
- (show_psnr ? VPX_CODEC_USE_PSNR : 0), &dsf[0]))
- die_codec(&codec[0], "Failed to initialize encoder");
-
- /* The extra encoding configuration parameters can be set as follows. */
- /* Set encoding speed */
- for ( i=0; i<NUM_ENCODERS; i++)
- {
- int speed = -6;
- if(vpx_codec_control(&codec[i], VP8E_SET_CPUUSED, speed))
- die_codec(&codec[i], "Failed to set cpu_used");
- }
-
- /* Set static threshold. */
- for ( i=0; i<NUM_ENCODERS; i++)
- {
- unsigned int static_thresh = 1;
- if(vpx_codec_control(&codec[i], VP8E_SET_STATIC_THRESHOLD, static_thresh))
- die_codec(&codec[i], "Failed to set static threshold");
- }
-
- /* Set NOISE_SENSITIVITY to do TEMPORAL_DENOISING */
- /* Enable denoising for the highest-resolution encoder. */
- if(vpx_codec_control(&codec[0], VP8E_SET_NOISE_SENSITIVITY, 1))
- die_codec(&codec[0], "Failed to set noise_sensitivity");
- for ( i=1; i< NUM_ENCODERS; i++)
- {
- if(vpx_codec_control(&codec[i], VP8E_SET_NOISE_SENSITIVITY, 0))
- die_codec(&codec[i], "Failed to set noise_sensitivity");
- }
-
-
- frame_avail = 1;
- got_data = 0;
-
- while(frame_avail || got_data)
- {
- vpx_codec_iter_t iter[NUM_ENCODERS]={NULL};
- const vpx_codec_cx_pkt_t *pkt[NUM_ENCODERS];
-
- flags = 0;
- frame_avail = read_frame_p(infile, &raw[0]);
-
- if(frame_avail)
- {
- for ( i=1; i<NUM_ENCODERS; i++)
- {
- /*Scale the image down a number of times by downsampling factor*/
- /* FilterMode 1 or 2 give better psnr than FilterMode 0. */
- I420Scale(raw[i-1].planes[VPX_PLANE_Y], raw[i-1].stride[VPX_PLANE_Y],
- raw[i-1].planes[VPX_PLANE_U], raw[i-1].stride[VPX_PLANE_U],
- raw[i-1].planes[VPX_PLANE_V], raw[i-1].stride[VPX_PLANE_V],
- raw[i-1].d_w, raw[i-1].d_h,
- raw[i].planes[VPX_PLANE_Y], raw[i].stride[VPX_PLANE_Y],
- raw[i].planes[VPX_PLANE_U], raw[i].stride[VPX_PLANE_U],
- raw[i].planes[VPX_PLANE_V], raw[i].stride[VPX_PLANE_V],
- raw[i].d_w, raw[i].d_h, 1);
- }
- }
-
- /* Encode each frame at multi-levels */
- if(vpx_codec_encode(&codec[0], frame_avail? &raw[0] : NULL,
- frame_cnt, 1, flags, arg_deadline))
- die_codec(&codec[0], "Failed to encode frame");
-
- for (i=NUM_ENCODERS-1; i>=0 ; i--)
- {
- got_data = 0;
-
- while( (pkt[i] = vpx_codec_get_cx_data(&codec[i], &iter[i])) )
- {
- got_data = 1;
- switch(pkt[i]->kind) {
- case VPX_CODEC_CX_FRAME_PKT:
- write_ivf_frame_header(outfile[i], pkt[i]);
- (void) fwrite(pkt[i]->data.frame.buf, 1,
- pkt[i]->data.frame.sz, outfile[i]);
- break;
- case VPX_CODEC_PSNR_PKT:
- if (show_psnr)
- {
- int j;
-
- psnr_sse_total[i] += pkt[i]->data.psnr.sse[0];
- psnr_samples_total[i] += pkt[i]->data.psnr.samples[0];
- for (j = 0; j < 4; j++)
- {
- //fprintf(stderr, "%.3lf ", pkt[i]->data.psnr.psnr[j]);
- psnr_totals[i][j] += pkt[i]->data.psnr.psnr[j];
- }
- psnr_count[i]++;
- }
-
- break;
- default:
- break;
- }
- printf(pkt[i]->kind == VPX_CODEC_CX_FRAME_PKT
- && (pkt[i]->data.frame.flags & VPX_FRAME_IS_KEY)? "K":".");
- fflush(stdout);
- }
- }
- frame_cnt++;
- }
- printf("\n");
-
- fclose(infile);
-
- printf("Processed %ld frames.\n",(long int)frame_cnt-1);
- for (i=0; i< NUM_ENCODERS; i++)
- {
- /* Calculate PSNR and print it out */
- if ( (show_psnr) && (psnr_count[i]>0) )
- {
- int j;
- double ovpsnr = sse_to_psnr(psnr_samples_total[i], 255.0,
- psnr_sse_total[i]);
-
- fprintf(stderr, "\n ENC%d PSNR (Overall/Avg/Y/U/V)", i);
-
- fprintf(stderr, " %.3lf", ovpsnr);
- for (j = 0; j < 4; j++)
- {
- fprintf(stderr, " %.3lf", psnr_totals[i][j]/psnr_count[i]);
- }
- }
-
- if(vpx_codec_destroy(&codec[i]))
- die_codec(&codec[i], "Failed to destroy codec");
-
- vpx_img_free(&raw[i]);
-
- if(!outfile[i])
- continue;
-
- /* Try to rewrite the file header with the actual frame count */
- if(!fseek(outfile[i], 0, SEEK_SET))
- write_ivf_file_header(outfile[i], &cfg[i], frame_cnt-1);
- fclose(outfile[i]);
- }
- printf("\n");
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/vp8cx_set_ref.c b/videocodec/libvpx_internal/libvpx/examples/vp8cx_set_ref.c
deleted file mode 100644
index 9b6d11b..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/vp8cx_set_ref.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-// VP8 Set Reference Frame
-// =======================
-//
-// This is an example demonstrating how to overwrite the VP8 encoder's
-// internal reference frame. In the sample we set the last frame to the
-// current frame. If this is done at a cut scene it will avoid a keyframe.
-// This technique could be used to bounce between two cameras.
-//
-// Note that the decoder would also have to set the reference frame to the
-// same value on the same frame, or the video will become corrupt.
-//
-// Usage
-// -----
-// This example adds a single argument to the `simple_encoder` example,
-// which specifies the frame number to update the reference frame on.
-// The parameter is parsed as follows:
-//
-//
-// Extra Variables
-// ---------------
-// This example maintains the frame number passed on the command line
-// in the `update_frame_num` variable.
-//
-//
-// Configuration
-// -------------
-//
-// The reference frame is updated on the frame specified on the command
-// line.
-//
-// Observing The Effects
-// ---------------------
-// Use the `simple_encoder` example to encode a sample with a cut scene.
-// Determine the frame number of the cut scene by looking for a generated
-// key-frame (indicated by a 'K'). Supply that frame number as an argument
-// to this example, and observe that no key-frame is generated.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
-
-#include "./tools_common.h"
-#include "./video_writer.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <width> <height> <infile> <outfile> <frame>\n",
- exec_name);
- exit(EXIT_FAILURE);
-}
-
-static void encode_frame(vpx_codec_ctx_t *codec,
- vpx_image_t *img,
- int frame_index,
- VpxVideoWriter *writer) {
- vpx_codec_iter_t iter = NULL;
- const vpx_codec_cx_pkt_t *pkt = NULL;
- const vpx_codec_err_t res = vpx_codec_encode(codec, img, frame_index, 1, 0,
- VPX_DL_GOOD_QUALITY);
- if (res != VPX_CODEC_OK)
- die_codec(codec, "Failed to encode frame");
-
- while ((pkt = vpx_codec_get_cx_data(codec, &iter)) != NULL) {
- if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
- const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
- if (!vpx_video_writer_write_frame(writer,
- pkt->data.frame.buf,
- pkt->data.frame.sz,
- pkt->data.frame.pts)) {
- die_codec(codec, "Failed to write compressed frame");
- }
-
- printf(keyframe ? "K" : ".");
- fflush(stdout);
- }
- }
-}
-
-int main(int argc, char **argv) {
- FILE *infile = NULL;
- vpx_codec_ctx_t codec = {0};
- vpx_codec_enc_cfg_t cfg = {0};
- int frame_count = 0;
- vpx_image_t raw;
- vpx_codec_err_t res;
- VpxVideoInfo info = {0};
- VpxVideoWriter *writer = NULL;
- const VpxInterface *encoder = NULL;
- int update_frame_num = 0;
- const int fps = 30; // TODO(dkovalev) add command line argument
- const int bitrate = 200; // kbit/s TODO(dkovalev) add command line argument
-
- exec_name = argv[0];
-
- if (argc != 6)
- die("Invalid number of arguments");
-
- // TODO(dkovalev): add vp9 support and rename the file accordingly
- encoder = get_vpx_encoder_by_name("vp8");
- if (!encoder)
- die("Unsupported codec.");
-
- update_frame_num = atoi(argv[5]);
- if (!update_frame_num)
- die("Couldn't parse frame number '%s'\n", argv[5]);
-
- info.codec_fourcc = encoder->fourcc;
- info.frame_width = strtol(argv[1], NULL, 0);
- info.frame_height = strtol(argv[2], NULL, 0);
- info.time_base.numerator = 1;
- info.time_base.denominator = fps;
-
- if (info.frame_width <= 0 ||
- info.frame_height <= 0 ||
- (info.frame_width % 2) != 0 ||
- (info.frame_height % 2) != 0) {
- die("Invalid frame size: %dx%d", info.frame_width, info.frame_height);
- }
-
- if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, info.frame_width,
- info.frame_height, 1)) {
- die("Failed to allocate image.");
- }
-
- printf("Using %s\n", vpx_codec_iface_name(encoder->interface()));
-
- res = vpx_codec_enc_config_default(encoder->interface(), &cfg, 0);
- if (res)
- die_codec(&codec, "Failed to get default codec config.");
-
- cfg.g_w = info.frame_width;
- cfg.g_h = info.frame_height;
- cfg.g_timebase.num = info.time_base.numerator;
- cfg.g_timebase.den = info.time_base.denominator;
- cfg.rc_target_bitrate = bitrate;
-
- writer = vpx_video_writer_open(argv[4], kContainerIVF, &info);
- if (!writer)
- die("Failed to open %s for writing.", argv[4]);
-
- if (!(infile = fopen(argv[3], "rb")))
- die("Failed to open %s for reading.", argv[3]);
-
- if (vpx_codec_enc_init(&codec, encoder->interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
-
- while (vpx_img_read(&raw, infile)) {
- if (frame_count + 1 == update_frame_num) {
- vpx_ref_frame_t ref;
- ref.frame_type = VP8_LAST_FRAME;
- ref.img = raw;
- if (vpx_codec_control(&codec, VP8_SET_REFERENCE, &ref))
- die_codec(&codec, "Failed to set reference frame");
- }
-
- encode_frame(&codec, &raw, frame_count++, writer);
- }
- encode_frame(&codec, NULL, -1, writer);
-
- printf("\n");
- fclose(infile);
- printf("Processed %d frames.\n", frame_count);
-
- vpx_img_free(&raw);
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec.");
-
- vpx_video_writer_close(writer);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/vp9_spatial_scalable_encoder.c b/videocodec/libvpx_internal/libvpx/examples/vp9_spatial_scalable_encoder.c
deleted file mode 100644
index 64e62ef..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/vp9_spatial_scalable_encoder.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-/*
- * This is an example demonstrating how to implement a multi-layer
- * VP9 encoding scheme based on spatial scalability for video applications
- * that benefit from a scalable bitstream.
- */
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "./args.h"
-#include "./tools_common.h"
-#include "./video_writer.h"
-
-#include "vpx/svc_context.h"
-#include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
-#include "./vpxstats.h"
-
-static const struct arg_enum_list encoding_mode_enum[] = {
- {"i", INTER_LAYER_PREDICTION_I},
- {"alt-ip", ALT_INTER_LAYER_PREDICTION_IP},
- {"ip", INTER_LAYER_PREDICTION_IP},
- {"gf", USE_GOLDEN_FRAME},
- {NULL, 0}
-};
-
-static const arg_def_t encoding_mode_arg = ARG_DEF_ENUM(
- "m", "encoding-mode", 1, "Encoding mode algorithm", encoding_mode_enum);
-static const arg_def_t skip_frames_arg =
- ARG_DEF("s", "skip-frames", 1, "input frames to skip");
-static const arg_def_t frames_arg =
- ARG_DEF("f", "frames", 1, "number of frames to encode");
-static const arg_def_t width_arg = ARG_DEF("w", "width", 1, "source width");
-static const arg_def_t height_arg = ARG_DEF("h", "height", 1, "source height");
-static const arg_def_t timebase_arg =
- ARG_DEF("t", "timebase", 1, "timebase (num/den)");
-static const arg_def_t bitrate_arg = ARG_DEF(
- "b", "target-bitrate", 1, "encoding bitrate, in kilobits per second");
-static const arg_def_t layers_arg =
- ARG_DEF("l", "layers", 1, "number of SVC layers");
-static const arg_def_t kf_dist_arg =
- ARG_DEF("k", "kf-dist", 1, "number of frames between keyframes");
-static const arg_def_t scale_factors_arg =
- ARG_DEF("r", "scale-factors", 1, "scale factors (lowest to highest layer)");
-static const arg_def_t quantizers_arg =
- ARG_DEF("q", "quantizers", 1, "quantizers for non key frames, also will "
- "be applied to key frames if -qn is not specified (lowest to "
- "highest layer)");
-static const arg_def_t quantizers_keyframe_arg =
- ARG_DEF("qn", "quantizers-keyframe", 1, "quantizers for key frames (lowest "
- "to highest layer)");
-static const arg_def_t passes_arg =
- ARG_DEF("p", "passes", 1, "Number of passes (1/2)");
-static const arg_def_t pass_arg =
- ARG_DEF(NULL, "pass", 1, "Pass to execute (1/2)");
-static const arg_def_t fpf_name_arg =
- ARG_DEF(NULL, "fpf", 1, "First pass statistics file name");
-static const arg_def_t min_q_arg =
- ARG_DEF(NULL, "min-q", 1, "Minimum quantizer");
-static const arg_def_t max_q_arg =
- ARG_DEF(NULL, "max-q", 1, "Maximum quantizer");
-static const arg_def_t min_bitrate_arg =
- ARG_DEF(NULL, "min-bitrate", 1, "Minimum bitrate");
-static const arg_def_t max_bitrate_arg =
- ARG_DEF(NULL, "max-bitrate", 1, "Maximum bitrate");
-
-static const arg_def_t *svc_args[] = {
- &encoding_mode_arg, &frames_arg, &width_arg, &height_arg,
- &timebase_arg, &bitrate_arg, &skip_frames_arg, &layers_arg,
- &kf_dist_arg, &scale_factors_arg, &quantizers_arg,
- &quantizers_keyframe_arg, &passes_arg, &pass_arg,
- &fpf_name_arg, &min_q_arg, &max_q_arg, &min_bitrate_arg,
- &max_bitrate_arg, NULL
-};
-
-static const SVC_ENCODING_MODE default_encoding_mode =
- INTER_LAYER_PREDICTION_IP;
-static const uint32_t default_frames_to_skip = 0;
-static const uint32_t default_frames_to_code = 60 * 60;
-static const uint32_t default_width = 1920;
-static const uint32_t default_height = 1080;
-static const uint32_t default_timebase_num = 1;
-static const uint32_t default_timebase_den = 60;
-static const uint32_t default_bitrate = 1000;
-static const uint32_t default_spatial_layers = 5;
-static const uint32_t default_kf_dist = 100;
-
-typedef struct {
- const char *input_filename;
- const char *output_filename;
- uint32_t frames_to_code;
- uint32_t frames_to_skip;
- struct VpxInputContext input_ctx;
- stats_io_t rc_stats;
- int passes;
- int pass;
-} AppInput;
-
-static const char *exec_name;
-
-void usage_exit() {
- fprintf(stderr, "Usage: %s <options> input_filename output_filename\n",
- exec_name);
- fprintf(stderr, "Options:\n");
- arg_show_usage(stderr, svc_args);
- exit(EXIT_FAILURE);
-}
-
-static void parse_command_line(int argc, const char **argv_,
- AppInput *app_input, SvcContext *svc_ctx,
- vpx_codec_enc_cfg_t *enc_cfg) {
- struct arg arg = {0};
- char **argv = NULL;
- char **argi = NULL;
- char **argj = NULL;
- vpx_codec_err_t res;
- int passes = 0;
- int pass = 0;
- const char *fpf_file_name = NULL;
- unsigned int min_bitrate = 0;
- unsigned int max_bitrate = 0;
-
- // initialize SvcContext with parameters that will be passed to vpx_svc_init
- svc_ctx->log_level = SVC_LOG_DEBUG;
- svc_ctx->spatial_layers = default_spatial_layers;
- svc_ctx->encoding_mode = default_encoding_mode;
-
- // start with default encoder configuration
- res = vpx_codec_enc_config_default(vpx_codec_vp9_cx(), enc_cfg, 0);
- if (res) {
- die("Failed to get config: %s\n", vpx_codec_err_to_string(res));
- }
- // update enc_cfg with app default values
- enc_cfg->g_w = default_width;
- enc_cfg->g_h = default_height;
- enc_cfg->g_timebase.num = default_timebase_num;
- enc_cfg->g_timebase.den = default_timebase_den;
- enc_cfg->rc_target_bitrate = default_bitrate;
- enc_cfg->kf_min_dist = default_kf_dist;
- enc_cfg->kf_max_dist = default_kf_dist;
-
- // initialize AppInput with default values
- app_input->frames_to_code = default_frames_to_code;
- app_input->frames_to_skip = default_frames_to_skip;
-
- // process command line options
- argv = argv_dup(argc - 1, argv_ + 1);
- for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
- arg.argv_step = 1;
-
- if (arg_match(&arg, &encoding_mode_arg, argi)) {
- svc_ctx->encoding_mode = arg_parse_enum_or_int(&arg);
- } else if (arg_match(&arg, &frames_arg, argi)) {
- app_input->frames_to_code = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &width_arg, argi)) {
- enc_cfg->g_w = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &height_arg, argi)) {
- enc_cfg->g_h = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &timebase_arg, argi)) {
- enc_cfg->g_timebase = arg_parse_rational(&arg);
- } else if (arg_match(&arg, &bitrate_arg, argi)) {
- enc_cfg->rc_target_bitrate = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &skip_frames_arg, argi)) {
- app_input->frames_to_skip = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &layers_arg, argi)) {
- svc_ctx->spatial_layers = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &kf_dist_arg, argi)) {
- enc_cfg->kf_min_dist = arg_parse_uint(&arg);
- enc_cfg->kf_max_dist = enc_cfg->kf_min_dist;
- } else if (arg_match(&arg, &scale_factors_arg, argi)) {
- vpx_svc_set_scale_factors(svc_ctx, arg.val);
- } else if (arg_match(&arg, &quantizers_arg, argi)) {
- vpx_svc_set_quantizers(svc_ctx, arg.val, 0);
- } else if (arg_match(&arg, &quantizers_keyframe_arg, argi)) {
- vpx_svc_set_quantizers(svc_ctx, arg.val, 1);
- } else if (arg_match(&arg, &passes_arg, argi)) {
- passes = arg_parse_uint(&arg);
- if (passes < 1 || passes > 2) {
- die("Error: Invalid number of passes (%d)\n", passes);
- }
- } else if (arg_match(&arg, &pass_arg, argi)) {
- pass = arg_parse_uint(&arg);
- if (pass < 1 || pass > 2) {
- die("Error: Invalid pass selected (%d)\n", pass);
- }
- } else if (arg_match(&arg, &fpf_name_arg, argi)) {
- fpf_file_name = arg.val;
- } else if (arg_match(&arg, &min_q_arg, argi)) {
- enc_cfg->rc_min_quantizer = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &max_q_arg, argi)) {
- enc_cfg->rc_max_quantizer = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &min_bitrate_arg, argi)) {
- min_bitrate = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &max_bitrate_arg, argi)) {
- max_bitrate = arg_parse_uint(&arg);
- } else {
- ++argj;
- }
- }
-
- if (passes == 0 || passes == 1) {
- if (pass) {
- fprintf(stderr, "pass is ignored since there's only one pass\n");
- }
- enc_cfg->g_pass = VPX_RC_ONE_PASS;
- } else {
- if (pass == 0) {
- die("pass must be specified when passes is 2\n");
- }
-
- if (fpf_file_name == NULL) {
- die("fpf must be specified when passes is 2\n");
- }
-
- if (pass == 1) {
- enc_cfg->g_pass = VPX_RC_FIRST_PASS;
- if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 0)) {
- fatal("Failed to open statistics store");
- }
- } else {
- enc_cfg->g_pass = VPX_RC_LAST_PASS;
- if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 1)) {
- fatal("Failed to open statistics store");
- }
- enc_cfg->rc_twopass_stats_in = stats_get(&app_input->rc_stats);
- }
- app_input->passes = passes;
- app_input->pass = pass;
- }
-
- if (enc_cfg->rc_target_bitrate > 0) {
- if (min_bitrate > 0) {
- enc_cfg->rc_2pass_vbr_minsection_pct =
- min_bitrate * 100 / enc_cfg->rc_target_bitrate;
- }
- if (max_bitrate > 0) {
- enc_cfg->rc_2pass_vbr_maxsection_pct =
- max_bitrate * 100 / enc_cfg->rc_target_bitrate;
- }
- }
-
- // Check for unrecognized options
- for (argi = argv; *argi; ++argi)
- if (argi[0][0] == '-' && strlen(argi[0]) > 1)
- die("Error: Unrecognized option %s\n", *argi);
-
- if (argv[0] == NULL || argv[1] == 0) {
- usage_exit();
- }
- app_input->input_filename = argv[0];
- app_input->output_filename = argv[1];
- free(argv);
-
- if (enc_cfg->g_w < 16 || enc_cfg->g_w % 2 || enc_cfg->g_h < 16 ||
- enc_cfg->g_h % 2)
- die("Invalid resolution: %d x %d\n", enc_cfg->g_w, enc_cfg->g_h);
-
- printf(
- "Codec %s\nframes: %d, skip: %d\n"
- "mode: %d, layers: %d\n"
- "width %d, height: %d,\n"
- "num: %d, den: %d, bitrate: %d,\n"
- "gop size: %d\n",
- vpx_codec_iface_name(vpx_codec_vp9_cx()), app_input->frames_to_code,
- app_input->frames_to_skip, svc_ctx->encoding_mode,
- svc_ctx->spatial_layers, enc_cfg->g_w, enc_cfg->g_h,
- enc_cfg->g_timebase.num, enc_cfg->g_timebase.den,
- enc_cfg->rc_target_bitrate, enc_cfg->kf_max_dist);
-}
-
-int main(int argc, const char **argv) {
- AppInput app_input = {0};
- VpxVideoWriter *writer = NULL;
- VpxVideoInfo info = {0};
- vpx_codec_ctx_t codec;
- vpx_codec_enc_cfg_t enc_cfg;
- SvcContext svc_ctx;
- uint32_t i;
- uint32_t frame_cnt = 0;
- vpx_image_t raw;
- vpx_codec_err_t res;
- int pts = 0; /* PTS starts at 0 */
- int frame_duration = 1; /* 1 timebase tick per frame */
- FILE *infile = NULL;
- int end_of_stream = 0;
-
- memset(&svc_ctx, 0, sizeof(svc_ctx));
- svc_ctx.log_print = 1;
- exec_name = argv[0];
- parse_command_line(argc, argv, &app_input, &svc_ctx, &enc_cfg);
-
- // Allocate image buffer
- if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, enc_cfg.g_w, enc_cfg.g_h, 32))
- die("Failed to allocate image %dx%d\n", enc_cfg.g_w, enc_cfg.g_h);
-
- if (!(infile = fopen(app_input.input_filename, "rb")))
- die("Failed to open %s for reading\n", app_input.input_filename);
-
- // Initialize codec
- if (vpx_svc_init(&svc_ctx, &codec, vpx_codec_vp9_cx(), &enc_cfg) !=
- VPX_CODEC_OK)
- die("Failed to initialize encoder\n");
-
- info.codec_fourcc = VP9_FOURCC;
- info.time_base.numerator = enc_cfg.g_timebase.num;
- info.time_base.denominator = enc_cfg.g_timebase.den;
- if (vpx_svc_get_layer_resolution(&svc_ctx, svc_ctx.spatial_layers - 1,
- (unsigned int *)&info.frame_width,
- (unsigned int *)&info.frame_height) !=
- VPX_CODEC_OK) {
- die("Failed to get output resolution");
- }
-
- if (!(app_input.passes == 2 && app_input.pass == 1)) {
- // We don't save the bitstream for the 1st pass on two pass rate control
- writer = vpx_video_writer_open(app_input.output_filename, kContainerIVF,
- &info);
- if (!writer)
- die("Failed to open %s for writing\n", app_input.output_filename);
- }
-
- // skip initial frames
- for (i = 0; i < app_input.frames_to_skip; ++i)
- vpx_img_read(&raw, infile);
-
- // Encode frames
- while (!end_of_stream) {
- if (frame_cnt >= app_input.frames_to_code || !vpx_img_read(&raw, infile)) {
- // We need one extra vpx_svc_encode call at end of stream to flush
- // encoder and get remaining data
- end_of_stream = 1;
- }
-
- res = vpx_svc_encode(&svc_ctx, &codec, (end_of_stream ? NULL : &raw),
- pts, frame_duration, VPX_DL_REALTIME);
- printf("%s", vpx_svc_get_message(&svc_ctx));
- if (res != VPX_CODEC_OK) {
- die_codec(&codec, "Failed to encode frame");
- }
- if (!(app_input.passes == 2 && app_input.pass == 1)) {
- if (vpx_svc_get_frame_size(&svc_ctx) > 0) {
- vpx_video_writer_write_frame(writer,
- vpx_svc_get_buffer(&svc_ctx),
- vpx_svc_get_frame_size(&svc_ctx),
- pts);
- }
- }
- if (vpx_svc_get_rc_stats_buffer_size(&svc_ctx) > 0) {
- stats_write(&app_input.rc_stats,
- vpx_svc_get_rc_stats_buffer(&svc_ctx),
- vpx_svc_get_rc_stats_buffer_size(&svc_ctx));
- }
- if (!end_of_stream) {
- ++frame_cnt;
- pts += frame_duration;
- }
- }
-
- printf("Processed %d frames\n", frame_cnt);
-
- fclose(infile);
- if (vpx_codec_destroy(&codec)) die_codec(&codec, "Failed to destroy codec");
-
- if (app_input.passes == 2)
- stats_close(&app_input.rc_stats, 1);
-
- if (writer) {
- vpx_video_writer_close(writer);
- }
-
- vpx_img_free(&raw);
-
- // display average size, psnr
- printf("%s", vpx_svc_dump_statistics(&svc_ctx));
-
- vpx_svc_release(&svc_ctx);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/examples/vpx_temporal_scalable_patterns.c b/videocodec/libvpx_internal/libvpx/examples/vpx_temporal_scalable_patterns.c
deleted file mode 100644
index 5cb4ee9..0000000
--- a/videocodec/libvpx_internal/libvpx/examples/vpx_temporal_scalable_patterns.c
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// This is an example demonstrating how to implement a multi-layer VP9
-// encoding scheme based on temporal scalability for video applications
-// that benefit from a scalable bitstream.
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "./vpx_config.h"
-#include "vpx_ports/vpx_timer.h"
-#include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
-
-#include "./tools_common.h"
-#include "./video_writer.h"
-
-static const char *exec_name;
-
-void usage_exit() {
- exit(EXIT_FAILURE);
-}
-
-static int mode_to_num_layers[12] = {1, 2, 2, 3, 3, 3, 3, 5, 2, 3, 3, 3};
-
-// For rate control encoding stats.
-struct RateControlMetrics {
- // Number of input frames per layer.
- int layer_input_frames[VPX_TS_MAX_LAYERS];
- // Total (cumulative) number of encoded frames per layer.
- int layer_tot_enc_frames[VPX_TS_MAX_LAYERS];
- // Number of encoded non-key frames per layer.
- int layer_enc_frames[VPX_TS_MAX_LAYERS];
- // Framerate per layer layer (cumulative).
- double layer_framerate[VPX_TS_MAX_LAYERS];
- // Target average frame size per layer (per-frame-bandwidth per layer).
- double layer_pfb[VPX_TS_MAX_LAYERS];
- // Actual average frame size per layer.
- double layer_avg_frame_size[VPX_TS_MAX_LAYERS];
- // Average rate mismatch per layer (|target - actual| / target).
- double layer_avg_rate_mismatch[VPX_TS_MAX_LAYERS];
- // Actual encoding bitrate per layer (cumulative).
- double layer_encoding_bitrate[VPX_TS_MAX_LAYERS];
-};
-
-// Note: these rate control metrics assume only 1 key frame in the
-// sequence (i.e., first frame only). So for temporal pattern# 7
-// (which has key frame for every frame on base layer), the metrics
-// computation will be off/wrong.
-// TODO(marpan): Update these metrics to account for multiple key frames
-// in the stream.
-static void set_rate_control_metrics(struct RateControlMetrics *rc,
- vpx_codec_enc_cfg_t *cfg) {
- unsigned int i = 0;
- // Set the layer (cumulative) framerate and the target layer (non-cumulative)
- // per-frame-bandwidth, for the rate control encoding stats below.
- const double framerate = cfg->g_timebase.den / cfg->g_timebase.num;
- rc->layer_framerate[0] = framerate / cfg->ts_rate_decimator[0];
- rc->layer_pfb[0] = 1000.0 * cfg->ts_target_bitrate[0] /
- rc->layer_framerate[0];
- for (i = 0; i < cfg->ts_number_layers; ++i) {
- if (i > 0) {
- rc->layer_framerate[i] = framerate / cfg->ts_rate_decimator[i];
- rc->layer_pfb[i] = 1000.0 *
- (cfg->ts_target_bitrate[i] - cfg->ts_target_bitrate[i - 1]) /
- (rc->layer_framerate[i] - rc->layer_framerate[i - 1]);
- }
- rc->layer_input_frames[i] = 0;
- rc->layer_enc_frames[i] = 0;
- rc->layer_tot_enc_frames[i] = 0;
- rc->layer_encoding_bitrate[i] = 0.0;
- rc->layer_avg_frame_size[i] = 0.0;
- rc->layer_avg_rate_mismatch[i] = 0.0;
- }
-}
-
-static void printout_rate_control_summary(struct RateControlMetrics *rc,
- vpx_codec_enc_cfg_t *cfg,
- int frame_cnt) {
- unsigned int i = 0;
- int tot_num_frames = 0;
- printf("Total number of processed frames: %d\n\n", frame_cnt -1);
- printf("Rate control layer stats for %d layer(s):\n\n",
- cfg->ts_number_layers);
- for (i = 0; i < cfg->ts_number_layers; ++i) {
- const int num_dropped = (i > 0) ?
- (rc->layer_input_frames[i] - rc->layer_enc_frames[i]) :
- (rc->layer_input_frames[i] - rc->layer_enc_frames[i] - 1);
- tot_num_frames += rc->layer_input_frames[i];
- rc->layer_encoding_bitrate[i] = 0.001 * rc->layer_framerate[i] *
- rc->layer_encoding_bitrate[i] / tot_num_frames;
- rc->layer_avg_frame_size[i] = rc->layer_avg_frame_size[i] /
- rc->layer_enc_frames[i];
- rc->layer_avg_rate_mismatch[i] = 100.0 * rc->layer_avg_rate_mismatch[i] /
- rc->layer_enc_frames[i];
- printf("For layer#: %d \n", i);
- printf("Bitrate (target vs actual): %d %f \n", cfg->ts_target_bitrate[i],
- rc->layer_encoding_bitrate[i]);
- printf("Average frame size (target vs actual): %f %f \n", rc->layer_pfb[i],
- rc->layer_avg_frame_size[i]);
- printf("Average rate_mismatch: %f \n", rc->layer_avg_rate_mismatch[i]);
- printf("Number of input frames, encoded (non-key) frames, "
- "and perc dropped frames: %d %d %f \n", rc->layer_input_frames[i],
- rc->layer_enc_frames[i],
- 100.0 * num_dropped / rc->layer_input_frames[i]);
- printf("\n");
- }
- if ((frame_cnt - 1) != tot_num_frames)
- die("Error: Number of input frames not equal to output! \n");
-}
-
-// Temporal scaling parameters:
-// NOTE: The 3 prediction frames cannot be used interchangeably due to
-// differences in the way they are handled throughout the code. The
-// frames should be allocated to layers in the order LAST, GF, ARF.
-// Other combinations work, but may produce slightly inferior results.
-static void set_temporal_layer_pattern(int layering_mode,
- vpx_codec_enc_cfg_t *cfg,
- int *layer_flags,
- int *flag_periodicity) {
- switch (layering_mode) {
- case 0: {
- // 1-layer.
- int ids[1] = {0};
- cfg->ts_periodicity = 1;
- *flag_periodicity = 1;
- cfg->ts_number_layers = 1;
- cfg->ts_rate_decimator[0] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // Update L only.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF;
- break;
- }
- case 1: {
- // 2-layers, 2-frame period.
- int ids[2] = {0, 1};
- cfg->ts_periodicity = 2;
- *flag_periodicity = 2;
- cfg->ts_number_layers = 2;
- cfg->ts_rate_decimator[0] = 2;
- cfg->ts_rate_decimator[1] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
-#if 1
- // 0=L, 1=GF, Intra-layer prediction enabled.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF;
- layer_flags[1] = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_REF_ARF;
-#else
- // 0=L, 1=GF, Intra-layer prediction disabled.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF;
- layer_flags[1] = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_REF_LAST;
-#endif
- break;
- }
- case 2: {
- // 2-layers, 3-frame period.
- int ids[3] = {0, 1, 1};
- cfg->ts_periodicity = 3;
- *flag_periodicity = 3;
- cfg->ts_number_layers = 2;
- cfg->ts_rate_decimator[0] = 3;
- cfg->ts_rate_decimator[1] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, Intra-layer prediction enabled.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[1] =
- layer_flags[2] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
- VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
- break;
- }
- case 3: {
- // 3-layers, 6-frame period.
- int ids[6] = {0, 2, 2, 1, 2, 2};
- cfg->ts_periodicity = 6;
- *flag_periodicity = 6;
- cfg->ts_number_layers = 3;
- cfg->ts_rate_decimator[0] = 6;
- cfg->ts_rate_decimator[1] = 3;
- cfg->ts_rate_decimator[2] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, 2=ARF, Intra-layer prediction enabled.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[3] = VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_UPD_LAST;
- layer_flags[1] =
- layer_flags[2] =
- layer_flags[4] =
- layer_flags[5] = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST;
- break;
- }
- case 4: {
- // 3-layers, 4-frame period.
- int ids[4] = {0, 2, 1, 2};
- cfg->ts_periodicity = 4;
- *flag_periodicity = 4;
- cfg->ts_number_layers = 3;
- cfg->ts_rate_decimator[0] = 4;
- cfg->ts_rate_decimator[1] = 2;
- cfg->ts_rate_decimator[2] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, 2=ARF, Intra-layer prediction disabled.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[2] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
- VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
- layer_flags[1] =
- layer_flags[3] = VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- break;
- }
- case 5: {
- // 3-layers, 4-frame period.
- int ids[4] = {0, 2, 1, 2};
- cfg->ts_periodicity = 4;
- *flag_periodicity = 4;
- cfg->ts_number_layers = 3;
- cfg->ts_rate_decimator[0] = 4;
- cfg->ts_rate_decimator[1] = 2;
- cfg->ts_rate_decimator[2] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, 2=ARF, Intra-layer prediction enabled in layer 1, disabled
- // in layer 2.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[2] = VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_ARF;
- layer_flags[1] =
- layer_flags[3] = VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- break;
- }
- case 6: {
- // 3-layers, 4-frame period.
- int ids[4] = {0, 2, 1, 2};
- cfg->ts_periodicity = 4;
- *flag_periodicity = 4;
- cfg->ts_number_layers = 3;
- cfg->ts_rate_decimator[0] = 4;
- cfg->ts_rate_decimator[1] = 2;
- cfg->ts_rate_decimator[2] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, 2=ARF, Intra-layer prediction enabled.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[2] = VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_ARF;
- layer_flags[1] =
- layer_flags[3] = VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF;
- break;
- }
- case 7: {
- // NOTE: Probably of academic interest only.
- // 5-layers, 16-frame period.
- int ids[16] = {0, 4, 3, 4, 2, 4, 3, 4, 1, 4, 3, 4, 2, 4, 3, 4};
- cfg->ts_periodicity = 16;
- *flag_periodicity = 16;
- cfg->ts_number_layers = 5;
- cfg->ts_rate_decimator[0] = 16;
- cfg->ts_rate_decimator[1] = 8;
- cfg->ts_rate_decimator[2] = 4;
- cfg->ts_rate_decimator[3] = 2;
- cfg->ts_rate_decimator[4] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- layer_flags[0] = VPX_EFLAG_FORCE_KF;
- layer_flags[1] =
- layer_flags[3] =
- layer_flags[5] =
- layer_flags[7] =
- layer_flags[9] =
- layer_flags[11] =
- layer_flags[13] =
- layer_flags[15] = VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF;
- layer_flags[2] =
- layer_flags[6] =
- layer_flags[10] =
- layer_flags[14] = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_GF;
- layer_flags[4] =
- layer_flags[12] = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[8] = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF;
- break;
- }
- case 8: {
- // 2-layers, with sync point at first frame of layer 1.
- int ids[2] = {0, 1};
- cfg->ts_periodicity = 2;
- *flag_periodicity = 8;
- cfg->ts_number_layers = 2;
- cfg->ts_rate_decimator[0] = 2;
- cfg->ts_rate_decimator[1] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF.
- // ARF is used as predictor for all frames, and is only updated on
- // key frame. Sync point every 8 frames.
-
- // Layer 0: predict from L and ARF, update L and G.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_UPD_ARF;
- // Layer 1: sync point: predict from L and ARF, and update G.
- layer_flags[1] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_ARF;
- // Layer 0, predict from L and ARF, update L.
- layer_flags[2] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF;
- // Layer 1: predict from L, G and ARF, and update G.
- layer_flags[3] = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_ENTROPY;
- // Layer 0.
- layer_flags[4] = layer_flags[2];
- // Layer 1.
- layer_flags[5] = layer_flags[3];
- // Layer 0.
- layer_flags[6] = layer_flags[4];
- // Layer 1.
- layer_flags[7] = layer_flags[5];
- break;
- }
- case 9: {
- // 3-layers: Sync points for layer 1 and 2 every 8 frames.
- int ids[4] = {0, 2, 1, 2};
- cfg->ts_periodicity = 4;
- *flag_periodicity = 8;
- cfg->ts_number_layers = 3;
- cfg->ts_rate_decimator[0] = 4;
- cfg->ts_rate_decimator[1] = 2;
- cfg->ts_rate_decimator[2] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, 2=ARF.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[1] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
- VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF;
- layer_flags[2] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
- VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[3] =
- layer_flags[5] = VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF;
- layer_flags[4] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
- VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
- layer_flags[6] = VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_ARF;
- layer_flags[7] = VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_ENTROPY;
- break;
- }
- case 10: {
- // 3-layers structure where ARF is used as predictor for all frames,
- // and is only updated on key frame.
- // Sync points for layer 1 and 2 every 8 frames.
-
- int ids[4] = {0, 2, 1, 2};
- cfg->ts_periodicity = 4;
- *flag_periodicity = 8;
- cfg->ts_number_layers = 3;
- cfg->ts_rate_decimator[0] = 4;
- cfg->ts_rate_decimator[1] = 2;
- cfg->ts_rate_decimator[2] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, 2=ARF.
- // Layer 0: predict from L and ARF; update L and G.
- layer_flags[0] = VPX_EFLAG_FORCE_KF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_REF_GF;
- // Layer 2: sync point: predict from L and ARF; update none.
- layer_flags[1] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_ENTROPY;
- // Layer 1: sync point: predict from L and ARF; update G.
- layer_flags[2] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_UPD_LAST;
- // Layer 2: predict from L, G, ARF; update none.
- layer_flags[3] = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_ENTROPY;
- // Layer 0: predict from L and ARF; update L.
- layer_flags[4] = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_REF_GF;
- // Layer 2: predict from L, G, ARF; update none.
- layer_flags[5] = layer_flags[3];
- // Layer 1: predict from L, G, ARF; update G.
- layer_flags[6] = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
- // Layer 2: predict from L, G, ARF; update none.
- layer_flags[7] = layer_flags[3];
- break;
- }
- case 11:
- default: {
- // 3-layers structure as in case 10, but no sync/refresh points for
- // layer 1 and 2.
- int ids[4] = {0, 2, 1, 2};
- cfg->ts_periodicity = 4;
- *flag_periodicity = 8;
- cfg->ts_number_layers = 3;
- cfg->ts_rate_decimator[0] = 4;
- cfg->ts_rate_decimator[1] = 2;
- cfg->ts_rate_decimator[2] = 1;
- memcpy(cfg->ts_layer_id, ids, sizeof(ids));
- // 0=L, 1=GF, 2=ARF.
- // Layer 0: predict from L and ARF; update L.
- layer_flags[0] = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_REF_GF;
- layer_flags[4] = layer_flags[0];
- // Layer 1: predict from L, G, ARF; update G.
- layer_flags[2] = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
- layer_flags[6] = layer_flags[2];
- // Layer 2: predict from L, G, ARF; update none.
- layer_flags[1] = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_ENTROPY;
- layer_flags[3] = layer_flags[1];
- layer_flags[5] = layer_flags[1];
- layer_flags[7] = layer_flags[1];
- break;
- }
- }
-}
-
-int main(int argc, char **argv) {
- VpxVideoWriter *outfile[VPX_TS_MAX_LAYERS];
- vpx_codec_ctx_t codec;
- vpx_codec_enc_cfg_t cfg;
- int frame_cnt = 0;
- vpx_image_t raw;
- vpx_codec_err_t res;
- unsigned int width;
- unsigned int height;
- int speed;
- int frame_avail;
- int got_data;
- int flags = 0;
- unsigned int i;
- int pts = 0; // PTS starts at 0.
- int frame_duration = 1; // 1 timebase tick per frame.
- int layering_mode = 0;
- int layer_flags[VPX_TS_MAX_PERIODICITY] = {0};
- int flag_periodicity = 1;
- int max_intra_size_pct;
- vpx_svc_layer_id_t layer_id = {0, 0};
- const VpxInterface *encoder = NULL;
- FILE *infile = NULL;
- struct RateControlMetrics rc;
- int64_t cx_time = 0;
-
- exec_name = argv[0];
- // Check usage and arguments.
- if (argc < 11) {
- die("Usage: %s <infile> <outfile> <codec_type(vp8/vp9)> <width> <height> "
- "<rate_num> <rate_den> <speed> <frame_drop_threshold> <mode> "
- "<Rate_0> ... <Rate_nlayers-1> \n", argv[0]);
- }
-
- encoder = get_vpx_encoder_by_name(argv[3]);
- if (!encoder)
- die("Unsupported codec.");
-
- printf("Using %s\n", vpx_codec_iface_name(encoder->interface()));
-
- width = strtol(argv[4], NULL, 0);
- height = strtol(argv[5], NULL, 0);
- if (width < 16 || width % 2 || height < 16 || height % 2) {
- die("Invalid resolution: %d x %d", width, height);
- }
-
- layering_mode = strtol(argv[10], NULL, 0);
- if (layering_mode < 0 || layering_mode > 12) {
- die("Invalid layering mode (0..12) %s", argv[10]);
- }
-
- if (argc != 11 + mode_to_num_layers[layering_mode]) {
- die("Invalid number of arguments");
- }
-
- if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, width, height, 32)) {
- die("Failed to allocate image", width, height);
- }
-
- // Populate encoder configuration.
- res = vpx_codec_enc_config_default(encoder->interface(), &cfg, 0);
- if (res) {
- printf("Failed to get config: %s\n", vpx_codec_err_to_string(res));
- return EXIT_FAILURE;
- }
-
- // Update the default configuration with our settings.
- cfg.g_w = width;
- cfg.g_h = height;
-
- // Timebase format e.g. 30fps: numerator=1, demoninator = 30.
- cfg.g_timebase.num = strtol(argv[6], NULL, 0);
- cfg.g_timebase.den = strtol(argv[7], NULL, 0);
-
- speed = strtol(argv[8], NULL, 0);
- if (speed < 0) {
- die("Invalid speed setting: must be positive");
- }
-
- for (i = 11; (int)i < 11 + mode_to_num_layers[layering_mode]; ++i) {
- cfg.ts_target_bitrate[i - 11] = strtol(argv[i], NULL, 0);
- }
-
- // Real time parameters.
- cfg.rc_dropframe_thresh = strtol(argv[9], NULL, 0);
- cfg.rc_end_usage = VPX_CBR;
- cfg.rc_resize_allowed = 0;
- cfg.rc_min_quantizer = 2;
- cfg.rc_max_quantizer = 56;
- cfg.rc_undershoot_pct = 50;
- cfg.rc_overshoot_pct = 50;
- cfg.rc_buf_initial_sz = 500;
- cfg.rc_buf_optimal_sz = 600;
- cfg.rc_buf_sz = 1000;
-
- // Enable error resilient mode.
- cfg.g_error_resilient = 1;
- cfg.g_lag_in_frames = 0;
- cfg.kf_mode = VPX_KF_DISABLED;
-
- // Disable automatic keyframe placement.
- cfg.kf_min_dist = cfg.kf_max_dist = 3000;
-
- set_temporal_layer_pattern(layering_mode,
- &cfg,
- layer_flags,
- &flag_periodicity);
-
- set_rate_control_metrics(&rc, &cfg);
-
- // Target bandwidth for the whole stream.
- // Set to ts_target_bitrate for highest layer (total bitrate).
- cfg.rc_target_bitrate = cfg.ts_target_bitrate[cfg.ts_number_layers - 1];
-
- // Open input file.
- if (!(infile = fopen(argv[1], "rb"))) {
- die("Failed to open %s for reading", argv[1]);
- }
-
- // Open an output file for each stream.
- for (i = 0; i < cfg.ts_number_layers; ++i) {
- char file_name[PATH_MAX];
- VpxVideoInfo info;
- info.codec_fourcc = encoder->fourcc;
- info.frame_width = cfg.g_w;
- info.frame_height = cfg.g_h;
- info.time_base.numerator = cfg.g_timebase.num;
- info.time_base.denominator = cfg.g_timebase.den;
-
- snprintf(file_name, sizeof(file_name), "%s_%d.ivf", argv[2], i);
- outfile[i] = vpx_video_writer_open(file_name, kContainerIVF, &info);
- if (!outfile[i])
- die("Failed to open %s for writing", file_name);
- }
- // No spatial layers in this encoder.
- cfg.ss_number_layers = 1;
-
- // Initialize codec.
- if (vpx_codec_enc_init(&codec, encoder->interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
-
- if (strncmp(encoder->name, "vp8", 3) == 0) {
- vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed);
- vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, 1);
- } else if (strncmp(encoder->name, "vp9", 3) == 0) {
- vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed);
- vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3);
- vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0);
- vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, 0);
- if (vpx_codec_control(&codec, VP9E_SET_SVC, 1)) {
- die_codec(&codec, "Failed to set SVC");
- }
- }
- vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1);
- vpx_codec_control(&codec, VP8E_SET_TOKEN_PARTITIONS, 1);
- // This controls the maximum target size of the key frame.
- // For generating smaller key frames, use a smaller max_intra_size_pct
- // value, like 100 or 200.
- max_intra_size_pct = (int) (((double)cfg.rc_buf_optimal_sz * 0.5)
- * ((double) cfg.g_timebase.den / cfg.g_timebase.num) / 10.0);
- // For low-quality key frame.
- max_intra_size_pct = 200;
- vpx_codec_control(&codec, VP8E_SET_MAX_INTRA_BITRATE_PCT, max_intra_size_pct);
-
- frame_avail = 1;
- while (frame_avail || got_data) {
- struct vpx_usec_timer timer;
- vpx_codec_iter_t iter = NULL;
- const vpx_codec_cx_pkt_t *pkt;
- // Update the temporal layer_id. No spatial layers in this test.
- layer_id.spatial_layer_id = 0;
- layer_id.temporal_layer_id =
- cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity];
- if (strncmp(encoder->name, "vp9", 3) == 0) {
- vpx_codec_control(&codec, VP9E_SET_SVC_LAYER_ID, &layer_id);
- }
- flags = layer_flags[frame_cnt % flag_periodicity];
- frame_avail = vpx_img_read(&raw, infile);
- if (frame_avail)
- ++rc.layer_input_frames[layer_id.temporal_layer_id];
- vpx_usec_timer_start(&timer);
- if (vpx_codec_encode(&codec, frame_avail? &raw : NULL, pts, 1, flags,
- VPX_DL_REALTIME)) {
- die_codec(&codec, "Failed to encode frame");
- }
- vpx_usec_timer_mark(&timer);
- cx_time += vpx_usec_timer_elapsed(&timer);
- // Reset KF flag.
- if (layering_mode != 7) {
- layer_flags[0] &= ~VPX_EFLAG_FORCE_KF;
- }
- got_data = 0;
- while ( (pkt = vpx_codec_get_cx_data(&codec, &iter)) ) {
- got_data = 1;
- switch (pkt->kind) {
- case VPX_CODEC_CX_FRAME_PKT:
- for (i = cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity];
- i < cfg.ts_number_layers; ++i) {
- vpx_video_writer_write_frame(outfile[i], pkt->data.frame.buf,
- pkt->data.frame.sz, pts);
- ++rc.layer_tot_enc_frames[i];
- rc.layer_encoding_bitrate[i] += 8.0 * pkt->data.frame.sz;
- // Keep count of rate control stats per layer (for non-key frames).
- if (i == cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity] &&
- !(pkt->data.frame.flags & VPX_FRAME_IS_KEY)) {
- rc.layer_avg_frame_size[i] += 8.0 * pkt->data.frame.sz;
- rc.layer_avg_rate_mismatch[i] +=
- fabs(8.0 * pkt->data.frame.sz - rc.layer_pfb[i]) /
- rc.layer_pfb[i];
- ++rc.layer_enc_frames[i];
- }
- }
- break;
- default:
- break;
- }
- }
- ++frame_cnt;
- pts += frame_duration;
- }
- fclose(infile);
- printout_rate_control_summary(&rc, &cfg, frame_cnt);
- printf("\n");
- printf("Frame cnt and encoding time/FPS stats for encoding: %d %f %f \n",
- frame_cnt,
- 1000 * (float)cx_time / (double)(frame_cnt * 1000000),
- 1000000 * (double)frame_cnt / (double)cx_time);
-
- if (vpx_codec_destroy(&codec))
- die_codec(&codec, "Failed to destroy codec");
-
- // Try to rewrite the output file headers with the actual frame count.
- for (i = 0; i < cfg.ts_number_layers; ++i)
- vpx_video_writer_close(outfile[i]);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/ivfdec.c b/videocodec/libvpx_internal/libvpx/ivfdec.c
deleted file mode 100644
index 6dcd66f..0000000
--- a/videocodec/libvpx_internal/libvpx/ivfdec.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vpx_ports/mem_ops.h"
-
-#include "./ivfdec.h"
-
-static const char *IVF_SIGNATURE = "DKIF";
-
-static void fix_framerate(int *num, int *den) {
- // Some versions of vpxenc used 1/(2*fps) for the timebase, so
- // we can guess the framerate using only the timebase in this
- // case. Other files would require reading ahead to guess the
- // timebase, like we do for webm.
- if (*num < 1000) {
- // Correct for the factor of 2 applied to the timebase in the encoder.
- if (*num & 1)
- *den *= 2;
- else
- *num /= 2;
- } else {
- // Don't know FPS for sure, and don't have readahead code
- // (yet?), so just default to 30fps.
- *num = 30;
- *den = 1;
- }
-}
-
-int file_is_ivf(struct VpxInputContext *input_ctx) {
- char raw_hdr[32];
- int is_ivf = 0;
-
- if (fread(raw_hdr, 1, 32, input_ctx->file) == 32) {
- if (memcmp(IVF_SIGNATURE, raw_hdr, 4) == 0) {
- is_ivf = 1;
-
- if (mem_get_le16(raw_hdr + 4) != 0) {
- fprintf(stderr, "Error: Unrecognized IVF version! This file may not"
- " decode properly.");
- }
-
- input_ctx->fourcc = mem_get_le32(raw_hdr + 8);
- input_ctx->width = mem_get_le16(raw_hdr + 12);
- input_ctx->height = mem_get_le16(raw_hdr + 14);
- input_ctx->framerate.numerator = mem_get_le32(raw_hdr + 16);
- input_ctx->framerate.denominator = mem_get_le32(raw_hdr + 20);
- fix_framerate(&input_ctx->framerate.numerator,
- &input_ctx->framerate.denominator);
- }
- }
-
- if (!is_ivf) {
- rewind(input_ctx->file);
- input_ctx->detect.buf_read = 0;
- } else {
- input_ctx->detect.position = 4;
- }
- return is_ivf;
-}
-
-int ivf_read_frame(FILE *infile, uint8_t **buffer,
- size_t *bytes_read, size_t *buffer_size) {
- char raw_header[IVF_FRAME_HDR_SZ] = {0};
- size_t frame_size = 0;
-
- if (fread(raw_header, IVF_FRAME_HDR_SZ, 1, infile) != 1) {
- if (!feof(infile))
- warn("Failed to read frame size\n");
- } else {
- frame_size = mem_get_le32(raw_header);
-
- if (frame_size > 256 * 1024 * 1024) {
- warn("Read invalid frame size (%u)\n", (unsigned int)frame_size);
- frame_size = 0;
- }
-
- if (frame_size > *buffer_size) {
- uint8_t *new_buffer = realloc(*buffer, 2 * frame_size);
-
- if (new_buffer) {
- *buffer = new_buffer;
- *buffer_size = 2 * frame_size;
- } else {
- warn("Failed to allocate compressed data buffer\n");
- frame_size = 0;
- }
- }
- }
-
- if (!feof(infile)) {
- if (fread(*buffer, 1, frame_size, infile) != frame_size) {
- warn("Failed to read full frame\n");
- return 1;
- }
-
- *bytes_read = frame_size;
- return 0;
- }
-
- return 1;
-}
diff --git a/videocodec/libvpx_internal/libvpx/ivfdec.h b/videocodec/libvpx_internal/libvpx/ivfdec.h
deleted file mode 100644
index dd29cc6..0000000
--- a/videocodec/libvpx_internal/libvpx/ivfdec.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef IVFDEC_H_
-#define IVFDEC_H_
-
-#include "./tools_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int file_is_ivf(struct VpxInputContext *input);
-
-int ivf_read_frame(FILE *infile, uint8_t **buffer,
- size_t *bytes_read, size_t *buffer_size);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif // IVFDEC_H_
diff --git a/videocodec/libvpx_internal/libvpx/ivfenc.c b/videocodec/libvpx_internal/libvpx/ivfenc.c
deleted file mode 100644
index 4a97c42..0000000
--- a/videocodec/libvpx_internal/libvpx/ivfenc.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./ivfenc.h"
-
-#include "vpx/vpx_encoder.h"
-#include "vpx_ports/mem_ops.h"
-
-void ivf_write_file_header(FILE *outfile,
- const struct vpx_codec_enc_cfg *cfg,
- unsigned int fourcc,
- int frame_cnt) {
- char header[32];
-
- header[0] = 'D';
- header[1] = 'K';
- header[2] = 'I';
- header[3] = 'F';
- mem_put_le16(header + 4, 0); // version
- mem_put_le16(header + 6, 32); // header size
- mem_put_le32(header + 8, fourcc); // fourcc
- mem_put_le16(header + 12, cfg->g_w); // width
- mem_put_le16(header + 14, cfg->g_h); // height
- mem_put_le32(header + 16, cfg->g_timebase.den); // rate
- mem_put_le32(header + 20, cfg->g_timebase.num); // scale
- mem_put_le32(header + 24, frame_cnt); // length
- mem_put_le32(header + 28, 0); // unused
-
- fwrite(header, 1, 32, outfile);
-}
-
-void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size) {
- char header[12];
-
- mem_put_le32(header, (int)frame_size);
- mem_put_le32(header + 4, (int)(pts & 0xFFFFFFFF));
- mem_put_le32(header + 8, (int)(pts >> 32));
- fwrite(header, 1, 12, outfile);
-}
-
-void ivf_write_frame_size(FILE *outfile, size_t frame_size) {
- char header[4];
-
- mem_put_le32(header, (int)frame_size);
- fwrite(header, 1, 4, outfile);
-}
diff --git a/videocodec/libvpx_internal/libvpx/ivfenc.h b/videocodec/libvpx_internal/libvpx/ivfenc.h
deleted file mode 100644
index 6623687..0000000
--- a/videocodec/libvpx_internal/libvpx/ivfenc.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef IVFENC_H_
-#define IVFENC_H_
-
-#include "./tools_common.h"
-
-struct vpx_codec_enc_cfg;
-struct vpx_codec_cx_pkt;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void ivf_write_file_header(FILE *outfile,
- const struct vpx_codec_enc_cfg *cfg,
- uint32_t fourcc,
- int frame_cnt);
-
-void ivf_write_frame_header(FILE *outfile, int64_t pts, size_t frame_size);
-
-void ivf_write_frame_size(FILE *outfile, size_t frame_size);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif // IVFENC_H_
diff --git a/videocodec/libvpx_internal/libvpx/keywords.dox b/videocodec/libvpx_internal/libvpx/keywords.dox
deleted file mode 100644
index 56f5368..0000000
--- a/videocodec/libvpx_internal/libvpx/keywords.dox
+++ /dev/null
@@ -1,51 +0,0 @@
-/*!\page rfc2119 RFC2119 Keywords
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
- NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
- "OPTIONAL" in this document are to be interpreted as described in
- <a href="http://www.ietf.org/rfc/rfc2119.txt">RFC 2119.</a>
-
-Specifically, the following definitions are used:
-
-\section MUST
-\anchor REQUIRED
-\anchor SHALL
- This word, or the terms "REQUIRED" or "SHALL", mean that the
- definition is an absolute requirement of the specification.
-
-\section MUSTNOT MUST NOT
-\anchor SHALLNOT
- This phrase, or the phrase "SHALL NOT", mean that the
- definition is an absolute prohibition of the specification.
-
-\section SHOULD
-\anchor RECOMMENDED
- This word, or the adjective "RECOMMENDED", mean that there
- may exist valid reasons in particular circumstances to ignore a
- particular item, but the full implications must be understood and
- carefully weighed before choosing a different course.
-
-\section SHOULDNOT SHOULD NOT
-\anchor NOTRECOMMENDED
- This phrase, or the phrase "NOT RECOMMENDED" mean that
- there may exist valid reasons in particular circumstances when the
- particular behavior is acceptable or even useful, but the full
- implications should be understood and the case carefully weighed
- before implementing any behavior described with this label.
-
-\section MAY
-\anchor OPTIONAL
- This word, or the adjective "OPTIONAL", mean that an item is
- truly optional. One vendor may choose to include the item because a
- particular marketplace requires it or because the vendor feels that
- it enhances the product while another vendor may omit the same item.
- An implementation which does not include a particular option \ref MUST be
- prepared to interoperate with another implementation which does
- include the option, though perhaps with reduced functionality. In the
- same vein an implementation which does include a particular option
- \ref MUST be prepared to interoperate with another implementation which
- does not include the option (except, of course, for the feature the
- option provides.)
-
-
-*/
diff --git a/videocodec/libvpx_internal/libvpx/libs.doxy_template b/videocodec/libvpx_internal/libvpx/libs.doxy_template
deleted file mode 100644
index 02e2902..0000000
--- a/videocodec/libvpx_internal/libvpx/libs.doxy_template
+++ /dev/null
@@ -1,1308 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-# Doxyfile 1.5.4
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file that
-# follow. The default is UTF-8 which is also the encoding used for all text before
-# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
-# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
-# possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "WebM VP8 Codec SDK"
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = docs
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
-# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
-# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
-# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to java_doc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a java_doc-style
-# comment as the brief description. If set to NO, the java_doc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
-# include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the defqault) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is
-# documented as struct with the name of the typedef. So
-# typedef struct type_s {} type_t, will appear in the documentation as a struct
-# with name type_t. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named type_s. This can typically
-# be useful for C code where the coding convention is that all structs are
-# typedef'ed and only the typedef is referenced never the struct's name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be extracted
-# and appear in the documentation as a namespace called 'anonymous_namespace{file}',
-# where file will be replaced with the base name of the file that contains the anonymous
-# namespace. By default anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = NO
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = NO
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from the
-# version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT =
-
-# This tag can be used to specify the character encoding of the source files that
-# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
-# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
-# See http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the output.
-# The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
-# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH
-# then you must also enable this option. If you don't then doxygen will produce
-# a warning and turn it on anyway
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code. Otherwise they will link to the documentstion.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# java_script and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# java_script, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the la_te_x output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = YES
-
-# The LATEX_OUTPUT tag is used to specify where the la_te_x docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the la_te_x command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for la_te_x. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# la_te_x documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = YES
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = letter
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of la_te_x
-# packages that should be included in the la_te_x output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal la_te_x header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the la_te_x that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated la_te_x files. This will instruct la_te_x to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man 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 `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-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
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an auto_gen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and la_te_x code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS = *.h
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and la_te_x) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
-# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
-# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
-# be found in the default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
-# generate a caller dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the number
-# of direct children of the root node in a graph is already larger than
-# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, which results in a white background.
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/videocodec/libvpx_internal/libvpx/libs.mk b/videocodec/libvpx_internal/libvpx/libs.mk
deleted file mode 100644
index a5c4b76..0000000
--- a/videocodec/libvpx_internal/libvpx/libs.mk
+++ /dev/null
@@ -1,533 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-# ARM assembly files are written in RVCT-style. We use some make magic to
-# filter those files to allow GCC compilation
-ifeq ($(ARCH_ARM),yes)
- ASM:=$(if $(filter yes,$(CONFIG_GCC)$(CONFIG_MSVS)),.asm.s,.asm)
-else
- ASM:=.asm
-endif
-
-#
-# Calculate platform- and compiler-specific offsets for hand coded assembly
-#
-ifeq ($(filter icc gcc,$(TGT_CC)), $(TGT_CC))
-OFFSET_PATTERN:='^[a-zA-Z0-9_]* EQU'
-define asm_offsets_template
-$$(BUILD_PFX)$(1): $$(BUILD_PFX)$(2).S
- @echo " [CREATE] $$@"
- $$(qexec)LC_ALL=C grep $$(OFFSET_PATTERN) $$< | tr -d '$$$$\#' $$(ADS2GAS) > $$@
-$$(BUILD_PFX)$(2).S: $(2)
-CLEAN-OBJS += $$(BUILD_PFX)$(1) $(2).S
-endef
-else
- ifeq ($(filter rvct,$(TGT_CC)), $(TGT_CC))
-define asm_offsets_template
-$$(BUILD_PFX)$(1): obj_int_extract
-$$(BUILD_PFX)$(1): $$(BUILD_PFX)$(2).o
- @echo " [CREATE] $$@"
- $$(qexec)./obj_int_extract rvds $$< $$(ADS2GAS) > $$@
-OBJS-yes += $$(BUILD_PFX)$(2).o
-CLEAN-OBJS += $$(BUILD_PFX)$(1)
-$$(filter %$$(ASM).o,$$(OBJS-yes)): $$(BUILD_PFX)$(1)
-endef
-endif # rvct
-endif # !gcc
-
-#
-# Rule to generate runtime cpu detection files
-#
-define rtcd_h_template
-$$(BUILD_PFX)$(1).h: $$(SRC_PATH_BARE)/$(2)
- @echo " [CREATE] $$@"
- $$(qexec)$$(SRC_PATH_BARE)/build/make/rtcd.pl --arch=$$(TGT_ISA) \
- --sym=$(1) \
- --config=$$(CONFIG_DIR)$$(target)$$(if $$(FAT_ARCHS),,-$$(TOOLCHAIN)).mk \
- $$(RTCD_OPTIONS) $$^ > $$@
-CLEAN-OBJS += $$(BUILD_PFX)$(1).h
-RTCD += $$(BUILD_PFX)$(1).h
-endef
-
-CODEC_SRCS-yes += CHANGELOG
-CODEC_SRCS-yes += libs.mk
-
-# If this is a universal (fat) binary, then all the subarchitectures have
-# already been built and our job is to stitch them together. The
-# BUILD_LIBVPX variable indicates whether we should be building
-# (compiling, linking) the library. The LIPO_LIBVPX variable indicates
-# that we're stitching.
-$(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
-
-include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
-CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
-CODEC_DOC_SRCS += $(addprefix vpx/,$(call enabled,API_DOC_SRCS))
-
-include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
-CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
-
-include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
-CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
-
-include $(SRC_PATH_BARE)/vpx_ports/vpx_ports.mk
-CODEC_SRCS-yes += $(addprefix vpx_ports/,$(call enabled,PORTS_SRCS))
-
-ifneq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),)
- VP8_PREFIX=vp8/
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
-endif
-
-ifeq ($(CONFIG_VP8_ENCODER),yes)
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
- CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
- CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
- INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
- INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
- CODEC_DOC_SECTIONS += vp8 vp8_encoder
-endif
-
-ifeq ($(CONFIG_VP8_DECODER),yes)
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
- CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
- CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
- INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
- INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
- CODEC_DOC_SECTIONS += vp8 vp8_decoder
-endif
-
-ifneq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),)
- VP9_PREFIX=vp9/
- include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9_common.mk
-endif
-
-ifeq ($(CONFIG_VP9_ENCODER),yes)
- VP9_PREFIX=vp9/
- include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9cx.mk
- CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
- CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_CX_EXPORTS))
- CODEC_SRCS-yes += $(VP9_PREFIX)vp9cx.mk vpx/vp8.h vpx/vp8cx.h
- INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
- INSTALL-LIBS-yes += include/vpx/svc_context.h
- INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
- CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
- CODEC_DOC_SECTIONS += vp9 vp9_encoder
-endif
-
-ifeq ($(CONFIG_VP9_DECODER),yes)
- VP9_PREFIX=vp9/
- include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9dx.mk
- CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_DX_SRCS))
- CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_DX_EXPORTS))
- CODEC_SRCS-yes += $(VP9_PREFIX)vp9dx.mk vpx/vp8.h vpx/vp8dx.h
- INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
- INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
- CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
- CODEC_DOC_SECTIONS += vp9 vp9_decoder
-endif
-
-
-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),vpxmt,vpxmd)
-GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
-# This variable uses deferred expansion intentionally, since the results of
-# $(wildcard) may change during the course of the Make.
-VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
-endif
-
-# The following pairs define a mapping of locations in the distribution
-# tree to locations in the source/build trees.
-INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
-INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
-INSTALL_MAPS += $(LIBSUBDIR)/% %
-INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
-ifeq ($(CONFIG_MSVS),yes)
-INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
-INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
-endif
-
-CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
-CODEC_SRCS-$(BUILD_LIBVPX) += build/make/rtcd.pl
-CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/emmintrin_compat.h
-CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem_ops.h
-CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem_ops_aligned.h
-CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_once.h
-CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
-INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
-ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
-CODEC_SRCS-$(BUILD_LIBVPX) += third_party/x86inc/x86inc.asm
-endif
-CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
-CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
-CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
-
-INSTALL-LIBS-yes += include/vpx/vpx_codec.h
-INSTALL-LIBS-yes += include/vpx/vpx_frame_buffer.h
-INSTALL-LIBS-yes += include/vpx/vpx_image.h
-INSTALL-LIBS-yes += include/vpx/vpx_integer.h
-INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
-INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
-ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
-ifeq ($(CONFIG_MSVS),yes)
-INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
-INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
-INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
-INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
-endif
-else
-INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
-INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
-endif
-
-CODEC_SRCS=$(call enabled,CODEC_SRCS)
-INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
-INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
-
-
-# Generate a list of all enabled sources, in particular for exporting to gyp
-# based build systems.
-libvpx_srcs.txt:
- @echo " [CREATE] $@"
- @echo $(CODEC_SRCS) | xargs -n1 echo | sort -u > $@
-CLEAN-OBJS += libvpx_srcs.txt
-
-
-ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
-ifeq ($(CONFIG_MSVS),yes)
-
-obj_int_extract.bat: $(SRC_PATH_BARE)/build/$(MSVS_ARCH_DIR)/obj_int_extract.bat
- @cp $^ $@
-
-obj_int_extract.$(VCPROJ_SFX): obj_int_extract.bat
-obj_int_extract.$(VCPROJ_SFX): $(SRC_PATH_BARE)/build/make/obj_int_extract.c
- @echo " [CREATE] $@"
- $(qexec)$(GEN_VCPROJ) \
- --exe \
- --target=$(TOOLCHAIN) \
- --name=obj_int_extract \
- --ver=$(CONFIG_VS_VERSION) \
- --proj-guid=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
- $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
- --out=$@ $^ \
- -I. \
- -I"$(SRC_PATH_BARE)" \
-
-PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.$(VCPROJ_SFX)
-
-vpx.def: $(call enabled,CODEC_EXPORTS)
- @echo " [CREATE] $@"
- $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
- --name=vpx\
- --out=$@ $^
-CLEAN-OBJS += vpx.def
-
-# Assembly files that are included, but don't define symbols themselves.
-# Filtered out to avoid Visual Studio build warnings.
-ASM_INCLUDES := \
- third_party/x86inc/x86inc.asm \
- vpx_config.asm \
- vpx_ports/x86_abi_support.asm \
-
-vpx.$(VCPROJ_SFX): $(CODEC_SRCS) vpx.def obj_int_extract.$(VCPROJ_SFX)
- @echo " [CREATE] $@"
- $(qexec)$(GEN_VCPROJ) \
- $(if $(CONFIG_SHARED),--dll,--lib) \
- --target=$(TOOLCHAIN) \
- $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
- --name=vpx \
- --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
- --module-def=vpx.def \
- --ver=$(CONFIG_VS_VERSION) \
- --out=$@ $(CFLAGS) \
- $(filter-out $(addprefix %, $(ASM_INCLUDES)), $^) \
- --src-path-bare="$(SRC_PATH_BARE)" \
-
-PROJECTS-$(BUILD_LIBVPX) += vpx.$(VCPROJ_SFX)
-
-vpx.$(VCPROJ_SFX): vpx_config.asm
-vpx.$(VCPROJ_SFX): $(RTCD)
-
-endif
-else
-LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
-OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
-LIBS-$(if $(BUILD_LIBVPX),$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
-$(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
-
-
-BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
-
-ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
-LIBVPX_SO := libvpx.$(VERSION_MAJOR).dylib
-EXPORT_FILE := libvpx.syms
-LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
- libvpx.dylib )
-else
-LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
-EXPORT_FILE := libvpx.ver
-SYM_LINK := libvpx.so
-LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
- libvpx.so libvpx.so.$(VERSION_MAJOR) \
- libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
-endif
-
-LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)\
- $(notdir $(LIBVPX_SO_SYMLINKS))
-$(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) $(EXPORT_FILE)
-$(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm
-$(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
-$(BUILD_PFX)$(LIBVPX_SO): EXPORTS_FILE = $(EXPORT_FILE)
-
-libvpx.ver: $(call enabled,CODEC_EXPORTS)
- @echo " [CREATE] $@"
- $(qexec)echo "{ global:" > $@
- $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
- $(qexec)echo "local: *; };" >> $@
-CLEAN-OBJS += libvpx.ver
-
-libvpx.syms: $(call enabled,CODEC_EXPORTS)
- @echo " [CREATE] $@"
- $(qexec)awk '{print "_"$$2}' $^ >$@
-CLEAN-OBJS += libvpx.syms
-
-define libvpx_symlink_template
-$(1): $(2)
- @echo " [LN] $(2) $$@"
- $(qexec)mkdir -p $$(dir $$@)
- $(qexec)ln -sf $(2) $$@
-endef
-
-$(eval $(call libvpx_symlink_template,\
- $(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\
- $(BUILD_PFX)$(LIBVPX_SO)))
-$(eval $(call libvpx_symlink_template,\
- $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\
- $(LIBVPX_SO)))
-
-
-INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBVPX_SO_SYMLINKS)
-INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBSUBDIR)/$(LIBVPX_SO)
-
-
-LIBS-$(BUILD_LIBVPX) += vpx.pc
-vpx.pc: config.mk libs.mk
- @echo " [CREATE] $@"
- $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
- $(qexec)echo 'prefix=$(PREFIX)' >> $@
- $(qexec)echo 'exec_prefix=$${prefix}' >> $@
- $(qexec)echo 'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
- $(qexec)echo 'includedir=$${prefix}/include' >> $@
- $(qexec)echo '' >> $@
- $(qexec)echo 'Name: vpx' >> $@
- $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
- $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
- $(qexec)echo 'Requires:' >> $@
- $(qexec)echo 'Conflicts:' >> $@
- $(qexec)echo 'Libs: -L$${libdir} -lvpx -lm' >> $@
-ifeq ($(HAVE_PTHREAD_H),yes)
- $(qexec)echo 'Libs.private: -lm -lpthread' >> $@
-else
- $(qexec)echo 'Libs.private: -lm' >> $@
-endif
- $(qexec)echo 'Cflags: -I$${includedir}' >> $@
-INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
-INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
-CLEAN-OBJS += vpx.pc
-endif
-
-LIBS-$(LIPO_LIBVPX) += libvpx.a
-$(eval $(if $(LIPO_LIBVPX),$(call lipo_lib_template,libvpx.a)))
-
-#
-# Rule to make assembler configuration file from C configuration file
-#
-ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
-# YASM
-$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
- @echo " [CREATE] $@"
- @egrep "#define [A-Z0-9_]+ [01]" $< \
- | awk '{print $$2 " equ " $$3}' > $@
-else
-ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
-$(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
- @echo " [CREATE] $@"
- @egrep "#define [A-Z0-9_]+ [01]" $< \
- | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
- @echo " END" $(ADS2GAS) >> $@
-CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
-endif
-
-#
-# Add assembler dependencies for configuration and offsets
-#
-$(filter %.s.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
-$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
-
-
-$(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
-CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
-
-
-##
-## libvpx test directives
-##
-ifeq ($(CONFIG_UNIT_TESTS),yes)
-LIBVPX_TEST_DATA_PATH ?= .
-
-include $(SRC_PATH_BARE)/test/test.mk
-LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
-LIBVPX_TEST_BINS=./test_libvpx$(EXE_SFX)
-LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
- $(call enabled,LIBVPX_TEST_DATA))
-libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1)
-
-libvpx_test_srcs.txt:
- @echo " [CREATE] $@"
- @echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | sort -u > $@
-CLEAN-OBJS += libvpx_test_srcs.txt
-
-$(LIBVPX_TEST_DATA): $(SRC_PATH_BARE)/test/test-data.sha1
- @echo " [DOWNLOAD] $@"
- $(qexec)trap 'rm -f $@' INT TERM &&\
- curl -L -o $@ $(call libvpx_test_data_url,$(@F))
-
-testdata:: $(LIBVPX_TEST_DATA)
- $(qexec)if [ -x "$$(which sha1sum)" ]; then\
- echo "Checking test data:";\
- if [ -n "$(LIBVPX_TEST_DATA)" ]; then\
- for f in $(call enabled,LIBVPX_TEST_DATA); do\
- grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
- (cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c);\
- done; \
- fi; \
- else\
- echo "Skipping test data integrity check, sha1sum not found.";\
- fi
-
-ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
-ifeq ($(CONFIG_MSVS),yes)
-
-gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
- @echo " [CREATE] $@"
- $(qexec)$(GEN_VCPROJ) \
- --lib \
- --target=$(TOOLCHAIN) \
- $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
- --name=gtest \
- --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
- --ver=$(CONFIG_VS_VERSION) \
- --src-path-bare="$(SRC_PATH_BARE)" \
- -D_VARIADIC_MAX=10 \
- --out=gtest.$(VCPROJ_SFX) $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
- -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
-
-PROJECTS-$(CONFIG_MSVS) += gtest.$(VCPROJ_SFX)
-
-test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) vpx.$(VCPROJ_SFX) gtest.$(VCPROJ_SFX)
- @echo " [CREATE] $@"
- $(qexec)$(GEN_VCPROJ) \
- --exe \
- --target=$(TOOLCHAIN) \
- --name=test_libvpx \
- -D_VARIADIC_MAX=10 \
- --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
- --ver=$(CONFIG_VS_VERSION) \
- $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
- --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
- -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
- -L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^
-
-PROJECTS-$(CONFIG_MSVS) += test_libvpx.$(VCPROJ_SFX)
-
-LIBVPX_TEST_BINS := $(addprefix $(TGT_OS:win64=x64)/Release/,$(notdir $(LIBVPX_TEST_BINS)))
-endif
-else
-
-include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
-GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
-GTEST_OBJS=$(call objs,$(GTEST_SRCS))
-ifeq ($(filter win%,$(TGT_OS)),$(TGT_OS))
-# Disabling pthreads globally will cause issues on darwin and possibly elsewhere
-$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -DGTEST_HAS_PTHREAD=0
-endif
-$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
-$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
-OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
-LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
-$(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)
-
-LIBVPX_TEST_OBJS=$(sort $(call objs,$(LIBVPX_TEST_SRCS)))
-$(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
-$(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
-OBJS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_OBJS)
-BINS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_BINS)
-
-CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
-CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
-$(foreach bin,$(LIBVPX_TEST_BINS),\
- $(if $(BUILD_LIBVPX),$(eval $(bin): \
- lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
- $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
- $(LIBVPX_TEST_OBJS) \
- -L. -lvpx -lgtest $(extralibs) -lm)\
- )))\
- $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
-
-endif
-
-# Install test sources only if codec source is included
-INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
- $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
-INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
-
-define test_shard_template
-test:: test_shard.$(1)
-test_shard.$(1): $(LIBVPX_TEST_BINS) testdata
- @set -e; \
- for t in $(LIBVPX_TEST_BINS); do \
- export GTEST_SHARD_INDEX=$(1); \
- export GTEST_TOTAL_SHARDS=$(2); \
- $$$$t; \
- done
-.PHONY: test_shard.$(1)
-endef
-
-NUM_SHARDS := 10
-SHARDS := 0 1 2 3 4 5 6 7 8 9
-$(foreach s,$(SHARDS),$(eval $(call test_shard_template,$(s),$(NUM_SHARDS))))
-
-endif
-
-##
-## documentation directives
-##
-CLEAN-OBJS += libs.doxy
-DOCS-yes += libs.doxy
-libs.doxy: $(CODEC_DOC_SRCS)
- @echo " [CREATE] $@"
- @rm -f $@
- @echo "INPUT += $^" >> $@
- @echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
- @echo "INCLUDE_PATH += ." >> $@;
- @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
-
-## Generate rtcd.h for all objects
-$(OBJS-yes:.o=.d): $(RTCD)
-
-## Update the global src list
-SRCS += $(CODEC_SRCS) $(LIBVPX_TEST_SRCS) $(GTEST_SRCS)
diff --git a/videocodec/libvpx_internal/libvpx/mainpage.dox b/videocodec/libvpx_internal/libvpx/mainpage.dox
deleted file mode 100644
index e2ec280..0000000
--- a/videocodec/libvpx_internal/libvpx/mainpage.dox
+++ /dev/null
@@ -1,53 +0,0 @@
-/*!\mainpage WebM VP8 Codec SDK
-
- \section main_contents Page Contents
- - \ref main_intro
- - \ref main_startpoints
- - \ref main_support
-
- \section main_intro Introduction
- Welcome to the WebM VP8 Codec SDK. This SDK allows you to integrate your
- applications with the VP8 video codec, a high quality, royalty free, open
- source codec deployed on millions of computers and devices worldwide.
-
- This distribution of the WebM VP8 Codec SDK includes the following support:
-
- \if vp8_encoder
- - \ref vp8_encoder
- \endif
- \if vp8_decoder
- - \ref vp8_decoder
- \endif
-
-
- \section main_startpoints Starting Points
- - Consult the \ref changelog for a complete list of improvements in this
- release.
- - The \ref readme contains instructions on recompiling the sample applications.
- - Read the \ref usage "usage" for a narrative on codec usage.
- - Read the \ref samples "sample code" for examples of how to interact with the
- codec.
- - \ref codec reference
- \if encoder
- - \ref encoder reference
- \endif
- \if decoder
- - \ref decoder reference
- \endif
-
- \section main_support Support Options & FAQ
- The WebM project is an open source project supported by its community. For
- questions about this SDK, please mail the apps-devel@webmproject.org list.
- To contribute, see http://www.webmproject.org/code/contribute and mail
- codec-devel@webmproject.org.
-*/
-
-/*!\page changelog CHANGELOG
- \verbinclude CHANGELOG
-*/
-
-/*!\page readme README
- \verbinclude README
-*/
-
-/*!\defgroup codecs Supported Codecs */
diff --git a/videocodec/libvpx_internal/libvpx/md5_utils.c b/videocodec/libvpx_internal/libvpx/md5_utils.c
deleted file mode 100644
index 8fb26e2..0000000
--- a/videocodec/libvpx_internal/libvpx/md5_utils.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5Init, call MD5Update as
- * needed on buffers full of bytes, and then call MD5Final, which
- * will fill a supplied 16-byte array with the digest.
- *
- * Changed so as no longer to depend on Colin Plumb's `usual.h' header
- * definitions
- * - Ian Jackson <ian@chiark.greenend.org.uk>.
- * Still in the public domain.
- */
-
-#include <string.h> /* for memcpy() */
-
-#include "md5_utils.h"
-
-void
-byteSwap(UWORD32 *buf, unsigned words) {
- md5byte *p;
-
- /* Only swap bytes for big endian machines */
- int i = 1;
-
- if (*(char *)&i == 1)
- return;
-
- p = (md5byte *)buf;
-
- do {
- *buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
- ((unsigned)p[1] << 8 | p[0]);
- p += 4;
- } while (--words);
-}
-
-/*
- * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
- * initialization constants.
- */
-void
-MD5Init(struct MD5Context *ctx) {
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bytes[0] = 0;
- ctx->bytes[1] = 0;
-}
-
-/*
- * Update context to reflect the concatenation of another buffer full
- * of bytes.
- */
-void
-MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len) {
- UWORD32 t;
-
- /* Update byte count */
-
- t = ctx->bytes[0];
-
- if ((ctx->bytes[0] = t + len) < t)
- ctx->bytes[1]++; /* Carry from low to high */
-
- t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
-
- if (t > len) {
- memcpy((md5byte *)ctx->in + 64 - t, buf, len);
- return;
- }
-
- /* First chunk is an odd size */
- memcpy((md5byte *)ctx->in + 64 - t, buf, t);
- byteSwap(ctx->in, 16);
- MD5Transform(ctx->buf, ctx->in);
- buf += t;
- len -= t;
-
- /* Process data in 64-byte chunks */
- while (len >= 64) {
- memcpy(ctx->in, buf, 64);
- byteSwap(ctx->in, 16);
- MD5Transform(ctx->buf, ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
- memcpy(ctx->in, buf, len);
-}
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-void
-MD5Final(md5byte digest[16], struct MD5Context *ctx) {
- int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
- md5byte *p = (md5byte *)ctx->in + count;
-
- /* Set the first char of padding to 0x80. There is always room. */
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 56 bytes (-8..55) */
- count = 56 - 1 - count;
-
- if (count < 0) { /* Padding forces an extra block */
- memset(p, 0, count + 8);
- byteSwap(ctx->in, 16);
- MD5Transform(ctx->buf, ctx->in);
- p = (md5byte *)ctx->in;
- count = 56;
- }
-
- memset(p, 0, count);
- byteSwap(ctx->in, 14);
-
- /* Append length in bits and transform */
- ctx->in[14] = ctx->bytes[0] << 3;
- ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
- MD5Transform(ctx->buf, ctx->in);
-
- byteSwap(ctx->buf, 4);
- memcpy(digest, ctx->buf, 16);
- memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
-}
-
-#ifndef ASM_MD5
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f,w,x,y,z,in,s) \
- (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. MD5Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-void
-MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) {
- register UWORD32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/md5_utils.h b/videocodec/libvpx_internal/libvpx/md5_utils.h
deleted file mode 100644
index bd4991b..0000000
--- a/videocodec/libvpx_internal/libvpx/md5_utils.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This is the header file for the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5Init, call MD5Update as
- * needed on buffers full of bytes, and then call MD5Final, which
- * will fill a supplied 16-byte array with the digest.
- *
- * Changed so as no longer to depend on Colin Plumb's `usual.h'
- * header definitions
- * - Ian Jackson <ian@chiark.greenend.org.uk>.
- * Still in the public domain.
- */
-
-#ifndef MD5_UTILS_H_
-#define MD5_UTILS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define md5byte unsigned char
-#define UWORD32 unsigned int
-
-typedef struct MD5Context MD5Context;
-struct MD5Context {
- UWORD32 buf[4];
- UWORD32 bytes[2];
- UWORD32 in[16];
-};
-
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
-void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // MD5_UTILS_H_
diff --git a/videocodec/libvpx_internal/libvpx/rate_hist.c b/videocodec/libvpx_internal/libvpx/rate_hist.c
deleted file mode 100644
index 1cef19b..0000000
--- a/videocodec/libvpx_internal/libvpx/rate_hist.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <stdio.h>
-#include <math.h>
-
-#include "./rate_hist.h"
-
-#define RATE_BINS 100
-#define HIST_BAR_MAX 40
-
-struct hist_bucket {
- int low;
- int high;
- int count;
-};
-
-struct rate_hist {
- int64_t *pts;
- int *sz;
- int samples;
- int frames;
- struct hist_bucket bucket[RATE_BINS];
- int total;
-};
-
-struct rate_hist *init_rate_histogram(const vpx_codec_enc_cfg_t *cfg,
- const vpx_rational_t *fps) {
- int i;
- struct rate_hist *hist = malloc(sizeof(*hist));
-
- // Determine the number of samples in the buffer. Use the file's framerate
- // to determine the number of frames in rc_buf_sz milliseconds, with an
- // adjustment (5/4) to account for alt-refs
- hist->samples = cfg->rc_buf_sz * 5 / 4 * fps->num / fps->den / 1000;
-
- // prevent division by zero
- if (hist->samples == 0)
- hist->samples = 1;
-
- hist->frames = 0;
- hist->total = 0;
-
- hist->pts = calloc(hist->samples, sizeof(*hist->pts));
- hist->sz = calloc(hist->samples, sizeof(*hist->sz));
- for (i = 0; i < RATE_BINS; i++) {
- hist->bucket[i].low = INT_MAX;
- hist->bucket[i].high = 0;
- hist->bucket[i].count = 0;
- }
-
- return hist;
-}
-
-void destroy_rate_histogram(struct rate_hist *hist) {
- if (hist) {
- free(hist->pts);
- free(hist->sz);
- free(hist);
- }
-}
-
-void update_rate_histogram(struct rate_hist *hist,
- const vpx_codec_enc_cfg_t *cfg,
- const vpx_codec_cx_pkt_t *pkt) {
- int i;
- int64_t then = 0;
- int64_t avg_bitrate = 0;
- int64_t sum_sz = 0;
- const int64_t now = pkt->data.frame.pts * 1000 *
- (uint64_t)cfg->g_timebase.num /
- (uint64_t)cfg->g_timebase.den;
-
- int idx = hist->frames++ % hist->samples;
- hist->pts[idx] = now;
- hist->sz[idx] = (int)pkt->data.frame.sz;
-
- if (now < cfg->rc_buf_initial_sz)
- return;
-
- then = now;
-
- /* Sum the size over the past rc_buf_sz ms */
- for (i = hist->frames; i > 0 && hist->frames - i < hist->samples; i--) {
- const int i_idx = (i - 1) % hist->samples;
-
- then = hist->pts[i_idx];
- if (now - then > cfg->rc_buf_sz)
- break;
- sum_sz += hist->sz[i_idx];
- }
-
- if (now == then)
- return;
-
- avg_bitrate = sum_sz * 8 * 1000 / (now - then);
- idx = (int)(avg_bitrate * (RATE_BINS / 2) / (cfg->rc_target_bitrate * 1000));
- if (idx < 0)
- idx = 0;
- if (idx > RATE_BINS - 1)
- idx = RATE_BINS - 1;
- if (hist->bucket[idx].low > avg_bitrate)
- hist->bucket[idx].low = (int)avg_bitrate;
- if (hist->bucket[idx].high < avg_bitrate)
- hist->bucket[idx].high = (int)avg_bitrate;
- hist->bucket[idx].count++;
- hist->total++;
-}
-
-static int merge_hist_buckets(struct hist_bucket *bucket,
- int max_buckets, int *num_buckets) {
- int small_bucket = 0, merge_bucket = INT_MAX, big_bucket = 0;
- int buckets = *num_buckets;
- int i;
-
- /* Find the extrema for this list of buckets */
- big_bucket = small_bucket = 0;
- for (i = 0; i < buckets; i++) {
- if (bucket[i].count < bucket[small_bucket].count)
- small_bucket = i;
- if (bucket[i].count > bucket[big_bucket].count)
- big_bucket = i;
- }
-
- /* If we have too many buckets, merge the smallest with an adjacent
- * bucket.
- */
- while (buckets > max_buckets) {
- int last_bucket = buckets - 1;
-
- /* merge the small bucket with an adjacent one. */
- if (small_bucket == 0)
- merge_bucket = 1;
- else if (small_bucket == last_bucket)
- merge_bucket = last_bucket - 1;
- else if (bucket[small_bucket - 1].count < bucket[small_bucket + 1].count)
- merge_bucket = small_bucket - 1;
- else
- merge_bucket = small_bucket + 1;
-
- assert(abs(merge_bucket - small_bucket) <= 1);
- assert(small_bucket < buckets);
- assert(big_bucket < buckets);
- assert(merge_bucket < buckets);
-
- if (merge_bucket < small_bucket) {
- bucket[merge_bucket].high = bucket[small_bucket].high;
- bucket[merge_bucket].count += bucket[small_bucket].count;
- } else {
- bucket[small_bucket].high = bucket[merge_bucket].high;
- bucket[small_bucket].count += bucket[merge_bucket].count;
- merge_bucket = small_bucket;
- }
-
- assert(bucket[merge_bucket].low != bucket[merge_bucket].high);
-
- buckets--;
-
- /* Remove the merge_bucket from the list, and find the new small
- * and big buckets while we're at it
- */
- big_bucket = small_bucket = 0;
- for (i = 0; i < buckets; i++) {
- if (i > merge_bucket)
- bucket[i] = bucket[i + 1];
-
- if (bucket[i].count < bucket[small_bucket].count)
- small_bucket = i;
- if (bucket[i].count > bucket[big_bucket].count)
- big_bucket = i;
- }
- }
-
- *num_buckets = buckets;
- return bucket[big_bucket].count;
-}
-
-static void show_histogram(const struct hist_bucket *bucket,
- int buckets, int total, int scale) {
- const char *pat1, *pat2;
- int i;
-
- switch ((int)(log(bucket[buckets - 1].high) / log(10)) + 1) {
- case 1:
- case 2:
- pat1 = "%4d %2s: ";
- pat2 = "%4d-%2d: ";
- break;
- case 3:
- pat1 = "%5d %3s: ";
- pat2 = "%5d-%3d: ";
- break;
- case 4:
- pat1 = "%6d %4s: ";
- pat2 = "%6d-%4d: ";
- break;
- case 5:
- pat1 = "%7d %5s: ";
- pat2 = "%7d-%5d: ";
- break;
- case 6:
- pat1 = "%8d %6s: ";
- pat2 = "%8d-%6d: ";
- break;
- case 7:
- pat1 = "%9d %7s: ";
- pat2 = "%9d-%7d: ";
- break;
- default:
- pat1 = "%12d %10s: ";
- pat2 = "%12d-%10d: ";
- break;
- }
-
- for (i = 0; i < buckets; i++) {
- int len;
- int j;
- float pct;
-
- pct = (float)(100.0 * bucket[i].count / total);
- len = HIST_BAR_MAX * bucket[i].count / scale;
- if (len < 1)
- len = 1;
- assert(len <= HIST_BAR_MAX);
-
- if (bucket[i].low == bucket[i].high)
- fprintf(stderr, pat1, bucket[i].low, "");
- else
- fprintf(stderr, pat2, bucket[i].low, bucket[i].high);
-
- for (j = 0; j < HIST_BAR_MAX; j++)
- fprintf(stderr, j < len ? "=" : " ");
- fprintf(stderr, "\t%5d (%6.2f%%)\n", bucket[i].count, pct);
- }
-}
-
-void show_q_histogram(const int counts[64], int max_buckets) {
- struct hist_bucket bucket[64];
- int buckets = 0;
- int total = 0;
- int scale;
- int i;
-
- for (i = 0; i < 64; i++) {
- if (counts[i]) {
- bucket[buckets].low = bucket[buckets].high = i;
- bucket[buckets].count = counts[i];
- buckets++;
- total += counts[i];
- }
- }
-
- fprintf(stderr, "\nQuantizer Selection:\n");
- scale = merge_hist_buckets(bucket, max_buckets, &buckets);
- show_histogram(bucket, buckets, total, scale);
-}
-
-void show_rate_histogram(struct rate_hist *hist,
- const vpx_codec_enc_cfg_t *cfg, int max_buckets) {
- int i, scale;
- int buckets = 0;
-
- for (i = 0; i < RATE_BINS; i++) {
- if (hist->bucket[i].low == INT_MAX)
- continue;
- hist->bucket[buckets++] = hist->bucket[i];
- }
-
- fprintf(stderr, "\nRate (over %dms window):\n", cfg->rc_buf_sz);
- scale = merge_hist_buckets(hist->bucket, max_buckets, &buckets);
- show_histogram(hist->bucket, buckets, hist->total, scale);
-}
diff --git a/videocodec/libvpx_internal/libvpx/rate_hist.h b/videocodec/libvpx_internal/libvpx/rate_hist.h
deleted file mode 100644
index 00a1676..0000000
--- a/videocodec/libvpx_internal/libvpx/rate_hist.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef RATE_HIST_H_
-#define RATE_HIST_H_
-
-#include "vpx/vpx_encoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct rate_hist;
-
-struct rate_hist *init_rate_histogram(const vpx_codec_enc_cfg_t *cfg,
- const vpx_rational_t *fps);
-
-void destroy_rate_histogram(struct rate_hist *hist);
-
-void update_rate_histogram(struct rate_hist *hist,
- const vpx_codec_enc_cfg_t *cfg,
- const vpx_codec_cx_pkt_t *pkt);
-
-void show_q_histogram(const int counts[64], int max_buckets);
-
-void show_rate_histogram(struct rate_hist *hist, const vpx_codec_enc_cfg_t *cfg,
- int max_buckets);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // RATE_HIST_H_
diff --git a/videocodec/libvpx_internal/libvpx/solution.mk b/videocodec/libvpx_internal/libvpx/solution.mk
deleted file mode 100644
index 2c8d29a..0000000
--- a/videocodec/libvpx_internal/libvpx/solution.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-# libvpx reverse dependencies (targets that depend on libvpx)
-VPX_NONDEPS=$(addsuffix .$(VCPROJ_SFX),vpx gtest obj_int_extract)
-VPX_RDEPS=$(foreach vcp,\
- $(filter-out $(VPX_NONDEPS),$^), --dep=$(vcp:.$(VCPROJ_SFX)=):vpx)
-
-vpx.sln: $(wildcard *.$(VCPROJ_SFX))
- @echo " [CREATE] $@"
- $(SRC_PATH_BARE)/build/make/gen_msvs_sln.sh \
- $(if $(filter vpx.$(VCPROJ_SFX),$^),$(VPX_RDEPS)) \
- --dep=vpx:obj_int_extract \
- --dep=test_libvpx:gtest \
- --ver=$(CONFIG_VS_VERSION)\
- --out=$@ $^
-vpx.sln.mk: vpx.sln
- @true
-
-PROJECTS-yes += vpx.sln vpx.sln.mk
--include vpx.sln.mk
-
-# Always install this file, as it is an unconditional post-build rule.
-INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
-INSTALL-SRCS-yes += $(target).mk
diff --git a/videocodec/libvpx_internal/libvpx/test/acm_random.h b/videocodec/libvpx_internal/libvpx/test/acm_random.h
deleted file mode 100644
index 496dae3..0000000
--- a/videocodec/libvpx_internal/libvpx/test/acm_random.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_ACM_RANDOM_H_
-#define TEST_ACM_RANDOM_H_
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "vpx/vpx_integer.h"
-
-namespace libvpx_test {
-
-class ACMRandom {
- public:
- ACMRandom() : random_(DeterministicSeed()) {}
-
- explicit ACMRandom(int seed) : random_(seed) {}
-
- void Reset(int seed) {
- random_.Reseed(seed);
- }
- uint16_t Rand16(void) {
- const uint32_t value =
- random_.Generate(testing::internal::Random::kMaxRange);
- return (value >> 16) & 0xffff;
- }
-
- uint8_t Rand8(void) {
- const uint32_t value =
- random_.Generate(testing::internal::Random::kMaxRange);
- // There's a bit more entropy in the upper bits of this implementation.
- return (value >> 24) & 0xff;
- }
-
- uint8_t Rand8Extremes(void) {
- // Returns a random value near 0 or near 255, to better exercise
- // saturation behavior.
- const uint8_t r = Rand8();
- return r < 128 ? r << 4 : r >> 4;
- }
-
- int PseudoUniform(int range) {
- return random_.Generate(range);
- }
-
- int operator()(int n) {
- return PseudoUniform(n);
- }
-
- static int DeterministicSeed(void) {
- return 0xbaba;
- }
-
- private:
- testing::internal::Random random_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_ACM_RANDOM_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/active_map_test.cc b/videocodec/libvpx_internal/libvpx/test/active_map_test.cc
deleted file mode 100644
index 6377e72..0000000
--- a/videocodec/libvpx_internal/libvpx/test/active_map_test.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <climits>
-#include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-class ActiveMapTest
- : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
- protected:
- static const int kWidth = 208;
- static const int kHeight = 144;
-
- ActiveMapTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~ActiveMapTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- cpu_used_ = GET_PARAM(2);
- }
-
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
- } else if (video->frame() == 3) {
- vpx_active_map_t map = {0};
- uint8_t active_map[9 * 13] = {
- 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1,
- 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1,
- 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1,
- 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
- 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
- };
- map.cols = (kWidth + 15) / 16;
- map.rows = (kHeight + 15) / 16;
- ASSERT_EQ(map.cols, 13u);
- ASSERT_EQ(map.rows, 9u);
- map.active_map = active_map;
- encoder->Control(VP8E_SET_ACTIVEMAP, &map);
- } else if (video->frame() == 15) {
- vpx_active_map_t map = {0};
- map.cols = (kWidth + 15) / 16;
- map.rows = (kHeight + 15) / 16;
- map.active_map = NULL;
- encoder->Control(VP8E_SET_ACTIVEMAP, &map);
- }
- }
-
- int cpu_used_;
-};
-
-TEST_P(ActiveMapTest, Test) {
- // Validate that this non multiple of 64 wide clip encodes
- cfg_.g_lag_in_frames = 0;
- cfg_.rc_target_bitrate = 400;
- cfg_.rc_resize_allowed = 0;
- cfg_.g_pass = VPX_RC_ONE_PASS;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.kf_max_dist = 90000;
-
- ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30,
- 1, 0, 20);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-#define VP9_FACTORY \
- static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)
-
-VP9_INSTANTIATE_TEST_CASE(ActiveMapTest,
- ::testing::Values(::libvpx_test::kRealTime),
- ::testing::Range(0, 6));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/altref_test.cc b/videocodec/libvpx_internal/libvpx/test/altref_test.cc
deleted file mode 100644
index af25b72..0000000
--- a/videocodec/libvpx_internal/libvpx/test/altref_test.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-namespace {
-
-// lookahead range: [kLookAheadMin, kLookAheadMax).
-const int kLookAheadMin = 5;
-const int kLookAheadMax = 26;
-
-class AltRefTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<int> {
- protected:
- AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
- virtual ~AltRefTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(libvpx_test::kTwoPassGood);
- }
-
- virtual void BeginPassHook(unsigned int pass) {
- altref_count_ = 0;
- }
-
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
- encoder->Control(VP8E_SET_CPUUSED, 3);
- }
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) ++altref_count_;
- }
-
- int altref_count() const { return altref_count_; }
-
- private:
- int altref_count_;
-};
-
-TEST_P(AltRefTest, MonotonicTimestamps) {
- const vpx_rational timebase = { 33333333, 1000000000 };
- cfg_.g_timebase = timebase;
- cfg_.rc_target_bitrate = 1000;
- cfg_.g_lag_in_frames = GET_PARAM(1);
-
- libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- timebase.den, timebase.num, 0, 30);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- EXPECT_GE(altref_count(), 1);
-}
-
-
-VP8_INSTANTIATE_TEST_CASE(AltRefTest,
- ::testing::Range(kLookAheadMin, kLookAheadMax));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/android/Android.mk b/videocodec/libvpx_internal/libvpx/test/android/Android.mk
deleted file mode 100644
index 13af601..0000000
--- a/videocodec/libvpx_internal/libvpx/test/android/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-#
-# This make file builds vpx_test app for android.
-# The test app itself runs on the command line through adb shell
-# The paths are really messed up as the libvpx make file
-# expects to be made from a parent directory.
-CUR_WD := $(call my-dir)
-BINDINGS_DIR := $(CUR_WD)/../../..
-LOCAL_PATH := $(CUR_WD)/../../..
-
-#libvpx
-include $(CLEAR_VARS)
-include $(BINDINGS_DIR)/libvpx/build/make/Android.mk
-LOCAL_PATH := $(CUR_WD)/../..
-
-#libgtest
-include $(CLEAR_VARS)
-LOCAL_ARM_MODE := arm
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_MODULE := gtest
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/third_party/googletest/src/
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/third_party/googletest/src/include/
-LOCAL_SRC_FILES := ./third_party/googletest/src/src/gtest-all.cc
-include $(BUILD_STATIC_LIBRARY)
-
-#libvpx_test
-include $(CLEAR_VARS)
-LOCAL_ARM_MODE := arm
-LOCAL_MODULE := libvpx_test
-LOCAL_STATIC_LIBRARIES := gtest
-LOCAL_SHARED_LIBRARIES := vpx
-include $(LOCAL_PATH)/test/test.mk
-LOCAL_C_INCLUDES := $(BINDINGS_DIR)
-FILTERED_SRC := $(sort $(filter %.cc %.c, $(LIBVPX_TEST_SRCS-yes)))
-LOCAL_SRC_FILES := $(addprefix ./test/, $(FILTERED_SRC))
-include $(BUILD_EXECUTABLE)
diff --git a/videocodec/libvpx_internal/libvpx/test/android/README b/videocodec/libvpx_internal/libvpx/test/android/README
deleted file mode 100644
index 6840d91..0000000
--- a/videocodec/libvpx_internal/libvpx/test/android/README
+++ /dev/null
@@ -1,32 +0,0 @@
-Android.mk will build vpx unittests on android.
-1) Configure libvpx from the parent directory:
-./libvpx/configure --target=armv7-android-gcc --enable-external-build \
- --enable-postproc --disable-install-srcs --enable-multi-res-encoding \
- --enable-temporal-denoising --disable-unit-tests --disable-install-docs \
- --disable-examples --disable-runtime-cpu-detect --sdk=$NDK
-
-2) From the parent directory, invoke ndk-build:
-NDK_PROJECT_PATH=. ndk-build APP_BUILD_SCRIPT=./libvpx/test/android/Android.mk \
- APP_ABI=armeabi-v7a APP_PLATFORM=android-18 APP_OPTIM=release \
- APP_STL=gnustl_static
-
-Note: Both adb and ndk-build are available prebuilt at:
- https://chromium.googlesource.com/android_tools
-
-3) Run get_files.py to download the test files:
-python get_files.py -i /path/to/test-data.sha1 -o /path/to/put/files \
- -u http://downloads.webmproject.org/test_data/libvpx
-
-4) Transfer files to device using adb. Ensure you have proper permissions for
-the target
-
-adb push /path/to/test_files /data/local/tmp
-adb push /path/to/built_libs /data/local/tmp
-
-NOTE: Built_libs defaults to parent_dir/libs/armeabi-v7a
-
-5) Run tests:
-adb shell
-(on device)
-cd /data/local/tmp
-LD_LIBRARY_PATH=. ./vpx_test
diff --git a/videocodec/libvpx_internal/libvpx/test/android/get_files.py b/videocodec/libvpx_internal/libvpx/test/android/get_files.py
deleted file mode 100644
index 1c69740..0000000
--- a/videocodec/libvpx_internal/libvpx/test/android/get_files.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-#
-# This simple script pulls test files from the webm homepage
-# It is intelligent enough to only pull files if
-# 1) File / test_data folder does not exist
-# 2) SHA mismatch
-
-import pycurl
-import csv
-import hashlib
-import re
-import os.path
-import time
-import itertools
-import sys
-import getopt
-
-#globals
-url = ''
-file_list_path = ''
-local_resource_path = ''
-
-# Helper functions:
-# A simple function which returns the sha hash of a file in hex
-def get_file_sha(filename):
- try:
- sha_hash = hashlib.sha1()
- with open(filename, 'rb') as file:
- buf = file.read(HASH_CHUNK)
- while len(buf) > 0:
- sha_hash.update(buf)
- buf = file.read(HASH_CHUNK)
- return sha_hash.hexdigest()
- except IOError:
- print "Error reading " + filename
-
-# Downloads a file from a url, and then checks the sha against the passed
-# in sha
-def download_and_check_sha(url, filename, sha):
- path = os.path.join(local_resource_path, filename)
- fp = open(path, "wb")
- curl = pycurl.Curl()
- curl.setopt(pycurl.URL, url + "/" + filename)
- curl.setopt(pycurl.WRITEDATA, fp)
- curl.perform()
- curl.close()
- fp.close()
- return get_file_sha(path) == sha
-
-#constants
-ftp_retries = 3
-
-SHA_COL = 0
-NAME_COL = 1
-EXPECTED_COL = 2
-HASH_CHUNK = 65536
-
-# Main script
-try:
- opts, args = \
- getopt.getopt(sys.argv[1:], \
- "u:i:o:", ["url=", "input_csv=", "output_dir="])
-except:
- print 'get_files.py -u <url> -i <input_csv> -o <output_dir>'
- sys.exit(2)
-
-for opt, arg in opts:
- if opt == '-u':
- url = arg
- elif opt in ("-i", "--input_csv"):
- file_list_path = os.path.join(arg)
- elif opt in ("-o", "--output_dir"):
- local_resource_path = os.path.join(arg)
-
-if len(sys.argv) != 7:
- print "Expects two paths and a url!"
- exit(1)
-
-if not os.path.isdir(local_resource_path):
- os.makedirs(local_resource_path)
-
-file_list_csv = open(file_list_path, "rb")
-
-# Our 'csv' file uses multiple spaces as a delimiter, python's
-# csv class only uses single character delimiters, so we convert them below
-file_list_reader = csv.reader((re.sub(' +', ' ', line) \
- for line in file_list_csv), delimiter = ' ')
-
-file_shas = []
-file_names = []
-
-for row in file_list_reader:
- if len(row) != EXPECTED_COL:
- continue
- file_shas.append(row[SHA_COL])
- file_names.append(row[NAME_COL])
-
-file_list_csv.close()
-
-# Download files, only if they don't already exist and have correct shas
-for filename, sha in itertools.izip(file_names, file_shas):
- path = os.path.join(local_resource_path, filename)
- if os.path.isfile(path) \
- and get_file_sha(path) == sha:
- print path + ' exists, skipping'
- continue
- for retry in range(0, ftp_retries):
- print "Downloading " + path
- if not download_and_check_sha(url, filename, sha):
- print "Sha does not match, retrying..."
- else:
- break
diff --git a/videocodec/libvpx_internal/libvpx/test/android/scrape_gtest_log.py b/videocodec/libvpx_internal/libvpx/test/android/scrape_gtest_log.py
deleted file mode 100644
index c159c89..0000000
--- a/videocodec/libvpx_internal/libvpx/test/android/scrape_gtest_log.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (c) 2014 The WebM project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-"""Standalone script which parses a gtest log for json.
-
-Json is returned returns as an array. This script is used by the libvpx
-waterfall to gather json results mixed in with gtest logs. This is
-dubious software engineering.
-"""
-
-import json
-import re
-import sys
-
-
-def main():
- blob = sys.stdin.read()
- json_string = '[' + ','.join('{' + x + '}' for x in
- re.findall(r'{([^}]*.?)}', blob)) + ']'
- print json.dumps(json.loads(json_string), indent=4, sort_keys=True)
-
-if __name__ == '__main__':
- sys.exit(main())
diff --git a/videocodec/libvpx_internal/libvpx/test/aq_segment_test.cc b/videocodec/libvpx_internal/libvpx/test/aq_segment_test.cc
deleted file mode 100644
index 2f88b53..0000000
--- a/videocodec/libvpx_internal/libvpx/test/aq_segment_test.cc
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <climits>
-#include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-class AqSegmentTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWith2Params<
- libvpx_test::TestMode, int> {
- protected:
- AqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- set_cpu_used_ = GET_PARAM(2);
- aq_mode_ = 0;
- }
-
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
- encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
- encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 100);
- }
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
- }
- }
- int set_cpu_used_;
- int aq_mode_;
-};
-
-// Validate that this AQ segmentation mode (AQ=1, variance_ap)
-// encodes and decodes without a mismatch.
-TEST_P(AqSegmentTest, TestNoMisMatchAQ1) {
- cfg_.rc_min_quantizer = 8;
- cfg_.rc_max_quantizer = 56;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.g_lag_in_frames = 0;
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_target_bitrate = 300;
-
- aq_mode_ = 1;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 100);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-// Validate that this AQ segmentation mode (AQ=2, complexity_aq)
-// encodes and decodes without a mismatch.
-TEST_P(AqSegmentTest, TestNoMisMatchAQ2) {
- cfg_.rc_min_quantizer = 8;
- cfg_.rc_max_quantizer = 56;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.g_lag_in_frames = 0;
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_target_bitrate = 300;
-
- aq_mode_ = 2;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 100);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-// Validate that this AQ segmentation mode (AQ=3, cyclic_refresh_aq)
-// encodes and decodes without a mismatch.
-TEST_P(AqSegmentTest, TestNoMisMatchAQ3) {
- cfg_.rc_min_quantizer = 8;
- cfg_.rc_max_quantizer = 56;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.g_lag_in_frames = 0;
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_target_bitrate = 300;
-
- aq_mode_ = 3;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 100);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-using std::tr1::make_tuple;
-
-#define VP9_FACTORY \
- static_cast<const libvpx_test::CodecFactory*> (&libvpx_test::kVP9)
-
-VP9_INSTANTIATE_TEST_CASE(AqSegmentTest,
- ::testing::Values(::libvpx_test::kRealTime,
- ::libvpx_test::kOnePassGood),
- ::testing::Range(3, 9));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/borders_test.cc b/videocodec/libvpx_internal/libvpx/test/borders_test.cc
deleted file mode 100644
index b30be45..0000000
--- a/videocodec/libvpx_internal/libvpx/test/borders_test.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <climits>
-#include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-class BordersTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- protected:
- BordersTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~BordersTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- }
-
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP8E_SET_CPUUSED, 1);
- encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
- encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
- encoder->Control(VP8E_SET_ARNR_STRENGTH, 5);
- encoder->Control(VP8E_SET_ARNR_TYPE, 3);
- }
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
- }
- }
-};
-
-TEST_P(BordersTest, TestEncodeHighBitrate) {
- // Validate that this non multiple of 64 wide clip encodes and decodes
- // without a mismatch when passing in a very low max q. This pushes
- // the encoder to producing lots of big partitions which will likely
- // extend into the border and test the border condition.
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_2pass_vbr_minsection_pct = 5;
- cfg_.rc_2pass_vbr_minsection_pct = 2000;
- cfg_.rc_target_bitrate = 2000;
- cfg_.rc_max_quantizer = 10;
-
- ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
- 40);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-TEST_P(BordersTest, TestLowBitrate) {
- // Validate that this clip encodes and decodes without a mismatch
- // when passing in a very high min q. This pushes the encoder to producing
- // lots of small partitions which might will test the other condition.
-
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_2pass_vbr_minsection_pct = 5;
- cfg_.rc_2pass_vbr_maxsection_pct = 2000;
- cfg_.rc_target_bitrate = 200;
- cfg_.rc_min_quantizer = 40;
-
- ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
- 40);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-VP9_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
- ::libvpx_test::kTwoPassGood));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/clear_system_state.h b/videocodec/libvpx_internal/libvpx/test/clear_system_state.h
deleted file mode 100644
index 1b40ef2..0000000
--- a/videocodec/libvpx_internal/libvpx/test/clear_system_state.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_CLEAR_SYSTEM_STATE_H_
-#define TEST_CLEAR_SYSTEM_STATE_H_
-
-#include "./vpx_config.h"
-#if ARCH_X86_32 || ARCH_X86_64
-# include "vpx_ports/x86.h"
-#endif
-
-namespace libvpx_test {
-
-// Reset system to a known state. This function should be used for all non-API
-// test cases.
-inline void ClearSystemState() {
-#if ARCH_X86_32 || ARCH_X86_64
- vpx_reset_mmx_state();
-#endif
-}
-
-} // namespace libvpx_test
-#endif // TEST_CLEAR_SYSTEM_STATE_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/codec_factory.h b/videocodec/libvpx_internal/libvpx/test/codec_factory.h
deleted file mode 100644
index 7f9398c..0000000
--- a/videocodec/libvpx_internal/libvpx/test/codec_factory.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_CODEC_FACTORY_H_
-#define TEST_CODEC_FACTORY_H_
-
-#include "./vpx_config.h"
-#include "vpx/vpx_decoder.h"
-#include "vpx/vpx_encoder.h"
-#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
-#include "vpx/vp8cx.h"
-#endif
-#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
-#include "vpx/vp8dx.h"
-#endif
-
-#include "test/decode_test_driver.h"
-#include "test/encode_test_driver.h"
-namespace libvpx_test {
-
-const int kCodecFactoryParam = 0;
-
-class CodecFactory {
- public:
- CodecFactory() {}
-
- virtual ~CodecFactory() {}
-
- virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
- unsigned long deadline) const = 0;
-
- virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
- unsigned long deadline,
- const unsigned long init_flags,
- TwopassStatsStore *stats) const = 0;
-
- virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
- int usage) const = 0;
-};
-
-/* Provide CodecTestWith<n>Params classes for a variable number of parameters
- * to avoid having to include a pointer to the CodecFactory in every test
- * definition.
- */
-template<class T1>
-class CodecTestWithParam : public ::testing::TestWithParam<
- std::tr1::tuple< const libvpx_test::CodecFactory*, T1 > > {
-};
-
-template<class T1, class T2>
-class CodecTestWith2Params : public ::testing::TestWithParam<
- std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2 > > {
-};
-
-template<class T1, class T2, class T3>
-class CodecTestWith3Params : public ::testing::TestWithParam<
- std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > {
-};
-
-/*
- * VP8 Codec Definitions
- */
-#if CONFIG_VP8
-class VP8Decoder : public Decoder {
- public:
- VP8Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
- : Decoder(cfg, deadline) {}
-
- protected:
- virtual vpx_codec_iface_t* CodecInterface() const {
-#if CONFIG_VP8_DECODER
- return &vpx_codec_vp8_dx_algo;
-#else
- return NULL;
-#endif
- }
-};
-
-class VP8Encoder : public Encoder {
- public:
- VP8Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
- const unsigned long init_flags, TwopassStatsStore *stats)
- : Encoder(cfg, deadline, init_flags, stats) {}
-
- protected:
- virtual vpx_codec_iface_t* CodecInterface() const {
-#if CONFIG_VP8_ENCODER
- return &vpx_codec_vp8_cx_algo;
-#else
- return NULL;
-#endif
- }
-};
-
-class VP8CodecFactory : public CodecFactory {
- public:
- VP8CodecFactory() : CodecFactory() {}
-
- virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
- unsigned long deadline) const {
-#if CONFIG_VP8_DECODER
- return new VP8Decoder(cfg, deadline);
-#else
- return NULL;
-#endif
- }
-
- virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
- unsigned long deadline,
- const unsigned long init_flags,
- TwopassStatsStore *stats) const {
-#if CONFIG_VP8_ENCODER
- return new VP8Encoder(cfg, deadline, init_flags, stats);
-#else
- return NULL;
-#endif
- }
-
- virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
- int usage) const {
-#if CONFIG_VP8_ENCODER
- return vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, cfg, usage);
-#else
- return VPX_CODEC_INCAPABLE;
-#endif
- }
-};
-
-const libvpx_test::VP8CodecFactory kVP8;
-
-#define VP8_INSTANTIATE_TEST_CASE(test, ...)\
- INSTANTIATE_TEST_CASE_P(VP8, test, \
- ::testing::Combine( \
- ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
- &libvpx_test::kVP8)), \
- __VA_ARGS__))
-#else
-#define VP8_INSTANTIATE_TEST_CASE(test, ...)
-#endif // CONFIG_VP8
-
-
-/*
- * VP9 Codec Definitions
- */
-#if CONFIG_VP9
-class VP9Decoder : public Decoder {
- public:
- VP9Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
- : Decoder(cfg, deadline) {}
-
- protected:
- virtual vpx_codec_iface_t* CodecInterface() const {
-#if CONFIG_VP9_DECODER
- return &vpx_codec_vp9_dx_algo;
-#else
- return NULL;
-#endif
- }
-};
-
-class VP9Encoder : public Encoder {
- public:
- VP9Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
- const unsigned long init_flags, TwopassStatsStore *stats)
- : Encoder(cfg, deadline, init_flags, stats) {}
-
- protected:
- virtual vpx_codec_iface_t* CodecInterface() const {
-#if CONFIG_VP9_ENCODER
- return &vpx_codec_vp9_cx_algo;
-#else
- return NULL;
-#endif
- }
-};
-
-class VP9CodecFactory : public CodecFactory {
- public:
- VP9CodecFactory() : CodecFactory() {}
-
- virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
- unsigned long deadline) const {
-#if CONFIG_VP9_DECODER
- return new VP9Decoder(cfg, deadline);
-#else
- return NULL;
-#endif
- }
-
- virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
- unsigned long deadline,
- const unsigned long init_flags,
- TwopassStatsStore *stats) const {
-#if CONFIG_VP9_ENCODER
- return new VP9Encoder(cfg, deadline, init_flags, stats);
-#else
- return NULL;
-#endif
- }
-
- virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
- int usage) const {
-#if CONFIG_VP9_ENCODER
- return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage);
-#else
- return VPX_CODEC_INCAPABLE;
-#endif
- }
-};
-
-const libvpx_test::VP9CodecFactory kVP9;
-
-#define VP9_INSTANTIATE_TEST_CASE(test, ...)\
- INSTANTIATE_TEST_CASE_P(VP9, test, \
- ::testing::Combine( \
- ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
- &libvpx_test::kVP9)), \
- __VA_ARGS__))
-#else
-#define VP9_INSTANTIATE_TEST_CASE(test, ...)
-#endif // CONFIG_VP9
-
-
-} // namespace libvpx_test
-
-#endif // TEST_CODEC_FACTORY_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/config_test.cc b/videocodec/libvpx_internal/libvpx/test/config_test.cc
deleted file mode 100644
index 0493110..0000000
--- a/videocodec/libvpx_internal/libvpx/test/config_test.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/util.h"
-#include "test/video_source.h"
-
-namespace {
-
-class ConfigTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- protected:
- ConfigTest() : EncoderTest(GET_PARAM(0)),
- frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
- virtual ~ConfigTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- }
-
- virtual void BeginPassHook(unsigned int /*pass*/) {
- frame_count_in_ = 0;
- frame_count_out_ = 0;
- }
-
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {
- ++frame_count_in_;
- abort_ |= (frame_count_in_ >= frame_count_max_);
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {
- ++frame_count_out_;
- }
-
- unsigned int frame_count_in_;
- unsigned int frame_count_out_;
- unsigned int frame_count_max_;
-};
-
-TEST_P(ConfigTest, LagIsDisabled) {
- frame_count_max_ = 2;
- cfg_.g_lag_in_frames = 15;
-
- libvpx_test::DummyVideoSource video;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- EXPECT_EQ(frame_count_in_, frame_count_out_);
-}
-
-VP8_INSTANTIATE_TEST_CASE(ConfigTest, ONE_PASS_TEST_MODES);
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/convolve_test.cc b/videocodec/libvpx_internal/libvpx/test/convolve_test.cc
deleted file mode 100644
index e920de8..0000000
--- a/videocodec/libvpx_internal/libvpx/test/convolve_test.cc
+++ /dev/null
@@ -1,689 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <string.h>
-#include "test/acm_random.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_filter.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/mem.h"
-
-namespace {
-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 filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h);
-
-struct ConvolveFunctions {
- ConvolveFunctions(convolve_fn_t h8, convolve_fn_t h8_avg,
- convolve_fn_t v8, convolve_fn_t v8_avg,
- convolve_fn_t hv8, convolve_fn_t hv8_avg)
- : h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg), v8_avg_(v8_avg),
- hv8_avg_(hv8_avg) {}
-
- convolve_fn_t h8_;
- convolve_fn_t v8_;
- convolve_fn_t hv8_;
- convolve_fn_t h8_avg_;
- convolve_fn_t v8_avg_;
- convolve_fn_t hv8_avg_;
-};
-
-typedef std::tr1::tuple<int, int, const ConvolveFunctions*> convolve_param_t;
-
-// Reference 8-tap subpixel filter, slightly modified to fit into this test.
-#define VP9_FILTER_WEIGHT 128
-#define VP9_FILTER_SHIFT 7
-uint8_t clip_pixel(int x) {
- return x < 0 ? 0 :
- x > 255 ? 255 :
- x;
-}
-
-void filter_block2d_8_c(const uint8_t *src_ptr,
- const unsigned int src_stride,
- const int16_t *HFilter,
- const int16_t *VFilter,
- uint8_t *dst_ptr,
- unsigned int dst_stride,
- unsigned int output_width,
- unsigned int output_height) {
- // Between passes, we use an intermediate buffer whose height is extended to
- // have enough horizontally filtered values as input for the vertical pass.
- // This buffer is allocated to be big enough for the largest block type we
- // support.
- const int kInterp_Extend = 4;
- const unsigned int intermediate_height =
- (kInterp_Extend - 1) + output_height + kInterp_Extend;
-
- /* Size of intermediate_buffer is max_intermediate_height * filter_max_width,
- * where max_intermediate_height = (kInterp_Extend - 1) + filter_max_height
- * + kInterp_Extend
- * = 3 + 16 + 4
- * = 23
- * and filter_max_width = 16
- */
- uint8_t intermediate_buffer[71 * 64];
- const int intermediate_next_stride = 1 - intermediate_height * output_width;
-
- // Horizontal pass (src -> transposed intermediate).
- {
- uint8_t *output_ptr = intermediate_buffer;
- const int src_next_row_stride = src_stride - output_width;
- unsigned int i, j;
- src_ptr -= (kInterp_Extend - 1) * src_stride + (kInterp_Extend - 1);
- for (i = 0; i < intermediate_height; ++i) {
- for (j = 0; j < output_width; ++j) {
- // Apply filter...
- const int temp = (src_ptr[0] * HFilter[0]) +
- (src_ptr[1] * HFilter[1]) +
- (src_ptr[2] * HFilter[2]) +
- (src_ptr[3] * HFilter[3]) +
- (src_ptr[4] * HFilter[4]) +
- (src_ptr[5] * HFilter[5]) +
- (src_ptr[6] * HFilter[6]) +
- (src_ptr[7] * HFilter[7]) +
- (VP9_FILTER_WEIGHT >> 1); // Rounding
-
- // Normalize back to 0-255...
- *output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);
- ++src_ptr;
- output_ptr += intermediate_height;
- }
- src_ptr += src_next_row_stride;
- output_ptr += intermediate_next_stride;
- }
- }
-
- // Vertical pass (transposed intermediate -> dst).
- {
- uint8_t *src_ptr = intermediate_buffer;
- const int dst_next_row_stride = dst_stride - output_width;
- unsigned int i, j;
- for (i = 0; i < output_height; ++i) {
- for (j = 0; j < output_width; ++j) {
- // Apply filter...
- const int temp = (src_ptr[0] * VFilter[0]) +
- (src_ptr[1] * VFilter[1]) +
- (src_ptr[2] * VFilter[2]) +
- (src_ptr[3] * VFilter[3]) +
- (src_ptr[4] * VFilter[4]) +
- (src_ptr[5] * VFilter[5]) +
- (src_ptr[6] * VFilter[6]) +
- (src_ptr[7] * VFilter[7]) +
- (VP9_FILTER_WEIGHT >> 1); // Rounding
-
- // Normalize back to 0-255...
- *dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);
- src_ptr += intermediate_height;
- }
- src_ptr += intermediate_next_stride;
- dst_ptr += dst_next_row_stride;
- }
- }
-}
-
-void block2d_average_c(uint8_t *src,
- unsigned int src_stride,
- uint8_t *output_ptr,
- unsigned int output_stride,
- unsigned int output_width,
- unsigned int output_height) {
- unsigned int i, j;
- for (i = 0; i < output_height; ++i) {
- for (j = 0; j < output_width; ++j) {
- output_ptr[j] = (output_ptr[j] + src[i * src_stride + j] + 1) >> 1;
- }
- output_ptr += output_stride;
- }
-}
-
-void filter_average_block2d_8_c(const uint8_t *src_ptr,
- const unsigned int src_stride,
- const int16_t *HFilter,
- const int16_t *VFilter,
- uint8_t *dst_ptr,
- unsigned int dst_stride,
- unsigned int output_width,
- unsigned int output_height) {
- uint8_t tmp[64 * 64];
-
- assert(output_width <= 64);
- assert(output_height <= 64);
- filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
- output_width, output_height);
- block2d_average_c(tmp, 64, dst_ptr, dst_stride,
- output_width, output_height);
-}
-
-class ConvolveTest : public ::testing::TestWithParam<convolve_param_t> {
- public:
- static void SetUpTestCase() {
- // Force input_ to be unaligned, output to be 16 byte aligned.
- input_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1;
- output_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kOutputBufferSize));
- }
-
- static void TearDownTestCase() {
- vpx_free(input_ - 1);
- input_ = NULL;
- vpx_free(output_);
- output_ = NULL;
- }
-
- protected:
- static const int kDataAlignment = 16;
- static const int kOuterBlockSize = 256;
- static const int kInputStride = kOuterBlockSize;
- static const int kOutputStride = kOuterBlockSize;
- static const int kMaxDimension = 64;
- static const int kInputBufferSize = kOuterBlockSize * kOuterBlockSize;
- static const int kOutputBufferSize = kOuterBlockSize * kOuterBlockSize;
-
- int Width() const { return GET_PARAM(0); }
- int Height() const { return GET_PARAM(1); }
- int BorderLeft() const {
- const int center = (kOuterBlockSize - Width()) / 2;
- return (center + (kDataAlignment - 1)) & ~(kDataAlignment - 1);
- }
- int BorderTop() const { return (kOuterBlockSize - Height()) / 2; }
-
- bool IsIndexInBorder(int i) {
- return (i < BorderTop() * kOuterBlockSize ||
- i >= (BorderTop() + Height()) * kOuterBlockSize ||
- i % kOuterBlockSize < BorderLeft() ||
- i % kOuterBlockSize >= (BorderLeft() + Width()));
- }
-
- virtual void SetUp() {
- UUT_ = GET_PARAM(2);
- /* Set up guard blocks for an inner block centered in the outer block */
- for (int i = 0; i < kOutputBufferSize; ++i) {
- if (IsIndexInBorder(i))
- output_[i] = 255;
- else
- output_[i] = 0;
- }
-
- ::libvpx_test::ACMRandom prng;
- for (int i = 0; i < kInputBufferSize; ++i)
- input_[i] = prng.Rand8Extremes();
- }
-
- void SetConstantInput(int value) {
- memset(input_, value, kInputBufferSize);
- }
-
- void CheckGuardBlocks() {
- for (int i = 0; i < kOutputBufferSize; ++i) {
- if (IsIndexInBorder(i))
- EXPECT_EQ(255, output_[i]);
- }
- }
-
- uint8_t* input() const {
- return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
- }
-
- uint8_t* output() const {
- return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
- }
-
- const ConvolveFunctions* UUT_;
- static uint8_t* input_;
- static uint8_t* output_;
-};
-uint8_t* ConvolveTest::input_ = NULL;
-uint8_t* ConvolveTest::output_ = NULL;
-
-TEST_P(ConvolveTest, GuardBlocks) {
- CheckGuardBlocks();
-}
-
-TEST_P(ConvolveTest, CopyHoriz) {
- uint8_t* const in = input();
- uint8_t* const out = output();
- DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
-
- REGISTER_STATE_CHECK(
- UUT_->h8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
- Width(), Height()));
-
- CheckGuardBlocks();
-
- for (int y = 0; y < Height(); ++y)
- for (int x = 0; x < Width(); ++x)
- ASSERT_EQ(out[y * kOutputStride + x], in[y * kInputStride + x])
- << "(" << x << "," << y << ")";
-}
-
-TEST_P(ConvolveTest, CopyVert) {
- uint8_t* const in = input();
- uint8_t* const out = output();
- DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
-
- REGISTER_STATE_CHECK(
- UUT_->v8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
- Width(), Height()));
-
- CheckGuardBlocks();
-
- for (int y = 0; y < Height(); ++y)
- for (int x = 0; x < Width(); ++x)
- ASSERT_EQ(out[y * kOutputStride + x], in[y * kInputStride + x])
- << "(" << x << "," << y << ")";
-}
-
-TEST_P(ConvolveTest, Copy2D) {
- uint8_t* const in = input();
- uint8_t* const out = output();
- DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
-
- REGISTER_STATE_CHECK(
- UUT_->hv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
- Width(), Height()));
-
- CheckGuardBlocks();
-
- for (int y = 0; y < Height(); ++y)
- for (int x = 0; x < Width(); ++x)
- ASSERT_EQ(out[y * kOutputStride + x], in[y * kInputStride + x])
- << "(" << x << "," << y << ")";
-}
-
-const int16_t (*kTestFilterList[])[8] = {
- vp9_bilinear_filters,
- vp9_sub_pel_filters_8,
- vp9_sub_pel_filters_8s,
- vp9_sub_pel_filters_8lp
-};
-const int kNumFilterBanks = sizeof(kTestFilterList) /
- sizeof(kTestFilterList[0]);
-const int kNumFilters = 16;
-
-TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
- for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
- const int16_t (*filters)[8] = kTestFilterList[filter_bank];
- for (int i = 0; i < kNumFilters; i++) {
- const int p0 = filters[i][0] + filters[i][1];
- const int p1 = filters[i][2] + filters[i][3];
- const int p2 = filters[i][4] + filters[i][5];
- const int p3 = filters[i][6] + filters[i][7];
- EXPECT_LE(p0, 128);
- EXPECT_LE(p1, 128);
- EXPECT_LE(p2, 128);
- EXPECT_LE(p3, 128);
- EXPECT_LE(p0 + p3, 128);
- EXPECT_LE(p0 + p3 + p1, 128);
- EXPECT_LE(p0 + p3 + p1 + p2, 128);
- EXPECT_EQ(p0 + p1 + p2 + p3, 128);
- }
- }
-}
-
-const int16_t kInvalidFilter[8] = { 0 };
-
-TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
- uint8_t* const in = input();
- uint8_t* const out = output();
- uint8_t ref[kOutputStride * kMaxDimension];
-
-
- for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
- const int16_t (*filters)[8] = kTestFilterList[filter_bank];
-
- for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
- for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
- filter_block2d_8_c(in, kInputStride,
- filters[filter_x], filters[filter_y],
- ref, kOutputStride,
- Width(), Height());
-
- if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y))
- REGISTER_STATE_CHECK(
- UUT_->hv8_(in, kInputStride, out, kOutputStride,
- filters[filter_x], 16, filters[filter_y], 16,
- Width(), Height()));
- else if (filter_y)
- REGISTER_STATE_CHECK(
- UUT_->v8_(in, kInputStride, out, kOutputStride,
- kInvalidFilter, 16, filters[filter_y], 16,
- Width(), Height()));
- else
- REGISTER_STATE_CHECK(
- UUT_->h8_(in, kInputStride, out, kOutputStride,
- filters[filter_x], 16, kInvalidFilter, 16,
- Width(), Height()));
-
- CheckGuardBlocks();
-
- for (int y = 0; y < Height(); ++y)
- for (int x = 0; x < Width(); ++x)
- ASSERT_EQ(ref[y * kOutputStride + x], out[y * kOutputStride + x])
- << "mismatch at (" << x << "," << y << "), "
- << "filters (" << filter_bank << ","
- << filter_x << "," << filter_y << ")";
- }
- }
- }
-}
-
-TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
- uint8_t* const in = input();
- uint8_t* const out = output();
- uint8_t ref[kOutputStride * kMaxDimension];
-
- // Populate ref and out with some random data
- ::libvpx_test::ACMRandom prng;
- for (int y = 0; y < Height(); ++y) {
- for (int x = 0; x < Width(); ++x) {
- const uint8_t r = prng.Rand8Extremes();
-
- out[y * kOutputStride + x] = r;
- ref[y * kOutputStride + x] = r;
- }
- }
-
- const int kNumFilterBanks = sizeof(kTestFilterList) /
- sizeof(kTestFilterList[0]);
-
- for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
- const int16_t (*filters)[8] = kTestFilterList[filter_bank];
- const int kNumFilters = 16;
-
- for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
- for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
- filter_average_block2d_8_c(in, kInputStride,
- filters[filter_x], filters[filter_y],
- ref, kOutputStride,
- Width(), Height());
-
- if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y))
- REGISTER_STATE_CHECK(
- UUT_->hv8_avg_(in, kInputStride, out, kOutputStride,
- filters[filter_x], 16, filters[filter_y], 16,
- Width(), Height()));
- else if (filter_y)
- REGISTER_STATE_CHECK(
- UUT_->v8_avg_(in, kInputStride, out, kOutputStride,
- filters[filter_x], 16, filters[filter_y], 16,
- Width(), Height()));
- else
- REGISTER_STATE_CHECK(
- UUT_->h8_avg_(in, kInputStride, out, kOutputStride,
- filters[filter_x], 16, filters[filter_y], 16,
- Width(), Height()));
-
- CheckGuardBlocks();
-
- for (int y = 0; y < Height(); ++y)
- for (int x = 0; x < Width(); ++x)
- ASSERT_EQ(ref[y * kOutputStride + x], out[y * kOutputStride + x])
- << "mismatch at (" << x << "," << y << "), "
- << "filters (" << filter_bank << ","
- << filter_x << "," << filter_y << ")";
- }
- }
- }
-}
-
-DECLARE_ALIGNED(256, const int16_t, kChangeFilters[16][8]) = {
- { 0, 0, 0, 0, 0, 0, 0, 128},
- { 0, 0, 0, 0, 0, 0, 128},
- { 0, 0, 0, 0, 0, 128},
- { 0, 0, 0, 0, 128},
- { 0, 0, 0, 128},
- { 0, 0, 128},
- { 0, 128},
- { 128},
- { 0, 0, 0, 0, 0, 0, 0, 128},
- { 0, 0, 0, 0, 0, 0, 128},
- { 0, 0, 0, 0, 0, 128},
- { 0, 0, 0, 0, 128},
- { 0, 0, 0, 128},
- { 0, 0, 128},
- { 0, 128},
- { 128}
-};
-
-/* This test exercises the horizontal and vertical filter functions. */
-TEST_P(ConvolveTest, ChangeFilterWorks) {
- uint8_t* const in = input();
- uint8_t* const out = output();
-
- /* Assume that the first input sample is at the 8/16th position. */
- const int kInitialSubPelOffset = 8;
-
- /* Filters are 8-tap, so the first filter tap will be applied to the pixel
- * at position -3 with respect to the current filtering position. Since
- * kInitialSubPelOffset is set to 8, we first select sub-pixel filter 8,
- * which is non-zero only in the last tap. So, applying the filter at the
- * current input position will result in an output equal to the pixel at
- * offset +4 (-3 + 7) with respect to the current filtering position.
- */
- const int kPixelSelected = 4;
-
- /* Assume that each output pixel requires us to step on by 17/16th pixels in
- * the input.
- */
- const int kInputPixelStep = 17;
-
- /* The filters are setup in such a way that the expected output produces
- * sets of 8 identical output samples. As the filter position moves to the
- * next 1/16th pixel position the only active (=128) filter tap moves one
- * position to the left, resulting in the same input pixel being replicated
- * in to the output for 8 consecutive samples. After each set of 8 positions
- * the filters select a different input pixel. kFilterPeriodAdjust below
- * computes which input pixel is written to the output for a specified
- * x or y position.
- */
-
- /* Test the horizontal filter. */
- REGISTER_STATE_CHECK(UUT_->h8_(in, kInputStride, out, kOutputStride,
- kChangeFilters[kInitialSubPelOffset],
- kInputPixelStep, NULL, 0, Width(), Height()));
-
- for (int x = 0; x < Width(); ++x) {
- const int kFilterPeriodAdjust = (x >> 3) << 3;
- const int ref_x =
- kPixelSelected + ((kInitialSubPelOffset
- + kFilterPeriodAdjust * kInputPixelStep)
- >> SUBPEL_BITS);
- ASSERT_EQ(in[ref_x], out[x]) << "x == " << x << "width = " << Width();
- }
-
- /* Test the vertical filter. */
- REGISTER_STATE_CHECK(UUT_->v8_(in, kInputStride, out, kOutputStride,
- NULL, 0, kChangeFilters[kInitialSubPelOffset],
- kInputPixelStep, Width(), Height()));
-
- for (int y = 0; y < Height(); ++y) {
- const int kFilterPeriodAdjust = (y >> 3) << 3;
- const int ref_y =
- kPixelSelected + ((kInitialSubPelOffset
- + kFilterPeriodAdjust * kInputPixelStep)
- >> SUBPEL_BITS);
- ASSERT_EQ(in[ref_y * kInputStride], out[y * kInputStride]) << "y == " << y;
- }
-
- /* Test the horizontal and vertical filters in combination. */
- REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride,
- kChangeFilters[kInitialSubPelOffset],
- kInputPixelStep,
- kChangeFilters[kInitialSubPelOffset],
- kInputPixelStep,
- Width(), Height()));
-
- for (int y = 0; y < Height(); ++y) {
- const int kFilterPeriodAdjustY = (y >> 3) << 3;
- const int ref_y =
- kPixelSelected + ((kInitialSubPelOffset
- + kFilterPeriodAdjustY * kInputPixelStep)
- >> SUBPEL_BITS);
- for (int x = 0; x < Width(); ++x) {
- const int kFilterPeriodAdjustX = (x >> 3) << 3;
- const int ref_x =
- kPixelSelected + ((kInitialSubPelOffset
- + kFilterPeriodAdjustX * kInputPixelStep)
- >> SUBPEL_BITS);
-
- ASSERT_EQ(in[ref_y * kInputStride + ref_x], out[y * kOutputStride + x])
- << "x == " << x << ", y == " << y;
- }
- }
-}
-
-/* This test exercises that enough rows and columns are filtered with every
- possible initial fractional positions and scaling steps. */
-TEST_P(ConvolveTest, CheckScalingFiltering) {
- uint8_t* const in = input();
- uint8_t* const out = output();
-
- SetConstantInput(127);
-
- for (int frac = 0; frac < 16; ++frac) {
- for (int step = 1; step <= 32; ++step) {
- /* Test the horizontal and vertical filters in combination. */
- REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride,
- vp9_sub_pel_filters_8[frac], step,
- vp9_sub_pel_filters_8[frac], step,
- Width(), Height()));
-
- CheckGuardBlocks();
-
- for (int y = 0; y < Height(); ++y) {
- for (int x = 0; x < Width(); ++x) {
- ASSERT_EQ(in[y * kInputStride + x], out[y * kOutputStride + x])
- << "x == " << x << ", y == " << y
- << ", frac == " << frac << ", step == " << step;
- }
- }
- }
- }
-}
-
-using std::tr1::make_tuple;
-
-const ConvolveFunctions convolve8_c(
- vp9_convolve8_horiz_c, vp9_convolve8_avg_horiz_c,
- vp9_convolve8_vert_c, vp9_convolve8_avg_vert_c,
- vp9_convolve8_c, vp9_convolve8_avg_c);
-
-INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values(
- make_tuple(4, 4, &convolve8_c),
- make_tuple(8, 4, &convolve8_c),
- make_tuple(4, 8, &convolve8_c),
- make_tuple(8, 8, &convolve8_c),
- make_tuple(16, 8, &convolve8_c),
- make_tuple(8, 16, &convolve8_c),
- make_tuple(16, 16, &convolve8_c),
- make_tuple(32, 16, &convolve8_c),
- make_tuple(16, 32, &convolve8_c),
- make_tuple(32, 32, &convolve8_c),
- make_tuple(64, 32, &convolve8_c),
- make_tuple(32, 64, &convolve8_c),
- make_tuple(64, 64, &convolve8_c)));
-
-#if HAVE_SSE2
-const ConvolveFunctions convolve8_sse2(
- vp9_convolve8_horiz_sse2, vp9_convolve8_avg_horiz_sse2,
- vp9_convolve8_vert_sse2, vp9_convolve8_avg_vert_sse2,
- vp9_convolve8_sse2, vp9_convolve8_avg_sse2);
-
-INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, ::testing::Values(
- make_tuple(4, 4, &convolve8_sse2),
- make_tuple(8, 4, &convolve8_sse2),
- make_tuple(4, 8, &convolve8_sse2),
- make_tuple(8, 8, &convolve8_sse2),
- make_tuple(16, 8, &convolve8_sse2),
- make_tuple(8, 16, &convolve8_sse2),
- make_tuple(16, 16, &convolve8_sse2),
- make_tuple(32, 16, &convolve8_sse2),
- make_tuple(16, 32, &convolve8_sse2),
- make_tuple(32, 32, &convolve8_sse2),
- make_tuple(64, 32, &convolve8_sse2),
- make_tuple(32, 64, &convolve8_sse2),
- make_tuple(64, 64, &convolve8_sse2)));
-#endif
-
-#if HAVE_SSSE3
-const ConvolveFunctions convolve8_ssse3(
- vp9_convolve8_horiz_ssse3, vp9_convolve8_avg_horiz_ssse3,
- vp9_convolve8_vert_ssse3, vp9_convolve8_avg_vert_ssse3,
- vp9_convolve8_ssse3, vp9_convolve8_avg_ssse3);
-
-INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, ::testing::Values(
- make_tuple(4, 4, &convolve8_ssse3),
- make_tuple(8, 4, &convolve8_ssse3),
- make_tuple(4, 8, &convolve8_ssse3),
- make_tuple(8, 8, &convolve8_ssse3),
- make_tuple(16, 8, &convolve8_ssse3),
- make_tuple(8, 16, &convolve8_ssse3),
- make_tuple(16, 16, &convolve8_ssse3),
- make_tuple(32, 16, &convolve8_ssse3),
- make_tuple(16, 32, &convolve8_ssse3),
- make_tuple(32, 32, &convolve8_ssse3),
- make_tuple(64, 32, &convolve8_ssse3),
- make_tuple(32, 64, &convolve8_ssse3),
- make_tuple(64, 64, &convolve8_ssse3)));
-#endif
-
-#if HAVE_NEON
-const ConvolveFunctions convolve8_neon(
- vp9_convolve8_horiz_neon, vp9_convolve8_avg_horiz_neon,
- vp9_convolve8_vert_neon, vp9_convolve8_avg_vert_neon,
- vp9_convolve8_neon, vp9_convolve8_avg_neon);
-
-INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest, ::testing::Values(
- make_tuple(4, 4, &convolve8_neon),
- make_tuple(8, 4, &convolve8_neon),
- make_tuple(4, 8, &convolve8_neon),
- make_tuple(8, 8, &convolve8_neon),
- make_tuple(16, 8, &convolve8_neon),
- make_tuple(8, 16, &convolve8_neon),
- make_tuple(16, 16, &convolve8_neon),
- make_tuple(32, 16, &convolve8_neon),
- make_tuple(16, 32, &convolve8_neon),
- make_tuple(32, 32, &convolve8_neon),
- make_tuple(64, 32, &convolve8_neon),
- make_tuple(32, 64, &convolve8_neon),
- make_tuple(64, 64, &convolve8_neon)));
-#endif
-
-#if HAVE_DSPR2
-const ConvolveFunctions convolve8_dspr2(
- vp9_convolve8_horiz_dspr2, vp9_convolve8_avg_horiz_dspr2,
- vp9_convolve8_vert_dspr2, vp9_convolve8_avg_vert_dspr2,
- vp9_convolve8_dspr2, vp9_convolve8_avg_dspr2);
-
-INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest, ::testing::Values(
- make_tuple(4, 4, &convolve8_dspr2),
- make_tuple(8, 4, &convolve8_dspr2),
- make_tuple(4, 8, &convolve8_dspr2),
- make_tuple(8, 8, &convolve8_dspr2),
- make_tuple(16, 8, &convolve8_dspr2),
- make_tuple(8, 16, &convolve8_dspr2),
- make_tuple(16, 16, &convolve8_dspr2),
- make_tuple(32, 16, &convolve8_dspr2),
- make_tuple(16, 32, &convolve8_dspr2),
- make_tuple(32, 32, &convolve8_dspr2),
- make_tuple(64, 32, &convolve8_dspr2),
- make_tuple(32, 64, &convolve8_dspr2),
- make_tuple(64, 64, &convolve8_dspr2)));
-#endif
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/cpu_speed_test.cc b/videocodec/libvpx_internal/libvpx/test/cpu_speed_test.cc
deleted file mode 100644
index be651b4..0000000
--- a/videocodec/libvpx_internal/libvpx/test/cpu_speed_test.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <climits>
-#include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-class CpuSpeedTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWith2Params<
- libvpx_test::TestMode, int> {
- protected:
- CpuSpeedTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~CpuSpeedTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- set_cpu_used_ = GET_PARAM(2);
- }
-
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
- encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
- encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
- encoder->Control(VP8E_SET_ARNR_STRENGTH, 5);
- encoder->Control(VP8E_SET_ARNR_TYPE, 3);
- }
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
- }
- }
- int set_cpu_used_;
-};
-
-TEST_P(CpuSpeedTest, TestQ0) {
- // Validate that this non multiple of 64 wide clip encodes and decodes
- // without a mismatch when passing in a very low max q. This pushes
- // the encoder to producing lots of big partitions which will likely
- // extend into the border and test the border condition.
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_2pass_vbr_minsection_pct = 5;
- cfg_.rc_2pass_vbr_minsection_pct = 2000;
- cfg_.rc_target_bitrate = 400;
- cfg_.rc_max_quantizer = 0;
- cfg_.rc_min_quantizer = 0;
-
- ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
- 20);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-
-TEST_P(CpuSpeedTest, TestEncodeHighBitrate) {
- // Validate that this non multiple of 64 wide clip encodes and decodes
- // without a mismatch when passing in a very low max q. This pushes
- // the encoder to producing lots of big partitions which will likely
- // extend into the border and test the border condition.
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_2pass_vbr_minsection_pct = 5;
- cfg_.rc_2pass_vbr_minsection_pct = 2000;
- cfg_.rc_target_bitrate = 12000;
- cfg_.rc_max_quantizer = 10;
- cfg_.rc_min_quantizer = 0;
-
- ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
- 20);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-TEST_P(CpuSpeedTest, TestLowBitrate) {
- // Validate that this clip encodes and decodes without a mismatch
- // when passing in a very high min q. This pushes the encoder to producing
- // lots of small partitions which might will test the other condition.
-
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_2pass_vbr_minsection_pct = 5;
- cfg_.rc_2pass_vbr_minsection_pct = 2000;
- cfg_.rc_target_bitrate = 200;
- cfg_.rc_min_quantizer = 40;
-
- ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
- 20);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-using std::tr1::make_tuple;
-
-#define VP9_FACTORY \
- static_cast<const libvpx_test::CodecFactory*> (&libvpx_test::kVP9)
-
-VP9_INSTANTIATE_TEST_CASE(
- CpuSpeedTest,
- ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
- ::testing::Range(0, 8));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/cq_test.cc b/videocodec/libvpx_internal/libvpx/test/cq_test.cc
deleted file mode 100644
index 7da7b80..0000000
--- a/videocodec/libvpx_internal/libvpx/test/cq_test.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <cmath>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-// CQ level range: [kCQLevelMin, kCQLevelMax).
-const int kCQLevelMin = 4;
-const int kCQLevelMax = 63;
-const int kCQLevelStep = 8;
-const unsigned int kCQTargetBitrate = 2000;
-
-class CQTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<int> {
- protected:
- CQTest() : EncoderTest(GET_PARAM(0)), cq_level_(GET_PARAM(1)) {
- init_flags_ = VPX_CODEC_USE_PSNR;
- }
-
- virtual ~CQTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(libvpx_test::kTwoPassGood);
- }
-
- virtual void BeginPassHook(unsigned int /*pass*/) {
- file_size_ = 0;
- psnr_ = 0.0;
- n_frames_ = 0;
- }
-
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- if (cfg_.rc_end_usage == VPX_CQ) {
- encoder->Control(VP8E_SET_CQ_LEVEL, cq_level_);
- }
- encoder->Control(VP8E_SET_CPUUSED, 3);
- }
- }
-
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
- psnr_ += pow(10.0, pkt->data.psnr.psnr[0] / 10.0);
- n_frames_++;
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- file_size_ += pkt->data.frame.sz;
- }
-
- double GetLinearPSNROverBitrate() const {
- double avg_psnr = log10(psnr_ / n_frames_) * 10.0;
- return pow(10.0, avg_psnr / 10.0) / file_size_;
- }
-
- size_t file_size() const { return file_size_; }
- int n_frames() const { return n_frames_; }
-
- private:
- int cq_level_;
- size_t file_size_;
- double psnr_;
- int n_frames_;
-};
-
-unsigned int prev_actual_bitrate = kCQTargetBitrate;
-TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
- const vpx_rational timebase = { 33333333, 1000000000 };
- cfg_.g_timebase = timebase;
- cfg_.rc_target_bitrate = kCQTargetBitrate;
- cfg_.g_lag_in_frames = 25;
-
- cfg_.rc_end_usage = VPX_CQ;
- libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- timebase.den, timebase.num, 0, 30);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- const double cq_psnr_lin = GetLinearPSNROverBitrate();
- const unsigned int cq_actual_bitrate =
- static_cast<unsigned int>(file_size()) * 8 * 30 / (n_frames() * 1000);
- EXPECT_LE(cq_actual_bitrate, kCQTargetBitrate);
- EXPECT_LE(cq_actual_bitrate, prev_actual_bitrate);
- prev_actual_bitrate = cq_actual_bitrate;
-
- // try targeting the approximate same bitrate with VBR mode
- cfg_.rc_end_usage = VPX_VBR;
- cfg_.rc_target_bitrate = cq_actual_bitrate;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- const double vbr_psnr_lin = GetLinearPSNROverBitrate();
- EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
-}
-
-VP8_INSTANTIATE_TEST_CASE(CQTest,
- ::testing::Range(kCQLevelMin, kCQLevelMax,
- kCQLevelStep));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/datarate_test.cc b/videocodec/libvpx_internal/libvpx/test/datarate_test.cc
deleted file mode 100644
index 1b921f0..0000000
--- a/videocodec/libvpx_internal/libvpx/test/datarate_test.cc
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "./vpx_config.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-#include "test/y4m_video_source.h"
-
-namespace {
-
-class DatarateTestLarge : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- public:
- DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {}
-
- virtual ~DatarateTestLarge() {}
-
- protected:
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- ResetModel();
- }
-
- virtual void ResetModel() {
- last_pts_ = 0;
- bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz;
- frame_number_ = 0;
- first_drop_ = 0;
- bits_total_ = 0;
- duration_ = 0.0;
- }
-
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
- const vpx_rational_t tb = video->timebase();
- timebase_ = static_cast<double>(tb.num) / tb.den;
- duration_ = 0;
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- // Time since last timestamp = duration.
- vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
-
- // TODO(jimbankoski): Remove these lines when the issue:
- // http://code.google.com/p/webm/issues/detail?id=496 is fixed.
- // For now the codec assumes buffer starts at starting buffer rate
- // plus one frame's time.
- if (last_pts_ == 0)
- duration = 1;
-
- // Add to the buffer the bits we'd expect from a constant bitrate server.
- bits_in_buffer_model_ += static_cast<int64_t>(
- duration * timebase_ * cfg_.rc_target_bitrate * 1000);
-
- /* Test the buffer model here before subtracting the frame. Do so because
- * the way the leaky bucket model works in libvpx is to allow the buffer to
- * empty - and then stop showing frames until we've got enough bits to
- * show one. As noted in comment below (issue 495), this does not currently
- * apply to key frames. For now exclude key frames in condition below. */
- const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY)
- ? true: false;
- if (!key_frame) {
- ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
- << pkt->data.frame.pts;
- }
-
- const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
-
- // Subtract from the buffer the bits associated with a played back frame.
- bits_in_buffer_model_ -= frame_size_in_bits;
-
- // Update the running total of bits for end of test datarate checks.
- bits_total_ += frame_size_in_bits;
-
- // If first drop not set and we have a drop set it to this time.
- if (!first_drop_ && duration > 1)
- first_drop_ = last_pts_ + 1;
-
- // Update the most recent pts.
- last_pts_ = pkt->data.frame.pts;
-
- // We update this so that we can calculate the datarate minus the last
- // frame encoded in the file.
- bits_in_last_frame_ = frame_size_in_bits;
-
- ++frame_number_;
- }
-
- virtual void EndPassHook(void) {
- if (bits_total_) {
- const double file_size_in_kb = bits_total_ / 1000.; // bits per kilobit
-
- duration_ = (last_pts_ + 1) * timebase_;
-
- // Effective file datarate includes the time spent prebuffering.
- effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0
- / (cfg_.rc_buf_initial_sz / 1000.0 + duration_);
-
- file_datarate_ = file_size_in_kb / duration_;
- }
- }
-
- vpx_codec_pts_t last_pts_;
- int64_t bits_in_buffer_model_;
- double timebase_;
- int frame_number_;
- vpx_codec_pts_t first_drop_;
- int64_t bits_total_;
- double duration_;
- double file_datarate_;
- double effective_datarate_;
- size_t bits_in_last_frame_;
-};
-
-TEST_P(DatarateTestLarge, BasicBufferModel) {
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_dropframe_thresh = 1;
- cfg_.rc_max_quantizer = 56;
- cfg_.rc_end_usage = VPX_CBR;
- // 2 pass cbr datarate control has a bug hidden by the small # of
- // frames selected in this encode. The problem is that even if the buffer is
- // negative we produce a keyframe on a cutscene. Ignoring datarate
- // constraints
- // TODO(jimbankoski): ( Fix when issue
- // http://code.google.com/p/webm/issues/detail?id=495 is addressed. )
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 140);
-
- // There is an issue for low bitrates in real-time mode, where the
- // effective_datarate slightly overshoots the target bitrate.
- // This is same the issue as noted about (#495).
- // TODO(jimbankoski/marpan): Update test to run for lower bitrates (< 100),
- // when the issue is resolved.
- for (int i = 100; i < 800; i += 200) {
- cfg_.rc_target_bitrate = i;
- ResetModel();
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_)
- << " The datarate for the file exceeds the target!";
-
- ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3)
- << " The datarate for the file missed the target!";
- }
-}
-
-TEST_P(DatarateTestLarge, ChangingDropFrameThresh) {
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_max_quantizer = 36;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.rc_target_bitrate = 200;
- cfg_.kf_mode = VPX_KF_DISABLED;
-
- const int frame_count = 40;
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, frame_count);
-
- // Here we check that the first dropped frame gets earlier and earlier
- // as the drop frame threshold is increased.
-
- const int kDropFrameThreshTestStep = 30;
- vpx_codec_pts_t last_drop = frame_count;
- for (int i = 1; i < 91; i += kDropFrameThreshTestStep) {
- cfg_.rc_dropframe_thresh = i;
- ResetModel();
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- ASSERT_LE(first_drop_, last_drop)
- << " The first dropped frame for drop_thresh " << i
- << " > first dropped frame for drop_thresh "
- << i - kDropFrameThreshTestStep;
- last_drop = first_drop_;
- }
-}
-
-class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
- public:
- DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {}
-
- protected:
- virtual ~DatarateTestVP9Large() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- set_cpu_used_ = GET_PARAM(2);
- ResetModel();
- }
-
- virtual void ResetModel() {
- last_pts_ = 0;
- bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz;
- frame_number_ = 0;
- tot_frame_number_ = 0;
- first_drop_ = 0;
- num_drops_ = 0;
- // For testing up to 3 layers.
- for (int i = 0; i < 3; ++i) {
- bits_total_[i] = 0;
- }
- }
-
- //
- // Frame flags and layer id for temporal layers.
- //
-
- // For two layers, test pattern is:
- // 1 3
- // 0 2 .....
- // For three layers, test pattern is:
- // 1 3 5 7
- // 2 6
- // 0 4 ....
- // LAST is always update on base/layer 0, GOLDEN is updated on layer 1.
- // For this 3 layer example, the 2nd enhancement layer (layer 2) does not
- // update any reference frames.
- int SetFrameFlags(int frame_num, int num_temp_layers) {
- int frame_flags = 0;
- if (num_temp_layers == 2) {
- if (frame_num % 2 == 0) {
- // Layer 0: predict from L and ARF, update L.
- frame_flags = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF;
- } else {
- // Layer 1: predict from L, G and ARF, and update G.
- frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_ENTROPY;
- }
- } else if (num_temp_layers == 3) {
- if (frame_num % 4 == 0) {
- // Layer 0: predict from L and ARF; update L.
- frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_REF_GF;
- } else if ((frame_num - 2) % 4 == 0) {
- // Layer 1: predict from L, G, ARF; update G.
- frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
- } else if ((frame_num - 1) % 2 == 0) {
- // Layer 2: predict from L, G, ARF; update none.
- frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
- VP8_EFLAG_NO_UPD_LAST;
- }
- }
- return frame_flags;
- }
-
- int SetLayerId(int frame_num, int num_temp_layers) {
- int layer_id = 0;
- if (num_temp_layers == 2) {
- if (frame_num % 2 == 0) {
- layer_id = 0;
- } else {
- layer_id = 1;
- }
- } else if (num_temp_layers == 3) {
- if (frame_num % 4 == 0) {
- layer_id = 0;
- } else if ((frame_num - 2) % 4 == 0) {
- layer_id = 1;
- } else if ((frame_num - 1) % 2 == 0) {
- layer_id = 2;
- }
- }
- return layer_id;
- }
-
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
- }
- if (cfg_.ts_number_layers > 1) {
- if (video->frame() == 1) {
- encoder->Control(VP9E_SET_SVC, 1);
- }
- vpx_svc_layer_id_t layer_id = {0, 0};
- layer_id.spatial_layer_id = 0;
- frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
- layer_id.temporal_layer_id = SetLayerId(video->frame(),
- cfg_.ts_number_layers);
- if (video->frame() > 0) {
- encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
- }
- }
- const vpx_rational_t tb = video->timebase();
- timebase_ = static_cast<double>(tb.num) / tb.den;
- duration_ = 0;
- }
-
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- // Time since last timestamp = duration.
- vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
-
- if (duration > 1) {
- // If first drop not set and we have a drop set it to this time.
- if (!first_drop_)
- first_drop_ = last_pts_ + 1;
- // Update the number of frame drops.
- num_drops_ += static_cast<int>(duration - 1);
- // Update counter for total number of frames (#frames input to encoder).
- // Needed for setting the proper layer_id below.
- tot_frame_number_ += static_cast<int>(duration - 1);
- }
-
- int layer = SetLayerId(tot_frame_number_, cfg_.ts_number_layers);
-
- // Add to the buffer the bits we'd expect from a constant bitrate server.
- bits_in_buffer_model_ += static_cast<int64_t>(
- duration * timebase_ * cfg_.rc_target_bitrate * 1000);
-
- // Buffer should not go negative.
- ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
- << pkt->data.frame.pts;
-
- const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
-
- // Update the total encoded bits. For temporal layers, update the cumulative
- // encoded bits per layer.
- for (int i = layer; i < static_cast<int>(cfg_.ts_number_layers); ++i) {
- bits_total_[i] += frame_size_in_bits;
- }
-
- // Update the most recent pts.
- last_pts_ = pkt->data.frame.pts;
- ++frame_number_;
- ++tot_frame_number_;
- }
-
- virtual void EndPassHook(void) {
- for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
- ++layer) {
- duration_ = (last_pts_ + 1) * timebase_;
- if (bits_total_[layer]) {
- // Effective file datarate:
- effective_datarate_[layer] = (bits_total_[layer] / 1000.0) / duration_;
- }
- }
- }
-
- vpx_codec_pts_t last_pts_;
- double timebase_;
- int frame_number_; // Counter for number of non-dropped/encoded frames.
- int tot_frame_number_; // Counter for total number of input frames.
- int64_t bits_total_[3];
- double duration_;
- double effective_datarate_[3];
- int set_cpu_used_;
- int64_t bits_in_buffer_model_;
- vpx_codec_pts_t first_drop_;
- int num_drops_;
-};
-
-// Check basic rate targeting,
-TEST_P(DatarateTestVP9Large, BasicRateTargeting) {
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_dropframe_thresh = 1;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_max_quantizer = 63;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.g_lag_in_frames = 0;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 140);
- for (int i = 150; i < 800; i += 200) {
- cfg_.rc_target_bitrate = i;
- ResetModel();
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85)
- << " The datarate for the file is lower than target by too much!";
- ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15)
- << " The datarate for the file is greater than target by too much!";
- }
-}
-
-// Check basic rate targeting,
-TEST_P(DatarateTestVP9Large, BasicRateTargeting444) {
- ::libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140);
-
- cfg_.g_profile = 1;
- cfg_.g_timebase = video.timebase();
-
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_dropframe_thresh = 1;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_max_quantizer = 63;
- cfg_.rc_end_usage = VPX_CBR;
-
- for (int i = 250; i < 900; i += 200) {
- cfg_.rc_target_bitrate = i;
- ResetModel();
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- ASSERT_GE(static_cast<double>(cfg_.rc_target_bitrate),
- effective_datarate_[0] * 0.85)
- << " The datarate for the file exceeds the target by too much!";
- ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate),
- effective_datarate_[0] * 1.15)
- << " The datarate for the file missed the target!"
- << cfg_.rc_target_bitrate << " "<< effective_datarate_;
- }
-}
-
-// Check that (1) the first dropped frame gets earlier and earlier
-// as the drop frame threshold is increased, and (2) that the total number of
-// frame drops does not decrease as we increase frame drop threshold.
-// Use a lower qp-max to force some frame drops.
-TEST_P(DatarateTestVP9Large, ChangingDropFrameThresh) {
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_undershoot_pct = 20;
- cfg_.rc_undershoot_pct = 20;
- cfg_.rc_dropframe_thresh = 10;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_max_quantizer = 50;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.rc_target_bitrate = 200;
- cfg_.g_lag_in_frames = 0;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 140);
-
- const int kDropFrameThreshTestStep = 30;
- vpx_codec_pts_t last_drop = 140;
- int last_num_drops = 0;
- for (int i = 10; i < 100; i += kDropFrameThreshTestStep) {
- cfg_.rc_dropframe_thresh = i;
- ResetModel();
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85)
- << " The datarate for the file is lower than target by too much!";
- ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15)
- << " The datarate for the file is greater than target by too much!";
- ASSERT_LE(first_drop_, last_drop)
- << " The first dropped frame for drop_thresh " << i
- << " > first dropped frame for drop_thresh "
- << i - kDropFrameThreshTestStep;
- ASSERT_GE(num_drops_, last_num_drops)
- << " The number of dropped frames for drop_thresh " << i
- << " < number of dropped frames for drop_thresh "
- << i - kDropFrameThreshTestStep;
- last_drop = first_drop_;
- last_num_drops = num_drops_;
- }
-}
-
-// Check basic rate targeting for 2 temporal layers.
-TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) {
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_dropframe_thresh = 1;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_max_quantizer = 63;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.g_lag_in_frames = 0;
-
- // 2 Temporal layers, no spatial layers: Framerate decimation (2, 1).
- cfg_.ss_number_layers = 1;
- cfg_.ts_number_layers = 2;
- cfg_.ts_rate_decimator[0] = 2;
- cfg_.ts_rate_decimator[1] = 1;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 200);
- for (int i = 200; i <= 800; i += 200) {
- cfg_.rc_target_bitrate = i;
- ResetModel();
- // 60-40 bitrate allocation for 2 temporal layers.
- cfg_.ts_target_bitrate[0] = 60 * cfg_.rc_target_bitrate / 100;
- cfg_.ts_target_bitrate[1] = cfg_.rc_target_bitrate;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
- ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85)
- << " The datarate for the file is lower than target by too much, "
- "for layer: " << j;
- ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15)
- << " The datarate for the file is greater than target by too much, "
- "for layer: " << j;
- }
- }
-}
-
-// Check basic rate targeting for 3 temporal layers.
-TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayers) {
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- cfg_.rc_dropframe_thresh = 1;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_max_quantizer = 63;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.g_lag_in_frames = 0;
-
- // 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1).
- cfg_.ss_number_layers = 1;
- cfg_.ts_number_layers = 3;
- cfg_.ts_rate_decimator[0] = 4;
- cfg_.ts_rate_decimator[1] = 2;
- cfg_.ts_rate_decimator[2] = 1;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 200);
- for (int i = 200; i <= 800; i += 200) {
- cfg_.rc_target_bitrate = i;
- ResetModel();
- // 40-20-40 bitrate allocation for 3 temporal layers.
- cfg_.ts_target_bitrate[0] = 40 * cfg_.rc_target_bitrate / 100;
- cfg_.ts_target_bitrate[1] = 60 * cfg_.rc_target_bitrate / 100;
- cfg_.ts_target_bitrate[2] = cfg_.rc_target_bitrate;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
- ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85)
- << " The datarate for the file is lower than target by too much, "
- "for layer: " << j;
- ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15)
- << " The datarate for the file is greater than target by too much, "
- "for layer: " << j;
- }
- }
-}
-
-// Check basic rate targeting for 3 temporal layers, with frame dropping.
-// Only for one (low) bitrate with lower max_quantizer, and somewhat higher
-// frame drop threshold, to force frame dropping.
-TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayersFrameDropping) {
- cfg_.rc_buf_initial_sz = 500;
- cfg_.rc_buf_optimal_sz = 500;
- cfg_.rc_buf_sz = 1000;
- // Set frame drop threshold and rc_max_quantizer to force some frame drops.
- cfg_.rc_dropframe_thresh = 20;
- cfg_.rc_max_quantizer = 45;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_end_usage = VPX_CBR;
- cfg_.g_lag_in_frames = 0;
-
- // 3 Temporal layers, no spatial layers: Framerate decimation (4, 2, 1).
- cfg_.ss_number_layers = 1;
- cfg_.ts_number_layers = 3;
- cfg_.ts_rate_decimator[0] = 4;
- cfg_.ts_rate_decimator[1] = 2;
- cfg_.ts_rate_decimator[2] = 1;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 200);
- cfg_.rc_target_bitrate = 200;
- ResetModel();
- // 40-20-40 bitrate allocation for 3 temporal layers.
- cfg_.ts_target_bitrate[0] = 40 * cfg_.rc_target_bitrate / 100;
- cfg_.ts_target_bitrate[1] = 60 * cfg_.rc_target_bitrate / 100;
- cfg_.ts_target_bitrate[2] = cfg_.rc_target_bitrate;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
- ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.85)
- << " The datarate for the file is lower than target by too much, "
- "for layer: " << j;
- ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.15)
- << " The datarate for the file is greater than target by too much, "
- "for layer: " << j;
- // Expect some frame drops in this test: for this 200 frames test,
- // expect at least 10% and not more than 50% drops.
- ASSERT_GE(num_drops_, 20);
- ASSERT_LE(num_drops_, 100);
- }
-}
-
-VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES);
-VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large,
- ::testing::Values(::libvpx_test::kOnePassGood,
- ::libvpx_test::kRealTime),
- ::testing::Range(2, 5));
-// TODO(marpan): Speed 5 to 7 fails on one of these tests, for
-// real-time mode. So for now test up to speed 4, and start at 2
-// (since speed 0 and 1 are slow). Enable more speeds when issue is fixed.
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/dct16x16_test.cc b/videocodec/libvpx_internal/libvpx/test/dct16x16_test.cc
deleted file mode 100644
index cb5562e..0000000
--- a/videocodec/libvpx_internal/libvpx/test/dct16x16_test.cc
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vpx/vpx_integer.h"
-
-extern "C" {
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch);
-}
-
-using libvpx_test::ACMRandom;
-
-namespace {
-
-#ifdef _MSC_VER
-static int round(double x) {
- if (x < 0)
- return static_cast<int>(ceil(x - 0.5));
- else
- return static_cast<int>(floor(x + 0.5));
-}
-#endif
-
-const int kNumCoeffs = 256;
-const double PI = 3.1415926535898;
-void reference2_16x16_idct_2d(double *input, double *output) {
- double x;
- for (int l = 0; l < 16; ++l) {
- for (int k = 0; k < 16; ++k) {
- double s = 0;
- for (int i = 0; i < 16; ++i) {
- for (int j = 0; j < 16; ++j) {
- x = cos(PI * j * (l + 0.5) / 16.0) *
- cos(PI * i * (k + 0.5) / 16.0) *
- input[i * 16 + j] / 256;
- if (i != 0)
- x *= sqrt(2.0);
- if (j != 0)
- x *= sqrt(2.0);
- s += x;
- }
- }
- output[k*16+l] = s;
- }
- }
-}
-
-
-const double C1 = 0.995184726672197;
-const double C2 = 0.98078528040323;
-const double C3 = 0.956940335732209;
-const double C4 = 0.923879532511287;
-const double C5 = 0.881921264348355;
-const double C6 = 0.831469612302545;
-const double C7 = 0.773010453362737;
-const double C8 = 0.707106781186548;
-const double C9 = 0.634393284163646;
-const double C10 = 0.555570233019602;
-const double C11 = 0.471396736825998;
-const double C12 = 0.38268343236509;
-const double C13 = 0.290284677254462;
-const double C14 = 0.195090322016128;
-const double C15 = 0.098017140329561;
-
-void butterfly_16x16_dct_1d(double input[16], double output[16]) {
- double step[16];
- double intermediate[16];
- double temp1, temp2;
-
- // step 1
- step[ 0] = input[0] + input[15];
- step[ 1] = input[1] + input[14];
- step[ 2] = input[2] + input[13];
- step[ 3] = input[3] + input[12];
- step[ 4] = input[4] + input[11];
- step[ 5] = input[5] + input[10];
- step[ 6] = input[6] + input[ 9];
- step[ 7] = input[7] + input[ 8];
- step[ 8] = input[7] - input[ 8];
- step[ 9] = input[6] - input[ 9];
- step[10] = input[5] - input[10];
- step[11] = input[4] - input[11];
- step[12] = input[3] - input[12];
- step[13] = input[2] - input[13];
- step[14] = input[1] - input[14];
- step[15] = input[0] - input[15];
-
- // step 2
- output[0] = step[0] + step[7];
- output[1] = step[1] + step[6];
- output[2] = step[2] + step[5];
- output[3] = step[3] + step[4];
- output[4] = step[3] - step[4];
- output[5] = step[2] - step[5];
- output[6] = step[1] - step[6];
- output[7] = step[0] - step[7];
-
- temp1 = step[ 8] * C7;
- temp2 = step[15] * C9;
- output[ 8] = temp1 + temp2;
-
- temp1 = step[ 9] * C11;
- temp2 = step[14] * C5;
- output[ 9] = temp1 - temp2;
-
- temp1 = step[10] * C3;
- temp2 = step[13] * C13;
- output[10] = temp1 + temp2;
-
- temp1 = step[11] * C15;
- temp2 = step[12] * C1;
- output[11] = temp1 - temp2;
-
- temp1 = step[11] * C1;
- temp2 = step[12] * C15;
- output[12] = temp2 + temp1;
-
- temp1 = step[10] * C13;
- temp2 = step[13] * C3;
- output[13] = temp2 - temp1;
-
- temp1 = step[ 9] * C5;
- temp2 = step[14] * C11;
- output[14] = temp2 + temp1;
-
- temp1 = step[ 8] * C9;
- temp2 = step[15] * C7;
- output[15] = temp2 - temp1;
-
- // step 3
- step[ 0] = output[0] + output[3];
- step[ 1] = output[1] + output[2];
- step[ 2] = output[1] - output[2];
- step[ 3] = output[0] - output[3];
-
- temp1 = output[4] * C14;
- temp2 = output[7] * C2;
- step[ 4] = temp1 + temp2;
-
- temp1 = output[5] * C10;
- temp2 = output[6] * C6;
- step[ 5] = temp1 + temp2;
-
- temp1 = output[5] * C6;
- temp2 = output[6] * C10;
- step[ 6] = temp2 - temp1;
-
- temp1 = output[4] * C2;
- temp2 = output[7] * C14;
- step[ 7] = temp2 - temp1;
-
- step[ 8] = output[ 8] + output[11];
- step[ 9] = output[ 9] + output[10];
- step[10] = output[ 9] - output[10];
- step[11] = output[ 8] - output[11];
-
- step[12] = output[12] + output[15];
- step[13] = output[13] + output[14];
- step[14] = output[13] - output[14];
- step[15] = output[12] - output[15];
-
- // step 4
- output[ 0] = (step[ 0] + step[ 1]);
- output[ 8] = (step[ 0] - step[ 1]);
-
- temp1 = step[2] * C12;
- temp2 = step[3] * C4;
- temp1 = temp1 + temp2;
- output[ 4] = 2*(temp1 * C8);
-
- temp1 = step[2] * C4;
- temp2 = step[3] * C12;
- temp1 = temp2 - temp1;
- output[12] = 2 * (temp1 * C8);
-
- output[ 2] = 2 * ((step[4] + step[ 5]) * C8);
- output[14] = 2 * ((step[7] - step[ 6]) * C8);
-
- temp1 = step[4] - step[5];
- temp2 = step[6] + step[7];
- output[ 6] = (temp1 + temp2);
- output[10] = (temp1 - temp2);
-
- intermediate[8] = step[8] + step[14];
- intermediate[9] = step[9] + step[15];
-
- temp1 = intermediate[8] * C12;
- temp2 = intermediate[9] * C4;
- temp1 = temp1 - temp2;
- output[3] = 2 * (temp1 * C8);
-
- temp1 = intermediate[8] * C4;
- temp2 = intermediate[9] * C12;
- temp1 = temp2 + temp1;
- output[13] = 2 * (temp1 * C8);
-
- output[ 9] = 2 * ((step[10] + step[11]) * C8);
-
- intermediate[11] = step[10] - step[11];
- intermediate[12] = step[12] + step[13];
- intermediate[13] = step[12] - step[13];
- intermediate[14] = step[ 8] - step[14];
- intermediate[15] = step[ 9] - step[15];
-
- output[15] = (intermediate[11] + intermediate[12]);
- output[ 1] = -(intermediate[11] - intermediate[12]);
-
- output[ 7] = 2 * (intermediate[13] * C8);
-
- temp1 = intermediate[14] * C12;
- temp2 = intermediate[15] * C4;
- temp1 = temp1 - temp2;
- output[11] = -2 * (temp1 * C8);
-
- temp1 = intermediate[14] * C4;
- temp2 = intermediate[15] * C12;
- temp1 = temp2 + temp1;
- output[ 5] = 2 * (temp1 * C8);
-}
-
-void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
- // First transform columns
- for (int i = 0; i < 16; ++i) {
- double temp_in[16], temp_out[16];
- for (int j = 0; j < 16; ++j)
- temp_in[j] = input[j * 16 + i];
- butterfly_16x16_dct_1d(temp_in, temp_out);
- for (int j = 0; j < 16; ++j)
- output[j * 16 + i] = temp_out[j];
- }
- // Then transform rows
- for (int i = 0; i < 16; ++i) {
- double temp_in[16], temp_out[16];
- for (int j = 0; j < 16; ++j)
- temp_in[j] = output[j + i * 16];
- butterfly_16x16_dct_1d(temp_in, temp_out);
- // Scale by some magic number
- for (int j = 0; j < 16; ++j)
- output[j + i * 16] = temp_out[j]/2;
- }
-}
-
-typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride);
-typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride,
- int tx_type);
-typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride,
- int tx_type);
-
-typedef std::tr1::tuple<fdct_t, idct_t, int> dct_16x16_param_t;
-typedef std::tr1::tuple<fht_t, iht_t, int> ht_16x16_param_t;
-
-void fdct16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
- vp9_fdct16x16_c(in, out, stride);
-}
-
-void fht16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
- vp9_fht16x16_c(in, out, stride, tx_type);
-}
-
-class Trans16x16TestBase {
- public:
- virtual ~Trans16x16TestBase() {}
-
- protected:
- virtual void RunFwdTxfm(int16_t *in, int16_t *out, int stride) = 0;
-
- virtual void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) = 0;
-
- void RunAccuracyCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- uint32_t max_error = 0;
- int64_t total_error = 0;
- const int count_test_block = 10000;
- for (int i = 0; i < count_test_block; ++i) {
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
-
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- test_input_block[j] = src[j] - dst[j];
- }
-
- REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,
- test_temp_block, pitch_));
- REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
-
- for (int j = 0; j < kNumCoeffs; ++j) {
- const uint32_t diff = dst[j] - src[j];
- const uint32_t error = diff * diff;
- if (max_error < error)
- max_error = error;
- total_error += error;
- }
- }
-
- EXPECT_GE(1u, max_error)
- << "Error: 16x16 FHT/IHT has an individual round trip error > 1";
-
- EXPECT_GE(count_test_block , total_error)
- << "Error: 16x16 FHT/IHT has average round trip error > 1 per block";
- }
-
- void RunCoeffCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 1000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j)
- input_block[j] = rnd.Rand8() - rnd.Rand8();
-
- fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_);
- REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_));
-
- // The minimum quant value is 4.
- for (int j = 0; j < kNumCoeffs; ++j)
- EXPECT_EQ(output_block[j], output_ref_block[j]);
- }
- }
-
- void RunMemCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 1000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- input_block[j] = rnd.Rand8() - rnd.Rand8();
- input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
- }
- if (i == 0)
- for (int j = 0; j < kNumCoeffs; ++j)
- input_extreme_block[j] = 255;
- if (i == 1)
- for (int j = 0; j < kNumCoeffs; ++j)
- input_extreme_block[j] = -255;
-
- fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
- REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
- output_block, pitch_));
-
- // The minimum quant value is 4.
- for (int j = 0; j < kNumCoeffs; ++j) {
- EXPECT_EQ(output_block[j], output_ref_block[j]);
- EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j]))
- << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE";
- }
- }
- }
-
- void RunInvAccuracyCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 1000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- double out_r[kNumCoeffs];
-
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- in[j] = src[j] - dst[j];
- }
-
- reference_16x16_dct_2d(in, out_r);
- for (int j = 0; j < kNumCoeffs; ++j)
- coeff[j] = round(out_r[j]);
-
- REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
-
- for (int j = 0; j < kNumCoeffs; ++j) {
- const uint32_t diff = dst[j] - src[j];
- const uint32_t error = diff * diff;
- EXPECT_GE(1u, error)
- << "Error: 16x16 IDCT has error " << error
- << " at index " << j;
- }
- }
- }
- int pitch_;
- int tx_type_;
- fht_t fwd_txfm_ref;
-};
-
-class Trans16x16DCT
- : public Trans16x16TestBase,
- public ::testing::TestWithParam<dct_16x16_param_t> {
- public:
- virtual ~Trans16x16DCT() {}
-
- virtual void SetUp() {
- fwd_txfm_ = GET_PARAM(0);
- inv_txfm_ = GET_PARAM(1);
- tx_type_ = GET_PARAM(2);
- pitch_ = 16;
- fwd_txfm_ref = fdct16x16_ref;
- }
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- void RunFwdTxfm(int16_t *in, int16_t *out, int stride) {
- fwd_txfm_(in, out, stride);
- }
- void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {
- inv_txfm_(out, dst, stride);
- }
-
- fdct_t fwd_txfm_;
- idct_t inv_txfm_;
-};
-
-TEST_P(Trans16x16DCT, AccuracyCheck) {
- RunAccuracyCheck();
-}
-
-TEST_P(Trans16x16DCT, CoeffCheck) {
- RunCoeffCheck();
-}
-
-TEST_P(Trans16x16DCT, MemCheck) {
- RunMemCheck();
-}
-
-TEST_P(Trans16x16DCT, InvAccuracyCheck) {
- RunInvAccuracyCheck();
-}
-
-class Trans16x16HT
- : public Trans16x16TestBase,
- public ::testing::TestWithParam<ht_16x16_param_t> {
- public:
- virtual ~Trans16x16HT() {}
-
- virtual void SetUp() {
- fwd_txfm_ = GET_PARAM(0);
- inv_txfm_ = GET_PARAM(1);
- tx_type_ = GET_PARAM(2);
- pitch_ = 16;
- fwd_txfm_ref = fht16x16_ref;
- }
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- void RunFwdTxfm(int16_t *in, int16_t *out, int stride) {
- fwd_txfm_(in, out, stride, tx_type_);
- }
- void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {
- inv_txfm_(out, dst, stride, tx_type_);
- }
-
- fht_t fwd_txfm_;
- iht_t inv_txfm_;
-};
-
-TEST_P(Trans16x16HT, AccuracyCheck) {
- RunAccuracyCheck();
-}
-
-TEST_P(Trans16x16HT, CoeffCheck) {
- RunCoeffCheck();
-}
-
-TEST_P(Trans16x16HT, MemCheck) {
- RunMemCheck();
-}
-
-using std::tr1::make_tuple;
-
-INSTANTIATE_TEST_CASE_P(
- C, Trans16x16DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct16x16_c, &vp9_idct16x16_256_add_c, 0)));
-INSTANTIATE_TEST_CASE_P(
- C, Trans16x16HT,
- ::testing::Values(
- make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 0),
- make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1),
- make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2),
- make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3)));
-
-#if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(
- NEON, Trans16x16DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct16x16_c,
- &vp9_idct16x16_256_add_neon, 0)));
-#endif
-
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(
- SSE2, Trans16x16DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct16x16_sse2,
- &vp9_idct16x16_256_add_sse2, 0)));
-INSTANTIATE_TEST_CASE_P(
- SSE2, Trans16x16HT,
- ::testing::Values(
- make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0),
- make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1),
- make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2),
- make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3)));
-#endif
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/dct32x32_test.cc b/videocodec/libvpx_internal/libvpx/test/dct32x32_test.cc
deleted file mode 100644
index 013f451..0000000
--- a/videocodec/libvpx_internal/libvpx/test/dct32x32_test.cc
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vpx/vpx_integer.h"
-
-using libvpx_test::ACMRandom;
-
-namespace {
-#ifdef _MSC_VER
-static int round(double x) {
- if (x < 0)
- return static_cast<int>(ceil(x - 0.5));
- else
- return static_cast<int>(floor(x + 0.5));
-}
-#endif
-
-const int kNumCoeffs = 1024;
-const double kPi = 3.141592653589793238462643383279502884;
-void reference_32x32_dct_1d(const double in[32], double out[32], int stride) {
- const double kInvSqrt2 = 0.707106781186547524400844362104;
- for (int k = 0; k < 32; k++) {
- out[k] = 0.0;
- for (int n = 0; n < 32; n++)
- out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0);
- if (k == 0)
- out[k] = out[k] * kInvSqrt2;
- }
-}
-
-void reference_32x32_dct_2d(const int16_t input[kNumCoeffs],
- double output[kNumCoeffs]) {
- // First transform columns
- for (int i = 0; i < 32; ++i) {
- double temp_in[32], temp_out[32];
- for (int j = 0; j < 32; ++j)
- temp_in[j] = input[j*32 + i];
- reference_32x32_dct_1d(temp_in, temp_out, 1);
- for (int j = 0; j < 32; ++j)
- output[j * 32 + i] = temp_out[j];
- }
- // Then transform rows
- for (int i = 0; i < 32; ++i) {
- double temp_in[32], temp_out[32];
- for (int j = 0; j < 32; ++j)
- temp_in[j] = output[j + i*32];
- reference_32x32_dct_1d(temp_in, temp_out, 1);
- // Scale by some magic number
- for (int j = 0; j < 32; ++j)
- output[j + i * 32] = temp_out[j] / 4;
- }
-}
-
-typedef void (*fwd_txfm_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*inv_txfm_t)(const int16_t *in, uint8_t *out, int stride);
-
-typedef std::tr1::tuple<fwd_txfm_t, inv_txfm_t, int> trans_32x32_param_t;
-
-class Trans32x32Test : public ::testing::TestWithParam<trans_32x32_param_t> {
- public:
- virtual ~Trans32x32Test() {}
- virtual void SetUp() {
- fwd_txfm_ = GET_PARAM(0);
- inv_txfm_ = GET_PARAM(1);
- version_ = GET_PARAM(2); // 0: high precision forward transform
- // 1: low precision version for rd loop
- }
-
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- int version_;
- fwd_txfm_t fwd_txfm_;
- inv_txfm_t inv_txfm_;
-};
-
-TEST_P(Trans32x32Test, AccuracyCheck) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- uint32_t max_error = 0;
- int64_t total_error = 0;
- const int count_test_block = 1000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- test_input_block[j] = src[j] - dst[j];
- }
-
- REGISTER_STATE_CHECK(fwd_txfm_(test_input_block, test_temp_block, 32));
- REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32));
-
- for (int j = 0; j < kNumCoeffs; ++j) {
- const uint32_t diff = dst[j] - src[j];
- const uint32_t error = diff * diff;
- if (max_error < error)
- max_error = error;
- total_error += error;
- }
- }
-
- if (version_ == 1) {
- max_error /= 2;
- total_error /= 45;
- }
-
- EXPECT_GE(1u, max_error)
- << "Error: 32x32 FDCT/IDCT has an individual round-trip error > 1";
-
- EXPECT_GE(count_test_block, total_error)
- << "Error: 32x32 FDCT/IDCT has average round-trip error > 1 per block";
-}
-
-TEST_P(Trans32x32Test, CoeffCheck) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 1000;
-
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- for (int j = 0; j < kNumCoeffs; ++j)
- input_block[j] = rnd.Rand8() - rnd.Rand8();
-
- const int stride = 32;
- vp9_fdct32x32_c(input_block, output_ref_block, stride);
- REGISTER_STATE_CHECK(fwd_txfm_(input_block, output_block, stride));
-
- if (version_ == 0) {
- for (int j = 0; j < kNumCoeffs; ++j)
- EXPECT_EQ(output_block[j], output_ref_block[j])
- << "Error: 32x32 FDCT versions have mismatched coefficients";
- } else {
- for (int j = 0; j < kNumCoeffs; ++j)
- EXPECT_GE(6, abs(output_block[j] - output_ref_block[j]))
- << "Error: 32x32 FDCT rd has mismatched coefficients";
- }
- }
-}
-
-TEST_P(Trans32x32Test, MemCheck) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 2000;
-
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- input_block[j] = rnd.Rand8() - rnd.Rand8();
- input_extreme_block[j] = rnd.Rand8() & 1 ? 255 : -255;
- }
- if (i == 0)
- for (int j = 0; j < kNumCoeffs; ++j)
- input_extreme_block[j] = 255;
- if (i == 1)
- for (int j = 0; j < kNumCoeffs; ++j)
- input_extreme_block[j] = -255;
-
- const int stride = 32;
- vp9_fdct32x32_c(input_extreme_block, output_ref_block, stride);
- REGISTER_STATE_CHECK(fwd_txfm_(input_extreme_block, output_block, stride));
-
- // The minimum quant value is 4.
- for (int j = 0; j < kNumCoeffs; ++j) {
- if (version_ == 0) {
- EXPECT_EQ(output_block[j], output_ref_block[j])
- << "Error: 32x32 FDCT versions have mismatched coefficients";
- } else {
- EXPECT_GE(6, abs(output_block[j] - output_ref_block[j]))
- << "Error: 32x32 FDCT rd has mismatched coefficients";
- }
- EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_ref_block[j]))
- << "Error: 32x32 FDCT C has coefficient larger than 4*DCT_MAX_VALUE";
- EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j]))
- << "Error: 32x32 FDCT has coefficient larger than "
- << "4*DCT_MAX_VALUE";
- }
- }
-}
-
-TEST_P(Trans32x32Test, InverseAccuracy) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 1000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- double out_r[kNumCoeffs];
-
- // Initialize a test block with input range [-255, 255]
- for (int j = 0; j < kNumCoeffs; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- in[j] = src[j] - dst[j];
- }
-
- reference_32x32_dct_2d(in, out_r);
- for (int j = 0; j < kNumCoeffs; ++j)
- coeff[j] = round(out_r[j]);
- REGISTER_STATE_CHECK(inv_txfm_(coeff, dst, 32));
- for (int j = 0; j < kNumCoeffs; ++j) {
- const int diff = dst[j] - src[j];
- const int error = diff * diff;
- EXPECT_GE(1, error)
- << "Error: 32x32 IDCT has error " << error
- << " at index " << j;
- }
- }
-}
-
-using std::tr1::make_tuple;
-
-INSTANTIATE_TEST_CASE_P(
- C, Trans32x32Test,
- ::testing::Values(
- make_tuple(&vp9_fdct32x32_c, &vp9_idct32x32_1024_add_c, 0),
- make_tuple(&vp9_fdct32x32_rd_c, &vp9_idct32x32_1024_add_c, 1)));
-
-#if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(
- NEON, Trans32x32Test,
- ::testing::Values(
- make_tuple(&vp9_fdct32x32_c,
- &vp9_idct32x32_1024_add_neon, 0),
- make_tuple(&vp9_fdct32x32_rd_c,
- &vp9_idct32x32_1024_add_neon, 1)));
-#endif
-
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(
- SSE2, Trans32x32Test,
- ::testing::Values(
- make_tuple(&vp9_fdct32x32_sse2,
- &vp9_idct32x32_1024_add_sse2, 0),
- make_tuple(&vp9_fdct32x32_rd_sse2,
- &vp9_idct32x32_1024_add_sse2, 1)));
-#endif
-
-#if HAVE_AVX2
-INSTANTIATE_TEST_CASE_P(
- AVX2, Trans32x32Test,
- ::testing::Values(
- make_tuple(&vp9_fdct32x32_avx2,
- &vp9_idct32x32_1024_add_sse2, 0),
- make_tuple(&vp9_fdct32x32_rd_avx2,
- &vp9_idct32x32_1024_add_sse2, 1)));
-#endif
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/decode_perf_test.cc b/videocodec/libvpx_internal/libvpx/test/decode_perf_test.cc
deleted file mode 100644
index a438261..0000000
--- a/videocodec/libvpx_internal/libvpx/test/decode_perf_test.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "test/codec_factory.h"
-#include "test/decode_test_driver.h"
-#include "test/ivf_video_source.h"
-#include "test/md5_helper.h"
-#include "test/util.h"
-#include "test/webm_video_source.h"
-#include "vpx_ports/vpx_timer.h"
-#include "./vpx_version.h"
-
-using std::tr1::make_tuple;
-
-namespace {
-
-#define VIDEO_NAME 0
-#define THREADS 1
-
-const double kUsecsInSec = 1000000.0;
-
-/*
- DecodePerfTest takes a tuple of filename + number of threads to decode with
- */
-typedef std::tr1::tuple<const char *, unsigned> decode_perf_param_t;
-
-const decode_perf_param_t kVP9DecodePerfVectors[] = {
- make_tuple("vp90-2-bbb_426x240_tile_1x1_180kbps.webm", 1),
- make_tuple("vp90-2-bbb_640x360_tile_1x2_337kbps.webm", 2),
- make_tuple("vp90-2-bbb_854x480_tile_1x2_651kbps.webm", 2),
- make_tuple("vp90-2-bbb_1280x720_tile_1x4_1310kbps.webm", 4),
- make_tuple("vp90-2-bbb_1920x1080_tile_1x1_2581kbps.webm", 1),
- make_tuple("vp90-2-bbb_1920x1080_tile_1x4_2586kbps.webm", 4),
- make_tuple("vp90-2-bbb_1920x1080_tile_1x4_fpm_2304kbps.webm", 4),
- make_tuple("vp90-2-sintel_426x182_tile_1x1_171kbps.webm", 1),
- make_tuple("vp90-2-sintel_640x272_tile_1x2_318kbps.webm", 2),
- make_tuple("vp90-2-sintel_854x364_tile_1x2_621kbps.webm", 2),
- make_tuple("vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm", 4),
- make_tuple("vp90-2-sintel_1920x818_tile_1x4_fpm_2279kbps.webm", 4),
- make_tuple("vp90-2-tos_426x178_tile_1x1_181kbps.webm", 1),
- make_tuple("vp90-2-tos_640x266_tile_1x2_336kbps.webm", 2),
- make_tuple("vp90-2-tos_854x356_tile_1x2_656kbps.webm", 2),
- make_tuple("vp90-2-tos_1280x534_tile_1x4_1306kbps.webm", 4),
- make_tuple("vp90-2-tos_1920x800_tile_1x4_fpm_2335kbps.webm", 4),
-};
-
-/*
- In order to reflect real world performance as much as possible, Perf tests
- *DO NOT* do any correctness checks. Please run them alongside correctness
- tests to ensure proper codec integrity. Furthermore, in this test we
- deliberately limit the amount of system calls we make to avoid OS
- preemption.
-
- TODO(joshualitt) create a more detailed perf measurement test to collect
- power/temp/min max frame decode times/etc
- */
-
-class DecodePerfTest : public ::testing::TestWithParam<decode_perf_param_t> {
-};
-
-TEST_P(DecodePerfTest, PerfTest) {
- const char *const video_name = GET_PARAM(VIDEO_NAME);
- const unsigned threads = GET_PARAM(THREADS);
-
- libvpx_test::WebMVideoSource video(video_name);
- video.Init();
-
- vpx_codec_dec_cfg_t cfg = {0};
- cfg.threads = threads;
- libvpx_test::VP9Decoder decoder(cfg, 0);
-
- vpx_usec_timer t;
- vpx_usec_timer_start(&t);
-
- for (video.Begin(); video.cxdata() != NULL; video.Next()) {
- decoder.DecodeFrame(video.cxdata(), video.frame_size());
- }
-
- vpx_usec_timer_mark(&t);
- const double elapsed_secs = double(vpx_usec_timer_elapsed(&t))
- / kUsecsInSec;
- const unsigned frames = video.frame_number();
- const double fps = double(frames) / elapsed_secs;
-
- printf("{\n");
- printf("\t\"version\" : \"%s\",\n", VERSION_STRING_NOSP);
- printf("\t\"videoName\" : \"%s\",\n", video_name);
- printf("\t\"threadCount\" : %u,\n", threads);
- printf("\t\"decodeTimeSecs\" : %f,\n", elapsed_secs);
- printf("\t\"totalFrames\" : %u,\n", frames);
- printf("\t\"framesPerSecond\" : %f\n", fps);
- printf("}\n");
-}
-
-INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest,
- ::testing::ValuesIn(kVP9DecodePerfVectors));
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/decode_test_driver.cc b/videocodec/libvpx_internal/libvpx/test/decode_test_driver.cc
deleted file mode 100644
index e667d1d..0000000
--- a/videocodec/libvpx_internal/libvpx/test/decode_test_driver.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "test/codec_factory.h"
-#include "test/decode_test_driver.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/register_state_check.h"
-#include "test/video_source.h"
-
-namespace libvpx_test {
-
-vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) {
- vpx_codec_err_t res_dec;
- InitOnce();
- REGISTER_STATE_CHECK(
- res_dec = vpx_codec_decode(&decoder_,
- cxdata, static_cast<unsigned int>(size),
- NULL, 0));
- return res_dec;
-}
-
-void DecoderTest::RunLoop(CompressedVideoSource *video) {
- vpx_codec_dec_cfg_t dec_cfg = {0};
- Decoder* const decoder = codec_->CreateDecoder(dec_cfg, 0);
- ASSERT_TRUE(decoder != NULL);
-
- // Decode frames.
- for (video->Begin(); video->cxdata(); video->Next()) {
- PreDecodeFrameHook(*video, decoder);
- vpx_codec_err_t res_dec = decoder->DecodeFrame(video->cxdata(),
- video->frame_size());
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
-
- DxDataIterator dec_iter = decoder->GetDxData();
- const vpx_image_t *img = NULL;
-
- // Get decompressed data
- while ((img = dec_iter.Next()))
- DecompressedFrameHook(*img, video->frame_number());
- }
-
- delete decoder;
-}
-} // namespace libvpx_test
diff --git a/videocodec/libvpx_internal/libvpx/test/decode_test_driver.h b/videocodec/libvpx_internal/libvpx/test/decode_test_driver.h
deleted file mode 100644
index 2734a45..0000000
--- a/videocodec/libvpx_internal/libvpx/test/decode_test_driver.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_DECODE_TEST_DRIVER_H_
-#define TEST_DECODE_TEST_DRIVER_H_
-#include <cstring>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "./vpx_config.h"
-#include "vpx/vpx_decoder.h"
-
-namespace libvpx_test {
-
-class CodecFactory;
-class CompressedVideoSource;
-
-// Provides an object to handle decoding output
-class DxDataIterator {
- public:
- explicit DxDataIterator(vpx_codec_ctx_t *decoder)
- : decoder_(decoder), iter_(NULL) {}
-
- const vpx_image_t *Next() {
- return vpx_codec_get_frame(decoder_, &iter_);
- }
-
- private:
- vpx_codec_ctx_t *decoder_;
- vpx_codec_iter_t iter_;
-};
-
-// Provides a simplified interface to manage one video decoding.
-// Similar to Encoder class, the exact services should be added
-// as more tests are added.
-class Decoder {
- public:
- Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
- : cfg_(cfg), deadline_(deadline), init_done_(false) {
- memset(&decoder_, 0, sizeof(decoder_));
- }
-
- virtual ~Decoder() {
- vpx_codec_destroy(&decoder_);
- }
-
- vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size);
-
- DxDataIterator GetDxData() {
- return DxDataIterator(&decoder_);
- }
-
- void set_deadline(unsigned long deadline) {
- deadline_ = deadline;
- }
-
- void Control(int ctrl_id, int arg) {
- InitOnce();
- const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
- ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
- }
-
- void Control(int ctrl_id, const void *arg) {
- InitOnce();
- const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
- ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
- }
-
- const char* DecodeError() {
- const char *detail = vpx_codec_error_detail(&decoder_);
- return detail ? detail : vpx_codec_error(&decoder_);
- }
-
- // Passes the external frame buffer information to libvpx.
- vpx_codec_err_t SetFrameBufferFunctions(
- vpx_get_frame_buffer_cb_fn_t cb_get,
- vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) {
- InitOnce();
- return vpx_codec_set_frame_buffer_functions(
- &decoder_, cb_get, cb_release, user_priv);
- }
-
- protected:
- virtual vpx_codec_iface_t* CodecInterface() const = 0;
-
- void InitOnce() {
- if (!init_done_) {
- const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,
- CodecInterface(),
- &cfg_, 0);
- ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
- init_done_ = true;
- }
- }
-
- vpx_codec_ctx_t decoder_;
- vpx_codec_dec_cfg_t cfg_;
- unsigned int deadline_;
- bool init_done_;
-};
-
-// Common test functionality for all Decoder tests.
-class DecoderTest {
- public:
- // Main decoding loop
- virtual void RunLoop(CompressedVideoSource *video);
-
- // Hook to be called before decompressing every frame.
- virtual void PreDecodeFrameHook(const CompressedVideoSource& video,
- Decoder *decoder) {}
-
- // Hook to be called on every decompressed frame.
- virtual void DecompressedFrameHook(const vpx_image_t& img,
- const unsigned int frame_number) {}
-
- protected:
- explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {}
-
- virtual ~DecoderTest() {}
-
- const CodecFactory *codec_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_DECODE_TEST_DRIVER_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/encode_test_driver.cc b/videocodec/libvpx_internal/libvpx/test/encode_test_driver.cc
deleted file mode 100644
index 709831e..0000000
--- a/videocodec/libvpx_internal/libvpx/test/encode_test_driver.cc
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/decode_test_driver.h"
-#include "test/register_state_check.h"
-#include "test/video_source.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-namespace libvpx_test {
-void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
- if (video->img())
- EncodeFrameInternal(*video, frame_flags);
- else
- Flush();
-
- // Handle twopass stats
- CxDataIterator iter = GetCxData();
-
- while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
- if (pkt->kind != VPX_CODEC_STATS_PKT)
- continue;
-
- stats_->Append(*pkt);
- }
-}
-
-void Encoder::EncodeFrameInternal(const VideoSource &video,
- const unsigned long frame_flags) {
- vpx_codec_err_t res;
- const vpx_image_t *img = video.img();
-
- // Handle first frame initialization
- if (!encoder_.priv) {
- cfg_.g_w = img->d_w;
- cfg_.g_h = img->d_h;
- cfg_.g_timebase = video.timebase();
- cfg_.rc_twopass_stats_in = stats_->buf();
- res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_,
- init_flags_);
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
- }
-
- // Handle frame resizing
- if (cfg_.g_w != img->d_w || cfg_.g_h != img->d_h) {
- cfg_.g_w = img->d_w;
- cfg_.g_h = img->d_h;
- res = vpx_codec_enc_config_set(&encoder_, &cfg_);
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
- }
-
- // Encode the frame
- REGISTER_STATE_CHECK(
- res = vpx_codec_encode(&encoder_,
- video.img(), video.pts(), video.duration(),
- frame_flags, deadline_));
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
-}
-
-void Encoder::Flush() {
- const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0,
- deadline_);
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
-}
-
-void EncoderTest::InitializeConfig() {
- const vpx_codec_err_t res = codec_->DefaultEncoderConfig(&cfg_, 0);
- ASSERT_EQ(VPX_CODEC_OK, res);
-}
-
-void EncoderTest::SetMode(TestMode mode) {
- switch (mode) {
- case kRealTime:
- deadline_ = VPX_DL_REALTIME;
- break;
-
- case kOnePassGood:
- case kTwoPassGood:
- deadline_ = VPX_DL_GOOD_QUALITY;
- break;
-
- case kOnePassBest:
- case kTwoPassBest:
- deadline_ = VPX_DL_BEST_QUALITY;
- break;
-
- default:
- ASSERT_TRUE(false) << "Unexpected mode " << mode;
- }
-
- if (mode == kTwoPassGood || mode == kTwoPassBest)
- passes_ = 2;
- else
- passes_ = 1;
-}
-// The function should return "true" most of the time, therefore no early
-// break-out is implemented within the match checking process.
-static bool compare_img(const vpx_image_t *img1,
- const vpx_image_t *img2) {
- bool match = (img1->fmt == img2->fmt) &&
- (img1->d_w == img2->d_w) &&
- (img1->d_h == img2->d_h);
-
- const unsigned int width_y = img1->d_w;
- const unsigned int height_y = img1->d_h;
- unsigned int i;
- for (i = 0; i < height_y; ++i)
- match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
- img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
- width_y) == 0) && match;
- const unsigned int width_uv = (img1->d_w + 1) >> 1;
- const unsigned int height_uv = (img1->d_h + 1) >> 1;
- for (i = 0; i < height_uv; ++i)
- match = (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],
- img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],
- width_uv) == 0) && match;
- for (i = 0; i < height_uv; ++i)
- match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],
- img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],
- width_uv) == 0) && match;
- return match;
-}
-
-void EncoderTest::MismatchHook(const vpx_image_t *img1,
- const vpx_image_t *img2) {
- ASSERT_TRUE(0) << "Encode/Decode mismatch found";
-}
-
-void EncoderTest::RunLoop(VideoSource *video) {
- vpx_codec_dec_cfg_t dec_cfg = {0};
-
- stats_.Reset();
-
- ASSERT_TRUE(passes_ == 1 || passes_ == 2);
- for (unsigned int pass = 0; pass < passes_; pass++) {
- last_pts_ = 0;
-
- if (passes_ == 1)
- cfg_.g_pass = VPX_RC_ONE_PASS;
- else if (pass == 0)
- cfg_.g_pass = VPX_RC_FIRST_PASS;
- else
- cfg_.g_pass = VPX_RC_LAST_PASS;
-
- BeginPassHook(pass);
- Encoder* const encoder = codec_->CreateEncoder(cfg_, deadline_, init_flags_,
- &stats_);
- ASSERT_TRUE(encoder != NULL);
- Decoder* const decoder = codec_->CreateDecoder(dec_cfg, 0);
- bool again;
- for (again = true, video->Begin(); again; video->Next()) {
- again = (video->img() != NULL);
-
- PreEncodeFrameHook(video);
- PreEncodeFrameHook(video, encoder);
- encoder->EncodeFrame(video, frame_flags_);
-
- CxDataIterator iter = encoder->GetCxData();
-
- bool has_cxdata = false;
- bool has_dxdata = false;
- while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
- pkt = MutateEncoderOutputHook(pkt);
- again = true;
- switch (pkt->kind) {
- case VPX_CODEC_CX_FRAME_PKT:
- has_cxdata = true;
- if (decoder && DoDecode()) {
- vpx_codec_err_t res_dec = decoder->DecodeFrame(
- (const uint8_t*)pkt->data.frame.buf, pkt->data.frame.sz);
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
- has_dxdata = true;
- }
- ASSERT_GE(pkt->data.frame.pts, last_pts_);
- last_pts_ = pkt->data.frame.pts;
- FramePktHook(pkt);
- break;
-
- case VPX_CODEC_PSNR_PKT:
- PSNRPktHook(pkt);
- break;
-
- default:
- break;
- }
- }
-
- if (has_dxdata && has_cxdata) {
- const vpx_image_t *img_enc = encoder->GetPreviewFrame();
- DxDataIterator dec_iter = decoder->GetDxData();
- const vpx_image_t *img_dec = dec_iter.Next();
- if (img_enc && img_dec) {
- const bool res = compare_img(img_enc, img_dec);
- if (!res) { // Mismatch
- MismatchHook(img_enc, img_dec);
- }
- }
- if (img_dec)
- DecompressedFrameHook(*img_dec, video->pts());
- }
- if (!Continue())
- break;
- }
-
- EndPassHook();
-
- if (decoder)
- delete decoder;
- delete encoder;
-
- if (!Continue())
- break;
- }
-}
-
-} // namespace libvpx_test
diff --git a/videocodec/libvpx_internal/libvpx/test/encode_test_driver.h b/videocodec/libvpx_internal/libvpx/test/encode_test_driver.h
deleted file mode 100644
index 9526068..0000000
--- a/videocodec/libvpx_internal/libvpx/test/encode_test_driver.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_ENCODE_TEST_DRIVER_H_
-#define TEST_ENCODE_TEST_DRIVER_H_
-
-#include <string>
-#include <vector>
-
-#include "./vpx_config.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "vpx/vpx_encoder.h"
-#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
-#include "vpx/vp8cx.h"
-#endif
-
-namespace libvpx_test {
-
-class CodecFactory;
-class VideoSource;
-
-enum TestMode {
- kRealTime,
- kOnePassGood,
- kOnePassBest,
- kTwoPassGood,
- kTwoPassBest
-};
-#define ALL_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
- ::libvpx_test::kOnePassGood, \
- ::libvpx_test::kOnePassBest, \
- ::libvpx_test::kTwoPassGood, \
- ::libvpx_test::kTwoPassBest)
-
-#define ONE_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
- ::libvpx_test::kOnePassGood, \
- ::libvpx_test::kOnePassBest)
-
-#define TWO_PASS_TEST_MODES ::testing::Values(::libvpx_test::kTwoPassGood, \
- ::libvpx_test::kTwoPassBest)
-
-
-// Provides an object to handle the libvpx get_cx_data() iteration pattern
-class CxDataIterator {
- public:
- explicit CxDataIterator(vpx_codec_ctx_t *encoder)
- : encoder_(encoder), iter_(NULL) {}
-
- const vpx_codec_cx_pkt_t *Next() {
- return vpx_codec_get_cx_data(encoder_, &iter_);
- }
-
- private:
- vpx_codec_ctx_t *encoder_;
- vpx_codec_iter_t iter_;
-};
-
-// Implements an in-memory store for libvpx twopass statistics
-class TwopassStatsStore {
- public:
- void Append(const vpx_codec_cx_pkt_t &pkt) {
- buffer_.append(reinterpret_cast<char *>(pkt.data.twopass_stats.buf),
- pkt.data.twopass_stats.sz);
- }
-
- vpx_fixed_buf_t buf() {
- const vpx_fixed_buf_t buf = { &buffer_[0], buffer_.size() };
- return buf;
- }
-
- void Reset() {
- buffer_.clear();
- }
-
- protected:
- std::string buffer_;
-};
-
-
-// Provides a simplified interface to manage one video encoding pass, given
-// a configuration and video source.
-//
-// TODO(jkoleszar): The exact services it provides and the appropriate
-// level of abstraction will be fleshed out as more tests are written.
-class Encoder {
- public:
- Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
- const unsigned long init_flags, TwopassStatsStore *stats)
- : cfg_(cfg), deadline_(deadline), init_flags_(init_flags), stats_(stats) {
- memset(&encoder_, 0, sizeof(encoder_));
- }
-
- virtual ~Encoder() {
- vpx_codec_destroy(&encoder_);
- }
-
- CxDataIterator GetCxData() {
- return CxDataIterator(&encoder_);
- }
-
- const vpx_image_t *GetPreviewFrame() {
- return vpx_codec_get_preview_frame(&encoder_);
- }
- // This is a thin wrapper around vpx_codec_encode(), so refer to
- // vpx_encoder.h for its semantics.
- void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
-
- // Convenience wrapper for EncodeFrame()
- void EncodeFrame(VideoSource *video) {
- EncodeFrame(video, 0);
- }
-
- void Control(int ctrl_id, int arg) {
- const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
- }
-
- void Control(int ctrl_id, struct vpx_scaling_mode *arg) {
- const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
- }
-
- void Control(int ctrl_id, struct vpx_svc_layer_id *arg) {
- const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
- }
-
-#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
- void Control(int ctrl_id, vpx_active_map_t *arg) {
- const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
- ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
- }
-#endif
-
- void set_deadline(unsigned long deadline) {
- deadline_ = deadline;
- }
-
- protected:
- virtual vpx_codec_iface_t* CodecInterface() const = 0;
-
- const char *EncoderError() {
- const char *detail = vpx_codec_error_detail(&encoder_);
- return detail ? detail : vpx_codec_error(&encoder_);
- }
-
- // Encode an image
- void EncodeFrameInternal(const VideoSource &video,
- const unsigned long frame_flags);
-
- // Flush the encoder on EOS
- void Flush();
-
- vpx_codec_ctx_t encoder_;
- vpx_codec_enc_cfg_t cfg_;
- unsigned long deadline_;
- unsigned long init_flags_;
- TwopassStatsStore *stats_;
-};
-
-// Common test functionality for all Encoder tests.
-//
-// This class is a mixin which provides the main loop common to all
-// encoder tests. It provides hooks which can be overridden by subclasses
-// to implement each test's specific behavior, while centralizing the bulk
-// of the boilerplate. Note that it doesn't inherit the gtest testing
-// classes directly, so that tests can be parameterized differently.
-class EncoderTest {
- protected:
- explicit EncoderTest(const CodecFactory *codec)
- : codec_(codec), abort_(false), init_flags_(0), frame_flags_(0),
- last_pts_(0) {}
-
- virtual ~EncoderTest() {}
-
- // Initialize the cfg_ member with the default configuration.
- void InitializeConfig();
-
- // Map the TestMode enum to the deadline_ and passes_ variables.
- void SetMode(TestMode mode);
-
- // Main loop
- virtual void RunLoop(VideoSource *video);
-
- // Hook to be called at the beginning of a pass.
- virtual void BeginPassHook(unsigned int pass) {}
-
- // Hook to be called at the end of a pass.
- virtual void EndPassHook() {}
-
- // Hook to be called before encoding a frame.
- virtual void PreEncodeFrameHook(VideoSource *video) {}
- virtual void PreEncodeFrameHook(VideoSource *video, Encoder *encoder) {}
-
- // Hook to be called on every compressed data packet.
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {}
-
- // Hook to be called on every PSNR packet.
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {}
-
- // Hook to determine whether the encode loop should continue.
- virtual bool Continue() const {
- return !(::testing::Test::HasFatalFailure() || abort_);
- }
-
- const CodecFactory *codec_;
- // Hook to determine whether to decode frame after encoding
- virtual bool DoDecode() const { return 1; }
-
- // Hook to handle encode/decode mismatch
- virtual void MismatchHook(const vpx_image_t *img1,
- const vpx_image_t *img2);
-
- // Hook to be called on every decompressed frame.
- virtual void DecompressedFrameHook(const vpx_image_t& img,
- vpx_codec_pts_t pts) {}
-
- // Hook that can modify the encoder's output data
- virtual const vpx_codec_cx_pkt_t * MutateEncoderOutputHook(
- const vpx_codec_cx_pkt_t *pkt) {
- return pkt;
- }
-
- bool abort_;
- vpx_codec_enc_cfg_t cfg_;
- unsigned int passes_;
- unsigned long deadline_;
- TwopassStatsStore stats_;
- unsigned long init_flags_;
- unsigned long frame_flags_;
- vpx_codec_pts_t last_pts_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_ENCODE_TEST_DRIVER_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/error_resilience_test.cc b/videocodec/libvpx_internal/libvpx/test/error_resilience_test.cc
deleted file mode 100644
index 89684f8..0000000
--- a/videocodec/libvpx_internal/libvpx/test/error_resilience_test.cc
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-const int kMaxErrorFrames = 12;
-const int kMaxDroppableFrames = 12;
-
-class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- protected:
- ErrorResilienceTestLarge()
- : EncoderTest(GET_PARAM(0)),
- psnr_(0.0),
- nframes_(0),
- mismatch_psnr_(0.0),
- mismatch_nframes_(0),
- encoding_mode_(GET_PARAM(1)) {
- Reset();
- }
-
- virtual ~ErrorResilienceTestLarge() {}
-
- void Reset() {
- error_nframes_ = 0;
- droppable_nframes_ = 0;
- }
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(encoding_mode_);
- }
-
- virtual void BeginPassHook(unsigned int /*pass*/) {
- psnr_ = 0.0;
- nframes_ = 0;
- mismatch_psnr_ = 0.0;
- mismatch_nframes_ = 0;
- }
-
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
- psnr_ += pkt->data.psnr.psnr[0];
- nframes_++;
- }
-
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video) {
- frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF);
- if (droppable_nframes_ > 0 &&
- (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
- for (unsigned int i = 0; i < droppable_nframes_; ++i) {
- if (droppable_frames_[i] == video->frame()) {
- std::cout << " Encoding droppable frame: "
- << droppable_frames_[i] << "\n";
- frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST |
- VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF);
- return;
- }
- }
- }
- }
-
- double GetAveragePsnr() const {
- if (nframes_)
- return psnr_ / nframes_;
- return 0.0;
- }
-
- double GetAverageMismatchPsnr() const {
- if (mismatch_nframes_)
- return mismatch_psnr_ / mismatch_nframes_;
- return 0.0;
- }
-
- virtual bool DoDecode() const {
- if (error_nframes_ > 0 &&
- (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
- for (unsigned int i = 0; i < error_nframes_; ++i) {
- if (error_frames_[i] == nframes_ - 1) {
- std::cout << " Skipping decoding frame: "
- << error_frames_[i] << "\n";
- return 0;
- }
- }
- }
- return 1;
- }
-
- virtual void MismatchHook(const vpx_image_t *img1,
- const vpx_image_t *img2) {
- double mismatch_psnr = compute_psnr(img1, img2);
- mismatch_psnr_ += mismatch_psnr;
- ++mismatch_nframes_;
- // std::cout << "Mismatch frame psnr: " << mismatch_psnr << "\n";
- }
-
- void SetErrorFrames(int num, unsigned int *list) {
- if (num > kMaxErrorFrames)
- num = kMaxErrorFrames;
- else if (num < 0)
- num = 0;
- error_nframes_ = num;
- for (unsigned int i = 0; i < error_nframes_; ++i)
- error_frames_[i] = list[i];
- }
-
- void SetDroppableFrames(int num, unsigned int *list) {
- if (num > kMaxDroppableFrames)
- num = kMaxDroppableFrames;
- else if (num < 0)
- num = 0;
- droppable_nframes_ = num;
- for (unsigned int i = 0; i < droppable_nframes_; ++i)
- droppable_frames_[i] = list[i];
- }
-
- unsigned int GetMismatchFrames() {
- return mismatch_nframes_;
- }
-
- private:
- double psnr_;
- unsigned int nframes_;
- unsigned int error_nframes_;
- unsigned int droppable_nframes_;
- double mismatch_psnr_;
- unsigned int mismatch_nframes_;
- unsigned int error_frames_[kMaxErrorFrames];
- unsigned int droppable_frames_[kMaxDroppableFrames];
- libvpx_test::TestMode encoding_mode_;
-};
-
-TEST_P(ErrorResilienceTestLarge, OnVersusOff) {
- const vpx_rational timebase = { 33333333, 1000000000 };
- cfg_.g_timebase = timebase;
- cfg_.rc_target_bitrate = 2000;
- cfg_.g_lag_in_frames = 10;
-
- init_flags_ = VPX_CODEC_USE_PSNR;
-
- libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- timebase.den, timebase.num, 0, 30);
-
- // Error resilient mode OFF.
- cfg_.g_error_resilient = 0;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- const double psnr_resilience_off = GetAveragePsnr();
- EXPECT_GT(psnr_resilience_off, 25.0);
-
- // Error resilient mode ON.
- cfg_.g_error_resilient = 1;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- const double psnr_resilience_on = GetAveragePsnr();
- EXPECT_GT(psnr_resilience_on, 25.0);
-
- // Test that turning on error resilient mode hurts by 10% at most.
- if (psnr_resilience_off > 0.0) {
- const double psnr_ratio = psnr_resilience_on / psnr_resilience_off;
- EXPECT_GE(psnr_ratio, 0.9);
- EXPECT_LE(psnr_ratio, 1.1);
- }
-}
-
-// Check for successful decoding and no encoder/decoder mismatch
-// if we lose (i.e., drop before decoding) a set of droppable
-// frames (i.e., frames that don't update any reference buffers).
-// Check both isolated and consecutive loss.
-TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
- const vpx_rational timebase = { 33333333, 1000000000 };
- cfg_.g_timebase = timebase;
- cfg_.rc_target_bitrate = 500;
- // FIXME(debargha): Fix this to work for any lag.
- // Currently this test only works for lag = 0
- cfg_.g_lag_in_frames = 0;
-
- init_flags_ = VPX_CODEC_USE_PSNR;
-
- libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- timebase.den, timebase.num, 0, 40);
-
- // Error resilient mode ON.
- cfg_.g_error_resilient = 1;
- cfg_.kf_mode = VPX_KF_DISABLED;
-
- // 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};
- SetDroppableFrames(num_droppable_frames, droppable_frame_list);
- SetErrorFrames(num_droppable_frames, droppable_frame_list);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- // Test that no mismatches have been found
- std::cout << " Mismatch frames: "
- << GetMismatchFrames() << "\n";
- EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
-
- // Reset previously set of error/droppable frames.
- Reset();
-
-#if 0
- // TODO(jkoleszar): This test is disabled for the time being as too
- // sensitive. It's not clear how to set a reasonable threshold for
- // this behavior.
-
- // Now set an arbitrary set of error frames that are non-droppable
- unsigned int num_error_frames = 3;
- unsigned int error_frame_list[] = {3, 10, 20};
- SetErrorFrames(num_error_frames, error_frame_list);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- // Test that dropping an arbitrary set of inter frames does not hurt too much
- // Note the Average Mismatch PSNR is the average of the PSNR between
- // decoded frame and encoder's version of the same frame for all frames
- // with mismatch.
- const double psnr_resilience_mismatch = GetAverageMismatchPsnr();
- std::cout << " Mismatch PSNR: "
- << psnr_resilience_mismatch << "\n";
- EXPECT_GT(psnr_resilience_mismatch, 20.0);
-#endif
-}
-
-VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES);
-VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTestLarge, ONE_PASS_TEST_MODES);
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/external_frame_buffer_test.cc b/videocodec/libvpx_internal/libvpx/test/external_frame_buffer_test.cc
deleted file mode 100644
index 54c79e9..0000000
--- a/videocodec/libvpx_internal/libvpx/test/external_frame_buffer_test.cc
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <string>
-
-#include "test/codec_factory.h"
-#include "test/decode_test_driver.h"
-#include "test/ivf_video_source.h"
-#include "test/md5_helper.h"
-#include "test/test_vectors.h"
-#include "test/util.h"
-#include "test/webm_video_source.h"
-
-namespace {
-
-const int kVideoNameParam = 1;
-const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
-
-struct ExternalFrameBuffer {
- uint8_t *data;
- size_t size;
- int in_use;
-};
-
-// Class to manipulate a list of external frame buffers.
-class ExternalFrameBufferList {
- public:
- ExternalFrameBufferList()
- : num_buffers_(0),
- ext_fb_list_(NULL) {}
-
- virtual ~ExternalFrameBufferList() {
- for (int i = 0; i < num_buffers_; ++i) {
- delete [] ext_fb_list_[i].data;
- }
- delete [] ext_fb_list_;
- }
-
- // Creates the list to hold the external buffers. Returns true on success.
- bool CreateBufferList(int num_buffers) {
- if (num_buffers < 0)
- return false;
-
- num_buffers_ = num_buffers;
- ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];
- EXPECT_TRUE(ext_fb_list_ != NULL);
- memset(ext_fb_list_, 0, sizeof(ext_fb_list_[0]) * num_buffers_);
- return true;
- }
-
- // Searches the frame buffer list for a free frame buffer. Makes sure
- // that the frame buffer is at least |min_size| in bytes. Marks that the
- // frame buffer is in use by libvpx. Finally sets |fb| to point to the
- // external frame buffer. Returns < 0 on an error.
- int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
- EXPECT_TRUE(fb != NULL);
- const int idx = FindFreeBufferIndex();
- if (idx == num_buffers_)
- return -1;
-
- if (ext_fb_list_[idx].size < min_size) {
- delete [] ext_fb_list_[idx].data;
- ext_fb_list_[idx].data = new uint8_t[min_size];
- ext_fb_list_[idx].size = min_size;
- }
-
- SetFrameBuffer(idx, fb);
- return 0;
- }
-
- // Test function that will not allocate any data for the frame buffer.
- // Returns < 0 on an error.
- int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
- EXPECT_TRUE(fb != NULL);
- const int idx = FindFreeBufferIndex();
- if (idx == num_buffers_)
- return -1;
-
- if (ext_fb_list_[idx].size < min_size) {
- delete [] ext_fb_list_[idx].data;
- ext_fb_list_[idx].data = NULL;
- ext_fb_list_[idx].size = min_size;
- }
-
- SetFrameBuffer(idx, fb);
- return 0;
- }
-
- // Marks the external frame buffer that |fb| is pointing too as free.
- // Returns < 0 on an error.
- int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) {
- EXPECT_TRUE(fb != NULL);
- ExternalFrameBuffer *const ext_fb =
- reinterpret_cast<ExternalFrameBuffer*>(fb->priv);
- EXPECT_TRUE(ext_fb != NULL);
- EXPECT_EQ(1, ext_fb->in_use);
- ext_fb->in_use = 0;
- return 0;
- }
-
- // Checks that the ximage data is contained within the external frame buffer
- // private data passed back in the ximage.
- void CheckXImageFrameBuffer(const vpx_image_t *img) {
- if (img->fb_priv != NULL) {
- const struct ExternalFrameBuffer *const ext_fb =
- reinterpret_cast<ExternalFrameBuffer*>(img->fb_priv);
-
- ASSERT_TRUE(img->planes[0] >= ext_fb->data &&
- img->planes[0] < (ext_fb->data + ext_fb->size));
- }
- }
-
- private:
- // Returns the index of the first free frame buffer. Returns |num_buffers_|
- // if there are no free frame buffers.
- int FindFreeBufferIndex() {
- int i;
- // Find a free frame buffer.
- for (i = 0; i < num_buffers_; ++i) {
- if (!ext_fb_list_[i].in_use)
- break;
- }
- return i;
- }
-
- // Sets |fb| to an external frame buffer. idx is the index into the frame
- // buffer list.
- void SetFrameBuffer(int idx, vpx_codec_frame_buffer_t *fb) {
- ASSERT_TRUE(fb != NULL);
- fb->data = ext_fb_list_[idx].data;
- fb->size = ext_fb_list_[idx].size;
- ASSERT_EQ(0, ext_fb_list_[idx].in_use);
- ext_fb_list_[idx].in_use = 1;
- fb->priv = &ext_fb_list_[idx];
- }
-
- int num_buffers_;
- ExternalFrameBuffer *ext_fb_list_;
-};
-
-// Callback used by libvpx to request the application to return a frame
-// buffer of at least |min_size| in bytes.
-int get_vp9_frame_buffer(void *user_priv, size_t min_size,
- vpx_codec_frame_buffer_t *fb) {
- ExternalFrameBufferList *const fb_list =
- reinterpret_cast<ExternalFrameBufferList*>(user_priv);
- return fb_list->GetFreeFrameBuffer(min_size, fb);
-}
-
-// Callback used by libvpx to tell the application that |fb| is not needed
-// anymore.
-int release_vp9_frame_buffer(void *user_priv,
- vpx_codec_frame_buffer_t *fb) {
- ExternalFrameBufferList *const fb_list =
- reinterpret_cast<ExternalFrameBufferList*>(user_priv);
- return fb_list->ReturnFrameBuffer(fb);
-}
-
-// Callback will not allocate data for frame buffer.
-int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size,
- vpx_codec_frame_buffer_t *fb) {
- ExternalFrameBufferList *const fb_list =
- reinterpret_cast<ExternalFrameBufferList*>(user_priv);
- return fb_list->GetZeroFrameBuffer(min_size, fb);
-}
-
-// Callback will allocate one less byte than |min_size|.
-int get_vp9_one_less_byte_frame_buffer(void *user_priv, size_t min_size,
- vpx_codec_frame_buffer_t *fb) {
- ExternalFrameBufferList *const fb_list =
- reinterpret_cast<ExternalFrameBufferList*>(user_priv);
- return fb_list->GetFreeFrameBuffer(min_size - 1, fb);
-}
-
-// Callback will not release the external frame buffer.
-int do_not_release_vp9_frame_buffer(void *user_priv,
- vpx_codec_frame_buffer_t *fb) {
- (void)user_priv;
- (void)fb;
- return 0;
-}
-
-// Class for testing passing in external frame buffers to libvpx.
-class ExternalFrameBufferMD5Test
- : public ::libvpx_test::DecoderTest,
- public ::libvpx_test::CodecTestWithParam<const char*> {
- protected:
- ExternalFrameBufferMD5Test()
- : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
- md5_file_(NULL),
- num_buffers_(0) {}
-
- virtual ~ExternalFrameBufferMD5Test() {
- if (md5_file_ != NULL)
- fclose(md5_file_);
- }
-
- virtual void PreDecodeFrameHook(
- const libvpx_test::CompressedVideoSource &video,
- libvpx_test::Decoder *decoder) {
- if (num_buffers_ > 0 && video.frame_number() == 0) {
- // Have libvpx use frame buffers we create.
- ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
- ASSERT_EQ(VPX_CODEC_OK,
- decoder->SetFrameBufferFunctions(
- GetVP9FrameBuffer, ReleaseVP9FrameBuffer, this));
- }
- }
-
- void OpenMD5File(const std::string &md5_file_name_) {
- md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
- ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "
- << md5_file_name_;
- }
-
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- const unsigned int frame_number) {
- ASSERT_TRUE(md5_file_ != NULL);
- char expected_md5[33];
- char junk[128];
-
- // Read correct md5 checksums.
- const int res = fscanf(md5_file_, "%s %s", expected_md5, junk);
- ASSERT_NE(EOF, res) << "Read md5 data failed";
- expected_md5[32] = '\0';
-
- ::libvpx_test::MD5 md5_res;
- md5_res.Add(&img);
- const char *const actual_md5 = md5_res.Get();
-
- // Check md5 match.
- ASSERT_STREQ(expected_md5, actual_md5)
- << "Md5 checksums don't match: frame number = " << frame_number;
- }
-
- // Callback to get a free external frame buffer. Return value < 0 is an
- // error.
- static int GetVP9FrameBuffer(void *user_priv, size_t min_size,
- vpx_codec_frame_buffer_t *fb) {
- ExternalFrameBufferMD5Test *const md5Test =
- reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);
- return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb);
- }
-
- // Callback to release an external frame buffer. Return value < 0 is an
- // error.
- static int ReleaseVP9FrameBuffer(void *user_priv,
- vpx_codec_frame_buffer_t *fb) {
- ExternalFrameBufferMD5Test *const md5Test =
- reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);
- return md5Test->fb_list_.ReturnFrameBuffer(fb);
- }
-
- void set_num_buffers(int num_buffers) { num_buffers_ = num_buffers; }
- int num_buffers() const { return num_buffers_; }
-
- private:
- FILE *md5_file_;
- int num_buffers_;
- ExternalFrameBufferList fb_list_;
-};
-
-// Class for testing passing in external frame buffers to libvpx.
-class ExternalFrameBufferTest : public ::testing::Test {
- protected:
- ExternalFrameBufferTest()
- : video_(NULL),
- decoder_(NULL),
- num_buffers_(0) {}
-
- virtual void SetUp() {
- video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
- ASSERT_TRUE(video_ != NULL);
- video_->Init();
- video_->Begin();
-
- vpx_codec_dec_cfg_t cfg = {0};
- decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
- ASSERT_TRUE(decoder_ != NULL);
- }
-
- virtual void TearDown() {
- delete decoder_;
- delete video_;
- }
-
- // Passes the external frame buffer information to libvpx.
- vpx_codec_err_t SetFrameBufferFunctions(
- int num_buffers,
- vpx_get_frame_buffer_cb_fn_t cb_get,
- vpx_release_frame_buffer_cb_fn_t cb_release) {
- if (num_buffers > 0) {
- num_buffers_ = num_buffers;
- EXPECT_TRUE(fb_list_.CreateBufferList(num_buffers_));
- }
-
- return decoder_->SetFrameBufferFunctions(cb_get, cb_release, &fb_list_);
- }
-
- vpx_codec_err_t DecodeOneFrame() {
- const vpx_codec_err_t res =
- decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
- CheckDecodedFrames();
- if (res == VPX_CODEC_OK)
- video_->Next();
- return res;
- }
-
- vpx_codec_err_t DecodeRemainingFrames() {
- for (; video_->cxdata() != NULL; video_->Next()) {
- const vpx_codec_err_t res =
- decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
- if (res != VPX_CODEC_OK)
- return res;
- CheckDecodedFrames();
- }
- return VPX_CODEC_OK;
- }
-
- private:
- void CheckDecodedFrames() {
- libvpx_test::DxDataIterator dec_iter = decoder_->GetDxData();
- const vpx_image_t *img = NULL;
-
- // Get decompressed data
- while ((img = dec_iter.Next()) != NULL) {
- fb_list_.CheckXImageFrameBuffer(img);
- }
- }
-
- libvpx_test::WebMVideoSource *video_;
- libvpx_test::VP9Decoder *decoder_;
- int num_buffers_;
- ExternalFrameBufferList fb_list_;
-};
-
-// This test runs through the set of test vectors, and decodes them.
-// Libvpx will call into the application to allocate a frame buffer when
-// needed. The md5 checksums are computed for each frame in the video file.
-// If md5 checksums match the correct md5 data, then the test is passed.
-// Otherwise, the test failed.
-TEST_P(ExternalFrameBufferMD5Test, ExtFBMD5Match) {
- const std::string filename = GET_PARAM(kVideoNameParam);
- libvpx_test::CompressedVideoSource *video = NULL;
-
- // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
- // #VPX_MAXIMUM_WORK_BUFFERS + four jitter buffers.
- const int jitter_buffers = 4;
- const int num_buffers =
- VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
- set_num_buffers(num_buffers);
-
-#if CONFIG_VP8_DECODER
- // Tell compiler we are not using kVP8TestVectors.
- (void)libvpx_test::kVP8TestVectors;
-#endif
-
- // Open compressed video file.
- if (filename.substr(filename.length() - 3, 3) == "ivf") {
- video = new libvpx_test::IVFVideoSource(filename);
- } else {
- video = new libvpx_test::WebMVideoSource(filename);
- }
- ASSERT_TRUE(video != NULL);
- video->Init();
-
- // Construct md5 file name.
- const std::string md5_filename = filename + ".md5";
- OpenMD5File(md5_filename);
-
- // Decode frame, and check the md5 matching.
- ASSERT_NO_FATAL_FAILURE(RunLoop(video));
- delete video;
-}
-
-TEST_F(ExternalFrameBufferTest, MinFrameBuffers) {
- // Minimum number of external frame buffers for VP9 is
- // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS.
- const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- ASSERT_EQ(VPX_CODEC_OK,
- SetFrameBufferFunctions(
- num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
- ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
-}
-
-TEST_F(ExternalFrameBufferTest, EightJitterBuffers) {
- // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
- // #VPX_MAXIMUM_WORK_BUFFERS + eight jitter buffers.
- const int jitter_buffers = 8;
- const int num_buffers =
- VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
- ASSERT_EQ(VPX_CODEC_OK,
- SetFrameBufferFunctions(
- num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
- ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
-}
-
-TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) {
- // Minimum number of external frame buffers for VP9 is
- // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS. Most files will
- // only use 5 frame buffers at one time.
- const int num_buffers = 2;
- ASSERT_EQ(VPX_CODEC_OK,
- SetFrameBufferFunctions(
- num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
- ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
- ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
-}
-
-TEST_F(ExternalFrameBufferTest, NoRelease) {
- const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- ASSERT_EQ(VPX_CODEC_OK,
- SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
- do_not_release_vp9_frame_buffer));
- ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
- ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
-}
-
-TEST_F(ExternalFrameBufferTest, NullRealloc) {
- const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- ASSERT_EQ(VPX_CODEC_OK,
- SetFrameBufferFunctions(num_buffers, get_vp9_zero_frame_buffer,
- release_vp9_frame_buffer));
- ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());
-}
-
-TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {
- const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- ASSERT_EQ(VPX_CODEC_OK,
- SetFrameBufferFunctions(
- num_buffers, get_vp9_one_less_byte_frame_buffer,
- release_vp9_frame_buffer));
- ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());
-}
-
-TEST_F(ExternalFrameBufferTest, NullGetFunction) {
- const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
- SetFrameBufferFunctions(num_buffers, NULL,
- release_vp9_frame_buffer));
-}
-
-TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {
- const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
- SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer, NULL));
-}
-
-TEST_F(ExternalFrameBufferTest, SetAfterDecode) {
- const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
- ASSERT_EQ(VPX_CODEC_ERROR,
- SetFrameBufferFunctions(
- num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
-}
-
-VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test,
- ::testing::ValuesIn(libvpx_test::kVP9TestVectors,
- libvpx_test::kVP9TestVectors +
- libvpx_test::kNumVP9TestVectors));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/fdct4x4_test.cc b/videocodec/libvpx_internal/libvpx/test/fdct4x4_test.cc
deleted file mode 100644
index 127775c..0000000
--- a/videocodec/libvpx_internal/libvpx/test/fdct4x4_test.cc
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vpx/vpx_integer.h"
-
-extern "C" {
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *output, int pitch);
-}
-
-using libvpx_test::ACMRandom;
-
-namespace {
-const int kNumCoeffs = 16;
-typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride);
-typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride,
- int tx_type);
-typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride,
- int tx_type);
-
-typedef std::tr1::tuple<fdct_t, idct_t, int> dct_4x4_param_t;
-typedef std::tr1::tuple<fht_t, iht_t, int> ht_4x4_param_t;
-
-void fdct4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
- vp9_fdct4x4_c(in, out, stride);
-}
-
-void fht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
- vp9_fht4x4_c(in, out, stride, tx_type);
-}
-
-class Trans4x4TestBase {
- public:
- virtual ~Trans4x4TestBase() {}
-
- protected:
- virtual void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) = 0;
-
- virtual void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) = 0;
-
- void RunAccuracyCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- uint32_t max_error = 0;
- int64_t total_error = 0;
- const int count_test_block = 10000;
- for (int i = 0; i < count_test_block; ++i) {
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
-
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- test_input_block[j] = src[j] - dst[j];
- }
-
- REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,
- test_temp_block, pitch_));
- REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
-
- for (int j = 0; j < kNumCoeffs; ++j) {
- const uint32_t diff = dst[j] - src[j];
- const uint32_t error = diff * diff;
- if (max_error < error)
- max_error = error;
- total_error += error;
- }
- }
-
- EXPECT_GE(1u, max_error)
- << "Error: 4x4 FHT/IHT has an individual round trip error > 1";
-
- EXPECT_GE(count_test_block , total_error)
- << "Error: 4x4 FHT/IHT has average round trip error > 1 per block";
- }
-
- void RunCoeffCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 5000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j)
- input_block[j] = rnd.Rand8() - rnd.Rand8();
-
- fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_);
- REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_));
-
- // The minimum quant value is 4.
- for (int j = 0; j < kNumCoeffs; ++j)
- EXPECT_EQ(output_block[j], output_ref_block[j]);
- }
- }
-
- void RunMemCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 5000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- input_block[j] = rnd.Rand8() - rnd.Rand8();
- input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
- }
- if (i == 0)
- for (int j = 0; j < kNumCoeffs; ++j)
- input_extreme_block[j] = 255;
- if (i == 1)
- for (int j = 0; j < kNumCoeffs; ++j)
- input_extreme_block[j] = -255;
-
- fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
- REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
- output_block, pitch_));
-
- // The minimum quant value is 4.
- for (int j = 0; j < kNumCoeffs; ++j) {
- EXPECT_EQ(output_block[j], output_ref_block[j]);
- EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j]))
- << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE";
- }
- }
- }
-
- void RunInvAccuracyCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 1000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < kNumCoeffs; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- in[j] = src[j] - dst[j];
- }
-
- fwd_txfm_ref(in, coeff, pitch_, tx_type_);
-
- REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
-
- for (int j = 0; j < kNumCoeffs; ++j) {
- const uint32_t diff = dst[j] - src[j];
- const uint32_t error = diff * diff;
- EXPECT_GE(1u, error)
- << "Error: 16x16 IDCT has error " << error
- << " at index " << j;
- }
- }
- }
-
- int pitch_;
- int tx_type_;
- fht_t fwd_txfm_ref;
-};
-
-class Trans4x4DCT
- : public Trans4x4TestBase,
- public ::testing::TestWithParam<dct_4x4_param_t> {
- public:
- virtual ~Trans4x4DCT() {}
-
- virtual void SetUp() {
- fwd_txfm_ = GET_PARAM(0);
- inv_txfm_ = GET_PARAM(1);
- tx_type_ = GET_PARAM(2);
- pitch_ = 4;
- fwd_txfm_ref = fdct4x4_ref;
- }
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) {
- fwd_txfm_(in, out, stride);
- }
- void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) {
- inv_txfm_(out, dst, stride);
- }
-
- fdct_t fwd_txfm_;
- idct_t inv_txfm_;
-};
-
-TEST_P(Trans4x4DCT, AccuracyCheck) {
- RunAccuracyCheck();
-}
-
-TEST_P(Trans4x4DCT, CoeffCheck) {
- RunCoeffCheck();
-}
-
-TEST_P(Trans4x4DCT, MemCheck) {
- RunMemCheck();
-}
-
-TEST_P(Trans4x4DCT, InvAccuracyCheck) {
- RunInvAccuracyCheck();
-}
-
-class Trans4x4HT
- : public Trans4x4TestBase,
- public ::testing::TestWithParam<ht_4x4_param_t> {
- public:
- virtual ~Trans4x4HT() {}
-
- virtual void SetUp() {
- fwd_txfm_ = GET_PARAM(0);
- inv_txfm_ = GET_PARAM(1);
- tx_type_ = GET_PARAM(2);
- pitch_ = 4;
- fwd_txfm_ref = fht4x4_ref;
- }
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) {
- fwd_txfm_(in, out, stride, tx_type_);
- }
-
- void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) {
- inv_txfm_(out, dst, stride, tx_type_);
- }
-
- fht_t fwd_txfm_;
- iht_t inv_txfm_;
-};
-
-TEST_P(Trans4x4HT, AccuracyCheck) {
- RunAccuracyCheck();
-}
-
-TEST_P(Trans4x4HT, CoeffCheck) {
- RunCoeffCheck();
-}
-
-TEST_P(Trans4x4HT, MemCheck) {
- RunMemCheck();
-}
-
-TEST_P(Trans4x4HT, InvAccuracyCheck) {
- RunInvAccuracyCheck();
-}
-
-using std::tr1::make_tuple;
-
-INSTANTIATE_TEST_CASE_P(
- C, Trans4x4DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct4x4_c, &vp9_idct4x4_16_add_c, 0)));
-INSTANTIATE_TEST_CASE_P(
- C, Trans4x4HT,
- ::testing::Values(
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0),
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1),
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2),
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3)));
-
-#if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(
- NEON, Trans4x4DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct4x4_c,
- &vp9_idct4x4_16_add_neon, 0)));
-INSTANTIATE_TEST_CASE_P(
- DISABLED_NEON, Trans4x4HT,
- ::testing::Values(
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 0),
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 1),
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 2),
- make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 3)));
-#endif
-
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(
- SSE2, Trans4x4DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct4x4_sse2,
- &vp9_idct4x4_16_add_sse2, 0)));
-INSTANTIATE_TEST_CASE_P(
- SSE2, Trans4x4HT,
- ::testing::Values(
- make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0),
- make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1),
- make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2),
- make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3)));
-#endif
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/fdct8x8_test.cc b/videocodec/libvpx_internal/libvpx/test/fdct8x8_test.cc
deleted file mode 100644
index 6f2d7d1..0000000
--- a/videocodec/libvpx_internal/libvpx/test/fdct8x8_test.cc
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vpx/vpx_integer.h"
-
-extern "C" {
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *output, int pitch);
-}
-
-using libvpx_test::ACMRandom;
-
-namespace {
-typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride);
-typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride,
- int tx_type);
-typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride,
- int tx_type);
-
-typedef std::tr1::tuple<fdct_t, idct_t, int> dct_8x8_param_t;
-typedef std::tr1::tuple<fht_t, iht_t, int> ht_8x8_param_t;
-
-void fdct8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
- vp9_fdct8x8_c(in, out, stride);
-}
-
-void fht8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
- vp9_fht8x8_c(in, out, stride, tx_type);
-}
-
-class FwdTrans8x8TestBase {
- public:
- virtual ~FwdTrans8x8TestBase() {}
-
- protected:
- virtual void RunFwdTxfm(int16_t *in, int16_t *out, int stride) = 0;
- virtual void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) = 0;
-
- void RunSignBiasCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, 64);
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_output_block, 64);
- int count_sign_block[64][2];
- const int count_test_block = 100000;
-
- memset(count_sign_block, 0, sizeof(count_sign_block));
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < 64; ++j)
- test_input_block[j] = rnd.Rand8() - rnd.Rand8();
- REGISTER_STATE_CHECK(
- RunFwdTxfm(test_input_block, test_output_block, pitch_));
-
- for (int j = 0; j < 64; ++j) {
- if (test_output_block[j] < 0)
- ++count_sign_block[j][0];
- else if (test_output_block[j] > 0)
- ++count_sign_block[j][1];
- }
- }
-
- for (int j = 0; j < 64; ++j) {
- const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
- const int max_diff = 1125;
- EXPECT_LT(diff, max_diff)
- << "Error: 8x8 FDCT/FHT has a sign bias > "
- << 1. * max_diff / count_test_block * 100 << "%"
- << " for input range [-255, 255] at index " << j
- << " count0: " << count_sign_block[j][0]
- << " count1: " << count_sign_block[j][1]
- << " diff: " << diff;
- }
-
- memset(count_sign_block, 0, sizeof(count_sign_block));
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-15, 15].
- for (int j = 0; j < 64; ++j)
- test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4);
- REGISTER_STATE_CHECK(
- RunFwdTxfm(test_input_block, test_output_block, pitch_));
-
- for (int j = 0; j < 64; ++j) {
- if (test_output_block[j] < 0)
- ++count_sign_block[j][0];
- else if (test_output_block[j] > 0)
- ++count_sign_block[j][1];
- }
- }
-
- for (int j = 0; j < 64; ++j) {
- const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
- const int max_diff = 10000;
- EXPECT_LT(diff, max_diff)
- << "Error: 4x4 FDCT/FHT has a sign bias > "
- << 1. * max_diff / count_test_block * 100 << "%"
- << " for input range [-15, 15] at index " << j
- << " count0: " << count_sign_block[j][0]
- << " count1: " << count_sign_block[j][1]
- << " diff: " << diff;
- }
- }
-
- void RunRoundTripErrorCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- int max_error = 0;
- int total_error = 0;
- const int count_test_block = 100000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, 64);
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, 64);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, 64);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, 64);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < 64; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- test_input_block[j] = src[j] - dst[j];
- }
-
- REGISTER_STATE_CHECK(
- RunFwdTxfm(test_input_block, test_temp_block, pitch_));
- for (int j = 0; j < 64; ++j) {
- if (test_temp_block[j] > 0) {
- test_temp_block[j] += 2;
- test_temp_block[j] /= 4;
- test_temp_block[j] *= 4;
- } else {
- test_temp_block[j] -= 2;
- test_temp_block[j] /= 4;
- test_temp_block[j] *= 4;
- }
- }
- REGISTER_STATE_CHECK(
- RunInvTxfm(test_temp_block, dst, pitch_));
-
- for (int j = 0; j < 64; ++j) {
- const int diff = dst[j] - src[j];
- const int error = diff * diff;
- if (max_error < error)
- max_error = error;
- total_error += error;
- }
- }
-
- EXPECT_GE(1, max_error)
- << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
- << " roundtrip error > 1";
-
- EXPECT_GE(count_test_block/5, total_error)
- << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
- << "error > 1/5 per block";
- }
-
- void RunExtremalCheck() {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- int max_error = 0;
- int total_error = 0;
- const int count_test_block = 100000;
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, 64);
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, 64);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, 64);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, src, 64);
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < 64; ++j) {
- src[j] = rnd.Rand8() % 2 ? 255 : 0;
- dst[j] = src[j] > 0 ? 0 : 255;
- test_input_block[j] = src[j] - dst[j];
- }
-
- REGISTER_STATE_CHECK(
- RunFwdTxfm(test_input_block, test_temp_block, pitch_));
- REGISTER_STATE_CHECK(
- RunInvTxfm(test_temp_block, dst, pitch_));
-
- for (int j = 0; j < 64; ++j) {
- const int diff = dst[j] - src[j];
- const int error = diff * diff;
- if (max_error < error)
- max_error = error;
- total_error += error;
- }
-
- EXPECT_GE(1, max_error)
- << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
- << "an individual roundtrip error > 1";
-
- EXPECT_GE(count_test_block/5, total_error)
- << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
- << " roundtrip error > 1/5 per block";
- }
- }
-
- int pitch_;
- int tx_type_;
- fht_t fwd_txfm_ref;
-};
-
-class FwdTrans8x8DCT
- : public FwdTrans8x8TestBase,
- public ::testing::TestWithParam<dct_8x8_param_t> {
- public:
- virtual ~FwdTrans8x8DCT() {}
-
- virtual void SetUp() {
- fwd_txfm_ = GET_PARAM(0);
- inv_txfm_ = GET_PARAM(1);
- tx_type_ = GET_PARAM(2);
- pitch_ = 8;
- fwd_txfm_ref = fdct8x8_ref;
- }
-
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- void RunFwdTxfm(int16_t *in, int16_t *out, int stride) {
- fwd_txfm_(in, out, stride);
- }
- void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {
- inv_txfm_(out, dst, stride);
- }
-
- fdct_t fwd_txfm_;
- idct_t inv_txfm_;
-};
-
-TEST_P(FwdTrans8x8DCT, SignBiasCheck) {
- RunSignBiasCheck();
-}
-
-TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) {
- RunRoundTripErrorCheck();
-}
-
-TEST_P(FwdTrans8x8DCT, ExtremalCheck) {
- RunExtremalCheck();
-}
-
-class FwdTrans8x8HT
- : public FwdTrans8x8TestBase,
- public ::testing::TestWithParam<ht_8x8_param_t> {
- public:
- virtual ~FwdTrans8x8HT() {}
-
- virtual void SetUp() {
- fwd_txfm_ = GET_PARAM(0);
- inv_txfm_ = GET_PARAM(1);
- tx_type_ = GET_PARAM(2);
- pitch_ = 8;
- fwd_txfm_ref = fht8x8_ref;
- }
-
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- void RunFwdTxfm(int16_t *in, int16_t *out, int stride) {
- fwd_txfm_(in, out, stride, tx_type_);
- }
- void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {
- inv_txfm_(out, dst, stride, tx_type_);
- }
-
- fht_t fwd_txfm_;
- iht_t inv_txfm_;
-};
-
-TEST_P(FwdTrans8x8HT, SignBiasCheck) {
- RunSignBiasCheck();
-}
-
-TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) {
- RunRoundTripErrorCheck();
-}
-
-TEST_P(FwdTrans8x8HT, ExtremalCheck) {
- RunExtremalCheck();
-}
-
-using std::tr1::make_tuple;
-
-INSTANTIATE_TEST_CASE_P(
- C, FwdTrans8x8DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct8x8_c, &vp9_idct8x8_64_add_c, 0)));
-INSTANTIATE_TEST_CASE_P(
- C, FwdTrans8x8HT,
- ::testing::Values(
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0),
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1),
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2),
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3)));
-
-#if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(
- NEON, FwdTrans8x8DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct8x8_c, &vp9_idct8x8_64_add_neon, 0)));
-INSTANTIATE_TEST_CASE_P(
- DISABLED_NEON, FwdTrans8x8HT,
- ::testing::Values(
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 0),
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 1),
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 2),
- make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 3)));
-#endif
-
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(
- SSE2, FwdTrans8x8DCT,
- ::testing::Values(
- make_tuple(&vp9_fdct8x8_sse2, &vp9_idct8x8_64_add_sse2, 0)));
-INSTANTIATE_TEST_CASE_P(
- SSE2, FwdTrans8x8HT,
- ::testing::Values(
- make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0),
- make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 1),
- make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2),
- make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3)));
-#endif
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/i420_video_source.h b/videocodec/libvpx_internal/libvpx/test/i420_video_source.h
deleted file mode 100644
index c3315f9..0000000
--- a/videocodec/libvpx_internal/libvpx/test/i420_video_source.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_I420_VIDEO_SOURCE_H_
-#define TEST_I420_VIDEO_SOURCE_H_
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-
-#include "test/video_source.h"
-
-namespace libvpx_test {
-
-// This class extends VideoSource to allow parsing of raw yv12
-// so that we can do actual file encodes.
-class I420VideoSource : public VideoSource {
- public:
- I420VideoSource(const std::string &file_name,
- unsigned int width, unsigned int height,
- int rate_numerator, int rate_denominator,
- unsigned int start, int limit)
- : file_name_(file_name),
- input_file_(NULL),
- img_(NULL),
- start_(start),
- limit_(limit),
- frame_(0),
- width_(0),
- height_(0),
- framerate_numerator_(rate_numerator),
- framerate_denominator_(rate_denominator) {
- // This initializes raw_sz_, width_, height_ and allocates an img.
- SetSize(width, height);
- }
-
- virtual ~I420VideoSource() {
- vpx_img_free(img_);
- if (input_file_)
- fclose(input_file_);
- }
-
- virtual void Begin() {
- if (input_file_)
- fclose(input_file_);
- input_file_ = OpenTestDataFile(file_name_);
- ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
- << file_name_;
- if (start_) {
- fseek(input_file_, static_cast<unsigned>(raw_sz_) * start_, SEEK_SET);
- }
-
- frame_ = start_;
- FillFrame();
- }
-
- virtual void Next() {
- ++frame_;
- FillFrame();
- }
-
- virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
-
- // Models a stream where Timebase = 1/FPS, so pts == frame.
- virtual vpx_codec_pts_t pts() const { return frame_; }
-
- virtual unsigned long duration() const { return 1; }
-
- virtual vpx_rational_t timebase() const {
- const vpx_rational_t t = { framerate_denominator_, framerate_numerator_ };
- return t;
- }
-
- virtual unsigned int frame() const { return frame_; }
-
- virtual unsigned int limit() const { return limit_; }
-
- void SetSize(unsigned int width, unsigned int height) {
- if (width != width_ || height != height_) {
- vpx_img_free(img_);
- img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, width, height, 1);
- ASSERT_TRUE(img_ != NULL);
- width_ = width;
- height_ = height;
- raw_sz_ = width * height * 3 / 2;
- }
- }
-
- virtual void FillFrame() {
- ASSERT_TRUE(input_file_ != NULL);
- // Read a frame from input_file.
- if (fread(img_->img_data, raw_sz_, 1, input_file_) == 0) {
- limit_ = frame_;
- }
- }
-
- protected:
- std::string file_name_;
- FILE *input_file_;
- vpx_image_t *img_;
- size_t raw_sz_;
- unsigned int start_;
- unsigned int limit_;
- unsigned int frame_;
- unsigned int width_;
- unsigned int height_;
- int framerate_numerator_;
- int framerate_denominator_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_I420_VIDEO_SOURCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/idct8x8_test.cc b/videocodec/libvpx_internal/libvpx/test/idct8x8_test.cc
deleted file mode 100644
index 5f4c33a..0000000
--- a/videocodec/libvpx_internal/libvpx/test/idct8x8_test.cc
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "./vp9_rtcd.h"
-
-#include "test/acm_random.h"
-#include "vpx/vpx_integer.h"
-
-using libvpx_test::ACMRandom;
-
-namespace {
-
-#ifdef _MSC_VER
-static int round(double x) {
- if (x < 0)
- return static_cast<int>(ceil(x - 0.5));
- else
- return static_cast<int>(floor(x + 0.5));
-}
-#endif
-
-void reference_dct_1d(double input[8], double output[8]) {
- const double kPi = 3.141592653589793238462643383279502884;
- const double kInvSqrt2 = 0.707106781186547524400844362104;
- for (int k = 0; k < 8; k++) {
- output[k] = 0.0;
- for (int n = 0; n < 8; n++)
- output[k] += input[n]*cos(kPi*(2*n+1)*k/16.0);
- if (k == 0)
- output[k] = output[k]*kInvSqrt2;
- }
-}
-
-void reference_dct_2d(int16_t input[64], double output[64]) {
- // First transform columns
- for (int i = 0; i < 8; ++i) {
- double temp_in[8], temp_out[8];
- for (int j = 0; j < 8; ++j)
- temp_in[j] = input[j*8 + i];
- reference_dct_1d(temp_in, temp_out);
- for (int j = 0; j < 8; ++j)
- output[j*8 + i] = temp_out[j];
- }
- // Then transform rows
- for (int i = 0; i < 8; ++i) {
- double temp_in[8], temp_out[8];
- for (int j = 0; j < 8; ++j)
- temp_in[j] = output[j + i*8];
- reference_dct_1d(temp_in, temp_out);
- for (int j = 0; j < 8; ++j)
- output[j + i*8] = temp_out[j];
- }
- // Scale by some magic number
- for (int i = 0; i < 64; ++i)
- output[i] *= 2;
-}
-
-void reference_idct_1d(double input[8], double output[8]) {
- const double kPi = 3.141592653589793238462643383279502884;
- const double kSqrt2 = 1.414213562373095048801688724209698;
- for (int k = 0; k < 8; k++) {
- output[k] = 0.0;
- for (int n = 0; n < 8; n++) {
- output[k] += input[n]*cos(kPi*(2*k+1)*n/16.0);
- if (n == 0)
- output[k] = output[k]/kSqrt2;
- }
- }
-}
-
-void reference_idct_2d(double input[64], int16_t output[64]) {
- double out[64], out2[64];
- // First transform rows
- for (int i = 0; i < 8; ++i) {
- double temp_in[8], temp_out[8];
- for (int j = 0; j < 8; ++j)
- temp_in[j] = input[j + i*8];
- reference_idct_1d(temp_in, temp_out);
- for (int j = 0; j < 8; ++j)
- out[j + i*8] = temp_out[j];
- }
- // Then transform columns
- for (int i = 0; i < 8; ++i) {
- double temp_in[8], temp_out[8];
- for (int j = 0; j < 8; ++j)
- temp_in[j] = out[j*8 + i];
- reference_idct_1d(temp_in, temp_out);
- for (int j = 0; j < 8; ++j)
- out2[j*8 + i] = temp_out[j];
- }
- for (int i = 0; i < 64; ++i)
- output[i] = round(out2[i]/32);
-}
-
-TEST(VP9Idct8x8Test, AccuracyCheck) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 10000;
- for (int i = 0; i < count_test_block; ++i) {
- int16_t input[64], coeff[64];
- double output_r[64];
- uint8_t dst[64], src[64];
-
- for (int j = 0; j < 64; ++j) {
- src[j] = rnd.Rand8();
- dst[j] = rnd.Rand8();
- }
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < 64; ++j)
- input[j] = src[j] - dst[j];
-
- reference_dct_2d(input, output_r);
- for (int j = 0; j < 64; ++j)
- coeff[j] = round(output_r[j]);
- vp9_idct8x8_64_add_c(coeff, dst, 8);
- for (int j = 0; j < 64; ++j) {
- const int diff = dst[j] - src[j];
- const int error = diff * diff;
- EXPECT_GE(1, error)
- << "Error: 8x8 FDCT/IDCT has error " << error
- << " at index " << j;
- }
- }
-}
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/idct_test.cc b/videocodec/libvpx_internal/libvpx/test/idct_test.cc
deleted file mode 100644
index 1bbf80a..0000000
--- a/videocodec/libvpx_internal/libvpx/test/idct_test.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-#include "./vp8_rtcd.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "vpx/vpx_integer.h"
-
-typedef void (*idct_fn_t)(int16_t *input, unsigned char *pred_ptr,
- int pred_stride, unsigned char *dst_ptr,
- int dst_stride);
-namespace {
-class IDCTTest : public ::testing::TestWithParam<idct_fn_t> {
- protected:
- virtual void SetUp() {
- int i;
-
- UUT = GetParam();
- memset(input, 0, sizeof(input));
- /* Set up guard blocks */
- for (i = 0; i < 256; i++) output[i] = ((i & 0xF) < 4 && (i < 64)) ? 0 : -1;
- }
-
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- idct_fn_t UUT;
- int16_t input[16];
- unsigned char output[256];
- unsigned char predict[256];
-};
-
-TEST_P(IDCTTest, TestGuardBlocks) {
- int i;
-
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(0, output[i]) << i;
- else
- EXPECT_EQ(255, output[i]);
-}
-
-TEST_P(IDCTTest, TestAllZeros) {
- int i;
-
- REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
-
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(0, output[i]) << "i==" << i;
- else
- EXPECT_EQ(255, output[i]) << "i==" << i;
-}
-
-TEST_P(IDCTTest, TestAllOnes) {
- int i;
-
- input[0] = 4;
- REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
-
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(1, output[i]) << "i==" << i;
- else
- EXPECT_EQ(255, output[i]) << "i==" << i;
-}
-
-TEST_P(IDCTTest, TestAddOne) {
- int i;
-
- for (i = 0; i < 256; i++) predict[i] = i;
- input[0] = 4;
- REGISTER_STATE_CHECK(UUT(input, predict, 16, output, 16));
-
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(i + 1, output[i]) << "i==" << i;
- else
- EXPECT_EQ(255, output[i]) << "i==" << i;
-}
-
-TEST_P(IDCTTest, TestWithData) {
- int i;
-
- for (i = 0; i < 16; i++) input[i] = i;
-
- REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
-
- for (i = 0; i < 256; i++)
- if ((i & 0xF) > 3 || i > 63)
- EXPECT_EQ(255, output[i]) << "i==" << i;
- else if (i == 0)
- EXPECT_EQ(11, output[i]) << "i==" << i;
- else if (i == 34)
- EXPECT_EQ(1, output[i]) << "i==" << i;
- else if (i == 2 || i == 17 || i == 32)
- EXPECT_EQ(3, output[i]) << "i==" << i;
- else
- EXPECT_EQ(0, output[i]) << "i==" << i;
-}
-
-INSTANTIATE_TEST_CASE_P(C, IDCTTest, ::testing::Values(vp8_short_idct4x4llm_c));
-#if HAVE_MMX
-INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
- ::testing::Values(vp8_short_idct4x4llm_mmx));
-#endif
-}
diff --git a/videocodec/libvpx_internal/libvpx/test/intrapred_test.cc b/videocodec/libvpx_internal/libvpx/test/intrapred_test.cc
deleted file mode 100644
index cefe192..0000000
--- a/videocodec/libvpx_internal/libvpx/test/intrapred_test.cc
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <string.h>
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "./vpx_config.h"
-#include "./vp8_rtcd.h"
-#include "vp8/common/blockd.h"
-#include "vpx_mem/vpx_mem.h"
-
-namespace {
-
-using libvpx_test::ACMRandom;
-
-class IntraPredBase {
- public:
- virtual ~IntraPredBase() { libvpx_test::ClearSystemState(); }
-
- protected:
- void SetupMacroblock(MACROBLOCKD *mbptr,
- MODE_INFO *miptr,
- uint8_t *data,
- int block_size,
- int stride,
- int num_planes) {
- mbptr_ = mbptr;
- miptr_ = miptr;
- mbptr_->up_available = 1;
- mbptr_->left_available = 1;
- mbptr_->mode_info_context = miptr_;
- stride_ = stride;
- block_size_ = block_size;
- num_planes_ = num_planes;
- for (int p = 0; p < num_planes; p++)
- data_ptr_[p] = data + stride * (block_size + 1) * p +
- stride + block_size;
- }
-
- void FillRandom() {
- // Fill edges with random data
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- for (int p = 0; p < num_planes_; p++) {
- for (int x = -1 ; x <= block_size_; x++)
- data_ptr_[p][x - stride_] = rnd.Rand8();
- for (int y = 0; y < block_size_; y++)
- data_ptr_[p][y * stride_ - 1] = rnd.Rand8();
- }
- }
-
- virtual void Predict(MB_PREDICTION_MODE mode) = 0;
-
- void SetLeftUnavailable() {
- mbptr_->left_available = 0;
- for (int p = 0; p < num_planes_; p++)
- for (int i = -1; i < block_size_; ++i)
- data_ptr_[p][stride_ * i - 1] = 129;
- }
-
- void SetTopUnavailable() {
- mbptr_->up_available = 0;
- for (int p = 0; p < num_planes_; p++)
- memset(&data_ptr_[p][-1 - stride_], 127, block_size_ + 2);
- }
-
- void SetTopLeftUnavailable() {
- SetLeftUnavailable();
- SetTopUnavailable();
- }
-
- int BlockSizeLog2Min1() const {
- switch (block_size_) {
- case 16:
- return 3;
- case 8:
- return 2;
- default:
- return 0;
- }
- }
-
- // check DC prediction output against a reference
- void CheckDCPrediction() const {
- for (int p = 0; p < num_planes_; p++) {
- // calculate expected DC
- int expected;
- if (mbptr_->up_available || mbptr_->left_available) {
- int sum = 0, shift = BlockSizeLog2Min1() + mbptr_->up_available +
- mbptr_->left_available;
- if (mbptr_->up_available)
- for (int x = 0; x < block_size_; x++)
- sum += data_ptr_[p][x - stride_];
- if (mbptr_->left_available)
- for (int y = 0; y < block_size_; y++)
- sum += data_ptr_[p][y * stride_ - 1];
- expected = (sum + (1 << (shift - 1))) >> shift;
- } else {
- expected = 0x80;
- }
- // check that all subsequent lines are equal to the first
- for (int y = 1; y < block_size_; ++y)
- ASSERT_EQ(0, memcmp(data_ptr_[p], &data_ptr_[p][y * stride_],
- block_size_));
- // within the first line, ensure that each pixel has the same value
- for (int x = 1; x < block_size_; ++x)
- ASSERT_EQ(data_ptr_[p][0], data_ptr_[p][x]);
- // now ensure that that pixel has the expected (DC) value
- ASSERT_EQ(expected, data_ptr_[p][0]);
- }
- }
-
- // check V prediction output against a reference
- void CheckVPrediction() const {
- // check that all lines equal the top border
- for (int p = 0; p < num_planes_; p++)
- for (int y = 0; y < block_size_; y++)
- ASSERT_EQ(0, memcmp(&data_ptr_[p][-stride_],
- &data_ptr_[p][y * stride_], block_size_));
- }
-
- // check H prediction output against a reference
- void CheckHPrediction() const {
- // for each line, ensure that each pixel is equal to the left border
- for (int p = 0; p < num_planes_; p++)
- for (int y = 0; y < block_size_; y++)
- for (int x = 0; x < block_size_; x++)
- ASSERT_EQ(data_ptr_[p][-1 + y * stride_],
- data_ptr_[p][x + y * stride_]);
- }
-
- static int ClipByte(int value) {
- if (value > 255)
- return 255;
- else if (value < 0)
- return 0;
- return value;
- }
-
- // check TM prediction output against a reference
- void CheckTMPrediction() const {
- for (int p = 0; p < num_planes_; p++)
- for (int y = 0; y < block_size_; y++)
- for (int x = 0; x < block_size_; x++) {
- const int expected = ClipByte(data_ptr_[p][x - stride_]
- + data_ptr_[p][stride_ * y - 1]
- - data_ptr_[p][-1 - stride_]);
- ASSERT_EQ(expected, data_ptr_[p][y * stride_ + x]);
- }
- }
-
- // Actual test
- void RunTest() {
- {
- SCOPED_TRACE("DC_PRED");
- FillRandom();
- Predict(DC_PRED);
- CheckDCPrediction();
- }
- {
- SCOPED_TRACE("DC_PRED LEFT");
- FillRandom();
- SetLeftUnavailable();
- Predict(DC_PRED);
- CheckDCPrediction();
- }
- {
- SCOPED_TRACE("DC_PRED TOP");
- FillRandom();
- SetTopUnavailable();
- Predict(DC_PRED);
- CheckDCPrediction();
- }
- {
- SCOPED_TRACE("DC_PRED TOP_LEFT");
- FillRandom();
- SetTopLeftUnavailable();
- Predict(DC_PRED);
- CheckDCPrediction();
- }
- {
- SCOPED_TRACE("H_PRED");
- FillRandom();
- Predict(H_PRED);
- CheckHPrediction();
- }
- {
- SCOPED_TRACE("V_PRED");
- FillRandom();
- Predict(V_PRED);
- CheckVPrediction();
- }
- {
- SCOPED_TRACE("TM_PRED");
- FillRandom();
- Predict(TM_PRED);
- CheckTMPrediction();
- }
- }
-
- MACROBLOCKD *mbptr_;
- MODE_INFO *miptr_;
- uint8_t *data_ptr_[2]; // in the case of Y, only [0] is used
- int stride_;
- int block_size_;
- int num_planes_;
-};
-
-typedef void (*intra_pred_y_fn_t)(MACROBLOCKD *x,
- uint8_t *yabove_row,
- uint8_t *yleft,
- int left_stride,
- uint8_t *ypred_ptr,
- int y_stride);
-
-class IntraPredYTest
- : public IntraPredBase,
- public ::testing::TestWithParam<intra_pred_y_fn_t> {
- public:
- static void SetUpTestCase() {
- mb_ = reinterpret_cast<MACROBLOCKD*>(
- vpx_memalign(32, sizeof(MACROBLOCKD)));
- mi_ = reinterpret_cast<MODE_INFO*>(
- vpx_memalign(32, sizeof(MODE_INFO)));
- data_array_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kDataBufferSize));
- }
-
- static void TearDownTestCase() {
- vpx_free(data_array_);
- vpx_free(mi_);
- vpx_free(mb_);
- data_array_ = NULL;
- }
-
- protected:
- static const int kBlockSize = 16;
- static const int kDataAlignment = 16;
- static const int kStride = kBlockSize * 3;
- // We use 48 so that the data pointer of the first pixel in each row of
- // each macroblock is 16-byte aligned, and this gives us access to the
- // top-left and top-right corner pixels belonging to the top-left/right
- // macroblocks.
- // We use 17 lines so we have one line above us for top-prediction.
- static const int kDataBufferSize = kStride * (kBlockSize + 1);
-
- virtual void SetUp() {
- pred_fn_ = GetParam();
- SetupMacroblock(mb_, mi_, data_array_, kBlockSize, kStride, 1);
- }
-
- virtual void Predict(MB_PREDICTION_MODE mode) {
- mbptr_->mode_info_context->mbmi.mode = mode;
- REGISTER_STATE_CHECK(pred_fn_(mbptr_,
- data_ptr_[0] - kStride,
- data_ptr_[0] - 1, kStride,
- data_ptr_[0], kStride));
- }
-
- intra_pred_y_fn_t pred_fn_;
- static uint8_t* data_array_;
- static MACROBLOCKD * mb_;
- static MODE_INFO *mi_;
-};
-
-MACROBLOCKD* IntraPredYTest::mb_ = NULL;
-MODE_INFO* IntraPredYTest::mi_ = NULL;
-uint8_t* IntraPredYTest::data_array_ = NULL;
-
-TEST_P(IntraPredYTest, IntraPredTests) {
- RunTest();
-}
-
-INSTANTIATE_TEST_CASE_P(C, IntraPredYTest,
- ::testing::Values(
- vp8_build_intra_predictors_mby_s_c));
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(SSE2, IntraPredYTest,
- ::testing::Values(
- vp8_build_intra_predictors_mby_s_sse2));
-#endif
-#if HAVE_SSSE3
-INSTANTIATE_TEST_CASE_P(SSSE3, IntraPredYTest,
- ::testing::Values(
- vp8_build_intra_predictors_mby_s_ssse3));
-#endif
-
-typedef void (*intra_pred_uv_fn_t)(MACROBLOCKD *x,
- uint8_t *uabove_row,
- uint8_t *vabove_row,
- uint8_t *uleft,
- uint8_t *vleft,
- int left_stride,
- uint8_t *upred_ptr,
- uint8_t *vpred_ptr,
- int pred_stride);
-
-class IntraPredUVTest
- : public IntraPredBase,
- public ::testing::TestWithParam<intra_pred_uv_fn_t> {
- public:
- static void SetUpTestCase() {
- mb_ = reinterpret_cast<MACROBLOCKD*>(
- vpx_memalign(32, sizeof(MACROBLOCKD)));
- mi_ = reinterpret_cast<MODE_INFO*>(
- vpx_memalign(32, sizeof(MODE_INFO)));
- data_array_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kDataBufferSize));
- }
-
- static void TearDownTestCase() {
- vpx_free(data_array_);
- vpx_free(mi_);
- vpx_free(mb_);
- data_array_ = NULL;
- }
-
- protected:
- static const int kBlockSize = 8;
- static const int kDataAlignment = 8;
- static const int kStride = kBlockSize * 3;
- // We use 24 so that the data pointer of the first pixel in each row of
- // each macroblock is 8-byte aligned, and this gives us access to the
- // top-left and top-right corner pixels belonging to the top-left/right
- // macroblocks.
- // We use 9 lines so we have one line above us for top-prediction.
- // [0] = U, [1] = V
- static const int kDataBufferSize = 2 * kStride * (kBlockSize + 1);
-
- virtual void SetUp() {
- pred_fn_ = GetParam();
- SetupMacroblock(mb_, mi_, data_array_, kBlockSize, kStride, 2);
- }
-
- virtual void Predict(MB_PREDICTION_MODE mode) {
- mbptr_->mode_info_context->mbmi.uv_mode = mode;
- pred_fn_(mbptr_, data_ptr_[0] - kStride, data_ptr_[1] - kStride,
- data_ptr_[0] - 1, data_ptr_[1] - 1, kStride,
- data_ptr_[0], data_ptr_[1], kStride);
- }
-
- intra_pred_uv_fn_t pred_fn_;
- // We use 24 so that the data pointer of the first pixel in each row of
- // each macroblock is 8-byte aligned, and this gives us access to the
- // top-left and top-right corner pixels belonging to the top-left/right
- // macroblocks.
- // We use 9 lines so we have one line above us for top-prediction.
- // [0] = U, [1] = V
- static uint8_t* data_array_;
- static MACROBLOCKD* mb_;
- static MODE_INFO* mi_;
-};
-
-MACROBLOCKD* IntraPredUVTest::mb_ = NULL;
-MODE_INFO* IntraPredUVTest::mi_ = NULL;
-uint8_t* IntraPredUVTest::data_array_ = NULL;
-
-TEST_P(IntraPredUVTest, IntraPredTests) {
- RunTest();
-}
-
-INSTANTIATE_TEST_CASE_P(C, IntraPredUVTest,
- ::testing::Values(
- vp8_build_intra_predictors_mbuv_s_c));
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(SSE2, IntraPredUVTest,
- ::testing::Values(
- vp8_build_intra_predictors_mbuv_s_sse2));
-#endif
-#if HAVE_SSSE3
-INSTANTIATE_TEST_CASE_P(SSSE3, IntraPredUVTest,
- ::testing::Values(
- vp8_build_intra_predictors_mbuv_s_ssse3));
-#endif
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/ivf_video_source.h b/videocodec/libvpx_internal/libvpx/test/ivf_video_source.h
deleted file mode 100644
index 824a39d..0000000
--- a/videocodec/libvpx_internal/libvpx/test/ivf_video_source.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_IVF_VIDEO_SOURCE_H_
-#define TEST_IVF_VIDEO_SOURCE_H_
-#include <cstdio>
-#include <cstdlib>
-#include <new>
-#include <string>
-#include "test/video_source.h"
-
-namespace libvpx_test {
-const unsigned int kCodeBufferSize = 256 * 1024;
-const unsigned int kIvfFileHdrSize = 32;
-const unsigned int kIvfFrameHdrSize = 12;
-
-static unsigned int MemGetLe32(const uint8_t *mem) {
- return (mem[3] << 24) | (mem[2] << 16) | (mem[1] << 8) | (mem[0]);
-}
-
-// This class extends VideoSource to allow parsing of ivf files,
-// so that we can do actual file decodes.
-class IVFVideoSource : public CompressedVideoSource {
- public:
- explicit IVFVideoSource(const std::string &file_name)
- : file_name_(file_name),
- input_file_(NULL),
- compressed_frame_buf_(NULL),
- frame_sz_(0),
- frame_(0),
- end_of_file_(false) {
- }
-
- virtual ~IVFVideoSource() {
- delete[] compressed_frame_buf_;
-
- if (input_file_)
- fclose(input_file_);
- }
-
- virtual void Init() {
- // Allocate a buffer for read in the compressed video frame.
- compressed_frame_buf_ = new uint8_t[libvpx_test::kCodeBufferSize];
- ASSERT_TRUE(compressed_frame_buf_ != NULL)
- << "Allocate frame buffer failed";
- }
-
- virtual void Begin() {
- input_file_ = OpenTestDataFile(file_name_);
- ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
- << file_name_;
-
- // Read file header
- uint8_t file_hdr[kIvfFileHdrSize];
- ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))
- << "File header read failed.";
- // Check file header
- ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' && file_hdr[2] == 'I'
- && file_hdr[3] == 'F') << "Input is not an IVF file.";
-
- FillFrame();
- }
-
- virtual void Next() {
- ++frame_;
- FillFrame();
- }
-
- void FillFrame() {
- ASSERT_TRUE(input_file_ != NULL);
- uint8_t frame_hdr[kIvfFrameHdrSize];
- // Check frame header and read a frame from input_file.
- if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_)
- != kIvfFrameHdrSize) {
- end_of_file_ = true;
- } else {
- end_of_file_ = false;
-
- frame_sz_ = MemGetLe32(frame_hdr);
- ASSERT_LE(frame_sz_, kCodeBufferSize)
- << "Frame is too big for allocated code buffer";
- ASSERT_EQ(frame_sz_,
- fread(compressed_frame_buf_, 1, frame_sz_, input_file_))
- << "Failed to read complete frame";
- }
- }
-
- virtual const uint8_t *cxdata() const {
- return end_of_file_ ? NULL : compressed_frame_buf_;
- }
- virtual size_t frame_size() const { return frame_sz_; }
- virtual unsigned int frame_number() const { return frame_; }
-
- protected:
- std::string file_name_;
- FILE *input_file_;
- uint8_t *compressed_frame_buf_;
- size_t frame_sz_;
- unsigned int frame_;
- bool end_of_file_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_IVF_VIDEO_SOURCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/keyframe_test.cc b/videocodec/libvpx_internal/libvpx/test/keyframe_test.cc
deleted file mode 100644
index d8b21a1..0000000
--- a/videocodec/libvpx_internal/libvpx/test/keyframe_test.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <climits>
-#include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-class KeyframeTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- protected:
- KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~KeyframeTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- kf_count_ = 0;
- kf_count_max_ = INT_MAX;
- kf_do_force_kf_ = false;
- set_cpu_used_ = 0;
- }
-
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
- if (kf_do_force_kf_)
- frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
- if (set_cpu_used_ && video->frame() == 1)
- encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
- kf_pts_list_.push_back(pkt->data.frame.pts);
- kf_count_++;
- abort_ |= kf_count_ > kf_count_max_;
- }
- }
-
- bool kf_do_force_kf_;
- int kf_count_;
- int kf_count_max_;
- std::vector<vpx_codec_pts_t> kf_pts_list_;
- int set_cpu_used_;
-};
-
-TEST_P(KeyframeTest, TestRandomVideoSource) {
- // Validate that encoding the RandomVideoSource produces multiple keyframes.
- // This validates the results of the TestDisableKeyframes test.
- kf_count_max_ = 2; // early exit successful tests.
-
- ::libvpx_test::RandomVideoSource video;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- // In realtime mode - auto placed keyframes are exceedingly rare, don't
- // bother with this check if(GetParam() > 0)
- if (GET_PARAM(1) > 0)
- EXPECT_GT(kf_count_, 1);
-}
-
-TEST_P(KeyframeTest, TestDisableKeyframes) {
- cfg_.kf_mode = VPX_KF_DISABLED;
- kf_count_max_ = 1; // early exit failed tests.
-
- ::libvpx_test::RandomVideoSource video;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- EXPECT_EQ(1, kf_count_);
-}
-
-TEST_P(KeyframeTest, TestForceKeyframe) {
- cfg_.kf_mode = VPX_KF_DISABLED;
- kf_do_force_kf_ = true;
-
- ::libvpx_test::DummyVideoSource video;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- // verify that every third frame is a keyframe.
- for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
- iter != kf_pts_list_.end(); ++iter) {
- ASSERT_EQ(0, *iter % 3) << "Unexpected keyframe at frame " << *iter;
- }
-}
-
-TEST_P(KeyframeTest, TestKeyframeMaxDistance) {
- cfg_.kf_max_dist = 25;
-
- ::libvpx_test::DummyVideoSource video;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- // verify that keyframe interval matches kf_max_dist
- for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
- iter != kf_pts_list_.end(); ++iter) {
- ASSERT_EQ(0, *iter % 25) << "Unexpected keyframe at frame " << *iter;
- }
-}
-
-TEST_P(KeyframeTest, TestAutoKeyframe) {
- cfg_.kf_mode = VPX_KF_AUTO;
- kf_do_force_kf_ = false;
-
- // Force a deterministic speed step in Real Time mode, as the faster modes
- // may not produce a keyframe like we expect. This is necessary when running
- // on very slow environments (like Valgrind). The step -11 was determined
- // experimentally as the fastest mode that still throws the keyframe.
- if (deadline_ == VPX_DL_REALTIME)
- set_cpu_used_ = -11;
-
- // This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120.
- // I check only the first 40 frames to make sure there's a keyframe at frame
- // 0 and 30.
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 40);
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- // In realtime mode - auto placed keyframes are exceedingly rare, don't
- // bother with this check
- if (GET_PARAM(1) > 0)
- EXPECT_EQ(2u, kf_pts_list_.size()) << " Not the right number of keyframes ";
-
- // Verify that keyframes match the file keyframes in the file.
- for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
- iter != kf_pts_list_.end(); ++iter) {
- if (deadline_ == VPX_DL_REALTIME && *iter > 0)
- EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
- << *iter;
- else
- EXPECT_EQ(0, *iter % 30) << "Unexpected keyframe at frame " << *iter;
- }
-}
-
-VP8_INSTANTIATE_TEST_CASE(KeyframeTest, ALL_TEST_MODES);
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/md5_helper.h b/videocodec/libvpx_internal/libvpx/test/md5_helper.h
deleted file mode 100644
index dd446f4..0000000
--- a/videocodec/libvpx_internal/libvpx/test/md5_helper.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_MD5_HELPER_H_
-#define TEST_MD5_HELPER_H_
-
-#include "./md5_utils.h"
-#include "vpx/vpx_decoder.h"
-
-namespace libvpx_test {
-class MD5 {
- public:
- MD5() {
- MD5Init(&md5_);
- }
-
- void Add(const vpx_image_t *img) {
- for (int plane = 0; plane < 3; ++plane) {
- const uint8_t *buf = img->planes[plane];
- // Calculate the width and height to do the md5 check. For the chroma
- // plane, we never want to round down and thus skip a pixel so if
- // we are shifting by 1 (chroma_shift) we add 1 before doing the shift.
- // This works only for chroma_shift of 0 and 1.
- const int h = plane ? (img->d_h + img->y_chroma_shift) >>
- img->y_chroma_shift : img->d_h;
- const int w = plane ? (img->d_w + img->x_chroma_shift) >>
- img->x_chroma_shift : img->d_w;
-
- for (int y = 0; y < h; ++y) {
- MD5Update(&md5_, buf, w);
- buf += img->stride[plane];
- }
- }
- }
-
- const char *Get(void) {
- static const char hex[16] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
- };
- uint8_t tmp[16];
- MD5Context ctx_tmp = md5_;
-
- MD5Final(tmp, &ctx_tmp);
- for (int i = 0; i < 16; i++) {
- res_[i * 2 + 0] = hex[tmp[i] >> 4];
- res_[i * 2 + 1] = hex[tmp[i] & 0xf];
- }
- res_[32] = 0;
-
- return res_;
- }
-
- protected:
- char res_[33];
- MD5Context md5_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_MD5_HELPER_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/partial_idct_test.cc b/videocodec/libvpx_internal/libvpx/test/partial_idct_test.cc
deleted file mode 100644
index 8849ce6..0000000
--- a/videocodec/libvpx_internal/libvpx/test/partial_idct_test.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_scan.h"
-#include "vpx/vpx_integer.h"
-
-using libvpx_test::ACMRandom;
-
-namespace {
-typedef void (*fwd_txfm_t)(const int16_t *in, int16_t *out, int stride);
-typedef void (*inv_txfm_t)(const int16_t *in, uint8_t *out, int stride);
-typedef std::tr1::tuple<inv_txfm_t,
- inv_txfm_t,
- TX_SIZE, int> partial_itxfm_param_t;
-const int kMaxNumCoeffs = 1024;
-class PartialIDctTest : public ::testing::TestWithParam<partial_itxfm_param_t> {
- public:
- virtual ~PartialIDctTest() {}
- virtual void SetUp() {
- full_itxfm_ = GET_PARAM(0);
- partial_itxfm_ = GET_PARAM(1);
- tx_size_ = GET_PARAM(2);
- last_nonzero_ = GET_PARAM(3);
- }
-
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
- int last_nonzero_;
- TX_SIZE tx_size_;
- inv_txfm_t full_itxfm_;
- inv_txfm_t partial_itxfm_;
-};
-
-TEST_P(PartialIDctTest, ResultsMatch) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- int size;
- switch (tx_size_) {
- case TX_4X4:
- size = 4;
- break;
- case TX_8X8:
- size = 8;
- break;
- case TX_16X16:
- size = 16;
- break;
- case TX_32X32:
- size = 32;
- break;
- default:
- FAIL() << "Wrong Size!";
- break;
- }
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block1, kMaxNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block2, kMaxNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst1, kMaxNumCoeffs);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, dst2, kMaxNumCoeffs);
- const int count_test_block = 1000;
- const int max_coeff = 32766 / 4;
- const int block_size = size * size;
- int max_error = 0;
- for (int i = 0; i < count_test_block; ++i) {
- // clear out destination buffer
- memset(dst1, 0, sizeof(*dst1) * block_size);
- memset(dst2, 0, sizeof(*dst2) * block_size);
- memset(test_coef_block1, 0, sizeof(*test_coef_block1) * block_size);
- memset(test_coef_block2, 0, sizeof(*test_coef_block2) * block_size);
- int max_energy_leftover = max_coeff * max_coeff;
- for (int j = 0; j < last_nonzero_; ++j) {
- int16_t coef = static_cast<int16_t>(sqrt(1.0 * max_energy_leftover) *
- (rnd.Rand16() - 32768) / 65536);
- max_energy_leftover -= coef * coef;
- if (max_energy_leftover < 0) {
- max_energy_leftover = 0;
- coef = 0;
- }
- test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] = coef;
- }
-
- memcpy(test_coef_block2, test_coef_block1,
- sizeof(*test_coef_block2) * block_size);
-
- REGISTER_STATE_CHECK(full_itxfm_(test_coef_block1, dst1, size));
- REGISTER_STATE_CHECK(partial_itxfm_(test_coef_block2, dst2, size));
-
- for (int j = 0; j < block_size; ++j) {
- const int diff = dst1[j] - dst2[j];
- const int error = diff * diff;
- if (max_error < error)
- max_error = error;
- }
- }
-
- EXPECT_EQ(0, max_error)
- << "Error: partial inverse transform produces different results";
-}
-using std::tr1::make_tuple;
-
-INSTANTIATE_TEST_CASE_P(
- C, PartialIDctTest,
- ::testing::Values(
- make_tuple(&vp9_idct32x32_1024_add_c,
- &vp9_idct32x32_34_add_c,
- TX_32X32, 34),
- make_tuple(&vp9_idct32x32_1024_add_c,
- &vp9_idct32x32_1_add_c,
- TX_32X32, 1),
- make_tuple(&vp9_idct16x16_256_add_c,
- &vp9_idct16x16_10_add_c,
- TX_16X16, 10),
- make_tuple(&vp9_idct16x16_256_add_c,
- &vp9_idct16x16_1_add_c,
- TX_16X16, 1),
- make_tuple(&vp9_idct8x8_64_add_c,
- &vp9_idct8x8_10_add_c,
- TX_8X8, 10),
- make_tuple(&vp9_idct8x8_64_add_c,
- &vp9_idct8x8_1_add_c,
- TX_8X8, 1),
- make_tuple(&vp9_idct4x4_16_add_c,
- &vp9_idct4x4_1_add_c,
- TX_4X4, 1)));
-#if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(
- NEON, PartialIDctTest,
- ::testing::Values(
- make_tuple(&vp9_idct32x32_1024_add_c,
- &vp9_idct32x32_1_add_neon,
- TX_32X32, 1),
- make_tuple(&vp9_idct16x16_256_add_c,
- &vp9_idct16x16_10_add_neon,
- TX_16X16, 10),
- make_tuple(&vp9_idct16x16_256_add_c,
- &vp9_idct16x16_1_add_neon,
- TX_16X16, 1),
- make_tuple(&vp9_idct8x8_64_add_c,
- &vp9_idct8x8_10_add_neon,
- TX_8X8, 10),
- make_tuple(&vp9_idct8x8_64_add_c,
- &vp9_idct8x8_1_add_neon,
- TX_8X8, 1),
- make_tuple(&vp9_idct4x4_16_add_c,
- &vp9_idct4x4_1_add_neon,
- TX_4X4, 1)));
-#endif
-
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(
- SSE2, PartialIDctTest,
- ::testing::Values(
- make_tuple(&vp9_idct32x32_1024_add_c,
- &vp9_idct32x32_34_add_sse2,
- TX_32X32, 34),
- make_tuple(&vp9_idct32x32_1024_add_c,
- &vp9_idct32x32_1_add_sse2,
- TX_32X32, 1),
- make_tuple(&vp9_idct16x16_256_add_c,
- &vp9_idct16x16_10_add_sse2,
- TX_16X16, 10),
- make_tuple(&vp9_idct16x16_256_add_c,
- &vp9_idct16x16_1_add_sse2,
- TX_16X16, 1),
- make_tuple(&vp9_idct8x8_64_add_c,
- &vp9_idct8x8_10_add_sse2,
- TX_8X8, 10),
- make_tuple(&vp9_idct8x8_64_add_c,
- &vp9_idct8x8_1_add_sse2,
- TX_8X8, 1),
- make_tuple(&vp9_idct4x4_16_add_c,
- &vp9_idct4x4_1_add_sse2,
- TX_4X4, 1)));
-#endif
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/pp_filter_test.cc b/videocodec/libvpx_internal/libvpx/test/pp_filter_test.cc
deleted file mode 100644
index 86c2b0e..0000000
--- a/videocodec/libvpx_internal/libvpx/test/pp_filter_test.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "./vpx_config.h"
-#include "./vp8_rtcd.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_mem/vpx_mem.h"
-
-typedef void (*post_proc_func_t)(unsigned char *src_ptr,
- unsigned char *dst_ptr,
- int src_pixels_per_line,
- int dst_pixels_per_line,
- int cols,
- unsigned char *flimit,
- int size);
-
-namespace {
-
-class VP8PostProcessingFilterTest
- : public ::testing::TestWithParam<post_proc_func_t> {
- public:
- virtual void TearDown() {
- libvpx_test::ClearSystemState();
- }
-};
-
-// Test routine for the VP8 post-processing function
-// vp8_post_proc_down_and_across_mb_row_c.
-
-TEST_P(VP8PostProcessingFilterTest, FilterOutputCheck) {
- // Size of the underlying data block that will be filtered.
- const int block_width = 16;
- const int block_height = 16;
-
- // 5-tap filter needs 2 padding rows above and below the block in the input.
- const int input_width = block_width;
- const int input_height = block_height + 4;
- const int input_stride = input_width;
- const int input_size = input_width * input_height;
-
- // Filter extends output block by 8 samples at left and right edges.
- const int output_width = block_width + 16;
- const int output_height = block_height;
- const int output_stride = output_width;
- const int output_size = output_width * output_height;
-
- uint8_t *const src_image =
- reinterpret_cast<uint8_t*>(vpx_calloc(input_size, 1));
- uint8_t *const dst_image =
- reinterpret_cast<uint8_t*>(vpx_calloc(output_size, 1));
-
- // Pointers to top-left pixel of block in the input and output images.
- uint8_t *const src_image_ptr = src_image + (input_stride << 1);
- uint8_t *const dst_image_ptr = dst_image + 8;
- uint8_t *const flimits =
- reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));
- (void)vpx_memset(flimits, 255, block_width);
-
- // Initialize pixels in the input:
- // block pixels to value 1,
- // border pixels to value 10.
- (void)vpx_memset(src_image, 10, input_size);
- uint8_t *pixel_ptr = src_image_ptr;
- for (int i = 0; i < block_height; ++i) {
- for (int j = 0; j < block_width; ++j) {
- pixel_ptr[j] = 1;
- }
- pixel_ptr += input_stride;
- }
-
- // Initialize pixels in the output to 99.
- (void)vpx_memset(dst_image, 99, output_size);
-
- REGISTER_STATE_CHECK(GetParam()(src_image_ptr, dst_image_ptr, input_stride,
- output_stride, block_width, flimits, 16));
-
- static const uint8_t expected_data[block_height] = {
- 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4
- };
-
- pixel_ptr = dst_image_ptr;
- for (int i = 0; i < block_height; ++i) {
- for (int j = 0; j < block_width; ++j) {
- EXPECT_EQ(expected_data[i], pixel_ptr[j])
- << "VP8PostProcessingFilterTest failed with invalid filter output";
- }
- pixel_ptr += output_stride;
- }
-
- vpx_free(src_image);
- vpx_free(dst_image);
- vpx_free(flimits);
-};
-
-INSTANTIATE_TEST_CASE_P(C, VP8PostProcessingFilterTest,
- ::testing::Values(vp8_post_proc_down_and_across_mb_row_c));
-
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(SSE2, VP8PostProcessingFilterTest,
- ::testing::Values(vp8_post_proc_down_and_across_mb_row_sse2));
-#endif
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/register_state_check.h b/videocodec/libvpx_internal/libvpx/test/register_state_check.h
deleted file mode 100644
index 7e3d053..0000000
--- a/videocodec/libvpx_internal/libvpx/test/register_state_check.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_REGISTER_STATE_CHECK_H_
-#define TEST_REGISTER_STATE_CHECK_H_
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "./vpx_config.h"
-
-#if defined(_WIN64)
-
-#define _WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winnt.h>
-
-namespace testing {
-namespace internal {
-
-inline bool operator==(const M128A& lhs, const M128A& rhs) {
- return (lhs.Low == rhs.Low && lhs.High == rhs.High);
-}
-
-} // namespace internal
-} // namespace testing
-
-namespace libvpx_test {
-
-// Compares the state of xmm[6-15] at construction with their state at
-// destruction. These registers should be preserved by the callee on
-// Windows x64.
-// Usage:
-// {
-// RegisterStateCheck reg_check;
-// FunctionToVerify();
-// }
-class RegisterStateCheck {
- public:
- RegisterStateCheck() { initialized_ = StoreRegisters(&pre_context_); }
- ~RegisterStateCheck() { EXPECT_TRUE(Check()); }
-
- private:
- static bool StoreRegisters(CONTEXT* const context) {
- const HANDLE this_thread = GetCurrentThread();
- EXPECT_TRUE(this_thread != NULL);
- context->ContextFlags = CONTEXT_FLOATING_POINT;
- const bool context_saved = GetThreadContext(this_thread, context) == TRUE;
- EXPECT_TRUE(context_saved) << "GetLastError: " << GetLastError();
- return context_saved;
- }
-
- // Compares the register state. Returns true if the states match.
- bool Check() const {
- if (!initialized_) return false;
- CONTEXT post_context;
- if (!StoreRegisters(&post_context)) return false;
-
- const M128A* xmm_pre = &pre_context_.Xmm6;
- const M128A* xmm_post = &post_context.Xmm6;
- for (int i = 6; i <= 15; ++i) {
- EXPECT_EQ(*xmm_pre, *xmm_post) << "xmm" << i << " has been modified!";
- ++xmm_pre;
- ++xmm_post;
- }
- return !testing::Test::HasNonfatalFailure();
- }
-
- bool initialized_;
- CONTEXT pre_context_;
-};
-
-#define REGISTER_STATE_CHECK(statement) do { \
- libvpx_test::RegisterStateCheck reg_check; \
- statement; \
-} while (false)
-
-} // namespace libvpx_test
-
-#elif defined(CONFIG_SHARED) && defined(HAVE_NEON) \
- && !CONFIG_SHARED && HAVE_NEON
-
-#include "vpx/vpx_integer.h"
-
-extern "C" {
-// Save the d8-d15 registers into store.
-void vp9_push_neon(int64_t *store);
-}
-
-namespace libvpx_test {
-
-// Compares the state of d8-d15 at construction with their state at
-// destruction. These registers should be preserved by the callee on
-// arm platform.
-// Usage:
-// {
-// RegisterStateCheck reg_check;
-// FunctionToVerify();
-// }
-class RegisterStateCheck {
- public:
- RegisterStateCheck() { initialized_ = StoreRegisters(pre_store_); }
- ~RegisterStateCheck() { EXPECT_TRUE(Check()); }
-
- private:
- static bool StoreRegisters(int64_t store[8]) {
- vp9_push_neon(store);
- return true;
- }
-
- // Compares the register state. Returns true if the states match.
- bool Check() const {
- if (!initialized_) return false;
- int64_t post_store[8];
- vp9_push_neon(post_store);
- for (int i = 0; i < 8; ++i) {
- EXPECT_EQ(pre_store_[i], post_store[i]) << "d"
- << i + 8 << " has been modified";
- }
- return !testing::Test::HasNonfatalFailure();
- }
-
- bool initialized_;
- int64_t pre_store_[8];
-};
-
-#define REGISTER_STATE_CHECK(statement) do { \
- libvpx_test::RegisterStateCheck reg_check; \
- statement; \
-} while (false)
-
-} // namespace libvpx_test
-
-#else
-
-namespace libvpx_test {
-
-class RegisterStateCheck {};
-#define REGISTER_STATE_CHECK(statement) statement
-
-} // namespace libvpx_test
-
-#endif // _WIN64
-
-#endif // TEST_REGISTER_STATE_CHECK_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/resize_test.cc b/videocodec/libvpx_internal/libvpx/test/resize_test.cc
deleted file mode 100644
index 8d08f1e..0000000
--- a/videocodec/libvpx_internal/libvpx/test/resize_test.cc
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <climits>
-#include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/video_source.h"
-#include "test/util.h"
-
-// Enable(1) or Disable(0) writing of the compressed bitstream.
-#define WRITE_COMPRESSED_STREAM 0
-
-namespace {
-
-#if WRITE_COMPRESSED_STREAM
-static void mem_put_le16(char *const mem, const unsigned int val) {
- mem[0] = val;
- mem[1] = val >> 8;
-}
-
-static void mem_put_le32(char *const mem, const unsigned int val) {
- mem[0] = val;
- mem[1] = val >> 8;
- mem[2] = val >> 16;
- mem[3] = val >> 24;
-}
-
-static void write_ivf_file_header(const vpx_codec_enc_cfg_t *const cfg,
- int frame_cnt, FILE *const outfile) {
- char header[32];
-
- header[0] = 'D';
- header[1] = 'K';
- header[2] = 'I';
- header[3] = 'F';
- mem_put_le16(header + 4, 0); /* version */
- mem_put_le16(header + 6, 32); /* headersize */
- mem_put_le32(header + 8, 0x30395056); /* fourcc (vp9) */
- mem_put_le16(header + 12, cfg->g_w); /* width */
- mem_put_le16(header + 14, cfg->g_h); /* height */
- mem_put_le32(header + 16, cfg->g_timebase.den); /* rate */
- mem_put_le32(header + 20, cfg->g_timebase.num); /* scale */
- mem_put_le32(header + 24, frame_cnt); /* length */
- mem_put_le32(header + 28, 0); /* unused */
-
- (void)fwrite(header, 1, 32, outfile);
-}
-
-static void write_ivf_frame_size(FILE *const outfile, const size_t size) {
- char header[4];
- mem_put_le32(header, static_cast<unsigned int>(size));
- (void)fwrite(header, 1, 4, outfile);
-}
-
-static void write_ivf_frame_header(const vpx_codec_cx_pkt_t *const pkt,
- FILE *const outfile) {
- char header[12];
- vpx_codec_pts_t pts;
-
- if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)
- return;
-
- pts = pkt->data.frame.pts;
- mem_put_le32(header, static_cast<unsigned int>(pkt->data.frame.sz));
- mem_put_le32(header + 4, pts & 0xFFFFFFFF);
- mem_put_le32(header + 8, pts >> 32);
-
- (void)fwrite(header, 1, 12, outfile);
-}
-#endif // WRITE_COMPRESSED_STREAM
-
-const unsigned int kInitialWidth = 320;
-const unsigned int kInitialHeight = 240;
-
-unsigned int ScaleForFrameNumber(unsigned int frame, unsigned int val) {
- if (frame < 10)
- return val;
- if (frame < 20)
- return val / 2;
- if (frame < 30)
- return val * 2 / 3;
- if (frame < 40)
- return val / 4;
- if (frame < 50)
- return val * 7 / 8;
- return val;
-}
-
-class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
- public:
- ResizingVideoSource() {
- SetSize(kInitialWidth, kInitialHeight);
- limit_ = 60;
- }
-
- virtual ~ResizingVideoSource() {}
-
- protected:
- virtual void Next() {
- ++frame_;
- SetSize(ScaleForFrameNumber(frame_, kInitialWidth),
- ScaleForFrameNumber(frame_, kInitialHeight));
- FillFrame();
- }
-};
-
-class ResizeTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- protected:
- ResizeTest() : EncoderTest(GET_PARAM(0)) {}
-
- virtual ~ResizeTest() {}
-
- struct FrameInfo {
- FrameInfo(vpx_codec_pts_t _pts, unsigned int _w, unsigned int _h)
- : pts(_pts), w(_w), h(_h) {}
-
- vpx_codec_pts_t pts;
- unsigned int w;
- unsigned int h;
- };
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- }
-
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- vpx_codec_pts_t pts) {
- frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
- }
-
- std::vector< FrameInfo > frame_info_list_;
-};
-
-TEST_P(ResizeTest, TestExternalResizeWorks) {
- ResizingVideoSource video;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
- info != frame_info_list_.end(); ++info) {
- const unsigned int frame = static_cast<unsigned>(info->pts);
- const unsigned int expected_w = ScaleForFrameNumber(frame, kInitialWidth);
- const unsigned int expected_h = ScaleForFrameNumber(frame, kInitialHeight);
-
- EXPECT_EQ(expected_w, info->w)
- << "Frame " << frame << "had unexpected width";
- EXPECT_EQ(expected_h, info->h)
- << "Frame " << frame << "had unexpected height";
- }
-}
-
-const unsigned int kStepDownFrame = 3;
-const unsigned int kStepUpFrame = 6;
-
-class ResizeInternalTest : public ResizeTest {
- protected:
-#if WRITE_COMPRESSED_STREAM
- ResizeInternalTest()
- : ResizeTest(),
- frame0_psnr_(0.0),
- outfile_(NULL),
- out_frames_(0) {}
-#else
- ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
-#endif
-
- virtual ~ResizeInternalTest() {}
-
- virtual void BeginPassHook(unsigned int /*pass*/) {
-#if WRITE_COMPRESSED_STREAM
- outfile_ = fopen("vp90-2-05-resize.ivf", "wb");
-#endif
- }
-
- virtual void EndPassHook() {
-#if WRITE_COMPRESSED_STREAM
- if (outfile_) {
- if (!fseek(outfile_, 0, SEEK_SET))
- write_ivf_file_header(&cfg_, out_frames_, outfile_);
- fclose(outfile_);
- outfile_ = NULL;
- }
-#endif
- }
-
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
- if (video->frame() == kStepDownFrame) {
- struct vpx_scaling_mode mode = {VP8E_FOURFIVE, VP8E_THREEFIVE};
- encoder->Control(VP8E_SET_SCALEMODE, &mode);
- }
- if (video->frame() == kStepUpFrame) {
- struct vpx_scaling_mode mode = {VP8E_NORMAL, VP8E_NORMAL};
- encoder->Control(VP8E_SET_SCALEMODE, &mode);
- }
- }
-
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
- if (!frame0_psnr_)
- frame0_psnr_ = pkt->data.psnr.psnr[0];
- EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
-#if WRITE_COMPRESSED_STREAM
- ++out_frames_;
-
- // Write initial file header if first frame.
- if (pkt->data.frame.pts == 0)
- write_ivf_file_header(&cfg_, 0, outfile_);
-
- // Write frame header and data.
- write_ivf_frame_header(pkt, outfile_);
- (void)fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_);
-#endif
- }
-
- double frame0_psnr_;
-#if WRITE_COMPRESSED_STREAM
- FILE *outfile_;
- unsigned int out_frames_;
-#endif
-};
-
-TEST_P(ResizeInternalTest, TestInternalResizeWorks) {
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 10);
- init_flags_ = VPX_CODEC_USE_PSNR;
-
- // q picked such that initial keyframe on this clip is ~30dB PSNR
- cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = 48;
-
- // If the number of frames being encoded is smaller than g_lag_in_frames
- // the encoded frame is unavailable using the current API. Comparing
- // frames to detect mismatch would then not be possible. Set
- // g_lag_in_frames = 0 to get around this.
- cfg_.g_lag_in_frames = 0;
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
- info != frame_info_list_.end(); ++info) {
- const vpx_codec_pts_t pts = info->pts;
- if (pts >= kStepDownFrame && pts < kStepUpFrame) {
- ASSERT_EQ(282U, info->w) << "Frame " << pts << " had unexpected width";
- ASSERT_EQ(173U, info->h) << "Frame " << pts << " had unexpected height";
- } else {
- EXPECT_EQ(352U, info->w) << "Frame " << pts << " had unexpected width";
- EXPECT_EQ(288U, info->h) << "Frame " << pts << " had unexpected height";
- }
- }
-}
-
-VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES);
-VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
- ::testing::Values(::libvpx_test::kOnePassBest));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/sad_test.cc b/videocodec/libvpx_internal/libvpx/test/sad_test.cc
deleted file mode 100644
index a692891..0000000
--- a/videocodec/libvpx_internal/libvpx/test/sad_test.cc
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <string.h>
-#include <limits.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#if CONFIG_VP8_ENCODER
-#include "./vp8_rtcd.h"
-#endif
-#if CONFIG_VP9_ENCODER
-#include "./vp9_rtcd.h"
-#endif
-#include "vpx_mem/vpx_mem.h"
-
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-
-typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr,
- int source_stride,
- const unsigned char *reference_ptr,
- int reference_stride,
- unsigned int max_sad);
-typedef std::tr1::tuple<int, int, sad_m_by_n_fn_t> sad_m_by_n_test_param_t;
-
-typedef void (*sad_n_by_n_by_4_fn_t)(const uint8_t *src_ptr,
- int src_stride,
- const unsigned char * const ref_ptr[],
- int ref_stride,
- unsigned int *sad_array);
-typedef std::tr1::tuple<int, int, sad_n_by_n_by_4_fn_t>
- sad_n_by_n_by_4_test_param_t;
-
-using libvpx_test::ACMRandom;
-
-namespace {
-class SADTestBase : public ::testing::Test {
- public:
- SADTestBase(int width, int height) : width_(width), height_(height) {}
-
- static void SetUpTestCase() {
- source_data_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kDataBlockSize));
- reference_data_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kDataBufferSize));
- }
-
- static void TearDownTestCase() {
- vpx_free(source_data_);
- source_data_ = NULL;
- vpx_free(reference_data_);
- reference_data_ = NULL;
- }
-
- virtual void TearDown() {
- libvpx_test::ClearSystemState();
- }
-
- protected:
- // Handle blocks up to 4 blocks 64x64 with stride up to 128
- static const int kDataAlignment = 16;
- static const int kDataBlockSize = 64 * 128;
- static const int kDataBufferSize = 4 * kDataBlockSize;
-
- virtual void SetUp() {
- source_stride_ = (width_ + 31) & ~31;
- reference_stride_ = width_ * 2;
- rnd_.Reset(ACMRandom::DeterministicSeed());
- }
-
- virtual uint8_t* GetReference(int block_idx) {
- return reference_data_ + block_idx * kDataBlockSize;
- }
-
- // Sum of Absolute Differences. Given two blocks, calculate the absolute
- // difference between two pixels in the same relative location; accumulate.
- unsigned int ReferenceSAD(unsigned int max_sad, int block_idx = 0) {
- unsigned int sad = 0;
- const uint8_t* const reference = GetReference(block_idx);
-
- for (int h = 0; h < height_; ++h) {
- for (int w = 0; w < width_; ++w) {
- sad += abs(source_data_[h * source_stride_ + w]
- - reference[h * reference_stride_ + w]);
- }
- if (sad > max_sad) {
- break;
- }
- }
- return sad;
- }
-
- void FillConstant(uint8_t *data, int stride, uint8_t fill_constant) {
- for (int h = 0; h < height_; ++h) {
- for (int w = 0; w < width_; ++w) {
- data[h * stride + w] = fill_constant;
- }
- }
- }
-
- void FillRandom(uint8_t *data, int stride) {
- for (int h = 0; h < height_; ++h) {
- for (int w = 0; w < width_; ++w) {
- data[h * stride + w] = rnd_.Rand8();
- }
- }
- }
-
- int width_, height_;
- static uint8_t* source_data_;
- int source_stride_;
- static uint8_t* reference_data_;
- int reference_stride_;
-
- ACMRandom rnd_;
-};
-
-class SADTest : public SADTestBase,
- public ::testing::WithParamInterface<sad_m_by_n_test_param_t> {
- public:
- SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
-
- protected:
- unsigned int SAD(unsigned int max_sad, int block_idx = 0) {
- unsigned int ret;
- const uint8_t* const reference = GetReference(block_idx);
-
- REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
- reference, reference_stride_,
- max_sad));
- return ret;
- }
-
- void CheckSad(unsigned int max_sad) {
- unsigned int reference_sad, exp_sad;
-
- reference_sad = ReferenceSAD(max_sad);
- exp_sad = SAD(max_sad);
-
- if (reference_sad <= max_sad) {
- ASSERT_EQ(exp_sad, reference_sad);
- } else {
- // Alternative implementations are not required to check max_sad
- ASSERT_GE(exp_sad, reference_sad);
- }
- }
-};
-
-class SADx4Test : public SADTestBase,
- public ::testing::WithParamInterface<sad_n_by_n_by_4_test_param_t> {
- public:
- SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
-
- protected:
- void SADs(unsigned int *results) {
- const uint8_t* refs[] = {GetReference(0), GetReference(1),
- GetReference(2), GetReference(3)};
-
- REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_,
- refs, reference_stride_,
- results));
- }
-
- void CheckSADs() {
- unsigned int reference_sad, exp_sad[4];
-
- SADs(exp_sad);
- for (int block = 0; block < 4; block++) {
- reference_sad = ReferenceSAD(UINT_MAX, block);
-
- EXPECT_EQ(exp_sad[block], reference_sad) << "block " << block;
- }
- }
-};
-
-uint8_t* SADTestBase::source_data_ = NULL;
-uint8_t* SADTestBase::reference_data_ = NULL;
-
-TEST_P(SADTest, MaxRef) {
- FillConstant(source_data_, source_stride_, 0);
- FillConstant(reference_data_, reference_stride_, 255);
- CheckSad(UINT_MAX);
-}
-
-TEST_P(SADx4Test, MaxRef) {
- FillConstant(source_data_, source_stride_, 0);
- FillConstant(GetReference(0), reference_stride_, 255);
- FillConstant(GetReference(1), reference_stride_, 255);
- FillConstant(GetReference(2), reference_stride_, 255);
- FillConstant(GetReference(3), reference_stride_, 255);
- CheckSADs();
-}
-
-TEST_P(SADTest, MaxSrc) {
- FillConstant(source_data_, source_stride_, 255);
- FillConstant(reference_data_, reference_stride_, 0);
- CheckSad(UINT_MAX);
-}
-
-TEST_P(SADx4Test, MaxSrc) {
- FillConstant(source_data_, source_stride_, 255);
- FillConstant(GetReference(0), reference_stride_, 0);
- FillConstant(GetReference(1), reference_stride_, 0);
- FillConstant(GetReference(2), reference_stride_, 0);
- FillConstant(GetReference(3), reference_stride_, 0);
- CheckSADs();
-}
-
-TEST_P(SADTest, ShortRef) {
- int tmp_stride = reference_stride_;
- reference_stride_ >>= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(reference_data_, reference_stride_);
- CheckSad(UINT_MAX);
- reference_stride_ = tmp_stride;
-}
-
-TEST_P(SADx4Test, ShortRef) {
- int tmp_stride = reference_stride_;
- reference_stride_ >>= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(GetReference(0), reference_stride_);
- FillRandom(GetReference(1), reference_stride_);
- FillRandom(GetReference(2), reference_stride_);
- FillRandom(GetReference(3), reference_stride_);
- CheckSADs();
- reference_stride_ = tmp_stride;
-}
-
-TEST_P(SADTest, UnalignedRef) {
- // The reference frame, but not the source frame, may be unaligned for
- // certain types of searches.
- int tmp_stride = reference_stride_;
- reference_stride_ -= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(reference_data_, reference_stride_);
- CheckSad(UINT_MAX);
- reference_stride_ = tmp_stride;
-}
-
-TEST_P(SADx4Test, UnalignedRef) {
- // The reference frame, but not the source frame, may be unaligned for
- // certain types of searches.
- int tmp_stride = reference_stride_;
- reference_stride_ -= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(GetReference(0), reference_stride_);
- FillRandom(GetReference(1), reference_stride_);
- FillRandom(GetReference(2), reference_stride_);
- FillRandom(GetReference(3), reference_stride_);
- CheckSADs();
- reference_stride_ = tmp_stride;
-}
-
-TEST_P(SADTest, ShortSrc) {
- int tmp_stride = source_stride_;
- source_stride_ >>= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(reference_data_, reference_stride_);
- CheckSad(UINT_MAX);
- source_stride_ = tmp_stride;
-}
-
-TEST_P(SADx4Test, ShortSrc) {
- int tmp_stride = source_stride_;
- source_stride_ >>= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(GetReference(0), reference_stride_);
- FillRandom(GetReference(1), reference_stride_);
- FillRandom(GetReference(2), reference_stride_);
- FillRandom(GetReference(3), reference_stride_);
- CheckSADs();
- source_stride_ = tmp_stride;
-}
-
-TEST_P(SADTest, MaxSAD) {
- // Verify that, when max_sad is set, the implementation does not return a
- // value lower than the reference.
- FillConstant(source_data_, source_stride_, 255);
- FillConstant(reference_data_, reference_stride_, 0);
- CheckSad(128);
-}
-
-using std::tr1::make_tuple;
-
-//------------------------------------------------------------------------------
-// C functions
-#if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_c = vp8_sad16x16_c;
-const sad_m_by_n_fn_t sad_8x16_c = vp8_sad8x16_c;
-const sad_m_by_n_fn_t sad_16x8_c = vp8_sad16x8_c;
-const sad_m_by_n_fn_t sad_8x8_c = vp8_sad8x8_c;
-const sad_m_by_n_fn_t sad_4x4_c = vp8_sad4x4_c;
-#endif
-#if CONFIG_VP9_ENCODER
-const sad_m_by_n_fn_t sad_64x64_c_vp9 = vp9_sad64x64_c;
-const sad_m_by_n_fn_t sad_32x32_c_vp9 = vp9_sad32x32_c;
-const sad_m_by_n_fn_t sad_16x16_c_vp9 = vp9_sad16x16_c;
-const sad_m_by_n_fn_t sad_8x16_c_vp9 = vp9_sad8x16_c;
-const sad_m_by_n_fn_t sad_16x8_c_vp9 = vp9_sad16x8_c;
-const sad_m_by_n_fn_t sad_8x8_c_vp9 = vp9_sad8x8_c;
-const sad_m_by_n_fn_t sad_8x4_c_vp9 = vp9_sad8x4_c;
-const sad_m_by_n_fn_t sad_4x8_c_vp9 = vp9_sad4x8_c;
-const sad_m_by_n_fn_t sad_4x4_c_vp9 = vp9_sad4x4_c;
-#endif
-const sad_m_by_n_test_param_t c_tests[] = {
-#if CONFIG_VP8_ENCODER
- make_tuple(16, 16, sad_16x16_c),
- make_tuple(8, 16, sad_8x16_c),
- make_tuple(16, 8, sad_16x8_c),
- make_tuple(8, 8, sad_8x8_c),
- make_tuple(4, 4, sad_4x4_c),
-#endif
-#if CONFIG_VP9_ENCODER
- make_tuple(64, 64, sad_64x64_c_vp9),
- make_tuple(32, 32, sad_32x32_c_vp9),
- make_tuple(16, 16, sad_16x16_c_vp9),
- make_tuple(8, 16, sad_8x16_c_vp9),
- make_tuple(16, 8, sad_16x8_c_vp9),
- make_tuple(8, 8, sad_8x8_c_vp9),
- make_tuple(8, 4, sad_8x4_c_vp9),
- make_tuple(4, 8, sad_4x8_c_vp9),
- make_tuple(4, 4, sad_4x4_c_vp9),
-#endif
-};
-INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
-
-#if CONFIG_VP9_ENCODER
-const sad_n_by_n_by_4_fn_t sad_64x64x4d_c = vp9_sad64x64x4d_c;
-const sad_n_by_n_by_4_fn_t sad_64x32x4d_c = vp9_sad64x32x4d_c;
-const sad_n_by_n_by_4_fn_t sad_32x64x4d_c = vp9_sad32x64x4d_c;
-const sad_n_by_n_by_4_fn_t sad_32x32x4d_c = vp9_sad32x32x4d_c;
-const sad_n_by_n_by_4_fn_t sad_32x16x4d_c = vp9_sad32x16x4d_c;
-const sad_n_by_n_by_4_fn_t sad_16x32x4d_c = vp9_sad16x32x4d_c;
-const sad_n_by_n_by_4_fn_t sad_16x16x4d_c = vp9_sad16x16x4d_c;
-const sad_n_by_n_by_4_fn_t sad_16x8x4d_c = vp9_sad16x8x4d_c;
-const sad_n_by_n_by_4_fn_t sad_8x16x4d_c = vp9_sad8x16x4d_c;
-const sad_n_by_n_by_4_fn_t sad_8x8x4d_c = vp9_sad8x8x4d_c;
-const sad_n_by_n_by_4_fn_t sad_8x4x4d_c = vp9_sad8x4x4d_c;
-const sad_n_by_n_by_4_fn_t sad_4x8x4d_c = vp9_sad4x8x4d_c;
-const sad_n_by_n_by_4_fn_t sad_4x4x4d_c = vp9_sad4x4x4d_c;
-INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::Values(
- make_tuple(64, 64, sad_64x64x4d_c),
- make_tuple(64, 32, sad_64x32x4d_c),
- make_tuple(32, 64, sad_32x64x4d_c),
- make_tuple(32, 32, sad_32x32x4d_c),
- make_tuple(32, 16, sad_32x16x4d_c),
- make_tuple(16, 32, sad_16x32x4d_c),
- make_tuple(16, 16, sad_16x16x4d_c),
- make_tuple(16, 8, sad_16x8x4d_c),
- make_tuple(8, 16, sad_8x16x4d_c),
- make_tuple(8, 8, sad_8x8x4d_c),
- make_tuple(8, 4, sad_8x4x4d_c),
- make_tuple(4, 8, sad_4x8x4d_c),
- make_tuple(4, 4, sad_4x4x4d_c)));
-#endif // CONFIG_VP9_ENCODER
-
-//------------------------------------------------------------------------------
-// ARM functions
-#if HAVE_MEDIA
-#if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_armv6 = vp8_sad16x16_armv6;
-INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::Values(
- make_tuple(16, 16, sad_16x16_armv6)));
-#endif
-#endif
-
-#if HAVE_NEON
-#if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_neon = vp8_sad16x16_neon;
-const sad_m_by_n_fn_t sad_8x16_neon = vp8_sad8x16_neon;
-const sad_m_by_n_fn_t sad_16x8_neon = vp8_sad16x8_neon;
-const sad_m_by_n_fn_t sad_8x8_neon = vp8_sad8x8_neon;
-const sad_m_by_n_fn_t sad_4x4_neon = vp8_sad4x4_neon;
-INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values(
- make_tuple(16, 16, sad_16x16_neon),
- make_tuple(8, 16, sad_8x16_neon),
- make_tuple(16, 8, sad_16x8_neon),
- make_tuple(8, 8, sad_8x8_neon),
- make_tuple(4, 4, sad_4x4_neon)));
-#endif
-#endif
-
-//------------------------------------------------------------------------------
-// x86 functions
-#if HAVE_MMX
-#if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_mmx = vp8_sad16x16_mmx;
-const sad_m_by_n_fn_t sad_8x16_mmx = vp8_sad8x16_mmx;
-const sad_m_by_n_fn_t sad_16x8_mmx = vp8_sad16x8_mmx;
-const sad_m_by_n_fn_t sad_8x8_mmx = vp8_sad8x8_mmx;
-const sad_m_by_n_fn_t sad_4x4_mmx = vp8_sad4x4_mmx;
-#endif
-#if CONFIG_VP9_ENCODER
-const sad_m_by_n_fn_t sad_16x16_mmx_vp9 = vp9_sad16x16_mmx;
-const sad_m_by_n_fn_t sad_8x16_mmx_vp9 = vp9_sad8x16_mmx;
-const sad_m_by_n_fn_t sad_16x8_mmx_vp9 = vp9_sad16x8_mmx;
-const sad_m_by_n_fn_t sad_8x8_mmx_vp9 = vp9_sad8x8_mmx;
-const sad_m_by_n_fn_t sad_4x4_mmx_vp9 = vp9_sad4x4_mmx;
-#endif
-
-const sad_m_by_n_test_param_t mmx_tests[] = {
-#if CONFIG_VP8_ENCODER
- make_tuple(16, 16, sad_16x16_mmx),
- make_tuple(8, 16, sad_8x16_mmx),
- make_tuple(16, 8, sad_16x8_mmx),
- make_tuple(8, 8, sad_8x8_mmx),
- make_tuple(4, 4, sad_4x4_mmx),
-#endif
-#if CONFIG_VP9_ENCODER
- make_tuple(16, 16, sad_16x16_mmx_vp9),
- make_tuple(8, 16, sad_8x16_mmx_vp9),
- make_tuple(16, 8, sad_16x8_mmx_vp9),
- make_tuple(8, 8, sad_8x8_mmx_vp9),
- make_tuple(4, 4, sad_4x4_mmx_vp9),
-#endif
-};
-INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::ValuesIn(mmx_tests));
-#endif
-
-#if HAVE_SSE
-#if CONFIG_VP9_ENCODER
-#if CONFIG_USE_X86INC
-const sad_m_by_n_fn_t sad_4x4_sse_vp9 = vp9_sad4x4_sse;
-const sad_m_by_n_fn_t sad_4x8_sse_vp9 = vp9_sad4x8_sse;
-INSTANTIATE_TEST_CASE_P(SSE, SADTest, ::testing::Values(
- make_tuple(4, 4, sad_4x4_sse_vp9),
- make_tuple(4, 8, sad_4x8_sse_vp9)));
-
-const sad_n_by_n_by_4_fn_t sad_4x8x4d_sse = vp9_sad4x8x4d_sse;
-const sad_n_by_n_by_4_fn_t sad_4x4x4d_sse = vp9_sad4x4x4d_sse;
-INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::Values(
- make_tuple(4, 8, sad_4x8x4d_sse),
- make_tuple(4, 4, sad_4x4x4d_sse)));
-#endif // CONFIG_USE_X86INC
-#endif // CONFIG_VP9_ENCODER
-#endif // HAVE_SSE
-
-#if HAVE_SSE2
-#if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_wmt = vp8_sad16x16_wmt;
-const sad_m_by_n_fn_t sad_8x16_wmt = vp8_sad8x16_wmt;
-const sad_m_by_n_fn_t sad_16x8_wmt = vp8_sad16x8_wmt;
-const sad_m_by_n_fn_t sad_8x8_wmt = vp8_sad8x8_wmt;
-const sad_m_by_n_fn_t sad_4x4_wmt = vp8_sad4x4_wmt;
-#endif
-#if CONFIG_VP9_ENCODER
-#if CONFIG_USE_X86INC
-const sad_m_by_n_fn_t sad_64x64_sse2_vp9 = vp9_sad64x64_sse2;
-const sad_m_by_n_fn_t sad_64x32_sse2_vp9 = vp9_sad64x32_sse2;
-const sad_m_by_n_fn_t sad_32x64_sse2_vp9 = vp9_sad32x64_sse2;
-const sad_m_by_n_fn_t sad_32x32_sse2_vp9 = vp9_sad32x32_sse2;
-const sad_m_by_n_fn_t sad_32x16_sse2_vp9 = vp9_sad32x16_sse2;
-const sad_m_by_n_fn_t sad_16x32_sse2_vp9 = vp9_sad16x32_sse2;
-const sad_m_by_n_fn_t sad_16x16_sse2_vp9 = vp9_sad16x16_sse2;
-const sad_m_by_n_fn_t sad_16x8_sse2_vp9 = vp9_sad16x8_sse2;
-const sad_m_by_n_fn_t sad_8x16_sse2_vp9 = vp9_sad8x16_sse2;
-const sad_m_by_n_fn_t sad_8x8_sse2_vp9 = vp9_sad8x8_sse2;
-const sad_m_by_n_fn_t sad_8x4_sse2_vp9 = vp9_sad8x4_sse2;
-#endif
-#endif
-const sad_m_by_n_test_param_t sse2_tests[] = {
-#if CONFIG_VP8_ENCODER
- make_tuple(16, 16, sad_16x16_wmt),
- make_tuple(8, 16, sad_8x16_wmt),
- make_tuple(16, 8, sad_16x8_wmt),
- make_tuple(8, 8, sad_8x8_wmt),
- make_tuple(4, 4, sad_4x4_wmt),
-#endif
-#if CONFIG_VP9_ENCODER
-#if CONFIG_USE_X86INC
- make_tuple(64, 64, sad_64x64_sse2_vp9),
- make_tuple(64, 32, sad_64x32_sse2_vp9),
- make_tuple(32, 64, sad_32x64_sse2_vp9),
- make_tuple(32, 32, sad_32x32_sse2_vp9),
- make_tuple(32, 16, sad_32x16_sse2_vp9),
- make_tuple(16, 32, sad_16x32_sse2_vp9),
- make_tuple(16, 16, sad_16x16_sse2_vp9),
- make_tuple(16, 8, sad_16x8_sse2_vp9),
- make_tuple(8, 16, sad_8x16_sse2_vp9),
- make_tuple(8, 8, sad_8x8_sse2_vp9),
- make_tuple(8, 4, sad_8x4_sse2_vp9),
-#endif
-#endif
-};
-INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
-
-#if CONFIG_VP9_ENCODER
-#if CONFIG_USE_X86INC
-const sad_n_by_n_by_4_fn_t sad_64x64x4d_sse2 = vp9_sad64x64x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_64x32x4d_sse2 = vp9_sad64x32x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_32x64x4d_sse2 = vp9_sad32x64x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_32x32x4d_sse2 = vp9_sad32x32x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_32x16x4d_sse2 = vp9_sad32x16x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_16x32x4d_sse2 = vp9_sad16x32x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_16x16x4d_sse2 = vp9_sad16x16x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_16x8x4d_sse2 = vp9_sad16x8x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_8x16x4d_sse2 = vp9_sad8x16x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_8x8x4d_sse2 = vp9_sad8x8x4d_sse2;
-const sad_n_by_n_by_4_fn_t sad_8x4x4d_sse2 = vp9_sad8x4x4d_sse2;
-INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::Values(
- make_tuple(64, 64, sad_64x64x4d_sse2),
- make_tuple(64, 32, sad_64x32x4d_sse2),
- make_tuple(32, 64, sad_32x64x4d_sse2),
- make_tuple(32, 32, sad_32x32x4d_sse2),
- make_tuple(32, 16, sad_32x16x4d_sse2),
- make_tuple(16, 32, sad_16x32x4d_sse2),
- make_tuple(16, 16, sad_16x16x4d_sse2),
- make_tuple(16, 8, sad_16x8x4d_sse2),
- make_tuple(8, 16, sad_8x16x4d_sse2),
- make_tuple(8, 8, sad_8x8x4d_sse2),
- make_tuple(8, 4, sad_8x4x4d_sse2)));
-#endif
-#endif
-#endif
-
-#if HAVE_SSE3
-#if CONFIG_VP8_ENCODER
-const sad_n_by_n_by_4_fn_t sad_16x16x4d_sse3 = vp8_sad16x16x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_16x8x4d_sse3 = vp8_sad16x8x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_8x16x4d_sse3 = vp8_sad8x16x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_8x8x4d_sse3 = vp8_sad8x8x4d_sse3;
-const sad_n_by_n_by_4_fn_t sad_4x4x4d_sse3 = vp8_sad4x4x4d_sse3;
-INSTANTIATE_TEST_CASE_P(SSE3, SADx4Test, ::testing::Values(
- make_tuple(16, 16, sad_16x16x4d_sse3),
- make_tuple(16, 8, sad_16x8x4d_sse3),
- make_tuple(8, 16, sad_8x16x4d_sse3),
- make_tuple(8, 8, sad_8x8x4d_sse3),
- make_tuple(4, 4, sad_4x4x4d_sse3)));
-#endif
-#endif
-
-#if HAVE_SSSE3
-#if CONFIG_USE_X86INC
-#if CONFIG_VP8_ENCODER
-const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3;
-INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
- make_tuple(16, 16, sad_16x16_sse3)));
-#endif
-#endif
-#endif
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/set_roi.cc b/videocodec/libvpx_internal/libvpx/test/set_roi.cc
deleted file mode 100644
index 5b054f4..0000000
--- a/videocodec/libvpx_internal/libvpx/test/set_roi.cc
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "vp8/encoder/onyx_int.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_mem/vpx_mem.h"
-
-using libvpx_test::ACMRandom;
-
-namespace {
-
-TEST(VP8RoiMapTest, ParameterCheck) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
- int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
- unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
-
- const int internalq_trans[] = {
- 0, 1, 2, 3, 4, 5, 7, 8,
- 9, 10, 12, 13, 15, 17, 18, 19,
- 20, 21, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 33, 35, 37, 39, 41,
- 43, 45, 47, 49, 51, 53, 55, 57,
- 59, 61, 64, 67, 70, 73, 76, 79,
- 82, 85, 88, 91, 94, 97, 100, 103,
- 106, 109, 112, 115, 118, 121, 124, 127,
- };
-
- // Initialize elements of cpi with valid defaults.
- VP8_COMP cpi;
- cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA;
- cpi.cyclic_refresh_mode_enabled = 0;
- cpi.mb.e_mbd.segmentation_enabled = 0;
- cpi.mb.e_mbd.update_mb_segmentation_map = 0;
- cpi.mb.e_mbd.update_mb_segmentation_data = 0;
- cpi.common.mb_rows = 240 >> 4;
- cpi.common.mb_cols = 320 >> 4;
- const int mbs = (cpi.common.mb_rows * cpi.common.mb_cols);
- vpx_memset(cpi.segment_feature_data, 0, sizeof(cpi.segment_feature_data));
-
- // Segment map
- cpi.segmentation_map = reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
-
- // Allocate memory for the source memory map.
- unsigned char *roi_map =
- reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
- vpx_memset(&roi_map[mbs >> 2], 1, (mbs >> 2));
- vpx_memset(&roi_map[mbs >> 1], 2, (mbs >> 2));
- vpx_memset(&roi_map[mbs -(mbs >> 2)], 3, (mbs >> 2));
-
- // Do a test call with valid parameters.
- int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
- cpi.common.mb_cols, delta_q, delta_lf,
- threshold);
- EXPECT_EQ(0, roi_retval)
- << "vp8_set_roimap roi failed with default test parameters";
-
- // Check that the values in the cpi structure get set as expected.
- if (roi_retval == 0) {
- // Check that the segment map got set.
- const int mapcompare = memcmp(roi_map, cpi.segmentation_map, mbs);
- EXPECT_EQ(0, mapcompare) << "segment map error";
-
- // Check the q deltas (note the need to translate into
- // the interanl range of 0-127.
- for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
- const int transq = internalq_trans[abs(delta_q[i])];
- if (abs(cpi.segment_feature_data[MB_LVL_ALT_Q][i]) != transq) {
- EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])
- << "segment delta_q error";
- break;
- }
- }
-
- // Check the loop filter deltas
- for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
- if (cpi.segment_feature_data[MB_LVL_ALT_LF][i] != delta_lf[i]) {
- EXPECT_EQ(delta_lf[i], cpi.segment_feature_data[MB_LVL_ALT_LF][i])
- << "segment delta_lf error";
- break;
- }
- }
-
- // Check the breakout thresholds
- for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
- unsigned int breakout =
- static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
-
- if (threshold[i] != breakout) {
- EXPECT_EQ(threshold[i], breakout)
- << "breakout threshold error";
- break;
- }
- }
-
- // Segmentation, and segmentation update flages should be set.
- EXPECT_EQ(1, cpi.mb.e_mbd.segmentation_enabled)
- << "segmentation_enabled error";
- EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_map)
- << "update_mb_segmentation_map error";
- EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data)
- << "update_mb_segmentation_data error";
-
-
- // Try a range of delta q and lf parameters (some legal, some not)
- for (int i = 0; i < 1000; ++i) {
- int rand_deltas[4];
- int deltas_valid;
- rand_deltas[0] = rnd(160) - 80;
- rand_deltas[1] = rnd(160) - 80;
- rand_deltas[2] = rnd(160) - 80;
- rand_deltas[3] = rnd(160) - 80;
-
- deltas_valid = ((abs(rand_deltas[0]) <= 63) &&
- (abs(rand_deltas[1]) <= 63) &&
- (abs(rand_deltas[2]) <= 63) &&
- (abs(rand_deltas[3]) <= 63)) ? 0 : -1;
-
- // Test with random delta q values.
- roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
- cpi.common.mb_cols, rand_deltas,
- delta_lf, threshold);
- EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";
-
- // One delta_q error shown at a time
- if (deltas_valid != roi_retval)
- break;
-
- // Test with random loop filter values.
- roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
- cpi.common.mb_cols, delta_q,
- rand_deltas, threshold);
- EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";
-
- // One delta loop filter error shown at a time
- if (deltas_valid != roi_retval)
- break;
- }
-
- // Test that we report and error if cyclic refresh is enabled.
- cpi.cyclic_refresh_mode_enabled = 1;
- roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
- cpi.common.mb_cols, delta_q,
- delta_lf, threshold);
- EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";
- cpi.cyclic_refresh_mode_enabled = 0;
-
- // Test invalid number of rows or colums.
- roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
- cpi.common.mb_cols, delta_q,
- delta_lf, threshold);
- EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";
-
- roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
- cpi.common.mb_cols - 1, delta_q,
- delta_lf, threshold);
- EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";
- }
-
- // Free allocated memory
- if (cpi.segmentation_map)
- vpx_free(cpi.segmentation_map);
- if (roi_map)
- vpx_free(roi_map);
-};
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/sixtap_predict_test.cc b/videocodec/libvpx_internal/libvpx/test/sixtap_predict_test.cc
deleted file mode 100644
index 0c600f4..0000000
--- a/videocodec/libvpx_internal/libvpx/test/sixtap_predict_test.cc
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "./vpx_config.h"
-#include "./vp8_rtcd.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_mem/vpx_mem.h"
-
-namespace {
-
-typedef void (*sixtap_predict_fn_t)(uint8_t *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- uint8_t *dst_ptr,
- int dst_pitch);
-
-typedef std::tr1::tuple<int, int, sixtap_predict_fn_t> sixtap_predict_param_t;
-
-class SixtapPredictTest
- : public ::testing::TestWithParam<sixtap_predict_param_t> {
- public:
- static void SetUpTestCase() {
- src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize));
- dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
- dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
- }
-
- static void TearDownTestCase() {
- vpx_free(src_);
- src_ = NULL;
- vpx_free(dst_);
- dst_ = NULL;
- vpx_free(dst_c_);
- dst_c_ = NULL;
- }
-
- virtual void TearDown() {
- libvpx_test::ClearSystemState();
- }
-
- protected:
- // Make test arrays big enough for 16x16 functions. Six-tap filters
- // need 5 extra pixels outside of the macroblock.
- static const int kSrcStride = 21;
- static const int kDstStride = 16;
- static const int kDataAlignment = 16;
- static const int kSrcSize = kSrcStride * kSrcStride + 1;
- static const int kDstSize = kDstStride * kDstStride;
-
- virtual void SetUp() {
- width_ = GET_PARAM(0);
- height_ = GET_PARAM(1);
- sixtap_predict_ = GET_PARAM(2);
- memset(src_, 0, kSrcSize);
- memset(dst_, 0, kDstSize);
- memset(dst_c_, 0, kDstSize);
- }
-
- int width_;
- int height_;
- sixtap_predict_fn_t sixtap_predict_;
- // The src stores the macroblock we will filter on, and makes it 1 byte larger
- // in order to test unaligned access. The result is stored in dst and dst_c(c
- // reference code result).
- static uint8_t* src_;
- static uint8_t* dst_;
- static uint8_t* dst_c_;
-};
-
-uint8_t* SixtapPredictTest::src_ = NULL;
-uint8_t* SixtapPredictTest::dst_ = NULL;
-uint8_t* SixtapPredictTest::dst_c_ = NULL;
-
-TEST_P(SixtapPredictTest, TestWithPresetData) {
- // Test input
- static const uint8_t test_data[kSrcSize] = {
- 216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42, 226, 177,
- 79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192, 44, 233, 120,
- 48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110, 102, 171, 32,
- 182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14, 3, 99, 247, 124,
- 148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239, 58, 83, 155, 91, 10,
- 166, 201, 115, 124, 5, 163, 104, 2, 231, 160, 16, 234, 4, 8, 103, 153,
- 167, 174, 187, 26, 193, 109, 64, 141, 90, 48, 200, 174, 204, 36, 184,
- 114, 237, 43, 238, 242, 207, 86, 245, 182, 247, 6, 161, 251, 14, 8, 148,
- 182, 182, 79, 208, 120, 188, 17, 6, 23, 65, 206, 197, 13, 242, 126, 128,
- 224, 170, 110, 211, 121, 197, 200, 47, 188, 207, 208, 184, 221, 216, 76,
- 148, 143, 156, 100, 8, 89, 117, 14, 112, 183, 221, 54, 197, 208, 180, 69,
- 176, 94, 180, 131, 215, 121, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142,
- 64, 215, 242, 72, 49, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181,
- 235, 224, 57, 195, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42,
- 148, 145, 29, 221, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184,
- 35, 181, 153, 93, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77,
- 209, 76, 106, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221,
- 223, 47, 118, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170,
- 24, 226, 247, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13,
- 93, 209, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69,
- 49, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
- 135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5, 36,
- 119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83, 109, 35,
- 93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204, 101, 77, 67, 52,
- 53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125, 179, 115, 161, 17, 83,
- 198, 101, 98, 85, 139, 3, 137, 75, 99, 178, 23, 201, 255, 91, 253, 52,
- 134, 60, 138, 131, 208, 251, 101, 48, 2, 227, 228, 118, 132, 245, 202,
- 75, 91, 44, 160, 231, 47, 41, 50, 147, 220, 74, 92, 219, 165, 89, 16
- };
-
- // Expected result
- static const uint8_t expected_dst[kDstSize] = {
- 117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39, 49, 38,
- 105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85, 177, 164, 79,
- 208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91, 154, 102, 102,
- 159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224, 186, 36, 231,
- 208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73, 201, 78, 149, 184,
- 100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120, 129, 49, 25, 133,
- 113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140, 78, 6, 55, 65, 240,
- 255, 245, 184, 72, 90, 100, 116, 131, 39, 60, 234, 167, 33, 160, 88, 185,
- 200, 157, 159, 176, 127, 151, 138, 102, 168, 106, 170, 86, 82, 219, 189,
- 76, 33, 115, 197, 106, 96, 198, 136, 97, 141, 237, 151, 98, 137, 191,
- 185, 2, 57, 95, 142, 91, 255, 185, 97, 137, 76, 162, 94, 173, 131, 193,
- 161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95,
- 15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196,
- 84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166,
- 189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180,
- 224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75,
- 136, 85, 189, 46, 71, 200, 90
- };
-
- uint8_t *src = const_cast<uint8_t*>(test_data);
-
- REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride,
- 2, 2, dst_, kDstStride));
-
- for (int i = 0; i < height_; ++i)
- for (int j = 0; j < width_; ++j)
- ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j])
- << "i==" << (i * width_ + j);
-}
-
-using libvpx_test::ACMRandom;
-
-TEST_P(SixtapPredictTest, TestWithRandomData) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- for (int i = 0; i < kSrcSize; ++i)
- src_[i] = rnd.Rand8();
-
- // Run tests for all possible offsets.
- for (int xoffset = 0; xoffset < 8; ++xoffset) {
- for (int yoffset = 0; yoffset < 8; ++yoffset) {
- // Call c reference function.
- // Move start point to next pixel to test if the function reads
- // unaligned data correctly.
- vp8_sixtap_predict16x16_c(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
- xoffset, yoffset, dst_c_, kDstStride);
-
- // Run test.
- REGISTER_STATE_CHECK(
- sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
- xoffset, yoffset, dst_, kDstStride));
-
- for (int i = 0; i < height_; ++i)
- for (int j = 0; j < width_; ++j)
- ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j])
- << "i==" << (i * width_ + j);
- }
- }
-}
-
-using std::tr1::make_tuple;
-
-const sixtap_predict_fn_t sixtap_16x16_c = vp8_sixtap_predict16x16_c;
-const sixtap_predict_fn_t sixtap_8x8_c = vp8_sixtap_predict8x8_c;
-const sixtap_predict_fn_t sixtap_8x4_c = vp8_sixtap_predict8x4_c;
-const sixtap_predict_fn_t sixtap_4x4_c = vp8_sixtap_predict4x4_c;
-INSTANTIATE_TEST_CASE_P(
- C, SixtapPredictTest, ::testing::Values(
- make_tuple(16, 16, sixtap_16x16_c),
- make_tuple(8, 8, sixtap_8x8_c),
- make_tuple(8, 4, sixtap_8x4_c),
- make_tuple(4, 4, sixtap_4x4_c)));
-#if HAVE_NEON
-const sixtap_predict_fn_t sixtap_16x16_neon = vp8_sixtap_predict16x16_neon;
-const sixtap_predict_fn_t sixtap_8x8_neon = vp8_sixtap_predict8x8_neon;
-const sixtap_predict_fn_t sixtap_8x4_neon = vp8_sixtap_predict8x4_neon;
-INSTANTIATE_TEST_CASE_P(
- DISABLED_NEON, SixtapPredictTest, ::testing::Values(
- make_tuple(16, 16, sixtap_16x16_neon),
- make_tuple(8, 8, sixtap_8x8_neon),
- make_tuple(8, 4, sixtap_8x4_neon)));
-#endif
-#if HAVE_MMX
-const sixtap_predict_fn_t sixtap_16x16_mmx = vp8_sixtap_predict16x16_mmx;
-const sixtap_predict_fn_t sixtap_8x8_mmx = vp8_sixtap_predict8x8_mmx;
-const sixtap_predict_fn_t sixtap_8x4_mmx = vp8_sixtap_predict8x4_mmx;
-const sixtap_predict_fn_t sixtap_4x4_mmx = vp8_sixtap_predict4x4_mmx;
-INSTANTIATE_TEST_CASE_P(
- MMX, SixtapPredictTest, ::testing::Values(
- make_tuple(16, 16, sixtap_16x16_mmx),
- make_tuple(8, 8, sixtap_8x8_mmx),
- make_tuple(8, 4, sixtap_8x4_mmx),
- make_tuple(4, 4, sixtap_4x4_mmx)));
-#endif
-#if HAVE_SSE2
-const sixtap_predict_fn_t sixtap_16x16_sse2 = vp8_sixtap_predict16x16_sse2;
-const sixtap_predict_fn_t sixtap_8x8_sse2 = vp8_sixtap_predict8x8_sse2;
-const sixtap_predict_fn_t sixtap_8x4_sse2 = vp8_sixtap_predict8x4_sse2;
-INSTANTIATE_TEST_CASE_P(
- SSE2, SixtapPredictTest, ::testing::Values(
- make_tuple(16, 16, sixtap_16x16_sse2),
- make_tuple(8, 8, sixtap_8x8_sse2),
- make_tuple(8, 4, sixtap_8x4_sse2)));
-#endif
-#if HAVE_SSSE3
-const sixtap_predict_fn_t sixtap_16x16_ssse3 = vp8_sixtap_predict16x16_ssse3;
-const sixtap_predict_fn_t sixtap_8x8_ssse3 = vp8_sixtap_predict8x8_ssse3;
-const sixtap_predict_fn_t sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3;
-const sixtap_predict_fn_t sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3;
-INSTANTIATE_TEST_CASE_P(
- SSSE3, SixtapPredictTest, ::testing::Values(
- make_tuple(16, 16, sixtap_16x16_ssse3),
- make_tuple(8, 8, sixtap_8x8_ssse3),
- make_tuple(8, 4, sixtap_8x4_ssse3),
- make_tuple(4, 4, sixtap_4x4_ssse3)));
-#endif
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/subtract_test.cc b/videocodec/libvpx_internal/libvpx/test/subtract_test.cc
deleted file mode 100644
index 3efb955..0000000
--- a/videocodec/libvpx_internal/libvpx/test/subtract_test.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "./vpx_config.h"
-#include "./vp8_rtcd.h"
-#include "vp8/common/blockd.h"
-#include "vp8/encoder/block.h"
-#include "vpx_mem/vpx_mem.h"
-
-typedef void (*subtract_b_fn_t)(BLOCK *be, BLOCKD *bd, int pitch);
-
-namespace {
-
-class SubtractBlockTest : public ::testing::TestWithParam<subtract_b_fn_t> {
- public:
- virtual void TearDown() {
- libvpx_test::ClearSystemState();
- }
-};
-
-using libvpx_test::ACMRandom;
-
-TEST_P(SubtractBlockTest, SimpleSubtract) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- BLOCK be;
- BLOCKD bd;
- // in libvpx, this stride is always 16
- const int kDiffPredStride = 16;
- const int kSrcStride[] = {32, 16, 8, 4, 0};
- const int kBlockWidth = 4;
- const int kBlockHeight = 4;
-
- // Allocate... align to 16 for mmx/sse tests
- uint8_t *source = reinterpret_cast<uint8_t*>(
- vpx_memalign(16, kBlockHeight * kSrcStride[0] * sizeof(*source)));
- be.src_diff = reinterpret_cast<int16_t*>(
- vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*be.src_diff)));
- bd.predictor = reinterpret_cast<unsigned char*>(
- vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*bd.predictor)));
-
- for (int i = 0; kSrcStride[i] > 0; ++i) {
- // start at block0
- be.src = 0;
- be.base_src = &source;
- be.src_stride = kSrcStride[i];
-
- // set difference
- int16_t *src_diff = be.src_diff;
- for (int r = 0; r < kBlockHeight; ++r) {
- for (int c = 0; c < kBlockWidth; ++c) {
- src_diff[c] = static_cast<int16_t>(0xa5a5u);
- }
- src_diff += kDiffPredStride;
- }
-
- // set destination
- uint8_t *base_src = *be.base_src;
- for (int r = 0; r < kBlockHeight; ++r) {
- for (int c = 0; c < kBlockWidth; ++c) {
- base_src[c] = rnd.Rand8();
- }
- base_src += be.src_stride;
- }
-
- // set predictor
- uint8_t *predictor = bd.predictor;
- for (int r = 0; r < kBlockHeight; ++r) {
- for (int c = 0; c < kBlockWidth; ++c) {
- predictor[c] = rnd.Rand8();
- }
- predictor += kDiffPredStride;
- }
-
- REGISTER_STATE_CHECK(GetParam()(&be, &bd, kDiffPredStride));
-
- base_src = *be.base_src;
- src_diff = be.src_diff;
- predictor = bd.predictor;
- for (int r = 0; r < kBlockHeight; ++r) {
- for (int c = 0; c < kBlockWidth; ++c) {
- EXPECT_EQ(base_src[c], (src_diff[c] + predictor[c])) << "r = " << r
- << ", c = " << c;
- }
- src_diff += kDiffPredStride;
- predictor += kDiffPredStride;
- base_src += be.src_stride;
- }
- }
- vpx_free(be.src_diff);
- vpx_free(source);
- vpx_free(bd.predictor);
-}
-
-INSTANTIATE_TEST_CASE_P(C, SubtractBlockTest,
- ::testing::Values(vp8_subtract_b_c));
-
-#if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(NEON, SubtractBlockTest,
- ::testing::Values(vp8_subtract_b_neon));
-#endif
-
-#if HAVE_MMX
-INSTANTIATE_TEST_CASE_P(MMX, SubtractBlockTest,
- ::testing::Values(vp8_subtract_b_mmx));
-#endif
-
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(SSE2, SubtractBlockTest,
- ::testing::Values(vp8_subtract_b_sse2));
-#endif
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/superframe_test.cc b/videocodec/libvpx_internal/libvpx/test/superframe_test.cc
deleted file mode 100644
index c0f542d..0000000
--- a/videocodec/libvpx_internal/libvpx/test/superframe_test.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <climits>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-
-namespace {
-
-class SuperframeTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- protected:
- SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL),
- last_sf_pts_(0) {}
- virtual ~SuperframeTest() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(GET_PARAM(1));
- sf_count_ = 0;
- sf_count_max_ = INT_MAX;
- }
-
- virtual void TearDown() {
- delete[] modified_buf_;
- }
-
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
- }
- }
-
- virtual const vpx_codec_cx_pkt_t * MutateEncoderOutputHook(
- const vpx_codec_cx_pkt_t *pkt) {
- if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)
- return pkt;
-
- const uint8_t *buffer = reinterpret_cast<uint8_t*>(pkt->data.frame.buf);
- const uint8_t marker = buffer[pkt->data.frame.sz - 1];
- const int frames = (marker & 0x7) + 1;
- const int mag = ((marker >> 3) & 3) + 1;
- const unsigned int index_sz = 2 + mag * frames;
- if ((marker & 0xe0) == 0xc0 &&
- pkt->data.frame.sz >= index_sz &&
- buffer[pkt->data.frame.sz - index_sz] == marker) {
- // frame is a superframe. strip off the index.
- if (modified_buf_)
- delete[] modified_buf_;
- modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz];
- memcpy(modified_buf_, pkt->data.frame.buf,
- pkt->data.frame.sz - index_sz);
- modified_pkt_ = *pkt;
- modified_pkt_.data.frame.buf = modified_buf_;
- modified_pkt_.data.frame.sz -= index_sz;
-
- sf_count_++;
- last_sf_pts_ = pkt->data.frame.pts;
- return &modified_pkt_;
- }
-
- // Make sure we do a few frames after the last SF
- abort_ |= sf_count_ > sf_count_max_ &&
- pkt->data.frame.pts - last_sf_pts_ >= 5;
- return pkt;
- }
-
- int sf_count_;
- int sf_count_max_;
- vpx_codec_cx_pkt_t modified_pkt_;
- uint8_t *modified_buf_;
- vpx_codec_pts_t last_sf_pts_;
-};
-
-TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
- sf_count_max_ = 0; // early exit on successful test.
- cfg_.g_lag_in_frames = 25;
-
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- 30, 1, 0, 40);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- EXPECT_EQ(sf_count_, 1);
-}
-
-VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Values(
- ::libvpx_test::kTwoPassGood));
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/svc_test.cc b/videocodec/libvpx_internal/libvpx/test/svc_test.cc
deleted file mode 100644
index fb9277b..0000000
--- a/videocodec/libvpx_internal/libvpx/test/svc_test.cc
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <string>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/decode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "vpx/svc_context.h"
-#include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
-
-namespace {
-
-using libvpx_test::CodecFactory;
-using libvpx_test::Decoder;
-using libvpx_test::VP9CodecFactory;
-
-class SvcTest : public ::testing::Test {
- protected:
- static const uint32_t kWidth = 352;
- static const uint32_t kHeight = 288;
-
- SvcTest()
- : codec_iface_(0),
- test_file_name_("hantro_collage_w352h288.yuv"),
- stats_file_name_("hantro_collage_w352h288.stat"),
- codec_initialized_(false),
- decoder_(0) {
- memset(&svc_, 0, sizeof(svc_));
- memset(&codec_, 0, sizeof(codec_));
- memset(&codec_enc_, 0, sizeof(codec_enc_));
- }
-
- virtual ~SvcTest() {}
-
- virtual void SetUp() {
- svc_.encoding_mode = INTER_LAYER_PREDICTION_IP;
- svc_.log_level = SVC_LOG_DEBUG;
- svc_.log_print = 0;
-
- codec_iface_ = vpx_codec_vp9_cx();
- const vpx_codec_err_t res =
- vpx_codec_enc_config_default(codec_iface_, &codec_enc_, 0);
- EXPECT_EQ(VPX_CODEC_OK, res);
-
- codec_enc_.g_w = kWidth;
- codec_enc_.g_h = kHeight;
- codec_enc_.g_timebase.num = 1;
- codec_enc_.g_timebase.den = 60;
- codec_enc_.kf_min_dist = 100;
- codec_enc_.kf_max_dist = 100;
-
- vpx_codec_dec_cfg_t dec_cfg = {0};
- VP9CodecFactory codec_factory;
- decoder_ = codec_factory.CreateDecoder(dec_cfg, 0);
- }
-
- virtual void TearDown() {
- vpx_svc_release(&svc_);
- delete(decoder_);
- if (codec_initialized_) vpx_codec_destroy(&codec_);
- }
-
- SvcContext svc_;
- vpx_codec_ctx_t codec_;
- struct vpx_codec_enc_cfg codec_enc_;
- vpx_codec_iface_t *codec_iface_;
- std::string test_file_name_;
- std::string stats_file_name_;
- bool codec_initialized_;
- Decoder *decoder_;
-};
-
-TEST_F(SvcTest, SvcInit) {
- // test missing parameters
- vpx_codec_err_t res = vpx_svc_init(NULL, &codec_, codec_iface_, &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
- res = vpx_svc_init(&svc_, NULL, codec_iface_, &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
- res = vpx_svc_init(&svc_, &codec_, NULL, &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_init(&svc_, &codec_, codec_iface_, NULL);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- svc_.spatial_layers = 6; // too many layers
- res = vpx_svc_init(&svc_, &codec_, codec_iface_, &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- svc_.spatial_layers = 0; // use default layers
- res = vpx_svc_init(&svc_, &codec_, codec_iface_, &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
- EXPECT_EQ(VPX_SS_DEFAULT_LAYERS, svc_.spatial_layers);
-}
-
-TEST_F(SvcTest, InitTwoLayers) {
- svc_.spatial_layers = 2;
- vpx_svc_set_scale_factors(&svc_, "4/16,16*16"); // invalid scale values
- vpx_codec_err_t res = vpx_svc_init(&svc_, &codec_, codec_iface_, &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- vpx_svc_set_scale_factors(&svc_, "4/16,16/16"); // valid scale values
- res = vpx_svc_init(&svc_, &codec_, codec_iface_, &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-}
-
-TEST_F(SvcTest, InvalidOptions) {
- vpx_codec_err_t res = vpx_svc_set_options(&svc_, NULL);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_options(&svc_, "not-an-option=1");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-}
-
-TEST_F(SvcTest, SetLayersOption) {
- vpx_codec_err_t res = vpx_svc_set_options(&svc_, "layers=3");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
- EXPECT_EQ(3, svc_.spatial_layers);
-}
-
-TEST_F(SvcTest, SetEncodingMode) {
- vpx_codec_err_t res = vpx_svc_set_options(&svc_, "encoding-mode=alt-ip");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
- EXPECT_EQ(ALT_INTER_LAYER_PREDICTION_IP, svc_.encoding_mode);
-}
-
-TEST_F(SvcTest, SetMultipleOptions) {
- vpx_codec_err_t res = vpx_svc_set_options(&svc_, "layers=2 encoding-mode=ip");
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
- EXPECT_EQ(2, svc_.spatial_layers);
- EXPECT_EQ(INTER_LAYER_PREDICTION_IP, svc_.encoding_mode);
-}
-
-TEST_F(SvcTest, SetScaleFactorsOption) {
- svc_.spatial_layers = 2;
- vpx_codec_err_t res =
- vpx_svc_set_options(&svc_, "scale-factors=not-scale-factors");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_options(&svc_, "scale-factors=1/3,2/3");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-}
-
-TEST_F(SvcTest, SetQuantizersOption) {
- svc_.spatial_layers = 2;
- vpx_codec_err_t res = vpx_svc_set_options(&svc_, "quantizers=not-quantizers");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- vpx_svc_set_options(&svc_, "quantizers=40,45");
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-}
-
-TEST_F(SvcTest, SetKeyFrameQuantizersOption) {
- svc_.spatial_layers = 2;
- vpx_codec_err_t res = vpx_svc_set_options(&svc_,
- "quantizers-keyframe=not-quantizers");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- vpx_svc_set_options(&svc_, "quantizers-keyframe=40,45");
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-}
-
-TEST_F(SvcTest, SetQuantizers) {
- vpx_codec_err_t res = vpx_svc_set_quantizers(NULL, "40,30", 0);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_quantizers(&svc_, NULL, 0);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- svc_.spatial_layers = 2;
- res = vpx_svc_set_quantizers(&svc_, "40", 0);
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_quantizers(&svc_, "40,30", 0);
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-}
-
-TEST_F(SvcTest, SetKeyFrameQuantizers) {
- vpx_codec_err_t res = vpx_svc_set_quantizers(NULL, "40,31", 1);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_quantizers(&svc_, NULL, 1);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_quantizers(&svc_, "40,30", 1);
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-}
-
-TEST_F(SvcTest, SetScaleFactors) {
- vpx_codec_err_t res = vpx_svc_set_scale_factors(NULL, "4/16,16/16");
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_scale_factors(&svc_, NULL);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- svc_.spatial_layers = 2;
- res = vpx_svc_set_scale_factors(&svc_, "4/16");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_set_scale_factors(&svc_, "4/16,16/16");
- EXPECT_EQ(VPX_CODEC_OK, res);
- res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-}
-
-// Test that decoder can handle an SVC frame as the first frame in a sequence.
-TEST_F(SvcTest, FirstFrameHasLayers) {
- svc_.spatial_layers = 2;
- vpx_svc_set_scale_factors(&svc_, "4/16,16/16");
- vpx_svc_set_quantizers(&svc_, "40,30", 0);
-
- vpx_codec_err_t res =
- vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-
- libvpx_test::I420VideoSource video(test_file_name_, kWidth, kHeight,
- codec_enc_.g_timebase.den,
- codec_enc_.g_timebase.num, 0, 30);
- video.Begin();
-
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- EXPECT_EQ(VPX_CODEC_OK, res);
-
- const vpx_codec_err_t res_dec = decoder_->DecodeFrame(
- static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)),
- vpx_svc_get_frame_size(&svc_));
-
- // this test fails with a decoder error
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
-}
-
-TEST_F(SvcTest, EncodeThreeFrames) {
- svc_.spatial_layers = 2;
- vpx_svc_set_scale_factors(&svc_, "4/16,16/16");
- vpx_svc_set_quantizers(&svc_, "40,30", 0);
-
- vpx_codec_err_t res =
- vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- ASSERT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-
- libvpx_test::I420VideoSource video(test_file_name_, kWidth, kHeight,
- codec_enc_.g_timebase.den,
- codec_enc_.g_timebase.num, 0, 30);
- // FRAME 0
- video.Begin();
- // This frame is a keyframe.
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(1, vpx_svc_is_keyframe(&svc_));
-
- vpx_codec_err_t res_dec = decoder_->DecodeFrame(
- static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)),
- vpx_svc_get_frame_size(&svc_));
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
-
- // FRAME 1
- video.Next();
- // This is a P-frame.
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_));
-
- res_dec = decoder_->DecodeFrame(
- static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)),
- vpx_svc_get_frame_size(&svc_));
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
-
- // FRAME 2
- video.Next();
- // This is a P-frame.
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_));
-
- res_dec = decoder_->DecodeFrame(
- static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)),
- vpx_svc_get_frame_size(&svc_));
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
-}
-
-TEST_F(SvcTest, GetLayerResolution) {
- svc_.spatial_layers = 2;
- vpx_svc_set_scale_factors(&svc_, "4/16,8/16");
- vpx_svc_set_quantizers(&svc_, "40,30", 0);
-
- vpx_codec_err_t res =
- vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- EXPECT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-
- // ensure that requested layer is a valid layer
- uint32_t layer_width, layer_height;
- res = vpx_svc_get_layer_resolution(&svc_, svc_.spatial_layers,
- &layer_width, &layer_height);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_get_layer_resolution(NULL, 0, &layer_width, &layer_height);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_get_layer_resolution(&svc_, 0, NULL, &layer_height);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_get_layer_resolution(&svc_, 0, &layer_width, NULL);
- EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
-
- res = vpx_svc_get_layer_resolution(&svc_, 0, &layer_width, &layer_height);
- EXPECT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(kWidth * 4 / 16, layer_width);
- EXPECT_EQ(kHeight * 4 / 16, layer_height);
-
- res = vpx_svc_get_layer_resolution(&svc_, 1, &layer_width, &layer_height);
- EXPECT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(kWidth * 8 / 16, layer_width);
- EXPECT_EQ(kHeight * 8 / 16, layer_height);
-}
-
-TEST_F(SvcTest, FirstPassEncode) {
- svc_.spatial_layers = 2;
- codec_enc_.g_pass = VPX_RC_FIRST_PASS;
- vpx_svc_set_scale_factors(&svc_, "4/16,16/16");
- vpx_svc_set_quantizers(&svc_, "40,30", 0);
-
- vpx_codec_err_t res =
- vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- ASSERT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-
- libvpx_test::I420VideoSource video(test_file_name_, kWidth, kHeight,
- codec_enc_.g_timebase.den,
- codec_enc_.g_timebase.num, 0, 30);
- // FRAME 0
- video.Begin();
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U);
-
- // FRAME 1
- video.Next();
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U);
-
- // Flush encoder and test EOS packet
- res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_GT(vpx_svc_get_rc_stats_buffer_size(&svc_), 0U);
-}
-
-TEST_F(SvcTest, SecondPassEncode) {
- svc_.spatial_layers = 2;
- codec_enc_.g_pass = VPX_RC_LAST_PASS;
-
- FILE *const stats_file = libvpx_test::OpenTestDataFile(stats_file_name_);
- ASSERT_TRUE(stats_file != NULL) << "Stats file open failed. Filename: "
- << stats_file;
-
- struct vpx_fixed_buf stats_buf;
- fseek(stats_file, 0, SEEK_END);
- stats_buf.sz = static_cast<size_t>(ftell(stats_file));
- fseek(stats_file, 0, SEEK_SET);
-
- stats_buf.buf = malloc(stats_buf.sz);
- ASSERT_TRUE(stats_buf.buf != NULL);
- const size_t bytes_read = fread(stats_buf.buf, 1, stats_buf.sz, stats_file);
- ASSERT_EQ(bytes_read, stats_buf.sz);
- fclose(stats_file);
- codec_enc_.rc_twopass_stats_in = stats_buf;
-
- vpx_codec_err_t res =
- vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
- ASSERT_EQ(VPX_CODEC_OK, res);
- codec_initialized_ = true;
-
- libvpx_test::I420VideoSource video(test_file_name_, kWidth, kHeight,
- codec_enc_.g_timebase.den,
- codec_enc_.g_timebase.num, 0, 30);
- // FRAME 0
- video.Begin();
- // This frame is a keyframe.
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(1, vpx_svc_is_keyframe(&svc_));
-
- vpx_codec_err_t res_dec = decoder_->DecodeFrame(
- static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)),
- vpx_svc_get_frame_size(&svc_));
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
-
- // FRAME 1
- video.Next();
- // This is a P-frame.
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_));
-
- res_dec = decoder_->DecodeFrame(
- static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)),
- vpx_svc_get_frame_size(&svc_));
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
-
- // FRAME 2
- video.Next();
- // This is a P-frame.
- res = vpx_svc_encode(&svc_, &codec_, video.img(), video.pts(),
- video.duration(), VPX_DL_GOOD_QUALITY);
- ASSERT_EQ(VPX_CODEC_OK, res);
- EXPECT_EQ(0, vpx_svc_is_keyframe(&svc_));
-
- res_dec = decoder_->DecodeFrame(
- static_cast<const uint8_t *>(vpx_svc_get_buffer(&svc_)),
- vpx_svc_get_frame_size(&svc_));
- ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
-
- free(stats_buf.buf);
-}
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/test-data.sha1 b/videocodec/libvpx_internal/libvpx/test/test-data.sha1
deleted file mode 100644
index b8f668a..0000000
--- a/videocodec/libvpx_internal/libvpx/test/test-data.sha1
+++ /dev/null
@@ -1,593 +0,0 @@
-d5dfb0151c9051f8c85999255645d7a23916d3c0 hantro_collage_w352h288.yuv
-998cec53307c94aa5835aaf8d5731f6a3c7c2e5a hantro_collage_w352h288.stat
-b87815bf86020c592ccc7a846ba2e28ec8043902 hantro_odd.yuv
-b1f1c3ec79114b9a0651af24ce634afb44a9a419 rush_hour_444.y4m
-5184c46ddca8b1fadd16742e8500115bc8f749da vp80-00-comprehensive-001.ivf
-65bf1bbbced81b97bd030f376d1b7f61a224793f vp80-00-comprehensive-002.ivf
-906b4c1e99eb734504c504b3f1ad8052137ce672 vp80-00-comprehensive-003.ivf
-ec144b1af53af895db78355785650b96dd3f0ade vp80-00-comprehensive-004.ivf
-afc7091785c62f1c121c4554a2830c30704587d9 vp80-00-comprehensive-005.ivf
-42ea9d55c818145d06a9b633b8e85c6a6164fd3e vp80-00-comprehensive-006.ivf
-e5b3a73ab79fe024c14309d653d6bed92902ee3b vp80-00-comprehensive-007.ivf
-f3c50a58875930adfb84525c0ef59d7e4c08540c vp80-00-comprehensive-008.ivf
-4b2841fdb83db51ae322096ae468bbb9dc2c8362 vp80-00-comprehensive-009.ivf
-efbff736e3a91ab6a98c5bc2dce65d645944c7b1 vp80-00-comprehensive-010.ivf
-6b315102cae008d22a3d2c231be92cb704a222f8 vp80-00-comprehensive-011.ivf
-f3214a4fea14c2d5ec689936c1613f274c859ee8 vp80-00-comprehensive-012.ivf
-e4094e96d308c8a35b74c480a43d853c5294cd34 vp80-00-comprehensive-013.ivf
-5b0adfaf60a69e0aaf3ec021a39d0a68fc0e1b5a vp80-00-comprehensive-014.ivf
-e8467688ddf26b5000664f904faf0d70506aa653 vp80-00-comprehensive-015.ivf
-aab55582337dfd2a39ff54fb2576a91910d49337 vp80-00-comprehensive-016.ivf
-1ba24724f80203c9bae4f1d0f99d534721980016 vp80-00-comprehensive-017.ivf
-143a15512b46f436280ddb4d0e6411eb4af434f2 vp80-00-comprehensive-018.ivf
-c5baeaf5714fdfb3a8bc960a8e33ac438e83b16b vp80-01-intra-1400.ivf
-f383955229afe3408453e316d11553d923ca60d5 vp80-01-intra-1411.ivf
-84e1f4343f174c9f3c83f834bac3196fb325bf2c vp80-01-intra-1416.ivf
-fb6e712a47dd57a28a3727d2ae2c97a8b7c7ca51 vp80-01-intra-1417.ivf
-71ea772d3e9d315b8cbecf41207b8a237c34853b vp80-02-inter-1402.ivf
-d85dbc4271525dcd128c503f936fe69091d1f8d0 vp80-02-inter-1412.ivf
-d4e5d3ad56511867d025f93724d090f92ba6ec3d vp80-02-inter-1418.ivf
-91791cbcc37c60f35dbd8090bacb54e5ec6dd4fa vp80-02-inter-1424.ivf
-17fbfe2fea70f6e2f3fa6ca4efaae6c0b03b5f02 vp80-03-segmentation-01.ivf
-3c3600dbbcde08e20d54c66fe3b7eadd4f09bdbb vp80-03-segmentation-02.ivf
-c156778d5340967d4b369c490848076e92f1f875 vp80-03-segmentation-03.ivf
-d25dcff6c60e87a1af70945b8911b6b4998533b0 vp80-03-segmentation-04.ivf
-362baba2ce454c9db21218f35e81c27a5ed0b730 vp80-03-segmentation-1401.ivf
-d223ae7ee748ce07e74c4679bfd219e84aa9f4b0 vp80-03-segmentation-1403.ivf
-033adf7f3a13836a3f1cffcb87c1972900f2b5c6 vp80-03-segmentation-1407.ivf
-4d51dfbf9f3e2c590ec99d1d6f59dd731d04375f vp80-03-segmentation-1408.ivf
-f37a62b197c2600d75e0ccfbb31b60efdedac251 vp80-03-segmentation-1409.ivf
-eb25bd7bfba5b2f6935018a930f42d123b1e7fcd vp80-03-segmentation-1410.ivf
-b9d5c436663a30c27cfff84b53a002e501258843 vp80-03-segmentation-1413.ivf
-6da92b9d1a180cc3a8afe348ab12258f5a37be1a vp80-03-segmentation-1414.ivf
-a4f5842602886bd669f115f93d8a35c035cb0948 vp80-03-segmentation-1415.ivf
-f295dceb8ef278b77251b3f9df8aee22e161d547 vp80-03-segmentation-1425.ivf
-198dbf9f36f733200e432664cc8c5752d59779de vp80-03-segmentation-1426.ivf
-7704804e32f5de976803929934a7fafe101ac7b0 vp80-03-segmentation-1427.ivf
-831ccd862ea95ca025d2f3bd8b88678752f5416d vp80-03-segmentation-1432.ivf
-b3c11978529289f9109f2766fcaba3ebc40e11ef vp80-03-segmentation-1435.ivf
-a835a731f5520ebfc1002c40121264d0020559ac vp80-03-segmentation-1436.ivf
-1d1732942f773bb2a5775fcb9689b1579ce28eab vp80-03-segmentation-1437.ivf
-db04799adfe089dfdf74dbd43cc05ede7161f99e vp80-03-segmentation-1441.ivf
-7caf39b3f20cfd52b998210878062e52a5edf1e6 vp80-03-segmentation-1442.ivf
-3607f6bb4ee106c38fa1ea370dc4ff8b8cde2261 vp80-04-partitions-1404.ivf
-93cc323b6b6867f1b12dd48773424549c6960a6b vp80-04-partitions-1405.ivf
-047eedb14b865bdac8a3538e63801054e0295e9c vp80-04-partitions-1406.ivf
-0f1233bd2bc33f56ce5e495dbd455d122339f384 vp80-05-sharpness-1428.ivf
-51767fc136488a9535c2a4c38067c542ee2048df vp80-05-sharpness-1429.ivf
-9805aa107672de25d6fb8c35e20d06deca5efe18 vp80-05-sharpness-1430.ivf
-61db6b965f9c27aebe71b85bf2d5877e58e4bbdf vp80-05-sharpness-1431.ivf
-10420d266290d2923555f84af38eeb96edbd3ae8 vp80-05-sharpness-1433.ivf
-3ed24f9a80cddfdf75824ba95cdb4ff9286cb443 vp80-05-sharpness-1434.ivf
-c87599cbecd72d4cd4f7ace3313b7a6bc6eb8163 vp80-05-sharpness-1438.ivf
-aff51d865c2621b60510459244ea83e958e4baed vp80-05-sharpness-1439.ivf
-da386e72b19b5485a6af199c5eb60ef25e510dd1 vp80-05-sharpness-1440.ivf
-6759a095203d96ccd267ce09b1b050b8cc4c2f1f vp80-05-sharpness-1443.ivf
-b95d3cc1d0df991e63e150a801710a72f20d9ba0 vp80-06-smallsize.ivf
-db55ec7fd02c864ba996ff060b25b1e08611330b vp80-00-comprehensive-001.ivf.md5
-29db0ad011cba1e45f856d5623cd38dac3e3bf19 vp80-00-comprehensive-002.ivf.md5
-e84f258f69e173e7d68f8f8c037a0a3766902182 vp80-00-comprehensive-003.ivf.md5
-eb7912eaf69559a16fd82bc3f5fb1524cf4a4466 vp80-00-comprehensive-004.ivf.md5
-4206f71c94894bd5b5b376f6c09b3817dbc65206 vp80-00-comprehensive-005.ivf.md5
-4f89b356f6f2fecb928f330a10f804f00f5325f5 vp80-00-comprehensive-006.ivf.md5
-2813236a32964dd8007e17648bcf035a20fcda6c vp80-00-comprehensive-007.ivf.md5
-10746c72098f872803c900e17c5680e451f5f498 vp80-00-comprehensive-008.ivf.md5
-39a23d0692ce64421a7bb7cdf6ccec5928d37fff vp80-00-comprehensive-009.ivf.md5
-f6e3de8931a0cc659bda8fbc14050346955e72d4 vp80-00-comprehensive-010.ivf.md5
-101683ec195b6e944f7cd1e468fc8921439363e6 vp80-00-comprehensive-011.ivf.md5
-1f592751ce46d8688998fa0fa4fbdcda0fd4058c vp80-00-comprehensive-012.ivf.md5
-6066176f90ca790251e795fca1a5797d59999841 vp80-00-comprehensive-013.ivf.md5
-2656da94ba93691f23edc4d60b3a09e2be46c217 vp80-00-comprehensive-014.ivf.md5
-c6e0d5f5d61460c8ac8edfa4e701f10312c03133 vp80-00-comprehensive-015.ivf.md5
-ee60fee501d8493e34e8d6a1fe315b51ed09b24a vp80-00-comprehensive-016.ivf.md5
-9f1914ceffcad4546c0a29de3ef591d8bea304dc vp80-00-comprehensive-017.ivf.md5
-e0305178fe288a9fd8082b39e2d03181edb19054 vp80-00-comprehensive-018.ivf.md5
-612494da2fa799cc9d76dcdd835ae6c7cb2e5c05 vp80-01-intra-1400.ivf.md5
-48ea06097ac8269c5e8c2131d3d0639f431fcf0e vp80-01-intra-1411.ivf.md5
-6e2ab4e7677ad0ba868083ca6bc387ee922b400c vp80-01-intra-1416.ivf.md5
-eca0a90348959ce3854142f8d8641b13050e8349 vp80-01-intra-1417.ivf.md5
-920feea203145d5c2258a91c4e6991934a79a99e vp80-02-inter-1402.ivf.md5
-f71d97909fe2b3dd65be7e1f56c72237f0cef200 vp80-02-inter-1412.ivf.md5
-e911254569a30bbb2a237ff8b79f69ed9da0672d vp80-02-inter-1418.ivf.md5
-58c789c50c9bb9cc90580bed291164a0939d28ba vp80-02-inter-1424.ivf.md5
-ff3e2f441327b9c20a0b37c524e0f5a48a36de7b vp80-03-segmentation-01.ivf.md5
-0791f417f076a542ae66fbc3426ab4d94cbd6c75 vp80-03-segmentation-02.ivf.md5
-722e50f1a6a91c34302d68681faffc1c26d1cc57 vp80-03-segmentation-03.ivf.md5
-c701f1885bcfb27fb8e70cc65606b289172ef889 vp80-03-segmentation-04.ivf.md5
-f79bc9ec189a2b4807632a3d0c5bf04a178b5300 vp80-03-segmentation-1401.ivf.md5
-b9aa4c74c0219b639811c44760d0b24cd8bb436a vp80-03-segmentation-1403.ivf.md5
-70d5a2207ca1891bcaebd5cf6dd88ce8d57b4334 vp80-03-segmentation-1407.ivf.md5
-265f962ee781531f9a93b9309461316fd32b2a1d vp80-03-segmentation-1408.ivf.md5
-0c4ecbbd6dc042d30e626d951b65f460dd6cd563 vp80-03-segmentation-1409.ivf.md5
-cf779af36a937f06570a0fca9db64ba133451dee vp80-03-segmentation-1410.ivf.md5
-0e6c5036d51ab078842f133934926c598a9cff02 vp80-03-segmentation-1413.ivf.md5
-eb3930aaf229116c80d507516c34759c3f6cdf69 vp80-03-segmentation-1414.ivf.md5
-123d6c0f72ee87911c4ae7538e87b7d163b22d6c vp80-03-segmentation-1415.ivf.md5
-e70551d1a38920e097a5d8782390b79ecaeb7505 vp80-03-segmentation-1425.ivf.md5
-44e8f4117e46dbb302b2cfd81171cc1a1846e431 vp80-03-segmentation-1426.ivf.md5
-52636e54aee5f95bbace37021bd67de5db767e9a vp80-03-segmentation-1427.ivf.md5
-b1ad3eff20215c28e295b15ef3636ed926d59cba vp80-03-segmentation-1432.ivf.md5
-24c22a552fa28a90e5978f67f57181cc2d7546d7 vp80-03-segmentation-1435.ivf.md5
-96c49c390abfced18a7a8c9b9ea10af778e10edb vp80-03-segmentation-1436.ivf.md5
-f95eb6214571434f1f73ab7833b9ccdf47588020 vp80-03-segmentation-1437.ivf.md5
-1c0700ca27c9b0090a7747a4b0b4dc21d1843181 vp80-03-segmentation-1441.ivf.md5
-81d4f23ca32667ee958bae579c8f5e97ba72eb97 vp80-03-segmentation-1442.ivf.md5
-272efcef07a3a30fbca51bfd566063d8258ec0be vp80-04-partitions-1404.ivf.md5
-66ed219ab812ac801b256d35cf495d193d4cf478 vp80-04-partitions-1405.ivf.md5
-36083f37f56f502bd60ec5e07502ee9e6b8699b0 vp80-04-partitions-1406.ivf.md5
-6ca909bf168a64c09415626294665dc1be3d1973 vp80-05-sharpness-1428.ivf.md5
-1667d2ee2334e5fdea8a8a866f4ccf3cf76f033a vp80-05-sharpness-1429.ivf.md5
-71bcbe5357d36a19df5b07fbe3e27bffa8893f0a vp80-05-sharpness-1430.ivf.md5
-89a09b1dffce2d55770a89e58d9925c70ef79bf8 vp80-05-sharpness-1431.ivf.md5
-08444a18b4e6ba3450c0796dd728d48c399a2dc9 vp80-05-sharpness-1433.ivf.md5
-6d6223719a90c13e848aa2a8a6642098cdb5977a vp80-05-sharpness-1434.ivf.md5
-41d70bb5fa45bc88da1604a0af466930b8dd77b5 vp80-05-sharpness-1438.ivf.md5
-086c56378df81b6cee264d7540a7b8f2b405c7a4 vp80-05-sharpness-1439.ivf.md5
-d32dc2c4165eb266ea4c23c14a45459b363def32 vp80-05-sharpness-1440.ivf.md5
-8c69dc3d8e563f56ffab5ad1e400d9e689dd23df vp80-05-sharpness-1443.ivf.md5
-d6f246df012c241b5fa6c1345019a3703d85c419 vp80-06-smallsize.ivf.md5
-ce881e567fe1d0fbcb2d3e9e6281a1a8d74d82e0 vp90-2-00-quantizer-00.webm
-ac5eda33407d0521c7afca43a63fd305c0cd9d13 vp90-2-00-quantizer-00.webm.md5
-2ca0463f2cfb93d25d7dded174db70b7cb87cb48 vp90-2-00-quantizer-01.webm
-10d98884fc6d9a5f47a2057922b8e25dd48d7786 vp90-2-00-quantizer-01.webm.md5
-d80a2920a5e0819d69dcba8fe260c01f820f8982 vp90-2-00-quantizer-02.webm
-c964c8e5e04165fabbf1c6ee8ee5121d35921965 vp90-2-00-quantizer-02.webm.md5
-fdef046777b5b75c962b715d809dbe2ea331afb9 vp90-2-00-quantizer-03.webm
-f270bee0b0c7aa2bf4c5afe098556b4f3f890faf vp90-2-00-quantizer-03.webm.md5
-66d98609e809394a6ac730787e6724e3badc075a vp90-2-00-quantizer-04.webm
-427433bfe121c4aea1095ec3124fdc174d200e3a vp90-2-00-quantizer-04.webm.md5
-e6e42626d8cadf0b5be16313f69212981b96fee5 vp90-2-00-quantizer-05.webm
-c98f6a9a1af4cfd71416792827304266aad4bd46 vp90-2-00-quantizer-05.webm.md5
-413ef09b721f5dcec1a96e937a97e5873c2e6db6 vp90-2-00-quantizer-06.webm
-5080e940a23805c82e578e21b57fc2c511e76376 vp90-2-00-quantizer-06.webm.md5
-4a50a5f4ac717c30dfaae8bb46702e3542e867de vp90-2-00-quantizer-07.webm
-76c429a02b56762e10ee4db88729d8834b3a70f4 vp90-2-00-quantizer-07.webm.md5
-d2f4e464780bf8b7e647efa18ac777a930e62bc0 vp90-2-00-quantizer-08.webm
-ab94aabf9316111b52d7c531962ed4123313b6ba vp90-2-00-quantizer-08.webm.md5
-174bc58433936dd79550398d744f1072ce7f5693 vp90-2-00-quantizer-09.webm
-e1f7690cd83ccc56d045e17cce552544a5f03810 vp90-2-00-quantizer-09.webm.md5
-52bc1dfd3a97b24d922eb8a31d07527891561f2a vp90-2-00-quantizer-10.webm
-9b37bed893b5f6a4e12f2aa40f02dd40f944d0f8 vp90-2-00-quantizer-10.webm.md5
-10031eecafde1e1d8e6323fe2b2a1d7e77a66869 vp90-2-00-quantizer-11.webm
-fe4620a4bb0e4f5cb9bbfedc4039a22b81b0f5c0 vp90-2-00-quantizer-11.webm.md5
-78e9f7bb77e8e348155bbdfa12790789d1d50c34 vp90-2-00-quantizer-12.webm
-0961d060cc8dd469c6dac8d7d75f927c0bb971b8 vp90-2-00-quantizer-12.webm.md5
-133b77a3bbcef652552d74ffc46afbfe3b8a1cba vp90-2-00-quantizer-13.webm
-df29e5e0f95772af482f540d776f6b9dea4bfa29 vp90-2-00-quantizer-13.webm.md5
-27323afdaf8987e025c27129c74c86502315a206 vp90-2-00-quantizer-14.webm
-ce96a2cc312942f0427a463f15a392870dd69764 vp90-2-00-quantizer-14.webm.md5
-ab58d0b41037829f6bc993910999f4af0212aafd vp90-2-00-quantizer-15.webm
-40f700db606501aa7cb49049624cbdde6409b122 vp90-2-00-quantizer-15.webm.md5
-cd948e66448aafb65998815ce37241f95d7c9ee7 vp90-2-00-quantizer-16.webm
-039b742d149c945ed79c7b9a6384352852a1c116 vp90-2-00-quantizer-16.webm.md5
-62f56e663e13c576764e491cf08f19bd46a71999 vp90-2-00-quantizer-17.webm
-90c5a39bf76e6b3e0a1c0d3e9b68a9fd78be963e vp90-2-00-quantizer-17.webm.md5
-f26ecad7263cd66a614e53ba5d7c00df181affeb vp90-2-00-quantizer-18.webm
-cda0a1c0fca2ec2976ae55124a8a67305508bae6 vp90-2-00-quantizer-18.webm.md5
-94bfc4c04fcfe139a63b98c569e8c14ba98c401f vp90-2-00-quantizer-19.webm
-5b8ec169ccf67d8a0a8e46a62eb173f5a1dbaf4f vp90-2-00-quantizer-19.webm.md5
-0ee88e9318985e1e245de78c2c4a665885ab76a7 vp90-2-00-quantizer-20.webm
-4b26f7edb4fcd3a1b4cce9ba3cb8650e3ee6e063 vp90-2-00-quantizer-20.webm.md5
-6a995cb2b1db33da8087321df1e646f95c3e32d1 vp90-2-00-quantizer-21.webm
-e216b4a1eceac03efcc433759be54ab8ea87b24b vp90-2-00-quantizer-21.webm.md5
-aa7722fc427e7180115f3c9cd96bb6b2768e7296 vp90-2-00-quantizer-22.webm
-1aa813bd45ae831bf5e79ace4d73dfd25989a07d vp90-2-00-quantizer-22.webm.md5
-7677e5b929ed6d142041f19b8a9cd5822ee1504a vp90-2-00-quantizer-23.webm
-0de0af34abd843d5b37e58baf3ed96a6104b64c3 vp90-2-00-quantizer-23.webm.md5
-b2995cbe1128b2d4926f1b28d01c501ecb6be8c8 vp90-2-00-quantizer-24.webm
-db6033af2ba2f2bca62468fb4b8808e474f93923 vp90-2-00-quantizer-24.webm.md5
-8135ba35587fd92cd4667be7896323d9b634401c vp90-2-00-quantizer-25.webm
-3499e00c2cc15876f61f07e3d3cfca54ebcd98fd vp90-2-00-quantizer-25.webm.md5
-af0fa2907746db82d345f6d831fcc1b2862a29fb vp90-2-00-quantizer-26.webm
-cd6fe3d14dab48886ebf65be00e6ed9616ebe5a7 vp90-2-00-quantizer-26.webm.md5
-bd0002e91323776beb5ff11e06edcf19fc08e9b9 vp90-2-00-quantizer-27.webm
-fe72154ef196067d6c272521012dd79706496cac vp90-2-00-quantizer-27.webm.md5
-fc15eb606f81455ff03df16bf3432296b002c43c vp90-2-00-quantizer-28.webm
-40b2e24b542206a6bfd746ef199e49ccea07678a vp90-2-00-quantizer-28.webm.md5
-3090bbf913cad0b2eddca7228f5ed51a58378b8d vp90-2-00-quantizer-29.webm
-eb59745e0912d8ed6c928268bcf265237c9ba93f vp90-2-00-quantizer-29.webm.md5
-c615abdca9c25e1cb110d908edbedfb3b7c92b91 vp90-2-00-quantizer-30.webm
-ad0f4fe6733e4e7cdfe8ef8722bb341dcc7538c0 vp90-2-00-quantizer-30.webm.md5
-037d9f242086cfb085518f6416259defa82d5fc2 vp90-2-00-quantizer-31.webm
-4654b40792572f0a790874c6347ef9196d86c1a7 vp90-2-00-quantizer-31.webm.md5
-505899f3f3515044c5c8b3213d9b9d16f614619d vp90-2-00-quantizer-32.webm
-659a2e6dd02df323f62600626859006640b445df vp90-2-00-quantizer-32.webm.md5
-8b32ec9c3b7e5ca8ddc6b8aea1c1cb7ca996bccc vp90-2-00-quantizer-33.webm
-5b175ef1120ddeba4feae1247bf381bbc4e816ce vp90-2-00-quantizer-33.webm.md5
-4d283755d17e287b1d099a80604398f60d7fb6ea vp90-2-00-quantizer-34.webm
-22a739de95acfeb27524e3700b8f678a9ad744d8 vp90-2-00-quantizer-34.webm.md5
-4296f56a892a412d3d4f64824718dd566c4e6459 vp90-2-00-quantizer-35.webm
-c532c9c8dc7b3506fc6a51e5c20c17ef0ac039e7 vp90-2-00-quantizer-35.webm.md5
-6f54e11da461e4410dd9075b015e2d9bc1d07dfb vp90-2-00-quantizer-36.webm
-0b3573f5addea4e3eb11a0b85f068299d5bdad78 vp90-2-00-quantizer-36.webm.md5
-210581682a26c2c4375efc785c36e07539888bc2 vp90-2-00-quantizer-37.webm
-2b4fb6f8ba975237858e61cc8f560bcfc87cb38e vp90-2-00-quantizer-37.webm.md5
-a15ef31283dfc4860f837fe200eb32a445f59629 vp90-2-00-quantizer-38.webm
-fb76771f3a795054b9936f70da7505c3ac585284 vp90-2-00-quantizer-38.webm.md5
-1df8433a441412831daae6726df89fa70d21b14d vp90-2-00-quantizer-39.webm
-39e162c09a20e7e684868097766347014371fee6 vp90-2-00-quantizer-39.webm.md5
-5330e4788ab9129dbb25a7a7d5411104521248b6 vp90-2-00-quantizer-40.webm
-872cc0f2cc9dbf000f89eadb4d8f9940e48e00b1 vp90-2-00-quantizer-40.webm.md5
-d88d03b982889e399a78d7a06eeb1cf30e6c2da2 vp90-2-00-quantizer-41.webm
-5b4f7217e57fa2a221011d0b32f8d0409496b7b6 vp90-2-00-quantizer-41.webm.md5
-9e16406e3e26955a6e17d455ef1ef64bbfa26e53 vp90-2-00-quantizer-42.webm
-0219d090cf37daabe19256ba8e932ba4874b92e4 vp90-2-00-quantizer-42.webm.md5
-a9b15843486fb05f8cd15437ef279782a42b75db vp90-2-00-quantizer-43.webm
-3c9b0b4c607f9579a31726bfcf56729334ddc686 vp90-2-00-quantizer-43.webm.md5
-1dbc931ac446c91eabe7213efff55b596cccf07c vp90-2-00-quantizer-44.webm
-73bc8f675103abaef3d9f73a2742b3bffd726d23 vp90-2-00-quantizer-44.webm.md5
-7c6c1be15beb9d6201204b018966c8c4f9777efc vp90-2-00-quantizer-45.webm
-c907b29da821f790c6748de61f592689312e4e36 vp90-2-00-quantizer-45.webm.md5
-07b434da1a467580f73b32177ee11b3e00f65a0d vp90-2-00-quantizer-46.webm
-7b2b7ce60c50bc970bc0ada46d7a7ce440148da3 vp90-2-00-quantizer-46.webm.md5
-233d0465fb1a6fa36e9f89bd2193ac79bd4d2809 vp90-2-00-quantizer-47.webm
-527e0a9fb932efe915027ffe077f9e8d3a4fb139 vp90-2-00-quantizer-47.webm.md5
-719613df7307e205c3fdb6acfb373849c5ab23c7 vp90-2-00-quantizer-48.webm
-65ab6c9d1b682c183b201c7ff42b90343ce3e304 vp90-2-00-quantizer-48.webm.md5
-3bf04a598325ed0eabae1598ec7f718f715ec672 vp90-2-00-quantizer-49.webm
-ac68c4387ce11fcc998d8ba455ab9b2bb361d240 vp90-2-00-quantizer-49.webm.md5
-d59238fb3a654931c9b65a11e7321b40d1f702e9 vp90-2-00-quantizer-50.webm
-d0576bfede46fd55659f028f2fd28554ceb3e6cc vp90-2-00-quantizer-50.webm.md5
-3f579785101d4209360dd96f8c2ffe9beddf3bee vp90-2-00-quantizer-51.webm
-89fcfe04f4457a7f02ab4a2f94aacbb88aee5789 vp90-2-00-quantizer-51.webm.md5
-28be5836e2fedefe4babf12fc9b79e460ab0a0f4 vp90-2-00-quantizer-52.webm
-f3dd52b70c18345fee740220f35da9c4def2017a vp90-2-00-quantizer-52.webm.md5
-488ad4058c17170665b6acd1021fade9a02771e4 vp90-2-00-quantizer-53.webm
-1cdcb1d4f3a37cf83ad235eb27ec62ed2a01afc7 vp90-2-00-quantizer-53.webm.md5
-682978289cb28cc8c9d39bc797300e45d6039de7 vp90-2-00-quantizer-54.webm
-36c35353f2c03cb099bd710d9994de7d9ed88834 vp90-2-00-quantizer-54.webm.md5
-c398ce49af762a48f10cc4da9fae0769aae5f226 vp90-2-00-quantizer-55.webm
-2cf3570542d984f167ab087f59493c7fb47e0ed2 vp90-2-00-quantizer-55.webm.md5
-3071f18b2fce261aa82d61f81a7ae4ca9a75d0e3 vp90-2-00-quantizer-56.webm
-d3f93f8272b6de31cffb011a26f11abb514efb12 vp90-2-00-quantizer-56.webm.md5
-f4e8e14b1f278801a7eb6f11734780a01b1668e9 vp90-2-00-quantizer-57.webm
-6478fdf1d7faf6db5f19dffc5e1363af358699ee vp90-2-00-quantizer-57.webm.md5
-307dc264f57cc618fff211fa44d7f52767ed9660 vp90-2-00-quantizer-58.webm
-cf231d4a52d492fa692ea4194ec5eb7511fec54e vp90-2-00-quantizer-58.webm.md5
-1fd7cd596170afce2de0b1441b7674bda5723440 vp90-2-00-quantizer-59.webm
-4681f7ef96f63e085c41bb1a964b0df7e67e0b38 vp90-2-00-quantizer-59.webm.md5
-34cdcc81c0ba7085aefbb22d7b4aa9bca3dd7c62 vp90-2-00-quantizer-60.webm
-58691ef53b6b623810e2c57ded374c77535df935 vp90-2-00-quantizer-60.webm.md5
-e6e812406aab81021bb16e772c1db03f75906cb6 vp90-2-00-quantizer-61.webm
-76436eace62f08ff92b61a0845e66667a027db1b vp90-2-00-quantizer-61.webm.md5
-84d811bceed70c950a6a08e572a6e274866e72b1 vp90-2-00-quantizer-62.webm
-2d937cc011eeddd95222b960982da5cd18db580f vp90-2-00-quantizer-62.webm.md5
-0912b295ba0ea09359315315ffd67d22d046f883 vp90-2-00-quantizer-63.webm
-5a829031055d70565f57dbcd47a6ac33619952b3 vp90-2-00-quantizer-63.webm.md5
-0cf9e5ebe0112bdb47b5887ee5d58eb9d4727c00 vp90-2-01-sharpness-1.webm
-5a0476be4448bae8f8ca17ea236c98793a755948 vp90-2-01-sharpness-1.webm.md5
-51e02d7911810cdf5be8b68ac40aedab479a3179 vp90-2-01-sharpness-2.webm
-a0ca5bc87a5ed7c7051f59078daa0d03be1b45b6 vp90-2-01-sharpness-2.webm.md5
-0603f8ad239c07a531d948187f4dafcaf51eda8d vp90-2-01-sharpness-3.webm
-3af8000a69c72fe77881e3176f026c2affb78cc7 vp90-2-01-sharpness-3.webm.md5
-4ca4839f48146252fb261ed88838d80211804841 vp90-2-01-sharpness-4.webm
-08832a1494f84fa9edd40e080bcf2c0e80100c76 vp90-2-01-sharpness-4.webm.md5
-95099dc8f9cbaf9b9a7dd65311923e441ff70731 vp90-2-01-sharpness-5.webm
-93ceee30c140f0b406726c0d896b9db6031c4c7f vp90-2-01-sharpness-5.webm.md5
-ceb4116fb7b078d266d153233b6d62a255a34e4c vp90-2-01-sharpness-6.webm
-da83efe59e537ce538e8b03a6eac63cf25849c9a vp90-2-01-sharpness-6.webm.md5
-b5f7cd19aece3880f9d616a778e5cc24c6b9b505 vp90-2-01-sharpness-7.webm
-2957408d20deac8633941a2169f801bae6f086e1 vp90-2-01-sharpness-7.webm.md5
-ffc096c2ce1050450ad462b5fabd2a5220846319 vp90-2-02-size-08x08.webm
-e36d2ed6fa2746347710b750586aafa6a01ff3ae vp90-2-02-size-08x08.webm.md5
-895b986f9fd55cd879472b31c6a06b82094418c8 vp90-2-02-size-08x10.webm
-079157a19137ccaebba606f2871f45a397347150 vp90-2-02-size-08x10.webm.md5
-1c5992203e62a2b83040ccbecd748b604e19f4c0 vp90-2-02-size-08x16.webm
-9aa45ffdf2078f883bbed01450031b691819c144 vp90-2-02-size-08x16.webm.md5
-d0a8953da1f85f484487408fee5da9e2a8391901 vp90-2-02-size-08x18.webm
-59a5cc17d354c6a23e5e959d666b1456a5d49c56 vp90-2-02-size-08x18.webm.md5
-1b13461a9fc65cb041bacfe4ea6f02d363397d61 vp90-2-02-size-08x32.webm
-2bdddd6878f05d37d84cde056a3f5e7f926ba3d6 vp90-2-02-size-08x32.webm.md5
-2861f0a0daadb62295b0504a1fbe5b50c79a8f59 vp90-2-02-size-08x34.webm
-6b5812cfb8a82d378ea2913bf009e93668020147 vp90-2-02-size-08x34.webm.md5
-02f948216d4246579dc53c47fe55d8fb264ba251 vp90-2-02-size-08x64.webm
-84b55fdee6d9aa820c7a8c62822446184b191767 vp90-2-02-size-08x64.webm.md5
-4b011242cbf42516efd2b197baebb61dd34562c9 vp90-2-02-size-08x66.webm
-6b1fa0a885947b3cc0fe58f75f838e662bd9bb8b vp90-2-02-size-08x66.webm.md5
-4057796be9dd12df48ab607f502ae6aa70eeeab6 vp90-2-02-size-10x08.webm
-71c752c51aec9f48de286b93f4c20e9c11cad7d0 vp90-2-02-size-10x08.webm.md5
-6583c853fa43fc53d51743eac5f3a43a359d45d0 vp90-2-02-size-10x10.webm
-1da524d24af1944b671d4d3f2b398d6e336584c3 vp90-2-02-size-10x10.webm.md5
-ba442fc03ccd3a705c64c83b36f5ada67d198874 vp90-2-02-size-10x16.webm
-7cfd960f232c34c641a4a2a9411b6fd0efb2fc50 vp90-2-02-size-10x16.webm.md5
-cc92ed40eef14f52e4d080cb2c57939dd8326374 vp90-2-02-size-10x18.webm
-db5626275cc55ce970b91c995e74f6838d943aca vp90-2-02-size-10x18.webm.md5
-3a93d501d22325e9fd4c9d8b82e2a432de33c351 vp90-2-02-size-10x32.webm
-5cae51b0c71cfc131651f345f87583eb2903afaf vp90-2-02-size-10x32.webm.md5
-50d2f2b15a9a5178153db44a9e03aaf32b227f67 vp90-2-02-size-10x34.webm
-bb0efe058122641e7f73e94497dda2b9e6c21efd vp90-2-02-size-10x34.webm.md5
-01624ec173e533e0b33fd9bdb91eb7360c7c9175 vp90-2-02-size-10x64.webm
-b9c0e3b054463546356acf5157f9be92fd34732f vp90-2-02-size-10x64.webm.md5
-2942879baf1c09e96b14d0fc84806abfe129c706 vp90-2-02-size-10x66.webm
-bab5f539c2f91952e187456b4beafbb4c01e25ee vp90-2-02-size-10x66.webm.md5
-88d2b63ca5e9ee163d8f20e8886f3df3ff301a66 vp90-2-02-size-16x08.webm
-7f48a0fcf8c25963f3057d7f6669c5f2415834b8 vp90-2-02-size-16x08.webm.md5
-59261eb34c15ea9b5ddd2d416215c1a8b9e6dc1f vp90-2-02-size-16x10.webm
-73a7c209a46dd051c9f7339b6e02ccd5b3b9fc81 vp90-2-02-size-16x10.webm.md5
-066834fef9cf5b9a72932cf4dea5f253e14a976d vp90-2-02-size-16x16.webm
-faec542f52f37601cb9c480d887ae9355be99372 vp90-2-02-size-16x16.webm.md5
-195307b4eb3192271ee4a935b0e48deef0c54cc2 vp90-2-02-size-16x18.webm
-5a92e19e624c0376321d4d0e22c0c91995bc23e1 vp90-2-02-size-16x18.webm.md5
-14f3f884216d7ae16ec521f024a2f2d31bbf9c1a vp90-2-02-size-16x32.webm
-ea622d1c817dd174556f7ee7ccfe4942b34d4845 vp90-2-02-size-16x32.webm.md5
-2e0501100578a5da9dd47e4beea160f945bdd1ba vp90-2-02-size-16x34.webm
-1b8645ef64239334921c5f56b24ce815e6070b05 vp90-2-02-size-16x34.webm.md5
-89a6797fbebebe93215f367229a9152277f5dcfe vp90-2-02-size-16x64.webm
-a03d8c1179ca626a8856fb416d635dbf377979cd vp90-2-02-size-16x64.webm.md5
-0f3a182e0750fcbae0b9eae80c7a53aabafdd18d vp90-2-02-size-16x66.webm
-8cb6736dc2d897c1283919a32068af377d66c59c vp90-2-02-size-16x66.webm.md5
-68fe70dc7914cc1d8d6dcd97388b79196ba3e7f1 vp90-2-02-size-18x08.webm
-874c7fb505be9db3160c57cb405c4dbd5b990dc2 vp90-2-02-size-18x08.webm.md5
-0546352dd78496d4dd86c3727ac2ff36c9e72032 vp90-2-02-size-18x10.webm
-1d80eb36557ea5f25a386495a36f93da0f25316b vp90-2-02-size-18x10.webm.md5
-60fe99e5f5cc99706efa3e0b894e45cbcf0d6330 vp90-2-02-size-18x16.webm
-1ab6cdd89a53662995d103546e6611c84f9292ab vp90-2-02-size-18x16.webm.md5
-f9a8f5fb749d69fd555db6ca093b7f77800c7b4f vp90-2-02-size-18x18.webm
-ace8a66328f7802b15f9989c2720c029c6abd279 vp90-2-02-size-18x18.webm.md5
-a197123a527ec25913a9bf52dc8c347749e00045 vp90-2-02-size-18x32.webm
-34fbd7036752232d1663e70d7f7cdc93f7129202 vp90-2-02-size-18x32.webm.md5
-f219655a639a774a2c9c0a9f45c28dc0b5e75e24 vp90-2-02-size-18x34.webm
-2c4d622a9ea548791c1a07903d3702e9774388bb vp90-2-02-size-18x34.webm.md5
-5308578da48c677d477a5404e19391d1303033c9 vp90-2-02-size-18x64.webm
-e7fd4462527bac38559518ba80e41847db880f15 vp90-2-02-size-18x64.webm.md5
-e109a7e013bd179f97e378542e1e81689ed06802 vp90-2-02-size-18x66.webm
-45c04e422fb383c1f3be04beefaa4490e83bdb1a vp90-2-02-size-18x66.webm.md5
-38844cae5d99caf445f7de33c3ae78494ce36c01 vp90-2-02-size-32x08.webm
-ad018be39e493ca2405225034b1a5b7a42af6f3a vp90-2-02-size-32x08.webm.md5
-7b57eaad55906f9de9903c8657a3fcb2aaf792ea vp90-2-02-size-32x10.webm
-2294425d4e55d275af5e25a0beac9738a1b4ee73 vp90-2-02-size-32x10.webm.md5
-f47ca2ced0d47f761bb0a5fdcd911d3f450fdcc1 vp90-2-02-size-32x16.webm
-ae10981d93913f0ab1f28c1146255e01769aa8c0 vp90-2-02-size-32x16.webm.md5
-08b23ad838b6cf1fbfe3ad7e7775d95573e815fc vp90-2-02-size-32x18.webm
-1ba76f4c4a4ac7aabfa3ce195c1b473535eb7cc8 vp90-2-02-size-32x18.webm.md5
-d5b88ae6c8c25c53dee74d9f1e6ca64244349a57 vp90-2-02-size-32x32.webm
-e39c067a8ee2da52a51641eb1cb7f8eba935eb6b vp90-2-02-size-32x32.webm.md5
-529429920dc36bd899059fa75a767f02c8c60874 vp90-2-02-size-32x34.webm
-56888e7834f52b106e8911e3a7fc0f473b609995 vp90-2-02-size-32x34.webm.md5
-38e848e160391c2b1a55040aadde613b9f4bf15e vp90-2-02-size-32x64.webm
-8950485fb3f68b0e8be234db860e4ec5f5490fd0 vp90-2-02-size-32x64.webm.md5
-5e8670f0b8ec9cefa8795b8959ffbe1a8e1aea94 vp90-2-02-size-32x66.webm
-225df9d7d72ec711b0b60f4aeb65311c97db054a vp90-2-02-size-32x66.webm.md5
-695f929e2ce6fb11a1f180322d46c5cb1c97fa61 vp90-2-02-size-34x08.webm
-5bb4262030018dd01883965c6aa6070185924ef6 vp90-2-02-size-34x08.webm.md5
-5adf74ec906d2ad3f7526e06bd29f5ad7d966a90 vp90-2-02-size-34x10.webm
-71c100b437d3e8701632ae8d65c3555339b1c68f vp90-2-02-size-34x10.webm.md5
-d0918923c987fba2d00193d83797b21289fe54aa vp90-2-02-size-34x16.webm
-5d5a52f3535b4d2698dd3d87f4a13fdc9b57163d vp90-2-02-size-34x16.webm.md5
-553ab0042cf87f5e668ec31b2e4b2a4b6ec196fd vp90-2-02-size-34x18.webm
-a164c7f3c424987df2340496e6a8cf76e973f0f1 vp90-2-02-size-34x18.webm.md5
-baf3e233634f150de81c18ba5d8848068e1c3c54 vp90-2-02-size-34x32.webm
-22a79d3bd1c9b85dfe8c70bb2e19f08a92a8be03 vp90-2-02-size-34x32.webm.md5
-6d50a533774a7167350e4a7ef43c94a5622179a2 vp90-2-02-size-34x34.webm
-0c099638e79c273546523e06704553e42eb00b00 vp90-2-02-size-34x34.webm.md5
-698cdd0a5e895cc202c488675e682a8c537ede4f vp90-2-02-size-34x64.webm
-9317b63987cddab8389510a27b86f9f3d46e3fa5 vp90-2-02-size-34x64.webm.md5
-4b5335ca06f082b6b69f584eb8e7886bdcafefd3 vp90-2-02-size-34x66.webm
-e18d68b35428f46a84a947c646804a51ef1d7cec vp90-2-02-size-34x66.webm.md5
-a54ae7b494906ec928a876e8290e5574f2f9f6a2 vp90-2-02-size-64x08.webm
-87f9f7087b6489d45e9e4b38ede2c5aef4a4928f vp90-2-02-size-64x08.webm.md5
-24522c70804a3c23d937df2d829ae63965b23f38 vp90-2-02-size-64x10.webm
-447ce03938ab53bffcb4a841ee0bfaa90462dcb9 vp90-2-02-size-64x10.webm.md5
-2a5035d035d214ae614af8051930690ef623989b vp90-2-02-size-64x16.webm
-84e355761dd2e0361b904c84c52a0dd0384d89cf vp90-2-02-size-64x16.webm.md5
-3a293ef4e270a19438e59b817fbe5f43eed4d36b vp90-2-02-size-64x18.webm
-666824e5ba746779eb46079e0631853dcc86d48b vp90-2-02-size-64x18.webm.md5
-ed32fae837095c9e8fc95d223ec68101812932c2 vp90-2-02-size-64x32.webm
-97086eadedce1d0d9c072b585ba7b49aec69b1e7 vp90-2-02-size-64x32.webm.md5
-696c7a7250bdfff594f4dfd88af34239092ecd00 vp90-2-02-size-64x34.webm
-253a1d38d452e7826b086846c6f872f829c276bb vp90-2-02-size-64x34.webm.md5
-fc508e0e3c2e6872c60919a60b812c5232e9c2b0 vp90-2-02-size-64x64.webm
-2cd6ebeca0f82e9f505616825c07950371b905ab vp90-2-02-size-64x64.webm.md5
-0f8a4fc1d6521187660425c283f08dff8c66e476 vp90-2-02-size-64x66.webm
-5806be11a1d346be235f88d3683e69f73746166c vp90-2-02-size-64x66.webm.md5
-273b0c36e3658685cde250408a478116d7ae92f1 vp90-2-02-size-66x08.webm
-23c3cd0dca20a2f71f036e77ea92025ff4e7a298 vp90-2-02-size-66x08.webm.md5
-4844c59c3306d1e671bb0568f00e344bf797e66e vp90-2-02-size-66x10.webm
-e041eaf6841d775f8fde8bbb4949d2733fdaab7f vp90-2-02-size-66x10.webm.md5
-bdf3f1582b234fcd2805ffec59f9d716a2345302 vp90-2-02-size-66x16.webm
-2ec85ee18119e6798968571ea6e1b93ca386e3af vp90-2-02-size-66x16.webm.md5
-0acce9af12b13b025d5274013da7ef6f568f075f vp90-2-02-size-66x18.webm
-77c4d53e2a5c96b70af9d575fe6811e0f5ee627b vp90-2-02-size-66x18.webm.md5
-682b36a25774bbdedcd603f504d18eb63f0167d4 vp90-2-02-size-66x32.webm
-53728fae2a428f16d376a29f341a64ddca97996a vp90-2-02-size-66x32.webm.md5
-e71b70e901e29eaa6672a6aa4f37f6f5faa02bd6 vp90-2-02-size-66x34.webm
-f69a6a555e3f614b0a35f9bfc313d8ebb35bc725 vp90-2-02-size-66x34.webm.md5
-4151b8c29452d5c2266397a7b9bf688899a2937b vp90-2-02-size-66x64.webm
-69486e7fd9e380b6c97a03d3e167affc79f73840 vp90-2-02-size-66x64.webm.md5
-68784a1ecac776fe2a3f230345af32f06f123536 vp90-2-02-size-66x66.webm
-7f008c7f48d55e652fbd6bac405b51e0015c94f2 vp90-2-02-size-66x66.webm.md5
-7e1bc449231ac1c5c2a11c9a6333b3e828763798 vp90-2-03-size-196x196.webm
-6788a561466dace32d500194bf042e19cccc35e1 vp90-2-03-size-196x196.webm.md5
-a170c9a88ec1dd854c7a471ff55fb2a97ac31870 vp90-2-03-size-196x198.webm
-6bf9d6a8e2bdc5bf4f8a78071a3fed5ca02ad6f2 vp90-2-03-size-196x198.webm.md5
-68f861d21c4c8b03d572c3d3fcd9f4fbf1f4503f vp90-2-03-size-196x200.webm
-bbfc260b2bfd872cc6054272bb6b7f959a9e1c6e vp90-2-03-size-196x200.webm.md5
-fc34889feeca2b7e5b27b4f1ce22d2e2b8e3e4b1 vp90-2-03-size-196x202.webm
-158ee72af578f39aad0c3b8f4cbed2fc78b57e0f vp90-2-03-size-196x202.webm.md5
-dd28fb7247af534bdf5e6795a3ac429610489a0b vp90-2-03-size-196x208.webm
-7546be847efce2d1c0a23f807bfb03f91b764e1e vp90-2-03-size-196x208.webm.md5
-41d5cf5ed65b722a1b6dc035e67f978ea8ffecf8 vp90-2-03-size-196x210.webm
-9444fdf632d6a1b6143f4cb10fed8f63c1d67ec1 vp90-2-03-size-196x210.webm.md5
-5007bc618143437c009d6dde5fc2e86f72d37dc2 vp90-2-03-size-196x224.webm
-858361d8f79b44df5545feabbc9754ec9ede632f vp90-2-03-size-196x224.webm.md5
-0bcbe357fbc776c3fa68e7117179574ed7564a44 vp90-2-03-size-196x226.webm
-72006a5f42031a43d70a2cd9fc1958962a86628f vp90-2-03-size-196x226.webm.md5
-000239f048cceaac055558e97ef07078ebf65502 vp90-2-03-size-198x196.webm
-2d6841901b72000c5340f30be602853438c1b787 vp90-2-03-size-198x196.webm.md5
-ae75b766306a6404c3b3b35a6b6d53633c14fbdb vp90-2-03-size-198x198.webm
-3f2544b4f3b4b643a98f2c3b15ea5826fc702fa1 vp90-2-03-size-198x198.webm.md5
-95ffd573fa84ccef1cd59e1583e6054f56a5c83d vp90-2-03-size-198x200.webm
-5d537e3c9b9c54418c79677543454c4cda3de1af vp90-2-03-size-198x200.webm.md5
-ecc845bf574375f469bc91bf5c75c79dc00073d6 vp90-2-03-size-198x202.webm
-1b59f5e111265615a7a459eeda8cc9045178d228 vp90-2-03-size-198x202.webm.md5
-432fb27144fe421b9f51cf44d2750a26133ed585 vp90-2-03-size-198x208.webm
-a58a67f4fb357c73ca078aeecbc0f782975630b1 vp90-2-03-size-198x208.webm.md5
-ff5058e7e6a47435046612afc8536f2040989e6f vp90-2-03-size-198x210.webm
-18d3be7935e52217e2e9400b6f2c681a9e45dc89 vp90-2-03-size-198x210.webm.md5
-a0d55263c1ed2c03817454dd4ec4090d36dbc864 vp90-2-03-size-198x224.webm
-efa366a299817e2da51c00623b165aab9fbb8d91 vp90-2-03-size-198x224.webm.md5
-ccd142fa2920fc85bb753f049160c1c353ad1574 vp90-2-03-size-198x226.webm
-534524a0b2dbff852e0b92ef09939db072f83243 vp90-2-03-size-198x226.webm.md5
-0d483b94ed40abc8ab6e49f960432ee54ad9c7f1 vp90-2-03-size-200x196.webm
-41795f548181717906e7a504ba551f06c32102ae vp90-2-03-size-200x196.webm.md5
-f6c2dc54e0989d50f01333fe40c91661fcbf849a vp90-2-03-size-200x198.webm
-43df5d8c46a40089441392e6d096c588c1079a68 vp90-2-03-size-200x198.webm.md5
-2f6e9df82e44fc145f0d9212dcccbed3de605e23 vp90-2-03-size-200x200.webm
-757b2ef96b82093255725bab9690bbafe27f3caf vp90-2-03-size-200x200.webm.md5
-40c5ea60415642a4a2e75c0d127b06309baadfab vp90-2-03-size-200x202.webm
-3022c4a1c625b5dc04fdb1052d17d45b4171cfba vp90-2-03-size-200x202.webm.md5
-6942ed5b27476bb8506d10e600d6ff60887780ca vp90-2-03-size-200x208.webm
-c4ab8c66f3cf2dc8e8dd7abae9ac21f4d32cd6be vp90-2-03-size-200x208.webm.md5
-71dbc99b83c49d1da45589b91eabb98e2f4a7b1e vp90-2-03-size-200x210.webm
-3f0b40da7eef7974b9bc326562f251feb67d9c7c vp90-2-03-size-200x210.webm.md5
-6b6b8489081cfefb377cc5f18eb754ec2383f655 vp90-2-03-size-200x224.webm
-a259df2ac0e294492e3f9d4315baa34cab044f04 vp90-2-03-size-200x224.webm.md5
-c9adc1c9bb07559349a0b054df4af56f7a6edbb9 vp90-2-03-size-200x226.webm
-714cec61e3575581e4f1a0e3921f4dfdbbd316c5 vp90-2-03-size-200x226.webm.md5
-f9bdc936bdf53f8be9ce78fecd41a21d31ff3943 vp90-2-03-size-202x196.webm
-5b8e2e50fcea2c43b12fc067b8a9cc117af77bda vp90-2-03-size-202x196.webm.md5
-c7b66ea3da87613deb47ff24a111247d3c384fec vp90-2-03-size-202x198.webm
-517e91204b25586da943556f4adc5951c9be8bee vp90-2-03-size-202x198.webm.md5
-935ef56b01cfdb4265a7e24696645209ccb20970 vp90-2-03-size-202x200.webm
-55b8ec4a2513183144a8e27564596c06c7576fce vp90-2-03-size-202x200.webm.md5
-849acf75e4f1d8d90046704e1103a18c64f30e35 vp90-2-03-size-202x202.webm
-c79afc6660df2824e7df314e5bfd71f0d8acf76b vp90-2-03-size-202x202.webm.md5
-17b3a4d55576b770626ccb856b9f1a6c8f6ae476 vp90-2-03-size-202x208.webm
-0b887ff30409c58f2ccdc3bfacd6be7c69f8997a vp90-2-03-size-202x208.webm.md5
-032d0ade4230fb2eef6d19915a7a1c9aa4a52617 vp90-2-03-size-202x210.webm
-f78f8e79533c0c88dd2bfdcec9b1c07848568ece vp90-2-03-size-202x210.webm.md5
-915a38c31fe425d5b93c837121cfa8082f5ea5bc vp90-2-03-size-202x224.webm
-bf52a104074d0c5942aa7a5b31e11db47e43d48e vp90-2-03-size-202x224.webm.md5
-be5cfde35666fa435e47d544d9258215beb1cf29 vp90-2-03-size-202x226.webm
-2fa2f87502fda756b319389c8975204e130a2e3f vp90-2-03-size-202x226.webm.md5
-15d908e97862b5b4bf295610df011fb9aa09909b vp90-2-03-size-208x196.webm
-50c60792305d6a99be376dd596a6ff979325e6cc vp90-2-03-size-208x196.webm.md5
-a367c7bc9fde56d6f4848cc573c7d4c1ce75e348 vp90-2-03-size-208x198.webm
-be85fb2c8d435a75484231356f07d06ebddd13cd vp90-2-03-size-208x198.webm.md5
-05fd46deb7288e7253742091f56e54a9a441a187 vp90-2-03-size-208x200.webm
-74f8ec3b3a2fe81767ed1ab36a47bc0062d6223c vp90-2-03-size-208x200.webm.md5
-d8985c4b386513a7385a4b3639bf91e469f1378b vp90-2-03-size-208x202.webm
-0614a1e8d92048852adcf605a51333f5fabc7f03 vp90-2-03-size-208x202.webm.md5
-28b002242238479165ba4fb87ee6b442c64b32e4 vp90-2-03-size-208x208.webm
-37de5aca59bb900228400b0e115d3229edb9dcc0 vp90-2-03-size-208x208.webm.md5
-c545be0050c2fad7c68427dbf86c62a739e94ab3 vp90-2-03-size-208x210.webm
-d646eccb3cd578f94b54777e32b88898bef6e17a vp90-2-03-size-208x210.webm.md5
-63a0cfe295b661026dd7b1bebb67acace1db766f vp90-2-03-size-208x224.webm
-85c0361d93bf85a335248fef2767ff43eeef23db vp90-2-03-size-208x224.webm.md5
-f911cc718d66e4fe8a865226088939c9eb1b7825 vp90-2-03-size-208x226.webm
-a6d583a57876e7b7ec48625b2b2cdbcf70cab837 vp90-2-03-size-208x226.webm.md5
-5bbb0f36da9a4683cf04e724124d8696332911bf vp90-2-03-size-210x196.webm
-a3580fc7816d7fbcfb54fdba501cabbd06ba2f1d vp90-2-03-size-210x196.webm.md5
-8db64d6f9ce36dd382013b42ae4e292deba697bc vp90-2-03-size-210x198.webm
-eda20f8268c7f4147bead4059e9c4897e09140a9 vp90-2-03-size-210x198.webm.md5
-ce391505eeaf1d12406563101cd6b2dbbbb44bfc vp90-2-03-size-210x200.webm
-79d73b7f623082d2a00aa33e95c79d11c7d9c3a8 vp90-2-03-size-210x200.webm.md5
-852db6fdc206e72391fc69b807f1954934679949 vp90-2-03-size-210x202.webm
-f69414c5677ed2f2b8b37ae76429e509a92276a5 vp90-2-03-size-210x202.webm.md5
-c424cc3edd2308da7d33f27acb36b54db5bf2595 vp90-2-03-size-210x208.webm
-27b18562faa1b3184256f4eae8114b539b3e9d3e vp90-2-03-size-210x208.webm.md5
-dd029eba719d50a2851592fa8b9b2efe88904930 vp90-2-03-size-210x210.webm
-c853a1670465eaa04ca31b3511995f1b6ed4f58f vp90-2-03-size-210x210.webm.md5
-d962e8ae676c54d0c3ea04ec7c04b37ae6a786e3 vp90-2-03-size-210x224.webm
-93b793e79d987065b39ad8e2e71244368435fc25 vp90-2-03-size-210x224.webm.md5
-3d0825fe83bcc125be1f78145ff43ca6d7588784 vp90-2-03-size-210x226.webm
-5230f31a57ca3b5311698a12035d2644533b3ec4 vp90-2-03-size-210x226.webm.md5
-6622f8bd9279e1ce45509a58a31a990052d45e14 vp90-2-03-size-224x196.webm
-65411da07f60113f2be05c807879072b161d561e vp90-2-03-size-224x196.webm.md5
-6744ff2ee2c41eb08c62ff30880833b6d77b585b vp90-2-03-size-224x198.webm
-46ea3641d41acd4bff347b224646c060d5620385 vp90-2-03-size-224x198.webm.md5
-8eb91f3416a1404705f370caecd74b2b458351b1 vp90-2-03-size-224x200.webm
-196aefb854c8b95b9330263d6690b7ee15693ecf vp90-2-03-size-224x200.webm.md5
-256a5a23ef4e6d5ef2871af5afb8cd13d28cec00 vp90-2-03-size-224x202.webm
-840ad8455dcf2be378c14b007e66fa642fc8196d vp90-2-03-size-224x202.webm.md5
-db4606480ab48b96c9a6ff5e639f1f1aea2a12e4 vp90-2-03-size-224x208.webm
-40b9801d5620467499ac70fa6b7c40aaa5e1c331 vp90-2-03-size-224x208.webm.md5
-e37159e687fe1cb24cffddfae059301adbaf4212 vp90-2-03-size-224x210.webm
-1e4acd4b6334ae260c3eed08652d0ba8122073f2 vp90-2-03-size-224x210.webm.md5
-0de1eb4bb6285ae621e4f2b613d2aa4a8c95a130 vp90-2-03-size-224x224.webm
-37db449ad86fb286c2c02d94aa8fe0379c05044a vp90-2-03-size-224x224.webm.md5
-32ebbf903a7d7881bcfe59639f1d472371f3bf27 vp90-2-03-size-224x226.webm
-5cc3ac5dc9f6912491aa2ddac863f8187f34c569 vp90-2-03-size-224x226.webm.md5
-9480ff5c2c32b1870ac760c87514912616e6cf01 vp90-2-03-size-226x196.webm
-fe83655c0f1888f0af7b047785f01ba7ca9f1324 vp90-2-03-size-226x196.webm.md5
-09cad4221996315cdddad4e502dbfabf53ca1d6a vp90-2-03-size-226x198.webm
-e3ddfdc650acb95adb45abd9b634e1f09ea8ac96 vp90-2-03-size-226x198.webm.md5
-c34f49d55fe39e3f0b607e3cc95e30244225cecb vp90-2-03-size-226x200.webm
-abb83edc868a3523ccd4e5523fac2efbe7c3df1f vp90-2-03-size-226x200.webm.md5
-d17bc08eedfc60c4c23d576a6c964a21bf854d1f vp90-2-03-size-226x202.webm
-1d22d2d0f375251c2d5a1acb4714bc35d963865b vp90-2-03-size-226x202.webm.md5
-9bd537c4f92a25596ccd29fedfe181feac948b92 vp90-2-03-size-226x208.webm
-6feb0e7325386275719f3511ada9e248a2ae7df4 vp90-2-03-size-226x208.webm.md5
-4487067f6cedd495b93696b44b37fe0a3e7eda14 vp90-2-03-size-226x210.webm
-49a8fa87945f47208168d541c068e78d878075d5 vp90-2-03-size-226x210.webm.md5
-559fea2f8da42b33c1aa1dbc34d1d6781009847a vp90-2-03-size-226x224.webm
-83c6d8f2969b759e10e5c6542baca1265c874c29 vp90-2-03-size-226x224.webm.md5
-fe0af2ee47b1e5f6a66db369e2d7e9d870b38dce vp90-2-03-size-226x226.webm
-94ad19b8b699cea105e2ff18f0df2afd7242bcf7 vp90-2-03-size-226x226.webm.md5
-b6524e4084d15b5d0caaa3d3d1368db30cbee69c vp90-2-03-deltaq.webm
-65f45ec9a55537aac76104818278e0978f94a678 vp90-2-03-deltaq.webm.md5
-4dbb87494c7f565ffc266c98d17d0d8c7a5c5aba vp90-2-05-resize.ivf
-7f6d8879336239a43dbb6c9f13178cb11cf7ed09 vp90-2-05-resize.ivf.md5
-bf61ddc1f716eba58d4c9837d4e91031d9ce4ffe vp90-2-06-bilinear.webm
-f6235f937552e11d8eb331ec55da6b3aa596b9ac vp90-2-06-bilinear.webm.md5
-495256cfd123fe777b2c0406862ed8468a1f4677 vp91-2-04-yv444.webm
-65e3a7ffef61ab340d9140f335ecc49125970c2c vp91-2-04-yv444.webm.md5
-0c83a1e414fde3bccd6dc451bbaee68e59974c76 vp90-2-07-frame_parallel.webm
-e5c2c9fb383e5bf3b563480adaeba5b7e3475ecd vp90-2-07-frame_parallel.webm.md5
-086c7edcffd699ae7d99d710fd7e53b18910ca5b vp90-2-08-tile_1x2_frame_parallel.webm
-e981ecaabb29a80e0cbc1f4002384965ce8e95bb vp90-2-08-tile_1x2_frame_parallel.webm.md5
-ed79be026a6f28646c5825da1c12d1fbc70f96a4 vp90-2-08-tile_1x2.webm
-45b404e025841c9750895fc1a9f6bd384fe6a315 vp90-2-08-tile_1x2.webm.md5
-cf8ea970c776797aae71dac8317ea926d9431cab vp90-2-08-tile_1x4_frame_parallel.webm
-a481fbea465010b57af5a19ebf6d4a5cfe5b9278 vp90-2-08-tile_1x4_frame_parallel.webm.md5
-0203ec456277a01aec401e7fb6c72c9a7e5e3f9d vp90-2-08-tile_1x4.webm
-c9b237dfcc01c1b414fbcaa481d014a906ef7998 vp90-2-08-tile_1x4.webm.md5
-20c75157e91ab41f82f70ffa73d5d01df8469287 vp90-2-08-tile-4x4.webm
-ae7451810247fd13975cc257aa0301ff17102255 vp90-2-08-tile-4x4.webm.md5
-2ec6e15422ac7a61af072dc5f27fcaf1942ce116 vp90-2-08-tile-4x1.webm
-0094f5ee5e46345017c30e0aa4835b550212d853 vp90-2-08-tile-4x1.webm.md5
-edea45dac4a3c2e5372339f8851d24c9bef803d6 vp90-2-09-subpixel-00.ivf
-5428efc4bf92191faedf4a727fcd1d94966a7abc vp90-2-09-subpixel-00.ivf.md5
-8cdd435d89029987ee196896e21520e5f879f04d vp90-2-bbb_1280x720_tile_1x4_1310kbps.webm
-091b373aa2ecb59aa5c647affd5bcafcc7547364 vp90-2-bbb_1920x1080_tile_1x1_2581kbps.webm
-87ee28032b0963a44b73a850fcc816a6dc83efbb vp90-2-bbb_1920x1080_tile_1x4_2586kbps.webm
-c6ce25c4bfd4bdfc2932b70428e3dfe11210ec4f vp90-2-bbb_1920x1080_tile_1x4_fpm_2304kbps.webm
-2064bdb22aa71c2691e0469fb62e8087a43f08f8 vp90-2-bbb_426x240_tile_1x1_180kbps.webm
-8080eda22694910162f0996e8a962612f381a57f vp90-2-bbb_640x360_tile_1x2_337kbps.webm
-a484b335c27ea189c0f0d77babea4a510ce12d50 vp90-2-bbb_854x480_tile_1x2_651kbps.webm
-3eacf1f006250be4cc5c92a7ef146e385ee62653 vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm
-217f089a16447490823127b36ce0d945522accfd vp90-2-sintel_1920x818_tile_1x4_fpm_2279kbps.webm
-eedb3c641e60dacbe082491a16df529a5c9187df vp90-2-sintel_426x182_tile_1x1_171kbps.webm
-cb7e4955af183dff33bcba0c837f0922ab066400 vp90-2-sintel_640x272_tile_1x2_318kbps.webm
-48613f9380e2580002f8a09d6e412ea4e89a52b9 vp90-2-sintel_854x364_tile_1x2_621kbps.webm
-990a91f24dd284562d21d714ae773dff5452cad8 vp90-2-tos_1280x534_tile_1x4_1306kbps.webm
-b6dd558c90bca466b4bcbd03b3371648186465a7 vp90-2-tos_1920x800_tile_1x4_fpm_2335kbps.webm
-1a9c2914ba932a38f0a143efc1ad0e318e78888b vp90-2-tos_426x178_tile_1x1_181kbps.webm
-a3d2b09f24debad4747a1b3066f572be4273bced vp90-2-tos_640x266_tile_1x2_336kbps.webm
-c64b03b5c090e6888cb39685c31f00a6b79fa45c vp90-2-tos_854x356_tile_1x2_656kbps.webm
-0e7cd4135b231c9cea8d76c19f9e84b6fd77acec vp90-2-08-tile_1x8_frame_parallel.webm
-c9b6850af28579b031791066457f4cb40df6e1c7 vp90-2-08-tile_1x8_frame_parallel.webm.md5
-e448b6e83490bca0f8d58b4f4b1126a17baf4b0c vp90-2-08-tile_1x8.webm
-5e524165f0397e6141d914f4f0a66267d7658376 vp90-2-08-tile_1x8.webm.md5
-a34e14923d6d17b1144254d8187d7f85b700a63c vp90-2-02-size-lf-1920x1080.webm
-e3b28ddcfaeb37fb4d132b93f92642a9ad17c22d vp90-2-02-size-lf-1920x1080.webm.md5
-d48c5db1b0f8e60521a7c749696b8067886033a3 vp90-2-09-aq2.webm
-84c1599298aac78f2fc05ae2274575d10569dfa0 vp90-2-09-aq2.webm.md5
-55fc55ed73d578ed60fad05692579873f8bad758 vp90-2-09-lf_deltas.webm
-54638c38009198c38c8f3b25c182b709b6c1fd2e vp90-2-09-lf_deltas.webm.md5
-510d95f3beb3b51c572611fdaeeece12277dac30 vp90-2-10-show-existing-frame.webm
-14d631096f4bfa2d71f7f739aec1448fb3c33bad vp90-2-10-show-existing-frame.webm.md5
-b4318e75f73a6a08992c7326de2fb589c2a794c7 vp90-2-11-size-351x287.webm
-b3c48382cf7d0454e83a02497c229d27720f9e20 vp90-2-11-size-351x287.webm.md5
-8e0096475ea2535bac71d3e2fc09e0c451c444df vp90-2-11-size-351x288.webm
-19e003804ec1dfc5464813b32339a15d5ba7b42f vp90-2-11-size-351x288.webm.md5
-40cd1d6a188d7a88b21ebac1e573d3f270ab261e vp90-2-11-size-352x287.webm
-68f515abe3858fc1eded46c8e6b2f727d43b5331 vp90-2-11-size-352x287.webm.md5
-9a510769ff23db410880ec3029d433e87d17f7fc vp90-2-12-droppable_1.ivf
-952eaac6eefa6f62179ed1db3e922fd42fecc624 vp90-2-12-droppable_1.ivf.md5
-9a510769ff23db410880ec3029d433e87d17f7fc vp90-2-12-droppable_2.ivf
-92a756469fa438220524e7fa6ac1d38c89514d17 vp90-2-12-droppable_2.ivf.md5
-c21e97e4ba486520118d78b01a5cb6e6dc33e190 vp90-2-12-droppable_3.ivf
-601abc9e4176c70f82ac0381365e9b151fdd24cd vp90-2-12-droppable_3.ivf.md5
-61c640dad23cd4f7ad811b867e7b7e3521f4e3ba vp90-2-13-largescaling.webm
-bca1b02eebdb088fa3f389fe0e7571e75a71f523 vp90-2-13-largescaling.webm.md5
diff --git a/videocodec/libvpx_internal/libvpx/test/test.mk b/videocodec/libvpx_internal/libvpx/test/test.mk
deleted file mode 100644
index 4d96bc6..0000000
--- a/videocodec/libvpx_internal/libvpx/test/test.mk
+++ /dev/null
@@ -1,740 +0,0 @@
-LIBVPX_TEST_SRCS-yes += acm_random.h
-LIBVPX_TEST_SRCS-yes += clear_system_state.h
-LIBVPX_TEST_SRCS-yes += codec_factory.h
-LIBVPX_TEST_SRCS-yes += md5_helper.h
-LIBVPX_TEST_SRCS-yes += register_state_check.h
-LIBVPX_TEST_SRCS-yes += test.mk
-LIBVPX_TEST_SRCS-yes += test_libvpx.cc
-LIBVPX_TEST_SRCS-yes += test_vectors.cc
-LIBVPX_TEST_SRCS-yes += test_vectors.h
-LIBVPX_TEST_SRCS-yes += util.h
-LIBVPX_TEST_SRCS-yes += video_source.h
-
-##
-## BLACK BOX TESTS
-##
-## Black box tests only use the public API.
-##
-LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../md5_utils.h ../md5_utils.c
-LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ivf_video_source.h
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += ../y4minput.h ../y4minput.c
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += aq_segment_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += datarate_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += y4m_video_source.h
-
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += altref_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
-
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += cpu_speed_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += resize_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_lossless_test.cc
-
-LIBVPX_TEST_SRCS-yes += decode_test_driver.cc
-LIBVPX_TEST_SRCS-yes += decode_test_driver.h
-LIBVPX_TEST_SRCS-yes += encode_test_driver.cc
-LIBVPX_TEST_SRCS-yes += encode_test_driver.h
-
-## WebM Parsing
-NESTEGG_SRCS += ../third_party/nestegg/halloc/halloc.h
-NESTEGG_SRCS += ../third_party/nestegg/halloc/src/align.h
-NESTEGG_SRCS += ../third_party/nestegg/halloc/src/halloc.c
-NESTEGG_SRCS += ../third_party/nestegg/halloc/src/hlist.h
-NESTEGG_SRCS += ../third_party/nestegg/include/nestegg/nestegg.h
-NESTEGG_SRCS += ../third_party/nestegg/src/nestegg.c
-LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += $(NESTEGG_SRCS)
-LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += webm_video_source.h
-
-LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += test_vector_test.cc
-
-# Currently we only support decoder perf tests for vp9
-ifeq ($(CONFIG_DECODE_PERF_TESTS)$(CONFIG_VP9_DECODER), yesyes)
-LIBVPX_TEST_SRCS-yes += decode_perf_test.cc
-endif
-
-##
-## WHITE BOX TESTS
-##
-## Whitebox tests invoke functions not exposed via the public API. Certain
-## shared library builds don't make these functions accessible.
-##
-ifeq ($(CONFIG_SHARED),)
-
-## VP8
-ifneq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),)
-
-# These tests require both the encoder and decoder to be built.
-ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),yesyes)
-LIBVPX_TEST_SRCS-yes += vp8_boolcoder_test.cc
-endif
-
-LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC) += pp_filter_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += vp8_decrypt_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += set_roi.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += subtract_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += variance_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += vp8_fdct4x4_test.cc
-
-LIBVPX_TEST_SRCS-yes += idct_test.cc
-LIBVPX_TEST_SRCS-yes += intrapred_test.cc
-LIBVPX_TEST_SRCS-yes += sixtap_predict_test.cc
-
-endif # VP8
-
-## VP9
-ifneq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),)
-
-# These tests require both the encoder and decoder to be built.
-ifeq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),yesyes)
-# IDCT test currently depends on FDCT function
-LIBVPX_TEST_SRCS-yes += idct8x8_test.cc
-LIBVPX_TEST_SRCS-yes += partial_idct_test.cc
-LIBVPX_TEST_SRCS-yes += superframe_test.cc
-LIBVPX_TEST_SRCS-yes += tile_independence_test.cc
-LIBVPX_TEST_SRCS-yes += vp9_boolcoder_test.cc
-
-endif
-
-LIBVPX_TEST_SRCS-$(CONFIG_VP9) += convolve_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_thread_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct16x16_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct32x32_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct8x8_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += variance_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_subtract_test.cc
-
-endif # VP9
-
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc
-
-endif # CONFIG_SHARED
-
-
-##
-## TEST DATA
-##
-LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.yuv
-LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.stat
-LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_odd.yuv
-LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += rush_hour_444.y4m
-
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-004.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-004.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-005.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-005.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-006.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-006.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-007.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-007.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-008.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-008.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-009.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-009.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-010.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-010.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-011.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-011.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-012.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-012.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-013.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-013.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-014.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-014.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-015.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-015.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-016.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-016.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-017.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-017.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-018.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-018.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1400.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1400.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1411.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1411.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1416.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1416.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1417.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1417.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1402.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1402.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1412.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1412.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1418.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1418.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1424.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1424.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-01.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-01.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-02.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-02.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-03.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-03.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-04.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-04.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1401.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1401.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1403.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1403.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1407.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1407.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1408.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1408.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1409.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1409.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1410.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1410.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1413.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1413.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1414.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1414.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1415.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1415.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1425.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1425.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1426.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1426.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1427.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1427.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1432.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1432.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1435.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1435.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1436.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1436.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1437.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1437.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1441.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1441.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1442.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1442.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1404.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1404.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1405.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1405.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1406.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1406.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1428.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1428.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1429.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1429.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1430.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1430.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1431.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1431.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1433.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1433.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1434.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1434.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1438.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1438.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1439.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1439.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1440.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1440.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1443.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1443.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-06-smallsize.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-06-smallsize.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-00.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-00.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-01.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-01.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-02.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-02.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-03.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-03.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-04.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-04.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-05.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-05.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-06.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-06.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-07.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-07.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-09.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-09.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-11.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-11.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-12.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-12.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-13.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-13.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-14.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-14.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-15.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-15.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-17.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-17.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-19.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-19.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-20.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-20.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-21.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-21.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-22.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-22.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-23.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-23.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-24.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-24.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-25.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-25.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-26.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-26.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-27.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-27.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-28.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-28.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-29.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-29.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-30.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-30.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-31.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-31.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-33.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-33.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-35.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-35.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-36.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-36.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-37.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-37.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-38.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-38.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-39.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-39.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-40.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-40.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-41.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-41.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-42.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-42.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-43.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-43.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-44.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-44.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-45.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-45.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-46.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-46.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-47.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-47.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-48.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-48.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-49.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-49.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-50.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-50.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-51.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-51.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-52.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-52.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-53.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-53.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-54.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-54.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-55.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-55.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-56.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-56.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-57.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-57.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-58.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-58.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-59.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-59.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-60.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-60.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-61.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-61.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-62.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-62.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-63.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-00-quantizer-63.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-1.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-1.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-2.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-2.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-3.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-3.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-4.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-4.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-5.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-5.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-6.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-6.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-7.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-01-sharpness-7.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-08x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-10x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-16x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-18x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-32x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-34x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-64x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x08.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x08.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x10.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x10.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x16.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x16.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x18.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x18.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x32.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x32.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x34.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x34.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x64.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x64.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x66.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-66x66.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-lf-1920x1080.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-02-size-lf-1920x1080.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-deltaq.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-deltaq.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-196x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-198x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-200x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-202x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-208x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-210x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-224x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x196.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x196.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x198.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x198.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x200.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x200.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x202.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x202.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x208.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x208.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x210.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x210.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x224.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x224.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x226.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-03-size-226x226.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-05-resize.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-05-resize.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-06-bilinear.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-06-bilinear.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-07-frame_parallel.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-07-frame_parallel.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x1.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x1.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x4.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile-4x4.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2_frame_parallel.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x2_frame_parallel.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4_frame_parallel.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x4_frame_parallel.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8_frame_parallel.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-08-tile_1x8_frame_parallel.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-aq2.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-aq2.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-lf_deltas.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-lf_deltas.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-subpixel-00.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-09-subpixel-00.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-10-show-existing-frame.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-10-show-existing-frame.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x287.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x287.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x288.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-351x288.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-352x287.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-11-size-352x287.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_1.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_1.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_2.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_2.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_3.ivf
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-12-droppable_3.ivf.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-13-largescaling.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp90-2-13-largescaling.webm.md5
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp91-2-04-yv444.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += vp91-2-04-yv444.webm.md5
-
-ifeq ($(CONFIG_DECODE_PERF_TESTS),yes)
-# BBB VP9 streams
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-bbb_426x240_tile_1x1_180kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-bbb_640x360_tile_1x2_337kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-bbb_854x480_tile_1x2_651kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-bbb_1280x720_tile_1x4_1310kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-bbb_1920x1080_tile_1x1_2581kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-bbb_1920x1080_tile_1x4_2586kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-bbb_1920x1080_tile_1x4_fpm_2304kbps.webm
-#Sintel VP9 streams
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-sintel_426x182_tile_1x1_171kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-sintel_640x272_tile_1x2_318kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-sintel_854x364_tile_1x2_621kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-sintel_1280x546_tile_1x4_1257kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-sintel_1920x818_tile_1x4_fpm_2279kbps.webm
-# TOS VP9 streams
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-tos_426x178_tile_1x1_181kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-tos_640x266_tile_1x2_336kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-tos_854x356_tile_1x2_656kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-tos_1280x534_tile_1x4_1306kbps.webm
-LIBVPX_TEST_DATA-$(CONFIG_VP9_DECODER) += \
- vp90-2-tos_1920x800_tile_1x4_fpm_2335kbps.webm
-endif # CONFIG_DECODE_PERF_TESTS
diff --git a/videocodec/libvpx_internal/libvpx/test/test_libvpx.cc b/videocodec/libvpx_internal/libvpx/test/test_libvpx.cc
deleted file mode 100644
index ee67aae..0000000
--- a/videocodec/libvpx_internal/libvpx/test/test_libvpx.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <string>
-#include "./vpx_config.h"
-#if ARCH_X86_32 || ARCH_X86_64
-#include "vpx_ports/x86.h"
-#endif
-extern "C" {
-#if CONFIG_VP8
-extern void vp8_rtcd();
-#endif
-#if CONFIG_VP9
-extern void vp9_rtcd();
-#endif
-}
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-static void append_negative_gtest_filter(const char *str) {
- std::string filter = ::testing::FLAGS_gtest_filter;
- // Negative patterns begin with one '-' followed by a ':' separated list.
- if (filter.find('-') == std::string::npos) filter += '-';
- filter += str;
- ::testing::FLAGS_gtest_filter = filter;
-}
-
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
-
-#if ARCH_X86_32 || ARCH_X86_64
- const int simd_caps = x86_simd_caps();
- if (!(simd_caps & HAS_MMX))
- append_negative_gtest_filter(":MMX/*");
- if (!(simd_caps & HAS_SSE))
- append_negative_gtest_filter(":SSE/*");
- if (!(simd_caps & HAS_SSE2))
- append_negative_gtest_filter(":SSE2/*");
- if (!(simd_caps & HAS_SSE3))
- append_negative_gtest_filter(":SSE3/*");
- if (!(simd_caps & HAS_SSSE3))
- append_negative_gtest_filter(":SSSE3/*");
- if (!(simd_caps & HAS_SSE4_1))
- append_negative_gtest_filter(":SSE4_1/*");
- if (!(simd_caps & HAS_AVX))
- append_negative_gtest_filter(":AVX/*");
- if (!(simd_caps & HAS_AVX2))
- append_negative_gtest_filter(":AVX2/*");
-#endif
-
-#if !CONFIG_SHARED
-// Shared library builds don't support whitebox tests
-// that exercise internal symbols.
-
-#if CONFIG_VP8
- vp8_rtcd();
-#endif
-#if CONFIG_VP9
- vp9_rtcd();
-#endif
-#endif
-
- return RUN_ALL_TESTS();
-}
diff --git a/videocodec/libvpx_internal/libvpx/test/test_vector_test.cc b/videocodec/libvpx_internal/libvpx/test/test_vector_test.cc
deleted file mode 100644
index 9ba18da..0000000
--- a/videocodec/libvpx_internal/libvpx/test/test_vector_test.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/decode_test_driver.h"
-#include "test/ivf_video_source.h"
-#include "test/md5_helper.h"
-#include "test/test_vectors.h"
-#include "test/util.h"
-#include "test/webm_video_source.h"
-#include "vpx_mem/vpx_mem.h"
-
-namespace {
-
-class TestVectorTest : public ::libvpx_test::DecoderTest,
- public ::libvpx_test::CodecTestWithParam<const char*> {
- protected:
- TestVectorTest() : DecoderTest(GET_PARAM(0)), md5_file_(NULL) {}
-
- virtual ~TestVectorTest() {
- if (md5_file_)
- fclose(md5_file_);
- }
-
- void OpenMD5File(const std::string& md5_file_name_) {
- md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
- ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "
- << md5_file_name_;
- }
-
- virtual void DecompressedFrameHook(const vpx_image_t& img,
- const unsigned int frame_number) {
- ASSERT_TRUE(md5_file_ != NULL);
- char expected_md5[33];
- char junk[128];
-
- // Read correct md5 checksums.
- const int res = fscanf(md5_file_, "%s %s", expected_md5, junk);
- ASSERT_NE(res, EOF) << "Read md5 data failed";
- expected_md5[32] = '\0';
-
- ::libvpx_test::MD5 md5_res;
- md5_res.Add(&img);
- const char *actual_md5 = md5_res.Get();
-
- // Check md5 match.
- ASSERT_STREQ(expected_md5, actual_md5)
- << "Md5 checksums don't match: frame number = " << frame_number;
- }
-
- private:
- FILE *md5_file_;
-};
-
-// This test runs through the whole set of test vectors, and decodes them.
-// The md5 checksums are computed for each frame in the video file. If md5
-// checksums match the correct md5 data, then the test is passed. Otherwise,
-// the test failed.
-TEST_P(TestVectorTest, MD5Match) {
- const std::string filename = GET_PARAM(1);
- libvpx_test::CompressedVideoSource *video = NULL;
-
- // Open compressed video file.
- if (filename.substr(filename.length() - 3, 3) == "ivf") {
- video = new libvpx_test::IVFVideoSource(filename);
- } else if (filename.substr(filename.length() - 4, 4) == "webm") {
- video = new libvpx_test::WebMVideoSource(filename);
- }
- video->Init();
-
- // Construct md5 file name.
- const std::string md5_filename = filename + ".md5";
- OpenMD5File(md5_filename);
-
- // Decode frame, and check the md5 matching.
- ASSERT_NO_FATAL_FAILURE(RunLoop(video));
- delete video;
-}
-
-VP8_INSTANTIATE_TEST_CASE(TestVectorTest,
- ::testing::ValuesIn(libvpx_test::kVP8TestVectors,
- libvpx_test::kVP8TestVectors +
- libvpx_test::kNumVP8TestVectors));
-VP9_INSTANTIATE_TEST_CASE(TestVectorTest,
- ::testing::ValuesIn(libvpx_test::kVP9TestVectors,
- libvpx_test::kVP9TestVectors +
- libvpx_test::kNumVP9TestVectors));
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/test_vectors.cc b/videocodec/libvpx_internal/libvpx/test/test_vectors.cc
deleted file mode 100644
index 8c789ff..0000000
--- a/videocodec/libvpx_internal/libvpx/test/test_vectors.cc
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "test/test_vectors.h"
-
-namespace libvpx_test {
-
-#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0]))
-
-#if CONFIG_VP8_DECODER
-const char *const kVP8TestVectors[] = {
- "vp80-00-comprehensive-001.ivf",
- "vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf",
- "vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf",
- "vp80-00-comprehensive-006.ivf", "vp80-00-comprehensive-007.ivf",
- "vp80-00-comprehensive-008.ivf", "vp80-00-comprehensive-009.ivf",
- "vp80-00-comprehensive-010.ivf", "vp80-00-comprehensive-011.ivf",
- "vp80-00-comprehensive-012.ivf", "vp80-00-comprehensive-013.ivf",
- "vp80-00-comprehensive-014.ivf", "vp80-00-comprehensive-015.ivf",
- "vp80-00-comprehensive-016.ivf", "vp80-00-comprehensive-017.ivf",
- "vp80-00-comprehensive-018.ivf", "vp80-01-intra-1400.ivf",
- "vp80-01-intra-1411.ivf", "vp80-01-intra-1416.ivf",
- "vp80-01-intra-1417.ivf", "vp80-02-inter-1402.ivf",
- "vp80-02-inter-1412.ivf", "vp80-02-inter-1418.ivf",
- "vp80-02-inter-1424.ivf", "vp80-03-segmentation-01.ivf",
- "vp80-03-segmentation-02.ivf", "vp80-03-segmentation-03.ivf",
- "vp80-03-segmentation-04.ivf", "vp80-03-segmentation-1401.ivf",
- "vp80-03-segmentation-1403.ivf", "vp80-03-segmentation-1407.ivf",
- "vp80-03-segmentation-1408.ivf", "vp80-03-segmentation-1409.ivf",
- "vp80-03-segmentation-1410.ivf", "vp80-03-segmentation-1413.ivf",
- "vp80-03-segmentation-1414.ivf", "vp80-03-segmentation-1415.ivf",
- "vp80-03-segmentation-1425.ivf", "vp80-03-segmentation-1426.ivf",
- "vp80-03-segmentation-1427.ivf", "vp80-03-segmentation-1432.ivf",
- "vp80-03-segmentation-1435.ivf", "vp80-03-segmentation-1436.ivf",
- "vp80-03-segmentation-1437.ivf", "vp80-03-segmentation-1441.ivf",
- "vp80-03-segmentation-1442.ivf", "vp80-04-partitions-1404.ivf",
- "vp80-04-partitions-1405.ivf", "vp80-04-partitions-1406.ivf",
- "vp80-05-sharpness-1428.ivf", "vp80-05-sharpness-1429.ivf",
- "vp80-05-sharpness-1430.ivf", "vp80-05-sharpness-1431.ivf",
- "vp80-05-sharpness-1433.ivf", "vp80-05-sharpness-1434.ivf",
- "vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf",
- "vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf",
- "vp80-06-smallsize.ivf"
-};
-const int kNumVP8TestVectors = NELEMENTS(kVP8TestVectors);
-#endif // CONFIG_VP8_DECODER
-#if CONFIG_VP9_DECODER
-const char *const kVP9TestVectors[] = {
- "vp90-2-00-quantizer-00.webm", "vp90-2-00-quantizer-01.webm",
- "vp90-2-00-quantizer-02.webm", "vp90-2-00-quantizer-03.webm",
- "vp90-2-00-quantizer-04.webm", "vp90-2-00-quantizer-05.webm",
- "vp90-2-00-quantizer-06.webm", "vp90-2-00-quantizer-07.webm",
- "vp90-2-00-quantizer-08.webm", "vp90-2-00-quantizer-09.webm",
- "vp90-2-00-quantizer-10.webm", "vp90-2-00-quantizer-11.webm",
- "vp90-2-00-quantizer-12.webm", "vp90-2-00-quantizer-13.webm",
- "vp90-2-00-quantizer-14.webm", "vp90-2-00-quantizer-15.webm",
- "vp90-2-00-quantizer-16.webm", "vp90-2-00-quantizer-17.webm",
- "vp90-2-00-quantizer-18.webm", "vp90-2-00-quantizer-19.webm",
- "vp90-2-00-quantizer-20.webm", "vp90-2-00-quantizer-21.webm",
- "vp90-2-00-quantizer-22.webm", "vp90-2-00-quantizer-23.webm",
- "vp90-2-00-quantizer-24.webm", "vp90-2-00-quantizer-25.webm",
- "vp90-2-00-quantizer-26.webm", "vp90-2-00-quantizer-27.webm",
- "vp90-2-00-quantizer-28.webm", "vp90-2-00-quantizer-29.webm",
- "vp90-2-00-quantizer-30.webm", "vp90-2-00-quantizer-31.webm",
- "vp90-2-00-quantizer-32.webm", "vp90-2-00-quantizer-33.webm",
- "vp90-2-00-quantizer-34.webm", "vp90-2-00-quantizer-35.webm",
- "vp90-2-00-quantizer-36.webm", "vp90-2-00-quantizer-37.webm",
- "vp90-2-00-quantizer-38.webm", "vp90-2-00-quantizer-39.webm",
- "vp90-2-00-quantizer-40.webm", "vp90-2-00-quantizer-41.webm",
- "vp90-2-00-quantizer-42.webm", "vp90-2-00-quantizer-43.webm",
- "vp90-2-00-quantizer-44.webm", "vp90-2-00-quantizer-45.webm",
- "vp90-2-00-quantizer-46.webm", "vp90-2-00-quantizer-47.webm",
- "vp90-2-00-quantizer-48.webm", "vp90-2-00-quantizer-49.webm",
- "vp90-2-00-quantizer-50.webm", "vp90-2-00-quantizer-51.webm",
- "vp90-2-00-quantizer-52.webm", "vp90-2-00-quantizer-53.webm",
- "vp90-2-00-quantizer-54.webm", "vp90-2-00-quantizer-55.webm",
- "vp90-2-00-quantizer-56.webm", "vp90-2-00-quantizer-57.webm",
- "vp90-2-00-quantizer-58.webm", "vp90-2-00-quantizer-59.webm",
- "vp90-2-00-quantizer-60.webm", "vp90-2-00-quantizer-61.webm",
- "vp90-2-00-quantizer-62.webm", "vp90-2-00-quantizer-63.webm",
- "vp90-2-01-sharpness-1.webm", "vp90-2-01-sharpness-2.webm",
- "vp90-2-01-sharpness-3.webm", "vp90-2-01-sharpness-4.webm",
- "vp90-2-01-sharpness-5.webm", "vp90-2-01-sharpness-6.webm",
- "vp90-2-01-sharpness-7.webm", "vp90-2-02-size-08x08.webm",
- "vp90-2-02-size-08x10.webm", "vp90-2-02-size-08x16.webm",
- "vp90-2-02-size-08x18.webm", "vp90-2-02-size-08x32.webm",
- "vp90-2-02-size-08x34.webm", "vp90-2-02-size-08x64.webm",
- "vp90-2-02-size-08x66.webm", "vp90-2-02-size-10x08.webm",
- "vp90-2-02-size-10x10.webm", "vp90-2-02-size-10x16.webm",
- "vp90-2-02-size-10x18.webm", "vp90-2-02-size-10x32.webm",
- "vp90-2-02-size-10x34.webm", "vp90-2-02-size-10x64.webm",
- "vp90-2-02-size-10x66.webm", "vp90-2-02-size-16x08.webm",
- "vp90-2-02-size-16x10.webm", "vp90-2-02-size-16x16.webm",
- "vp90-2-02-size-16x18.webm", "vp90-2-02-size-16x32.webm",
- "vp90-2-02-size-16x34.webm", "vp90-2-02-size-16x64.webm",
- "vp90-2-02-size-16x66.webm", "vp90-2-02-size-18x08.webm",
- "vp90-2-02-size-18x10.webm", "vp90-2-02-size-18x16.webm",
- "vp90-2-02-size-18x18.webm", "vp90-2-02-size-18x32.webm",
- "vp90-2-02-size-18x34.webm", "vp90-2-02-size-18x64.webm",
- "vp90-2-02-size-18x66.webm", "vp90-2-02-size-32x08.webm",
- "vp90-2-02-size-32x10.webm", "vp90-2-02-size-32x16.webm",
- "vp90-2-02-size-32x18.webm", "vp90-2-02-size-32x32.webm",
- "vp90-2-02-size-32x34.webm", "vp90-2-02-size-32x64.webm",
- "vp90-2-02-size-32x66.webm", "vp90-2-02-size-34x08.webm",
- "vp90-2-02-size-34x10.webm", "vp90-2-02-size-34x16.webm",
- "vp90-2-02-size-34x18.webm", "vp90-2-02-size-34x32.webm",
- "vp90-2-02-size-34x34.webm", "vp90-2-02-size-34x64.webm",
- "vp90-2-02-size-34x66.webm", "vp90-2-02-size-64x08.webm",
- "vp90-2-02-size-64x10.webm", "vp90-2-02-size-64x16.webm",
- "vp90-2-02-size-64x18.webm", "vp90-2-02-size-64x32.webm",
- "vp90-2-02-size-64x34.webm", "vp90-2-02-size-64x64.webm",
- "vp90-2-02-size-64x66.webm", "vp90-2-02-size-66x08.webm",
- "vp90-2-02-size-66x10.webm", "vp90-2-02-size-66x16.webm",
- "vp90-2-02-size-66x18.webm", "vp90-2-02-size-66x32.webm",
- "vp90-2-02-size-66x34.webm", "vp90-2-02-size-66x64.webm",
- "vp90-2-02-size-66x66.webm", "vp90-2-03-size-196x196.webm",
- "vp90-2-03-size-196x198.webm", "vp90-2-03-size-196x200.webm",
- "vp90-2-03-size-196x202.webm", "vp90-2-03-size-196x208.webm",
- "vp90-2-03-size-196x210.webm", "vp90-2-03-size-196x224.webm",
- "vp90-2-03-size-196x226.webm", "vp90-2-03-size-198x196.webm",
- "vp90-2-03-size-198x198.webm", "vp90-2-03-size-198x200.webm",
- "vp90-2-03-size-198x202.webm", "vp90-2-03-size-198x208.webm",
- "vp90-2-03-size-198x210.webm", "vp90-2-03-size-198x224.webm",
- "vp90-2-03-size-198x226.webm", "vp90-2-03-size-200x196.webm",
- "vp90-2-03-size-200x198.webm", "vp90-2-03-size-200x200.webm",
- "vp90-2-03-size-200x202.webm", "vp90-2-03-size-200x208.webm",
- "vp90-2-03-size-200x210.webm", "vp90-2-03-size-200x224.webm",
- "vp90-2-03-size-200x226.webm", "vp90-2-03-size-202x196.webm",
- "vp90-2-03-size-202x198.webm", "vp90-2-03-size-202x200.webm",
- "vp90-2-03-size-202x202.webm", "vp90-2-03-size-202x208.webm",
- "vp90-2-03-size-202x210.webm", "vp90-2-03-size-202x224.webm",
- "vp90-2-03-size-202x226.webm", "vp90-2-03-size-208x196.webm",
- "vp90-2-03-size-208x198.webm", "vp90-2-03-size-208x200.webm",
- "vp90-2-03-size-208x202.webm", "vp90-2-03-size-208x208.webm",
- "vp90-2-03-size-208x210.webm", "vp90-2-03-size-208x224.webm",
- "vp90-2-03-size-208x226.webm", "vp90-2-03-size-210x196.webm",
- "vp90-2-03-size-210x198.webm", "vp90-2-03-size-210x200.webm",
- "vp90-2-03-size-210x202.webm", "vp90-2-03-size-210x208.webm",
- "vp90-2-03-size-210x210.webm", "vp90-2-03-size-210x224.webm",
- "vp90-2-03-size-210x226.webm", "vp90-2-03-size-224x196.webm",
- "vp90-2-03-size-224x198.webm", "vp90-2-03-size-224x200.webm",
- "vp90-2-03-size-224x202.webm", "vp90-2-03-size-224x208.webm",
- "vp90-2-03-size-224x210.webm", "vp90-2-03-size-224x224.webm",
- "vp90-2-03-size-224x226.webm", "vp90-2-03-size-226x196.webm",
- "vp90-2-03-size-226x198.webm", "vp90-2-03-size-226x200.webm",
- "vp90-2-03-size-226x202.webm", "vp90-2-03-size-226x208.webm",
- "vp90-2-03-size-226x210.webm", "vp90-2-03-size-226x224.webm",
- "vp90-2-03-size-226x226.webm", "vp90-2-03-deltaq.webm",
- "vp90-2-05-resize.ivf", "vp90-2-06-bilinear.webm",
- "vp90-2-07-frame_parallel.webm", "vp90-2-08-tile_1x2_frame_parallel.webm",
- "vp90-2-08-tile_1x2.webm", "vp90-2-08-tile_1x4_frame_parallel.webm",
- "vp90-2-08-tile_1x4.webm", "vp90-2-08-tile_1x8_frame_parallel.webm",
- "vp90-2-08-tile_1x8.webm", "vp90-2-08-tile-4x4.webm",
- "vp90-2-08-tile-4x1.webm", "vp90-2-09-subpixel-00.ivf",
- "vp90-2-02-size-lf-1920x1080.webm", "vp90-2-09-aq2.webm",
- "vp90-2-09-lf_deltas.webm", "vp90-2-10-show-existing-frame.webm",
- "vp90-2-11-size-351x287.webm", "vp90-2-11-size-351x288.webm",
- "vp90-2-11-size-352x287.webm", "vp90-2-12-droppable_1.ivf",
- "vp90-2-12-droppable_2.ivf", "vp90-2-12-droppable_3.ivf",
- "vp90-2-13-largescaling.webm", "vp91-2-04-yv444.webm"
-};
-const int kNumVP9TestVectors = NELEMENTS(kVP9TestVectors);
-#endif // CONFIG_VP9_DECODER
-
-} // namespace libvpx_test
diff --git a/videocodec/libvpx_internal/libvpx/test/test_vectors.h b/videocodec/libvpx_internal/libvpx/test/test_vectors.h
deleted file mode 100644
index 8e1aabb..0000000
--- a/videocodec/libvpx_internal/libvpx/test/test_vectors.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_TEST_VECTORS_H_
-#define TEST_TEST_VECTORS_H_
-
-#include "./vpx_config.h"
-
-namespace libvpx_test {
-
-#if CONFIG_VP8_DECODER
-extern const int kNumVP8TestVectors;
-extern const char *const kVP8TestVectors[];
-#endif
-
-#if CONFIG_VP9_DECODER
-extern const int kNumVP9TestVectors;
-extern const char *const kVP9TestVectors[];
-#endif // CONFIG_VP9_DECODER
-
-} // namespace libvpx_test
-
-#endif // TEST_TEST_VECTORS_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/tile_independence_test.cc b/videocodec/libvpx_internal/libvpx/test/tile_independence_test.cc
deleted file mode 100644
index d714452..0000000
--- a/videocodec/libvpx_internal/libvpx/test/tile_independence_test.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-#include "test/md5_helper.h"
-#include "vpx_mem/vpx_mem.h"
-
-namespace {
-class TileIndependenceTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<int> {
- protected:
- TileIndependenceTest()
- : EncoderTest(GET_PARAM(0)),
- md5_fw_order_(),
- md5_inv_order_(),
- n_tiles_(GET_PARAM(1)) {
- init_flags_ = VPX_CODEC_USE_PSNR;
- vpx_codec_dec_cfg_t cfg;
- cfg.w = 704;
- cfg.h = 144;
- cfg.threads = 1;
- fw_dec_ = codec_->CreateDecoder(cfg, 0);
- inv_dec_ = codec_->CreateDecoder(cfg, 0);
- inv_dec_->Control(VP9_INVERT_TILE_DECODE_ORDER, 1);
- }
-
- virtual ~TileIndependenceTest() {
- delete fw_dec_;
- delete inv_dec_;
- }
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(libvpx_test::kTwoPassGood);
- }
-
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
- if (video->frame() == 1) {
- encoder->Control(VP9E_SET_TILE_COLUMNS, n_tiles_);
- }
- }
-
- void UpdateMD5(::libvpx_test::Decoder *dec, const vpx_codec_cx_pkt_t *pkt,
- ::libvpx_test::MD5 *md5) {
- const vpx_codec_err_t res = dec->DecodeFrame(
- reinterpret_cast<uint8_t*>(pkt->data.frame.buf), pkt->data.frame.sz);
- if (res != VPX_CODEC_OK) {
- abort_ = true;
- ASSERT_EQ(VPX_CODEC_OK, res);
- }
- const vpx_image_t *img = dec->GetDxData().Next();
- md5->Add(img);
- }
-
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- UpdateMD5(fw_dec_, pkt, &md5_fw_order_);
- UpdateMD5(inv_dec_, pkt, &md5_inv_order_);
- }
-
- ::libvpx_test::MD5 md5_fw_order_, md5_inv_order_;
- ::libvpx_test::Decoder *fw_dec_, *inv_dec_;
-
- private:
- int n_tiles_;
-};
-
-// run an encode with 2 or 4 tiles, and do the decode both in normal and
-// inverted tile ordering. Ensure that the MD5 of the output in both cases
-// is identical. If so, tiles are considered independent and the test passes.
-TEST_P(TileIndependenceTest, MD5Match) {
- const vpx_rational timebase = { 33333333, 1000000000 };
- cfg_.g_timebase = timebase;
- cfg_.rc_target_bitrate = 500;
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_end_usage = VPX_VBR;
-
- libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 704, 144,
- timebase.den, timebase.num, 0, 30);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-
- const char *md5_fw_str = md5_fw_order_.Get();
- const char *md5_inv_str = md5_inv_order_.Get();
-
- // could use ASSERT_EQ(!memcmp(.., .., 16) here, but this gives nicer
- // output if it fails. Not sure if it's helpful since it's really just
- // a MD5...
- ASSERT_STREQ(md5_fw_str, md5_inv_str);
-}
-
-VP9_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Range(0, 2, 1));
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/tools_common.sh b/videocodec/libvpx_internal/libvpx/test/tools_common.sh
deleted file mode 100644
index cd79771..0000000
--- a/videocodec/libvpx_internal/libvpx/test/tools_common.sh
+++ /dev/null
@@ -1,437 +0,0 @@
-#!/bin/sh
-##
-## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-## This file contains shell code shared by test scripts for libvpx tools.
-set -e
-
-# Sets $VPX_TOOL_TEST to the name specified by positional parameter one.
-test_begin() {
- VPX_TOOL_TEST="${1}"
-}
-
-# Clears the VPX_TOOL_TEST variable after confirming that $VPX_TOOL_TEST matches
-# positional parameter one.
-test_end() {
- if [ "$1" != "${VPX_TOOL_TEST}" ]; then
- echo "FAIL completed test mismatch!."
- echo " completed test: ${1}"
- echo " active test: ${VPX_TOOL_TEST}."
- return 1
- fi
- VPX_TOOL_TEST='<unset>'
-}
-
-# Echoes the target configuration being tested.
-test_configuration_target() {
- vpx_config_mk="${LIBVPX_CONFIG_PATH}/config.mk"
- # Find the TOOLCHAIN line, split it using ':=' as the field separator, and
- # print the last field to get the value. Then pipe the value to tr to consume
- # any leading/trailing spaces while allowing tr to echo the output to stdout.
- awk -F ':=' '/TOOLCHAIN/ { print $NF }' "${vpx_config_mk}" | tr -d ' '
-}
-
-# Trap function used for failure reports and tool output directory removal.
-# When the contents of $VPX_TOOL_TEST do not match the string '<unset>', reports
-# failure of test stored in $VPX_TOOL_TEST.
-cleanup() {
- if [ -n "${VPX_TOOL_TEST}" ] && [ "${VPX_TOOL_TEST}" != '<unset>' ]; then
- echo "FAIL: $VPX_TOOL_TEST"
- fi
- if [ -n "${VPX_TEST_OUTPUT_DIR}" ] && [ -d "${VPX_TEST_OUTPUT_DIR}" ]; then
- rm -rf "${VPX_TEST_OUTPUT_DIR}"
- fi
-}
-
-# Echoes the git hash portion of the VERSION_STRING variable defined in
-# $LIBVPX_CONFIG_PATH/config.mk to stdout, or the version number string when
-# no git hash is contained in VERSION_STRING.
-config_hash() {
- vpx_config_mk="${LIBVPX_CONFIG_PATH}/config.mk"
- # Find VERSION_STRING line, split it with "-g" and print the last field to
- # output the git hash to stdout.
- vpx_version=$(awk -F -g '/VERSION_STRING/ {print $NF}' "${vpx_config_mk}")
- # Handle two situations here:
- # 1. The default case: $vpx_version is a git hash, so echo it unchanged.
- # 2. When being run a non-dev tree, the -g portion is not present in the
- # version string: It's only the version number.
- # In this case $vpx_version is something like 'VERSION_STRING=v1.3.0', so
- # we echo only what is after the '='.
- echo "${vpx_version##*=}"
-}
-
-# Echoes the short form of the current git hash.
-current_hash() {
- if git --version > /dev/null 2>&1; then
- (cd "$(dirname "${0}")"
- git rev-parse --short HEAD)
- else
- # Return the config hash if git is unavailable: Fail silently, git hashes
- # are used only for warnings.
- config_hash
- fi
-}
-
-# Echoes warnings to stdout when git hash in vpx_config.h does not match the
-# current git hash.
-check_git_hashes() {
- hash_at_configure_time=$(config_hash)
- hash_now=$(current_hash)
-
- if [ "${hash_at_configure_time}" != "${hash_now}" ]; then
- echo "Warning: git hash has changed since last configure."
- fi
-}
-
-# This script requires that the LIBVPX_BIN_PATH, LIBVPX_CONFIG_PATH, and
-# LIBVPX_TEST_DATA_PATH variables are in the environment: Confirm that
-# the variables are set and that they all evaluate to directory paths.
-verify_vpx_test_environment() {
- if [ ! -d "${LIBVPX_BIN_PATH}" ]; then
- echo "The LIBVPX_BIN_PATH environment variable must be set."
- return 1
- fi
- if [ ! -d "${LIBVPX_CONFIG_PATH}" ]; then
- echo "The LIBVPX_CONFIG_PATH environment variable must be set."
- return 1
- fi
- if [ ! -d "${LIBVPX_TEST_DATA_PATH}" ]; then
- echo "The LIBVPX_TEST_DATA_PATH environment variable must be set."
- return 1
- fi
-}
-
-# Greps vpx_config.h in LIBVPX_CONFIG_PATH for positional parameter one, which
-# should be a LIBVPX preprocessor flag. Echoes yes to stdout when the feature
-# is available.
-vpx_config_option_enabled() {
- vpx_config_option="${1}"
- vpx_config_file="${LIBVPX_CONFIG_PATH}/vpx_config.h"
- config_line=$(grep "${vpx_config_option}" "${vpx_config_file}")
- if echo "${config_line}" | egrep -q '1$'; then
- echo yes
- fi
-}
-
-# Echoes yes when output of test_configuration_target() contains win32 or win64.
-is_windows_target() {
- if test_configuration_target \
- | grep -q -e win32 -e win64 > /dev/null 2>&1; then
- echo yes
- fi
-}
-
-# Echoes yes to stdout when the file named by positional parameter one exists
-# in LIBVPX_BIN_PATH, and is executable.
-vpx_tool_available() {
- tool_name="${1}"
- if [ "$(is_windows_target)" = "yes" ]; then
- tool_name="${tool_name}.exe"
- fi
- [ -x "${LIBVPX_BIN_PATH}/${1}" ] && echo yes
-}
-
-# Echoes yes to stdout when vpx_config_option_enabled() reports yes for
-# CONFIG_VP8_DECODER.
-vp8_decode_available() {
- [ "$(vpx_config_option_enabled CONFIG_VP8_DECODER)" = "yes" ] && echo yes
-}
-
-# Echoes yes to stdout when vpx_config_option_enabled() reports yes for
-# CONFIG_VP8_ENCODER.
-vp8_encode_available() {
- [ "$(vpx_config_option_enabled CONFIG_VP8_ENCODER)" = "yes" ] && echo yes
-}
-
-# Echoes yes to stdout when vpx_config_option_enabled() reports yes for
-# CONFIG_VP9_DECODER.
-vp9_decode_available() {
- [ "$(vpx_config_option_enabled CONFIG_VP9_DECODER)" = "yes" ] && echo yes
-}
-
-# Echoes yes to stdout when vpx_config_option_enabled() reports yes for
-# CONFIG_VP9_ENCODER.
-vp9_encode_available() {
- [ "$(vpx_config_option_enabled CONFIG_VP9_ENCODER)" = "yes" ] && echo yes
-}
-
-# Echoes yes to stdout when vpx_config_option_enabled() reports yes for
-# CONFIG_WEBM_IO.
-webm_io_available() {
- [ "$(vpx_config_option_enabled CONFIG_WEBM_IO)" = "yes" ] && echo yes
-}
-
-# Echoes yes to stdout when vpxdec exists according to vpx_tool_available().
-vpxdec_available() {
- [ -n $(vpx_tool_available vpxdec) ] && echo yes
-}
-
-# Wrapper function for running vpxdec in noblit mode. Requires that
-# LIBVPX_BIN_PATH points to the directory containing vpxdec. Positional
-# parameter one is used as the input file path. Positional parameter two, when
-# present, is interpreted as a boolean flag that means the input should be sent
-# to vpxdec via pipe from cat instead of directly.
-vpxdec() {
- input="${1}"
- pipe_input=${2}
-
- if [ $# -gt 2 ]; then
- # shift away $1 and $2 so the remaining arguments can be passed to vpxdec
- # via $@.
- shift 2
- fi
-
- decoder="${LIBVPX_BIN_PATH}/vpxdec"
-
- if [ "$(is_windows_target)" = "yes" ]; then
- decoder="${decoder}.exe"
- fi
-
- if [ -z "${pipe_input}" ]; then
- "${decoder}" "$input" --summary --noblit "$@" > /dev/null 2>&1
- else
- cat "${input}" | "${decoder}" - --summary --noblit "$@" > /dev/null 2>&1
- fi
-}
-
-# Echoes yes to stdout when vpxenc exists according to vpx_tool_available().
-vpxenc_available() {
- [ -n $(vpx_tool_available vpxenc) ] && echo yes
-}
-
-# Wrapper function for running vpxenc. Positional parameters are interpreted as
-# follows:
-# 1 - codec name
-# 2 - input width
-# 3 - input height
-# 4 - number of frames to encode
-# 5 - path to input file
-# 6 - path to output file
-# Note: The output file path must end in .ivf to output an IVF file.
-# 7 - extra flags
-# Note: Extra flags currently supports a special case: when set to "-"
-# input is piped to vpxenc via cat.
-vpxenc() {
- encoder="${LIBVPX_BIN_PATH}/vpxenc"
- codec="${1}"
- width=${2}
- height=${3}
- frames=${4}
- input=${5}
- output="${VPX_TEST_OUTPUT_DIR}/${6}"
- extra_flags=${7}
-
- if [ "$(is_windows_target)" = "yes" ]; then
- encoder="${encoder}.exe"
- fi
-
- # Because --ivf must be within the command line to get IVF from vpxenc.
- if echo "${output}" | egrep -q 'ivf$'; then
- use_ivf=--ivf
- else
- unset use_ivf
- fi
-
- if [ "${extra_flags}" = "-" ]; then
- pipe_input=yes
- extra_flags=${8}
- else
- unset pipe_input
- fi
-
- if [ -z "${pipe_input}" ]; then
- "${encoder}" --codec=${codec} --width=${width} --height=${height} \
- --limit=${frames} ${use_ivf} ${extra_flags} --output="${output}" \
- "${input}" > /dev/null 2>&1
- else
- cat "${input}" \
- | "${encoder}" --codec=${codec} --width=${width} --height=${height} \
- --limit=${frames} ${use_ivf} ${extra_flags} --output="${output}" - \
- > /dev/null 2>&1
- fi
-
- if [ ! -e "${output}" ]; then
- # Return non-zero exit status: output file doesn't exist, so something
- # definitely went wrong.
- return 1
- fi
-}
-
-# Filters strings from positional parameter one using the filter specified by
-# positional parameter two. Filter behavior depends on the presence of a third
-# positional parameter. When parameter three is present, strings that match the
-# filter are excluded. When omitted, strings matching the filter are included.
-# The filtered string is echoed to stdout.
-filter_strings() {
- strings=${1}
- filter=${2}
- exclude=${3}
-
- if [ -n "${exclude}" ]; then
- # When positional parameter three exists the caller wants to remove strings.
- # Tell grep to invert matches using the -v argument.
- exclude='-v'
- else
- unset exclude
- fi
-
- if [ -n "${filter}" ]; then
- for s in ${strings}; do
- if echo "${s}" | egrep -q ${exclude} "${filter}" > /dev/null 2>&1; then
- filtered_strings="${filtered_strings} ${s}"
- fi
- done
- else
- filtered_strings="${strings}"
- fi
- echo "${filtered_strings}"
-}
-
-# Runs user test functions passed via positional parameters one and two.
-# Functions in positional parameter one are treated as environment verification
-# functions and are run unconditionally. Functions in positional parameter two
-# are run according to the rules specified in vpx_test_usage().
-run_tests() {
- env_tests="verify_vpx_test_environment ${1}"
- tests_to_filter="${2}"
-
- if [ "${VPX_TEST_RUN_DISABLED_TESTS}" != "yes" ]; then
- # Filter out DISABLED tests.
- tests_to_filter=$(filter_strings "${tests_to_filter}" ^DISABLED exclude)
- fi
-
- if [ -n "${VPX_TEST_FILTER}" ]; then
- # Remove tests not matching the user's filter.
- tests_to_filter=$(filter_strings "${tests_to_filter}" ${VPX_TEST_FILTER})
- fi
-
- tests_to_run="${env_tests} ${tests_to_filter}"
-
- check_git_hashes
-
- # Run tests.
- for test in ${tests_to_run}; do
- test_begin "${test}"
- "${test}"
- [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ] && echo " PASS ${test}"
- test_end "${test}"
- done
-
- tested_config="$(test_configuration_target) @ $(current_hash)"
- echo $(basename "${0%.*}"): Done, all tests pass for ${tested_config}.
-}
-
-vpx_test_usage() {
-cat << EOF
- Usage: ${0##*/} [arguments]
- --bin-path <path to libvpx binaries directory>
- --config-path <path to libvpx config directory>
- --filter <filter>: User test filter. Only tests matching filter are run.
- --run-disabled-tests: Run disabled tests.
- --help: Display this message and exit.
- --test-data-path <path to libvpx test data directory>
- --verbose: Verbose output.
-
- When the --bin-path option is not specified the script attempts to use
- \$LIBVPX_BIN_PATH and then the current directory.
-
- When the --config-path option is not specified the script attempts to use
- \$LIBVPX_CONFIG_PATH and then the current directory.
-
- When the -test-data-path option is not specified the script attempts to use
- \$LIBVPX_TEST_DATA_PATH and then the current directory.
-EOF
-}
-
-# Returns non-zero (failure) when required environment variables are empty
-# strings.
-vpx_test_check_environment() {
- if [ -z "${LIBVPX_BIN_PATH}" ] || \
- [ -z "${LIBVPX_CONFIG_PATH}" ] || \
- [ -z "${LIBVPX_TEST_DATA_PATH}" ]; then
- return 1
- fi
-}
-
-# Parse the command line.
-while [ -n "$1" ]; do
- case "$1" in
- --bin-path)
- LIBVPX_BIN_PATH="$2"
- shift
- ;;
- --config-path)
- LIBVPX_CONFIG_PATH="$2"
- shift
- ;;
- --filter)
- VPX_TEST_FILTER="$2"
- shift
- ;;
- --run-disabled-tests)
- VPX_TEST_RUN_DISABLED_TESTS=yes
- ;;
- --help)
- vpx_test_usage
- exit
- ;;
- --test-data-path)
- LIBVPX_TEST_DATA_PATH="$2"
- shift
- ;;
- --verbose)
- VPX_TEST_VERBOSE_OUTPUT=yes
- ;;
- *)
- vpx_test_usage
- exit 1
- ;;
- esac
- shift
-done
-
-# Handle running the tests from a build directory without arguments when running
-# the tests on *nix/macosx.
-LIBVPX_BIN_PATH="${LIBVPX_BIN_PATH:-.}"
-LIBVPX_CONFIG_PATH="${LIBVPX_CONFIG_PATH:-.}"
-LIBVPX_TEST_DATA_PATH="${LIBVPX_TEST_DATA_PATH:-.}"
-
-# Create a temporary directory for output files, and a trap to clean it up.
-if [ -n "${TMPDIR}" ]; then
- VPX_TEST_TEMP_ROOT="${TMPDIR}"
-elif [ -n "${TEMPDIR}" ]; then
- VPX_TEST_TEMP_ROOT="${TEMPDIR}"
-else
- VPX_TEST_TEMP_ROOT=/tmp
-fi
-
-VPX_TEST_RAND=$(awk 'BEGIN { srand(); printf "%d\n",(rand() * 32768)}')
-VPX_TEST_OUTPUT_DIR="${VPX_TEST_TEMP_ROOT}/vpx_test_${VPX_TEST_RAND}"
-
-if ! mkdir -p "${VPX_TEST_OUTPUT_DIR}" || \
- [ ! -d "${VPX_TEST_OUTPUT_DIR}" ]; then
- echo "${0##*/}: Cannot create output directory, giving up."
- echo "${0##*/}: VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR}"
- exit 1
-fi
-
-trap cleanup EXIT
-
-if [ "${VPX_TEST_VERBOSE_OUTPUT}" = "yes" ]; then
-cat << EOF
-$(basename "${0%.*}") test configuration:
- LIBVPX_BIN_PATH=${LIBVPX_BIN_PATH}
- LIBVPX_CONFIG_PATH=${LIBVPX_CONFIG_PATH}
- LIBVPX_TEST_DATA_PATH=${LIBVPX_TEST_DATA_PATH}
- VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR}
- VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT}
- VPX_TEST_FILTER=${VPX_TEST_FILTER}
- VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS}
-EOF
-fi
diff --git a/videocodec/libvpx_internal/libvpx/test/util.h b/videocodec/libvpx_internal/libvpx/test/util.h
deleted file mode 100644
index 3c45721..0000000
--- a/videocodec/libvpx_internal/libvpx/test/util.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef TEST_UTIL_H_
-#define TEST_UTIL_H_
-
-#include <stdio.h>
-#include <math.h>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "vpx/vpx_image.h"
-
-// Macros
-#define GET_PARAM(k) std::tr1::get< k >(GetParam())
-
-static double compute_psnr(const vpx_image_t *img1,
- const vpx_image_t *img2) {
- assert((img1->fmt == img2->fmt) &&
- (img1->d_w == img2->d_w) &&
- (img1->d_h == img2->d_h));
-
- const unsigned int width_y = img1->d_w;
- const unsigned int height_y = img1->d_h;
- unsigned int i, j;
-
- int64_t sqrerr = 0;
- for (i = 0; i < height_y; ++i)
- for (j = 0; j < width_y; ++j) {
- int64_t d = img1->planes[VPX_PLANE_Y][i * img1->stride[VPX_PLANE_Y] + j] -
- img2->planes[VPX_PLANE_Y][i * img2->stride[VPX_PLANE_Y] + j];
- sqrerr += d * d;
- }
- double mse = static_cast<double>(sqrerr) / (width_y * height_y);
- double psnr = 100.0;
- if (mse > 0.0) {
- psnr = 10 * log10(255.0 * 255.0 / mse);
- }
- return psnr;
-}
-
-#endif // TEST_UTIL_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/variance_test.cc b/videocodec/libvpx_internal/libvpx/test/variance_test.cc
deleted file mode 100644
index c9bf13a..0000000
--- a/videocodec/libvpx_internal/libvpx/test/variance_test.cc
+++ /dev/null
@@ -1,709 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <stdlib.h>
-#include <new>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-
-#include "vpx/vpx_integer.h"
-#include "./vpx_config.h"
-#include "vpx_mem/vpx_mem.h"
-#if CONFIG_VP8_ENCODER
-# include "./vp8_rtcd.h"
-# include "vp8/common/variance.h"
-#endif
-#if CONFIG_VP9_ENCODER
-# include "./vp9_rtcd.h"
-# include "vp9/encoder/vp9_variance.h"
-#endif
-#include "test/acm_random.h"
-
-namespace {
-
-using ::std::tr1::get;
-using ::std::tr1::make_tuple;
-using ::std::tr1::tuple;
-using libvpx_test::ACMRandom;
-
-static unsigned int variance_ref(const uint8_t *ref, const uint8_t *src,
- int l2w, int l2h, unsigned int *sse_ptr) {
- int se = 0;
- unsigned int sse = 0;
- const int w = 1 << l2w, h = 1 << l2h;
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- int diff = ref[w * y + x] - src[w * y + x];
- se += diff;
- sse += diff * diff;
- }
- }
- *sse_ptr = sse;
- return sse - (((int64_t) se * se) >> (l2w + l2h));
-}
-
-static unsigned int subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
- int l2w, int l2h, int xoff, int yoff,
- unsigned int *sse_ptr) {
- int se = 0;
- unsigned int sse = 0;
- const int w = 1 << l2w, h = 1 << l2h;
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- // bilinear interpolation at a 16th pel step
- const int a1 = ref[(w + 1) * (y + 0) + x + 0];
- const int a2 = ref[(w + 1) * (y + 0) + x + 1];
- const int b1 = ref[(w + 1) * (y + 1) + x + 0];
- const int b2 = ref[(w + 1) * (y + 1) + x + 1];
- const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
- const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
- const int r = a + (((b - a) * yoff + 8) >> 4);
- int diff = r - src[w * y + x];
- se += diff;
- sse += diff * diff;
- }
- }
- *sse_ptr = sse;
- return sse - (((int64_t) se * se) >> (l2w + l2h));
-}
-
-template<typename VarianceFunctionType>
-class VarianceTest
- : public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > {
- public:
- virtual void SetUp() {
- const tuple<int, int, VarianceFunctionType>& params = this->GetParam();
- log2width_ = get<0>(params);
- width_ = 1 << log2width_;
- log2height_ = get<1>(params);
- height_ = 1 << log2height_;
- variance_ = get<2>(params);
-
- rnd(ACMRandom::DeterministicSeed());
- block_size_ = width_ * height_;
- src_ = new uint8_t[block_size_];
- ref_ = new uint8_t[block_size_];
- ASSERT_TRUE(src_ != NULL);
- ASSERT_TRUE(ref_ != NULL);
- }
-
- virtual void TearDown() {
- delete[] src_;
- delete[] ref_;
- libvpx_test::ClearSystemState();
- }
-
- protected:
- void ZeroTest();
- void RefTest();
- void OneQuarterTest();
-
- ACMRandom rnd;
- uint8_t* src_;
- uint8_t* ref_;
- int width_, log2width_;
- int height_, log2height_;
- int block_size_;
- VarianceFunctionType variance_;
-};
-
-template<typename VarianceFunctionType>
-void VarianceTest<VarianceFunctionType>::ZeroTest() {
- for (int i = 0; i <= 255; ++i) {
- memset(src_, i, block_size_);
- for (int j = 0; j <= 255; ++j) {
- memset(ref_, j, block_size_);
- unsigned int sse;
- unsigned int var;
- REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));
- EXPECT_EQ(0u, var) << "src values: " << i << "ref values: " << j;
- }
- }
-}
-
-template<typename VarianceFunctionType>
-void VarianceTest<VarianceFunctionType>::RefTest() {
- for (int i = 0; i < 10; ++i) {
- for (int j = 0; j < block_size_; j++) {
- src_[j] = rnd.Rand8();
- ref_[j] = rnd.Rand8();
- }
- unsigned int sse1, sse2;
- unsigned int var1;
- REGISTER_STATE_CHECK(var1 = variance_(src_, width_, ref_, width_, &sse1));
- const unsigned int var2 = variance_ref(src_, ref_, log2width_,
- log2height_, &sse2);
- EXPECT_EQ(sse1, sse2);
- EXPECT_EQ(var1, var2);
- }
-}
-
-template<typename VarianceFunctionType>
-void VarianceTest<VarianceFunctionType>::OneQuarterTest() {
- memset(src_, 255, block_size_);
- const int half = block_size_ / 2;
- memset(ref_, 255, half);
- memset(ref_ + half, 0, half);
- unsigned int sse;
- unsigned int var;
- REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));
- const unsigned int expected = block_size_ * 255 * 255 / 4;
- EXPECT_EQ(expected, var);
-}
-
-#if CONFIG_VP9_ENCODER
-
-unsigned int subpel_avg_variance_ref(const uint8_t *ref,
- const uint8_t *src,
- const uint8_t *second_pred,
- int l2w, int l2h,
- int xoff, int yoff,
- unsigned int *sse_ptr) {
- int se = 0;
- unsigned int sse = 0;
- const int w = 1 << l2w, h = 1 << l2h;
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- // bilinear interpolation at a 16th pel step
- const int a1 = ref[(w + 1) * (y + 0) + x + 0];
- const int a2 = ref[(w + 1) * (y + 0) + x + 1];
- const int b1 = ref[(w + 1) * (y + 1) + x + 0];
- const int b2 = ref[(w + 1) * (y + 1) + x + 1];
- const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
- const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
- const int r = a + (((b - a) * yoff + 8) >> 4);
- int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
- se += diff;
- sse += diff * diff;
- }
- }
- *sse_ptr = sse;
- return sse - (((int64_t) se * se) >> (l2w + l2h));
-}
-
-template<typename SubpelVarianceFunctionType>
-class SubpelVarianceTest
- : public ::testing::TestWithParam<tuple<int, int,
- SubpelVarianceFunctionType> > {
- public:
- virtual void SetUp() {
- const tuple<int, int, SubpelVarianceFunctionType>& params =
- this->GetParam();
- log2width_ = get<0>(params);
- width_ = 1 << log2width_;
- log2height_ = get<1>(params);
- height_ = 1 << log2height_;
- subpel_variance_ = get<2>(params);
-
- rnd(ACMRandom::DeterministicSeed());
- block_size_ = width_ * height_;
- src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
- sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
- ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
- ASSERT_TRUE(src_ != NULL);
- ASSERT_TRUE(sec_ != NULL);
- ASSERT_TRUE(ref_ != NULL);
- }
-
- virtual void TearDown() {
- vpx_free(src_);
- delete[] ref_;
- vpx_free(sec_);
- libvpx_test::ClearSystemState();
- }
-
- protected:
- void RefTest();
-
- ACMRandom rnd;
- uint8_t *src_;
- uint8_t *ref_;
- uint8_t *sec_;
- int width_, log2width_;
- int height_, log2height_;
- int block_size_;
- SubpelVarianceFunctionType subpel_variance_;
-};
-
-template<typename SubpelVarianceFunctionType>
-void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
- for (int x = 0; x < 16; ++x) {
- for (int y = 0; y < 16; ++y) {
- for (int j = 0; j < block_size_; j++) {
- src_[j] = rnd.Rand8();
- }
- for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
- ref_[j] = rnd.Rand8();
- }
- unsigned int sse1, sse2;
- unsigned int var1;
- REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,
- src_, width_, &sse1));
- const unsigned int var2 = subpel_variance_ref(ref_, src_, log2width_,
- log2height_, x, y, &sse2);
- EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
- EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
- }
- }
-}
-
-template<>
-void SubpelVarianceTest<vp9_subp_avg_variance_fn_t>::RefTest() {
- for (int x = 0; x < 16; ++x) {
- for (int y = 0; y < 16; ++y) {
- for (int j = 0; j < block_size_; j++) {
- src_[j] = rnd.Rand8();
- sec_[j] = rnd.Rand8();
- }
- for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
- ref_[j] = rnd.Rand8();
- }
- unsigned int sse1, sse2;
- unsigned int var1;
- REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,
- src_, width_, &sse1, sec_));
- const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,
- log2width_, log2height_,
- x, y, &sse2);
- EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
- EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
- }
- }
-}
-
-#endif // CONFIG_VP9_ENCODER
-
-// -----------------------------------------------------------------------------
-// VP8 test cases.
-
-namespace vp8 {
-
-#if CONFIG_VP8_ENCODER
-typedef VarianceTest<vp8_variance_fn_t> VP8VarianceTest;
-
-TEST_P(VP8VarianceTest, Zero) { ZeroTest(); }
-TEST_P(VP8VarianceTest, Ref) { RefTest(); }
-TEST_P(VP8VarianceTest, OneQuarter) { OneQuarterTest(); }
-
-const vp8_variance_fn_t variance4x4_c = vp8_variance4x4_c;
-const vp8_variance_fn_t variance8x8_c = vp8_variance8x8_c;
-const vp8_variance_fn_t variance8x16_c = vp8_variance8x16_c;
-const vp8_variance_fn_t variance16x8_c = vp8_variance16x8_c;
-const vp8_variance_fn_t variance16x16_c = vp8_variance16x16_c;
-INSTANTIATE_TEST_CASE_P(
- C, VP8VarianceTest,
- ::testing::Values(make_tuple(2, 2, variance4x4_c),
- make_tuple(3, 3, variance8x8_c),
- make_tuple(3, 4, variance8x16_c),
- make_tuple(4, 3, variance16x8_c),
- make_tuple(4, 4, variance16x16_c)));
-
-#if HAVE_NEON
-const vp8_variance_fn_t variance8x8_neon = vp8_variance8x8_neon;
-const vp8_variance_fn_t variance8x16_neon = vp8_variance8x16_neon;
-const vp8_variance_fn_t variance16x8_neon = vp8_variance16x8_neon;
-const vp8_variance_fn_t variance16x16_neon = vp8_variance16x16_neon;
-INSTANTIATE_TEST_CASE_P(
- NEON, VP8VarianceTest,
- ::testing::Values(make_tuple(3, 3, variance8x8_neon),
- make_tuple(3, 4, variance8x16_neon),
- make_tuple(4, 3, variance16x8_neon),
- make_tuple(4, 4, variance16x16_neon)));
-#endif
-
-#if HAVE_MMX
-const vp8_variance_fn_t variance4x4_mmx = vp8_variance4x4_mmx;
-const vp8_variance_fn_t variance8x8_mmx = vp8_variance8x8_mmx;
-const vp8_variance_fn_t variance8x16_mmx = vp8_variance8x16_mmx;
-const vp8_variance_fn_t variance16x8_mmx = vp8_variance16x8_mmx;
-const vp8_variance_fn_t variance16x16_mmx = vp8_variance16x16_mmx;
-INSTANTIATE_TEST_CASE_P(
- MMX, VP8VarianceTest,
- ::testing::Values(make_tuple(2, 2, variance4x4_mmx),
- make_tuple(3, 3, variance8x8_mmx),
- make_tuple(3, 4, variance8x16_mmx),
- make_tuple(4, 3, variance16x8_mmx),
- make_tuple(4, 4, variance16x16_mmx)));
-#endif
-
-#if HAVE_SSE2
-const vp8_variance_fn_t variance4x4_wmt = vp8_variance4x4_wmt;
-const vp8_variance_fn_t variance8x8_wmt = vp8_variance8x8_wmt;
-const vp8_variance_fn_t variance8x16_wmt = vp8_variance8x16_wmt;
-const vp8_variance_fn_t variance16x8_wmt = vp8_variance16x8_wmt;
-const vp8_variance_fn_t variance16x16_wmt = vp8_variance16x16_wmt;
-INSTANTIATE_TEST_CASE_P(
- SSE2, VP8VarianceTest,
- ::testing::Values(make_tuple(2, 2, variance4x4_wmt),
- make_tuple(3, 3, variance8x8_wmt),
- make_tuple(3, 4, variance8x16_wmt),
- make_tuple(4, 3, variance16x8_wmt),
- make_tuple(4, 4, variance16x16_wmt)));
-#endif
-#endif // CONFIG_VP8_ENCODER
-
-} // namespace vp8
-
-// -----------------------------------------------------------------------------
-// VP9 test cases.
-
-namespace vp9 {
-
-#if CONFIG_VP9_ENCODER
-typedef VarianceTest<vp9_variance_fn_t> VP9VarianceTest;
-typedef SubpelVarianceTest<vp9_subpixvariance_fn_t> VP9SubpelVarianceTest;
-typedef SubpelVarianceTest<vp9_subp_avg_variance_fn_t> VP9SubpelAvgVarianceTest;
-
-TEST_P(VP9VarianceTest, Zero) { ZeroTest(); }
-TEST_P(VP9VarianceTest, Ref) { RefTest(); }
-TEST_P(VP9SubpelVarianceTest, Ref) { RefTest(); }
-TEST_P(VP9SubpelAvgVarianceTest, Ref) { RefTest(); }
-TEST_P(VP9VarianceTest, OneQuarter) { OneQuarterTest(); }
-
-const vp9_variance_fn_t variance4x4_c = vp9_variance4x4_c;
-const vp9_variance_fn_t variance4x8_c = vp9_variance4x8_c;
-const vp9_variance_fn_t variance8x4_c = vp9_variance8x4_c;
-const vp9_variance_fn_t variance8x8_c = vp9_variance8x8_c;
-const vp9_variance_fn_t variance8x16_c = vp9_variance8x16_c;
-const vp9_variance_fn_t variance16x8_c = vp9_variance16x8_c;
-const vp9_variance_fn_t variance16x16_c = vp9_variance16x16_c;
-const vp9_variance_fn_t variance16x32_c = vp9_variance16x32_c;
-const vp9_variance_fn_t variance32x16_c = vp9_variance32x16_c;
-const vp9_variance_fn_t variance32x32_c = vp9_variance32x32_c;
-const vp9_variance_fn_t variance32x64_c = vp9_variance32x64_c;
-const vp9_variance_fn_t variance64x32_c = vp9_variance64x32_c;
-const vp9_variance_fn_t variance64x64_c = vp9_variance64x64_c;
-INSTANTIATE_TEST_CASE_P(
- C, VP9VarianceTest,
- ::testing::Values(make_tuple(2, 2, variance4x4_c),
- make_tuple(2, 3, variance4x8_c),
- make_tuple(3, 2, variance8x4_c),
- make_tuple(3, 3, variance8x8_c),
- make_tuple(3, 4, variance8x16_c),
- make_tuple(4, 3, variance16x8_c),
- make_tuple(4, 4, variance16x16_c),
- make_tuple(4, 5, variance16x32_c),
- make_tuple(5, 4, variance32x16_c),
- make_tuple(5, 5, variance32x32_c),
- make_tuple(5, 6, variance32x64_c),
- make_tuple(6, 5, variance64x32_c),
- make_tuple(6, 6, variance64x64_c)));
-
-const vp9_subpixvariance_fn_t subpel_variance4x4_c =
- vp9_sub_pixel_variance4x4_c;
-const vp9_subpixvariance_fn_t subpel_variance4x8_c =
- vp9_sub_pixel_variance4x8_c;
-const vp9_subpixvariance_fn_t subpel_variance8x4_c =
- vp9_sub_pixel_variance8x4_c;
-const vp9_subpixvariance_fn_t subpel_variance8x8_c =
- vp9_sub_pixel_variance8x8_c;
-const vp9_subpixvariance_fn_t subpel_variance8x16_c =
- vp9_sub_pixel_variance8x16_c;
-const vp9_subpixvariance_fn_t subpel_variance16x8_c =
- vp9_sub_pixel_variance16x8_c;
-const vp9_subpixvariance_fn_t subpel_variance16x16_c =
- vp9_sub_pixel_variance16x16_c;
-const vp9_subpixvariance_fn_t subpel_variance16x32_c =
- vp9_sub_pixel_variance16x32_c;
-const vp9_subpixvariance_fn_t subpel_variance32x16_c =
- vp9_sub_pixel_variance32x16_c;
-const vp9_subpixvariance_fn_t subpel_variance32x32_c =
- vp9_sub_pixel_variance32x32_c;
-const vp9_subpixvariance_fn_t subpel_variance32x64_c =
- vp9_sub_pixel_variance32x64_c;
-const vp9_subpixvariance_fn_t subpel_variance64x32_c =
- vp9_sub_pixel_variance64x32_c;
-const vp9_subpixvariance_fn_t subpel_variance64x64_c =
- vp9_sub_pixel_variance64x64_c;
-INSTANTIATE_TEST_CASE_P(
- C, VP9SubpelVarianceTest,
- ::testing::Values(make_tuple(2, 2, subpel_variance4x4_c),
- make_tuple(2, 3, subpel_variance4x8_c),
- make_tuple(3, 2, subpel_variance8x4_c),
- make_tuple(3, 3, subpel_variance8x8_c),
- make_tuple(3, 4, subpel_variance8x16_c),
- make_tuple(4, 3, subpel_variance16x8_c),
- make_tuple(4, 4, subpel_variance16x16_c),
- make_tuple(4, 5, subpel_variance16x32_c),
- make_tuple(5, 4, subpel_variance32x16_c),
- make_tuple(5, 5, subpel_variance32x32_c),
- make_tuple(5, 6, subpel_variance32x64_c),
- make_tuple(6, 5, subpel_variance64x32_c),
- make_tuple(6, 6, subpel_variance64x64_c)));
-
-const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_c =
- vp9_sub_pixel_avg_variance4x4_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_c =
- vp9_sub_pixel_avg_variance4x8_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_c =
- vp9_sub_pixel_avg_variance8x4_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_c =
- vp9_sub_pixel_avg_variance8x8_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_c =
- vp9_sub_pixel_avg_variance8x16_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_c =
- vp9_sub_pixel_avg_variance16x8_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_c =
- vp9_sub_pixel_avg_variance16x16_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_c =
- vp9_sub_pixel_avg_variance16x32_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_c =
- vp9_sub_pixel_avg_variance32x16_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_c =
- vp9_sub_pixel_avg_variance32x32_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_c =
- vp9_sub_pixel_avg_variance32x64_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_c =
- vp9_sub_pixel_avg_variance64x32_c;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_c =
- vp9_sub_pixel_avg_variance64x64_c;
-INSTANTIATE_TEST_CASE_P(
- C, VP9SubpelAvgVarianceTest,
- ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_c),
- make_tuple(2, 3, subpel_avg_variance4x8_c),
- make_tuple(3, 2, subpel_avg_variance8x4_c),
- make_tuple(3, 3, subpel_avg_variance8x8_c),
- make_tuple(3, 4, subpel_avg_variance8x16_c),
- make_tuple(4, 3, subpel_avg_variance16x8_c),
- make_tuple(4, 4, subpel_avg_variance16x16_c),
- make_tuple(4, 5, subpel_avg_variance16x32_c),
- make_tuple(5, 4, subpel_avg_variance32x16_c),
- make_tuple(5, 5, subpel_avg_variance32x32_c),
- make_tuple(5, 6, subpel_avg_variance32x64_c),
- make_tuple(6, 5, subpel_avg_variance64x32_c),
- make_tuple(6, 6, subpel_avg_variance64x64_c)));
-
-#if HAVE_MMX
-const vp9_variance_fn_t variance4x4_mmx = vp9_variance4x4_mmx;
-const vp9_variance_fn_t variance8x8_mmx = vp9_variance8x8_mmx;
-const vp9_variance_fn_t variance8x16_mmx = vp9_variance8x16_mmx;
-const vp9_variance_fn_t variance16x8_mmx = vp9_variance16x8_mmx;
-const vp9_variance_fn_t variance16x16_mmx = vp9_variance16x16_mmx;
-INSTANTIATE_TEST_CASE_P(
- MMX, VP9VarianceTest,
- ::testing::Values(make_tuple(2, 2, variance4x4_mmx),
- make_tuple(3, 3, variance8x8_mmx),
- make_tuple(3, 4, variance8x16_mmx),
- make_tuple(4, 3, variance16x8_mmx),
- make_tuple(4, 4, variance16x16_mmx)));
-#endif
-
-#if HAVE_SSE2
-#if CONFIG_USE_X86INC
-const vp9_variance_fn_t variance4x4_sse2 = vp9_variance4x4_sse2;
-const vp9_variance_fn_t variance4x8_sse2 = vp9_variance4x8_sse2;
-const vp9_variance_fn_t variance8x4_sse2 = vp9_variance8x4_sse2;
-const vp9_variance_fn_t variance8x8_sse2 = vp9_variance8x8_sse2;
-const vp9_variance_fn_t variance8x16_sse2 = vp9_variance8x16_sse2;
-const vp9_variance_fn_t variance16x8_sse2 = vp9_variance16x8_sse2;
-const vp9_variance_fn_t variance16x16_sse2 = vp9_variance16x16_sse2;
-const vp9_variance_fn_t variance16x32_sse2 = vp9_variance16x32_sse2;
-const vp9_variance_fn_t variance32x16_sse2 = vp9_variance32x16_sse2;
-const vp9_variance_fn_t variance32x32_sse2 = vp9_variance32x32_sse2;
-const vp9_variance_fn_t variance32x64_sse2 = vp9_variance32x64_sse2;
-const vp9_variance_fn_t variance64x32_sse2 = vp9_variance64x32_sse2;
-const vp9_variance_fn_t variance64x64_sse2 = vp9_variance64x64_sse2;
-INSTANTIATE_TEST_CASE_P(
- SSE2, VP9VarianceTest,
- ::testing::Values(make_tuple(2, 2, variance4x4_sse2),
- make_tuple(2, 3, variance4x8_sse2),
- make_tuple(3, 2, variance8x4_sse2),
- make_tuple(3, 3, variance8x8_sse2),
- make_tuple(3, 4, variance8x16_sse2),
- make_tuple(4, 3, variance16x8_sse2),
- make_tuple(4, 4, variance16x16_sse2),
- make_tuple(4, 5, variance16x32_sse2),
- make_tuple(5, 4, variance32x16_sse2),
- make_tuple(5, 5, variance32x32_sse2),
- make_tuple(5, 6, variance32x64_sse2),
- make_tuple(6, 5, variance64x32_sse2),
- make_tuple(6, 6, variance64x64_sse2)));
-
-const vp9_subpixvariance_fn_t subpel_variance4x4_sse =
- vp9_sub_pixel_variance4x4_sse;
-const vp9_subpixvariance_fn_t subpel_variance4x8_sse =
- vp9_sub_pixel_variance4x8_sse;
-const vp9_subpixvariance_fn_t subpel_variance8x4_sse2 =
- vp9_sub_pixel_variance8x4_sse2;
-const vp9_subpixvariance_fn_t subpel_variance8x8_sse2 =
- vp9_sub_pixel_variance8x8_sse2;
-const vp9_subpixvariance_fn_t subpel_variance8x16_sse2 =
- vp9_sub_pixel_variance8x16_sse2;
-const vp9_subpixvariance_fn_t subpel_variance16x8_sse2 =
- vp9_sub_pixel_variance16x8_sse2;
-const vp9_subpixvariance_fn_t subpel_variance16x16_sse2 =
- vp9_sub_pixel_variance16x16_sse2;
-const vp9_subpixvariance_fn_t subpel_variance16x32_sse2 =
- vp9_sub_pixel_variance16x32_sse2;
-const vp9_subpixvariance_fn_t subpel_variance32x16_sse2 =
- vp9_sub_pixel_variance32x16_sse2;
-const vp9_subpixvariance_fn_t subpel_variance32x32_sse2 =
- vp9_sub_pixel_variance32x32_sse2;
-const vp9_subpixvariance_fn_t subpel_variance32x64_sse2 =
- vp9_sub_pixel_variance32x64_sse2;
-const vp9_subpixvariance_fn_t subpel_variance64x32_sse2 =
- vp9_sub_pixel_variance64x32_sse2;
-const vp9_subpixvariance_fn_t subpel_variance64x64_sse2 =
- vp9_sub_pixel_variance64x64_sse2;
-INSTANTIATE_TEST_CASE_P(
- SSE2, VP9SubpelVarianceTest,
- ::testing::Values(make_tuple(2, 2, subpel_variance4x4_sse),
- make_tuple(2, 3, subpel_variance4x8_sse),
- make_tuple(3, 2, subpel_variance8x4_sse2),
- make_tuple(3, 3, subpel_variance8x8_sse2),
- make_tuple(3, 4, subpel_variance8x16_sse2),
- make_tuple(4, 3, subpel_variance16x8_sse2),
- make_tuple(4, 4, subpel_variance16x16_sse2),
- make_tuple(4, 5, subpel_variance16x32_sse2),
- make_tuple(5, 4, subpel_variance32x16_sse2),
- make_tuple(5, 5, subpel_variance32x32_sse2),
- make_tuple(5, 6, subpel_variance32x64_sse2),
- make_tuple(6, 5, subpel_variance64x32_sse2),
- make_tuple(6, 6, subpel_variance64x64_sse2)));
-
-const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_sse =
- vp9_sub_pixel_avg_variance4x4_sse;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_sse =
- vp9_sub_pixel_avg_variance4x8_sse;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_sse2 =
- vp9_sub_pixel_avg_variance8x4_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_sse2 =
- vp9_sub_pixel_avg_variance8x8_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_sse2 =
- vp9_sub_pixel_avg_variance8x16_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_sse2 =
- vp9_sub_pixel_avg_variance16x8_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_sse2 =
- vp9_sub_pixel_avg_variance16x16_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_sse2 =
- vp9_sub_pixel_avg_variance16x32_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_sse2 =
- vp9_sub_pixel_avg_variance32x16_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_sse2 =
- vp9_sub_pixel_avg_variance32x32_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_sse2 =
- vp9_sub_pixel_avg_variance32x64_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_sse2 =
- vp9_sub_pixel_avg_variance64x32_sse2;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_sse2 =
- vp9_sub_pixel_avg_variance64x64_sse2;
-INSTANTIATE_TEST_CASE_P(
- SSE2, VP9SubpelAvgVarianceTest,
- ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_sse),
- make_tuple(2, 3, subpel_avg_variance4x8_sse),
- make_tuple(3, 2, subpel_avg_variance8x4_sse2),
- make_tuple(3, 3, subpel_avg_variance8x8_sse2),
- make_tuple(3, 4, subpel_avg_variance8x16_sse2),
- make_tuple(4, 3, subpel_avg_variance16x8_sse2),
- make_tuple(4, 4, subpel_avg_variance16x16_sse2),
- make_tuple(4, 5, subpel_avg_variance16x32_sse2),
- make_tuple(5, 4, subpel_avg_variance32x16_sse2),
- make_tuple(5, 5, subpel_avg_variance32x32_sse2),
- make_tuple(5, 6, subpel_avg_variance32x64_sse2),
- make_tuple(6, 5, subpel_avg_variance64x32_sse2),
- make_tuple(6, 6, subpel_avg_variance64x64_sse2)));
-#endif
-#endif
-
-#if HAVE_SSSE3
-#if CONFIG_USE_X86INC
-
-const vp9_subpixvariance_fn_t subpel_variance4x4_ssse3 =
- vp9_sub_pixel_variance4x4_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance4x8_ssse3 =
- vp9_sub_pixel_variance4x8_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance8x4_ssse3 =
- vp9_sub_pixel_variance8x4_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance8x8_ssse3 =
- vp9_sub_pixel_variance8x8_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance8x16_ssse3 =
- vp9_sub_pixel_variance8x16_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance16x8_ssse3 =
- vp9_sub_pixel_variance16x8_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance16x16_ssse3 =
- vp9_sub_pixel_variance16x16_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance16x32_ssse3 =
- vp9_sub_pixel_variance16x32_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance32x16_ssse3 =
- vp9_sub_pixel_variance32x16_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance32x32_ssse3 =
- vp9_sub_pixel_variance32x32_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance32x64_ssse3 =
- vp9_sub_pixel_variance32x64_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance64x32_ssse3 =
- vp9_sub_pixel_variance64x32_ssse3;
-const vp9_subpixvariance_fn_t subpel_variance64x64_ssse3 =
- vp9_sub_pixel_variance64x64_ssse3;
-INSTANTIATE_TEST_CASE_P(
- SSSE3, VP9SubpelVarianceTest,
- ::testing::Values(make_tuple(2, 2, subpel_variance4x4_ssse3),
- make_tuple(2, 3, subpel_variance4x8_ssse3),
- make_tuple(3, 2, subpel_variance8x4_ssse3),
- make_tuple(3, 3, subpel_variance8x8_ssse3),
- make_tuple(3, 4, subpel_variance8x16_ssse3),
- make_tuple(4, 3, subpel_variance16x8_ssse3),
- make_tuple(4, 4, subpel_variance16x16_ssse3),
- make_tuple(4, 5, subpel_variance16x32_ssse3),
- make_tuple(5, 4, subpel_variance32x16_ssse3),
- make_tuple(5, 5, subpel_variance32x32_ssse3),
- make_tuple(5, 6, subpel_variance32x64_ssse3),
- make_tuple(6, 5, subpel_variance64x32_ssse3),
- make_tuple(6, 6, subpel_variance64x64_ssse3)));
-
-const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_ssse3 =
- vp9_sub_pixel_avg_variance4x4_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_ssse3 =
- vp9_sub_pixel_avg_variance4x8_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_ssse3 =
- vp9_sub_pixel_avg_variance8x4_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_ssse3 =
- vp9_sub_pixel_avg_variance8x8_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_ssse3 =
- vp9_sub_pixel_avg_variance8x16_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_ssse3 =
- vp9_sub_pixel_avg_variance16x8_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_ssse3 =
- vp9_sub_pixel_avg_variance16x16_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_ssse3 =
- vp9_sub_pixel_avg_variance16x32_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_ssse3 =
- vp9_sub_pixel_avg_variance32x16_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_ssse3 =
- vp9_sub_pixel_avg_variance32x32_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_ssse3 =
- vp9_sub_pixel_avg_variance32x64_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_ssse3 =
- vp9_sub_pixel_avg_variance64x32_ssse3;
-const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_ssse3 =
- vp9_sub_pixel_avg_variance64x64_ssse3;
-INSTANTIATE_TEST_CASE_P(
- SSSE3, VP9SubpelAvgVarianceTest,
- ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_ssse3),
- make_tuple(2, 3, subpel_avg_variance4x8_ssse3),
- make_tuple(3, 2, subpel_avg_variance8x4_ssse3),
- make_tuple(3, 3, subpel_avg_variance8x8_ssse3),
- make_tuple(3, 4, subpel_avg_variance8x16_ssse3),
- make_tuple(4, 3, subpel_avg_variance16x8_ssse3),
- make_tuple(4, 4, subpel_avg_variance16x16_ssse3),
- make_tuple(4, 5, subpel_avg_variance16x32_ssse3),
- make_tuple(5, 4, subpel_avg_variance32x16_ssse3),
- make_tuple(5, 5, subpel_avg_variance32x32_ssse3),
- make_tuple(5, 6, subpel_avg_variance32x64_ssse3),
- make_tuple(6, 5, subpel_avg_variance64x32_ssse3),
- make_tuple(6, 6, subpel_avg_variance64x64_ssse3)));
-#endif
-#endif
-#endif // CONFIG_VP9_ENCODER
-
-} // namespace vp9
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/video_source.h b/videocodec/libvpx_internal/libvpx/test/video_source.h
deleted file mode 100644
index 6d1855a..0000000
--- a/videocodec/libvpx_internal/libvpx/test/video_source.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_VIDEO_SOURCE_H_
-#define TEST_VIDEO_SOURCE_H_
-
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-#include "test/acm_random.h"
-#include "vpx/vpx_encoder.h"
-
-namespace libvpx_test {
-
-// Helper macros to ensure LIBVPX_TEST_DATA_PATH is a quoted string.
-// These are undefined right below GetDataPath
-// NOTE: LIBVPX_TEST_DATA_PATH MUST NOT be a quoted string before
-// Stringification or the GetDataPath will fail at runtime
-#define TO_STRING(S) #S
-#define STRINGIFY(S) TO_STRING(S)
-
-// A simple function to encapsulate cross platform retrieval of test data path
-static std::string GetDataPath() {
- const char *const data_path = getenv("LIBVPX_TEST_DATA_PATH");
- if (data_path == NULL) {
-#ifdef LIBVPX_TEST_DATA_PATH
- // In some environments, we cannot set environment variables
- // Instead, we set the data path by using a preprocessor symbol
- // which can be set from make files
- return STRINGIFY(LIBVPX_TEST_DATA_PATH);
-#else
- return ".";
-#endif
- }
- return data_path;
-}
-
-// Undefining stringification macros because they are not used elsewhere
-#undef TO_STRING
-#undef STRINGIFY
-
-static FILE *OpenTestDataFile(const std::string& file_name) {
- const std::string path_to_source = GetDataPath() + "/" + file_name;
- return fopen(path_to_source.c_str(), "rb");
-}
-
-// Abstract base class for test video sources, which provide a stream of
-// vpx_image_t images with associated timestamps and duration.
-class VideoSource {
- public:
- virtual ~VideoSource() {}
-
- // Prepare the stream for reading, rewind/open as necessary.
- virtual void Begin() = 0;
-
- // Advance the cursor to the next frame
- virtual void Next() = 0;
-
- // Get the current video frame, or NULL on End-Of-Stream.
- virtual vpx_image_t *img() const = 0;
-
- // Get the presentation timestamp of the current frame.
- virtual vpx_codec_pts_t pts() const = 0;
-
- // Get the current frame's duration
- virtual unsigned long duration() const = 0;
-
- // Get the timebase for the stream
- virtual vpx_rational_t timebase() const = 0;
-
- // Get the current frame counter, starting at 0.
- virtual unsigned int frame() const = 0;
-
- // Get the current file limit.
- virtual unsigned int limit() const = 0;
-};
-
-
-class DummyVideoSource : public VideoSource {
- public:
- DummyVideoSource() : img_(NULL), limit_(100), width_(0), height_(0) {
- SetSize(80, 64);
- }
-
- virtual ~DummyVideoSource() { vpx_img_free(img_); }
-
- virtual void Begin() {
- frame_ = 0;
- FillFrame();
- }
-
- virtual void Next() {
- ++frame_;
- FillFrame();
- }
-
- virtual vpx_image_t *img() const {
- return (frame_ < limit_) ? img_ : NULL;
- }
-
- // Models a stream where Timebase = 1/FPS, so pts == frame.
- virtual vpx_codec_pts_t pts() const { return frame_; }
-
- virtual unsigned long duration() const { return 1; }
-
- virtual vpx_rational_t timebase() const {
- const vpx_rational_t t = {1, 30};
- return t;
- }
-
- virtual unsigned int frame() const { return frame_; }
-
- virtual unsigned int limit() const { return limit_; }
-
- void SetSize(unsigned int width, unsigned int height) {
- if (width != width_ || height != height_) {
- vpx_img_free(img_);
- raw_sz_ = ((width + 31)&~31) * height * 3 / 2;
- img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, width, height, 32);
- width_ = width;
- height_ = height;
- }
- }
-
- protected:
- virtual void FillFrame() { memset(img_->img_data, 0, raw_sz_); }
-
- vpx_image_t *img_;
- size_t raw_sz_;
- unsigned int limit_;
- unsigned int frame_;
- unsigned int width_;
- unsigned int height_;
-};
-
-
-class RandomVideoSource : public DummyVideoSource {
- public:
- RandomVideoSource(int seed = ACMRandom::DeterministicSeed())
- : rnd_(seed),
- seed_(seed) { }
-
- protected:
- // Reset the RNG to get a matching stream for the second pass
- virtual void Begin() {
- frame_ = 0;
- rnd_.Reset(seed_);
- FillFrame();
- }
-
- // 15 frames of noise, followed by 15 static frames. Reset to 0 rather
- // than holding previous frames to encourage keyframes to be thrown.
- virtual void FillFrame() {
- if (frame_ % 30 < 15)
- for (size_t i = 0; i < raw_sz_; ++i)
- img_->img_data[i] = rnd_.Rand8();
- else
- memset(img_->img_data, 0, raw_sz_);
- }
-
- ACMRandom rnd_;
- int seed_;
-};
-
-// Abstract base class for test video sources, which provide a stream of
-// decompressed images to the decoder.
-class CompressedVideoSource {
- public:
- virtual ~CompressedVideoSource() {}
-
- virtual void Init() = 0;
-
- // Prepare the stream for reading, rewind/open as necessary.
- virtual void Begin() = 0;
-
- // Advance the cursor to the next frame
- virtual void Next() = 0;
-
- virtual const uint8_t *cxdata() const = 0;
-
- virtual size_t frame_size() const = 0;
-
- virtual unsigned int frame_number() const = 0;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_VIDEO_SOURCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/vp8_boolcoder_test.cc b/videocodec/libvpx_internal/libvpx/test/vp8_boolcoder_test.cc
deleted file mode 100644
index 9cd1987..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vp8_boolcoder_test.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "test/acm_random.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "vpx/vpx_integer.h"
-
-#include "vp8/encoder/boolhuff.h"
-#include "vp8/decoder/dboolhuff.h"
-
-namespace {
-const int num_tests = 10;
-
-// In a real use the 'decrypt_state' parameter will be a pointer to a struct
-// with whatever internal state the decryptor uses. For testing we'll just
-// xor with a constant key, and decrypt_state will point to the start of
-// the original buffer.
-const uint8_t secret_key[16] = {
- 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
- 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
-};
-
-void encrypt_buffer(uint8_t *buffer, size_t size) {
- for (size_t i = 0; i < size; ++i) {
- buffer[i] ^= secret_key[i & 15];
- }
-}
-
-void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
- uint8_t *output, int count) {
- const size_t offset = input - reinterpret_cast<uint8_t*>(decrypt_state);
- for (int i = 0; i < count; i++) {
- output[i] = input[i] ^ secret_key[(offset + i) & 15];
- }
-}
-
-} // namespace
-
-using libvpx_test::ACMRandom;
-
-TEST(VP8, TestBitIO) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- for (int n = 0; n < num_tests; ++n) {
- for (int method = 0; method <= 7; ++method) { // we generate various proba
- const int kBitsToTest = 1000;
- uint8_t probas[kBitsToTest];
-
- for (int i = 0; i < kBitsToTest; ++i) {
- const int parity = i & 1;
- probas[i] =
- (method == 0) ? 0 : (method == 1) ? 255 :
- (method == 2) ? 128 :
- (method == 3) ? rnd.Rand8() :
- (method == 4) ? (parity ? 0 : 255) :
- // alternate between low and high proba:
- (method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) :
- (method == 6) ?
- (parity ? rnd(64) : 255 - rnd(64)) :
- (parity ? rnd(32) : 255 - rnd(32));
- }
- for (int bit_method = 0; bit_method <= 3; ++bit_method) {
- const int random_seed = 6432;
- const int kBufferSize = 10000;
- ACMRandom bit_rnd(random_seed);
- BOOL_CODER bw;
- uint8_t bw_buffer[kBufferSize];
- vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize);
-
- int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
- for (int i = 0; i < kBitsToTest; ++i) {
- if (bit_method == 2) {
- bit = (i & 1);
- } else if (bit_method == 3) {
- bit = bit_rnd(2);
- }
- vp8_encode_bool(&bw, bit, static_cast<int>(probas[i]));
- }
-
- vp8_stop_encode(&bw);
-
- BOOL_DECODER br;
-#if CONFIG_DECRYPT
- encrypt_buffer(bw_buffer, buffer_size);
- vp8dx_start_decode(&br, bw_buffer, buffer_size,
- test_decrypt_cb,
- reinterpret_cast<void *>(bw_buffer));
-#else
- vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL);
-#endif
- bit_rnd.Reset(random_seed);
- for (int i = 0; i < kBitsToTest; ++i) {
- if (bit_method == 2) {
- bit = (i & 1);
- } else if (bit_method == 3) {
- bit = bit_rnd(2);
- }
- GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
- << "pos: "<< i << " / " << kBitsToTest
- << " bit_method: " << bit_method
- << " method: " << method;
- }
- }
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/test/vp8_decrypt_test.cc b/videocodec/libvpx_internal/libvpx/test/vp8_decrypt_test.cc
deleted file mode 100644
index 1b5b083..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vp8_decrypt_test.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-#include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/ivf_video_source.h"
-
-namespace {
-// In a real use the 'decrypt_state' parameter will be a pointer to a struct
-// with whatever internal state the decryptor uses. For testing we'll just
-// xor with a constant key, and decrypt_state will point to the start of
-// the original buffer.
-const uint8_t test_key[16] = {
- 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
- 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
-};
-
-void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
- ptrdiff_t offset) {
- for (size_t i = 0; i < size; ++i) {
- dst[i] = src[i] ^ test_key[(offset + i) & 15];
- }
-}
-
-void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
- uint8_t *output, int count) {
- encrypt_buffer(input, output, count,
- input - reinterpret_cast<uint8_t *>(decrypt_state));
-}
-
-} // namespace
-
-namespace libvpx_test {
-
-TEST(TestDecrypt, DecryptWorks) {
- libvpx_test::IVFVideoSource video("vp80-00-comprehensive-001.ivf");
- video.Init();
-
- vpx_codec_dec_cfg_t dec_cfg = {0};
- VP8Decoder decoder(dec_cfg, 0);
-
- video.Begin();
-
- // no decryption
- vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size());
- ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
-
- // decrypt frame
- video.Next();
-
-#if CONFIG_DECRYPT
- std::vector<uint8_t> encrypted(video.frame_size());
- encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0);
- vp8_decrypt_init di = { test_decrypt_cb, &encrypted[0] };
- decoder.Control(VP8D_SET_DECRYPTOR, &di);
-#endif // CONFIG_DECRYPT
-
- res = decoder.DecodeFrame(video.cxdata(), video.frame_size());
- ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
-}
-
-} // namespace libvpx_test
diff --git a/videocodec/libvpx_internal/libvpx/test/vp8_fdct4x4_test.cc b/videocodec/libvpx_internal/libvpx/test/vp8_fdct4x4_test.cc
deleted file mode 100644
index bdbf74e..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vp8_fdct4x4_test.cc
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "./vp8_rtcd.h"
-
-#include "test/acm_random.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "vpx/vpx_integer.h"
-
-namespace {
-
-const int cospi8sqrt2minus1 = 20091;
-const int sinpi8sqrt2 = 35468;
-
-void reference_idct4x4(const int16_t *input, int16_t *output) {
- const int16_t *ip = input;
- int16_t *op = output;
-
- for (int i = 0; i < 4; ++i) {
- const int a1 = ip[0] + ip[8];
- const int b1 = ip[0] - ip[8];
- const int temp1 = (ip[4] * sinpi8sqrt2) >> 16;
- const int temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1) >> 16);
- const int c1 = temp1 - temp2;
- const int temp3 = ip[4] + ((ip[4] * cospi8sqrt2minus1) >> 16);
- const int temp4 = (ip[12] * sinpi8sqrt2) >> 16;
- const int d1 = temp3 + temp4;
- op[0] = a1 + d1;
- op[12] = a1 - d1;
- op[4] = b1 + c1;
- op[8] = b1 - c1;
- ++ip;
- ++op;
- }
- ip = output;
- op = output;
- for (int i = 0; i < 4; ++i) {
- const int a1 = ip[0] + ip[2];
- const int b1 = ip[0] - ip[2];
- const int temp1 = (ip[1] * sinpi8sqrt2) >> 16;
- const int temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1) >> 16);
- const int c1 = temp1 - temp2;
- const int temp3 = ip[1] + ((ip[1] * cospi8sqrt2minus1) >> 16);
- const int temp4 = (ip[3] * sinpi8sqrt2) >> 16;
- const int d1 = temp3 + temp4;
- op[0] = (a1 + d1 + 4) >> 3;
- op[3] = (a1 - d1 + 4) >> 3;
- op[1] = (b1 + c1 + 4) >> 3;
- op[2] = (b1 - c1 + 4) >> 3;
- ip += 4;
- op += 4;
- }
-}
-
-using libvpx_test::ACMRandom;
-
-TEST(VP8FdctTest, SignBiasCheck) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- int16_t test_input_block[16];
- int16_t test_output_block[16];
- const int pitch = 8;
- int count_sign_block[16][2];
- const int count_test_block = 1000000;
-
- memset(count_sign_block, 0, sizeof(count_sign_block));
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < 16; ++j)
- test_input_block[j] = rnd.Rand8() - rnd.Rand8();
-
- vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
-
- for (int j = 0; j < 16; ++j) {
- if (test_output_block[j] < 0)
- ++count_sign_block[j][0];
- else if (test_output_block[j] > 0)
- ++count_sign_block[j][1];
- }
- }
-
- bool bias_acceptable = true;
- for (int j = 0; j < 16; ++j)
- bias_acceptable = bias_acceptable &&
- (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
-
- EXPECT_EQ(true, bias_acceptable)
- << "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";
-
- memset(count_sign_block, 0, sizeof(count_sign_block));
-
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-15, 15].
- for (int j = 0; j < 16; ++j)
- test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4);
-
- vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
-
- for (int j = 0; j < 16; ++j) {
- if (test_output_block[j] < 0)
- ++count_sign_block[j][0];
- else if (test_output_block[j] > 0)
- ++count_sign_block[j][1];
- }
- }
-
- bias_acceptable = true;
- for (int j = 0; j < 16; ++j)
- bias_acceptable = bias_acceptable &&
- (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
-
- EXPECT_EQ(true, bias_acceptable)
- << "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";
-};
-
-TEST(VP8FdctTest, RoundTripErrorCheck) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- int max_error = 0;
- double total_error = 0;
- const int count_test_block = 1000000;
- for (int i = 0; i < count_test_block; ++i) {
- int16_t test_input_block[16];
- int16_t test_temp_block[16];
- int16_t test_output_block[16];
-
- // Initialize a test block with input range [-255, 255].
- for (int j = 0; j < 16; ++j)
- test_input_block[j] = rnd.Rand8() - rnd.Rand8();
-
- const int pitch = 8;
- vp8_short_fdct4x4_c(test_input_block, test_temp_block, pitch);
- reference_idct4x4(test_temp_block, test_output_block);
-
- for (int j = 0; j < 16; ++j) {
- const int diff = test_input_block[j] - test_output_block[j];
- const int error = diff * diff;
- if (max_error < error)
- max_error = error;
- total_error += error;
- }
- }
-
- EXPECT_GE(1, max_error )
- << "Error: FDCT/IDCT has an individual roundtrip error > 1";
-
- EXPECT_GE(count_test_block, total_error)
- << "Error: FDCT/IDCT has average roundtrip error > 1 per block";
-};
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/vp9_boolcoder_test.cc b/videocodec/libvpx_internal/libvpx/test/vp9_boolcoder_test.cc
deleted file mode 100644
index c579ade..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vp9_boolcoder_test.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "vp9/decoder/vp9_reader.h"
-#include "vp9/encoder/vp9_writer.h"
-
-#include "test/acm_random.h"
-#include "vpx/vpx_integer.h"
-
-using libvpx_test::ACMRandom;
-
-namespace {
-const int num_tests = 10;
-} // namespace
-
-TEST(VP9, TestBitIO) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- for (int n = 0; n < num_tests; ++n) {
- for (int method = 0; method <= 7; ++method) { // we generate various proba
- const int kBitsToTest = 1000;
- uint8_t probas[kBitsToTest];
-
- for (int i = 0; i < kBitsToTest; ++i) {
- const int parity = i & 1;
- probas[i] =
- (method == 0) ? 0 : (method == 1) ? 255 :
- (method == 2) ? 128 :
- (method == 3) ? rnd.Rand8() :
- (method == 4) ? (parity ? 0 : 255) :
- // alternate between low and high proba:
- (method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) :
- (method == 6) ?
- (parity ? rnd(64) : 255 - rnd(64)) :
- (parity ? rnd(32) : 255 - rnd(32));
- }
- for (int bit_method = 0; bit_method <= 3; ++bit_method) {
- const int random_seed = 6432;
- const int kBufferSize = 10000;
- ACMRandom bit_rnd(random_seed);
- vp9_writer bw;
- uint8_t bw_buffer[kBufferSize];
- vp9_start_encode(&bw, bw_buffer);
-
- int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
- for (int i = 0; i < kBitsToTest; ++i) {
- if (bit_method == 2) {
- bit = (i & 1);
- } else if (bit_method == 3) {
- bit = bit_rnd(2);
- }
- vp9_write(&bw, bit, static_cast<int>(probas[i]));
- }
-
- vp9_stop_encode(&bw);
-
- // First bit should be zero
- GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0);
-
- vp9_reader br;
- vp9_reader_init(&br, bw_buffer, kBufferSize);
- bit_rnd.Reset(random_seed);
- for (int i = 0; i < kBitsToTest; ++i) {
- if (bit_method == 2) {
- bit = (i & 1);
- } else if (bit_method == 3) {
- bit = bit_rnd(2);
- }
- GTEST_ASSERT_EQ(vp9_read(&br, probas[i]), bit)
- << "pos: " << i << " / " << kBitsToTest
- << " bit_method: " << bit_method
- << " method: " << method;
- }
- }
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/test/vp9_lossless_test.cc b/videocodec/libvpx_internal/libvpx/test/vp9_lossless_test.cc
deleted file mode 100644
index 7c3ba9f..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vp9_lossless_test.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "./vpx_config.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/encode_test_driver.h"
-#include "test/i420_video_source.h"
-#include "test/util.h"
-#include "test/y4m_video_source.h"
-
-namespace {
-
-const int kMaxPsnr = 100;
-
-class LosslessTestLarge : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
- protected:
- LosslessTestLarge()
- : EncoderTest(GET_PARAM(0)),
- psnr_(kMaxPsnr),
- nframes_(0),
- encoding_mode_(GET_PARAM(1)) {
- }
-
- virtual ~LosslessTestLarge() {}
-
- virtual void SetUp() {
- InitializeConfig();
- SetMode(encoding_mode_);
- }
-
- virtual void BeginPassHook(unsigned int /*pass*/) {
- psnr_ = kMaxPsnr;
- nframes_ = 0;
- }
-
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
- if (pkt->data.psnr.psnr[0] < psnr_)
- psnr_= pkt->data.psnr.psnr[0];
- }
-
- double GetMinPsnr() const {
- return psnr_;
- }
-
- private:
- double psnr_;
- unsigned int nframes_;
- libvpx_test::TestMode encoding_mode_;
-};
-
-TEST_P(LosslessTestLarge, TestLossLessEncoding) {
- const vpx_rational timebase = { 33333333, 1000000000 };
- cfg_.g_timebase = timebase;
- cfg_.rc_target_bitrate = 2000;
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_max_quantizer = 0;
-
- init_flags_ = VPX_CODEC_USE_PSNR;
-
- // intentionally changed the dimension for better testing coverage
- libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
- timebase.den, timebase.num, 0, 10);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- const double psnr_lossless = GetMinPsnr();
- EXPECT_GE(psnr_lossless, kMaxPsnr);
-}
-
-TEST_P(LosslessTestLarge, TestLossLessEncoding444) {
- libvpx_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 10);
-
- cfg_.g_profile = 1;
- cfg_.g_timebase = video.timebase();
- cfg_.rc_target_bitrate = 2000;
- cfg_.g_lag_in_frames = 25;
- cfg_.rc_min_quantizer = 0;
- cfg_.rc_max_quantizer = 0;
-
- init_flags_ = VPX_CODEC_USE_PSNR;
-
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
- const double psnr_lossless = GetMinPsnr();
- EXPECT_GE(psnr_lossless, kMaxPsnr);
-}
-
-VP9_INSTANTIATE_TEST_CASE(LosslessTestLarge, ALL_TEST_MODES);
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/vp9_subtract_test.cc b/videocodec/libvpx_internal/libvpx/test/vp9_subtract_test.cc
deleted file mode 100644
index d7df286..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vp9_subtract_test.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vpx_mem/vpx_mem.h"
-
-typedef void (*subtract_fn_t)(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);
-
-namespace vp9 {
-
-class VP9SubtractBlockTest : public ::testing::TestWithParam<subtract_fn_t> {
- public:
- virtual void TearDown() {
- libvpx_test::ClearSystemState();
- }
-};
-
-using libvpx_test::ACMRandom;
-
-TEST_P(VP9SubtractBlockTest, SimpleSubtract) {
- ACMRandom rnd(ACMRandom::DeterministicSeed());
-
- // FIXME(rbultje) split in its own file
- for (BLOCK_SIZE bsize = BLOCK_4X4; bsize < BLOCK_SIZES;
- bsize = static_cast<BLOCK_SIZE>(static_cast<int>(bsize) + 1)) {
- const int block_width = 4 * num_4x4_blocks_wide_lookup[bsize];
- const int block_height = 4 * num_4x4_blocks_high_lookup[bsize];
- int16_t *diff = reinterpret_cast<int16_t *>(
- vpx_memalign(16, sizeof(*diff) * block_width * block_height * 2));
- uint8_t *pred = reinterpret_cast<uint8_t *>(
- vpx_memalign(16, block_width * block_height * 2));
- uint8_t *src = reinterpret_cast<uint8_t *>(
- vpx_memalign(16, block_width * block_height * 2));
-
- for (int n = 0; n < 100; n++) {
- for (int r = 0; r < block_height; ++r) {
- for (int c = 0; c < block_width * 2; ++c) {
- src[r * block_width * 2 + c] = rnd.Rand8();
- pred[r * block_width * 2 + c] = rnd.Rand8();
- }
- }
-
- GetParam()(block_height, block_width, diff, block_width,
- src, block_width, pred, block_width);
-
- for (int r = 0; r < block_height; ++r) {
- for (int c = 0; c < block_width; ++c) {
- EXPECT_EQ(diff[r * block_width + c],
- (src[r * block_width + c] -
- pred[r * block_width + c])) << "r = " << r
- << ", c = " << c
- << ", bs = " << bsize;
- }
- }
-
- GetParam()(block_height, block_width, diff, block_width * 2,
- src, block_width * 2, pred, block_width * 2);
-
- for (int r = 0; r < block_height; ++r) {
- for (int c = 0; c < block_width; ++c) {
- EXPECT_EQ(diff[r * block_width * 2 + c],
- (src[r * block_width * 2 + c] -
- pred[r * block_width * 2 + c])) << "r = " << r
- << ", c = " << c
- << ", bs = " << bsize;
- }
- }
- }
- vpx_free(diff);
- vpx_free(pred);
- vpx_free(src);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(C, VP9SubtractBlockTest,
- ::testing::Values(vp9_subtract_block_c));
-
-#if HAVE_SSE2 && CONFIG_USE_X86INC
-INSTANTIATE_TEST_CASE_P(SSE2, VP9SubtractBlockTest,
- ::testing::Values(vp9_subtract_block_sse2));
-#endif
-} // namespace vp9
diff --git a/videocodec/libvpx_internal/libvpx/test/vp9_thread_test.cc b/videocodec/libvpx_internal/libvpx/test/vp9_thread_test.cc
deleted file mode 100644
index a78cdea..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vp9_thread_test.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <string>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/codec_factory.h"
-#include "test/decode_test_driver.h"
-#include "test/md5_helper.h"
-#include "test/webm_video_source.h"
-#include "vp9/decoder/vp9_thread.h"
-
-namespace {
-
-using std::string;
-
-class VP9WorkerThreadTest : public ::testing::TestWithParam<bool> {
- protected:
- virtual ~VP9WorkerThreadTest() {}
- virtual void SetUp() {
- vp9_worker_init(&worker_);
- }
-
- virtual void TearDown() {
- vp9_worker_end(&worker_);
- }
-
- VP9Worker worker_;
-};
-
-int ThreadHook(void* data, void* return_value) {
- int* const hook_data = reinterpret_cast<int*>(data);
- *hook_data = 5;
- return *reinterpret_cast<int*>(return_value);
-}
-
-TEST_P(VP9WorkerThreadTest, HookSuccess) {
- EXPECT_NE(vp9_worker_sync(&worker_), 0); // should be a no-op.
-
- for (int i = 0; i < 2; ++i) {
- EXPECT_NE(vp9_worker_reset(&worker_), 0);
-
- int hook_data = 0;
- int return_value = 1; // return successfully from the hook
- worker_.hook = ThreadHook;
- worker_.data1 = &hook_data;
- worker_.data2 = &return_value;
-
- const bool synchronous = GetParam();
- if (synchronous) {
- vp9_worker_execute(&worker_);
- } else {
- vp9_worker_launch(&worker_);
- }
- EXPECT_NE(vp9_worker_sync(&worker_), 0);
- EXPECT_FALSE(worker_.had_error);
- EXPECT_EQ(5, hook_data);
-
- EXPECT_NE(vp9_worker_sync(&worker_), 0); // should be a no-op.
- }
-}
-
-TEST_P(VP9WorkerThreadTest, HookFailure) {
- EXPECT_NE(vp9_worker_reset(&worker_), 0);
-
- int hook_data = 0;
- int return_value = 0; // return failure from the hook
- worker_.hook = ThreadHook;
- worker_.data1 = &hook_data;
- worker_.data2 = &return_value;
-
- const bool synchronous = GetParam();
- if (synchronous) {
- vp9_worker_execute(&worker_);
- } else {
- vp9_worker_launch(&worker_);
- }
- EXPECT_FALSE(vp9_worker_sync(&worker_));
- EXPECT_EQ(1, worker_.had_error);
-
- // Ensure _reset() clears the error and _launch() can be called again.
- return_value = 1;
- EXPECT_NE(vp9_worker_reset(&worker_), 0);
- EXPECT_FALSE(worker_.had_error);
- vp9_worker_launch(&worker_);
- EXPECT_NE(vp9_worker_sync(&worker_), 0);
- EXPECT_FALSE(worker_.had_error);
-}
-
-// -----------------------------------------------------------------------------
-// Multi-threaded decode tests
-
-// Decodes |filename| with |num_threads|. Returns the md5 of the decoded frames.
-string DecodeFile(const string& filename, int num_threads) {
- libvpx_test::WebMVideoSource video(filename);
- video.Init();
-
- vpx_codec_dec_cfg_t cfg = {0};
- cfg.threads = num_threads;
- libvpx_test::VP9Decoder decoder(cfg, 0);
-
- libvpx_test::MD5 md5;
- for (video.Begin(); video.cxdata(); video.Next()) {
- const vpx_codec_err_t res =
- decoder.DecodeFrame(video.cxdata(), video.frame_size());
- if (res != VPX_CODEC_OK) {
- EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();
- break;
- }
-
- libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
- const vpx_image_t *img = NULL;
-
- // Get decompressed data
- while ((img = dec_iter.Next())) {
- md5.Add(img);
- }
- }
- return string(md5.Get());
-}
-
-TEST(VP9DecodeMTTest, MTDecode) {
- // no tiles or frame parallel; this exercises loop filter threading.
- EXPECT_STREQ("b35a1b707b28e82be025d960aba039bc",
- DecodeFile("vp90-2-03-size-226x226.webm", 2).c_str());
-}
-
-TEST(VP9DecodeMTTest, MTDecode2) {
- static const struct {
- const char *name;
- const char *expected_md5;
- } files[] = {
- { "vp90-2-08-tile_1x2_frame_parallel.webm",
- "68ede6abd66bae0a2edf2eb9232241b6" },
- { "vp90-2-08-tile_1x4_frame_parallel.webm",
- "368ebc6ebf3a5e478d85b2c3149b2848" },
- { "vp90-2-08-tile_1x8_frame_parallel.webm",
- "17e439da2388aff3a0f69cb22579c6c1" },
- };
-
- for (int i = 0; i < static_cast<int>(sizeof(files) / sizeof(files[0])); ++i) {
- for (int t = 2; t <= 8; ++t) {
- EXPECT_STREQ(files[i].expected_md5, DecodeFile(files[i].name, t).c_str())
- << "threads = " << t;
- }
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Synchronous, VP9WorkerThreadTest, ::testing::Bool());
-
-} // namespace
diff --git a/videocodec/libvpx_internal/libvpx/test/vpxdec.sh b/videocodec/libvpx_internal/libvpx/test/vpxdec.sh
deleted file mode 100644
index d236f97..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vpxdec.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-##
-## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-## This file tests vpxdec. To add new tests to this file, do the following:
-## 1. Write a shell function (this is your test).
-## 2. Add the function to vpxdec_tests (on a new line).
-##
-. $(dirname $0)/tools_common.sh
-
-VP8_IVF_FILE="${LIBVPX_TEST_DATA_PATH}/vp80-00-comprehensive-001.ivf"
-VP9_WEBM_FILE="${LIBVPX_TEST_DATA_PATH}/vp90-2-00-quantizer-00.webm"
-
-# Environment check: Make sure input is available.
-vpxdec_verify_environment() {
- if [ ! -e "${VP8_IVF_FILE}" ] || [ ! -e "${VP9_WEBM_FILE}" ]; then
- echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
- return 1
- fi
-}
-
-vpxdec_can_decode_vp8() {
- if [ "$(vpxdec_available)" = "yes" ] && \
- [ "$(vp8_decode_available)" = "yes" ]; then
- echo yes
- fi
-}
-
-vpxdec_can_decode_vp9() {
- if [ "$(vpxdec_available)" = "yes" ] && \
- [ "$(vp9_decode_available)" = "yes" ]; then
- echo yes
- fi
-}
-
-vpxdec_vp8_ivf() {
- if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
- vpxdec "${VP8_IVF_FILE}"
- fi
-}
-
-vpxdec_vp8_ivf_pipe_input() {
- if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
- vpxdec "${VP8_IVF_FILE}" -
- fi
-}
-
-vpxdec_vp9_webm() {
- if [ "$(vpxdec_can_decode_vp9)" = "yes" ] && \
- [ "$(webm_io_available)" = "yes" ]; then
- vpxdec "${VP9_WEBM_FILE}"
- fi
-}
-
-vpxdec_tests="vpxdec_vp8_ivf
- vpxdec_vp8_ivf_pipe_input
- vpxdec_vp9_webm"
-
-run_tests vpxdec_verify_environment "${vpxdec_tests}"
diff --git a/videocodec/libvpx_internal/libvpx/test/vpxenc.sh b/videocodec/libvpx_internal/libvpx/test/vpxenc.sh
deleted file mode 100644
index 89e4eb3..0000000
--- a/videocodec/libvpx_internal/libvpx/test/vpxenc.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/sh
-##
-## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-## This file tests vpxenc using hantro_collage_w352h288.yuv as input. To add
-## new tests to this file, do the following:
-## 1. Write a shell function (this is your test).
-## 2. Add the function to vpxenc_tests (on a new line).
-##
-. $(dirname $0)/tools_common.sh
-
-YUV_RAW_INPUT="${LIBVPX_TEST_DATA_PATH}/hantro_collage_w352h288.yuv"
-YUV_RAW_INPUT_WIDTH=352
-YUV_RAW_INPUT_HEIGHT=288
-TEST_FRAMES=10
-
-# Environment check: Make sure input is available.
-vpxenc_verify_environment() {
- if [ ! -e "${YUV_RAW_INPUT}" ]; then
- echo "The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH."
- return 1
- fi
-}
-
-vpxenc_can_encode_vp8() {
- if [ "$(vpxenc_available)" = "yes" ] && \
- [ "$(vp8_encode_available)" = "yes" ]; then
- echo yes
- fi
-}
-
-vpxenc_can_encode_vp9() {
- if [ "$(vpxenc_available)" = "yes" ] && \
- [ "$(vp9_encode_available)" = "yes" ]; then
- echo yes
- fi
-}
-
-vpxenc_vp8_ivf() {
- if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
- vpxenc vp8 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
- "${YUV_RAW_INPUT}" vp8.ivf
- fi
-}
-
-vpxenc_vp8_ivf_pipe_input() {
- if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
- vpxenc vp8 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
- "${YUV_RAW_INPUT}" vp8.ivf -
- fi
-}
-
-vpxenc_vp8_webm() {
- if [ "$(vpxenc_can_encode_vp8)" = "yes" ] &&
- [ "$(webm_io_available)" = "yes" ] ; then
- vpxenc vp8 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
- "${YUV_RAW_INPUT}" vp8.webm
- fi
-}
-
-vpxenc_vp9_ivf() {
- if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
- vpxenc vp9 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
- "${YUV_RAW_INPUT}" vp9.ivf
- fi
-}
-
-vpxenc_vp9_webm() {
- if [ "$(vpxenc_can_encode_vp9)" = "yes" ] &&
- [ "$(webm_io_available)" = "yes" ] ; then
- vpxenc vp9 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
- "${YUV_RAW_INPUT}" vp9.webm
- fi
-}
-
-DISABLED_vpxenc_vp9_ivf_lossless() {
- if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
- vpxenc vp9 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
- "${YUV_RAW_INPUT}" vp9_lossless.ivf --lossless
- fi
-}
-
-vpxenc_tests="vpxenc_vp8_ivf
- vpxenc_vp8_webm
- vpxenc_vp8_ivf_pipe_input
- vpxenc_vp9_ivf
- vpxenc_vp9_webm
- DISABLED_vpxenc_vp9_ivf_lossless"
-
-run_tests vpxenc_verify_environment "${vpxenc_tests}"
diff --git a/videocodec/libvpx_internal/libvpx/test/webm_video_source.h b/videocodec/libvpx_internal/libvpx/test/webm_video_source.h
deleted file mode 100644
index 9d88ae3..0000000
--- a/videocodec/libvpx_internal/libvpx/test/webm_video_source.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_WEBM_VIDEO_SOURCE_H_
-#define TEST_WEBM_VIDEO_SOURCE_H_
-#include <cstdarg>
-#include <cstdio>
-#include <cstdlib>
-#include <new>
-#include <string>
-#include "third_party/nestegg/include/nestegg/nestegg.h"
-#include "test/video_source.h"
-
-namespace libvpx_test {
-
-static int
-nestegg_read_cb(void *buffer, size_t length, void *userdata) {
- FILE *f = reinterpret_cast<FILE *>(userdata);
-
- if (fread(buffer, 1, length, f) < length) {
- if (ferror(f))
- return -1;
- if (feof(f))
- return 0;
- }
- return 1;
-}
-
-
-static int
-nestegg_seek_cb(int64_t offset, int whence, void *userdata) {
- FILE *f = reinterpret_cast<FILE *>(userdata);
- switch (whence) {
- case NESTEGG_SEEK_SET:
- whence = SEEK_SET;
- break;
- case NESTEGG_SEEK_CUR:
- whence = SEEK_CUR;
- break;
- case NESTEGG_SEEK_END:
- whence = SEEK_END;
- break;
- };
- return fseek(f, (long)offset, whence) ? -1 : 0;
-}
-
-
-static int64_t
-nestegg_tell_cb(void *userdata) {
- FILE *f = reinterpret_cast<FILE *>(userdata);
- return ftell(f);
-}
-
-
-static void
-nestegg_log_cb(nestegg *context, unsigned int severity, char const *format,
- ...) {
- va_list ap;
-
- va_start(ap, format);
- vfprintf(stderr, format, ap);
- fprintf(stderr, "\n");
- va_end(ap);
-}
-
-// This class extends VideoSource to allow parsing of WebM files,
-// so that we can do actual file decodes.
-class WebMVideoSource : public CompressedVideoSource {
- public:
- explicit WebMVideoSource(const std::string &file_name)
- : file_name_(file_name),
- input_file_(NULL),
- nestegg_ctx_(NULL),
- pkt_(NULL),
- video_track_(0),
- chunk_(0),
- chunks_(0),
- buf_(NULL),
- buf_sz_(0),
- frame_(0),
- end_of_file_(false) {
- }
-
- virtual ~WebMVideoSource() {
- if (input_file_)
- fclose(input_file_);
- if (nestegg_ctx_ != NULL) {
- if (pkt_ != NULL) {
- nestegg_free_packet(pkt_);
- }
- nestegg_destroy(nestegg_ctx_);
- }
- }
-
- virtual void Init() {
- }
-
- virtual void Begin() {
- input_file_ = OpenTestDataFile(file_name_);
- ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
- << file_name_;
-
- nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb,
- input_file_};
- ASSERT_FALSE(nestegg_init(&nestegg_ctx_, io, NULL, -1))
- << "nestegg_init failed";
-
- unsigned int n;
- ASSERT_FALSE(nestegg_track_count(nestegg_ctx_, &n))
- << "failed to get track count";
-
- for (unsigned int i = 0; i < n; i++) {
- int track_type = nestegg_track_type(nestegg_ctx_, i);
- ASSERT_GE(track_type, 0) << "failed to get track type";
-
- if (track_type == NESTEGG_TRACK_VIDEO) {
- video_track_ = i;
- break;
- }
- }
-
- FillFrame();
- }
-
- virtual void Next() {
- ++frame_;
- FillFrame();
- }
-
- void FillFrame() {
- ASSERT_TRUE(input_file_ != NULL);
- if (chunk_ >= chunks_) {
- unsigned int track;
-
- do {
- /* End of this packet, get another. */
- if (pkt_ != NULL) {
- nestegg_free_packet(pkt_);
- pkt_ = NULL;
- }
-
- int again = nestegg_read_packet(nestegg_ctx_, &pkt_);
- ASSERT_GE(again, 0) << "nestegg_read_packet failed";
- if (!again) {
- end_of_file_ = true;
- return;
- }
-
- ASSERT_FALSE(nestegg_packet_track(pkt_, &track))
- << "nestegg_packet_track failed";
- } while (track != video_track_);
-
- ASSERT_FALSE(nestegg_packet_count(pkt_, &chunks_))
- << "nestegg_packet_count failed";
- chunk_ = 0;
- }
-
- ASSERT_FALSE(nestegg_packet_data(pkt_, chunk_, &buf_, &buf_sz_))
- << "nestegg_packet_data failed";
- chunk_++;
- }
-
- virtual const uint8_t *cxdata() const {
- return end_of_file_ ? NULL : buf_;
- }
- virtual size_t frame_size() const { return buf_sz_; }
- virtual unsigned int frame_number() const { return frame_; }
-
- protected:
- std::string file_name_;
- FILE *input_file_;
- nestegg *nestegg_ctx_;
- nestegg_packet *pkt_;
- unsigned int video_track_;
- unsigned int chunk_;
- unsigned int chunks_;
- uint8_t *buf_;
- size_t buf_sz_;
- unsigned int frame_;
- bool end_of_file_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_WEBM_VIDEO_SOURCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/test/y4m_video_source.h b/videocodec/libvpx_internal/libvpx/test/y4m_video_source.h
deleted file mode 100644
index 7419043..0000000
--- a/videocodec/libvpx_internal/libvpx/test/y4m_video_source.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TEST_Y4M_VIDEO_SOURCE_H_
-#define TEST_Y4M_VIDEO_SOURCE_H_
-#include <string>
-
-#include "test/video_source.h"
-#include "./y4minput.h"
-
-namespace libvpx_test {
-
-// This class extends VideoSource to allow parsing of raw yv12
-// so that we can do actual file encodes.
-class Y4mVideoSource : public VideoSource {
- public:
- Y4mVideoSource(const std::string &file_name,
- unsigned int start, int limit)
- : file_name_(file_name),
- input_file_(NULL),
- img_(new vpx_image_t()),
- start_(start),
- limit_(limit),
- frame_(0),
- framerate_numerator_(0),
- framerate_denominator_(0),
- y4m_() {
- }
-
- virtual ~Y4mVideoSource() {
- vpx_img_free(img_.get());
- CloseSource();
- }
-
- virtual void Begin() {
- CloseSource();
- input_file_ = OpenTestDataFile(file_name_);
- ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
- << file_name_;
-
- y4m_input_open(&y4m_, input_file_, NULL, 0, 0);
- framerate_numerator_ = y4m_.fps_n;
- framerate_denominator_ = y4m_.fps_d;
-
- frame_ = 0;
- for (unsigned int i = 0; i < start_; i++) {
- Next();
- }
-
- FillFrame();
- }
-
- virtual void Next() {
- ++frame_;
- FillFrame();
- }
-
- virtual vpx_image_t *img() const {
- return (frame_ < limit_) ? img_.get() : NULL;
- }
-
- // Models a stream where Timebase = 1/FPS, so pts == frame.
- virtual vpx_codec_pts_t pts() const { return frame_; }
-
- virtual unsigned long duration() const { return 1; }
-
- virtual vpx_rational_t timebase() const {
- const vpx_rational_t t = { framerate_denominator_, framerate_numerator_ };
- return t;
- }
-
- virtual unsigned int frame() const { return frame_; }
-
- virtual unsigned int limit() const { return limit_; }
-
- virtual void FillFrame() {
- ASSERT_TRUE(input_file_ != NULL);
- // Read a frame from input_file.
- y4m_input_fetch_frame(&y4m_, input_file_, img_.get());
- }
-
- protected:
- void CloseSource() {
- y4m_input_close(&y4m_);
- y4m_ = y4m_input();
- if (input_file_ != NULL) {
- fclose(input_file_);
- input_file_ = NULL;
- }
- }
-
- std::string file_name_;
- FILE *input_file_;
- testing::internal::scoped_ptr<vpx_image_t> img_;
- unsigned int start_;
- unsigned int limit_;
- unsigned int frame_;
- int framerate_numerator_;
- int framerate_denominator_;
- y4m_input y4m_;
-};
-
-} // namespace libvpx_test
-
-#endif // TEST_Y4M_VIDEO_SOURCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/README.webm b/videocodec/libvpx_internal/libvpx/third_party/googletest/README.webm
deleted file mode 100644
index 6fdeb87..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/README.webm
+++ /dev/null
@@ -1,15 +0,0 @@
-URL: http://code.google.com/p/googletest/
-Version: 1.7.0
-License: BSD
-License File: COPYING
-
-Description:
-Google's framework for writing C++ tests on a variety of platforms
-(Linux, Mac OS X, Windows, Windows CE, Symbian, etc). Based on the
-xUnit architecture. Supports automatic test discovery, a rich set of
-assertions, user-defined assertions, death tests, fatal and non-fatal
-failures, various options for running the tests, and XML test report
-generation.
-
-Local Modifications:
-None. \ No newline at end of file
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/gtest.mk b/videocodec/libvpx_internal/libvpx/third_party/googletest/gtest.mk
deleted file mode 100644
index 0de3113..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/gtest.mk
+++ /dev/null
@@ -1 +0,0 @@
-GTEST_SRCS-yes += src/gtest-all.cc
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/CHANGES b/videocodec/libvpx_internal/libvpx/third_party/googletest/src/CHANGES
deleted file mode 100644
index 0552132..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/CHANGES
+++ /dev/null
@@ -1,157 +0,0 @@
-Changes for 1.7.0:
-
-* New feature: death tests are supported on OpenBSD and in iOS
- simulator now.
-* New feature: Google Test now implements a protocol to allow
- a test runner to detect that a test program has exited
- prematurely and report it as a failure (before it would be
- falsely reported as a success if the exit code is 0).
-* New feature: Test::RecordProperty() can now be used outside of the
- lifespan of a test method, in which case it will be attributed to
- the current test case or the test program in the XML report.
-* New feature (potentially breaking): --gtest_list_tests now prints
- the type parameters and value parameters for each test.
-* Improvement: char pointers and char arrays are now escaped properly
- in failure messages.
-* Improvement: failure summary in XML reports now includes file and
- line information.
-* Improvement: the <testsuites> XML element now has a timestamp attribute.
-* Improvement: When --gtest_filter is specified, XML report now doesn't
- contain information about tests that are filtered out.
-* Fixed the bug where long --gtest_filter flag values are truncated in
- death tests.
-* Potentially breaking change: RUN_ALL_TESTS() is now implemented as a
- function instead of a macro in order to work better with Clang.
-* Compatibility fixes with C++ 11 and various platforms.
-* Bug/warning fixes.
-
-Changes for 1.6.0:
-
-* New feature: ADD_FAILURE_AT() for reporting a test failure at the
- given source location -- useful for writing testing utilities.
-* New feature: the universal value printer is moved from Google Mock
- to Google Test.
-* New feature: type parameters and value parameters are reported in
- the XML report now.
-* A gtest_disable_pthreads CMake option.
-* Colored output works in GNU Screen sessions now.
-* Parameters of value-parameterized tests are now printed in the
- textual output.
-* Failures from ad hoc test assertions run before RUN_ALL_TESTS() are
- now correctly reported.
-* Arguments of ASSERT_XY and EXPECT_XY no longer need to support << to
- ostream.
-* More complete handling of exceptions.
-* GTEST_ASSERT_XY can be used instead of ASSERT_XY in case the latter
- name is already used by another library.
-* --gtest_catch_exceptions is now true by default, allowing a test
- program to continue after an exception is thrown.
-* Value-parameterized test fixtures can now derive from Test and
- WithParamInterface<T> separately, easing conversion of legacy tests.
-* Death test messages are clearly marked to make them more
- distinguishable from other messages.
-* Compatibility fixes for Android, Google Native Client, MinGW, HP UX,
- PowerPC, Lucid autotools, libCStd, Sun C++, Borland C++ Builder (Code Gear),
- IBM XL C++ (Visual Age C++), and C++0x.
-* Bug fixes and implementation clean-ups.
-* Potentially incompatible changes: disables the harmful 'make install'
- command in autotools.
-
-Changes for 1.5.0:
-
- * New feature: assertions can be safely called in multiple threads
- where the pthreads library is available.
- * New feature: predicates used inside EXPECT_TRUE() and friends
- can now generate custom failure messages.
- * New feature: Google Test can now be compiled as a DLL.
- * New feature: fused source files are included.
- * New feature: prints help when encountering unrecognized Google Test flags.
- * Experimental feature: CMake build script (requires CMake 2.6.4+).
- * Experimental feature: the Pump script for meta programming.
- * double values streamed to an assertion are printed with enough precision
- to differentiate any two different values.
- * Google Test now works on Solaris and AIX.
- * Build and test script improvements.
- * Bug fixes and implementation clean-ups.
-
- Potentially breaking changes:
-
- * Stopped supporting VC++ 7.1 with exceptions disabled.
- * Dropped support for 'make install'.
-
-Changes for 1.4.0:
-
- * New feature: the event listener API
- * New feature: test shuffling
- * New feature: the XML report format is closer to junitreport and can
- be parsed by Hudson now.
- * New feature: when a test runs under Visual Studio, its failures are
- integrated in the IDE.
- * New feature: /MD(d) versions of VC++ projects.
- * New feature: elapsed time for the tests is printed by default.
- * New feature: comes with a TR1 tuple implementation such that Boost
- is no longer needed for Combine().
- * New feature: EXPECT_DEATH_IF_SUPPORTED macro and friends.
- * New feature: the Xcode project can now produce static gtest
- libraries in addition to a framework.
- * Compatibility fixes for Solaris, Cygwin, minGW, Windows Mobile,
- Symbian, gcc, and C++Builder.
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.3.0:
-
- * New feature: death tests on Windows, Cygwin, and Mac.
- * New feature: ability to use Google Test assertions in other testing
- frameworks.
- * New feature: ability to run disabled test via
- --gtest_also_run_disabled_tests.
- * New feature: the --help flag for printing the usage.
- * New feature: access to Google Test flag values in user code.
- * New feature: a script that packs Google Test into one .h and one
- .cc file for easy deployment.
- * New feature: support for distributing test functions to multiple
- machines (requires support from the test runner).
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.2.1:
-
- * Compatibility fixes for Linux IA-64 and IBM z/OS.
- * Added support for using Boost and other TR1 implementations.
- * Changes to the build scripts to support upcoming release of Google C++
- Mocking Framework.
- * Added Makefile to the distribution package.
- * Improved build instructions in README.
-
-Changes for 1.2.0:
-
- * New feature: value-parameterized tests.
- * New feature: the ASSERT/EXPECT_(NON)FATAL_FAILURE(_ON_ALL_THREADS)
- macros.
- * Changed the XML report format to match JUnit/Ant's.
- * Added tests to the Xcode project.
- * Added scons/SConscript for building with SCons.
- * Added src/gtest-all.cc for building Google Test from a single file.
- * Fixed compatibility with Solaris and z/OS.
- * Enabled running Python tests on systems with python 2.3 installed,
- e.g. Mac OS X 10.4.
- * Bug fixes.
-
-Changes for 1.1.0:
-
- * New feature: type-parameterized tests.
- * New feature: exception assertions.
- * New feature: printing elapsed time of tests.
- * Improved the robustness of death tests.
- * Added an Xcode project and samples.
- * Adjusted the output format on Windows to be understandable by Visual Studio.
- * Minor bug fixes.
-
-Changes for 1.0.1:
-
- * Added project files for Visual Studio 7.1.
- * Fixed issues with compiling on Mac OS X.
- * Fixed issues with compiling on Cygwin.
-
-Changes for 1.0.0:
-
- * Initial Open Source release of Google Test
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/CONTRIBUTORS b/videocodec/libvpx_internal/libvpx/third_party/googletest/src/CONTRIBUTORS
deleted file mode 100644
index feae2fc..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/CONTRIBUTORS
+++ /dev/null
@@ -1,37 +0,0 @@
-# This file contains a list of people who've made non-trivial
-# contribution to the Google C++ Testing Framework project. People
-# who commit code to the project are encouraged to add their names
-# here. Please keep the list sorted by first names.
-
-Ajay Joshi <jaj@google.com>
-Balázs Dán <balazs.dan@gmail.com>
-Bharat Mediratta <bharat@menalto.com>
-Chandler Carruth <chandlerc@google.com>
-Chris Prince <cprince@google.com>
-Chris Taylor <taylorc@google.com>
-Dan Egnor <egnor@google.com>
-Eric Roman <eroman@chromium.org>
-Hady Zalek <hady.zalek@gmail.com>
-Jeffrey Yasskin <jyasskin@google.com>
-Jói Sigurðsson <joi@google.com>
-Keir Mierle <mierle@gmail.com>
-Keith Ray <keith.ray@gmail.com>
-Kenton Varda <kenton@google.com>
-Manuel Klimek <klimek@google.com>
-Markus Heule <markus.heule@gmail.com>
-Mika Raento <mikie@iki.fi>
-Miklós Fazekas <mfazekas@szemafor.com>
-Pasi Valminen <pasi.valminen@gmail.com>
-Patrick Hanna <phanna@google.com>
-Patrick Riley <pfr@google.com>
-Peter Kaminski <piotrk@google.com>
-Preston Jackson <preston.a.jackson@gmail.com>
-Rainer Klaffenboeck <rainer.klaffenboeck@dynatrace.com>
-Russ Cox <rsc@google.com>
-Russ Rufer <russ@pentad.com>
-Sean Mcafee <eefacm@gmail.com>
-Sigurður Ásgeirsson <siggi@google.com>
-Tracy Bialik <tracy@pentad.com>
-Vadim Berman <vadimb@google.com>
-Vlad Losev <vladl@google.com>
-Zhanyong Wan <wan@google.com>
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/LICENSE b/videocodec/libvpx_internal/libvpx/third_party/googletest/src/LICENSE
deleted file mode 100644
index 1941a11..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/README b/videocodec/libvpx_internal/libvpx/third_party/googletest/src/README
deleted file mode 100644
index 26f35a8..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/README
+++ /dev/null
@@ -1,435 +0,0 @@
-Google C++ Testing Framework
-============================
-
-http://code.google.com/p/googletest/
-
-Overview
---------
-
-Google's framework for writing C++ tests on a variety of platforms
-(Linux, Mac OS X, Windows, Windows CE, Symbian, etc). Based on the
-xUnit architecture. Supports automatic test discovery, a rich set of
-assertions, user-defined assertions, death tests, fatal and non-fatal
-failures, various options for running the tests, and XML test report
-generation.
-
-Please see the project page above for more information as well as the
-mailing list for questions, discussions, and development. There is
-also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
-join us!
-
-Requirements for End Users
---------------------------
-
-Google Test is designed to have fairly minimal requirements to build
-and use with your projects, but there are some. Currently, we support
-Linux, Windows, Mac OS X, and Cygwin. We will also make our best
-effort to support other platforms (e.g. Solaris, AIX, and z/OS).
-However, since core members of the Google Test project have no access
-to these platforms, Google Test may have outstanding issues there. If
-you notice any problems on your platform, please notify
-googletestframework@googlegroups.com. Patches for fixing them are
-even more welcome!
-
-### Linux Requirements ###
-
-These are the base requirements to build and use Google Test from a source
-package (as described below):
- * GNU-compatible Make or gmake
- * POSIX-standard shell
- * POSIX(-2) Regular Expressions (regex.h)
- * A C++98-standard-compliant compiler
-
-### Windows Requirements ###
-
- * Microsoft Visual C++ 7.1 or newer
-
-### Cygwin Requirements ###
-
- * Cygwin 1.5.25-14 or newer
-
-### Mac OS X Requirements ###
-
- * Mac OS X 10.4 Tiger or newer
- * Developer Tools Installed
-
-Also, you'll need CMake 2.6.4 or higher if you want to build the
-samples using the provided CMake script, regardless of the platform.
-
-Requirements for Contributors
------------------------------
-
-We welcome patches. If you plan to contribute a patch, you need to
-build Google Test and its own tests from an SVN checkout (described
-below), which has further requirements:
-
- * Python version 2.3 or newer (for running some of the tests and
- re-generating certain source files from templates)
- * CMake 2.6.4 or newer
-
-Getting the Source
-------------------
-
-There are two primary ways of getting Google Test's source code: you
-can download a stable source release in your preferred archive format,
-or directly check out the source from our Subversion (SVN) repositary.
-The SVN checkout requires a few extra steps and some extra software
-packages on your system, but lets you track the latest development and
-make patches much more easily, so we highly encourage it.
-
-### Source Package ###
-
-Google Test is released in versioned source packages which can be
-downloaded from the download page [1]. Several different archive
-formats are provided, but the only difference is the tools used to
-manipulate them, and the size of the resulting file. Download
-whichever you are most comfortable with.
-
- [1] http://code.google.com/p/googletest/downloads/list
-
-Once the package is downloaded, expand it using whichever tools you
-prefer for that type. This will result in a new directory with the
-name "gtest-X.Y.Z" which contains all of the source code. Here are
-some examples on Linux:
-
- tar -xvzf gtest-X.Y.Z.tar.gz
- tar -xvjf gtest-X.Y.Z.tar.bz2
- unzip gtest-X.Y.Z.zip
-
-### SVN Checkout ###
-
-To check out the main branch (also known as the "trunk") of Google
-Test, run the following Subversion command:
-
- svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn
-
-Setting up the Build
---------------------
-
-To build Google Test and your tests that use it, you need to tell your
-build system where to find its headers and source files. The exact
-way to do it depends on which build system you use, and is usually
-straightforward.
-
-### Generic Build Instructions ###
-
-Suppose you put Google Test in directory ${GTEST_DIR}. To build it,
-create a library build target (or a project as called by Visual Studio
-and Xcode) to compile
-
- ${GTEST_DIR}/src/gtest-all.cc
-
-with ${GTEST_DIR}/include in the system header search path and ${GTEST_DIR}
-in the normal header search path. Assuming a Linux-like system and gcc,
-something like the following will do:
-
- g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
- -pthread -c ${GTEST_DIR}/src/gtest-all.cc
- ar -rv libgtest.a gtest-all.o
-
-(We need -pthread as Google Test uses threads.)
-
-Next, you should compile your test source file with
-${GTEST_DIR}/include in the system header search path, and link it
-with gtest and any other necessary libraries:
-
- g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \
- -o your_test
-
-As an example, the make/ directory contains a Makefile that you can
-use to build Google Test on systems where GNU make is available
-(e.g. Linux, Mac OS X, and Cygwin). It doesn't try to build Google
-Test's own tests. Instead, it just builds the Google Test library and
-a sample test. You can use it as a starting point for your own build
-script.
-
-If the default settings are correct for your environment, the
-following commands should succeed:
-
- cd ${GTEST_DIR}/make
- make
- ./sample1_unittest
-
-If you see errors, try to tweak the contents of make/Makefile to make
-them go away. There are instructions in make/Makefile on how to do
-it.
-
-### Using CMake ###
-
-Google Test comes with a CMake build script (CMakeLists.txt) that can
-be used on a wide range of platforms ("C" stands for cross-platofrm.).
-If you don't have CMake installed already, you can download it for
-free from http://www.cmake.org/.
-
-CMake works by generating native makefiles or build projects that can
-be used in the compiler environment of your choice. The typical
-workflow starts with:
-
- mkdir mybuild # Create a directory to hold the build output.
- cd mybuild
- cmake ${GTEST_DIR} # Generate native build scripts.
-
-If you want to build Google Test's samples, you should replace the
-last command with
-
- cmake -Dgtest_build_samples=ON ${GTEST_DIR}
-
-If you are on a *nix system, you should now see a Makefile in the
-current directory. Just type 'make' to build gtest.
-
-If you use Windows and have Vistual Studio installed, a gtest.sln file
-and several .vcproj files will be created. You can then build them
-using Visual Studio.
-
-On Mac OS X with Xcode installed, a .xcodeproj file will be generated.
-
-### Legacy Build Scripts ###
-
-Before settling on CMake, we have been providing hand-maintained build
-projects/scripts for Visual Studio, Xcode, and Autotools. While we
-continue to provide them for convenience, they are not actively
-maintained any more. We highly recommend that you follow the
-instructions in the previous two sections to integrate Google Test
-with your existing build system.
-
-If you still need to use the legacy build scripts, here's how:
-
-The msvc\ folder contains two solutions with Visual C++ projects.
-Open the gtest.sln or gtest-md.sln file using Visual Studio, and you
-are ready to build Google Test the same way you build any Visual
-Studio project. Files that have names ending with -md use DLL
-versions of Microsoft runtime libraries (the /MD or the /MDd compiler
-option). Files without that suffix use static versions of the runtime
-libraries (the /MT or the /MTd option). Please note that one must use
-the same option to compile both gtest and the test code. If you use
-Visual Studio 2005 or above, we recommend the -md version as /MD is
-the default for new projects in these versions of Visual Studio.
-
-On Mac OS X, open the gtest.xcodeproj in the xcode/ folder using
-Xcode. Build the "gtest" target. The universal binary framework will
-end up in your selected build directory (selected in the Xcode
-"Preferences..." -> "Building" pane and defaults to xcode/build).
-Alternatively, at the command line, enter:
-
- xcodebuild
-
-This will build the "Release" configuration of gtest.framework in your
-default build location. See the "xcodebuild" man page for more
-information about building different configurations and building in
-different locations.
-
-If you wish to use the Google Test Xcode project with Xcode 4.x and
-above, you need to either:
- * update the SDK configuration options in xcode/Config/General.xconfig.
- Comment options SDKROOT, MACOS_DEPLOYMENT_TARGET, and GCC_VERSION. If
- you choose this route you lose the ability to target earlier versions
- of MacOS X.
- * Install an SDK for an earlier version. This doesn't appear to be
- supported by Apple, but has been reported to work
- (http://stackoverflow.com/questions/5378518).
-
-Tweaking Google Test
---------------------
-
-Google Test can be used in diverse environments. The default
-configuration may not work (or may not work well) out of the box in
-some environments. However, you can easily tweak Google Test by
-defining control macros on the compiler command line. Generally,
-these macros are named like GTEST_XYZ and you define them to either 1
-or 0 to enable or disable a certain feature.
-
-We list the most frequently used macros below. For a complete list,
-see file include/gtest/internal/gtest-port.h.
-
-### Choosing a TR1 Tuple Library ###
-
-Some Google Test features require the C++ Technical Report 1 (TR1)
-tuple library, which is not yet available with all compilers. The
-good news is that Google Test implements a subset of TR1 tuple that's
-enough for its own need, and will automatically use this when the
-compiler doesn't provide TR1 tuple.
-
-Usually you don't need to care about which tuple library Google Test
-uses. However, if your project already uses TR1 tuple, you need to
-tell Google Test to use the same TR1 tuple library the rest of your
-project uses, or the two tuple implementations will clash. To do
-that, add
-
- -DGTEST_USE_OWN_TR1_TUPLE=0
-
-to the compiler flags while compiling Google Test and your tests. If
-you want to force Google Test to use its own tuple library, just add
-
- -DGTEST_USE_OWN_TR1_TUPLE=1
-
-to the compiler flags instead.
-
-If you don't want Google Test to use tuple at all, add
-
- -DGTEST_HAS_TR1_TUPLE=0
-
-and all features using tuple will be disabled.
-
-### Multi-threaded Tests ###
-
-Google Test is thread-safe where the pthread library is available.
-After #include "gtest/gtest.h", you can check the GTEST_IS_THREADSAFE
-macro to see whether this is the case (yes if the macro is #defined to
-1, no if it's undefined.).
-
-If Google Test doesn't correctly detect whether pthread is available
-in your environment, you can force it with
-
- -DGTEST_HAS_PTHREAD=1
-
-or
-
- -DGTEST_HAS_PTHREAD=0
-
-When Google Test uses pthread, you may need to add flags to your
-compiler and/or linker to select the pthread library, or you'll get
-link errors. If you use the CMake script or the deprecated Autotools
-script, this is taken care of for you. If you use your own build
-script, you'll need to read your compiler and linker's manual to
-figure out what flags to add.
-
-### As a Shared Library (DLL) ###
-
-Google Test is compact, so most users can build and link it as a
-static library for the simplicity. You can choose to use Google Test
-as a shared library (known as a DLL on Windows) if you prefer.
-
-To compile *gtest* as a shared library, add
-
- -DGTEST_CREATE_SHARED_LIBRARY=1
-
-to the compiler flags. You'll also need to tell the linker to produce
-a shared library instead - consult your linker's manual for how to do
-it.
-
-To compile your *tests* that use the gtest shared library, add
-
- -DGTEST_LINKED_AS_SHARED_LIBRARY=1
-
-to the compiler flags.
-
-Note: while the above steps aren't technically necessary today when
-using some compilers (e.g. GCC), they may become necessary in the
-future, if we decide to improve the speed of loading the library (see
-http://gcc.gnu.org/wiki/Visibility for details). Therefore you are
-recommended to always add the above flags when using Google Test as a
-shared library. Otherwise a future release of Google Test may break
-your build script.
-
-### Avoiding Macro Name Clashes ###
-
-In C++, macros don't obey namespaces. Therefore two libraries that
-both define a macro of the same name will clash if you #include both
-definitions. In case a Google Test macro clashes with another
-library, you can force Google Test to rename its macro to avoid the
-conflict.
-
-Specifically, if both Google Test and some other code define macro
-FOO, you can add
-
- -DGTEST_DONT_DEFINE_FOO=1
-
-to the compiler flags to tell Google Test to change the macro's name
-from FOO to GTEST_FOO. Currently FOO can be FAIL, SUCCEED, or TEST.
-For example, with -DGTEST_DONT_DEFINE_TEST=1, you'll need to write
-
- GTEST_TEST(SomeTest, DoesThis) { ... }
-
-instead of
-
- TEST(SomeTest, DoesThis) { ... }
-
-in order to define a test.
-
-Upgrating from an Earlier Version
----------------------------------
-
-We strive to keep Google Test releases backward compatible.
-Sometimes, though, we have to make some breaking changes for the
-users' long-term benefits. This section describes what you'll need to
-do if you are upgrading from an earlier version of Google Test.
-
-### Upgrading from 1.3.0 or Earlier ###
-
-You may need to explicitly enable or disable Google Test's own TR1
-tuple library. See the instructions in section "Choosing a TR1 Tuple
-Library".
-
-### Upgrading from 1.4.0 or Earlier ###
-
-The Autotools build script (configure + make) is no longer officially
-supportted. You are encouraged to migrate to your own build system or
-use CMake. If you still need to use Autotools, you can find
-instructions in the README file from Google Test 1.4.0.
-
-On platforms where the pthread library is available, Google Test uses
-it in order to be thread-safe. See the "Multi-threaded Tests" section
-for what this means to your build script.
-
-If you use Microsoft Visual C++ 7.1 with exceptions disabled, Google
-Test will no longer compile. This should affect very few people, as a
-large portion of STL (including <string>) doesn't compile in this mode
-anyway. We decided to stop supporting it in order to greatly simplify
-Google Test's implementation.
-
-Developing Google Test
-----------------------
-
-This section discusses how to make your own changes to Google Test.
-
-### Testing Google Test Itself ###
-
-To make sure your changes work as intended and don't break existing
-functionality, you'll want to compile and run Google Test's own tests.
-For that you can use CMake:
-
- mkdir mybuild
- cd mybuild
- cmake -Dgtest_build_tests=ON ${GTEST_DIR}
-
-Make sure you have Python installed, as some of Google Test's tests
-are written in Python. If the cmake command complains about not being
-able to find Python ("Could NOT find PythonInterp (missing:
-PYTHON_EXECUTABLE)"), try telling it explicitly where your Python
-executable can be found:
-
- cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
-
-Next, you can build Google Test and all of its own tests. On *nix,
-this is usually done by 'make'. To run the tests, do
-
- make test
-
-All tests should pass.
-
-### Regenerating Source Files ###
-
-Some of Google Test's source files are generated from templates (not
-in the C++ sense) using a script. A template file is named FOO.pump,
-where FOO is the name of the file it will generate. For example, the
-file include/gtest/internal/gtest-type-util.h.pump is used to generate
-gtest-type-util.h in the same directory.
-
-Normally you don't need to worry about regenerating the source files,
-unless you need to modify them. In that case, you should modify the
-corresponding .pump files instead and run the pump.py Python script to
-regenerate them. You can find pump.py in the scripts/ directory.
-Read the Pump manual [2] for how to use it.
-
- [2] http://code.google.com/p/googletest/wiki/PumpManual
-
-### Contributing a Patch ###
-
-We welcome patches. Please read the Google Test developer's guide [3]
-for how you can contribute. In particular, make sure you have signed
-the Contributor License Agreement, or we won't be able to accept the
-patch.
-
- [3] http://code.google.com/p/googletest/wiki/GoogleTestDevGuide
-
-Happy testing!
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/include/gtest/gtest.h b/videocodec/libvpx_internal/libvpx/third_party/googletest/src/include/gtest/gtest.h
deleted file mode 100644
index 4f3804f..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/include/gtest/gtest.h
+++ /dev/null
@@ -1,20061 +0,0 @@
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for Google Test. It should be
-// included by any test program that uses Google Test.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-//
-// Acknowledgment: Google Test borrowed the idea of automatic test
-// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
-// easyUnit framework.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_H_
-
-#include <limits>
-#include <ostream>
-#include <vector>
-
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares functions and macros used internally by
-// Google Test. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan)
-//
-// Low-level types and utilities for porting Google Test to various
-// platforms. They are subject to change without notice. DO NOT USE
-// THEM IN USER CODE.
-//
-// This file is fundamental to Google Test. All other Google Test source
-// files are expected to #include this. Therefore, it cannot #include
-// any other Google Test header.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-
-// The user can define the following macros in the build script to
-// control Google Test's behavior. If the user doesn't define a macro
-// in this list, Google Test will define it.
-//
-// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
-// is/isn't available.
-// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
-// are enabled.
-// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::string, which is different to std::string).
-// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::wstring, which is different to std::wstring).
-// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
-// expressions are/aren't available.
-// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
-// is/isn't available.
-// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
-// enabled.
-// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
-// std::wstring does/doesn't work (Google Test can
-// be used where std::wstring is unavailable).
-// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple
-// is/isn't available.
-// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
-// compiler supports Microsoft's "Structured
-// Exception Handling".
-// GTEST_HAS_STREAM_REDIRECTION
-// - Define it to 1/0 to indicate whether the
-// platform supports I/O stream redirection using
-// dup() and dup2().
-// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google
-// Test's own tr1 tuple implementation should be
-// used. Unused when the user sets
-// GTEST_HAS_TR1_TUPLE to 0.
-// GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test
-// is building in C++11/C++98 mode.
-// GTEST_LINKED_AS_SHARED_LIBRARY
-// - Define to 1 when compiling tests that use
-// Google Test as a shared library (known as
-// DLL on Windows).
-// GTEST_CREATE_SHARED_LIBRARY
-// - Define to 1 when compiling Google Test itself
-// as a shared library.
-
-// This header defines the following utilities:
-//
-// Macros indicating the current platform (defined to 1 if compiled on
-// the given platform; otherwise undefined):
-// GTEST_OS_AIX - IBM AIX
-// GTEST_OS_CYGWIN - Cygwin
-// GTEST_OS_HPUX - HP-UX
-// GTEST_OS_LINUX - Linux
-// GTEST_OS_LINUX_ANDROID - Google Android
-// GTEST_OS_MAC - Mac OS X
-// GTEST_OS_IOS - iOS
-// GTEST_OS_IOS_SIMULATOR - iOS simulator
-// GTEST_OS_NACL - Google Native Client (NaCl)
-// GTEST_OS_OPENBSD - OpenBSD
-// GTEST_OS_QNX - QNX
-// GTEST_OS_SOLARIS - Sun Solaris
-// GTEST_OS_SYMBIAN - Symbian
-// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
-// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
-// GTEST_OS_WINDOWS_MINGW - MinGW
-// GTEST_OS_WINDOWS_MOBILE - Windows Mobile
-// GTEST_OS_ZOS - z/OS
-//
-// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
-// most stable support. Since core members of the Google Test project
-// don't have access to other platforms, support for them may be less
-// stable. If you notice any problems on your platform, please notify
-// googletestframework@googlegroups.com (patches for fixing them are
-// even more welcome!).
-//
-// Note that it is possible that none of the GTEST_OS_* macros are defined.
-//
-// Macros indicating available Google Test features (defined to 1 if
-// the corresponding feature is supported; otherwise undefined):
-// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
-// tests)
-// GTEST_HAS_DEATH_TEST - death tests
-// GTEST_HAS_PARAM_TEST - value-parameterized tests
-// GTEST_HAS_TYPED_TEST - typed tests
-// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
-// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
-// GTEST_HAS_POSIX_RE (see above) which users can
-// define themselves.
-// GTEST_USES_SIMPLE_RE - our own simple regex is used;
-// the above two are mutually exclusive.
-// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
-//
-// Macros for basic C++ coding:
-// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
-// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
-// variable don't have to be used.
-// GTEST_DISALLOW_ASSIGN_ - disables operator=.
-// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
-// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
-//
-// Synchronization:
-// Mutex, MutexLock, ThreadLocal, GetThreadCount()
-// - synchronization primitives.
-// GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
-// synchronization primitives have real implementations
-// and Google Test is thread-safe; or 0 otherwise.
-//
-// Template meta programming:
-// is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only.
-// IteratorTraits - partial implementation of std::iterator_traits, which
-// is not available in libCstd when compiled with Sun C++.
-//
-// Smart pointers:
-// scoped_ptr - as in TR2.
-//
-// Regular expressions:
-// RE - a simple regular expression class using the POSIX
-// Extended Regular Expression syntax on UNIX-like
-// platforms, or a reduced regular exception syntax on
-// other platforms, including Windows.
-//
-// Logging:
-// GTEST_LOG_() - logs messages at the specified severity level.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-//
-// Stdout and stderr capturing:
-// CaptureStdout() - starts capturing stdout.
-// GetCapturedStdout() - stops capturing stdout and returns the captured
-// string.
-// CaptureStderr() - starts capturing stderr.
-// GetCapturedStderr() - stops capturing stderr and returns the captured
-// string.
-//
-// Integer types:
-// TypeWithSize - maps an integer to a int type.
-// Int32, UInt32, Int64, UInt64, TimeInMillis
-// - integers of known sizes.
-// BiggestInt - the biggest signed integer type.
-//
-// Command-line utilities:
-// GTEST_FLAG() - references a flag.
-// GTEST_DECLARE_*() - declares a flag.
-// GTEST_DEFINE_*() - defines a flag.
-// GetInjectableArgvs() - returns the command line as a vector of strings.
-//
-// Environment variable utilities:
-// GetEnv() - gets the value of an environment variable.
-// BoolFromGTestEnv() - parses a bool environment variable.
-// Int32FromGTestEnv() - parses an Int32 environment variable.
-// StringFromGTestEnv() - parses a string environment variable.
-
-#include <ctype.h> // for isspace, etc
-#include <stddef.h> // for ptrdiff_t
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef _WIN32_WCE
-# include <sys/types.h>
-# include <sys/stat.h>
-#endif // !_WIN32_WCE
-
-#if defined __APPLE__
-# include <AvailabilityMacros.h>
-# include <TargetConditionals.h>
-#endif
-
-#include <iostream> // NOLINT
-#include <sstream> // NOLINT
-#include <string> // NOLINT
-
-#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
-#define GTEST_FLAG_PREFIX_ "gtest_"
-#define GTEST_FLAG_PREFIX_DASH_ "gtest-"
-#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
-#define GTEST_NAME_ "Google Test"
-#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
-
-// Determines the version of gcc that is used to compile this.
-#ifdef __GNUC__
-// 40302 means version 4.3.2.
-# define GTEST_GCC_VER_ \
- (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
-#endif // __GNUC__
-
-// Determines the platform on which Google Test is compiled.
-#ifdef __CYGWIN__
-# define GTEST_OS_CYGWIN 1
-#elif defined __SYMBIAN32__
-# define GTEST_OS_SYMBIAN 1
-#elif defined _WIN32
-# define GTEST_OS_WINDOWS 1
-# ifdef _WIN32_WCE
-# define GTEST_OS_WINDOWS_MOBILE 1
-# elif defined(__MINGW__) || defined(__MINGW32__)
-# define GTEST_OS_WINDOWS_MINGW 1
-# else
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# endif // _WIN32_WCE
-#elif defined __APPLE__
-# define GTEST_OS_MAC 1
-# if TARGET_OS_IPHONE
-# define GTEST_OS_IOS 1
-# if TARGET_IPHONE_SIMULATOR
-# define GTEST_OS_IOS_SIMULATOR 1
-# endif
-# endif
-#elif defined __linux__
-# define GTEST_OS_LINUX 1
-# if defined __ANDROID__
-# define GTEST_OS_LINUX_ANDROID 1
-# endif
-#elif defined __MVS__
-# define GTEST_OS_ZOS 1
-#elif defined(__sun) && defined(__SVR4)
-# define GTEST_OS_SOLARIS 1
-#elif defined(_AIX)
-# define GTEST_OS_AIX 1
-#elif defined(__hpux)
-# define GTEST_OS_HPUX 1
-#elif defined __native_client__
-# define GTEST_OS_NACL 1
-#elif defined __OpenBSD__
-# define GTEST_OS_OPENBSD 1
-#elif defined __QNX__
-# define GTEST_OS_QNX 1
-#endif // __CYGWIN__
-
-#ifndef GTEST_LANG_CXX11
-// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
-// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
-// value for __cplusplus, and recent versions of clang, gcc, and
-// probably other compilers set that too in C++11 mode.
-# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
-// Compiling in at least C++11 mode.
-# define GTEST_LANG_CXX11 1
-# else
-# define GTEST_LANG_CXX11 0
-# endif
-#endif
-
-// Brings in definitions for functions used in the testing::internal::posix
-// namespace (read, write, close, chdir, isatty, stat). We do not currently
-// use them on Windows Mobile.
-#if !GTEST_OS_WINDOWS
-// This assumes that non-Windows OSes provide unistd.h. For OSes where this
-// is not the case, we need to include headers that provide the functions
-// mentioned above.
-# include <unistd.h>
-# include <strings.h>
-#elif !GTEST_OS_WINDOWS_MOBILE
-# include <direct.h>
-# include <io.h>
-#endif
-
-#if GTEST_OS_LINUX_ANDROID
-// Used to define __ANDROID_API__ matching the target NDK API level.
-# include <android/api-level.h> // NOLINT
-#endif
-
-// Defines this to true iff Google Test can use POSIX regular expressions.
-#ifndef GTEST_HAS_POSIX_RE
-# if GTEST_OS_LINUX_ANDROID
-// On Android, <regex.h> is only available starting with Gingerbread.
-# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
-# else
-# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
-# endif
-#endif
-
-#if GTEST_HAS_POSIX_RE
-
-// On some platforms, <regex.h> needs someone to define size_t, and
-// won't compile otherwise. We can #include it here as we already
-// included <stdlib.h>, which is guaranteed to define size_t through
-// <stddef.h>.
-# include <regex.h> // NOLINT
-
-# define GTEST_USES_POSIX_RE 1
-
-#elif GTEST_OS_WINDOWS
-
-// <regex.h> is not available on Windows. Use our own simple regex
-// implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#else
-
-// <regex.h> may not be available on this platform. Use our own
-// simple regex implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#endif // GTEST_HAS_POSIX_RE
-
-#ifndef GTEST_HAS_EXCEPTIONS
-// The user didn't tell us whether exceptions are enabled, so we need
-// to figure it out.
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
-// macro to enable exceptions, so we'll do the same.
-// Assumes that exceptions are enabled by default.
-# ifndef _HAS_EXCEPTIONS
-# define _HAS_EXCEPTIONS 1
-# endif // _HAS_EXCEPTIONS
-# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
-# elif defined(__GNUC__) && __EXCEPTIONS
-// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__SUNPRO_CC)
-// Sun Pro CC supports exceptions. However, there is no compile-time way of
-// detecting whether they are enabled or not. Therefore, we assume that
-// they are enabled unless the user tells us otherwise.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__IBMCPP__) && __EXCEPTIONS
-// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__HP_aCC)
-// Exception handling is in effect by default in HP aCC compiler. It has to
-// be turned of by +noeh compiler option if desired.
-# define GTEST_HAS_EXCEPTIONS 1
-# else
-// For other compilers, we assume exceptions are disabled to be
-// conservative.
-# define GTEST_HAS_EXCEPTIONS 0
-# endif // defined(_MSC_VER) || defined(__BORLANDC__)
-#endif // GTEST_HAS_EXCEPTIONS
-
-#if !defined(GTEST_HAS_STD_STRING)
-// Even though we don't use this macro any longer, we keep it in case
-// some clients still depend on it.
-# define GTEST_HAS_STD_STRING 1
-#elif !GTEST_HAS_STD_STRING
-// The user told us that ::std::string isn't available.
-# error "Google Test cannot be used where ::std::string isn't available."
-#endif // !defined(GTEST_HAS_STD_STRING)
-
-#ifndef GTEST_HAS_GLOBAL_STRING
-// The user didn't tell us whether ::string is available, so we need
-// to figure it out.
-
-# define GTEST_HAS_GLOBAL_STRING 0
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#ifndef GTEST_HAS_STD_WSTRING
-// The user didn't tell us whether ::std::wstring is available, so we need
-// to figure it out.
-// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
-// is available.
-
-// Cygwin 1.7 and below doesn't support ::std::wstring.
-// Solaris' libc++ doesn't support it either. Android has
-// no support for it at least as recent as Froyo (2.2).
-# define GTEST_HAS_STD_WSTRING \
- (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
-
-#endif // GTEST_HAS_STD_WSTRING
-
-#ifndef GTEST_HAS_GLOBAL_WSTRING
-// The user didn't tell us whether ::wstring is available, so we need
-// to figure it out.
-# define GTEST_HAS_GLOBAL_WSTRING \
- (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// Determines whether RTTI is available.
-#ifndef GTEST_HAS_RTTI
-// The user didn't tell us whether RTTI is enabled, so we need to
-// figure it out.
-
-# ifdef _MSC_VER
-
-# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
-
-# ifdef __GXX_RTTI
-// When building against STLport with the Android NDK and with
-// -frtti -fno-exceptions, the build fails at link time with undefined
-// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
-// so disable RTTI when detected.
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
- !defined(__EXCEPTIONS)
-# define GTEST_HAS_RTTI 0
-# else
-# define GTEST_HAS_RTTI 1
-# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
-# else
-# define GTEST_HAS_RTTI 0
-# endif // __GXX_RTTI
-
-// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
-// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
-// first version with C++ support.
-# elif defined(__clang__)
-
-# define GTEST_HAS_RTTI __has_feature(cxx_rtti)
-
-// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
-// both the typeid and dynamic_cast features are present.
-# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
-
-# ifdef __RTTI_ALL__
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-# else
-
-// For all other compilers, we assume RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-
-# endif // _MSC_VER
-
-#endif // GTEST_HAS_RTTI
-
-// It's this header's responsibility to #include <typeinfo> when RTTI
-// is enabled.
-#if GTEST_HAS_RTTI
-# include <typeinfo>
-#endif
-
-// Determines whether Google Test can use the pthreads library.
-#ifndef GTEST_HAS_PTHREAD
-// The user didn't tell us explicitly, so we assume pthreads support is
-// available on Linux and Mac.
-//
-// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
-// to your compiler flags.
-# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
- || GTEST_OS_QNX)
-#endif // GTEST_HAS_PTHREAD
-
-#if GTEST_HAS_PTHREAD
-// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
-// true.
-# include <pthread.h> // NOLINT
-
-// For timespec and nanosleep, used below.
-# include <time.h> // NOLINT
-#endif
-
-// Determines whether Google Test can use tr1/tuple. You can define
-// this macro to 0 to prevent Google Test from using tuple (any
-// feature depending on tuple with be disabled in this mode).
-#ifndef GTEST_HAS_TR1_TUPLE
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
-// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
-# define GTEST_HAS_TR1_TUPLE 0
-# else
-// The user didn't tell us not to do it, so we assume it's OK.
-# define GTEST_HAS_TR1_TUPLE 1
-# endif
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether Google Test's own tr1 tuple implementation
-// should be used.
-#ifndef GTEST_USE_OWN_TR1_TUPLE
-// The user didn't tell us, so we need to figure it out.
-
-// We use our own TR1 tuple if we aren't sure the user has an
-// implementation of it already. At this time, libstdc++ 4.0.0+ and
-// MSVC 2010 are the only mainstream standard libraries that come
-// with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler
-// pretends to be GCC by defining __GNUC__ and friends, but cannot
-// compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1
-// tuple in a 323 MB Feature Pack download, which we cannot assume the
-// user has. QNX's QCC compiler is a modified GCC but it doesn't
-// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
-// and it can be used with some compilers that define __GNUC__.
-# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
- && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
-# define GTEST_ENV_HAS_TR1_TUPLE_ 1
-# endif
-
-// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
-// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
-// can build with clang but need to use gcc4.2's libstdc++).
-# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
-# define GTEST_ENV_HAS_STD_TUPLE_ 1
-# endif
-
-# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
-# define GTEST_USE_OWN_TR1_TUPLE 0
-# else
-# define GTEST_USE_OWN_TR1_TUPLE 1
-# endif
-
-#endif // GTEST_USE_OWN_TR1_TUPLE
-
-// To avoid conditional compilation everywhere, we make it
-// gtest-port.h's responsibility to #include the header implementing
-// tr1/tuple.
-#if GTEST_HAS_TR1_TUPLE
-
-# if GTEST_USE_OWN_TR1_TUPLE
-// This file was GENERATED by command:
-// pump.py gtest-tuple.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2009 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility> // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined). This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-// Sun Studio versions < 12 also have the above bug.
-#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
- template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
- private:
-#endif
-
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
- void, void, void>
-#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
- void, void, void>
-#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
- void, void, void>
-#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
- void, void, void>
-#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
- void, void, void>
-#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
- void, void, void>
-#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- void, void, void>
-#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, void, void>
-#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, void>
-#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, T##9>
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-#define GTEST_0_TYPENAMES_(T)
-#define GTEST_1_TYPENAMES_(T) typename T##0
-#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
-#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
-#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3
-#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4
-#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5
-#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6
-#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
-#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8
-#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8, typename T##9
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior. We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <typename T0 = void, typename T1 = void, typename T2 = void,
- typename T3 = void, typename T4 = void, typename T5 = void,
- typename T6 = void, typename T7 = void, typename T8 = void,
- typename T9 = void>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; }; // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
- typedef T0 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
- typedef T1 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
- typedef T2 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
- typedef T3 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
- typedef T4 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
- typedef T5 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
- typedef T6 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
- typedef T7 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
- typedef T8 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
- typedef T9 type;
-};
-
-} // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
- tuple() {}
- tuple(const tuple& /* t */) {}
- tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-class GTEST_1_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
-
- tuple(const tuple& t) : f0_(t.f0_) {}
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
- f0_ = t.f0_;
- return *this;
- }
-
- T0 f0_;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-class GTEST_2_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
- f1_(f1) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
- template <typename U0, typename U1>
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
- template <typename U0, typename U1>
- tuple& operator=(const ::std::pair<U0, U1>& p) {
- f0_ = p.first;
- f1_ = p.second;
- return *this;
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-class GTEST_3_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-class GTEST_4_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-class GTEST_5_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
- GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_) {}
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-class GTEST_6_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_) {}
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-class GTEST_7_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-class GTEST_8_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
- GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-class GTEST_9_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-class tuple {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
- f9_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
- f9_(t.f9_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- f9_ = t.f9_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
- T9 f9_;
-};
-
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-template <GTEST_1_TYPENAMES_(T)>
-inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
- return GTEST_1_TUPLE_(T)(f0);
-}
-
-template <GTEST_2_TYPENAMES_(T)>
-inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
- return GTEST_2_TUPLE_(T)(f0, f1);
-}
-
-template <GTEST_3_TYPENAMES_(T)>
-inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
- return GTEST_3_TUPLE_(T)(f0, f1, f2);
-}
-
-template <GTEST_4_TYPENAMES_(T)>
-inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3) {
- return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
-}
-
-template <GTEST_5_TYPENAMES_(T)>
-inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4) {
- return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
-}
-
-template <GTEST_6_TYPENAMES_(T)>
-inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5) {
- return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
-}
-
-template <GTEST_7_TYPENAMES_(T)>
-inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
- return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
-}
-
-template <GTEST_8_TYPENAMES_(T)>
-inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
- return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
-}
-
-template <GTEST_9_TYPENAMES_(T)>
-inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8) {
- return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
-}
-
-template <GTEST_10_TYPENAMES_(T)>
-inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8, const T9& f9) {
- return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
-}
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T) > {
- static const int value = 0;
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T) > {
- static const int value = 1;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T) > {
- static const int value = 2;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T) > {
- static const int value = 3;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T) > {
- static const int value = 4;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T) > {
- static const int value = 5;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T) > {
- static const int value = 6;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T) > {
- static const int value = 7;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T) > {
- static const int value = 8;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T) > {
- static const int value = 9;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T) > {
- static const int value = 10;
-};
-
-template <int k, class Tuple>
-struct tuple_element {
- typedef typename gtest_internal::TupleElement<
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-template <>
-class Get<0> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- Field(Tuple& t) { return t.f0_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- ConstField(const Tuple& t) { return t.f0_; }
-};
-
-template <>
-class Get<1> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- Field(Tuple& t) { return t.f1_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- ConstField(const Tuple& t) { return t.f1_; }
-};
-
-template <>
-class Get<2> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- Field(Tuple& t) { return t.f2_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- ConstField(const Tuple& t) { return t.f2_; }
-};
-
-template <>
-class Get<3> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- Field(Tuple& t) { return t.f3_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- ConstField(const Tuple& t) { return t.f3_; }
-};
-
-template <>
-class Get<4> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- Field(Tuple& t) { return t.f4_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- ConstField(const Tuple& t) { return t.f4_; }
-};
-
-template <>
-class Get<5> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- Field(Tuple& t) { return t.f5_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- ConstField(const Tuple& t) { return t.f5_; }
-};
-
-template <>
-class Get<6> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- Field(Tuple& t) { return t.f6_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- ConstField(const Tuple& t) { return t.f6_; }
-};
-
-template <>
-class Get<7> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- Field(Tuple& t) { return t.f7_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- ConstField(const Tuple& t) { return t.f7_; }
-};
-
-template <>
-class Get<8> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- Field(Tuple& t) { return t.f8_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- ConstField(const Tuple& t) { return t.f8_; }
-};
-
-template <>
-class Get<9> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- Field(Tuple& t) { return t.f9_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- ConstField(const Tuple& t) { return t.f9_; }
-};
-
-} // namespace gtest_internal
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(const GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
- return true;
- }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
- }
-};
-
-} // namespace gtest_internal
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator==(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) {
- return gtest_internal::SameSizeTuplePrefixComparator<
- tuple_size<GTEST_10_TUPLE_(T) >::value,
- tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
-}
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-} // namespace tr1
-} // namespace std
-
-#undef GTEST_0_TUPLE_
-#undef GTEST_1_TUPLE_
-#undef GTEST_2_TUPLE_
-#undef GTEST_3_TUPLE_
-#undef GTEST_4_TUPLE_
-#undef GTEST_5_TUPLE_
-#undef GTEST_6_TUPLE_
-#undef GTEST_7_TUPLE_
-#undef GTEST_8_TUPLE_
-#undef GTEST_9_TUPLE_
-#undef GTEST_10_TUPLE_
-
-#undef GTEST_0_TYPENAMES_
-#undef GTEST_1_TYPENAMES_
-#undef GTEST_2_TYPENAMES_
-#undef GTEST_3_TYPENAMES_
-#undef GTEST_4_TYPENAMES_
-#undef GTEST_5_TYPENAMES_
-#undef GTEST_6_TYPENAMES_
-#undef GTEST_7_TYPENAMES_
-#undef GTEST_8_TYPENAMES_
-#undef GTEST_9_TYPENAMES_
-#undef GTEST_10_TYPENAMES_
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-# elif GTEST_ENV_HAS_STD_TUPLE_
-# include <tuple>
-// C++11 puts its tuple into the ::std namespace rather than
-// ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there.
-// This causes undefined behavior, but supported compilers react in
-// the way we intend.
-namespace std {
-namespace tr1 {
-using ::std::get;
-using ::std::make_tuple;
-using ::std::tuple;
-using ::std::tuple_element;
-using ::std::tuple_size;
-}
-}
-
-# elif GTEST_OS_SYMBIAN
-
-// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
-// use STLport's tuple implementation, which unfortunately doesn't
-// work as the copy of STLport distributed with Symbian is incomplete.
-// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
-// use its own tuple implementation.
-# ifdef BOOST_HAS_TR1_TUPLE
-# undef BOOST_HAS_TR1_TUPLE
-# endif // BOOST_HAS_TR1_TUPLE
-
-// This prevents <boost/tr1/detail/config.hpp>, which defines
-// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
-# define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
-# include <tuple>
-
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
-// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
-// not conform to the TR1 spec, which requires the header to be <tuple>.
-
-# if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
-// which is #included by <tr1/tuple>, to not compile when RTTI is
-// disabled. _TR1_FUNCTIONAL is the header guard for
-// <tr1/functional>. Hence the following #define is a hack to prevent
-// <tr1/functional> from being included.
-# define _TR1_FUNCTIONAL 1
-# include <tr1/tuple>
-# undef _TR1_FUNCTIONAL // Allows the user to #include
- // <tr1/functional> if he chooses to.
-# else
-# include <tr1/tuple> // NOLINT
-# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-
-# else
-// If the compiler is not GCC 4.0+, we assume the user is using a
-// spec-conforming TR1 implementation.
-# include <tuple> // NOLINT
-# endif // GTEST_USE_OWN_TR1_TUPLE
-
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether clone(2) is supported.
-// Usually it will only be available on Linux, excluding
-// Linux on the Itanium architecture.
-// Also see http://linux.die.net/man/2/clone.
-#ifndef GTEST_HAS_CLONE
-// The user didn't tell us, so we need to figure it out.
-
-# if GTEST_OS_LINUX && !defined(__ia64__)
-# if GTEST_OS_LINUX_ANDROID
-// On Android, clone() is only available on ARM starting with Gingerbread.
-# if defined(__arm__) && __ANDROID_API__ >= 9
-# define GTEST_HAS_CLONE 1
-# else
-# define GTEST_HAS_CLONE 0
-# endif
-# else
-# define GTEST_HAS_CLONE 1
-# endif
-# else
-# define GTEST_HAS_CLONE 0
-# endif // GTEST_OS_LINUX && !defined(__ia64__)
-
-#endif // GTEST_HAS_CLONE
-
-// Determines whether to support stream redirection. This is used to test
-// output correctness and to implement death tests.
-#ifndef GTEST_HAS_STREAM_REDIRECTION
-// By default, we assume that stream redirection is supported on all
-// platforms except known mobile ones.
-# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
-# define GTEST_HAS_STREAM_REDIRECTION 0
-# else
-# define GTEST_HAS_STREAM_REDIRECTION 1
-# endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-// Determines whether to support death tests.
-// Google Test does not support death tests for VC 7.1 and earlier as
-// abort() in a VC 7.1 application compiled as GUI in debug config
-// pops up a dialog window that cannot be suppressed programmatically.
-#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
- (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \
- (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
- GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
- GTEST_OS_OPENBSD || GTEST_OS_QNX)
-# define GTEST_HAS_DEATH_TEST 1
-# include <vector> // NOLINT
-#endif
-
-// We don't support MSVC 7.1 with exceptions disabled now. Therefore
-// all the compilers we care about are adequate for supporting
-// value-parameterized tests.
-#define GTEST_HAS_PARAM_TEST 1
-
-// Determines whether to support type-driven tests.
-
-// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
-// Sun Pro CC, IBM Visual Age, and HP aCC support.
-#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
- defined(__IBMCPP__) || defined(__HP_aCC)
-# define GTEST_HAS_TYPED_TEST 1
-# define GTEST_HAS_TYPED_TEST_P 1
-#endif
-
-// Determines whether to support Combine(). This only makes sense when
-// value-parameterized tests are enabled. The implementation doesn't
-// work on Sun Studio since it doesn't understand templated conversion
-// operators.
-#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
-# define GTEST_HAS_COMBINE 1
-#endif
-
-// Determines whether the system compiler uses UTF-16 for encoding wide strings.
-#define GTEST_WIDE_STRING_USES_UTF16_ \
- (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
-
-// Determines whether test results can be streamed to a socket.
-#if GTEST_OS_LINUX
-# define GTEST_CAN_STREAM_RESULTS_ 1
-#endif
-
-// Defines some utility macros.
-
-// The GNU compiler emits a warning if nested "if" statements are followed by
-// an "else" statement and braces are not used to explicitly disambiguate the
-// "else" binding. This leads to problems with code like:
-//
-// if (gate)
-// ASSERT_*(condition) << "Some message";
-//
-// The "switch (0) case 0:" idiom is used to suppress this.
-#ifdef __INTEL_COMPILER
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
-#else
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
-#endif
-
-// Use this annotation at the end of a struct/class definition to
-// prevent the compiler from optimizing away instances that are never
-// used. This is useful when all interesting logic happens inside the
-// c'tor and / or d'tor. Example:
-//
-// struct Foo {
-// Foo() { ... }
-// } GTEST_ATTRIBUTE_UNUSED_;
-//
-// Also use it after a variable or parameter declaration to tell the
-// compiler the variable/parameter does not have to be used.
-#if defined(__GNUC__) && !defined(COMPILER_ICC)
-# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-#else
-# define GTEST_ATTRIBUTE_UNUSED_
-#endif
-
-// A macro to disallow operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_ASSIGN_(type)\
- void operator=(type const &)
-
-// A macro to disallow copy constructor and operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
- type(type const &);\
- GTEST_DISALLOW_ASSIGN_(type)
-
-// Tell the compiler to warn about unused return values for functions declared
-// with this macro. The macro should be used on function declarations
-// following the argument list:
-//
-// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
-#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
-# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
-#else
-# define GTEST_MUST_USE_RESULT_
-#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
-
-// Determine whether the compiler supports Microsoft's Structured Exception
-// Handling. This is supported by several Windows compilers but generally
-// does not exist on any other system.
-#ifndef GTEST_HAS_SEH
-// The user didn't tell us, so we need to figure it out.
-
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// These two compilers are known to support SEH.
-# define GTEST_HAS_SEH 1
-# else
-// Assume no SEH.
-# define GTEST_HAS_SEH 0
-# endif
-
-#endif // GTEST_HAS_SEH
-
-#ifdef _MSC_VER
-
-# if GTEST_LINKED_AS_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllimport)
-# elif GTEST_CREATE_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllexport)
-# endif
-
-#endif // _MSC_VER
-
-#ifndef GTEST_API_
-# define GTEST_API_
-#endif
-
-#ifdef __GNUC__
-// Ask the compiler to never inline a given function.
-# define GTEST_NO_INLINE_ __attribute__((noinline))
-#else
-# define GTEST_NO_INLINE_
-#endif
-
-// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
-#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
-# define GTEST_HAS_CXXABI_H_ 1
-#else
-# define GTEST_HAS_CXXABI_H_ 0
-#endif
-
-namespace testing {
-
-class Message;
-
-namespace internal {
-
-// A secret type that Google Test users don't know about. It has no
-// definition on purpose. Therefore it's impossible to create a
-// Secret object, which is what we want.
-class Secret;
-
-// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-// GTEST_COMPILE_ASSERT_(ARRAYSIZE(content_type_names) == CONTENT_NUM_TYPES,
-// content_type_names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-// GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-template <bool>
-struct CompileAssert {
-};
-
-#define GTEST_COMPILE_ASSERT_(expr, msg) \
- typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
- msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
-
-// Implementation details of GTEST_COMPILE_ASSERT_:
-//
-// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
-// elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-// #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-// does not work, as gcc supports variable-length arrays whose sizes
-// are determined at run-time (this is gcc's extension and not part
-// of the C++ standard). As a result, gcc fails to reject the
-// following code with the simple definition:
-//
-// int foo;
-// GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
-// // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-// expr is a compile-time constant. (Template arguments must be
-// determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
-//
-// CompileAssert<bool(expr)>
-//
-// instead, these compilers will refuse to compile
-//
-// GTEST_COMPILE_ASSERT_(5 > 0, some_message);
-//
-// (They seem to think the ">" in "5 > 0" marks the end of the
-// template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-// ((expr) ? 1 : -1).
-//
-// This is to avoid running into a bug in MS VC 7.1, which
-// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
-//
-// This template is declared, but intentionally undefined.
-template <typename T1, typename T2>
-struct StaticAssertTypeEqHelper;
-
-template <typename T>
-struct StaticAssertTypeEqHelper<T, T> {};
-
-#if GTEST_HAS_GLOBAL_STRING
-typedef ::string string;
-#else
-typedef ::std::string string;
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-typedef ::wstring wstring;
-#elif GTEST_HAS_STD_WSTRING
-typedef ::std::wstring wstring;
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// A helper for suppressing warnings on constant condition. It just
-// returns 'condition'.
-GTEST_API_ bool IsTrue(bool condition);
-
-// Defines scoped_ptr.
-
-// This implementation of scoped_ptr is PARTIAL - it only contains
-// enough stuff to satisfy Google Test's need.
-template <typename T>
-class scoped_ptr {
- public:
- typedef T element_type;
-
- explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
- ~scoped_ptr() { reset(); }
-
- T& operator*() const { return *ptr_; }
- T* operator->() const { return ptr_; }
- T* get() const { return ptr_; }
-
- T* release() {
- T* const ptr = ptr_;
- ptr_ = NULL;
- return ptr;
- }
-
- void reset(T* p = NULL) {
- if (p != ptr_) {
- if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
- delete ptr_;
- }
- ptr_ = p;
- }
- }
-
- private:
- T* ptr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
-};
-
-// Defines RE.
-
-// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
-// Regular Expression syntax.
-class GTEST_API_ RE {
- public:
- // A copy constructor is required by the Standard to initialize object
- // references from r-values.
- RE(const RE& other) { Init(other.pattern()); }
-
- // Constructs an RE from a string.
- RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#if GTEST_HAS_GLOBAL_STRING
-
- RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- RE(const char* regex) { Init(regex); } // NOLINT
- ~RE();
-
- // Returns the string representation of the regex.
- const char* pattern() const { return pattern_; }
-
- // FullMatch(str, re) returns true iff regular expression re matches
- // the entire str.
- // PartialMatch(str, re) returns true iff regular expression re
- // matches a substring of str (including str itself).
- //
- // TODO(wan@google.com): make FullMatch() and PartialMatch() work
- // when str contains NUL characters.
- static bool FullMatch(const ::std::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::std::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#if GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const ::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const char* str, const RE& re);
- static bool PartialMatch(const char* str, const RE& re);
-
- private:
- void Init(const char* regex);
-
- // We use a const char* instead of an std::string, as Google Test used to be
- // used where std::string is not available. TODO(wan@google.com): change to
- // std::string.
- const char* pattern_;
- bool is_valid_;
-
-#if GTEST_USES_POSIX_RE
-
- regex_t full_regex_; // For FullMatch().
- regex_t partial_regex_; // For PartialMatch().
-
-#else // GTEST_USES_SIMPLE_RE
-
- const char* full_pattern_; // For FullMatch();
-
-#endif
-
- GTEST_DISALLOW_ASSIGN_(RE);
-};
-
-// Formats a source file path and a line number as they would appear
-// in an error message from the compiler used to compile this code.
-GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
-
-// Formats a file location for compiler-independent XML output.
-// Although this function is not platform dependent, we put it next to
-// FormatFileLocation in order to contrast the two functions.
-GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
- int line);
-
-// Defines logging utilities:
-// GTEST_LOG_(severity) - logs messages at the specified severity level. The
-// message itself is streamed into the macro.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-
-enum GTestLogSeverity {
- GTEST_INFO,
- GTEST_WARNING,
- GTEST_ERROR,
- GTEST_FATAL
-};
-
-// Formats log entry severity, provides a stream object for streaming the
-// log message, and terminates the message with a newline when going out of
-// scope.
-class GTEST_API_ GTestLog {
- public:
- GTestLog(GTestLogSeverity severity, const char* file, int line);
-
- // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
- ~GTestLog();
-
- ::std::ostream& GetStream() { return ::std::cerr; }
-
- private:
- const GTestLogSeverity severity_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
-};
-
-#define GTEST_LOG_(severity) \
- ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
- __FILE__, __LINE__).GetStream()
-
-inline void LogToStderr() {}
-inline void FlushInfoLog() { fflush(NULL); }
-
-// INTERNAL IMPLEMENTATION - DO NOT USE.
-//
-// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
-// is not satisfied.
-// Synopsys:
-// GTEST_CHECK_(boolean_condition);
-// or
-// GTEST_CHECK_(boolean_condition) << "Additional message";
-//
-// This checks the condition and if the condition is not satisfied
-// it prints message about the condition violation, including the
-// condition itself, plus additional message streamed into it, if any,
-// and then it aborts the program. It aborts the program irrespective of
-// whether it is built in the debug mode or not.
-#define GTEST_CHECK_(condition) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::IsTrue(condition)) \
- ; \
- else \
- GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
-
-// An all-mode assert to verify that the given POSIX-style function
-// call returns 0 (indicating success). Known limitation: this
-// doesn't expand to a balanced 'if' statement, so enclose the macro
-// in {} if you need to use it as the only statement in an 'if'
-// branch.
-#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
- if (const int gtest_error = (posix_call)) \
- GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
- << gtest_error
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Use ImplicitCast_ as a safe version of static_cast for upcasting in
-// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
-// const Foo*). When you use ImplicitCast_, the compiler checks that
-// the cast is safe. Such explicit ImplicitCast_s are necessary in
-// surprisingly many situations where C++ demands an exact type match
-// instead of an argument type convertable to a target type.
-//
-// The syntax for using ImplicitCast_ is the same as for static_cast:
-//
-// ImplicitCast_<ToType>(expr)
-//
-// ImplicitCast_ would have been part of the C++ standard library,
-// but the proposal was submitted too late. It will probably make
-// its way into the language in the future.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., implicit_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To>
-inline To ImplicitCast_(To x) { return x; }
-
-// When you upcast (that is, cast a pointer from type Foo to type
-// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
-// always succeed. When you downcast (that is, cast a pointer from
-// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
-// how do you know the pointer is really of type SubclassOfFoo? It
-// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
-// when you downcast, you should use this macro. In debug mode, we
-// use dynamic_cast<> to double-check the downcast is legal (we die
-// if it's not). In normal mode, we do the efficient static_cast<>
-// instead. Thus, it's important to test in debug mode to make sure
-// the cast is legal!
-// This is the only place in the code we should use dynamic_cast<>.
-// In particular, you SHOULDN'T be using dynamic_cast<> in order to
-// do RTTI (eg code like this:
-// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
-// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
-// You should design the code some other way not to need this.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., down_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To, typename From> // use like this: DownCast_<T*>(foo);
-inline To DownCast_(From* f) { // so we only accept pointers
- // Ensures that To is a sub-type of From *. This test is here only
- // for compile-time type checking, and has no overhead in an
- // optimized build at run-time, as it will be optimized away
- // completely.
- if (false) {
- const To to = NULL;
- ::testing::internal::ImplicitCast_<From*>(to);
- }
-
-#if GTEST_HAS_RTTI
- // RTTI: debug mode only!
- GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
-#endif
- return static_cast<To>(f);
-}
-
-// Downcasts the pointer of type Base to Derived.
-// Derived must be a subclass of Base. The parameter MUST
-// point to a class of type Derived, not any subclass of it.
-// When RTTI is available, the function performs a runtime
-// check to enforce this.
-template <class Derived, class Base>
-Derived* CheckedDowncastToActualType(Base* base) {
-#if GTEST_HAS_RTTI
- GTEST_CHECK_(typeid(*base) == typeid(Derived));
- return dynamic_cast<Derived*>(base); // NOLINT
-#else
- return static_cast<Derived*>(base); // Poor man's downcast.
-#endif
-}
-
-#if GTEST_HAS_STREAM_REDIRECTION
-
-// Defines the stderr capturer:
-// CaptureStdout - starts capturing stdout.
-// GetCapturedStdout - stops capturing stdout and returns the captured string.
-// CaptureStderr - starts capturing stderr.
-// GetCapturedStderr - stops capturing stderr and returns the captured string.
-//
-GTEST_API_ void CaptureStdout();
-GTEST_API_ std::string GetCapturedStdout();
-GTEST_API_ void CaptureStderr();
-GTEST_API_ std::string GetCapturedStderr();
-
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-
-#if GTEST_HAS_DEATH_TEST
-
-const ::std::vector<testing::internal::string>& GetInjectableArgvs();
-void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
- new_argvs);
-
-// A copy of all command line arguments. Set by InitGoogleTest().
-extern ::std::vector<testing::internal::string> g_argvs;
-
-#endif // GTEST_HAS_DEATH_TEST
-
-// Defines synchronization primitives.
-
-#if GTEST_HAS_PTHREAD
-
-// Sleeps for (roughly) n milli-seconds. This function is only for
-// testing Google Test's own constructs. Don't use it in user tests,
-// either directly or indirectly.
-inline void SleepMilliseconds(int n) {
- const timespec time = {
- 0, // 0 seconds.
- n * 1000L * 1000L, // And n ms.
- };
- nanosleep(&time, NULL);
-}
-
-// Allows a controller thread to pause execution of newly created
-// threads until notified. Instances of this class must be created
-// and destroyed in the controller thread.
-//
-// This class is only for testing Google Test's own constructs. Do not
-// use it in user tests, either directly or indirectly.
-class Notification {
- public:
- Notification() : notified_(false) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- }
- ~Notification() {
- pthread_mutex_destroy(&mutex_);
- }
-
- // Notifies all threads created with this notification to start. Must
- // be called from the controller thread.
- void Notify() {
- pthread_mutex_lock(&mutex_);
- notified_ = true;
- pthread_mutex_unlock(&mutex_);
- }
-
- // Blocks until the controller thread notifies. Must be called from a test
- // thread.
- void WaitForNotification() {
- for (;;) {
- pthread_mutex_lock(&mutex_);
- const bool notified = notified_;
- pthread_mutex_unlock(&mutex_);
- if (notified)
- break;
- SleepMilliseconds(10);
- }
- }
-
- private:
- pthread_mutex_t mutex_;
- bool notified_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
-};
-
-// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
-// Consequently, it cannot select a correct instantiation of ThreadWithParam
-// in order to call its Run(). Introducing ThreadWithParamBase as a
-// non-templated base class for ThreadWithParam allows us to bypass this
-// problem.
-class ThreadWithParamBase {
- public:
- virtual ~ThreadWithParamBase() {}
- virtual void Run() = 0;
-};
-
-// pthread_create() accepts a pointer to a function type with the C linkage.
-// According to the Standard (7.5/1), function types with different linkages
-// are different even if they are otherwise identical. Some compilers (for
-// example, SunStudio) treat them as different types. Since class methods
-// cannot be defined with C-linkage we need to define a free C-function to
-// pass into pthread_create().
-extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
- static_cast<ThreadWithParamBase*>(thread)->Run();
- return NULL;
-}
-
-// Helper class for testing Google Test's multi-threading constructs.
-// To use it, write:
-//
-// void ThreadFunc(int param) { /* Do things with param */ }
-// Notification thread_can_start;
-// ...
-// // The thread_can_start parameter is optional; you can supply NULL.
-// ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
-// thread_can_start.Notify();
-//
-// These classes are only for testing Google Test's own constructs. Do
-// not use them in user tests, either directly or indirectly.
-template <typename T>
-class ThreadWithParam : public ThreadWithParamBase {
- public:
- typedef void (*UserThreadFunc)(T);
-
- ThreadWithParam(
- UserThreadFunc func, T param, Notification* thread_can_start)
- : func_(func),
- param_(param),
- thread_can_start_(thread_can_start),
- finished_(false) {
- ThreadWithParamBase* const base = this;
- // The thread can be created only after all fields except thread_
- // have been initialized.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
- }
- ~ThreadWithParam() { Join(); }
-
- void Join() {
- if (!finished_) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
- finished_ = true;
- }
- }
-
- virtual void Run() {
- if (thread_can_start_ != NULL)
- thread_can_start_->WaitForNotification();
- func_(param_);
- }
-
- private:
- const UserThreadFunc func_; // User-supplied thread function.
- const T param_; // User-supplied parameter to the thread function.
- // When non-NULL, used to block execution until the controller thread
- // notifies.
- Notification* const thread_can_start_;
- bool finished_; // true iff we know that the thread function has finished.
- pthread_t thread_; // The native thread object.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
-};
-
-// MutexBase and Mutex implement mutex on pthreads-based platforms. They
-// are used in conjunction with class MutexLock:
-//
-// Mutex mutex;
-// ...
-// MutexLock lock(&mutex); // Acquires the mutex and releases it at the end
-// // of the current scope.
-//
-// MutexBase implements behavior for both statically and dynamically
-// allocated mutexes. Do not use MutexBase directly. Instead, write
-// the following to define a static mutex:
-//
-// GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
-//
-// You can forward declare a static mutex like this:
-//
-// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
-//
-// To create a dynamic mutex, just define an object of type Mutex.
-class MutexBase {
- public:
- // Acquires this mutex.
- void Lock() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
- owner_ = pthread_self();
- has_owner_ = true;
- }
-
- // Releases this mutex.
- void Unlock() {
- // Since the lock is being released the owner_ field should no longer be
- // considered valid. We don't protect writing to has_owner_ here, as it's
- // the caller's responsibility to ensure that the current thread holds the
- // mutex when this is called.
- has_owner_ = false;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
- }
-
- // Does nothing if the current thread holds the mutex. Otherwise, crashes
- // with high probability.
- void AssertHeld() const {
- GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
- << "The current thread is not holding the mutex @" << this;
- }
-
- // A static mutex may be used before main() is entered. It may even
- // be used before the dynamic initialization stage. Therefore we
- // must be able to initialize a static mutex object at link time.
- // This means MutexBase has to be a POD and its member variables
- // have to be public.
- public:
- pthread_mutex_t mutex_; // The underlying pthread mutex.
- // has_owner_ indicates whether the owner_ field below contains a valid thread
- // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
- // accesses to the owner_ field should be protected by a check of this field.
- // An alternative might be to memset() owner_ to all zeros, but there's no
- // guarantee that a zero'd pthread_t is necessarily invalid or even different
- // from pthread_self().
- bool has_owner_;
- pthread_t owner_; // The thread holding the mutex.
-};
-
-// Forward-declares a static mutex.
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::MutexBase mutex
-
-// Defines and statically (i.e. at link time) initializes a static mutex.
-// The initialization list here does not explicitly initialize each field,
-// instead relying on default initialization for the unspecified fields. In
-// particular, the owner_ field (a pthread_t) is not explicitly initialized.
-// This allows initialization to work whether pthread_t is a scalar or struct.
-// The flag -Wmissing-field-initializers must not be specified for this to work.
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
- ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }
-
-// The Mutex class can only be used for mutexes created at runtime. It
-// shares its API with MutexBase otherwise.
-class Mutex : public MutexBase {
- public:
- Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- has_owner_ = false;
- }
- ~Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
-};
-
-// We cannot name this class MutexLock as the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(MutexBase* mutex)
- : mutex_(mutex) { mutex_->Lock(); }
-
- ~GTestMutexLock() { mutex_->Unlock(); }
-
- private:
- MutexBase* const mutex_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
-};
-
-typedef GTestMutexLock MutexLock;
-
-// Helpers for ThreadLocal.
-
-// pthread_key_create() requires DeleteThreadLocalValue() to have
-// C-linkage. Therefore it cannot be templatized to access
-// ThreadLocal<T>. Hence the need for class
-// ThreadLocalValueHolderBase.
-class ThreadLocalValueHolderBase {
- public:
- virtual ~ThreadLocalValueHolderBase() {}
-};
-
-// Called by pthread to delete thread-local data stored by
-// pthread_setspecific().
-extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
- delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
-}
-
-// Implements thread-local storage on pthreads-based systems.
-//
-// // Thread 1
-// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
-//
-// // Thread 2
-// tl.set(150); // Changes the value for thread 2 only.
-// EXPECT_EQ(150, tl.get());
-//
-// // Thread 1
-// EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
-// tl.set(200);
-// EXPECT_EQ(200, tl.get());
-//
-// The template type argument T must have a public copy constructor.
-// In addition, the default ThreadLocal constructor requires T to have
-// a public default constructor.
-//
-// An object managed for a thread by a ThreadLocal instance is deleted
-// when the thread exits. Or, if the ThreadLocal instance dies in
-// that thread, when the ThreadLocal dies. It's the user's
-// responsibility to ensure that all other threads using a ThreadLocal
-// have exited when it dies, or the per-thread objects for those
-// threads will not be deleted.
-//
-// Google Test only uses global ThreadLocal objects. That means they
-// will die after main() has returned. Therefore, no per-thread
-// object managed by Google Test will be leaked as long as all threads
-// using Google Test have exited when main() returns.
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal() : key_(CreateKey()),
- default_() {}
- explicit ThreadLocal(const T& value) : key_(CreateKey()),
- default_(value) {}
-
- ~ThreadLocal() {
- // Destroys the managed object for the current thread, if any.
- DeleteThreadLocalValue(pthread_getspecific(key_));
-
- // Releases resources associated with the key. This will *not*
- // delete managed objects for other threads.
- GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
- }
-
- T* pointer() { return GetOrCreateValue(); }
- const T* pointer() const { return GetOrCreateValue(); }
- const T& get() const { return *pointer(); }
- void set(const T& value) { *pointer() = value; }
-
- private:
- // Holds a value of type T.
- class ValueHolder : public ThreadLocalValueHolderBase {
- public:
- explicit ValueHolder(const T& value) : value_(value) {}
-
- T* pointer() { return &value_; }
-
- private:
- T value_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
- };
-
- static pthread_key_t CreateKey() {
- pthread_key_t key;
- // When a thread exits, DeleteThreadLocalValue() will be called on
- // the object managed for that thread.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_key_create(&key, &DeleteThreadLocalValue));
- return key;
- }
-
- T* GetOrCreateValue() const {
- ThreadLocalValueHolderBase* const holder =
- static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
- if (holder != NULL) {
- return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
- }
-
- ValueHolder* const new_holder = new ValueHolder(default_);
- ThreadLocalValueHolderBase* const holder_base = new_holder;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
- return new_holder->pointer();
- }
-
- // A key pthreads uses for looking up per-thread values.
- const pthread_key_t key_;
- const T default_; // The default value for each thread.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
-};
-
-# define GTEST_IS_THREADSAFE 1
-
-#else // GTEST_HAS_PTHREAD
-
-// A dummy implementation of synchronization primitives (mutex, lock,
-// and thread-local variable). Necessary for compiling Google Test where
-// mutex is not supported - using Google Test in multiple threads is not
-// supported on such platforms.
-
-class Mutex {
- public:
- Mutex() {}
- void Lock() {}
- void Unlock() {}
- void AssertHeld() const {}
-};
-
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::Mutex mutex
-
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
-
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(Mutex*) {} // NOLINT
-};
-
-typedef GTestMutexLock MutexLock;
-
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal() : value_() {}
- explicit ThreadLocal(const T& value) : value_(value) {}
- T* pointer() { return &value_; }
- const T* pointer() const { return &value_; }
- const T& get() const { return value_; }
- void set(const T& value) { value_ = value; }
- private:
- T value_;
-};
-
-// The above synchronization primitives have dummy implementations.
-// Therefore Google Test is not thread-safe.
-# define GTEST_IS_THREADSAFE 0
-
-#endif // GTEST_HAS_PTHREAD
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-GTEST_API_ size_t GetThreadCount();
-
-// Passing non-POD classes through ellipsis (...) crashes the ARM
-// compiler and generates a warning in Sun Studio. The Nokia Symbian
-// and the IBM XL C/C++ compiler try to instantiate a copy constructor
-// for objects passed through ellipsis (...), failing for uncopyable
-// objects. We define this to ensure that only POD is passed through
-// ellipsis on these systems.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_ELLIPSIS_NEEDS_POD_ 1
-#else
-# define GTEST_CAN_COMPARE_NULL 1
-#endif
-
-// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
-// const T& and const T* in a function template. These compilers
-// _can_ decide between class template specializations for T and T*,
-// so a tr1::type_traits-like is_pointer works.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
-# define GTEST_NEEDS_IS_POINTER_ 1
-#endif
-
-template <bool bool_value>
-struct bool_constant {
- typedef bool_constant<bool_value> type;
- static const bool value = bool_value;
-};
-template <bool bool_value> const bool bool_constant<bool_value>::value;
-
-typedef bool_constant<false> false_type;
-typedef bool_constant<true> true_type;
-
-template <typename T>
-struct is_pointer : public false_type {};
-
-template <typename T>
-struct is_pointer<T*> : public true_type {};
-
-template <typename Iterator>
-struct IteratorTraits {
- typedef typename Iterator::value_type value_type;
-};
-
-template <typename T>
-struct IteratorTraits<T*> {
- typedef T value_type;
-};
-
-template <typename T>
-struct IteratorTraits<const T*> {
- typedef T value_type;
-};
-
-#if GTEST_OS_WINDOWS
-# define GTEST_PATH_SEP_ "\\"
-# define GTEST_HAS_ALT_PATH_SEP_ 1
-// The biggest signed integer type the compiler supports.
-typedef __int64 BiggestInt;
-#else
-# define GTEST_PATH_SEP_ "/"
-# define GTEST_HAS_ALT_PATH_SEP_ 0
-typedef long long BiggestInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-
-// Utilities for char.
-
-// isspace(int ch) and friends accept an unsigned char or EOF. char
-// may be signed, depending on the compiler (or compiler flags).
-// Therefore we need to cast a char to unsigned char before calling
-// isspace(), etc.
-
-inline bool IsAlpha(char ch) {
- return isalpha(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsAlNum(char ch) {
- return isalnum(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsDigit(char ch) {
- return isdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsLower(char ch) {
- return islower(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsSpace(char ch) {
- return isspace(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsUpper(char ch) {
- return isupper(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(char ch) {
- return isxdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(wchar_t ch) {
- const unsigned char low_byte = static_cast<unsigned char>(ch);
- return ch == low_byte && isxdigit(low_byte) != 0;
-}
-
-inline char ToLower(char ch) {
- return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
-}
-inline char ToUpper(char ch) {
- return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
-}
-
-// The testing::internal::posix namespace holds wrappers for common
-// POSIX functions. These wrappers hide the differences between
-// Windows/MSVC and POSIX systems. Since some compilers define these
-// standard functions as macros, the wrapper cannot have the same name
-// as the wrapped function.
-
-namespace posix {
-
-// Functions with a different name on Windows.
-
-#if GTEST_OS_WINDOWS
-
-typedef struct _stat StatStruct;
-
-# ifdef __BORLANDC__
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-# else // !__BORLANDC__
-# if GTEST_OS_WINDOWS_MOBILE
-inline int IsATTY(int /* fd */) { return 0; }
-# else
-inline int IsATTY(int fd) { return _isatty(fd); }
-# endif // GTEST_OS_WINDOWS_MOBILE
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return _stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return _strdup(src); }
-# endif // __BORLANDC__
-
-# if GTEST_OS_WINDOWS_MOBILE
-inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
-// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
-// time and thus not defined there.
-# else
-inline int FileNo(FILE* file) { return _fileno(file); }
-inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
-inline int RmDir(const char* dir) { return _rmdir(dir); }
-inline bool IsDir(const StatStruct& st) {
- return (_S_IFDIR & st.st_mode) != 0;
-}
-# endif // GTEST_OS_WINDOWS_MOBILE
-
-#else
-
-typedef struct stat StatStruct;
-
-inline int FileNo(FILE* file) { return fileno(file); }
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return strcasecmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-inline int RmDir(const char* dir) { return rmdir(dir); }
-inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
-
-#endif // GTEST_OS_WINDOWS
-
-// Functions deprecated by MSVC 8.0.
-
-#ifdef _MSC_VER
-// Temporarily disable warning 4996 (deprecated function).
-# pragma warning(push)
-# pragma warning(disable:4996)
-#endif
-
-inline const char* StrNCpy(char* dest, const char* src, size_t n) {
- return strncpy(dest, src, n);
-}
-
-// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
-// StrError() aren't needed on Windows CE at this time and thus not
-// defined there.
-
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int ChDir(const char* dir) { return chdir(dir); }
-#endif
-inline FILE* FOpen(const char* path, const char* mode) {
- return fopen(path, mode);
-}
-#if !GTEST_OS_WINDOWS_MOBILE
-inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
- return freopen(path, mode, stream);
-}
-inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
-#endif
-inline int FClose(FILE* fp) { return fclose(fp); }
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int Read(int fd, void* buf, unsigned int count) {
- return static_cast<int>(read(fd, buf, count));
-}
-inline int Write(int fd, const void* buf, unsigned int count) {
- return static_cast<int>(write(fd, buf, count));
-}
-inline int Close(int fd) { return close(fd); }
-inline const char* StrError(int errnum) { return strerror(errnum); }
-#endif
-inline const char* GetEnv(const char* name) {
-#if GTEST_OS_WINDOWS_MOBILE
- // We are on Windows CE, which has no environment variables.
- return NULL;
-#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
- // Environment variables which we programmatically clear will be set to the
- // empty string rather than unset (NULL). Handle that case.
- const char* const env = getenv(name);
- return (env != NULL && env[0] != '\0') ? env : NULL;
-#else
- return getenv(name);
-#endif
-}
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Windows CE has no C library. The abort() function is used in
-// several places in Google Test. This implementation provides a reasonable
-// imitation of standard behaviour.
-void Abort();
-#else
-inline void Abort() { abort(); }
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-} // namespace posix
-
-// MSVC "deprecates" snprintf and issues warnings wherever it is used. In
-// order to avoid these warnings, we need to use _snprintf or _snprintf_s on
-// MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate
-// function in order to achieve that. We use macro definition here because
-// snprintf is a variadic function.
-#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
-// MSVC 2005 and above support variadic macros.
-# define GTEST_SNPRINTF_(buffer, size, format, ...) \
- _snprintf_s(buffer, size, size, format, __VA_ARGS__)
-#elif defined(_MSC_VER)
-// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
-// complain about _snprintf.
-# define GTEST_SNPRINTF_ _snprintf
-#else
-# define GTEST_SNPRINTF_ snprintf
-#endif
-
-// The maximum number a BiggestInt can represent. This definition
-// works no matter BiggestInt is represented in one's complement or
-// two's complement.
-//
-// We cannot rely on numeric_limits in STL, as __int64 and long long
-// are not part of standard C++ and numeric_limits doesn't need to be
-// defined for them.
-const BiggestInt kMaxBiggestInt =
- ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
-
-// This template class serves as a compile-time function from size to
-// type. It maps a size in bytes to a primitive type with that
-// size. e.g.
-//
-// TypeWithSize<4>::UInt
-//
-// is typedef-ed to be unsigned int (unsigned integer made up of 4
-// bytes).
-//
-// Such functionality should belong to STL, but I cannot find it
-// there.
-//
-// Google Test uses this class in the implementation of floating-point
-// comparison.
-//
-// For now it only handles UInt (unsigned int) as that's all Google Test
-// needs. Other types can be easily added in the future if need
-// arises.
-template <size_t size>
-class TypeWithSize {
- public:
- // This prevents the user from using TypeWithSize<N> with incorrect
- // values of N.
- typedef void UInt;
-};
-
-// The specialization for size 4.
-template <>
-class TypeWithSize<4> {
- public:
- // unsigned int has size 4 in both gcc and MSVC.
- //
- // As base/basictypes.h doesn't compile on Windows, we cannot use
- // uint32, uint64, and etc here.
- typedef int Int;
- typedef unsigned int UInt;
-};
-
-// The specialization for size 8.
-template <>
-class TypeWithSize<8> {
- public:
-#if GTEST_OS_WINDOWS
- typedef __int64 Int;
- typedef unsigned __int64 UInt;
-#else
- typedef long long Int; // NOLINT
- typedef unsigned long long UInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-};
-
-// Integer types of known sizes.
-typedef TypeWithSize<4>::Int Int32;
-typedef TypeWithSize<4>::UInt UInt32;
-typedef TypeWithSize<8>::Int Int64;
-typedef TypeWithSize<8>::UInt UInt64;
-typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
-
-// Utilities for command line flags and environment variables.
-
-// Macro for referencing flags.
-#define GTEST_FLAG(name) FLAGS_gtest_##name
-
-// Macros for declaring flags.
-#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
-#define GTEST_DECLARE_int32_(name) \
- GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
-#define GTEST_DECLARE_string_(name) \
- GTEST_API_ extern ::std::string GTEST_FLAG(name)
-
-// Macros for defining flags.
-#define GTEST_DEFINE_bool_(name, default_val, doc) \
- GTEST_API_ bool GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_int32_(name, default_val, doc) \
- GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_string_(name, default_val, doc) \
- GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
-
-// Thread annotations
-#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
-#define GTEST_LOCK_EXCLUDED_(locks)
-
-// Parses 'str' for a 32-bit signed integer. If successful, writes the result
-// to *value and returns true; otherwise leaves *value unchanged and returns
-// false.
-// TODO(chandlerc): Find a better way to refactor flag and environment parsing
-// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
-// function.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value);
-
-// Parses a bool/Int32/string from the environment variable
-// corresponding to the given Google Test flag.
-bool BoolFromGTestEnv(const char* flag, bool default_val);
-GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
-const char* StringFromGTestEnv(const char* flag, const char* default_val);
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-
-#if GTEST_OS_LINUX
-# include <stdlib.h>
-# include <sys/types.h>
-# include <sys/wait.h>
-# include <unistd.h>
-#endif // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept>
-#endif
-
-#include <ctype.h>
-#include <float.h>
-#include <string.h>
-#include <iomanip>
-#include <limits>
-#include <set>
-
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the Message class.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-
-#include <limits>
-
-
-// Ensures that there is at least one operator<< in the global namespace.
-// See Message& operator<<(...) below for why.
-void operator<<(const testing::internal::Secret&, int);
-
-namespace testing {
-
-// The Message class works like an ostream repeater.
-//
-// Typical usage:
-//
-// 1. You stream a bunch of values to a Message object.
-// It will remember the text in a stringstream.
-// 2. Then you stream the Message object to an ostream.
-// This causes the text in the Message to be streamed
-// to the ostream.
-//
-// For example;
-//
-// testing::Message foo;
-// foo << 1 << " != " << 2;
-// std::cout << foo;
-//
-// will print "1 != 2".
-//
-// Message is not intended to be inherited from. In particular, its
-// destructor is not virtual.
-//
-// Note that stringstream behaves differently in gcc and in MSVC. You
-// can stream a NULL char pointer to it in the former, but not in the
-// latter (it causes an access violation if you do). The Message
-// class hides this difference by treating a NULL char pointer as
-// "(null)".
-class GTEST_API_ Message {
- private:
- // The type of basic IO manipulators (endl, ends, and flush) for
- // narrow streams.
- typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
-
- public:
- // Constructs an empty Message.
- Message();
-
- // Copy constructor.
- Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
- *ss_ << msg.GetString();
- }
-
- // Constructs a Message from a C-string.
- explicit Message(const char* str) : ss_(new ::std::stringstream) {
- *ss_ << str;
- }
-
-#if GTEST_OS_SYMBIAN
- // Streams a value (either a pointer or not) to this object.
- template <typename T>
- inline Message& operator <<(const T& value) {
- StreamHelper(typename internal::is_pointer<T>::type(), value);
- return *this;
- }
-#else
- // Streams a non-pointer value to this object.
- template <typename T>
- inline Message& operator <<(const T& val) {
- // Some libraries overload << for STL containers. These
- // overloads are defined in the global namespace instead of ::std.
- //
- // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
- // overloads are visible in either the std namespace or the global
- // namespace, but not other namespaces, including the testing
- // namespace which Google Test's Message class is in.
- //
- // To allow STL containers (and other types that has a << operator
- // defined in the global namespace) to be used in Google Test
- // assertions, testing::Message must access the custom << operator
- // from the global namespace. With this using declaration,
- // overloads of << defined in the global namespace and those
- // visible via Koenig lookup are both exposed in this function.
- using ::operator <<;
- *ss_ << val;
- return *this;
- }
-
- // Streams a pointer value to this object.
- //
- // This function is an overload of the previous one. When you
- // stream a pointer to a Message, this definition will be used as it
- // is more specialized. (The C++ Standard, section
- // [temp.func.order].) If you stream a non-pointer, then the
- // previous definition will be used.
- //
- // The reason for this overload is that streaming a NULL pointer to
- // ostream is undefined behavior. Depending on the compiler, you
- // may get "0", "(nil)", "(null)", or an access violation. To
- // ensure consistent result across compilers, we always treat NULL
- // as "(null)".
- template <typename T>
- inline Message& operator <<(T* const& pointer) { // NOLINT
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- return *this;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // Since the basic IO manipulators are overloaded for both narrow
- // and wide streams, we have to provide this specialized definition
- // of operator <<, even though its body is the same as the
- // templatized version above. Without this definition, streaming
- // endl or other basic IO manipulators to Message will confuse the
- // compiler.
- Message& operator <<(BasicNarrowIoManip val) {
- *ss_ << val;
- return *this;
- }
-
- // Instead of 1/0, we want to see true/false for bool values.
- Message& operator <<(bool b) {
- return *this << (b ? "true" : "false");
- }
-
- // These two overloads allow streaming a wide C string to a Message
- // using the UTF-8 encoding.
- Message& operator <<(const wchar_t* wide_c_str);
- Message& operator <<(wchar_t* wide_c_str);
-
-#if GTEST_HAS_STD_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::std::wstring& wstr);
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::wstring& wstr);
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
- // Gets the text streamed to this object so far as an std::string.
- // Each '\0' character in the buffer is replaced with "\\0".
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- std::string GetString() const;
-
- private:
-
-#if GTEST_OS_SYMBIAN
- // These are needed as the Nokia Symbian Compiler cannot decide between
- // const T& and const T* in a function template. The Nokia compiler _can_
- // decide between class template specializations for T and T*, so a
- // tr1::type_traits-like is_pointer works, and we can overload on that.
- template <typename T>
- inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- }
- template <typename T>
- inline void StreamHelper(internal::false_type /*is_pointer*/,
- const T& value) {
- // See the comments in Message& operator <<(const T&) above for why
- // we need this using statement.
- using ::operator <<;
- *ss_ << value;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // We'll hold the text streamed to this object here.
- const internal::scoped_ptr< ::std::stringstream> ss_;
-
- // We declare (but don't implement) this to prevent the compiler
- // from implementing the assignment operator.
- void operator=(const Message&);
-};
-
-// Streams a Message to an ostream.
-inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
- return os << sb.GetString();
-}
-
-namespace internal {
-
-// Converts a streamable value to an std::string. A NULL pointer is
-// converted to "(null)". When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-template <typename T>
-std::string StreamableToString(const T& streamable) {
- return (Message() << streamable).GetString();
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares the String class and functions used internally by
-// Google Test. They are subject to change without notice. They should not used
-// by code external to Google Test.
-//
-// This header file is #included by <gtest/internal/gtest-internal.h>.
-// It should not be #included by other files.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-
-#ifdef __BORLANDC__
-// string.h is not guaranteed to provide strcpy on C++ Builder.
-# include <mem.h>
-#endif
-
-#include <string.h>
-#include <string>
-
-
-namespace testing {
-namespace internal {
-
-// String - an abstract class holding static string utilities.
-class GTEST_API_ String {
- public:
- // Static utility methods
-
- // Clones a 0-terminated C string, allocating memory using new. The
- // caller is responsible for deleting the return value using
- // delete[]. Returns the cloned string, or NULL if the input is
- // NULL.
- //
- // This is different from strdup() in string.h, which allocates
- // memory using malloc().
- static const char* CloneCString(const char* c_str);
-
-#if GTEST_OS_WINDOWS_MOBILE
- // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
- // able to pass strings to Win32 APIs on CE we need to convert them
- // to 'Unicode', UTF-16.
-
- // Creates a UTF-16 wide string from the given ANSI string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the wide string, or NULL if the
- // input is NULL.
- //
- // The wide string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static LPCWSTR AnsiToUtf16(const char* c_str);
-
- // Creates an ANSI string from the given wide string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the ANSI string, or NULL if the
- // input is NULL.
- //
- // The returned string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static const char* Utf16ToAnsi(LPCWSTR utf16_str);
-#endif
-
- // Compares two C strings. Returns true iff they have the same content.
- //
- // Unlike strcmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CStringEquals(const char* lhs, const char* rhs);
-
- // Converts a wide C string to a String using the UTF-8 encoding.
- // NULL will be converted to "(null)". If an error occurred during
- // the conversion, "(failed to convert from wide string)" is
- // returned.
- static std::string ShowWideCString(const wchar_t* wide_c_str);
-
- // Compares two wide C strings. Returns true iff they have the same
- // content.
- //
- // Unlike wcscmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
-
- // Compares two C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike strcasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CaseInsensitiveCStringEquals(const char* lhs,
- const char* rhs);
-
- // Compares two wide C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL wide C string,
- // including the empty string.
- // NB: The implementations on different platforms slightly differ.
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
- // environment variable. On GNU platform this method uses wcscasecmp
- // which compares according to LC_CTYPE category of the current locale.
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
- // current locale.
- static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs);
-
- // Returns true iff the given string ends with the given suffix, ignoring
- // case. Any string is considered to end with an empty suffix.
- static bool EndsWithCaseInsensitive(
- const std::string& str, const std::string& suffix);
-
- // Formats an int value as "%02d".
- static std::string FormatIntWidth2(int value); // "%02d" for width == 2
-
- // Formats an int value as "%X".
- static std::string FormatHexInt(int value);
-
- // Formats a byte as "%02X".
- static std::string FormatByte(unsigned char value);
-
- private:
- String(); // Not meant to be instantiated.
-}; // class String
-
-// Gets the content of the stringstream's buffer as an std::string. Each '\0'
-// character in the buffer is replaced with "\\0".
-GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: keith.ray@gmail.com (Keith Ray)
-//
-// Google Test filepath utilities
-//
-// This header file declares classes and functions used internally by
-// Google Test. They are subject to change without notice.
-//
-// This file is #included in <gtest/internal/gtest-internal.h>.
-// Do not include this header file separately!
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-
-
-namespace testing {
-namespace internal {
-
-// FilePath - a class for file and directory pathname manipulation which
-// handles platform-specific conventions (like the pathname separator).
-// Used for helper functions for naming files in a directory for xml output.
-// Except for Set methods, all methods are const or static, which provides an
-// "immutable value object" -- useful for peace of mind.
-// A FilePath with a value ending in a path separator ("like/this/") represents
-// a directory, otherwise it is assumed to represent a file. In either case,
-// it may or may not represent an actual file or directory in the file system.
-// Names are NOT checked for syntax correctness -- no checking for illegal
-// characters, malformed paths, etc.
-
-class GTEST_API_ FilePath {
- public:
- FilePath() : pathname_("") { }
- FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
-
- explicit FilePath(const std::string& pathname) : pathname_(pathname) {
- Normalize();
- }
-
- FilePath& operator=(const FilePath& rhs) {
- Set(rhs);
- return *this;
- }
-
- void Set(const FilePath& rhs) {
- pathname_ = rhs.pathname_;
- }
-
- const std::string& string() const { return pathname_; }
- const char* c_str() const { return pathname_.c_str(); }
-
- // Returns the current working directory, or "" if unsuccessful.
- static FilePath GetCurrentDir();
-
- // Given directory = "dir", base_name = "test", number = 0,
- // extension = "xml", returns "dir/test.xml". If number is greater
- // than zero (e.g., 12), returns "dir/test_12.xml".
- // On Windows platform, uses \ as the separator rather than /.
- static FilePath MakeFileName(const FilePath& directory,
- const FilePath& base_name,
- int number,
- const char* extension);
-
- // Given directory = "dir", relative_path = "test.xml",
- // returns "dir/test.xml".
- // On Windows, uses \ as the separator rather than /.
- static FilePath ConcatPaths(const FilePath& directory,
- const FilePath& relative_path);
-
- // Returns a pathname for a file that does not currently exist. The pathname
- // will be directory/base_name.extension or
- // directory/base_name_<number>.extension if directory/base_name.extension
- // already exists. The number will be incremented until a pathname is found
- // that does not already exist.
- // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
- // There could be a race condition if two or more processes are calling this
- // function at the same time -- they could both pick the same filename.
- static FilePath GenerateUniqueFileName(const FilePath& directory,
- const FilePath& base_name,
- const char* extension);
-
- // Returns true iff the path is "".
- bool IsEmpty() const { return pathname_.empty(); }
-
- // If input name has a trailing separator character, removes it and returns
- // the name, otherwise return the name string unmodified.
- // On Windows platform, uses \ as the separator, other platforms use /.
- FilePath RemoveTrailingPathSeparator() const;
-
- // Returns a copy of the FilePath with the directory part removed.
- // Example: FilePath("path/to/file").RemoveDirectoryName() returns
- // FilePath("file"). If there is no directory part ("just_a_file"), it returns
- // the FilePath unmodified. If there is no file part ("just_a_dir/") it
- // returns an empty FilePath ("").
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveDirectoryName() const;
-
- // RemoveFileName returns the directory path with the filename removed.
- // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
- // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
- // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
- // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveFileName() const;
-
- // Returns a copy of the FilePath with the case-insensitive extension removed.
- // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
- // FilePath("dir/file"). If a case-insensitive extension is not
- // found, returns a copy of the original FilePath.
- FilePath RemoveExtension(const char* extension) const;
-
- // Creates directories so that path exists. Returns true if successful or if
- // the directories already exist; returns false if unable to create
- // directories for any reason. Will also return false if the FilePath does
- // not represent a directory (that is, it doesn't end with a path separator).
- bool CreateDirectoriesRecursively() const;
-
- // Create the directory so that path exists. Returns true if successful or
- // if the directory already exists; returns false if unable to create the
- // directory for any reason, including if the parent directory does not
- // exist. Not named "CreateDirectory" because that's a macro on Windows.
- bool CreateFolder() const;
-
- // Returns true if FilePath describes something in the file-system,
- // either a file, directory, or whatever, and that something exists.
- bool FileOrDirectoryExists() const;
-
- // Returns true if pathname describes a directory in the file-system
- // that exists.
- bool DirectoryExists() const;
-
- // Returns true if FilePath ends with a path separator, which indicates that
- // it is intended to represent a directory. Returns false otherwise.
- // This does NOT check that a directory (or file) actually exists.
- bool IsDirectory() const;
-
- // Returns true if pathname describes a root directory. (Windows has one
- // root directory per disk drive.)
- bool IsRootDirectory() const;
-
- // Returns true if pathname describes an absolute path.
- bool IsAbsolutePath() const;
-
- private:
- // Replaces multiple consecutive separators with a single separator.
- // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
- // redundancies that might be in a pathname involving "." or "..".
- //
- // A pathname with multiple consecutive separators may occur either through
- // user error or as a result of some scripts or APIs that generate a pathname
- // with a trailing separator. On other platforms the same API or script
- // may NOT generate a pathname with a trailing "/". Then elsewhere that
- // pathname may have another "/" and pathname components added to it,
- // without checking for the separator already being there.
- // The script language and operating system may allow paths like "foo//bar"
- // but some of the functions in FilePath will not handle that correctly. In
- // particular, RemoveTrailingPathSeparator() only removes one separator, and
- // it is called in CreateDirectoriesRecursively() assuming that it will change
- // a pathname from directory syntax (trailing separator) to filename syntax.
- //
- // On Windows this method also replaces the alternate path separator '/' with
- // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
- // "bar\\foo".
-
- void Normalize();
-
- // Returns a pointer to the last occurence of a valid path separator in
- // the FilePath. On Windows, for example, both '/' and '\' are valid path
- // separators. Returns NULL if no path separator was found.
- const char* FindLastPathSeparator() const;
-
- std::string pathname_;
-}; // class FilePath
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-// This file was GENERATED by command:
-// pump.py gtest-type-util.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently we support at most 50 types in a list, and at most 50
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-
-// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-# if GTEST_HAS_CXXABI_H_
-# include <cxxabi.h>
-# elif defined(__HP_aCC)
-# include <acxx_demangle.h>
-# endif // GTEST_HASH_CXXABI_H_
-
-namespace testing {
-namespace internal {
-
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
- int status = 0;
- // gcc's implementation of typeid(T).name() mangles the type name,
- // so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
- using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
- const std::string name_str(status == 0 ? readable_name : name);
- free(readable_name);
- return name_str;
-# else
- return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
-
- return "<type>";
-
-# endif // GTEST_HAS_RTTI
-}
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type. This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
- typedef bool type;
-};
-
-// A unique type used as the default value for the arguments of class
-// template Types. This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists. In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
- typedef T1 Head;
- typedef Types0 Tail;
-};
-template <typename T1, typename T2>
-struct Types2 {
- typedef T1 Head;
- typedef Types1<T2> Tail;
-};
-
-template <typename T1, typename T2, typename T3>
-struct Types3 {
- typedef T1 Head;
- typedef Types2<T2, T3> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types4 {
- typedef T1 Head;
- typedef Types3<T2, T3, T4> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types5 {
- typedef T1 Head;
- typedef Types4<T2, T3, T4, T5> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types6 {
- typedef T1 Head;
- typedef Types5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types7 {
- typedef T1 Head;
- typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types8 {
- typedef T1 Head;
- typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types9 {
- typedef T1 Head;
- typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types10 {
- typedef T1 Head;
- typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types11 {
- typedef T1 Head;
- typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types12 {
- typedef T1 Head;
- typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types13 {
- typedef T1 Head;
- typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types14 {
- typedef T1 Head;
- typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types15 {
- typedef T1 Head;
- typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types16 {
- typedef T1 Head;
- typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types17 {
- typedef T1 Head;
- typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types18 {
- typedef T1 Head;
- typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types19 {
- typedef T1 Head;
- typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types20 {
- typedef T1 Head;
- typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types21 {
- typedef T1 Head;
- typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types22 {
- typedef T1 Head;
- typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types23 {
- typedef T1 Head;
- typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types24 {
- typedef T1 Head;
- typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types25 {
- typedef T1 Head;
- typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types26 {
- typedef T1 Head;
- typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types27 {
- typedef T1 Head;
- typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types28 {
- typedef T1 Head;
- typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types29 {
- typedef T1 Head;
- typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types30 {
- typedef T1 Head;
- typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types31 {
- typedef T1 Head;
- typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types32 {
- typedef T1 Head;
- typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types33 {
- typedef T1 Head;
- typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types34 {
- typedef T1 Head;
- typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types35 {
- typedef T1 Head;
- typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types36 {
- typedef T1 Head;
- typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types37 {
- typedef T1 Head;
- typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types38 {
- typedef T1 Head;
- typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types39 {
- typedef T1 Head;
- typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types40 {
- typedef T1 Head;
- typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types41 {
- typedef T1 Head;
- typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types42 {
- typedef T1 Head;
- typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types43 {
- typedef T1 Head;
- typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types44 {
- typedef T1 Head;
- typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types45 {
- typedef T1 Head;
- typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types46 {
- typedef T1 Head;
- typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types47 {
- typedef T1 Head;
- typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types48 {
- typedef T1 Head;
- typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types49 {
- typedef T1 Head;
- typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct Types50 {
- typedef T1 Head;
- typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-} // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length. Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Types template.
-template <typename T1 = internal::None, typename T2 = internal::None,
- typename T3 = internal::None, typename T4 = internal::None,
- typename T5 = internal::None, typename T6 = internal::None,
- typename T7 = internal::None, typename T8 = internal::None,
- typename T9 = internal::None, typename T10 = internal::None,
- typename T11 = internal::None, typename T12 = internal::None,
- typename T13 = internal::None, typename T14 = internal::None,
- typename T15 = internal::None, typename T16 = internal::None,
- typename T17 = internal::None, typename T18 = internal::None,
- typename T19 = internal::None, typename T20 = internal::None,
- typename T21 = internal::None, typename T22 = internal::None,
- typename T23 = internal::None, typename T24 = internal::None,
- typename T25 = internal::None, typename T26 = internal::None,
- typename T27 = internal::None, typename T28 = internal::None,
- typename T29 = internal::None, typename T30 = internal::None,
- typename T31 = internal::None, typename T32 = internal::None,
- typename T33 = internal::None, typename T34 = internal::None,
- typename T35 = internal::None, typename T36 = internal::None,
- typename T37 = internal::None, typename T38 = internal::None,
- typename T39 = internal::None, typename T40 = internal::None,
- typename T41 = internal::None, typename T42 = internal::None,
- typename T43 = internal::None, typename T44 = internal::None,
- typename T45 = internal::None, typename T46 = internal::None,
- typename T47 = internal::None, typename T48 = internal::None,
- typename T49 = internal::None, typename T50 = internal::None>
-struct Types {
- typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Types<internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types0 type;
-};
-template <typename T1>
-struct Types<T1, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types1<T1> type;
-};
-template <typename T1, typename T2>
-struct Types<T1, T2, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types2<T1, T2> type;
-};
-template <typename T1, typename T2, typename T3>
-struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types3<T1, T2, T3> type;
-};
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types4<T1, T2, T3, T4> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types5<T1, T2, T3, T4, T5> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, internal::None, internal::None, internal::None> {
- typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, internal::None, internal::None> {
- typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, T49, internal::None> {
- typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-namespace internal {
-
-# define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>. This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
- template <typename T>
- struct Bind {
- typedef Tmpl<T> type;
- };
-};
-
-# define GTEST_BIND_(TmplSel, T) \
- TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates. This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists. In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN). Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
- typedef TemplateSel<T1> Head;
- typedef Templates0 Tail;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates2 {
- typedef TemplateSel<T1> Head;
- typedef Templates1<T2> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates3 {
- typedef TemplateSel<T1> Head;
- typedef Templates2<T2, T3> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates4 {
- typedef TemplateSel<T1> Head;
- typedef Templates3<T2, T3, T4> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates5 {
- typedef TemplateSel<T1> Head;
- typedef Templates4<T2, T3, T4, T5> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates6 {
- typedef TemplateSel<T1> Head;
- typedef Templates5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates7 {
- typedef TemplateSel<T1> Head;
- typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates8 {
- typedef TemplateSel<T1> Head;
- typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates9 {
- typedef TemplateSel<T1> Head;
- typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates10 {
- typedef TemplateSel<T1> Head;
- typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates11 {
- typedef TemplateSel<T1> Head;
- typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates12 {
- typedef TemplateSel<T1> Head;
- typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates13 {
- typedef TemplateSel<T1> Head;
- typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates14 {
- typedef TemplateSel<T1> Head;
- typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates15 {
- typedef TemplateSel<T1> Head;
- typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates16 {
- typedef TemplateSel<T1> Head;
- typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates17 {
- typedef TemplateSel<T1> Head;
- typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates18 {
- typedef TemplateSel<T1> Head;
- typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates19 {
- typedef TemplateSel<T1> Head;
- typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates20 {
- typedef TemplateSel<T1> Head;
- typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates21 {
- typedef TemplateSel<T1> Head;
- typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates22 {
- typedef TemplateSel<T1> Head;
- typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates23 {
- typedef TemplateSel<T1> Head;
- typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates24 {
- typedef TemplateSel<T1> Head;
- typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates25 {
- typedef TemplateSel<T1> Head;
- typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates26 {
- typedef TemplateSel<T1> Head;
- typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates27 {
- typedef TemplateSel<T1> Head;
- typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates28 {
- typedef TemplateSel<T1> Head;
- typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates29 {
- typedef TemplateSel<T1> Head;
- typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates30 {
- typedef TemplateSel<T1> Head;
- typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates31 {
- typedef TemplateSel<T1> Head;
- typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates32 {
- typedef TemplateSel<T1> Head;
- typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates33 {
- typedef TemplateSel<T1> Head;
- typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates34 {
- typedef TemplateSel<T1> Head;
- typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates35 {
- typedef TemplateSel<T1> Head;
- typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates36 {
- typedef TemplateSel<T1> Head;
- typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates37 {
- typedef TemplateSel<T1> Head;
- typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates38 {
- typedef TemplateSel<T1> Head;
- typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates39 {
- typedef TemplateSel<T1> Head;
- typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates40 {
- typedef TemplateSel<T1> Head;
- typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates41 {
- typedef TemplateSel<T1> Head;
- typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates42 {
- typedef TemplateSel<T1> Head;
- typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates43 {
- typedef TemplateSel<T1> Head;
- typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates44 {
- typedef TemplateSel<T1> Head;
- typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates45 {
- typedef TemplateSel<T1> Head;
- typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates46 {
- typedef TemplateSel<T1> Head;
- typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates47 {
- typedef TemplateSel<T1> Head;
- typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates48 {
- typedef TemplateSel<T1> Head;
- typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates49 {
- typedef TemplateSel<T1> Head;
- typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
-struct Templates50 {
- typedef TemplateSel<T1> Head;
- typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length. Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Templates template.
-template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
- GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
- GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
- GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
- GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
- GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
- GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
- GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
- GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
- GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
- GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
- GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
- GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
- GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
- GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
- GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
- GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
- GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
- GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
- GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
- GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
- GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
- GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
- GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
- GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
-struct Templates {
- typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates0 type;
-};
-template <GTEST_TEMPLATE_ T1>
-struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates1<T1> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates2<T1, T2> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates3<T1, T2, T3> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates4<T1, T2, T3, T4> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates5<T1, T2, T3, T4, T5> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates6<T1, T2, T3, T4, T5, T6> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, NoneT, NoneT, NoneT> {
- typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, NoneT, NoneT> {
- typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, T49, NoneT> {
- typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList {
- typedef Types1<T> type;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> > {
- typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-// Due to C++ preprocessor weirdness, we need double indirection to
-// concatenate two tokens when one of them is __LINE__. Writing
-//
-// foo ## __LINE__
-//
-// will result in the token foo__LINE__, instead of foo followed by
-// the current line number. For more details, see
-// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
-#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
-#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
-
-class ProtocolMessage;
-namespace proto2 { class Message; }
-
-namespace testing {
-
-// Forward declarations.
-
-class AssertionResult; // Result of an assertion.
-class Message; // Represents a failure message.
-class Test; // Represents a test.
-class TestInfo; // Information about a test.
-class TestPartResult; // Result of a test part.
-class UnitTest; // A collection of test cases.
-
-template <typename T>
-::std::string PrintToString(const T& value);
-
-namespace internal {
-
-struct TraceInfo; // Information about a trace point.
-class ScopedTrace; // Implements scoped trace.
-class TestInfoImpl; // Opaque implementation of TestInfo
-class UnitTestImpl; // Opaque implementation of UnitTest
-
-// How many times InitGoogleTest() has been called.
-GTEST_API_ extern int g_init_gtest_count;
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-GTEST_API_ extern const char kStackTraceMarker[];
-
-// Two overloaded helpers for checking at compile time whether an
-// expression is a null pointer literal (i.e. NULL or any 0-valued
-// compile-time integral constant). Their return values have
-// different sizes, so we can use sizeof() to test which version is
-// picked by the compiler. These helpers have no implementations, as
-// we only need their signatures.
-//
-// Given IsNullLiteralHelper(x), the compiler will pick the first
-// version if x can be implicitly converted to Secret*, and pick the
-// second version otherwise. Since Secret is a secret and incomplete
-// type, the only expression a user can write that has type Secret* is
-// a null pointer literal. Therefore, we know that x is a null
-// pointer literal if and only if the first version is picked by the
-// compiler.
-char IsNullLiteralHelper(Secret* p);
-char (&IsNullLiteralHelper(...))[2]; // NOLINT
-
-// A compile-time bool constant that is true if and only if x is a
-// null pointer literal (i.e. NULL or any 0-valued compile-time
-// integral constant).
-#ifdef GTEST_ELLIPSIS_NEEDS_POD_
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_IS_NULL_LITERAL_(x) false
-#else
-# define GTEST_IS_NULL_LITERAL_(x) \
- (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
-#endif // GTEST_ELLIPSIS_NEEDS_POD_
-
-// Appends the user-supplied message to the Google-Test-generated message.
-GTEST_API_ std::string AppendUserMessage(
- const std::string& gtest_msg, const Message& user_msg);
-
-#if GTEST_HAS_EXCEPTIONS
-
-// This exception is thrown by (and only by) a failed Google Test
-// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
-// are enabled). We derive it from std::runtime_error, which is for
-// errors presumably detectable only at run time. Since
-// std::runtime_error inherits from std::exception, many testing
-// frameworks know how to extract and print the message inside it.
-class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
- public:
- explicit GoogleTestFailureException(const TestPartResult& failure);
-};
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-// A helper class for creating scoped traces in user programs.
-class GTEST_API_ ScopedTrace {
- public:
- // The c'tor pushes the given source file location and message onto
- // a trace stack maintained by Google Test.
- ScopedTrace(const char* file, int line, const Message& message);
-
- // The d'tor pops the info pushed by the c'tor.
- //
- // Note that the d'tor is not virtual in order to be efficient.
- // Don't inherit from ScopedTrace!
- ~ScopedTrace();
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
-} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
- // c'tor and d'tor. Therefore it doesn't
- // need to be used otherwise.
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
- bool ignoring_case);
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-GTEST_API_ std::string GetBoolAssertionFailureMessage(
- const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value);
-
-// This template class represents an IEEE floating-point number
-// (either single-precision or double-precision, depending on the
-// template parameters).
-//
-// The purpose of this class is to do more sophisticated number
-// comparison. (Due to round-off error, etc, it's very unlikely that
-// two floating-points will be equal exactly. Hence a naive
-// comparison by the == operation often doesn't work.)
-//
-// Format of IEEE floating-point:
-//
-// The most-significant bit being the leftmost, an IEEE
-// floating-point looks like
-//
-// sign_bit exponent_bits fraction_bits
-//
-// Here, sign_bit is a single bit that designates the sign of the
-// number.
-//
-// For float, there are 8 exponent bits and 23 fraction bits.
-//
-// For double, there are 11 exponent bits and 52 fraction bits.
-//
-// More details can be found at
-// http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-template <typename RawType>
-class FloatingPoint {
- public:
- // Defines the unsigned integer type that has the same size as the
- // floating point number.
- typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
-
- // Constants.
-
- // # of bits in a number.
- static const size_t kBitCount = 8*sizeof(RawType);
-
- // # of fraction bits in a number.
- static const size_t kFractionBitCount =
- std::numeric_limits<RawType>::digits - 1;
-
- // # of exponent bits in a number.
- static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
-
- // The mask for the sign bit.
- static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
-
- // The mask for the fraction bits.
- static const Bits kFractionBitMask =
- ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
-
- // The mask for the exponent bits.
- static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
-
- // How many ULP's (Units in the Last Place) we want to tolerate when
- // comparing two numbers. The larger the value, the more error we
- // allow. A 0 value means that two numbers must be exactly the same
- // to be considered equal.
- //
- // The maximum error of a single floating-point operation is 0.5
- // units in the last place. On Intel CPU's, all floating-point
- // calculations are done with 80-bit precision, while double has 64
- // bits. Therefore, 4 should be enough for ordinary use.
- //
- // See the following article for more details on ULP:
- // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
- static const size_t kMaxUlps = 4;
-
- // Constructs a FloatingPoint from a raw floating-point number.
- //
- // On an Intel CPU, passing a non-normalized NAN (Not a Number)
- // around may change its bits, although the new value is guaranteed
- // to be also a NAN. Therefore, don't expect this constructor to
- // preserve the bits in x when x is a NAN.
- explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
-
- // Static methods
-
- // Reinterprets a bit pattern as a floating-point number.
- //
- // This function is needed to test the AlmostEquals() method.
- static RawType ReinterpretBits(const Bits bits) {
- FloatingPoint fp(0);
- fp.u_.bits_ = bits;
- return fp.u_.value_;
- }
-
- // Returns the floating-point number that represent positive infinity.
- static RawType Infinity() {
- return ReinterpretBits(kExponentBitMask);
- }
-
- // Returns the maximum representable finite floating-point number.
- static RawType Max();
-
- // Non-static methods
-
- // Returns the bits that represents this number.
- const Bits &bits() const { return u_.bits_; }
-
- // Returns the exponent bits of this number.
- Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
-
- // Returns the fraction bits of this number.
- Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
-
- // Returns the sign bit of this number.
- Bits sign_bit() const { return kSignBitMask & u_.bits_; }
-
- // Returns true iff this is NAN (not a number).
- bool is_nan() const {
- // It's a NAN if the exponent bits are all ones and the fraction
- // bits are not entirely zeros.
- return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
- }
-
- // Returns true iff this number is at most kMaxUlps ULP's away from
- // rhs. In particular, this function:
- //
- // - returns false if either number is (or both are) NAN.
- // - treats really large numbers as almost equal to infinity.
- // - thinks +0.0 and -0.0 are 0 DLP's apart.
- bool AlmostEquals(const FloatingPoint& rhs) const {
- // The IEEE standard says that any comparison operation involving
- // a NAN must return false.
- if (is_nan() || rhs.is_nan()) return false;
-
- return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
- <= kMaxUlps;
- }
-
- private:
- // The data type used to store the actual floating-point number.
- union FloatingPointUnion {
- RawType value_; // The raw floating-point number.
- Bits bits_; // The bits that represent the number.
- };
-
- // Converts an integer from the sign-and-magnitude representation to
- // the biased representation. More precisely, let N be 2 to the
- // power of (kBitCount - 1), an integer x is represented by the
- // unsigned number x + N.
- //
- // For instance,
- //
- // -N + 1 (the most negative number representable using
- // sign-and-magnitude) is represented by 1;
- // 0 is represented by N; and
- // N - 1 (the biggest number representable using
- // sign-and-magnitude) is represented by 2N - 1.
- //
- // Read http://en.wikipedia.org/wiki/Signed_number_representations
- // for more details on signed number representations.
- static Bits SignAndMagnitudeToBiased(const Bits &sam) {
- if (kSignBitMask & sam) {
- // sam represents a negative number.
- return ~sam + 1;
- } else {
- // sam represents a positive number.
- return kSignBitMask | sam;
- }
- }
-
- // Given two numbers in the sign-and-magnitude representation,
- // returns the distance between them as an unsigned number.
- static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
- const Bits &sam2) {
- const Bits biased1 = SignAndMagnitudeToBiased(sam1);
- const Bits biased2 = SignAndMagnitudeToBiased(sam2);
- return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
- }
-
- FloatingPointUnion u_;
-};
-
-// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
-// macro defined by <windows.h>.
-template <>
-inline float FloatingPoint<float>::Max() { return FLT_MAX; }
-template <>
-inline double FloatingPoint<double>::Max() { return DBL_MAX; }
-
-// Typedefs the instances of the FloatingPoint template class that we
-// care to use.
-typedef FloatingPoint<float> Float;
-typedef FloatingPoint<double> Double;
-
-// In order to catch the mistake of putting tests that use different
-// test fixture classes in the same test case, we need to assign
-// unique IDs to fixture classes and compare them. The TypeId type is
-// used to hold such IDs. The user should treat TypeId as an opaque
-// type: the only operation allowed on TypeId values is to compare
-// them for equality using the == operator.
-typedef const void* TypeId;
-
-template <typename T>
-class TypeIdHelper {
- public:
- // dummy_ must not have a const type. Otherwise an overly eager
- // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
- // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
- static bool dummy_;
-};
-
-template <typename T>
-bool TypeIdHelper<T>::dummy_ = false;
-
-// GetTypeId<T>() returns the ID of type T. Different values will be
-// returned for different types. Calling the function twice with the
-// same type argument is guaranteed to return the same ID.
-template <typename T>
-TypeId GetTypeId() {
- // The compiler is required to allocate a different
- // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
- // the template. Therefore, the address of dummy_ is guaranteed to
- // be unique.
- return &(TypeIdHelper<T>::dummy_);
-}
-
-// Returns the type ID of ::testing::Test. Always call this instead
-// of GetTypeId< ::testing::Test>() to get the type ID of
-// ::testing::Test, as the latter may give the wrong result due to a
-// suspected linker bug when compiling Google Test as a Mac OS X
-// framework.
-GTEST_API_ TypeId GetTestTypeId();
-
-// Defines the abstract factory interface that creates instances
-// of a Test object.
-class TestFactoryBase {
- public:
- virtual ~TestFactoryBase() {}
-
- // Creates a test instance to run. The instance is both created and destroyed
- // within TestInfoImpl::Run()
- virtual Test* CreateTest() = 0;
-
- protected:
- TestFactoryBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
-};
-
-// This class provides implementation of TeastFactoryBase interface.
-// It is used in TEST and TEST_F macros.
-template <class TestClass>
-class TestFactoryImpl : public TestFactoryBase {
- public:
- virtual Test* CreateTest() { return new TestClass; }
-};
-
-#if GTEST_OS_WINDOWS
-
-// Predicate-formatters for implementing the HRESULT checking macros
-// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
-// We pass a long instead of HRESULT to avoid causing an
-// include dependency for the HRESULT type.
-GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
- long hr); // NOLINT
-GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
- long hr); // NOLINT
-
-#endif // GTEST_OS_WINDOWS
-
-// Types of SetUpTestCase() and TearDownTestCase() functions.
-typedef void (*SetUpTestCaseFunc)();
-typedef void (*TearDownTestCaseFunc)();
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// name: name of the test
-// type_param the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
-// value_param text representation of the test's value parameter,
-// or NULL if this is not a type-parameterized test.
-// fixture_class_id: ID of the test fixture class
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-// factory: pointer to the factory that creates a test object.
-// The newly created TestInfo instance will assume
-// ownership of the factory object.
-GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- TypeId fixture_class_id,
- SetUpTestCaseFunc set_up_tc,
- TearDownTestCaseFunc tear_down_tc,
- TestFactoryBase* factory);
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false. None of pstr, *pstr, and prefix can be NULL.
-GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// State of the definition of a type-parameterized test case.
-class GTEST_API_ TypedTestCasePState {
- public:
- TypedTestCasePState() : registered_(false) {}
-
- // Adds the given test name to defined_test_names_ and return true
- // if the test case hasn't been registered; otherwise aborts the
- // program.
- bool AddTestName(const char* file, int line, const char* case_name,
- const char* test_name) {
- if (registered_) {
- fprintf(stderr, "%s Test %s must be defined before "
- "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
- FormatFileLocation(file, line).c_str(), test_name, case_name);
- fflush(stderr);
- posix::Abort();
- }
- defined_test_names_.insert(test_name);
- return true;
- }
-
- // Verifies that registered_tests match the test names in
- // defined_test_names_; returns registered_tests if successful, or
- // aborts the program otherwise.
- const char* VerifyRegisteredTestNames(
- const char* file, int line, const char* registered_tests);
-
- private:
- bool registered_;
- ::std::set<const char*> defined_test_names_;
-};
-
-// Skips to the first non-space char after the first comma in 'str';
-// returns NULL if no comma is found in 'str'.
-inline const char* SkipComma(const char* str) {
- const char* comma = strchr(str, ',');
- if (comma == NULL) {
- return NULL;
- }
- while (IsSpace(*(++comma))) {}
- return comma;
-}
-
-// Returns the prefix of 'str' before the first comma in it; returns
-// the entire string if it contains no comma.
-inline std::string GetPrefixUntilComma(const char* str) {
- const char* comma = strchr(str, ',');
- return comma == NULL ? str : std::string(str, comma);
-}
-
-// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
-// registers a list of type-parameterized tests with Google Test. The
-// return value is insignificant - we just need to return something
-// such that we can call this function in a namespace scope.
-//
-// Implementation note: The GTEST_TEMPLATE_ macro declares a template
-// template parameter. It's defined in gtest-type-util.h.
-template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
-class TypeParameterizedTest {
- public:
- // 'index' is the index of the test in the type list 'Types'
- // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
- // Types). Valid values for 'index' are [0, N - 1] where N is the
- // length of Types.
- static bool Register(const char* prefix, const char* case_name,
- const char* test_names, int index) {
- typedef typename Types::Head Type;
- typedef Fixture<Type> FixtureClass;
- typedef typename GTEST_BIND_(TestSel, Type) TestClass;
-
- // First, registers the first type-parameterized test in the type
- // list.
- MakeAndRegisterTestInfo(
- (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
- + StreamableToString(index)).c_str(),
- GetPrefixUntilComma(test_names).c_str(),
- GetTypeName<Type>().c_str(),
- NULL, // No value parameter.
- GetTypeId<FixtureClass>(),
- TestClass::SetUpTestCase,
- TestClass::TearDownTestCase,
- new TestFactoryImpl<TestClass>);
-
- // Next, recurses (at compile time) with the tail of the type list.
- return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
- ::Register(prefix, case_name, test_names, index + 1);
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, class TestSel>
-class TypeParameterizedTest<Fixture, TestSel, Types0> {
- public:
- static bool Register(const char* /*prefix*/, const char* /*case_name*/,
- const char* /*test_names*/, int /*index*/) {
- return true;
- }
-};
-
-// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
-// registers *all combinations* of 'Tests' and 'Types' with Google
-// Test. The return value is insignificant - we just need to return
-// something such that we can call this function in a namespace scope.
-template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
-class TypeParameterizedTestCase {
- public:
- static bool Register(const char* prefix, const char* case_name,
- const char* test_names) {
- typedef typename Tests::Head Head;
-
- // First, register the first test in 'Test' for each type in 'Types'.
- TypeParameterizedTest<Fixture, Head, Types>::Register(
- prefix, case_name, test_names, 0);
-
- // Next, recurses (at compile time) with the tail of the test list.
- return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
- ::Register(prefix, case_name, SkipComma(test_names));
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, typename Types>
-class TypeParameterizedTestCase<Fixture, Templates0, Types> {
- public:
- static bool Register(const char* /*prefix*/, const char* /*case_name*/,
- const char* /*test_names*/) {
- return true;
- }
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
- UnitTest* unit_test, int skip_count);
-
-// Helpers for suppressing warnings on unreachable code or constant
-// condition.
-
-// Always returns true.
-GTEST_API_ bool AlwaysTrue();
-
-// Always returns false.
-inline bool AlwaysFalse() { return !AlwaysTrue(); }
-
-// Helper for suppressing false warning from Clang on a const char*
-// variable declared in a conditional expression always being NULL in
-// the else branch.
-struct GTEST_API_ ConstCharPtr {
- ConstCharPtr(const char* str) : value(str) {}
- operator bool() const { return true; }
- const char* value;
-};
-
-// A simple Linear Congruential Generator for generating random
-// numbers with a uniform distribution. Unlike rand() and srand(), it
-// doesn't use global state (and therefore can't interfere with user
-// code). Unlike rand_r(), it's portable. An LCG isn't very random,
-// but it's good enough for our purposes.
-class GTEST_API_ Random {
- public:
- static const UInt32 kMaxRange = 1u << 31;
-
- explicit Random(UInt32 seed) : state_(seed) {}
-
- void Reseed(UInt32 seed) { state_ = seed; }
-
- // Generates a random number from [0, range). Crashes if 'range' is
- // 0 or greater than kMaxRange.
- UInt32 Generate(UInt32 range);
-
- private:
- UInt32 state_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
-};
-
-// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
-// compiler error iff T1 and T2 are different types.
-template <typename T1, typename T2>
-struct CompileAssertTypesEqual;
-
-template <typename T>
-struct CompileAssertTypesEqual<T, T> {
-};
-
-// Removes the reference from a type if it is a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::remove_reference, which is not widely available yet.
-template <typename T>
-struct RemoveReference { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveReference<T&> { typedef T type; }; // NOLINT
-
-// A handy wrapper around RemoveReference that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_REFERENCE_(T) \
- typename ::testing::internal::RemoveReference<T>::type
-
-// Removes const from a type if it is a const type, otherwise leaves
-// it unchanged. This is the same as tr1::remove_const, which is not
-// widely available yet.
-template <typename T>
-struct RemoveConst { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveConst<const T> { typedef T type; }; // NOLINT
-
-// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
-// definition to fail to remove the const in 'const int[3]' and 'const
-// char[3][4]'. The following specialization works around the bug.
-template <typename T, size_t N>
-struct RemoveConst<const T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-
-#if defined(_MSC_VER) && _MSC_VER < 1400
-// This is the only specialization that allows VC++ 7.1 to remove const in
-// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC
-// and thus needs to be conditionally compiled.
-template <typename T, size_t N>
-struct RemoveConst<T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-#endif
-
-// A handy wrapper around RemoveConst that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_CONST_(T) \
- typename ::testing::internal::RemoveConst<T>::type
-
-// Turns const U&, U&, const U, and U all into U.
-#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
- GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
-
-// Adds reference to a type if it is not a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::add_reference, which is not widely available yet.
-template <typename T>
-struct AddReference { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddReference<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper around AddReference that works when the argument T
-// depends on template parameters.
-#define GTEST_ADD_REFERENCE_(T) \
- typename ::testing::internal::AddReference<T>::type
-
-// Adds a reference to const on top of T as necessary. For example,
-// it transforms
-//
-// char ==> const char&
-// const char ==> const char&
-// char& ==> const char&
-// const char& ==> const char&
-//
-// The argument T must depend on some template parameters.
-#define GTEST_REFERENCE_TO_CONST_(T) \
- GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
-
-// ImplicitlyConvertible<From, To>::value is a compile-time bool
-// constant that's true iff type From can be implicitly converted to
-// type To.
-template <typename From, typename To>
-class ImplicitlyConvertible {
- private:
- // We need the following helper functions only for their types.
- // They have no implementations.
-
- // MakeFrom() is an expression whose type is From. We cannot simply
- // use From(), as the type From may not have a public default
- // constructor.
- static From MakeFrom();
-
- // These two functions are overloaded. Given an expression
- // Helper(x), the compiler will pick the first version if x can be
- // implicitly converted to type To; otherwise it will pick the
- // second version.
- //
- // The first version returns a value of size 1, and the second
- // version returns a value of size 2. Therefore, by checking the
- // size of Helper(x), which can be done at compile time, we can tell
- // which version of Helper() is used, and hence whether x can be
- // implicitly converted to type To.
- static char Helper(To);
- static char (&Helper(...))[2]; // NOLINT
-
- // We have to put the 'public' section after the 'private' section,
- // or MSVC refuses to compile the code.
- public:
- // MSVC warns about implicitly converting from double to int for
- // possible loss of data, so we need to temporarily disable the
- // warning.
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4244) // Temporarily disables warning 4244.
-
- static const bool value =
- sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-# pragma warning(pop) // Restores the warning state.
-#elif defined(__BORLANDC__)
- // C++Builder cannot use member overload resolution during template
- // instantiation. The simplest workaround is to use its C++0x type traits
- // functions (C++Builder 2009 and above only).
- static const bool value = __is_convertible(From, To);
-#else
- static const bool value =
- sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
-#endif // _MSV_VER
-};
-template <typename From, typename To>
-const bool ImplicitlyConvertible<From, To>::value;
-
-// IsAProtocolMessage<T>::value is a compile-time bool constant that's
-// true iff T is type ProtocolMessage, proto2::Message, or a subclass
-// of those.
-template <typename T>
-struct IsAProtocolMessage
- : public bool_constant<
- ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
- ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
-};
-
-// When the compiler sees expression IsContainerTest<C>(0), if C is an
-// STL-style container class, the first overload of IsContainerTest
-// will be viable (since both C::iterator* and C::const_iterator* are
-// valid types and NULL can be implicitly converted to them). It will
-// be picked over the second overload as 'int' is a perfect match for
-// the type of argument 0. If C::iterator or C::const_iterator is not
-// a valid type, the first overload is not viable, and the second
-// overload will be picked. Therefore, we can determine whether C is
-// a container class by checking the type of IsContainerTest<C>(0).
-// The value of the expression is insignificant.
-//
-// Note that we look for both C::iterator and C::const_iterator. The
-// reason is that C++ injects the name of a class as a member of the
-// class itself (e.g. you can refer to class iterator as either
-// 'iterator' or 'iterator::iterator'). If we look for C::iterator
-// only, for example, we would mistakenly think that a class named
-// iterator is an STL container.
-//
-// Also note that the simpler approach of overloading
-// IsContainerTest(typename C::const_iterator*) and
-// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
-typedef int IsContainer;
-template <class C>
-IsContainer IsContainerTest(int /* dummy */,
- typename C::iterator* /* it */ = NULL,
- typename C::const_iterator* /* const_it */ = NULL) {
- return 0;
-}
-
-typedef char IsNotContainer;
-template <class C>
-IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
-
-// EnableIf<condition>::type is void when 'Cond' is true, and
-// undefined when 'Cond' is false. To use SFINAE to make a function
-// overload only apply when a particular expression is true, add
-// "typename EnableIf<expression>::type* = 0" as the last parameter.
-template<bool> struct EnableIf;
-template<> struct EnableIf<true> { typedef void type; }; // NOLINT
-
-// Utilities for native arrays.
-
-// ArrayEq() compares two k-dimensional native arrays using the
-// elements' operator==, where k can be any integer >= 0. When k is
-// 0, ArrayEq() degenerates into comparing a single pair of values.
-
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
- return internal::ArrayEq(lhs, N, rhs);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous ArrayEq() function, arrays with different sizes would
-// lead to different copies of the template code.
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
- for (size_t i = 0; i != size; i++) {
- if (!internal::ArrayEq(lhs[i], rhs[i]))
- return false;
- }
- return true;
-}
-
-// Finds the first element in the iterator range [begin, end) that
-// equals elem. Element may be a native array type itself.
-template <typename Iter, typename Element>
-Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
- for (Iter it = begin; it != end; ++it) {
- if (internal::ArrayEq(*it, elem))
- return it;
- }
- return end;
-}
-
-// CopyArray() copies a k-dimensional native array using the elements'
-// operator=, where k can be any integer >= 0. When k is 0,
-// CopyArray() degenerates into copying a single value.
-
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline void CopyArray(const T& from, U* to) { *to = from; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline void CopyArray(const T(&from)[N], U(*to)[N]) {
- internal::CopyArray(from, N, *to);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous CopyArray() function, arrays with different sizes
-// would lead to different copies of the template code.
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to) {
- for (size_t i = 0; i != size; i++) {
- internal::CopyArray(from[i], to + i);
- }
-}
-
-// The relation between an NativeArray object (see below) and the
-// native array it represents.
-enum RelationToSource {
- kReference, // The NativeArray references the native array.
- kCopy // The NativeArray makes a copy of the native array and
- // owns the copy.
-};
-
-// Adapts a native array to a read-only STL-style container. Instead
-// of the complete STL container concept, this adaptor only implements
-// members useful for Google Mock's container matchers. New members
-// should be added as needed. To simplify the implementation, we only
-// support Element being a raw type (i.e. having no top-level const or
-// reference modifier). It's the client's responsibility to satisfy
-// this requirement. Element can be an array type itself (hence
-// multi-dimensional arrays are supported).
-template <typename Element>
-class NativeArray {
- public:
- // STL-style container typedefs.
- typedef Element value_type;
- typedef Element* iterator;
- typedef const Element* const_iterator;
-
- // Constructs from a native array.
- NativeArray(const Element* array, size_t count, RelationToSource relation) {
- Init(array, count, relation);
- }
-
- // Copy constructor.
- NativeArray(const NativeArray& rhs) {
- Init(rhs.array_, rhs.size_, rhs.relation_to_source_);
- }
-
- ~NativeArray() {
- // Ensures that the user doesn't instantiate NativeArray with a
- // const or reference type.
- static_cast<void>(StaticAssertTypeEqHelper<Element,
- GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());
- if (relation_to_source_ == kCopy)
- delete[] array_;
- }
-
- // STL-style container methods.
- size_t size() const { return size_; }
- const_iterator begin() const { return array_; }
- const_iterator end() const { return array_ + size_; }
- bool operator==(const NativeArray& rhs) const {
- return size() == rhs.size() &&
- ArrayEq(begin(), size(), rhs.begin());
- }
-
- private:
- // Initializes this object; makes a copy of the input array if
- // 'relation' is kCopy.
- void Init(const Element* array, size_t a_size, RelationToSource relation) {
- if (relation == kReference) {
- array_ = array;
- } else {
- Element* const copy = new Element[a_size];
- CopyArray(array, a_size, copy);
- array_ = copy;
- }
- size_ = a_size;
- relation_to_source_ = relation;
- }
-
- const Element* array_;
- size_t size_;
- RelationToSource relation_to_source_;
-
- GTEST_DISALLOW_ASSIGN_(NativeArray);
-};
-
-} // namespace internal
-} // namespace testing
-
-#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
- ::testing::internal::AssertHelper(result_type, file, line, message) \
- = ::testing::Message()
-
-#define GTEST_MESSAGE_(message, result_type) \
- GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
-
-#define GTEST_FATAL_FAILURE_(message) \
- return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
-
-#define GTEST_NONFATAL_FAILURE_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
-
-#define GTEST_SUCCESS_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
-
-// Suppresses MSVC warnings 4072 (unreachable code) for the code following
-// statement if it returns or throws (or doesn't return or throw in some
-// situations).
-#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
- if (::testing::internal::AlwaysTrue()) { statement; }
-
-#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::ConstCharPtr gtest_msg = "") { \
- bool gtest_caught_expected = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (expected_exception const&) { \
- gtest_caught_expected = true; \
- } \
- catch (...) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws a different type."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- if (!gtest_caught_expected) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws nothing."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
- fail(gtest_msg.value)
-
-#define GTEST_TEST_NO_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
- fail("Expected: " #statement " doesn't throw an exception.\n" \
- " Actual: it throws.")
-
-#define GTEST_TEST_ANY_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- bool gtest_caught_any = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- gtest_caught_any = true; \
- } \
- if (!gtest_caught_any) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
- fail("Expected: " #statement " throws an exception.\n" \
- " Actual: it doesn't.")
-
-
-// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
-// either a boolean expression or an AssertionResult. text is a textual
-// represenation of expression as it was passed into the EXPECT_TRUE.
-#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar_ = \
- ::testing::AssertionResult(expression)) \
- ; \
- else \
- fail(::testing::internal::GetBoolAssertionFailureMessage(\
- gtest_ar_, text, #actual, #expected).c_str())
-
-#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
- fail("Expected: " #statement " doesn't generate new fatal " \
- "failures in the current thread.\n" \
- " Actual: it does.")
-
-// Expands to the name of the class that implements the given test.
-#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- test_case_name##_##test_name##_Test
-
-// Helper macro for defining tests.
-#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
-class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
- public:\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
- private:\
- virtual void TestBody();\
- static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
-};\
-\
-::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
- ::test_info_ =\
- ::testing::internal::MakeAndRegisterTestInfo(\
- #test_case_name, #test_name, NULL, NULL, \
- (parent_id), \
- parent_class::SetUpTestCase, \
- parent_class::TearDownTestCase, \
- new ::testing::internal::TestFactoryImpl<\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
-void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for death tests. It is
-// #included by gtest.h so a user doesn't need to include this
-// directly.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines internal utilities needed for implementing
-// death tests. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-
-
-#include <stdio.h>
-
-namespace testing {
-namespace internal {
-
-GTEST_DECLARE_string_(internal_run_death_test);
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kDeathTestStyleFlag[] = "death_test_style";
-const char kDeathTestUseFork[] = "death_test_use_fork";
-const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
-
-#if GTEST_HAS_DEATH_TEST
-
-// DeathTest is a class that hides much of the complexity of the
-// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
-// returns a concrete class that depends on the prevailing death test
-// style, as defined by the --gtest_death_test_style and/or
-// --gtest_internal_run_death_test flags.
-
-// In describing the results of death tests, these terms are used with
-// the corresponding definitions:
-//
-// exit status: The integer exit information in the format specified
-// by wait(2)
-// exit code: The integer code passed to exit(3), _exit(2), or
-// returned from main()
-class GTEST_API_ DeathTest {
- public:
- // Create returns false if there was an error determining the
- // appropriate action to take for the current death test; for example,
- // if the gtest_death_test_style flag is set to an invalid value.
- // The LastMessage method will return a more detailed message in that
- // case. Otherwise, the DeathTest pointer pointed to by the "test"
- // argument is set. If the death test should be skipped, the pointer
- // is set to NULL; otherwise, it is set to the address of a new concrete
- // DeathTest object that controls the execution of the current test.
- static bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
- DeathTest();
- virtual ~DeathTest() { }
-
- // A helper class that aborts a death test when it's deleted.
- class ReturnSentinel {
- public:
- explicit ReturnSentinel(DeathTest* test) : test_(test) { }
- ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
- private:
- DeathTest* const test_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
- } GTEST_ATTRIBUTE_UNUSED_;
-
- // An enumeration of possible roles that may be taken when a death
- // test is encountered. EXECUTE means that the death test logic should
- // be executed immediately. OVERSEE means that the program should prepare
- // the appropriate environment for a child process to execute the death
- // test, then wait for it to complete.
- enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
-
- // An enumeration of the three reasons that a test might be aborted.
- enum AbortReason {
- TEST_ENCOUNTERED_RETURN_STATEMENT,
- TEST_THREW_EXCEPTION,
- TEST_DID_NOT_DIE
- };
-
- // Assumes one of the above roles.
- virtual TestRole AssumeRole() = 0;
-
- // Waits for the death test to finish and returns its status.
- virtual int Wait() = 0;
-
- // Returns true if the death test passed; that is, the test process
- // exited during the test, its exit status matches a user-supplied
- // predicate, and its stderr output matches a user-supplied regular
- // expression.
- // The user-supplied predicate may be a macro expression rather
- // than a function pointer or functor, or else Wait and Passed could
- // be combined.
- virtual bool Passed(bool exit_status_ok) = 0;
-
- // Signals that the death test did not die as expected.
- virtual void Abort(AbortReason reason) = 0;
-
- // Returns a human-readable outcome message regarding the outcome of
- // the last death test.
- static const char* LastMessage();
-
- static void set_last_death_test_message(const std::string& message);
-
- private:
- // A string containing a description of the outcome of the last death test.
- static std::string last_death_test_message_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
-};
-
-// Factory interface for death tests. May be mocked out for testing.
-class DeathTestFactory {
- public:
- virtual ~DeathTestFactory() { }
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test) = 0;
-};
-
-// A concrete DeathTestFactory implementation for normal use.
-class DefaultDeathTestFactory : public DeathTestFactory {
- public:
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
-};
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
-
-// Traps C++ exceptions escaping statement and reports them as test
-// failures. Note that trapping SEH exceptions is not implemented here.
-# if GTEST_HAS_EXCEPTIONS
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } catch (const ::std::exception& gtest_exception) { \
- fprintf(\
- stderr, \
- "\n%s: Caught std::exception-derived exception escaping the " \
- "death test statement. Exception message: %s\n", \
- ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
- gtest_exception.what()); \
- fflush(stderr); \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- } catch (...) { \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- }
-
-# else
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-
-# endif
-
-// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
-// ASSERT_EXIT*, and EXPECT_EXIT*.
-# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- const ::testing::internal::RE& gtest_regex = (regex); \
- ::testing::internal::DeathTest* gtest_dt; \
- if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
- __FILE__, __LINE__, &gtest_dt)) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- if (gtest_dt != NULL) { \
- ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
- gtest_dt_ptr(gtest_dt); \
- switch (gtest_dt->AssumeRole()) { \
- case ::testing::internal::DeathTest::OVERSEE_TEST: \
- if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- break; \
- case ::testing::internal::DeathTest::EXECUTE_TEST: { \
- ::testing::internal::DeathTest::ReturnSentinel \
- gtest_sentinel(gtest_dt); \
- GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
- gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
- break; \
- } \
- default: \
- break; \
- } \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
- fail(::testing::internal::DeathTest::LastMessage())
-// The symbol "fail" here expands to something into which a message
-// can be streamed.
-
-// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
-// NDEBUG mode. In this case we need the statements to be executed, the regex is
-// ignored, and the macro must accept a streamed message even though the message
-// is never printed.
-# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } else \
- ::testing::Message()
-
-// A class representing the parsed contents of the
-// --gtest_internal_run_death_test flag, as it existed when
-// RUN_ALL_TESTS was called.
-class InternalRunDeathTestFlag {
- public:
- InternalRunDeathTestFlag(const std::string& a_file,
- int a_line,
- int an_index,
- int a_write_fd)
- : file_(a_file), line_(a_line), index_(an_index),
- write_fd_(a_write_fd) {}
-
- ~InternalRunDeathTestFlag() {
- if (write_fd_ >= 0)
- posix::Close(write_fd_);
- }
-
- const std::string& file() const { return file_; }
- int line() const { return line_; }
- int index() const { return index_; }
- int write_fd() const { return write_fd_; }
-
- private:
- std::string file_;
- int line_;
- int index_;
- int write_fd_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
-};
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
-
-#else // GTEST_HAS_DEATH_TEST
-
-// This macro is used for implementing macros such as
-// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
-// death tests are not supported. Those macros must compile on such systems
-// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
-// systems that support death tests. This allows one to write such a macro
-// on a system that does not support death tests and be sure that it will
-// compile on a death-test supporting system.
-//
-// Parameters:
-// statement - A statement that a macro such as EXPECT_DEATH would test
-// for program termination. This macro has to make sure this
-// statement is compiled but not executed, to ensure that
-// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
-// parameter iff EXPECT_DEATH compiles with it.
-// regex - A regex that a macro such as EXPECT_DEATH would use to test
-// the output of statement. This parameter has to be
-// compiled but not evaluated by this macro, to ensure that
-// this macro only accepts expressions that a macro such as
-// EXPECT_DEATH would accept.
-// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
-// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
-// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
-// compile inside functions where ASSERT_DEATH doesn't
-// compile.
-//
-// The branch that has an always false condition is used to ensure that
-// statement and regex are compiled (and thus syntactically correct) but
-// never executed. The unreachable code macro protects the terminator
-// statement from generating an 'unreachable code' warning in case
-// statement unconditionally returns or throws. The Message constructor at
-// the end allows the syntax of streaming additional messages into the
-// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
-# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_LOG_(WARNING) \
- << "Death tests are not supported on this platform.\n" \
- << "Statement '" #statement "' cannot be verified."; \
- } else if (::testing::internal::AlwaysFalse()) { \
- ::testing::internal::RE::PartialMatch(".*", (regex)); \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- terminator; \
- } else \
- ::testing::Message()
-
-#endif // GTEST_HAS_DEATH_TEST
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-
-namespace testing {
-
-// This flag controls the style of death tests. Valid values are "threadsafe",
-// meaning that the death test child process will re-execute the test binary
-// from the start, running only a single death test, or "fast",
-// meaning that the child process will execute the test logic immediately
-// after forking.
-GTEST_DECLARE_string_(death_test_style);
-
-#if GTEST_HAS_DEATH_TEST
-
-namespace internal {
-
-// Returns a Boolean value indicating whether the caller is currently
-// executing in the context of the death test child process. Tools such as
-// Valgrind heap checkers may need this to modify their behavior in death
-// tests. IMPORTANT: This is an internal utility. Using it may break the
-// implementation of death tests. User code MUST NOT use it.
-GTEST_API_ bool InDeathTestChild();
-
-} // namespace internal
-
-// The following macros are useful for writing death tests.
-
-// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
-// executed:
-//
-// 1. It generates a warning if there is more than one active
-// thread. This is because it's safe to fork() or clone() only
-// when there is a single thread.
-//
-// 2. The parent process clone()s a sub-process and runs the death
-// test in it; the sub-process exits with code 0 at the end of the
-// death test, if it hasn't exited already.
-//
-// 3. The parent process waits for the sub-process to terminate.
-//
-// 4. The parent process checks the exit code and error message of
-// the sub-process.
-//
-// Examples:
-//
-// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
-// for (int i = 0; i < 5; i++) {
-// EXPECT_DEATH(server.ProcessRequest(i),
-// "Invalid request .* in ProcessRequest()")
-// << "Failed to die on request " << i;
-// }
-//
-// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
-//
-// bool KilledBySIGHUP(int exit_code) {
-// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
-// }
-//
-// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
-//
-// On the regular expressions used in death tests:
-//
-// On POSIX-compliant systems (*nix), we use the <regex.h> library,
-// which uses the POSIX extended regex syntax.
-//
-// On other platforms (e.g. Windows), we only support a simple regex
-// syntax implemented as part of Google Test. This limited
-// implementation should be enough most of the time when writing
-// death tests; though it lacks many features you can find in PCRE
-// or POSIX extended regex syntax. For example, we don't support
-// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
-// repetition count ("x{5,7}"), among others.
-//
-// Below is the syntax that we do support. We chose it to be a
-// subset of both PCRE and POSIX extended regex, so it's easy to
-// learn wherever you come from. In the following: 'A' denotes a
-// literal character, period (.), or a single \\ escape sequence;
-// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
-// natural numbers.
-//
-// c matches any literal character c
-// \\d matches any decimal digit
-// \\D matches any character that's not a decimal digit
-// \\f matches \f
-// \\n matches \n
-// \\r matches \r
-// \\s matches any ASCII whitespace, including \n
-// \\S matches any character that's not a whitespace
-// \\t matches \t
-// \\v matches \v
-// \\w matches any letter, _, or decimal digit
-// \\W matches any character that \\w doesn't match
-// \\c matches any literal character c, which must be a punctuation
-// . matches any single character except \n
-// A? matches 0 or 1 occurrences of A
-// A* matches 0 or many occurrences of A
-// A+ matches 1 or many occurrences of A
-// ^ matches the beginning of a string (not that of each line)
-// $ matches the end of a string (not that of each line)
-// xy matches x followed by y
-//
-// If you accidentally use PCRE or POSIX extended regex features
-// not implemented by us, you will get a run-time failure. In that
-// case, please try to rewrite your regular expression within the
-// above syntax.
-//
-// This implementation is *not* meant to be as highly tuned or robust
-// as a compiled regex library, but should perform well enough for a
-// death test, which already incurs significant overhead by launching
-// a child process.
-//
-// Known caveats:
-//
-// A "threadsafe" style death test obtains the path to the test
-// program from argv[0] and re-executes it in the sub-process. For
-// simplicity, the current implementation doesn't search the PATH
-// when launching the sub-process. This means that the user must
-// invoke the test program via a path that contains at least one
-// path separator (e.g. path/to/foo_test and
-// /absolute/path/to/bar_test are fine, but foo_test is not). This
-// is rarely a problem as people usually don't put the test binary
-// directory in PATH.
-//
-// TODO(wan@google.com): make thread-safe death tests search the PATH.
-
-// Asserts that a given statement causes the program to exit, with an
-// integer exit status that satisfies predicate, and emitting error output
-// that matches regex.
-# define ASSERT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
-
-// Like ASSERT_EXIT, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
-
-// Asserts that a given statement causes the program to exit, either by
-// explicitly exiting with a nonzero exit code or being killed by a
-// signal, and emitting error output that matches regex.
-# define ASSERT_DEATH(statement, regex) \
- ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Like ASSERT_DEATH, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_DEATH(statement, regex) \
- EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
-
-// Tests that an exit code describes a normal exit with a given exit code.
-class GTEST_API_ ExitedWithCode {
- public:
- explicit ExitedWithCode(int exit_code);
- bool operator()(int exit_status) const;
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ExitedWithCode& other);
-
- const int exit_code_;
-};
-
-# if !GTEST_OS_WINDOWS
-// Tests that an exit code describes an exit due to termination by a
-// given signal.
-class GTEST_API_ KilledBySignal {
- public:
- explicit KilledBySignal(int signum);
- bool operator()(int exit_status) const;
- private:
- const int signum_;
-};
-# endif // !GTEST_OS_WINDOWS
-
-// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
-// The death testing framework causes this to have interesting semantics,
-// since the sideeffects of the call are only visible in opt mode, and not
-// in debug mode.
-//
-// In practice, this can be used to test functions that utilize the
-// LOG(DFATAL) macro using the following style:
-//
-// int DieInDebugOr12(int* sideeffect) {
-// if (sideeffect) {
-// *sideeffect = 12;
-// }
-// LOG(DFATAL) << "death";
-// return 12;
-// }
-//
-// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
-// int sideeffect = 0;
-// // Only asserts in dbg.
-// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
-//
-// #ifdef NDEBUG
-// // opt-mode has sideeffect visible.
-// EXPECT_EQ(12, sideeffect);
-// #else
-// // dbg-mode no visible sideeffect.
-// EXPECT_EQ(0, sideeffect);
-// #endif
-// }
-//
-// This will assert that DieInDebugReturn12InOpt() crashes in debug
-// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
-// appropriate fallback value (12 in this case) in opt mode. If you
-// need to test that a function has appropriate side-effects in opt
-// mode, include assertions against the side-effects. A general
-// pattern for this is:
-//
-// EXPECT_DEBUG_DEATH({
-// // Side-effects here will have an effect after this statement in
-// // opt mode, but none in debug mode.
-// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
-// }, "death");
-//
-# ifdef NDEBUG
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# else
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- EXPECT_DEATH(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- ASSERT_DEATH(statement, regex)
-
-# endif // NDEBUG for EXPECT_DEBUG_DEATH
-#endif // GTEST_HAS_DEATH_TEST
-
-// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
-// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
-// death tests are supported; otherwise they just issue a warning. This is
-// useful when you are combining death test assertions with normal test
-// assertions in one test.
-#if GTEST_HAS_DEATH_TEST
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- EXPECT_DEATH(statement, regex)
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- ASSERT_DEATH(statement, regex)
-#else
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
-#endif
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-// This file was GENERATED by command:
-// pump.py gtest-param-test.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It is usually derived from testing::TestWithParam<T> (see below for
-// another inheritance scheme that's sometimes useful in more complicated
-// class hierarchies), where the type of your parameter values.
-// TestWithParam<T> is itself derived from testing::Test. T can be any
-// copyable type. If it's a raw pointer, you are responsible for managing the
-// lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
- // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
- // Inside a test, access the test parameter with the GetParam() method
- // of the TestWithParam<T> class:
- EXPECT_TRUE(foo.Blah(GetParam()));
- ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
- ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a summary of them, which
-// are all in the testing namespace:
-//
-//
-// Range(begin, end [, step]) - Yields values {begin, begin+step,
-// begin+step+step, ...}. The values do not
-// include end. step defaults to 1.
-// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
-// ValuesIn(container) - Yields values from a C-style array, an STL
-// ValuesIn(begin,end) container, or an iterator range [begin, end).
-// Bool() - Yields sequence {false, true}.
-// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
-// for the math savvy) of the values generated
-// by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
- FooTest,
- Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-// * InstantiationName/FooTest.DoesBlah/1 for "miny"
-// * InstantiationName/FooTest.DoesBlah/2 for "moe"
-// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions (including parameters to the
-// generators) are evaluated in InitGoogleTest(), after main() has started.
-// This allows the user on one hand, to adjust generator parameters in order
-// to dynamically determine a set of tests to run and on the other hand,
-// give the user a chance to inspect the generated tests with Google Test
-// reflection API before RUN_ALL_TESTS() is executed.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-//
-//
-// A parameterized test fixture must be derived from testing::Test and from
-// testing::WithParamInterface<T>, where T is the type of the parameter
-// values. Inheriting from TestWithParam<T> satisfies that requirement because
-// TestWithParam<T> inherits from both Test and WithParamInterface. In more
-// complicated hierarchies, however, it is occasionally useful to inherit
-// separately from Test and WithParamInterface. For example:
-
-class BaseTest : public ::testing::Test {
- // You can inherit all the usual members for a non-parameterized test
- // fixture here.
-};
-
-class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
- // The usual test fixture members go here too.
-};
-
-TEST_F(BaseTest, HasFoo) {
- // This is an ordinary non-parameterized test.
-}
-
-TEST_P(DerivedTest, DoesBlah) {
- // GetParam works just the same here as if you inherit from TestWithParam.
- EXPECT_TRUE(foo.Blah(GetParam()));
-}
-
-#endif // 0
-
-
-#if !GTEST_OS_SYMBIAN
-# include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-
-#include <iterator>
-#include <utility>
-#include <vector>
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-// Copyright 2003 Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: Dan Egnor (egnor@google.com)
-//
-// A "smart" pointer type with reference tracking. Every pointer to a
-// particular object is kept on a circular linked list. When the last pointer
-// to an object is destroyed or reassigned, the object is deleted.
-//
-// Used properly, this deletes the object when the last reference goes away.
-// There are several caveats:
-// - Like all reference counting schemes, cycles lead to leaks.
-// - Each smart pointer is actually two pointers (8 bytes instead of 4).
-// - Every time a pointer is assigned, the entire list of pointers to that
-// object is traversed. This class is therefore NOT SUITABLE when there
-// will often be more than two or three pointers to a particular object.
-// - References are only tracked as long as linked_ptr<> objects are copied.
-// If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
-// will happen (double deletion).
-//
-// A good use of this class is storing object references in STL containers.
-// You can safely put linked_ptr<> in a vector<>.
-// Other uses may not be as good.
-//
-// Note: If you use an incomplete type with linked_ptr<>, the class
-// *containing* linked_ptr<> must have a constructor and destructor (even
-// if they do nothing!).
-//
-// Bill Gibbons suggested we use something like this.
-//
-// Thread Safety:
-// Unlike other linked_ptr implementations, in this implementation
-// a linked_ptr object is thread-safe in the sense that:
-// - it's safe to copy linked_ptr objects concurrently,
-// - it's safe to copy *from* a linked_ptr and read its underlying
-// raw pointer (e.g. via get()) concurrently, and
-// - it's safe to write to two linked_ptrs that point to the same
-// shared object concurrently.
-// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
-// confusion with normal linked_ptr.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-
-#include <stdlib.h>
-#include <assert.h>
-
-
-namespace testing {
-namespace internal {
-
-// Protects copying of all linked_ptr objects.
-GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
-
-// This is used internally by all instances of linked_ptr<>. It needs to be
-// a non-template class because different types of linked_ptr<> can refer to
-// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
-// So, it needs to be possible for different types of linked_ptr to participate
-// in the same circular linked list, so we need a single class type here.
-//
-// DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr<T>.
-class linked_ptr_internal {
- public:
- // Create a new circle that includes only this instance.
- void join_new() {
- next_ = this;
- }
-
- // Many linked_ptr operations may change p.link_ for some linked_ptr
- // variable p in the same circle as this object. Therefore we need
- // to prevent two such operations from occurring concurrently.
- //
- // Note that different types of linked_ptr objects can coexist in a
- // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
- // linked_ptr<Derived2>). Therefore we must use a single mutex to
- // protect all linked_ptr objects. This can create serious
- // contention in production code, but is acceptable in a testing
- // framework.
-
- // Join an existing circle.
- void join(linked_ptr_internal const* ptr)
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- linked_ptr_internal const* p = ptr;
- while (p->next_ != ptr) p = p->next_;
- p->next_ = this;
- next_ = ptr;
- }
-
- // Leave whatever circle we're part of. Returns true if we were the
- // last member of the circle. Once this is done, you can join() another.
- bool depart()
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- if (next_ == this) return true;
- linked_ptr_internal const* p = next_;
- while (p->next_ != this) p = p->next_;
- p->next_ = next_;
- return false;
- }
-
- private:
- mutable linked_ptr_internal const* next_;
-};
-
-template <typename T>
-class linked_ptr {
- public:
- typedef T element_type;
-
- // Take over ownership of a raw pointer. This should happen as soon as
- // possible after the object is created.
- explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
- ~linked_ptr() { depart(); }
-
- // Copy an existing linked_ptr<>, adding ourselves to the list of references.
- template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
- linked_ptr(linked_ptr const& ptr) { // NOLINT
- assert(&ptr != this);
- copy(&ptr);
- }
-
- // Assignment releases the old value and acquires the new.
- template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
- depart();
- copy(&ptr);
- return *this;
- }
-
- linked_ptr& operator=(linked_ptr const& ptr) {
- if (&ptr != this) {
- depart();
- copy(&ptr);
- }
- return *this;
- }
-
- // Smart pointer members.
- void reset(T* ptr = NULL) {
- depart();
- capture(ptr);
- }
- T* get() const { return value_; }
- T* operator->() const { return value_; }
- T& operator*() const { return *value_; }
-
- bool operator==(T* p) const { return value_ == p; }
- bool operator!=(T* p) const { return value_ != p; }
- template <typename U>
- bool operator==(linked_ptr<U> const& ptr) const {
- return value_ == ptr.get();
- }
- template <typename U>
- bool operator!=(linked_ptr<U> const& ptr) const {
- return value_ != ptr.get();
- }
-
- private:
- template <typename U>
- friend class linked_ptr;
-
- T* value_;
- linked_ptr_internal link_;
-
- void depart() {
- if (link_.depart()) delete value_;
- }
-
- void capture(T* ptr) {
- value_ = ptr;
- link_.join_new();
- }
-
- template <typename U> void copy(linked_ptr<U> const* ptr) {
- value_ = ptr->get();
- if (value_)
- link_.join(&ptr->link_);
- else
- link_.join_new();
- }
-};
-
-template<typename T> inline
-bool operator==(T* ptr, const linked_ptr<T>& x) {
- return ptr == x.get();
-}
-
-template<typename T> inline
-bool operator!=(T* ptr, const linked_ptr<T>& x) {
- return ptr != x.get();
-}
-
-// A function to convert T* into linked_ptr<T>
-// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
-// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
-template <typename T>
-linked_ptr<T> make_linked_ptr(T* ptr) {
- return linked_ptr<T>(ptr);
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Test - The Google C++ Testing Framework
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// A user can teach this function how to print a class type T by
-// defining either operator<<() or PrintTo() in the namespace that
-// defines T. More specifically, the FIRST defined function in the
-// following list will be used (assuming T is defined in namespace
-// foo):
-//
-// 1. foo::PrintTo(const T&, ostream*)
-// 2. operator<<(ostream&, const T&) defined in either foo or the
-// global namespace.
-//
-// If none of the above is defined, it will print the debug string of
-// the value if it is a protocol buffer, or print the raw bytes in the
-// value otherwise.
-//
-// To aid debugging: when T is a reference type, the address of the
-// value is also printed; when T is a (const) char pointer, both the
-// pointer value and the NUL-terminated string it points to are
-// printed.
-//
-// We also provide some convenient wrappers:
-//
-// // Prints a value to a string. For a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// std::string ::testing::PrintToString(const T& value);
-//
-// // Prints a value tersely: for a reference type, the referenced
-// // value (but not the address) is printed; for a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
-//
-// // Prints value using the type inferred by the compiler. The difference
-// // from UniversalTersePrint() is that this function prints both the
-// // pointer and the NUL-terminated string for a (const or not) char pointer.
-// void ::testing::internal::UniversalPrint(const T& value, ostream*);
-//
-// // Prints the fields of a tuple tersely to a string vector, one
-// // element for each field. Tuple support must be enabled in
-// // gtest-port.h.
-// std::vector<string> UniversalTersePrintTupleFieldsToStrings(
-// const Tuple& value);
-//
-// Known limitation:
-//
-// The print primitives print the elements of an STL-style container
-// using the compiler-inferred type of *iter where iter is a
-// const_iterator of the container. When const_iterator is an input
-// iterator but not a forward iterator, this inferred type may not
-// match value_type, and the print output may be incorrect. In
-// practice, this is rarely a problem as for most containers
-// const_iterator is a forward iterator. We'll fix this if there's an
-// actual need for it. Note that this fix cannot rely on value_type
-// being defined as many user-defined container types don't have
-// value_type.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-
-#include <ostream> // NOLINT
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-
-namespace testing {
-
-// Definitions in the 'internal' and 'internal2' name spaces are
-// subject to change without notice. DO NOT USE THEM IN USER CODE!
-namespace internal2 {
-
-// Prints the given number of bytes in the given object to the given
-// ostream.
-GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
- size_t count,
- ::std::ostream* os);
-
-// For selecting which printer to use when a given type has neither <<
-// nor PrintTo().
-enum TypeKind {
- kProtobuf, // a protobuf type
- kConvertibleToInteger, // a type implicitly convertible to BiggestInt
- // (e.g. a named or unnamed enum type)
- kOtherType // anything else
-};
-
-// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
-// by the universal printer to print a value of type T when neither
-// operator<< nor PrintTo() is defined for T, where kTypeKind is the
-// "kind" of T as defined by enum TypeKind.
-template <typename T, TypeKind kTypeKind>
-class TypeWithoutFormatter {
- public:
- // This default version is called when kTypeKind is kOtherType.
- static void PrintValue(const T& value, ::std::ostream* os) {
- PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
- sizeof(value), os);
- }
-};
-
-// We print a protobuf using its ShortDebugString() when the string
-// doesn't exceed this many characters; otherwise we print it using
-// DebugString() for better readability.
-const size_t kProtobufOneLinerMaxLength = 50;
-
-template <typename T>
-class TypeWithoutFormatter<T, kProtobuf> {
- public:
- static void PrintValue(const T& value, ::std::ostream* os) {
- const ::testing::internal::string short_str = value.ShortDebugString();
- const ::testing::internal::string pretty_str =
- short_str.length() <= kProtobufOneLinerMaxLength ?
- short_str : ("\n" + value.DebugString());
- *os << ("<" + pretty_str + ">");
- }
-};
-
-template <typename T>
-class TypeWithoutFormatter<T, kConvertibleToInteger> {
- public:
- // Since T has no << operator or PrintTo() but can be implicitly
- // converted to BiggestInt, we print it as a BiggestInt.
- //
- // Most likely T is an enum type (either named or unnamed), in which
- // case printing it as an integer is the desired behavior. In case
- // T is not an enum, printing it as an integer is the best we can do
- // given that it has no user-defined printer.
- static void PrintValue(const T& value, ::std::ostream* os) {
- const internal::BiggestInt kBigInt = value;
- *os << kBigInt;
- }
-};
-
-// Prints the given value to the given ostream. If the value is a
-// protocol message, its debug string is printed; if it's an enum or
-// of a type implicitly convertible to BiggestInt, it's printed as an
-// integer; otherwise the bytes in the value are printed. This is
-// what UniversalPrinter<T>::Print() does when it knows nothing about
-// type T and T has neither << operator nor PrintTo().
-//
-// A user can override this behavior for a class type Foo by defining
-// a << operator in the namespace where Foo is defined.
-//
-// We put this operator in namespace 'internal2' instead of 'internal'
-// to simplify the implementation, as much code in 'internal' needs to
-// use << in STL, which would conflict with our own << were it defined
-// in 'internal'.
-//
-// Note that this operator<< takes a generic std::basic_ostream<Char,
-// CharTraits> type instead of the more restricted std::ostream. If
-// we define it to take an std::ostream instead, we'll get an
-// "ambiguous overloads" compiler error when trying to print a type
-// Foo that supports streaming to std::basic_ostream<Char,
-// CharTraits>, as the compiler cannot tell whether
-// operator<<(std::ostream&, const T&) or
-// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
-// specific.
-template <typename Char, typename CharTraits, typename T>
-::std::basic_ostream<Char, CharTraits>& operator<<(
- ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
- TypeWithoutFormatter<T,
- (internal::IsAProtocolMessage<T>::value ? kProtobuf :
- internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
- kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
- return os;
-}
-
-} // namespace internal2
-} // namespace testing
-
-// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
-// magic needed for implementing UniversalPrinter won't work.
-namespace testing_internal {
-
-// Used to print a value that is not an STL-style container when the
-// user doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
- // With the following statement, during unqualified name lookup,
- // testing::internal2::operator<< appears as if it was declared in
- // the nearest enclosing namespace that contains both
- // ::testing_internal and ::testing::internal2, i.e. the global
- // namespace. For more details, refer to the C++ Standard section
- // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
- // testing::internal2::operator<< in case T doesn't come with a <<
- // operator.
- //
- // We cannot write 'using ::testing::internal2::operator<<;', which
- // gcc 3.3 fails to compile due to a compiler bug.
- using namespace ::testing::internal2; // NOLINT
-
- // Assuming T is defined in namespace foo, in the next statement,
- // the compiler will consider all of:
- //
- // 1. foo::operator<< (thanks to Koenig look-up),
- // 2. ::operator<< (as the current namespace is enclosed in ::),
- // 3. testing::internal2::operator<< (thanks to the using statement above).
- //
- // The operator<< whose type matches T best will be picked.
- //
- // We deliberately allow #2 to be a candidate, as sometimes it's
- // impossible to define #1 (e.g. when foo is ::std, defining
- // anything in it is undefined behavior unless you are a compiler
- // vendor.).
- *os << value;
-}
-
-} // namespace testing_internal
-
-namespace testing {
-namespace internal {
-
-// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
-// value to the given ostream. The caller must ensure that
-// 'ostream_ptr' is not NULL, or the behavior is undefined.
-//
-// We define UniversalPrinter as a class template (as opposed to a
-// function template), as we need to partially specialize it for
-// reference types, which cannot be done with function templates.
-template <typename T>
-class UniversalPrinter;
-
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os);
-
-// Used to print an STL-style container when the user doesn't define
-// a PrintTo() for it.
-template <typename C>
-void DefaultPrintTo(IsContainer /* dummy */,
- false_type /* is not a pointer */,
- const C& container, ::std::ostream* os) {
- const size_t kMaxCount = 32; // The maximum number of elements to print.
- *os << '{';
- size_t count = 0;
- for (typename C::const_iterator it = container.begin();
- it != container.end(); ++it, ++count) {
- if (count > 0) {
- *os << ',';
- if (count == kMaxCount) { // Enough has been printed.
- *os << " ...";
- break;
- }
- }
- *os << ' ';
- // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
- // handle *it being a native array.
- internal::UniversalPrint(*it, os);
- }
-
- if (count > 0) {
- *os << ' ';
- }
- *os << '}';
-}
-
-// Used to print a pointer that is neither a char pointer nor a member
-// pointer, when the user doesn't define PrintTo() for it. (A member
-// variable pointer or member function pointer doesn't really point to
-// a location in the address space. Their representation is
-// implementation-defined. Therefore they will be printed as raw
-// bytes.)
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- true_type /* is a pointer */,
- T* p, ::std::ostream* os) {
- if (p == NULL) {
- *os << "NULL";
- } else {
- // C++ doesn't allow casting from a function pointer to any object
- // pointer.
- //
- // IsTrue() silences warnings: "Condition is always true",
- // "unreachable code".
- if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
- // T is not a function type. We just call << to print p,
- // relying on ADL to pick up user-defined << for their pointer
- // types, if any.
- *os << p;
- } else {
- // T is a function type, so '*os << p' doesn't do what we want
- // (it just prints p as bool). We want to print p as a const
- // void*. However, we cannot cast it to const void* directly,
- // even using reinterpret_cast, as earlier versions of gcc
- // (e.g. 3.4.5) cannot compile the cast when p is a function
- // pointer. Casting to UInt64 first solves the problem.
- *os << reinterpret_cast<const void*>(
- reinterpret_cast<internal::UInt64>(p));
- }
- }
-}
-
-// Used to print a non-container, non-pointer value when the user
-// doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- false_type /* is not a pointer */,
- const T& value, ::std::ostream* os) {
- ::testing_internal::DefaultPrintNonContainerTo(value, os);
-}
-
-// Prints the given value using the << operator if it has one;
-// otherwise prints the bytes in it. This is what
-// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
-// or overloaded for type T.
-//
-// A user can override this behavior for a class type Foo by defining
-// an overload of PrintTo() in the namespace where Foo is defined. We
-// give the user this option as sometimes defining a << operator for
-// Foo is not desirable (e.g. the coding style may prevent doing it,
-// or there is already a << operator but it doesn't do what the user
-// wants).
-template <typename T>
-void PrintTo(const T& value, ::std::ostream* os) {
- // DefaultPrintTo() is overloaded. The type of its first two
- // arguments determine which version will be picked. If T is an
- // STL-style container, the version for container will be called; if
- // T is a pointer, the pointer version will be called; otherwise the
- // generic version will be called.
- //
- // Note that we check for container types here, prior to we check
- // for protocol message types in our operator<<. The rationale is:
- //
- // For protocol messages, we want to give people a chance to
- // override Google Mock's format by defining a PrintTo() or
- // operator<<. For STL containers, other formats can be
- // incompatible with Google Mock's format for the container
- // elements; therefore we check for container types here to ensure
- // that our format is used.
- //
- // The second argument of DefaultPrintTo() is needed to bypass a bug
- // in Symbian's C++ compiler that prevents it from picking the right
- // overload between:
- //
- // PrintTo(const T& x, ...);
- // PrintTo(T* x, ...);
- DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
-}
-
-// The following list of PrintTo() overloads tells
-// UniversalPrinter<T>::Print() how to print standard types (built-in
-// types, strings, plain arrays, and pointers).
-
-// Overloads for various char types.
-GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
-GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
-inline void PrintTo(char c, ::std::ostream* os) {
- // When printing a plain char, we always treat it as unsigned. This
- // way, the output won't be affected by whether the compiler thinks
- // char is signed or not.
- PrintTo(static_cast<unsigned char>(c), os);
-}
-
-// Overloads for other simple built-in types.
-inline void PrintTo(bool x, ::std::ostream* os) {
- *os << (x ? "true" : "false");
-}
-
-// Overload for wchar_t type.
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its decimal code (except for L'\0').
-// The L'\0' char is printed as "L'\\0'". The decimal code is printed
-// as signed integer when wchar_t is implemented by the compiler
-// as a signed type and is printed as an unsigned integer when wchar_t
-// is implemented as an unsigned type.
-GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
-
-// Overloads for C strings.
-GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
-inline void PrintTo(char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const char*>(s), os);
-}
-
-// signed/unsigned char is often used for representing binary data, so
-// we print pointers to it as void* to be safe.
-inline void PrintTo(const signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-
-// MSVC can be configured to define wchar_t as a typedef of unsigned
-// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
-// type. When wchar_t is a typedef, defining an overload for const
-// wchar_t* would cause unsigned short* be printed as a wide string,
-// possibly causing invalid memory accesses.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Overloads for wide C strings
-GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
-inline void PrintTo(wchar_t* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const wchar_t*>(s), os);
-}
-#endif
-
-// Overload for C arrays. Multi-dimensional arrays are printed
-// properly.
-
-// Prints the given number of elements in an array, without printing
-// the curly braces.
-template <typename T>
-void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
- UniversalPrint(a[0], os);
- for (size_t i = 1; i != count; i++) {
- *os << ", ";
- UniversalPrint(a[i], os);
- }
-}
-
-// Overloads for ::string and ::std::string.
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
-inline void PrintTo(const ::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
-GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
-inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-
-// Overloads for ::wstring and ::std::wstring.
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_TR1_TUPLE
-// Overload for ::std::tr1::tuple. Needed for printing function arguments,
-// which are packed as tuples.
-
-// Helper function for printing a tuple. T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os);
-
-// Overloaded PrintTo() for tuples of various arities. We support
-// tuples of up-to 10 fields. The following implementation works
-// regardless of whether tr1::tuple is implemented using the
-// non-standard variadic template feature or not.
-
-inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1>
-void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2>
-void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-void PrintTo(
- const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Overload for std::pair.
-template <typename T1, typename T2>
-void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
- *os << '(';
- // We cannot use UniversalPrint(value.first, os) here, as T1 may be
- // a reference type. The same for printing value.second.
- UniversalPrinter<T1>::Print(value.first, os);
- *os << ", ";
- UniversalPrinter<T2>::Print(value.second, os);
- *os << ')';
-}
-
-// Implements printing a non-reference type T by letting the compiler
-// pick the right overload of PrintTo() for T.
-template <typename T>
-class UniversalPrinter {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4180) // Temporarily disables warning 4180.
-#endif // _MSC_VER
-
- // Note: we deliberately don't call this PrintTo(), as that name
- // conflicts with ::testing::internal::PrintTo in the body of the
- // function.
- static void Print(const T& value, ::std::ostream* os) {
- // By default, ::testing::internal::PrintTo() is used for printing
- // the value.
- //
- // Thanks to Koenig look-up, if T is a class and has its own
- // PrintTo() function defined in its namespace, that function will
- // be visible here. Since it is more specific than the generic ones
- // in ::testing::internal, it will be picked by the compiler in the
- // following statement - exactly what we want.
- PrintTo(value, os);
- }
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif // _MSC_VER
-};
-
-// UniversalPrintArray(begin, len, os) prints an array of 'len'
-// elements, starting at address 'begin'.
-template <typename T>
-void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
- if (len == 0) {
- *os << "{}";
- } else {
- *os << "{ ";
- const size_t kThreshold = 18;
- const size_t kChunkSize = 8;
- // If the array has more than kThreshold elements, we'll have to
- // omit some details by printing only the first and the last
- // kChunkSize elements.
- // TODO(wan@google.com): let the user control the threshold using a flag.
- if (len <= kThreshold) {
- PrintRawArrayTo(begin, len, os);
- } else {
- PrintRawArrayTo(begin, kChunkSize, os);
- *os << ", ..., ";
- PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
- }
- *os << " }";
- }
-}
-// This overload prints a (const) char array compactly.
-GTEST_API_ void UniversalPrintArray(
- const char* begin, size_t len, ::std::ostream* os);
-
-// This overload prints a (const) wchar_t array compactly.
-GTEST_API_ void UniversalPrintArray(
- const wchar_t* begin, size_t len, ::std::ostream* os);
-
-// Implements printing an array type T[N].
-template <typename T, size_t N>
-class UniversalPrinter<T[N]> {
- public:
- // Prints the given array, omitting some elements when there are too
- // many.
- static void Print(const T (&a)[N], ::std::ostream* os) {
- UniversalPrintArray(a, N, os);
- }
-};
-
-// Implements printing a reference type T&.
-template <typename T>
-class UniversalPrinter<T&> {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4180) // Temporarily disables warning 4180.
-#endif // _MSC_VER
-
- static void Print(const T& value, ::std::ostream* os) {
- // Prints the address of the value. We use reinterpret_cast here
- // as static_cast doesn't compile when T is a function type.
- *os << "@" << reinterpret_cast<const void*>(&value) << " ";
-
- // Then prints the value itself.
- UniversalPrint(value, os);
- }
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif // _MSC_VER
-};
-
-// Prints a value tersely: for a reference type, the referenced value
-// (but not the address) is printed; for a (const) char pointer, the
-// NUL-terminated string (but not the pointer) is printed.
-
-template <typename T>
-class UniversalTersePrinter {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T>
-class UniversalTersePrinter<T&> {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T, size_t N>
-class UniversalTersePrinter<T[N]> {
- public:
- static void Print(const T (&value)[N], ::std::ostream* os) {
- UniversalPrinter<T[N]>::Print(value, os);
- }
-};
-template <>
-class UniversalTersePrinter<const char*> {
- public:
- static void Print(const char* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(string(str), os);
- }
- }
-};
-template <>
-class UniversalTersePrinter<char*> {
- public:
- static void Print(char* str, ::std::ostream* os) {
- UniversalTersePrinter<const char*>::Print(str, os);
- }
-};
-
-#if GTEST_HAS_STD_WSTRING
-template <>
-class UniversalTersePrinter<const wchar_t*> {
- public:
- static void Print(const wchar_t* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(::std::wstring(str), os);
- }
- }
-};
-#endif
-
-template <>
-class UniversalTersePrinter<wchar_t*> {
- public:
- static void Print(wchar_t* str, ::std::ostream* os) {
- UniversalTersePrinter<const wchar_t*>::Print(str, os);
- }
-};
-
-template <typename T>
-void UniversalTersePrint(const T& value, ::std::ostream* os) {
- UniversalTersePrinter<T>::Print(value, os);
-}
-
-// Prints a value using the type inferred by the compiler. The
-// difference between this and UniversalTersePrint() is that for a
-// (const) char pointer, this prints both the pointer and the
-// NUL-terminated string.
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os) {
- // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
- // UniversalPrinter with T directly.
- typedef T T1;
- UniversalPrinter<T1>::Print(value, os);
-}
-
-#if GTEST_HAS_TR1_TUPLE
-typedef ::std::vector<string> Strings;
-
-// This helper template allows PrintTo() for tuples and
-// UniversalTersePrintTupleFieldsToStrings() to be defined by
-// induction on the number of tuple fields. The idea is that
-// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
-// fields in tuple t, and can be defined in terms of
-// TuplePrefixPrinter<N - 1>.
-
-// The inductive case.
-template <size_t N>
-struct TuplePrefixPrinter {
- // Prints the first N fields of a tuple.
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
- TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
- *os << ", ";
- UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>
- ::Print(::std::tr1::get<N - 1>(t), os);
- }
-
- // Tersely prints the first N fields of a tuple to a string vector,
- // one element for each field.
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
- TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
- ::std::stringstream ss;
- UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);
- strings->push_back(ss.str());
- }
-};
-
-// Base cases.
-template <>
-struct TuplePrefixPrinter<0> {
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
-
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
-};
-// We have to specialize the entire TuplePrefixPrinter<> class
-// template here, even though the definition of
-// TersePrintPrefixToStrings() is the same as the generic version, as
-// Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't
-// support specializing a method template of a class template.
-template <>
-struct TuplePrefixPrinter<1> {
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
- UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::
- Print(::std::tr1::get<0>(t), os);
- }
-
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
- ::std::stringstream ss;
- UniversalTersePrint(::std::tr1::get<0>(t), &ss);
- strings->push_back(ss.str());
- }
-};
-
-// Helper function for printing a tuple. T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os) {
- *os << "(";
- TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::
- PrintPrefixTo(t, os);
- *os << ")";
-}
-
-// Prints the fields of a tuple tersely to a string vector, one
-// element for each field. See the comment before
-// UniversalTersePrint() for how we define "tersely".
-template <typename Tuple>
-Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
- Strings result;
- TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::
- TersePrintPrefixToStrings(value, &result);
- return result;
-}
-#endif // GTEST_HAS_TR1_TUPLE
-
-} // namespace internal
-
-template <typename T>
-::std::string PrintToString(const T& value) {
- ::std::stringstream ss;
- internal::UniversalTersePrinter<T>::Print(value, &ss);
- return ss.str();
-}
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-namespace internal {
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Outputs a message explaining invalid registration of different
-// fixture class for the same test case. This may happen when
-// TEST_P macro is used to define two tests with the same name
-// but in different namespaces.
-GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
- const char* file, int line);
-
-template <typename> class ParamGeneratorInterface;
-template <typename> class ParamGenerator;
-
-// Interface for iterating over elements provided by an implementation
-// of ParamGeneratorInterface<T>.
-template <typename T>
-class ParamIteratorInterface {
- public:
- virtual ~ParamIteratorInterface() {}
- // A pointer to the base generator instance.
- // Used only for the purposes of iterator comparison
- // to make sure that two iterators belong to the same generator.
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
- // Advances iterator to point to the next element
- // provided by the generator. The caller is responsible
- // for not calling Advance() on an iterator equal to
- // BaseGenerator()->End().
- virtual void Advance() = 0;
- // Clones the iterator object. Used for implementing copy semantics
- // of ParamIterator<T>.
- virtual ParamIteratorInterface* Clone() const = 0;
- // Dereferences the current iterator and provides (read-only) access
- // to the pointed value. It is the caller's responsibility not to call
- // Current() on an iterator equal to BaseGenerator()->End().
- // Used for implementing ParamGenerator<T>::operator*().
- virtual const T* Current() const = 0;
- // Determines whether the given iterator and other point to the same
- // element in the sequence generated by the generator.
- // Used for implementing ParamGenerator<T>::operator==().
- virtual bool Equals(const ParamIteratorInterface& other) const = 0;
-};
-
-// Class iterating over elements provided by an implementation of
-// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
-// and implements the const forward iterator concept.
-template <typename T>
-class ParamIterator {
- public:
- typedef T value_type;
- typedef const T& reference;
- typedef ptrdiff_t difference_type;
-
- // ParamIterator assumes ownership of the impl_ pointer.
- ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
- ParamIterator& operator=(const ParamIterator& other) {
- if (this != &other)
- impl_.reset(other.impl_->Clone());
- return *this;
- }
-
- const T& operator*() const { return *impl_->Current(); }
- const T* operator->() const { return impl_->Current(); }
- // Prefix version of operator++.
- ParamIterator& operator++() {
- impl_->Advance();
- return *this;
- }
- // Postfix version of operator++.
- ParamIterator operator++(int /*unused*/) {
- ParamIteratorInterface<T>* clone = impl_->Clone();
- impl_->Advance();
- return ParamIterator(clone);
- }
- bool operator==(const ParamIterator& other) const {
- return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
- }
- bool operator!=(const ParamIterator& other) const {
- return !(*this == other);
- }
-
- private:
- friend class ParamGenerator<T>;
- explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
- scoped_ptr<ParamIteratorInterface<T> > impl_;
-};
-
-// ParamGeneratorInterface<T> is the binary interface to access generators
-// defined in other translation units.
-template <typename T>
-class ParamGeneratorInterface {
- public:
- typedef T ParamType;
-
- virtual ~ParamGeneratorInterface() {}
-
- // Generator interface definition
- virtual ParamIteratorInterface<T>* Begin() const = 0;
- virtual ParamIteratorInterface<T>* End() const = 0;
-};
-
-// Wraps ParamGeneratorInterface<T> and provides general generator syntax
-// compatible with the STL Container concept.
-// This class implements copy initialization semantics and the contained
-// ParamGeneratorInterface<T> instance is shared among all copies
-// of the original object. This is possible because that instance is immutable.
-template<typename T>
-class ParamGenerator {
- public:
- typedef ParamIterator<T> iterator;
-
- explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
- ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
-
- ParamGenerator& operator=(const ParamGenerator& other) {
- impl_ = other.impl_;
- return *this;
- }
-
- iterator begin() const { return iterator(impl_->Begin()); }
- iterator end() const { return iterator(impl_->End()); }
-
- private:
- linked_ptr<const ParamGeneratorInterface<T> > impl_;
-};
-
-// Generates values from a range of two comparable values. Can be used to
-// generate sequences of user-defined types that implement operator+() and
-// operator<().
-// This class is used in the Range() function.
-template <typename T, typename IncrementT>
-class RangeGenerator : public ParamGeneratorInterface<T> {
- public:
- RangeGenerator(T begin, T end, IncrementT step)
- : begin_(begin), end_(end),
- step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
- virtual ~RangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, begin_, 0, step_);
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, end_, end_index_, step_);
- }
-
- private:
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
- IncrementT step)
- : base_(base), value_(value), index_(index), step_(step) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- value_ = value_ + step_;
- index_++;
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- virtual const T* Current() const { return &value_; }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const int other_index =
- CheckedDowncastToActualType<const Iterator>(&other)->index_;
- return index_ == other_index;
- }
-
- private:
- Iterator(const Iterator& other)
- : ParamIteratorInterface<T>(),
- base_(other.base_), value_(other.value_), index_(other.index_),
- step_(other.step_) {}
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<T>* const base_;
- T value_;
- int index_;
- const IncrementT step_;
- }; // class RangeGenerator::Iterator
-
- static int CalculateEndIndex(const T& begin,
- const T& end,
- const IncrementT& step) {
- int end_index = 0;
- for (T i = begin; i < end; i = i + step)
- end_index++;
- return end_index;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const RangeGenerator& other);
-
- const T begin_;
- const T end_;
- const IncrementT step_;
- // The index for the end() iterator. All the elements in the generated
- // sequence are indexed (0-based) to aid iterator comparison.
- const int end_index_;
-}; // class RangeGenerator
-
-
-// Generates values from a pair of STL-style iterators. Used in the
-// ValuesIn() function. The elements are copied from the source range
-// since the source can be located on the stack, and the generator
-// is likely to persist beyond that stack frame.
-template <typename T>
-class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
- public:
- template <typename ForwardIterator>
- ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
- : container_(begin, end) {}
- virtual ~ValuesInIteratorRangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, container_.begin());
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, container_.end());
- }
-
- private:
- typedef typename ::std::vector<T> ContainerType;
-
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base,
- typename ContainerType::const_iterator iterator)
- : base_(base), iterator_(iterator) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- ++iterator_;
- value_.reset();
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- // We need to use cached value referenced by iterator_ because *iterator_
- // can return a temporary object (and of type other then T), so just
- // having "return &*iterator_;" doesn't work.
- // value_ is updated here and not in Advance() because Advance()
- // can advance iterator_ beyond the end of the range, and we cannot
- // detect that fact. The client code, on the other hand, is
- // responsible for not calling Current() on an out-of-range iterator.
- virtual const T* Current() const {
- if (value_.get() == NULL)
- value_.reset(new T(*iterator_));
- return value_.get();
- }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- return iterator_ ==
- CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
- }
-
- private:
- Iterator(const Iterator& other)
- // The explicit constructor call suppresses a false warning
- // emitted by gcc when supplied with the -Wextra option.
- : ParamIteratorInterface<T>(),
- base_(other.base_),
- iterator_(other.iterator_) {}
-
- const ParamGeneratorInterface<T>* const base_;
- typename ContainerType::const_iterator iterator_;
- // A cached value of *iterator_. We keep it here to allow access by
- // pointer in the wrapping iterator's operator->().
- // value_ needs to be mutable to be accessed in Current().
- // Use of scoped_ptr helps manage cached value's lifetime,
- // which is bound by the lifespan of the iterator itself.
- mutable scoped_ptr<const T> value_;
- }; // class ValuesInIteratorRangeGenerator::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const ValuesInIteratorRangeGenerator& other);
-
- const ContainerType container_;
-}; // class ValuesInIteratorRangeGenerator
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Stores a parameter value and later creates tests parameterized with that
-// value.
-template <class TestClass>
-class ParameterizedTestFactory : public TestFactoryBase {
- public:
- typedef typename TestClass::ParamType ParamType;
- explicit ParameterizedTestFactory(ParamType parameter) :
- parameter_(parameter) {}
- virtual Test* CreateTest() {
- TestClass::SetParam(&parameter_);
- return new TestClass();
- }
-
- private:
- const ParamType parameter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactoryBase is a base class for meta-factories that create
-// test factories for passing into MakeAndRegisterTestInfo function.
-template <class ParamType>
-class TestMetaFactoryBase {
- public:
- virtual ~TestMetaFactoryBase() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactory creates test factories for passing into
-// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
-// ownership of test factory pointer, same factory object cannot be passed
-// into that method twice. But ParameterizedTestCaseInfo is going to call
-// it for each Test/Parameter value combination. Thus it needs meta factory
-// creator class.
-template <class TestCase>
-class TestMetaFactory
- : public TestMetaFactoryBase<typename TestCase::ParamType> {
- public:
- typedef typename TestCase::ParamType ParamType;
-
- TestMetaFactory() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
- return new ParameterizedTestFactory<TestCase>(parameter);
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfoBase is a generic interface
-// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
-// accumulates test information provided by TEST_P macro invocations
-// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
-// and uses that information to register all resulting test instances
-// in RegisterTests method. The ParameterizeTestCaseRegistry class holds
-// a collection of pointers to the ParameterizedTestCaseInfo objects
-// and calls RegisterTests() on each of them when asked.
-class ParameterizedTestCaseInfoBase {
- public:
- virtual ~ParameterizedTestCaseInfoBase() {}
-
- // Base part of test case name for display purposes.
- virtual const string& GetTestCaseName() const = 0;
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const = 0;
- // UnitTest class invokes this method to register tests in this
- // test case right before running them in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- virtual void RegisterTests() = 0;
-
- protected:
- ParameterizedTestCaseInfoBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
-// macro invocations for a particular test case and generators
-// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
-// test case. It registers tests with all values generated by all
-// generators when asked.
-template <class TestCase>
-class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
- public:
- // ParamType and GeneratorCreationFunc are private types but are required
- // for declarations of public methods AddTestPattern() and
- // AddTestCaseInstantiation().
- typedef typename TestCase::ParamType ParamType;
- // A function that returns an instance of appropriate generator type.
- typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
-
- explicit ParameterizedTestCaseInfo(const char* name)
- : test_case_name_(name) {}
-
- // Test case base name for display purposes.
- virtual const string& GetTestCaseName() const { return test_case_name_; }
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
- // TEST_P macro uses AddTestPattern() to record information
- // about a single test in a LocalTestInfo structure.
- // test_case_name is the base name of the test case (without invocation
- // prefix). test_base_name is the name of an individual test without
- // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
- // test case base name and DoBar is test base name.
- void AddTestPattern(const char* test_case_name,
- const char* test_base_name,
- TestMetaFactoryBase<ParamType>* meta_factory) {
- tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
- test_base_name,
- meta_factory)));
- }
- // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
- // about a generator.
- int AddTestCaseInstantiation(const string& instantiation_name,
- GeneratorCreationFunc* func,
- const char* /* file */,
- int /* line */) {
- instantiations_.push_back(::std::make_pair(instantiation_name, func));
- return 0; // Return value used only to run this method in namespace scope.
- }
- // UnitTest class invokes this method to register tests in this test case
- // test cases right before running tests in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- // UnitTest has a guard to prevent from calling this method more then once.
- virtual void RegisterTests() {
- for (typename TestInfoContainer::iterator test_it = tests_.begin();
- test_it != tests_.end(); ++test_it) {
- linked_ptr<TestInfo> test_info = *test_it;
- for (typename InstantiationContainer::iterator gen_it =
- instantiations_.begin(); gen_it != instantiations_.end();
- ++gen_it) {
- const string& instantiation_name = gen_it->first;
- ParamGenerator<ParamType> generator((*gen_it->second)());
-
- string test_case_name;
- if ( !instantiation_name.empty() )
- test_case_name = instantiation_name + "/";
- test_case_name += test_info->test_case_base_name;
-
- int i = 0;
- for (typename ParamGenerator<ParamType>::iterator param_it =
- generator.begin();
- param_it != generator.end(); ++param_it, ++i) {
- Message test_name_stream;
- test_name_stream << test_info->test_base_name << "/" << i;
- MakeAndRegisterTestInfo(
- test_case_name.c_str(),
- test_name_stream.GetString().c_str(),
- NULL, // No type parameter.
- PrintToString(*param_it).c_str(),
- GetTestCaseTypeId(),
- TestCase::SetUpTestCase,
- TestCase::TearDownTestCase,
- test_info->test_meta_factory->CreateTestFactory(*param_it));
- } // for param_it
- } // for gen_it
- } // for test_it
- } // RegisterTests
-
- private:
- // LocalTestInfo structure keeps information about a single test registered
- // with TEST_P macro.
- struct TestInfo {
- TestInfo(const char* a_test_case_base_name,
- const char* a_test_base_name,
- TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
- test_case_base_name(a_test_case_base_name),
- test_base_name(a_test_base_name),
- test_meta_factory(a_test_meta_factory) {}
-
- const string test_case_base_name;
- const string test_base_name;
- const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
- };
- typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
- // Keeps pairs of <Instantiation name, Sequence generator creation function>
- // received from INSTANTIATE_TEST_CASE_P macros.
- typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >
- InstantiationContainer;
-
- const string test_case_name_;
- TestInfoContainer tests_;
- InstantiationContainer instantiations_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
-}; // class ParameterizedTestCaseInfo
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
-// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
-// macros use it to locate their corresponding ParameterizedTestCaseInfo
-// descriptors.
-class ParameterizedTestCaseRegistry {
- public:
- ParameterizedTestCaseRegistry() {}
- ~ParameterizedTestCaseRegistry() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- delete *it;
- }
- }
-
- // Looks up or creates and returns a structure containing information about
- // tests and instantiations of a particular test case.
- template <class TestCase>
- ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
- const char* test_case_name,
- const char* file,
- int line) {
- ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- if ((*it)->GetTestCaseName() == test_case_name) {
- if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
- // Complain about incorrect usage of Google Test facilities
- // and terminate the program since we cannot guaranty correct
- // test case setup and tear-down in this case.
- ReportInvalidTestCaseType(test_case_name, file, line);
- posix::Abort();
- } else {
- // At this point we are sure that the object we found is of the same
- // type we are looking for, so we downcast it to that type
- // without further checks.
- typed_test_info = CheckedDowncastToActualType<
- ParameterizedTestCaseInfo<TestCase> >(*it);
- }
- break;
- }
- }
- if (typed_test_info == NULL) {
- typed_test_info = new ParameterizedTestCaseInfo<TestCase>(test_case_name);
- test_case_infos_.push_back(typed_test_info);
- }
- return typed_test_info;
- }
- void RegisterTests() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- (*it)->RegisterTests();
- }
- }
-
- private:
- typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
-
- TestCaseInfoContainer test_case_infos_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
-};
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-// This file was GENERATED by command:
-// pump.py gtest-param-util-generated.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most 50 arguments in Values,
-// and at most 10 arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tr1::tuple which is
-// currently set at 10.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
- explicit ValueArray1(T1 v1) : v1_(v1) {}
-
- template <typename T>
- operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray1& other);
-
- const T1 v1_;
-};
-
-template <typename T1, typename T2>
-class ValueArray2 {
- public:
- ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray2& other);
-
- const T1 v1_;
- const T2 v2_;
-};
-
-template <typename T1, typename T2, typename T3>
-class ValueArray3 {
- public:
- ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray3& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-class ValueArray4 {
- public:
- ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray4& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class ValueArray5 {
- public:
- ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray5& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class ValueArray6 {
- public:
- ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray6& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class ValueArray7 {
- public:
- ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray7& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class ValueArray8 {
- public:
- ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray8& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class ValueArray9 {
- public:
- ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray9& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class ValueArray10 {
- public:
- ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray10& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-class ValueArray11 {
- public:
- ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray11& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-class ValueArray12 {
- public:
- ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray12& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-class ValueArray13 {
- public:
- ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray13& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-class ValueArray14 {
- public:
- ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray14& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-class ValueArray15 {
- public:
- ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray15& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-class ValueArray16 {
- public:
- ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray16& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-class ValueArray17 {
- public:
- ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray17& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-class ValueArray18 {
- public:
- ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray18& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-class ValueArray19 {
- public:
- ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray19& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-class ValueArray20 {
- public:
- ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray20& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-class ValueArray21 {
- public:
- ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray21& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-class ValueArray22 {
- public:
- ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray22& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-class ValueArray23 {
- public:
- ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray23& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-class ValueArray24 {
- public:
- ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray24& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-class ValueArray25 {
- public:
- ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray25& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-class ValueArray26 {
- public:
- ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray26& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-class ValueArray27 {
- public:
- ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray27& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-class ValueArray28 {
- public:
- ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray28& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-class ValueArray29 {
- public:
- ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray29& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-class ValueArray30 {
- public:
- ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray30& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-class ValueArray31 {
- public:
- ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray31& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-class ValueArray32 {
- public:
- ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray32& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-class ValueArray33 {
- public:
- ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray33& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-class ValueArray34 {
- public:
- ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray34& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-class ValueArray35 {
- public:
- ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray35& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-class ValueArray36 {
- public:
- ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray36& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-class ValueArray37 {
- public:
- ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray37& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-class ValueArray38 {
- public:
- ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray38& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-class ValueArray39 {
- public:
- ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray39& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-class ValueArray40 {
- public:
- ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray40& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-class ValueArray41 {
- public:
- ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray41& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-class ValueArray42 {
- public:
- ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray42& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-class ValueArray43 {
- public:
- ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
- v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray43& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-class ValueArray44 {
- public:
- ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
- v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
- v43_(v43), v44_(v44) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray44& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-class ValueArray45 {
- public:
- ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
- v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray45& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-class ValueArray46 {
- public:
- ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray46& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-class ValueArray47 {
- public:
- ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
- v47_(v47) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray47& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-class ValueArray48 {
- public:
- ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
- v46_(v46), v47_(v47), v48_(v48) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray48& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-class ValueArray49 {
- public:
- ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
- T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray49& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-class ValueArray50 {
- public:
- ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
- T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray50& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
- const T50 v50_;
-};
-
-# if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-template <typename T1, typename T2>
-class CartesianProductGenerator2
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2> > {
- public:
- typedef ::std::tr1::tuple<T1, T2> ParamType;
-
- CartesianProductGenerator2(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2)
- : g1_(g1), g2_(g2) {}
- virtual ~CartesianProductGenerator2() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current2_;
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- ParamType current_value_;
- }; // class CartesianProductGenerator2::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator2& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
-}; // class CartesianProductGenerator2
-
-
-template <typename T1, typename T2, typename T3>
-class CartesianProductGenerator3
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3> ParamType;
-
- CartesianProductGenerator3(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- virtual ~CartesianProductGenerator3() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current3_;
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- ParamType current_value_;
- }; // class CartesianProductGenerator3::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator3& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
-}; // class CartesianProductGenerator3
-
-
-template <typename T1, typename T2, typename T3, typename T4>
-class CartesianProductGenerator4
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType;
-
- CartesianProductGenerator4(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- virtual ~CartesianProductGenerator4() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current4_;
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- ParamType current_value_;
- }; // class CartesianProductGenerator4::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator4& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
-}; // class CartesianProductGenerator4
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class CartesianProductGenerator5
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType;
-
- CartesianProductGenerator5(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- virtual ~CartesianProductGenerator5() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current5_;
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- ParamType current_value_;
- }; // class CartesianProductGenerator5::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator5& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
-}; // class CartesianProductGenerator5
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class CartesianProductGenerator6
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
- T6> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType;
-
- CartesianProductGenerator6(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- virtual ~CartesianProductGenerator6() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current6_;
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- ParamType current_value_;
- }; // class CartesianProductGenerator6::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator6& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
-}; // class CartesianProductGenerator6
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class CartesianProductGenerator7
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
-
- CartesianProductGenerator7(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- virtual ~CartesianProductGenerator7() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current7_;
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- ParamType current_value_;
- }; // class CartesianProductGenerator7::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator7& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
-}; // class CartesianProductGenerator7
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class CartesianProductGenerator8
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
-
- CartesianProductGenerator8(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- virtual ~CartesianProductGenerator8() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current8_;
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- ParamType current_value_;
- }; // class CartesianProductGenerator8::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator8& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
-}; // class CartesianProductGenerator8
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class CartesianProductGenerator9
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
-
- CartesianProductGenerator9(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- virtual ~CartesianProductGenerator9() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current9_;
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- ParamType current_value_;
- }; // class CartesianProductGenerator9::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator9& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
-}; // class CartesianProductGenerator9
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class CartesianProductGenerator10
- : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9, T10> > {
- public:
- typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
-
- CartesianProductGenerator10(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
- const ParamGenerator<T10>& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- virtual ~CartesianProductGenerator10() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end(), g10_, g10_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9,
- const ParamGenerator<T10>& g10,
- const typename ParamGenerator<T10>::iterator& current10)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
- begin10_(g10.begin()), end10_(g10.end()), current10_(current10) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current10_;
- if (current10_ == end10_) {
- current10_ = begin10_;
- ++current9_;
- }
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_ &&
- current10_ == typed_other->current10_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_),
- begin10_(other.begin10_),
- end10_(other.end10_),
- current10_(other.current10_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_, *current10_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_ ||
- current10_ == end10_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- const typename ParamGenerator<T10>::iterator begin10_;
- const typename ParamGenerator<T10>::iterator end10_;
- typename ParamGenerator<T10>::iterator current10_;
- ParamType current_value_;
- }; // class CartesianProductGenerator10::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator10& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
- const ParamGenerator<T10> g10_;
-}; // class CartesianProductGenerator10
-
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-template <class Generator1, class Generator2>
-class CartesianProductHolder2 {
- public:
-CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
- : g1_(g1), g2_(g2) {}
- template <typename T1, typename T2>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2> >(
- new CartesianProductGenerator2<T1, T2>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder2& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
-}; // class CartesianProductHolder2
-
-template <class Generator1, class Generator2, class Generator3>
-class CartesianProductHolder3 {
- public:
-CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
- const Generator3& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- template <typename T1, typename T2, typename T3>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >(
- new CartesianProductGenerator3<T1, T2, T3>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder3& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
-}; // class CartesianProductHolder3
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4>
-class CartesianProductHolder4 {
- public:
-CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- template <typename T1, typename T2, typename T3, typename T4>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >(
- new CartesianProductGenerator4<T1, T2, T3, T4>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder4& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
-}; // class CartesianProductHolder4
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5>
-class CartesianProductHolder5 {
- public:
-CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >(
- new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder5& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
-}; // class CartesianProductHolder5
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6>
-class CartesianProductHolder6 {
- public:
-CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> >(
- new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder6& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
-}; // class CartesianProductHolder6
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7>
-class CartesianProductHolder7 {
- public:
-CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6,
- T7> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> >(
- new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder7& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
-}; // class CartesianProductHolder7
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8>
-class CartesianProductHolder8 {
- public:
-CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7,
- T8> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
- new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder8& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
-}; // class CartesianProductHolder8
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9>
-class CartesianProductHolder9 {
- public:
-CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >(
- new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder9& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
-}; // class CartesianProductHolder9
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9, class Generator10>
-class CartesianProductHolder10 {
- public:
-CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9, const Generator10& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
- operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9, T10> >() const {
- return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9, T10> >(
- new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_),
- static_cast<ParamGenerator<T10> >(g10_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder10& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
- const Generator10 g10_;
-}; // class CartesianProductHolder10
-
-# endif // GTEST_HAS_COMBINE
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-// - returns a generator producing a sequence of values {start, start+1,
-// start+2, ..., }.
-// Range(start, end, step)
-// - returns a generator producing a sequence of values {start, start+step,
-// start+step+step, ..., }.
-// Notes:
-// * The generated sequences never include end. For example, Range(1, 5)
-// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-// returns a generator producing {1, 3, 5, 7}.
-// * start and end must have the same type. That type may be any integral or
-// floating-point type or a user defined type satisfying these conditions:
-// * It must be assignable (have operator=() defined).
-// * It must have operator+() (operator+(int-compatible type) for
-// two-operand version).
-// * It must have operator<() defined.
-// Elements in the resulting sequences will also have that type.
-// * Condition start < end must be satisfied in order for resulting sequences
-// to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
- return internal::ParamGenerator<T>(
- new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
- return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-// - returns a generator producing sequences with elements from
-// a C-style array.
-// ValuesIn(const Container& container)
-// - returns a generator producing sequences with elements from
-// an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-// - returns a generator producing sequences with elements from
-// a range [begin, end) defined by a pair of STL-style iterators. These
-// iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-// ::std::vector< ::std::string> v;
-// v.push_back("a");
-// v.push_back("b");
-// return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-// StlStringTest,
-// ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-// ::std::list<char> list;
-// list.push_back('a');
-// list.push_back('b');
-// return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-// CharTest,
-// ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end) {
- typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
- ::value_type ParamType;
- return internal::ParamGenerator<ParamType>(
- new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
- return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container) {
- return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-// - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to 50 parameters.
-//
-template <typename T1>
-internal::ValueArray1<T1> Values(T1 v1) {
- return internal::ValueArray1<T1>(v1);
-}
-
-template <typename T1, typename T2>
-internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
- return internal::ValueArray2<T1, T2>(v1, v2);
-}
-
-template <typename T1, typename T2, typename T3>
-internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
- return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
- return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5) {
- return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6) {
- return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7) {
- return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
- v6, v7);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
- return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
- v5, v6, v7, v8);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
- return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
- return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) {
- return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) {
- return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) {
- return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
- return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
- return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16) {
- return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17) {
- return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18) {
- return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
- return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
- return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
- return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22) {
- return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23) {
- return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24) {
- return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
- return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) {
- return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) {
- return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) {
- return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) {
- return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
- return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
- return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32) {
- return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33) {
- return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34) {
- return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
- return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
- return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37) {
- return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38) {
- return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
- v33, v34, v35, v36, v37, v38);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38, T39 v39) {
- return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
- v32, v33, v34, v35, v36, v37, v38, v39);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
- T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
- T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
- return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
- v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
- return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
- v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) {
- return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
- v42);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) {
- return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
- v41, v42, v43);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) {
- return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
- v40, v41, v42, v43, v44);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
- return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
- v39, v40, v41, v42, v43, v44, v45);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
- return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
- return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
- T48 v48) {
- return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
- v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
- T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
- T47 v47, T48 v48, T49 v49) {
- return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
- v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
- T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
- T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
- return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
- v48, v49, v50);
-}
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-// - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-// virtual void SetUp() {
-// external_flag = GetParam();
-// }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
- return Values(false, true);
-}
-
-# if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-// - returns a generator producing sequences with elements coming from
-// the Cartesian product of elements from the sequences generated by
-// gen1, gen2, ..., genN. The sequence elements will have a type of
-// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-// of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to 10 arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-// : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-// Combine(Values("cat", "dog"),
-// Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-// : public testing::TestWithParam<tuple<bool, bool> > {
-// virtual void SetUp() {
-// // Assigns external_flag_1 and external_flag_2 values from the tuple.
-// tie(external_flag_1, external_flag_2) = GetParam();
-// }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-// // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-// Combine(Bool(), Bool()));
-//
-template <typename Generator1, typename Generator2>
-internal::CartesianProductHolder2<Generator1, Generator2> Combine(
- const Generator1& g1, const Generator2& g2) {
- return internal::CartesianProductHolder2<Generator1, Generator2>(
- g1, g2);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3>
-internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3) {
- return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
- g1, g2, g3);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4>
-internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4) {
- return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4>(
- g1, g2, g3, g4);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5>
-internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5) {
- return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5>(
- g1, g2, g3, g4, g5);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6>
-internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6) {
- return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6>(
- g1, g2, g3, g4, g5, g6);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7>
-internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7) {
- return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7>(
- g1, g2, g3, g4, g5, g6, g7);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8>
-internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8) {
- return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8>(
- g1, g2, g3, g4, g5, g6, g7, g8);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9>
-internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8,
- Generator9> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9) {
- return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9,
- typename Generator10>
-internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9,
- const Generator10& g10) {
- return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
-}
-# endif // GTEST_HAS_COMBINE
-
-
-
-# define TEST_P(test_case_name, test_name) \
- class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- : public test_case_name { \
- public: \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
- virtual void TestBody(); \
- private: \
- static int AddToRegistry() { \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
- #test_case_name, \
- #test_name, \
- new ::testing::internal::TestMetaFactory< \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
- return 0; \
- } \
- static int gtest_registering_dummy_; \
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
- }; \
- int GTEST_TEST_CLASS_NAME_(test_case_name, \
- test_name)::gtest_registering_dummy_ = \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
- void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
- ::testing::internal::ParamGenerator<test_case_name::ParamType> \
- gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
- int gtest_##prefix##test_case_name##_dummy_ = \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
- #prefix, \
- &gtest_##prefix##test_case_name##_EvalGenerator_, \
- __FILE__, __LINE__)
-
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Google C++ Testing Framework definitions useful in production code.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-
-// When you need to test the private or protected members of a class,
-// use the FRIEND_TEST macro to declare your tests as friends of the
-// class. For example:
-//
-// class MyClass {
-// private:
-// void MyMethod();
-// FRIEND_TEST(MyClassTest, MyMethod);
-// };
-//
-// class MyClassTest : public testing::Test {
-// // ...
-// };
-//
-// TEST_F(MyClassTest, MyMethod) {
-// // Can call MyClass::MyMethod() here.
-// }
-
-#define FRIEND_TEST(test_case_name, test_name)\
-friend class test_case_name##_##test_name##_Test
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-
-#include <iosfwd>
-#include <vector>
-
-namespace testing {
-
-// A copyable object representing the result of a test part (i.e. an
-// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
-//
-// Don't inherit from TestPartResult as its destructor is not virtual.
-class GTEST_API_ TestPartResult {
- public:
- // The possible outcomes of a test part (i.e. an assertion or an
- // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
- enum Type {
- kSuccess, // Succeeded.
- kNonFatalFailure, // Failed but the test can continue.
- kFatalFailure // Failed and the test should be terminated.
- };
-
- // C'tor. TestPartResult does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestPartResult object.
- TestPartResult(Type a_type,
- const char* a_file_name,
- int a_line_number,
- const char* a_message)
- : type_(a_type),
- file_name_(a_file_name == NULL ? "" : a_file_name),
- line_number_(a_line_number),
- summary_(ExtractSummary(a_message)),
- message_(a_message) {
- }
-
- // Gets the outcome of the test part.
- Type type() const { return type_; }
-
- // Gets the name of the source file where the test part took place, or
- // NULL if it's unknown.
- const char* file_name() const {
- return file_name_.empty() ? NULL : file_name_.c_str();
- }
-
- // Gets the line in the source file where the test part took place,
- // or -1 if it's unknown.
- int line_number() const { return line_number_; }
-
- // Gets the summary of the failure message.
- const char* summary() const { return summary_.c_str(); }
-
- // Gets the message associated with the test part.
- const char* message() const { return message_.c_str(); }
-
- // Returns true iff the test part passed.
- bool passed() const { return type_ == kSuccess; }
-
- // Returns true iff the test part failed.
- bool failed() const { return type_ != kSuccess; }
-
- // Returns true iff the test part non-fatally failed.
- bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
-
- // Returns true iff the test part fatally failed.
- bool fatally_failed() const { return type_ == kFatalFailure; }
-
- private:
- Type type_;
-
- // Gets the summary of the failure message by omitting the stack
- // trace in it.
- static std::string ExtractSummary(const char* message);
-
- // The name of the source file where the test part took place, or
- // "" if the source file is unknown.
- std::string file_name_;
- // The line in the source file where the test part took place, or -1
- // if the line number is unknown.
- int line_number_;
- std::string summary_; // The test failure summary.
- std::string message_; // The test failure message.
-};
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
-
-// An array of TestPartResult objects.
-//
-// Don't inherit from TestPartResultArray as its destructor is not
-// virtual.
-class GTEST_API_ TestPartResultArray {
- public:
- TestPartResultArray() {}
-
- // Appends the given TestPartResult to the array.
- void Append(const TestPartResult& result);
-
- // Returns the TestPartResult at the given index (0-based).
- const TestPartResult& GetTestPartResult(int index) const;
-
- // Returns the number of TestPartResult objects in the array.
- int size() const;
-
- private:
- std::vector<TestPartResult> array_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
-};
-
-// This interface knows how to report a test part result.
-class TestPartResultReporterInterface {
- public:
- virtual ~TestPartResultReporterInterface() {}
-
- virtual void ReportTestPartResult(const TestPartResult& result) = 0;
-};
-
-namespace internal {
-
-// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
-// statement generates new fatal failures. To do so it registers itself as the
-// current test part result reporter. Besides checking if fatal failures were
-// reported, it only delegates the reporting to the former result reporter.
-// The original result reporter is restored in the destructor.
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-class GTEST_API_ HasNewFatalFailureHelper
- : public TestPartResultReporterInterface {
- public:
- HasNewFatalFailureHelper();
- virtual ~HasNewFatalFailureHelper();
- virtual void ReportTestPartResult(const TestPartResult& result);
- bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
- private:
- bool has_new_fatal_failure_;
- TestPartResultReporterInterface* original_reporter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-
-// This header implements typed tests and type-parameterized tests.
-
-// Typed (aka type-driven) tests repeat the same test for types in a
-// list. You must know which types you want to test with when writing
-// typed tests. Here's how you do it:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- public:
- ...
- typedef std::list<T> List;
- static T shared_;
- T value_;
-};
-
-// Next, associate a list of types with the test case, which will be
-// repeated for each type in the list. The typedef is necessary for
-// the macro to parse correctly.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-TYPED_TEST_CASE(FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// TYPED_TEST_CASE(FooTest, int);
-
-// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
-// tests for this test case as you want.
-TYPED_TEST(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- // Since we are inside a derived class template, C++ requires use to
- // visit the members of FooTest via 'this'.
- TypeParam n = this->value_;
-
- // To visit static members of the fixture, add the TestFixture::
- // prefix.
- n += TestFixture::shared_;
-
- // To refer to typedefs in the fixture, add the "typename
- // TestFixture::" prefix.
- typename TestFixture::List values;
- values.push_back(n);
- ...
-}
-
-TYPED_TEST(FooTest, HasPropertyA) { ... }
-
-#endif // 0
-
-// Type-parameterized tests are abstract test patterns parameterized
-// by a type. Compared with typed tests, type-parameterized tests
-// allow you to define the test pattern without knowing what the type
-// parameters are. The defined pattern can be instantiated with
-// different types any number of times, in any number of translation
-// units.
-//
-// If you are designing an interface or concept, you can define a
-// suite of type-parameterized tests to verify properties that any
-// valid implementation of the interface/concept should have. Then,
-// each implementation can easily instantiate the test suite to verify
-// that it conforms to the requirements, without having to write
-// similar tests repeatedly. Here's an example:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- ...
-};
-
-// Next, declare that you will define a type-parameterized test case
-// (the _P suffix is for "parameterized" or "pattern", whichever you
-// prefer):
-TYPED_TEST_CASE_P(FooTest);
-
-// Then, use TYPED_TEST_P() to define as many type-parameterized tests
-// for this type-parameterized test case as you want.
-TYPED_TEST_P(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- TypeParam n = 0;
- ...
-}
-
-TYPED_TEST_P(FooTest, HasPropertyA) { ... }
-
-// Now the tricky part: you need to register all test patterns before
-// you can instantiate them. The first argument of the macro is the
-// test case name; the rest are the names of the tests in this test
-// case.
-REGISTER_TYPED_TEST_CASE_P(FooTest,
- DoesBlah, HasPropertyA);
-
-// Finally, you are free to instantiate the pattern with the types you
-// want. If you put the above code in a header file, you can #include
-// it in multiple C++ source files and instantiate it multiple times.
-//
-// To distinguish different instances of the pattern, the first
-// argument to the INSTANTIATE_* macro is a prefix that will be added
-// to the actual test case name. Remember to pick unique prefixes for
-// different instances.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
-
-#endif // 0
-
-
-// Implements typed tests.
-
-#if GTEST_HAS_TYPED_TEST
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the typedef for the type parameters of the
-// given test case.
-# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define TYPED_TEST_CASE(CaseName, Types) \
- typedef ::testing::internal::TypeList< Types >::type \
- GTEST_TYPE_PARAMS_(CaseName)
-
-# define TYPED_TEST(CaseName, TestName) \
- template <typename gtest_TypeParam_> \
- class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
- : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTest< \
- CaseName, \
- ::testing::internal::TemplateSel< \
- GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
- GTEST_TYPE_PARAMS_(CaseName)>::Register(\
- "", #CaseName, #TestName, 0); \
- template <typename gtest_TypeParam_> \
- void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
-
-#endif // GTEST_HAS_TYPED_TEST
-
-// Implements type-parameterized tests.
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the namespace name that the type-parameterized tests for
-// the given type-parameterized test case are defined in. The exact
-// name of the namespace is subject to change without notice.
-# define GTEST_CASE_NAMESPACE_(TestCaseName) \
- gtest_case_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the variable used to remember the names of
-// the defined tests in the given test case.
-# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
- gtest_typed_test_case_p_state_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
-//
-// Expands to the name of the variable used to remember the names of
-// the registered tests in the given test case.
-# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
- gtest_registered_test_names_##TestCaseName##_
-
-// The variables defined in the type-parameterized test macros are
-// static as typically these macros are used in a .h file that can be
-// #included in multiple translation units linked together.
-# define TYPED_TEST_CASE_P(CaseName) \
- static ::testing::internal::TypedTestCasePState \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
-
-# define TYPED_TEST_P(CaseName, TestName) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- template <typename gtest_TypeParam_> \
- class TestName : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
- __FILE__, __LINE__, #CaseName, #TestName); \
- } \
- template <typename gtest_TypeParam_> \
- void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
-
-# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
- } \
- static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
- __FILE__, __LINE__, #__VA_ARGS__)
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
- bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTestCase<CaseName, \
- GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
- ::testing::internal::TypeList< Types >::type>::Register(\
- #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
-
-#endif // GTEST_HAS_TYPED_TEST_P
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-
-// Depending on the platform, different string classes are available.
-// On Linux, in addition to ::std::string, Google also makes use of
-// class ::string, which has the same interface as ::std::string, but
-// has a different implementation.
-//
-// The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
-// ::string is available AND is a distinct type to ::std::string, or
-// define it to 0 to indicate otherwise.
-//
-// If the user's ::std::string and ::string are the same class due to
-// aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
-//
-// If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
-// heuristically.
-
-namespace testing {
-
-// Declares the flags.
-
-// This flag temporary enables the disabled tests.
-GTEST_DECLARE_bool_(also_run_disabled_tests);
-
-// This flag brings the debugger on an assertion failure.
-GTEST_DECLARE_bool_(break_on_failure);
-
-// This flag controls whether Google Test catches all test-thrown exceptions
-// and logs them as failures.
-GTEST_DECLARE_bool_(catch_exceptions);
-
-// This flag enables using colors in terminal output. Available values are
-// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
-// to let Google Test decide.
-GTEST_DECLARE_string_(color);
-
-// This flag sets up the filter to select by name using a glob pattern
-// the tests to run. If the filter is not given all tests are executed.
-GTEST_DECLARE_string_(filter);
-
-// This flag causes the Google Test to list tests. None of the tests listed
-// are actually run if the flag is provided.
-GTEST_DECLARE_bool_(list_tests);
-
-// This flag controls whether Google Test emits a detailed XML report to a file
-// in addition to its normal textual output.
-GTEST_DECLARE_string_(output);
-
-// This flags control whether Google Test prints the elapsed time for each
-// test.
-GTEST_DECLARE_bool_(print_time);
-
-// This flag specifies the random number seed.
-GTEST_DECLARE_int32_(random_seed);
-
-// This flag sets how many times the tests are repeated. The default value
-// is 1. If the value is -1 the tests are repeating forever.
-GTEST_DECLARE_int32_(repeat);
-
-// This flag controls whether Google Test includes Google Test internal
-// stack frames in failure stack traces.
-GTEST_DECLARE_bool_(show_internal_stack_frames);
-
-// When this flag is specified, tests' order is randomized on every iteration.
-GTEST_DECLARE_bool_(shuffle);
-
-// This flag specifies the maximum number of stack frames to be
-// printed in a failure message.
-GTEST_DECLARE_int32_(stack_trace_depth);
-
-// When this flag is specified, a failed assertion will throw an
-// exception if exceptions are enabled, or exit the program with a
-// non-zero code otherwise.
-GTEST_DECLARE_bool_(throw_on_failure);
-
-// When this flag is set with a "host:port" string, on supported
-// platforms test results are streamed to the specified port on
-// the specified host machine.
-GTEST_DECLARE_string_(stream_result_to);
-
-// The upper limit for valid stack trace depths.
-const int kMaxStackTraceDepth = 100;
-
-namespace internal {
-
-class AssertHelper;
-class DefaultGlobalTestPartResultReporter;
-class ExecDeathTest;
-class NoExecDeathTest;
-class FinalSuccessChecker;
-class GTestFlagSaver;
-class StreamingListenerTest;
-class TestResultAccessor;
-class TestEventListenersAccessor;
-class TestEventRepeater;
-class UnitTestRecordPropertyTestHelper;
-class WindowsDeathTest;
-class UnitTestImpl* GetUnitTestImpl();
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
- const std::string& message);
-
-} // namespace internal
-
-// The friend relationship of some of these classes is cyclic.
-// If we don't forward declare them the compiler might confuse the classes
-// in friendship clauses with same named classes on the scope.
-class Test;
-class TestCase;
-class TestInfo;
-class UnitTest;
-
-// A class for indicating whether an assertion was successful. When
-// the assertion wasn't successful, the AssertionResult object
-// remembers a non-empty message that describes how it failed.
-//
-// To create an instance of this class, use one of the factory functions
-// (AssertionSuccess() and AssertionFailure()).
-//
-// This class is useful for two purposes:
-// 1. Defining predicate functions to be used with Boolean test assertions
-// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
-// 2. Defining predicate-format functions to be
-// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
-//
-// For example, if you define IsEven predicate:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
-// will print the message
-//
-// Value of: IsEven(Fib(5))
-// Actual: false (5 is odd)
-// Expected: true
-//
-// instead of a more opaque
-//
-// Value of: IsEven(Fib(5))
-// Actual: false
-// Expected: true
-//
-// in case IsEven is a simple Boolean predicate.
-//
-// If you expect your predicate to be reused and want to support informative
-// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
-// about half as often as positive ones in our tests), supply messages for
-// both success and failure cases:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess() << n << " is even";
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
-//
-// Value of: IsEven(Fib(6))
-// Actual: true (8 is even)
-// Expected: false
-//
-// NB: Predicates that support negative Boolean assertions have reduced
-// performance in positive ones so be careful not to use them in tests
-// that have lots (tens of thousands) of positive Boolean assertions.
-//
-// To use this class with EXPECT_PRED_FORMAT assertions such as:
-//
-// // Verifies that Foo() returns an even number.
-// EXPECT_PRED_FORMAT1(IsEven, Foo());
-//
-// you need to define:
-//
-// testing::AssertionResult IsEven(const char* expr, int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure()
-// << "Expected: " << expr << " is even\n Actual: it's " << n;
-// }
-//
-// If Foo() returns 5, you will see the following message:
-//
-// Expected: Foo() is even
-// Actual: it's 5
-//
-class GTEST_API_ AssertionResult {
- public:
- // Copy constructor.
- // Used in EXPECT_TRUE/FALSE(assertion_result).
- AssertionResult(const AssertionResult& other);
- // Used in the EXPECT_TRUE/FALSE(bool_expression).
- explicit AssertionResult(bool success) : success_(success) {}
-
- // Returns true iff the assertion succeeded.
- operator bool() const { return success_; } // NOLINT
-
- // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
- AssertionResult operator!() const;
-
- // Returns the text streamed into this AssertionResult. Test assertions
- // use it when they fail (i.e., the predicate's outcome doesn't match the
- // assertion's expectation). When nothing has been streamed into the
- // object, returns an empty string.
- const char* message() const {
- return message_.get() != NULL ? message_->c_str() : "";
- }
- // TODO(vladl@google.com): Remove this after making sure no clients use it.
- // Deprecated; please use message() instead.
- const char* failure_message() const { return message(); }
-
- // Streams a custom failure message into this object.
- template <typename T> AssertionResult& operator<<(const T& value) {
- AppendMessage(Message() << value);
- return *this;
- }
-
- // Allows streaming basic output manipulators such as endl or flush into
- // this object.
- AssertionResult& operator<<(
- ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
- AppendMessage(Message() << basic_manipulator);
- return *this;
- }
-
- private:
- // Appends the contents of message to message_.
- void AppendMessage(const Message& a_message) {
- if (message_.get() == NULL)
- message_.reset(new ::std::string);
- message_->append(a_message.GetString().c_str());
- }
-
- // Stores result of the assertion predicate.
- bool success_;
- // Stores the message describing the condition in case the expectation
- // construct is not satisfied with the predicate's outcome.
- // Referenced via a pointer to avoid taking too much stack frame space
- // with test assertions.
- internal::scoped_ptr< ::std::string> message_;
-
- GTEST_DISALLOW_ASSIGN_(AssertionResult);
-};
-
-// Makes a successful assertion result.
-GTEST_API_ AssertionResult AssertionSuccess();
-
-// Makes a failed assertion result.
-GTEST_API_ AssertionResult AssertionFailure();
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << msg.
-GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
-
-// The abstract class that all tests inherit from.
-//
-// In Google Test, a unit test program contains one or many TestCases, and
-// each TestCase contains one or many Tests.
-//
-// When you define a test using the TEST macro, you don't need to
-// explicitly derive from Test - the TEST macro automatically does
-// this for you.
-//
-// The only time you derive from Test is when defining a test fixture
-// to be used a TEST_F. For example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// virtual void SetUp() { ... }
-// virtual void TearDown() { ... }
-// ...
-// };
-//
-// TEST_F(FooTest, Bar) { ... }
-// TEST_F(FooTest, Baz) { ... }
-//
-// Test is not copyable.
-class GTEST_API_ Test {
- public:
- friend class TestInfo;
-
- // Defines types for pointers to functions that set up and tear down
- // a test case.
- typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
- typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
-
- // The d'tor is virtual as we intend to inherit from Test.
- virtual ~Test();
-
- // Sets up the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::SetUpTestCase() before running the first
- // test in test case Foo. Hence a sub-class can define its own
- // SetUpTestCase() method to shadow the one defined in the super
- // class.
- static void SetUpTestCase() {}
-
- // Tears down the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::TearDownTestCase() after running the last
- // test in test case Foo. Hence a sub-class can define its own
- // TearDownTestCase() method to shadow the one defined in the super
- // class.
- static void TearDownTestCase() {}
-
- // Returns true iff the current test has a fatal failure.
- static bool HasFatalFailure();
-
- // Returns true iff the current test has a non-fatal failure.
- static bool HasNonfatalFailure();
-
- // Returns true iff the current test has a (either fatal or
- // non-fatal) failure.
- static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
-
- // Logs a property for the current test, test case, or for the entire
- // invocation of the test program when used outside of the context of a
- // test case. Only the last value for a given key is remembered. These
- // are public static so they can be called from utility functions that are
- // not members of the test fixture. Calls to RecordProperty made during
- // lifespan of the test (from the moment its constructor starts to the
- // moment its destructor finishes) will be output in XML as attributes of
- // the <testcase> element. Properties recorded from fixture's
- // SetUpTestCase or TearDownTestCase are logged as attributes of the
- // corresponding <testsuite> element. Calls to RecordProperty made in the
- // global context (before or after invocation of RUN_ALL_TESTS and from
- // SetUp/TearDown method of Environment objects registered with Google
- // Test) will be output as attributes of the <testsuites> element.
- static void RecordProperty(const std::string& key, const std::string& value);
- static void RecordProperty(const std::string& key, int value);
-
- protected:
- // Creates a Test object.
- Test();
-
- // Sets up the test fixture.
- virtual void SetUp();
-
- // Tears down the test fixture.
- virtual void TearDown();
-
- private:
- // Returns true iff the current test has the same fixture class as
- // the first test in the current test case.
- static bool HasSameFixtureClass();
-
- // Runs the test after the test fixture has been set up.
- //
- // A sub-class must implement this to define the test logic.
- //
- // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
- // Instead, use the TEST or TEST_F macro.
- virtual void TestBody() = 0;
-
- // Sets up, executes, and tears down the test.
- void Run();
-
- // Deletes self. We deliberately pick an unusual name for this
- // internal method to avoid clashing with names used in user TESTs.
- void DeleteSelf_() { delete this; }
-
- // Uses a GTestFlagSaver to save and restore all Google Test flags.
- const internal::GTestFlagSaver* const gtest_flag_saver_;
-
- // Often a user mis-spells SetUp() as Setup() and spends a long time
- // wondering why it is never called by Google Test. The declaration of
- // the following method is solely for catching such an error at
- // compile time:
- //
- // - The return type is deliberately chosen to be not void, so it
- // will be a conflict if a user declares void Setup() in his test
- // fixture.
- //
- // - This method is private, so it will be another compiler error
- // if a user calls it from his test fixture.
- //
- // DO NOT OVERRIDE THIS FUNCTION.
- //
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-
- // We disallow copying Tests.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
-};
-
-typedef internal::TimeInMillis TimeInMillis;
-
-// A copyable object representing a user specified test property which can be
-// output as a key/value string pair.
-//
-// Don't inherit from TestProperty as its destructor is not virtual.
-class TestProperty {
- public:
- // C'tor. TestProperty does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestProperty object.
- TestProperty(const std::string& a_key, const std::string& a_value) :
- key_(a_key), value_(a_value) {
- }
-
- // Gets the user supplied key.
- const char* key() const {
- return key_.c_str();
- }
-
- // Gets the user supplied value.
- const char* value() const {
- return value_.c_str();
- }
-
- // Sets a new value, overriding the one supplied in the constructor.
- void SetValue(const std::string& new_value) {
- value_ = new_value;
- }
-
- private:
- // The key supplied by the user.
- std::string key_;
- // The value supplied by the user.
- std::string value_;
-};
-
-// The result of a single Test. This includes a list of
-// TestPartResults, a list of TestProperties, a count of how many
-// death tests there are in the Test, and how much time it took to run
-// the Test.
-//
-// TestResult is not copyable.
-class GTEST_API_ TestResult {
- public:
- // Creates an empty TestResult.
- TestResult();
-
- // D'tor. Do not inherit from TestResult.
- ~TestResult();
-
- // Gets the number of all test parts. This is the sum of the number
- // of successful test parts and the number of failed test parts.
- int total_part_count() const;
-
- // Returns the number of the test properties.
- int test_property_count() const;
-
- // Returns true iff the test passed (i.e. no test part failed).
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test failed.
- bool Failed() const;
-
- // Returns true iff the test fatally failed.
- bool HasFatalFailure() const;
-
- // Returns true iff the test has a non-fatal failure.
- bool HasNonfatalFailure() const;
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test part result among all the results. i can range
- // from 0 to test_property_count() - 1. If i is not in that range, aborts
- // the program.
- const TestPartResult& GetTestPartResult(int i) const;
-
- // Returns the i-th test property. i can range from 0 to
- // test_property_count() - 1. If i is not in that range, aborts the
- // program.
- const TestProperty& GetTestProperty(int i) const;
-
- private:
- friend class TestInfo;
- friend class TestCase;
- friend class UnitTest;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::ExecDeathTest;
- friend class internal::TestResultAccessor;
- friend class internal::UnitTestImpl;
- friend class internal::WindowsDeathTest;
-
- // Gets the vector of TestPartResults.
- const std::vector<TestPartResult>& test_part_results() const {
- return test_part_results_;
- }
-
- // Gets the vector of TestProperties.
- const std::vector<TestProperty>& test_properties() const {
- return test_properties_;
- }
-
- // Sets the elapsed time.
- void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
-
- // Adds a test property to the list. The property is validated and may add
- // a non-fatal failure if invalid (e.g., if it conflicts with reserved
- // key names). If a property is already recorded for the same key, the
- // value will be updated, rather than storing multiple values for the same
- // key. xml_element specifies the element for which the property is being
- // recorded and is used for validation.
- void RecordProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a failure if the key is a reserved attribute of Google Test
- // testcase tags. Returns true if the property is valid.
- // TODO(russr): Validate attribute names are legal and human readable.
- static bool ValidateTestProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a test part result to the list.
- void AddTestPartResult(const TestPartResult& test_part_result);
-
- // Returns the death test count.
- int death_test_count() const { return death_test_count_; }
-
- // Increments the death test count, returning the new count.
- int increment_death_test_count() { return ++death_test_count_; }
-
- // Clears the test part results.
- void ClearTestPartResults();
-
- // Clears the object.
- void Clear();
-
- // Protects mutable state of the property vector and of owned
- // properties, whose values may be updated.
- internal::Mutex test_properites_mutex_;
-
- // The vector of TestPartResults
- std::vector<TestPartResult> test_part_results_;
- // The vector of TestProperties
- std::vector<TestProperty> test_properties_;
- // Running count of death tests.
- int death_test_count_;
- // The elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
-
- // We disallow copying TestResult.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
-}; // class TestResult
-
-// A TestInfo object stores the following information about a test:
-//
-// Test case name
-// Test name
-// Whether the test should be run
-// A function pointer that creates the test object when invoked
-// Test result
-//
-// The constructor of TestInfo registers itself with the UnitTest
-// singleton such that the RUN_ALL_TESTS() macro knows which tests to
-// run.
-class GTEST_API_ TestInfo {
- public:
- // Destructs a TestInfo object. This function is not virtual, so
- // don't inherit from TestInfo.
- ~TestInfo();
-
- // Returns the test case name.
- const char* test_case_name() const { return test_case_name_.c_str(); }
-
- // Returns the test name.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a typed
- // or a type-parameterized test.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns the text representation of the value parameter, or NULL if this
- // is not a value-parameterized test.
- const char* value_param() const {
- if (value_param_.get() != NULL)
- return value_param_->c_str();
- return NULL;
- }
-
- // Returns true if this test should run, that is if the test is not
- // disabled (or it is disabled but the also_run_disabled_tests flag has
- // been specified) and its full name matches the user-specified filter.
- //
- // Google Test allows the user to filter the tests by their full names.
- // The full name of a test Bar in test case Foo is defined as
- // "Foo.Bar". Only the tests that match the filter will run.
- //
- // A filter is a colon-separated list of glob (not regex) patterns,
- // optionally followed by a '-' and a colon-separated list of
- // negative patterns (tests to exclude). A test is run if it
- // matches one of the positive patterns and does not match any of
- // the negative patterns.
- //
- // For example, *A*:Foo.* is a filter that matches any string that
- // contains the character 'A' or starts with "Foo.".
- bool should_run() const { return should_run_; }
-
- // Returns true iff this test will appear in the XML report.
- bool is_reportable() const {
- // For now, the XML report includes all tests matching the filter.
- // In the future, we may trim tests that are excluded because of
- // sharding.
- return matches_filter_;
- }
-
- // Returns the result of the test.
- const TestResult* result() const { return &result_; }
-
- private:
-#if GTEST_HAS_DEATH_TEST
- friend class internal::DefaultDeathTestFactory;
-#endif // GTEST_HAS_DEATH_TEST
- friend class Test;
- friend class TestCase;
- friend class internal::UnitTestImpl;
- friend class internal::StreamingListenerTest;
- friend TestInfo* internal::MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- internal::TypeId fixture_class_id,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc,
- internal::TestFactoryBase* factory);
-
- // Constructs a TestInfo object. The newly constructed instance assumes
- // ownership of the factory object.
- TestInfo(const std::string& test_case_name,
- const std::string& name,
- const char* a_type_param, // NULL if not a type-parameterized test
- const char* a_value_param, // NULL if not a value-parameterized test
- internal::TypeId fixture_class_id,
- internal::TestFactoryBase* factory);
-
- // Increments the number of death tests encountered in this test so
- // far.
- int increment_death_test_count() {
- return result_.increment_death_test_count();
- }
-
- // Creates the test object, runs it, records its result, and then
- // deletes it.
- void Run();
-
- static void ClearTestResult(TestInfo* test_info) {
- test_info->result_.Clear();
- }
-
- // These fields are immutable properties of the test.
- const std::string test_case_name_; // Test case name
- const std::string name_; // Test name
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // Text representation of the value parameter, or NULL if this is not a
- // value-parameterized test.
- const internal::scoped_ptr<const ::std::string> value_param_;
- const internal::TypeId fixture_class_id_; // ID of the test fixture class
- bool should_run_; // True iff this test should run
- bool is_disabled_; // True iff this test is disabled
- bool matches_filter_; // True if this test matches the
- // user-specified filter.
- internal::TestFactoryBase* const factory_; // The factory that creates
- // the test object
-
- // This field is mutable and needs to be reset before running the
- // test for the second time.
- TestResult result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
-};
-
-// A test case, which consists of a vector of TestInfos.
-//
-// TestCase is not copyable.
-class GTEST_API_ TestCase {
- public:
- // Creates a TestCase with the given name.
- //
- // TestCase does NOT have a default constructor. Always use this
- // constructor to create a TestCase object.
- //
- // Arguments:
- //
- // name: name of the test case
- // a_type_param: the name of the test's type parameter, or NULL if
- // this is not a type-parameterized test.
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- TestCase(const char* name, const char* a_type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc);
-
- // Destructor of TestCase.
- virtual ~TestCase();
-
- // Gets the name of the TestCase.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a
- // type-parameterized test case.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns true if any test in this test case should run.
- bool should_run() const { return should_run_; }
-
- // Gets the number of successful tests in this test case.
- int successful_test_count() const;
-
- // Gets the number of failed tests in this test case.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests in this test case.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Get the number of tests in this test case that should run.
- int test_to_run_count() const;
-
- // Gets the number of all tests in this test case.
- int total_test_count() const;
-
- // Returns true iff the test case passed.
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test case failed.
- bool Failed() const { return failed_test_count() > 0; }
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- const TestInfo* GetTestInfo(int i) const;
-
- // Returns the TestResult that holds test properties recorded during
- // execution of SetUpTestCase and TearDownTestCase.
- const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
-
- private:
- friend class Test;
- friend class internal::UnitTestImpl;
-
- // Gets the (mutable) vector of TestInfos in this TestCase.
- std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
-
- // Gets the (immutable) vector of TestInfos in this TestCase.
- const std::vector<TestInfo*>& test_info_list() const {
- return test_info_list_;
- }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- TestInfo* GetMutableTestInfo(int i);
-
- // Sets the should_run member.
- void set_should_run(bool should) { should_run_ = should; }
-
- // Adds a TestInfo to this test case. Will delete the TestInfo upon
- // destruction of the TestCase object.
- void AddTestInfo(TestInfo * test_info);
-
- // Clears the results of all tests in this test case.
- void ClearResult();
-
- // Clears the results of all tests in the given test case.
- static void ClearTestCaseResult(TestCase* test_case) {
- test_case->ClearResult();
- }
-
- // Runs every test in this TestCase.
- void Run();
-
- // Runs SetUpTestCase() for this TestCase. This wrapper is needed
- // for catching exceptions thrown from SetUpTestCase().
- void RunSetUpTestCase() { (*set_up_tc_)(); }
-
- // Runs TearDownTestCase() for this TestCase. This wrapper is
- // needed for catching exceptions thrown from TearDownTestCase().
- void RunTearDownTestCase() { (*tear_down_tc_)(); }
-
- // Returns true iff test passed.
- static bool TestPassed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Passed();
- }
-
- // Returns true iff test failed.
- static bool TestFailed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Failed();
- }
-
- // Returns true iff the test is disabled and will be reported in the XML
- // report.
- static bool TestReportableDisabled(const TestInfo* test_info) {
- return test_info->is_reportable() && test_info->is_disabled_;
- }
-
- // Returns true iff test is disabled.
- static bool TestDisabled(const TestInfo* test_info) {
- return test_info->is_disabled_;
- }
-
- // Returns true iff this test will appear in the XML report.
- static bool TestReportable(const TestInfo* test_info) {
- return test_info->is_reportable();
- }
-
- // Returns true if the given test should run.
- static bool ShouldRunTest(const TestInfo* test_info) {
- return test_info->should_run();
- }
-
- // Shuffles the tests in this test case.
- void ShuffleTests(internal::Random* random);
-
- // Restores the test order to before the first shuffle.
- void UnshuffleTests();
-
- // Name of the test case.
- std::string name_;
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // The vector of TestInfos in their original order. It owns the
- // elements in the vector.
- std::vector<TestInfo*> test_info_list_;
- // Provides a level of indirection for the test list to allow easy
- // shuffling and restoring the test order. The i-th element in this
- // vector is the index of the i-th test in the shuffled test list.
- std::vector<int> test_indices_;
- // Pointer to the function that sets up the test case.
- Test::SetUpTestCaseFunc set_up_tc_;
- // Pointer to the function that tears down the test case.
- Test::TearDownTestCaseFunc tear_down_tc_;
- // True iff any test in this test case should run.
- bool should_run_;
- // Elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
- // Holds test properties recorded during execution of SetUpTestCase and
- // TearDownTestCase.
- TestResult ad_hoc_test_result_;
-
- // We disallow copying TestCases.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
-};
-
-// An Environment object is capable of setting up and tearing down an
-// environment. The user should subclass this to define his own
-// environment(s).
-//
-// An Environment object does the set-up and tear-down in virtual
-// methods SetUp() and TearDown() instead of the constructor and the
-// destructor, as:
-//
-// 1. You cannot safely throw from a destructor. This is a problem
-// as in some cases Google Test is used where exceptions are enabled, and
-// we may want to implement ASSERT_* using exceptions where they are
-// available.
-// 2. You cannot use ASSERT_* directly in a constructor or
-// destructor.
-class Environment {
- public:
- // The d'tor is virtual as we need to subclass Environment.
- virtual ~Environment() {}
-
- // Override this to define how to set up the environment.
- virtual void SetUp() {}
-
- // Override this to define how to tear down the environment.
- virtual void TearDown() {}
- private:
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-};
-
-// The interface for tracing execution of tests. The methods are organized in
-// the order the corresponding events are fired.
-class TestEventListener {
- public:
- virtual ~TestEventListener() {}
-
- // Fired before any test activity starts.
- virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
-
- // Fired before each iteration of tests starts. There may be more than
- // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
- // index, starting from 0.
- virtual void OnTestIterationStart(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired before environment set-up for each iteration of tests starts.
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment set-up for each iteration of tests ends.
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
-
- // Fired before the test case starts.
- virtual void OnTestCaseStart(const TestCase& test_case) = 0;
-
- // Fired before the test starts.
- virtual void OnTestStart(const TestInfo& test_info) = 0;
-
- // Fired after a failed assertion or a SUCCEED() invocation.
- virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
-
- // Fired after the test ends.
- virtual void OnTestEnd(const TestInfo& test_info) = 0;
-
- // Fired after the test case ends.
- virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
-
- // Fired before environment tear-down for each iteration of tests starts.
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment tear-down for each iteration of tests ends.
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
-
- // Fired after each iteration of tests finishes.
- virtual void OnTestIterationEnd(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired after all test activities have ended.
- virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
-};
-
-// The convenience class for users who need to override just one or two
-// methods and are not concerned that a possible change to a signature of
-// the methods they override will not be caught during the build. For
-// comments about each method please see the definition of TestEventListener
-// above.
-class EmptyTestEventListener : public TestEventListener {
- public:
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
- virtual void OnTestStart(const TestInfo& /*test_info*/) {}
- virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
- virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
- virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
- virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-};
-
-// TestEventListeners lets users add listeners to track events in Google Test.
-class GTEST_API_ TestEventListeners {
- public:
- TestEventListeners();
- ~TestEventListeners();
-
- // Appends an event listener to the end of the list. Google Test assumes
- // the ownership of the listener (i.e. it will delete the listener when
- // the test program finishes).
- void Append(TestEventListener* listener);
-
- // Removes the given event listener from the list and returns it. It then
- // becomes the caller's responsibility to delete the listener. Returns
- // NULL if the listener is not found in the list.
- TestEventListener* Release(TestEventListener* listener);
-
- // Returns the standard listener responsible for the default console
- // output. Can be removed from the listeners list to shut down default
- // console output. Note that removing this object from the listener list
- // with Release transfers its ownership to the caller and makes this
- // function return NULL the next time.
- TestEventListener* default_result_printer() const {
- return default_result_printer_;
- }
-
- // Returns the standard listener responsible for the default XML output
- // controlled by the --gtest_output=xml flag. Can be removed from the
- // listeners list by users who want to shut down the default XML output
- // controlled by this flag and substitute it with custom one. Note that
- // removing this object from the listener list with Release transfers its
- // ownership to the caller and makes this function return NULL the next
- // time.
- TestEventListener* default_xml_generator() const {
- return default_xml_generator_;
- }
-
- private:
- friend class TestCase;
- friend class TestInfo;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::NoExecDeathTest;
- friend class internal::TestEventListenersAccessor;
- friend class internal::UnitTestImpl;
-
- // Returns repeater that broadcasts the TestEventListener events to all
- // subscribers.
- TestEventListener* repeater();
-
- // Sets the default_result_printer attribute to the provided listener.
- // The listener is also added to the listener list and previous
- // default_result_printer is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultResultPrinter(TestEventListener* listener);
-
- // Sets the default_xml_generator attribute to the provided listener. The
- // listener is also added to the listener list and previous
- // default_xml_generator is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultXmlGenerator(TestEventListener* listener);
-
- // Controls whether events will be forwarded by the repeater to the
- // listeners in the list.
- bool EventForwardingEnabled() const;
- void SuppressEventForwarding();
-
- // The actual list of listeners.
- internal::TestEventRepeater* repeater_;
- // Listener responsible for the standard result output.
- TestEventListener* default_result_printer_;
- // Listener responsible for the creation of the XML output file.
- TestEventListener* default_xml_generator_;
-
- // We disallow copying TestEventListeners.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
-};
-
-// A UnitTest consists of a vector of TestCases.
-//
-// This is a singleton class. The only instance of UnitTest is
-// created when UnitTest::GetInstance() is first called. This
-// instance is never deleted.
-//
-// UnitTest is not copyable.
-//
-// This class is thread-safe as long as the methods are called
-// according to their specification.
-class GTEST_API_ UnitTest {
- public:
- // Gets the singleton UnitTest object. The first time this method
- // is called, a UnitTest object is constructed and returned.
- // Consecutive calls will return the same object.
- static UnitTest* GetInstance();
-
- // Runs all tests in this UnitTest object and prints the result.
- // Returns 0 if successful, or 1 otherwise.
- //
- // This method can only be called from the main thread.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- int Run() GTEST_MUST_USE_RESULT_;
-
- // Returns the working directory when the first TEST() or TEST_F()
- // was executed. The UnitTest object owns the string.
- const char* original_working_dir() const;
-
- // Returns the TestCase object for the test that's currently running,
- // or NULL if no test is running.
- const TestCase* current_test_case() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the TestInfo object for the test that's currently running,
- // or NULL if no test is running.
- const TestInfo* current_test_info() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the random seed used at the start of the current test run.
- int random_seed() const;
-
-#if GTEST_HAS_PARAM_TEST
- // Returns the ParameterizedTestCaseRegistry object used to keep track of
- // value-parameterized tests and instantiate and register them.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
- GTEST_LOCK_EXCLUDED_(mutex_);
-#endif // GTEST_HAS_PARAM_TEST
-
- // Gets the number of successful test cases.
- int successful_test_case_count() const;
-
- // Gets the number of failed test cases.
- int failed_test_case_count() const;
-
- // Gets the number of all test cases.
- int total_test_case_count() const;
-
- // Gets the number of all test cases that contain at least one test
- // that should run.
- int test_case_to_run_count() const;
-
- // Gets the number of successful tests.
- int successful_test_count() const;
-
- // Gets the number of failed tests.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Gets the number of all tests.
- int total_test_count() const;
-
- // Gets the number of tests that should run.
- int test_to_run_count() const;
-
- // Gets the time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp() const;
-
- // Gets the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const;
-
- // Returns true iff the unit test passed (i.e. all test cases passed).
- bool Passed() const;
-
- // Returns true iff the unit test failed (i.e. some test case failed
- // or something outside of all tests failed).
- bool Failed() const;
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- const TestCase* GetTestCase(int i) const;
-
- // Returns the TestResult containing information on test failures and
- // properties logged outside of individual test cases.
- const TestResult& ad_hoc_test_result() const;
-
- // Returns the list of event listeners that can be used to track events
- // inside Google Test.
- TestEventListeners& listeners();
-
- private:
- // Registers and returns a global test environment. When a test
- // program is run, all global test environments will be set-up in
- // the order they were registered. After all tests in the program
- // have finished, all global test environments will be torn-down in
- // the *reverse* order they were registered.
- //
- // The UnitTest object takes ownership of the given environment.
- //
- // This method can only be called from the main thread.
- Environment* AddEnvironment(Environment* env);
-
- // Adds a TestPartResult to the current TestResult object. All
- // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
- // eventually call this to report their results. The user code
- // should use the assertion macros instead of calling this directly.
- void AddTestPartResult(TestPartResult::Type result_type,
- const char* file_name,
- int line_number,
- const std::string& message,
- const std::string& os_stack_trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Adds a TestProperty to the current TestResult object when invoked from
- // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
- // from SetUpTestCase or TearDownTestCase, or to the global property set
- // when invoked elsewhere. If the result already contains a property with
- // the same key, the value will be updated.
- void RecordProperty(const std::string& key, const std::string& value);
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- TestCase* GetMutableTestCase(int i);
-
- // Accessors for the implementation object.
- internal::UnitTestImpl* impl() { return impl_; }
- const internal::UnitTestImpl* impl() const { return impl_; }
-
- // These classes and funcions are friends as they need to access private
- // members of UnitTest.
- friend class Test;
- friend class internal::AssertHelper;
- friend class internal::ScopedTrace;
- friend class internal::StreamingListenerTest;
- friend class internal::UnitTestRecordPropertyTestHelper;
- friend Environment* AddGlobalTestEnvironment(Environment* env);
- friend internal::UnitTestImpl* internal::GetUnitTestImpl();
- friend void internal::ReportFailureInUnknownLocation(
- TestPartResult::Type result_type,
- const std::string& message);
-
- // Creates an empty UnitTest.
- UnitTest();
-
- // D'tor
- virtual ~UnitTest();
-
- // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
- // Google Test trace stack.
- void PushGTestTrace(const internal::TraceInfo& trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Pops a trace from the per-thread Google Test trace stack.
- void PopGTestTrace()
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Protects mutable state in *impl_. This is mutable as some const
- // methods need to lock it too.
- mutable internal::Mutex mutex_;
-
- // Opaque implementation object. This field is never changed once
- // the object is constructed. We don't mark it as const here, as
- // doing so will cause a warning in the constructor of UnitTest.
- // Mutable state in *impl_ is protected by mutex_.
- internal::UnitTestImpl* impl_;
-
- // We disallow copying UnitTest.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
-};
-
-// A convenient wrapper for adding an environment for the test
-// program.
-//
-// You should call this before RUN_ALL_TESTS() is called, probably in
-// main(). If you use gtest_main, you need to call this before main()
-// starts for it to take effect. For example, you can define a global
-// variable like this:
-//
-// testing::Environment* const foo_env =
-// testing::AddGlobalTestEnvironment(new FooEnvironment);
-//
-// However, we strongly recommend you to write your own main() and
-// call AddGlobalTestEnvironment() there, as relying on initialization
-// of global variables makes the code harder to read and may cause
-// problems when you register multiple environments from different
-// translation units and the environments have dependencies among them
-// (remember that the compiler doesn't guarantee the order in which
-// global variables from different translation units are initialized).
-inline Environment* AddGlobalTestEnvironment(Environment* env) {
- return UnitTest::GetInstance()->AddEnvironment(env);
-}
-
-// Initializes Google Test. This must be called before calling
-// RUN_ALL_TESTS(). In particular, it parses a command line for the
-// flags that Google Test recognizes. Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-GTEST_API_ void InitGoogleTest(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
-
-namespace internal {
-
-// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
-// value of type ToPrint that is an operand of a comparison assertion
-// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
-// the comparison, and is used to help determine the best way to
-// format the value. In particular, when the value is a C string
-// (char pointer) and the other operand is an STL string object, we
-// want to format the C string as a string, since we know it is
-// compared by value with the string object. If the value is a char
-// pointer but the other operand is not an STL string object, we don't
-// know whether the pointer is supposed to point to a NUL-terminated
-// string, and thus want to print it as a pointer to be safe.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// The default case.
-template <typename ToPrint, typename OtherOperand>
-class FormatForComparison {
- public:
- static ::std::string Format(const ToPrint& value) {
- return ::testing::PrintToString(value);
- }
-};
-
-// Array.
-template <typename ToPrint, size_t N, typename OtherOperand>
-class FormatForComparison<ToPrint[N], OtherOperand> {
- public:
- static ::std::string Format(const ToPrint* value) {
- return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
- }
-};
-
-// By default, print C string as pointers to be safe, as we don't know
-// whether they actually point to a NUL-terminated string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
- template <typename OtherOperand> \
- class FormatForComparison<CharType*, OtherOperand> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(static_cast<const void*>(value)); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
-
-// If a C string is compared with an STL string object, we know it's meant
-// to point to a NUL-terminated string, and thus can print it as a string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
- template <> \
- class FormatForComparison<CharType*, OtherStringType> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(value); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
-
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
-#endif
-
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
-#endif
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
-#endif
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
-
-// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
-// operand to be used in a failure message. The type (but not value)
-// of the other operand may affect the format. This allows us to
-// print a char* as a raw pointer when it is compared against another
-// char* or void*, and print it as a C string when it is compared
-// against an std::string object, for example.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename T1, typename T2>
-std::string FormatForComparisonFailureMessage(
- const T1& value, const T2& /* other_operand */) {
- return FormatForComparison<T1, T2>::Format(value);
-}
-
-// The helper function for {ASSERT|EXPECT}_EQ.
-template <typename T1, typename T2>
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4389) // Temporarily disables warning on
- // signed/unsigned mismatch.
-#endif
-
- if (expected == actual) {
- return AssertionSuccess();
- }
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif
-
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
- false);
-}
-
-// With this overloaded version, we allow anonymous enums to be used
-// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
-// can be implicitly cast to BiggestInt.
-GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual);
-
-// The helper class for {ASSERT|EXPECT}_EQ. The template argument
-// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
-// is a null pointer literal. The following default implementation is
-// for lhs_is_null_literal being false.
-template <bool lhs_is_null_literal>
-class EqHelper {
- public:
- // This templatized version is for the general case.
- template <typename T1, typename T2>
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-
- // With this overloaded version, we allow anonymous enums to be used
- // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
- // enums can be implicitly cast to BiggestInt.
- //
- // Even though its body looks the same as the above version, we
- // cannot merge the two, as it will make anonymous enums unhappy.
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-};
-
-// This specialization is used when the first argument to ASSERT_EQ()
-// is a null pointer literal, like NULL, false, or 0.
-template <>
-class EqHelper<true> {
- public:
- // We define two overloaded versions of Compare(). The first
- // version will be picked when the second argument to ASSERT_EQ() is
- // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
- // EXPECT_EQ(false, a_bool).
- template <typename T1, typename T2>
- static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual,
- // The following line prevents this overload from being considered if T2
- // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr)
- // expands to Compare("", "", NULL, my_ptr), which requires a conversion
- // to match the Secret* in the other overload, which would otherwise make
- // this template match better.
- typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
- }
-
- // This version will be picked when the second argument to ASSERT_EQ() is a
- // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
- template <typename T>
- static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
- // We used to have a second template parameter instead of Secret*. That
- // template parameter would deduce to 'long', making this a better match
- // than the first overload even without the first overload's EnableIf.
- // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
- // non-pointer argument" (even a deduced integral argument), so the old
- // implementation caused warnings in user code.
- Secret* /* expected (NULL) */,
- T* actual) {
- // We already know that 'expected' is a null pointer.
- return CmpHelperEQ(expected_expression, actual_expression,
- static_cast<T*>(NULL), actual);
- }
-};
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
-// of similar code.
-//
-// For each templatized helper function, we also define an overloaded
-// version for BiggestInt in order to reduce code bloat and allow
-// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
-// with gcc 4.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-template <typename T1, typename T2>\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
- const T1& val1, const T2& val2) {\
- if (val1 op val2) {\
- return AssertionSuccess();\
- } else {\
- return AssertionFailure() \
- << "Expected: (" << expr1 << ") " #op " (" << expr2\
- << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
- << " vs " << FormatForComparisonFailureMessage(val2, val1);\
- }\
-}\
-GTEST_API_ AssertionResult CmpHelper##op_name(\
- const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// Implements the helper function for {ASSERT|EXPECT}_NE
-GTEST_IMPL_CMP_HELPER_(NE, !=);
-// Implements the helper function for {ASSERT|EXPECT}_LE
-GTEST_IMPL_CMP_HELPER_(LE, <=);
-// Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, <);
-// Implements the helper function for {ASSERT|EXPECT}_GE
-GTEST_IMPL_CMP_HELPER_(GE, >=);
-// Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, >);
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-
-// Helper function for *_STREQ on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual);
-
-// Helper function for *_STRNE on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2);
-
-} // namespace internal
-
-// IsSubstring() and IsNotSubstring() are intended to be used as the
-// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
-// themselves. They check whether needle is a substring of haystack
-// (NULL is considered a substring of itself only), and return an
-// appropriate error message when they fail.
-//
-// The {needle,haystack}_expr arguments are the stringified
-// expressions that generated the two real arguments.
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-#endif // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-// Helper template function for comparing floating-points.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename RawType>
-AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
- const char* actual_expression,
- RawType expected,
- RawType actual) {
- const FloatingPoint<RawType> lhs(expected), rhs(actual);
-
- if (lhs.AlmostEquals(rhs)) {
- return AssertionSuccess();
- }
-
- ::std::stringstream expected_ss;
- expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << expected;
-
- ::std::stringstream actual_ss;
- actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << actual;
-
- return EqFailure(expected_expression,
- actual_expression,
- StringStreamToString(&expected_ss),
- StringStreamToString(&actual_ss),
- false);
-}
-
-// Helper function for implementing ASSERT_NEAR.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error);
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-// A class that enables one to stream messages to assertion macros
-class GTEST_API_ AssertHelper {
- public:
- // Constructor.
- AssertHelper(TestPartResult::Type type,
- const char* file,
- int line,
- const char* message);
- ~AssertHelper();
-
- // Message assignment is a semantic trick to enable assertion
- // streaming; see the GTEST_MESSAGE_ macro below.
- void operator=(const Message& message) const;
-
- private:
- // We put our data in a struct so that the size of the AssertHelper class can
- // be as small as possible. This is important because gcc is incapable of
- // re-using stack space even for temporary variables, so every EXPECT_EQ
- // reserves stack space for another AssertHelper.
- struct AssertHelperData {
- AssertHelperData(TestPartResult::Type t,
- const char* srcfile,
- int line_num,
- const char* msg)
- : type(t), file(srcfile), line(line_num), message(msg) { }
-
- TestPartResult::Type const type;
- const char* const file;
- int const line;
- std::string const message;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
- };
-
- AssertHelperData* const data_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
-};
-
-} // namespace internal
-
-#if GTEST_HAS_PARAM_TEST
-// The pure interface class that all value-parameterized tests inherit from.
-// A value-parameterized class must inherit from both ::testing::Test and
-// ::testing::WithParamInterface. In most cases that just means inheriting
-// from ::testing::TestWithParam, but more complicated test hierarchies
-// may need to inherit from Test and WithParamInterface at different levels.
-//
-// This interface has support for accessing the test parameter value via
-// the GetParam() method.
-//
-// Use it with one of the parameter generator defining functions, like Range(),
-// Values(), ValuesIn(), Bool(), and Combine().
-//
-// class FooTest : public ::testing::TestWithParam<int> {
-// protected:
-// FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual ~FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual void SetUp() {
-// // Can use GetParam() here.
-// }
-// virtual void TearDown {
-// // Can use GetParam() here.
-// }
-// };
-// TEST_P(FooTest, DoesBar) {
-// // Can use GetParam() method here.
-// Foo foo;
-// ASSERT_TRUE(foo.DoesBar(GetParam()));
-// }
-// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
-
-template <typename T>
-class WithParamInterface {
- public:
- typedef T ParamType;
- virtual ~WithParamInterface() {}
-
- // The current parameter value. Is also available in the test fixture's
- // constructor. This member function is non-static, even though it only
- // references static data, to reduce the opportunity for incorrect uses
- // like writing 'WithParamInterface<bool>::GetParam()' for a test that
- // uses a fixture whose parameter type is int.
- const ParamType& GetParam() const {
- GTEST_CHECK_(parameter_ != NULL)
- << "GetParam() can only be called inside a value-parameterized test "
- << "-- did you intend to write TEST_P instead of TEST_F?";
- return *parameter_;
- }
-
- private:
- // Sets parameter value. The caller is responsible for making sure the value
- // remains alive and unchanged throughout the current test.
- static void SetParam(const ParamType* parameter) {
- parameter_ = parameter;
- }
-
- // Static value used for accessing parameter during a test lifetime.
- static const ParamType* parameter_;
-
- // TestClass must be a subclass of WithParamInterface<T> and Test.
- template <class TestClass> friend class internal::ParameterizedTestFactory;
-};
-
-template <typename T>
-const T* WithParamInterface<T>::parameter_ = NULL;
-
-// Most value-parameterized classes can ignore the existence of
-// WithParamInterface, and can just inherit from ::testing::TestWithParam.
-
-template <typename T>
-class TestWithParam : public Test, public WithParamInterface<T> {
-};
-
-#endif // GTEST_HAS_PARAM_TEST
-
-// Macros for indicating success/failure in test code.
-
-// ADD_FAILURE unconditionally adds a failure to the current test.
-// SUCCEED generates a success - it doesn't automatically make the
-// current test successful, as a test is only successful when it has
-// no failure.
-//
-// EXPECT_* verifies that a certain condition is satisfied. If not,
-// it behaves like ADD_FAILURE. In particular:
-//
-// EXPECT_TRUE verifies that a Boolean condition is true.
-// EXPECT_FALSE verifies that a Boolean condition is false.
-//
-// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
-// that they will also abort the current function on failure. People
-// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
-// writing data-driven tests often find themselves using ADD_FAILURE
-// and EXPECT_* more.
-
-// Generates a nonfatal failure with a generic message.
-#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
-
-// Generates a nonfatal failure at the given source file location with
-// a generic message.
-#define ADD_FAILURE_AT(file, line) \
- GTEST_MESSAGE_AT_(file, line, "Failed", \
- ::testing::TestPartResult::kNonFatalFailure)
-
-// Generates a fatal failure with a generic message.
-#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
-
-// Define this macro to 1 to omit the definition of FAIL(), which is a
-// generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_FAIL
-# define FAIL() GTEST_FAIL()
-#endif
-
-// Generates a success with a generic message.
-#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
-
-// Define this macro to 1 to omit the definition of SUCCEED(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_SUCCEED
-# define SUCCEED() GTEST_SUCCEED()
-#endif
-
-// Macros for testing exceptions.
-//
-// * {ASSERT|EXPECT}_THROW(statement, expected_exception):
-// Tests that the statement throws the expected exception.
-// * {ASSERT|EXPECT}_NO_THROW(statement):
-// Tests that the statement doesn't throw any exception.
-// * {ASSERT|EXPECT}_ANY_THROW(statement):
-// Tests that the statement throws an exception.
-
-#define EXPECT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
-#define ASSERT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
-#define ASSERT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
-
-// Boolean assertions. Condition can be either a Boolean expression or an
-// AssertionResult. For more information on how to use AssertionResult with
-// these macros see comments on that class.
-#define EXPECT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
- GTEST_NONFATAL_FAILURE_)
-#define EXPECT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_NONFATAL_FAILURE_)
-#define ASSERT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
- GTEST_FATAL_FAILURE_)
-#define ASSERT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_FATAL_FAILURE_)
-
-// Includes the auto-generated header that implements a family of
-// generic predicate assertion macros.
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
-// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
-//
-// Implements a family of generic predicate assertion macros.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-
-// Makes sure this header is not included before gtest.h.
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-# error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
-
-// This header implements a family of generic predicate assertion
-// macros:
-//
-// ASSERT_PRED_FORMAT1(pred_format, v1)
-// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
-// ...
-//
-// where pred_format is a function or functor that takes n (in the
-// case of ASSERT_PRED_FORMATn) values and their source expression
-// text, and returns a testing::AssertionResult. See the definition
-// of ASSERT_EQ in gtest.h for an example.
-//
-// If you don't care about formatting, you can use the more
-// restrictive version:
-//
-// ASSERT_PRED1(pred, v1)
-// ASSERT_PRED2(pred, v1, v2)
-// ...
-//
-// where pred is an n-ary function or functor that returns bool,
-// and the values v1, v2, ..., must support the << operator for
-// streaming to std::ostream.
-//
-// We also define the EXPECT_* variations.
-//
-// For now we only support predicates whose arity is at most 5.
-// Please email googletestframework@googlegroups.com if you need
-// support for higher arities.
-
-// GTEST_ASSERT_ is the basic statement to which all of the assertions
-// in this file reduce. Don't use this in your code.
-
-#define GTEST_ASSERT_(expression, on_failure) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar = (expression)) \
- ; \
- else \
- on_failure(gtest_ar.failure_message())
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-template <typename Pred,
- typename T1>
-AssertionResult AssertPred1Helper(const char* pred_text,
- const char* e1,
- Pred pred,
- const T1& v1) {
- if (pred(v1)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, v1), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-#define GTEST_PRED1_(pred, v1, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
- #v1, \
- pred, \
- v1), on_failure)
-
-// Unary predicate assertion macros.
-#define EXPECT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2>
-AssertionResult AssertPred2Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- Pred pred,
- const T1& v1,
- const T2& v2) {
- if (pred(v1, v2)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-#define GTEST_PRED2_(pred, v1, v2, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
- #v1, \
- #v2, \
- pred, \
- v1, \
- v2), on_failure)
-
-// Binary predicate assertion macros.
-#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3>
-AssertionResult AssertPred3Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3) {
- if (pred(v1, v2, v3)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- pred, \
- v1, \
- v2, \
- v3), on_failure)
-
-// Ternary predicate assertion macros.
-#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4>
-AssertionResult AssertPred4Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4) {
- if (pred(v1, v2, v3, v4)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4), on_failure)
-
-// 4-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5>
-AssertionResult AssertPred5Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- const char* e5,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4,
- const T5& v5) {
- if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ", "
- << e5 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4
- << "\n" << e5 << " evaluates to " << v5;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- #v5, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4, \
- v5), on_failure)
-
-// 5-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-
-
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-
-// Macros for testing equalities and inequalities.
-//
-// * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
-// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
-// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
-// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
-// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
-// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
-//
-// When they are not, Google Test prints both the tested expressions and
-// their actual values. The values must be compatible built-in types,
-// or you will get a compiler error. By "compatible" we mean that the
-// values can be compared by the respective operator.
-//
-// Note:
-//
-// 1. It is possible to make a user-defined type work with
-// {ASSERT|EXPECT}_??(), but that requires overloading the
-// comparison operators and is thus discouraged by the Google C++
-// Usage Guide. Therefore, you are advised to use the
-// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
-// equal.
-//
-// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
-// pointers (in particular, C strings). Therefore, if you use it
-// with two C strings, you are testing how their locations in memory
-// are related, not how their content is related. To compare two C
-// strings by content, use {ASSERT|EXPECT}_STR*().
-//
-// 3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
-// {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
-// what the actual value is when it fails, and similarly for the
-// other comparisons.
-//
-// 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
-// evaluate their arguments, which is undefined.
-//
-// 5. These macros evaluate their arguments exactly once.
-//
-// Examples:
-//
-// EXPECT_NE(5, Foo());
-// EXPECT_EQ(NULL, a_pointer);
-// ASSERT_LT(i, array_size);
-// ASSERT_GT(records.size(), 0) << "There is no record left.";
-
-#define EXPECT_EQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
-#define EXPECT_NE(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
-#define EXPECT_LE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define EXPECT_LT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define EXPECT_GE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define EXPECT_GT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-#define GTEST_ASSERT_EQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
-#define GTEST_ASSERT_NE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
-#define GTEST_ASSERT_LE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define GTEST_ASSERT_LT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define GTEST_ASSERT_GE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define GTEST_ASSERT_GT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
-// ASSERT_XY(), which clashes with some users' own code.
-
-#if !GTEST_DONT_DEFINE_ASSERT_EQ
-# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_NE
-# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LE
-# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LT
-# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GE
-# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GT
-# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
-#endif
-
-// C-string Comparisons. All tests treat NULL and any non-NULL string
-// as different. Two NULLs are equal.
-//
-// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
-// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
-// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
-// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
-//
-// For wide or narrow string objects, you can use the
-// {ASSERT|EXPECT}_??() macros.
-//
-// Don't depend on the order in which the arguments are evaluated,
-// which is undefined.
-//
-// These macros evaluate their arguments exactly once.
-
-#define EXPECT_STREQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define EXPECT_STRNE(s1, s2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define EXPECT_STRCASEEQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define EXPECT_STRCASENE(s1, s2)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-#define ASSERT_STREQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
-#define ASSERT_STRNE(s1, s2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define ASSERT_STRCASEEQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
-#define ASSERT_STRCASENE(s1, s2)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-// Macros for comparing floating-point numbers.
-//
-// * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
-// Tests that two float values are almost equal.
-// * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
-// Tests that two double values are almost equal.
-// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
-// Tests that v1 and v2 are within the given distance to each other.
-//
-// Google Test uses ULP-based comparison to automatically pick a default
-// error bound that is appropriate for the operands. See the
-// FloatingPoint template class in gtest-internal.h if you are
-// interested in the implementation details.
-
-#define EXPECT_FLOAT_EQ(expected, actual)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
-
-#define EXPECT_DOUBLE_EQ(expected, actual)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
-
-#define ASSERT_FLOAT_EQ(expected, actual)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
-
-#define ASSERT_DOUBLE_EQ(expected, actual)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
-
-#define EXPECT_NEAR(val1, val2, abs_error)\
- EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-#define ASSERT_NEAR(val1, val2, abs_error)\
- ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-// These predicate format functions work on floating-point values, and
-// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
-//
-// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2);
-GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2);
-
-
-#if GTEST_OS_WINDOWS
-
-// Macros that test for HRESULT failure and success, these are only useful
-// on Windows, and rely on Windows SDK macros and APIs to compile.
-//
-// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
-//
-// When expr unexpectedly fails or succeeds, Google Test prints the
-// expected result and the actual result with both a human-readable
-// string representation of the error, if available, as well as the
-// hex result code.
-# define EXPECT_HRESULT_SUCCEEDED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define ASSERT_HRESULT_SUCCEEDED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define EXPECT_HRESULT_FAILED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-# define ASSERT_HRESULT_FAILED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-#endif // GTEST_OS_WINDOWS
-
-// Macros that execute statement and check that it doesn't generate new fatal
-// failures in the current thread.
-//
-// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
-//
-// Examples:
-//
-// EXPECT_NO_FATAL_FAILURE(Process());
-// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
-//
-#define ASSERT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
-#define EXPECT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
-
-// Causes a trace (including the source file path, the current line
-// number, and the given message) to be included in every test failure
-// message generated by code in the current scope. The effect is
-// undone when the control leaves the current scope.
-//
-// The message argument can be anything streamable to std::ostream.
-//
-// In the implementation, we include the current line number as part
-// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
-// to appear in the same block - as long as they are on different
-// lines.
-#define SCOPED_TRACE(message) \
- ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
- __FILE__, __LINE__, ::testing::Message() << (message))
-
-// Compile-time assertion for type equality.
-// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
-// the same type. The value it returns is not interesting.
-//
-// Instead of making StaticAssertTypeEq a class template, we make it a
-// function template that invokes a helper class template. This
-// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
-// defining objects of that type.
-//
-// CAVEAT:
-//
-// When used inside a method of a class template,
-// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
-// instantiated. For example, given:
-//
-// template <typename T> class Foo {
-// public:
-// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
-// };
-//
-// the code:
-//
-// void Test1() { Foo<bool> foo; }
-//
-// will NOT generate a compiler error, as Foo<bool>::Bar() is never
-// actually instantiated. Instead, you need:
-//
-// void Test2() { Foo<bool> foo; foo.Bar(); }
-//
-// to cause a compiler error.
-template <typename T1, typename T2>
-bool StaticAssertTypeEq() {
- (void)internal::StaticAssertTypeEqHelper<T1, T2>();
- return true;
-}
-
-// Defines a test.
-//
-// The first parameter is the name of the test case, and the second
-// parameter is the name of the test within the test case.
-//
-// The convention is to end the test case name with "Test". For
-// example, a test case for the Foo class can be named FooTest.
-//
-// The user should put his test code between braces after using this
-// macro. Example:
-//
-// TEST(FooTest, InitializesCorrectly) {
-// Foo foo;
-// EXPECT_TRUE(foo.StatusIsOK());
-// }
-
-// Note that we call GetTestTypeId() instead of GetTypeId<
-// ::testing::Test>() here to get the type ID of testing::Test. This
-// is to work around a suspected linker bug when using Google Test as
-// a framework on Mac OS X. The bug causes GetTypeId<
-// ::testing::Test>() to return different values depending on whether
-// the call is from the Google Test framework itself or from user test
-// code. GetTestTypeId() is guaranteed to always return the same
-// value, as it always calls GetTypeId<>() from the Google Test
-// framework.
-#define GTEST_TEST(test_case_name, test_name)\
- GTEST_TEST_(test_case_name, test_name, \
- ::testing::Test, ::testing::internal::GetTestTypeId())
-
-// Define this macro to 1 to omit the definition of TEST(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_TEST
-# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
-#endif
-
-// Defines a test that uses a test fixture.
-//
-// The first parameter is the name of the test fixture class, which
-// also doubles as the test case name. The second parameter is the
-// name of the test within the test case.
-//
-// A test fixture class must be declared earlier. The user should put
-// his test code between braces after using this macro. Example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// virtual void SetUp() { b_.AddElement(3); }
-//
-// Foo a_;
-// Foo b_;
-// };
-//
-// TEST_F(FooTest, InitializesCorrectly) {
-// EXPECT_TRUE(a_.StatusIsOK());
-// }
-//
-// TEST_F(FooTest, ReturnsElementCountCorrectly) {
-// EXPECT_EQ(0, a_.size());
-// EXPECT_EQ(1, b_.size());
-// }
-
-#define TEST_F(test_fixture, test_name)\
- GTEST_TEST_(test_fixture, test_name, test_fixture, \
- ::testing::internal::GetTypeId<test_fixture>())
-
-} // namespace testing
-
-// Use this function in main() to run all tests. It returns 0 if all
-// tests are successful, or 1 otherwise.
-//
-// RUN_ALL_TESTS() should be invoked after the command line has been
-// parsed by InitGoogleTest().
-//
-// This function was formerly a macro; thus, it is in the global
-// namespace and has an all-caps name.
-int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
-
-inline int RUN_ALL_TESTS() {
- return ::testing::UnitTest::GetInstance()->Run();
-}
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest-all.cc b/videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest-all.cc
deleted file mode 100644
index a9a03b2..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest-all.cc
+++ /dev/null
@@ -1,9592 +0,0 @@
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// Google C++ Testing Framework (Google Test)
-//
-// Sometimes it's desirable to build Google Test by compiling a single file.
-// This file serves this purpose.
-
-// This line ensures that gtest.h can be compiled on its own, even
-// when it's fused.
-#include "gtest/gtest.h"
-
-// The following lines pull in the real gtest *.cc files.
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Utilities for testing Google Test itself and code that uses Google Test
-// (e.g. frameworks built on top of Google Test).
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-
-
-namespace testing {
-
-// This helper class can be used to mock out Google Test failure reporting
-// so that we can test Google Test or code that builds on Google Test.
-//
-// An object of this class appends a TestPartResult object to the
-// TestPartResultArray object given in the constructor whenever a Google Test
-// failure is reported. It can either intercept only failures that are
-// generated in the same thread that created this object or it can intercept
-// all generated failures. The scope of this mock object can be controlled with
-// the second argument to the two arguments constructor.
-class GTEST_API_ ScopedFakeTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- // The two possible mocking modes of this object.
- enum InterceptMode {
- INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
- INTERCEPT_ALL_THREADS // Intercepts all failures.
- };
-
- // The c'tor sets this object as the test part result reporter used
- // by Google Test. The 'result' parameter specifies where to report the
- // results. This reporter will only catch failures generated in the current
- // thread. DEPRECATED
- explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
-
- // Same as above, but you can choose the interception scope of this object.
- ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
- TestPartResultArray* result);
-
- // The d'tor restores the previous test part result reporter.
- virtual ~ScopedFakeTestPartResultReporter();
-
- // Appends the TestPartResult object to the TestPartResultArray
- // received in the constructor.
- //
- // This method is from the TestPartResultReporterInterface
- // interface.
- virtual void ReportTestPartResult(const TestPartResult& result);
- private:
- void Init();
-
- const InterceptMode intercept_mode_;
- TestPartResultReporterInterface* old_reporter_;
- TestPartResultArray* const result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
-};
-
-namespace internal {
-
-// A helper class for implementing EXPECT_FATAL_FAILURE() and
-// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring. If that's not the case, a
-// non-fatal failure will be generated.
-class GTEST_API_ SingleFailureChecker {
- public:
- // The constructor remembers the arguments.
- SingleFailureChecker(const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr);
- ~SingleFailureChecker();
- private:
- const TestPartResultArray* const results_;
- const TestPartResult::Type type_;
- const string substr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-// A set of macros for testing Google Test assertions or code that's expected
-// to generate Google Test fatal failures. It verifies that the given
-// statement will cause exactly one fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - 'statement' cannot reference local non-static variables or
-// non-static members of the current object.
-// - 'statement' cannot return a value.
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
-// gtest_unittest.cc will fail to compile if we do that.
-#define EXPECT_FATAL_FAILURE(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ALL_THREADS, &gtest_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-// A macro for testing Google Test assertions or code that's expected to
-// generate Google Test non-fatal failures. It asserts that the given
-// statement will cause exactly one non-fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// 'statement' is allowed to reference local variables and members of
-// the current object.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. If we do that, the code won't compile when the user gives
-// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
-// expands to code containing an unprotected comma. The
-// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
-// catches that.
-//
-// For the same reason, we have to write
-// if (::testing::internal::AlwaysTrue()) { statement; }
-// instead of
-// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-// to avoid an MSVC warning on unreachable code.
-#define EXPECT_NONFATAL_FAILURE(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
- &gtest_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-
-#include <ctype.h>
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include <algorithm>
-#include <iomanip>
-#include <limits>
-#include <ostream> // NOLINT
-#include <sstream>
-#include <vector>
-
-#if GTEST_OS_LINUX
-
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-
-# include <fcntl.h> // NOLINT
-# include <limits.h> // NOLINT
-# include <sched.h> // NOLINT
-// Declares vsnprintf(). This header is not available on Windows.
-# include <strings.h> // NOLINT
-# include <sys/mman.h> // NOLINT
-# include <sys/time.h> // NOLINT
-# include <unistd.h> // NOLINT
-# include <string>
-
-#elif GTEST_OS_SYMBIAN
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-
-#elif GTEST_OS_ZOS
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-
-// On z/OS we additionally need strings.h for strcasecmp.
-# include <strings.h> // NOLINT
-
-#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE.
-
-# include <windows.h> // NOLINT
-
-#elif GTEST_OS_WINDOWS // We are on Windows proper.
-
-# include <io.h> // NOLINT
-# include <sys/timeb.h> // NOLINT
-# include <sys/types.h> // NOLINT
-# include <sys/stat.h> // NOLINT
-
-# if GTEST_OS_WINDOWS_MINGW
-// MinGW has gettimeofday() but not _ftime64().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-// TODO(kenton@google.com): There are other ways to get the time on
-// Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW
-// supports these. consider using them instead.
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-# include <sys/time.h> // NOLINT
-# endif // GTEST_OS_WINDOWS_MINGW
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-# include <windows.h> // NOLINT
-
-#else
-
-// Assume other platforms have gettimeofday().
-// TODO(kenton@google.com): Use autoconf to detect availability of
-// gettimeofday().
-# define GTEST_HAS_GETTIMEOFDAY_ 1
-
-// cpplint thinks that the header is already included, so we want to
-// silence it.
-# include <sys/time.h> // NOLINT
-# include <unistd.h> // NOLINT
-
-#endif // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept>
-#endif
-
-#if GTEST_CAN_STREAM_RESULTS_
-# include <arpa/inet.h> // NOLINT
-# include <netdb.h> // NOLINT
-#endif
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Utility functions and classes used by the Google C++ testing framework.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// This file contains purely Google Test's internal implementation. Please
-// DO NOT #INCLUDE IT IN A USER PROGRAM.
-
-#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
-#define GTEST_SRC_GTEST_INTERNAL_INL_H_
-
-// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
-// part of Google Test's implementation; otherwise it's undefined.
-#if !GTEST_IMPLEMENTATION_
-// A user is trying to include this from his code - just say no.
-# error "gtest-internal-inl.h is part of Google Test's internal implementation."
-# error "It must not be included except by Google Test itself."
-#endif // GTEST_IMPLEMENTATION_
-
-#ifndef _WIN32_WCE
-# include <errno.h>
-#endif // !_WIN32_WCE
-#include <stddef.h>
-#include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
-#include <string.h> // For memmove.
-
-#include <algorithm>
-#include <string>
-#include <vector>
-
-
-#if GTEST_CAN_STREAM_RESULTS_
-# include <arpa/inet.h> // NOLINT
-# include <netdb.h> // NOLINT
-#endif
-
-#if GTEST_OS_WINDOWS
-# include <windows.h> // NOLINT
-#endif // GTEST_OS_WINDOWS
-
-
-namespace testing {
-
-// Declares the flags.
-//
-// We don't want the users to modify this flag in the code, but want
-// Google Test's own unit tests to be able to access it. Therefore we
-// declare it here as opposed to in gtest.h.
-GTEST_DECLARE_bool_(death_test_use_fork);
-
-namespace internal {
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library. This is solely for testing GetTestTypeId().
-GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
-const char kBreakOnFailureFlag[] = "break_on_failure";
-const char kCatchExceptionsFlag[] = "catch_exceptions";
-const char kColorFlag[] = "color";
-const char kFilterFlag[] = "filter";
-const char kListTestsFlag[] = "list_tests";
-const char kOutputFlag[] = "output";
-const char kPrintTimeFlag[] = "print_time";
-const char kRandomSeedFlag[] = "random_seed";
-const char kRepeatFlag[] = "repeat";
-const char kShuffleFlag[] = "shuffle";
-const char kStackTraceDepthFlag[] = "stack_trace_depth";
-const char kStreamResultToFlag[] = "stream_result_to";
-const char kThrowOnFailureFlag[] = "throw_on_failure";
-
-// A valid random seed must be in [1, kMaxRandomSeed].
-const int kMaxRandomSeed = 99999;
-
-// g_help_flag is true iff the --help flag or an equivalent form is
-// specified on the command line.
-GTEST_API_ extern bool g_help_flag;
-
-// Returns the current time in milliseconds.
-GTEST_API_ TimeInMillis GetTimeInMillis();
-
-// Returns true iff Google Test should use colors in the output.
-GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
-
-// Formats the given time in milliseconds as seconds.
-GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
-
-// Converts the given time in milliseconds to a date string in the ISO 8601
-// format, without the timezone information. N.B.: due to the use the
-// non-reentrant localtime() function, this function is not thread safe. Do
-// not use it in any code that can be called from multiple threads.
-GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
-
-// Parses a string for an Int32 flag, in the form of "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-GTEST_API_ bool ParseInt32Flag(
- const char* str, const char* flag, Int32* value);
-
-// Returns a random seed in range [1, kMaxRandomSeed] based on the
-// given --gtest_random_seed flag value.
-inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
- const unsigned int raw_seed = (random_seed_flag == 0) ?
- static_cast<unsigned int>(GetTimeInMillis()) :
- static_cast<unsigned int>(random_seed_flag);
-
- // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
- // it's easy to type.
- const int normalized_seed =
- static_cast<int>((raw_seed - 1U) %
- static_cast<unsigned int>(kMaxRandomSeed)) + 1;
- return normalized_seed;
-}
-
-// Returns the first valid random seed after 'seed'. The behavior is
-// undefined if 'seed' is invalid. The seed after kMaxRandomSeed is
-// considered to be 1.
-inline int GetNextRandomSeed(int seed) {
- GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
- << "Invalid random seed " << seed << " - must be in [1, "
- << kMaxRandomSeed << "].";
- const int next_seed = seed + 1;
- return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
-}
-
-// This class saves the values of all Google Test flags in its c'tor, and
-// restores them in its d'tor.
-class GTestFlagSaver {
- public:
- // The c'tor.
- GTestFlagSaver() {
- also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
- break_on_failure_ = GTEST_FLAG(break_on_failure);
- catch_exceptions_ = GTEST_FLAG(catch_exceptions);
- color_ = GTEST_FLAG(color);
- death_test_style_ = GTEST_FLAG(death_test_style);
- death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
- filter_ = GTEST_FLAG(filter);
- internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
- list_tests_ = GTEST_FLAG(list_tests);
- output_ = GTEST_FLAG(output);
- print_time_ = GTEST_FLAG(print_time);
- random_seed_ = GTEST_FLAG(random_seed);
- repeat_ = GTEST_FLAG(repeat);
- shuffle_ = GTEST_FLAG(shuffle);
- stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
- stream_result_to_ = GTEST_FLAG(stream_result_to);
- throw_on_failure_ = GTEST_FLAG(throw_on_failure);
- }
-
- // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
- ~GTestFlagSaver() {
- GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
- GTEST_FLAG(break_on_failure) = break_on_failure_;
- GTEST_FLAG(catch_exceptions) = catch_exceptions_;
- GTEST_FLAG(color) = color_;
- GTEST_FLAG(death_test_style) = death_test_style_;
- GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
- GTEST_FLAG(filter) = filter_;
- GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
- GTEST_FLAG(list_tests) = list_tests_;
- GTEST_FLAG(output) = output_;
- GTEST_FLAG(print_time) = print_time_;
- GTEST_FLAG(random_seed) = random_seed_;
- GTEST_FLAG(repeat) = repeat_;
- GTEST_FLAG(shuffle) = shuffle_;
- GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
- GTEST_FLAG(stream_result_to) = stream_result_to_;
- GTEST_FLAG(throw_on_failure) = throw_on_failure_;
- }
-
- private:
- // Fields for saving the original values of flags.
- bool also_run_disabled_tests_;
- bool break_on_failure_;
- bool catch_exceptions_;
- std::string color_;
- std::string death_test_style_;
- bool death_test_use_fork_;
- std::string filter_;
- std::string internal_run_death_test_;
- bool list_tests_;
- std::string output_;
- bool print_time_;
- internal::Int32 random_seed_;
- internal::Int32 repeat_;
- bool shuffle_;
- internal::Int32 stack_trace_depth_;
- std::string stream_result_to_;
- bool throw_on_failure_;
-} GTEST_ATTRIBUTE_UNUSED_;
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
-// to "(Invalid Unicode 0xXXXXXXXX)".
-GTEST_API_ std::string CodePointToUtf8(UInt32 code_point);
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded();
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (e.g., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-GTEST_API_ bool ShouldShard(const char* total_shards_str,
- const char* shard_index_str,
- bool in_subprocess_for_death_test);
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error and
-// and aborts.
-GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-GTEST_API_ bool ShouldRunTestOnShard(
- int total_shards, int shard_index, int test_id);
-
-// STL container utilities.
-
-// Returns the number of elements in the given container that satisfy
-// the given predicate.
-template <class Container, typename Predicate>
-inline int CountIf(const Container& c, Predicate predicate) {
- // Implemented as an explicit loop since std::count_if() in libCstd on
- // Solaris has a non-standard signature.
- int count = 0;
- for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {
- if (predicate(*it))
- ++count;
- }
- return count;
-}
-
-// Applies a function/functor to each element in the container.
-template <class Container, typename Functor>
-void ForEach(const Container& c, Functor functor) {
- std::for_each(c.begin(), c.end(), functor);
-}
-
-// Returns the i-th element of the vector, or default_value if i is not
-// in range [0, v.size()).
-template <typename E>
-inline E GetElementOr(const std::vector<E>& v, int i, E default_value) {
- return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];
-}
-
-// Performs an in-place shuffle of a range of the vector's elements.
-// 'begin' and 'end' are element indices as an STL-style range;
-// i.e. [begin, end) are shuffled, where 'end' == size() means to
-// shuffle to the end of the vector.
-template <typename E>
-void ShuffleRange(internal::Random* random, int begin, int end,
- std::vector<E>* v) {
- const int size = static_cast<int>(v->size());
- GTEST_CHECK_(0 <= begin && begin <= size)
- << "Invalid shuffle range start " << begin << ": must be in range [0, "
- << size << "].";
- GTEST_CHECK_(begin <= end && end <= size)
- << "Invalid shuffle range finish " << end << ": must be in range ["
- << begin << ", " << size << "].";
-
- // Fisher-Yates shuffle, from
- // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
- for (int range_width = end - begin; range_width >= 2; range_width--) {
- const int last_in_range = begin + range_width - 1;
- const int selected = begin + random->Generate(range_width);
- std::swap((*v)[selected], (*v)[last_in_range]);
- }
-}
-
-// Performs an in-place shuffle of the vector's elements.
-template <typename E>
-inline void Shuffle(internal::Random* random, std::vector<E>* v) {
- ShuffleRange(random, 0, static_cast<int>(v->size()), v);
-}
-
-// A function for deleting an object. Handy for being used as a
-// functor.
-template <typename T>
-static void Delete(T* x) {
- delete x;
-}
-
-// A predicate that checks the key of a TestProperty against a known key.
-//
-// TestPropertyKeyIs is copyable.
-class TestPropertyKeyIs {
- public:
- // Constructor.
- //
- // TestPropertyKeyIs has NO default constructor.
- explicit TestPropertyKeyIs(const std::string& key) : key_(key) {}
-
- // Returns true iff the test name of test property matches on key_.
- bool operator()(const TestProperty& test_property) const {
- return test_property.key() == key_;
- }
-
- private:
- std::string key_;
-};
-
-// Class UnitTestOptions.
-//
-// This class contains functions for processing options the user
-// specifies when running the tests. It has only static members.
-//
-// In most cases, the user can specify an option using either an
-// environment variable or a command line flag. E.g. you can set the
-// test filter using either GTEST_FILTER or --gtest_filter. If both
-// the variable and the flag are present, the latter overrides the
-// former.
-class GTEST_API_ UnitTestOptions {
- public:
- // Functions for processing the gtest_output flag.
-
- // Returns the output format, or "" for normal printed output.
- static std::string GetOutputFormat();
-
- // Returns the absolute path of the requested output file, or the
- // default (test_detail.xml in the original working directory) if
- // none was explicitly specified.
- static std::string GetAbsolutePathToOutputFile();
-
- // Functions for processing the gtest_filter flag.
-
- // Returns true iff the wildcard pattern matches the string. The
- // first ':' or '\0' character in pattern marks the end of it.
- //
- // This recursive algorithm isn't very efficient, but is clear and
- // works well enough for matching test names, which are short.
- static bool PatternMatchesString(const char *pattern, const char *str);
-
- // Returns true iff the user-specified filter matches the test case
- // name and the test name.
- static bool FilterMatchesTest(const std::string &test_case_name,
- const std::string &test_name);
-
-#if GTEST_OS_WINDOWS
- // Function for supporting the gtest_catch_exception flag.
-
- // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
- // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
- // This function is useful as an __except condition.
- static int GTestShouldProcessSEH(DWORD exception_code);
-#endif // GTEST_OS_WINDOWS
-
- // Returns true if "name" matches the ':' separated list of glob-style
- // filters in "filter".
- static bool MatchesFilter(const std::string& name, const char* filter);
-};
-
-// Returns the current application's name, removing directory path if that
-// is present. Used by UnitTestOptions::GetOutputFile.
-GTEST_API_ FilePath GetCurrentExecutableName();
-
-// The role interface for getting the OS stack trace as a string.
-class OsStackTraceGetterInterface {
- public:
- OsStackTraceGetterInterface() {}
- virtual ~OsStackTraceGetterInterface() {}
-
- // Returns the current OS stack trace as an std::string. Parameters:
- //
- // max_depth - the maximum number of stack frames to be included
- // in the trace.
- // skip_count - the number of top frames to be skipped; doesn't count
- // against max_depth.
- virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;
-
- // UponLeavingGTest() should be called immediately before Google Test calls
- // user code. It saves some information about the current stack that
- // CurrentStackTrace() will use to find and hide Google Test stack frames.
- virtual void UponLeavingGTest() = 0;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
-};
-
-// A working implementation of the OsStackTraceGetterInterface interface.
-class OsStackTraceGetter : public OsStackTraceGetterInterface {
- public:
- OsStackTraceGetter() : caller_frame_(NULL) {}
-
- virtual string CurrentStackTrace(int max_depth, int skip_count)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);
-
- // This string is inserted in place of stack frames that are part of
- // Google Test's implementation.
- static const char* const kElidedFramesMarker;
-
- private:
- Mutex mutex_; // protects all internal state
-
- // We save the stack frame below the frame that calls user code.
- // We do this because the address of the frame immediately below
- // the user code changes between the call to UponLeavingGTest()
- // and any calls to CurrentStackTrace() from within the user code.
- void* caller_frame_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
-};
-
-// Information about a Google Test trace point.
-struct TraceInfo {
- const char* file;
- int line;
- std::string message;
-};
-
-// This is the default global test part result reporter used in UnitTestImpl.
-// This class should only be used by UnitTestImpl.
-class DefaultGlobalTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
- // Implements the TestPartResultReporterInterface. Reports the test part
- // result in the current test.
- virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
- UnitTestImpl* const unit_test_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
-};
-
-// This is the default per thread test part result reporter used in
-// UnitTestImpl. This class should only be used by UnitTestImpl.
-class DefaultPerThreadTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
- // Implements the TestPartResultReporterInterface. The implementation just
- // delegates to the current global test part result reporter of *unit_test_.
- virtual void ReportTestPartResult(const TestPartResult& result);
-
- private:
- UnitTestImpl* const unit_test_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
-};
-
-// The private implementation of the UnitTest class. We don't protect
-// the methods under a mutex, as this class is not accessible by a
-// user and the UnitTest class that delegates work to this class does
-// proper locking.
-class GTEST_API_ UnitTestImpl {
- public:
- explicit UnitTestImpl(UnitTest* parent);
- virtual ~UnitTestImpl();
-
- // There are two different ways to register your own TestPartResultReporter.
- // You can register your own repoter to listen either only for test results
- // from the current thread or for results from all threads.
- // By default, each per-thread test result repoter just passes a new
- // TestPartResult to the global test result reporter, which registers the
- // test part result for the currently running test.
-
- // Returns the global test part result reporter.
- TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
-
- // Sets the global test part result reporter.
- void SetGlobalTestPartResultReporter(
- TestPartResultReporterInterface* reporter);
-
- // Returns the test part result reporter for the current thread.
- TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
-
- // Sets the test part result reporter for the current thread.
- void SetTestPartResultReporterForCurrentThread(
- TestPartResultReporterInterface* reporter);
-
- // Gets the number of successful test cases.
- int successful_test_case_count() const;
-
- // Gets the number of failed test cases.
- int failed_test_case_count() const;
-
- // Gets the number of all test cases.
- int total_test_case_count() const;
-
- // Gets the number of all test cases that contain at least one test
- // that should run.
- int test_case_to_run_count() const;
-
- // Gets the number of successful tests.
- int successful_test_count() const;
-
- // Gets the number of failed tests.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Gets the number of all tests.
- int total_test_count() const;
-
- // Gets the number of tests that should run.
- int test_to_run_count() const;
-
- // Gets the time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp() const { return start_timestamp_; }
-
- // Gets the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns true iff the unit test passed (i.e. all test cases passed).
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the unit test failed (i.e. some test case failed
- // or something outside of all tests failed).
- bool Failed() const {
- return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
- }
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- const TestCase* GetTestCase(int i) const {
- const int index = GetElementOr(test_case_indices_, i, -1);
- return index < 0 ? NULL : test_cases_[i];
- }
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- TestCase* GetMutableTestCase(int i) {
- const int index = GetElementOr(test_case_indices_, i, -1);
- return index < 0 ? NULL : test_cases_[index];
- }
-
- // Provides access to the event listener list.
- TestEventListeners* listeners() { return &listeners_; }
-
- // Returns the TestResult for the test that's currently running, or
- // the TestResult for the ad hoc test if no test is running.
- TestResult* current_test_result();
-
- // Returns the TestResult for the ad hoc test.
- const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
-
- // Sets the OS stack trace getter.
- //
- // Does nothing if the input and the current OS stack trace getter
- // are the same; otherwise, deletes the old getter and makes the
- // input the current getter.
- void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
-
- // Returns the current OS stack trace getter if it is not NULL;
- // otherwise, creates an OsStackTraceGetter, makes it the current
- // getter, and returns it.
- OsStackTraceGetterInterface* os_stack_trace_getter();
-
- // Returns the current OS stack trace as an std::string.
- //
- // The maximum number of stack frames to be included is specified by
- // the gtest_stack_trace_depth flag. The skip_count parameter
- // specifies the number of top frames to be skipped, which doesn't
- // count against the number of frames to be included.
- //
- // For example, if Foo() calls Bar(), which in turn calls
- // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
- // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
- std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
-
- // Finds and returns a TestCase with the given name. If one doesn't
- // exist, creates one and returns it.
- //
- // Arguments:
- //
- // test_case_name: name of the test case
- // type_param: the name of the test's type parameter, or NULL if
- // this is not a typed or a type-parameterized test.
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- TestCase* GetTestCase(const char* test_case_name,
- const char* type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc);
-
- // Adds a TestInfo to the unit test.
- //
- // Arguments:
- //
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- // test_info: the TestInfo object
- void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc,
- TestInfo* test_info) {
- // In order to support thread-safe death tests, we need to
- // remember the original working directory when the test program
- // was first invoked. We cannot do this in RUN_ALL_TESTS(), as
- // the user may have changed the current directory before calling
- // RUN_ALL_TESTS(). Therefore we capture the current directory in
- // AddTestInfo(), which is called to register a TEST or TEST_F
- // before main() is reached.
- if (original_working_dir_.IsEmpty()) {
- original_working_dir_.Set(FilePath::GetCurrentDir());
- GTEST_CHECK_(!original_working_dir_.IsEmpty())
- << "Failed to get the current working directory.";
- }
-
- GetTestCase(test_info->test_case_name(),
- test_info->type_param(),
- set_up_tc,
- tear_down_tc)->AddTestInfo(test_info);
- }
-
-#if GTEST_HAS_PARAM_TEST
- // Returns ParameterizedTestCaseRegistry object used to keep track of
- // value-parameterized tests and instantiate and register them.
- internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
- return parameterized_test_registry_;
- }
-#endif // GTEST_HAS_PARAM_TEST
-
- // Sets the TestCase object for the test that's currently running.
- void set_current_test_case(TestCase* a_current_test_case) {
- current_test_case_ = a_current_test_case;
- }
-
- // Sets the TestInfo object for the test that's currently running. If
- // current_test_info is NULL, the assertion results will be stored in
- // ad_hoc_test_result_.
- void set_current_test_info(TestInfo* a_current_test_info) {
- current_test_info_ = a_current_test_info;
- }
-
- // Registers all parameterized tests defined using TEST_P and
- // INSTANTIATE_TEST_CASE_P, creating regular tests for each test/parameter
- // combination. This method can be called more then once; it has guards
- // protecting from registering the tests more then once. If
- // value-parameterized tests are disabled, RegisterParameterizedTests is
- // present but does nothing.
- void RegisterParameterizedTests();
-
- // Runs all tests in this UnitTest object, prints the result, and
- // returns true if all tests are successful. If any exception is
- // thrown during a test, this test is considered to be failed, but
- // the rest of the tests will still be run.
- bool RunAllTests();
-
- // Clears the results of all tests, except the ad hoc tests.
- void ClearNonAdHocTestResult() {
- ForEach(test_cases_, TestCase::ClearTestCaseResult);
- }
-
- // Clears the results of ad-hoc test assertions.
- void ClearAdHocTestResult() {
- ad_hoc_test_result_.Clear();
- }
-
- // Adds a TestProperty to the current TestResult object when invoked in a
- // context of a test or a test case, or to the global property set. If the
- // result already contains a property with the same key, the value will be
- // updated.
- void RecordProperty(const TestProperty& test_property);
-
- enum ReactionToSharding {
- HONOR_SHARDING_PROTOCOL,
- IGNORE_SHARDING_PROTOCOL
- };
-
- // Matches the full name of each test against the user-specified
- // filter to decide whether the test should run, then records the
- // result in each TestCase and TestInfo object.
- // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
- // based on sharding variables in the environment.
- // Returns the number of tests that should run.
- int FilterTests(ReactionToSharding shard_tests);
-
- // Prints the names of the tests matching the user-specified filter flag.
- void ListTestsMatchingFilter();
-
- const TestCase* current_test_case() const { return current_test_case_; }
- TestInfo* current_test_info() { return current_test_info_; }
- const TestInfo* current_test_info() const { return current_test_info_; }
-
- // Returns the vector of environments that need to be set-up/torn-down
- // before/after the tests are run.
- std::vector<Environment*>& environments() { return environments_; }
-
- // Getters for the per-thread Google Test trace stack.
- std::vector<TraceInfo>& gtest_trace_stack() {
- return *(gtest_trace_stack_.pointer());
- }
- const std::vector<TraceInfo>& gtest_trace_stack() const {
- return gtest_trace_stack_.get();
- }
-
-#if GTEST_HAS_DEATH_TEST
- void InitDeathTestSubprocessControlInfo() {
- internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
- }
- // Returns a pointer to the parsed --gtest_internal_run_death_test
- // flag, or NULL if that flag was not specified.
- // This information is useful only in a death test child process.
- // Must not be called before a call to InitGoogleTest.
- const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
- return internal_run_death_test_flag_.get();
- }
-
- // Returns a pointer to the current death test factory.
- internal::DeathTestFactory* death_test_factory() {
- return death_test_factory_.get();
- }
-
- void SuppressTestEventsIfInSubprocess();
-
- friend class ReplaceDeathTestFactory;
-#endif // GTEST_HAS_DEATH_TEST
-
- // Initializes the event listener performing XML output as specified by
- // UnitTestOptions. Must not be called before InitGoogleTest.
- void ConfigureXmlOutput();
-
-#if GTEST_CAN_STREAM_RESULTS_
- // Initializes the event listener for streaming test results to a socket.
- // Must not be called before InitGoogleTest.
- void ConfigureStreamingOutput();
-#endif
-
- // Performs initialization dependent upon flag values obtained in
- // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
- // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
- // this function is also called from RunAllTests. Since this function can be
- // called more than once, it has to be idempotent.
- void PostFlagParsingInit();
-
- // Gets the random seed used at the start of the current test iteration.
- int random_seed() const { return random_seed_; }
-
- // Gets the random number generator.
- internal::Random* random() { return &random_; }
-
- // Shuffles all test cases, and the tests within each test case,
- // making sure that death tests are still run first.
- void ShuffleTests();
-
- // Restores the test cases and tests to their order before the first shuffle.
- void UnshuffleTests();
-
- // Returns the value of GTEST_FLAG(catch_exceptions) at the moment
- // UnitTest::Run() starts.
- bool catch_exceptions() const { return catch_exceptions_; }
-
- private:
- friend class ::testing::UnitTest;
-
- // Used by UnitTest::Run() to capture the state of
- // GTEST_FLAG(catch_exceptions) at the moment it starts.
- void set_catch_exceptions(bool value) { catch_exceptions_ = value; }
-
- // The UnitTest object that owns this implementation object.
- UnitTest* const parent_;
-
- // The working directory when the first TEST() or TEST_F() was
- // executed.
- internal::FilePath original_working_dir_;
-
- // The default test part result reporters.
- DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
- DefaultPerThreadTestPartResultReporter
- default_per_thread_test_part_result_reporter_;
-
- // Points to (but doesn't own) the global test part result reporter.
- TestPartResultReporterInterface* global_test_part_result_repoter_;
-
- // Protects read and write access to global_test_part_result_reporter_.
- internal::Mutex global_test_part_result_reporter_mutex_;
-
- // Points to (but doesn't own) the per-thread test part result reporter.
- internal::ThreadLocal<TestPartResultReporterInterface*>
- per_thread_test_part_result_reporter_;
-
- // The vector of environments that need to be set-up/torn-down
- // before/after the tests are run.
- std::vector<Environment*> environments_;
-
- // The vector of TestCases in their original order. It owns the
- // elements in the vector.
- std::vector<TestCase*> test_cases_;
-
- // Provides a level of indirection for the test case list to allow
- // easy shuffling and restoring the test case order. The i-th
- // element of this vector is the index of the i-th test case in the
- // shuffled order.
- std::vector<int> test_case_indices_;
-
-#if GTEST_HAS_PARAM_TEST
- // ParameterizedTestRegistry object used to register value-parameterized
- // tests.
- internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
-
- // Indicates whether RegisterParameterizedTests() has been called already.
- bool parameterized_tests_registered_;
-#endif // GTEST_HAS_PARAM_TEST
-
- // Index of the last death test case registered. Initially -1.
- int last_death_test_case_;
-
- // This points to the TestCase for the currently running test. It
- // changes as Google Test goes through one test case after another.
- // When no test is running, this is set to NULL and Google Test
- // stores assertion results in ad_hoc_test_result_. Initially NULL.
- TestCase* current_test_case_;
-
- // This points to the TestInfo for the currently running test. It
- // changes as Google Test goes through one test after another. When
- // no test is running, this is set to NULL and Google Test stores
- // assertion results in ad_hoc_test_result_. Initially NULL.
- TestInfo* current_test_info_;
-
- // Normally, a user only writes assertions inside a TEST or TEST_F,
- // or inside a function called by a TEST or TEST_F. Since Google
- // Test keeps track of which test is current running, it can
- // associate such an assertion with the test it belongs to.
- //
- // If an assertion is encountered when no TEST or TEST_F is running,
- // Google Test attributes the assertion result to an imaginary "ad hoc"
- // test, and records the result in ad_hoc_test_result_.
- TestResult ad_hoc_test_result_;
-
- // The list of event listeners that can be used to track events inside
- // Google Test.
- TestEventListeners listeners_;
-
- // The OS stack trace getter. Will be deleted when the UnitTest
- // object is destructed. By default, an OsStackTraceGetter is used,
- // but the user can set this field to use a custom getter if that is
- // desired.
- OsStackTraceGetterInterface* os_stack_trace_getter_;
-
- // True iff PostFlagParsingInit() has been called.
- bool post_flag_parse_init_performed_;
-
- // The random number seed used at the beginning of the test run.
- int random_seed_;
-
- // Our random number generator.
- internal::Random random_;
-
- // The time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp_;
-
- // How long the test took to run, in milliseconds.
- TimeInMillis elapsed_time_;
-
-#if GTEST_HAS_DEATH_TEST
- // The decomposed components of the gtest_internal_run_death_test flag,
- // parsed when RUN_ALL_TESTS is called.
- internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
- internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;
-#endif // GTEST_HAS_DEATH_TEST
-
- // A per-thread stack of traces created by the SCOPED_TRACE() macro.
- internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;
-
- // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()
- // starts.
- bool catch_exceptions_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
-}; // class UnitTestImpl
-
-// Convenience function for accessing the global UnitTest
-// implementation object.
-inline UnitTestImpl* GetUnitTestImpl() {
- return UnitTest::GetInstance()->impl();
-}
-
-#if GTEST_USES_SIMPLE_RE
-
-// Internal helper functions for implementing the simple regular
-// expression matcher.
-GTEST_API_ bool IsInSet(char ch, const char* str);
-GTEST_API_ bool IsAsciiDigit(char ch);
-GTEST_API_ bool IsAsciiPunct(char ch);
-GTEST_API_ bool IsRepeat(char ch);
-GTEST_API_ bool IsAsciiWhiteSpace(char ch);
-GTEST_API_ bool IsAsciiWordChar(char ch);
-GTEST_API_ bool IsValidEscape(char ch);
-GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
-GTEST_API_ bool ValidateRegex(const char* regex);
-GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
-GTEST_API_ bool MatchRepetitionAndRegexAtHead(
- bool escaped, char ch, char repeat, const char* regex, const char* str);
-GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
-
-#endif // GTEST_USES_SIMPLE_RE
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
-GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
-
-#if GTEST_HAS_DEATH_TEST
-
-// Returns the message describing the last system error, regardless of the
-// platform.
-GTEST_API_ std::string GetLastErrnoDescription();
-
-# if GTEST_OS_WINDOWS
-// Provides leak-safe Windows kernel handle ownership.
-class AutoHandle {
- public:
- AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
- explicit AutoHandle(HANDLE handle) : handle_(handle) {}
-
- ~AutoHandle() { Reset(); }
-
- HANDLE Get() const { return handle_; }
- void Reset() { Reset(INVALID_HANDLE_VALUE); }
- void Reset(HANDLE handle) {
- if (handle != handle_) {
- if (handle_ != INVALID_HANDLE_VALUE)
- ::CloseHandle(handle_);
- handle_ = handle;
- }
- }
-
- private:
- HANDLE handle_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
-};
-# endif // GTEST_OS_WINDOWS
-
-// Attempts to parse a string into a positive integer pointed to by the
-// number parameter. Returns true if that is possible.
-// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
-// it here.
-template <typename Integer>
-bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
- // Fail fast if the given string does not begin with a digit;
- // this bypasses strtoXXX's "optional leading whitespace and plus
- // or minus sign" semantics, which are undesirable here.
- if (str.empty() || !IsDigit(str[0])) {
- return false;
- }
- errno = 0;
-
- char* end;
- // BiggestConvertible is the largest integer type that system-provided
- // string-to-number conversion routines can return.
-
-# if GTEST_OS_WINDOWS && !defined(__GNUC__)
-
- // MSVC and C++ Builder define __int64 instead of the standard long long.
- typedef unsigned __int64 BiggestConvertible;
- const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
-
-# else
-
- typedef unsigned long long BiggestConvertible; // NOLINT
- const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
-
-# endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
-
- const bool parse_success = *end == '\0' && errno == 0;
-
- // TODO(vladl@google.com): Convert this to compile time assertion when it is
- // available.
- GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
-
- const Integer result = static_cast<Integer>(parsed);
- if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
- *number = result;
- return true;
- }
- return false;
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-// TestResult contains some private methods that should be hidden from
-// Google Test user but are required for testing. This class allow our tests
-// to access them.
-//
-// This class is supplied only for the purpose of testing Google Test's own
-// constructs. Do not use it in user tests, either directly or indirectly.
-class TestResultAccessor {
- public:
- static void RecordProperty(TestResult* test_result,
- const std::string& xml_element,
- const TestProperty& property) {
- test_result->RecordProperty(xml_element, property);
- }
-
- static void ClearTestPartResults(TestResult* test_result) {
- test_result->ClearTestPartResults();
- }
-
- static const std::vector<testing::TestPartResult>& test_part_results(
- const TestResult& test_result) {
- return test_result.test_part_results();
- }
-};
-
-#if GTEST_CAN_STREAM_RESULTS_
-
-// Streams test results to the given port on the given host machine.
-class StreamingListener : public EmptyTestEventListener {
- public:
- // Abstract base class for writing strings to a socket.
- class AbstractSocketWriter {
- public:
- virtual ~AbstractSocketWriter() {}
-
- // Sends a string to the socket.
- virtual void Send(const string& message) = 0;
-
- // Closes the socket.
- virtual void CloseConnection() {}
-
- // Sends a string and a newline to the socket.
- void SendLn(const string& message) {
- Send(message + "\n");
- }
- };
-
- // Concrete class for actually writing strings to a socket.
- class SocketWriter : public AbstractSocketWriter {
- public:
- SocketWriter(const string& host, const string& port)
- : sockfd_(-1), host_name_(host), port_num_(port) {
- MakeConnection();
- }
-
- virtual ~SocketWriter() {
- if (sockfd_ != -1)
- CloseConnection();
- }
-
- // Sends a string to the socket.
- virtual void Send(const string& message) {
- GTEST_CHECK_(sockfd_ != -1)
- << "Send() can be called only when there is a connection.";
-
- const int len = static_cast<int>(message.length());
- if (write(sockfd_, message.c_str(), len) != len) {
- GTEST_LOG_(WARNING)
- << "stream_result_to: failed to stream to "
- << host_name_ << ":" << port_num_;
- }
- }
-
- private:
- // Creates a client socket and connects to the server.
- void MakeConnection();
-
- // Closes the socket.
- void CloseConnection() {
- GTEST_CHECK_(sockfd_ != -1)
- << "CloseConnection() can be called only when there is a connection.";
-
- close(sockfd_);
- sockfd_ = -1;
- }
-
- int sockfd_; // socket file descriptor
- const string host_name_;
- const string port_num_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
- }; // class SocketWriter
-
- // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
- static string UrlEncode(const char* str);
-
- StreamingListener(const string& host, const string& port)
- : socket_writer_(new SocketWriter(host, port)) { Start(); }
-
- explicit StreamingListener(AbstractSocketWriter* socket_writer)
- : socket_writer_(socket_writer) { Start(); }
-
- void OnTestProgramStart(const UnitTest& /* unit_test */) {
- SendLn("event=TestProgramStart");
- }
-
- void OnTestProgramEnd(const UnitTest& unit_test) {
- // Note that Google Test current only report elapsed time for each
- // test iteration, not for the entire test program.
- SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
-
- // Notify the streaming server to stop.
- socket_writer_->CloseConnection();
- }
-
- void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {
- SendLn("event=TestIterationStart&iteration=" +
- StreamableToString(iteration));
- }
-
- void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {
- SendLn("event=TestIterationEnd&passed=" +
- FormatBool(unit_test.Passed()) + "&elapsed_time=" +
- StreamableToString(unit_test.elapsed_time()) + "ms");
- }
-
- void OnTestCaseStart(const TestCase& test_case) {
- SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
- }
-
- void OnTestCaseEnd(const TestCase& test_case) {
- SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed())
- + "&elapsed_time=" + StreamableToString(test_case.elapsed_time())
- + "ms");
- }
-
- void OnTestStart(const TestInfo& test_info) {
- SendLn(std::string("event=TestStart&name=") + test_info.name());
- }
-
- void OnTestEnd(const TestInfo& test_info) {
- SendLn("event=TestEnd&passed=" +
- FormatBool((test_info.result())->Passed()) +
- "&elapsed_time=" +
- StreamableToString((test_info.result())->elapsed_time()) + "ms");
- }
-
- void OnTestPartResult(const TestPartResult& test_part_result) {
- const char* file_name = test_part_result.file_name();
- if (file_name == NULL)
- file_name = "";
- SendLn("event=TestPartResult&file=" + UrlEncode(file_name) +
- "&line=" + StreamableToString(test_part_result.line_number()) +
- "&message=" + UrlEncode(test_part_result.message()));
- }
-
- private:
- // Sends the given message and a newline to the socket.
- void SendLn(const string& message) { socket_writer_->SendLn(message); }
-
- // Called at the start of streaming to notify the receiver what
- // protocol we are using.
- void Start() { SendLn("gtest_streaming_protocol_version=1.0"); }
-
- string FormatBool(bool value) { return value ? "1" : "0"; }
-
- const scoped_ptr<AbstractSocketWriter> socket_writer_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);
-}; // class StreamingListener
-
-#endif // GTEST_CAN_STREAM_RESULTS_
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_SRC_GTEST_INTERNAL_INL_H_
-#undef GTEST_IMPLEMENTATION_
-
-#if GTEST_OS_WINDOWS
-# define vsnprintf _vsnprintf
-#endif // GTEST_OS_WINDOWS
-
-namespace testing {
-
-using internal::CountIf;
-using internal::ForEach;
-using internal::GetElementOr;
-using internal::Shuffle;
-
-// Constants.
-
-// A test whose test case name or test name matches this filter is
-// disabled and not run.
-static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*";
-
-// A test case whose name matches this filter is considered a death
-// test case and will be run before test cases whose name doesn't
-// match this filter.
-static const char kDeathTestCaseFilter[] = "*DeathTest:*DeathTest/*";
-
-// A test filter that matches everything.
-static const char kUniversalFilter[] = "*";
-
-// The default output file for XML output.
-static const char kDefaultOutputFile[] = "test_detail.xml";
-
-// The environment variable name for the test shard index.
-static const char kTestShardIndex[] = "GTEST_SHARD_INDEX";
-// The environment variable name for the total number of test shards.
-static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS";
-// The environment variable name for the test shard status file.
-static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE";
-
-namespace internal {
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-const char kStackTraceMarker[] = "\nStack trace:\n";
-
-// g_help_flag is true iff the --help flag or an equivalent form is
-// specified on the command line.
-bool g_help_flag = false;
-
-} // namespace internal
-
-static const char* GetDefaultFilter() {
- return kUniversalFilter;
-}
-
-GTEST_DEFINE_bool_(
- also_run_disabled_tests,
- internal::BoolFromGTestEnv("also_run_disabled_tests", false),
- "Run disabled tests too, in addition to the tests normally being run.");
-
-GTEST_DEFINE_bool_(
- break_on_failure,
- internal::BoolFromGTestEnv("break_on_failure", false),
- "True iff a failed assertion should be a debugger break-point.");
-
-GTEST_DEFINE_bool_(
- catch_exceptions,
- internal::BoolFromGTestEnv("catch_exceptions", true),
- "True iff " GTEST_NAME_
- " should catch exceptions and treat them as test failures.");
-
-GTEST_DEFINE_string_(
- color,
- internal::StringFromGTestEnv("color", "auto"),
- "Whether to use colors in the output. Valid values: yes, no, "
- "and auto. 'auto' means to use colors if the output is "
- "being sent to a terminal and the TERM environment variable "
- "is set to a terminal type that supports colors.");
-
-GTEST_DEFINE_string_(
- filter,
- internal::StringFromGTestEnv("filter", GetDefaultFilter()),
- "A colon-separated list of glob (not regex) patterns "
- "for filtering the tests to run, optionally followed by a "
- "'-' and a : separated list of negative patterns (tests to "
- "exclude). A test is run if it matches one of the positive "
- "patterns and does not match any of the negative patterns.");
-
-GTEST_DEFINE_bool_(list_tests, false,
- "List all tests without running them.");
-
-GTEST_DEFINE_string_(
- output,
- internal::StringFromGTestEnv("output", ""),
- "A format (currently must be \"xml\"), optionally followed "
- "by a colon and an output file name or directory. A directory "
- "is indicated by a trailing pathname separator. "
- "Examples: \"xml:filename.xml\", \"xml::directoryname/\". "
- "If a directory is specified, output files will be created "
- "within that directory, with file-names based on the test "
- "executable's name and, if necessary, made unique by adding "
- "digits.");
-
-GTEST_DEFINE_bool_(
- print_time,
- internal::BoolFromGTestEnv("print_time", true),
- "True iff " GTEST_NAME_
- " should display elapsed time in text output.");
-
-GTEST_DEFINE_int32_(
- random_seed,
- internal::Int32FromGTestEnv("random_seed", 0),
- "Random number seed to use when shuffling test orders. Must be in range "
- "[1, 99999], or 0 to use a seed based on the current time.");
-
-GTEST_DEFINE_int32_(
- repeat,
- internal::Int32FromGTestEnv("repeat", 1),
- "How many times to repeat each test. Specify a negative number "
- "for repeating forever. Useful for shaking out flaky tests.");
-
-GTEST_DEFINE_bool_(
- show_internal_stack_frames, false,
- "True iff " GTEST_NAME_ " should include internal stack frames when "
- "printing test failure stack traces.");
-
-GTEST_DEFINE_bool_(
- shuffle,
- internal::BoolFromGTestEnv("shuffle", false),
- "True iff " GTEST_NAME_
- " should randomize tests' order on every run.");
-
-GTEST_DEFINE_int32_(
- stack_trace_depth,
- internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
- "The maximum number of stack frames to print when an "
- "assertion fails. The valid range is 0 through 100, inclusive.");
-
-GTEST_DEFINE_string_(
- stream_result_to,
- internal::StringFromGTestEnv("stream_result_to", ""),
- "This flag specifies the host name and the port number on which to stream "
- "test results. Example: \"localhost:555\". The flag is effective only on "
- "Linux.");
-
-GTEST_DEFINE_bool_(
- throw_on_failure,
- internal::BoolFromGTestEnv("throw_on_failure", false),
- "When this flag is specified, a failed assertion will throw an exception "
- "if exceptions are enabled or exit the program with a non-zero code "
- "otherwise.");
-
-namespace internal {
-
-// Generates a random number from [0, range), using a Linear
-// Congruential Generator (LCG). Crashes if 'range' is 0 or greater
-// than kMaxRange.
-UInt32 Random::Generate(UInt32 range) {
- // These constants are the same as are used in glibc's rand(3).
- state_ = (1103515245U*state_ + 12345U) % kMaxRange;
-
- GTEST_CHECK_(range > 0)
- << "Cannot generate a number in the range [0, 0).";
- GTEST_CHECK_(range <= kMaxRange)
- << "Generation of a number in [0, " << range << ") was requested, "
- << "but this can only generate numbers in [0, " << kMaxRange << ").";
-
- // Converting via modulus introduces a bit of downward bias, but
- // it's simple, and a linear congruential generator isn't too good
- // to begin with.
- return state_ % range;
-}
-
-// GTestIsInitialized() returns true iff the user has initialized
-// Google Test. Useful for catching the user mistake of not initializing
-// Google Test before calling RUN_ALL_TESTS().
-//
-// A user must call testing::InitGoogleTest() to initialize Google
-// Test. g_init_gtest_count is set to the number of times
-// InitGoogleTest() has been called. We don't protect this variable
-// under a mutex as it is only accessed in the main thread.
-GTEST_API_ int g_init_gtest_count = 0;
-static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
-
-// Iterates over a vector of TestCases, keeping a running sum of the
-// results of calling a given int-returning method on each.
-// Returns the sum.
-static int SumOverTestCaseList(const std::vector<TestCase*>& case_list,
- int (TestCase::*method)() const) {
- int sum = 0;
- for (size_t i = 0; i < case_list.size(); i++) {
- sum += (case_list[i]->*method)();
- }
- return sum;
-}
-
-// Returns true iff the test case passed.
-static bool TestCasePassed(const TestCase* test_case) {
- return test_case->should_run() && test_case->Passed();
-}
-
-// Returns true iff the test case failed.
-static bool TestCaseFailed(const TestCase* test_case) {
- return test_case->should_run() && test_case->Failed();
-}
-
-// Returns true iff test_case contains at least one test that should
-// run.
-static bool ShouldRunTestCase(const TestCase* test_case) {
- return test_case->should_run();
-}
-
-// AssertHelper constructor.
-AssertHelper::AssertHelper(TestPartResult::Type type,
- const char* file,
- int line,
- const char* message)
- : data_(new AssertHelperData(type, file, line, message)) {
-}
-
-AssertHelper::~AssertHelper() {
- delete data_;
-}
-
-// Message assignment, for assertion streaming support.
-void AssertHelper::operator=(const Message& message) const {
- UnitTest::GetInstance()->
- AddTestPartResult(data_->type, data_->file, data_->line,
- AppendUserMessage(data_->message, message),
- UnitTest::GetInstance()->impl()
- ->CurrentOsStackTraceExceptTop(1)
- // Skips the stack frame for this function itself.
- ); // NOLINT
-}
-
-// Mutex for linked pointers.
-GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
-
-// Application pathname gotten in InitGoogleTest.
-std::string g_executable_path;
-
-// Returns the current application's name, removing directory path if that
-// is present.
-FilePath GetCurrentExecutableName() {
- FilePath result;
-
-#if GTEST_OS_WINDOWS
- result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
-#else
- result.Set(FilePath(g_executable_path));
-#endif // GTEST_OS_WINDOWS
-
- return result.RemoveDirectoryName();
-}
-
-// Functions for processing the gtest_output flag.
-
-// Returns the output format, or "" for normal printed output.
-std::string UnitTestOptions::GetOutputFormat() {
- const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
- if (gtest_output_flag == NULL) return std::string("");
-
- const char* const colon = strchr(gtest_output_flag, ':');
- return (colon == NULL) ?
- std::string(gtest_output_flag) :
- std::string(gtest_output_flag, colon - gtest_output_flag);
-}
-
-// Returns the name of the requested output file, or the default if none
-// was explicitly specified.
-std::string UnitTestOptions::GetAbsolutePathToOutputFile() {
- const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
- if (gtest_output_flag == NULL)
- return "";
-
- const char* const colon = strchr(gtest_output_flag, ':');
- if (colon == NULL)
- return internal::FilePath::ConcatPaths(
- internal::FilePath(
- UnitTest::GetInstance()->original_working_dir()),
- internal::FilePath(kDefaultOutputFile)).string();
-
- internal::FilePath output_name(colon + 1);
- if (!output_name.IsAbsolutePath())
- // TODO(wan@google.com): on Windows \some\path is not an absolute
- // path (as its meaning depends on the current drive), yet the
- // following logic for turning it into an absolute path is wrong.
- // Fix it.
- output_name = internal::FilePath::ConcatPaths(
- internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
- internal::FilePath(colon + 1));
-
- if (!output_name.IsDirectory())
- return output_name.string();
-
- internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
- output_name, internal::GetCurrentExecutableName(),
- GetOutputFormat().c_str()));
- return result.string();
-}
-
-// Returns true iff the wildcard pattern matches the string. The
-// first ':' or '\0' character in pattern marks the end of it.
-//
-// This recursive algorithm isn't very efficient, but is clear and
-// works well enough for matching test names, which are short.
-bool UnitTestOptions::PatternMatchesString(const char *pattern,
- const char *str) {
- switch (*pattern) {
- case '\0':
- case ':': // Either ':' or '\0' marks the end of the pattern.
- return *str == '\0';
- case '?': // Matches any single character.
- return *str != '\0' && PatternMatchesString(pattern + 1, str + 1);
- case '*': // Matches any string (possibly empty) of characters.
- return (*str != '\0' && PatternMatchesString(pattern, str + 1)) ||
- PatternMatchesString(pattern + 1, str);
- default: // Non-special character. Matches itself.
- return *pattern == *str &&
- PatternMatchesString(pattern + 1, str + 1);
- }
-}
-
-bool UnitTestOptions::MatchesFilter(
- const std::string& name, const char* filter) {
- const char *cur_pattern = filter;
- for (;;) {
- if (PatternMatchesString(cur_pattern, name.c_str())) {
- return true;
- }
-
- // Finds the next pattern in the filter.
- cur_pattern = strchr(cur_pattern, ':');
-
- // Returns if no more pattern can be found.
- if (cur_pattern == NULL) {
- return false;
- }
-
- // Skips the pattern separater (the ':' character).
- cur_pattern++;
- }
-}
-
-// Returns true iff the user-specified filter matches the test case
-// name and the test name.
-bool UnitTestOptions::FilterMatchesTest(const std::string &test_case_name,
- const std::string &test_name) {
- const std::string& full_name = test_case_name + "." + test_name.c_str();
-
- // Split --gtest_filter at '-', if there is one, to separate into
- // positive filter and negative filter portions
- const char* const p = GTEST_FLAG(filter).c_str();
- const char* const dash = strchr(p, '-');
- std::string positive;
- std::string negative;
- if (dash == NULL) {
- positive = GTEST_FLAG(filter).c_str(); // Whole string is a positive filter
- negative = "";
- } else {
- positive = std::string(p, dash); // Everything up to the dash
- negative = std::string(dash + 1); // Everything after the dash
- if (positive.empty()) {
- // Treat '-test1' as the same as '*-test1'
- positive = kUniversalFilter;
- }
- }
-
- // A filter is a colon-separated list of patterns. It matches a
- // test if any pattern in it matches the test.
- return (MatchesFilter(full_name, positive.c_str()) &&
- !MatchesFilter(full_name, negative.c_str()));
-}
-
-#if GTEST_HAS_SEH
-// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
-// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
-// This function is useful as an __except condition.
-int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {
- // Google Test should handle a SEH exception if:
- // 1. the user wants it to, AND
- // 2. this is not a breakpoint exception, AND
- // 3. this is not a C++ exception (VC++ implements them via SEH,
- // apparently).
- //
- // SEH exception code for C++ exceptions.
- // (see http://support.microsoft.com/kb/185294 for more information).
- const DWORD kCxxExceptionCode = 0xe06d7363;
-
- bool should_handle = true;
-
- if (!GTEST_FLAG(catch_exceptions))
- should_handle = false;
- else if (exception_code == EXCEPTION_BREAKPOINT)
- should_handle = false;
- else if (exception_code == kCxxExceptionCode)
- should_handle = false;
-
- return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
-}
-#endif // GTEST_HAS_SEH
-
-} // namespace internal
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test. The 'result' parameter specifies where to report the
-// results. Intercepts only failures from the current thread.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
- TestPartResultArray* result)
- : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
- result_(result) {
- Init();
-}
-
-// The c'tor sets this object as the test part result reporter used by
-// Google Test. The 'result' parameter specifies where to report the
-// results.
-ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
- InterceptMode intercept_mode, TestPartResultArray* result)
- : intercept_mode_(intercept_mode),
- result_(result) {
- Init();
-}
-
-void ScopedFakeTestPartResultReporter::Init() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
- old_reporter_ = impl->GetGlobalTestPartResultReporter();
- impl->SetGlobalTestPartResultReporter(this);
- } else {
- old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();
- impl->SetTestPartResultReporterForCurrentThread(this);
- }
-}
-
-// The d'tor restores the test part result reporter used by Google Test
-// before.
-ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
- impl->SetGlobalTestPartResultReporter(old_reporter_);
- } else {
- impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
- }
-}
-
-// Increments the test part result count and remembers the result.
-// This method is from the TestPartResultReporterInterface interface.
-void ScopedFakeTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- result_->Append(result);
-}
-
-namespace internal {
-
-// Returns the type ID of ::testing::Test. We should always call this
-// instead of GetTypeId< ::testing::Test>() to get the type ID of
-// testing::Test. This is to work around a suspected linker bug when
-// using Google Test as a framework on Mac OS X. The bug causes
-// GetTypeId< ::testing::Test>() to return different values depending
-// on whether the call is from the Google Test framework itself or
-// from user test code. GetTestTypeId() is guaranteed to always
-// return the same value, as it always calls GetTypeId<>() from the
-// gtest.cc, which is within the Google Test framework.
-TypeId GetTestTypeId() {
- return GetTypeId<Test>();
-}
-
-// The value of GetTestTypeId() as seen from within the Google Test
-// library. This is solely for testing GetTestTypeId().
-extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
-
-// This predicate-formatter checks that 'results' contains a test part
-// failure of the given type and that the failure message contains the
-// given substring.
-AssertionResult HasOneFailure(const char* /* results_expr */,
- const char* /* type_expr */,
- const char* /* substr_expr */,
- const TestPartResultArray& results,
- TestPartResult::Type type,
- const string& substr) {
- const std::string expected(type == TestPartResult::kFatalFailure ?
- "1 fatal failure" :
- "1 non-fatal failure");
- Message msg;
- if (results.size() != 1) {
- msg << "Expected: " << expected << "\n"
- << " Actual: " << results.size() << " failures";
- for (int i = 0; i < results.size(); i++) {
- msg << "\n" << results.GetTestPartResult(i);
- }
- return AssertionFailure() << msg;
- }
-
- const TestPartResult& r = results.GetTestPartResult(0);
- if (r.type() != type) {
- return AssertionFailure() << "Expected: " << expected << "\n"
- << " Actual:\n"
- << r;
- }
-
- if (strstr(r.message(), substr.c_str()) == NULL) {
- return AssertionFailure() << "Expected: " << expected << " containing \""
- << substr << "\"\n"
- << " Actual:\n"
- << r;
- }
-
- return AssertionSuccess();
-}
-
-// The constructor of SingleFailureChecker remembers where to look up
-// test part results, what type of failure we expect, and what
-// substring the failure message should contain.
-SingleFailureChecker:: SingleFailureChecker(
- const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr)
- : results_(results),
- type_(type),
- substr_(substr) {}
-
-// The destructor of SingleFailureChecker verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring. If that's not the case, a
-// non-fatal failure will be generated.
-SingleFailureChecker::~SingleFailureChecker() {
- EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_);
-}
-
-DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(
- UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultGlobalTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- unit_test_->current_test_result()->AddTestPartResult(result);
- unit_test_->listeners()->repeater()->OnTestPartResult(result);
-}
-
-DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(
- UnitTestImpl* unit_test) : unit_test_(unit_test) {}
-
-void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
- const TestPartResult& result) {
- unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);
-}
-
-// Returns the global test part result reporter.
-TestPartResultReporterInterface*
-UnitTestImpl::GetGlobalTestPartResultReporter() {
- internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- return global_test_part_result_repoter_;
-}
-
-// Sets the global test part result reporter.
-void UnitTestImpl::SetGlobalTestPartResultReporter(
- TestPartResultReporterInterface* reporter) {
- internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- global_test_part_result_repoter_ = reporter;
-}
-
-// Returns the test part result reporter for the current thread.
-TestPartResultReporterInterface*
-UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
- return per_thread_test_part_result_reporter_.get();
-}
-
-// Sets the test part result reporter for the current thread.
-void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
- TestPartResultReporterInterface* reporter) {
- per_thread_test_part_result_reporter_.set(reporter);
-}
-
-// Gets the number of successful test cases.
-int UnitTestImpl::successful_test_case_count() const {
- return CountIf(test_cases_, TestCasePassed);
-}
-
-// Gets the number of failed test cases.
-int UnitTestImpl::failed_test_case_count() const {
- return CountIf(test_cases_, TestCaseFailed);
-}
-
-// Gets the number of all test cases.
-int UnitTestImpl::total_test_case_count() const {
- return static_cast<int>(test_cases_.size());
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTestImpl::test_case_to_run_count() const {
- return CountIf(test_cases_, ShouldRunTestCase);
-}
-
-// Gets the number of successful tests.
-int UnitTestImpl::successful_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);
-}
-
-// Gets the number of failed tests.
-int UnitTestImpl::failed_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);
-}
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int UnitTestImpl::reportable_disabled_test_count() const {
- return SumOverTestCaseList(test_cases_,
- &TestCase::reportable_disabled_test_count);
-}
-
-// Gets the number of disabled tests.
-int UnitTestImpl::disabled_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);
-}
-
-// Gets the number of tests to be printed in the XML report.
-int UnitTestImpl::reportable_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::reportable_test_count);
-}
-
-// Gets the number of all tests.
-int UnitTestImpl::total_test_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);
-}
-
-// Gets the number of tests that should run.
-int UnitTestImpl::test_to_run_count() const {
- return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);
-}
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
-// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-std::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
- (void)skip_count;
- return "";
-}
-
-// Returns the current time in milliseconds.
-TimeInMillis GetTimeInMillis() {
-#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)
- // Difference between 1970-01-01 and 1601-01-01 in milliseconds.
- // http://analogous.blogspot.com/2005/04/epoch.html
- const TimeInMillis kJavaEpochToWinFileTimeDelta =
- static_cast<TimeInMillis>(116444736UL) * 100000UL;
- const DWORD kTenthMicrosInMilliSecond = 10000;
-
- SYSTEMTIME now_systime;
- FILETIME now_filetime;
- ULARGE_INTEGER now_int64;
- // TODO(kenton@google.com): Shouldn't this just use
- // GetSystemTimeAsFileTime()?
- GetSystemTime(&now_systime);
- if (SystemTimeToFileTime(&now_systime, &now_filetime)) {
- now_int64.LowPart = now_filetime.dwLowDateTime;
- now_int64.HighPart = now_filetime.dwHighDateTime;
- now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -
- kJavaEpochToWinFileTimeDelta;
- return now_int64.QuadPart;
- }
- return 0;
-#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
- __timeb64 now;
-
-# ifdef _MSC_VER
-
- // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
- // (deprecated function) there.
- // TODO(kenton@google.com): Use GetTickCount()? Or use
- // SystemTimeToFileTime()
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4996) // Temporarily disables warning 4996.
- _ftime64(&now);
-# pragma warning(pop) // Restores the warning state.
-# else
-
- _ftime64(&now);
-
-# endif // _MSC_VER
-
- return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
-#elif GTEST_HAS_GETTIMEOFDAY_
- struct timeval now;
- gettimeofday(&now, NULL);
- return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
-#else
-# error "Don't know how to get the current time on your system."
-#endif
-}
-
-// Utilities
-
-// class String.
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Creates a UTF-16 wide string from the given ANSI string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the wide string, or NULL if the
-// input is NULL.
-LPCWSTR String::AnsiToUtf16(const char* ansi) {
- if (!ansi) return NULL;
- const int length = strlen(ansi);
- const int unicode_length =
- MultiByteToWideChar(CP_ACP, 0, ansi, length,
- NULL, 0);
- WCHAR* unicode = new WCHAR[unicode_length + 1];
- MultiByteToWideChar(CP_ACP, 0, ansi, length,
- unicode, unicode_length);
- unicode[unicode_length] = 0;
- return unicode;
-}
-
-// Creates an ANSI string from the given wide string, allocating
-// memory using new. The caller is responsible for deleting the return
-// value using delete[]. Returns the ANSI string, or NULL if the
-// input is NULL.
-const char* String::Utf16ToAnsi(LPCWSTR utf16_str) {
- if (!utf16_str) return NULL;
- const int ansi_length =
- WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
- NULL, 0, NULL, NULL);
- char* ansi = new char[ansi_length + 1];
- WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
- ansi, ansi_length, NULL, NULL);
- ansi[ansi_length] = 0;
- return ansi;
-}
-
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-// Compares two C strings. Returns true iff they have the same content.
-//
-// Unlike strcmp(), this function can handle NULL argument(s). A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CStringEquals(const char * lhs, const char * rhs) {
- if ( lhs == NULL ) return rhs == NULL;
-
- if ( rhs == NULL ) return false;
-
- return strcmp(lhs, rhs) == 0;
-}
-
-#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-// Converts an array of wide chars to a narrow string using the UTF-8
-// encoding, and streams the result to the given Message object.
-static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
- Message* msg) {
- for (size_t i = 0; i != length; ) { // NOLINT
- if (wstr[i] != L'\0') {
- *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));
- while (i != length && wstr[i] != L'\0')
- i++;
- } else {
- *msg << '\0';
- i++;
- }
- }
-}
-
-#endif // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
-
-} // namespace internal
-
-// Constructs an empty Message.
-// We allocate the stringstream separately because otherwise each use of
-// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's
-// stack frame leading to huge stack frames in some cases; gcc does not reuse
-// the stack space.
-Message::Message() : ss_(new ::std::stringstream) {
- // By default, we want there to be enough precision when printing
- // a double to a Message.
- *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2);
-}
-
-// These two overloads allow streaming a wide C string to a Message
-// using the UTF-8 encoding.
-Message& Message::operator <<(const wchar_t* wide_c_str) {
- return *this << internal::String::ShowWideCString(wide_c_str);
-}
-Message& Message::operator <<(wchar_t* wide_c_str) {
- return *this << internal::String::ShowWideCString(wide_c_str);
-}
-
-#if GTEST_HAS_STD_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::std::wstring& wstr) {
- internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
- return *this;
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-// Converts the given wide string to a narrow string using the UTF-8
-// encoding, and streams the result to this Message object.
-Message& Message::operator <<(const ::wstring& wstr) {
- internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
- return *this;
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// Gets the text streamed to this object so far as an std::string.
-// Each '\0' character in the buffer is replaced with "\\0".
-std::string Message::GetString() const {
- return internal::StringStreamToString(ss_.get());
-}
-
-// AssertionResult constructors.
-// Used in EXPECT_TRUE/FALSE(assertion_result).
-AssertionResult::AssertionResult(const AssertionResult& other)
- : success_(other.success_),
- message_(other.message_.get() != NULL ?
- new ::std::string(*other.message_) :
- static_cast< ::std::string*>(NULL)) {
-}
-
-// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
-AssertionResult AssertionResult::operator!() const {
- AssertionResult negation(!success_);
- if (message_.get() != NULL)
- negation << *message_;
- return negation;
-}
-
-// Makes a successful assertion result.
-AssertionResult AssertionSuccess() {
- return AssertionResult(true);
-}
-
-// Makes a failed assertion result.
-AssertionResult AssertionFailure() {
- return AssertionResult(false);
-}
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << message.
-AssertionResult AssertionFailure(const Message& message) {
- return AssertionFailure() << message;
-}
-
-namespace internal {
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
- bool ignoring_case) {
- Message msg;
- msg << "Value of: " << actual_expression;
- if (actual_value != actual_expression) {
- msg << "\n Actual: " << actual_value;
- }
-
- msg << "\nExpected: " << expected_expression;
- if (ignoring_case) {
- msg << " (ignoring case)";
- }
- if (expected_value != expected_expression) {
- msg << "\nWhich is: " << expected_value;
- }
-
- return AssertionFailure() << msg;
-}
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-std::string GetBoolAssertionFailureMessage(
- const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value) {
- const char* actual_message = assertion_result.message();
- Message msg;
- msg << "Value of: " << expression_text
- << "\n Actual: " << actual_predicate_value;
- if (actual_message[0] != '\0')
- msg << " (" << actual_message << ")";
- msg << "\nExpected: " << expected_predicate_value;
- return msg.GetString();
-}
-
-// Helper function for implementing ASSERT_NEAR.
-AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error) {
- const double diff = fabs(val1 - val2);
- if (diff <= abs_error) return AssertionSuccess();
-
- // TODO(wan): do not print the value of an expression if it's
- // already a literal.
- return AssertionFailure()
- << "The difference between " << expr1 << " and " << expr2
- << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
- << expr1 << " evaluates to " << val1 << ",\n"
- << expr2 << " evaluates to " << val2 << ", and\n"
- << abs_error_expr << " evaluates to " << abs_error << ".";
-}
-
-
-// Helper template for implementing FloatLE() and DoubleLE().
-template <typename RawType>
-AssertionResult FloatingPointLE(const char* expr1,
- const char* expr2,
- RawType val1,
- RawType val2) {
- // Returns success if val1 is less than val2,
- if (val1 < val2) {
- return AssertionSuccess();
- }
-
- // or if val1 is almost equal to val2.
- const FloatingPoint<RawType> lhs(val1), rhs(val2);
- if (lhs.AlmostEquals(rhs)) {
- return AssertionSuccess();
- }
-
- // Note that the above two checks will both fail if either val1 or
- // val2 is NaN, as the IEEE floating-point standard requires that
- // any predicate involving a NaN must return false.
-
- ::std::stringstream val1_ss;
- val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << val1;
-
- ::std::stringstream val2_ss;
- val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << val2;
-
- return AssertionFailure()
- << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n"
- << " Actual: " << StringStreamToString(&val1_ss) << " vs "
- << StringStreamToString(&val2_ss);
-}
-
-} // namespace internal
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2) {
- return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);
-}
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2) {
- return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);
-}
-
-namespace internal {
-
-// The helper function for {ASSERT|EXPECT}_EQ with int or enum
-// arguments.
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- if (expected == actual) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
- false);
-}
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here
-// just to avoid copy-and-paste of similar code.
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
- BiggestInt val1, BiggestInt val2) {\
- if (val1 op val2) {\
- return AssertionSuccess();\
- } else {\
- return AssertionFailure() \
- << "Expected: (" << expr1 << ") " #op " (" << expr2\
- << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
- << " vs " << FormatForComparisonFailureMessage(val2, val1);\
- }\
-}
-
-// Implements the helper function for {ASSERT|EXPECT}_NE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(NE, !=)
-// Implements the helper function for {ASSERT|EXPECT}_LE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LE, <=)
-// Implements the helper function for {ASSERT|EXPECT}_LT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(LT, < )
-// Implements the helper function for {ASSERT|EXPECT}_GE with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GE, >=)
-// Implements the helper function for {ASSERT|EXPECT}_GT with int or
-// enum arguments.
-GTEST_IMPL_CMP_HELPER_(GT, > )
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- false);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CaseInsensitiveCStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- true);
-}
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2) {
- if (!String::CStringEquals(s1, s2)) {
- return AssertionSuccess();
- } else {
- return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
- << s2_expression << "), actual: \""
- << s1 << "\" vs \"" << s2 << "\"";
- }
-}
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2) {
- if (!String::CaseInsensitiveCStringEquals(s1, s2)) {
- return AssertionSuccess();
- } else {
- return AssertionFailure()
- << "Expected: (" << s1_expression << ") != ("
- << s2_expression << ") (ignoring case), actual: \""
- << s1 << "\" vs \"" << s2 << "\"";
- }
-}
-
-} // namespace internal
-
-namespace {
-
-// Helper functions for implementing IsSubString() and IsNotSubstring().
-
-// This group of overloaded functions return true iff needle is a
-// substring of haystack. NULL is considered a substring of itself
-// only.
-
-bool IsSubstringPred(const char* needle, const char* haystack) {
- if (needle == NULL || haystack == NULL)
- return needle == haystack;
-
- return strstr(haystack, needle) != NULL;
-}
-
-bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {
- if (needle == NULL || haystack == NULL)
- return needle == haystack;
-
- return wcsstr(haystack, needle) != NULL;
-}
-
-// StringType here can be either ::std::string or ::std::wstring.
-template <typename StringType>
-bool IsSubstringPred(const StringType& needle,
- const StringType& haystack) {
- return haystack.find(needle) != StringType::npos;
-}
-
-// This function implements either IsSubstring() or IsNotSubstring(),
-// depending on the value of the expected_to_be_substring parameter.
-// StringType here can be const char*, const wchar_t*, ::std::string,
-// or ::std::wstring.
-template <typename StringType>
-AssertionResult IsSubstringImpl(
- bool expected_to_be_substring,
- const char* needle_expr, const char* haystack_expr,
- const StringType& needle, const StringType& haystack) {
- if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
- return AssertionSuccess();
-
- const bool is_wide_string = sizeof(needle[0]) > 1;
- const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
- return AssertionFailure()
- << "Value of: " << needle_expr << "\n"
- << " Actual: " << begin_string_quote << needle << "\"\n"
- << "Expected: " << (expected_to_be_substring ? "" : "not ")
- << "a substring of " << haystack_expr << "\n"
- << "Which is: " << begin_string_quote << haystack << "\"";
-}
-
-} // namespace
-
-// IsSubstring() and IsNotSubstring() check whether needle is a
-// substring of haystack (NULL is considered a substring of itself
-// only), and return an appropriate error message when they fail.
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-
-#if GTEST_HAS_STD_WSTRING
-AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack) {
- return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
-}
-
-AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack) {
- return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-
-namespace {
-
-// Helper function for IsHRESULT{SuccessFailure} predicates
-AssertionResult HRESULTFailureHelper(const char* expr,
- const char* expected,
- long hr) { // NOLINT
-# if GTEST_OS_WINDOWS_MOBILE
-
- // Windows CE doesn't support FormatMessage.
- const char error_text[] = "";
-
-# else
-
- // Looks up the human-readable system message for the HRESULT code
- // and since we're not passing any params to FormatMessage, we don't
- // want inserts expanded.
- const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS;
- const DWORD kBufSize = 4096;
- // Gets the system's human readable message string for this HRESULT.
- char error_text[kBufSize] = { '\0' };
- DWORD message_length = ::FormatMessageA(kFlags,
- 0, // no source, we're asking system
- hr, // the error
- 0, // no line width restrictions
- error_text, // output buffer
- kBufSize, // buf size
- NULL); // no arguments for inserts
- // Trims tailing white space (FormatMessage leaves a trailing CR-LF)
- for (; message_length && IsSpace(error_text[message_length - 1]);
- --message_length) {
- error_text[message_length - 1] = '\0';
- }
-
-# endif // GTEST_OS_WINDOWS_MOBILE
-
- const std::string error_hex("0x" + String::FormatHexInt(hr));
- return ::testing::AssertionFailure()
- << "Expected: " << expr << " " << expected << ".\n"
- << " Actual: " << error_hex << " " << error_text << "\n";
-}
-
-} // namespace
-
-AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
- if (SUCCEEDED(hr)) {
- return AssertionSuccess();
- }
- return HRESULTFailureHelper(expr, "succeeds", hr);
-}
-
-AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
- if (FAILED(hr)) {
- return AssertionSuccess();
- }
- return HRESULTFailureHelper(expr, "fails", hr);
-}
-
-#endif // GTEST_OS_WINDOWS
-
-// Utility functions for encoding Unicode text (wide strings) in
-// UTF-8.
-
-// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8
-// like this:
-//
-// Code-point length Encoding
-// 0 - 7 bits 0xxxxxxx
-// 8 - 11 bits 110xxxxx 10xxxxxx
-// 12 - 16 bits 1110xxxx 10xxxxxx 10xxxxxx
-// 17 - 21 bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-
-// The maximum code-point a one-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) << 7) - 1;
-
-// The maximum code-point a two-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;
-
-// The maximum code-point a three-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;
-
-// The maximum code-point a four-byte UTF-8 sequence can represent.
-const UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;
-
-// Chops off the n lowest bits from a bit pattern. Returns the n
-// lowest bits. As a side effect, the original bit pattern will be
-// shifted to the right by n bits.
-inline UInt32 ChopLowBits(UInt32* bits, int n) {
- const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);
- *bits >>= n;
- return low_bits;
-}
-
-// Converts a Unicode code point to a narrow string in UTF-8 encoding.
-// code_point parameter is of type UInt32 because wchar_t may not be
-// wide enough to contain a code point.
-// If the code_point is not a valid Unicode code point
-// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
-// to "(Invalid Unicode 0xXXXXXXXX)".
-std::string CodePointToUtf8(UInt32 code_point) {
- if (code_point > kMaxCodePoint4) {
- return "(Invalid Unicode 0x" + String::FormatHexInt(code_point) + ")";
- }
-
- char str[5]; // Big enough for the largest valid code point.
- if (code_point <= kMaxCodePoint1) {
- str[1] = '\0';
- str[0] = static_cast<char>(code_point); // 0xxxxxxx
- } else if (code_point <= kMaxCodePoint2) {
- str[2] = '\0';
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xC0 | code_point); // 110xxxxx
- } else if (code_point <= kMaxCodePoint3) {
- str[3] = '\0';
- str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xE0 | code_point); // 1110xxxx
- } else { // code_point <= kMaxCodePoint4
- str[4] = '\0';
- str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
- str[0] = static_cast<char>(0xF0 | code_point); // 11110xxx
- }
- return str;
-}
-
-// The following two functions only make sense if the the system
-// uses UTF-16 for wide string encoding. All supported systems
-// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.
-
-// Determines if the arguments constitute UTF-16 surrogate pair
-// and thus should be combined into a single Unicode code point
-// using CreateCodePointFromUtf16SurrogatePair.
-inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
- return sizeof(wchar_t) == 2 &&
- (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
-}
-
-// Creates a Unicode code point from UTF16 surrogate pair.
-inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
- wchar_t second) {
- const UInt32 mask = (1 << 10) - 1;
- return (sizeof(wchar_t) == 2) ?
- (((first & mask) << 10) | (second & mask)) + 0x10000 :
- // This function should not be called when the condition is
- // false, but we provide a sensible default in case it is.
- static_cast<UInt32>(first);
-}
-
-// Converts a wide string to a narrow string in UTF-8 encoding.
-// The wide string is assumed to have the following encoding:
-// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
-// UTF-32 if sizeof(wchar_t) == 4 (on Linux)
-// Parameter str points to a null-terminated wide string.
-// Parameter num_chars may additionally limit the number
-// of wchar_t characters processed. -1 is used when the entire string
-// should be processed.
-// If the string contains code points that are not valid Unicode code points
-// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
-// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
-// and contains invalid UTF-16 surrogate pairs, values in those pairs
-// will be encoded as individual Unicode characters from Basic Normal Plane.
-std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
- if (num_chars == -1)
- num_chars = static_cast<int>(wcslen(str));
-
- ::std::stringstream stream;
- for (int i = 0; i < num_chars; ++i) {
- UInt32 unicode_code_point;
-
- if (str[i] == L'\0') {
- break;
- } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {
- unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],
- str[i + 1]);
- i++;
- } else {
- unicode_code_point = static_cast<UInt32>(str[i]);
- }
-
- stream << CodePointToUtf8(unicode_code_point);
- }
- return StringStreamToString(&stream);
-}
-
-// Converts a wide C string to an std::string using the UTF-8 encoding.
-// NULL will be converted to "(null)".
-std::string String::ShowWideCString(const wchar_t * wide_c_str) {
- if (wide_c_str == NULL) return "(null)";
-
- return internal::WideStringToUtf8(wide_c_str, -1);
-}
-
-// Compares two wide C strings. Returns true iff they have the same
-// content.
-//
-// Unlike wcscmp(), this function can handle NULL argument(s). A NULL
-// C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
- if (lhs == NULL) return rhs == NULL;
-
- if (rhs == NULL) return false;
-
- return wcscmp(lhs, rhs) == 0;
-}
-
-// Helper function for *_STREQ on wide strings.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual) {
- if (String::WideCStringEquals(expected, actual)) {
- return AssertionSuccess();
- }
-
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
- false);
-}
-
-// Helper function for *_STRNE on wide strings.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2) {
- if (!String::WideCStringEquals(s1, s2)) {
- return AssertionSuccess();
- }
-
- return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
- << s2_expression << "), actual: "
- << PrintToString(s1)
- << " vs " << PrintToString(s2);
-}
-
-// Compares two C strings, ignoring case. Returns true iff they have
-// the same content.
-//
-// Unlike strcasecmp(), this function can handle NULL argument(s). A
-// NULL C string is considered different to any non-NULL C string,
-// including the empty string.
-bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {
- if (lhs == NULL)
- return rhs == NULL;
- if (rhs == NULL)
- return false;
- return posix::StrCaseCmp(lhs, rhs) == 0;
-}
-
- // Compares two wide C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL wide C string,
- // including the empty string.
- // NB: The implementations on different platforms slightly differ.
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
- // environment variable. On GNU platform this method uses wcscasecmp
- // which compares according to LC_CTYPE category of the current locale.
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
- // current locale.
-bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs) {
- if (lhs == NULL) return rhs == NULL;
-
- if (rhs == NULL) return false;
-
-#if GTEST_OS_WINDOWS
- return _wcsicmp(lhs, rhs) == 0;
-#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
- return wcscasecmp(lhs, rhs) == 0;
-#else
- // Android, Mac OS X and Cygwin don't define wcscasecmp.
- // Other unknown OSes may not define it either.
- wint_t left, right;
- do {
- left = towlower(*lhs++);
- right = towlower(*rhs++);
- } while (left && left == right);
- return left == right;
-#endif // OS selector
-}
-
-// Returns true iff str ends with the given suffix, ignoring case.
-// Any string is considered to end with an empty suffix.
-bool String::EndsWithCaseInsensitive(
- const std::string& str, const std::string& suffix) {
- const size_t str_len = str.length();
- const size_t suffix_len = suffix.length();
- return (str_len >= suffix_len) &&
- CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len,
- suffix.c_str());
-}
-
-// Formats an int value as "%02d".
-std::string String::FormatIntWidth2(int value) {
- std::stringstream ss;
- ss << std::setfill('0') << std::setw(2) << value;
- return ss.str();
-}
-
-// Formats an int value as "%X".
-std::string String::FormatHexInt(int value) {
- std::stringstream ss;
- ss << std::hex << std::uppercase << value;
- return ss.str();
-}
-
-// Formats a byte as "%02X".
-std::string String::FormatByte(unsigned char value) {
- std::stringstream ss;
- ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase
- << static_cast<unsigned int>(value);
- return ss.str();
-}
-
-// Converts the buffer in a stringstream to an std::string, converting NUL
-// bytes to "\\0" along the way.
-std::string StringStreamToString(::std::stringstream* ss) {
- const ::std::string& str = ss->str();
- const char* const start = str.c_str();
- const char* const end = start + str.length();
-
- std::string result;
- result.reserve(2 * (end - start));
- for (const char* ch = start; ch != end; ++ch) {
- if (*ch == '\0') {
- result += "\\0"; // Replaces NUL with "\\0";
- } else {
- result += *ch;
- }
- }
-
- return result;
-}
-
-// Appends the user-supplied message to the Google-Test-generated message.
-std::string AppendUserMessage(const std::string& gtest_msg,
- const Message& user_msg) {
- // Appends the user message if it's non-empty.
- const std::string user_msg_string = user_msg.GetString();
- if (user_msg_string.empty()) {
- return gtest_msg;
- }
-
- return gtest_msg + "\n" + user_msg_string;
-}
-
-} // namespace internal
-
-// class TestResult
-
-// Creates an empty TestResult.
-TestResult::TestResult()
- : death_test_count_(0),
- elapsed_time_(0) {
-}
-
-// D'tor.
-TestResult::~TestResult() {
-}
-
-// Returns the i-th test part result among all the results. i can
-// range from 0 to total_part_count() - 1. If i is not in that range,
-// aborts the program.
-const TestPartResult& TestResult::GetTestPartResult(int i) const {
- if (i < 0 || i >= total_part_count())
- internal::posix::Abort();
- return test_part_results_.at(i);
-}
-
-// Returns the i-th test property. i can range from 0 to
-// test_property_count() - 1. If i is not in that range, aborts the
-// program.
-const TestProperty& TestResult::GetTestProperty(int i) const {
- if (i < 0 || i >= test_property_count())
- internal::posix::Abort();
- return test_properties_.at(i);
-}
-
-// Clears the test part results.
-void TestResult::ClearTestPartResults() {
- test_part_results_.clear();
-}
-
-// Adds a test part result to the list.
-void TestResult::AddTestPartResult(const TestPartResult& test_part_result) {
- test_part_results_.push_back(test_part_result);
-}
-
-// Adds a test property to the list. If a property with the same key as the
-// supplied property is already represented, the value of this test_property
-// replaces the old value for that key.
-void TestResult::RecordProperty(const std::string& xml_element,
- const TestProperty& test_property) {
- if (!ValidateTestProperty(xml_element, test_property)) {
- return;
- }
- internal::MutexLock lock(&test_properites_mutex_);
- const std::vector<TestProperty>::iterator property_with_matching_key =
- std::find_if(test_properties_.begin(), test_properties_.end(),
- internal::TestPropertyKeyIs(test_property.key()));
- if (property_with_matching_key == test_properties_.end()) {
- test_properties_.push_back(test_property);
- return;
- }
- property_with_matching_key->SetValue(test_property.value());
-}
-
-// The list of reserved attributes used in the <testsuites> element of XML
-// output.
-static const char* const kReservedTestSuitesAttributes[] = {
- "disabled",
- "errors",
- "failures",
- "name",
- "random_seed",
- "tests",
- "time",
- "timestamp"
-};
-
-// The list of reserved attributes used in the <testsuite> element of XML
-// output.
-static const char* const kReservedTestSuiteAttributes[] = {
- "disabled",
- "errors",
- "failures",
- "name",
- "tests",
- "time"
-};
-
-// The list of reserved attributes used in the <testcase> element of XML output.
-static const char* const kReservedTestCaseAttributes[] = {
- "classname",
- "name",
- "status",
- "time",
- "type_param",
- "value_param"
-};
-
-template <int kSize>
-std::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) {
- return std::vector<std::string>(array, array + kSize);
-}
-
-static std::vector<std::string> GetReservedAttributesForElement(
- const std::string& xml_element) {
- if (xml_element == "testsuites") {
- return ArrayAsVector(kReservedTestSuitesAttributes);
- } else if (xml_element == "testsuite") {
- return ArrayAsVector(kReservedTestSuiteAttributes);
- } else if (xml_element == "testcase") {
- return ArrayAsVector(kReservedTestCaseAttributes);
- } else {
- GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element;
- }
- // This code is unreachable but some compilers may not realizes that.
- return std::vector<std::string>();
-}
-
-static std::string FormatWordList(const std::vector<std::string>& words) {
- Message word_list;
- for (size_t i = 0; i < words.size(); ++i) {
- if (i > 0 && words.size() > 2) {
- word_list << ", ";
- }
- if (i == words.size() - 1) {
- word_list << "and ";
- }
- word_list << "'" << words[i] << "'";
- }
- return word_list.GetString();
-}
-
-bool ValidateTestPropertyName(const std::string& property_name,
- const std::vector<std::string>& reserved_names) {
- if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
- reserved_names.end()) {
- ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
- << " (" << FormatWordList(reserved_names)
- << " are reserved by " << GTEST_NAME_ << ")";
- return false;
- }
- return true;
-}
-
-// Adds a failure if the key is a reserved attribute of the element named
-// xml_element. Returns true if the property is valid.
-bool TestResult::ValidateTestProperty(const std::string& xml_element,
- const TestProperty& test_property) {
- return ValidateTestPropertyName(test_property.key(),
- GetReservedAttributesForElement(xml_element));
-}
-
-// Clears the object.
-void TestResult::Clear() {
- test_part_results_.clear();
- test_properties_.clear();
- death_test_count_ = 0;
- elapsed_time_ = 0;
-}
-
-// Returns true iff the test failed.
-bool TestResult::Failed() const {
- for (int i = 0; i < total_part_count(); ++i) {
- if (GetTestPartResult(i).failed())
- return true;
- }
- return false;
-}
-
-// Returns true iff the test part fatally failed.
-static bool TestPartFatallyFailed(const TestPartResult& result) {
- return result.fatally_failed();
-}
-
-// Returns true iff the test fatally failed.
-bool TestResult::HasFatalFailure() const {
- return CountIf(test_part_results_, TestPartFatallyFailed) > 0;
-}
-
-// Returns true iff the test part non-fatally failed.
-static bool TestPartNonfatallyFailed(const TestPartResult& result) {
- return result.nonfatally_failed();
-}
-
-// Returns true iff the test has a non-fatal failure.
-bool TestResult::HasNonfatalFailure() const {
- return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;
-}
-
-// Gets the number of all test parts. This is the sum of the number
-// of successful test parts and the number of failed test parts.
-int TestResult::total_part_count() const {
- return static_cast<int>(test_part_results_.size());
-}
-
-// Returns the number of the test properties.
-int TestResult::test_property_count() const {
- return static_cast<int>(test_properties_.size());
-}
-
-// class Test
-
-// Creates a Test object.
-
-// The c'tor saves the values of all Google Test flags.
-Test::Test()
- : gtest_flag_saver_(new internal::GTestFlagSaver) {
-}
-
-// The d'tor restores the values of all Google Test flags.
-Test::~Test() {
- delete gtest_flag_saver_;
-}
-
-// Sets up the test fixture.
-//
-// A sub-class may override this.
-void Test::SetUp() {
-}
-
-// Tears down the test fixture.
-//
-// A sub-class may override this.
-void Test::TearDown() {
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const std::string& key, const std::string& value) {
- UnitTest::GetInstance()->RecordProperty(key, value);
-}
-
-// Allows user supplied key value pairs to be recorded for later output.
-void Test::RecordProperty(const std::string& key, int value) {
- Message value_message;
- value_message << value;
- RecordProperty(key, value_message.GetString().c_str());
-}
-
-namespace internal {
-
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
- const std::string& message) {
- // This function is a friend of UnitTest and as such has access to
- // AddTestPartResult.
- UnitTest::GetInstance()->AddTestPartResult(
- result_type,
- NULL, // No info about the source file where the exception occurred.
- -1, // We have no info on which line caused the exception.
- message,
- ""); // No stack trace, either.
-}
-
-} // namespace internal
-
-// Google Test requires all tests in the same test case to use the same test
-// fixture class. This function checks if the current test has the
-// same fixture class as the first test in the current test case. If
-// yes, it returns true; otherwise it generates a Google Test failure and
-// returns false.
-bool Test::HasSameFixtureClass() {
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- const TestCase* const test_case = impl->current_test_case();
-
- // Info about the first test in the current test case.
- const TestInfo* const first_test_info = test_case->test_info_list()[0];
- const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_;
- const char* const first_test_name = first_test_info->name();
-
- // Info about the current test.
- const TestInfo* const this_test_info = impl->current_test_info();
- const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_;
- const char* const this_test_name = this_test_info->name();
-
- if (this_fixture_id != first_fixture_id) {
- // Is the first test defined using TEST?
- const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
- // Is this test defined using TEST?
- const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
-
- if (first_is_TEST || this_is_TEST) {
- // The user mixed TEST and TEST_F in this test case - we'll tell
- // him/her how to fix it.
-
- // Gets the name of the TEST and the name of the TEST_F. Note
- // that first_is_TEST and this_is_TEST cannot both be true, as
- // the fixture IDs are different for the two tests.
- const char* const TEST_name =
- first_is_TEST ? first_test_name : this_test_name;
- const char* const TEST_F_name =
- first_is_TEST ? this_test_name : first_test_name;
-
- ADD_FAILURE()
- << "All tests in the same test case must use the same test fixture\n"
- << "class, so mixing TEST_F and TEST in the same test case is\n"
- << "illegal. In test case " << this_test_info->test_case_name()
- << ",\n"
- << "test " << TEST_F_name << " is defined using TEST_F but\n"
- << "test " << TEST_name << " is defined using TEST. You probably\n"
- << "want to change the TEST to TEST_F or move it to another test\n"
- << "case.";
- } else {
- // The user defined two fixture classes with the same name in
- // two namespaces - we'll tell him/her how to fix it.
- ADD_FAILURE()
- << "All tests in the same test case must use the same test fixture\n"
- << "class. However, in test case "
- << this_test_info->test_case_name() << ",\n"
- << "you defined test " << first_test_name
- << " and test " << this_test_name << "\n"
- << "using two different test fixture classes. This can happen if\n"
- << "the two classes are from different namespaces or translation\n"
- << "units and have the same name. You should probably rename one\n"
- << "of the classes to put the tests into different test cases.";
- }
- return false;
- }
-
- return true;
-}
-
-#if GTEST_HAS_SEH
-
-// Adds an "exception thrown" fatal failure to the current test. This
-// function returns its result via an output parameter pointer because VC++
-// prohibits creation of objects with destructors on stack in functions
-// using __try (see error C2712).
-static std::string* FormatSehExceptionMessage(DWORD exception_code,
- const char* location) {
- Message message;
- message << "SEH exception with code 0x" << std::setbase(16) <<
- exception_code << std::setbase(10) << " thrown in " << location << ".";
-
- return new std::string(message.GetString());
-}
-
-#endif // GTEST_HAS_SEH
-
-namespace internal {
-
-#if GTEST_HAS_EXCEPTIONS
-
-// Adds an "exception thrown" fatal failure to the current test.
-static std::string FormatCxxExceptionMessage(const char* description,
- const char* location) {
- Message message;
- if (description != NULL) {
- message << "C++ exception with description \"" << description << "\"";
- } else {
- message << "Unknown C++ exception";
- }
- message << " thrown in " << location << ".";
-
- return message.GetString();
-}
-
-static std::string PrintTestPartResultToString(
- const TestPartResult& test_part_result);
-
-GoogleTestFailureException::GoogleTestFailureException(
- const TestPartResult& failure)
- : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-// We put these helper functions in the internal namespace as IBM's xlC
-// compiler rejects the code if they were declared static.
-
-// Runs the given method and handles SEH exceptions it throws, when
-// SEH is supported; returns the 0-value for type Result in case of an
-// SEH exception. (Microsoft compilers cannot handle SEH and C++
-// exceptions in the same function. Therefore, we provide a separate
-// wrapper function for handling SEH exceptions.)
-template <class T, typename Result>
-Result HandleSehExceptionsInMethodIfSupported(
- T* object, Result (T::*method)(), const char* location) {
-#if GTEST_HAS_SEH
- __try {
- return (object->*method)();
- } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
- GetExceptionCode())) {
- // We create the exception message on the heap because VC++ prohibits
- // creation of objects with destructors on stack in functions using __try
- // (see error C2712).
- std::string* exception_message = FormatSehExceptionMessage(
- GetExceptionCode(), location);
- internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
- *exception_message);
- delete exception_message;
- return static_cast<Result>(0);
- }
-#else
- (void)location;
- return (object->*method)();
-#endif // GTEST_HAS_SEH
-}
-
-// Runs the given method and catches and reports C++ and/or SEH-style
-// exceptions, if they are supported; returns the 0-value for type
-// Result in case of an SEH exception.
-template <class T, typename Result>
-Result HandleExceptionsInMethodIfSupported(
- T* object, Result (T::*method)(), const char* location) {
- // NOTE: The user code can affect the way in which Google Test handles
- // exceptions by setting GTEST_FLAG(catch_exceptions), but only before
- // RUN_ALL_TESTS() starts. It is technically possible to check the flag
- // after the exception is caught and either report or re-throw the
- // exception based on the flag's value:
- //
- // try {
- // // Perform the test method.
- // } catch (...) {
- // if (GTEST_FLAG(catch_exceptions))
- // // Report the exception as failure.
- // else
- // throw; // Re-throws the original exception.
- // }
- //
- // However, the purpose of this flag is to allow the program to drop into
- // the debugger when the exception is thrown. On most platforms, once the
- // control enters the catch block, the exception origin information is
- // lost and the debugger will stop the program at the point of the
- // re-throw in this function -- instead of at the point of the original
- // throw statement in the code under test. For this reason, we perform
- // the check early, sacrificing the ability to affect Google Test's
- // exception handling in the method where the exception is thrown.
- if (internal::GetUnitTestImpl()->catch_exceptions()) {
-#if GTEST_HAS_EXCEPTIONS
- try {
- return HandleSehExceptionsInMethodIfSupported(object, method, location);
- } catch (const internal::GoogleTestFailureException&) { // NOLINT
- // This exception type can only be thrown by a failed Google
- // Test assertion with the intention of letting another testing
- // framework catch it. Therefore we just re-throw it.
- throw;
- } catch (const std::exception& e) { // NOLINT
- internal::ReportFailureInUnknownLocation(
- TestPartResult::kFatalFailure,
- FormatCxxExceptionMessage(e.what(), location));
- } catch (...) { // NOLINT
- internal::ReportFailureInUnknownLocation(
- TestPartResult::kFatalFailure,
- FormatCxxExceptionMessage(NULL, location));
- }
- return static_cast<Result>(0);
-#else
- return HandleSehExceptionsInMethodIfSupported(object, method, location);
-#endif // GTEST_HAS_EXCEPTIONS
- } else {
- return (object->*method)();
- }
-}
-
-} // namespace internal
-
-// Runs the test and updates the test result.
-void Test::Run() {
- if (!HasSameFixtureClass()) return;
-
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()");
- // We will run the test only if SetUp() was successful.
- if (!HasFatalFailure()) {
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &Test::TestBody, "the test body");
- }
-
- // However, we want to clean up as much as possible. Hence we will
- // always call TearDown(), even if SetUp() or the test body has
- // failed.
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &Test::TearDown, "TearDown()");
-}
-
-// Returns true iff the current test has a fatal failure.
-bool Test::HasFatalFailure() {
- return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();
-}
-
-// Returns true iff the current test has a non-fatal failure.
-bool Test::HasNonfatalFailure() {
- return internal::GetUnitTestImpl()->current_test_result()->
- HasNonfatalFailure();
-}
-
-// class TestInfo
-
-// Constructs a TestInfo object. It assumes ownership of the test factory
-// object.
-TestInfo::TestInfo(const std::string& a_test_case_name,
- const std::string& a_name,
- const char* a_type_param,
- const char* a_value_param,
- internal::TypeId fixture_class_id,
- internal::TestFactoryBase* factory)
- : test_case_name_(a_test_case_name),
- name_(a_name),
- type_param_(a_type_param ? new std::string(a_type_param) : NULL),
- value_param_(a_value_param ? new std::string(a_value_param) : NULL),
- fixture_class_id_(fixture_class_id),
- should_run_(false),
- is_disabled_(false),
- matches_filter_(false),
- factory_(factory),
- result_() {}
-
-// Destructs a TestInfo object.
-TestInfo::~TestInfo() { delete factory_; }
-
-namespace internal {
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// name: name of the test
-// type_param: the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
-// value_param: text representation of the test's value parameter,
-// or NULL if this is not a value-parameterized test.
-// fixture_class_id: ID of the test fixture class
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-// factory: pointer to the factory that creates a test object.
-// The newly created TestInfo instance will assume
-// ownership of the factory object.
-TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- TypeId fixture_class_id,
- SetUpTestCaseFunc set_up_tc,
- TearDownTestCaseFunc tear_down_tc,
- TestFactoryBase* factory) {
- TestInfo* const test_info =
- new TestInfo(test_case_name, name, type_param, value_param,
- fixture_class_id, factory);
- GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
- return test_info;
-}
-
-#if GTEST_HAS_PARAM_TEST
-void ReportInvalidTestCaseType(const char* test_case_name,
- const char* file, int line) {
- Message errors;
- errors
- << "Attempted redefinition of test case " << test_case_name << ".\n"
- << "All tests in the same test case must use the same test fixture\n"
- << "class. However, in test case " << test_case_name << ", you tried\n"
- << "to define a test using a fixture class different from the one\n"
- << "used earlier. This can happen if the two fixture classes are\n"
- << "from different namespaces and have the same name. You should\n"
- << "probably rename one of the classes to put the tests into different\n"
- << "test cases.";
-
- fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
- errors.GetString().c_str());
-}
-#endif // GTEST_HAS_PARAM_TEST
-
-} // namespace internal
-
-namespace {
-
-// A predicate that checks the test name of a TestInfo against a known
-// value.
-//
-// This is used for implementation of the TestCase class only. We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestNameIs is copyable.
-class TestNameIs {
- public:
- // Constructor.
- //
- // TestNameIs has NO default constructor.
- explicit TestNameIs(const char* name)
- : name_(name) {}
-
- // Returns true iff the test name of test_info matches name_.
- bool operator()(const TestInfo * test_info) const {
- return test_info && test_info->name() == name_;
- }
-
- private:
- std::string name_;
-};
-
-} // namespace
-
-namespace internal {
-
-// This method expands all parameterized tests registered with macros TEST_P
-// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
-// This will be done just once during the program runtime.
-void UnitTestImpl::RegisterParameterizedTests() {
-#if GTEST_HAS_PARAM_TEST
- if (!parameterized_tests_registered_) {
- parameterized_test_registry_.RegisterTests();
- parameterized_tests_registered_ = true;
- }
-#endif
-}
-
-} // namespace internal
-
-// Creates the test object, runs it, records its result, and then
-// deletes it.
-void TestInfo::Run() {
- if (!should_run_) return;
-
- // Tells UnitTest where to store test result.
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->set_current_test_info(this);
-
- TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
- // Notifies the unit test event listeners that a test is about to start.
- repeater->OnTestStart(*this);
-
- const TimeInMillis start = internal::GetTimeInMillis();
-
- impl->os_stack_trace_getter()->UponLeavingGTest();
-
- // Creates the test object.
- Test* const test = internal::HandleExceptionsInMethodIfSupported(
- factory_, &internal::TestFactoryBase::CreateTest,
- "the test fixture's constructor");
-
- // Runs the test only if the test object was created and its
- // constructor didn't generate a fatal failure.
- if ((test != NULL) && !Test::HasFatalFailure()) {
- // This doesn't throw as all user code that can throw are wrapped into
- // exception handling code.
- test->Run();
- }
-
- // Deletes the test object.
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- test, &Test::DeleteSelf_, "the test fixture's destructor");
-
- result_.set_elapsed_time(internal::GetTimeInMillis() - start);
-
- // Notifies the unit test event listener that a test has just finished.
- repeater->OnTestEnd(*this);
-
- // Tells UnitTest to stop associating assertion results to this
- // test.
- impl->set_current_test_info(NULL);
-}
-
-// class TestCase
-
-// Gets the number of successful tests in this test case.
-int TestCase::successful_test_count() const {
- return CountIf(test_info_list_, TestPassed);
-}
-
-// Gets the number of failed tests in this test case.
-int TestCase::failed_test_count() const {
- return CountIf(test_info_list_, TestFailed);
-}
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int TestCase::reportable_disabled_test_count() const {
- return CountIf(test_info_list_, TestReportableDisabled);
-}
-
-// Gets the number of disabled tests in this test case.
-int TestCase::disabled_test_count() const {
- return CountIf(test_info_list_, TestDisabled);
-}
-
-// Gets the number of tests to be printed in the XML report.
-int TestCase::reportable_test_count() const {
- return CountIf(test_info_list_, TestReportable);
-}
-
-// Get the number of tests in this test case that should run.
-int TestCase::test_to_run_count() const {
- return CountIf(test_info_list_, ShouldRunTest);
-}
-
-// Gets the number of all tests.
-int TestCase::total_test_count() const {
- return static_cast<int>(test_info_list_.size());
-}
-
-// Creates a TestCase with the given name.
-//
-// Arguments:
-//
-// name: name of the test case
-// a_type_param: the name of the test case's type parameter, or NULL if
-// this is not a typed or a type-parameterized test case.
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-TestCase::TestCase(const char* a_name, const char* a_type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc)
- : name_(a_name),
- type_param_(a_type_param ? new std::string(a_type_param) : NULL),
- set_up_tc_(set_up_tc),
- tear_down_tc_(tear_down_tc),
- should_run_(false),
- elapsed_time_(0) {
-}
-
-// Destructor of TestCase.
-TestCase::~TestCase() {
- // Deletes every Test in the collection.
- ForEach(test_info_list_, internal::Delete<TestInfo>);
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-const TestInfo* TestCase::GetTestInfo(int i) const {
- const int index = GetElementOr(test_indices_, i, -1);
- return index < 0 ? NULL : test_info_list_[index];
-}
-
-// Returns the i-th test among all the tests. i can range from 0 to
-// total_test_count() - 1. If i is not in that range, returns NULL.
-TestInfo* TestCase::GetMutableTestInfo(int i) {
- const int index = GetElementOr(test_indices_, i, -1);
- return index < 0 ? NULL : test_info_list_[index];
-}
-
-// Adds a test to this test case. Will delete the test upon
-// destruction of the TestCase object.
-void TestCase::AddTestInfo(TestInfo * test_info) {
- test_info_list_.push_back(test_info);
- test_indices_.push_back(static_cast<int>(test_indices_.size()));
-}
-
-// Runs every test in this TestCase.
-void TestCase::Run() {
- if (!should_run_) return;
-
- internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
- impl->set_current_test_case(this);
-
- TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
-
- repeater->OnTestCaseStart(*this);
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &TestCase::RunSetUpTestCase, "SetUpTestCase()");
-
- const internal::TimeInMillis start = internal::GetTimeInMillis();
- for (int i = 0; i < total_test_count(); i++) {
- GetMutableTestInfo(i)->Run();
- }
- elapsed_time_ = internal::GetTimeInMillis() - start;
-
- impl->os_stack_trace_getter()->UponLeavingGTest();
- internal::HandleExceptionsInMethodIfSupported(
- this, &TestCase::RunTearDownTestCase, "TearDownTestCase()");
-
- repeater->OnTestCaseEnd(*this);
- impl->set_current_test_case(NULL);
-}
-
-// Clears the results of all tests in this test case.
-void TestCase::ClearResult() {
- ad_hoc_test_result_.Clear();
- ForEach(test_info_list_, TestInfo::ClearTestResult);
-}
-
-// Shuffles the tests in this test case.
-void TestCase::ShuffleTests(internal::Random* random) {
- Shuffle(random, &test_indices_);
-}
-
-// Restores the test order to before the first shuffle.
-void TestCase::UnshuffleTests() {
- for (size_t i = 0; i < test_indices_.size(); i++) {
- test_indices_[i] = static_cast<int>(i);
- }
-}
-
-// Formats a countable noun. Depending on its quantity, either the
-// singular form or the plural form is used. e.g.
-//
-// FormatCountableNoun(1, "formula", "formuli") returns "1 formula".
-// FormatCountableNoun(5, "book", "books") returns "5 books".
-static std::string FormatCountableNoun(int count,
- const char * singular_form,
- const char * plural_form) {
- return internal::StreamableToString(count) + " " +
- (count == 1 ? singular_form : plural_form);
-}
-
-// Formats the count of tests.
-static std::string FormatTestCount(int test_count) {
- return FormatCountableNoun(test_count, "test", "tests");
-}
-
-// Formats the count of test cases.
-static std::string FormatTestCaseCount(int test_case_count) {
- return FormatCountableNoun(test_case_count, "test case", "test cases");
-}
-
-// Converts a TestPartResult::Type enum to human-friendly string
-// representation. Both kNonFatalFailure and kFatalFailure are translated
-// to "Failure", as the user usually doesn't care about the difference
-// between the two when viewing the test result.
-static const char * TestPartResultTypeToString(TestPartResult::Type type) {
- switch (type) {
- case TestPartResult::kSuccess:
- return "Success";
-
- case TestPartResult::kNonFatalFailure:
- case TestPartResult::kFatalFailure:
-#ifdef _MSC_VER
- return "error: ";
-#else
- return "Failure\n";
-#endif
- default:
- return "Unknown result type";
- }
-}
-
-namespace internal {
-
-// Prints a TestPartResult to an std::string.
-static std::string PrintTestPartResultToString(
- const TestPartResult& test_part_result) {
- return (Message()
- << internal::FormatFileLocation(test_part_result.file_name(),
- test_part_result.line_number())
- << " " << TestPartResultTypeToString(test_part_result.type())
- << test_part_result.message()).GetString();
-}
-
-// Prints a TestPartResult.
-static void PrintTestPartResult(const TestPartResult& test_part_result) {
- const std::string& result =
- PrintTestPartResultToString(test_part_result);
- printf("%s\n", result.c_str());
- fflush(stdout);
- // If the test program runs in Visual Studio or a debugger, the
- // following statements add the test part result message to the Output
- // window such that the user can double-click on it to jump to the
- // corresponding source code location; otherwise they do nothing.
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- // We don't call OutputDebugString*() on Windows Mobile, as printing
- // to stdout is done by OutputDebugString() there already - we don't
- // want the same message printed twice.
- ::OutputDebugStringA(result.c_str());
- ::OutputDebugStringA("\n");
-#endif
-}
-
-// class PrettyUnitTestResultPrinter
-
-enum GTestColor {
- COLOR_DEFAULT,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW
-};
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-
-// Returns the character attribute for the given color.
-WORD GetColorAttribute(GTestColor color) {
- switch (color) {
- case COLOR_RED: return FOREGROUND_RED;
- case COLOR_GREEN: return FOREGROUND_GREEN;
- case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;
- default: return 0;
- }
-}
-
-#else
-
-// Returns the ANSI color code for the given color. COLOR_DEFAULT is
-// an invalid input.
-const char* GetAnsiColorCode(GTestColor color) {
- switch (color) {
- case COLOR_RED: return "1";
- case COLOR_GREEN: return "2";
- case COLOR_YELLOW: return "3";
- default: return NULL;
- };
-}
-
-#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
-
-// Returns true iff Google Test should use colors in the output.
-bool ShouldUseColor(bool stdout_is_tty) {
- const char* const gtest_color = GTEST_FLAG(color).c_str();
-
- if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
-#if GTEST_OS_WINDOWS
- // On Windows the TERM variable is usually not set, but the
- // console there does support colors.
- return stdout_is_tty;
-#else
- // On non-Windows platforms, we rely on the TERM variable.
- const char* const term = posix::GetEnv("TERM");
- const bool term_supports_color =
- String::CStringEquals(term, "xterm") ||
- String::CStringEquals(term, "xterm-color") ||
- String::CStringEquals(term, "xterm-256color") ||
- String::CStringEquals(term, "screen") ||
- String::CStringEquals(term, "screen-256color") ||
- String::CStringEquals(term, "linux") ||
- String::CStringEquals(term, "cygwin");
- return stdout_is_tty && term_supports_color;
-#endif // GTEST_OS_WINDOWS
- }
-
- return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
- String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
- String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
- String::CStringEquals(gtest_color, "1");
- // We take "yes", "true", "t", and "1" as meaning "yes". If the
- // value is neither one of these nor "auto", we treat it as "no" to
- // be conservative.
-}
-
-// Helpers for printing colored strings to stdout. Note that on Windows, we
-// cannot simply emit special characters and have the terminal change colors.
-// This routine must actually emit the characters rather than return a string
-// that would be colored when printed, as can be done on Linux.
-void ColoredPrintf(GTestColor color, const char* fmt, ...) {
- va_list args;
- va_start(args, fmt);
-
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS || GTEST_OS_IOS
- const bool use_color = false;
-#else
- static const bool in_color_mode =
- ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
- const bool use_color = in_color_mode && (color != COLOR_DEFAULT);
-#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
- // The '!= 0' comparison is necessary to satisfy MSVC 7.1.
-
- if (!use_color) {
- vprintf(fmt, args);
- va_end(args);
- return;
- }
-
-#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
-
- // Gets the current text color.
- CONSOLE_SCREEN_BUFFER_INFO buffer_info;
- GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
- const WORD old_color_attrs = buffer_info.wAttributes;
-
- // We need to flush the stream buffers into the console before each
- // SetConsoleTextAttribute call lest it affect the text that is already
- // printed but has not yet reached the console.
- fflush(stdout);
- SetConsoleTextAttribute(stdout_handle,
- GetColorAttribute(color) | FOREGROUND_INTENSITY);
- vprintf(fmt, args);
-
- fflush(stdout);
- // Restores the text color.
- SetConsoleTextAttribute(stdout_handle, old_color_attrs);
-#else
- printf("\033[0;3%sm", GetAnsiColorCode(color));
- vprintf(fmt, args);
- printf("\033[m"); // Resets the terminal to default.
-#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
- va_end(args);
-}
-
-// Text printed in Google Test's text output and --gunit_list_tests
-// output to label the type parameter and value parameter for a test.
-static const char kTypeParamLabel[] = "TypeParam";
-static const char kValueParamLabel[] = "GetParam()";
-
-void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
- const char* const type_param = test_info.type_param();
- const char* const value_param = test_info.value_param();
-
- if (type_param != NULL || value_param != NULL) {
- printf(", where ");
- if (type_param != NULL) {
- printf("%s = %s", kTypeParamLabel, type_param);
- if (value_param != NULL)
- printf(" and ");
- }
- if (value_param != NULL) {
- printf("%s = %s", kValueParamLabel, value_param);
- }
- }
-}
-
-// This class implements the TestEventListener interface.
-//
-// Class PrettyUnitTestResultPrinter is copyable.
-class PrettyUnitTestResultPrinter : public TestEventListener {
- public:
- PrettyUnitTestResultPrinter() {}
- static void PrintTestName(const char * test_case, const char * test) {
- printf("%s.%s", test_case, test);
- }
-
- // The following methods override what's in the TestEventListener class.
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestCaseStart(const TestCase& test_case);
- virtual void OnTestStart(const TestInfo& test_info);
- virtual void OnTestPartResult(const TestPartResult& result);
- virtual void OnTestEnd(const TestInfo& test_info);
- virtual void OnTestCaseEnd(const TestCase& test_case);
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-
- private:
- static void PrintFailedTests(const UnitTest& unit_test);
-};
-
- // Fired before each iteration of tests starts.
-void PrettyUnitTestResultPrinter::OnTestIterationStart(
- const UnitTest& unit_test, int iteration) {
- if (GTEST_FLAG(repeat) != 1)
- printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
-
- const char* const filter = GTEST_FLAG(filter).c_str();
-
- // Prints the filter if it's not *. This reminds the user that some
- // tests may be skipped.
- if (!String::CStringEquals(filter, kUniversalFilter)) {
- ColoredPrintf(COLOR_YELLOW,
- "Note: %s filter = %s\n", GTEST_NAME_, filter);
- }
-
- if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
- const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);
- ColoredPrintf(COLOR_YELLOW,
- "Note: This is test shard %d of %s.\n",
- static_cast<int>(shard_index) + 1,
- internal::posix::GetEnv(kTestTotalShards));
- }
-
- if (GTEST_FLAG(shuffle)) {
- ColoredPrintf(COLOR_YELLOW,
- "Note: Randomizing tests' orders with a seed of %d .\n",
- unit_test.random_seed());
- }
-
- ColoredPrintf(COLOR_GREEN, "[==========] ");
- printf("Running %s from %s.\n",
- FormatTestCount(unit_test.test_to_run_count()).c_str(),
- FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
- const UnitTest& /*unit_test*/) {
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("Global test environment set-up.\n");
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
- const std::string counts =
- FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("%s from %s", counts.c_str(), test_case.name());
- if (test_case.type_param() == NULL) {
- printf("\n");
- } else {
- printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param());
- }
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
- ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
- PrintTestName(test_info.test_case_name(), test_info.name());
- printf("\n");
- fflush(stdout);
-}
-
-// Called after an assertion failure.
-void PrettyUnitTestResultPrinter::OnTestPartResult(
- const TestPartResult& result) {
- // If the test part succeeded, we don't need to do anything.
- if (result.type() == TestPartResult::kSuccess)
- return;
-
- // Print failure message from the assertion (e.g. expected this and got that).
- PrintTestPartResult(result);
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
- if (test_info.result()->Passed()) {
- ColoredPrintf(COLOR_GREEN, "[ OK ] ");
- } else {
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- }
- PrintTestName(test_info.test_case_name(), test_info.name());
- if (test_info.result()->Failed())
- PrintFullTestCommentIfPresent(test_info);
-
- if (GTEST_FLAG(print_time)) {
- printf(" (%s ms)\n", internal::StreamableToString(
- test_info.result()->elapsed_time()).c_str());
- } else {
- printf("\n");
- }
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
- if (!GTEST_FLAG(print_time)) return;
-
- const std::string counts =
- FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("%s from %s (%s ms total)\n\n",
- counts.c_str(), test_case.name(),
- internal::StreamableToString(test_case.elapsed_time()).c_str());
- fflush(stdout);
-}
-
-void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(
- const UnitTest& /*unit_test*/) {
- ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("Global test environment tear-down\n");
- fflush(stdout);
-}
-
-// Internal helper for printing the list of failed tests.
-void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {
- const int failed_test_count = unit_test.failed_test_count();
- if (failed_test_count == 0) {
- return;
- }
-
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- const TestCase& test_case = *unit_test.GetTestCase(i);
- if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {
- continue;
- }
- for (int j = 0; j < test_case.total_test_count(); ++j) {
- const TestInfo& test_info = *test_case.GetTestInfo(j);
- if (!test_info.should_run() || test_info.result()->Passed()) {
- continue;
- }
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- printf("%s.%s", test_case.name(), test_info.name());
- PrintFullTestCommentIfPresent(test_info);
- printf("\n");
- }
- }
-}
-
-void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
- int /*iteration*/) {
- ColoredPrintf(COLOR_GREEN, "[==========] ");
- printf("%s from %s ran.",
- FormatTestCount(unit_test.test_to_run_count()).c_str(),
- FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
- if (GTEST_FLAG(print_time)) {
- printf(" (%s ms total)",
- internal::StreamableToString(unit_test.elapsed_time()).c_str());
- }
- printf("\n");
- ColoredPrintf(COLOR_GREEN, "[ PASSED ] ");
- printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str());
-
- int num_failures = unit_test.failed_test_count();
- if (!unit_test.Passed()) {
- const int failed_test_count = unit_test.failed_test_count();
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
- printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str());
- PrintFailedTests(unit_test);
- printf("\n%2d FAILED %s\n", num_failures,
- num_failures == 1 ? "TEST" : "TESTS");
- }
-
- int num_disabled = unit_test.reportable_disabled_test_count();
- if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
- if (!num_failures) {
- printf("\n"); // Add a spacer if no FAILURE banner is displayed.
- }
- ColoredPrintf(COLOR_YELLOW,
- " YOU HAVE %d DISABLED %s\n\n",
- num_disabled,
- num_disabled == 1 ? "TEST" : "TESTS");
- }
- // Ensure that Google Test output is printed before, e.g., heapchecker output.
- fflush(stdout);
-}
-
-// End PrettyUnitTestResultPrinter
-
-// class TestEventRepeater
-//
-// This class forwards events to other event listeners.
-class TestEventRepeater : public TestEventListener {
- public:
- TestEventRepeater() : forwarding_enabled_(true) {}
- virtual ~TestEventRepeater();
- void Append(TestEventListener *listener);
- TestEventListener* Release(TestEventListener* listener);
-
- // Controls whether events will be forwarded to listeners_. Set to false
- // in death test child processes.
- bool forwarding_enabled() const { return forwarding_enabled_; }
- void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
-
- virtual void OnTestProgramStart(const UnitTest& unit_test);
- virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);
- virtual void OnTestCaseStart(const TestCase& test_case);
- virtual void OnTestStart(const TestInfo& test_info);
- virtual void OnTestPartResult(const TestPartResult& result);
- virtual void OnTestEnd(const TestInfo& test_info);
- virtual void OnTestCaseEnd(const TestCase& test_case);
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
- virtual void OnTestProgramEnd(const UnitTest& unit_test);
-
- private:
- // Controls whether events will be forwarded to listeners_. Set to false
- // in death test child processes.
- bool forwarding_enabled_;
- // The list of listeners that receive events.
- std::vector<TestEventListener*> listeners_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);
-};
-
-TestEventRepeater::~TestEventRepeater() {
- ForEach(listeners_, Delete<TestEventListener>);
-}
-
-void TestEventRepeater::Append(TestEventListener *listener) {
- listeners_.push_back(listener);
-}
-
-// TODO(vladl@google.com): Factor the search functionality into Vector::Find.
-TestEventListener* TestEventRepeater::Release(TestEventListener *listener) {
- for (size_t i = 0; i < listeners_.size(); ++i) {
- if (listeners_[i] == listener) {
- listeners_.erase(listeners_.begin() + i);
- return listener;
- }
- }
-
- return NULL;
-}
-
-// Since most methods are very similar, use macros to reduce boilerplate.
-// This defines a member that forwards the call to all listeners.
-#define GTEST_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
- if (forwarding_enabled_) { \
- for (size_t i = 0; i < listeners_.size(); i++) { \
- listeners_[i]->Name(parameter); \
- } \
- } \
-}
-// This defines a member that forwards the call to all listeners in reverse
-// order.
-#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \
-void TestEventRepeater::Name(const Type& parameter) { \
- if (forwarding_enabled_) { \
- for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \
- listeners_[i]->Name(parameter); \
- } \
- } \
-}
-
-GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)
-GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)
-GTEST_REPEATER_METHOD_(OnTestStart, TestInfo)
-GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)
-GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)
-GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)
-
-#undef GTEST_REPEATER_METHOD_
-#undef GTEST_REVERSE_REPEATER_METHOD_
-
-void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,
- int iteration) {
- if (forwarding_enabled_) {
- for (size_t i = 0; i < listeners_.size(); i++) {
- listeners_[i]->OnTestIterationStart(unit_test, iteration);
- }
- }
-}
-
-void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,
- int iteration) {
- if (forwarding_enabled_) {
- for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {
- listeners_[i]->OnTestIterationEnd(unit_test, iteration);
- }
- }
-}
-
-// End TestEventRepeater
-
-// This class generates an XML output file.
-class XmlUnitTestResultPrinter : public EmptyTestEventListener {
- public:
- explicit XmlUnitTestResultPrinter(const char* output_file);
-
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
-
- private:
- // Is c a whitespace character that is normalized to a space character
- // when it appears in an XML attribute value?
- static bool IsNormalizableWhitespace(char c) {
- return c == 0x9 || c == 0xA || c == 0xD;
- }
-
- // May c appear in a well-formed XML document?
- static bool IsValidXmlCharacter(char c) {
- return IsNormalizableWhitespace(c) || c >= 0x20;
- }
-
- // Returns an XML-escaped copy of the input string str. If
- // is_attribute is true, the text is meant to appear as an attribute
- // value, and normalizable whitespace is preserved by replacing it
- // with character references.
- static std::string EscapeXml(const std::string& str, bool is_attribute);
-
- // Returns the given string with all characters invalid in XML removed.
- static std::string RemoveInvalidXmlCharacters(const std::string& str);
-
- // Convenience wrapper around EscapeXml when str is an attribute value.
- static std::string EscapeXmlAttribute(const std::string& str) {
- return EscapeXml(str, true);
- }
-
- // Convenience wrapper around EscapeXml when str is not an attribute value.
- static std::string EscapeXmlText(const char* str) {
- return EscapeXml(str, false);
- }
-
- // Verifies that the given attribute belongs to the given element and
- // streams the attribute as XML.
- static void OutputXmlAttribute(std::ostream* stream,
- const std::string& element_name,
- const std::string& name,
- const std::string& value);
-
- // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
- static void OutputXmlCDataSection(::std::ostream* stream, const char* data);
-
- // Streams an XML representation of a TestInfo object.
- static void OutputXmlTestInfo(::std::ostream* stream,
- const char* test_case_name,
- const TestInfo& test_info);
-
- // Prints an XML representation of a TestCase object
- static void PrintXmlTestCase(::std::ostream* stream,
- const TestCase& test_case);
-
- // Prints an XML summary of unit_test to output stream out.
- static void PrintXmlUnitTest(::std::ostream* stream,
- const UnitTest& unit_test);
-
- // Produces a string representing the test properties in a result as space
- // delimited XML attributes based on the property key="value" pairs.
- // When the std::string is not empty, it includes a space at the beginning,
- // to delimit this attribute from prior attributes.
- static std::string TestPropertiesAsXmlAttributes(const TestResult& result);
-
- // The output file.
- const std::string output_file_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
-};
-
-// Creates a new XmlUnitTestResultPrinter.
-XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
- : output_file_(output_file) {
- if (output_file_.c_str() == NULL || output_file_.empty()) {
- fprintf(stderr, "XML output file may not be null\n");
- fflush(stderr);
- exit(EXIT_FAILURE);
- }
-}
-
-// Called after the unit test ends.
-void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
- int /*iteration*/) {
- FILE* xmlout = NULL;
- FilePath output_file(output_file_);
- FilePath output_dir(output_file.RemoveFileName());
-
- if (output_dir.CreateDirectoriesRecursively()) {
- xmlout = posix::FOpen(output_file_.c_str(), "w");
- }
- if (xmlout == NULL) {
- // TODO(wan): report the reason of the failure.
- //
- // We don't do it for now as:
- //
- // 1. There is no urgent need for it.
- // 2. It's a bit involved to make the errno variable thread-safe on
- // all three operating systems (Linux, Windows, and Mac OS).
- // 3. To interpret the meaning of errno in a thread-safe way,
- // we need the strerror_r() function, which is not available on
- // Windows.
- fprintf(stderr,
- "Unable to open file \"%s\"\n",
- output_file_.c_str());
- fflush(stderr);
- exit(EXIT_FAILURE);
- }
- std::stringstream stream;
- PrintXmlUnitTest(&stream, unit_test);
- fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
- fclose(xmlout);
-}
-
-// Returns an XML-escaped copy of the input string str. If is_attribute
-// is true, the text is meant to appear as an attribute value, and
-// normalizable whitespace is preserved by replacing it with character
-// references.
-//
-// Invalid XML characters in str, if any, are stripped from the output.
-// It is expected that most, if not all, of the text processed by this
-// module will consist of ordinary English text.
-// If this module is ever modified to produce version 1.1 XML output,
-// most invalid characters can be retained using character references.
-// TODO(wan): It might be nice to have a minimally invasive, human-readable
-// escaping scheme for invalid characters, rather than dropping them.
-std::string XmlUnitTestResultPrinter::EscapeXml(
- const std::string& str, bool is_attribute) {
- Message m;
-
- for (size_t i = 0; i < str.size(); ++i) {
- const char ch = str[i];
- switch (ch) {
- case '<':
- m << "&lt;";
- break;
- case '>':
- m << "&gt;";
- break;
- case '&':
- m << "&amp;";
- break;
- case '\'':
- if (is_attribute)
- m << "&apos;";
- else
- m << '\'';
- break;
- case '"':
- if (is_attribute)
- m << "&quot;";
- else
- m << '"';
- break;
- default:
- if (IsValidXmlCharacter(ch)) {
- if (is_attribute && IsNormalizableWhitespace(ch))
- m << "&#x" << String::FormatByte(static_cast<unsigned char>(ch))
- << ";";
- else
- m << ch;
- }
- break;
- }
- }
-
- return m.GetString();
-}
-
-// Returns the given string with all characters invalid in XML removed.
-// Currently invalid characters are dropped from the string. An
-// alternative is to replace them with certain characters such as . or ?.
-std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(
- const std::string& str) {
- std::string output;
- output.reserve(str.size());
- for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
- if (IsValidXmlCharacter(*it))
- output.push_back(*it);
-
- return output;
-}
-
-// The following routines generate an XML representation of a UnitTest
-// object.
-//
-// This is how Google Test concepts map to the DTD:
-//
-// <testsuites name="AllTests"> <-- corresponds to a UnitTest object
-// <testsuite name="testcase-name"> <-- corresponds to a TestCase object
-// <testcase name="test-name"> <-- corresponds to a TestInfo object
-// <failure message="...">...</failure>
-// <failure message="...">...</failure>
-// <failure message="...">...</failure>
-// <-- individual assertion failures
-// </testcase>
-// </testsuite>
-// </testsuites>
-
-// Formats the given time in milliseconds as seconds.
-std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
- ::std::stringstream ss;
- ss << ms/1000.0;
- return ss.str();
-}
-
-// Converts the given epoch time in milliseconds to a date string in the ISO
-// 8601 format, without the timezone information.
-std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
- // Using non-reentrant version as localtime_r is not portable.
- time_t seconds = static_cast<time_t>(ms / 1000);
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4996) // Temporarily disables warning 4996
- // (function or variable may be unsafe).
- const struct tm* const time_struct = localtime(&seconds); // NOLINT
-# pragma warning(pop) // Restores the warning state again.
-#else
- const struct tm* const time_struct = localtime(&seconds); // NOLINT
-#endif
- if (time_struct == NULL)
- return ""; // Invalid ms value
-
- // YYYY-MM-DDThh:mm:ss
- return StreamableToString(time_struct->tm_year + 1900) + "-" +
- String::FormatIntWidth2(time_struct->tm_mon + 1) + "-" +
- String::FormatIntWidth2(time_struct->tm_mday) + "T" +
- String::FormatIntWidth2(time_struct->tm_hour) + ":" +
- String::FormatIntWidth2(time_struct->tm_min) + ":" +
- String::FormatIntWidth2(time_struct->tm_sec);
-}
-
-// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
-void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
- const char* data) {
- const char* segment = data;
- *stream << "<![CDATA[";
- for (;;) {
- const char* const next_segment = strstr(segment, "]]>");
- if (next_segment != NULL) {
- stream->write(
- segment, static_cast<std::streamsize>(next_segment - segment));
- *stream << "]]>]]&gt;<![CDATA[";
- segment = next_segment + strlen("]]>");
- } else {
- *stream << segment;
- break;
- }
- }
- *stream << "]]>";
-}
-
-void XmlUnitTestResultPrinter::OutputXmlAttribute(
- std::ostream* stream,
- const std::string& element_name,
- const std::string& name,
- const std::string& value) {
- const std::vector<std::string>& allowed_names =
- GetReservedAttributesForElement(element_name);
-
- GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) !=
- allowed_names.end())
- << "Attribute " << name << " is not allowed for element <" << element_name
- << ">.";
-
- *stream << " " << name << "=\"" << EscapeXmlAttribute(value) << "\"";
-}
-
-// Prints an XML representation of a TestInfo object.
-// TODO(wan): There is also value in printing properties with the plain printer.
-void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
- const char* test_case_name,
- const TestInfo& test_info) {
- const TestResult& result = *test_info.result();
- const std::string kTestcase = "testcase";
-
- *stream << " <testcase";
- OutputXmlAttribute(stream, kTestcase, "name", test_info.name());
-
- if (test_info.value_param() != NULL) {
- OutputXmlAttribute(stream, kTestcase, "value_param",
- test_info.value_param());
- }
- if (test_info.type_param() != NULL) {
- OutputXmlAttribute(stream, kTestcase, "type_param", test_info.type_param());
- }
-
- OutputXmlAttribute(stream, kTestcase, "status",
- test_info.should_run() ? "run" : "notrun");
- OutputXmlAttribute(stream, kTestcase, "time",
- FormatTimeInMillisAsSeconds(result.elapsed_time()));
- OutputXmlAttribute(stream, kTestcase, "classname", test_case_name);
- *stream << TestPropertiesAsXmlAttributes(result);
-
- int failures = 0;
- for (int i = 0; i < result.total_part_count(); ++i) {
- const TestPartResult& part = result.GetTestPartResult(i);
- if (part.failed()) {
- if (++failures == 1) {
- *stream << ">\n";
- }
- const string location = internal::FormatCompilerIndependentFileLocation(
- part.file_name(), part.line_number());
- const string summary = location + "\n" + part.summary();
- *stream << " <failure message=\""
- << EscapeXmlAttribute(summary.c_str())
- << "\" type=\"\">";
- const string detail = location + "\n" + part.message();
- OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
- *stream << "</failure>\n";
- }
- }
-
- if (failures == 0)
- *stream << " />\n";
- else
- *stream << " </testcase>\n";
-}
-
-// Prints an XML representation of a TestCase object
-void XmlUnitTestResultPrinter::PrintXmlTestCase(std::ostream* stream,
- const TestCase& test_case) {
- const std::string kTestsuite = "testsuite";
- *stream << " <" << kTestsuite;
- OutputXmlAttribute(stream, kTestsuite, "name", test_case.name());
- OutputXmlAttribute(stream, kTestsuite, "tests",
- StreamableToString(test_case.reportable_test_count()));
- OutputXmlAttribute(stream, kTestsuite, "failures",
- StreamableToString(test_case.failed_test_count()));
- OutputXmlAttribute(
- stream, kTestsuite, "disabled",
- StreamableToString(test_case.reportable_disabled_test_count()));
- OutputXmlAttribute(stream, kTestsuite, "errors", "0");
- OutputXmlAttribute(stream, kTestsuite, "time",
- FormatTimeInMillisAsSeconds(test_case.elapsed_time()));
- *stream << TestPropertiesAsXmlAttributes(test_case.ad_hoc_test_result())
- << ">\n";
-
- for (int i = 0; i < test_case.total_test_count(); ++i) {
- if (test_case.GetTestInfo(i)->is_reportable())
- OutputXmlTestInfo(stream, test_case.name(), *test_case.GetTestInfo(i));
- }
- *stream << " </" << kTestsuite << ">\n";
-}
-
-// Prints an XML summary of unit_test to output stream out.
-void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream,
- const UnitTest& unit_test) {
- const std::string kTestsuites = "testsuites";
-
- *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- *stream << "<" << kTestsuites;
-
- OutputXmlAttribute(stream, kTestsuites, "tests",
- StreamableToString(unit_test.reportable_test_count()));
- OutputXmlAttribute(stream, kTestsuites, "failures",
- StreamableToString(unit_test.failed_test_count()));
- OutputXmlAttribute(
- stream, kTestsuites, "disabled",
- StreamableToString(unit_test.reportable_disabled_test_count()));
- OutputXmlAttribute(stream, kTestsuites, "errors", "0");
- OutputXmlAttribute(
- stream, kTestsuites, "timestamp",
- FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()));
- OutputXmlAttribute(stream, kTestsuites, "time",
- FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));
-
- if (GTEST_FLAG(shuffle)) {
- OutputXmlAttribute(stream, kTestsuites, "random_seed",
- StreamableToString(unit_test.random_seed()));
- }
-
- *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result());
-
- OutputXmlAttribute(stream, kTestsuites, "name", "AllTests");
- *stream << ">\n";
-
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- if (unit_test.GetTestCase(i)->reportable_test_count() > 0)
- PrintXmlTestCase(stream, *unit_test.GetTestCase(i));
- }
- *stream << "</" << kTestsuites << ">\n";
-}
-
-// Produces a string representing the test properties in a result as space
-// delimited XML attributes based on the property key="value" pairs.
-std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
- const TestResult& result) {
- Message attributes;
- for (int i = 0; i < result.test_property_count(); ++i) {
- const TestProperty& property = result.GetTestProperty(i);
- attributes << " " << property.key() << "="
- << "\"" << EscapeXmlAttribute(property.value()) << "\"";
- }
- return attributes.GetString();
-}
-
-// End XmlUnitTestResultPrinter
-
-#if GTEST_CAN_STREAM_RESULTS_
-
-// Checks if str contains '=', '&', '%' or '\n' characters. If yes,
-// replaces them by "%xx" where xx is their hexadecimal value. For
-// example, replaces "=" with "%3D". This algorithm is O(strlen(str))
-// in both time and space -- important as the input str may contain an
-// arbitrarily long test failure message and stack trace.
-string StreamingListener::UrlEncode(const char* str) {
- string result;
- result.reserve(strlen(str) + 1);
- for (char ch = *str; ch != '\0'; ch = *++str) {
- switch (ch) {
- case '%':
- case '=':
- case '&':
- case '\n':
- result.append("%" + String::FormatByte(static_cast<unsigned char>(ch)));
- break;
- default:
- result.push_back(ch);
- break;
- }
- }
- return result;
-}
-
-void StreamingListener::SocketWriter::MakeConnection() {
- GTEST_CHECK_(sockfd_ == -1)
- << "MakeConnection() can't be called when there is already a connection.";
-
- addrinfo hints;
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_UNSPEC; // To allow both IPv4 and IPv6 addresses.
- hints.ai_socktype = SOCK_STREAM;
- addrinfo* servinfo = NULL;
-
- // Use the getaddrinfo() to get a linked list of IP addresses for
- // the given host name.
- const int error_num = getaddrinfo(
- host_name_.c_str(), port_num_.c_str(), &hints, &servinfo);
- if (error_num != 0) {
- GTEST_LOG_(WARNING) << "stream_result_to: getaddrinfo() failed: "
- << gai_strerror(error_num);
- }
-
- // Loop through all the results and connect to the first we can.
- for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != NULL;
- cur_addr = cur_addr->ai_next) {
- sockfd_ = socket(
- cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol);
- if (sockfd_ != -1) {
- // Connect the client socket to the server socket.
- if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) {
- close(sockfd_);
- sockfd_ = -1;
- }
- }
- }
-
- freeaddrinfo(servinfo); // all done with this structure
-
- if (sockfd_ == -1) {
- GTEST_LOG_(WARNING) << "stream_result_to: failed to connect to "
- << host_name_ << ":" << port_num_;
- }
-}
-
-// End of class Streaming Listener
-#endif // GTEST_CAN_STREAM_RESULTS__
-
-// Class ScopedTrace
-
-// Pushes the given source file location and message onto a per-thread
-// trace stack maintained by Google Test.
-ScopedTrace::ScopedTrace(const char* file, int line, const Message& message)
- GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
- TraceInfo trace;
- trace.file = file;
- trace.line = line;
- trace.message = message.GetString();
-
- UnitTest::GetInstance()->PushGTestTrace(trace);
-}
-
-// Pops the info pushed by the c'tor.
-ScopedTrace::~ScopedTrace()
- GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
- UnitTest::GetInstance()->PopGTestTrace();
-}
-
-
-// class OsStackTraceGetter
-
-// Returns the current OS stack trace as an std::string. Parameters:
-//
-// max_depth - the maximum number of stack frames to be included
-// in the trace.
-// skip_count - the number of top frames to be skipped; doesn't count
-// against max_depth.
-//
-string OsStackTraceGetter::CurrentStackTrace(int /* max_depth */,
- int /* skip_count */)
- GTEST_LOCK_EXCLUDED_(mutex_) {
- return "";
-}
-
-void OsStackTraceGetter::UponLeavingGTest()
- GTEST_LOCK_EXCLUDED_(mutex_) {
-}
-
-const char* const
-OsStackTraceGetter::kElidedFramesMarker =
- "... " GTEST_NAME_ " internal frames ...";
-
-// A helper class that creates the premature-exit file in its
-// constructor and deletes the file in its destructor.
-class ScopedPrematureExitFile {
- public:
- explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
- : premature_exit_filepath_(premature_exit_filepath) {
- // If a path to the premature-exit file is specified...
- if (premature_exit_filepath != NULL && *premature_exit_filepath != '\0') {
- // create the file with a single "0" character in it. I/O
- // errors are ignored as there's nothing better we can do and we
- // don't want to fail the test because of this.
- FILE* pfile = posix::FOpen(premature_exit_filepath, "w");
- fwrite("0", 1, 1, pfile);
- fclose(pfile);
- }
- }
-
- ~ScopedPrematureExitFile() {
- if (premature_exit_filepath_ != NULL && *premature_exit_filepath_ != '\0') {
- remove(premature_exit_filepath_);
- }
- }
-
- private:
- const char* const premature_exit_filepath_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile);
-};
-
-} // namespace internal
-
-// class TestEventListeners
-
-TestEventListeners::TestEventListeners()
- : repeater_(new internal::TestEventRepeater()),
- default_result_printer_(NULL),
- default_xml_generator_(NULL) {
-}
-
-TestEventListeners::~TestEventListeners() { delete repeater_; }
-
-// Returns the standard listener responsible for the default console
-// output. Can be removed from the listeners list to shut down default
-// console output. Note that removing this object from the listener list
-// with Release transfers its ownership to the user.
-void TestEventListeners::Append(TestEventListener* listener) {
- repeater_->Append(listener);
-}
-
-// Removes the given event listener from the list and returns it. It then
-// becomes the caller's responsibility to delete the listener. Returns
-// NULL if the listener is not found in the list.
-TestEventListener* TestEventListeners::Release(TestEventListener* listener) {
- if (listener == default_result_printer_)
- default_result_printer_ = NULL;
- else if (listener == default_xml_generator_)
- default_xml_generator_ = NULL;
- return repeater_->Release(listener);
-}
-
-// Returns repeater that broadcasts the TestEventListener events to all
-// subscribers.
-TestEventListener* TestEventListeners::repeater() { return repeater_; }
-
-// Sets the default_result_printer attribute to the provided listener.
-// The listener is also added to the listener list and previous
-// default_result_printer is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) {
- if (default_result_printer_ != listener) {
- // It is an error to pass this method a listener that is already in the
- // list.
- delete Release(default_result_printer_);
- default_result_printer_ = listener;
- if (listener != NULL)
- Append(listener);
- }
-}
-
-// Sets the default_xml_generator attribute to the provided listener. The
-// listener is also added to the listener list and previous
-// default_xml_generator is removed from it and deleted. The listener can
-// also be NULL in which case it will not be added to the list. Does
-// nothing if the previous and the current listener objects are the same.
-void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) {
- if (default_xml_generator_ != listener) {
- // It is an error to pass this method a listener that is already in the
- // list.
- delete Release(default_xml_generator_);
- default_xml_generator_ = listener;
- if (listener != NULL)
- Append(listener);
- }
-}
-
-// Controls whether events will be forwarded by the repeater to the
-// listeners in the list.
-bool TestEventListeners::EventForwardingEnabled() const {
- return repeater_->forwarding_enabled();
-}
-
-void TestEventListeners::SuppressEventForwarding() {
- repeater_->set_forwarding_enabled(false);
-}
-
-// class UnitTest
-
-// Gets the singleton UnitTest object. The first time this method is
-// called, a UnitTest object is constructed and returned. Consecutive
-// calls will return the same object.
-//
-// We don't protect this under mutex_ as a user is not supposed to
-// call this before main() starts, from which point on the return
-// value will never change.
-UnitTest* UnitTest::GetInstance() {
- // When compiled with MSVC 7.1 in optimized mode, destroying the
- // UnitTest object upon exiting the program messes up the exit code,
- // causing successful tests to appear failed. We have to use a
- // different implementation in this case to bypass the compiler bug.
- // This implementation makes the compiler happy, at the cost of
- // leaking the UnitTest object.
-
- // CodeGear C++Builder insists on a public destructor for the
- // default implementation. Use this implementation to keep good OO
- // design with private destructor.
-
-#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
- static UnitTest* const instance = new UnitTest;
- return instance;
-#else
- static UnitTest instance;
- return &instance;
-#endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
-}
-
-// Gets the number of successful test cases.
-int UnitTest::successful_test_case_count() const {
- return impl()->successful_test_case_count();
-}
-
-// Gets the number of failed test cases.
-int UnitTest::failed_test_case_count() const {
- return impl()->failed_test_case_count();
-}
-
-// Gets the number of all test cases.
-int UnitTest::total_test_case_count() const {
- return impl()->total_test_case_count();
-}
-
-// Gets the number of all test cases that contain at least one test
-// that should run.
-int UnitTest::test_case_to_run_count() const {
- return impl()->test_case_to_run_count();
-}
-
-// Gets the number of successful tests.
-int UnitTest::successful_test_count() const {
- return impl()->successful_test_count();
-}
-
-// Gets the number of failed tests.
-int UnitTest::failed_test_count() const { return impl()->failed_test_count(); }
-
-// Gets the number of disabled tests that will be reported in the XML report.
-int UnitTest::reportable_disabled_test_count() const {
- return impl()->reportable_disabled_test_count();
-}
-
-// Gets the number of disabled tests.
-int UnitTest::disabled_test_count() const {
- return impl()->disabled_test_count();
-}
-
-// Gets the number of tests to be printed in the XML report.
-int UnitTest::reportable_test_count() const {
- return impl()->reportable_test_count();
-}
-
-// Gets the number of all tests.
-int UnitTest::total_test_count() const { return impl()->total_test_count(); }
-
-// Gets the number of tests that should run.
-int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
-
-// Gets the time of the test program start, in ms from the start of the
-// UNIX epoch.
-internal::TimeInMillis UnitTest::start_timestamp() const {
- return impl()->start_timestamp();
-}
-
-// Gets the elapsed time, in milliseconds.
-internal::TimeInMillis UnitTest::elapsed_time() const {
- return impl()->elapsed_time();
-}
-
-// Returns true iff the unit test passed (i.e. all test cases passed).
-bool UnitTest::Passed() const { return impl()->Passed(); }
-
-// Returns true iff the unit test failed (i.e. some test case failed
-// or something outside of all tests failed).
-bool UnitTest::Failed() const { return impl()->Failed(); }
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-const TestCase* UnitTest::GetTestCase(int i) const {
- return impl()->GetTestCase(i);
-}
-
-// Returns the TestResult containing information on test failures and
-// properties logged outside of individual test cases.
-const TestResult& UnitTest::ad_hoc_test_result() const {
- return *impl()->ad_hoc_test_result();
-}
-
-// Gets the i-th test case among all the test cases. i can range from 0 to
-// total_test_case_count() - 1. If i is not in that range, returns NULL.
-TestCase* UnitTest::GetMutableTestCase(int i) {
- return impl()->GetMutableTestCase(i);
-}
-
-// Returns the list of event listeners that can be used to track events
-// inside Google Test.
-TestEventListeners& UnitTest::listeners() {
- return *impl()->listeners();
-}
-
-// Registers and returns a global test environment. When a test
-// program is run, all global test environments will be set-up in the
-// order they were registered. After all tests in the program have
-// finished, all global test environments will be torn-down in the
-// *reverse* order they were registered.
-//
-// The UnitTest object takes ownership of the given environment.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-Environment* UnitTest::AddEnvironment(Environment* env) {
- if (env == NULL) {
- return NULL;
- }
-
- impl_->environments().push_back(env);
- return env;
-}
-
-// Adds a TestPartResult to the current TestResult object. All Google Test
-// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
-// this to report their results. The user code should use the
-// assertion macros instead of calling this directly.
-void UnitTest::AddTestPartResult(
- TestPartResult::Type result_type,
- const char* file_name,
- int line_number,
- const std::string& message,
- const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) {
- Message msg;
- msg << message;
-
- internal::MutexLock lock(&mutex_);
- if (impl_->gtest_trace_stack().size() > 0) {
- msg << "\n" << GTEST_NAME_ << " trace:";
-
- for (int i = static_cast<int>(impl_->gtest_trace_stack().size());
- i > 0; --i) {
- const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1];
- msg << "\n" << internal::FormatFileLocation(trace.file, trace.line)
- << " " << trace.message;
- }
- }
-
- if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
- msg << internal::kStackTraceMarker << os_stack_trace;
- }
-
- const TestPartResult result =
- TestPartResult(result_type, file_name, line_number,
- msg.GetString().c_str());
- impl_->GetTestPartResultReporterForCurrentThread()->
- ReportTestPartResult(result);
-
- if (result_type != TestPartResult::kSuccess) {
- // gtest_break_on_failure takes precedence over
- // gtest_throw_on_failure. This allows a user to set the latter
- // in the code (perhaps in order to use Google Test assertions
- // with another testing framework) and specify the former on the
- // command line for debugging.
- if (GTEST_FLAG(break_on_failure)) {
-#if GTEST_OS_WINDOWS
- // Using DebugBreak on Windows allows gtest to still break into a debugger
- // when a failure happens and both the --gtest_break_on_failure and
- // the --gtest_catch_exceptions flags are specified.
- DebugBreak();
-#else
- // Dereference NULL through a volatile pointer to prevent the compiler
- // from removing. We use this rather than abort() or __builtin_trap() for
- // portability: Symbian doesn't implement abort() well, and some debuggers
- // don't correctly trap abort().
- *static_cast<volatile int*>(NULL) = 1;
-#endif // GTEST_OS_WINDOWS
- } else if (GTEST_FLAG(throw_on_failure)) {
-#if GTEST_HAS_EXCEPTIONS
- throw internal::GoogleTestFailureException(result);
-#else
- // We cannot call abort() as it generates a pop-up in debug mode
- // that cannot be suppressed in VC 7.1 or below.
- exit(1);
-#endif
- }
- }
-}
-
-// Adds a TestProperty to the current TestResult object when invoked from
-// inside a test, to current TestCase's ad_hoc_test_result_ when invoked
-// from SetUpTestCase or TearDownTestCase, or to the global property set
-// when invoked elsewhere. If the result already contains a property with
-// the same key, the value will be updated.
-void UnitTest::RecordProperty(const std::string& key,
- const std::string& value) {
- impl_->RecordProperty(TestProperty(key, value));
-}
-
-// Runs all tests in this UnitTest object and prints the result.
-// Returns 0 if successful, or 1 otherwise.
-//
-// We don't protect this under mutex_, as we only support calling it
-// from the main thread.
-int UnitTest::Run() {
- const bool in_death_test_child_process =
- internal::GTEST_FLAG(internal_run_death_test).length() > 0;
-
- // Google Test implements this protocol for catching that a test
- // program exits before returning control to Google Test:
- //
- // 1. Upon start, Google Test creates a file whose absolute path
- // is specified by the environment variable
- // TEST_PREMATURE_EXIT_FILE.
- // 2. When Google Test has finished its work, it deletes the file.
- //
- // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before
- // running a Google-Test-based test program and check the existence
- // of the file at the end of the test execution to see if it has
- // exited prematurely.
-
- // If we are in the child process of a death test, don't
- // create/delete the premature exit file, as doing so is unnecessary
- // and will confuse the parent process. Otherwise, create/delete
- // the file upon entering/leaving this function. If the program
- // somehow exits before this function has a chance to return, the
- // premature-exit file will be left undeleted, causing a test runner
- // that understands the premature-exit-file protocol to report the
- // test as having failed.
- const internal::ScopedPrematureExitFile premature_exit_file(
- in_death_test_child_process ?
- NULL : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE"));
-
- // Captures the value of GTEST_FLAG(catch_exceptions). This value will be
- // used for the duration of the program.
- impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions));
-
-#if GTEST_HAS_SEH
- // Either the user wants Google Test to catch exceptions thrown by the
- // tests or this is executing in the context of death test child
- // process. In either case the user does not want to see pop-up dialogs
- // about crashes - they are expected.
- if (impl()->catch_exceptions() || in_death_test_child_process) {
-# if !GTEST_OS_WINDOWS_MOBILE
- // SetErrorMode doesn't exist on CE.
- SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
- SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
-# endif // !GTEST_OS_WINDOWS_MOBILE
-
-# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
- // Death test children can be terminated with _abort(). On Windows,
- // _abort() can show a dialog with a warning message. This forces the
- // abort message to go to stderr instead.
- _set_error_mode(_OUT_TO_STDERR);
-# endif
-
-# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
- // In the debug version, Visual Studio pops up a separate dialog
- // offering a choice to debug the aborted program. We need to suppress
- // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
- // executed. Google Test will notify the user of any unexpected
- // failure via stderr.
- //
- // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.
- // Users of prior VC versions shall suffer the agony and pain of
- // clicking through the countless debug dialogs.
- // TODO(vladl@google.com): find a way to suppress the abort dialog() in the
- // debug mode when compiled with VC 7.1 or lower.
- if (!GTEST_FLAG(break_on_failure))
- _set_abort_behavior(
- 0x0, // Clear the following flags:
- _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump.
-# endif
- }
-#endif // GTEST_HAS_SEH
-
- return internal::HandleExceptionsInMethodIfSupported(
- impl(),
- &internal::UnitTestImpl::RunAllTests,
- "auxiliary test code (environments or event listeners)") ? 0 : 1;
-}
-
-// Returns the working directory when the first TEST() or TEST_F() was
-// executed.
-const char* UnitTest::original_working_dir() const {
- return impl_->original_working_dir_.c_str();
-}
-
-// Returns the TestCase object for the test that's currently running,
-// or NULL if no test is running.
-const TestCase* UnitTest::current_test_case() const
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- return impl_->current_test_case();
-}
-
-// Returns the TestInfo object for the test that's currently running,
-// or NULL if no test is running.
-const TestInfo* UnitTest::current_test_info() const
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- return impl_->current_test_info();
-}
-
-// Returns the random seed used at the start of the current test run.
-int UnitTest::random_seed() const { return impl_->random_seed(); }
-
-#if GTEST_HAS_PARAM_TEST
-// Returns ParameterizedTestCaseRegistry object used to keep track of
-// value-parameterized tests and instantiate and register them.
-internal::ParameterizedTestCaseRegistry&
- UnitTest::parameterized_test_registry()
- GTEST_LOCK_EXCLUDED_(mutex_) {
- return impl_->parameterized_test_registry();
-}
-#endif // GTEST_HAS_PARAM_TEST
-
-// Creates an empty UnitTest.
-UnitTest::UnitTest() {
- impl_ = new internal::UnitTestImpl(this);
-}
-
-// Destructor of UnitTest.
-UnitTest::~UnitTest() {
- delete impl_;
-}
-
-// Pushes a trace defined by SCOPED_TRACE() on to the per-thread
-// Google Test trace stack.
-void UnitTest::PushGTestTrace(const internal::TraceInfo& trace)
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- impl_->gtest_trace_stack().push_back(trace);
-}
-
-// Pops a trace from the per-thread Google Test trace stack.
-void UnitTest::PopGTestTrace()
- GTEST_LOCK_EXCLUDED_(mutex_) {
- internal::MutexLock lock(&mutex_);
- impl_->gtest_trace_stack().pop_back();
-}
-
-namespace internal {
-
-UnitTestImpl::UnitTestImpl(UnitTest* parent)
- : parent_(parent),
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4355) // Temporarily disables warning 4355
- // (using this in initializer).
- default_global_test_part_result_reporter_(this),
- default_per_thread_test_part_result_reporter_(this),
-# pragma warning(pop) // Restores the warning state again.
-#else
- default_global_test_part_result_reporter_(this),
- default_per_thread_test_part_result_reporter_(this),
-#endif // _MSC_VER
- global_test_part_result_repoter_(
- &default_global_test_part_result_reporter_),
- per_thread_test_part_result_reporter_(
- &default_per_thread_test_part_result_reporter_),
-#if GTEST_HAS_PARAM_TEST
- parameterized_test_registry_(),
- parameterized_tests_registered_(false),
-#endif // GTEST_HAS_PARAM_TEST
- last_death_test_case_(-1),
- current_test_case_(NULL),
- current_test_info_(NULL),
- ad_hoc_test_result_(),
- os_stack_trace_getter_(NULL),
- post_flag_parse_init_performed_(false),
- random_seed_(0), // Will be overridden by the flag before first use.
- random_(0), // Will be reseeded before first use.
- start_timestamp_(0),
- elapsed_time_(0),
-#if GTEST_HAS_DEATH_TEST
- death_test_factory_(new DefaultDeathTestFactory),
-#endif
- // Will be overridden by the flag before first use.
- catch_exceptions_(false) {
- listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter);
-}
-
-UnitTestImpl::~UnitTestImpl() {
- // Deletes every TestCase.
- ForEach(test_cases_, internal::Delete<TestCase>);
-
- // Deletes every Environment.
- ForEach(environments_, internal::Delete<Environment>);
-
- delete os_stack_trace_getter_;
-}
-
-// Adds a TestProperty to the current TestResult object when invoked in a
-// context of a test, to current test case's ad_hoc_test_result when invoke
-// from SetUpTestCase/TearDownTestCase, or to the global property set
-// otherwise. If the result already contains a property with the same key,
-// the value will be updated.
-void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
- std::string xml_element;
- TestResult* test_result; // TestResult appropriate for property recording.
-
- if (current_test_info_ != NULL) {
- xml_element = "testcase";
- test_result = &(current_test_info_->result_);
- } else if (current_test_case_ != NULL) {
- xml_element = "testsuite";
- test_result = &(current_test_case_->ad_hoc_test_result_);
- } else {
- xml_element = "testsuites";
- test_result = &ad_hoc_test_result_;
- }
- test_result->RecordProperty(xml_element, test_property);
-}
-
-#if GTEST_HAS_DEATH_TEST
-// Disables event forwarding if the control is currently in a death test
-// subprocess. Must not be called before InitGoogleTest.
-void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
- if (internal_run_death_test_flag_.get() != NULL)
- listeners()->SuppressEventForwarding();
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-// Initializes event listeners performing XML output as specified by
-// UnitTestOptions. Must not be called before InitGoogleTest.
-void UnitTestImpl::ConfigureXmlOutput() {
- const std::string& output_format = UnitTestOptions::GetOutputFormat();
- if (output_format == "xml") {
- listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
- UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
- } else if (output_format != "") {
- printf("WARNING: unrecognized output format \"%s\" ignored.\n",
- output_format.c_str());
- fflush(stdout);
- }
-}
-
-#if GTEST_CAN_STREAM_RESULTS_
-// Initializes event listeners for streaming test results in string form.
-// Must not be called before InitGoogleTest.
-void UnitTestImpl::ConfigureStreamingOutput() {
- const std::string& target = GTEST_FLAG(stream_result_to);
- if (!target.empty()) {
- const size_t pos = target.find(':');
- if (pos != std::string::npos) {
- listeners()->Append(new StreamingListener(target.substr(0, pos),
- target.substr(pos+1)));
- } else {
- printf("WARNING: unrecognized streaming target \"%s\" ignored.\n",
- target.c_str());
- fflush(stdout);
- }
- }
-}
-#endif // GTEST_CAN_STREAM_RESULTS_
-
-// Performs initialization dependent upon flag values obtained in
-// ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
-// ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
-// this function is also called from RunAllTests. Since this function can be
-// called more than once, it has to be idempotent.
-void UnitTestImpl::PostFlagParsingInit() {
- // Ensures that this function does not execute more than once.
- if (!post_flag_parse_init_performed_) {
- post_flag_parse_init_performed_ = true;
-
-#if GTEST_HAS_DEATH_TEST
- InitDeathTestSubprocessControlInfo();
- SuppressTestEventsIfInSubprocess();
-#endif // GTEST_HAS_DEATH_TEST
-
- // Registers parameterized tests. This makes parameterized tests
- // available to the UnitTest reflection API without running
- // RUN_ALL_TESTS.
- RegisterParameterizedTests();
-
- // Configures listeners for XML output. This makes it possible for users
- // to shut down the default XML output before invoking RUN_ALL_TESTS.
- ConfigureXmlOutput();
-
-#if GTEST_CAN_STREAM_RESULTS_
- // Configures listeners for streaming test results to the specified server.
- ConfigureStreamingOutput();
-#endif // GTEST_CAN_STREAM_RESULTS_
- }
-}
-
-// A predicate that checks the name of a TestCase against a known
-// value.
-//
-// This is used for implementation of the UnitTest class only. We put
-// it in the anonymous namespace to prevent polluting the outer
-// namespace.
-//
-// TestCaseNameIs is copyable.
-class TestCaseNameIs {
- public:
- // Constructor.
- explicit TestCaseNameIs(const std::string& name)
- : name_(name) {}
-
- // Returns true iff the name of test_case matches name_.
- bool operator()(const TestCase* test_case) const {
- return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0;
- }
-
- private:
- std::string name_;
-};
-
-// Finds and returns a TestCase with the given name. If one doesn't
-// exist, creates one and returns it. It's the CALLER'S
-// RESPONSIBILITY to ensure that this function is only called WHEN THE
-// TESTS ARE NOT SHUFFLED.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// type_param: the name of the test case's type parameter, or NULL if
-// this is not a typed or a type-parameterized test case.
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-TestCase* UnitTestImpl::GetTestCase(const char* test_case_name,
- const char* type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc) {
- // Can we find a TestCase with the given name?
- const std::vector<TestCase*>::const_iterator test_case =
- std::find_if(test_cases_.begin(), test_cases_.end(),
- TestCaseNameIs(test_case_name));
-
- if (test_case != test_cases_.end())
- return *test_case;
-
- // No. Let's create one.
- TestCase* const new_test_case =
- new TestCase(test_case_name, type_param, set_up_tc, tear_down_tc);
-
- // Is this a death test case?
- if (internal::UnitTestOptions::MatchesFilter(test_case_name,
- kDeathTestCaseFilter)) {
- // Yes. Inserts the test case after the last death test case
- // defined so far. This only works when the test cases haven't
- // been shuffled. Otherwise we may end up running a death test
- // after a non-death test.
- ++last_death_test_case_;
- test_cases_.insert(test_cases_.begin() + last_death_test_case_,
- new_test_case);
- } else {
- // No. Appends to the end of the list.
- test_cases_.push_back(new_test_case);
- }
-
- test_case_indices_.push_back(static_cast<int>(test_case_indices_.size()));
- return new_test_case;
-}
-
-// Helpers for setting up / tearing down the given environment. They
-// are for use in the ForEach() function.
-static void SetUpEnvironment(Environment* env) { env->SetUp(); }
-static void TearDownEnvironment(Environment* env) { env->TearDown(); }
-
-// Runs all tests in this UnitTest object, prints the result, and
-// returns true if all tests are successful. If any exception is
-// thrown during a test, the test is considered to be failed, but the
-// rest of the tests will still be run.
-//
-// When parameterized tests are enabled, it expands and registers
-// parameterized tests first in RegisterParameterizedTests().
-// All other functions called from RunAllTests() may safely assume that
-// parameterized tests are ready to be counted and run.
-bool UnitTestImpl::RunAllTests() {
- // Makes sure InitGoogleTest() was called.
- if (!GTestIsInitialized()) {
- printf("%s",
- "\nThis test program did NOT call ::testing::InitGoogleTest "
- "before calling RUN_ALL_TESTS(). Please fix it.\n");
- return false;
- }
-
- // Do not run any test if the --help flag was specified.
- if (g_help_flag)
- return true;
-
- // Repeats the call to the post-flag parsing initialization in case the
- // user didn't call InitGoogleTest.
- PostFlagParsingInit();
-
- // Even if sharding is not on, test runners may want to use the
- // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
- // protocol.
- internal::WriteToShardStatusFileIfNeeded();
-
- // True iff we are in a subprocess for running a thread-safe-style
- // death test.
- bool in_subprocess_for_death_test = false;
-
-#if GTEST_HAS_DEATH_TEST
- in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
-#endif // GTEST_HAS_DEATH_TEST
-
- const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex,
- in_subprocess_for_death_test);
-
- // Compares the full test names with the filter to decide which
- // tests to run.
- const bool has_tests_to_run = FilterTests(should_shard
- ? HONOR_SHARDING_PROTOCOL
- : IGNORE_SHARDING_PROTOCOL) > 0;
-
- // Lists the tests and exits if the --gtest_list_tests flag was specified.
- if (GTEST_FLAG(list_tests)) {
- // This must be called *after* FilterTests() has been called.
- ListTestsMatchingFilter();
- return true;
- }
-
- random_seed_ = GTEST_FLAG(shuffle) ?
- GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0;
-
- // True iff at least one test has failed.
- bool failed = false;
-
- TestEventListener* repeater = listeners()->repeater();
-
- start_timestamp_ = GetTimeInMillis();
- repeater->OnTestProgramStart(*parent_);
-
- // How many times to repeat the tests? We don't want to repeat them
- // when we are inside the subprocess of a death test.
- const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat);
- // Repeats forever if the repeat count is negative.
- const bool forever = repeat < 0;
- for (int i = 0; forever || i != repeat; i++) {
- // We want to preserve failures generated by ad-hoc test
- // assertions executed before RUN_ALL_TESTS().
- ClearNonAdHocTestResult();
-
- const TimeInMillis start = GetTimeInMillis();
-
- // Shuffles test cases and tests if requested.
- if (has_tests_to_run && GTEST_FLAG(shuffle)) {
- random()->Reseed(random_seed_);
- // This should be done before calling OnTestIterationStart(),
- // such that a test event listener can see the actual test order
- // in the event.
- ShuffleTests();
- }
-
- // Tells the unit test event listeners that the tests are about to start.
- repeater->OnTestIterationStart(*parent_, i);
-
- // Runs each test case if there is at least one test to run.
- if (has_tests_to_run) {
- // Sets up all environments beforehand.
- repeater->OnEnvironmentsSetUpStart(*parent_);
- ForEach(environments_, SetUpEnvironment);
- repeater->OnEnvironmentsSetUpEnd(*parent_);
-
- // Runs the tests only if there was no fatal failure during global
- // set-up.
- if (!Test::HasFatalFailure()) {
- for (int test_index = 0; test_index < total_test_case_count();
- test_index++) {
- GetMutableTestCase(test_index)->Run();
- }
- }
-
- // Tears down all environments in reverse order afterwards.
- repeater->OnEnvironmentsTearDownStart(*parent_);
- std::for_each(environments_.rbegin(), environments_.rend(),
- TearDownEnvironment);
- repeater->OnEnvironmentsTearDownEnd(*parent_);
- }
-
- elapsed_time_ = GetTimeInMillis() - start;
-
- // Tells the unit test event listener that the tests have just finished.
- repeater->OnTestIterationEnd(*parent_, i);
-
- // Gets the result and clears it.
- if (!Passed()) {
- failed = true;
- }
-
- // Restores the original test order after the iteration. This
- // allows the user to quickly repro a failure that happens in the
- // N-th iteration without repeating the first (N - 1) iterations.
- // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in
- // case the user somehow changes the value of the flag somewhere
- // (it's always safe to unshuffle the tests).
- UnshuffleTests();
-
- if (GTEST_FLAG(shuffle)) {
- // Picks a new random seed for each iteration.
- random_seed_ = GetNextRandomSeed(random_seed_);
- }
- }
-
- repeater->OnTestProgramEnd(*parent_);
-
- return !failed;
-}
-
-// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
-// if the variable is present. If a file already exists at this location, this
-// function will write over it. If the variable is present, but the file cannot
-// be created, prints an error and exits.
-void WriteToShardStatusFileIfNeeded() {
- const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);
- if (test_shard_file != NULL) {
- FILE* const file = posix::FOpen(test_shard_file, "w");
- if (file == NULL) {
- ColoredPrintf(COLOR_RED,
- "Could not write to the test shard status file \"%s\" "
- "specified by the %s environment variable.\n",
- test_shard_file, kTestShardStatusFile);
- fflush(stdout);
- exit(EXIT_FAILURE);
- }
- fclose(file);
- }
-}
-
-// Checks whether sharding is enabled by examining the relevant
-// environment variable values. If the variables are present,
-// but inconsistent (i.e., shard_index >= total_shards), prints
-// an error and exits. If in_subprocess_for_death_test, sharding is
-// disabled because it must only be applied to the original test
-// process. Otherwise, we could filter out death tests we intended to execute.
-bool ShouldShard(const char* total_shards_env,
- const char* shard_index_env,
- bool in_subprocess_for_death_test) {
- if (in_subprocess_for_death_test) {
- return false;
- }
-
- const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1);
- const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1);
-
- if (total_shards == -1 && shard_index == -1) {
- return false;
- } else if (total_shards == -1 && shard_index != -1) {
- const Message msg = Message()
- << "Invalid environment variables: you have "
- << kTestShardIndex << " = " << shard_index
- << ", but have left " << kTestTotalShards << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- } else if (total_shards != -1 && shard_index == -1) {
- const Message msg = Message()
- << "Invalid environment variables: you have "
- << kTestTotalShards << " = " << total_shards
- << ", but have left " << kTestShardIndex << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- } else if (shard_index < 0 || shard_index >= total_shards) {
- const Message msg = Message()
- << "Invalid environment variables: we require 0 <= "
- << kTestShardIndex << " < " << kTestTotalShards
- << ", but you have " << kTestShardIndex << "=" << shard_index
- << ", " << kTestTotalShards << "=" << total_shards << ".\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
- fflush(stdout);
- exit(EXIT_FAILURE);
- }
-
- return total_shards > 1;
-}
-
-// Parses the environment variable var as an Int32. If it is unset,
-// returns default_val. If it is not an Int32, prints an error
-// and aborts.
-Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
- const char* str_val = posix::GetEnv(var);
- if (str_val == NULL) {
- return default_val;
- }
-
- Int32 result;
- if (!ParseInt32(Message() << "The value of environment variable " << var,
- str_val, &result)) {
- exit(EXIT_FAILURE);
- }
- return result;
-}
-
-// Given the total number of shards, the shard index, and the test id,
-// returns true iff the test should be run on this shard. The test id is
-// some arbitrary but unique non-negative integer assigned to each test
-// method. Assumes that 0 <= shard_index < total_shards.
-bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
- return (test_id % total_shards) == shard_index;
-}
-
-// Compares the name of each test with the user-specified filter to
-// decide whether the test should be run, then records the result in
-// each TestCase and TestInfo object.
-// If shard_tests == true, further filters tests based on sharding
-// variables in the environment - see
-// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide.
-// Returns the number of tests that should run.
-int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
- const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
- Int32FromEnvOrDie(kTestTotalShards, -1) : -1;
- const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ?
- Int32FromEnvOrDie(kTestShardIndex, -1) : -1;
-
- // num_runnable_tests are the number of tests that will
- // run across all shards (i.e., match filter and are not disabled).
- // num_selected_tests are the number of tests to be run on
- // this shard.
- int num_runnable_tests = 0;
- int num_selected_tests = 0;
- for (size_t i = 0; i < test_cases_.size(); i++) {
- TestCase* const test_case = test_cases_[i];
- const std::string &test_case_name = test_case->name();
- test_case->set_should_run(false);
-
- for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
- TestInfo* const test_info = test_case->test_info_list()[j];
- const std::string test_name(test_info->name());
- // A test is disabled if test case name or test name matches
- // kDisableTestFilter.
- const bool is_disabled =
- internal::UnitTestOptions::MatchesFilter(test_case_name,
- kDisableTestFilter) ||
- internal::UnitTestOptions::MatchesFilter(test_name,
- kDisableTestFilter);
- test_info->is_disabled_ = is_disabled;
-
- const bool matches_filter =
- internal::UnitTestOptions::FilterMatchesTest(test_case_name,
- test_name);
- test_info->matches_filter_ = matches_filter;
-
- const bool is_runnable =
- (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) &&
- matches_filter;
-
- const bool is_selected = is_runnable &&
- (shard_tests == IGNORE_SHARDING_PROTOCOL ||
- ShouldRunTestOnShard(total_shards, shard_index,
- num_runnable_tests));
-
- num_runnable_tests += is_runnable;
- num_selected_tests += is_selected;
-
- test_info->should_run_ = is_selected;
- test_case->set_should_run(test_case->should_run() || is_selected);
- }
- }
- return num_selected_tests;
-}
-
-// Prints the given C-string on a single line by replacing all '\n'
-// characters with string "\\n". If the output takes more than
-// max_length characters, only prints the first max_length characters
-// and "...".
-static void PrintOnOneLine(const char* str, int max_length) {
- if (str != NULL) {
- for (int i = 0; *str != '\0'; ++str) {
- if (i >= max_length) {
- printf("...");
- break;
- }
- if (*str == '\n') {
- printf("\\n");
- i += 2;
- } else {
- printf("%c", *str);
- ++i;
- }
- }
- }
-}
-
-// Prints the names of the tests matching the user-specified filter flag.
-void UnitTestImpl::ListTestsMatchingFilter() {
- // Print at most this many characters for each type/value parameter.
- const int kMaxParamLength = 250;
-
- for (size_t i = 0; i < test_cases_.size(); i++) {
- const TestCase* const test_case = test_cases_[i];
- bool printed_test_case_name = false;
-
- for (size_t j = 0; j < test_case->test_info_list().size(); j++) {
- const TestInfo* const test_info =
- test_case->test_info_list()[j];
- if (test_info->matches_filter_) {
- if (!printed_test_case_name) {
- printed_test_case_name = true;
- printf("%s.", test_case->name());
- if (test_case->type_param() != NULL) {
- printf(" # %s = ", kTypeParamLabel);
- // We print the type parameter on a single line to make
- // the output easy to parse by a program.
- PrintOnOneLine(test_case->type_param(), kMaxParamLength);
- }
- printf("\n");
- }
- printf(" %s", test_info->name());
- if (test_info->value_param() != NULL) {
- printf(" # %s = ", kValueParamLabel);
- // We print the value parameter on a single line to make the
- // output easy to parse by a program.
- PrintOnOneLine(test_info->value_param(), kMaxParamLength);
- }
- printf("\n");
- }
- }
- }
- fflush(stdout);
-}
-
-// Sets the OS stack trace getter.
-//
-// Does nothing if the input and the current OS stack trace getter are
-// the same; otherwise, deletes the old getter and makes the input the
-// current getter.
-void UnitTestImpl::set_os_stack_trace_getter(
- OsStackTraceGetterInterface* getter) {
- if (os_stack_trace_getter_ != getter) {
- delete os_stack_trace_getter_;
- os_stack_trace_getter_ = getter;
- }
-}
-
-// Returns the current OS stack trace getter if it is not NULL;
-// otherwise, creates an OsStackTraceGetter, makes it the current
-// getter, and returns it.
-OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
- if (os_stack_trace_getter_ == NULL) {
- os_stack_trace_getter_ = new OsStackTraceGetter;
- }
-
- return os_stack_trace_getter_;
-}
-
-// Returns the TestResult for the test that's currently running, or
-// the TestResult for the ad hoc test if no test is running.
-TestResult* UnitTestImpl::current_test_result() {
- return current_test_info_ ?
- &(current_test_info_->result_) : &ad_hoc_test_result_;
-}
-
-// Shuffles all test cases, and the tests within each test case,
-// making sure that death tests are still run first.
-void UnitTestImpl::ShuffleTests() {
- // Shuffles the death test cases.
- ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_);
-
- // Shuffles the non-death test cases.
- ShuffleRange(random(), last_death_test_case_ + 1,
- static_cast<int>(test_cases_.size()), &test_case_indices_);
-
- // Shuffles the tests inside each test case.
- for (size_t i = 0; i < test_cases_.size(); i++) {
- test_cases_[i]->ShuffleTests(random());
- }
-}
-
-// Restores the test cases and tests to their order before the first shuffle.
-void UnitTestImpl::UnshuffleTests() {
- for (size_t i = 0; i < test_cases_.size(); i++) {
- // Unshuffles the tests in each test case.
- test_cases_[i]->UnshuffleTests();
- // Resets the index of each test case.
- test_case_indices_[i] = static_cast<int>(i);
- }
-}
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
- int skip_count) {
- // We pass skip_count + 1 to skip this wrapper function in addition
- // to what the user really wants to skip.
- return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
-}
-
-// Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to
-// suppress unreachable code warnings.
-namespace {
-class ClassUniqueToAlwaysTrue {};
-}
-
-bool IsTrue(bool condition) { return condition; }
-
-bool AlwaysTrue() {
-#if GTEST_HAS_EXCEPTIONS
- // This condition is always false so AlwaysTrue() never actually throws,
- // but it makes the compiler think that it may throw.
- if (IsTrue(false))
- throw ClassUniqueToAlwaysTrue();
-#endif // GTEST_HAS_EXCEPTIONS
- return true;
-}
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false. None of pstr, *pstr, and prefix can be NULL.
-bool SkipPrefix(const char* prefix, const char** pstr) {
- const size_t prefix_len = strlen(prefix);
- if (strncmp(*pstr, prefix, prefix_len) == 0) {
- *pstr += prefix_len;
- return true;
- }
- return false;
-}
-
-// Parses a string as a command line flag. The string should have
-// the format "--flag=value". When def_optional is true, the "=value"
-// part can be omitted.
-//
-// Returns the value of the flag, or NULL if the parsing failed.
-const char* ParseFlagValue(const char* str,
- const char* flag,
- bool def_optional) {
- // str and flag must not be NULL.
- if (str == NULL || flag == NULL) return NULL;
-
- // The flag must start with "--" followed by GTEST_FLAG_PREFIX_.
- const std::string flag_str = std::string("--") + GTEST_FLAG_PREFIX_ + flag;
- const size_t flag_len = flag_str.length();
- if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
-
- // Skips the flag name.
- const char* flag_end = str + flag_len;
-
- // When def_optional is true, it's OK to not have a "=value" part.
- if (def_optional && (flag_end[0] == '\0')) {
- return flag_end;
- }
-
- // If def_optional is true and there are more characters after the
- // flag name, or if def_optional is false, there must be a '=' after
- // the flag name.
- if (flag_end[0] != '=') return NULL;
-
- // Returns the string after "=".
- return flag_end + 1;
-}
-
-// Parses a string for a bool flag, in the form of either
-// "--flag=value" or "--flag".
-//
-// In the former case, the value is taken as true as long as it does
-// not start with '0', 'f', or 'F'.
-//
-// In the latter case, the value is taken as true.
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, true);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Converts the string value to a bool.
- *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F');
- return true;
-}
-
-// Parses a string for an Int32 flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, false);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Sets *value to the value of the flag.
- return ParseInt32(Message() << "The value of flag --" << flag,
- value_str, value);
-}
-
-// Parses a string for a string flag, in the form of
-// "--flag=value".
-//
-// On success, stores the value of the flag in *value, and returns
-// true. On failure, returns false without changing *value.
-bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
- // Gets the value of the flag as a string.
- const char* const value_str = ParseFlagValue(str, flag, false);
-
- // Aborts if the parsing failed.
- if (value_str == NULL) return false;
-
- // Sets *value to the value of the flag.
- *value = value_str;
- return true;
-}
-
-// Determines whether a string has a prefix that Google Test uses for its
-// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
-// If Google Test detects that a command line flag has its prefix but is not
-// recognized, it will print its help message. Flags starting with
-// GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test
-// internal flags and do not trigger the help message.
-static bool HasGoogleTestFlagPrefix(const char* str) {
- return (SkipPrefix("--", &str) ||
- SkipPrefix("-", &str) ||
- SkipPrefix("/", &str)) &&
- !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) &&
- (SkipPrefix(GTEST_FLAG_PREFIX_, &str) ||
- SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str));
-}
-
-// Prints a string containing code-encoded text. The following escape
-// sequences can be used in the string to control the text color:
-//
-// @@ prints a single '@' character.
-// @R changes the color to red.
-// @G changes the color to green.
-// @Y changes the color to yellow.
-// @D changes to the default terminal text color.
-//
-// TODO(wan@google.com): Write tests for this once we add stdout
-// capturing to Google Test.
-static void PrintColorEncoded(const char* str) {
- GTestColor color = COLOR_DEFAULT; // The current color.
-
- // Conceptually, we split the string into segments divided by escape
- // sequences. Then we print one segment at a time. At the end of
- // each iteration, the str pointer advances to the beginning of the
- // next segment.
- for (;;) {
- const char* p = strchr(str, '@');
- if (p == NULL) {
- ColoredPrintf(color, "%s", str);
- return;
- }
-
- ColoredPrintf(color, "%s", std::string(str, p).c_str());
-
- const char ch = p[1];
- str = p + 2;
- if (ch == '@') {
- ColoredPrintf(color, "@");
- } else if (ch == 'D') {
- color = COLOR_DEFAULT;
- } else if (ch == 'R') {
- color = COLOR_RED;
- } else if (ch == 'G') {
- color = COLOR_GREEN;
- } else if (ch == 'Y') {
- color = COLOR_YELLOW;
- } else {
- --str;
- }
- }
-}
-
-static const char kColorEncodedHelpMessage[] =
-"This program contains tests written using " GTEST_NAME_ ". You can use the\n"
-"following command line flags to control its behavior:\n"
-"\n"
-"Test Selection:\n"
-" @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n"
-" List the names of all tests instead of running them. The name of\n"
-" TEST(Foo, Bar) is \"Foo.Bar\".\n"
-" @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS"
- "[@G-@YNEGATIVE_PATTERNS]@D\n"
-" Run only the tests whose name matches one of the positive patterns but\n"
-" none of the negative patterns. '?' matches any single character; '*'\n"
-" matches any substring; ':' separates two patterns.\n"
-" @G--" GTEST_FLAG_PREFIX_ "also_run_disabled_tests@D\n"
-" Run all disabled tests too.\n"
-"\n"
-"Test Execution:\n"
-" @G--" GTEST_FLAG_PREFIX_ "repeat=@Y[COUNT]@D\n"
-" Run the tests repeatedly; use a negative count to repeat forever.\n"
-" @G--" GTEST_FLAG_PREFIX_ "shuffle@D\n"
-" Randomize tests' orders on every iteration.\n"
-" @G--" GTEST_FLAG_PREFIX_ "random_seed=@Y[NUMBER]@D\n"
-" Random number seed to use for shuffling test orders (between 1 and\n"
-" 99999, or 0 to use a seed based on the current time).\n"
-"\n"
-"Test Output:\n"
-" @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n"
-" Enable/disable colored output. The default is @Gauto@D.\n"
-" -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n"
-" Don't print the elapsed time of each test.\n"
-" @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G"
- GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n"
-" Generate an XML report in the given directory or with the given file\n"
-" name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.\n"
-#if GTEST_CAN_STREAM_RESULTS_
-" @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n"
-" Stream test results to the given server.\n"
-#endif // GTEST_CAN_STREAM_RESULTS_
-"\n"
-"Assertion Behavior:\n"
-#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-" @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n"
-" Set the default death test style.\n"
-#endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
-" @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n"
-" Turn assertion failures into debugger break-points.\n"
-" @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n"
-" Turn assertion failures into C++ exceptions.\n"
-" @G--" GTEST_FLAG_PREFIX_ "catch_exceptions=0@D\n"
-" Do not report exceptions as test failures. Instead, allow them\n"
-" to crash the program or throw a pop-up (on Windows).\n"
-"\n"
-"Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set "
- "the corresponding\n"
-"environment variable of a flag (all letters in upper-case). For example, to\n"
-"disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_
- "color=no@D or set\n"
-"the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n"
-"\n"
-"For more information, please read the " GTEST_NAME_ " documentation at\n"
-"@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n"
-"(not one in your own code or tests), please report it to\n"
-"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test. The type parameter CharType can be
-// instantiated to either char or wchar_t.
-template <typename CharType>
-void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
- for (int i = 1; i < *argc; i++) {
- const std::string arg_string = StreamableToString(argv[i]);
- const char* const arg = arg_string.c_str();
-
- using internal::ParseBoolFlag;
- using internal::ParseInt32Flag;
- using internal::ParseStringFlag;
-
- // Do we see a Google Test flag?
- if (ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
- &GTEST_FLAG(also_run_disabled_tests)) ||
- ParseBoolFlag(arg, kBreakOnFailureFlag,
- &GTEST_FLAG(break_on_failure)) ||
- ParseBoolFlag(arg, kCatchExceptionsFlag,
- &GTEST_FLAG(catch_exceptions)) ||
- ParseStringFlag(arg, kColorFlag, &GTEST_FLAG(color)) ||
- ParseStringFlag(arg, kDeathTestStyleFlag,
- &GTEST_FLAG(death_test_style)) ||
- ParseBoolFlag(arg, kDeathTestUseFork,
- &GTEST_FLAG(death_test_use_fork)) ||
- ParseStringFlag(arg, kFilterFlag, &GTEST_FLAG(filter)) ||
- ParseStringFlag(arg, kInternalRunDeathTestFlag,
- &GTEST_FLAG(internal_run_death_test)) ||
- ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||
- ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||
- ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||
- ParseInt32Flag(arg, kRandomSeedFlag, &GTEST_FLAG(random_seed)) ||
- ParseInt32Flag(arg, kRepeatFlag, &GTEST_FLAG(repeat)) ||
- ParseBoolFlag(arg, kShuffleFlag, &GTEST_FLAG(shuffle)) ||
- ParseInt32Flag(arg, kStackTraceDepthFlag,
- &GTEST_FLAG(stack_trace_depth)) ||
- ParseStringFlag(arg, kStreamResultToFlag,
- &GTEST_FLAG(stream_result_to)) ||
- ParseBoolFlag(arg, kThrowOnFailureFlag,
- &GTEST_FLAG(throw_on_failure))
- ) {
- // Yes. Shift the remainder of the argv list left by one. Note
- // that argv has (*argc + 1) elements, the last one always being
- // NULL. The following loop moves the trailing NULL element as
- // well.
- for (int j = i; j != *argc; j++) {
- argv[j] = argv[j + 1];
- }
-
- // Decrements the argument count.
- (*argc)--;
-
- // We also need to decrement the iterator as we just removed
- // an element.
- i--;
- } else if (arg_string == "--help" || arg_string == "-h" ||
- arg_string == "-?" || arg_string == "/?" ||
- HasGoogleTestFlagPrefix(arg)) {
- // Both help flag and unrecognized Google Test flags (excluding
- // internal ones) trigger help display.
- g_help_flag = true;
- }
- }
-
- if (g_help_flag) {
- // We print the help here instead of in RUN_ALL_TESTS(), as the
- // latter may not be called at all if the user is using Google
- // Test with another testing framework.
- PrintColorEncoded(kColorEncodedHelpMessage);
- }
-}
-
-// Parses the command line for Google Test flags, without initializing
-// other parts of Google Test.
-void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
- ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
- ParseGoogleTestFlagsOnlyImpl(argc, argv);
-}
-
-// The internal implementation of InitGoogleTest().
-//
-// The type parameter CharType can be instantiated to either char or
-// wchar_t.
-template <typename CharType>
-void InitGoogleTestImpl(int* argc, CharType** argv) {
- g_init_gtest_count++;
-
- // We don't want to run the initialization code twice.
- if (g_init_gtest_count != 1) return;
-
- if (*argc <= 0) return;
-
- internal::g_executable_path = internal::StreamableToString(argv[0]);
-
-#if GTEST_HAS_DEATH_TEST
-
- g_argvs.clear();
- for (int i = 0; i != *argc; i++) {
- g_argvs.push_back(StreamableToString(argv[i]));
- }
-
-#endif // GTEST_HAS_DEATH_TEST
-
- ParseGoogleTestFlagsOnly(argc, argv);
- GetUnitTestImpl()->PostFlagParsingInit();
-}
-
-} // namespace internal
-
-// Initializes Google Test. This must be called before calling
-// RUN_ALL_TESTS(). In particular, it parses a command line for the
-// flags that Google Test recognizes. Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-void InitGoogleTest(int* argc, char** argv) {
- internal::InitGoogleTestImpl(argc, argv);
-}
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-void InitGoogleTest(int* argc, wchar_t** argv) {
- internal::InitGoogleTestImpl(argc, argv);
-}
-
-} // namespace testing
-// Copyright 2005, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
-//
-// This file implements death tests.
-
-
-#if GTEST_HAS_DEATH_TEST
-
-# if GTEST_OS_MAC
-# include <crt_externs.h>
-# endif // GTEST_OS_MAC
-
-# include <errno.h>
-# include <fcntl.h>
-# include <limits.h>
-
-# if GTEST_OS_LINUX
-# include <signal.h>
-# endif // GTEST_OS_LINUX
-
-# include <stdarg.h>
-
-# if GTEST_OS_WINDOWS
-# include <windows.h>
-# else
-# include <sys/mman.h>
-# include <sys/wait.h>
-# endif // GTEST_OS_WINDOWS
-
-# if GTEST_OS_QNX
-# include <spawn.h>
-# endif // GTEST_OS_QNX
-
-#endif // GTEST_HAS_DEATH_TEST
-
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-// Constants.
-
-// The default death test style.
-static const char kDefaultDeathTestStyle[] = "fast";
-
-GTEST_DEFINE_string_(
- death_test_style,
- internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
- "Indicates how to run a death test in a forked child process: "
- "\"threadsafe\" (child process re-executes the test binary "
- "from the beginning, running only the specific death test) or "
- "\"fast\" (child process runs the death test immediately "
- "after forking).");
-
-GTEST_DEFINE_bool_(
- death_test_use_fork,
- internal::BoolFromGTestEnv("death_test_use_fork", false),
- "Instructs to use fork()/_exit() instead of clone() in death tests. "
- "Ignored and always uses fork() on POSIX systems where clone() is not "
- "implemented. Useful when running under valgrind or similar tools if "
- "those do not support clone(). Valgrind 3.3.1 will just fail if "
- "it sees an unsupported combination of clone() flags. "
- "It is not recommended to use this flag w/o valgrind though it will "
- "work in 99% of the cases. Once valgrind is fixed, this flag will "
- "most likely be removed.");
-
-namespace internal {
-GTEST_DEFINE_string_(
- internal_run_death_test, "",
- "Indicates the file, line number, temporal index of "
- "the single death test to run, and a file descriptor to "
- "which a success code may be sent, all separated by "
- "the '|' characters. This flag is specified if and only if the current "
- "process is a sub-process launched for running a thread-safe "
- "death test. FOR INTERNAL USE ONLY.");
-} // namespace internal
-
-#if GTEST_HAS_DEATH_TEST
-
-namespace internal {
-
-// Valid only for fast death tests. Indicates the code is running in the
-// child process of a fast style death test.
-static bool g_in_fast_death_test_child = false;
-
-// Returns a Boolean value indicating whether the caller is currently
-// executing in the context of the death test child process. Tools such as
-// Valgrind heap checkers may need this to modify their behavior in death
-// tests. IMPORTANT: This is an internal utility. Using it may break the
-// implementation of death tests. User code MUST NOT use it.
-bool InDeathTestChild() {
-# if GTEST_OS_WINDOWS
-
- // On Windows, death tests are thread-safe regardless of the value of the
- // death_test_style flag.
- return !GTEST_FLAG(internal_run_death_test).empty();
-
-# else
-
- if (GTEST_FLAG(death_test_style) == "threadsafe")
- return !GTEST_FLAG(internal_run_death_test).empty();
- else
- return g_in_fast_death_test_child;
-#endif
-}
-
-} // namespace internal
-
-// ExitedWithCode constructor.
-ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
-}
-
-// ExitedWithCode function-call operator.
-bool ExitedWithCode::operator()(int exit_status) const {
-# if GTEST_OS_WINDOWS
-
- return exit_status == exit_code_;
-
-# else
-
- return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
-
-# endif // GTEST_OS_WINDOWS
-}
-
-# if !GTEST_OS_WINDOWS
-// KilledBySignal constructor.
-KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
-}
-
-// KilledBySignal function-call operator.
-bool KilledBySignal::operator()(int exit_status) const {
- return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
-}
-# endif // !GTEST_OS_WINDOWS
-
-namespace internal {
-
-// Utilities needed for death tests.
-
-// Generates a textual description of a given exit code, in the format
-// specified by wait(2).
-static std::string ExitSummary(int exit_code) {
- Message m;
-
-# if GTEST_OS_WINDOWS
-
- m << "Exited with exit status " << exit_code;
-
-# else
-
- if (WIFEXITED(exit_code)) {
- m << "Exited with exit status " << WEXITSTATUS(exit_code);
- } else if (WIFSIGNALED(exit_code)) {
- m << "Terminated by signal " << WTERMSIG(exit_code);
- }
-# ifdef WCOREDUMP
- if (WCOREDUMP(exit_code)) {
- m << " (core dumped)";
- }
-# endif
-# endif // GTEST_OS_WINDOWS
-
- return m.GetString();
-}
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-bool ExitedUnsuccessfully(int exit_status) {
- return !ExitedWithCode(0)(exit_status);
-}
-
-# if !GTEST_OS_WINDOWS
-// Generates a textual failure message when a death test finds more than
-// one thread running, or cannot determine the number of threads, prior
-// to executing the given statement. It is the responsibility of the
-// caller not to pass a thread_count of 1.
-static std::string DeathTestThreadWarning(size_t thread_count) {
- Message msg;
- msg << "Death tests use fork(), which is unsafe particularly"
- << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
- if (thread_count == 0)
- msg << "couldn't detect the number of threads.";
- else
- msg << "detected " << thread_count << " threads.";
- return msg.GetString();
-}
-# endif // !GTEST_OS_WINDOWS
-
-// Flag characters for reporting a death test that did not die.
-static const char kDeathTestLived = 'L';
-static const char kDeathTestReturned = 'R';
-static const char kDeathTestThrew = 'T';
-static const char kDeathTestInternalError = 'I';
-
-// An enumeration describing all of the possible ways that a death test can
-// conclude. DIED means that the process died while executing the test
-// code; LIVED means that process lived beyond the end of the test code;
-// RETURNED means that the test statement attempted to execute a return
-// statement, which is not allowed; THREW means that the test statement
-// returned control by throwing an exception. IN_PROGRESS means the test
-// has not yet concluded.
-// TODO(vladl@google.com): Unify names and possibly values for
-// AbortReason, DeathTestOutcome, and flag characters above.
-enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
-
-// Routine for aborting the program which is safe to call from an
-// exec-style death test child process, in which case the error
-// message is propagated back to the parent process. Otherwise, the
-// message is simply printed to stderr. In either case, the program
-// then exits with status 1.
-void DeathTestAbort(const std::string& message) {
- // On a POSIX system, this function may be called from a threadsafe-style
- // death test child process, which operates on a very small stack. Use
- // the heap for any additional non-minuscule memory requirements.
- const InternalRunDeathTestFlag* const flag =
- GetUnitTestImpl()->internal_run_death_test_flag();
- if (flag != NULL) {
- FILE* parent = posix::FDOpen(flag->write_fd(), "w");
- fputc(kDeathTestInternalError, parent);
- fprintf(parent, "%s", message.c_str());
- fflush(parent);
- _exit(1);
- } else {
- fprintf(stderr, "%s", message.c_str());
- fflush(stderr);
- posix::Abort();
- }
-}
-
-// A replacement for CHECK that calls DeathTestAbort if the assertion
-// fails.
-# define GTEST_DEATH_TEST_CHECK_(expression) \
- do { \
- if (!::testing::internal::IsTrue(expression)) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression); \
- } \
- } while (::testing::internal::AlwaysFalse())
-
-// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for
-// evaluating any system call that fulfills two conditions: it must return
-// -1 on failure, and set errno to EINTR when it is interrupted and
-// should be tried again. The macro expands to a loop that repeatedly
-// evaluates the expression as long as it evaluates to -1 and sets
-// errno to EINTR. If the expression evaluates to -1 but errno is
-// something other than EINTR, DeathTestAbort is called.
-# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
- do { \
- int gtest_retval; \
- do { \
- gtest_retval = (expression); \
- } while (gtest_retval == -1 && errno == EINTR); \
- if (gtest_retval == -1) { \
- DeathTestAbort( \
- ::std::string("CHECK failed: File ") + __FILE__ + ", line " \
- + ::testing::internal::StreamableToString(__LINE__) + ": " \
- + #expression + " != -1"); \
- } \
- } while (::testing::internal::AlwaysFalse())
-
-// Returns the message describing the last system error in errno.
-std::string GetLastErrnoDescription() {
- return errno == 0 ? "" : posix::StrError(errno);
-}
-
-// This is called from a death test parent process to read a failure
-// message from the death test child process and log it with the FATAL
-// severity. On Windows, the message is read from a pipe handle. On other
-// platforms, it is read from a file descriptor.
-static void FailFromInternalError(int fd) {
- Message error;
- char buffer[256];
- int num_read;
-
- do {
- while ((num_read = posix::Read(fd, buffer, 255)) > 0) {
- buffer[num_read] = '\0';
- error << buffer;
- }
- } while (num_read == -1 && errno == EINTR);
-
- if (num_read == 0) {
- GTEST_LOG_(FATAL) << error.GetString();
- } else {
- const int last_error = errno;
- GTEST_LOG_(FATAL) << "Error while reading death test internal: "
- << GetLastErrnoDescription() << " [" << last_error << "]";
- }
-}
-
-// Death test constructor. Increments the running death test count
-// for the current test.
-DeathTest::DeathTest() {
- TestInfo* const info = GetUnitTestImpl()->current_test_info();
- if (info == NULL) {
- DeathTestAbort("Cannot run a death test outside of a TEST or "
- "TEST_F construct");
- }
-}
-
-// Creates and returns a death test by dispatching to the current
-// death test factory.
-bool DeathTest::Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test) {
- return GetUnitTestImpl()->death_test_factory()->Create(
- statement, regex, file, line, test);
-}
-
-const char* DeathTest::LastMessage() {
- return last_death_test_message_.c_str();
-}
-
-void DeathTest::set_last_death_test_message(const std::string& message) {
- last_death_test_message_ = message;
-}
-
-std::string DeathTest::last_death_test_message_;
-
-// Provides cross platform implementation for some death functionality.
-class DeathTestImpl : public DeathTest {
- protected:
- DeathTestImpl(const char* a_statement, const RE* a_regex)
- : statement_(a_statement),
- regex_(a_regex),
- spawned_(false),
- status_(-1),
- outcome_(IN_PROGRESS),
- read_fd_(-1),
- write_fd_(-1) {}
-
- // read_fd_ is expected to be closed and cleared by a derived class.
- ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
-
- void Abort(AbortReason reason);
- virtual bool Passed(bool status_ok);
-
- const char* statement() const { return statement_; }
- const RE* regex() const { return regex_; }
- bool spawned() const { return spawned_; }
- void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
- int status() const { return status_; }
- void set_status(int a_status) { status_ = a_status; }
- DeathTestOutcome outcome() const { return outcome_; }
- void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; }
- int read_fd() const { return read_fd_; }
- void set_read_fd(int fd) { read_fd_ = fd; }
- int write_fd() const { return write_fd_; }
- void set_write_fd(int fd) { write_fd_ = fd; }
-
- // Called in the parent process only. Reads the result code of the death
- // test child process via a pipe, interprets it to set the outcome_
- // member, and closes read_fd_. Outputs diagnostics and terminates in
- // case of unexpected codes.
- void ReadAndInterpretStatusByte();
-
- private:
- // The textual content of the code this object is testing. This class
- // doesn't own this string and should not attempt to delete it.
- const char* const statement_;
- // The regular expression which test output must match. DeathTestImpl
- // doesn't own this object and should not attempt to delete it.
- const RE* const regex_;
- // True if the death test child process has been successfully spawned.
- bool spawned_;
- // The exit status of the child process.
- int status_;
- // How the death test concluded.
- DeathTestOutcome outcome_;
- // Descriptor to the read end of the pipe to the child process. It is
- // always -1 in the child process. The child keeps its write end of the
- // pipe in write_fd_.
- int read_fd_;
- // Descriptor to the child's write end of the pipe to the parent process.
- // It is always -1 in the parent process. The parent keeps its end of the
- // pipe in read_fd_.
- int write_fd_;
-};
-
-// Called in the parent process only. Reads the result code of the death
-// test child process via a pipe, interprets it to set the outcome_
-// member, and closes read_fd_. Outputs diagnostics and terminates in
-// case of unexpected codes.
-void DeathTestImpl::ReadAndInterpretStatusByte() {
- char flag;
- int bytes_read;
-
- // The read() here blocks until data is available (signifying the
- // failure of the death test) or until the pipe is closed (signifying
- // its success), so it's okay to call this in the parent before
- // the child process has exited.
- do {
- bytes_read = posix::Read(read_fd(), &flag, 1);
- } while (bytes_read == -1 && errno == EINTR);
-
- if (bytes_read == 0) {
- set_outcome(DIED);
- } else if (bytes_read == 1) {
- switch (flag) {
- case kDeathTestReturned:
- set_outcome(RETURNED);
- break;
- case kDeathTestThrew:
- set_outcome(THREW);
- break;
- case kDeathTestLived:
- set_outcome(LIVED);
- break;
- case kDeathTestInternalError:
- FailFromInternalError(read_fd()); // Does not return.
- break;
- default:
- GTEST_LOG_(FATAL) << "Death test child process reported "
- << "unexpected status byte ("
- << static_cast<unsigned int>(flag) << ")";
- }
- } else {
- GTEST_LOG_(FATAL) << "Read from death test child process failed: "
- << GetLastErrnoDescription();
- }
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd()));
- set_read_fd(-1);
-}
-
-// Signals that the death test code which should have exited, didn't.
-// Should be called only in a death test child process.
-// Writes a status byte to the child's status file descriptor, then
-// calls _exit(1).
-void DeathTestImpl::Abort(AbortReason reason) {
- // The parent process considers the death test to be a failure if
- // it finds any data in our pipe. So, here we write a single flag byte
- // to the pipe, then exit.
- const char status_ch =
- reason == TEST_DID_NOT_DIE ? kDeathTestLived :
- reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned;
-
- GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1));
- // We are leaking the descriptor here because on some platforms (i.e.,
- // when built as Windows DLL), destructors of global objects will still
- // run after calling _exit(). On such systems, write_fd_ will be
- // indirectly closed from the destructor of UnitTestImpl, causing double
- // close if it is also closed here. On debug configurations, double close
- // may assert. As there are no in-process buffers to flush here, we are
- // relying on the OS to close the descriptor after the process terminates
- // when the destructors are not run.
- _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
-}
-
-// Returns an indented copy of stderr output for a death test.
-// This makes distinguishing death test output lines from regular log lines
-// much easier.
-static ::std::string FormatDeathTestOutput(const ::std::string& output) {
- ::std::string ret;
- for (size_t at = 0; ; ) {
- const size_t line_end = output.find('\n', at);
- ret += "[ DEATH ] ";
- if (line_end == ::std::string::npos) {
- ret += output.substr(at);
- break;
- }
- ret += output.substr(at, line_end + 1 - at);
- at = line_end + 1;
- }
- return ret;
-}
-
-// Assesses the success or failure of a death test, using both private
-// members which have previously been set, and one argument:
-//
-// Private data members:
-// outcome: An enumeration describing how the death test
-// concluded: DIED, LIVED, THREW, or RETURNED. The death test
-// fails in the latter three cases.
-// status: The exit status of the child process. On *nix, it is in the
-// in the format specified by wait(2). On Windows, this is the
-// value supplied to the ExitProcess() API or a numeric code
-// of the exception that terminated the program.
-// regex: A regular expression object to be applied to
-// the test's captured standard error output; the death test
-// fails if it does not match.
-//
-// Argument:
-// status_ok: true if exit_status is acceptable in the context of
-// this particular death test, which fails if it is false
-//
-// Returns true iff all of the above conditions are met. Otherwise, the
-// first failing condition, in the order given above, is the one that is
-// reported. Also sets the last death test message string.
-bool DeathTestImpl::Passed(bool status_ok) {
- if (!spawned())
- return false;
-
- const std::string error_message = GetCapturedStderr();
-
- bool success = false;
- Message buffer;
-
- buffer << "Death test: " << statement() << "\n";
- switch (outcome()) {
- case LIVED:
- buffer << " Result: failed to die.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case THREW:
- buffer << " Result: threw an exception.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case RETURNED:
- buffer << " Result: illegal return in test statement.\n"
- << " Error msg:\n" << FormatDeathTestOutput(error_message);
- break;
- case DIED:
- if (status_ok) {
- const bool matched = RE::PartialMatch(error_message.c_str(), *regex());
- if (matched) {
- success = true;
- } else {
- buffer << " Result: died but not with expected error.\n"
- << " Expected: " << regex()->pattern() << "\n"
- << "Actual msg:\n" << FormatDeathTestOutput(error_message);
- }
- } else {
- buffer << " Result: died but not with expected exit code:\n"
- << " " << ExitSummary(status()) << "\n"
- << "Actual msg:\n" << FormatDeathTestOutput(error_message);
- }
- break;
- case IN_PROGRESS:
- default:
- GTEST_LOG_(FATAL)
- << "DeathTest::Passed somehow called before conclusion of test";
- }
-
- DeathTest::set_last_death_test_message(buffer.GetString());
- return success;
-}
-
-# if GTEST_OS_WINDOWS
-// WindowsDeathTest implements death tests on Windows. Due to the
-// specifics of starting new processes on Windows, death tests there are
-// always threadsafe, and Google Test considers the
-// --gtest_death_test_style=fast setting to be equivalent to
-// --gtest_death_test_style=threadsafe there.
-//
-// A few implementation notes: Like the Linux version, the Windows
-// implementation uses pipes for child-to-parent communication. But due to
-// the specifics of pipes on Windows, some extra steps are required:
-//
-// 1. The parent creates a communication pipe and stores handles to both
-// ends of it.
-// 2. The parent starts the child and provides it with the information
-// necessary to acquire the handle to the write end of the pipe.
-// 3. The child acquires the write end of the pipe and signals the parent
-// using a Windows event.
-// 4. Now the parent can release the write end of the pipe on its side. If
-// this is done before step 3, the object's reference count goes down to
-// 0 and it is destroyed, preventing the child from acquiring it. The
-// parent now has to release it, or read operations on the read end of
-// the pipe will not return when the child terminates.
-// 5. The parent reads child's output through the pipe (outcome code and
-// any possible error messages) from the pipe, and its stderr and then
-// determines whether to fail the test.
-//
-// Note: to distinguish Win32 API calls from the local method and function
-// calls, the former are explicitly resolved in the global namespace.
-//
-class WindowsDeathTest : public DeathTestImpl {
- public:
- WindowsDeathTest(const char* a_statement,
- const RE* a_regex,
- const char* file,
- int line)
- : DeathTestImpl(a_statement, a_regex), file_(file), line_(line) {}
-
- // All of these virtual functions are inherited from DeathTest.
- virtual int Wait();
- virtual TestRole AssumeRole();
-
- private:
- // The name of the file in which the death test is located.
- const char* const file_;
- // The line number on which the death test is located.
- const int line_;
- // Handle to the write end of the pipe to the child process.
- AutoHandle write_handle_;
- // Child process handle.
- AutoHandle child_handle_;
- // Event the child process uses to signal the parent that it has
- // acquired the handle to the write end of the pipe. After seeing this
- // event the parent can release its own handles to make sure its
- // ReadFile() calls return when the child terminates.
- AutoHandle event_handle_;
-};
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists. As a side effect, sets the
-// outcome data member.
-int WindowsDeathTest::Wait() {
- if (!spawned())
- return 0;
-
- // Wait until the child either signals that it has acquired the write end
- // of the pipe or it dies.
- const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() };
- switch (::WaitForMultipleObjects(2,
- wait_handles,
- FALSE, // Waits for any of the handles.
- INFINITE)) {
- case WAIT_OBJECT_0:
- case WAIT_OBJECT_0 + 1:
- break;
- default:
- GTEST_DEATH_TEST_CHECK_(false); // Should not get here.
- }
-
- // The child has acquired the write end of the pipe or exited.
- // We release the handle on our side and continue.
- write_handle_.Reset();
- event_handle_.Reset();
-
- ReadAndInterpretStatusByte();
-
- // Waits for the child process to exit if it haven't already. This
- // returns immediately if the child has already exited, regardless of
- // whether previous calls to WaitForMultipleObjects synchronized on this
- // handle or not.
- GTEST_DEATH_TEST_CHECK_(
- WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(),
- INFINITE));
- DWORD status_code;
- GTEST_DEATH_TEST_CHECK_(
- ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE);
- child_handle_.Reset();
- set_status(static_cast<int>(status_code));
- return status();
-}
-
-// The AssumeRole process for a Windows death test. It creates a child
-// process with the same executable as the current process to run the
-// death test. The child process is given the --gtest_filter and
-// --gtest_internal_run_death_test flags such that it knows to run the
-// current death test only.
-DeathTest::TestRole WindowsDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
-
- if (flag != NULL) {
- // ParseInternalRunDeathTestFlag() has performed all the necessary
- // processing.
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
-
- // WindowsDeathTest uses an anonymous pipe to communicate results of
- // a death test.
- SECURITY_ATTRIBUTES handles_are_inheritable = {
- sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
- HANDLE read_handle, write_handle;
- GTEST_DEATH_TEST_CHECK_(
- ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable,
- 0) // Default buffer size.
- != FALSE);
- set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle),
- O_RDONLY));
- write_handle_.Reset(write_handle);
- event_handle_.Reset(::CreateEvent(
- &handles_are_inheritable,
- TRUE, // The event will automatically reset to non-signaled state.
- FALSE, // The initial state is non-signalled.
- NULL)); // The even is unnamed.
- GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != NULL);
- const std::string filter_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "=" +
- info->test_case_name() + "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag +
- "=" + file_ + "|" + StreamableToString(line_) + "|" +
- StreamableToString(death_test_index) + "|" +
- StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +
- // size_t has the same width as pointers on both 32-bit and 64-bit
- // Windows platforms.
- // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
- "|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) +
- "|" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));
-
- char executable_path[_MAX_PATH + 1]; // NOLINT
- GTEST_DEATH_TEST_CHECK_(
- _MAX_PATH + 1 != ::GetModuleFileNameA(NULL,
- executable_path,
- _MAX_PATH));
-
- std::string command_line =
- std::string(::GetCommandLineA()) + " " + filter_flag + " \"" +
- internal_flag + "\"";
-
- DeathTest::set_last_death_test_message("");
-
- CaptureStderr();
- // Flush the log buffers since the log streams are shared with the child.
- FlushInfoLog();
-
- // The child process will share the standard handles with the parent.
- STARTUPINFOA startup_info;
- memset(&startup_info, 0, sizeof(STARTUPINFO));
- startup_info.dwFlags = STARTF_USESTDHANDLES;
- startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE);
- startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
- startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
-
- PROCESS_INFORMATION process_info;
- GTEST_DEATH_TEST_CHECK_(::CreateProcessA(
- executable_path,
- const_cast<char*>(command_line.c_str()),
- NULL, // Retuned process handle is not inheritable.
- NULL, // Retuned thread handle is not inheritable.
- TRUE, // Child inherits all inheritable handles (for write_handle_).
- 0x0, // Default creation flags.
- NULL, // Inherit the parent's environment.
- UnitTest::GetInstance()->original_working_dir(),
- &startup_info,
- &process_info) != FALSE);
- child_handle_.Reset(process_info.hProcess);
- ::CloseHandle(process_info.hThread);
- set_spawned(true);
- return OVERSEE_TEST;
-}
-# else // We are not on Windows.
-
-// ForkingDeathTest provides implementations for most of the abstract
-// methods of the DeathTest interface. Only the AssumeRole method is
-// left undefined.
-class ForkingDeathTest : public DeathTestImpl {
- public:
- ForkingDeathTest(const char* statement, const RE* regex);
-
- // All of these virtual functions are inherited from DeathTest.
- virtual int Wait();
-
- protected:
- void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
-
- private:
- // PID of child process during death test; 0 in the child process itself.
- pid_t child_pid_;
-};
-
-// Constructs a ForkingDeathTest.
-ForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex)
- : DeathTestImpl(a_statement, a_regex),
- child_pid_(-1) {}
-
-// Waits for the child in a death test to exit, returning its exit
-// status, or 0 if no child process exists. As a side effect, sets the
-// outcome data member.
-int ForkingDeathTest::Wait() {
- if (!spawned())
- return 0;
-
- ReadAndInterpretStatusByte();
-
- int status_value;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0));
- set_status(status_value);
- return status_value;
-}
-
-// A concrete death test class that forks, then immediately runs the test
-// in the child process.
-class NoExecDeathTest : public ForkingDeathTest {
- public:
- NoExecDeathTest(const char* a_statement, const RE* a_regex) :
- ForkingDeathTest(a_statement, a_regex) { }
- virtual TestRole AssumeRole();
-};
-
-// The AssumeRole process for a fork-and-run death test. It implements a
-// straightforward fork, with a simple pipe to transmit the status byte.
-DeathTest::TestRole NoExecDeathTest::AssumeRole() {
- const size_t thread_count = GetThreadCount();
- if (thread_count != 1) {
- GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count);
- }
-
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
-
- DeathTest::set_last_death_test_message("");
- CaptureStderr();
- // When we fork the process below, the log file buffers are copied, but the
- // file descriptors are shared. We flush all log files here so that closing
- // the file descriptors in the child process doesn't throw off the
- // synchronization between descriptors and buffers in the parent process.
- // This is as close to the fork as possible to avoid a race condition in case
- // there are multiple threads running before the death test, and another
- // thread writes to the log file.
- FlushInfoLog();
-
- const pid_t child_pid = fork();
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- set_child_pid(child_pid);
- if (child_pid == 0) {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
- set_write_fd(pipe_fd[1]);
- // Redirects all logging to stderr in the child process to prevent
- // concurrent writes to the log files. We capture stderr in the parent
- // process and append the child process' output to a log.
- LogToStderr();
- // Event forwarding to the listeners of event listener API mush be shut
- // down in death test subprocesses.
- GetUnitTestImpl()->listeners()->SuppressEventForwarding();
- g_in_fast_death_test_child = true;
- return EXECUTE_TEST;
- } else {
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
- }
-}
-
-// A concrete death test class that forks and re-executes the main
-// program from the beginning, with command-line flags set that cause
-// only this specific death test to be run.
-class ExecDeathTest : public ForkingDeathTest {
- public:
- ExecDeathTest(const char* a_statement, const RE* a_regex,
- const char* file, int line) :
- ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
- virtual TestRole AssumeRole();
- private:
- static ::std::vector<testing::internal::string>
- GetArgvsForDeathTestChildProcess() {
- ::std::vector<testing::internal::string> args = GetInjectableArgvs();
- return args;
- }
- // The name of the file in which the death test is located.
- const char* const file_;
- // The line number on which the death test is located.
- const int line_;
-};
-
-// Utility class for accumulating command-line arguments.
-class Arguments {
- public:
- Arguments() {
- args_.push_back(NULL);
- }
-
- ~Arguments() {
- for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();
- ++i) {
- free(*i);
- }
- }
- void AddArgument(const char* argument) {
- args_.insert(args_.end() - 1, posix::StrDup(argument));
- }
-
- template <typename Str>
- void AddArguments(const ::std::vector<Str>& arguments) {
- for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
- i != arguments.end();
- ++i) {
- args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
- }
- }
- char* const* Argv() {
- return &args_[0];
- }
-
- private:
- std::vector<char*> args_;
-};
-
-// A struct that encompasses the arguments to the child process of a
-// threadsafe-style death test process.
-struct ExecDeathTestArgs {
- char* const* argv; // Command-line arguments for the child's call to exec
- int close_fd; // File descriptor to close; the read end of a pipe
-};
-
-# if GTEST_OS_MAC
-inline char** GetEnviron() {
- // When Google Test is built as a framework on MacOS X, the environ variable
- // is unavailable. Apple's documentation (man environ) recommends using
- // _NSGetEnviron() instead.
- return *_NSGetEnviron();
-}
-# else
-// Some POSIX platforms expect you to declare environ. extern "C" makes
-// it reside in the global namespace.
-extern "C" char** environ;
-inline char** GetEnviron() { return environ; }
-# endif // GTEST_OS_MAC
-
-# if !GTEST_OS_QNX
-// The main function for a threadsafe-style death test child process.
-// This function is called in a clone()-ed process and thus must avoid
-// any potentially unsafe operations like malloc or libc functions.
-static int ExecDeathTestChildMain(void* child_arg) {
- ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));
-
- // We need to execute the test program in the same environment where
- // it was originally invoked. Therefore we change to the original
- // working directory first.
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
- // We can safely call chdir() as it's a direct system call.
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
-
- // We can safely call execve() as it's a direct system call. We
- // cannot use execvp() as it's a libc function and thus potentially
- // unsafe. Since execve() doesn't search the PATH, the user must
- // invoke the test program via a valid path that contains at least
- // one path separator.
- execve(args->argv[0], args->argv, GetEnviron());
- DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
- original_dir + " failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
-}
-# endif // !GTEST_OS_QNX
-
-// Two utility routines that together determine the direction the stack
-// grows.
-// This could be accomplished more elegantly by a single recursive
-// function, but we want to guard against the unlikely possibility of
-// a smart compiler optimizing the recursion away.
-//
-// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
-// StackLowerThanAddress into StackGrowsDown, which then doesn't give
-// correct answer.
-void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
-void StackLowerThanAddress(const void* ptr, bool* result) {
- int dummy;
- *result = (&dummy < ptr);
-}
-
-bool StackGrowsDown() {
- int dummy;
- bool result;
- StackLowerThanAddress(&dummy, &result);
- return result;
-}
-
-// Spawns a child process with the same executable as the current process in
-// a thread-safe manner and instructs it to run the death test. The
-// implementation uses fork(2) + exec. On systems where clone(2) is
-// available, it is used instead, being slightly more thread-safe. On QNX,
-// fork supports only single-threaded environments, so this function uses
-// spawn(2) there instead. The function dies with an error message if
-// anything goes wrong.
-static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
- ExecDeathTestArgs args = { argv, close_fd };
- pid_t child_pid = -1;
-
-# if GTEST_OS_QNX
- // Obtains the current directory and sets it to be closed in the child
- // process.
- const int cwd_fd = open(".", O_RDONLY);
- GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));
- // We need to execute the test program in the same environment where
- // it was originally invoked. Therefore we change to the original
- // working directory first.
- const char* const original_dir =
- UnitTest::GetInstance()->original_working_dir();
- // We can safely call chdir() as it's a direct system call.
- if (chdir(original_dir) != 0) {
- DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " +
- GetLastErrnoDescription());
- return EXIT_FAILURE;
- }
-
- int fd_flags;
- // Set close_fd to be closed after spawn.
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));
- GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,
- fd_flags | FD_CLOEXEC));
- struct inheritance inherit = {0};
- // spawn is a system call.
- child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());
- // Restores the current working directory.
- GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
-
-# else // GTEST_OS_QNX
-# if GTEST_OS_LINUX
- // When a SIGPROF signal is received while fork() or clone() are executing,
- // the process may hang. To avoid this, we ignore SIGPROF here and re-enable
- // it after the call to fork()/clone() is complete.
- struct sigaction saved_sigprof_action;
- struct sigaction ignore_sigprof_action;
- memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));
- sigemptyset(&ignore_sigprof_action.sa_mask);
- ignore_sigprof_action.sa_handler = SIG_IGN;
- GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(
- SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));
-# endif // GTEST_OS_LINUX
-
-# if GTEST_HAS_CLONE
- const bool use_fork = GTEST_FLAG(death_test_use_fork);
-
- if (!use_fork) {
- static const bool stack_grows_down = StackGrowsDown();
- const size_t stack_size = getpagesize();
- // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
- void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
-
- // Maximum stack alignment in bytes: For a downward-growing stack, this
- // amount is subtracted from size of the stack space to get an address
- // that is within the stack space and is aligned on all systems we care
- // about. As far as I know there is no ABI with stack alignment greater
- // than 64. We assume stack and stack_size already have alignment of
- // kMaxStackAlignment.
- const size_t kMaxStackAlignment = 64;
- void* const stack_top =
- static_cast<char*>(stack) +
- (stack_grows_down ? stack_size - kMaxStackAlignment : 0);
- GTEST_DEATH_TEST_CHECK_(stack_size > kMaxStackAlignment &&
- reinterpret_cast<intptr_t>(stack_top) % kMaxStackAlignment == 0);
-
- child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args);
-
- GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
- }
-# else
- const bool use_fork = true;
-# endif // GTEST_HAS_CLONE
-
- if (use_fork && (child_pid = fork()) == 0) {
- ExecDeathTestChildMain(&args);
- _exit(0);
- }
-# endif // GTEST_OS_QNX
-# if GTEST_OS_LINUX
- GTEST_DEATH_TEST_CHECK_SYSCALL_(
- sigaction(SIGPROF, &saved_sigprof_action, NULL));
-# endif // GTEST_OS_LINUX
-
- GTEST_DEATH_TEST_CHECK_(child_pid != -1);
- return child_pid;
-}
-
-// The AssumeRole process for a fork-and-exec death test. It re-executes the
-// main program from the beginning, setting the --gtest_filter
-// and --gtest_internal_run_death_test flags to cause only the current
-// death test to be re-run.
-DeathTest::TestRole ExecDeathTest::AssumeRole() {
- const UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const TestInfo* const info = impl->current_test_info();
- const int death_test_index = info->result()->death_test_count();
-
- if (flag != NULL) {
- set_write_fd(flag->write_fd());
- return EXECUTE_TEST;
- }
-
- int pipe_fd[2];
- GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
- // Clear the close-on-exec flag on the write end of the pipe, lest
- // it be closed when the child process does an exec:
- GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
-
- const std::string filter_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kFilterFlag + "="
- + info->test_case_name() + "." + info->name();
- const std::string internal_flag =
- std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "="
- + file_ + "|" + StreamableToString(line_) + "|"
- + StreamableToString(death_test_index) + "|"
- + StreamableToString(pipe_fd[1]);
- Arguments args;
- args.AddArguments(GetArgvsForDeathTestChildProcess());
- args.AddArgument(filter_flag.c_str());
- args.AddArgument(internal_flag.c_str());
-
- DeathTest::set_last_death_test_message("");
-
- CaptureStderr();
- // See the comment in NoExecDeathTest::AssumeRole for why the next line
- // is necessary.
- FlushInfoLog();
-
- const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);
- GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
- set_child_pid(child_pid);
- set_read_fd(pipe_fd[0]);
- set_spawned(true);
- return OVERSEE_TEST;
-}
-
-# endif // !GTEST_OS_WINDOWS
-
-// Creates a concrete DeathTest-derived class that depends on the
-// --gtest_death_test_style flag, and sets the pointer pointed to
-// by the "test" argument to its address. If the test should be
-// skipped, sets that pointer to NULL. Returns true, unless the
-// flag is set to an invalid value.
-bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
- const char* file, int line,
- DeathTest** test) {
- UnitTestImpl* const impl = GetUnitTestImpl();
- const InternalRunDeathTestFlag* const flag =
- impl->internal_run_death_test_flag();
- const int death_test_index = impl->current_test_info()
- ->increment_death_test_count();
-
- if (flag != NULL) {
- if (death_test_index > flag->index()) {
- DeathTest::set_last_death_test_message(
- "Death test count (" + StreamableToString(death_test_index)
- + ") somehow exceeded expected maximum ("
- + StreamableToString(flag->index()) + ")");
- return false;
- }
-
- if (!(flag->file() == file && flag->line() == line &&
- flag->index() == death_test_index)) {
- *test = NULL;
- return true;
- }
- }
-
-# if GTEST_OS_WINDOWS
-
- if (GTEST_FLAG(death_test_style) == "threadsafe" ||
- GTEST_FLAG(death_test_style) == "fast") {
- *test = new WindowsDeathTest(statement, regex, file, line);
- }
-
-# else
-
- if (GTEST_FLAG(death_test_style) == "threadsafe") {
- *test = new ExecDeathTest(statement, regex, file, line);
- } else if (GTEST_FLAG(death_test_style) == "fast") {
- *test = new NoExecDeathTest(statement, regex);
- }
-
-# endif // GTEST_OS_WINDOWS
-
- else { // NOLINT - this is more readable than unbalanced brackets inside #if.
- DeathTest::set_last_death_test_message(
- "Unknown death test style \"" + GTEST_FLAG(death_test_style)
- + "\" encountered");
- return false;
- }
-
- return true;
-}
-
-// Splits a given string on a given delimiter, populating a given
-// vector with the fields. GTEST_HAS_DEATH_TEST implies that we have
-// ::std::string, so we can use it here.
-static void SplitString(const ::std::string& str, char delimiter,
- ::std::vector< ::std::string>* dest) {
- ::std::vector< ::std::string> parsed;
- ::std::string::size_type pos = 0;
- while (::testing::internal::AlwaysTrue()) {
- const ::std::string::size_type colon = str.find(delimiter, pos);
- if (colon == ::std::string::npos) {
- parsed.push_back(str.substr(pos));
- break;
- } else {
- parsed.push_back(str.substr(pos, colon - pos));
- pos = colon + 1;
- }
- }
- dest->swap(parsed);
-}
-
-# if GTEST_OS_WINDOWS
-// Recreates the pipe and event handles from the provided parameters,
-// signals the event, and returns a file descriptor wrapped around the pipe
-// handle. This function is called in the child process only.
-int GetStatusFileDescriptor(unsigned int parent_process_id,
- size_t write_handle_as_size_t,
- size_t event_handle_as_size_t) {
- AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
- FALSE, // Non-inheritable.
- parent_process_id));
- if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
- DeathTestAbort("Unable to open parent process " +
- StreamableToString(parent_process_id));
- }
-
- // TODO(vladl@google.com): Replace the following check with a
- // compile-time assertion when available.
- GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t));
-
- const HANDLE write_handle =
- reinterpret_cast<HANDLE>(write_handle_as_size_t);
- HANDLE dup_write_handle;
-
- // The newly initialized handle is accessible only in in the parent
- // process. To obtain one accessible within the child, we need to use
- // DuplicateHandle.
- if (!::DuplicateHandle(parent_process_handle.Get(), write_handle,
- ::GetCurrentProcess(), &dup_write_handle,
- 0x0, // Requested privileges ignored since
- // DUPLICATE_SAME_ACCESS is used.
- FALSE, // Request non-inheritable handler.
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
-
- const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t);
- HANDLE dup_event_handle;
-
- if (!::DuplicateHandle(parent_process_handle.Get(), event_handle,
- ::GetCurrentProcess(), &dup_event_handle,
- 0x0,
- FALSE,
- DUPLICATE_SAME_ACCESS)) {
- DeathTestAbort("Unable to duplicate the event handle " +
- StreamableToString(event_handle_as_size_t) +
- " from the parent process " +
- StreamableToString(parent_process_id));
- }
-
- const int write_fd =
- ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND);
- if (write_fd == -1) {
- DeathTestAbort("Unable to convert pipe handle " +
- StreamableToString(write_handle_as_size_t) +
- " to a file descriptor");
- }
-
- // Signals the parent that the write end of the pipe has been acquired
- // so the parent can release its own write end.
- ::SetEvent(dup_event_handle);
-
- return write_fd;
-}
-# endif // GTEST_OS_WINDOWS
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
- if (GTEST_FLAG(internal_run_death_test) == "") return NULL;
-
- // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we
- // can use it here.
- int line = -1;
- int index = -1;
- ::std::vector< ::std::string> fields;
- SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
- int write_fd = -1;
-
-# if GTEST_OS_WINDOWS
-
- unsigned int parent_process_id = 0;
- size_t write_handle_as_size_t = 0;
- size_t event_handle_as_size_t = 0;
-
- if (fields.size() != 6
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &parent_process_id)
- || !ParseNaturalNumber(fields[4], &write_handle_as_size_t)
- || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: " +
- GTEST_FLAG(internal_run_death_test));
- }
- write_fd = GetStatusFileDescriptor(parent_process_id,
- write_handle_as_size_t,
- event_handle_as_size_t);
-# else
-
- if (fields.size() != 4
- || !ParseNaturalNumber(fields[1], &line)
- || !ParseNaturalNumber(fields[2], &index)
- || !ParseNaturalNumber(fields[3], &write_fd)) {
- DeathTestAbort("Bad --gtest_internal_run_death_test flag: "
- + GTEST_FLAG(internal_run_death_test));
- }
-
-# endif // GTEST_OS_WINDOWS
-
- return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
-}
-
-} // namespace internal
-
-#endif // GTEST_HAS_DEATH_TEST
-
-} // namespace testing
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: keith.ray@gmail.com (Keith Ray)
-
-
-#include <stdlib.h>
-
-#if GTEST_OS_WINDOWS_MOBILE
-# include <windows.h>
-#elif GTEST_OS_WINDOWS
-# include <direct.h>
-# include <io.h>
-#elif GTEST_OS_SYMBIAN
-// Symbian OpenC has PATH_MAX in sys/syslimits.h
-# include <sys/syslimits.h>
-#else
-# include <limits.h>
-# include <climits> // Some Linux distributions define PATH_MAX here.
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-#if GTEST_OS_WINDOWS
-# define GTEST_PATH_MAX_ _MAX_PATH
-#elif defined(PATH_MAX)
-# define GTEST_PATH_MAX_ PATH_MAX
-#elif defined(_XOPEN_PATH_MAX)
-# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
-#else
-# define GTEST_PATH_MAX_ _POSIX_PATH_MAX
-#endif // GTEST_OS_WINDOWS
-
-
-namespace testing {
-namespace internal {
-
-#if GTEST_OS_WINDOWS
-// On Windows, '\\' is the standard path separator, but many tools and the
-// Windows API also accept '/' as an alternate path separator. Unless otherwise
-// noted, a file path can contain either kind of path separators, or a mixture
-// of them.
-const char kPathSeparator = '\\';
-const char kAlternatePathSeparator = '/';
-const char kPathSeparatorString[] = "\\";
-const char kAlternatePathSeparatorString[] = "/";
-# if GTEST_OS_WINDOWS_MOBILE
-// Windows CE doesn't have a current directory. You should not use
-// the current directory in tests on Windows CE, but this at least
-// provides a reasonable fallback.
-const char kCurrentDirectoryString[] = "\\";
-// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
-const DWORD kInvalidFileAttributes = 0xffffffff;
-# else
-const char kCurrentDirectoryString[] = ".\\";
-# endif // GTEST_OS_WINDOWS_MOBILE
-#else
-const char kPathSeparator = '/';
-const char kPathSeparatorString[] = "/";
-const char kCurrentDirectoryString[] = "./";
-#endif // GTEST_OS_WINDOWS
-
-// Returns whether the given character is a valid path separator.
-static bool IsPathSeparator(char c) {
-#if GTEST_HAS_ALT_PATH_SEP_
- return (c == kPathSeparator) || (c == kAlternatePathSeparator);
-#else
- return c == kPathSeparator;
-#endif
-}
-
-// Returns the current working directory, or "" if unsuccessful.
-FilePath FilePath::GetCurrentDir() {
-#if GTEST_OS_WINDOWS_MOBILE
- // Windows CE doesn't have a current directory, so we just return
- // something reasonable.
- return FilePath(kCurrentDirectoryString);
-#elif GTEST_OS_WINDOWS
- char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
- return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#else
- char cwd[GTEST_PATH_MAX_ + 1] = { '\0' };
- return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
-#endif // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns a copy of the FilePath with the case-insensitive extension removed.
-// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
-// FilePath("dir/file"). If a case-insensitive extension is not
-// found, returns a copy of the original FilePath.
-FilePath FilePath::RemoveExtension(const char* extension) const {
- const std::string dot_extension = std::string(".") + extension;
- if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {
- return FilePath(pathname_.substr(
- 0, pathname_.length() - dot_extension.length()));
- }
- return *this;
-}
-
-// Returns a pointer to the last occurence of a valid path separator in
-// the FilePath. On Windows, for example, both '/' and '\' are valid path
-// separators. Returns NULL if no path separator was found.
-const char* FilePath::FindLastPathSeparator() const {
- const char* const last_sep = strrchr(c_str(), kPathSeparator);
-#if GTEST_HAS_ALT_PATH_SEP_
- const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);
- // Comparing two pointers of which only one is NULL is undefined.
- if (last_alt_sep != NULL &&
- (last_sep == NULL || last_alt_sep > last_sep)) {
- return last_alt_sep;
- }
-#endif
- return last_sep;
-}
-
-// Returns a copy of the FilePath with the directory part removed.
-// Example: FilePath("path/to/file").RemoveDirectoryName() returns
-// FilePath("file"). If there is no directory part ("just_a_file"), it returns
-// the FilePath unmodified. If there is no file part ("just_a_dir/") it
-// returns an empty FilePath ("").
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveDirectoryName() const {
- const char* const last_sep = FindLastPathSeparator();
- return last_sep ? FilePath(last_sep + 1) : *this;
-}
-
-// RemoveFileName returns the directory path with the filename removed.
-// Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
-// If the FilePath is "a_file" or "/a_file", RemoveFileName returns
-// FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
-// not have a file, like "just/a/dir/", it returns the FilePath unmodified.
-// On Windows platform, '\' is the path separator, otherwise it is '/'.
-FilePath FilePath::RemoveFileName() const {
- const char* const last_sep = FindLastPathSeparator();
- std::string dir;
- if (last_sep) {
- dir = std::string(c_str(), last_sep + 1 - c_str());
- } else {
- dir = kCurrentDirectoryString;
- }
- return FilePath(dir);
-}
-
-// Helper functions for naming files in a directory for xml output.
-
-// Given directory = "dir", base_name = "test", number = 0,
-// extension = "xml", returns "dir/test.xml". If number is greater
-// than zero (e.g., 12), returns "dir/test_12.xml".
-// On Windows platform, uses \ as the separator rather than /.
-FilePath FilePath::MakeFileName(const FilePath& directory,
- const FilePath& base_name,
- int number,
- const char* extension) {
- std::string file;
- if (number == 0) {
- file = base_name.string() + "." + extension;
- } else {
- file = base_name.string() + "_" + StreamableToString(number)
- + "." + extension;
- }
- return ConcatPaths(directory, FilePath(file));
-}
-
-// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
-// On Windows, uses \ as the separator rather than /.
-FilePath FilePath::ConcatPaths(const FilePath& directory,
- const FilePath& relative_path) {
- if (directory.IsEmpty())
- return relative_path;
- const FilePath dir(directory.RemoveTrailingPathSeparator());
- return FilePath(dir.string() + kPathSeparator + relative_path.string());
-}
-
-// Returns true if pathname describes something findable in the file-system,
-// either a file, directory, or whatever.
-bool FilePath::FileOrDirectoryExists() const {
-#if GTEST_OS_WINDOWS_MOBILE
- LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
- const DWORD attributes = GetFileAttributes(unicode);
- delete [] unicode;
- return attributes != kInvalidFileAttributes;
-#else
- posix::StatStruct file_stat;
- return posix::Stat(pathname_.c_str(), &file_stat) == 0;
-#endif // GTEST_OS_WINDOWS_MOBILE
-}
-
-// Returns true if pathname describes a directory in the file-system
-// that exists.
-bool FilePath::DirectoryExists() const {
- bool result = false;
-#if GTEST_OS_WINDOWS
- // Don't strip off trailing separator if path is a root directory on
- // Windows (like "C:\\").
- const FilePath& path(IsRootDirectory() ? *this :
- RemoveTrailingPathSeparator());
-#else
- const FilePath& path(*this);
-#endif
-
-#if GTEST_OS_WINDOWS_MOBILE
- LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
- const DWORD attributes = GetFileAttributes(unicode);
- delete [] unicode;
- if ((attributes != kInvalidFileAttributes) &&
- (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
- result = true;
- }
-#else
- posix::StatStruct file_stat;
- result = posix::Stat(path.c_str(), &file_stat) == 0 &&
- posix::IsDir(file_stat);
-#endif // GTEST_OS_WINDOWS_MOBILE
-
- return result;
-}
-
-// Returns true if pathname describes a root directory. (Windows has one
-// root directory per disk drive.)
-bool FilePath::IsRootDirectory() const {
-#if GTEST_OS_WINDOWS
- // TODO(wan@google.com): on Windows a network share like
- // \\server\share can be a root directory, although it cannot be the
- // current directory. Handle this properly.
- return pathname_.length() == 3 && IsAbsolutePath();
-#else
- return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]);
-#endif
-}
-
-// Returns true if pathname describes an absolute path.
-bool FilePath::IsAbsolutePath() const {
- const char* const name = pathname_.c_str();
-#if GTEST_OS_WINDOWS
- return pathname_.length() >= 3 &&
- ((name[0] >= 'a' && name[0] <= 'z') ||
- (name[0] >= 'A' && name[0] <= 'Z')) &&
- name[1] == ':' &&
- IsPathSeparator(name[2]);
-#else
- return IsPathSeparator(name[0]);
-#endif
-}
-
-// Returns a pathname for a file that does not currently exist. The pathname
-// will be directory/base_name.extension or
-// directory/base_name_<number>.extension if directory/base_name.extension
-// already exists. The number will be incremented until a pathname is found
-// that does not already exist.
-// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
-// There could be a race condition if two or more processes are calling this
-// function at the same time -- they could both pick the same filename.
-FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
- const FilePath& base_name,
- const char* extension) {
- FilePath full_pathname;
- int number = 0;
- do {
- full_pathname.Set(MakeFileName(directory, base_name, number++, extension));
- } while (full_pathname.FileOrDirectoryExists());
- return full_pathname;
-}
-
-// Returns true if FilePath ends with a path separator, which indicates that
-// it is intended to represent a directory. Returns false otherwise.
-// This does NOT check that a directory (or file) actually exists.
-bool FilePath::IsDirectory() const {
- return !pathname_.empty() &&
- IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]);
-}
-
-// Create directories so that path exists. Returns true if successful or if
-// the directories already exist; returns false if unable to create directories
-// for any reason.
-bool FilePath::CreateDirectoriesRecursively() const {
- if (!this->IsDirectory()) {
- return false;
- }
-
- if (pathname_.length() == 0 || this->DirectoryExists()) {
- return true;
- }
-
- const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
- return parent.CreateDirectoriesRecursively() && this->CreateFolder();
-}
-
-// Create the directory so that path exists. Returns true if successful or
-// if the directory already exists; returns false if unable to create the
-// directory for any reason, including if the parent directory does not
-// exist. Not named "CreateDirectory" because that's a macro on Windows.
-bool FilePath::CreateFolder() const {
-#if GTEST_OS_WINDOWS_MOBILE
- FilePath removed_sep(this->RemoveTrailingPathSeparator());
- LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
- int result = CreateDirectory(unicode, NULL) ? 0 : -1;
- delete [] unicode;
-#elif GTEST_OS_WINDOWS
- int result = _mkdir(pathname_.c_str());
-#else
- int result = mkdir(pathname_.c_str(), 0777);
-#endif // GTEST_OS_WINDOWS_MOBILE
-
- if (result == -1) {
- return this->DirectoryExists(); // An error is OK if the directory exists.
- }
- return true; // No error.
-}
-
-// If input name has a trailing separator character, remove it and return the
-// name, otherwise return the name string unmodified.
-// On Windows platform, uses \ as the separator, other platforms use /.
-FilePath FilePath::RemoveTrailingPathSeparator() const {
- return IsDirectory()
- ? FilePath(pathname_.substr(0, pathname_.length() - 1))
- : *this;
-}
-
-// Removes any redundant separators that might be in the pathname.
-// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
-// redundancies that might be in a pathname involving "." or "..".
-// TODO(wan@google.com): handle Windows network shares (e.g. \\server\share).
-void FilePath::Normalize() {
- if (pathname_.c_str() == NULL) {
- pathname_ = "";
- return;
- }
- const char* src = pathname_.c_str();
- char* const dest = new char[pathname_.length() + 1];
- char* dest_ptr = dest;
- memset(dest_ptr, 0, pathname_.length() + 1);
-
- while (*src != '\0') {
- *dest_ptr = *src;
- if (!IsPathSeparator(*src)) {
- src++;
- } else {
-#if GTEST_HAS_ALT_PATH_SEP_
- if (*dest_ptr == kAlternatePathSeparator) {
- *dest_ptr = kPathSeparator;
- }
-#endif
- while (IsPathSeparator(*src))
- src++;
- }
- dest_ptr++;
- }
- *dest_ptr = '\0';
- pathname_ = dest;
- delete[] dest;
-}
-
-} // namespace internal
-} // namespace testing
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#if GTEST_OS_WINDOWS_MOBILE
-# include <windows.h> // For TerminateProcess()
-#elif GTEST_OS_WINDOWS
-# include <io.h>
-# include <sys/stat.h>
-#else
-# include <unistd.h>
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-#if GTEST_OS_MAC
-# include <mach/mach_init.h>
-# include <mach/task.h>
-# include <mach/vm_map.h>
-#endif // GTEST_OS_MAC
-
-#if GTEST_OS_QNX
-# include <devctl.h>
-# include <sys/procfs.h>
-#endif // GTEST_OS_QNX
-
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-namespace internal {
-
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
-const int kStdOutFileno = 1;
-const int kStdErrFileno = 2;
-#else
-const int kStdOutFileno = STDOUT_FILENO;
-const int kStdErrFileno = STDERR_FILENO;
-#endif // _MSC_VER
-
-#if GTEST_OS_MAC
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount() {
- const task_t task = mach_task_self();
- mach_msg_type_number_t thread_count;
- thread_act_array_t thread_list;
- const kern_return_t status = task_threads(task, &thread_list, &thread_count);
- if (status == KERN_SUCCESS) {
- // task_threads allocates resources in thread_list and we need to free them
- // to avoid leaks.
- vm_deallocate(task,
- reinterpret_cast<vm_address_t>(thread_list),
- sizeof(thread_t) * thread_count);
- return static_cast<size_t>(thread_count);
- } else {
- return 0;
- }
-}
-
-#elif GTEST_OS_QNX
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-size_t GetThreadCount() {
- const int fd = open("/proc/self/as", O_RDONLY);
- if (fd < 0) {
- return 0;
- }
- procfs_info process_info;
- const int status =
- devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);
- close(fd);
- if (status == EOK) {
- return static_cast<size_t>(process_info.num_threads);
- } else {
- return 0;
- }
-}
-
-#else
-
-size_t GetThreadCount() {
- // There's no portable way to detect the number of threads, so we just
- // return 0 to indicate that we cannot detect it.
- return 0;
-}
-
-#endif // GTEST_OS_MAC
-
-#if GTEST_USES_POSIX_RE
-
-// Implements RE. Currently only needed for death tests.
-
-RE::~RE() {
- if (is_valid_) {
- // regfree'ing an invalid regex might crash because the content
- // of the regex is undefined. Since the regex's are essentially
- // the same, one cannot be valid (or invalid) without the other
- // being so too.
- regfree(&partial_regex_);
- regfree(&full_regex_);
- }
- free(const_cast<char*>(pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
- if (!re.is_valid_) return false;
-
- regmatch_t match;
- return regexec(&re.full_regex_, str, 1, &match, 0) == 0;
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
- if (!re.is_valid_) return false;
-
- regmatch_t match;
- return regexec(&re.partial_regex_, str, 1, &match, 0) == 0;
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
- pattern_ = posix::StrDup(regex);
-
- // Reserves enough bytes to hold the regular expression used for a
- // full match.
- const size_t full_regex_len = strlen(regex) + 10;
- char* const full_pattern = new char[full_regex_len];
-
- snprintf(full_pattern, full_regex_len, "^(%s)$", regex);
- is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0;
- // We want to call regcomp(&partial_regex_, ...) even if the
- // previous expression returns false. Otherwise partial_regex_ may
- // not be properly initialized can may cause trouble when it's
- // freed.
- //
- // Some implementation of POSIX regex (e.g. on at least some
- // versions of Cygwin) doesn't accept the empty string as a valid
- // regex. We change it to an equivalent form "()" to be safe.
- if (is_valid_) {
- const char* const partial_regex = (*regex == '\0') ? "()" : regex;
- is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0;
- }
- EXPECT_TRUE(is_valid_)
- << "Regular expression \"" << regex
- << "\" is not a valid POSIX Extended regular expression.";
-
- delete[] full_pattern;
-}
-
-#elif GTEST_USES_SIMPLE_RE
-
-// Returns true iff ch appears anywhere in str (excluding the
-// terminating '\0' character).
-bool IsInSet(char ch, const char* str) {
- return ch != '\0' && strchr(str, ch) != NULL;
-}
-
-// Returns true iff ch belongs to the given classification. Unlike
-// similar functions in <ctype.h>, these aren't affected by the
-// current locale.
-bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }
-bool IsAsciiPunct(char ch) {
- return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~");
-}
-bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
-bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
-bool IsAsciiWordChar(char ch) {
- return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') ||
- ('0' <= ch && ch <= '9') || ch == '_';
-}
-
-// Returns true iff "\\c" is a supported escape sequence.
-bool IsValidEscape(char c) {
- return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW"));
-}
-
-// Returns true iff the given atom (specified by escaped and pattern)
-// matches ch. The result is undefined if the atom is invalid.
-bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
- if (escaped) { // "\\p" where p is pattern_char.
- switch (pattern_char) {
- case 'd': return IsAsciiDigit(ch);
- case 'D': return !IsAsciiDigit(ch);
- case 'f': return ch == '\f';
- case 'n': return ch == '\n';
- case 'r': return ch == '\r';
- case 's': return IsAsciiWhiteSpace(ch);
- case 'S': return !IsAsciiWhiteSpace(ch);
- case 't': return ch == '\t';
- case 'v': return ch == '\v';
- case 'w': return IsAsciiWordChar(ch);
- case 'W': return !IsAsciiWordChar(ch);
- }
- return IsAsciiPunct(pattern_char) && pattern_char == ch;
- }
-
- return (pattern_char == '.' && ch != '\n') || pattern_char == ch;
-}
-
-// Helper function used by ValidateRegex() to format error messages.
-std::string FormatRegexSyntaxError(const char* regex, int index) {
- return (Message() << "Syntax error at index " << index
- << " in simple regular expression \"" << regex << "\": ").GetString();
-}
-
-// Generates non-fatal failures and returns false if regex is invalid;
-// otherwise returns true.
-bool ValidateRegex(const char* regex) {
- if (regex == NULL) {
- // TODO(wan@google.com): fix the source file location in the
- // assertion failures to match where the regex is used in user
- // code.
- ADD_FAILURE() << "NULL is not a valid simple regular expression.";
- return false;
- }
-
- bool is_valid = true;
-
- // True iff ?, *, or + can follow the previous atom.
- bool prev_repeatable = false;
- for (int i = 0; regex[i]; i++) {
- if (regex[i] == '\\') { // An escape sequence
- i++;
- if (regex[i] == '\0') {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
- << "'\\' cannot appear at the end.";
- return false;
- }
-
- if (!IsValidEscape(regex[i])) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1)
- << "invalid escape sequence \"\\" << regex[i] << "\".";
- is_valid = false;
- }
- prev_repeatable = true;
- } else { // Not an escape sequence.
- const char ch = regex[i];
-
- if (ch == '^' && i > 0) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'^' can only appear at the beginning.";
- is_valid = false;
- } else if (ch == '$' && regex[i + 1] != '\0') {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'$' can only appear at the end.";
- is_valid = false;
- } else if (IsInSet(ch, "()[]{}|")) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'" << ch << "' is unsupported.";
- is_valid = false;
- } else if (IsRepeat(ch) && !prev_repeatable) {
- ADD_FAILURE() << FormatRegexSyntaxError(regex, i)
- << "'" << ch << "' can only follow a repeatable token.";
- is_valid = false;
- }
-
- prev_repeatable = !IsInSet(ch, "^$?*+");
- }
- }
-
- return is_valid;
-}
-
-// Matches a repeated regex atom followed by a valid simple regular
-// expression. The regex atom is defined as c if escaped is false,
-// or \c otherwise. repeat is the repetition meta character (?, *,
-// or +). The behavior is undefined if str contains too many
-// characters to be indexable by size_t, in which case the test will
-// probably time out anyway. We are fine with this limitation as
-// std::string has it too.
-bool MatchRepetitionAndRegexAtHead(
- bool escaped, char c, char repeat, const char* regex,
- const char* str) {
- const size_t min_count = (repeat == '+') ? 1 : 0;
- const size_t max_count = (repeat == '?') ? 1 :
- static_cast<size_t>(-1) - 1;
- // We cannot call numeric_limits::max() as it conflicts with the
- // max() macro on Windows.
-
- for (size_t i = 0; i <= max_count; ++i) {
- // We know that the atom matches each of the first i characters in str.
- if (i >= min_count && MatchRegexAtHead(regex, str + i)) {
- // We have enough matches at the head, and the tail matches too.
- // Since we only care about *whether* the pattern matches str
- // (as opposed to *how* it matches), there is no need to find a
- // greedy match.
- return true;
- }
- if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i]))
- return false;
- }
- return false;
-}
-
-// Returns true iff regex matches a prefix of str. regex must be a
-// valid simple regular expression and not start with "^", or the
-// result is undefined.
-bool MatchRegexAtHead(const char* regex, const char* str) {
- if (*regex == '\0') // An empty regex matches a prefix of anything.
- return true;
-
- // "$" only matches the end of a string. Note that regex being
- // valid guarantees that there's nothing after "$" in it.
- if (*regex == '$')
- return *str == '\0';
-
- // Is the first thing in regex an escape sequence?
- const bool escaped = *regex == '\\';
- if (escaped)
- ++regex;
- if (IsRepeat(regex[1])) {
- // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so
- // here's an indirect recursion. It terminates as the regex gets
- // shorter in each recursion.
- return MatchRepetitionAndRegexAtHead(
- escaped, regex[0], regex[1], regex + 2, str);
- } else {
- // regex isn't empty, isn't "$", and doesn't start with a
- // repetition. We match the first atom of regex with the first
- // character of str and recurse.
- return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) &&
- MatchRegexAtHead(regex + 1, str + 1);
- }
-}
-
-// Returns true iff regex matches any substring of str. regex must be
-// a valid simple regular expression, or the result is undefined.
-//
-// The algorithm is recursive, but the recursion depth doesn't exceed
-// the regex length, so we won't need to worry about running out of
-// stack space normally. In rare cases the time complexity can be
-// exponential with respect to the regex length + the string length,
-// but usually it's must faster (often close to linear).
-bool MatchRegexAnywhere(const char* regex, const char* str) {
- if (regex == NULL || str == NULL)
- return false;
-
- if (*regex == '^')
- return MatchRegexAtHead(regex + 1, str);
-
- // A successful match can be anywhere in str.
- do {
- if (MatchRegexAtHead(regex, str))
- return true;
- } while (*str++ != '\0');
- return false;
-}
-
-// Implements the RE class.
-
-RE::~RE() {
- free(const_cast<char*>(pattern_));
- free(const_cast<char*>(full_pattern_));
-}
-
-// Returns true iff regular expression re matches the entire str.
-bool RE::FullMatch(const char* str, const RE& re) {
- return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str);
-}
-
-// Returns true iff regular expression re matches a substring of str
-// (including str itself).
-bool RE::PartialMatch(const char* str, const RE& re) {
- return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str);
-}
-
-// Initializes an RE from its string representation.
-void RE::Init(const char* regex) {
- pattern_ = full_pattern_ = NULL;
- if (regex != NULL) {
- pattern_ = posix::StrDup(regex);
- }
-
- is_valid_ = ValidateRegex(regex);
- if (!is_valid_) {
- // No need to calculate the full pattern when the regex is invalid.
- return;
- }
-
- const size_t len = strlen(regex);
- // Reserves enough bytes to hold the regular expression used for a
- // full match: we need space to prepend a '^', append a '$', and
- // terminate the string with '\0'.
- char* buffer = static_cast<char*>(malloc(len + 3));
- full_pattern_ = buffer;
-
- if (*regex != '^')
- *buffer++ = '^'; // Makes sure full_pattern_ starts with '^'.
-
- // We don't use snprintf or strncpy, as they trigger a warning when
- // compiled with VC++ 8.0.
- memcpy(buffer, regex, len);
- buffer += len;
-
- if (len == 0 || regex[len - 1] != '$')
- *buffer++ = '$'; // Makes sure full_pattern_ ends with '$'.
-
- *buffer = '\0';
-}
-
-#endif // GTEST_USES_POSIX_RE
-
-const char kUnknownFile[] = "unknown file";
-
-// Formats a source file path and a line number as they would appear
-// in an error message from the compiler used to compile this code.
-GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
-
- if (line < 0) {
- return file_name + ":";
- }
-#ifdef _MSC_VER
- return file_name + "(" + StreamableToString(line) + "):";
-#else
- return file_name + ":" + StreamableToString(line) + ":";
-#endif // _MSC_VER
-}
-
-// Formats a file location for compiler-independent XML output.
-// Although this function is not platform dependent, we put it next to
-// FormatFileLocation in order to contrast the two functions.
-// Note that FormatCompilerIndependentFileLocation() does NOT append colon
-// to the file location it produces, unlike FormatFileLocation().
-GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
- const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
-
- if (line < 0)
- return file_name;
- else
- return file_name + ":" + StreamableToString(line);
-}
-
-
-GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line)
- : severity_(severity) {
- const char* const marker =
- severity == GTEST_INFO ? "[ INFO ]" :
- severity == GTEST_WARNING ? "[WARNING]" :
- severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]";
- GetStream() << ::std::endl << marker << " "
- << FormatFileLocation(file, line).c_str() << ": ";
-}
-
-// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
-GTestLog::~GTestLog() {
- GetStream() << ::std::endl;
- if (severity_ == GTEST_FATAL) {
- fflush(stderr);
- posix::Abort();
- }
-}
-// Disable Microsoft deprecation warnings for POSIX functions called from
-// this class (creat, dup, dup2, and close)
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable: 4996)
-#endif // _MSC_VER
-
-#if GTEST_HAS_STREAM_REDIRECTION
-
-// Object that captures an output stream (stdout/stderr).
-class CapturedStream {
- public:
- // The ctor redirects the stream to a temporary file.
- explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
-# if GTEST_OS_WINDOWS
- char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
- char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
-
- ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
- const UINT success = ::GetTempFileNameA(temp_dir_path,
- "gtest_redir",
- 0, // Generate unique file name.
- temp_file_path);
- GTEST_CHECK_(success != 0)
- << "Unable to create a temporary file in " << temp_dir_path;
- const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
- GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
- << temp_file_path;
- filename_ = temp_file_path;
-# else
- // There's no guarantee that a test has write access to the current
- // directory, so we create the temporary file in the /tmp directory
- // instead. We use /tmp on most systems, and /sdcard on Android.
- // That's because Android doesn't have /tmp.
-# if GTEST_OS_LINUX_ANDROID
- // Note: Android applications are expected to call the framework's
- // Context.getExternalStorageDirectory() method through JNI to get
- // the location of the world-writable SD Card directory. However,
- // this requires a Context handle, which cannot be retrieved
- // globally from native code. Doing so also precludes running the
- // code as part of a regular standalone executable, which doesn't
- // run in a Dalvik process (e.g. when running it through 'adb shell').
- //
- // The location /sdcard is directly accessible from native code
- // and is the only location (unofficially) supported by the Android
- // team. It's generally a symlink to the real SD Card mount point
- // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or
- // other OEM-customized locations. Never rely on these, and always
- // use /sdcard.
- char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX";
-# else
- char name_template[] = "/tmp/captured_stream.XXXXXX";
-# endif // GTEST_OS_LINUX_ANDROID
- const int captured_fd = mkstemp(name_template);
- filename_ = name_template;
-# endif // GTEST_OS_WINDOWS
- fflush(NULL);
- dup2(captured_fd, fd_);
- close(captured_fd);
- }
-
- ~CapturedStream() {
- remove(filename_.c_str());
- }
-
- std::string GetCapturedString() {
- if (uncaptured_fd_ != -1) {
- // Restores the original stream.
- fflush(NULL);
- dup2(uncaptured_fd_, fd_);
- close(uncaptured_fd_);
- uncaptured_fd_ = -1;
- }
-
- FILE* const file = posix::FOpen(filename_.c_str(), "r");
- const std::string content = ReadEntireFile(file);
- posix::FClose(file);
- return content;
- }
-
- private:
- // Reads the entire content of a file as an std::string.
- static std::string ReadEntireFile(FILE* file);
-
- // Returns the size (in bytes) of a file.
- static size_t GetFileSize(FILE* file);
-
- const int fd_; // A stream to capture.
- int uncaptured_fd_;
- // Name of the temporary file holding the stderr output.
- ::std::string filename_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
-};
-
-// Returns the size (in bytes) of a file.
-size_t CapturedStream::GetFileSize(FILE* file) {
- fseek(file, 0, SEEK_END);
- return static_cast<size_t>(ftell(file));
-}
-
-// Reads the entire content of a file as a string.
-std::string CapturedStream::ReadEntireFile(FILE* file) {
- const size_t file_size = GetFileSize(file);
- char* const buffer = new char[file_size];
-
- size_t bytes_last_read = 0; // # of bytes read in the last fread()
- size_t bytes_read = 0; // # of bytes read so far
-
- fseek(file, 0, SEEK_SET);
-
- // Keeps reading the file until we cannot read further or the
- // pre-determined file size is reached.
- do {
- bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
- bytes_read += bytes_last_read;
- } while (bytes_last_read > 0 && bytes_read < file_size);
-
- const std::string content(buffer, bytes_read);
- delete[] buffer;
-
- return content;
-}
-
-# ifdef _MSC_VER
-# pragma warning(pop)
-# endif // _MSC_VER
-
-static CapturedStream* g_captured_stderr = NULL;
-static CapturedStream* g_captured_stdout = NULL;
-
-// Starts capturing an output stream (stdout/stderr).
-void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
- if (*stream != NULL) {
- GTEST_LOG_(FATAL) << "Only one " << stream_name
- << " capturer can exist at a time.";
- }
- *stream = new CapturedStream(fd);
-}
-
-// Stops capturing the output stream and returns the captured string.
-std::string GetCapturedStream(CapturedStream** captured_stream) {
- const std::string content = (*captured_stream)->GetCapturedString();
-
- delete *captured_stream;
- *captured_stream = NULL;
-
- return content;
-}
-
-// Starts capturing stdout.
-void CaptureStdout() {
- CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
-}
-
-// Starts capturing stderr.
-void CaptureStderr() {
- CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr);
-}
-
-// Stops capturing stdout and returns the captured string.
-std::string GetCapturedStdout() {
- return GetCapturedStream(&g_captured_stdout);
-}
-
-// Stops capturing stderr and returns the captured string.
-std::string GetCapturedStderr() {
- return GetCapturedStream(&g_captured_stderr);
-}
-
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-#if GTEST_HAS_DEATH_TEST
-
-// A copy of all command line arguments. Set by InitGoogleTest().
-::std::vector<testing::internal::string> g_argvs;
-
-static const ::std::vector<testing::internal::string>* g_injected_test_argvs =
- NULL; // Owned.
-
-void SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {
- if (g_injected_test_argvs != argvs)
- delete g_injected_test_argvs;
- g_injected_test_argvs = argvs;
-}
-
-const ::std::vector<testing::internal::string>& GetInjectableArgvs() {
- if (g_injected_test_argvs != NULL) {
- return *g_injected_test_argvs;
- }
- return g_argvs;
-}
-#endif // GTEST_HAS_DEATH_TEST
-
-#if GTEST_OS_WINDOWS_MOBILE
-namespace posix {
-void Abort() {
- DebugBreak();
- TerminateProcess(GetCurrentProcess(), 1);
-}
-} // namespace posix
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-// Returns the name of the environment variable corresponding to the
-// given flag. For example, FlagToEnvVar("foo") will return
-// "GTEST_FOO" in the open-source version.
-static std::string FlagToEnvVar(const char* flag) {
- const std::string full_flag =
- (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
-
- Message env_var;
- for (size_t i = 0; i != full_flag.length(); i++) {
- env_var << ToUpper(full_flag.c_str()[i]);
- }
-
- return env_var.GetString();
-}
-
-// Parses 'str' for a 32-bit signed integer. If successful, writes
-// the result to *value and returns true; otherwise leaves *value
-// unchanged and returns false.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
- // Parses the environment variable as a decimal integer.
- char* end = NULL;
- const long long_value = strtol(str, &end, 10); // NOLINT
-
- // Has strtol() consumed all characters in the string?
- if (*end != '\0') {
- // No - an invalid character was encountered.
- Message msg;
- msg << "WARNING: " << src_text
- << " is expected to be a 32-bit integer, but actually"
- << " has value \"" << str << "\".\n";
- printf("%s", msg.GetString().c_str());
- fflush(stdout);
- return false;
- }
-
- // Is the parsed value in the range of an Int32?
- const Int32 result = static_cast<Int32>(long_value);
- if (long_value == LONG_MAX || long_value == LONG_MIN ||
- // The parsed value overflows as a long. (strtol() returns
- // LONG_MAX or LONG_MIN when the input overflows.)
- result != long_value
- // The parsed value overflows as an Int32.
- ) {
- Message msg;
- msg << "WARNING: " << src_text
- << " is expected to be a 32-bit integer, but actually"
- << " has value " << str << ", which overflows.\n";
- printf("%s", msg.GetString().c_str());
- fflush(stdout);
- return false;
- }
-
- *value = result;
- return true;
-}
-
-// Reads and returns the Boolean environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-//
-// The value is considered true iff it's not "0".
-bool BoolFromGTestEnv(const char* flag, bool default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const string_value = posix::GetEnv(env_var.c_str());
- return string_value == NULL ?
- default_value : strcmp(string_value, "0") != 0;
-}
-
-// Reads and returns a 32-bit integer stored in the environment
-// variable corresponding to the given flag; if it isn't set or
-// doesn't represent a valid 32-bit integer, returns default_value.
-Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const string_value = posix::GetEnv(env_var.c_str());
- if (string_value == NULL) {
- // The environment variable is not set.
- return default_value;
- }
-
- Int32 result = default_value;
- if (!ParseInt32(Message() << "Environment variable " << env_var,
- string_value, &result)) {
- printf("The default value %s is used.\n",
- (Message() << default_value).GetString().c_str());
- fflush(stdout);
- return default_value;
- }
-
- return result;
-}
-
-// Reads and returns the string environment variable corresponding to
-// the given flag; if it's not set, returns default_value.
-const char* StringFromGTestEnv(const char* flag, const char* default_value) {
- const std::string env_var = FlagToEnvVar(flag);
- const char* const value = posix::GetEnv(env_var.c_str());
- return value == NULL ? default_value : value;
-}
-
-} // namespace internal
-} // namespace testing
-// Copyright 2007, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-// Google Test - The Google C++ Testing Framework
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// It uses the << operator when possible, and prints the bytes in the
-// object otherwise. A user can override its behavior for a class
-// type Foo by defining either operator<<(::std::ostream&, const Foo&)
-// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that
-// defines Foo.
-
-#include <ctype.h>
-#include <stdio.h>
-#include <ostream> // NOLINT
-#include <string>
-
-namespace testing {
-
-namespace {
-
-using ::std::ostream;
-
-// Prints a segment of bytes in the given object.
-void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
- size_t count, ostream* os) {
- char text[5] = "";
- for (size_t i = 0; i != count; i++) {
- const size_t j = start + i;
- if (i != 0) {
- // Organizes the bytes into groups of 2 for easy parsing by
- // human.
- if ((j % 2) == 0)
- *os << ' ';
- else
- *os << '-';
- }
- GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
- *os << text;
- }
-}
-
-// Prints the bytes in the given value to the given ostream.
-void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,
- ostream* os) {
- // Tells the user how big the object is.
- *os << count << "-byte object <";
-
- const size_t kThreshold = 132;
- const size_t kChunkSize = 64;
- // If the object size is bigger than kThreshold, we'll have to omit
- // some details by printing only the first and the last kChunkSize
- // bytes.
- // TODO(wan): let the user control the threshold using a flag.
- if (count < kThreshold) {
- PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);
- } else {
- PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
- *os << " ... ";
- // Rounds up to 2-byte boundary.
- const size_t resume_pos = (count - kChunkSize + 1)/2*2;
- PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
- }
- *os << ">";
-}
-
-} // namespace
-
-namespace internal2 {
-
-// Delegates to PrintBytesInObjectToImpl() to print the bytes in the
-// given object. The delegation simplifies the implementation, which
-// uses the << operator and thus is easier done outside of the
-// ::testing::internal namespace, which contains a << operator that
-// sometimes conflicts with the one in STL.
-void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,
- ostream* os) {
- PrintBytesInObjectToImpl(obj_bytes, count, os);
-}
-
-} // namespace internal2
-
-namespace internal {
-
-// Depending on the value of a char (or wchar_t), we print it in one
-// of three formats:
-// - as is if it's a printable ASCII (e.g. 'a', '2', ' '),
-// - as a hexidecimal escape sequence (e.g. '\x7F'), or
-// - as a special escape sequence (e.g. '\r', '\n').
-enum CharFormat {
- kAsIs,
- kHexEscape,
- kSpecialEscape
-};
-
-// Returns true if c is a printable ASCII character. We test the
-// value of c directly instead of calling isprint(), which is buggy on
-// Windows Mobile.
-inline bool IsPrintableAscii(wchar_t c) {
- return 0x20 <= c && c <= 0x7E;
-}
-
-// Prints a wide or narrow char c as a character literal without the
-// quotes, escaping it when necessary; returns how c was formatted.
-// The template argument UnsignedChar is the unsigned version of Char,
-// which is the type of c.
-template <typename UnsignedChar, typename Char>
-static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
- switch (static_cast<wchar_t>(c)) {
- case L'\0':
- *os << "\\0";
- break;
- case L'\'':
- *os << "\\'";
- break;
- case L'\\':
- *os << "\\\\";
- break;
- case L'\a':
- *os << "\\a";
- break;
- case L'\b':
- *os << "\\b";
- break;
- case L'\f':
- *os << "\\f";
- break;
- case L'\n':
- *os << "\\n";
- break;
- case L'\r':
- *os << "\\r";
- break;
- case L'\t':
- *os << "\\t";
- break;
- case L'\v':
- *os << "\\v";
- break;
- default:
- if (IsPrintableAscii(c)) {
- *os << static_cast<char>(c);
- return kAsIs;
- } else {
- *os << "\\x" + String::FormatHexInt(static_cast<UnsignedChar>(c));
- return kHexEscape;
- }
- }
- return kSpecialEscape;
-}
-
-// Prints a wchar_t c as if it's part of a string literal, escaping it when
-// necessary; returns how c was formatted.
-static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
- switch (c) {
- case L'\'':
- *os << "'";
- return kAsIs;
- case L'"':
- *os << "\\\"";
- return kSpecialEscape;
- default:
- return PrintAsCharLiteralTo<wchar_t>(c, os);
- }
-}
-
-// Prints a char c as if it's part of a string literal, escaping it when
-// necessary; returns how c was formatted.
-static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
- return PrintAsStringLiteralTo(
- static_cast<wchar_t>(static_cast<unsigned char>(c)), os);
-}
-
-// Prints a wide or narrow character c and its code. '\0' is printed
-// as "'\\0'", other unprintable characters are also properly escaped
-// using the standard C++ escape sequence. The template argument
-// UnsignedChar is the unsigned version of Char, which is the type of c.
-template <typename UnsignedChar, typename Char>
-void PrintCharAndCodeTo(Char c, ostream* os) {
- // First, print c as a literal in the most readable form we can find.
- *os << ((sizeof(c) > 1) ? "L'" : "'");
- const CharFormat format = PrintAsCharLiteralTo<UnsignedChar>(c, os);
- *os << "'";
-
- // To aid user debugging, we also print c's code in decimal, unless
- // it's 0 (in which case c was printed as '\\0', making the code
- // obvious).
- if (c == 0)
- return;
- *os << " (" << static_cast<int>(c);
-
- // For more convenience, we print c's code again in hexidecimal,
- // unless c was already printed in the form '\x##' or the code is in
- // [1, 9].
- if (format == kHexEscape || (1 <= c && c <= 9)) {
- // Do nothing.
- } else {
- *os << ", 0x" << String::FormatHexInt(static_cast<UnsignedChar>(c));
- }
- *os << ")";
-}
-
-void PrintTo(unsigned char c, ::std::ostream* os) {
- PrintCharAndCodeTo<unsigned char>(c, os);
-}
-void PrintTo(signed char c, ::std::ostream* os) {
- PrintCharAndCodeTo<unsigned char>(c, os);
-}
-
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its code. L'\0' is printed as "L'\\0'".
-void PrintTo(wchar_t wc, ostream* os) {
- PrintCharAndCodeTo<wchar_t>(wc, os);
-}
-
-// Prints the given array of characters to the ostream. CharType must be either
-// char or wchar_t.
-// The array starts at begin, the length is len, it may include '\0' characters
-// and may not be NUL-terminated.
-template <typename CharType>
-static void PrintCharsAsStringTo(
- const CharType* begin, size_t len, ostream* os) {
- const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\"";
- *os << kQuoteBegin;
- bool is_previous_hex = false;
- for (size_t index = 0; index < len; ++index) {
- const CharType cur = begin[index];
- if (is_previous_hex && IsXDigit(cur)) {
- // Previous character is of '\x..' form and this character can be
- // interpreted as another hexadecimal digit in its number. Break string to
- // disambiguate.
- *os << "\" " << kQuoteBegin;
- }
- is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
- }
- *os << "\"";
-}
-
-// Prints a (const) char/wchar_t array of 'len' elements, starting at address
-// 'begin'. CharType must be either char or wchar_t.
-template <typename CharType>
-static void UniversalPrintCharArray(
- const CharType* begin, size_t len, ostream* os) {
- // The code
- // const char kFoo[] = "foo";
- // generates an array of 4, not 3, elements, with the last one being '\0'.
- //
- // Therefore when printing a char array, we don't print the last element if
- // it's '\0', such that the output matches the string literal as it's
- // written in the source code.
- if (len > 0 && begin[len - 1] == '\0') {
- PrintCharsAsStringTo(begin, len - 1, os);
- return;
- }
-
- // If, however, the last element in the array is not '\0', e.g.
- // const char kFoo[] = { 'f', 'o', 'o' };
- // we must print the entire array. We also print a message to indicate
- // that the array is not NUL-terminated.
- PrintCharsAsStringTo(begin, len, os);
- *os << " (no terminating NUL)";
-}
-
-// Prints a (const) char array of 'len' elements, starting at address 'begin'.
-void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
- UniversalPrintCharArray(begin, len, os);
-}
-
-// Prints a (const) wchar_t array of 'len' elements, starting at address
-// 'begin'.
-void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {
- UniversalPrintCharArray(begin, len, os);
-}
-
-// Prints the given C string to the ostream.
-void PrintTo(const char* s, ostream* os) {
- if (s == NULL) {
- *os << "NULL";
- } else {
- *os << ImplicitCast_<const void*>(s) << " pointing to ";
- PrintCharsAsStringTo(s, strlen(s), os);
- }
-}
-
-// MSVC compiler can be configured to define whar_t as a typedef
-// of unsigned short. Defining an overload for const wchar_t* in that case
-// would cause pointers to unsigned shorts be printed as wide strings,
-// possibly accessing more memory than intended and causing invalid
-// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when
-// wchar_t is implemented as a native type.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Prints the given wide C string to the ostream.
-void PrintTo(const wchar_t* s, ostream* os) {
- if (s == NULL) {
- *os << "NULL";
- } else {
- *os << ImplicitCast_<const void*>(s) << " pointing to ";
- PrintCharsAsStringTo(s, wcslen(s), os);
- }
-}
-#endif // wchar_t is native
-
-// Prints a ::string object.
-#if GTEST_HAS_GLOBAL_STRING
-void PrintStringTo(const ::string& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
-void PrintStringTo(const ::std::string& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-
-// Prints a ::wstring object.
-#if GTEST_HAS_GLOBAL_WSTRING
-void PrintWideStringTo(const ::wstring& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
- PrintCharsAsStringTo(s.data(), s.size(), os);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-} // namespace internal
-
-} // namespace testing
-// Copyright 2008, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-// The Google C++ Testing Framework (Google Test)
-
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#undef GTEST_IMPLEMENTATION_
-
-namespace testing {
-
-using internal::GetUnitTestImpl;
-
-// Gets the summary of the failure message by omitting the stack trace
-// in it.
-std::string TestPartResult::ExtractSummary(const char* message) {
- const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
- return stack_trace == NULL ? message :
- std::string(message, stack_trace);
-}
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
- return os
- << result.file_name() << ":" << result.line_number() << ": "
- << (result.type() == TestPartResult::kSuccess ? "Success" :
- result.type() == TestPartResult::kFatalFailure ? "Fatal failure" :
- "Non-fatal failure") << ":\n"
- << result.message() << std::endl;
-}
-
-// Appends a TestPartResult to the array.
-void TestPartResultArray::Append(const TestPartResult& result) {
- array_.push_back(result);
-}
-
-// Returns the TestPartResult at the given index (0-based).
-const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
- if (index < 0 || index >= size()) {
- printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
- internal::posix::Abort();
- }
-
- return array_[index];
-}
-
-// Returns the number of TestPartResult objects in the array.
-int TestPartResultArray::size() const {
- return static_cast<int>(array_.size());
-}
-
-namespace internal {
-
-HasNewFatalFailureHelper::HasNewFatalFailureHelper()
- : has_new_fatal_failure_(false),
- original_reporter_(GetUnitTestImpl()->
- GetTestPartResultReporterForCurrentThread()) {
- GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);
-}
-
-HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
- GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
- original_reporter_);
-}
-
-void HasNewFatalFailureHelper::ReportTestPartResult(
- const TestPartResult& result) {
- if (result.fatally_failed())
- has_new_fatal_failure_ = true;
- original_reporter_->ReportTestPartResult(result);
-}
-
-} // namespace internal
-
-} // namespace testing
-// Copyright 2008 Google Inc.
-// All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-
-namespace testing {
-namespace internal {
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// Skips to the first non-space char in str. Returns an empty string if str
-// contains only whitespace characters.
-static const char* SkipSpaces(const char* str) {
- while (IsSpace(*str))
- str++;
- return str;
-}
-
-// Verifies that registered_tests match the test names in
-// defined_test_names_; returns registered_tests if successful, or
-// aborts the program otherwise.
-const char* TypedTestCasePState::VerifyRegisteredTestNames(
- const char* file, int line, const char* registered_tests) {
- typedef ::std::set<const char*>::const_iterator DefinedTestIter;
- registered_ = true;
-
- // Skip initial whitespace in registered_tests since some
- // preprocessors prefix stringizied literals with whitespace.
- registered_tests = SkipSpaces(registered_tests);
-
- Message errors;
- ::std::set<std::string> tests;
- for (const char* names = registered_tests; names != NULL;
- names = SkipComma(names)) {
- const std::string name = GetPrefixUntilComma(names);
- if (tests.count(name) != 0) {
- errors << "Test " << name << " is listed more than once.\n";
- continue;
- }
-
- bool found = false;
- for (DefinedTestIter it = defined_test_names_.begin();
- it != defined_test_names_.end();
- ++it) {
- if (name == *it) {
- found = true;
- break;
- }
- }
-
- if (found) {
- tests.insert(name);
- } else {
- errors << "No test named " << name
- << " can be found in this test case.\n";
- }
- }
-
- for (DefinedTestIter it = defined_test_names_.begin();
- it != defined_test_names_.end();
- ++it) {
- if (tests.count(*it) == 0) {
- errors << "You forgot to list test " << *it << ".\n";
- }
- }
-
- const std::string& errors_str = errors.GetString();
- if (errors_str != "") {
- fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
- errors_str.c_str());
- fflush(stderr);
- posix::Abort();
- }
-
- return registered_tests;
-}
-
-#endif // GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
diff --git a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest_main.cc b/videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest_main.cc
deleted file mode 100644
index f302822..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/googletest/src/src/gtest_main.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <stdio.h>
-
-#include "gtest/gtest.h"
-
-GTEST_API_ int main(int argc, char **argv) {
- printf("Running main() from gtest_main.cc\n");
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.c b/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.c
deleted file mode 100644
index 116cbc4..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.c
+++ /dev/null
@@ -1,52 +0,0 @@
-// #include <strmif.h>
-#include "EbmlBufferWriter.h"
-#include "EbmlWriter.h"
-// #include <cassert>
-// #include <limits>
-// #include <malloc.h> //_alloca
-#include <stdlib.h>
-#include <wchar.h>
-#include <string.h>
-
-void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len) {
- unsigned char *src = glob->buf;
- src += glob->offset;
- memcpy(src, buffer_in, len);
- glob->offset += len;
-}
-
-static void _Serialize(EbmlGlobal *glob, const unsigned char *p, const unsigned char *q) {
- while (q != p) {
- --q;
- memcpy(&(glob->buf[glob->offset]), q, 1);
- glob->offset++;
- }
-}
-
-void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len) {
- // assert(buf);
-
- const unsigned char *const p = (const unsigned char *)(buffer_in);
- const unsigned char *const q = p + len;
-
- _Serialize(glob, p, q);
-}
-
-
-void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id) {
- Ebml_WriteID(glob, class_id);
- ebmlLoc->offset = glob->offset;
- // todo this is always taking 8 bytes, this may need later optimization
- unsigned long long unknownLen = 0x01FFFFFFFFFFFFFFLLU;
- Ebml_Serialize(glob, (void *)&unknownLen, 8); // this is a key that says lenght unknown
-}
-
-void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc) {
- unsigned long long size = glob->offset - ebmlLoc->offset - 8;
- unsigned long long curOffset = glob->offset;
- glob->offset = ebmlLoc->offset;
- size |= 0x0100000000000000LLU;
- Ebml_Serialize(glob, &size, 8);
- glob->offset = curOffset;
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.h b/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.h
deleted file mode 100644
index acd5c2a..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlBufferWriter.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef EBMLBUFFERWRITER_HPP
-#define EBMLBUFFERWRITER_HPP
-
-typedef struct {
- unsigned long long offset;
-} EbmlLoc;
-
-typedef struct {
- unsigned char *buf;
- unsigned int length;
- unsigned int offset;
-} EbmlGlobal;
-
-
-void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id);
-void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc);
-
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlIDs.h b/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlIDs.h
deleted file mode 100644
index 44d4385..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlIDs.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef MKV_DEFS_HPP
-#define MKV_DEFS_HPP 1
-
-/* Commenting out values not available in webm, but available in matroska */
-
-enum mkv {
- EBML = 0x1A45DFA3,
- EBMLVersion = 0x4286,
- EBMLReadVersion = 0x42F7,
- EBMLMaxIDLength = 0x42F2,
- EBMLMaxSizeLength = 0x42F3,
- DocType = 0x4282,
- DocTypeVersion = 0x4287,
- DocTypeReadVersion = 0x4285,
-/* CRC_32 = 0xBF, */
- Void = 0xEC,
- SignatureSlot = 0x1B538667,
- SignatureAlgo = 0x7E8A,
- SignatureHash = 0x7E9A,
- SignaturePublicKey = 0x7EA5,
- Signature = 0x7EB5,
- SignatureElements = 0x7E5B,
- SignatureElementList = 0x7E7B,
- SignedElement = 0x6532,
- /* segment */
- Segment = 0x18538067,
- /* Meta Seek Information */
- SeekHead = 0x114D9B74,
- Seek = 0x4DBB,
- SeekID = 0x53AB,
- SeekPosition = 0x53AC,
- /* Segment Information */
- Info = 0x1549A966,
-/* SegmentUID = 0x73A4, */
-/* SegmentFilename = 0x7384, */
-/* PrevUID = 0x3CB923, */
-/* PrevFilename = 0x3C83AB, */
-/* NextUID = 0x3EB923, */
-/* NextFilename = 0x3E83BB, */
-/* SegmentFamily = 0x4444, */
-/* ChapterTranslate = 0x6924, */
-/* ChapterTranslateEditionUID = 0x69FC, */
-/* ChapterTranslateCodec = 0x69BF, */
-/* ChapterTranslateID = 0x69A5, */
- TimecodeScale = 0x2AD7B1,
- Segment_Duration = 0x4489,
- DateUTC = 0x4461,
-/* Title = 0x7BA9, */
- MuxingApp = 0x4D80,
- WritingApp = 0x5741,
- /* Cluster */
- Cluster = 0x1F43B675,
- Timecode = 0xE7,
-/* SilentTracks = 0x5854, */
-/* SilentTrackNumber = 0x58D7, */
-/* Position = 0xA7, */
- PrevSize = 0xAB,
- BlockGroup = 0xA0,
- Block = 0xA1,
-/* BlockVirtual = 0xA2, */
- BlockAdditions = 0x75A1,
- BlockMore = 0xA6,
- BlockAddID = 0xEE,
- BlockAdditional = 0xA5,
- BlockDuration = 0x9B,
-/* ReferencePriority = 0xFA, */
- ReferenceBlock = 0xFB,
-/* ReferenceVirtual = 0xFD, */
-/* CodecState = 0xA4, */
-/* Slices = 0x8E, */
-/* TimeSlice = 0xE8, */
- LaceNumber = 0xCC,
-/* FrameNumber = 0xCD, */
-/* BlockAdditionID = 0xCB, */
-/* MkvDelay = 0xCE, */
-/* Cluster_Duration = 0xCF, */
- SimpleBlock = 0xA3,
-/* EncryptedBlock = 0xAF, */
- /* Track */
- Tracks = 0x1654AE6B,
- TrackEntry = 0xAE,
- TrackNumber = 0xD7,
- TrackUID = 0x73C5,
- TrackType = 0x83,
- FlagEnabled = 0xB9,
- FlagDefault = 0x88,
- FlagForced = 0x55AA,
- FlagLacing = 0x9C,
-/* MinCache = 0x6DE7, */
-/* MaxCache = 0x6DF8, */
- DefaultDuration = 0x23E383,
-/* TrackTimecodeScale = 0x23314F, */
-/* TrackOffset = 0x537F, */
- MaxBlockAdditionID = 0x55EE,
- Name = 0x536E,
- Language = 0x22B59C,
- CodecID = 0x86,
- CodecPrivate = 0x63A2,
- CodecName = 0x258688,
-/* AttachmentLink = 0x7446, */
-/* CodecSettings = 0x3A9697, */
-/* CodecInfoURL = 0x3B4040, */
-/* CodecDownloadURL = 0x26B240, */
-/* CodecDecodeAll = 0xAA, */
-/* TrackOverlay = 0x6FAB, */
-/* TrackTranslate = 0x6624, */
-/* TrackTranslateEditionUID = 0x66FC, */
-/* TrackTranslateCodec = 0x66BF, */
-/* TrackTranslateTrackID = 0x66A5, */
- /* video */
- Video = 0xE0,
- FlagInterlaced = 0x9A,
- StereoMode = 0x53B8,
- AlphaMode = 0x53C0,
- PixelWidth = 0xB0,
- PixelHeight = 0xBA,
- PixelCropBottom = 0x54AA,
- PixelCropTop = 0x54BB,
- PixelCropLeft = 0x54CC,
- PixelCropRight = 0x54DD,
- DisplayWidth = 0x54B0,
- DisplayHeight = 0x54BA,
- DisplayUnit = 0x54B2,
- AspectRatioType = 0x54B3,
-/* ColourSpace = 0x2EB524, */
-/* GammaValue = 0x2FB523, */
- FrameRate = 0x2383E3,
- /* end video */
- /* audio */
- Audio = 0xE1,
- SamplingFrequency = 0xB5,
- OutputSamplingFrequency = 0x78B5,
- Channels = 0x9F,
-/* ChannelPositions = 0x7D7B, */
- BitDepth = 0x6264,
- /* end audio */
- /* content encoding */
-/* ContentEncodings = 0x6d80, */
-/* ContentEncoding = 0x6240, */
-/* ContentEncodingOrder = 0x5031, */
-/* ContentEncodingScope = 0x5032, */
-/* ContentEncodingType = 0x5033, */
-/* ContentCompression = 0x5034, */
-/* ContentCompAlgo = 0x4254, */
-/* ContentCompSettings = 0x4255, */
-/* ContentEncryption = 0x5035, */
-/* ContentEncAlgo = 0x47e1, */
-/* ContentEncKeyID = 0x47e2, */
-/* ContentSignature = 0x47e3, */
-/* ContentSigKeyID = 0x47e4, */
-/* ContentSigAlgo = 0x47e5, */
-/* ContentSigHashAlgo = 0x47e6, */
- /* end content encoding */
- /* Cueing Data */
- Cues = 0x1C53BB6B,
- CuePoint = 0xBB,
- CueTime = 0xB3,
- CueTrackPositions = 0xB7,
- CueTrack = 0xF7,
- CueClusterPosition = 0xF1,
- CueBlockNumber = 0x5378
-/* CueCodecState = 0xEA, */
-/* CueReference = 0xDB, */
-/* CueRefTime = 0x96, */
-/* CueRefCluster = 0x97, */
-/* CueRefNumber = 0x535F, */
-/* CueRefCodecState = 0xEB, */
- /* Attachment */
-/* Attachments = 0x1941A469, */
-/* AttachedFile = 0x61A7, */
-/* FileDescription = 0x467E, */
-/* FileName = 0x466E, */
-/* FileMimeType = 0x4660, */
-/* FileData = 0x465C, */
-/* FileUID = 0x46AE, */
-/* FileReferral = 0x4675, */
- /* Chapters */
-/* Chapters = 0x1043A770, */
-/* EditionEntry = 0x45B9, */
-/* EditionUID = 0x45BC, */
-/* EditionFlagHidden = 0x45BD, */
-/* EditionFlagDefault = 0x45DB, */
-/* EditionFlagOrdered = 0x45DD, */
-/* ChapterAtom = 0xB6, */
-/* ChapterUID = 0x73C4, */
-/* ChapterTimeStart = 0x91, */
-/* ChapterTimeEnd = 0x92, */
-/* ChapterFlagHidden = 0x98, */
-/* ChapterFlagEnabled = 0x4598, */
-/* ChapterSegmentUID = 0x6E67, */
-/* ChapterSegmentEditionUID = 0x6EBC, */
-/* ChapterPhysicalEquiv = 0x63C3, */
-/* ChapterTrack = 0x8F, */
-/* ChapterTrackNumber = 0x89, */
-/* ChapterDisplay = 0x80, */
-/* ChapString = 0x85, */
-/* ChapLanguage = 0x437C, */
-/* ChapCountry = 0x437E, */
-/* ChapProcess = 0x6944, */
-/* ChapProcessCodecID = 0x6955, */
-/* ChapProcessPrivate = 0x450D, */
-/* ChapProcessCommand = 0x6911, */
-/* ChapProcessTime = 0x6922, */
-/* ChapProcessData = 0x6933, */
- /* Tagging */
-/* Tags = 0x1254C367, */
-/* Tag = 0x7373, */
-/* Targets = 0x63C0, */
-/* TargetTypeValue = 0x68CA, */
-/* TargetType = 0x63CA, */
-/* Tagging_TrackUID = 0x63C5, */
-/* Tagging_EditionUID = 0x63C9, */
-/* Tagging_ChapterUID = 0x63C4, */
-/* AttachmentUID = 0x63C6, */
-/* SimpleTag = 0x67C8, */
-/* TagName = 0x45A3, */
-/* TagLanguage = 0x447A, */
-/* TagDefault = 0x4484, */
-/* TagString = 0x4487, */
-/* TagBinary = 0x4485, */
-};
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.c b/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.c
deleted file mode 100644
index 27cfe86..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "EbmlWriter.h"
-#include <stdlib.h>
-#include <wchar.h>
-#include <string.h>
-#include <limits.h>
-#if defined(_MSC_VER)
-#define LITERALU64(n) n
-#else
-#define LITERALU64(n) n##LLU
-#endif
-
-void Ebml_WriteLen(EbmlGlobal *glob, int64_t val) {
- /* TODO check and make sure we are not > than 0x0100000000000000LLU */
- unsigned char size = 8; /* size in bytes to output */
-
- /* mask to compare for byte size */
- int64_t minVal = 0xff;
-
- for (size = 1; size < 8; size ++) {
- if (val < minVal)
- break;
-
- minVal = (minVal << 7);
- }
-
- val |= (((uint64_t)0x80) << ((size - 1) * 7));
-
- Ebml_Serialize(glob, (void *) &val, sizeof(val), size);
-}
-
-void Ebml_WriteString(EbmlGlobal *glob, const char *str) {
- const size_t size_ = strlen(str);
- const uint64_t size = size_;
- Ebml_WriteLen(glob, size);
- /* TODO: it's not clear from the spec whether the nul terminator
- * should be serialized too. For now we omit the null terminator.
- */
- Ebml_Write(glob, str, (unsigned long)size);
-}
-
-void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr) {
- const size_t strlen = wcslen(wstr);
-
- /* TODO: it's not clear from the spec whether the nul terminator
- * should be serialized too. For now we include it.
- */
- const uint64_t size = strlen;
-
- Ebml_WriteLen(glob, size);
- Ebml_Write(glob, wstr, (unsigned long)size);
-}
-
-void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id) {
- int len;
-
- if (class_id >= 0x01000000)
- len = 4;
- else if (class_id >= 0x00010000)
- len = 3;
- else if (class_id >= 0x00000100)
- len = 2;
- else
- len = 1;
-
- Ebml_Serialize(glob, (void *)&class_id, sizeof(class_id), len);
-}
-
-void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui) {
- unsigned char sizeSerialized = 8 | 0x80;
- Ebml_WriteID(glob, class_id);
- Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
- Ebml_Serialize(glob, &ui, sizeof(ui), 8);
-}
-
-void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui) {
- unsigned char size = 8; /* size in bytes to output */
- unsigned char sizeSerialized = 0;
- unsigned long minVal;
-
- Ebml_WriteID(glob, class_id);
- minVal = 0x7fLU; /* mask to compare for byte size */
-
- for (size = 1; size < 4; size ++) {
- if (ui < minVal) {
- break;
- }
-
- minVal <<= 7;
- }
-
- sizeSerialized = 0x80 | size;
- Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
- Ebml_Serialize(glob, &ui, sizeof(ui), size);
-}
-/* TODO: perhaps this is a poor name for this id serializer helper function */
-void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long bin) {
- int size;
- for (size = 4; size > 1; size--) {
- if (bin & (unsigned int)0x000000ff << ((size - 1) * 8))
- break;
- }
- Ebml_WriteID(glob, class_id);
- Ebml_WriteLen(glob, size);
- Ebml_WriteID(glob, bin);
-}
-
-void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d) {
- unsigned char len = 0x88;
-
- Ebml_WriteID(glob, class_id);
- Ebml_Serialize(glob, &len, sizeof(len), 1);
- Ebml_Serialize(glob, &d, sizeof(d), 8);
-}
-
-void Ebml_WriteSigned16(EbmlGlobal *glob, short val) {
- signed long out = ((val & 0x003FFFFF) | 0x00200000) << 8;
- Ebml_Serialize(glob, &out, sizeof(out), 3);
-}
-
-void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s) {
- Ebml_WriteID(glob, class_id);
- Ebml_WriteString(glob, s);
-}
-
-void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s) {
- Ebml_WriteID(glob, class_id);
- Ebml_WriteUTF8(glob, s);
-}
-
-void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length) {
- Ebml_WriteID(glob, class_id);
- Ebml_WriteLen(glob, data_length);
- Ebml_Write(glob, data, data_length);
-}
-
-void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize) {
- unsigned char tmp = 0;
- unsigned long i = 0;
-
- Ebml_WriteID(glob, 0xEC);
- Ebml_WriteLen(glob, vSize);
-
- for (i = 0; i < vSize; i++) {
- Ebml_Write(glob, &tmp, 1);
- }
-}
-
-/* TODO Serialize Date */
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.h b/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.h
deleted file mode 100644
index b94f757..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/EbmlWriter.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef EBMLWRITER_HPP
-#define EBMLWRITER_HPP
-#include <stddef.h>
-#include "vpx/vpx_integer.h"
-
-/* note: you must define write and serialize functions as well as your own
- * EBML_GLOBAL
- *
- * These functions MUST be implemented
- */
-
-typedef struct EbmlGlobal EbmlGlobal;
-void Ebml_Serialize(EbmlGlobal *glob, const void *, int, unsigned long);
-void Ebml_Write(EbmlGlobal *glob, const void *, unsigned long);
-
-/*****/
-
-void Ebml_WriteLen(EbmlGlobal *glob, int64_t val);
-void Ebml_WriteString(EbmlGlobal *glob, const char *str);
-void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr);
-void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id);
-void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui);
-void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
-void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
-void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d);
-/* TODO make this more generic to signed */
-void Ebml_WriteSigned16(EbmlGlobal *glob, short val);
-void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s);
-void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s);
-void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length);
-void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize);
-/* TODO need date function */
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/Makefile b/videocodec/libvpx_internal/libvpx/third_party/libmkv/Makefile
deleted file mode 100644
index 71aee23..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#Variables
-CC=gcc
-LINKER=gcc
-FLAGS=-g -Wall
-
-all: testlibmkv
-
-#Build Targets
-EbmlWriter.o: EbmlWriter.c EbmlWriter.h
- $(CC) $(FLAGS) -c EbmlWriter.c
-
-EbmlBufferWriter.o: EbmlBufferWriter.c EbmlBufferWriter.h
- $(CC) $(FLAGS) -c EbmlBufferWriter.c
-
-WebMElement.o: WebMElement.c WebMElement.h
- $(CC) $(FLAGS) -c WebMElement.c
-
-testlibmkv.o: testlibmkv.c
- $(CC) $(FLAGS) -c testlibmkv.c
-
-testlibmkv: testlibmkv.o WebMElement.o EbmlBufferWriter.o EbmlWriter.o
- $(LINKER) $(FLAGS) -o testlibmkv testlibmkv.o WebMElement.o EbmlBufferWriter.o EbmlWriter.o
-
-clean:
- rm -rf *.o testlibmkv
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.c b/videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.c
deleted file mode 100644
index 6c3670a..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.c
+++ /dev/null
@@ -1,217 +0,0 @@
-// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-
-#include "EbmlBufferWriter.h"
-#include "EbmlIDs.h"
-#include "WebMElement.h"
-#include <stdio.h>
-#include "vpx/vpx_integer.h"
-
-#define kVorbisPrivateMaxSize 4000
-
-void writeHeader(EbmlGlobal *glob) {
- EbmlLoc start;
- Ebml_StartSubElement(glob, &start, EBML);
- Ebml_SerializeUnsigned(glob, EBMLVersion, 1);
- Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1); // EBML Read Version
- Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4); // EBML Max ID Length
- Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8); // EBML Max Size Length
- Ebml_SerializeString(glob, DocType, "webm"); // Doc Type
- Ebml_SerializeUnsigned(glob, DocTypeVersion, 2); // Doc Type Version
- Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2); // Doc Type Read Version
- Ebml_EndSubElement(glob, &start);
-}
-
-void writeSimpleBlock(EbmlGlobal *glob, unsigned char trackNumber, short timeCode,
- int isKeyframe, unsigned char lacingFlag, int discardable,
- unsigned char *data, unsigned long dataLength) {
- Ebml_WriteID(glob, SimpleBlock);
- unsigned long blockLength = 4 + dataLength;
- blockLength |= 0x10000000; // TODO check length < 0x0FFFFFFFF
- Ebml_Serialize(glob, &blockLength, sizeof(blockLength), 4);
- trackNumber |= 0x80; // TODO check track nubmer < 128
- Ebml_Write(glob, &trackNumber, 1);
- // Ebml_WriteSigned16(glob, timeCode,2); //this is 3 bytes
- Ebml_Serialize(glob, &timeCode, sizeof(timeCode), 2);
- unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable;
- Ebml_Write(glob, &flags, 1);
- Ebml_Write(glob, data, dataLength);
-}
-
-static uint64_t generateTrackID(unsigned int trackNumber) {
- uint64_t t = time(NULL) * trackNumber;
- uint64_t r = rand();
- r = r << 32;
- r += rand();
- uint64_t rval = t ^ r;
- return rval;
-}
-
-void writeVideoTrack(EbmlGlobal *glob, unsigned int trackNumber,
- int flagLacing, const char *codecId,
- unsigned int pixelWidth, unsigned int pixelHeight,
- double frameRate) {
- EbmlLoc start;
- Ebml_StartSubElement(glob, &start, TrackEntry);
- Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
- uint64_t trackID = generateTrackID(trackNumber);
- Ebml_SerializeUnsigned(glob, TrackUID, trackID);
- Ebml_SerializeString(glob, CodecName, "VP8"); // TODO shouldn't be fixed
-
- Ebml_SerializeUnsigned(glob, TrackType, 1); // video is always 1
- Ebml_SerializeString(glob, CodecID, codecId);
- {
- EbmlLoc videoStart;
- Ebml_StartSubElement(glob, &videoStart, Video);
- Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth);
- Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight);
- Ebml_SerializeFloat(glob, FrameRate, frameRate);
- Ebml_EndSubElement(glob, &videoStart); // Video
- }
- Ebml_EndSubElement(glob, &start); // Track Entry
-}
-void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber,
- int flagLacing, const char *codecId,
- double samplingFrequency, unsigned int channels,
- unsigned char *private, unsigned long privateSize) {
- EbmlLoc start;
- Ebml_StartSubElement(glob, &start, TrackEntry);
- Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
- uint64_t trackID = generateTrackID(trackNumber);
- Ebml_SerializeUnsigned(glob, TrackUID, trackID);
- Ebml_SerializeUnsigned(glob, TrackType, 2); // audio is always 2
- // I am using defaults for thesed required fields
- /* Ebml_SerializeUnsigned(glob, FlagEnabled, 1);
- Ebml_SerializeUnsigned(glob, FlagDefault, 1);
- Ebml_SerializeUnsigned(glob, FlagForced, 1);
- Ebml_SerializeUnsigned(glob, FlagLacing, flagLacing);*/
- Ebml_SerializeString(glob, CodecID, codecId);
- Ebml_SerializeData(glob, CodecPrivate, private, privateSize);
-
- Ebml_SerializeString(glob, CodecName, "VORBIS"); // fixed for now
- {
- EbmlLoc AudioStart;
- Ebml_StartSubElement(glob, &AudioStart, Audio);
- Ebml_SerializeFloat(glob, SamplingFrequency, samplingFrequency);
- Ebml_SerializeUnsigned(glob, Channels, channels);
- Ebml_EndSubElement(glob, &AudioStart);
- }
- Ebml_EndSubElement(glob, &start);
-}
-void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo, unsigned long timeCodeScale, double duration) {
- Ebml_StartSubElement(ebml, startInfo, Info);
- Ebml_SerializeUnsigned(ebml, TimecodeScale, timeCodeScale);
- Ebml_SerializeFloat(ebml, Segment_Duration, duration * 1000.0); // Currently fixed to using milliseconds
- Ebml_SerializeString(ebml, 0x4D80, "QTmuxingAppLibWebM-0.0.1");
- Ebml_SerializeString(ebml, 0x5741, "QTwritingAppLibWebM-0.0.1");
- Ebml_EndSubElement(ebml, startInfo);
-}
-
-/*
-void Mkv_InitializeSegment(Ebml& ebml_out, EbmlLoc& ebmlLoc)
-{
- Ebml_StartSubElement(ebml_out, ebmlLoc, 0x18538067);
-}
-
-void Mkv_InitializeSeek(Ebml& ebml_out, EbmlLoc& ebmlLoc)
-{
- Ebml_StartSubElement(ebml_out, ebmlLoc, 0x114d9b74);
-}
-void Mkv_WriteSeekInformation(Ebml& ebml_out, SeekStruct& seekInformation)
-{
- EbmlLoc ebmlLoc;
- Ebml_StartSubElement(ebml_out, ebmlLoc, 0x4dbb);
- Ebml_SerializeString(ebml_out, 0x53ab, seekInformation.SeekID);
- Ebml_SerializeUnsigned(ebml_out, 0x53ac, seekInformation.SeekPosition);
- Ebml_EndSubElement(ebml_out, ebmlLoc);
-}
-
-void Mkv_WriteSegmentInformation(Ebml& ebml_out, SegmentInformationStruct& segmentInformation)
-{
- Ebml_SerializeUnsigned(ebml_out, 0x73a4, segmentInformation.segmentUID);
- if (segmentInformation.filename != 0)
- Ebml_SerializeString(ebml_out, 0x7384, segmentInformation.filename);
- Ebml_SerializeUnsigned(ebml_out, 0x2AD7B1, segmentInformation.TimecodeScale);
- Ebml_SerializeUnsigned(ebml_out, 0x4489, segmentInformation.Duration);
- // TODO date
- Ebml_SerializeWString(ebml_out, 0x4D80, L"MKVMUX");
- Ebml_SerializeWString(ebml_out, 0x5741, segmentInformation.WritingApp);
-}
-
-void Mkv_InitializeTrack(Ebml& ebml_out, EbmlLoc& ebmlLoc)
-{
- Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1654AE6B);
-}
-
-static void Mkv_WriteGenericTrackData(Ebml& ebml_out, TrackStruct& track)
-{
- Ebml_SerializeUnsigned(ebml_out, 0xD7, track.TrackNumber);
- Ebml_SerializeUnsigned(ebml_out, 0x73C5, track.TrackUID);
- Ebml_SerializeUnsigned(ebml_out, 0x83, track.TrackType);
- Ebml_SerializeUnsigned(ebml_out, 0xB9, track.FlagEnabled ? 1 :0);
- Ebml_SerializeUnsigned(ebml_out, 0x88, track.FlagDefault ? 1 :0);
- Ebml_SerializeUnsigned(ebml_out, 0x55AA, track.FlagForced ? 1 :0);
- if (track.Language != 0)
- Ebml_SerializeString(ebml_out, 0x22B59C, track.Language);
- if (track.CodecID != 0)
- Ebml_SerializeString(ebml_out, 0x86, track.CodecID);
- if (track.CodecPrivate != 0)
- Ebml_SerializeData(ebml_out, 0x63A2, track.CodecPrivate, track.CodecPrivateLength);
- if (track.CodecName != 0)
- Ebml_SerializeWString(ebml_out, 0x258688, track.CodecName);
-}
-
-void Mkv_WriteVideoTrack(Ebml& ebml_out, TrackStruct & track, VideoTrackStruct& video)
-{
- EbmlLoc trackHeadLoc, videoHeadLoc;
- Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); // start Track
- Mkv_WriteGenericTrackData(ebml_out, track);
- Ebml_StartSubElement(ebml_out, videoHeadLoc, 0xE0); // start Video
- Ebml_SerializeUnsigned(ebml_out, 0x9A, video.FlagInterlaced ? 1 :0);
- Ebml_SerializeUnsigned(ebml_out, 0xB0, video.PixelWidth);
- Ebml_SerializeUnsigned(ebml_out, 0xBA, video.PixelHeight);
- Ebml_SerializeUnsigned(ebml_out, 0x54B0, video.PixelDisplayWidth);
- Ebml_SerializeUnsigned(ebml_out, 0x54BA, video.PixelDisplayHeight);
- Ebml_SerializeUnsigned(ebml_out, 0x54B2, video.displayUnit);
- Ebml_SerializeFloat(ebml_out, 0x2383E3, video.FrameRate);
- Ebml_EndSubElement(ebml_out, videoHeadLoc);
- Ebml_EndSubElement(ebml_out, trackHeadLoc);
-
-}
-
-void Mkv_WriteAudioTrack(Ebml& ebml_out, TrackStruct & track, AudioTrackStruct& video)
-{
- EbmlLoc trackHeadLoc, audioHeadLoc;
- Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE);
- Mkv_WriteGenericTrackData(ebml_out, track);
- Ebml_StartSubElement(ebml_out, audioHeadLoc, 0xE0); // start Audio
- Ebml_SerializeFloat(ebml_out, 0xB5, video.SamplingFrequency);
- Ebml_SerializeUnsigned(ebml_out, 0x9F, video.Channels);
- Ebml_SerializeUnsigned(ebml_out, 0x6264, video.BitDepth);
- Ebml_EndSubElement(ebml_out, audioHeadLoc); // end audio
- Ebml_EndSubElement(ebml_out, trackHeadLoc);
-}
-
-void Mkv_WriteEbmlClusterHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, ClusterHeadStruct & clusterHead)
-{
- Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1F43B675);
- Ebml_SerializeUnsigned(ebml_out, 0x6264, clusterHead.TimeCode);
-}
-
-void Mkv_WriteSimpleBlockHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, SimpleBlockStruct& block)
-{
- Ebml_StartSubElement(ebml_out, ebmlLoc, 0xA3);
- Ebml_Write1UInt(ebml_out, block.TrackNumber);
- Ebml_WriteSigned16(ebml_out,block.TimeCode);
- unsigned char flags = 0x00 | (block.iskey ? 0x80:0x00) | (block.lacing << 1) | block.discardable;
- Ebml_Write1UInt(ebml_out, flags); // TODO this may be the wrong function
- Ebml_Serialize(ebml_out, block.data, block.dataLength);
- Ebml_EndSubElement(ebml_out,ebmlLoc);
-}
-*/
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.h b/videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.h
deleted file mode 100644
index 0e5ec20..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/WebMElement.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-
-#ifndef MKV_CONTEXT_HPP
-#define MKV_CONTEXT_HPP 1
-
-// these are helper functions
-void writeHeader(EbmlGlobal *ebml);
-void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo,
- unsigned long timeCodeScale, double duration);
-// this function is a helper only, it assumes a lot of defaults
-void writeVideoTrack(EbmlGlobal *ebml, unsigned int trackNumber,
- int flagLacing, const char *codecId,
- unsigned int pixelWidth, unsigned int pixelHeight,
- double frameRate);
-void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber,
- int flagLacing, const char *codecId,
- double samplingFrequency, unsigned int channels,
- unsigned char *private, unsigned long privateSize);
-
-void writeSimpleBlock(EbmlGlobal *ebml, unsigned char trackNumber,
- short timeCode, int isKeyframe,
- unsigned char lacingFlag, int discardable,
- unsigned char *data, unsigned long dataLength);
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libmkv/testlibmkv.c b/videocodec/libvpx_internal/libvpx/third_party/libmkv/testlibmkv.c
deleted file mode 100644
index 97bcf95..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libmkv/testlibmkv.c
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-
-
-#include "EbmlIDs.h"
-#include "EbmlBufferWriter.h"
-#include "WebMElement.h"
-
-#include <stdio.h>
-int main(int argc, char *argv[]) {
- // init the datatype we're using for ebml output
- unsigned char data[8192];
- EbmlGlobal ebml;
- ebml.buf = data;
- ebml.offset = 0;
- ebml.length = 8192;
-
- writeHeader(&ebml);
- {
- EbmlLoc startSegment;
- Ebml_StartSubElement(&ebml, &startSegment, Segment); // segment
- {
- // segment info
- EbmlLoc startInfo;
- Ebml_StartSubElement(&ebml, &startInfo, Info);
- Ebml_SerializeString(&ebml, 0x4D80, "muxingAppLibMkv");
- Ebml_SerializeString(&ebml, 0x5741, "writingAppLibMkv");
- Ebml_EndSubElement(&ebml, &startInfo);
- }
-
- {
- EbmlLoc trackStart;
- Ebml_StartSubElement(&ebml, &trackStart, Tracks);
- writeVideoTrack(&ebml, 1, 1, "V_MS/VFW/FOURCC", 320, 240, 29.97);
- // writeAudioTrack(&ebml,2,1, "A_VORBIS", 32000, 1, NULL, 0);
- Ebml_EndSubElement(&ebml, &trackStart);
- }
-
- {
- EbmlLoc clusterStart;
- Ebml_StartSubElement(&ebml, &clusterStart, Cluster); // cluster
- Ebml_SerializeUnsigned(&ebml, Timecode, 0);
-
- unsigned char someData[4] = {1, 2, 3, 4};
- writeSimpleBlock(&ebml, 1, 0, 1, 0, 0, someData, 4);
- Ebml_EndSubElement(&ebml, &clusterStart);
- } // end cluster
- Ebml_EndSubElement(&ebml, &startSegment);
- }
-
- // dump ebml stuff to the file
- FILE *file_out = fopen("test.mkv", "wb");
- size_t bytesWritten = fwrite(data, 1, ebml.offset, file_out);
- fclose(file_out);
- return 0;
-} \ No newline at end of file
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/AUTHORS.TXT b/videocodec/libvpx_internal/libvpx/third_party/libwebm/AUTHORS.TXT
deleted file mode 100644
index 8ab6f79..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/AUTHORS.TXT
+++ /dev/null
@@ -1,4 +0,0 @@
-# Names should be added to this file like so:
-# Name or Organization <email address>
-
-Google Inc.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/LICENSE.TXT b/videocodec/libvpx_internal/libvpx/third_party/libwebm/LICENSE.TXT
deleted file mode 100644
index 7a6f995..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/LICENSE.TXT
+++ /dev/null
@@ -1,30 +0,0 @@
-Copyright (c) 2010, Google Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- * Neither the name of Google nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/PATENTS.TXT b/videocodec/libvpx_internal/libvpx/third_party/libwebm/PATENTS.TXT
deleted file mode 100644
index 4414d83..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/PATENTS.TXT
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the WebM Project.
-
-Google hereby grants to you a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer, and otherwise run, modify and propagate the contents of this
-implementation of VP8, where such license applies only to those patent
-claims, both currently owned by Google and acquired in the future,
-licensable by Google that are necessarily infringed by this
-implementation of VP8. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of VP8 or any code incorporated within this
-implementation of VP8 constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of VP8
-shall terminate as of the date such litigation is filed.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/README.webm b/videocodec/libvpx_internal/libvpx/third_party/libwebm/README.webm
deleted file mode 100644
index b13c8cb..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/README.webm
+++ /dev/null
@@ -1,7 +0,0 @@
-URL: https://chromium.googlesource.com/webm/libwebm
-Version: 630a0e3c338e1b32bddf513a2dad807908d2976a
-License: BSD
-License File: LICENSE.txt
-
-Description:
-libwebm is used to handle WebM container I/O.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/RELEASE.TXT b/videocodec/libvpx_internal/libvpx/third_party/libwebm/RELEASE.TXT
deleted file mode 100644
index a7e9f03..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/RELEASE.TXT
+++ /dev/null
@@ -1,34 +0,0 @@
-1.0.0.5
- * Handled case when no duration
- * Handled empty clusters
- * Handled empty clusters when seeking
- * Implemented check lacing bits
-
-1.0.0.4
- * Made Cues member variables mutables
- * Defined against badly-formatted cue points
- * Segment::GetCluster returns CuePoint too
- * Separated cue-based searches
-
-1.0.0.3
- * Added Block::GetOffset() to get a frame's offset in a block
- * Changed cluster count type from size_t to long
- * Parsed SeekHead to find cues
- * Allowed seeking beyond end of cluster cache
- * Added not to attempt to reparse cues element
- * Restructured Segment::LoadCluster
- * Marked position of cues without parsing cues element
- * Allowed cue points to be loaded incrementally
- * Implemented to load lazily cue points as they're searched
- * Merged Cues::LoadCuePoint into Cues::Find
- * Lazy init cues
- * Loaded cue point during find
-
-1.0.0.2
- * added support for Cues element
- * seeking was improved
-
-1.0.0.1
- * fixed item 141
- * added item 142
- * added this file, RELEASE.TXT, to repository
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.cpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.cpp
deleted file mode 100644
index 8ae0dda..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.cpp
+++ /dev/null
@@ -1,3245 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#include "mkvmuxer.hpp"
-
-#include <climits>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <new>
-
-#include "mkvmuxerutil.hpp"
-#include "mkvparser.hpp"
-#include "mkvwriter.hpp"
-#include "webmids.hpp"
-
-#ifdef _MSC_VER
-// Disable MSVC warnings that suggest making code non-portable.
-#pragma warning(disable:4996)
-#endif
-
-namespace mkvmuxer {
-
-namespace {
-// Deallocate the string designated by |dst|, and then copy the |src|
-// string to |dst|. The caller owns both the |src| string and the
-// |dst| copy (hence the caller is responsible for eventually
-// deallocating the strings, either directly, or indirectly via
-// StrCpy). Returns true if the source string was successfully copied
-// to the destination.
-bool StrCpy(const char* src, char** dst_ptr) {
- if (dst_ptr == NULL)
- return false;
-
- char*& dst = *dst_ptr;
-
- delete [] dst;
- dst = NULL;
-
- if (src == NULL)
- return true;
-
- const size_t size = strlen(src) + 1;
-
- dst = new (std::nothrow) char[size]; // NOLINT
- if (dst == NULL)
- return false;
-
- strcpy(dst, src); // NOLINT
- return true;
-}
-} // namespace
-
-///////////////////////////////////////////////////////////////
-//
-// IMkvWriter Class
-
-IMkvWriter::IMkvWriter() {
-}
-
-IMkvWriter::~IMkvWriter() {
-}
-
-bool WriteEbmlHeader(IMkvWriter* writer) {
- // Level 0
- uint64 size = EbmlElementSize(kMkvEBMLVersion, 1ULL);
- size += EbmlElementSize(kMkvEBMLReadVersion, 1ULL);
- size += EbmlElementSize(kMkvEBMLMaxIDLength, 4ULL);
- size += EbmlElementSize(kMkvEBMLMaxSizeLength, 8ULL);
- size += EbmlElementSize(kMkvDocType, "webm");
- size += EbmlElementSize(kMkvDocTypeVersion, 2ULL);
- size += EbmlElementSize(kMkvDocTypeReadVersion, 2ULL);
-
- if (!WriteEbmlMasterElement(writer, kMkvEBML, size))
- return false;
- if (!WriteEbmlElement(writer, kMkvEBMLVersion, 1ULL))
- return false;
- if (!WriteEbmlElement(writer, kMkvEBMLReadVersion, 1ULL))
- return false;
- if (!WriteEbmlElement(writer, kMkvEBMLMaxIDLength, 4ULL))
- return false;
- if (!WriteEbmlElement(writer, kMkvEBMLMaxSizeLength, 8ULL))
- return false;
- if (!WriteEbmlElement(writer, kMkvDocType, "webm"))
- return false;
- if (!WriteEbmlElement(writer, kMkvDocTypeVersion, 2ULL))
- return false;
- if (!WriteEbmlElement(writer, kMkvDocTypeReadVersion, 2ULL))
- return false;
-
- return true;
-}
-
-bool ChunkedCopy(mkvparser::IMkvReader* source,
- mkvmuxer::IMkvWriter* dst,
- mkvmuxer::int64 start, int64 size) {
- // TODO(vigneshv): Check if this is a reasonable value.
- const uint32 kBufSize = 2048;
- uint8* buf = new uint8[kBufSize];
- int64 offset = start;
- while (size > 0) {
- const int64 read_len = (size > kBufSize) ? kBufSize : size;
- if (source->Read(offset, static_cast<long>(read_len), buf))
- return false;
- dst->Write(buf, static_cast<uint32>(read_len));
- offset += read_len;
- size -= read_len;
- }
- delete[] buf;
- return true;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Frame Class
-
-Frame::Frame()
- : add_id_(0),
- additional_(NULL),
- additional_length_(0),
- duration_(0),
- frame_(NULL),
- is_key_(false),
- length_(0),
- track_number_(0),
- timestamp_(0),
- discard_padding_(0) {
-}
-
-Frame::~Frame() {
- delete [] frame_;
- delete [] additional_;
-}
-
-bool Frame::Init(const uint8* frame, uint64 length) {
- uint8* const data =
- new (std::nothrow) uint8[static_cast<size_t>(length)]; // NOLINT
- if (!data)
- return false;
-
- delete [] frame_;
- frame_ = data;
- length_ = length;
-
- memcpy(frame_, frame, static_cast<size_t>(length_));
- return true;
-}
-
-bool Frame::AddAdditionalData(const uint8* additional, uint64 length,
- uint64 add_id) {
- uint8* const data =
- new (std::nothrow) uint8[static_cast<size_t>(length)]; // NOLINT
- if (!data)
- return false;
-
- delete [] additional_;
- additional_ = data;
- additional_length_ = length;
- add_id_ = add_id;
-
- memcpy(additional_, additional, static_cast<size_t>(additional_length_));
- return true;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// CuePoint Class
-
-CuePoint::CuePoint()
- : time_(0),
- track_(0),
- cluster_pos_(0),
- block_number_(1),
- output_block_number_(true) {
-}
-
-CuePoint::~CuePoint() {
-}
-
-bool CuePoint::Write(IMkvWriter* writer) const {
- if (!writer || track_ < 1 || cluster_pos_ < 1)
- return false;
-
- uint64 size = EbmlElementSize(kMkvCueClusterPosition, cluster_pos_);
- size += EbmlElementSize(kMkvCueTrack, track_);
- if (output_block_number_ && block_number_ > 1)
- size += EbmlElementSize(kMkvCueBlockNumber, block_number_);
- const uint64 track_pos_size = EbmlMasterElementSize(kMkvCueTrackPositions,
- size) + size;
- const uint64 payload_size = EbmlElementSize(kMkvCueTime, time_) +
- track_pos_size;
-
- if (!WriteEbmlMasterElement(writer, kMkvCuePoint, payload_size))
- return false;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- if (!WriteEbmlElement(writer, kMkvCueTime, time_))
- return false;
-
- if (!WriteEbmlMasterElement(writer, kMkvCueTrackPositions, size))
- return false;
- if (!WriteEbmlElement(writer, kMkvCueTrack, track_))
- return false;
- if (!WriteEbmlElement(writer, kMkvCueClusterPosition, cluster_pos_))
- return false;
- if (output_block_number_ && block_number_ > 1)
- if (!WriteEbmlElement(writer, kMkvCueBlockNumber, block_number_))
- return false;
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0)
- return false;
-
- if (stop_position - payload_position != static_cast<int64>(payload_size))
- return false;
-
- return true;
-}
-
-uint64 CuePoint::PayloadSize() const {
- uint64 size = EbmlElementSize(kMkvCueClusterPosition, cluster_pos_);
- size += EbmlElementSize(kMkvCueTrack, track_);
- if (output_block_number_ && block_number_ > 1)
- size += EbmlElementSize(kMkvCueBlockNumber, block_number_);
- const uint64 track_pos_size = EbmlMasterElementSize(kMkvCueTrackPositions,
- size) + size;
- const uint64 payload_size = EbmlElementSize(kMkvCueTime, time_) +
- track_pos_size;
-
- return payload_size;
-}
-
-uint64 CuePoint::Size() const {
- const uint64 payload_size = PayloadSize();
- return EbmlMasterElementSize(kMkvCuePoint, payload_size) + payload_size;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Cues Class
-
-Cues::Cues()
- : cue_entries_capacity_(0),
- cue_entries_size_(0),
- cue_entries_(NULL),
- output_block_number_(true) {
-}
-
-Cues::~Cues() {
- if (cue_entries_) {
- for (int32 i = 0; i < cue_entries_size_; ++i) {
- CuePoint* const cue = cue_entries_[i];
- delete cue;
- }
- delete [] cue_entries_;
- }
-}
-
-bool Cues::AddCue(CuePoint* cue) {
- if (!cue)
- return false;
-
- if ((cue_entries_size_ + 1) > cue_entries_capacity_) {
- // Add more CuePoints.
- const int32 new_capacity =
- (!cue_entries_capacity_) ? 2 : cue_entries_capacity_ * 2;
-
- if (new_capacity < 1)
- return false;
-
- CuePoint** const cues =
- new (std::nothrow) CuePoint*[new_capacity]; // NOLINT
- if (!cues)
- return false;
-
- for (int32 i = 0; i < cue_entries_size_; ++i) {
- cues[i] = cue_entries_[i];
- }
-
- delete [] cue_entries_;
-
- cue_entries_ = cues;
- cue_entries_capacity_ = new_capacity;
- }
-
- cue->set_output_block_number(output_block_number_);
- cue_entries_[cue_entries_size_++] = cue;
- return true;
-}
-
-CuePoint* Cues::GetCueByIndex(int32 index) const {
- if (cue_entries_ == NULL)
- return NULL;
-
- if (index >= cue_entries_size_)
- return NULL;
-
- return cue_entries_[index];
-}
-
-uint64 Cues::Size() {
- uint64 size = 0;
- for (int32 i = 0; i < cue_entries_size_; ++i)
- size += GetCueByIndex(i)->Size();
- size += EbmlMasterElementSize(kMkvCues, size);
- return size;
-}
-
-bool Cues::Write(IMkvWriter* writer) const {
- if (!writer)
- return false;
-
- uint64 size = 0;
- for (int32 i = 0; i < cue_entries_size_; ++i) {
- const CuePoint* const cue = GetCueByIndex(i);
-
- if (!cue)
- return false;
-
- size += cue->Size();
- }
-
- if (!WriteEbmlMasterElement(writer, kMkvCues, size))
- return false;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- for (int32 i = 0; i < cue_entries_size_; ++i) {
- const CuePoint* const cue = GetCueByIndex(i);
-
- if (!cue->Write(writer))
- return false;
- }
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0)
- return false;
-
- if (stop_position - payload_position != static_cast<int64>(size))
- return false;
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// ContentEncAESSettings Class
-
-ContentEncAESSettings::ContentEncAESSettings() : cipher_mode_(kCTR) {}
-
-uint64 ContentEncAESSettings::Size() const {
- const uint64 payload = PayloadSize();
- const uint64 size =
- EbmlMasterElementSize(kMkvContentEncAESSettings, payload) + payload;
- return size;
-}
-
-bool ContentEncAESSettings::Write(IMkvWriter* writer) const {
- const uint64 payload = PayloadSize();
-
- if (!WriteEbmlMasterElement(writer, kMkvContentEncAESSettings, payload))
- return false;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- if (!WriteEbmlElement(writer, kMkvAESSettingsCipherMode, cipher_mode_))
- return false;
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(payload))
- return false;
-
- return true;
-}
-
-uint64 ContentEncAESSettings::PayloadSize() const {
- uint64 size = EbmlElementSize(kMkvAESSettingsCipherMode, cipher_mode_);
- return size;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// ContentEncoding Class
-
-ContentEncoding::ContentEncoding()
- : enc_algo_(5),
- enc_key_id_(NULL),
- encoding_order_(0),
- encoding_scope_(1),
- encoding_type_(1),
- enc_key_id_length_(0) {
-}
-
-ContentEncoding::~ContentEncoding() {
- delete [] enc_key_id_;
-}
-
-bool ContentEncoding::SetEncryptionID(const uint8* id, uint64 length) {
- if (!id || length < 1)
- return false;
-
- delete [] enc_key_id_;
-
- enc_key_id_ =
- new (std::nothrow) uint8[static_cast<size_t>(length)]; // NOLINT
- if (!enc_key_id_)
- return false;
-
- memcpy(enc_key_id_, id, static_cast<size_t>(length));
- enc_key_id_length_ = length;
-
- return true;
-}
-
-uint64 ContentEncoding::Size() const {
- const uint64 encryption_size = EncryptionSize();
- const uint64 encoding_size = EncodingSize(0, encryption_size);
- const uint64 encodings_size = EbmlMasterElementSize(kMkvContentEncoding,
- encoding_size) +
- encoding_size;
-
- return encodings_size;
-}
-
-bool ContentEncoding::Write(IMkvWriter* writer) const {
- const uint64 encryption_size = EncryptionSize();
- const uint64 encoding_size = EncodingSize(0, encryption_size);
- const uint64 size = EbmlMasterElementSize(kMkvContentEncoding,
- encoding_size) +
- encoding_size;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- if (!WriteEbmlMasterElement(writer, kMkvContentEncoding, encoding_size))
- return false;
- if (!WriteEbmlElement(writer, kMkvContentEncodingOrder, encoding_order_))
- return false;
- if (!WriteEbmlElement(writer, kMkvContentEncodingScope, encoding_scope_))
- return false;
- if (!WriteEbmlElement(writer, kMkvContentEncodingType, encoding_type_))
- return false;
-
- if (!WriteEbmlMasterElement(writer, kMkvContentEncryption, encryption_size))
- return false;
- if (!WriteEbmlElement(writer, kMkvContentEncAlgo, enc_algo_))
- return false;
- if (!WriteEbmlElement(writer,
- kMkvContentEncKeyID,
- enc_key_id_,
- enc_key_id_length_))
- return false;
-
- if (!enc_aes_settings_.Write(writer))
- return false;
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(size))
- return false;
-
- return true;
-}
-
-uint64 ContentEncoding::EncodingSize(uint64 compresion_size,
- uint64 encryption_size) const {
- // TODO(fgalligan): Add support for compression settings.
- if (compresion_size != 0)
- return 0;
-
- uint64 encoding_size = 0;
-
- if (encryption_size > 0) {
- encoding_size += EbmlMasterElementSize(kMkvContentEncryption,
- encryption_size) +
- encryption_size;
- }
- encoding_size += EbmlElementSize(kMkvContentEncodingType, encoding_type_);
- encoding_size += EbmlElementSize(kMkvContentEncodingScope, encoding_scope_);
- encoding_size += EbmlElementSize(kMkvContentEncodingOrder, encoding_order_);
-
- return encoding_size;
-}
-
-uint64 ContentEncoding::EncryptionSize() const {
- const uint64 aes_size = enc_aes_settings_.Size();
-
- uint64 encryption_size = EbmlElementSize(kMkvContentEncKeyID,
- enc_key_id_,
- enc_key_id_length_);
- encryption_size += EbmlElementSize(kMkvContentEncAlgo, enc_algo_);
-
- return encryption_size + aes_size;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Track Class
-
-Track::Track(unsigned int* seed)
- : codec_id_(NULL),
- codec_private_(NULL),
- language_(NULL),
- max_block_additional_id_(0),
- name_(NULL),
- number_(0),
- type_(0),
- uid_(MakeUID(seed)),
- codec_delay_(0),
- seek_pre_roll_(0),
- codec_private_length_(0),
- content_encoding_entries_(NULL),
- content_encoding_entries_size_(0) {
-}
-
-Track::~Track() {
- delete [] codec_id_;
- delete [] codec_private_;
- delete [] language_;
- delete [] name_;
-
- if (content_encoding_entries_) {
- for (uint32 i = 0; i < content_encoding_entries_size_; ++i) {
- ContentEncoding* const encoding = content_encoding_entries_[i];
- delete encoding;
- }
- delete [] content_encoding_entries_;
- }
-}
-
-bool Track::AddContentEncoding() {
- const uint32 count = content_encoding_entries_size_ + 1;
-
- ContentEncoding** const content_encoding_entries =
- new (std::nothrow) ContentEncoding*[count]; // NOLINT
- if (!content_encoding_entries)
- return false;
-
- ContentEncoding* const content_encoding =
- new (std::nothrow) ContentEncoding(); // NOLINT
- if (!content_encoding) {
- delete [] content_encoding_entries;
- return false;
- }
-
- for (uint32 i = 0; i < content_encoding_entries_size_; ++i) {
- content_encoding_entries[i] = content_encoding_entries_[i];
- }
-
- delete [] content_encoding_entries_;
-
- content_encoding_entries_ = content_encoding_entries;
- content_encoding_entries_[content_encoding_entries_size_] = content_encoding;
- content_encoding_entries_size_ = count;
- return true;
-}
-
-ContentEncoding* Track::GetContentEncodingByIndex(uint32 index) const {
- if (content_encoding_entries_ == NULL)
- return NULL;
-
- if (index >= content_encoding_entries_size_)
- return NULL;
-
- return content_encoding_entries_[index];
-}
-
-uint64 Track::PayloadSize() const {
- uint64 size = EbmlElementSize(kMkvTrackNumber, number_);
- size += EbmlElementSize(kMkvTrackUID, uid_);
- size += EbmlElementSize(kMkvTrackType, type_);
- if (codec_id_)
- size += EbmlElementSize(kMkvCodecID, codec_id_);
- if (codec_private_)
- size += EbmlElementSize(kMkvCodecPrivate,
- codec_private_,
- codec_private_length_);
- if (language_)
- size += EbmlElementSize(kMkvLanguage, language_);
- if (name_)
- size += EbmlElementSize(kMkvName, name_);
- if (max_block_additional_id_)
- size += EbmlElementSize(kMkvMaxBlockAdditionID, max_block_additional_id_);
- if (codec_delay_)
- size += EbmlElementSize(kMkvCodecDelay, codec_delay_);
- if (seek_pre_roll_)
- size += EbmlElementSize(kMkvSeekPreRoll, seek_pre_roll_);
-
- if (content_encoding_entries_size_ > 0) {
- uint64 content_encodings_size = 0;
- for (uint32 i = 0; i < content_encoding_entries_size_; ++i) {
- ContentEncoding* const encoding = content_encoding_entries_[i];
- content_encodings_size += encoding->Size();
- }
-
- size += EbmlMasterElementSize(kMkvContentEncodings,
- content_encodings_size) +
- content_encodings_size;
- }
-
- return size;
-}
-
-uint64 Track::Size() const {
- uint64 size = PayloadSize();
- size += EbmlMasterElementSize(kMkvTrackEntry, size);
- return size;
-}
-
-bool Track::Write(IMkvWriter* writer) const {
- if (!writer)
- return false;
-
- // |size| may be bigger than what is written out in this function because
- // derived classes may write out more data in the Track element.
- const uint64 payload_size = PayloadSize();
-
- if (!WriteEbmlMasterElement(writer, kMkvTrackEntry, payload_size))
- return false;
-
- uint64 size = EbmlElementSize(kMkvTrackNumber, number_);
- size += EbmlElementSize(kMkvTrackUID, uid_);
- size += EbmlElementSize(kMkvTrackType, type_);
- if (codec_id_)
- size += EbmlElementSize(kMkvCodecID, codec_id_);
- if (codec_private_)
- size += EbmlElementSize(kMkvCodecPrivate,
- codec_private_,
- codec_private_length_);
- if (language_)
- size += EbmlElementSize(kMkvLanguage, language_);
- if (name_)
- size += EbmlElementSize(kMkvName, name_);
- if (max_block_additional_id_)
- size += EbmlElementSize(kMkvMaxBlockAdditionID, max_block_additional_id_);
- if (codec_delay_)
- size += EbmlElementSize(kMkvCodecDelay, codec_delay_);
- if (seek_pre_roll_)
- size += EbmlElementSize(kMkvSeekPreRoll, seek_pre_roll_);
-
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- if (!WriteEbmlElement(writer, kMkvTrackNumber, number_))
- return false;
- if (!WriteEbmlElement(writer, kMkvTrackUID, uid_))
- return false;
- if (!WriteEbmlElement(writer, kMkvTrackType, type_))
- return false;
- if (max_block_additional_id_) {
- if (!WriteEbmlElement(writer,
- kMkvMaxBlockAdditionID,
- max_block_additional_id_)) {
- return false;
- }
- }
- if (codec_delay_) {
- if (!WriteEbmlElement(writer, kMkvCodecDelay, codec_delay_))
- return false;
- }
- if (seek_pre_roll_) {
- if (!WriteEbmlElement(writer, kMkvSeekPreRoll, seek_pre_roll_))
- return false;
- }
- if (codec_id_) {
- if (!WriteEbmlElement(writer, kMkvCodecID, codec_id_))
- return false;
- }
- if (codec_private_) {
- if (!WriteEbmlElement(writer,
- kMkvCodecPrivate,
- codec_private_,
- codec_private_length_))
- return false;
- }
- if (language_) {
- if (!WriteEbmlElement(writer, kMkvLanguage, language_))
- return false;
- }
- if (name_) {
- if (!WriteEbmlElement(writer, kMkvName, name_))
- return false;
- }
-
- int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(size))
- return false;
-
- if (content_encoding_entries_size_ > 0) {
- uint64 content_encodings_size = 0;
- for (uint32 i = 0; i < content_encoding_entries_size_; ++i) {
- ContentEncoding* const encoding = content_encoding_entries_[i];
- content_encodings_size += encoding->Size();
- }
-
- if (!WriteEbmlMasterElement(writer,
- kMkvContentEncodings,
- content_encodings_size))
- return false;
-
- for (uint32 i = 0; i < content_encoding_entries_size_; ++i) {
- ContentEncoding* const encoding = content_encoding_entries_[i];
- if (!encoding->Write(writer))
- return false;
- }
- }
-
- stop_position = writer->Position();
- if (stop_position < 0)
- return false;
- return true;
-}
-
-bool Track::SetCodecPrivate(const uint8* codec_private, uint64 length) {
- if (!codec_private || length < 1)
- return false;
-
- delete [] codec_private_;
-
- codec_private_ =
- new (std::nothrow) uint8[static_cast<size_t>(length)]; // NOLINT
- if (!codec_private_)
- return false;
-
- memcpy(codec_private_, codec_private, static_cast<size_t>(length));
- codec_private_length_ = length;
-
- return true;
-}
-
-void Track::set_codec_id(const char* codec_id) {
- if (codec_id) {
- delete [] codec_id_;
-
- const size_t length = strlen(codec_id) + 1;
- codec_id_ = new (std::nothrow) char[length]; // NOLINT
- if (codec_id_) {
-#ifdef _MSC_VER
- strcpy_s(codec_id_, length, codec_id);
-#else
- strcpy(codec_id_, codec_id);
-#endif
- }
- }
-}
-
-// TODO(fgalligan): Vet the language parameter.
-void Track::set_language(const char* language) {
- if (language) {
- delete [] language_;
-
- const size_t length = strlen(language) + 1;
- language_ = new (std::nothrow) char[length]; // NOLINT
- if (language_) {
-#ifdef _MSC_VER
- strcpy_s(language_, length, language);
-#else
- strcpy(language_, language);
-#endif
- }
- }
-}
-
-void Track::set_name(const char* name) {
- if (name) {
- delete [] name_;
-
- const size_t length = strlen(name) + 1;
- name_ = new (std::nothrow) char[length]; // NOLINT
- if (name_) {
-#ifdef _MSC_VER
- strcpy_s(name_, length, name);
-#else
- strcpy(name_, name);
-#endif
- }
- }
-}
-
-///////////////////////////////////////////////////////////////
-//
-// VideoTrack Class
-
-VideoTrack::VideoTrack(unsigned int* seed)
- : Track(seed),
- display_height_(0),
- display_width_(0),
- frame_rate_(0.0),
- height_(0),
- stereo_mode_(0),
- alpha_mode_(0),
- width_(0) {
-}
-
-VideoTrack::~VideoTrack() {
-}
-
-bool VideoTrack::SetStereoMode(uint64 stereo_mode) {
- if (stereo_mode != kMono &&
- stereo_mode != kSideBySideLeftIsFirst &&
- stereo_mode != kTopBottomRightIsFirst &&
- stereo_mode != kTopBottomLeftIsFirst &&
- stereo_mode != kSideBySideRightIsFirst)
- return false;
-
- stereo_mode_ = stereo_mode;
- return true;
-}
-
-bool VideoTrack::SetAlphaMode(uint64 alpha_mode) {
- if (alpha_mode != kNoAlpha &&
- alpha_mode != kAlpha)
- return false;
-
- alpha_mode_ = alpha_mode;
- return true;
-}
-
-uint64 VideoTrack::PayloadSize() const {
- const uint64 parent_size = Track::PayloadSize();
-
- uint64 size = VideoPayloadSize();
- size += EbmlMasterElementSize(kMkvVideo, size);
-
- return parent_size + size;
-}
-
-bool VideoTrack::Write(IMkvWriter* writer) const {
- if (!Track::Write(writer))
- return false;
-
- const uint64 size = VideoPayloadSize();
-
- if (!WriteEbmlMasterElement(writer, kMkvVideo, size))
- return false;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- if (!WriteEbmlElement(writer, kMkvPixelWidth, width_))
- return false;
- if (!WriteEbmlElement(writer, kMkvPixelHeight, height_))
- return false;
- if (display_width_ > 0)
- if (!WriteEbmlElement(writer, kMkvDisplayWidth, display_width_))
- return false;
- if (display_height_ > 0)
- if (!WriteEbmlElement(writer, kMkvDisplayHeight, display_height_))
- return false;
- if (stereo_mode_ > kMono)
- if (!WriteEbmlElement(writer, kMkvStereoMode, stereo_mode_))
- return false;
- if (alpha_mode_ > kNoAlpha)
- if (!WriteEbmlElement(writer, kMkvAlphaMode, alpha_mode_))
- return false;
- if (frame_rate_ > 0.0)
- if (!WriteEbmlElement(writer,
- kMkvFrameRate,
- static_cast<float>(frame_rate_)))
- return false;
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(size))
- return false;
-
- return true;
-}
-
-uint64 VideoTrack::VideoPayloadSize() const {
- uint64 size = EbmlElementSize(kMkvPixelWidth, width_);
- size += EbmlElementSize(kMkvPixelHeight, height_);
- if (display_width_ > 0)
- size += EbmlElementSize(kMkvDisplayWidth, display_width_);
- if (display_height_ > 0)
- size += EbmlElementSize(kMkvDisplayHeight, display_height_);
- if (stereo_mode_ > kMono)
- size += EbmlElementSize(kMkvStereoMode, stereo_mode_);
- if (alpha_mode_ > kNoAlpha)
- size += EbmlElementSize(kMkvAlphaMode, alpha_mode_);
- if (frame_rate_ > 0.0)
- size += EbmlElementSize(kMkvFrameRate, static_cast<float>(frame_rate_));
-
- return size;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// AudioTrack Class
-
-AudioTrack::AudioTrack(unsigned int* seed)
- : Track(seed),
- bit_depth_(0),
- channels_(1),
- sample_rate_(0.0) {
-}
-
-AudioTrack::~AudioTrack() {
-}
-
-uint64 AudioTrack::PayloadSize() const {
- const uint64 parent_size = Track::PayloadSize();
-
- uint64 size = EbmlElementSize(kMkvSamplingFrequency,
- static_cast<float>(sample_rate_));
- size += EbmlElementSize(kMkvChannels, channels_);
- if (bit_depth_ > 0)
- size += EbmlElementSize(kMkvBitDepth, bit_depth_);
- size += EbmlMasterElementSize(kMkvAudio, size);
-
- return parent_size + size;
-}
-
-bool AudioTrack::Write(IMkvWriter* writer) const {
- if (!Track::Write(writer))
- return false;
-
- // Calculate AudioSettings size.
- uint64 size = EbmlElementSize(kMkvSamplingFrequency,
- static_cast<float>(sample_rate_));
- size += EbmlElementSize(kMkvChannels, channels_);
- if (bit_depth_ > 0)
- size += EbmlElementSize(kMkvBitDepth, bit_depth_);
-
- if (!WriteEbmlMasterElement(writer, kMkvAudio, size))
- return false;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- if (!WriteEbmlElement(writer,
- kMkvSamplingFrequency,
- static_cast<float>(sample_rate_)))
- return false;
- if (!WriteEbmlElement(writer, kMkvChannels, channels_))
- return false;
- if (bit_depth_ > 0)
- if (!WriteEbmlElement(writer, kMkvBitDepth, bit_depth_))
- return false;
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(size))
- return false;
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Tracks Class
-
-const char Tracks::kOpusCodecId[] = "A_OPUS";
-const char Tracks::kVorbisCodecId[] = "A_VORBIS";
-const char Tracks::kVp8CodecId[] = "V_VP8";
-const char Tracks::kVp9CodecId[] = "V_VP9";
-
-
-Tracks::Tracks()
- : track_entries_(NULL),
- track_entries_size_(0) {
-}
-
-Tracks::~Tracks() {
- if (track_entries_) {
- for (uint32 i = 0; i < track_entries_size_; ++i) {
- Track* const track = track_entries_[i];
- delete track;
- }
- delete [] track_entries_;
- }
-}
-
-bool Tracks::AddTrack(Track* track, int32 number) {
- if (number < 0)
- return false;
-
- // This muxer only supports track numbers in the range [1, 126], in
- // order to be able (to use Matroska integer representation) to
- // serialize the block header (of which the track number is a part)
- // for a frame using exactly 4 bytes.
-
- if (number > 0x7E)
- return false;
-
- uint32 track_num = number;
-
- if (track_num > 0) {
- // Check to make sure a track does not already have |track_num|.
- for (uint32 i = 0; i < track_entries_size_; ++i) {
- if (track_entries_[i]->number() == track_num)
- return false;
- }
- }
-
- const uint32 count = track_entries_size_ + 1;
-
- Track** const track_entries = new (std::nothrow) Track*[count]; // NOLINT
- if (!track_entries)
- return false;
-
- for (uint32 i = 0; i < track_entries_size_; ++i) {
- track_entries[i] = track_entries_[i];
- }
-
- delete [] track_entries_;
-
- // Find the lowest availible track number > 0.
- if (track_num == 0) {
- track_num = count;
-
- // Check to make sure a track does not already have |track_num|.
- bool exit = false;
- do {
- exit = true;
- for (uint32 i = 0; i < track_entries_size_; ++i) {
- if (track_entries[i]->number() == track_num) {
- track_num++;
- exit = false;
- break;
- }
- }
- } while (!exit);
- }
- track->set_number(track_num);
-
- track_entries_ = track_entries;
- track_entries_[track_entries_size_] = track;
- track_entries_size_ = count;
- return true;
-}
-
-const Track* Tracks::GetTrackByIndex(uint32 index) const {
- if (track_entries_ == NULL)
- return NULL;
-
- if (index >= track_entries_size_)
- return NULL;
-
- return track_entries_[index];
-}
-
-Track* Tracks::GetTrackByNumber(uint64 track_number) const {
- const int32 count = track_entries_size();
- for (int32 i = 0; i < count; ++i) {
- if (track_entries_[i]->number() == track_number)
- return track_entries_[i];
- }
-
- return NULL;
-}
-
-bool Tracks::TrackIsAudio(uint64 track_number) const {
- const Track* const track = GetTrackByNumber(track_number);
-
- if (track->type() == kAudio)
- return true;
-
- return false;
-}
-
-bool Tracks::TrackIsVideo(uint64 track_number) const {
- const Track* const track = GetTrackByNumber(track_number);
-
- if (track->type() == kVideo)
- return true;
-
- return false;
-}
-
-bool Tracks::Write(IMkvWriter* writer) const {
- uint64 size = 0;
- const int32 count = track_entries_size();
- for (int32 i = 0; i < count; ++i) {
- const Track* const track = GetTrackByIndex(i);
-
- if (!track)
- return false;
-
- size += track->Size();
- }
-
- if (!WriteEbmlMasterElement(writer, kMkvTracks, size))
- return false;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- for (int32 i = 0; i < count; ++i) {
- const Track* const track = GetTrackByIndex(i);
- if (!track->Write(writer))
- return false;
- }
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(size))
- return false;
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Chapter Class
-
-bool Chapter::set_id(const char* id) {
- return StrCpy(id, &id_);
-}
-
-void Chapter::set_time(const Segment& segment,
- uint64 start_ns,
- uint64 end_ns) {
- const SegmentInfo* const info = segment.GetSegmentInfo();
- const uint64 timecode_scale = info->timecode_scale();
- start_timecode_ = start_ns / timecode_scale;
- end_timecode_ = end_ns / timecode_scale;
-}
-
-bool Chapter::add_string(const char* title,
- const char* language,
- const char* country) {
- if (!ExpandDisplaysArray())
- return false;
-
- Display& d = displays_[displays_count_++];
- d.Init();
-
- if (!d.set_title(title))
- return false;
-
- if (!d.set_language(language))
- return false;
-
- if (!d.set_country(country))
- return false;
-
- return true;
-}
-
-Chapter::Chapter() {
- // This ctor only constructs the object. Proper initialization is
- // done in Init() (called in Chapters::AddChapter()). The only
- // reason we bother implementing this ctor is because we had to
- // declare it as private (along with the dtor), in order to prevent
- // clients from creating Chapter instances (a privelege we grant
- // only to the Chapters class). Doing no initialization here also
- // means that creating arrays of chapter objects is more efficient,
- // because we only initialize each new chapter object as it becomes
- // active on the array.
-}
-
-Chapter::~Chapter() {
-}
-
-void Chapter::Init(unsigned int* seed) {
- id_ = NULL;
- displays_ = NULL;
- displays_size_ = 0;
- displays_count_ = 0;
- uid_ = MakeUID(seed);
-}
-
-void Chapter::ShallowCopy(Chapter* dst) const {
- dst->id_ = id_;
- dst->start_timecode_ = start_timecode_;
- dst->end_timecode_ = end_timecode_;
- dst->uid_ = uid_;
- dst->displays_ = displays_;
- dst->displays_size_ = displays_size_;
- dst->displays_count_ = displays_count_;
-}
-
-void Chapter::Clear() {
- StrCpy(NULL, &id_);
-
- while (displays_count_ > 0) {
- Display& d = displays_[--displays_count_];
- d.Clear();
- }
-
- delete [] displays_;
- displays_ = NULL;
-
- displays_size_ = 0;
-}
-
-bool Chapter::ExpandDisplaysArray() {
- if (displays_size_ > displays_count_)
- return true; // nothing to do yet
-
- const int size = (displays_size_ == 0) ? 1 : 2 * displays_size_;
-
- Display* const displays = new (std::nothrow) Display[size]; // NOLINT
- if (displays == NULL)
- return false;
-
- for (int idx = 0; idx < displays_count_; ++idx) {
- displays[idx] = displays_[idx]; // shallow copy
- }
-
- delete [] displays_;
-
- displays_ = displays;
- displays_size_ = size;
-
- return true;
-}
-
-uint64 Chapter::WriteAtom(IMkvWriter* writer) const {
- uint64 payload_size =
- EbmlElementSize(kMkvChapterStringUID, id_) +
- EbmlElementSize(kMkvChapterUID, uid_) +
- EbmlElementSize(kMkvChapterTimeStart, start_timecode_) +
- EbmlElementSize(kMkvChapterTimeEnd, end_timecode_);
-
- for (int idx = 0; idx < displays_count_; ++idx) {
- const Display& d = displays_[idx];
- payload_size += d.WriteDisplay(NULL);
- }
-
- const uint64 atom_size =
- EbmlMasterElementSize(kMkvChapterAtom, payload_size) +
- payload_size;
-
- if (writer == NULL)
- return atom_size;
-
- const int64 start = writer->Position();
-
- if (!WriteEbmlMasterElement(writer, kMkvChapterAtom, payload_size))
- return 0;
-
- if (!WriteEbmlElement(writer, kMkvChapterStringUID, id_))
- return 0;
-
- if (!WriteEbmlElement(writer, kMkvChapterUID, uid_))
- return 0;
-
- if (!WriteEbmlElement(writer, kMkvChapterTimeStart, start_timecode_))
- return 0;
-
- if (!WriteEbmlElement(writer, kMkvChapterTimeEnd, end_timecode_))
- return 0;
-
- for (int idx = 0; idx < displays_count_; ++idx) {
- const Display& d = displays_[idx];
-
- if (!d.WriteDisplay(writer))
- return 0;
- }
-
- const int64 stop = writer->Position();
-
- if (stop >= start && uint64(stop - start) != atom_size)
- return 0;
-
- return atom_size;
-}
-
-void Chapter::Display::Init() {
- title_ = NULL;
- language_ = NULL;
- country_ = NULL;
-}
-
-void Chapter::Display::Clear() {
- StrCpy(NULL, &title_);
- StrCpy(NULL, &language_);
- StrCpy(NULL, &country_);
-}
-
-bool Chapter::Display::set_title(const char* title) {
- return StrCpy(title, &title_);
-}
-
-bool Chapter::Display::set_language(const char* language) {
- return StrCpy(language, &language_);
-}
-
-bool Chapter::Display::set_country(const char* country) {
- return StrCpy(country, &country_);
-}
-
-uint64 Chapter::Display::WriteDisplay(IMkvWriter* writer) const {
- uint64 payload_size = EbmlElementSize(kMkvChapString, title_);
-
- if (language_)
- payload_size += EbmlElementSize(kMkvChapLanguage, language_);
-
- if (country_)
- payload_size += EbmlElementSize(kMkvChapCountry, country_);
-
- const uint64 display_size =
- EbmlMasterElementSize(kMkvChapterDisplay, payload_size) +
- payload_size;
-
- if (writer == NULL)
- return display_size;
-
- const int64 start = writer->Position();
-
- if (!WriteEbmlMasterElement(writer, kMkvChapterDisplay, payload_size))
- return 0;
-
- if (!WriteEbmlElement(writer, kMkvChapString, title_))
- return 0;
-
- if (language_) {
- if (!WriteEbmlElement(writer, kMkvChapLanguage, language_))
- return 0;
- }
-
- if (country_) {
- if (!WriteEbmlElement(writer, kMkvChapCountry, country_))
- return 0;
- }
-
- const int64 stop = writer->Position();
-
- if (stop >= start && uint64(stop - start) != display_size)
- return 0;
-
- return display_size;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Chapters Class
-
-Chapters::Chapters()
- : chapters_size_(0),
- chapters_count_(0),
- chapters_(NULL) {
-}
-
-Chapters::~Chapters() {
- while (chapters_count_ > 0) {
- Chapter& chapter = chapters_[--chapters_count_];
- chapter.Clear();
- }
-
- delete [] chapters_;
- chapters_ = NULL;
-}
-
-int Chapters::Count() const {
- return chapters_count_;
-}
-
-Chapter* Chapters::AddChapter(unsigned int* seed) {
- if (!ExpandChaptersArray())
- return NULL;
-
- Chapter& chapter = chapters_[chapters_count_++];
- chapter.Init(seed);
-
- return &chapter;
-}
-
-bool Chapters::Write(IMkvWriter* writer) const {
- if (writer == NULL)
- return false;
-
- const uint64 payload_size = WriteEdition(NULL); // return size only
-
- if (!WriteEbmlMasterElement(writer, kMkvChapters, payload_size))
- return false;
-
- const int64 start = writer->Position();
-
- if (WriteEdition(writer) == 0) // error
- return false;
-
- const int64 stop = writer->Position();
-
- if (stop >= start && uint64(stop - start) != payload_size)
- return false;
-
- return true;
-}
-
-bool Chapters::ExpandChaptersArray() {
- if (chapters_size_ > chapters_count_)
- return true; // nothing to do yet
-
- const int size = (chapters_size_ == 0) ? 1 : 2 * chapters_size_;
-
- Chapter* const chapters = new (std::nothrow) Chapter[size]; // NOLINT
- if (chapters == NULL)
- return false;
-
- for (int idx = 0; idx < chapters_count_; ++idx) {
- const Chapter& src = chapters_[idx];
- Chapter* const dst = chapters + idx;
- src.ShallowCopy(dst);
- }
-
- delete [] chapters_;
-
- chapters_ = chapters;
- chapters_size_ = size;
-
- return true;
-}
-
-uint64 Chapters::WriteEdition(IMkvWriter* writer) const {
- uint64 payload_size = 0;
-
- for (int idx = 0; idx < chapters_count_; ++idx) {
- const Chapter& chapter = chapters_[idx];
- payload_size += chapter.WriteAtom(NULL);
- }
-
- const uint64 edition_size =
- EbmlMasterElementSize(kMkvEditionEntry, payload_size) +
- payload_size;
-
- if (writer == NULL) // return size only
- return edition_size;
-
- const int64 start = writer->Position();
-
- if (!WriteEbmlMasterElement(writer, kMkvEditionEntry, payload_size))
- return 0; // error
-
- for (int idx = 0; idx < chapters_count_; ++idx) {
- const Chapter& chapter = chapters_[idx];
-
- const uint64 chapter_size = chapter.WriteAtom(writer);
- if (chapter_size == 0) // error
- return 0;
- }
-
- const int64 stop = writer->Position();
-
- if (stop >= start && uint64(stop - start) != edition_size)
- return 0;
-
- return edition_size;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Cluster class
-
-Cluster::Cluster(uint64 timecode, int64 cues_pos)
- : blocks_added_(0),
- finalized_(false),
- header_written_(false),
- payload_size_(0),
- position_for_cues_(cues_pos),
- size_position_(-1),
- timecode_(timecode),
- writer_(NULL) {
-}
-
-Cluster::~Cluster() {
-}
-
-bool Cluster::Init(IMkvWriter* ptr_writer) {
- if (!ptr_writer) {
- return false;
- }
- writer_ = ptr_writer;
- return true;
-}
-
-bool Cluster::AddFrame(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 abs_timecode,
- bool is_key) {
- return DoWriteBlock(frame,
- length,
- track_number,
- abs_timecode,
- is_key ? 1 : 0,
- &WriteSimpleBlock);
-}
-
-bool Cluster::AddFrameWithAdditional(const uint8* frame,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- uint64 abs_timecode,
- bool is_key) {
- return DoWriteBlockWithAdditional(frame,
- length,
- additional,
- additional_length,
- add_id,
- track_number,
- abs_timecode,
- is_key ? 1 : 0,
- &WriteBlockWithAdditional);
-}
-
-bool Cluster::AddFrameWithDiscardPadding(const uint8* frame,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- uint64 abs_timecode,
- bool is_key) {
- return DoWriteBlockWithDiscardPadding(frame,
- length,
- discard_padding,
- track_number,
- abs_timecode,
- is_key ? 1 : 0,
- &WriteBlockWithDiscardPadding);
-}
-
-bool Cluster::AddMetadata(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 abs_timecode,
- uint64 duration_timecode) {
- return DoWriteBlock(frame,
- length,
- track_number,
- abs_timecode,
- duration_timecode,
- &WriteMetadataBlock);
-}
-
-void Cluster::AddPayloadSize(uint64 size) {
- payload_size_ += size;
-}
-
-bool Cluster::Finalize() {
- if (!writer_ || finalized_ || size_position_ == -1)
- return false;
-
- if (writer_->Seekable()) {
- const int64 pos = writer_->Position();
-
- if (writer_->Position(size_position_))
- return false;
-
- if (WriteUIntSize(writer_, payload_size(), 8))
- return false;
-
- if (writer_->Position(pos))
- return false;
- }
-
- finalized_ = true;
-
- return true;
-}
-
-uint64 Cluster::Size() const {
- const uint64 element_size =
- EbmlMasterElementSize(kMkvCluster,
- 0xFFFFFFFFFFFFFFFFULL) + payload_size_;
- return element_size;
-}
-
-template <typename Type>
-bool Cluster::PreWriteBlock(Type* write_function) {
- if (write_function == NULL)
- return false;
-
- if (finalized_)
- return false;
-
- if (!header_written_) {
- if (!WriteClusterHeader())
- return false;
- }
-
- return true;
-}
-
-void Cluster::PostWriteBlock(uint64 element_size) {
- AddPayloadSize(element_size);
- ++blocks_added_;
-}
-
-bool Cluster::IsValidTrackNumber(uint64 track_number) const {
- return (track_number > 0 && track_number <= 0x7E);
-}
-
-int64 Cluster::GetRelativeTimecode(int64 abs_timecode) const {
- const int64 cluster_timecode = this->Cluster::timecode();
- const int64 rel_timecode =
- static_cast<int64>(abs_timecode) - cluster_timecode;
-
- if (rel_timecode < 0 || rel_timecode > kMaxBlockTimecode)
- return -1;
-
- return rel_timecode;
-}
-
-bool Cluster::DoWriteBlock(
- const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 abs_timecode,
- uint64 generic_arg,
- WriteBlock write_block) {
- if (frame == NULL || length == 0)
- return false;
-
- if (!IsValidTrackNumber(track_number))
- return false;
-
- const int64 rel_timecode = GetRelativeTimecode(abs_timecode);
- if (rel_timecode < 0)
- return false;
-
- if (!PreWriteBlock(write_block))
- return false;
-
- const uint64 element_size = (*write_block)(writer_,
- frame,
- length,
- track_number,
- rel_timecode,
- generic_arg);
- if (element_size == 0)
- return false;
-
- PostWriteBlock(element_size);
- return true;
-}
-
-bool Cluster::DoWriteBlockWithAdditional(
- const uint8* frame,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- uint64 abs_timecode,
- uint64 generic_arg,
- WriteBlockAdditional write_block) {
- if (frame == NULL || length == 0 ||
- additional == NULL || additional_length == 0)
- return false;
-
- if (!IsValidTrackNumber(track_number))
- return false;
-
- const int64 rel_timecode = GetRelativeTimecode(abs_timecode);
- if (rel_timecode < 0)
- return false;
-
- if (!PreWriteBlock(write_block))
- return false;
-
- const uint64 element_size = (*write_block)(writer_,
- frame,
- length,
- additional,
- additional_length,
- add_id,
- track_number,
- rel_timecode,
- generic_arg);
- if (element_size == 0)
- return false;
-
- PostWriteBlock(element_size);
- return true;
-}
-
-bool Cluster::DoWriteBlockWithDiscardPadding(
- const uint8* frame,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- uint64 abs_timecode,
- uint64 generic_arg,
- WriteBlockDiscardPadding write_block) {
- if (frame == NULL || length == 0 || discard_padding <= 0)
- return false;
-
- if (!IsValidTrackNumber(track_number))
- return false;
-
- const int64 rel_timecode = GetRelativeTimecode(abs_timecode);
- if (rel_timecode < 0)
- return false;
-
- if (!PreWriteBlock(write_block))
- return false;
-
- const uint64 element_size = (*write_block)(writer_,
- frame,
- length,
- discard_padding,
- track_number,
- rel_timecode,
- generic_arg);
- if (element_size == 0)
- return false;
-
- PostWriteBlock(element_size);
- return true;
-}
-
-bool Cluster::WriteClusterHeader() {
- if (finalized_)
- return false;
-
- if (WriteID(writer_, kMkvCluster))
- return false;
-
- // Save for later.
- size_position_ = writer_->Position();
-
- // Write "unknown" (EBML coded -1) as cluster size value. We need to write 8
- // bytes because we do not know how big our cluster will be.
- if (SerializeInt(writer_, kEbmlUnknownValue, 8))
- return false;
-
- if (!WriteEbmlElement(writer_, kMkvTimecode, timecode()))
- return false;
- AddPayloadSize(EbmlElementSize(kMkvTimecode, timecode()));
- header_written_ = true;
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// SeekHead Class
-
-SeekHead::SeekHead() : start_pos_(0ULL) {
- for (int32 i = 0; i < kSeekEntryCount; ++i) {
- seek_entry_id_[i] = 0;
- seek_entry_pos_[i] = 0;
- }
-}
-
-SeekHead::~SeekHead() {
-}
-
-bool SeekHead::Finalize(IMkvWriter* writer) const {
- if (writer->Seekable()) {
- if (start_pos_ == -1)
- return false;
-
- uint64 payload_size = 0;
- uint64 entry_size[kSeekEntryCount];
-
- for (int32 i = 0; i < kSeekEntryCount; ++i) {
- if (seek_entry_id_[i] != 0) {
- entry_size[i] = EbmlElementSize(
- kMkvSeekID,
- static_cast<uint64>(seek_entry_id_[i]));
- entry_size[i] += EbmlElementSize(kMkvSeekPosition, seek_entry_pos_[i]);
-
- payload_size += EbmlMasterElementSize(kMkvSeek, entry_size[i]) +
- entry_size[i];
- }
- }
-
- // No SeekHead elements
- if (payload_size == 0)
- return true;
-
- const int64 pos = writer->Position();
- if (writer->Position(start_pos_))
- return false;
-
- if (!WriteEbmlMasterElement(writer, kMkvSeekHead, payload_size))
- return false;
-
- for (int32 i = 0; i < kSeekEntryCount; ++i) {
- if (seek_entry_id_[i] != 0) {
- if (!WriteEbmlMasterElement(writer, kMkvSeek, entry_size[i]))
- return false;
-
- if (!WriteEbmlElement(writer,
- kMkvSeekID,
- static_cast<uint64>(seek_entry_id_[i])))
- return false;
-
- if (!WriteEbmlElement(writer, kMkvSeekPosition, seek_entry_pos_[i]))
- return false;
- }
- }
-
- const uint64 total_entry_size = kSeekEntryCount * MaxEntrySize();
- const uint64 total_size =
- EbmlMasterElementSize(kMkvSeekHead,
- total_entry_size) + total_entry_size;
- const int64 size_left = total_size - (writer->Position() - start_pos_);
-
- const uint64 bytes_written = WriteVoidElement(writer, size_left);
- if (!bytes_written)
- return false;
-
- if (writer->Position(pos))
- return false;
- }
-
- return true;
-}
-
-bool SeekHead::Write(IMkvWriter* writer) {
- const uint64 entry_size = kSeekEntryCount * MaxEntrySize();
- const uint64 size = EbmlMasterElementSize(kMkvSeekHead, entry_size);
-
- start_pos_ = writer->Position();
-
- const uint64 bytes_written = WriteVoidElement(writer, size + entry_size);
- if (!bytes_written)
- return false;
-
- return true;
-}
-
-bool SeekHead::AddSeekEntry(uint32 id, uint64 pos) {
- for (int32 i = 0; i < kSeekEntryCount; ++i) {
- if (seek_entry_id_[i] == 0) {
- seek_entry_id_[i] = id;
- seek_entry_pos_[i] = pos;
- return true;
- }
- }
- return false;
-}
-
-uint32 SeekHead::GetId(int index) const {
- if (index < 0 || index >= kSeekEntryCount)
- return UINT_MAX;
- return seek_entry_id_[index];
-}
-
-uint64 SeekHead::GetPosition(int index) const {
- if (index < 0 || index >= kSeekEntryCount)
- return ULLONG_MAX;
- return seek_entry_pos_[index];
-}
-
-bool SeekHead::SetSeekEntry(int index, uint32 id, uint64 position) {
- if (index < 0 || index >= kSeekEntryCount)
- return false;
- seek_entry_id_[index] = id;
- seek_entry_pos_[index] = position;
- return true;
-}
-
-uint64 SeekHead::MaxEntrySize() const {
- const uint64 max_entry_payload_size =
- EbmlElementSize(kMkvSeekID, 0xffffffffULL) +
- EbmlElementSize(kMkvSeekPosition, 0xffffffffffffffffULL);
- const uint64 max_entry_size =
- EbmlMasterElementSize(kMkvSeek, max_entry_payload_size) +
- max_entry_payload_size;
-
- return max_entry_size;
-}
-
-///////////////////////////////////////////////////////////////
-//
-// SegmentInfo Class
-
-SegmentInfo::SegmentInfo()
- : duration_(-1.0),
- muxing_app_(NULL),
- timecode_scale_(1000000ULL),
- writing_app_(NULL),
- duration_pos_(-1) {
-}
-
-SegmentInfo::~SegmentInfo() {
- delete [] muxing_app_;
- delete [] writing_app_;
-}
-
-bool SegmentInfo::Init() {
- int32 major;
- int32 minor;
- int32 build;
- int32 revision;
- GetVersion(&major, &minor, &build, &revision);
- char temp[256];
-#ifdef _MSC_VER
- sprintf_s(temp,
- sizeof(temp)/sizeof(temp[0]),
- "libwebm-%d.%d.%d.%d",
- major,
- minor,
- build,
- revision);
-#else
- snprintf(temp,
- sizeof(temp)/sizeof(temp[0]),
- "libwebm-%d.%d.%d.%d",
- major,
- minor,
- build,
- revision);
-#endif
-
- const size_t app_len = strlen(temp) + 1;
-
- delete [] muxing_app_;
-
- muxing_app_ = new (std::nothrow) char[app_len]; // NOLINT
- if (!muxing_app_)
- return false;
-
-#ifdef _MSC_VER
- strcpy_s(muxing_app_, app_len, temp);
-#else
- strcpy(muxing_app_, temp);
-#endif
-
- set_writing_app(temp);
- if (!writing_app_)
- return false;
- return true;
-}
-
-bool SegmentInfo::Finalize(IMkvWriter* writer) const {
- if (!writer)
- return false;
-
- if (duration_ > 0.0) {
- if (writer->Seekable()) {
- if (duration_pos_ == -1)
- return false;
-
- const int64 pos = writer->Position();
-
- if (writer->Position(duration_pos_))
- return false;
-
- if (!WriteEbmlElement(writer,
- kMkvDuration,
- static_cast<float>(duration_)))
- return false;
-
- if (writer->Position(pos))
- return false;
- }
- }
-
- return true;
-}
-
-bool SegmentInfo::Write(IMkvWriter* writer) {
- if (!writer || !muxing_app_ || !writing_app_)
- return false;
-
- uint64 size = EbmlElementSize(kMkvTimecodeScale, timecode_scale_);
- if (duration_ > 0.0)
- size += EbmlElementSize(kMkvDuration, static_cast<float>(duration_));
- size += EbmlElementSize(kMkvMuxingApp, muxing_app_);
- size += EbmlElementSize(kMkvWritingApp, writing_app_);
-
- if (!WriteEbmlMasterElement(writer, kMkvInfo, size))
- return false;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return false;
-
- if (!WriteEbmlElement(writer, kMkvTimecodeScale, timecode_scale_))
- return false;
-
- if (duration_ > 0.0) {
- // Save for later
- duration_pos_ = writer->Position();
-
- if (!WriteEbmlElement(writer, kMkvDuration, static_cast<float>(duration_)))
- return false;
- }
-
- if (!WriteEbmlElement(writer, kMkvMuxingApp, muxing_app_))
- return false;
- if (!WriteEbmlElement(writer, kMkvWritingApp, writing_app_))
- return false;
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(size))
- return false;
-
- return true;
-}
-
-void SegmentInfo::set_muxing_app(const char* app) {
- if (app) {
- const size_t length = strlen(app) + 1;
- char* temp_str = new (std::nothrow) char[length]; // NOLINT
- if (!temp_str)
- return;
-
-#ifdef _MSC_VER
- strcpy_s(temp_str, length, app);
-#else
- strcpy(temp_str, app);
-#endif
-
- delete [] muxing_app_;
- muxing_app_ = temp_str;
- }
-}
-
-void SegmentInfo::set_writing_app(const char* app) {
- if (app) {
- const size_t length = strlen(app) + 1;
- char* temp_str = new (std::nothrow) char[length]; // NOLINT
- if (!temp_str)
- return;
-
-#ifdef _MSC_VER
- strcpy_s(temp_str, length, app);
-#else
- strcpy(temp_str, app);
-#endif
-
- delete [] writing_app_;
- writing_app_ = temp_str;
- }
-}
-
-///////////////////////////////////////////////////////////////
-//
-// Segment Class
-
-Segment::Segment()
- : chunk_count_(0),
- chunk_name_(NULL),
- chunk_writer_cluster_(NULL),
- chunk_writer_cues_(NULL),
- chunk_writer_header_(NULL),
- chunking_(false),
- chunking_base_name_(NULL),
- cluster_list_(NULL),
- cluster_list_capacity_(0),
- cluster_list_size_(0),
- cues_position_(kAfterClusters),
- cues_track_(0),
- force_new_cluster_(false),
- frames_(NULL),
- frames_capacity_(0),
- frames_size_(0),
- has_video_(false),
- header_written_(false),
- last_block_duration_(0),
- last_timestamp_(0),
- max_cluster_duration_(kDefaultMaxClusterDuration),
- max_cluster_size_(0),
- mode_(kFile),
- new_cuepoint_(false),
- output_cues_(true),
- payload_pos_(0),
- size_position_(0),
- writer_cluster_(NULL),
- writer_cues_(NULL),
- writer_header_(NULL) {
- const time_t curr_time = time(NULL);
- seed_ = static_cast<unsigned int>(curr_time);
-#ifdef _WIN32
- srand(seed_);
-#endif
-}
-
-Segment::~Segment() {
- if (cluster_list_) {
- for (int32 i = 0; i < cluster_list_size_; ++i) {
- Cluster* const cluster = cluster_list_[i];
- delete cluster;
- }
- delete [] cluster_list_;
- }
-
- if (frames_) {
- for (int32 i = 0; i < frames_size_; ++i) {
- Frame* const frame = frames_[i];
- delete frame;
- }
- delete [] frames_;
- }
-
- delete [] chunk_name_;
- delete [] chunking_base_name_;
-
- if (chunk_writer_cluster_) {
- chunk_writer_cluster_->Close();
- delete chunk_writer_cluster_;
- }
- if (chunk_writer_cues_) {
- chunk_writer_cues_->Close();
- delete chunk_writer_cues_;
- }
- if (chunk_writer_header_) {
- chunk_writer_header_->Close();
- delete chunk_writer_header_;
- }
-}
-
-void Segment::MoveCuesBeforeClustersHelper(uint64 diff,
- int32 index,
- uint64* cues_size) {
- const uint64 old_cues_size = *cues_size;
- CuePoint* const cue_point = cues_.GetCueByIndex(index);
- if (cue_point == NULL)
- return;
- const uint64 old_cue_point_size = cue_point->Size();
- const uint64 cluster_pos = cue_point->cluster_pos() + diff;
- cue_point->set_cluster_pos(cluster_pos); // update the new cluster position
- // New size of the cue is computed as follows
- // Let a = current size of Cues Element
- // Let b = Difference in Cue Point's size after this pass
- // Let c = Difference in length of Cues Element's size
- // (This is computed as CodedSize(a + b) - CodedSize(a)
- // Let d = a + b + c. Now d is the new size of the Cues element which is
- // passed on to the next recursive call.
- const uint64 cue_point_size_diff = cue_point->Size() - old_cue_point_size;
- const uint64 cue_size_diff = GetCodedUIntSize(*cues_size +
- cue_point_size_diff) -
- GetCodedUIntSize(*cues_size);
- *cues_size += cue_point_size_diff + cue_size_diff;
- diff = *cues_size - old_cues_size;
- if (diff > 0) {
- for (int32 i = 0; i < cues_.cue_entries_size(); ++i) {
- MoveCuesBeforeClustersHelper(diff, i, cues_size);
- }
- }
-}
-
-void Segment::MoveCuesBeforeClusters() {
- const uint64 current_cue_size = cues_.Size();
- uint64 cue_size = current_cue_size;
- for (int32 i = 0; i < cues_.cue_entries_size(); i++)
- MoveCuesBeforeClustersHelper(current_cue_size, i, &cue_size);
-
- // Adjust the Seek Entry to reflect the change in position
- // of Cluster and Cues
- int32 cluster_index = 0;
- int32 cues_index = 0;
- for (int32 i = 0; i < SeekHead::kSeekEntryCount; ++i) {
- if (seek_head_.GetId(i) == kMkvCluster)
- cluster_index = i;
- if (seek_head_.GetId(i) == kMkvCues)
- cues_index = i;
- }
- seek_head_.SetSeekEntry(cues_index, kMkvCues,
- seek_head_.GetPosition(cluster_index));
- seek_head_.SetSeekEntry(cluster_index, kMkvCluster,
- cues_.Size() + seek_head_.GetPosition(cues_index));
-}
-
-bool Segment::Init(IMkvWriter* ptr_writer) {
- if (!ptr_writer) {
- return false;
- }
- writer_cluster_ = ptr_writer;
- writer_cues_ = ptr_writer;
- writer_header_ = ptr_writer;
- return segment_info_.Init();
-}
-
-bool Segment::CopyAndMoveCuesBeforeClusters(mkvparser::IMkvReader* reader,
- IMkvWriter* writer) {
- if (!writer->Seekable() || chunking_)
- return false;
- const int64 cluster_offset = cluster_list_[0]->size_position() -
- GetUIntSize(kMkvCluster);
-
- // Copy the headers.
- if (!ChunkedCopy(reader, writer, 0, cluster_offset))
- return false;
-
- // Recompute cue positions and seek entries.
- MoveCuesBeforeClusters();
-
- // Write cues and seek entries.
- // TODO(vigneshv): As of now, it's safe to call seek_head_.Finalize() for the
- // second time with a different writer object. But the name Finalize() doesn't
- // indicate something we want to call more than once. So consider renaming it
- // to write() or some such.
- if (!cues_.Write(writer) || !seek_head_.Finalize(writer))
- return false;
-
- // Copy the Clusters.
- if (!ChunkedCopy(reader, writer, cluster_offset,
- cluster_end_offset_ - cluster_offset))
- return false;
-
- // Update the Segment size in case the Cues size has changed.
- const int64 pos = writer->Position();
- const int64 segment_size = writer->Position() - payload_pos_;
- if (writer->Position(size_position_) ||
- WriteUIntSize(writer, segment_size, 8) ||
- writer->Position(pos))
- return false;
- return true;
-}
-
-bool Segment::Finalize() {
- if (WriteFramesAll() < 0)
- return false;
-
- if (mode_ == kFile) {
- if (cluster_list_size_ > 0) {
- // Update last cluster's size
- Cluster* const old_cluster = cluster_list_[cluster_list_size_-1];
-
- if (!old_cluster || !old_cluster->Finalize())
- return false;
- }
-
- if (chunking_ && chunk_writer_cluster_) {
- chunk_writer_cluster_->Close();
- chunk_count_++;
- }
-
- const double duration =
- (static_cast<double>(last_timestamp_) + last_block_duration_) /
- segment_info_.timecode_scale();
- segment_info_.set_duration(duration);
- if (!segment_info_.Finalize(writer_header_))
- return false;
-
- if (output_cues_)
- if (!seek_head_.AddSeekEntry(kMkvCues, MaxOffset()))
- return false;
-
- if (chunking_) {
- if (!chunk_writer_cues_)
- return false;
-
- char* name = NULL;
- if (!UpdateChunkName("cues", &name))
- return false;
-
- const bool cues_open = chunk_writer_cues_->Open(name);
- delete [] name;
- if (!cues_open)
- return false;
- }
-
- cluster_end_offset_ = writer_cluster_->Position();
-
- // Write the seek headers and cues
- if (output_cues_)
- if (!cues_.Write(writer_cues_))
- return false;
-
- if (!seek_head_.Finalize(writer_header_))
- return false;
-
- if (writer_header_->Seekable()) {
- if (size_position_ == -1)
- return false;
-
- const int64 pos = writer_header_->Position();
- const int64 segment_size = MaxOffset();
-
- if (segment_size < 1)
- return false;
-
- if (writer_header_->Position(size_position_))
- return false;
-
- if (WriteUIntSize(writer_header_, segment_size, 8))
- return false;
-
- if (writer_header_->Position(pos))
- return false;
- }
-
- if (chunking_) {
- // Do not close any writers until the segment size has been written,
- // otherwise the size may be off.
- if (!chunk_writer_cues_ || !chunk_writer_header_)
- return false;
-
- chunk_writer_cues_->Close();
- chunk_writer_header_->Close();
- }
- }
-
- return true;
-}
-
-Track* Segment::AddTrack(int32 number) {
- Track* const track = new (std::nothrow) Track(&seed_); // NOLINT
-
- if (!track)
- return NULL;
-
- if (!tracks_.AddTrack(track, number)) {
- delete track;
- return NULL;
- }
-
- return track;
-}
-
-Chapter* Segment::AddChapter() {
- return chapters_.AddChapter(&seed_);
-}
-
-uint64 Segment::AddVideoTrack(int32 width, int32 height, int32 number) {
- VideoTrack* const track = new (std::nothrow) VideoTrack(&seed_); // NOLINT
- if (!track)
- return 0;
-
- track->set_type(Tracks::kVideo);
- track->set_codec_id(Tracks::kVp8CodecId);
- track->set_width(width);
- track->set_height(height);
-
- tracks_.AddTrack(track, number);
- has_video_ = true;
-
- return track->number();
-}
-
-bool Segment::AddCuePoint(uint64 timestamp, uint64 track) {
- if (cluster_list_size_ < 1)
- return false;
-
- const Cluster* const cluster = cluster_list_[cluster_list_size_-1];
- if (!cluster)
- return false;
-
- CuePoint* const cue = new (std::nothrow) CuePoint(); // NOLINT
- if (!cue)
- return false;
-
- cue->set_time(timestamp / segment_info_.timecode_scale());
- cue->set_block_number(cluster->blocks_added());
- cue->set_cluster_pos(cluster->position_for_cues());
- cue->set_track(track);
- if (!cues_.AddCue(cue))
- return false;
-
- new_cuepoint_ = false;
- return true;
-}
-
-uint64 Segment::AddAudioTrack(int32 sample_rate,
- int32 channels,
- int32 number) {
- AudioTrack* const track = new (std::nothrow) AudioTrack(&seed_); // NOLINT
- if (!track)
- return 0;
-
- track->set_type(Tracks::kAudio);
- track->set_codec_id(Tracks::kVorbisCodecId);
- track->set_sample_rate(sample_rate);
- track->set_channels(channels);
-
- tracks_.AddTrack(track, number);
-
- return track->number();
-}
-
-bool Segment::AddFrame(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 timestamp,
- bool is_key) {
- if (!frame)
- return false;
-
- if (!CheckHeaderInfo())
- return false;
-
- // Check for non-monotonically increasing timestamps.
- if (timestamp < last_timestamp_)
- return false;
-
- // If the segment has a video track hold onto audio frames to make sure the
- // audio that is associated with the start time of a video key-frame is
- // muxed into the same cluster.
- if (has_video_ && tracks_.TrackIsAudio(track_number) && !force_new_cluster_) {
- Frame* const new_frame = new (std::nothrow) Frame();
- if (new_frame == NULL || !new_frame->Init(frame, length))
- return false;
- new_frame->set_track_number(track_number);
- new_frame->set_timestamp(timestamp);
- new_frame->set_is_key(is_key);
-
- if (!QueueFrame(new_frame))
- return false;
-
- return true;
- }
-
- if (!DoNewClusterProcessing(track_number, timestamp, is_key))
- return false;
-
- if (cluster_list_size_ < 1)
- return false;
-
- Cluster* const cluster = cluster_list_[cluster_list_size_ - 1];
- if (!cluster)
- return false;
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
- const uint64 abs_timecode = timestamp / timecode_scale;
-
- if (!cluster->AddFrame(frame,
- length,
- track_number,
- abs_timecode,
- is_key))
- return false;
-
- if (new_cuepoint_ && cues_track_ == track_number) {
- if (!AddCuePoint(timestamp, cues_track_))
- return false;
- }
-
- if (timestamp > last_timestamp_)
- last_timestamp_ = timestamp;
-
- return true;
-}
-
-bool Segment::AddFrameWithAdditional(const uint8* frame,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- uint64 timestamp,
- bool is_key) {
- if (frame == NULL || additional == NULL)
- return false;
-
- if (!CheckHeaderInfo())
- return false;
-
- // Check for non-monotonically increasing timestamps.
- if (timestamp < last_timestamp_)
- return false;
-
- // If the segment has a video track hold onto audio frames to make sure the
- // audio that is associated with the start time of a video key-frame is
- // muxed into the same cluster.
- if (has_video_ && tracks_.TrackIsAudio(track_number) && !force_new_cluster_) {
- Frame* const new_frame = new (std::nothrow) Frame();
- if (new_frame == NULL || !new_frame->Init(frame, length))
- return false;
- new_frame->set_track_number(track_number);
- new_frame->set_timestamp(timestamp);
- new_frame->set_is_key(is_key);
-
- if (!QueueFrame(new_frame))
- return false;
-
- return true;
- }
-
- if (!DoNewClusterProcessing(track_number, timestamp, is_key))
- return false;
-
- if (cluster_list_size_ < 1)
- return false;
-
- Cluster* const cluster = cluster_list_[cluster_list_size_ - 1];
- if (cluster == NULL)
- return false;
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
- const uint64 abs_timecode = timestamp / timecode_scale;
-
- if (!cluster->AddFrameWithAdditional(frame,
- length,
- additional,
- additional_length,
- add_id,
- track_number,
- abs_timecode,
- is_key))
- return false;
-
- if (new_cuepoint_ && cues_track_ == track_number) {
- if (!AddCuePoint(timestamp, cues_track_))
- return false;
- }
-
- if (timestamp > last_timestamp_)
- last_timestamp_ = timestamp;
-
- return true;
-}
-
-bool Segment::AddFrameWithDiscardPadding(const uint8* frame,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- uint64 timestamp,
- bool is_key) {
- if (frame == NULL || discard_padding <= 0)
- return false;
-
- if (!CheckHeaderInfo())
- return false;
-
- // Check for non-monotonically increasing timestamps.
- if (timestamp < last_timestamp_)
- return false;
-
- // If the segment has a video track hold onto audio frames to make sure the
- // audio that is associated with the start time of a video key-frame is
- // muxed into the same cluster.
- if (has_video_ && tracks_.TrackIsAudio(track_number) && !force_new_cluster_) {
- Frame* const new_frame = new (std::nothrow) Frame();
- if (new_frame == NULL || !new_frame->Init(frame, length))
- return false;
- new_frame->set_track_number(track_number);
- new_frame->set_timestamp(timestamp);
- new_frame->set_is_key(is_key);
- new_frame->set_discard_padding(discard_padding);
-
- if (!QueueFrame(new_frame))
- return false;
-
- return true;
- }
-
- if (!DoNewClusterProcessing(track_number, timestamp, is_key))
- return false;
-
- if (cluster_list_size_ < 1)
- return false;
-
- Cluster* const cluster = cluster_list_[cluster_list_size_ - 1];
- if (!cluster)
- return false;
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
- const uint64 abs_timecode = timestamp / timecode_scale;
-
- if (!cluster->AddFrameWithDiscardPadding(frame, length,
- discard_padding,
- track_number,
- abs_timecode,
- is_key)) {
- return false;
- }
-
- if (new_cuepoint_ && cues_track_ == track_number) {
- if (!AddCuePoint(timestamp, cues_track_))
- return false;
- }
-
- if (timestamp > last_timestamp_)
- last_timestamp_ = timestamp;
-
- return true;
-}
-
-bool Segment::AddMetadata(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 timestamp_ns,
- uint64 duration_ns) {
- if (!frame)
- return false;
-
- if (!CheckHeaderInfo())
- return false;
-
- // Check for non-monotonically increasing timestamps.
- if (timestamp_ns < last_timestamp_)
- return false;
-
- if (!DoNewClusterProcessing(track_number, timestamp_ns, true))
- return false;
-
- if (cluster_list_size_ < 1)
- return false;
-
- Cluster* const cluster = cluster_list_[cluster_list_size_-1];
-
- if (!cluster)
- return false;
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
- const uint64 abs_timecode = timestamp_ns / timecode_scale;
- const uint64 duration_timecode = duration_ns / timecode_scale;
-
- if (!cluster->AddMetadata(frame,
- length,
- track_number,
- abs_timecode,
- duration_timecode))
- return false;
-
- if (timestamp_ns > last_timestamp_)
- last_timestamp_ = timestamp_ns;
-
- return true;
-}
-
-bool Segment::AddGenericFrame(const Frame* frame) {
- last_block_duration_ = frame->duration();
- if (!tracks_.TrackIsAudio(frame->track_number()) &&
- !tracks_.TrackIsVideo(frame->track_number()) &&
- frame->duration() > 0) {
- return AddMetadata(frame->frame(),
- frame->length(),
- frame->track_number(),
- frame->timestamp(),
- frame->duration());
- } else if (frame->additional() && frame->additional_length() > 0) {
- return AddFrameWithAdditional(frame->frame(),
- frame->length(),
- frame->additional(),
- frame->additional_length(),
- frame->add_id(),
- frame->track_number(),
- frame->timestamp(),
- frame->is_key());
- } else if (frame->discard_padding() > 0) {
- return AddFrameWithDiscardPadding(frame->frame(), frame->length(),
- frame->discard_padding(),
- frame->track_number(),
- frame->timestamp(),
- frame->is_key());
- } else {
- return AddFrame(frame->frame(),
- frame->length(),
- frame->track_number(),
- frame->timestamp(),
- frame->is_key());
- }
-}
-
-void Segment::OutputCues(bool output_cues) {
- output_cues_ = output_cues;
-}
-
-bool Segment::SetChunking(bool chunking, const char* filename) {
- if (chunk_count_ > 0)
- return false;
-
- if (chunking) {
- if (!filename)
- return false;
-
- // Check if we are being set to what is already set.
- if (chunking_ && !strcmp(filename, chunking_base_name_))
- return true;
-
- const size_t name_length = strlen(filename) + 1;
- char* const temp = new (std::nothrow) char[name_length]; // NOLINT
- if (!temp)
- return false;
-
-#ifdef _MSC_VER
- strcpy_s(temp, name_length, filename);
-#else
- strcpy(temp, filename);
-#endif
-
- delete [] chunking_base_name_;
- chunking_base_name_ = temp;
-
- if (!UpdateChunkName("chk", &chunk_name_))
- return false;
-
- if (!chunk_writer_cluster_) {
- chunk_writer_cluster_ = new (std::nothrow) MkvWriter(); // NOLINT
- if (!chunk_writer_cluster_)
- return false;
- }
-
- if (!chunk_writer_cues_) {
- chunk_writer_cues_ = new (std::nothrow) MkvWriter(); // NOLINT
- if (!chunk_writer_cues_)
- return false;
- }
-
- if (!chunk_writer_header_) {
- chunk_writer_header_ = new (std::nothrow) MkvWriter(); // NOLINT
- if (!chunk_writer_header_)
- return false;
- }
-
- if (!chunk_writer_cluster_->Open(chunk_name_))
- return false;
-
- const size_t header_length = strlen(filename) + strlen(".hdr") + 1;
- char* const header = new (std::nothrow) char[header_length]; // NOLINT
- if (!header)
- return false;
-
-#ifdef _MSC_VER
- strcpy_s(header, header_length - strlen(".hdr"), chunking_base_name_);
- strcat_s(header, header_length, ".hdr");
-#else
- strcpy(header, chunking_base_name_);
- strcat(header, ".hdr");
-#endif
- if (!chunk_writer_header_->Open(header)) {
- delete [] header;
- return false;
- }
-
- writer_cluster_ = chunk_writer_cluster_;
- writer_cues_ = chunk_writer_cues_;
- writer_header_ = chunk_writer_header_;
-
- delete [] header;
- }
-
- chunking_ = chunking;
-
- return true;
-}
-
-bool Segment::CuesTrack(uint64 track_number) {
- const Track* const track = GetTrackByNumber(track_number);
- if (!track)
- return false;
-
- cues_track_ = track_number;
- return true;
-}
-
-void Segment::ForceNewClusterOnNextFrame() {
- force_new_cluster_ = true;
-}
-
-Track* Segment::GetTrackByNumber(uint64 track_number) const {
- return tracks_.GetTrackByNumber(track_number);
-}
-
-bool Segment::WriteSegmentHeader() {
- // TODO(fgalligan): Support more than one segment.
- if (!WriteEbmlHeader(writer_header_))
- return false;
-
- // Write "unknown" (-1) as segment size value. If mode is kFile, Segment
- // will write over duration when the file is finalized.
- if (WriteID(writer_header_, kMkvSegment))
- return false;
-
- // Save for later.
- size_position_ = writer_header_->Position();
-
- // Write "unknown" (EBML coded -1) as segment size value. We need to write 8
- // bytes because if we are going to overwrite the segment size later we do
- // not know how big our segment will be.
- if (SerializeInt(writer_header_, kEbmlUnknownValue, 8))
- return false;
-
- payload_pos_ = writer_header_->Position();
-
- if (mode_ == kFile && writer_header_->Seekable()) {
- // Set the duration > 0.0 so SegmentInfo will write out the duration. When
- // the muxer is done writing we will set the correct duration and have
- // SegmentInfo upadte it.
- segment_info_.set_duration(1.0);
-
- if (!seek_head_.Write(writer_header_))
- return false;
- }
-
- if (!seek_head_.AddSeekEntry(kMkvInfo, MaxOffset()))
- return false;
- if (!segment_info_.Write(writer_header_))
- return false;
-
- if (!seek_head_.AddSeekEntry(kMkvTracks, MaxOffset()))
- return false;
- if (!tracks_.Write(writer_header_))
- return false;
-
- if (chapters_.Count() > 0) {
- if (!seek_head_.AddSeekEntry(kMkvChapters, MaxOffset()))
- return false;
- if (!chapters_.Write(writer_header_))
- return false;
- }
-
- if (chunking_ && (mode_ == kLive || !writer_header_->Seekable())) {
- if (!chunk_writer_header_)
- return false;
-
- chunk_writer_header_->Close();
- }
-
- header_written_ = true;
-
- return true;
-}
-
-// Here we are testing whether to create a new cluster, given a frame
-// having time frame_timestamp_ns.
-//
-int Segment::TestFrame(uint64 track_number,
- uint64 frame_timestamp_ns,
- bool is_key) const {
- if (force_new_cluster_)
- return 1;
-
- // If no clusters have been created yet, then create a new cluster
- // and write this frame immediately, in the new cluster. This path
- // should only be followed once, the first time we attempt to write
- // a frame.
-
- if (cluster_list_size_ <= 0)
- return 1;
-
- // There exists at least one cluster. We must compare the frame to
- // the last cluster, in order to determine whether the frame is
- // written to the existing cluster, or that a new cluster should be
- // created.
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
- const uint64 frame_timecode = frame_timestamp_ns / timecode_scale;
-
- const Cluster* const last_cluster = cluster_list_[cluster_list_size_ - 1];
- const uint64 last_cluster_timecode = last_cluster->timecode();
-
- // For completeness we test for the case when the frame's timecode
- // is less than the cluster's timecode. Although in principle that
- // is allowed, this muxer doesn't actually write clusters like that,
- // so this indicates a bug somewhere in our algorithm.
-
- if (frame_timecode < last_cluster_timecode) // should never happen
- return -1; // error
-
- // If the frame has a timestamp significantly larger than the last
- // cluster (in Matroska, cluster-relative timestamps are serialized
- // using a 16-bit signed integer), then we cannot write this frame
- // to that cluster, and so we must create a new cluster.
-
- const int64 delta_timecode = frame_timecode - last_cluster_timecode;
-
- if (delta_timecode > kMaxBlockTimecode)
- return 2;
-
- // We decide to create a new cluster when we have a video keyframe.
- // This will flush queued (audio) frames, and write the keyframe
- // immediately, in the newly-created cluster.
-
- if (is_key && tracks_.TrackIsVideo(track_number))
- return 1;
-
- // Create a new cluster if we have accumulated too many frames
- // already, where "too many" is defined as "the total time of frames
- // in the cluster exceeds a threshold".
-
- const uint64 delta_ns = delta_timecode * timecode_scale;
-
- if (max_cluster_duration_ > 0 && delta_ns >= max_cluster_duration_)
- return 1;
-
- // This is similar to the case above, with the difference that a new
- // cluster is created when the size of the current cluster exceeds a
- // threshold.
-
- const uint64 cluster_size = last_cluster->payload_size();
-
- if (max_cluster_size_ > 0 && cluster_size >= max_cluster_size_)
- return 1;
-
- // There's no need to create a new cluster, so emit this frame now.
-
- return 0;
-}
-
-bool Segment::MakeNewCluster(uint64 frame_timestamp_ns) {
- const int32 new_size = cluster_list_size_ + 1;
-
- if (new_size > cluster_list_capacity_) {
- // Add more clusters.
- const int32 new_capacity =
- (cluster_list_capacity_ <= 0) ? 1 : cluster_list_capacity_ * 2;
- Cluster** const clusters =
- new (std::nothrow) Cluster*[new_capacity]; // NOLINT
- if (!clusters)
- return false;
-
- for (int32 i = 0; i < cluster_list_size_; ++i) {
- clusters[i] = cluster_list_[i];
- }
-
- delete [] cluster_list_;
-
- cluster_list_ = clusters;
- cluster_list_capacity_ = new_capacity;
- }
-
- if (!WriteFramesLessThan(frame_timestamp_ns))
- return false;
-
- if (mode_ == kFile) {
- if (cluster_list_size_ > 0) {
- // Update old cluster's size
- Cluster* const old_cluster = cluster_list_[cluster_list_size_ - 1];
-
- if (!old_cluster || !old_cluster->Finalize())
- return false;
- }
-
- if (output_cues_)
- new_cuepoint_ = true;
- }
-
- if (chunking_ && cluster_list_size_ > 0) {
- chunk_writer_cluster_->Close();
- chunk_count_++;
-
- if (!UpdateChunkName("chk", &chunk_name_))
- return false;
- if (!chunk_writer_cluster_->Open(chunk_name_))
- return false;
- }
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
- const uint64 frame_timecode = frame_timestamp_ns / timecode_scale;
-
- uint64 cluster_timecode = frame_timecode;
-
- if (frames_size_ > 0) {
- const Frame* const f = frames_[0]; // earliest queued frame
- const uint64 ns = f->timestamp();
- const uint64 tc = ns / timecode_scale;
-
- if (tc < cluster_timecode)
- cluster_timecode = tc;
- }
-
- Cluster*& cluster = cluster_list_[cluster_list_size_];
- const int64 offset = MaxOffset();
- cluster = new (std::nothrow) Cluster(cluster_timecode, offset); // NOLINT
- if (!cluster)
- return false;
-
- if (!cluster->Init(writer_cluster_))
- return false;
-
- cluster_list_size_ = new_size;
- return true;
-}
-
-bool Segment::DoNewClusterProcessing(uint64 track_number,
- uint64 frame_timestamp_ns,
- bool is_key) {
- for (;;) {
- // Based on the characteristics of the current frame and current
- // cluster, decide whether to create a new cluster.
- const int result = TestFrame(track_number, frame_timestamp_ns, is_key);
- if (result < 0) // error
- return false;
-
- // Always set force_new_cluster_ to false after TestFrame.
- force_new_cluster_ = false;
-
- // A non-zero result means create a new cluster.
- if (result > 0 && !MakeNewCluster(frame_timestamp_ns))
- return false;
-
- // Write queued (audio) frames.
- const int frame_count = WriteFramesAll();
- if (frame_count < 0) // error
- return false;
-
- // Write the current frame to the current cluster (if TestFrame
- // returns 0) or to a newly created cluster (TestFrame returns 1).
- if (result <= 1)
- return true;
-
- // TestFrame returned 2, which means there was a large time
- // difference between the cluster and the frame itself. Do the
- // test again, comparing the frame to the new cluster.
- }
-}
-
-bool Segment::CheckHeaderInfo() {
- if (!header_written_) {
- if (!WriteSegmentHeader())
- return false;
-
- if (!seek_head_.AddSeekEntry(kMkvCluster, MaxOffset()))
- return false;
-
- if (output_cues_ && cues_track_ == 0) {
- // Check for a video track
- for (uint32 i = 0; i < tracks_.track_entries_size(); ++i) {
- const Track* const track = tracks_.GetTrackByIndex(i);
- if (!track)
- return false;
-
- if (tracks_.TrackIsVideo(track->number())) {
- cues_track_ = track->number();
- break;
- }
- }
-
- // Set first track found
- if (cues_track_ == 0) {
- const Track* const track = tracks_.GetTrackByIndex(0);
- if (!track)
- return false;
-
- cues_track_ = track->number();
- }
- }
- }
- return true;
-}
-
-bool Segment::UpdateChunkName(const char* ext, char** name) const {
- if (!name || !ext)
- return false;
-
- char ext_chk[64];
-#ifdef _MSC_VER
- sprintf_s(ext_chk, sizeof(ext_chk), "_%06d.%s", chunk_count_, ext);
-#else
- snprintf(ext_chk, sizeof(ext_chk), "_%06d.%s", chunk_count_, ext);
-#endif
-
- const size_t length = strlen(chunking_base_name_) + strlen(ext_chk) + 1;
- char* const str = new (std::nothrow) char[length]; // NOLINT
- if (!str)
- return false;
-
-#ifdef _MSC_VER
- strcpy_s(str, length-strlen(ext_chk), chunking_base_name_);
- strcat_s(str, length, ext_chk);
-#else
- strcpy(str, chunking_base_name_);
- strcat(str, ext_chk);
-#endif
-
- delete [] *name;
- *name = str;
-
- return true;
-}
-
-int64 Segment::MaxOffset() {
- if (!writer_header_)
- return -1;
-
- int64 offset = writer_header_->Position() - payload_pos_;
-
- if (chunking_) {
- for (int32 i = 0; i < cluster_list_size_; ++i) {
- Cluster* const cluster = cluster_list_[i];
- offset += cluster->Size();
- }
-
- if (writer_cues_)
- offset += writer_cues_->Position();
- }
-
- return offset;
-}
-
-bool Segment::QueueFrame(Frame* frame) {
- const int32 new_size = frames_size_ + 1;
-
- if (new_size > frames_capacity_) {
- // Add more frames.
- const int32 new_capacity = (!frames_capacity_) ? 2 : frames_capacity_ * 2;
-
- if (new_capacity < 1)
- return false;
-
- Frame** const frames = new (std::nothrow) Frame*[new_capacity]; // NOLINT
- if (!frames)
- return false;
-
- for (int32 i = 0; i < frames_size_; ++i) {
- frames[i] = frames_[i];
- }
-
- delete [] frames_;
- frames_ = frames;
- frames_capacity_ = new_capacity;
- }
-
- frames_[frames_size_++] = frame;
-
- return true;
-}
-
-int Segment::WriteFramesAll() {
- if (frames_ == NULL)
- return 0;
-
- if (cluster_list_size_ < 1)
- return -1;
-
- Cluster* const cluster = cluster_list_[cluster_list_size_-1];
-
- if (!cluster)
- return -1;
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
-
- for (int32 i = 0; i < frames_size_; ++i) {
- Frame*& frame = frames_[i];
- const uint64 frame_timestamp = frame->timestamp(); // ns
- const uint64 frame_timecode = frame_timestamp / timecode_scale;
-
- if (frame->discard_padding() > 0) {
- if (!cluster->AddFrameWithDiscardPadding(frame->frame(),
- frame->length(),
- frame->discard_padding(),
- frame->track_number(),
- frame_timecode,
- frame->is_key())) {
- return -1;
- }
- } else {
- if (!cluster->AddFrame(frame->frame(),
- frame->length(),
- frame->track_number(),
- frame_timecode,
- frame->is_key())) {
- return -1;
- }
- }
-
- if (new_cuepoint_ && cues_track_ == frame->track_number()) {
- if (!AddCuePoint(frame_timestamp, cues_track_))
- return -1;
- }
-
- if (frame_timestamp > last_timestamp_)
- last_timestamp_ = frame_timestamp;
-
- delete frame;
- frame = NULL;
- }
-
- const int result = frames_size_;
- frames_size_ = 0;
-
- return result;
-}
-
-bool Segment::WriteFramesLessThan(uint64 timestamp) {
- // Check |cluster_list_size_| to see if this is the first cluster. If it is
- // the first cluster the audio frames that are less than the first video
- // timesatmp will be written in a later step.
- if (frames_size_ > 0 && cluster_list_size_ > 0) {
- if (!frames_)
- return false;
-
- Cluster* const cluster = cluster_list_[cluster_list_size_-1];
- if (!cluster)
- return false;
-
- const uint64 timecode_scale = segment_info_.timecode_scale();
- int32 shift_left = 0;
-
- // TODO(fgalligan): Change this to use the durations of frames instead of
- // the next frame's start time if the duration is accurate.
- for (int32 i = 1; i < frames_size_; ++i) {
- const Frame* const frame_curr = frames_[i];
-
- if (frame_curr->timestamp() > timestamp)
- break;
-
- const Frame* const frame_prev = frames_[i-1];
- const uint64 frame_timestamp = frame_prev->timestamp();
- const uint64 frame_timecode = frame_timestamp / timecode_scale;
- const int64 discard_padding = frame_prev->discard_padding();
-
- if (discard_padding > 0) {
- if (!cluster->AddFrameWithDiscardPadding(frame_prev->frame(),
- frame_prev->length(),
- discard_padding,
- frame_prev->track_number(),
- frame_timecode,
- frame_prev->is_key())) {
- return false;
- }
- } else {
- if (!cluster->AddFrame(frame_prev->frame(),
- frame_prev->length(),
- frame_prev->track_number(),
- frame_timecode,
- frame_prev->is_key())) {
- return false;
- }
- }
-
- if (new_cuepoint_ && cues_track_ == frame_prev->track_number()) {
- if (!AddCuePoint(frame_timestamp, cues_track_))
- return false;
- }
-
- ++shift_left;
- if (frame_timestamp > last_timestamp_)
- last_timestamp_ = frame_timestamp;
-
- delete frame_prev;
- }
-
- if (shift_left > 0) {
- if (shift_left >= frames_size_)
- return false;
-
- const int32 new_frames_size = frames_size_ - shift_left;
- for (int32 i = 0; i < new_frames_size; ++i) {
- frames_[i] = frames_[i+shift_left];
- }
-
- frames_size_ = new_frames_size;
- }
- }
-
- return true;
-}
-
-} // namespace mkvmuxer
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.hpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.hpp
deleted file mode 100644
index 63a315e..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxer.hpp
+++ /dev/null
@@ -1,1403 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef MKVMUXER_HPP
-#define MKVMUXER_HPP
-
-#include "mkvmuxertypes.hpp"
-
-// For a description of the WebM elements see
-// http://www.webmproject.org/code/specs/container/.
-
-namespace mkvparser {
- class IMkvReader;
-} // end namespace
-
-namespace mkvmuxer {
-
-class MkvWriter;
-class Segment;
-
-///////////////////////////////////////////////////////////////
-// Interface used by the mkvmuxer to write out the Mkv data.
-class IMkvWriter {
- public:
- // Writes out |len| bytes of |buf|. Returns 0 on success.
- virtual int32 Write(const void* buf, uint32 len) = 0;
-
- // Returns the offset of the output position from the beginning of the
- // output.
- virtual int64 Position() const = 0;
-
- // Set the current File position. Returns 0 on success.
- virtual int32 Position(int64 position) = 0;
-
- // Returns true if the writer is seekable.
- virtual bool Seekable() const = 0;
-
- // Element start notification. Called whenever an element identifier is about
- // to be written to the stream. |element_id| is the element identifier, and
- // |position| is the location in the WebM stream where the first octet of the
- // element identifier will be written.
- // Note: the |MkvId| enumeration in webmids.hpp defines element values.
- virtual void ElementStartNotify(uint64 element_id, int64 position) = 0;
-
- protected:
- IMkvWriter();
- virtual ~IMkvWriter();
-
- private:
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(IMkvWriter);
-};
-
-// Writes out the EBML header for a WebM file. This function must be called
-// before any other libwebm writing functions are called.
-bool WriteEbmlHeader(IMkvWriter* writer);
-
-// Copies in Chunk from source to destination between the given byte positions
-bool ChunkedCopy(mkvparser::IMkvReader* source, IMkvWriter* dst,
- int64 start, int64 size);
-
-///////////////////////////////////////////////////////////////
-// Class to hold data the will be written to a block.
-class Frame {
- public:
- Frame();
- ~Frame();
-
- // Copies |frame| data into |frame_|. Returns true on success.
- bool Init(const uint8* frame, uint64 length);
-
- // Copies |additional| data into |additional_|. Returns true on success.
- bool AddAdditionalData(const uint8* additional, uint64 length,
- uint64 add_id);
-
- uint64 add_id() const { return add_id_; }
- const uint8* additional() const { return additional_; }
- uint64 additional_length() const { return additional_length_; }
- void set_duration(uint64 duration) { duration_ = duration; }
- uint64 duration() const { return duration_; }
- const uint8* frame() const { return frame_; }
- void set_is_key(bool key) { is_key_ = key; }
- bool is_key() const { return is_key_; }
- uint64 length() const { return length_; }
- void set_track_number(uint64 track_number) { track_number_ = track_number; }
- uint64 track_number() const { return track_number_; }
- void set_timestamp(uint64 timestamp) { timestamp_ = timestamp; }
- uint64 timestamp() const { return timestamp_; }
- void set_discard_padding(uint64 discard_padding) {
- discard_padding_ = discard_padding;
- }
- uint64 discard_padding() const { return discard_padding_; }
-
- private:
- // Id of the Additional data.
- uint64 add_id_;
-
- // Pointer to additional data. Owned by this class.
- uint8* additional_;
-
- // Length of the additional data.
- uint64 additional_length_;
-
- // Duration of the frame in nanoseconds.
- uint64 duration_;
-
- // Pointer to the data. Owned by this class.
- uint8* frame_;
-
- // Flag telling if the data should set the key flag of a block.
- bool is_key_;
-
- // Length of the data.
- uint64 length_;
-
- // Mkv track number the data is associated with.
- uint64 track_number_;
-
- // Timestamp of the data in nanoseconds.
- uint64 timestamp_;
-
- // Discard padding for the frame.
- int64 discard_padding_;
-};
-
-///////////////////////////////////////////////////////////////
-// Class to hold one cue point in a Cues element.
-class CuePoint {
- public:
- CuePoint();
- ~CuePoint();
-
- // Returns the size in bytes for the entire CuePoint element.
- uint64 Size() const;
-
- // Output the CuePoint element to the writer. Returns true on success.
- bool Write(IMkvWriter* writer) const;
-
- void set_time(uint64 time) { time_ = time; }
- uint64 time() const { return time_; }
- void set_track(uint64 track) { track_ = track; }
- uint64 track() const { return track_; }
- void set_cluster_pos(uint64 cluster_pos) { cluster_pos_ = cluster_pos; }
- uint64 cluster_pos() const { return cluster_pos_; }
- void set_block_number(uint64 block_number) { block_number_ = block_number; }
- uint64 block_number() const { return block_number_; }
- void set_output_block_number(bool output_block_number) {
- output_block_number_ = output_block_number;
- }
- bool output_block_number() const { return output_block_number_; }
-
- private:
- // Returns the size in bytes for the payload of the CuePoint element.
- uint64 PayloadSize() const;
-
- // Absolute timecode according to the segment time base.
- uint64 time_;
-
- // The Track element associated with the CuePoint.
- uint64 track_;
-
- // The position of the Cluster containing the Block.
- uint64 cluster_pos_;
-
- // Number of the Block within the Cluster, starting from 1.
- uint64 block_number_;
-
- // If true the muxer will write out the block number for the cue if the
- // block number is different than the default of 1. Default is set to true.
- bool output_block_number_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(CuePoint);
-};
-
-///////////////////////////////////////////////////////////////
-// Cues element.
-class Cues {
- public:
- Cues();
- ~Cues();
-
- // Adds a cue point to the Cues element. Returns true on success.
- bool AddCue(CuePoint* cue);
-
- // Returns the cue point by index. Returns NULL if there is no cue point
- // match.
- CuePoint* GetCueByIndex(int32 index) const;
-
- // Returns the total size of the Cues element
- uint64 Size();
-
- // Output the Cues element to the writer. Returns true on success.
- bool Write(IMkvWriter* writer) const;
-
- int32 cue_entries_size() const { return cue_entries_size_; }
- void set_output_block_number(bool output_block_number) {
- output_block_number_ = output_block_number;
- }
- bool output_block_number() const { return output_block_number_; }
-
- private:
- // Number of allocated elements in |cue_entries_|.
- int32 cue_entries_capacity_;
-
- // Number of CuePoints in |cue_entries_|.
- int32 cue_entries_size_;
-
- // CuePoint list.
- CuePoint** cue_entries_;
-
- // If true the muxer will write out the block number for the cue if the
- // block number is different than the default of 1. Default is set to true.
- bool output_block_number_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Cues);
-};
-
-///////////////////////////////////////////////////////////////
-// ContentEncAESSettings element
-class ContentEncAESSettings {
- public:
- enum {
- kCTR = 1
- };
-
- ContentEncAESSettings();
- ~ContentEncAESSettings() {}
-
- // Returns the size in bytes for the ContentEncAESSettings element.
- uint64 Size() const;
-
- // Writes out the ContentEncAESSettings element to |writer|. Returns true on
- // success.
- bool Write(IMkvWriter* writer) const;
-
- uint64 cipher_mode() const { return cipher_mode_; }
-
- private:
- // Returns the size in bytes for the payload of the ContentEncAESSettings
- // element.
- uint64 PayloadSize() const;
-
- // Sub elements
- uint64 cipher_mode_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(ContentEncAESSettings);
-};
-
-///////////////////////////////////////////////////////////////
-// ContentEncoding element
-// Elements used to describe if the track data has been encrypted or
-// compressed with zlib or header stripping.
-// Currently only whole frames can be encrypted with AES. This dictates that
-// ContentEncodingOrder will be 0, ContentEncodingScope will be 1,
-// ContentEncodingType will be 1, and ContentEncAlgo will be 5.
-class ContentEncoding {
- public:
- ContentEncoding();
- ~ContentEncoding();
-
- // Sets the content encryption id. Copies |length| bytes from |id| to
- // |enc_key_id_|. Returns true on success.
- bool SetEncryptionID(const uint8* id, uint64 length);
-
- // Returns the size in bytes for the ContentEncoding element.
- uint64 Size() const;
-
- // Writes out the ContentEncoding element to |writer|. Returns true on
- // success.
- bool Write(IMkvWriter* writer) const;
-
- uint64 enc_algo() const { return enc_algo_; }
- uint64 encoding_order() const { return encoding_order_; }
- uint64 encoding_scope() const { return encoding_scope_; }
- uint64 encoding_type() const { return encoding_type_; }
- ContentEncAESSettings* enc_aes_settings() { return &enc_aes_settings_; }
-
- private:
- // Returns the size in bytes for the encoding elements.
- uint64 EncodingSize(uint64 compresion_size, uint64 encryption_size) const;
-
- // Returns the size in bytes for the encryption elements.
- uint64 EncryptionSize() const;
-
- // Track element names
- uint64 enc_algo_;
- uint8* enc_key_id_;
- uint64 encoding_order_;
- uint64 encoding_scope_;
- uint64 encoding_type_;
-
- // ContentEncAESSettings element.
- ContentEncAESSettings enc_aes_settings_;
-
- // Size of the ContentEncKeyID data in bytes.
- uint64 enc_key_id_length_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(ContentEncoding);
-};
-
-///////////////////////////////////////////////////////////////
-// Track element.
-class Track {
- public:
- // The |seed| parameter is used to synthesize a UID for the track.
- explicit Track(unsigned int* seed);
- virtual ~Track();
-
- // Adds a ContentEncoding element to the Track. Returns true on success.
- virtual bool AddContentEncoding();
-
- // Returns the ContentEncoding by index. Returns NULL if there is no
- // ContentEncoding match.
- ContentEncoding* GetContentEncodingByIndex(uint32 index) const;
-
- // Returns the size in bytes for the payload of the Track element.
- virtual uint64 PayloadSize() const;
-
- // Returns the size in bytes of the Track element.
- virtual uint64 Size() const;
-
- // Output the Track element to the writer. Returns true on success.
- virtual bool Write(IMkvWriter* writer) const;
-
- // Sets the CodecPrivate element of the Track element. Copies |length|
- // bytes from |codec_private| to |codec_private_|. Returns true on success.
- bool SetCodecPrivate(const uint8* codec_private, uint64 length);
-
- void set_codec_id(const char* codec_id);
- const char* codec_id() const { return codec_id_; }
- const uint8* codec_private() const { return codec_private_; }
- void set_language(const char* language);
- const char* language() const { return language_; }
- void set_max_block_additional_id(uint64 max_block_additional_id) {
- max_block_additional_id_ = max_block_additional_id;
- }
- uint64 max_block_additional_id() const { return max_block_additional_id_; }
- void set_name(const char* name);
- const char* name() const { return name_; }
- void set_number(uint64 number) { number_ = number; }
- uint64 number() const { return number_; }
- void set_type(uint64 type) { type_ = type; }
- uint64 type() const { return type_; }
- void set_uid(uint64 uid) { uid_ = uid; }
- uint64 uid() const { return uid_; }
- void set_codec_delay(uint64 codec_delay) { codec_delay_ = codec_delay; }
- uint64 codec_delay() const { return codec_delay_; }
- void set_seek_pre_roll(uint64 seek_pre_roll) {
- seek_pre_roll_ = seek_pre_roll;
- }
- uint64 seek_pre_roll() const { return seek_pre_roll_; }
-
- uint64 codec_private_length() const { return codec_private_length_; }
- uint32 content_encoding_entries_size() const {
- return content_encoding_entries_size_;
- }
-
- private:
- // Track element names
- char* codec_id_;
- uint8* codec_private_;
- char* language_;
- uint64 max_block_additional_id_;
- char* name_;
- uint64 number_;
- uint64 type_;
- uint64 uid_;
- uint64 codec_delay_;
- uint64 seek_pre_roll_;
-
- // Size of the CodecPrivate data in bytes.
- uint64 codec_private_length_;
-
- // ContentEncoding element list.
- ContentEncoding** content_encoding_entries_;
-
- // Number of ContentEncoding elements added.
- uint32 content_encoding_entries_size_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Track);
-};
-
-///////////////////////////////////////////////////////////////
-// Track that has video specific elements.
-class VideoTrack : public Track {
- public:
- // Supported modes for stereo 3D.
- enum StereoMode {
- kMono = 0,
- kSideBySideLeftIsFirst = 1,
- kTopBottomRightIsFirst = 2,
- kTopBottomLeftIsFirst = 3,
- kSideBySideRightIsFirst = 11
- };
-
- enum AlphaMode {
- kNoAlpha = 0,
- kAlpha = 1
- };
-
- // The |seed| parameter is used to synthesize a UID for the track.
- explicit VideoTrack(unsigned int* seed);
- virtual ~VideoTrack();
-
- // Returns the size in bytes for the payload of the Track element plus the
- // video specific elements.
- virtual uint64 PayloadSize() const;
-
- // Output the VideoTrack element to the writer. Returns true on success.
- virtual bool Write(IMkvWriter* writer) const;
-
- // Sets the video's stereo mode. Returns true on success.
- bool SetStereoMode(uint64 stereo_mode);
-
- // Sets the video's alpha mode. Returns true on success.
- bool SetAlphaMode(uint64 alpha_mode);
-
- void set_display_height(uint64 height) { display_height_ = height; }
- uint64 display_height() const { return display_height_; }
- void set_display_width(uint64 width) { display_width_ = width; }
- uint64 display_width() const { return display_width_; }
- void set_frame_rate(double frame_rate) { frame_rate_ = frame_rate; }
- double frame_rate() const { return frame_rate_; }
- void set_height(uint64 height) { height_ = height; }
- uint64 height() const { return height_; }
- uint64 stereo_mode() { return stereo_mode_; }
- uint64 alpha_mode() { return alpha_mode_; }
- void set_width(uint64 width) { width_ = width; }
- uint64 width() const { return width_; }
-
- private:
- // Returns the size in bytes of the Video element.
- uint64 VideoPayloadSize() const;
-
- // Video track element names.
- uint64 display_height_;
- uint64 display_width_;
- double frame_rate_;
- uint64 height_;
- uint64 stereo_mode_;
- uint64 alpha_mode_;
- uint64 width_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(VideoTrack);
-};
-
-///////////////////////////////////////////////////////////////
-// Track that has audio specific elements.
-class AudioTrack : public Track {
- public:
- // The |seed| parameter is used to synthesize a UID for the track.
- explicit AudioTrack(unsigned int* seed);
- virtual ~AudioTrack();
-
- // Returns the size in bytes for the payload of the Track element plus the
- // audio specific elements.
- virtual uint64 PayloadSize() const;
-
- // Output the AudioTrack element to the writer. Returns true on success.
- virtual bool Write(IMkvWriter* writer) const;
-
- void set_bit_depth(uint64 bit_depth) { bit_depth_ = bit_depth; }
- uint64 bit_depth() const { return bit_depth_; }
- void set_channels(uint64 channels) { channels_ = channels; }
- uint64 channels() const { return channels_; }
- void set_sample_rate(double sample_rate) { sample_rate_ = sample_rate; }
- double sample_rate() const { return sample_rate_; }
-
- private:
- // Audio track element names.
- uint64 bit_depth_;
- uint64 channels_;
- double sample_rate_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(AudioTrack);
-};
-
-///////////////////////////////////////////////////////////////
-// Tracks element
-class Tracks {
- public:
- // Audio and video type defined by the Matroska specs.
- enum {
- kVideo = 0x1,
- kAudio = 0x2
- };
- // Opus, Vorbis, VP8, and VP9 codec ids defined by the Matroska specs.
- static const char kOpusCodecId[];
- static const char kVorbisCodecId[];
- static const char kVp8CodecId[];
- static const char kVp9CodecId[];
-
- Tracks();
- ~Tracks();
-
- // Adds a Track element to the Tracks object. |track| will be owned and
- // deleted by the Tracks object. Returns true on success. |number| is the
- // number to use for the track. |number| must be >= 0. If |number| == 0
- // then the muxer will decide on the track number.
- bool AddTrack(Track* track, int32 number);
-
- // Returns the track by index. Returns NULL if there is no track match.
- const Track* GetTrackByIndex(uint32 idx) const;
-
- // Search the Tracks and return the track that matches |tn|. Returns NULL
- // if there is no track match.
- Track* GetTrackByNumber(uint64 track_number) const;
-
- // Returns true if the track number is an audio track.
- bool TrackIsAudio(uint64 track_number) const;
-
- // Returns true if the track number is a video track.
- bool TrackIsVideo(uint64 track_number) const;
-
- // Output the Tracks element to the writer. Returns true on success.
- bool Write(IMkvWriter* writer) const;
-
- uint32 track_entries_size() const { return track_entries_size_; }
-
- private:
- // Track element list.
- Track** track_entries_;
-
- // Number of Track elements added.
- uint32 track_entries_size_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Tracks);
-};
-
-///////////////////////////////////////////////////////////////
-// Chapter element
-//
-class Chapter {
- public:
- // Set the identifier for this chapter. (This corresponds to the
- // Cue Identifier line in WebVTT.)
- // TODO(matthewjheaney): the actual serialization of this item in
- // MKV is pending.
- bool set_id(const char* id);
-
- // Converts the nanosecond start and stop times of this chapter to
- // their corresponding timecode values, and stores them that way.
- void set_time(const Segment& segment,
- uint64 start_time_ns,
- uint64 end_time_ns);
-
- // Sets the uid for this chapter. Primarily used to enable
- // deterministic output from the muxer.
- void set_uid(const uint64 uid) { uid_ = uid; }
-
- // Add a title string to this chapter, per the semantics described
- // here:
- // http://www.matroska.org/technical/specs/index.html
- //
- // The title ("chapter string") is a UTF-8 string.
- //
- // The language has ISO 639-2 representation, described here:
- // http://www.loc.gov/standards/iso639-2/englangn.html
- // http://www.loc.gov/standards/iso639-2/php/English_list.php
- // If you specify NULL as the language value, this implies
- // English ("eng").
- //
- // The country value corresponds to the codes listed here:
- // http://www.iana.org/domains/root/db/
- //
- // The function returns false if the string could not be allocated.
- bool add_string(const char* title,
- const char* language,
- const char* country);
-
- private:
- friend class Chapters;
-
- // For storage of chapter titles that differ by language.
- class Display {
- public:
- // Establish representation invariant for new Display object.
- void Init();
-
- // Reclaim resources, in anticipation of destruction.
- void Clear();
-
- // Copies the title to the |title_| member. Returns false on
- // error.
- bool set_title(const char* title);
-
- // Copies the language to the |language_| member. Returns false
- // on error.
- bool set_language(const char* language);
-
- // Copies the country to the |country_| member. Returns false on
- // error.
- bool set_country(const char* country);
-
- // If |writer| is non-NULL, serialize the Display sub-element of
- // the Atom into the stream. Returns the Display element size on
- // success, 0 if error.
- uint64 WriteDisplay(IMkvWriter* writer) const;
-
- private:
- char* title_;
- char* language_;
- char* country_;
- };
-
- Chapter();
- ~Chapter();
-
- // Establish the representation invariant for a newly-created
- // Chapter object. The |seed| parameter is used to create the UID
- // for this chapter atom.
- void Init(unsigned int* seed);
-
- // Copies this Chapter object to a different one. This is used when
- // expanding a plain array of Chapter objects (see Chapters).
- void ShallowCopy(Chapter* dst) const;
-
- // Reclaim resources used by this Chapter object, pending its
- // destruction.
- void Clear();
-
- // If there is no storage remaining on the |displays_| array for a
- // new display object, creates a new, longer array and copies the
- // existing Display objects to the new array. Returns false if the
- // array cannot be expanded.
- bool ExpandDisplaysArray();
-
- // If |writer| is non-NULL, serialize the Atom sub-element into the
- // stream. Returns the total size of the element on success, 0 if
- // error.
- uint64 WriteAtom(IMkvWriter* writer) const;
-
- // The string identifier for this chapter (corresponds to WebVTT cue
- // identifier).
- char* id_;
-
- // Start timecode of the chapter.
- uint64 start_timecode_;
-
- // Stop timecode of the chapter.
- uint64 end_timecode_;
-
- // The binary identifier for this chapter.
- uint64 uid_;
-
- // The Atom element can contain multiple Display sub-elements, as
- // the same logical title can be rendered in different languages.
- Display* displays_;
-
- // The physical length (total size) of the |displays_| array.
- int displays_size_;
-
- // The logical length (number of active elements) on the |displays_|
- // array.
- int displays_count_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Chapter);
-};
-
-///////////////////////////////////////////////////////////////
-// Chapters element
-//
-class Chapters {
- public:
- Chapters();
- ~Chapters();
-
- Chapter* AddChapter(unsigned int* seed);
-
- // Returns the number of chapters that have been added.
- int Count() const;
-
- // Output the Chapters element to the writer. Returns true on success.
- bool Write(IMkvWriter* writer) const;
-
- private:
- // Expands the chapters_ array if there is not enough space to contain
- // another chapter object. Returns true on success.
- bool ExpandChaptersArray();
-
- // If |writer| is non-NULL, serialize the Edition sub-element of the
- // Chapters element into the stream. Returns the Edition element
- // size on success, 0 if error.
- uint64 WriteEdition(IMkvWriter* writer) const;
-
- // Total length of the chapters_ array.
- int chapters_size_;
-
- // Number of active chapters on the chapters_ array.
- int chapters_count_;
-
- // Array for storage of chapter objects.
- Chapter* chapters_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Chapters);
-};
-
-///////////////////////////////////////////////////////////////
-// Cluster element
-//
-// Notes:
-// |Init| must be called before any other method in this class.
-class Cluster {
- public:
- Cluster(uint64 timecode, int64 cues_pos);
- ~Cluster();
-
- // |timecode| is the absolute timecode of the cluster. |cues_pos| is the
- // position for the cluster within the segment that should be written in
- // the cues element.
- bool Init(IMkvWriter* ptr_writer);
-
- // Adds a frame to be output in the file. The frame is written out through
- // |writer_| if successful. Returns true on success.
- // Inputs:
- // frame: Pointer to the data
- // length: Length of the data
- // track_number: Track to add the data to. Value returned by Add track
- // functions. The range of allowed values is [1, 126].
- // timecode: Absolute (not relative to cluster) timestamp of the
- // frame, expressed in timecode units.
- // is_key: Flag telling whether or not this frame is a key frame.
- bool AddFrame(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 timecode, // timecode units (absolute)
- bool is_key);
-
- // Adds a frame to be output in the file. The frame is written out through
- // |writer_| if successful. Returns true on success.
- // Inputs:
- // frame: Pointer to the data
- // length: Length of the data
- // additional: Pointer to the additional data
- // additional_length: Length of the additional data
- // add_id: Value of BlockAddID element
- // track_number: Track to add the data to. Value returned by Add track
- // functions. The range of allowed values is [1, 126].
- // abs_timecode: Absolute (not relative to cluster) timestamp of the
- // frame, expressed in timecode units.
- // is_key: Flag telling whether or not this frame is a key frame.
- bool AddFrameWithAdditional(const uint8* frame,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- uint64 abs_timecode,
- bool is_key);
-
- // Adds a frame to be output in the file. The frame is written out through
- // |writer_| if successful. Returns true on success.
- // Inputs:
- // frame: Pointer to the data.
- // length: Length of the data.
- // discard_padding: DiscardPadding element value.
- // track_number: Track to add the data to. Value returned by Add track
- // functions. The range of allowed values is [1, 126].
- // abs_timecode: Absolute (not relative to cluster) timestamp of the
- // frame, expressed in timecode units.
- // is_key: Flag telling whether or not this frame is a key frame.
- bool AddFrameWithDiscardPadding(const uint8* frame,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- uint64 abs_timecode,
- bool is_key);
-
- // Writes a frame of metadata to the output medium; returns true on
- // success.
- // Inputs:
- // frame: Pointer to the data
- // length: Length of the data
- // track_number: Track to add the data to. Value returned by Add track
- // functions. The range of allowed values is [1, 126].
- // timecode: Absolute (not relative to cluster) timestamp of the
- // metadata frame, expressed in timecode units.
- // duration: Duration of metadata frame, in timecode units.
- //
- // The metadata frame is written as a block group, with a duration
- // sub-element but no reference time sub-elements (indicating that
- // it is considered a keyframe, per Matroska semantics).
- bool AddMetadata(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 timecode, // timecode units (absolute)
- uint64 duration); // timecode units
-
- // Increments the size of the cluster's data in bytes.
- void AddPayloadSize(uint64 size);
-
- // Closes the cluster so no more data can be written to it. Will update the
- // cluster's size if |writer_| is seekable. Returns true on success.
- bool Finalize();
-
- // Returns the size in bytes for the entire Cluster element.
- uint64 Size() const;
-
- int64 size_position() const { return size_position_; }
- int32 blocks_added() const { return blocks_added_; }
- uint64 payload_size() const { return payload_size_; }
- int64 position_for_cues() const { return position_for_cues_; }
- uint64 timecode() const { return timecode_; }
-
- private:
- // Signature that matches either of WriteSimpleBlock or WriteMetadataBlock
- // in the muxer utilities package.
- typedef uint64 (*WriteBlock)(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- uint64 track_number,
- int64 timecode,
- uint64 generic_arg);
-
- // Signature that matches WriteBlockWithAdditional
- // in the muxer utilities package.
- typedef uint64 (*WriteBlockAdditional)(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- const uint8* additional,
- uint64 add_id,
- uint64 additional_length,
- uint64 track_number,
- int64 timecode,
- uint64 is_key);
-
- // Signature that matches WriteBlockWithDiscardPadding
- // in the muxer utilities package.
- typedef uint64 (*WriteBlockDiscardPadding)(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- int64 timecode,
- uint64 is_key);
-
- // Utility method that confirms that blocks can still be added, and that the
- // cluster header has been written. Used by |DoWriteBlock*|. Returns true
- // when successful.
- template <typename Type>
- bool PreWriteBlock(Type* write_function);
-
- // Utility method used by the |DoWriteBlock*| methods that handles the book
- // keeping required after each block is written.
- void PostWriteBlock(uint64 element_size);
-
- // To simplify things, we require that there be fewer than 127
- // tracks -- this allows us to serialize the track number value for
- // a stream using a single byte, per the Matroska encoding.
- bool IsValidTrackNumber(uint64 track_number) const;
-
- // Given |abs_timecode|, calculates timecode relative to most recent timecode.
- // Returns -1 on failure, or a relative timecode.
- int64 GetRelativeTimecode(int64 abs_timecode) const;
-
- // Used to implement AddFrame and AddMetadata.
- bool DoWriteBlock(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 absolute_timecode,
- uint64 generic_arg,
- WriteBlock write_block);
-
- // Used to implement AddFrameWithAdditional
- bool DoWriteBlockWithAdditional(const uint8* frame,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- uint64 absolute_timecode,
- uint64 generic_arg,
- WriteBlockAdditional write_block);
-
- // Used to implement AddFrameWithDiscardPadding
- bool DoWriteBlockWithDiscardPadding(const uint8* frame,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- uint64 absolute_timecode,
- uint64 generic_arg,
- WriteBlockDiscardPadding write_block);
-
- // Outputs the Cluster header to |writer_|. Returns true on success.
- bool WriteClusterHeader();
-
- // Number of blocks added to the cluster.
- int32 blocks_added_;
-
- // Flag telling if the cluster has been closed.
- bool finalized_;
-
- // Flag telling if the cluster's header has been written.
- bool header_written_;
-
- // The size of the cluster elements in bytes.
- uint64 payload_size_;
-
- // The file position used for cue points.
- const int64 position_for_cues_;
-
- // The file position of the cluster's size element.
- int64 size_position_;
-
- // The absolute timecode of the cluster.
- const uint64 timecode_;
-
- // Pointer to the writer object. Not owned by this class.
- IMkvWriter* writer_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Cluster);
-};
-
-///////////////////////////////////////////////////////////////
-// SeekHead element
-class SeekHead {
- public:
- SeekHead();
- ~SeekHead();
-
- // TODO(fgalligan): Change this to reserve a certain size. Then check how
- // big the seek entry to be added is as not every seek entry will be the
- // maximum size it could be.
- // Adds a seek entry to be written out when the element is finalized. |id|
- // must be the coded mkv element id. |pos| is the file position of the
- // element. Returns true on success.
- bool AddSeekEntry(uint32 id, uint64 pos);
-
- // Writes out SeekHead and SeekEntry elements. Returns true on success.
- bool Finalize(IMkvWriter* writer) const;
-
- // Returns the id of the Seek Entry at the given index. Returns -1 if index is
- // out of range.
- uint32 GetId(int index) const;
-
- // Returns the position of the Seek Entry at the given index. Returns -1 if
- // index is out of range.
- uint64 GetPosition(int index) const;
-
- // Sets the Seek Entry id and position at given index.
- // Returns true on success.
- bool SetSeekEntry(int index, uint32 id, uint64 position);
-
- // Reserves space by writing out a Void element which will be updated with
- // a SeekHead element later. Returns true on success.
- bool Write(IMkvWriter* writer);
-
- // We are going to put a cap on the number of Seek Entries.
- const static int32 kSeekEntryCount = 5;
-
- private:
- // Returns the maximum size in bytes of one seek entry.
- uint64 MaxEntrySize() const;
-
- // Seek entry id element list.
- uint32 seek_entry_id_[kSeekEntryCount];
-
- // Seek entry pos element list.
- uint64 seek_entry_pos_[kSeekEntryCount];
-
- // The file position of SeekHead element.
- int64 start_pos_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(SeekHead);
-};
-
-///////////////////////////////////////////////////////////////
-// Segment Information element
-class SegmentInfo {
- public:
- SegmentInfo();
- ~SegmentInfo();
-
- // Will update the duration if |duration_| is > 0.0. Returns true on success.
- bool Finalize(IMkvWriter* writer) const;
-
- // Sets |muxing_app_| and |writing_app_|.
- bool Init();
-
- // Output the Segment Information element to the writer. Returns true on
- // success.
- bool Write(IMkvWriter* writer);
-
- void set_duration(double duration) { duration_ = duration; }
- double duration() const { return duration_; }
- void set_muxing_app(const char* app);
- const char* muxing_app() const { return muxing_app_; }
- void set_timecode_scale(uint64 scale) { timecode_scale_ = scale; }
- uint64 timecode_scale() const { return timecode_scale_; }
- void set_writing_app(const char* app);
- const char* writing_app() const { return writing_app_; }
-
- private:
- // Segment Information element names.
- // Initially set to -1 to signify that a duration has not been set and should
- // not be written out.
- double duration_;
- // Set to libwebm-%d.%d.%d.%d, major, minor, build, revision.
- char* muxing_app_;
- uint64 timecode_scale_;
- // Initially set to libwebm-%d.%d.%d.%d, major, minor, build, revision.
- char* writing_app_;
-
- // The file position of the duration element.
- int64 duration_pos_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(SegmentInfo);
-};
-
-///////////////////////////////////////////////////////////////
-// This class represents the main segment in a WebM file. Currently only
-// supports one Segment element.
-//
-// Notes:
-// |Init| must be called before any other method in this class.
-class Segment {
- public:
- enum Mode {
- kLive = 0x1,
- kFile = 0x2
- };
-
- enum CuesPosition {
- kAfterClusters = 0x0, // Position Cues after Clusters - Default
- kBeforeClusters = 0x1 // Position Cues before Clusters
- };
-
- const static uint64 kDefaultMaxClusterDuration = 30000000000ULL;
-
- Segment();
- ~Segment();
-
- // Initializes |SegmentInfo| and returns result. Always returns false when
- // |ptr_writer| is NULL.
- bool Init(IMkvWriter* ptr_writer);
-
- // Adds a generic track to the segment. Returns the newly-allocated
- // track object (which is owned by the segment) on success, NULL on
- // error. |number| is the number to use for the track. |number|
- // must be >= 0. If |number| == 0 then the muxer will decide on the
- // track number.
- Track* AddTrack(int32 number);
-
- // Adds a Vorbis audio track to the segment. Returns the number of the track
- // on success, 0 on error. |number| is the number to use for the audio track.
- // |number| must be >= 0. If |number| == 0 then the muxer will decide on
- // the track number.
- uint64 AddAudioTrack(int32 sample_rate, int32 channels, int32 number);
-
- // Adds an empty chapter to the chapters of this segment. Returns
- // non-NULL on success. After adding the chapter, the caller should
- // populate its fields via the Chapter member functions.
- Chapter* AddChapter();
-
- // Adds a cue point to the Cues element. |timestamp| is the time in
- // nanoseconds of the cue's time. |track| is the Track of the Cue. This
- // function must be called after AddFrame to calculate the correct
- // BlockNumber for the CuePoint. Returns true on success.
- bool AddCuePoint(uint64 timestamp, uint64 track);
-
- // Adds a frame to be output in the file. Returns true on success.
- // Inputs:
- // frame: Pointer to the data
- // length: Length of the data
- // track_number: Track to add the data to. Value returned by Add track
- // functions.
- // timestamp: Timestamp of the frame in nanoseconds from 0.
- // is_key: Flag telling whether or not this frame is a key frame.
- bool AddFrame(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 timestamp_ns,
- bool is_key);
-
- // Writes a frame of metadata to the output medium; returns true on
- // success.
- // Inputs:
- // frame: Pointer to the data
- // length: Length of the data
- // track_number: Track to add the data to. Value returned by Add track
- // functions.
- // timecode: Absolute timestamp of the metadata frame, expressed
- // in nanosecond units.
- // duration: Duration of metadata frame, in nanosecond units.
- //
- // The metadata frame is written as a block group, with a duration
- // sub-element but no reference time sub-elements (indicating that
- // it is considered a keyframe, per Matroska semantics).
- bool AddMetadata(const uint8* frame,
- uint64 length,
- uint64 track_number,
- uint64 timestamp_ns,
- uint64 duration_ns);
-
- // Writes a frame with additional data to the output medium; returns true on
- // success.
- // Inputs:
- // frame: Pointer to the data.
- // length: Length of the data.
- // additional: Pointer to additional data.
- // additional_length: Length of additional data.
- // add_id: Additional ID which identifies the type of additional data.
- // track_number: Track to add the data to. Value returned by Add track
- // functions.
- // timestamp: Absolute timestamp of the frame, expressed in nanosecond
- // units.
- // is_key: Flag telling whether or not this frame is a key frame.
- bool AddFrameWithAdditional(const uint8* frame,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- uint64 timestamp,
- bool is_key);
-
- // Writes a frame with DiscardPadding to the output medium; returns true on
- // success.
- // Inputs:
- // frame: Pointer to the data.
- // length: Length of the data.
- // discard_padding: DiscardPadding element value.
- // track_number: Track to add the data to. Value returned by Add track
- // functions.
- // timestamp: Absolute timestamp of the frame, expressed in nanosecond
- // units.
- // is_key: Flag telling whether or not this frame is a key frame.
- bool AddFrameWithDiscardPadding(const uint8* frame,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- uint64 timestamp,
- bool is_key);
-
- // Writes a Frame to the output medium. Chooses the correct way of writing
- // the frame (Block vs SimpleBlock) based on the parameters passed.
- // Inputs:
- // frame: frame object
- bool AddGenericFrame(const Frame* frame);
-
- // Adds a VP8 video track to the segment. Returns the number of the track on
- // success, 0 on error. |number| is the number to use for the video track.
- // |number| must be >= 0. If |number| == 0 then the muxer will decide on
- // the track number.
- uint64 AddVideoTrack(int32 width, int32 height, int32 number);
-
- // This function must be called after Finalize() if you need a copy of the
- // output with Cues written before the Clusters. It will return false if the
- // writer is not seekable of if chunking is set to true.
- // Input parameters:
- // reader - an IMkvReader object created with the same underlying file of the
- // current writer object. Make sure to close the existing writer
- // object before creating this so that all the data is properly
- // flushed and available for reading.
- // writer - an IMkvWriter object pointing to a *different* file than the one
- // pointed by the current writer object. This file will contain the
- // Cues element before the Clusters.
- bool CopyAndMoveCuesBeforeClusters(mkvparser::IMkvReader* reader,
- IMkvWriter* writer);
-
- // Sets which track to use for the Cues element. Must have added the track
- // before calling this function. Returns true on success. |track_number| is
- // returned by the Add track functions.
- bool CuesTrack(uint64 track_number);
-
- // This will force the muxer to create a new Cluster when the next frame is
- // added.
- void ForceNewClusterOnNextFrame();
-
- // Writes out any frames that have not been written out. Finalizes the last
- // cluster. May update the size and duration of the segment. May output the
- // Cues element. May finalize the SeekHead element. Returns true on success.
- bool Finalize();
-
- // Returns the Cues object.
- Cues* GetCues() { return &cues_; }
-
- // Returns the Segment Information object.
- const SegmentInfo* GetSegmentInfo() const { return &segment_info_; }
- SegmentInfo* GetSegmentInfo() { return &segment_info_; }
-
- // Search the Tracks and return the track that matches |track_number|.
- // Returns NULL if there is no track match.
- Track* GetTrackByNumber(uint64 track_number) const;
-
- // Toggles whether to output a cues element.
- void OutputCues(bool output_cues);
-
- // Sets if the muxer will output files in chunks or not. |chunking| is a
- // flag telling whether or not to turn on chunking. |filename| is the base
- // filename for the chunk files. The header chunk file will be named
- // |filename|.hdr and the data chunks will be named
- // |filename|_XXXXXX.chk. Chunking implies that the muxer will be writing
- // to files so the muxer will use the default MkvWriter class to control
- // what data is written to what files. Returns true on success.
- // TODO: Should we change the IMkvWriter Interface to add Open and Close?
- // That will force the interface to be dependent on files.
- bool SetChunking(bool chunking, const char* filename);
-
- bool chunking() const { return chunking_; }
- uint64 cues_track() const { return cues_track_; }
- void set_max_cluster_duration(uint64 max_cluster_duration) {
- max_cluster_duration_ = max_cluster_duration;
- }
- uint64 max_cluster_duration() const { return max_cluster_duration_; }
- void set_max_cluster_size(uint64 max_cluster_size) {
- max_cluster_size_ = max_cluster_size;
- }
- uint64 max_cluster_size() const { return max_cluster_size_; }
- void set_mode(Mode mode) { mode_ = mode; }
- Mode mode() const { return mode_; }
- CuesPosition cues_position() const { return cues_position_; }
- bool output_cues() const { return output_cues_; }
- const SegmentInfo* segment_info() const { return &segment_info_; }
-
- private:
- // Checks if header information has been output and initialized. If not it
- // will output the Segment element and initialize the SeekHead elment and
- // Cues elements.
- bool CheckHeaderInfo();
-
- // Sets |name| according to how many chunks have been written. |ext| is the
- // file extension. |name| must be deleted by the calling app. Returns true
- // on success.
- bool UpdateChunkName(const char* ext, char** name) const;
-
- // Returns the maximum offset within the segment's payload. When chunking
- // this function is needed to determine offsets of elements within the
- // chunked files. Returns -1 on error.
- int64 MaxOffset();
-
- // Adds the frame to our frame array.
- bool QueueFrame(Frame* frame);
-
- // Output all frames that are queued. Returns -1 on error, otherwise
- // it returns the number of frames written.
- int WriteFramesAll();
-
- // Output all frames that are queued that have an end time that is less
- // then |timestamp|. Returns true on success and if there are no frames
- // queued.
- bool WriteFramesLessThan(uint64 timestamp);
-
- // Outputs the segment header, Segment Information element, SeekHead element,
- // and Tracks element to |writer_|.
- bool WriteSegmentHeader();
-
- // Given a frame with the specified timestamp (nanosecond units) and
- // keyframe status, determine whether a new cluster should be
- // created, before writing enqueued frames and the frame itself. The
- // function returns one of the following values:
- // -1 = error: an out-of-order frame was detected
- // 0 = do not create a new cluster, and write frame to the existing cluster
- // 1 = create a new cluster, and write frame to that new cluster
- // 2 = create a new cluster, and re-run test
- int TestFrame(uint64 track_num, uint64 timestamp_ns, bool key) const;
-
- // Create a new cluster, using the earlier of the first enqueued
- // frame, or the indicated time. Returns true on success.
- bool MakeNewCluster(uint64 timestamp_ns);
-
- // Checks whether a new cluster needs to be created, and if so
- // creates a new cluster. Returns false if creation of a new cluster
- // was necessary but creation was not successful.
- bool DoNewClusterProcessing(uint64 track_num, uint64 timestamp_ns, bool key);
-
-
- // Adjusts Cue Point values (to place Cues before Clusters) so that they
- // reflect the correct offsets.
- void MoveCuesBeforeClusters();
-
- // This function recursively computes the correct cluster offsets (this is
- // done to move the Cues before Clusters). It recursively updates the change
- // in size (which indicates a change in cluster offset) until no sizes change.
- // Parameters:
- // diff - indicates the difference in size of the Cues element that needs to
- // accounted for.
- // index - index in the list of Cues which is currently being adjusted.
- // cue_size - size of the Cues element.
- void MoveCuesBeforeClustersHelper(uint64 diff, int index, uint64* cue_size);
-
- // Seeds the random number generator used to make UIDs.
- unsigned int seed_;
-
- // WebM elements
- Cues cues_;
- SeekHead seek_head_;
- SegmentInfo segment_info_;
- Tracks tracks_;
- Chapters chapters_;
-
- // Number of chunks written.
- int chunk_count_;
-
- // Current chunk filename.
- char* chunk_name_;
-
- // Default MkvWriter object created by this class used for writing clusters
- // out in separate files.
- MkvWriter* chunk_writer_cluster_;
-
- // Default MkvWriter object created by this class used for writing Cues
- // element out to a file.
- MkvWriter* chunk_writer_cues_;
-
- // Default MkvWriter object created by this class used for writing the
- // Matroska header out to a file.
- MkvWriter* chunk_writer_header_;
-
- // Flag telling whether or not the muxer is chunking output to multiple
- // files.
- bool chunking_;
-
- // Base filename for the chunked files.
- char* chunking_base_name_;
-
- // File position offset where the Clusters end.
- int64 cluster_end_offset_;
-
- // List of clusters.
- Cluster** cluster_list_;
-
- // Number of cluster pointers allocated in the cluster list.
- int32 cluster_list_capacity_;
-
- // Number of clusters in the cluster list.
- int32 cluster_list_size_;
-
- // Indicates whether Cues should be written before or after Clusters
- CuesPosition cues_position_;
-
- // Track number that is associated with the cues element for this segment.
- uint64 cues_track_;
-
- // Tells the muxer to force a new cluster on the next Block.
- bool force_new_cluster_;
-
- // List of stored audio frames. These variables are used to store frames so
- // the muxer can follow the guideline "Audio blocks that contain the video
- // key frame's timecode should be in the same cluster as the video key frame
- // block."
- Frame** frames_;
-
- // Number of frame pointers allocated in the frame list.
- int32 frames_capacity_;
-
- // Number of frames in the frame list.
- int32 frames_size_;
-
- // Flag telling if a video track has been added to the segment.
- bool has_video_;
-
- // Flag telling if the segment's header has been written.
- bool header_written_;
-
- // Duration of the last block in nanoseconds.
- uint64 last_block_duration_;
-
- // Last timestamp in nanoseconds added to a cluster.
- uint64 last_timestamp_;
-
- // Maximum time in nanoseconds for a cluster duration. This variable is a
- // guideline and some clusters may have a longer duration. Default is 30
- // seconds.
- uint64 max_cluster_duration_;
-
- // Maximum size in bytes for a cluster. This variable is a guideline and
- // some clusters may have a larger size. Default is 0 which signifies that
- // the muxer will decide the size.
- uint64 max_cluster_size_;
-
- // The mode that segment is in. If set to |kLive| the writer must not
- // seek backwards.
- Mode mode_;
-
- // Flag telling the muxer that a new cue point should be added.
- bool new_cuepoint_;
-
- // TODO(fgalligan): Should we add support for more than one Cues element?
- // Flag whether or not the muxer should output a Cues element.
- bool output_cues_;
-
- // The file position of the segment's payload.
- int64 payload_pos_;
-
- // The file position of the element's size.
- int64 size_position_;
-
- // Pointer to the writer objects. Not owned by this class.
- IMkvWriter* writer_cluster_;
- IMkvWriter* writer_cues_;
- IMkvWriter* writer_header_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Segment);
-};
-
-} //end namespace mkvmuxer
-
-#endif //MKVMUXER_HPP
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxertypes.hpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxertypes.hpp
deleted file mode 100644
index 2c66fd2..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxertypes.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef MKVMUXERTYPES_HPP
-#define MKVMUXERTYPES_HPP
-
-// Copied from Chromium basictypes.h
-// A macro to disallow the copy constructor and operator= functions
-// This should be used in the private: declarations for a class
-#define LIBWEBM_DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
-
-namespace mkvmuxer {
-
-typedef unsigned char uint8;
-typedef short int16;
-typedef int int32;
-typedef unsigned int uint32;
-typedef long long int64;
-typedef unsigned long long uint64;
-
-} //end namespace mkvmuxer
-
-#endif // MKVMUXERTYPES_HPP
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.cpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.cpp
deleted file mode 100644
index 96350e9..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.cpp
+++ /dev/null
@@ -1,713 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#include "mkvmuxerutil.hpp"
-
-#ifdef __ANDROID__
-#include <fcntl.h>
-#endif
-
-#include <cassert>
-#include <cmath>
-#include <cstdio>
-#ifdef _MSC_VER
-#define _CRT_RAND_S
-#endif
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-
-#include <new>
-
-#include "mkvwriter.hpp"
-#include "webmids.hpp"
-
-namespace mkvmuxer {
-
-int32 GetCodedUIntSize(uint64 value) {
- if (value < 0x000000000000007FULL)
- return 1;
- else if (value < 0x0000000000003FFFULL)
- return 2;
- else if (value < 0x00000000001FFFFFULL)
- return 3;
- else if (value < 0x000000000FFFFFFFULL)
- return 4;
- else if (value < 0x00000007FFFFFFFFULL)
- return 5;
- else if (value < 0x000003FFFFFFFFFFULL)
- return 6;
- else if (value < 0x0001FFFFFFFFFFFFULL)
- return 7;
- return 8;
-}
-
-int32 GetUIntSize(uint64 value) {
- if (value < 0x0000000000000100ULL)
- return 1;
- else if (value < 0x0000000000010000ULL)
- return 2;
- else if (value < 0x0000000001000000ULL)
- return 3;
- else if (value < 0x0000000100000000ULL)
- return 4;
- else if (value < 0x0000010000000000ULL)
- return 5;
- else if (value < 0x0001000000000000ULL)
- return 6;
- else if (value < 0x0100000000000000ULL)
- return 7;
- return 8;
-}
-
-uint64 EbmlMasterElementSize(uint64 type, uint64 value) {
- // Size of EBML ID
- int32 ebml_size = GetUIntSize(type);
-
- // Datasize
- ebml_size += GetCodedUIntSize(value);
-
- return ebml_size;
-}
-
-uint64 EbmlElementSize(uint64 type, int64 value) {
- return EbmlElementSize(type, static_cast<uint64>(value));
-}
-
-uint64 EbmlElementSize(uint64 type, uint64 value) {
- // Size of EBML ID
- int32 ebml_size = GetUIntSize(type);
-
- // Datasize
- ebml_size += GetUIntSize(value);
-
- // Size of Datasize
- ebml_size++;
-
- return ebml_size;
-}
-
-uint64 EbmlElementSize(uint64 type, float /* value */ ) {
- // Size of EBML ID
- uint64 ebml_size = GetUIntSize(type);
-
- // Datasize
- ebml_size += sizeof(float);
-
- // Size of Datasize
- ebml_size++;
-
- return ebml_size;
-}
-
-uint64 EbmlElementSize(uint64 type, const char* value) {
- if (!value)
- return 0;
-
- // Size of EBML ID
- uint64 ebml_size = GetUIntSize(type);
-
- // Datasize
- ebml_size += strlen(value);
-
- // Size of Datasize
- ebml_size++;
-
- return ebml_size;
-}
-
-uint64 EbmlElementSize(uint64 type, const uint8* value, uint64 size) {
- if (!value)
- return 0;
-
- // Size of EBML ID
- uint64 ebml_size = GetUIntSize(type);
-
- // Datasize
- ebml_size += size;
-
- // Size of Datasize
- ebml_size += GetCodedUIntSize(size);
-
- return ebml_size;
-}
-
-int32 SerializeInt(IMkvWriter* writer, int64 value, int32 size) {
- if (!writer || size < 1 || size > 8)
- return -1;
-
- for (int32 i = 1; i <= size; ++i) {
- const int32 byte_count = size - i;
- const int32 bit_count = byte_count * 8;
-
- const int64 bb = value >> bit_count;
- const uint8 b = static_cast<uint8>(bb);
-
- const int32 status = writer->Write(&b, 1);
-
- if (status < 0)
- return status;
- }
-
- return 0;
-}
-
-int32 SerializeFloat(IMkvWriter* writer, float f) {
- if (!writer)
- return -1;
-
- assert(sizeof(uint32) == sizeof(float));
- // This union is merely used to avoid a reinterpret_cast from float& to
- // uint32& which will result in violation of strict aliasing.
- union U32 {
- uint32 u32;
- float f;
- } value;
- value.f = f;
-
- for (int32 i = 1; i <= 4; ++i) {
- const int32 byte_count = 4 - i;
- const int32 bit_count = byte_count * 8;
-
- const uint8 byte = static_cast<uint8>(value.u32 >> bit_count);
-
- const int32 status = writer->Write(&byte, 1);
-
- if (status < 0)
- return status;
- }
-
- return 0;
-}
-
-int32 WriteUInt(IMkvWriter* writer, uint64 value) {
- if (!writer)
- return -1;
-
- int32 size = GetCodedUIntSize(value);
-
- return WriteUIntSize(writer, value, size);
-}
-
-int32 WriteUIntSize(IMkvWriter* writer, uint64 value, int32 size) {
- if (!writer || size < 0 || size > 8)
- return -1;
-
- if (size > 0) {
- const uint64 bit = 1LL << (size * 7);
-
- if (value > (bit - 2))
- return -1;
-
- value |= bit;
- } else {
- size = 1;
- int64 bit;
-
- for (;;) {
- bit = 1LL << (size * 7);
- const uint64 max = bit - 2;
-
- if (value <= max)
- break;
-
- ++size;
- }
-
- if (size > 8)
- return false;
-
- value |= bit;
- }
-
- return SerializeInt(writer, value, size);
-}
-
-int32 WriteID(IMkvWriter* writer, uint64 type) {
- if (!writer)
- return -1;
-
- writer->ElementStartNotify(type, writer->Position());
-
- const int32 size = GetUIntSize(type);
-
- return SerializeInt(writer, type, size);
-}
-
-bool WriteEbmlMasterElement(IMkvWriter* writer, uint64 type, uint64 size) {
- if (!writer)
- return false;
-
- if (WriteID(writer, type))
- return false;
-
- if (WriteUInt(writer, size))
- return false;
-
- return true;
-}
-
-bool WriteEbmlElement(IMkvWriter* writer, uint64 type, uint64 value) {
- if (!writer)
- return false;
-
- if (WriteID(writer, type))
- return false;
-
- const uint64 size = GetUIntSize(value);
- if (WriteUInt(writer, size))
- return false;
-
- if (SerializeInt(writer, value, static_cast<int32>(size)))
- return false;
-
- return true;
-}
-
-bool WriteEbmlElement(IMkvWriter* writer, uint64 type, float value) {
- if (!writer)
- return false;
-
- if (WriteID(writer, type))
- return false;
-
- if (WriteUInt(writer, 4))
- return false;
-
- if (SerializeFloat(writer, value))
- return false;
-
- return true;
-}
-
-bool WriteEbmlElement(IMkvWriter* writer, uint64 type, const char* value) {
- if (!writer || !value)
- return false;
-
- if (WriteID(writer, type))
- return false;
-
- const int32 length = strlen(value);
- if (WriteUInt(writer, length))
- return false;
-
- if (writer->Write(value, length))
- return false;
-
- return true;
-}
-
-bool WriteEbmlElement(IMkvWriter* writer,
- uint64 type,
- const uint8* value,
- uint64 size) {
- if (!writer || !value || size < 1)
- return false;
-
- if (WriteID(writer, type))
- return false;
-
- if (WriteUInt(writer, size))
- return false;
-
- if (writer->Write(value, static_cast<uint32>(size)))
- return false;
-
- return true;
-}
-
-uint64 WriteSimpleBlock(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- uint64 track_number,
- int64 timecode,
- uint64 is_key) {
- if (!writer)
- return false;
-
- if (!data || length < 1)
- return false;
-
- // Here we only permit track number values to be no greater than
- // 126, which the largest value we can store having a Matroska
- // integer representation of only 1 byte.
-
- if (track_number < 1 || track_number > 126)
- return false;
-
- // Technically the timestamp for a block can be less than the
- // timestamp for the cluster itself (remember that block timestamp
- // is a signed, 16-bit integer). However, as a simplification we
- // only permit non-negative cluster-relative timestamps for blocks.
-
- if (timecode < 0 || timecode > kMaxBlockTimecode)
- return false;
-
- if (WriteID(writer, kMkvSimpleBlock))
- return 0;
-
- const int32 size = static_cast<int32>(length) + 4;
- if (WriteUInt(writer, size))
- return 0;
-
- if (WriteUInt(writer, static_cast<uint64>(track_number)))
- return 0;
-
- if (SerializeInt(writer, timecode, 2))
- return 0;
-
- uint64 flags = 0;
- if (is_key)
- flags |= 0x80;
-
- if (SerializeInt(writer, flags, 1))
- return 0;
-
- if (writer->Write(data, static_cast<uint32>(length)))
- return 0;
-
- const uint64 element_size =
- GetUIntSize(kMkvSimpleBlock) + GetCodedUIntSize(size) + 4 + length;
-
- return element_size;
-}
-
-// We must write the metadata (key)frame as a BlockGroup element,
-// because we need to specify a duration for the frame. The
-// BlockGroup element comprises the frame itself and its duration,
-// and is laid out as follows:
-//
-// BlockGroup tag
-// BlockGroup size
-// Block tag
-// Block size
-// (the frame is the block payload)
-// Duration tag
-// Duration size
-// (duration payload)
-//
-uint64 WriteMetadataBlock(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- uint64 track_number,
- int64 timecode,
- uint64 duration) {
- // We don't backtrack when writing to the stream, so we must
- // pre-compute the BlockGroup size, by summing the sizes of each
- // sub-element (the block and the duration).
-
- // We use a single byte for the track number of the block, which
- // means the block header is exactly 4 bytes.
-
- // TODO(matthewjheaney): use EbmlMasterElementSize and WriteEbmlMasterElement
-
- const uint64 block_payload_size = 4 + length;
- const int32 block_size = GetCodedUIntSize(block_payload_size);
- const uint64 block_elem_size = 1 + block_size + block_payload_size;
-
- const int32 duration_payload_size = GetUIntSize(duration);
- const int32 duration_size = GetCodedUIntSize(duration_payload_size);
- const uint64 duration_elem_size = 1 + duration_size + duration_payload_size;
-
- const uint64 blockg_payload_size = block_elem_size + duration_elem_size;
- const int32 blockg_size = GetCodedUIntSize(blockg_payload_size);
- const uint64 blockg_elem_size = 1 + blockg_size + blockg_payload_size;
-
- if (WriteID(writer, kMkvBlockGroup)) // 1-byte ID size
- return 0;
-
- if (WriteUInt(writer, blockg_payload_size))
- return 0;
-
- // Write Block element
-
- if (WriteID(writer, kMkvBlock)) // 1-byte ID size
- return 0;
-
- if (WriteUInt(writer, block_payload_size))
- return 0;
-
- // Byte 1 of 4
-
- if (WriteUInt(writer, track_number))
- return 0;
-
- // Bytes 2 & 3 of 4
-
- if (SerializeInt(writer, timecode, 2))
- return 0;
-
- // Byte 4 of 4
-
- const uint64 flags = 0;
-
- if (SerializeInt(writer, flags, 1))
- return 0;
-
- // Now write the actual frame (of metadata)
-
- if (writer->Write(data, static_cast<uint32>(length)))
- return 0;
-
- // Write Duration element
-
- if (WriteID(writer, kMkvBlockDuration)) // 1-byte ID size
- return 0;
-
- if (WriteUInt(writer, duration_payload_size))
- return 0;
-
- if (SerializeInt(writer, duration, duration_payload_size))
- return 0;
-
- // Note that we don't write a reference time as part of the block
- // group; no reference time(s) indicates that this block is a
- // keyframe. (Unlike the case for a SimpleBlock element, the header
- // bits of the Block sub-element of a BlockGroup element do not
- // indicate keyframe status. The keyframe status is inferred from
- // the absence of reference time sub-elements.)
-
- return blockg_elem_size;
-}
-
-// Writes a WebM BlockGroup with BlockAdditional data. The structure is as
-// follows:
-// Indentation shows sub-levels
-// BlockGroup
-// Block
-// Data
-// BlockAdditions
-// BlockMore
-// BlockAddID
-// 1 (Denotes Alpha)
-// BlockAdditional
-// Data
-uint64 WriteBlockWithAdditional(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- int64 timecode,
- uint64 is_key) {
- if (!data || !additional || length < 1 || additional_length < 1)
- return 0;
-
- const uint64 block_payload_size = 4 + length;
- const uint64 block_elem_size = EbmlMasterElementSize(kMkvBlock,
- block_payload_size) +
- block_payload_size;
- const uint64 block_additional_elem_size = EbmlElementSize(kMkvBlockAdditional,
- additional,
- additional_length);
- const uint64 block_addid_elem_size = EbmlElementSize(kMkvBlockAddID, add_id);
-
- const uint64 block_more_payload_size = block_addid_elem_size +
- block_additional_elem_size;
- const uint64 block_more_elem_size = EbmlMasterElementSize(
- kMkvBlockMore,
- block_more_payload_size) +
- block_more_payload_size;
- const uint64 block_additions_payload_size = block_more_elem_size;
- const uint64 block_additions_elem_size = EbmlMasterElementSize(
- kMkvBlockAdditions,
- block_additions_payload_size) +
- block_additions_payload_size;
- const uint64 block_group_payload_size = block_elem_size +
- block_additions_elem_size;
- const uint64 block_group_elem_size = EbmlMasterElementSize(
- kMkvBlockGroup,
- block_group_payload_size) +
- block_group_payload_size;
-
- if (!WriteEbmlMasterElement(writer, kMkvBlockGroup,
- block_group_payload_size))
- return 0;
-
- if (!WriteEbmlMasterElement(writer, kMkvBlock, block_payload_size))
- return 0;
-
- if (WriteUInt(writer, track_number))
- return 0;
-
- if (SerializeInt(writer, timecode, 2))
- return 0;
-
- uint64 flags = 0;
- if (is_key)
- flags |= 0x80;
- if (SerializeInt(writer, flags, 1))
- return 0;
-
- if (writer->Write(data, static_cast<uint32>(length)))
- return 0;
-
- if (!WriteEbmlMasterElement(writer, kMkvBlockAdditions,
- block_additions_payload_size))
- return 0;
-
- if (!WriteEbmlMasterElement(writer, kMkvBlockMore, block_more_payload_size))
- return 0;
-
- if (!WriteEbmlElement(writer, kMkvBlockAddID, add_id))
- return 0;
-
- if (!WriteEbmlElement(writer, kMkvBlockAdditional,
- additional, additional_length))
- return 0;
-
- return block_group_elem_size;
-}
-
-// Writes a WebM BlockGroup with DiscardPadding. The structure is as follows:
-// Indentation shows sub-levels
-// BlockGroup
-// Block
-// Data
-// DiscardPadding
-uint64 WriteBlockWithDiscardPadding(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- int64 timecode,
- uint64 is_key) {
- if (!data || length < 1 || discard_padding <= 0)
- return 0;
-
- const uint64 block_payload_size = 4 + length;
- const uint64 block_elem_size = EbmlMasterElementSize(kMkvBlock,
- block_payload_size) +
- block_payload_size;
- const uint64 discard_padding_elem_size = EbmlElementSize(kMkvDiscardPadding,
- discard_padding);
- const uint64 block_group_payload_size = block_elem_size +
- discard_padding_elem_size;
- const uint64 block_group_elem_size = EbmlMasterElementSize(
- kMkvBlockGroup,
- block_group_payload_size) +
- block_group_payload_size;
-
- if (!WriteEbmlMasterElement(writer, kMkvBlockGroup,
- block_group_payload_size))
- return 0;
-
- if (!WriteEbmlMasterElement(writer, kMkvBlock, block_payload_size))
- return 0;
-
- if (WriteUInt(writer, track_number))
- return 0;
-
- if (SerializeInt(writer, timecode, 2))
- return 0;
-
- uint64 flags = 0;
- if (is_key)
- flags |= 0x80;
- if (SerializeInt(writer, flags, 1))
- return 0;
-
- if (writer->Write(data, static_cast<uint32>(length)))
- return 0;
-
- if (WriteID(writer, kMkvDiscardPadding))
- return 0;
-
- const uint64 size = GetUIntSize(discard_padding);
- if (WriteUInt(writer, size))
- return false;
-
- if (SerializeInt(writer, discard_padding, static_cast<int32>(size)))
- return false;
-
- return block_group_elem_size;
-}
-
-uint64 WriteVoidElement(IMkvWriter* writer, uint64 size) {
- if (!writer)
- return false;
-
- // Subtract one for the void ID and the coded size.
- uint64 void_entry_size = size - 1 - GetCodedUIntSize(size-1);
- uint64 void_size = EbmlMasterElementSize(kMkvVoid, void_entry_size) +
- void_entry_size;
-
- if (void_size != size)
- return 0;
-
- const int64 payload_position = writer->Position();
- if (payload_position < 0)
- return 0;
-
- if (WriteID(writer, kMkvVoid))
- return 0;
-
- if (WriteUInt(writer, void_entry_size))
- return 0;
-
- const uint8 value = 0;
- for (int32 i = 0; i < static_cast<int32>(void_entry_size); ++i) {
- if (writer->Write(&value, 1))
- return 0;
- }
-
- const int64 stop_position = writer->Position();
- if (stop_position < 0 ||
- stop_position - payload_position != static_cast<int64>(void_size))
- return 0;
-
- return void_size;
-}
-
-void GetVersion(int32* major, int32* minor, int32* build, int32* revision) {
- *major = 0;
- *minor = 2;
- *build = 1;
- *revision = 0;
-}
-
-} // namespace mkvmuxer
-
-mkvmuxer::uint64 mkvmuxer::MakeUID(unsigned int* seed) {
- uint64 uid = 0;
-
-#ifdef __MINGW32__
- srand(*seed);
-#endif
-
- for (int i = 0; i < 7; ++i) { // avoid problems with 8-byte values
- uid <<= 8;
-
- // TODO(fgalligan): Move random number generation to platform specific code.
-#ifdef _MSC_VER
- (void)seed;
- unsigned int random_value;
- const errno_t e = rand_s(&random_value);
- (void)e;
- const int32 nn = random_value;
-#elif __ANDROID__
- int32 temp_num = 1;
- int fd = open("/dev/urandom", O_RDONLY);
- if (fd != -1) {
- read(fd, &temp_num, sizeof(int32));
- close(fd);
- }
- const int32 nn = temp_num;
-#elif defined __MINGW32__
- const int32 nn = rand();
-#else
- const int32 nn = rand_r(seed);
-#endif
- const int32 n = 0xFF & (nn >> 4); // throw away low-order bits
-
- uid |= n;
- }
-
- return uid;
-}
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.hpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.hpp
deleted file mode 100644
index d196ad3..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvmuxerutil.hpp
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef MKVMUXERUTIL_HPP
-#define MKVMUXERUTIL_HPP
-
-#include "mkvmuxertypes.hpp"
-
-namespace mkvmuxer {
-
-class IMkvWriter;
-
-const uint64 kEbmlUnknownValue = 0x01FFFFFFFFFFFFFFULL;
-const int64 kMaxBlockTimecode = 0x07FFFLL;
-
-// Writes out |value| in Big Endian order. Returns 0 on success.
-int32 SerializeInt(IMkvWriter* writer, int64 value, int32 size);
-
-// Returns the size in bytes of the element.
-int32 GetUIntSize(uint64 value);
-int32 GetCodedUIntSize(uint64 value);
-uint64 EbmlMasterElementSize(uint64 type, uint64 value);
-uint64 EbmlElementSize(uint64 type, int64 value);
-uint64 EbmlElementSize(uint64 type, uint64 value);
-uint64 EbmlElementSize(uint64 type, float value);
-uint64 EbmlElementSize(uint64 type, const char* value);
-uint64 EbmlElementSize(uint64 type, const uint8* value, uint64 size);
-
-// Creates an EBML coded number from |value| and writes it out. The size of
-// the coded number is determined by the value of |value|. |value| must not
-// be in a coded form. Returns 0 on success.
-int32 WriteUInt(IMkvWriter* writer, uint64 value);
-
-// Creates an EBML coded number from |value| and writes it out. The size of
-// the coded number is determined by the value of |size|. |value| must not
-// be in a coded form. Returns 0 on success.
-int32 WriteUIntSize(IMkvWriter* writer, uint64 value, int32 size);
-
-// Output an Mkv master element. Returns true if the element was written.
-bool WriteEbmlMasterElement(IMkvWriter* writer, uint64 value, uint64 size);
-
-// Outputs an Mkv ID, calls |IMkvWriter::ElementStartNotify|, and passes the
-// ID to |SerializeInt|. Returns 0 on success.
-int32 WriteID(IMkvWriter* writer, uint64 type);
-
-// Output an Mkv non-master element. Returns true if the element was written.
-bool WriteEbmlElement(IMkvWriter* writer, uint64 type, uint64 value);
-bool WriteEbmlElement(IMkvWriter* writer, uint64 type, float value);
-bool WriteEbmlElement(IMkvWriter* writer, uint64 type, const char* value);
-bool WriteEbmlElement(IMkvWriter* writer,
- uint64 type,
- const uint8* value,
- uint64 size);
-
-// Output an Mkv Simple Block.
-// Inputs:
-// data: Pointer to the data.
-// length: Length of the data.
-// track_number: Track to add the data to. Value returned by Add track
-// functions. Only values in the range [1, 126] are
-// permitted.
-// timecode: Relative timecode of the Block. Only values in the
-// range [0, 2^15) are permitted.
-// is_key: Non-zero value specifies that frame is a key frame.
-uint64 WriteSimpleBlock(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- uint64 track_number,
- int64 timecode,
- uint64 is_key);
-
-// Output a metadata keyframe, using a Block Group element.
-// Inputs:
-// data: Pointer to the (meta)data.
-// length: Length of the (meta)data.
-// track_number: Track to add the data to. Value returned by Add track
-// functions. Only values in the range [1, 126] are
-// permitted.
-// timecode Timecode of frame, relative to cluster timecode. Only
-// values in the range [0, 2^15) are permitted.
-// duration_timecode Duration of frame, using timecode units.
-uint64 WriteMetadataBlock(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- uint64 track_number,
- int64 timecode,
- uint64 duration_timecode);
-
-// Output an Mkv Block with BlockAdditional data.
-// Inputs:
-// data: Pointer to the data.
-// length: Length of the data.
-// additional: Pointer to the additional data
-// additional_length: Length of the additional data.
-// add_id: Value of BlockAddID element.
-// track_number: Track to add the data to. Value returned by Add track
-// functions. Only values in the range [1, 126] are
-// permitted.
-// timecode: Relative timecode of the Block. Only values in the
-// range [0, 2^15) are permitted.
-// is_key: Non-zero value specifies that frame is a key frame.
-uint64 WriteBlockWithAdditional(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- const uint8* additional,
- uint64 additional_length,
- uint64 add_id,
- uint64 track_number,
- int64 timecode,
- uint64 is_key);
-
-// Output an Mkv Block with a DiscardPadding element.
-// Inputs:
-// data: Pointer to the data.
-// length: Length of the data.
-// discard_padding: DiscardPadding value.
-// track_number: Track to add the data to. Value returned by Add track
-// functions. Only values in the range [1, 126] are
-// permitted.
-// timecode: Relative timecode of the Block. Only values in the
-// range [0, 2^15) are permitted.
-// is_key: Non-zero value specifies that frame is a key frame.
-uint64 WriteBlockWithDiscardPadding(IMkvWriter* writer,
- const uint8* data,
- uint64 length,
- int64 discard_padding,
- uint64 track_number,
- int64 timecode,
- uint64 is_key);
-
-// Output a void element. |size| must be the entire size in bytes that will be
-// void. The function will calculate the size of the void header and subtract
-// it from |size|.
-uint64 WriteVoidElement(IMkvWriter* writer, uint64 size);
-
-// Returns the version number of the muxer in |major|, |minor|, |build|,
-// and |revision|.
-void GetVersion(int32* major, int32* minor, int32* build, int32* revision);
-
-// Returns a random number to be used for UID, using |seed| to seed
-// the random-number generator (see POSIX rand_r() for semantics).
-uint64 MakeUID(unsigned int* seed);
-
-} //end namespace mkvmuxer
-
-#endif // MKVMUXERUTIL_HPP
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.cpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.cpp
deleted file mode 100644
index b41456a..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.cpp
+++ /dev/null
@@ -1,9617 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#include "mkvparser.hpp"
-#include <cassert>
-#include <cstring>
-#include <new>
-#include <climits>
-
-#ifdef _MSC_VER
-// Disable MSVC warnings that suggest making code non-portable.
-#pragma warning(disable:4996)
-#endif
-
-mkvparser::IMkvReader::~IMkvReader()
-{
-}
-
-void mkvparser::GetVersion(int& major, int& minor, int& build, int& revision)
-{
- major = 1;
- minor = 0;
- build = 0;
- revision = 27;
-}
-
-long long mkvparser::ReadUInt(IMkvReader* pReader, long long pos, long& len)
-{
- assert(pReader);
- assert(pos >= 0);
-
- int status;
-
-//#ifdef _DEBUG
-// long long total, available;
-// status = pReader->Length(&total, &available);
-// assert(status >= 0);
-// assert((total < 0) || (available <= total));
-// assert(pos < available);
-// assert((available - pos) >= 1); //assume here max u-int len is 8
-//#endif
-
- len = 1;
-
- unsigned char b;
-
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0) //error or underflow
- return status;
-
- if (status > 0) //interpreted as "underflow"
- return E_BUFFER_NOT_FULL;
-
- if (b == 0) //we can't handle u-int values larger than 8 bytes
- return E_FILE_FORMAT_INVALID;
-
- unsigned char m = 0x80;
-
- while (!(b & m))
- {
- m >>= 1;
- ++len;
- }
-
-//#ifdef _DEBUG
-// assert((available - pos) >= len);
-//#endif
-
- long long result = b & (~m);
- ++pos;
-
- for (int i = 1; i < len; ++i)
- {
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- {
- len = 1;
- return status;
- }
-
- if (status > 0)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result <<= 8;
- result |= b;
-
- ++pos;
- }
-
- return result;
-}
-
-long long mkvparser::GetUIntLength(
- IMkvReader* pReader,
- long long pos,
- long& len)
-{
- assert(pReader);
- assert(pos >= 0);
-
- long long total, available;
-
- int status = pReader->Length(&total, &available);
- assert(status >= 0);
- assert((total < 0) || (available <= total));
-
- len = 1;
-
- if (pos >= available)
- return pos; //too few bytes available
-
- unsigned char b;
-
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- return status;
-
- assert(status == 0);
-
- if (b == 0) //we can't handle u-int values larger than 8 bytes
- return E_FILE_FORMAT_INVALID;
-
- unsigned char m = 0x80;
-
- while (!(b & m))
- {
- m >>= 1;
- ++len;
- }
-
- return 0; //success
-}
-
-
-long long mkvparser::UnserializeUInt(
- IMkvReader* pReader,
- long long pos,
- long long size)
-{
- assert(pReader);
- assert(pos >= 0);
-
- if ((size <= 0) || (size > 8))
- return E_FILE_FORMAT_INVALID;
-
- long long result = 0;
-
- for (long long i = 0; i < size; ++i)
- {
- unsigned char b;
-
- const long status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- return status;
-
- result <<= 8;
- result |= b;
-
- ++pos;
- }
-
- return result;
-}
-
-
-long mkvparser::UnserializeFloat(
- IMkvReader* pReader,
- long long pos,
- long long size_,
- double& result)
-{
- assert(pReader);
- assert(pos >= 0);
-
- if ((size_ != 4) && (size_ != 8))
- return E_FILE_FORMAT_INVALID;
-
- const long size = static_cast<long>(size_);
-
- unsigned char buf[8];
-
- const int status = pReader->Read(pos, size, buf);
-
- if (status < 0) //error
- return status;
-
- if (size == 4)
- {
- union
- {
- float f;
- unsigned long ff;
- };
-
- ff = 0;
-
- for (int i = 0;;)
- {
- ff |= buf[i];
-
- if (++i >= 4)
- break;
-
- ff <<= 8;
- }
-
- result = f;
- }
- else
- {
- assert(size == 8);
-
- union
- {
- double d;
- unsigned long long dd;
- };
-
- dd = 0;
-
- for (int i = 0;;)
- {
- dd |= buf[i];
-
- if (++i >= 8)
- break;
-
- dd <<= 8;
- }
-
- result = d;
- }
-
- return 0;
-}
-
-
-long mkvparser::UnserializeInt(
- IMkvReader* pReader,
- long long pos,
- long size,
- long long& result)
-{
- assert(pReader);
- assert(pos >= 0);
- assert(size > 0);
- assert(size <= 8);
-
- {
- signed char b;
-
- const long status = pReader->Read(pos, 1, (unsigned char*)&b);
-
- if (status < 0)
- return status;
-
- result = b;
-
- ++pos;
- }
-
- for (long i = 1; i < size; ++i)
- {
- unsigned char b;
-
- const long status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- return status;
-
- result <<= 8;
- result |= b;
-
- ++pos;
- }
-
- return 0; //success
-}
-
-
-long mkvparser::UnserializeString(
- IMkvReader* pReader,
- long long pos,
- long long size_,
- char*& str)
-{
- delete[] str;
- str = NULL;
-
- if (size_ >= LONG_MAX) //we need (size+1) chars
- return E_FILE_FORMAT_INVALID;
-
- const long size = static_cast<long>(size_);
-
- str = new (std::nothrow) char[size+1];
-
- if (str == NULL)
- return -1;
-
- unsigned char* const buf = reinterpret_cast<unsigned char*>(str);
-
- const long status = pReader->Read(pos, size, buf);
-
- if (status)
- {
- delete[] str;
- str = NULL;
-
- return status;
- }
-
- str[size] = '\0';
-
- return 0; //success
-}
-
-
-long mkvparser::ParseElementHeader(
- IMkvReader* pReader,
- long long& pos,
- long long stop,
- long long& id,
- long long& size)
-{
- if ((stop >= 0) && (pos >= stop))
- return E_FILE_FORMAT_INVALID;
-
- long len;
-
- id = ReadUInt(pReader, pos, len);
-
- if (id < 0)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume id
-
- if ((stop >= 0) && (pos >= stop))
- return E_FILE_FORMAT_INVALID;
-
- size = ReadUInt(pReader, pos, len);
-
- if (size < 0)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume length of size
-
- //pos now designates payload
-
- if ((stop >= 0) && ((pos + size) > stop))
- return E_FILE_FORMAT_INVALID;
-
- return 0; //success
-}
-
-
-bool mkvparser::Match(
- IMkvReader* pReader,
- long long& pos,
- unsigned long id_,
- long long& val)
-{
- assert(pReader);
- assert(pos >= 0);
-
- long long total, available;
-
- const long status = pReader->Length(&total, &available);
- assert(status >= 0);
- assert((total < 0) || (available <= total));
- if (status < 0)
- return false;
-
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- if ((unsigned long)id != id_)
- return false;
-
- pos += len; //consume id
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert(size <= 8);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- pos += len; //consume length of size of payload
-
- val = UnserializeUInt(pReader, pos, size);
- assert(val >= 0);
-
- pos += size; //consume size of payload
-
- return true;
-}
-
-bool mkvparser::Match(
- IMkvReader* pReader,
- long long& pos,
- unsigned long id_,
- unsigned char*& buf,
- size_t& buflen)
-{
- assert(pReader);
- assert(pos >= 0);
-
- long long total, available;
-
- long status = pReader->Length(&total, &available);
- assert(status >= 0);
- assert((total < 0) || (available <= total));
- if (status < 0)
- return false;
-
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- if ((unsigned long)id != id_)
- return false;
-
- pos += len; //consume id
-
- const long long size_ = ReadUInt(pReader, pos, len);
- assert(size_ >= 0);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- pos += len; //consume length of size of payload
- assert((pos + size_) <= available);
-
- const long buflen_ = static_cast<long>(size_);
-
- buf = new (std::nothrow) unsigned char[buflen_];
- assert(buf); //TODO
-
- status = pReader->Read(pos, buflen_, buf);
- assert(status == 0); //TODO
-
- buflen = buflen_;
-
- pos += size_; //consume size of payload
- return true;
-}
-
-
-namespace mkvparser
-{
-
-EBMLHeader::EBMLHeader() :
- m_docType(NULL)
-{
- Init();
-}
-
-EBMLHeader::~EBMLHeader()
-{
- delete[] m_docType;
-}
-
-void EBMLHeader::Init()
-{
- m_version = 1;
- m_readVersion = 1;
- m_maxIdLength = 4;
- m_maxSizeLength = 8;
-
- if (m_docType)
- {
- delete[] m_docType;
- m_docType = NULL;
- }
-
- m_docTypeVersion = 1;
- m_docTypeReadVersion = 1;
-}
-
-long long EBMLHeader::Parse(
- IMkvReader* pReader,
- long long& pos)
-{
- assert(pReader);
-
- long long total, available;
-
- long status = pReader->Length(&total, &available);
-
- if (status < 0) //error
- return status;
-
- pos = 0;
- long long end = (available >= 1024) ? 1024 : available;
-
- for (;;)
- {
- unsigned char b = 0;
-
- while (pos < end)
- {
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0) //error
- return status;
-
- if (b == 0x1A)
- break;
-
- ++pos;
- }
-
- if (b != 0x1A)
- {
- if (pos >= 1024)
- return E_FILE_FORMAT_INVALID; //don't bother looking anymore
-
- if ((total >= 0) && ((total - available) < 5))
- return E_FILE_FORMAT_INVALID;
-
- return available + 5; //5 = 4-byte ID + 1st byte of size
- }
-
- if ((total >= 0) && ((total - pos) < 5))
- return E_FILE_FORMAT_INVALID;
-
- if ((available - pos) < 5)
- return pos + 5; //try again later
-
- long len;
-
- const long long result = ReadUInt(pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result == 0x0A45DFA3) //EBML Header ID
- {
- pos += len; //consume ID
- break;
- }
-
- ++pos; //throw away just the 0x1A byte, and try again
- }
-
- //pos designates start of size field
-
- //get length of size field
-
- long len;
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result > 0) //need more data
- return result;
-
- assert(len > 0);
- assert(len <= 8);
-
- if ((total >= 0) && ((total - pos) < len))
- return E_FILE_FORMAT_INVALID;
-
- if ((available - pos) < len)
- return pos + len; //try again later
-
- //get the EBML header size
-
- result = ReadUInt(pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- pos += len; //consume size field
-
- //pos now designates start of payload
-
- if ((total >= 0) && ((total - pos) < result))
- return E_FILE_FORMAT_INVALID;
-
- if ((available - pos) < result)
- return pos + result;
-
- end = pos + result;
-
- Init();
-
- while (pos < end)
- {
- long long id, size;
-
- status = ParseElementHeader(
- pReader,
- pos,
- end,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (size == 0) //weird
- return E_FILE_FORMAT_INVALID;
-
- if (id == 0x0286) //version
- {
- m_version = UnserializeUInt(pReader, pos, size);
-
- if (m_version <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x02F7) //read version
- {
- m_readVersion = UnserializeUInt(pReader, pos, size);
-
- if (m_readVersion <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x02F2) //max id length
- {
- m_maxIdLength = UnserializeUInt(pReader, pos, size);
-
- if (m_maxIdLength <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x02F3) //max size length
- {
- m_maxSizeLength = UnserializeUInt(pReader, pos, size);
-
- if (m_maxSizeLength <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0282) //doctype
- {
- if (m_docType)
- return E_FILE_FORMAT_INVALID;
-
- status = UnserializeString(pReader, pos, size, m_docType);
-
- if (status) //error
- return status;
- }
- else if (id == 0x0287) //doctype version
- {
- m_docTypeVersion = UnserializeUInt(pReader, pos, size);
-
- if (m_docTypeVersion <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0285) //doctype read version
- {
- m_docTypeReadVersion = UnserializeUInt(pReader, pos, size);
-
- if (m_docTypeReadVersion <= 0)
- return E_FILE_FORMAT_INVALID;
- }
-
- pos += size;
- }
-
- assert(pos == end);
- return 0;
-}
-
-
-Segment::Segment(
- IMkvReader* pReader,
- long long elem_start,
- //long long elem_size,
- long long start,
- long long size) :
- m_pReader(pReader),
- m_element_start(elem_start),
- //m_element_size(elem_size),
- m_start(start),
- m_size(size),
- m_pos(start),
- m_pUnknownSize(0),
- m_pSeekHead(NULL),
- m_pInfo(NULL),
- m_pTracks(NULL),
- m_pCues(NULL),
- m_pChapters(NULL),
- m_clusters(NULL),
- m_clusterCount(0),
- m_clusterPreloadCount(0),
- m_clusterSize(0)
-{
-}
-
-
-Segment::~Segment()
-{
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- Cluster** i = m_clusters;
- Cluster** j = m_clusters + count;
-
- while (i != j)
- {
- Cluster* const p = *i++;
- assert(p);
-
- delete p;
- }
-
- delete[] m_clusters;
-
- delete m_pTracks;
- delete m_pInfo;
- delete m_pCues;
- delete m_pChapters;
- delete m_pSeekHead;
-}
-
-
-long long Segment::CreateInstance(
- IMkvReader* pReader,
- long long pos,
- Segment*& pSegment)
-{
- assert(pReader);
- assert(pos >= 0);
-
- pSegment = NULL;
-
- long long total, available;
-
- const long status = pReader->Length(&total, &available);
-
- if (status < 0) //error
- return status;
-
- if (available < 0)
- return -1;
-
- if ((total >= 0) && (available > total))
- return -1;
-
- //I would assume that in practice this loop would execute
- //exactly once, but we allow for other elements (e.g. Void)
- //to immediately follow the EBML header. This is fine for
- //the source filter case (since the entire file is available),
- //but in the splitter case over a network we should probably
- //just give up early. We could for example decide only to
- //execute this loop a maximum of, say, 10 times.
- //TODO:
- //There is an implied "give up early" by only parsing up
- //to the available limit. We do do that, but only if the
- //total file size is unknown. We could decide to always
- //use what's available as our limit (irrespective of whether
- //we happen to know the total file length). This would have
- //as its sense "parse this much of the file before giving up",
- //which a slightly different sense from "try to parse up to
- //10 EMBL elements before giving up".
-
- for (;;)
- {
- if ((total >= 0) && (pos >= total))
- return E_FILE_FORMAT_INVALID;
-
- //Read ID
- long len;
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result) //error, or too few available bytes
- return result;
-
- if ((total >= 0) && ((pos + len) > total))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- const long long idpos = pos;
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return id;
-
- pos += len; //consume ID
-
- //Read Size
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result) //error, or too few available bytes
- return result;
-
- if ((total >= 0) && ((pos + len) > total))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return size;
-
- pos += len; //consume length of size of element
-
- //Pos now points to start of payload
-
- //Handle "unknown size" for live streaming of webm files.
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (id == 0x08538067) //Segment ID
- {
- if (size == unknown_size)
- size = -1;
-
- else if (total < 0)
- size = -1;
-
- else if ((pos + size) > total)
- size = -1;
-
- pSegment = new (std::nothrow) Segment(
- pReader,
- idpos,
- //elem_size
- pos,
- size);
-
- if (pSegment == 0)
- return -1; //generic error
-
- return 0; //success
- }
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && ((pos + size) > total))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + size) > available)
- return pos + size;
-
- pos += size; //consume payload
- }
-}
-
-
-long long Segment::ParseHeaders()
-{
- //Outermost (level 0) segment object has been constructed,
- //and pos designates start of payload. We need to find the
- //inner (level 1) elements.
- long long total, available;
-
- const int status = m_pReader->Length(&total, &available);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (available <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
- assert((segment_stop < 0) || (total < 0) || (segment_stop <= total));
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- for (;;)
- {
- if ((total >= 0) && (m_pos >= total))
- break;
-
- if ((segment_stop >= 0) && (m_pos >= segment_stop))
- break;
-
- long long pos = m_pos;
- const long long element_start = pos;
-
- if ((pos + 1) > available)
- return (pos + 1);
-
- long len;
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result > 0) //underflow (weird)
- return (pos + 1);
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error
- return id;
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- pos += len; //consume ID
-
- if ((pos + 1) > available)
- return (pos + 1);
-
- //Read Size
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result > 0) //underflow (weird)
- return (pos + 1);
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return size;
-
- pos += len; //consume length of size of element
-
- const long long element_size = size + pos - element_start;
-
- //Pos now points to start of payload
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- //We read EBML elements either in total or nothing at all.
-
- if ((pos + size) > available)
- return pos + size;
-
- if (id == 0x0549A966) //Segment Info ID
- {
- if (m_pInfo)
- return E_FILE_FORMAT_INVALID;
-
- m_pInfo = new (std::nothrow) SegmentInfo(
- this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pInfo == NULL)
- return -1;
-
- const long status = m_pInfo->Parse();
-
- if (status)
- return status;
- }
- else if (id == 0x0654AE6B) //Tracks ID
- {
- if (m_pTracks)
- return E_FILE_FORMAT_INVALID;
-
- m_pTracks = new (std::nothrow) Tracks(this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pTracks == NULL)
- return -1;
-
- const long status = m_pTracks->Parse();
-
- if (status)
- return status;
- }
- else if (id == 0x0C53BB6B) //Cues ID
- {
- if (m_pCues == NULL)
- {
- m_pCues = new (std::nothrow) Cues(
- this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pCues == NULL)
- return -1;
- }
- }
- else if (id == 0x014D9B74) //SeekHead ID
- {
- if (m_pSeekHead == NULL)
- {
- m_pSeekHead = new (std::nothrow) SeekHead(
- this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pSeekHead == NULL)
- return -1;
-
- const long status = m_pSeekHead->Parse();
-
- if (status)
- return status;
- }
- }
- else if (id == 0x0043A770) //Chapters ID
- {
- if (m_pChapters == NULL)
- {
- m_pChapters = new (std::nothrow) Chapters(
- this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pChapters == NULL)
- return -1;
-
- const long status = m_pChapters->Parse();
-
- if (status)
- return status;
- }
- }
-
- m_pos = pos + size; //consume payload
- }
-
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- if (m_pInfo == NULL) //TODO: liberalize this behavior
- return E_FILE_FORMAT_INVALID;
-
- if (m_pTracks == NULL)
- return E_FILE_FORMAT_INVALID;
-
- return 0; //success
-}
-
-
-long Segment::LoadCluster(
- long long& pos,
- long& len)
-{
- for (;;)
- {
- const long result = DoLoadCluster(pos, len);
-
- if (result <= 1)
- return result;
- }
-}
-
-
-long Segment::DoLoadCluster(
- long long& pos,
- long& len)
-{
- if (m_pos < 0)
- return DoLoadClusterUnknownSize(pos, len);
-
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- long long cluster_off = -1; //offset relative to start of segment
- long long cluster_size = -1; //size of cluster payload
-
- for (;;)
- {
- if ((total >= 0) && (m_pos >= total))
- return 1; //no more clusters
-
- if ((segment_stop >= 0) && (m_pos >= segment_stop))
- return 1; //no more clusters
-
- pos = m_pos;
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- pos += len; //consume ID
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume length of size of element
-
- //pos now points to start of payload
-
- if (size == 0) //weird
- {
- m_pos = pos;
- continue;
- }
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
-#if 0 //we must handle this to support live webm
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //TODO: allow this
-#endif
-
- if ((segment_stop >= 0) &&
- (size != unknown_size) &&
- ((pos + size) > segment_stop))
- {
- return E_FILE_FORMAT_INVALID;
- }
-
-#if 0 //commented-out, to support incremental cluster parsing
- len = static_cast<long>(size);
-
- if ((pos + size) > avail)
- return E_BUFFER_NOT_FULL;
-#endif
-
- if (id == 0x0C53BB6B) //Cues ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //TODO: liberalize
-
- if (m_pCues == NULL)
- {
- const long long element_size = (pos - idpos) + size;
-
- m_pCues = new Cues(this,
- pos,
- size,
- idpos,
- element_size);
- assert(m_pCues); //TODO
- }
-
- m_pos = pos + size; //consume payload
- continue;
- }
-
- if (id != 0x0F43B675) //Cluster ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //TODO: liberalize
-
- m_pos = pos + size; //consume payload
- continue;
- }
-
- //We have a cluster.
-
- cluster_off = idpos - m_start; //relative pos
-
- if (size != unknown_size)
- cluster_size = size;
-
- break;
- }
-
- assert(cluster_off >= 0); //have cluster
-
- long long pos_;
- long len_;
-
- status = Cluster::HasBlockEntries(this, cluster_off, pos_, len_);
-
- if (status < 0) //error, or underflow
- {
- pos = pos_;
- len = len_;
-
- return status;
- }
-
- //status == 0 means "no block entries found"
- //status > 0 means "found at least one block entry"
-
- //TODO:
- //The issue here is that the segment increments its own
- //pos ptr past the most recent cluster parsed, and then
- //starts from there to parse the next cluster. If we
- //don't know the size of the current cluster, then we
- //must either parse its payload (as we do below), looking
- //for the cluster (or cues) ID to terminate the parse.
- //This isn't really what we want: rather, we really need
- //a way to create the curr cluster object immediately.
- //The pity is that cluster::parse can determine its own
- //boundary, and we largely duplicate that same logic here.
- //
- //Maybe we need to get rid of our look-ahead preloading
- //in source::parse???
- //
- //As we're parsing the blocks in the curr cluster
- //(in cluster::parse), we should have some way to signal
- //to the segment that we have determined the boundary,
- //so it can adjust its own segment::m_pos member.
- //
- //The problem is that we're asserting in asyncreadinit,
- //because we adjust the pos down to the curr seek pos,
- //and the resulting adjusted len is > 2GB. I'm suspicious
- //that this is even correct, but even if it is, we can't
- //be loading that much data in the cache anyway.
-
- const long idx = m_clusterCount;
-
- if (m_clusterPreloadCount > 0)
- {
- assert(idx < m_clusterSize);
-
- Cluster* const pCluster = m_clusters[idx];
- assert(pCluster);
- assert(pCluster->m_index < 0);
-
- const long long off = pCluster->GetPosition();
- assert(off >= 0);
-
- if (off == cluster_off) //preloaded already
- {
- if (status == 0) //no entries found
- return E_FILE_FORMAT_INVALID;
-
- if (cluster_size >= 0)
- pos += cluster_size;
- else
- {
- const long long element_size = pCluster->GetElementSize();
-
- if (element_size <= 0)
- return E_FILE_FORMAT_INVALID; //TODO: handle this case
-
- pos = pCluster->m_element_start + element_size;
- }
-
- pCluster->m_index = idx; //move from preloaded to loaded
- ++m_clusterCount;
- --m_clusterPreloadCount;
-
- m_pos = pos; //consume payload
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- return 0; //success
- }
- }
-
- if (status == 0) //no entries found
- {
- if (cluster_size < 0)
- return E_FILE_FORMAT_INVALID; //TODO: handle this
-
- pos += cluster_size;
-
- if ((total >= 0) && (pos >= total))
- {
- m_pos = total;
- return 1; //no more clusters
- }
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- {
- m_pos = segment_stop;
- return 1; //no more clusters
- }
-
- m_pos = pos;
- return 2; //try again
- }
-
- //status > 0 means we have an entry
-
- Cluster* const pCluster = Cluster::Create(this,
- idx,
- cluster_off);
- //element_size);
- assert(pCluster);
-
- AppendCluster(pCluster);
- assert(m_clusters);
- assert(idx < m_clusterSize);
- assert(m_clusters[idx] == pCluster);
-
- if (cluster_size >= 0)
- {
- pos += cluster_size;
-
- m_pos = pos;
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- return 0;
- }
-
- m_pUnknownSize = pCluster;
- m_pos = -pos;
-
- return 0; //partial success, since we have a new cluster
-
- //status == 0 means "no block entries found"
-
- //pos designates start of payload
- //m_pos has NOT been adjusted yet (in case we need to come back here)
-
-#if 0
-
- if (cluster_size < 0) //unknown size
- {
- const long long payload_pos = pos; //absolute pos of cluster payload
-
- for (;;) //determine cluster size
- {
- if ((total >= 0) && (pos >= total))
- break;
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- break; //no more clusters
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- if (id == 0x0C53BB6B) //Cues ID
- break;
-
- switch (id)
- {
- case 0x20: //BlockGroup
- case 0x23: //Simple Block
- case 0x67: //TimeCode
- case 0x2B: //PrevSize
- break;
-
- default:
- assert(false);
- break;
- }
-
- pos += len; //consume ID (of sub-element)
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field of element
-
- //pos now points to start of sub-element's payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not allowed for sub-elements
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop)) //weird
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload of sub-element
- assert((segment_stop < 0) || (pos <= segment_stop));
- } //determine cluster size
-
- cluster_size = pos - payload_pos;
- assert(cluster_size >= 0);
-
- pos = payload_pos; //reset and re-parse original cluster
- }
-
- if (m_clusterPreloadCount > 0)
- {
- assert(idx < m_clusterSize);
-
- Cluster* const pCluster = m_clusters[idx];
- assert(pCluster);
- assert(pCluster->m_index < 0);
-
- const long long off = pCluster->GetPosition();
- assert(off >= 0);
-
- if (off == cluster_off) //preloaded already
- return E_FILE_FORMAT_INVALID; //subtle
- }
-
- m_pos = pos + cluster_size; //consume payload
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- return 2; //try to find another cluster
-
-#endif
-
-}
-
-
-long Segment::DoLoadClusterUnknownSize(
- long long& pos,
- long& len)
-{
- assert(m_pos < 0);
- assert(m_pUnknownSize);
-
-#if 0
- assert(m_pUnknownSize->GetElementSize() < 0); //TODO: verify this
-
- const long long element_start = m_pUnknownSize->m_element_start;
-
- pos = -m_pos;
- assert(pos > element_start);
-
- //We have already consumed the (cluster) ID and size fields.
- //We just need to consume the blocks and other sub-elements
- //of this cluster, until we discover the boundary.
-
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- long long element_size = -1;
-
- for (;;) //determine cluster size
- {
- if ((total >= 0) && (pos >= total))
- {
- element_size = total - element_start;
- assert(element_size > 0);
-
- break;
- }
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- {
- element_size = segment_stop - element_start;
- assert(element_size > 0);
-
- break;
- }
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if ((id == 0x0F43B675) || (id == 0x0C53BB6B)) //Cluster ID or Cues ID
- {
- element_size = pos - element_start;
- assert(element_size > 0);
-
- break;
- }
-
-#ifdef _DEBUG
- switch (id)
- {
- case 0x20: //BlockGroup
- case 0x23: //Simple Block
- case 0x67: //TimeCode
- case 0x2B: //PrevSize
- break;
-
- default:
- assert(false);
- break;
- }
-#endif
-
- pos += len; //consume ID (of sub-element)
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field of element
-
- //pos now points to start of sub-element's payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not allowed for sub-elements
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop)) //weird
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload of sub-element
- assert((segment_stop < 0) || (pos <= segment_stop));
- } //determine cluster size
-
- assert(element_size >= 0);
-
- m_pos = element_start + element_size;
- m_pUnknownSize = 0;
-
- return 2; //continue parsing
-#else
- const long status = m_pUnknownSize->Parse(pos, len);
-
- if (status < 0) //error or underflow
- return status;
-
- if (status == 0) //parsed a block
- return 2; //continue parsing
-
- assert(status > 0); //nothing left to parse of this cluster
-
- const long long start = m_pUnknownSize->m_element_start;
-
- const long long size = m_pUnknownSize->GetElementSize();
- assert(size >= 0);
-
- pos = start + size;
- m_pos = pos;
-
- m_pUnknownSize = 0;
-
- return 2; //continue parsing
-#endif
-}
-
-
-void Segment::AppendCluster(Cluster* pCluster)
-{
- assert(pCluster);
- assert(pCluster->m_index >= 0);
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- long& size = m_clusterSize;
- assert(size >= count);
-
- const long idx = pCluster->m_index;
- assert(idx == m_clusterCount);
-
- if (count >= size)
- {
- const long n = (size <= 0) ? 2048 : 2*size;
-
- Cluster** const qq = new Cluster*[n];
- Cluster** q = qq;
-
- Cluster** p = m_clusters;
- Cluster** const pp = p + count;
-
- while (p != pp)
- *q++ = *p++;
-
- delete[] m_clusters;
-
- m_clusters = qq;
- size = n;
- }
-
- if (m_clusterPreloadCount > 0)
- {
- assert(m_clusters);
-
- Cluster** const p = m_clusters + m_clusterCount;
- assert(*p);
- assert((*p)->m_index < 0);
-
- Cluster** q = p + m_clusterPreloadCount;
- assert(q < (m_clusters + size));
-
- for (;;)
- {
- Cluster** const qq = q - 1;
- assert((*qq)->m_index < 0);
-
- *q = *qq;
- q = qq;
-
- if (q == p)
- break;
- }
- }
-
- m_clusters[idx] = pCluster;
- ++m_clusterCount;
-}
-
-
-void Segment::PreloadCluster(Cluster* pCluster, ptrdiff_t idx)
-{
- assert(pCluster);
- assert(pCluster->m_index < 0);
- assert(idx >= m_clusterCount);
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- long& size = m_clusterSize;
- assert(size >= count);
-
- if (count >= size)
- {
- const long n = (size <= 0) ? 2048 : 2*size;
-
- Cluster** const qq = new Cluster*[n];
- Cluster** q = qq;
-
- Cluster** p = m_clusters;
- Cluster** const pp = p + count;
-
- while (p != pp)
- *q++ = *p++;
-
- delete[] m_clusters;
-
- m_clusters = qq;
- size = n;
- }
-
- assert(m_clusters);
-
- Cluster** const p = m_clusters + idx;
-
- Cluster** q = m_clusters + count;
- assert(q >= p);
- assert(q < (m_clusters + size));
-
- while (q > p)
- {
- Cluster** const qq = q - 1;
- assert((*qq)->m_index < 0);
-
- *q = *qq;
- q = qq;
- }
-
- m_clusters[idx] = pCluster;
- ++m_clusterPreloadCount;
-}
-
-
-long Segment::Load()
-{
- assert(m_clusters == NULL);
- assert(m_clusterSize == 0);
- assert(m_clusterCount == 0);
- //assert(m_size >= 0);
-
- //Outermost (level 0) segment object has been constructed,
- //and pos designates start of payload. We need to find the
- //inner (level 1) elements.
-
- const long long header_status = ParseHeaders();
-
- if (header_status < 0) //error
- return static_cast<long>(header_status);
-
- if (header_status > 0) //underflow
- return E_BUFFER_NOT_FULL;
-
- assert(m_pInfo);
- assert(m_pTracks);
-
- for (;;)
- {
- const int status = LoadCluster();
-
- if (status < 0) //error
- return status;
-
- if (status >= 1) //no more clusters
- return 0;
- }
-}
-
-
-SeekHead::SeekHead(
- Segment* pSegment,
- long long start,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_entries(0),
- m_entry_count(0),
- m_void_elements(0),
- m_void_element_count(0)
-{
-}
-
-
-SeekHead::~SeekHead()
-{
- delete[] m_entries;
- delete[] m_void_elements;
-}
-
-
-long SeekHead::Parse()
-{
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = m_start;
- const long long stop = m_start + m_size;
-
- //first count the seek head entries
-
- int entry_count = 0;
- int void_element_count = 0;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x0DBB) //SeekEntry ID
- ++entry_count;
- else if (id == 0x6C) //Void ID
- ++void_element_count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- m_entries = new (std::nothrow) Entry[entry_count];
-
- if (m_entries == NULL)
- return -1;
-
- m_void_elements = new (std::nothrow) VoidElement[void_element_count];
-
- if (m_void_elements == NULL)
- return -1;
-
- //now parse the entries and void elements
-
- Entry* pEntry = m_entries;
- VoidElement* pVoidElement = m_void_elements;
-
- pos = m_start;
-
- while (pos < stop)
- {
- const long long idpos = pos;
-
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x0DBB) //SeekEntry ID
- {
- if (ParseEntry(pReader, pos, size, pEntry))
- {
- Entry& e = *pEntry++;
-
- e.element_start = idpos;
- e.element_size = (pos + size) - idpos;
- }
- }
- else if (id == 0x6C) //Void ID
- {
- VoidElement& e = *pVoidElement++;
-
- e.element_start = idpos;
- e.element_size = (pos + size) - idpos;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- ptrdiff_t count_ = ptrdiff_t(pEntry - m_entries);
- assert(count_ >= 0);
- assert(count_ <= entry_count);
-
- m_entry_count = static_cast<int>(count_);
-
- count_ = ptrdiff_t(pVoidElement - m_void_elements);
- assert(count_ >= 0);
- assert(count_ <= void_element_count);
-
- m_void_element_count = static_cast<int>(count_);
-
- return 0;
-}
-
-
-int SeekHead::GetCount() const
-{
- return m_entry_count;
-}
-
-const SeekHead::Entry* SeekHead::GetEntry(int idx) const
-{
- if (idx < 0)
- return 0;
-
- if (idx >= m_entry_count)
- return 0;
-
- return m_entries + idx;
-}
-
-int SeekHead::GetVoidElementCount() const
-{
- return m_void_element_count;
-}
-
-const SeekHead::VoidElement* SeekHead::GetVoidElement(int idx) const
-{
- if (idx < 0)
- return 0;
-
- if (idx >= m_void_element_count)
- return 0;
-
- return m_void_elements + idx;
-}
-
-
-#if 0
-void Segment::ParseCues(long long off)
-{
- if (m_pCues)
- return;
-
- //odbgstream os;
- //os << "Segment::ParseCues (begin)" << endl;
-
- long long pos = m_start + off;
- const long long element_start = pos;
- const long long stop = m_start + m_size;
-
- long len;
-
- long long result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0);
- assert((pos + len) <= stop);
-
- const long long idpos = pos;
-
- const long long id = ReadUInt(m_pReader, idpos, len);
- assert(id == 0x0C53BB6B); //Cues ID
-
- pos += len; //consume ID
- assert(pos < stop);
-
- //Read Size
-
- result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0);
- assert((pos + len) <= stop);
-
- const long long size = ReadUInt(m_pReader, pos, len);
- assert(size >= 0);
-
- pos += len; //consume length of size of element
- assert((pos + size) <= stop);
-
- const long long element_size = size + pos - element_start;
-
- //Pos now points to start of payload
-
- m_pCues = new Cues(this, pos, size, element_start, element_size);
- assert(m_pCues); //TODO
-
- //os << "Segment::ParseCues (end)" << endl;
-}
-#else
-long Segment::ParseCues(
- long long off,
- long long& pos,
- long& len)
-{
- if (m_pCues)
- return 0; //success
-
- if (off < 0)
- return -1;
-
- long long total, avail;
-
- const int status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- pos = m_start + off;
-
- if ((total < 0) || (pos >= total))
- return 1; //don't bother parsing cues
-
- const long long element_start = pos;
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //underflow (weird)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
-
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id != 0x0C53BB6B) //Cues ID
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume ID
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //underflow (weird)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- if (size == 0) //weird, although technically not illegal
- return 1; //done
-
- pos += len; //consume length of size of element
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- //Pos now points to start of payload
-
- const long long element_stop = pos + size;
-
- if ((segment_stop >= 0) && (element_stop > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && (element_stop > total))
- return 1; //don't bother parsing anymore
-
- len = static_cast<long>(size);
-
- if (element_stop > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long element_size = element_stop - element_start;
-
- m_pCues = new (std::nothrow) Cues(
- this,
- pos,
- size,
- element_start,
- element_size);
- assert(m_pCues); //TODO
-
- return 0; //success
-}
-#endif
-
-
-#if 0
-void Segment::ParseSeekEntry(
- long long start,
- long long size_)
-{
- long long pos = start;
-
- const long long stop = start + size_;
-
- long len;
-
- const long long seekIdId = ReadUInt(m_pReader, pos, len);
- //seekIdId;
- assert(seekIdId == 0x13AB); //SeekID ID
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long seekIdSize = ReadUInt(m_pReader, pos, len);
- assert(seekIdSize >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume size
-
- const long long seekId = ReadUInt(m_pReader, pos, len); //payload
- assert(seekId >= 0);
- assert(len == seekIdSize);
- assert((pos + len) <= stop);
-
- pos += seekIdSize; //consume payload
-
- const long long seekPosId = ReadUInt(m_pReader, pos, len);
- //seekPosId;
- assert(seekPosId == 0x13AC); //SeekPos ID
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long seekPosSize = ReadUInt(m_pReader, pos, len);
- assert(seekPosSize >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume size
- assert((pos + seekPosSize) <= stop);
-
- const long long seekOff = UnserializeUInt(m_pReader, pos, seekPosSize);
- assert(seekOff >= 0);
- assert(seekOff < m_size);
-
- pos += seekPosSize; //consume payload
- assert(pos == stop);
-
- const long long seekPos = m_start + seekOff;
- assert(seekPos < (m_start + m_size));
-
- if (seekId == 0x0C53BB6B) //Cues ID
- ParseCues(seekOff);
-}
-#else
-bool SeekHead::ParseEntry(
- IMkvReader* pReader,
- long long start,
- long long size_,
- Entry* pEntry)
-{
- if (size_ <= 0)
- return false;
-
- long long pos = start;
- const long long stop = start + size_;
-
- long len;
-
- //parse the container for the level-1 element ID
-
- const long long seekIdId = ReadUInt(pReader, pos, len);
- //seekIdId;
-
- if (seekIdId != 0x13AB) //SeekID ID
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume SeekID id
-
- const long long seekIdSize = ReadUInt(pReader, pos, len);
-
- if (seekIdSize <= 0)
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume size of field
-
- if ((pos + seekIdSize) > stop)
- return false;
-
- //Note that the SeekId payload really is serialized
- //as a "Matroska integer", not as a plain binary value.
- //In fact, Matroska requires that ID values in the
- //stream exactly match the binary representation as listed
- //in the Matroska specification.
- //
- //This parser is more liberal, and permits IDs to have
- //any width. (This could make the representation in the stream
- //different from what's in the spec, but it doesn't matter here,
- //since we always normalize "Matroska integer" values.)
-
- pEntry->id = ReadUInt(pReader, pos, len); //payload
-
- if (pEntry->id <= 0)
- return false;
-
- if (len != seekIdSize)
- return false;
-
- pos += seekIdSize; //consume SeekID payload
-
- const long long seekPosId = ReadUInt(pReader, pos, len);
-
- if (seekPosId != 0x13AC) //SeekPos ID
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume id
-
- const long long seekPosSize = ReadUInt(pReader, pos, len);
-
- if (seekPosSize <= 0)
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume size
-
- if ((pos + seekPosSize) > stop)
- return false;
-
- pEntry->pos = UnserializeUInt(pReader, pos, seekPosSize);
-
- if (pEntry->pos < 0)
- return false;
-
- pos += seekPosSize; //consume payload
-
- if (pos != stop)
- return false;
-
- return true;
-}
-#endif
-
-
-Cues::Cues(
- Segment* pSegment,
- long long start_,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start_),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_cue_points(NULL),
- m_count(0),
- m_preload_count(0),
- m_pos(start_)
-{
-}
-
-
-Cues::~Cues()
-{
- const long n = m_count + m_preload_count;
-
- CuePoint** p = m_cue_points;
- CuePoint** const q = p + n;
-
- while (p != q)
- {
- CuePoint* const pCP = *p++;
- assert(pCP);
-
- delete pCP;
- }
-
- delete[] m_cue_points;
-}
-
-
-long Cues::GetCount() const
-{
- if (m_cue_points == NULL)
- return -1;
-
- return m_count; //TODO: really ignore preload count?
-}
-
-
-bool Cues::DoneParsing() const
-{
- const long long stop = m_start + m_size;
- return (m_pos >= stop);
-}
-
-
-void Cues::Init() const
-{
- if (m_cue_points)
- return;
-
- assert(m_count == 0);
- assert(m_preload_count == 0);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- const long long stop = m_start + m_size;
- long long pos = m_start;
-
- long cue_points_size = 0;
-
- while (pos < stop)
- {
- const long long idpos = pos;
-
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x3B) //CuePoint ID
- PreloadCuePoint(cue_points_size, idpos);
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-}
-
-
-void Cues::PreloadCuePoint(
- long& cue_points_size,
- long long pos) const
-{
- assert(m_count == 0);
-
- if (m_preload_count >= cue_points_size)
- {
- const long n = (cue_points_size <= 0) ? 2048 : 2*cue_points_size;
-
- CuePoint** const qq = new CuePoint*[n];
- CuePoint** q = qq; //beginning of target
-
- CuePoint** p = m_cue_points; //beginning of source
- CuePoint** const pp = p + m_preload_count; //end of source
-
- while (p != pp)
- *q++ = *p++;
-
- delete[] m_cue_points;
-
- m_cue_points = qq;
- cue_points_size = n;
- }
-
- CuePoint* const pCP = new CuePoint(m_preload_count, pos);
- m_cue_points[m_preload_count++] = pCP;
-}
-
-
-bool Cues::LoadCuePoint() const
-{
- //odbgstream os;
- //os << "Cues::LoadCuePoint" << endl;
-
- const long long stop = m_start + m_size;
-
- if (m_pos >= stop)
- return false; //nothing else to do
-
- Init();
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- while (m_pos < stop)
- {
- const long long idpos = m_pos;
-
- long len;
-
- const long long id = ReadUInt(pReader, m_pos, len);
- assert(id >= 0); //TODO
- assert((m_pos + len) <= stop);
-
- m_pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, m_pos, len);
- assert(size >= 0);
- assert((m_pos + len) <= stop);
-
- m_pos += len; //consume Size field
- assert((m_pos + size) <= stop);
-
- if (id != 0x3B) //CuePoint ID
- {
- m_pos += size; //consume payload
- assert(m_pos <= stop);
-
- continue;
- }
-
- assert(m_preload_count > 0);
-
- CuePoint* const pCP = m_cue_points[m_count];
- assert(pCP);
- assert((pCP->GetTimeCode() >= 0) || (-pCP->GetTimeCode() == idpos));
- if (pCP->GetTimeCode() < 0 && (-pCP->GetTimeCode() != idpos))
- return false;
-
- pCP->Load(pReader);
- ++m_count;
- --m_preload_count;
-
- m_pos += size; //consume payload
- assert(m_pos <= stop);
-
- return true; //yes, we loaded a cue point
- }
-
- //return (m_pos < stop);
- return false; //no, we did not load a cue point
-}
-
-
-bool Cues::Find(
- long long time_ns,
- const Track* pTrack,
- const CuePoint*& pCP,
- const CuePoint::TrackPosition*& pTP) const
-{
- assert(time_ns >= 0);
- assert(pTrack);
-
-#if 0
- LoadCuePoint(); //establish invariant
-
- assert(m_cue_points);
- assert(m_count > 0);
-
- CuePoint** const ii = m_cue_points;
- CuePoint** i = ii;
-
- CuePoint** const jj = ii + m_count + m_preload_count;
- CuePoint** j = jj;
-
- pCP = *i;
- assert(pCP);
-
- if (time_ns <= pCP->GetTime(m_pSegment))
- {
- pTP = pCP->Find(pTrack);
- return (pTP != NULL);
- }
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) <= time_ns
- //[i, j) ?
- //[j, jj) > time_ns
-
- CuePoint** const k = i + (j - i) / 2;
- assert(k < jj);
-
- CuePoint* const pCP = *k;
- assert(pCP);
-
- pCP->Load(pReader);
-
- const long long t = pCP->GetTime(m_pSegment);
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i <= jj);
- assert(i > ii);
-
- pCP = *--i;
- assert(pCP);
- assert(pCP->GetTime(m_pSegment) <= time_ns);
-#else
- if (m_cue_points == NULL)
- return false;
-
- if (m_count == 0)
- return false;
-
- CuePoint** const ii = m_cue_points;
- CuePoint** i = ii;
-
- CuePoint** const jj = ii + m_count;
- CuePoint** j = jj;
-
- pCP = *i;
- assert(pCP);
-
- if (time_ns <= pCP->GetTime(m_pSegment))
- {
- pTP = pCP->Find(pTrack);
- return (pTP != NULL);
- }
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) <= time_ns
- //[i, j) ?
- //[j, jj) > time_ns
-
- CuePoint** const k = i + (j - i) / 2;
- assert(k < jj);
-
- CuePoint* const pCP = *k;
- assert(pCP);
-
- const long long t = pCP->GetTime(m_pSegment);
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i <= jj);
- assert(i > ii);
-
- pCP = *--i;
- assert(pCP);
- assert(pCP->GetTime(m_pSegment) <= time_ns);
-#endif
-
- //TODO: here and elsewhere, it's probably not correct to search
- //for the cue point with this time, and then search for a matching
- //track. In principle, the matching track could be on some earlier
- //cue point, and with our current algorithm, we'd miss it. To make
- //this bullet-proof, we'd need to create a secondary structure,
- //with a list of cue points that apply to a track, and then search
- //that track-based structure for a matching cue point.
-
- pTP = pCP->Find(pTrack);
- return (pTP != NULL);
-}
-
-
-#if 0
-bool Cues::FindNext(
- long long time_ns,
- const Track* pTrack,
- const CuePoint*& pCP,
- const CuePoint::TrackPosition*& pTP) const
-{
- pCP = 0;
- pTP = 0;
-
- if (m_count == 0)
- return false;
-
- assert(m_cue_points);
-
- const CuePoint* const* const ii = m_cue_points;
- const CuePoint* const* i = ii;
-
- const CuePoint* const* const jj = ii + m_count;
- const CuePoint* const* j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) <= time_ns
- //[i, j) ?
- //[j, jj) > time_ns
-
- const CuePoint* const* const k = i + (j - i) / 2;
- assert(k < jj);
-
- pCP = *k;
- assert(pCP);
-
- const long long t = pCP->GetTime(m_pSegment);
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i <= jj);
-
- if (i >= jj) //time_ns is greater than max cue point
- return false;
-
- pCP = *i;
- assert(pCP);
- assert(pCP->GetTime(m_pSegment) > time_ns);
-
- pTP = pCP->Find(pTrack);
- return (pTP != NULL);
-}
-#endif
-
-
-const CuePoint* Cues::GetFirst() const
-{
- if (m_cue_points == NULL)
- return NULL;
-
- if (m_count == 0)
- return NULL;
-
-#if 0
- LoadCuePoint(); //init cues
-
- const size_t count = m_count + m_preload_count;
-
- if (count == 0) //weird
- return NULL;
-#endif
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
-
- CuePoint* const pCP = pp[0];
- assert(pCP);
- assert(pCP->GetTimeCode() >= 0);
-
- return pCP;
-}
-
-
-const CuePoint* Cues::GetLast() const
-{
- if (m_cue_points == NULL)
- return NULL;
-
- if (m_count <= 0)
- return NULL;
-
-#if 0
- LoadCuePoint(); //init cues
-
- const size_t count = m_count + m_preload_count;
-
- if (count == 0) //weird
- return NULL;
-
- const size_t index = count - 1;
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
-
- CuePoint* const pCP = pp[index];
- assert(pCP);
-
- pCP->Load(m_pSegment->m_pReader);
- assert(pCP->GetTimeCode() >= 0);
-#else
- const long index = m_count - 1;
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
-
- CuePoint* const pCP = pp[index];
- assert(pCP);
- assert(pCP->GetTimeCode() >= 0);
-#endif
-
- return pCP;
-}
-
-
-const CuePoint* Cues::GetNext(const CuePoint* pCurr) const
-{
- if (pCurr == NULL)
- return NULL;
-
- assert(pCurr->GetTimeCode() >= 0);
- assert(m_cue_points);
- assert(m_count >= 1);
-
-#if 0
- const size_t count = m_count + m_preload_count;
-
- size_t index = pCurr->m_index;
- assert(index < count);
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
- assert(pp[index] == pCurr);
-
- ++index;
-
- if (index >= count)
- return NULL;
-
- CuePoint* const pNext = pp[index];
- assert(pNext);
-
- pNext->Load(m_pSegment->m_pReader);
-#else
- long index = pCurr->m_index;
- assert(index < m_count);
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
- assert(pp[index] == pCurr);
-
- ++index;
-
- if (index >= m_count)
- return NULL;
-
- CuePoint* const pNext = pp[index];
- assert(pNext);
- assert(pNext->GetTimeCode() >= 0);
-#endif
-
- return pNext;
-}
-
-
-const BlockEntry* Cues::GetBlock(
- const CuePoint* pCP,
- const CuePoint::TrackPosition* pTP) const
-{
- if (pCP == NULL)
- return NULL;
-
- if (pTP == NULL)
- return NULL;
-
- return m_pSegment->GetBlock(*pCP, *pTP);
-}
-
-
-const BlockEntry* Segment::GetBlock(
- const CuePoint& cp,
- const CuePoint::TrackPosition& tp)
-{
- Cluster** const ii = m_clusters;
- Cluster** i = ii;
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- Cluster** const jj = ii + count;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) < pTP->m_pos
- //[i, j) ?
- //[j, jj) > pTP->m_pos
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- Cluster* const pCluster = *k;
- assert(pCluster);
-
- //const long long pos_ = pCluster->m_pos;
- //assert(pos_);
- //const long long pos = pos_ * ((pos_ < 0) ? -1 : 1);
-
- const long long pos = pCluster->GetPosition();
- assert(pos >= 0);
-
- if (pos < tp.m_pos)
- i = k + 1;
- else if (pos > tp.m_pos)
- j = k;
- else
- return pCluster->GetEntry(cp, tp);
- }
-
- assert(i == j);
- //assert(Cluster::HasBlockEntries(this, tp.m_pos));
-
- Cluster* const pCluster = Cluster::Create(this, -1, tp.m_pos); //, -1);
- assert(pCluster);
-
- const ptrdiff_t idx = i - m_clusters;
-
- PreloadCluster(pCluster, idx);
- assert(m_clusters);
- assert(m_clusterPreloadCount > 0);
- assert(m_clusters[idx] == pCluster);
-
- return pCluster->GetEntry(cp, tp);
-}
-
-
-const Cluster* Segment::FindOrPreloadCluster(long long requested_pos)
-{
- if (requested_pos < 0)
- return 0;
-
- Cluster** const ii = m_clusters;
- Cluster** i = ii;
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- Cluster** const jj = ii + count;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) < pTP->m_pos
- //[i, j) ?
- //[j, jj) > pTP->m_pos
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- Cluster* const pCluster = *k;
- assert(pCluster);
-
- //const long long pos_ = pCluster->m_pos;
- //assert(pos_);
- //const long long pos = pos_ * ((pos_ < 0) ? -1 : 1);
-
- const long long pos = pCluster->GetPosition();
- assert(pos >= 0);
-
- if (pos < requested_pos)
- i = k + 1;
- else if (pos > requested_pos)
- j = k;
- else
- return pCluster;
- }
-
- assert(i == j);
- //assert(Cluster::HasBlockEntries(this, tp.m_pos));
-
- Cluster* const pCluster = Cluster::Create(
- this,
- -1,
- requested_pos);
- //-1);
- assert(pCluster);
-
- const ptrdiff_t idx = i - m_clusters;
-
- PreloadCluster(pCluster, idx);
- assert(m_clusters);
- assert(m_clusterPreloadCount > 0);
- assert(m_clusters[idx] == pCluster);
-
- return pCluster;
-}
-
-
-CuePoint::CuePoint(long idx, long long pos) :
- m_element_start(0),
- m_element_size(0),
- m_index(idx),
- m_timecode(-1 * pos),
- m_track_positions(NULL),
- m_track_positions_count(0)
-{
- assert(pos > 0);
-}
-
-
-CuePoint::~CuePoint()
-{
- delete[] m_track_positions;
-}
-
-
-void CuePoint::Load(IMkvReader* pReader)
-{
- //odbgstream os;
- //os << "CuePoint::Load(begin): timecode=" << m_timecode << endl;
-
- if (m_timecode >= 0) //already loaded
- return;
-
- assert(m_track_positions == NULL);
- assert(m_track_positions_count == 0);
-
- long long pos_ = -m_timecode;
- const long long element_start = pos_;
-
- long long stop;
-
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos_, len);
- assert(id == 0x3B); //CuePoint ID
- if (id != 0x3B)
- return;
-
- pos_ += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos_, len);
- assert(size >= 0);
-
- pos_ += len; //consume Size field
- //pos_ now points to start of payload
-
- stop = pos_ + size;
- }
-
- const long long element_size = stop - element_start;
-
- long long pos = pos_;
-
- //First count number of track positions
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x33) //CueTime ID
- m_timecode = UnserializeUInt(pReader, pos, size);
-
- else if (id == 0x37) //CueTrackPosition(s) ID
- ++m_track_positions_count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(m_timecode >= 0);
- assert(m_track_positions_count > 0);
-
- //os << "CuePoint::Load(cont'd): idpos=" << idpos
- // << " timecode=" << m_timecode
- // << endl;
-
- m_track_positions = new TrackPosition[m_track_positions_count];
-
- //Now parse track positions
-
- TrackPosition* p = m_track_positions;
- pos = pos_;
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x37) //CueTrackPosition(s) ID
- {
- TrackPosition& tp = *p++;
- tp.Parse(pReader, pos, size);
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(size_t(p - m_track_positions) == m_track_positions_count);
-
- m_element_start = element_start;
- m_element_size = element_size;
-}
-
-
-
-void CuePoint::TrackPosition::Parse(
- IMkvReader* pReader,
- long long start_,
- long long size_)
-{
- const long long stop = start_ + size_;
- long long pos = start_;
-
- m_track = -1;
- m_pos = -1;
- m_block = 1; //default
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x77) //CueTrack ID
- m_track = UnserializeUInt(pReader, pos, size);
-
- else if (id == 0x71) //CueClusterPos ID
- m_pos = UnserializeUInt(pReader, pos, size);
-
- else if (id == 0x1378) //CueBlockNumber
- m_block = UnserializeUInt(pReader, pos, size);
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(m_pos >= 0);
- assert(m_track > 0);
- //assert(m_block > 0);
-}
-
-
-const CuePoint::TrackPosition* CuePoint::Find(const Track* pTrack) const
-{
- assert(pTrack);
-
- const long long n = pTrack->GetNumber();
-
- const TrackPosition* i = m_track_positions;
- const TrackPosition* const j = i + m_track_positions_count;
-
- while (i != j)
- {
- const TrackPosition& p = *i++;
-
- if (p.m_track == n)
- return &p;
- }
-
- return NULL; //no matching track number found
-}
-
-
-long long CuePoint::GetTimeCode() const
-{
- return m_timecode;
-}
-
-long long CuePoint::GetTime(const Segment* pSegment) const
-{
- assert(pSegment);
- assert(m_timecode >= 0);
-
- const SegmentInfo* const pInfo = pSegment->GetInfo();
- assert(pInfo);
-
- const long long scale = pInfo->GetTimeCodeScale();
- assert(scale >= 1);
-
- const long long time = scale * m_timecode;
-
- return time;
-}
-
-
-#if 0
-long long Segment::Unparsed() const
-{
- if (m_size < 0)
- return LLONG_MAX;
-
- const long long stop = m_start + m_size;
-
- const long long result = stop - m_pos;
- assert(result >= 0);
-
- return result;
-}
-#else
-bool Segment::DoneParsing() const
-{
- if (m_size < 0)
- {
- long long total, avail;
-
- const int status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return true; //must assume done
-
- if (total < 0)
- return false; //assume live stream
-
- return (m_pos >= total);
- }
-
- const long long stop = m_start + m_size;
-
- return (m_pos >= stop);
-}
-#endif
-
-
-const Cluster* Segment::GetFirst() const
-{
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return &m_eos;
-
- Cluster* const pCluster = m_clusters[0];
- assert(pCluster);
-
- return pCluster;
-}
-
-
-const Cluster* Segment::GetLast() const
-{
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return &m_eos;
-
- const long idx = m_clusterCount - 1;
-
- Cluster* const pCluster = m_clusters[idx];
- assert(pCluster);
-
- return pCluster;
-}
-
-
-unsigned long Segment::GetCount() const
-{
- return m_clusterCount;
-}
-
-
-const Cluster* Segment::GetNext(const Cluster* pCurr)
-{
- assert(pCurr);
- assert(pCurr != &m_eos);
- assert(m_clusters);
-
- long idx = pCurr->m_index;
-
- if (idx >= 0)
- {
- assert(m_clusterCount > 0);
- assert(idx < m_clusterCount);
- assert(pCurr == m_clusters[idx]);
-
- ++idx;
-
- if (idx >= m_clusterCount)
- return &m_eos; //caller will LoadCluster as desired
-
- Cluster* const pNext = m_clusters[idx];
- assert(pNext);
- assert(pNext->m_index >= 0);
- assert(pNext->m_index == idx);
-
- return pNext;
- }
-
- assert(m_clusterPreloadCount > 0);
-
- long long pos = pCurr->m_element_start;
-
- assert(m_size >= 0); //TODO
- const long long stop = m_start + m_size; //end of segment
-
- {
- long len;
-
- long long result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0);
- assert((pos + len) <= stop); //TODO
- if (result != 0)
- return NULL;
-
- const long long id = ReadUInt(m_pReader, pos, len);
- assert(id == 0x0F43B675); //Cluster ID
- if (id != 0x0F43B675)
- return NULL;
-
- pos += len; //consume ID
-
- //Read Size
- result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0); //TODO
- assert((pos + len) <= stop); //TODO
-
- const long long size = ReadUInt(m_pReader, pos, len);
- assert(size > 0); //TODO
- //assert((pCurr->m_size <= 0) || (pCurr->m_size == size));
-
- pos += len; //consume length of size of element
- assert((pos + size) <= stop); //TODO
-
- //Pos now points to start of payload
-
- pos += size; //consume payload
- }
-
- long long off_next = 0;
-
- while (pos < stop)
- {
- long len;
-
- long long result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0);
- assert((pos + len) <= stop); //TODO
- if (result != 0)
- return NULL;
-
- const long long idpos = pos; //pos of next (potential) cluster
-
- const long long id = ReadUInt(m_pReader, idpos, len);
- assert(id > 0); //TODO
-
- pos += len; //consume ID
-
- //Read Size
- result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0); //TODO
- assert((pos + len) <= stop); //TODO
-
- const long long size = ReadUInt(m_pReader, pos, len);
- assert(size >= 0); //TODO
-
- pos += len; //consume length of size of element
- assert((pos + size) <= stop); //TODO
-
- //Pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- if (id == 0x0F43B675) //Cluster ID
- {
- const long long off_next_ = idpos - m_start;
-
- long long pos_;
- long len_;
-
- const long status = Cluster::HasBlockEntries(
- this,
- off_next_,
- pos_,
- len_);
-
- assert(status >= 0);
-
- if (status > 0)
- {
- off_next = off_next_;
- break;
- }
- }
-
- pos += size; //consume payload
- }
-
- if (off_next <= 0)
- return 0;
-
- Cluster** const ii = m_clusters + m_clusterCount;
- Cluster** i = ii;
-
- Cluster** const jj = ii + m_clusterPreloadCount;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[0, i) < pos_next
- //[i, j) ?
- //[j, jj) > pos_next
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- Cluster* const pNext = *k;
- assert(pNext);
- assert(pNext->m_index < 0);
-
- //const long long pos_ = pNext->m_pos;
- //assert(pos_);
- //pos = pos_ * ((pos_ < 0) ? -1 : 1);
-
- pos = pNext->GetPosition();
-
- if (pos < off_next)
- i = k + 1;
- else if (pos > off_next)
- j = k;
- else
- return pNext;
- }
-
- assert(i == j);
-
- Cluster* const pNext = Cluster::Create(this,
- -1,
- off_next);
- assert(pNext);
-
- const ptrdiff_t idx_next = i - m_clusters; //insertion position
-
- PreloadCluster(pNext, idx_next);
- assert(m_clusters);
- assert(idx_next < m_clusterSize);
- assert(m_clusters[idx_next] == pNext);
-
- return pNext;
-}
-
-
-long Segment::ParseNext(
- const Cluster* pCurr,
- const Cluster*& pResult,
- long long& pos,
- long& len)
-{
- assert(pCurr);
- assert(!pCurr->EOS());
- assert(m_clusters);
-
- pResult = 0;
-
- if (pCurr->m_index >= 0) //loaded (not merely preloaded)
- {
- assert(m_clusters[pCurr->m_index] == pCurr);
-
- const long next_idx = pCurr->m_index + 1;
-
- if (next_idx < m_clusterCount)
- {
- pResult = m_clusters[next_idx];
- return 0; //success
- }
-
- //curr cluster is last among loaded
-
- const long result = LoadCluster(pos, len);
-
- if (result < 0) //error or underflow
- return result;
-
- if (result > 0) //no more clusters
- {
- //pResult = &m_eos;
- return 1;
- }
-
- pResult = GetLast();
- return 0; //success
- }
-
- assert(m_pos > 0);
-
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- //interrogate curr cluster
-
- pos = pCurr->m_element_start;
-
- if (pCurr->m_element_size >= 0)
- pos += pCurr->m_element_size;
- else
- {
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(m_pReader, pos, len);
-
- if (id != 0x0F43B675) //weird: not Cluster ID
- return -1;
-
- pos += len; //consume ID
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size) //TODO: should never happen
- return E_FILE_FORMAT_INVALID; //TODO: resolve this
-
- //assert((pCurr->m_size <= 0) || (pCurr->m_size == size));
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- //Pos now points to start of payload
-
- pos += size; //consume payload (that is, the current cluster)
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- //By consuming the payload, we are assuming that the curr
- //cluster isn't interesting. That is, we don't bother checking
- //whether the payload of the curr cluster is less than what
- //happens to be available (obtained via IMkvReader::Length).
- //Presumably the caller has already dispensed with the current
- //cluster, and really does want the next cluster.
- }
-
- //pos now points to just beyond the last fully-loaded cluster
-
- for (;;)
- {
- const long status = DoParseNext(pResult, pos, len);
-
- if (status <= 1)
- return status;
- }
-}
-
-
-long Segment::DoParseNext(
- const Cluster*& pResult,
- long long& pos,
- long& len)
-{
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- //Parse next cluster. This is strictly a parsing activity.
- //Creation of a new cluster object happens later, after the
- //parsing is done.
-
- long long off_next = 0;
- long long cluster_size = -1;
-
- for (;;)
- {
- if ((total >= 0) && (pos >= total))
- return 1; //EOF
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- return 1; //EOF
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos; //absolute
- const long long idoff = pos - m_start; //relative
-
- const long long id = ReadUInt(m_pReader, idpos, len); //absolute
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0) //weird
- return -1; //generic error
-
- pos += len; //consume ID
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume length of size of element
-
- //Pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if ((segment_stop >= 0) &&
- (size != unknown_size) &&
- ((pos + size) > segment_stop))
- {
- return E_FILE_FORMAT_INVALID;
- }
-
- if (id == 0x0C53BB6B) //Cues ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- const long long element_stop = pos + size;
-
- if ((segment_stop >= 0) && (element_stop > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- const long long element_start = idpos;
- const long long element_size = element_stop - element_start;
-
- if (m_pCues == NULL)
- {
- m_pCues = new Cues(this,
- pos,
- size,
- element_start,
- element_size);
- assert(m_pCues); //TODO
- }
-
- pos += size; //consume payload
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- continue;
- }
-
- if (id != 0x0F43B675) //not a Cluster ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- continue;
- }
-
-#if 0 //this is commented-out to support incremental cluster parsing
- len = static_cast<long>(size);
-
- if (element_stop > avail)
- return E_BUFFER_NOT_FULL;
-#endif
-
- //We have a cluster.
-
- off_next = idoff;
-
- if (size != unknown_size)
- cluster_size = size;
-
- break;
- }
-
- assert(off_next > 0); //have cluster
-
- //We have parsed the next cluster.
- //We have not created a cluster object yet. What we need
- //to do now is determine whether it has already be preloaded
- //(in which case, an object for this cluster has already been
- //created), and if not, create a new cluster object.
-
- Cluster** const ii = m_clusters + m_clusterCount;
- Cluster** i = ii;
-
- Cluster** const jj = ii + m_clusterPreloadCount;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[0, i) < pos_next
- //[i, j) ?
- //[j, jj) > pos_next
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- const Cluster* const pNext = *k;
- assert(pNext);
- assert(pNext->m_index < 0);
-
- pos = pNext->GetPosition();
- assert(pos >= 0);
-
- if (pos < off_next)
- i = k + 1;
- else if (pos > off_next)
- j = k;
- else
- {
- pResult = pNext;
- return 0; //success
- }
- }
-
- assert(i == j);
-
- long long pos_;
- long len_;
-
- status = Cluster::HasBlockEntries(this, off_next, pos_, len_);
-
- if (status < 0) //error or underflow
- {
- pos = pos_;
- len = len_;
-
- return status;
- }
-
- if (status > 0) //means "found at least one block entry"
- {
- Cluster* const pNext = Cluster::Create(this,
- -1, //preloaded
- off_next);
- //element_size);
- assert(pNext);
-
- const ptrdiff_t idx_next = i - m_clusters; //insertion position
-
- PreloadCluster(pNext, idx_next);
- assert(m_clusters);
- assert(idx_next < m_clusterSize);
- assert(m_clusters[idx_next] == pNext);
-
- pResult = pNext;
- return 0; //success
- }
-
- //status == 0 means "no block entries found"
-
- if (cluster_size < 0) //unknown size
- {
- const long long payload_pos = pos; //absolute pos of cluster payload
-
- for (;;) //determine cluster size
- {
- if ((total >= 0) && (pos >= total))
- break;
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- break; //no more clusters
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- if (id == 0x0C53BB6B) //Cues ID
- break;
-
- pos += len; //consume ID (of sub-element)
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field of element
-
- //pos now points to start of sub-element's payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not allowed for sub-elements
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop)) //weird
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload of sub-element
- assert((segment_stop < 0) || (pos <= segment_stop));
- } //determine cluster size
-
- cluster_size = pos - payload_pos;
- assert(cluster_size >= 0); //TODO: handle cluster_size = 0
-
- pos = payload_pos; //reset and re-parse original cluster
- }
-
- pos += cluster_size; //consume payload
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- return 2; //try to find a cluster that follows next
-}
-
-
-const Cluster* Segment::FindCluster(long long time_ns) const
-{
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return &m_eos;
-
- {
- Cluster* const pCluster = m_clusters[0];
- assert(pCluster);
- assert(pCluster->m_index == 0);
-
- if (time_ns <= pCluster->GetTime())
- return pCluster;
- }
-
- //Binary search of cluster array
-
- long i = 0;
- long j = m_clusterCount;
-
- while (i < j)
- {
- //INVARIANT:
- //[0, i) <= time_ns
- //[i, j) ?
- //[j, m_clusterCount) > time_ns
-
- const long k = i + (j - i) / 2;
- assert(k < m_clusterCount);
-
- Cluster* const pCluster = m_clusters[k];
- assert(pCluster);
- assert(pCluster->m_index == k);
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i > 0);
- assert(i <= m_clusterCount);
-
- const long k = i - 1;
-
- Cluster* const pCluster = m_clusters[k];
- assert(pCluster);
- assert(pCluster->m_index == k);
- assert(pCluster->GetTime() <= time_ns);
-
- return pCluster;
-}
-
-
-#if 0
-const BlockEntry* Segment::Seek(
- long long time_ns,
- const Track* pTrack) const
-{
- assert(pTrack);
-
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return pTrack->GetEOS();
-
- Cluster** const i = m_clusters;
- assert(i);
-
- {
- Cluster* const pCluster = *i;
- assert(pCluster);
- assert(pCluster->m_index == 0); //m_clusterCount > 0
- assert(pCluster->m_pSegment == this);
-
- if (time_ns <= pCluster->GetTime())
- return pCluster->GetEntry(pTrack);
- }
-
- Cluster** const j = i + m_clusterCount;
-
- if (pTrack->GetType() == 2) //audio
- {
- //TODO: we could decide to use cues for this, as we do for video.
- //But we only use it for video because looking around for a keyframe
- //can get expensive. Audio doesn't require anything special so a
- //straight cluster search is good enough (we assume).
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- Cluster* const pCluster = *mid;
- assert(pCluster);
- assert(pCluster->m_index == long(mid - m_clusters));
- assert(pCluster->m_pSegment == this);
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- while (lo > i)
- {
- Cluster* const pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- const BlockEntry* const pBE = pCluster->GetEntry(pTrack);
-
- if ((pBE != 0) && !pBE->EOS())
- return pBE;
-
- //landed on empty cluster (no entries)
- }
-
- return pTrack->GetEOS(); //weird
- }
-
- assert(pTrack->GetType() == 1); //video
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- Cluster* const pCluster = *mid;
- assert(pCluster);
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- Cluster* pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- {
- const BlockEntry* const pBE = pCluster->GetEntry(pTrack, time_ns);
-
- if ((pBE != 0) && !pBE->EOS()) //found a keyframe
- return pBE;
- }
-
- const VideoTrack* const pVideo = static_cast<const VideoTrack*>(pTrack);
-
- while (lo != i)
- {
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- const BlockEntry* const pBlockEntry = pCluster->GetMaxKey(pVideo);
-
- if ((pBlockEntry != 0) && !pBlockEntry->EOS())
- return pBlockEntry;
- }
-
- //weird: we're on the first cluster, but no keyframe found
- //should never happen but we must return something anyway
-
- return pTrack->GetEOS();
-}
-#endif
-
-
-#if 0
-bool Segment::SearchCues(
- long long time_ns,
- Track* pTrack,
- Cluster*& pCluster,
- const BlockEntry*& pBlockEntry,
- const CuePoint*& pCP,
- const CuePoint::TrackPosition*& pTP)
-{
- if (pTrack->GetType() != 1) //not video
- return false; //TODO: for now, just handle video stream
-
- if (m_pCues == NULL)
- return false;
-
- if (!m_pCues->Find(time_ns, pTrack, pCP, pTP))
- return false; //weird
-
- assert(pCP);
- assert(pTP);
- assert(pTP->m_track == pTrack->GetNumber());
-
- //We have the cue point and track position we want,
- //so we now need to search for the cluster having
- //the indicated position.
-
- return GetCluster(pCP, pTP, pCluster, pBlockEntry);
-}
-#endif
-
-
-const Tracks* Segment::GetTracks() const
-{
- return m_pTracks;
-}
-
-
-const SegmentInfo* Segment::GetInfo() const
-{
- return m_pInfo;
-}
-
-
-const Cues* Segment::GetCues() const
-{
- return m_pCues;
-}
-
-
-const Chapters* Segment::GetChapters() const
-{
- return m_pChapters;
-}
-
-
-const SeekHead* Segment::GetSeekHead() const
-{
- return m_pSeekHead;
-}
-
-
-long long Segment::GetDuration() const
-{
- assert(m_pInfo);
- return m_pInfo->GetDuration();
-}
-
-
-Chapters::Chapters(
- Segment* pSegment,
- long long payload_start,
- long long payload_size,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(payload_start),
- m_size(payload_size),
- m_element_start(element_start),
- m_element_size(element_size),
- m_editions(NULL),
- m_editions_size(0),
- m_editions_count(0)
-{
-}
-
-
-Chapters::~Chapters()
-{
- while (m_editions_count > 0)
- {
- Edition& e = m_editions[--m_editions_count];
- e.Clear();
- }
-}
-
-
-long Chapters::Parse()
-{
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = m_start; // payload start
- const long long stop = pos + m_size; // payload stop
-
- while (pos < stop)
- {
- long long id, size;
-
- long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) // error
- return status;
-
- if (size == 0) // weird
- continue;
-
- if (id == 0x05B9) // EditionEntry ID
- {
- status = ParseEdition(pos, size);
-
- if (status < 0) // error
- return status;
- }
-
- pos += size;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
- return 0;
-}
-
-
-int Chapters::GetEditionCount() const
-{
- return m_editions_count;
-}
-
-
-const Chapters::Edition* Chapters::GetEdition(int idx) const
-{
- if (idx < 0)
- return NULL;
-
- if (idx >= m_editions_count)
- return NULL;
-
- return m_editions + idx;
-}
-
-
-bool Chapters::ExpandEditionsArray()
-{
- if (m_editions_size > m_editions_count)
- return true; // nothing else to do
-
- const int size = (m_editions_size == 0) ? 1 : 2 * m_editions_size;
-
- Edition* const editions = new (std::nothrow) Edition[size];
-
- if (editions == NULL)
- return false;
-
- for (int idx = 0; idx < m_editions_count; ++idx)
- {
- m_editions[idx].ShallowCopy(editions[idx]);
- }
-
- delete[] m_editions;
- m_editions = editions;
-
- m_editions_size = size;
- return true;
-}
-
-
-long Chapters::ParseEdition(
- long long pos,
- long long size)
-{
- if (!ExpandEditionsArray())
- return -1;
-
- Edition& e = m_editions[m_editions_count++];
- e.Init();
-
- return e.Parse(m_pSegment->m_pReader, pos, size);
-}
-
-
-Chapters::Edition::Edition()
-{
-}
-
-
-Chapters::Edition::~Edition()
-{
-}
-
-
-int Chapters::Edition::GetAtomCount() const
-{
- return m_atoms_count;
-}
-
-
-const Chapters::Atom* Chapters::Edition::GetAtom(int index) const
-{
- if (index < 0)
- return NULL;
-
- if (index >= m_atoms_count)
- return NULL;
-
- return m_atoms + index;
-}
-
-
-void Chapters::Edition::Init()
-{
- m_atoms = NULL;
- m_atoms_size = 0;
- m_atoms_count = 0;
-}
-
-
-void Chapters::Edition::ShallowCopy(Edition& rhs) const
-{
- rhs.m_atoms = m_atoms;
- rhs.m_atoms_size = m_atoms_size;
- rhs.m_atoms_count = m_atoms_count;
-}
-
-
-void Chapters::Edition::Clear()
-{
- while (m_atoms_count > 0)
- {
- Atom& a = m_atoms[--m_atoms_count];
- a.Clear();
- }
-
- delete[] m_atoms;
- m_atoms = NULL;
-
- m_atoms_size = 0;
-}
-
-
-long Chapters::Edition::Parse(
- IMkvReader* pReader,
- long long pos,
- long long size)
-{
- const long long stop = pos + size;
-
- while (pos < stop)
- {
- long long id, size;
-
- long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) // error
- return status;
-
- if (size == 0) // weird
- continue;
-
- if (id == 0x36) // Atom ID
- {
- status = ParseAtom(pReader, pos, size);
-
- if (status < 0) // error
- return status;
- }
-
- pos += size;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
- return 0;
-}
-
-
-long Chapters::Edition::ParseAtom(
- IMkvReader* pReader,
- long long pos,
- long long size)
-{
- if (!ExpandAtomsArray())
- return -1;
-
- Atom& a = m_atoms[m_atoms_count++];
- a.Init();
-
- return a.Parse(pReader, pos, size);
-}
-
-
-bool Chapters::Edition::ExpandAtomsArray()
-{
- if (m_atoms_size > m_atoms_count)
- return true; // nothing else to do
-
- const int size = (m_atoms_size == 0) ? 1 : 2 * m_atoms_size;
-
- Atom* const atoms = new (std::nothrow) Atom[size];
-
- if (atoms == NULL)
- return false;
-
- for (int idx = 0; idx < m_atoms_count; ++idx)
- {
- m_atoms[idx].ShallowCopy(atoms[idx]);
- }
-
- delete[] m_atoms;
- m_atoms = atoms;
-
- m_atoms_size = size;
- return true;
-}
-
-
-Chapters::Atom::Atom()
-{
-}
-
-
-Chapters::Atom::~Atom()
-{
-}
-
-
-unsigned long long Chapters::Atom::GetUID() const
-{
- return m_uid;
-}
-
-
-const char* Chapters::Atom::GetStringUID() const
-{
- return m_string_uid;
-}
-
-
-long long Chapters::Atom::GetStartTimecode() const
-{
- return m_start_timecode;
-}
-
-
-long long Chapters::Atom::GetStopTimecode() const
-{
- return m_stop_timecode;
-}
-
-
-long long Chapters::Atom::GetStartTime(const Chapters* pChapters) const
-{
- return GetTime(pChapters, m_start_timecode);
-}
-
-
-long long Chapters::Atom::GetStopTime(const Chapters* pChapters) const
-{
- return GetTime(pChapters, m_stop_timecode);
-}
-
-
-int Chapters::Atom::GetDisplayCount() const
-{
- return m_displays_count;
-}
-
-
-const Chapters::Display* Chapters::Atom::GetDisplay(int index) const
-{
- if (index < 0)
- return NULL;
-
- if (index >= m_displays_count)
- return NULL;
-
- return m_displays + index;
-}
-
-
-void Chapters::Atom::Init()
-{
- m_string_uid = NULL;
- m_uid = 0;
- m_start_timecode = -1;
- m_stop_timecode = -1;
-
- m_displays = NULL;
- m_displays_size = 0;
- m_displays_count = 0;
-}
-
-
-void Chapters::Atom::ShallowCopy(Atom& rhs) const
-{
- rhs.m_string_uid = m_string_uid;
- rhs.m_uid = m_uid;
- rhs.m_start_timecode = m_start_timecode;
- rhs.m_stop_timecode = m_stop_timecode;
-
- rhs.m_displays = m_displays;
- rhs.m_displays_size = m_displays_size;
- rhs.m_displays_count = m_displays_count;
-}
-
-
-void Chapters::Atom::Clear()
-{
- delete[] m_string_uid;
- m_string_uid = NULL;
-
- while (m_displays_count > 0)
- {
- Display& d = m_displays[--m_displays_count];
- d.Clear();
- }
-
- delete[] m_displays;
- m_displays = NULL;
-
- m_displays_size = 0;
-}
-
-
-long Chapters::Atom::Parse(
- IMkvReader* pReader,
- long long pos,
- long long size)
-{
- const long long stop = pos + size;
-
- while (pos < stop)
- {
- long long id, size;
-
- long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) // error
- return status;
-
- if (size == 0) // weird
- continue;
-
- if (id == 0x00) // Display ID
- {
- status = ParseDisplay(pReader, pos, size);
-
- if (status < 0) // error
- return status;
- }
- else if (id == 0x1654) // StringUID ID
- {
- status = UnserializeString(pReader, pos, size, m_string_uid);
-
- if (status < 0) // error
- return status;
- }
- else if (id == 0x33C4) // UID ID
- {
- const long long val = UnserializeUInt(pReader, pos, size);
-
- if (val < 0) // error
- return static_cast<long>(val);
-
- m_uid = val;
- }
- else if (id == 0x11) // TimeStart ID
- {
- const long long val = UnserializeUInt(pReader, pos, size);
-
- if (val < 0) // error
- return static_cast<long>(val);
-
- m_start_timecode = val;
- }
- else if (id == 0x12) // TimeEnd ID
- {
- const long long val = UnserializeUInt(pReader, pos, size);
-
- if (val < 0) // error
- return static_cast<long>(val);
-
- m_stop_timecode = val;
- }
-
- pos += size;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
- return 0;
-}
-
-
-long long Chapters::Atom::GetTime(
- const Chapters* pChapters,
- long long timecode)
-{
- if (pChapters == NULL)
- return -1;
-
- Segment* const pSegment = pChapters->m_pSegment;
-
- if (pSegment == NULL) // weird
- return -1;
-
- const SegmentInfo* const pInfo = pSegment->GetInfo();
-
- if (pInfo == NULL)
- return -1;
-
- const long long timecode_scale = pInfo->GetTimeCodeScale();
-
- if (timecode_scale < 1) // weird
- return -1;
-
- if (timecode < 0)
- return -1;
-
- const long long result = timecode_scale * timecode;
-
- return result;
-}
-
-
-long Chapters::Atom::ParseDisplay(
- IMkvReader* pReader,
- long long pos,
- long long size)
-{
- if (!ExpandDisplaysArray())
- return -1;
-
- Display& d = m_displays[m_displays_count++];
- d.Init();
-
- return d.Parse(pReader, pos, size);
-}
-
-
-bool Chapters::Atom::ExpandDisplaysArray()
-{
- if (m_displays_size > m_displays_count)
- return true; // nothing else to do
-
- const int size = (m_displays_size == 0) ? 1 : 2 * m_displays_size;
-
- Display* const displays = new (std::nothrow) Display[size];
-
- if (displays == NULL)
- return false;
-
- for (int idx = 0; idx < m_displays_count; ++idx)
- {
- m_displays[idx].ShallowCopy(displays[idx]);
- }
-
- delete[] m_displays;
- m_displays = displays;
-
- m_displays_size = size;
- return true;
-}
-
-
-Chapters::Display::Display()
-{
-}
-
-
-Chapters::Display::~Display()
-{
-}
-
-
-const char* Chapters::Display::GetString() const
-{
- return m_string;
-}
-
-
-const char* Chapters::Display::GetLanguage() const
-{
- return m_language;
-}
-
-
-const char* Chapters::Display::GetCountry() const
-{
- return m_country;
-}
-
-
-void Chapters::Display::Init()
-{
- m_string = NULL;
- m_language = NULL;
- m_country = NULL;
-}
-
-
-void Chapters::Display::ShallowCopy(Display& rhs) const
-{
- rhs.m_string = m_string;
- rhs.m_language = m_language;
- rhs.m_country = m_country;
-}
-
-
-void Chapters::Display::Clear()
-{
- delete[] m_string;
- m_string = NULL;
-
- delete[] m_language;
- m_language = NULL;
-
- delete[] m_country;
- m_country = NULL;
-}
-
-
-long Chapters::Display::Parse(
- IMkvReader* pReader,
- long long pos,
- long long size)
-{
- const long long stop = pos + size;
-
- while (pos < stop)
- {
- long long id, size;
-
- long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) // error
- return status;
-
- if (size == 0) // weird
- continue;
-
- if (id == 0x05) // ChapterString ID
- {
- status = UnserializeString(pReader, pos, size, m_string);
-
- if (status)
- return status;
- }
- else if (id == 0x037C) // ChapterLanguage ID
- {
- status = UnserializeString(pReader, pos, size, m_language);
-
- if (status)
- return status;
- }
- else if (id == 0x037E) // ChapterCountry ID
- {
- status = UnserializeString(pReader, pos, size, m_country);
-
- if (status)
- return status;
- }
-
- pos += size;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
- return 0;
-}
-
-
-SegmentInfo::SegmentInfo(
- Segment* pSegment,
- long long start,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_pMuxingAppAsUTF8(NULL),
- m_pWritingAppAsUTF8(NULL),
- m_pTitleAsUTF8(NULL)
-{
-}
-
-SegmentInfo::~SegmentInfo()
-{
- delete[] m_pMuxingAppAsUTF8;
- m_pMuxingAppAsUTF8 = NULL;
-
- delete[] m_pWritingAppAsUTF8;
- m_pWritingAppAsUTF8 = NULL;
-
- delete[] m_pTitleAsUTF8;
- m_pTitleAsUTF8 = NULL;
-}
-
-
-long SegmentInfo::Parse()
-{
- assert(m_pMuxingAppAsUTF8 == NULL);
- assert(m_pWritingAppAsUTF8 == NULL);
- assert(m_pTitleAsUTF8 == NULL);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = m_start;
- const long long stop = m_start + m_size;
-
- m_timecodeScale = 1000000;
- m_duration = -1;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x0AD7B1) //Timecode Scale
- {
- m_timecodeScale = UnserializeUInt(pReader, pos, size);
-
- if (m_timecodeScale <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0489) //Segment duration
- {
- const long status = UnserializeFloat(
- pReader,
- pos,
- size,
- m_duration);
-
- if (status < 0)
- return status;
-
- if (m_duration < 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0D80) //MuxingApp
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- m_pMuxingAppAsUTF8);
-
- if (status)
- return status;
- }
- else if (id == 0x1741) //WritingApp
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- m_pWritingAppAsUTF8);
-
- if (status)
- return status;
- }
- else if (id == 0x3BA9) //Title
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- m_pTitleAsUTF8);
-
- if (status)
- return status;
- }
-
- pos += size;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- return 0;
-}
-
-
-long long SegmentInfo::GetTimeCodeScale() const
-{
- return m_timecodeScale;
-}
-
-
-long long SegmentInfo::GetDuration() const
-{
- if (m_duration < 0)
- return -1;
-
- assert(m_timecodeScale >= 1);
-
- const double dd = double(m_duration) * double(m_timecodeScale);
- const long long d = static_cast<long long>(dd);
-
- return d;
-}
-
-const char* SegmentInfo::GetMuxingAppAsUTF8() const
-{
- return m_pMuxingAppAsUTF8;
-}
-
-
-const char* SegmentInfo::GetWritingAppAsUTF8() const
-{
- return m_pWritingAppAsUTF8;
-}
-
-const char* SegmentInfo::GetTitleAsUTF8() const
-{
- return m_pTitleAsUTF8;
-}
-
-///////////////////////////////////////////////////////////////
-// ContentEncoding element
-ContentEncoding::ContentCompression::ContentCompression()
- : algo(0),
- settings(NULL),
- settings_len(0) {
-}
-
-ContentEncoding::ContentCompression::~ContentCompression() {
- delete [] settings;
-}
-
-ContentEncoding::ContentEncryption::ContentEncryption()
- : algo(0),
- key_id(NULL),
- key_id_len(0),
- signature(NULL),
- signature_len(0),
- sig_key_id(NULL),
- sig_key_id_len(0),
- sig_algo(0),
- sig_hash_algo(0) {
-}
-
-ContentEncoding::ContentEncryption::~ContentEncryption() {
- delete [] key_id;
- delete [] signature;
- delete [] sig_key_id;
-}
-
-ContentEncoding::ContentEncoding()
- : compression_entries_(NULL),
- compression_entries_end_(NULL),
- encryption_entries_(NULL),
- encryption_entries_end_(NULL),
- encoding_order_(0),
- encoding_scope_(1),
- encoding_type_(0) {
-}
-
-ContentEncoding::~ContentEncoding() {
- ContentCompression** comp_i = compression_entries_;
- ContentCompression** const comp_j = compression_entries_end_;
-
- while (comp_i != comp_j) {
- ContentCompression* const comp = *comp_i++;
- delete comp;
- }
-
- delete [] compression_entries_;
-
- ContentEncryption** enc_i = encryption_entries_;
- ContentEncryption** const enc_j = encryption_entries_end_;
-
- while (enc_i != enc_j) {
- ContentEncryption* const enc = *enc_i++;
- delete enc;
- }
-
- delete [] encryption_entries_;
-}
-
-
-const ContentEncoding::ContentCompression*
-ContentEncoding::GetCompressionByIndex(unsigned long idx) const {
- const ptrdiff_t count = compression_entries_end_ - compression_entries_;
- assert(count >= 0);
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return compression_entries_[idx];
-}
-
-unsigned long ContentEncoding::GetCompressionCount() const {
- const ptrdiff_t count = compression_entries_end_ - compression_entries_;
- assert(count >= 0);
-
- return static_cast<unsigned long>(count);
-}
-
-const ContentEncoding::ContentEncryption*
-ContentEncoding::GetEncryptionByIndex(unsigned long idx) const {
- const ptrdiff_t count = encryption_entries_end_ - encryption_entries_;
- assert(count >= 0);
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return encryption_entries_[idx];
-}
-
-unsigned long ContentEncoding::GetEncryptionCount() const {
- const ptrdiff_t count = encryption_entries_end_ - encryption_entries_;
- assert(count >= 0);
-
- return static_cast<unsigned long>(count);
-}
-
-long ContentEncoding::ParseContentEncAESSettingsEntry(
- long long start,
- long long size,
- IMkvReader* pReader,
- ContentEncAESSettings* aes) {
- assert(pReader);
- assert(aes);
-
- long long pos = start;
- const long long stop = start + size;
-
- while (pos < stop) {
- long long id, size;
- const long status = ParseElementHeader(pReader,
- pos,
- stop,
- id,
- size);
- if (status < 0) //error
- return status;
-
- if (id == 0x7E8) {
- // AESSettingsCipherMode
- aes->cipher_mode = UnserializeUInt(pReader, pos, size);
- if (aes->cipher_mode != 1)
- return E_FILE_FORMAT_INVALID;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- return 0;
-}
-
-long ContentEncoding::ParseContentEncodingEntry(long long start,
- long long size,
- IMkvReader* pReader) {
- assert(pReader);
-
- long long pos = start;
- const long long stop = start + size;
-
- // Count ContentCompression and ContentEncryption elements.
- int compression_count = 0;
- int encryption_count = 0;
-
- while (pos < stop) {
- long long id, size;
- const long status = ParseElementHeader(pReader,
- pos,
- stop,
- id,
- size);
- if (status < 0) //error
- return status;
-
- if (id == 0x1034) // ContentCompression ID
- ++compression_count;
-
- if (id == 0x1035) // ContentEncryption ID
- ++encryption_count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- if (compression_count <= 0 && encryption_count <= 0)
- return -1;
-
- if (compression_count > 0) {
- compression_entries_ =
- new (std::nothrow) ContentCompression*[compression_count];
- if (!compression_entries_)
- return -1;
- compression_entries_end_ = compression_entries_;
- }
-
- if (encryption_count > 0) {
- encryption_entries_ =
- new (std::nothrow) ContentEncryption*[encryption_count];
- if (!encryption_entries_) {
- delete [] compression_entries_;
- return -1;
- }
- encryption_entries_end_ = encryption_entries_;
- }
-
- pos = start;
- while (pos < stop) {
- long long id, size;
- long status = ParseElementHeader(pReader,
- pos,
- stop,
- id,
- size);
- if (status < 0) //error
- return status;
-
- if (id == 0x1031) {
- // ContentEncodingOrder
- encoding_order_ = UnserializeUInt(pReader, pos, size);
- } else if (id == 0x1032) {
- // ContentEncodingScope
- encoding_scope_ = UnserializeUInt(pReader, pos, size);
- if (encoding_scope_ < 1)
- return -1;
- } else if (id == 0x1033) {
- // ContentEncodingType
- encoding_type_ = UnserializeUInt(pReader, pos, size);
- } else if (id == 0x1034) {
- // ContentCompression ID
- ContentCompression* const compression =
- new (std::nothrow) ContentCompression();
- if (!compression)
- return -1;
-
- status = ParseCompressionEntry(pos, size, pReader, compression);
- if (status) {
- delete compression;
- return status;
- }
- *compression_entries_end_++ = compression;
- } else if (id == 0x1035) {
- // ContentEncryption ID
- ContentEncryption* const encryption =
- new (std::nothrow) ContentEncryption();
- if (!encryption)
- return -1;
-
- status = ParseEncryptionEntry(pos, size, pReader, encryption);
- if (status) {
- delete encryption;
- return status;
- }
- *encryption_entries_end_++ = encryption;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
- return 0;
-}
-
-long ContentEncoding::ParseCompressionEntry(
- long long start,
- long long size,
- IMkvReader* pReader,
- ContentCompression* compression) {
- assert(pReader);
- assert(compression);
-
- long long pos = start;
- const long long stop = start + size;
-
- bool valid = false;
-
- while (pos < stop) {
- long long id, size;
- const long status = ParseElementHeader(pReader,
- pos,
- stop,
- id,
- size);
- if (status < 0) //error
- return status;
-
- if (id == 0x254) {
- // ContentCompAlgo
- long long algo = UnserializeUInt(pReader, pos, size);
- if (algo < 0)
- return E_FILE_FORMAT_INVALID;
- compression->algo = algo;
- valid = true;
- } else if (id == 0x255) {
- // ContentCompSettings
- if (size <= 0)
- return E_FILE_FORMAT_INVALID;
-
- const size_t buflen = static_cast<size_t>(size);
- typedef unsigned char* buf_t;
- const buf_t buf = new (std::nothrow) unsigned char[buflen];
- if (buf == NULL)
- return -1;
-
- const int read_status = pReader->Read(pos, buflen, buf);
- if (read_status) {
- delete [] buf;
- return status;
- }
-
- compression->settings = buf;
- compression->settings_len = buflen;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- // ContentCompAlgo is mandatory
- if (!valid)
- return E_FILE_FORMAT_INVALID;
-
- return 0;
-}
-
-long ContentEncoding::ParseEncryptionEntry(
- long long start,
- long long size,
- IMkvReader* pReader,
- ContentEncryption* encryption) {
- assert(pReader);
- assert(encryption);
-
- long long pos = start;
- const long long stop = start + size;
-
- while (pos < stop) {
- long long id, size;
- const long status = ParseElementHeader(pReader,
- pos,
- stop,
- id,
- size);
- if (status < 0) //error
- return status;
-
- if (id == 0x7E1) {
- // ContentEncAlgo
- encryption->algo = UnserializeUInt(pReader, pos, size);
- if (encryption->algo != 5)
- return E_FILE_FORMAT_INVALID;
- } else if (id == 0x7E2) {
- // ContentEncKeyID
- delete[] encryption->key_id;
- encryption->key_id = NULL;
- encryption->key_id_len = 0;
-
- if (size <= 0)
- return E_FILE_FORMAT_INVALID;
-
- const size_t buflen = static_cast<size_t>(size);
- typedef unsigned char* buf_t;
- const buf_t buf = new (std::nothrow) unsigned char[buflen];
- if (buf == NULL)
- return -1;
-
- const int read_status = pReader->Read(pos, buflen, buf);
- if (read_status) {
- delete [] buf;
- return status;
- }
-
- encryption->key_id = buf;
- encryption->key_id_len = buflen;
- } else if (id == 0x7E3) {
- // ContentSignature
- delete[] encryption->signature;
- encryption->signature = NULL;
- encryption->signature_len = 0;
-
- if (size <= 0)
- return E_FILE_FORMAT_INVALID;
-
- const size_t buflen = static_cast<size_t>(size);
- typedef unsigned char* buf_t;
- const buf_t buf = new (std::nothrow) unsigned char[buflen];
- if (buf == NULL)
- return -1;
-
- const int read_status = pReader->Read(pos, buflen, buf);
- if (read_status) {
- delete [] buf;
- return status;
- }
-
- encryption->signature = buf;
- encryption->signature_len = buflen;
- } else if (id == 0x7E4) {
- // ContentSigKeyID
- delete[] encryption->sig_key_id;
- encryption->sig_key_id = NULL;
- encryption->sig_key_id_len = 0;
-
- if (size <= 0)
- return E_FILE_FORMAT_INVALID;
-
- const size_t buflen = static_cast<size_t>(size);
- typedef unsigned char* buf_t;
- const buf_t buf = new (std::nothrow) unsigned char[buflen];
- if (buf == NULL)
- return -1;
-
- const int read_status = pReader->Read(pos, buflen, buf);
- if (read_status) {
- delete [] buf;
- return status;
- }
-
- encryption->sig_key_id = buf;
- encryption->sig_key_id_len = buflen;
- } else if (id == 0x7E5) {
- // ContentSigAlgo
- encryption->sig_algo = UnserializeUInt(pReader, pos, size);
- } else if (id == 0x7E6) {
- // ContentSigHashAlgo
- encryption->sig_hash_algo = UnserializeUInt(pReader, pos, size);
- } else if (id == 0x7E7) {
- // ContentEncAESSettings
- const long status = ParseContentEncAESSettingsEntry(
- pos,
- size,
- pReader,
- &encryption->aes_settings);
- if (status)
- return status;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- return 0;
-}
-
-Track::Track(
- Segment* pSegment,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_element_start(element_start),
- m_element_size(element_size),
- content_encoding_entries_(NULL),
- content_encoding_entries_end_(NULL)
-{
-}
-
-Track::~Track()
-{
- Info& info = const_cast<Info&>(m_info);
- info.Clear();
-
- ContentEncoding** i = content_encoding_entries_;
- ContentEncoding** const j = content_encoding_entries_end_;
-
- while (i != j) {
- ContentEncoding* const encoding = *i++;
- delete encoding;
- }
-
- delete [] content_encoding_entries_;
-}
-
-long Track::Create(
- Segment* pSegment,
- const Info& info,
- long long element_start,
- long long element_size,
- Track*& pResult)
-{
- if (pResult)
- return -1;
-
- Track* const pTrack = new (std::nothrow) Track(pSegment,
- element_start,
- element_size);
-
- if (pTrack == NULL)
- return -1; //generic error
-
- const int status = info.Copy(pTrack->m_info);
-
- if (status) // error
- {
- delete pTrack;
- return status;
- }
-
- pResult = pTrack;
- return 0; //success
-}
-
-Track::Info::Info():
- uid(0),
- defaultDuration(0),
- codecDelay(0),
- seekPreRoll(0),
- nameAsUTF8(NULL),
- language(NULL),
- codecId(NULL),
- codecNameAsUTF8(NULL),
- codecPrivate(NULL),
- codecPrivateSize(0),
- lacing(false)
-{
-}
-
-Track::Info::~Info()
-{
- Clear();
-}
-
-void Track::Info::Clear()
-{
- delete[] nameAsUTF8;
- nameAsUTF8 = NULL;
-
- delete[] language;
- language = NULL;
-
- delete[] codecId;
- codecId = NULL;
-
- delete[] codecPrivate;
- codecPrivate = NULL;
- codecPrivateSize = 0;
-
- delete[] codecNameAsUTF8;
- codecNameAsUTF8 = NULL;
-}
-
-int Track::Info::CopyStr(char* Info::*str, Info& dst_) const
-{
- if (str == static_cast<char* Info::*>(NULL))
- return -1;
-
- char*& dst = dst_.*str;
-
- if (dst) //should be NULL already
- return -1;
-
- const char* const src = this->*str;
-
- if (src == NULL)
- return 0;
-
- const size_t len = strlen(src);
-
- dst = new (std::nothrow) char[len+1];
-
- if (dst == NULL)
- return -1;
-
- strcpy(dst, src);
-
- return 0;
-}
-
-
-int Track::Info::Copy(Info& dst) const
-{
- if (&dst == this)
- return 0;
-
- dst.type = type;
- dst.number = number;
- dst.defaultDuration = defaultDuration;
- dst.codecDelay = codecDelay;
- dst.seekPreRoll = seekPreRoll;
- dst.uid = uid;
- dst.lacing = lacing;
- dst.settings = settings;
-
- //We now copy the string member variables from src to dst.
- //This involves memory allocation so in principle the operation
- //can fail (indeed, that's why we have Info::Copy), so we must
- //report this to the caller. An error return from this function
- //therefore implies that the copy was only partially successful.
-
- if (int status = CopyStr(&Info::nameAsUTF8, dst))
- return status;
-
- if (int status = CopyStr(&Info::language, dst))
- return status;
-
- if (int status = CopyStr(&Info::codecId, dst))
- return status;
-
- if (int status = CopyStr(&Info::codecNameAsUTF8, dst))
- return status;
-
- if (codecPrivateSize > 0)
- {
- if (codecPrivate == NULL)
- return -1;
-
- if (dst.codecPrivate)
- return -1;
-
- if (dst.codecPrivateSize != 0)
- return -1;
-
- dst.codecPrivate = new (std::nothrow) unsigned char[codecPrivateSize];
-
- if (dst.codecPrivate == NULL)
- return -1;
-
- memcpy(dst.codecPrivate, codecPrivate, codecPrivateSize);
- dst.codecPrivateSize = codecPrivateSize;
- }
-
- return 0;
-}
-
-const BlockEntry* Track::GetEOS() const
-{
- return &m_eos;
-}
-
-long Track::GetType() const
-{
- return m_info.type;
-}
-
-long Track::GetNumber() const
-{
- return m_info.number;
-}
-
-unsigned long long Track::GetUid() const
-{
- return m_info.uid;
-}
-
-const char* Track::GetNameAsUTF8() const
-{
- return m_info.nameAsUTF8;
-}
-
-const char* Track::GetLanguage() const
-{
- return m_info.language;
-}
-
-const char* Track::GetCodecNameAsUTF8() const
-{
- return m_info.codecNameAsUTF8;
-}
-
-
-const char* Track::GetCodecId() const
-{
- return m_info.codecId;
-}
-
-const unsigned char* Track::GetCodecPrivate(size_t& size) const
-{
- size = m_info.codecPrivateSize;
- return m_info.codecPrivate;
-}
-
-
-bool Track::GetLacing() const
-{
- return m_info.lacing;
-}
-
-unsigned long long Track::GetDefaultDuration() const
-{
- return m_info.defaultDuration;
-}
-
-unsigned long long Track::GetCodecDelay() const
-{
- return m_info.codecDelay;
-}
-
-unsigned long long Track::GetSeekPreRoll() const
-{
- return m_info.seekPreRoll;
-}
-
-long Track::GetFirst(const BlockEntry*& pBlockEntry) const
-{
- const Cluster* pCluster = m_pSegment->GetFirst();
-
- for (int i = 0; ; )
- {
- if (pCluster == NULL)
- {
- pBlockEntry = GetEOS();
- return 1;
- }
-
- if (pCluster->EOS())
- {
-#if 0
- if (m_pSegment->Unparsed() <= 0) //all clusters have been loaded
- {
- pBlockEntry = GetEOS();
- return 1;
- }
-#else
- if (m_pSegment->DoneParsing())
- {
- pBlockEntry = GetEOS();
- return 1;
- }
-#endif
-
- pBlockEntry = 0;
- return E_BUFFER_NOT_FULL;
- }
-
- long status = pCluster->GetFirst(pBlockEntry);
-
- if (status < 0) //error
- return status;
-
- if (pBlockEntry == 0) //empty cluster
- {
- pCluster = m_pSegment->GetNext(pCluster);
- continue;
- }
-
- for (;;)
- {
- const Block* const pBlock = pBlockEntry->GetBlock();
- assert(pBlock);
-
- const long long tn = pBlock->GetTrackNumber();
-
- if ((tn == m_info.number) && VetEntry(pBlockEntry))
- return 0;
-
- const BlockEntry* pNextEntry;
-
- status = pCluster->GetNext(pBlockEntry, pNextEntry);
-
- if (status < 0) //error
- return status;
-
- if (pNextEntry == 0)
- break;
-
- pBlockEntry = pNextEntry;
- }
-
- ++i;
-
- if (i >= 100)
- break;
-
- pCluster = m_pSegment->GetNext(pCluster);
- }
-
- //NOTE: if we get here, it means that we didn't find a block with
- //a matching track number. We interpret that as an error (which
- //might be too conservative).
-
- pBlockEntry = GetEOS(); //so we can return a non-NULL value
- return 1;
-}
-
-
-long Track::GetNext(
- const BlockEntry* pCurrEntry,
- const BlockEntry*& pNextEntry) const
-{
- assert(pCurrEntry);
- assert(!pCurrEntry->EOS()); //?
-
- const Block* const pCurrBlock = pCurrEntry->GetBlock();
- assert(pCurrBlock && pCurrBlock->GetTrackNumber() == m_info.number);
- if (!pCurrBlock || pCurrBlock->GetTrackNumber() != m_info.number)
- return -1;
-
- const Cluster* pCluster = pCurrEntry->GetCluster();
- assert(pCluster);
- assert(!pCluster->EOS());
-
- long status = pCluster->GetNext(pCurrEntry, pNextEntry);
-
- if (status < 0) //error
- return status;
-
- for (int i = 0; ; )
- {
- while (pNextEntry)
- {
- const Block* const pNextBlock = pNextEntry->GetBlock();
- assert(pNextBlock);
-
- if (pNextBlock->GetTrackNumber() == m_info.number)
- return 0;
-
- pCurrEntry = pNextEntry;
-
- status = pCluster->GetNext(pCurrEntry, pNextEntry);
-
- if (status < 0) //error
- return status;
- }
-
- pCluster = m_pSegment->GetNext(pCluster);
-
- if (pCluster == NULL)
- {
- pNextEntry = GetEOS();
- return 1;
- }
-
- if (pCluster->EOS())
- {
-#if 0
- if (m_pSegment->Unparsed() <= 0) //all clusters have been loaded
- {
- pNextEntry = GetEOS();
- return 1;
- }
-#else
- if (m_pSegment->DoneParsing())
- {
- pNextEntry = GetEOS();
- return 1;
- }
-#endif
-
- //TODO: there is a potential O(n^2) problem here: we tell the
- //caller to (pre)load another cluster, which he does, but then he
- //calls GetNext again, which repeats the same search. This is
- //a pathological case, since the only way it can happen is if
- //there exists a long sequence of clusters none of which contain a
- // block from this track. One way around this problem is for the
- //caller to be smarter when he loads another cluster: don't call
- //us back until you have a cluster that contains a block from this
- //track. (Of course, that's not cheap either, since our caller
- //would have to scan the each cluster as it's loaded, so that
- //would just push back the problem.)
-
- pNextEntry = NULL;
- return E_BUFFER_NOT_FULL;
- }
-
- status = pCluster->GetFirst(pNextEntry);
-
- if (status < 0) //error
- return status;
-
- if (pNextEntry == NULL) //empty cluster
- continue;
-
- ++i;
-
- if (i >= 100)
- break;
- }
-
- //NOTE: if we get here, it means that we didn't find a block with
- //a matching track number after lots of searching, so we give
- //up trying.
-
- pNextEntry = GetEOS(); //so we can return a non-NULL value
- return 1;
-}
-
-bool Track::VetEntry(const BlockEntry* pBlockEntry) const
-{
- assert(pBlockEntry);
- const Block* const pBlock = pBlockEntry->GetBlock();
- assert(pBlock);
- assert(pBlock->GetTrackNumber() == m_info.number);
- if (!pBlock || pBlock->GetTrackNumber() != m_info.number)
- return false;
-
- // This function is used during a seek to determine whether the
- // frame is a valid seek target. This default function simply
- // returns true, which means all frames are valid seek targets.
- // It gets overridden by the VideoTrack class, because only video
- // keyframes can be used as seek target.
-
- return true;
-}
-
-long Track::Seek(
- long long time_ns,
- const BlockEntry*& pResult) const
-{
- const long status = GetFirst(pResult);
-
- if (status < 0) //buffer underflow, etc
- return status;
-
- assert(pResult);
-
- if (pResult->EOS())
- return 0;
-
- const Cluster* pCluster = pResult->GetCluster();
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
-
- if (time_ns <= pResult->GetBlock()->GetTime(pCluster))
- return 0;
-
- Cluster** const clusters = m_pSegment->m_clusters;
- assert(clusters);
-
- const long count = m_pSegment->GetCount(); //loaded only, not preloaded
- assert(count > 0);
-
- Cluster** const i = clusters + pCluster->GetIndex();
- assert(i);
- assert(*i == pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- Cluster** const j = clusters + count;
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- pCluster = *mid;
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
- assert(pCluster->GetIndex() == long(mid - m_pSegment->m_clusters));
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- while (lo > i)
- {
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- pResult = pCluster->GetEntry(this);
-
- if ((pResult != 0) && !pResult->EOS())
- return 0;
-
- //landed on empty cluster (no entries)
- }
-
- pResult = GetEOS(); //weird
- return 0;
-}
-
-const ContentEncoding*
-Track::GetContentEncodingByIndex(unsigned long idx) const {
- const ptrdiff_t count =
- content_encoding_entries_end_ - content_encoding_entries_;
- assert(count >= 0);
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return content_encoding_entries_[idx];
-}
-
-unsigned long Track::GetContentEncodingCount() const {
- const ptrdiff_t count =
- content_encoding_entries_end_ - content_encoding_entries_;
- assert(count >= 0);
-
- return static_cast<unsigned long>(count);
-}
-
-long Track::ParseContentEncodingsEntry(long long start, long long size) {
- IMkvReader* const pReader = m_pSegment->m_pReader;
- assert(pReader);
-
- long long pos = start;
- const long long stop = start + size;
-
- // Count ContentEncoding elements.
- int count = 0;
- while (pos < stop) {
- long long id, size;
- const long status = ParseElementHeader(pReader,
- pos,
- stop,
- id,
- size);
- if (status < 0) //error
- return status;
-
-
- //pos now designates start of element
- if (id == 0x2240) // ContentEncoding ID
- ++count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- if (count <= 0)
- return -1;
-
- content_encoding_entries_ = new (std::nothrow) ContentEncoding*[count];
- if (!content_encoding_entries_)
- return -1;
-
- content_encoding_entries_end_ = content_encoding_entries_;
-
- pos = start;
- while (pos < stop) {
- long long id, size;
- long status = ParseElementHeader(pReader,
- pos,
- stop,
- id,
- size);
- if (status < 0) //error
- return status;
-
- //pos now designates start of element
- if (id == 0x2240) { // ContentEncoding ID
- ContentEncoding* const content_encoding =
- new (std::nothrow) ContentEncoding();
- if (!content_encoding)
- return -1;
-
- status = content_encoding->ParseContentEncodingEntry(pos,
- size,
- pReader);
- if (status) {
- delete content_encoding;
- return status;
- }
-
- *content_encoding_entries_end_++ = content_encoding;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- return 0;
-}
-
-Track::EOSBlock::EOSBlock() :
- BlockEntry(NULL, LONG_MIN)
-{
-}
-
-BlockEntry::Kind Track::EOSBlock::GetKind() const
-{
- return kBlockEOS;
-}
-
-
-const Block* Track::EOSBlock::GetBlock() const
-{
- return NULL;
-}
-
-
-VideoTrack::VideoTrack(
- Segment* pSegment,
- long long element_start,
- long long element_size) :
- Track(pSegment, element_start, element_size)
-{
-}
-
-
-long VideoTrack::Parse(
- Segment* pSegment,
- const Info& info,
- long long element_start,
- long long element_size,
- VideoTrack*& pResult)
-{
- if (pResult)
- return -1;
-
- if (info.type != Track::kVideo)
- return -1;
-
- long long width = 0;
- long long height = 0;
- double rate = 0.0;
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- const Settings& s = info.settings;
- assert(s.start >= 0);
- assert(s.size >= 0);
-
- long long pos = s.start;
- assert(pos >= 0);
-
- const long long stop = pos + s.size;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x30) //pixel width
- {
- width = UnserializeUInt(pReader, pos, size);
-
- if (width <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x3A) //pixel height
- {
- height = UnserializeUInt(pReader, pos, size);
-
- if (height <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0383E3) //frame rate
- {
- const long status = UnserializeFloat(
- pReader,
- pos,
- size,
- rate);
-
- if (status < 0)
- return status;
-
- if (rate <= 0)
- return E_FILE_FORMAT_INVALID;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- VideoTrack* const pTrack = new (std::nothrow) VideoTrack(pSegment,
- element_start,
- element_size);
-
- if (pTrack == NULL)
- return -1; //generic error
-
- const int status = info.Copy(pTrack->m_info);
-
- if (status) // error
- {
- delete pTrack;
- return status;
- }
-
- pTrack->m_width = width;
- pTrack->m_height = height;
- pTrack->m_rate = rate;
-
- pResult = pTrack;
- return 0; //success
-}
-
-
-bool VideoTrack::VetEntry(const BlockEntry* pBlockEntry) const
-{
- return Track::VetEntry(pBlockEntry) && pBlockEntry->GetBlock()->IsKey();
-}
-
-long VideoTrack::Seek(
- long long time_ns,
- const BlockEntry*& pResult) const
-{
- const long status = GetFirst(pResult);
-
- if (status < 0) //buffer underflow, etc
- return status;
-
- assert(pResult);
-
- if (pResult->EOS())
- return 0;
-
- const Cluster* pCluster = pResult->GetCluster();
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
-
- if (time_ns <= pResult->GetBlock()->GetTime(pCluster))
- return 0;
-
- Cluster** const clusters = m_pSegment->m_clusters;
- assert(clusters);
-
- const long count = m_pSegment->GetCount(); //loaded only, not pre-loaded
- assert(count > 0);
-
- Cluster** const i = clusters + pCluster->GetIndex();
- assert(i);
- assert(*i == pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- Cluster** const j = clusters + count;
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- pCluster = *mid;
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
- assert(pCluster->GetIndex() == long(mid - m_pSegment->m_clusters));
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- pResult = pCluster->GetEntry(this, time_ns);
-
- if ((pResult != 0) && !pResult->EOS()) //found a keyframe
- return 0;
-
- while (lo != i)
- {
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
-#if 0
- //TODO:
- //We need to handle the case when a cluster
- //contains multiple keyframes. Simply returning
- //the largest keyframe on the cluster isn't
- //good enough.
- pResult = pCluster->GetMaxKey(this);
-#else
- pResult = pCluster->GetEntry(this, time_ns);
-#endif
-
- if ((pResult != 0) && !pResult->EOS())
- return 0;
- }
-
- //weird: we're on the first cluster, but no keyframe found
- //should never happen but we must return something anyway
-
- pResult = GetEOS();
- return 0;
-}
-
-
-long long VideoTrack::GetWidth() const
-{
- return m_width;
-}
-
-
-long long VideoTrack::GetHeight() const
-{
- return m_height;
-}
-
-
-double VideoTrack::GetFrameRate() const
-{
- return m_rate;
-}
-
-
-AudioTrack::AudioTrack(
- Segment* pSegment,
- long long element_start,
- long long element_size) :
- Track(pSegment, element_start, element_size)
-{
-}
-
-
-long AudioTrack::Parse(
- Segment* pSegment,
- const Info& info,
- long long element_start,
- long long element_size,
- AudioTrack*& pResult)
-{
- if (pResult)
- return -1;
-
- if (info.type != Track::kAudio)
- return -1;
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- const Settings& s = info.settings;
- assert(s.start >= 0);
- assert(s.size >= 0);
-
- long long pos = s.start;
- assert(pos >= 0);
-
- const long long stop = pos + s.size;
-
- double rate = 8000.0; // MKV default
- long long channels = 1;
- long long bit_depth = 0;
-
- while (pos < stop)
- {
- long long id, size;
-
- long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x35) //Sample Rate
- {
- status = UnserializeFloat(pReader, pos, size, rate);
-
- if (status < 0)
- return status;
-
- if (rate <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x1F) //Channel Count
- {
- channels = UnserializeUInt(pReader, pos, size);
-
- if (channels <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x2264) //Bit Depth
- {
- bit_depth = UnserializeUInt(pReader, pos, size);
-
- if (bit_depth <= 0)
- return E_FILE_FORMAT_INVALID;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- AudioTrack* const pTrack = new (std::nothrow) AudioTrack(pSegment,
- element_start,
- element_size);
-
- if (pTrack == NULL)
- return -1; //generic error
-
- const int status = info.Copy(pTrack->m_info);
-
- if (status)
- {
- delete pTrack;
- return status;
- }
-
- pTrack->m_rate = rate;
- pTrack->m_channels = channels;
- pTrack->m_bitDepth = bit_depth;
-
- pResult = pTrack;
- return 0; //success
-}
-
-
-double AudioTrack::GetSamplingRate() const
-{
- return m_rate;
-}
-
-
-long long AudioTrack::GetChannels() const
-{
- return m_channels;
-}
-
-long long AudioTrack::GetBitDepth() const
-{
- return m_bitDepth;
-}
-
-Tracks::Tracks(
- Segment* pSegment,
- long long start,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_trackEntries(NULL),
- m_trackEntriesEnd(NULL)
-{
-}
-
-
-long Tracks::Parse()
-{
- assert(m_trackEntries == NULL);
- assert(m_trackEntriesEnd == NULL);
-
- const long long stop = m_start + m_size;
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- int count = 0;
- long long pos = m_start;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (size == 0) //weird
- continue;
-
- if (id == 0x2E) //TrackEntry ID
- ++count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- if (count <= 0)
- return 0; //success
-
- m_trackEntries = new (std::nothrow) Track*[count];
-
- if (m_trackEntries == NULL)
- return -1;
-
- m_trackEntriesEnd = m_trackEntries;
-
- pos = m_start;
-
- while (pos < stop)
- {
- const long long element_start = pos;
-
- long long id, payload_size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- payload_size);
-
- if (status < 0) //error
- return status;
-
- if (payload_size == 0) //weird
- continue;
-
- const long long payload_stop = pos + payload_size;
- assert(payload_stop <= stop); //checked in ParseElement
-
- const long long element_size = payload_stop - element_start;
-
- if (id == 0x2E) //TrackEntry ID
- {
- Track*& pTrack = *m_trackEntriesEnd;
- pTrack = NULL;
-
- const long status = ParseTrackEntry(
- pos,
- payload_size,
- element_start,
- element_size,
- pTrack);
-
- if (status)
- return status;
-
- if (pTrack)
- ++m_trackEntriesEnd;
- }
-
- pos = payload_stop;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- return 0; //success
-}
-
-
-unsigned long Tracks::GetTracksCount() const
-{
- const ptrdiff_t result = m_trackEntriesEnd - m_trackEntries;
- assert(result >= 0);
-
- return static_cast<unsigned long>(result);
-}
-
-long Tracks::ParseTrackEntry(
- long long track_start,
- long long track_size,
- long long element_start,
- long long element_size,
- Track*& pResult) const
-{
- if (pResult)
- return -1;
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = track_start;
- const long long track_stop = track_start + track_size;
-
- Track::Info info;
-
- info.type = 0;
- info.number = 0;
- info.uid = 0;
- info.defaultDuration = 0;
-
- Track::Settings v;
- v.start = -1;
- v.size = -1;
-
- Track::Settings a;
- a.start = -1;
- a.size = -1;
-
- Track::Settings e; //content_encodings_settings;
- e.start = -1;
- e.size = -1;
-
- long long lacing = 1; //default is true
-
- while (pos < track_stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- track_stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (size < 0)
- return E_FILE_FORMAT_INVALID;
-
- const long long start = pos;
-
- if (id == 0x60) // VideoSettings ID
- {
- v.start = start;
- v.size = size;
- }
- else if (id == 0x61) // AudioSettings ID
- {
- a.start = start;
- a.size = size;
- }
- else if (id == 0x2D80) // ContentEncodings ID
- {
- e.start = start;
- e.size = size;
- }
- else if (id == 0x33C5) //Track UID
- {
- if (size > 8)
- return E_FILE_FORMAT_INVALID;
-
- info.uid = 0;
-
- long long pos_ = start;
- const long long pos_end = start + size;
-
- while (pos_ != pos_end)
- {
- unsigned char b;
-
- const int status = pReader->Read(pos_, 1, &b);
-
- if (status)
- return status;
-
- info.uid <<= 8;
- info.uid |= b;
-
- ++pos_;
- }
- }
- else if (id == 0x57) //Track Number
- {
- const long long num = UnserializeUInt(pReader, pos, size);
-
- if ((num <= 0) || (num > 127))
- return E_FILE_FORMAT_INVALID;
-
- info.number = static_cast<long>(num);
- }
- else if (id == 0x03) //Track Type
- {
- const long long type = UnserializeUInt(pReader, pos, size);
-
- if ((type <= 0) || (type > 254))
- return E_FILE_FORMAT_INVALID;
-
- info.type = static_cast<long>(type);
- }
- else if (id == 0x136E) //Track Name
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- info.nameAsUTF8);
-
- if (status)
- return status;
- }
- else if (id == 0x02B59C) //Track Language
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- info.language);
-
- if (status)
- return status;
- }
- else if (id == 0x03E383) //Default Duration
- {
- const long long duration = UnserializeUInt(pReader, pos, size);
-
- if (duration < 0)
- return E_FILE_FORMAT_INVALID;
-
- info.defaultDuration = static_cast<unsigned long long>(duration);
- }
- else if (id == 0x06) //CodecID
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- info.codecId);
-
- if (status)
- return status;
- }
- else if (id == 0x1C) //lacing
- {
- lacing = UnserializeUInt(pReader, pos, size);
-
- if ((lacing < 0) || (lacing > 1))
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x23A2) //Codec Private
- {
- delete[] info.codecPrivate;
- info.codecPrivate = NULL;
- info.codecPrivateSize = 0;
-
- const size_t buflen = static_cast<size_t>(size);
-
- if (buflen)
- {
- typedef unsigned char* buf_t;
-
- const buf_t buf = new (std::nothrow) unsigned char[buflen];
-
- if (buf == NULL)
- return -1;
-
- const int status = pReader->Read(pos, buflen, buf);
-
- if (status)
- {
- delete[] buf;
- return status;
- }
-
- info.codecPrivate = buf;
- info.codecPrivateSize = buflen;
- }
- }
- else if (id == 0x058688) //Codec Name
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- info.codecNameAsUTF8);
-
- if (status)
- return status;
- }
- else if (id == 0x16AA) //Codec Delay
- {
- info.codecDelay = UnserializeUInt(pReader, pos, size);
-
- }
- else if (id == 0x16BB) //Seek Pre Roll
- {
- info.seekPreRoll = UnserializeUInt(pReader, pos, size);
- }
-
- pos += size; //consume payload
- assert(pos <= track_stop);
- }
-
- assert(pos == track_stop);
-
- if (info.number <= 0) //not specified
- return E_FILE_FORMAT_INVALID;
-
- if (GetTrackByNumber(info.number))
- return E_FILE_FORMAT_INVALID;
-
- if (info.type <= 0) //not specified
- return E_FILE_FORMAT_INVALID;
-
- info.lacing = (lacing > 0) ? true : false;
-
- if (info.type == Track::kVideo)
- {
- if (v.start < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (a.start >= 0)
- return E_FILE_FORMAT_INVALID;
-
- info.settings = v;
-
- VideoTrack* pTrack = NULL;
-
- const long status = VideoTrack::Parse(m_pSegment,
- info,
- element_start,
- element_size,
- pTrack);
-
- if (status)
- return status;
-
- pResult = pTrack;
- assert(pResult);
-
- if (e.start >= 0)
- pResult->ParseContentEncodingsEntry(e.start, e.size);
- }
- else if (info.type == Track::kAudio)
- {
- if (a.start < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (v.start >= 0)
- return E_FILE_FORMAT_INVALID;
-
- info.settings = a;
-
- AudioTrack* pTrack = NULL;
-
- const long status = AudioTrack::Parse(m_pSegment,
- info,
- element_start,
- element_size,
- pTrack);
-
- if (status)
- return status;
-
- pResult = pTrack;
- assert(pResult);
-
- if (e.start >= 0)
- pResult->ParseContentEncodingsEntry(e.start, e.size);
- }
- else
- {
- // neither video nor audio - probably metadata or subtitles
-
- if (a.start >= 0)
- return E_FILE_FORMAT_INVALID;
-
- if (v.start >= 0)
- return E_FILE_FORMAT_INVALID;
-
- if (e.start >= 0)
- return E_FILE_FORMAT_INVALID;
-
- info.settings.start = -1;
- info.settings.size = 0;
-
- Track* pTrack = NULL;
-
- const long status = Track::Create(m_pSegment,
- info,
- element_start,
- element_size,
- pTrack);
-
- if (status)
- return status;
-
- pResult = pTrack;
- assert(pResult);
- }
-
- return 0; //success
-}
-
-
-Tracks::~Tracks()
-{
- Track** i = m_trackEntries;
- Track** const j = m_trackEntriesEnd;
-
- while (i != j)
- {
- Track* const pTrack = *i++;
- delete pTrack;
- }
-
- delete[] m_trackEntries;
-}
-
-const Track* Tracks::GetTrackByNumber(long tn) const
-{
- if (tn < 0)
- return NULL;
-
- Track** i = m_trackEntries;
- Track** const j = m_trackEntriesEnd;
-
- while (i != j)
- {
- Track* const pTrack = *i++;
-
- if (pTrack == NULL)
- continue;
-
- if (tn == pTrack->GetNumber())
- return pTrack;
- }
-
- return NULL; //not found
-}
-
-
-const Track* Tracks::GetTrackByIndex(unsigned long idx) const
-{
- const ptrdiff_t count = m_trackEntriesEnd - m_trackEntries;
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return m_trackEntries[idx];
-}
-
-#if 0
-long long Cluster::Unparsed() const
-{
- if (m_timecode < 0) //not even partially loaded
- return LLONG_MAX;
-
- assert(m_pos >= m_element_start);
- //assert(m_element_size > m_size);
-
- const long long element_stop = m_element_start + m_element_size;
- assert(m_pos <= element_stop);
-
- const long long result = element_stop - m_pos;
- assert(result >= 0);
-
- return result;
-}
-#endif
-
-
-long Cluster::Load(long long& pos, long& len) const
-{
- assert(m_pSegment);
- assert(m_pos >= m_element_start);
-
- if (m_timecode >= 0) //at least partially loaded
- return 0;
-
- assert(m_pos == m_element_start);
- assert(m_element_size < 0);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- const int status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
- assert((total < 0) || (m_pos <= total)); //TODO: verify this
-
- pos = m_pos;
-
- long long cluster_size = -1;
-
- {
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error or underflow
- return static_cast<long>(result);
-
- if (result > 0) //underflow (weird)
- return E_BUFFER_NOT_FULL;
-
- //if ((pos + len) > segment_stop)
- // return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id_ = ReadUInt(pReader, pos, len);
-
- if (id_ < 0) //error
- return static_cast<long>(id_);
-
- if (id_ != 0x0F43B675) //Cluster ID
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume id
-
- //read cluster size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- //if ((pos + len) > segment_stop)
- // return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(cluster_size);
-
- if (size == 0)
- return E_FILE_FORMAT_INVALID; //TODO: verify this
-
- pos += len; //consume length of size of element
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size != unknown_size)
- cluster_size = size;
- }
-
- //pos points to start of payload
-
-#if 0
- len = static_cast<long>(size_);
-
- if (cluster_stop > avail)
- return E_BUFFER_NOT_FULL;
-#endif
-
- long long timecode = -1;
- long long new_pos = -1;
- bool bBlock = false;
-
- long long cluster_stop = (cluster_size < 0) ? -1 : pos + cluster_size;
-
- for (;;)
- {
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- break;
-
- //Parse ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0)
- return E_FILE_FORMAT_INVALID;
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- if (id == 0x0C53BB6B) //Cues ID
- break;
-
- pos += len; //consume ID field
-
- //Parse Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume size field
-
- if ((cluster_stop >= 0) && (pos > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- //pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- if ((cluster_stop >= 0) && ((pos + size) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if (id == 0x67) //TimeCode ID
- {
- len = static_cast<long>(size);
-
- if ((pos + size) > avail)
- return E_BUFFER_NOT_FULL;
-
- timecode = UnserializeUInt(pReader, pos, size);
-
- if (timecode < 0) //error (or underflow)
- return static_cast<long>(timecode);
-
- new_pos = pos + size;
-
- if (bBlock)
- break;
- }
- else if (id == 0x20) //BlockGroup ID
- {
- bBlock = true;
- break;
- }
- else if (id == 0x23) //SimpleBlock ID
- {
- bBlock = true;
- break;
- }
-
- pos += size; //consume payload
- assert((cluster_stop < 0) || (pos <= cluster_stop));
- }
-
- assert((cluster_stop < 0) || (pos <= cluster_stop));
-
- if (timecode < 0) //no timecode found
- return E_FILE_FORMAT_INVALID;
-
- if (!bBlock)
- return E_FILE_FORMAT_INVALID;
-
- m_pos = new_pos; //designates position just beyond timecode payload
- m_timecode = timecode; // m_timecode >= 0 means we're partially loaded
-
- if (cluster_size >= 0)
- m_element_size = cluster_stop - m_element_start;
-
- return 0;
-}
-
-
-long Cluster::Parse(long long& pos, long& len) const
-{
- long status = Load(pos, len);
-
- if (status < 0)
- return status;
-
- assert(m_pos >= m_element_start);
- assert(m_timecode >= 0);
- //assert(m_size > 0);
- //assert(m_element_size > m_size);
-
- const long long cluster_stop =
- (m_element_size < 0) ? -1 : m_element_start + m_element_size;
-
- if ((cluster_stop >= 0) && (m_pos >= cluster_stop))
- return 1; //nothing else to do
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- pos = m_pos;
-
- for (;;)
- {
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- break;
-
- if ((total >= 0) && (pos >= total))
- {
- if (m_element_size < 0)
- m_element_size = pos - m_element_start;
-
- break;
- }
-
- //Parse ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0) //weird
- return E_FILE_FORMAT_INVALID;
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if ((id == 0x0F43B675) || (id == 0x0C53BB6B)) //Cluster or Cues ID
- {
- if (m_element_size < 0)
- m_element_size = pos - m_element_start;
-
- break;
- }
-
- pos += len; //consume ID field
-
- //Parse Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume size field
-
- if ((cluster_stop >= 0) && (pos > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- //pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- //const long long block_start = pos;
- const long long block_stop = pos + size;
-
- if (cluster_stop >= 0)
- {
- if (block_stop > cluster_stop)
- {
- if ((id == 0x20) || (id == 0x23))
- return E_FILE_FORMAT_INVALID;
-
- pos = cluster_stop;
- break;
- }
- }
- else if ((total >= 0) && (block_stop > total))
- {
- m_element_size = total - m_element_start;
- pos = total;
- break;
- }
- else if (block_stop > avail)
- {
- len = static_cast<long>(size);
- return E_BUFFER_NOT_FULL;
- }
-
- Cluster* const this_ = const_cast<Cluster*>(this);
-
- if (id == 0x20) //BlockGroup
- return this_->ParseBlockGroup(size, pos, len);
-
- if (id == 0x23) //SimpleBlock
- return this_->ParseSimpleBlock(size, pos, len);
-
- pos += size; //consume payload
- assert((cluster_stop < 0) || (pos <= cluster_stop));
- }
-
- assert(m_element_size > 0);
-
- m_pos = pos;
- assert((cluster_stop < 0) || (m_pos <= cluster_stop));
-
- if (m_entries_count > 0)
- {
- const long idx = m_entries_count - 1;
-
- const BlockEntry* const pLast = m_entries[idx];
- assert(pLast);
-
- const Block* const pBlock = pLast->GetBlock();
- assert(pBlock);
-
- const long long start = pBlock->m_start;
-
- if ((total >= 0) && (start > total))
- return -1; //defend against trucated stream
-
- const long long size = pBlock->m_size;
-
- const long long stop = start + size;
- assert((cluster_stop < 0) || (stop <= cluster_stop));
-
- if ((total >= 0) && (stop > total))
- return -1; //defend against trucated stream
- }
-
- return 1; //no more entries
-}
-
-
-long Cluster::ParseSimpleBlock(
- long long block_size,
- long long& pos,
- long& len)
-{
- const long long block_start = pos;
- const long long block_stop = pos + block_size;
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- long status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- //parse track number
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long track = ReadUInt(pReader, pos, len);
-
- if (track < 0) //error
- return static_cast<long>(track);
-
- if (track == 0)
- return E_FILE_FORMAT_INVALID;
-
-#if 0
- //TODO(matthewjheaney)
- //This turned out to be too conservative. The problem is that
- //if we see a track header in the tracks element with an unsupported
- //track type, we throw that track header away, so it is not present
- //in the track map. But even though we don't understand the track
- //header, there are still blocks in the cluster with that track
- //number. It was our decision to ignore that track header, so it's
- //up to us to deal with blocks associated with that track -- we
- //cannot simply report an error since technically there's nothing
- //wrong with the file.
- //
- //For now we go ahead and finish the parse, creating a block entry
- //for this block. This is somewhat wasteful, because without a
- //track header there's nothing you can do with the block. What
- //we really need here is a special return value that indicates to
- //the caller that he should ignore this particular block, and
- //continue parsing.
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(track);
-
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return E_FILE_FORMAT_INVALID;
-#endif
-
- pos += len; //consume track number
-
- if ((pos + 2) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 2) > avail)
- {
- len = 2;
- return E_BUFFER_NOT_FULL;
- }
-
- pos += 2; //consume timecode
-
- if ((pos + 1) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- unsigned char flags;
-
- status = pReader->Read(pos, 1, &flags);
-
- if (status < 0) //error or underflow
- {
- len = 1;
- return status;
- }
-
- ++pos; //consume flags byte
- assert(pos <= avail);
-
- if (pos >= block_stop)
- return E_FILE_FORMAT_INVALID;
-
- const int lacing = int(flags & 0x06) >> 1;
-
- if ((lacing != 0) && (block_stop > avail))
- {
- len = static_cast<long>(block_stop - pos);
- return E_BUFFER_NOT_FULL;
- }
-
- status = CreateBlock(0x23, //simple block id
- block_start, block_size,
- 0); //DiscardPadding
-
- if (status != 0)
- return status;
-
- m_pos = block_stop;
-
- return 0; //success
-}
-
-
-long Cluster::ParseBlockGroup(
- long long payload_size,
- long long& pos,
- long& len)
-{
- const long long payload_start = pos;
- const long long payload_stop = pos + payload_size;
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- long status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- if ((total >= 0) && (payload_stop > total))
- return E_FILE_FORMAT_INVALID;
-
- if (payload_stop > avail)
- {
- len = static_cast<long>(payload_size);
- return E_BUFFER_NOT_FULL;
- }
-
- long long discard_padding = 0;
-
- while (pos < payload_stop)
- {
- //parse sub-block element ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0) //not a value ID
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume ID field
-
- //Parse Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field
-
- //pos now points to start of sub-block group payload
-
- if (pos > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- if (id == 0x35A2) //DiscardPadding
- {
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- status = UnserializeInt(pReader, pos, len, discard_padding);
-
- if (status < 0) //error
- return status;
- }
-
- if (id != 0x21) //sub-part of BlockGroup is not a Block
- {
- pos += size; //consume sub-part of block group
-
- if (pos > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- continue;
- }
-
- const long long block_stop = pos + size;
-
- if (block_stop > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- //parse track number
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long track = ReadUInt(pReader, pos, len);
-
- if (track < 0) //error
- return static_cast<long>(track);
-
- if (track == 0)
- return E_FILE_FORMAT_INVALID;
-
-#if 0
- //TODO(matthewjheaney)
- //This turned out to be too conservative. The problem is that
- //if we see a track header in the tracks element with an unsupported
- //track type, we throw that track header away, so it is not present
- //in the track map. But even though we don't understand the track
- //header, there are still blocks in the cluster with that track
- //number. It was our decision to ignore that track header, so it's
- //up to us to deal with blocks associated with that track -- we
- //cannot simply report an error since technically there's nothing
- //wrong with the file.
- //
- //For now we go ahead and finish the parse, creating a block entry
- //for this block. This is somewhat wasteful, because without a
- //track header there's nothing you can do with the block. What
- //we really need here is a special return value that indicates to
- //the caller that he should ignore this particular block, and
- //continue parsing.
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(track);
-
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return E_FILE_FORMAT_INVALID;
-#endif
-
- pos += len; //consume track number
-
- if ((pos + 2) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 2) > avail)
- {
- len = 2;
- return E_BUFFER_NOT_FULL;
- }
-
- pos += 2; //consume timecode
-
- if ((pos + 1) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- unsigned char flags;
-
- status = pReader->Read(pos, 1, &flags);
-
- if (status < 0) //error or underflow
- {
- len = 1;
- return status;
- }
-
- ++pos; //consume flags byte
- assert(pos <= avail);
-
- if (pos >= block_stop)
- return E_FILE_FORMAT_INVALID;
-
- const int lacing = int(flags & 0x06) >> 1;
-
- if ((lacing != 0) && (block_stop > avail))
- {
- len = static_cast<long>(block_stop - pos);
- return E_BUFFER_NOT_FULL;
- }
-
- pos = block_stop; //consume block-part of block group
- assert(pos <= payload_stop);
- }
-
- assert(pos == payload_stop);
-
- status = CreateBlock(0x20, //BlockGroup ID
- payload_start, payload_size,
- discard_padding);
- if (status != 0)
- return status;
-
- m_pos = payload_stop;
-
- return 0; //success
-}
-
-
-long Cluster::GetEntry(long index, const mkvparser::BlockEntry*& pEntry) const
-{
- assert(m_pos >= m_element_start);
-
- pEntry = NULL;
-
- if (index < 0)
- return -1; //generic error
-
- if (m_entries_count < 0)
- return E_BUFFER_NOT_FULL;
-
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count <= m_entries_size);
-
- if (index < m_entries_count)
- {
- pEntry = m_entries[index];
- assert(pEntry);
-
- return 1; //found entry
- }
-
- if (m_element_size < 0) //we don't know cluster end yet
- return E_BUFFER_NOT_FULL; //underflow
-
- const long long element_stop = m_element_start + m_element_size;
-
- if (m_pos >= element_stop)
- return 0; //nothing left to parse
-
- return E_BUFFER_NOT_FULL; //underflow, since more remains to be parsed
-}
-
-
-Cluster* Cluster::Create(
- Segment* pSegment,
- long idx,
- long long off)
- //long long element_size)
-{
- assert(pSegment);
- assert(off >= 0);
-
- const long long element_start = pSegment->m_start + off;
-
- Cluster* const pCluster = new Cluster(pSegment,
- idx,
- element_start);
- //element_size);
- assert(pCluster);
-
- return pCluster;
-}
-
-
-Cluster::Cluster() :
- m_pSegment(NULL),
- m_element_start(0),
- m_index(0),
- m_pos(0),
- m_element_size(0),
- m_timecode(0),
- m_entries(NULL),
- m_entries_size(0),
- m_entries_count(0) //means "no entries"
-{
-}
-
-
-Cluster::Cluster(
- Segment* pSegment,
- long idx,
- long long element_start
- /* long long element_size */ ) :
- m_pSegment(pSegment),
- m_element_start(element_start),
- m_index(idx),
- m_pos(element_start),
- m_element_size(-1 /* element_size */ ),
- m_timecode(-1),
- m_entries(NULL),
- m_entries_size(0),
- m_entries_count(-1) //means "has not been parsed yet"
-{
-}
-
-
-Cluster::~Cluster()
-{
- if (m_entries_count <= 0)
- return;
-
- BlockEntry** i = m_entries;
- BlockEntry** const j = m_entries + m_entries_count;
-
- while (i != j)
- {
- BlockEntry* p = *i++;
- assert(p);
-
- delete p;
- }
-
- delete[] m_entries;
-}
-
-
-bool Cluster::EOS() const
-{
- return (m_pSegment == NULL);
-}
-
-
-long Cluster::GetIndex() const
-{
- return m_index;
-}
-
-
-long long Cluster::GetPosition() const
-{
- const long long pos = m_element_start - m_pSegment->m_start;
- assert(pos >= 0);
-
- return pos;
-}
-
-
-long long Cluster::GetElementSize() const
-{
- return m_element_size;
-}
-
-
-#if 0
-bool Cluster::HasBlockEntries(
- const Segment* pSegment,
- long long off) //relative to start of segment payload
-{
- assert(pSegment);
- assert(off >= 0); //relative to segment
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- long long pos = pSegment->m_start + off; //absolute
- long long size;
-
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- (void)id;
- assert(id >= 0);
- assert(id == 0x0F43B675); //Cluster ID
-
- pos += len; //consume id
-
- size = ReadUInt(pReader, pos, len);
- assert(size > 0);
-
- pos += len; //consume size
-
- //pos now points to start of payload
- }
-
- const long long stop = pos + size;
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume size
-
- if (id == 0x20) //BlockGroup ID
- return true;
-
- if (id == 0x23) //SimpleBlock ID
- return true;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- return false;
-}
-#endif
-
-
-long Cluster::HasBlockEntries(
- const Segment* pSegment,
- long long off, //relative to start of segment payload
- long long& pos,
- long& len)
-{
- assert(pSegment);
- assert(off >= 0); //relative to segment
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- long long total, avail;
-
- long status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- pos = pSegment->m_start + off; //absolute
-
- if ((total >= 0) && (pos >= total))
- return 0; //we don't even have a complete cluster
-
- const long long segment_stop =
- (pSegment->m_size < 0) ? -1 : pSegment->m_start + pSegment->m_size;
-
- long long cluster_stop = -1; //interpreted later to mean "unknown size"
-
- {
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //need more data
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && ((pos + len) > total))
- return 0;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id != 0x0F43B675) //weird: not cluster ID
- return -1; //generic error
-
- pos += len; //consume Cluster ID field
-
- //read size field
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && ((pos + len) > total))
- return 0;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- if (size == 0)
- return 0; //cluster does not have entries
-
- pos += len; //consume size field
-
- //pos now points to start of payload
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size != unknown_size)
- {
- cluster_stop = pos + size;
- assert(cluster_stop >= 0);
-
- if ((segment_stop >= 0) && (cluster_stop > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && (cluster_stop > total))
- //return E_FILE_FORMAT_INVALID; //too conservative
- return 0; //cluster does not have any entries
- }
- }
-
- for (;;)
- {
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- return 0; //no entries detected
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //need more data
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- return 0; //no entries found
-
- if (id == 0x0C53BB6B) //Cues ID
- return 0; //no entries found
-
- pos += len; //consume id field
-
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- //read size field
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //underflow
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field
-
- //pos now points to start of payload
-
- if ((cluster_stop >= 0) && (pos > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not supported inside cluster
-
- if ((cluster_stop >= 0) && ((pos + size) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if (id == 0x20) //BlockGroup ID
- return 1; //have at least one entry
-
- if (id == 0x23) //SimpleBlock ID
- return 1; //have at least one entry
-
- pos += size; //consume payload
- assert((cluster_stop < 0) || (pos <= cluster_stop));
- }
-}
-
-
-long long Cluster::GetTimeCode() const
-{
- long long pos;
- long len;
-
- const long status = Load(pos, len);
-
- if (status < 0) //error
- return status;
-
- return m_timecode;
-}
-
-
-long long Cluster::GetTime() const
-{
- const long long tc = GetTimeCode();
-
- if (tc < 0)
- return tc;
-
- const SegmentInfo* const pInfo = m_pSegment->GetInfo();
- assert(pInfo);
-
- const long long scale = pInfo->GetTimeCodeScale();
- assert(scale >= 1);
-
- const long long t = m_timecode * scale;
-
- return t;
-}
-
-
-long long Cluster::GetFirstTime() const
-{
- const BlockEntry* pEntry;
-
- const long status = GetFirst(pEntry);
-
- if (status < 0) //error
- return status;
-
- if (pEntry == NULL) //empty cluster
- return GetTime();
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- return pBlock->GetTime(this);
-}
-
-
-long long Cluster::GetLastTime() const
-{
- const BlockEntry* pEntry;
-
- const long status = GetLast(pEntry);
-
- if (status < 0) //error
- return status;
-
- if (pEntry == NULL) //empty cluster
- return GetTime();
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- return pBlock->GetTime(this);
-}
-
-
-long Cluster::CreateBlock(
- long long id,
- long long pos, //absolute pos of payload
- long long size,
- long long discard_padding)
-{
- assert((id == 0x20) || (id == 0x23)); //BlockGroup or SimpleBlock
-
- if (m_entries_count < 0) //haven't parsed anything yet
- {
- assert(m_entries == NULL);
- assert(m_entries_size == 0);
-
- m_entries_size = 1024;
- m_entries = new BlockEntry*[m_entries_size];
-
- m_entries_count = 0;
- }
- else
- {
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count <= m_entries_size);
-
- if (m_entries_count >= m_entries_size)
- {
- const long entries_size = 2 * m_entries_size;
-
- BlockEntry** const entries = new BlockEntry*[entries_size];
- assert(entries);
-
- BlockEntry** src = m_entries;
- BlockEntry** const src_end = src + m_entries_count;
-
- BlockEntry** dst = entries;
-
- while (src != src_end)
- *dst++ = *src++;
-
- delete[] m_entries;
-
- m_entries = entries;
- m_entries_size = entries_size;
- }
- }
-
- if (id == 0x20) //BlockGroup ID
- return CreateBlockGroup(pos, size, discard_padding);
- else //SimpleBlock ID
- return CreateSimpleBlock(pos, size);
-}
-
-
-long Cluster::CreateBlockGroup(
- long long start_offset,
- long long size,
- long long discard_padding)
-{
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count >= 0);
- assert(m_entries_count < m_entries_size);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = start_offset;
- const long long stop = start_offset + size;
-
- //For WebM files, there is a bias towards previous reference times
- //(in order to support alt-ref frames, which refer back to the previous
- //keyframe). Normally a 0 value is not possible, but here we tenatively
- //allow 0 as the value of a reference frame, with the interpretation
- //that this is a "previous" reference time.
-
- long long prev = 1; //nonce
- long long next = 0; //nonce
- long long duration = -1; //really, this is unsigned
-
- long long bpos = -1;
- long long bsize = -1;
-
- while (pos < stop)
- {
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume size
-
- if (id == 0x21) //Block ID
- {
- if (bpos < 0) //Block ID
- {
- bpos = pos;
- bsize = size;
- }
- }
- else if (id == 0x1B) //Duration ID
- {
- assert(size <= 8);
-
- duration = UnserializeUInt(pReader, pos, size);
- assert(duration >= 0); //TODO
- }
- else if (id == 0x7B) //ReferenceBlock
- {
- assert(size <= 8);
- const long size_ = static_cast<long>(size);
-
- long long time;
-
- long status = UnserializeInt(pReader, pos, size_, time);
- assert(status == 0);
- if (status != 0)
- return -1;
-
- if (time <= 0) //see note above
- prev = time;
- else //weird
- next = time;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
- assert(bpos >= 0);
- assert(bsize >= 0);
-
- const long idx = m_entries_count;
-
- BlockEntry** const ppEntry = m_entries + idx;
- BlockEntry*& pEntry = *ppEntry;
-
- pEntry = new (std::nothrow) BlockGroup(
- this,
- idx,
- bpos,
- bsize,
- prev,
- next,
- duration,
- discard_padding);
-
- if (pEntry == NULL)
- return -1; //generic error
-
- BlockGroup* const p = static_cast<BlockGroup*>(pEntry);
-
- const long status = p->Parse();
-
- if (status == 0) //success
- {
- ++m_entries_count;
- return 0;
- }
-
- delete pEntry;
- pEntry = 0;
-
- return status;
-}
-
-
-
-long Cluster::CreateSimpleBlock(
- long long st,
- long long sz)
-{
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count >= 0);
- assert(m_entries_count < m_entries_size);
-
- const long idx = m_entries_count;
-
- BlockEntry** const ppEntry = m_entries + idx;
- BlockEntry*& pEntry = *ppEntry;
-
- pEntry = new (std::nothrow) SimpleBlock(this, idx, st, sz);
-
- if (pEntry == NULL)
- return -1; //generic error
-
- SimpleBlock* const p = static_cast<SimpleBlock*>(pEntry);
-
- const long status = p->Parse();
-
- if (status == 0)
- {
- ++m_entries_count;
- return 0;
- }
-
- delete pEntry;
- pEntry = 0;
-
- return status;
-}
-
-
-long Cluster::GetFirst(const BlockEntry*& pFirst) const
-{
- if (m_entries_count <= 0)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //error
- {
- pFirst = NULL;
- return status;
- }
-
- if (m_entries_count <= 0) //empty cluster
- {
- pFirst = NULL;
- return 0;
- }
- }
-
- assert(m_entries);
-
- pFirst = m_entries[0];
- assert(pFirst);
-
- return 0; //success
-}
-
-long Cluster::GetLast(const BlockEntry*& pLast) const
-{
- for (;;)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //error
- {
- pLast = NULL;
- return status;
- }
-
- if (status > 0) //no new block
- break;
- }
-
- if (m_entries_count <= 0)
- {
- pLast = NULL;
- return 0;
- }
-
- assert(m_entries);
-
- const long idx = m_entries_count - 1;
-
- pLast = m_entries[idx];
- assert(pLast);
-
- return 0;
-}
-
-
-long Cluster::GetNext(
- const BlockEntry* pCurr,
- const BlockEntry*& pNext) const
-{
- assert(pCurr);
- assert(m_entries);
- assert(m_entries_count > 0);
-
- size_t idx = pCurr->GetIndex();
- assert(idx < size_t(m_entries_count));
- assert(m_entries[idx] == pCurr);
-
- ++idx;
-
- if (idx >= size_t(m_entries_count))
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //error
- {
- pNext = NULL;
- return status;
- }
-
- if (status > 0)
- {
- pNext = NULL;
- return 0;
- }
-
- assert(m_entries);
- assert(m_entries_count > 0);
- assert(idx < size_t(m_entries_count));
- }
-
- pNext = m_entries[idx];
- assert(pNext);
-
- return 0;
-}
-
-
-long Cluster::GetEntryCount() const
-{
- return m_entries_count;
-}
-
-
-const BlockEntry* Cluster::GetEntry(
- const Track* pTrack,
- long long time_ns) const
-{
- assert(pTrack);
-
- if (m_pSegment == NULL) //this is the special EOS cluster
- return pTrack->GetEOS();
-
-#if 0
-
- LoadBlockEntries();
-
- if ((m_entries == NULL) || (m_entries_count <= 0))
- return NULL; //return EOS here?
-
- const BlockEntry* pResult = pTrack->GetEOS();
-
- BlockEntry** i = m_entries;
- assert(i);
-
- BlockEntry** const j = i + m_entries_count;
-
- while (i != j)
- {
- const BlockEntry* const pEntry = *i++;
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != pTrack->GetNumber())
- continue;
-
- if (pTrack->VetEntry(pEntry))
- {
- if (time_ns < 0) //just want first candidate block
- return pEntry;
-
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- break;
-
- pResult = pEntry;
- }
- else if (time_ns >= 0)
- {
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- break;
- }
- }
-
- return pResult;
-
-#else
-
- const BlockEntry* pResult = pTrack->GetEOS();
-
- long index = 0;
-
- for (;;)
- {
- if (index >= m_entries_count)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
- assert(status >= 0);
-
- if (status > 0) //completely parsed, and no more entries
- return pResult;
-
- if (status < 0) //should never happen
- return 0;
-
- assert(m_entries);
- assert(index < m_entries_count);
- }
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != pTrack->GetNumber())
- {
- ++index;
- continue;
- }
-
- if (pTrack->VetEntry(pEntry))
- {
- if (time_ns < 0) //just want first candidate block
- return pEntry;
-
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- return pResult;
-
- pResult = pEntry; //have a candidate
- }
- else if (time_ns >= 0)
- {
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- return pResult;
- }
-
- ++index;
- }
-
-#endif
-}
-
-
-const BlockEntry*
-Cluster::GetEntry(
- const CuePoint& cp,
- const CuePoint::TrackPosition& tp) const
-{
- assert(m_pSegment);
-
-#if 0
-
- LoadBlockEntries();
-
- if (m_entries == NULL)
- return NULL;
-
- const long long count = m_entries_count;
-
- if (count <= 0)
- return NULL;
-
- const long long tc = cp.GetTimeCode();
-
- if ((tp.m_block > 0) && (tp.m_block <= count))
- {
- const size_t block = static_cast<size_t>(tp.m_block);
- const size_t index = block - 1;
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if ((pBlock->GetTrackNumber() == tp.m_track) &&
- (pBlock->GetTimeCode(this) == tc))
- {
- return pEntry;
- }
- }
-
- const BlockEntry* const* i = m_entries;
- const BlockEntry* const* const j = i + count;
-
- while (i != j)
- {
-#ifdef _DEBUG
- const ptrdiff_t idx = i - m_entries;
- idx;
-#endif
-
- const BlockEntry* const pEntry = *i++;
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != tp.m_track)
- continue;
-
- const long long tc_ = pBlock->GetTimeCode(this);
- assert(tc_ >= 0);
-
- if (tc_ < tc)
- continue;
-
- if (tc_ > tc)
- return NULL;
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(tp.m_track);
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return NULL;
-
- const long long type = pTrack->GetType();
-
- if (type == 2) //audio
- return pEntry;
-
- if (type != 1) //not video
- return NULL;
-
- if (!pBlock->IsKey())
- return NULL;
-
- return pEntry;
- }
-
- return NULL;
-
-#else
-
- const long long tc = cp.GetTimeCode();
-
- if (tp.m_block > 0)
- {
- const long block = static_cast<long>(tp.m_block);
- const long index = block - 1;
-
- while (index >= m_entries_count)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //TODO: can this happen?
- return NULL;
-
- if (status > 0) //nothing remains to be parsed
- return NULL;
- }
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if ((pBlock->GetTrackNumber() == tp.m_track) &&
- (pBlock->GetTimeCode(this) == tc))
- {
- return pEntry;
- }
- }
-
- long index = 0;
-
- for (;;)
- {
- if (index >= m_entries_count)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //TODO: can this happen?
- return NULL;
-
- if (status > 0) //nothing remains to be parsed
- return NULL;
-
- assert(m_entries);
- assert(index < m_entries_count);
- }
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != tp.m_track)
- {
- ++index;
- continue;
- }
-
- const long long tc_ = pBlock->GetTimeCode(this);
-
- if (tc_ < tc)
- {
- ++index;
- continue;
- }
-
- if (tc_ > tc)
- return NULL;
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(tp.m_track);
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return NULL;
-
- const long long type = pTrack->GetType();
-
- if (type == 2) //audio
- return pEntry;
-
- if (type != 1) //not video
- return NULL;
-
- if (!pBlock->IsKey())
- return NULL;
-
- return pEntry;
- }
-
-#endif
-
-}
-
-
-#if 0
-const BlockEntry* Cluster::GetMaxKey(const VideoTrack* pTrack) const
-{
- assert(pTrack);
-
- if (m_pSegment == NULL) //EOS
- return pTrack->GetEOS();
-
- LoadBlockEntries();
-
- if ((m_entries == NULL) || (m_entries_count <= 0))
- return pTrack->GetEOS();
-
- BlockEntry** i = m_entries + m_entries_count;
- BlockEntry** const j = m_entries;
-
- while (i != j)
- {
- const BlockEntry* const pEntry = *--i;
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != pTrack->GetNumber())
- continue;
-
- if (pBlock->IsKey())
- return pEntry;
- }
-
- return pTrack->GetEOS(); //no satisfactory block found
-}
-#endif
-
-
-BlockEntry::BlockEntry(Cluster* p, long idx) :
- m_pCluster(p),
- m_index(idx)
-{
-}
-
-
-BlockEntry::~BlockEntry()
-{
-}
-
-
-bool BlockEntry::EOS() const
-{
- return (GetKind() == kBlockEOS);
-}
-
-
-const Cluster* BlockEntry::GetCluster() const
-{
- return m_pCluster;
-}
-
-
-long BlockEntry::GetIndex() const
-{
- return m_index;
-}
-
-
-SimpleBlock::SimpleBlock(
- Cluster* pCluster,
- long idx,
- long long start,
- long long size) :
- BlockEntry(pCluster, idx),
- m_block(start, size, 0)
-{
-}
-
-
-long SimpleBlock::Parse()
-{
- return m_block.Parse(m_pCluster);
-}
-
-
-BlockEntry::Kind SimpleBlock::GetKind() const
-{
- return kBlockSimple;
-}
-
-
-const Block* SimpleBlock::GetBlock() const
-{
- return &m_block;
-}
-
-
-BlockGroup::BlockGroup(
- Cluster* pCluster,
- long idx,
- long long block_start,
- long long block_size,
- long long prev,
- long long next,
- long long duration,
- long long discard_padding) :
- BlockEntry(pCluster, idx),
- m_block(block_start, block_size, discard_padding),
- m_prev(prev),
- m_next(next),
- m_duration(duration)
-{
-}
-
-
-long BlockGroup::Parse()
-{
- const long status = m_block.Parse(m_pCluster);
-
- if (status)
- return status;
-
- m_block.SetKey((m_prev > 0) && (m_next <= 0));
-
- return 0;
-}
-
-
-#if 0
-void BlockGroup::ParseBlock(long long start, long long size)
-{
- IMkvReader* const pReader = m_pCluster->m_pSegment->m_pReader;
-
- Block* const pBlock = new Block(start, size, pReader);
- assert(pBlock); //TODO
-
- //TODO: the Matroska spec says you have multiple blocks within the
- //same block group, with blocks ranked by priority (the flag bits).
-
- assert(m_pBlock == NULL);
- m_pBlock = pBlock;
-}
-#endif
-
-
-BlockEntry::Kind BlockGroup::GetKind() const
-{
- return kBlockGroup;
-}
-
-
-const Block* BlockGroup::GetBlock() const
-{
- return &m_block;
-}
-
-
-long long BlockGroup::GetPrevTimeCode() const
-{
- return m_prev;
-}
-
-
-long long BlockGroup::GetNextTimeCode() const
-{
- return m_next;
-}
-
-long long BlockGroup::GetDurationTimeCode() const
-{
- return m_duration;
-}
-
-Block::Block(long long start, long long size_, long long discard_padding) :
- m_start(start),
- m_size(size_),
- m_track(0),
- m_timecode(-1),
- m_flags(0),
- m_frames(NULL),
- m_frame_count(-1),
- m_discard_padding(discard_padding)
-{
-}
-
-
-Block::~Block()
-{
- delete[] m_frames;
-}
-
-
-long Block::Parse(const Cluster* pCluster)
-{
- if (pCluster == NULL)
- return -1;
-
- if (pCluster->m_pSegment == NULL)
- return -1;
-
- assert(m_start >= 0);
- assert(m_size >= 0);
- assert(m_track <= 0);
- assert(m_frames == NULL);
- assert(m_frame_count <= 0);
-
- long long pos = m_start;
- const long long stop = m_start + m_size;
-
- long len;
-
- IMkvReader* const pReader = pCluster->m_pSegment->m_pReader;
-
- m_track = ReadUInt(pReader, pos, len);
-
- if (m_track <= 0)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > stop)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume track number
-
- if ((stop - pos) < 2)
- return E_FILE_FORMAT_INVALID;
-
- long status;
- long long value;
-
- status = UnserializeInt(pReader, pos, 2, value);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- if (value < SHRT_MIN)
- return E_FILE_FORMAT_INVALID;
-
- if (value > SHRT_MAX)
- return E_FILE_FORMAT_INVALID;
-
- m_timecode = static_cast<short>(value);
-
- pos += 2;
-
- if ((stop - pos) <= 0)
- return E_FILE_FORMAT_INVALID;
-
- status = pReader->Read(pos, 1, &m_flags);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- const int lacing = int(m_flags & 0x06) >> 1;
-
- ++pos; //consume flags byte
-
- if (lacing == 0) //no lacing
- {
- if (pos > stop)
- return E_FILE_FORMAT_INVALID;
-
- m_frame_count = 1;
- m_frames = new Frame[m_frame_count];
-
- Frame& f = m_frames[0];
- f.pos = pos;
-
- const long long frame_size = stop - pos;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- f.len = static_cast<long>(frame_size);
-
- return 0; //success
- }
-
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- unsigned char biased_count;
-
- status = pReader->Read(pos, 1, &biased_count);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- ++pos; //consume frame count
- assert(pos <= stop);
-
- m_frame_count = int(biased_count) + 1;
-
- m_frames = new Frame[m_frame_count];
- assert(m_frames);
-
- if (lacing == 1) //Xiph
- {
- Frame* pf = m_frames;
- Frame* const pf_end = pf + m_frame_count;
-
- long size = 0;
- int frame_count = m_frame_count;
-
- while (frame_count > 1)
- {
- long frame_size = 0;
-
- for (;;)
- {
- unsigned char val;
-
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- status = pReader->Read(pos, 1, &val);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- ++pos; //consume xiph size byte
-
- frame_size += val;
-
- if (val < 255)
- break;
- }
-
- Frame& f = *pf++;
- assert(pf < pf_end);
-
- f.pos = 0; //patch later
-
- f.len = frame_size;
- size += frame_size; //contribution of this frame
-
- --frame_count;
- }
-
- assert(pf < pf_end);
- assert(pos <= stop);
-
- {
- Frame& f = *pf++;
-
- if (pf != pf_end)
- return E_FILE_FORMAT_INVALID;
-
- f.pos = 0; //patch later
-
- const long long total_size = stop - pos;
-
- if (total_size < size)
- return E_FILE_FORMAT_INVALID;
-
- const long long frame_size = total_size - size;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- f.len = static_cast<long>(frame_size);
- }
-
- pf = m_frames;
- while (pf != pf_end)
- {
- Frame& f = *pf++;
- assert((pos + f.len) <= stop);
-
- f.pos = pos;
- pos += f.len;
- }
-
- assert(pos == stop);
- }
- else if (lacing == 2) //fixed-size lacing
- {
- const long long total_size = stop - pos;
-
- if ((total_size % m_frame_count) != 0)
- return E_FILE_FORMAT_INVALID;
-
- const long long frame_size = total_size / m_frame_count;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- Frame* pf = m_frames;
- Frame* const pf_end = pf + m_frame_count;
-
- while (pf != pf_end)
- {
- assert((pos + frame_size) <= stop);
-
- Frame& f = *pf++;
-
- f.pos = pos;
- f.len = static_cast<long>(frame_size);
-
- pos += frame_size;
- }
-
- assert(pos == stop);
- }
- else
- {
- assert(lacing == 3); //EBML lacing
-
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- long size = 0;
- int frame_count = m_frame_count;
-
- long long frame_size = ReadUInt(pReader, pos, len);
-
- if (frame_size < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > stop)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume length of size of first frame
-
- if ((pos + frame_size) > stop)
- return E_FILE_FORMAT_INVALID;
-
- Frame* pf = m_frames;
- Frame* const pf_end = pf + m_frame_count;
-
- {
- Frame& curr = *pf;
-
- curr.pos = 0; //patch later
-
- curr.len = static_cast<long>(frame_size);
- size += curr.len; //contribution of this frame
- }
-
- --frame_count;
-
- while (frame_count > 1)
- {
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- assert(pf < pf_end);
-
- const Frame& prev = *pf++;
- assert(prev.len == frame_size);
- if (prev.len != frame_size)
- return E_FILE_FORMAT_INVALID;
-
- assert(pf < pf_end);
-
- Frame& curr = *pf;
-
- curr.pos = 0; //patch later
-
- const long long delta_size_ = ReadUInt(pReader, pos, len);
-
- if (delta_size_ < 0)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > stop)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume length of (delta) size
- assert(pos <= stop);
-
- const int exp = 7*len - 1;
- const long long bias = (1LL << exp) - 1LL;
- const long long delta_size = delta_size_ - bias;
-
- frame_size += delta_size;
-
- if (frame_size < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- curr.len = static_cast<long>(frame_size);
- size += curr.len; //contribution of this frame
-
- --frame_count;
- }
-
- {
- assert(pos <= stop);
- assert(pf < pf_end);
-
- const Frame& prev = *pf++;
- assert(prev.len == frame_size);
- if (prev.len != frame_size)
- return E_FILE_FORMAT_INVALID;
-
- assert(pf < pf_end);
-
- Frame& curr = *pf++;
- assert(pf == pf_end);
-
- curr.pos = 0; //patch later
-
- const long long total_size = stop - pos;
-
- if (total_size < size)
- return E_FILE_FORMAT_INVALID;
-
- frame_size = total_size - size;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- curr.len = static_cast<long>(frame_size);
- }
-
- pf = m_frames;
- while (pf != pf_end)
- {
- Frame& f = *pf++;
- assert((pos + f.len) <= stop);
-
- f.pos = pos;
- pos += f.len;
- }
-
- assert(pos == stop);
- }
-
- return 0; //success
-}
-
-
-long long Block::GetTimeCode(const Cluster* pCluster) const
-{
- if (pCluster == 0)
- return m_timecode;
-
- const long long tc0 = pCluster->GetTimeCode();
- assert(tc0 >= 0);
-
- const long long tc = tc0 + m_timecode;
-
- return tc; //unscaled timecode units
-}
-
-
-long long Block::GetTime(const Cluster* pCluster) const
-{
- assert(pCluster);
-
- const long long tc = GetTimeCode(pCluster);
-
- const Segment* const pSegment = pCluster->m_pSegment;
- const SegmentInfo* const pInfo = pSegment->GetInfo();
- assert(pInfo);
-
- const long long scale = pInfo->GetTimeCodeScale();
- assert(scale >= 1);
-
- const long long ns = tc * scale;
-
- return ns;
-}
-
-
-long long Block::GetTrackNumber() const
-{
- return m_track;
-}
-
-
-bool Block::IsKey() const
-{
- return ((m_flags & static_cast<unsigned char>(1 << 7)) != 0);
-}
-
-
-void Block::SetKey(bool bKey)
-{
- if (bKey)
- m_flags |= static_cast<unsigned char>(1 << 7);
- else
- m_flags &= 0x7F;
-}
-
-
-bool Block::IsInvisible() const
-{
- return bool(int(m_flags & 0x08) != 0);
-}
-
-
-Block::Lacing Block::GetLacing() const
-{
- const int value = int(m_flags & 0x06) >> 1;
- return static_cast<Lacing>(value);
-}
-
-
-int Block::GetFrameCount() const
-{
- return m_frame_count;
-}
-
-
-const Block::Frame& Block::GetFrame(int idx) const
-{
- assert(idx >= 0);
- assert(idx < m_frame_count);
-
- const Frame& f = m_frames[idx];
- assert(f.pos > 0);
- assert(f.len > 0);
-
- return f;
-}
-
-
-long Block::Frame::Read(IMkvReader* pReader, unsigned char* buf) const
-{
- assert(pReader);
- assert(buf);
-
- const long status = pReader->Read(pos, len, buf);
- return status;
-}
-
-long long Block::GetDiscardPadding() const
-{
- return m_discard_padding;
-}
-
-} //end namespace mkvparser
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.hpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.hpp
deleted file mode 100644
index 7184d26..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvparser.hpp
+++ /dev/null
@@ -1,1079 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef MKVPARSER_HPP
-#define MKVPARSER_HPP
-
-#include <cstdlib>
-#include <cstdio>
-#include <cstddef>
-
-namespace mkvparser
-{
-
-const int E_FILE_FORMAT_INVALID = -2;
-const int E_BUFFER_NOT_FULL = -3;
-
-class IMkvReader
-{
-public:
- virtual int Read(long long pos, long len, unsigned char* buf) = 0;
- virtual int Length(long long* total, long long* available) = 0;
-protected:
- virtual ~IMkvReader();
-};
-
-long long GetUIntLength(IMkvReader*, long long, long&);
-long long ReadUInt(IMkvReader*, long long, long&);
-long long UnserializeUInt(IMkvReader*, long long pos, long long size);
-
-long UnserializeFloat(IMkvReader*, long long pos, long long size, double&);
-long UnserializeInt(IMkvReader*, long long pos, long len, long long& result);
-
-long UnserializeString(
- IMkvReader*,
- long long pos,
- long long size,
- char*& str);
-
-long ParseElementHeader(
- IMkvReader* pReader,
- long long& pos, //consume id and size fields
- long long stop, //if you know size of element's parent
- long long& id,
- long long& size);
-
-bool Match(IMkvReader*, long long&, unsigned long, long long&);
-bool Match(IMkvReader*, long long&, unsigned long, unsigned char*&, size_t&);
-
-void GetVersion(int& major, int& minor, int& build, int& revision);
-
-struct EBMLHeader
-{
- EBMLHeader();
- ~EBMLHeader();
- long long m_version;
- long long m_readVersion;
- long long m_maxIdLength;
- long long m_maxSizeLength;
- char* m_docType;
- long long m_docTypeVersion;
- long long m_docTypeReadVersion;
-
- long long Parse(IMkvReader*, long long&);
- void Init();
-};
-
-
-class Segment;
-class Track;
-class Cluster;
-
-class Block
-{
- Block(const Block&);
- Block& operator=(const Block&);
-
-public:
- const long long m_start;
- const long long m_size;
-
- Block(long long start, long long size, long long discard_padding);
- ~Block();
-
- long Parse(const Cluster*);
-
- long long GetTrackNumber() const;
- long long GetTimeCode(const Cluster*) const; //absolute, but not scaled
- long long GetTime(const Cluster*) const; //absolute, and scaled (ns)
- bool IsKey() const;
- void SetKey(bool);
- bool IsInvisible() const;
-
- enum Lacing { kLacingNone, kLacingXiph, kLacingFixed, kLacingEbml };
- Lacing GetLacing() const;
-
- int GetFrameCount() const; //to index frames: [0, count)
-
- struct Frame
- {
- long long pos; //absolute offset
- long len;
-
- long Read(IMkvReader*, unsigned char*) const;
- };
-
- const Frame& GetFrame(int frame_index) const;
-
- long long GetDiscardPadding() const;
-
-private:
- long long m_track; //Track::Number()
- short m_timecode; //relative to cluster
- unsigned char m_flags;
-
- Frame* m_frames;
- int m_frame_count;
-
-protected:
- const long long m_discard_padding;
-};
-
-
-class BlockEntry
-{
- BlockEntry(const BlockEntry&);
- BlockEntry& operator=(const BlockEntry&);
-
-protected:
- BlockEntry(Cluster*, long index);
-
-public:
- virtual ~BlockEntry();
-
- bool EOS() const;
- const Cluster* GetCluster() const;
- long GetIndex() const;
- virtual const Block* GetBlock() const = 0;
-
- enum Kind { kBlockEOS, kBlockSimple, kBlockGroup };
- virtual Kind GetKind() const = 0;
-
-protected:
- Cluster* const m_pCluster;
- const long m_index;
-
-};
-
-
-class SimpleBlock : public BlockEntry
-{
- SimpleBlock(const SimpleBlock&);
- SimpleBlock& operator=(const SimpleBlock&);
-
-public:
- SimpleBlock(Cluster*, long index, long long start, long long size);
- long Parse();
-
- Kind GetKind() const;
- const Block* GetBlock() const;
-
-protected:
- Block m_block;
-
-};
-
-
-class BlockGroup : public BlockEntry
-{
- BlockGroup(const BlockGroup&);
- BlockGroup& operator=(const BlockGroup&);
-
-public:
- BlockGroup(
- Cluster*,
- long index,
- long long block_start, //absolute pos of block's payload
- long long block_size, //size of block's payload
- long long prev,
- long long next,
- long long duration,
- long long discard_padding);
-
- long Parse();
-
- Kind GetKind() const;
- const Block* GetBlock() const;
-
- long long GetPrevTimeCode() const; //relative to block's time
- long long GetNextTimeCode() const; //as above
- long long GetDurationTimeCode() const;
-
-private:
- Block m_block;
- const long long m_prev;
- const long long m_next;
- const long long m_duration;
-};
-
-///////////////////////////////////////////////////////////////
-// ContentEncoding element
-// Elements used to describe if the track data has been encrypted or
-// compressed with zlib or header stripping.
-class ContentEncoding {
-public:
- enum {
- kCTR = 1
- };
-
- ContentEncoding();
- ~ContentEncoding();
-
- // ContentCompression element names
- struct ContentCompression {
- ContentCompression();
- ~ContentCompression();
-
- unsigned long long algo;
- unsigned char* settings;
- long long settings_len;
- };
-
- // ContentEncAESSettings element names
- struct ContentEncAESSettings {
- ContentEncAESSettings() : cipher_mode(kCTR) {}
- ~ContentEncAESSettings() {}
-
- unsigned long long cipher_mode;
- };
-
- // ContentEncryption element names
- struct ContentEncryption {
- ContentEncryption();
- ~ContentEncryption();
-
- unsigned long long algo;
- unsigned char* key_id;
- long long key_id_len;
- unsigned char* signature;
- long long signature_len;
- unsigned char* sig_key_id;
- long long sig_key_id_len;
- unsigned long long sig_algo;
- unsigned long long sig_hash_algo;
-
- ContentEncAESSettings aes_settings;
- };
-
- // Returns ContentCompression represented by |idx|. Returns NULL if |idx|
- // is out of bounds.
- const ContentCompression* GetCompressionByIndex(unsigned long idx) const;
-
- // Returns number of ContentCompression elements in this ContentEncoding
- // element.
- unsigned long GetCompressionCount() const;
-
- // Parses the ContentCompression element from |pReader|. |start| is the
- // starting offset of the ContentCompression payload. |size| is the size in
- // bytes of the ContentCompression payload. |compression| is where the parsed
- // values will be stored.
- long ParseCompressionEntry(long long start,
- long long size,
- IMkvReader* pReader,
- ContentCompression* compression);
-
- // Returns ContentEncryption represented by |idx|. Returns NULL if |idx|
- // is out of bounds.
- const ContentEncryption* GetEncryptionByIndex(unsigned long idx) const;
-
- // Returns number of ContentEncryption elements in this ContentEncoding
- // element.
- unsigned long GetEncryptionCount() const;
-
- // Parses the ContentEncAESSettings element from |pReader|. |start| is the
- // starting offset of the ContentEncAESSettings payload. |size| is the
- // size in bytes of the ContentEncAESSettings payload. |encryption| is
- // where the parsed values will be stored.
- long ParseContentEncAESSettingsEntry(long long start,
- long long size,
- IMkvReader* pReader,
- ContentEncAESSettings* aes);
-
- // Parses the ContentEncoding element from |pReader|. |start| is the
- // starting offset of the ContentEncoding payload. |size| is the size in
- // bytes of the ContentEncoding payload. Returns true on success.
- long ParseContentEncodingEntry(long long start,
- long long size,
- IMkvReader* pReader);
-
- // Parses the ContentEncryption element from |pReader|. |start| is the
- // starting offset of the ContentEncryption payload. |size| is the size in
- // bytes of the ContentEncryption payload. |encryption| is where the parsed
- // values will be stored.
- long ParseEncryptionEntry(long long start,
- long long size,
- IMkvReader* pReader,
- ContentEncryption* encryption);
-
- unsigned long long encoding_order() const { return encoding_order_; }
- unsigned long long encoding_scope() const { return encoding_scope_; }
- unsigned long long encoding_type() const { return encoding_type_; }
-
-private:
- // Member variables for list of ContentCompression elements.
- ContentCompression** compression_entries_;
- ContentCompression** compression_entries_end_;
-
- // Member variables for list of ContentEncryption elements.
- ContentEncryption** encryption_entries_;
- ContentEncryption** encryption_entries_end_;
-
- // ContentEncoding element names
- unsigned long long encoding_order_;
- unsigned long long encoding_scope_;
- unsigned long long encoding_type_;
-
- // LIBWEBM_DISALLOW_COPY_AND_ASSIGN(ContentEncoding);
- ContentEncoding(const ContentEncoding&);
- ContentEncoding& operator=(const ContentEncoding&);
-};
-
-class Track
-{
- Track(const Track&);
- Track& operator=(const Track&);
-
-public:
- class Info;
- static long Create(
- Segment*,
- const Info&,
- long long element_start,
- long long element_size,
- Track*&);
-
- enum Type {
- kVideo = 1,
- kAudio = 2,
- kSubtitle = 0x11,
- kMetadata = 0x21
- };
-
- Segment* const m_pSegment;
- const long long m_element_start;
- const long long m_element_size;
- virtual ~Track();
-
- long GetType() const;
- long GetNumber() const;
- unsigned long long GetUid() const;
- const char* GetNameAsUTF8() const;
- const char* GetLanguage() const;
- const char* GetCodecNameAsUTF8() const;
- const char* GetCodecId() const;
- const unsigned char* GetCodecPrivate(size_t&) const;
- bool GetLacing() const;
- unsigned long long GetDefaultDuration() const;
- unsigned long long GetCodecDelay() const;
- unsigned long long GetSeekPreRoll() const;
-
- const BlockEntry* GetEOS() const;
-
- struct Settings
- {
- long long start;
- long long size;
- };
-
- class Info
- {
- public:
- Info();
- ~Info();
- int Copy(Info&) const;
- void Clear();
- long type;
- long number;
- unsigned long long uid;
- unsigned long long defaultDuration;
- unsigned long long codecDelay;
- unsigned long long seekPreRoll;
- char* nameAsUTF8;
- char* language;
- char* codecId;
- char* codecNameAsUTF8;
- unsigned char* codecPrivate;
- size_t codecPrivateSize;
- bool lacing;
- Settings settings;
-
- private:
- Info(const Info&);
- Info& operator=(const Info&);
- int CopyStr(char* Info::*str, Info&) const;
- };
-
- long GetFirst(const BlockEntry*&) const;
- long GetNext(const BlockEntry* pCurr, const BlockEntry*& pNext) const;
- virtual bool VetEntry(const BlockEntry*) const;
- virtual long Seek(long long time_ns, const BlockEntry*&) const;
-
- const ContentEncoding* GetContentEncodingByIndex(unsigned long idx) const;
- unsigned long GetContentEncodingCount() const;
-
- long ParseContentEncodingsEntry(long long start, long long size);
-
-protected:
- Track(
- Segment*,
- long long element_start,
- long long element_size);
-
- Info m_info;
-
- class EOSBlock : public BlockEntry
- {
- public:
- EOSBlock();
-
- Kind GetKind() const;
- const Block* GetBlock() const;
- };
-
- EOSBlock m_eos;
-
-private:
- ContentEncoding** content_encoding_entries_;
- ContentEncoding** content_encoding_entries_end_;
-};
-
-
-class VideoTrack : public Track
-{
- VideoTrack(const VideoTrack&);
- VideoTrack& operator=(const VideoTrack&);
-
- VideoTrack(
- Segment*,
- long long element_start,
- long long element_size);
-
-public:
- static long Parse(
- Segment*,
- const Info&,
- long long element_start,
- long long element_size,
- VideoTrack*&);
-
- long long GetWidth() const;
- long long GetHeight() const;
- double GetFrameRate() const;
-
- bool VetEntry(const BlockEntry*) const;
- long Seek(long long time_ns, const BlockEntry*&) const;
-
-private:
- long long m_width;
- long long m_height;
- double m_rate;
-
-};
-
-
-class AudioTrack : public Track
-{
- AudioTrack(const AudioTrack&);
- AudioTrack& operator=(const AudioTrack&);
-
- AudioTrack(
- Segment*,
- long long element_start,
- long long element_size);
-public:
- static long Parse(
- Segment*,
- const Info&,
- long long element_start,
- long long element_size,
- AudioTrack*&);
-
- double GetSamplingRate() const;
- long long GetChannels() const;
- long long GetBitDepth() const;
-
-private:
- double m_rate;
- long long m_channels;
- long long m_bitDepth;
-};
-
-
-class Tracks
-{
- Tracks(const Tracks&);
- Tracks& operator=(const Tracks&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- Tracks(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
-
- ~Tracks();
-
- long Parse();
-
- unsigned long GetTracksCount() const;
-
- const Track* GetTrackByNumber(long tn) const;
- const Track* GetTrackByIndex(unsigned long idx) const;
-
-private:
- Track** m_trackEntries;
- Track** m_trackEntriesEnd;
-
- long ParseTrackEntry(
- long long payload_start,
- long long payload_size,
- long long element_start,
- long long element_size,
- Track*&) const;
-
-};
-
-
-class Chapters
-{
- Chapters(const Chapters&);
- Chapters& operator=(const Chapters&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- Chapters(
- Segment*,
- long long payload_start,
- long long payload_size,
- long long element_start,
- long long element_size);
-
- ~Chapters();
-
- long Parse();
-
- class Atom;
- class Edition;
-
- class Display
- {
- friend class Atom;
- Display();
- Display(const Display&);
- ~Display();
- Display& operator=(const Display&);
- public:
- const char* GetString() const;
- const char* GetLanguage() const;
- const char* GetCountry() const;
- private:
- void Init();
- void ShallowCopy(Display&) const;
- void Clear();
- long Parse(IMkvReader*, long long pos, long long size);
-
- char* m_string;
- char* m_language;
- char* m_country;
- };
-
- class Atom
- {
- friend class Edition;
- Atom();
- Atom(const Atom&);
- ~Atom();
- Atom& operator=(const Atom&);
- public:
- unsigned long long GetUID() const;
- const char* GetStringUID() const;
-
- long long GetStartTimecode() const;
- long long GetStopTimecode() const;
-
- long long GetStartTime(const Chapters*) const;
- long long GetStopTime(const Chapters*) const;
-
- int GetDisplayCount() const;
- const Display* GetDisplay(int index) const;
- private:
- void Init();
- void ShallowCopy(Atom&) const;
- void Clear();
- long Parse(IMkvReader*, long long pos, long long size);
- static long long GetTime(const Chapters*, long long timecode);
-
- long ParseDisplay(IMkvReader*, long long pos, long long size);
- bool ExpandDisplaysArray();
-
- char* m_string_uid;
- unsigned long long m_uid;
- long long m_start_timecode;
- long long m_stop_timecode;
-
- Display* m_displays;
- int m_displays_size;
- int m_displays_count;
- };
-
- class Edition
- {
- friend class Chapters;
- Edition();
- Edition(const Edition&);
- ~Edition();
- Edition& operator=(const Edition&);
- public:
- int GetAtomCount() const;
- const Atom* GetAtom(int index) const;
- private:
- void Init();
- void ShallowCopy(Edition&) const;
- void Clear();
- long Parse(IMkvReader*, long long pos, long long size);
-
- long ParseAtom(IMkvReader*, long long pos, long long size);
- bool ExpandAtomsArray();
-
- Atom* m_atoms;
- int m_atoms_size;
- int m_atoms_count;
- };
-
- int GetEditionCount() const;
- const Edition* GetEdition(int index) const;
-
-private:
- long ParseEdition(long long pos, long long size);
- bool ExpandEditionsArray();
-
- Edition* m_editions;
- int m_editions_size;
- int m_editions_count;
-
-};
-
-
-class SegmentInfo
-{
- SegmentInfo(const SegmentInfo&);
- SegmentInfo& operator=(const SegmentInfo&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- SegmentInfo(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
-
- ~SegmentInfo();
-
- long Parse();
-
- long long GetTimeCodeScale() const;
- long long GetDuration() const; //scaled
- const char* GetMuxingAppAsUTF8() const;
- const char* GetWritingAppAsUTF8() const;
- const char* GetTitleAsUTF8() const;
-
-private:
- long long m_timecodeScale;
- double m_duration;
- char* m_pMuxingAppAsUTF8;
- char* m_pWritingAppAsUTF8;
- char* m_pTitleAsUTF8;
-};
-
-
-class SeekHead
-{
- SeekHead(const SeekHead&);
- SeekHead& operator=(const SeekHead&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- SeekHead(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
-
- ~SeekHead();
-
- long Parse();
-
- struct Entry
- {
- //the SeekHead entry payload
- long long id;
- long long pos;
-
- //absolute pos of SeekEntry ID
- long long element_start;
-
- //SeekEntry ID size + size size + payload
- long long element_size;
- };
-
- int GetCount() const;
- const Entry* GetEntry(int idx) const;
-
- struct VoidElement
- {
- //absolute pos of Void ID
- long long element_start;
-
- //ID size + size size + payload size
- long long element_size;
- };
-
- int GetVoidElementCount() const;
- const VoidElement* GetVoidElement(int idx) const;
-
-private:
- Entry* m_entries;
- int m_entry_count;
-
- VoidElement* m_void_elements;
- int m_void_element_count;
-
- static bool ParseEntry(
- IMkvReader*,
- long long pos, //payload
- long long size,
- Entry*);
-
-};
-
-class Cues;
-class CuePoint
-{
- friend class Cues;
-
- CuePoint(long, long long);
- ~CuePoint();
-
- CuePoint(const CuePoint&);
- CuePoint& operator=(const CuePoint&);
-
-public:
- long long m_element_start;
- long long m_element_size;
-
- void Load(IMkvReader*);
-
- long long GetTimeCode() const; //absolute but unscaled
- long long GetTime(const Segment*) const; //absolute and scaled (ns units)
-
- struct TrackPosition
- {
- long long m_track;
- long long m_pos; //of cluster
- long long m_block;
- //codec_state //defaults to 0
- //reference = clusters containing req'd referenced blocks
- // reftime = timecode of the referenced block
-
- void Parse(IMkvReader*, long long, long long);
- };
-
- const TrackPosition* Find(const Track*) const;
-
-private:
- const long m_index;
- long long m_timecode;
- TrackPosition* m_track_positions;
- size_t m_track_positions_count;
-
-};
-
-
-class Cues
-{
- friend class Segment;
-
- Cues(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
- ~Cues();
-
- Cues(const Cues&);
- Cues& operator=(const Cues&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- bool Find( //lower bound of time_ns
- long long time_ns,
- const Track*,
- const CuePoint*&,
- const CuePoint::TrackPosition*&) const;
-
-#if 0
- bool FindNext( //upper_bound of time_ns
- long long time_ns,
- const Track*,
- const CuePoint*&,
- const CuePoint::TrackPosition*&) const;
-#endif
-
- const CuePoint* GetFirst() const;
- const CuePoint* GetLast() const;
- const CuePoint* GetNext(const CuePoint*) const;
-
- const BlockEntry* GetBlock(
- const CuePoint*,
- const CuePoint::TrackPosition*) const;
-
- bool LoadCuePoint() const;
- long GetCount() const; //loaded only
- //long GetTotal() const; //loaded + preloaded
- bool DoneParsing() const;
-
-private:
- void Init() const;
- void PreloadCuePoint(long&, long long) const;
-
- mutable CuePoint** m_cue_points;
- mutable long m_count;
- mutable long m_preload_count;
- mutable long long m_pos;
-
-};
-
-
-class Cluster
-{
- friend class Segment;
-
- Cluster(const Cluster&);
- Cluster& operator=(const Cluster&);
-
-public:
- Segment* const m_pSegment;
-
-public:
- static Cluster* Create(
- Segment*,
- long index, //index in segment
- long long off); //offset relative to segment
- //long long element_size);
-
- Cluster(); //EndOfStream
- ~Cluster();
-
- bool EOS() const;
-
- long long GetTimeCode() const; //absolute, but not scaled
- long long GetTime() const; //absolute, and scaled (nanosecond units)
- long long GetFirstTime() const; //time (ns) of first (earliest) block
- long long GetLastTime() const; //time (ns) of last (latest) block
-
- long GetFirst(const BlockEntry*&) const;
- long GetLast(const BlockEntry*&) const;
- long GetNext(const BlockEntry* curr, const BlockEntry*& next) const;
-
- const BlockEntry* GetEntry(const Track*, long long ns = -1) const;
- const BlockEntry* GetEntry(
- const CuePoint&,
- const CuePoint::TrackPosition&) const;
- //const BlockEntry* GetMaxKey(const VideoTrack*) const;
-
-// static bool HasBlockEntries(const Segment*, long long);
-
- static long HasBlockEntries(
- const Segment*,
- long long idoff,
- long long& pos,
- long& size);
-
- long GetEntryCount() const;
-
- long Load(long long& pos, long& size) const;
-
- long Parse(long long& pos, long& size) const;
- long GetEntry(long index, const mkvparser::BlockEntry*&) const;
-
-protected:
- Cluster(
- Segment*,
- long index,
- long long element_start);
- //long long element_size);
-
-public:
- const long long m_element_start;
- long long GetPosition() const; //offset relative to segment
-
- long GetIndex() const;
- long long GetElementSize() const;
- //long long GetPayloadSize() const;
-
- //long long Unparsed() const;
-
-private:
- long m_index;
- mutable long long m_pos;
- //mutable long long m_size;
- mutable long long m_element_size;
- mutable long long m_timecode;
- mutable BlockEntry** m_entries;
- mutable long m_entries_size;
- mutable long m_entries_count;
-
- long ParseSimpleBlock(long long, long long&, long&);
- long ParseBlockGroup(long long, long long&, long&);
-
- long CreateBlock(long long id, long long pos, long long size,
- long long discard_padding);
- long CreateBlockGroup(long long start_offset, long long size,
- long long discard_padding);
- long CreateSimpleBlock(long long, long long);
-
-};
-
-
-class Segment
-{
- friend class Cues;
- friend class Track;
- friend class VideoTrack;
-
- Segment(const Segment&);
- Segment& operator=(const Segment&);
-
-private:
- Segment(
- IMkvReader*,
- long long elem_start,
- //long long elem_size,
- long long pos,
- long long size);
-
-public:
- IMkvReader* const m_pReader;
- const long long m_element_start;
- //const long long m_element_size;
- const long long m_start; //posn of segment payload
- const long long m_size; //size of segment payload
- Cluster m_eos; //TODO: make private?
-
- static long long CreateInstance(IMkvReader*, long long, Segment*&);
- ~Segment();
-
- long Load(); //loads headers and all clusters
-
- //for incremental loading
- //long long Unparsed() const;
- bool DoneParsing() const;
- long long ParseHeaders(); //stops when first cluster is found
- //long FindNextCluster(long long& pos, long& size) const;
- long LoadCluster(long long& pos, long& size); //load one cluster
- long LoadCluster();
-
- long ParseNext(
- const Cluster* pCurr,
- const Cluster*& pNext,
- long long& pos,
- long& size);
-
-#if 0
- //This pair parses one cluster, but only changes the state of the
- //segment object when the cluster is actually added to the index.
- long ParseCluster(long long& cluster_pos, long long& new_pos) const;
- bool AddCluster(long long cluster_pos, long long new_pos);
-#endif
-
- const SeekHead* GetSeekHead() const;
- const Tracks* GetTracks() const;
- const SegmentInfo* GetInfo() const;
- const Cues* GetCues() const;
- const Chapters* GetChapters() const;
-
- long long GetDuration() const;
-
- unsigned long GetCount() const;
- const Cluster* GetFirst() const;
- const Cluster* GetLast() const;
- const Cluster* GetNext(const Cluster*);
-
- const Cluster* FindCluster(long long time_nanoseconds) const;
- //const BlockEntry* Seek(long long time_nanoseconds, const Track*) const;
-
- const Cluster* FindOrPreloadCluster(long long pos);
-
- long ParseCues(
- long long cues_off, //offset relative to start of segment
- long long& parse_pos,
- long& parse_len);
-
-private:
-
- long long m_pos; //absolute file posn; what has been consumed so far
- Cluster* m_pUnknownSize;
-
- SeekHead* m_pSeekHead;
- SegmentInfo* m_pInfo;
- Tracks* m_pTracks;
- Cues* m_pCues;
- Chapters* m_pChapters;
- Cluster** m_clusters;
- long m_clusterCount; //number of entries for which m_index >= 0
- long m_clusterPreloadCount; //number of entries for which m_index < 0
- long m_clusterSize; //array size
-
- long DoLoadCluster(long long&, long&);
- long DoLoadClusterUnknownSize(long long&, long&);
- long DoParseNext(const Cluster*&, long long&, long&);
-
- void AppendCluster(Cluster*);
- void PreloadCluster(Cluster*, ptrdiff_t);
-
- //void ParseSeekHead(long long pos, long long size);
- //void ParseSeekEntry(long long pos, long long size);
- //void ParseCues(long long);
-
- const BlockEntry* GetBlock(
- const CuePoint&,
- const CuePoint::TrackPosition&);
-
-};
-
-} //end namespace mkvparser
-
-inline long mkvparser::Segment::LoadCluster()
-{
- long long pos;
- long size;
-
- return LoadCluster(pos, size);
-}
-
-#endif //MKVPARSER_HPP
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.cpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.cpp
deleted file mode 100644
index cb3567f..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#include "mkvreader.hpp"
-
-#include <cassert>
-
-namespace mkvparser
-{
-
-MkvReader::MkvReader() :
- m_file(NULL)
-{
-}
-
-MkvReader::~MkvReader()
-{
- Close();
-}
-
-int MkvReader::Open(const char* fileName)
-{
- if (fileName == NULL)
- return -1;
-
- if (m_file)
- return -1;
-
-#ifdef _MSC_VER
- const errno_t e = fopen_s(&m_file, fileName, "rb");
-
- if (e)
- return -1; //error
-#else
- m_file = fopen(fileName, "rb");
-
- if (m_file == NULL)
- return -1;
-#endif
-
-#ifdef _MSC_VER
- int status = _fseeki64(m_file, 0L, SEEK_END);
-
- if (status)
- return -1; //error
-
- m_length = _ftelli64(m_file);
-#else
- fseek(m_file, 0L, SEEK_END);
- m_length = ftell(m_file);
-#endif
- assert(m_length >= 0);
-
-#ifdef _MSC_VER
- status = _fseeki64(m_file, 0L, SEEK_SET);
-
- if (status)
- return -1; //error
-#else
- fseek(m_file, 0L, SEEK_SET);
-#endif
-
- return 0;
-}
-
-void MkvReader::Close()
-{
- if (m_file != NULL)
- {
- fclose(m_file);
- m_file = NULL;
- }
-}
-
-int MkvReader::Length(long long* total, long long* available)
-{
- if (m_file == NULL)
- return -1;
-
- if (total)
- *total = m_length;
-
- if (available)
- *available = m_length;
-
- return 0;
-}
-
-int MkvReader::Read(long long offset, long len, unsigned char* buffer)
-{
- if (m_file == NULL)
- return -1;
-
- if (offset < 0)
- return -1;
-
- if (len < 0)
- return -1;
-
- if (len == 0)
- return 0;
-
- if (offset >= m_length)
- return -1;
-
-#ifdef _MSC_VER
- const int status = _fseeki64(m_file, offset, SEEK_SET);
-
- if (status)
- return -1; //error
-#else
- fseek(m_file, offset, SEEK_SET);
-#endif
-
- const size_t size = fread(buffer, 1, len, m_file);
-
- if (size < size_t(len))
- return -1; //error
-
- return 0; //success
-}
-
-} //end namespace mkvparser
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.hpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.hpp
deleted file mode 100644
index adcc29f..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvreader.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef MKVREADER_HPP
-#define MKVREADER_HPP
-
-#include "mkvparser.hpp"
-#include <cstdio>
-
-namespace mkvparser
-{
-
-class MkvReader : public IMkvReader
-{
- MkvReader(const MkvReader&);
- MkvReader& operator=(const MkvReader&);
-public:
- MkvReader();
- virtual ~MkvReader();
-
- int Open(const char*);
- void Close();
-
- virtual int Read(long long position, long length, unsigned char* buffer);
- virtual int Length(long long* total, long long* available);
-private:
- long long m_length;
- FILE* m_file;
-};
-
-} //end namespace mkvparser
-
-#endif //MKVREADER_HPP
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.cpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.cpp
deleted file mode 100644
index 8de89a4..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#include "mkvwriter.hpp"
-
-#ifdef _MSC_VER
-#include <share.h> // for _SH_DENYWR
-#endif
-
-#include <new>
-
-namespace mkvmuxer {
-
-MkvWriter::MkvWriter() : file_(NULL), writer_owns_file_(true) {
-}
-
-MkvWriter::MkvWriter(FILE* fp): file_(fp), writer_owns_file_(false) {
-}
-
-MkvWriter::~MkvWriter() {
- Close();
-}
-
-int32 MkvWriter::Write(const void* buffer, uint32 length) {
- if (!file_)
- return -1;
-
- if (length == 0)
- return 0;
-
- if (buffer == NULL)
- return -1;
-
- const size_t bytes_written = fwrite(buffer, 1, length, file_);
-
- return (bytes_written == length) ? 0 : -1;
-}
-
-bool MkvWriter::Open(const char* filename) {
- if (filename == NULL)
- return false;
-
- if (file_)
- return false;
-
-#ifdef _MSC_VER
- file_ = _fsopen(filename, "wb", _SH_DENYWR);
-#else
- file_ = fopen(filename, "wb");
-#endif
- if (file_ == NULL)
- return false;
- return true;
-}
-
-void MkvWriter::Close() {
- if (file_ && writer_owns_file_) {
- fclose(file_);
- }
- file_ = NULL;
-}
-
-int64 MkvWriter::Position() const {
- if (!file_)
- return 0;
-
-#ifdef _MSC_VER
- return _ftelli64(file_);
-#else
- return ftell(file_);
-#endif
-}
-
-int32 MkvWriter::Position(int64 position) {
- if (!file_)
- return -1;
-
-#ifdef _MSC_VER
- return _fseeki64(file_, position, SEEK_SET);
-#else
- return fseek(file_, position, SEEK_SET);
-#endif
-}
-
-bool MkvWriter::Seekable() const {
- return true;
-}
-
-void MkvWriter::ElementStartNotify(uint64, int64) {
-}
-
-} // namespace mkvmuxer
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.hpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.hpp
deleted file mode 100644
index 524e0f7..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/mkvwriter.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef MKVWRITER_HPP
-#define MKVWRITER_HPP
-
-#include <stdio.h>
-
-#include "mkvmuxer.hpp"
-#include "mkvmuxertypes.hpp"
-
-namespace mkvmuxer {
-
-// Default implementation of the IMkvWriter interface on Windows.
-class MkvWriter : public IMkvWriter {
- public:
- MkvWriter();
- MkvWriter(FILE* fp);
- virtual ~MkvWriter();
-
- // IMkvWriter interface
- virtual int64 Position() const;
- virtual int32 Position(int64 position);
- virtual bool Seekable() const;
- virtual int32 Write(const void* buffer, uint32 length);
- virtual void ElementStartNotify(uint64 element_id, int64 position);
-
- // Creates and opens a file for writing. |filename| is the name of the file
- // to open. This function will overwrite the contents of |filename|. Returns
- // true on success.
- bool Open(const char* filename);
-
- // Closes an opened file.
- void Close();
-
- private:
- // File handle to output file.
- FILE* file_;
- bool writer_owns_file_;
-
- LIBWEBM_DISALLOW_COPY_AND_ASSIGN(MkvWriter);
-};
-
-} //end namespace mkvmuxer
-
-#endif // MKVWRITER_HPP
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libwebm/webmids.hpp b/videocodec/libvpx_internal/libvpx/third_party/libwebm/webmids.hpp
deleted file mode 100644
index 65fab96..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libwebm/webmids.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef WEBMIDS_HPP
-#define WEBMIDS_HPP
-
-namespace mkvmuxer {
-
-enum MkvId {
- kMkvEBML = 0x1A45DFA3,
- kMkvEBMLVersion = 0x4286,
- kMkvEBMLReadVersion = 0x42F7,
- kMkvEBMLMaxIDLength = 0x42F2,
- kMkvEBMLMaxSizeLength = 0x42F3,
- kMkvDocType = 0x4282,
- kMkvDocTypeVersion = 0x4287,
- kMkvDocTypeReadVersion = 0x4285,
- kMkvVoid = 0xEC,
- kMkvSignatureSlot = 0x1B538667,
- kMkvSignatureAlgo = 0x7E8A,
- kMkvSignatureHash = 0x7E9A,
- kMkvSignaturePublicKey = 0x7EA5,
- kMkvSignature = 0x7EB5,
- kMkvSignatureElements = 0x7E5B,
- kMkvSignatureElementList = 0x7E7B,
- kMkvSignedElement = 0x6532,
- //segment
- kMkvSegment = 0x18538067,
- //Meta Seek Information
- kMkvSeekHead = 0x114D9B74,
- kMkvSeek = 0x4DBB,
- kMkvSeekID = 0x53AB,
- kMkvSeekPosition = 0x53AC,
- //Segment Information
- kMkvInfo = 0x1549A966,
- kMkvTimecodeScale = 0x2AD7B1,
- kMkvDuration = 0x4489,
- kMkvDateUTC = 0x4461,
- kMkvMuxingApp = 0x4D80,
- kMkvWritingApp = 0x5741,
- //Cluster
- kMkvCluster = 0x1F43B675,
- kMkvTimecode = 0xE7,
- kMkvPrevSize = 0xAB,
- kMkvBlockGroup = 0xA0,
- kMkvBlock = 0xA1,
- kMkvBlockDuration = 0x9B,
- kMkvReferenceBlock = 0xFB,
- kMkvLaceNumber = 0xCC,
- kMkvSimpleBlock = 0xA3,
- kMkvBlockAdditions = 0x75A1,
- kMkvBlockMore = 0xA6,
- kMkvBlockAddID = 0xEE,
- kMkvBlockAdditional = 0xA5,
- kMkvDiscardPadding = 0x75A2,
- //Track
- kMkvTracks = 0x1654AE6B,
- kMkvTrackEntry = 0xAE,
- kMkvTrackNumber = 0xD7,
- kMkvTrackUID = 0x73C5,
- kMkvTrackType = 0x83,
- kMkvFlagEnabled = 0xB9,
- kMkvFlagDefault = 0x88,
- kMkvFlagForced = 0x55AA,
- kMkvFlagLacing = 0x9C,
- kMkvDefaultDuration = 0x23E383,
- kMkvMaxBlockAdditionID = 0x55EE,
- kMkvName = 0x536E,
- kMkvLanguage = 0x22B59C,
- kMkvCodecID = 0x86,
- kMkvCodecPrivate = 0x63A2,
- kMkvCodecName = 0x258688,
- kMkvCodecDelay = 0x56AA,
- kMkvSeekPreRoll = 0x56BB,
- //video
- kMkvVideo = 0xE0,
- kMkvFlagInterlaced = 0x9A,
- kMkvStereoMode = 0x53B8,
- kMkvAlphaMode = 0x53C0,
- kMkvPixelWidth = 0xB0,
- kMkvPixelHeight = 0xBA,
- kMkvPixelCropBottom = 0x54AA,
- kMkvPixelCropTop = 0x54BB,
- kMkvPixelCropLeft = 0x54CC,
- kMkvPixelCropRight = 0x54DD,
- kMkvDisplayWidth = 0x54B0,
- kMkvDisplayHeight = 0x54BA,
- kMkvDisplayUnit = 0x54B2,
- kMkvAspectRatioType = 0x54B3,
- kMkvFrameRate = 0x2383E3,
- //end video
- //audio
- kMkvAudio = 0xE1,
- kMkvSamplingFrequency = 0xB5,
- kMkvOutputSamplingFrequency = 0x78B5,
- kMkvChannels = 0x9F,
- kMkvBitDepth = 0x6264,
- //end audio
- //ContentEncodings
- kMkvContentEncodings = 0x6D80,
- kMkvContentEncoding = 0x6240,
- kMkvContentEncodingOrder = 0x5031,
- kMkvContentEncodingScope = 0x5032,
- kMkvContentEncodingType = 0x5033,
- kMkvContentEncryption = 0x5035,
- kMkvContentEncAlgo = 0x47E1,
- kMkvContentEncKeyID = 0x47E2,
- kMkvContentEncAESSettings = 0x47E7,
- kMkvAESSettingsCipherMode = 0x47E8,
- kMkvAESSettingsCipherInitData = 0x47E9,
- //end ContentEncodings
- //Cueing Data
- kMkvCues = 0x1C53BB6B,
- kMkvCuePoint = 0xBB,
- kMkvCueTime = 0xB3,
- kMkvCueTrackPositions = 0xB7,
- kMkvCueTrack = 0xF7,
- kMkvCueClusterPosition = 0xF1,
- kMkvCueBlockNumber = 0x5378,
- //Chapters
- kMkvChapters = 0x1043A770,
- kMkvEditionEntry = 0x45B9,
- kMkvChapterAtom = 0xB6,
- kMkvChapterUID = 0x73C4,
- kMkvChapterStringUID = 0x5654,
- kMkvChapterTimeStart = 0x91,
- kMkvChapterTimeEnd = 0x92,
- kMkvChapterDisplay = 0x80,
- kMkvChapString = 0x85,
- kMkvChapLanguage = 0x437C,
- kMkvChapCountry = 0x437E
-};
-
-} // end namespace mkvmuxer
-
-#endif // WEBMIDS_HPP
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libyuv/README.webm b/videocodec/libvpx_internal/libvpx/third_party/libyuv/README.webm
deleted file mode 100644
index d3495ca..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libyuv/README.webm
+++ /dev/null
@@ -1,17 +0,0 @@
-Name: libyuv
-URL: http://code.google.com/p/libyuv/
-Version: 102
-License: BSD
-License File: LICENSE
-
-Description:
-libyuv is an open source project that includes YUV conversion and scaling
-functionality.
-
-The optimized scaler in libyuv is used in multiple resolution encoder example,
-which down-samples the original input video (f.g. 1280x720) a number of times
-in order to encode multiple resolution bit streams.
-
-Local Modifications:
-Modified the original scaler code from C++ to C to fit in our current build
-system. This is a temporal solution, and will be improved later. \ No newline at end of file
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/basic_types.h b/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/basic_types.h
deleted file mode 100644
index 30504ce..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/basic_types.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_
-#define INCLUDE_LIBYUV_BASIC_TYPES_H_
-
-#include <stddef.h> // for NULL, size_t
-
-#if !(defined(_MSC_VER) && (_MSC_VER < 1600))
-#include <stdint.h> // for uintptr_t
-#endif
-
-#ifndef INT_TYPES_DEFINED
-#define INT_TYPES_DEFINED
-#ifdef COMPILER_MSVC
-typedef unsigned __int64 uint64;
-typedef __int64 int64;
-#ifndef INT64_C
-#define INT64_C(x) x ## I64
-#endif
-#ifndef UINT64_C
-#define UINT64_C(x) x ## UI64
-#endif
-#define INT64_F "I64"
-#else // COMPILER_MSVC
-#ifdef __LP64__
-typedef unsigned long uint64;
-typedef long int64;
-#ifndef INT64_C
-#define INT64_C(x) x ## L
-#endif
-#ifndef UINT64_C
-#define UINT64_C(x) x ## UL
-#endif
-#define INT64_F "l"
-#else // __LP64__
-typedef unsigned long long uint64;
-typedef long long int64;
-#ifndef INT64_C
-#define INT64_C(x) x ## LL
-#endif
-#ifndef UINT64_C
-#define UINT64_C(x) x ## ULL
-#endif
-#define INT64_F "ll"
-#endif // __LP64__
-#endif // COMPILER_MSVC
-typedef unsigned int uint32;
-typedef int int32;
-typedef unsigned short uint16;
-typedef short int16;
-typedef unsigned char uint8;
-typedef char int8;
-#endif // INT_TYPES_DEFINED
-
-// Detect compiler is for x86 or x64.
-#if defined(__x86_64__) || defined(_M_X64) || \
- defined(__i386__) || defined(_M_IX86)
-#define CPU_X86 1
-#endif
-
-#define ALIGNP(p, t) \
- ((uint8*)((((uintptr_t)(p) + \
- ((t)-1)) & ~((t)-1))))
-
-#endif // INCLUDE_LIBYUV_BASIC_TYPES_H_
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/cpu_id.h b/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/cpu_id.h
deleted file mode 100644
index 4a53b5b..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/cpu_id.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef INCLUDE_LIBYUV_CPU_ID_H_
-#define INCLUDE_LIBYUV_CPU_ID_H_
-
-#ifdef __cplusplus
-namespace libyuv {
-extern "C" {
-#endif
-
-// These flags are only valid on x86 processors
-static const int kCpuHasSSE2 = 1;
-static const int kCpuHasSSSE3 = 2;
-
-// These flags are only valid on ARM processors
-static const int kCpuHasNEON = 4;
-
-// Internal flag to indicate cpuid is initialized.
-static const int kCpuInitialized = 8;
-
-// Detect CPU has SSE2 etc.
-// test_flag parameter should be one of kCpuHas constants above
-// returns non-zero if instruction set is detected
-static __inline int TestCpuFlag(int test_flag) {
- extern int cpu_info_;
- extern int InitCpuFlags();
- return (cpu_info_ ? cpu_info_ : InitCpuFlags()) & test_flag;
-}
-
-// For testing, allow CPU flags to be disabled.
-// ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3.
-// -1 to enable all cpu specific optimizations.
-// 0 to disable all cpu specific optimizations.
-void MaskCpuFlags(int enable_flags);
-
-#ifdef __cplusplus
-} // extern "C"
-} // namespace libyuv
-#endif
-
-#endif // INCLUDE_LIBYUV_CPU_ID_H_
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/scale.h b/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/scale.h
deleted file mode 100644
index 21fe360..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libyuv/include/libyuv/scale.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef INCLUDE_LIBYUV_SCALE_H_
-#define INCLUDE_LIBYUV_SCALE_H_
-
-#include "third_party/libyuv/include/libyuv/basic_types.h"
-
-#ifdef __cplusplus
-namespace libyuv {
-extern "C" {
-#endif
-
-// Supported filtering
-typedef enum {
- kFilterNone = 0, // Point sample; Fastest
- kFilterBilinear = 1, // Faster than box, but lower quality scaling down.
- kFilterBox = 2 // Highest quality
-}FilterMode;
-
-// Scales a YUV 4:2:0 image from the src width and height to the
-// dst width and height.
-// If filtering is kFilterNone, a simple nearest-neighbor algorithm is
-// used. This produces basic (blocky) quality at the fastest speed.
-// If filtering is kFilterBilinear, interpolation is used to produce a better
-// quality image, at the expense of speed.
-// If filtering is kFilterBox, averaging is used to produce ever better
-// quality image, at further expense of speed.
-// Returns 0 if successful.
-
-int I420Scale(const uint8* src_y, int src_stride_y,
- const uint8* src_u, int src_stride_u,
- const uint8* src_v, int src_stride_v,
- int src_width, int src_height,
- uint8* dst_y, int dst_stride_y,
- uint8* dst_u, int dst_stride_u,
- uint8* dst_v, int dst_stride_v,
- int dst_width, int dst_height,
- FilterMode filtering);
-
-// Legacy API. Deprecated
-int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
- int src_stride_y, int src_stride_u, int src_stride_v,
- int src_width, int src_height,
- uint8* dst_y, uint8* dst_u, uint8* dst_v,
- int dst_stride_y, int dst_stride_u, int dst_stride_v,
- int dst_width, int dst_height,
- int interpolate);
-
-// Legacy API. Deprecated
-int ScaleOffset(const uint8* src, int src_width, int src_height,
- uint8* dst, int dst_width, int dst_height, int dst_yoffset,
- int interpolate);
-
-// For testing, allow disabling of optimizations.
-void SetUseReferenceImpl(int use);
-
-#ifdef __cplusplus
-} // extern "C"
-} // namespace libyuv
-#endif
-
-#endif // INCLUDE_LIBYUV_SCALE_H_
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/cpu_id.c b/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/cpu_id.c
deleted file mode 100644
index fccf3dd..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/cpu_id.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "third_party/libyuv/include/libyuv/cpu_id.h"
-
-#ifdef _MSC_VER
-#include <intrin.h>
-#endif
-#ifdef __ANDROID__
-#include <cpu-features.h>
-#endif
-
-#include "third_party/libyuv/include/libyuv/basic_types.h" // for CPU_X86
-
-// TODO(fbarchard): Use cpuid.h when gcc 4.4 is used on OSX and Linux.
-#if (defined(__pic__) || defined(__APPLE__)) && defined(__i386__)
-static inline void __cpuid(int cpu_info[4], int info_type) {
- asm volatile (
- "mov %%ebx, %%edi \n"
- "cpuid \n"
- "xchg %%edi, %%ebx \n"
- : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
- : "a"(info_type)
- );
-}
-#elif defined(__i386__) || defined(__x86_64__)
-static inline void __cpuid(int cpu_info[4], int info_type) {
- asm volatile (
- "cpuid \n"
- : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
- : "a"(info_type)
- );
-}
-#endif
-
-#ifdef __cplusplus
-namespace libyuv {
-extern "C" {
-#endif
-
-// CPU detect function for SIMD instruction sets.
-int cpu_info_ = 0;
-
-int InitCpuFlags() {
-#ifdef CPU_X86
- int cpu_info[4];
- __cpuid(cpu_info, 1);
- cpu_info_ = (cpu_info[3] & 0x04000000 ? kCpuHasSSE2 : 0) |
- (cpu_info[2] & 0x00000200 ? kCpuHasSSSE3 : 0) |
- kCpuInitialized;
-#elif defined(__ANDROID__) && defined(__ARM_NEON__)
- uint64_t features = android_getCpuFeatures();
- cpu_info_ = ((features & ANDROID_CPU_ARM_FEATURE_NEON) ? kCpuHasNEON : 0) |
- kCpuInitialized;
-#elif defined(__ARM_NEON__)
- // gcc -mfpu=neon defines __ARM_NEON__
- // Enable Neon if you want support for Neon and Arm, and use MaskCpuFlags
- // to disable Neon on devices that do not have it.
- cpu_info_ = kCpuHasNEON | kCpuInitialized;
-#else
- cpu_info_ = kCpuInitialized;
-#endif
- return cpu_info_;
-}
-
-void MaskCpuFlags(int enable_flags) {
- InitCpuFlags();
- cpu_info_ = (cpu_info_ & enable_flags) | kCpuInitialized;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-} // namespace libyuv
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/row.h b/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/row.h
deleted file mode 100644
index eabe180..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/row.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef LIBYUV_SOURCE_ROW_H_
-#define LIBYUV_SOURCE_ROW_H_
-
-#include "third_party/libyuv/include/libyuv/basic_types.h"
-
-#define kMaxStride (2048 * 4)
-#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
-
-#if defined(COVERAGE_ENABLED) || defined(TARGET_IPHONE_SIMULATOR)
-#define YUV_DISABLE_ASM
-#endif
-
-#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
-#define HAS_FASTCONVERTYUVTOARGBROW_NEON
-void FastConvertYUVToARGBRow_NEON(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-#define HAS_FASTCONVERTYUVTOBGRAROW_NEON
-void FastConvertYUVToBGRARow_NEON(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-#define HAS_FASTCONVERTYUVTOABGRROW_NEON
-void FastConvertYUVToABGRRow_NEON(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-#endif
-
-// The following are available on all x86 platforms
-#if (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) && \
- !defined(YUV_DISABLE_ASM)
-#define HAS_ABGRTOARGBROW_SSSE3
-#define HAS_BGRATOARGBROW_SSSE3
-#define HAS_BG24TOARGBROW_SSSE3
-#define HAS_RAWTOARGBROW_SSSE3
-#define HAS_RGB24TOYROW_SSSE3
-#define HAS_RAWTOYROW_SSSE3
-#define HAS_RGB24TOUVROW_SSSE3
-#define HAS_RAWTOUVROW_SSSE3
-#define HAS_ARGBTOYROW_SSSE3
-#define HAS_BGRATOYROW_SSSE3
-#define HAS_ABGRTOYROW_SSSE3
-#define HAS_ARGBTOUVROW_SSSE3
-#define HAS_BGRATOUVROW_SSSE3
-#define HAS_ABGRTOUVROW_SSSE3
-#define HAS_I400TOARGBROW_SSE2
-#define HAS_FASTCONVERTYTOARGBROW_SSE2
-#define HAS_FASTCONVERTYUVTOARGBROW_SSSE3
-#define HAS_FASTCONVERTYUVTOBGRAROW_SSSE3
-#define HAS_FASTCONVERTYUVTOABGRROW_SSSE3
-#define HAS_FASTCONVERTYUV444TOARGBROW_SSSE3
-#define HAS_REVERSE_ROW_SSSE3
-#endif
-
-// The following are available on Neon platforms
-#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
-#define HAS_REVERSE_ROW_NEON
-#endif
-
-#ifdef __cplusplus
-namespace libyuv {
-extern "C" {
-#endif
-
-#ifdef HAS_ARGBTOYROW_SSSE3
-void ARGBToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
-void BGRAToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
-void ABGRToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
-void ARGBToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-void BGRAToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-void ABGRToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-#endif
-#if defined(HAS_BG24TOARGBROW_SSSE3) && defined(HAS_ARGBTOYROW_SSSE3)
-#define HASRGB24TOYROW_SSSE3
-#endif
-#ifdef HASRGB24TOYROW_SSSE3
-void RGB24ToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
-void RAWToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix);
-void RGB24ToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-void RAWToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-#endif
-#ifdef HAS_REVERSE_ROW_SSSE3
-void ReverseRow_SSSE3(const uint8* src, uint8* dst, int width);
-#endif
-#ifdef HAS_REVERSE_ROW_NEON
-void ReverseRow_NEON(const uint8* src, uint8* dst, int width);
-#endif
-void ReverseRow_C(const uint8* src, uint8* dst, int width);
-
-void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
-void BGRAToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
-void ABGRToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
-void RGB24ToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
-void RAWToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
-void ARGBToUVRow_C(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-void BGRAToUVRow_C(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-void ABGRToUVRow_C(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-void RGB24ToUVRow_C(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-void RAWToUVRow_C(const uint8* src_argb0, int src_stride_argb,
- uint8* dst_u, uint8* dst_v, int width);
-
-#ifdef HAS_BG24TOARGBROW_SSSE3
-void ABGRToARGBRow_SSSE3(const uint8* src_abgr, uint8* dst_argb, int pix);
-void BGRAToARGBRow_SSSE3(const uint8* src_bgra, uint8* dst_argb, int pix);
-void BG24ToARGBRow_SSSE3(const uint8* src_bg24, uint8* dst_argb, int pix);
-void RAWToARGBRow_SSSE3(const uint8* src_bg24, uint8* dst_argb, int pix);
-#endif
-void ABGRToARGBRow_C(const uint8* src_abgr, uint8* dst_argb, int pix);
-void BGRAToARGBRow_C(const uint8* src_bgra, uint8* dst_argb, int pix);
-void BG24ToARGBRow_C(const uint8* src_bg24, uint8* dst_argb, int pix);
-void RAWToARGBRow_C(const uint8* src_bg24, uint8* dst_argb, int pix);
-
-#ifdef HAS_I400TOARGBROW_SSE2
-void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int pix);
-#endif
-void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int pix);
-
-#if defined(_MSC_VER)
-#define SIMD_ALIGNED(var) __declspec(align(16)) var
-typedef __declspec(align(16)) signed char vec8[16];
-typedef __declspec(align(16)) unsigned char uvec8[16];
-typedef __declspec(align(16)) signed short vec16[8];
-#else // __GNUC__
-#define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
-typedef signed char __attribute__((vector_size(16))) vec8;
-typedef unsigned char __attribute__((vector_size(16))) uvec8;
-typedef signed short __attribute__((vector_size(16))) vec16;
-#endif
-
-//extern "C"
-SIMD_ALIGNED(const int16 kCoefficientsRgbY[768][4]);
-//extern "C"
-SIMD_ALIGNED(const int16 kCoefficientsBgraY[768][4]);
-//extern "C"
-SIMD_ALIGNED(const int16 kCoefficientsAbgrY[768][4]);
-
-void FastConvertYUVToARGBRow_C(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUVToBGRARow_C(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUVToABGRRow_C(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUV444ToARGBRow_C(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYToARGBRow_C(const uint8* y_buf,
- uint8* rgb_buf,
- int width);
-
-#ifdef HAS_FASTCONVERTYUVTOARGBROW_SSE2
-void FastConvertYUVToARGBRow_SSE2(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUVToARGBRow4_SSE2(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUVToBGRARow_SSE2(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUVToABGRRow_SSE2(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUV444ToARGBRow_SSE2(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYToARGBRow_SSE2(const uint8* y_buf,
- uint8* rgb_buf,
- int width);
-#endif
-
-#ifdef HAS_FASTCONVERTYUVTOARGBROW_SSSE3
-void FastConvertYUVToARGBRow_SSSE3(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUVToBGRARow_SSSE3(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUVToABGRRow_SSSE3(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-void FastConvertYUV444ToARGBRow_SSSE3(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- int width);
-
-#endif
-
-#ifdef HAS_FASTCONVERTYTOARGBROW_SSE2
-void FastConvertYToARGBRow_SSE2(const uint8* y_buf,
- uint8* rgb_buf,
- int width);
-
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-} // namespace libyuv
-#endif
-
-#endif // LIBYUV_SOURCE_ROW_H_
diff --git a/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/scale.c b/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/scale.c
deleted file mode 100644
index 3c30b55..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/libyuv/source/scale.c
+++ /dev/null
@@ -1,3884 +0,0 @@
-/*
- * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "third_party/libyuv/include/libyuv/scale.h"
-
-#include <assert.h>
-#include <string.h>
-
-#include "third_party/libyuv/include/libyuv/cpu_id.h"
-#include "third_party/libyuv/source/row.h"
-
-#ifdef __cplusplus
-namespace libyuv {
-extern "C" {
-#endif
-
-/*
- * Note: Defining YUV_DISABLE_ASM allows to use c version.
- */
-//#define YUV_DISABLE_ASM
-
-#if defined(_MSC_VER)
-#define ALIGN16(var) __declspec(align(16)) var
-#else
-#define ALIGN16(var) var __attribute__((aligned(16)))
-#endif
-
-// Note: A Neon reference manual
-// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/CJAJIIGG.html
-// Note: Some SSE2 reference manuals
-// cpuvol1.pdf agner_instruction_tables.pdf 253666.pdf 253667.pdf
-
-// Set the following flag to true to revert to only
-// using the reference implementation ScalePlaneBox(), and
-// NOT the optimized versions. Useful for debugging and
-// when comparing the quality of the resulting YUV planes
-// as produced by the optimized and non-optimized versions.
-
-static int use_reference_impl_ = 0;
-
-void SetUseReferenceImpl(int use) {
- use_reference_impl_ = use;
-}
-
-// ScaleRowDown2Int also used by planar functions
-
-/**
- * NEON downscalers with interpolation.
- *
- * Provided by Fritz Koenig
- *
- */
-
-#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
-#define HAS_SCALEROWDOWN2_NEON
-void ScaleRowDown2_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- asm volatile (
- "1: \n"
- "vld2.u8 {q0,q1}, [%0]! \n" // load even pixels into q0, odd into q1
- "vst1.u8 {q0}, [%1]! \n" // store even pixels
- "subs %2, %2, #16 \n" // 16 processed per loop
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst), // %1
- "+r"(dst_width) // %2
- :
- : "q0", "q1" // Clobber List
- );
-}
-
-void ScaleRowDown2Int_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- asm volatile (
- "add %1, %0 \n" // change the stride to row 2 pointer
- "1: \n"
- "vld1.u8 {q0,q1}, [%0]! \n" // load row 1 and post increment
- "vld1.u8 {q2,q3}, [%1]! \n" // load row 2 and post increment
- "vpaddl.u8 q0, q0 \n" // row 1 add adjacent
- "vpaddl.u8 q1, q1 \n"
- "vpadal.u8 q0, q2 \n" // row 2 add adjacent, add row 1 to row 2
- "vpadal.u8 q1, q3 \n"
- "vrshrn.u16 d0, q0, #2 \n" // downshift, round and pack
- "vrshrn.u16 d1, q1, #2 \n"
- "vst1.u8 {q0}, [%2]! \n"
- "subs %3, %3, #16 \n" // 16 processed per loop
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(src_stride), // %1
- "+r"(dst), // %2
- "+r"(dst_width) // %3
- :
- : "q0", "q1", "q2", "q3" // Clobber List
- );
-}
-
-#define HAS_SCALEROWDOWN4_NEON
-static void ScaleRowDown4_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "1: \n"
- "vld2.u8 {d0, d1}, [%0]! \n"
- "vtrn.u8 d1, d0 \n"
- "vshrn.u16 d0, q0, #8 \n"
- "vst1.u32 {d0[1]}, [%1]! \n"
-
- "subs %2, #4 \n"
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- :
- : "q0", "q1", "memory", "cc"
- );
-}
-
-static void ScaleRowDown4Int_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "add r4, %0, %3 \n"
- "add r5, r4, %3 \n"
- "add %3, r5, %3 \n"
- "1: \n"
- "vld1.u8 {q0}, [%0]! \n" // load up 16x4 block of input data
- "vld1.u8 {q1}, [r4]! \n"
- "vld1.u8 {q2}, [r5]! \n"
- "vld1.u8 {q3}, [%3]! \n"
-
- "vpaddl.u8 q0, q0 \n"
- "vpadal.u8 q0, q1 \n"
- "vpadal.u8 q0, q2 \n"
- "vpadal.u8 q0, q3 \n"
-
- "vpaddl.u16 q0, q0 \n"
-
- "vrshrn.u32 d0, q0, #4 \n" // divide by 16 w/rounding
-
- "vmovn.u16 d0, q0 \n"
- "vst1.u32 {d0[0]}, [%1]! \n"
-
- "subs %2, #4 \n"
- "bhi 1b \n"
-
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"(src_stride) // %3
- : "r4", "r5", "q0", "q1", "q2", "q3", "memory", "cc"
- );
-}
-
-#define HAS_SCALEROWDOWN34_NEON
-// Down scale from 4 to 3 pixels. Use the neon multilane read/write
-// to load up the every 4th pixel into a 4 different registers.
-// Point samples 32 pixels to 24 pixels.
-static void ScaleRowDown34_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "1: \n"
- "vld4.u8 {d0, d1, d2, d3}, [%0]! \n" // src line 0
- "vmov d2, d3 \n" // order needs to be d0, d1, d2
- "vst3.u8 {d0, d1, d2}, [%1]! \n"
- "subs %2, #24 \n"
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- :
- : "d0", "d1", "d2", "d3", "memory", "cc"
- );
-}
-
-static void ScaleRowDown34_0_Int_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "vmov.u8 d24, #3 \n"
- "add %3, %0 \n"
- "1: \n"
- "vld4.u8 {d0, d1, d2, d3}, [%0]! \n" // src line 0
- "vld4.u8 {d4, d5, d6, d7}, [%3]! \n" // src line 1
-
- // filter src line 0 with src line 1
- // expand chars to shorts to allow for room
- // when adding lines together
- "vmovl.u8 q8, d4 \n"
- "vmovl.u8 q9, d5 \n"
- "vmovl.u8 q10, d6 \n"
- "vmovl.u8 q11, d7 \n"
-
- // 3 * line_0 + line_1
- "vmlal.u8 q8, d0, d24 \n"
- "vmlal.u8 q9, d1, d24 \n"
- "vmlal.u8 q10, d2, d24 \n"
- "vmlal.u8 q11, d3, d24 \n"
-
- // (3 * line_0 + line_1) >> 2
- "vqrshrn.u16 d0, q8, #2 \n"
- "vqrshrn.u16 d1, q9, #2 \n"
- "vqrshrn.u16 d2, q10, #2 \n"
- "vqrshrn.u16 d3, q11, #2 \n"
-
- // a0 = (src[0] * 3 + s[1] * 1) >> 2
- "vmovl.u8 q8, d1 \n"
- "vmlal.u8 q8, d0, d24 \n"
- "vqrshrn.u16 d0, q8, #2 \n"
-
- // a1 = (src[1] * 1 + s[2] * 1) >> 1
- "vrhadd.u8 d1, d1, d2 \n"
-
- // a2 = (src[2] * 1 + s[3] * 3) >> 2
- "vmovl.u8 q8, d2 \n"
- "vmlal.u8 q8, d3, d24 \n"
- "vqrshrn.u16 d2, q8, #2 \n"
-
- "vst3.u8 {d0, d1, d2}, [%1]! \n"
-
- "subs %2, #24 \n"
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width), // %2
- "+r"(src_stride) // %3
- :
- : "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11", "d24", "memory", "cc"
- );
-}
-
-static void ScaleRowDown34_1_Int_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "vmov.u8 d24, #3 \n"
- "add %3, %0 \n"
- "1: \n"
- "vld4.u8 {d0, d1, d2, d3}, [%0]! \n" // src line 0
- "vld4.u8 {d4, d5, d6, d7}, [%3]! \n" // src line 1
-
- // average src line 0 with src line 1
- "vrhadd.u8 q0, q0, q2 \n"
- "vrhadd.u8 q1, q1, q3 \n"
-
- // a0 = (src[0] * 3 + s[1] * 1) >> 2
- "vmovl.u8 q3, d1 \n"
- "vmlal.u8 q3, d0, d24 \n"
- "vqrshrn.u16 d0, q3, #2 \n"
-
- // a1 = (src[1] * 1 + s[2] * 1) >> 1
- "vrhadd.u8 d1, d1, d2 \n"
-
- // a2 = (src[2] * 1 + s[3] * 3) >> 2
- "vmovl.u8 q3, d2 \n"
- "vmlal.u8 q3, d3, d24 \n"
- "vqrshrn.u16 d2, q3, #2 \n"
-
- "vst3.u8 {d0, d1, d2}, [%1]! \n"
-
- "subs %2, #24 \n"
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width), // %2
- "+r"(src_stride) // %3
- :
- : "r4", "q0", "q1", "q2", "q3", "d24", "memory", "cc"
- );
-}
-
-#define HAS_SCALEROWDOWN38_NEON
-const uint8 shuf38[16] __attribute__ ((aligned(16))) =
- { 0, 3, 6, 8, 11, 14, 16, 19, 22, 24, 27, 30, 0, 0, 0, 0 };
-const uint8 shuf38_2[16] __attribute__ ((aligned(16))) =
- { 0, 8, 16, 2, 10, 17, 4, 12, 18, 6, 14, 19, 0, 0, 0, 0 };
-const unsigned short mult38_div6[8] __attribute__ ((aligned(16))) =
- { 65536 / 12, 65536 / 12, 65536 / 12, 65536 / 12,
- 65536 / 12, 65536 / 12, 65536 / 12, 65536 / 12 };
-const unsigned short mult38_div9[8] __attribute__ ((aligned(16))) =
- { 65536 / 18, 65536 / 18, 65536 / 18, 65536 / 18,
- 65536 / 18, 65536 / 18, 65536 / 18, 65536 / 18 };
-
-// 32 -> 12
-static void ScaleRowDown38_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "vld1.u8 {q3}, [%3] \n"
- "1: \n"
- "vld1.u8 {d0, d1, d2, d3}, [%0]! \n"
- "vtbl.u8 d4, {d0, d1, d2, d3}, d6 \n"
- "vtbl.u8 d5, {d0, d1, d2, d3}, d7 \n"
- "vst1.u8 {d4}, [%1]! \n"
- "vst1.u32 {d5[0]}, [%1]! \n"
- "subs %2, #12 \n"
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"(shuf38) // %3
- : "d0", "d1", "d2", "d3", "d4", "d5", "memory", "cc"
- );
-}
-
-// 32x3 -> 12x1
-static void ScaleRowDown38_3_Int_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "vld1.u16 {q13}, [%4] \n"
- "vld1.u8 {q14}, [%5] \n"
- "vld1.u8 {q15}, [%6] \n"
- "add r4, %0, %3, lsl #1 \n"
- "add %3, %0 \n"
- "1: \n"
-
- // d0 = 00 40 01 41 02 42 03 43
- // d1 = 10 50 11 51 12 52 13 53
- // d2 = 20 60 21 61 22 62 23 63
- // d3 = 30 70 31 71 32 72 33 73
- "vld4.u8 {d0, d1, d2, d3}, [%0]! \n"
- "vld4.u8 {d4, d5, d6, d7}, [%3]! \n"
- "vld4.u8 {d16, d17, d18, d19}, [r4]! \n"
-
- // Shuffle the input data around to get align the data
- // so adjacent data can be added. 0,1 - 2,3 - 4,5 - 6,7
- // d0 = 00 10 01 11 02 12 03 13
- // d1 = 40 50 41 51 42 52 43 53
- "vtrn.u8 d0, d1 \n"
- "vtrn.u8 d4, d5 \n"
- "vtrn.u8 d16, d17 \n"
-
- // d2 = 20 30 21 31 22 32 23 33
- // d3 = 60 70 61 71 62 72 63 73
- "vtrn.u8 d2, d3 \n"
- "vtrn.u8 d6, d7 \n"
- "vtrn.u8 d18, d19 \n"
-
- // d0 = 00+10 01+11 02+12 03+13
- // d2 = 40+50 41+51 42+52 43+53
- "vpaddl.u8 q0, q0 \n"
- "vpaddl.u8 q2, q2 \n"
- "vpaddl.u8 q8, q8 \n"
-
- // d3 = 60+70 61+71 62+72 63+73
- "vpaddl.u8 d3, d3 \n"
- "vpaddl.u8 d7, d7 \n"
- "vpaddl.u8 d19, d19 \n"
-
- // combine source lines
- "vadd.u16 q0, q2 \n"
- "vadd.u16 q0, q8 \n"
- "vadd.u16 d4, d3, d7 \n"
- "vadd.u16 d4, d19 \n"
-
- // dst_ptr[3] = (s[6 + st * 0] + s[7 + st * 0]
- // + s[6 + st * 1] + s[7 + st * 1]
- // + s[6 + st * 2] + s[7 + st * 2]) / 6
- "vqrdmulh.s16 q2, q13 \n"
- "vmovn.u16 d4, q2 \n"
-
- // Shuffle 2,3 reg around so that 2 can be added to the
- // 0,1 reg and 3 can be added to the 4,5 reg. This
- // requires expanding from u8 to u16 as the 0,1 and 4,5
- // registers are already expanded. Then do transposes
- // to get aligned.
- // q2 = xx 20 xx 30 xx 21 xx 31 xx 22 xx 32 xx 23 xx 33
- "vmovl.u8 q1, d2 \n"
- "vmovl.u8 q3, d6 \n"
- "vmovl.u8 q9, d18 \n"
-
- // combine source lines
- "vadd.u16 q1, q3 \n"
- "vadd.u16 q1, q9 \n"
-
- // d4 = xx 20 xx 30 xx 22 xx 32
- // d5 = xx 21 xx 31 xx 23 xx 33
- "vtrn.u32 d2, d3 \n"
-
- // d4 = xx 20 xx 21 xx 22 xx 23
- // d5 = xx 30 xx 31 xx 32 xx 33
- "vtrn.u16 d2, d3 \n"
-
- // 0+1+2, 3+4+5
- "vadd.u16 q0, q1 \n"
-
- // Need to divide, but can't downshift as the the value
- // isn't a power of 2. So multiply by 65536 / n
- // and take the upper 16 bits.
- "vqrdmulh.s16 q0, q15 \n"
-
- // Align for table lookup, vtbl requires registers to
- // be adjacent
- "vmov.u8 d2, d4 \n"
-
- "vtbl.u8 d3, {d0, d1, d2}, d28 \n"
- "vtbl.u8 d4, {d0, d1, d2}, d29 \n"
-
- "vst1.u8 {d3}, [%1]! \n"
- "vst1.u32 {d4[0]}, [%1]! \n"
- "subs %2, #12 \n"
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width), // %2
- "+r"(src_stride) // %3
- : "r"(mult38_div6), // %4
- "r"(shuf38_2), // %5
- "r"(mult38_div9) // %6
- : "r4", "q0", "q1", "q2", "q3", "q8", "q9",
- "q13", "q14", "q15", "memory", "cc"
- );
-}
-
-// 32x2 -> 12x1
-static void ScaleRowDown38_2_Int_NEON(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "vld1.u16 {q13}, [%4] \n"
- "vld1.u8 {q14}, [%5] \n"
- "add %3, %0 \n"
- "1: \n"
-
- // d0 = 00 40 01 41 02 42 03 43
- // d1 = 10 50 11 51 12 52 13 53
- // d2 = 20 60 21 61 22 62 23 63
- // d3 = 30 70 31 71 32 72 33 73
- "vld4.u8 {d0, d1, d2, d3}, [%0]! \n"
- "vld4.u8 {d4, d5, d6, d7}, [%3]! \n"
-
- // Shuffle the input data around to get align the data
- // so adjacent data can be added. 0,1 - 2,3 - 4,5 - 6,7
- // d0 = 00 10 01 11 02 12 03 13
- // d1 = 40 50 41 51 42 52 43 53
- "vtrn.u8 d0, d1 \n"
- "vtrn.u8 d4, d5 \n"
-
- // d2 = 20 30 21 31 22 32 23 33
- // d3 = 60 70 61 71 62 72 63 73
- "vtrn.u8 d2, d3 \n"
- "vtrn.u8 d6, d7 \n"
-
- // d0 = 00+10 01+11 02+12 03+13
- // d2 = 40+50 41+51 42+52 43+53
- "vpaddl.u8 q0, q0 \n"
- "vpaddl.u8 q2, q2 \n"
-
- // d3 = 60+70 61+71 62+72 63+73
- "vpaddl.u8 d3, d3 \n"
- "vpaddl.u8 d7, d7 \n"
-
- // combine source lines
- "vadd.u16 q0, q2 \n"
- "vadd.u16 d4, d3, d7 \n"
-
- // dst_ptr[3] = (s[6] + s[7] + s[6+st] + s[7+st]) / 4
- "vqrshrn.u16 d4, q2, #2 \n"
-
- // Shuffle 2,3 reg around so that 2 can be added to the
- // 0,1 reg and 3 can be added to the 4,5 reg. This
- // requires expanding from u8 to u16 as the 0,1 and 4,5
- // registers are already expanded. Then do transposes
- // to get aligned.
- // q2 = xx 20 xx 30 xx 21 xx 31 xx 22 xx 32 xx 23 xx 33
- "vmovl.u8 q1, d2 \n"
- "vmovl.u8 q3, d6 \n"
-
- // combine source lines
- "vadd.u16 q1, q3 \n"
-
- // d4 = xx 20 xx 30 xx 22 xx 32
- // d5 = xx 21 xx 31 xx 23 xx 33
- "vtrn.u32 d2, d3 \n"
-
- // d4 = xx 20 xx 21 xx 22 xx 23
- // d5 = xx 30 xx 31 xx 32 xx 33
- "vtrn.u16 d2, d3 \n"
-
- // 0+1+2, 3+4+5
- "vadd.u16 q0, q1 \n"
-
- // Need to divide, but can't downshift as the the value
- // isn't a power of 2. So multiply by 65536 / n
- // and take the upper 16 bits.
- "vqrdmulh.s16 q0, q13 \n"
-
- // Align for table lookup, vtbl requires registers to
- // be adjacent
- "vmov.u8 d2, d4 \n"
-
- "vtbl.u8 d3, {d0, d1, d2}, d28 \n"
- "vtbl.u8 d4, {d0, d1, d2}, d29 \n"
-
- "vst1.u8 {d3}, [%1]! \n"
- "vst1.u32 {d4[0]}, [%1]! \n"
- "subs %2, #12 \n"
- "bhi 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width), // %2
- "+r"(src_stride) // %3
- : "r"(mult38_div6), // %4
- "r"(shuf38_2) // %5
- : "q0", "q1", "q2", "q3", "q13", "q14", "memory", "cc"
- );
-}
-
-/**
- * SSE2 downscalers with interpolation.
- *
- * Provided by Frank Barchard (fbarchard@google.com)
- *
- */
-
-// Constants for SSE2 code
-#elif (defined(_M_IX86) || defined(__i386__) || defined(__x86_64__)) && \
- !defined(YUV_DISABLE_ASM)
-#if defined(_MSC_VER)
-#define TALIGN16(t, var) __declspec(align(16)) t _ ## var
-#elif (defined(__APPLE__) || defined(__MINGW32__) || defined(__CYGWIN__)) && defined(__i386__)
-#define TALIGN16(t, var) t var __attribute__((aligned(16)))
-#else
-#define TALIGN16(t, var) t _ ## var __attribute__((aligned(16)))
-#endif
-
-#if (defined(__APPLE__) || defined(__MINGW32__) || defined(__CYGWIN__)) && \
- defined(__i386__)
-#define DECLARE_FUNCTION(name) \
- ".text \n" \
- ".globl _" #name " \n" \
-"_" #name ": \n"
-#else
-#define DECLARE_FUNCTION(name) \
- ".text \n" \
- ".global " #name " \n" \
-#name ": \n"
-#endif
-
-
-// Offsets for source bytes 0 to 9
-//extern "C"
-TALIGN16(const uint8, shuf0[16]) =
- { 0, 1, 3, 4, 5, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 128 };
-
-// Offsets for source bytes 11 to 20 with 8 subtracted = 3 to 12.
-//extern "C"
-TALIGN16(const uint8, shuf1[16]) =
- { 3, 4, 5, 7, 8, 9, 11, 12, 128, 128, 128, 128, 128, 128, 128, 128 };
-
-// Offsets for source bytes 21 to 31 with 16 subtracted = 5 to 31.
-//extern "C"
-TALIGN16(const uint8, shuf2[16]) =
- { 5, 7, 8, 9, 11, 12, 13, 15, 128, 128, 128, 128, 128, 128, 128, 128 };
-
-// Offsets for source bytes 0 to 10
-//extern "C"
-TALIGN16(const uint8, shuf01[16]) =
- { 0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10 };
-
-// Offsets for source bytes 10 to 21 with 8 subtracted = 3 to 13.
-//extern "C"
-TALIGN16(const uint8, shuf11[16]) =
- { 2, 3, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 12, 13 };
-
-// Offsets for source bytes 21 to 31 with 16 subtracted = 5 to 31.
-//extern "C"
-TALIGN16(const uint8, shuf21[16]) =
- { 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 12, 13, 13, 14, 14, 15 };
-
-// Coefficients for source bytes 0 to 10
-//extern "C"
-TALIGN16(const uint8, madd01[16]) =
- { 3, 1, 2, 2, 1, 3, 3, 1, 2, 2, 1, 3, 3, 1, 2, 2 };
-
-// Coefficients for source bytes 10 to 21
-//extern "C"
-TALIGN16(const uint8, madd11[16]) =
- { 1, 3, 3, 1, 2, 2, 1, 3, 3, 1, 2, 2, 1, 3, 3, 1 };
-
-// Coefficients for source bytes 21 to 31
-//extern "C"
-TALIGN16(const uint8, madd21[16]) =
- { 2, 2, 1, 3, 3, 1, 2, 2, 1, 3, 3, 1, 2, 2, 1, 3 };
-
-// Coefficients for source bytes 21 to 31
-//extern "C"
-TALIGN16(const int16, round34[8]) =
- { 2, 2, 2, 2, 2, 2, 2, 2 };
-
-//extern "C"
-TALIGN16(const uint8, shuf38a[16]) =
- { 0, 3, 6, 8, 11, 14, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 };
-
-//extern "C"
-TALIGN16(const uint8, shuf38b[16]) =
- { 128, 128, 128, 128, 128, 128, 0, 3, 6, 8, 11, 14, 128, 128, 128, 128 };
-
-// Arrange words 0,3,6 into 0,1,2
-//extern "C"
-TALIGN16(const uint8, shufac0[16]) =
- { 0, 1, 6, 7, 12, 13, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 };
-
-// Arrange words 0,3,6 into 3,4,5
-//extern "C"
-TALIGN16(const uint8, shufac3[16]) =
- { 128, 128, 128, 128, 128, 128, 0, 1, 6, 7, 12, 13, 128, 128, 128, 128 };
-
-// Scaling values for boxes of 3x3 and 2x3
-//extern "C"
-TALIGN16(const uint16, scaleac3[8]) =
- { 65536 / 9, 65536 / 9, 65536 / 6, 65536 / 9, 65536 / 9, 65536 / 6, 0, 0 };
-
-// Arrange first value for pixels 0,1,2,3,4,5
-//extern "C"
-TALIGN16(const uint8, shufab0[16]) =
- { 0, 128, 3, 128, 6, 128, 8, 128, 11, 128, 14, 128, 128, 128, 128, 128 };
-
-// Arrange second value for pixels 0,1,2,3,4,5
-//extern "C"
-TALIGN16(const uint8, shufab1[16]) =
- { 1, 128, 4, 128, 7, 128, 9, 128, 12, 128, 15, 128, 128, 128, 128, 128 };
-
-// Arrange third value for pixels 0,1,2,3,4,5
-//extern "C"
-TALIGN16(const uint8, shufab2[16]) =
- { 2, 128, 5, 128, 128, 128, 10, 128, 13, 128, 128, 128, 128, 128, 128, 128 };
-
-// Scaling values for boxes of 3x2 and 2x2
-//extern "C"
-TALIGN16(const uint16, scaleab2[8]) =
- { 65536 / 3, 65536 / 3, 65536 / 2, 65536 / 3, 65536 / 3, 65536 / 2, 0, 0 };
-#endif
-
-#if defined(_M_IX86) && !defined(YUV_DISABLE_ASM) && defined(_MSC_VER)
-
-#define HAS_SCALEROWDOWN2_SSE2
-// Reads 32 pixels, throws half away and writes 16 pixels.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned.
-__declspec(naked)
-static void ScaleRowDown2_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- mov eax, [esp + 4] // src_ptr
- // src_stride ignored
- mov edx, [esp + 12] // dst_ptr
- mov ecx, [esp + 16] // dst_width
- pcmpeqb xmm5, xmm5 // generate mask 0x00ff00ff
- psrlw xmm5, 8
-
- wloop:
- movdqa xmm0, [eax]
- movdqa xmm1, [eax + 16]
- lea eax, [eax + 32]
- pand xmm0, xmm5
- pand xmm1, xmm5
- packuswb xmm0, xmm1
- movdqa [edx], xmm0
- lea edx, [edx + 16]
- sub ecx, 16
- ja wloop
-
- ret
- }
-}
-// Blends 32x2 rectangle to 16x1.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned.
-__declspec(naked)
-void ScaleRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- push esi
- mov eax, [esp + 4 + 4] // src_ptr
- mov esi, [esp + 4 + 8] // src_stride
- mov edx, [esp + 4 + 12] // dst_ptr
- mov ecx, [esp + 4 + 16] // dst_width
- pcmpeqb xmm5, xmm5 // generate mask 0x00ff00ff
- psrlw xmm5, 8
-
- wloop:
- movdqa xmm0, [eax]
- movdqa xmm1, [eax + 16]
- movdqa xmm2, [eax + esi]
- movdqa xmm3, [eax + esi + 16]
- lea eax, [eax + 32]
- pavgb xmm0, xmm2 // average rows
- pavgb xmm1, xmm3
-
- movdqa xmm2, xmm0 // average columns (32 to 16 pixels)
- psrlw xmm0, 8
- movdqa xmm3, xmm1
- psrlw xmm1, 8
- pand xmm2, xmm5
- pand xmm3, xmm5
- pavgw xmm0, xmm2
- pavgw xmm1, xmm3
- packuswb xmm0, xmm1
-
- movdqa [edx], xmm0
- lea edx, [edx + 16]
- sub ecx, 16
- ja wloop
-
- pop esi
- ret
- }
-}
-
-#define HAS_SCALEROWDOWN4_SSE2
-// Point samples 32 pixels to 8 pixels.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 8 byte aligned.
-__declspec(naked)
-static void ScaleRowDown4_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- // src_stride ignored
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- pcmpeqb xmm5, xmm5 // generate mask 0x000000ff
- psrld xmm5, 24
-
- wloop:
- movdqa xmm0, [esi]
- movdqa xmm1, [esi + 16]
- lea esi, [esi + 32]
- pand xmm0, xmm5
- pand xmm1, xmm5
- packuswb xmm0, xmm1
- packuswb xmm0, xmm0
- movq qword ptr [edi], xmm0
- lea edi, [edi + 8]
- sub ecx, 8
- ja wloop
-
- popad
- ret
- }
-}
-
-// Blends 32x4 rectangle to 8x1.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 8 byte aligned.
-__declspec(naked)
-static void ScaleRowDown4Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov ebx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- pcmpeqb xmm7, xmm7 // generate mask 0x00ff00ff
- psrlw xmm7, 8
- lea edx, [ebx + ebx * 2] // src_stride * 3
-
- wloop:
- movdqa xmm0, [esi]
- movdqa xmm1, [esi + 16]
- movdqa xmm2, [esi + ebx]
- movdqa xmm3, [esi + ebx + 16]
- pavgb xmm0, xmm2 // average rows
- pavgb xmm1, xmm3
- movdqa xmm2, [esi + ebx * 2]
- movdqa xmm3, [esi + ebx * 2 + 16]
- movdqa xmm4, [esi + edx]
- movdqa xmm5, [esi + edx + 16]
- lea esi, [esi + 32]
- pavgb xmm2, xmm4
- pavgb xmm3, xmm5
- pavgb xmm0, xmm2
- pavgb xmm1, xmm3
-
- movdqa xmm2, xmm0 // average columns (32 to 16 pixels)
- psrlw xmm0, 8
- movdqa xmm3, xmm1
- psrlw xmm1, 8
- pand xmm2, xmm7
- pand xmm3, xmm7
- pavgw xmm0, xmm2
- pavgw xmm1, xmm3
- packuswb xmm0, xmm1
-
- movdqa xmm2, xmm0 // average columns (16 to 8 pixels)
- psrlw xmm0, 8
- pand xmm2, xmm7
- pavgw xmm0, xmm2
- packuswb xmm0, xmm0
-
- movq qword ptr [edi], xmm0
- lea edi, [edi + 8]
- sub ecx, 8
- ja wloop
-
- popad
- ret
- }
-}
-
-#define HAS_SCALEROWDOWN8_SSE2
-// Point samples 32 pixels to 4 pixels.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 4 byte aligned.
-__declspec(naked)
-static void ScaleRowDown8_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- // src_stride ignored
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- pcmpeqb xmm5, xmm5 // generate mask isolating 1 src 8 bytes
- psrlq xmm5, 56
-
- wloop:
- movdqa xmm0, [esi]
- movdqa xmm1, [esi + 16]
- lea esi, [esi + 32]
- pand xmm0, xmm5
- pand xmm1, xmm5
- packuswb xmm0, xmm1 // 32->16
- packuswb xmm0, xmm0 // 16->8
- packuswb xmm0, xmm0 // 8->4
- movd dword ptr [edi], xmm0
- lea edi, [edi + 4]
- sub ecx, 4
- ja wloop
-
- popad
- ret
- }
-}
-
-// Blends 32x8 rectangle to 4x1.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 4 byte aligned.
-__declspec(naked)
-static void ScaleRowDown8Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov ebx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- lea edx, [ebx + ebx * 2] // src_stride * 3
- pxor xmm7, xmm7
-
- wloop:
- movdqa xmm0, [esi] // average 8 rows to 1
- movdqa xmm1, [esi + 16]
- movdqa xmm2, [esi + ebx]
- movdqa xmm3, [esi + ebx + 16]
- pavgb xmm0, xmm2
- pavgb xmm1, xmm3
- movdqa xmm2, [esi + ebx * 2]
- movdqa xmm3, [esi + ebx * 2 + 16]
- movdqa xmm4, [esi + edx]
- movdqa xmm5, [esi + edx + 16]
- lea ebp, [esi + ebx * 4]
- lea esi, [esi + 32]
- pavgb xmm2, xmm4
- pavgb xmm3, xmm5
- pavgb xmm0, xmm2
- pavgb xmm1, xmm3
-
- movdqa xmm2, [ebp]
- movdqa xmm3, [ebp + 16]
- movdqa xmm4, [ebp + ebx]
- movdqa xmm5, [ebp + ebx + 16]
- pavgb xmm2, xmm4
- pavgb xmm3, xmm5
- movdqa xmm4, [ebp + ebx * 2]
- movdqa xmm5, [ebp + ebx * 2 + 16]
- movdqa xmm6, [ebp + edx]
- pavgb xmm4, xmm6
- movdqa xmm6, [ebp + edx + 16]
- pavgb xmm5, xmm6
- pavgb xmm2, xmm4
- pavgb xmm3, xmm5
- pavgb xmm0, xmm2
- pavgb xmm1, xmm3
-
- psadbw xmm0, xmm7 // average 32 pixels to 4
- psadbw xmm1, xmm7
- pshufd xmm0, xmm0, 0xd8 // x1x0 -> xx01
- pshufd xmm1, xmm1, 0x8d // x3x2 -> 32xx
- por xmm0, xmm1 // -> 3201
- psrlw xmm0, 3
- packuswb xmm0, xmm0
- packuswb xmm0, xmm0
- movd dword ptr [edi], xmm0
-
- lea edi, [edi + 4]
- sub ecx, 4
- ja wloop
-
- popad
- ret
- }
-}
-
-#define HAS_SCALEROWDOWN34_SSSE3
-// Point samples 32 pixels to 24 pixels.
-// Produces three 8 byte values. For each 8 bytes, 16 bytes are read.
-// Then shuffled to do the scaling.
-
-// Note that movdqa+palign may be better than movdqu.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 8 byte aligned.
-__declspec(naked)
-static void ScaleRowDown34_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- // src_stride ignored
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- movdqa xmm3, _shuf0
- movdqa xmm4, _shuf1
- movdqa xmm5, _shuf2
-
- wloop:
- movdqa xmm0, [esi]
- movdqa xmm1, [esi + 16]
- lea esi, [esi + 32]
- movdqa xmm2, xmm1
- palignr xmm1, xmm0, 8
- pshufb xmm0, xmm3
- pshufb xmm1, xmm4
- pshufb xmm2, xmm5
- movq qword ptr [edi], xmm0
- movq qword ptr [edi + 8], xmm1
- movq qword ptr [edi + 16], xmm2
- lea edi, [edi + 24]
- sub ecx, 24
- ja wloop
-
- popad
- ret
- }
-}
-
-// Blends 32x2 rectangle to 24x1
-// Produces three 8 byte values. For each 8 bytes, 16 bytes are read.
-// Then shuffled to do the scaling.
-
-// Register usage:
-// xmm0 src_row 0
-// xmm1 src_row 1
-// xmm2 shuf 0
-// xmm3 shuf 1
-// xmm4 shuf 2
-// xmm5 madd 0
-// xmm6 madd 1
-// xmm7 round34
-
-// Note that movdqa+palign may be better than movdqu.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 8 byte aligned.
-__declspec(naked)
-static void ScaleRowDown34_1_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov ebx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- movdqa xmm2, _shuf01
- movdqa xmm3, _shuf11
- movdqa xmm4, _shuf21
- movdqa xmm5, _madd01
- movdqa xmm6, _madd11
- movdqa xmm7, _round34
-
- wloop:
- movdqa xmm0, [esi] // pixels 0..7
- movdqa xmm1, [esi+ebx]
- pavgb xmm0, xmm1
- pshufb xmm0, xmm2
- pmaddubsw xmm0, xmm5
- paddsw xmm0, xmm7
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edi], xmm0
- movdqu xmm0, [esi+8] // pixels 8..15
- movdqu xmm1, [esi+ebx+8]
- pavgb xmm0, xmm1
- pshufb xmm0, xmm3
- pmaddubsw xmm0, xmm6
- paddsw xmm0, xmm7
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edi+8], xmm0
- movdqa xmm0, [esi+16] // pixels 16..23
- movdqa xmm1, [esi+ebx+16]
- lea esi, [esi+32]
- pavgb xmm0, xmm1
- pshufb xmm0, xmm4
- movdqa xmm1, _madd21
- pmaddubsw xmm0, xmm1
- paddsw xmm0, xmm7
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edi+16], xmm0
- lea edi, [edi+24]
- sub ecx, 24
- ja wloop
-
- popad
- ret
- }
-}
-
-// Note that movdqa+palign may be better than movdqu.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 8 byte aligned.
-__declspec(naked)
-static void ScaleRowDown34_0_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov ebx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- movdqa xmm2, _shuf01
- movdqa xmm3, _shuf11
- movdqa xmm4, _shuf21
- movdqa xmm5, _madd01
- movdqa xmm6, _madd11
- movdqa xmm7, _round34
-
- wloop:
- movdqa xmm0, [esi] // pixels 0..7
- movdqa xmm1, [esi+ebx]
- pavgb xmm1, xmm0
- pavgb xmm0, xmm1
- pshufb xmm0, xmm2
- pmaddubsw xmm0, xmm5
- paddsw xmm0, xmm7
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edi], xmm0
- movdqu xmm0, [esi+8] // pixels 8..15
- movdqu xmm1, [esi+ebx+8]
- pavgb xmm1, xmm0
- pavgb xmm0, xmm1
- pshufb xmm0, xmm3
- pmaddubsw xmm0, xmm6
- paddsw xmm0, xmm7
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edi+8], xmm0
- movdqa xmm0, [esi+16] // pixels 16..23
- movdqa xmm1, [esi+ebx+16]
- lea esi, [esi+32]
- pavgb xmm1, xmm0
- pavgb xmm0, xmm1
- pshufb xmm0, xmm4
- movdqa xmm1, _madd21
- pmaddubsw xmm0, xmm1
- paddsw xmm0, xmm7
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edi+16], xmm0
- lea edi, [edi+24]
- sub ecx, 24
- ja wloop
-
- popad
- ret
- }
-}
-
-#define HAS_SCALEROWDOWN38_SSSE3
-// 3/8 point sampler
-
-// Scale 32 pixels to 12
-__declspec(naked)
-static void ScaleRowDown38_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov edx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- movdqa xmm4, _shuf38a
- movdqa xmm5, _shuf38b
-
- xloop:
- movdqa xmm0, [esi] // 16 pixels -> 0,1,2,3,4,5
- movdqa xmm1, [esi + 16] // 16 pixels -> 6,7,8,9,10,11
- lea esi, [esi + 32]
- pshufb xmm0, xmm4
- pshufb xmm1, xmm5
- paddusb xmm0, xmm1
-
- movq qword ptr [edi], xmm0 // write 12 pixels
- movhlps xmm1, xmm0
- movd [edi + 8], xmm1
- lea edi, [edi + 12]
- sub ecx, 12
- ja xloop
-
- popad
- ret
- }
-}
-
-// Scale 16x3 pixels to 6x1 with interpolation
-__declspec(naked)
-static void ScaleRowDown38_3_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov edx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- movdqa xmm4, _shufac0
- movdqa xmm5, _shufac3
- movdqa xmm6, _scaleac3
- pxor xmm7, xmm7
-
- xloop:
- movdqa xmm0, [esi] // sum up 3 rows into xmm0/1
- movdqa xmm2, [esi + edx]
- movhlps xmm1, xmm0
- movhlps xmm3, xmm2
- punpcklbw xmm0, xmm7
- punpcklbw xmm1, xmm7
- punpcklbw xmm2, xmm7
- punpcklbw xmm3, xmm7
- paddusw xmm0, xmm2
- paddusw xmm1, xmm3
- movdqa xmm2, [esi + edx * 2]
- lea esi, [esi + 16]
- movhlps xmm3, xmm2
- punpcklbw xmm2, xmm7
- punpcklbw xmm3, xmm7
- paddusw xmm0, xmm2
- paddusw xmm1, xmm3
-
- movdqa xmm2, xmm0 // 8 pixels -> 0,1,2 of xmm2
- psrldq xmm0, 2
- paddusw xmm2, xmm0
- psrldq xmm0, 2
- paddusw xmm2, xmm0
- pshufb xmm2, xmm4
-
- movdqa xmm3, xmm1 // 8 pixels -> 3,4,5 of xmm2
- psrldq xmm1, 2
- paddusw xmm3, xmm1
- psrldq xmm1, 2
- paddusw xmm3, xmm1
- pshufb xmm3, xmm5
- paddusw xmm2, xmm3
-
- pmulhuw xmm2, xmm6 // divide by 9,9,6, 9,9,6
- packuswb xmm2, xmm2
-
- movd [edi], xmm2 // write 6 pixels
- pextrw eax, xmm2, 2
- mov [edi + 4], ax
- lea edi, [edi + 6]
- sub ecx, 6
- ja xloop
-
- popad
- ret
- }
-}
-
-// Scale 16x2 pixels to 6x1 with interpolation
-__declspec(naked)
-static void ScaleRowDown38_2_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov edx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- movdqa xmm4, _shufab0
- movdqa xmm5, _shufab1
- movdqa xmm6, _shufab2
- movdqa xmm7, _scaleab2
-
- xloop:
- movdqa xmm2, [esi] // average 2 rows into xmm2
- pavgb xmm2, [esi + edx]
- lea esi, [esi + 16]
-
- movdqa xmm0, xmm2 // 16 pixels -> 0,1,2,3,4,5 of xmm0
- pshufb xmm0, xmm4
- movdqa xmm1, xmm2
- pshufb xmm1, xmm5
- paddusw xmm0, xmm1
- pshufb xmm2, xmm6
- paddusw xmm0, xmm2
-
- pmulhuw xmm0, xmm7 // divide by 3,3,2, 3,3,2
- packuswb xmm0, xmm0
-
- movd [edi], xmm0 // write 6 pixels
- pextrw eax, xmm0, 2
- mov [edi + 4], ax
- lea edi, [edi + 6]
- sub ecx, 6
- ja xloop
-
- popad
- ret
- }
-}
-
-#define HAS_SCALEADDROWS_SSE2
-
-// Reads 8xN bytes and produces 16 shorts at a time.
-__declspec(naked)
-static void ScaleAddRows_SSE2(const uint8* src_ptr, int src_stride,
- uint16* dst_ptr, int src_width,
- int src_height) {
- __asm {
- pushad
- mov esi, [esp + 32 + 4] // src_ptr
- mov edx, [esp + 32 + 8] // src_stride
- mov edi, [esp + 32 + 12] // dst_ptr
- mov ecx, [esp + 32 + 16] // dst_width
- mov ebx, [esp + 32 + 20] // height
- pxor xmm5, xmm5
- dec ebx
-
- xloop:
- // first row
- movdqa xmm2, [esi]
- lea eax, [esi + edx]
- movhlps xmm3, xmm2
- mov ebp, ebx
- punpcklbw xmm2, xmm5
- punpcklbw xmm3, xmm5
-
- // sum remaining rows
- yloop:
- movdqa xmm0, [eax] // read 16 pixels
- lea eax, [eax + edx] // advance to next row
- movhlps xmm1, xmm0
- punpcklbw xmm0, xmm5
- punpcklbw xmm1, xmm5
- paddusw xmm2, xmm0 // sum 16 words
- paddusw xmm3, xmm1
- sub ebp, 1
- ja yloop
-
- movdqa [edi], xmm2
- movdqa [edi + 16], xmm3
- lea edi, [edi + 32]
- lea esi, [esi + 16]
-
- sub ecx, 16
- ja xloop
-
- popad
- ret
- }
-}
-
-// Bilinear row filtering combines 16x2 -> 16x1. SSE2 version.
-#define HAS_SCALEFILTERROWS_SSE2
-__declspec(naked)
-static void ScaleFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr,
- int src_stride, int dst_width,
- int source_y_fraction) {
- __asm {
- push esi
- push edi
- mov edi, [esp + 8 + 4] // dst_ptr
- mov esi, [esp + 8 + 8] // src_ptr
- mov edx, [esp + 8 + 12] // src_stride
- mov ecx, [esp + 8 + 16] // dst_width
- mov eax, [esp + 8 + 20] // source_y_fraction (0..255)
- cmp eax, 0
- je xloop1
- cmp eax, 128
- je xloop2
-
- movd xmm6, eax // xmm6 = y fraction
- punpcklwd xmm6, xmm6
- pshufd xmm6, xmm6, 0
- neg eax // xmm5 = 256 - y fraction
- add eax, 256
- movd xmm5, eax
- punpcklwd xmm5, xmm5
- pshufd xmm5, xmm5, 0
- pxor xmm7, xmm7
-
- xloop:
- movdqa xmm0, [esi]
- movdqa xmm2, [esi + edx]
- lea esi, [esi + 16]
- movdqa xmm1, xmm0
- movdqa xmm3, xmm2
- punpcklbw xmm0, xmm7
- punpcklbw xmm2, xmm7
- punpckhbw xmm1, xmm7
- punpckhbw xmm3, xmm7
- pmullw xmm0, xmm5 // scale row 0
- pmullw xmm1, xmm5
- pmullw xmm2, xmm6 // scale row 1
- pmullw xmm3, xmm6
- paddusw xmm0, xmm2 // sum rows
- paddusw xmm1, xmm3
- psrlw xmm0, 8
- psrlw xmm1, 8
- packuswb xmm0, xmm1
- movdqa [edi], xmm0
- lea edi, [edi + 16]
- sub ecx, 16
- ja xloop
-
- mov al, [edi - 1]
- mov [edi], al
- pop edi
- pop esi
- ret
-
- xloop1:
- movdqa xmm0, [esi]
- lea esi, [esi + 16]
- movdqa [edi], xmm0
- lea edi, [edi + 16]
- sub ecx, 16
- ja xloop1
-
- mov al, [edi - 1]
- mov [edi], al
- pop edi
- pop esi
- ret
-
- xloop2:
- movdqa xmm0, [esi]
- movdqa xmm2, [esi + edx]
- lea esi, [esi + 16]
- pavgb xmm0, xmm2
- movdqa [edi], xmm0
- lea edi, [edi + 16]
- sub ecx, 16
- ja xloop2
-
- mov al, [edi - 1]
- mov [edi], al
- pop edi
- pop esi
- ret
- }
-}
-
-// Bilinear row filtering combines 16x2 -> 16x1. SSSE3 version.
-#define HAS_SCALEFILTERROWS_SSSE3
-__declspec(naked)
-static void ScaleFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
- int src_stride, int dst_width,
- int source_y_fraction) {
- __asm {
- push esi
- push edi
- mov edi, [esp + 8 + 4] // dst_ptr
- mov esi, [esp + 8 + 8] // src_ptr
- mov edx, [esp + 8 + 12] // src_stride
- mov ecx, [esp + 8 + 16] // dst_width
- mov eax, [esp + 8 + 20] // source_y_fraction (0..255)
- shr eax, 1
- cmp eax, 0
- je xloop1
- cmp eax, 64
- je xloop2
-
- mov ah,al
- neg al
- add al, 128
- movd xmm5, eax
- punpcklwd xmm5, xmm5
- pshufd xmm5, xmm5, 0
-
- xloop:
- movdqa xmm0, [esi]
- movdqa xmm2, [esi + edx]
- lea esi, [esi + 16]
- movdqa xmm1, xmm0
- punpcklbw xmm0, xmm2
- punpckhbw xmm1, xmm2
- pmaddubsw xmm0, xmm5
- pmaddubsw xmm1, xmm5
- psrlw xmm0, 7
- psrlw xmm1, 7
- packuswb xmm0, xmm1
- movdqa [edi], xmm0
- lea edi, [edi + 16]
- sub ecx, 16
- ja xloop
-
- mov al, [edi - 1]
- mov [edi], al
- pop edi
- pop esi
- ret
-
- xloop1:
- movdqa xmm0, [esi]
- lea esi, [esi + 16]
- movdqa [edi], xmm0
- lea edi, [edi + 16]
- sub ecx, 16
- ja xloop1
-
- mov al, [edi - 1]
- mov [edi], al
- pop edi
- pop esi
- ret
-
- xloop2:
- movdqa xmm0, [esi]
- movdqa xmm2, [esi + edx]
- lea esi, [esi + 16]
- pavgb xmm0, xmm2
- movdqa [edi], xmm0
- lea edi, [edi + 16]
- sub ecx, 16
- ja xloop2
-
- mov al, [edi - 1]
- mov [edi], al
- pop edi
- pop esi
- ret
-
- }
-}
-
-// Note that movdqa+palign may be better than movdqu.
-// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 8 byte aligned.
-__declspec(naked)
-static void ScaleFilterCols34_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
- int dst_width) {
- __asm {
- mov edx, [esp + 4] // dst_ptr
- mov eax, [esp + 8] // src_ptr
- mov ecx, [esp + 12] // dst_width
- movdqa xmm1, _round34
- movdqa xmm2, _shuf01
- movdqa xmm3, _shuf11
- movdqa xmm4, _shuf21
- movdqa xmm5, _madd01
- movdqa xmm6, _madd11
- movdqa xmm7, _madd21
-
- wloop:
- movdqa xmm0, [eax] // pixels 0..7
- pshufb xmm0, xmm2
- pmaddubsw xmm0, xmm5
- paddsw xmm0, xmm1
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edx], xmm0
- movdqu xmm0, [eax+8] // pixels 8..15
- pshufb xmm0, xmm3
- pmaddubsw xmm0, xmm6
- paddsw xmm0, xmm1
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edx+8], xmm0
- movdqa xmm0, [eax+16] // pixels 16..23
- lea eax, [eax+32]
- pshufb xmm0, xmm4
- pmaddubsw xmm0, xmm7
- paddsw xmm0, xmm1
- psrlw xmm0, 2
- packuswb xmm0, xmm0
- movq qword ptr [edx+16], xmm0
- lea edx, [edx+24]
- sub ecx, 24
- ja wloop
- ret
- }
-}
-
-#elif (defined(__x86_64__) || defined(__i386__)) && !defined(YUV_DISABLE_ASM)
-
-// GCC versions of row functions are verbatim conversions from Visual C.
-// Generated using gcc disassembly on Visual C object file:
-// objdump -D yuvscaler.obj >yuvscaler.txt
-#define HAS_SCALEROWDOWN2_SSE2
-static void ScaleRowDown2_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "pcmpeqb %%xmm5,%%xmm5 \n"
- "psrlw $0x8,%%xmm5 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm1 \n"
- "lea 0x20(%0),%0 \n"
- "pand %%xmm5,%%xmm0 \n"
- "pand %%xmm5,%%xmm1 \n"
- "packuswb %%xmm1,%%xmm0 \n"
- "movdqa %%xmm0,(%1) \n"
- "lea 0x10(%1),%1 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- :
- : "memory", "cc"
-);
-}
-
-static void ScaleRowDown2Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "pcmpeqb %%xmm5,%%xmm5 \n"
- "psrlw $0x8,%%xmm5 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm1 \n"
- "movdqa (%0,%3,1),%%xmm2 \n"
- "movdqa 0x10(%0,%3,1),%%xmm3 \n"
- "lea 0x20(%0),%0 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "pavgb %%xmm3,%%xmm1 \n"
- "movdqa %%xmm0,%%xmm2 \n"
- "psrlw $0x8,%%xmm0 \n"
- "movdqa %%xmm1,%%xmm3 \n"
- "psrlw $0x8,%%xmm1 \n"
- "pand %%xmm5,%%xmm2 \n"
- "pand %%xmm5,%%xmm3 \n"
- "pavgw %%xmm2,%%xmm0 \n"
- "pavgw %%xmm3,%%xmm1 \n"
- "packuswb %%xmm1,%%xmm0 \n"
- "movdqa %%xmm0,(%1) \n"
- "lea 0x10(%1),%1 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)) // %3
- : "memory", "cc"
-);
-}
-
-#define HAS_SCALEROWDOWN4_SSE2
-static void ScaleRowDown4_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "pcmpeqb %%xmm5,%%xmm5 \n"
- "psrld $0x18,%%xmm5 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm1 \n"
- "lea 0x20(%0),%0 \n"
- "pand %%xmm5,%%xmm0 \n"
- "pand %%xmm5,%%xmm1 \n"
- "packuswb %%xmm1,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,(%1) \n"
- "lea 0x8(%1),%1 \n"
- "sub $0x8,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- :
- : "memory", "cc"
-);
-}
-
-static void ScaleRowDown4Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- intptr_t temp = 0;
- asm volatile (
- "pcmpeqb %%xmm7,%%xmm7 \n"
- "psrlw $0x8,%%xmm7 \n"
- "lea (%4,%4,2),%3 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm1 \n"
- "movdqa (%0,%4,1),%%xmm2 \n"
- "movdqa 0x10(%0,%4,1),%%xmm3 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "pavgb %%xmm3,%%xmm1 \n"
- "movdqa (%0,%4,2),%%xmm2 \n"
- "movdqa 0x10(%0,%4,2),%%xmm3 \n"
- "movdqa (%0,%3,1),%%xmm4 \n"
- "movdqa 0x10(%0,%3,1),%%xmm5 \n"
- "lea 0x20(%0),%0 \n"
- "pavgb %%xmm4,%%xmm2 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "pavgb %%xmm5,%%xmm3 \n"
- "pavgb %%xmm3,%%xmm1 \n"
- "movdqa %%xmm0,%%xmm2 \n"
- "psrlw $0x8,%%xmm0 \n"
- "movdqa %%xmm1,%%xmm3 \n"
- "psrlw $0x8,%%xmm1 \n"
- "pand %%xmm7,%%xmm2 \n"
- "pand %%xmm7,%%xmm3 \n"
- "pavgw %%xmm2,%%xmm0 \n"
- "pavgw %%xmm3,%%xmm1 \n"
- "packuswb %%xmm1,%%xmm0 \n"
- "movdqa %%xmm0,%%xmm2 \n"
- "psrlw $0x8,%%xmm0 \n"
- "pand %%xmm7,%%xmm2 \n"
- "pavgw %%xmm2,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,(%1) \n"
- "lea 0x8(%1),%1 \n"
- "sub $0x8,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width), // %2
- "+r"(temp) // %3
- : "r"((intptr_t)(src_stride)) // %4
- : "memory", "cc"
-#if defined(__x86_64__)
- , "xmm6", "xmm7"
-#endif
-);
-}
-
-#define HAS_SCALEROWDOWN8_SSE2
-static void ScaleRowDown8_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "pcmpeqb %%xmm5,%%xmm5 \n"
- "psrlq $0x38,%%xmm5 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm1 \n"
- "lea 0x20(%0),%0 \n"
- "pand %%xmm5,%%xmm0 \n"
- "pand %%xmm5,%%xmm1 \n"
- "packuswb %%xmm1,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movd %%xmm0,(%1) \n"
- "lea 0x4(%1),%1 \n"
- "sub $0x4,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- :
- : "memory", "cc"
-);
-}
-
-#if defined(__i386__)
-void ScaleRowDown8Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- asm(
- DECLARE_FUNCTION(ScaleRowDown8Int_SSE2)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x28(%esp),%ebx \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "lea (%ebx,%ebx,2),%edx \n"
- "pxor %xmm7,%xmm7 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa 0x10(%esi),%xmm1 \n"
- "movdqa (%esi,%ebx,1),%xmm2 \n"
- "movdqa 0x10(%esi,%ebx,1),%xmm3 \n"
- "pavgb %xmm2,%xmm0 \n"
- "pavgb %xmm3,%xmm1 \n"
- "movdqa (%esi,%ebx,2),%xmm2 \n"
- "movdqa 0x10(%esi,%ebx,2),%xmm3 \n"
- "movdqa (%esi,%edx,1),%xmm4 \n"
- "movdqa 0x10(%esi,%edx,1),%xmm5 \n"
- "lea (%esi,%ebx,4),%ebp \n"
- "lea 0x20(%esi),%esi \n"
- "pavgb %xmm4,%xmm2 \n"
- "pavgb %xmm5,%xmm3 \n"
- "pavgb %xmm2,%xmm0 \n"
- "pavgb %xmm3,%xmm1 \n"
- "movdqa 0x0(%ebp),%xmm2 \n"
- "movdqa 0x10(%ebp),%xmm3 \n"
- "movdqa 0x0(%ebp,%ebx,1),%xmm4 \n"
- "movdqa 0x10(%ebp,%ebx,1),%xmm5 \n"
- "pavgb %xmm4,%xmm2 \n"
- "pavgb %xmm5,%xmm3 \n"
- "movdqa 0x0(%ebp,%ebx,2),%xmm4 \n"
- "movdqa 0x10(%ebp,%ebx,2),%xmm5 \n"
- "movdqa 0x0(%ebp,%edx,1),%xmm6 \n"
- "pavgb %xmm6,%xmm4 \n"
- "movdqa 0x10(%ebp,%edx,1),%xmm6 \n"
- "pavgb %xmm6,%xmm5 \n"
- "pavgb %xmm4,%xmm2 \n"
- "pavgb %xmm5,%xmm3 \n"
- "pavgb %xmm2,%xmm0 \n"
- "pavgb %xmm3,%xmm1 \n"
- "psadbw %xmm7,%xmm0 \n"
- "psadbw %xmm7,%xmm1 \n"
- "pshufd $0xd8,%xmm0,%xmm0 \n"
- "pshufd $0x8d,%xmm1,%xmm1 \n"
- "por %xmm1,%xmm0 \n"
- "psrlw $0x3,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movd %xmm0,(%edi) \n"
- "lea 0x4(%edi),%edi \n"
- "sub $0x4,%ecx \n"
- "ja 1b \n"
- "popa \n"
- "ret \n"
-);
-
-// fpic is used for magiccam plugin
-#if !defined(__PIC__)
-#define HAS_SCALEROWDOWN34_SSSE3
-void ScaleRowDown34_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- asm(
- DECLARE_FUNCTION(ScaleRowDown34_SSSE3)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "movdqa _shuf0,%xmm3 \n"
- "movdqa _shuf1,%xmm4 \n"
- "movdqa _shuf2,%xmm5 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa 0x10(%esi),%xmm2 \n"
- "lea 0x20(%esi),%esi \n"
- "movdqa %xmm2,%xmm1 \n"
- "palignr $0x8,%xmm0,%xmm1 \n"
- "pshufb %xmm3,%xmm0 \n"
- "pshufb %xmm4,%xmm1 \n"
- "pshufb %xmm5,%xmm2 \n"
- "movq %xmm0,(%edi) \n"
- "movq %xmm1,0x8(%edi) \n"
- "movq %xmm2,0x10(%edi) \n"
- "lea 0x18(%edi),%edi \n"
- "sub $0x18,%ecx \n"
- "ja 1b \n"
- "popa \n"
- "ret \n"
-);
-
-void ScaleRowDown34_1_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- asm(
- DECLARE_FUNCTION(ScaleRowDown34_1_Int_SSSE3)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x28(%esp),%ebp \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "movdqa _shuf01,%xmm2 \n"
- "movdqa _shuf11,%xmm3 \n"
- "movdqa _shuf21,%xmm4 \n"
- "movdqa _madd01,%xmm5 \n"
- "movdqa _madd11,%xmm6 \n"
- "movdqa _round34,%xmm7 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa (%esi,%ebp),%xmm1 \n"
- "pavgb %xmm1,%xmm0 \n"
- "pshufb %xmm2,%xmm0 \n"
- "pmaddubsw %xmm5,%xmm0 \n"
- "paddsw %xmm7,%xmm0 \n"
- "psrlw $0x2,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movq %xmm0,(%edi) \n"
- "movdqu 0x8(%esi),%xmm0 \n"
- "movdqu 0x8(%esi,%ebp),%xmm1 \n"
- "pavgb %xmm1,%xmm0 \n"
- "pshufb %xmm3,%xmm0 \n"
- "pmaddubsw %xmm6,%xmm0 \n"
- "paddsw %xmm7,%xmm0 \n"
- "psrlw $0x2,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movq %xmm0,0x8(%edi) \n"
- "movdqa 0x10(%esi),%xmm0 \n"
- "movdqa 0x10(%esi,%ebp),%xmm1 \n"
- "lea 0x20(%esi),%esi \n"
- "pavgb %xmm1,%xmm0 \n"
- "pshufb %xmm4,%xmm0 \n"
- "movdqa _madd21,%xmm1 \n"
- "pmaddubsw %xmm1,%xmm0 \n"
- "paddsw %xmm7,%xmm0 \n"
- "psrlw $0x2,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movq %xmm0,0x10(%edi) \n"
- "lea 0x18(%edi),%edi \n"
- "sub $0x18,%ecx \n"
- "ja 1b \n"
-
- "popa \n"
- "ret \n"
-);
-
-void ScaleRowDown34_0_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- asm(
- DECLARE_FUNCTION(ScaleRowDown34_0_Int_SSSE3)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x28(%esp),%ebp \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "movdqa _shuf01,%xmm2 \n"
- "movdqa _shuf11,%xmm3 \n"
- "movdqa _shuf21,%xmm4 \n"
- "movdqa _madd01,%xmm5 \n"
- "movdqa _madd11,%xmm6 \n"
- "movdqa _round34,%xmm7 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa (%esi,%ebp,1),%xmm1 \n"
- "pavgb %xmm0,%xmm1 \n"
- "pavgb %xmm1,%xmm0 \n"
- "pshufb %xmm2,%xmm0 \n"
- "pmaddubsw %xmm5,%xmm0 \n"
- "paddsw %xmm7,%xmm0 \n"
- "psrlw $0x2,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movq %xmm0,(%edi) \n"
- "movdqu 0x8(%esi),%xmm0 \n"
- "movdqu 0x8(%esi,%ebp,1),%xmm1 \n"
- "pavgb %xmm0,%xmm1 \n"
- "pavgb %xmm1,%xmm0 \n"
- "pshufb %xmm3,%xmm0 \n"
- "pmaddubsw %xmm6,%xmm0 \n"
- "paddsw %xmm7,%xmm0 \n"
- "psrlw $0x2,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movq %xmm0,0x8(%edi) \n"
- "movdqa 0x10(%esi),%xmm0 \n"
- "movdqa 0x10(%esi,%ebp,1),%xmm1 \n"
- "lea 0x20(%esi),%esi \n"
- "pavgb %xmm0,%xmm1 \n"
- "pavgb %xmm1,%xmm0 \n"
- "pshufb %xmm4,%xmm0 \n"
- "movdqa _madd21,%xmm1 \n"
- "pmaddubsw %xmm1,%xmm0 \n"
- "paddsw %xmm7,%xmm0 \n"
- "psrlw $0x2,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movq %xmm0,0x10(%edi) \n"
- "lea 0x18(%edi),%edi \n"
- "sub $0x18,%ecx \n"
- "ja 1b \n"
- "popa \n"
- "ret \n"
-);
-
-#define HAS_SCALEROWDOWN38_SSSE3
-void ScaleRowDown38_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- asm(
- DECLARE_FUNCTION(ScaleRowDown38_SSSE3)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x28(%esp),%edx \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "movdqa _shuf38a ,%xmm4 \n"
- "movdqa _shuf38b ,%xmm5 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa 0x10(%esi),%xmm1 \n"
- "lea 0x20(%esi),%esi \n"
- "pshufb %xmm4,%xmm0 \n"
- "pshufb %xmm5,%xmm1 \n"
- "paddusb %xmm1,%xmm0 \n"
- "movq %xmm0,(%edi) \n"
- "movhlps %xmm0,%xmm1 \n"
- "movd %xmm1,0x8(%edi) \n"
- "lea 0xc(%edi),%edi \n"
- "sub $0xc,%ecx \n"
- "ja 1b \n"
- "popa \n"
- "ret \n"
-);
-
-void ScaleRowDown38_3_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- asm(
- DECLARE_FUNCTION(ScaleRowDown38_3_Int_SSSE3)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x28(%esp),%edx \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "movdqa _shufac0,%xmm4 \n"
- "movdqa _shufac3,%xmm5 \n"
- "movdqa _scaleac3,%xmm6 \n"
- "pxor %xmm7,%xmm7 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa (%esi,%edx,1),%xmm2 \n"
- "movhlps %xmm0,%xmm1 \n"
- "movhlps %xmm2,%xmm3 \n"
- "punpcklbw %xmm7,%xmm0 \n"
- "punpcklbw %xmm7,%xmm1 \n"
- "punpcklbw %xmm7,%xmm2 \n"
- "punpcklbw %xmm7,%xmm3 \n"
- "paddusw %xmm2,%xmm0 \n"
- "paddusw %xmm3,%xmm1 \n"
- "movdqa (%esi,%edx,2),%xmm2 \n"
- "lea 0x10(%esi),%esi \n"
- "movhlps %xmm2,%xmm3 \n"
- "punpcklbw %xmm7,%xmm2 \n"
- "punpcklbw %xmm7,%xmm3 \n"
- "paddusw %xmm2,%xmm0 \n"
- "paddusw %xmm3,%xmm1 \n"
- "movdqa %xmm0,%xmm2 \n"
- "psrldq $0x2,%xmm0 \n"
- "paddusw %xmm0,%xmm2 \n"
- "psrldq $0x2,%xmm0 \n"
- "paddusw %xmm0,%xmm2 \n"
- "pshufb %xmm4,%xmm2 \n"
- "movdqa %xmm1,%xmm3 \n"
- "psrldq $0x2,%xmm1 \n"
- "paddusw %xmm1,%xmm3 \n"
- "psrldq $0x2,%xmm1 \n"
- "paddusw %xmm1,%xmm3 \n"
- "pshufb %xmm5,%xmm3 \n"
- "paddusw %xmm3,%xmm2 \n"
- "pmulhuw %xmm6,%xmm2 \n"
- "packuswb %xmm2,%xmm2 \n"
- "movd %xmm2,(%edi) \n"
- "pextrw $0x2,%xmm2,%eax \n"
- "mov %ax,0x4(%edi) \n"
- "lea 0x6(%edi),%edi \n"
- "sub $0x6,%ecx \n"
- "ja 1b \n"
- "popa \n"
- "ret \n"
-);
-
-void ScaleRowDown38_2_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- asm(
- DECLARE_FUNCTION(ScaleRowDown38_2_Int_SSSE3)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x28(%esp),%edx \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "movdqa _shufab0,%xmm4 \n"
- "movdqa _shufab1,%xmm5 \n"
- "movdqa _shufab2,%xmm6 \n"
- "movdqa _scaleab2,%xmm7 \n"
-
-"1:"
- "movdqa (%esi),%xmm2 \n"
- "pavgb (%esi,%edx,1),%xmm2 \n"
- "lea 0x10(%esi),%esi \n"
- "movdqa %xmm2,%xmm0 \n"
- "pshufb %xmm4,%xmm0 \n"
- "movdqa %xmm2,%xmm1 \n"
- "pshufb %xmm5,%xmm1 \n"
- "paddusw %xmm1,%xmm0 \n"
- "pshufb %xmm6,%xmm2 \n"
- "paddusw %xmm2,%xmm0 \n"
- "pmulhuw %xmm7,%xmm0 \n"
- "packuswb %xmm0,%xmm0 \n"
- "movd %xmm0,(%edi) \n"
- "pextrw $0x2,%xmm0,%eax \n"
- "mov %ax,0x4(%edi) \n"
- "lea 0x6(%edi),%edi \n"
- "sub $0x6,%ecx \n"
- "ja 1b \n"
- "popa \n"
- "ret \n"
-);
-#endif // __PIC__
-
-#define HAS_SCALEADDROWS_SSE2
-void ScaleAddRows_SSE2(const uint8* src_ptr, int src_stride,
- uint16* dst_ptr, int src_width,
- int src_height);
- asm(
- DECLARE_FUNCTION(ScaleAddRows_SSE2)
- "pusha \n"
- "mov 0x24(%esp),%esi \n"
- "mov 0x28(%esp),%edx \n"
- "mov 0x2c(%esp),%edi \n"
- "mov 0x30(%esp),%ecx \n"
- "mov 0x34(%esp),%ebx \n"
- "pxor %xmm5,%xmm5 \n"
-
-"1:"
- "movdqa (%esi),%xmm2 \n"
- "lea (%esi,%edx,1),%eax \n"
- "movhlps %xmm2,%xmm3 \n"
- "lea -0x1(%ebx),%ebp \n"
- "punpcklbw %xmm5,%xmm2 \n"
- "punpcklbw %xmm5,%xmm3 \n"
-
-"2:"
- "movdqa (%eax),%xmm0 \n"
- "lea (%eax,%edx,1),%eax \n"
- "movhlps %xmm0,%xmm1 \n"
- "punpcklbw %xmm5,%xmm0 \n"
- "punpcklbw %xmm5,%xmm1 \n"
- "paddusw %xmm0,%xmm2 \n"
- "paddusw %xmm1,%xmm3 \n"
- "sub $0x1,%ebp \n"
- "ja 2b \n"
-
- "movdqa %xmm2,(%edi) \n"
- "movdqa %xmm3,0x10(%edi) \n"
- "lea 0x20(%edi),%edi \n"
- "lea 0x10(%esi),%esi \n"
- "sub $0x10,%ecx \n"
- "ja 1b \n"
- "popa \n"
- "ret \n"
-);
-
-// Bilinear row filtering combines 16x2 -> 16x1. SSE2 version
-#define HAS_SCALEFILTERROWS_SSE2
-void ScaleFilterRows_SSE2(uint8* dst_ptr,
- const uint8* src_ptr, int src_stride,
- int dst_width, int source_y_fraction);
- asm(
- DECLARE_FUNCTION(ScaleFilterRows_SSE2)
- "push %esi \n"
- "push %edi \n"
- "mov 0xc(%esp),%edi \n"
- "mov 0x10(%esp),%esi \n"
- "mov 0x14(%esp),%edx \n"
- "mov 0x18(%esp),%ecx \n"
- "mov 0x1c(%esp),%eax \n"
- "cmp $0x0,%eax \n"
- "je 2f \n"
- "cmp $0x80,%eax \n"
- "je 3f \n"
- "movd %eax,%xmm6 \n"
- "punpcklwd %xmm6,%xmm6 \n"
- "pshufd $0x0,%xmm6,%xmm6 \n"
- "neg %eax \n"
- "add $0x100,%eax \n"
- "movd %eax,%xmm5 \n"
- "punpcklwd %xmm5,%xmm5 \n"
- "pshufd $0x0,%xmm5,%xmm5 \n"
- "pxor %xmm7,%xmm7 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa (%esi,%edx,1),%xmm2 \n"
- "lea 0x10(%esi),%esi \n"
- "movdqa %xmm0,%xmm1 \n"
- "movdqa %xmm2,%xmm3 \n"
- "punpcklbw %xmm7,%xmm0 \n"
- "punpcklbw %xmm7,%xmm2 \n"
- "punpckhbw %xmm7,%xmm1 \n"
- "punpckhbw %xmm7,%xmm3 \n"
- "pmullw %xmm5,%xmm0 \n"
- "pmullw %xmm5,%xmm1 \n"
- "pmullw %xmm6,%xmm2 \n"
- "pmullw %xmm6,%xmm3 \n"
- "paddusw %xmm2,%xmm0 \n"
- "paddusw %xmm3,%xmm1 \n"
- "psrlw $0x8,%xmm0 \n"
- "psrlw $0x8,%xmm1 \n"
- "packuswb %xmm1,%xmm0 \n"
- "movdqa %xmm0,(%edi) \n"
- "lea 0x10(%edi),%edi \n"
- "sub $0x10,%ecx \n"
- "ja 1b \n"
- "mov -0x1(%edi),%al \n"
- "mov %al,(%edi) \n"
- "pop %edi \n"
- "pop %esi \n"
- "ret \n"
-
-"2:"
- "movdqa (%esi),%xmm0 \n"
- "lea 0x10(%esi),%esi \n"
- "movdqa %xmm0,(%edi) \n"
- "lea 0x10(%edi),%edi \n"
- "sub $0x10,%ecx \n"
- "ja 2b \n"
-
- "mov -0x1(%edi),%al \n"
- "mov %al,(%edi) \n"
- "pop %edi \n"
- "pop %esi \n"
- "ret \n"
-
-"3:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa (%esi,%edx,1),%xmm2 \n"
- "lea 0x10(%esi),%esi \n"
- "pavgb %xmm2,%xmm0 \n"
- "movdqa %xmm0,(%edi) \n"
- "lea 0x10(%edi),%edi \n"
- "sub $0x10,%ecx \n"
- "ja 3b \n"
-
- "mov -0x1(%edi),%al \n"
- "mov %al,(%edi) \n"
- "pop %edi \n"
- "pop %esi \n"
- "ret \n"
-);
-
-// Bilinear row filtering combines 16x2 -> 16x1. SSSE3 version
-#define HAS_SCALEFILTERROWS_SSSE3
-void ScaleFilterRows_SSSE3(uint8* dst_ptr,
- const uint8* src_ptr, int src_stride,
- int dst_width, int source_y_fraction);
- asm(
- DECLARE_FUNCTION(ScaleFilterRows_SSSE3)
- "push %esi \n"
- "push %edi \n"
- "mov 0xc(%esp),%edi \n"
- "mov 0x10(%esp),%esi \n"
- "mov 0x14(%esp),%edx \n"
- "mov 0x18(%esp),%ecx \n"
- "mov 0x1c(%esp),%eax \n"
- "shr %eax \n"
- "cmp $0x0,%eax \n"
- "je 2f \n"
- "cmp $0x40,%eax \n"
- "je 3f \n"
- "mov %al,%ah \n"
- "neg %al \n"
- "add $0x80,%al \n"
- "movd %eax,%xmm5 \n"
- "punpcklwd %xmm5,%xmm5 \n"
- "pshufd $0x0,%xmm5,%xmm5 \n"
-
-"1:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa (%esi,%edx,1),%xmm2 \n"
- "lea 0x10(%esi),%esi \n"
- "movdqa %xmm0,%xmm1 \n"
- "punpcklbw %xmm2,%xmm0 \n"
- "punpckhbw %xmm2,%xmm1 \n"
- "pmaddubsw %xmm5,%xmm0 \n"
- "pmaddubsw %xmm5,%xmm1 \n"
- "psrlw $0x7,%xmm0 \n"
- "psrlw $0x7,%xmm1 \n"
- "packuswb %xmm1,%xmm0 \n"
- "movdqa %xmm0,(%edi) \n"
- "lea 0x10(%edi),%edi \n"
- "sub $0x10,%ecx \n"
- "ja 1b \n"
- "mov -0x1(%edi),%al \n"
- "mov %al,(%edi) \n"
- "pop %edi \n"
- "pop %esi \n"
- "ret \n"
-
-"2:"
- "movdqa (%esi),%xmm0 \n"
- "lea 0x10(%esi),%esi \n"
- "movdqa %xmm0,(%edi) \n"
- "lea 0x10(%edi),%edi \n"
- "sub $0x10,%ecx \n"
- "ja 2b \n"
- "mov -0x1(%edi),%al \n"
- "mov %al,(%edi) \n"
- "pop %edi \n"
- "pop %esi \n"
- "ret \n"
-
-"3:"
- "movdqa (%esi),%xmm0 \n"
- "movdqa (%esi,%edx,1),%xmm2 \n"
- "lea 0x10(%esi),%esi \n"
- "pavgb %xmm2,%xmm0 \n"
- "movdqa %xmm0,(%edi) \n"
- "lea 0x10(%edi),%edi \n"
- "sub $0x10,%ecx \n"
- "ja 3b \n"
- "mov -0x1(%edi),%al \n"
- "mov %al,(%edi) \n"
- "pop %edi \n"
- "pop %esi \n"
- "ret \n"
-);
-
-#elif defined(__x86_64__)
-static void ScaleRowDown8Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "lea (%3,%3,2),%%r10 \n"
- "pxor %%xmm7,%%xmm7 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm1 \n"
- "movdqa (%0,%3,1),%%xmm2 \n"
- "movdqa 0x10(%0,%3,1),%%xmm3 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "pavgb %%xmm3,%%xmm1 \n"
- "movdqa (%0,%3,2),%%xmm2 \n"
- "movdqa 0x10(%0,%3,2),%%xmm3 \n"
- "movdqa (%0,%%r10,1),%%xmm4 \n"
- "movdqa 0x10(%0,%%r10,1),%%xmm5 \n"
- "lea (%0,%3,4),%%r11 \n"
- "lea 0x20(%0),%0 \n"
- "pavgb %%xmm4,%%xmm2 \n"
- "pavgb %%xmm5,%%xmm3 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "pavgb %%xmm3,%%xmm1 \n"
- "movdqa 0x0(%%r11),%%xmm2 \n"
- "movdqa 0x10(%%r11),%%xmm3 \n"
- "movdqa 0x0(%%r11,%3,1),%%xmm4 \n"
- "movdqa 0x10(%%r11,%3,1),%%xmm5 \n"
- "pavgb %%xmm4,%%xmm2 \n"
- "pavgb %%xmm5,%%xmm3 \n"
- "movdqa 0x0(%%r11,%3,2),%%xmm4 \n"
- "movdqa 0x10(%%r11,%3,2),%%xmm5 \n"
- "movdqa 0x0(%%r11,%%r10,1),%%xmm6 \n"
- "pavgb %%xmm6,%%xmm4 \n"
- "movdqa 0x10(%%r11,%%r10,1),%%xmm6 \n"
- "pavgb %%xmm6,%%xmm5 \n"
- "pavgb %%xmm4,%%xmm2 \n"
- "pavgb %%xmm5,%%xmm3 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "pavgb %%xmm3,%%xmm1 \n"
- "psadbw %%xmm7,%%xmm0 \n"
- "psadbw %%xmm7,%%xmm1 \n"
- "pshufd $0xd8,%%xmm0,%%xmm0 \n"
- "pshufd $0x8d,%%xmm1,%%xmm1 \n"
- "por %%xmm1,%%xmm0 \n"
- "psrlw $0x3,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movd %%xmm0,(%1) \n"
- "lea 0x4(%1),%1 \n"
- "sub $0x4,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)) // %3
- : "memory", "cc", "r10", "r11", "xmm6", "xmm7"
-);
-}
-
-#define HAS_SCALEROWDOWN34_SSSE3
-static void ScaleRowDown34_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "movdqa (%3),%%xmm3 \n"
- "movdqa (%4),%%xmm4 \n"
- "movdqa (%5),%%xmm5 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm2 \n"
- "lea 0x20(%0),%0 \n"
- "movdqa %%xmm2,%%xmm1 \n"
- "palignr $0x8,%%xmm0,%%xmm1 \n"
- "pshufb %%xmm3,%%xmm0 \n"
- "pshufb %%xmm4,%%xmm1 \n"
- "pshufb %%xmm5,%%xmm2 \n"
- "movq %%xmm0,(%1) \n"
- "movq %%xmm1,0x8(%1) \n"
- "movq %%xmm2,0x10(%1) \n"
- "lea 0x18(%1),%1 \n"
- "sub $0x18,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"(_shuf0), // %3
- "r"(_shuf1), // %4
- "r"(_shuf2) // %5
- : "memory", "cc"
-);
-}
-
-static void ScaleRowDown34_1_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "movdqa (%4),%%xmm2 \n" // _shuf01
- "movdqa (%5),%%xmm3 \n" // _shuf11
- "movdqa (%6),%%xmm4 \n" // _shuf21
- "movdqa (%7),%%xmm5 \n" // _madd01
- "movdqa (%8),%%xmm6 \n" // _madd11
- "movdqa (%9),%%xmm7 \n" // _round34
- "movdqa (%10),%%xmm8 \n" // _madd21
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa (%0,%3),%%xmm1 \n"
- "pavgb %%xmm1,%%xmm0 \n"
- "pshufb %%xmm2,%%xmm0 \n"
- "pmaddubsw %%xmm5,%%xmm0 \n"
- "paddsw %%xmm7,%%xmm0 \n"
- "psrlw $0x2,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,(%1) \n"
- "movdqu 0x8(%0),%%xmm0 \n"
- "movdqu 0x8(%0,%3),%%xmm1 \n"
- "pavgb %%xmm1,%%xmm0 \n"
- "pshufb %%xmm3,%%xmm0 \n"
- "pmaddubsw %%xmm6,%%xmm0 \n"
- "paddsw %%xmm7,%%xmm0 \n"
- "psrlw $0x2,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,0x8(%1) \n"
- "movdqa 0x10(%0),%%xmm0 \n"
- "movdqa 0x10(%0,%3),%%xmm1 \n"
- "lea 0x20(%0),%0 \n"
- "pavgb %%xmm1,%%xmm0 \n"
- "pshufb %%xmm4,%%xmm0 \n"
- "pmaddubsw %%xmm8,%%xmm0 \n"
- "paddsw %%xmm7,%%xmm0 \n"
- "psrlw $0x2,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,0x10(%1) \n"
- "lea 0x18(%1),%1 \n"
- "sub $0x18,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)), // %3
- "r"(_shuf01), // %4
- "r"(_shuf11), // %5
- "r"(_shuf21), // %6
- "r"(_madd01), // %7
- "r"(_madd11), // %8
- "r"(_round34), // %9
- "r"(_madd21) // %10
- : "memory", "cc", "xmm6", "xmm7", "xmm8"
-);
-}
-
-static void ScaleRowDown34_0_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "movdqa (%4),%%xmm2 \n" // _shuf01
- "movdqa (%5),%%xmm3 \n" // _shuf11
- "movdqa (%6),%%xmm4 \n" // _shuf21
- "movdqa (%7),%%xmm5 \n" // _madd01
- "movdqa (%8),%%xmm6 \n" // _madd11
- "movdqa (%9),%%xmm7 \n" // _round34
- "movdqa (%10),%%xmm8 \n" // _madd21
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa (%0,%3,1),%%xmm1 \n"
- "pavgb %%xmm0,%%xmm1 \n"
- "pavgb %%xmm1,%%xmm0 \n"
- "pshufb %%xmm2,%%xmm0 \n"
- "pmaddubsw %%xmm5,%%xmm0 \n"
- "paddsw %%xmm7,%%xmm0 \n"
- "psrlw $0x2,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,(%1) \n"
- "movdqu 0x8(%0),%%xmm0 \n"
- "movdqu 0x8(%0,%3,1),%%xmm1 \n"
- "pavgb %%xmm0,%%xmm1 \n"
- "pavgb %%xmm1,%%xmm0 \n"
- "pshufb %%xmm3,%%xmm0 \n"
- "pmaddubsw %%xmm6,%%xmm0 \n"
- "paddsw %%xmm7,%%xmm0 \n"
- "psrlw $0x2,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,0x8(%1) \n"
- "movdqa 0x10(%0),%%xmm0 \n"
- "movdqa 0x10(%0,%3,1),%%xmm1 \n"
- "lea 0x20(%0),%0 \n"
- "pavgb %%xmm0,%%xmm1 \n"
- "pavgb %%xmm1,%%xmm0 \n"
- "pshufb %%xmm4,%%xmm0 \n"
- "pmaddubsw %%xmm8,%%xmm0 \n"
- "paddsw %%xmm7,%%xmm0 \n"
- "psrlw $0x2,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movq %%xmm0,0x10(%1) \n"
- "lea 0x18(%1),%1 \n"
- "sub $0x18,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)), // %3
- "r"(_shuf01), // %4
- "r"(_shuf11), // %5
- "r"(_shuf21), // %6
- "r"(_madd01), // %7
- "r"(_madd11), // %8
- "r"(_round34), // %9
- "r"(_madd21) // %10
- : "memory", "cc", "xmm6", "xmm7", "xmm8"
-);
-}
-
-#define HAS_SCALEROWDOWN38_SSSE3
-static void ScaleRowDown38_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "movdqa (%3),%%xmm4 \n"
- "movdqa (%4),%%xmm5 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa 0x10(%0),%%xmm1 \n"
- "lea 0x20(%0),%0 \n"
- "pshufb %%xmm4,%%xmm0 \n"
- "pshufb %%xmm5,%%xmm1 \n"
- "paddusb %%xmm1,%%xmm0 \n"
- "movq %%xmm0,(%1) \n"
- "movhlps %%xmm0,%%xmm1 \n"
- "movd %%xmm1,0x8(%1) \n"
- "lea 0xc(%1),%1 \n"
- "sub $0xc,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"(_shuf38a), // %3
- "r"(_shuf38b) // %4
- : "memory", "cc"
-);
-}
-
-static void ScaleRowDown38_3_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "movdqa (%4),%%xmm4 \n"
- "movdqa (%5),%%xmm5 \n"
- "movdqa (%6),%%xmm6 \n"
- "pxor %%xmm7,%%xmm7 \n"
-"1:"
- "movdqa (%0),%%xmm0 \n"
- "movdqa (%0,%3,1),%%xmm2 \n"
- "movhlps %%xmm0,%%xmm1 \n"
- "movhlps %%xmm2,%%xmm3 \n"
- "punpcklbw %%xmm7,%%xmm0 \n"
- "punpcklbw %%xmm7,%%xmm1 \n"
- "punpcklbw %%xmm7,%%xmm2 \n"
- "punpcklbw %%xmm7,%%xmm3 \n"
- "paddusw %%xmm2,%%xmm0 \n"
- "paddusw %%xmm3,%%xmm1 \n"
- "movdqa (%0,%3,2),%%xmm2 \n"
- "lea 0x10(%0),%0 \n"
- "movhlps %%xmm2,%%xmm3 \n"
- "punpcklbw %%xmm7,%%xmm2 \n"
- "punpcklbw %%xmm7,%%xmm3 \n"
- "paddusw %%xmm2,%%xmm0 \n"
- "paddusw %%xmm3,%%xmm1 \n"
- "movdqa %%xmm0,%%xmm2 \n"
- "psrldq $0x2,%%xmm0 \n"
- "paddusw %%xmm0,%%xmm2 \n"
- "psrldq $0x2,%%xmm0 \n"
- "paddusw %%xmm0,%%xmm2 \n"
- "pshufb %%xmm4,%%xmm2 \n"
- "movdqa %%xmm1,%%xmm3 \n"
- "psrldq $0x2,%%xmm1 \n"
- "paddusw %%xmm1,%%xmm3 \n"
- "psrldq $0x2,%%xmm1 \n"
- "paddusw %%xmm1,%%xmm3 \n"
- "pshufb %%xmm5,%%xmm3 \n"
- "paddusw %%xmm3,%%xmm2 \n"
- "pmulhuw %%xmm6,%%xmm2 \n"
- "packuswb %%xmm2,%%xmm2 \n"
- "movd %%xmm2,(%1) \n"
- "pextrw $0x2,%%xmm2,%%eax \n"
- "mov %%ax,0x4(%1) \n"
- "lea 0x6(%1),%1 \n"
- "sub $0x6,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)), // %3
- "r"(_shufac0), // %4
- "r"(_shufac3), // %5
- "r"(_scaleac3) // %6
- : "memory", "cc", "rax", "xmm6", "xmm7"
-);
-}
-
-static void ScaleRowDown38_2_Int_SSSE3(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- asm volatile (
- "movdqa (%4),%%xmm4 \n"
- "movdqa (%5),%%xmm5 \n"
- "movdqa (%6),%%xmm6 \n"
- "movdqa (%7),%%xmm7 \n"
-"1:"
- "movdqa (%0),%%xmm2 \n"
- "pavgb (%0,%3,1),%%xmm2 \n"
- "lea 0x10(%0),%0 \n"
- "movdqa %%xmm2,%%xmm0 \n"
- "pshufb %%xmm4,%%xmm0 \n"
- "movdqa %%xmm2,%%xmm1 \n"
- "pshufb %%xmm5,%%xmm1 \n"
- "paddusw %%xmm1,%%xmm0 \n"
- "pshufb %%xmm6,%%xmm2 \n"
- "paddusw %%xmm2,%%xmm0 \n"
- "pmulhuw %%xmm7,%%xmm0 \n"
- "packuswb %%xmm0,%%xmm0 \n"
- "movd %%xmm0,(%1) \n"
- "pextrw $0x2,%%xmm0,%%eax \n"
- "mov %%ax,0x4(%1) \n"
- "lea 0x6(%1),%1 \n"
- "sub $0x6,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)), // %3
- "r"(_shufab0), // %4
- "r"(_shufab1), // %5
- "r"(_shufab2), // %6
- "r"(_scaleab2) // %7
- : "memory", "cc", "rax", "xmm6", "xmm7"
-);
-}
-
-#define HAS_SCALEADDROWS_SSE2
-static void ScaleAddRows_SSE2(const uint8* src_ptr, int src_stride,
- uint16* dst_ptr, int src_width,
- int src_height) {
- asm volatile (
- "pxor %%xmm5,%%xmm5 \n"
-"1:"
- "movdqa (%0),%%xmm2 \n"
- "lea (%0,%4,1),%%r10 \n"
- "movhlps %%xmm2,%%xmm3 \n"
- "lea -0x1(%3),%%r11 \n"
- "punpcklbw %%xmm5,%%xmm2 \n"
- "punpcklbw %%xmm5,%%xmm3 \n"
-
-"2:"
- "movdqa (%%r10),%%xmm0 \n"
- "lea (%%r10,%4,1),%%r10 \n"
- "movhlps %%xmm0,%%xmm1 \n"
- "punpcklbw %%xmm5,%%xmm0 \n"
- "punpcklbw %%xmm5,%%xmm1 \n"
- "paddusw %%xmm0,%%xmm2 \n"
- "paddusw %%xmm1,%%xmm3 \n"
- "sub $0x1,%%r11 \n"
- "ja 2b \n"
-
- "movdqa %%xmm2,(%1) \n"
- "movdqa %%xmm3,0x10(%1) \n"
- "lea 0x20(%1),%1 \n"
- "lea 0x10(%0),%0 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- : "+r"(src_ptr), // %0
- "+r"(dst_ptr), // %1
- "+r"(src_width), // %2
- "+r"(src_height) // %3
- : "r"((intptr_t)(src_stride)) // %4
- : "memory", "cc", "r10", "r11"
-);
-}
-
-// Bilinear row filtering combines 16x2 -> 16x1. SSE2 version
-#define HAS_SCALEFILTERROWS_SSE2
-static void ScaleFilterRows_SSE2(uint8* dst_ptr,
- const uint8* src_ptr, int src_stride,
- int dst_width, int source_y_fraction) {
- if (source_y_fraction == 0) {
- asm volatile (
- "1:"
- "movdqa (%1),%%xmm0 \n"
- "lea 0x10(%1),%1 \n"
- "movdqa %%xmm0,(%0) \n"
- "lea 0x10(%0),%0 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- "mov -0x1(%0),%%al \n"
- "mov %%al,(%0) \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_width) // %2
- :
- : "memory", "cc", "rax"
- );
- return;
- } else if (source_y_fraction == 128) {
- asm volatile (
- "1:"
- "movdqa (%1),%%xmm0 \n"
- "movdqa (%1,%3,1),%%xmm2 \n"
- "lea 0x10(%1),%1 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "movdqa %%xmm0,(%0) \n"
- "lea 0x10(%0),%0 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- "mov -0x1(%0),%%al \n"
- "mov %%al,(%0) \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)) // %3
- : "memory", "cc", "rax"
- );
- return;
- } else {
- asm volatile (
- "mov %3,%%eax \n"
- "movd %%eax,%%xmm6 \n"
- "punpcklwd %%xmm6,%%xmm6 \n"
- "pshufd $0x0,%%xmm6,%%xmm6 \n"
- "neg %%eax \n"
- "add $0x100,%%eax \n"
- "movd %%eax,%%xmm5 \n"
- "punpcklwd %%xmm5,%%xmm5 \n"
- "pshufd $0x0,%%xmm5,%%xmm5 \n"
- "pxor %%xmm7,%%xmm7 \n"
- "1:"
- "movdqa (%1),%%xmm0 \n"
- "movdqa (%1,%4,1),%%xmm2 \n"
- "lea 0x10(%1),%1 \n"
- "movdqa %%xmm0,%%xmm1 \n"
- "movdqa %%xmm2,%%xmm3 \n"
- "punpcklbw %%xmm7,%%xmm0 \n"
- "punpcklbw %%xmm7,%%xmm2 \n"
- "punpckhbw %%xmm7,%%xmm1 \n"
- "punpckhbw %%xmm7,%%xmm3 \n"
- "pmullw %%xmm5,%%xmm0 \n"
- "pmullw %%xmm5,%%xmm1 \n"
- "pmullw %%xmm6,%%xmm2 \n"
- "pmullw %%xmm6,%%xmm3 \n"
- "paddusw %%xmm2,%%xmm0 \n"
- "paddusw %%xmm3,%%xmm1 \n"
- "psrlw $0x8,%%xmm0 \n"
- "psrlw $0x8,%%xmm1 \n"
- "packuswb %%xmm1,%%xmm0 \n"
- "movdqa %%xmm0,(%0) \n"
- "lea 0x10(%0),%0 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- "mov -0x1(%0),%%al \n"
- "mov %%al,(%0) \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_width), // %2
- "+r"(source_y_fraction) // %3
- : "r"((intptr_t)(src_stride)) // %4
- : "memory", "cc", "rax", "xmm6", "xmm7"
- );
- }
- return;
-}
-
-// Bilinear row filtering combines 16x2 -> 16x1. SSSE3 version
-#define HAS_SCALEFILTERROWS_SSSE3
-static void ScaleFilterRows_SSSE3(uint8* dst_ptr,
- const uint8* src_ptr, int src_stride,
- int dst_width, int source_y_fraction) {
- source_y_fraction >>= 1;
- if (source_y_fraction == 0) {
- asm volatile (
- "1:"
- "movdqa (%1),%%xmm0 \n"
- "lea 0x10(%1),%1 \n"
- "movdqa %%xmm0,(%0) \n"
- "lea 0x10(%0),%0 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- "mov -0x1(%0),%%al \n"
- "mov %%al,(%0) \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_width) // %2
- :
- : "memory", "cc", "rax"
- );
- return;
- } else if (source_y_fraction == 64) {
- asm volatile (
- "1:"
- "movdqa (%1),%%xmm0 \n"
- "movdqa (%1,%3,1),%%xmm2 \n"
- "lea 0x10(%1),%1 \n"
- "pavgb %%xmm2,%%xmm0 \n"
- "movdqa %%xmm0,(%0) \n"
- "lea 0x10(%0),%0 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- "mov -0x1(%0),%%al \n"
- "mov %%al,(%0) \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_width) // %2
- : "r"((intptr_t)(src_stride)) // %3
- : "memory", "cc", "rax"
- );
- return;
- } else {
- asm volatile (
- "mov %3,%%eax \n"
- "mov %%al,%%ah \n"
- "neg %%al \n"
- "add $0x80,%%al \n"
- "movd %%eax,%%xmm5 \n"
- "punpcklwd %%xmm5,%%xmm5 \n"
- "pshufd $0x0,%%xmm5,%%xmm5 \n"
- "1:"
- "movdqa (%1),%%xmm0 \n"
- "movdqa (%1,%4,1),%%xmm2 \n"
- "lea 0x10(%1),%1 \n"
- "movdqa %%xmm0,%%xmm1 \n"
- "punpcklbw %%xmm2,%%xmm0 \n"
- "punpckhbw %%xmm2,%%xmm1 \n"
- "pmaddubsw %%xmm5,%%xmm0 \n"
- "pmaddubsw %%xmm5,%%xmm1 \n"
- "psrlw $0x7,%%xmm0 \n"
- "psrlw $0x7,%%xmm1 \n"
- "packuswb %%xmm1,%%xmm0 \n"
- "movdqa %%xmm0,(%0) \n"
- "lea 0x10(%0),%0 \n"
- "sub $0x10,%2 \n"
- "ja 1b \n"
- "mov -0x1(%0),%%al \n"
- "mov %%al,(%0) \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_width), // %2
- "+r"(source_y_fraction) // %3
- : "r"((intptr_t)(src_stride)) // %4
- : "memory", "cc", "rax"
- );
- }
- return;
-}
-#endif
-#endif
-
-// CPU agnostic row functions
-static void ScaleRowDown2_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- int x;
- for (x = 0; x < dst_width; ++x) {
- *dst++ = *src_ptr;
- src_ptr += 2;
- }
-}
-
-static void ScaleRowDown2Int_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- int x;
- for (x = 0; x < dst_width; ++x) {
- *dst++ = (src_ptr[0] + src_ptr[1] +
- src_ptr[src_stride] + src_ptr[src_stride + 1] + 2) >> 2;
- src_ptr += 2;
- }
-}
-
-static void ScaleRowDown4_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- int x;
- for (x = 0; x < dst_width; ++x) {
- *dst++ = *src_ptr;
- src_ptr += 4;
- }
-}
-
-static void ScaleRowDown4Int_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- int x;
- for (x = 0; x < dst_width; ++x) {
- *dst++ = (src_ptr[0] + src_ptr[1] + src_ptr[2] + src_ptr[3] +
- src_ptr[src_stride + 0] + src_ptr[src_stride + 1] +
- src_ptr[src_stride + 2] + src_ptr[src_stride + 3] +
- src_ptr[src_stride * 2 + 0] + src_ptr[src_stride * 2 + 1] +
- src_ptr[src_stride * 2 + 2] + src_ptr[src_stride * 2 + 3] +
- src_ptr[src_stride * 3 + 0] + src_ptr[src_stride * 3 + 1] +
- src_ptr[src_stride * 3 + 2] + src_ptr[src_stride * 3 + 3] +
- 8) >> 4;
- src_ptr += 4;
- }
-}
-
-// 640 output pixels is enough to allow 5120 input pixels with 1/8 scale down.
-// Keeping the total buffer under 4096 bytes avoids a stackcheck, saving 4% cpu.
-// The following 2 lines cause error on Windows.
-//static const int kMaxOutputWidth = 640;
-//static const int kMaxRow12 = 1280; //kMaxOutputWidth * 2;
-#define kMaxOutputWidth 640
-#define kMaxRow12 1280
-
-static void ScaleRowDown8_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- int x;
- for (x = 0; x < dst_width; ++x) {
- *dst++ = *src_ptr;
- src_ptr += 8;
- }
-}
-
-// Note calling code checks width is less than max and if not
-// uses ScaleRowDown8_C instead.
-static void ScaleRowDown8Int_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- ALIGN16(uint8 src_row[kMaxRow12 * 2]);
- assert(dst_width <= kMaxOutputWidth);
- ScaleRowDown4Int_C(src_ptr, src_stride, src_row, dst_width * 2);
- ScaleRowDown4Int_C(src_ptr + src_stride * 4, src_stride,
- src_row + kMaxOutputWidth,
- dst_width * 2);
- ScaleRowDown2Int_C(src_row, kMaxOutputWidth, dst, dst_width);
-}
-
-static void ScaleRowDown34_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- uint8* dend;
- assert((dst_width % 3 == 0) && (dst_width > 0));
- dend = dst + dst_width;
- do {
- dst[0] = src_ptr[0];
- dst[1] = src_ptr[1];
- dst[2] = src_ptr[3];
- dst += 3;
- src_ptr += 4;
- } while (dst < dend);
-}
-
-// Filter rows 0 and 1 together, 3 : 1
-static void ScaleRowDown34_0_Int_C(const uint8* src_ptr, int src_stride,
- uint8* d, int dst_width) {
- uint8* dend;
- const uint8* s;
- const uint8* t;
- assert((dst_width % 3 == 0) && (dst_width > 0));
- dend = d + dst_width;
- s = src_ptr;
- t = src_ptr + src_stride;
- do {
- uint8 a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
- uint8 a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
- uint8 a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
- uint8 b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
- uint8 b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
- uint8 b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
- d[0] = (a0 * 3 + b0 + 2) >> 2;
- d[1] = (a1 * 3 + b1 + 2) >> 2;
- d[2] = (a2 * 3 + b2 + 2) >> 2;
- d += 3;
- s += 4;
- t += 4;
- } while (d < dend);
-}
-
-// Filter rows 1 and 2 together, 1 : 1
-static void ScaleRowDown34_1_Int_C(const uint8* src_ptr, int src_stride,
- uint8* d, int dst_width) {
- uint8* dend;
- const uint8* s;
- const uint8* t;
- assert((dst_width % 3 == 0) && (dst_width > 0));
- dend = d + dst_width;
- s = src_ptr;
- t = src_ptr + src_stride;
- do {
- uint8 a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
- uint8 a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
- uint8 a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
- uint8 b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
- uint8 b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
- uint8 b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
- d[0] = (a0 + b0 + 1) >> 1;
- d[1] = (a1 + b1 + 1) >> 1;
- d[2] = (a2 + b2 + 1) >> 1;
- d += 3;
- s += 4;
- t += 4;
- } while (d < dend);
-}
-
-#if defined(HAS_SCALEFILTERROWS_SSE2)
-// Filter row to 3/4
-static void ScaleFilterCols34_C(uint8* dst_ptr, const uint8* src_ptr,
- int dst_width) {
- uint8* dend;
- const uint8* s;
- assert((dst_width % 3 == 0) && (dst_width > 0));
- dend = dst_ptr + dst_width;
- s = src_ptr;
- do {
- dst_ptr[0] = (s[0] * 3 + s[1] * 1 + 2) >> 2;
- dst_ptr[1] = (s[1] * 1 + s[2] * 1 + 1) >> 1;
- dst_ptr[2] = (s[2] * 1 + s[3] * 3 + 2) >> 2;
- dst_ptr += 3;
- s += 4;
- } while (dst_ptr < dend);
-}
-#endif
-
-static void ScaleFilterCols_C(uint8* dst_ptr, const uint8* src_ptr,
- int dst_width, int dx) {
- int x = 0;
- int j;
- for (j = 0; j < dst_width; ++j) {
- int xi = x >> 16;
- int xf1 = x & 0xffff;
- int xf0 = 65536 - xf1;
-
- *dst_ptr++ = (src_ptr[xi] * xf0 + src_ptr[xi + 1] * xf1) >> 16;
- x += dx;
- }
-}
-
-//Not work on Windows
-//static const int kMaxInputWidth = 2560;
-#define kMaxInputWidth 2560
-#if defined(HAS_SCALEFILTERROWS_SSE2)
-#define HAS_SCALEROWDOWN34_SSE2
-// Filter rows 0 and 1 together, 3 : 1
-static void ScaleRowDown34_0_Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- ALIGN16(uint8 row[kMaxInputWidth]);
- assert((dst_width % 3 == 0) && (dst_width > 0));
- ScaleFilterRows_SSE2(row, src_ptr, src_stride, dst_width * 4 / 3, 256 / 4);
- ScaleFilterCols34_C(dst_ptr, row, dst_width);
-}
-
-// Filter rows 1 and 2 together, 1 : 1
-static void ScaleRowDown34_1_Int_SSE2(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- ALIGN16(uint8 row[kMaxInputWidth]);
- assert((dst_width % 3 == 0) && (dst_width > 0));
- ScaleFilterRows_SSE2(row, src_ptr, src_stride, dst_width * 4 / 3, 256 / 2);
- ScaleFilterCols34_C(dst_ptr, row, dst_width);
-}
-#endif
-
-static void ScaleRowDown38_C(const uint8* src_ptr, int src_stride,
- uint8* dst, int dst_width) {
- int x;
- assert(dst_width % 3 == 0);
- for (x = 0; x < dst_width; x += 3) {
- dst[0] = src_ptr[0];
- dst[1] = src_ptr[3];
- dst[2] = src_ptr[6];
- dst += 3;
- src_ptr += 8;
- }
-}
-
-// 8x3 -> 3x1
-static void ScaleRowDown38_3_Int_C(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- int i;
- assert((dst_width % 3 == 0) && (dst_width > 0));
- for (i = 0; i < dst_width; i+=3) {
- dst_ptr[0] = (src_ptr[0] + src_ptr[1] + src_ptr[2] +
- src_ptr[src_stride + 0] + src_ptr[src_stride + 1] +
- src_ptr[src_stride + 2] + src_ptr[src_stride * 2 + 0] +
- src_ptr[src_stride * 2 + 1] + src_ptr[src_stride * 2 + 2]) *
- (65536 / 9) >> 16;
- dst_ptr[1] = (src_ptr[3] + src_ptr[4] + src_ptr[5] +
- src_ptr[src_stride + 3] + src_ptr[src_stride + 4] +
- src_ptr[src_stride + 5] + src_ptr[src_stride * 2 + 3] +
- src_ptr[src_stride * 2 + 4] + src_ptr[src_stride * 2 + 5]) *
- (65536 / 9) >> 16;
- dst_ptr[2] = (src_ptr[6] + src_ptr[7] +
- src_ptr[src_stride + 6] + src_ptr[src_stride + 7] +
- src_ptr[src_stride * 2 + 6] + src_ptr[src_stride * 2 + 7]) *
- (65536 / 6) >> 16;
- src_ptr += 8;
- dst_ptr += 3;
- }
-}
-
-// 8x2 -> 3x1
-static void ScaleRowDown38_2_Int_C(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width) {
- int i;
- assert((dst_width % 3 == 0) && (dst_width > 0));
- for (i = 0; i < dst_width; i+=3) {
- dst_ptr[0] = (src_ptr[0] + src_ptr[1] + src_ptr[2] +
- src_ptr[src_stride + 0] + src_ptr[src_stride + 1] +
- src_ptr[src_stride + 2]) * (65536 / 6) >> 16;
- dst_ptr[1] = (src_ptr[3] + src_ptr[4] + src_ptr[5] +
- src_ptr[src_stride + 3] + src_ptr[src_stride + 4] +
- src_ptr[src_stride + 5]) * (65536 / 6) >> 16;
- dst_ptr[2] = (src_ptr[6] + src_ptr[7] +
- src_ptr[src_stride + 6] + src_ptr[src_stride + 7]) *
- (65536 / 4) >> 16;
- src_ptr += 8;
- dst_ptr += 3;
- }
-}
-
-// C version 8x2 -> 8x1
-static void ScaleFilterRows_C(uint8* dst_ptr,
- const uint8* src_ptr, int src_stride,
- int dst_width, int source_y_fraction) {
- int y1_fraction;
- int y0_fraction;
- const uint8* src_ptr1;
- uint8* end;
- assert(dst_width > 0);
- y1_fraction = source_y_fraction;
- y0_fraction = 256 - y1_fraction;
- src_ptr1 = src_ptr + src_stride;
- end = dst_ptr + dst_width;
- do {
- dst_ptr[0] = (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction) >> 8;
- dst_ptr[1] = (src_ptr[1] * y0_fraction + src_ptr1[1] * y1_fraction) >> 8;
- dst_ptr[2] = (src_ptr[2] * y0_fraction + src_ptr1[2] * y1_fraction) >> 8;
- dst_ptr[3] = (src_ptr[3] * y0_fraction + src_ptr1[3] * y1_fraction) >> 8;
- dst_ptr[4] = (src_ptr[4] * y0_fraction + src_ptr1[4] * y1_fraction) >> 8;
- dst_ptr[5] = (src_ptr[5] * y0_fraction + src_ptr1[5] * y1_fraction) >> 8;
- dst_ptr[6] = (src_ptr[6] * y0_fraction + src_ptr1[6] * y1_fraction) >> 8;
- dst_ptr[7] = (src_ptr[7] * y0_fraction + src_ptr1[7] * y1_fraction) >> 8;
- src_ptr += 8;
- src_ptr1 += 8;
- dst_ptr += 8;
- } while (dst_ptr < end);
- dst_ptr[0] = dst_ptr[-1];
-}
-
-void ScaleAddRows_C(const uint8* src_ptr, int src_stride,
- uint16* dst_ptr, int src_width, int src_height) {
- int x,y;
- assert(src_width > 0);
- assert(src_height > 0);
- for (x = 0; x < src_width; ++x) {
- const uint8* s = src_ptr + x;
- int sum = 0;
- for (y = 0; y < src_height; ++y) {
- sum += s[0];
- s += src_stride;
- }
- dst_ptr[x] = sum;
- }
-}
-
-/**
- * Scale plane, 1/2
- *
- * This is an optimized version for scaling down a plane to 1/2 of
- * its original size.
- *
- */
-static void ScalePlaneDown2(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr,
- FilterMode filtering) {
- void (*ScaleRowDown2)(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- assert(IS_ALIGNED(src_width, 2));
- assert(IS_ALIGNED(src_height, 2));
-
-#if defined(HAS_SCALEROWDOWN2_NEON)
- if (TestCpuFlag(kCpuHasNEON) &&
- IS_ALIGNED(dst_width, 16)) {
- ScaleRowDown2 = filtering ? ScaleRowDown2Int_NEON : ScaleRowDown2_NEON;
- } else
-#endif
-#if defined(HAS_SCALEROWDOWN2_SSE2)
- if (TestCpuFlag(kCpuHasSSE2) &&
- IS_ALIGNED(dst_width, 16) &&
- IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(src_stride, 16) &&
- IS_ALIGNED(dst_ptr, 16) && IS_ALIGNED(dst_stride, 16)) {
- ScaleRowDown2 = filtering ? ScaleRowDown2Int_SSE2 : ScaleRowDown2_SSE2;
- } else
-#endif
- {
- ScaleRowDown2 = filtering ? ScaleRowDown2Int_C : ScaleRowDown2_C;
- }
-
- {
- int y;
- for (y = 0; y < dst_height; ++y) {
- ScaleRowDown2(src_ptr, src_stride, dst_ptr, dst_width);
- src_ptr += (src_stride << 1);
- dst_ptr += dst_stride;
- }
- }
-}
-
-/**
- * Scale plane, 1/4
- *
- * This is an optimized version for scaling down a plane to 1/4 of
- * its original size.
- */
-static void ScalePlaneDown4(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr,
- FilterMode filtering) {
- void (*ScaleRowDown4)(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- assert(IS_ALIGNED(src_width, 4));
- assert(IS_ALIGNED(src_height, 4));
-
-#if defined(HAS_SCALEROWDOWN4_NEON)
- if (TestCpuFlag(kCpuHasNEON) &&
- IS_ALIGNED(dst_width, 4)) {
- ScaleRowDown4 = filtering ? ScaleRowDown4Int_NEON : ScaleRowDown4_NEON;
- } else
-#endif
-#if defined(HAS_SCALEROWDOWN4_SSE2)
- if (TestCpuFlag(kCpuHasSSE2) &&
- IS_ALIGNED(dst_width, 8) &&
- IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(src_stride, 16) &&
- IS_ALIGNED(dst_ptr, 8) && IS_ALIGNED(dst_stride, 8)) {
- ScaleRowDown4 = filtering ? ScaleRowDown4Int_SSE2 : ScaleRowDown4_SSE2;
- } else
-#endif
- {
- ScaleRowDown4 = filtering ? ScaleRowDown4Int_C : ScaleRowDown4_C;
- }
-
- {
- int y;
- for (y = 0; y < dst_height; ++y) {
- ScaleRowDown4(src_ptr, src_stride, dst_ptr, dst_width);
- src_ptr += (src_stride << 2);
- dst_ptr += dst_stride;
- }
- }
-}
-
-/**
- * Scale plane, 1/8
- *
- * This is an optimized version for scaling down a plane to 1/8
- * of its original size.
- *
- */
-static void ScalePlaneDown8(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr,
- FilterMode filtering) {
- void (*ScaleRowDown8)(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- assert(IS_ALIGNED(src_width, 8));
- assert(IS_ALIGNED(src_height, 8));
-
-#if defined(HAS_SCALEROWDOWN8_SSE2)
- if (TestCpuFlag(kCpuHasSSE2) &&
- IS_ALIGNED(dst_width, 4) &&
- IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(src_stride, 16) &&
- IS_ALIGNED(dst_ptr, 4) && IS_ALIGNED(dst_stride, 4)) {
- ScaleRowDown8 = filtering ? ScaleRowDown8Int_SSE2 : ScaleRowDown8_SSE2;
- } else
-#endif
- {
- ScaleRowDown8 = filtering && (dst_width <= kMaxOutputWidth) ?
- ScaleRowDown8Int_C : ScaleRowDown8_C;
- }
-
- {
- int y;
- for (y = 0; y < dst_height; ++y) {
- ScaleRowDown8(src_ptr, src_stride, dst_ptr, dst_width);
- src_ptr += (src_stride << 3);
- dst_ptr += dst_stride;
- }
- }
-}
-
-/**
- * Scale plane down, 3/4
- *
- * Provided by Frank Barchard (fbarchard@google.com)
- *
- */
-static void ScalePlaneDown34(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr,
- FilterMode filtering) {
- void (*ScaleRowDown34_0)(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- void (*ScaleRowDown34_1)(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- assert(dst_width % 3 == 0);
-#if defined(HAS_SCALEROWDOWN34_NEON)
- if (TestCpuFlag(kCpuHasNEON) &&
- (dst_width % 24 == 0)) {
- if (!filtering) {
- ScaleRowDown34_0 = ScaleRowDown34_NEON;
- ScaleRowDown34_1 = ScaleRowDown34_NEON;
- } else {
- ScaleRowDown34_0 = ScaleRowDown34_0_Int_NEON;
- ScaleRowDown34_1 = ScaleRowDown34_1_Int_NEON;
- }
- } else
-#endif
-
-#if defined(HAS_SCALEROWDOWN34_SSSE3)
- if (TestCpuFlag(kCpuHasSSSE3) &&
- (dst_width % 24 == 0) &&
- IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(src_stride, 16) &&
- IS_ALIGNED(dst_ptr, 8) && IS_ALIGNED(dst_stride, 8)) {
- if (!filtering) {
- ScaleRowDown34_0 = ScaleRowDown34_SSSE3;
- ScaleRowDown34_1 = ScaleRowDown34_SSSE3;
- } else {
- ScaleRowDown34_0 = ScaleRowDown34_0_Int_SSSE3;
- ScaleRowDown34_1 = ScaleRowDown34_1_Int_SSSE3;
- }
- } else
-#endif
-#if defined(HAS_SCALEROWDOWN34_SSE2)
- if (TestCpuFlag(kCpuHasSSE2) &&
- (dst_width % 24 == 0) && IS_ALIGNED(src_stride, 16) &&
- IS_ALIGNED(dst_stride, 8) &&
- IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(dst_ptr, 8) &&
- filtering) {
- ScaleRowDown34_0 = ScaleRowDown34_0_Int_SSE2;
- ScaleRowDown34_1 = ScaleRowDown34_1_Int_SSE2;
- } else
-#endif
- {
- if (!filtering) {
- ScaleRowDown34_0 = ScaleRowDown34_C;
- ScaleRowDown34_1 = ScaleRowDown34_C;
- } else {
- ScaleRowDown34_0 = ScaleRowDown34_0_Int_C;
- ScaleRowDown34_1 = ScaleRowDown34_1_Int_C;
- }
- }
- {
- int src_row = 0;
- int y;
- for (y = 0; y < dst_height; ++y) {
- switch (src_row) {
- case 0:
- ScaleRowDown34_0(src_ptr, src_stride, dst_ptr, dst_width);
- break;
-
- case 1:
- ScaleRowDown34_1(src_ptr, src_stride, dst_ptr, dst_width);
- break;
-
- case 2:
- ScaleRowDown34_0(src_ptr + src_stride, -src_stride,
- dst_ptr, dst_width);
- break;
- }
- ++src_row;
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- if (src_row >= 3) {
- src_ptr += src_stride;
- src_row = 0;
- }
- }
-}
-}
-
-/**
- * Scale plane, 3/8
- *
- * This is an optimized version for scaling down a plane to 3/8
- * of its original size.
- *
- * Reduces 16x3 to 6x1
- */
-static void ScalePlaneDown38(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr,
- FilterMode filtering) {
- void (*ScaleRowDown38_3)(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- void (*ScaleRowDown38_2)(const uint8* src_ptr, int src_stride,
- uint8* dst_ptr, int dst_width);
- assert(dst_width % 3 == 0);
-#if defined(HAS_SCALEROWDOWN38_NEON)
- if (TestCpuFlag(kCpuHasNEON) &&
- (dst_width % 12 == 0)) {
- if (!filtering) {
- ScaleRowDown38_3 = ScaleRowDown38_NEON;
- ScaleRowDown38_2 = ScaleRowDown38_NEON;
- } else {
- ScaleRowDown38_3 = ScaleRowDown38_3_Int_NEON;
- ScaleRowDown38_2 = ScaleRowDown38_2_Int_NEON;
- }
- } else
-#endif
-
-#if defined(HAS_SCALEROWDOWN38_SSSE3)
- if (TestCpuFlag(kCpuHasSSSE3) &&
- (dst_width % 24 == 0) && IS_ALIGNED(src_stride, 16) &&
- IS_ALIGNED(dst_stride, 8) &&
- IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(dst_ptr, 8)) {
- if (!filtering) {
- ScaleRowDown38_3 = ScaleRowDown38_SSSE3;
- ScaleRowDown38_2 = ScaleRowDown38_SSSE3;
- } else {
- ScaleRowDown38_3 = ScaleRowDown38_3_Int_SSSE3;
- ScaleRowDown38_2 = ScaleRowDown38_2_Int_SSSE3;
- }
- } else
-#endif
- {
- if (!filtering) {
- ScaleRowDown38_3 = ScaleRowDown38_C;
- ScaleRowDown38_2 = ScaleRowDown38_C;
- } else {
- ScaleRowDown38_3 = ScaleRowDown38_3_Int_C;
- ScaleRowDown38_2 = ScaleRowDown38_2_Int_C;
- }
- }
- {
- int src_row = 0;
- int y;
- for (y = 0; y < dst_height; ++y) {
- switch (src_row) {
- case 0:
- case 1:
- ScaleRowDown38_3(src_ptr, src_stride, dst_ptr, dst_width);
- src_ptr += src_stride * 3;
- ++src_row;
- break;
-
- case 2:
- ScaleRowDown38_2(src_ptr, src_stride, dst_ptr, dst_width);
- src_ptr += src_stride * 2;
- src_row = 0;
- break;
- }
- dst_ptr += dst_stride;
- }
-}
-}
-
-__inline static uint32 SumBox(int iboxwidth, int iboxheight,
- int src_stride, const uint8* src_ptr) {
- int x, y;
- uint32 sum;
- assert(iboxwidth > 0);
- assert(iboxheight > 0);
- sum = 0u;
- for (y = 0; y < iboxheight; ++y) {
- for (x = 0; x < iboxwidth; ++x) {
- sum += src_ptr[x];
- }
- src_ptr += src_stride;
- }
- return sum;
-}
-
-static void ScalePlaneBoxRow(int dst_width, int boxheight,
- int dx, int src_stride,
- const uint8* src_ptr, uint8* dst_ptr) {
- int x = 0;
- int i;
- for (i = 0; i < dst_width; ++i) {
- int ix = x >> 16;
- int boxwidth;
- x += dx;
- boxwidth = (x >> 16) - ix;
- *dst_ptr++ = SumBox(boxwidth, boxheight, src_stride, src_ptr + ix) /
- (boxwidth * boxheight);
- }
-}
-
-__inline static uint32 SumPixels(int iboxwidth, const uint16* src_ptr) {
- uint32 sum;
- int x;
- assert(iboxwidth > 0);
- sum = 0u;
- for (x = 0; x < iboxwidth; ++x) {
- sum += src_ptr[x];
- }
- return sum;
-}
-
-static void ScaleAddCols2_C(int dst_width, int boxheight, int dx,
- const uint16* src_ptr, uint8* dst_ptr) {
- int scaletbl[2];
- int minboxwidth = (dx >> 16);
- scaletbl[0] = 65536 / (minboxwidth * boxheight);
- scaletbl[1] = 65536 / ((minboxwidth + 1) * boxheight);
- {
- int *scaleptr = scaletbl - minboxwidth;
- int x = 0;
- int i;
- for (i = 0; i < dst_width; ++i) {
- int ix = x >> 16;
- int boxwidth;
- x += dx;
- boxwidth = (x >> 16) - ix;
- *dst_ptr++ = SumPixels(boxwidth, src_ptr + ix) * scaleptr[boxwidth] >> 16;
- }
- }
-}
-
-static void ScaleAddCols1_C(int dst_width, int boxheight, int dx,
- const uint16* src_ptr, uint8* dst_ptr) {
- int boxwidth = (dx >> 16);
- int scaleval = 65536 / (boxwidth * boxheight);
- int x = 0;
- int i;
- for (i = 0; i < dst_width; ++i) {
- *dst_ptr++ = SumPixels(boxwidth, src_ptr + x) * scaleval >> 16;
- x += boxwidth;
- }
-}
-
-/**
- * Scale plane down to any dimensions, with interpolation.
- * (boxfilter).
- *
- * Same method as SimpleScale, which is fixed point, outputting
- * one pixel of destination using fixed point (16.16) to step
- * through source, sampling a box of pixel with simple
- * averaging.
- */
-static void ScalePlaneBox(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr) {
- int dx, dy;
- assert(dst_width > 0);
- assert(dst_height > 0);
- dy = (src_height << 16) / dst_height;
- dx = (src_width << 16) / dst_width;
- if (!IS_ALIGNED(src_width, 16) || (src_width > kMaxInputWidth) ||
- dst_height * 2 > src_height) {
- uint8* dst = dst_ptr;
- int dy = (src_height << 16) / dst_height;
- int dx = (src_width << 16) / dst_width;
- int y = 0;
- int j;
- for (j = 0; j < dst_height; ++j) {
- int iy = y >> 16;
- const uint8* const src = src_ptr + iy * src_stride;
- int boxheight;
- y += dy;
- if (y > (src_height << 16)) {
- y = (src_height << 16);
- }
- boxheight = (y >> 16) - iy;
- ScalePlaneBoxRow(dst_width, boxheight,
- dx, src_stride,
- src, dst);
-
- dst += dst_stride;
- }
- } else {
- ALIGN16(uint16 row[kMaxInputWidth]);
- void (*ScaleAddRows)(const uint8* src_ptr, int src_stride,
- uint16* dst_ptr, int src_width, int src_height);
- void (*ScaleAddCols)(int dst_width, int boxheight, int dx,
- const uint16* src_ptr, uint8* dst_ptr);
-#if defined(HAS_SCALEADDROWS_SSE2)
- if (TestCpuFlag(kCpuHasSSE2) &&
- IS_ALIGNED(src_stride, 16) && IS_ALIGNED(src_ptr, 16) &&
- IS_ALIGNED(src_width, 16)) {
- ScaleAddRows = ScaleAddRows_SSE2;
- } else
-#endif
- {
- ScaleAddRows = ScaleAddRows_C;
- }
- if (dx & 0xffff) {
- ScaleAddCols = ScaleAddCols2_C;
- } else {
- ScaleAddCols = ScaleAddCols1_C;
- }
-
- {
- int y = 0;
- int j;
- for (j = 0; j < dst_height; ++j) {
- int iy = y >> 16;
- const uint8* const src = src_ptr + iy * src_stride;
- int boxheight;
- y += dy;
- if (y > (src_height << 16)) {
- y = (src_height << 16);
- }
- boxheight = (y >> 16) - iy;
- ScaleAddRows(src, src_stride, row, src_width, boxheight);
- ScaleAddCols(dst_width, boxheight, dx, row, dst_ptr);
- dst_ptr += dst_stride;
- }
- }
- }
-}
-
-/**
- * Scale plane to/from any dimensions, with interpolation.
- */
-static void ScalePlaneBilinearSimple(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr) {
- int i, j;
- uint8* dst = dst_ptr;
- int dx = (src_width << 16) / dst_width;
- int dy = (src_height << 16) / dst_height;
- int maxx = ((src_width - 1) << 16) - 1;
- int maxy = ((src_height - 1) << 16) - 1;
- int y = (dst_height < src_height) ? 32768 :
- (src_height << 16) / dst_height - 32768;
- for (i = 0; i < dst_height; ++i) {
- int cy = (y < 0) ? 0 : y;
- int yi = cy >> 16;
- int yf = cy & 0xffff;
- const uint8* const src = src_ptr + yi * src_stride;
- int x = (dst_width < src_width) ? 32768 :
- (src_width << 16) / dst_width - 32768;
- for (j = 0; j < dst_width; ++j) {
- int cx = (x < 0) ? 0 : x;
- int xi = cx >> 16;
- int xf = cx & 0xffff;
- int r0 = (src[xi] * (65536 - xf) + src[xi + 1] * xf) >> 16;
- int r1 = (src[xi + src_stride] * (65536 - xf) +
- src[xi + src_stride + 1] * xf) >> 16;
- *dst++ = (r0 * (65536 - yf) + r1 * yf) >> 16;
- x += dx;
- if (x > maxx)
- x = maxx;
- }
- dst += dst_stride - dst_width;
- y += dy;
- if (y > maxy)
- y = maxy;
- }
-}
-
-/**
- * Scale plane to/from any dimensions, with bilinear
- * interpolation.
- */
-static void ScalePlaneBilinear(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr) {
- int dy;
- int dx;
- assert(dst_width > 0);
- assert(dst_height > 0);
- dy = (src_height << 16) / dst_height;
- dx = (src_width << 16) / dst_width;
- if (!IS_ALIGNED(src_width, 8) || (src_width > kMaxInputWidth)) {
- ScalePlaneBilinearSimple(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src_ptr, dst_ptr);
-
- } else {
- ALIGN16(uint8 row[kMaxInputWidth + 1]);
- void (*ScaleFilterRows)(uint8* dst_ptr, const uint8* src_ptr,
- int src_stride,
- int dst_width, int source_y_fraction);
- void (*ScaleFilterCols)(uint8* dst_ptr, const uint8* src_ptr,
- int dst_width, int dx);
-#if defined(HAS_SCALEFILTERROWS_SSSE3)
- if (TestCpuFlag(kCpuHasSSSE3) &&
- IS_ALIGNED(src_stride, 16) && IS_ALIGNED(src_ptr, 16) &&
- IS_ALIGNED(src_width, 16)) {
- ScaleFilterRows = ScaleFilterRows_SSSE3;
- } else
-#endif
-#if defined(HAS_SCALEFILTERROWS_SSE2)
- if (TestCpuFlag(kCpuHasSSE2) &&
- IS_ALIGNED(src_stride, 16) && IS_ALIGNED(src_ptr, 16) &&
- IS_ALIGNED(src_width, 16)) {
- ScaleFilterRows = ScaleFilterRows_SSE2;
- } else
-#endif
- {
- ScaleFilterRows = ScaleFilterRows_C;
- }
- ScaleFilterCols = ScaleFilterCols_C;
-
- {
- int y = 0;
- int maxy = ((src_height - 1) << 16) - 1; // max is filter of last 2 rows.
- int j;
- for (j = 0; j < dst_height; ++j) {
- int iy = y >> 16;
- int fy = (y >> 8) & 255;
- const uint8* const src = src_ptr + iy * src_stride;
- ScaleFilterRows(row, src, src_stride, src_width, fy);
- ScaleFilterCols(dst_ptr, row, dst_width, dx);
- dst_ptr += dst_stride;
- y += dy;
- if (y > maxy) {
- y = maxy;
- }
- }
- }
-}
-}
-
-/**
- * Scale plane to/from any dimensions, without interpolation.
- * Fixed point math is used for performance: The upper 16 bits
- * of x and dx is the integer part of the source position and
- * the lower 16 bits are the fixed decimal part.
- */
-static void ScalePlaneSimple(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr) {
- uint8* dst = dst_ptr;
- int dx = (src_width << 16) / dst_width;
- int y;
- for (y = 0; y < dst_height; ++y) {
- const uint8* const src = src_ptr + (y * src_height / dst_height) *
- src_stride;
- // TODO(fbarchard): Round X coordinate by setting x=0x8000.
- int x = 0;
- int i;
- for (i = 0; i < dst_width; ++i) {
- *dst++ = src[x >> 16];
- x += dx;
- }
- dst += dst_stride - dst_width;
- }
-}
-
-/**
- * Scale plane to/from any dimensions.
- */
-static void ScalePlaneAnySize(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr,
- FilterMode filtering) {
- if (!filtering) {
- ScalePlaneSimple(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src_ptr, dst_ptr);
- } else {
- // fall back to non-optimized version
- ScalePlaneBilinear(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src_ptr, dst_ptr);
- }
-}
-
-/**
- * Scale plane down, any size
- *
- * This is an optimized version for scaling down a plane to any size.
- * The current implementation is ~10 times faster compared to the
- * reference implementation for e.g. XGA->LowResPAL
- *
- */
-static void ScalePlaneDown(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr,
- FilterMode filtering) {
- if (!filtering) {
- ScalePlaneSimple(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src_ptr, dst_ptr);
- } else if (filtering == kFilterBilinear || src_height * 2 > dst_height) {
- // between 1/2x and 1x use bilinear
- ScalePlaneBilinear(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src_ptr, dst_ptr);
- } else {
- ScalePlaneBox(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src_ptr, dst_ptr);
- }
-}
-
-/**
- * Copy plane, no scaling
- *
- * This simply copies the given plane without scaling.
- * The current implementation is ~115 times faster
- * compared to the reference implementation.
- *
- */
-static void CopyPlane(int src_width, int src_height,
- int dst_width, int dst_height,
- int src_stride, int dst_stride,
- const uint8* src_ptr, uint8* dst_ptr) {
- if (src_stride == src_width && dst_stride == dst_width) {
- // All contiguous, so can use REALLY fast path.
- memcpy(dst_ptr, src_ptr, src_width * src_height);
- } else {
- // Not all contiguous; must copy scanlines individually
- const uint8* src = src_ptr;
- uint8* dst = dst_ptr;
- int i;
- for (i = 0; i < src_height; ++i) {
- memcpy(dst, src, src_width);
- dst += dst_stride;
- src += src_stride;
- }
- }
-}
-
-static void ScalePlane(const uint8* src, int src_stride,
- int src_width, int src_height,
- uint8* dst, int dst_stride,
- int dst_width, int dst_height,
- FilterMode filtering, int use_ref) {
- // Use specialized scales to improve performance for common resolutions.
- // For example, all the 1/2 scalings will use ScalePlaneDown2()
- if (dst_width == src_width && dst_height == src_height) {
- // Straight copy.
- CopyPlane(src_width, src_height, dst_width, dst_height, src_stride,
- dst_stride, src, dst);
- } else if (dst_width <= src_width && dst_height <= src_height) {
- // Scale down.
- if (use_ref) {
- // For testing, allow the optimized versions to be disabled.
- ScalePlaneDown(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- } else if (4 * dst_width == 3 * src_width &&
- 4 * dst_height == 3 * src_height) {
- // optimized, 3/4
- ScalePlaneDown34(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- } else if (2 * dst_width == src_width && 2 * dst_height == src_height) {
- // optimized, 1/2
- ScalePlaneDown2(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- // 3/8 rounded up for odd sized chroma height.
- } else if (8 * dst_width == 3 * src_width &&
- dst_height == ((src_height * 3 + 7) / 8)) {
- // optimized, 3/8
- ScalePlaneDown38(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- } else if (4 * dst_width == src_width && 4 * dst_height == src_height) {
- // optimized, 1/4
- ScalePlaneDown4(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- } else if (8 * dst_width == src_width && 8 * dst_height == src_height) {
- // optimized, 1/8
- ScalePlaneDown8(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- } else {
- // Arbitrary downsample
- ScalePlaneDown(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- }
- } else {
- // Arbitrary scale up and/or down.
- ScalePlaneAnySize(src_width, src_height, dst_width, dst_height,
- src_stride, dst_stride, src, dst, filtering);
- }
-}
-
-/**
- * Scale a plane.
- *
- * This function in turn calls a scaling function
- * suitable for handling the desired resolutions.
- *
- */
-
-int I420Scale(const uint8* src_y, int src_stride_y,
- const uint8* src_u, int src_stride_u,
- const uint8* src_v, int src_stride_v,
- int src_width, int src_height,
- uint8* dst_y, int dst_stride_y,
- uint8* dst_u, int dst_stride_u,
- uint8* dst_v, int dst_stride_v,
- int dst_width, int dst_height,
- FilterMode filtering) {
- if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
- !dst_y || !dst_u || !dst_v || dst_width <= 0 || dst_height <= 0) {
- return -1;
- }
- // Negative height means invert the image.
- if (src_height < 0) {
- int halfheight;
- src_height = -src_height;
- halfheight = (src_height + 1) >> 1;
- src_y = src_y + (src_height - 1) * src_stride_y;
- src_u = src_u + (halfheight - 1) * src_stride_u;
- src_v = src_v + (halfheight - 1) * src_stride_v;
- src_stride_y = -src_stride_y;
- src_stride_u = -src_stride_u;
- src_stride_v = -src_stride_v;
- }
- {
- int src_halfwidth = (src_width + 1) >> 1;
- int src_halfheight = (src_height + 1) >> 1;
- int dst_halfwidth = (dst_width + 1) >> 1;
- int dst_halfheight = (dst_height + 1) >> 1;
-
- ScalePlane(src_y, src_stride_y, src_width, src_height,
- dst_y, dst_stride_y, dst_width, dst_height,
- filtering, use_reference_impl_);
- ScalePlane(src_u, src_stride_u, src_halfwidth, src_halfheight,
- dst_u, dst_stride_u, dst_halfwidth, dst_halfheight,
- filtering, use_reference_impl_);
- ScalePlane(src_v, src_stride_v, src_halfwidth, src_halfheight,
- dst_v, dst_stride_v, dst_halfwidth, dst_halfheight,
- filtering, use_reference_impl_);
- }
- return 0;
-}
-
-// Deprecated api
-int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
- int src_stride_y, int src_stride_u, int src_stride_v,
- int src_width, int src_height,
- uint8* dst_y, uint8* dst_u, uint8* dst_v,
- int dst_stride_y, int dst_stride_u, int dst_stride_v,
- int dst_width, int dst_height,
- int interpolate) {
- if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
- !dst_y || !dst_u || !dst_v || dst_width <= 0 || dst_height <= 0) {
- return -1;
- }
- // Negative height means invert the image.
- if (src_height < 0) {
- int halfheight;
- src_height = -src_height;
- halfheight = (src_height + 1) >> 1;
- src_y = src_y + (src_height - 1) * src_stride_y;
- src_u = src_u + (halfheight - 1) * src_stride_u;
- src_v = src_v + (halfheight - 1) * src_stride_v;
- src_stride_y = -src_stride_y;
- src_stride_u = -src_stride_u;
- src_stride_v = -src_stride_v;
- }
- {
- int src_halfwidth = (src_width + 1) >> 1;
- int src_halfheight = (src_height + 1) >> 1;
- int dst_halfwidth = (dst_width + 1) >> 1;
- int dst_halfheight = (dst_height + 1) >> 1;
- FilterMode filtering = interpolate ? kFilterBox : kFilterNone;
-
- ScalePlane(src_y, src_stride_y, src_width, src_height,
- dst_y, dst_stride_y, dst_width, dst_height,
- filtering, use_reference_impl_);
- ScalePlane(src_u, src_stride_u, src_halfwidth, src_halfheight,
- dst_u, dst_stride_u, dst_halfwidth, dst_halfheight,
- filtering, use_reference_impl_);
- ScalePlane(src_v, src_stride_v, src_halfwidth, src_halfheight,
- dst_v, dst_stride_v, dst_halfwidth, dst_halfheight,
- filtering, use_reference_impl_);
- }
- return 0;
-}
-
-// Deprecated api
-int ScaleOffset(const uint8* src, int src_width, int src_height,
- uint8* dst, int dst_width, int dst_height, int dst_yoffset,
- int interpolate) {
- if (!src || src_width <= 0 || src_height <= 0 ||
- !dst || dst_width <= 0 || dst_height <= 0 || dst_yoffset < 0 ||
- dst_yoffset >= dst_height) {
- return -1;
- }
- dst_yoffset = dst_yoffset & ~1; // chroma requires offset to multiple of 2.
- {
- int src_halfwidth = (src_width + 1) >> 1;
- int src_halfheight = (src_height + 1) >> 1;
- int dst_halfwidth = (dst_width + 1) >> 1;
- int dst_halfheight = (dst_height + 1) >> 1;
- int aheight = dst_height - dst_yoffset * 2; // actual output height
- const uint8* const src_y = src;
- const uint8* const src_u = src + src_width * src_height;
- const uint8* const src_v = src + src_width * src_height +
- src_halfwidth * src_halfheight;
- uint8* dst_y = dst + dst_yoffset * dst_width;
- uint8* dst_u = dst + dst_width * dst_height +
- (dst_yoffset >> 1) * dst_halfwidth;
- uint8* dst_v = dst + dst_width * dst_height + dst_halfwidth * dst_halfheight +
- (dst_yoffset >> 1) * dst_halfwidth;
- return Scale(src_y, src_u, src_v, src_width, src_halfwidth, src_halfwidth,
- src_width, src_height, dst_y, dst_u, dst_v, dst_width,
- dst_halfwidth, dst_halfwidth, dst_width, aheight, interpolate);
- }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-} // namespace libyuv
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/0001-include-paths.diff b/videocodec/libvpx_internal/libvpx/third_party/nestegg/0001-include-paths.diff
deleted file mode 100644
index a704ebd..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/0001-include-paths.diff
+++ /dev/null
@@ -1,41 +0,0 @@
-diff --git a/nestegg/halloc/src/halloc.c b/nestegg/halloc/src/halloc.c
-index 5758fc0..837b3ff 100644
---- a/nestegg/halloc/src/halloc.c
-+++ b/nestegg/halloc/src/halloc.c
-@@ -15,7 +15,7 @@
- #include <stdlib.h> /* realloc */
- #include <string.h> /* memset & co */
-
--#include "halloc.h"
-+#include "third_party/nestegg/halloc/halloc.h"
- #include "align.h"
- #include "hlist.h"
-
-diff --git a/nestegg/include/nestegg/nestegg.h b/nestegg/include/nestegg/nestegg.h
-index ff13728..c18d1d3 100644
---- a/nestegg/include/nestegg/nestegg.h
-+++ b/nestegg/include/nestegg/nestegg.h
-@@ -7,7 +7,7 @@
- #if !defined(NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79)
- #define NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79
-
--#include <nestegg/nestegg-stdint.h>
-+#include "vpx/vpx_integer.h"
-
- #if defined(__cplusplus)
- extern "C" {
-diff --git a/nestegg/src/nestegg.c b/nestegg/src/nestegg.c
-index daf1eed..4fb10e7 100644
---- a/nestegg/src/nestegg.c
-+++ b/nestegg/src/nestegg.c
-@@ -8,8 +8,8 @@
- #include <stdlib.h>
- #include <string.h>
-
--#include "halloc.h"
--#include "nestegg/nestegg.h"
-+#include "third_party/nestegg/halloc/halloc.h"
-+#include "third_party/nestegg/include/nestegg/nestegg.h"
-
- /* EBML Elements */
- #define ID_EBML 0x1a45dfa3
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/0002-ne_read_simple-uninitialized_variable.diff b/videocodec/libvpx_internal/libvpx/third_party/nestegg/0002-ne_read_simple-uninitialized_variable.diff
deleted file mode 100644
index c3bc9e5..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/0002-ne_read_simple-uninitialized_variable.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/nestegg/src/nestegg.c b/nestegg/src/nestegg.c
-index 4fb10e7..b6bc460 100644
---- a/nestegg/src/nestegg.c
-+++ b/nestegg/src/nestegg.c
-@@ -934,7 +934,7 @@ static int
- ne_read_simple(nestegg * ctx, struct ebml_element_desc * desc, size_t length)
- {
- struct ebml_type * storage;
-- int r;
-+ int r = 0;
-
- storage = (struct ebml_type *) (ctx->ancestor->data + desc->offset);
-
-@@ -968,7 +968,6 @@ ne_read_simple(nestegg * ctx, struct ebml_element_desc * desc, size_t length)
- case TYPE_MASTER:
- case TYPE_UNKNOWN:
- assert(0);
-- r = 0;
- break;
- }
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/AUTHORS b/videocodec/libvpx_internal/libvpx/third_party/nestegg/AUTHORS
deleted file mode 100644
index 7d2c612..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-Matthew Gregan <kinetik@flim.org>
-Steve Workman <sjhworkman@gmail.com>
-Paul Adenot <paul@paul.cx>
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/INSTALL b/videocodec/libvpx_internal/libvpx/third_party/nestegg/INSTALL
deleted file mode 100644
index 401df41..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/INSTALL
+++ /dev/null
@@ -1,8 +0,0 @@
-Build instructions for libnestegg
-=================================
-
-0. Change directory into the source directory.
-1. Run |autoreconf --install| to generate configure.
-2. Run |./configure| to configure the build.
-3. Run |make| to build.
-4. Run |make check| to run the test suite.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/LICENSE b/videocodec/libvpx_internal/libvpx/third_party/nestegg/LICENSE
deleted file mode 100644
index a67984a..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright © 2010 Mozilla Foundation
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/README b/videocodec/libvpx_internal/libvpx/third_party/nestegg/README
deleted file mode 100644
index 47c8237..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/README
+++ /dev/null
@@ -1,6 +0,0 @@
-See INSTALL for build instructions.
-
-Licensed under an ISC-style license. See LICENSE for details.
-
-The source under the halloc/ directory is licensed under a BSD license. See
-halloc/halloc.h for details.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/README.webm b/videocodec/libvpx_internal/libvpx/third_party/nestegg/README.webm
deleted file mode 100644
index 8e3760b..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/README.webm
+++ /dev/null
@@ -1,24 +0,0 @@
-URL: https://github.com/kinetiknz/nestegg.git
-Version: f46223191d8116a36bf299b5b9793fcb798417b1
-License: ISC-style
-License File: LICENSE
-
-Description:
-The source under the halloc/ directory is licensed under a BSD license. See
-halloc/halloc.h for details.
-
-Local Modifications:
-- delete unnecessary docs and build files
-- nestegg/0001-include-paths.diff
- include path modifications for the libvpx build system
-- 0002-ne_read_simple-uninitialized_variable.diff
- fixes:
-nestegg.c|975 col 6| warning: ‘r’ may be used uninitialized in this function [-Wuninitialized]
-- add ne_get_uint32 convenience function
-- fix track_number uint64->uint32 warnings
-- fix track_scale double->uint64 warning
-- nestegg_packet_track: fix uint64->uint32 warning
-- ne_read_(string|binary|block): normalize size_t usage
-- ne_parse: normalize size_t usage
-- quiet read related uint64->size_t warnings
-- ne_buffer_read: quiet uint64->size_t warning
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/TODO b/videocodec/libvpx_internal/libvpx/third_party/nestegg/TODO
deleted file mode 100644
index bf0cb04..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/TODO
+++ /dev/null
@@ -1,21 +0,0 @@
-- Document when read, seek, tell callbacks are used.
-- Add an automated testsuite.
-- Test (and fix, if necessary) support for unknown sizes.
-- Test (and fix, if necessary) support for large files.
-- Read past unknown elements rather than seeking.
-- Try to handle unknown elements with unknown sizes.
-- Formalize handling of default element values.
-- Try to resynchronize stream when read_block fails so that failure to parse
- a single block can be treated as non-fatal.
-- Make logging more useful to API users.
-- Avoid reparsing Cues and ignore any SeekHead at end of file.
-- Optionally build a Cue index as Clusters are parsed.
-- Support seeking without Cues.
-- Avoid building a list of Clusters as they are parsed and retain only the
- last one parsed.
-- Add an asynchronous error code to struct nestegg and ensure that API calls
- continue to fail safely one a fatal error has been returned.
-- Modify parser/data structures to provide a clean separation. Perhaps the
- parser should return a generic tree of nodes that a second pass uses to
- initialize the main data structures.
-- Use pool allocator for all allocations.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/README b/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/README
deleted file mode 100644
index 380fba2..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/README
+++ /dev/null
@@ -1,45 +0,0 @@
-halloc 1.2.1
-============
-
- Hierarchical memory heap interface - an extension to standard
- malloc/free interface that simplifies tasks of memory disposal
- when allocated structures exhibit hierarchical properties.
-
- http://swapped.cc/halloc
-=
- To build libhalloc.a with GNU tools run
- make
-
- To install in /usr/include and /usr/lib
- make install
-
- To cleanup the build files
- make clean
-=
- halloc-1.2.1
- * fixed a double-free bug in _set_allocator() as per
- Matthew Gregan comments
-
- * switched to using NULL instead of 0 where applicable
-
- halloc-1.2.0
- * added missing <string.h> include to halloc.c
-
- * improved standard compliance thanks to the feedback
- received from Stan Tobias. Two things were fixed -
-
- - hblock_t structure no longer uses zero-sized 'data'
- array, which happened to be common, but non-standard
- extension;
-
- - secondly, added the code to test the behaviour of
- realloc(ptr, 0). Standard allows it NOT to act as
- free(), in which case halloc will use its own version
- of allocator calling free() when neccessary.
-
- halloc-1.1.0
- * initial public release (rewrite of hhmalloc library)
-
-=============================================================================
-Copyright (c) 2004-2010, Alex Pankratov (ap@swapped.cc). All rights reserved.
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/halloc.h b/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/halloc.h
deleted file mode 100644
index 10af4e8..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/halloc.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved.
- *
- * Hierarchical memory allocator, 1.2.1
- * http://swapped.cc/halloc
- */
-
-/*
- * The program is distributed under terms of BSD license.
- * You can obtain the copy of the license by visiting:
- *
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-#ifndef _LIBP_HALLOC_H_
-#define _LIBP_HALLOC_H_
-
-#include <stddef.h> /* size_t */
-
-/*
- * Core API
- */
-void * halloc (void * block, size_t len);
-void hattach(void * block, void * parent);
-
-/*
- * standard malloc/free api
- */
-void * h_malloc (size_t len);
-void * h_calloc (size_t n, size_t len);
-void * h_realloc(void * p, size_t len);
-void h_free (void * p);
-char * h_strdup (const char * str);
-
-/*
- * the underlying allocator
- */
-typedef void * (* realloc_t)(void * ptr, size_t len);
-
-extern realloc_t halloc_allocator;
-
-#endif
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/align.h b/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/align.h
deleted file mode 100644
index 4c6e183..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/align.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved.
- *
- * Hierarchical memory allocator, 1.2.1
- * http://swapped.cc/halloc
- */
-
-/*
- * The program is distributed under terms of BSD license.
- * You can obtain the copy of the license by visiting:
- *
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-#ifndef _LIBP_ALIGN_H_
-#define _LIBP_ALIGN_H_
-
-/*
- * a type with the most strict alignment requirements
- */
-union max_align
-{
- char c;
- short s;
- long l;
- int i;
- float f;
- double d;
- void * v;
- void (*q)(void);
-};
-
-typedef union max_align max_align_t;
-
-#endif
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/halloc.c b/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/halloc.c
deleted file mode 100644
index 8860d73..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/halloc.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2004i-2010 Alex Pankratov. All rights reserved.
- *
- * Hierarchical memory allocator, 1.2.1
- * http://swapped.cc/halloc
- */
-
-/*
- * The program is distributed under terms of BSD license.
- * You can obtain the copy of the license by visiting:
- *
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-#include <stdlib.h> /* realloc */
-#include <string.h> /* memset & co */
-
-#include "third_party/nestegg/halloc/halloc.h"
-#include "align.h"
-#include "hlist.h"
-
-/*
- * block control header
- */
-typedef struct hblock
-{
-#ifndef NDEBUG
-#define HH_MAGIC 0x20040518L
- long magic;
-#endif
- hlist_item_t siblings; /* 2 pointers */
- hlist_head_t children; /* 1 pointer */
- max_align_t data[1]; /* not allocated, see below */
-
-} hblock_t;
-
-#define sizeof_hblock offsetof(hblock_t, data)
-
-/*
- *
- */
-realloc_t halloc_allocator = NULL;
-
-#define allocator halloc_allocator
-
-/*
- * static methods
- */
-static void _set_allocator(void);
-static void * _realloc(void * ptr, size_t n);
-
-static int _relate(hblock_t * b, hblock_t * p);
-static void _free_children(hblock_t * p);
-
-/*
- * Core API
- */
-void * halloc(void * ptr, size_t len)
-{
- hblock_t * p;
-
- /* set up default allocator */
- if (! allocator)
- {
- _set_allocator();
- assert(allocator);
- }
-
- /* calloc */
- if (! ptr)
- {
- if (! len)
- return NULL;
-
- p = allocator(0, len + sizeof_hblock);
- if (! p)
- return NULL;
-#ifndef NDEBUG
- p->magic = HH_MAGIC;
-#endif
- hlist_init(&p->children);
- hlist_init_item(&p->siblings);
-
- return p->data;
- }
-
- p = structof(ptr, hblock_t, data);
- assert(p->magic == HH_MAGIC);
-
- /* realloc */
- if (len)
- {
- p = allocator(p, len + sizeof_hblock);
- if (! p)
- return NULL;
-
- hlist_relink(&p->siblings);
- hlist_relink_head(&p->children);
-
- return p->data;
- }
-
- /* free */
- _free_children(p);
- hlist_del(&p->siblings);
- allocator(p, 0);
-
- return NULL;
-}
-
-void hattach(void * block, void * parent)
-{
- hblock_t * b, * p;
-
- if (! block)
- {
- assert(! parent);
- return;
- }
-
- /* detach */
- b = structof(block, hblock_t, data);
- assert(b->magic == HH_MAGIC);
-
- hlist_del(&b->siblings);
-
- if (! parent)
- return;
-
- /* attach */
- p = structof(parent, hblock_t, data);
- assert(p->magic == HH_MAGIC);
-
- /* sanity checks */
- assert(b != p); /* trivial */
- assert(! _relate(p, b)); /* heavy ! */
-
- hlist_add(&p->children, &b->siblings);
-}
-
-/*
- * malloc/free api
- */
-void * h_malloc(size_t len)
-{
- return halloc(0, len);
-}
-
-void * h_calloc(size_t n, size_t len)
-{
- void * ptr = halloc(0, len*=n);
- return ptr ? memset(ptr, 0, len) : NULL;
-}
-
-void * h_realloc(void * ptr, size_t len)
-{
- return halloc(ptr, len);
-}
-
-void h_free(void * ptr)
-{
- halloc(ptr, 0);
-}
-
-char * h_strdup(const char * str)
-{
- size_t len = strlen(str);
- char * ptr = halloc(0, len + 1);
- return ptr ? (ptr[len] = 0, memcpy(ptr, str, len)) : NULL;
-}
-
-/*
- * static stuff
- */
-static void _set_allocator(void)
-{
- void * p;
- assert(! allocator);
-
- /*
- * the purpose of the test below is to check the behaviour
- * of realloc(ptr, 0), which is defined in the standard
- * as an implementation-specific. if it returns zero,
- * then it's equivalent to free(). it can however return
- * non-zero, in which case it cannot be used for freeing
- * memory blocks and we'll need to supply our own version
- *
- * Thanks to Stan Tobias for pointing this tricky part out.
- */
- allocator = realloc;
- if (! (p = malloc(1)))
- /* hmm */
- return;
-
- if ((p = realloc(p, 0)))
- {
- /* realloc cannot be used as free() */
- allocator = _realloc;
- free(p);
- }
-}
-
-static void * _realloc(void * ptr, size_t n)
-{
- /*
- * free'ing realloc()
- */
- if (n)
- return realloc(ptr, n);
- free(ptr);
- return NULL;
-}
-
-static int _relate(hblock_t * b, hblock_t * p)
-{
- hlist_item_t * i;
-
- if (!b || !p)
- return 0;
-
- /*
- * since there is no 'parent' pointer, which would've allowed
- * O(log(n)) upward traversal, the check must use O(n) downward
- * iteration of the entire hierarchy; and this can be VERY SLOW
- */
- hlist_for_each(i, &p->children)
- {
- hblock_t * q = structof(i, hblock_t, siblings);
- if (q == b || _relate(b, q))
- return 1;
- }
- return 0;
-}
-
-static void _free_children(hblock_t * p)
-{
- hlist_item_t * i, * tmp;
-
-#ifndef NDEBUG
- /*
- * this catches loops in hierarchy with almost zero
- * overhead (compared to _relate() running time)
- */
- assert(p && p->magic == HH_MAGIC);
- p->magic = 0;
-#endif
- hlist_for_each_safe(i, tmp, &p->children)
- {
- hblock_t * q = structof(i, hblock_t, siblings);
- _free_children(q);
- allocator(q, 0);
- }
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/hlist.h b/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/hlist.h
deleted file mode 100644
index 2791f78..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/hlist.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved.
- *
- * Hierarchical memory allocator, 1.2.1
- * http://swapped.cc/halloc
- */
-
-/*
- * The program is distributed under terms of BSD license.
- * You can obtain the copy of the license by visiting:
- *
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-#ifndef _LIBP_HLIST_H_
-#define _LIBP_HLIST_H_
-
-#include <assert.h>
-#include "macros.h" /* static_inline */
-
-/*
- * weak double-linked list w/ tail sentinel
- */
-typedef struct hlist_head hlist_head_t;
-typedef struct hlist_item hlist_item_t;
-
-/*
- *
- */
-struct hlist_head
-{
- hlist_item_t * next;
-};
-
-struct hlist_item
-{
- hlist_item_t * next;
- hlist_item_t ** prev;
-};
-
-/*
- * shared tail sentinel
- */
-struct hlist_item hlist_null;
-
-/*
- *
- */
-#define __hlist_init(h) { &hlist_null }
-#define __hlist_init_item(i) { &hlist_null, &(i).next }
-
-static_inline void hlist_init(hlist_head_t * h);
-static_inline void hlist_init_item(hlist_item_t * i);
-
-/* static_inline void hlist_purge(hlist_head_t * h); */
-
-/* static_inline bool_t hlist_empty(const hlist_head_t * h); */
-
-/* static_inline hlist_item_t * hlist_head(const hlist_head_t * h); */
-
-/* static_inline hlist_item_t * hlist_next(const hlist_item_t * i); */
-/* static_inline hlist_item_t * hlist_prev(const hlist_item_t * i,
- const hlist_head_t * h); */
-
-static_inline void hlist_add(hlist_head_t * h, hlist_item_t * i);
-
-/* static_inline void hlist_add_prev(hlist_item_t * l, hlist_item_t * i); */
-/* static_inline void hlist_add_next(hlist_item_t * l, hlist_item_t * i); */
-
-static_inline void hlist_del(hlist_item_t * i);
-
-static_inline void hlist_relink(hlist_item_t * i);
-static_inline void hlist_relink_head(hlist_head_t * h);
-
-#define hlist_for_each(i, h) \
- for (i = (h)->next; i != &hlist_null; i = i->next)
-
-#define hlist_for_each_safe(i, tmp, h) \
- for (i = (h)->next, tmp = i->next; \
- i!= &hlist_null; \
- i = tmp, tmp = i->next)
-
-/*
- * static
- */
-static_inline void hlist_init(hlist_head_t * h)
-{
- assert(h);
- h->next = &hlist_null;
-}
-
-static_inline void hlist_init_item(hlist_item_t * i)
-{
- assert(i);
- i->prev = &i->next;
- i->next = &hlist_null;
-}
-
-static_inline void hlist_add(hlist_head_t * h, hlist_item_t * i)
-{
- hlist_item_t * next;
- assert(h && i);
-
- next = i->next = h->next;
- next->prev = &i->next;
- h->next = i;
- i->prev = &h->next;
-}
-
-static_inline void hlist_del(hlist_item_t * i)
-{
- hlist_item_t * next;
- assert(i);
-
- next = i->next;
- next->prev = i->prev;
- *i->prev = next;
-
- hlist_init_item(i);
-}
-
-static_inline void hlist_relink(hlist_item_t * i)
-{
- assert(i);
- *i->prev = i;
- i->next->prev = &i->next;
-}
-
-static_inline void hlist_relink_head(hlist_head_t * h)
-{
- assert(h);
- h->next->prev = &h->next;
-}
-
-#endif
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/macros.h b/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/macros.h
deleted file mode 100644
index 1f84bc2..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/halloc/src/macros.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved.
- *
- * Hierarchical memory allocator, 1.2.1
- * http://swapped.cc/halloc
- */
-
-/*
- * The program is distributed under terms of BSD license.
- * You can obtain the copy of the license by visiting:
- *
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-#ifndef _LIBP_MACROS_H_
-#define _LIBP_MACROS_H_
-
-#include <stddef.h> /* offsetof */
-
-/*
- restore pointer to the structure by a pointer to its field
- */
-#define structof(p,t,f) ((t*)(- (ptrdiff_t) offsetof(t,f) + (char*)(p)))
-
-/*
- * redefine for the target compiler
- */
-#ifdef _WIN32
-#define static_inline static __inline
-#else
-#define static_inline static __inline__
-#endif
-
-
-#endif
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/include/nestegg/nestegg.h b/videocodec/libvpx_internal/libvpx/third_party/nestegg/include/nestegg/nestegg.h
deleted file mode 100644
index c18d1d3..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/include/nestegg/nestegg.h
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright © 2010 Mozilla Foundation
- *
- * This program is made available under an ISC-style license. See the
- * accompanying file LICENSE for details.
- */
-#if !defined(NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79)
-#define NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79
-
-#include "vpx/vpx_integer.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/** @mainpage
-
- @section intro Introduction
-
- This is the documentation for the <tt>libnestegg</tt> C API.
- <tt>libnestegg</tt> is a demultiplexing library for <a
- href="http://www.webmproject.org/code/specs/container/">WebM</a>
- media files.
-
- @section example Example code
-
- @code
- nestegg * demux_ctx;
- nestegg_init(&demux_ctx, io, NULL);
-
- nestegg_packet * pkt;
- while ((r = nestegg_read_packet(demux_ctx, &pkt)) > 0) {
- unsigned int track;
-
- nestegg_packet_track(pkt, &track);
-
- // This example decodes the first track only.
- if (track == 0) {
- unsigned int chunk, chunks;
-
- nestegg_packet_count(pkt, &chunks);
-
- // Decode each chunk of data.
- for (chunk = 0; chunk < chunks; ++chunk) {
- unsigned char * data;
- size_t data_size;
-
- nestegg_packet_data(pkt, chunk, &data, &data_size);
-
- example_codec_decode(codec_ctx, data, data_size);
- }
- }
-
- nestegg_free_packet(pkt);
- }
-
- nestegg_destroy(demux_ctx);
- @endcode
-*/
-
-
-/** @file
- The <tt>libnestegg</tt> C API. */
-
-#define NESTEGG_TRACK_VIDEO 0 /**< Track is of type video. */
-#define NESTEGG_TRACK_AUDIO 1 /**< Track is of type audio. */
-
-#define NESTEGG_CODEC_VP8 0 /**< Track uses Google On2 VP8 codec. */
-#define NESTEGG_CODEC_VORBIS 1 /**< Track uses Xiph Vorbis codec. */
-#define NESTEGG_CODEC_VP9 2 /**< Track uses Google On2 VP9 codec. */
-#define NESTEGG_CODEC_OPUS 3 /**< Track uses Xiph Opus codec. */
-
-#define NESTEGG_VIDEO_MONO 0 /**< Track is mono video. */
-#define NESTEGG_VIDEO_STEREO_LEFT_RIGHT 1 /**< Track is side-by-side stereo video. Left first. */
-#define NESTEGG_VIDEO_STEREO_BOTTOM_TOP 2 /**< Track is top-bottom stereo video. Right first. */
-#define NESTEGG_VIDEO_STEREO_TOP_BOTTOM 3 /**< Track is top-bottom stereo video. Left first. */
-#define NESTEGG_VIDEO_STEREO_RIGHT_LEFT 11 /**< Track is side-by-side stereo video. Right first. */
-
-#define NESTEGG_SEEK_SET 0 /**< Seek offset relative to beginning of stream. */
-#define NESTEGG_SEEK_CUR 1 /**< Seek offset relative to current position in stream. */
-#define NESTEGG_SEEK_END 2 /**< Seek offset relative to end of stream. */
-
-#define NESTEGG_LOG_DEBUG 1 /**< Debug level log message. */
-#define NESTEGG_LOG_INFO 10 /**< Informational level log message. */
-#define NESTEGG_LOG_WARNING 100 /**< Warning level log message. */
-#define NESTEGG_LOG_ERROR 1000 /**< Error level log message. */
-#define NESTEGG_LOG_CRITICAL 10000 /**< Critical level log message. */
-
-typedef struct nestegg nestegg; /**< Opaque handle referencing the stream state. */
-typedef struct nestegg_packet nestegg_packet; /**< Opaque handle referencing a packet of data. */
-
-/** User supplied IO context. */
-typedef struct {
- /** User supplied read callback.
- @param buffer Buffer to read data into.
- @param length Length of supplied buffer in bytes.
- @param userdata The #userdata supplied by the user.
- @retval 1 Read succeeded.
- @retval 0 End of stream.
- @retval -1 Error. */
- int (* read)(void * buffer, size_t length, void * userdata);
-
- /** User supplied seek callback.
- @param offset Offset within the stream to seek to.
- @param whence Seek direction. One of #NESTEGG_SEEK_SET,
- #NESTEGG_SEEK_CUR, or #NESTEGG_SEEK_END.
- @param userdata The #userdata supplied by the user.
- @retval 0 Seek succeeded.
- @retval -1 Error. */
- int (* seek)(int64_t offset, int whence, void * userdata);
-
- /** User supplied tell callback.
- @param userdata The #userdata supplied by the user.
- @returns Current position within the stream.
- @retval -1 Error. */
- int64_t (* tell)(void * userdata);
-
- /** User supplied pointer to be passed to the IO callbacks. */
- void * userdata;
-} nestegg_io;
-
-/** Parameters specific to a video track. */
-typedef struct {
- unsigned int stereo_mode; /**< Video mode. One of #NESTEGG_VIDEO_MONO,
- #NESTEGG_VIDEO_STEREO_LEFT_RIGHT,
- #NESTEGG_VIDEO_STEREO_BOTTOM_TOP, or
- #NESTEGG_VIDEO_STEREO_TOP_BOTTOM. */
- unsigned int width; /**< Width of the video frame in pixels. */
- unsigned int height; /**< Height of the video frame in pixels. */
- unsigned int display_width; /**< Display width of the video frame in pixels. */
- unsigned int display_height; /**< Display height of the video frame in pixels. */
- unsigned int crop_bottom; /**< Pixels to crop from the bottom of the frame. */
- unsigned int crop_top; /**< Pixels to crop from the top of the frame. */
- unsigned int crop_left; /**< Pixels to crop from the left of the frame. */
- unsigned int crop_right; /**< Pixels to crop from the right of the frame. */
-} nestegg_video_params;
-
-/** Parameters specific to an audio track. */
-typedef struct {
- double rate; /**< Sampling rate in Hz. */
- unsigned int channels; /**< Number of audio channels. */
- unsigned int depth; /**< Bits per sample. */
- uint64_t codec_delay; /**< Nanoseconds that must be discarded from the start. */
- uint64_t seek_preroll;/**< Nanoseconds that must be discarded after a seek. */
-} nestegg_audio_params;
-
-/** Logging callback function pointer. */
-typedef void (* nestegg_log)(nestegg * context, unsigned int severity, char const * format, ...);
-
-/** Initialize a nestegg context. During initialization the parser will
- read forward in the stream processing all elements until the first
- block of media is reached. All track metadata has been processed at this point.
- @param context Storage for the new nestegg context. @see nestegg_destroy
- @param io User supplied IO context.
- @param callback Optional logging callback function pointer. May be NULL.
- @param max_offset Optional maximum offset to be read. Set -1 to ignore.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_init(nestegg ** context, nestegg_io io, nestegg_log callback, int64_t max_offset);
-
-/** Destroy a nestegg context and free associated memory.
- @param context #nestegg context to be freed. @see nestegg_init */
-void nestegg_destroy(nestegg * context);
-
-/** Query the duration of the media stream in nanoseconds.
- @param context Stream context initialized by #nestegg_init.
- @param duration Storage for the queried duration.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_duration(nestegg * context, uint64_t * duration);
-
-/** Query the tstamp scale of the media stream in nanoseconds.
- Timecodes presented by nestegg have been scaled by this value
- before presentation to the caller.
- @param context Stream context initialized by #nestegg_init.
- @param scale Storage for the queried scale factor.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_tstamp_scale(nestegg * context, uint64_t * scale);
-
-/** Query the number of tracks in the media stream.
- @param context Stream context initialized by #nestegg_init.
- @param tracks Storage for the queried track count.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_track_count(nestegg * context, unsigned int * tracks);
-
-/** Query the start and end offset for a particular cluster.
- @param context Stream context initialized by #nestegg_init.
- @param cluster_num Zero-based cluster number; order they appear in cues.
- @param max_offset Optional maximum offset to be read. Set -1 to ignore.
- @param start_pos Starting offset of the cluster. -1 means non-existant.
- @param end_pos Starting offset of the cluster. -1 means non-existant or
- final cluster.
- @param tstamp Starting timestamp of the cluster.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_get_cue_point(nestegg * context, unsigned int cluster_num,
- int64_t max_offset, int64_t * start_pos,
- int64_t * end_pos, uint64_t * tstamp);
-
-/** Seek to @a offset. Stream will seek directly to offset.
- Should be used to seek to the start of a resync point, i.e. cluster; the
- parser will not be able to understand other offsets.
- @param context Stream context initialized by #nestegg_init.
- @param offset Absolute offset in bytes.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_offset_seek(nestegg * context, uint64_t offset);
-
-/** Seek @a track to @a tstamp. Stream seek will terminate at the earliest
- key point in the stream at or before @a tstamp. Other tracks in the
- stream will output packets with unspecified but nearby timestamps.
- @param context Stream context initialized by #nestegg_init.
- @param track Zero based track number.
- @param tstamp Absolute timestamp in nanoseconds.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_track_seek(nestegg * context, unsigned int track, uint64_t tstamp);
-
-/** Query the type specified by @a track.
- @param context Stream context initialized by #nestegg_init.
- @param track Zero based track number.
- @retval #NESTEGG_TRACK_VIDEO Track type is video.
- @retval #NESTEGG_TRACK_AUDIO Track type is audio.
- @retval -1 Error. */
-int nestegg_track_type(nestegg * context, unsigned int track);
-
-/** Query the codec ID specified by @a track.
- @param context Stream context initialized by #nestegg_init.
- @param track Zero based track number.
- @retval #NESTEGG_CODEC_VP8 Track codec is VP8.
- @retval #NESTEGG_CODEC_VORBIS Track codec is Vorbis.
- @retval -1 Error. */
-int nestegg_track_codec_id(nestegg * context, unsigned int track);
-
-/** Query the number of codec initialization chunks for @a track. Each
- chunk of data should be passed to the codec initialization functions in
- the order returned.
- @param context Stream context initialized by #nestegg_init.
- @param track Zero based track number.
- @param count Storage for the queried chunk count.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_track_codec_data_count(nestegg * context, unsigned int track,
- unsigned int * count);
-
-/** Get a pointer to chunk number @a item of codec initialization data for
- @a track.
- @param context Stream context initialized by #nestegg_init.
- @param track Zero based track number.
- @param item Zero based chunk item number.
- @param data Storage for the queried data pointer.
- The data is owned by the #nestegg context.
- @param length Storage for the queried data size.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_track_codec_data(nestegg * context, unsigned int track, unsigned int item,
- unsigned char ** data, size_t * length);
-
-/** Query the video parameters specified by @a track.
- @param context Stream context initialized by #nestegg_init.
- @param track Zero based track number.
- @param params Storage for the queried video parameters.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_track_video_params(nestegg * context, unsigned int track,
- nestegg_video_params * params);
-
-/** Query the audio parameters specified by @a track.
- @param context Stream context initialized by #nestegg_init.
- @param track Zero based track number.
- @param params Storage for the queried audio parameters.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_track_audio_params(nestegg * context, unsigned int track,
- nestegg_audio_params * params);
-
-/** Read a packet of media data. A packet consists of one or more chunks of
- data associated with a single track. nestegg_read_packet should be
- called in a loop while the return value is 1 to drive the stream parser
- forward. @see nestegg_free_packet
- @param context Context returned by #nestegg_init.
- @param packet Storage for the returned nestegg_packet.
- @retval 1 Additional packets may be read in subsequent calls.
- @retval 0 End of stream.
- @retval -1 Error. */
-int nestegg_read_packet(nestegg * context, nestegg_packet ** packet);
-
-/** Destroy a nestegg_packet and free associated memory.
- @param packet #nestegg_packet to be freed. @see nestegg_read_packet */
-void nestegg_free_packet(nestegg_packet * packet);
-
-/** Query the track number of @a packet.
- @param packet Packet initialized by #nestegg_read_packet.
- @param track Storage for the queried zero based track index.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_packet_track(nestegg_packet * packet, unsigned int * track);
-
-/** Query the time stamp in nanoseconds of @a packet.
- @param packet Packet initialized by #nestegg_read_packet.
- @param tstamp Storage for the queried timestamp in nanoseconds.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_packet_tstamp(nestegg_packet * packet, uint64_t * tstamp);
-
-/** Query the number of data chunks contained in @a packet.
- @param packet Packet initialized by #nestegg_read_packet.
- @param count Storage for the queried timestamp in nanoseconds.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_packet_count(nestegg_packet * packet, unsigned int * count);
-
-/** Get a pointer to chunk number @a item of packet data.
- @param packet Packet initialized by #nestegg_read_packet.
- @param item Zero based chunk item number.
- @param data Storage for the queried data pointer.
- The data is owned by the #nestegg_packet packet.
- @param length Storage for the queried data size.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_packet_data(nestegg_packet * packet, unsigned int item,
- unsigned char ** data, size_t * length);
-
-/** Returns discard_padding for given packet
- @param packet Packet initialized by #nestegg_read_packet.
- @param discard_padding pointer to store discard padding in.
- @retval 0 Success.
- @retval -1 Error. */
-int nestegg_packet_discard_padding(nestegg_packet * packet,
- int64_t * discard_padding);
-
-/** Query the presence of cues.
- @param context Stream context initialized by #nestegg_init.
- @retval 0 The media has no cues.
- @retval 1 The media has cues. */
-int nestegg_has_cues(nestegg * context);
-
-/**
- * Try to determine if the buffer looks like the beginning of a WebM file.
- *
- * @param buffer A buffer containing the beginning of a media file.
- * @param length The size of the buffer.
- * @retval 0 The file is not a WebM file.
- * @retval 1 The file is a WebM file. */
-int nestegg_sniff(unsigned char const * buffer, size_t length);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79 */
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/src/nestegg.c b/videocodec/libvpx_internal/libvpx/third_party/nestegg/src/nestegg.c
deleted file mode 100644
index c7e2b02..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/src/nestegg.c
+++ /dev/null
@@ -1,2323 +0,0 @@
-/*
- * Copyright © 2010 Mozilla Foundation
- *
- * This program is made available under an ISC-style license. See the
- * accompanying file LICENSE for details.
- */
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/nestegg/halloc/halloc.h"
-#include "third_party/nestegg/include/nestegg/nestegg.h"
-
-/* EBML Elements */
-#define ID_EBML 0x1a45dfa3
-#define ID_EBML_VERSION 0x4286
-#define ID_EBML_READ_VERSION 0x42f7
-#define ID_EBML_MAX_ID_LENGTH 0x42f2
-#define ID_EBML_MAX_SIZE_LENGTH 0x42f3
-#define ID_DOCTYPE 0x4282
-#define ID_DOCTYPE_VERSION 0x4287
-#define ID_DOCTYPE_READ_VERSION 0x4285
-
-/* Global Elements */
-#define ID_VOID 0xec
-#define ID_CRC32 0xbf
-
-/* WebM Elements */
-#define ID_SEGMENT 0x18538067
-
-/* Seek Head Elements */
-#define ID_SEEK_HEAD 0x114d9b74
-#define ID_SEEK 0x4dbb
-#define ID_SEEK_ID 0x53ab
-#define ID_SEEK_POSITION 0x53ac
-
-/* Info Elements */
-#define ID_INFO 0x1549a966
-#define ID_TIMECODE_SCALE 0x2ad7b1
-#define ID_DURATION 0x4489
-
-/* Cluster Elements */
-#define ID_CLUSTER 0x1f43b675
-#define ID_TIMECODE 0xe7
-#define ID_BLOCK_GROUP 0xa0
-#define ID_SIMPLE_BLOCK 0xa3
-
-/* BlockGroup Elements */
-#define ID_BLOCK 0xa1
-#define ID_BLOCK_DURATION 0x9b
-#define ID_REFERENCE_BLOCK 0xfb
-#define ID_DISCARD_PADDING 0x75a2
-
-/* Tracks Elements */
-#define ID_TRACKS 0x1654ae6b
-#define ID_TRACK_ENTRY 0xae
-#define ID_TRACK_NUMBER 0xd7
-#define ID_TRACK_UID 0x73c5
-#define ID_TRACK_TYPE 0x83
-#define ID_FLAG_ENABLED 0xb9
-#define ID_FLAG_DEFAULT 0x88
-#define ID_FLAG_LACING 0x9c
-#define ID_TRACK_TIMECODE_SCALE 0x23314f
-#define ID_LANGUAGE 0x22b59c
-#define ID_CODEC_ID 0x86
-#define ID_CODEC_PRIVATE 0x63a2
-#define ID_CODEC_DELAY 0x56aa
-#define ID_SEEK_PREROLL 0x56bb
-
-/* Video Elements */
-#define ID_VIDEO 0xe0
-#define ID_STEREO_MODE 0x53b8
-#define ID_PIXEL_WIDTH 0xb0
-#define ID_PIXEL_HEIGHT 0xba
-#define ID_PIXEL_CROP_BOTTOM 0x54aa
-#define ID_PIXEL_CROP_TOP 0x54bb
-#define ID_PIXEL_CROP_LEFT 0x54cc
-#define ID_PIXEL_CROP_RIGHT 0x54dd
-#define ID_DISPLAY_WIDTH 0x54b0
-#define ID_DISPLAY_HEIGHT 0x54ba
-
-/* Audio Elements */
-#define ID_AUDIO 0xe1
-#define ID_SAMPLING_FREQUENCY 0xb5
-#define ID_CHANNELS 0x9f
-#define ID_BIT_DEPTH 0x6264
-
-/* Cues Elements */
-#define ID_CUES 0x1c53bb6b
-#define ID_CUE_POINT 0xbb
-#define ID_CUE_TIME 0xb3
-#define ID_CUE_TRACK_POSITIONS 0xb7
-#define ID_CUE_TRACK 0xf7
-#define ID_CUE_CLUSTER_POSITION 0xf1
-#define ID_CUE_BLOCK_NUMBER 0x5378
-
-/* EBML Types */
-enum ebml_type_enum {
- TYPE_UNKNOWN,
- TYPE_MASTER,
- TYPE_UINT,
- TYPE_FLOAT,
- TYPE_INT,
- TYPE_STRING,
- TYPE_BINARY
-};
-
-#define LIMIT_STRING (1 << 20)
-#define LIMIT_BINARY (1 << 24)
-#define LIMIT_BLOCK (1 << 30)
-#define LIMIT_FRAME (1 << 28)
-
-/* Field Flags */
-#define DESC_FLAG_NONE 0
-#define DESC_FLAG_MULTI (1 << 0)
-#define DESC_FLAG_SUSPEND (1 << 1)
-#define DESC_FLAG_OFFSET (1 << 2)
-
-/* Block Header Flags */
-#define BLOCK_FLAGS_LACING 6
-
-/* Lacing Constants */
-#define LACING_NONE 0
-#define LACING_XIPH 1
-#define LACING_FIXED 2
-#define LACING_EBML 3
-
-/* Track Types */
-#define TRACK_TYPE_VIDEO 1
-#define TRACK_TYPE_AUDIO 2
-
-/* Track IDs */
-#define TRACK_ID_VP8 "V_VP8"
-#define TRACK_ID_VP9 "V_VP9"
-#define TRACK_ID_VORBIS "A_VORBIS"
-#define TRACK_ID_OPUS "A_OPUS"
-
-enum vint_mask {
- MASK_NONE,
- MASK_FIRST_BIT
-};
-
-struct ebml_binary {
- unsigned char * data;
- size_t length;
-};
-
-struct ebml_list_node {
- struct ebml_list_node * next;
- uint64_t id;
- void * data;
-};
-
-struct ebml_list {
- struct ebml_list_node * head;
- struct ebml_list_node * tail;
-};
-
-struct ebml_type {
- union ebml_value {
- uint64_t u;
- double f;
- int64_t i;
- char * s;
- struct ebml_binary b;
- } v;
- enum ebml_type_enum type;
- int read;
-};
-
-/* EBML Definitions */
-struct ebml {
- struct ebml_type ebml_version;
- struct ebml_type ebml_read_version;
- struct ebml_type ebml_max_id_length;
- struct ebml_type ebml_max_size_length;
- struct ebml_type doctype;
- struct ebml_type doctype_version;
- struct ebml_type doctype_read_version;
-};
-
-/* Matroksa Definitions */
-struct seek {
- struct ebml_type id;
- struct ebml_type position;
-};
-
-struct seek_head {
- struct ebml_list seek;
-};
-
-struct info {
- struct ebml_type timecode_scale;
- struct ebml_type duration;
-};
-
-struct block_group {
- struct ebml_type duration;
- struct ebml_type reference_block;
- struct ebml_type discard_padding;
-};
-
-struct cluster {
- struct ebml_type timecode;
- struct ebml_list block_group;
-};
-
-struct video {
- struct ebml_type stereo_mode;
- struct ebml_type pixel_width;
- struct ebml_type pixel_height;
- struct ebml_type pixel_crop_bottom;
- struct ebml_type pixel_crop_top;
- struct ebml_type pixel_crop_left;
- struct ebml_type pixel_crop_right;
- struct ebml_type display_width;
- struct ebml_type display_height;
-};
-
-struct audio {
- struct ebml_type sampling_frequency;
- struct ebml_type channels;
- struct ebml_type bit_depth;
-};
-
-struct track_entry {
- struct ebml_type number;
- struct ebml_type uid;
- struct ebml_type type;
- struct ebml_type flag_enabled;
- struct ebml_type flag_default;
- struct ebml_type flag_lacing;
- struct ebml_type track_timecode_scale;
- struct ebml_type language;
- struct ebml_type codec_id;
- struct ebml_type codec_private;
- struct ebml_type codec_delay;
- struct ebml_type seek_preroll;
- struct video video;
- struct audio audio;
-};
-
-struct tracks {
- struct ebml_list track_entry;
-};
-
-struct cue_track_positions {
- struct ebml_type track;
- struct ebml_type cluster_position;
- struct ebml_type block_number;
-};
-
-struct cue_point {
- struct ebml_type time;
- struct ebml_list cue_track_positions;
-};
-
-struct cues {
- struct ebml_list cue_point;
-};
-
-struct segment {
- struct ebml_list seek_head;
- struct info info;
- struct ebml_list cluster;
- struct tracks tracks;
- struct cues cues;
-};
-
-/* Misc. */
-struct pool_ctx {
- char dummy;
-};
-
-struct list_node {
- struct list_node * previous;
- struct ebml_element_desc * node;
- unsigned char * data;
-};
-
-struct saved_state {
- int64_t stream_offset;
- struct list_node * ancestor;
- uint64_t last_id;
- uint64_t last_size;
- int last_valid;
-};
-
-struct frame {
- unsigned char * data;
- size_t length;
- struct frame * next;
-};
-
-/* Public (opaque) Structures */
-struct nestegg {
- nestegg_io * io;
- nestegg_log log;
- struct pool_ctx * alloc_pool;
- uint64_t last_id;
- uint64_t last_size;
- int last_valid;
- struct list_node * ancestor;
- struct ebml ebml;
- struct segment segment;
- int64_t segment_offset;
- unsigned int track_count;
-};
-
-struct nestegg_packet {
- uint64_t track;
- uint64_t timecode;
- struct frame * frame;
- int64_t discard_padding;
-};
-
-/* Element Descriptor */
-struct ebml_element_desc {
- char const * name;
- uint64_t id;
- enum ebml_type_enum type;
- size_t offset;
- unsigned int flags;
- struct ebml_element_desc * children;
- size_t size;
- size_t data_offset;
-};
-
-#define E_FIELD(ID, TYPE, STRUCT, FIELD) \
- { #ID, ID, TYPE, offsetof(STRUCT, FIELD), DESC_FLAG_NONE, NULL, 0, 0 }
-#define E_MASTER(ID, TYPE, STRUCT, FIELD) \
- { #ID, ID, TYPE, offsetof(STRUCT, FIELD), DESC_FLAG_MULTI, ne_ ## FIELD ## _elements, \
- sizeof(struct FIELD), 0 }
-#define E_SINGLE_MASTER_O(ID, TYPE, STRUCT, FIELD) \
- { #ID, ID, TYPE, offsetof(STRUCT, FIELD), DESC_FLAG_OFFSET, ne_ ## FIELD ## _elements, 0, \
- offsetof(STRUCT, FIELD ## _offset) }
-#define E_SINGLE_MASTER(ID, TYPE, STRUCT, FIELD) \
- { #ID, ID, TYPE, offsetof(STRUCT, FIELD), DESC_FLAG_NONE, ne_ ## FIELD ## _elements, 0, 0 }
-#define E_SUSPEND(ID, TYPE) \
- { #ID, ID, TYPE, 0, DESC_FLAG_SUSPEND, NULL, 0, 0 }
-#define E_LAST \
- { NULL, 0, 0, 0, DESC_FLAG_NONE, NULL, 0, 0 }
-
-/* EBML Element Lists */
-static struct ebml_element_desc ne_ebml_elements[] = {
- E_FIELD(ID_EBML_VERSION, TYPE_UINT, struct ebml, ebml_version),
- E_FIELD(ID_EBML_READ_VERSION, TYPE_UINT, struct ebml, ebml_read_version),
- E_FIELD(ID_EBML_MAX_ID_LENGTH, TYPE_UINT, struct ebml, ebml_max_id_length),
- E_FIELD(ID_EBML_MAX_SIZE_LENGTH, TYPE_UINT, struct ebml, ebml_max_size_length),
- E_FIELD(ID_DOCTYPE, TYPE_STRING, struct ebml, doctype),
- E_FIELD(ID_DOCTYPE_VERSION, TYPE_UINT, struct ebml, doctype_version),
- E_FIELD(ID_DOCTYPE_READ_VERSION, TYPE_UINT, struct ebml, doctype_read_version),
- E_LAST
-};
-
-/* WebM Element Lists */
-static struct ebml_element_desc ne_seek_elements[] = {
- E_FIELD(ID_SEEK_ID, TYPE_BINARY, struct seek, id),
- E_FIELD(ID_SEEK_POSITION, TYPE_UINT, struct seek, position),
- E_LAST
-};
-
-static struct ebml_element_desc ne_seek_head_elements[] = {
- E_MASTER(ID_SEEK, TYPE_MASTER, struct seek_head, seek),
- E_LAST
-};
-
-static struct ebml_element_desc ne_info_elements[] = {
- E_FIELD(ID_TIMECODE_SCALE, TYPE_UINT, struct info, timecode_scale),
- E_FIELD(ID_DURATION, TYPE_FLOAT, struct info, duration),
- E_LAST
-};
-
-static struct ebml_element_desc ne_block_group_elements[] = {
- E_SUSPEND(ID_BLOCK, TYPE_BINARY),
- E_FIELD(ID_BLOCK_DURATION, TYPE_UINT, struct block_group, duration),
- E_FIELD(ID_REFERENCE_BLOCK, TYPE_INT, struct block_group, reference_block),
- E_FIELD(ID_DISCARD_PADDING, TYPE_INT, struct block_group, discard_padding),
- E_LAST
-};
-
-static struct ebml_element_desc ne_cluster_elements[] = {
- E_FIELD(ID_TIMECODE, TYPE_UINT, struct cluster, timecode),
- E_MASTER(ID_BLOCK_GROUP, TYPE_MASTER, struct cluster, block_group),
- E_SUSPEND(ID_SIMPLE_BLOCK, TYPE_BINARY),
- E_LAST
-};
-
-static struct ebml_element_desc ne_video_elements[] = {
- E_FIELD(ID_STEREO_MODE, TYPE_UINT, struct video, stereo_mode),
- E_FIELD(ID_PIXEL_WIDTH, TYPE_UINT, struct video, pixel_width),
- E_FIELD(ID_PIXEL_HEIGHT, TYPE_UINT, struct video, pixel_height),
- E_FIELD(ID_PIXEL_CROP_BOTTOM, TYPE_UINT, struct video, pixel_crop_bottom),
- E_FIELD(ID_PIXEL_CROP_TOP, TYPE_UINT, struct video, pixel_crop_top),
- E_FIELD(ID_PIXEL_CROP_LEFT, TYPE_UINT, struct video, pixel_crop_left),
- E_FIELD(ID_PIXEL_CROP_RIGHT, TYPE_UINT, struct video, pixel_crop_right),
- E_FIELD(ID_DISPLAY_WIDTH, TYPE_UINT, struct video, display_width),
- E_FIELD(ID_DISPLAY_HEIGHT, TYPE_UINT, struct video, display_height),
- E_LAST
-};
-
-static struct ebml_element_desc ne_audio_elements[] = {
- E_FIELD(ID_SAMPLING_FREQUENCY, TYPE_FLOAT, struct audio, sampling_frequency),
- E_FIELD(ID_CHANNELS, TYPE_UINT, struct audio, channels),
- E_FIELD(ID_BIT_DEPTH, TYPE_UINT, struct audio, bit_depth),
- E_LAST
-};
-
-static struct ebml_element_desc ne_track_entry_elements[] = {
- E_FIELD(ID_TRACK_NUMBER, TYPE_UINT, struct track_entry, number),
- E_FIELD(ID_TRACK_UID, TYPE_UINT, struct track_entry, uid),
- E_FIELD(ID_TRACK_TYPE, TYPE_UINT, struct track_entry, type),
- E_FIELD(ID_FLAG_ENABLED, TYPE_UINT, struct track_entry, flag_enabled),
- E_FIELD(ID_FLAG_DEFAULT, TYPE_UINT, struct track_entry, flag_default),
- E_FIELD(ID_FLAG_LACING, TYPE_UINT, struct track_entry, flag_lacing),
- E_FIELD(ID_TRACK_TIMECODE_SCALE, TYPE_FLOAT, struct track_entry, track_timecode_scale),
- E_FIELD(ID_LANGUAGE, TYPE_STRING, struct track_entry, language),
- E_FIELD(ID_CODEC_ID, TYPE_STRING, struct track_entry, codec_id),
- E_FIELD(ID_CODEC_PRIVATE, TYPE_BINARY, struct track_entry, codec_private),
- E_FIELD(ID_CODEC_DELAY, TYPE_UINT, struct track_entry, codec_delay),
- E_FIELD(ID_SEEK_PREROLL, TYPE_UINT, struct track_entry, seek_preroll),
- E_SINGLE_MASTER(ID_VIDEO, TYPE_MASTER, struct track_entry, video),
- E_SINGLE_MASTER(ID_AUDIO, TYPE_MASTER, struct track_entry, audio),
- E_LAST
-};
-
-static struct ebml_element_desc ne_tracks_elements[] = {
- E_MASTER(ID_TRACK_ENTRY, TYPE_MASTER, struct tracks, track_entry),
- E_LAST
-};
-
-static struct ebml_element_desc ne_cue_track_positions_elements[] = {
- E_FIELD(ID_CUE_TRACK, TYPE_UINT, struct cue_track_positions, track),
- E_FIELD(ID_CUE_CLUSTER_POSITION, TYPE_UINT, struct cue_track_positions, cluster_position),
- E_FIELD(ID_CUE_BLOCK_NUMBER, TYPE_UINT, struct cue_track_positions, block_number),
- E_LAST
-};
-
-static struct ebml_element_desc ne_cue_point_elements[] = {
- E_FIELD(ID_CUE_TIME, TYPE_UINT, struct cue_point, time),
- E_MASTER(ID_CUE_TRACK_POSITIONS, TYPE_MASTER, struct cue_point, cue_track_positions),
- E_LAST
-};
-
-static struct ebml_element_desc ne_cues_elements[] = {
- E_MASTER(ID_CUE_POINT, TYPE_MASTER, struct cues, cue_point),
- E_LAST
-};
-
-static struct ebml_element_desc ne_segment_elements[] = {
- E_MASTER(ID_SEEK_HEAD, TYPE_MASTER, struct segment, seek_head),
- E_SINGLE_MASTER(ID_INFO, TYPE_MASTER, struct segment, info),
- E_MASTER(ID_CLUSTER, TYPE_MASTER, struct segment, cluster),
- E_SINGLE_MASTER(ID_TRACKS, TYPE_MASTER, struct segment, tracks),
- E_SINGLE_MASTER(ID_CUES, TYPE_MASTER, struct segment, cues),
- E_LAST
-};
-
-static struct ebml_element_desc ne_top_level_elements[] = {
- E_SINGLE_MASTER(ID_EBML, TYPE_MASTER, nestegg, ebml),
- E_SINGLE_MASTER_O(ID_SEGMENT, TYPE_MASTER, nestegg, segment),
- E_LAST
-};
-
-#undef E_FIELD
-#undef E_MASTER
-#undef E_SINGLE_MASTER_O
-#undef E_SINGLE_MASTER
-#undef E_SUSPEND
-#undef E_LAST
-
-static struct pool_ctx *
-ne_pool_init(void)
-{
- struct pool_ctx * pool;
-
- pool = h_malloc(sizeof(*pool));
- if (!pool)
- abort();
- return pool;
-}
-
-static void
-ne_pool_destroy(struct pool_ctx * pool)
-{
- h_free(pool);
-}
-
-static void *
-ne_pool_alloc(size_t size, struct pool_ctx * pool)
-{
- void * p;
-
- p = h_malloc(size);
- if (!p)
- abort();
- hattach(p, pool);
- memset(p, 0, size);
- return p;
-}
-
-static void *
-ne_alloc(size_t size)
-{
- void * p;
-
- p = calloc(1, size);
- if (!p)
- abort();
- return p;
-}
-
-static int
-ne_io_read(nestegg_io * io, void * buffer, size_t length)
-{
- return io->read(buffer, length, io->userdata);
-}
-
-static int
-ne_io_seek(nestegg_io * io, int64_t offset, int whence)
-{
- return io->seek(offset, whence, io->userdata);
-}
-
-static int
-ne_io_read_skip(nestegg_io * io, size_t length)
-{
- size_t get;
- unsigned char buf[8192];
- int r = 1;
-
- while (length > 0) {
- get = length < sizeof(buf) ? length : sizeof(buf);
- r = ne_io_read(io, buf, get);
- if (r != 1)
- break;
- length -= get;
- }
-
- return r;
-}
-
-static int64_t
-ne_io_tell(nestegg_io * io)
-{
- return io->tell(io->userdata);
-}
-
-static int
-ne_bare_read_vint(nestegg_io * io, uint64_t * value, uint64_t * length, enum vint_mask maskflag)
-{
- int r;
- unsigned char b;
- size_t maxlen = 8;
- unsigned int count = 1, mask = 1 << 7;
-
- r = ne_io_read(io, &b, 1);
- if (r != 1)
- return r;
-
- while (count < maxlen) {
- if ((b & mask) != 0)
- break;
- mask >>= 1;
- count += 1;
- }
-
- if (length)
- *length = count;
- *value = b;
-
- if (maskflag == MASK_FIRST_BIT)
- *value = b & ~mask;
-
- while (--count) {
- r = ne_io_read(io, &b, 1);
- if (r != 1)
- return r;
- *value <<= 8;
- *value |= b;
- }
-
- return 1;
-}
-
-static int
-ne_read_id(nestegg_io * io, uint64_t * value, uint64_t * length)
-{
- return ne_bare_read_vint(io, value, length, MASK_NONE);
-}
-
-static int
-ne_read_vint(nestegg_io * io, uint64_t * value, uint64_t * length)
-{
- return ne_bare_read_vint(io, value, length, MASK_FIRST_BIT);
-}
-
-static int
-ne_read_svint(nestegg_io * io, int64_t * value, uint64_t * length)
-{
- int r;
- uint64_t uvalue;
- uint64_t ulength;
- int64_t svint_subtr[] = {
- 0x3f, 0x1fff,
- 0xfffff, 0x7ffffff,
- 0x3ffffffffLL, 0x1ffffffffffLL,
- 0xffffffffffffLL, 0x7fffffffffffffLL
- };
-
- r = ne_bare_read_vint(io, &uvalue, &ulength, MASK_FIRST_BIT);
- if (r != 1)
- return r;
- *value = uvalue - svint_subtr[ulength - 1];
- if (length)
- *length = ulength;
- return r;
-}
-
-static int
-ne_read_uint(nestegg_io * io, uint64_t * val, uint64_t length)
-{
- unsigned char b;
- int r;
-
- if (length == 0 || length > 8)
- return -1;
- r = ne_io_read(io, &b, 1);
- if (r != 1)
- return r;
- *val = b;
- while (--length) {
- r = ne_io_read(io, &b, 1);
- if (r != 1)
- return r;
- *val <<= 8;
- *val |= b;
- }
- return 1;
-}
-
-static int
-ne_read_int(nestegg_io * io, int64_t * val, uint64_t length)
-{
- int r;
- uint64_t uval, base;
-
- r = ne_read_uint(io, &uval, length);
- if (r != 1)
- return r;
-
- if (length < sizeof(int64_t)) {
- base = 1;
- base <<= length * 8 - 1;
- if (uval >= base) {
- base = 1;
- base <<= length * 8;
- } else {
- base = 0;
- }
- *val = uval - base;
- } else {
- *val = (int64_t) uval;
- }
-
- return 1;
-}
-
-static int
-ne_read_float(nestegg_io * io, double * val, uint64_t length)
-{
- union {
- uint64_t u;
- float f;
- double d;
- } value;
- int r;
-
- /* Length == 10 not implemented. */
- if (length != 4 && length != 8)
- return -1;
- r = ne_read_uint(io, &value.u, length);
- if (r != 1)
- return r;
- if (length == 4)
- *val = value.f;
- else
- *val = value.d;
- return 1;
-}
-
-static int
-ne_read_string(nestegg * ctx, char ** val, uint64_t length)
-{
- char * str;
- int r;
- const size_t alloc_size = (size_t)length + 1;
-
- if (length == 0 || length > LIMIT_STRING)
- return -1;
- str = ne_pool_alloc(alloc_size, ctx->alloc_pool);
- r = ne_io_read(ctx->io, (unsigned char *) str, alloc_size - 1);
- if (r != 1)
- return r;
- str[alloc_size - 1] = '\0';
- *val = str;
- return 1;
-}
-
-static int
-ne_read_binary(nestegg * ctx, struct ebml_binary * val, uint64_t length)
-{
- if (length == 0 || length > LIMIT_BINARY)
- return -1;
- val->length = (size_t)length;
- val->data = ne_pool_alloc(val->length, ctx->alloc_pool);
- return ne_io_read(ctx->io, val->data, val->length);
-}
-
-static int
-ne_get_uint(struct ebml_type type, uint64_t * value)
-{
- if (!type.read)
- return -1;
-
- assert(type.type == TYPE_UINT);
-
- *value = type.v.u;
-
- return 0;
-}
-
-static int
-ne_get_uint32(struct ebml_type type, unsigned int * value)
-{
- uint64_t v;
- if (ne_get_uint(type, &v))
- return -1;
-
- assert((unsigned int)v == v);
-
- *value = (unsigned int)v;
-
- return 0;
-}
-
-static int
-ne_get_float(struct ebml_type type, double * value)
-{
- if (!type.read)
- return -1;
-
- assert(type.type == TYPE_FLOAT);
-
- *value = type.v.f;
-
- return 0;
-}
-
-static int
-ne_get_string(struct ebml_type type, char ** value)
-{
- if (!type.read)
- return -1;
-
- assert(type.type == TYPE_STRING);
-
- *value = type.v.s;
-
- return 0;
-}
-
-static int
-ne_get_binary(struct ebml_type type, struct ebml_binary * value)
-{
- if (!type.read)
- return -1;
-
- assert(type.type == TYPE_BINARY);
-
- *value = type.v.b;
-
- return 0;
-}
-
-static int
-ne_is_ancestor_element(uint64_t id, struct list_node * ancestor)
-{
- struct ebml_element_desc * element;
-
- for (; ancestor; ancestor = ancestor->previous)
- for (element = ancestor->node; element->id; ++element)
- if (element->id == id)
- return 1;
-
- return 0;
-}
-
-static struct ebml_element_desc *
-ne_find_element(uint64_t id, struct ebml_element_desc * elements)
-{
- struct ebml_element_desc * element;
-
- for (element = elements; element->id; ++element)
- if (element->id == id)
- return element;
-
- return NULL;
-}
-
-static void
-ne_ctx_push(nestegg * ctx, struct ebml_element_desc * ancestor, void * data)
-{
- struct list_node * item;
-
- item = ne_alloc(sizeof(*item));
- item->previous = ctx->ancestor;
- item->node = ancestor;
- item->data = data;
- ctx->ancestor = item;
-}
-
-static void
-ne_ctx_pop(nestegg * ctx)
-{
- struct list_node * item;
-
- item = ctx->ancestor;
- ctx->ancestor = item->previous;
- free(item);
-}
-
-static int
-ne_ctx_save(nestegg * ctx, struct saved_state * s)
-{
- s->stream_offset = ne_io_tell(ctx->io);
- if (s->stream_offset < 0)
- return -1;
- s->ancestor = ctx->ancestor;
- s->last_id = ctx->last_id;
- s->last_size = ctx->last_size;
- s->last_valid = ctx->last_valid;
- return 0;
-}
-
-static int
-ne_ctx_restore(nestegg * ctx, struct saved_state * s)
-{
- int r;
-
- r = ne_io_seek(ctx->io, s->stream_offset, NESTEGG_SEEK_SET);
- if (r != 0)
- return -1;
- ctx->ancestor = s->ancestor;
- ctx->last_id = s->last_id;
- ctx->last_size = s->last_size;
- ctx->last_valid = s->last_valid;
- return 0;
-}
-
-static int
-ne_peek_element(nestegg * ctx, uint64_t * id, uint64_t * size)
-{
- int r;
-
- if (ctx->last_valid) {
- if (id)
- *id = ctx->last_id;
- if (size)
- *size = ctx->last_size;
- return 1;
- }
-
- r = ne_read_id(ctx->io, &ctx->last_id, NULL);
- if (r != 1)
- return r;
-
- r = ne_read_vint(ctx->io, &ctx->last_size, NULL);
- if (r != 1)
- return r;
-
- if (id)
- *id = ctx->last_id;
- if (size)
- *size = ctx->last_size;
-
- ctx->last_valid = 1;
-
- return 1;
-}
-
-static int
-ne_read_element(nestegg * ctx, uint64_t * id, uint64_t * size)
-{
- int r;
-
- r = ne_peek_element(ctx, id, size);
- if (r != 1)
- return r;
-
- ctx->last_valid = 0;
-
- return 1;
-}
-
-static void
-ne_read_master(nestegg * ctx, struct ebml_element_desc * desc)
-{
- struct ebml_list * list;
- struct ebml_list_node * node, * oldtail;
-
- assert(desc->type == TYPE_MASTER && desc->flags & DESC_FLAG_MULTI);
-
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "multi master element %llx (%s)",
- desc->id, desc->name);
-
- list = (struct ebml_list *) (ctx->ancestor->data + desc->offset);
-
- node = ne_pool_alloc(sizeof(*node), ctx->alloc_pool);
- node->id = desc->id;
- node->data = ne_pool_alloc(desc->size, ctx->alloc_pool);
-
- oldtail = list->tail;
- if (oldtail)
- oldtail->next = node;
- list->tail = node;
- if (!list->head)
- list->head = node;
-
- ctx->log(ctx, NESTEGG_LOG_DEBUG, " -> using data %p", node->data);
-
- ne_ctx_push(ctx, desc->children, node->data);
-}
-
-static void
-ne_read_single_master(nestegg * ctx, struct ebml_element_desc * desc)
-{
- assert(desc->type == TYPE_MASTER && !(desc->flags & DESC_FLAG_MULTI));
-
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "single master element %llx (%s)",
- desc->id, desc->name);
- ctx->log(ctx, NESTEGG_LOG_DEBUG, " -> using data %p (%u)",
- ctx->ancestor->data + desc->offset, desc->offset);
-
- ne_ctx_push(ctx, desc->children, ctx->ancestor->data + desc->offset);
-}
-
-static int
-ne_read_simple(nestegg * ctx, struct ebml_element_desc * desc, size_t length)
-{
- struct ebml_type * storage;
- int r = 0;
-
- storage = (struct ebml_type *) (ctx->ancestor->data + desc->offset);
-
- if (storage->read) {
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "element %llx (%s) already read, skipping",
- desc->id, desc->name);
- return 0;
- }
-
- storage->type = desc->type;
-
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "element %llx (%s) -> %p (%u)",
- desc->id, desc->name, storage, desc->offset);
-
- switch (desc->type) {
- case TYPE_UINT:
- r = ne_read_uint(ctx->io, &storage->v.u, length);
- break;
- case TYPE_FLOAT:
- r = ne_read_float(ctx->io, &storage->v.f, length);
- break;
- case TYPE_INT:
- r = ne_read_int(ctx->io, &storage->v.i, length);
- break;
- case TYPE_STRING:
- r = ne_read_string(ctx, &storage->v.s, length);
- break;
- case TYPE_BINARY:
- r = ne_read_binary(ctx, &storage->v.b, length);
- break;
- case TYPE_MASTER:
- case TYPE_UNKNOWN:
- assert(0);
- break;
- }
-
- if (r == 1)
- storage->read = 1;
-
- return r;
-}
-
-static int
-ne_parse(nestegg * ctx, struct ebml_element_desc * top_level, int64_t max_offset)
-{
- int r;
- int64_t * data_offset;
- uint64_t id, size, peeked_id;
- struct ebml_element_desc * element;
-
- if (!ctx->ancestor)
- return -1;
-
- for (;;) {
- if (max_offset > 0 && ne_io_tell(ctx->io) >= max_offset) {
- /* Reached end of offset allowed for parsing - return gracefully */
- r = 1;
- break;
- }
- r = ne_peek_element(ctx, &id, &size);
- if (r != 1)
- break;
- peeked_id = id;
-
- element = ne_find_element(id, ctx->ancestor->node);
- if (element) {
- if (element->flags & DESC_FLAG_SUSPEND) {
- assert(element->type == TYPE_BINARY);
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "suspend parse at %llx", id);
- r = 1;
- break;
- }
-
- r = ne_read_element(ctx, &id, &size);
- if (r != 1)
- break;
- assert(id == peeked_id);
-
- if (element->flags & DESC_FLAG_OFFSET) {
- data_offset = (int64_t *) (ctx->ancestor->data + element->data_offset);
- *data_offset = ne_io_tell(ctx->io);
- if (*data_offset < 0) {
- r = -1;
- break;
- }
- }
-
- if (element->type == TYPE_MASTER) {
- if (element->flags & DESC_FLAG_MULTI)
- ne_read_master(ctx, element);
- else
- ne_read_single_master(ctx, element);
- continue;
- } else {
- r = ne_read_simple(ctx, element, (size_t)size);
- if (r < 0)
- break;
- }
- } else if (ne_is_ancestor_element(id, ctx->ancestor->previous)) {
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "parent element %llx", id);
- if (top_level && ctx->ancestor->node == top_level) {
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "*** parse about to back up past top_level");
- r = 1;
- break;
- }
- ne_ctx_pop(ctx);
- } else {
- r = ne_read_element(ctx, &id, &size);
- if (r != 1)
- break;
-
- if (id != ID_VOID && id != ID_CRC32)
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "unknown element %llx", id);
- r = ne_io_read_skip(ctx->io, (size_t)size);
- if (r != 1)
- break;
- }
- }
-
- if (r != 1)
- while (ctx->ancestor)
- ne_ctx_pop(ctx);
-
- return r;
-}
-
-static uint64_t
-ne_xiph_lace_value(unsigned char ** np)
-{
- uint64_t lace;
- uint64_t value;
- unsigned char * p = *np;
-
- lace = *p++;
- value = lace;
- while (lace == 255) {
- lace = *p++;
- value += lace;
- }
-
- *np = p;
-
- return value;
-}
-
-static int
-ne_read_xiph_lace_value(nestegg_io * io, uint64_t * value, size_t * consumed)
-{
- int r;
- uint64_t lace;
-
- r = ne_read_uint(io, &lace, 1);
- if (r != 1)
- return r;
- *consumed += 1;
-
- *value = lace;
- while (lace == 255) {
- r = ne_read_uint(io, &lace, 1);
- if (r != 1)
- return r;
- *consumed += 1;
- *value += lace;
- }
-
- return 1;
-}
-
-static int
-ne_read_xiph_lacing(nestegg_io * io, size_t block, size_t * read, uint64_t n, uint64_t * sizes)
-{
- int r;
- size_t i = 0;
- uint64_t sum = 0;
-
- while (--n) {
- r = ne_read_xiph_lace_value(io, &sizes[i], read);
- if (r != 1)
- return r;
- sum += sizes[i];
- i += 1;
- }
-
- if (*read + sum > block)
- return -1;
-
- /* Last frame is the remainder of the block. */
- sizes[i] = block - *read - sum;
- return 1;
-}
-
-static int
-ne_read_ebml_lacing(nestegg_io * io, size_t block, size_t * read, uint64_t n, uint64_t * sizes)
-{
- int r;
- uint64_t lace, sum, length;
- int64_t slace;
- size_t i = 0;
-
- r = ne_read_vint(io, &lace, &length);
- if (r != 1)
- return r;
- assert(length <= 8);
- *read += (size_t)length;
-
- sizes[i] = lace;
- sum = sizes[i];
-
- i += 1;
- n -= 1;
-
- while (--n) {
- r = ne_read_svint(io, &slace, &length);
- if (r != 1)
- return r;
- assert(length <= 8);
- *read += (size_t)length;
- sizes[i] = sizes[i - 1] + slace;
- sum += sizes[i];
- i += 1;
- }
-
- if (*read + sum > block)
- return -1;
-
- /* Last frame is the remainder of the block. */
- sizes[i] = block - *read - sum;
- return 1;
-}
-
-static uint64_t
-ne_get_timecode_scale(nestegg * ctx)
-{
- uint64_t scale;
-
- if (ne_get_uint(ctx->segment.info.timecode_scale, &scale) != 0)
- scale = 1000000;
-
- return scale;
-}
-
-static int
-ne_map_track_number_to_index(nestegg * ctx,
- unsigned int track_number,
- unsigned int * track_index)
-{
- struct ebml_list_node * node;
- struct track_entry * t_entry;
- uint64_t t_number = 0;
-
- if (!track_index)
- return -1;
- *track_index = 0;
-
- if (track_number == 0)
- return -1;
-
- node = ctx->segment.tracks.track_entry.head;
- while (node) {
- assert(node->id == ID_TRACK_ENTRY);
- t_entry = node->data;
- if (ne_get_uint(t_entry->number, &t_number) != 0)
- return -1;
- if (t_number == track_number)
- return 0;
- *track_index += 1;
- node = node->next;
- }
-
- return -1;
-}
-
-static struct track_entry *
-ne_find_track_entry(nestegg * ctx, unsigned int track)
-{
- struct ebml_list_node * node;
- unsigned int tracks = 0;
-
- node = ctx->segment.tracks.track_entry.head;
- while (node) {
- assert(node->id == ID_TRACK_ENTRY);
- if (track == tracks)
- return node->data;
- tracks += 1;
- node = node->next;
- }
-
- return NULL;
-}
-
-static int
-ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_packet ** data)
-{
- int r;
- int64_t timecode, abs_timecode;
- nestegg_packet * pkt;
- struct cluster * cluster;
- struct frame * f, * last;
- struct track_entry * entry;
- const int track_scale = 1;
- uint64_t track_number, length, frame_sizes[256], cluster_tc, flags, frames, tc_scale, total;
- unsigned int i, lacing, track;
- size_t consumed = 0;
-
- *data = NULL;
-
- if (block_size > LIMIT_BLOCK)
- return -1;
-
- r = ne_read_vint(ctx->io, &track_number, &length);
- if (r != 1)
- return r;
-
- if (track_number == 0 || (unsigned int)track_number != track_number)
- return -1;
-
- assert(length <= 8);
- consumed += (size_t)length;
-
- r = ne_read_int(ctx->io, &timecode, 2);
- if (r != 1)
- return r;
-
- consumed += 2;
-
- r = ne_read_uint(ctx->io, &flags, 1);
- if (r != 1)
- return r;
-
- consumed += 1;
-
- frames = 0;
-
- /* Flags are different between Block and SimpleBlock, but lacing is
- encoded the same way. */
- lacing = (flags & BLOCK_FLAGS_LACING) >> 1;
-
- switch (lacing) {
- case LACING_NONE:
- frames = 1;
- break;
- case LACING_XIPH:
- case LACING_FIXED:
- case LACING_EBML:
- r = ne_read_uint(ctx->io, &frames, 1);
- if (r != 1)
- return r;
- consumed += 1;
- frames += 1;
- }
-
- if (frames > 256)
- return -1;
-
- switch (lacing) {
- case LACING_NONE:
- frame_sizes[0] = block_size - consumed;
- break;
- case LACING_XIPH:
- if (frames == 1)
- return -1;
- r = ne_read_xiph_lacing(ctx->io, (size_t)block_size, &consumed, frames, frame_sizes);
- if (r != 1)
- return r;
- break;
- case LACING_FIXED:
- if ((block_size - consumed) % frames)
- return -1;
- for (i = 0; i < frames; ++i)
- frame_sizes[i] = (block_size - consumed) / frames;
- break;
- case LACING_EBML:
- if (frames == 1)
- return -1;
- r = ne_read_ebml_lacing(ctx->io, (size_t)block_size, &consumed, frames, frame_sizes);
- if (r != 1)
- return r;
- break;
- }
-
- /* Sanity check unlaced frame sizes against total block size. */
- total = consumed;
- for (i = 0; i < frames; ++i)
- total += frame_sizes[i];
- if (total > block_size)
- return -1;
-
- if (ne_map_track_number_to_index(ctx, (unsigned int)track_number, &track) != 0)
- return -1;
-
- entry = ne_find_track_entry(ctx, track);
- if (!entry)
- return -1;
-
- tc_scale = ne_get_timecode_scale(ctx);
-
- assert(ctx->segment.cluster.tail->id == ID_CLUSTER);
- cluster = ctx->segment.cluster.tail->data;
- if (ne_get_uint(cluster->timecode, &cluster_tc) != 0)
- return -1;
-
- abs_timecode = timecode + cluster_tc;
- if (abs_timecode < 0)
- return -1;
-
- pkt = ne_alloc(sizeof(*pkt));
- pkt->track = track;
- pkt->timecode = abs_timecode * tc_scale * track_scale;
-
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "%sblock t %lld pts %f f %llx frames: %llu",
- block_id == ID_BLOCK ? "" : "simple", pkt->track, pkt->timecode / 1e9, flags, frames);
-
- last = NULL;
- for (i = 0; i < frames; ++i) {
- if (frame_sizes[i] > LIMIT_FRAME) {
- nestegg_free_packet(pkt);
- return -1;
- }
- f = ne_alloc(sizeof(*f));
- f->length = (size_t)frame_sizes[i];
- f->data = ne_alloc(f->length);
- r = ne_io_read(ctx->io, f->data, f->length);
- if (r != 1) {
- free(f->data);
- free(f);
- nestegg_free_packet(pkt);
- return -1;
- }
-
- if (!last)
- pkt->frame = f;
- else
- last->next = f;
- last = f;
- }
-
- *data = pkt;
-
- return 1;
-}
-
-static int
-ne_read_discard_padding(nestegg * ctx, nestegg_packet * pkt)
-{
- int r;
- uint64_t id, size;
- struct ebml_element_desc * element;
- struct ebml_type * storage;
-
- r = ne_peek_element(ctx, &id, &size);
- if (r != 1)
- return r;
-
- if (id != ID_DISCARD_PADDING)
- return 1;
-
- element = ne_find_element(id, ctx->ancestor->node);
- if (!element)
- return 1;
-
- assert((size_t)size == size);
- r = ne_read_simple(ctx, element, (size_t)size);
- if (r != 1)
- return r;
- storage = (struct ebml_type *) (ctx->ancestor->data + element->offset);
- pkt->discard_padding = storage->v.i;
-
- return 1;
-}
-
-
-static uint64_t
-ne_buf_read_id(unsigned char const * p, size_t length)
-{
- uint64_t id = 0;
-
- while (length--) {
- id <<= 8;
- id |= *p++;
- }
-
- return id;
-}
-
-static struct seek *
-ne_find_seek_for_id(struct ebml_list_node * seek_head, uint64_t id)
-{
- struct ebml_list * head;
- struct ebml_list_node * seek;
- struct ebml_binary binary_id;
- struct seek * s;
-
- while (seek_head) {
- assert(seek_head->id == ID_SEEK_HEAD);
- head = seek_head->data;
- seek = head->head;
-
- while (seek) {
- assert(seek->id == ID_SEEK);
- s = seek->data;
-
- if (ne_get_binary(s->id, &binary_id) == 0 &&
- ne_buf_read_id(binary_id.data, binary_id.length) == id)
- return s;
-
- seek = seek->next;
- }
-
- seek_head = seek_head->next;
- }
-
- return NULL;
-}
-
-static struct cue_track_positions *
-ne_find_cue_position_for_track(nestegg * ctx, struct ebml_list_node * node, unsigned int track)
-{
- struct cue_track_positions * pos = NULL;
- unsigned int track_number;
- unsigned int t;
-
- while (node) {
- assert(node->id == ID_CUE_TRACK_POSITIONS);
- pos = node->data;
- if (ne_get_uint32(pos->track, &track_number) != 0)
- return NULL;
-
- if (ne_map_track_number_to_index(ctx, track_number, &t) != 0)
- return NULL;
-
- if (t == track)
- return pos;
-
- node = node->next;
- }
-
- return NULL;
-}
-
-static struct cue_point *
-ne_find_cue_point_for_tstamp(nestegg * ctx, struct ebml_list_node * cue_point, unsigned int track, uint64_t scale, uint64_t tstamp)
-{
- uint64_t time;
- struct cue_point * c, * prev = NULL;
-
- while (cue_point) {
- assert(cue_point->id == ID_CUE_POINT);
- c = cue_point->data;
-
- if (!prev)
- prev = c;
-
- if (ne_get_uint(c->time, &time) == 0 && time * scale > tstamp)
- break;
-
- if (ne_find_cue_position_for_track(ctx, c->cue_track_positions.head, track) != NULL)
- prev = c;
-
- cue_point = cue_point->next;
- }
-
- return prev;
-}
-
-static int
-ne_is_suspend_element(uint64_t id)
-{
- if (id == ID_SIMPLE_BLOCK || id == ID_BLOCK)
- return 1;
- return 0;
-}
-
-static void
-ne_null_log_callback(nestegg * ctx, unsigned int severity, char const * fmt, ...)
-{
- if (ctx && severity && fmt)
- return;
-}
-
-static int
-ne_init_cue_points(nestegg * ctx, int64_t max_offset)
-{
- int r;
- struct ebml_list_node * node = ctx->segment.cues.cue_point.head;
- struct seek * found;
- uint64_t seek_pos, id;
- struct saved_state state;
-
- /* If there are no cues loaded, check for cues element in the seek head
- and load it. */
- if (!node) {
- found = ne_find_seek_for_id(ctx->segment.seek_head.head, ID_CUES);
- if (!found)
- return -1;
-
- if (ne_get_uint(found->position, &seek_pos) != 0)
- return -1;
-
- /* Save old parser state. */
- r = ne_ctx_save(ctx, &state);
- if (r != 0)
- return -1;
-
- /* Seek and set up parser state for segment-level element (Cues). */
- r = ne_io_seek(ctx->io, ctx->segment_offset + seek_pos, NESTEGG_SEEK_SET);
- if (r != 0)
- return -1;
- ctx->last_valid = 0;
-
- r = ne_read_element(ctx, &id, NULL);
- if (r != 1)
- return -1;
-
- if (id != ID_CUES)
- return -1;
-
- ctx->ancestor = NULL;
- ne_ctx_push(ctx, ne_top_level_elements, ctx);
- ne_ctx_push(ctx, ne_segment_elements, &ctx->segment);
- ne_ctx_push(ctx, ne_cues_elements, &ctx->segment.cues);
- /* parser will run until end of cues element. */
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "seek: parsing cue elements");
- r = ne_parse(ctx, ne_cues_elements, max_offset);
- while (ctx->ancestor)
- ne_ctx_pop(ctx);
-
- /* Reset parser state to original state and seek back to old position. */
- if (ne_ctx_restore(ctx, &state) != 0)
- return -1;
-
- if (r < 0)
- return -1;
-
- node = ctx->segment.cues.cue_point.head;
- if (!node)
- return -1;
- }
-
- return 0;
-}
-
-/* Three functions that implement the nestegg_io interface, operating on a
- * sniff_buffer. */
-struct sniff_buffer {
- unsigned char const * buffer;
- size_t length;
- int64_t offset;
-};
-
-static int
-ne_buffer_read(void * buffer, size_t length, void * user_data)
-{
- struct sniff_buffer * sb = user_data;
-
- int rv = 1;
- size_t available = sb->length - (size_t)sb->offset;
-
- if (available < length)
- return 0;
-
- memcpy(buffer, sb->buffer + sb->offset, length);
- sb->offset += length;
-
- return rv;
-}
-
-static int
-ne_buffer_seek(int64_t offset, int whence, void * user_data)
-{
- struct sniff_buffer * sb = user_data;
- int64_t o = sb->offset;
-
- switch(whence) {
- case NESTEGG_SEEK_SET:
- o = offset;
- break;
- case NESTEGG_SEEK_CUR:
- o += offset;
- break;
- case NESTEGG_SEEK_END:
- o = sb->length + offset;
- break;
- }
-
- if (o < 0 || o > (int64_t) sb->length)
- return -1;
-
- sb->offset = o;
- return 0;
-}
-
-static int64_t
-ne_buffer_tell(void * user_data)
-{
- struct sniff_buffer * sb = user_data;
- return sb->offset;
-}
-
-static int
-ne_match_webm(nestegg_io io, int64_t max_offset)
-{
- int r;
- uint64_t id;
- char * doctype;
- nestegg * ctx;
-
- if (!(io.read && io.seek && io.tell))
- return -1;
-
- ctx = ne_alloc(sizeof(*ctx));
-
- ctx->io = ne_alloc(sizeof(*ctx->io));
- *ctx->io = io;
- ctx->alloc_pool = ne_pool_init();
- ctx->log = ne_null_log_callback;
-
- r = ne_peek_element(ctx, &id, NULL);
- if (r != 1) {
- nestegg_destroy(ctx);
- return 0;
- }
-
- if (id != ID_EBML) {
- nestegg_destroy(ctx);
- return 0;
- }
-
- ne_ctx_push(ctx, ne_top_level_elements, ctx);
-
- /* we don't check the return value of ne_parse, that might fail because
- * max_offset is not on a valid element end point. We only want to check
- * the EBML ID and that the doctype is "webm". */
- ne_parse(ctx, NULL, max_offset);
-
- if (ne_get_string(ctx->ebml.doctype, &doctype) != 0 ||
- strcmp(doctype, "webm") != 0) {
- nestegg_destroy(ctx);
- return 0;
- }
-
- nestegg_destroy(ctx);
-
- return 1;
-}
-
-int
-nestegg_init(nestegg ** context, nestegg_io io, nestegg_log callback, int64_t max_offset)
-{
- int r;
- uint64_t id, version, docversion;
- struct ebml_list_node * track;
- char * doctype;
- nestegg * ctx;
-
- if (!(io.read && io.seek && io.tell))
- return -1;
-
- ctx = ne_alloc(sizeof(*ctx));
-
- ctx->io = ne_alloc(sizeof(*ctx->io));
- *ctx->io = io;
- ctx->log = callback;
- ctx->alloc_pool = ne_pool_init();
-
- if (!ctx->log)
- ctx->log = ne_null_log_callback;
-
- r = ne_peek_element(ctx, &id, NULL);
- if (r != 1) {
- nestegg_destroy(ctx);
- return -1;
- }
-
- if (id != ID_EBML) {
- nestegg_destroy(ctx);
- return -1;
- }
-
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "ctx %p", ctx);
-
- ne_ctx_push(ctx, ne_top_level_elements, ctx);
-
- r = ne_parse(ctx, NULL, max_offset);
-
- if (r != 1) {
- nestegg_destroy(ctx);
- return -1;
- }
-
- if (ne_get_uint(ctx->ebml.ebml_read_version, &version) != 0)
- version = 1;
- if (version != 1) {
- nestegg_destroy(ctx);
- return -1;
- }
-
- if (ne_get_string(ctx->ebml.doctype, &doctype) != 0)
- doctype = "matroska";
- if (strcmp(doctype, "webm") != 0) {
- nestegg_destroy(ctx);
- return -1;
- }
-
- if (ne_get_uint(ctx->ebml.doctype_read_version, &docversion) != 0)
- docversion = 1;
- if (docversion < 1 || docversion > 2) {
- nestegg_destroy(ctx);
- return -1;
- }
-
- if (!ctx->segment.tracks.track_entry.head) {
- nestegg_destroy(ctx);
- return -1;
- }
-
- track = ctx->segment.tracks.track_entry.head;
- ctx->track_count = 0;
-
- while (track) {
- ctx->track_count += 1;
- track = track->next;
- }
-
- *context = ctx;
-
- return 0;
-}
-
-void
-nestegg_destroy(nestegg * ctx)
-{
- while (ctx->ancestor)
- ne_ctx_pop(ctx);
- ne_pool_destroy(ctx->alloc_pool);
- free(ctx->io);
- free(ctx);
-}
-
-int
-nestegg_duration(nestegg * ctx, uint64_t * duration)
-{
- uint64_t tc_scale;
- double unscaled_duration;
-
- if (ne_get_float(ctx->segment.info.duration, &unscaled_duration) != 0)
- return -1;
-
- tc_scale = ne_get_timecode_scale(ctx);
-
- *duration = (uint64_t) (unscaled_duration * tc_scale);
- return 0;
-}
-
-int
-nestegg_tstamp_scale(nestegg * ctx, uint64_t * scale)
-{
- *scale = ne_get_timecode_scale(ctx);
- return 0;
-}
-
-int
-nestegg_track_count(nestegg * ctx, unsigned int * tracks)
-{
- *tracks = ctx->track_count;
- return 0;
-}
-
-int
-nestegg_get_cue_point(nestegg * ctx, unsigned int cluster_num, int64_t max_offset,
- int64_t * start_pos, int64_t * end_pos, uint64_t * tstamp)
-{
- int range_obtained = 0;
- unsigned int cluster_count = 0;
- struct cue_point * cue_point;
- struct cue_track_positions * pos;
- uint64_t seek_pos, track_number, tc_scale, time;
- struct ebml_list_node * cues_node = ctx->segment.cues.cue_point.head;
- struct ebml_list_node * cue_pos_node = NULL;
- unsigned int track = 0, track_count = 0, track_index;
-
- if (!start_pos || !end_pos || !tstamp)
- return -1;
-
- /* Initialise return values */
- *start_pos = -1;
- *end_pos = -1;
- *tstamp = 0;
-
- if (!cues_node) {
- ne_init_cue_points(ctx, max_offset);
- cues_node = ctx->segment.cues.cue_point.head;
- /* Verify cues have been added to context. */
- if (!cues_node)
- return -1;
- }
-
- nestegg_track_count(ctx, &track_count);
-
- tc_scale = ne_get_timecode_scale(ctx);
-
- while (cues_node && !range_obtained) {
- assert(cues_node->id == ID_CUE_POINT);
- cue_point = cues_node->data;
- cue_pos_node = cue_point->cue_track_positions.head;
- while (cue_pos_node) {
- assert(cue_pos_node->id == ID_CUE_TRACK_POSITIONS);
- pos = cue_pos_node->data;
- for (track = 0; track < track_count; track++) {
- if (ne_get_uint(pos->track, &track_number) != 0)
- return -1;
-
- if (ne_map_track_number_to_index(ctx, (unsigned int)track_number, &track_index) != 0)
- return -1;
-
- if (track_index == track) {
- if (ne_get_uint(pos->cluster_position, &seek_pos) != 0)
- return -1;
- if (cluster_count == cluster_num) {
- *start_pos = ctx->segment_offset+seek_pos;
- if (ne_get_uint(cue_point->time, &time) != 0)
- return -1;
- *tstamp = time * tc_scale;
- } else if (cluster_count == cluster_num+1) {
- *end_pos = (ctx->segment_offset+seek_pos)-1;
- range_obtained = 1;
- break;
- }
- cluster_count++;
- }
- }
- cue_pos_node = cue_pos_node->next;
- }
- cues_node = cues_node->next;
- }
-
- return 0;
-}
-
-int
-nestegg_offset_seek(nestegg * ctx, uint64_t offset)
-{
- int r;
-
- /* Seek and set up parser state for segment-level element (Cluster). */
- r = ne_io_seek(ctx->io, offset, NESTEGG_SEEK_SET);
- if (r != 0)
- return -1;
- ctx->last_valid = 0;
-
- while (ctx->ancestor)
- ne_ctx_pop(ctx);
-
- ne_ctx_push(ctx, ne_top_level_elements, ctx);
- ne_ctx_push(ctx, ne_segment_elements, &ctx->segment);
-
- return 0;
-}
-
-int
-nestegg_track_seek(nestegg * ctx, unsigned int track, uint64_t tstamp)
-{
- int r;
- struct cue_point * cue_point;
- struct cue_track_positions * pos;
- uint64_t seek_pos, tc_scale;
-
- /* If there are no cues loaded, check for cues element in the seek head
- and load it. */
- if (!ctx->segment.cues.cue_point.head) {
- r = ne_init_cue_points(ctx, -1);
- if (r != 0)
- return -1;
- }
-
- tc_scale = ne_get_timecode_scale(ctx);
-
- cue_point = ne_find_cue_point_for_tstamp(ctx, ctx->segment.cues.cue_point.head,
- track, tc_scale, tstamp);
- if (!cue_point)
- return -1;
-
- pos = ne_find_cue_position_for_track(ctx, cue_point->cue_track_positions.head, track);
- if (pos == NULL)
- return -1;
-
- if (ne_get_uint(pos->cluster_position, &seek_pos) != 0)
- return -1;
-
- /* Seek and set up parser state for segment-level element (Cluster). */
- r = nestegg_offset_seek(ctx, ctx->segment_offset + seek_pos);
- ctx->log(ctx, NESTEGG_LOG_DEBUG, "seek: parsing cluster elements");
- r = ne_parse(ctx, NULL, -1);
- if (r != 1)
- return -1;
-
- if (!ne_is_suspend_element(ctx->last_id))
- return -1;
-
- return 0;
-}
-
-int
-nestegg_track_type(nestegg * ctx, unsigned int track)
-{
- struct track_entry * entry;
- uint64_t type;
-
- entry = ne_find_track_entry(ctx, track);
- if (!entry)
- return -1;
-
- if (ne_get_uint(entry->type, &type) != 0)
- return -1;
-
- if (type & TRACK_TYPE_VIDEO)
- return NESTEGG_TRACK_VIDEO;
-
- if (type & TRACK_TYPE_AUDIO)
- return NESTEGG_TRACK_AUDIO;
-
- return -1;
-}
-
-int
-nestegg_track_codec_id(nestegg * ctx, unsigned int track)
-{
- char * codec_id;
- struct track_entry * entry;
-
- entry = ne_find_track_entry(ctx, track);
- if (!entry)
- return -1;
-
- if (ne_get_string(entry->codec_id, &codec_id) != 0)
- return -1;
-
- if (strcmp(codec_id, TRACK_ID_VP8) == 0)
- return NESTEGG_CODEC_VP8;
-
- if (strcmp(codec_id, TRACK_ID_VP9) == 0)
- return NESTEGG_CODEC_VP9;
-
- if (strcmp(codec_id, TRACK_ID_VORBIS) == 0)
- return NESTEGG_CODEC_VORBIS;
-
- if (strcmp(codec_id, TRACK_ID_OPUS) == 0)
- return NESTEGG_CODEC_OPUS;
-
- return -1;
-}
-
-int
-nestegg_track_codec_data_count(nestegg * ctx, unsigned int track,
- unsigned int * count)
-{
- struct track_entry * entry;
- struct ebml_binary codec_private;
- unsigned char * p;
-
- *count = 0;
-
- entry = ne_find_track_entry(ctx, track);
- if (!entry)
- return -1;
-
- if (nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_VORBIS)
- return -1;
-
- if (ne_get_binary(entry->codec_private, &codec_private) != 0)
- return -1;
-
- if (codec_private.length < 1)
- return -1;
-
- p = codec_private.data;
- *count = *p + 1;
-
- if (*count > 3)
- return -1;
-
- return 0;
-}
-
-int
-nestegg_track_codec_data(nestegg * ctx, unsigned int track, unsigned int item,
- unsigned char ** data, size_t * length)
-{
- struct track_entry * entry;
- struct ebml_binary codec_private;
- uint64_t sizes[3], total;
- unsigned char * p;
- unsigned int count, i;
-
- *data = NULL;
- *length = 0;
-
- entry = ne_find_track_entry(ctx, track);
- if (!entry)
- return -1;
-
- if (nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_VORBIS
- && nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_OPUS)
- return -1;
-
- if (ne_get_binary(entry->codec_private, &codec_private) != 0)
- return -1;
-
- if (nestegg_track_codec_id(ctx, track) == NESTEGG_CODEC_VORBIS) {
- p = codec_private.data;
- count = *p++ + 1;
-
- if (count > 3)
- return -1;
-
- i = 0;
- total = 0;
- while (--count) {
- sizes[i] = ne_xiph_lace_value(&p);
- total += sizes[i];
- i += 1;
- }
- sizes[i] = codec_private.length - total - (p - codec_private.data);
-
- for (i = 0; i < item; ++i) {
- if (sizes[i] > LIMIT_FRAME)
- return -1;
- p += sizes[i];
- }
- *data = p;
- *length = (size_t)sizes[item];
- } else {
- *data = codec_private.data;
- *length = codec_private.length;
- }
-
- return 0;
-}
-
-int
-nestegg_track_video_params(nestegg * ctx, unsigned int track,
- nestegg_video_params * params)
-{
- struct track_entry * entry;
- unsigned int value;
-
- memset(params, 0, sizeof(*params));
-
- entry = ne_find_track_entry(ctx, track);
- if (!entry)
- return -1;
-
- if (nestegg_track_type(ctx, track) != NESTEGG_TRACK_VIDEO)
- return -1;
-
- value = 0;
- ne_get_uint32(entry->video.stereo_mode, &value);
- if (value <= NESTEGG_VIDEO_STEREO_TOP_BOTTOM ||
- value == NESTEGG_VIDEO_STEREO_RIGHT_LEFT)
- params->stereo_mode = value;
-
- if (ne_get_uint32(entry->video.pixel_width, &value) != 0)
- return -1;
- params->width = value;
-
- if (ne_get_uint32(entry->video.pixel_height, &value) != 0)
- return -1;
- params->height = value;
-
- value = 0;
- ne_get_uint32(entry->video.pixel_crop_bottom, &value);
- params->crop_bottom = value;
-
- value = 0;
- ne_get_uint32(entry->video.pixel_crop_top, &value);
- params->crop_top = value;
-
- value = 0;
- ne_get_uint32(entry->video.pixel_crop_left, &value);
- params->crop_left = value;
-
- value = 0;
- ne_get_uint32(entry->video.pixel_crop_right, &value);
- params->crop_right = value;
-
- value = params->width;
- ne_get_uint32(entry->video.display_width, &value);
- params->display_width = value;
-
- value = params->height;
- ne_get_uint32(entry->video.display_height, &value);
- params->display_height = value;
-
- return 0;
-}
-
-int
-nestegg_track_audio_params(nestegg * ctx, unsigned int track,
- nestegg_audio_params * params)
-{
- struct track_entry * entry;
- unsigned int value;
-
- memset(params, 0, sizeof(*params));
-
- entry = ne_find_track_entry(ctx, track);
- if (!entry)
- return -1;
-
- if (nestegg_track_type(ctx, track) != NESTEGG_TRACK_AUDIO)
- return -1;
-
- params->rate = 8000;
- ne_get_float(entry->audio.sampling_frequency, &params->rate);
-
- value = 1;
- ne_get_uint32(entry->audio.channels, &value);
- params->channels = value;
-
- value = 16;
- ne_get_uint32(entry->audio.bit_depth, &value);
- params->depth = value;
-
- value = 0;
- ne_get_uint32(entry->codec_delay, &value);
- params->codec_delay = value;
-
- value = 0;
- ne_get_uint32(entry->seek_preroll, &value);
- params->seek_preroll = value;
-
- return 0;
-}
-
-int
-nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
-{
- int r;
- uint64_t id, size;
-
- *pkt = NULL;
-
- for (;;) {
- r = ne_peek_element(ctx, &id, &size);
- if (r != 1)
- return r;
-
- /* Any DESC_FLAG_SUSPEND fields must be handled here. */
- if (ne_is_suspend_element(id)) {
- r = ne_read_element(ctx, &id, &size);
- if (r != 1)
- return r;
-
- /* The only DESC_FLAG_SUSPEND fields are Blocks and SimpleBlocks, which we
- handle directly. */
- r = ne_read_block(ctx, id, size, pkt);
- if (r != 1)
- return r;
-
- r = ne_read_discard_padding(ctx, *pkt);
- if (r != 1)
- return r;
-
- return r;
- }
-
- r = ne_parse(ctx, NULL, -1);
- if (r != 1)
- return r;
- }
-
- return 1;
-}
-
-void
-nestegg_free_packet(nestegg_packet * pkt)
-{
- struct frame * frame;
-
- while (pkt->frame) {
- frame = pkt->frame;
- pkt->frame = frame->next;
- free(frame->data);
- free(frame);
- }
-
- free(pkt);
-}
-
-int
-nestegg_packet_track(nestegg_packet * pkt, unsigned int * track)
-{
- *track = (unsigned int)pkt->track;
- return 0;
-}
-
-int
-nestegg_packet_tstamp(nestegg_packet * pkt, uint64_t * tstamp)
-{
- *tstamp = pkt->timecode;
- return 0;
-}
-
-int
-nestegg_packet_discard_padding(nestegg_packet * pkt, int64_t * discard_padding)
-{
- *discard_padding = pkt->discard_padding;
- return 0;
-}
-
-int
-nestegg_packet_count(nestegg_packet * pkt, unsigned int * count)
-{
- struct frame * f = pkt->frame;
-
- *count = 0;
-
- while (f) {
- *count += 1;
- f = f->next;
- }
-
- return 0;
-}
-
-int
-nestegg_packet_data(nestegg_packet * pkt, unsigned int item,
- unsigned char ** data, size_t * length)
-{
- struct frame * f = pkt->frame;
- unsigned int count = 0;
-
- *data = NULL;
- *length = 0;
-
- while (f) {
- if (count == item) {
- *data = f->data;
- *length = f->length;
- return 0;
- }
- count += 1;
- f = f->next;
- }
-
- return -1;
-}
-
-int
-nestegg_has_cues(nestegg * ctx)
-{
- return ctx->segment.cues.cue_point.head ||
- ne_find_seek_for_id(ctx->segment.seek_head.head, ID_CUES);
-}
-
-int
-nestegg_sniff(unsigned char const * buffer, size_t length)
-{
- nestegg_io io;
- struct sniff_buffer user_data;
-
- user_data.buffer = buffer;
- user_data.length = length;
- user_data.offset = 0;
-
- io.read = ne_buffer_read;
- io.seek = ne_buffer_seek;
- io.tell = ne_buffer_tell;
- io.userdata = &user_data;
- return ne_match_webm(io, length);
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/third_party/nestegg/test/test.c b/videocodec/libvpx_internal/libvpx/third_party/nestegg/test/test.c
deleted file mode 100644
index cc0753d..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/nestegg/test/test.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright © 2010 Mozilla Foundation
- *
- * This program is made available under an ISC-style license. See the
- * accompanying file LICENSE for details.
- */
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include "nestegg/nestegg.h"
-
-#undef DEBUG
-#define SEEK_TEST
-
-static int
-stdio_read(void * p, size_t length, void * file)
-{
- size_t r;
- FILE * fp = file;
-
- r = fread(p, length, 1, fp);
- if (r == 0 && feof(fp))
- return 0;
- return r == 0 ? -1 : 1;
-}
-
-static int
-stdio_seek(int64_t offset, int whence, void * file)
-{
- FILE * fp = file;
- return fseek(fp, offset, whence);
-}
-
-static int64_t
-stdio_tell(void * fp)
-{
- return ftell(fp);
-}
-
-static void
-log_callback(nestegg * ctx, unsigned int severity, char const * fmt, ...)
-{
- va_list ap;
- char const * sev = NULL;
-
-#if !defined(DEBUG)
- if (severity < NESTEGG_LOG_WARNING)
- return;
-#endif
-
- switch (severity) {
- case NESTEGG_LOG_DEBUG:
- sev = "debug: ";
- break;
- case NESTEGG_LOG_WARNING:
- sev = "warning: ";
- break;
- case NESTEGG_LOG_CRITICAL:
- sev = "critical:";
- break;
- default:
- sev = "unknown: ";
- }
-
- fprintf(stderr, "%p %s ", (void *) ctx, sev);
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-
- fprintf(stderr, "\n");
-}
-
-int
-main(int argc, char * argv[])
-{
- FILE * fp;
- int r, type;
- nestegg * ctx;
- nestegg_audio_params aparams;
- nestegg_packet * pkt;
- nestegg_video_params vparams;
- size_t length, size;
- uint64_t duration, tstamp, pkt_tstamp;
- unsigned char * codec_data, * ptr;
- unsigned int cnt, i, j, track, tracks, pkt_cnt, pkt_track;
- unsigned int data_items = 0;
- nestegg_io io = {
- stdio_read,
- stdio_seek,
- stdio_tell,
- NULL
- };
-
- if (argc != 2)
- return EXIT_FAILURE;
-
- fp = fopen(argv[1], "rb");
- if (!fp)
- return EXIT_FAILURE;
-
- io.userdata = fp;
-
- ctx = NULL;
- r = nestegg_init(&ctx, io, log_callback, -1);
- if (r != 0)
- return EXIT_FAILURE;
-
- nestegg_track_count(ctx, &tracks);
- nestegg_duration(ctx, &duration);
-#if defined(DEBUG)
- fprintf(stderr, "media has %u tracks and duration %fs\n", tracks, duration / 1e9);
-#endif
-
- for (i = 0; i < tracks; ++i) {
- type = nestegg_track_type(ctx, i);
-#if defined(DEBUG)
- fprintf(stderr, "track %u: type: %d codec: %d", i,
- type, nestegg_track_codec_id(ctx, i));
-#endif
- nestegg_track_codec_data_count(ctx, i, &data_items);
- for (j = 0; j < data_items; ++j) {
- nestegg_track_codec_data(ctx, i, j, &codec_data, &length);
-#if defined(DEBUG)
- fprintf(stderr, " (%p, %u)", codec_data, (unsigned int) length);
-#endif
- }
- if (type == NESTEGG_TRACK_VIDEO) {
- nestegg_track_video_params(ctx, i, &vparams);
-#if defined(DEBUG)
- fprintf(stderr, " video: %ux%u (d: %ux%u %ux%ux%ux%u)",
- vparams.width, vparams.height,
- vparams.display_width, vparams.display_height,
- vparams.crop_top, vparams.crop_left, vparams.crop_bottom, vparams.crop_right);
-#endif
- } else if (type == NESTEGG_TRACK_AUDIO) {
- nestegg_track_audio_params(ctx, i, &aparams);
-#if defined(DEBUG)
- fprintf(stderr, " audio: %.2fhz %u bit %u channels",
- aparams.rate, aparams.depth, aparams.channels);
-#endif
- }
-#if defined(DEBUG)
- fprintf(stderr, "\n");
-#endif
- }
-
-#if defined(SEEK_TEST)
-#if defined(DEBUG)
- fprintf(stderr, "seek to middle\n");
-#endif
- r = nestegg_track_seek(ctx, 0, duration / 2);
- if (r == 0) {
-#if defined(DEBUG)
- fprintf(stderr, "middle ");
-#endif
- r = nestegg_read_packet(ctx, &pkt);
- if (r == 1) {
- nestegg_packet_track(pkt, &track);
- nestegg_packet_count(pkt, &cnt);
- nestegg_packet_tstamp(pkt, &tstamp);
-#if defined(DEBUG)
- fprintf(stderr, "* t %u pts %f frames %u\n", track, tstamp / 1e9, cnt);
-#endif
- nestegg_free_packet(pkt);
- } else {
-#if defined(DEBUG)
- fprintf(stderr, "middle seek failed\n");
-#endif
- }
- }
-
-#if defined(DEBUG)
- fprintf(stderr, "seek to ~end\n");
-#endif
- r = nestegg_track_seek(ctx, 0, duration - (duration / 10));
- if (r == 0) {
-#if defined(DEBUG)
- fprintf(stderr, "end ");
-#endif
- r = nestegg_read_packet(ctx, &pkt);
- if (r == 1) {
- nestegg_packet_track(pkt, &track);
- nestegg_packet_count(pkt, &cnt);
- nestegg_packet_tstamp(pkt, &tstamp);
-#if defined(DEBUG)
- fprintf(stderr, "* t %u pts %f frames %u\n", track, tstamp / 1e9, cnt);
-#endif
- nestegg_free_packet(pkt);
- } else {
-#if defined(DEBUG)
- fprintf(stderr, "end seek failed\n");
-#endif
- }
- }
-
-#if defined(DEBUG)
- fprintf(stderr, "seek to ~start\n");
-#endif
- r = nestegg_track_seek(ctx, 0, duration / 10);
- if (r == 0) {
-#if defined(DEBUG)
- fprintf(stderr, "start ");
-#endif
- r = nestegg_read_packet(ctx, &pkt);
- if (r == 1) {
- nestegg_packet_track(pkt, &track);
- nestegg_packet_count(pkt, &cnt);
- nestegg_packet_tstamp(pkt, &tstamp);
-#if defined(DEBUG)
- fprintf(stderr, "* t %u pts %f frames %u\n", track, tstamp / 1e9, cnt);
-#endif
- nestegg_free_packet(pkt);
- } else {
-#if defined(DEBUG)
- fprintf(stderr, "start seek failed\n");
-#endif
- }
- }
-#endif
-
- while (nestegg_read_packet(ctx, &pkt) > 0) {
- nestegg_packet_track(pkt, &pkt_track);
- nestegg_packet_count(pkt, &pkt_cnt);
- nestegg_packet_tstamp(pkt, &pkt_tstamp);
-
-#if defined(DEBUG)
- fprintf(stderr, "t %u pts %f frames %u: ", pkt_track, pkt_tstamp / 1e9, pkt_cnt);
-#endif
-
- for (i = 0; i < pkt_cnt; ++i) {
- nestegg_packet_data(pkt, i, &ptr, &size);
-#if defined(DEBUG)
- fprintf(stderr, "%u ", (unsigned int) size);
-#endif
- }
-#if defined(DEBUG)
- fprintf(stderr, "\n");
-#endif
-
- nestegg_free_packet(pkt);
- }
-
- nestegg_destroy(ctx);
- fclose(fp);
-
- return EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/third_party/x86inc/LICENSE b/videocodec/libvpx_internal/libvpx/third_party/x86inc/LICENSE
deleted file mode 100644
index 7d07645..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/x86inc/LICENSE
+++ /dev/null
@@ -1,18 +0,0 @@
-Copyright (C) 2005-2012 x264 project
-
-Authors: Loren Merritt <lorenm@u.washington.edu>
- Anton Mitrofanov <BugMaster@narod.ru>
- Jason Garrett-Glaser <darkshikari@gmail.com>
- Henrik Gramner <hengar-6@student.ltu.se>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/x86inc/README.webm b/videocodec/libvpx_internal/libvpx/third_party/x86inc/README.webm
deleted file mode 100644
index 02cd9ab..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/x86inc/README.webm
+++ /dev/null
@@ -1,11 +0,0 @@
-URL: http://git.videolan.org/?p=x264.git
-Version: 999b753ff0f4dc872077f4fa90d465e948cbe656
-License: ISC
-License File: LICENSE
-
-Description:
-x264/libav's framework for x86 assembly. Contains a variety of macros and
-defines that help automatically allow assembly to work cross-platform.
-
-Local Modifications:
-Some modifications to allow PIC to work with x86inc.
diff --git a/videocodec/libvpx_internal/libvpx/third_party/x86inc/x86inc.asm b/videocodec/libvpx_internal/libvpx/third_party/x86inc/x86inc.asm
deleted file mode 100644
index 9e4918a..0000000
--- a/videocodec/libvpx_internal/libvpx/third_party/x86inc/x86inc.asm
+++ /dev/null
@@ -1,1199 +0,0 @@
-;*****************************************************************************
-;* x86inc.asm: x264asm abstraction layer
-;*****************************************************************************
-;* Copyright (C) 2005-2012 x264 project
-;*
-;* Authors: Loren Merritt <lorenm@u.washington.edu>
-;* Anton Mitrofanov <BugMaster@narod.ru>
-;* Jason Garrett-Glaser <darkshikari@gmail.com>
-;* Henrik Gramner <hengar-6@student.ltu.se>
-;*
-;* Permission to use, copy, modify, and/or distribute this software for any
-;* purpose with or without fee is hereby granted, provided that the above
-;* copyright notice and this permission notice appear in all copies.
-;*
-;* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;*****************************************************************************
-
-; This is a header file for the x264ASM assembly language, which uses
-; NASM/YASM syntax combined with a large number of macros to provide easy
-; abstraction between different calling conventions (x86_32, win64, linux64).
-; It also has various other useful features to simplify writing the kind of
-; DSP functions that are most often used in x264.
-
-; Unlike the rest of x264, this file is available under an ISC license, as it
-; has significant usefulness outside of x264 and we want it to be available
-; to the largest audience possible. Of course, if you modify it for your own
-; purposes to add a new feature, we strongly encourage contributing a patch
-; as this feature might be useful for others as well. Send patches or ideas
-; to x264-devel@videolan.org .
-
-%include "vpx_config.asm"
-
-%define program_name vp9
-
-
-%define UNIX64 0
-%define WIN64 0
-%if ARCH_X86_64
- %ifidn __OUTPUT_FORMAT__,win32
- %define WIN64 1
- %elifidn __OUTPUT_FORMAT__,win64
- %define WIN64 1
- %elifidn __OUTPUT_FORMAT__,x64
- %define WIN64 1
- %else
- %define UNIX64 1
- %endif
-%endif
-
-%ifidn __OUTPUT_FORMAT__,elf32
- %define mangle(x) x
-%elifidn __OUTPUT_FORMAT__,elf64
- %define mangle(x) x
-%elifidn __OUTPUT_FORMAT__,elf
- %define mangle(x) x
-%elifidn __OUTPUT_FORMAT__,x64
- %define mangle(x) x
-%elifidn __OUTPUT_FORMAT__,win64
- %define mangle(x) x
-%else
- %define mangle(x) _ %+ x
-%endif
-
-; FIXME: All of the 64bit asm functions that take a stride as an argument
-; via register, assume that the high dword of that register is filled with 0.
-; This is true in practice (since we never do any 64bit arithmetic on strides,
-; and x264's strides are all positive), but is not guaranteed by the ABI.
-
-; Name of the .rodata section.
-; Kludge: Something on OS X fails to align .rodata even given an align attribute,
-; so use a different read-only section.
-%macro SECTION_RODATA 0-1 16
- %ifidn __OUTPUT_FORMAT__,macho64
- SECTION .text align=%1
- %elifidn __OUTPUT_FORMAT__,macho
- SECTION .text align=%1
- fakegot:
- %elifidn __OUTPUT_FORMAT__,aout
- section .text
- %else
- SECTION .rodata align=%1
- %endif
-%endmacro
-
-; aout does not support align=
-%macro SECTION_TEXT 0-1 16
- %ifidn __OUTPUT_FORMAT__,aout
- SECTION .text
- %else
- SECTION .text align=%1
- %endif
-%endmacro
-
-; PIC macros are copied from vpx_ports/x86_abi_support.asm. The "define PIC"
-; from original code is added in for 64bit.
-%ifidn __OUTPUT_FORMAT__,elf32
-%define ABI_IS_32BIT 1
-%elifidn __OUTPUT_FORMAT__,macho32
-%define ABI_IS_32BIT 1
-%elifidn __OUTPUT_FORMAT__,win32
-%define ABI_IS_32BIT 1
-%elifidn __OUTPUT_FORMAT__,aout
-%define ABI_IS_32BIT 1
-%else
-%define ABI_IS_32BIT 0
-%endif
-
-%if ABI_IS_32BIT
- %if CONFIG_PIC=1
- %ifidn __OUTPUT_FORMAT__,elf32
- %define GET_GOT_SAVE_ARG 1
- %define WRT_PLT wrt ..plt
- %macro GET_GOT 1
- extern _GLOBAL_OFFSET_TABLE_
- push %1
- call %%get_got
- %%sub_offset:
- jmp %%exitGG
- %%get_got:
- mov %1, [esp]
- add %1, _GLOBAL_OFFSET_TABLE_ + $$ - %%sub_offset wrt ..gotpc
- ret
- %%exitGG:
- %undef GLOBAL
- %define GLOBAL(x) x + %1 wrt ..gotoff
- %undef RESTORE_GOT
- %define RESTORE_GOT pop %1
- %endmacro
- %elifidn __OUTPUT_FORMAT__,macho32
- %define GET_GOT_SAVE_ARG 1
- %macro GET_GOT 1
- push %1
- call %%get_got
- %%get_got:
- pop %1
- %undef GLOBAL
- %define GLOBAL(x) x + %1 - %%get_got
- %undef RESTORE_GOT
- %define RESTORE_GOT pop %1
- %endmacro
- %endif
- %endif
-
- %if ARCH_X86_64 == 0
- %undef PIC
- %endif
-
-%else
- %macro GET_GOT 1
- %endmacro
- %define GLOBAL(x) rel x
- %define WRT_PLT wrt ..plt
-
- %if WIN64
- %define PIC
- %elifidn __OUTPUT_FORMAT__,macho64
- %define PIC
- %elif CONFIG_PIC
- %define PIC
- %endif
-%endif
-
-%ifnmacro GET_GOT
- %macro GET_GOT 1
- %endmacro
- %define GLOBAL(x) x
-%endif
-%ifndef RESTORE_GOT
-%define RESTORE_GOT
-%endif
-%ifndef WRT_PLT
-%define WRT_PLT
-%endif
-
-%ifdef PIC
- default rel
-%endif
-; Done with PIC macros
-
-; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
-%ifndef __NASM_VER__
-CPU amdnop
-%else
-%use smartalign
-ALIGNMODE k7
-%endif
-
-; Macros to eliminate most code duplication between x86_32 and x86_64:
-; Currently this works only for leaf functions which load all their arguments
-; into registers at the start, and make no other use of the stack. Luckily that
-; covers most of x264's asm.
-
-; PROLOGUE:
-; %1 = number of arguments. loads them from stack if needed.
-; %2 = number of registers used. pushes callee-saved regs if needed.
-; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed.
-; %4 = list of names to define to registers
-; PROLOGUE can also be invoked by adding the same options to cglobal
-
-; e.g.
-; cglobal foo, 2,3,0, dst, src, tmp
-; declares a function (foo), taking two args (dst and src) and one local variable (tmp)
-
-; TODO Some functions can use some args directly from the stack. If they're the
-; last args then you can just not declare them, but if they're in the middle
-; we need more flexible macro.
-
-; RET:
-; Pops anything that was pushed by PROLOGUE, and returns.
-
-; REP_RET:
-; Same, but if it doesn't pop anything it becomes a 2-byte ret, for athlons
-; which are slow when a normal ret follows a branch.
-
-; registers:
-; rN and rNq are the native-size register holding function argument N
-; rNd, rNw, rNb are dword, word, and byte size
-; rNm is the original location of arg N (a register or on the stack), dword
-; rNmp is native size
-
-%macro DECLARE_REG 5-6
- %define r%1q %2
- %define r%1d %3
- %define r%1w %4
- %define r%1b %5
- %if %0 == 5
- %define r%1m %3
- %define r%1mp %2
- %elif ARCH_X86_64 ; memory
- %define r%1m [rsp + stack_offset + %6]
- %define r%1mp qword r %+ %1m
- %else
- %define r%1m [esp + stack_offset + %6]
- %define r%1mp dword r %+ %1m
- %endif
- %define r%1 %2
-%endmacro
-
-%macro DECLARE_REG_SIZE 2
- %define r%1q r%1
- %define e%1q r%1
- %define r%1d e%1
- %define e%1d e%1
- %define r%1w %1
- %define e%1w %1
- %define r%1b %2
- %define e%1b %2
-%if ARCH_X86_64 == 0
- %define r%1 e%1
-%endif
-%endmacro
-
-DECLARE_REG_SIZE ax, al
-DECLARE_REG_SIZE bx, bl
-DECLARE_REG_SIZE cx, cl
-DECLARE_REG_SIZE dx, dl
-DECLARE_REG_SIZE si, sil
-DECLARE_REG_SIZE di, dil
-DECLARE_REG_SIZE bp, bpl
-
-; t# defines for when per-arch register allocation is more complex than just function arguments
-
-%macro DECLARE_REG_TMP 1-*
- %assign %%i 0
- %rep %0
- CAT_XDEFINE t, %%i, r%1
- %assign %%i %%i+1
- %rotate 1
- %endrep
-%endmacro
-
-%macro DECLARE_REG_TMP_SIZE 0-*
- %rep %0
- %define t%1q t%1 %+ q
- %define t%1d t%1 %+ d
- %define t%1w t%1 %+ w
- %define t%1b t%1 %+ b
- %rotate 1
- %endrep
-%endmacro
-
-DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
-
-%if ARCH_X86_64
- %define gprsize 8
-%else
- %define gprsize 4
-%endif
-
-%macro PUSH 1
- push %1
- %assign stack_offset stack_offset+gprsize
-%endmacro
-
-%macro POP 1
- pop %1
- %assign stack_offset stack_offset-gprsize
-%endmacro
-
-%macro PUSH_IF_USED 1-*
- %rep %0
- %if %1 < regs_used
- PUSH r%1
- %endif
- %rotate 1
- %endrep
-%endmacro
-
-%macro POP_IF_USED 1-*
- %rep %0
- %if %1 < regs_used
- pop r%1
- %endif
- %rotate 1
- %endrep
-%endmacro
-
-%macro LOAD_IF_USED 1-*
- %rep %0
- %if %1 < num_args
- mov r%1, r %+ %1 %+ mp
- %endif
- %rotate 1
- %endrep
-%endmacro
-
-%macro SUB 2
- sub %1, %2
- %ifidn %1, rsp
- %assign stack_offset stack_offset+(%2)
- %endif
-%endmacro
-
-%macro ADD 2
- add %1, %2
- %ifidn %1, rsp
- %assign stack_offset stack_offset-(%2)
- %endif
-%endmacro
-
-%macro movifnidn 2
- %ifnidn %1, %2
- mov %1, %2
- %endif
-%endmacro
-
-%macro movsxdifnidn 2
- %ifnidn %1, %2
- movsxd %1, %2
- %endif
-%endmacro
-
-%macro ASSERT 1
- %if (%1) == 0
- %error assert failed
- %endif
-%endmacro
-
-%macro DEFINE_ARGS 0-*
- %ifdef n_arg_names
- %assign %%i 0
- %rep n_arg_names
- CAT_UNDEF arg_name %+ %%i, q
- CAT_UNDEF arg_name %+ %%i, d
- CAT_UNDEF arg_name %+ %%i, w
- CAT_UNDEF arg_name %+ %%i, b
- CAT_UNDEF arg_name %+ %%i, m
- CAT_UNDEF arg_name %+ %%i, mp
- CAT_UNDEF arg_name, %%i
- %assign %%i %%i+1
- %endrep
- %endif
-
- %xdefine %%stack_offset stack_offset
- %undef stack_offset ; so that the current value of stack_offset doesn't get baked in by xdefine
- %assign %%i 0
- %rep %0
- %xdefine %1q r %+ %%i %+ q
- %xdefine %1d r %+ %%i %+ d
- %xdefine %1w r %+ %%i %+ w
- %xdefine %1b r %+ %%i %+ b
- %xdefine %1m r %+ %%i %+ m
- %xdefine %1mp r %+ %%i %+ mp
- CAT_XDEFINE arg_name, %%i, %1
- %assign %%i %%i+1
- %rotate 1
- %endrep
- %xdefine stack_offset %%stack_offset
- %assign n_arg_names %0
-%endmacro
-
-%if WIN64 ; Windows x64 ;=================================================
-
-DECLARE_REG 0, rcx, ecx, cx, cl
-DECLARE_REG 1, rdx, edx, dx, dl
-DECLARE_REG 2, R8, R8D, R8W, R8B
-DECLARE_REG 3, R9, R9D, R9W, R9B
-DECLARE_REG 4, R10, R10D, R10W, R10B, 40
-DECLARE_REG 5, R11, R11D, R11W, R11B, 48
-DECLARE_REG 6, rax, eax, ax, al, 56
-DECLARE_REG 7, rdi, edi, di, dil, 64
-DECLARE_REG 8, rsi, esi, si, sil, 72
-DECLARE_REG 9, rbx, ebx, bx, bl, 80
-DECLARE_REG 10, rbp, ebp, bp, bpl, 88
-DECLARE_REG 11, R12, R12D, R12W, R12B, 96
-DECLARE_REG 12, R13, R13D, R13W, R13B, 104
-DECLARE_REG 13, R14, R14D, R14W, R14B, 112
-DECLARE_REG 14, R15, R15D, R15W, R15B, 120
-
-%macro PROLOGUE 2-4+ 0 ; #args, #regs, #xmm_regs, arg_names...
- %assign num_args %1
- %assign regs_used %2
- ASSERT regs_used >= num_args
- ASSERT regs_used <= 15
- PUSH_IF_USED 7, 8, 9, 10, 11, 12, 13, 14
- %if mmsize == 8
- %assign xmm_regs_used 0
- %else
- WIN64_SPILL_XMM %3
- %endif
- LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
- DEFINE_ARGS %4
-%endmacro
-
-%macro WIN64_SPILL_XMM 1
- %assign xmm_regs_used %1
- ASSERT xmm_regs_used <= 16
- %if xmm_regs_used > 6
- SUB rsp, (xmm_regs_used-6)*16+16
- %assign %%i xmm_regs_used
- %rep (xmm_regs_used-6)
- %assign %%i %%i-1
- movdqa [rsp + (%%i-6)*16+(~stack_offset&8)], xmm %+ %%i
- %endrep
- %endif
-%endmacro
-
-%macro WIN64_RESTORE_XMM_INTERNAL 1
- %if xmm_regs_used > 6
- %assign %%i xmm_regs_used
- %rep (xmm_regs_used-6)
- %assign %%i %%i-1
- movdqa xmm %+ %%i, [%1 + (%%i-6)*16+(~stack_offset&8)]
- %endrep
- add %1, (xmm_regs_used-6)*16+16
- %endif
-%endmacro
-
-%macro WIN64_RESTORE_XMM 1
- WIN64_RESTORE_XMM_INTERNAL %1
- %assign stack_offset stack_offset-(xmm_regs_used-6)*16+16
- %assign xmm_regs_used 0
-%endmacro
-
-%macro RET 0
- WIN64_RESTORE_XMM_INTERNAL rsp
- POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
- ret
-%endmacro
-
-%macro REP_RET 0
- %if regs_used > 7 || xmm_regs_used > 6
- RET
- %else
- rep ret
- %endif
-%endmacro
-
-%elif ARCH_X86_64 ; *nix x64 ;=============================================
-
-DECLARE_REG 0, rdi, edi, di, dil
-DECLARE_REG 1, rsi, esi, si, sil
-DECLARE_REG 2, rdx, edx, dx, dl
-DECLARE_REG 3, rcx, ecx, cx, cl
-DECLARE_REG 4, R8, R8D, R8W, R8B
-DECLARE_REG 5, R9, R9D, R9W, R9B
-DECLARE_REG 6, rax, eax, ax, al, 8
-DECLARE_REG 7, R10, R10D, R10W, R10B, 16
-DECLARE_REG 8, R11, R11D, R11W, R11B, 24
-DECLARE_REG 9, rbx, ebx, bx, bl, 32
-DECLARE_REG 10, rbp, ebp, bp, bpl, 40
-DECLARE_REG 11, R12, R12D, R12W, R12B, 48
-DECLARE_REG 12, R13, R13D, R13W, R13B, 56
-DECLARE_REG 13, R14, R14D, R14W, R14B, 64
-DECLARE_REG 14, R15, R15D, R15W, R15B, 72
-
-%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
- %assign num_args %1
- %assign regs_used %2
- ASSERT regs_used >= num_args
- ASSERT regs_used <= 15
- PUSH_IF_USED 9, 10, 11, 12, 13, 14
- LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
- DEFINE_ARGS %4
-%endmacro
-
-%macro RET 0
- POP_IF_USED 14, 13, 12, 11, 10, 9
- ret
-%endmacro
-
-%macro REP_RET 0
- %if regs_used > 9
- RET
- %else
- rep ret
- %endif
-%endmacro
-
-%else ; X86_32 ;==============================================================
-
-DECLARE_REG 0, eax, eax, ax, al, 4
-DECLARE_REG 1, ecx, ecx, cx, cl, 8
-DECLARE_REG 2, edx, edx, dx, dl, 12
-DECLARE_REG 3, ebx, ebx, bx, bl, 16
-DECLARE_REG 4, esi, esi, si, null, 20
-DECLARE_REG 5, edi, edi, di, null, 24
-DECLARE_REG 6, ebp, ebp, bp, null, 28
-%define rsp esp
-
-%macro DECLARE_ARG 1-*
- %rep %0
- %define r%1m [esp + stack_offset + 4*%1 + 4]
- %define r%1mp dword r%1m
- %rotate 1
- %endrep
-%endmacro
-
-DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
-
-%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
- %assign num_args %1
- %assign regs_used %2
- %if regs_used > 7
- %assign regs_used 7
- %endif
- ASSERT regs_used >= num_args
- PUSH_IF_USED 3, 4, 5, 6
- LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
- DEFINE_ARGS %4
-%endmacro
-
-%macro RET 0
- POP_IF_USED 6, 5, 4, 3
- ret
-%endmacro
-
-%macro REP_RET 0
- %if regs_used > 3
- RET
- %else
- rep ret
- %endif
-%endmacro
-
-%endif ;======================================================================
-
-%if WIN64 == 0
-%macro WIN64_SPILL_XMM 1
-%endmacro
-%macro WIN64_RESTORE_XMM 1
-%endmacro
-%endif
-
-;=============================================================================
-; arch-independent part
-;=============================================================================
-
-%assign function_align 16
-
-; Begin a function.
-; Applies any symbol mangling needed for C linkage, and sets up a define such that
-; subsequent uses of the function name automatically refer to the mangled version.
-; Appends cpuflags to the function name if cpuflags has been specified.
-%macro cglobal 1-2+ ; name, [PROLOGUE args]
-%if %0 == 1
- cglobal_internal %1 %+ SUFFIX
-%else
- cglobal_internal %1 %+ SUFFIX, %2
-%endif
-%endmacro
-%macro cglobal_internal 1-2+
- %ifndef cglobaled_%1
- %xdefine %1 mangle(program_name %+ _ %+ %1)
- %xdefine %1.skip_prologue %1 %+ .skip_prologue
- CAT_XDEFINE cglobaled_, %1, 1
- %endif
- %xdefine current_function %1
- %ifidn __OUTPUT_FORMAT__,elf
- global %1:function hidden
- %elifidn __OUTPUT_FORMAT__,elf32
- global %1:function hidden
- %elifidn __OUTPUT_FORMAT__,elf64
- global %1:function hidden
- %elifidn __OUTPUT_FORMAT__,macho32
- global %1:private_extern
- %elifidn __OUTPUT_FORMAT__,macho64
- global %1:private_extern
- %else
- global %1
- %endif
- align function_align
- %1:
- RESET_MM_PERMUTATION ; not really needed, but makes disassembly somewhat nicer
- %assign stack_offset 0
- %if %0 > 1
- PROLOGUE %2
- %endif
-%endmacro
-
-%macro cextern 1
- %xdefine %1 mangle(program_name %+ _ %+ %1)
- CAT_XDEFINE cglobaled_, %1, 1
- extern %1
-%endmacro
-
-; like cextern, but without the prefix
-%macro cextern_naked 1
- %xdefine %1 mangle(%1)
- CAT_XDEFINE cglobaled_, %1, 1
- extern %1
-%endmacro
-
-%macro const 2+
- %xdefine %1 mangle(program_name %+ _ %+ %1)
- global %1
- %1: %2
-%endmacro
-
-; This is needed for ELF, otherwise the GNU linker assumes the stack is
-; executable by default.
-%ifidn __OUTPUT_FORMAT__,elf
-SECTION .note.GNU-stack noalloc noexec nowrite progbits
-%elifidn __OUTPUT_FORMAT__,elf32
-SECTION .note.GNU-stack noalloc noexec nowrite progbits
-%elifidn __OUTPUT_FORMAT__,elf64
-SECTION .note.GNU-stack noalloc noexec nowrite progbits
-%endif
-
-; cpuflags
-
-%assign cpuflags_mmx (1<<0)
-%assign cpuflags_mmx2 (1<<1) | cpuflags_mmx
-%assign cpuflags_3dnow (1<<2) | cpuflags_mmx
-%assign cpuflags_3dnow2 (1<<3) | cpuflags_3dnow
-%assign cpuflags_sse (1<<4) | cpuflags_mmx2
-%assign cpuflags_sse2 (1<<5) | cpuflags_sse
-%assign cpuflags_sse2slow (1<<6) | cpuflags_sse2
-%assign cpuflags_sse3 (1<<7) | cpuflags_sse2
-%assign cpuflags_ssse3 (1<<8) | cpuflags_sse3
-%assign cpuflags_sse4 (1<<9) | cpuflags_ssse3
-%assign cpuflags_sse42 (1<<10)| cpuflags_sse4
-%assign cpuflags_avx (1<<11)| cpuflags_sse42
-%assign cpuflags_xop (1<<12)| cpuflags_avx
-%assign cpuflags_fma4 (1<<13)| cpuflags_avx
-
-%assign cpuflags_cache32 (1<<16)
-%assign cpuflags_cache64 (1<<17)
-%assign cpuflags_slowctz (1<<18)
-%assign cpuflags_lzcnt (1<<19)
-%assign cpuflags_misalign (1<<20)
-%assign cpuflags_aligned (1<<21) ; not a cpu feature, but a function variant
-%assign cpuflags_atom (1<<22)
-
-%define cpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
-%define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
-
-; Takes up to 2 cpuflags from the above list.
-; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
-; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
-%macro INIT_CPUFLAGS 0-2
- %if %0 >= 1
- %xdefine cpuname %1
- %assign cpuflags cpuflags_%1
- %if %0 >= 2
- %xdefine cpuname %1_%2
- %assign cpuflags cpuflags | cpuflags_%2
- %endif
- %xdefine SUFFIX _ %+ cpuname
- %if cpuflag(avx)
- %assign avx_enabled 1
- %endif
- %if mmsize == 16 && notcpuflag(sse2)
- %define mova movaps
- %define movu movups
- %define movnta movntps
- %endif
- %if cpuflag(aligned)
- %define movu mova
- %elifidn %1, sse3
- %define movu lddqu
- %endif
- %else
- %xdefine SUFFIX
- %undef cpuname
- %undef cpuflags
- %endif
-%endmacro
-
-; merge mmx and sse*
-
-%macro CAT_XDEFINE 3
- %xdefine %1%2 %3
-%endmacro
-
-%macro CAT_UNDEF 2
- %undef %1%2
-%endmacro
-
-%macro INIT_MMX 0-1+
- %assign avx_enabled 0
- %define RESET_MM_PERMUTATION INIT_MMX %1
- %define mmsize 8
- %define num_mmregs 8
- %define mova movq
- %define movu movq
- %define movh movd
- %define movnta movntq
- %assign %%i 0
- %rep 8
- CAT_XDEFINE m, %%i, mm %+ %%i
- CAT_XDEFINE nmm, %%i, %%i
- %assign %%i %%i+1
- %endrep
- %rep 8
- CAT_UNDEF m, %%i
- CAT_UNDEF nmm, %%i
- %assign %%i %%i+1
- %endrep
- INIT_CPUFLAGS %1
-%endmacro
-
-%macro INIT_XMM 0-1+
- %assign avx_enabled 0
- %define RESET_MM_PERMUTATION INIT_XMM %1
- %define mmsize 16
- %define num_mmregs 8
- %if ARCH_X86_64
- %define num_mmregs 16
- %endif
- %define mova movdqa
- %define movu movdqu
- %define movh movq
- %define movnta movntdq
- %assign %%i 0
- %rep num_mmregs
- CAT_XDEFINE m, %%i, xmm %+ %%i
- CAT_XDEFINE nxmm, %%i, %%i
- %assign %%i %%i+1
- %endrep
- INIT_CPUFLAGS %1
-%endmacro
-
-; FIXME: INIT_AVX can be replaced by INIT_XMM avx
-%macro INIT_AVX 0
- INIT_XMM
- %assign avx_enabled 1
- %define PALIGNR PALIGNR_SSSE3
- %define RESET_MM_PERMUTATION INIT_AVX
-%endmacro
-
-%macro INIT_YMM 0-1+
- %assign avx_enabled 1
- %define RESET_MM_PERMUTATION INIT_YMM %1
- %define mmsize 32
- %define num_mmregs 8
- %if ARCH_X86_64
- %define num_mmregs 16
- %endif
- %define mova vmovaps
- %define movu vmovups
- %undef movh
- %define movnta vmovntps
- %assign %%i 0
- %rep num_mmregs
- CAT_XDEFINE m, %%i, ymm %+ %%i
- CAT_XDEFINE nymm, %%i, %%i
- %assign %%i %%i+1
- %endrep
- INIT_CPUFLAGS %1
-%endmacro
-
-INIT_XMM
-
-; I often want to use macros that permute their arguments. e.g. there's no
-; efficient way to implement butterfly or transpose or dct without swapping some
-; arguments.
-;
-; I would like to not have to manually keep track of the permutations:
-; If I insert a permutation in the middle of a function, it should automatically
-; change everything that follows. For more complex macros I may also have multiple
-; implementations, e.g. the SSE2 and SSSE3 versions may have different permutations.
-;
-; Hence these macros. Insert a PERMUTE or some SWAPs at the end of a macro that
-; permutes its arguments. It's equivalent to exchanging the contents of the
-; registers, except that this way you exchange the register names instead, so it
-; doesn't cost any cycles.
-
-%macro PERMUTE 2-* ; takes a list of pairs to swap
-%rep %0/2
- %xdefine tmp%2 m%2
- %xdefine ntmp%2 nm%2
- %rotate 2
-%endrep
-%rep %0/2
- %xdefine m%1 tmp%2
- %xdefine nm%1 ntmp%2
- %undef tmp%2
- %undef ntmp%2
- %rotate 2
-%endrep
-%endmacro
-
-%macro SWAP 2-* ; swaps a single chain (sometimes more concise than pairs)
-%rep %0-1
-%ifdef m%1
- %xdefine tmp m%1
- %xdefine m%1 m%2
- %xdefine m%2 tmp
- CAT_XDEFINE n, m%1, %1
- CAT_XDEFINE n, m%2, %2
-%else
- ; If we were called as "SWAP m0,m1" rather than "SWAP 0,1" infer the original numbers here.
- ; Be careful using this mode in nested macros though, as in some cases there may be
- ; other copies of m# that have already been dereferenced and don't get updated correctly.
- %xdefine %%n1 n %+ %1
- %xdefine %%n2 n %+ %2
- %xdefine tmp m %+ %%n1
- CAT_XDEFINE m, %%n1, m %+ %%n2
- CAT_XDEFINE m, %%n2, tmp
- CAT_XDEFINE n, m %+ %%n1, %%n1
- CAT_XDEFINE n, m %+ %%n2, %%n2
-%endif
- %undef tmp
- %rotate 1
-%endrep
-%endmacro
-
-; If SAVE_MM_PERMUTATION is placed at the end of a function, then any later
-; calls to that function will automatically load the permutation, so values can
-; be returned in mmregs.
-%macro SAVE_MM_PERMUTATION 0-1
- %if %0
- %xdefine %%f %1_m
- %else
- %xdefine %%f current_function %+ _m
- %endif
- %assign %%i 0
- %rep num_mmregs
- CAT_XDEFINE %%f, %%i, m %+ %%i
- %assign %%i %%i+1
- %endrep
-%endmacro
-
-%macro LOAD_MM_PERMUTATION 1 ; name to load from
- %ifdef %1_m0
- %assign %%i 0
- %rep num_mmregs
- CAT_XDEFINE m, %%i, %1_m %+ %%i
- CAT_XDEFINE n, m %+ %%i, %%i
- %assign %%i %%i+1
- %endrep
- %endif
-%endmacro
-
-; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
-%macro call 1
- call_internal %1, %1 %+ SUFFIX
-%endmacro
-%macro call_internal 2
- %xdefine %%i %1
- %ifndef cglobaled_%1
- %ifdef cglobaled_%2
- %xdefine %%i %2
- %endif
- %endif
- call %%i
- LOAD_MM_PERMUTATION %%i
-%endmacro
-
-; Substitutions that reduce instruction size but are functionally equivalent
-%macro add 2
- %ifnum %2
- %if %2==128
- sub %1, -128
- %else
- add %1, %2
- %endif
- %else
- add %1, %2
- %endif
-%endmacro
-
-%macro sub 2
- %ifnum %2
- %if %2==128
- add %1, -128
- %else
- sub %1, %2
- %endif
- %else
- sub %1, %2
- %endif
-%endmacro
-
-;=============================================================================
-; AVX abstraction layer
-;=============================================================================
-
-%assign i 0
-%rep 16
- %if i < 8
- CAT_XDEFINE sizeofmm, i, 8
- %endif
- CAT_XDEFINE sizeofxmm, i, 16
- CAT_XDEFINE sizeofymm, i, 32
-%assign i i+1
-%endrep
-%undef i
-
-;%1 == instruction
-;%2 == 1 if float, 0 if int
-;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 2- or 3-operand (xmm, xmm, xmm)
-;%4 == number of operands given
-;%5+: operands
-%macro RUN_AVX_INSTR 6-7+
- %ifid %5
- %define %%size sizeof%5
- %else
- %define %%size mmsize
- %endif
- %if %%size==32
- %if %0 >= 7
- v%1 %5, %6, %7
- %else
- v%1 %5, %6
- %endif
- %else
- %if %%size==8
- %define %%regmov movq
- %elif %2
- %define %%regmov movaps
- %else
- %define %%regmov movdqa
- %endif
-
- %if %4>=3+%3
- %ifnidn %5, %6
- %if avx_enabled && sizeof%5==16
- v%1 %5, %6, %7
- %else
- %%regmov %5, %6
- %1 %5, %7
- %endif
- %else
- %1 %5, %7
- %endif
- %elif %3
- %1 %5, %6, %7
- %else
- %1 %5, %6
- %endif
- %endif
-%endmacro
-
-; 3arg AVX ops with a memory arg can only have it in src2,
-; whereas SSE emulation of 3arg prefers to have it in src1 (i.e. the mov).
-; So, if the op is symmetric and the wrong one is memory, swap them.
-%macro RUN_AVX_INSTR1 8
- %assign %%swap 0
- %if avx_enabled
- %ifnid %6
- %assign %%swap 1
- %endif
- %elifnidn %5, %6
- %ifnid %7
- %assign %%swap 1
- %endif
- %endif
- %if %%swap && %3 == 0 && %8 == 1
- RUN_AVX_INSTR %1, %2, %3, %4, %5, %7, %6
- %else
- RUN_AVX_INSTR %1, %2, %3, %4, %5, %6, %7
- %endif
-%endmacro
-
-;%1 == instruction
-;%2 == 1 if float, 0 if int
-;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 3-operand (xmm, xmm, xmm)
-;%4 == 1 if symmetric (i.e. doesn't matter which src arg is which), 0 if not
-%macro AVX_INSTR 4
- %macro %1 2-9 fnord, fnord, fnord, %1, %2, %3, %4
- %ifidn %3, fnord
- RUN_AVX_INSTR %6, %7, %8, 2, %1, %2
- %elifidn %4, fnord
- RUN_AVX_INSTR1 %6, %7, %8, 3, %1, %2, %3, %9
- %elifidn %5, fnord
- RUN_AVX_INSTR %6, %7, %8, 4, %1, %2, %3, %4
- %else
- RUN_AVX_INSTR %6, %7, %8, 5, %1, %2, %3, %4, %5
- %endif
- %endmacro
-%endmacro
-
-AVX_INSTR addpd, 1, 0, 1
-AVX_INSTR addps, 1, 0, 1
-AVX_INSTR addsd, 1, 0, 1
-AVX_INSTR addss, 1, 0, 1
-AVX_INSTR addsubpd, 1, 0, 0
-AVX_INSTR addsubps, 1, 0, 0
-AVX_INSTR andpd, 1, 0, 1
-AVX_INSTR andps, 1, 0, 1
-AVX_INSTR andnpd, 1, 0, 0
-AVX_INSTR andnps, 1, 0, 0
-AVX_INSTR blendpd, 1, 0, 0
-AVX_INSTR blendps, 1, 0, 0
-AVX_INSTR blendvpd, 1, 0, 0
-AVX_INSTR blendvps, 1, 0, 0
-AVX_INSTR cmppd, 1, 0, 0
-AVX_INSTR cmpps, 1, 0, 0
-AVX_INSTR cmpsd, 1, 0, 0
-AVX_INSTR cmpss, 1, 0, 0
-AVX_INSTR cvtdq2ps, 1, 0, 0
-AVX_INSTR cvtps2dq, 1, 0, 0
-AVX_INSTR divpd, 1, 0, 0
-AVX_INSTR divps, 1, 0, 0
-AVX_INSTR divsd, 1, 0, 0
-AVX_INSTR divss, 1, 0, 0
-AVX_INSTR dppd, 1, 1, 0
-AVX_INSTR dpps, 1, 1, 0
-AVX_INSTR haddpd, 1, 0, 0
-AVX_INSTR haddps, 1, 0, 0
-AVX_INSTR hsubpd, 1, 0, 0
-AVX_INSTR hsubps, 1, 0, 0
-AVX_INSTR maxpd, 1, 0, 1
-AVX_INSTR maxps, 1, 0, 1
-AVX_INSTR maxsd, 1, 0, 1
-AVX_INSTR maxss, 1, 0, 1
-AVX_INSTR minpd, 1, 0, 1
-AVX_INSTR minps, 1, 0, 1
-AVX_INSTR minsd, 1, 0, 1
-AVX_INSTR minss, 1, 0, 1
-AVX_INSTR movhlps, 1, 0, 0
-AVX_INSTR movlhps, 1, 0, 0
-AVX_INSTR movsd, 1, 0, 0
-AVX_INSTR movss, 1, 0, 0
-AVX_INSTR mpsadbw, 0, 1, 0
-AVX_INSTR mulpd, 1, 0, 1
-AVX_INSTR mulps, 1, 0, 1
-AVX_INSTR mulsd, 1, 0, 1
-AVX_INSTR mulss, 1, 0, 1
-AVX_INSTR orpd, 1, 0, 1
-AVX_INSTR orps, 1, 0, 1
-AVX_INSTR packsswb, 0, 0, 0
-AVX_INSTR packssdw, 0, 0, 0
-AVX_INSTR packuswb, 0, 0, 0
-AVX_INSTR packusdw, 0, 0, 0
-AVX_INSTR paddb, 0, 0, 1
-AVX_INSTR paddw, 0, 0, 1
-AVX_INSTR paddd, 0, 0, 1
-AVX_INSTR paddq, 0, 0, 1
-AVX_INSTR paddsb, 0, 0, 1
-AVX_INSTR paddsw, 0, 0, 1
-AVX_INSTR paddusb, 0, 0, 1
-AVX_INSTR paddusw, 0, 0, 1
-AVX_INSTR palignr, 0, 1, 0
-AVX_INSTR pand, 0, 0, 1
-AVX_INSTR pandn, 0, 0, 0
-AVX_INSTR pavgb, 0, 0, 1
-AVX_INSTR pavgw, 0, 0, 1
-AVX_INSTR pblendvb, 0, 0, 0
-AVX_INSTR pblendw, 0, 1, 0
-AVX_INSTR pcmpestri, 0, 0, 0
-AVX_INSTR pcmpestrm, 0, 0, 0
-AVX_INSTR pcmpistri, 0, 0, 0
-AVX_INSTR pcmpistrm, 0, 0, 0
-AVX_INSTR pcmpeqb, 0, 0, 1
-AVX_INSTR pcmpeqw, 0, 0, 1
-AVX_INSTR pcmpeqd, 0, 0, 1
-AVX_INSTR pcmpeqq, 0, 0, 1
-AVX_INSTR pcmpgtb, 0, 0, 0
-AVX_INSTR pcmpgtw, 0, 0, 0
-AVX_INSTR pcmpgtd, 0, 0, 0
-AVX_INSTR pcmpgtq, 0, 0, 0
-AVX_INSTR phaddw, 0, 0, 0
-AVX_INSTR phaddd, 0, 0, 0
-AVX_INSTR phaddsw, 0, 0, 0
-AVX_INSTR phsubw, 0, 0, 0
-AVX_INSTR phsubd, 0, 0, 0
-AVX_INSTR phsubsw, 0, 0, 0
-AVX_INSTR pmaddwd, 0, 0, 1
-AVX_INSTR pmaddubsw, 0, 0, 0
-AVX_INSTR pmaxsb, 0, 0, 1
-AVX_INSTR pmaxsw, 0, 0, 1
-AVX_INSTR pmaxsd, 0, 0, 1
-AVX_INSTR pmaxub, 0, 0, 1
-AVX_INSTR pmaxuw, 0, 0, 1
-AVX_INSTR pmaxud, 0, 0, 1
-AVX_INSTR pminsb, 0, 0, 1
-AVX_INSTR pminsw, 0, 0, 1
-AVX_INSTR pminsd, 0, 0, 1
-AVX_INSTR pminub, 0, 0, 1
-AVX_INSTR pminuw, 0, 0, 1
-AVX_INSTR pminud, 0, 0, 1
-AVX_INSTR pmulhuw, 0, 0, 1
-AVX_INSTR pmulhrsw, 0, 0, 1
-AVX_INSTR pmulhw, 0, 0, 1
-AVX_INSTR pmullw, 0, 0, 1
-AVX_INSTR pmulld, 0, 0, 1
-AVX_INSTR pmuludq, 0, 0, 1
-AVX_INSTR pmuldq, 0, 0, 1
-AVX_INSTR por, 0, 0, 1
-AVX_INSTR psadbw, 0, 0, 1
-AVX_INSTR pshufb, 0, 0, 0
-AVX_INSTR psignb, 0, 0, 0
-AVX_INSTR psignw, 0, 0, 0
-AVX_INSTR psignd, 0, 0, 0
-AVX_INSTR psllw, 0, 0, 0
-AVX_INSTR pslld, 0, 0, 0
-AVX_INSTR psllq, 0, 0, 0
-AVX_INSTR pslldq, 0, 0, 0
-AVX_INSTR psraw, 0, 0, 0
-AVX_INSTR psrad, 0, 0, 0
-AVX_INSTR psrlw, 0, 0, 0
-AVX_INSTR psrld, 0, 0, 0
-AVX_INSTR psrlq, 0, 0, 0
-AVX_INSTR psrldq, 0, 0, 0
-AVX_INSTR psubb, 0, 0, 0
-AVX_INSTR psubw, 0, 0, 0
-AVX_INSTR psubd, 0, 0, 0
-AVX_INSTR psubq, 0, 0, 0
-AVX_INSTR psubsb, 0, 0, 0
-AVX_INSTR psubsw, 0, 0, 0
-AVX_INSTR psubusb, 0, 0, 0
-AVX_INSTR psubusw, 0, 0, 0
-AVX_INSTR punpckhbw, 0, 0, 0
-AVX_INSTR punpckhwd, 0, 0, 0
-AVX_INSTR punpckhdq, 0, 0, 0
-AVX_INSTR punpckhqdq, 0, 0, 0
-AVX_INSTR punpcklbw, 0, 0, 0
-AVX_INSTR punpcklwd, 0, 0, 0
-AVX_INSTR punpckldq, 0, 0, 0
-AVX_INSTR punpcklqdq, 0, 0, 0
-AVX_INSTR pxor, 0, 0, 1
-AVX_INSTR shufps, 1, 1, 0
-AVX_INSTR subpd, 1, 0, 0
-AVX_INSTR subps, 1, 0, 0
-AVX_INSTR subsd, 1, 0, 0
-AVX_INSTR subss, 1, 0, 0
-AVX_INSTR unpckhpd, 1, 0, 0
-AVX_INSTR unpckhps, 1, 0, 0
-AVX_INSTR unpcklpd, 1, 0, 0
-AVX_INSTR unpcklps, 1, 0, 0
-AVX_INSTR xorpd, 1, 0, 1
-AVX_INSTR xorps, 1, 0, 1
-
-; 3DNow instructions, for sharing code between AVX, SSE and 3DN
-AVX_INSTR pfadd, 1, 0, 1
-AVX_INSTR pfsub, 1, 0, 0
-AVX_INSTR pfmul, 1, 0, 1
-
-; base-4 constants for shuffles
-%assign i 0
-%rep 256
- %assign j ((i>>6)&3)*1000 + ((i>>4)&3)*100 + ((i>>2)&3)*10 + (i&3)
- %if j < 10
- CAT_XDEFINE q000, j, i
- %elif j < 100
- CAT_XDEFINE q00, j, i
- %elif j < 1000
- CAT_XDEFINE q0, j, i
- %else
- CAT_XDEFINE q, j, i
- %endif
-%assign i i+1
-%endrep
-%undef i
-%undef j
-
-%macro FMA_INSTR 3
- %macro %1 4-7 %1, %2, %3
- %if cpuflag(xop)
- v%5 %1, %2, %3, %4
- %else
- %6 %1, %2, %3
- %7 %1, %4
- %endif
- %endmacro
-%endmacro
-
-FMA_INSTR pmacsdd, pmulld, paddd
-FMA_INSTR pmacsww, pmullw, paddw
-FMA_INSTR pmadcswd, pmaddwd, paddd
diff --git a/videocodec/libvpx_internal/libvpx/tools/all_builds.py b/videocodec/libvpx_internal/libvpx/tools/all_builds.py
deleted file mode 100644
index d1f0c80..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/all_builds.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/python
-
-import getopt
-import subprocess
-import sys
-
-LONG_OPTIONS = ["shard=", "shards="]
-BASE_COMMAND = "./configure --enable-internal-stats --enable-experimental"
-
-def RunCommand(command):
- run = subprocess.Popen(command, shell=True)
- output = run.communicate()
- if run.returncode:
- print "Non-zero return code: " + str(run.returncode) + " => exiting!"
- sys.exit(1)
-
-def list_of_experiments():
- experiments = []
- configure_file = open("configure")
- list_start = False
- for line in configure_file.read().split("\n"):
- if line == 'EXPERIMENT_LIST="':
- list_start = True
- elif line == '"':
- list_start = False
- elif list_start:
- currently_broken = ["csm"]
- experiment = line[4:]
- if experiment not in currently_broken:
- experiments.append(experiment)
- return experiments
-
-def main(argv):
- # Parse arguments
- options = {"--shard": 0, "--shards": 1}
- if "--" in argv:
- opt_end_index = argv.index("--")
- else:
- opt_end_index = len(argv)
- try:
- o, _ = getopt.getopt(argv[1:opt_end_index], None, LONG_OPTIONS)
- except getopt.GetoptError, err:
- print str(err)
- print "Usage: %s [--shard=<n> --shards=<n>] -- [configure flag ...]"%argv[0]
- sys.exit(2)
-
- options.update(o)
- extra_args = argv[opt_end_index + 1:]
-
- # Shard experiment list
- shard = int(options["--shard"])
- shards = int(options["--shards"])
- experiments = list_of_experiments()
- base_command = " ".join([BASE_COMMAND] + extra_args)
- configs = [base_command]
- configs += ["%s --enable-%s" % (base_command, e) for e in experiments]
- my_configs = zip(configs, range(len(configs)))
- my_configs = filter(lambda x: x[1] % shards == shard, my_configs)
- my_configs = [e[0] for e in my_configs]
-
- # Run configs for this shard
- for config in my_configs:
- test_build(config)
-
-def test_build(configure_command):
- print "\033[34m\033[47mTesting %s\033[0m" % (configure_command)
- RunCommand(configure_command)
- RunCommand("make clean")
- RunCommand("make")
-
-if __name__ == "__main__":
- main(sys.argv)
diff --git a/videocodec/libvpx_internal/libvpx/tools/author_first_release.sh b/videocodec/libvpx_internal/libvpx/tools/author_first_release.sh
deleted file mode 100644
index 7b0b797..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/author_first_release.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-##
-## List the release each author first contributed to.
-##
-## Usage: author_first_release.sh [TAGS]
-##
-## If the TAGS arguments are unspecified, all tags reported by `git tag`
-## will be considered.
-##
-tags=${@:-$(git tag)}
-for tag in $tags; do
- git shortlog -n -e -s $tag |
- cut -f2- |
- awk "{print \"${tag#v}\t\"\$0}"
-done | sort -k2 | uniq -f2
diff --git a/videocodec/libvpx_internal/libvpx/tools/cpplint.py b/videocodec/libvpx_internal/libvpx/tools/cpplint.py
deleted file mode 100644
index 25fbef7..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/cpplint.py
+++ /dev/null
@@ -1,4756 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2009 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Does google-lint on c++ files.
-
-The goal of this script is to identify places in the code that *may*
-be in non-compliance with google style. It does not attempt to fix
-up these problems -- the point is to educate. It does also not
-attempt to find all problems, or to ensure that everything it does
-find is legitimately a problem.
-
-In particular, we can get very confused by /* and // inside strings!
-We do a small hack, which is to ignore //'s with "'s after them on the
-same line, but it is far from perfect (in either direction).
-"""
-
-import codecs
-import copy
-import getopt
-import math # for log
-import os
-import re
-import sre_compile
-import string
-import sys
-import unicodedata
-
-
-_USAGE = """
-Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
- [--counting=total|toplevel|detailed] [--root=subdir]
- [--linelength=digits]
- <file> [file] ...
-
- The style guidelines this tries to follow are those in
- http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
-
- Every problem is given a confidence score from 1-5, with 5 meaning we are
- certain of the problem, and 1 meaning it could be a legitimate construct.
- This will miss some errors, and is not a substitute for a code review.
-
- To suppress false-positive errors of a certain category, add a
- 'NOLINT(category)' comment to the line. NOLINT or NOLINT(*)
- suppresses errors of all categories on that line.
-
- The files passed in will be linted; at least one file must be provided.
- Default linted extensions are .cc, .cpp, .cu, .cuh and .h. Change the
- extensions with the --extensions flag.
-
- Flags:
-
- output=vs7
- By default, the output is formatted to ease emacs parsing. Visual Studio
- compatible output (vs7) may also be used. Other formats are unsupported.
-
- verbose=#
- Specify a number 0-5 to restrict errors to certain verbosity levels.
-
- filter=-x,+y,...
- Specify a comma-separated list of category-filters to apply: only
- error messages whose category names pass the filters will be printed.
- (Category names are printed with the message and look like
- "[whitespace/indent]".) Filters are evaluated left to right.
- "-FOO" and "FOO" means "do not print categories that start with FOO".
- "+FOO" means "do print categories that start with FOO".
-
- Examples: --filter=-whitespace,+whitespace/braces
- --filter=whitespace,runtime/printf,+runtime/printf_format
- --filter=-,+build/include_what_you_use
-
- To see a list of all the categories used in cpplint, pass no arg:
- --filter=
-
- counting=total|toplevel|detailed
- The total number of errors found is always printed. If
- 'toplevel' is provided, then the count of errors in each of
- the top-level categories like 'build' and 'whitespace' will
- also be printed. If 'detailed' is provided, then a count
- is provided for each category like 'build/class'.
-
- root=subdir
- The root directory used for deriving header guard CPP variable.
- By default, the header guard CPP variable is calculated as the relative
- path to the directory that contains .git, .hg, or .svn. When this flag
- is specified, the relative path is calculated from the specified
- directory. If the specified directory does not exist, this flag is
- ignored.
-
- Examples:
- Assuing that src/.git exists, the header guard CPP variables for
- src/chrome/browser/ui/browser.h are:
-
- No flag => CHROME_BROWSER_UI_BROWSER_H_
- --root=chrome => BROWSER_UI_BROWSER_H_
- --root=chrome/browser => UI_BROWSER_H_
-
- linelength=digits
- This is the allowed line length for the project. The default value is
- 80 characters.
-
- Examples:
- --linelength=120
-
- extensions=extension,extension,...
- The allowed file extensions that cpplint will check
-
- Examples:
- --extensions=hpp,cpp
-"""
-
-# We categorize each error message we print. Here are the categories.
-# We want an explicit list so we can list them all in cpplint --filter=.
-# If you add a new error message with a new category, add it to the list
-# here! cpplint_unittest.py should tell you if you forget to do this.
-_ERROR_CATEGORIES = [
- 'build/class',
- 'build/deprecated',
- 'build/endif_comment',
- 'build/explicit_make_pair',
- 'build/forward_decl',
- 'build/header_guard',
- 'build/include',
- 'build/include_alpha',
- 'build/include_order',
- 'build/include_what_you_use',
- 'build/namespaces',
- 'build/printf_format',
- 'build/storage_class',
- 'legal/copyright',
- 'readability/alt_tokens',
- 'readability/braces',
- 'readability/casting',
- 'readability/check',
- 'readability/constructors',
- 'readability/fn_size',
- 'readability/function',
- 'readability/multiline_comment',
- 'readability/multiline_string',
- 'readability/namespace',
- 'readability/nolint',
- 'readability/nul',
- 'readability/streams',
- 'readability/todo',
- 'readability/utf8',
- 'runtime/arrays',
- 'runtime/casting',
- 'runtime/explicit',
- 'runtime/int',
- 'runtime/init',
- 'runtime/invalid_increment',
- 'runtime/member_string_references',
- 'runtime/memset',
- 'runtime/operator',
- 'runtime/printf',
- 'runtime/printf_format',
- 'runtime/references',
- 'runtime/sizeof',
- 'runtime/string',
- 'runtime/threadsafe_fn',
- 'runtime/vlog',
- 'whitespace/blank_line',
- 'whitespace/braces',
- 'whitespace/comma',
- 'whitespace/comments',
- 'whitespace/empty_conditional_body',
- 'whitespace/empty_loop_body',
- 'whitespace/end_of_line',
- 'whitespace/ending_newline',
- 'whitespace/forcolon',
- 'whitespace/indent',
- 'whitespace/line_length',
- 'whitespace/newline',
- 'whitespace/operators',
- 'whitespace/parens',
- 'whitespace/semicolon',
- 'whitespace/tab',
- 'whitespace/todo'
- ]
-
-# The default state of the category filter. This is overrided by the --filter=
-# flag. By default all errors are on, so only add here categories that should be
-# off by default (i.e., categories that must be enabled by the --filter= flags).
-# All entries here should start with a '-' or '+', as in the --filter= flag.
-_DEFAULT_FILTERS = ['-build/include_alpha']
-
-# We used to check for high-bit characters, but after much discussion we
-# decided those were OK, as long as they were in UTF-8 and didn't represent
-# hard-coded international strings, which belong in a separate i18n file.
-
-
-# C++ headers
-_CPP_HEADERS = frozenset([
- # Legacy
- 'algobase.h',
- 'algo.h',
- 'alloc.h',
- 'builtinbuf.h',
- 'bvector.h',
- 'complex.h',
- 'defalloc.h',
- 'deque.h',
- 'editbuf.h',
- 'fstream.h',
- 'function.h',
- 'hash_map',
- 'hash_map.h',
- 'hash_set',
- 'hash_set.h',
- 'hashtable.h',
- 'heap.h',
- 'indstream.h',
- 'iomanip.h',
- 'iostream.h',
- 'istream.h',
- 'iterator.h',
- 'list.h',
- 'map.h',
- 'multimap.h',
- 'multiset.h',
- 'ostream.h',
- 'pair.h',
- 'parsestream.h',
- 'pfstream.h',
- 'procbuf.h',
- 'pthread_alloc',
- 'pthread_alloc.h',
- 'rope',
- 'rope.h',
- 'ropeimpl.h',
- 'set.h',
- 'slist',
- 'slist.h',
- 'stack.h',
- 'stdiostream.h',
- 'stl_alloc.h',
- 'stl_relops.h',
- 'streambuf.h',
- 'stream.h',
- 'strfile.h',
- 'strstream.h',
- 'tempbuf.h',
- 'tree.h',
- 'type_traits.h',
- 'vector.h',
- # 17.6.1.2 C++ library headers
- 'algorithm',
- 'array',
- 'atomic',
- 'bitset',
- 'chrono',
- 'codecvt',
- 'complex',
- 'condition_variable',
- 'deque',
- 'exception',
- 'forward_list',
- 'fstream',
- 'functional',
- 'future',
- 'initializer_list',
- 'iomanip',
- 'ios',
- 'iosfwd',
- 'iostream',
- 'istream',
- 'iterator',
- 'limits',
- 'list',
- 'locale',
- 'map',
- 'memory',
- 'mutex',
- 'new',
- 'numeric',
- 'ostream',
- 'queue',
- 'random',
- 'ratio',
- 'regex',
- 'set',
- 'sstream',
- 'stack',
- 'stdexcept',
- 'streambuf',
- 'string',
- 'strstream',
- 'system_error',
- 'thread',
- 'tuple',
- 'typeindex',
- 'typeinfo',
- 'type_traits',
- 'unordered_map',
- 'unordered_set',
- 'utility',
- 'valarray',
- 'vector',
- # 17.6.1.2 C++ headers for C library facilities
- 'cassert',
- 'ccomplex',
- 'cctype',
- 'cerrno',
- 'cfenv',
- 'cfloat',
- 'cinttypes',
- 'ciso646',
- 'climits',
- 'clocale',
- 'cmath',
- 'csetjmp',
- 'csignal',
- 'cstdalign',
- 'cstdarg',
- 'cstdbool',
- 'cstddef',
- 'cstdint',
- 'cstdio',
- 'cstdlib',
- 'cstring',
- 'ctgmath',
- 'ctime',
- 'cuchar',
- 'cwchar',
- 'cwctype',
- ])
-
-# Assertion macros. These are defined in base/logging.h and
-# testing/base/gunit.h. Note that the _M versions need to come first
-# for substring matching to work.
-_CHECK_MACROS = [
- 'DCHECK', 'CHECK',
- 'EXPECT_TRUE_M', 'EXPECT_TRUE',
- 'ASSERT_TRUE_M', 'ASSERT_TRUE',
- 'EXPECT_FALSE_M', 'EXPECT_FALSE',
- 'ASSERT_FALSE_M', 'ASSERT_FALSE',
- ]
-
-# Replacement macros for CHECK/DCHECK/EXPECT_TRUE/EXPECT_FALSE
-_CHECK_REPLACEMENT = dict([(m, {}) for m in _CHECK_MACROS])
-
-for op, replacement in [('==', 'EQ'), ('!=', 'NE'),
- ('>=', 'GE'), ('>', 'GT'),
- ('<=', 'LE'), ('<', 'LT')]:
- _CHECK_REPLACEMENT['DCHECK'][op] = 'DCHECK_%s' % replacement
- _CHECK_REPLACEMENT['CHECK'][op] = 'CHECK_%s' % replacement
- _CHECK_REPLACEMENT['EXPECT_TRUE'][op] = 'EXPECT_%s' % replacement
- _CHECK_REPLACEMENT['ASSERT_TRUE'][op] = 'ASSERT_%s' % replacement
- _CHECK_REPLACEMENT['EXPECT_TRUE_M'][op] = 'EXPECT_%s_M' % replacement
- _CHECK_REPLACEMENT['ASSERT_TRUE_M'][op] = 'ASSERT_%s_M' % replacement
-
-for op, inv_replacement in [('==', 'NE'), ('!=', 'EQ'),
- ('>=', 'LT'), ('>', 'LE'),
- ('<=', 'GT'), ('<', 'GE')]:
- _CHECK_REPLACEMENT['EXPECT_FALSE'][op] = 'EXPECT_%s' % inv_replacement
- _CHECK_REPLACEMENT['ASSERT_FALSE'][op] = 'ASSERT_%s' % inv_replacement
- _CHECK_REPLACEMENT['EXPECT_FALSE_M'][op] = 'EXPECT_%s_M' % inv_replacement
- _CHECK_REPLACEMENT['ASSERT_FALSE_M'][op] = 'ASSERT_%s_M' % inv_replacement
-
-# Alternative tokens and their replacements. For full list, see section 2.5
-# Alternative tokens [lex.digraph] in the C++ standard.
-#
-# Digraphs (such as '%:') are not included here since it's a mess to
-# match those on a word boundary.
-_ALT_TOKEN_REPLACEMENT = {
- 'and': '&&',
- 'bitor': '|',
- 'or': '||',
- 'xor': '^',
- 'compl': '~',
- 'bitand': '&',
- 'and_eq': '&=',
- 'or_eq': '|=',
- 'xor_eq': '^=',
- 'not': '!',
- 'not_eq': '!='
- }
-
-# Compile regular expression that matches all the above keywords. The "[ =()]"
-# bit is meant to avoid matching these keywords outside of boolean expressions.
-#
-# False positives include C-style multi-line comments and multi-line strings
-# but those have always been troublesome for cpplint.
-_ALT_TOKEN_REPLACEMENT_PATTERN = re.compile(
- r'[ =()](' + ('|'.join(_ALT_TOKEN_REPLACEMENT.keys())) + r')(?=[ (]|$)')
-
-
-# These constants define types of headers for use with
-# _IncludeState.CheckNextIncludeOrder().
-_C_SYS_HEADER = 1
-_CPP_SYS_HEADER = 2
-_LIKELY_MY_HEADER = 3
-_POSSIBLE_MY_HEADER = 4
-_OTHER_HEADER = 5
-
-# These constants define the current inline assembly state
-_NO_ASM = 0 # Outside of inline assembly block
-_INSIDE_ASM = 1 # Inside inline assembly block
-_END_ASM = 2 # Last line of inline assembly block
-_BLOCK_ASM = 3 # The whole block is an inline assembly block
-
-# Match start of assembly blocks
-_MATCH_ASM = re.compile(r'^\s*(?:asm|_asm|__asm|__asm__)'
- r'(?:\s+(volatile|__volatile__))?'
- r'\s*[{(]')
-
-
-_regexp_compile_cache = {}
-
-# Finds occurrences of NOLINT or NOLINT(...).
-_RE_SUPPRESSION = re.compile(r'\bNOLINT\b(\([^)]*\))?')
-
-# {str, set(int)}: a map from error categories to sets of linenumbers
-# on which those errors are expected and should be suppressed.
-_error_suppressions = {}
-
-# The root directory used for deriving header guard CPP variable.
-# This is set by --root flag.
-_root = None
-
-# The allowed line length of files.
-# This is set by --linelength flag.
-_line_length = 80
-
-# The allowed extensions for file names
-# This is set by --extensions flag.
-_valid_extensions = set(['cc', 'h', 'cpp', 'cu', 'cuh'])
-
-def ParseNolintSuppressions(filename, raw_line, linenum, error):
- """Updates the global list of error-suppressions.
-
- Parses any NOLINT comments on the current line, updating the global
- error_suppressions store. Reports an error if the NOLINT comment
- was malformed.
-
- Args:
- filename: str, the name of the input file.
- raw_line: str, the line of input text, with comments.
- linenum: int, the number of the current line.
- error: function, an error handler.
- """
- # FIXME(adonovan): "NOLINT(" is misparsed as NOLINT(*).
- matched = _RE_SUPPRESSION.search(raw_line)
- if matched:
- category = matched.group(1)
- if category in (None, '(*)'): # => "suppress all"
- _error_suppressions.setdefault(None, set()).add(linenum)
- else:
- if category.startswith('(') and category.endswith(')'):
- category = category[1:-1]
- if category in _ERROR_CATEGORIES:
- _error_suppressions.setdefault(category, set()).add(linenum)
- else:
- error(filename, linenum, 'readability/nolint', 5,
- 'Unknown NOLINT error category: %s' % category)
-
-
-def ResetNolintSuppressions():
- "Resets the set of NOLINT suppressions to empty."
- _error_suppressions.clear()
-
-
-def IsErrorSuppressedByNolint(category, linenum):
- """Returns true if the specified error category is suppressed on this line.
-
- Consults the global error_suppressions map populated by
- ParseNolintSuppressions/ResetNolintSuppressions.
-
- Args:
- category: str, the category of the error.
- linenum: int, the current line number.
- Returns:
- bool, True iff the error should be suppressed due to a NOLINT comment.
- """
- return (linenum in _error_suppressions.get(category, set()) or
- linenum in _error_suppressions.get(None, set()))
-
-def Match(pattern, s):
- """Matches the string with the pattern, caching the compiled regexp."""
- # The regexp compilation caching is inlined in both Match and Search for
- # performance reasons; factoring it out into a separate function turns out
- # to be noticeably expensive.
- if pattern not in _regexp_compile_cache:
- _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
- return _regexp_compile_cache[pattern].match(s)
-
-
-def ReplaceAll(pattern, rep, s):
- """Replaces instances of pattern in a string with a replacement.
-
- The compiled regex is kept in a cache shared by Match and Search.
-
- Args:
- pattern: regex pattern
- rep: replacement text
- s: search string
-
- Returns:
- string with replacements made (or original string if no replacements)
- """
- if pattern not in _regexp_compile_cache:
- _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
- return _regexp_compile_cache[pattern].sub(rep, s)
-
-
-def Search(pattern, s):
- """Searches the string for the pattern, caching the compiled regexp."""
- if pattern not in _regexp_compile_cache:
- _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
- return _regexp_compile_cache[pattern].search(s)
-
-
-class _IncludeState(dict):
- """Tracks line numbers for includes, and the order in which includes appear.
-
- As a dict, an _IncludeState object serves as a mapping between include
- filename and line number on which that file was included.
-
- Call CheckNextIncludeOrder() once for each header in the file, passing
- in the type constants defined above. Calls in an illegal order will
- raise an _IncludeError with an appropriate error message.
-
- """
- # self._section will move monotonically through this set. If it ever
- # needs to move backwards, CheckNextIncludeOrder will raise an error.
- _INITIAL_SECTION = 0
- _MY_H_SECTION = 1
- _C_SECTION = 2
- _CPP_SECTION = 3
- _OTHER_H_SECTION = 4
-
- _TYPE_NAMES = {
- _C_SYS_HEADER: 'C system header',
- _CPP_SYS_HEADER: 'C++ system header',
- _LIKELY_MY_HEADER: 'header this file implements',
- _POSSIBLE_MY_HEADER: 'header this file may implement',
- _OTHER_HEADER: 'other header',
- }
- _SECTION_NAMES = {
- _INITIAL_SECTION: "... nothing. (This can't be an error.)",
- _MY_H_SECTION: 'a header this file implements',
- _C_SECTION: 'C system header',
- _CPP_SECTION: 'C++ system header',
- _OTHER_H_SECTION: 'other header',
- }
-
- def __init__(self):
- dict.__init__(self)
- self.ResetSection()
-
- def ResetSection(self):
- # The name of the current section.
- self._section = self._INITIAL_SECTION
- # The path of last found header.
- self._last_header = ''
-
- def SetLastHeader(self, header_path):
- self._last_header = header_path
-
- def CanonicalizeAlphabeticalOrder(self, header_path):
- """Returns a path canonicalized for alphabetical comparison.
-
- - replaces "-" with "_" so they both cmp the same.
- - removes '-inl' since we don't require them to be after the main header.
- - lowercase everything, just in case.
-
- Args:
- header_path: Path to be canonicalized.
-
- Returns:
- Canonicalized path.
- """
- return header_path.replace('-inl.h', '.h').replace('-', '_').lower()
-
- def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
- """Check if a header is in alphabetical order with the previous header.
-
- Args:
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- header_path: Canonicalized header to be checked.
-
- Returns:
- Returns true if the header is in alphabetical order.
- """
- # If previous section is different from current section, _last_header will
- # be reset to empty string, so it's always less than current header.
- #
- # If previous line was a blank line, assume that the headers are
- # intentionally sorted the way they are.
- if (self._last_header > header_path and
- not Match(r'^\s*$', clean_lines.elided[linenum - 1])):
- return False
- return True
-
- def CheckNextIncludeOrder(self, header_type):
- """Returns a non-empty error message if the next header is out of order.
-
- This function also updates the internal state to be ready to check
- the next include.
-
- Args:
- header_type: One of the _XXX_HEADER constants defined above.
-
- Returns:
- The empty string if the header is in the right order, or an
- error message describing what's wrong.
-
- """
- error_message = ('Found %s after %s' %
- (self._TYPE_NAMES[header_type],
- self._SECTION_NAMES[self._section]))
-
- last_section = self._section
-
- if header_type == _C_SYS_HEADER:
- if self._section <= self._C_SECTION:
- self._section = self._C_SECTION
- else:
- self._last_header = ''
- return error_message
- elif header_type == _CPP_SYS_HEADER:
- if self._section <= self._CPP_SECTION:
- self._section = self._CPP_SECTION
- else:
- self._last_header = ''
- return error_message
- elif header_type == _LIKELY_MY_HEADER:
- if self._section <= self._MY_H_SECTION:
- self._section = self._MY_H_SECTION
- else:
- self._section = self._OTHER_H_SECTION
- elif header_type == _POSSIBLE_MY_HEADER:
- if self._section <= self._MY_H_SECTION:
- self._section = self._MY_H_SECTION
- else:
- # This will always be the fallback because we're not sure
- # enough that the header is associated with this file.
- self._section = self._OTHER_H_SECTION
- else:
- assert header_type == _OTHER_HEADER
- self._section = self._OTHER_H_SECTION
-
- if last_section != self._section:
- self._last_header = ''
-
- return ''
-
-
-class _CppLintState(object):
- """Maintains module-wide state.."""
-
- def __init__(self):
- self.verbose_level = 1 # global setting.
- self.error_count = 0 # global count of reported errors
- # filters to apply when emitting error messages
- self.filters = _DEFAULT_FILTERS[:]
- self.counting = 'total' # In what way are we counting errors?
- self.errors_by_category = {} # string to int dict storing error counts
-
- # output format:
- # "emacs" - format that emacs can parse (default)
- # "vs7" - format that Microsoft Visual Studio 7 can parse
- self.output_format = 'emacs'
-
- def SetOutputFormat(self, output_format):
- """Sets the output format for errors."""
- self.output_format = output_format
-
- def SetVerboseLevel(self, level):
- """Sets the module's verbosity, and returns the previous setting."""
- last_verbose_level = self.verbose_level
- self.verbose_level = level
- return last_verbose_level
-
- def SetCountingStyle(self, counting_style):
- """Sets the module's counting options."""
- self.counting = counting_style
-
- def SetFilters(self, filters):
- """Sets the error-message filters.
-
- These filters are applied when deciding whether to emit a given
- error message.
-
- Args:
- filters: A string of comma-separated filters (eg "+whitespace/indent").
- Each filter should start with + or -; else we die.
-
- Raises:
- ValueError: The comma-separated filters did not all start with '+' or '-'.
- E.g. "-,+whitespace,-whitespace/indent,whitespace/badfilter"
- """
- # Default filters always have less priority than the flag ones.
- self.filters = _DEFAULT_FILTERS[:]
- for filt in filters.split(','):
- clean_filt = filt.strip()
- if clean_filt:
- self.filters.append(clean_filt)
- for filt in self.filters:
- if not (filt.startswith('+') or filt.startswith('-')):
- raise ValueError('Every filter in --filters must start with + or -'
- ' (%s does not)' % filt)
-
- def ResetErrorCounts(self):
- """Sets the module's error statistic back to zero."""
- self.error_count = 0
- self.errors_by_category = {}
-
- def IncrementErrorCount(self, category):
- """Bumps the module's error statistic."""
- self.error_count += 1
- if self.counting in ('toplevel', 'detailed'):
- if self.counting != 'detailed':
- category = category.split('/')[0]
- if category not in self.errors_by_category:
- self.errors_by_category[category] = 0
- self.errors_by_category[category] += 1
-
- def PrintErrorCounts(self):
- """Print a summary of errors by category, and the total."""
- for category, count in self.errors_by_category.iteritems():
- sys.stderr.write('Category \'%s\' errors found: %d\n' %
- (category, count))
- sys.stderr.write('Total errors found: %d\n' % self.error_count)
-
-_cpplint_state = _CppLintState()
-
-
-def _OutputFormat():
- """Gets the module's output format."""
- return _cpplint_state.output_format
-
-
-def _SetOutputFormat(output_format):
- """Sets the module's output format."""
- _cpplint_state.SetOutputFormat(output_format)
-
-
-def _VerboseLevel():
- """Returns the module's verbosity setting."""
- return _cpplint_state.verbose_level
-
-
-def _SetVerboseLevel(level):
- """Sets the module's verbosity, and returns the previous setting."""
- return _cpplint_state.SetVerboseLevel(level)
-
-
-def _SetCountingStyle(level):
- """Sets the module's counting options."""
- _cpplint_state.SetCountingStyle(level)
-
-
-def _Filters():
- """Returns the module's list of output filters, as a list."""
- return _cpplint_state.filters
-
-
-def _SetFilters(filters):
- """Sets the module's error-message filters.
-
- These filters are applied when deciding whether to emit a given
- error message.
-
- Args:
- filters: A string of comma-separated filters (eg "whitespace/indent").
- Each filter should start with + or -; else we die.
- """
- _cpplint_state.SetFilters(filters)
-
-
-class _FunctionState(object):
- """Tracks current function name and the number of lines in its body."""
-
- _NORMAL_TRIGGER = 250 # for --v=0, 500 for --v=1, etc.
- _TEST_TRIGGER = 400 # about 50% more than _NORMAL_TRIGGER.
-
- def __init__(self):
- self.in_a_function = False
- self.lines_in_function = 0
- self.current_function = ''
-
- def Begin(self, function_name):
- """Start analyzing function body.
-
- Args:
- function_name: The name of the function being tracked.
- """
- self.in_a_function = True
- self.lines_in_function = 0
- self.current_function = function_name
-
- def Count(self):
- """Count line in current function body."""
- if self.in_a_function:
- self.lines_in_function += 1
-
- def Check(self, error, filename, linenum):
- """Report if too many lines in function body.
-
- Args:
- error: The function to call with any errors found.
- filename: The name of the current file.
- linenum: The number of the line to check.
- """
- if Match(r'T(EST|est)', self.current_function):
- base_trigger = self._TEST_TRIGGER
- else:
- base_trigger = self._NORMAL_TRIGGER
- trigger = base_trigger * 2**_VerboseLevel()
-
- if self.lines_in_function > trigger:
- error_level = int(math.log(self.lines_in_function / base_trigger, 2))
- # 50 => 0, 100 => 1, 200 => 2, 400 => 3, 800 => 4, 1600 => 5, ...
- if error_level > 5:
- error_level = 5
- error(filename, linenum, 'readability/fn_size', error_level,
- 'Small and focused functions are preferred:'
- ' %s has %d non-comment lines'
- ' (error triggered by exceeding %d lines).' % (
- self.current_function, self.lines_in_function, trigger))
-
- def End(self):
- """Stop analyzing function body."""
- self.in_a_function = False
-
-
-class _IncludeError(Exception):
- """Indicates a problem with the include order in a file."""
- pass
-
-
-class FileInfo:
- """Provides utility functions for filenames.
-
- FileInfo provides easy access to the components of a file's path
- relative to the project root.
- """
-
- def __init__(self, filename):
- self._filename = filename
-
- def FullName(self):
- """Make Windows paths like Unix."""
- return os.path.abspath(self._filename).replace('\\', '/')
-
- def RepositoryName(self):
- """FullName after removing the local path to the repository.
-
- If we have a real absolute path name here we can try to do something smart:
- detecting the root of the checkout and truncating /path/to/checkout from
- the name so that we get header guards that don't include things like
- "C:\Documents and Settings\..." or "/home/username/..." in them and thus
- people on different computers who have checked the source out to different
- locations won't see bogus errors.
- """
- fullname = self.FullName()
-
- if os.path.exists(fullname):
- project_dir = os.path.dirname(fullname)
-
- if os.path.exists(os.path.join(project_dir, ".svn")):
- # If there's a .svn file in the current directory, we recursively look
- # up the directory tree for the top of the SVN checkout
- root_dir = project_dir
- one_up_dir = os.path.dirname(root_dir)
- while os.path.exists(os.path.join(one_up_dir, ".svn")):
- root_dir = os.path.dirname(root_dir)
- one_up_dir = os.path.dirname(one_up_dir)
-
- prefix = os.path.commonprefix([root_dir, project_dir])
- return fullname[len(prefix) + 1:]
-
- # Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by
- # searching up from the current path.
- root_dir = os.path.dirname(fullname)
- while (root_dir != os.path.dirname(root_dir) and
- not os.path.exists(os.path.join(root_dir, ".git")) and
- not os.path.exists(os.path.join(root_dir, ".hg")) and
- not os.path.exists(os.path.join(root_dir, ".svn"))):
- root_dir = os.path.dirname(root_dir)
-
- if (os.path.exists(os.path.join(root_dir, ".git")) or
- os.path.exists(os.path.join(root_dir, ".hg")) or
- os.path.exists(os.path.join(root_dir, ".svn"))):
- prefix = os.path.commonprefix([root_dir, project_dir])
- return fullname[len(prefix) + 1:]
-
- # Don't know what to do; header guard warnings may be wrong...
- return fullname
-
- def Split(self):
- """Splits the file into the directory, basename, and extension.
-
- For 'chrome/browser/browser.cc', Split() would
- return ('chrome/browser', 'browser', '.cc')
-
- Returns:
- A tuple of (directory, basename, extension).
- """
-
- googlename = self.RepositoryName()
- project, rest = os.path.split(googlename)
- return (project,) + os.path.splitext(rest)
-
- def BaseName(self):
- """File base name - text after the final slash, before the final period."""
- return self.Split()[1]
-
- def Extension(self):
- """File extension - text following the final period."""
- return self.Split()[2]
-
- def NoExtension(self):
- """File has no source file extension."""
- return '/'.join(self.Split()[0:2])
-
- def IsSource(self):
- """File has a source file extension."""
- return self.Extension()[1:] in ('c', 'cc', 'cpp', 'cxx')
-
-
-def _ShouldPrintError(category, confidence, linenum):
- """If confidence >= verbose, category passes filter and is not suppressed."""
-
- # There are three ways we might decide not to print an error message:
- # a "NOLINT(category)" comment appears in the source,
- # the verbosity level isn't high enough, or the filters filter it out.
- if IsErrorSuppressedByNolint(category, linenum):
- return False
- if confidence < _cpplint_state.verbose_level:
- return False
-
- is_filtered = False
- for one_filter in _Filters():
- if one_filter.startswith('-'):
- if category.startswith(one_filter[1:]):
- is_filtered = True
- elif one_filter.startswith('+'):
- if category.startswith(one_filter[1:]):
- is_filtered = False
- else:
- assert False # should have been checked for in SetFilter.
- if is_filtered:
- return False
-
- return True
-
-
-def Error(filename, linenum, category, confidence, message):
- """Logs the fact we've found a lint error.
-
- We log where the error was found, and also our confidence in the error,
- that is, how certain we are this is a legitimate style regression, and
- not a misidentification or a use that's sometimes justified.
-
- False positives can be suppressed by the use of
- "cpplint(category)" comments on the offending line. These are
- parsed into _error_suppressions.
-
- Args:
- filename: The name of the file containing the error.
- linenum: The number of the line containing the error.
- category: A string used to describe the "category" this bug
- falls under: "whitespace", say, or "runtime". Categories
- may have a hierarchy separated by slashes: "whitespace/indent".
- confidence: A number from 1-5 representing a confidence score for
- the error, with 5 meaning that we are certain of the problem,
- and 1 meaning that it could be a legitimate construct.
- message: The error message.
- """
- if _ShouldPrintError(category, confidence, linenum):
- _cpplint_state.IncrementErrorCount(category)
- if _cpplint_state.output_format == 'vs7':
- sys.stderr.write('%s(%s): %s [%s] [%d]\n' % (
- filename, linenum, message, category, confidence))
- elif _cpplint_state.output_format == 'eclipse':
- sys.stderr.write('%s:%s: warning: %s [%s] [%d]\n' % (
- filename, linenum, message, category, confidence))
- else:
- sys.stderr.write('%s:%s: %s [%s] [%d]\n' % (
- filename, linenum, message, category, confidence))
-
-
-# Matches standard C++ escape sequences per 2.13.2.3 of the C++ standard.
-_RE_PATTERN_CLEANSE_LINE_ESCAPES = re.compile(
- r'\\([abfnrtv?"\\\']|\d+|x[0-9a-fA-F]+)')
-# Matches strings. Escape codes should already be removed by ESCAPES.
-_RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES = re.compile(r'"[^"]*"')
-# Matches characters. Escape codes should already be removed by ESCAPES.
-_RE_PATTERN_CLEANSE_LINE_SINGLE_QUOTES = re.compile(r"'.'")
-# Matches multi-line C++ comments.
-# This RE is a little bit more complicated than one might expect, because we
-# have to take care of space removals tools so we can handle comments inside
-# statements better.
-# The current rule is: We only clear spaces from both sides when we're at the
-# end of the line. Otherwise, we try to remove spaces from the right side,
-# if this doesn't work we try on left side but only if there's a non-character
-# on the right.
-_RE_PATTERN_CLEANSE_LINE_C_COMMENTS = re.compile(
- r"""(\s*/\*.*\*/\s*$|
- /\*.*\*/\s+|
- \s+/\*.*\*/(?=\W)|
- /\*.*\*/)""", re.VERBOSE)
-
-
-def IsCppString(line):
- """Does line terminate so, that the next symbol is in string constant.
-
- This function does not consider single-line nor multi-line comments.
-
- Args:
- line: is a partial line of code starting from the 0..n.
-
- Returns:
- True, if next character appended to 'line' is inside a
- string constant.
- """
-
- line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
- return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1
-
-
-def CleanseRawStrings(raw_lines):
- """Removes C++11 raw strings from lines.
-
- Before:
- static const char kData[] = R"(
- multi-line string
- )";
-
- After:
- static const char kData[] = ""
- (replaced by blank line)
- "";
-
- Args:
- raw_lines: list of raw lines.
-
- Returns:
- list of lines with C++11 raw strings replaced by empty strings.
- """
-
- delimiter = None
- lines_without_raw_strings = []
- for line in raw_lines:
- if delimiter:
- # Inside a raw string, look for the end
- end = line.find(delimiter)
- if end >= 0:
- # Found the end of the string, match leading space for this
- # line and resume copying the original lines, and also insert
- # a "" on the last line.
- leading_space = Match(r'^(\s*)\S', line)
- line = leading_space.group(1) + '""' + line[end + len(delimiter):]
- delimiter = None
- else:
- # Haven't found the end yet, append a blank line.
- line = ''
-
- else:
- # Look for beginning of a raw string.
- # See 2.14.15 [lex.string] for syntax.
- matched = Match(r'^(.*)\b(?:R|u8R|uR|UR|LR)"([^\s\\()]*)\((.*)$', line)
- if matched:
- delimiter = ')' + matched.group(2) + '"'
-
- end = matched.group(3).find(delimiter)
- if end >= 0:
- # Raw string ended on same line
- line = (matched.group(1) + '""' +
- matched.group(3)[end + len(delimiter):])
- delimiter = None
- else:
- # Start of a multi-line raw string
- line = matched.group(1) + '""'
-
- lines_without_raw_strings.append(line)
-
- # TODO(unknown): if delimiter is not None here, we might want to
- # emit a warning for unterminated string.
- return lines_without_raw_strings
-
-
-def FindNextMultiLineCommentStart(lines, lineix):
- """Find the beginning marker for a multiline comment."""
- while lineix < len(lines):
- if lines[lineix].strip().startswith('/*'):
- # Only return this marker if the comment goes beyond this line
- if lines[lineix].strip().find('*/', 2) < 0:
- return lineix
- lineix += 1
- return len(lines)
-
-
-def FindNextMultiLineCommentEnd(lines, lineix):
- """We are inside a comment, find the end marker."""
- while lineix < len(lines):
- if lines[lineix].strip().endswith('*/'):
- return lineix
- lineix += 1
- return len(lines)
-
-
-def RemoveMultiLineCommentsFromRange(lines, begin, end):
- """Clears a range of lines for multi-line comments."""
- # Having // dummy comments makes the lines non-empty, so we will not get
- # unnecessary blank line warnings later in the code.
- for i in range(begin, end):
- lines[i] = '// dummy'
-
-
-def RemoveMultiLineComments(filename, lines, error):
- """Removes multiline (c-style) comments from lines."""
- lineix = 0
- while lineix < len(lines):
- lineix_begin = FindNextMultiLineCommentStart(lines, lineix)
- if lineix_begin >= len(lines):
- return
- lineix_end = FindNextMultiLineCommentEnd(lines, lineix_begin)
- if lineix_end >= len(lines):
- error(filename, lineix_begin + 1, 'readability/multiline_comment', 5,
- 'Could not find end of multi-line comment')
- return
- RemoveMultiLineCommentsFromRange(lines, lineix_begin, lineix_end + 1)
- lineix = lineix_end + 1
-
-
-def CleanseComments(line):
- """Removes //-comments and single-line C-style /* */ comments.
-
- Args:
- line: A line of C++ source.
-
- Returns:
- The line with single-line comments removed.
- """
- commentpos = line.find('//')
- if commentpos != -1 and not IsCppString(line[:commentpos]):
- line = line[:commentpos].rstrip()
- # get rid of /* ... */
- return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
-
-
-class CleansedLines(object):
- """Holds 3 copies of all lines with different preprocessing applied to them.
-
- 1) elided member contains lines without strings and comments,
- 2) lines member contains lines without comments, and
- 3) raw_lines member contains all the lines without processing.
- All these three members are of <type 'list'>, and of the same length.
- """
-
- def __init__(self, lines):
- self.elided = []
- self.lines = []
- self.raw_lines = lines
- self.num_lines = len(lines)
- self.lines_without_raw_strings = CleanseRawStrings(lines)
- for linenum in range(len(self.lines_without_raw_strings)):
- self.lines.append(CleanseComments(
- self.lines_without_raw_strings[linenum]))
- elided = self._CollapseStrings(self.lines_without_raw_strings[linenum])
- self.elided.append(CleanseComments(elided))
-
- def NumLines(self):
- """Returns the number of lines represented."""
- return self.num_lines
-
- @staticmethod
- def _CollapseStrings(elided):
- """Collapses strings and chars on a line to simple "" or '' blocks.
-
- We nix strings first so we're not fooled by text like '"http://"'
-
- Args:
- elided: The line being processed.
-
- Returns:
- The line with collapsed strings.
- """
- if not _RE_PATTERN_INCLUDE.match(elided):
- # Remove escaped characters first to make quote/single quote collapsing
- # basic. Things that look like escaped characters shouldn't occur
- # outside of strings and chars.
- elided = _RE_PATTERN_CLEANSE_LINE_ESCAPES.sub('', elided)
- elided = _RE_PATTERN_CLEANSE_LINE_SINGLE_QUOTES.sub("''", elided)
- elided = _RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES.sub('""', elided)
- return elided
-
-
-def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
- """Find the position just after the matching endchar.
-
- Args:
- line: a CleansedLines line.
- startpos: start searching at this position.
- depth: nesting level at startpos.
- startchar: expression opening character.
- endchar: expression closing character.
-
- Returns:
- On finding matching endchar: (index just after matching endchar, 0)
- Otherwise: (-1, new depth at end of this line)
- """
- for i in xrange(startpos, len(line)):
- if line[i] == startchar:
- depth += 1
- elif line[i] == endchar:
- depth -= 1
- if depth == 0:
- return (i + 1, 0)
- return (-1, depth)
-
-
-def CloseExpression(clean_lines, linenum, pos):
- """If input points to ( or { or [ or <, finds the position that closes it.
-
- If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
- linenum/pos that correspond to the closing of the expression.
-
- Args:
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- pos: A position on the line.
-
- Returns:
- A tuple (line, linenum, pos) pointer *past* the closing brace, or
- (line, len(lines), -1) if we never find a close. Note we ignore
- strings and comments when matching; and the line we return is the
- 'cleansed' line at linenum.
- """
-
- line = clean_lines.elided[linenum]
- startchar = line[pos]
- if startchar not in '({[<':
- return (line, clean_lines.NumLines(), -1)
- if startchar == '(': endchar = ')'
- if startchar == '[': endchar = ']'
- if startchar == '{': endchar = '}'
- if startchar == '<': endchar = '>'
-
- # Check first line
- (end_pos, num_open) = FindEndOfExpressionInLine(
- line, pos, 0, startchar, endchar)
- if end_pos > -1:
- return (line, linenum, end_pos)
-
- # Continue scanning forward
- while linenum < clean_lines.NumLines() - 1:
- linenum += 1
- line = clean_lines.elided[linenum]
- (end_pos, num_open) = FindEndOfExpressionInLine(
- line, 0, num_open, startchar, endchar)
- if end_pos > -1:
- return (line, linenum, end_pos)
-
- # Did not find endchar before end of file, give up
- return (line, clean_lines.NumLines(), -1)
-
-
-def FindStartOfExpressionInLine(line, endpos, depth, startchar, endchar):
- """Find position at the matching startchar.
-
- This is almost the reverse of FindEndOfExpressionInLine, but note
- that the input position and returned position differs by 1.
-
- Args:
- line: a CleansedLines line.
- endpos: start searching at this position.
- depth: nesting level at endpos.
- startchar: expression opening character.
- endchar: expression closing character.
-
- Returns:
- On finding matching startchar: (index at matching startchar, 0)
- Otherwise: (-1, new depth at beginning of this line)
- """
- for i in xrange(endpos, -1, -1):
- if line[i] == endchar:
- depth += 1
- elif line[i] == startchar:
- depth -= 1
- if depth == 0:
- return (i, 0)
- return (-1, depth)
-
-
-def ReverseCloseExpression(clean_lines, linenum, pos):
- """If input points to ) or } or ] or >, finds the position that opens it.
-
- If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
- linenum/pos that correspond to the opening of the expression.
-
- Args:
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- pos: A position on the line.
-
- Returns:
- A tuple (line, linenum, pos) pointer *at* the opening brace, or
- (line, 0, -1) if we never find the matching opening brace. Note
- we ignore strings and comments when matching; and the line we
- return is the 'cleansed' line at linenum.
- """
- line = clean_lines.elided[linenum]
- endchar = line[pos]
- if endchar not in ')}]>':
- return (line, 0, -1)
- if endchar == ')': startchar = '('
- if endchar == ']': startchar = '['
- if endchar == '}': startchar = '{'
- if endchar == '>': startchar = '<'
-
- # Check last line
- (start_pos, num_open) = FindStartOfExpressionInLine(
- line, pos, 0, startchar, endchar)
- if start_pos > -1:
- return (line, linenum, start_pos)
-
- # Continue scanning backward
- while linenum > 0:
- linenum -= 1
- line = clean_lines.elided[linenum]
- (start_pos, num_open) = FindStartOfExpressionInLine(
- line, len(line) - 1, num_open, startchar, endchar)
- if start_pos > -1:
- return (line, linenum, start_pos)
-
- # Did not find startchar before beginning of file, give up
- return (line, 0, -1)
-
-
-def CheckForCopyright(filename, lines, error):
- """Logs an error if no Copyright message appears at the top of the file."""
-
- # We'll say it should occur by line 10. Don't forget there's a
- # dummy line at the front.
- for line in xrange(1, min(len(lines), 11)):
- if re.search(r'Copyright', lines[line], re.I): break
- else: # means no copyright line was found
- error(filename, 0, 'legal/copyright', 5,
- 'No copyright message found. '
- 'You should have a line: "Copyright [year] <Copyright Owner>"')
-
-
-def GetHeaderGuardCPPVariable(filename):
- """Returns the CPP variable that should be used as a header guard.
-
- Args:
- filename: The name of a C++ header file.
-
- Returns:
- The CPP variable that should be used as a header guard in the
- named file.
-
- """
-
- # Restores original filename in case that cpplint is invoked from Emacs's
- # flymake.
- filename = re.sub(r'_flymake\.h$', '.h', filename)
- filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
-
- fileinfo = FileInfo(filename)
- file_path_from_root = fileinfo.RepositoryName()
- if _root:
- file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root)
- return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_'
-
-
-def CheckForHeaderGuard(filename, lines, error):
- """Checks that the file contains a header guard.
-
- Logs an error if no #ifndef header guard is present. For other
- headers, checks that the full pathname is used.
-
- Args:
- filename: The name of the C++ header file.
- lines: An array of strings, each representing a line of the file.
- error: The function to call with any errors found.
- """
-
- cppvar = GetHeaderGuardCPPVariable(filename)
-
- ifndef = None
- ifndef_linenum = 0
- define = None
- endif = None
- endif_linenum = 0
- for linenum, line in enumerate(lines):
- linesplit = line.split()
- if len(linesplit) >= 2:
- # find the first occurrence of #ifndef and #define, save arg
- if not ifndef and linesplit[0] == '#ifndef':
- # set ifndef to the header guard presented on the #ifndef line.
- ifndef = linesplit[1]
- ifndef_linenum = linenum
- if not define and linesplit[0] == '#define':
- define = linesplit[1]
- # find the last occurrence of #endif, save entire line
- if line.startswith('#endif'):
- endif = line
- endif_linenum = linenum
-
- if not ifndef:
- error(filename, 0, 'build/header_guard', 5,
- 'No #ifndef header guard found, suggested CPP variable is: %s' %
- cppvar)
- return
-
- if not define:
- error(filename, 0, 'build/header_guard', 5,
- 'No #define header guard found, suggested CPP variable is: %s' %
- cppvar)
- return
-
- # The guard should be PATH_FILE_H_, but we also allow PATH_FILE_H__
- # for backward compatibility.
- if ifndef != cppvar:
- error_level = 0
- if ifndef != cppvar + '_':
- error_level = 5
-
- ParseNolintSuppressions(filename, lines[ifndef_linenum], ifndef_linenum,
- error)
- error(filename, ifndef_linenum, 'build/header_guard', error_level,
- '#ifndef header guard has wrong style, please use: %s' % cppvar)
-
- if define != ifndef:
- error(filename, 0, 'build/header_guard', 5,
- '#ifndef and #define don\'t match, suggested CPP variable is: %s' %
- cppvar)
- return
-
- if endif != ('#endif // %s' % cppvar):
- error_level = 0
- if endif != ('#endif // %s' % (cppvar + '_')):
- error_level = 5
-
- ParseNolintSuppressions(filename, lines[endif_linenum], endif_linenum,
- error)
- error(filename, endif_linenum, 'build/header_guard', error_level,
- '#endif line should be "#endif // %s"' % cppvar)
-
-
-def CheckForBadCharacters(filename, lines, error):
- """Logs an error for each line containing bad characters.
-
- Two kinds of bad characters:
-
- 1. Unicode replacement characters: These indicate that either the file
- contained invalid UTF-8 (likely) or Unicode replacement characters (which
- it shouldn't). Note that it's possible for this to throw off line
- numbering if the invalid UTF-8 occurred adjacent to a newline.
-
- 2. NUL bytes. These are problematic for some tools.
-
- Args:
- filename: The name of the current file.
- lines: An array of strings, each representing a line of the file.
- error: The function to call with any errors found.
- """
- for linenum, line in enumerate(lines):
- if u'\ufffd' in line:
- error(filename, linenum, 'readability/utf8', 5,
- 'Line contains invalid UTF-8 (or Unicode replacement character).')
- if '\0' in line:
- error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.')
-
-
-def CheckForNewlineAtEOF(filename, lines, error):
- """Logs an error if there is no newline char at the end of the file.
-
- Args:
- filename: The name of the current file.
- lines: An array of strings, each representing a line of the file.
- error: The function to call with any errors found.
- """
-
- # The array lines() was created by adding two newlines to the
- # original file (go figure), then splitting on \n.
- # To verify that the file ends in \n, we just have to make sure the
- # last-but-two element of lines() exists and is empty.
- if len(lines) < 3 or lines[-2]:
- error(filename, len(lines) - 2, 'whitespace/ending_newline', 5,
- 'Could not find a newline character at the end of the file.')
-
-
-def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
- """Logs an error if we see /* ... */ or "..." that extend past one line.
-
- /* ... */ comments are legit inside macros, for one line.
- Otherwise, we prefer // comments, so it's ok to warn about the
- other. Likewise, it's ok for strings to extend across multiple
- lines, as long as a line continuation character (backslash)
- terminates each line. Although not currently prohibited by the C++
- style guide, it's ugly and unnecessary. We don't do well with either
- in this lint program, so we warn about both.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum]
-
- # Remove all \\ (escaped backslashes) from the line. They are OK, and the
- # second (escaped) slash may trigger later \" detection erroneously.
- line = line.replace('\\\\', '')
-
- if line.count('/*') > line.count('*/'):
- error(filename, linenum, 'readability/multiline_comment', 5,
- 'Complex multi-line /*...*/-style comment found. '
- 'Lint may give bogus warnings. '
- 'Consider replacing these with //-style comments, '
- 'with #if 0...#endif, '
- 'or with more clearly structured multi-line comments.')
-
- if (line.count('"') - line.count('\\"')) % 2:
- error(filename, linenum, 'readability/multiline_string', 5,
- 'Multi-line string ("...") found. This lint script doesn\'t '
- 'do well with such strings, and may give bogus warnings. '
- 'Use C++11 raw strings or concatenation instead.')
-
-
-threading_list = (
- ('asctime(', 'asctime_r('),
- ('ctime(', 'ctime_r('),
- ('getgrgid(', 'getgrgid_r('),
- ('getgrnam(', 'getgrnam_r('),
- ('getlogin(', 'getlogin_r('),
- ('getpwnam(', 'getpwnam_r('),
- ('getpwuid(', 'getpwuid_r('),
- ('gmtime(', 'gmtime_r('),
- ('localtime(', 'localtime_r('),
- ('rand(', 'rand_r('),
- ('strtok(', 'strtok_r('),
- ('ttyname(', 'ttyname_r('),
- )
-
-
-def CheckPosixThreading(filename, clean_lines, linenum, error):
- """Checks for calls to thread-unsafe functions.
-
- Much code has been originally written without consideration of
- multi-threading. Also, engineers are relying on their old experience;
- they have learned posix before threading extensions were added. These
- tests guide the engineers to use thread-safe functions (when using
- posix directly).
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum]
- for single_thread_function, multithread_safe_function in threading_list:
- ix = line.find(single_thread_function)
- # Comparisons made explicit for clarity -- pylint: disable=g-explicit-bool-comparison
- if ix >= 0 and (ix == 0 or (not line[ix - 1].isalnum() and
- line[ix - 1] not in ('_', '.', '>'))):
- error(filename, linenum, 'runtime/threadsafe_fn', 2,
- 'Consider using ' + multithread_safe_function +
- '...) instead of ' + single_thread_function +
- '...) for improved thread safety.')
-
-
-def CheckVlogArguments(filename, clean_lines, linenum, error):
- """Checks that VLOG() is only used for defining a logging level.
-
- For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
- VLOG(FATAL) are not.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum]
- if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line):
- error(filename, linenum, 'runtime/vlog', 5,
- 'VLOG() should be used with numeric verbosity level. '
- 'Use LOG() if you want symbolic severity levels.')
-
-
-# Matches invalid increment: *count++, which moves pointer instead of
-# incrementing a value.
-_RE_PATTERN_INVALID_INCREMENT = re.compile(
- r'^\s*\*\w+(\+\+|--);')
-
-
-def CheckInvalidIncrement(filename, clean_lines, linenum, error):
- """Checks for invalid increment *count++.
-
- For example following function:
- void increment_counter(int* count) {
- *count++;
- }
- is invalid, because it effectively does count++, moving pointer, and should
- be replaced with ++*count, (*count)++ or *count += 1.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum]
- if _RE_PATTERN_INVALID_INCREMENT.match(line):
- error(filename, linenum, 'runtime/invalid_increment', 5,
- 'Changing pointer instead of value (or unused value of operator*).')
-
-
-class _BlockInfo(object):
- """Stores information about a generic block of code."""
-
- def __init__(self, seen_open_brace):
- self.seen_open_brace = seen_open_brace
- self.open_parentheses = 0
- self.inline_asm = _NO_ASM
-
- def CheckBegin(self, filename, clean_lines, linenum, error):
- """Run checks that applies to text up to the opening brace.
-
- This is mostly for checking the text after the class identifier
- and the "{", usually where the base class is specified. For other
- blocks, there isn't much to check, so we always pass.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- pass
-
- def CheckEnd(self, filename, clean_lines, linenum, error):
- """Run checks that applies to text after the closing brace.
-
- This is mostly used for checking end of namespace comments.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- pass
-
-
-class _ClassInfo(_BlockInfo):
- """Stores information about a class."""
-
- def __init__(self, name, class_or_struct, clean_lines, linenum):
- _BlockInfo.__init__(self, False)
- self.name = name
- self.starting_linenum = linenum
- self.is_derived = False
- if class_or_struct == 'struct':
- self.access = 'public'
- self.is_struct = True
- else:
- self.access = 'private'
- self.is_struct = False
-
- # Remember initial indentation level for this class. Using raw_lines here
- # instead of elided to account for leading comments.
- initial_indent = Match(r'^( *)\S', clean_lines.raw_lines[linenum])
- if initial_indent:
- self.class_indent = len(initial_indent.group(1))
- else:
- self.class_indent = 0
-
- # Try to find the end of the class. This will be confused by things like:
- # class A {
- # } *x = { ...
- #
- # But it's still good enough for CheckSectionSpacing.
- self.last_line = 0
- depth = 0
- for i in range(linenum, clean_lines.NumLines()):
- line = clean_lines.elided[i]
- depth += line.count('{') - line.count('}')
- if not depth:
- self.last_line = i
- break
-
- def CheckBegin(self, filename, clean_lines, linenum, error):
- # Look for a bare ':'
- if Search('(^|[^:]):($|[^:])', clean_lines.elided[linenum]):
- self.is_derived = True
-
- def CheckEnd(self, filename, clean_lines, linenum, error):
- # Check that closing brace is aligned with beginning of the class.
- # Only do this if the closing brace is indented by only whitespaces.
- # This means we will not check single-line class definitions.
- indent = Match(r'^( *)\}', clean_lines.elided[linenum])
- if indent and len(indent.group(1)) != self.class_indent:
- if self.is_struct:
- parent = 'struct ' + self.name
- else:
- parent = 'class ' + self.name
- error(filename, linenum, 'whitespace/indent', 3,
- 'Closing brace should be aligned with beginning of %s' % parent)
-
-
-class _NamespaceInfo(_BlockInfo):
- """Stores information about a namespace."""
-
- def __init__(self, name, linenum):
- _BlockInfo.__init__(self, False)
- self.name = name or ''
- self.starting_linenum = linenum
-
- def CheckEnd(self, filename, clean_lines, linenum, error):
- """Check end of namespace comments."""
- line = clean_lines.raw_lines[linenum]
-
- # Check how many lines is enclosed in this namespace. Don't issue
- # warning for missing namespace comments if there aren't enough
- # lines. However, do apply checks if there is already an end of
- # namespace comment and it's incorrect.
- #
- # TODO(unknown): We always want to check end of namespace comments
- # if a namespace is large, but sometimes we also want to apply the
- # check if a short namespace contained nontrivial things (something
- # other than forward declarations). There is currently no logic on
- # deciding what these nontrivial things are, so this check is
- # triggered by namespace size only, which works most of the time.
- if (linenum - self.starting_linenum < 10
- and not Match(r'};*\s*(//|/\*).*\bnamespace\b', line)):
- return
-
- # Look for matching comment at end of namespace.
- #
- # Note that we accept C style "/* */" comments for terminating
- # namespaces, so that code that terminate namespaces inside
- # preprocessor macros can be cpplint clean.
- #
- # We also accept stuff like "// end of namespace <name>." with the
- # period at the end.
- #
- # Besides these, we don't accept anything else, otherwise we might
- # get false negatives when existing comment is a substring of the
- # expected namespace.
- if self.name:
- # Named namespace
- if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
- r'[\*/\.\\\s]*$'),
- line):
- error(filename, linenum, 'readability/namespace', 5,
- 'Namespace should be terminated with "// namespace %s"' %
- self.name)
- else:
- # Anonymous namespace
- if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
- error(filename, linenum, 'readability/namespace', 5,
- 'Namespace should be terminated with "// namespace"')
-
-
-class _PreprocessorInfo(object):
- """Stores checkpoints of nesting stacks when #if/#else is seen."""
-
- def __init__(self, stack_before_if):
- # The entire nesting stack before #if
- self.stack_before_if = stack_before_if
-
- # The entire nesting stack up to #else
- self.stack_before_else = []
-
- # Whether we have already seen #else or #elif
- self.seen_else = False
-
-
-class _NestingState(object):
- """Holds states related to parsing braces."""
-
- def __init__(self):
- # Stack for tracking all braces. An object is pushed whenever we
- # see a "{", and popped when we see a "}". Only 3 types of
- # objects are possible:
- # - _ClassInfo: a class or struct.
- # - _NamespaceInfo: a namespace.
- # - _BlockInfo: some other type of block.
- self.stack = []
-
- # Stack of _PreprocessorInfo objects.
- self.pp_stack = []
-
- def SeenOpenBrace(self):
- """Check if we have seen the opening brace for the innermost block.
-
- Returns:
- True if we have seen the opening brace, False if the innermost
- block is still expecting an opening brace.
- """
- return (not self.stack) or self.stack[-1].seen_open_brace
-
- def InNamespaceBody(self):
- """Check if we are currently one level inside a namespace body.
-
- Returns:
- True if top of the stack is a namespace block, False otherwise.
- """
- return self.stack and isinstance(self.stack[-1], _NamespaceInfo)
-
- def UpdatePreprocessor(self, line):
- """Update preprocessor stack.
-
- We need to handle preprocessors due to classes like this:
- #ifdef SWIG
- struct ResultDetailsPageElementExtensionPoint {
- #else
- struct ResultDetailsPageElementExtensionPoint : public Extension {
- #endif
-
- We make the following assumptions (good enough for most files):
- - Preprocessor condition evaluates to true from #if up to first
- #else/#elif/#endif.
-
- - Preprocessor condition evaluates to false from #else/#elif up
- to #endif. We still perform lint checks on these lines, but
- these do not affect nesting stack.
-
- Args:
- line: current line to check.
- """
- if Match(r'^\s*#\s*(if|ifdef|ifndef)\b', line):
- # Beginning of #if block, save the nesting stack here. The saved
- # stack will allow us to restore the parsing state in the #else case.
- self.pp_stack.append(_PreprocessorInfo(copy.deepcopy(self.stack)))
- elif Match(r'^\s*#\s*(else|elif)\b', line):
- # Beginning of #else block
- if self.pp_stack:
- if not self.pp_stack[-1].seen_else:
- # This is the first #else or #elif block. Remember the
- # whole nesting stack up to this point. This is what we
- # keep after the #endif.
- self.pp_stack[-1].seen_else = True
- self.pp_stack[-1].stack_before_else = copy.deepcopy(self.stack)
-
- # Restore the stack to how it was before the #if
- self.stack = copy.deepcopy(self.pp_stack[-1].stack_before_if)
- else:
- # TODO(unknown): unexpected #else, issue warning?
- pass
- elif Match(r'^\s*#\s*endif\b', line):
- # End of #if or #else blocks.
- if self.pp_stack:
- # If we saw an #else, we will need to restore the nesting
- # stack to its former state before the #else, otherwise we
- # will just continue from where we left off.
- if self.pp_stack[-1].seen_else:
- # Here we can just use a shallow copy since we are the last
- # reference to it.
- self.stack = self.pp_stack[-1].stack_before_else
- # Drop the corresponding #if
- self.pp_stack.pop()
- else:
- # TODO(unknown): unexpected #endif, issue warning?
- pass
-
- def Update(self, filename, clean_lines, linenum, error):
- """Update nesting state with current line.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum]
-
- # Update pp_stack first
- self.UpdatePreprocessor(line)
-
- # Count parentheses. This is to avoid adding struct arguments to
- # the nesting stack.
- if self.stack:
- inner_block = self.stack[-1]
- depth_change = line.count('(') - line.count(')')
- inner_block.open_parentheses += depth_change
-
- # Also check if we are starting or ending an inline assembly block.
- if inner_block.inline_asm in (_NO_ASM, _END_ASM):
- if (depth_change != 0 and
- inner_block.open_parentheses == 1 and
- _MATCH_ASM.match(line)):
- # Enter assembly block
- inner_block.inline_asm = _INSIDE_ASM
- else:
- # Not entering assembly block. If previous line was _END_ASM,
- # we will now shift to _NO_ASM state.
- inner_block.inline_asm = _NO_ASM
- elif (inner_block.inline_asm == _INSIDE_ASM and
- inner_block.open_parentheses == 0):
- # Exit assembly block
- inner_block.inline_asm = _END_ASM
-
- # Consume namespace declaration at the beginning of the line. Do
- # this in a loop so that we catch same line declarations like this:
- # namespace proto2 { namespace bridge { class MessageSet; } }
- while True:
- # Match start of namespace. The "\b\s*" below catches namespace
- # declarations even if it weren't followed by a whitespace, this
- # is so that we don't confuse our namespace checker. The
- # missing spaces will be flagged by CheckSpacing.
- namespace_decl_match = Match(r'^\s*namespace\b\s*([:\w]+)?(.*)$', line)
- if not namespace_decl_match:
- break
-
- new_namespace = _NamespaceInfo(namespace_decl_match.group(1), linenum)
- self.stack.append(new_namespace)
-
- line = namespace_decl_match.group(2)
- if line.find('{') != -1:
- new_namespace.seen_open_brace = True
- line = line[line.find('{') + 1:]
-
- # Look for a class declaration in whatever is left of the line
- # after parsing namespaces. The regexp accounts for decorated classes
- # such as in:
- # class LOCKABLE API Object {
- # };
- #
- # Templates with class arguments may confuse the parser, for example:
- # template <class T
- # class Comparator = less<T>,
- # class Vector = vector<T> >
- # class HeapQueue {
- #
- # Because this parser has no nesting state about templates, by the
- # time it saw "class Comparator", it may think that it's a new class.
- # Nested templates have a similar problem:
- # template <
- # typename ExportedType,
- # typename TupleType,
- # template <typename, typename> class ImplTemplate>
- #
- # To avoid these cases, we ignore classes that are followed by '=' or '>'
- class_decl_match = Match(
- r'\s*(template\s*<[\w\s<>,:]*>\s*)?'
- r'(class|struct)\s+([A-Z_]+\s+)*(\w+(?:::\w+)*)'
- r'(([^=>]|<[^<>]*>|<[^<>]*<[^<>]*>\s*>)*)$', line)
- if (class_decl_match and
- (not self.stack or self.stack[-1].open_parentheses == 0)):
- self.stack.append(_ClassInfo(
- class_decl_match.group(4), class_decl_match.group(2),
- clean_lines, linenum))
- line = class_decl_match.group(5)
-
- # If we have not yet seen the opening brace for the innermost block,
- # run checks here.
- if not self.SeenOpenBrace():
- self.stack[-1].CheckBegin(filename, clean_lines, linenum, error)
-
- # Update access control if we are inside a class/struct
- if self.stack and isinstance(self.stack[-1], _ClassInfo):
- classinfo = self.stack[-1]
- access_match = Match(
- r'^(.*)\b(public|private|protected|signals)(\s+(?:slots\s*)?)?'
- r':(?:[^:]|$)',
- line)
- if access_match:
- classinfo.access = access_match.group(2)
-
- # Check that access keywords are indented +1 space. Skip this
- # check if the keywords are not preceded by whitespaces.
- indent = access_match.group(1)
- if (len(indent) != classinfo.class_indent + 1 and
- Match(r'^\s*$', indent)):
- if classinfo.is_struct:
- parent = 'struct ' + classinfo.name
- else:
- parent = 'class ' + classinfo.name
- slots = ''
- if access_match.group(3):
- slots = access_match.group(3)
- error(filename, linenum, 'whitespace/indent', 3,
- '%s%s: should be indented +1 space inside %s' % (
- access_match.group(2), slots, parent))
-
- # Consume braces or semicolons from what's left of the line
- while True:
- # Match first brace, semicolon, or closed parenthesis.
- matched = Match(r'^[^{;)}]*([{;)}])(.*)$', line)
- if not matched:
- break
-
- token = matched.group(1)
- if token == '{':
- # If namespace or class hasn't seen a opening brace yet, mark
- # namespace/class head as complete. Push a new block onto the
- # stack otherwise.
- if not self.SeenOpenBrace():
- self.stack[-1].seen_open_brace = True
- else:
- self.stack.append(_BlockInfo(True))
- if _MATCH_ASM.match(line):
- self.stack[-1].inline_asm = _BLOCK_ASM
- elif token == ';' or token == ')':
- # If we haven't seen an opening brace yet, but we already saw
- # a semicolon, this is probably a forward declaration. Pop
- # the stack for these.
- #
- # Similarly, if we haven't seen an opening brace yet, but we
- # already saw a closing parenthesis, then these are probably
- # function arguments with extra "class" or "struct" keywords.
- # Also pop these stack for these.
- if not self.SeenOpenBrace():
- self.stack.pop()
- else: # token == '}'
- # Perform end of block checks and pop the stack.
- if self.stack:
- self.stack[-1].CheckEnd(filename, clean_lines, linenum, error)
- self.stack.pop()
- line = matched.group(2)
-
- def InnermostClass(self):
- """Get class info on the top of the stack.
-
- Returns:
- A _ClassInfo object if we are inside a class, or None otherwise.
- """
- for i in range(len(self.stack), 0, -1):
- classinfo = self.stack[i - 1]
- if isinstance(classinfo, _ClassInfo):
- return classinfo
- return None
-
- def CheckCompletedBlocks(self, filename, error):
- """Checks that all classes and namespaces have been completely parsed.
-
- Call this when all lines in a file have been processed.
- Args:
- filename: The name of the current file.
- error: The function to call with any errors found.
- """
- # Note: This test can result in false positives if #ifdef constructs
- # get in the way of brace matching. See the testBuildClass test in
- # cpplint_unittest.py for an example of this.
- for obj in self.stack:
- if isinstance(obj, _ClassInfo):
- error(filename, obj.starting_linenum, 'build/class', 5,
- 'Failed to find complete declaration of class %s' %
- obj.name)
- elif isinstance(obj, _NamespaceInfo):
- error(filename, obj.starting_linenum, 'build/namespaces', 5,
- 'Failed to find complete declaration of namespace %s' %
- obj.name)
-
-
-def CheckForNonStandardConstructs(filename, clean_lines, linenum,
- nesting_state, error):
- r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
-
- Complain about several constructs which gcc-2 accepts, but which are
- not standard C++. Warning about these in lint is one way to ease the
- transition to new compilers.
- - put storage class first (e.g. "static const" instead of "const static").
- - "%lld" instead of %qd" in printf-type functions.
- - "%1$d" is non-standard in printf-type functions.
- - "\%" is an undefined character escape sequence.
- - text after #endif is not allowed.
- - invalid inner-style forward declaration.
- - >? and <? operators, and their >?= and <?= cousins.
-
- Additionally, check for constructor/destructor style violations and reference
- members, as it is very convenient to do so while checking for
- gcc-2 compliance.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- nesting_state: A _NestingState instance which maintains information about
- the current stack of nested blocks being parsed.
- error: A callable to which errors are reported, which takes 4 arguments:
- filename, line number, error level, and message
- """
-
- # Remove comments from the line, but leave in strings for now.
- line = clean_lines.lines[linenum]
-
- if Search(r'printf\s*\(.*".*%[-+ ]?\d*q', line):
- error(filename, linenum, 'runtime/printf_format', 3,
- '%q in format strings is deprecated. Use %ll instead.')
-
- if Search(r'printf\s*\(.*".*%\d+\$', line):
- error(filename, linenum, 'runtime/printf_format', 2,
- '%N$ formats are unconventional. Try rewriting to avoid them.')
-
- # Remove escaped backslashes before looking for undefined escapes.
- line = line.replace('\\\\', '')
-
- if Search(r'("|\').*\\(%|\[|\(|{)', line):
- error(filename, linenum, 'build/printf_format', 3,
- '%, [, (, and { are undefined character escapes. Unescape them.')
-
- # For the rest, work with both comments and strings removed.
- line = clean_lines.elided[linenum]
-
- if Search(r'\b(const|volatile|void|char|short|int|long'
- r'|float|double|signed|unsigned'
- r'|schar|u?int8|u?int16|u?int32|u?int64)'
- r'\s+(register|static|extern|typedef)\b',
- line):
- error(filename, linenum, 'build/storage_class', 5,
- 'Storage class (static, extern, typedef, etc) should be first.')
-
- if Match(r'\s*#\s*endif\s*[^/\s]+', line):
- error(filename, linenum, 'build/endif_comment', 5,
- 'Uncommented text after #endif is non-standard. Use a comment.')
-
- if Match(r'\s*class\s+(\w+\s*::\s*)+\w+\s*;', line):
- error(filename, linenum, 'build/forward_decl', 5,
- 'Inner-style forward declarations are invalid. Remove this line.')
-
- if Search(r'(\w+|[+-]?\d+(\.\d*)?)\s*(<|>)\?=?\s*(\w+|[+-]?\d+)(\.\d*)?',
- line):
- error(filename, linenum, 'build/deprecated', 3,
- '>? and <? (max and min) operators are non-standard and deprecated.')
-
- if Search(r'^\s*const\s*string\s*&\s*\w+\s*;', line):
- # TODO(unknown): Could it be expanded safely to arbitrary references,
- # without triggering too many false positives? The first
- # attempt triggered 5 warnings for mostly benign code in the regtest, hence
- # the restriction.
- # Here's the original regexp, for the reference:
- # type_name = r'\w+((\s*::\s*\w+)|(\s*<\s*\w+?\s*>))?'
- # r'\s*const\s*' + type_name + '\s*&\s*\w+\s*;'
- error(filename, linenum, 'runtime/member_string_references', 2,
- 'const string& members are dangerous. It is much better to use '
- 'alternatives, such as pointers or simple constants.')
-
- # Everything else in this function operates on class declarations.
- # Return early if the top of the nesting stack is not a class, or if
- # the class head is not completed yet.
- classinfo = nesting_state.InnermostClass()
- if not classinfo or not classinfo.seen_open_brace:
- return
-
- # The class may have been declared with namespace or classname qualifiers.
- # The constructor and destructor will not have those qualifiers.
- base_classname = classinfo.name.split('::')[-1]
-
- # Look for single-argument constructors that aren't marked explicit.
- # Technically a valid construct, but against style.
- args = Match(r'\s+(?:inline\s+)?%s\s*\(([^,()]+)\)'
- % re.escape(base_classname),
- line)
- if (args and
- args.group(1) != 'void' and
- not Match(r'(const\s+)?%s(\s+const)?\s*(?:<\w+>\s*)?&'
- % re.escape(base_classname), args.group(1).strip())):
- error(filename, linenum, 'runtime/explicit', 5,
- 'Single-argument constructors should be marked explicit.')
-
-
-def CheckSpacingForFunctionCall(filename, line, linenum, error):
- """Checks for the correctness of various spacing around function calls.
-
- Args:
- filename: The name of the current file.
- line: The text of the line to check.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
-
- # Since function calls often occur inside if/for/while/switch
- # expressions - which have their own, more liberal conventions - we
- # first see if we should be looking inside such an expression for a
- # function call, to which we can apply more strict standards.
- fncall = line # if there's no control flow construct, look at whole line
- for pattern in (r'\bif\s*\((.*)\)\s*{',
- r'\bfor\s*\((.*)\)\s*{',
- r'\bwhile\s*\((.*)\)\s*[{;]',
- r'\bswitch\s*\((.*)\)\s*{'):
- match = Search(pattern, line)
- if match:
- fncall = match.group(1) # look inside the parens for function calls
- break
-
- # Except in if/for/while/switch, there should never be space
- # immediately inside parens (eg "f( 3, 4 )"). We make an exception
- # for nested parens ( (a+b) + c ). Likewise, there should never be
- # a space before a ( when it's a function argument. I assume it's a
- # function argument when the char before the whitespace is legal in
- # a function name (alnum + _) and we're not starting a macro. Also ignore
- # pointers and references to arrays and functions coz they're too tricky:
- # we use a very simple way to recognize these:
- # " (something)(maybe-something)" or
- # " (something)(maybe-something," or
- # " (something)[something]"
- # Note that we assume the contents of [] to be short enough that
- # they'll never need to wrap.
- if ( # Ignore control structures.
- not Search(r'\b(if|for|while|switch|return|new|delete|catch|sizeof)\b',
- fncall) and
- # Ignore pointers/references to functions.
- not Search(r' \([^)]+\)\([^)]*(\)|,$)', fncall) and
- # Ignore pointers/references to arrays.
- not Search(r' \([^)]+\)\[[^\]]+\]', fncall)):
- if Search(r'\w\s*\(\s(?!\s*\\$)', fncall): # a ( used for a fn call
- error(filename, linenum, 'whitespace/parens', 4,
- 'Extra space after ( in function call')
- elif Search(r'\(\s+(?!(\s*\\)|\()', fncall):
- error(filename, linenum, 'whitespace/parens', 2,
- 'Extra space after (')
- if (Search(r'\w\s+\(', fncall) and
- not Search(r'#\s*define|typedef', fncall) and
- not Search(r'\w\s+\((\w+::)*\*\w+\)\(', fncall)):
- error(filename, linenum, 'whitespace/parens', 4,
- 'Extra space before ( in function call')
- # If the ) is followed only by a newline or a { + newline, assume it's
- # part of a control statement (if/while/etc), and don't complain
- if Search(r'[^)]\s+\)\s*[^{\s]', fncall):
- # If the closing parenthesis is preceded by only whitespaces,
- # try to give a more descriptive error message.
- if Search(r'^\s+\)', fncall):
- error(filename, linenum, 'whitespace/parens', 2,
- 'Closing ) should be moved to the previous line')
- else:
- error(filename, linenum, 'whitespace/parens', 2,
- 'Extra space before )')
-
-
-def IsBlankLine(line):
- """Returns true if the given line is blank.
-
- We consider a line to be blank if the line is empty or consists of
- only white spaces.
-
- Args:
- line: A line of a string.
-
- Returns:
- True, if the given line is blank.
- """
- return not line or line.isspace()
-
-
-def CheckForFunctionLengths(filename, clean_lines, linenum,
- function_state, error):
- """Reports for long function bodies.
-
- For an overview why this is done, see:
- http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
-
- Uses a simplistic algorithm assuming other style guidelines
- (especially spacing) are followed.
- Only checks unindented functions, so class members are unchecked.
- Trivial bodies are unchecked, so constructors with huge initializer lists
- may be missed.
- Blank/comment lines are not counted so as to avoid encouraging the removal
- of vertical space and comments just to get through a lint check.
- NOLINT *on the last line of a function* disables this check.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- function_state: Current function name and lines in body so far.
- error: The function to call with any errors found.
- """
- lines = clean_lines.lines
- line = lines[linenum]
- raw = clean_lines.raw_lines
- raw_line = raw[linenum]
- joined_line = ''
-
- starting_func = False
- regexp = r'(\w(\w|::|\*|\&|\s)*)\(' # decls * & space::name( ...
- match_result = Match(regexp, line)
- if match_result:
- # If the name is all caps and underscores, figure it's a macro and
- # ignore it, unless it's TEST or TEST_F.
- function_name = match_result.group(1).split()[-1]
- if function_name == 'TEST' or function_name == 'TEST_F' or (
- not Match(r'[A-Z_]+$', function_name)):
- starting_func = True
-
- if starting_func:
- body_found = False
- for start_linenum in xrange(linenum, clean_lines.NumLines()):
- start_line = lines[start_linenum]
- joined_line += ' ' + start_line.lstrip()
- if Search(r'(;|})', start_line): # Declarations and trivial functions
- body_found = True
- break # ... ignore
- elif Search(r'{', start_line):
- body_found = True
- function = Search(r'((\w|:)*)\(', line).group(1)
- if Match(r'TEST', function): # Handle TEST... macros
- parameter_regexp = Search(r'(\(.*\))', joined_line)
- if parameter_regexp: # Ignore bad syntax
- function += parameter_regexp.group(1)
- else:
- function += '()'
- function_state.Begin(function)
- break
- if not body_found:
- # No body for the function (or evidence of a non-function) was found.
- error(filename, linenum, 'readability/fn_size', 5,
- 'Lint failed to find start of function body.')
- elif Match(r'^\}\s*$', line): # function end
- function_state.Check(error, filename, linenum)
- function_state.End()
- elif not Match(r'^\s*$', line):
- function_state.Count() # Count non-blank/non-comment lines.
-
-
-_RE_PATTERN_TODO = re.compile(r'^//(\s*)TODO(\(.+?\))?:?(\s|$)?')
-
-
-def CheckComment(comment, filename, linenum, error):
- """Checks for common mistakes in TODO comments.
-
- Args:
- comment: The text of the comment from the line in question.
- filename: The name of the current file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- match = _RE_PATTERN_TODO.match(comment)
- if match:
- # One whitespace is correct; zero whitespace is handled elsewhere.
- leading_whitespace = match.group(1)
- if len(leading_whitespace) > 1:
- error(filename, linenum, 'whitespace/todo', 2,
- 'Too many spaces before TODO')
-
- username = match.group(2)
- if not username:
- error(filename, linenum, 'readability/todo', 2,
- 'Missing username in TODO; it should look like '
- '"// TODO(my_username): Stuff."')
-
- middle_whitespace = match.group(3)
- # Comparisons made explicit for correctness -- pylint: disable=g-explicit-bool-comparison
- if middle_whitespace != ' ' and middle_whitespace != '':
- error(filename, linenum, 'whitespace/todo', 2,
- 'TODO(my_username) should be followed by a space')
-
-def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
- """Checks for improper use of DISALLOW* macros.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- nesting_state: A _NestingState instance which maintains information about
- the current stack of nested blocks being parsed.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum] # get rid of comments and strings
-
- matched = Match((r'\s*(DISALLOW_COPY_AND_ASSIGN|'
- r'DISALLOW_EVIL_CONSTRUCTORS|'
- r'DISALLOW_IMPLICIT_CONSTRUCTORS)'), line)
- if not matched:
- return
- if nesting_state.stack and isinstance(nesting_state.stack[-1], _ClassInfo):
- if nesting_state.stack[-1].access != 'private':
- error(filename, linenum, 'readability/constructors', 3,
- '%s must be in the private: section' % matched.group(1))
-
- else:
- # Found DISALLOW* macro outside a class declaration, or perhaps it
- # was used inside a function when it should have been part of the
- # class declaration. We could issue a warning here, but it
- # probably resulted in a compiler error already.
- pass
-
-
-def FindNextMatchingAngleBracket(clean_lines, linenum, init_suffix):
- """Find the corresponding > to close a template.
-
- Args:
- clean_lines: A CleansedLines instance containing the file.
- linenum: Current line number.
- init_suffix: Remainder of the current line after the initial <.
-
- Returns:
- True if a matching bracket exists.
- """
- line = init_suffix
- nesting_stack = ['<']
- while True:
- # Find the next operator that can tell us whether < is used as an
- # opening bracket or as a less-than operator. We only want to
- # warn on the latter case.
- #
- # We could also check all other operators and terminate the search
- # early, e.g. if we got something like this "a<b+c", the "<" is
- # most likely a less-than operator, but then we will get false
- # positives for default arguments and other template expressions.
- match = Search(r'^[^<>(),;\[\]]*([<>(),;\[\]])(.*)$', line)
- if match:
- # Found an operator, update nesting stack
- operator = match.group(1)
- line = match.group(2)
-
- if nesting_stack[-1] == '<':
- # Expecting closing angle bracket
- if operator in ('<', '(', '['):
- nesting_stack.append(operator)
- elif operator == '>':
- nesting_stack.pop()
- if not nesting_stack:
- # Found matching angle bracket
- return True
- elif operator == ',':
- # Got a comma after a bracket, this is most likely a template
- # argument. We have not seen a closing angle bracket yet, but
- # it's probably a few lines later if we look for it, so just
- # return early here.
- return True
- else:
- # Got some other operator.
- return False
-
- else:
- # Expecting closing parenthesis or closing bracket
- if operator in ('<', '(', '['):
- nesting_stack.append(operator)
- elif operator in (')', ']'):
- # We don't bother checking for matching () or []. If we got
- # something like (] or [), it would have been a syntax error.
- nesting_stack.pop()
-
- else:
- # Scan the next line
- linenum += 1
- if linenum >= len(clean_lines.elided):
- break
- line = clean_lines.elided[linenum]
-
- # Exhausted all remaining lines and still no matching angle bracket.
- # Most likely the input was incomplete, otherwise we should have
- # seen a semicolon and returned early.
- return True
-
-
-def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix):
- """Find the corresponding < that started a template.
-
- Args:
- clean_lines: A CleansedLines instance containing the file.
- linenum: Current line number.
- init_prefix: Part of the current line before the initial >.
-
- Returns:
- True if a matching bracket exists.
- """
- line = init_prefix
- nesting_stack = ['>']
- while True:
- # Find the previous operator
- match = Search(r'^(.*)([<>(),;\[\]])[^<>(),;\[\]]*$', line)
- if match:
- # Found an operator, update nesting stack
- operator = match.group(2)
- line = match.group(1)
-
- if nesting_stack[-1] == '>':
- # Expecting opening angle bracket
- if operator in ('>', ')', ']'):
- nesting_stack.append(operator)
- elif operator == '<':
- nesting_stack.pop()
- if not nesting_stack:
- # Found matching angle bracket
- return True
- elif operator == ',':
- # Got a comma before a bracket, this is most likely a
- # template argument. The opening angle bracket is probably
- # there if we look for it, so just return early here.
- return True
- else:
- # Got some other operator.
- return False
-
- else:
- # Expecting opening parenthesis or opening bracket
- if operator in ('>', ')', ']'):
- nesting_stack.append(operator)
- elif operator in ('(', '['):
- nesting_stack.pop()
-
- else:
- # Scan the previous line
- linenum -= 1
- if linenum < 0:
- break
- line = clean_lines.elided[linenum]
-
- # Exhausted all earlier lines and still no matching angle bracket.
- return False
-
-
-def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
- """Checks for the correctness of various spacing issues in the code.
-
- Things we check for: spaces around operators, spaces after
- if/for/while/switch, no spaces around parens in function calls, two
- spaces between code and comment, don't start a block with a blank
- line, don't end a function with a blank line, don't add a blank line
- after public/protected/private, don't have too many blank lines in a row.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- nesting_state: A _NestingState instance which maintains information about
- the current stack of nested blocks being parsed.
- error: The function to call with any errors found.
- """
-
- # Don't use "elided" lines here, otherwise we can't check commented lines.
- # Don't want to use "raw" either, because we don't want to check inside C++11
- # raw strings,
- raw = clean_lines.lines_without_raw_strings
- line = raw[linenum]
-
- # Before nixing comments, check if the line is blank for no good
- # reason. This includes the first line after a block is opened, and
- # blank lines at the end of a function (ie, right before a line like '}'
- #
- # Skip all the blank line checks if we are immediately inside a
- # namespace body. In other words, don't issue blank line warnings
- # for this block:
- # namespace {
- #
- # }
- #
- # A warning about missing end of namespace comments will be issued instead.
- if IsBlankLine(line) and not nesting_state.InNamespaceBody():
- elided = clean_lines.elided
- prev_line = elided[linenum - 1]
- prevbrace = prev_line.rfind('{')
- # TODO(unknown): Don't complain if line before blank line, and line after,
- # both start with alnums and are indented the same amount.
- # This ignores whitespace at the start of a namespace block
- # because those are not usually indented.
- if prevbrace != -1 and prev_line[prevbrace:].find('}') == -1:
- # OK, we have a blank line at the start of a code block. Before we
- # complain, we check if it is an exception to the rule: The previous
- # non-empty line has the parameters of a function header that are indented
- # 4 spaces (because they did not fit in a 80 column line when placed on
- # the same line as the function name). We also check for the case where
- # the previous line is indented 6 spaces, which may happen when the
- # initializers of a constructor do not fit into a 80 column line.
- exception = False
- if Match(r' {6}\w', prev_line): # Initializer list?
- # We are looking for the opening column of initializer list, which
- # should be indented 4 spaces to cause 6 space indentation afterwards.
- search_position = linenum-2
- while (search_position >= 0
- and Match(r' {6}\w', elided[search_position])):
- search_position -= 1
- exception = (search_position >= 0
- and elided[search_position][:5] == ' :')
- else:
- # Search for the function arguments or an initializer list. We use a
- # simple heuristic here: If the line is indented 4 spaces; and we have a
- # closing paren, without the opening paren, followed by an opening brace
- # or colon (for initializer lists) we assume that it is the last line of
- # a function header. If we have a colon indented 4 spaces, it is an
- # initializer list.
- exception = (Match(r' {4}\w[^\(]*\)\s*(const\s*)?(\{\s*$|:)',
- prev_line)
- or Match(r' {4}:', prev_line))
-
- if not exception:
- error(filename, linenum, 'whitespace/blank_line', 2,
- 'Redundant blank line at the start of a code block '
- 'should be deleted.')
- # Ignore blank lines at the end of a block in a long if-else
- # chain, like this:
- # if (condition1) {
- # // Something followed by a blank line
- #
- # } else if (condition2) {
- # // Something else
- # }
- if linenum + 1 < clean_lines.NumLines():
- next_line = raw[linenum + 1]
- if (next_line
- and Match(r'\s*}', next_line)
- and next_line.find('} else ') == -1):
- error(filename, linenum, 'whitespace/blank_line', 3,
- 'Redundant blank line at the end of a code block '
- 'should be deleted.')
-
- matched = Match(r'\s*(public|protected|private):', prev_line)
- if matched:
- error(filename, linenum, 'whitespace/blank_line', 3,
- 'Do not leave a blank line after "%s:"' % matched.group(1))
-
- # Next, we complain if there's a comment too near the text
- commentpos = line.find('//')
- if commentpos != -1:
- # Check if the // may be in quotes. If so, ignore it
- # Comparisons made explicit for clarity -- pylint: disable=g-explicit-bool-comparison
- if (line.count('"', 0, commentpos) -
- line.count('\\"', 0, commentpos)) % 2 == 0: # not in quotes
- # Allow one space for new scopes, two spaces otherwise:
- if (not Match(r'^\s*{ //', line) and
- ((commentpos >= 1 and
- line[commentpos-1] not in string.whitespace) or
- (commentpos >= 2 and
- line[commentpos-2] not in string.whitespace))):
- error(filename, linenum, 'whitespace/comments', 2,
- 'At least two spaces is best between code and comments')
- # There should always be a space between the // and the comment
- commentend = commentpos + 2
- if commentend < len(line) and not line[commentend] == ' ':
- # but some lines are exceptions -- e.g. if they're big
- # comment delimiters like:
- # //----------------------------------------------------------
- # or are an empty C++ style Doxygen comment, like:
- # ///
- # or C++ style Doxygen comments placed after the variable:
- # ///< Header comment
- # //!< Header comment
- # or they begin with multiple slashes followed by a space:
- # //////// Header comment
- match = (Search(r'[=/-]{4,}\s*$', line[commentend:]) or
- Search(r'^/$', line[commentend:]) or
- Search(r'^!< ', line[commentend:]) or
- Search(r'^/< ', line[commentend:]) or
- Search(r'^/+ ', line[commentend:]))
- if not match:
- error(filename, linenum, 'whitespace/comments', 4,
- 'Should have a space between // and comment')
- CheckComment(line[commentpos:], filename, linenum, error)
-
- line = clean_lines.elided[linenum] # get rid of comments and strings
-
- # Don't try to do spacing checks for operator methods
- line = re.sub(r'operator(==|!=|<|<<|<=|>=|>>|>)\(', 'operator\(', line)
-
- # We allow no-spaces around = within an if: "if ( (a=Foo()) == 0 )".
- # Otherwise not. Note we only check for non-spaces on *both* sides;
- # sometimes people put non-spaces on one side when aligning ='s among
- # many lines (not that this is behavior that I approve of...)
- if Search(r'[\w.]=[\w.]', line) and not Search(r'\b(if|while) ', line):
- error(filename, linenum, 'whitespace/operators', 4,
- 'Missing spaces around =')
-
- # It's ok not to have spaces around binary operators like + - * /, but if
- # there's too little whitespace, we get concerned. It's hard to tell,
- # though, so we punt on this one for now. TODO.
-
- # You should always have whitespace around binary operators.
- #
- # Check <= and >= first to avoid false positives with < and >, then
- # check non-include lines for spacing around < and >.
- match = Search(r'[^<>=!\s](==|!=|<=|>=)[^<>=!\s]', line)
- if match:
- error(filename, linenum, 'whitespace/operators', 3,
- 'Missing spaces around %s' % match.group(1))
- # We allow no-spaces around << when used like this: 10<<20, but
- # not otherwise (particularly, not when used as streams)
- # Also ignore using ns::operator<<;
- match = Search(r'(operator|\S)(?:L|UL|ULL|l|ul|ull)?<<(\S)', line)
- if (match and
- not (match.group(1).isdigit() and match.group(2).isdigit()) and
- not (match.group(1) == 'operator' and match.group(2) == ';')):
- error(filename, linenum, 'whitespace/operators', 3,
- 'Missing spaces around <<')
- elif not Match(r'#.*include', line):
- # Avoid false positives on ->
- reduced_line = line.replace('->', '')
-
- # Look for < that is not surrounded by spaces. This is only
- # triggered if both sides are missing spaces, even though
- # technically should should flag if at least one side is missing a
- # space. This is done to avoid some false positives with shifts.
- match = Search(r'[^\s<]<([^\s=<].*)', reduced_line)
- if (match and
- not FindNextMatchingAngleBracket(clean_lines, linenum, match.group(1))):
- error(filename, linenum, 'whitespace/operators', 3,
- 'Missing spaces around <')
-
- # Look for > that is not surrounded by spaces. Similar to the
- # above, we only trigger if both sides are missing spaces to avoid
- # false positives with shifts.
- match = Search(r'^(.*[^\s>])>[^\s=>]', reduced_line)
- if (match and
- not FindPreviousMatchingAngleBracket(clean_lines, linenum,
- match.group(1))):
- error(filename, linenum, 'whitespace/operators', 3,
- 'Missing spaces around >')
-
- # We allow no-spaces around >> for almost anything. This is because
- # C++11 allows ">>" to close nested templates, which accounts for
- # most cases when ">>" is not followed by a space.
- #
- # We still warn on ">>" followed by alpha character, because that is
- # likely due to ">>" being used for right shifts, e.g.:
- # value >> alpha
- #
- # When ">>" is used to close templates, the alphanumeric letter that
- # follows would be part of an identifier, and there should still be
- # a space separating the template type and the identifier.
- # type<type<type>> alpha
- match = Search(r'>>[a-zA-Z_]', line)
- if match:
- error(filename, linenum, 'whitespace/operators', 3,
- 'Missing spaces around >>')
-
- # There shouldn't be space around unary operators
- match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line)
- if match:
- error(filename, linenum, 'whitespace/operators', 4,
- 'Extra space for operator %s' % match.group(1))
-
- # A pet peeve of mine: no spaces after an if, while, switch, or for
- match = Search(r' (if\(|for\(|while\(|switch\()', line)
- if match:
- error(filename, linenum, 'whitespace/parens', 5,
- 'Missing space before ( in %s' % match.group(1))
-
- # For if/for/while/switch, the left and right parens should be
- # consistent about how many spaces are inside the parens, and
- # there should either be zero or one spaces inside the parens.
- # We don't want: "if ( foo)" or "if ( foo )".
- # Exception: "for ( ; foo; bar)" and "for (foo; bar; )" are allowed.
- match = Search(r'\b(if|for|while|switch)\s*'
- r'\(([ ]*)(.).*[^ ]+([ ]*)\)\s*{\s*$',
- line)
- if match:
- if len(match.group(2)) != len(match.group(4)):
- if not (match.group(3) == ';' and
- len(match.group(2)) == 1 + len(match.group(4)) or
- not match.group(2) and Search(r'\bfor\s*\(.*; \)', line)):
- error(filename, linenum, 'whitespace/parens', 5,
- 'Mismatching spaces inside () in %s' % match.group(1))
- if len(match.group(2)) not in [0, 1]:
- error(filename, linenum, 'whitespace/parens', 5,
- 'Should have zero or one spaces inside ( and ) in %s' %
- match.group(1))
-
- # You should always have a space after a comma (either as fn arg or operator)
- #
- # This does not apply when the non-space character following the
- # comma is another comma, since the only time when that happens is
- # for empty macro arguments.
- #
- # We run this check in two passes: first pass on elided lines to
- # verify that lines contain missing whitespaces, second pass on raw
- # lines to confirm that those missing whitespaces are not due to
- # elided comments.
- if Search(r',[^,\s]', line) and Search(r',[^,\s]', raw[linenum]):
- error(filename, linenum, 'whitespace/comma', 3,
- 'Missing space after ,')
-
- # You should always have a space after a semicolon
- # except for few corner cases
- # TODO(unknown): clarify if 'if (1) { return 1;}' is requires one more
- # space after ;
- if Search(r';[^\s};\\)/]', line):
- error(filename, linenum, 'whitespace/semicolon', 3,
- 'Missing space after ;')
-
- # Next we will look for issues with function calls.
- CheckSpacingForFunctionCall(filename, line, linenum, error)
-
- # Except after an opening paren, or after another opening brace (in case of
- # an initializer list, for instance), you should have spaces before your
- # braces. And since you should never have braces at the beginning of a line,
- # this is an easy test.
- match = Match(r'^(.*[^ ({]){', line)
- if match:
- # Try a bit harder to check for brace initialization. This
- # happens in one of the following forms:
- # Constructor() : initializer_list_{} { ... }
- # Constructor{}.MemberFunction()
- # Type variable{};
- # FunctionCall(type{}, ...);
- # LastArgument(..., type{});
- # LOG(INFO) << type{} << " ...";
- # map_of_type[{...}] = ...;
- #
- # We check for the character following the closing brace, and
- # silence the warning if it's one of those listed above, i.e.
- # "{.;,)<]".
- #
- # To account for nested initializer list, we allow any number of
- # closing braces up to "{;,)<". We can't simply silence the
- # warning on first sight of closing brace, because that would
- # cause false negatives for things that are not initializer lists.
- # Silence this: But not this:
- # Outer{ if (...) {
- # Inner{...} if (...){ // Missing space before {
- # }; }
- #
- # There is a false negative with this approach if people inserted
- # spurious semicolons, e.g. "if (cond){};", but we will catch the
- # spurious semicolon with a separate check.
- (endline, endlinenum, endpos) = CloseExpression(
- clean_lines, linenum, len(match.group(1)))
- trailing_text = ''
- if endpos > -1:
- trailing_text = endline[endpos:]
- for offset in xrange(endlinenum + 1,
- min(endlinenum + 3, clean_lines.NumLines() - 1)):
- trailing_text += clean_lines.elided[offset]
- if not Match(r'^[\s}]*[{.;,)<\]]', trailing_text):
- error(filename, linenum, 'whitespace/braces', 5,
- 'Missing space before {')
-
- # Make sure '} else {' has spaces.
- if Search(r'}else', line):
- error(filename, linenum, 'whitespace/braces', 5,
- 'Missing space before else')
-
- # You shouldn't have spaces before your brackets, except maybe after
- # 'delete []' or 'new char * []'.
- if Search(r'\w\s+\[', line) and not Search(r'delete\s+\[', line):
- error(filename, linenum, 'whitespace/braces', 5,
- 'Extra space before [')
-
- # You shouldn't have a space before a semicolon at the end of the line.
- # There's a special case for "for" since the style guide allows space before
- # the semicolon there.
- if Search(r':\s*;\s*$', line):
- error(filename, linenum, 'whitespace/semicolon', 5,
- 'Semicolon defining empty statement. Use {} instead.')
- elif Search(r'^\s*;\s*$', line):
- error(filename, linenum, 'whitespace/semicolon', 5,
- 'Line contains only semicolon. If this should be an empty statement, '
- 'use {} instead.')
- elif (Search(r'\s+;\s*$', line) and
- not Search(r'\bfor\b', line)):
- error(filename, linenum, 'whitespace/semicolon', 5,
- 'Extra space before last semicolon. If this should be an empty '
- 'statement, use {} instead.')
-
- # In range-based for, we wanted spaces before and after the colon, but
- # not around "::" tokens that might appear.
- if (Search('for *\(.*[^:]:[^: ]', line) or
- Search('for *\(.*[^: ]:[^:]', line)):
- error(filename, linenum, 'whitespace/forcolon', 2,
- 'Missing space around colon in range-based for loop')
-
-
-def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
- """Checks for additional blank line issues related to sections.
-
- Currently the only thing checked here is blank line before protected/private.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- class_info: A _ClassInfo objects.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- # Skip checks if the class is small, where small means 25 lines or less.
- # 25 lines seems like a good cutoff since that's the usual height of
- # terminals, and any class that can't fit in one screen can't really
- # be considered "small".
- #
- # Also skip checks if we are on the first line. This accounts for
- # classes that look like
- # class Foo { public: ... };
- #
- # If we didn't find the end of the class, last_line would be zero,
- # and the check will be skipped by the first condition.
- if (class_info.last_line - class_info.starting_linenum <= 24 or
- linenum <= class_info.starting_linenum):
- return
-
- matched = Match(r'\s*(public|protected|private):', clean_lines.lines[linenum])
- if matched:
- # Issue warning if the line before public/protected/private was
- # not a blank line, but don't do this if the previous line contains
- # "class" or "struct". This can happen two ways:
- # - We are at the beginning of the class.
- # - We are forward-declaring an inner class that is semantically
- # private, but needed to be public for implementation reasons.
- # Also ignores cases where the previous line ends with a backslash as can be
- # common when defining classes in C macros.
- prev_line = clean_lines.lines[linenum - 1]
- if (not IsBlankLine(prev_line) and
- not Search(r'\b(class|struct)\b', prev_line) and
- not Search(r'\\$', prev_line)):
- # Try a bit harder to find the beginning of the class. This is to
- # account for multi-line base-specifier lists, e.g.:
- # class Derived
- # : public Base {
- end_class_head = class_info.starting_linenum
- for i in range(class_info.starting_linenum, linenum):
- if Search(r'\{\s*$', clean_lines.lines[i]):
- end_class_head = i
- break
- if end_class_head < linenum - 1:
- error(filename, linenum, 'whitespace/blank_line', 3,
- '"%s:" should be preceded by a blank line' % matched.group(1))
-
-
-def GetPreviousNonBlankLine(clean_lines, linenum):
- """Return the most recent non-blank line and its line number.
-
- Args:
- clean_lines: A CleansedLines instance containing the file contents.
- linenum: The number of the line to check.
-
- Returns:
- A tuple with two elements. The first element is the contents of the last
- non-blank line before the current line, or the empty string if this is the
- first non-blank line. The second is the line number of that line, or -1
- if this is the first non-blank line.
- """
-
- prevlinenum = linenum - 1
- while prevlinenum >= 0:
- prevline = clean_lines.elided[prevlinenum]
- if not IsBlankLine(prevline): # if not a blank line...
- return (prevline, prevlinenum)
- prevlinenum -= 1
- return ('', -1)
-
-
-def CheckBraces(filename, clean_lines, linenum, error):
- """Looks for misplaced braces (e.g. at the end of line).
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
-
- line = clean_lines.elided[linenum] # get rid of comments and strings
-
- if Match(r'\s*{\s*$', line):
- # We allow an open brace to start a line in the case where someone is using
- # braces in a block to explicitly create a new scope, which is commonly used
- # to control the lifetime of stack-allocated variables. Braces are also
- # used for brace initializers inside function calls. We don't detect this
- # perfectly: we just don't complain if the last non-whitespace character on
- # the previous non-blank line is ',', ';', ':', '(', '{', or '}', or if the
- # previous line starts a preprocessor block.
- prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
- if (not Search(r'[,;:}{(]\s*$', prevline) and
- not Match(r'\s*#', prevline)):
- error(filename, linenum, 'whitespace/braces', 4,
- '{ should almost always be at the end of the previous line')
-
- # An else clause should be on the same line as the preceding closing brace.
- if Match(r'\s*else\s*', line):
- prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
- if Match(r'\s*}\s*$', prevline):
- error(filename, linenum, 'whitespace/newline', 4,
- 'An else should appear on the same line as the preceding }')
-
- # If braces come on one side of an else, they should be on both.
- # However, we have to worry about "else if" that spans multiple lines!
- if Search(r'}\s*else[^{]*$', line) or Match(r'[^}]*else\s*{', line):
- if Search(r'}\s*else if([^{]*)$', line): # could be multi-line if
- # find the ( after the if
- pos = line.find('else if')
- pos = line.find('(', pos)
- if pos > 0:
- (endline, _, endpos) = CloseExpression(clean_lines, linenum, pos)
- if endline[endpos:].find('{') == -1: # must be brace after if
- error(filename, linenum, 'readability/braces', 5,
- 'If an else has a brace on one side, it should have it on both')
- else: # common case: else not followed by a multi-line if
- error(filename, linenum, 'readability/braces', 5,
- 'If an else has a brace on one side, it should have it on both')
-
- # Likewise, an else should never have the else clause on the same line
- if Search(r'\belse [^\s{]', line) and not Search(r'\belse if\b', line):
- error(filename, linenum, 'whitespace/newline', 4,
- 'Else clause should never be on same line as else (use 2 lines)')
-
- # In the same way, a do/while should never be on one line
- if Match(r'\s*do [^\s{]', line):
- error(filename, linenum, 'whitespace/newline', 4,
- 'do/while clauses should not be on a single line')
-
- # Block bodies should not be followed by a semicolon. Due to C++11
- # brace initialization, there are more places where semicolons are
- # required than not, so we use a whitelist approach to check these
- # rather than a blacklist. These are the places where "};" should
- # be replaced by just "}":
- # 1. Some flavor of block following closing parenthesis:
- # for (;;) {};
- # while (...) {};
- # switch (...) {};
- # Function(...) {};
- # if (...) {};
- # if (...) else if (...) {};
- #
- # 2. else block:
- # if (...) else {};
- #
- # 3. const member function:
- # Function(...) const {};
- #
- # 4. Block following some statement:
- # x = 42;
- # {};
- #
- # 5. Block at the beginning of a function:
- # Function(...) {
- # {};
- # }
- #
- # Note that naively checking for the preceding "{" will also match
- # braces inside multi-dimensional arrays, but this is fine since
- # that expression will not contain semicolons.
- #
- # 6. Block following another block:
- # while (true) {}
- # {};
- #
- # 7. End of namespaces:
- # namespace {};
- #
- # These semicolons seems far more common than other kinds of
- # redundant semicolons, possibly due to people converting classes
- # to namespaces. For now we do not warn for this case.
- #
- # Try matching case 1 first.
- match = Match(r'^(.*\)\s*)\{', line)
- if match:
- # Matched closing parenthesis (case 1). Check the token before the
- # matching opening parenthesis, and don't warn if it looks like a
- # macro. This avoids these false positives:
- # - macro that defines a base class
- # - multi-line macro that defines a base class
- # - macro that defines the whole class-head
- #
- # But we still issue warnings for macros that we know are safe to
- # warn, specifically:
- # - TEST, TEST_F, TEST_P, MATCHER, MATCHER_P
- # - TYPED_TEST
- # - INTERFACE_DEF
- # - EXCLUSIVE_LOCKS_REQUIRED, SHARED_LOCKS_REQUIRED, LOCKS_EXCLUDED:
- #
- # We implement a whitelist of safe macros instead of a blacklist of
- # unsafe macros, even though the latter appears less frequently in
- # google code and would have been easier to implement. This is because
- # the downside for getting the whitelist wrong means some extra
- # semicolons, while the downside for getting the blacklist wrong
- # would result in compile errors.
- #
- # In addition to macros, we also don't want to warn on compound
- # literals.
- closing_brace_pos = match.group(1).rfind(')')
- opening_parenthesis = ReverseCloseExpression(
- clean_lines, linenum, closing_brace_pos)
- if opening_parenthesis[2] > -1:
- line_prefix = opening_parenthesis[0][0:opening_parenthesis[2]]
- macro = Search(r'\b([A-Z_]+)\s*$', line_prefix)
- if ((macro and
- macro.group(1) not in (
- 'TEST', 'TEST_F', 'MATCHER', 'MATCHER_P', 'TYPED_TEST',
- 'EXCLUSIVE_LOCKS_REQUIRED', 'SHARED_LOCKS_REQUIRED',
- 'LOCKS_EXCLUDED', 'INTERFACE_DEF')) or
- Search(r'\s+=\s*$', line_prefix)):
- match = None
-
- else:
- # Try matching cases 2-3.
- match = Match(r'^(.*(?:else|\)\s*const)\s*)\{', line)
- if not match:
- # Try matching cases 4-6. These are always matched on separate lines.
- #
- # Note that we can't simply concatenate the previous line to the
- # current line and do a single match, otherwise we may output
- # duplicate warnings for the blank line case:
- # if (cond) {
- # // blank line
- # }
- prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
- if prevline and Search(r'[;{}]\s*$', prevline):
- match = Match(r'^(\s*)\{', line)
-
- # Check matching closing brace
- if match:
- (endline, endlinenum, endpos) = CloseExpression(
- clean_lines, linenum, len(match.group(1)))
- if endpos > -1 and Match(r'^\s*;', endline[endpos:]):
- # Current {} pair is eligible for semicolon check, and we have found
- # the redundant semicolon, output warning here.
- #
- # Note: because we are scanning forward for opening braces, and
- # outputting warnings for the matching closing brace, if there are
- # nested blocks with trailing semicolons, we will get the error
- # messages in reversed order.
- error(filename, endlinenum, 'readability/braces', 4,
- "You don't need a ; after a }")
-
-
-def CheckEmptyBlockBody(filename, clean_lines, linenum, error):
- """Look for empty loop/conditional body with only a single semicolon.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
-
- # Search for loop keywords at the beginning of the line. Because only
- # whitespaces are allowed before the keywords, this will also ignore most
- # do-while-loops, since those lines should start with closing brace.
- #
- # We also check "if" blocks here, since an empty conditional block
- # is likely an error.
- line = clean_lines.elided[linenum]
- matched = Match(r'\s*(for|while|if)\s*\(', line)
- if matched:
- # Find the end of the conditional expression
- (end_line, end_linenum, end_pos) = CloseExpression(
- clean_lines, linenum, line.find('('))
-
- # Output warning if what follows the condition expression is a semicolon.
- # No warning for all other cases, including whitespace or newline, since we
- # have a separate check for semicolons preceded by whitespace.
- if end_pos >= 0 and Match(r';', end_line[end_pos:]):
- if matched.group(1) == 'if':
- error(filename, end_linenum, 'whitespace/empty_conditional_body', 5,
- 'Empty conditional bodies should use {}')
- else:
- error(filename, end_linenum, 'whitespace/empty_loop_body', 5,
- 'Empty loop bodies should use {} or continue')
-
-
-def CheckCheck(filename, clean_lines, linenum, error):
- """Checks the use of CHECK and EXPECT macros.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
-
- # Decide the set of replacement macros that should be suggested
- lines = clean_lines.elided
- check_macro = None
- start_pos = -1
- for macro in _CHECK_MACROS:
- i = lines[linenum].find(macro)
- if i >= 0:
- check_macro = macro
-
- # Find opening parenthesis. Do a regular expression match here
- # to make sure that we are matching the expected CHECK macro, as
- # opposed to some other macro that happens to contain the CHECK
- # substring.
- matched = Match(r'^(.*\b' + check_macro + r'\s*)\(', lines[linenum])
- if not matched:
- continue
- start_pos = len(matched.group(1))
- break
- if not check_macro or start_pos < 0:
- # Don't waste time here if line doesn't contain 'CHECK' or 'EXPECT'
- return
-
- # Find end of the boolean expression by matching parentheses
- (last_line, end_line, end_pos) = CloseExpression(
- clean_lines, linenum, start_pos)
- if end_pos < 0:
- return
- if linenum == end_line:
- expression = lines[linenum][start_pos + 1:end_pos - 1]
- else:
- expression = lines[linenum][start_pos + 1:]
- for i in xrange(linenum + 1, end_line):
- expression += lines[i]
- expression += last_line[0:end_pos - 1]
-
- # Parse expression so that we can take parentheses into account.
- # This avoids false positives for inputs like "CHECK((a < 4) == b)",
- # which is not replaceable by CHECK_LE.
- lhs = ''
- rhs = ''
- operator = None
- while expression:
- matched = Match(r'^\s*(<<|<<=|>>|>>=|->\*|->|&&|\|\||'
- r'==|!=|>=|>|<=|<|\()(.*)$', expression)
- if matched:
- token = matched.group(1)
- if token == '(':
- # Parenthesized operand
- expression = matched.group(2)
- (end, _) = FindEndOfExpressionInLine(expression, 0, 1, '(', ')')
- if end < 0:
- return # Unmatched parenthesis
- lhs += '(' + expression[0:end]
- expression = expression[end:]
- elif token in ('&&', '||'):
- # Logical and/or operators. This means the expression
- # contains more than one term, for example:
- # CHECK(42 < a && a < b);
- #
- # These are not replaceable with CHECK_LE, so bail out early.
- return
- elif token in ('<<', '<<=', '>>', '>>=', '->*', '->'):
- # Non-relational operator
- lhs += token
- expression = matched.group(2)
- else:
- # Relational operator
- operator = token
- rhs = matched.group(2)
- break
- else:
- # Unparenthesized operand. Instead of appending to lhs one character
- # at a time, we do another regular expression match to consume several
- # characters at once if possible. Trivial benchmark shows that this
- # is more efficient when the operands are longer than a single
- # character, which is generally the case.
- matched = Match(r'^([^-=!<>()&|]+)(.*)$', expression)
- if not matched:
- matched = Match(r'^(\s*\S)(.*)$', expression)
- if not matched:
- break
- lhs += matched.group(1)
- expression = matched.group(2)
-
- # Only apply checks if we got all parts of the boolean expression
- if not (lhs and operator and rhs):
- return
-
- # Check that rhs do not contain logical operators. We already know
- # that lhs is fine since the loop above parses out && and ||.
- if rhs.find('&&') > -1 or rhs.find('||') > -1:
- return
-
- # At least one of the operands must be a constant literal. This is
- # to avoid suggesting replacements for unprintable things like
- # CHECK(variable != iterator)
- #
- # The following pattern matches decimal, hex integers, strings, and
- # characters (in that order).
- lhs = lhs.strip()
- rhs = rhs.strip()
- match_constant = r'^([-+]?(\d+|0[xX][0-9a-fA-F]+)[lLuU]{0,3}|".*"|\'.*\')$'
- if Match(match_constant, lhs) or Match(match_constant, rhs):
- # Note: since we know both lhs and rhs, we can provide a more
- # descriptive error message like:
- # Consider using CHECK_EQ(x, 42) instead of CHECK(x == 42)
- # Instead of:
- # Consider using CHECK_EQ instead of CHECK(a == b)
- #
- # We are still keeping the less descriptive message because if lhs
- # or rhs gets long, the error message might become unreadable.
- error(filename, linenum, 'readability/check', 2,
- 'Consider using %s instead of %s(a %s b)' % (
- _CHECK_REPLACEMENT[check_macro][operator],
- check_macro, operator))
-
-
-def CheckAltTokens(filename, clean_lines, linenum, error):
- """Check alternative keywords being used in boolean expressions.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum]
-
- # Avoid preprocessor lines
- if Match(r'^\s*#', line):
- return
-
- # Last ditch effort to avoid multi-line comments. This will not help
- # if the comment started before the current line or ended after the
- # current line, but it catches most of the false positives. At least,
- # it provides a way to workaround this warning for people who use
- # multi-line comments in preprocessor macros.
- #
- # TODO(unknown): remove this once cpplint has better support for
- # multi-line comments.
- if line.find('/*') >= 0 or line.find('*/') >= 0:
- return
-
- for match in _ALT_TOKEN_REPLACEMENT_PATTERN.finditer(line):
- error(filename, linenum, 'readability/alt_tokens', 2,
- 'Use operator %s instead of %s' % (
- _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1)))
-
-
-def GetLineWidth(line):
- """Determines the width of the line in column positions.
-
- Args:
- line: A string, which may be a Unicode string.
-
- Returns:
- The width of the line in column positions, accounting for Unicode
- combining characters and wide characters.
- """
- if isinstance(line, unicode):
- width = 0
- for uc in unicodedata.normalize('NFC', line):
- if unicodedata.east_asian_width(uc) in ('W', 'F'):
- width += 2
- elif not unicodedata.combining(uc):
- width += 1
- return width
- else:
- return len(line)
-
-
-def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
- error):
- """Checks rules from the 'C++ style rules' section of cppguide.html.
-
- Most of these rules are hard to test (naming, comment style), but we
- do what we can. In particular we check for 2-space indents, line lengths,
- tab usage, spaces inside code, etc.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- file_extension: The extension (without the dot) of the filename.
- nesting_state: A _NestingState instance which maintains information about
- the current stack of nested blocks being parsed.
- error: The function to call with any errors found.
- """
-
- # Don't use "elided" lines here, otherwise we can't check commented lines.
- # Don't want to use "raw" either, because we don't want to check inside C++11
- # raw strings,
- raw_lines = clean_lines.lines_without_raw_strings
- line = raw_lines[linenum]
-
- if line.find('\t') != -1:
- error(filename, linenum, 'whitespace/tab', 1,
- 'Tab found; better to use spaces')
-
- # One or three blank spaces at the beginning of the line is weird; it's
- # hard to reconcile that with 2-space indents.
- # NOTE: here are the conditions rob pike used for his tests. Mine aren't
- # as sophisticated, but it may be worth becoming so: RLENGTH==initial_spaces
- # if(RLENGTH > 20) complain = 0;
- # if(match($0, " +(error|private|public|protected):")) complain = 0;
- # if(match(prev, "&& *$")) complain = 0;
- # if(match(prev, "\\|\\| *$")) complain = 0;
- # if(match(prev, "[\",=><] *$")) complain = 0;
- # if(match($0, " <<")) complain = 0;
- # if(match(prev, " +for \\(")) complain = 0;
- # if(prevodd && match(prevprev, " +for \\(")) complain = 0;
- initial_spaces = 0
- cleansed_line = clean_lines.elided[linenum]
- while initial_spaces < len(line) and line[initial_spaces] == ' ':
- initial_spaces += 1
- if line and line[-1].isspace():
- error(filename, linenum, 'whitespace/end_of_line', 4,
- 'Line ends in whitespace. Consider deleting these extra spaces.')
- # There are certain situations we allow one space, notably for section labels
- elif ((initial_spaces == 1 or initial_spaces == 3) and
- not Match(r'\s*\w+\s*:\s*$', cleansed_line)):
- error(filename, linenum, 'whitespace/indent', 3,
- 'Weird number of spaces at line-start. '
- 'Are you using a 2-space indent?')
-
- # Check if the line is a header guard.
- is_header_guard = False
- if file_extension == 'h':
- cppvar = GetHeaderGuardCPPVariable(filename)
- if (line.startswith('#ifndef %s' % cppvar) or
- line.startswith('#define %s' % cppvar) or
- line.startswith('#endif // %s' % cppvar)):
- is_header_guard = True
- # #include lines and header guards can be long, since there's no clean way to
- # split them.
- #
- # URLs can be long too. It's possible to split these, but it makes them
- # harder to cut&paste.
- #
- # The "$Id:...$" comment may also get very long without it being the
- # developers fault.
- if (not line.startswith('#include') and not is_header_guard and
- not Match(r'^\s*//.*http(s?)://\S*$', line) and
- not Match(r'^// \$Id:.*#[0-9]+ \$$', line)):
- line_width = GetLineWidth(line)
- extended_length = int((_line_length * 1.25))
- if line_width > extended_length:
- error(filename, linenum, 'whitespace/line_length', 4,
- 'Lines should very rarely be longer than %i characters' %
- extended_length)
- elif line_width > _line_length:
- error(filename, linenum, 'whitespace/line_length', 2,
- 'Lines should be <= %i characters long' % _line_length)
-
- if (cleansed_line.count(';') > 1 and
- # for loops are allowed two ;'s (and may run over two lines).
- cleansed_line.find('for') == -1 and
- (GetPreviousNonBlankLine(clean_lines, linenum)[0].find('for') == -1 or
- GetPreviousNonBlankLine(clean_lines, linenum)[0].find(';') != -1) and
- # It's ok to have many commands in a switch case that fits in 1 line
- not ((cleansed_line.find('case ') != -1 or
- cleansed_line.find('default:') != -1) and
- cleansed_line.find('break;') != -1)):
- error(filename, linenum, 'whitespace/newline', 0,
- 'More than one command on the same line')
-
- # Some more style checks
- CheckBraces(filename, clean_lines, linenum, error)
- CheckEmptyBlockBody(filename, clean_lines, linenum, error)
- CheckAccess(filename, clean_lines, linenum, nesting_state, error)
- CheckSpacing(filename, clean_lines, linenum, nesting_state, error)
- CheckCheck(filename, clean_lines, linenum, error)
- CheckAltTokens(filename, clean_lines, linenum, error)
- classinfo = nesting_state.InnermostClass()
- if classinfo:
- CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
-
-
-_RE_PATTERN_INCLUDE_NEW_STYLE = re.compile(r'#include +"[^/]+\.h"')
-_RE_PATTERN_INCLUDE = re.compile(r'^\s*#\s*include\s*([<"])([^>"]*)[>"].*$')
-# Matches the first component of a filename delimited by -s and _s. That is:
-# _RE_FIRST_COMPONENT.match('foo').group(0) == 'foo'
-# _RE_FIRST_COMPONENT.match('foo.cc').group(0) == 'foo'
-# _RE_FIRST_COMPONENT.match('foo-bar_baz.cc').group(0) == 'foo'
-# _RE_FIRST_COMPONENT.match('foo_bar-baz.cc').group(0) == 'foo'
-_RE_FIRST_COMPONENT = re.compile(r'^[^-_.]+')
-
-
-def _DropCommonSuffixes(filename):
- """Drops common suffixes like _test.cc or -inl.h from filename.
-
- For example:
- >>> _DropCommonSuffixes('foo/foo-inl.h')
- 'foo/foo'
- >>> _DropCommonSuffixes('foo/bar/foo.cc')
- 'foo/bar/foo'
- >>> _DropCommonSuffixes('foo/foo_internal.h')
- 'foo/foo'
- >>> _DropCommonSuffixes('foo/foo_unusualinternal.h')
- 'foo/foo_unusualinternal'
-
- Args:
- filename: The input filename.
-
- Returns:
- The filename with the common suffix removed.
- """
- for suffix in ('test.cc', 'regtest.cc', 'unittest.cc',
- 'inl.h', 'impl.h', 'internal.h'):
- if (filename.endswith(suffix) and len(filename) > len(suffix) and
- filename[-len(suffix) - 1] in ('-', '_')):
- return filename[:-len(suffix) - 1]
- return os.path.splitext(filename)[0]
-
-
-def _IsTestFilename(filename):
- """Determines if the given filename has a suffix that identifies it as a test.
-
- Args:
- filename: The input filename.
-
- Returns:
- True if 'filename' looks like a test, False otherwise.
- """
- if (filename.endswith('_test.cc') or
- filename.endswith('_unittest.cc') or
- filename.endswith('_regtest.cc')):
- return True
- else:
- return False
-
-
-def _ClassifyInclude(fileinfo, include, is_system):
- """Figures out what kind of header 'include' is.
-
- Args:
- fileinfo: The current file cpplint is running over. A FileInfo instance.
- include: The path to a #included file.
- is_system: True if the #include used <> rather than "".
-
- Returns:
- One of the _XXX_HEADER constants.
-
- For example:
- >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'stdio.h', True)
- _C_SYS_HEADER
- >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'string', True)
- _CPP_SYS_HEADER
- >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/foo.h', False)
- _LIKELY_MY_HEADER
- >>> _ClassifyInclude(FileInfo('foo/foo_unknown_extension.cc'),
- ... 'bar/foo_other_ext.h', False)
- _POSSIBLE_MY_HEADER
- >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/bar.h', False)
- _OTHER_HEADER
- """
- # This is a list of all standard c++ header files, except
- # those already checked for above.
- is_cpp_h = include in _CPP_HEADERS
-
- if is_system:
- if is_cpp_h:
- return _CPP_SYS_HEADER
- else:
- return _C_SYS_HEADER
-
- # If the target file and the include we're checking share a
- # basename when we drop common extensions, and the include
- # lives in . , then it's likely to be owned by the target file.
- target_dir, target_base = (
- os.path.split(_DropCommonSuffixes(fileinfo.RepositoryName())))
- include_dir, include_base = os.path.split(_DropCommonSuffixes(include))
- if target_base == include_base and (
- include_dir == target_dir or
- include_dir == os.path.normpath(target_dir + '/../public')):
- return _LIKELY_MY_HEADER
-
- # If the target and include share some initial basename
- # component, it's possible the target is implementing the
- # include, so it's allowed to be first, but we'll never
- # complain if it's not there.
- target_first_component = _RE_FIRST_COMPONENT.match(target_base)
- include_first_component = _RE_FIRST_COMPONENT.match(include_base)
- if (target_first_component and include_first_component and
- target_first_component.group(0) ==
- include_first_component.group(0)):
- return _POSSIBLE_MY_HEADER
-
- return _OTHER_HEADER
-
-
-
-def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
- """Check rules that are applicable to #include lines.
-
- Strings on #include lines are NOT removed from elided line, to make
- certain tasks easier. However, to prevent false positives, checks
- applicable to #include lines in CheckLanguage must be put here.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- include_state: An _IncludeState instance in which the headers are inserted.
- error: The function to call with any errors found.
- """
- fileinfo = FileInfo(filename)
-
- line = clean_lines.lines[linenum]
-
- # "include" should use the new style "foo/bar.h" instead of just "bar.h"
- if _RE_PATTERN_INCLUDE_NEW_STYLE.search(line):
- error(filename, linenum, 'build/include', 4,
- 'Include the directory when naming .h files')
-
- # we shouldn't include a file more than once. actually, there are a
- # handful of instances where doing so is okay, but in general it's
- # not.
- match = _RE_PATTERN_INCLUDE.search(line)
- if match:
- include = match.group(2)
- is_system = (match.group(1) == '<')
- if include in include_state:
- error(filename, linenum, 'build/include', 4,
- '"%s" already included at %s:%s' %
- (include, filename, include_state[include]))
- else:
- include_state[include] = linenum
-
- # We want to ensure that headers appear in the right order:
- # 1) for foo.cc, foo.h (preferred location)
- # 2) c system files
- # 3) cpp system files
- # 4) for foo.cc, foo.h (deprecated location)
- # 5) other google headers
- #
- # We classify each include statement as one of those 5 types
- # using a number of techniques. The include_state object keeps
- # track of the highest type seen, and complains if we see a
- # lower type after that.
- error_message = include_state.CheckNextIncludeOrder(
- _ClassifyInclude(fileinfo, include, is_system))
- if error_message:
- error(filename, linenum, 'build/include_order', 4,
- '%s. Should be: %s.h, c system, c++ system, other.' %
- (error_message, fileinfo.BaseName()))
- canonical_include = include_state.CanonicalizeAlphabeticalOrder(include)
- if not include_state.IsInAlphabeticalOrder(
- clean_lines, linenum, canonical_include):
- error(filename, linenum, 'build/include_alpha', 4,
- 'Include "%s" not in alphabetical order' % include)
- include_state.SetLastHeader(canonical_include)
-
- # Look for any of the stream classes that are part of standard C++.
- match = _RE_PATTERN_INCLUDE.match(line)
- if match:
- include = match.group(2)
- if Match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include):
- # Many unit tests use cout, so we exempt them.
- if not _IsTestFilename(filename):
- error(filename, linenum, 'readability/streams', 3,
- 'Streams are highly discouraged.')
-
-
-def _GetTextInside(text, start_pattern):
- r"""Retrieves all the text between matching open and close parentheses.
-
- Given a string of lines and a regular expression string, retrieve all the text
- following the expression and between opening punctuation symbols like
- (, [, or {, and the matching close-punctuation symbol. This properly nested
- occurrences of the punctuations, so for the text like
- printf(a(), b(c()));
- a call to _GetTextInside(text, r'printf\(') will return 'a(), b(c())'.
- start_pattern must match string having an open punctuation symbol at the end.
-
- Args:
- text: The lines to extract text. Its comments and strings must be elided.
- It can be single line and can span multiple lines.
- start_pattern: The regexp string indicating where to start extracting
- the text.
- Returns:
- The extracted text.
- None if either the opening string or ending punctuation could not be found.
- """
- # TODO(sugawarayu): Audit cpplint.py to see what places could be profitably
- # rewritten to use _GetTextInside (and use inferior regexp matching today).
-
- # Give opening punctuations to get the matching close-punctuations.
- matching_punctuation = {'(': ')', '{': '}', '[': ']'}
- closing_punctuation = set(matching_punctuation.itervalues())
-
- # Find the position to start extracting text.
- match = re.search(start_pattern, text, re.M)
- if not match: # start_pattern not found in text.
- return None
- start_position = match.end(0)
-
- assert start_position > 0, (
- 'start_pattern must ends with an opening punctuation.')
- assert text[start_position - 1] in matching_punctuation, (
- 'start_pattern must ends with an opening punctuation.')
- # Stack of closing punctuations we expect to have in text after position.
- punctuation_stack = [matching_punctuation[text[start_position - 1]]]
- position = start_position
- while punctuation_stack and position < len(text):
- if text[position] == punctuation_stack[-1]:
- punctuation_stack.pop()
- elif text[position] in closing_punctuation:
- # A closing punctuation without matching opening punctuations.
- return None
- elif text[position] in matching_punctuation:
- punctuation_stack.append(matching_punctuation[text[position]])
- position += 1
- if punctuation_stack:
- # Opening punctuations left without matching close-punctuations.
- return None
- # punctuations match.
- return text[start_position:position - 1]
-
-
-# Patterns for matching call-by-reference parameters.
-#
-# Supports nested templates up to 2 levels deep using this messy pattern:
-# < (?: < (?: < [^<>]*
-# >
-# | [^<>] )*
-# >
-# | [^<>] )*
-# >
-_RE_PATTERN_IDENT = r'[_a-zA-Z]\w*' # =~ [[:alpha:]][[:alnum:]]*
-_RE_PATTERN_TYPE = (
- r'(?:const\s+)?(?:typename\s+|class\s+|struct\s+|union\s+|enum\s+)?'
- r'(?:\w|'
- r'\s*<(?:<(?:<[^<>]*>|[^<>])*>|[^<>])*>|'
- r'::)+')
-# A call-by-reference parameter ends with '& identifier'.
-_RE_PATTERN_REF_PARAM = re.compile(
- r'(' + _RE_PATTERN_TYPE + r'(?:\s*(?:\bconst\b|[*]))*\s*'
- r'&\s*' + _RE_PATTERN_IDENT + r')\s*(?:=[^,()]+)?[,)]')
-# A call-by-const-reference parameter either ends with 'const& identifier'
-# or looks like 'const type& identifier' when 'type' is atomic.
-_RE_PATTERN_CONST_REF_PARAM = (
- r'(?:.*\s*\bconst\s*&\s*' + _RE_PATTERN_IDENT +
- r'|const\s+' + _RE_PATTERN_TYPE + r'\s*&\s*' + _RE_PATTERN_IDENT + r')')
-
-
-def CheckLanguage(filename, clean_lines, linenum, file_extension,
- include_state, nesting_state, error):
- """Checks rules from the 'C++ language rules' section of cppguide.html.
-
- Some of these rules are hard to test (function overloading, using
- uint32 inappropriately), but we do the best we can.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- file_extension: The extension (without the dot) of the filename.
- include_state: An _IncludeState instance in which the headers are inserted.
- nesting_state: A _NestingState instance which maintains information about
- the current stack of nested blocks being parsed.
- error: The function to call with any errors found.
- """
- # If the line is empty or consists of entirely a comment, no need to
- # check it.
- line = clean_lines.elided[linenum]
- if not line:
- return
-
- match = _RE_PATTERN_INCLUDE.search(line)
- if match:
- CheckIncludeLine(filename, clean_lines, linenum, include_state, error)
- return
-
- # Reset include state across preprocessor directives. This is meant
- # to silence warnings for conditional includes.
- if Match(r'^\s*#\s*(?:ifdef|elif|else|endif)\b', line):
- include_state.ResetSection()
-
- # Make Windows paths like Unix.
- fullname = os.path.abspath(filename).replace('\\', '/')
-
- # TODO(unknown): figure out if they're using default arguments in fn proto.
-
- # Check to see if they're using an conversion function cast.
- # I just try to capture the most common basic types, though there are more.
- # Parameterless conversion functions, such as bool(), are allowed as they are
- # probably a member operator declaration or default constructor.
- match = Search(
- r'(\bnew\s+)?\b' # Grab 'new' operator, if it's there
- r'(int|float|double|bool|char|int32|uint32|int64|uint64)'
- r'(\([^)].*)', line)
- if match:
- matched_new = match.group(1)
- matched_type = match.group(2)
- matched_funcptr = match.group(3)
-
- # gMock methods are defined using some variant of MOCK_METHODx(name, type)
- # where type may be float(), int(string), etc. Without context they are
- # virtually indistinguishable from int(x) casts. Likewise, gMock's
- # MockCallback takes a template parameter of the form return_type(arg_type),
- # which looks much like the cast we're trying to detect.
- #
- # std::function<> wrapper has a similar problem.
- #
- # Return types for function pointers also look like casts if they
- # don't have an extra space.
- if (matched_new is None and # If new operator, then this isn't a cast
- not (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
- Search(r'\bMockCallback<.*>', line) or
- Search(r'\bstd::function<.*>', line)) and
- not (matched_funcptr and
- Match(r'\((?:[^() ]+::\s*\*\s*)?[^() ]+\)\s*\(',
- matched_funcptr))):
- # Try a bit harder to catch gmock lines: the only place where
- # something looks like an old-style cast is where we declare the
- # return type of the mocked method, and the only time when we
- # are missing context is if MOCK_METHOD was split across
- # multiple lines. The missing MOCK_METHOD is usually one or two
- # lines back, so scan back one or two lines.
- #
- # It's not possible for gmock macros to appear in the first 2
- # lines, since the class head + section name takes up 2 lines.
- if (linenum < 2 or
- not (Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\((?:\S+,)?\s*$',
- clean_lines.elided[linenum - 1]) or
- Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\(\s*$',
- clean_lines.elided[linenum - 2]))):
- error(filename, linenum, 'readability/casting', 4,
- 'Using deprecated casting style. '
- 'Use static_cast<%s>(...) instead' %
- matched_type)
-
- CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
- 'static_cast',
- r'\((int|float|double|bool|char|u?int(16|32|64))\)', error)
-
- # This doesn't catch all cases. Consider (const char * const)"hello".
- #
- # (char *) "foo" should always be a const_cast (reinterpret_cast won't
- # compile).
- if CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
- 'const_cast', r'\((char\s?\*+\s?)\)\s*"', error):
- pass
- else:
- # Check pointer casts for other than string constants
- CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
- 'reinterpret_cast', r'\((\w+\s?\*+\s?)\)', error)
-
- # In addition, we look for people taking the address of a cast. This
- # is dangerous -- casts can assign to temporaries, so the pointer doesn't
- # point where you think.
- match = Search(
- r'(?:&\(([^)]+)\)[\w(])|'
- r'(?:&(static|dynamic|down|reinterpret)_cast\b)', line)
- if match and match.group(1) != '*':
- error(filename, linenum, 'runtime/casting', 4,
- ('Are you taking an address of a cast? '
- 'This is dangerous: could be a temp var. '
- 'Take the address before doing the cast, rather than after'))
-
- # Create an extended_line, which is the concatenation of the current and
- # next lines, for more effective checking of code that may span more than one
- # line.
- if linenum + 1 < clean_lines.NumLines():
- extended_line = line + clean_lines.elided[linenum + 1]
- else:
- extended_line = line
-
- # Check for people declaring static/global STL strings at the top level.
- # This is dangerous because the C++ language does not guarantee that
- # globals with constructors are initialized before the first access.
- match = Match(
- r'((?:|static +)(?:|const +))string +([a-zA-Z0-9_:]+)\b(.*)',
- line)
- # Make sure it's not a function.
- # Function template specialization looks like: "string foo<Type>(...".
- # Class template definitions look like: "string Foo<Type>::Method(...".
- #
- # Also ignore things that look like operators. These are matched separately
- # because operator names cross non-word boundaries. If we change the pattern
- # above, we would decrease the accuracy of matching identifiers.
- if (match and
- not Search(r'\boperator\W', line) and
- not Match(r'\s*(<.*>)?(::[a-zA-Z0-9_]+)?\s*\(([^"]|$)', match.group(3))):
- error(filename, linenum, 'runtime/string', 4,
- 'For a static/global string constant, use a C style string instead: '
- '"%schar %s[]".' %
- (match.group(1), match.group(2)))
-
- if Search(r'\b([A-Za-z0-9_]*_)\(\1\)', line):
- error(filename, linenum, 'runtime/init', 4,
- 'You seem to be initializing a member variable with itself.')
-
- if file_extension == 'h':
- # TODO(unknown): check that 1-arg constructors are explicit.
- # How to tell it's a constructor?
- # (handled in CheckForNonStandardConstructs for now)
- # TODO(unknown): check that classes have DISALLOW_EVIL_CONSTRUCTORS
- # (level 1 error)
- pass
-
- # Check if people are using the verboten C basic types. The only exception
- # we regularly allow is "unsigned short port" for port.
- if Search(r'\bshort port\b', line):
- if not Search(r'\bunsigned short port\b', line):
- error(filename, linenum, 'runtime/int', 4,
- 'Use "unsigned short" for ports, not "short"')
- else:
- match = Search(r'\b(short|long(?! +double)|long long)\b', line)
- if match:
- error(filename, linenum, 'runtime/int', 4,
- 'Use int16/int64/etc, rather than the C type %s' % match.group(1))
-
- # When snprintf is used, the second argument shouldn't be a literal.
- match = Search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line)
- if match and match.group(2) != '0':
- # If 2nd arg is zero, snprintf is used to calculate size.
- error(filename, linenum, 'runtime/printf', 3,
- 'If you can, use sizeof(%s) instead of %s as the 2nd arg '
- 'to snprintf.' % (match.group(1), match.group(2)))
-
- # Check if some verboten C functions are being used.
- if Search(r'\bsprintf\b', line):
- error(filename, linenum, 'runtime/printf', 5,
- 'Never use sprintf. Use snprintf instead.')
- match = Search(r'\b(strcpy|strcat)\b', line)
- if match:
- error(filename, linenum, 'runtime/printf', 4,
- 'Almost always, snprintf is better than %s' % match.group(1))
-
- # Check if some verboten operator overloading is going on
- # TODO(unknown): catch out-of-line unary operator&:
- # class X {};
- # int operator&(const X& x) { return 42; } // unary operator&
- # The trick is it's hard to tell apart from binary operator&:
- # class Y { int operator&(const Y& x) { return 23; } }; // binary operator&
- if Search(r'\boperator\s*&\s*\(\s*\)', line):
- error(filename, linenum, 'runtime/operator', 4,
- 'Unary operator& is dangerous. Do not use it.')
-
- # Check for suspicious usage of "if" like
- # } if (a == b) {
- if Search(r'\}\s*if\s*\(', line):
- error(filename, linenum, 'readability/braces', 4,
- 'Did you mean "else if"? If not, start a new line for "if".')
-
- # Check for potential format string bugs like printf(foo).
- # We constrain the pattern not to pick things like DocidForPrintf(foo).
- # Not perfect but it can catch printf(foo.c_str()) and printf(foo->c_str())
- # TODO(sugawarayu): Catch the following case. Need to change the calling
- # convention of the whole function to process multiple line to handle it.
- # printf(
- # boy_this_is_a_really_long_variable_that_cannot_fit_on_the_prev_line);
- printf_args = _GetTextInside(line, r'(?i)\b(string)?printf\s*\(')
- if printf_args:
- match = Match(r'([\w.\->()]+)$', printf_args)
- if match and match.group(1) != '__VA_ARGS__':
- function_name = re.search(r'\b((?:string)?printf)\s*\(',
- line, re.I).group(1)
- error(filename, linenum, 'runtime/printf', 4,
- 'Potential format string bug. Do %s("%%s", %s) instead.'
- % (function_name, match.group(1)))
-
- # Check for potential memset bugs like memset(buf, sizeof(buf), 0).
- match = Search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line)
- if match and not Match(r"^''|-?[0-9]+|0x[0-9A-Fa-f]$", match.group(2)):
- error(filename, linenum, 'runtime/memset', 4,
- 'Did you mean "memset(%s, 0, %s)"?'
- % (match.group(1), match.group(2)))
-
- if Search(r'\busing namespace\b', line):
- error(filename, linenum, 'build/namespaces', 5,
- 'Do not use namespace using-directives. '
- 'Use using-declarations instead.')
-
- # Detect variable-length arrays.
- match = Match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line)
- if (match and match.group(2) != 'return' and match.group(2) != 'delete' and
- match.group(3).find(']') == -1):
- # Split the size using space and arithmetic operators as delimiters.
- # If any of the resulting tokens are not compile time constants then
- # report the error.
- tokens = re.split(r'\s|\+|\-|\*|\/|<<|>>]', match.group(3))
- is_const = True
- skip_next = False
- for tok in tokens:
- if skip_next:
- skip_next = False
- continue
-
- if Search(r'sizeof\(.+\)', tok): continue
- if Search(r'arraysize\(\w+\)', tok): continue
-
- tok = tok.lstrip('(')
- tok = tok.rstrip(')')
- if not tok: continue
- if Match(r'\d+', tok): continue
- if Match(r'0[xX][0-9a-fA-F]+', tok): continue
- if Match(r'k[A-Z0-9]\w*', tok): continue
- if Match(r'(.+::)?k[A-Z0-9]\w*', tok): continue
- if Match(r'(.+::)?[A-Z][A-Z0-9_]*', tok): continue
- # A catch all for tricky sizeof cases, including 'sizeof expression',
- # 'sizeof(*type)', 'sizeof(const type)', 'sizeof(struct StructName)'
- # requires skipping the next token because we split on ' ' and '*'.
- if tok.startswith('sizeof'):
- skip_next = True
- continue
- is_const = False
- break
- if not is_const:
- error(filename, linenum, 'runtime/arrays', 1,
- 'Do not use variable-length arrays. Use an appropriately named '
- "('k' followed by CamelCase) compile-time constant for the size.")
-
- # If DISALLOW_EVIL_CONSTRUCTORS, DISALLOW_COPY_AND_ASSIGN, or
- # DISALLOW_IMPLICIT_CONSTRUCTORS is present, then it should be the last thing
- # in the class declaration.
- match = Match(
- (r'\s*'
- r'(DISALLOW_(EVIL_CONSTRUCTORS|COPY_AND_ASSIGN|IMPLICIT_CONSTRUCTORS))'
- r'\(.*\);$'),
- line)
- if match and linenum + 1 < clean_lines.NumLines():
- next_line = clean_lines.elided[linenum + 1]
- # We allow some, but not all, declarations of variables to be present
- # in the statement that defines the class. The [\w\*,\s]* fragment of
- # the regular expression below allows users to declare instances of
- # the class or pointers to instances, but not less common types such
- # as function pointers or arrays. It's a tradeoff between allowing
- # reasonable code and avoiding trying to parse more C++ using regexps.
- if not Search(r'^\s*}[\w\*,\s]*;', next_line):
- error(filename, linenum, 'readability/constructors', 3,
- match.group(1) + ' should be the last thing in the class')
-
- # Check for use of unnamed namespaces in header files. Registration
- # macros are typically OK, so we allow use of "namespace {" on lines
- # that end with backslashes.
- if (file_extension == 'h'
- and Search(r'\bnamespace\s*{', line)
- and line[-1] != '\\'):
- error(filename, linenum, 'build/namespaces', 4,
- 'Do not use unnamed namespaces in header files. See '
- 'http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces'
- ' for more information.')
-
-def CheckForNonConstReference(filename, clean_lines, linenum,
- nesting_state, error):
- """Check for non-const references.
-
- Separate from CheckLanguage since it scans backwards from current
- line, instead of scanning forward.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- nesting_state: A _NestingState instance which maintains information about
- the current stack of nested blocks being parsed.
- error: The function to call with any errors found.
- """
- # Do nothing if there is no '&' on current line.
- line = clean_lines.elided[linenum]
- if '&' not in line:
- return
-
- # Long type names may be broken across multiple lines, usually in one
- # of these forms:
- # LongType
- # ::LongTypeContinued &identifier
- # LongType::
- # LongTypeContinued &identifier
- # LongType<
- # ...>::LongTypeContinued &identifier
- #
- # If we detected a type split across two lines, join the previous
- # line to current line so that we can match const references
- # accordingly.
- #
- # Note that this only scans back one line, since scanning back
- # arbitrary number of lines would be expensive. If you have a type
- # that spans more than 2 lines, please use a typedef.
- if linenum > 1:
- previous = None
- if Match(r'\s*::(?:[\w<>]|::)+\s*&\s*\S', line):
- # previous_line\n + ::current_line
- previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+[\w<>])\s*$',
- clean_lines.elided[linenum - 1])
- elif Match(r'\s*[a-zA-Z_]([\w<>]|::)+\s*&\s*\S', line):
- # previous_line::\n + current_line
- previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+::)\s*$',
- clean_lines.elided[linenum - 1])
- if previous:
- line = previous.group(1) + line.lstrip()
- else:
- # Check for templated parameter that is split across multiple lines
- endpos = line.rfind('>')
- if endpos > -1:
- (_, startline, startpos) = ReverseCloseExpression(
- clean_lines, linenum, endpos)
- if startpos > -1 and startline < linenum:
- # Found the matching < on an earlier line, collect all
- # pieces up to current line.
- line = ''
- for i in xrange(startline, linenum + 1):
- line += clean_lines.elided[i].strip()
-
- # Check for non-const references in function parameters. A single '&' may
- # found in the following places:
- # inside expression: binary & for bitwise AND
- # inside expression: unary & for taking the address of something
- # inside declarators: reference parameter
- # We will exclude the first two cases by checking that we are not inside a
- # function body, including one that was just introduced by a trailing '{'.
- # TODO(unknwon): Doesn't account for preprocessor directives.
- # TODO(unknown): Doesn't account for 'catch(Exception& e)' [rare].
- check_params = False
- if not nesting_state.stack:
- check_params = True # top level
- elif (isinstance(nesting_state.stack[-1], _ClassInfo) or
- isinstance(nesting_state.stack[-1], _NamespaceInfo)):
- check_params = True # within class or namespace
- elif Match(r'.*{\s*$', line):
- if (len(nesting_state.stack) == 1 or
- isinstance(nesting_state.stack[-2], _ClassInfo) or
- isinstance(nesting_state.stack[-2], _NamespaceInfo)):
- check_params = True # just opened global/class/namespace block
- # We allow non-const references in a few standard places, like functions
- # called "swap()" or iostream operators like "<<" or ">>". Do not check
- # those function parameters.
- #
- # We also accept & in static_assert, which looks like a function but
- # it's actually a declaration expression.
- whitelisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
- r'operator\s*[<>][<>]|'
- r'static_assert|COMPILE_ASSERT'
- r')\s*\(')
- if Search(whitelisted_functions, line):
- check_params = False
- elif not Search(r'\S+\([^)]*$', line):
- # Don't see a whitelisted function on this line. Actually we
- # didn't see any function name on this line, so this is likely a
- # multi-line parameter list. Try a bit harder to catch this case.
- for i in xrange(2):
- if (linenum > i and
- Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])):
- check_params = False
- break
-
- if check_params:
- decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body
- for parameter in re.findall(_RE_PATTERN_REF_PARAM, decls):
- if not Match(_RE_PATTERN_CONST_REF_PARAM, parameter):
- error(filename, linenum, 'runtime/references', 2,
- 'Is this a non-const reference? '
- 'If so, make const or use a pointer: ' +
- ReplaceAll(' *<', '<', parameter))
-
-
-def CheckCStyleCast(filename, linenum, line, raw_line, cast_type, pattern,
- error):
- """Checks for a C-style cast by looking for the pattern.
-
- Args:
- filename: The name of the current file.
- linenum: The number of the line to check.
- line: The line of code to check.
- raw_line: The raw line of code to check, with comments.
- cast_type: The string for the C++ cast to recommend. This is either
- reinterpret_cast, static_cast, or const_cast, depending.
- pattern: The regular expression used to find C-style casts.
- error: The function to call with any errors found.
-
- Returns:
- True if an error was emitted.
- False otherwise.
- """
- match = Search(pattern, line)
- if not match:
- return False
-
- # e.g., sizeof(int)
- sizeof_match = Match(r'.*sizeof\s*$', line[0:match.start(1) - 1])
- if sizeof_match:
- error(filename, linenum, 'runtime/sizeof', 1,
- 'Using sizeof(type). Use sizeof(varname) instead if possible')
- return True
-
- # operator++(int) and operator--(int)
- if (line[0:match.start(1) - 1].endswith(' operator++') or
- line[0:match.start(1) - 1].endswith(' operator--')):
- return False
-
- # A single unnamed argument for a function tends to look like old
- # style cast. If we see those, don't issue warnings for deprecated
- # casts, instead issue warnings for unnamed arguments where
- # appropriate.
- #
- # These are things that we want warnings for, since the style guide
- # explicitly require all parameters to be named:
- # Function(int);
- # Function(int) {
- # ConstMember(int) const;
- # ConstMember(int) const {
- # ExceptionMember(int) throw (...);
- # ExceptionMember(int) throw (...) {
- # PureVirtual(int) = 0;
- #
- # These are functions of some sort, where the compiler would be fine
- # if they had named parameters, but people often omit those
- # identifiers to reduce clutter:
- # (FunctionPointer)(int);
- # (FunctionPointer)(int) = value;
- # Function((function_pointer_arg)(int))
- # <TemplateArgument(int)>;
- # <(FunctionPointerTemplateArgument)(int)>;
- remainder = line[match.end(0):]
- if Match(r'^\s*(?:;|const\b|throw\b|=|>|\{|\))', remainder):
- # Looks like an unnamed parameter.
-
- # Don't warn on any kind of template arguments.
- if Match(r'^\s*>', remainder):
- return False
-
- # Don't warn on assignments to function pointers, but keep warnings for
- # unnamed parameters to pure virtual functions. Note that this pattern
- # will also pass on assignments of "0" to function pointers, but the
- # preferred values for those would be "nullptr" or "NULL".
- matched_zero = Match(r'^\s=\s*(\S+)\s*;', remainder)
- if matched_zero and matched_zero.group(1) != '0':
- return False
-
- # Don't warn on function pointer declarations. For this we need
- # to check what came before the "(type)" string.
- if Match(r'.*\)\s*$', line[0:match.start(0)]):
- return False
-
- # Don't warn if the parameter is named with block comments, e.g.:
- # Function(int /*unused_param*/);
- if '/*' in raw_line:
- return False
-
- # Passed all filters, issue warning here.
- error(filename, linenum, 'readability/function', 3,
- 'All parameters should be named in a function')
- return True
-
- # At this point, all that should be left is actual casts.
- error(filename, linenum, 'readability/casting', 4,
- 'Using C-style cast. Use %s<%s>(...) instead' %
- (cast_type, match.group(1)))
-
- return True
-
-
-_HEADERS_CONTAINING_TEMPLATES = (
- ('<deque>', ('deque',)),
- ('<functional>', ('unary_function', 'binary_function',
- 'plus', 'minus', 'multiplies', 'divides', 'modulus',
- 'negate',
- 'equal_to', 'not_equal_to', 'greater', 'less',
- 'greater_equal', 'less_equal',
- 'logical_and', 'logical_or', 'logical_not',
- 'unary_negate', 'not1', 'binary_negate', 'not2',
- 'bind1st', 'bind2nd',
- 'pointer_to_unary_function',
- 'pointer_to_binary_function',
- 'ptr_fun',
- 'mem_fun_t', 'mem_fun', 'mem_fun1_t', 'mem_fun1_ref_t',
- 'mem_fun_ref_t',
- 'const_mem_fun_t', 'const_mem_fun1_t',
- 'const_mem_fun_ref_t', 'const_mem_fun1_ref_t',
- 'mem_fun_ref',
- )),
- ('<limits>', ('numeric_limits',)),
- ('<list>', ('list',)),
- ('<map>', ('map', 'multimap',)),
- ('<memory>', ('allocator',)),
- ('<queue>', ('queue', 'priority_queue',)),
- ('<set>', ('set', 'multiset',)),
- ('<stack>', ('stack',)),
- ('<string>', ('char_traits', 'basic_string',)),
- ('<utility>', ('pair',)),
- ('<vector>', ('vector',)),
-
- # gcc extensions.
- # Note: std::hash is their hash, ::hash is our hash
- ('<hash_map>', ('hash_map', 'hash_multimap',)),
- ('<hash_set>', ('hash_set', 'hash_multiset',)),
- ('<slist>', ('slist',)),
- )
-
-_RE_PATTERN_STRING = re.compile(r'\bstring\b')
-
-_re_pattern_algorithm_header = []
-for _template in ('copy', 'max', 'min', 'min_element', 'sort', 'swap',
- 'transform'):
- # Match max<type>(..., ...), max(..., ...), but not foo->max, foo.max or
- # type::max().
- _re_pattern_algorithm_header.append(
- (re.compile(r'[^>.]\b' + _template + r'(<.*?>)?\([^\)]'),
- _template,
- '<algorithm>'))
-
-_re_pattern_templates = []
-for _header, _templates in _HEADERS_CONTAINING_TEMPLATES:
- for _template in _templates:
- _re_pattern_templates.append(
- (re.compile(r'(\<|\b)' + _template + r'\s*\<'),
- _template + '<>',
- _header))
-
-
-def FilesBelongToSameModule(filename_cc, filename_h):
- """Check if these two filenames belong to the same module.
-
- The concept of a 'module' here is a as follows:
- foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
- same 'module' if they are in the same directory.
- some/path/public/xyzzy and some/path/internal/xyzzy are also considered
- to belong to the same module here.
-
- If the filename_cc contains a longer path than the filename_h, for example,
- '/absolute/path/to/base/sysinfo.cc', and this file would include
- 'base/sysinfo.h', this function also produces the prefix needed to open the
- header. This is used by the caller of this function to more robustly open the
- header file. We don't have access to the real include paths in this context,
- so we need this guesswork here.
-
- Known bugs: tools/base/bar.cc and base/bar.h belong to the same module
- according to this implementation. Because of this, this function gives
- some false positives. This should be sufficiently rare in practice.
-
- Args:
- filename_cc: is the path for the .cc file
- filename_h: is the path for the header path
-
- Returns:
- Tuple with a bool and a string:
- bool: True if filename_cc and filename_h belong to the same module.
- string: the additional prefix needed to open the header file.
- """
-
- if not filename_cc.endswith('.cc'):
- return (False, '')
- filename_cc = filename_cc[:-len('.cc')]
- if filename_cc.endswith('_unittest'):
- filename_cc = filename_cc[:-len('_unittest')]
- elif filename_cc.endswith('_test'):
- filename_cc = filename_cc[:-len('_test')]
- filename_cc = filename_cc.replace('/public/', '/')
- filename_cc = filename_cc.replace('/internal/', '/')
-
- if not filename_h.endswith('.h'):
- return (False, '')
- filename_h = filename_h[:-len('.h')]
- if filename_h.endswith('-inl'):
- filename_h = filename_h[:-len('-inl')]
- filename_h = filename_h.replace('/public/', '/')
- filename_h = filename_h.replace('/internal/', '/')
-
- files_belong_to_same_module = filename_cc.endswith(filename_h)
- common_path = ''
- if files_belong_to_same_module:
- common_path = filename_cc[:-len(filename_h)]
- return files_belong_to_same_module, common_path
-
-
-def UpdateIncludeState(filename, include_state, io=codecs):
- """Fill up the include_state with new includes found from the file.
-
- Args:
- filename: the name of the header to read.
- include_state: an _IncludeState instance in which the headers are inserted.
- io: The io factory to use to read the file. Provided for testability.
-
- Returns:
- True if a header was succesfully added. False otherwise.
- """
- headerfile = None
- try:
- headerfile = io.open(filename, 'r', 'utf8', 'replace')
- except IOError:
- return False
- linenum = 0
- for line in headerfile:
- linenum += 1
- clean_line = CleanseComments(line)
- match = _RE_PATTERN_INCLUDE.search(clean_line)
- if match:
- include = match.group(2)
- # The value formatting is cute, but not really used right now.
- # What matters here is that the key is in include_state.
- include_state.setdefault(include, '%s:%d' % (filename, linenum))
- return True
-
-
-def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
- io=codecs):
- """Reports for missing stl includes.
-
- This function will output warnings to make sure you are including the headers
- necessary for the stl containers and functions that you use. We only give one
- reason to include a header. For example, if you use both equal_to<> and
- less<> in a .h file, only one (the latter in the file) of these will be
- reported as a reason to include the <functional>.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- include_state: An _IncludeState instance.
- error: The function to call with any errors found.
- io: The IO factory to use to read the header file. Provided for unittest
- injection.
- """
- required = {} # A map of header name to linenumber and the template entity.
- # Example of required: { '<functional>': (1219, 'less<>') }
-
- for linenum in xrange(clean_lines.NumLines()):
- line = clean_lines.elided[linenum]
- if not line or line[0] == '#':
- continue
-
- # String is special -- it is a non-templatized type in STL.
- matched = _RE_PATTERN_STRING.search(line)
- if matched:
- # Don't warn about strings in non-STL namespaces:
- # (We check only the first match per line; good enough.)
- prefix = line[:matched.start()]
- if prefix.endswith('std::') or not prefix.endswith('::'):
- required['<string>'] = (linenum, 'string')
-
- for pattern, template, header in _re_pattern_algorithm_header:
- if pattern.search(line):
- required[header] = (linenum, template)
-
- # The following function is just a speed up, no semantics are changed.
- if not '<' in line: # Reduces the cpu time usage by skipping lines.
- continue
-
- for pattern, template, header in _re_pattern_templates:
- if pattern.search(line):
- required[header] = (linenum, template)
-
- # The policy is that if you #include something in foo.h you don't need to
- # include it again in foo.cc. Here, we will look at possible includes.
- # Let's copy the include_state so it is only messed up within this function.
- include_state = include_state.copy()
-
- # Did we find the header for this file (if any) and succesfully load it?
- header_found = False
-
- # Use the absolute path so that matching works properly.
- abs_filename = FileInfo(filename).FullName()
-
- # For Emacs's flymake.
- # If cpplint is invoked from Emacs's flymake, a temporary file is generated
- # by flymake and that file name might end with '_flymake.cc'. In that case,
- # restore original file name here so that the corresponding header file can be
- # found.
- # e.g. If the file name is 'foo_flymake.cc', we should search for 'foo.h'
- # instead of 'foo_flymake.h'
- abs_filename = re.sub(r'_flymake\.cc$', '.cc', abs_filename)
-
- # include_state is modified during iteration, so we iterate over a copy of
- # the keys.
- header_keys = include_state.keys()
- for header in header_keys:
- (same_module, common_path) = FilesBelongToSameModule(abs_filename, header)
- fullpath = common_path + header
- if same_module and UpdateIncludeState(fullpath, include_state, io):
- header_found = True
-
- # If we can't find the header file for a .cc, assume it's because we don't
- # know where to look. In that case we'll give up as we're not sure they
- # didn't include it in the .h file.
- # TODO(unknown): Do a better job of finding .h files so we are confident that
- # not having the .h file means there isn't one.
- if filename.endswith('.cc') and not header_found:
- return
-
- # All the lines have been processed, report the errors found.
- for required_header_unstripped in required:
- template = required[required_header_unstripped][1]
- if required_header_unstripped.strip('<>"') not in include_state:
- error(filename, required[required_header_unstripped][0],
- 'build/include_what_you_use', 4,
- 'Add #include ' + required_header_unstripped + ' for ' + template)
-
-
-_RE_PATTERN_EXPLICIT_MAKEPAIR = re.compile(r'\bmake_pair\s*<')
-
-
-def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error):
- """Check that make_pair's template arguments are deduced.
-
- G++ 4.6 in C++0x mode fails badly if make_pair's template arguments are
- specified explicitly, and such use isn't intended in any case.
-
- Args:
- filename: The name of the current file.
- clean_lines: A CleansedLines instance containing the file.
- linenum: The number of the line to check.
- error: The function to call with any errors found.
- """
- line = clean_lines.elided[linenum]
- match = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(line)
- if match:
- error(filename, linenum, 'build/explicit_make_pair',
- 4, # 4 = high confidence
- 'For C++11-compatibility, omit template arguments from make_pair'
- ' OR use pair directly OR if appropriate, construct a pair directly')
-
-
-def ProcessLine(filename, file_extension, clean_lines, line,
- include_state, function_state, nesting_state, error,
- extra_check_functions=[]):
- """Processes a single line in the file.
-
- Args:
- filename: Filename of the file that is being processed.
- file_extension: The extension (dot not included) of the file.
- clean_lines: An array of strings, each representing a line of the file,
- with comments stripped.
- line: Number of line being processed.
- include_state: An _IncludeState instance in which the headers are inserted.
- function_state: A _FunctionState instance which counts function lines, etc.
- nesting_state: A _NestingState instance which maintains information about
- the current stack of nested blocks being parsed.
- error: A callable to which errors are reported, which takes 4 arguments:
- filename, line number, error level, and message
- extra_check_functions: An array of additional check functions that will be
- run on each source line. Each function takes 4
- arguments: filename, clean_lines, line, error
- """
- raw_lines = clean_lines.raw_lines
- ParseNolintSuppressions(filename, raw_lines[line], line, error)
- nesting_state.Update(filename, clean_lines, line, error)
- if nesting_state.stack and nesting_state.stack[-1].inline_asm != _NO_ASM:
- return
- CheckForFunctionLengths(filename, clean_lines, line, function_state, error)
- CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error)
- CheckStyle(filename, clean_lines, line, file_extension, nesting_state, error)
- CheckLanguage(filename, clean_lines, line, file_extension, include_state,
- nesting_state, error)
- CheckForNonConstReference(filename, clean_lines, line, nesting_state, error)
- CheckForNonStandardConstructs(filename, clean_lines, line,
- nesting_state, error)
- CheckVlogArguments(filename, clean_lines, line, error)
- CheckPosixThreading(filename, clean_lines, line, error)
- CheckInvalidIncrement(filename, clean_lines, line, error)
- CheckMakePairUsesDeduction(filename, clean_lines, line, error)
- for check_fn in extra_check_functions:
- check_fn(filename, clean_lines, line, error)
-
-def ProcessFileData(filename, file_extension, lines, error,
- extra_check_functions=[]):
- """Performs lint checks and reports any errors to the given error function.
-
- Args:
- filename: Filename of the file that is being processed.
- file_extension: The extension (dot not included) of the file.
- lines: An array of strings, each representing a line of the file, with the
- last element being empty if the file is terminated with a newline.
- error: A callable to which errors are reported, which takes 4 arguments:
- filename, line number, error level, and message
- extra_check_functions: An array of additional check functions that will be
- run on each source line. Each function takes 4
- arguments: filename, clean_lines, line, error
- """
- lines = (['// marker so line numbers and indices both start at 1'] + lines +
- ['// marker so line numbers end in a known way'])
-
- include_state = _IncludeState()
- function_state = _FunctionState()
- nesting_state = _NestingState()
-
- ResetNolintSuppressions()
-
- CheckForCopyright(filename, lines, error)
-
- if file_extension == 'h':
- CheckForHeaderGuard(filename, lines, error)
-
- RemoveMultiLineComments(filename, lines, error)
- clean_lines = CleansedLines(lines)
- for line in xrange(clean_lines.NumLines()):
- ProcessLine(filename, file_extension, clean_lines, line,
- include_state, function_state, nesting_state, error,
- extra_check_functions)
- nesting_state.CheckCompletedBlocks(filename, error)
-
- CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
-
- # We check here rather than inside ProcessLine so that we see raw
- # lines rather than "cleaned" lines.
- CheckForBadCharacters(filename, lines, error)
-
- CheckForNewlineAtEOF(filename, lines, error)
-
-def ProcessFile(filename, vlevel, extra_check_functions=[]):
- """Does google-lint on a single file.
-
- Args:
- filename: The name of the file to parse.
-
- vlevel: The level of errors to report. Every error of confidence
- >= verbose_level will be reported. 0 is a good default.
-
- extra_check_functions: An array of additional check functions that will be
- run on each source line. Each function takes 4
- arguments: filename, clean_lines, line, error
- """
-
- _SetVerboseLevel(vlevel)
-
- try:
- # Support the UNIX convention of using "-" for stdin. Note that
- # we are not opening the file with universal newline support
- # (which codecs doesn't support anyway), so the resulting lines do
- # contain trailing '\r' characters if we are reading a file that
- # has CRLF endings.
- # If after the split a trailing '\r' is present, it is removed
- # below. If it is not expected to be present (i.e. os.linesep !=
- # '\r\n' as in Windows), a warning is issued below if this file
- # is processed.
-
- if filename == '-':
- lines = codecs.StreamReaderWriter(sys.stdin,
- codecs.getreader('utf8'),
- codecs.getwriter('utf8'),
- 'replace').read().split('\n')
- else:
- lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n')
-
- carriage_return_found = False
- # Remove trailing '\r'.
- for linenum in range(len(lines)):
- if lines[linenum].endswith('\r'):
- lines[linenum] = lines[linenum].rstrip('\r')
- carriage_return_found = True
-
- except IOError:
- sys.stderr.write(
- "Skipping input '%s': Can't open for reading\n" % filename)
- return
-
- # Note, if no dot is found, this will give the entire filename as the ext.
- file_extension = filename[filename.rfind('.') + 1:]
-
- # When reading from stdin, the extension is unknown, so no cpplint tests
- # should rely on the extension.
- if filename != '-' and file_extension not in _valid_extensions:
- sys.stderr.write('Ignoring %s; not a valid file name '
- '(%s)\n' % (filename, ', '.join(_valid_extensions)))
- else:
- ProcessFileData(filename, file_extension, lines, Error,
- extra_check_functions)
- if carriage_return_found and os.linesep != '\r\n':
- # Use 0 for linenum since outputting only one error for potentially
- # several lines.
- Error(filename, 0, 'whitespace/newline', 1,
- 'One or more unexpected \\r (^M) found;'
- 'better to use only a \\n')
-
- sys.stderr.write('Done processing %s\n' % filename)
-
-
-def PrintUsage(message):
- """Prints a brief usage string and exits, optionally with an error message.
-
- Args:
- message: The optional error message.
- """
- sys.stderr.write(_USAGE)
- if message:
- sys.exit('\nFATAL ERROR: ' + message)
- else:
- sys.exit(1)
-
-
-def PrintCategories():
- """Prints a list of all the error-categories used by error messages.
-
- These are the categories used to filter messages via --filter.
- """
- sys.stderr.write(''.join(' %s\n' % cat for cat in _ERROR_CATEGORIES))
- sys.exit(0)
-
-
-def ParseArguments(args):
- """Parses the command line arguments.
-
- This may set the output format and verbosity level as side-effects.
-
- Args:
- args: The command line arguments:
-
- Returns:
- The list of filenames to lint.
- """
- try:
- (opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=',
- 'counting=',
- 'filter=',
- 'root=',
- 'linelength=',
- 'extensions='])
- except getopt.GetoptError:
- PrintUsage('Invalid arguments.')
-
- verbosity = _VerboseLevel()
- output_format = _OutputFormat()
- filters = ''
- counting_style = ''
-
- for (opt, val) in opts:
- if opt == '--help':
- PrintUsage(None)
- elif opt == '--output':
- if val not in ('emacs', 'vs7', 'eclipse'):
- PrintUsage('The only allowed output formats are emacs, vs7 and eclipse.')
- output_format = val
- elif opt == '--verbose':
- verbosity = int(val)
- elif opt == '--filter':
- filters = val
- if not filters:
- PrintCategories()
- elif opt == '--counting':
- if val not in ('total', 'toplevel', 'detailed'):
- PrintUsage('Valid counting options are total, toplevel, and detailed')
- counting_style = val
- elif opt == '--root':
- global _root
- _root = val
- elif opt == '--linelength':
- global _line_length
- try:
- _line_length = int(val)
- except ValueError:
- PrintUsage('Line length must be digits.')
- elif opt == '--extensions':
- global _valid_extensions
- try:
- _valid_extensions = set(val.split(','))
- except ValueError:
- PrintUsage('Extensions must be comma seperated list.')
-
- if not filenames:
- PrintUsage('No files were specified.')
-
- _SetOutputFormat(output_format)
- _SetVerboseLevel(verbosity)
- _SetFilters(filters)
- _SetCountingStyle(counting_style)
-
- return filenames
-
-
-def main():
- filenames = ParseArguments(sys.argv[1:])
-
- # Change stderr to write with replacement characters so we don't die
- # if we try to print something containing non-ASCII characters.
- sys.stderr = codecs.StreamReaderWriter(sys.stderr,
- codecs.getreader('utf8'),
- codecs.getwriter('utf8'),
- 'replace')
-
- _cpplint_state.ResetErrorCounts()
- for filename in filenames:
- ProcessFile(filename, _cpplint_state.verbose_level)
- _cpplint_state.PrintErrorCounts()
-
- sys.exit(_cpplint_state.error_count > 0)
-
-
-if __name__ == '__main__':
- main()
diff --git a/videocodec/libvpx_internal/libvpx/tools/diff.py b/videocodec/libvpx_internal/libvpx/tools/diff.py
deleted file mode 100644
index a96c7db..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/diff.py
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/env python
-## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-"""Classes for representing diff pieces."""
-
-__author__ = "jkoleszar@google.com"
-
-import re
-
-
-class DiffLines(object):
- """A container for one half of a diff."""
-
- def __init__(self, filename, offset, length):
- self.filename = filename
- self.offset = offset
- self.length = length
- self.lines = []
- self.delta_line_nums = []
-
- def Append(self, line):
- l = len(self.lines)
- if line[0] != " ":
- self.delta_line_nums.append(self.offset + l)
- self.lines.append(line[1:])
- assert l+1 <= self.length
-
- def Complete(self):
- return len(self.lines) == self.length
-
- def __contains__(self, item):
- return item >= self.offset and item <= self.offset + self.length - 1
-
-
-class DiffHunk(object):
- """A container for one diff hunk, consisting of two DiffLines."""
-
- def __init__(self, header, file_a, file_b, start_a, len_a, start_b, len_b):
- self.header = header
- self.left = DiffLines(file_a, start_a, len_a)
- self.right = DiffLines(file_b, start_b, len_b)
- self.lines = []
-
- def Append(self, line):
- """Adds a line to the DiffHunk and its DiffLines children."""
- if line[0] == "-":
- self.left.Append(line)
- elif line[0] == "+":
- self.right.Append(line)
- elif line[0] == " ":
- self.left.Append(line)
- self.right.Append(line)
- elif line[0] == "\\":
- # Ignore newline messages from git diff.
- pass
- else:
- assert False, ("Unrecognized character at start of diff line "
- "%r" % line[0])
- self.lines.append(line)
-
- def Complete(self):
- return self.left.Complete() and self.right.Complete()
-
- def __repr__(self):
- return "DiffHunk(%s, %s, len %d)" % (
- self.left.filename, self.right.filename,
- max(self.left.length, self.right.length))
-
-
-def ParseDiffHunks(stream):
- """Walk a file-like object, yielding DiffHunks as they're parsed."""
-
- file_regex = re.compile(r"(\+\+\+|---) (\S+)")
- range_regex = re.compile(r"@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?")
- hunk = None
- while True:
- line = stream.readline()
- if not line:
- break
-
- if hunk is None:
- # Parse file names
- diff_file = file_regex.match(line)
- if diff_file:
- if line.startswith("---"):
- a_line = line
- a = diff_file.group(2)
- continue
- if line.startswith("+++"):
- b_line = line
- b = diff_file.group(2)
- continue
-
- # Parse offset/lengths
- diffrange = range_regex.match(line)
- if diffrange:
- if diffrange.group(2):
- start_a = int(diffrange.group(1))
- len_a = int(diffrange.group(3))
- else:
- start_a = 1
- len_a = int(diffrange.group(1))
-
- if diffrange.group(5):
- start_b = int(diffrange.group(4))
- len_b = int(diffrange.group(6))
- else:
- start_b = 1
- len_b = int(diffrange.group(4))
-
- header = [a_line, b_line, line]
- hunk = DiffHunk(header, a, b, start_a, len_a, start_b, len_b)
- else:
- # Add the current line to the hunk
- hunk.Append(line)
-
- # See if the whole hunk has been parsed. If so, yield it and prepare
- # for the next hunk.
- if hunk.Complete():
- yield hunk
- hunk = None
-
- # Partial hunks are a parse error
- assert hunk is None
diff --git a/videocodec/libvpx_internal/libvpx/tools/ftfy.sh b/videocodec/libvpx_internal/libvpx/tools/ftfy.sh
deleted file mode 100644
index 92059f5..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/ftfy.sh
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/sh
-self="$0"
-dirname_self=$(dirname "$self")
-
-usage() {
- cat <<EOF >&2
-Usage: $self [option]
-
-This script applies a whitespace transformation to the commit at HEAD. If no
-options are given, then the modified files are left in the working tree.
-
-Options:
- -h, --help Shows this message
- -n, --dry-run Shows a diff of the changes to be made.
- --amend Squashes the changes into the commit at HEAD
- This option will also reformat the commit message.
- --commit Creates a new commit containing only the whitespace changes
- --msg-only Reformat the commit message only, ignore the patch itself.
-
-EOF
- rm -f ${CLEAN_FILES}
- exit 1
-}
-
-
-log() {
- echo "${self##*/}: $@" >&2
-}
-
-
-vpx_style() {
- for f; do
- case "$f" in
- *.h|*.c|*.cc)
- "${dirname_self}"/vpx-astyle.sh "$f"
- ;;
- esac
- done
-}
-
-
-apply() {
- [ $INTERSECT_RESULT -ne 0 ] && patch -p1 < "$1"
-}
-
-
-commit() {
- LAST_CHANGEID=$(git show | awk '/Change-Id:/{print $2}')
- if [ -z "$LAST_CHANGEID" ]; then
- log "HEAD doesn't have a Change-Id, unable to generate a new commit"
- exit 1
- fi
-
- # Build a deterministic Change-Id from the parent's
- NEW_CHANGEID=${LAST_CHANGEID}-styled
- NEW_CHANGEID=I$(echo $NEW_CHANGEID | git hash-object --stdin)
-
- # Commit, preserving authorship from the parent commit.
- git commit -a -C HEAD > /dev/null
- git commit --amend -F- << EOF
-Cosmetic: Fix whitespace in change ${LAST_CHANGEID:0:9}
-
-Change-Id: ${NEW_CHANGEID}
-EOF
-}
-
-
-show_commit_msg_diff() {
- if [ $DIFF_MSG_RESULT -ne 0 ]; then
- log "Modified commit message:"
- diff -u "$ORIG_COMMIT_MSG" "$NEW_COMMIT_MSG" | tail -n +3
- fi
-}
-
-
-amend() {
- show_commit_msg_diff
- if [ $DIFF_MSG_RESULT -ne 0 ] || [ $INTERSECT_RESULT -ne 0 ]; then
- git commit -a --amend -F "$NEW_COMMIT_MSG"
- fi
-}
-
-
-diff_msg() {
- git log -1 --format=%B > "$ORIG_COMMIT_MSG"
- "${dirname_self}"/wrap-commit-msg.py \
- < "$ORIG_COMMIT_MSG" > "$NEW_COMMIT_MSG"
- cmp -s "$ORIG_COMMIT_MSG" "$NEW_COMMIT_MSG"
- DIFF_MSG_RESULT=$?
-}
-
-
-# Temporary files
-ORIG_DIFF=orig.diff.$$
-MODIFIED_DIFF=modified.diff.$$
-FINAL_DIFF=final.diff.$$
-ORIG_COMMIT_MSG=orig.commit-msg.$$
-NEW_COMMIT_MSG=new.commit-msg.$$
-CLEAN_FILES="${ORIG_DIFF} ${MODIFIED_DIFF} ${FINAL_DIFF}"
-CLEAN_FILES="${CLEAN_FILES} ${ORIG_COMMIT_MSG} ${NEW_COMMIT_MSG}"
-
-# Preconditions
-[ $# -lt 2 ] || usage
-
-# Check that astyle supports pad-header and align-pointer=name
-if ! astyle --pad-header --align-pointer=name < /dev/null; then
- log "Install astyle v1.24 or newer"
- exit 1
-fi
-
-if ! git diff --quiet HEAD; then
- log "Working tree is dirty, commit your changes first"
- exit 1
-fi
-
-# Need to be in the root
-cd "$(git rev-parse --show-toplevel)"
-
-# Collect the original diff
-git show > "${ORIG_DIFF}"
-
-# Apply the style guide on new and modified files and collect its diff
-for f in $(git diff HEAD^ --name-only -M90 --diff-filter=AM); do
- case "$f" in
- third_party/*) continue;;
- nestegg/*) continue;;
- esac
- vpx_style "$f"
-done
-git diff --no-color --no-ext-diff > "${MODIFIED_DIFF}"
-
-# Intersect the two diffs
-"${dirname_self}"/intersect-diffs.py \
- "${ORIG_DIFF}" "${MODIFIED_DIFF}" > "${FINAL_DIFF}"
-INTERSECT_RESULT=$?
-git reset --hard >/dev/null
-
-# Fixup the commit message
-diff_msg
-
-# Handle options
-if [ -n "$1" ]; then
- case "$1" in
- -h|--help) usage;;
- -n|--dry-run) cat "${FINAL_DIFF}"; show_commit_msg_diff;;
- --commit) apply "${FINAL_DIFF}"; commit;;
- --amend) apply "${FINAL_DIFF}"; amend;;
- --msg-only) amend;;
- *) usage;;
- esac
-else
- apply "${FINAL_DIFF}"
- if ! git diff --quiet; then
- log "Formatting changes applied, verify and commit."
- log "See also: http://www.webmproject.org/code/contribute/conventions/"
- git diff --stat
- fi
-fi
-
-rm -f ${CLEAN_FILES}
diff --git a/videocodec/libvpx_internal/libvpx/tools/gen_authors.sh b/videocodec/libvpx_internal/libvpx/tools/gen_authors.sh
deleted file mode 100644
index e1246f0..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/gen_authors.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-# Add organization names manually.
-
-cat <<EOF
-# This file is automatically generated from the git commit history
-# by tools/gen_authors.sh.
-
-$(git log --pretty=format:"%aN <%aE>" | sort | uniq)
-Google Inc.
-The Mozilla Foundation
-The Xiph.Org Foundation
-EOF
diff --git a/videocodec/libvpx_internal/libvpx/tools/intersect-diffs.py b/videocodec/libvpx_internal/libvpx/tools/intersect-diffs.py
deleted file mode 100644
index 4dbafa9..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/intersect-diffs.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-"""Calculates the "intersection" of two unified diffs.
-
-Given two diffs, A and B, it finds all hunks in B that had non-context lines
-in A and prints them to stdout. This is useful to determine the hunks in B that
-are relevant to A. The resulting file can be applied with patch(1) on top of A.
-"""
-
-__author__ = "jkoleszar@google.com"
-
-import sys
-
-import diff
-
-
-def FormatDiffHunks(hunks):
- """Re-serialize a list of DiffHunks."""
- r = []
- last_header = None
- for hunk in hunks:
- this_header = hunk.header[0:2]
- if last_header != this_header:
- r.extend(hunk.header)
- last_header = this_header
- else:
- r.extend(hunk.header[2])
- r.extend(hunk.lines)
- r.append("\n")
- return "".join(r)
-
-
-def ZipHunks(rhs_hunks, lhs_hunks):
- """Join two hunk lists on filename."""
- for rhs_hunk in rhs_hunks:
- rhs_file = rhs_hunk.right.filename.split("/")[1:]
-
- for lhs_hunk in lhs_hunks:
- lhs_file = lhs_hunk.left.filename.split("/")[1:]
- if lhs_file != rhs_file:
- continue
- yield (rhs_hunk, lhs_hunk)
-
-
-def main():
- old_hunks = [x for x in diff.ParseDiffHunks(open(sys.argv[1], "r"))]
- new_hunks = [x for x in diff.ParseDiffHunks(open(sys.argv[2], "r"))]
- out_hunks = []
-
- # Join the right hand side of the older diff with the left hand side of the
- # newer diff.
- for old_hunk, new_hunk in ZipHunks(old_hunks, new_hunks):
- if new_hunk in out_hunks:
- continue
- old_lines = old_hunk.right
- new_lines = new_hunk.left
-
- # Determine if this hunk overlaps any non-context line from the other
- for i in old_lines.delta_line_nums:
- if i in new_lines:
- out_hunks.append(new_hunk)
- break
-
- if out_hunks:
- print FormatDiffHunks(out_hunks)
- sys.exit(1)
-
-if __name__ == "__main__":
- main()
diff --git a/videocodec/libvpx_internal/libvpx/tools/lint-hunks.py b/videocodec/libvpx_internal/libvpx/tools/lint-hunks.py
deleted file mode 100644
index 6e25d93..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/lint-hunks.py
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/bin/python
-## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-"""Performs style checking on each diff hunk."""
-import getopt
-import os
-import StringIO
-import subprocess
-import sys
-
-import diff
-
-
-SHORT_OPTIONS = "h"
-LONG_OPTIONS = ["help"]
-
-TOPLEVEL_CMD = ["git", "rev-parse", "--show-toplevel"]
-DIFF_CMD = ["git", "diff"]
-DIFF_INDEX_CMD = ["git", "diff-index", "-u", "HEAD", "--"]
-SHOW_CMD = ["git", "show"]
-CPPLINT_FILTERS = ["-readability/casting"]
-
-
-class Usage(Exception):
- pass
-
-
-class SubprocessException(Exception):
- def __init__(self, args):
- msg = "Failed to execute '%s'"%(" ".join(args))
- super(SubprocessException, self).__init__(msg)
-
-
-class Subprocess(subprocess.Popen):
- """Adds the notion of an expected returncode to Popen."""
-
- def __init__(self, args, expected_returncode=0, **kwargs):
- self._args = args
- self._expected_returncode = expected_returncode
- super(Subprocess, self).__init__(args, **kwargs)
-
- def communicate(self, *args, **kwargs):
- result = super(Subprocess, self).communicate(*args, **kwargs)
- if self._expected_returncode is not None:
- try:
- ok = self.returncode in self._expected_returncode
- except TypeError:
- ok = self.returncode == self._expected_returncode
- if not ok:
- raise SubprocessException(self._args)
- return result
-
-
-def main(argv=None):
- if argv is None:
- argv = sys.argv
- try:
- try:
- opts, args = getopt.getopt(argv[1:], SHORT_OPTIONS, LONG_OPTIONS)
- except getopt.error, msg:
- raise Usage(msg)
-
- # process options
- for o, _ in opts:
- if o in ("-h", "--help"):
- print __doc__
- sys.exit(0)
-
- if args and len(args) > 1:
- print __doc__
- sys.exit(0)
-
- # Find the fully qualified path to the root of the tree
- tl = Subprocess(TOPLEVEL_CMD, stdout=subprocess.PIPE)
- tl = tl.communicate()[0].strip()
-
- # See if we're working on the index or not.
- if args:
- diff_cmd = DIFF_CMD + [args[0] + "^!"]
- else:
- diff_cmd = DIFF_INDEX_CMD
-
- # Build the command line to execute cpplint
- cpplint_cmd = [os.path.join(tl, "tools", "cpplint.py"),
- "--filter=" + ",".join(CPPLINT_FILTERS),
- "-"]
-
- # Get a list of all affected lines
- file_affected_line_map = {}
- p = Subprocess(diff_cmd, stdout=subprocess.PIPE)
- stdout = p.communicate()[0]
- for hunk in diff.ParseDiffHunks(StringIO.StringIO(stdout)):
- filename = hunk.right.filename[2:]
- if filename not in file_affected_line_map:
- file_affected_line_map[filename] = set()
- file_affected_line_map[filename].update(hunk.right.delta_line_nums)
-
- # Run each affected file through cpplint
- lint_failed = False
- for filename, affected_lines in file_affected_line_map.iteritems():
- if filename.split(".")[-1] not in ("c", "h", "cc"):
- continue
-
- if args:
- # File contents come from git
- show_cmd = SHOW_CMD + [args[0] + ":" + filename]
- show = Subprocess(show_cmd, stdout=subprocess.PIPE)
- lint = Subprocess(cpplint_cmd, expected_returncode=(0, 1),
- stdin=show.stdout, stderr=subprocess.PIPE)
- lint_out = lint.communicate()[1]
- else:
- # File contents come from the working tree
- lint = Subprocess(cpplint_cmd, expected_returncode=(0, 1),
- stdin=subprocess.PIPE, stderr=subprocess.PIPE)
- stdin = open(os.path.join(tl, filename)).read()
- lint_out = lint.communicate(stdin)[1]
-
- for line in lint_out.split("\n"):
- fields = line.split(":")
- if fields[0] != "-":
- continue
- warning_line_num = int(fields[1])
- if warning_line_num in affected_lines:
- print "%s:%d:%s"%(filename, warning_line_num,
- ":".join(fields[2:]))
- lint_failed = True
-
- # Set exit code if any relevant lint errors seen
- if lint_failed:
- return 1
-
- except Usage, err:
- print >>sys.stderr, err
- print >>sys.stderr, "for help use --help"
- return 2
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/videocodec/libvpx_internal/libvpx/tools/vpx-astyle.sh b/videocodec/libvpx_internal/libvpx/tools/vpx-astyle.sh
deleted file mode 100644
index 6340426..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/vpx-astyle.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-set -e
-astyle --style=java --indent=spaces=2 --indent-switches\
- --min-conditional-indent=0 \
- --pad-oper --pad-header --unpad-paren \
- --align-pointer=name \
- --indent-preprocessor --convert-tabs --indent-labels \
- --suffix=none --quiet --max-instatement-indent=80 "$@"
-# Disabled, too greedy?
-#sed -i 's;[[:space:]]\{1,\}\[;[;g' "$@"
-
-sed_i() {
- # Incompatible sed parameter parsing.
- if sed -i 2>&1 | grep -q 'requires an argument'; then
- sed -i '' "$@"
- else
- sed -i "$@"
- fi
-}
-
-sed_i -e 's/[[:space:]]\{1,\}\([,;]\)/\1/g' \
- -e 's/[[:space:]]\{1,\}\([+-]\{2\};\)/\1/g' \
- -e 's/,[[:space:]]*}/}/g' \
- -e 's;//\([^/[:space:]].*$\);// \1;g' \
- -e 's/^\(public\|private\|protected\):$/ \1:/g' \
- -e 's/[[:space:]]\{1,\}$//g' \
- "$@"
diff --git a/videocodec/libvpx_internal/libvpx/tools/wrap-commit-msg.py b/videocodec/libvpx_internal/libvpx/tools/wrap-commit-msg.py
deleted file mode 100644
index d5b4b04..0000000
--- a/videocodec/libvpx_internal/libvpx/tools/wrap-commit-msg.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-"""Wraps paragraphs of text, preserving manual formatting
-
-This is like fold(1), but has the special convention of not modifying lines
-that start with whitespace. This allows you to intersperse blocks with
-special formatting, like code blocks, with written prose. The prose will
-be wordwrapped, and the manual formatting will be preserved.
-
- * This won't handle the case of a bulleted (or ordered) list specially, so
- manual wrapping must be done.
-
-Occasionally it's useful to put something with explicit formatting that
-doesn't look at all like a block of text inline.
-
- indicator = has_leading_whitespace(line);
- if (indicator)
- preserve_formatting(line);
-
-The intent is that this docstring would make it through the transform
-and still be legible and presented as it is in the source. If additional
-cases are handled, update this doc to describe the effect.
-"""
-
-__author__ = "jkoleszar@google.com"
-import textwrap
-import sys
-
-def wrap(text):
- if text:
- return textwrap.fill(text, break_long_words=False) + '\n'
- return ""
-
-
-def main(fileobj):
- text = ""
- output = ""
- while True:
- line = fileobj.readline()
- if not line:
- break
-
- if line.lstrip() == line:
- text += line
- else:
- output += wrap(text)
- text=""
- output += line
- output += wrap(text)
-
- # Replace the file or write to stdout.
- if fileobj == sys.stdin:
- fileobj = sys.stdout
- else:
- fileobj.seek(0)
- fileobj.truncate(0)
- fileobj.write(output)
-
-if __name__ == "__main__":
- if len(sys.argv) > 1:
- main(open(sys.argv[1], "r+"))
- else:
- main(sys.stdin)
diff --git a/videocodec/libvpx_internal/libvpx/tools_common.c b/videocodec/libvpx_internal/libvpx/tools_common.c
deleted file mode 100644
index 4f2ac74..0000000
--- a/videocodec/libvpx_internal/libvpx/tools_common.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "./tools_common.h"
-
-#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
-#include "vpx/vp8cx.h"
-#endif
-
-#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
-#include "vpx/vp8dx.h"
-#endif
-
-#if defined(_WIN32) || defined(__OS2__)
-#include <io.h>
-#include <fcntl.h>
-
-#ifdef __OS2__
-#define _setmode setmode
-#define _fileno fileno
-#define _O_BINARY O_BINARY
-#endif
-#endif
-
-#define LOG_ERROR(label) do {\
- const char *l = label;\
- va_list ap;\
- va_start(ap, fmt);\
- if (l)\
- fprintf(stderr, "%s: ", l);\
- vfprintf(stderr, fmt, ap);\
- fprintf(stderr, "\n");\
- va_end(ap);\
-} while (0)
-
-
-FILE *set_binary_mode(FILE *stream) {
- (void)stream;
-#if defined(_WIN32) || defined(__OS2__)
- _setmode(_fileno(stream), _O_BINARY);
-#endif
- return stream;
-}
-
-void die(const char *fmt, ...) {
- LOG_ERROR(NULL);
- usage_exit();
-}
-
-void fatal(const char *fmt, ...) {
- LOG_ERROR("Fatal");
- exit(EXIT_FAILURE);
-}
-
-void warn(const char *fmt, ...) {
- LOG_ERROR("Warning");
-}
-
-void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
- const char *detail = vpx_codec_error_detail(ctx);
-
- printf("%s: %s\n", s, vpx_codec_error(ctx));
- if (detail)
- printf(" %s\n", detail);
- exit(EXIT_FAILURE);
-}
-
-int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame) {
- FILE *f = input_ctx->file;
- struct FileTypeDetectionBuffer *detect = &input_ctx->detect;
- int plane = 0;
- int shortread = 0;
-
- for (plane = 0; plane < 3; ++plane) {
- uint8_t *ptr;
- const int w = (plane ? (1 + yuv_frame->d_w) / 2 : yuv_frame->d_w);
- const int h = (plane ? (1 + yuv_frame->d_h) / 2 : yuv_frame->d_h);
- int r;
-
- /* Determine the correct plane based on the image format. The for-loop
- * always counts in Y,U,V order, but this may not match the order of
- * the data on disk.
- */
- switch (plane) {
- case 1:
- ptr = yuv_frame->planes[
- yuv_frame->fmt == VPX_IMG_FMT_YV12 ? VPX_PLANE_V : VPX_PLANE_U];
- break;
- case 2:
- ptr = yuv_frame->planes[
- yuv_frame->fmt == VPX_IMG_FMT_YV12 ? VPX_PLANE_U : VPX_PLANE_V];
- break;
- default:
- ptr = yuv_frame->planes[plane];
- }
-
- for (r = 0; r < h; ++r) {
- size_t needed = w;
- size_t buf_position = 0;
- const size_t left = detect->buf_read - detect->position;
- if (left > 0) {
- const size_t more = (left < needed) ? left : needed;
- memcpy(ptr, detect->buf + detect->position, more);
- buf_position = more;
- needed -= more;
- detect->position += more;
- }
- if (needed > 0) {
- shortread |= (fread(ptr + buf_position, 1, needed, f) < needed);
- }
-
- ptr += yuv_frame->stride[plane];
- }
- }
-
- return shortread;
-}
-
-static const VpxInterface vpx_encoders[] = {
-#if CONFIG_VP8_ENCODER
- {"vp8", VP8_FOURCC, &vpx_codec_vp8_cx},
-#endif
-
-#if CONFIG_VP9_ENCODER
- {"vp9", VP9_FOURCC, &vpx_codec_vp9_cx},
-#endif
-};
-
-int get_vpx_encoder_count() {
- return sizeof(vpx_encoders) / sizeof(vpx_encoders[0]);
-}
-
-const VpxInterface *get_vpx_encoder_by_index(int i) {
- return &vpx_encoders[i];
-}
-
-const VpxInterface *get_vpx_encoder_by_name(const char *name) {
- int i;
-
- for (i = 0; i < get_vpx_encoder_count(); ++i) {
- const VpxInterface *encoder = get_vpx_encoder_by_index(i);
- if (strcmp(encoder->name, name) == 0)
- return encoder;
- }
-
- return NULL;
-}
-
-static const VpxInterface vpx_decoders[] = {
-#if CONFIG_VP8_DECODER
- {"vp8", VP8_FOURCC, &vpx_codec_vp8_dx},
-#endif
-
-#if CONFIG_VP9_DECODER
- {"vp9", VP9_FOURCC, &vpx_codec_vp9_dx},
-#endif
-};
-
-int get_vpx_decoder_count() {
- return sizeof(vpx_decoders) / sizeof(vpx_decoders[0]);
-}
-
-const VpxInterface *get_vpx_decoder_by_index(int i) {
- return &vpx_decoders[i];
-}
-
-const VpxInterface *get_vpx_decoder_by_name(const char *name) {
- int i;
-
- for (i = 0; i < get_vpx_decoder_count(); ++i) {
- const VpxInterface *const decoder = get_vpx_decoder_by_index(i);
- if (strcmp(decoder->name, name) == 0)
- return decoder;
- }
-
- return NULL;
-}
-
-const VpxInterface *get_vpx_decoder_by_fourcc(uint32_t fourcc) {
- int i;
-
- for (i = 0; i < get_vpx_decoder_count(); ++i) {
- const VpxInterface *const decoder = get_vpx_decoder_by_index(i);
- if (decoder->fourcc == fourcc)
- return decoder;
- }
-
- return NULL;
-}
-
-// TODO(dkovalev): move this function to vpx_image.{c, h}, so it will be part
-// of vpx_image_t support
-int vpx_img_plane_width(const vpx_image_t *img, int plane) {
- if (plane > 0 && img->x_chroma_shift > 0)
- return (img->d_w + 1) >> img->x_chroma_shift;
- else
- return img->d_w;
-}
-
-int vpx_img_plane_height(const vpx_image_t *img, int plane) {
- if (plane > 0 && img->y_chroma_shift > 0)
- return (img->d_h + 1) >> img->y_chroma_shift;
- else
- return img->d_h;
-}
-
-void vpx_img_write(const vpx_image_t *img, FILE *file) {
- int plane;
-
- for (plane = 0; plane < 3; ++plane) {
- const unsigned char *buf = img->planes[plane];
- const int stride = img->stride[plane];
- const int w = vpx_img_plane_width(img, plane);
- const int h = vpx_img_plane_height(img, plane);
- int y;
-
- for (y = 0; y < h; ++y) {
- fwrite(buf, 1, w, file);
- buf += stride;
- }
- }
-}
-
-int vpx_img_read(vpx_image_t *img, FILE *file) {
- int plane;
-
- for (plane = 0; plane < 3; ++plane) {
- unsigned char *buf = img->planes[plane];
- const int stride = img->stride[plane];
- const int w = vpx_img_plane_width(img, plane);
- const int h = vpx_img_plane_height(img, plane);
- int y;
-
- for (y = 0; y < h; ++y) {
- if (fread(buf, 1, w, file) != w)
- return 0;
- buf += stride;
- }
- }
-
- return 1;
-}
-
-// TODO(dkovalev) change sse_to_psnr signature: double -> int64_t
-double sse_to_psnr(double samples, double peak, double sse) {
- static const double kMaxPSNR = 100.0;
-
- if (sse > 0.0) {
- const double psnr = 10.0 * log10(samples * peak * peak / sse);
- return psnr > kMaxPSNR ? kMaxPSNR : psnr;
- } else {
- return kMaxPSNR;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/tools_common.h b/videocodec/libvpx_internal/libvpx/tools_common.h
deleted file mode 100644
index 549e895..0000000
--- a/videocodec/libvpx_internal/libvpx/tools_common.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef TOOLS_COMMON_H_
-#define TOOLS_COMMON_H_
-
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "vpx/vpx_codec.h"
-#include "vpx/vpx_image.h"
-#include "vpx/vpx_integer.h"
-
-#if CONFIG_ENCODERS
-#include "./y4minput.h"
-#endif
-
-#if defined(_MSC_VER)
-/* MSVS uses _f{seek,tell}i64. */
-#define fseeko _fseeki64
-#define ftello _ftelli64
-typedef long _off_t; // NOLINT - MSVS compatible type
-typedef __int64 off_t; // fseeki64 compatible type
-#define _OFF_T_DEFINED
-#elif defined(_WIN32)
-/* MinGW defines off_t as long and uses f{seek,tell}o64/off64_t for large
- * files. */
-#define fseeko fseeko64
-#define ftello ftello64
-#define off_t off64_t
-#endif /* _WIN32 */
-
-#if CONFIG_OS_SUPPORT
-#if defined(_MSC_VER)
-#include <io.h> /* NOLINT */
-#define snprintf _snprintf
-#define isatty _isatty
-#define fileno _fileno
-#else
-#include <unistd.h> /* NOLINT */
-#endif /* _MSC_VER */
-#endif /* CONFIG_OS_SUPPORT */
-
-/* Use 32-bit file operations in WebM file format when building ARM
- * executables (.axf) with RVCT. */
-#if !CONFIG_OS_SUPPORT
-typedef long off_t; /* NOLINT */
-#define fseeko fseek
-#define ftello ftell
-#endif /* CONFIG_OS_SUPPORT */
-
-#define LITERALU64(hi, lo) ((((uint64_t)hi) << 32) | lo)
-
-#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif
-
-#define IVF_FRAME_HDR_SZ (4 + 8) /* 4 byte size + 8 byte timestamp */
-#define IVF_FILE_HDR_SZ 32
-
-#define RAW_FRAME_HDR_SZ sizeof(uint32_t)
-
-#define VP8_FOURCC 0x30385056
-#define VP9_FOURCC 0x30395056
-
-enum VideoFileType {
- FILE_TYPE_RAW,
- FILE_TYPE_IVF,
- FILE_TYPE_Y4M,
- FILE_TYPE_WEBM
-};
-
-struct FileTypeDetectionBuffer {
- char buf[4];
- size_t buf_read;
- size_t position;
-};
-
-struct VpxRational {
- int numerator;
- int denominator;
-};
-
-struct VpxInputContext {
- const char *filename;
- FILE *file;
- off_t length;
- struct FileTypeDetectionBuffer detect;
- enum VideoFileType file_type;
- uint32_t width;
- uint32_t height;
- int use_i420;
- int only_i420;
- uint32_t fourcc;
- struct VpxRational framerate;
-#if CONFIG_ENCODERS
- y4m_input y4m;
-#endif
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Sets a stdio stream into binary mode */
-FILE *set_binary_mode(FILE *stream);
-
-void die(const char *fmt, ...);
-void fatal(const char *fmt, ...);
-void warn(const char *fmt, ...);
-
-void die_codec(vpx_codec_ctx_t *ctx, const char *s);
-
-/* The tool including this file must define usage_exit() */
-void usage_exit();
-
-int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame);
-
-typedef struct VpxInterface {
- const char *const name;
- const uint32_t fourcc;
- vpx_codec_iface_t *(*const interface)();
-} VpxInterface;
-
-int get_vpx_encoder_count();
-const VpxInterface *get_vpx_encoder_by_index(int i);
-const VpxInterface *get_vpx_encoder_by_name(const char *name);
-
-int get_vpx_decoder_count();
-const VpxInterface *get_vpx_decoder_by_index(int i);
-const VpxInterface *get_vpx_decoder_by_name(const char *name);
-const VpxInterface *get_vpx_decoder_by_fourcc(uint32_t fourcc);
-
-// TODO(dkovalev): move this function to vpx_image.{c, h}, so it will be part
-// of vpx_image_t support
-int vpx_img_plane_width(const vpx_image_t *img, int plane);
-int vpx_img_plane_height(const vpx_image_t *img, int plane);
-void vpx_img_write(const vpx_image_t *img, FILE *file);
-int vpx_img_read(vpx_image_t *img, FILE *file);
-
-double sse_to_psnr(double samples, double peak, double mse);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif // TOOLS_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/usage.dox b/videocodec/libvpx_internal/libvpx/usage.dox
deleted file mode 100644
index 92fd6b2..0000000
--- a/videocodec/libvpx_internal/libvpx/usage.dox
+++ /dev/null
@@ -1,208 +0,0 @@
-/*!\page usage Usage
-
- The vpx multi-format codec SDK provides a unified interface amongst its
- supported codecs. This abstraction allows applications using this SDK to
- easily support multiple video formats with minimal code duplication or
- "special casing." This section describes the interface common to all codecs.
- For codec-specific details, see the \ref codecs page.
-
- The following sections are common to all codecs:
- - \ref usage_types
- - \ref usage_features
- - \ref usage_init
- - \ref usage_errors
-
- Fore more information on decoder and encoder specific usage, see the
- following pages:
- \if decoder
- - \subpage usage_decode
- \endif
- \if decoder
- - \subpage usage_encode
- \endif
-
- \section usage_types Important Data Types
- There are two important data structures to consider in this interface.
-
- \subsection usage_ctxs Contexts
- A context is a storage area allocated by the calling application that the
- codec may write into to store details about a single instance of that codec.
- Most of the context is implementation specific, and thus opaque to the
- application. The context structure as seen by the application is of fixed
- size, and thus can be allocated with automatic storage or dynamically
- on the heap.
-
- Most operations require an initialized codec context. Codec context
- instances are codec specific. That is, the codec to be used for the encoded
- video must be known at initialization time. See #vpx_codec_ctx_t for further
- information.
-
- \subsection usage_ifaces Interfaces
- A codec interface is an opaque structure that controls how function calls
- into the generic interface are dispatched to their codec-specific
- implementations. Applications \ref MUSTNOT attempt to examine or override
- this storage, as it contains internal implementation details likely to
- change from release to release.
-
- Each supported codec will expose an interface structure to the application
- as an <code>extern</code> reference to a structure of the incomplete type
- #vpx_codec_iface_t.
-
- \section usage_features Features
- Several "features" are defined that are optionally implemented by codec
- algorithms. Indeed, the same algorithm may support different features on
- different platforms. The purpose of defining these features is that when
- they are implemented, they conform to a common interface. The features, or
- capabilities, of an algorithm can be queried from it's interface by using
- the vpx_codec_get_caps() method. Attempts to invoke features not supported
- by an algorithm will generally result in #VPX_CODEC_INCAPABLE.
-
- Currently defined features available in both encoders and decoders include:
- - \subpage usage_xma
-
- \if decoder
- Currently defined decoder features include:
- - \ref usage_cb
- - \ref usage_postproc
- \endif
-
- \section usage_init Initialization
- To initialize a codec instance, the address of the codec context
- and interface structures are passed to an initialization function. Depending
- on the \ref usage_features that the codec supports, the codec could be
- initialized in different modes. Most notably, the application may choose to
- use \ref usage_xma mode to gain fine grained control over how and where
- memory is allocated for the codec.
-
- To prevent cases of confusion where the ABI of the library changes,
- the ABI is versioned. The ABI version number must be passed at
- initialization time to ensure the application is using a header file that
- matches the library. The current ABI version number is stored in the
- preprocessor macros #VPX_CODEC_ABI_VERSION, #VPX_ENCODER_ABI_VERSION, and
- #VPX_DECODER_ABI_VERSION. For convenience, each initialization function has
- a wrapper macro that inserts the correct version number. These macros are
- named like the initialization methods, but without the _ver suffix.
-
-
- The available initialization methods are:
- \if encoder - #vpx_codec_enc_init (calls vpx_codec_enc_init_ver()) \endif
- \if multi-encoder - #vpx_codec_enc_init_multi (calls vpx_codec_enc_init_multi_ver()) \endif
- \if decoder - #vpx_codec_dec_init (calls vpx_codec_dec_init_ver()) \endif
-
-
-
- \section usage_errors Error Handling
- Almost all codec functions return an error status of type #vpx_codec_err_t.
- The semantics of how each error condition should be processed is clearly
- defined in the definitions of each enumerated value. Error values can be
- converted into ASCII strings with the vpx_codec_error() and
- vpx_codec_err_to_string() methods. The difference between these two methods is
- that vpx_codec_error() returns the error state from an initialized context,
- whereas vpx_codec_err_to_string() can be used in cases where an error occurs
- outside any context. The enumerated value returned from the last call can be
- retrieved from the <code>err</code> member of the decoder context as well.
- Finally, more detailed error information may be able to be obtained by using
- the vpx_codec_error_detail() method. Not all errors produce detailed error
- information.
-
- In addition to error information, the codec library's build configuration
- is available at runtime on some platforms. This information can be returned
- by calling vpx_codec_build_config(), and is formatted as a base64 coded string
- (comprised of characters in the set [a-z_a-Z0-9+/]). This information is not
- useful to an application at runtime, but may be of use to vpx for support.
-
-
- \section usage_deadline Deadline
- Both the encoding and decoding functions have a <code>deadline</code>
- parameter. This parameter indicates the amount of time, in microseconds
- (us), that the application wants the codec to spend processing before
- returning. This is a soft deadline -- that is, the semantics of the
- requested operation take precedence over meeting the deadline. If, for
- example, an application sets a <code>deadline</code> of 1000us, and the
- frame takes 2000us to decode, the call to vpx_codec_decode() will return
- after 2000us. In this case the deadline is not met, but the semantics of the
- function are preserved. If, for the same frame, an application instead sets
- a <code>deadline</code> of 5000us, the decoder will see that it has 3000us
- remaining in its time slice when decoding completes. It could then choose to
- run a set of \ref usage_postproc filters, and perhaps would return after
- 4000us (instead of the allocated 5000us). In this case the deadline is met,
- and the semantics of the call are preserved, as before.
-
- The special value <code>0</code> is reserved to represent an infinite
- deadline. In this case, the codec will perform as much processing as
- possible to yield the highest quality frame.
-
- By convention, the value <code>1</code> is used to mean "return as fast as
- possible."
-
-*/
-
-
-/*! \page usage_xma External Memory Allocation
- Applications that wish to have fine grained control over how and where
- decoders allocate memory \ref MAY make use of the eXternal Memory Allocation
- (XMA) interface. Not all codecs support the XMA \ref usage_features.
-
- To use a decoder in XMA mode, the decoder \ref MUST be initialized with the
- vpx_codec_xma_init_ver() function. The amount of memory a decoder needs to
- allocate is heavily dependent on the size of the encoded video frames. The
- size of the video must be known before requesting the decoder's memory map.
- This stream information can be obtained with the vpx_codec_peek_stream_info()
- function, which does not require a constructed decoder context. If the exact
- stream is not known, a stream info structure can be created that reflects
- the maximum size that the decoder instance is required to support.
-
- Once the decoder instance has been initialized and the stream information
- determined, the application calls the vpx_codec_get_mem_map() iterator
- repeatedly to get a list of the memory segments requested by the decoder.
- The iterator value should be initialized to NULL to request the first
- element, and the function will return #VPX_CODEC_LIST_END to signal the end of
- the list.
-
- After each segment is identified, it must be passed to the codec through the
- vpx_codec_set_mem_map() function. Segments \ref MUST be passed in the same
- order as they are returned from vpx_codec_get_mem_map(), but there is no
- requirement that vpx_codec_get_mem_map() must finish iterating before
- vpx_codec_set_mem_map() is called. For instance, some applications may choose
- to get a list of all requests, construct an optimal heap, and then set all
- maps at once with one call. Other applications may set one map at a time,
- allocating it immediately after it is returned from vpx_codec_get_mem_map().
-
- After all segments have been set using vpx_codec_set_mem_map(), the codec may
- be used as it would be in normal internal allocation mode.
-
- \section usage_xma_seg_id Segment Identifiers
- Each requested segment is identified by an identifier unique to
- that decoder type. Some of these identifiers are private, while others are
- enumerated for application use. Identifiers not enumerated publicly are
- subject to change. Identifiers are non-consecutive.
-
- \section usage_xma_seg_szalign Segment Size and Alignment
- The sz (size) and align (alignment) parameters describe the required size
- and alignment of the requested segment. Alignment will always be a power of
- two. Applications \ref MUST honor the alignment requested. Failure to do so
- could result in program crashes or may incur a speed penalty.
-
- \section usage_xma_seg_flags Segment Flags
- The flags member of the segment structure indicates any requirements or
- desires of the codec for the particular segment. The #VPX_CODEC_MEM_ZERO flag
- indicates that the segment \ref MUST be zeroed by the application prior to
- passing it to the application. The #VPX_CODEC_MEM_WRONLY flag indicates that
- the segment will only be written into by the decoder, not read. If this flag
- is not set, the application \ref MUST insure that the memory segment is
- readable. On some platforms, framebuffer memory is writable but not
- readable, for example. The #VPX_CODEC_MEM_FAST flag indicates that the segment
- will be frequently accessed, and that it should be placed into fast memory,
- if any is available. The application \ref MAY choose to place other segments
- in fast memory as well, but the most critical segments will be identified by
- this flag.
-
- \section usage_xma_seg_basedtor Segment Base Address and Destructor
- For each requested memory segment, the application must determine the
- address of a memory segment that meets the requirements of the codec. This
- address is set in the <code>base</code> member of the #vpx_codec_mmap
- structure. If the application requires processing when the segment is no
- longer used by the codec (for instance to deallocate it or close an
- associated file descriptor) the <code>dtor</code> and <code>priv</code>
- members can be set.
-*/
diff --git a/videocodec/libvpx_internal/libvpx/usage_cx.dox b/videocodec/libvpx_internal/libvpx/usage_cx.dox
deleted file mode 100644
index 62f3e45..0000000
--- a/videocodec/libvpx_internal/libvpx/usage_cx.dox
+++ /dev/null
@@ -1,13 +0,0 @@
-/*! \page usage_encode Encode
-
- The vpx_codec_encode() function is at the core of the encode loop. It
- processes raw images passed by the application, producing packets of
- compressed data. The <code>deadline</code> parameter controls the amount
- of time in microseconds the encoder should spend working on the frame. For
- more information on the <code>deadline</code> parameter, see
- \ref usage_deadline.
-
-
- \ref samples
-
-*/
diff --git a/videocodec/libvpx_internal/libvpx/usage_dx.dox b/videocodec/libvpx_internal/libvpx/usage_dx.dox
deleted file mode 100644
index 883ce24..0000000
--- a/videocodec/libvpx_internal/libvpx/usage_dx.dox
+++ /dev/null
@@ -1,62 +0,0 @@
-/*! \page usage_decode Decoding
-
- The vpx_codec_decode() function is at the core of the decode loop. It
- processes packets of compressed data passed by the application, producing
- decoded images. The decoder expects packets to comprise exactly one image
- frame of data. Packets \ref MUST be passed in decode order. If the
- application wishes to associate some data with the frame, the
- <code>user_priv</code> member may be set. The <code>deadline</code>
- parameter controls the amount of time in microseconds the decoder should
- spend working on the frame. This is typically used to support adaptive
- \ref usage_postproc based on the amount of free CPU time. For more
- information on the <code>deadline</code> parameter, see \ref usage_deadline.
-
- \ref samples
-
-
- \section usage_cb Callback Based Decoding
- There are two methods for the application to access decoded frame data. Some
- codecs support asynchronous (callback-based) decoding \ref usage_features
- that allow the application to register a callback to be invoked by the
- decoder when decoded data becomes available. Decoders are not required to
- support this feature, however. Like all \ref usage_features, support can be
- determined by calling vpx_codec_get_caps(). Callbacks are available in both
- frame-based and slice-based variants. Frame based callbacks conform to the
- signature of #vpx_codec_put_frame_cb_fn_t and are invoked once the entire
- frame has been decoded. Slice based callbacks conform to the signature of
- #vpx_codec_put_slice_cb_fn_t and are invoked after a subsection of the frame
- is decoded. For example, a slice callback could be issued for each
- macroblock row. However, the number and size of slices to return is
- implementation specific. Also, the image data passed in a slice callback is
- not necessarily in the same memory segment as the data will be when it is
- assembled into a full frame. For this reason, the application \ref MUST
- examine the rectangles that describe what data is valid to access and what
- data has been updated in this call. For all their additional complexity,
- slice based decoding callbacks provide substantial speed gains to the
- overall application in some cases, due to improved cache behavior.
-
-
- \section usage_frame_iter Frame Iterator Based Decoding
- If the codec does not support callback based decoding, or the application
- chooses not to make use of that feature, decoded frames are made available
- through the vpx_codec_get_frame() iterator. The application initializes the
- iterator storage (of type #vpx_codec_iter_t) to NULL, then calls
- vpx_codec_get_frame repeatedly until it returns NULL, indicating that all
- images have been returned. This process may result in zero, one, or many
- frames that are ready for display, depending on the codec.
-
-
- \section usage_postproc Postprocessing
- Postprocessing is a process that is applied after a frame is decoded to
- enhance the image's appearance by removing artifacts introduced in the
- compression process. It is not required to properly decode the frame, and
- is generally done only when there is enough spare CPU time to execute
- the required filters. Codecs may support a number of different
- postprocessing filters, and the available filters may differ from platform
- to platform. Embedded devices often do not have enough CPU to implement
- postprocessing in software. The filter selection is generally handled
- automatically by the codec, depending on the amount of time remaining before
- hitting the user-specified \ref usage_deadline after decoding the frame.
-
-
-*/
diff --git a/videocodec/libvpx_internal/libvpx/video_common.h b/videocodec/libvpx_internal/libvpx/video_common.h
deleted file mode 100644
index 44b27a8..0000000
--- a/videocodec/libvpx_internal/libvpx/video_common.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VIDEO_COMMON_H_
-#define VIDEO_COMMON_H_
-
-#include "./tools_common.h"
-
-typedef struct {
- uint32_t codec_fourcc;
- int frame_width;
- int frame_height;
- struct VpxRational time_base;
-} VpxVideoInfo;
-
-#endif // VIDEO_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/video_reader.c b/videocodec/libvpx_internal/libvpx/video_reader.c
deleted file mode 100644
index 39c7edb..0000000
--- a/videocodec/libvpx_internal/libvpx/video_reader.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "./ivfdec.h"
-#include "./video_reader.h"
-
-#include "vpx_ports/mem_ops.h"
-
-static const char *const kIVFSignature = "DKIF";
-
-struct VpxVideoReaderStruct {
- VpxVideoInfo info;
- FILE *file;
- uint8_t *buffer;
- size_t buffer_size;
- size_t frame_size;
-};
-
-VpxVideoReader *vpx_video_reader_open(const char *filename) {
- char header[32];
- VpxVideoReader *reader = NULL;
- FILE *const file = fopen(filename, "rb");
- if (!file)
- return NULL; // Can't open file
-
- if (fread(header, 1, 32, file) != 32)
- return NULL; // Can't read file header
-
- if (memcmp(kIVFSignature, header, 4) != 0)
- return NULL; // Wrong IVF signature
-
- if (mem_get_le16(header + 4) != 0)
- return NULL; // Wrong IVF version
-
- reader = calloc(1, sizeof(*reader));
- if (!reader)
- return NULL; // Can't allocate VpxVideoReader
-
- reader->file = file;
- reader->info.codec_fourcc = mem_get_le32(header + 8);
- reader->info.frame_width = mem_get_le16(header + 12);
- reader->info.frame_height = mem_get_le16(header + 14);
- reader->info.time_base.numerator = mem_get_le32(header + 16);
- reader->info.time_base.denominator = mem_get_le32(header + 20);
-
- return reader;
-}
-
-void vpx_video_reader_close(VpxVideoReader *reader) {
- if (reader) {
- fclose(reader->file);
- free(reader->buffer);
- free(reader);
- }
-}
-
-int vpx_video_reader_read_frame(VpxVideoReader *reader) {
- return !ivf_read_frame(reader->file, &reader->buffer, &reader->frame_size,
- &reader->buffer_size);
-}
-
-const uint8_t *vpx_video_reader_get_frame(VpxVideoReader *reader,
- size_t *size) {
- if (size)
- *size = reader->frame_size;
-
- return reader->buffer;
-}
-
-const VpxVideoInfo *vpx_video_reader_get_info(VpxVideoReader *reader) {
- return &reader->info;
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/video_reader.h b/videocodec/libvpx_internal/libvpx/video_reader.h
deleted file mode 100644
index a62c6d7..0000000
--- a/videocodec/libvpx_internal/libvpx/video_reader.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VIDEO_READER_H_
-#define VIDEO_READER_H_
-
-#include "./video_common.h"
-
-// The following code is work in progress. It is going to support transparent
-// reading of input files. Right now only IVF format is supported for
-// simplicity. The main goal the API is to be simple and easy to use in example
-// code and in vpxenc/vpxdec later. All low-level details like memory
-// buffer management are hidden from API users.
-struct VpxVideoReaderStruct;
-typedef struct VpxVideoReaderStruct VpxVideoReader;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Opens the input file for reading and inspects it to determine file type.
-// Returns an opaque VpxVideoReader* upon success, or NULL upon failure.
-// Right now only IVF format is supported.
-VpxVideoReader *vpx_video_reader_open(const char *filename);
-
-// Frees all resources associated with VpxVideoReader* returned from
-// vpx_video_reader_open() call.
-void vpx_video_reader_close(VpxVideoReader *reader);
-
-// Reads frame from the file and stores it in internal buffer.
-int vpx_video_reader_read_frame(VpxVideoReader *reader);
-
-// Returns the pointer to memory buffer with frame data read by last call to
-// vpx_video_reader_read_frame().
-const uint8_t *vpx_video_reader_get_frame(VpxVideoReader *reader,
- size_t *size);
-
-// Fills VpxVideoInfo with information from opened video file.
-const VpxVideoInfo *vpx_video_reader_get_info(VpxVideoReader *reader);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VIDEO_READER_H_
diff --git a/videocodec/libvpx_internal/libvpx/video_writer.c b/videocodec/libvpx_internal/libvpx/video_writer.c
deleted file mode 100644
index 3695236..0000000
--- a/videocodec/libvpx_internal/libvpx/video_writer.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "./ivfenc.h"
-#include "./video_writer.h"
-#include "vpx/vpx_encoder.h"
-
-struct VpxVideoWriterStruct {
- VpxVideoInfo info;
- FILE *file;
- int frame_count;
-};
-
-static void write_header(FILE *file, const VpxVideoInfo *info,
- int frame_count) {
- struct vpx_codec_enc_cfg cfg;
- cfg.g_w = info->frame_width;
- cfg.g_h = info->frame_height;
- cfg.g_timebase.num = info->time_base.numerator;
- cfg.g_timebase.den = info->time_base.denominator;
-
- ivf_write_file_header(file, &cfg, info->codec_fourcc, frame_count);
-}
-
-VpxVideoWriter *vpx_video_writer_open(const char *filename,
- VpxContainer container,
- const VpxVideoInfo *info) {
- if (container == kContainerIVF) {
- VpxVideoWriter *writer = NULL;
- FILE *const file = fopen(filename, "wb");
- if (!file)
- return NULL;
-
- writer = malloc(sizeof(*writer));
- if (!writer)
- return NULL;
-
- writer->frame_count = 0;
- writer->info = *info;
- writer->file = file;
-
- write_header(writer->file, info, 0);
-
- return writer;
- }
-
- return NULL;
-}
-
-void vpx_video_writer_close(VpxVideoWriter *writer) {
- if (writer) {
- // Rewriting frame header with real frame count
- rewind(writer->file);
- write_header(writer->file, &writer->info, writer->frame_count);
-
- fclose(writer->file);
- free(writer);
- }
-}
-
-int vpx_video_writer_write_frame(VpxVideoWriter *writer,
- const uint8_t *buffer, size_t size,
- int64_t pts) {
- ivf_write_frame_header(writer->file, pts, size);
- if (fwrite(buffer, 1, size, writer->file) != size)
- return 0;
-
- ++writer->frame_count;
-
- return 1;
-}
diff --git a/videocodec/libvpx_internal/libvpx/video_writer.h b/videocodec/libvpx_internal/libvpx/video_writer.h
deleted file mode 100644
index 5dbfe52..0000000
--- a/videocodec/libvpx_internal/libvpx/video_writer.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VIDEO_WRITER_H_
-#define VIDEO_WRITER_H_
-
-#include "./video_common.h"
-
-typedef enum {
- kContainerIVF
-} VpxContainer;
-
-struct VpxVideoWriterStruct;
-typedef struct VpxVideoWriterStruct VpxVideoWriter;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Finds and opens writer for specified container format.
-// Returns an opaque VpxVideoWriter* upon success, or NULL upon failure.
-// Right now only IVF format is supported.
-VpxVideoWriter *vpx_video_writer_open(const char *filename,
- VpxContainer container,
- const VpxVideoInfo *info);
-
-// Frees all resources associated with VpxVideoWriter* returned from
-// vpx_video_writer_open() call.
-void vpx_video_writer_close(VpxVideoWriter *writer);
-
-// Writes frame bytes to the file.
-int vpx_video_writer_write_frame(VpxVideoWriter *writer,
- const uint8_t *buffer, size_t size,
- int64_t pts);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VIDEO_WRITER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.c b/videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.c
deleted file mode 100644
index 54afc13..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "blockd.h"
-#include "vpx_mem/vpx_mem.h"
-#include "onyxc_int.h"
-#include "findnearmv.h"
-#include "entropymode.h"
-#include "systemdependent.h"
-
-void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
-{
- int i;
- for (i = 0; i < NUM_YV12_BUFFERS; i++)
- vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
-
- vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
-#if CONFIG_POSTPROC
- vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
- if (oci->post_proc_buffer_int_used)
- vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer_int);
-
- vpx_free(oci->pp_limits_buffer);
- oci->pp_limits_buffer = NULL;
-#endif
-
- vpx_free(oci->above_context);
- vpx_free(oci->mip);
-#if CONFIG_ERROR_CONCEALMENT
- vpx_free(oci->prev_mip);
- oci->prev_mip = NULL;
-#endif
-
- oci->above_context = NULL;
- oci->mip = NULL;
-}
-
-int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
-{
- int i;
-
- vp8_de_alloc_frame_buffers(oci);
-
- /* our internal buffers are always multiples of 16 */
- if ((width & 0xf) != 0)
- width += 16 - (width & 0xf);
-
- if ((height & 0xf) != 0)
- height += 16 - (height & 0xf);
-
-
- for (i = 0; i < NUM_YV12_BUFFERS; i++)
- {
- oci->fb_idx_ref_cnt[i] = 0;
- oci->yv12_fb[i].flags = 0;
- if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
- goto allocation_fail;
- }
-
- oci->new_fb_idx = 0;
- oci->lst_fb_idx = 1;
- oci->gld_fb_idx = 2;
- oci->alt_fb_idx = 3;
-
- oci->fb_idx_ref_cnt[0] = 1;
- oci->fb_idx_ref_cnt[1] = 1;
- oci->fb_idx_ref_cnt[2] = 1;
- oci->fb_idx_ref_cnt[3] = 1;
-
- if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0)
- goto allocation_fail;
-
- oci->mb_rows = height >> 4;
- oci->mb_cols = width >> 4;
- oci->MBs = oci->mb_rows * oci->mb_cols;
- oci->mode_info_stride = oci->mb_cols + 1;
- oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
-
- if (!oci->mip)
- goto allocation_fail;
-
- oci->mi = oci->mip + oci->mode_info_stride + 1;
-
- /* Allocation of previous mode info will be done in vp8_decode_frame()
- * as it is a decoder only data */
-
- oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
-
- if (!oci->above_context)
- goto allocation_fail;
-
-#if CONFIG_POSTPROC
- if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0)
- goto allocation_fail;
-
- oci->post_proc_buffer_int_used = 0;
- vpx_memset(&oci->postproc_state, 0, sizeof(oci->postproc_state));
- vpx_memset(oci->post_proc_buffer.buffer_alloc, 128,
- oci->post_proc_buffer.frame_size);
-
- /* Allocate buffer to store post-processing filter coefficients.
- *
- * Note: Round up mb_cols to support SIMD reads
- */
- oci->pp_limits_buffer = vpx_memalign(16, 24 * ((oci->mb_cols + 1) & ~1));
- if (!oci->pp_limits_buffer)
- goto allocation_fail;
-#endif
-
- return 0;
-
-allocation_fail:
- vp8_de_alloc_frame_buffers(oci);
- return 1;
-}
-
-void vp8_setup_version(VP8_COMMON *cm)
-{
- switch (cm->version)
- {
- case 0:
- cm->no_lpf = 0;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 0;
- cm->full_pixel = 0;
- break;
- case 1:
- cm->no_lpf = 0;
- cm->filter_type = SIMPLE_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 0;
- break;
- case 2:
- cm->no_lpf = 1;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 0;
- break;
- case 3:
- cm->no_lpf = 1;
- cm->filter_type = SIMPLE_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 1;
- break;
- default:
- /*4,5,6,7 are reserved for future use*/
- cm->no_lpf = 0;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 0;
- cm->full_pixel = 0;
- break;
- }
-}
-void vp8_create_common(VP8_COMMON *oci)
-{
- vp8_machine_specific_config(oci);
-
- vp8_init_mbmode_probs(oci);
- vp8_default_bmode_probs(oci->fc.bmode_prob);
-
- oci->mb_no_coeff_skip = 1;
- oci->no_lpf = 0;
- oci->filter_type = NORMAL_LOOPFILTER;
- oci->use_bilinear_mc_filter = 0;
- oci->full_pixel = 0;
- oci->multi_token_partition = ONE_PARTITION;
- oci->clamp_type = RECON_CLAMP_REQUIRED;
-
- /* Initialize reference frame sign bias structure to defaults */
- vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
-
- /* Default disable buffer to buffer copying */
- oci->copy_buffer_to_gf = 0;
- oci->copy_buffer_to_arf = 0;
-}
-
-void vp8_remove_common(VP8_COMMON *oci)
-{
- vp8_de_alloc_frame_buffers(oci);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.h b/videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.h
deleted file mode 100644
index 93e99d7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/alloccommon.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ALLOCCOMMON_H_
-#define VP8_COMMON_ALLOCCOMMON_H_
-
-#include "onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_create_common(VP8_COMMON *oci);
-void vp8_remove_common(VP8_COMMON *oci);
-void vp8_de_alloc_frame_buffers(VP8_COMMON *oci);
-int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height);
-void vp8_setup_version(VP8_COMMON *oci);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_ALLOCCOMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/bilinearfilter_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/bilinearfilter_v6.asm
deleted file mode 100644
index 9704b42..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/bilinearfilter_v6.asm
+++ /dev/null
@@ -1,237 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_filter_block2d_bil_first_pass_armv6|
- EXPORT |vp8_filter_block2d_bil_second_pass_armv6|
-
- 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 *vp8_filter
-;-------------------------------------
-; The output is transposed stroed in output array to make it easy for second pass filtering.
-|vp8_filter_block2d_bil_first_pass_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; vp8_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 ; |vp8_filter_block2d_bil_first_pass_armv6|
-
-
-;---------------------------------
-; 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 *vp8_filter
-;---------------------------------
-|vp8_filter_block2d_bil_second_pass_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; vp8_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 ; |vp8_filter_block2d_second_pass_armv6|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem16x16_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem16x16_v6.asm
deleted file mode 100644
index abf048c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem16x16_v6.asm
+++ /dev/null
@@ -1,186 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_copy_mem16x16_v6|
- ; ARM
- ; REQUIRE8
- ; PRESERVE8
-
- AREA Block, CODE, READONLY ; name this block of code
-;void copy_mem16x16_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem16x16_v6| PROC
- stmdb sp!, {r4 - r7}
- ;push {r4-r7}
-
- ;preload
- pld [r0, #31] ; preload for next 16x16 block
-
- ands r4, r0, #15
- beq copy_mem16x16_fast
-
- ands r4, r0, #7
- beq copy_mem16x16_8
-
- ands r4, r0, #3
- beq copy_mem16x16_4
-
- ;copy one byte each time
- ldrb r4, [r0]
- ldrb r5, [r0, #1]
- ldrb r6, [r0, #2]
- ldrb r7, [r0, #3]
-
- mov r12, #16
-
-copy_mem16x16_1_loop
- strb r4, [r2]
- strb r5, [r2, #1]
- strb r6, [r2, #2]
- strb r7, [r2, #3]
-
- ldrb r4, [r0, #4]
- ldrb r5, [r0, #5]
- ldrb r6, [r0, #6]
- ldrb r7, [r0, #7]
-
- subs r12, r12, #1
-
- strb r4, [r2, #4]
- strb r5, [r2, #5]
- strb r6, [r2, #6]
- strb r7, [r2, #7]
-
- ldrb r4, [r0, #8]
- ldrb r5, [r0, #9]
- ldrb r6, [r0, #10]
- ldrb r7, [r0, #11]
-
- strb r4, [r2, #8]
- strb r5, [r2, #9]
- strb r6, [r2, #10]
- strb r7, [r2, #11]
-
- ldrb r4, [r0, #12]
- ldrb r5, [r0, #13]
- ldrb r6, [r0, #14]
- ldrb r7, [r0, #15]
-
- add r0, r0, r1
-
- strb r4, [r2, #12]
- strb r5, [r2, #13]
- strb r6, [r2, #14]
- strb r7, [r2, #15]
-
- add r2, r2, r3
-
- ldrneb r4, [r0]
- ldrneb r5, [r0, #1]
- ldrneb r6, [r0, #2]
- ldrneb r7, [r0, #3]
-
- pld [r0, #31] ; preload for next 16x16 block
-
- bne copy_mem16x16_1_loop
-
- ldmia sp!, {r4 - r7}
- ;pop {r4-r7}
- mov pc, lr
-
-;copy 4 bytes each time
-copy_mem16x16_4
- ldr r4, [r0]
- ldr r5, [r0, #4]
- ldr r6, [r0, #8]
- ldr r7, [r0, #12]
-
- mov r12, #16
-
-copy_mem16x16_4_loop
- subs r12, r12, #1
- add r0, r0, r1
-
- str r4, [r2]
- str r5, [r2, #4]
- str r6, [r2, #8]
- str r7, [r2, #12]
-
- add r2, r2, r3
-
- ldrne r4, [r0]
- ldrne r5, [r0, #4]
- ldrne r6, [r0, #8]
- ldrne r7, [r0, #12]
-
- pld [r0, #31] ; preload for next 16x16 block
-
- bne copy_mem16x16_4_loop
-
- ldmia sp!, {r4 - r7}
- ;pop {r4-r7}
- mov pc, lr
-
-;copy 8 bytes each time
-copy_mem16x16_8
- sub r1, r1, #16
- sub r3, r3, #16
-
- mov r12, #16
-
-copy_mem16x16_8_loop
- ldmia r0!, {r4-r5}
- ;ldm r0, {r4-r5}
- ldmia r0!, {r6-r7}
-
- add r0, r0, r1
-
- stmia r2!, {r4-r5}
- subs r12, r12, #1
- ;stm r2, {r4-r5}
- stmia r2!, {r6-r7}
-
- add r2, r2, r3
-
- pld [r0, #31] ; preload for next 16x16 block
- bne copy_mem16x16_8_loop
-
- ldmia sp!, {r4 - r7}
- ;pop {r4-r7}
- mov pc, lr
-
-;copy 16 bytes each time
-copy_mem16x16_fast
- ;sub r1, r1, #16
- ;sub r3, r3, #16
-
- mov r12, #16
-
-copy_mem16x16_fast_loop
- ldmia r0, {r4-r7}
- ;ldm r0, {r4-r7}
- add r0, r0, r1
-
- subs r12, r12, #1
- stmia r2, {r4-r7}
- ;stm r2, {r4-r7}
- add r2, r2, r3
-
- pld [r0, #31] ; preload for next 16x16 block
- bne copy_mem16x16_fast_loop
-
- ldmia sp!, {r4 - r7}
- ;pop {r4-r7}
- mov pc, lr
-
- ENDP ; |vp8_copy_mem16x16_v6|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x4_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x4_v6.asm
deleted file mode 100644
index d8362ef..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x4_v6.asm
+++ /dev/null
@@ -1,128 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_copy_mem8x4_v6|
- ; ARM
- ; REQUIRE8
- ; PRESERVE8
-
- AREA Block, CODE, READONLY ; name this block of code
-;void vp8_copy_mem8x4_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem8x4_v6| PROC
- ;push {r4-r5}
- stmdb sp!, {r4-r5}
-
- ;preload
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- ands r4, r0, #7
- beq copy_mem8x4_fast
-
- ands r4, r0, #3
- beq copy_mem8x4_4
-
- ;copy 1 byte each time
- ldrb r4, [r0]
- ldrb r5, [r0, #1]
-
- mov r12, #4
-
-copy_mem8x4_1_loop
- strb r4, [r2]
- strb r5, [r2, #1]
-
- ldrb r4, [r0, #2]
- ldrb r5, [r0, #3]
-
- subs r12, r12, #1
-
- strb r4, [r2, #2]
- strb r5, [r2, #3]
-
- ldrb r4, [r0, #4]
- ldrb r5, [r0, #5]
-
- strb r4, [r2, #4]
- strb r5, [r2, #5]
-
- ldrb r4, [r0, #6]
- ldrb r5, [r0, #7]
-
- add r0, r0, r1
-
- strb r4, [r2, #6]
- strb r5, [r2, #7]
-
- add r2, r2, r3
-
- ldrneb r4, [r0]
- ldrneb r5, [r0, #1]
-
- bne copy_mem8x4_1_loop
-
- ldmia sp!, {r4 - r5}
- ;pop {r4-r5}
- mov pc, lr
-
-;copy 4 bytes each time
-copy_mem8x4_4
- ldr r4, [r0]
- ldr r5, [r0, #4]
-
- mov r12, #4
-
-copy_mem8x4_4_loop
- subs r12, r12, #1
- add r0, r0, r1
-
- str r4, [r2]
- str r5, [r2, #4]
-
- add r2, r2, r3
-
- ldrne r4, [r0]
- ldrne r5, [r0, #4]
-
- bne copy_mem8x4_4_loop
-
- ldmia sp!, {r4-r5}
- ;pop {r4-r5}
- mov pc, lr
-
-;copy 8 bytes each time
-copy_mem8x4_fast
- ;sub r1, r1, #8
- ;sub r3, r3, #8
-
- mov r12, #4
-
-copy_mem8x4_fast_loop
- ldmia r0, {r4-r5}
- ;ldm r0, {r4-r5}
- add r0, r0, r1
-
- subs r12, r12, #1
- stmia r2, {r4-r5}
- ;stm r2, {r4-r5}
- add r2, r2, r3
-
- bne copy_mem8x4_fast_loop
-
- ldmia sp!, {r4-r5}
- ;pop {r4-r5}
- mov pc, lr
-
- ENDP ; |vp8_copy_mem8x4_v6|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x8_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x8_v6.asm
deleted file mode 100644
index c6a60c6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/copymem8x8_v6.asm
+++ /dev/null
@@ -1,128 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_copy_mem8x8_v6|
- ; ARM
- ; REQUIRE8
- ; PRESERVE8
-
- AREA Block, CODE, READONLY ; name this block of code
-;void copy_mem8x8_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-|vp8_copy_mem8x8_v6| PROC
- ;push {r4-r5}
- stmdb sp!, {r4-r5}
-
- ;preload
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- ands r4, r0, #7
- beq copy_mem8x8_fast
-
- ands r4, r0, #3
- beq copy_mem8x8_4
-
- ;copy 1 byte each time
- ldrb r4, [r0]
- ldrb r5, [r0, #1]
-
- mov r12, #8
-
-copy_mem8x8_1_loop
- strb r4, [r2]
- strb r5, [r2, #1]
-
- ldrb r4, [r0, #2]
- ldrb r5, [r0, #3]
-
- subs r12, r12, #1
-
- strb r4, [r2, #2]
- strb r5, [r2, #3]
-
- ldrb r4, [r0, #4]
- ldrb r5, [r0, #5]
-
- strb r4, [r2, #4]
- strb r5, [r2, #5]
-
- ldrb r4, [r0, #6]
- ldrb r5, [r0, #7]
-
- add r0, r0, r1
-
- strb r4, [r2, #6]
- strb r5, [r2, #7]
-
- add r2, r2, r3
-
- ldrneb r4, [r0]
- ldrneb r5, [r0, #1]
-
- bne copy_mem8x8_1_loop
-
- ldmia sp!, {r4 - r5}
- ;pop {r4-r5}
- mov pc, lr
-
-;copy 4 bytes each time
-copy_mem8x8_4
- ldr r4, [r0]
- ldr r5, [r0, #4]
-
- mov r12, #8
-
-copy_mem8x8_4_loop
- subs r12, r12, #1
- add r0, r0, r1
-
- str r4, [r2]
- str r5, [r2, #4]
-
- add r2, r2, r3
-
- ldrne r4, [r0]
- ldrne r5, [r0, #4]
-
- bne copy_mem8x8_4_loop
-
- ldmia sp!, {r4 - r5}
- ;pop {r4-r5}
- mov pc, lr
-
-;copy 8 bytes each time
-copy_mem8x8_fast
- ;sub r1, r1, #8
- ;sub r3, r3, #8
-
- mov r12, #8
-
-copy_mem8x8_fast_loop
- ldmia r0, {r4-r5}
- ;ldm r0, {r4-r5}
- add r0, r0, r1
-
- subs r12, r12, #1
- stmia r2, {r4-r5}
- ;stm r2, {r4-r5}
- add r2, r2, r3
-
- bne copy_mem8x8_fast_loop
-
- ldmia sp!, {r4-r5}
- ;pop {r4-r5}
- mov pc, lr
-
- ENDP ; |vp8_copy_mem8x8_v6|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dc_only_idct_add_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dc_only_idct_add_v6.asm
deleted file mode 100644
index 9aa659f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dc_only_idct_add_v6.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
- EXPORT |vp8_dc_only_idct_add_v6|
-
- AREA |.text|, CODE, READONLY
-
-;void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr,
-; int pred_stride, unsigned char *dst_ptr,
-; int dst_stride)
-; r0 input_dc
-; r1 pred_ptr
-; r2 pred_stride
-; r3 dst_ptr
-; sp dst_stride
-
-|vp8_dc_only_idct_add_v6| PROC
- stmdb sp!, {r4 - r7}
-
- add r0, r0, #4 ; input_dc += 4
- ldr r12, c0x0000FFFF
- ldr r4, [r1], r2
- and r0, r12, r0, asr #3 ; input_dc >> 3 + mask
- ldr r6, [r1], r2
- orr r0, r0, r0, lsl #16 ; a1 | a1
-
- ldr r12, [sp, #16] ; dst stride
-
- uxtab16 r5, r0, r4 ; a1+2 | a1+0
- uxtab16 r4, r0, r4, ror #8 ; a1+3 | a1+1
- uxtab16 r7, r0, r6
- uxtab16 r6, r0, r6, ror #8
- usat16 r5, #8, r5
- usat16 r4, #8, r4
- usat16 r7, #8, r7
- usat16 r6, #8, r6
- orr r5, r5, r4, lsl #8
- orr r7, r7, r6, lsl #8
- ldr r4, [r1], r2
- str r5, [r3], r12
- ldr r6, [r1]
- str r7, [r3], r12
-
- uxtab16 r5, r0, r4
- uxtab16 r4, r0, r4, ror #8
- uxtab16 r7, r0, r6
- uxtab16 r6, r0, r6, ror #8
- usat16 r5, #8, r5
- usat16 r4, #8, r4
- usat16 r7, #8, r7
- usat16 r6, #8, r6
- orr r5, r5, r4, lsl #8
- orr r7, r7, r6, lsl #8
- str r5, [r3], r12
- str r7, [r3]
-
- ldmia sp!, {r4 - r7}
- bx lr
-
- ENDP ; |vp8_dc_only_idct_add_v6|
-
-; Constant Pool
-c0x0000FFFF DCD 0x0000FFFF
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequant_idct_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequant_idct_v6.asm
deleted file mode 100644
index 2510ad8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequant_idct_v6.asm
+++ /dev/null
@@ -1,190 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
- EXPORT |vp8_dequant_idct_add_v6|
-
- AREA |.text|, CODE, READONLY
-;void vp8_dequant_idct_v6(short *input, short *dq,
-; unsigned char *dest, int stride)
-; r0 = q
-; r1 = dq
-; r2 = dst
-; r3 = stride
-
-|vp8_dequant_idct_add_v6| PROC
- stmdb sp!, {r4-r11, lr}
-
- ldr r4, [r0] ;input
- ldr r5, [r1], #4 ;dq
-
- sub sp, sp, #4
- str r3, [sp]
-
- mov r12, #4
-
-vp8_dequant_add_loop
- smulbb r6, r4, r5
- smultt r7, r4, r5
-
- ldr r4, [r0, #4] ;input
- ldr r5, [r1], #4 ;dq
-
- strh r6, [r0], #2
- strh r7, [r0], #2
-
- smulbb r6, r4, r5
- smultt r7, r4, r5
-
- subs r12, r12, #1
-
- ldrne r4, [r0, #4]
- ldrne r5, [r1], #4
-
- strh r6, [r0], #2
- strh r7, [r0], #2
-
- bne vp8_dequant_add_loop
-
- sub r0, r0, #32
- mov r1, r0
-
-; short_idct4x4llm_v6_dual
- ldr r3, cospi8sqrt2minus1
- ldr r4, sinpi8sqrt2
- ldr r6, [r0, #8]
- mov r5, #2
-vp8_dequant_idct_loop1_v6
- ldr r12, [r0, #24]
- ldr r14, [r0, #16]
- smulwt r9, r3, r6
- smulwb r7, r3, r6
- smulwt r10, r4, r6
- smulwb r8, r4, r6
- pkhbt r7, r7, r9, lsl #16
- smulwt r11, r3, r12
- pkhbt r8, r8, r10, lsl #16
- uadd16 r6, r6, r7
- smulwt r7, r4, r12
- smulwb r9, r3, r12
- smulwb r10, r4, r12
- subs r5, r5, #1
- pkhbt r9, r9, r11, lsl #16
- ldr r11, [r0], #4
- pkhbt r10, r10, r7, lsl #16
- uadd16 r7, r12, r9
- usub16 r7, r8, r7
- uadd16 r6, r6, r10
- uadd16 r10, r11, r14
- usub16 r8, r11, r14
- uadd16 r9, r10, r6
- usub16 r10, r10, r6
- uadd16 r6, r8, r7
- usub16 r7, r8, r7
- str r6, [r1, #8]
- ldrne r6, [r0, #8]
- str r7, [r1, #16]
- str r10, [r1, #24]
- str r9, [r1], #4
- bne vp8_dequant_idct_loop1_v6
-
- mov r5, #2
- sub r0, r1, #8
-vp8_dequant_idct_loop2_v6
- ldr r6, [r0], #4
- ldr r7, [r0], #4
- ldr r8, [r0], #4
- ldr r9, [r0], #4
- smulwt r1, r3, r6
- smulwt r12, r4, r6
- smulwt lr, r3, r8
- smulwt r10, r4, r8
- pkhbt r11, r8, r6, lsl #16
- pkhbt r1, lr, r1, lsl #16
- pkhbt r12, r10, r12, lsl #16
- pkhtb r6, r6, r8, asr #16
- uadd16 r6, r1, r6
- pkhbt lr, r9, r7, lsl #16
- uadd16 r10, r11, lr
- usub16 lr, r11, lr
- pkhtb r8, r7, r9, asr #16
- subs r5, r5, #1
- smulwt r1, r3, r8
- smulwb r7, r3, r8
- smulwt r11, r4, r8
- smulwb r9, r4, r8
- pkhbt r1, r7, r1, lsl #16
- uadd16 r8, r1, r8
- pkhbt r11, r9, r11, lsl #16
- usub16 r1, r12, r8
- uadd16 r8, r11, r6
- ldr r9, c0x00040004
- ldr r12, [sp] ; get stride from stack
- uadd16 r6, r10, r8
- usub16 r7, r10, r8
- uadd16 r7, r7, r9
- uadd16 r6, r6, r9
- uadd16 r10, r14, r1
- usub16 r1, r14, r1
- uadd16 r10, r10, r9
- uadd16 r1, r1, r9
- ldr r11, [r2] ; load input from dst
- mov r8, r7, asr #3
- pkhtb r9, r8, r10, asr #19
- mov r8, r1, asr #3
- pkhtb r8, r8, r6, asr #19
- uxtb16 lr, r11, ror #8
- qadd16 r9, r9, lr
- uxtb16 lr, r11
- qadd16 r8, r8, lr
- usat16 r9, #8, r9
- usat16 r8, #8, r8
- orr r9, r8, r9, lsl #8
- ldr r11, [r2, r12] ; load input from dst
- mov r7, r7, lsl #16
- mov r1, r1, lsl #16
- mov r10, r10, lsl #16
- mov r6, r6, lsl #16
- mov r7, r7, asr #3
- pkhtb r7, r7, r10, asr #19
- mov r1, r1, asr #3
- pkhtb r1, r1, r6, asr #19
- uxtb16 r8, r11, ror #8
- qadd16 r7, r7, r8
- uxtb16 r8, r11
- qadd16 r1, r1, r8
- usat16 r7, #8, r7
- usat16 r1, #8, r1
- orr r1, r1, r7, lsl #8
- str r9, [r2], r12 ; store output to dst
- str r1, [r2], r12 ; store output to dst
- bne vp8_dequant_idct_loop2_v6
-
-; vpx_memset
- sub r0, r0, #32
- add sp, sp, #4
-
- mov r12, #0
- str r12, [r0]
- str r12, [r0, #4]
- str r12, [r0, #8]
- str r12, [r0, #12]
- str r12, [r0, #16]
- str r12, [r0, #20]
- str r12, [r0, #24]
- str r12, [r0, #28]
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_dequant_idct_add_v6|
-
-; Constant Pool
-cospi8sqrt2minus1 DCD 0x00004E7B
-sinpi8sqrt2 DCD 0x00008A8C
-c0x00040004 DCD 0x00040004
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequantize_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequantize_v6.asm
deleted file mode 100644
index 72f7e0e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/dequantize_v6.asm
+++ /dev/null
@@ -1,69 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_dequantize_b_loop_v6|
-
- AREA |.text|, CODE, READONLY ; name this block of code
-;-------------------------------
-;void vp8_dequantize_b_loop_v6(short *Q, short *DQC, short *DQ);
-; r0 short *Q,
-; r1 short *DQC
-; r2 short *DQ
-|vp8_dequantize_b_loop_v6| PROC
- stmdb sp!, {r4-r9, lr}
-
- ldr r3, [r0] ;load Q
- ldr r4, [r1] ;load DQC
- ldr r5, [r0, #4]
- ldr r6, [r1, #4]
-
- mov r12, #2 ;loop counter
-
-dequant_loop
- smulbb r7, r3, r4 ;multiply
- smultt r8, r3, r4
- smulbb r9, r5, r6
- smultt lr, r5, r6
-
- ldr r3, [r0, #8]
- ldr r4, [r1, #8]
- ldr r5, [r0, #12]
- ldr r6, [r1, #12]
-
- strh r7, [r2], #2 ;store result
- smulbb r7, r3, r4 ;multiply
- strh r8, [r2], #2
- smultt r8, r3, r4
- strh r9, [r2], #2
- smulbb r9, r5, r6
- strh lr, [r2], #2
- smultt lr, r5, r6
-
- subs r12, r12, #1
-
- add r0, r0, #16
- add r1, r1, #16
-
- ldrne r3, [r0]
- strh r7, [r2], #2 ;store result
- ldrne r4, [r1]
- strh r8, [r2], #2
- ldrne r5, [r0, #4]
- strh r9, [r2], #2
- ldrne r6, [r1, #4]
- strh lr, [r2], #2
-
- bne dequant_loop
-
- ldmia sp!, {r4-r9, pc}
- ENDP ;|vp8_dequantize_b_loop_v6|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/filter_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/filter_v6.asm
deleted file mode 100644
index eb4b75b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/filter_v6.asm
+++ /dev/null
@@ -1,624 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_filter_block2d_first_pass_armv6|
- EXPORT |vp8_filter_block2d_first_pass_16x16_armv6|
- EXPORT |vp8_filter_block2d_first_pass_8x8_armv6|
- EXPORT |vp8_filter_block2d_second_pass_armv6|
- EXPORT |vp8_filter4_block2d_second_pass_armv6|
- EXPORT |vp8_filter_block2d_first_pass_only_armv6|
- EXPORT |vp8_filter_block2d_second_pass_only_armv6|
-
- AREA |.text|, CODE, READONLY ; name this block of code
-;-------------------------------------
-; r0 unsigned char *src_ptr
-; r1 short *output_ptr
-; r2 unsigned int src_pixels_per_line
-; r3 unsigned int output_width
-; stack unsigned int output_height
-; stack const short *vp8_filter
-;-------------------------------------
-; vp8_filter the input and put in the output array. Apply the 6 tap FIR filter with
-; the output being a 2 byte value and the intput being a 1 byte value.
-|vp8_filter_block2d_first_pass_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; vp8_filter address
- ldr r7, [sp, #36] ; output height
-
- sub r2, r2, r3 ; inside loop increments input array,
- ; so the height loop only needs to add
- ; r2 - width to the input pointer
-
- mov r3, r3, lsl #1 ; multiply width by 2 because using shorts
- add r12, r3, #16 ; square off the output
- sub sp, sp, #4
-
- ldr r4, [r11] ; load up packed filter coefficients
- ldr r5, [r11, #4]
- ldr r6, [r11, #8]
-
- str r1, [sp] ; push destination to stack
- mov r7, r7, lsl #16 ; height is top part of counter
-
-; six tap filter
-|height_loop_1st_6|
- ldrb r8, [r0, #-2] ; load source data
- ldrb r9, [r0, #-1]
- ldrb r10, [r0], #2
- orr r7, r7, r3, lsr #2 ; construct loop counter
-
-|width_loop_1st_6|
- ldrb r11, [r0, #-1]
-
- pkhbt lr, r8, r9, lsl #16 ; r9 | r8
- pkhbt r8, r9, r10, lsl #16 ; r10 | r9
-
- ldrb r9, [r0]
-
- smuad lr, lr, r4 ; apply the filter
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
- smuad r8, r8, r4
- pkhbt r11, r11, r9, lsl #16 ; r9 | r11
-
- smlad lr, r10, r5, lr
- ldrb r10, [r0, #1]
- smlad r8, r11, r5, r8
- ldrb r11, [r0, #2]
-
- sub r7, r7, #1
-
- pkhbt r9, r9, r10, lsl #16 ; r10 | r9
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
-
- smlad lr, r9, r6, lr
- smlad r11, r10, r6, r8
-
- ands r10, r7, #0xff ; test loop counter
-
- add lr, lr, #0x40 ; round_shift_and_clamp
- ldrneb r8, [r0, #-2] ; load data for next loop
- usat lr, #8, lr, asr #7
- add r11, r11, #0x40
- ldrneb r9, [r0, #-1]
- usat r11, #8, r11, asr #7
-
- strh lr, [r1], r12 ; result is transposed and stored, which
- ; will make second pass filtering easier.
- ldrneb r10, [r0], #2
- strh r11, [r1], r12
-
- bne width_loop_1st_6
-
- ldr r1, [sp] ; load and update dst address
- subs r7, r7, #0x10000
- add r0, r0, r2 ; move to next input line
-
- add r1, r1, #2 ; move over to next column
- str r1, [sp]
-
- bne height_loop_1st_6
-
- add sp, sp, #4
- ldmia sp!, {r4 - r11, pc}
-
- ENDP
-
-; --------------------------
-; 16x16 version
-; -----------------------------
-|vp8_filter_block2d_first_pass_16x16_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; vp8_filter address
- ldr r7, [sp, #36] ; output height
-
- add r4, r2, #18 ; preload next low
- pld [r0, r4]
-
- sub r2, r2, r3 ; inside loop increments input array,
- ; so the height loop only needs to add
- ; r2 - width to the input pointer
-
- mov r3, r3, lsl #1 ; multiply width by 2 because using shorts
- add r12, r3, #16 ; square off the output
- sub sp, sp, #4
-
- ldr r4, [r11] ; load up packed filter coefficients
- ldr r5, [r11, #4]
- ldr r6, [r11, #8]
-
- str r1, [sp] ; push destination to stack
- mov r7, r7, lsl #16 ; height is top part of counter
-
-; six tap filter
-|height_loop_1st_16_6|
- ldrb r8, [r0, #-2] ; load source data
- ldrb r9, [r0, #-1]
- ldrb r10, [r0], #2
- orr r7, r7, r3, lsr #2 ; construct loop counter
-
-|width_loop_1st_16_6|
- ldrb r11, [r0, #-1]
-
- pkhbt lr, r8, r9, lsl #16 ; r9 | r8
- pkhbt r8, r9, r10, lsl #16 ; r10 | r9
-
- ldrb r9, [r0]
-
- smuad lr, lr, r4 ; apply the filter
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
- smuad r8, r8, r4
- pkhbt r11, r11, r9, lsl #16 ; r9 | r11
-
- smlad lr, r10, r5, lr
- ldrb r10, [r0, #1]
- smlad r8, r11, r5, r8
- ldrb r11, [r0, #2]
-
- sub r7, r7, #1
-
- pkhbt r9, r9, r10, lsl #16 ; r10 | r9
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
-
- smlad lr, r9, r6, lr
- smlad r11, r10, r6, r8
-
- ands r10, r7, #0xff ; test loop counter
-
- add lr, lr, #0x40 ; round_shift_and_clamp
- ldrneb r8, [r0, #-2] ; load data for next loop
- usat lr, #8, lr, asr #7
- add r11, r11, #0x40
- ldrneb r9, [r0, #-1]
- usat r11, #8, r11, asr #7
-
- strh lr, [r1], r12 ; result is transposed and stored, which
- ; will make second pass filtering easier.
- ldrneb r10, [r0], #2
- strh r11, [r1], r12
-
- bne width_loop_1st_16_6
-
- ldr r1, [sp] ; load and update dst address
- subs r7, r7, #0x10000
- add r0, r0, r2 ; move to next input line
-
- add r11, r2, #34 ; adding back block width(=16)
- pld [r0, r11] ; preload next low
-
- add r1, r1, #2 ; move over to next column
- str r1, [sp]
-
- bne height_loop_1st_16_6
-
- add sp, sp, #4
- ldmia sp!, {r4 - r11, pc}
-
- ENDP
-
-; --------------------------
-; 8x8 version
-; -----------------------------
-|vp8_filter_block2d_first_pass_8x8_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; vp8_filter address
- ldr r7, [sp, #36] ; output height
-
- add r4, r2, #10 ; preload next low
- pld [r0, r4]
-
- sub r2, r2, r3 ; inside loop increments input array,
- ; so the height loop only needs to add
- ; r2 - width to the input pointer
-
- mov r3, r3, lsl #1 ; multiply width by 2 because using shorts
- add r12, r3, #16 ; square off the output
- sub sp, sp, #4
-
- ldr r4, [r11] ; load up packed filter coefficients
- ldr r5, [r11, #4]
- ldr r6, [r11, #8]
-
- str r1, [sp] ; push destination to stack
- mov r7, r7, lsl #16 ; height is top part of counter
-
-; six tap filter
-|height_loop_1st_8_6|
- ldrb r8, [r0, #-2] ; load source data
- ldrb r9, [r0, #-1]
- ldrb r10, [r0], #2
- orr r7, r7, r3, lsr #2 ; construct loop counter
-
-|width_loop_1st_8_6|
- ldrb r11, [r0, #-1]
-
- pkhbt lr, r8, r9, lsl #16 ; r9 | r8
- pkhbt r8, r9, r10, lsl #16 ; r10 | r9
-
- ldrb r9, [r0]
-
- smuad lr, lr, r4 ; apply the filter
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
- smuad r8, r8, r4
- pkhbt r11, r11, r9, lsl #16 ; r9 | r11
-
- smlad lr, r10, r5, lr
- ldrb r10, [r0, #1]
- smlad r8, r11, r5, r8
- ldrb r11, [r0, #2]
-
- sub r7, r7, #1
-
- pkhbt r9, r9, r10, lsl #16 ; r10 | r9
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
-
- smlad lr, r9, r6, lr
- smlad r11, r10, r6, r8
-
- ands r10, r7, #0xff ; test loop counter
-
- add lr, lr, #0x40 ; round_shift_and_clamp
- ldrneb r8, [r0, #-2] ; load data for next loop
- usat lr, #8, lr, asr #7
- add r11, r11, #0x40
- ldrneb r9, [r0, #-1]
- usat r11, #8, r11, asr #7
-
- strh lr, [r1], r12 ; result is transposed and stored, which
- ; will make second pass filtering easier.
- ldrneb r10, [r0], #2
- strh r11, [r1], r12
-
- bne width_loop_1st_8_6
-
- ldr r1, [sp] ; load and update dst address
- subs r7, r7, #0x10000
- add r0, r0, r2 ; move to next input line
-
- add r11, r2, #18 ; adding back block width(=8)
- pld [r0, r11] ; preload next low
-
- add r1, r1, #2 ; move over to next column
- str r1, [sp]
-
- bne height_loop_1st_8_6
-
- add sp, sp, #4
- ldmia sp!, {r4 - r11, pc}
-
- ENDP
-
-;---------------------------------
-; r0 short *src_ptr,
-; r1 unsigned char *output_ptr,
-; r2 unsigned int output_pitch,
-; r3 unsigned int cnt,
-; stack const short *vp8_filter
-;---------------------------------
-|vp8_filter_block2d_second_pass_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #36] ; vp8_filter address
- sub sp, sp, #4
- mov r7, r3, lsl #16 ; height is top part of counter
- str r1, [sp] ; push destination to stack
-
- ldr r4, [r11] ; load up packed filter coefficients
- ldr r5, [r11, #4]
- ldr r6, [r11, #8]
-
- pkhbt r12, r5, r4 ; pack the filter differently
- pkhbt r11, r6, r5
-
- sub r0, r0, #4 ; offset input buffer
-
-|height_loop_2nd|
- ldr r8, [r0] ; load the data
- ldr r9, [r0, #4]
- orr r7, r7, r3, lsr #1 ; loop counter
-
-|width_loop_2nd|
- smuad lr, r4, r8 ; apply filter
- sub r7, r7, #1
- smulbt r8, r4, r8
-
- ldr r10, [r0, #8]
-
- smlad lr, r5, r9, lr
- smladx r8, r12, r9, r8
-
- ldrh r9, [r0, #12]
-
- smlad lr, r6, r10, lr
- smladx r8, r11, r10, r8
-
- add r0, r0, #4
- smlatb r10, r6, r9, r8
-
- add lr, lr, #0x40 ; round_shift_and_clamp
- ands r8, r7, #0xff
- usat lr, #8, lr, asr #7
- add r10, r10, #0x40
- strb lr, [r1], r2 ; the result is transposed back and stored
- usat r10, #8, r10, asr #7
-
- ldrne r8, [r0] ; load data for next loop
- ldrne r9, [r0, #4]
- strb r10, [r1], r2
-
- bne width_loop_2nd
-
- ldr r1, [sp] ; update dst for next loop
- subs r7, r7, #0x10000
- add r0, r0, #16 ; updata src for next loop
- add r1, r1, #1
- str r1, [sp]
-
- bne height_loop_2nd
-
- add sp, sp, #4
- ldmia sp!, {r4 - r11, pc}
-
- ENDP
-
-;---------------------------------
-; r0 short *src_ptr,
-; r1 unsigned char *output_ptr,
-; r2 unsigned int output_pitch,
-; r3 unsigned int cnt,
-; stack const short *vp8_filter
-;---------------------------------
-|vp8_filter4_block2d_second_pass_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #36] ; vp8_filter address
- mov r7, r3, lsl #16 ; height is top part of counter
-
- ldr r4, [r11] ; load up packed filter coefficients
- add lr, r1, r3 ; save final destination pointer
- ldr r5, [r11, #4]
- ldr r6, [r11, #8]
-
- pkhbt r12, r5, r4 ; pack the filter differently
- pkhbt r11, r6, r5
- mov r4, #0x40 ; rounding factor (for smlad{x})
-
-|height_loop_2nd_4|
- ldrd r8, r9, [r0, #-4] ; load the data
- orr r7, r7, r3, lsr #1 ; loop counter
-
-|width_loop_2nd_4|
- ldr r10, [r0, #4]!
- smladx r6, r9, r12, r4 ; apply filter
- pkhbt r8, r9, r8
- smlad r5, r8, r12, r4
- pkhbt r8, r10, r9
- smladx r6, r10, r11, r6
- sub r7, r7, #1
- smlad r5, r8, r11, r5
-
- mov r8, r9 ; shift the data for the next loop
- mov r9, r10
-
- usat r6, #8, r6, asr #7 ; shift and clamp
- usat r5, #8, r5, asr #7
-
- strb r5, [r1], r2 ; the result is transposed back and stored
- tst r7, #0xff
- strb r6, [r1], r2
-
- bne width_loop_2nd_4
-
- subs r7, r7, #0x10000
- add r0, r0, #16 ; update src for next loop
- sub r1, lr, r7, lsr #16 ; update dst for next loop
-
- bne height_loop_2nd_4
-
- ldmia sp!, {r4 - r11, pc}
-
- ENDP
-
-;------------------------------------
-; r0 unsigned char *src_ptr
-; r1 unsigned char *output_ptr,
-; r2 unsigned int src_pixels_per_line
-; r3 unsigned int cnt,
-; stack unsigned int output_pitch,
-; stack const short *vp8_filter
-;------------------------------------
-|vp8_filter_block2d_first_pass_only_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- add r7, r2, r3 ; preload next low
- add r7, r7, #2
- pld [r0, r7]
-
- ldr r4, [sp, #36] ; output pitch
- ldr r11, [sp, #40] ; HFilter address
- sub sp, sp, #8
-
- mov r7, r3
- sub r2, r2, r3 ; inside loop increments input array,
- ; so the height loop only needs to add
- ; r2 - width to the input pointer
-
- sub r4, r4, r3
- str r4, [sp] ; save modified output pitch
- str r2, [sp, #4]
-
- mov r2, #0x40
-
- ldr r4, [r11] ; load up packed filter coefficients
- ldr r5, [r11, #4]
- ldr r6, [r11, #8]
-
-; six tap filter
-|height_loop_1st_only_6|
- ldrb r8, [r0, #-2] ; load data
- ldrb r9, [r0, #-1]
- ldrb r10, [r0], #2
-
- mov r12, r3, lsr #1 ; loop counter
-
-|width_loop_1st_only_6|
- ldrb r11, [r0, #-1]
-
- pkhbt lr, r8, r9, lsl #16 ; r9 | r8
- pkhbt r8, r9, r10, lsl #16 ; r10 | r9
-
- ldrb r9, [r0]
-
-;; smuad lr, lr, r4
- smlad lr, lr, r4, r2
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
-;; smuad r8, r8, r4
- smlad r8, r8, r4, r2
- pkhbt r11, r11, r9, lsl #16 ; r9 | r11
-
- smlad lr, r10, r5, lr
- ldrb r10, [r0, #1]
- smlad r8, r11, r5, r8
- ldrb r11, [r0, #2]
-
- subs r12, r12, #1
-
- pkhbt r9, r9, r10, lsl #16 ; r10 | r9
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
-
- smlad lr, r9, r6, lr
- smlad r10, r10, r6, r8
-
-;; add lr, lr, #0x40 ; round_shift_and_clamp
- ldrneb r8, [r0, #-2] ; load data for next loop
- usat lr, #8, lr, asr #7
-;; add r10, r10, #0x40
- strb lr, [r1], #1 ; store the result
- usat r10, #8, r10, asr #7
-
- ldrneb r9, [r0, #-1]
- strb r10, [r1], #1
- ldrneb r10, [r0], #2
-
- bne width_loop_1st_only_6
-
- ldr lr, [sp] ; load back output pitch
- ldr r12, [sp, #4] ; load back output pitch
- subs r7, r7, #1
- add r0, r0, r12 ; updata src for next loop
-
- add r11, r12, r3 ; preload next low
- add r11, r11, #2
- pld [r0, r11]
-
- add r1, r1, lr ; update dst for next loop
-
- bne height_loop_1st_only_6
-
- add sp, sp, #8
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_filter_block2d_first_pass_only_armv6|
-
-
-;------------------------------------
-; r0 unsigned char *src_ptr,
-; r1 unsigned char *output_ptr,
-; r2 unsigned int src_pixels_per_line
-; r3 unsigned int cnt,
-; stack unsigned int output_pitch,
-; stack const short *vp8_filter
-;------------------------------------
-|vp8_filter_block2d_second_pass_only_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
-
- ldr r11, [sp, #40] ; VFilter address
- ldr r12, [sp, #36] ; output pitch
-
- mov r7, r3, lsl #16 ; height is top part of counter
- sub r0, r0, r2, lsl #1 ; need 6 elements for filtering, 2 before, 3 after
-
- sub sp, sp, #8
-
- ldr r4, [r11] ; load up packed filter coefficients
- ldr r5, [r11, #4]
- ldr r6, [r11, #8]
-
- str r0, [sp] ; save r0 to stack
- str r1, [sp, #4] ; save dst to stack
-
-; six tap filter
-|width_loop_2nd_only_6|
- ldrb r8, [r0], r2 ; load data
- orr r7, r7, r3 ; loop counter
- ldrb r9, [r0], r2
- ldrb r10, [r0], r2
-
-|height_loop_2nd_only_6|
- ; filter first column in this inner loop, than, move to next colum.
- ldrb r11, [r0], r2
-
- pkhbt lr, r8, r9, lsl #16 ; r9 | r8
- pkhbt r8, r9, r10, lsl #16 ; r10 | r9
-
- ldrb r9, [r0], r2
-
- smuad lr, lr, r4
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
- smuad r8, r8, r4
- pkhbt r11, r11, r9, lsl #16 ; r9 | r11
-
- smlad lr, r10, r5, lr
- ldrb r10, [r0], r2
- smlad r8, r11, r5, r8
- ldrb r11, [r0]
-
- sub r7, r7, #2
- sub r0, r0, r2, lsl #2
-
- pkhbt r9, r9, r10, lsl #16 ; r10 | r9
- pkhbt r10, r10, r11, lsl #16 ; r11 | r10
-
- smlad lr, r9, r6, lr
- smlad r10, r10, r6, r8
-
- ands r9, r7, #0xff
-
- add lr, lr, #0x40 ; round_shift_and_clamp
- ldrneb r8, [r0], r2 ; load data for next loop
- usat lr, #8, lr, asr #7
- add r10, r10, #0x40
- strb lr, [r1], r12 ; store the result for the column
- usat r10, #8, r10, asr #7
-
- ldrneb r9, [r0], r2
- strb r10, [r1], r12
- ldrneb r10, [r0], r2
-
- bne height_loop_2nd_only_6
-
- ldr r0, [sp]
- ldr r1, [sp, #4]
- subs r7, r7, #0x10000
- add r0, r0, #1 ; move to filter next column
- str r0, [sp]
- add r1, r1, #1
- str r1, [sp, #4]
-
- bne width_loop_2nd_only_6
-
- add sp, sp, #8
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_filter_block2d_second_pass_only_armv6|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_blk_v6.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_blk_v6.c
deleted file mode 100644
index c94f84a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_blk_v6.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-
-
-void vp8_dequant_idct_add_y_block_v6(short *q, short *dq,
- unsigned char *dst,
- int stride, char *eobs)
-{
- int i;
-
- for (i = 0; i < 4; i++)
- {
- if (eobs[0] > 1)
- vp8_dequant_idct_add_v6 (q, dq, dst, stride);
- else if (eobs[0] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[0]*dq[0], dst, stride, dst, stride);
- ((int *)q)[0] = 0;
- }
-
- if (eobs[1] > 1)
- vp8_dequant_idct_add_v6 (q+16, dq, dst+4, stride);
- else if (eobs[1] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[16]*dq[0], dst+4, stride, dst+4, stride);
- ((int *)(q+16))[0] = 0;
- }
-
- if (eobs[2] > 1)
- vp8_dequant_idct_add_v6 (q+32, dq, dst+8, stride);
- else if (eobs[2] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[32]*dq[0], dst+8, stride, dst+8, stride);
- ((int *)(q+32))[0] = 0;
- }
-
- if (eobs[3] > 1)
- vp8_dequant_idct_add_v6 (q+48, dq, dst+12, stride);
- else if (eobs[3] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[48]*dq[0], dst+12, stride,dst+12,stride);
- ((int *)(q+48))[0] = 0;
- }
-
- q += 64;
- dst += 4*stride;
- eobs += 4;
- }
-}
-
-void vp8_dequant_idct_add_uv_block_v6(short *q, short *dq,
- unsigned char *dstu,
- unsigned char *dstv,
- int stride, char *eobs)
-{
- int i;
-
- for (i = 0; i < 2; i++)
- {
- if (eobs[0] > 1)
- vp8_dequant_idct_add_v6 (q, dq, dstu, stride);
- else if (eobs[0] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[0]*dq[0], dstu, stride, dstu, stride);
- ((int *)q)[0] = 0;
- }
-
- if (eobs[1] > 1)
- vp8_dequant_idct_add_v6 (q+16, dq, dstu+4, stride);
- else if (eobs[1] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[16]*dq[0], dstu+4, stride,
- dstu+4, stride);
- ((int *)(q+16))[0] = 0;
- }
-
- q += 32;
- dstu += 4*stride;
- eobs += 2;
- }
-
- for (i = 0; i < 2; i++)
- {
- if (eobs[0] > 1)
- vp8_dequant_idct_add_v6 (q, dq, dstv, stride);
- else if (eobs[0] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[0]*dq[0], dstv, stride, dstv, stride);
- ((int *)q)[0] = 0;
- }
-
- if (eobs[1] > 1)
- vp8_dequant_idct_add_v6 (q+16, dq, dstv+4, stride);
- else if (eobs[1] == 1)
- {
- vp8_dc_only_idct_add_v6 (q[16]*dq[0], dstv+4, stride,
- dstv+4, stride);
- ((int *)(q+16))[0] = 0;
- }
-
- q += 32;
- dstv += 4*stride;
- eobs += 2;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_v6.asm
deleted file mode 100644
index b4d44cb..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/idct_v6.asm
+++ /dev/null
@@ -1,202 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_short_idct4x4llm_v6_dual|
-
- AREA |.text|, CODE, READONLY
-
-
-; void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch,
-; unsigned char *dst, int stride)
-; r0 short* input
-; r1 unsigned char* pred
-; r2 int pitch
-; r3 unsigned char* dst
-; sp int stride
-
-|vp8_short_idct4x4llm_v6_dual| PROC
- stmdb sp!, {r4-r11, lr}
-
- sub sp, sp, #4
-
- mov r4, #0x00008A00 ; sin
- orr r4, r4, #0x0000008C ; sinpi8sqrt2
-
- mov r5, #0x00004E00 ; cos
- orr r5, r5, #0x0000007B ; cospi8sqrt2minus1
- orr r5, r5, #1<<31 ; loop counter on top bit
-
-loop1_dual
- ldr r6, [r0, #(4*2)] ; i5 | i4
- ldr r12, [r0, #(12*2)] ; i13|i12
- ldr r14, [r0, #(8*2)] ; i9 | i8
-
- smulbt r9, r5, r6 ; (ip[5] * cospi8sqrt2minus1) >> 16
- smulbb r7, r5, r6 ; (ip[4] * cospi8sqrt2minus1) >> 16
- smulwt r10, r4, r6 ; (ip[5] * sinpi8sqrt2) >> 16
- smulwb r8, r4, r6 ; (ip[4] * sinpi8sqrt2) >> 16
-
- smulbt r11, r5, r12 ; (ip[13] * cospi8sqrt2minus1) >> 16
- pkhtb r7, r9, r7, asr #16 ; 5c | 4c
- pkhbt r8, r8, r10, lsl #16 ; 5s | 4s
- uadd16 r6, r6, r7 ; 5c+5 | 4c+4
-
- smulwt r7, r4, r12 ; (ip[13] * sinpi8sqrt2) >> 16
- smulbb r9, r5, r12 ; (ip[12] * cospi8sqrt2minus1) >> 16
- smulwb r10, r4, r12 ; (ip[12] * sinpi8sqrt2) >> 16
-
- subs r5, r5, #1<<31 ; i--
-
- pkhtb r9, r11, r9, asr #16 ; 13c | 12c
- ldr r11, [r0] ; i1 | i0
- pkhbt r10, r10, r7, lsl #16 ; 13s | 12s
- uadd16 r7, r12, r9 ; 13c+13 | 12c+12
-
- usub16 r7, r8, r7 ; c
- uadd16 r6, r6, r10 ; d
- uadd16 r10, r11, r14 ; a
- usub16 r8, r11, r14 ; b
-
- uadd16 r9, r10, r6 ; a+d
- usub16 r10, r10, r6 ; a-d
- uadd16 r6, r8, r7 ; b+c
- usub16 r7, r8, r7 ; b-c
-
- ; use input buffer to store intermediate results
- str r6, [r0, #(4*2)] ; o5 | o4
- str r7, [r0, #(8*2)] ; o9 | o8
- str r10,[r0, #(12*2)] ; o13|o12
- str r9, [r0], #4 ; o1 | o0
-
- bcs loop1_dual
-
- sub r0, r0, #8 ; reset input/output
- str r0, [sp]
-
-loop2_dual
-
- ldr r6, [r0, #(4*2)] ; i5 | i4
- ldr r12,[r0, #(2*2)] ; i3 | i2
- ldr r14,[r0, #(6*2)] ; i7 | i6
- ldr r0, [r0, #(0*2)] ; i1 | i0
-
- smulbt r9, r5, r6 ; (ip[5] * cospi8sqrt2minus1) >> 16
- smulbt r7, r5, r0 ; (ip[1] * cospi8sqrt2minus1) >> 16
- smulwt r10, r4, r6 ; (ip[5] * sinpi8sqrt2) >> 16
- smulwt r8, r4, r0 ; (ip[1] * sinpi8sqrt2) >> 16
-
- pkhbt r11, r6, r0, lsl #16 ; i0 | i4
- pkhtb r7, r7, r9, asr #16 ; 1c | 5c
- pkhtb r0, r0, r6, asr #16 ; i1 | i5
- pkhbt r8, r10, r8, lsl #16 ; 1s | 5s = temp1
-
- uadd16 r0, r7, r0 ; 1c+1 | 5c+5 = temp2
- pkhbt r9, r14, r12, lsl #16 ; i2 | i6
- uadd16 r10, r11, r9 ; a
- usub16 r9, r11, r9 ; b
- pkhtb r6, r12, r14, asr #16 ; i3 | i7
-
- subs r5, r5, #1<<31 ; i--
-
- smulbt r7, r5, r6 ; (ip[3] * cospi8sqrt2minus1) >> 16
- smulwt r11, r4, r6 ; (ip[3] * sinpi8sqrt2) >> 16
- smulbb r12, r5, r6 ; (ip[7] * cospi8sqrt2minus1) >> 16
- smulwb r14, r4, r6 ; (ip[7] * sinpi8sqrt2) >> 16
-
- pkhtb r7, r7, r12, asr #16 ; 3c | 7c
- pkhbt r11, r14, r11, lsl #16 ; 3s | 7s = temp1
-
- uadd16 r6, r7, r6 ; 3c+3 | 7c+7 = temp2
- usub16 r12, r8, r6 ; c (o1 | o5)
- uadd16 r6, r11, r0 ; d (o3 | o7)
- uadd16 r7, r10, r6 ; a+d
-
- mov r8, #4 ; set up 4's
- orr r8, r8, #0x40000 ; 4|4
-
- usub16 r6, r10, r6 ; a-d
- uadd16 r6, r6, r8 ; a-d+4, 3|7
- uadd16 r7, r7, r8 ; a+d+4, 0|4
- uadd16 r10, r9, r12 ; b+c
- usub16 r0, r9, r12 ; b-c
- uadd16 r10, r10, r8 ; b+c+4, 1|5
- uadd16 r8, r0, r8 ; b-c+4, 2|6
-
- ldr lr, [sp, #40] ; dst stride
-
- ldrb r0, [r1] ; pred p0
- ldrb r11, [r1, #1] ; pred p1
- ldrb r12, [r1, #2] ; pred p2
-
- add r0, r0, r7, asr #19 ; p0 + o0
- add r11, r11, r10, asr #19 ; p1 + o1
- add r12, r12, r8, asr #19 ; p2 + o2
-
- usat r0, #8, r0 ; d0 = clip8(p0 + o0)
- usat r11, #8, r11 ; d1 = clip8(p1 + o1)
- usat r12, #8, r12 ; d2 = clip8(p2 + o2)
-
- add r0, r0, r11, lsl #8 ; |--|--|d1|d0|
-
- ldrb r11, [r1, #3] ; pred p3
-
- add r0, r0, r12, lsl #16 ; |--|d2|d1|d0|
-
- add r11, r11, r6, asr #19 ; p3 + o3
-
- sxth r7, r7 ;
- sxth r10, r10 ;
-
- usat r11, #8, r11 ; d3 = clip8(p3 + o3)
-
- sxth r8, r8 ;
- sxth r6, r6 ;
-
- add r0, r0, r11, lsl #24 ; |d3|d2|d1|d0|
-
- ldrb r12, [r1, r2]! ; pred p4
- str r0, [r3], lr
- ldrb r11, [r1, #1] ; pred p5
-
- add r12, r12, r7, asr #3 ; p4 + o4
- add r11, r11, r10, asr #3 ; p5 + o5
-
- usat r12, #8, r12 ; d4 = clip8(p4 + o4)
- usat r11, #8, r11 ; d5 = clip8(p5 + o5)
-
- ldrb r7, [r1, #2] ; pred p6
- ldrb r10, [r1, #3] ; pred p6
-
- add r12, r12, r11, lsl #8 ; |--|--|d5|d4|
-
- add r7, r7, r8, asr #3 ; p6 + o6
- add r10, r10, r6, asr #3 ; p7 + o7
-
- ldr r0, [sp] ; load input pointer
-
- usat r7, #8, r7 ; d6 = clip8(p6 + o6)
- usat r10, #8, r10 ; d7 = clip8(p7 + o7)
-
- add r12, r12, r7, lsl #16 ; |--|d6|d5|d4|
- add r12, r12, r10, lsl #24 ; |d7|d6|d5|d4|
-
- str r12, [r3], lr
- add r0, r0, #16
- add r1, r1, r2 ; pred + pitch
-
- bcs loop2_dual
-
- add sp, sp, #4 ; idct_output buffer
- ldmia sp!, {r4 - r11, pc}
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/intra4x4_predict_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/intra4x4_predict_v6.asm
deleted file mode 100644
index c5ec824..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/intra4x4_predict_v6.asm
+++ /dev/null
@@ -1,611 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_intra4x4_predict_armv6|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-
-;void vp8_intra4x4_predict_armv6(unsigned char *Above, unsigned char *yleft,
-; B_PREDICTION_MODE left_stride, int b_mode,
-; unsigned char *dst, int dst_stride,
-; unsigned char top_left)
-
-; r0: *Above
-; r1: *yleft
-; r2: left_stride
-; r3: b_mode
-; sp + #40: dst
-; sp + #44: dst_stride
-; sp + #48: top_left
-|vp8_intra4x4_predict_armv6| PROC
- push {r4-r12, lr}
-
- cmp r3, #10
- addlt pc, pc, r3, lsl #2 ; position independent switch
- pop {r4-r12, pc} ; default
- b b_dc_pred
- b b_tm_pred
- b b_ve_pred
- b b_he_pred
- b b_ld_pred
- b b_rd_pred
- b b_vr_pred
- b b_vl_pred
- b b_hd_pred
- b b_hu_pred
-
-b_dc_pred
- ; load values
- ldr r8, [r0] ; Above
- ldrb r4, [r1], r2 ; Left[0]
- mov r9, #0
- ldrb r5, [r1], r2 ; Left[1]
- ldrb r6, [r1], r2 ; Left[2]
- usad8 r12, r8, r9
- ldrb r7, [r1] ; Left[3]
-
- ; calculate dc
- add r4, r4, r5
- add r4, r4, r6
- add r4, r4, r7
- add r4, r4, r12
- add r4, r4, #4
- ldr r0, [sp, #44] ; dst_stride
- mov r12, r4, asr #3 ; (expected_dc + 4) >> 3
-
- add r12, r12, r12, lsl #8
- ldr r3, [sp, #40] ; dst
- add r12, r12, r12, lsl #16
-
- ; store values
- str r12, [r3], r0
- str r12, [r3], r0
- str r12, [r3], r0
- str r12, [r3]
-
- pop {r4-r12, pc}
-
-b_tm_pred
- ldr r8, [r0] ; Above
- ldrb r9, [sp, #48] ; top_left
- ldrb r4, [r1], r2 ; Left[0]
- ldrb r5, [r1], r2 ; Left[1]
- ldrb r6, [r1], r2 ; Left[2]
- ldrb r7, [r1] ; Left[3]
- ldr r0, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
-
- add r9, r9, r9, lsl #16 ; [tl|tl]
- uxtb16 r10, r8 ; a[2|0]
- uxtb16 r11, r8, ror #8 ; a[3|1]
- ssub16 r10, r10, r9 ; a[2|0] - [tl|tl]
- ssub16 r11, r11, r9 ; a[3|1] - [tl|tl]
-
- add r4, r4, r4, lsl #16 ; l[0|0]
- add r5, r5, r5, lsl #16 ; l[1|1]
- add r6, r6, r6, lsl #16 ; l[2|2]
- add r7, r7, r7, lsl #16 ; l[3|3]
-
- sadd16 r1, r4, r10 ; l[0|0] + a[2|0] - [tl|tl]
- sadd16 r2, r4, r11 ; l[0|0] + a[3|1] - [tl|tl]
- usat16 r1, #8, r1
- usat16 r2, #8, r2
-
- sadd16 r4, r5, r10 ; l[1|1] + a[2|0] - [tl|tl]
- sadd16 r5, r5, r11 ; l[1|1] + a[3|1] - [tl|tl]
-
- add r12, r1, r2, lsl #8 ; [3|2|1|0]
- str r12, [r3], r0
-
- usat16 r4, #8, r4
- usat16 r5, #8, r5
-
- sadd16 r1, r6, r10 ; l[2|2] + a[2|0] - [tl|tl]
- sadd16 r2, r6, r11 ; l[2|2] + a[3|1] - [tl|tl]
-
- add r12, r4, r5, lsl #8 ; [3|2|1|0]
- str r12, [r3], r0
-
- usat16 r1, #8, r1
- usat16 r2, #8, r2
-
- sadd16 r4, r7, r10 ; l[3|3] + a[2|0] - [tl|tl]
- sadd16 r5, r7, r11 ; l[3|3] + a[3|1] - [tl|tl]
-
- add r12, r1, r2, lsl #8 ; [3|2|1|0]
-
- usat16 r4, #8, r4
- usat16 r5, #8, r5
-
- str r12, [r3], r0
-
- add r12, r4, r5, lsl #8 ; [3|2|1|0]
- str r12, [r3]
-
- pop {r4-r12, pc}
-
-b_ve_pred
- ldr r8, [r0] ; a[3|2|1|0]
- ldr r11, c00FF00FF
- ldrb r9, [sp, #48] ; top_left
- ldrb r10, [r0, #4] ; a[4]
-
- ldr r0, c00020002
-
- uxtb16 r4, r8 ; a[2|0]
- uxtb16 r5, r8, ror #8 ; a[3|1]
- ldr r2, [sp, #44] ; dst_stride
- pkhbt r9, r9, r5, lsl #16 ; a[1|-1]
-
- add r9, r9, r4, lsl #1 ;[a[1]+2*a[2] | tl+2*a[0] ]
- uxtab16 r9, r9, r5 ;[a[1]+2*a[2]+a[3] | tl+2*a[0]+a[1] ]
- ldr r3, [sp, #40] ; dst
- uxtab16 r9, r9, r0 ;[a[1]+2*a[2]+a[3]+2| tl+2*a[0]+a[1]+2]
-
- add r0, r0, r10, lsl #16 ;[a[4]+2 | 2]
- add r0, r0, r4, asr #16 ;[a[4]+2 | a[2]+2]
- add r0, r0, r5, lsl #1 ;[a[4]+2*a[3]+2 | a[2]+2*a[1]+2]
- uadd16 r4, r4, r0 ;[a[4]+2*a[3]+a[2]+2|a[2]+2*a[1]+a[0]+2]
-
- and r9, r11, r9, asr #2
- and r4, r11, r4, asr #2
- add r9, r9, r4, lsl #8
-
- ; store values
- str r9, [r3], r2
- str r9, [r3], r2
- str r9, [r3], r2
- str r9, [r3]
-
- pop {r4-r12, pc}
-
-
-b_he_pred
- ldrb r4, [r1], r2 ; Left[0]
- ldrb r8, [sp, #48] ; top_left
- ldrb r5, [r1], r2 ; Left[1]
- ldrb r6, [r1], r2 ; Left[2]
- ldrb r7, [r1] ; Left[3]
-
- add r8, r8, r4 ; tl + l[0]
- add r9, r4, r5 ; l[0] + l[1]
- add r10, r5, r6 ; l[1] + l[2]
- add r11, r6, r7 ; l[2] + l[3]
-
- mov r0, #2<<14
-
- add r8, r8, r9 ; tl + 2*l[0] + l[1]
- add r4, r9, r10 ; l[0] + 2*l[1] + l[2]
- add r5, r10, r11 ; l[1] + 2*l[2] + l[3]
- add r6, r11, r7, lsl #1 ; l[2] + 2*l[3] + l[3]
-
-
- add r8, r0, r8, lsl #14 ; (tl + 2*l[0] + l[1])>>2 in top half
- add r9, r0, r4, lsl #14 ; (l[0] + 2*l[1] + l[2])>>2 in top half
- add r10,r0, r5, lsl #14 ; (l[1] + 2*l[2] + l[3])>>2 in top half
- add r11,r0, r6, lsl #14 ; (l[2] + 2*l[3] + l[3])>>2 in top half
-
- pkhtb r8, r8, r8, asr #16 ; l[-|0|-|0]
- pkhtb r9, r9, r9, asr #16 ; l[-|1|-|1]
- pkhtb r10, r10, r10, asr #16 ; l[-|2|-|2]
- pkhtb r11, r11, r11, asr #16 ; l[-|3|-|3]
-
- ldr r0, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
-
- add r8, r8, r8, lsl #8 ; l[0|0|0|0]
- add r9, r9, r9, lsl #8 ; l[1|1|1|1]
- add r10, r10, r10, lsl #8 ; l[2|2|2|2]
- add r11, r11, r11, lsl #8 ; l[3|3|3|3]
-
- ; store values
- str r8, [r3], r0
- str r9, [r3], r0
- str r10, [r3], r0
- str r11, [r3]
-
- pop {r4-r12, pc}
-
-b_ld_pred
- ldr r4, [r0] ; Above[0-3]
- ldr r12, c00020002
- ldr r5, [r0, #4] ; Above[4-7]
- ldr lr, c00FF00FF
-
- uxtb16 r6, r4 ; a[2|0]
- uxtb16 r7, r4, ror #8 ; a[3|1]
- uxtb16 r8, r5 ; a[6|4]
- uxtb16 r9, r5, ror #8 ; a[7|5]
- pkhtb r10, r6, r8 ; a[2|4]
- pkhtb r11, r7, r9 ; a[3|5]
-
- add r4, r6, r7, lsl #1 ; [a2+2*a3 | a0+2*a1]
- add r4, r4, r10, ror #16 ; [a2+2*a3+a4 | a0+2*a1+a2]
- uxtab16 r4, r4, r12 ; [a2+2*a3+a4+2 | a0+2*a1+a2+2]
-
- add r5, r7, r10, ror #15 ; [a3+2*a4 | a1+2*a2]
- add r5, r5, r11, ror #16 ; [a3+2*a4+a5 | a1+2*a2+a3]
- uxtab16 r5, r5, r12 ; [a3+2*a4+a5+2 | a1+2*a2+a3+2]
-
- pkhtb r7, r9, r8, asr #16
- add r6, r8, r9, lsl #1 ; [a6+2*a7 | a4+2*a5]
- uadd16 r6, r6, r7 ; [a6+2*a7+a7 | a4+2*a5+a6]
- uxtab16 r6, r6, r12 ; [a6+2*a7+a7+2 | a4+2*a5+a6+2]
-
- uxth r7, r9 ; [ a5]
- add r7, r7, r8, asr #15 ; [ a5+2*a6]
- add r7, r7, r9, asr #16 ; [ a5+2*a6+a7]
- uxtah r7, r7, r12 ; [ a5+2*a6+a7+2]
-
- ldr r0, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
-
- ; scale down
- and r4, lr, r4, asr #2
- and r5, lr, r5, asr #2
- and r6, lr, r6, asr #2
- mov r7, r7, asr #2
-
- add r8, r4, r5, lsl #8 ; [3|2|1|0]
- str r8, [r3], r0
-
- mov r9, r8, lsr #8
- add r9, r9, r6, lsl #24 ; [4|3|2|1]
- str r9, [r3], r0
-
- mov r10, r9, lsr #8
- add r10, r10, r7, lsl #24 ; [5|4|3|2]
- str r10, [r3], r0
-
- mov r6, r6, lsr #16
- mov r11, r10, lsr #8
- add r11, r11, r6, lsl #24 ; [6|5|4|3]
- str r11, [r3]
-
- pop {r4-r12, pc}
-
-b_rd_pred
- ldrb r7, [r1], r2 ; l[0] = pp[3]
- ldr lr, [r0] ; Above = pp[8|7|6|5]
- ldrb r8, [sp, #48] ; tl = pp[4]
- ldrb r6, [r1], r2 ; l[1] = pp[2]
- ldrb r5, [r1], r2 ; l[2] = pp[1]
- ldrb r4, [r1], r2 ; l[3] = pp[0]
-
-
- uxtb16 r9, lr ; p[7|5]
- uxtb16 r10, lr, ror #8 ; p[8|6]
- add r4, r4, r6, lsl #16 ; p[2|0]
- add r5, r5, r7, lsl #16 ; p[3|1]
- add r6, r6, r8, lsl #16 ; p[4|2]
- pkhbt r7, r7, r9, lsl #16 ; p[5|3]
- pkhbt r8, r8, r10, lsl #16 ; p[6|4]
-
- ldr r12, c00020002
- ldr lr, c00FF00FF
-
- add r4, r4, r5, lsl #1 ; [p2+2*p3 | p0+2*p1]
- add r4, r4, r6 ; [p2+2*p3+p4 | p0+2*p1+p2]
- uxtab16 r4, r4, r12 ; [p2+2*p3+p4+2 | p0+2*p1+p2+2]
-
- add r5, r5, r6, lsl #1 ; [p3+2*p4 | p1+2*p2]
- add r5, r5, r7 ; [p3+2*p4+p5 | p1+2*p2+p3]
- uxtab16 r5, r5, r12 ; [p3+2*p4+p5+2 | p1+2*p2+p3+2]
-
- add r6, r7, r8, lsl #1 ; [p5+2*p6 | p3+2*p4]
- add r6, r6, r9 ; [p5+2*p6+p7 | p3+2*p4+p5]
- uxtab16 r6, r6, r12 ; [p5+2*p6+p7+2 | p3+2*p4+p5+2]
-
- add r7, r8, r9, lsl #1 ; [p6+2*p7 | p4+2*p5]
- add r7, r7, r10 ; [p6+2*p7+p8 | p4+2*p5+p6]
- uxtab16 r7, r7, r12 ; [p6+2*p7+p8+2 | p4+2*p5+p6+2]
-
- ldr r0, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
-
- ; scale down
- and r7, lr, r7, asr #2
- and r6, lr, r6, asr #2
- and r5, lr, r5, asr #2
- and r4, lr, r4, asr #2
-
- add r8, r6, r7, lsl #8 ; [6|5|4|3]
- str r8, [r3], r0
-
- mov r9, r8, lsl #8 ; [5|4|3|-]
- uxtab r9, r9, r4, ror #16 ; [5|4|3|2]
- str r9, [r3], r0
-
- mov r10, r9, lsl #8 ; [4|3|2|-]
- uxtab r10, r10, r5 ; [4|3|2|1]
- str r10, [r3], r0
-
- mov r11, r10, lsl #8 ; [3|2|1|-]
- uxtab r11, r11, r4 ; [3|2|1|0]
- str r11, [r3]
-
- pop {r4-r12, pc}
-
-b_vr_pred
- ldrb r7, [r1], r2 ; l[0] = pp[3]
- ldr lr, [r0] ; Above = pp[8|7|6|5]
- ldrb r8, [sp, #48] ; tl = pp[4]
- ldrb r6, [r1], r2 ; l[1] = pp[2]
- ldrb r5, [r1], r2 ; l[2] = pp[1]
- ldrb r4, [r1] ; l[3] = pp[0]
-
- add r5, r5, r7, lsl #16 ; p[3|1]
- add r6, r6, r8, lsl #16 ; p[4|2]
- uxtb16 r9, lr ; p[7|5]
- uxtb16 r10, lr, ror #8 ; p[8|6]
- pkhbt r7, r7, r9, lsl #16 ; p[5|3]
- pkhbt r8, r8, r10, lsl #16 ; p[6|4]
-
- ldr r4, c00010001
- ldr r12, c00020002
- ldr lr, c00FF00FF
-
- add r5, r5, r6, lsl #1 ; [p3+2*p4 | p1+2*p2]
- add r5, r5, r7 ; [p3+2*p4+p5 | p1+2*p2+p3]
- uxtab16 r5, r5, r12 ; [p3+2*p4+p5+2 | p1+2*p2+p3+2]
-
- add r6, r6, r7, lsl #1 ; [p4+2*p5 | p2+2*p3]
- add r6, r6, r8 ; [p4+2*p5+p6 | p2+2*p3+p4]
- uxtab16 r6, r6, r12 ; [p4+2*p5+p6+2 | p2+2*p3+p4+2]
-
- uadd16 r11, r8, r9 ; [p6+p7 | p4+p5]
- uhadd16 r11, r11, r4 ; [(p6+p7+1)>>1 | (p4+p5+1)>>1]
- ; [F|E]
-
- add r7, r7, r8, lsl #1 ; [p5+2*p6 | p3+2*p4]
- add r7, r7, r9 ; [p5+2*p6+p7 | p3+2*p4+p5]
- uxtab16 r7, r7, r12 ; [p5+2*p6+p7+2 | p3+2*p4+p5+2]
-
- uadd16 r2, r9, r10 ; [p7+p8 | p5+p6]
- uhadd16 r2, r2, r4 ; [(p7+p8+1)>>1 | (p5+p6+1)>>1]
- ; [J|I]
-
- add r8, r8, r9, lsl #1 ; [p6+2*p7 | p4+2*p5]
- add r8, r8, r10 ; [p6+2*p7+p8 | p4+2*p5+p6]
- uxtab16 r8, r8, r12 ; [p6+2*p7+p8+2 | p4+2*p5+p6+2]
-
- ldr r0, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
-
- ; scale down
- and r5, lr, r5, asr #2 ; [B|A]
- and r6, lr, r6, asr #2 ; [D|C]
- and r7, lr, r7, asr #2 ; [H|G]
- and r8, lr, r8, asr #2 ; [L|K]
-
- add r12, r11, r2, lsl #8 ; [J|F|I|E]
- str r12, [r3], r0
-
- add r12, r7, r8, lsl #8 ; [L|H|K|G]
- str r12, [r3], r0
-
- pkhbt r2, r6, r2, lsl #16 ; [-|I|-|C]
- add r2, r2, r11, lsl #8 ; [F|I|E|C]
-
- pkhtb r12, r6, r5 ; [-|D|-|A]
- pkhtb r10, r7, r5, asr #16 ; [-|H|-|B]
- str r2, [r3], r0
- add r12, r12, r10, lsl #8 ; [H|D|B|A]
- str r12, [r3]
-
- pop {r4-r12, pc}
-
-b_vl_pred
- ldr r4, [r0] ; [3|2|1|0] = Above[0-3]
- ldr r12, c00020002
- ldr r5, [r0, #4] ; [7|6|5|4] = Above[4-7]
- ldr lr, c00FF00FF
- ldr r2, c00010001
-
- mov r0, r4, lsr #16 ; [-|-|3|2]
- add r0, r0, r5, lsl #16 ; [5|4|3|2]
- uxtb16 r6, r4 ; [2|0]
- uxtb16 r7, r4, ror #8 ; [3|1]
- uxtb16 r8, r0 ; [4|2]
- uxtb16 r9, r0, ror #8 ; [5|3]
- uxtb16 r10, r5 ; [6|4]
- uxtb16 r11, r5, ror #8 ; [7|5]
-
- uadd16 r4, r6, r7 ; [p2+p3 | p0+p1]
- uhadd16 r4, r4, r2 ; [(p2+p3+1)>>1 | (p0+p1+1)>>1]
- ; [B|A]
-
- add r5, r6, r7, lsl #1 ; [p2+2*p3 | p0+2*p1]
- add r5, r5, r8 ; [p2+2*p3+p4 | p0+2*p1+p2]
- uxtab16 r5, r5, r12 ; [p2+2*p3+p4+2 | p0+2*p1+p2+2]
-
- uadd16 r6, r7, r8 ; [p3+p4 | p1+p2]
- uhadd16 r6, r6, r2 ; [(p3+p4+1)>>1 | (p1+p2+1)>>1]
- ; [F|E]
-
- add r7, r7, r8, lsl #1 ; [p3+2*p4 | p1+2*p2]
- add r7, r7, r9 ; [p3+2*p4+p5 | p1+2*p2+p3]
- uxtab16 r7, r7, r12 ; [p3+2*p4+p5+2 | p1+2*p2+p3+2]
-
- add r8, r8, r9, lsl #1 ; [p4+2*p5 | p2+2*p3]
- add r8, r8, r10 ; [p4+2*p5+p6 | p2+2*p3+p4]
- uxtab16 r8, r8, r12 ; [p4+2*p5+p6+2 | p2+2*p3+p4+2]
-
- add r9, r9, r10, lsl #1 ; [p5+2*p6 | p3+2*p4]
- add r9, r9, r11 ; [p5+2*p6+p7 | p3+2*p4+p5]
- uxtab16 r9, r9, r12 ; [p5+2*p6+p7+2 | p3+2*p4+p5+2]
-
- ldr r0, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
-
- ; scale down
- and r5, lr, r5, asr #2 ; [D|C]
- and r7, lr, r7, asr #2 ; [H|G]
- and r8, lr, r8, asr #2 ; [I|D]
- and r9, lr, r9, asr #2 ; [J|H]
-
- add r10, r4, r6, lsl #8 ; [F|B|E|A]
- str r10, [r3], r0
-
- add r5, r5, r7, lsl #8 ; [H|C|G|D]
- str r5, [r3], r0
-
- pkhtb r12, r8, r4, asr #16 ; [-|I|-|B]
- pkhtb r10, r9, r8 ; [-|J|-|D]
-
- add r12, r6, r12, lsl #8 ; [I|F|B|E]
- str r12, [r3], r0
-
- add r10, r7, r10, lsl #8 ; [J|H|D|G]
- str r10, [r3]
-
- pop {r4-r12, pc}
-
-b_hd_pred
- ldrb r7, [r1], r2 ; l[0] = pp[3]
- ldr lr, [r0] ; Above = pp[8|7|6|5]
- ldrb r8, [sp, #48] ; tl = pp[4]
- ldrb r6, [r1], r2 ; l[1] = pp[2]
- ldrb r5, [r1], r2 ; l[2] = pp[1]
- ldrb r4, [r1] ; l[3] = pp[0]
-
- uxtb16 r9, lr ; p[7|5]
- uxtb16 r10, lr, ror #8 ; p[8|6]
-
- add r4, r4, r5, lsl #16 ; p[1|0]
- add r5, r5, r6, lsl #16 ; p[2|1]
- add r6, r6, r7, lsl #16 ; p[3|2]
- add r7, r7, r8, lsl #16 ; p[4|3]
-
- ldr r12, c00020002
- ldr lr, c00FF00FF
- ldr r2, c00010001
-
- pkhtb r8, r7, r9 ; p[4|5]
- pkhtb r1, r9, r10 ; p[7|6]
- pkhbt r10, r8, r10, lsl #16 ; p[6|5]
-
- uadd16 r11, r4, r5 ; [p1+p2 | p0+p1]
- uhadd16 r11, r11, r2 ; [(p1+p2+1)>>1 | (p0+p1+1)>>1]
- ; [B|A]
-
- add r4, r4, r5, lsl #1 ; [p1+2*p2 | p0+2*p1]
- add r4, r4, r6 ; [p1+2*p2+p3 | p0+2*p1+p2]
- uxtab16 r4, r4, r12 ; [p1+2*p2+p3+2 | p0+2*p1+p2+2]
-
- uadd16 r0, r6, r7 ; [p3+p4 | p2+p3]
- uhadd16 r0, r0, r2 ; [(p3+p4+1)>>1 | (p2+p3+1)>>1]
- ; [F|E]
-
- add r5, r6, r7, lsl #1 ; [p3+2*p4 | p2+2*p3]
- add r5, r5, r8, ror #16 ; [p3+2*p4+p5 | p2+2*p3+p4]
- uxtab16 r5, r5, r12 ; [p3+2*p4+p5+2 | p2+2*p3+p4+2]
-
- add r6, r12, r8, ror #16 ; [p5+2 | p4+2]
- add r6, r6, r10, lsl #1 ; [p5+2+2*p6 | p4+2+2*p5]
- uxtab16 r6, r6, r1 ; [p5+2+2*p6+p7 | p4+2+2*p5+p6]
-
- ; scale down
- and r4, lr, r4, asr #2 ; [D|C]
- and r5, lr, r5, asr #2 ; [H|G]
- and r6, lr, r6, asr #2 ; [J|I]
-
- ldr lr, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
-
- pkhtb r2, r0, r6 ; [-|F|-|I]
- pkhtb r12, r6, r5, asr #16 ; [-|J|-|H]
- add r12, r12, r2, lsl #8 ; [F|J|I|H]
- add r2, r0, r5, lsl #8 ; [H|F|G|E]
- mov r12, r12, ror #24 ; [J|I|H|F]
- str r12, [r3], lr
-
- mov r7, r11, asr #16 ; [-|-|-|B]
- str r2, [r3], lr
- add r7, r7, r0, lsl #16 ; [-|E|-|B]
- add r7, r7, r4, asr #8 ; [-|E|D|B]
- add r7, r7, r5, lsl #24 ; [G|E|D|B]
- str r7, [r3], lr
-
- add r5, r11, r4, lsl #8 ; [D|B|C|A]
- str r5, [r3]
-
- pop {r4-r12, pc}
-
-
-
-b_hu_pred
- ldrb r4, [r1], r2 ; Left[0]
- ldr r12, c00020002
- ldrb r5, [r1], r2 ; Left[1]
- ldr lr, c00FF00FF
- ldrb r6, [r1], r2 ; Left[2]
- ldr r2, c00010001
- ldrb r7, [r1] ; Left[3]
-
- add r4, r4, r5, lsl #16 ; [1|0]
- add r5, r5, r6, lsl #16 ; [2|1]
- add r9, r6, r7, lsl #16 ; [3|2]
-
- uadd16 r8, r4, r5 ; [p1+p2 | p0+p1]
- uhadd16 r8, r8, r2 ; [(p1+p2+1)>>1 | (p0+p1+1)>>1]
- ; [B|A]
-
- add r4, r4, r5, lsl #1 ; [p1+2*p2 | p0+2*p1]
- add r4, r4, r9 ; [p1+2*p2+p3 | p0+2*p1+p2]
- uxtab16 r4, r4, r12 ; [p1+2*p2+p3+2 | p0+2*p1+p2+2]
- ldr r2, [sp, #44] ; dst_stride
- ldr r3, [sp, #40] ; dst
- and r4, lr, r4, asr #2 ; [D|C]
-
- add r10, r6, r7 ; [p2+p3]
- add r11, r10, r7, lsl #1 ; [p2+3*p3]
- add r10, r10, #1
- add r11, r11, #2
- mov r10, r10, asr #1 ; [E]
- mov r11, r11, asr #2 ; [F]
-
- add r9, r7, r9, asr #8 ; [-|-|G|G]
- add r0, r8, r4, lsl #8 ; [D|B|C|A]
- add r7, r9, r9, lsl #16 ; [G|G|G|G]
-
- str r0, [r3], r2
-
- mov r1, r8, asr #16 ; [-|-|-|B]
- add r1, r1, r4, asr #8 ; [-|-|D|B]
- add r1, r1, r10, lsl #16 ; [-|E|D|B]
- add r1, r1, r11, lsl #24 ; [F|E|D|B]
- str r1, [r3], r2
-
- add r10, r11, lsl #8 ; [-|-|F|E]
- add r10, r10, r9, lsl #16 ; [G|G|F|E]
- str r10, [r3], r2
-
- str r7, [r3]
-
- pop {r4-r12, pc}
-
- ENDP
-
-; constants
-c00010001
- DCD 0x00010001
-c00020002
- DCD 0x00020002
-c00FF00FF
- DCD 0x00FF00FF
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/iwalsh_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/iwalsh_v6.asm
deleted file mode 100644
index 31ef09c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/iwalsh_v6.asm
+++ /dev/null
@@ -1,136 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp8_short_inv_walsh4x4_v6|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY ; name this block of code
-
-;short vp8_short_inv_walsh4x4_v6(short *input, short *mb_dqcoeff)
-|vp8_short_inv_walsh4x4_v6| PROC
-
- stmdb sp!, {r4 - r12, lr}
-
- ldr r2, [r0, #0] ; [1 | 0]
- ldr r3, [r0, #4] ; [3 | 2]
- ldr r4, [r0, #8] ; [5 | 4]
- ldr r5, [r0, #12] ; [7 | 6]
- ldr r6, [r0, #16] ; [9 | 8]
- ldr r7, [r0, #20] ; [11 | 10]
- ldr r8, [r0, #24] ; [13 | 12]
- ldr r9, [r0, #28] ; [15 | 14]
-
- qadd16 r10, r2, r8 ; a1 [1+13 | 0+12]
- qadd16 r11, r4, r6 ; b1 [5+9 | 4+8]
- qsub16 r12, r4, r6 ; c1 [5-9 | 4-8]
- qsub16 lr, r2, r8 ; d1 [1-13 | 0-12]
-
- qadd16 r2, r10, r11 ; a1 + b1 [1 | 0]
- qadd16 r4, r12, lr ; c1 + d1 [5 | 4]
- qsub16 r6, r10, r11 ; a1 - b1 [9 | 8]
- qsub16 r8, lr, r12 ; d1 - c1 [13 | 12]
-
- qadd16 r10, r3, r9 ; a1 [3+15 | 2+14]
- qadd16 r11, r5, r7 ; b1 [7+11 | 6+10]
- qsub16 r12, r5, r7 ; c1 [7-11 | 6-10]
- qsub16 lr, r3, r9 ; d1 [3-15 | 2-14]
-
- qadd16 r3, r10, r11 ; a1 + b1 [3 | 2]
- qadd16 r5, r12, lr ; c1 + d1 [7 | 6]
- qsub16 r7, r10, r11 ; a1 - b1 [11 | 10]
- qsub16 r9, lr, r12 ; d1 - c1 [15 | 14]
-
- ; first transform complete
-
- qsubaddx r10, r2, r3 ; [c1|a1] [1-2 | 0+3]
- qaddsubx r11, r2, r3 ; [b1|d1] [1+2 | 0-3]
- qsubaddx r12, r4, r5 ; [c1|a1] [5-6 | 4+7]
- qaddsubx lr, r4, r5 ; [b1|d1] [5+6 | 4-7]
-
- qaddsubx r2, r10, r11 ; [b2|c2] [c1+d1 | a1-b1]
- qaddsubx r3, r11, r10 ; [a2|d2] [b1+a1 | d1-c1]
- ldr r10, c0x00030003
- qaddsubx r4, r12, lr ; [b2|c2] [c1+d1 | a1-b1]
- qaddsubx r5, lr, r12 ; [a2|d2] [b1+a1 | d1-c1]
-
- qadd16 r2, r2, r10 ; [b2+3|c2+3]
- qadd16 r3, r3, r10 ; [a2+3|d2+3]
- qadd16 r4, r4, r10 ; [b2+3|c2+3]
- qadd16 r5, r5, r10 ; [a2+3|d2+3]
-
- asr r12, r3, #19 ; [0]
- strh r12, [r1], #32
- asr lr, r2, #19 ; [1]
- strh lr, [r1], #32
- sxth r2, r2
- sxth r3, r3
- asr r2, r2, #3 ; [2]
- strh r2, [r1], #32
- asr r3, r3, #3 ; [3]
- strh r3, [r1], #32
-
- asr r12, r5, #19 ; [4]
- strh r12, [r1], #32
- asr lr, r4, #19 ; [5]
- strh lr, [r1], #32
- sxth r4, r4
- sxth r5, r5
- asr r4, r4, #3 ; [6]
- strh r4, [r1], #32
- asr r5, r5, #3 ; [7]
- strh r5, [r1], #32
-
- qsubaddx r2, r6, r7 ; [c1|a1] [9-10 | 8+11]
- qaddsubx r3, r6, r7 ; [b1|d1] [9+10 | 8-11]
- qsubaddx r4, r8, r9 ; [c1|a1] [13-14 | 12+15]
- qaddsubx r5, r8, r9 ; [b1|d1] [13+14 | 12-15]
-
- qaddsubx r6, r2, r3 ; [b2|c2] [c1+d1 | a1-b1]
- qaddsubx r7, r3, r2 ; [a2|d2] [b1+a1 | d1-c1]
- qaddsubx r8, r4, r5 ; [b2|c2] [c1+d1 | a1-b1]
- qaddsubx r9, r5, r4 ; [a2|d2] [b1+a1 | d1-c1]
-
- qadd16 r6, r6, r10 ; [b2+3|c2+3]
- qadd16 r7, r7, r10 ; [a2+3|d2+3]
- qadd16 r8, r8, r10 ; [b2+3|c2+3]
- qadd16 r9, r9, r10 ; [a2+3|d2+3]
-
- asr r12, r7, #19 ; [8]
- strh r12, [r1], #32
- asr lr, r6, #19 ; [9]
- strh lr, [r1], #32
- sxth r6, r6
- sxth r7, r7
- asr r6, r6, #3 ; [10]
- strh r6, [r1], #32
- asr r7, r7, #3 ; [11]
- strh r7, [r1], #32
-
- asr r12, r9, #19 ; [12]
- strh r12, [r1], #32
- asr lr, r8, #19 ; [13]
- strh lr, [r1], #32
- sxth r8, r8
- sxth r9, r9
- asr r8, r8, #3 ; [14]
- strh r8, [r1], #32
- asr r9, r9, #3 ; [15]
- strh r9, [r1], #32
-
- ldmia sp!, {r4 - r12, pc}
- ENDP ; |vp8_short_inv_walsh4x4_v6|
-
-
-; Constant Pool
-c0x00030003 DCD 0x00030003
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/loopfilter_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/loopfilter_v6.asm
deleted file mode 100644
index 1cbbbcd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/loopfilter_v6.asm
+++ /dev/null
@@ -1,1282 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_loop_filter_horizontal_edge_armv6|
- EXPORT |vp8_mbloop_filter_horizontal_edge_armv6|
- EXPORT |vp8_loop_filter_vertical_edge_armv6|
- EXPORT |vp8_mbloop_filter_vertical_edge_armv6|
-
- AREA |.text|, CODE, READONLY ; name this block of code
-
- MACRO
- TRANSPOSE_MATRIX $a0, $a1, $a2, $a3, $b0, $b1, $b2, $b3
- ; input: $a0, $a1, $a2, $a3; output: $b0, $b1, $b2, $b3
- ; a0: 03 02 01 00
- ; a1: 13 12 11 10
- ; a2: 23 22 21 20
- ; a3: 33 32 31 30
- ; b3 b2 b1 b0
-
- uxtb16 $b1, $a1 ; xx 12 xx 10
- uxtb16 $b0, $a0 ; xx 02 xx 00
- uxtb16 $b3, $a3 ; xx 32 xx 30
- uxtb16 $b2, $a2 ; xx 22 xx 20
- orr $b1, $b0, $b1, lsl #8 ; 12 02 10 00
- orr $b3, $b2, $b3, lsl #8 ; 32 22 30 20
-
- uxtb16 $a1, $a1, ror #8 ; xx 13 xx 11
- uxtb16 $a3, $a3, ror #8 ; xx 33 xx 31
- uxtb16 $a0, $a0, ror #8 ; xx 03 xx 01
- uxtb16 $a2, $a2, ror #8 ; xx 23 xx 21
- orr $a0, $a0, $a1, lsl #8 ; 13 03 11 01
- orr $a2, $a2, $a3, lsl #8 ; 33 23 31 21
-
- pkhtb $b2, $b3, $b1, asr #16 ; 32 22 12 02 -- p1
- pkhbt $b0, $b1, $b3, lsl #16 ; 30 20 10 00 -- p3
-
- pkhtb $b3, $a2, $a0, asr #16 ; 33 23 13 03 -- p0
- pkhbt $b1, $a0, $a2, lsl #16 ; 31 21 11 01 -- p2
- MEND
-
-
-src RN r0
-pstep RN r1
-count RN r5
-
-;r0 unsigned char *src_ptr,
-;r1 int src_pixel_step,
-;r2 const char *blimit,
-;r3 const char *limit,
-;stack const char *thresh,
-;stack int count
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_horizontal_edge_armv6| PROC
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- stmdb sp!, {r4 - r11, lr}
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
- ldr count, [sp, #40] ; count for 8-in-parallel
- ldr r6, [sp, #36] ; load thresh address
- sub sp, sp, #16 ; create temp buffer
-
- ldr r9, [src], pstep ; p3
- ldrb r4, [r2] ; blimit
- ldr r10, [src], pstep ; p2
- ldrb r2, [r3] ; limit
- ldr r11, [src], pstep ; p1
- orr r4, r4, r4, lsl #8
- ldrb r3, [r6] ; thresh
- orr r2, r2, r2, lsl #8
- mov count, count, lsl #1 ; 4-in-parallel
- orr r4, r4, r4, lsl #16
- orr r3, r3, r3, lsl #8
- orr r2, r2, r2, lsl #16
- orr r3, r3, r3, lsl #16
-
-|Hnext8|
- ; vp8_filter_mask() function
- ; calculate breakout conditions
- ldr r12, [src], pstep ; p0
-
- uqsub8 r6, r9, r10 ; p3 - p2
- uqsub8 r7, r10, r9 ; p2 - p3
- uqsub8 r8, r10, r11 ; p2 - p1
- uqsub8 r10, r11, r10 ; p1 - p2
-
- orr r6, r6, r7 ; abs (p3-p2)
- orr r8, r8, r10 ; abs (p2-p1)
- uqsub8 lr, r6, r2 ; compare to limit. lr: vp8_filter_mask
- uqsub8 r8, r8, r2 ; compare to limit
- uqsub8 r6, r11, r12 ; p1 - p0
- orr lr, lr, r8
- uqsub8 r7, r12, r11 ; p0 - p1
- ldr r9, [src], pstep ; q0
- ldr r10, [src], pstep ; q1
- orr r6, r6, r7 ; abs (p1-p0)
- uqsub8 r7, r6, r2 ; compare to limit
- uqsub8 r8, r6, r3 ; compare to thresh -- save r8 for later
- orr lr, lr, r7
-
- uqsub8 r6, r11, r10 ; p1 - q1
- uqsub8 r7, r10, r11 ; q1 - p1
- uqsub8 r11, r12, r9 ; p0 - q0
- uqsub8 r12, r9, r12 ; q0 - p0
- orr r6, r6, r7 ; abs (p1-q1)
- ldr r7, c0x7F7F7F7F
- orr r12, r11, r12 ; abs (p0-q0)
- ldr r11, [src], pstep ; q2
- uqadd8 r12, r12, r12 ; abs (p0-q0) * 2
- and r6, r7, r6, lsr #1 ; abs (p1-q1) / 2
- uqsub8 r7, r9, r10 ; q0 - q1
- uqadd8 r12, r12, r6 ; abs (p0-q0)*2 + abs (p1-q1)/2
- uqsub8 r6, r10, r9 ; q1 - q0
- uqsub8 r12, r12, r4 ; compare to flimit
- uqsub8 r9, r11, r10 ; q2 - q1
-
- orr lr, lr, r12
-
- ldr r12, [src], pstep ; q3
- uqsub8 r10, r10, r11 ; q1 - q2
- orr r6, r7, r6 ; abs (q1-q0)
- orr r10, r9, r10 ; abs (q2-q1)
- uqsub8 r7, r6, r2 ; compare to limit
- uqsub8 r10, r10, r2 ; compare to limit
- uqsub8 r6, r6, r3 ; compare to thresh -- save r6 for later
- orr lr, lr, r7
- orr lr, lr, r10
-
- uqsub8 r10, r12, r11 ; q3 - q2
- uqsub8 r9, r11, r12 ; q2 - q3
-
- mvn r11, #0 ; r11 == -1
-
- orr r10, r10, r9 ; abs (q3-q2)
- uqsub8 r10, r10, r2 ; compare to limit
-
- mov r12, #0
- orr lr, lr, r10
- sub src, src, pstep, lsl #2
-
- usub8 lr, r12, lr ; use usub8 instead of ssub8
- sel lr, r11, r12 ; filter mask: lr
-
- cmp lr, #0
- beq hskip_filter ; skip filtering
-
- sub src, src, pstep, lsl #1 ; move src pointer down by 6 lines
-
- ;vp8_hevmask() function
- ;calculate high edge variance
- orr r10, r6, r8 ; calculate vp8_hevmask
-
- ldr r7, [src], pstep ; p1
-
- usub8 r10, r12, r10 ; use usub8 instead of ssub8
- sel r6, r12, r11 ; obtain vp8_hevmask: r6
-
- ;vp8_filter() function
- ldr r8, [src], pstep ; p0
- ldr r12, c0x80808080
- ldr r9, [src], pstep ; q0
- ldr r10, [src], pstep ; q1
-
- eor r7, r7, r12 ; p1 offset to convert to a signed value
- eor r8, r8, r12 ; p0 offset to convert to a signed value
- eor r9, r9, r12 ; q0 offset to convert to a signed value
- eor r10, r10, r12 ; q1 offset to convert to a signed value
-
- str r9, [sp] ; store qs0 temporarily
- str r8, [sp, #4] ; store ps0 temporarily
- str r10, [sp, #8] ; store qs1 temporarily
- str r7, [sp, #12] ; store ps1 temporarily
-
- qsub8 r7, r7, r10 ; vp8_signed_char_clamp(ps1-qs1)
- qsub8 r8, r9, r8 ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
-
- and r7, r7, r6 ; vp8_filter (r7) &= hev
-
- qadd8 r7, r7, r8
- ldr r9, c0x03030303 ; r9 = 3 --modified for vp8
-
- qadd8 r7, r7, r8
- ldr r10, c0x04040404
-
- qadd8 r7, r7, r8
- and r7, r7, lr ; vp8_filter &= mask;
-
- ;modify code for vp8 -- Filter1 = vp8_filter (r7)
- qadd8 r8 , r7 , r9 ; Filter2 (r8) = vp8_signed_char_clamp(vp8_filter+3)
- qadd8 r7 , r7 , r10 ; vp8_filter = vp8_signed_char_clamp(vp8_filter+4)
-
- mov r9, #0
- shadd8 r8 , r8 , r9 ; Filter2 >>= 3
- shadd8 r7 , r7 , r9 ; vp8_filter >>= 3
- shadd8 r8 , r8 , r9
- shadd8 r7 , r7 , r9
- shadd8 lr , r8 , r9 ; lr: Filter2
- shadd8 r7 , r7 , r9 ; r7: filter
-
- ;usub8 lr, r8, r10 ; s = (s==4)*-1
- ;sel lr, r11, r9
- ;usub8 r8, r10, r8
- ;sel r8, r11, r9
- ;and r8, r8, lr ; -1 for each element that equals 4
-
- ;calculate output
- ;qadd8 lr, r8, r7 ; u = vp8_signed_char_clamp(s + vp8_filter)
-
- ldr r8, [sp] ; load qs0
- ldr r9, [sp, #4] ; load ps0
-
- ldr r10, c0x01010101
-
- qsub8 r8 ,r8, r7 ; u = vp8_signed_char_clamp(qs0 - vp8_filter)
- qadd8 r9, r9, lr ; u = vp8_signed_char_clamp(ps0 + Filter2)
-
- ;end of modification for vp8
-
- mov lr, #0
- sadd8 r7, r7 , r10 ; vp8_filter += 1
- shadd8 r7, r7, lr ; vp8_filter >>= 1
-
- ldr r11, [sp, #12] ; load ps1
- ldr r10, [sp, #8] ; load qs1
-
- bic r7, r7, r6 ; vp8_filter &= ~hev
- sub src, src, pstep, lsl #2
-
- qadd8 r11, r11, r7 ; u = vp8_signed_char_clamp(ps1 + vp8_filter)
- qsub8 r10, r10,r7 ; u = vp8_signed_char_clamp(qs1 - vp8_filter)
-
- eor r11, r11, r12 ; *op1 = u^0x80
- str r11, [src], pstep ; store op1
- eor r9, r9, r12 ; *op0 = u^0x80
- str r9, [src], pstep ; store op0 result
- eor r8, r8, r12 ; *oq0 = u^0x80
- str r8, [src], pstep ; store oq0 result
- eor r10, r10, r12 ; *oq1 = u^0x80
- str r10, [src], pstep ; store oq1
-
- sub src, src, pstep, lsl #1
-
-|hskip_filter|
- add src, src, #4
- sub src, src, pstep, lsl #2
-
- subs count, count, #1
-
- ldrne r9, [src], pstep ; p3
- ldrne r10, [src], pstep ; p2
- ldrne r11, [src], pstep ; p1
-
- bne Hnext8
-
- add sp, sp, #16
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_loop_filter_horizontal_edge_armv6|
-
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_mbloop_filter_horizontal_edge_armv6| PROC
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- stmdb sp!, {r4 - r11, lr}
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
- ldr count, [sp, #40] ; count for 8-in-parallel
- ldr r6, [sp, #36] ; load thresh address
- sub sp, sp, #16 ; create temp buffer
-
- ldr r9, [src], pstep ; p3
- ldrb r4, [r2] ; blimit
- ldr r10, [src], pstep ; p2
- ldrb r2, [r3] ; limit
- ldr r11, [src], pstep ; p1
- orr r4, r4, r4, lsl #8
- ldrb r3, [r6] ; thresh
- orr r2, r2, r2, lsl #8
- mov count, count, lsl #1 ; 4-in-parallel
- orr r4, r4, r4, lsl #16
- orr r3, r3, r3, lsl #8
- orr r2, r2, r2, lsl #16
- orr r3, r3, r3, lsl #16
-
-|MBHnext8|
-
- ; vp8_filter_mask() function
- ; calculate breakout conditions
- ldr r12, [src], pstep ; p0
-
- uqsub8 r6, r9, r10 ; p3 - p2
- uqsub8 r7, r10, r9 ; p2 - p3
- uqsub8 r8, r10, r11 ; p2 - p1
- uqsub8 r10, r11, r10 ; p1 - p2
-
- orr r6, r6, r7 ; abs (p3-p2)
- orr r8, r8, r10 ; abs (p2-p1)
- uqsub8 lr, r6, r2 ; compare to limit. lr: vp8_filter_mask
- uqsub8 r8, r8, r2 ; compare to limit
-
- uqsub8 r6, r11, r12 ; p1 - p0
- orr lr, lr, r8
- uqsub8 r7, r12, r11 ; p0 - p1
- ldr r9, [src], pstep ; q0
- ldr r10, [src], pstep ; q1
- orr r6, r6, r7 ; abs (p1-p0)
- uqsub8 r7, r6, r2 ; compare to limit
- uqsub8 r8, r6, r3 ; compare to thresh -- save r8 for later
- orr lr, lr, r7
-
- uqsub8 r6, r11, r10 ; p1 - q1
- uqsub8 r7, r10, r11 ; q1 - p1
- uqsub8 r11, r12, r9 ; p0 - q0
- uqsub8 r12, r9, r12 ; q0 - p0
- orr r6, r6, r7 ; abs (p1-q1)
- ldr r7, c0x7F7F7F7F
- orr r12, r11, r12 ; abs (p0-q0)
- ldr r11, [src], pstep ; q2
- uqadd8 r12, r12, r12 ; abs (p0-q0) * 2
- and r6, r7, r6, lsr #1 ; abs (p1-q1) / 2
- uqsub8 r7, r9, r10 ; q0 - q1
- uqadd8 r12, r12, r6 ; abs (p0-q0)*2 + abs (p1-q1)/2
- uqsub8 r6, r10, r9 ; q1 - q0
- uqsub8 r12, r12, r4 ; compare to flimit
- uqsub8 r9, r11, r10 ; q2 - q1
-
- orr lr, lr, r12
-
- ldr r12, [src], pstep ; q3
-
- uqsub8 r10, r10, r11 ; q1 - q2
- orr r6, r7, r6 ; abs (q1-q0)
- orr r10, r9, r10 ; abs (q2-q1)
- uqsub8 r7, r6, r2 ; compare to limit
- uqsub8 r10, r10, r2 ; compare to limit
- uqsub8 r6, r6, r3 ; compare to thresh -- save r6 for later
- orr lr, lr, r7
- orr lr, lr, r10
-
- uqsub8 r10, r12, r11 ; q3 - q2
- uqsub8 r9, r11, r12 ; q2 - q3
-
- mvn r11, #0 ; r11 == -1
-
- orr r10, r10, r9 ; abs (q3-q2)
- uqsub8 r10, r10, r2 ; compare to limit
-
- mov r12, #0
-
- orr lr, lr, r10
-
- usub8 lr, r12, lr ; use usub8 instead of ssub8
- sel lr, r11, r12 ; filter mask: lr
-
- cmp lr, #0
- beq mbhskip_filter ; skip filtering
-
- ;vp8_hevmask() function
- ;calculate high edge variance
- sub src, src, pstep, lsl #2 ; move src pointer down by 6 lines
- sub src, src, pstep, lsl #1
-
- orr r10, r6, r8
- ldr r7, [src], pstep ; p1
-
- usub8 r10, r12, r10
- sel r6, r12, r11 ; hev mask: r6
-
- ;vp8_mbfilter() function
- ;p2, q2 are only needed at the end. Don't need to load them in now.
- ldr r8, [src], pstep ; p0
- ldr r12, c0x80808080
- ldr r9, [src], pstep ; q0
- ldr r10, [src] ; q1
-
- eor r7, r7, r12 ; ps1
- eor r8, r8, r12 ; ps0
- eor r9, r9, r12 ; qs0
- eor r10, r10, r12 ; qs1
-
- qsub8 r12, r9, r8 ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
- str r7, [sp, #12] ; store ps1 temporarily
- qsub8 r7, r7, r10 ; vp8_signed_char_clamp(ps1-qs1)
- str r10, [sp, #8] ; store qs1 temporarily
- qadd8 r7, r7, r12
- str r9, [sp] ; store qs0 temporarily
- qadd8 r7, r7, r12
- str r8, [sp, #4] ; store ps0 temporarily
- qadd8 r7, r7, r12 ; vp8_filter: r7
-
- ldr r10, c0x03030303 ; r10 = 3 --modified for vp8
- ldr r9, c0x04040404
-
- and r7, r7, lr ; vp8_filter &= mask (lr is free)
-
- mov r12, r7 ; Filter2: r12
- and r12, r12, r6 ; Filter2 &= hev
-
- ;modify code for vp8
- ;save bottom 3 bits so that we round one side +4 and the other +3
- qadd8 r8 , r12 , r9 ; Filter1 (r8) = vp8_signed_char_clamp(Filter2+4)
- qadd8 r12 , r12 , r10 ; Filter2 (r12) = vp8_signed_char_clamp(Filter2+3)
-
- mov r10, #0
- shadd8 r8 , r8 , r10 ; Filter1 >>= 3
- shadd8 r12 , r12 , r10 ; Filter2 >>= 3
- shadd8 r8 , r8 , r10
- shadd8 r12 , r12 , r10
- shadd8 r8 , r8 , r10 ; r8: Filter1
- shadd8 r12 , r12 , r10 ; r12: Filter2
-
- ldr r9, [sp] ; load qs0
- ldr r11, [sp, #4] ; load ps0
-
- qsub8 r9 , r9, r8 ; qs0 = vp8_signed_char_clamp(qs0 - Filter1)
- qadd8 r11, r11, r12 ; ps0 = vp8_signed_char_clamp(ps0 + Filter2)
-
- ;save bottom 3 bits so that we round one side +4 and the other +3
- ;and r8, r12, r10 ; s = Filter2 & 7 (s: r8)
- ;qadd8 r12 , r12 , r9 ; Filter2 = vp8_signed_char_clamp(Filter2+4)
- ;mov r10, #0
- ;shadd8 r12 , r12 , r10 ; Filter2 >>= 3
- ;usub8 lr, r8, r9 ; s = (s==4)*-1
- ;sel lr, r11, r10
- ;shadd8 r12 , r12 , r10
- ;usub8 r8, r9, r8
- ;sel r8, r11, r10
- ;ldr r9, [sp] ; load qs0
- ;ldr r11, [sp, #4] ; load ps0
- ;shadd8 r12 , r12 , r10
- ;and r8, r8, lr ; -1 for each element that equals 4
- ;qadd8 r10, r8, r12 ; u = vp8_signed_char_clamp(s + Filter2)
- ;qsub8 r9 , r9, r12 ; qs0 = vp8_signed_char_clamp(qs0 - Filter2)
- ;qadd8 r11, r11, r10 ; ps0 = vp8_signed_char_clamp(ps0 + u)
-
- ;end of modification for vp8
-
- bic r12, r7, r6 ; vp8_filter &= ~hev ( r6 is free)
- ;mov r12, r7
-
- ;roughly 3/7th difference across boundary
- mov lr, #0x1b ; 27
- mov r7, #0x3f ; 63
-
- sxtb16 r6, r12
- sxtb16 r10, r12, ror #8
- smlabb r8, r6, lr, r7
- smlatb r6, r6, lr, r7
- smlabb r7, r10, lr, r7
- smultb r10, r10, lr
- ssat r8, #8, r8, asr #7
- ssat r6, #8, r6, asr #7
- add r10, r10, #63
- ssat r7, #8, r7, asr #7
- ssat r10, #8, r10, asr #7
-
- ldr lr, c0x80808080
-
- pkhbt r6, r8, r6, lsl #16
- pkhbt r10, r7, r10, lsl #16
- uxtb16 r6, r6
- uxtb16 r10, r10
-
- sub src, src, pstep
-
- orr r10, r6, r10, lsl #8 ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
-
- qsub8 r8, r9, r10 ; s = vp8_signed_char_clamp(qs0 - u)
- qadd8 r10, r11, r10 ; s = vp8_signed_char_clamp(ps0 + u)
- eor r8, r8, lr ; *oq0 = s^0x80
- str r8, [src] ; store *oq0
- sub src, src, pstep
- eor r10, r10, lr ; *op0 = s^0x80
- str r10, [src] ; store *op0
-
- ;roughly 2/7th difference across boundary
- mov lr, #0x12 ; 18
- mov r7, #0x3f ; 63
-
- sxtb16 r6, r12
- sxtb16 r10, r12, ror #8
- smlabb r8, r6, lr, r7
- smlatb r6, r6, lr, r7
- smlabb r9, r10, lr, r7
- smlatb r10, r10, lr, r7
- ssat r8, #8, r8, asr #7
- ssat r6, #8, r6, asr #7
- ssat r9, #8, r9, asr #7
- ssat r10, #8, r10, asr #7
-
- ldr lr, c0x80808080
-
- pkhbt r6, r8, r6, lsl #16
- pkhbt r10, r9, r10, lsl #16
-
- ldr r9, [sp, #8] ; load qs1
- ldr r11, [sp, #12] ; load ps1
-
- uxtb16 r6, r6
- uxtb16 r10, r10
-
- sub src, src, pstep
-
- orr r10, r6, r10, lsl #8 ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7)
-
- qadd8 r11, r11, r10 ; s = vp8_signed_char_clamp(ps1 + u)
- qsub8 r8, r9, r10 ; s = vp8_signed_char_clamp(qs1 - u)
- eor r11, r11, lr ; *op1 = s^0x80
- str r11, [src], pstep ; store *op1
- eor r8, r8, lr ; *oq1 = s^0x80
- add src, src, pstep, lsl #1
-
- mov r7, #0x3f ; 63
-
- str r8, [src], pstep ; store *oq1
-
- ;roughly 1/7th difference across boundary
- mov lr, #0x9 ; 9
- ldr r9, [src] ; load q2
-
- sxtb16 r6, r12
- sxtb16 r10, r12, ror #8
- smlabb r8, r6, lr, r7
- smlatb r6, r6, lr, r7
- smlabb r12, r10, lr, r7
- smlatb r10, r10, lr, r7
- ssat r8, #8, r8, asr #7
- ssat r6, #8, r6, asr #7
- ssat r12, #8, r12, asr #7
- ssat r10, #8, r10, asr #7
-
- sub src, src, pstep, lsl #2
-
- pkhbt r6, r8, r6, lsl #16
- pkhbt r10, r12, r10, lsl #16
-
- sub src, src, pstep
- ldr lr, c0x80808080
-
- ldr r11, [src] ; load p2
-
- uxtb16 r6, r6
- uxtb16 r10, r10
-
- eor r9, r9, lr
- eor r11, r11, lr
-
- orr r10, r6, r10, lsl #8 ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7)
-
- qadd8 r8, r11, r10 ; s = vp8_signed_char_clamp(ps2 + u)
- qsub8 r10, r9, r10 ; s = vp8_signed_char_clamp(qs2 - u)
- eor r8, r8, lr ; *op2 = s^0x80
- str r8, [src], pstep, lsl #2 ; store *op2
- add src, src, pstep
- eor r10, r10, lr ; *oq2 = s^0x80
- str r10, [src], pstep, lsl #1 ; store *oq2
-
-|mbhskip_filter|
- add src, src, #4
- sub src, src, pstep, lsl #3
- subs count, count, #1
-
- ldrne r9, [src], pstep ; p3
- ldrne r10, [src], pstep ; p2
- ldrne r11, [src], pstep ; p1
-
- bne MBHnext8
-
- add sp, sp, #16
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_mbloop_filter_horizontal_edge_armv6|
-
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_vertical_edge_armv6| PROC
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- stmdb sp!, {r4 - r11, lr}
-
- sub src, src, #4 ; move src pointer down by 4
- ldr count, [sp, #40] ; count for 8-in-parallel
- ldr r12, [sp, #36] ; load thresh address
- sub sp, sp, #16 ; create temp buffer
-
- ldr r6, [src], pstep ; load source data
- ldrb r4, [r2] ; blimit
- ldr r7, [src], pstep
- ldrb r2, [r3] ; limit
- ldr r8, [src], pstep
- orr r4, r4, r4, lsl #8
- ldrb r3, [r12] ; thresh
- orr r2, r2, r2, lsl #8
- ldr lr, [src], pstep
- mov count, count, lsl #1 ; 4-in-parallel
- orr r4, r4, r4, lsl #16
- orr r3, r3, r3, lsl #8
- orr r2, r2, r2, lsl #16
- orr r3, r3, r3, lsl #16
-
-|Vnext8|
-
- ; vp8_filter_mask() function
- ; calculate breakout conditions
- ; transpose the source data for 4-in-parallel operation
- TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
-
- uqsub8 r7, r9, r10 ; p3 - p2
- uqsub8 r8, r10, r9 ; p2 - p3
- uqsub8 r9, r10, r11 ; p2 - p1
- uqsub8 r10, r11, r10 ; p1 - p2
- orr r7, r7, r8 ; abs (p3-p2)
- orr r10, r9, r10 ; abs (p2-p1)
- uqsub8 lr, r7, r2 ; compare to limit. lr: vp8_filter_mask
- uqsub8 r10, r10, r2 ; compare to limit
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
-
- orr lr, lr, r10
-
- uqsub8 r6, r11, r12 ; p1 - p0
- uqsub8 r7, r12, r11 ; p0 - p1
- add src, src, #4 ; move src pointer up by 4
- orr r6, r6, r7 ; abs (p1-p0)
- str r11, [sp, #12] ; save p1
- uqsub8 r10, r6, r2 ; compare to limit
- uqsub8 r11, r6, r3 ; compare to thresh
- orr lr, lr, r10
-
- ; transpose uses 8 regs(r6 - r12 and lr). Need to save reg value now
- ; transpose the source data for 4-in-parallel operation
- ldr r6, [src], pstep ; load source data
- str r11, [sp] ; push r11 to stack
- ldr r7, [src], pstep
- str r12, [sp, #4] ; save current reg before load q0 - q3 data
- ldr r8, [src], pstep
- str lr, [sp, #8]
- ldr lr, [src], pstep
-
- TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
-
- ldr lr, [sp, #8] ; load back (f)limit accumulator
-
- uqsub8 r6, r12, r11 ; q3 - q2
- uqsub8 r7, r11, r12 ; q2 - q3
- uqsub8 r12, r11, r10 ; q2 - q1
- uqsub8 r11, r10, r11 ; q1 - q2
- orr r6, r6, r7 ; abs (q3-q2)
- orr r7, r12, r11 ; abs (q2-q1)
- uqsub8 r6, r6, r2 ; compare to limit
- uqsub8 r7, r7, r2 ; compare to limit
- ldr r11, [sp, #4] ; load back p0
- ldr r12, [sp, #12] ; load back p1
- orr lr, lr, r6
- orr lr, lr, r7
-
- uqsub8 r6, r11, r9 ; p0 - q0
- uqsub8 r7, r9, r11 ; q0 - p0
- uqsub8 r8, r12, r10 ; p1 - q1
- uqsub8 r11, r10, r12 ; q1 - p1
- orr r6, r6, r7 ; abs (p0-q0)
- ldr r7, c0x7F7F7F7F
- orr r8, r8, r11 ; abs (p1-q1)
- uqadd8 r6, r6, r6 ; abs (p0-q0) * 2
- and r8, r7, r8, lsr #1 ; abs (p1-q1) / 2
- uqsub8 r11, r10, r9 ; q1 - q0
- uqadd8 r6, r8, r6 ; abs (p0-q0)*2 + abs (p1-q1)/2
- uqsub8 r12, r9, r10 ; q0 - q1
- uqsub8 r6, r6, r4 ; compare to flimit
-
- orr r9, r11, r12 ; abs (q1-q0)
- uqsub8 r8, r9, r2 ; compare to limit
- uqsub8 r10, r9, r3 ; compare to thresh
- orr lr, lr, r6
- orr lr, lr, r8
-
- mvn r11, #0 ; r11 == -1
- mov r12, #0
-
- usub8 lr, r12, lr
- ldr r9, [sp] ; load the compared result
- sel lr, r11, r12 ; filter mask: lr
-
- cmp lr, #0
- beq vskip_filter ; skip filtering
-
- ;vp8_hevmask() function
- ;calculate high edge variance
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
-
- orr r9, r9, r10
-
- ldrh r7, [src, #-2]
- ldrh r8, [src], pstep
-
- usub8 r9, r12, r9
- sel r6, r12, r11 ; hev mask: r6
-
- ;vp8_filter() function
- ; load soure data to r6, r11, r12, lr
- ldrh r9, [src, #-2]
- ldrh r10, [src], pstep
-
- pkhbt r12, r7, r8, lsl #16
-
- ldrh r7, [src, #-2]
- ldrh r8, [src], pstep
-
- pkhbt r11, r9, r10, lsl #16
-
- ldrh r9, [src, #-2]
- ldrh r10, [src], pstep
-
- ; Transpose needs 8 regs(r6 - r12, and lr). Save r6 and lr first
- str r6, [sp]
- str lr, [sp, #4]
-
- pkhbt r6, r7, r8, lsl #16
- pkhbt lr, r9, r10, lsl #16
-
- ;transpose r12, r11, r6, lr to r7, r8, r9, r10
- TRANSPOSE_MATRIX r12, r11, r6, lr, r7, r8, r9, r10
-
- ;load back hev_mask r6 and filter_mask lr
- ldr r12, c0x80808080
- ldr r6, [sp]
- ldr lr, [sp, #4]
-
- eor r7, r7, r12 ; p1 offset to convert to a signed value
- eor r8, r8, r12 ; p0 offset to convert to a signed value
- eor r9, r9, r12 ; q0 offset to convert to a signed value
- eor r10, r10, r12 ; q1 offset to convert to a signed value
-
- str r9, [sp] ; store qs0 temporarily
- str r8, [sp, #4] ; store ps0 temporarily
- str r10, [sp, #8] ; store qs1 temporarily
- str r7, [sp, #12] ; store ps1 temporarily
-
- qsub8 r7, r7, r10 ; vp8_signed_char_clamp(ps1-qs1)
- qsub8 r8, r9, r8 ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
-
- and r7, r7, r6 ; vp8_filter (r7) &= hev (r7 : filter)
-
- qadd8 r7, r7, r8
- ldr r9, c0x03030303 ; r9 = 3 --modified for vp8
-
- qadd8 r7, r7, r8
- ldr r10, c0x04040404
-
- qadd8 r7, r7, r8
- ;mvn r11, #0 ; r11 == -1
-
- and r7, r7, lr ; vp8_filter &= mask
-
- ;modify code for vp8 -- Filter1 = vp8_filter (r7)
- qadd8 r8 , r7 , r9 ; Filter2 (r8) = vp8_signed_char_clamp(vp8_filter+3)
- qadd8 r7 , r7 , r10 ; vp8_filter = vp8_signed_char_clamp(vp8_filter+4)
-
- mov r9, #0
- shadd8 r8 , r8 , r9 ; Filter2 >>= 3
- shadd8 r7 , r7 , r9 ; vp8_filter >>= 3
- shadd8 r8 , r8 , r9
- shadd8 r7 , r7 , r9
- shadd8 lr , r8 , r9 ; lr: filter2
- shadd8 r7 , r7 , r9 ; r7: filter
-
- ;usub8 lr, r8, r10 ; s = (s==4)*-1
- ;sel lr, r11, r9
- ;usub8 r8, r10, r8
- ;sel r8, r11, r9
- ;and r8, r8, lr ; -1 for each element that equals 4 -- r8: s
-
- ;calculate output
- ;qadd8 lr, r8, r7 ; u = vp8_signed_char_clamp(s + vp8_filter)
-
- ldr r8, [sp] ; load qs0
- ldr r9, [sp, #4] ; load ps0
-
- ldr r10, c0x01010101
-
- qsub8 r8, r8, r7 ; u = vp8_signed_char_clamp(qs0 - vp8_filter)
- qadd8 r9, r9, lr ; u = vp8_signed_char_clamp(ps0 + Filter2)
- ;end of modification for vp8
-
- eor r8, r8, r12
- eor r9, r9, r12
-
- mov lr, #0
-
- sadd8 r7, r7, r10
- shadd8 r7, r7, lr
-
- ldr r10, [sp, #8] ; load qs1
- ldr r11, [sp, #12] ; load ps1
-
- bic r7, r7, r6 ; r7: vp8_filter
-
- qsub8 r10 , r10, r7 ; u = vp8_signed_char_clamp(qs1 - vp8_filter)
- qadd8 r11, r11, r7 ; u = vp8_signed_char_clamp(ps1 + vp8_filter)
- eor r10, r10, r12
- eor r11, r11, r12
-
- sub src, src, pstep, lsl #2
-
- ;we can use TRANSPOSE_MATRIX macro to transpose output - input: q1, q0, p0, p1
- ;output is b0, b1, b2, b3
- ;b0: 03 02 01 00
- ;b1: 13 12 11 10
- ;b2: 23 22 21 20
- ;b3: 33 32 31 30
- ; p1 p0 q0 q1
- ; (a3 a2 a1 a0)
- TRANSPOSE_MATRIX r11, r9, r8, r10, r6, r7, r12, lr
-
- strh r6, [src, #-2] ; store the result
- mov r6, r6, lsr #16
- strh r6, [src], pstep
-
- strh r7, [src, #-2]
- mov r7, r7, lsr #16
- strh r7, [src], pstep
-
- strh r12, [src, #-2]
- mov r12, r12, lsr #16
- strh r12, [src], pstep
-
- strh lr, [src, #-2]
- mov lr, lr, lsr #16
- strh lr, [src], pstep
-
-|vskip_filter|
- sub src, src, #4
- subs count, count, #1
-
- ldrne r6, [src], pstep ; load source data
- ldrne r7, [src], pstep
- ldrne r8, [src], pstep
- ldrne lr, [src], pstep
-
- bne Vnext8
-
- add sp, sp, #16
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_loop_filter_vertical_edge_armv6|
-
-
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_mbloop_filter_vertical_edge_armv6| PROC
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- stmdb sp!, {r4 - r11, lr}
-
- sub src, src, #4 ; move src pointer down by 4
- ldr count, [sp, #40] ; count for 8-in-parallel
- ldr r12, [sp, #36] ; load thresh address
- pld [src, #23] ; preload for next block
- sub sp, sp, #16 ; create temp buffer
-
- ldr r6, [src], pstep ; load source data
- ldrb r4, [r2] ; blimit
- pld [src, #23]
- ldr r7, [src], pstep
- ldrb r2, [r3] ; limit
- pld [src, #23]
- ldr r8, [src], pstep
- orr r4, r4, r4, lsl #8
- ldrb r3, [r12] ; thresh
- orr r2, r2, r2, lsl #8
- pld [src, #23]
- ldr lr, [src], pstep
- mov count, count, lsl #1 ; 4-in-parallel
- orr r4, r4, r4, lsl #16
- orr r3, r3, r3, lsl #8
- orr r2, r2, r2, lsl #16
- orr r3, r3, r3, lsl #16
-
-|MBVnext8|
- ; vp8_filter_mask() function
- ; calculate breakout conditions
- ; transpose the source data for 4-in-parallel operation
- TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
-
- uqsub8 r7, r9, r10 ; p3 - p2
- uqsub8 r8, r10, r9 ; p2 - p3
- uqsub8 r9, r10, r11 ; p2 - p1
- uqsub8 r10, r11, r10 ; p1 - p2
- orr r7, r7, r8 ; abs (p3-p2)
- orr r10, r9, r10 ; abs (p2-p1)
- uqsub8 lr, r7, r2 ; compare to limit. lr: vp8_filter_mask
- uqsub8 r10, r10, r2 ; compare to limit
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
-
- orr lr, lr, r10
-
- uqsub8 r6, r11, r12 ; p1 - p0
- uqsub8 r7, r12, r11 ; p0 - p1
- add src, src, #4 ; move src pointer up by 4
- orr r6, r6, r7 ; abs (p1-p0)
- str r11, [sp, #12] ; save p1
- uqsub8 r10, r6, r2 ; compare to limit
- uqsub8 r11, r6, r3 ; compare to thresh
- orr lr, lr, r10
-
- ; transpose uses 8 regs(r6 - r12 and lr). Need to save reg value now
- ; transpose the source data for 4-in-parallel operation
- ldr r6, [src], pstep ; load source data
- str r11, [sp] ; push r11 to stack
- ldr r7, [src], pstep
- str r12, [sp, #4] ; save current reg before load q0 - q3 data
- ldr r8, [src], pstep
- str lr, [sp, #8]
- ldr lr, [src], pstep
-
-
- TRANSPOSE_MATRIX r6, r7, r8, lr, r9, r10, r11, r12
-
- ldr lr, [sp, #8] ; load back (f)limit accumulator
-
- uqsub8 r6, r12, r11 ; q3 - q2
- uqsub8 r7, r11, r12 ; q2 - q3
- uqsub8 r12, r11, r10 ; q2 - q1
- uqsub8 r11, r10, r11 ; q1 - q2
- orr r6, r6, r7 ; abs (q3-q2)
- orr r7, r12, r11 ; abs (q2-q1)
- uqsub8 r6, r6, r2 ; compare to limit
- uqsub8 r7, r7, r2 ; compare to limit
- ldr r11, [sp, #4] ; load back p0
- ldr r12, [sp, #12] ; load back p1
- orr lr, lr, r6
- orr lr, lr, r7
-
- uqsub8 r6, r11, r9 ; p0 - q0
- uqsub8 r7, r9, r11 ; q0 - p0
- uqsub8 r8, r12, r10 ; p1 - q1
- uqsub8 r11, r10, r12 ; q1 - p1
- orr r6, r6, r7 ; abs (p0-q0)
- ldr r7, c0x7F7F7F7F
- orr r8, r8, r11 ; abs (p1-q1)
- uqadd8 r6, r6, r6 ; abs (p0-q0) * 2
- and r8, r7, r8, lsr #1 ; abs (p1-q1) / 2
- uqsub8 r11, r10, r9 ; q1 - q0
- uqadd8 r6, r8, r6 ; abs (p0-q0)*2 + abs (p1-q1)/2
- uqsub8 r12, r9, r10 ; q0 - q1
- uqsub8 r6, r6, r4 ; compare to flimit
-
- orr r9, r11, r12 ; abs (q1-q0)
- uqsub8 r8, r9, r2 ; compare to limit
- uqsub8 r10, r9, r3 ; compare to thresh
- orr lr, lr, r6
- orr lr, lr, r8
-
- mvn r11, #0 ; r11 == -1
- mov r12, #0
-
- usub8 lr, r12, lr
- ldr r9, [sp] ; load the compared result
- sel lr, r11, r12 ; filter mask: lr
-
- cmp lr, #0
- beq mbvskip_filter ; skip filtering
-
-
-
- ;vp8_hevmask() function
- ;calculate high edge variance
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
-
- orr r9, r9, r10
-
- ldrh r7, [src, #-2]
- ldrh r8, [src], pstep
-
- usub8 r9, r12, r9
- sel r6, r12, r11 ; hev mask: r6
-
-
- ; vp8_mbfilter() function
- ; p2, q2 are only needed at the end. Don't need to load them in now.
- ; Transpose needs 8 regs(r6 - r12, and lr). Save r6 and lr first
- ; load soure data to r6, r11, r12, lr
- ldrh r9, [src, #-2]
- ldrh r10, [src], pstep
-
- pkhbt r12, r7, r8, lsl #16
-
- ldrh r7, [src, #-2]
- ldrh r8, [src], pstep
-
- pkhbt r11, r9, r10, lsl #16
-
- ldrh r9, [src, #-2]
- ldrh r10, [src], pstep
-
- str r6, [sp] ; save r6
- str lr, [sp, #4] ; save lr
-
- pkhbt r6, r7, r8, lsl #16
- pkhbt lr, r9, r10, lsl #16
-
- ;transpose r12, r11, r6, lr to p1, p0, q0, q1
- TRANSPOSE_MATRIX r12, r11, r6, lr, r7, r8, r9, r10
-
- ;load back hev_mask r6 and filter_mask lr
- ldr r12, c0x80808080
- ldr r6, [sp]
- ldr lr, [sp, #4]
-
- eor r7, r7, r12 ; ps1
- eor r8, r8, r12 ; ps0
- eor r9, r9, r12 ; qs0
- eor r10, r10, r12 ; qs1
-
- qsub8 r12, r9, r8 ; vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
- str r7, [sp, #12] ; store ps1 temporarily
- qsub8 r7, r7, r10 ; vp8_signed_char_clamp(ps1-qs1)
- str r10, [sp, #8] ; store qs1 temporarily
- qadd8 r7, r7, r12
- str r9, [sp] ; store qs0 temporarily
- qadd8 r7, r7, r12
- str r8, [sp, #4] ; store ps0 temporarily
- qadd8 r7, r7, r12 ; vp8_filter: r7
-
- ldr r10, c0x03030303 ; r10 = 3 --modified for vp8
- ldr r9, c0x04040404
- ;mvn r11, #0 ; r11 == -1
-
- and r7, r7, lr ; vp8_filter &= mask (lr is free)
-
- mov r12, r7 ; Filter2: r12
- and r12, r12, r6 ; Filter2 &= hev
-
- ;modify code for vp8
- ;save bottom 3 bits so that we round one side +4 and the other +3
- qadd8 r8 , r12 , r9 ; Filter1 (r8) = vp8_signed_char_clamp(Filter2+4)
- qadd8 r12 , r12 , r10 ; Filter2 (r12) = vp8_signed_char_clamp(Filter2+3)
-
- mov r10, #0
- shadd8 r8 , r8 , r10 ; Filter1 >>= 3
- shadd8 r12 , r12 , r10 ; Filter2 >>= 3
- shadd8 r8 , r8 , r10
- shadd8 r12 , r12 , r10
- shadd8 r8 , r8 , r10 ; r8: Filter1
- shadd8 r12 , r12 , r10 ; r12: Filter2
-
- ldr r9, [sp] ; load qs0
- ldr r11, [sp, #4] ; load ps0
-
- qsub8 r9 , r9, r8 ; qs0 = vp8_signed_char_clamp(qs0 - Filter1)
- qadd8 r11, r11, r12 ; ps0 = vp8_signed_char_clamp(ps0 + Filter2)
-
- ;save bottom 3 bits so that we round one side +4 and the other +3
- ;and r8, r12, r10 ; s = Filter2 & 7 (s: r8)
- ;qadd8 r12 , r12 , r9 ; Filter2 = vp8_signed_char_clamp(Filter2+4)
- ;mov r10, #0
- ;shadd8 r12 , r12 , r10 ; Filter2 >>= 3
- ;usub8 lr, r8, r9 ; s = (s==4)*-1
- ;sel lr, r11, r10
- ;shadd8 r12 , r12 , r10
- ;usub8 r8, r9, r8
- ;sel r8, r11, r10
- ;ldr r9, [sp] ; load qs0
- ;ldr r11, [sp, #4] ; load ps0
- ;shadd8 r12 , r12 , r10
- ;and r8, r8, lr ; -1 for each element that equals 4
- ;qadd8 r10, r8, r12 ; u = vp8_signed_char_clamp(s + Filter2)
- ;qsub8 r9 , r9, r12 ; qs0 = vp8_signed_char_clamp(qs0 - Filter2)
- ;qadd8 r11, r11, r10 ; ps0 = vp8_signed_char_clamp(ps0 + u)
-
- ;end of modification for vp8
-
- bic r12, r7, r6 ;vp8_filter &= ~hev ( r6 is free)
- ;mov r12, r7
-
- ;roughly 3/7th difference across boundary
- mov lr, #0x1b ; 27
- mov r7, #0x3f ; 63
-
- sxtb16 r6, r12
- sxtb16 r10, r12, ror #8
- smlabb r8, r6, lr, r7
- smlatb r6, r6, lr, r7
- smlabb r7, r10, lr, r7
- smultb r10, r10, lr
- ssat r8, #8, r8, asr #7
- ssat r6, #8, r6, asr #7
- add r10, r10, #63
- ssat r7, #8, r7, asr #7
- ssat r10, #8, r10, asr #7
-
- ldr lr, c0x80808080
-
- pkhbt r6, r8, r6, lsl #16
- pkhbt r10, r7, r10, lsl #16
- uxtb16 r6, r6
- uxtb16 r10, r10
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
-
- orr r10, r6, r10, lsl #8 ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
-
- qsub8 r8, r9, r10 ; s = vp8_signed_char_clamp(qs0 - u)
- qadd8 r10, r11, r10 ; s = vp8_signed_char_clamp(ps0 + u)
- eor r8, r8, lr ; *oq0 = s^0x80
- eor r10, r10, lr ; *op0 = s^0x80
-
- strb r10, [src, #-1] ; store op0 result
- strb r8, [src], pstep ; store oq0 result
- mov r10, r10, lsr #8
- mov r8, r8, lsr #8
- strb r10, [src, #-1]
- strb r8, [src], pstep
- mov r10, r10, lsr #8
- mov r8, r8, lsr #8
- strb r10, [src, #-1]
- strb r8, [src], pstep
- mov r10, r10, lsr #8
- mov r8, r8, lsr #8
- strb r10, [src, #-1]
- strb r8, [src], pstep
-
- ;roughly 2/7th difference across boundary
- mov lr, #0x12 ; 18
- mov r7, #0x3f ; 63
-
- sxtb16 r6, r12
- sxtb16 r10, r12, ror #8
- smlabb r8, r6, lr, r7
- smlatb r6, r6, lr, r7
- smlabb r9, r10, lr, r7
-
- smlatb r10, r10, lr, r7
- ssat r8, #8, r8, asr #7
- ssat r6, #8, r6, asr #7
- ssat r9, #8, r9, asr #7
- ssat r10, #8, r10, asr #7
-
- sub src, src, pstep, lsl #2 ; move src pointer down by 4 lines
-
- pkhbt r6, r8, r6, lsl #16
- pkhbt r10, r9, r10, lsl #16
-
- ldr r9, [sp, #8] ; load qs1
- ldr r11, [sp, #12] ; load ps1
- ldr lr, c0x80808080
-
- uxtb16 r6, r6
- uxtb16 r10, r10
-
- add src, src, #2
-
- orr r10, r6, r10, lsl #8 ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7)
-
- qsub8 r8, r9, r10 ; s = vp8_signed_char_clamp(qs1 - u)
- qadd8 r10, r11, r10 ; s = vp8_signed_char_clamp(ps1 + u)
- eor r8, r8, lr ; *oq1 = s^0x80
- eor r10, r10, lr ; *op1 = s^0x80
-
- ldrb r11, [src, #-5] ; load p2 for 1/7th difference across boundary
- strb r10, [src, #-4] ; store op1
- strb r8, [src, #-1] ; store oq1
- ldrb r9, [src], pstep ; load q2 for 1/7th difference across boundary
-
- mov r10, r10, lsr #8
- mov r8, r8, lsr #8
-
- ldrb r6, [src, #-5]
- strb r10, [src, #-4]
- strb r8, [src, #-1]
- ldrb r7, [src], pstep
-
- mov r10, r10, lsr #8
- mov r8, r8, lsr #8
- orr r11, r11, r6, lsl #8
- orr r9, r9, r7, lsl #8
-
- ldrb r6, [src, #-5]
- strb r10, [src, #-4]
- strb r8, [src, #-1]
- ldrb r7, [src], pstep
-
- mov r10, r10, lsr #8
- mov r8, r8, lsr #8
- orr r11, r11, r6, lsl #16
- orr r9, r9, r7, lsl #16
-
- ldrb r6, [src, #-5]
- strb r10, [src, #-4]
- strb r8, [src, #-1]
- ldrb r7, [src], pstep
- orr r11, r11, r6, lsl #24
- orr r9, r9, r7, lsl #24
-
- ;roughly 1/7th difference across boundary
- eor r9, r9, lr
- eor r11, r11, lr
-
- mov lr, #0x9 ; 9
- mov r7, #0x3f ; 63
-
- sxtb16 r6, r12
- sxtb16 r10, r12, ror #8
- smlabb r8, r6, lr, r7
- smlatb r6, r6, lr, r7
- smlabb r12, r10, lr, r7
- smlatb r10, r10, lr, r7
- ssat r8, #8, r8, asr #7
- ssat r6, #8, r6, asr #7
- ssat r12, #8, r12, asr #7
- ssat r10, #8, r10, asr #7
-
- sub src, src, pstep, lsl #2
-
- pkhbt r6, r8, r6, lsl #16
- pkhbt r10, r12, r10, lsl #16
-
- uxtb16 r6, r6
- uxtb16 r10, r10
-
- ldr lr, c0x80808080
-
- orr r10, r6, r10, lsl #8 ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7)
-
- qadd8 r8, r11, r10 ; s = vp8_signed_char_clamp(ps2 + u)
- qsub8 r10, r9, r10 ; s = vp8_signed_char_clamp(qs2 - u)
- eor r8, r8, lr ; *op2 = s^0x80
- eor r10, r10, lr ; *oq2 = s^0x80
-
- strb r8, [src, #-5] ; store *op2
- strb r10, [src], pstep ; store *oq2
- mov r8, r8, lsr #8
- mov r10, r10, lsr #8
- strb r8, [src, #-5]
- strb r10, [src], pstep
- mov r8, r8, lsr #8
- mov r10, r10, lsr #8
- strb r8, [src, #-5]
- strb r10, [src], pstep
- mov r8, r8, lsr #8
- mov r10, r10, lsr #8
- strb r8, [src, #-5]
- strb r10, [src], pstep
-
- ;adjust src pointer for next loop
- sub src, src, #2
-
-|mbvskip_filter|
- sub src, src, #4
- subs count, count, #1
-
- pld [src, #23] ; preload for next block
- ldrne r6, [src], pstep ; load source data
- pld [src, #23]
- ldrne r7, [src], pstep
- pld [src, #23]
- ldrne r8, [src], pstep
- pld [src, #23]
- ldrne lr, [src], pstep
-
- bne MBVnext8
-
- add sp, sp, #16
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_mbloop_filter_vertical_edge_armv6|
-
-; Constant Pool
-c0x80808080 DCD 0x80808080
-c0x03030303 DCD 0x03030303
-c0x04040404 DCD 0x04040404
-c0x01010101 DCD 0x01010101
-c0x7F7F7F7F DCD 0x7F7F7F7F
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/simpleloopfilter_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/simpleloopfilter_v6.asm
deleted file mode 100644
index 5e00cf0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/simpleloopfilter_v6.asm
+++ /dev/null
@@ -1,286 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_loop_filter_simple_horizontal_edge_armv6|
- EXPORT |vp8_loop_filter_simple_vertical_edge_armv6|
-
- AREA |.text|, CODE, READONLY ; name this block of code
-
- MACRO
- TRANSPOSE_MATRIX $a0, $a1, $a2, $a3, $b0, $b1, $b2, $b3
- ; input: $a0, $a1, $a2, $a3; output: $b0, $b1, $b2, $b3
- ; a0: 03 02 01 00
- ; a1: 13 12 11 10
- ; a2: 23 22 21 20
- ; a3: 33 32 31 30
- ; b3 b2 b1 b0
-
- uxtb16 $b1, $a1 ; xx 12 xx 10
- uxtb16 $b0, $a0 ; xx 02 xx 00
- uxtb16 $b3, $a3 ; xx 32 xx 30
- uxtb16 $b2, $a2 ; xx 22 xx 20
- orr $b1, $b0, $b1, lsl #8 ; 12 02 10 00
- orr $b3, $b2, $b3, lsl #8 ; 32 22 30 20
-
- uxtb16 $a1, $a1, ror #8 ; xx 13 xx 11
- uxtb16 $a3, $a3, ror #8 ; xx 33 xx 31
- uxtb16 $a0, $a0, ror #8 ; xx 03 xx 01
- uxtb16 $a2, $a2, ror #8 ; xx 23 xx 21
- orr $a0, $a0, $a1, lsl #8 ; 13 03 11 01
- orr $a2, $a2, $a3, lsl #8 ; 33 23 31 21
-
- pkhtb $b2, $b3, $b1, asr #16 ; 32 22 12 02 -- p1
- pkhbt $b0, $b1, $b3, lsl #16 ; 30 20 10 00 -- p3
-
- pkhtb $b3, $a2, $a0, asr #16 ; 33 23 13 03 -- p0
- pkhbt $b1, $a0, $a2, lsl #16 ; 31 21 11 01 -- p2
- MEND
-
-
-
-src RN r0
-pstep RN r1
-
-;r0 unsigned char *src_ptr,
-;r1 int src_pixel_step,
-;r2 const char *blimit
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_simple_horizontal_edge_armv6| PROC
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- stmdb sp!, {r4 - r11, lr}
-
- ldrb r12, [r2] ; blimit
- ldr r3, [src, -pstep, lsl #1] ; p1
- ldr r4, [src, -pstep] ; p0
- ldr r5, [src] ; q0
- ldr r6, [src, pstep] ; q1
- orr r12, r12, r12, lsl #8 ; blimit
- ldr r2, c0x80808080
- orr r12, r12, r12, lsl #16 ; blimit
- mov r9, #4 ; double the count. we're doing 4 at a time
- mov lr, #0 ; need 0 in a couple places
-
-|simple_hnext8|
- ; vp8_simple_filter_mask()
-
- uqsub8 r7, r3, r6 ; p1 - q1
- uqsub8 r8, r6, r3 ; q1 - p1
- uqsub8 r10, r4, r5 ; p0 - q0
- uqsub8 r11, r5, r4 ; q0 - p0
- orr r8, r8, r7 ; abs(p1 - q1)
- orr r10, r10, r11 ; abs(p0 - q0)
- uqadd8 r10, r10, r10 ; abs(p0 - q0) * 2
- uhadd8 r8, r8, lr ; abs(p1 - q2) >> 1
- uqadd8 r10, r10, r8 ; abs(p0 - q0)*2 + abs(p1 - q1)/2
- mvn r8, #0
- usub8 r10, r12, r10 ; compare to flimit. usub8 sets GE flags
- sel r10, r8, lr ; filter mask: F or 0
- cmp r10, #0
- beq simple_hskip_filter ; skip filtering if all masks are 0x00
-
- ;vp8_simple_filter()
-
- eor r3, r3, r2 ; p1 offset to convert to a signed value
- eor r6, r6, r2 ; q1 offset to convert to a signed value
- eor r4, r4, r2 ; p0 offset to convert to a signed value
- eor r5, r5, r2 ; q0 offset to convert to a signed value
-
- qsub8 r3, r3, r6 ; vp8_filter = p1 - q1
- qsub8 r6, r5, r4 ; q0 - p0
- qadd8 r3, r3, r6 ; += q0 - p0
- ldr r7, c0x04040404
- qadd8 r3, r3, r6 ; += q0 - p0
- ldr r8, c0x03030303
- qadd8 r3, r3, r6 ; vp8_filter = p1-q1 + 3*(q0-p0))
- ;STALL
- and r3, r3, r10 ; vp8_filter &= mask
-
- qadd8 r7 , r3 , r7 ; Filter1 = vp8_filter + 4
- qadd8 r8 , r3 , r8 ; Filter2 = vp8_filter + 3
-
- shadd8 r7 , r7 , lr
- shadd8 r8 , r8 , lr
- shadd8 r7 , r7 , lr
- shadd8 r8 , r8 , lr
- shadd8 r7 , r7 , lr ; Filter1 >>= 3
- shadd8 r8 , r8 , lr ; Filter2 >>= 3
-
- qsub8 r5 ,r5, r7 ; u = q0 - Filter1
- qadd8 r4, r4, r8 ; u = p0 + Filter2
- eor r5, r5, r2 ; *oq0 = u^0x80
- str r5, [src] ; store oq0 result
- eor r4, r4, r2 ; *op0 = u^0x80
- str r4, [src, -pstep] ; store op0 result
-
-|simple_hskip_filter|
- subs r9, r9, #1
- addne src, src, #4 ; next row
-
- ldrne r3, [src, -pstep, lsl #1] ; p1
- ldrne r4, [src, -pstep] ; p0
- ldrne r5, [src] ; q0
- ldrne r6, [src, pstep] ; q1
-
- bne simple_hnext8
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_loop_filter_simple_horizontal_edge_armv6|
-
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-|vp8_loop_filter_simple_vertical_edge_armv6| PROC
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- stmdb sp!, {r4 - r11, lr}
-
- ldrb r12, [r2] ; r12: blimit
- ldr r2, c0x80808080
- orr r12, r12, r12, lsl #8
-
- ; load soure data to r7, r8, r9, r10
- ldrh r3, [src, #-2]
- pld [src, #23] ; preload for next block
- ldrh r4, [src], pstep
- orr r12, r12, r12, lsl #16
-
- ldrh r5, [src, #-2]
- pld [src, #23]
- ldrh r6, [src], pstep
-
- pkhbt r7, r3, r4, lsl #16
-
- ldrh r3, [src, #-2]
- pld [src, #23]
- ldrh r4, [src], pstep
-
- pkhbt r8, r5, r6, lsl #16
-
- ldrh r5, [src, #-2]
- pld [src, #23]
- ldrh r6, [src], pstep
- mov r11, #4 ; double the count. we're doing 4 at a time
-
-|simple_vnext8|
- ; vp8_simple_filter_mask() function
- pkhbt r9, r3, r4, lsl #16
- pkhbt r10, r5, r6, lsl #16
-
- ;transpose r7, r8, r9, r10 to r3, r4, r5, r6
- TRANSPOSE_MATRIX r7, r8, r9, r10, r3, r4, r5, r6
-
- uqsub8 r7, r3, r6 ; p1 - q1
- uqsub8 r8, r6, r3 ; q1 - p1
- uqsub8 r9, r4, r5 ; p0 - q0
- uqsub8 r10, r5, r4 ; q0 - p0
- orr r7, r7, r8 ; abs(p1 - q1)
- orr r9, r9, r10 ; abs(p0 - q0)
- mov r8, #0
- uqadd8 r9, r9, r9 ; abs(p0 - q0) * 2
- uhadd8 r7, r7, r8 ; abs(p1 - q1) / 2
- uqadd8 r7, r7, r9 ; abs(p0 - q0)*2 + abs(p1 - q1)/2
- mvn r10, #0 ; r10 == -1
-
- usub8 r7, r12, r7 ; compare to flimit
- sel lr, r10, r8 ; filter mask
-
- cmp lr, #0
- beq simple_vskip_filter ; skip filtering
-
- ;vp8_simple_filter() function
- eor r3, r3, r2 ; p1 offset to convert to a signed value
- eor r6, r6, r2 ; q1 offset to convert to a signed value
- eor r4, r4, r2 ; p0 offset to convert to a signed value
- eor r5, r5, r2 ; q0 offset to convert to a signed value
-
- qsub8 r3, r3, r6 ; vp8_filter = p1 - q1
- qsub8 r6, r5, r4 ; q0 - p0
-
- qadd8 r3, r3, r6 ; vp8_filter += q0 - p0
- ldr r9, c0x03030303 ; r9 = 3
-
- qadd8 r3, r3, r6 ; vp8_filter += q0 - p0
- ldr r7, c0x04040404
-
- qadd8 r3, r3, r6 ; vp8_filter = p1-q1 + 3*(q0-p0))
- ;STALL
- and r3, r3, lr ; vp8_filter &= mask
-
- qadd8 r9 , r3 , r9 ; Filter2 = vp8_filter + 3
- qadd8 r3 , r3 , r7 ; Filter1 = vp8_filter + 4
-
- shadd8 r9 , r9 , r8
- shadd8 r3 , r3 , r8
- shadd8 r9 , r9 , r8
- shadd8 r3 , r3 , r8
- shadd8 r9 , r9 , r8 ; Filter2 >>= 3
- shadd8 r3 , r3 , r8 ; Filter1 >>= 3
-
- ;calculate output
- sub src, src, pstep, lsl #2
-
- qadd8 r4, r4, r9 ; u = p0 + Filter2
- qsub8 r5, r5, r3 ; u = q0 - Filter1
- eor r4, r4, r2 ; *op0 = u^0x80
- eor r5, r5, r2 ; *oq0 = u^0x80
-
- strb r4, [src, #-1] ; store the result
- mov r4, r4, lsr #8
- strb r5, [src], pstep
- mov r5, r5, lsr #8
-
- strb r4, [src, #-1]
- mov r4, r4, lsr #8
- strb r5, [src], pstep
- mov r5, r5, lsr #8
-
- strb r4, [src, #-1]
- mov r4, r4, lsr #8
- strb r5, [src], pstep
- mov r5, r5, lsr #8
-
- strb r4, [src, #-1]
- strb r5, [src], pstep
-
-|simple_vskip_filter|
- subs r11, r11, #1
-
- ; load soure data to r7, r8, r9, r10
- ldrneh r3, [src, #-2]
- pld [src, #23] ; preload for next block
- ldrneh r4, [src], pstep
-
- ldrneh r5, [src, #-2]
- pld [src, #23]
- ldrneh r6, [src], pstep
-
- pkhbt r7, r3, r4, lsl #16
-
- ldrneh r3, [src, #-2]
- pld [src, #23]
- ldrneh r4, [src], pstep
-
- pkhbt r8, r5, r6, lsl #16
-
- ldrneh r5, [src, #-2]
- pld [src, #23]
- ldrneh r6, [src], pstep
-
- bne simple_vnext8
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_loop_filter_simple_vertical_edge_armv6|
-
-; Constant Pool
-c0x80808080 DCD 0x80808080
-c0x03030303 DCD 0x03030303
-c0x04040404 DCD 0x04040404
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
deleted file mode 100644
index e81aef5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
+++ /dev/null
@@ -1,273 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sixtap_predict8x4_armv6|
-
- AREA |.text|, CODE, READONLY ; name this block of code
-;-------------------------------------
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; stack unsigned char *dst_ptr,
-; stack int dst_pitch
-;-------------------------------------
-;note: In first pass, store the result in transpose(8linesx9columns) on stack. Temporary stack size is 184.
-;Line width is 20 that is 9 short data plus 2 to make it 4bytes aligned. In second pass, load data from stack,
-;and the result is stored in transpose.
-|vp8_sixtap_predict8x4_armv6| PROC
- stmdb sp!, {r4 - r11, lr}
- str r3, [sp, #-184]! ;reserve space on stack for temporary storage, store yoffset
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- add lr, sp, #4 ;point to temporary buffer
- beq skip_firstpass_filter
-
-;first-pass filter
- adr r12, filter8_coeff
- sub r0, r0, r1, lsl #1
-
- add r3, r1, #10 ; preload next low
- pld [r0, r3]
-
- add r2, r12, r2, lsl #4 ;calculate filter location
- add r0, r0, #3 ;adjust src only for loading convinience
-
- ldr r3, [r2] ; load up packed filter coefficients
- ldr r4, [r2, #4]
- ldr r5, [r2, #8]
-
- mov r2, #0x90000 ; height=9 is top part of counter
-
- sub r1, r1, #8
-
-|first_pass_hloop_v6|
- ldrb r6, [r0, #-5] ; load source data
- ldrb r7, [r0, #-4]
- ldrb r8, [r0, #-3]
- ldrb r9, [r0, #-2]
- ldrb r10, [r0, #-1]
-
- orr r2, r2, #0x4 ; construct loop counter. width=8=4x2
-
- pkhbt r6, r6, r7, lsl #16 ; r7 | r6
- pkhbt r7, r7, r8, lsl #16 ; r8 | r7
-
- pkhbt r8, r8, r9, lsl #16 ; r9 | r8
- pkhbt r9, r9, r10, lsl #16 ; r10 | r9
-
-|first_pass_wloop_v6|
- smuad r11, r6, r3 ; vp8_filter[0], vp8_filter[1]
- smuad r12, r7, r3
-
- ldrb r6, [r0], #1
-
- smlad r11, r8, r4, r11 ; vp8_filter[2], vp8_filter[3]
- ldrb r7, [r0], #1
- smlad r12, r9, r4, r12
-
- pkhbt r10, r10, r6, lsl #16 ; r10 | r9
- pkhbt r6, r6, r7, lsl #16 ; r11 | r10
- smlad r11, r10, r5, r11 ; vp8_filter[4], vp8_filter[5]
- smlad r12, r6, r5, r12
-
- sub r2, r2, #1
-
- add r11, r11, #0x40 ; round_shift_and_clamp
- tst r2, #0xff ; test loop counter
- usat r11, #8, r11, asr #7
- add r12, r12, #0x40
- strh r11, [lr], #20 ; result is transposed and stored, which
- usat r12, #8, r12, asr #7
-
- strh r12, [lr], #20
-
- movne r11, r6
- movne r12, r7
-
- movne r6, r8
- movne r7, r9
- movne r8, r10
- movne r9, r11
- movne r10, r12
-
- bne first_pass_wloop_v6
-
- ;;add r9, ppl, #30 ; attempt to load 2 adjacent cache lines
- ;;IF ARCHITECTURE=6
- ;pld [src, ppl]
- ;;pld [src, r9]
- ;;ENDIF
-
- subs r2, r2, #0x10000
-
- sub lr, lr, #158
-
- add r0, r0, r1 ; move to next input line
-
- add r11, r1, #18 ; preload next low. adding back block width(=8), which is subtracted earlier
- pld [r0, r11]
-
- bne first_pass_hloop_v6
-
-;second pass filter
-secondpass_filter
- ldr r3, [sp], #4 ; load back yoffset
- ldr r0, [sp, #216] ; load dst address from stack 180+36
- ldr r1, [sp, #220] ; load dst stride from stack 180+40
-
- cmp r3, #0
- beq skip_secondpass_filter
-
- adr r12, filter8_coeff
- add lr, r12, r3, lsl #4 ;calculate filter location
-
- mov r2, #0x00080000
-
- ldr r3, [lr] ; load up packed filter coefficients
- ldr r4, [lr, #4]
- ldr r5, [lr, #8]
-
- pkhbt r12, r4, r3 ; pack the filter differently
- pkhbt r11, r5, r4
-
-second_pass_hloop_v6
- ldr r6, [sp] ; load the data
- ldr r7, [sp, #4]
-
- orr r2, r2, #2 ; loop counter
-
-second_pass_wloop_v6
- smuad lr, r3, r6 ; apply filter
- smulbt r10, r3, r6
-
- ldr r8, [sp, #8]
-
- smlad lr, r4, r7, lr
- smladx r10, r12, r7, r10
-
- ldrh r9, [sp, #12]
-
- smlad lr, r5, r8, lr
- smladx r10, r11, r8, r10
-
- add sp, sp, #4
- smlatb r10, r5, r9, r10
-
- sub r2, r2, #1
-
- add lr, lr, #0x40 ; round_shift_and_clamp
- tst r2, #0xff
- usat lr, #8, lr, asr #7
- add r10, r10, #0x40
- strb lr, [r0], r1 ; the result is transposed back and stored
- usat r10, #8, r10, asr #7
-
- strb r10, [r0],r1
-
- movne r6, r7
- movne r7, r8
-
- bne second_pass_wloop_v6
-
- subs r2, r2, #0x10000
- add sp, sp, #12 ; updata src for next loop (20-8)
- sub r0, r0, r1, lsl #2
- add r0, r0, #1
-
- bne second_pass_hloop_v6
-
- add sp, sp, #20
- ldmia sp!, {r4 - r11, pc}
-
-;--------------------
-skip_firstpass_filter
- sub r0, r0, r1, lsl #1
- sub r1, r1, #8
- mov r2, #9
-
-skip_firstpass_hloop
- ldrb r4, [r0], #1 ; load data
- subs r2, r2, #1
- ldrb r5, [r0], #1
- strh r4, [lr], #20 ; store it to immediate buffer
- ldrb r6, [r0], #1 ; load data
- strh r5, [lr], #20
- ldrb r7, [r0], #1
- strh r6, [lr], #20
- ldrb r8, [r0], #1
- strh r7, [lr], #20
- ldrb r9, [r0], #1
- strh r8, [lr], #20
- ldrb r10, [r0], #1
- strh r9, [lr], #20
- ldrb r11, [r0], #1
- strh r10, [lr], #20
- add r0, r0, r1 ; move to next input line
- strh r11, [lr], #20
-
- sub lr, lr, #158 ; move over to next column
- bne skip_firstpass_hloop
-
- b secondpass_filter
-
-;--------------------
-skip_secondpass_filter
- mov r2, #8
- add sp, sp, #4 ;start from src[0] instead of src[-2]
-
-skip_secondpass_hloop
- ldr r6, [sp], #4
- subs r2, r2, #1
- ldr r8, [sp], #4
-
- mov r7, r6, lsr #16 ; unpack
- strb r6, [r0], r1
- mov r9, r8, lsr #16
- strb r7, [r0], r1
- add sp, sp, #12 ; 20-8
- strb r8, [r0], r1
- strb r9, [r0], r1
-
- sub r0, r0, r1, lsl #2
- add r0, r0, #1
-
- bne skip_secondpass_hloop
-
- add sp, sp, #16 ; 180 - (160 +4)
-
- ldmia sp!, {r4 - r11, pc}
-
- ENDP
-
-;-----------------
-;One word each is reserved. Label filter_coeff can be used to access the data.
-;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
-filter8_coeff
- DCD 0x00000000, 0x00000080, 0x00000000, 0x00000000
- DCD 0xfffa0000, 0x000c007b, 0x0000ffff, 0x00000000
- DCD 0xfff50002, 0x0024006c, 0x0001fff8, 0x00000000
- DCD 0xfff70000, 0x0032005d, 0x0000fffa, 0x00000000
- DCD 0xfff00003, 0x004d004d, 0x0003fff0, 0x00000000
- DCD 0xfffa0000, 0x005d0032, 0x0000fff7, 0x00000000
- DCD 0xfff80001, 0x006c0024, 0x0002fff5, 0x00000000
- DCD 0xffff0000, 0x007b000c, 0x0000fffa, 0x00000000
-
- ;DCD 0, 0, 128, 0, 0, 0
- ;DCD 0, -6, 123, 12, -1, 0
- ;DCD 2, -11, 108, 36, -8, 1
- ;DCD 0, -9, 93, 50, -6, 0
- ;DCD 3, -16, 77, 77, -16, 3
- ;DCD 0, -6, 50, 93, -9, 0
- ;DCD 1, -8, 36, 108, -11, 2
- ;DCD 0, -1, 12, 123, -6, 0
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_sad16x16_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_sad16x16_armv6.asm
deleted file mode 100644
index 1b4f5cf..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_sad16x16_armv6.asm
+++ /dev/null
@@ -1,96 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sad16x16_armv6|
-
- 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
-; stack max_sad (not used)
-|vp8_sad16x16_armv6| 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/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance16x16_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance16x16_armv6.asm
deleted file mode 100644
index 3991957..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance16x16_armv6.asm
+++ /dev/null
@@ -1,154 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_variance16x16_armv6|
-
- 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
-|vp8_variance16x16_armv6| 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)
-
-loop
- ; 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 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
-
- END
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance8x8_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance8x8_armv6.asm
deleted file mode 100644
index 915ee49..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance8x8_armv6.asm
+++ /dev/null
@@ -1,101 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_variance8x8_armv6|
-
- ARM
-
- 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
-|vp8_variance8x8_armv6| 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
-
-loop
- ; 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 loop
-
- ; 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
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
deleted file mode 100644
index 3668dc5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6.asm
+++ /dev/null
@@ -1,182 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_variance_halfpixvar16x16_h_armv6|
-
- 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
-|vp8_variance_halfpixvar16x16_h_armv6| 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/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
deleted file mode 100644
index b4e0959..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6.asm
+++ /dev/null
@@ -1,222 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_variance_halfpixvar16x16_hv_armv6|
-
- 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
-|vp8_variance_halfpixvar16x16_hv_armv6| 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/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
deleted file mode 100644
index 10863e2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6.asm
+++ /dev/null
@@ -1,184 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_variance_halfpixvar16x16_v_armv6|
-
- 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
-|vp8_variance_halfpixvar16x16_v_armv6| 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/videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.c
deleted file mode 100644
index 799c8bd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include <math.h>
-#include "vp8/common/filter.h"
-#include "bilinearfilter_arm.h"
-
-void vp8_filter_block2d_bil_armv6
-(
- unsigned char *src_ptr,
- unsigned char *dst_ptr,
- unsigned int src_pitch,
- unsigned int dst_pitch,
- const short *HFilter,
- const short *VFilter,
- int Width,
- int Height
-)
-{
- unsigned short FData[36*16]; /* Temp data buffer used in filtering */
-
- /* First filter 1-D horizontally... */
- vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
-
- /* then 1-D vertically... */
- vp8_filter_block2d_bil_second_pass_armv6(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
-}
-
-
-void vp8_bilinear_predict4x4_armv6
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
-}
-
-void vp8_bilinear_predict8x8_armv6
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
-}
-
-void vp8_bilinear_predict8x4_armv6
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
-}
-
-void vp8_bilinear_predict16x16_armv6
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.h b/videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.h
deleted file mode 100644
index 6b84e6f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/bilinearfilter_arm.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ARM_BILINEARFILTER_ARM_H_
-#define VP8_COMMON_ARM_BILINEARFILTER_ARM_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void vp8_filter_block2d_bil_first_pass_armv6
-(
- const unsigned char *src_ptr,
- unsigned short *dst_ptr,
- unsigned int src_pitch,
- unsigned int height,
- unsigned int width,
- const short *vp8_filter
-);
-
-extern void vp8_filter_block2d_bil_second_pass_armv6
-(
- const unsigned short *src_ptr,
- unsigned char *dst_ptr,
- int dst_pitch,
- unsigned int height,
- unsigned int width,
- const short *vp8_filter
-);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_ARM_BILINEARFILTER_ARM_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/dequantize_arm.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/dequantize_arm.c
deleted file mode 100644
index 70e72aa..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/dequantize_arm.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8/common/blockd.h"
-
-#if HAVE_NEON
-extern void vp8_dequantize_b_loop_neon(short *Q, short *DQC, short *DQ);
-#endif
-
-#if HAVE_MEDIA
-extern void vp8_dequantize_b_loop_v6(short *Q, short *DQC, short *DQ);
-#endif
-
-#if HAVE_NEON
-
-void vp8_dequantize_b_neon(BLOCKD *d, short *DQC)
-{
- short *DQ = d->dqcoeff;
- short *Q = d->qcoeff;
-
- vp8_dequantize_b_loop_neon(Q, DQC, DQ);
-}
-#endif
-
-#if HAVE_MEDIA
-void vp8_dequantize_b_v6(BLOCKD *d, short *DQC)
-{
- short *DQ = d->dqcoeff;
- short *Q = d->qcoeff;
-
- vp8_dequantize_b_loop_v6(Q, DQC, DQ);
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/filter_arm.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/filter_arm.c
deleted file mode 100644
index 7fe3967..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/filter_arm.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include <math.h>
-#include "vp8/common/filter.h"
-#include "vpx_ports/mem.h"
-
-extern void vp8_filter_block2d_first_pass_armv6
-(
- unsigned char *src_ptr,
- short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_width,
- unsigned int output_height,
- const short *vp8_filter
-);
-
-// 8x8
-extern void vp8_filter_block2d_first_pass_8x8_armv6
-(
- unsigned char *src_ptr,
- short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_width,
- unsigned int output_height,
- const short *vp8_filter
-);
-
-// 16x16
-extern void vp8_filter_block2d_first_pass_16x16_armv6
-(
- unsigned char *src_ptr,
- short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_width,
- unsigned int output_height,
- const short *vp8_filter
-);
-
-extern void vp8_filter_block2d_second_pass_armv6
-(
- short *src_ptr,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int cnt,
- const short *vp8_filter
-);
-
-extern void vp8_filter4_block2d_second_pass_armv6
-(
- short *src_ptr,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int cnt,
- const short *vp8_filter
-);
-
-extern void vp8_filter_block2d_first_pass_only_armv6
-(
- unsigned char *src_ptr,
- unsigned char *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int cnt,
- unsigned int output_pitch,
- const short *vp8_filter
-);
-
-
-extern void vp8_filter_block2d_second_pass_only_armv6
-(
- unsigned char *src_ptr,
- unsigned char *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int cnt,
- unsigned int output_pitch,
- const short *vp8_filter
-);
-
-#if HAVE_MEDIA
-void vp8_sixtap_predict4x4_armv6
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
- DECLARE_ALIGNED_ARRAY(4, short, FData, 12*4); /* Temp data buffer used in filtering */
-
-
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- /* Vfilter is null. First pass only */
- if (xoffset && !yoffset)
- {
- /*vp8_filter_block2d_first_pass_armv6 ( src_ptr, FData+2, src_pixels_per_line, 4, 4, HFilter );
- vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, VFilter );*/
-
- vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, HFilter);
- }
- /* Hfilter is null. Second pass only */
- else if (!xoffset && yoffset)
- {
- vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, VFilter);
- }
- else
- {
- /* Vfilter is a 4 tap filter */
- if (yoffset & 0x1)
- {
- vp8_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 4, 7, HFilter);
- vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
- }
- /* Vfilter is 6 tap filter */
- else
- {
- vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 4, 9, HFilter);
- vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
- }
- }
-}
-
-void vp8_sixtap_predict8x8_armv6
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
- DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data buffer used in filtering */
-
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- if (xoffset && !yoffset)
- {
- vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter);
- }
- /* Hfilter is null. Second pass only */
- else if (!xoffset && yoffset)
- {
- vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter);
- }
- else
- {
- if (yoffset & 0x1)
- {
- vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
- vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
- }
- else
- {
- vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
- vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
- }
- }
-}
-
-
-void vp8_sixtap_predict16x16_armv6
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
- DECLARE_ALIGNED_ARRAY(4, short, FData, 24*16); /* Temp data buffer used in filtering */
-
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- if (xoffset && !yoffset)
- {
- vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, HFilter);
- }
- /* Hfilter is null. Second pass only */
- else if (!xoffset && yoffset)
- {
- vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, VFilter);
- }
- else
- {
- if (yoffset & 0x1)
- {
- vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
- vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
- }
- else
- {
- vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
- vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
- }
- }
-
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/loopfilter_arm.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/loopfilter_arm.c
deleted file mode 100644
index 3bdc967..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/loopfilter_arm.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vp8/common/loopfilter.h"
-#include "vp8/common/onyxc_int.h"
-
-#define prototype_loopfilter(sym) \
- void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
- const unsigned char *limit, const unsigned char *thresh, int count)
-
-#if HAVE_MEDIA
-extern prototype_loopfilter(vp8_loop_filter_horizontal_edge_armv6);
-extern prototype_loopfilter(vp8_loop_filter_vertical_edge_armv6);
-extern prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_armv6);
-extern prototype_loopfilter(vp8_mbloop_filter_vertical_edge_armv6);
-#endif
-
-#if HAVE_NEON
-typedef void loopfilter_y_neon(unsigned char *src, int pitch,
- unsigned char blimit, unsigned char limit, unsigned char thresh);
-typedef void loopfilter_uv_neon(unsigned char *u, int pitch,
- unsigned char blimit, unsigned char limit, unsigned char thresh,
- unsigned char *v);
-
-extern loopfilter_y_neon vp8_loop_filter_horizontal_edge_y_neon;
-extern loopfilter_y_neon vp8_loop_filter_vertical_edge_y_neon;
-extern loopfilter_y_neon vp8_mbloop_filter_horizontal_edge_y_neon;
-extern loopfilter_y_neon vp8_mbloop_filter_vertical_edge_y_neon;
-
-extern loopfilter_uv_neon vp8_loop_filter_horizontal_edge_uv_neon;
-extern loopfilter_uv_neon vp8_loop_filter_vertical_edge_uv_neon;
-extern loopfilter_uv_neon vp8_mbloop_filter_horizontal_edge_uv_neon;
-extern loopfilter_uv_neon vp8_mbloop_filter_vertical_edge_uv_neon;
-#endif
-
-#if HAVE_MEDIA
-/* ARMV6/MEDIA loopfilter functions*/
-/* Horizontal MB filtering */
-void vp8_loop_filter_mbh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_mbloop_filter_horizontal_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_mbloop_filter_horizontal_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_mbloop_filter_horizontal_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-/* Vertical MB Filtering */
-void vp8_loop_filter_mbv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_mbloop_filter_vertical_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_mbloop_filter_vertical_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_mbloop_filter_vertical_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-/* Horizontal B Filtering */
-void vp8_loop_filter_bh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_loop_filter_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_loop_filter_horizontal_edge_armv6(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_loop_filter_horizontal_edge_armv6(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-void vp8_loop_filter_bhs_armv6(unsigned char *y_ptr, int y_stride,
- const unsigned char *blimit)
-{
- vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, blimit);
-}
-
-/* Vertical B Filtering */
-void vp8_loop_filter_bv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_loop_filter_vertical_edge_armv6(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_vertical_edge_armv6(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_vertical_edge_armv6(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_loop_filter_vertical_edge_armv6(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_loop_filter_vertical_edge_armv6(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-void vp8_loop_filter_bvs_armv6(unsigned char *y_ptr, int y_stride,
- const unsigned char *blimit)
-{
- vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 4, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 8, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_armv6(y_ptr + 12, y_stride, blimit);
-}
-#endif
-
-#if HAVE_NEON
-/* NEON loopfilter functions */
-/* Horizontal MB filtering */
-void vp8_loop_filter_mbh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned char mblim = *lfi->mblim;
- unsigned char lim = *lfi->lim;
- unsigned char hev_thr = *lfi->hev_thr;
- vp8_mbloop_filter_horizontal_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
-
- if (u_ptr)
- vp8_mbloop_filter_horizontal_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
-}
-
-/* Vertical MB Filtering */
-void vp8_loop_filter_mbv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned char mblim = *lfi->mblim;
- unsigned char lim = *lfi->lim;
- unsigned char hev_thr = *lfi->hev_thr;
-
- vp8_mbloop_filter_vertical_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
-
- if (u_ptr)
- vp8_mbloop_filter_vertical_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
-}
-
-/* Horizontal B Filtering */
-void vp8_loop_filter_bh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned char blim = *lfi->blim;
- unsigned char lim = *lfi->lim;
- unsigned char hev_thr = *lfi->hev_thr;
-
- vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 4 * y_stride, y_stride, blim, lim, hev_thr);
- vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 8 * y_stride, y_stride, blim, lim, hev_thr);
- vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 12 * y_stride, y_stride, blim, lim, hev_thr);
-
- if (u_ptr)
- vp8_loop_filter_horizontal_edge_uv_neon(u_ptr + 4 * uv_stride, uv_stride, blim, lim, hev_thr, v_ptr + 4 * uv_stride);
-}
-
-/* Vertical B Filtering */
-void vp8_loop_filter_bv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned char blim = *lfi->blim;
- unsigned char lim = *lfi->lim;
- unsigned char hev_thr = *lfi->hev_thr;
-
- vp8_loop_filter_vertical_edge_y_neon(y_ptr + 4, y_stride, blim, lim, hev_thr);
- vp8_loop_filter_vertical_edge_y_neon(y_ptr + 8, y_stride, blim, lim, hev_thr);
- vp8_loop_filter_vertical_edge_y_neon(y_ptr + 12, y_stride, blim, lim, hev_thr);
-
- if (u_ptr)
- vp8_loop_filter_vertical_edge_uv_neon(u_ptr + 4, uv_stride, blim, lim, hev_thr, v_ptr + 4);
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/bilinearpredict_neon.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/bilinearpredict_neon.c
deleted file mode 100644
index e1c3c2b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/bilinearpredict_neon.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <arm_neon.h>
-
-static const uint16_t bifilter4_coeff[8][2] = {
- {128, 0},
- {112, 16},
- { 96, 32},
- { 80, 48},
- { 64, 64},
- { 48, 80},
- { 32, 96},
- { 16, 112}
-};
-
-void vp8_bilinear_predict4x4_neon(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch) {
- uint8x8_t d0u8, d1u8, d2u8, d3u8, d4u8, d5u8, d6u8;
- uint8x8_t d26u8, d27u8, d28u8, d29u8, d30u8;
- uint32x2_t d28u32, d29u32, d30u32;
- uint8x16_t q1u8, q2u8;
- uint16x8_t q1u16, q2u16;
- uint16x8_t q7u16, q8u16, q9u16;
- uint64x2_t q4u64, q5u64;
- uint64x1_t d12u64;
- uint32x2x2_t d0u32x2, d1u32x2, d2u32x2, d3u32x2;
-
- if (xoffset == 0) { // skip_1stpass_filter
- d28u32 = vld1_lane_u32((const uint32_t *)src_ptr, d28u32, 0);
- src_ptr += src_pixels_per_line;
- d28u32 = vld1_lane_u32((const uint32_t *)src_ptr, d28u32, 1);
- src_ptr += src_pixels_per_line;
- d29u32 = vld1_lane_u32((const uint32_t *)src_ptr, d29u32, 0);
- src_ptr += src_pixels_per_line;
- d29u32 = vld1_lane_u32((const uint32_t *)src_ptr, d29u32, 1);
- src_ptr += src_pixels_per_line;
- d30u32 = vld1_lane_u32((const uint32_t *)src_ptr, d30u32, 0);
- d28u8 = vreinterpret_u8_u32(d28u32);
- d29u8 = vreinterpret_u8_u32(d29u32);
- d30u8 = vreinterpret_u8_u32(d30u32);
- } else {
- d2u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d3u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d4u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d5u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d6u8 = vld1_u8(src_ptr);
-
- q1u8 = vcombine_u8(d2u8, d3u8);
- q2u8 = vcombine_u8(d4u8, d5u8);
-
- d0u8 = vdup_n_u8((uint8_t)bifilter4_coeff[xoffset][0]);
- d1u8 = vdup_n_u8((uint8_t)bifilter4_coeff[xoffset][1]);
-
- q4u64 = vshrq_n_u64(vreinterpretq_u64_u8(q1u8), 8);
- q5u64 = vshrq_n_u64(vreinterpretq_u64_u8(q2u8), 8);
- d12u64 = vshr_n_u64(vreinterpret_u64_u8(d6u8), 8);
-
- d0u32x2 = vzip_u32(vreinterpret_u32_u8(vget_low_u8(q1u8)),
- vreinterpret_u32_u8(vget_high_u8(q1u8)));
- d1u32x2 = vzip_u32(vreinterpret_u32_u8(vget_low_u8(q2u8)),
- vreinterpret_u32_u8(vget_high_u8(q2u8)));
- d2u32x2 = vzip_u32(vreinterpret_u32_u64(vget_low_u64(q4u64)),
- vreinterpret_u32_u64(vget_high_u64(q4u64)));
- d3u32x2 = vzip_u32(vreinterpret_u32_u64(vget_low_u64(q5u64)),
- vreinterpret_u32_u64(vget_high_u64(q5u64)));
-
- q7u16 = vmull_u8(vreinterpret_u8_u32(d0u32x2.val[0]), d0u8);
- q8u16 = vmull_u8(vreinterpret_u8_u32(d1u32x2.val[0]), d0u8);
- q9u16 = vmull_u8(d6u8, d0u8);
-
- q7u16 = vmlal_u8(q7u16, vreinterpret_u8_u32(d2u32x2.val[0]), d1u8);
- q8u16 = vmlal_u8(q8u16, vreinterpret_u8_u32(d3u32x2.val[0]), d1u8);
- q9u16 = vmlal_u8(q9u16, vreinterpret_u8_u64(d12u64), d1u8);
-
- d28u8 = vqrshrn_n_u16(q7u16, 7);
- d29u8 = vqrshrn_n_u16(q8u16, 7);
- d30u8 = vqrshrn_n_u16(q9u16, 7);
- }
-
- // secondpass_filter
- if (yoffset == 0) { // skip_2ndpass_filter
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d28u8), 0);
- dst_ptr += dst_pitch;
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d28u8), 1);
- dst_ptr += dst_pitch;
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d29u8), 0);
- dst_ptr += dst_pitch;
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d29u8), 1);
- } else {
- d0u8 = vdup_n_u8(bifilter4_coeff[yoffset][0]);
- d1u8 = vdup_n_u8(bifilter4_coeff[yoffset][1]);
-
- q1u16 = vmull_u8(d28u8, d0u8);
- q2u16 = vmull_u8(d29u8, d0u8);
-
- d26u8 = vext_u8(d28u8, d29u8, 4);
- d27u8 = vext_u8(d29u8, d30u8, 4);
-
- q1u16 = vmlal_u8(q1u16, d26u8, d1u8);
- q2u16 = vmlal_u8(q2u16, d27u8, d1u8);
-
- d2u8 = vqrshrn_n_u16(q1u16, 7);
- d3u8 = vqrshrn_n_u16(q2u16, 7);
-
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 0);
- dst_ptr += dst_pitch;
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 1);
- dst_ptr += dst_pitch;
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d3u8), 0);
- dst_ptr += dst_pitch;
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d3u8), 1);
- }
- return;
-}
-
-void vp8_bilinear_predict8x4_neon(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch) {
- uint8x8_t d0u8, d1u8, d2u8, d3u8, d4u8, d5u8;
- uint8x8_t d7u8, d9u8, d11u8, d22u8, d23u8, d24u8, d25u8, d26u8;
- uint8x16_t q1u8, q2u8, q3u8, q4u8, q5u8;
- uint16x8_t q1u16, q2u16, q3u16, q4u16;
- uint16x8_t q6u16, q7u16, q8u16, q9u16, q10u16;
-
- if (xoffset == 0) { // skip_1stpass_filter
- d22u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d23u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d24u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d25u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d26u8 = vld1_u8(src_ptr);
- } else {
- q1u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q2u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q3u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q4u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q5u8 = vld1q_u8(src_ptr);
-
- d0u8 = vdup_n_u8((uint8_t)bifilter4_coeff[xoffset][0]);
- d1u8 = vdup_n_u8((uint8_t)bifilter4_coeff[xoffset][1]);
-
- q6u16 = vmull_u8(vget_low_u8(q1u8), d0u8);
- q7u16 = vmull_u8(vget_low_u8(q2u8), d0u8);
- q8u16 = vmull_u8(vget_low_u8(q3u8), d0u8);
- q9u16 = vmull_u8(vget_low_u8(q4u8), d0u8);
- q10u16 = vmull_u8(vget_low_u8(q5u8), d0u8);
-
- d3u8 = vext_u8(vget_low_u8(q1u8), vget_high_u8(q1u8), 1);
- d5u8 = vext_u8(vget_low_u8(q2u8), vget_high_u8(q2u8), 1);
- d7u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 1);
- d9u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 1);
- d11u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 1);
-
- q6u16 = vmlal_u8(q6u16, d3u8, d1u8);
- q7u16 = vmlal_u8(q7u16, d5u8, d1u8);
- q8u16 = vmlal_u8(q8u16, d7u8, d1u8);
- q9u16 = vmlal_u8(q9u16, d9u8, d1u8);
- q10u16 = vmlal_u8(q10u16, d11u8, d1u8);
-
- d22u8 = vqrshrn_n_u16(q6u16, 7);
- d23u8 = vqrshrn_n_u16(q7u16, 7);
- d24u8 = vqrshrn_n_u16(q8u16, 7);
- d25u8 = vqrshrn_n_u16(q9u16, 7);
- d26u8 = vqrshrn_n_u16(q10u16, 7);
- }
-
- // secondpass_filter
- if (yoffset == 0) { // skip_2ndpass_filter
- vst1_u8((uint8_t *)dst_ptr, d22u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d23u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d24u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d25u8);
- } else {
- d0u8 = vdup_n_u8(bifilter4_coeff[yoffset][0]);
- d1u8 = vdup_n_u8(bifilter4_coeff[yoffset][1]);
-
- q1u16 = vmull_u8(d22u8, d0u8);
- q2u16 = vmull_u8(d23u8, d0u8);
- q3u16 = vmull_u8(d24u8, d0u8);
- q4u16 = vmull_u8(d25u8, d0u8);
-
- q1u16 = vmlal_u8(q1u16, d23u8, d1u8);
- q2u16 = vmlal_u8(q2u16, d24u8, d1u8);
- q3u16 = vmlal_u8(q3u16, d25u8, d1u8);
- q4u16 = vmlal_u8(q4u16, d26u8, d1u8);
-
- d2u8 = vqrshrn_n_u16(q1u16, 7);
- d3u8 = vqrshrn_n_u16(q2u16, 7);
- d4u8 = vqrshrn_n_u16(q3u16, 7);
- d5u8 = vqrshrn_n_u16(q4u16, 7);
-
- vst1_u8((uint8_t *)dst_ptr, d2u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d3u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d4u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d5u8);
- }
- return;
-}
-
-void vp8_bilinear_predict8x8_neon(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch) {
- uint8x8_t d0u8, d1u8, d2u8, d3u8, d4u8, d5u8, d6u8, d7u8, d8u8, d9u8, d11u8;
- uint8x8_t d22u8, d23u8, d24u8, d25u8, d26u8, d27u8, d28u8, d29u8, d30u8;
- uint8x16_t q1u8, q2u8, q3u8, q4u8, q5u8;
- uint16x8_t q1u16, q2u16, q3u16, q4u16, q5u16;
- uint16x8_t q6u16, q7u16, q8u16, q9u16, q10u16;
-
- if (xoffset == 0) { // skip_1stpass_filter
- d22u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d23u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d24u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d25u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d26u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d27u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d28u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d29u8 = vld1_u8(src_ptr); src_ptr += src_pixels_per_line;
- d30u8 = vld1_u8(src_ptr);
- } else {
- q1u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q2u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q3u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q4u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
-
- d0u8 = vdup_n_u8((uint8_t)bifilter4_coeff[xoffset][0]);
- d1u8 = vdup_n_u8((uint8_t)bifilter4_coeff[xoffset][1]);
-
- q6u16 = vmull_u8(vget_low_u8(q1u8), d0u8);
- q7u16 = vmull_u8(vget_low_u8(q2u8), d0u8);
- q8u16 = vmull_u8(vget_low_u8(q3u8), d0u8);
- q9u16 = vmull_u8(vget_low_u8(q4u8), d0u8);
-
- d3u8 = vext_u8(vget_low_u8(q1u8), vget_high_u8(q1u8), 1);
- d5u8 = vext_u8(vget_low_u8(q2u8), vget_high_u8(q2u8), 1);
- d7u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 1);
- d9u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 1);
-
- q6u16 = vmlal_u8(q6u16, d3u8, d1u8);
- q7u16 = vmlal_u8(q7u16, d5u8, d1u8);
- q8u16 = vmlal_u8(q8u16, d7u8, d1u8);
- q9u16 = vmlal_u8(q9u16, d9u8, d1u8);
-
- d22u8 = vqrshrn_n_u16(q6u16, 7);
- d23u8 = vqrshrn_n_u16(q7u16, 7);
- d24u8 = vqrshrn_n_u16(q8u16, 7);
- d25u8 = vqrshrn_n_u16(q9u16, 7);
-
- // first_pass filtering on the rest 5-line data
- q1u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q2u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q3u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q4u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q5u8 = vld1q_u8(src_ptr);
-
- q6u16 = vmull_u8(vget_low_u8(q1u8), d0u8);
- q7u16 = vmull_u8(vget_low_u8(q2u8), d0u8);
- q8u16 = vmull_u8(vget_low_u8(q3u8), d0u8);
- q9u16 = vmull_u8(vget_low_u8(q4u8), d0u8);
- q10u16 = vmull_u8(vget_low_u8(q5u8), d0u8);
-
- d3u8 = vext_u8(vget_low_u8(q1u8), vget_high_u8(q1u8), 1);
- d5u8 = vext_u8(vget_low_u8(q2u8), vget_high_u8(q2u8), 1);
- d7u8 = vext_u8(vget_low_u8(q3u8), vget_high_u8(q3u8), 1);
- d9u8 = vext_u8(vget_low_u8(q4u8), vget_high_u8(q4u8), 1);
- d11u8 = vext_u8(vget_low_u8(q5u8), vget_high_u8(q5u8), 1);
-
- q6u16 = vmlal_u8(q6u16, d3u8, d1u8);
- q7u16 = vmlal_u8(q7u16, d5u8, d1u8);
- q8u16 = vmlal_u8(q8u16, d7u8, d1u8);
- q9u16 = vmlal_u8(q9u16, d9u8, d1u8);
- q10u16 = vmlal_u8(q10u16, d11u8, d1u8);
-
- d26u8 = vqrshrn_n_u16(q6u16, 7);
- d27u8 = vqrshrn_n_u16(q7u16, 7);
- d28u8 = vqrshrn_n_u16(q8u16, 7);
- d29u8 = vqrshrn_n_u16(q9u16, 7);
- d30u8 = vqrshrn_n_u16(q10u16, 7);
- }
-
- // secondpass_filter
- if (yoffset == 0) { // skip_2ndpass_filter
- vst1_u8((uint8_t *)dst_ptr, d22u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d23u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d24u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d25u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d26u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d27u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d28u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d29u8);
- } else {
- d0u8 = vdup_n_u8(bifilter4_coeff[yoffset][0]);
- d1u8 = vdup_n_u8(bifilter4_coeff[yoffset][1]);
-
- q1u16 = vmull_u8(d22u8, d0u8);
- q2u16 = vmull_u8(d23u8, d0u8);
- q3u16 = vmull_u8(d24u8, d0u8);
- q4u16 = vmull_u8(d25u8, d0u8);
- q5u16 = vmull_u8(d26u8, d0u8);
- q6u16 = vmull_u8(d27u8, d0u8);
- q7u16 = vmull_u8(d28u8, d0u8);
- q8u16 = vmull_u8(d29u8, d0u8);
-
- q1u16 = vmlal_u8(q1u16, d23u8, d1u8);
- q2u16 = vmlal_u8(q2u16, d24u8, d1u8);
- q3u16 = vmlal_u8(q3u16, d25u8, d1u8);
- q4u16 = vmlal_u8(q4u16, d26u8, d1u8);
- q5u16 = vmlal_u8(q5u16, d27u8, d1u8);
- q6u16 = vmlal_u8(q6u16, d28u8, d1u8);
- q7u16 = vmlal_u8(q7u16, d29u8, d1u8);
- q8u16 = vmlal_u8(q8u16, d30u8, d1u8);
-
- d2u8 = vqrshrn_n_u16(q1u16, 7);
- d3u8 = vqrshrn_n_u16(q2u16, 7);
- d4u8 = vqrshrn_n_u16(q3u16, 7);
- d5u8 = vqrshrn_n_u16(q4u16, 7);
- d6u8 = vqrshrn_n_u16(q5u16, 7);
- d7u8 = vqrshrn_n_u16(q6u16, 7);
- d8u8 = vqrshrn_n_u16(q7u16, 7);
- d9u8 = vqrshrn_n_u16(q8u16, 7);
-
- vst1_u8((uint8_t *)dst_ptr, d2u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d3u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d4u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d5u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d6u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d7u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d8u8); dst_ptr += dst_pitch;
- vst1_u8((uint8_t *)dst_ptr, d9u8);
- }
- return;
-}
-
-void vp8_bilinear_predict16x16_neon(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch) {
- int i;
- unsigned char tmp[272];
- unsigned char *tmpp;
- uint8x8_t d0u8, d1u8, d2u8, d3u8, d4u8, d5u8, d6u8, d7u8, d8u8, d9u8;
- uint8x8_t d10u8, d11u8, d12u8, d13u8, d14u8, d15u8, d16u8, d17u8, d18u8;
- uint8x8_t d19u8, d20u8, d21u8;
- uint8x16_t q1u8, q2u8, q3u8, q4u8, q5u8, q6u8, q7u8, q8u8, q9u8, q10u8;
- uint8x16_t q11u8, q12u8, q13u8, q14u8, q15u8;
- uint16x8_t q1u16, q2u16, q3u16, q4u16, q5u16, q6u16, q7u16, q8u16;
- uint16x8_t q9u16, q10u16, q11u16, q12u16, q13u16, q14u16;
-
- if (xoffset == 0) { // secondpass_bfilter16x16_only
- d0u8 = vdup_n_u8(bifilter4_coeff[yoffset][0]);
- d1u8 = vdup_n_u8(bifilter4_coeff[yoffset][1]);
-
- q11u8 = vld1q_u8(src_ptr);
- src_ptr += src_pixels_per_line;
- for (i = 4; i > 0; i--) {
- q12u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q13u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q14u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
- q15u8 = vld1q_u8(src_ptr); src_ptr += src_pixels_per_line;
-
- q1u16 = vmull_u8(vget_low_u8(q11u8), d0u8);
- q2u16 = vmull_u8(vget_high_u8(q11u8), d0u8);
- q3u16 = vmull_u8(vget_low_u8(q12u8), d0u8);
- q4u16 = vmull_u8(vget_high_u8(q12u8), d0u8);
- q5u16 = vmull_u8(vget_low_u8(q13u8), d0u8);
- q6u16 = vmull_u8(vget_high_u8(q13u8), d0u8);
- q7u16 = vmull_u8(vget_low_u8(q14u8), d0u8);
- q8u16 = vmull_u8(vget_high_u8(q14u8), d0u8);
-
- q1u16 = vmlal_u8(q1u16, vget_low_u8(q12u8), d1u8);
- q2u16 = vmlal_u8(q2u16, vget_high_u8(q12u8), d1u8);
- q3u16 = vmlal_u8(q3u16, vget_low_u8(q13u8), d1u8);
- q4u16 = vmlal_u8(q4u16, vget_high_u8(q13u8), d1u8);
- q5u16 = vmlal_u8(q5u16, vget_low_u8(q14u8), d1u8);
- q6u16 = vmlal_u8(q6u16, vget_high_u8(q14u8), d1u8);
- q7u16 = vmlal_u8(q7u16, vget_low_u8(q15u8), d1u8);
- q8u16 = vmlal_u8(q8u16, vget_high_u8(q15u8), d1u8);
-
- d2u8 = vqrshrn_n_u16(q1u16, 7);
- d3u8 = vqrshrn_n_u16(q2u16, 7);
- d4u8 = vqrshrn_n_u16(q3u16, 7);
- d5u8 = vqrshrn_n_u16(q4u16, 7);
- d6u8 = vqrshrn_n_u16(q5u16, 7);
- d7u8 = vqrshrn_n_u16(q6u16, 7);
- d8u8 = vqrshrn_n_u16(q7u16, 7);
- d9u8 = vqrshrn_n_u16(q8u16, 7);
-
- q1u8 = vcombine_u8(d2u8, d3u8);
- q2u8 = vcombine_u8(d4u8, d5u8);
- q3u8 = vcombine_u8(d6u8, d7u8);
- q4u8 = vcombine_u8(d8u8, d9u8);
-
- q11u8 = q15u8;
-
- vst1q_u8((uint8_t *)dst_ptr, q1u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q2u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q3u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q4u8); dst_ptr += dst_pitch;
- }
- return;
- }
-
- if (yoffset == 0) { // firstpass_bfilter16x16_only
- d0u8 = vdup_n_u8(bifilter4_coeff[xoffset][0]);
- d1u8 = vdup_n_u8(bifilter4_coeff[xoffset][1]);
-
- for (i = 4; i > 0 ; i--) {
- d2u8 = vld1_u8(src_ptr);
- d3u8 = vld1_u8(src_ptr + 8);
- d4u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d5u8 = vld1_u8(src_ptr);
- d6u8 = vld1_u8(src_ptr + 8);
- d7u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d8u8 = vld1_u8(src_ptr);
- d9u8 = vld1_u8(src_ptr + 8);
- d10u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d11u8 = vld1_u8(src_ptr);
- d12u8 = vld1_u8(src_ptr + 8);
- d13u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
-
- q7u16 = vmull_u8(d2u8, d0u8);
- q8u16 = vmull_u8(d3u8, d0u8);
- q9u16 = vmull_u8(d5u8, d0u8);
- q10u16 = vmull_u8(d6u8, d0u8);
- q11u16 = vmull_u8(d8u8, d0u8);
- q12u16 = vmull_u8(d9u8, d0u8);
- q13u16 = vmull_u8(d11u8, d0u8);
- q14u16 = vmull_u8(d12u8, d0u8);
-
- d2u8 = vext_u8(d2u8, d3u8, 1);
- d5u8 = vext_u8(d5u8, d6u8, 1);
- d8u8 = vext_u8(d8u8, d9u8, 1);
- d11u8 = vext_u8(d11u8, d12u8, 1);
-
- q7u16 = vmlal_u8(q7u16, d2u8, d1u8);
- q9u16 = vmlal_u8(q9u16, d5u8, d1u8);
- q11u16 = vmlal_u8(q11u16, d8u8, d1u8);
- q13u16 = vmlal_u8(q13u16, d11u8, d1u8);
-
- d3u8 = vext_u8(d3u8, d4u8, 1);
- d6u8 = vext_u8(d6u8, d7u8, 1);
- d9u8 = vext_u8(d9u8, d10u8, 1);
- d12u8 = vext_u8(d12u8, d13u8, 1);
-
- q8u16 = vmlal_u8(q8u16, d3u8, d1u8);
- q10u16 = vmlal_u8(q10u16, d6u8, d1u8);
- q12u16 = vmlal_u8(q12u16, d9u8, d1u8);
- q14u16 = vmlal_u8(q14u16, d12u8, d1u8);
-
- d14u8 = vqrshrn_n_u16(q7u16, 7);
- d15u8 = vqrshrn_n_u16(q8u16, 7);
- d16u8 = vqrshrn_n_u16(q9u16, 7);
- d17u8 = vqrshrn_n_u16(q10u16, 7);
- d18u8 = vqrshrn_n_u16(q11u16, 7);
- d19u8 = vqrshrn_n_u16(q12u16, 7);
- d20u8 = vqrshrn_n_u16(q13u16, 7);
- d21u8 = vqrshrn_n_u16(q14u16, 7);
-
- q7u8 = vcombine_u8(d14u8, d15u8);
- q8u8 = vcombine_u8(d16u8, d17u8);
- q9u8 = vcombine_u8(d18u8, d19u8);
- q10u8 =vcombine_u8(d20u8, d21u8);
-
- vst1q_u8((uint8_t *)dst_ptr, q7u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q8u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q9u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q10u8); dst_ptr += dst_pitch;
- }
- return;
- }
-
- d0u8 = vdup_n_u8(bifilter4_coeff[xoffset][0]);
- d1u8 = vdup_n_u8(bifilter4_coeff[xoffset][1]);
-
- d2u8 = vld1_u8(src_ptr);
- d3u8 = vld1_u8(src_ptr + 8);
- d4u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d5u8 = vld1_u8(src_ptr);
- d6u8 = vld1_u8(src_ptr + 8);
- d7u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d8u8 = vld1_u8(src_ptr);
- d9u8 = vld1_u8(src_ptr + 8);
- d10u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d11u8 = vld1_u8(src_ptr);
- d12u8 = vld1_u8(src_ptr + 8);
- d13u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
-
- // First Pass: output_height lines x output_width columns (17x16)
- tmpp = tmp;
- for (i = 3; i > 0; i--) {
- q7u16 = vmull_u8(d2u8, d0u8);
- q8u16 = vmull_u8(d3u8, d0u8);
- q9u16 = vmull_u8(d5u8, d0u8);
- q10u16 = vmull_u8(d6u8, d0u8);
- q11u16 = vmull_u8(d8u8, d0u8);
- q12u16 = vmull_u8(d9u8, d0u8);
- q13u16 = vmull_u8(d11u8, d0u8);
- q14u16 = vmull_u8(d12u8, d0u8);
-
- d2u8 = vext_u8(d2u8, d3u8, 1);
- d5u8 = vext_u8(d5u8, d6u8, 1);
- d8u8 = vext_u8(d8u8, d9u8, 1);
- d11u8 = vext_u8(d11u8, d12u8, 1);
-
- q7u16 = vmlal_u8(q7u16, d2u8, d1u8);
- q9u16 = vmlal_u8(q9u16, d5u8, d1u8);
- q11u16 = vmlal_u8(q11u16, d8u8, d1u8);
- q13u16 = vmlal_u8(q13u16, d11u8, d1u8);
-
- d3u8 = vext_u8(d3u8, d4u8, 1);
- d6u8 = vext_u8(d6u8, d7u8, 1);
- d9u8 = vext_u8(d9u8, d10u8, 1);
- d12u8 = vext_u8(d12u8, d13u8, 1);
-
- q8u16 = vmlal_u8(q8u16, d3u8, d1u8);
- q10u16 = vmlal_u8(q10u16, d6u8, d1u8);
- q12u16 = vmlal_u8(q12u16, d9u8, d1u8);
- q14u16 = vmlal_u8(q14u16, d12u8, d1u8);
-
- d14u8 = vqrshrn_n_u16(q7u16, 7);
- d15u8 = vqrshrn_n_u16(q8u16, 7);
- d16u8 = vqrshrn_n_u16(q9u16, 7);
- d17u8 = vqrshrn_n_u16(q10u16, 7);
- d18u8 = vqrshrn_n_u16(q11u16, 7);
- d19u8 = vqrshrn_n_u16(q12u16, 7);
- d20u8 = vqrshrn_n_u16(q13u16, 7);
- d21u8 = vqrshrn_n_u16(q14u16, 7);
-
- d2u8 = vld1_u8(src_ptr);
- d3u8 = vld1_u8(src_ptr + 8);
- d4u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d5u8 = vld1_u8(src_ptr);
- d6u8 = vld1_u8(src_ptr + 8);
- d7u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d8u8 = vld1_u8(src_ptr);
- d9u8 = vld1_u8(src_ptr + 8);
- d10u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
- d11u8 = vld1_u8(src_ptr);
- d12u8 = vld1_u8(src_ptr + 8);
- d13u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
-
- q7u8 = vcombine_u8(d14u8, d15u8);
- q8u8 = vcombine_u8(d16u8, d17u8);
- q9u8 = vcombine_u8(d18u8, d19u8);
- q10u8 = vcombine_u8(d20u8, d21u8);
-
- vst1q_u8((uint8_t *)tmpp, q7u8); tmpp += 16;
- vst1q_u8((uint8_t *)tmpp, q8u8); tmpp += 16;
- vst1q_u8((uint8_t *)tmpp, q9u8); tmpp += 16;
- vst1q_u8((uint8_t *)tmpp, q10u8); tmpp += 16;
- }
-
- // First-pass filtering for rest 5 lines
- d14u8 = vld1_u8(src_ptr);
- d15u8 = vld1_u8(src_ptr + 8);
- d16u8 = vld1_u8(src_ptr + 16); src_ptr += src_pixels_per_line;
-
- q9u16 = vmull_u8(d2u8, d0u8);
- q10u16 = vmull_u8(d3u8, d0u8);
- q11u16 = vmull_u8(d5u8, d0u8);
- q12u16 = vmull_u8(d6u8, d0u8);
- q13u16 = vmull_u8(d8u8, d0u8);
- q14u16 = vmull_u8(d9u8, d0u8);
-
- d2u8 = vext_u8(d2u8, d3u8, 1);
- d5u8 = vext_u8(d5u8, d6u8, 1);
- d8u8 = vext_u8(d8u8, d9u8, 1);
-
- q9u16 = vmlal_u8(q9u16, d2u8, d1u8);
- q11u16 = vmlal_u8(q11u16, d5u8, d1u8);
- q13u16 = vmlal_u8(q13u16, d8u8, d1u8);
-
- d3u8 = vext_u8(d3u8, d4u8, 1);
- d6u8 = vext_u8(d6u8, d7u8, 1);
- d9u8 = vext_u8(d9u8, d10u8, 1);
-
- q10u16 = vmlal_u8(q10u16, d3u8, d1u8);
- q12u16 = vmlal_u8(q12u16, d6u8, d1u8);
- q14u16 = vmlal_u8(q14u16, d9u8, d1u8);
-
- q1u16 = vmull_u8(d11u8, d0u8);
- q2u16 = vmull_u8(d12u8, d0u8);
- q3u16 = vmull_u8(d14u8, d0u8);
- q4u16 = vmull_u8(d15u8, d0u8);
-
- d11u8 = vext_u8(d11u8, d12u8, 1);
- d14u8 = vext_u8(d14u8, d15u8, 1);
-
- q1u16 = vmlal_u8(q1u16, d11u8, d1u8);
- q3u16 = vmlal_u8(q3u16, d14u8, d1u8);
-
- d12u8 = vext_u8(d12u8, d13u8, 1);
- d15u8 = vext_u8(d15u8, d16u8, 1);
-
- q2u16 = vmlal_u8(q2u16, d12u8, d1u8);
- q4u16 = vmlal_u8(q4u16, d15u8, d1u8);
-
- d10u8 = vqrshrn_n_u16(q9u16, 7);
- d11u8 = vqrshrn_n_u16(q10u16, 7);
- d12u8 = vqrshrn_n_u16(q11u16, 7);
- d13u8 = vqrshrn_n_u16(q12u16, 7);
- d14u8 = vqrshrn_n_u16(q13u16, 7);
- d15u8 = vqrshrn_n_u16(q14u16, 7);
- d16u8 = vqrshrn_n_u16(q1u16, 7);
- d17u8 = vqrshrn_n_u16(q2u16, 7);
- d18u8 = vqrshrn_n_u16(q3u16, 7);
- d19u8 = vqrshrn_n_u16(q4u16, 7);
-
- q5u8 = vcombine_u8(d10u8, d11u8);
- q6u8 = vcombine_u8(d12u8, d13u8);
- q7u8 = vcombine_u8(d14u8, d15u8);
- q8u8 = vcombine_u8(d16u8, d17u8);
- q9u8 = vcombine_u8(d18u8, d19u8);
-
- vst1q_u8((uint8_t *)tmpp, q5u8); tmpp += 16;
- vst1q_u8((uint8_t *)tmpp, q6u8); tmpp += 16;
- vst1q_u8((uint8_t *)tmpp, q7u8); tmpp += 16;
- vst1q_u8((uint8_t *)tmpp, q8u8); tmpp += 16;
- vst1q_u8((uint8_t *)tmpp, q9u8);
-
- // secondpass_filter
- d0u8 = vdup_n_u8(bifilter4_coeff[yoffset][0]);
- d1u8 = vdup_n_u8(bifilter4_coeff[yoffset][1]);
-
- tmpp = tmp;
- q11u8 = vld1q_u8(tmpp);
- tmpp += 16;
- for (i = 4; i > 0; i--) {
- q12u8 = vld1q_u8(tmpp); tmpp += 16;
- q13u8 = vld1q_u8(tmpp); tmpp += 16;
- q14u8 = vld1q_u8(tmpp); tmpp += 16;
- q15u8 = vld1q_u8(tmpp); tmpp += 16;
-
- q1u16 = vmull_u8(vget_low_u8(q11u8), d0u8);
- q2u16 = vmull_u8(vget_high_u8(q11u8), d0u8);
- q3u16 = vmull_u8(vget_low_u8(q12u8), d0u8);
- q4u16 = vmull_u8(vget_high_u8(q12u8), d0u8);
- q5u16 = vmull_u8(vget_low_u8(q13u8), d0u8);
- q6u16 = vmull_u8(vget_high_u8(q13u8), d0u8);
- q7u16 = vmull_u8(vget_low_u8(q14u8), d0u8);
- q8u16 = vmull_u8(vget_high_u8(q14u8), d0u8);
-
- q1u16 = vmlal_u8(q1u16, vget_low_u8(q12u8), d1u8);
- q2u16 = vmlal_u8(q2u16, vget_high_u8(q12u8), d1u8);
- q3u16 = vmlal_u8(q3u16, vget_low_u8(q13u8), d1u8);
- q4u16 = vmlal_u8(q4u16, vget_high_u8(q13u8), d1u8);
- q5u16 = vmlal_u8(q5u16, vget_low_u8(q14u8), d1u8);
- q6u16 = vmlal_u8(q6u16, vget_high_u8(q14u8), d1u8);
- q7u16 = vmlal_u8(q7u16, vget_low_u8(q15u8), d1u8);
- q8u16 = vmlal_u8(q8u16, vget_high_u8(q15u8), d1u8);
-
- d2u8 = vqrshrn_n_u16(q1u16, 7);
- d3u8 = vqrshrn_n_u16(q2u16, 7);
- d4u8 = vqrshrn_n_u16(q3u16, 7);
- d5u8 = vqrshrn_n_u16(q4u16, 7);
- d6u8 = vqrshrn_n_u16(q5u16, 7);
- d7u8 = vqrshrn_n_u16(q6u16, 7);
- d8u8 = vqrshrn_n_u16(q7u16, 7);
- d9u8 = vqrshrn_n_u16(q8u16, 7);
-
- q1u8 = vcombine_u8(d2u8, d3u8);
- q2u8 = vcombine_u8(d4u8, d5u8);
- q3u8 = vcombine_u8(d6u8, d7u8);
- q4u8 = vcombine_u8(d8u8, d9u8);
-
- q11u8 = q15u8;
-
- vst1q_u8((uint8_t *)dst_ptr, q1u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q2u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q3u8); dst_ptr += dst_pitch;
- vst1q_u8((uint8_t *)dst_ptr, q4u8); dst_ptr += dst_pitch;
- }
- return;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
deleted file mode 100644
index e3ea91f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
+++ /dev/null
@@ -1,584 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_build_intra_predictors_mby_neon_func|
- EXPORT |vp8_build_intra_predictors_mby_s_neon_func|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-; r0 unsigned char *y_buffer
-; r1 unsigned char *ypred_ptr
-; r2 int y_stride
-; r3 int mode
-; stack int Up
-; stack int Left
-
-|vp8_build_intra_predictors_mby_neon_func| PROC
- push {r4-r8, lr}
-
- cmp r3, #0
- beq case_dc_pred
- cmp r3, #1
- beq case_v_pred
- cmp r3, #2
- beq case_h_pred
- cmp r3, #3
- beq case_tm_pred
-
-case_dc_pred
- ldr r4, [sp, #24] ; Up
- ldr r5, [sp, #28] ; Left
-
- ; Default the DC average to 128
- mov r12, #128
- vdup.u8 q0, r12
-
- ; Zero out running sum
- mov r12, #0
-
- ; compute shift and jump
- adds r7, r4, r5
- beq skip_dc_pred_up_left
-
- ; Load above row, if it exists
- cmp r4, #0
- beq skip_dc_pred_up
-
- sub r6, r0, r2
- vld1.8 {q1}, [r6]
- vpaddl.u8 q2, q1
- vpaddl.u16 q3, q2
- vpaddl.u32 q4, q3
-
- vmov.32 r4, d8[0]
- vmov.32 r6, d9[0]
-
- add r12, r4, r6
-
- ; Move back to interger registers
-
-skip_dc_pred_up
-
- cmp r5, #0
- beq skip_dc_pred_left
-
- sub r0, r0, #1
-
- ; Load left row, if it exists
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0]
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
-skip_dc_pred_left
- add r7, r7, #3 ; Shift
- sub r4, r7, #1
- mov r5, #1
- add r12, r12, r5, lsl r4
- mov r5, r12, lsr r7 ; expected_dc
-
- vdup.u8 q0, r5
-
-skip_dc_pred_up_left
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
-
- pop {r4-r8,pc}
-case_v_pred
- ; Copy down above row
- sub r6, r0, r2
- vld1.8 {q0}, [r6]
-
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q0}, [r1]!
- pop {r4-r8,pc}
-
-case_h_pred
- ; Load 4x yleft_col
- sub r0, r0, #1
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q1}, [r1]!
- vst1.u8 {q2}, [r1]!
- vst1.u8 {q3}, [r1]!
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q1}, [r1]!
- vst1.u8 {q2}, [r1]!
- vst1.u8 {q3}, [r1]!
-
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q1}, [r1]!
- vst1.u8 {q2}, [r1]!
- vst1.u8 {q3}, [r1]!
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q1}, [r1]!
- vst1.u8 {q2}, [r1]!
- vst1.u8 {q3}, [r1]!
-
- pop {r4-r8,pc}
-
-case_tm_pred
- ; Load yabove_row
- sub r3, r0, r2
- vld1.8 {q8}, [r3]
-
- ; Load ytop_left
- sub r3, r3, #1
- ldrb r7, [r3]
-
- vdup.u16 q7, r7
-
- ; Compute yabove_row - ytop_left
- mov r3, #1
- vdup.u8 q0, r3
-
- vmull.u8 q4, d16, d0
- vmull.u8 q5, d17, d0
-
- vsub.s16 q4, q4, q7
- vsub.s16 q5, q5, q7
-
- ; Load 4x yleft_col
- sub r0, r0, #1
- mov r12, #4
-
-case_tm_pred_loop
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u16 q0, r3
- vdup.u16 q1, r4
- vdup.u16 q2, r5
- vdup.u16 q3, r6
-
- vqadd.s16 q8, q0, q4
- vqadd.s16 q9, q0, q5
-
- vqadd.s16 q10, q1, q4
- vqadd.s16 q11, q1, q5
-
- vqadd.s16 q12, q2, q4
- vqadd.s16 q13, q2, q5
-
- vqadd.s16 q14, q3, q4
- vqadd.s16 q15, q3, q5
-
- vqshrun.s16 d0, q8, #0
- vqshrun.s16 d1, q9, #0
-
- vqshrun.s16 d2, q10, #0
- vqshrun.s16 d3, q11, #0
-
- vqshrun.s16 d4, q12, #0
- vqshrun.s16 d5, q13, #0
-
- vqshrun.s16 d6, q14, #0
- vqshrun.s16 d7, q15, #0
-
- vst1.u8 {q0}, [r1]!
- vst1.u8 {q1}, [r1]!
- vst1.u8 {q2}, [r1]!
- vst1.u8 {q3}, [r1]!
-
- subs r12, r12, #1
- bne case_tm_pred_loop
-
- pop {r4-r8,pc}
-
- ENDP
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; r0 unsigned char *y_buffer
-; r1 unsigned char *ypred_ptr
-; r2 int y_stride
-; r3 int mode
-; stack int Up
-; stack int Left
-
-|vp8_build_intra_predictors_mby_s_neon_func| PROC
- push {r4-r8, lr}
-
- mov r1, r0 ; unsigned char *ypred_ptr = x->dst.y_buffer; //x->Predictor;
-
- cmp r3, #0
- beq case_dc_pred_s
- cmp r3, #1
- beq case_v_pred_s
- cmp r3, #2
- beq case_h_pred_s
- cmp r3, #3
- beq case_tm_pred_s
-
-case_dc_pred_s
- ldr r4, [sp, #24] ; Up
- ldr r5, [sp, #28] ; Left
-
- ; Default the DC average to 128
- mov r12, #128
- vdup.u8 q0, r12
-
- ; Zero out running sum
- mov r12, #0
-
- ; compute shift and jump
- adds r7, r4, r5
- beq skip_dc_pred_up_left_s
-
- ; Load above row, if it exists
- cmp r4, #0
- beq skip_dc_pred_up_s
-
- sub r6, r0, r2
- vld1.8 {q1}, [r6]
- vpaddl.u8 q2, q1
- vpaddl.u16 q3, q2
- vpaddl.u32 q4, q3
-
- vmov.32 r4, d8[0]
- vmov.32 r6, d9[0]
-
- add r12, r4, r6
-
- ; Move back to interger registers
-
-skip_dc_pred_up_s
-
- cmp r5, #0
- beq skip_dc_pred_left_s
-
- sub r0, r0, #1
-
- ; Load left row, if it exists
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0]
-
- add r12, r12, r3
- add r12, r12, r4
- add r12, r12, r5
- add r12, r12, r6
-
-skip_dc_pred_left_s
- add r7, r7, #3 ; Shift
- sub r4, r7, #1
- mov r5, #1
- add r12, r12, r5, lsl r4
- mov r5, r12, lsr r7 ; expected_dc
-
- vdup.u8 q0, r5
-
-skip_dc_pred_up_left_s
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
-
- pop {r4-r8,pc}
-case_v_pred_s
- ; Copy down above row
- sub r6, r0, r2
- vld1.8 {q0}, [r6]
-
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q0}, [r1], r2
- pop {r4-r8,pc}
-
-case_h_pred_s
- ; Load 4x yleft_col
- sub r0, r0, #1
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q1}, [r1], r2
- vst1.u8 {q2}, [r1], r2
- vst1.u8 {q3}, [r1], r2
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q1}, [r1], r2
- vst1.u8 {q2}, [r1], r2
- vst1.u8 {q3}, [r1], r2
-
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q1}, [r1], r2
- vst1.u8 {q2}, [r1], r2
- vst1.u8 {q3}, [r1], r2
-
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u8 q0, r3
- vdup.u8 q1, r4
- vdup.u8 q2, r5
- vdup.u8 q3, r6
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q1}, [r1], r2
- vst1.u8 {q2}, [r1], r2
- vst1.u8 {q3}, [r1], r2
-
- pop {r4-r8,pc}
-
-case_tm_pred_s
- ; Load yabove_row
- sub r3, r0, r2
- vld1.8 {q8}, [r3]
-
- ; Load ytop_left
- sub r3, r3, #1
- ldrb r7, [r3]
-
- vdup.u16 q7, r7
-
- ; Compute yabove_row - ytop_left
- mov r3, #1
- vdup.u8 q0, r3
-
- vmull.u8 q4, d16, d0
- vmull.u8 q5, d17, d0
-
- vsub.s16 q4, q4, q7
- vsub.s16 q5, q5, q7
-
- ; Load 4x yleft_col
- sub r0, r0, #1
- mov r12, #4
-
-case_tm_pred_loop_s
- ldrb r3, [r0], r2
- ldrb r4, [r0], r2
- ldrb r5, [r0], r2
- ldrb r6, [r0], r2
- vdup.u16 q0, r3
- vdup.u16 q1, r4
- vdup.u16 q2, r5
- vdup.u16 q3, r6
-
- vqadd.s16 q8, q0, q4
- vqadd.s16 q9, q0, q5
-
- vqadd.s16 q10, q1, q4
- vqadd.s16 q11, q1, q5
-
- vqadd.s16 q12, q2, q4
- vqadd.s16 q13, q2, q5
-
- vqadd.s16 q14, q3, q4
- vqadd.s16 q15, q3, q5
-
- vqshrun.s16 d0, q8, #0
- vqshrun.s16 d1, q9, #0
-
- vqshrun.s16 d2, q10, #0
- vqshrun.s16 d3, q11, #0
-
- vqshrun.s16 d4, q12, #0
- vqshrun.s16 d5, q13, #0
-
- vqshrun.s16 d6, q14, #0
- vqshrun.s16 d7, q15, #0
-
- vst1.u8 {q0}, [r1], r2
- vst1.u8 {q1}, [r1], r2
- vst1.u8 {q2}, [r1], r2
- vst1.u8 {q3}, [r1], r2
-
- subs r12, r12, #1
- bne case_tm_pred_loop_s
-
- pop {r4-r8,pc}
-
- ENDP
-
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/copymem_neon.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/copymem_neon.c
deleted file mode 100644
index deced11..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/copymem_neon.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <arm_neon.h>
-
-void vp8_copy_mem8x4_neon(
- unsigned char *src,
- int src_stride,
- unsigned char *dst,
- int dst_stride) {
- uint8x8_t vtmp;
- int r;
-
- for (r = 0; r < 4; r++) {
- vtmp = vld1_u8(src);
- vst1_u8(dst, vtmp);
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp8_copy_mem8x8_neon(
- unsigned char *src,
- int src_stride,
- unsigned char *dst,
- int dst_stride) {
- uint8x8_t vtmp;
- int r;
-
- for (r = 0; r < 8; r++) {
- vtmp = vld1_u8(src);
- vst1_u8(dst, vtmp);
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp8_copy_mem16x16_neon(
- unsigned char *src,
- int src_stride,
- unsigned char *dst,
- int dst_stride) {
- int r;
- uint8x16_t qtmp;
-
- for (r = 0; r < 16; r++) {
- qtmp = vld1q_u8(src);
- vst1q_u8(dst, qtmp);
- src += src_stride;
- dst += dst_stride;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dc_only_idct_add_neon.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dc_only_idct_add_neon.c
deleted file mode 100644
index ad5f41d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dc_only_idct_add_neon.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <arm_neon.h>
-
-void vp8_dc_only_idct_add_neon(
- int16_t input_dc,
- unsigned char *pred_ptr,
- int pred_stride,
- unsigned char *dst_ptr,
- int dst_stride) {
- int i;
- uint16_t a1 = ((input_dc + 4) >> 3);
- uint32x2_t d2u32 = vdup_n_u32(0);
- uint8x8_t d2u8;
- uint16x8_t q1u16;
- uint16x8_t qAdd;
-
- qAdd = vdupq_n_u16(a1);
-
- for (i = 0; i < 2; i++) {
- d2u32 = vld1_lane_u32((const uint32_t *)pred_ptr, d2u32, 0);
- pred_ptr += pred_stride;
- d2u32 = vld1_lane_u32((const uint32_t *)pred_ptr, d2u32, 1);
- pred_ptr += pred_stride;
-
- q1u16 = vaddw_u8(qAdd, vreinterpret_u8_u32(d2u32));
- d2u8 = vqmovun_s16(vreinterpretq_s16_u16(q1u16));
-
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 0);
- dst_ptr += dst_stride;
- vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 1);
- dst_ptr += dst_stride;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequant_idct_neon.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequant_idct_neon.c
deleted file mode 100644
index 58e1192..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequant_idct_neon.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <arm_neon.h>
-
-static const int16_t cospi8sqrt2minus1 = 20091;
-static const int16_t sinpi8sqrt2 = 35468;
-
-void vp8_dequant_idct_add_neon(
- int16_t *input,
- int16_t *dq,
- unsigned char *dst,
- int stride) {
- unsigned char *dst0;
- int32x2_t d14, d15;
- int16x4_t d2, d3, d4, d5, d10, d11, d12, d13;
- int16x8_t q1, q2, q3, q4, q5, q6;
- int16x8_t qEmpty = vdupq_n_s16(0);
- int32x2x2_t d2tmp0, d2tmp1;
- int16x4x2_t d2tmp2, d2tmp3;
-
- d14 = d15 = vdup_n_s32(0);
-
- // load input
- q3 = vld1q_s16(input);
- vst1q_s16(input, qEmpty);
- input += 8;
- q4 = vld1q_s16(input);
- vst1q_s16(input, qEmpty);
-
- // load dq
- q5 = vld1q_s16(dq);
- dq += 8;
- q6 = vld1q_s16(dq);
-
- // load src from dst
- dst0 = dst;
- d14 = vld1_lane_s32((const int32_t *)dst0, d14, 0);
- dst0 += stride;
- d14 = vld1_lane_s32((const int32_t *)dst0, d14, 1);
- dst0 += stride;
- d15 = vld1_lane_s32((const int32_t *)dst0, d15, 0);
- dst0 += stride;
- d15 = vld1_lane_s32((const int32_t *)dst0, d15, 1);
-
- q1 = vreinterpretq_s16_u16(vmulq_u16(vreinterpretq_u16_s16(q3),
- vreinterpretq_u16_s16(q5)));
- q2 = vreinterpretq_s16_u16(vmulq_u16(vreinterpretq_u16_s16(q4),
- vreinterpretq_u16_s16(q6)));
-
- d12 = vqadd_s16(vget_low_s16(q1), vget_low_s16(q2));
- d13 = vqsub_s16(vget_low_s16(q1), vget_low_s16(q2));
-
- q2 = vcombine_s16(vget_high_s16(q1), vget_high_s16(q2));
-
- q3 = vqdmulhq_n_s16(q2, sinpi8sqrt2);
- q4 = vqdmulhq_n_s16(q2, cospi8sqrt2minus1);
-
- q3 = vshrq_n_s16(q3, 1);
- q4 = vshrq_n_s16(q4, 1);
-
- q3 = vqaddq_s16(q3, q2);
- q4 = vqaddq_s16(q4, q2);
-
- d10 = vqsub_s16(vget_low_s16(q3), vget_high_s16(q4));
- d11 = vqadd_s16(vget_high_s16(q3), vget_low_s16(q4));
-
- d2 = vqadd_s16(d12, d11);
- d3 = vqadd_s16(d13, d10);
- d4 = vqsub_s16(d13, d10);
- d5 = vqsub_s16(d12, d11);
-
- d2tmp0 = vtrn_s32(vreinterpret_s32_s16(d2), vreinterpret_s32_s16(d4));
- d2tmp1 = vtrn_s32(vreinterpret_s32_s16(d3), vreinterpret_s32_s16(d5));
- d2tmp2 = vtrn_s16(vreinterpret_s16_s32(d2tmp0.val[0]),
- vreinterpret_s16_s32(d2tmp1.val[0]));
- d2tmp3 = vtrn_s16(vreinterpret_s16_s32(d2tmp0.val[1]),
- vreinterpret_s16_s32(d2tmp1.val[1]));
-
- // loop 2
- q2 = vcombine_s16(d2tmp2.val[1], d2tmp3.val[1]);
-
- q3 = vqdmulhq_n_s16(q2, sinpi8sqrt2);
- q4 = vqdmulhq_n_s16(q2, cospi8sqrt2minus1);
-
- d12 = vqadd_s16(d2tmp2.val[0], d2tmp3.val[0]);
- d13 = vqsub_s16(d2tmp2.val[0], d2tmp3.val[0]);
-
- q3 = vshrq_n_s16(q3, 1);
- q4 = vshrq_n_s16(q4, 1);
-
- q3 = vqaddq_s16(q3, q2);
- q4 = vqaddq_s16(q4, q2);
-
- d10 = vqsub_s16(vget_low_s16(q3), vget_high_s16(q4));
- d11 = vqadd_s16(vget_high_s16(q3), vget_low_s16(q4));
-
- d2 = vqadd_s16(d12, d11);
- d3 = vqadd_s16(d13, d10);
- d4 = vqsub_s16(d13, d10);
- d5 = vqsub_s16(d12, d11);
-
- d2 = vrshr_n_s16(d2, 3);
- d3 = vrshr_n_s16(d3, 3);
- d4 = vrshr_n_s16(d4, 3);
- d5 = vrshr_n_s16(d5, 3);
-
- d2tmp0 = vtrn_s32(vreinterpret_s32_s16(d2), vreinterpret_s32_s16(d4));
- d2tmp1 = vtrn_s32(vreinterpret_s32_s16(d3), vreinterpret_s32_s16(d5));
- d2tmp2 = vtrn_s16(vreinterpret_s16_s32(d2tmp0.val[0]),
- vreinterpret_s16_s32(d2tmp1.val[0]));
- d2tmp3 = vtrn_s16(vreinterpret_s16_s32(d2tmp0.val[1]),
- vreinterpret_s16_s32(d2tmp1.val[1]));
-
- q1 = vcombine_s16(d2tmp2.val[0], d2tmp2.val[1]);
- q2 = vcombine_s16(d2tmp3.val[0], d2tmp3.val[1]);
-
- q1 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q1),
- vreinterpret_u8_s32(d14)));
- q2 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q2),
- vreinterpret_u8_s32(d15)));
-
- d14 = vreinterpret_s32_u8(vqmovun_s16(q1));
- d15 = vreinterpret_s32_u8(vqmovun_s16(q2));
-
- dst0 = dst;
- vst1_lane_s32((int32_t *)dst0, d14, 0);
- dst0 += stride;
- vst1_lane_s32((int32_t *)dst0, d14, 1);
- dst0 += stride;
- vst1_lane_s32((int32_t *)dst0, d15, 0);
- dst0 += stride;
- vst1_lane_s32((int32_t *)dst0, d15, 1);
- return;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequantizeb_neon.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequantizeb_neon.c
deleted file mode 100644
index 60f69c8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/dequantizeb_neon.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <arm_neon.h>
-
-void vp8_dequantize_b_loop_neon(
- int16_t *Q,
- int16_t *DQC,
- int16_t *DQ) {
- int16x8x2_t qQ, qDQC, qDQ;
-
- qQ = vld2q_s16(Q);
- qDQC = vld2q_s16(DQC);
-
- qDQ.val[0] = vmulq_s16(qQ.val[0], qDQC.val[0]);
- qDQ.val[1] = vmulq_s16(qQ.val[1], qDQC.val[1]);
-
- vst2q_s16(DQ, qDQ);
- return;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_blk_neon.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_blk_neon.c
deleted file mode 100644
index fb327a7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_blk_neon.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-
-/* place these declarations here because we don't want to maintain them
- * outside of this scope
- */
-void idct_dequant_full_2x_neon(short *q, short *dq,
- unsigned char *dst, int stride);
-void idct_dequant_0_2x_neon(short *q, short dq,
- unsigned char *dst, int stride);
-
-
-void vp8_dequant_idct_add_y_block_neon(short *q, short *dq,
- unsigned char *dst,
- int stride, char *eobs)
-{
- int i;
-
- for (i = 0; i < 4; i++)
- {
- if (((short *)(eobs))[0])
- {
- if (((short *)eobs)[0] & 0xfefe)
- idct_dequant_full_2x_neon (q, dq, dst, stride);
- else
- idct_dequant_0_2x_neon (q, dq[0], dst, stride);
- }
-
- if (((short *)(eobs))[1])
- {
- if (((short *)eobs)[1] & 0xfefe)
- idct_dequant_full_2x_neon (q+32, dq, dst+8, stride);
- else
- idct_dequant_0_2x_neon (q+32, dq[0], dst+8, stride);
- }
- q += 64;
- dst += 4*stride;
- eobs += 4;
- }
-}
-
-void vp8_dequant_idct_add_uv_block_neon(short *q, short *dq,
- unsigned char *dstu,
- unsigned char *dstv,
- int stride, char *eobs)
-{
- if (((short *)(eobs))[0])
- {
- if (((short *)eobs)[0] & 0xfefe)
- idct_dequant_full_2x_neon (q, dq, dstu, stride);
- else
- idct_dequant_0_2x_neon (q, dq[0], dstu, stride);
- }
-
- q += 32;
- dstu += 4*stride;
-
- if (((short *)(eobs))[1])
- {
- if (((short *)eobs)[1] & 0xfefe)
- idct_dequant_full_2x_neon (q, dq, dstu, stride);
- else
- idct_dequant_0_2x_neon (q, dq[0], dstu, stride);
- }
-
- q += 32;
-
- if (((short *)(eobs))[2])
- {
- if (((short *)eobs)[2] & 0xfefe)
- idct_dequant_full_2x_neon (q, dq, dstv, stride);
- else
- idct_dequant_0_2x_neon (q, dq[0], dstv, stride);
- }
-
- q += 32;
- dstv += 4*stride;
-
- if (((short *)(eobs))[3])
- {
- if (((short *)eobs)[3] & 0xfefe)
- idct_dequant_full_2x_neon (q, dq, dstv, stride);
- else
- idct_dequant_0_2x_neon (q, dq[0], dstv, stride);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_0_2x_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_0_2x_neon.asm
deleted file mode 100644
index 6c29c55..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_0_2x_neon.asm
+++ /dev/null
@@ -1,79 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
-
- EXPORT |idct_dequant_0_2x_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-;void idct_dequant_0_2x_neon(short *q, short dq,
-; unsigned char *dst, int stride);
-; r0 *q
-; r1 dq
-; r2 *dst
-; r3 stride
-|idct_dequant_0_2x_neon| PROC
- push {r4, r5}
-
- add r12, r2, #4
- vld1.32 {d2[0]}, [r2], r3
- vld1.32 {d8[0]}, [r12], r3
- vld1.32 {d2[1]}, [r2], r3
- vld1.32 {d8[1]}, [r12], r3
- vld1.32 {d4[0]}, [r2], r3
- vld1.32 {d10[0]}, [r12], r3
- vld1.32 {d4[1]}, [r2], r3
- vld1.32 {d10[1]}, [r12], r3
-
- ldrh r12, [r0] ; lo q
- ldrh r4, [r0, #32] ; hi q
- mov r5, #0
- strh r5, [r0]
- strh r5, [r0, #32]
-
- sxth r12, r12 ; lo
- mul r0, r12, r1
- add r0, r0, #4
- asr r0, r0, #3
- vdup.16 q0, r0
- sxth r4, r4 ; hi
- mul r0, r4, r1
- add r0, r0, #4
- asr r0, r0, #3
- vdup.16 q3, r0
-
- vaddw.u8 q1, q0, d2 ; lo
- vaddw.u8 q2, q0, d4
- vaddw.u8 q4, q3, d8 ; hi
- vaddw.u8 q5, q3, d10
-
- sub r2, r2, r3, lsl #2 ; dst - 4*stride
- add r0, r2, #4
-
- vqmovun.s16 d2, q1 ; lo
- vqmovun.s16 d4, q2
- vqmovun.s16 d8, q4 ; hi
- vqmovun.s16 d10, q5
-
- vst1.32 {d2[0]}, [r2], r3 ; lo
- vst1.32 {d8[0]}, [r0], r3 ; hi
- vst1.32 {d2[1]}, [r2], r3
- vst1.32 {d8[1]}, [r0], r3
- vst1.32 {d4[0]}, [r2], r3
- vst1.32 {d10[0]}, [r0], r3
- vst1.32 {d4[1]}, [r2]
- vst1.32 {d10[1]}, [r0]
-
- pop {r4, r5}
- bx lr
-
- ENDP ; |idct_dequant_0_2x_neon|
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_full_2x_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_full_2x_neon.asm
deleted file mode 100644
index d5dce63..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/idct_dequant_full_2x_neon.asm
+++ /dev/null
@@ -1,196 +0,0 @@
-;
-; Copyright (c) 2010 The Webm project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |idct_dequant_full_2x_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-;void idct_dequant_full_2x_neon(short *q, short *dq,
-; unsigned char *dst, int stride);
-; r0 *q,
-; r1 *dq,
-; r2 *dst
-; r3 stride
-|idct_dequant_full_2x_neon| PROC
- vld1.16 {q0, q1}, [r1] ; dq (same l/r)
- vld1.16 {q2, q3}, [r0] ; l q
- add r0, r0, #32
- vld1.16 {q4, q5}, [r0] ; r q
- add r12, r2, #4
-
- ; interleave the predictors
- vld1.32 {d28[0]}, [r2], r3 ; l pre
- vld1.32 {d28[1]}, [r12], r3 ; r pre
- vld1.32 {d29[0]}, [r2], r3
- vld1.32 {d29[1]}, [r12], r3
- vld1.32 {d30[0]}, [r2], r3
- vld1.32 {d30[1]}, [r12], r3
- vld1.32 {d31[0]}, [r2], r3
- vld1.32 {d31[1]}, [r12]
-
- adr r1, cospi8sqrt2minus1 ; pointer to the first constant
-
- ; dequant: q[i] = q[i] * dq[i]
- vmul.i16 q2, q2, q0
- vmul.i16 q3, q3, q1
- vmul.i16 q4, q4, q0
- vmul.i16 q5, q5, q1
-
- vld1.16 {d0}, [r1]
-
- ; q2: l0r0 q3: l8r8
- ; q4: l4r4 q5: l12r12
- vswp d5, d8
- vswp d7, d10
-
- ; _CONSTANTS_ * 4,12 >> 16
- ; q6: 4 * sinpi : c1/temp1
- ; q7: 12 * sinpi : d1/temp2
- ; q8: 4 * cospi
- ; q9: 12 * cospi
- vqdmulh.s16 q6, q4, d0[2] ; sinpi8sqrt2
- vqdmulh.s16 q7, q5, d0[2]
- vqdmulh.s16 q8, q4, d0[0] ; cospi8sqrt2minus1
- vqdmulh.s16 q9, q5, d0[0]
-
- vqadd.s16 q10, q2, q3 ; a1 = 0 + 8
- vqsub.s16 q11, q2, q3 ; b1 = 0 - 8
-
- ; vqdmulh only accepts signed values. this was a problem because
- ; our constant had the high bit set, and was treated as a negative value.
- ; vqdmulh also doubles the value before it shifts by 16. we need to
- ; compensate for this. in the case of sinpi8sqrt2, the lowest bit is 0,
- ; so we can shift the constant without losing precision. this avoids
- ; shift again afterward, but also avoids the sign issue. win win!
- ; for cospi8sqrt2minus1 the lowest bit is 1, so we lose precision if we
- ; pre-shift it
- vshr.s16 q8, q8, #1
- vshr.s16 q9, q9, #1
-
- ; q4: 4 + 4 * cospi : d1/temp1
- ; q5: 12 + 12 * cospi : c1/temp2
- vqadd.s16 q4, q4, q8
- vqadd.s16 q5, q5, q9
-
- ; c1 = temp1 - temp2
- ; d1 = temp1 + temp2
- vqsub.s16 q2, q6, q5
- vqadd.s16 q3, q4, q7
-
- ; [0]: a1+d1
- ; [1]: b1+c1
- ; [2]: b1-c1
- ; [3]: a1-d1
- vqadd.s16 q4, q10, q3
- vqadd.s16 q5, q11, q2
- vqsub.s16 q6, q11, q2
- vqsub.s16 q7, q10, q3
-
- ; rotate
- vtrn.32 q4, q6
- vtrn.32 q5, q7
- vtrn.16 q4, q5
- vtrn.16 q6, q7
- ; idct loop 2
- ; q4: l 0, 4, 8,12 r 0, 4, 8,12
- ; q5: l 1, 5, 9,13 r 1, 5, 9,13
- ; q6: l 2, 6,10,14 r 2, 6,10,14
- ; q7: l 3, 7,11,15 r 3, 7,11,15
-
- ; q8: 1 * sinpi : c1/temp1
- ; q9: 3 * sinpi : d1/temp2
- ; q10: 1 * cospi
- ; q11: 3 * cospi
- vqdmulh.s16 q8, q5, d0[2] ; sinpi8sqrt2
- vqdmulh.s16 q9, q7, d0[2]
- vqdmulh.s16 q10, q5, d0[0] ; cospi8sqrt2minus1
- vqdmulh.s16 q11, q7, d0[0]
-
- vqadd.s16 q2, q4, q6 ; a1 = 0 + 2
- vqsub.s16 q3, q4, q6 ; b1 = 0 - 2
-
- ; see note on shifting above
- vshr.s16 q10, q10, #1
- vshr.s16 q11, q11, #1
-
- ; q10: 1 + 1 * cospi : d1/temp1
- ; q11: 3 + 3 * cospi : c1/temp2
- vqadd.s16 q10, q5, q10
- vqadd.s16 q11, q7, q11
-
- ; q8: c1 = temp1 - temp2
- ; q9: d1 = temp1 + temp2
- vqsub.s16 q8, q8, q11
- vqadd.s16 q9, q10, q9
-
- ; a1+d1
- ; b1+c1
- ; b1-c1
- ; a1-d1
- vqadd.s16 q4, q2, q9
- vqadd.s16 q5, q3, q8
- vqsub.s16 q6, q3, q8
- vqsub.s16 q7, q2, q9
-
- ; +4 >> 3 (rounding)
- vrshr.s16 q4, q4, #3 ; lo
- vrshr.s16 q5, q5, #3
- vrshr.s16 q6, q6, #3 ; hi
- vrshr.s16 q7, q7, #3
-
- vtrn.32 q4, q6
- vtrn.32 q5, q7
- vtrn.16 q4, q5
- vtrn.16 q6, q7
-
- ; adding pre
- ; input is still packed. pre was read interleaved
- vaddw.u8 q4, q4, d28
- vaddw.u8 q5, q5, d29
- vaddw.u8 q6, q6, d30
- vaddw.u8 q7, q7, d31
-
- vmov.i16 q14, #0
- vmov q15, q14
- vst1.16 {q14, q15}, [r0] ; write over high input
- sub r0, r0, #32
- vst1.16 {q14, q15}, [r0] ; write over low input
-
- sub r2, r2, r3, lsl #2 ; dst - 4*stride
- add r1, r2, #4 ; hi
-
- ;saturate and narrow
- vqmovun.s16 d0, q4 ; lo
- vqmovun.s16 d1, q5
- vqmovun.s16 d2, q6 ; hi
- vqmovun.s16 d3, q7
-
- vst1.32 {d0[0]}, [r2], r3 ; lo
- vst1.32 {d0[1]}, [r1], r3 ; hi
- vst1.32 {d1[0]}, [r2], r3
- vst1.32 {d1[1]}, [r1], r3
- vst1.32 {d2[0]}, [r2], r3
- vst1.32 {d2[1]}, [r1], r3
- vst1.32 {d3[0]}, [r2]
- vst1.32 {d3[1]}, [r1]
-
- bx lr
-
- ENDP ; |idct_dequant_full_2x_neon|
-
-; Constant Pool
-cospi8sqrt2minus1 DCD 0x4e7b
-; because the lowest bit in 0x8a8c is 0, we can pre-shift this
-sinpi8sqrt2 DCD 0x4546
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/iwalsh_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/iwalsh_neon.asm
deleted file mode 100644
index e8ea2a6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/iwalsh_neon.asm
+++ /dev/null
@@ -1,87 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
- EXPORT |vp8_short_inv_walsh4x4_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY ; name this block of code
-
-;short vp8_short_inv_walsh4x4_neon(short *input, short *mb_dqcoeff)
-|vp8_short_inv_walsh4x4_neon| PROC
-
- ; read in all four lines of values: d0->d3
- vld1.i16 {q0-q1}, [r0@128]
-
- ; first for loop
- vadd.s16 d4, d0, d3 ;a = [0] + [12]
- vadd.s16 d6, d1, d2 ;b = [4] + [8]
- vsub.s16 d5, d0, d3 ;d = [0] - [12]
- vsub.s16 d7, d1, d2 ;c = [4] - [8]
-
- vadd.s16 q0, q2, q3 ; a+b d+c
- vsub.s16 q1, q2, q3 ; a-b d-c
-
- vtrn.32 d0, d2 ;d0: 0 1 8 9
- ;d2: 2 3 10 11
- vtrn.32 d1, d3 ;d1: 4 5 12 13
- ;d3: 6 7 14 15
-
- vtrn.16 d0, d1 ;d0: 0 4 8 12
- ;d1: 1 5 9 13
- vtrn.16 d2, d3 ;d2: 2 6 10 14
- ;d3: 3 7 11 15
-
- ; second for loop
-
- vadd.s16 d4, d0, d3 ;a = [0] + [3]
- vadd.s16 d6, d1, d2 ;b = [1] + [2]
- vsub.s16 d5, d0, d3 ;d = [0] - [3]
- vsub.s16 d7, d1, d2 ;c = [1] - [2]
-
- vmov.i16 q8, #3
-
- vadd.s16 q0, q2, q3 ; a+b d+c
- vsub.s16 q1, q2, q3 ; a-b d-c
-
- vadd.i16 q0, q0, q8 ;e/f += 3
- vadd.i16 q1, q1, q8 ;g/h += 3
-
- vshr.s16 q0, q0, #3 ;e/f >> 3
- vshr.s16 q1, q1, #3 ;g/h >> 3
-
- mov r2, #64
- add r3, r1, #32
-
- vst1.i16 d0[0], [r1],r2
- vst1.i16 d1[0], [r3],r2
- vst1.i16 d2[0], [r1],r2
- vst1.i16 d3[0], [r3],r2
-
- vst1.i16 d0[1], [r1],r2
- vst1.i16 d1[1], [r3],r2
- vst1.i16 d2[1], [r1],r2
- vst1.i16 d3[1], [r3],r2
-
- vst1.i16 d0[2], [r1],r2
- vst1.i16 d1[2], [r3],r2
- vst1.i16 d2[2], [r1],r2
- vst1.i16 d3[2], [r3],r2
-
- vst1.i16 d0[3], [r1],r2
- vst1.i16 d1[3], [r3],r2
- vst1.i16 d2[3], [r1]
- vst1.i16 d3[3], [r3]
-
- bx lr
- ENDP ; |vp8_short_inv_walsh4x4_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfilter_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfilter_neon.asm
deleted file mode 100644
index e44be0a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfilter_neon.asm
+++ /dev/null
@@ -1,397 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_loop_filter_horizontal_edge_y_neon|
- EXPORT |vp8_loop_filter_horizontal_edge_uv_neon|
- EXPORT |vp8_loop_filter_vertical_edge_y_neon|
- EXPORT |vp8_loop_filter_vertical_edge_uv_neon|
- ARM
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *src
-; r1 int pitch
-; r2 unsigned char blimit
-; r3 unsigned char limit
-; sp unsigned char thresh,
-|vp8_loop_filter_horizontal_edge_y_neon| PROC
- push {lr}
- vdup.u8 q0, r2 ; duplicate blimit
- vdup.u8 q1, r3 ; duplicate limit
- sub r2, r0, r1, lsl #2 ; move src pointer down by 4 lines
- ldr r3, [sp, #4] ; load thresh
- add r12, r2, r1
- add r1, r1, r1
-
- vdup.u8 q2, r3 ; duplicate thresh
-
- vld1.u8 {q3}, [r2@128], r1 ; p3
- vld1.u8 {q4}, [r12@128], r1 ; p2
- vld1.u8 {q5}, [r2@128], r1 ; p1
- vld1.u8 {q6}, [r12@128], r1 ; p0
- vld1.u8 {q7}, [r2@128], r1 ; q0
- vld1.u8 {q8}, [r12@128], r1 ; q1
- vld1.u8 {q9}, [r2@128] ; q2
- vld1.u8 {q10}, [r12@128] ; q3
-
- sub r2, r2, r1, lsl #1
- sub r12, r12, r1, lsl #1
-
- bl vp8_loop_filter_neon
-
- vst1.u8 {q5}, [r2@128], r1 ; store op1
- vst1.u8 {q6}, [r12@128], r1 ; store op0
- vst1.u8 {q7}, [r2@128], r1 ; store oq0
- vst1.u8 {q8}, [r12@128], r1 ; store oq1
-
- pop {pc}
- ENDP ; |vp8_loop_filter_horizontal_edge_y_neon|
-
-
-; r0 unsigned char *u,
-; r1 int pitch,
-; r2 unsigned char blimit
-; r3 unsigned char limit
-; sp unsigned char thresh,
-; sp+4 unsigned char *v
-|vp8_loop_filter_horizontal_edge_uv_neon| PROC
- push {lr}
- vdup.u8 q0, r2 ; duplicate blimit
- vdup.u8 q1, r3 ; duplicate limit
- ldr r12, [sp, #4] ; load thresh
- ldr r2, [sp, #8] ; load v ptr
- vdup.u8 q2, r12 ; duplicate thresh
-
- sub r3, r0, r1, lsl #2 ; move u pointer down by 4 lines
- sub r12, r2, r1, lsl #2 ; move v pointer down by 4 lines
-
- vld1.u8 {d6}, [r3@64], r1 ; p3
- vld1.u8 {d7}, [r12@64], r1 ; p3
- vld1.u8 {d8}, [r3@64], r1 ; p2
- vld1.u8 {d9}, [r12@64], r1 ; p2
- vld1.u8 {d10}, [r3@64], r1 ; p1
- vld1.u8 {d11}, [r12@64], r1 ; p1
- vld1.u8 {d12}, [r3@64], r1 ; p0
- vld1.u8 {d13}, [r12@64], r1 ; p0
- vld1.u8 {d14}, [r3@64], r1 ; q0
- vld1.u8 {d15}, [r12@64], r1 ; q0
- vld1.u8 {d16}, [r3@64], r1 ; q1
- vld1.u8 {d17}, [r12@64], r1 ; q1
- vld1.u8 {d18}, [r3@64], r1 ; q2
- vld1.u8 {d19}, [r12@64], r1 ; q2
- vld1.u8 {d20}, [r3@64] ; q3
- vld1.u8 {d21}, [r12@64] ; q3
-
- bl vp8_loop_filter_neon
-
- sub r0, r0, r1, lsl #1
- sub r2, r2, r1, lsl #1
-
- vst1.u8 {d10}, [r0@64], r1 ; store u op1
- vst1.u8 {d11}, [r2@64], r1 ; store v op1
- vst1.u8 {d12}, [r0@64], r1 ; store u op0
- vst1.u8 {d13}, [r2@64], r1 ; store v op0
- vst1.u8 {d14}, [r0@64], r1 ; store u oq0
- vst1.u8 {d15}, [r2@64], r1 ; store v oq0
- vst1.u8 {d16}, [r0@64] ; store u oq1
- vst1.u8 {d17}, [r2@64] ; store v oq1
-
- pop {pc}
- ENDP ; |vp8_loop_filter_horizontal_edge_uv_neon|
-
-; void vp8_loop_filter_vertical_edge_y_neon(unsigned char *src, int pitch,
-; const signed char *flimit,
-; const signed char *limit,
-; const signed char *thresh,
-; int count)
-; r0 unsigned char *src
-; r1 int pitch
-; r2 unsigned char blimit
-; r3 unsigned char limit
-; sp unsigned char thresh,
-
-|vp8_loop_filter_vertical_edge_y_neon| PROC
- push {lr}
- vdup.u8 q0, r2 ; duplicate blimit
- vdup.u8 q1, r3 ; duplicate limit
- sub r2, r0, #4 ; src ptr down by 4 columns
- add r1, r1, r1
- ldr r3, [sp, #4] ; load thresh
- add r12, r2, r1, asr #1
-
- vld1.u8 {d6}, [r2], r1
- vld1.u8 {d8}, [r12], r1
- vld1.u8 {d10}, [r2], r1
- vld1.u8 {d12}, [r12], r1
- vld1.u8 {d14}, [r2], r1
- vld1.u8 {d16}, [r12], r1
- vld1.u8 {d18}, [r2], r1
- vld1.u8 {d20}, [r12], r1
-
- vld1.u8 {d7}, [r2], r1 ; load second 8-line src data
- vld1.u8 {d9}, [r12], r1
- vld1.u8 {d11}, [r2], r1
- vld1.u8 {d13}, [r12], r1
- vld1.u8 {d15}, [r2], r1
- vld1.u8 {d17}, [r12], r1
- vld1.u8 {d19}, [r2]
- vld1.u8 {d21}, [r12]
-
- ;transpose to 8x16 matrix
- vtrn.32 q3, q7
- vtrn.32 q4, q8
- vtrn.32 q5, q9
- vtrn.32 q6, q10
-
- vdup.u8 q2, r3 ; duplicate thresh
-
- vtrn.16 q3, q5
- vtrn.16 q4, q6
- vtrn.16 q7, q9
- vtrn.16 q8, q10
-
- vtrn.8 q3, q4
- vtrn.8 q5, q6
- vtrn.8 q7, q8
- vtrn.8 q9, q10
-
- bl vp8_loop_filter_neon
-
- vswp d12, d11
- vswp d16, d13
-
- sub r0, r0, #2 ; dst ptr
-
- vswp d14, d12
- vswp d16, d15
-
- add r12, r0, r1, asr #1
-
- ;store op1, op0, oq0, oq1
- vst4.8 {d10[0], d11[0], d12[0], d13[0]}, [r0], r1
- vst4.8 {d10[1], d11[1], d12[1], d13[1]}, [r12], r1
- vst4.8 {d10[2], d11[2], d12[2], d13[2]}, [r0], r1
- vst4.8 {d10[3], d11[3], d12[3], d13[3]}, [r12], r1
- vst4.8 {d10[4], d11[4], d12[4], d13[4]}, [r0], r1
- vst4.8 {d10[5], d11[5], d12[5], d13[5]}, [r12], r1
- vst4.8 {d10[6], d11[6], d12[6], d13[6]}, [r0], r1
- vst4.8 {d10[7], d11[7], d12[7], d13[7]}, [r12], r1
-
- vst4.8 {d14[0], d15[0], d16[0], d17[0]}, [r0], r1
- vst4.8 {d14[1], d15[1], d16[1], d17[1]}, [r12], r1
- vst4.8 {d14[2], d15[2], d16[2], d17[2]}, [r0], r1
- vst4.8 {d14[3], d15[3], d16[3], d17[3]}, [r12], r1
- vst4.8 {d14[4], d15[4], d16[4], d17[4]}, [r0], r1
- vst4.8 {d14[5], d15[5], d16[5], d17[5]}, [r12], r1
- vst4.8 {d14[6], d15[6], d16[6], d17[6]}, [r0]
- vst4.8 {d14[7], d15[7], d16[7], d17[7]}, [r12]
-
- pop {pc}
- ENDP ; |vp8_loop_filter_vertical_edge_y_neon|
-
-; void vp8_loop_filter_vertical_edge_uv_neon(unsigned char *u, int pitch
-; const signed char *flimit,
-; const signed char *limit,
-; const signed char *thresh,
-; unsigned char *v)
-; r0 unsigned char *u,
-; r1 int pitch,
-; r2 unsigned char blimit
-; r3 unsigned char limit
-; sp unsigned char thresh,
-; sp+4 unsigned char *v
-|vp8_loop_filter_vertical_edge_uv_neon| PROC
- push {lr}
- vdup.u8 q0, r2 ; duplicate blimit
- sub r12, r0, #4 ; move u pointer down by 4 columns
- ldr r2, [sp, #8] ; load v ptr
- vdup.u8 q1, r3 ; duplicate limit
- sub r3, r2, #4 ; move v pointer down by 4 columns
-
- vld1.u8 {d6}, [r12], r1 ;load u data
- vld1.u8 {d7}, [r3], r1 ;load v data
- vld1.u8 {d8}, [r12], r1
- vld1.u8 {d9}, [r3], r1
- vld1.u8 {d10}, [r12], r1
- vld1.u8 {d11}, [r3], r1
- vld1.u8 {d12}, [r12], r1
- vld1.u8 {d13}, [r3], r1
- vld1.u8 {d14}, [r12], r1
- vld1.u8 {d15}, [r3], r1
- vld1.u8 {d16}, [r12], r1
- vld1.u8 {d17}, [r3], r1
- vld1.u8 {d18}, [r12], r1
- vld1.u8 {d19}, [r3], r1
- vld1.u8 {d20}, [r12]
- vld1.u8 {d21}, [r3]
-
- ldr r12, [sp, #4] ; load thresh
-
- ;transpose to 8x16 matrix
- vtrn.32 q3, q7
- vtrn.32 q4, q8
- vtrn.32 q5, q9
- vtrn.32 q6, q10
-
- vdup.u8 q2, r12 ; duplicate thresh
-
- vtrn.16 q3, q5
- vtrn.16 q4, q6
- vtrn.16 q7, q9
- vtrn.16 q8, q10
-
- vtrn.8 q3, q4
- vtrn.8 q5, q6
- vtrn.8 q7, q8
- vtrn.8 q9, q10
-
- bl vp8_loop_filter_neon
-
- vswp d12, d11
- vswp d16, d13
- vswp d14, d12
- vswp d16, d15
-
- sub r0, r0, #2
- sub r2, r2, #2
-
- ;store op1, op0, oq0, oq1
- vst4.8 {d10[0], d11[0], d12[0], d13[0]}, [r0], r1
- vst4.8 {d14[0], d15[0], d16[0], d17[0]}, [r2], r1
- vst4.8 {d10[1], d11[1], d12[1], d13[1]}, [r0], r1
- vst4.8 {d14[1], d15[1], d16[1], d17[1]}, [r2], r1
- vst4.8 {d10[2], d11[2], d12[2], d13[2]}, [r0], r1
- vst4.8 {d14[2], d15[2], d16[2], d17[2]}, [r2], r1
- vst4.8 {d10[3], d11[3], d12[3], d13[3]}, [r0], r1
- vst4.8 {d14[3], d15[3], d16[3], d17[3]}, [r2], r1
- vst4.8 {d10[4], d11[4], d12[4], d13[4]}, [r0], r1
- vst4.8 {d14[4], d15[4], d16[4], d17[4]}, [r2], r1
- vst4.8 {d10[5], d11[5], d12[5], d13[5]}, [r0], r1
- vst4.8 {d14[5], d15[5], d16[5], d17[5]}, [r2], r1
- vst4.8 {d10[6], d11[6], d12[6], d13[6]}, [r0], r1
- vst4.8 {d14[6], d15[6], d16[6], d17[6]}, [r2], r1
- vst4.8 {d10[7], d11[7], d12[7], d13[7]}, [r0]
- vst4.8 {d14[7], d15[7], d16[7], d17[7]}, [r2]
-
- pop {pc}
- ENDP ; |vp8_loop_filter_vertical_edge_uv_neon|
-
-; void vp8_loop_filter_neon();
-; This is a helper function for the loopfilters. The invidual functions do the
-; necessary load, transpose (if necessary) and store.
-
-; r0-r3 PRESERVE
-; q0 flimit
-; q1 limit
-; q2 thresh
-; q3 p3
-; q4 p2
-; q5 p1
-; q6 p0
-; q7 q0
-; q8 q1
-; q9 q2
-; q10 q3
-|vp8_loop_filter_neon| PROC
-
- ; vp8_filter_mask
- vabd.u8 q11, q3, q4 ; abs(p3 - p2)
- vabd.u8 q12, q4, q5 ; abs(p2 - p1)
- vabd.u8 q13, q5, q6 ; abs(p1 - p0)
- vabd.u8 q14, q8, q7 ; abs(q1 - q0)
- vabd.u8 q3, q9, q8 ; abs(q2 - q1)
- vabd.u8 q4, q10, q9 ; abs(q3 - q2)
-
- vmax.u8 q11, q11, q12
- vmax.u8 q12, q13, q14
- vmax.u8 q3, q3, q4
- vmax.u8 q15, q11, q12
-
- vabd.u8 q9, q6, q7 ; abs(p0 - q0)
-
- ; vp8_hevmask
- vcgt.u8 q13, q13, q2 ; (abs(p1 - p0) > thresh)*-1
- vcgt.u8 q14, q14, q2 ; (abs(q1 - q0) > thresh)*-1
- vmax.u8 q15, q15, q3
-
- vmov.u8 q10, #0x80 ; 0x80
-
- vabd.u8 q2, q5, q8 ; a = abs(p1 - q1)
- vqadd.u8 q9, q9, q9 ; b = abs(p0 - q0) * 2
-
- vcge.u8 q15, q1, q15
-
- ; vp8_filter() function
- ; convert to signed
- veor q7, q7, q10 ; qs0
- vshr.u8 q2, q2, #1 ; a = a / 2
- veor q6, q6, q10 ; ps0
-
- veor q5, q5, q10 ; ps1
- vqadd.u8 q9, q9, q2 ; a = b + a
-
- veor q8, q8, q10 ; qs1
-
- vmov.u8 q10, #3 ; #3
-
- vsubl.s8 q2, d14, d12 ; ( qs0 - ps0)
- vsubl.s8 q11, d15, d13
-
- vcge.u8 q9, q0, q9 ; (a > flimit * 2 + limit) * -1
-
- vmovl.u8 q4, d20
-
- vqsub.s8 q1, q5, q8 ; vp8_filter = clamp(ps1-qs1)
- vorr q14, q13, q14 ; vp8_hevmask
-
- vmul.i16 q2, q2, q4 ; 3 * ( qs0 - ps0)
- vmul.i16 q11, q11, q4
-
- vand q1, q1, q14 ; vp8_filter &= hev
- vand q15, q15, q9 ; vp8_filter_mask
-
- vaddw.s8 q2, q2, d2
- vaddw.s8 q11, q11, d3
-
- vmov.u8 q9, #4 ; #4
-
- ; vp8_filter = clamp(vp8_filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d2, q2
- vqmovn.s16 d3, q11
- vand q1, q1, q15 ; vp8_filter &= mask
-
- vqadd.s8 q2, q1, q10 ; Filter2 = clamp(vp8_filter+3)
- vqadd.s8 q1, q1, q9 ; Filter1 = clamp(vp8_filter+4)
- vshr.s8 q2, q2, #3 ; Filter2 >>= 3
- vshr.s8 q1, q1, #3 ; Filter1 >>= 3
-
-
- vqadd.s8 q11, q6, q2 ; u = clamp(ps0 + Filter2)
- vqsub.s8 q10, q7, q1 ; u = clamp(qs0 - Filter1)
-
- ; outer tap adjustments: ++vp8_filter >> 1
- vrshr.s8 q1, q1, #1
- vbic q1, q1, q14 ; vp8_filter &= ~hev
- vmov.u8 q0, #0x80 ; 0x80
- vqadd.s8 q13, q5, q1 ; u = clamp(ps1 + vp8_filter)
- vqsub.s8 q12, q8, q1 ; u = clamp(qs1 - vp8_filter)
-
- veor q6, q11, q0 ; *op0 = u^0x80
- veor q7, q10, q0 ; *oq0 = u^0x80
- veor q5, q13, q0 ; *op1 = u^0x80
- veor q8, q12, q0 ; *oq1 = u^0x80
-
- bx lr
- ENDP ; |vp8_loop_filter_horizontal_edge_y_neon|
-
-;-----------------
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
deleted file mode 100644
index adf848b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
+++ /dev/null
@@ -1,117 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- ;EXPORT |vp8_loop_filter_simple_horizontal_edge_neon|
- EXPORT |vp8_loop_filter_bhs_neon|
- EXPORT |vp8_loop_filter_mbhs_neon|
- ARM
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *s, PRESERVE
-; r1 int p, PRESERVE
-; q1 limit, PRESERVE
-
-|vp8_loop_filter_simple_horizontal_edge_neon| PROC
-
- sub r3, r0, r1, lsl #1 ; move src pointer down by 2 lines
-
- vld1.u8 {q7}, [r0@128], r1 ; q0
- vld1.u8 {q5}, [r3@128], r1 ; p0
- vld1.u8 {q8}, [r0@128] ; q1
- vld1.u8 {q6}, [r3@128] ; p1
-
- vabd.u8 q15, q6, q7 ; abs(p0 - q0)
- vabd.u8 q14, q5, q8 ; abs(p1 - q1)
-
- vqadd.u8 q15, q15, q15 ; abs(p0 - q0) * 2
- vshr.u8 q14, q14, #1 ; abs(p1 - q1) / 2
- vmov.u8 q0, #0x80 ; 0x80
- vmov.s16 q13, #3
- vqadd.u8 q15, q15, q14 ; abs(p0 - q0) * 2 + abs(p1 - q1) / 2
-
- veor q7, q7, q0 ; qs0: q0 offset to convert to a signed value
- veor q6, q6, q0 ; ps0: p0 offset to convert to a signed value
- veor q5, q5, q0 ; ps1: p1 offset to convert to a signed value
- veor q8, q8, q0 ; qs1: q1 offset to convert to a signed value
-
- vcge.u8 q15, q1, q15 ; (abs(p0 - q0)*2 + abs(p1-q1)/2 > limit)*-1
-
- vsubl.s8 q2, d14, d12 ; ( qs0 - ps0)
- vsubl.s8 q3, d15, d13
-
- vqsub.s8 q4, q5, q8 ; q4: vp8_filter = vp8_signed_char_clamp(ps1-qs1)
-
- vmul.s16 q2, q2, q13 ; 3 * ( qs0 - ps0)
- vmul.s16 q3, q3, q13
-
- vmov.u8 q10, #0x03 ; 0x03
- vmov.u8 q9, #0x04 ; 0x04
-
- vaddw.s8 q2, q2, d8 ; vp8_filter + 3 * ( qs0 - ps0)
- vaddw.s8 q3, q3, d9
-
- vqmovn.s16 d8, q2 ; vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d9, q3
-
- vand q14, q4, q15 ; vp8_filter &= mask
-
- vqadd.s8 q2, q14, q10 ; Filter2 = vp8_signed_char_clamp(vp8_filter+3)
- vqadd.s8 q3, q14, q9 ; Filter1 = vp8_signed_char_clamp(vp8_filter+4)
- vshr.s8 q2, q2, #3 ; Filter2 >>= 3
- vshr.s8 q4, q3, #3 ; Filter1 >>= 3
-
- sub r0, r0, r1
-
- ;calculate output
- vqadd.s8 q11, q6, q2 ; u = vp8_signed_char_clamp(ps0 + Filter2)
- vqsub.s8 q10, q7, q4 ; u = vp8_signed_char_clamp(qs0 - Filter1)
-
- veor q6, q11, q0 ; *op0 = u^0x80
- veor q7, q10, q0 ; *oq0 = u^0x80
-
- vst1.u8 {q6}, [r3@128] ; store op0
- vst1.u8 {q7}, [r0@128] ; store oq0
-
- bx lr
- ENDP ; |vp8_loop_filter_simple_horizontal_edge_neon|
-
-; r0 unsigned char *y
-; r1 int ystride
-; r2 const unsigned char *blimit
-
-|vp8_loop_filter_bhs_neon| PROC
- push {r4, lr}
- ldrb r3, [r2] ; load blim from mem
- vdup.s8 q1, r3 ; duplicate blim
-
- add r0, r0, r1, lsl #2 ; src = y_ptr + 4 * y_stride
- bl vp8_loop_filter_simple_horizontal_edge_neon
- ; vp8_loop_filter_simple_horizontal_edge_neon preserves r0, r1 and q1
- add r0, r0, r1, lsl #2 ; src = y_ptr + 8* y_stride
- bl vp8_loop_filter_simple_horizontal_edge_neon
- add r0, r0, r1, lsl #2 ; src = y_ptr + 12 * y_stride
- pop {r4, lr}
- b vp8_loop_filter_simple_horizontal_edge_neon
- ENDP ;|vp8_loop_filter_bhs_neon|
-
-; r0 unsigned char *y
-; r1 int ystride
-; r2 const unsigned char *blimit
-
-|vp8_loop_filter_mbhs_neon| PROC
- ldrb r3, [r2] ; load blim from mem
- vdup.s8 q1, r3 ; duplicate mblim
- b vp8_loop_filter_simple_horizontal_edge_neon
- ENDP ;|vp8_loop_filter_bhs_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
deleted file mode 100644
index e690df2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
+++ /dev/null
@@ -1,154 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- ;EXPORT |vp8_loop_filter_simple_vertical_edge_neon|
- EXPORT |vp8_loop_filter_bvs_neon|
- EXPORT |vp8_loop_filter_mbvs_neon|
- ARM
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *s, PRESERVE
-; r1 int p, PRESERVE
-; q1 limit, PRESERVE
-
-|vp8_loop_filter_simple_vertical_edge_neon| PROC
- sub r0, r0, #2 ; move src pointer down by 2 columns
- add r12, r1, r1
- add r3, r0, r1
-
- vld4.8 {d6[0], d7[0], d8[0], d9[0]}, [r0], r12
- vld4.8 {d6[1], d7[1], d8[1], d9[1]}, [r3], r12
- vld4.8 {d6[2], d7[2], d8[2], d9[2]}, [r0], r12
- vld4.8 {d6[3], d7[3], d8[3], d9[3]}, [r3], r12
- vld4.8 {d6[4], d7[4], d8[4], d9[4]}, [r0], r12
- vld4.8 {d6[5], d7[5], d8[5], d9[5]}, [r3], r12
- vld4.8 {d6[6], d7[6], d8[6], d9[6]}, [r0], r12
- vld4.8 {d6[7], d7[7], d8[7], d9[7]}, [r3], r12
-
- vld4.8 {d10[0], d11[0], d12[0], d13[0]}, [r0], r12
- vld4.8 {d10[1], d11[1], d12[1], d13[1]}, [r3], r12
- vld4.8 {d10[2], d11[2], d12[2], d13[2]}, [r0], r12
- vld4.8 {d10[3], d11[3], d12[3], d13[3]}, [r3], r12
- vld4.8 {d10[4], d11[4], d12[4], d13[4]}, [r0], r12
- vld4.8 {d10[5], d11[5], d12[5], d13[5]}, [r3], r12
- vld4.8 {d10[6], d11[6], d12[6], d13[6]}, [r0], r12
- vld4.8 {d10[7], d11[7], d12[7], d13[7]}, [r3]
-
- vswp d7, d10
- vswp d12, d9
-
- ;vp8_filter_mask() function
- ;vp8_hevmask() function
- sub r0, r0, r1, lsl #4
- vabd.u8 q15, q5, q4 ; abs(p0 - q0)
- vabd.u8 q14, q3, q6 ; abs(p1 - q1)
-
- vqadd.u8 q15, q15, q15 ; abs(p0 - q0) * 2
- vshr.u8 q14, q14, #1 ; abs(p1 - q1) / 2
- vmov.u8 q0, #0x80 ; 0x80
- vmov.s16 q11, #3
- vqadd.u8 q15, q15, q14 ; abs(p0 - q0) * 2 + abs(p1 - q1) / 2
-
- veor q4, q4, q0 ; qs0: q0 offset to convert to a signed value
- veor q5, q5, q0 ; ps0: p0 offset to convert to a signed value
- veor q3, q3, q0 ; ps1: p1 offset to convert to a signed value
- veor q6, q6, q0 ; qs1: q1 offset to convert to a signed value
-
- vcge.u8 q15, q1, q15 ; abs(p0 - q0)*2 + abs(p1-q1)/2 > flimit*2 + limit)*-1
-
- vsubl.s8 q2, d8, d10 ; ( qs0 - ps0)
- vsubl.s8 q13, d9, d11
-
- vqsub.s8 q14, q3, q6 ; vp8_filter = vp8_signed_char_clamp(ps1-qs1)
-
- vmul.s16 q2, q2, q11 ; 3 * ( qs0 - ps0)
- vmul.s16 q13, q13, q11
-
- vmov.u8 q11, #0x03 ; 0x03
- vmov.u8 q12, #0x04 ; 0x04
-
- vaddw.s8 q2, q2, d28 ; vp8_filter + 3 * ( qs0 - ps0)
- vaddw.s8 q13, q13, d29
-
- vqmovn.s16 d28, q2 ; vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d29, q13
-
- add r0, r0, #1
- add r3, r0, r1
-
- vand q14, q14, q15 ; vp8_filter &= mask
-
- vqadd.s8 q2, q14, q11 ; Filter2 = vp8_signed_char_clamp(vp8_filter+3)
- vqadd.s8 q3, q14, q12 ; Filter1 = vp8_signed_char_clamp(vp8_filter+4)
- vshr.s8 q2, q2, #3 ; Filter2 >>= 3
- vshr.s8 q14, q3, #3 ; Filter1 >>= 3
-
- ;calculate output
- vqadd.s8 q11, q5, q2 ; u = vp8_signed_char_clamp(ps0 + Filter2)
- vqsub.s8 q10, q4, q14 ; u = vp8_signed_char_clamp(qs0 - Filter1)
-
- veor q6, q11, q0 ; *op0 = u^0x80
- veor q7, q10, q0 ; *oq0 = u^0x80
- add r12, r1, r1
- vswp d13, d14
-
- ;store op1, op0, oq0, oq1
- vst2.8 {d12[0], d13[0]}, [r0], r12
- vst2.8 {d12[1], d13[1]}, [r3], r12
- vst2.8 {d12[2], d13[2]}, [r0], r12
- vst2.8 {d12[3], d13[3]}, [r3], r12
- vst2.8 {d12[4], d13[4]}, [r0], r12
- vst2.8 {d12[5], d13[5]}, [r3], r12
- vst2.8 {d12[6], d13[6]}, [r0], r12
- vst2.8 {d12[7], d13[7]}, [r3], r12
- vst2.8 {d14[0], d15[0]}, [r0], r12
- vst2.8 {d14[1], d15[1]}, [r3], r12
- vst2.8 {d14[2], d15[2]}, [r0], r12
- vst2.8 {d14[3], d15[3]}, [r3], r12
- vst2.8 {d14[4], d15[4]}, [r0], r12
- vst2.8 {d14[5], d15[5]}, [r3], r12
- vst2.8 {d14[6], d15[6]}, [r0], r12
- vst2.8 {d14[7], d15[7]}, [r3]
-
- bx lr
- ENDP ; |vp8_loop_filter_simple_vertical_edge_neon|
-
-; r0 unsigned char *y
-; r1 int ystride
-; r2 const unsigned char *blimit
-
-|vp8_loop_filter_bvs_neon| PROC
- push {r4, lr}
- ldrb r3, [r2] ; load blim from mem
- mov r4, r0
- add r0, r0, #4
- vdup.s8 q1, r3 ; duplicate blim
- bl vp8_loop_filter_simple_vertical_edge_neon
- ; vp8_loop_filter_simple_vertical_edge_neon preserves r1 and q1
- add r0, r4, #8
- bl vp8_loop_filter_simple_vertical_edge_neon
- add r0, r4, #12
- pop {r4, lr}
- b vp8_loop_filter_simple_vertical_edge_neon
- ENDP ;|vp8_loop_filter_bvs_neon|
-
-; r0 unsigned char *y
-; r1 int ystride
-; r2 const unsigned char *blimit
-
-|vp8_loop_filter_mbvs_neon| PROC
- ldrb r3, [r2] ; load mblim from mem
- vdup.s8 q1, r3 ; duplicate mblim
- b vp8_loop_filter_simple_vertical_edge_neon
- ENDP ;|vp8_loop_filter_bvs_neon|
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm
deleted file mode 100644
index f41c156..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/mbloopfilter_neon.asm
+++ /dev/null
@@ -1,469 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_mbloop_filter_horizontal_edge_y_neon|
- EXPORT |vp8_mbloop_filter_horizontal_edge_uv_neon|
- EXPORT |vp8_mbloop_filter_vertical_edge_y_neon|
- EXPORT |vp8_mbloop_filter_vertical_edge_uv_neon|
- ARM
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; void vp8_mbloop_filter_horizontal_edge_y_neon(unsigned char *src, int pitch,
-; const unsigned char *blimit,
-; const unsigned char *limit,
-; const unsigned char *thresh)
-; r0 unsigned char *src,
-; r1 int pitch,
-; r2 unsigned char blimit
-; r3 unsigned char limit
-; sp unsigned char thresh,
-|vp8_mbloop_filter_horizontal_edge_y_neon| PROC
- push {lr}
- add r1, r1, r1 ; double stride
- ldr r12, [sp, #4] ; load thresh
- sub r0, r0, r1, lsl #1 ; move src pointer down by 4 lines
- vdup.u8 q2, r12 ; thresh
- add r12, r0, r1, lsr #1 ; move src pointer up by 1 line
-
- vld1.u8 {q3}, [r0@128], r1 ; p3
- vld1.u8 {q4}, [r12@128], r1 ; p2
- vld1.u8 {q5}, [r0@128], r1 ; p1
- vld1.u8 {q6}, [r12@128], r1 ; p0
- vld1.u8 {q7}, [r0@128], r1 ; q0
- vld1.u8 {q8}, [r12@128], r1 ; q1
- vld1.u8 {q9}, [r0@128], r1 ; q2
- vld1.u8 {q10}, [r12@128], r1 ; q3
-
- bl vp8_mbloop_filter_neon
-
- sub r12, r12, r1, lsl #2
- add r0, r12, r1, lsr #1
-
- vst1.u8 {q4}, [r12@128],r1 ; store op2
- vst1.u8 {q5}, [r0@128],r1 ; store op1
- vst1.u8 {q6}, [r12@128], r1 ; store op0
- vst1.u8 {q7}, [r0@128],r1 ; store oq0
- vst1.u8 {q8}, [r12@128] ; store oq1
- vst1.u8 {q9}, [r0@128] ; store oq2
-
- pop {pc}
- ENDP ; |vp8_mbloop_filter_horizontal_edge_y_neon|
-
-; void vp8_mbloop_filter_horizontal_edge_uv_neon(unsigned char *u, int pitch,
-; const unsigned char *blimit,
-; const unsigned char *limit,
-; const unsigned char *thresh,
-; unsigned char *v)
-; r0 unsigned char *u,
-; r1 int pitch,
-; r2 unsigned char blimit
-; r3 unsigned char limit
-; sp unsigned char thresh,
-; sp+4 unsigned char *v
-
-|vp8_mbloop_filter_horizontal_edge_uv_neon| PROC
- push {lr}
- ldr r12, [sp, #4] ; load thresh
- sub r0, r0, r1, lsl #2 ; move u pointer down by 4 lines
- vdup.u8 q2, r12 ; thresh
- ldr r12, [sp, #8] ; load v ptr
- sub r12, r12, r1, lsl #2 ; move v pointer down by 4 lines
-
- vld1.u8 {d6}, [r0@64], r1 ; p3
- vld1.u8 {d7}, [r12@64], r1 ; p3
- vld1.u8 {d8}, [r0@64], r1 ; p2
- vld1.u8 {d9}, [r12@64], r1 ; p2
- vld1.u8 {d10}, [r0@64], r1 ; p1
- vld1.u8 {d11}, [r12@64], r1 ; p1
- vld1.u8 {d12}, [r0@64], r1 ; p0
- vld1.u8 {d13}, [r12@64], r1 ; p0
- vld1.u8 {d14}, [r0@64], r1 ; q0
- vld1.u8 {d15}, [r12@64], r1 ; q0
- vld1.u8 {d16}, [r0@64], r1 ; q1
- vld1.u8 {d17}, [r12@64], r1 ; q1
- vld1.u8 {d18}, [r0@64], r1 ; q2
- vld1.u8 {d19}, [r12@64], r1 ; q2
- vld1.u8 {d20}, [r0@64], r1 ; q3
- vld1.u8 {d21}, [r12@64], r1 ; q3
-
- bl vp8_mbloop_filter_neon
-
- sub r0, r0, r1, lsl #3
- sub r12, r12, r1, lsl #3
-
- add r0, r0, r1
- add r12, r12, r1
-
- vst1.u8 {d8}, [r0@64], r1 ; store u op2
- vst1.u8 {d9}, [r12@64], r1 ; store v op2
- vst1.u8 {d10}, [r0@64], r1 ; store u op1
- vst1.u8 {d11}, [r12@64], r1 ; store v op1
- vst1.u8 {d12}, [r0@64], r1 ; store u op0
- vst1.u8 {d13}, [r12@64], r1 ; store v op0
- vst1.u8 {d14}, [r0@64], r1 ; store u oq0
- vst1.u8 {d15}, [r12@64], r1 ; store v oq0
- vst1.u8 {d16}, [r0@64], r1 ; store u oq1
- vst1.u8 {d17}, [r12@64], r1 ; store v oq1
- vst1.u8 {d18}, [r0@64], r1 ; store u oq2
- vst1.u8 {d19}, [r12@64], r1 ; store v oq2
-
- pop {pc}
- ENDP ; |vp8_mbloop_filter_horizontal_edge_uv_neon|
-
-; void vp8_mbloop_filter_vertical_edge_y_neon(unsigned char *src, int pitch,
-; const unsigned char *blimit,
-; const unsigned char *limit,
-; const unsigned char *thresh)
-; r0 unsigned char *src,
-; r1 int pitch,
-; r2 unsigned char blimit
-; r3 unsigned char limit
-; sp unsigned char thresh,
-|vp8_mbloop_filter_vertical_edge_y_neon| PROC
- push {lr}
- ldr r12, [sp, #4] ; load thresh
- sub r0, r0, #4 ; move src pointer down by 4 columns
- vdup.s8 q2, r12 ; thresh
- add r12, r0, r1, lsl #3 ; move src pointer down by 8 lines
-
- vld1.u8 {d6}, [r0], r1 ; load first 8-line src data
- vld1.u8 {d7}, [r12], r1 ; load second 8-line src data
- vld1.u8 {d8}, [r0], r1
- vld1.u8 {d9}, [r12], r1
- vld1.u8 {d10}, [r0], r1
- vld1.u8 {d11}, [r12], r1
- vld1.u8 {d12}, [r0], r1
- vld1.u8 {d13}, [r12], r1
- vld1.u8 {d14}, [r0], r1
- vld1.u8 {d15}, [r12], r1
- vld1.u8 {d16}, [r0], r1
- vld1.u8 {d17}, [r12], r1
- vld1.u8 {d18}, [r0], r1
- vld1.u8 {d19}, [r12], r1
- vld1.u8 {d20}, [r0], r1
- vld1.u8 {d21}, [r12], r1
-
- ;transpose to 8x16 matrix
- vtrn.32 q3, q7
- vtrn.32 q4, q8
- vtrn.32 q5, q9
- vtrn.32 q6, q10
-
- vtrn.16 q3, q5
- vtrn.16 q4, q6
- vtrn.16 q7, q9
- vtrn.16 q8, q10
-
- vtrn.8 q3, q4
- vtrn.8 q5, q6
- vtrn.8 q7, q8
- vtrn.8 q9, q10
-
- sub r0, r0, r1, lsl #3
-
- bl vp8_mbloop_filter_neon
-
- sub r12, r12, r1, lsl #3
-
- ;transpose to 16x8 matrix
- vtrn.32 q3, q7
- vtrn.32 q4, q8
- vtrn.32 q5, q9
- vtrn.32 q6, q10
-
- vtrn.16 q3, q5
- vtrn.16 q4, q6
- vtrn.16 q7, q9
- vtrn.16 q8, q10
-
- vtrn.8 q3, q4
- vtrn.8 q5, q6
- vtrn.8 q7, q8
- vtrn.8 q9, q10
-
- ;store op2, op1, op0, oq0, oq1, oq2
- vst1.8 {d6}, [r0], r1
- vst1.8 {d7}, [r12], r1
- vst1.8 {d8}, [r0], r1
- vst1.8 {d9}, [r12], r1
- vst1.8 {d10}, [r0], r1
- vst1.8 {d11}, [r12], r1
- vst1.8 {d12}, [r0], r1
- vst1.8 {d13}, [r12], r1
- vst1.8 {d14}, [r0], r1
- vst1.8 {d15}, [r12], r1
- vst1.8 {d16}, [r0], r1
- vst1.8 {d17}, [r12], r1
- vst1.8 {d18}, [r0], r1
- vst1.8 {d19}, [r12], r1
- vst1.8 {d20}, [r0]
- vst1.8 {d21}, [r12]
-
- pop {pc}
- ENDP ; |vp8_mbloop_filter_vertical_edge_y_neon|
-
-; void vp8_mbloop_filter_vertical_edge_uv_neon(unsigned char *u, int pitch,
-; const unsigned char *blimit,
-; const unsigned char *limit,
-; const unsigned char *thresh,
-; unsigned char *v)
-; r0 unsigned char *u,
-; r1 int pitch,
-; r2 const signed char *flimit,
-; r3 const signed char *limit,
-; sp const signed char *thresh,
-; sp+4 unsigned char *v
-|vp8_mbloop_filter_vertical_edge_uv_neon| PROC
- push {lr}
- ldr r12, [sp, #4] ; load thresh
- sub r0, r0, #4 ; move u pointer down by 4 columns
- vdup.u8 q2, r12 ; thresh
- ldr r12, [sp, #8] ; load v ptr
- sub r12, r12, #4 ; move v pointer down by 4 columns
-
- vld1.u8 {d6}, [r0], r1 ;load u data
- vld1.u8 {d7}, [r12], r1 ;load v data
- vld1.u8 {d8}, [r0], r1
- vld1.u8 {d9}, [r12], r1
- vld1.u8 {d10}, [r0], r1
- vld1.u8 {d11}, [r12], r1
- vld1.u8 {d12}, [r0], r1
- vld1.u8 {d13}, [r12], r1
- vld1.u8 {d14}, [r0], r1
- vld1.u8 {d15}, [r12], r1
- vld1.u8 {d16}, [r0], r1
- vld1.u8 {d17}, [r12], r1
- vld1.u8 {d18}, [r0], r1
- vld1.u8 {d19}, [r12], r1
- vld1.u8 {d20}, [r0], r1
- vld1.u8 {d21}, [r12], r1
-
- ;transpose to 8x16 matrix
- vtrn.32 q3, q7
- vtrn.32 q4, q8
- vtrn.32 q5, q9
- vtrn.32 q6, q10
-
- vtrn.16 q3, q5
- vtrn.16 q4, q6
- vtrn.16 q7, q9
- vtrn.16 q8, q10
-
- vtrn.8 q3, q4
- vtrn.8 q5, q6
- vtrn.8 q7, q8
- vtrn.8 q9, q10
-
- sub r0, r0, r1, lsl #3
-
- bl vp8_mbloop_filter_neon
-
- sub r12, r12, r1, lsl #3
-
- ;transpose to 16x8 matrix
- vtrn.32 q3, q7
- vtrn.32 q4, q8
- vtrn.32 q5, q9
- vtrn.32 q6, q10
-
- vtrn.16 q3, q5
- vtrn.16 q4, q6
- vtrn.16 q7, q9
- vtrn.16 q8, q10
-
- vtrn.8 q3, q4
- vtrn.8 q5, q6
- vtrn.8 q7, q8
- vtrn.8 q9, q10
-
- ;store op2, op1, op0, oq0, oq1, oq2
- vst1.8 {d6}, [r0], r1
- vst1.8 {d7}, [r12], r1
- vst1.8 {d8}, [r0], r1
- vst1.8 {d9}, [r12], r1
- vst1.8 {d10}, [r0], r1
- vst1.8 {d11}, [r12], r1
- vst1.8 {d12}, [r0], r1
- vst1.8 {d13}, [r12], r1
- vst1.8 {d14}, [r0], r1
- vst1.8 {d15}, [r12], r1
- vst1.8 {d16}, [r0], r1
- vst1.8 {d17}, [r12], r1
- vst1.8 {d18}, [r0], r1
- vst1.8 {d19}, [r12], r1
- vst1.8 {d20}, [r0]
- vst1.8 {d21}, [r12]
-
- pop {pc}
- ENDP ; |vp8_mbloop_filter_vertical_edge_uv_neon|
-
-; void vp8_mbloop_filter_neon()
-; This is a helper function for the macroblock loopfilters. The individual
-; functions do the necessary load, transpose (if necessary), preserve (if
-; necessary) and store.
-
-; r0,r1 PRESERVE
-; r2 mblimit
-; r3 limit
-
-; q2 thresh
-; q3 p3 PRESERVE
-; q4 p2
-; q5 p1
-; q6 p0
-; q7 q0
-; q8 q1
-; q9 q2
-; q10 q3 PRESERVE
-
-|vp8_mbloop_filter_neon| PROC
-
- ; vp8_filter_mask
- vabd.u8 q11, q3, q4 ; abs(p3 - p2)
- vabd.u8 q12, q4, q5 ; abs(p2 - p1)
- vabd.u8 q13, q5, q6 ; abs(p1 - p0)
- vabd.u8 q14, q8, q7 ; abs(q1 - q0)
- vabd.u8 q1, q9, q8 ; abs(q2 - q1)
- vabd.u8 q0, q10, q9 ; abs(q3 - q2)
-
- vmax.u8 q11, q11, q12
- vmax.u8 q12, q13, q14
- vmax.u8 q1, q1, q0
- vmax.u8 q15, q11, q12
-
- vabd.u8 q12, q6, q7 ; abs(p0 - q0)
-
- ; vp8_hevmask
- vcgt.u8 q13, q13, q2 ; (abs(p1 - p0) > thresh) * -1
- vcgt.u8 q14, q14, q2 ; (abs(q1 - q0) > thresh) * -1
- vmax.u8 q15, q15, q1
-
- vdup.u8 q1, r3 ; limit
- vdup.u8 q2, r2 ; mblimit
-
- vmov.u8 q0, #0x80 ; 0x80
-
- vcge.u8 q15, q1, q15
-
- vabd.u8 q1, q5, q8 ; a = abs(p1 - q1)
- vqadd.u8 q12, q12, q12 ; b = abs(p0 - q0) * 2
- vmov.u16 q11, #3 ; #3
-
- ; vp8_filter
- ; convert to signed
- veor q7, q7, q0 ; qs0
- vshr.u8 q1, q1, #1 ; a = a / 2
- veor q6, q6, q0 ; ps0
- veor q5, q5, q0 ; ps1
-
- vqadd.u8 q12, q12, q1 ; a = b + a
-
- veor q8, q8, q0 ; qs1
- veor q4, q4, q0 ; ps2
- veor q9, q9, q0 ; qs2
-
- vorr q14, q13, q14 ; vp8_hevmask
-
- vcge.u8 q12, q2, q12 ; (a > flimit * 2 + limit) * -1
-
- vsubl.s8 q2, d14, d12 ; qs0 - ps0
- vsubl.s8 q13, d15, d13
-
- vqsub.s8 q1, q5, q8 ; vp8_filter = clamp(ps1-qs1)
-
- vmul.i16 q2, q2, q11 ; 3 * ( qs0 - ps0)
-
- vand q15, q15, q12 ; vp8_filter_mask
-
- vmul.i16 q13, q13, q11
-
- vmov.u8 q12, #3 ; #3
-
- vaddw.s8 q2, q2, d2 ; vp8_filter + 3 * ( qs0 - ps0)
- vaddw.s8 q13, q13, d3
-
- vmov.u8 q11, #4 ; #4
-
- ; vp8_filter = clamp(vp8_filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d2, q2
- vqmovn.s16 d3, q13
-
- vand q1, q1, q15 ; vp8_filter &= mask
-
- vmov.u16 q15, #63 ; #63
-
- vand q13, q1, q14 ; Filter2 &= hev
-
- vqadd.s8 q2, q13, q11 ; Filter1 = clamp(Filter2+4)
- vqadd.s8 q13, q13, q12 ; Filter2 = clamp(Filter2+3)
-
- vmov q0, q15
-
- vshr.s8 q2, q2, #3 ; Filter1 >>= 3
- vshr.s8 q13, q13, #3 ; Filter2 >>= 3
-
- vmov q11, q15
- vmov q12, q15
-
- vqsub.s8 q7, q7, q2 ; qs0 = clamp(qs0 - Filter1)
-
- vqadd.s8 q6, q6, q13 ; ps0 = clamp(ps0 + Filter2)
-
- vbic q1, q1, q14 ; vp8_filter &= ~hev
-
- ; roughly 1/7th difference across boundary
- ; roughly 2/7th difference across boundary
- ; roughly 3/7th difference across boundary
-
- vmov.u8 d5, #9 ; #9
- vmov.u8 d4, #18 ; #18
-
- vmov q13, q15
- vmov q14, q15
-
- vmlal.s8 q0, d2, d5 ; 63 + Filter2 * 9
- vmlal.s8 q11, d3, d5
- vmov.u8 d5, #27 ; #27
- vmlal.s8 q12, d2, d4 ; 63 + Filter2 * 18
- vmlal.s8 q13, d3, d4
- vmlal.s8 q14, d2, d5 ; 63 + Filter2 * 27
- vmlal.s8 q15, d3, d5
-
- vqshrn.s16 d0, q0, #7 ; u = clamp((63 + Filter2 * 9)>>7)
- vqshrn.s16 d1, q11, #7
- vqshrn.s16 d24, q12, #7 ; u = clamp((63 + Filter2 * 18)>>7)
- vqshrn.s16 d25, q13, #7
- vqshrn.s16 d28, q14, #7 ; u = clamp((63 + Filter2 * 27)>>7)
- vqshrn.s16 d29, q15, #7
-
- vmov.u8 q1, #0x80 ; 0x80
-
- vqsub.s8 q11, q9, q0 ; s = clamp(qs2 - u)
- vqadd.s8 q0, q4, q0 ; s = clamp(ps2 + u)
- vqsub.s8 q13, q8, q12 ; s = clamp(qs1 - u)
- vqadd.s8 q12, q5, q12 ; s = clamp(ps1 + u)
- vqsub.s8 q15, q7, q14 ; s = clamp(qs0 - u)
- vqadd.s8 q14, q6, q14 ; s = clamp(ps0 + u)
-
- veor q9, q11, q1 ; *oq2 = s^0x80
- veor q4, q0, q1 ; *op2 = s^0x80
- veor q8, q13, q1 ; *oq1 = s^0x80
- veor q5, q12, q1 ; *op2 = s^0x80
- veor q7, q15, q1 ; *oq0 = s^0x80
- veor q6, q14, q1 ; *op0 = s^0x80
-
- bx lr
- ENDP ; |vp8_mbloop_filter_neon|
-
-;-----------------
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad16_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad16_neon.asm
deleted file mode 100644
index d7c590e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad16_neon.asm
+++ /dev/null
@@ -1,207 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sad16x16_neon|
- EXPORT |vp8_sad16x8_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 unsigned char *src_ptr
-; r1 int src_stride
-; r2 unsigned char *ref_ptr
-; r3 int ref_stride
-|vp8_sad16x16_neon| PROC
-;;
- vld1.8 {q0}, [r0], r1
- vld1.8 {q4}, [r2], r3
-
- vld1.8 {q1}, [r0], r1
- vld1.8 {q5}, [r2], r3
-
- vabdl.u8 q12, d0, d8
- vabdl.u8 q13, d1, d9
-
- vld1.8 {q2}, [r0], r1
- vld1.8 {q6}, [r2], r3
-
- vabal.u8 q12, d2, d10
- vabal.u8 q13, d3, d11
-
- vld1.8 {q3}, [r0], r1
- vld1.8 {q7}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q13, d5, d13
-
-;;
- vld1.8 {q0}, [r0], r1
- vld1.8 {q4}, [r2], r3
-
- vabal.u8 q12, d6, d14
- vabal.u8 q13, d7, d15
-
- vld1.8 {q1}, [r0], r1
- vld1.8 {q5}, [r2], r3
-
- vabal.u8 q12, d0, d8
- vabal.u8 q13, d1, d9
-
- vld1.8 {q2}, [r0], r1
- vld1.8 {q6}, [r2], r3
-
- vabal.u8 q12, d2, d10
- vabal.u8 q13, d3, d11
-
- vld1.8 {q3}, [r0], r1
- vld1.8 {q7}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q13, d5, d13
-
-;;
- vld1.8 {q0}, [r0], r1
- vld1.8 {q4}, [r2], r3
-
- vabal.u8 q12, d6, d14
- vabal.u8 q13, d7, d15
-
- vld1.8 {q1}, [r0], r1
- vld1.8 {q5}, [r2], r3
-
- vabal.u8 q12, d0, d8
- vabal.u8 q13, d1, d9
-
- vld1.8 {q2}, [r0], r1
- vld1.8 {q6}, [r2], r3
-
- vabal.u8 q12, d2, d10
- vabal.u8 q13, d3, d11
-
- vld1.8 {q3}, [r0], r1
- vld1.8 {q7}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q13, d5, d13
-
-;;
- vld1.8 {q0}, [r0], r1
- vld1.8 {q4}, [r2], r3
-
- vabal.u8 q12, d6, d14
- vabal.u8 q13, d7, d15
-
- vld1.8 {q1}, [r0], r1
- vld1.8 {q5}, [r2], r3
-
- vabal.u8 q12, d0, d8
- vabal.u8 q13, d1, d9
-
- vld1.8 {q2}, [r0], r1
- vld1.8 {q6}, [r2], r3
-
- vabal.u8 q12, d2, d10
- vabal.u8 q13, d3, d11
-
- vld1.8 {q3}, [r0]
- vld1.8 {q7}, [r2]
-
- vabal.u8 q12, d4, d12
- vabal.u8 q13, d5, d13
-
- vabal.u8 q12, d6, d14
- vabal.u8 q13, d7, d15
-
- vadd.u16 q0, q12, q13
-
- vpaddl.u16 q1, q0
- vpaddl.u32 q0, q1
-
- vadd.u32 d0, d0, d1
-
- vmov.32 r0, d0[0]
-
- bx lr
-
- ENDP
-
-;==============================
-;unsigned int vp8_sad16x8_c(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-|vp8_sad16x8_neon| PROC
- vld1.8 {q0}, [r0], r1
- vld1.8 {q4}, [r2], r3
-
- vld1.8 {q1}, [r0], r1
- vld1.8 {q5}, [r2], r3
-
- vabdl.u8 q12, d0, d8
- vabdl.u8 q13, d1, d9
-
- vld1.8 {q2}, [r0], r1
- vld1.8 {q6}, [r2], r3
-
- vabal.u8 q12, d2, d10
- vabal.u8 q13, d3, d11
-
- vld1.8 {q3}, [r0], r1
- vld1.8 {q7}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q13, d5, d13
-
- vld1.8 {q0}, [r0], r1
- vld1.8 {q4}, [r2], r3
-
- vabal.u8 q12, d6, d14
- vabal.u8 q13, d7, d15
-
- vld1.8 {q1}, [r0], r1
- vld1.8 {q5}, [r2], r3
-
- vabal.u8 q12, d0, d8
- vabal.u8 q13, d1, d9
-
- vld1.8 {q2}, [r0], r1
- vld1.8 {q6}, [r2], r3
-
- vabal.u8 q12, d2, d10
- vabal.u8 q13, d3, d11
-
- vld1.8 {q3}, [r0], r1
- vld1.8 {q7}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q13, d5, d13
-
- vabal.u8 q12, d6, d14
- vabal.u8 q13, d7, d15
-
- vadd.u16 q0, q12, q13
-
- vpaddl.u16 q1, q0
- vpaddl.u32 q0, q1
-
- vadd.u32 d0, d0, d1
-
- vmov.32 r0, d0[0]
-
- bx lr
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad8_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad8_neon.asm
deleted file mode 100644
index 23ba6df..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sad8_neon.asm
+++ /dev/null
@@ -1,209 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sad8x8_neon|
- EXPORT |vp8_sad8x16_neon|
- EXPORT |vp8_sad4x4_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-; unsigned int vp8_sad8x8_c(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-
-|vp8_sad8x8_neon| PROC
- vld1.8 {d0}, [r0], r1
- vld1.8 {d8}, [r2], r3
-
- vld1.8 {d2}, [r0], r1
- vld1.8 {d10}, [r2], r3
-
- vabdl.u8 q12, d0, d8
-
- vld1.8 {d4}, [r0], r1
- vld1.8 {d12}, [r2], r3
-
- vabal.u8 q12, d2, d10
-
- vld1.8 {d6}, [r0], r1
- vld1.8 {d14}, [r2], r3
-
- vabal.u8 q12, d4, d12
-
- vld1.8 {d0}, [r0], r1
- vld1.8 {d8}, [r2], r3
-
- vabal.u8 q12, d6, d14
-
- vld1.8 {d2}, [r0], r1
- vld1.8 {d10}, [r2], r3
-
- vabal.u8 q12, d0, d8
-
- vld1.8 {d4}, [r0], r1
- vld1.8 {d12}, [r2], r3
-
- vabal.u8 q12, d2, d10
-
- vld1.8 {d6}, [r0], r1
- vld1.8 {d14}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q12, d6, d14
-
- vpaddl.u16 q1, q12
- vpaddl.u32 q0, q1
- vadd.u32 d0, d0, d1
-
- vmov.32 r0, d0[0]
-
- bx lr
-
- ENDP
-
-;============================
-;unsigned int vp8_sad8x16_c(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-
-|vp8_sad8x16_neon| PROC
- vld1.8 {d0}, [r0], r1
- vld1.8 {d8}, [r2], r3
-
- vld1.8 {d2}, [r0], r1
- vld1.8 {d10}, [r2], r3
-
- vabdl.u8 q12, d0, d8
-
- vld1.8 {d4}, [r0], r1
- vld1.8 {d12}, [r2], r3
-
- vabal.u8 q12, d2, d10
-
- vld1.8 {d6}, [r0], r1
- vld1.8 {d14}, [r2], r3
-
- vabal.u8 q12, d4, d12
-
- vld1.8 {d0}, [r0], r1
- vld1.8 {d8}, [r2], r3
-
- vabal.u8 q12, d6, d14
-
- vld1.8 {d2}, [r0], r1
- vld1.8 {d10}, [r2], r3
-
- vabal.u8 q12, d0, d8
-
- vld1.8 {d4}, [r0], r1
- vld1.8 {d12}, [r2], r3
-
- vabal.u8 q12, d2, d10
-
- vld1.8 {d6}, [r0], r1
- vld1.8 {d14}, [r2], r3
-
- vabal.u8 q12, d4, d12
-
- vld1.8 {d0}, [r0], r1
- vld1.8 {d8}, [r2], r3
-
- vabal.u8 q12, d6, d14
-
- vld1.8 {d2}, [r0], r1
- vld1.8 {d10}, [r2], r3
-
- vabal.u8 q12, d0, d8
-
- vld1.8 {d4}, [r0], r1
- vld1.8 {d12}, [r2], r3
-
- vabal.u8 q12, d2, d10
-
- vld1.8 {d6}, [r0], r1
- vld1.8 {d14}, [r2], r3
-
- vabal.u8 q12, d4, d12
-
- vld1.8 {d0}, [r0], r1
- vld1.8 {d8}, [r2], r3
-
- vabal.u8 q12, d6, d14
-
- vld1.8 {d2}, [r0], r1
- vld1.8 {d10}, [r2], r3
-
- vabal.u8 q12, d0, d8
-
- vld1.8 {d4}, [r0], r1
- vld1.8 {d12}, [r2], r3
-
- vabal.u8 q12, d2, d10
-
- vld1.8 {d6}, [r0], r1
- vld1.8 {d14}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q12, d6, d14
-
- vpaddl.u16 q1, q12
- vpaddl.u32 q0, q1
- vadd.u32 d0, d0, d1
-
- vmov.32 r0, d0[0]
-
- bx lr
-
- ENDP
-
-;===========================
-;unsigned int vp8_sad4x4_c(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-
-|vp8_sad4x4_neon| PROC
- vld1.8 {d0}, [r0], r1
- vld1.8 {d8}, [r2], r3
-
- vld1.8 {d2}, [r0], r1
- vld1.8 {d10}, [r2], r3
-
- vabdl.u8 q12, d0, d8
-
- vld1.8 {d4}, [r0], r1
- vld1.8 {d12}, [r2], r3
-
- vabal.u8 q12, d2, d10
-
- vld1.8 {d6}, [r0], r1
- vld1.8 {d14}, [r2], r3
-
- vabal.u8 q12, d4, d12
- vabal.u8 q12, d6, d14
-
- vpaddl.u16 d1, d24
- vpaddl.u32 d0, d1
- vmov.32 r0, d0[0]
-
- bx lr
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/save_reg_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/save_reg_neon.asm
deleted file mode 100644
index fd7002e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/save_reg_neon.asm
+++ /dev/null
@@ -1,36 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_push_neon|
- EXPORT |vp8_pop_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-|vp8_push_neon| PROC
- vst1.i64 {d8, d9, d10, d11}, [r0]!
- vst1.i64 {d12, d13, d14, d15}, [r0]!
- bx lr
-
- ENDP
-
-|vp8_pop_neon| PROC
- vld1.i64 {d8, d9, d10, d11}, [r0]!
- vld1.i64 {d12, d13, d14, d15}, [r0]!
- bx lr
-
- ENDP
-
- END
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm
deleted file mode 100644
index 67d2ab0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/shortidct4x4llm_neon.asm
+++ /dev/null
@@ -1,139 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_short_idct4x4llm_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;*************************************************************
-;void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch,
-; unsigned char *dst, int stride)
-;r0 short * input
-;r1 short * pred
-;r2 int pitch
-;r3 unsigned char dst
-;sp int stride
-;*************************************************************
-
-; static const int cospi8sqrt2minus1=20091;
-; static const int sinpi8sqrt2 =35468;
-; static const int rounding = 0;
-
-; Optimization note: The resulted data from dequantization are signed
-; 13-bit data that is in the range of [-4096, 4095]. This allows to
-; use "vqdmulh"(neon) instruction since it won't go out of range
-; (13+16+1=30bits<32bits). This instruction gives the high half
-; result of the multiplication that is needed in IDCT.
-
-|vp8_short_idct4x4llm_neon| PROC
- adr r12, idct_coeff
- vld1.16 {q1, q2}, [r0]
- vld1.16 {d0}, [r12]
-
- vswp d3, d4 ;q2(vp[4] vp[12])
- ldr r0, [sp] ; stride
-
- vqdmulh.s16 q3, q2, d0[2]
- vqdmulh.s16 q4, q2, d0[0]
-
- vqadd.s16 d12, d2, d3 ;a1
- vqsub.s16 d13, d2, d3 ;b1
-
- vshr.s16 q3, q3, #1
- vshr.s16 q4, q4, #1
-
- vqadd.s16 q3, q3, q2 ;modify since sinpi8sqrt2 > 65536/2 (negtive number)
- vqadd.s16 q4, q4, q2
-
- ;d6 - c1:temp1
- ;d7 - d1:temp2
- ;d8 - d1:temp1
- ;d9 - c1:temp2
-
- vqsub.s16 d10, d6, d9 ;c1
- vqadd.s16 d11, d7, d8 ;d1
-
- vqadd.s16 d2, d12, d11
- vqadd.s16 d3, d13, d10
- vqsub.s16 d4, d13, d10
- vqsub.s16 d5, d12, d11
-
- vtrn.32 d2, d4
- vtrn.32 d3, d5
- vtrn.16 d2, d3
- vtrn.16 d4, d5
-
- vswp d3, d4
-
- vqdmulh.s16 q3, q2, d0[2]
- vqdmulh.s16 q4, q2, d0[0]
-
- vqadd.s16 d12, d2, d3 ;a1
- vqsub.s16 d13, d2, d3 ;b1
-
- vshr.s16 q3, q3, #1
- vshr.s16 q4, q4, #1
-
- vqadd.s16 q3, q3, q2 ;modify since sinpi8sqrt2 > 65536/2 (negtive number)
- vqadd.s16 q4, q4, q2
-
- vqsub.s16 d10, d6, d9 ;c1
- vqadd.s16 d11, d7, d8 ;d1
-
- vqadd.s16 d2, d12, d11
- vqadd.s16 d3, d13, d10
- vqsub.s16 d4, d13, d10
- vqsub.s16 d5, d12, d11
-
- vrshr.s16 d2, d2, #3
- vrshr.s16 d3, d3, #3
- vrshr.s16 d4, d4, #3
- vrshr.s16 d5, d5, #3
-
- vtrn.32 d2, d4
- vtrn.32 d3, d5
- vtrn.16 d2, d3
- vtrn.16 d4, d5
-
- ; load prediction data
- vld1.32 d6[0], [r1], r2
- vld1.32 d6[1], [r1], r2
- vld1.32 d7[0], [r1], r2
- vld1.32 d7[1], [r1], r2
-
- ; add prediction and residual
- vaddw.u8 q1, q1, d6
- vaddw.u8 q2, q2, d7
-
- vqmovun.s16 d1, q1
- vqmovun.s16 d2, q2
-
- ; store to destination
- vst1.32 d1[0], [r3], r0
- vst1.32 d1[1], [r3], r0
- vst1.32 d2[0], [r3], r0
- vst1.32 d2[1], [r3], r0
-
- bx lr
-
- ENDP
-
-;-----------------
-
-idct_coeff
- DCD 0x4e7b4e7b, 0x8a8c8a8c
-
-;20091, 20091, 35468, 35468
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm
deleted file mode 100644
index 9fdafd3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict16x16_neon.asm
+++ /dev/null
@@ -1,490 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sixtap_predict16x16_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-filter16_coeff
- DCD 0, 0, 128, 0, 0, 0, 0, 0
- DCD 0, -6, 123, 12, -1, 0, 0, 0
- DCD 2, -11, 108, 36, -8, 1, 0, 0
- DCD 0, -9, 93, 50, -6, 0, 0, 0
- DCD 3, -16, 77, 77, -16, 3, 0, 0
- DCD 0, -6, 50, 93, -9, 0, 0, 0
- DCD 1, -8, 36, 108, -11, 2, 0, 0
- DCD 0, -1, 12, 123, -6, 0, 0, 0
-
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; r4 unsigned char *dst_ptr,
-; stack(r5) int dst_pitch
-
-;Note: To take advantage of 8-bit mulplication instruction in NEON. First apply abs() to
-; filter coeffs to make them u8. Then, use vmlsl for negtive coeffs. After multiplication,
-; the result can be negtive. So, I treat the result as s16. But, since it is also possible
-; that the result can be a large positive number (> 2^15-1), which could be confused as a
-; negtive number. To avoid that error, apply filter coeffs in the order of 0, 1, 4 ,5 ,2,
-; which ensures that the result stays in s16 range. Finally, saturated add the result by
-; applying 3rd filter coeff. Same applys to other filter functions.
-
-|vp8_sixtap_predict16x16_neon| PROC
- push {r4-r5, lr}
-
- adr r12, filter16_coeff
- ldr r4, [sp, #12] ;load parameters from stack
- ldr r5, [sp, #16] ;load parameters from stack
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- beq secondpass_filter16x16_only
-
- add r2, r12, r2, lsl #5 ;calculate filter location
-
- cmp r3, #0 ;skip second_pass filter if yoffset=0
-
- vld1.s32 {q14, q15}, [r2] ;load first_pass filter
-
- beq firstpass_filter16x16_only
-
- sub sp, sp, #336 ;reserve space on stack for temporary storage
- mov lr, sp
-
- vabs.s32 q12, q14
- vabs.s32 q13, q15
-
- mov r2, #7 ;loop counter
- sub r0, r0, #2 ;move srcptr back to (line-2) and (column-2)
- sub r0, r0, r1, lsl #1
-
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vdup.8 d1, d24[4]
- vdup.8 d2, d25[0]
- vdup.8 d3, d25[4]
- vdup.8 d4, d26[0]
- vdup.8 d5, d26[4]
-
-;First Pass: output_height lines x output_width columns (21x16)
-filt_blk2d_fp16x16_loop_neon
- vld1.u8 {d6, d7, d8}, [r0], r1 ;load src data
- vld1.u8 {d9, d10, d11}, [r0], r1
- vld1.u8 {d12, d13, d14}, [r0], r1
-
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vmull.u8 q8, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q9, d7, d0
- vmull.u8 q10, d9, d0
- vmull.u8 q11, d10, d0
- vmull.u8 q12, d12, d0
- vmull.u8 q13, d13, d0
-
- vext.8 d28, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d29, d9, d10, #1
- vext.8 d30, d12, d13, #1
-
- vmlsl.u8 q8, d28, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q10, d29, d1
- vmlsl.u8 q12, d30, d1
-
- vext.8 d28, d7, d8, #1
- vext.8 d29, d10, d11, #1
- vext.8 d30, d13, d14, #1
-
- vmlsl.u8 q9, d28, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q11, d29, d1
- vmlsl.u8 q13, d30, d1
-
- vext.8 d28, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d29, d9, d10, #4
- vext.8 d30, d12, d13, #4
-
- vmlsl.u8 q8, d28, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q10, d29, d4
- vmlsl.u8 q12, d30, d4
-
- vext.8 d28, d7, d8, #4
- vext.8 d29, d10, d11, #4
- vext.8 d30, d13, d14, #4
-
- vmlsl.u8 q9, d28, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q11, d29, d4
- vmlsl.u8 q13, d30, d4
-
- vext.8 d28, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d29, d9, d10, #5
- vext.8 d30, d12, d13, #5
-
- vmlal.u8 q8, d28, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q10, d29, d5
- vmlal.u8 q12, d30, d5
-
- vext.8 d28, d7, d8, #5
- vext.8 d29, d10, d11, #5
- vext.8 d30, d13, d14, #5
-
- vmlal.u8 q9, d28, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q11, d29, d5
- vmlal.u8 q13, d30, d5
-
- vext.8 d28, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d29, d9, d10, #2
- vext.8 d30, d12, d13, #2
-
- vmlal.u8 q8, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q10, d29, d2
- vmlal.u8 q12, d30, d2
-
- vext.8 d28, d7, d8, #2
- vext.8 d29, d10, d11, #2
- vext.8 d30, d13, d14, #2
-
- vmlal.u8 q9, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q11, d29, d2
- vmlal.u8 q13, d30, d2
-
- vext.8 d28, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d29, d9, d10, #3
- vext.8 d30, d12, d13, #3
-
- vext.8 d15, d7, d8, #3
- vext.8 d31, d10, d11, #3
- vext.8 d6, d13, d14, #3
-
- vmull.u8 q4, d28, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q5, d29, d3
- vmull.u8 q6, d30, d3
-
- vqadd.s16 q8, q4 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q10, q5
- vqadd.s16 q12, q6
-
- vmull.u8 q6, d15, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q7, d31, d3
- vmull.u8 q3, d6, d3
-
- subs r2, r2, #1
-
- vqadd.s16 q9, q6
- vqadd.s16 q11, q7
- vqadd.s16 q13, q3
-
- vqrshrun.s16 d6, q8, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q9, #7
- vqrshrun.s16 d8, q10, #7
- vqrshrun.s16 d9, q11, #7
- vqrshrun.s16 d10, q12, #7
- vqrshrun.s16 d11, q13, #7
-
- vst1.u8 {d6, d7, d8}, [lr]! ;store result
- vst1.u8 {d9, d10, d11}, [lr]!
-
- bne filt_blk2d_fp16x16_loop_neon
-
-;Second pass: 16x16
-;secondpass_filter - do first 8-columns and then second 8-columns
- add r3, r12, r3, lsl #5
- sub lr, lr, #336
-
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
- mov r3, #2 ;loop counter
-
- vabs.s32 q7, q5
- vabs.s32 q8, q6
-
- mov r2, #16
-
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vdup.8 d1, d14[4]
- vdup.8 d2, d15[0]
- vdup.8 d3, d15[4]
- vdup.8 d4, d16[0]
- vdup.8 d5, d16[4]
-
-filt_blk2d_sp16x16_outloop_neon
- vld1.u8 {d18}, [lr], r2 ;load src data
- vld1.u8 {d19}, [lr], r2
- vld1.u8 {d20}, [lr], r2
- vld1.u8 {d21}, [lr], r2
- mov r12, #4 ;loop counter
- vld1.u8 {d22}, [lr], r2
-
-secondpass_inner_loop_neon
- vld1.u8 {d23}, [lr], r2 ;load src data
- vld1.u8 {d24}, [lr], r2
- vld1.u8 {d25}, [lr], r2
- vld1.u8 {d26}, [lr], r2
-
- vmull.u8 q3, d18, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d19, d0
- vmull.u8 q5, d20, d0
- vmull.u8 q6, d21, d0
-
- vmlsl.u8 q3, d19, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q4, d20, d1
- vmlsl.u8 q5, d21, d1
- vmlsl.u8 q6, d22, d1
-
- vmlsl.u8 q3, d22, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d23, d4
- vmlsl.u8 q5, d24, d4
- vmlsl.u8 q6, d25, d4
-
- vmlal.u8 q3, d20, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d21, d2
- vmlal.u8 q5, d22, d2
- vmlal.u8 q6, d23, d2
-
- vmlal.u8 q3, d23, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q4, d24, d5
- vmlal.u8 q5, d25, d5
- vmlal.u8 q6, d26, d5
-
- vmull.u8 q7, d21, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q8, d22, d3
- vmull.u8 q9, d23, d3
- vmull.u8 q10, d24, d3
-
- subs r12, r12, #1
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vqrshrun.s16 d6, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q8, #7
- vqrshrun.s16 d8, q9, #7
- vqrshrun.s16 d9, q10, #7
-
- vst1.u8 {d6}, [r4], r5 ;store result
- vmov q9, q11
- vst1.u8 {d7}, [r4], r5
- vmov q10, q12
- vst1.u8 {d8}, [r4], r5
- vmov d22, d26
- vst1.u8 {d9}, [r4], r5
-
- bne secondpass_inner_loop_neon
-
- subs r3, r3, #1
- sub lr, lr, #336
- add lr, lr, #8
-
- sub r4, r4, r5, lsl #4
- add r4, r4, #8
-
- bne filt_blk2d_sp16x16_outloop_neon
-
- add sp, sp, #336
- pop {r4-r5,pc}
-
-;--------------------
-firstpass_filter16x16_only
- vabs.s32 q12, q14
- vabs.s32 q13, q15
-
- mov r2, #8 ;loop counter
- sub r0, r0, #2 ;move srcptr back to (column-2)
-
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vdup.8 d1, d24[4]
- vdup.8 d2, d25[0]
- vdup.8 d3, d25[4]
- vdup.8 d4, d26[0]
- vdup.8 d5, d26[4]
-
-;First Pass: output_height lines x output_width columns (16x16)
-filt_blk2d_fpo16x16_loop_neon
- vld1.u8 {d6, d7, d8}, [r0], r1 ;load src data
- vld1.u8 {d9, d10, d11}, [r0], r1
-
- pld [r0]
- pld [r0, r1]
-
- vmull.u8 q6, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q7, d7, d0
- vmull.u8 q8, d9, d0
- vmull.u8 q9, d10, d0
-
- vext.8 d20, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d21, d9, d10, #1
- vext.8 d22, d7, d8, #1
- vext.8 d23, d10, d11, #1
- vext.8 d24, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d25, d9, d10, #4
- vext.8 d26, d7, d8, #4
- vext.8 d27, d10, d11, #4
- vext.8 d28, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d29, d9, d10, #5
-
- vmlsl.u8 q6, d20, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d21, d1
- vmlsl.u8 q7, d22, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q9, d23, d1
- vmlsl.u8 q6, d24, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d25, d4
- vmlsl.u8 q7, d26, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q9, d27, d4
- vmlal.u8 q6, d28, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q8, d29, d5
-
- vext.8 d20, d7, d8, #5
- vext.8 d21, d10, d11, #5
- vext.8 d22, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d23, d9, d10, #2
- vext.8 d24, d7, d8, #2
- vext.8 d25, d10, d11, #2
-
- vext.8 d26, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d27, d9, d10, #3
- vext.8 d28, d7, d8, #3
- vext.8 d29, d10, d11, #3
-
- vmlal.u8 q7, d20, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q9, d21, d5
- vmlal.u8 q6, d22, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d23, d2
- vmlal.u8 q7, d24, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q9, d25, d2
-
- vmull.u8 q10, d26, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q11, d27, d3
- vmull.u8 q12, d28, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q15, d29, d3
-
- vqadd.s16 q6, q10 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q11
- vqadd.s16 q7, q12
- vqadd.s16 q9, q15
-
- subs r2, r2, #1
-
- vqrshrun.s16 d6, q6, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q7, #7
- vqrshrun.s16 d8, q8, #7
- vqrshrun.s16 d9, q9, #7
-
- vst1.u8 {q3}, [r4], r5 ;store result
- vst1.u8 {q4}, [r4], r5
-
- bne filt_blk2d_fpo16x16_loop_neon
-
- pop {r4-r5,pc}
-
-;--------------------
-secondpass_filter16x16_only
-;Second pass: 16x16
- add r3, r12, r3, lsl #5
- sub r0, r0, r1, lsl #1
-
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
- mov r3, #2 ;loop counter
-
- vabs.s32 q7, q5
- vabs.s32 q8, q6
-
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vdup.8 d1, d14[4]
- vdup.8 d2, d15[0]
- vdup.8 d3, d15[4]
- vdup.8 d4, d16[0]
- vdup.8 d5, d16[4]
-
-filt_blk2d_spo16x16_outloop_neon
- vld1.u8 {d18}, [r0], r1 ;load src data
- vld1.u8 {d19}, [r0], r1
- vld1.u8 {d20}, [r0], r1
- vld1.u8 {d21}, [r0], r1
- mov r12, #4 ;loop counter
- vld1.u8 {d22}, [r0], r1
-
-secondpass_only_inner_loop_neon
- vld1.u8 {d23}, [r0], r1 ;load src data
- vld1.u8 {d24}, [r0], r1
- vld1.u8 {d25}, [r0], r1
- vld1.u8 {d26}, [r0], r1
-
- vmull.u8 q3, d18, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d19, d0
- vmull.u8 q5, d20, d0
- vmull.u8 q6, d21, d0
-
- vmlsl.u8 q3, d19, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q4, d20, d1
- vmlsl.u8 q5, d21, d1
- vmlsl.u8 q6, d22, d1
-
- vmlsl.u8 q3, d22, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d23, d4
- vmlsl.u8 q5, d24, d4
- vmlsl.u8 q6, d25, d4
-
- vmlal.u8 q3, d20, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d21, d2
- vmlal.u8 q5, d22, d2
- vmlal.u8 q6, d23, d2
-
- vmlal.u8 q3, d23, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q4, d24, d5
- vmlal.u8 q5, d25, d5
- vmlal.u8 q6, d26, d5
-
- vmull.u8 q7, d21, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q8, d22, d3
- vmull.u8 q9, d23, d3
- vmull.u8 q10, d24, d3
-
- subs r12, r12, #1
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vqrshrun.s16 d6, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q8, #7
- vqrshrun.s16 d8, q9, #7
- vqrshrun.s16 d9, q10, #7
-
- vst1.u8 {d6}, [r4], r5 ;store result
- vmov q9, q11
- vst1.u8 {d7}, [r4], r5
- vmov q10, q12
- vst1.u8 {d8}, [r4], r5
- vmov d22, d26
- vst1.u8 {d9}, [r4], r5
-
- bne secondpass_only_inner_loop_neon
-
- subs r3, r3, #1
- sub r0, r0, r1, lsl #4
- sub r0, r0, r1, lsl #2
- sub r0, r0, r1
- add r0, r0, #8
-
- sub r4, r4, r5, lsl #4
- add r4, r4, #8
-
- bne filt_blk2d_spo16x16_outloop_neon
-
- pop {r4-r5,pc}
-
- ENDP
-
-;-----------------
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm
deleted file mode 100644
index a4222bc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict4x4_neon.asm
+++ /dev/null
@@ -1,422 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sixtap_predict4x4_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-filter4_coeff
- DCD 0, 0, 128, 0, 0, 0, 0, 0
- DCD 0, -6, 123, 12, -1, 0, 0, 0
- DCD 2, -11, 108, 36, -8, 1, 0, 0
- DCD 0, -9, 93, 50, -6, 0, 0, 0
- DCD 3, -16, 77, 77, -16, 3, 0, 0
- DCD 0, -6, 50, 93, -9, 0, 0, 0
- DCD 1, -8, 36, 108, -11, 2, 0, 0
- DCD 0, -1, 12, 123, -6, 0, 0, 0
-
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; stack(r4) unsigned char *dst_ptr,
-; stack(lr) int dst_pitch
-
-|vp8_sixtap_predict4x4_neon| PROC
- push {r4, lr}
-
- adr r12, filter4_coeff
- ldr r4, [sp, #8] ;load parameters from stack
- ldr lr, [sp, #12] ;load parameters from stack
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- beq secondpass_filter4x4_only
-
- add r2, r12, r2, lsl #5 ;calculate filter location
-
- cmp r3, #0 ;skip second_pass filter if yoffset=0
- vld1.s32 {q14, q15}, [r2] ;load first_pass filter
-
- beq firstpass_filter4x4_only
-
- vabs.s32 q12, q14 ;get abs(filer_parameters)
- vabs.s32 q13, q15
-
- sub r0, r0, #2 ;go back 2 columns of src data
- sub r0, r0, r1, lsl #1 ;go back 2 lines of src data
-
-;First pass: output_height lines x output_width columns (9x4)
- vld1.u8 {q3}, [r0], r1 ;load first 4-line src data
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vld1.u8 {q4}, [r0], r1
- vdup.8 d1, d24[4]
- vld1.u8 {q5}, [r0], r1
- vdup.8 d2, d25[0]
- vld1.u8 {q6}, [r0], r1
- vdup.8 d3, d25[4]
- vdup.8 d4, d26[0]
- vdup.8 d5, d26[4]
-
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vext.8 d18, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d19, d8, d9, #5
- vext.8 d20, d10, d11, #5
- vext.8 d21, d12, d13, #5
-
- vswp d7, d8 ;discard 2nd half data after src_ptr[3] is done
- vswp d11, d12
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[3])
- vzip.32 d20, d21
- vmull.u8 q7, d18, d5 ;(src_ptr[3] * vp8_filter[5])
- vmull.u8 q8, d20, d5
-
- vmov q4, q3 ;keep original src data in q4 q6
- vmov q6, q5
-
- vzip.32 d6, d7 ;construct src_ptr[-2], and put 2-line data together
- vzip.32 d10, d11
- vshr.u64 q9, q4, #8 ;construct src_ptr[-1]
- vshr.u64 q10, q6, #8
- vmlal.u8 q7, d6, d0 ;+(src_ptr[-2] * vp8_filter[0])
- vmlal.u8 q8, d10, d0
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[-1])
- vzip.32 d20, d21
- vshr.u64 q3, q4, #32 ;construct src_ptr[2]
- vshr.u64 q5, q6, #32
- vmlsl.u8 q7, d18, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d20, d1
-
- vzip.32 d6, d7 ;put 2-line data in 1 register (src_ptr[2])
- vzip.32 d10, d11
- vshr.u64 q9, q4, #16 ;construct src_ptr[0]
- vshr.u64 q10, q6, #16
- vmlsl.u8 q7, d6, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d10, d4
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[0])
- vzip.32 d20, d21
- vshr.u64 q3, q4, #24 ;construct src_ptr[1]
- vshr.u64 q5, q6, #24
- vmlal.u8 q7, d18, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d20, d2
-
- vzip.32 d6, d7 ;put 2-line data in 1 register (src_ptr[1])
- vzip.32 d10, d11
- vmull.u8 q9, d6, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q10, d10, d3
-
- vld1.u8 {q3}, [r0], r1 ;load rest 5-line src data
- vld1.u8 {q4}, [r0], r1
-
- vqadd.s16 q7, q9 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q10
-
- vld1.u8 {q5}, [r0], r1
- vld1.u8 {q6}, [r0], r1
-
- vqrshrun.s16 d27, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d28, q8, #7
-
- ;First Pass on rest 5-line data
- vld1.u8 {q11}, [r0], r1
-
- vext.8 d18, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d19, d8, d9, #5
- vext.8 d20, d10, d11, #5
- vext.8 d21, d12, d13, #5
-
- vswp d7, d8 ;discard 2nd half data after src_ptr[3] is done
- vswp d11, d12
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[3])
- vzip.32 d20, d21
- vext.8 d31, d22, d23, #5 ;construct src_ptr[3]
- vmull.u8 q7, d18, d5 ;(src_ptr[3] * vp8_filter[5])
- vmull.u8 q8, d20, d5
- vmull.u8 q12, d31, d5 ;(src_ptr[3] * vp8_filter[5])
-
- vmov q4, q3 ;keep original src data in q4 q6
- vmov q6, q5
-
- vzip.32 d6, d7 ;construct src_ptr[-2], and put 2-line data together
- vzip.32 d10, d11
- vshr.u64 q9, q4, #8 ;construct src_ptr[-1]
- vshr.u64 q10, q6, #8
-
- vmlal.u8 q7, d6, d0 ;+(src_ptr[-2] * vp8_filter[0])
- vmlal.u8 q8, d10, d0
- vmlal.u8 q12, d22, d0 ;(src_ptr[-2] * vp8_filter[0])
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[-1])
- vzip.32 d20, d21
- vshr.u64 q3, q4, #32 ;construct src_ptr[2]
- vshr.u64 q5, q6, #32
- vext.8 d31, d22, d23, #1 ;construct src_ptr[-1]
-
- vmlsl.u8 q7, d18, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d20, d1
- vmlsl.u8 q12, d31, d1 ;-(src_ptr[-1] * vp8_filter[1])
-
- vzip.32 d6, d7 ;put 2-line data in 1 register (src_ptr[2])
- vzip.32 d10, d11
- vshr.u64 q9, q4, #16 ;construct src_ptr[0]
- vshr.u64 q10, q6, #16
- vext.8 d31, d22, d23, #4 ;construct src_ptr[2]
-
- vmlsl.u8 q7, d6, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d10, d4
- vmlsl.u8 q12, d31, d4 ;-(src_ptr[2] * vp8_filter[4])
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[0])
- vzip.32 d20, d21
- vshr.u64 q3, q4, #24 ;construct src_ptr[1]
- vshr.u64 q5, q6, #24
- vext.8 d31, d22, d23, #2 ;construct src_ptr[0]
-
- vmlal.u8 q7, d18, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d20, d2
- vmlal.u8 q12, d31, d2 ;(src_ptr[0] * vp8_filter[2])
-
- vzip.32 d6, d7 ;put 2-line data in 1 register (src_ptr[1])
- vzip.32 d10, d11
- vext.8 d31, d22, d23, #3 ;construct src_ptr[1]
- vmull.u8 q9, d6, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q10, d10, d3
- vmull.u8 q11, d31, d3 ;(src_ptr[1] * vp8_filter[3])
-
- add r3, r12, r3, lsl #5
-
- vqadd.s16 q7, q9 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q10
- vqadd.s16 q12, q11
-
- vext.8 d23, d27, d28, #4
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
-
- vqrshrun.s16 d29, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d30, q8, #7
- vqrshrun.s16 d31, q12, #7
-
-;Second pass: 4x4
- vabs.s32 q7, q5
- vabs.s32 q8, q6
-
- vext.8 d24, d28, d29, #4
- vext.8 d25, d29, d30, #4
- vext.8 d26, d30, d31, #4
-
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vdup.8 d1, d14[4]
- vdup.8 d2, d15[0]
- vdup.8 d3, d15[4]
- vdup.8 d4, d16[0]
- vdup.8 d5, d16[4]
-
- vmull.u8 q3, d27, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d28, d0
-
- vmull.u8 q5, d25, d5 ;(src_ptr[3] * vp8_filter[5])
- vmull.u8 q6, d26, d5
-
- vmlsl.u8 q3, d29, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d30, d4
-
- vmlsl.u8 q5, d23, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q6, d24, d1
-
- vmlal.u8 q3, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d29, d2
-
- vmlal.u8 q5, d24, d3 ;(src_ptr[1] * vp8_filter[3])
- vmlal.u8 q6, d25, d3
-
- add r0, r4, lr
- add r1, r0, lr
- add r2, r1, lr
-
- vqadd.s16 q5, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q6, q4
-
- vqrshrun.s16 d3, q5, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d4, q6, #7
-
- vst1.32 {d3[0]}, [r4] ;store result
- vst1.32 {d3[1]}, [r0]
- vst1.32 {d4[0]}, [r1]
- vst1.32 {d4[1]}, [r2]
-
- pop {r4, pc}
-
-
-;---------------------
-firstpass_filter4x4_only
- vabs.s32 q12, q14 ;get abs(filer_parameters)
- vabs.s32 q13, q15
-
- sub r0, r0, #2 ;go back 2 columns of src data
-
-;First pass: output_height lines x output_width columns (4x4)
- vld1.u8 {q3}, [r0], r1 ;load first 4-line src data
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vld1.u8 {q4}, [r0], r1
- vdup.8 d1, d24[4]
- vld1.u8 {q5}, [r0], r1
- vdup.8 d2, d25[0]
- vld1.u8 {q6}, [r0], r1
-
- vdup.8 d3, d25[4]
- vdup.8 d4, d26[0]
- vdup.8 d5, d26[4]
-
- vext.8 d18, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d19, d8, d9, #5
- vext.8 d20, d10, d11, #5
- vext.8 d21, d12, d13, #5
-
- vswp d7, d8 ;discard 2nd half data after src_ptr[3] is done
- vswp d11, d12
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[3])
- vzip.32 d20, d21
- vmull.u8 q7, d18, d5 ;(src_ptr[3] * vp8_filter[5])
- vmull.u8 q8, d20, d5
-
- vmov q4, q3 ;keep original src data in q4 q6
- vmov q6, q5
-
- vzip.32 d6, d7 ;construct src_ptr[-2], and put 2-line data together
- vzip.32 d10, d11
- vshr.u64 q9, q4, #8 ;construct src_ptr[-1]
- vshr.u64 q10, q6, #8
- vmlal.u8 q7, d6, d0 ;+(src_ptr[-2] * vp8_filter[0])
- vmlal.u8 q8, d10, d0
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[-1])
- vzip.32 d20, d21
- vshr.u64 q3, q4, #32 ;construct src_ptr[2]
- vshr.u64 q5, q6, #32
- vmlsl.u8 q7, d18, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d20, d1
-
- vzip.32 d6, d7 ;put 2-line data in 1 register (src_ptr[2])
- vzip.32 d10, d11
- vshr.u64 q9, q4, #16 ;construct src_ptr[0]
- vshr.u64 q10, q6, #16
- vmlsl.u8 q7, d6, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d10, d4
-
- vzip.32 d18, d19 ;put 2-line data in 1 register (src_ptr[0])
- vzip.32 d20, d21
- vshr.u64 q3, q4, #24 ;construct src_ptr[1]
- vshr.u64 q5, q6, #24
- vmlal.u8 q7, d18, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d20, d2
-
- vzip.32 d6, d7 ;put 2-line data in 1 register (src_ptr[1])
- vzip.32 d10, d11
- vmull.u8 q9, d6, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q10, d10, d3
-
- add r0, r4, lr
- add r1, r0, lr
- add r2, r1, lr
-
- vqadd.s16 q7, q9 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q10
-
- vqrshrun.s16 d27, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d28, q8, #7
-
- vst1.32 {d27[0]}, [r4] ;store result
- vst1.32 {d27[1]}, [r0]
- vst1.32 {d28[0]}, [r1]
- vst1.32 {d28[1]}, [r2]
-
- pop {r4, pc}
-
-
-;---------------------
-secondpass_filter4x4_only
- sub r0, r0, r1, lsl #1
- add r3, r12, r3, lsl #5
-
- vld1.32 {d27[0]}, [r0], r1 ;load src data
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
- vld1.32 {d27[1]}, [r0], r1
- vabs.s32 q7, q5
- vld1.32 {d28[0]}, [r0], r1
- vabs.s32 q8, q6
- vld1.32 {d28[1]}, [r0], r1
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vld1.32 {d29[0]}, [r0], r1
- vdup.8 d1, d14[4]
- vld1.32 {d29[1]}, [r0], r1
- vdup.8 d2, d15[0]
- vld1.32 {d30[0]}, [r0], r1
- vdup.8 d3, d15[4]
- vld1.32 {d30[1]}, [r0], r1
- vdup.8 d4, d16[0]
- vld1.32 {d31[0]}, [r0], r1
- vdup.8 d5, d16[4]
-
- vext.8 d23, d27, d28, #4
- vext.8 d24, d28, d29, #4
- vext.8 d25, d29, d30, #4
- vext.8 d26, d30, d31, #4
-
- vmull.u8 q3, d27, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d28, d0
-
- vmull.u8 q5, d25, d5 ;(src_ptr[3] * vp8_filter[5])
- vmull.u8 q6, d26, d5
-
- vmlsl.u8 q3, d29, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d30, d4
-
- vmlsl.u8 q5, d23, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q6, d24, d1
-
- vmlal.u8 q3, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d29, d2
-
- vmlal.u8 q5, d24, d3 ;(src_ptr[1] * vp8_filter[3])
- vmlal.u8 q6, d25, d3
-
- add r0, r4, lr
- add r1, r0, lr
- add r2, r1, lr
-
- vqadd.s16 q5, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q6, q4
-
- vqrshrun.s16 d3, q5, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d4, q6, #7
-
- vst1.32 {d3[0]}, [r4] ;store result
- vst1.32 {d3[1]}, [r0]
- vst1.32 {d4[0]}, [r1]
- vst1.32 {d4[1]}, [r2]
-
- pop {r4, pc}
-
- ENDP
-
-;-----------------
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm
deleted file mode 100644
index a57ec01..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x4_neon.asm
+++ /dev/null
@@ -1,473 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sixtap_predict8x4_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-filter8_coeff
- DCD 0, 0, 128, 0, 0, 0, 0, 0
- DCD 0, -6, 123, 12, -1, 0, 0, 0
- DCD 2, -11, 108, 36, -8, 1, 0, 0
- DCD 0, -9, 93, 50, -6, 0, 0, 0
- DCD 3, -16, 77, 77, -16, 3, 0, 0
- DCD 0, -6, 50, 93, -9, 0, 0, 0
- DCD 1, -8, 36, 108, -11, 2, 0, 0
- DCD 0, -1, 12, 123, -6, 0, 0, 0
-
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; r4 unsigned char *dst_ptr,
-; stack(r5) int dst_pitch
-
-|vp8_sixtap_predict8x4_neon| PROC
- push {r4-r5, lr}
-
- adr r12, filter8_coeff
- ldr r4, [sp, #12] ;load parameters from stack
- ldr r5, [sp, #16] ;load parameters from stack
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- beq secondpass_filter8x4_only
-
- add r2, r12, r2, lsl #5 ;calculate filter location
-
- cmp r3, #0 ;skip second_pass filter if yoffset=0
-
- vld1.s32 {q14, q15}, [r2] ;load first_pass filter
-
- beq firstpass_filter8x4_only
-
- sub sp, sp, #32 ;reserve space on stack for temporary storage
- vabs.s32 q12, q14
- vabs.s32 q13, q15
-
- sub r0, r0, #2 ;move srcptr back to (line-2) and (column-2)
- mov lr, sp
- sub r0, r0, r1, lsl #1
-
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vdup.8 d1, d24[4]
- vdup.8 d2, d25[0]
-
-;First pass: output_height lines x output_width columns (9x8)
- vld1.u8 {q3}, [r0], r1 ;load src data
- vdup.8 d3, d25[4]
- vld1.u8 {q4}, [r0], r1
- vdup.8 d4, d26[0]
- vld1.u8 {q5}, [r0], r1
- vdup.8 d5, d26[4]
- vld1.u8 {q6}, [r0], r1
-
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vmull.u8 q7, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q8, d8, d0
- vmull.u8 q9, d10, d0
- vmull.u8 q10, d12, d0
-
- vext.8 d28, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d29, d8, d9, #1
- vext.8 d30, d10, d11, #1
- vext.8 d31, d12, d13, #1
-
- vmlsl.u8 q7, d28, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d29, d1
- vmlsl.u8 q9, d30, d1
- vmlsl.u8 q10, d31, d1
-
- vext.8 d28, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d29, d8, d9, #4
- vext.8 d30, d10, d11, #4
- vext.8 d31, d12, d13, #4
-
- vmlsl.u8 q7, d28, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d29, d4
- vmlsl.u8 q9, d30, d4
- vmlsl.u8 q10, d31, d4
-
- vext.8 d28, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d29, d8, d9, #2
- vext.8 d30, d10, d11, #2
- vext.8 d31, d12, d13, #2
-
- vmlal.u8 q7, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d29, d2
- vmlal.u8 q9, d30, d2
- vmlal.u8 q10, d31, d2
-
- vext.8 d28, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d29, d8, d9, #5
- vext.8 d30, d10, d11, #5
- vext.8 d31, d12, d13, #5
-
- vmlal.u8 q7, d28, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q8, d29, d5
- vmlal.u8 q9, d30, d5
- vmlal.u8 q10, d31, d5
-
- vext.8 d28, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d29, d8, d9, #3
- vext.8 d30, d10, d11, #3
- vext.8 d31, d12, d13, #3
-
- vmull.u8 q3, d28, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q4, d29, d3
- vmull.u8 q5, d30, d3
- vmull.u8 q6, d31, d3
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vld1.u8 {q3}, [r0], r1 ;load src data
-
- vqrshrun.s16 d22, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d23, q8, #7
- vqrshrun.s16 d24, q9, #7
- vqrshrun.s16 d25, q10, #7
-
- vld1.u8 {q4}, [r0], r1
- vst1.u8 {d22}, [lr]! ;store result
- vld1.u8 {q5}, [r0], r1
- vst1.u8 {d23}, [lr]!
- vld1.u8 {q6}, [r0], r1
- vst1.u8 {d24}, [lr]!
- vld1.u8 {q7}, [r0], r1
- vst1.u8 {d25}, [lr]!
-
- ;first_pass filtering on the rest 5-line data
- vmull.u8 q8, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q9, d8, d0
- vmull.u8 q10, d10, d0
- vmull.u8 q11, d12, d0
- vmull.u8 q12, d14, d0
-
- vext.8 d27, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d28, d8, d9, #1
- vext.8 d29, d10, d11, #1
- vext.8 d30, d12, d13, #1
- vext.8 d31, d14, d15, #1
-
- vmlsl.u8 q8, d27, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q9, d28, d1
- vmlsl.u8 q10, d29, d1
- vmlsl.u8 q11, d30, d1
- vmlsl.u8 q12, d31, d1
-
- vext.8 d27, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d28, d8, d9, #4
- vext.8 d29, d10, d11, #4
- vext.8 d30, d12, d13, #4
- vext.8 d31, d14, d15, #4
-
- vmlsl.u8 q8, d27, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q9, d28, d4
- vmlsl.u8 q10, d29, d4
- vmlsl.u8 q11, d30, d4
- vmlsl.u8 q12, d31, d4
-
- vext.8 d27, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d28, d8, d9, #2
- vext.8 d29, d10, d11, #2
- vext.8 d30, d12, d13, #2
- vext.8 d31, d14, d15, #2
-
- vmlal.u8 q8, d27, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q9, d28, d2
- vmlal.u8 q10, d29, d2
- vmlal.u8 q11, d30, d2
- vmlal.u8 q12, d31, d2
-
- vext.8 d27, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d28, d8, d9, #5
- vext.8 d29, d10, d11, #5
- vext.8 d30, d12, d13, #5
- vext.8 d31, d14, d15, #5
-
- vmlal.u8 q8, d27, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q9, d28, d5
- vmlal.u8 q10, d29, d5
- vmlal.u8 q11, d30, d5
- vmlal.u8 q12, d31, d5
-
- vext.8 d27, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d28, d8, d9, #3
- vext.8 d29, d10, d11, #3
- vext.8 d30, d12, d13, #3
- vext.8 d31, d14, d15, #3
-
- vmull.u8 q3, d27, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q4, d28, d3
- vmull.u8 q5, d29, d3
- vmull.u8 q6, d30, d3
- vmull.u8 q7, d31, d3
-
- vqadd.s16 q8, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q9, q4
- vqadd.s16 q10, q5
- vqadd.s16 q11, q6
- vqadd.s16 q12, q7
-
- vqrshrun.s16 d26, q8, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d27, q9, #7
- vqrshrun.s16 d28, q10, #7
- vqrshrun.s16 d29, q11, #7 ;load intermediate data from stack
- vqrshrun.s16 d30, q12, #7
-
-;Second pass: 8x4
-;secondpass_filter
- add r3, r12, r3, lsl #5
- sub lr, lr, #32
-
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
- vld1.u8 {q11}, [lr]!
-
- vabs.s32 q7, q5
- vabs.s32 q8, q6
-
- vld1.u8 {q12}, [lr]!
-
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vdup.8 d1, d14[4]
- vdup.8 d2, d15[0]
- vdup.8 d3, d15[4]
- vdup.8 d4, d16[0]
- vdup.8 d5, d16[4]
-
- vmull.u8 q3, d22, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d23, d0
- vmull.u8 q5, d24, d0
- vmull.u8 q6, d25, d0
-
- vmlsl.u8 q3, d23, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q4, d24, d1
- vmlsl.u8 q5, d25, d1
- vmlsl.u8 q6, d26, d1
-
- vmlsl.u8 q3, d26, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d27, d4
- vmlsl.u8 q5, d28, d4
- vmlsl.u8 q6, d29, d4
-
- vmlal.u8 q3, d24, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d25, d2
- vmlal.u8 q5, d26, d2
- vmlal.u8 q6, d27, d2
-
- vmlal.u8 q3, d27, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q4, d28, d5
- vmlal.u8 q5, d29, d5
- vmlal.u8 q6, d30, d5
-
- vmull.u8 q7, d25, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q8, d26, d3
- vmull.u8 q9, d27, d3
- vmull.u8 q10, d28, d3
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vqrshrun.s16 d6, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q8, #7
- vqrshrun.s16 d8, q9, #7
- vqrshrun.s16 d9, q10, #7
-
- vst1.u8 {d6}, [r4], r5 ;store result
- vst1.u8 {d7}, [r4], r5
- vst1.u8 {d8}, [r4], r5
- vst1.u8 {d9}, [r4], r5
-
- add sp, sp, #32
- pop {r4-r5,pc}
-
-;--------------------
-firstpass_filter8x4_only
- vabs.s32 q12, q14
- vabs.s32 q13, q15
-
- sub r0, r0, #2 ;move srcptr back to (line-2) and (column-2)
- vld1.u8 {q3}, [r0], r1 ;load src data
-
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vld1.u8 {q4}, [r0], r1
- vdup.8 d1, d24[4]
- vld1.u8 {q5}, [r0], r1
- vdup.8 d2, d25[0]
- vld1.u8 {q6}, [r0], r1
- vdup.8 d3, d25[4]
- vdup.8 d4, d26[0]
- vdup.8 d5, d26[4]
-
-;First pass: output_height lines x output_width columns (4x8)
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vmull.u8 q7, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q8, d8, d0
- vmull.u8 q9, d10, d0
- vmull.u8 q10, d12, d0
-
- vext.8 d28, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d29, d8, d9, #1
- vext.8 d30, d10, d11, #1
- vext.8 d31, d12, d13, #1
-
- vmlsl.u8 q7, d28, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d29, d1
- vmlsl.u8 q9, d30, d1
- vmlsl.u8 q10, d31, d1
-
- vext.8 d28, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d29, d8, d9, #4
- vext.8 d30, d10, d11, #4
- vext.8 d31, d12, d13, #4
-
- vmlsl.u8 q7, d28, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d29, d4
- vmlsl.u8 q9, d30, d4
- vmlsl.u8 q10, d31, d4
-
- vext.8 d28, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d29, d8, d9, #2
- vext.8 d30, d10, d11, #2
- vext.8 d31, d12, d13, #2
-
- vmlal.u8 q7, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d29, d2
- vmlal.u8 q9, d30, d2
- vmlal.u8 q10, d31, d2
-
- vext.8 d28, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d29, d8, d9, #5
- vext.8 d30, d10, d11, #5
- vext.8 d31, d12, d13, #5
-
- vmlal.u8 q7, d28, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q8, d29, d5
- vmlal.u8 q9, d30, d5
- vmlal.u8 q10, d31, d5
-
- vext.8 d28, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d29, d8, d9, #3
- vext.8 d30, d10, d11, #3
- vext.8 d31, d12, d13, #3
-
- vmull.u8 q3, d28, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q4, d29, d3
- vmull.u8 q5, d30, d3
- vmull.u8 q6, d31, d3
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vqrshrun.s16 d22, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d23, q8, #7
- vqrshrun.s16 d24, q9, #7
- vqrshrun.s16 d25, q10, #7
-
- vst1.u8 {d22}, [r4], r5 ;store result
- vst1.u8 {d23}, [r4], r5
- vst1.u8 {d24}, [r4], r5
- vst1.u8 {d25}, [r4], r5
-
- pop {r4-r5,pc}
-
-;---------------------
-secondpass_filter8x4_only
-;Second pass: 8x4
- add r3, r12, r3, lsl #5
- sub r0, r0, r1, lsl #1
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
- vabs.s32 q7, q5
- vabs.s32 q8, q6
-
- vld1.u8 {d22}, [r0], r1
- vld1.u8 {d23}, [r0], r1
- vld1.u8 {d24}, [r0], r1
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vld1.u8 {d25}, [r0], r1
- vdup.8 d1, d14[4]
- vld1.u8 {d26}, [r0], r1
- vdup.8 d2, d15[0]
- vld1.u8 {d27}, [r0], r1
- vdup.8 d3, d15[4]
- vld1.u8 {d28}, [r0], r1
- vdup.8 d4, d16[0]
- vld1.u8 {d29}, [r0], r1
- vdup.8 d5, d16[4]
- vld1.u8 {d30}, [r0], r1
-
- vmull.u8 q3, d22, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d23, d0
- vmull.u8 q5, d24, d0
- vmull.u8 q6, d25, d0
-
- vmlsl.u8 q3, d23, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q4, d24, d1
- vmlsl.u8 q5, d25, d1
- vmlsl.u8 q6, d26, d1
-
- vmlsl.u8 q3, d26, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d27, d4
- vmlsl.u8 q5, d28, d4
- vmlsl.u8 q6, d29, d4
-
- vmlal.u8 q3, d24, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d25, d2
- vmlal.u8 q5, d26, d2
- vmlal.u8 q6, d27, d2
-
- vmlal.u8 q3, d27, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q4, d28, d5
- vmlal.u8 q5, d29, d5
- vmlal.u8 q6, d30, d5
-
- vmull.u8 q7, d25, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q8, d26, d3
- vmull.u8 q9, d27, d3
- vmull.u8 q10, d28, d3
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vqrshrun.s16 d6, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q8, #7
- vqrshrun.s16 d8, q9, #7
- vqrshrun.s16 d9, q10, #7
-
- vst1.u8 {d6}, [r4], r5 ;store result
- vst1.u8 {d7}, [r4], r5
- vst1.u8 {d8}, [r4], r5
- vst1.u8 {d9}, [r4], r5
-
- pop {r4-r5,pc}
-
- ENDP
-
-;-----------------
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm
deleted file mode 100644
index 00ed5ae..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/sixtappredict8x8_neon.asm
+++ /dev/null
@@ -1,524 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sixtap_predict8x8_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-filter8_coeff
- DCD 0, 0, 128, 0, 0, 0, 0, 0
- DCD 0, -6, 123, 12, -1, 0, 0, 0
- DCD 2, -11, 108, 36, -8, 1, 0, 0
- DCD 0, -9, 93, 50, -6, 0, 0, 0
- DCD 3, -16, 77, 77, -16, 3, 0, 0
- DCD 0, -6, 50, 93, -9, 0, 0, 0
- DCD 1, -8, 36, 108, -11, 2, 0, 0
- DCD 0, -1, 12, 123, -6, 0, 0, 0
-
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; stack(r4) unsigned char *dst_ptr,
-; stack(r5) int dst_pitch
-
-|vp8_sixtap_predict8x8_neon| PROC
- push {r4-r5, lr}
-
- adr r12, filter8_coeff
-
- ldr r4, [sp, #12] ;load parameters from stack
- ldr r5, [sp, #16] ;load parameters from stack
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- beq secondpass_filter8x8_only
-
- add r2, r12, r2, lsl #5 ;calculate filter location
-
- cmp r3, #0 ;skip second_pass filter if yoffset=0
-
- vld1.s32 {q14, q15}, [r2] ;load first_pass filter
-
- beq firstpass_filter8x8_only
-
- sub sp, sp, #64 ;reserve space on stack for temporary storage
- mov lr, sp
-
- vabs.s32 q12, q14
- vabs.s32 q13, q15
-
- mov r2, #2 ;loop counter
- sub r0, r0, #2 ;move srcptr back to (line-2) and (column-2)
- sub r0, r0, r1, lsl #1
-
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vdup.8 d1, d24[4]
- vdup.8 d2, d25[0]
-
-;First pass: output_height lines x output_width columns (13x8)
- vld1.u8 {q3}, [r0], r1 ;load src data
- vdup.8 d3, d25[4]
- vld1.u8 {q4}, [r0], r1
- vdup.8 d4, d26[0]
- vld1.u8 {q5}, [r0], r1
- vdup.8 d5, d26[4]
- vld1.u8 {q6}, [r0], r1
-
-filt_blk2d_fp8x8_loop_neon
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vmull.u8 q7, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q8, d8, d0
- vmull.u8 q9, d10, d0
- vmull.u8 q10, d12, d0
-
- vext.8 d28, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d29, d8, d9, #1
- vext.8 d30, d10, d11, #1
- vext.8 d31, d12, d13, #1
-
- vmlsl.u8 q7, d28, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d29, d1
- vmlsl.u8 q9, d30, d1
- vmlsl.u8 q10, d31, d1
-
- vext.8 d28, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d29, d8, d9, #4
- vext.8 d30, d10, d11, #4
- vext.8 d31, d12, d13, #4
-
- vmlsl.u8 q7, d28, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d29, d4
- vmlsl.u8 q9, d30, d4
- vmlsl.u8 q10, d31, d4
-
- vext.8 d28, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d29, d8, d9, #2
- vext.8 d30, d10, d11, #2
- vext.8 d31, d12, d13, #2
-
- vmlal.u8 q7, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d29, d2
- vmlal.u8 q9, d30, d2
- vmlal.u8 q10, d31, d2
-
- vext.8 d28, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d29, d8, d9, #5
- vext.8 d30, d10, d11, #5
- vext.8 d31, d12, d13, #5
-
- vmlal.u8 q7, d28, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q8, d29, d5
- vmlal.u8 q9, d30, d5
- vmlal.u8 q10, d31, d5
-
- vext.8 d28, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d29, d8, d9, #3
- vext.8 d30, d10, d11, #3
- vext.8 d31, d12, d13, #3
-
- vmull.u8 q3, d28, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q4, d29, d3
- vmull.u8 q5, d30, d3
- vmull.u8 q6, d31, d3
-
- subs r2, r2, #1
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vld1.u8 {q3}, [r0], r1 ;load src data
-
- vqrshrun.s16 d22, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d23, q8, #7
- vqrshrun.s16 d24, q9, #7
- vqrshrun.s16 d25, q10, #7
-
- vst1.u8 {d22}, [lr]! ;store result
- vld1.u8 {q4}, [r0], r1
- vst1.u8 {d23}, [lr]!
- vld1.u8 {q5}, [r0], r1
- vst1.u8 {d24}, [lr]!
- vld1.u8 {q6}, [r0], r1
- vst1.u8 {d25}, [lr]!
-
- bne filt_blk2d_fp8x8_loop_neon
-
- ;first_pass filtering on the rest 5-line data
- ;vld1.u8 {q3}, [r0], r1 ;load src data
- ;vld1.u8 {q4}, [r0], r1
- ;vld1.u8 {q5}, [r0], r1
- ;vld1.u8 {q6}, [r0], r1
- vld1.u8 {q7}, [r0], r1
-
- vmull.u8 q8, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q9, d8, d0
- vmull.u8 q10, d10, d0
- vmull.u8 q11, d12, d0
- vmull.u8 q12, d14, d0
-
- vext.8 d27, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d28, d8, d9, #1
- vext.8 d29, d10, d11, #1
- vext.8 d30, d12, d13, #1
- vext.8 d31, d14, d15, #1
-
- vmlsl.u8 q8, d27, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q9, d28, d1
- vmlsl.u8 q10, d29, d1
- vmlsl.u8 q11, d30, d1
- vmlsl.u8 q12, d31, d1
-
- vext.8 d27, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d28, d8, d9, #4
- vext.8 d29, d10, d11, #4
- vext.8 d30, d12, d13, #4
- vext.8 d31, d14, d15, #4
-
- vmlsl.u8 q8, d27, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q9, d28, d4
- vmlsl.u8 q10, d29, d4
- vmlsl.u8 q11, d30, d4
- vmlsl.u8 q12, d31, d4
-
- vext.8 d27, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d28, d8, d9, #2
- vext.8 d29, d10, d11, #2
- vext.8 d30, d12, d13, #2
- vext.8 d31, d14, d15, #2
-
- vmlal.u8 q8, d27, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q9, d28, d2
- vmlal.u8 q10, d29, d2
- vmlal.u8 q11, d30, d2
- vmlal.u8 q12, d31, d2
-
- vext.8 d27, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d28, d8, d9, #5
- vext.8 d29, d10, d11, #5
- vext.8 d30, d12, d13, #5
- vext.8 d31, d14, d15, #5
-
- vmlal.u8 q8, d27, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q9, d28, d5
- vmlal.u8 q10, d29, d5
- vmlal.u8 q11, d30, d5
- vmlal.u8 q12, d31, d5
-
- vext.8 d27, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d28, d8, d9, #3
- vext.8 d29, d10, d11, #3
- vext.8 d30, d12, d13, #3
- vext.8 d31, d14, d15, #3
-
- vmull.u8 q3, d27, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q4, d28, d3
- vmull.u8 q5, d29, d3
- vmull.u8 q6, d30, d3
- vmull.u8 q7, d31, d3
-
- vqadd.s16 q8, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q9, q4
- vqadd.s16 q10, q5
- vqadd.s16 q11, q6
- vqadd.s16 q12, q7
-
- add r3, r12, r3, lsl #5
-
- vqrshrun.s16 d26, q8, #7 ;shift/round/saturate to u8
- sub lr, lr, #64
- vqrshrun.s16 d27, q9, #7
- vld1.u8 {q9}, [lr]! ;load intermediate data from stack
- vqrshrun.s16 d28, q10, #7
- vld1.u8 {q10}, [lr]!
-
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
-
- vqrshrun.s16 d29, q11, #7
- vld1.u8 {q11}, [lr]!
-
- vabs.s32 q7, q5
- vabs.s32 q8, q6
-
- vqrshrun.s16 d30, q12, #7
- vld1.u8 {q12}, [lr]!
-
-;Second pass: 8x8
- mov r3, #2 ;loop counter
-
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vdup.8 d1, d14[4]
- vdup.8 d2, d15[0]
- vdup.8 d3, d15[4]
- vdup.8 d4, d16[0]
- vdup.8 d5, d16[4]
-
-filt_blk2d_sp8x8_loop_neon
- vmull.u8 q3, d18, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d19, d0
- vmull.u8 q5, d20, d0
- vmull.u8 q6, d21, d0
-
- vmlsl.u8 q3, d19, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q4, d20, d1
- vmlsl.u8 q5, d21, d1
- vmlsl.u8 q6, d22, d1
-
- vmlsl.u8 q3, d22, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d23, d4
- vmlsl.u8 q5, d24, d4
- vmlsl.u8 q6, d25, d4
-
- vmlal.u8 q3, d20, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d21, d2
- vmlal.u8 q5, d22, d2
- vmlal.u8 q6, d23, d2
-
- vmlal.u8 q3, d23, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q4, d24, d5
- vmlal.u8 q5, d25, d5
- vmlal.u8 q6, d26, d5
-
- vmull.u8 q7, d21, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q8, d22, d3
- vmull.u8 q9, d23, d3
- vmull.u8 q10, d24, d3
-
- subs r3, r3, #1
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vqrshrun.s16 d6, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q8, #7
- vqrshrun.s16 d8, q9, #7
- vqrshrun.s16 d9, q10, #7
-
- vmov q9, q11
- vst1.u8 {d6}, [r4], r5 ;store result
- vmov q10, q12
- vst1.u8 {d7}, [r4], r5
- vmov q11, q13
- vst1.u8 {d8}, [r4], r5
- vmov q12, q14
- vst1.u8 {d9}, [r4], r5
- vmov d26, d30
-
- bne filt_blk2d_sp8x8_loop_neon
-
- add sp, sp, #64
- pop {r4-r5,pc}
-
-;---------------------
-firstpass_filter8x8_only
- ;add r2, r12, r2, lsl #5 ;calculate filter location
- ;vld1.s32 {q14, q15}, [r2] ;load first_pass filter
- vabs.s32 q12, q14
- vabs.s32 q13, q15
-
- mov r2, #2 ;loop counter
- sub r0, r0, #2 ;move srcptr back to (line-2) and (column-2)
-
- vdup.8 d0, d24[0] ;first_pass filter (d0-d5)
- vdup.8 d1, d24[4]
- vdup.8 d2, d25[0]
- vdup.8 d3, d25[4]
- vdup.8 d4, d26[0]
- vdup.8 d5, d26[4]
-
-;First pass: output_height lines x output_width columns (8x8)
-filt_blk2d_fpo8x8_loop_neon
- vld1.u8 {q3}, [r0], r1 ;load src data
- vld1.u8 {q4}, [r0], r1
- vld1.u8 {q5}, [r0], r1
- vld1.u8 {q6}, [r0], r1
-
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vmull.u8 q7, d6, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q8, d8, d0
- vmull.u8 q9, d10, d0
- vmull.u8 q10, d12, d0
-
- vext.8 d28, d6, d7, #1 ;construct src_ptr[-1]
- vext.8 d29, d8, d9, #1
- vext.8 d30, d10, d11, #1
- vext.8 d31, d12, d13, #1
-
- vmlsl.u8 q7, d28, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q8, d29, d1
- vmlsl.u8 q9, d30, d1
- vmlsl.u8 q10, d31, d1
-
- vext.8 d28, d6, d7, #4 ;construct src_ptr[2]
- vext.8 d29, d8, d9, #4
- vext.8 d30, d10, d11, #4
- vext.8 d31, d12, d13, #4
-
- vmlsl.u8 q7, d28, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q8, d29, d4
- vmlsl.u8 q9, d30, d4
- vmlsl.u8 q10, d31, d4
-
- vext.8 d28, d6, d7, #2 ;construct src_ptr[0]
- vext.8 d29, d8, d9, #2
- vext.8 d30, d10, d11, #2
- vext.8 d31, d12, d13, #2
-
- vmlal.u8 q7, d28, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q8, d29, d2
- vmlal.u8 q9, d30, d2
- vmlal.u8 q10, d31, d2
-
- vext.8 d28, d6, d7, #5 ;construct src_ptr[3]
- vext.8 d29, d8, d9, #5
- vext.8 d30, d10, d11, #5
- vext.8 d31, d12, d13, #5
-
- vmlal.u8 q7, d28, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q8, d29, d5
- vmlal.u8 q9, d30, d5
- vmlal.u8 q10, d31, d5
-
- vext.8 d28, d6, d7, #3 ;construct src_ptr[1]
- vext.8 d29, d8, d9, #3
- vext.8 d30, d10, d11, #3
- vext.8 d31, d12, d13, #3
-
- vmull.u8 q3, d28, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q4, d29, d3
- vmull.u8 q5, d30, d3
- vmull.u8 q6, d31, d3
- ;
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- subs r2, r2, #1
-
- vqrshrun.s16 d22, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d23, q8, #7
- vqrshrun.s16 d24, q9, #7
- vqrshrun.s16 d25, q10, #7
-
- vst1.u8 {d22}, [r4], r5 ;store result
- vst1.u8 {d23}, [r4], r5
- vst1.u8 {d24}, [r4], r5
- vst1.u8 {d25}, [r4], r5
-
- bne filt_blk2d_fpo8x8_loop_neon
-
- pop {r4-r5,pc}
-
-;---------------------
-secondpass_filter8x8_only
- sub r0, r0, r1, lsl #1
- add r3, r12, r3, lsl #5
-
- vld1.u8 {d18}, [r0], r1 ;load src data
- vld1.s32 {q5, q6}, [r3] ;load second_pass filter
- vld1.u8 {d19}, [r0], r1
- vabs.s32 q7, q5
- vld1.u8 {d20}, [r0], r1
- vabs.s32 q8, q6
- vld1.u8 {d21}, [r0], r1
- mov r3, #2 ;loop counter
- vld1.u8 {d22}, [r0], r1
- vdup.8 d0, d14[0] ;second_pass filter parameters (d0-d5)
- vld1.u8 {d23}, [r0], r1
- vdup.8 d1, d14[4]
- vld1.u8 {d24}, [r0], r1
- vdup.8 d2, d15[0]
- vld1.u8 {d25}, [r0], r1
- vdup.8 d3, d15[4]
- vld1.u8 {d26}, [r0], r1
- vdup.8 d4, d16[0]
- vld1.u8 {d27}, [r0], r1
- vdup.8 d5, d16[4]
- vld1.u8 {d28}, [r0], r1
- vld1.u8 {d29}, [r0], r1
- vld1.u8 {d30}, [r0], r1
-
-;Second pass: 8x8
-filt_blk2d_spo8x8_loop_neon
- vmull.u8 q3, d18, d0 ;(src_ptr[-2] * vp8_filter[0])
- vmull.u8 q4, d19, d0
- vmull.u8 q5, d20, d0
- vmull.u8 q6, d21, d0
-
- vmlsl.u8 q3, d19, d1 ;-(src_ptr[-1] * vp8_filter[1])
- vmlsl.u8 q4, d20, d1
- vmlsl.u8 q5, d21, d1
- vmlsl.u8 q6, d22, d1
-
- vmlsl.u8 q3, d22, d4 ;-(src_ptr[2] * vp8_filter[4])
- vmlsl.u8 q4, d23, d4
- vmlsl.u8 q5, d24, d4
- vmlsl.u8 q6, d25, d4
-
- vmlal.u8 q3, d20, d2 ;(src_ptr[0] * vp8_filter[2])
- vmlal.u8 q4, d21, d2
- vmlal.u8 q5, d22, d2
- vmlal.u8 q6, d23, d2
-
- vmlal.u8 q3, d23, d5 ;(src_ptr[3] * vp8_filter[5])
- vmlal.u8 q4, d24, d5
- vmlal.u8 q5, d25, d5
- vmlal.u8 q6, d26, d5
-
- vmull.u8 q7, d21, d3 ;(src_ptr[1] * vp8_filter[3])
- vmull.u8 q8, d22, d3
- vmull.u8 q9, d23, d3
- vmull.u8 q10, d24, d3
-
- subs r3, r3, #1
-
- vqadd.s16 q7, q3 ;sum of all (src_data*filter_parameters)
- vqadd.s16 q8, q4
- vqadd.s16 q9, q5
- vqadd.s16 q10, q6
-
- vqrshrun.s16 d6, q7, #7 ;shift/round/saturate to u8
- vqrshrun.s16 d7, q8, #7
- vqrshrun.s16 d8, q9, #7
- vqrshrun.s16 d9, q10, #7
-
- vmov q9, q11
- vst1.u8 {d6}, [r4], r5 ;store result
- vmov q10, q12
- vst1.u8 {d7}, [r4], r5
- vmov q11, q13
- vst1.u8 {d8}, [r4], r5
- vmov q12, q14
- vst1.u8 {d9}, [r4], r5
- vmov d26, d30
-
- bne filt_blk2d_spo8x8_loop_neon
-
- pop {r4-r5,pc}
-
- ENDP
-
-;-----------------
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/variance_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/variance_neon.asm
deleted file mode 100644
index e3b4832..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/variance_neon.asm
+++ /dev/null
@@ -1,276 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_variance16x16_neon|
- EXPORT |vp8_variance16x8_neon|
- EXPORT |vp8_variance8x16_neon|
- EXPORT |vp8_variance8x8_neon|
-
- 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
-|vp8_variance16x16_neon| PROC
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
- mov r12, #8
-
-variance16x16_neon_loop
- vld1.8 {q0}, [r0], r1 ;Load up source and reference
- vld1.8 {q2}, [r2], r3
- vld1.8 {q1}, [r0], r1
- vld1.8 {q3}, [r2], r3
-
- vsubl.u8 q11, d0, d4 ;calculate diff
- vsubl.u8 q12, d1, d5
- vsubl.u8 q13, d2, d6
- vsubl.u8 q14, d3, d7
-
- ;VPADAL adds adjacent pairs of elements of a vector, and accumulates
- ;the results into the elements of the destination vector. The explanation
- ;in ARM guide is wrong.
- vpadal.s16 q8, q11 ;calculate sum
- vmlal.s16 q9, d22, d22 ;calculate sse
- vmlal.s16 q10, d23, d23
-
- subs r12, r12, #1
-
- vpadal.s16 q8, q12
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
- vpadal.s16 q8, q13
- vmlal.s16 q9, d26, d26
- vmlal.s16 q10, d27, d27
- vpadal.s16 q8, q14
- vmlal.s16 q9, d28, d28
- vmlal.s16 q10, d29, d29
-
- bne variance16x16_neon_loop
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- ldr r12, [sp] ;load *sse from stack
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- ;vmov.32 r0, d0[0] ;this instruction costs a lot
- ;vmov.32 r1, d1[0]
- ;mul r0, r0, r0
- ;str r1, [r12]
- ;sub r0, r1, r0, lsr #8
-
- ; while sum is signed, sum * sum is always positive and must be treated as
- ; unsigned to avoid propagating the sign bit.
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [r12] ;store sse
- vshr.u32 d10, d10, #8
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- bx lr
-
- ENDP
-
-;================================
-;unsigned int vp8_variance16x8_c(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride,
-; unsigned int *sse)
-|vp8_variance16x8_neon| PROC
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
- mov r12, #4
-
-variance16x8_neon_loop
- vld1.8 {q0}, [r0], r1 ;Load up source and reference
- vld1.8 {q2}, [r2], r3
- vld1.8 {q1}, [r0], r1
- vld1.8 {q3}, [r2], r3
-
- vsubl.u8 q11, d0, d4 ;calculate diff
- vsubl.u8 q12, d1, d5
- vsubl.u8 q13, d2, d6
- vsubl.u8 q14, d3, d7
-
- vpadal.s16 q8, q11 ;calculate sum
- vmlal.s16 q9, d22, d22 ;calculate sse
- vmlal.s16 q10, d23, d23
-
- subs r12, r12, #1
-
- vpadal.s16 q8, q12
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
- vpadal.s16 q8, q13
- vmlal.s16 q9, d26, d26
- vmlal.s16 q10, d27, d27
- vpadal.s16 q8, q14
- vmlal.s16 q9, d28, d28
- vmlal.s16 q10, d29, d29
-
- bne variance16x8_neon_loop
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- ldr r12, [sp] ;load *sse from stack
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [r12] ;store sse
- vshr.u32 d10, d10, #7
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- bx lr
-
- ENDP
-
-;=================================
-;unsigned int vp8_variance8x16_c(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride,
-; unsigned int *sse)
-
-|vp8_variance8x16_neon| PROC
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
- mov r12, #8
-
-variance8x16_neon_loop
- vld1.8 {d0}, [r0], r1 ;Load up source and reference
- vld1.8 {d4}, [r2], r3
- vld1.8 {d2}, [r0], r1
- vld1.8 {d6}, [r2], r3
-
- vsubl.u8 q11, d0, d4 ;calculate diff
- vsubl.u8 q12, d2, d6
-
- vpadal.s16 q8, q11 ;calculate sum
- vmlal.s16 q9, d22, d22 ;calculate sse
- vmlal.s16 q10, d23, d23
-
- subs r12, r12, #1
-
- vpadal.s16 q8, q12
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
-
- bne variance8x16_neon_loop
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- ldr r12, [sp] ;load *sse from stack
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [r12] ;store sse
- vshr.u32 d10, d10, #7
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- bx lr
-
- ENDP
-
-;==================================
-; r0 unsigned char *src_ptr
-; r1 int source_stride
-; r2 unsigned char *ref_ptr
-; r3 int recon_stride
-; stack unsigned int *sse
-|vp8_variance8x8_neon| PROC
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
- mov r12, #2
-
-variance8x8_neon_loop
- vld1.8 {d0}, [r0], r1 ;Load up source and reference
- vld1.8 {d4}, [r2], r3
- vld1.8 {d1}, [r0], r1
- vld1.8 {d5}, [r2], r3
- vld1.8 {d2}, [r0], r1
- vld1.8 {d6}, [r2], r3
- vld1.8 {d3}, [r0], r1
- vld1.8 {d7}, [r2], r3
-
- vsubl.u8 q11, d0, d4 ;calculate diff
- vsubl.u8 q12, d1, d5
- vsubl.u8 q13, d2, d6
- vsubl.u8 q14, d3, d7
-
- vpadal.s16 q8, q11 ;calculate sum
- vmlal.s16 q9, d22, d22 ;calculate sse
- vmlal.s16 q10, d23, d23
-
- subs r12, r12, #1
-
- vpadal.s16 q8, q12
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
- vpadal.s16 q8, q13
- vmlal.s16 q9, d26, d26
- vmlal.s16 q10, d27, d27
- vpadal.s16 q8, q14
- vmlal.s16 q9, d28, d28
- vmlal.s16 q10, d29, d29
-
- bne variance8x8_neon_loop
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- ldr r12, [sp] ;load *sse from stack
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [r12] ;store sse
- vshr.u32 d10, d10, #6
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- bx lr
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
deleted file mode 100644
index 9d22c52..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16_neon.asm
+++ /dev/null
@@ -1,423 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-;-----------------
-
- EXPORT |vp8_sub_pixel_variance16x16_neon_func|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; stack(r4) unsigned char *dst_ptr,
-; stack(r5) int dst_pixels_per_line,
-; stack(r6) unsigned int *sse
-;note: most of the code is copied from bilinear_predict16x16_neon and vp8_variance16x16_neon.
-
-bilinear_taps_coeff
- DCD 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
-
-|vp8_sub_pixel_variance16x16_neon_func| PROC
- push {r4-r6, lr}
-
- adr r12, bilinear_taps_coeff
- ldr r4, [sp, #16] ;load *dst_ptr from stack
- ldr r5, [sp, #20] ;load dst_pixels_per_line from stack
- ldr r6, [sp, #24] ;load *sse from stack
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- beq secondpass_bfilter16x16_only
-
- add r2, r12, r2, lsl #3 ;calculate filter location
-
- cmp r3, #0 ;skip second_pass filter if yoffset=0
-
- vld1.s32 {d31}, [r2] ;load first_pass filter
-
- beq firstpass_bfilter16x16_only
-
- sub sp, sp, #272 ;reserve space on stack for temporary storage
- vld1.u8 {d2, d3, d4}, [r0], r1 ;load src data
- mov lr, sp
- vld1.u8 {d5, d6, d7}, [r0], r1
-
- mov r2, #3 ;loop counter
- vld1.u8 {d8, d9, d10}, [r0], r1
-
- vdup.8 d0, d31[0] ;first_pass filter (d0 d1)
- vld1.u8 {d11, d12, d13}, [r0], r1
-
- vdup.8 d1, d31[4]
-
-;First Pass: output_height lines x output_width columns (17x16)
-vp8e_filt_blk2d_fp16x16_loop_neon
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vmull.u8 q7, d2, d0 ;(src_ptr[0] * Filter[0])
- vmull.u8 q8, d3, d0
- vmull.u8 q9, d5, d0
- vmull.u8 q10, d6, d0
- vmull.u8 q11, d8, d0
- vmull.u8 q12, d9, d0
- vmull.u8 q13, d11, d0
- vmull.u8 q14, d12, d0
-
- vext.8 d2, d2, d3, #1 ;construct src_ptr[1]
- vext.8 d5, d5, d6, #1
- vext.8 d8, d8, d9, #1
- vext.8 d11, d11, d12, #1
-
- vmlal.u8 q7, d2, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q9, d5, d1
- vmlal.u8 q11, d8, d1
- vmlal.u8 q13, d11, d1
-
- vext.8 d3, d3, d4, #1
- vext.8 d6, d6, d7, #1
- vext.8 d9, d9, d10, #1
- vext.8 d12, d12, d13, #1
-
- vmlal.u8 q8, d3, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q10, d6, d1
- vmlal.u8 q12, d9, d1
- vmlal.u8 q14, d12, d1
-
- subs r2, r2, #1
-
- vqrshrn.u16 d14, q7, #7 ;shift/round/saturate to u8
- vqrshrn.u16 d15, q8, #7
- vqrshrn.u16 d16, q9, #7
- vqrshrn.u16 d17, q10, #7
- vqrshrn.u16 d18, q11, #7
- vqrshrn.u16 d19, q12, #7
- vqrshrn.u16 d20, q13, #7
-
- vld1.u8 {d2, d3, d4}, [r0], r1 ;load src data
- vqrshrn.u16 d21, q14, #7
- vld1.u8 {d5, d6, d7}, [r0], r1
-
- vst1.u8 {d14, d15, d16, d17}, [lr]! ;store result
- vld1.u8 {d8, d9, d10}, [r0], r1
- vst1.u8 {d18, d19, d20, d21}, [lr]!
- vld1.u8 {d11, d12, d13}, [r0], r1
-
- bne vp8e_filt_blk2d_fp16x16_loop_neon
-
-;First-pass filtering for rest 5 lines
- vld1.u8 {d14, d15, d16}, [r0], r1
-
- vmull.u8 q9, d2, d0 ;(src_ptr[0] * Filter[0])
- vmull.u8 q10, d3, d0
- vmull.u8 q11, d5, d0
- vmull.u8 q12, d6, d0
- vmull.u8 q13, d8, d0
- vmull.u8 q14, d9, d0
-
- vext.8 d2, d2, d3, #1 ;construct src_ptr[1]
- vext.8 d5, d5, d6, #1
- vext.8 d8, d8, d9, #1
-
- vmlal.u8 q9, d2, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q11, d5, d1
- vmlal.u8 q13, d8, d1
-
- vext.8 d3, d3, d4, #1
- vext.8 d6, d6, d7, #1
- vext.8 d9, d9, d10, #1
-
- vmlal.u8 q10, d3, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q12, d6, d1
- vmlal.u8 q14, d9, d1
-
- vmull.u8 q1, d11, d0
- vmull.u8 q2, d12, d0
- vmull.u8 q3, d14, d0
- vmull.u8 q4, d15, d0
-
- vext.8 d11, d11, d12, #1 ;construct src_ptr[1]
- vext.8 d14, d14, d15, #1
-
- vmlal.u8 q1, d11, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q3, d14, d1
-
- vext.8 d12, d12, d13, #1
- vext.8 d15, d15, d16, #1
-
- vmlal.u8 q2, d12, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q4, d15, d1
-
- vqrshrn.u16 d10, q9, #7 ;shift/round/saturate to u8
- vqrshrn.u16 d11, q10, #7
- vqrshrn.u16 d12, q11, #7
- vqrshrn.u16 d13, q12, #7
- vqrshrn.u16 d14, q13, #7
- vqrshrn.u16 d15, q14, #7
- vqrshrn.u16 d16, q1, #7
- vqrshrn.u16 d17, q2, #7
- vqrshrn.u16 d18, q3, #7
- vqrshrn.u16 d19, q4, #7
-
- vst1.u8 {d10, d11, d12, d13}, [lr]! ;store result
- vst1.u8 {d14, d15, d16, d17}, [lr]!
- vst1.u8 {d18, d19}, [lr]!
-
-;Second pass: 16x16
-;secondpass_filter
- add r3, r12, r3, lsl #3
- sub lr, lr, #272
-
- vld1.u32 {d31}, [r3] ;load second_pass filter
-
- sub sp, sp, #256
- mov r3, sp
-
- vld1.u8 {d22, d23}, [lr]! ;load src data
-
- vdup.8 d0, d31[0] ;second_pass filter parameters (d0 d1)
- vdup.8 d1, d31[4]
- mov r12, #4 ;loop counter
-
-vp8e_filt_blk2d_sp16x16_loop_neon
- vld1.u8 {d24, d25}, [lr]!
- vmull.u8 q1, d22, d0 ;(src_ptr[0] * Filter[0])
- vld1.u8 {d26, d27}, [lr]!
- vmull.u8 q2, d23, d0
- vld1.u8 {d28, d29}, [lr]!
- vmull.u8 q3, d24, d0
- vld1.u8 {d30, d31}, [lr]!
-
- vmull.u8 q4, d25, d0
- vmull.u8 q5, d26, d0
- vmull.u8 q6, d27, d0
- vmull.u8 q7, d28, d0
- vmull.u8 q8, d29, d0
-
- vmlal.u8 q1, d24, d1 ;(src_ptr[pixel_step] * Filter[1])
- vmlal.u8 q2, d25, d1
- vmlal.u8 q3, d26, d1
- vmlal.u8 q4, d27, d1
- vmlal.u8 q5, d28, d1
- vmlal.u8 q6, d29, d1
- vmlal.u8 q7, d30, d1
- vmlal.u8 q8, d31, d1
-
- subs r12, r12, #1
-
- vqrshrn.u16 d2, q1, #7 ;shift/round/saturate to u8
- vqrshrn.u16 d3, q2, #7
- vqrshrn.u16 d4, q3, #7
- vqrshrn.u16 d5, q4, #7
- vqrshrn.u16 d6, q5, #7
- vqrshrn.u16 d7, q6, #7
- vqrshrn.u16 d8, q7, #7
- vqrshrn.u16 d9, q8, #7
-
- vst1.u8 {d2, d3}, [r3]! ;store result
- vst1.u8 {d4, d5}, [r3]!
- vst1.u8 {d6, d7}, [r3]!
- vmov q11, q15
- vst1.u8 {d8, d9}, [r3]!
-
- bne vp8e_filt_blk2d_sp16x16_loop_neon
-
- b sub_pixel_variance16x16_neon
-
-;--------------------
-firstpass_bfilter16x16_only
- mov r2, #4 ;loop counter
- sub sp, sp, #528 ;reserve space on stack for temporary storage
- vdup.8 d0, d31[0] ;first_pass filter (d0 d1)
- vdup.8 d1, d31[4]
- mov r3, sp
-
-;First Pass: output_height lines x output_width columns (16x16)
-vp8e_filt_blk2d_fpo16x16_loop_neon
- vld1.u8 {d2, d3, d4}, [r0], r1 ;load src data
- vld1.u8 {d5, d6, d7}, [r0], r1
- vld1.u8 {d8, d9, d10}, [r0], r1
- vld1.u8 {d11, d12, d13}, [r0], r1
-
- pld [r0]
- pld [r0, r1]
- pld [r0, r1, lsl #1]
-
- vmull.u8 q7, d2, d0 ;(src_ptr[0] * Filter[0])
- vmull.u8 q8, d3, d0
- vmull.u8 q9, d5, d0
- vmull.u8 q10, d6, d0
- vmull.u8 q11, d8, d0
- vmull.u8 q12, d9, d0
- vmull.u8 q13, d11, d0
- vmull.u8 q14, d12, d0
-
- vext.8 d2, d2, d3, #1 ;construct src_ptr[1]
- vext.8 d5, d5, d6, #1
- vext.8 d8, d8, d9, #1
- vext.8 d11, d11, d12, #1
-
- vmlal.u8 q7, d2, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q9, d5, d1
- vmlal.u8 q11, d8, d1
- vmlal.u8 q13, d11, d1
-
- vext.8 d3, d3, d4, #1
- vext.8 d6, d6, d7, #1
- vext.8 d9, d9, d10, #1
- vext.8 d12, d12, d13, #1
-
- vmlal.u8 q8, d3, d1 ;(src_ptr[0] * Filter[1])
- vmlal.u8 q10, d6, d1
- vmlal.u8 q12, d9, d1
- vmlal.u8 q14, d12, d1
-
- subs r2, r2, #1
-
- vqrshrn.u16 d14, q7, #7 ;shift/round/saturate to u8
- vqrshrn.u16 d15, q8, #7
- vqrshrn.u16 d16, q9, #7
- vqrshrn.u16 d17, q10, #7
- vqrshrn.u16 d18, q11, #7
- vqrshrn.u16 d19, q12, #7
- vqrshrn.u16 d20, q13, #7
- vst1.u8 {d14, d15}, [r3]! ;store result
- vqrshrn.u16 d21, q14, #7
-
- vst1.u8 {d16, d17}, [r3]!
- vst1.u8 {d18, d19}, [r3]!
- vst1.u8 {d20, d21}, [r3]!
-
- bne vp8e_filt_blk2d_fpo16x16_loop_neon
-
- b sub_pixel_variance16x16_neon
-
-;---------------------
-secondpass_bfilter16x16_only
-;Second pass: 16x16
-;secondpass_filter
- sub sp, sp, #528 ;reserve space on stack for temporary storage
- add r3, r12, r3, lsl #3
- mov r12, #4 ;loop counter
- vld1.u32 {d31}, [r3] ;load second_pass filter
- vld1.u8 {d22, d23}, [r0], r1 ;load src data
- mov r3, sp
-
- vdup.8 d0, d31[0] ;second_pass filter parameters (d0 d1)
- vdup.8 d1, d31[4]
-
-vp8e_filt_blk2d_spo16x16_loop_neon
- vld1.u8 {d24, d25}, [r0], r1
- vmull.u8 q1, d22, d0 ;(src_ptr[0] * Filter[0])
- vld1.u8 {d26, d27}, [r0], r1
- vmull.u8 q2, d23, d0
- vld1.u8 {d28, d29}, [r0], r1
- vmull.u8 q3, d24, d0
- vld1.u8 {d30, d31}, [r0], r1
-
- vmull.u8 q4, d25, d0
- vmull.u8 q5, d26, d0
- vmull.u8 q6, d27, d0
- vmull.u8 q7, d28, d0
- vmull.u8 q8, d29, d0
-
- vmlal.u8 q1, d24, d1 ;(src_ptr[pixel_step] * Filter[1])
- vmlal.u8 q2, d25, d1
- vmlal.u8 q3, d26, d1
- vmlal.u8 q4, d27, d1
- vmlal.u8 q5, d28, d1
- vmlal.u8 q6, d29, d1
- vmlal.u8 q7, d30, d1
- vmlal.u8 q8, d31, d1
-
- vqrshrn.u16 d2, q1, #7 ;shift/round/saturate to u8
- vqrshrn.u16 d3, q2, #7
- vqrshrn.u16 d4, q3, #7
- vqrshrn.u16 d5, q4, #7
- vqrshrn.u16 d6, q5, #7
- vqrshrn.u16 d7, q6, #7
- vqrshrn.u16 d8, q7, #7
- vqrshrn.u16 d9, q8, #7
-
- vst1.u8 {d2, d3}, [r3]! ;store result
- subs r12, r12, #1
- vst1.u8 {d4, d5}, [r3]!
- vmov q11, q15
- vst1.u8 {d6, d7}, [r3]!
- vst1.u8 {d8, d9}, [r3]!
-
- bne vp8e_filt_blk2d_spo16x16_loop_neon
-
- b sub_pixel_variance16x16_neon
-
-;----------------------------
-;variance16x16
-sub_pixel_variance16x16_neon
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
- sub r3, r3, #256
- mov r12, #8
-
-sub_pixel_variance16x16_neon_loop
- vld1.8 {q0}, [r3]! ;Load up source and reference
- vld1.8 {q2}, [r4], r5
- vld1.8 {q1}, [r3]!
- vld1.8 {q3}, [r4], r5
-
- vsubl.u8 q11, d0, d4 ;diff
- vsubl.u8 q12, d1, d5
- vsubl.u8 q13, d2, d6
- vsubl.u8 q14, d3, d7
-
- vpadal.s16 q8, q11 ;sum
- vmlal.s16 q9, d22, d22 ;sse
- vmlal.s16 q10, d23, d23
-
- subs r12, r12, #1
-
- vpadal.s16 q8, q12
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
- vpadal.s16 q8, q13
- vmlal.s16 q9, d26, d26
- vmlal.s16 q10, d27, d27
- vpadal.s16 q8, q14
- vmlal.s16 q9, d28, d28
- vmlal.s16 q10, d29, d29
-
- bne sub_pixel_variance16x16_neon_loop
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [r6] ;store sse
- vshr.u32 d10, d10, #8
- vsub.u32 d0, d1, d10
-
- add sp, sp, #528
- vmov.32 r0, d0[0] ;return
-
- pop {r4-r6,pc}
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm
deleted file mode 100644
index 155be4f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance16x16s_neon.asm
+++ /dev/null
@@ -1,572 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_variance_halfpixvar16x16_h_neon|
- EXPORT |vp8_variance_halfpixvar16x16_v_neon|
- EXPORT |vp8_variance_halfpixvar16x16_hv_neon|
- EXPORT |vp8_sub_pixel_variance16x16s_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;================================================
-;unsigned int vp8_variance_halfpixvar16x16_h_neon
-;(
-; unsigned char *src_ptr, r0
-; int src_pixels_per_line, r1
-; unsigned char *dst_ptr, r2
-; int dst_pixels_per_line, r3
-; unsigned int *sse
-;);
-;================================================
-|vp8_variance_halfpixvar16x16_h_neon| PROC
- push {lr}
-
- mov r12, #4 ;loop counter
- ldr lr, [sp, #4] ;load *sse from stack
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
-;First Pass: output_height lines x output_width columns (16x16)
-vp8_filt_fpo16x16s_4_0_loop_neon
- vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
- vld1.8 {q11}, [r2], r3
- vld1.u8 {d4, d5, d6, d7}, [r0], r1
- vld1.8 {q12}, [r2], r3
- vld1.u8 {d8, d9, d10, d11}, [r0], r1
- vld1.8 {q13}, [r2], r3
- vld1.u8 {d12, d13, d14, d15}, [r0], r1
-
- ;pld [r0]
- ;pld [r0, r1]
- ;pld [r0, r1, lsl #1]
-
- vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
- vext.8 q3, q2, q3, #1
- vext.8 q5, q4, q5, #1
- vext.8 q7, q6, q7, #1
-
- vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
- vld1.8 {q14}, [r2], r3
- vrhadd.u8 q1, q2, q3
- vrhadd.u8 q2, q4, q5
- vrhadd.u8 q3, q6, q7
-
- vsubl.u8 q4, d0, d22 ;diff
- vsubl.u8 q5, d1, d23
- vsubl.u8 q6, d2, d24
- vsubl.u8 q7, d3, d25
- vsubl.u8 q0, d4, d26
- vsubl.u8 q1, d5, d27
- vsubl.u8 q2, d6, d28
- vsubl.u8 q3, d7, d29
-
- vpadal.s16 q8, q4 ;sum
- vmlal.s16 q9, d8, d8 ;sse
- vmlal.s16 q10, d9, d9
-
- subs r12, r12, #1
-
- vpadal.s16 q8, q5
- vmlal.s16 q9, d10, d10
- vmlal.s16 q10, d11, d11
- vpadal.s16 q8, q6
- vmlal.s16 q9, d12, d12
- vmlal.s16 q10, d13, d13
- vpadal.s16 q8, q7
- vmlal.s16 q9, d14, d14
- vmlal.s16 q10, d15, d15
-
- vpadal.s16 q8, q0 ;sum
- vmlal.s16 q9, d0, d0 ;sse
- vmlal.s16 q10, d1, d1
- vpadal.s16 q8, q1
- vmlal.s16 q9, d2, d2
- vmlal.s16 q10, d3, d3
- vpadal.s16 q8, q2
- vmlal.s16 q9, d4, d4
- vmlal.s16 q10, d5, d5
- vpadal.s16 q8, q3
- vmlal.s16 q9, d6, d6
- vmlal.s16 q10, d7, d7
-
- bne vp8_filt_fpo16x16s_4_0_loop_neon
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [lr] ;store sse
- vshr.u32 d10, d10, #8
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- pop {pc}
- ENDP
-
-;================================================
-;unsigned int vp8_variance_halfpixvar16x16_v_neon
-;(
-; unsigned char *src_ptr, r0
-; int src_pixels_per_line, r1
-; unsigned char *dst_ptr, r2
-; int dst_pixels_per_line, r3
-; unsigned int *sse
-;);
-;================================================
-|vp8_variance_halfpixvar16x16_v_neon| PROC
- push {lr}
-
- mov r12, #4 ;loop counter
-
- vld1.u8 {q0}, [r0], r1 ;load src data
- ldr lr, [sp, #4] ;load *sse from stack
-
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
-vp8_filt_spo16x16s_0_4_loop_neon
- vld1.u8 {q2}, [r0], r1
- vld1.8 {q1}, [r2], r3
- vld1.u8 {q4}, [r0], r1
- vld1.8 {q3}, [r2], r3
- vld1.u8 {q6}, [r0], r1
- vld1.8 {q5}, [r2], r3
- vld1.u8 {q15}, [r0], r1
-
- vrhadd.u8 q0, q0, q2
- vld1.8 {q7}, [r2], r3
- vrhadd.u8 q2, q2, q4
- vrhadd.u8 q4, q4, q6
- vrhadd.u8 q6, q6, q15
-
- vsubl.u8 q11, d0, d2 ;diff
- vsubl.u8 q12, d1, d3
- vsubl.u8 q13, d4, d6
- vsubl.u8 q14, d5, d7
- vsubl.u8 q0, d8, d10
- vsubl.u8 q1, d9, d11
- vsubl.u8 q2, d12, d14
- vsubl.u8 q3, d13, d15
-
- vpadal.s16 q8, q11 ;sum
- vmlal.s16 q9, d22, d22 ;sse
- vmlal.s16 q10, d23, d23
-
- subs r12, r12, #1
-
- vpadal.s16 q8, q12
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
- vpadal.s16 q8, q13
- vmlal.s16 q9, d26, d26
- vmlal.s16 q10, d27, d27
- vpadal.s16 q8, q14
- vmlal.s16 q9, d28, d28
- vmlal.s16 q10, d29, d29
-
- vpadal.s16 q8, q0 ;sum
- vmlal.s16 q9, d0, d0 ;sse
- vmlal.s16 q10, d1, d1
- vpadal.s16 q8, q1
- vmlal.s16 q9, d2, d2
- vmlal.s16 q10, d3, d3
- vpadal.s16 q8, q2
- vmlal.s16 q9, d4, d4
- vmlal.s16 q10, d5, d5
-
- vmov q0, q15
-
- vpadal.s16 q8, q3
- vmlal.s16 q9, d6, d6
- vmlal.s16 q10, d7, d7
-
- bne vp8_filt_spo16x16s_0_4_loop_neon
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [lr] ;store sse
- vshr.u32 d10, d10, #8
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- pop {pc}
- ENDP
-
-;================================================
-;unsigned int vp8_variance_halfpixvar16x16_hv_neon
-;(
-; unsigned char *src_ptr, r0
-; int src_pixels_per_line, r1
-; unsigned char *dst_ptr, r2
-; int dst_pixels_per_line, r3
-; unsigned int *sse
-;);
-;================================================
-|vp8_variance_halfpixvar16x16_hv_neon| PROC
- push {lr}
-
- vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
-
- ldr lr, [sp, #4] ;load *sse from stack
- vmov.i8 q13, #0 ;q8 - sum
- vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
-
- vmov.i8 q14, #0 ;q9, q10 - sse
- vmov.i8 q15, #0
-
- mov r12, #4 ;loop counter
- vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
-
-;First Pass: output_height lines x output_width columns (17x16)
-vp8_filt16x16s_4_4_loop_neon
- vld1.u8 {d4, d5, d6, d7}, [r0], r1
- vld1.u8 {d8, d9, d10, d11}, [r0], r1
- vld1.u8 {d12, d13, d14, d15}, [r0], r1
- vld1.u8 {d16, d17, d18, d19}, [r0], r1
-
- ;pld [r0]
- ;pld [r0, r1]
- ;pld [r0, r1, lsl #1]
-
- vext.8 q3, q2, q3, #1 ;construct src_ptr[1]
- vext.8 q5, q4, q5, #1
- vext.8 q7, q6, q7, #1
- vext.8 q9, q8, q9, #1
-
- vrhadd.u8 q1, q2, q3 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
- vrhadd.u8 q2, q4, q5
- vrhadd.u8 q3, q6, q7
- vrhadd.u8 q4, q8, q9
-
- vld1.8 {q5}, [r2], r3
- vrhadd.u8 q0, q0, q1
- vld1.8 {q6}, [r2], r3
- vrhadd.u8 q1, q1, q2
- vld1.8 {q7}, [r2], r3
- vrhadd.u8 q2, q2, q3
- vld1.8 {q8}, [r2], r3
- vrhadd.u8 q3, q3, q4
-
- vsubl.u8 q9, d0, d10 ;diff
- vsubl.u8 q10, d1, d11
- vsubl.u8 q11, d2, d12
- vsubl.u8 q12, d3, d13
-
- vsubl.u8 q0, d4, d14 ;diff
- vsubl.u8 q1, d5, d15
- vsubl.u8 q5, d6, d16
- vsubl.u8 q6, d7, d17
-
- vpadal.s16 q13, q9 ;sum
- vmlal.s16 q14, d18, d18 ;sse
- vmlal.s16 q15, d19, d19
-
- vpadal.s16 q13, q10 ;sum
- vmlal.s16 q14, d20, d20 ;sse
- vmlal.s16 q15, d21, d21
-
- vpadal.s16 q13, q11 ;sum
- vmlal.s16 q14, d22, d22 ;sse
- vmlal.s16 q15, d23, d23
-
- vpadal.s16 q13, q12 ;sum
- vmlal.s16 q14, d24, d24 ;sse
- vmlal.s16 q15, d25, d25
-
- subs r12, r12, #1
-
- vpadal.s16 q13, q0 ;sum
- vmlal.s16 q14, d0, d0 ;sse
- vmlal.s16 q15, d1, d1
-
- vpadal.s16 q13, q1 ;sum
- vmlal.s16 q14, d2, d2 ;sse
- vmlal.s16 q15, d3, d3
-
- vpadal.s16 q13, q5 ;sum
- vmlal.s16 q14, d10, d10 ;sse
- vmlal.s16 q15, d11, d11
-
- vmov q0, q4
-
- vpadal.s16 q13, q6 ;sum
- vmlal.s16 q14, d12, d12 ;sse
- vmlal.s16 q15, d13, d13
-
- bne vp8_filt16x16s_4_4_loop_neon
-
- vadd.u32 q15, q14, q15 ;accumulate sse
- vpaddl.s32 q0, q13 ;accumulate sum
-
- vpaddl.u32 q1, q15
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [lr] ;store sse
- vshr.u32 d10, d10, #8
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- pop {pc}
- ENDP
-
-;==============================
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; stack unsigned char *dst_ptr,
-; stack int dst_pixels_per_line,
-; stack unsigned int *sse
-;note: in vp8_find_best_half_pixel_step()(called when 8<Speed<15), and first call of vp8_find_best_sub_pixel_step()
-;(called when speed<=8). xoffset/yoffset can only be 4 or 0, which means either by pass the filter,
-;or filter coeff is {64, 64}. This simplified program only works in this situation.
-;note: It happens that both xoffset and yoffset are zero. This can be handled in c code later.
-
-|vp8_sub_pixel_variance16x16s_neon| PROC
- push {r4, lr}
-
- ldr r4, [sp, #8] ;load *dst_ptr from stack
- ldr r12, [sp, #12] ;load dst_pixels_per_line from stack
- ldr lr, [sp, #16] ;load *sse from stack
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- beq secondpass_bfilter16x16s_only
-
- cmp r3, #0 ;skip second_pass filter if yoffset=0
- beq firstpass_bfilter16x16s_only
-
- vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
- sub sp, sp, #256 ;reserve space on stack for temporary storage
- vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
- mov r3, sp
- mov r2, #4 ;loop counter
- vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
-
-;First Pass: output_height lines x output_width columns (17x16)
-vp8e_filt_blk2d_fp16x16s_loop_neon
- vld1.u8 {d4, d5, d6, d7}, [r0], r1
- vld1.u8 {d8, d9, d10, d11}, [r0], r1
- vld1.u8 {d12, d13, d14, d15}, [r0], r1
- vld1.u8 {d16, d17, d18, d19}, [r0], r1
-
- ;pld [r0]
- ;pld [r0, r1]
- ;pld [r0, r1, lsl #1]
-
- vext.8 q3, q2, q3, #1 ;construct src_ptr[1]
- vext.8 q5, q4, q5, #1
- vext.8 q7, q6, q7, #1
- vext.8 q9, q8, q9, #1
-
- vrhadd.u8 q1, q2, q3 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
- vrhadd.u8 q2, q4, q5
- vrhadd.u8 q3, q6, q7
- vrhadd.u8 q4, q8, q9
-
- vrhadd.u8 q0, q0, q1
- vrhadd.u8 q1, q1, q2
- vrhadd.u8 q2, q2, q3
- vrhadd.u8 q3, q3, q4
-
- subs r2, r2, #1
- vst1.u8 {d0, d1 ,d2, d3}, [r3]! ;store result
- vmov q0, q4
- vst1.u8 {d4, d5, d6, d7}, [r3]!
-
- bne vp8e_filt_blk2d_fp16x16s_loop_neon
-
- b sub_pixel_variance16x16s_neon
-
-;--------------------
-firstpass_bfilter16x16s_only
- mov r2, #2 ;loop counter
- sub sp, sp, #256 ;reserve space on stack for temporary storage
- mov r3, sp
-
-;First Pass: output_height lines x output_width columns (16x16)
-vp8e_filt_blk2d_fpo16x16s_loop_neon
- vld1.u8 {d0, d1, d2, d3}, [r0], r1 ;load src data
- vld1.u8 {d4, d5, d6, d7}, [r0], r1
- vld1.u8 {d8, d9, d10, d11}, [r0], r1
- vld1.u8 {d12, d13, d14, d15}, [r0], r1
-
- ;pld [r0]
- ;pld [r0, r1]
- ;pld [r0, r1, lsl #1]
-
- vext.8 q1, q0, q1, #1 ;construct src_ptr[1]
- vld1.u8 {d16, d17, d18, d19}, [r0], r1
- vext.8 q3, q2, q3, #1
- vld1.u8 {d20, d21, d22, d23}, [r0], r1
- vext.8 q5, q4, q5, #1
- vld1.u8 {d24, d25, d26, d27}, [r0], r1
- vext.8 q7, q6, q7, #1
- vld1.u8 {d28, d29, d30, d31}, [r0], r1
- vext.8 q9, q8, q9, #1
- vext.8 q11, q10, q11, #1
- vext.8 q13, q12, q13, #1
- vext.8 q15, q14, q15, #1
-
- vrhadd.u8 q0, q0, q1 ;(src_ptr[0]+src_ptr[1])/round/shift right 1
- vrhadd.u8 q1, q2, q3
- vrhadd.u8 q2, q4, q5
- vrhadd.u8 q3, q6, q7
- vrhadd.u8 q4, q8, q9
- vrhadd.u8 q5, q10, q11
- vrhadd.u8 q6, q12, q13
- vrhadd.u8 q7, q14, q15
-
- subs r2, r2, #1
-
- vst1.u8 {d0, d1, d2, d3}, [r3]! ;store result
- vst1.u8 {d4, d5, d6, d7}, [r3]!
- vst1.u8 {d8, d9, d10, d11}, [r3]!
- vst1.u8 {d12, d13, d14, d15}, [r3]!
-
- bne vp8e_filt_blk2d_fpo16x16s_loop_neon
-
- b sub_pixel_variance16x16s_neon
-
-;---------------------
-secondpass_bfilter16x16s_only
- sub sp, sp, #256 ;reserve space on stack for temporary storage
-
- mov r2, #2 ;loop counter
- vld1.u8 {d0, d1}, [r0], r1 ;load src data
- mov r3, sp
-
-vp8e_filt_blk2d_spo16x16s_loop_neon
- vld1.u8 {d2, d3}, [r0], r1
- vld1.u8 {d4, d5}, [r0], r1
- vld1.u8 {d6, d7}, [r0], r1
- vld1.u8 {d8, d9}, [r0], r1
-
- vrhadd.u8 q0, q0, q1
- vld1.u8 {d10, d11}, [r0], r1
- vrhadd.u8 q1, q1, q2
- vld1.u8 {d12, d13}, [r0], r1
- vrhadd.u8 q2, q2, q3
- vld1.u8 {d14, d15}, [r0], r1
- vrhadd.u8 q3, q3, q4
- vld1.u8 {d16, d17}, [r0], r1
- vrhadd.u8 q4, q4, q5
- vrhadd.u8 q5, q5, q6
- vrhadd.u8 q6, q6, q7
- vrhadd.u8 q7, q7, q8
-
- subs r2, r2, #1
-
- vst1.u8 {d0, d1, d2, d3}, [r3]! ;store result
- vmov q0, q8
- vst1.u8 {d4, d5, d6, d7}, [r3]!
- vst1.u8 {d8, d9, d10, d11}, [r3]! ;store result
- vst1.u8 {d12, d13, d14, d15}, [r3]!
-
- bne vp8e_filt_blk2d_spo16x16s_loop_neon
-
- b sub_pixel_variance16x16s_neon
-
-;----------------------------
-;variance16x16
-sub_pixel_variance16x16s_neon
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
- sub r3, r3, #256
- mov r2, #4
-
-sub_pixel_variance16x16s_neon_loop
- vld1.8 {q0}, [r3]! ;Load up source and reference
- vld1.8 {q1}, [r4], r12
- vld1.8 {q2}, [r3]!
- vld1.8 {q3}, [r4], r12
- vld1.8 {q4}, [r3]!
- vld1.8 {q5}, [r4], r12
- vld1.8 {q6}, [r3]!
- vld1.8 {q7}, [r4], r12
-
- vsubl.u8 q11, d0, d2 ;diff
- vsubl.u8 q12, d1, d3
- vsubl.u8 q13, d4, d6
- vsubl.u8 q14, d5, d7
- vsubl.u8 q0, d8, d10
- vsubl.u8 q1, d9, d11
- vsubl.u8 q2, d12, d14
- vsubl.u8 q3, d13, d15
-
- vpadal.s16 q8, q11 ;sum
- vmlal.s16 q9, d22, d22 ;sse
- vmlal.s16 q10, d23, d23
-
- subs r2, r2, #1
-
- vpadal.s16 q8, q12
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
- vpadal.s16 q8, q13
- vmlal.s16 q9, d26, d26
- vmlal.s16 q10, d27, d27
- vpadal.s16 q8, q14
- vmlal.s16 q9, d28, d28
- vmlal.s16 q10, d29, d29
-
- vpadal.s16 q8, q0 ;sum
- vmlal.s16 q9, d0, d0 ;sse
- vmlal.s16 q10, d1, d1
- vpadal.s16 q8, q1
- vmlal.s16 q9, d2, d2
- vmlal.s16 q10, d3, d3
- vpadal.s16 q8, q2
- vmlal.s16 q9, d4, d4
- vmlal.s16 q10, d5, d5
- vpadal.s16 q8, q3
- vmlal.s16 q9, d6, d6
- vmlal.s16 q10, d7, d7
-
- bne sub_pixel_variance16x16s_neon_loop
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [lr] ;store sse
- vshr.u32 d10, d10, #8
- vsub.u32 d0, d1, d10
-
- add sp, sp, #256
- vmov.32 r0, d0[0] ;return
-
- pop {r4, pc}
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
deleted file mode 100644
index f6b6847..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/neon/vp8_subpixelvariance8x8_neon.asm
+++ /dev/null
@@ -1,222 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_sub_pixel_variance8x8_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-; r0 unsigned char *src_ptr,
-; r1 int src_pixels_per_line,
-; r2 int xoffset,
-; r3 int yoffset,
-; stack(r4) unsigned char *dst_ptr,
-; stack(r5) int dst_pixels_per_line,
-; stack(r6) unsigned int *sse
-;note: most of the code is copied from bilinear_predict8x8_neon and vp8_variance8x8_neon.
-
-|vp8_sub_pixel_variance8x8_neon| PROC
- push {r4-r5, lr}
-
- adr r12, bilinear_taps_coeff
- ldr r4, [sp, #12] ;load *dst_ptr from stack
- ldr r5, [sp, #16] ;load dst_pixels_per_line from stack
- ldr lr, [sp, #20] ;load *sse from stack
-
- cmp r2, #0 ;skip first_pass filter if xoffset=0
- beq skip_firstpass_filter
-
-;First pass: output_height lines x output_width columns (9x8)
- add r2, r12, r2, lsl #3 ;calculate filter location
-
- vld1.u8 {q1}, [r0], r1 ;load src data
- vld1.u32 {d31}, [r2] ;load first_pass filter
- vld1.u8 {q2}, [r0], r1
- vdup.8 d0, d31[0] ;first_pass filter (d0 d1)
- vld1.u8 {q3}, [r0], r1
- vdup.8 d1, d31[4]
- vld1.u8 {q4}, [r0], r1
-
- vmull.u8 q6, d2, d0 ;(src_ptr[0] * Filter[0])
- vmull.u8 q7, d4, d0
- vmull.u8 q8, d6, d0
- vmull.u8 q9, d8, d0
-
- vext.8 d3, d2, d3, #1 ;construct src_ptr[-1]
- vext.8 d5, d4, d5, #1
- vext.8 d7, d6, d7, #1
- vext.8 d9, d8, d9, #1
-
- vmlal.u8 q6, d3, d1 ;(src_ptr[1] * Filter[1])
- vmlal.u8 q7, d5, d1
- vmlal.u8 q8, d7, d1
- vmlal.u8 q9, d9, d1
-
- vld1.u8 {q1}, [r0], r1 ;load src data
- vqrshrn.u16 d22, q6, #7 ;shift/round/saturate to u8
- vld1.u8 {q2}, [r0], r1
- vqrshrn.u16 d23, q7, #7
- vld1.u8 {q3}, [r0], r1
- vqrshrn.u16 d24, q8, #7
- vld1.u8 {q4}, [r0], r1
- vqrshrn.u16 d25, q9, #7
-
- ;first_pass filtering on the rest 5-line data
- vld1.u8 {q5}, [r0], r1
-
- vmull.u8 q6, d2, d0 ;(src_ptr[0] * Filter[0])
- vmull.u8 q7, d4, d0
- vmull.u8 q8, d6, d0
- vmull.u8 q9, d8, d0
- vmull.u8 q10, d10, d0
-
- vext.8 d3, d2, d3, #1 ;construct src_ptr[-1]
- vext.8 d5, d4, d5, #1
- vext.8 d7, d6, d7, #1
- vext.8 d9, d8, d9, #1
- vext.8 d11, d10, d11, #1
-
- vmlal.u8 q6, d3, d1 ;(src_ptr[1] * Filter[1])
- vmlal.u8 q7, d5, d1
- vmlal.u8 q8, d7, d1
- vmlal.u8 q9, d9, d1
- vmlal.u8 q10, d11, d1
-
- vqrshrn.u16 d26, q6, #7 ;shift/round/saturate to u8
- vqrshrn.u16 d27, q7, #7
- vqrshrn.u16 d28, q8, #7
- vqrshrn.u16 d29, q9, #7
- vqrshrn.u16 d30, q10, #7
-
-;Second pass: 8x8
-secondpass_filter
- cmp r3, #0 ;skip second_pass filter if yoffset=0
- ;skip_secondpass_filter
- beq sub_pixel_variance8x8_neon
-
- add r3, r12, r3, lsl #3
-
- vld1.u32 {d31}, [r3] ;load second_pass filter
-
- vdup.8 d0, d31[0] ;second_pass filter parameters (d0 d1)
- vdup.8 d1, d31[4]
-
- vmull.u8 q1, d22, d0 ;(src_ptr[0] * Filter[0])
- vmull.u8 q2, d23, d0
- vmull.u8 q3, d24, d0
- vmull.u8 q4, d25, d0
- vmull.u8 q5, d26, d0
- vmull.u8 q6, d27, d0
- vmull.u8 q7, d28, d0
- vmull.u8 q8, d29, d0
-
- vmlal.u8 q1, d23, d1 ;(src_ptr[pixel_step] * Filter[1])
- vmlal.u8 q2, d24, d1
- vmlal.u8 q3, d25, d1
- vmlal.u8 q4, d26, d1
- vmlal.u8 q5, d27, d1
- vmlal.u8 q6, d28, d1
- vmlal.u8 q7, d29, d1
- vmlal.u8 q8, d30, d1
-
- vqrshrn.u16 d22, q1, #7 ;shift/round/saturate to u8
- vqrshrn.u16 d23, q2, #7
- vqrshrn.u16 d24, q3, #7
- vqrshrn.u16 d25, q4, #7
- vqrshrn.u16 d26, q5, #7
- vqrshrn.u16 d27, q6, #7
- vqrshrn.u16 d28, q7, #7
- vqrshrn.u16 d29, q8, #7
-
- b sub_pixel_variance8x8_neon
-
-;--------------------
-skip_firstpass_filter
- vld1.u8 {d22}, [r0], r1 ;load src data
- vld1.u8 {d23}, [r0], r1
- vld1.u8 {d24}, [r0], r1
- vld1.u8 {d25}, [r0], r1
- vld1.u8 {d26}, [r0], r1
- vld1.u8 {d27}, [r0], r1
- vld1.u8 {d28}, [r0], r1
- vld1.u8 {d29}, [r0], r1
- vld1.u8 {d30}, [r0], r1
-
- b secondpass_filter
-
-;----------------------
-;vp8_variance8x8_neon
-sub_pixel_variance8x8_neon
- vmov.i8 q8, #0 ;q8 - sum
- vmov.i8 q9, #0 ;q9, q10 - sse
- vmov.i8 q10, #0
-
- mov r12, #2
-
-sub_pixel_variance8x8_neon_loop
- vld1.8 {d0}, [r4], r5 ;load dst data
- subs r12, r12, #1
- vld1.8 {d1}, [r4], r5
- vld1.8 {d2}, [r4], r5
- vsubl.u8 q4, d22, d0 ;calculate diff
- vld1.8 {d3}, [r4], r5
-
- vsubl.u8 q5, d23, d1
- vsubl.u8 q6, d24, d2
-
- vpadal.s16 q8, q4 ;sum
- vmlal.s16 q9, d8, d8 ;sse
- vmlal.s16 q10, d9, d9
-
- vsubl.u8 q7, d25, d3
-
- vpadal.s16 q8, q5
- vmlal.s16 q9, d10, d10
- vmlal.s16 q10, d11, d11
-
- vmov q11, q13
-
- vpadal.s16 q8, q6
- vmlal.s16 q9, d12, d12
- vmlal.s16 q10, d13, d13
-
- vmov q12, q14
-
- vpadal.s16 q8, q7
- vmlal.s16 q9, d14, d14
- vmlal.s16 q10, d15, d15
-
- bne sub_pixel_variance8x8_neon_loop
-
- vadd.u32 q10, q9, q10 ;accumulate sse
- vpaddl.s32 q0, q8 ;accumulate sum
-
- vpaddl.u32 q1, q10
- vadd.s64 d0, d0, d1
- vadd.u64 d1, d2, d3
-
- vmull.s32 q5, d0, d0
- vst1.32 {d1[0]}, [lr] ;store sse
- vshr.u32 d10, d10, #6
- vsub.u32 d0, d1, d10
-
- vmov.32 r0, d0[0] ;return
- pop {r4-r5, pc}
-
- ENDP
-
-;-----------------
-
-bilinear_taps_coeff
- DCD 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/reconintra_arm.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/reconintra_arm.c
deleted file mode 100644
index 2874896..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/reconintra_arm.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vp8/common/blockd.h"
-#include "vpx_mem/vpx_mem.h"
-
-#if HAVE_NEON
-extern void vp8_build_intra_predictors_mby_neon_func(
- unsigned char *y_buffer,
- unsigned char *ypred_ptr,
- int y_stride,
- int mode,
- int Up,
- int Left);
-
-void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x)
-{
- unsigned char *y_buffer = x->dst.y_buffer;
- unsigned char *ypred_ptr = x->predictor;
- int y_stride = x->dst.y_stride;
- int mode = x->mode_info_context->mbmi.mode;
- int Up = x->up_available;
- int Left = x->left_available;
-
- vp8_build_intra_predictors_mby_neon_func(y_buffer, ypred_ptr, y_stride, mode, Up, Left);
-}
-
-extern void vp8_build_intra_predictors_mby_s_neon_func(
- unsigned char *y_buffer,
- unsigned char *ypred_ptr,
- int y_stride,
- int mode,
- int Up,
- int Left);
-
-void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x)
-{
- unsigned char *y_buffer = x->dst.y_buffer;
- unsigned char *ypred_ptr = x->predictor;
- int y_stride = x->dst.y_stride;
- int mode = x->mode_info_context->mbmi.mode;
- int Up = x->up_available;
- int Left = x->left_available;
-
- vp8_build_intra_predictors_mby_s_neon_func(y_buffer, ypred_ptr, y_stride, mode, Up, Left);
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/arm/variance_arm.c b/videocodec/libvpx_internal/libvpx/vp8/common/arm/variance_arm.c
deleted file mode 100644
index 467a509..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/arm/variance_arm.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vp8/common/variance.h"
-#include "vp8/common/filter.h"
-
-#if HAVE_MEDIA
-#include "vp8/common/arm/bilinearfilter_arm.h"
-
-unsigned int vp8_sub_pixel_variance8x8_armv6
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- unsigned short first_pass[10*8];
- unsigned char second_pass[8*8];
- const short *HFilter, *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
- src_pixels_per_line,
- 9, 8, HFilter);
- vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
- 8, 8, 8, VFilter);
-
- return vp8_variance8x8_armv6(second_pass, 8, dst_ptr,
- dst_pixels_per_line, sse);
-}
-
-unsigned int vp8_sub_pixel_variance16x16_armv6
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- unsigned short first_pass[36*16];
- unsigned char second_pass[20*16];
- const short *HFilter, *VFilter;
- unsigned int var;
-
- if (xoffset == 4 && yoffset == 0)
- {
- var = vp8_variance_halfpixvar16x16_h_armv6(src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, sse);
- }
- else if (xoffset == 0 && yoffset == 4)
- {
- var = vp8_variance_halfpixvar16x16_v_armv6(src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, sse);
- }
- else if (xoffset == 4 && yoffset == 4)
- {
- var = vp8_variance_halfpixvar16x16_hv_armv6(src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, sse);
- }
- else
- {
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
- src_pixels_per_line,
- 17, 16, HFilter);
- vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
- 16, 16, 16, VFilter);
-
- var = vp8_variance16x16_armv6(second_pass, 16, dst_ptr,
- dst_pixels_per_line, sse);
- }
- return var;
-}
-
-#endif /* HAVE_MEDIA */
-
-
-#if HAVE_NEON
-
-extern unsigned int vp8_sub_pixel_variance16x16_neon_func
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-);
-
-unsigned int vp8_sub_pixel_variance16x16_neon
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- if (xoffset == 4 && yoffset == 0)
- return vp8_variance_halfpixvar16x16_h_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
- else if (xoffset == 0 && yoffset == 4)
- return vp8_variance_halfpixvar16x16_v_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
- else if (xoffset == 4 && yoffset == 4)
- return vp8_variance_halfpixvar16x16_hv_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
- else
- return vp8_sub_pixel_variance16x16_neon_func(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse);
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/blockd.c b/videocodec/libvpx_internal/libvpx/vp8/common/blockd.c
deleted file mode 100644
index 1fc3cd0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/blockd.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "blockd.h"
-#include "vpx_mem/vpx_mem.h"
-
-const unsigned char vp8_block2left[25] =
-{
- 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
-};
-const unsigned char vp8_block2above[25] =
-{
- 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/blockd.h b/videocodec/libvpx_internal/libvpx/vp8/common/blockd.h
deleted file mode 100644
index 7629218..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/blockd.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_BLOCKD_H_
-#define VP8_COMMON_BLOCKD_H_
-
-void vpx_log(const char *format, ...);
-
-#include "vpx_config.h"
-#include "vpx_scale/yv12config.h"
-#include "mv.h"
-#include "treecoder.h"
-#include "vpx_ports/mem.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*#define DCPRED 1*/
-#define DCPREDSIMTHRESH 0
-#define DCPREDCNTTHRESH 3
-
-#define MB_FEATURE_TREE_PROBS 3
-#define MAX_MB_SEGMENTS 4
-
-#define MAX_REF_LF_DELTAS 4
-#define MAX_MODE_LF_DELTAS 4
-
-/* Segment Feature Masks */
-#define SEGMENT_DELTADATA 0
-#define SEGMENT_ABSDATA 1
-
-typedef struct
-{
- int r, c;
-} POS;
-
-#define PLANE_TYPE_Y_NO_DC 0
-#define PLANE_TYPE_Y2 1
-#define PLANE_TYPE_UV 2
-#define PLANE_TYPE_Y_WITH_DC 3
-
-
-typedef char ENTROPY_CONTEXT;
-typedef struct
-{
- ENTROPY_CONTEXT y1[4];
- ENTROPY_CONTEXT u[2];
- ENTROPY_CONTEXT v[2];
- ENTROPY_CONTEXT y2;
-} ENTROPY_CONTEXT_PLANES;
-
-extern const unsigned char vp8_block2left[25];
-extern const unsigned char vp8_block2above[25];
-
-#define VP8_COMBINEENTROPYCONTEXTS( Dest, A, B) \
- Dest = (A)+(B);
-
-
-typedef enum
-{
- KEY_FRAME = 0,
- INTER_FRAME = 1
-} FRAME_TYPE;
-
-typedef enum
-{
- DC_PRED, /* average of above and left pixels */
- V_PRED, /* vertical prediction */
- H_PRED, /* horizontal prediction */
- TM_PRED, /* Truemotion prediction */
- B_PRED, /* block based prediction, each block has its own prediction mode */
-
- NEARESTMV,
- NEARMV,
- ZEROMV,
- NEWMV,
- SPLITMV,
-
- MB_MODE_COUNT
-} MB_PREDICTION_MODE;
-
-/* Macroblock level features */
-typedef enum
-{
- MB_LVL_ALT_Q = 0, /* Use alternate Quantizer .... */
- MB_LVL_ALT_LF = 1, /* Use alternate loop filter value... */
- MB_LVL_MAX = 2 /* Number of MB level features supported */
-
-} MB_LVL_FEATURES;
-
-/* Segment Feature Masks */
-#define SEGMENT_ALTQ 0x01
-#define SEGMENT_ALT_LF 0x02
-
-#define VP8_YMODES (B_PRED + 1)
-#define VP8_UV_MODES (TM_PRED + 1)
-
-#define VP8_MVREFS (1 + SPLITMV - NEARESTMV)
-
-typedef enum
-{
- B_DC_PRED, /* average of above and left pixels */
- B_TM_PRED,
-
- B_VE_PRED, /* vertical prediction */
- B_HE_PRED, /* horizontal prediction */
-
- B_LD_PRED,
- B_RD_PRED,
-
- B_VR_PRED,
- B_VL_PRED,
- B_HD_PRED,
- B_HU_PRED,
-
- LEFT4X4,
- ABOVE4X4,
- ZERO4X4,
- NEW4X4,
-
- B_MODE_COUNT
-} B_PREDICTION_MODE;
-
-#define VP8_BINTRAMODES (B_HU_PRED + 1) /* 10 */
-#define VP8_SUBMVREFS (1 + NEW4X4 - LEFT4X4)
-
-/* For keyframes, intra block modes are predicted by the (already decoded)
- modes for the Y blocks to the left and above us; for interframes, there
- is a single probability table. */
-
-union b_mode_info
-{
- B_PREDICTION_MODE as_mode;
- int_mv mv;
-};
-
-typedef enum
-{
- INTRA_FRAME = 0,
- LAST_FRAME = 1,
- GOLDEN_FRAME = 2,
- ALTREF_FRAME = 3,
- MAX_REF_FRAMES = 4
-} MV_REFERENCE_FRAME;
-
-typedef struct
-{
- uint8_t mode, uv_mode;
- uint8_t ref_frame;
- uint8_t is_4x4;
- int_mv mv;
-
- uint8_t partitioning;
- uint8_t mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
- uint8_t need_to_clamp_mvs;
- uint8_t segment_id; /* Which set of segmentation parameters should be used for this MB */
-} MB_MODE_INFO;
-
-typedef struct modeinfo
-{
- MB_MODE_INFO mbmi;
- union b_mode_info bmi[16];
-} MODE_INFO;
-
-#if CONFIG_MULTI_RES_ENCODING
-/* The mb-level information needed to be stored for higher-resolution encoder */
-typedef struct
-{
- MB_PREDICTION_MODE mode;
- MV_REFERENCE_FRAME ref_frame;
- int_mv mv;
- int dissim; /* dissimilarity level of the macroblock */
-} LOWER_RES_MB_INFO;
-
-/* The frame-level information needed to be stored for higher-resolution
- * encoder */
-typedef struct
-{
- FRAME_TYPE frame_type;
- int is_frame_dropped;
- /* The frame number of each reference frames */
- unsigned int low_res_ref_frames[MAX_REF_FRAMES];
- LOWER_RES_MB_INFO *mb_info;
-} LOWER_RES_FRAME_INFO;
-#endif
-
-typedef struct blockd
-{
- short *qcoeff;
- short *dqcoeff;
- unsigned char *predictor;
- short *dequant;
-
- int offset;
- char *eob;
-
- union b_mode_info bmi;
-} BLOCKD;
-
-typedef void (*vp8_subpix_fn_t)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-typedef struct macroblockd
-{
- DECLARE_ALIGNED(16, unsigned char, predictor[384]);
- DECLARE_ALIGNED(16, short, qcoeff[400]);
- DECLARE_ALIGNED(16, short, dqcoeff[400]);
- DECLARE_ALIGNED(16, char, eobs[25]);
-
- DECLARE_ALIGNED(16, short, dequant_y1[16]);
- DECLARE_ALIGNED(16, short, dequant_y1_dc[16]);
- DECLARE_ALIGNED(16, short, dequant_y2[16]);
- DECLARE_ALIGNED(16, short, dequant_uv[16]);
-
- /* 16 Y blocks, 4 U, 4 V, 1 DC 2nd order block, each with 16 entries. */
- BLOCKD block[25];
- int fullpixel_mask;
-
- YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
- YV12_BUFFER_CONFIG dst;
-
- MODE_INFO *mode_info_context;
- int mode_info_stride;
-
- FRAME_TYPE frame_type;
-
- int up_available;
- int left_available;
-
- unsigned char *recon_above[3];
- unsigned char *recon_left[3];
- int recon_left_stride[2];
-
- /* Y,U,V,Y2 */
- ENTROPY_CONTEXT_PLANES *above_context;
- ENTROPY_CONTEXT_PLANES *left_context;
-
- /* 0 indicates segmentation at MB level is not enabled. Otherwise the individual bits indicate which features are active. */
- unsigned char segmentation_enabled;
-
- /* 0 (do not update) 1 (update) the macroblock segmentation map. */
- unsigned char update_mb_segmentation_map;
-
- /* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
- unsigned char update_mb_segmentation_data;
-
- /* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
- unsigned char mb_segement_abs_delta;
-
- /* Per frame flags that define which MB level features (such as quantizer or loop filter level) */
- /* are enabled and when enabled the proabilities used to decode the per MB flags in MB_MODE_INFO */
- vp8_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS]; /* Probability Tree used to code Segment number */
-
- signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; /* Segment parameters */
-
- /* mode_based Loop filter adjustment */
- unsigned char mode_ref_lf_delta_enabled;
- unsigned char mode_ref_lf_delta_update;
-
- /* Delta values have the range +/- MAX_LOOP_FILTER */
- signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
- signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
- signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
- signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
-
- /* Distance of MB away from frame edges */
- int mb_to_left_edge;
- int mb_to_right_edge;
- int mb_to_top_edge;
- int mb_to_bottom_edge;
-
-
-
- vp8_subpix_fn_t subpixel_predict;
- vp8_subpix_fn_t subpixel_predict8x4;
- vp8_subpix_fn_t subpixel_predict8x8;
- vp8_subpix_fn_t subpixel_predict16x16;
-
- void *current_bc;
-
- int corrupted;
-
-#if ARCH_X86_32 || ARCH_X86_64
- /* This is an intermediate buffer currently used in sub-pixel motion search
- * to keep a copy of the reference area. This buffer can be used for other
- * purpose.
- */
- DECLARE_ALIGNED(32, unsigned char, y_buf[22*32]);
-#endif
-} MACROBLOCKD;
-
-
-extern void vp8_build_block_doffsets(MACROBLOCKD *x);
-extern void vp8_setup_block_dptrs(MACROBLOCKD *x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_BLOCKD_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/coefupdateprobs.h b/videocodec/libvpx_internal/libvpx/vp8/common/coefupdateprobs.h
deleted file mode 100644
index d96a19e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/coefupdateprobs.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_COMMON_COEFUPDATEPROBS_H_
-#define VP8_COMMON_COEFUPDATEPROBS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Update probabilities for the nodes in the token entropy tree.
- Generated file included by entropy.c */
-
-const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] =
-{
- {
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255, },
- {250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255, },
- {234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255, },
- },
- {
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255, },
- {234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255, },
- {251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255, },
- {248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_COEFUPDATEPROBS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/common.h b/videocodec/libvpx_internal/libvpx/vp8/common/common.h
deleted file mode 100644
index ee5b58c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/common.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_COMMON_H_
-#define VP8_COMMON_COMMON_H_
-
-#include <assert.h>
-
-/* Interface header for common constant data structures and lookup tables */
-
-#include "vpx_mem/vpx_mem.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Only need this for fixed-size arrays, for structs just assign. */
-
-#define vp8_copy( Dest, Src) { \
- assert( sizeof( Dest) == sizeof( Src)); \
- vpx_memcpy( Dest, Src, sizeof( Src)); \
- }
-
-/* Use this for variably-sized arrays. */
-
-#define vp8_copy_array( Dest, Src, N) { \
- assert( sizeof( *Dest) == sizeof( *Src)); \
- vpx_memcpy( Dest, Src, N * sizeof( *Src)); \
- }
-
-#define vp8_zero( Dest) vpx_memset( &Dest, 0, sizeof( Dest));
-
-#define vp8_zero_array( Dest, N) vpx_memset( Dest, 0, N * sizeof( *Dest));
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/context.c b/videocodec/libvpx_internal/libvpx/vp8/common/context.c
deleted file mode 100644
index 99e95d3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/context.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "entropy.h"
-
-/* *** GENERATED FILE: DO NOT EDIT *** */
-
-#if 0
-int Contexts[vp8_coef_counter_dimen];
-
-const int default_contexts[vp8_coef_counter_dimen] =
-{
- {
- // Block Type ( 0 )
- {
- // Coeff Band ( 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,},
- },
- {
- // Coeff Band ( 1 )
- {30190, 26544, 225, 24, 4, 0, 0, 0, 0, 0, 0, 4171593,},
- {26846, 25157, 1241, 130, 26, 6, 1, 0, 0, 0, 0, 149987,},
- {10484, 9538, 1006, 160, 36, 18, 0, 0, 0, 0, 0, 15104,},
- },
- {
- // Coeff Band ( 2 )
- {25842, 40456, 1126, 83, 11, 2, 0, 0, 0, 0, 0, 0,},
- {9338, 8010, 512, 73, 7, 3, 2, 0, 0, 0, 0, 43294,},
- {1047, 751, 149, 31, 13, 6, 1, 0, 0, 0, 0, 879,},
- },
- {
- // Coeff Band ( 3 )
- {26136, 9826, 252, 13, 0, 0, 0, 0, 0, 0, 0, 0,},
- {8134, 5574, 191, 14, 2, 0, 0, 0, 0, 0, 0, 35302,},
- { 605, 677, 116, 9, 1, 0, 0, 0, 0, 0, 0, 611,},
- },
- {
- // Coeff Band ( 4 )
- {10263, 15463, 283, 17, 0, 0, 0, 0, 0, 0, 0, 0,},
- {2773, 2191, 128, 9, 2, 2, 0, 0, 0, 0, 0, 10073,},
- { 134, 125, 32, 4, 0, 2, 0, 0, 0, 0, 0, 50,},
- },
- {
- // Coeff Band ( 5 )
- {10483, 2663, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0,},
- {2137, 1251, 27, 1, 1, 0, 0, 0, 0, 0, 0, 14362,},
- { 116, 156, 14, 2, 1, 0, 0, 0, 0, 0, 0, 190,},
- },
- {
- // Coeff Band ( 6 )
- {40977, 27614, 412, 28, 0, 0, 0, 0, 0, 0, 0, 0,},
- {6113, 5213, 261, 22, 3, 0, 0, 0, 0, 0, 0, 26164,},
- { 382, 312, 50, 14, 2, 0, 0, 0, 0, 0, 0, 345,},
- },
- {
- // Coeff Band ( 7 )
- { 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,},
- },
- },
- {
- // Block Type ( 1 )
- {
- // Coeff Band ( 0 )
- {3268, 19382, 1043, 250, 93, 82, 49, 26, 17, 8, 25, 82289,},
- {8758, 32110, 5436, 1832, 827, 668, 420, 153, 24, 0, 3, 52914,},
- {9337, 23725, 8487, 3954, 2107, 1836, 1069, 399, 59, 0, 0, 18620,},
- },
- {
- // Coeff Band ( 1 )
- {12419, 8420, 452, 62, 9, 1, 0, 0, 0, 0, 0, 0,},
- {11715, 8705, 693, 92, 15, 7, 2, 0, 0, 0, 0, 53988,},
- {7603, 8585, 2306, 778, 270, 145, 39, 5, 0, 0, 0, 9136,},
- },
- {
- // Coeff Band ( 2 )
- {15938, 14335, 1207, 184, 55, 13, 4, 1, 0, 0, 0, 0,},
- {7415, 6829, 1138, 244, 71, 26, 7, 0, 0, 0, 0, 9980,},
- {1580, 1824, 655, 241, 89, 46, 10, 2, 0, 0, 0, 429,},
- },
- {
- // Coeff Band ( 3 )
- {19453, 5260, 201, 19, 0, 0, 0, 0, 0, 0, 0, 0,},
- {9173, 3758, 213, 22, 1, 1, 0, 0, 0, 0, 0, 9820,},
- {1689, 1277, 276, 51, 17, 4, 0, 0, 0, 0, 0, 679,},
- },
- {
- // Coeff Band ( 4 )
- {12076, 10667, 620, 85, 19, 9, 5, 0, 0, 0, 0, 0,},
- {4665, 3625, 423, 55, 19, 9, 0, 0, 0, 0, 0, 5127,},
- { 415, 440, 143, 34, 20, 7, 2, 0, 0, 0, 0, 101,},
- },
- {
- // Coeff Band ( 5 )
- {12183, 4846, 115, 11, 1, 0, 0, 0, 0, 0, 0, 0,},
- {4226, 3149, 177, 21, 2, 0, 0, 0, 0, 0, 0, 7157,},
- { 375, 621, 189, 51, 11, 4, 1, 0, 0, 0, 0, 198,},
- },
- {
- // Coeff Band ( 6 )
- {61658, 37743, 1203, 94, 10, 3, 0, 0, 0, 0, 0, 0,},
- {15514, 11563, 903, 111, 14, 5, 0, 0, 0, 0, 0, 25195,},
- { 929, 1077, 291, 78, 14, 7, 1, 0, 0, 0, 0, 507,},
- },
- {
- // Coeff Band ( 7 )
- { 0, 990, 15, 3, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 0, 412, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1641,},
- { 0, 18, 7, 1, 0, 0, 0, 0, 0, 0, 0, 30,},
- },
- },
- {
- // Block Type ( 2 )
- {
- // Coeff Band ( 0 )
- { 953, 24519, 628, 120, 28, 12, 4, 0, 0, 0, 0, 2248798,},
- {1525, 25654, 2647, 617, 239, 143, 42, 5, 0, 0, 0, 66837,},
- {1180, 11011, 3001, 1237, 532, 448, 239, 54, 5, 0, 0, 7122,},
- },
- {
- // Coeff Band ( 1 )
- {1356, 2220, 67, 10, 4, 1, 0, 0, 0, 0, 0, 0,},
- {1450, 2544, 102, 18, 4, 3, 0, 0, 0, 0, 0, 57063,},
- {1182, 2110, 470, 130, 41, 21, 0, 0, 0, 0, 0, 6047,},
- },
- {
- // Coeff Band ( 2 )
- { 370, 3378, 200, 30, 5, 4, 1, 0, 0, 0, 0, 0,},
- { 293, 1006, 131, 29, 11, 0, 0, 0, 0, 0, 0, 5404,},
- { 114, 387, 98, 23, 4, 8, 1, 0, 0, 0, 0, 236,},
- },
- {
- // Coeff Band ( 3 )
- { 579, 194, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 395, 213, 5, 1, 0, 0, 0, 0, 0, 0, 0, 4157,},
- { 119, 122, 4, 0, 0, 0, 0, 0, 0, 0, 0, 300,},
- },
- {
- // Coeff Band ( 4 )
- { 38, 557, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 21, 114, 12, 1, 0, 0, 0, 0, 0, 0, 0, 427,},
- { 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,},
- },
- {
- // Coeff Band ( 5 )
- { 52, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 18, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652,},
- { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,},
- },
- {
- // Coeff Band ( 6 )
- { 640, 569, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 25, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 517,},
- { 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,},
- },
- {
- // Coeff Band ( 7 )
- { 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,},
- },
- },
- {
- // Block Type ( 3 )
- {
- // Coeff Band ( 0 )
- {2506, 20161, 2707, 767, 261, 178, 107, 30, 14, 3, 0, 100694,},
- {8806, 36478, 8817, 3268, 1280, 850, 401, 114, 42, 0, 0, 58572,},
- {11003, 27214, 11798, 5716, 2482, 2072, 1048, 175, 32, 0, 0, 19284,},
- },
- {
- // Coeff Band ( 1 )
- {9738, 11313, 959, 205, 70, 18, 11, 1, 0, 0, 0, 0,},
- {12628, 15085, 1507, 273, 52, 19, 9, 0, 0, 0, 0, 54280,},
- {10701, 15846, 5561, 1926, 813, 570, 249, 36, 0, 0, 0, 6460,},
- },
- {
- // Coeff Band ( 2 )
- {6781, 22539, 2784, 634, 182, 123, 20, 4, 0, 0, 0, 0,},
- {6263, 11544, 2649, 790, 259, 168, 27, 5, 0, 0, 0, 20539,},
- {3109, 4075, 2031, 896, 457, 386, 158, 29, 0, 0, 0, 1138,},
- },
- {
- // Coeff Band ( 3 )
- {11515, 4079, 465, 73, 5, 14, 2, 0, 0, 0, 0, 0,},
- {9361, 5834, 650, 96, 24, 8, 4, 0, 0, 0, 0, 22181,},
- {4343, 3974, 1360, 415, 132, 96, 14, 1, 0, 0, 0, 1267,},
- },
- {
- // Coeff Band ( 4 )
- {4787, 9297, 823, 168, 44, 12, 4, 0, 0, 0, 0, 0,},
- {3619, 4472, 719, 198, 60, 31, 3, 0, 0, 0, 0, 8401,},
- {1157, 1175, 483, 182, 88, 31, 8, 0, 0, 0, 0, 268,},
- },
- {
- // Coeff Band ( 5 )
- {8299, 1226, 32, 5, 1, 0, 0, 0, 0, 0, 0, 0,},
- {3502, 1568, 57, 4, 1, 1, 0, 0, 0, 0, 0, 9811,},
- {1055, 1070, 166, 29, 6, 1, 0, 0, 0, 0, 0, 527,},
- },
- {
- // Coeff Band ( 6 )
- {27414, 27927, 1989, 347, 69, 26, 0, 0, 0, 0, 0, 0,},
- {5876, 10074, 1574, 341, 91, 24, 4, 0, 0, 0, 0, 21954,},
- {1571, 2171, 778, 324, 124, 65, 16, 0, 0, 0, 0, 979,},
- },
- {
- // Coeff Band ( 7 )
- { 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 459,},
- { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13,},
- },
- },
-};
-
-//Update probabilities for the nodes in the token entropy tree.
-const vp8_prob tree_update_probs[vp8_coef_tree_dimen] =
-{
- {
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255, },
- {250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255, },
- {234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255, },
- },
- {
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255, },
- {234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255, },
- {251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255, },
- {248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
-};
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/debugmodes.c b/videocodec/libvpx_internal/libvpx/vp8/common/debugmodes.c
deleted file mode 100644
index 46064e6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/debugmodes.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdio.h>
-#include "blockd.h"
-
-
-void vp8_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols, int frame)
-{
-
- int mb_row;
- int mb_col;
- int mb_index = 0;
- FILE *mvs = fopen("mvs.stt", "a");
-
- /* print out the macroblock Y modes */
- mb_index = 0;
- fprintf(mvs, "Mb Modes for Frame %d\n", frame);
-
- for (mb_row = 0; mb_row < rows; mb_row++)
- {
- for (mb_col = 0; mb_col < cols; mb_col++)
- {
-
- fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
-
- mb_index++;
- }
-
- fprintf(mvs, "\n");
- mb_index++;
- }
-
- fprintf(mvs, "\n");
-
- mb_index = 0;
- fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
-
- for (mb_row = 0; mb_row < rows; mb_row++)
- {
- for (mb_col = 0; mb_col < cols; mb_col++)
- {
-
- fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
-
- mb_index++;
- }
-
- fprintf(mvs, "\n");
- mb_index++;
- }
-
- fprintf(mvs, "\n");
-
- /* print out the macroblock UV modes */
- mb_index = 0;
- fprintf(mvs, "UV Modes for Frame %d\n", frame);
-
- for (mb_row = 0; mb_row < rows; mb_row++)
- {
- for (mb_col = 0; mb_col < cols; mb_col++)
- {
-
- fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
-
- mb_index++;
- }
-
- mb_index++;
- fprintf(mvs, "\n");
- }
-
- fprintf(mvs, "\n");
-
- /* print out the block modes */
- mb_index = 0;
- fprintf(mvs, "Mbs for Frame %d\n", frame);
- {
- int b_row;
-
- for (b_row = 0; b_row < 4 * rows; b_row++)
- {
- int b_col;
- int bindex;
-
- for (b_col = 0; b_col < 4 * cols; b_col++)
- {
- mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
- bindex = (b_row & 3) * 4 + (b_col & 3);
-
- if (mi[mb_index].mbmi.mode == B_PRED)
- fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode);
- else
- fprintf(mvs, "xx ");
-
- }
-
- fprintf(mvs, "\n");
- }
- }
- fprintf(mvs, "\n");
-
- /* print out the macroblock mvs */
- mb_index = 0;
- fprintf(mvs, "MVs for Frame %d\n", frame);
-
- for (mb_row = 0; mb_row < rows; mb_row++)
- {
- for (mb_col = 0; mb_col < cols; mb_col++)
- {
- fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv.as_mv.row / 2, mi[mb_index].mbmi.mv.as_mv.col / 2);
-
- mb_index++;
- }
-
- mb_index++;
- fprintf(mvs, "\n");
- }
-
- fprintf(mvs, "\n");
-
-
- /* print out the block modes */
- mb_index = 0;
- fprintf(mvs, "MVs for Frame %d\n", frame);
- {
- int b_row;
-
- for (b_row = 0; b_row < 4 * rows; b_row++)
- {
- int b_col;
- int bindex;
-
- for (b_col = 0; b_col < 4 * cols; b_col++)
- {
- mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
- bindex = (b_row & 3) * 4 + (b_col & 3);
- fprintf(mvs, "%3d:%-3d ", mi[mb_index].bmi[bindex].mv.as_mv.row, mi[mb_index].bmi[bindex].mv.as_mv.col);
-
- }
-
- fprintf(mvs, "\n");
- }
- }
- fprintf(mvs, "\n");
-
-
- fclose(mvs);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/default_coef_probs.h b/videocodec/libvpx_internal/libvpx/vp8/common/default_coef_probs.h
deleted file mode 100644
index 4d69e4b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/default_coef_probs.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
-*/
-
-#ifndef VP8_COMMON_DEFAULT_COEF_PROBS_H_
-#define VP8_COMMON_DEFAULT_COEF_PROBS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*Generated file, included by entropy.c*/
-
-
-static const vp8_prob default_coef_probs [BLOCK_TYPES]
- [COEF_BANDS]
- [PREV_COEF_CONTEXTS]
- [ENTROPY_NODES] =
-{
- { /* Block Type ( 0 ) */
- { /* Coeff Band ( 0 )*/
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 1 )*/
- { 253, 136, 254, 255, 228, 219, 128, 128, 128, 128, 128 },
- { 189, 129, 242, 255, 227, 213, 255, 219, 128, 128, 128 },
- { 106, 126, 227, 252, 214, 209, 255, 255, 128, 128, 128 }
- },
- { /* Coeff Band ( 2 )*/
- { 1, 98, 248, 255, 236, 226, 255, 255, 128, 128, 128 },
- { 181, 133, 238, 254, 221, 234, 255, 154, 128, 128, 128 },
- { 78, 134, 202, 247, 198, 180, 255, 219, 128, 128, 128 }
- },
- { /* Coeff Band ( 3 )*/
- { 1, 185, 249, 255, 243, 255, 128, 128, 128, 128, 128 },
- { 184, 150, 247, 255, 236, 224, 128, 128, 128, 128, 128 },
- { 77, 110, 216, 255, 236, 230, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 4 )*/
- { 1, 101, 251, 255, 241, 255, 128, 128, 128, 128, 128 },
- { 170, 139, 241, 252, 236, 209, 255, 255, 128, 128, 128 },
- { 37, 116, 196, 243, 228, 255, 255, 255, 128, 128, 128 }
- },
- { /* Coeff Band ( 5 )*/
- { 1, 204, 254, 255, 245, 255, 128, 128, 128, 128, 128 },
- { 207, 160, 250, 255, 238, 128, 128, 128, 128, 128, 128 },
- { 102, 103, 231, 255, 211, 171, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 6 )*/
- { 1, 152, 252, 255, 240, 255, 128, 128, 128, 128, 128 },
- { 177, 135, 243, 255, 234, 225, 128, 128, 128, 128, 128 },
- { 80, 129, 211, 255, 194, 224, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 7 )*/
- { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 246, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
- }
- },
- { /* Block Type ( 1 ) */
- { /* Coeff Band ( 0 )*/
- { 198, 35, 237, 223, 193, 187, 162, 160, 145, 155, 62 },
- { 131, 45, 198, 221, 172, 176, 220, 157, 252, 221, 1 },
- { 68, 47, 146, 208, 149, 167, 221, 162, 255, 223, 128 }
- },
- { /* Coeff Band ( 1 )*/
- { 1, 149, 241, 255, 221, 224, 255, 255, 128, 128, 128 },
- { 184, 141, 234, 253, 222, 220, 255, 199, 128, 128, 128 },
- { 81, 99, 181, 242, 176, 190, 249, 202, 255, 255, 128 }
- },
- { /* Coeff Band ( 2 )*/
- { 1, 129, 232, 253, 214, 197, 242, 196, 255, 255, 128 },
- { 99, 121, 210, 250, 201, 198, 255, 202, 128, 128, 128 },
- { 23, 91, 163, 242, 170, 187, 247, 210, 255, 255, 128 }
- },
- { /* Coeff Band ( 3 )*/
- { 1, 200, 246, 255, 234, 255, 128, 128, 128, 128, 128 },
- { 109, 178, 241, 255, 231, 245, 255, 255, 128, 128, 128 },
- { 44, 130, 201, 253, 205, 192, 255, 255, 128, 128, 128 }
- },
- { /* Coeff Band ( 4 )*/
- { 1, 132, 239, 251, 219, 209, 255, 165, 128, 128, 128 },
- { 94, 136, 225, 251, 218, 190, 255, 255, 128, 128, 128 },
- { 22, 100, 174, 245, 186, 161, 255, 199, 128, 128, 128 }
- },
- { /* Coeff Band ( 5 )*/
- { 1, 182, 249, 255, 232, 235, 128, 128, 128, 128, 128 },
- { 124, 143, 241, 255, 227, 234, 128, 128, 128, 128, 128 },
- { 35, 77, 181, 251, 193, 211, 255, 205, 128, 128, 128 }
- },
- { /* Coeff Band ( 6 )*/
- { 1, 157, 247, 255, 236, 231, 255, 255, 128, 128, 128 },
- { 121, 141, 235, 255, 225, 227, 255, 255, 128, 128, 128 },
- { 45, 99, 188, 251, 195, 217, 255, 224, 128, 128, 128 }
- },
- { /* Coeff Band ( 7 )*/
- { 1, 1, 251, 255, 213, 255, 128, 128, 128, 128, 128 },
- { 203, 1, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
- { 137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128 }
- }
- },
- { /* Block Type ( 2 ) */
- { /* Coeff Band ( 0 )*/
- { 253, 9, 248, 251, 207, 208, 255, 192, 128, 128, 128 },
- { 175, 13, 224, 243, 193, 185, 249, 198, 255, 255, 128 },
- { 73, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128 }
- },
- { /* Coeff Band ( 1 )*/
- { 1, 95, 247, 253, 212, 183, 255, 255, 128, 128, 128 },
- { 239, 90, 244, 250, 211, 209, 255, 255, 128, 128, 128 },
- { 155, 77, 195, 248, 188, 195, 255, 255, 128, 128, 128 }
- },
- { /* Coeff Band ( 2 )*/
- { 1, 24, 239, 251, 218, 219, 255, 205, 128, 128, 128 },
- { 201, 51, 219, 255, 196, 186, 128, 128, 128, 128, 128 },
- { 69, 46, 190, 239, 201, 218, 255, 228, 128, 128, 128 }
- },
- { /* Coeff Band ( 3 )*/
- { 1, 191, 251, 255, 255, 128, 128, 128, 128, 128, 128 },
- { 223, 165, 249, 255, 213, 255, 128, 128, 128, 128, 128 },
- { 141, 124, 248, 255, 255, 128, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 4 )*/
- { 1, 16, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
- { 190, 36, 230, 255, 236, 255, 128, 128, 128, 128, 128 },
- { 149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 5 )*/
- { 1, 226, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 247, 192, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 6 )*/
- { 1, 134, 252, 255, 255, 128, 128, 128, 128, 128, 128 },
- { 213, 62, 250, 255, 255, 128, 128, 128, 128, 128, 128 },
- { 55, 93, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
- },
- { /* Coeff Band ( 7 )*/
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
- }
- },
- { /* Block Type ( 3 ) */
- { /* Coeff Band ( 0 )*/
- { 202, 24, 213, 235, 186, 191, 220, 160, 240, 175, 255 },
- { 126, 38, 182, 232, 169, 184, 228, 174, 255, 187, 128 },
- { 61, 46, 138, 219, 151, 178, 240, 170, 255, 216, 128 }
- },
- { /* Coeff Band ( 1 )*/
- { 1, 112, 230, 250, 199, 191, 247, 159, 255, 255, 128 },
- { 166, 109, 228, 252, 211, 215, 255, 174, 128, 128, 128 },
- { 39, 77, 162, 232, 172, 180, 245, 178, 255, 255, 128 }
- },
- { /* Coeff Band ( 2 )*/
- { 1, 52, 220, 246, 198, 199, 249, 220, 255, 255, 128 },
- { 124, 74, 191, 243, 183, 193, 250, 221, 255, 255, 128 },
- { 24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128 }
- },
- { /* Coeff Band ( 3 )*/
- { 1, 182, 225, 249, 219, 240, 255, 224, 128, 128, 128 },
- { 149, 150, 226, 252, 216, 205, 255, 171, 128, 128, 128 },
- { 28, 108, 170, 242, 183, 194, 254, 223, 255, 255, 128 }
- },
- { /* Coeff Band ( 4 )*/
- { 1, 81, 230, 252, 204, 203, 255, 192, 128, 128, 128 },
- { 123, 102, 209, 247, 188, 196, 255, 233, 128, 128, 128 },
- { 20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128 }
- },
- { /* Coeff Band ( 5 )*/
- { 1, 222, 248, 255, 216, 213, 128, 128, 128, 128, 128 },
- { 168, 175, 246, 252, 235, 205, 255, 255, 128, 128, 128 },
- { 47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128 }
- },
- { /* Coeff Band ( 6 )*/
- { 1, 121, 236, 253, 212, 214, 255, 255, 128, 128, 128 },
- { 141, 84, 213, 252, 201, 202, 255, 219, 128, 128, 128 },
- { 42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128 }
- },
- { /* Coeff Band ( 7 )*/
- { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
- { 238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
- }
- }
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_DEFAULT_COEF_PROBS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/dequantize.c b/videocodec/libvpx_internal/libvpx/vp8/common/dequantize.c
deleted file mode 100644
index 6e2f69a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/dequantize.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vp8/common/blockd.h"
-#include "vpx_mem/vpx_mem.h"
-
-void vp8_dequantize_b_c(BLOCKD *d, short *DQC)
-{
- int i;
- short *DQ = d->dqcoeff;
- short *Q = d->qcoeff;
-
- for (i = 0; i < 16; i++)
- {
- DQ[i] = Q[i] * DQC[i];
- }
-}
-
-void vp8_dequant_idct_add_c(short *input, short *dq,
- unsigned char *dest, int stride)
-{
- int i;
-
- for (i = 0; i < 16; i++)
- {
- input[i] = dq[i] * input[i];
- }
-
- vp8_short_idct4x4llm_c(input, dest, stride, dest, stride);
-
- vpx_memset(input, 0, 32);
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/entropy.c b/videocodec/libvpx_internal/libvpx/vp8/common/entropy.c
deleted file mode 100644
index 8c046a4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/entropy.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "entropy.h"
-#include "blockd.h"
-#include "onyxc_int.h"
-#include "vpx_mem/vpx_mem.h"
-
-#include "coefupdateprobs.h"
-
-DECLARE_ALIGNED(16, const unsigned char, vp8_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
-};
-
-DECLARE_ALIGNED(16, const unsigned char, vp8_coef_bands[16]) =
-{ 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7};
-
-DECLARE_ALIGNED(16, const unsigned char,
- vp8_prev_token_class[MAX_ENTROPY_TOKENS]) =
-{ 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0};
-
-DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) =
-{
- 0, 1, 4, 8,
- 5, 2, 3, 6,
- 9, 12, 13, 10,
- 7, 11, 14, 15,
-};
-
-DECLARE_ALIGNED(16, const short, vp8_default_inv_zig_zag[16]) =
-{
- 1, 2, 6, 7,
- 3, 5, 8, 13,
- 4, 9, 12, 14,
- 10, 11, 15, 16
-};
-
-/* vp8_default_zig_zag_mask generated with:
-
- void vp8_init_scan_order_mask()
- {
- int i;
-
- for (i = 0; i < 16; i++)
- {
- vp8_default_zig_zag_mask[vp8_default_zig_zag1d[i]] = 1 << i;
- }
-
- }
-*/
-DECLARE_ALIGNED(16, const short, vp8_default_zig_zag_mask[16]) =
-{
- 1, 2, 32, 64,
- 4, 16, 128, 4096,
- 8, 256, 2048, 8192,
- 512, 1024, 16384, -32768
-};
-
-const int vp8_mb_feature_data_bits[MB_LVL_MAX] = {7, 6};
-
-/* Array indices are identical to previously-existing CONTEXT_NODE indices */
-
-const vp8_tree_index vp8_coef_tree[ 22] = /* corresponding _CONTEXT_NODEs */
-{
- -DCT_EOB_TOKEN, 2, /* 0 = EOB */
- -ZERO_TOKEN, 4, /* 1 = ZERO */
- -ONE_TOKEN, 6, /* 2 = ONE */
- 8, 12, /* 3 = LOW_VAL */
- -TWO_TOKEN, 10, /* 4 = TWO */
- -THREE_TOKEN, -FOUR_TOKEN, /* 5 = THREE */
- 14, 16, /* 6 = HIGH_LOW */
- -DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 7 = CAT_ONE */
- 18, 20, /* 8 = CAT_THREEFOUR */
- -DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */
- -DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
-};
-
-/* vp8_coef_encodings generated with:
- vp8_tokens_from_tree(vp8_coef_encodings, vp8_coef_tree);
-*/
-vp8_token vp8_coef_encodings[MAX_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}
-};
-
-/* Trees for extra bits. Probabilities are constant and
- do not depend on previously encoded bits */
-
-static const vp8_prob Pcat1[] = { 159};
-static const vp8_prob Pcat2[] = { 165, 145};
-static const vp8_prob Pcat3[] = { 173, 148, 140};
-static const vp8_prob Pcat4[] = { 176, 155, 140, 135};
-static const vp8_prob Pcat5[] = { 180, 157, 141, 134, 130};
-static const vp8_prob Pcat6[] =
-{ 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129};
-
-
-/* tree index tables generated with:
-
- void init_bit_tree(vp8_tree_index *p, int n)
- {
- int i = 0;
-
- while (++i < n)
- {
- p[0] = p[1] = i << 1;
- p += 2;
- }
-
- p[0] = p[1] = 0;
- }
-
- void init_bit_trees()
- {
- init_bit_tree(cat1, 1);
- init_bit_tree(cat2, 2);
- init_bit_tree(cat3, 3);
- init_bit_tree(cat4, 4);
- init_bit_tree(cat5, 5);
- init_bit_tree(cat6, 11);
- }
-*/
-
-static const vp8_tree_index cat1[2] = { 0, 0 };
-static const vp8_tree_index cat2[4] = { 2, 2, 0, 0 };
-static const vp8_tree_index cat3[6] = { 2, 2, 4, 4, 0, 0 };
-static const vp8_tree_index cat4[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
-static const vp8_tree_index cat5[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
-static const vp8_tree_index cat6[22] = { 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12,
- 14, 14, 16, 16, 18, 18, 20, 20, 0, 0 };
-
-const vp8_extra_bit_struct vp8_extra_bits[12] =
-{
- { 0, 0, 0, 0},
- { 0, 0, 0, 1},
- { 0, 0, 0, 2},
- { 0, 0, 0, 3},
- { 0, 0, 0, 4},
- { cat1, Pcat1, 1, 5},
- { cat2, Pcat2, 2, 7},
- { cat3, Pcat3, 3, 11},
- { cat4, Pcat4, 4, 19},
- { cat5, Pcat5, 5, 35},
- { cat6, Pcat6, 11, 67},
- { 0, 0, 0, 0}
-};
-
-#include "default_coef_probs.h"
-
-void vp8_default_coef_probs(VP8_COMMON *pc)
-{
- vpx_memcpy(pc->fc.coef_probs, default_coef_probs,
- sizeof(default_coef_probs));
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/entropy.h b/videocodec/libvpx_internal/libvpx/vp8/common/entropy.h
deleted file mode 100644
index a90bab4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/entropy.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ENTROPY_H_
-#define VP8_COMMON_ENTROPY_H_
-
-#include "treecoder.h"
-#include "blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Coefficient token alphabet */
-
-#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */
-#define ONE_TOKEN 1 /* 1 Extra Bits 0+1 */
-#define TWO_TOKEN 2 /* 2 Extra Bits 0+1 */
-#define THREE_TOKEN 3 /* 3 Extra Bits 0+1 */
-#define FOUR_TOKEN 4 /* 4 Extra Bits 0+1 */
-#define DCT_VAL_CATEGORY1 5 /* 5-6 Extra Bits 1+1 */
-#define DCT_VAL_CATEGORY2 6 /* 7-10 Extra Bits 2+1 */
-#define DCT_VAL_CATEGORY3 7 /* 11-18 Extra Bits 3+1 */
-#define DCT_VAL_CATEGORY4 8 /* 19-34 Extra Bits 4+1 */
-#define DCT_VAL_CATEGORY5 9 /* 35-66 Extra Bits 5+1 */
-#define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 11+1 */
-#define DCT_EOB_TOKEN 11 /* EOB Extra Bits 0+0 */
-
-#define MAX_ENTROPY_TOKENS 12
-#define ENTROPY_NODES 11
-
-extern const vp8_tree_index vp8_coef_tree[];
-
-extern const struct vp8_token_struct vp8_coef_encodings[MAX_ENTROPY_TOKENS];
-
-typedef struct
-{
- vp8_tree_p tree;
- const vp8_prob *prob;
- int Len;
- int base_val;
-} vp8_extra_bit_struct;
-
-extern const vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
-
-#define PROB_UPDATE_BASELINE_COST 7
-
-#define MAX_PROB 255
-#define DCT_MAX_VALUE 2048
-
-
-/* Coefficients are predicted via a 3-dimensional probability table. */
-
-/* Outside dimension. 0 = Y no DC, 1 = Y2, 2 = UV, 3 = Y with DC */
-
-#define BLOCK_TYPES 4
-
-/* Middle dimension is a coarsening of the coefficient's
- position within the 4x4 DCT. */
-
-#define COEF_BANDS 8
-extern DECLARE_ALIGNED(16, const unsigned char, vp8_coef_bands[16]);
-
-/* Inside dimension is 3-valued measure of nearby complexity, that is,
- the extent to which nearby coefficients are nonzero. For the first
- coefficient (DC, unless block type is 0), we look at the (already encoded)
- blocks above and to the left of the current block. The context index is
- then the number (0,1,or 2) of these blocks having nonzero coefficients.
- After decoding a coefficient, the measure is roughly the size of the
- most recently decoded coefficient (0 for 0, 1 for 1, 2 for >1).
- Note that the intuitive meaning of this measure changes as coefficients
- are decoded, e.g., prior to the first token, a zero means that my neighbors
- are empty while, after the first token, because of the use of end-of-block,
- a zero means we just decoded a zero and hence guarantees that a non-zero
- coefficient will appear later in this block. However, this shift
- in meaning is perfectly OK because our context depends also on the
- coefficient band (and since zigzag positions 0, 1, and 2 are in
- distinct bands). */
-
-/*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */
-# define PREV_COEF_CONTEXTS 3
-
-extern DECLARE_ALIGNED(16, const unsigned char, vp8_prev_token_class[MAX_ENTROPY_TOKENS]);
-
-extern const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-
-
-struct VP8Common;
-void vp8_default_coef_probs(struct VP8Common *);
-
-extern DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]);
-extern DECLARE_ALIGNED(16, const short, vp8_default_inv_zig_zag[16]);
-extern DECLARE_ALIGNED(16, const short, vp8_default_zig_zag_mask[16]);
-extern const int vp8_mb_feature_data_bits[MB_LVL_MAX];
-
-void vp8_coef_tree_initialize(void);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_ENTROPY_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/entropymode.c b/videocodec/libvpx_internal/libvpx/vp8/common/entropymode.c
deleted file mode 100644
index 091e4c7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/entropymode.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#define USE_PREBUILT_TABLES
-
-#include "entropymode.h"
-#include "entropy.h"
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp8_entropymodedata.h"
-
-int vp8_mv_cont(const int_mv *l, const int_mv *a)
-{
- int lez = (l->as_int == 0);
- int aez = (a->as_int == 0);
- int lea = (l->as_int == a->as_int);
-
- if (lea && lez)
- return SUBMVREF_LEFT_ABOVE_ZED;
-
- if (lea)
- return SUBMVREF_LEFT_ABOVE_SAME;
-
- if (aez)
- return SUBMVREF_ABOVE_ZED;
-
- if (lez)
- return SUBMVREF_LEFT_ZED;
-
- return SUBMVREF_NORMAL;
-}
-
-static const vp8_prob sub_mv_ref_prob [VP8_SUBMVREFS-1] = { 180, 162, 25};
-
-const vp8_prob vp8_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS-1] =
-{
- { 147, 136, 18 },
- { 106, 145, 1 },
- { 179, 121, 1 },
- { 223, 1 , 34 },
- { 208, 1 , 1 }
-};
-
-
-
-const vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS] =
-{
- {
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 1, 1, 1, 1,
- 1, 1, 1, 1,
- },
- {
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- },
- {
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- 2, 2, 3, 3,
- 2, 2, 3, 3,
- },
- {
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
- 12, 13, 14, 15,
- }
-};
-
-const int vp8_mbsplit_count [VP8_NUMMBSPLITS] = { 2, 2, 4, 16};
-
-const vp8_prob vp8_mbsplit_probs [VP8_NUMMBSPLITS-1] = { 110, 111, 150};
-
-
-/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
-
-const vp8_tree_index vp8_bmode_tree[18] = /* INTRAMODECONTEXTNODE value */
-{
- -B_DC_PRED, 2, /* 0 = DC_NODE */
- -B_TM_PRED, 4, /* 1 = TM_NODE */
- -B_VE_PRED, 6, /* 2 = VE_NODE */
- 8, 12, /* 3 = COM_NODE */
- -B_HE_PRED, 10, /* 4 = HE_NODE */
- -B_RD_PRED, -B_VR_PRED, /* 5 = RD_NODE */
- -B_LD_PRED, 14, /* 6 = LD_NODE */
- -B_VL_PRED, 16, /* 7 = VL_NODE */
- -B_HD_PRED, -B_HU_PRED /* 8 = HD_NODE */
-};
-
-/* Again, these trees use the same probability indices as their
- explicitly-programmed predecessors. */
-
-const vp8_tree_index vp8_ymode_tree[8] =
-{
- -DC_PRED, 2,
- 4, 6,
- -V_PRED, -H_PRED,
- -TM_PRED, -B_PRED
-};
-
-const vp8_tree_index vp8_kf_ymode_tree[8] =
-{
- -B_PRED, 2,
- 4, 6,
- -DC_PRED, -V_PRED,
- -H_PRED, -TM_PRED
-};
-
-const vp8_tree_index vp8_uv_mode_tree[6] =
-{
- -DC_PRED, 2,
- -V_PRED, 4,
- -H_PRED, -TM_PRED
-};
-
-const vp8_tree_index vp8_mbsplit_tree[6] =
-{
- -3, 2,
- -2, 4,
- -0, -1
-};
-
-const vp8_tree_index vp8_mv_ref_tree[8] =
-{
- -ZEROMV, 2,
- -NEARESTMV, 4,
- -NEARMV, 6,
- -NEWMV, -SPLITMV
-};
-
-const vp8_tree_index vp8_sub_mv_ref_tree[6] =
-{
- -LEFT4X4, 2,
- -ABOVE4X4, 4,
- -ZERO4X4, -NEW4X4
-};
-
-const vp8_tree_index vp8_small_mvtree [14] =
-{
- 2, 8,
- 4, 6,
- -0, -1,
- -2, -3,
- 10, 12,
- -4, -5,
- -6, -7
-};
-
-void vp8_init_mbmode_probs(VP8_COMMON *x)
-{
- vpx_memcpy(x->fc.ymode_prob, vp8_ymode_prob, sizeof(vp8_ymode_prob));
- vpx_memcpy(x->fc.uv_mode_prob, vp8_uv_mode_prob, sizeof(vp8_uv_mode_prob));
- vpx_memcpy(x->fc.sub_mv_ref_prob, sub_mv_ref_prob, sizeof(sub_mv_ref_prob));
-}
-
-void vp8_default_bmode_probs(vp8_prob p [VP8_BINTRAMODES-1])
-{
- vpx_memcpy(p, vp8_bmode_prob, sizeof(vp8_bmode_prob));
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/entropymode.h b/videocodec/libvpx_internal/libvpx/vp8/common/entropymode.h
deleted file mode 100644
index 81bdfc4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/entropymode.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ENTROPYMODE_H_
-#define VP8_COMMON_ENTROPYMODE_H_
-
-#include "onyxc_int.h"
-#include "treecoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum
-{
- SUBMVREF_NORMAL,
- SUBMVREF_LEFT_ZED,
- SUBMVREF_ABOVE_ZED,
- SUBMVREF_LEFT_ABOVE_SAME,
- SUBMVREF_LEFT_ABOVE_ZED
-} sumvfref_t;
-
-typedef int vp8_mbsplit[16];
-
-#define VP8_NUMMBSPLITS 4
-
-extern const vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS];
-
-extern const int vp8_mbsplit_count [VP8_NUMMBSPLITS]; /* # of subsets */
-
-extern const vp8_prob vp8_mbsplit_probs [VP8_NUMMBSPLITS-1];
-
-extern int vp8_mv_cont(const int_mv *l, const int_mv *a);
-#define SUBMVREF_COUNT 5
-extern const vp8_prob vp8_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS-1];
-
-
-extern const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES];
-
-
-extern const vp8_tree_index vp8_bmode_tree[];
-
-extern const vp8_tree_index vp8_ymode_tree[];
-extern const vp8_tree_index vp8_kf_ymode_tree[];
-extern const vp8_tree_index vp8_uv_mode_tree[];
-
-extern const vp8_tree_index vp8_mbsplit_tree[];
-extern const vp8_tree_index vp8_mv_ref_tree[];
-extern const vp8_tree_index vp8_sub_mv_ref_tree[];
-
-extern const struct vp8_token_struct vp8_bmode_encodings[VP8_BINTRAMODES];
-extern const struct vp8_token_struct vp8_ymode_encodings[VP8_YMODES];
-extern const struct vp8_token_struct vp8_kf_ymode_encodings[VP8_YMODES];
-extern const struct vp8_token_struct vp8_uv_mode_encodings[VP8_UV_MODES];
-extern const struct vp8_token_struct vp8_mbsplit_encodings[VP8_NUMMBSPLITS];
-
-/* Inter mode values do not start at zero */
-
-extern const struct vp8_token_struct vp8_mv_ref_encoding_array[VP8_MVREFS];
-extern const struct vp8_token_struct vp8_sub_mv_ref_encoding_array[VP8_SUBMVREFS];
-
-extern const vp8_tree_index vp8_small_mvtree[];
-
-extern const struct vp8_token_struct vp8_small_mvencodings[8];
-
-/* Key frame default mode probs */
-extern const vp8_prob vp8_kf_bmode_prob[VP8_BINTRAMODES][VP8_BINTRAMODES]
-[VP8_BINTRAMODES-1];
-extern const vp8_prob vp8_kf_uv_mode_prob[VP8_UV_MODES-1];
-extern const vp8_prob vp8_kf_ymode_prob[VP8_YMODES-1];
-
-void vp8_init_mbmode_probs(VP8_COMMON *x);
-void vp8_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES-1]);
-void vp8_kf_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_ENTROPYMODE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/entropymv.c b/videocodec/libvpx_internal/libvpx/vp8/common/entropymv.c
deleted file mode 100644
index e5df1f0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/entropymv.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "entropymv.h"
-
-const MV_CONTEXT vp8_mv_update_probs[2] =
-{
- {{
- 237,
- 246,
- 253, 253, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 250, 250, 252, 254, 254
- }},
- {{
- 231,
- 243,
- 245, 253, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 251, 251, 254, 254, 254
- }}
-};
-const MV_CONTEXT vp8_default_mv_context[2] =
-{
- {{
- /* row */
- 162, /* is short */
- 128, /* sign */
- 225, 146, 172, 147, 214, 39, 156, /* short tree */
- 128, 129, 132, 75, 145, 178, 206, 239, 254, 254 /* long bits */
- }},
-
-
-
- {{
- /* same for column */
- 164, /* is short */
- 128,
- 204, 170, 119, 235, 140, 230, 228,
- 128, 130, 130, 74, 148, 180, 203, 236, 254, 254 /* long bits */
-
- }}
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/entropymv.h b/videocodec/libvpx_internal/libvpx/vp8/common/entropymv.h
deleted file mode 100644
index 42840d5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/entropymv.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ENTROPYMV_H_
-#define VP8_COMMON_ENTROPYMV_H_
-
-#include "treecoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum
-{
- mv_max = 1023, /* max absolute value of a MV component */
- MVvals = (2 * mv_max) + 1, /* # possible values "" */
- mvfp_max = 255, /* max absolute value of a full pixel MV component */
- MVfpvals = (2 * mvfp_max) +1, /* # possible full pixel MV values */
-
- mvlong_width = 10, /* Large MVs have 9 bit magnitudes */
- mvnum_short = 8, /* magnitudes 0 through 7 */
-
- /* probability offsets for coding each MV component */
-
- mvpis_short = 0, /* short (<= 7) vs long (>= 8) */
- MVPsign, /* sign for non-zero */
- MVPshort, /* 8 short values = 7-position tree */
-
- MVPbits = MVPshort + mvnum_short - 1, /* mvlong_width long value bits */
- MVPcount = MVPbits + mvlong_width /* (with independent probabilities) */
-};
-
-typedef struct mv_context
-{
- vp8_prob prob[MVPcount]; /* often come in row, col pairs */
-} MV_CONTEXT;
-
-extern const MV_CONTEXT vp8_mv_update_probs[2], vp8_default_mv_context[2];
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_ENTROPYMV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/extend.c b/videocodec/libvpx_internal/libvpx/vp8/common/extend.c
deleted file mode 100644
index c9bdd21..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/extend.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "extend.h"
-#include "vpx_mem/vpx_mem.h"
-
-
-static void copy_and_extend_plane
-(
- unsigned char *s, /* source */
- int sp, /* source pitch */
- unsigned char *d, /* destination */
- int dp, /* destination pitch */
- int h, /* height */
- int w, /* width */
- int et, /* extend top border */
- int el, /* extend left border */
- int eb, /* extend bottom border */
- int er /* extend right border */
-)
-{
- int i;
- unsigned char *src_ptr1, *src_ptr2;
- unsigned char *dest_ptr1, *dest_ptr2;
- int linesize;
-
- /* copy the left and right most columns out */
- src_ptr1 = s;
- src_ptr2 = s + w - 1;
- dest_ptr1 = d - el;
- dest_ptr2 = d + w;
-
- for (i = 0; i < h; i++)
- {
- vpx_memset(dest_ptr1, src_ptr1[0], el);
- vpx_memcpy(dest_ptr1 + el, src_ptr1, w);
- vpx_memset(dest_ptr2, src_ptr2[0], er);
- src_ptr1 += sp;
- src_ptr2 += sp;
- dest_ptr1 += dp;
- dest_ptr2 += dp;
- }
-
- /* Now copy the top and bottom lines into each line of the respective
- * borders
- */
- src_ptr1 = d - el;
- src_ptr2 = d + dp * (h - 1) - el;
- dest_ptr1 = d + dp * (-et) - el;
- dest_ptr2 = d + dp * (h) - el;
- linesize = el + er + w;
-
- for (i = 0; i < et; i++)
- {
- vpx_memcpy(dest_ptr1, src_ptr1, linesize);
- dest_ptr1 += dp;
- }
-
- for (i = 0; i < eb; i++)
- {
- vpx_memcpy(dest_ptr2, src_ptr2, linesize);
- dest_ptr2 += dp;
- }
-}
-
-
-void vp8_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst)
-{
- int et = dst->border;
- int el = dst->border;
- int eb = dst->border + dst->y_height - src->y_height;
- int er = dst->border + dst->y_width - src->y_width;
-
- copy_and_extend_plane(src->y_buffer, src->y_stride,
- dst->y_buffer, dst->y_stride,
- src->y_height, src->y_width,
- et, el, eb, er);
-
- et = dst->border >> 1;
- el = dst->border >> 1;
- eb = (dst->border >> 1) + dst->uv_height - src->uv_height;
- er = (dst->border >> 1) + dst->uv_width - src->uv_width;
-
- copy_and_extend_plane(src->u_buffer, src->uv_stride,
- dst->u_buffer, dst->uv_stride,
- src->uv_height, src->uv_width,
- et, el, eb, er);
-
- copy_and_extend_plane(src->v_buffer, src->uv_stride,
- dst->v_buffer, dst->uv_stride,
- src->uv_height, src->uv_width,
- et, el, eb, er);
-}
-
-
-void vp8_copy_and_extend_frame_with_rect(YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst,
- int srcy, int srcx,
- int srch, int srcw)
-{
- int et = dst->border;
- int el = dst->border;
- int eb = dst->border + dst->y_height - src->y_height;
- int er = dst->border + dst->y_width - src->y_width;
- int src_y_offset = srcy * src->y_stride + srcx;
- int dst_y_offset = srcy * dst->y_stride + srcx;
- int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1);
- int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1);
-
- /* If the side is not touching the bounder then don't extend. */
- if (srcy)
- et = 0;
- if (srcx)
- el = 0;
- if (srcy + srch != src->y_height)
- eb = 0;
- if (srcx + srcw != src->y_width)
- er = 0;
-
- copy_and_extend_plane(src->y_buffer + src_y_offset,
- src->y_stride,
- dst->y_buffer + dst_y_offset,
- dst->y_stride,
- srch, srcw,
- et, el, eb, er);
-
- et = (et + 1) >> 1;
- el = (el + 1) >> 1;
- eb = (eb + 1) >> 1;
- er = (er + 1) >> 1;
- srch = (srch + 1) >> 1;
- srcw = (srcw + 1) >> 1;
-
- copy_and_extend_plane(src->u_buffer + src_uv_offset,
- src->uv_stride,
- dst->u_buffer + dst_uv_offset,
- dst->uv_stride,
- srch, srcw,
- et, el, eb, er);
-
- copy_and_extend_plane(src->v_buffer + src_uv_offset,
- src->uv_stride,
- dst->v_buffer + dst_uv_offset,
- dst->uv_stride,
- srch, srcw,
- et, el, eb, er);
-}
-
-
-/* note the extension is only for the last row, for intra prediction purpose */
-void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf,
- unsigned char *YPtr,
- unsigned char *UPtr,
- unsigned char *VPtr)
-{
- int i;
-
- YPtr += ybf->y_stride * 14;
- UPtr += ybf->uv_stride * 6;
- VPtr += ybf->uv_stride * 6;
-
- for (i = 0; i < 4; i++)
- {
- YPtr[i] = YPtr[-1];
- UPtr[i] = UPtr[-1];
- VPtr[i] = VPtr[-1];
- }
-
- YPtr += ybf->y_stride;
- UPtr += ybf->uv_stride;
- VPtr += ybf->uv_stride;
-
- for (i = 0; i < 4; i++)
- {
- YPtr[i] = YPtr[-1];
- UPtr[i] = UPtr[-1];
- VPtr[i] = VPtr[-1];
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/extend.h b/videocodec/libvpx_internal/libvpx/vp8/common/extend.h
deleted file mode 100644
index 068f4ac..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/extend.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_EXTEND_H_
-#define VP8_COMMON_EXTEND_H_
-
-#include "vpx_scale/yv12config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr, unsigned char *UPtr, unsigned char *VPtr);
-void vp8_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst);
-void vp8_copy_and_extend_frame_with_rect(YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst,
- int srcy, int srcx,
- int srch, int srcw);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_EXTEND_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/filter.c b/videocodec/libvpx_internal/libvpx/vp8/common/filter.c
deleted file mode 100644
index 25266f8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/filter.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "filter.h"
-
-DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]) =
-{
- { 128, 0 },
- { 112, 16 },
- { 96, 32 },
- { 80, 48 },
- { 64, 64 },
- { 48, 80 },
- { 32, 96 },
- { 16, 112 }
-};
-
-DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][6]) =
-{
-
- { 0, 0, 128, 0, 0, 0 }, /* note that 1/8 pel positions are just as per alpha -0.5 bicubic */
- { 0, -6, 123, 12, -1, 0 },
- { 2, -11, 108, 36, -8, 1 }, /* New 1/4 pel 6 tap filter */
- { 0, -9, 93, 50, -6, 0 },
- { 3, -16, 77, 77, -16, 3 }, /* New 1/2 pel 6 tap filter */
- { 0, -6, 50, 93, -9, 0 },
- { 1, -8, 36, 108, -11, 2 }, /* New 1/4 pel 6 tap filter */
- { 0, -1, 12, 123, -6, 0 },
-};
-
-static void filter_block2d_first_pass
-(
- unsigned char *src_ptr,
- int *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-)
-{
- unsigned int i, j;
- int Temp;
-
- for (i = 0; i < output_height; i++)
- {
- for (j = 0; j < output_width; j++)
- {
- Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp8_filter[0]) +
- ((int)src_ptr[-1 * (int)pixel_step] * vp8_filter[1]) +
- ((int)src_ptr[0] * vp8_filter[2]) +
- ((int)src_ptr[pixel_step] * vp8_filter[3]) +
- ((int)src_ptr[2*pixel_step] * vp8_filter[4]) +
- ((int)src_ptr[3*pixel_step] * vp8_filter[5]) +
- (VP8_FILTER_WEIGHT >> 1); /* Rounding */
-
- /* Normalize back to 0-255 */
- Temp = Temp >> VP8_FILTER_SHIFT;
-
- if (Temp < 0)
- Temp = 0;
- else if (Temp > 255)
- Temp = 255;
-
- output_ptr[j] = Temp;
- src_ptr++;
- }
-
- /* Next row... */
- src_ptr += src_pixels_per_line - output_width;
- output_ptr += output_width;
- }
-}
-
-static void filter_block2d_second_pass
-(
- int *src_ptr,
- unsigned char *output_ptr,
- int output_pitch,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-)
-{
- unsigned int i, j;
- int Temp;
-
- for (i = 0; i < output_height; i++)
- {
- for (j = 0; j < output_width; j++)
- {
- /* Apply filter */
- Temp = ((int)src_ptr[-2 * (int)pixel_step] * vp8_filter[0]) +
- ((int)src_ptr[-1 * (int)pixel_step] * vp8_filter[1]) +
- ((int)src_ptr[0] * vp8_filter[2]) +
- ((int)src_ptr[pixel_step] * vp8_filter[3]) +
- ((int)src_ptr[2*pixel_step] * vp8_filter[4]) +
- ((int)src_ptr[3*pixel_step] * vp8_filter[5]) +
- (VP8_FILTER_WEIGHT >> 1); /* Rounding */
-
- /* Normalize back to 0-255 */
- Temp = Temp >> VP8_FILTER_SHIFT;
-
- if (Temp < 0)
- Temp = 0;
- else if (Temp > 255)
- Temp = 255;
-
- output_ptr[j] = (unsigned char)Temp;
- src_ptr++;
- }
-
- /* Start next row */
- src_ptr += src_pixels_per_line - output_width;
- output_ptr += output_pitch;
- }
-}
-
-
-static void filter_block2d
-(
- unsigned char *src_ptr,
- unsigned char *output_ptr,
- unsigned int src_pixels_per_line,
- int output_pitch,
- const short *HFilter,
- const short *VFilter
-)
-{
- int FData[9*4]; /* Temp data buffer used in filtering */
-
- /* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 4, HFilter);
-
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 8, output_ptr, output_pitch, 4, 4, 4, 4, VFilter);
-}
-
-
-void vp8_sixtap_predict4x4_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- filter_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter);
-}
-void vp8_sixtap_predict8x8_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
- int FData[13*16]; /* Temp data buffer used in filtering */
-
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- /* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 13, 8, HFilter);
-
-
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 16, dst_ptr, dst_pitch, 8, 8, 8, 8, VFilter);
-
-}
-
-void vp8_sixtap_predict8x4_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
- int FData[13*16]; /* Temp data buffer used in filtering */
-
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- /* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 8, HFilter);
-
-
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 16, dst_ptr, dst_pitch, 8, 8, 4, 8, VFilter);
-
-}
-
-void vp8_sixtap_predict16x16_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
- int FData[21*24]; /* Temp data buffer used in filtering */
-
-
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- /* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 21, 16, HFilter);
-
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 32, dst_ptr, dst_pitch, 16, 16, 16, 16, VFilter);
-
-}
-
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_first_pass
- *
- * INPUTS : UINT8 *src_ptr : Pointer to source block.
- * UINT32 src_stride : Stride of source block.
- * UINT32 height : Block height.
- * UINT32 width : Block width.
- * INT32 *vp8_filter : Array of 2 bi-linear filter taps.
- *
- * OUTPUTS : INT32 *dst_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block
- * in the horizontal direction to produce the filtered output
- * block. Used to implement first-pass of 2-D separable filter.
- *
- * SPECIAL NOTES : Produces INT32 output to retain precision for next pass.
- * Two filter taps should sum to VP8_FILTER_WEIGHT.
- *
- ****************************************************************************/
-static void filter_block2d_bil_first_pass
-(
- unsigned char *src_ptr,
- unsigned short *dst_ptr,
- unsigned int src_stride,
- unsigned int height,
- unsigned int width,
- const short *vp8_filter
-)
-{
- unsigned int i, j;
-
- for (i = 0; i < height; i++)
- {
- for (j = 0; j < width; j++)
- {
- /* Apply bilinear filter */
- dst_ptr[j] = (((int)src_ptr[0] * vp8_filter[0]) +
- ((int)src_ptr[1] * vp8_filter[1]) +
- (VP8_FILTER_WEIGHT / 2)) >> VP8_FILTER_SHIFT;
- src_ptr++;
- }
-
- /* Next row... */
- src_ptr += src_stride - width;
- dst_ptr += width;
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_second_pass
- *
- * INPUTS : INT32 *src_ptr : Pointer to source block.
- * UINT32 dst_pitch : Destination block pitch.
- * UINT32 height : Block height.
- * UINT32 width : Block width.
- * INT32 *vp8_filter : Array of 2 bi-linear filter taps.
- *
- * OUTPUTS : UINT16 *dst_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block
- * in the vertical direction to produce the filtered output
- * block. Used to implement second-pass of 2-D separable filter.
- *
- * SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_first_pass.
- * Two filter taps should sum to VP8_FILTER_WEIGHT.
- *
- ****************************************************************************/
-static void filter_block2d_bil_second_pass
-(
- unsigned short *src_ptr,
- unsigned char *dst_ptr,
- int dst_pitch,
- unsigned int height,
- unsigned int width,
- const short *vp8_filter
-)
-{
- unsigned int i, j;
- int Temp;
-
- for (i = 0; i < height; i++)
- {
- for (j = 0; j < width; j++)
- {
- /* Apply filter */
- Temp = ((int)src_ptr[0] * vp8_filter[0]) +
- ((int)src_ptr[width] * vp8_filter[1]) +
- (VP8_FILTER_WEIGHT / 2);
- dst_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
- src_ptr++;
- }
-
- /* Next row... */
- dst_ptr += dst_pitch;
- }
-}
-
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil
- *
- * INPUTS : UINT8 *src_ptr : Pointer to source block.
- * UINT32 src_pitch : Stride of source block.
- * UINT32 dst_pitch : Stride of destination block.
- * INT32 *HFilter : Array of 2 horizontal filter taps.
- * INT32 *VFilter : Array of 2 vertical filter taps.
- * INT32 Width : Block width
- * INT32 Height : Block height
- *
- * OUTPUTS : UINT16 *dst_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : 2-D filters an input block by applying a 2-tap
- * bi-linear filter horizontally followed by a 2-tap
- * bi-linear filter vertically on the result.
- *
- * SPECIAL NOTES : The largest block size can be handled here is 16x16
- *
- ****************************************************************************/
-static void filter_block2d_bil
-(
- unsigned char *src_ptr,
- unsigned char *dst_ptr,
- unsigned int src_pitch,
- unsigned int dst_pitch,
- const short *HFilter,
- const short *VFilter,
- int Width,
- int Height
-)
-{
-
- unsigned short FData[17*16]; /* Temp data buffer used in filtering */
-
- /* First filter 1-D horizontally... */
- filter_block2d_bil_first_pass(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
-
- /* then 1-D vertically... */
- filter_block2d_bil_second_pass(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
-}
-
-
-void vp8_bilinear_predict4x4_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-#if 0
- {
- int i;
- unsigned char temp1[16];
- unsigned char temp2[16];
-
- bilinear_predict4x4_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, temp1, 4);
- filter_block2d_bil(src_ptr, temp2, src_pixels_per_line, 4, HFilter, VFilter, 4, 4);
-
- for (i = 0; i < 16; i++)
- {
- if (temp1[i] != temp2[i])
- {
- bilinear_predict4x4_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, temp1, 4);
- filter_block2d_bil(src_ptr, temp2, src_pixels_per_line, 4, HFilter, VFilter, 4, 4);
- }
- }
- }
-#endif
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
-
-}
-
-void vp8_bilinear_predict8x8_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
-
-}
-
-void vp8_bilinear_predict8x4_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
-
-}
-
-void vp8_bilinear_predict16x16_c
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/filter.h b/videocodec/libvpx_internal/libvpx/vp8/common/filter.h
deleted file mode 100644
index cfba775..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/filter.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_FILTER_H_
-#define VP8_COMMON_FILTER_H_
-
-#include "vpx_ports/mem.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BLOCK_HEIGHT_WIDTH 4
-#define VP8_FILTER_WEIGHT 128
-#define VP8_FILTER_SHIFT 7
-
-extern DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]);
-extern DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][6]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_FILTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.c b/videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.c
deleted file mode 100644
index e8ee40f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "findnearmv.h"
-
-const unsigned char vp8_mbsplit_offset[4][16] = {
- { 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
-};
-
-/* Predict motion vectors using those from already-decoded nearby blocks.
- Note that we only consider one 4x4 subblock from each candidate 16x16
- macroblock. */
-void vp8_find_near_mvs
-(
- MACROBLOCKD *xd,
- const MODE_INFO *here,
- int_mv *nearest,
- int_mv *nearby,
- int_mv *best_mv,
- int cnt[4],
- int refframe,
- int *ref_frame_sign_bias
-)
-{
- const MODE_INFO *above = here - xd->mode_info_stride;
- const MODE_INFO *left = here - 1;
- const MODE_INFO *aboveleft = above - 1;
- int_mv near_mvs[4];
- int_mv *mv = near_mvs;
- int *cntx = cnt;
- enum {CNT_INTRA, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV};
-
- /* Zero accumulators */
- mv[0].as_int = mv[1].as_int = mv[2].as_int = 0;
- cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0;
-
- /* Process above */
- if (above->mbmi.ref_frame != INTRA_FRAME)
- {
- if (above->mbmi.mv.as_int)
- {
- (++mv)->as_int = above->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame], refframe, mv, ref_frame_sign_bias);
- ++cntx;
- }
-
- *cntx += 2;
- }
-
- /* Process left */
- if (left->mbmi.ref_frame != INTRA_FRAME)
- {
- if (left->mbmi.mv.as_int)
- {
- int_mv this_mv;
-
- this_mv.as_int = left->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame], refframe, &this_mv, ref_frame_sign_bias);
-
- if (this_mv.as_int != mv->as_int)
- {
- (++mv)->as_int = this_mv.as_int;
- ++cntx;
- }
-
- *cntx += 2;
- }
- else
- cnt[CNT_INTRA] += 2;
- }
-
- /* Process above left */
- if (aboveleft->mbmi.ref_frame != INTRA_FRAME)
- {
- if (aboveleft->mbmi.mv.as_int)
- {
- int_mv this_mv;
-
- this_mv.as_int = aboveleft->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[aboveleft->mbmi.ref_frame], refframe, &this_mv, ref_frame_sign_bias);
-
- if (this_mv.as_int != mv->as_int)
- {
- (++mv)->as_int = this_mv.as_int;
- ++cntx;
- }
-
- *cntx += 1;
- }
- else
- cnt[CNT_INTRA] += 1;
- }
-
- /* If we have three distinct MV's ... */
- if (cnt[CNT_SPLITMV])
- {
- /* See if above-left MV can be merged with NEAREST */
- if (mv->as_int == near_mvs[CNT_NEAREST].as_int)
- cnt[CNT_NEAREST] += 1;
- }
-
- cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV)
- + (left->mbmi.mode == SPLITMV)) * 2
- + (aboveleft->mbmi.mode == SPLITMV);
-
- /* Swap near and nearest if necessary */
- if (cnt[CNT_NEAR] > cnt[CNT_NEAREST])
- {
- int tmp;
- tmp = cnt[CNT_NEAREST];
- cnt[CNT_NEAREST] = cnt[CNT_NEAR];
- cnt[CNT_NEAR] = tmp;
- tmp = near_mvs[CNT_NEAREST].as_int;
- near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
- near_mvs[CNT_NEAR].as_int = tmp;
- }
-
- /* Use near_mvs[0] to store the "best" MV */
- if (cnt[CNT_NEAREST] >= cnt[CNT_INTRA])
- near_mvs[CNT_INTRA] = near_mvs[CNT_NEAREST];
-
- /* Set up return values */
- best_mv->as_int = near_mvs[0].as_int;
- nearest->as_int = near_mvs[CNT_NEAREST].as_int;
- nearby->as_int = near_mvs[CNT_NEAR].as_int;
-}
-
-
-static void invert_and_clamp_mvs(int_mv *inv, int_mv *src, MACROBLOCKD *xd)
-{
- inv->as_mv.row = src->as_mv.row * -1;
- inv->as_mv.col = src->as_mv.col * -1;
- vp8_clamp_mv2(inv, xd);
- vp8_clamp_mv2(src, xd);
-}
-
-
-int vp8_find_near_mvs_bias
-(
- MACROBLOCKD *xd,
- const MODE_INFO *here,
- int_mv mode_mv_sb[2][MB_MODE_COUNT],
- int_mv best_mv_sb[2],
- int cnt[4],
- int refframe,
- int *ref_frame_sign_bias
-)
-{
- int sign_bias = ref_frame_sign_bias[refframe];
-
- vp8_find_near_mvs(xd,
- here,
- &mode_mv_sb[sign_bias][NEARESTMV],
- &mode_mv_sb[sign_bias][NEARMV],
- &best_mv_sb[sign_bias],
- cnt,
- refframe,
- ref_frame_sign_bias);
-
- invert_and_clamp_mvs(&mode_mv_sb[!sign_bias][NEARESTMV],
- &mode_mv_sb[sign_bias][NEARESTMV], xd);
- invert_and_clamp_mvs(&mode_mv_sb[!sign_bias][NEARMV],
- &mode_mv_sb[sign_bias][NEARMV], xd);
- invert_and_clamp_mvs(&best_mv_sb[!sign_bias],
- &best_mv_sb[sign_bias], xd);
-
- return sign_bias;
-}
-
-
-vp8_prob *vp8_mv_ref_probs(
- vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
-)
-{
- p[0] = vp8_mode_contexts [near_mv_ref_ct[0]] [0];
- p[1] = vp8_mode_contexts [near_mv_ref_ct[1]] [1];
- p[2] = vp8_mode_contexts [near_mv_ref_ct[2]] [2];
- p[3] = vp8_mode_contexts [near_mv_ref_ct[3]] [3];
- /*p[3] = vp8_mode_contexts [near_mv_ref_ct[1] + near_mv_ref_ct[2] + near_mv_ref_ct[3]] [3];*/
- return p;
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.h b/videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.h
deleted file mode 100644
index 3c8c050..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/findnearmv.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_FINDNEARMV_H_
-#define VP8_COMMON_FINDNEARMV_H_
-
-#include "mv.h"
-#include "blockd.h"
-#include "modecont.h"
-#include "treecoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp,
- const int *ref_frame_sign_bias)
-{
- if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe])
- {
- mvp->as_mv.row *= -1;
- mvp->as_mv.col *= -1;
- }
-}
-
-#define LEFT_TOP_MARGIN (16 << 3)
-#define RIGHT_BOTTOM_MARGIN (16 << 3)
-static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd)
-{
- if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
- mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
- else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
- mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
-
- if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
- mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
- else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
- mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
-}
-
-static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge,
- int mb_to_top_edge, int mb_to_bottom_edge)
-{
- mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
- mb_to_left_edge : mv->as_mv.col;
- mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
- mb_to_right_edge : mv->as_mv.col;
- mv->as_mv.row = (mv->as_mv.row < mb_to_top_edge) ?
- mb_to_top_edge : mv->as_mv.row;
- mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ?
- mb_to_bottom_edge : mv->as_mv.row;
-}
-static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge,
- int mb_to_right_edge, int mb_to_top_edge,
- int mb_to_bottom_edge)
-{
- unsigned int need_to_clamp;
- need_to_clamp = (mv->as_mv.col < mb_to_left_edge);
- need_to_clamp |= (mv->as_mv.col > mb_to_right_edge);
- need_to_clamp |= (mv->as_mv.row < mb_to_top_edge);
- need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge);
- return need_to_clamp;
-}
-
-void vp8_find_near_mvs
-(
- MACROBLOCKD *xd,
- const MODE_INFO *here,
- int_mv *nearest, int_mv *nearby, int_mv *best,
- int near_mv_ref_cts[4],
- int refframe,
- int *ref_frame_sign_bias
-);
-
-
-int vp8_find_near_mvs_bias
-(
- MACROBLOCKD *xd,
- const MODE_INFO *here,
- int_mv mode_mv_sb[2][MB_MODE_COUNT],
- int_mv best_mv_sb[2],
- int cnt[4],
- int refframe,
- int *ref_frame_sign_bias
-);
-
-
-vp8_prob *vp8_mv_ref_probs(
- vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
-);
-
-extern const unsigned char vp8_mbsplit_offset[4][16];
-
-
-static int left_block_mv(const MODE_INFO *cur_mb, int b)
-{
- if (!(b & 3))
- {
- /* On L edge, get from MB to left of us */
- --cur_mb;
-
- if(cur_mb->mbmi.mode != SPLITMV)
- return cur_mb->mbmi.mv.as_int;
- b += 4;
- }
-
- return (cur_mb->bmi + b - 1)->mv.as_int;
-}
-
-static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride)
-{
- if (!(b >> 2))
- {
- /* On top edge, get from MB above us */
- cur_mb -= mi_stride;
-
- if(cur_mb->mbmi.mode != SPLITMV)
- return cur_mb->mbmi.mv.as_int;
- b += 16;
- }
-
- return (cur_mb->bmi + (b - 4))->mv.as_int;
-}
-static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b)
-{
- if (!(b & 3))
- {
- /* On L edge, get from MB to left of us */
- --cur_mb;
- switch (cur_mb->mbmi.mode)
- {
- case B_PRED:
- return (cur_mb->bmi + b + 3)->as_mode;
- case DC_PRED:
- return B_DC_PRED;
- case V_PRED:
- return B_VE_PRED;
- case H_PRED:
- return B_HE_PRED;
- case TM_PRED:
- return B_TM_PRED;
- default:
- return B_DC_PRED;
- }
- }
-
- return (cur_mb->bmi + b - 1)->as_mode;
-}
-
-static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, int b, int mi_stride)
-{
- if (!(b >> 2))
- {
- /* On top edge, get from MB above us */
- cur_mb -= mi_stride;
-
- switch (cur_mb->mbmi.mode)
- {
- case B_PRED:
- return (cur_mb->bmi + b + 12)->as_mode;
- case DC_PRED:
- return B_DC_PRED;
- case V_PRED:
- return B_VE_PRED;
- case H_PRED:
- return B_HE_PRED;
- case TM_PRED:
- return B_TM_PRED;
- default:
- return B_DC_PRED;
- }
- }
-
- return (cur_mb->bmi + b - 4)->as_mode;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_FINDNEARMV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/generic/systemdependent.c b/videocodec/libvpx_internal/libvpx/vp8/common/generic/systemdependent.c
deleted file mode 100644
index 9d88d8f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/generic/systemdependent.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#if ARCH_ARM
-#include "vpx_ports/arm.h"
-#elif ARCH_X86_32 || ARCH_X86_64
-#include "vpx_ports/x86.h"
-#endif
-#include "vp8/common/onyxc_int.h"
-
-#if CONFIG_MULTITHREAD
-#if HAVE_UNISTD_H && !defined(__OS2__)
-#include <unistd.h>
-#elif defined(_WIN32)
-#include <windows.h>
-typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
-#elif defined(__OS2__)
-#define INCL_DOS
-#define INCL_DOSSPINLOCK
-#include <os2.h>
-#endif
-#endif
-
-#if CONFIG_MULTITHREAD
-static int get_cpu_count()
-{
- int core_count = 16;
-
-#if HAVE_UNISTD_H && !defined(__OS2__)
-#if defined(_SC_NPROCESSORS_ONLN)
- core_count = sysconf(_SC_NPROCESSORS_ONLN);
-#elif defined(_SC_NPROC_ONLN)
- core_count = sysconf(_SC_NPROC_ONLN);
-#endif
-#elif defined(_WIN32)
- {
- PGNSI pGNSI;
- SYSTEM_INFO sysinfo;
-
- /* Call GetNativeSystemInfo if supported or
- * GetSystemInfo otherwise. */
-
- pGNSI = (PGNSI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo");
- if (pGNSI != NULL)
- pGNSI(&sysinfo);
- else
- GetSystemInfo(&sysinfo);
-
- core_count = sysinfo.dwNumberOfProcessors;
- }
-#elif defined(__OS2__)
- {
- ULONG proc_id;
- ULONG status;
-
- core_count = 0;
- for (proc_id = 1; ; proc_id++)
- {
- if (DosGetProcessorStatus(proc_id, &status))
- break;
-
- if (status == PROC_ONLINE)
- core_count++;
- }
- }
-#else
- /* other platforms */
-#endif
-
- return core_count > 0 ? core_count : 1;
-}
-#endif
-
-void vp8_clear_system_state_c() {};
-
-void vp8_machine_specific_config(VP8_COMMON *ctx)
-{
-#if CONFIG_MULTITHREAD
- ctx->processor_core_count = get_cpu_count();
-#endif /* CONFIG_MULTITHREAD */
-
-#if ARCH_ARM
- ctx->cpu_caps = arm_cpu_caps();
-#elif ARCH_X86_32 || ARCH_X86_64
- ctx->cpu_caps = x86_simd_caps();
-#endif
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/header.h b/videocodec/libvpx_internal/libvpx/vp8/common/header.h
deleted file mode 100644
index e27bca1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/header.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_HEADER_H_
-#define VP8_COMMON_HEADER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 24 bits total */
-typedef struct
-{
- unsigned int type: 1;
- unsigned int version: 3;
- unsigned int show_frame: 1;
-
- /* Allow 2^20 bytes = 8 megabits for first partition */
-
- unsigned int first_partition_length_in_bytes: 19;
-
-#ifdef PACKET_TESTING
- unsigned int frame_number;
- unsigned int update_gold: 1;
- unsigned int uses_gold: 1;
- unsigned int update_last: 1;
- unsigned int uses_last: 1;
-#endif
-
-} VP8_HEADER;
-
-#ifdef PACKET_TESTING
-#define VP8_HEADER_SIZE 8
-#else
-#define VP8_HEADER_SIZE 3
-#endif
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_HEADER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/idct_blk.c b/videocodec/libvpx_internal/libvpx/vp8/common/idct_blk.c
deleted file mode 100644
index 65d5002..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/idct_blk.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_mem/vpx_mem.h"
-
-void vp8_dequant_idct_add_c(short *input, short *dq,
- unsigned char *dest, int stride);
-void vp8_dc_only_idct_add_c(short input_dc, unsigned char * pred,
- int pred_stride, unsigned char *dst_ptr,
- int dst_stride);
-
-void vp8_dequant_idct_add_y_block_c
- (short *q, short *dq,
- unsigned char *dst, int stride, char *eobs)
-{
- int i, j;
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- if (*eobs++ > 1)
- vp8_dequant_idct_add_c (q, dq, dst, stride);
- else
- {
- vp8_dc_only_idct_add_c (q[0]*dq[0], dst, stride, dst, stride);
- vpx_memset(q, 0, 2 * sizeof(q[0]));
- }
-
- q += 16;
- dst += 4;
- }
-
- dst += 4*stride - 16;
- }
-}
-
-void vp8_dequant_idct_add_uv_block_c
- (short *q, short *dq,
- unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
-{
- int i, j;
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- if (*eobs++ > 1)
- vp8_dequant_idct_add_c (q, dq, dstu, stride);
- else
- {
- vp8_dc_only_idct_add_c (q[0]*dq[0], dstu, stride, dstu, stride);
- vpx_memset(q, 0, 2 * sizeof(q[0]));
- }
-
- q += 16;
- dstu += 4;
- }
-
- dstu += 4*stride - 8;
- }
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- if (*eobs++ > 1)
- vp8_dequant_idct_add_c (q, dq, dstv, stride);
- else
- {
- vp8_dc_only_idct_add_c (q[0]*dq[0], dstv, stride, dstv, stride);
- vpx_memset(q, 0, 2 * sizeof(q[0]));
- }
-
- q += 16;
- dstv += 4;
- }
-
- dstv += 4*stride - 8;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/idctllm.c b/videocodec/libvpx_internal/libvpx/vp8/common/idctllm.c
deleted file mode 100644
index 47af52f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/idctllm.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
- * Notes:
- *
- * This implementation makes use of 16 bit fixed point verio of two multiply
- * constants:
- * 1. sqrt(2) * cos (pi/8)
- * 2. sqrt(2) * sin (pi/8)
- * Becuase the first constant is bigger than 1, to maintain the same 16 bit
- * fixed point precision as the second one, we use a trick of
- * x * a = x + x*(a-1)
- * so
- * x * sqrt(2) * cos (pi/8) = x + x * (sqrt(2) *cos(pi/8)-1).
- **************************************************************************/
-static const int cospi8sqrt2minus1 = 20091;
-static const int sinpi8sqrt2 = 35468;
-
-void vp8_short_idct4x4llm_c(short *input, unsigned char *pred_ptr,
- int pred_stride, unsigned char *dst_ptr,
- int dst_stride)
-{
- int i;
- int r, c;
- int a1, b1, c1, d1;
- short output[16];
- short *ip = input;
- short *op = output;
- int temp1, temp2;
- int shortpitch = 4;
-
- for (i = 0; i < 4; i++)
- {
- a1 = ip[0] + ip[8];
- b1 = ip[0] - ip[8];
-
- temp1 = (ip[4] * sinpi8sqrt2) >> 16;
- temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1) >> 16);
- c1 = temp1 - temp2;
-
- temp1 = ip[4] + ((ip[4] * cospi8sqrt2minus1) >> 16);
- temp2 = (ip[12] * sinpi8sqrt2) >> 16;
- d1 = temp1 + temp2;
-
- op[shortpitch*0] = a1 + d1;
- op[shortpitch*3] = a1 - d1;
-
- op[shortpitch*1] = b1 + c1;
- op[shortpitch*2] = b1 - c1;
-
- ip++;
- op++;
- }
-
- ip = output;
- op = output;
-
- for (i = 0; i < 4; i++)
- {
- a1 = ip[0] + ip[2];
- b1 = ip[0] - ip[2];
-
- temp1 = (ip[1] * sinpi8sqrt2) >> 16;
- temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1) >> 16);
- c1 = temp1 - temp2;
-
- temp1 = ip[1] + ((ip[1] * cospi8sqrt2minus1) >> 16);
- temp2 = (ip[3] * sinpi8sqrt2) >> 16;
- d1 = temp1 + temp2;
-
-
- op[0] = (a1 + d1 + 4) >> 3;
- op[3] = (a1 - d1 + 4) >> 3;
-
- op[1] = (b1 + c1 + 4) >> 3;
- op[2] = (b1 - c1 + 4) >> 3;
-
- ip += shortpitch;
- op += shortpitch;
- }
-
- ip = output;
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- int a = ip[c] + pred_ptr[c] ;
-
- if (a < 0)
- a = 0;
-
- if (a > 255)
- a = 255;
-
- dst_ptr[c] = (unsigned char) a ;
- }
- ip += 4;
- dst_ptr += dst_stride;
- pred_ptr += pred_stride;
- }
-}
-
-void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr,
- int pred_stride, unsigned char *dst_ptr,
- int dst_stride)
-{
- int a1 = ((input_dc + 4) >> 3);
- int r, c;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- int a = a1 + pred_ptr[c] ;
-
- if (a < 0)
- a = 0;
-
- if (a > 255)
- a = 255;
-
- dst_ptr[c] = (unsigned char) a ;
- }
-
- dst_ptr += dst_stride;
- pred_ptr += pred_stride;
- }
-
-}
-
-void vp8_short_inv_walsh4x4_c(short *input, short *mb_dqcoeff)
-{
- short output[16];
- int i;
- int a1, b1, c1, d1;
- int a2, b2, c2, d2;
- short *ip = input;
- short *op = output;
-
- for (i = 0; i < 4; i++)
- {
- a1 = ip[0] + ip[12];
- b1 = ip[4] + ip[8];
- c1 = ip[4] - ip[8];
- d1 = ip[0] - ip[12];
-
- op[0] = a1 + b1;
- op[4] = c1 + d1;
- op[8] = a1 - b1;
- op[12] = d1 - c1;
- ip++;
- op++;
- }
-
- ip = output;
- op = output;
-
- for (i = 0; i < 4; i++)
- {
- a1 = ip[0] + ip[3];
- b1 = ip[1] + ip[2];
- c1 = ip[1] - ip[2];
- d1 = ip[0] - ip[3];
-
- a2 = a1 + b1;
- b2 = c1 + d1;
- c2 = a1 - b1;
- d2 = d1 - c1;
-
- op[0] = (a2 + 3) >> 3;
- op[1] = (b2 + 3) >> 3;
- op[2] = (c2 + 3) >> 3;
- op[3] = (d2 + 3) >> 3;
-
- ip += 4;
- op += 4;
- }
-
- for(i = 0; i < 16; i++)
- {
- mb_dqcoeff[i * 16] = output[i];
- }
-}
-
-void vp8_short_inv_walsh4x4_1_c(short *input, short *mb_dqcoeff)
-{
- int i;
- int a1;
-
- a1 = ((input[0] + 3) >> 3);
- for(i = 0; i < 16; i++)
- {
- mb_dqcoeff[i * 16] = a1;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/invtrans.h b/videocodec/libvpx_internal/libvpx/vp8/common/invtrans.h
deleted file mode 100644
index affe57e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/invtrans.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_INVTRANS_H_
-#define VP8_COMMON_INVTRANS_H_
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "blockd.h"
-#include "onyxc_int.h"
-
-#if CONFIG_MULTITHREAD
-#include "vpx_mem/vpx_mem.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static void eob_adjust(char *eobs, short *diff)
-{
- /* eob adjust.... the idct can only skip if both the dc and eob are zero */
- int js;
- for(js = 0; js < 16; js++)
- {
- if((eobs[js] == 0) && (diff[0] != 0))
- eobs[js]++;
- diff+=16;
- }
-}
-
-static void vp8_inverse_transform_mby(MACROBLOCKD *xd)
-{
- short *DQC = xd->dequant_y1;
-
- if (xd->mode_info_context->mbmi.mode != SPLITMV)
- {
- /* do 2nd order transform on the dc block */
- if (xd->eobs[24] > 1)
- {
- vp8_short_inv_walsh4x4
- (&xd->block[24].dqcoeff[0], xd->qcoeff);
- }
- else
- {
- vp8_short_inv_walsh4x4_1
- (&xd->block[24].dqcoeff[0], xd->qcoeff);
- }
- eob_adjust(xd->eobs, xd->qcoeff);
-
- DQC = xd->dequant_y1_dc;
- }
- vp8_dequant_idct_add_y_block
- (xd->qcoeff, DQC,
- xd->dst.y_buffer,
- xd->dst.y_stride, xd->eobs);
-}
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_INVTRANS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.c b/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.c
deleted file mode 100644
index 3f3c429..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.c
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "loopfilter.h"
-#include "onyxc_int.h"
-#include "vpx_mem/vpx_mem.h"
-
-typedef unsigned char uc;
-
-static void lf_init_lut(loop_filter_info_n *lfi)
-{
- int filt_lvl;
-
- for (filt_lvl = 0; filt_lvl <= MAX_LOOP_FILTER; filt_lvl++)
- {
- if (filt_lvl >= 40)
- {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 2;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 3;
- }
- else if (filt_lvl >= 20)
- {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 1;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 2;
- }
- else if (filt_lvl >= 15)
- {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 1;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 1;
- }
- else
- {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 0;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 0;
- }
- }
-
- lfi->mode_lf_lut[DC_PRED] = 1;
- lfi->mode_lf_lut[V_PRED] = 1;
- lfi->mode_lf_lut[H_PRED] = 1;
- lfi->mode_lf_lut[TM_PRED] = 1;
- lfi->mode_lf_lut[B_PRED] = 0;
-
- lfi->mode_lf_lut[ZEROMV] = 1;
- lfi->mode_lf_lut[NEARESTMV] = 2;
- lfi->mode_lf_lut[NEARMV] = 2;
- lfi->mode_lf_lut[NEWMV] = 2;
- lfi->mode_lf_lut[SPLITMV] = 3;
-
-}
-
-void vp8_loop_filter_update_sharpness(loop_filter_info_n *lfi,
- int sharpness_lvl)
-{
- int i;
-
- /* For each possible value for the loop filter fill out limits */
- for (i = 0; i <= MAX_LOOP_FILTER; i++)
- {
- int filt_lvl = i;
- int block_inside_limit = 0;
-
- /* Set loop filter paramaeters that control sharpness. */
- block_inside_limit = filt_lvl >> (sharpness_lvl > 0);
- block_inside_limit = block_inside_limit >> (sharpness_lvl > 4);
-
- if (sharpness_lvl > 0)
- {
- if (block_inside_limit > (9 - sharpness_lvl))
- block_inside_limit = (9 - sharpness_lvl);
- }
-
- if (block_inside_limit < 1)
- block_inside_limit = 1;
-
- vpx_memset(lfi->lim[i], block_inside_limit, SIMD_WIDTH);
- vpx_memset(lfi->blim[i], (2 * filt_lvl + block_inside_limit),
- SIMD_WIDTH);
- vpx_memset(lfi->mblim[i], (2 * (filt_lvl + 2) + block_inside_limit),
- SIMD_WIDTH);
- }
-}
-
-void vp8_loop_filter_init(VP8_COMMON *cm)
-{
- loop_filter_info_n *lfi = &cm->lf_info;
- int i;
-
- /* init limits for given sharpness*/
- vp8_loop_filter_update_sharpness(lfi, cm->sharpness_level);
- cm->last_sharpness_level = cm->sharpness_level;
-
- /* init LUT for lvl and hev thr picking */
- lf_init_lut(lfi);
-
- /* init hev threshold const vectors */
- for(i = 0; i < 4 ; i++)
- {
- vpx_memset(lfi->hev_thr[i], i, SIMD_WIDTH);
- }
-}
-
-void vp8_loop_filter_frame_init(VP8_COMMON *cm,
- MACROBLOCKD *mbd,
- int default_filt_lvl)
-{
- int seg, /* segment number */
- ref, /* index in ref_lf_deltas */
- mode; /* index in mode_lf_deltas */
-
- loop_filter_info_n *lfi = &cm->lf_info;
-
- /* update limits if sharpness has changed */
- if(cm->last_sharpness_level != cm->sharpness_level)
- {
- vp8_loop_filter_update_sharpness(lfi, cm->sharpness_level);
- cm->last_sharpness_level = cm->sharpness_level;
- }
-
- for(seg = 0; seg < MAX_MB_SEGMENTS; seg++)
- {
- int lvl_seg = default_filt_lvl;
- int lvl_ref, lvl_mode;
-
- /* Note the baseline filter values for each segment */
- if (mbd->segmentation_enabled)
- {
- /* Abs value */
- if (mbd->mb_segement_abs_delta == SEGMENT_ABSDATA)
- {
- lvl_seg = mbd->segment_feature_data[MB_LVL_ALT_LF][seg];
- }
- else /* Delta Value */
- {
- lvl_seg += mbd->segment_feature_data[MB_LVL_ALT_LF][seg];
- lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63: lvl_seg) : 0;
- }
- }
-
- if (!mbd->mode_ref_lf_delta_enabled)
- {
- /* we could get rid of this if we assume that deltas are set to
- * zero when not in use; encoder always uses deltas
- */
- vpx_memset(lfi->lvl[seg][0], lvl_seg, 4 * 4 );
- continue;
- }
-
- /* INTRA_FRAME */
- ref = INTRA_FRAME;
-
- /* Apply delta for reference frame */
- lvl_ref = lvl_seg + mbd->ref_lf_deltas[ref];
-
- /* Apply delta for Intra modes */
- mode = 0; /* B_PRED */
- /* Only the split mode BPRED has a further special case */
- lvl_mode = lvl_ref + mbd->mode_lf_deltas[mode];
- /* clamp */
- lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0;
-
- lfi->lvl[seg][ref][mode] = lvl_mode;
-
- mode = 1; /* all the rest of Intra modes */
- /* clamp */
- lvl_mode = (lvl_ref > 0) ? (lvl_ref > 63 ? 63 : lvl_ref) : 0;
- lfi->lvl[seg][ref][mode] = lvl_mode;
-
- /* LAST, GOLDEN, ALT */
- for(ref = 1; ref < MAX_REF_FRAMES; ref++)
- {
- /* Apply delta for reference frame */
- lvl_ref = lvl_seg + mbd->ref_lf_deltas[ref];
-
- /* Apply delta for Inter modes */
- for (mode = 1; mode < 4; mode++)
- {
- lvl_mode = lvl_ref + mbd->mode_lf_deltas[mode];
- /* clamp */
- lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0;
-
- lfi->lvl[seg][ref][mode] = lvl_mode;
- }
- }
- }
-}
-
-
-void vp8_loop_filter_row_normal(VP8_COMMON *cm, MODE_INFO *mode_info_context,
- int mb_row, int post_ystride, int post_uvstride,
- unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr)
-{
- int mb_col;
- int filter_level;
- loop_filter_info_n *lfi_n = &cm->lf_info;
- loop_filter_info lfi;
- FRAME_TYPE frame_type = cm->frame_type;
-
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
- int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
- mode_info_context->mbmi.mode != SPLITMV &&
- mode_info_context->mbmi.mb_skip_coeff);
-
- const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
- const int seg = mode_info_context->mbmi.segment_id;
- const int ref_frame = mode_info_context->mbmi.ref_frame;
-
- filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
-
- if (filter_level)
- {
- const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
- lfi.mblim = lfi_n->mblim[filter_level];
- lfi.blim = lfi_n->blim[filter_level];
- lfi.lim = lfi_n->lim[filter_level];
- lfi.hev_thr = lfi_n->hev_thr[hev_index];
-
- if (mb_col > 0)
- vp8_loop_filter_mbv
- (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bv
- (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_mbh
- (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bh
- (y_ptr, u_ptr, v_ptr, post_ystride, post_uvstride, &lfi);
- }
-
- y_ptr += 16;
- u_ptr += 8;
- v_ptr += 8;
-
- mode_info_context++; /* step to next MB */
- }
-
-}
-
-void vp8_loop_filter_row_simple(VP8_COMMON *cm, MODE_INFO *mode_info_context,
- int mb_row, int post_ystride, int post_uvstride,
- unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr)
-{
- int mb_col;
- int filter_level;
- loop_filter_info_n *lfi_n = &cm->lf_info;
- (void)post_uvstride;
-
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
- int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
- mode_info_context->mbmi.mode != SPLITMV &&
- mode_info_context->mbmi.mb_skip_coeff);
-
- const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
- const int seg = mode_info_context->mbmi.segment_id;
- const int ref_frame = mode_info_context->mbmi.ref_frame;
-
- filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
-
- if (filter_level)
- {
- if (mb_col > 0)
- vp8_loop_filter_simple_mbv
- (y_ptr, post_ystride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bv
- (y_ptr, post_ystride, lfi_n->blim[filter_level]);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_simple_mbh
- (y_ptr, post_ystride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bh
- (y_ptr, post_ystride, lfi_n->blim[filter_level]);
- }
-
- y_ptr += 16;
- u_ptr += 8;
- v_ptr += 8;
-
- mode_info_context++; /* step to next MB */
- }
-
-}
-void vp8_loop_filter_frame(VP8_COMMON *cm,
- MACROBLOCKD *mbd,
- int frame_type)
-{
- YV12_BUFFER_CONFIG *post = cm->frame_to_show;
- loop_filter_info_n *lfi_n = &cm->lf_info;
- loop_filter_info lfi;
-
- int mb_row;
- int mb_col;
- int mb_rows = cm->mb_rows;
- int mb_cols = cm->mb_cols;
-
- int filter_level;
-
- unsigned char *y_ptr, *u_ptr, *v_ptr;
-
- /* Point at base of Mb MODE_INFO list */
- const MODE_INFO *mode_info_context = cm->mi;
- int post_y_stride = post->y_stride;
- int post_uv_stride = post->uv_stride;
-
- /* Initialize the loop filter for this frame. */
- vp8_loop_filter_frame_init(cm, mbd, cm->filter_level);
-
- /* Set up the buffer pointers */
- y_ptr = post->y_buffer;
- u_ptr = post->u_buffer;
- v_ptr = post->v_buffer;
-
- /* vp8_filter each macro block */
- if (cm->filter_type == NORMAL_LOOPFILTER)
- {
- for (mb_row = 0; mb_row < mb_rows; mb_row++)
- {
- for (mb_col = 0; mb_col < mb_cols; mb_col++)
- {
- int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
- mode_info_context->mbmi.mode != SPLITMV &&
- mode_info_context->mbmi.mb_skip_coeff);
-
- const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
- const int seg = mode_info_context->mbmi.segment_id;
- const int ref_frame = mode_info_context->mbmi.ref_frame;
-
- filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
-
- if (filter_level)
- {
- const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
- lfi.mblim = lfi_n->mblim[filter_level];
- lfi.blim = lfi_n->blim[filter_level];
- lfi.lim = lfi_n->lim[filter_level];
- lfi.hev_thr = lfi_n->hev_thr[hev_index];
-
- if (mb_col > 0)
- vp8_loop_filter_mbv
- (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bv
- (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_mbh
- (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bh
- (y_ptr, u_ptr, v_ptr, post_y_stride, post_uv_stride, &lfi);
- }
-
- y_ptr += 16;
- u_ptr += 8;
- v_ptr += 8;
-
- mode_info_context++; /* step to next MB */
- }
- y_ptr += post_y_stride * 16 - post->y_width;
- u_ptr += post_uv_stride * 8 - post->uv_width;
- v_ptr += post_uv_stride * 8 - post->uv_width;
-
- mode_info_context++; /* Skip border mb */
-
- }
- }
- else /* SIMPLE_LOOPFILTER */
- {
- for (mb_row = 0; mb_row < mb_rows; mb_row++)
- {
- for (mb_col = 0; mb_col < mb_cols; mb_col++)
- {
- int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
- mode_info_context->mbmi.mode != SPLITMV &&
- mode_info_context->mbmi.mb_skip_coeff);
-
- const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
- const int seg = mode_info_context->mbmi.segment_id;
- const int ref_frame = mode_info_context->mbmi.ref_frame;
-
- filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
- if (filter_level)
- {
- const unsigned char * mblim = lfi_n->mblim[filter_level];
- const unsigned char * blim = lfi_n->blim[filter_level];
-
- if (mb_col > 0)
- vp8_loop_filter_simple_mbv
- (y_ptr, post_y_stride, mblim);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bv
- (y_ptr, post_y_stride, blim);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_simple_mbh
- (y_ptr, post_y_stride, mblim);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bh
- (y_ptr, post_y_stride, blim);
- }
-
- y_ptr += 16;
- u_ptr += 8;
- v_ptr += 8;
-
- mode_info_context++; /* step to next MB */
- }
- y_ptr += post_y_stride * 16 - post->y_width;
- u_ptr += post_uv_stride * 8 - post->uv_width;
- v_ptr += post_uv_stride * 8 - post->uv_width;
-
- mode_info_context++; /* Skip border mb */
-
- }
- }
-}
-
-void vp8_loop_filter_frame_yonly
-(
- VP8_COMMON *cm,
- MACROBLOCKD *mbd,
- int default_filt_lvl
-)
-{
- YV12_BUFFER_CONFIG *post = cm->frame_to_show;
-
- unsigned char *y_ptr;
- int mb_row;
- int mb_col;
-
- loop_filter_info_n *lfi_n = &cm->lf_info;
- loop_filter_info lfi;
-
- int filter_level;
- FRAME_TYPE frame_type = cm->frame_type;
-
- /* Point at base of Mb MODE_INFO list */
- const MODE_INFO *mode_info_context = cm->mi;
-
-#if 0
- if(default_filt_lvl == 0) /* no filter applied */
- return;
-#endif
-
- /* Initialize the loop filter for this frame. */
- vp8_loop_filter_frame_init( cm, mbd, default_filt_lvl);
-
- /* Set up the buffer pointers */
- y_ptr = post->y_buffer;
-
- /* vp8_filter each macro block */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
- {
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
- int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
- mode_info_context->mbmi.mode != SPLITMV &&
- mode_info_context->mbmi.mb_skip_coeff);
-
- const int mode_index = lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
- const int seg = mode_info_context->mbmi.segment_id;
- const int ref_frame = mode_info_context->mbmi.ref_frame;
-
- filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
-
- if (filter_level)
- {
- if (cm->filter_type == NORMAL_LOOPFILTER)
- {
- const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
- lfi.mblim = lfi_n->mblim[filter_level];
- lfi.blim = lfi_n->blim[filter_level];
- lfi.lim = lfi_n->lim[filter_level];
- lfi.hev_thr = lfi_n->hev_thr[hev_index];
-
- if (mb_col > 0)
- vp8_loop_filter_mbv
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bv
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_mbh
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bh
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
- }
- else
- {
- if (mb_col > 0)
- vp8_loop_filter_simple_mbv
- (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bv
- (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_simple_mbh
- (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bh
- (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
- }
- }
-
- y_ptr += 16;
- mode_info_context ++; /* step to next MB */
-
- }
-
- y_ptr += post->y_stride * 16 - post->y_width;
- mode_info_context ++; /* Skip border mb */
- }
-
-}
-
-void vp8_loop_filter_partial_frame
-(
- VP8_COMMON *cm,
- MACROBLOCKD *mbd,
- int default_filt_lvl
-)
-{
- YV12_BUFFER_CONFIG *post = cm->frame_to_show;
-
- unsigned char *y_ptr;
- int mb_row;
- int mb_col;
- int mb_cols = post->y_width >> 4;
- int mb_rows = post->y_height >> 4;
-
- int linestocopy;
-
- loop_filter_info_n *lfi_n = &cm->lf_info;
- loop_filter_info lfi;
-
- int filter_level;
- FRAME_TYPE frame_type = cm->frame_type;
-
- const MODE_INFO *mode_info_context;
-
-#if 0
- if(default_filt_lvl == 0) /* no filter applied */
- return;
-#endif
-
- /* Initialize the loop filter for this frame. */
- vp8_loop_filter_frame_init( cm, mbd, default_filt_lvl);
-
- /* number of MB rows to use in partial filtering */
- linestocopy = mb_rows / PARTIAL_FRAME_FRACTION;
- linestocopy = linestocopy ? linestocopy << 4 : 16; /* 16 lines per MB */
-
- /* Set up the buffer pointers; partial image starts at ~middle of frame */
- y_ptr = post->y_buffer + ((post->y_height >> 5) * 16) * post->y_stride;
- mode_info_context = cm->mi + (post->y_height >> 5) * (mb_cols + 1);
-
- /* vp8_filter each macro block */
- for (mb_row = 0; mb_row<(linestocopy >> 4); mb_row++)
- {
- for (mb_col = 0; mb_col < mb_cols; mb_col++)
- {
- int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
- mode_info_context->mbmi.mode != SPLITMV &&
- mode_info_context->mbmi.mb_skip_coeff);
-
- const int mode_index =
- lfi_n->mode_lf_lut[mode_info_context->mbmi.mode];
- const int seg = mode_info_context->mbmi.segment_id;
- const int ref_frame = mode_info_context->mbmi.ref_frame;
-
- filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
-
- if (filter_level)
- {
- if (cm->filter_type == NORMAL_LOOPFILTER)
- {
- const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
- lfi.mblim = lfi_n->mblim[filter_level];
- lfi.blim = lfi_n->blim[filter_level];
- lfi.lim = lfi_n->lim[filter_level];
- lfi.hev_thr = lfi_n->hev_thr[hev_index];
-
- if (mb_col > 0)
- vp8_loop_filter_mbv
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bv
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
-
- vp8_loop_filter_mbh
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bh
- (y_ptr, 0, 0, post->y_stride, 0, &lfi);
- }
- else
- {
- if (mb_col > 0)
- vp8_loop_filter_simple_mbv
- (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bv
- (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
-
- vp8_loop_filter_simple_mbh
- (y_ptr, post->y_stride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bh
- (y_ptr, post->y_stride, lfi_n->blim[filter_level]);
- }
- }
-
- y_ptr += 16;
- mode_info_context += 1; /* step to next MB */
- }
-
- y_ptr += post->y_stride * 16 - post->y_width;
- mode_info_context += 1; /* Skip border mb */
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.h b/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.h
deleted file mode 100644
index 20a6bd3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_LOOPFILTER_H_
-#define VP8_COMMON_LOOPFILTER_H_
-
-#include "vpx_ports/mem.h"
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_LOOP_FILTER 63
-/* fraction of total macroblock rows to be used in fast filter level picking */
-/* has to be > 2 */
-#define PARTIAL_FRAME_FRACTION 8
-
-typedef enum
-{
- NORMAL_LOOPFILTER = 0,
- SIMPLE_LOOPFILTER = 1
-} LOOPFILTERTYPE;
-
-#if ARCH_ARM
-#define SIMD_WIDTH 1
-#else
-#define SIMD_WIDTH 16
-#endif
-
-/* Need to align this structure so when it is declared and
- * passed it can be loaded into vector registers.
- */
-typedef struct
-{
- DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
- DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
- DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
- DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]);
- unsigned char lvl[4][4][4];
- unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
- unsigned char mode_lf_lut[10];
-} loop_filter_info_n;
-
-typedef struct loop_filter_info
-{
- const unsigned char * mblim;
- const unsigned char * blim;
- const unsigned char * lim;
- const unsigned char * hev_thr;
-} loop_filter_info;
-
-
-typedef void loop_filter_uvfunction
-(
- unsigned char *u, /* source pointer */
- int p, /* pitch */
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
- unsigned char *v
-);
-
-/* assorted loopfilter functions which get used elsewhere */
-struct VP8Common;
-struct macroblockd;
-struct modeinfo;
-
-void vp8_loop_filter_init(struct VP8Common *cm);
-
-void vp8_loop_filter_frame_init(struct VP8Common *cm,
- struct macroblockd *mbd,
- int default_filt_lvl);
-
-void vp8_loop_filter_frame(struct VP8Common *cm, struct macroblockd *mbd,
- int frame_type);
-
-void vp8_loop_filter_partial_frame(struct VP8Common *cm,
- struct macroblockd *mbd,
- int default_filt_lvl);
-
-void vp8_loop_filter_frame_yonly(struct VP8Common *cm,
- struct macroblockd *mbd,
- int default_filt_lvl);
-
-void vp8_loop_filter_update_sharpness(loop_filter_info_n *lfi,
- int sharpness_lvl);
-
-void vp8_loop_filter_row_normal(struct VP8Common *cm,
- struct modeinfo *mode_info_context,
- int mb_row, int post_ystride, int post_uvstride,
- unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr);
-
-void vp8_loop_filter_row_simple(struct VP8Common *cm,
- struct modeinfo *mode_info_context,
- int mb_row, int post_ystride, int post_uvstride,
- unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_LOOPFILTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter_filters.c b/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter_filters.c
deleted file mode 100644
index 1d51696..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/loopfilter_filters.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include "loopfilter.h"
-#include "onyxc_int.h"
-
-typedef unsigned char uc;
-
-static signed char vp8_signed_char_clamp(int t)
-{
- t = (t < -128 ? -128 : t);
- t = (t > 127 ? 127 : t);
- return (signed char) t;
-}
-
-
-/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
-static signed char vp8_filter_mask(uc limit, uc blimit,
- uc p3, uc p2, uc p1, uc p0,
- uc q0, uc q1, uc q2, uc q3)
-{
- signed char mask = 0;
- mask |= (abs(p3 - p2) > limit);
- mask |= (abs(p2 - p1) > limit);
- mask |= (abs(p1 - p0) > limit);
- mask |= (abs(q1 - q0) > limit);
- mask |= (abs(q2 - q1) > limit);
- mask |= (abs(q3 - q2) > limit);
- mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit);
- return mask - 1;
-}
-
-/* is there high variance internal edge ( 11111111 yes, 00000000 no) */
-static signed char vp8_hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1)
-{
- signed char hev = 0;
- hev |= (abs(p1 - p0) > thresh) * -1;
- hev |= (abs(q1 - q0) > thresh) * -1;
- return hev;
-}
-
-static void vp8_filter(signed char mask, uc hev, uc *op1,
- uc *op0, uc *oq0, uc *oq1)
-
-{
- signed char ps0, qs0;
- signed char ps1, qs1;
- signed char filter_value, Filter1, Filter2;
- signed char u;
-
- ps1 = (signed char) * op1 ^ 0x80;
- ps0 = (signed char) * op0 ^ 0x80;
- qs0 = (signed char) * oq0 ^ 0x80;
- qs1 = (signed char) * oq1 ^ 0x80;
-
- /* add outer taps if we have high edge variance */
- filter_value = vp8_signed_char_clamp(ps1 - qs1);
- filter_value &= hev;
-
- /* inner taps */
- filter_value = vp8_signed_char_clamp(filter_value + 3 * (qs0 - ps0));
- filter_value &= mask;
-
- /* save bottom 3 bits so that we round one side +4 and the other +3
- * if it equals 4 we'll set to adjust by -1 to account for the fact
- * we'd round 3 the other way
- */
- Filter1 = vp8_signed_char_clamp(filter_value + 4);
- Filter2 = vp8_signed_char_clamp(filter_value + 3);
- Filter1 >>= 3;
- Filter2 >>= 3;
- u = vp8_signed_char_clamp(qs0 - Filter1);
- *oq0 = u ^ 0x80;
- u = vp8_signed_char_clamp(ps0 + Filter2);
- *op0 = u ^ 0x80;
- filter_value = Filter1;
-
- /* outer tap adjustments */
- filter_value += 1;
- filter_value >>= 1;
- filter_value &= ~hev;
-
- u = vp8_signed_char_clamp(qs1 - filter_value);
- *oq1 = u ^ 0x80;
- u = vp8_signed_char_clamp(ps1 + filter_value);
- *op1 = u ^ 0x80;
-
-}
-void vp8_loop_filter_horizontal_edge_c
-(
- unsigned char *s,
- int p, /* pitch */
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
- int count
-)
-{
- int hev = 0; /* high edge variance */
- signed char mask = 0;
- int i = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
- do
- {
- mask = vp8_filter_mask(limit[0], blimit[0],
- s[-4*p], s[-3*p], s[-2*p], s[-1*p],
- s[0*p], s[1*p], s[2*p], s[3*p]);
-
- hev = vp8_hevmask(thresh[0], s[-2*p], s[-1*p], s[0*p], s[1*p]);
-
- vp8_filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
-
- ++s;
- }
- while (++i < count * 8);
-}
-
-void vp8_loop_filter_vertical_edge_c
-(
- unsigned char *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
- int count
-)
-{
- int hev = 0; /* high edge variance */
- signed char mask = 0;
- int i = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
- do
- {
- mask = vp8_filter_mask(limit[0], blimit[0],
- s[-4], s[-3], s[-2], s[-1], s[0], s[1], s[2], s[3]);
-
- hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
-
- vp8_filter(mask, hev, s - 2, s - 1, s, s + 1);
-
- s += p;
- }
- while (++i < count * 8);
-}
-
-static void vp8_mbfilter(signed char mask, uc hev,
- uc *op2, uc *op1, uc *op0, uc *oq0, uc *oq1, uc *oq2)
-{
- signed char s, u;
- signed char filter_value, Filter1, Filter2;
- signed char ps2 = (signed char) * op2 ^ 0x80;
- signed char ps1 = (signed char) * op1 ^ 0x80;
- signed char ps0 = (signed char) * op0 ^ 0x80;
- signed char qs0 = (signed char) * oq0 ^ 0x80;
- signed char qs1 = (signed char) * oq1 ^ 0x80;
- signed char qs2 = (signed char) * oq2 ^ 0x80;
-
- /* add outer taps if we have high edge variance */
- filter_value = vp8_signed_char_clamp(ps1 - qs1);
- filter_value = vp8_signed_char_clamp(filter_value + 3 * (qs0 - ps0));
- filter_value &= mask;
-
- Filter2 = filter_value;
- Filter2 &= hev;
-
- /* save bottom 3 bits so that we round one side +4 and the other +3 */
- Filter1 = vp8_signed_char_clamp(Filter2 + 4);
- Filter2 = vp8_signed_char_clamp(Filter2 + 3);
- Filter1 >>= 3;
- Filter2 >>= 3;
- qs0 = vp8_signed_char_clamp(qs0 - Filter1);
- ps0 = vp8_signed_char_clamp(ps0 + Filter2);
-
-
- /* only apply wider filter if not high edge variance */
- filter_value &= ~hev;
- Filter2 = filter_value;
-
- /* roughly 3/7th difference across boundary */
- u = vp8_signed_char_clamp((63 + Filter2 * 27) >> 7);
- s = vp8_signed_char_clamp(qs0 - u);
- *oq0 = s ^ 0x80;
- s = vp8_signed_char_clamp(ps0 + u);
- *op0 = s ^ 0x80;
-
- /* roughly 2/7th difference across boundary */
- u = vp8_signed_char_clamp((63 + Filter2 * 18) >> 7);
- s = vp8_signed_char_clamp(qs1 - u);
- *oq1 = s ^ 0x80;
- s = vp8_signed_char_clamp(ps1 + u);
- *op1 = s ^ 0x80;
-
- /* roughly 1/7th difference across boundary */
- u = vp8_signed_char_clamp((63 + Filter2 * 9) >> 7);
- s = vp8_signed_char_clamp(qs2 - u);
- *oq2 = s ^ 0x80;
- s = vp8_signed_char_clamp(ps2 + u);
- *op2 = s ^ 0x80;
-}
-
-void vp8_mbloop_filter_horizontal_edge_c
-(
- unsigned char *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
- int count
-)
-{
- signed char hev = 0; /* high edge variance */
- signed char mask = 0;
- int i = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
- do
- {
-
- mask = vp8_filter_mask(limit[0], blimit[0],
- s[-4*p], s[-3*p], s[-2*p], s[-1*p],
- s[0*p], s[1*p], s[2*p], s[3*p]);
-
- hev = vp8_hevmask(thresh[0], s[-2*p], s[-1*p], s[0*p], s[1*p]);
-
- vp8_mbfilter(mask, hev, s - 3 * p, s - 2 * p, s - 1 * p, s, s + 1 * p, s + 2 * p);
-
- ++s;
- }
- while (++i < count * 8);
-
-}
-
-
-void vp8_mbloop_filter_vertical_edge_c
-(
- unsigned char *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
- int count
-)
-{
- signed char hev = 0; /* high edge variance */
- signed char mask = 0;
- int i = 0;
-
- do
- {
-
- mask = vp8_filter_mask(limit[0], blimit[0],
- s[-4], s[-3], s[-2], s[-1], s[0], s[1], s[2], s[3]);
-
- hev = vp8_hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
-
- vp8_mbfilter(mask, hev, s - 3, s - 2, s - 1, s, s + 1, s + 2);
-
- s += p;
- }
- while (++i < count * 8);
-
-}
-
-/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
-static signed char vp8_simple_filter_mask(uc blimit, uc p1, uc p0, uc q0, uc q1)
-{
-/* Why does this cause problems for win32?
- * error C2143: syntax error : missing ';' before 'type'
- * (void) limit;
- */
- signed char mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 <= blimit) * -1;
- return mask;
-}
-
-static void vp8_simple_filter(signed char mask, uc *op1, uc *op0, uc *oq0, uc *oq1)
-{
- signed char filter_value, Filter1, Filter2;
- signed char p1 = (signed char) * op1 ^ 0x80;
- signed char p0 = (signed char) * op0 ^ 0x80;
- signed char q0 = (signed char) * oq0 ^ 0x80;
- signed char q1 = (signed char) * oq1 ^ 0x80;
- signed char u;
-
- filter_value = vp8_signed_char_clamp(p1 - q1);
- filter_value = vp8_signed_char_clamp(filter_value + 3 * (q0 - p0));
- filter_value &= mask;
-
- /* save bottom 3 bits so that we round one side +4 and the other +3 */
- Filter1 = vp8_signed_char_clamp(filter_value + 4);
- Filter1 >>= 3;
- u = vp8_signed_char_clamp(q0 - Filter1);
- *oq0 = u ^ 0x80;
-
- Filter2 = vp8_signed_char_clamp(filter_value + 3);
- Filter2 >>= 3;
- u = vp8_signed_char_clamp(p0 + Filter2);
- *op0 = u ^ 0x80;
-}
-
-void vp8_loop_filter_simple_horizontal_edge_c
-(
- unsigned char *s,
- int p,
- const unsigned char *blimit
-)
-{
- signed char mask = 0;
- int i = 0;
-
- do
- {
- mask = vp8_simple_filter_mask(blimit[0], s[-2*p], s[-1*p], s[0*p], s[1*p]);
- vp8_simple_filter(mask, s - 2 * p, s - 1 * p, s, s + 1 * p);
- ++s;
- }
- while (++i < 16);
-}
-
-void vp8_loop_filter_simple_vertical_edge_c
-(
- unsigned char *s,
- int p,
- const unsigned char *blimit
-)
-{
- signed char mask = 0;
- int i = 0;
-
- do
- {
- mask = vp8_simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]);
- vp8_simple_filter(mask, s - 2, s - 1, s, s + 1);
- s += p;
- }
- while (++i < 16);
-
-}
-
-/* Horizontal MB filtering */
-void vp8_loop_filter_mbh_c(unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr, int y_stride, int uv_stride,
- loop_filter_info *lfi)
-{
- vp8_mbloop_filter_horizontal_edge_c(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_mbloop_filter_horizontal_edge_c(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_mbloop_filter_horizontal_edge_c(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-/* Vertical MB Filtering */
-void vp8_loop_filter_mbv_c(unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr, int y_stride, int uv_stride,
- loop_filter_info *lfi)
-{
- vp8_mbloop_filter_vertical_edge_c(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_mbloop_filter_vertical_edge_c(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_mbloop_filter_vertical_edge_c(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-/* Horizontal B Filtering */
-void vp8_loop_filter_bh_c(unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr, int y_stride, int uv_stride,
- loop_filter_info *lfi)
-{
- vp8_loop_filter_horizontal_edge_c(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_horizontal_edge_c(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_horizontal_edge_c(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_loop_filter_horizontal_edge_c(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_loop_filter_horizontal_edge_c(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-void vp8_loop_filter_bhs_c(unsigned char *y_ptr, int y_stride,
- const unsigned char *blimit)
-{
- vp8_loop_filter_simple_horizontal_edge_c(y_ptr + 4 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_c(y_ptr + 8 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_c(y_ptr + 12 * y_stride, y_stride, blimit);
-}
-
-/* Vertical B Filtering */
-void vp8_loop_filter_bv_c(unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr, int y_stride, int uv_stride,
- loop_filter_info *lfi)
-{
- vp8_loop_filter_vertical_edge_c(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_vertical_edge_c(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_vertical_edge_c(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_loop_filter_vertical_edge_c(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_loop_filter_vertical_edge_c(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-void vp8_loop_filter_bvs_c(unsigned char *y_ptr, int y_stride,
- const unsigned char *blimit)
-{
- vp8_loop_filter_simple_vertical_edge_c(y_ptr + 4, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_c(y_ptr + 8, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_c(y_ptr + 12, y_stride, blimit);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mbpitch.c b/videocodec/libvpx_internal/libvpx/vp8/common/mbpitch.c
deleted file mode 100644
index 32e1b66..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mbpitch.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "blockd.h"
-
-void vp8_setup_block_dptrs(MACROBLOCKD *x)
-{
- int r, c;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- x->block[r*4+c].predictor = x->predictor + r * 4 * 16 + c * 4;
- }
- }
-
- for (r = 0; r < 2; r++)
- {
- for (c = 0; c < 2; c++)
- {
- x->block[16+r*2+c].predictor = x->predictor + 256 + r * 4 * 8 + c * 4;
-
- }
- }
-
- for (r = 0; r < 2; r++)
- {
- for (c = 0; c < 2; c++)
- {
- x->block[20+r*2+c].predictor = x->predictor + 320 + r * 4 * 8 + c * 4;
-
- }
- }
-
- for (r = 0; r < 25; r++)
- {
- x->block[r].qcoeff = x->qcoeff + r * 16;
- x->block[r].dqcoeff = x->dqcoeff + r * 16;
- x->block[r].eob = x->eobs + r;
- }
-}
-
-void vp8_build_block_doffsets(MACROBLOCKD *x)
-{
- int block;
-
- for (block = 0; block < 16; block++) /* y blocks */
- {
- x->block[block].offset =
- (block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4;
- }
-
- for (block = 16; block < 20; block++) /* U and V blocks */
- {
- x->block[block+4].offset =
- x->block[block].offset =
- ((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mfqe.c b/videocodec/libvpx_internal/libvpx/vp8/common/mfqe.c
deleted file mode 100644
index 0693326..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mfqe.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* MFQE: Multiframe Quality Enhancement
- * In rate limited situations keyframes may cause significant visual artifacts
- * commonly referred to as "popping." This file implements a postproccesing
- * algorithm which blends data from the preceeding frame when there is no
- * motion and the q from the previous frame is lower which indicates that it is
- * higher quality.
- */
-
-#include "postproc.h"
-#include "variance.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8_rtcd.h"
-#include "vpx_scale/yv12config.h"
-
-#include <limits.h>
-#include <stdlib.h>
-
-static void filter_by_weight(unsigned char *src, int src_stride,
- unsigned char *dst, int dst_stride,
- int block_size, int src_weight)
-{
- int dst_weight = (1 << MFQE_PRECISION) - src_weight;
- int rounding_bit = 1 << (MFQE_PRECISION - 1);
- int r, c;
-
- for (r = 0; r < block_size; r++)
- {
- for (c = 0; c < block_size; c++)
- {
- dst[c] = (src[c] * src_weight +
- dst[c] * dst_weight +
- rounding_bit) >> MFQE_PRECISION;
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp8_filter_by_weight16x16_c(unsigned char *src, int src_stride,
- unsigned char *dst, int dst_stride,
- int src_weight)
-{
- filter_by_weight(src, src_stride, dst, dst_stride, 16, src_weight);
-}
-
-void vp8_filter_by_weight8x8_c(unsigned char *src, int src_stride,
- unsigned char *dst, int dst_stride,
- int src_weight)
-{
- filter_by_weight(src, src_stride, dst, dst_stride, 8, src_weight);
-}
-
-void vp8_filter_by_weight4x4_c(unsigned char *src, int src_stride,
- unsigned char *dst, int dst_stride,
- int src_weight)
-{
- filter_by_weight(src, src_stride, dst, dst_stride, 4, src_weight);
-}
-
-static void apply_ifactor(unsigned char *y_src,
- int y_src_stride,
- unsigned char *y_dst,
- int y_dst_stride,
- unsigned char *u_src,
- unsigned char *v_src,
- int uv_src_stride,
- unsigned char *u_dst,
- unsigned char *v_dst,
- int uv_dst_stride,
- int block_size,
- int src_weight)
-{
- if (block_size == 16)
- {
- vp8_filter_by_weight16x16(y_src, y_src_stride, y_dst, y_dst_stride, src_weight);
- vp8_filter_by_weight8x8(u_src, uv_src_stride, u_dst, uv_dst_stride, src_weight);
- vp8_filter_by_weight8x8(v_src, uv_src_stride, v_dst, uv_dst_stride, src_weight);
- }
- else /* if (block_size == 8) */
- {
- vp8_filter_by_weight8x8(y_src, y_src_stride, y_dst, y_dst_stride, src_weight);
- vp8_filter_by_weight4x4(u_src, uv_src_stride, u_dst, uv_dst_stride, src_weight);
- vp8_filter_by_weight4x4(v_src, uv_src_stride, v_dst, uv_dst_stride, src_weight);
- }
-}
-
-static unsigned int int_sqrt(unsigned int x)
-{
- unsigned int y = x;
- unsigned int guess;
- int p = 1;
- while (y>>=1) p++;
- p>>=1;
-
- guess=0;
- while (p>=0)
- {
- guess |= (1<<p);
- if (x<guess*guess)
- guess -= (1<<p);
- p--;
- }
- /* choose between guess or guess+1 */
- return guess+(guess*guess+guess+1<=x);
-}
-
-#define USE_SSD
-static void multiframe_quality_enhance_block
-(
- int blksize, /* Currently only values supported are 16, 8 */
- int qcurr,
- int qprev,
- unsigned char *y,
- unsigned char *u,
- unsigned char *v,
- int y_stride,
- int uv_stride,
- unsigned char *yd,
- unsigned char *ud,
- unsigned char *vd,
- int yd_stride,
- int uvd_stride
-)
-{
- static const unsigned char VP8_ZEROS[16]=
- {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- };
- int uvblksize = blksize >> 1;
- int qdiff = qcurr - qprev;
-
- int i;
- unsigned char *up;
- unsigned char *udp;
- unsigned char *vp;
- unsigned char *vdp;
-
- unsigned int act, actd, sad, usad, vsad, sse, thr, thrsq, actrisk;
-
- if (blksize == 16)
- {
- actd = (vp8_variance16x16(yd, yd_stride, VP8_ZEROS, 0, &sse)+128)>>8;
- act = (vp8_variance16x16(y, y_stride, VP8_ZEROS, 0, &sse)+128)>>8;
-#ifdef USE_SSD
- sad = (vp8_variance16x16(y, y_stride, yd, yd_stride, &sse));
- sad = (sse + 128)>>8;
- usad = (vp8_variance8x8(u, uv_stride, ud, uvd_stride, &sse));
- usad = (sse + 32)>>6;
- vsad = (vp8_variance8x8(v, uv_stride, vd, uvd_stride, &sse));
- vsad = (sse + 32)>>6;
-#else
- sad = (vp8_sad16x16(y, y_stride, yd, yd_stride, UINT_MAX) + 128) >> 8;
- usad = (vp8_sad8x8(u, uv_stride, ud, uvd_stride, UINT_MAX) + 32) >> 6;
- vsad = (vp8_sad8x8(v, uv_stride, vd, uvd_stride, UINT_MAX)+ 32) >> 6;
-#endif
- }
- else /* if (blksize == 8) */
- {
- actd = (vp8_variance8x8(yd, yd_stride, VP8_ZEROS, 0, &sse)+32)>>6;
- act = (vp8_variance8x8(y, y_stride, VP8_ZEROS, 0, &sse)+32)>>6;
-#ifdef USE_SSD
- sad = (vp8_variance8x8(y, y_stride, yd, yd_stride, &sse));
- sad = (sse + 32)>>6;
- usad = (vp8_variance4x4(u, uv_stride, ud, uvd_stride, &sse));
- usad = (sse + 8)>>4;
- vsad = (vp8_variance4x4(v, uv_stride, vd, uvd_stride, &sse));
- vsad = (sse + 8)>>4;
-#else
- sad = (vp8_sad8x8(y, y_stride, yd, yd_stride, UINT_MAX) + 32) >> 6;
- usad = (vp8_sad4x4(u, uv_stride, ud, uvd_stride, UINT_MAX) + 8) >> 4;
- vsad = (vp8_sad4x4(v, uv_stride, vd, uvd_stride, UINT_MAX) + 8) >> 4;
-#endif
- }
-
- actrisk = (actd > act * 5);
-
- /* thr = qdiff/16 + log2(act) + log4(qprev) */
- thr = (qdiff >> 4);
- while (actd >>= 1) thr++;
- while (qprev >>= 2) thr++;
-
-#ifdef USE_SSD
- thrsq = thr * thr;
- if (sad < thrsq &&
- /* additional checks for color mismatch and excessive addition of
- * high-frequencies */
- 4 * usad < thrsq && 4 * vsad < thrsq && !actrisk)
-#else
- if (sad < thr &&
- /* additional checks for color mismatch and excessive addition of
- * high-frequencies */
- 2 * usad < thr && 2 * vsad < thr && !actrisk)
-#endif
- {
- int ifactor;
-#ifdef USE_SSD
- /* TODO: optimize this later to not need sqr root */
- sad = int_sqrt(sad);
-#endif
- ifactor = (sad << MFQE_PRECISION) / thr;
- ifactor >>= (qdiff >> 5);
-
- if (ifactor)
- {
- apply_ifactor(y, y_stride, yd, yd_stride,
- u, v, uv_stride,
- ud, vd, uvd_stride,
- blksize, ifactor);
- }
- }
- else /* else implicitly copy from previous frame */
- {
- if (blksize == 16)
- {
- vp8_copy_mem16x16(y, y_stride, yd, yd_stride);
- vp8_copy_mem8x8(u, uv_stride, ud, uvd_stride);
- vp8_copy_mem8x8(v, uv_stride, vd, uvd_stride);
- }
- else /* if (blksize == 8) */
- {
- vp8_copy_mem8x8(y, y_stride, yd, yd_stride);
- for (up = u, udp = ud, i = 0; i < uvblksize; ++i, up += uv_stride, udp += uvd_stride)
- vpx_memcpy(udp, up, uvblksize);
- for (vp = v, vdp = vd, i = 0; i < uvblksize; ++i, vp += uv_stride, vdp += uvd_stride)
- vpx_memcpy(vdp, vp, uvblksize);
- }
- }
-}
-
-static int qualify_inter_mb(const MODE_INFO *mode_info_context, int *map)
-{
- if (mode_info_context->mbmi.mb_skip_coeff)
- map[0] = map[1] = map[2] = map[3] = 1;
- else if (mode_info_context->mbmi.mode==SPLITMV)
- {
- static int ndx[4][4] =
- {
- {0, 1, 4, 5},
- {2, 3, 6, 7},
- {8, 9, 12, 13},
- {10, 11, 14, 15}
- };
- int i, j;
- for (i=0; i<4; ++i)
- {
- map[i] = 1;
- for (j=0; j<4 && map[j]; ++j)
- map[i] &= (mode_info_context->bmi[ndx[i][j]].mv.as_mv.row <= 2 &&
- mode_info_context->bmi[ndx[i][j]].mv.as_mv.col <= 2);
- }
- }
- else
- {
- map[0] = map[1] = map[2] = map[3] =
- (mode_info_context->mbmi.mode > B_PRED &&
- abs(mode_info_context->mbmi.mv.as_mv.row) <= 2 &&
- abs(mode_info_context->mbmi.mv.as_mv.col) <= 2);
- }
- return (map[0]+map[1]+map[2]+map[3]);
-}
-
-void vp8_multiframe_quality_enhance
-(
- VP8_COMMON *cm
-)
-{
- YV12_BUFFER_CONFIG *show = cm->frame_to_show;
- YV12_BUFFER_CONFIG *dest = &cm->post_proc_buffer;
-
- FRAME_TYPE frame_type = cm->frame_type;
- /* Point at base of Mb MODE_INFO list has motion vectors etc */
- const MODE_INFO *mode_info_context = cm->show_frame_mi;
- int mb_row;
- int mb_col;
- int totmap, map[4];
- int qcurr = cm->base_qindex;
- int qprev = cm->postproc_state.last_base_qindex;
-
- unsigned char *y_ptr, *u_ptr, *v_ptr;
- unsigned char *yd_ptr, *ud_ptr, *vd_ptr;
-
- /* Set up the buffer pointers */
- y_ptr = show->y_buffer;
- u_ptr = show->u_buffer;
- v_ptr = show->v_buffer;
- yd_ptr = dest->y_buffer;
- ud_ptr = dest->u_buffer;
- vd_ptr = dest->v_buffer;
-
- /* postprocess each macro block */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
- {
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
- /* if motion is high there will likely be no benefit */
- if (frame_type == INTER_FRAME) totmap = qualify_inter_mb(mode_info_context, map);
- else totmap = (frame_type == KEY_FRAME ? 4 : 0);
- if (totmap)
- {
- if (totmap < 4)
- {
- int i, j;
- for (i=0; i<2; ++i)
- for (j=0; j<2; ++j)
- {
- if (map[i*2+j])
- {
- multiframe_quality_enhance_block(8, qcurr, qprev,
- y_ptr + 8*(i*show->y_stride+j),
- u_ptr + 4*(i*show->uv_stride+j),
- v_ptr + 4*(i*show->uv_stride+j),
- show->y_stride,
- show->uv_stride,
- yd_ptr + 8*(i*dest->y_stride+j),
- ud_ptr + 4*(i*dest->uv_stride+j),
- vd_ptr + 4*(i*dest->uv_stride+j),
- dest->y_stride,
- dest->uv_stride);
- }
- else
- {
- /* copy a 8x8 block */
- int k;
- unsigned char *up = u_ptr + 4*(i*show->uv_stride+j);
- unsigned char *udp = ud_ptr + 4*(i*dest->uv_stride+j);
- unsigned char *vp = v_ptr + 4*(i*show->uv_stride+j);
- unsigned char *vdp = vd_ptr + 4*(i*dest->uv_stride+j);
- vp8_copy_mem8x8(y_ptr + 8*(i*show->y_stride+j), show->y_stride,
- yd_ptr + 8*(i*dest->y_stride+j), dest->y_stride);
- for (k = 0; k < 4; ++k, up += show->uv_stride, udp += dest->uv_stride,
- vp += show->uv_stride, vdp += dest->uv_stride)
- {
- vpx_memcpy(udp, up, 4);
- vpx_memcpy(vdp, vp, 4);
- }
- }
- }
- }
- else /* totmap = 4 */
- {
- multiframe_quality_enhance_block(16, qcurr, qprev, y_ptr,
- u_ptr, v_ptr,
- show->y_stride,
- show->uv_stride,
- yd_ptr, ud_ptr, vd_ptr,
- dest->y_stride,
- dest->uv_stride);
- }
- }
- else
- {
- vp8_copy_mem16x16(y_ptr, show->y_stride, yd_ptr, dest->y_stride);
- vp8_copy_mem8x8(u_ptr, show->uv_stride, ud_ptr, dest->uv_stride);
- vp8_copy_mem8x8(v_ptr, show->uv_stride, vd_ptr, dest->uv_stride);
- }
- y_ptr += 16;
- u_ptr += 8;
- v_ptr += 8;
- yd_ptr += 16;
- ud_ptr += 8;
- vd_ptr += 8;
- mode_info_context++; /* step to next MB */
- }
-
- y_ptr += show->y_stride * 16 - 16 * cm->mb_cols;
- u_ptr += show->uv_stride * 8 - 8 * cm->mb_cols;
- v_ptr += show->uv_stride * 8 - 8 * cm->mb_cols;
- yd_ptr += dest->y_stride * 16 - 16 * cm->mb_cols;
- ud_ptr += dest->uv_stride * 8 - 8 * cm->mb_cols;
- vd_ptr += dest->uv_stride * 8 - 8 * cm->mb_cols;
-
- mode_info_context++; /* Skip border mb */
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/dequantize_dspr2.c b/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/dequantize_dspr2.c
deleted file mode 100644
index 619ee80..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/dequantize_dspr2.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_mem/vpx_mem.h"
-
-#if HAVE_DSPR2
-void vp8_dequant_idct_add_dspr2(short *input, short *dq,
- unsigned char *dest, int stride)
-{
- int i;
-
- for (i = 0; i < 16; i++)
- {
- input[i] = dq[i] * input[i];
- }
-
- vp8_short_idct4x4llm_dspr2(input, dest, stride, dest, stride);
-
- vpx_memset(input, 0, 32);
-
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/filter_dspr2.c b/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/filter_dspr2.c
deleted file mode 100644
index ace5d40..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/filter_dspr2.c
+++ /dev/null
@@ -1,2823 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include "vp8_rtcd.h"
-#include "vpx_ports/mem.h"
-
-#if HAVE_DSPR2
-#define CROP_WIDTH 256
-unsigned char ff_cropTbl[256 + 2 * CROP_WIDTH];
-
-static const unsigned short sub_pel_filterss[8][3] =
-{
- { 0, 0, 0},
- { 0, 0x0601, 0x7b0c},
- { 0x0201, 0x0b08, 0x6c24},
- { 0, 0x0906, 0x5d32},
- { 0x0303, 0x1010, 0x4d4d},
- { 0, 0x0609, 0x325d},
- { 0x0102, 0x080b, 0x246c},
- { 0, 0x0106, 0x0c7b},
-};
-
-
-static const int sub_pel_filters_int[8][3] =
-{
- { 0, 0, 0},
- { 0x0000fffa, 0x007b000c, 0xffff0000},
- { 0x0002fff5, 0x006c0024, 0xfff80001},
- { 0x0000fff7, 0x005d0032, 0xfffa0000},
- { 0x0003fff0, 0x004d004d, 0xfff00003},
- { 0x0000fffa, 0x0032005d, 0xfff70000},
- { 0x0001fff8, 0x0024006c, 0xfff50002},
- { 0x0000ffff, 0x000c007b, 0xfffa0000},
-};
-
-
-static const int sub_pel_filters_inv[8][3] =
-{
- { 0, 0, 0},
- { 0xfffa0000, 0x000c007b, 0x0000ffff},
- { 0xfff50002, 0x0024006c, 0x0001fff8},
- { 0xfff70000, 0x0032005d, 0x0000fffa},
- { 0xfff00003, 0x004d004d, 0x0003fff0},
- { 0xfffa0000, 0x005d0032, 0x0000fff7},
- { 0xfff80001, 0x006c0024, 0x0002fff5},
- { 0xffff0000, 0x007b000c, 0x0000fffa},
-};
-
-
-static const int sub_pel_filters_int_tap_4[8][2] =
-{
- { 0, 0},
- { 0xfffa007b, 0x000cffff},
- { 0, 0},
- { 0xfff7005d, 0x0032fffa},
- { 0, 0},
- { 0xfffa0032, 0x005dfff7},
- { 0, 0},
- { 0xffff000c, 0x007bfffa},
-};
-
-
-static const int sub_pel_filters_inv_tap_4[8][2] =
-{
- { 0, 0},
- { 0x007bfffa, 0xffff000c},
- { 0, 0},
- { 0x005dfff7, 0xfffa0032},
- { 0, 0},
- { 0x0032fffa, 0xfff7005d},
- { 0, 0},
- { 0x000cffff, 0xfffa007b},
-};
-
-inline void prefetch_load(unsigned char *src)
-{
- __asm__ __volatile__ (
- "pref 0, 0(%[src]) \n\t"
- :
- : [src] "r" (src)
- );
-}
-
-
-inline void prefetch_store(unsigned char *dst)
-{
- __asm__ __volatile__ (
- "pref 1, 0(%[dst]) \n\t"
- :
- : [dst] "r" (dst)
- );
-}
-
-void dsputil_static_init(void)
-{
- int i;
-
- for (i = 0; i < 256; i++) ff_cropTbl[i + CROP_WIDTH] = i;
-
- for (i = 0; i < CROP_WIDTH; i++)
- {
- ff_cropTbl[i] = 0;
- ff_cropTbl[i + CROP_WIDTH + 256] = 255;
- }
-}
-
-void vp8_filter_block2d_first_pass_4
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT dst_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_height,
- int xoffset,
- int pitch
-)
-{
- unsigned int i;
- int Temp1, Temp2, Temp3, Temp4;
-
- unsigned int vector4a = 64;
- int vector1b, vector2b, vector3b;
- unsigned int tp1, tp2, tn1, tn2;
- unsigned int p1, p2, p3;
- unsigned int n1, n2, n3;
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- vector3b = sub_pel_filters_inv[xoffset][2];
-
- /* if (xoffset == 0) we don't need any filtering */
- if (vector3b == 0)
- {
- for (i = 0; i < output_height; i++)
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + src_pixels_per_line);
- dst_ptr[0] = src_ptr[0];
- dst_ptr[1] = src_ptr[1];
- dst_ptr[2] = src_ptr[2];
- dst_ptr[3] = src_ptr[3];
-
- /* next row... */
- src_ptr += src_pixels_per_line;
- dst_ptr += 4;
- }
- }
- else
- {
- if (vector3b > 65536)
- {
- /* 6 tap filter */
-
- vector1b = sub_pel_filters_inv[xoffset][0];
- vector2b = sub_pel_filters_inv[xoffset][1];
-
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + src_pixels_per_line);
-
- for (i = output_height; i--;)
- {
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "ulw %[tp1], -2(%[src_ptr]) \n\t"
- "ulw %[tp2], 2(%[src_ptr]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[p1], %[tp2] \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector3b] \n\t"
-
- /* odd 1. pixel */
- "ulw %[tn2], 3(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn2] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector3b] \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[n1], %[tn2] \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- /* clamp */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "lbux %[tn1], %[Temp2](%[cm]) \n\t"
- "lbux %[tp2], %[Temp3](%[cm]) \n\t"
- "lbux %[n2], %[Temp4](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "sb %[tn1], 1(%[dst_ptr]) \n\t"
- "sb %[tp2], 2(%[dst_ptr]) \n\t"
- "sb %[n2], 3(%[dst_ptr]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tn1] "=&r" (tn1),
- [tn2] "=&r" (tn2), [p1] "=&r" (p1), [p2] "=&r" (p2),
- [p3] "=&r" (p3), [n1] "=&r" (n1), [n2] "=&r" (n2),
- [n3] "=&r" (n3), [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [cm] "r" (cm), [dst_ptr] "r" (dst_ptr),
- [vector3b] "r" (vector3b), [src_ptr] "r" (src_ptr)
- );
-
- /* Next row... */
- src_ptr += src_pixels_per_line;
- dst_ptr += pitch;
- }
- }
- else
- {
- /* 4 tap filter */
-
- vector1b = sub_pel_filters_inv_tap_4[xoffset][0];
- vector2b = sub_pel_filters_inv_tap_4[xoffset][1];
-
- for (i = output_height; i--;)
- {
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "ulw %[tp1], -1(%[src_ptr]) \n\t"
- "ulw %[tp2], 3(%[src_ptr]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- /* odd 1. pixel */
- "srl %[tn1], %[tp2], 8 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn1] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- /* clamp and store results */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "lbux %[tn1], %[Temp2](%[cm]) \n\t"
- "lbux %[tp2], %[Temp3](%[cm]) \n\t"
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "sb %[tn1], 1(%[dst_ptr]) \n\t"
- "lbux %[n2], %[Temp4](%[cm]) \n\t"
- "sb %[tp2], 2(%[dst_ptr]) \n\t"
- "sb %[n2], 3(%[dst_ptr]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tn1] "=&r" (tn1),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3),
- [n1] "=&r" (n1), [n2] "=&r" (n2), [n3] "=&r" (n3),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [cm] "r" (cm), [dst_ptr] "r" (dst_ptr),
- [src_ptr] "r" (src_ptr)
- );
- /* Next row... */
- src_ptr += src_pixels_per_line;
- dst_ptr += pitch;
- }
- }
- }
-}
-
-void vp8_filter_block2d_first_pass_8_all
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT dst_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_height,
- int xoffset,
- int pitch
-)
-{
- unsigned int i;
- int Temp1, Temp2, Temp3, Temp4;
-
- unsigned int vector4a = 64;
- unsigned int vector1b, vector2b, vector3b;
- unsigned int tp1, tp2, tn1, tn2;
- unsigned int p1, p2, p3, p4;
- unsigned int n1, n2, n3, n4;
-
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- /* if (xoffset == 0) we don't need any filtering */
- if (xoffset == 0)
- {
- for (i = 0; i < output_height; i++)
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + src_pixels_per_line);
-
- dst_ptr[0] = src_ptr[0];
- dst_ptr[1] = src_ptr[1];
- dst_ptr[2] = src_ptr[2];
- dst_ptr[3] = src_ptr[3];
- dst_ptr[4] = src_ptr[4];
- dst_ptr[5] = src_ptr[5];
- dst_ptr[6] = src_ptr[6];
- dst_ptr[7] = src_ptr[7];
-
- /* next row... */
- src_ptr += src_pixels_per_line;
- dst_ptr += 8;
- }
- }
- else
- {
- vector3b = sub_pel_filters_inv[xoffset][2];
-
- if (vector3b > 65536)
- {
- /* 6 tap filter */
-
- vector1b = sub_pel_filters_inv[xoffset][0];
- vector2b = sub_pel_filters_inv[xoffset][1];
-
- for (i = output_height; i--;)
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + src_pixels_per_line);
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "ulw %[tp1], -2(%[src_ptr]) \n\t"
- "ulw %[tp2], 2(%[src_ptr]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[p1], %[tp2] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector3b] \n\t"
-
- "balign %[tp2], %[tp1], 3 \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
- "ulw %[tn2], 3(%[src_ptr]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn2] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector3b] \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[n1], %[tn2] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "ulw %[tp1], 6(%[src_ptr]) \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[tp1] \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tn2] "=&r" (tn2),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3),
- [n1] "=&r" (n1), [n2] "=&r" (n2), [n3] "=&r" (n3),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [vector3b] "r" (vector3b),
- [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- dst_ptr[0] = cm[Temp1];
- dst_ptr[1] = cm[Temp2];
- dst_ptr[2] = cm[Temp3];
- dst_ptr[3] = cm[Temp4];
-
- /* next 4 pixels */
- __asm__ __volatile__ (
- /* even 3. pixel */
- "dpa.w.ph $ac3, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector3b] \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[p4], %[tp1] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
-
- "ulw %[tn1], 7(%[src_ptr]) \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- /* odd 3. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n2], %[tn1] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector3b] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
-
- /* odd 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[n4], %[tn1] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n4], %[vector3b] \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- : [tn1] "=&r" (tn1), [n2] "=&r" (n2),
- [p4] "=&r" (p4), [n4] "=&r" (n4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [tp1] "r" (tp1), [vector1b] "r" (vector1b), [p2] "r" (p2),
- [vector2b] "r" (vector2b), [n1] "r" (n1), [p1] "r" (p1),
- [vector4a] "r" (vector4a), [vector3b] "r" (vector3b),
- [p3] "r" (p3), [n3] "r" (n3), [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- dst_ptr[4] = cm[Temp1];
- dst_ptr[5] = cm[Temp2];
- dst_ptr[6] = cm[Temp3];
- dst_ptr[7] = cm[Temp4];
-
- src_ptr += src_pixels_per_line;
- dst_ptr += pitch;
- }
- }
- else
- {
- /* 4 tap filter */
-
- vector1b = sub_pel_filters_inv_tap_4[xoffset][0];
- vector2b = sub_pel_filters_inv_tap_4[xoffset][1];
-
- for (i = output_height; i--;)
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + src_pixels_per_line);
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "ulw %[tp1], -1(%[src_ptr]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
-
- "ulw %[tp2], 3(%[src_ptr]) \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- "balign %[tp2], %[tp1], 3 \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
-
- "ulw %[tn2], 4(%[src_ptr]) \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbr %[n3], %[tn2] \n\t"
- "preceu.ph.qbl %[n4], %[tn2] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "ulw %[tp1], 7(%[src_ptr]) \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tn2] "=&r" (tn2), [p1] "=&r" (p1), [p2] "=&r" (p2),
- [p3] "=&r" (p3), [p4] "=&r" (p4), [n1] "=&r" (n1),
- [n2] "=&r" (n2), [n3] "=&r" (n3), [n4] "=&r" (n4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- dst_ptr[0] = cm[Temp1];
- dst_ptr[1] = cm[Temp2];
- dst_ptr[2] = cm[Temp3];
- dst_ptr[3] = cm[Temp4];
-
- /* next 4 pixels */
- __asm__ __volatile__ (
- /* even 3. pixel */
- "dpa.w.ph $ac3, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector2b] \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbr %[p2], %[tp1] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector2b] \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- /* odd 3. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n4], %[vector2b] \n\t"
- "ulw %[tn1], 8(%[src_ptr]) \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
-
- /* odd 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbr %[n2], %[tn1] \n\t"
- "dpa.w.ph $ac2, %[n4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector2b] \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- : [tn1] "=&r" (tn1), [p2] "=&r" (p2), [n2] "=&r" (n2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [tp1] "r" (tp1), [p3] "r" (p3), [p4] "r" (p4),
- [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [src_ptr] "r" (src_ptr),
- [n3] "r" (n3), [n4] "r" (n4)
- );
-
- /* clamp and store results */
- dst_ptr[4] = cm[Temp1];
- dst_ptr[5] = cm[Temp2];
- dst_ptr[6] = cm[Temp3];
- dst_ptr[7] = cm[Temp4];
-
- /* next row... */
- src_ptr += src_pixels_per_line;
- dst_ptr += pitch;
- }
- }
- }
-}
-
-
-void vp8_filter_block2d_first_pass16_6tap
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT dst_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_height,
- int xoffset,
- int pitch
-)
-{
- unsigned int i;
- int Temp1, Temp2, Temp3, Temp4;
-
- unsigned int vector4a;
- unsigned int vector1b, vector2b, vector3b;
- unsigned int tp1, tp2, tn1, tn2;
- unsigned int p1, p2, p3, p4;
- unsigned int n1, n2, n3, n4;
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- vector1b = sub_pel_filters_inv[xoffset][0];
- vector2b = sub_pel_filters_inv[xoffset][1];
- vector3b = sub_pel_filters_inv[xoffset][2];
- vector4a = 64;
-
- for (i = output_height; i--;)
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + src_pixels_per_line);
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "ulw %[tp1], -2(%[src_ptr]) \n\t"
- "ulw %[tp2], 2(%[src_ptr]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[p1], %[tp2] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector3b] \n\t"
-
- "balign %[tp2], %[tp1], 3 \n\t"
- "ulw %[tn2], 3(%[src_ptr]) \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn2] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector3b] \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[n1], %[tn2] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "ulw %[tp1], 6(%[src_ptr]) \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[tp1] \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tn2] "=&r" (tn2),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3),
- [n1] "=&r" (n1), [n2] "=&r" (n2), [n3] "=&r" (n3),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [vector3b] "r" (vector3b),
- [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- dst_ptr[0] = cm[Temp1];
- dst_ptr[1] = cm[Temp2];
- dst_ptr[2] = cm[Temp3];
- dst_ptr[3] = cm[Temp4];
-
- /* next 4 pixels */
- __asm__ __volatile__ (
- /* even 3. pixel */
- "dpa.w.ph $ac3, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector3b] \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[p4], %[tp1] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "ulw %[tn1], 7(%[src_ptr]) \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- /* odd 3. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n2], %[tn1] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector3b] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
-
- /* odd 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[n4], %[tn1] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n4], %[vector3b] \n\t"
- "ulw %[tp2], 10(%[src_ptr]) \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- : [tn1] "=&r" (tn1), [tp2] "=&r" (tp2), [n2] "=&r" (n2),
- [p4] "=&r" (p4), [n4] "=&r" (n4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [tp1] "r" (tp1), [n1] "r" (n1), [p1] "r" (p1),
- [vector4a] "r" (vector4a), [p2] "r" (p2), [vector3b] "r" (vector3b),
- [p3] "r" (p3), [n3] "r" (n3), [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- dst_ptr[4] = cm[Temp1];
- dst_ptr[5] = cm[Temp2];
- dst_ptr[6] = cm[Temp3];
- dst_ptr[7] = cm[Temp4];
-
- /* next 4 pixels */
- __asm__ __volatile__ (
- /* even 5. pixel */
- "dpa.w.ph $ac3, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector3b] \n\t"
-
- /* even 6. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector3b] \n\t"
-
- "ulw %[tn1], 11(%[src_ptr]) \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- /* odd 5. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tn1] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n4], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector3b] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
-
- /* odd 6. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[n3], %[tn1] \n\t"
- "dpa.w.ph $ac2, %[n4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector3b] \n\t"
- "ulw %[tp1], 14(%[src_ptr]) \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[p4], %[tp1] \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- : [tn1] "=&r" (tn1), [tp1] "=&r" (tp1),
- [n1] "=&r" (n1), [p3] "=&r" (p3), [n3] "=&r" (n3),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [tp2] "r" (tp2), [p2] "r" (p2), [n2] "r" (n2),
- [p4] "r" (p4), [n4] "r" (n4), [p1] "r" (p1), [src_ptr] "r" (src_ptr),
- [vector4a] "r" (vector4a), [vector3b] "r" (vector3b)
- );
-
- /* clamp and store results */
- dst_ptr[8] = cm[Temp1];
- dst_ptr[9] = cm[Temp2];
- dst_ptr[10] = cm[Temp3];
- dst_ptr[11] = cm[Temp4];
-
- /* next 4 pixels */
- __asm__ __volatile__ (
- /* even 7. pixel */
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector3b] \n\t"
-
- /* even 8. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector3b] \n\t"
- "ulw %[tn1], 15(%[src_ptr]) \n\t"
- "extp %[Temp1], $ac3, 9 \n\t"
-
- /* odd 7. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "preceu.ph.qbr %[n4], %[tn1] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n4], %[vector3b] \n\t"
- "extp %[Temp3], $ac2, 9 \n\t"
-
- /* odd 8. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "preceu.ph.qbl %[n2], %[tn1] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n4], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector3b] \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
- "extp %[Temp4], $ac2, 9 \n\t"
-
- /* clamp and store results */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "lbux %[tn1], %[Temp2](%[cm]) \n\t"
- "lbux %[p2], %[Temp3](%[cm]) \n\t"
- "sb %[tp1], 12(%[dst_ptr]) \n\t"
- "sb %[tn1], 13(%[dst_ptr]) \n\t"
- "lbux %[n2], %[Temp4](%[cm]) \n\t"
- "sb %[p2], 14(%[dst_ptr]) \n\t"
- "sb %[n2], 15(%[dst_ptr]) \n\t"
-
- : [tn1] "=&r" (tn1), [p2] "=&r" (p2), [n2] "=&r" (n2), [n4] "=&r" (n4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [tp1] "r" (tp1), [p4] "r" (p4), [n1] "r" (n1), [p1] "r" (p1),
- [vector4a] "r" (vector4a), [vector3b] "r" (vector3b), [p3] "r" (p3),
- [n3] "r" (n3), [src_ptr] "r" (src_ptr),
- [cm] "r" (cm), [dst_ptr] "r" (dst_ptr)
- );
-
- src_ptr += src_pixels_per_line;
- dst_ptr += pitch;
- }
-}
-
-
-void vp8_filter_block2d_first_pass16_0
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT output_ptr,
- unsigned int src_pixels_per_line
-)
-{
- int Temp1, Temp2, Temp3, Temp4;
- int i;
-
- /* prefetch src_ptr data to cache memory */
- prefetch_store(output_ptr + 32);
-
- /* copy memory from src buffer to dst buffer */
- for (i = 0; i < 7; i++)
- {
- __asm__ __volatile__ (
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "ulw %[Temp3], 8(%[src_ptr]) \n\t"
- "ulw %[Temp4], 12(%[src_ptr]) \n\t"
- "sw %[Temp1], 0(%[output_ptr]) \n\t"
- "sw %[Temp2], 4(%[output_ptr]) \n\t"
- "sw %[Temp3], 8(%[output_ptr]) \n\t"
- "sw %[Temp4], 12(%[output_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [Temp4] "=&r" (Temp4), [src_ptr] "+r" (src_ptr)
- : [src_pixels_per_line] "r" (src_pixels_per_line),
- [output_ptr] "r" (output_ptr)
- );
-
- __asm__ __volatile__ (
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "ulw %[Temp3], 8(%[src_ptr]) \n\t"
- "ulw %[Temp4], 12(%[src_ptr]) \n\t"
- "sw %[Temp1], 16(%[output_ptr]) \n\t"
- "sw %[Temp2], 20(%[output_ptr]) \n\t"
- "sw %[Temp3], 24(%[output_ptr]) \n\t"
- "sw %[Temp4], 28(%[output_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [Temp4] "=&r" (Temp4), [src_ptr] "+r" (src_ptr)
- : [src_pixels_per_line] "r" (src_pixels_per_line),
- [output_ptr] "r" (output_ptr)
- );
-
- __asm__ __volatile__ (
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "ulw %[Temp3], 8(%[src_ptr]) \n\t"
- "ulw %[Temp4], 12(%[src_ptr]) \n\t"
- "sw %[Temp1], 32(%[output_ptr]) \n\t"
- "sw %[Temp2], 36(%[output_ptr]) \n\t"
- "sw %[Temp3], 40(%[output_ptr]) \n\t"
- "sw %[Temp4], 44(%[output_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [Temp4] "=&r" (Temp4), [src_ptr] "+r" (src_ptr)
- : [src_pixels_per_line] "r" (src_pixels_per_line),
- [output_ptr] "r" (output_ptr)
- );
-
- output_ptr += 48;
- }
-}
-
-
-void vp8_filter_block2d_first_pass16_4tap
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_width,
- unsigned int output_height,
- int xoffset,
- int yoffset,
- unsigned char *RESTRICT dst_ptr,
- int pitch
-)
-{
- unsigned int i, j;
- int Temp1, Temp2, Temp3, Temp4;
-
- unsigned int vector4a;
- int vector1b, vector2b;
- unsigned int tp1, tp2, tp3, tn1;
- unsigned int p1, p2, p3;
- unsigned int n1, n2, n3;
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- vector4a = 64;
-
- vector1b = sub_pel_filters_inv_tap_4[xoffset][0];
- vector2b = sub_pel_filters_inv_tap_4[xoffset][1];
-
- /* if (yoffset == 0) don't need temp buffer, data will be stored in dst_ptr */
- if (yoffset == 0)
- {
- output_height -= 5;
- src_ptr += (src_pixels_per_line + src_pixels_per_line);
-
- for (i = output_height; i--;)
- {
- __asm__ __volatile__ (
- "ulw %[tp3], -1(%[src_ptr]) \n\t"
- : [tp3] "=&r" (tp3)
- : [src_ptr] "r" (src_ptr)
- );
-
- /* processing 4 adjacent pixels */
- for (j = 0; j < 16; j += 4)
- {
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "ulw %[tp2], 3(%[src_ptr]) \n\t"
- "move %[tp1], %[tp3] \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $0, $ac3 \n\t"
- "move %[tp3], %[tp2] \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $0, $ac2 \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "extr.w %[Temp1], $ac3, 7 \n\t"
-
- /* odd 1. pixel */
- "ulw %[tn1], 4(%[src_ptr]) \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $0, $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn1] \n\t"
- "extr.w %[Temp3], $ac2, 7 \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $0, $ac2 \n\t"
- "extr.w %[Temp2], $ac3, 7 \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "extr.w %[Temp4], $ac2, 7 \n\t"
-
- /* clamp and store results */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "lbux %[tn1], %[Temp2](%[cm]) \n\t"
- "lbux %[tp2], %[Temp3](%[cm]) \n\t"
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "sb %[tn1], 1(%[dst_ptr]) \n\t"
- "lbux %[n2], %[Temp4](%[cm]) \n\t"
- "sb %[tp2], 2(%[dst_ptr]) \n\t"
- "sb %[n2], 3(%[dst_ptr]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tp3] "=&r" (tp3),
- [tn1] "=&r" (tn1), [p1] "=&r" (p1), [p2] "=&r" (p2),
- [n1] "=&r" (n1), [n2] "=&r" (n2), [n3] "=&r" (n3),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [p3] "=&r" (p3),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [cm] "r" (cm), [dst_ptr] "r" (dst_ptr),
- [src_ptr] "r" (src_ptr)
- );
-
- src_ptr += 4;
- }
-
- /* Next row... */
- src_ptr += src_pixels_per_line - 16;
- dst_ptr += pitch;
- }
- }
- else
- {
- for (i = output_height; i--;)
- {
- /* processing 4 adjacent pixels */
- for (j = 0; j < 16; j += 4)
- {
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "ulw %[tp1], -1(%[src_ptr]) \n\t"
- "ulw %[tp2], 3(%[src_ptr]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $0, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $0, $ac2 \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "extr.w %[Temp1], $ac3, 7 \n\t"
-
- /* odd 1. pixel */
- "ulw %[tn1], 4(%[src_ptr]) \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $0, $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn1] \n\t"
- "extr.w %[Temp3], $ac2, 7 \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $0, $ac2 \n\t"
- "extr.w %[Temp2], $ac3, 7 \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "extr.w %[Temp4], $ac2, 7 \n\t"
-
- /* clamp and store results */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "lbux %[tn1], %[Temp2](%[cm]) \n\t"
- "lbux %[tp2], %[Temp3](%[cm]) \n\t"
- "sb %[tp1], 0(%[output_ptr]) \n\t"
- "sb %[tn1], 1(%[output_ptr]) \n\t"
- "lbux %[n2], %[Temp4](%[cm]) \n\t"
- "sb %[tp2], 2(%[output_ptr]) \n\t"
- "sb %[n2], 3(%[output_ptr]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tn1] "=&r" (tn1),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3),
- [n1] "=&r" (n1), [n2] "=&r" (n2), [n3] "=&r" (n3),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector4a] "r" (vector4a), [cm] "r" (cm),
- [output_ptr] "r" (output_ptr), [src_ptr] "r" (src_ptr)
- );
-
- src_ptr += 4;
- }
-
- /* next row... */
- src_ptr += src_pixels_per_line;
- output_ptr += output_width;
- }
- }
-}
-
-
-void vp8_filter_block2d_second_pass4
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT output_ptr,
- int output_pitch,
- int yoffset
-)
-{
- unsigned int i;
-
- int Temp1, Temp2, Temp3, Temp4;
- unsigned int vector1b, vector2b, vector3b, vector4a;
-
- unsigned char src_ptr_l2;
- unsigned char src_ptr_l1;
- unsigned char src_ptr_0;
- unsigned char src_ptr_r1;
- unsigned char src_ptr_r2;
- unsigned char src_ptr_r3;
-
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- vector4a = 64;
-
- /* load filter coefficients */
- vector1b = sub_pel_filterss[yoffset][0];
- vector2b = sub_pel_filterss[yoffset][2];
- vector3b = sub_pel_filterss[yoffset][1];
-
- if (vector1b)
- {
- /* 6 tap filter */
-
- for (i = 2; i--;)
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr);
-
- /* do not allow compiler to reorder instructions */
- __asm__ __volatile__ (
- ".set noreorder \n\t"
- :
- :
- );
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l2], -8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 12(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 13(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 14(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 15(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp3], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp4], $ac1, 9 \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2),
- [src_ptr_l2] "=&r" (src_ptr_l2), [src_ptr_r3] "=&r" (src_ptr_r3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4a] "r" (vector4a),
- [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- output_ptr[0] = cm[Temp1];
- output_ptr[1] = cm[Temp2];
- output_ptr[2] = cm[Temp3];
- output_ptr[3] = cm[Temp4];
-
- output_ptr += output_pitch;
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l2], -4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 12(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 16(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 13(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 17(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], 2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 14(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 18(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], 3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 15(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 19(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp3], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp4], $ac1, 9 \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2),
- [src_ptr_l2] "=&r" (src_ptr_l2), [src_ptr_r3] "=&r" (src_ptr_r3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4a] "r" (vector4a),
- [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- output_ptr[0] = cm[Temp1];
- output_ptr[1] = cm[Temp2];
- output_ptr[2] = cm[Temp3];
- output_ptr[3] = cm[Temp4];
-
- src_ptr += 8;
- output_ptr += output_pitch;
- }
- }
- else
- {
- /* 4 tap filter */
-
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr);
-
- for (i = 2; i--;)
- {
- /* do not allow compiler to reorder instructions */
- __asm__ __volatile__ (
- ".set noreorder \n\t"
- :
- :
- );
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l1], -4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 8(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 9(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 10(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 11(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp3], $ac0, 9 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp4], $ac1, 9 \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [vector4a] "r" (vector4a), [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- output_ptr[0] = cm[Temp1];
- output_ptr[1] = cm[Temp2];
- output_ptr[2] = cm[Temp3];
- output_ptr[3] = cm[Temp4];
-
- output_ptr += output_pitch;
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l1], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 12(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 13(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], 2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 14(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], 3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 15(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp3], $ac0, 9 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp4], $ac1, 9 \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=r" (Temp4),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [vector4a] "r" (vector4a), [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- output_ptr[0] = cm[Temp1];
- output_ptr[1] = cm[Temp2];
- output_ptr[2] = cm[Temp3];
- output_ptr[3] = cm[Temp4];
-
- src_ptr += 8;
- output_ptr += output_pitch;
- }
- }
-}
-
-
-void vp8_filter_block2d_second_pass_8
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT output_ptr,
- int output_pitch,
- unsigned int output_height,
- unsigned int output_width,
- unsigned int yoffset
-)
-{
- unsigned int i;
-
- int Temp1, Temp2, Temp3, Temp4, Temp5, Temp6, Temp7, Temp8;
- unsigned int vector1b, vector2b, vector3b, vector4a;
-
- unsigned char src_ptr_l2;
- unsigned char src_ptr_l1;
- unsigned char src_ptr_0;
- unsigned char src_ptr_r1;
- unsigned char src_ptr_r2;
- unsigned char src_ptr_r3;
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- vector4a = 64;
-
- vector1b = sub_pel_filterss[yoffset][0];
- vector2b = sub_pel_filterss[yoffset][2];
- vector3b = sub_pel_filterss[yoffset][1];
-
- if (vector1b)
- {
- /* 6 tap filter */
-
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr);
-
- for (i = output_height; i--;)
- {
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l2], -16(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 16(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 24(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -15(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 17(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 25(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -14(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 18(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 26(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -13(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 19(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 27(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp3], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2),
- [src_ptr_l2] "=&r" (src_ptr_l2), [src_ptr_r3] "=&r" (src_ptr_r3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4a] "r" (vector4a),
- [src_ptr] "r" (src_ptr)
- );
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l2], -12(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 12(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 20(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 28(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp4], $ac1, 9 \n\t"
-
- "lbu %[src_ptr_l2], -11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 13(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 21(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 29(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp5], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 14(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 22(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 30(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp6], $ac3, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 15(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 23(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 31(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp7], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp8], $ac1, 9 \n\t"
-
- : [Temp4] "=&r" (Temp4), [Temp5] "=&r" (Temp5),
- [Temp6] "=&r" (Temp6), [Temp7] "=&r" (Temp7), [Temp8] "=r" (Temp8),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2),
- [src_ptr_l2] "=&r" (src_ptr_l2),[src_ptr_r3] "=&r" (src_ptr_r3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4a] "r" (vector4a),
- [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- output_ptr[0] = cm[Temp1];
- output_ptr[1] = cm[Temp2];
- output_ptr[2] = cm[Temp3];
- output_ptr[3] = cm[Temp4];
- output_ptr[4] = cm[Temp5];
- output_ptr[5] = cm[Temp6];
- output_ptr[6] = cm[Temp7];
- output_ptr[7] = cm[Temp8];
-
- src_ptr += 8;
- output_ptr += output_pitch;
- }
- }
- else
- {
- /* 4 tap filter */
-
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr);
-
- for (i = output_height; i--;)
- {
- __asm__ __volatile__ (
- "lbu %[src_ptr_l1], -8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 16(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- : [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [vector4a] "r" (vector4a), [src_ptr] "r" (src_ptr)
- );
-
- __asm__ __volatile__ (
- "lbu %[src_ptr_l1], -7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 17(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- : [Temp1] "=r" (Temp1),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [vector4a] "r" (vector4a), [src_ptr] "r" (src_ptr)
- );
-
- src_ptr_l1 = src_ptr[-6];
- src_ptr_0 = src_ptr[2];
- src_ptr_r1 = src_ptr[10];
- src_ptr_r2 = src_ptr[18];
-
- __asm__ __volatile__ (
- "mtlo %[vector4a], $ac0 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
-
- : [Temp2] "=r" (Temp2)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [src_ptr_l1] "r" (src_ptr_l1), [src_ptr_0] "r" (src_ptr_0),
- [src_ptr_r1] "r" (src_ptr_r1), [src_ptr_r2] "r" (src_ptr_r2),
- [vector4a] "r" (vector4a)
- );
-
- src_ptr_l1 = src_ptr[-5];
- src_ptr_0 = src_ptr[3];
- src_ptr_r1 = src_ptr[11];
- src_ptr_r2 = src_ptr[19];
-
- __asm__ __volatile__ (
- "mtlo %[vector4a], $ac1 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp3], $ac0, 9 \n\t"
-
- : [Temp3] "=r" (Temp3)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [src_ptr_l1] "r" (src_ptr_l1), [src_ptr_0] "r" (src_ptr_0),
- [src_ptr_r1] "r" (src_ptr_r1), [src_ptr_r2] "r" (src_ptr_r2),
- [vector4a] "r" (vector4a)
- );
-
- src_ptr_l1 = src_ptr[-4];
- src_ptr_0 = src_ptr[4];
- src_ptr_r1 = src_ptr[12];
- src_ptr_r2 = src_ptr[20];
-
- __asm__ __volatile__ (
- "mtlo %[vector4a], $ac2 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp4], $ac1, 9 \n\t"
-
- : [Temp4] "=r" (Temp4)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [src_ptr_l1] "r" (src_ptr_l1), [src_ptr_0] "r" (src_ptr_0),
- [src_ptr_r1] "r" (src_ptr_r1), [src_ptr_r2] "r" (src_ptr_r2),
- [vector4a] "r" (vector4a)
- );
-
- src_ptr_l1 = src_ptr[-3];
- src_ptr_0 = src_ptr[5];
- src_ptr_r1 = src_ptr[13];
- src_ptr_r2 = src_ptr[21];
-
- __asm__ __volatile__ (
- "mtlo %[vector4a], $ac3 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp5], $ac2, 9 \n\t"
-
- : [Temp5] "=&r" (Temp5)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [src_ptr_l1] "r" (src_ptr_l1), [src_ptr_0] "r" (src_ptr_0),
- [src_ptr_r1] "r" (src_ptr_r1), [src_ptr_r2] "r" (src_ptr_r2),
- [vector4a] "r" (vector4a)
- );
-
- src_ptr_l1 = src_ptr[-2];
- src_ptr_0 = src_ptr[6];
- src_ptr_r1 = src_ptr[14];
- src_ptr_r2 = src_ptr[22];
-
- __asm__ __volatile__ (
- "mtlo %[vector4a], $ac0 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp6], $ac3, 9 \n\t"
-
- : [Temp6] "=r" (Temp6)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [src_ptr_l1] "r" (src_ptr_l1), [src_ptr_0] "r" (src_ptr_0),
- [src_ptr_r1] "r" (src_ptr_r1), [src_ptr_r2] "r" (src_ptr_r2),
- [vector4a] "r" (vector4a)
- );
-
- src_ptr_l1 = src_ptr[-1];
- src_ptr_0 = src_ptr[7];
- src_ptr_r1 = src_ptr[15];
- src_ptr_r2 = src_ptr[23];
-
- __asm__ __volatile__ (
- "mtlo %[vector4a], $ac1 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp7], $ac0, 9 \n\t"
- "extp %[Temp8], $ac1, 9 \n\t"
-
- : [Temp7] "=&r" (Temp7), [Temp8] "=r" (Temp8)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [src_ptr_l1] "r" (src_ptr_l1), [src_ptr_0] "r" (src_ptr_0),
- [src_ptr_r1] "r" (src_ptr_r1), [src_ptr_r2] "r" (src_ptr_r2),
- [vector4a] "r" (vector4a)
- );
-
- /* clamp and store results */
- output_ptr[0] = cm[Temp1];
- output_ptr[1] = cm[Temp2];
- output_ptr[2] = cm[Temp3];
- output_ptr[3] = cm[Temp4];
- output_ptr[4] = cm[Temp5];
- output_ptr[5] = cm[Temp6];
- output_ptr[6] = cm[Temp7];
- output_ptr[7] = cm[Temp8];
-
- src_ptr += 8;
- output_ptr += output_pitch;
- }
- }
-}
-
-
-void vp8_filter_block2d_second_pass161
-(
- unsigned char *RESTRICT src_ptr,
- unsigned char *RESTRICT output_ptr,
- int output_pitch,
- const unsigned short *vp8_filter
-)
-{
- unsigned int i, j;
-
- int Temp1, Temp2, Temp3, Temp4, Temp5, Temp6, Temp7, Temp8;
- unsigned int vector4a;
- unsigned int vector1b, vector2b, vector3b;
-
- unsigned char src_ptr_l2;
- unsigned char src_ptr_l1;
- unsigned char src_ptr_0;
- unsigned char src_ptr_r1;
- unsigned char src_ptr_r2;
- unsigned char src_ptr_r3;
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- vector4a = 64;
-
- vector1b = vp8_filter[0];
- vector2b = vp8_filter[2];
- vector3b = vp8_filter[1];
-
- if (vector1b == 0)
- {
- /* 4 tap filter */
-
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + 16);
-
- for (i = 16; i--;)
- {
- /* unrolling for loop */
- for (j = 0; j < 16; j += 8)
- {
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l1], -16(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 16(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 32(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -15(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 17(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 33(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -14(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 18(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 34(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp2], $ac3, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -13(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 19(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 35(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp3], $ac1, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -12(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 20(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 36(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "extp %[Temp4], $ac3, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 21(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 37(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp5], $ac2, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 22(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 38(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp6], $ac3, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l1], -9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 23(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 39(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp7], $ac1, 9 \n\t"
-
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp8], $ac3, 9 \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4),
- [Temp5] "=&r" (Temp5), [Temp6] "=&r" (Temp6),
- [Temp7] "=&r" (Temp7), [Temp8] "=r" (Temp8),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2)
- : [vector2b] "r" (vector2b), [vector3b] "r" (vector3b),
- [vector4a] "r" (vector4a), [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- output_ptr[j] = cm[Temp1];
- output_ptr[j + 1] = cm[Temp2];
- output_ptr[j + 2] = cm[Temp3];
- output_ptr[j + 3] = cm[Temp4];
- output_ptr[j + 4] = cm[Temp5];
- output_ptr[j + 5] = cm[Temp6];
- output_ptr[j + 6] = cm[Temp7];
- output_ptr[j + 7] = cm[Temp8];
-
- src_ptr += 8;
- }
-
- output_ptr += output_pitch;
- }
- }
- else
- {
- /* 4 tap filter */
-
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + 16);
-
- /* unroll for loop */
- for (i = 16; i--;)
- {
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l2], -32(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -16(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 0(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 16(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 32(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 48(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -31(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -15(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 17(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 33(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 49(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -30(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -14(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 18(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 34(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 50(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp2], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -29(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -13(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 19(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 35(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 51(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp3], $ac1, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -28(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -12(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 20(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 36(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 52(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "extp %[Temp4], $ac3, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -27(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 21(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 37(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 53(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp5], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -26(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 22(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 38(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 54(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp6], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -25(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 23(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 39(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 55(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp7], $ac1, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp8], $ac3, 9 \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4),
- [Temp5] "=&r" (Temp5), [Temp6] "=&r" (Temp6),
- [Temp7] "=&r" (Temp7), [Temp8] "=r" (Temp8),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2),
- [src_ptr_l2] "=&r" (src_ptr_l2),[src_ptr_r3] "=&r" (src_ptr_r3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4a] "r" (vector4a),
- [src_ptr] "r" (src_ptr)
- );
-
- /* clamp and store results */
- output_ptr[0] = cm[Temp1];
- output_ptr[1] = cm[Temp2];
- output_ptr[2] = cm[Temp3];
- output_ptr[3] = cm[Temp4];
- output_ptr[4] = cm[Temp5];
- output_ptr[5] = cm[Temp6];
- output_ptr[6] = cm[Temp7];
- output_ptr[7] = cm[Temp8];
-
- /* apply filter with vectors pairs */
- __asm__ __volatile__ (
- "lbu %[src_ptr_l2], -24(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 8(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 24(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 40(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 56(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -23(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -7(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 9(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 25(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 41(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 57(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp1], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -22(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -6(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 10(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 26(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 42(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 58(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp2], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -21(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -5(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 11(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 27(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 43(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 59(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp3], $ac1, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -20(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -4(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 12(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 28(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 44(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 60(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "extp %[Temp4], $ac3, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac2, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac2, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -19(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -3(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 13(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 29(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 45(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 61(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac0 \n\t"
- "extp %[Temp5], $ac2, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac0, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac0, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -18(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -2(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 14(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 30(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 46(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 62(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "extp %[Temp6], $ac0, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac1, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac1, %[src_ptr_l1], %[vector3b] \n\t"
-
- "lbu %[src_ptr_l2], -17(%[src_ptr]) \n\t"
- "lbu %[src_ptr_l1], -1(%[src_ptr]) \n\t"
- "lbu %[src_ptr_0], 15(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r1], 31(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r2], 47(%[src_ptr]) \n\t"
- "lbu %[src_ptr_r3], 63(%[src_ptr]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "extp %[Temp7], $ac1, 9 \n\t"
-
- "append %[src_ptr_l2], %[src_ptr_r3], 8 \n\t"
- "append %[src_ptr_0], %[src_ptr_r1], 8 \n\t"
- "append %[src_ptr_l1], %[src_ptr_r2], 8 \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_l2], %[vector1b] \n\t"
- "dpau.h.qbr $ac3, %[src_ptr_0], %[vector2b] \n\t"
- "dpsu.h.qbr $ac3, %[src_ptr_l1], %[vector3b] \n\t"
- "extp %[Temp8], $ac3, 9 \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4),
- [Temp5] "=&r" (Temp5), [Temp6] "=&r" (Temp6),
- [Temp7] "=&r" (Temp7), [Temp8] "=r" (Temp8),
- [src_ptr_l1] "=&r" (src_ptr_l1), [src_ptr_0] "=&r" (src_ptr_0),
- [src_ptr_r1] "=&r" (src_ptr_r1), [src_ptr_r2] "=&r" (src_ptr_r2),
- [src_ptr_l2] "=&r" (src_ptr_l2), [src_ptr_r3] "=&r" (src_ptr_r3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4a] "r" (vector4a),
- [src_ptr] "r" (src_ptr)
- );
-
- src_ptr += 16;
- output_ptr[8] = cm[Temp1];
- output_ptr[9] = cm[Temp2];
- output_ptr[10] = cm[Temp3];
- output_ptr[11] = cm[Temp4];
- output_ptr[12] = cm[Temp5];
- output_ptr[13] = cm[Temp6];
- output_ptr[14] = cm[Temp7];
- output_ptr[15] = cm[Temp8];
-
- output_ptr += output_pitch;
- }
- }
-}
-
-
-void vp8_sixtap_predict4x4_dspr2
-(
- unsigned char *RESTRICT src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *RESTRICT dst_ptr,
- int dst_pitch
-)
-{
- unsigned char FData[9 * 4]; /* Temp data bufffer used in filtering */
- unsigned int pos = 16;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- if (yoffset)
- {
- /* First filter 1-D horizontally... */
- vp8_filter_block2d_first_pass_4(src_ptr - (2 * src_pixels_per_line), FData,
- src_pixels_per_line, 9, xoffset, 4);
- /* then filter verticaly... */
- vp8_filter_block2d_second_pass4(FData + 8, dst_ptr, dst_pitch, yoffset);
- }
- else
- /* if (yoffsset == 0) vp8_filter_block2d_first_pass save data to dst_ptr */
- vp8_filter_block2d_first_pass_4(src_ptr, dst_ptr, src_pixels_per_line,
- 4, xoffset, dst_pitch);
-}
-
-
-void vp8_sixtap_predict8x8_dspr2
-(
- unsigned char *RESTRICT src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *RESTRICT dst_ptr,
- int dst_pitch
-)
-{
-
- unsigned char FData[13 * 8]; /* Temp data bufffer used in filtering */
- unsigned int pos, Temp1, Temp2;
-
- pos = 16;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- if (yoffset)
- {
-
- src_ptr = src_ptr - (2 * src_pixels_per_line);
-
- if (xoffset)
- /* filter 1-D horizontally... */
- vp8_filter_block2d_first_pass_8_all(src_ptr, FData, src_pixels_per_line,
- 13, xoffset, 8);
-
- else
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + 2 * src_pixels_per_line);
-
- __asm__ __volatile__ (
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 0(%[FData]) \n\t"
- "sw %[Temp2], 4(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 8(%[FData]) \n\t"
- "sw %[Temp2], 12(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 16(%[FData]) \n\t"
- "sw %[Temp2], 20(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 24(%[FData]) \n\t"
- "sw %[Temp2], 28(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 32(%[FData]) \n\t"
- "sw %[Temp2], 36(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 40(%[FData]) \n\t"
- "sw %[Temp2], 44(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 48(%[FData]) \n\t"
- "sw %[Temp2], 52(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 56(%[FData]) \n\t"
- "sw %[Temp2], 60(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 64(%[FData]) \n\t"
- "sw %[Temp2], 68(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 72(%[FData]) \n\t"
- "sw %[Temp2], 76(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 80(%[FData]) \n\t"
- "sw %[Temp2], 84(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 88(%[FData]) \n\t"
- "sw %[Temp2], 92(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 96(%[FData]) \n\t"
- "sw %[Temp2], 100(%[FData]) \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2)
- : [FData] "r" (FData), [src_ptr] "r" (src_ptr),
- [src_pixels_per_line] "r" (src_pixels_per_line)
- );
- }
-
- /* filter verticaly... */
- vp8_filter_block2d_second_pass_8(FData + 16, dst_ptr, dst_pitch, 8, 8, yoffset);
- }
-
- /* if (yoffsset == 0) vp8_filter_block2d_first_pass save data to dst_ptr */
- else
- {
- if (xoffset)
- vp8_filter_block2d_first_pass_8_all(src_ptr, dst_ptr, src_pixels_per_line,
- 8, xoffset, dst_pitch);
-
- else
- {
- /* copy from src buffer to dst buffer */
- __asm__ __volatile__ (
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 0(%[dst_ptr]) \n\t"
- "sw %[Temp2], 4(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 8(%[dst_ptr]) \n\t"
- "sw %[Temp2], 12(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 16(%[dst_ptr]) \n\t"
- "sw %[Temp2], 20(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 24(%[dst_ptr]) \n\t"
- "sw %[Temp2], 28(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 32(%[dst_ptr]) \n\t"
- "sw %[Temp2], 36(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 40(%[dst_ptr]) \n\t"
- "sw %[Temp2], 44(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 48(%[dst_ptr]) \n\t"
- "sw %[Temp2], 52(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 56(%[dst_ptr]) \n\t"
- "sw %[Temp2], 60(%[dst_ptr]) \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2)
- : [dst_ptr] "r" (dst_ptr), [src_ptr] "r" (src_ptr),
- [src_pixels_per_line] "r" (src_pixels_per_line)
- );
- }
- }
-}
-
-
-void vp8_sixtap_predict8x4_dspr2
-(
- unsigned char *RESTRICT src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *RESTRICT dst_ptr,
- int dst_pitch
-)
-{
- unsigned char FData[9 * 8]; /* Temp data bufffer used in filtering */
- unsigned int pos, Temp1, Temp2;
-
- pos = 16;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- if (yoffset)
- {
-
- src_ptr = src_ptr - (2 * src_pixels_per_line);
-
- if (xoffset)
- /* filter 1-D horizontally... */
- vp8_filter_block2d_first_pass_8_all(src_ptr, FData, src_pixels_per_line,
- 9, xoffset, 8);
-
- else
- {
- /* prefetch src_ptr data to cache memory */
- prefetch_load(src_ptr + 2 * src_pixels_per_line);
-
- __asm__ __volatile__ (
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 0(%[FData]) \n\t"
- "sw %[Temp2], 4(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 8(%[FData]) \n\t"
- "sw %[Temp2], 12(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 16(%[FData]) \n\t"
- "sw %[Temp2], 20(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 24(%[FData]) \n\t"
- "sw %[Temp2], 28(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 32(%[FData]) \n\t"
- "sw %[Temp2], 36(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 40(%[FData]) \n\t"
- "sw %[Temp2], 44(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 48(%[FData]) \n\t"
- "sw %[Temp2], 52(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 56(%[FData]) \n\t"
- "sw %[Temp2], 60(%[FData]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 64(%[FData]) \n\t"
- "sw %[Temp2], 68(%[FData]) \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2)
- : [FData] "r" (FData), [src_ptr] "r" (src_ptr),
- [src_pixels_per_line] "r" (src_pixels_per_line)
- );
- }
-
- /* filter verticaly... */
- vp8_filter_block2d_second_pass_8(FData + 16, dst_ptr, dst_pitch, 4, 8, yoffset);
- }
-
- /* if (yoffsset == 0) vp8_filter_block2d_first_pass save data to dst_ptr */
- else
- {
- if (xoffset)
- vp8_filter_block2d_first_pass_8_all(src_ptr, dst_ptr, src_pixels_per_line,
- 4, xoffset, dst_pitch);
-
- else
- {
- /* copy from src buffer to dst buffer */
- __asm__ __volatile__ (
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 0(%[dst_ptr]) \n\t"
- "sw %[Temp2], 4(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 8(%[dst_ptr]) \n\t"
- "sw %[Temp2], 12(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 16(%[dst_ptr]) \n\t"
- "sw %[Temp2], 20(%[dst_ptr]) \n\t"
- "addu %[src_ptr], %[src_ptr], %[src_pixels_per_line] \n\t"
-
- "ulw %[Temp1], 0(%[src_ptr]) \n\t"
- "ulw %[Temp2], 4(%[src_ptr]) \n\t"
- "sw %[Temp1], 24(%[dst_ptr]) \n\t"
- "sw %[Temp2], 28(%[dst_ptr]) \n\t"
-
- : [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2)
- : [dst_ptr] "r" (dst_ptr), [src_ptr] "r" (src_ptr),
- [src_pixels_per_line] "r" (src_pixels_per_line)
- );
- }
- }
-}
-
-
-void vp8_sixtap_predict16x16_dspr2
-(
- unsigned char *RESTRICT src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *RESTRICT dst_ptr,
- int dst_pitch
-)
-{
- const unsigned short *VFilter;
- unsigned char FData[21 * 16]; /* Temp data bufffer used in filtering */
- unsigned int pos;
-
- VFilter = sub_pel_filterss[yoffset];
-
- pos = 16;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- if (yoffset)
- {
-
- src_ptr = src_ptr - (2 * src_pixels_per_line);
-
- switch (xoffset)
- {
- /* filter 1-D horizontally... */
- case 2:
- case 4:
- case 6:
- /* 6 tap filter */
- vp8_filter_block2d_first_pass16_6tap(src_ptr, FData, src_pixels_per_line,
- 21, xoffset, 16);
- break;
-
- case 0:
- /* only copy buffer */
- vp8_filter_block2d_first_pass16_0(src_ptr, FData, src_pixels_per_line);
- break;
-
- case 1:
- case 3:
- case 5:
- case 7:
- /* 4 tap filter */
- vp8_filter_block2d_first_pass16_4tap(src_ptr, FData, src_pixels_per_line, 16,
- 21, xoffset, yoffset, dst_ptr, dst_pitch);
- break;
- }
-
- /* filter verticaly... */
- vp8_filter_block2d_second_pass161(FData + 32, dst_ptr, dst_pitch, VFilter);
- }
- else
- {
- /* if (yoffsset == 0) vp8_filter_block2d_first_pass save data to dst_ptr */
- switch (xoffset)
- {
- case 2:
- case 4:
- case 6:
- /* 6 tap filter */
- vp8_filter_block2d_first_pass16_6tap(src_ptr, dst_ptr, src_pixels_per_line,
- 16, xoffset, dst_pitch);
- break;
-
- case 1:
- case 3:
- case 5:
- case 7:
- /* 4 tap filter */
- vp8_filter_block2d_first_pass16_4tap(src_ptr, dst_ptr, src_pixels_per_line, 16,
- 21, xoffset, yoffset, dst_ptr, dst_pitch);
- break;
- }
- }
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idct_blk_dspr2.c b/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idct_blk_dspr2.c
deleted file mode 100644
index ab938cd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idct_blk_dspr2.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-
-#if HAVE_DSPR2
-
-void vp8_dequant_idct_add_y_block_dspr2
-(short *q, short *dq,
- unsigned char *dst, int stride, char *eobs)
-{
- int i, j;
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- if (*eobs++ > 1)
- vp8_dequant_idct_add_dspr2(q, dq, dst, stride);
- else
- {
- vp8_dc_only_idct_add_dspr2(q[0]*dq[0], dst, stride, dst, stride);
- ((int *)q)[0] = 0;
- }
-
- q += 16;
- dst += 4;
- }
-
- dst += 4 * stride - 16;
- }
-}
-
-void vp8_dequant_idct_add_uv_block_dspr2
-(short *q, short *dq,
- unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
-{
- int i, j;
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- if (*eobs++ > 1)
- vp8_dequant_idct_add_dspr2(q, dq, dstu, stride);
- else
- {
- vp8_dc_only_idct_add_dspr2(q[0]*dq[0], dstu, stride, dstu, stride);
- ((int *)q)[0] = 0;
- }
-
- q += 16;
- dstu += 4;
- }
-
- dstu += 4 * stride - 8;
- }
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- if (*eobs++ > 1)
- vp8_dequant_idct_add_dspr2(q, dq, dstv, stride);
- else
- {
- vp8_dc_only_idct_add_dspr2(q[0]*dq[0], dstv, stride, dstv, stride);
- ((int *)q)[0] = 0;
- }
-
- q += 16;
- dstv += 4;
- }
-
- dstv += 4 * stride - 8;
- }
-}
-
-#endif
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idctllm_dspr2.c b/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idctllm_dspr2.c
deleted file mode 100644
index 2eff710..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/idctllm_dspr2.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp8_rtcd.h"
-
-#if HAVE_DSPR2
-#define CROP_WIDTH 256
-
-/******************************************************************************
- * Notes:
- *
- * This implementation makes use of 16 bit fixed point version of two multiply
- * constants:
- * 1. sqrt(2) * cos (pi/8)
- * 2. sqrt(2) * sin (pi/8)
- * Since the first constant is bigger than 1, to maintain the same 16 bit
- * fixed point precision as the second one, we use a trick of
- * x * a = x + x*(a-1)
- * so
- * x * sqrt(2) * cos (pi/8) = x + x * (sqrt(2) *cos(pi/8)-1).
- ****************************************************************************/
-extern unsigned char ff_cropTbl[256 + 2 * CROP_WIDTH];
-static const int cospi8sqrt2minus1 = 20091;
-static const int sinpi8sqrt2 = 35468;
-
-inline void prefetch_load_short(short *src)
-{
- __asm__ __volatile__ (
- "pref 0, 0(%[src]) \n\t"
- :
- : [src] "r" (src)
- );
-}
-
-void vp8_short_idct4x4llm_dspr2(short *input, unsigned char *pred_ptr,
- int pred_stride, unsigned char *dst_ptr,
- int dst_stride)
-{
- int r, c;
- int a1, b1, c1, d1;
- short output[16];
- short *ip = input;
- short *op = output;
- int temp1, temp2;
- int shortpitch = 4;
-
- int c2, d2;
- int temp3, temp4;
- unsigned char *cm = ff_cropTbl + CROP_WIDTH;
-
- /* prepare data for load */
- prefetch_load_short(ip + 8);
-
- /* first loop is unrolled */
- a1 = ip[0] + ip[8];
- b1 = ip[0] - ip[8];
-
- temp1 = (ip[4] * sinpi8sqrt2) >> 16;
- temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1) >> 16);
- c1 = temp1 - temp2;
-
- temp1 = ip[4] + ((ip[4] * cospi8sqrt2minus1) >> 16);
- temp2 = (ip[12] * sinpi8sqrt2) >> 16;
- d1 = temp1 + temp2;
-
- temp3 = (ip[5] * sinpi8sqrt2) >> 16;
- temp4 = ip[13] + ((ip[13] * cospi8sqrt2minus1) >> 16);
- c2 = temp3 - temp4;
-
- temp3 = ip[5] + ((ip[5] * cospi8sqrt2minus1) >> 16);
- temp4 = (ip[13] * sinpi8sqrt2) >> 16;
- d2 = temp3 + temp4;
-
- op[0] = a1 + d1;
- op[12] = a1 - d1;
- op[4] = b1 + c1;
- op[8] = b1 - c1;
-
- a1 = ip[1] + ip[9];
- b1 = ip[1] - ip[9];
-
- op[1] = a1 + d2;
- op[13] = a1 - d2;
- op[5] = b1 + c2;
- op[9] = b1 - c2;
-
- a1 = ip[2] + ip[10];
- b1 = ip[2] - ip[10];
-
- temp1 = (ip[6] * sinpi8sqrt2) >> 16;
- temp2 = ip[14] + ((ip[14] * cospi8sqrt2minus1) >> 16);
- c1 = temp1 - temp2;
-
- temp1 = ip[6] + ((ip[6] * cospi8sqrt2minus1) >> 16);
- temp2 = (ip[14] * sinpi8sqrt2) >> 16;
- d1 = temp1 + temp2;
-
- temp3 = (ip[7] * sinpi8sqrt2) >> 16;
- temp4 = ip[15] + ((ip[15] * cospi8sqrt2minus1) >> 16);
- c2 = temp3 - temp4;
-
- temp3 = ip[7] + ((ip[7] * cospi8sqrt2minus1) >> 16);
- temp4 = (ip[15] * sinpi8sqrt2) >> 16;
- d2 = temp3 + temp4;
-
- op[2] = a1 + d1;
- op[14] = a1 - d1;
- op[6] = b1 + c1;
- op[10] = b1 - c1;
-
- a1 = ip[3] + ip[11];
- b1 = ip[3] - ip[11];
-
- op[3] = a1 + d2;
- op[15] = a1 - d2;
- op[7] = b1 + c2;
- op[11] = b1 - c2;
-
- ip = output;
-
- /* prepare data for load */
- prefetch_load_short(ip + shortpitch);
-
- /* second loop is unrolled */
- a1 = ip[0] + ip[2];
- b1 = ip[0] - ip[2];
-
- temp1 = (ip[1] * sinpi8sqrt2) >> 16;
- temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1) >> 16);
- c1 = temp1 - temp2;
-
- temp1 = ip[1] + ((ip[1] * cospi8sqrt2minus1) >> 16);
- temp2 = (ip[3] * sinpi8sqrt2) >> 16;
- d1 = temp1 + temp2;
-
- temp3 = (ip[5] * sinpi8sqrt2) >> 16;
- temp4 = ip[7] + ((ip[7] * cospi8sqrt2minus1) >> 16);
- c2 = temp3 - temp4;
-
- temp3 = ip[5] + ((ip[5] * cospi8sqrt2minus1) >> 16);
- temp4 = (ip[7] * sinpi8sqrt2) >> 16;
- d2 = temp3 + temp4;
-
- op[0] = (a1 + d1 + 4) >> 3;
- op[3] = (a1 - d1 + 4) >> 3;
- op[1] = (b1 + c1 + 4) >> 3;
- op[2] = (b1 - c1 + 4) >> 3;
-
- a1 = ip[4] + ip[6];
- b1 = ip[4] - ip[6];
-
- op[4] = (a1 + d2 + 4) >> 3;
- op[7] = (a1 - d2 + 4) >> 3;
- op[5] = (b1 + c2 + 4) >> 3;
- op[6] = (b1 - c2 + 4) >> 3;
-
- a1 = ip[8] + ip[10];
- b1 = ip[8] - ip[10];
-
- temp1 = (ip[9] * sinpi8sqrt2) >> 16;
- temp2 = ip[11] + ((ip[11] * cospi8sqrt2minus1) >> 16);
- c1 = temp1 - temp2;
-
- temp1 = ip[9] + ((ip[9] * cospi8sqrt2minus1) >> 16);
- temp2 = (ip[11] * sinpi8sqrt2) >> 16;
- d1 = temp1 + temp2;
-
- temp3 = (ip[13] * sinpi8sqrt2) >> 16;
- temp4 = ip[15] + ((ip[15] * cospi8sqrt2minus1) >> 16);
- c2 = temp3 - temp4;
-
- temp3 = ip[13] + ((ip[13] * cospi8sqrt2minus1) >> 16);
- temp4 = (ip[15] * sinpi8sqrt2) >> 16;
- d2 = temp3 + temp4;
-
- op[8] = (a1 + d1 + 4) >> 3;
- op[11] = (a1 - d1 + 4) >> 3;
- op[9] = (b1 + c1 + 4) >> 3;
- op[10] = (b1 - c1 + 4) >> 3;
-
- a1 = ip[12] + ip[14];
- b1 = ip[12] - ip[14];
-
- op[12] = (a1 + d2 + 4) >> 3;
- op[15] = (a1 - d2 + 4) >> 3;
- op[13] = (b1 + c2 + 4) >> 3;
- op[14] = (b1 - c2 + 4) >> 3;
-
- ip = output;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- short a = ip[c] + pred_ptr[c] ;
- dst_ptr[c] = cm[a] ;
- }
-
- ip += 4;
- dst_ptr += dst_stride;
- pred_ptr += pred_stride;
- }
-}
-
-void vp8_dc_only_idct_add_dspr2(short input_dc, unsigned char *pred_ptr, int pred_stride, unsigned char *dst_ptr, int dst_stride)
-{
- int a1;
- int i, absa1;
- int t2, vector_a1, vector_a;
-
- /* a1 = ((input_dc + 4) >> 3); */
- __asm__ __volatile__ (
- "addi %[a1], %[input_dc], 4 \n\t"
- "sra %[a1], %[a1], 3 \n\t"
- : [a1] "=r" (a1)
- : [input_dc] "r" (input_dc)
- );
-
- if (a1 < 0)
- {
- /* use quad-byte
- * input and output memory are four byte aligned
- */
- __asm__ __volatile__ (
- "abs %[absa1], %[a1] \n\t"
- "replv.qb %[vector_a1], %[absa1] \n\t"
- : [absa1] "=r" (absa1), [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- /* use (a1 - predptr[c]) instead a1 + predptr[c] */
- for (i = 4; i--;)
- {
- __asm__ __volatile__ (
- "lw %[t2], 0(%[pred_ptr]) \n\t"
- "add %[pred_ptr], %[pred_ptr], %[pred_stride] \n\t"
- "subu_s.qb %[vector_a], %[t2], %[vector_a1] \n\t"
- "sw %[vector_a], 0(%[dst_ptr]) \n\t"
- "add %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
- : [t2] "=&r" (t2), [vector_a] "=&r" (vector_a),
- [dst_ptr] "+&r" (dst_ptr), [pred_ptr] "+&r" (pred_ptr)
- : [dst_stride] "r" (dst_stride), [pred_stride] "r" (pred_stride), [vector_a1] "r" (vector_a1)
- );
- }
- }
- else
- {
- /* use quad-byte
- * input and output memory are four byte aligned
- */
- __asm__ __volatile__ (
- "replv.qb %[vector_a1], %[a1] \n\t"
- : [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (i = 4; i--;)
- {
- __asm__ __volatile__ (
- "lw %[t2], 0(%[pred_ptr]) \n\t"
- "add %[pred_ptr], %[pred_ptr], %[pred_stride] \n\t"
- "addu_s.qb %[vector_a], %[vector_a1], %[t2] \n\t"
- "sw %[vector_a], 0(%[dst_ptr]) \n\t"
- "add %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
- : [t2] "=&r" (t2), [vector_a] "=&r" (vector_a),
- [dst_ptr] "+&r" (dst_ptr), [pred_ptr] "+&r" (pred_ptr)
- : [dst_stride] "r" (dst_stride), [pred_stride] "r" (pred_stride), [vector_a1] "r" (vector_a1)
- );
- }
- }
-
-}
-
-void vp8_short_inv_walsh4x4_dspr2(short *input, short *mb_dqcoeff)
-{
- short output[16];
- int i;
- int a1, b1, c1, d1;
- int a2, b2, c2, d2;
- short *ip = input;
- short *op = output;
-
- prefetch_load_short(ip);
-
- for (i = 4; i--;)
- {
- a1 = ip[0] + ip[12];
- b1 = ip[4] + ip[8];
- c1 = ip[4] - ip[8];
- d1 = ip[0] - ip[12];
-
- op[0] = a1 + b1;
- op[4] = c1 + d1;
- op[8] = a1 - b1;
- op[12] = d1 - c1;
-
- ip++;
- op++;
- }
-
- ip = output;
- op = output;
-
- prefetch_load_short(ip);
-
- for (i = 4; i--;)
- {
- a1 = ip[0] + ip[3] + 3;
- b1 = ip[1] + ip[2];
- c1 = ip[1] - ip[2];
- d1 = ip[0] - ip[3] + 3;
-
- a2 = a1 + b1;
- b2 = d1 + c1;
- c2 = a1 - b1;
- d2 = d1 - c1;
-
- op[0] = a2 >> 3;
- op[1] = b2 >> 3;
- op[2] = c2 >> 3;
- op[3] = d2 >> 3;
-
- ip += 4;
- op += 4;
- }
-
- for (i = 0; i < 16; i++)
- {
- mb_dqcoeff[i * 16] = output[i];
- }
-}
-
-void vp8_short_inv_walsh4x4_1_dspr2(short *input, short *mb_dqcoeff)
-{
- int a1;
-
- a1 = ((input[0] + 3) >> 3);
-
- __asm__ __volatile__ (
- "sh %[a1], 0(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 32(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 64(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 96(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 128(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 160(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 192(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 224(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 256(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 288(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 320(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 352(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 384(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 416(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 448(%[mb_dqcoeff]) \n\t"
- "sh %[a1], 480(%[mb_dqcoeff]) \n\t"
-
- :
- : [a1] "r" (a1), [mb_dqcoeff] "r" (mb_dqcoeff)
- );
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/loopfilter_filters_dspr2.c b/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/loopfilter_filters_dspr2.c
deleted file mode 100644
index 9ae6bc8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/loopfilter_filters_dspr2.c
+++ /dev/null
@@ -1,2622 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include "vp8_rtcd.h"
-#include "vp8/common/onyxc_int.h"
-
-#if HAVE_DSPR2
-typedef unsigned char uc;
-
-/* prefetch data for load */
-inline void prefetch_load_lf(unsigned char *src)
-{
- __asm__ __volatile__ (
- "pref 0, 0(%[src]) \n\t"
- :
- : [src] "r" (src)
- );
-}
-
-
-/* prefetch data for store */
-inline void prefetch_store_lf(unsigned char *dst)
-{
- __asm__ __volatile__ (
- "pref 1, 0(%[dst]) \n\t"
- :
- : [dst] "r" (dst)
- );
-}
-
-/* processing 4 pixels at the same time
- * compute hev and mask in the same function
- */
-static __inline void vp8_filter_mask_vec_mips
-(
- uint32_t limit,
- uint32_t flimit,
- uint32_t p1,
- uint32_t p0,
- uint32_t p3,
- uint32_t p2,
- uint32_t q0,
- uint32_t q1,
- uint32_t q2,
- uint32_t q3,
- uint32_t thresh,
- uint32_t *hev,
- uint32_t *mask
-)
-{
- uint32_t c, r, r3, r_k;
- uint32_t s1, s2, s3;
- uint32_t ones = 0xFFFFFFFF;
- uint32_t hev1;
-
- __asm__ __volatile__ (
- /* mask |= (abs(p3 - p2) > limit) */
- "subu_s.qb %[c], %[p3], %[p2] \n\t"
- "subu_s.qb %[r_k], %[p2], %[p3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], $0, %[c] \n\t"
-
- /* mask |= (abs(p2 - p1) > limit) */
- "subu_s.qb %[c], %[p2], %[p1] \n\t"
- "subu_s.qb %[r_k], %[p1], %[p2] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- /* mask |= (abs(p1 - p0) > limit)
- * hev |= (abs(p1 - p0) > thresh)
- */
- "subu_s.qb %[c], %[p1], %[p0] \n\t"
- "subu_s.qb %[r_k], %[p0], %[p1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[thresh], %[r_k] \n\t"
- "or %[r3], $0, %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- /* mask |= (abs(q1 - q0) > limit)
- * hev |= (abs(q1 - q0) > thresh)
- */
- "subu_s.qb %[c], %[q1], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[q1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[thresh], %[r_k] \n\t"
- "or %[r3], %[r3], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- /* mask |= (abs(q2 - q1) > limit) */
- "subu_s.qb %[c], %[q2], %[q1] \n\t"
- "subu_s.qb %[r_k], %[q1], %[q2] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "sll %[r3], %[r3], 24 \n\t"
-
- /* mask |= (abs(q3 - q2) > limit) */
- "subu_s.qb %[c], %[q3], %[q2] \n\t"
- "subu_s.qb %[r_k], %[q2], %[q3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- : [c] "=&r" (c), [r_k] "=&r" (r_k),
- [r] "=&r" (r), [r3] "=&r" (r3)
- : [limit] "r" (limit), [p3] "r" (p3), [p2] "r" (p2),
- [p1] "r" (p1), [p0] "r" (p0), [q1] "r" (q1), [q0] "r" (q0),
- [q2] "r" (q2), [q3] "r" (q3), [thresh] "r" (thresh)
- );
-
- __asm__ __volatile__ (
- /* abs(p0 - q0) */
- "subu_s.qb %[c], %[p0], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[p0] \n\t"
- "wrdsp %[r3] \n\t"
- "or %[s1], %[r_k], %[c] \n\t"
-
- /* abs(p1 - q1) */
- "subu_s.qb %[c], %[p1], %[q1] \n\t"
- "addu_s.qb %[s3], %[s1], %[s1] \n\t"
- "pick.qb %[hev1], %[ones], $0 \n\t"
- "subu_s.qb %[r_k], %[q1], %[p1] \n\t"
- "or %[s2], %[r_k], %[c] \n\t"
-
- /* abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > flimit * 2 + limit */
- "shrl.qb %[s2], %[s2], 1 \n\t"
- "addu_s.qb %[s1], %[s2], %[s3] \n\t"
- "cmpgu.lt.qb %[c], %[flimit], %[s1] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "sll %[r], %[r], 24 \n\t"
-
- "wrdsp %[r] \n\t"
- "pick.qb %[s2], $0, %[ones] \n\t"
-
- : [c] "=&r" (c), [r_k] "=&r" (r_k), [s1] "=&r" (s1), [hev1] "=&r" (hev1),
- [s2] "=&r" (s2), [r] "+r" (r), [s3] "=&r" (s3)
- : [p0] "r" (p0), [q0] "r" (q0), [p1] "r" (p1), [r3] "r" (r3),
- [q1] "r" (q1), [ones] "r" (ones), [flimit] "r" (flimit)
- );
-
- *hev = hev1;
- *mask = s2;
-}
-
-
-/* inputs & outputs are quad-byte vectors */
-static __inline void vp8_filter_mips
-(
- uint32_t mask,
- uint32_t hev,
- uint32_t *ps1,
- uint32_t *ps0,
- uint32_t *qs0,
- uint32_t *qs1
-)
-{
- int32_t vp8_filter_l, vp8_filter_r;
- int32_t Filter1_l, Filter1_r, Filter2_l, Filter2_r;
- int32_t subr_r, subr_l;
- uint32_t t1, t2, HWM, t3;
- uint32_t hev_l, hev_r, mask_l, mask_r, invhev_l, invhev_r;
-
- int32_t vps1, vps0, vqs0, vqs1;
- int32_t vps1_l, vps1_r, vps0_l, vps0_r, vqs0_l, vqs0_r, vqs1_l, vqs1_r;
- uint32_t N128;
-
- N128 = 0x80808080;
- t1 = 0x03000300;
- t2 = 0x04000400;
- t3 = 0x01000100;
- HWM = 0xFF00FF00;
-
- vps0 = (*ps0) ^ N128;
- vps1 = (*ps1) ^ N128;
- vqs0 = (*qs0) ^ N128;
- vqs1 = (*qs1) ^ N128;
-
- /* use halfword pairs instead quad-bytes because of accuracy */
- vps0_l = vps0 & HWM;
- vps0_r = vps0 << 8;
- vps0_r = vps0_r & HWM;
-
- vps1_l = vps1 & HWM;
- vps1_r = vps1 << 8;
- vps1_r = vps1_r & HWM;
-
- vqs0_l = vqs0 & HWM;
- vqs0_r = vqs0 << 8;
- vqs0_r = vqs0_r & HWM;
-
- vqs1_l = vqs1 & HWM;
- vqs1_r = vqs1 << 8;
- vqs1_r = vqs1_r & HWM;
-
- mask_l = mask & HWM;
- mask_r = mask << 8;
- mask_r = mask_r & HWM;
-
- hev_l = hev & HWM;
- hev_r = hev << 8;
- hev_r = hev_r & HWM;
-
- __asm__ __volatile__ (
- /* vp8_filter = vp8_signed_char_clamp(ps1 - qs1); */
- "subq_s.ph %[vp8_filter_l], %[vps1_l], %[vqs1_l] \n\t"
- "subq_s.ph %[vp8_filter_r], %[vps1_r], %[vqs1_r] \n\t"
-
- /* qs0 - ps0 */
- "subq_s.ph %[subr_l], %[vqs0_l], %[vps0_l] \n\t"
- "subq_s.ph %[subr_r], %[vqs0_r], %[vps0_r] \n\t"
-
- /* vp8_filter &= hev; */
- "and %[vp8_filter_l], %[vp8_filter_l], %[hev_l] \n\t"
- "and %[vp8_filter_r], %[vp8_filter_r], %[hev_r] \n\t"
-
- /* vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (qs0 - ps0)); */
- "addq_s.ph %[vp8_filter_l], %[vp8_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp8_filter_r], %[vp8_filter_r], %[subr_r] \n\t"
- "xor %[invhev_l], %[hev_l], %[HWM] \n\t"
- "addq_s.ph %[vp8_filter_l], %[vp8_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp8_filter_r], %[vp8_filter_r], %[subr_r] \n\t"
- "xor %[invhev_r], %[hev_r], %[HWM] \n\t"
- "addq_s.ph %[vp8_filter_l], %[vp8_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp8_filter_r], %[vp8_filter_r], %[subr_r] \n\t"
-
- /* vp8_filter &= mask; */
- "and %[vp8_filter_l], %[vp8_filter_l], %[mask_l] \n\t"
- "and %[vp8_filter_r], %[vp8_filter_r], %[mask_r] \n\t"
-
- : [vp8_filter_l] "=&r" (vp8_filter_l), [vp8_filter_r] "=&r" (vp8_filter_r),
- [subr_l] "=&r" (subr_l), [subr_r] "=&r" (subr_r),
- [invhev_l] "=&r" (invhev_l), [invhev_r] "=&r" (invhev_r)
-
- : [vps0_l] "r" (vps0_l), [vps0_r] "r" (vps0_r), [vps1_l] "r" (vps1_l),
- [vps1_r] "r" (vps1_r), [vqs0_l] "r" (vqs0_l), [vqs0_r] "r" (vqs0_r),
- [vqs1_l] "r" (vqs1_l), [vqs1_r] "r" (vqs1_r),
- [mask_l] "r" (mask_l), [mask_r] "r" (mask_r),
- [hev_l] "r" (hev_l), [hev_r] "r" (hev_r),
- [HWM] "r" (HWM)
- );
-
- /* save bottom 3 bits so that we round one side +4 and the other +3 */
- __asm__ __volatile__ (
- /* Filter2 = vp8_signed_char_clamp(vp8_filter + 3) >>= 3; */
- "addq_s.ph %[Filter1_l], %[vp8_filter_l], %[t2] \n\t"
- "addq_s.ph %[Filter1_r], %[vp8_filter_r], %[t2] \n\t"
-
- /* Filter1 = vp8_signed_char_clamp(vp8_filter + 4) >>= 3; */
- "addq_s.ph %[Filter2_l], %[vp8_filter_l], %[t1] \n\t"
- "addq_s.ph %[Filter2_r], %[vp8_filter_r], %[t1] \n\t"
- "shra.ph %[Filter1_r], %[Filter1_r], 3 \n\t"
- "shra.ph %[Filter1_l], %[Filter1_l], 3 \n\t"
-
- "shra.ph %[Filter2_l], %[Filter2_l], 3 \n\t"
- "shra.ph %[Filter2_r], %[Filter2_r], 3 \n\t"
-
- "and %[Filter1_l], %[Filter1_l], %[HWM] \n\t"
- "and %[Filter1_r], %[Filter1_r], %[HWM] \n\t"
-
- /* vps0 = vp8_signed_char_clamp(ps0 + Filter2); */
- "addq_s.ph %[vps0_l], %[vps0_l], %[Filter2_l] \n\t"
- "addq_s.ph %[vps0_r], %[vps0_r], %[Filter2_r] \n\t"
-
- /* vqs0 = vp8_signed_char_clamp(qs0 - Filter1); */
- "subq_s.ph %[vqs0_l], %[vqs0_l], %[Filter1_l] \n\t"
- "subq_s.ph %[vqs0_r], %[vqs0_r], %[Filter1_r] \n\t"
-
- : [Filter1_l] "=&r" (Filter1_l), [Filter1_r] "=&r" (Filter1_r),
- [Filter2_l] "=&r" (Filter2_l), [Filter2_r] "=&r" (Filter2_r),
- [vps0_l] "+r" (vps0_l), [vps0_r] "+r" (vps0_r),
- [vqs0_l] "+r" (vqs0_l), [vqs0_r] "+r" (vqs0_r)
-
- : [t1] "r" (t1), [t2] "r" (t2),
- [vp8_filter_l] "r" (vp8_filter_l), [vp8_filter_r] "r" (vp8_filter_r),
- [HWM] "r" (HWM)
- );
-
- __asm__ __volatile__ (
- /* (vp8_filter += 1) >>= 1 */
- "addqh.ph %[Filter1_l], %[Filter1_l], %[t3] \n\t"
- "addqh.ph %[Filter1_r], %[Filter1_r], %[t3] \n\t"
-
- /* vp8_filter &= ~hev; */
- "and %[Filter1_l], %[Filter1_l], %[invhev_l] \n\t"
- "and %[Filter1_r], %[Filter1_r], %[invhev_r] \n\t"
-
- /* vps1 = vp8_signed_char_clamp(ps1 + vp8_filter); */
- "addq_s.ph %[vps1_l], %[vps1_l], %[Filter1_l] \n\t"
- "addq_s.ph %[vps1_r], %[vps1_r], %[Filter1_r] \n\t"
-
- /* vqs1 = vp8_signed_char_clamp(qs1 - vp8_filter); */
- "subq_s.ph %[vqs1_l], %[vqs1_l], %[Filter1_l] \n\t"
- "subq_s.ph %[vqs1_r], %[vqs1_r], %[Filter1_r] \n\t"
-
- : [Filter1_l] "+r" (Filter1_l), [Filter1_r] "+r" (Filter1_r),
- [vps1_l] "+r" (vps1_l), [vps1_r] "+r" (vps1_r),
- [vqs1_l] "+r" (vqs1_l), [vqs1_r] "+r" (vqs1_r)
-
- : [t3] "r" (t3), [invhev_l] "r" (invhev_l), [invhev_r] "r" (invhev_r)
- );
-
- /* Create quad-bytes from halfword pairs */
- vqs0_l = vqs0_l & HWM;
- vqs1_l = vqs1_l & HWM;
- vps0_l = vps0_l & HWM;
- vps1_l = vps1_l & HWM;
-
- __asm__ __volatile__ (
- "shrl.ph %[vqs0_r], %[vqs0_r], 8 \n\t"
- "shrl.ph %[vps0_r], %[vps0_r], 8 \n\t"
- "shrl.ph %[vqs1_r], %[vqs1_r], 8 \n\t"
- "shrl.ph %[vps1_r], %[vps1_r], 8 \n\t"
-
- : [vps1_r] "+r" (vps1_r), [vqs1_r] "+r" (vqs1_r),
- [vps0_r] "+r" (vps0_r), [vqs0_r] "+r" (vqs0_r)
- :
- );
-
- vqs0 = vqs0_l | vqs0_r;
- vqs1 = vqs1_l | vqs1_r;
- vps0 = vps0_l | vps0_r;
- vps1 = vps1_l | vps1_r;
-
- *ps0 = vps0 ^ N128;
- *ps1 = vps1 ^ N128;
- *qs0 = vqs0 ^ N128;
- *qs1 = vqs1 ^ N128;
-}
-
-void vp8_loop_filter_horizontal_edge_mips
-(
- unsigned char *s,
- int p,
- unsigned int flimit,
- unsigned int limit,
- unsigned int thresh,
- int count
-)
-{
- uint32_t mask;
- uint32_t hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *sm1, *s0, *s1, *s2, *s3, *s4, *s5, *s6;
-
- mask = 0;
- hev = 0;
- p1 = 0;
- p2 = 0;
- p3 = 0;
- p4 = 0;
-
- /* prefetch data for store */
- prefetch_store_lf(s);
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- sm1 = s - (p << 2);
- s0 = s - p - p - p;
- s1 = s - p - p ;
- s2 = s - p;
- s3 = s;
- s4 = s + p;
- s5 = s + p + p;
- s6 = s + p + p + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood */
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- }
- }
-
- sm1 += 4;
- s0 += 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- s5 += 4;
- s6 += 4;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood */
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- }
- }
-
- sm1 += 4;
- s0 += 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- s5 += 4;
- s6 += 4;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood */
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- }
- }
-
- sm1 += 4;
- s0 += 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- s5 += 4;
- s6 += 4;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood */
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- }
- }
-}
-
-void vp8_loop_filter_uvhorizontal_edge_mips
-(
- unsigned char *s,
- int p,
- unsigned int flimit,
- unsigned int limit,
- unsigned int thresh,
- int count
-)
-{
- uint32_t mask;
- uint32_t hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *sm1, *s0, *s1, *s2, *s3, *s4, *s5, *s6;
-
- mask = 0;
- hev = 0;
- p1 = 0;
- p2 = 0;
- p3 = 0;
- p4 = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- sm1 = s - (p << 2);
- s0 = s - p - p - p;
- s1 = s - p - p ;
- s2 = s - p;
- s3 = s;
- s4 = s + p;
- s5 = s + p + p;
- s6 = s + p + p + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood */
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- }
- }
-
- sm1 += 4;
- s0 += 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- s5 += 4;
- s6 += 4;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood */
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- }
- }
-}
-
-void vp8_loop_filter_vertical_edge_mips
-(
- unsigned char *s,
- int p,
- const unsigned int flimit,
- const unsigned int limit,
- const unsigned int thresh,
- int count
-)
-{
- int i;
- uint32_t mask, hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *s1, *s2, *s3, *s4;
- uint32_t prim1, prim2, sec3, sec4, prim3, prim4;
-
- hev = 0;
- mask = 0;
- i = 0;
- pm1 = 0;
- p0 = 0;
- p1 = 0;
- p2 = 0;
- p3 = 0;
- p4 = 0;
- p5 = 0;
- p6 = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- /* apply filter on 4 pixesl at the same time */
- do
- {
-
- /* prefetch data for store */
- prefetch_store_lf(s + p);
-
- s1 = s;
- s2 = s + p;
- s3 = s2 + p;
- s4 = s3 + p;
- s = s4 + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood
- * don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s4] "r" (s4),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
- : [p1] "+r" (p1)
- : [p4] "r" (p4), [p3] "r" (p3), [s3] "r" (s3), [p2] "r" (p2)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s2] "r" (s2),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s1] "r" (s1),
- [p2] "r" (p2), [p1] "r" (p1)
- );
- }
- }
-
- s1 = s;
- s2 = s + p;
- s3 = s2 + p;
- s4 = s3 + p;
- s = s4 + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood
- * don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s4] "r" (s4),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
- : [p1] "+r" (p1)
- : [p4] "r" (p4), [p3] "r" (p3), [s3] "r" (s3), [p2] "r" (p2)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s2] "r" (s2),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s1] "r" (s1),
- [p2] "r" (p2), [p1] "r" (p1)
- );
- }
- }
-
- i += 8;
- }
-
- while (i < count);
-}
-
-void vp8_loop_filter_uvvertical_edge_mips
-(
- unsigned char *s,
- int p,
- unsigned int flimit,
- unsigned int limit,
- unsigned int thresh,
- int count
-)
-{
- uint32_t mask, hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *s1, *s2, *s3, *s4;
- uint32_t prim1, prim2, sec3, sec4, prim3, prim4;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- /* apply filter on 4 pixesl at the same time */
-
- s1 = s;
- s2 = s + p;
- s3 = s2 + p;
- s4 = s3 + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood
- * don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s4] "r" (s4),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
- : [p1] "+r" (p1)
- : [p4] "r" (p4), [p3] "r" (p3), [s3] "r" (s3), [p2] "r" (p2)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s2] "r" (s2),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s1] "r" (s1), [p2] "r" (p2), [p1] "r" (p1)
- );
- }
- }
-
- s1 = s4 + p;
- s2 = s1 + p;
- s3 = s2 + p;
- s4 = s3 + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_filter_mips(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood
- * don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s4] "r" (s4),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
- : [p1] "+r" (p1)
- : [p4] "r" (p4), [p3] "r" (p3), [s3] "r" (s3), [p2] "r" (p2)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s2] "r" (s2),
- [p2] "r" (p2), [p1] "r" (p1)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
- :
- : [p4] "r" (p4), [p3] "r" (p3), [s1] "r" (s1),
- [p2] "r" (p2), [p1] "r" (p1)
- );
- }
- }
-}
-
-/* inputs & outputs are quad-byte vectors */
-static __inline void vp8_mbfilter_mips
-(
- uint32_t mask,
- uint32_t hev,
- uint32_t *ps2,
- uint32_t *ps1,
- uint32_t *ps0,
- uint32_t *qs0,
- uint32_t *qs1,
- uint32_t *qs2
-)
-{
- int32_t vps2, vps1, vps0, vqs0, vqs1, vqs2;
- int32_t vps2_l, vps1_l, vps0_l, vqs0_l, vqs1_l, vqs2_l;
- int32_t vps2_r, vps1_r, vps0_r, vqs0_r, vqs1_r, vqs2_r;
- uint32_t HWM, vp8_filter_l, vp8_filter_r, mask_l, mask_r, hev_l, hev_r, subr_r, subr_l;
- uint32_t Filter2_l, Filter2_r, t1, t2, Filter1_l, Filter1_r, invhev_l, invhev_r;
- uint32_t N128, R63;
- uint32_t u1_l, u1_r, u2_l, u2_r, u3_l, u3_r;
-
- R63 = 0x003F003F;
- HWM = 0xFF00FF00;
- N128 = 0x80808080;
- t1 = 0x03000300;
- t2 = 0x04000400;
-
- vps0 = (*ps0) ^ N128;
- vps1 = (*ps1) ^ N128;
- vps2 = (*ps2) ^ N128;
- vqs0 = (*qs0) ^ N128;
- vqs1 = (*qs1) ^ N128;
- vqs2 = (*qs2) ^ N128;
-
- /* use halfword pairs instead quad-bytes because of accuracy */
- vps0_l = vps0 & HWM;
- vps0_r = vps0 << 8;
- vps0_r = vps0_r & HWM;
-
- vqs0_l = vqs0 & HWM;
- vqs0_r = vqs0 << 8;
- vqs0_r = vqs0_r & HWM;
-
- vps1_l = vps1 & HWM;
- vps1_r = vps1 << 8;
- vps1_r = vps1_r & HWM;
-
- vqs1_l = vqs1 & HWM;
- vqs1_r = vqs1 << 8;
- vqs1_r = vqs1_r & HWM;
-
- vqs2_l = vqs2 & HWM;
- vqs2_r = vqs2 << 8;
- vqs2_r = vqs2_r & HWM;
-
- __asm__ __volatile__ (
- /* qs0 - ps0 */
- "subq_s.ph %[subr_l], %[vqs0_l], %[vps0_l] \n\t"
- "subq_s.ph %[subr_r], %[vqs0_r], %[vps0_r] \n\t"
-
- /* vp8_filter = vp8_signed_char_clamp(ps1 - qs1); */
- "subq_s.ph %[vp8_filter_l], %[vps1_l], %[vqs1_l] \n\t"
- "subq_s.ph %[vp8_filter_r], %[vps1_r], %[vqs1_r] \n\t"
-
- : [vp8_filter_l] "=&r" (vp8_filter_l), [vp8_filter_r] "=r" (vp8_filter_r),
- [subr_l] "=&r" (subr_l), [subr_r] "=&r" (subr_r)
- : [vps0_l] "r" (vps0_l), [vps0_r] "r" (vps0_r), [vps1_l] "r" (vps1_l),
- [vps1_r] "r" (vps1_r), [vqs0_l] "r" (vqs0_l), [vqs0_r] "r" (vqs0_r),
- [vqs1_l] "r" (vqs1_l), [vqs1_r] "r" (vqs1_r)
- );
-
- vps2_l = vps2 & HWM;
- vps2_r = vps2 << 8;
- vps2_r = vps2_r & HWM;
-
- /* add outer taps if we have high edge variance */
- __asm__ __volatile__ (
- /* vp8_filter = vp8_signed_char_clamp(vp8_filter + 3 * (qs0 - ps0)); */
- "addq_s.ph %[vp8_filter_l], %[vp8_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp8_filter_r], %[vp8_filter_r], %[subr_r] \n\t"
- "and %[mask_l], %[HWM], %[mask] \n\t"
- "sll %[mask_r], %[mask], 8 \n\t"
- "and %[mask_r], %[HWM], %[mask_r] \n\t"
- "addq_s.ph %[vp8_filter_l], %[vp8_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp8_filter_r], %[vp8_filter_r], %[subr_r] \n\t"
- "and %[hev_l], %[HWM], %[hev] \n\t"
- "sll %[hev_r], %[hev], 8 \n\t"
- "and %[hev_r], %[HWM], %[hev_r] \n\t"
- "addq_s.ph %[vp8_filter_l], %[vp8_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp8_filter_r], %[vp8_filter_r], %[subr_r] \n\t"
-
- /* vp8_filter &= mask; */
- "and %[vp8_filter_l], %[vp8_filter_l], %[mask_l] \n\t"
- "and %[vp8_filter_r], %[vp8_filter_r], %[mask_r] \n\t"
-
- /* Filter2 = vp8_filter & hev; */
- "and %[Filter2_l], %[vp8_filter_l], %[hev_l] \n\t"
- "and %[Filter2_r], %[vp8_filter_r], %[hev_r] \n\t"
-
- : [vp8_filter_l] "+r" (vp8_filter_l), [vp8_filter_r] "+r" (vp8_filter_r),
- [hev_l] "=&r" (hev_l), [hev_r] "=&r" (hev_r),
- [mask_l] "=&r" (mask_l), [mask_r] "=&r" (mask_r),
- [Filter2_l] "=&r" (Filter2_l), [Filter2_r] "=&r" (Filter2_r)
- : [subr_l] "r" (subr_l), [subr_r] "r" (subr_r),
- [HWM] "r" (HWM), [hev] "r" (hev), [mask] "r" (mask)
- );
-
- /* save bottom 3 bits so that we round one side +4 and the other +3 */
- __asm__ __volatile__ (
- /* Filter1 = vp8_signed_char_clamp(Filter2 + 4) >>= 3; */
- "addq_s.ph %[Filter1_l], %[Filter2_l], %[t2] \n\t"
- "xor %[invhev_l], %[hev_l], %[HWM] \n\t"
- "addq_s.ph %[Filter1_r], %[Filter2_r], %[t2] \n\t"
-
- /* Filter2 = vp8_signed_char_clamp(Filter2 + 3) >>= 3; */
- "addq_s.ph %[Filter2_l], %[Filter2_l], %[t1] \n\t"
- "addq_s.ph %[Filter2_r], %[Filter2_r], %[t1] \n\t"
-
- "shra.ph %[Filter1_l], %[Filter1_l], 3 \n\t"
- "shra.ph %[Filter1_r], %[Filter1_r], 3 \n\t"
-
- "shra.ph %[Filter2_l], %[Filter2_l], 3 \n\t"
- "shra.ph %[Filter2_r], %[Filter2_r], 3 \n\t"
- "and %[Filter1_l], %[Filter1_l], %[HWM] \n\t"
- "and %[Filter1_r], %[Filter1_r], %[HWM] \n\t"
- "xor %[invhev_r], %[hev_r], %[HWM] \n\t"
-
- /* qs0 = vp8_signed_char_clamp(qs0 - Filter1); */
- "subq_s.ph %[vqs0_l], %[vqs0_l], %[Filter1_l] \n\t"
- "subq_s.ph %[vqs0_r], %[vqs0_r], %[Filter1_r] \n\t"
-
- /* ps0 = vp8_signed_char_clamp(ps0 + Filter2); */
- "addq_s.ph %[vps0_l], %[vps0_l], %[Filter2_l] \n\t"
- "addq_s.ph %[vps0_r], %[vps0_r], %[Filter2_r] \n\t"
-
- : [invhev_l] "=&r" (invhev_l), [invhev_r] "=&r" (invhev_r),
- [Filter1_l] "=&r" (Filter1_l), [Filter1_r] "=&r" (Filter1_r),
- [Filter2_l] "+r" (Filter2_l), [Filter2_r] "+r" (Filter2_r),
- [vps0_l] "+r" (vps0_l), [vps0_r] "+r" (vps0_r),
- [vqs0_l] "+r" (vqs0_l), [vqs0_r] "+r" (vqs0_r)
- : [t1] "r" (t1), [t2] "r" (t2), [HWM] "r" (HWM),
- [hev_l] "r" (hev_l), [hev_r] "r" (hev_r)
- );
-
- /* only apply wider filter if not high edge variance */
- __asm__ __volatile__ (
- /* vp8_filter &= ~hev; */
- "and %[Filter2_l], %[vp8_filter_l], %[invhev_l] \n\t"
- "and %[Filter2_r], %[vp8_filter_r], %[invhev_r] \n\t"
-
- "shra.ph %[Filter2_l], %[Filter2_l], 8 \n\t"
- "shra.ph %[Filter2_r], %[Filter2_r], 8 \n\t"
-
- : [Filter2_l] "=&r" (Filter2_l), [Filter2_r] "=&r" (Filter2_r)
- : [vp8_filter_l] "r" (vp8_filter_l), [vp8_filter_r] "r" (vp8_filter_r),
- [invhev_l] "r" (invhev_l), [invhev_r] "r" (invhev_r)
- );
-
- /* roughly 3/7th difference across boundary */
- __asm__ __volatile__ (
- "shll.ph %[u3_l], %[Filter2_l], 3 \n\t"
- "shll.ph %[u3_r], %[Filter2_r], 3 \n\t"
-
- "addq.ph %[u3_l], %[u3_l], %[Filter2_l] \n\t"
- "addq.ph %[u3_r], %[u3_r], %[Filter2_r] \n\t"
-
- "shll.ph %[u2_l], %[u3_l], 1 \n\t"
- "shll.ph %[u2_r], %[u3_r], 1 \n\t"
-
- "addq.ph %[u1_l], %[u3_l], %[u2_l] \n\t"
- "addq.ph %[u1_r], %[u3_r], %[u2_r] \n\t"
-
- "addq.ph %[u2_l], %[u2_l], %[R63] \n\t"
- "addq.ph %[u2_r], %[u2_r], %[R63] \n\t"
-
- "addq.ph %[u3_l], %[u3_l], %[R63] \n\t"
- "addq.ph %[u3_r], %[u3_r], %[R63] \n\t"
-
- /* vp8_signed_char_clamp((63 + Filter2 * 27) >> 7)
- * vp8_signed_char_clamp((63 + Filter2 * 18) >> 7)
- */
- "addq.ph %[u1_l], %[u1_l], %[R63] \n\t"
- "addq.ph %[u1_r], %[u1_r], %[R63] \n\t"
- "shra.ph %[u1_l], %[u1_l], 7 \n\t"
- "shra.ph %[u1_r], %[u1_r], 7 \n\t"
- "shra.ph %[u2_l], %[u2_l], 7 \n\t"
- "shra.ph %[u2_r], %[u2_r], 7 \n\t"
- "shll.ph %[u1_l], %[u1_l], 8 \n\t"
- "shll.ph %[u1_r], %[u1_r], 8 \n\t"
- "shll.ph %[u2_l], %[u2_l], 8 \n\t"
- "shll.ph %[u2_r], %[u2_r], 8 \n\t"
-
- /* vqs0 = vp8_signed_char_clamp(qs0 - u); */
- "subq_s.ph %[vqs0_l], %[vqs0_l], %[u1_l] \n\t"
- "subq_s.ph %[vqs0_r], %[vqs0_r], %[u1_r] \n\t"
-
- /* vps0 = vp8_signed_char_clamp(ps0 + u); */
- "addq_s.ph %[vps0_l], %[vps0_l], %[u1_l] \n\t"
- "addq_s.ph %[vps0_r], %[vps0_r], %[u1_r] \n\t"
-
- : [u1_l] "=&r" (u1_l), [u1_r] "=&r" (u1_r), [u2_l] "=&r" (u2_l),
- [u2_r] "=&r" (u2_r), [u3_l] "=&r" (u3_l), [u3_r] "=&r" (u3_r),
- [vps0_l] "+r" (vps0_l), [vps0_r] "+r" (vps0_r),
- [vqs0_l] "+r" (vqs0_l), [vqs0_r] "+r" (vqs0_r)
- : [R63] "r" (R63),
- [Filter2_l] "r" (Filter2_l), [Filter2_r] "r" (Filter2_r)
- );
-
- __asm__ __volatile__ (
- /* vqs1 = vp8_signed_char_clamp(qs1 - u); */
- "subq_s.ph %[vqs1_l], %[vqs1_l], %[u2_l] \n\t"
- "addq_s.ph %[vps1_l], %[vps1_l], %[u2_l] \n\t"
-
- /* vps1 = vp8_signed_char_clamp(ps1 + u); */
- "addq_s.ph %[vps1_r], %[vps1_r], %[u2_r] \n\t"
- "subq_s.ph %[vqs1_r], %[vqs1_r], %[u2_r] \n\t"
-
- : [vps1_l] "+r" (vps1_l), [vps1_r] "+r" (vps1_r),
- [vqs1_l] "+r" (vqs1_l), [vqs1_r] "+r" (vqs1_r)
- : [u2_l] "r" (u2_l), [u2_r] "r" (u2_r)
- );
-
- /* roughly 1/7th difference across boundary */
- __asm__ __volatile__ (
- /* u = vp8_signed_char_clamp((63 + Filter2 * 9) >> 7); */
- "shra.ph %[u3_l], %[u3_l], 7 \n\t"
- "shra.ph %[u3_r], %[u3_r], 7 \n\t"
- "shll.ph %[u3_l], %[u3_l], 8 \n\t"
- "shll.ph %[u3_r], %[u3_r], 8 \n\t"
-
- /* vqs2 = vp8_signed_char_clamp(qs2 - u); */
- "subq_s.ph %[vqs2_l], %[vqs2_l], %[u3_l] \n\t"
- "subq_s.ph %[vqs2_r], %[vqs2_r], %[u3_r] \n\t"
-
- /* vps2 = vp8_signed_char_clamp(ps2 + u); */
- "addq_s.ph %[vps2_l], %[vps2_l], %[u3_l] \n\t"
- "addq_s.ph %[vps2_r], %[vps2_r], %[u3_r] \n\t"
-
- : [u3_l] "+r" (u3_l), [u3_r] "+r" (u3_r), [vps2_l] "+r" (vps2_l),
- [vps2_r] "+r" (vps2_r), [vqs2_l] "+r" (vqs2_l), [vqs2_r] "+r" (vqs2_r)
- :
- );
-
- /* Create quad-bytes from halfword pairs */
- __asm__ __volatile__ (
- "and %[vqs0_l], %[vqs0_l], %[HWM] \n\t"
- "shrl.ph %[vqs0_r], %[vqs0_r], 8 \n\t"
-
- "and %[vps0_l], %[vps0_l], %[HWM] \n\t"
- "shrl.ph %[vps0_r], %[vps0_r], 8 \n\t"
-
- "and %[vqs1_l], %[vqs1_l], %[HWM] \n\t"
- "shrl.ph %[vqs1_r], %[vqs1_r], 8 \n\t"
-
- "and %[vps1_l], %[vps1_l], %[HWM] \n\t"
- "shrl.ph %[vps1_r], %[vps1_r], 8 \n\t"
-
- "and %[vqs2_l], %[vqs2_l], %[HWM] \n\t"
- "shrl.ph %[vqs2_r], %[vqs2_r], 8 \n\t"
-
- "and %[vps2_l], %[vps2_l], %[HWM] \n\t"
- "shrl.ph %[vps2_r], %[vps2_r], 8 \n\t"
-
- "or %[vqs0_r], %[vqs0_l], %[vqs0_r] \n\t"
- "or %[vps0_r], %[vps0_l], %[vps0_r] \n\t"
- "or %[vqs1_r], %[vqs1_l], %[vqs1_r] \n\t"
- "or %[vps1_r], %[vps1_l], %[vps1_r] \n\t"
- "or %[vqs2_r], %[vqs2_l], %[vqs2_r] \n\t"
- "or %[vps2_r], %[vps2_l], %[vps2_r] \n\t"
-
- : [vps1_l] "+r" (vps1_l), [vps1_r] "+r" (vps1_r), [vqs1_l] "+r" (vqs1_l),
- [vqs1_r] "+r" (vqs1_r), [vps0_l] "+r" (vps0_l), [vps0_r] "+r" (vps0_r),
- [vqs0_l] "+r" (vqs0_l), [vqs0_r] "+r" (vqs0_r), [vqs2_l] "+r" (vqs2_l),
- [vqs2_r] "+r" (vqs2_r), [vps2_r] "+r" (vps2_r), [vps2_l] "+r" (vps2_l)
- : [HWM] "r" (HWM)
- );
-
- *ps0 = vps0_r ^ N128;
- *ps1 = vps1_r ^ N128;
- *ps2 = vps2_r ^ N128;
- *qs0 = vqs0_r ^ N128;
- *qs1 = vqs1_r ^ N128;
- *qs2 = vqs2_r ^ N128;
-}
-
-void vp8_mbloop_filter_horizontal_edge_mips
-(
- unsigned char *s,
- int p,
- unsigned int flimit,
- unsigned int limit,
- unsigned int thresh,
- int count
-)
-{
- int i;
- uint32_t mask, hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *sm1, *s0, *s1, *s2, *s3, *s4, *s5, *s6;
-
- mask = 0;
- hev = 0;
- i = 0;
- p1 = 0;
- p2 = 0;
- p3 = 0;
- p4 = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- sm1 = s - (p << 2);
- s0 = s - p - p - p;
- s1 = s - p - p;
- s2 = s - p;
- s3 = s;
- s4 = s + p;
- s5 = s + p + p;
- s6 = s + p + p + p;
-
- /* prefetch data for load */
- prefetch_load_lf(s + p);
-
- /* apply filter on 4 pixesl at the same time */
- do
- {
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_mbfilter_mips(mask, hev, &p0, &p1, &p2, &p3, &p4, &p5);
-
- /* unpack processed 4x4 neighborhood
- * memory is 4 byte aligned
- */
- *((uint32_t *)s0) = p0;
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- *((uint32_t *)s5) = p5;
- }
- }
-
- sm1 += 4;
- s0 += 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- s5 += 4;
- s6 += 4;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_mbfilter_mips(mask, hev, &p0, &p1, &p2, &p3, &p4, &p5);
-
- /* unpack processed 4x4 neighborhood
- * memory is 4 byte aligned
- */
- *((uint32_t *)s0) = p0;
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- *((uint32_t *)s5) = p5;
- }
- }
-
- sm1 += 4;
- s0 += 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- s5 += 4;
- s6 += 4;
-
- i += 8;
- }
-
- while (i < count);
-}
-
-void vp8_mbloop_filter_uvhorizontal_edge_mips
-(
- unsigned char *s,
- int p,
- unsigned int flimit,
- unsigned int limit,
- unsigned int thresh,
- int count
-)
-{
- uint32_t mask, hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *sm1, *s0, *s1, *s2, *s3, *s4, *s5, *s6;
-
- mask = 0;
- hev = 0;
- p1 = 0;
- p2 = 0;
- p3 = 0;
- p4 = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- sm1 = s - (p << 2);
- s0 = s - p - p - p;
- s1 = s - p - p;
- s2 = s - p;
- s3 = s;
- s4 = s + p;
- s5 = s + p + p;
- s6 = s + p + p + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- /* if mask == 0 do filtering is not needed */
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- if (mask)
- {
- /* filtering */
- vp8_mbfilter_mips(mask, hev, &p0, &p1, &p2, &p3, &p4, &p5);
-
- /* unpack processed 4x4 neighborhood
- * memory is 4 byte aligned
- */
- *((uint32_t *)s0) = p0;
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- *((uint32_t *)s5) = p5;
- }
- }
-
- sm1 += 4;
- s0 += 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- s5 += 4;
- s6 += 4;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p1 = *((uint32_t *)(s1));
- p2 = *((uint32_t *)(s2));
- p3 = *((uint32_t *)(s3));
- p4 = *((uint32_t *)(s4));
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- pm1 = *((uint32_t *)(sm1));
- p0 = *((uint32_t *)(s0));
- p5 = *((uint32_t *)(s5));
- p6 = *((uint32_t *)(s6));
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_mbfilter_mips(mask, hev, &p0, &p1, &p2, &p3, &p4, &p5);
-
- /* unpack processed 4x4 neighborhood
- * memory is 4 byte aligned
- */
- *((uint32_t *)s0) = p0;
- *((uint32_t *)s1) = p1;
- *((uint32_t *)s2) = p2;
- *((uint32_t *)s3) = p3;
- *((uint32_t *)s4) = p4;
- *((uint32_t *)s5) = p5;
- }
- }
-}
-
-
-void vp8_mbloop_filter_vertical_edge_mips
-(
- unsigned char *s,
- int p,
- unsigned int flimit,
- unsigned int limit,
- unsigned int thresh,
- int count
-)
-{
-
- int i;
- uint32_t mask, hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *s1, *s2, *s3, *s4;
- uint32_t prim1, prim2, sec3, sec4, prim3, prim4;
-
- mask = 0;
- hev = 0;
- i = 0;
- pm1 = 0;
- p0 = 0;
- p1 = 0;
- p2 = 0;
- p3 = 0;
- p4 = 0;
- p5 = 0;
- p6 = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- /* apply filter on 4 pixesl at the same time */
- do
- {
- s1 = s;
- s2 = s + p;
- s3 = s2 + p;
- s4 = s3 + p;
- s = s4 + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_mbfilter_mips(mask, hev, &p0, &p1, &p2, &p3, &p4, &p5);
-
- /* don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s4]) \n\t"
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
- "sb %[p0], -3(%[s4]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s4] "r" (s4),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s3]) \n\t"
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
- "sb %[p0], -3(%[s3]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s3] "r" (s3),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s2]) \n\t"
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
- "sb %[p0], -3(%[s2]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s2] "r" (s2),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s1]) \n\t"
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
- "sb %[p0], -3(%[s1]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s1] "r" (s1),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
- }
- }
-
- i += 4;
- }
-
- while (i < count);
-}
-
-void vp8_mbloop_filter_uvvertical_edge_mips
-(
- unsigned char *s,
- int p,
- unsigned int flimit,
- unsigned int limit,
- unsigned int thresh,
- int count
-)
-{
- uint32_t mask, hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- unsigned char *s1, *s2, *s3, *s4;
- uint32_t prim1, prim2, sec3, sec4, prim3, prim4;
-
- mask = 0;
- hev = 0;
- pm1 = 0;
- p0 = 0;
- p1 = 0;
- p2 = 0;
- p3 = 0;
- p4 = 0;
- p5 = 0;
- p6 = 0;
-
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
-
- /* apply filter on 4 pixesl at the same time */
-
- s1 = s;
- s2 = s + p;
- s3 = s2 + p;
- s4 = s3 + p;
-
- /* prefetch data for load */
- prefetch_load_lf(s + 2 * p);
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6,
- thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_mbfilter_mips(mask, hev, &p0, &p1, &p2, &p3, &p4, &p5);
-
- /* don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s4]) \n\t"
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
- "sb %[p0], -3(%[s4]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s4] "r" (s4),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s3]) \n\t"
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
- "sb %[p0], -3(%[s3]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s3] "r" (s3),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s2]) \n\t"
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
- "sb %[p0], -3(%[s2]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s2] "r" (s2),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s1]) \n\t"
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
- "sb %[p0], -3(%[s1]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s1] "r" (s1),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
- }
- }
-
- s1 = s4 + p;
- s2 = s1 + p;
- s3 = s2 + p;
- s4 = s3 + p;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0)))
- {
-
- vp8_filter_mask_vec_mips(limit, flimit, p1, p2, pm1, p0, p3, p4, p5, p6, thresh, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask)
- {
- /* filtering */
- vp8_mbfilter_mips(mask, hev, &p0, &p1, &p2, &p3, &p4, &p5);
-
- /* don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s4]) \n\t"
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
- "sb %[p0], -3(%[s4]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s4] "r" (s4),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s3]) \n\t"
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
- "sb %[p0], -3(%[s3]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s3] "r" (s3),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s2]) \n\t"
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
- "sb %[p0], -3(%[s2]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s2] "r" (s2),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
-
- __asm__ __volatile__ (
- "srl %[p5], %[p5], 8 \n\t"
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
- "srl %[p0], %[p0], 8 \n\t"
- : [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p5], 2(%[s1]) \n\t"
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
- "sb %[p0], -3(%[s1]) \n\t"
- :
- : [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3), [s1] "r" (s1),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0)
- );
- }
- }
-}
-
-/* Horizontal MB filtering */
-void vp8_loop_filter_mbh_dspr2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned int thresh_vec, flimit_vec, limit_vec;
- unsigned char thresh, flimit, limit, flimit_temp;
-
- /* use direct value instead pointers */
- limit = *(lfi->lim);
- flimit_temp = *(lfi->mblim);
- thresh = *(lfi->hev_thr);
- flimit = flimit_temp;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[thresh] \n\t"
- "replv.qb %[flimit_vec], %[flimit] \n\t"
- "replv.qb %[limit_vec], %[limit] \n\t"
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec), [limit_vec] "=r" (limit_vec)
- : [thresh] "r" (thresh), [flimit] "r" (flimit), [limit] "r" (limit)
- );
-
- vp8_mbloop_filter_horizontal_edge_mips(y_ptr, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
-
- if (u_ptr)
- {
- vp8_mbloop_filter_uvhorizontal_edge_mips(u_ptr, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
- }
-
- if (v_ptr)
- {
- vp8_mbloop_filter_uvhorizontal_edge_mips(v_ptr, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
- }
-}
-
-
-/* Vertical MB Filtering */
-void vp8_loop_filter_mbv_dspr2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned int thresh_vec, flimit_vec, limit_vec;
- unsigned char thresh, flimit, limit, flimit_temp;
-
- /* use direct value instead pointers */
- limit = *(lfi->lim);
- flimit_temp = *(lfi->mblim);
- thresh = *(lfi->hev_thr);
- flimit = flimit_temp;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[thresh] \n\t"
- "replv.qb %[flimit_vec], %[flimit] \n\t"
- "replv.qb %[limit_vec], %[limit] \n\t"
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec), [limit_vec] "=r" (limit_vec)
- : [thresh] "r" (thresh), [flimit] "r" (flimit), [limit] "r" (limit)
- );
-
- vp8_mbloop_filter_vertical_edge_mips(y_ptr, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
-
- if (u_ptr)
- vp8_mbloop_filter_uvvertical_edge_mips(u_ptr, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
-
- if (v_ptr)
- vp8_mbloop_filter_uvvertical_edge_mips(v_ptr, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
-}
-
-
-/* Horizontal B Filtering */
-void vp8_loop_filter_bh_dspr2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned int thresh_vec, flimit_vec, limit_vec;
- unsigned char thresh, flimit, limit, flimit_temp;
-
- /* use direct value instead pointers */
- limit = *(lfi->lim);
- flimit_temp = *(lfi->blim);
- thresh = *(lfi->hev_thr);
- flimit = flimit_temp;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[thresh] \n\t"
- "replv.qb %[flimit_vec], %[flimit] \n\t"
- "replv.qb %[limit_vec], %[limit] \n\t"
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec), [limit_vec] "=r" (limit_vec)
- : [thresh] "r" (thresh), [flimit] "r" (flimit), [limit] "r" (limit)
- );
-
- vp8_loop_filter_horizontal_edge_mips(y_ptr + 4 * y_stride, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
- vp8_loop_filter_horizontal_edge_mips(y_ptr + 8 * y_stride, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
- vp8_loop_filter_horizontal_edge_mips(y_ptr + 12 * y_stride, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
-
- if (u_ptr)
- vp8_loop_filter_uvhorizontal_edge_mips(u_ptr + 4 * uv_stride, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
-
- if (v_ptr)
- vp8_loop_filter_uvhorizontal_edge_mips(v_ptr + 4 * uv_stride, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
-}
-
-
-/* Vertical B Filtering */
-void vp8_loop_filter_bv_dspr2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- unsigned int thresh_vec, flimit_vec, limit_vec;
- unsigned char thresh, flimit, limit, flimit_temp;
-
- /* use direct value instead pointers */
- limit = *(lfi->lim);
- flimit_temp = *(lfi->blim);
- thresh = *(lfi->hev_thr);
- flimit = flimit_temp;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[thresh] \n\t"
- "replv.qb %[flimit_vec], %[flimit] \n\t"
- "replv.qb %[limit_vec], %[limit] \n\t"
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec), [limit_vec] "=r" (limit_vec)
- : [thresh] "r" (thresh), [flimit] "r" (flimit), [limit] "r" (limit)
- );
-
- vp8_loop_filter_vertical_edge_mips(y_ptr + 4, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
- vp8_loop_filter_vertical_edge_mips(y_ptr + 8, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
- vp8_loop_filter_vertical_edge_mips(y_ptr + 12, y_stride, flimit_vec, limit_vec, thresh_vec, 16);
-
- if (u_ptr)
- vp8_loop_filter_uvvertical_edge_mips(u_ptr + 4, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
-
- if (v_ptr)
- vp8_loop_filter_uvvertical_edge_mips(v_ptr + 4, uv_stride, flimit_vec, limit_vec, thresh_vec, 0);
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/reconinter_dspr2.c b/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/reconinter_dspr2.c
deleted file mode 100644
index a14b397..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mips/dspr2/reconinter_dspr2.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx/vpx_integer.h"
-
-#if HAVE_DSPR2
-inline void prefetch_load_int(unsigned char *src)
-{
- __asm__ __volatile__ (
- "pref 0, 0(%[src]) \n\t"
- :
- : [src] "r" (src)
- );
-}
-
-
-__inline void vp8_copy_mem16x16_dspr2(
- unsigned char *RESTRICT src,
- int src_stride,
- unsigned char *RESTRICT dst,
- int dst_stride)
-{
- int r;
- unsigned int a0, a1, a2, a3;
-
- for (r = 16; r--;)
- {
- /* load src data in cache memory */
- prefetch_load_int(src + src_stride);
-
- /* use unaligned memory load and store */
- __asm__ __volatile__ (
- "ulw %[a0], 0(%[src]) \n\t"
- "ulw %[a1], 4(%[src]) \n\t"
- "ulw %[a2], 8(%[src]) \n\t"
- "ulw %[a3], 12(%[src]) \n\t"
- "sw %[a0], 0(%[dst]) \n\t"
- "sw %[a1], 4(%[dst]) \n\t"
- "sw %[a2], 8(%[dst]) \n\t"
- "sw %[a3], 12(%[dst]) \n\t"
- : [a0] "=&r" (a0), [a1] "=&r" (a1),
- [a2] "=&r" (a2), [a3] "=&r" (a3)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-
-__inline void vp8_copy_mem8x8_dspr2(
- unsigned char *RESTRICT src,
- int src_stride,
- unsigned char *RESTRICT dst,
- int dst_stride)
-{
- int r;
- unsigned int a0, a1;
-
- /* load src data in cache memory */
- prefetch_load_int(src + src_stride);
-
- for (r = 8; r--;)
- {
- /* use unaligned memory load and store */
- __asm__ __volatile__ (
- "ulw %[a0], 0(%[src]) \n\t"
- "ulw %[a1], 4(%[src]) \n\t"
- "sw %[a0], 0(%[dst]) \n\t"
- "sw %[a1], 4(%[dst]) \n\t"
- : [a0] "=&r" (a0), [a1] "=&r" (a1)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-
-__inline void vp8_copy_mem8x4_dspr2(
- unsigned char *RESTRICT src,
- int src_stride,
- unsigned char *RESTRICT dst,
- int dst_stride)
-{
- int r;
- unsigned int a0, a1;
-
- /* load src data in cache memory */
- prefetch_load_int(src + src_stride);
-
- for (r = 4; r--;)
- {
- /* use unaligned memory load and store */
- __asm__ __volatile__ (
- "ulw %[a0], 0(%[src]) \n\t"
- "ulw %[a1], 4(%[src]) \n\t"
- "sw %[a0], 0(%[dst]) \n\t"
- "sw %[a1], 4(%[dst]) \n\t"
- : [a0] "=&r" (a0), [a1] "=&r" (a1)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/modecont.c b/videocodec/libvpx_internal/libvpx/vp8/common/modecont.c
deleted file mode 100644
index 86a74bc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/modecont.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "entropy.h"
-
-const int vp8_mode_contexts[6][4] =
-{
- {
- /* 0 */
- 7, 1, 1, 143,
- },
- {
- /* 1 */
- 14, 18, 14, 107,
- },
- {
- /* 2 */
- 135, 64, 57, 68,
- },
- {
- /* 3 */
- 60, 56, 128, 65,
- },
- {
- /* 4 */
- 159, 134, 128, 34,
- },
- {
- /* 5 */
- 234, 188, 128, 28,
- },
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/modecont.h b/videocodec/libvpx_internal/libvpx/vp8/common/modecont.h
deleted file mode 100644
index ff34c33..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/modecont.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_MODECONT_H_
-#define VP8_COMMON_MODECONT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const int vp8_mode_contexts[6][4];
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_MODECONT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/mv.h b/videocodec/libvpx_internal/libvpx/vp8/common/mv.h
deleted file mode 100644
index 111ccd6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/mv.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_MV_H_
-#define VP8_COMMON_MV_H_
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct
-{
- short row;
- short col;
-} MV;
-
-typedef union int_mv
-{
- uint32_t as_int;
- MV as_mv;
-} int_mv; /* facilitates faster equality tests and copies */
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_MV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/onyx.h b/videocodec/libvpx_internal/libvpx/vp8/common/onyx.h
deleted file mode 100644
index 119e40c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/onyx.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ONYX_H_
-#define VP8_COMMON_ONYX_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "vpx_config.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
-#include "vpx_scale/yv12config.h"
-#include "ppflags.h"
-
- struct VP8_COMP;
-
- /* Create/destroy static data structures. */
-
- typedef enum
- {
- NORMAL = 0,
- FOURFIVE = 1,
- THREEFIVE = 2,
- ONETWO = 3
-
- } VPX_SCALING;
-
- typedef enum
- {
- USAGE_LOCAL_FILE_PLAYBACK = 0x0,
- USAGE_STREAM_FROM_SERVER = 0x1,
- USAGE_CONSTRAINED_QUALITY = 0x2,
- USAGE_CONSTANT_QUALITY = 0x3
- } END_USAGE;
-
-
- typedef enum
- {
- MODE_REALTIME = 0x0,
- MODE_GOODQUALITY = 0x1,
- MODE_BESTQUALITY = 0x2,
- MODE_FIRSTPASS = 0x3,
- MODE_SECONDPASS = 0x4,
- MODE_SECONDPASS_BEST = 0x5
- } MODE;
-
- typedef enum
- {
- FRAMEFLAGS_KEY = 1,
- FRAMEFLAGS_GOLDEN = 2,
- FRAMEFLAGS_ALTREF = 4
- } FRAMETYPE_FLAGS;
-
-
-#include <assert.h>
- static void Scale2Ratio(int mode, int *hr, int *hs)
- {
- switch (mode)
- {
- case NORMAL:
- *hr = 1;
- *hs = 1;
- break;
- case FOURFIVE:
- *hr = 4;
- *hs = 5;
- break;
- case THREEFIVE:
- *hr = 3;
- *hs = 5;
- break;
- case ONETWO:
- *hr = 1;
- *hs = 2;
- break;
- default:
- *hr = 1;
- *hs = 1;
- assert(0);
- break;
- }
- }
-
- typedef struct
- {
- /* 4 versions of bitstream defined:
- * 0 best quality/slowest decode, 3 lowest quality/fastest decode
- */
- int Version;
- int Width;
- int Height;
- struct vpx_rational timebase;
- unsigned int target_bandwidth; /* kilobits per second */
-
- /* parameter used for applying pre processing blur: recommendation 0 */
- int noise_sensitivity;
-
- /* parameter used for sharpening output: recommendation 0: */
- int Sharpness;
- int cpu_used;
- unsigned int rc_max_intra_bitrate_pct;
-
- /* mode ->
- *(0)=Realtime/Live Encoding. This mode is optimized for realtim
- * encoding (for example, capturing a television signal or feed
- * from a live camera). ( speed setting controls how fast )
- *(1)=Good Quality Fast Encoding. The encoder balances quality with
- * the amount of time it takes to encode the output. ( speed
- * setting controls how fast )
- *(2)=One Pass - Best Quality. The encoder places priority on the
- * quality of the output over encoding speed. The output is
- * compressed at the highest possible quality. This option takes
- * the longest amount of time to encode. ( speed setting ignored
- * )
- *(3)=Two Pass - First Pass. The encoder generates a file of
- * statistics for use in the second encoding pass. ( speed
- * setting controls how fast )
- *(4)=Two Pass - Second Pass. The encoder uses the statistics that
- * were generated in the first encoding pass to create the
- * compressed output. ( speed setting controls how fast )
- *(5)=Two Pass - Second Pass Best. The encoder uses the statistics
- * that were generated in the first encoding pass to create the
- * compressed output using the highest possible quality, and
- * taking a longer amount of time to encode.. ( speed setting
- * ignored )
- */
- int Mode;
-
- /* Key Framing Operations */
- int auto_key; /* automatically detect cut scenes */
- int key_freq; /* maximum distance to key frame. */
-
- /* lagged compression (if allow_lag == 0 lag_in_frames is ignored) */
- int allow_lag;
- int lag_in_frames; /* how many frames lag before we start encoding */
-
- /*
- * DATARATE CONTROL OPTIONS
- */
-
- int end_usage; /* vbr or cbr */
-
- /* buffer targeting aggressiveness */
- int under_shoot_pct;
- int over_shoot_pct;
-
- /* buffering parameters */
- int64_t starting_buffer_level;
- int64_t optimal_buffer_level;
- int64_t maximum_buffer_size;
-
- int64_t starting_buffer_level_in_ms;
- int64_t optimal_buffer_level_in_ms;
- int64_t maximum_buffer_size_in_ms;
-
- /* controlling quality */
- int fixed_q;
- int worst_allowed_q;
- int best_allowed_q;
- int cq_level;
-
- /* allow internal resizing */
- int allow_spatial_resampling;
- int resample_down_water_mark;
- int resample_up_water_mark;
-
- /* allow internal frame rate alterations */
- int allow_df;
- int drop_frames_water_mark;
-
- /* two pass datarate control */
- int two_pass_vbrbias;
- int two_pass_vbrmin_section;
- int two_pass_vbrmax_section;
-
- /*
- * END DATARATE CONTROL OPTIONS
- */
-
- /* these parameters aren't to be used in final build don't use!!! */
- int play_alternate;
- int alt_freq;
- int alt_q;
- int key_q;
- int gold_q;
-
-
- int multi_threaded; /* how many threads to run the encoder on */
- int token_partitions; /* how many token partitions to create */
-
- /* early breakout threshold: for video conf recommend 800 */
- int encode_breakout;
-
- /* Bitfield defining the error resiliency features to enable.
- * Can provide decodable frames after losses in previous
- * frames and decodable partitions after losses in the same frame.
- */
- unsigned int error_resilient_mode;
-
- int arnr_max_frames;
- int arnr_strength;
- int arnr_type;
-
- struct vpx_fixed_buf two_pass_stats_in;
- struct vpx_codec_pkt_list *output_pkt_list;
-
- vp8e_tuning tuning;
-
- /* Temporal scaling parameters */
- unsigned int number_of_layers;
- unsigned int target_bitrate[VPX_TS_MAX_PERIODICITY];
- unsigned int rate_decimator[VPX_TS_MAX_PERIODICITY];
- unsigned int periodicity;
- unsigned int layer_id[VPX_TS_MAX_PERIODICITY];
-
-#if CONFIG_MULTI_RES_ENCODING
- /* Number of total resolutions encoded */
- unsigned int mr_total_resolutions;
-
- /* Current encoder ID */
- unsigned int mr_encoder_id;
-
- /* Down-sampling factor */
- vpx_rational_t mr_down_sampling_factor;
-
- /* Memory location to store low-resolution encoder's mode info */
- void* mr_low_res_mode_info;
-#endif
- } VP8_CONFIG;
-
-
- void vp8_initialize();
-
- struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf);
- void vp8_remove_compressor(struct VP8_COMP* *comp);
-
- void vp8_init_config(struct VP8_COMP* onyx, VP8_CONFIG *oxcf);
- void vp8_change_config(struct VP8_COMP* onyx, VP8_CONFIG *oxcf);
-
- int vp8_receive_raw_frame(struct VP8_COMP* comp, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time_stamp);
- int vp8_get_compressed_data(struct VP8_COMP* comp, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, unsigned char *dest_end, int64_t *time_stamp, int64_t *time_end, int flush);
- int vp8_get_preview_raw_frame(struct VP8_COMP* comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags);
-
- int vp8_use_as_reference(struct VP8_COMP* comp, int ref_frame_flags);
- int vp8_update_reference(struct VP8_COMP* comp, int ref_frame_flags);
- int vp8_get_reference(struct VP8_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd);
- int vp8_set_reference(struct VP8_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd);
- int vp8_update_entropy(struct VP8_COMP* comp, int update);
- int vp8_set_roimap(struct VP8_COMP* comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]);
- int vp8_set_active_map(struct VP8_COMP* comp, unsigned char *map, unsigned int rows, unsigned int cols);
- int vp8_set_internal_size(struct VP8_COMP* comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
- int vp8_get_quantizer(struct VP8_COMP* c);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // VP8_COMMON_ONYX_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/onyxc_int.h b/videocodec/libvpx_internal/libvpx/vp8/common/onyxc_int.h
deleted file mode 100644
index 6d89865..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/onyxc_int.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ONYXC_INT_H_
-#define VP8_COMMON_ONYXC_INT_H_
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "loopfilter.h"
-#include "entropymv.h"
-#include "entropy.h"
-#if CONFIG_POSTPROC
-#include "postproc.h"
-#endif
-
-/*#ifdef PACKET_TESTING*/
-#include "header.h"
-/*#endif*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MINQ 0
-#define MAXQ 127
-#define QINDEX_RANGE (MAXQ + 1)
-
-#define NUM_YV12_BUFFERS 4
-
-#define MAX_PARTITIONS 9
-
-typedef struct frame_contexts
-{
- vp8_prob bmode_prob [VP8_BINTRAMODES-1];
- vp8_prob ymode_prob [VP8_YMODES-1]; /* interframe intra mode probs */
- vp8_prob uv_mode_prob [VP8_UV_MODES-1];
- vp8_prob sub_mv_ref_prob [VP8_SUBMVREFS-1];
- vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
- MV_CONTEXT mvc[2];
-} FRAME_CONTEXT;
-
-typedef enum
-{
- ONE_PARTITION = 0,
- TWO_PARTITION = 1,
- FOUR_PARTITION = 2,
- EIGHT_PARTITION = 3
-} TOKEN_PARTITION;
-
-typedef enum
-{
- RECON_CLAMP_REQUIRED = 0,
- RECON_CLAMP_NOTREQUIRED = 1
-} CLAMP_TYPE;
-
-typedef struct VP8Common
-
-{
- struct vpx_internal_error_info error;
-
- DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][2]);
- DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][2]);
- DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][2]);
-
- int Width;
- int Height;
- int horiz_scale;
- int vert_scale;
-
- CLAMP_TYPE clamp_type;
-
- YV12_BUFFER_CONFIG *frame_to_show;
-
- YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS];
- int fb_idx_ref_cnt[NUM_YV12_BUFFERS];
- int new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx;
-
- YV12_BUFFER_CONFIG temp_scale_frame;
-
-#if CONFIG_POSTPROC
- YV12_BUFFER_CONFIG post_proc_buffer;
- YV12_BUFFER_CONFIG post_proc_buffer_int;
- int post_proc_buffer_int_used;
- unsigned char *pp_limits_buffer; /* post-processing filter coefficients */
-#endif
-
- FRAME_TYPE last_frame_type; /* Save last frame's frame type for motion search. */
- FRAME_TYPE frame_type;
-
- int show_frame;
-
- int frame_flags;
- int MBs;
- int mb_rows;
- int mb_cols;
- int mode_info_stride;
-
- /* profile settings */
- int mb_no_coeff_skip;
- int no_lpf;
- int use_bilinear_mc_filter;
- int full_pixel;
-
- int base_qindex;
-
- int y1dc_delta_q;
- int y2dc_delta_q;
- int y2ac_delta_q;
- int uvdc_delta_q;
- int uvac_delta_q;
-
- /* We allocate a MODE_INFO struct for each macroblock, together with
- an extra row on top and column on the left to simplify prediction. */
-
- MODE_INFO *mip; /* Base of allocated array */
- MODE_INFO *mi; /* Corresponds to upper left visible macroblock */
-#if CONFIG_ERROR_CONCEALMENT
- MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */
- MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
-#endif
- MODE_INFO *show_frame_mi; /* MODE_INFO for the last decoded frame
- to show */
- LOOPFILTERTYPE filter_type;
-
- loop_filter_info_n lf_info;
-
- int filter_level;
- int last_sharpness_level;
- int sharpness_level;
-
- int refresh_last_frame; /* Two state 0 = NO, 1 = YES */
- int refresh_golden_frame; /* Two state 0 = NO, 1 = YES */
- int refresh_alt_ref_frame; /* Two state 0 = NO, 1 = YES */
-
- int copy_buffer_to_gf; /* 0 none, 1 Last to GF, 2 ARF to GF */
- int copy_buffer_to_arf; /* 0 none, 1 Last to ARF, 2 GF to ARF */
-
- int refresh_entropy_probs; /* Two state 0 = NO, 1 = YES */
-
- int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */
-
- /* Y,U,V,Y2 */
- ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */
- ENTROPY_CONTEXT_PLANES left_context; /* (up to) 4 contexts "" */
-
- FRAME_CONTEXT lfc; /* last frame entropy */
- FRAME_CONTEXT fc; /* this frame entropy */
-
- unsigned int current_video_frame;
-
- int version;
-
- TOKEN_PARTITION multi_token_partition;
-
-#ifdef PACKET_TESTING
- VP8_HEADER oh;
-#endif
-#if CONFIG_POSTPROC_VISUALIZER
- double bitrate;
- double framerate;
-#endif
-
-#if CONFIG_MULTITHREAD
- int processor_core_count;
-#endif
-#if CONFIG_POSTPROC
- struct postproc_state postproc_state;
-#endif
- int cpu_caps;
-} VP8_COMMON;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_ONYXC_INT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/onyxd.h b/videocodec/libvpx_internal/libvpx/vp8/common/onyxd.h
deleted file mode 100644
index e37b29f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/onyxd.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_ONYXD_H_
-#define VP8_COMMON_ONYXD_H_
-
-
-/* Create/destroy static data structures. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#include "vpx_scale/yv12config.h"
-#include "ppflags.h"
-#include "vpx_ports/mem.h"
-#include "vpx/vpx_codec.h"
-#include "vpx/vp8.h"
-
- struct VP8D_COMP;
-
- typedef struct
- {
- int Width;
- int Height;
- int Version;
- int postprocess;
- int max_threads;
- int error_concealment;
- } VP8D_CONFIG;
-
- typedef enum
- {
- VP8D_OK = 0
- } VP8D_SETTING;
-
- void vp8dx_initialize(void);
-
- void vp8dx_set_setting(struct VP8D_COMP* comp, VP8D_SETTING oxst, int x);
-
- int vp8dx_get_setting(struct VP8D_COMP* comp, VP8D_SETTING oxst);
-
- int vp8dx_receive_compressed_data(struct VP8D_COMP* comp,
- size_t size, const uint8_t *dest,
- int64_t time_stamp);
- int vp8dx_get_raw_frame(struct VP8D_COMP* comp, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags);
-
- vpx_codec_err_t vp8dx_get_reference(struct VP8D_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd);
- vpx_codec_err_t vp8dx_set_reference(struct VP8D_COMP* comp, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif // VP8_COMMON_ONYXD_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/postproc.c b/videocodec/libvpx_internal/libvpx/vp8/common/postproc.c
deleted file mode 100644
index da2d1da..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/postproc.c
+++ /dev/null
@@ -1,1201 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_scale_rtcd.h"
-#include "vpx_scale/yv12config.h"
-#include "postproc.h"
-#include "common.h"
-#include "vpx_scale/vpx_scale.h"
-#include "systemdependent.h"
-
-#include <limits.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#define RGB_TO_YUV(t) \
- ( (0.257*(float)(t>>16)) + (0.504*(float)(t>>8&0xff)) + (0.098*(float)(t&0xff)) + 16), \
- (-(0.148*(float)(t>>16)) - (0.291*(float)(t>>8&0xff)) + (0.439*(float)(t&0xff)) + 128), \
- ( (0.439*(float)(t>>16)) - (0.368*(float)(t>>8&0xff)) - (0.071*(float)(t&0xff)) + 128)
-
-/* global constants */
-#if CONFIG_POSTPROC_VISUALIZER
-static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] =
-{
- { RGB_TO_YUV(0x98FB98) }, /* PaleGreen */
- { RGB_TO_YUV(0x00FF00) }, /* Green */
- { RGB_TO_YUV(0xADFF2F) }, /* GreenYellow */
- { RGB_TO_YUV(0x228B22) }, /* ForestGreen */
- { RGB_TO_YUV(0x006400) }, /* DarkGreen */
- { RGB_TO_YUV(0x98F5FF) }, /* Cadet Blue */
- { RGB_TO_YUV(0x6CA6CD) }, /* Sky Blue */
- { RGB_TO_YUV(0x00008B) }, /* Dark blue */
- { RGB_TO_YUV(0x551A8B) }, /* Purple */
- { RGB_TO_YUV(0xFF0000) } /* Red */
-};
-
-static const unsigned char B_PREDICTION_MODE_colors[B_MODE_COUNT][3] =
-{
- { RGB_TO_YUV(0x6633ff) }, /* Purple */
- { RGB_TO_YUV(0xcc33ff) }, /* Magenta */
- { RGB_TO_YUV(0xff33cc) }, /* Pink */
- { RGB_TO_YUV(0xff3366) }, /* Coral */
- { RGB_TO_YUV(0x3366ff) }, /* Blue */
- { RGB_TO_YUV(0xed00f5) }, /* Dark Blue */
- { RGB_TO_YUV(0x2e00b8) }, /* Dark Purple */
- { RGB_TO_YUV(0xff6633) }, /* Orange */
- { RGB_TO_YUV(0x33ccff) }, /* Light Blue */
- { RGB_TO_YUV(0x8ab800) }, /* Green */
- { RGB_TO_YUV(0xffcc33) }, /* Light Orange */
- { RGB_TO_YUV(0x33ffcc) }, /* Aqua */
- { RGB_TO_YUV(0x66ff33) }, /* Light Green */
- { RGB_TO_YUV(0xccff33) }, /* Yellow */
-};
-
-static const unsigned char MV_REFERENCE_FRAME_colors[MAX_REF_FRAMES][3] =
-{
- { RGB_TO_YUV(0x00ff00) }, /* Blue */
- { RGB_TO_YUV(0x0000ff) }, /* Green */
- { RGB_TO_YUV(0xffff00) }, /* Yellow */
- { RGB_TO_YUV(0xff0000) }, /* Red */
-};
-#endif
-
-const short vp8_rv[] =
-{
- 8, 5, 2, 2, 8, 12, 4, 9, 8, 3,
- 0, 3, 9, 0, 0, 0, 8, 3, 14, 4,
- 10, 1, 11, 14, 1, 14, 9, 6, 12, 11,
- 8, 6, 10, 0, 0, 8, 9, 0, 3, 14,
- 8, 11, 13, 4, 2, 9, 0, 3, 9, 6,
- 1, 2, 3, 14, 13, 1, 8, 2, 9, 7,
- 3, 3, 1, 13, 13, 6, 6, 5, 2, 7,
- 11, 9, 11, 8, 7, 3, 2, 0, 13, 13,
- 14, 4, 12, 5, 12, 10, 8, 10, 13, 10,
- 4, 14, 4, 10, 0, 8, 11, 1, 13, 7,
- 7, 14, 6, 14, 13, 2, 13, 5, 4, 4,
- 0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
- 8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
- 3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
- 3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
- 13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
- 5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
- 9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
- 4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
- 3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
- 11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
- 5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
- 0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
- 10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
- 4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
- 0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
- 8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
- 3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
- 3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
- 13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
- 5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
- 9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
- 4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
- 3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
- 11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
- 5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
- 0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
- 10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
- 4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
- 3, 8, 3, 7, 8, 5, 11, 4, 12, 3,
- 11, 9, 14, 8, 14, 13, 4, 3, 1, 2,
- 14, 6, 5, 4, 4, 11, 4, 6, 2, 1,
- 5, 8, 8, 12, 13, 5, 14, 10, 12, 13,
- 0, 9, 5, 5, 11, 10, 13, 9, 10, 13,
-};
-
-extern void vp8_blit_text(const char *msg, unsigned char *address, const int pitch);
-extern void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch);
-/***********************************************************************************************************
- */
-void vp8_post_proc_down_and_across_mb_row_c
-(
- unsigned char *src_ptr,
- unsigned char *dst_ptr,
- int src_pixels_per_line,
- int dst_pixels_per_line,
- int cols,
- unsigned char *f,
- int size
-)
-{
- unsigned char *p_src, *p_dst;
- int row;
- int col;
- unsigned char v;
- unsigned char d[4];
-
- for (row = 0; row < size; row++)
- {
- /* post_proc_down for one row */
- p_src = src_ptr;
- p_dst = dst_ptr;
-
- for (col = 0; col < cols; col++)
- {
- unsigned char p_above2 = p_src[col - 2 * src_pixels_per_line];
- unsigned char p_above1 = p_src[col - src_pixels_per_line];
- unsigned char p_below1 = p_src[col + src_pixels_per_line];
- unsigned char p_below2 = p_src[col + 2 * src_pixels_per_line];
-
- v = p_src[col];
-
- if ((abs(v - p_above2) < f[col]) && (abs(v - p_above1) < f[col])
- && (abs(v - p_below1) < f[col]) && (abs(v - p_below2) < f[col]))
- {
- unsigned char k1, k2, k3;
- k1 = (p_above2 + p_above1 + 1) >> 1;
- k2 = (p_below2 + p_below1 + 1) >> 1;
- k3 = (k1 + k2 + 1) >> 1;
- v = (k3 + v + 1) >> 1;
- }
-
- p_dst[col] = v;
- }
-
- /* now post_proc_across */
- p_src = dst_ptr;
- p_dst = dst_ptr;
-
- p_src[-2] = p_src[-1] = p_src[0];
- p_src[cols] = p_src[cols + 1] = p_src[cols - 1];
-
- for (col = 0; col < cols; col++)
- {
- v = p_src[col];
-
- if ((abs(v - p_src[col - 2]) < f[col])
- && (abs(v - p_src[col - 1]) < f[col])
- && (abs(v - p_src[col + 1]) < f[col])
- && (abs(v - p_src[col + 2]) < f[col]))
- {
- unsigned char k1, k2, k3;
- k1 = (p_src[col - 2] + p_src[col - 1] + 1) >> 1;
- k2 = (p_src[col + 2] + p_src[col + 1] + 1) >> 1;
- k3 = (k1 + k2 + 1) >> 1;
- v = (k3 + v + 1) >> 1;
- }
-
- d[col & 3] = v;
-
- if (col >= 2)
- p_dst[col - 2] = d[(col - 2) & 3];
- }
-
- /* handle the last two pixels */
- p_dst[col - 2] = d[(col - 2) & 3];
- p_dst[col - 1] = d[(col - 1) & 3];
-
- /* next row */
- src_ptr += src_pixels_per_line;
- dst_ptr += dst_pixels_per_line;
- }
-}
-
-static int q2mbl(int x)
-{
- if (x < 20) x = 20;
-
- x = 50 + (x - 50) * 10 / 8;
- return x * x / 3;
-}
-void vp8_mbpost_proc_across_ip_c(unsigned char *src, int pitch, int rows, int cols, int flimit)
-{
- int r, c, i;
-
- unsigned char *s = src;
- unsigned char d[16];
-
- for (r = 0; r < rows; r++)
- {
- int sumsq = 0;
- int sum = 0;
-
- for (i = -8; i<0; i++)
- s[i]=s[0];
-
- /* 17 avoids valgrind warning - we buffer values in c in d
- * and only write them when we've read 8 ahead...
- */
- for (i = cols; i<cols+17; i++)
- s[i]=s[cols-1];
-
- for (i = -8; i <= 6; i++)
- {
- sumsq += s[i] * s[i];
- sum += s[i];
- d[i+8] = 0;
- }
-
- for (c = 0; c < cols + 8; c++)
- {
- int x = s[c+7] - s[c-8];
- int y = s[c+7] + s[c-8];
-
- sum += x;
- sumsq += x * y;
-
- d[c&15] = s[c];
-
- if (sumsq * 15 - sum * sum < flimit)
- {
- d[c&15] = (8 + sum + s[c]) >> 4;
- }
-
- s[c-8] = d[(c-8)&15];
- }
-
- s += pitch;
- }
-}
-
-
-void vp8_mbpost_proc_down_c(unsigned char *dst, int pitch, int rows, int cols, int flimit)
-{
- int r, c, i;
- const short *rv3 = &vp8_rv[63&rand()];
-
- for (c = 0; c < cols; c++ )
- {
- unsigned char *s = &dst[c];
- int sumsq = 0;
- int sum = 0;
- unsigned char d[16];
- const short *rv2 = rv3 + ((c * 17) & 127);
-
- for (i = -8; i < 0; i++)
- s[i*pitch]=s[0];
-
- /* 17 avoids valgrind warning - we buffer values in c in d
- * and only write them when we've read 8 ahead...
- */
- for (i = rows; i < rows+17; i++)
- s[i*pitch]=s[(rows-1)*pitch];
-
- for (i = -8; i <= 6; i++)
- {
- sumsq += s[i*pitch] * s[i*pitch];
- sum += s[i*pitch];
- }
-
- for (r = 0; r < rows + 8; r++)
- {
- sumsq += s[7*pitch] * s[ 7*pitch] - s[-8*pitch] * s[-8*pitch];
- sum += s[7*pitch] - s[-8*pitch];
- d[r&15] = s[0];
-
- if (sumsq * 15 - sum * sum < flimit)
- {
- d[r&15] = (rv2[r&127] + sum + s[0]) >> 4;
- }
- if (r >= 8)
- s[-8*pitch] = d[(r-8)&15];
- s += pitch;
- }
- }
-}
-
-static void vp8_de_mblock(YV12_BUFFER_CONFIG *post,
- int q)
-{
- vp8_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
- post->y_width, q2mbl(q));
- vp8_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
- post->y_width, q2mbl(q));
-}
-
-void vp8_deblock(VP8_COMMON *cm,
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
- int flag)
-{
- double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
- int ppl = (int)(level + .5);
-
- const MODE_INFO *mode_info_context = cm->show_frame_mi;
- int mbr, mbc;
-
- /* The pixel thresholds are adjusted according to if or not the macroblock
- * is a skipped block. */
- unsigned char *ylimits = cm->pp_limits_buffer;
- unsigned char *uvlimits = cm->pp_limits_buffer + 16 * cm->mb_cols;
- (void) low_var_thresh;
- (void) flag;
-
- if (ppl > 0)
- {
- for (mbr = 0; mbr < cm->mb_rows; mbr++)
- {
- unsigned char *ylptr = ylimits;
- unsigned char *uvlptr = uvlimits;
- for (mbc = 0; mbc < cm->mb_cols; mbc++)
- {
- unsigned char mb_ppl;
-
- if (mode_info_context->mbmi.mb_skip_coeff)
- mb_ppl = (unsigned char)ppl >> 1;
- else
- mb_ppl = (unsigned char)ppl;
-
- vpx_memset(ylptr, mb_ppl, 16);
- vpx_memset(uvlptr, mb_ppl, 8);
-
- ylptr += 16;
- uvlptr += 8;
- mode_info_context++;
- }
- mode_info_context++;
-
- vp8_post_proc_down_and_across_mb_row(
- source->y_buffer + 16 * mbr * source->y_stride,
- post->y_buffer + 16 * mbr * post->y_stride, source->y_stride,
- post->y_stride, source->y_width, ylimits, 16);
-
- vp8_post_proc_down_and_across_mb_row(
- source->u_buffer + 8 * mbr * source->uv_stride,
- post->u_buffer + 8 * mbr * post->uv_stride, source->uv_stride,
- post->uv_stride, source->uv_width, uvlimits, 8);
- vp8_post_proc_down_and_across_mb_row(
- source->v_buffer + 8 * mbr * source->uv_stride,
- post->v_buffer + 8 * mbr * post->uv_stride, source->uv_stride,
- post->uv_stride, source->uv_width, uvlimits, 8);
- }
- } else
- {
- vp8_yv12_copy_frame(source, post);
- }
-}
-
-#if !(CONFIG_TEMPORAL_DENOISING)
-void vp8_de_noise(VP8_COMMON *cm,
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
- int flag)
-{
- double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
- int ppl = (int)(level + .5);
- int mb_rows = source->y_width >> 4;
- int mb_cols = source->y_height >> 4;
- unsigned char *limits = cm->pp_limits_buffer;;
- int mbr, mbc;
- (void) post;
- (void) low_var_thresh;
- (void) flag;
-
- vpx_memset(limits, (unsigned char)ppl, 16 * mb_cols);
-
- /* TODO: The original code don't filter the 2 outer rows and columns. */
- for (mbr = 0; mbr < mb_rows; mbr++)
- {
- vp8_post_proc_down_and_across_mb_row(
- source->y_buffer + 16 * mbr * source->y_stride,
- source->y_buffer + 16 * mbr * source->y_stride,
- source->y_stride, source->y_stride, source->y_width, limits, 16);
-
- vp8_post_proc_down_and_across_mb_row(
- source->u_buffer + 8 * mbr * source->uv_stride,
- source->u_buffer + 8 * mbr * source->uv_stride,
- source->uv_stride, source->uv_stride, source->uv_width, limits, 8);
- vp8_post_proc_down_and_across_mb_row(
- source->v_buffer + 8 * mbr * source->uv_stride,
- source->v_buffer + 8 * mbr * source->uv_stride,
- source->uv_stride, source->uv_stride, source->uv_width, limits, 8);
- }
-}
-#endif
-
-double vp8_gaussian(double sigma, double mu, double x)
-{
- return 1 / (sigma * sqrt(2.0 * 3.14159265)) *
- (exp(-(x - mu) * (x - mu) / (2 * sigma * sigma)));
-}
-
-static void fillrd(struct postproc_state *state, int q, int a)
-{
- char char_dist[300];
-
- double sigma;
- int i;
-
- vp8_clear_system_state();
-
-
- sigma = a + .5 + .6 * (63 - q) / 63.0;
-
- /* set up a lookup table of 256 entries that matches
- * a gaussian distribution with sigma determined by q.
- */
- {
- int next, j;
-
- next = 0;
-
- for (i = -32; i < 32; i++)
- {
- const int v = (int)(.5 + 256 * vp8_gaussian(sigma, 0, i));
-
- if (v)
- {
- for (j = 0; j < v; j++)
- {
- char_dist[next+j] = (char) i;
- }
-
- next = next + j;
- }
-
- }
-
- for (; next < 256; next++)
- char_dist[next] = 0;
-
- }
-
- for (i = 0; i < 3072; i++)
- {
- state->noise[i] = char_dist[rand() & 0xff];
- }
-
- for (i = 0; i < 16; i++)
- {
- state->blackclamp[i] = -char_dist[0];
- state->whiteclamp[i] = -char_dist[0];
- state->bothclamp[i] = -2 * char_dist[0];
- }
-
- state->last_q = q;
- state->last_noise = a;
-}
-
-/****************************************************************************
- *
- * ROUTINE : plane_add_noise_c
- *
- * INPUTS : unsigned char *Start starting address of buffer to add gaussian
- * noise to
- * unsigned int Width width of plane
- * unsigned int Height height of plane
- * int Pitch distance between subsequent lines of frame
- * int q quantizer used to determine amount of noise
- * to add
- *
- * OUTPUTS : None.
- *
- * RETURNS : void.
- *
- * FUNCTION : adds gaussian noise to a plane of pixels
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-void vp8_plane_add_noise_c(unsigned char *Start, char *noise,
- char blackclamp[16],
- char whiteclamp[16],
- char bothclamp[16],
- unsigned int Width, unsigned int Height, int Pitch)
-{
- unsigned int i, j;
- (void)bothclamp;
- for (i = 0; i < Height; i++)
- {
- unsigned char *Pos = Start + i * Pitch;
- char *Ref = (char *)(noise + (rand() & 0xff));
-
- for (j = 0; j < Width; j++)
- {
- if (Pos[j] < blackclamp[0])
- Pos[j] = blackclamp[0];
-
- if (Pos[j] > 255 + whiteclamp[0])
- Pos[j] = 255 + whiteclamp[0];
-
- Pos[j] += Ref[j];
- }
- }
-}
-
-/* Blend the macro block with a solid colored square. Leave the
- * edges unblended to give distinction to macro blocks in areas
- * filled with the same color block.
- */
-void vp8_blend_mb_inner_c (unsigned char *y, unsigned char *u, unsigned char *v,
- int y_1, int u_1, int v_1, int alpha, int stride)
-{
- int i, j;
- int y1_const = y_1*((1<<16)-alpha);
- int u1_const = u_1*((1<<16)-alpha);
- int v1_const = v_1*((1<<16)-alpha);
-
- y += 2*stride + 2;
- for (i = 0; i < 12; i++)
- {
- for (j = 0; j < 12; j++)
- {
- y[j] = (y[j]*alpha + y1_const)>>16;
- }
- y += stride;
- }
-
- stride >>= 1;
-
- u += stride + 1;
- v += stride + 1;
-
- for (i = 0; i < 6; i++)
- {
- for (j = 0; j < 6; j++)
- {
- u[j] = (u[j]*alpha + u1_const)>>16;
- v[j] = (v[j]*alpha + v1_const)>>16;
- }
- u += stride;
- v += stride;
- }
-}
-
-/* Blend only the edge of the macro block. Leave center
- * unblended to allow for other visualizations to be layered.
- */
-void vp8_blend_mb_outer_c (unsigned char *y, unsigned char *u, unsigned char *v,
- int y_1, int u_1, int v_1, int alpha, int stride)
-{
- int i, j;
- int y1_const = y_1*((1<<16)-alpha);
- int u1_const = u_1*((1<<16)-alpha);
- int v1_const = v_1*((1<<16)-alpha);
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 16; j++)
- {
- y[j] = (y[j]*alpha + y1_const)>>16;
- }
- y += stride;
- }
-
- for (i = 0; i < 12; i++)
- {
- y[0] = (y[0]*alpha + y1_const)>>16;
- y[1] = (y[1]*alpha + y1_const)>>16;
- y[14] = (y[14]*alpha + y1_const)>>16;
- y[15] = (y[15]*alpha + y1_const)>>16;
- y += stride;
- }
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 16; j++)
- {
- y[j] = (y[j]*alpha + y1_const)>>16;
- }
- y += stride;
- }
-
- stride >>= 1;
-
- for (j = 0; j < 8; j++)
- {
- u[j] = (u[j]*alpha + u1_const)>>16;
- v[j] = (v[j]*alpha + v1_const)>>16;
- }
- u += stride;
- v += stride;
-
- for (i = 0; i < 6; i++)
- {
- u[0] = (u[0]*alpha + u1_const)>>16;
- v[0] = (v[0]*alpha + v1_const)>>16;
-
- u[7] = (u[7]*alpha + u1_const)>>16;
- v[7] = (v[7]*alpha + v1_const)>>16;
-
- u += stride;
- v += stride;
- }
-
- for (j = 0; j < 8; j++)
- {
- u[j] = (u[j]*alpha + u1_const)>>16;
- v[j] = (v[j]*alpha + v1_const)>>16;
- }
-}
-
-void vp8_blend_b_c (unsigned char *y, unsigned char *u, unsigned char *v,
- int y_1, int u_1, int v_1, int alpha, int stride)
-{
- int i, j;
- int y1_const = y_1*((1<<16)-alpha);
- int u1_const = u_1*((1<<16)-alpha);
- int v1_const = v_1*((1<<16)-alpha);
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- y[j] = (y[j]*alpha + y1_const)>>16;
- }
- y += stride;
- }
-
- stride >>= 1;
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- u[j] = (u[j]*alpha + u1_const)>>16;
- v[j] = (v[j]*alpha + v1_const)>>16;
- }
- u += stride;
- v += stride;
- }
-}
-
-static void constrain_line (int x_0, int *x_1, int y_0, int *y_1, int width, int height)
-{
- int dx;
- int dy;
-
- if (*x_1 > width)
- {
- dx = *x_1 - x_0;
- dy = *y_1 - y_0;
-
- *x_1 = width;
- if (dx)
- *y_1 = ((width-x_0)*dy)/dx + y_0;
- }
- if (*x_1 < 0)
- {
- dx = *x_1 - x_0;
- dy = *y_1 - y_0;
-
- *x_1 = 0;
- if (dx)
- *y_1 = ((0-x_0)*dy)/dx + y_0;
- }
- if (*y_1 > height)
- {
- dx = *x_1 - x_0;
- dy = *y_1 - y_0;
-
- *y_1 = height;
- if (dy)
- *x_1 = ((height-y_0)*dx)/dy + x_0;
- }
- if (*y_1 < 0)
- {
- dx = *x_1 - x_0;
- dy = *y_1 - y_0;
-
- *y_1 = 0;
- if (dy)
- *x_1 = ((0-y_0)*dx)/dy + x_0;
- }
-}
-
-#if CONFIG_POSTPROC
-int vp8_post_proc_frame(VP8_COMMON *oci, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *ppflags)
-{
- int q = oci->filter_level * 10 / 6;
- int flags = ppflags->post_proc_flag;
- int deblock_level = ppflags->deblocking_level;
- int noise_level = ppflags->noise_level;
-
- if (!oci->frame_to_show)
- return -1;
-
- if (q > 63)
- q = 63;
-
- if (!flags)
- {
- *dest = *oci->frame_to_show;
-
- /* handle problem with extending borders */
- dest->y_width = oci->Width;
- dest->y_height = oci->Height;
- dest->uv_height = dest->y_height / 2;
- oci->postproc_state.last_base_qindex = oci->base_qindex;
- oci->postproc_state.last_frame_valid = 1;
- return 0;
- }
-
- /* Allocate post_proc_buffer_int if needed */
- if ((flags & VP8D_MFQE) && !oci->post_proc_buffer_int_used)
- {
- if ((flags & VP8D_DEBLOCK) || (flags & VP8D_DEMACROBLOCK))
- {
- int width = (oci->Width + 15) & ~15;
- int height = (oci->Height + 15) & ~15;
-
- if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer_int,
- width, height, VP8BORDERINPIXELS))
- vpx_internal_error(&oci->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate MFQE framebuffer");
-
- oci->post_proc_buffer_int_used = 1;
-
- /* insure that postproc is set to all 0's so that post proc
- * doesn't pull random data in from edge
- */
- vpx_memset((&oci->post_proc_buffer_int)->buffer_alloc,128,(&oci->post_proc_buffer)->frame_size);
-
- }
- }
-
- vp8_clear_system_state();
-
- if ((flags & VP8D_MFQE) &&
- oci->postproc_state.last_frame_valid &&
- oci->current_video_frame >= 2 &&
- oci->postproc_state.last_base_qindex < 60 &&
- oci->base_qindex - oci->postproc_state.last_base_qindex >= 20)
- {
- vp8_multiframe_quality_enhance(oci);
- if (((flags & VP8D_DEBLOCK) || (flags & VP8D_DEMACROBLOCK)) &&
- oci->post_proc_buffer_int_used)
- {
- vp8_yv12_copy_frame(&oci->post_proc_buffer, &oci->post_proc_buffer_int);
- if (flags & VP8D_DEMACROBLOCK)
- {
- vp8_deblock(oci, &oci->post_proc_buffer_int, &oci->post_proc_buffer,
- q + (deblock_level - 5) * 10, 1, 0);
- vp8_de_mblock(&oci->post_proc_buffer,
- q + (deblock_level - 5) * 10);
- }
- else if (flags & VP8D_DEBLOCK)
- {
- vp8_deblock(oci, &oci->post_proc_buffer_int, &oci->post_proc_buffer,
- q, 1, 0);
- }
- }
- /* Move partially towards the base q of the previous frame */
- oci->postproc_state.last_base_qindex = (3*oci->postproc_state.last_base_qindex + oci->base_qindex)>>2;
- }
- else if (flags & VP8D_DEMACROBLOCK)
- {
- vp8_deblock(oci, oci->frame_to_show, &oci->post_proc_buffer,
- q + (deblock_level - 5) * 10, 1, 0);
- vp8_de_mblock(&oci->post_proc_buffer, q + (deblock_level - 5) * 10);
-
- oci->postproc_state.last_base_qindex = oci->base_qindex;
- }
- else if (flags & VP8D_DEBLOCK)
- {
- vp8_deblock(oci, oci->frame_to_show, &oci->post_proc_buffer,
- q, 1, 0);
- oci->postproc_state.last_base_qindex = oci->base_qindex;
- }
- else
- {
- vp8_yv12_copy_frame(oci->frame_to_show, &oci->post_proc_buffer);
- oci->postproc_state.last_base_qindex = oci->base_qindex;
- }
- oci->postproc_state.last_frame_valid = 1;
-
- if (flags & VP8D_ADDNOISE)
- {
- if (oci->postproc_state.last_q != q
- || oci->postproc_state.last_noise != noise_level)
- {
- fillrd(&oci->postproc_state, 63 - q, noise_level);
- }
-
- vp8_plane_add_noise
- (oci->post_proc_buffer.y_buffer,
- oci->postproc_state.noise,
- oci->postproc_state.blackclamp,
- oci->postproc_state.whiteclamp,
- oci->postproc_state.bothclamp,
- oci->post_proc_buffer.y_width, oci->post_proc_buffer.y_height,
- oci->post_proc_buffer.y_stride);
- }
-
-#if CONFIG_POSTPROC_VISUALIZER
- if (flags & VP8D_DEBUG_TXT_FRAME_INFO)
- {
- char message[512];
- sprintf(message, "F%1dG%1dQ%3dF%3dP%d_s%dx%d",
- (oci->frame_type == KEY_FRAME),
- oci->refresh_golden_frame,
- oci->base_qindex,
- oci->filter_level,
- flags,
- oci->mb_cols, oci->mb_rows);
- vp8_blit_text(message, oci->post_proc_buffer.y_buffer, oci->post_proc_buffer.y_stride);
- }
-
- if (flags & VP8D_DEBUG_TXT_MBLK_MODES)
- {
- int i, j;
- unsigned char *y_ptr;
- YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
- int mb_rows = post->y_height >> 4;
- int mb_cols = post->y_width >> 4;
- int mb_index = 0;
- MODE_INFO *mi = oci->mi;
-
- y_ptr = post->y_buffer + 4 * post->y_stride + 4;
-
- /* vp8_filter each macro block */
- for (i = 0; i < mb_rows; i++)
- {
- for (j = 0; j < mb_cols; j++)
- {
- char zz[4];
-
- sprintf(zz, "%c", mi[mb_index].mbmi.mode + 'a');
-
- vp8_blit_text(zz, y_ptr, post->y_stride);
- mb_index ++;
- y_ptr += 16;
- }
-
- mb_index ++; /* border */
- y_ptr += post->y_stride * 16 - post->y_width;
-
- }
- }
-
- if (flags & VP8D_DEBUG_TXT_DC_DIFF)
- {
- int i, j;
- unsigned char *y_ptr;
- YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
- int mb_rows = post->y_height >> 4;
- int mb_cols = post->y_width >> 4;
- int mb_index = 0;
- MODE_INFO *mi = oci->mi;
-
- y_ptr = post->y_buffer + 4 * post->y_stride + 4;
-
- /* vp8_filter each macro block */
- for (i = 0; i < mb_rows; i++)
- {
- for (j = 0; j < mb_cols; j++)
- {
- char zz[4];
- int dc_diff = !(mi[mb_index].mbmi.mode != B_PRED &&
- mi[mb_index].mbmi.mode != SPLITMV &&
- mi[mb_index].mbmi.mb_skip_coeff);
-
- if (oci->frame_type == KEY_FRAME)
- sprintf(zz, "a");
- else
- sprintf(zz, "%c", dc_diff + '0');
-
- vp8_blit_text(zz, y_ptr, post->y_stride);
- mb_index ++;
- y_ptr += 16;
- }
-
- mb_index ++; /* border */
- y_ptr += post->y_stride * 16 - post->y_width;
-
- }
- }
-
- if (flags & VP8D_DEBUG_TXT_RATE_INFO)
- {
- char message[512];
- sprintf(message, "Bitrate: %10.2f framerate: %10.2f ", oci->bitrate, oci->framerate);
- vp8_blit_text(message, oci->post_proc_buffer.y_buffer, oci->post_proc_buffer.y_stride);
- }
-
- /* Draw motion vectors */
- if ((flags & VP8D_DEBUG_DRAW_MV) && ppflags->display_mv_flag)
- {
- YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
- int width = post->y_width;
- int height = post->y_height;
- unsigned char *y_buffer = oci->post_proc_buffer.y_buffer;
- int y_stride = oci->post_proc_buffer.y_stride;
- MODE_INFO *mi = oci->mi;
- int x0, y0;
-
- for (y0 = 0; y0 < height; y0 += 16)
- {
- for (x0 = 0; x0 < width; x0 += 16)
- {
- int x1, y1;
-
- if (!(ppflags->display_mv_flag & (1<<mi->mbmi.mode)))
- {
- mi++;
- continue;
- }
-
- if (mi->mbmi.mode == SPLITMV)
- {
- switch (mi->mbmi.partitioning)
- {
- case 0 : /* mv_top_bottom */
- {
- union b_mode_info *bmi = &mi->bmi[0];
- MV *mv = &bmi->mv.as_mv;
-
- x1 = x0 + 8 + (mv->col >> 3);
- y1 = y0 + 4 + (mv->row >> 3);
-
- constrain_line (x0+8, &x1, y0+4, &y1, width, height);
- vp8_blit_line (x0+8, x1, y0+4, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[8];
-
- x1 = x0 + 8 + (mv->col >> 3);
- y1 = y0 +12 + (mv->row >> 3);
-
- constrain_line (x0+8, &x1, y0+12, &y1, width, height);
- vp8_blit_line (x0+8, x1, y0+12, y1, y_buffer, y_stride);
-
- break;
- }
- case 1 : /* mv_left_right */
- {
- union b_mode_info *bmi = &mi->bmi[0];
- MV *mv = &bmi->mv.as_mv;
-
- x1 = x0 + 4 + (mv->col >> 3);
- y1 = y0 + 8 + (mv->row >> 3);
-
- constrain_line (x0+4, &x1, y0+8, &y1, width, height);
- vp8_blit_line (x0+4, x1, y0+8, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[2];
-
- x1 = x0 +12 + (mv->col >> 3);
- y1 = y0 + 8 + (mv->row >> 3);
-
- constrain_line (x0+12, &x1, y0+8, &y1, width, height);
- vp8_blit_line (x0+12, x1, y0+8, y1, y_buffer, y_stride);
-
- break;
- }
- case 2 : /* mv_quarters */
- {
- union b_mode_info *bmi = &mi->bmi[0];
- MV *mv = &bmi->mv.as_mv;
-
- x1 = x0 + 4 + (mv->col >> 3);
- y1 = y0 + 4 + (mv->row >> 3);
-
- constrain_line (x0+4, &x1, y0+4, &y1, width, height);
- vp8_blit_line (x0+4, x1, y0+4, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[2];
-
- x1 = x0 +12 + (mv->col >> 3);
- y1 = y0 + 4 + (mv->row >> 3);
-
- constrain_line (x0+12, &x1, y0+4, &y1, width, height);
- vp8_blit_line (x0+12, x1, y0+4, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[8];
-
- x1 = x0 + 4 + (mv->col >> 3);
- y1 = y0 +12 + (mv->row >> 3);
-
- constrain_line (x0+4, &x1, y0+12, &y1, width, height);
- vp8_blit_line (x0+4, x1, y0+12, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[10];
-
- x1 = x0 +12 + (mv->col >> 3);
- y1 = y0 +12 + (mv->row >> 3);
-
- constrain_line (x0+12, &x1, y0+12, &y1, width, height);
- vp8_blit_line (x0+12, x1, y0+12, y1, y_buffer, y_stride);
- break;
- }
- default :
- {
- union b_mode_info *bmi = mi->bmi;
- int bx0, by0;
-
- for (by0 = y0; by0 < (y0+16); by0 += 4)
- {
- for (bx0 = x0; bx0 < (x0+16); bx0 += 4)
- {
- MV *mv = &bmi->mv.as_mv;
-
- x1 = bx0 + 2 + (mv->col >> 3);
- y1 = by0 + 2 + (mv->row >> 3);
-
- constrain_line (bx0+2, &x1, by0+2, &y1, width, height);
- vp8_blit_line (bx0+2, x1, by0+2, y1, y_buffer, y_stride);
-
- bmi++;
- }
- }
- }
- }
- }
- else if (mi->mbmi.mode >= NEARESTMV)
- {
- MV *mv = &mi->mbmi.mv.as_mv;
- const int lx0 = x0 + 8;
- const int ly0 = y0 + 8;
-
- x1 = lx0 + (mv->col >> 3);
- y1 = ly0 + (mv->row >> 3);
-
- if (x1 != lx0 && y1 != ly0)
- {
- constrain_line (lx0, &x1, ly0-1, &y1, width, height);
- vp8_blit_line (lx0, x1, ly0-1, y1, y_buffer, y_stride);
-
- constrain_line (lx0, &x1, ly0+1, &y1, width, height);
- vp8_blit_line (lx0, x1, ly0+1, y1, y_buffer, y_stride);
- }
- else
- vp8_blit_line (lx0, x1, ly0, y1, y_buffer, y_stride);
- }
-
- mi++;
- }
- mi++;
- }
- }
-
- /* Color in block modes */
- if ((flags & VP8D_DEBUG_CLR_BLK_MODES)
- && (ppflags->display_mb_modes_flag || ppflags->display_b_modes_flag))
- {
- int y, x;
- YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
- int width = post->y_width;
- int height = post->y_height;
- unsigned char *y_ptr = oci->post_proc_buffer.y_buffer;
- unsigned char *u_ptr = oci->post_proc_buffer.u_buffer;
- unsigned char *v_ptr = oci->post_proc_buffer.v_buffer;
- int y_stride = oci->post_proc_buffer.y_stride;
- MODE_INFO *mi = oci->mi;
-
- for (y = 0; y < height; y += 16)
- {
- for (x = 0; x < width; x += 16)
- {
- int Y = 0, U = 0, V = 0;
-
- if (mi->mbmi.mode == B_PRED &&
- ((ppflags->display_mb_modes_flag & B_PRED) || ppflags->display_b_modes_flag))
- {
- int by, bx;
- unsigned char *yl, *ul, *vl;
- union b_mode_info *bmi = mi->bmi;
-
- yl = y_ptr + x;
- ul = u_ptr + (x>>1);
- vl = v_ptr + (x>>1);
-
- for (by = 0; by < 16; by += 4)
- {
- for (bx = 0; bx < 16; bx += 4)
- {
- if ((ppflags->display_b_modes_flag & (1<<mi->mbmi.mode))
- || (ppflags->display_mb_modes_flag & B_PRED))
- {
- Y = B_PREDICTION_MODE_colors[bmi->as_mode][0];
- U = B_PREDICTION_MODE_colors[bmi->as_mode][1];
- V = B_PREDICTION_MODE_colors[bmi->as_mode][2];
-
- vp8_blend_b
- (yl+bx, ul+(bx>>1), vl+(bx>>1), Y, U, V, 0xc000, y_stride);
- }
- bmi++;
- }
-
- yl += y_stride*4;
- ul += y_stride*1;
- vl += y_stride*1;
- }
- }
- else if (ppflags->display_mb_modes_flag & (1<<mi->mbmi.mode))
- {
- Y = MB_PREDICTION_MODE_colors[mi->mbmi.mode][0];
- U = MB_PREDICTION_MODE_colors[mi->mbmi.mode][1];
- V = MB_PREDICTION_MODE_colors[mi->mbmi.mode][2];
-
- vp8_blend_mb_inner
- (y_ptr+x, u_ptr+(x>>1), v_ptr+(x>>1), Y, U, V, 0xc000, y_stride);
- }
-
- mi++;
- }
- y_ptr += y_stride*16;
- u_ptr += y_stride*4;
- v_ptr += y_stride*4;
-
- mi++;
- }
- }
-
- /* Color in frame reference blocks */
- if ((flags & VP8D_DEBUG_CLR_FRM_REF_BLKS) && ppflags->display_ref_frame_flag)
- {
- int y, x;
- YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
- int width = post->y_width;
- int height = post->y_height;
- unsigned char *y_ptr = oci->post_proc_buffer.y_buffer;
- unsigned char *u_ptr = oci->post_proc_buffer.u_buffer;
- unsigned char *v_ptr = oci->post_proc_buffer.v_buffer;
- int y_stride = oci->post_proc_buffer.y_stride;
- MODE_INFO *mi = oci->mi;
-
- for (y = 0; y < height; y += 16)
- {
- for (x = 0; x < width; x +=16)
- {
- int Y = 0, U = 0, V = 0;
-
- if (ppflags->display_ref_frame_flag & (1<<mi->mbmi.ref_frame))
- {
- Y = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][0];
- U = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][1];
- V = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][2];
-
- vp8_blend_mb_outer
- (y_ptr+x, u_ptr+(x>>1), v_ptr+(x>>1), Y, U, V, 0xc000, y_stride);
- }
-
- mi++;
- }
- y_ptr += y_stride*16;
- u_ptr += y_stride*4;
- v_ptr += y_stride*4;
-
- mi++;
- }
- }
-#endif
-
- *dest = oci->post_proc_buffer;
-
- /* handle problem with extending borders */
- dest->y_width = oci->Width;
- dest->y_height = oci->Height;
- dest->uv_height = dest->y_height / 2;
- return 0;
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/postproc.h b/videocodec/libvpx_internal/libvpx/vp8/common/postproc.h
deleted file mode 100644
index 33d0a7f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/postproc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_POSTPROC_H_
-#define VP8_COMMON_POSTPROC_H_
-
-#include "vpx_ports/mem.h"
-struct postproc_state
-{
- int last_q;
- int last_noise;
- char noise[3072];
- int last_base_qindex;
- int last_frame_valid;
- DECLARE_ALIGNED(16, char, blackclamp[16]);
- DECLARE_ALIGNED(16, char, whiteclamp[16]);
- DECLARE_ALIGNED(16, char, bothclamp[16]);
-};
-#include "onyxc_int.h"
-#include "ppflags.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-int vp8_post_proc_frame(struct VP8Common *oci, YV12_BUFFER_CONFIG *dest,
- vp8_ppflags_t *flags);
-
-
-void vp8_de_noise(struct VP8Common *oci,
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
- int flag);
-
-void vp8_deblock(struct VP8Common *oci,
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
- int flag);
-
-#define MFQE_PRECISION 4
-
-void vp8_multiframe_quality_enhance(struct VP8Common *cm);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_POSTPROC_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/copy_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/copy_altivec.asm
deleted file mode 100644
index a4ce915..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/copy_altivec.asm
+++ /dev/null
@@ -1,47 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl copy_mem16x16_ppc
-
-;# r3 unsigned char *src
-;# r4 int src_stride
-;# r5 unsigned char *dst
-;# r6 int dst_stride
-
-;# Make the assumption that input will not be aligned,
-;# but the output will be. So two reads and a perm
-;# for the input, but only one store for the output.
-copy_mem16x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xe000
- mtspr 256, r12 ;# set VRSAVE
-
- li r10, 16
- mtctr r10
-
-cp_16x16_loop:
- lvsl v0, 0, r3 ;# permutate value for alignment
-
- lvx v1, 0, r3
- lvx v2, r10, r3
-
- vperm v1, v1, v2, v0
-
- stvx v1, 0, r5
-
- add r3, r3, r4 ;# increment source pointer
- add r5, r5, r6 ;# increment destination pointer
-
- bdnz cp_16x16_loop
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_altivec.asm
deleted file mode 100644
index 4da2e94..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_altivec.asm
+++ /dev/null
@@ -1,1013 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl sixtap_predict_ppc
- .globl sixtap_predict8x4_ppc
- .globl sixtap_predict8x8_ppc
- .globl sixtap_predict16x16_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-.macro load_hfilter V0, V1
- load_c \V0, HFilter, r5, r9, r10
-
- addi r5, r5, 16
- lvx \V1, r5, r10
-.endm
-
-;# Vertical filtering
-.macro Vprolog
- load_c v0, VFilter, r6, r3, r10
-
- vspltish v5, 8
- vspltish v6, 3
- vslh v6, v5, v6 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v1, v0, 1
- vspltb v2, v0, 2
- vspltb v3, v0, 3
- vspltb v4, v0, 4
- vspltb v5, v0, 5
- vspltb v0, v0, 0
-.endm
-
-.macro vpre_load
- Vprolog
- li r10, 16
- lvx v10, 0, r9 ;# v10..v14 = first 5 rows
- lvx v11, r10, r9
- addi r9, r9, 32
- lvx v12, 0, r9
- lvx v13, r10, r9
- addi r9, r9, 32
- lvx v14, 0, r9
-.endm
-
-.macro Msum Re, Ro, V, T, TMP
- ;# (Re,Ro) += (V*T)
- vmuleub \TMP, \V, \T ;# trashes v8
- vadduhm \Re, \Re, \TMP ;# Re = evens, saturation unnecessary
- vmuloub \TMP, \V, \T
- vadduhm \Ro, \Ro, \TMP ;# Ro = odds
-.endm
-
-.macro vinterp_no_store P0 P1 P2 P3 P4 P5
- vmuleub v8, \P0, v0 ;# 64 + 4 positive taps
- vadduhm v16, v6, v8
- vmuloub v8, \P0, v0
- vadduhm v17, v6, v8
- Msum v16, v17, \P2, v2, v8
- Msum v16, v17, \P3, v3, v8
- Msum v16, v17, \P5, v5, v8
-
- vmuleub v18, \P1, v1 ;# 2 negative taps
- vmuloub v19, \P1, v1
- Msum v18, v19, \P4, v4, v8
-
- vsubuhs v16, v16, v18 ;# subtract neg from pos
- vsubuhs v17, v17, v19
- vsrh v16, v16, v7 ;# divide by 128
- vsrh v17, v17, v7 ;# v16 v17 = evens, odds
- vmrghh v18, v16, v17 ;# v18 v19 = 16-bit result in order
- vmrglh v19, v16, v17
- vpkuhus \P0, v18, v19 ;# P0 = 8-bit result
-.endm
-
-.macro vinterp_no_store_8x8 P0 P1 P2 P3 P4 P5
- vmuleub v24, \P0, v13 ;# 64 + 4 positive taps
- vadduhm v21, v20, v24
- vmuloub v24, \P0, v13
- vadduhm v22, v20, v24
- Msum v21, v22, \P2, v15, v25
- Msum v21, v22, \P3, v16, v25
- Msum v21, v22, \P5, v18, v25
-
- vmuleub v23, \P1, v14 ;# 2 negative taps
- vmuloub v24, \P1, v14
- Msum v23, v24, \P4, v17, v25
-
- vsubuhs v21, v21, v23 ;# subtract neg from pos
- vsubuhs v22, v22, v24
- vsrh v21, v21, v19 ;# divide by 128
- vsrh v22, v22, v19 ;# v16 v17 = evens, odds
- vmrghh v23, v21, v22 ;# v18 v19 = 16-bit result in order
- vmrglh v24, v21, v22
- vpkuhus \P0, v23, v24 ;# P0 = 8-bit result
-.endm
-
-
-.macro Vinterp P0 P1 P2 P3 P4 P5
- vinterp_no_store \P0, \P1, \P2, \P3, \P4, \P5
- stvx \P0, 0, r7
- add r7, r7, r8 ;# 33 ops per 16 pels
-.endm
-
-
-.macro luma_v P0, P1, P2, P3, P4, P5
- addi r9, r9, 16 ;# P5 = newest input row
- lvx \P5, 0, r9
- Vinterp \P0, \P1, \P2, \P3, \P4, \P5
-.endm
-
-.macro luma_vtwo
- luma_v v10, v11, v12, v13, v14, v15
- luma_v v11, v12, v13, v14, v15, v10
-.endm
-
-.macro luma_vfour
- luma_vtwo
- luma_v v12, v13, v14, v15, v10, v11
- luma_v v13, v14, v15, v10, v11, v12
-.endm
-
-.macro luma_vsix
- luma_vfour
- luma_v v14, v15, v10, v11, v12, v13
- luma_v v15, v10, v11, v12, v13, v14
-.endm
-
-.macro Interp4 R I I4
- vmsummbm \R, v13, \I, v15
- vmsummbm \R, v14, \I4, \R
-.endm
-
-.macro Read8x8 VD, RS, RP, increment_counter
- lvsl v21, 0, \RS ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx \VD, 0, \RS
- lvx v20, r10, \RS
-
-.if \increment_counter
- add \RS, \RS, \RP
-.endif
-
- vperm \VD, \VD, v20, v21
-.endm
-
-.macro interp_8x8 R
- vperm v20, \R, \R, v16 ;# v20 = 0123 1234 2345 3456
- vperm v21, \R, \R, v17 ;# v21 = 4567 5678 6789 789A
- Interp4 v20, v20, v21 ;# v20 = result 0 1 2 3
- vperm \R, \R, \R, v18 ;# R = 89AB 9ABC ABCx BCxx
- Interp4 v21, v21, \R ;# v21 = result 4 5 6 7
-
- vpkswus \R, v20, v21 ;# R = 0 1 2 3 4 5 6 7
- vsrh \R, \R, v19
-
- vpkuhus \R, \R, \R ;# saturate and pack
-
-.endm
-
-.macro Read4x4 VD, RS, RP, increment_counter
- lvsl v21, 0, \RS ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v20, 0, \RS
-
-.if \increment_counter
- add \RS, \RS, \RP
-.endif
-
- vperm \VD, v20, v20, v21
-.endm
- .text
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-sixtap_predict_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xff87
- ori r12, r12, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq- vertical_only_4x4
-
- ;# load up horizontal filter
- load_hfilter v13, v14
-
- ;# rounding added in on the multiply
- vspltisw v16, 8
- vspltisw v15, 3
- vslw v15, v16, v15 ;# 0x00000040000000400000004000000040
-
- ;# Load up permutation constants
- load_c v16, B_0123, 0, r9, r10
- load_c v17, B_4567, 0, r9, r10
- load_c v18, B_89AB, 0, r9, r10
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- addi r9, r3, 0
- li r10, 16
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# filter a line
- interp_8x8 v2
- interp_8x8 v3
- interp_8x8 v4
- interp_8x8 v5
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional 5 lines that are needed
- ;# for the vertical filter.
- beq- store_4x4
-
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r9, r9, r4
- sub r9, r9, r4
-
- Read8x8 v0, r9, r4, 1
- Read8x8 v1, r9, r4, 0
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 0
-
- interp_8x8 v0
- interp_8x8 v1
- interp_8x8 v6
- interp_8x8 v7
- interp_8x8 v8
-
- b second_pass_4x4
-
-vertical_only_4x4:
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
- li r10, 16
-
- Read8x8 v0, r3, r4, 1
- Read8x8 v1, r3, r4, 1
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 0
-
- slwi r6, r6, 4 ;# index into vertical filter array
-
-second_pass_4x4:
- load_c v20, b_hilo_4x4, 0, r9, r10
- load_c v21, b_hilo, 0, r9, r10
-
- ;# reposition input so that it can go through the
- ;# filtering phase with one pass.
- vperm v0, v0, v1, v20 ;# 0 1 x x
- vperm v2, v2, v3, v20 ;# 2 3 x x
- vperm v4, v4, v5, v20 ;# 4 5 x x
- vperm v6, v6, v7, v20 ;# 6 7 x x
-
- vperm v0, v0, v2, v21 ;# 0 1 2 3
- vperm v4, v4, v6, v21 ;# 4 5 6 7
-
- vsldoi v1, v0, v4, 4
- vsldoi v2, v0, v4, 8
- vsldoi v3, v0, v4, 12
-
- vsldoi v5, v4, v8, 4
-
- load_c v13, VFilter, r6, r9, r10
-
- vspltish v15, 8
- vspltish v20, 3
- vslh v20, v15, v20 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v14, v13, 1
- vspltb v15, v13, 2
- vspltb v16, v13, 3
- vspltb v17, v13, 4
- vspltb v18, v13, 5
- vspltb v13, v13, 0
-
- vinterp_no_store_8x8 v0, v1, v2, v3, v4, v5
-
- stvx v0, 0, r1
-
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- lwz r0, 4(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- lwz r0, 8(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- lwz r0, 12(r1)
- stw r0, 0(r7)
-
- b exit_4x4
-
-store_4x4:
-
- stvx v2, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v3, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v4, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v5, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
-
-exit_4x4:
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro w_8x8 V, D, R, P
- stvx \V, 0, r1
- lwz \R, 0(r1)
- stw \R, 0(r7)
- lwz \R, 4(r1)
- stw \R, 4(r7)
- add \D, \D, \P
-.endm
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-
-sixtap_predict8x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq- second_pass_pre_copy_8x4
-
- load_hfilter v13, v14
-
- ;# rounding added in on the multiply
- vspltisw v16, 8
- vspltisw v15, 3
- vslw v15, v16, v15 ;# 0x00000040000000400000004000000040
-
- ;# Load up permutation constants
- load_c v16, B_0123, 0, r9, r10
- load_c v17, B_4567, 0, r9, r10
- load_c v18, B_89AB, 0, r9, r10
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- addi r9, r3, 0
- li r10, 16
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# filter a line
- interp_8x8 v2
- interp_8x8 v3
- interp_8x8 v4
- interp_8x8 v5
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional 5 lines that are needed
- ;# for the vertical filter.
- beq- store_8x4
-
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r9, r9, r4
- sub r9, r9, r4
-
- Read8x8 v0, r9, r4, 1
- Read8x8 v1, r9, r4, 0
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 0
-
- interp_8x8 v0
- interp_8x8 v1
- interp_8x8 v6
- interp_8x8 v7
- interp_8x8 v8
-
- b second_pass_8x4
-
-second_pass_pre_copy_8x4:
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
- li r10, 16
-
- Read8x8 v0, r3, r4, 1
- Read8x8 v1, r3, r4, 1
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 1
-
- slwi r6, r6, 4 ;# index into vertical filter array
-
-second_pass_8x4:
- load_c v13, VFilter, r6, r9, r10
-
- vspltish v15, 8
- vspltish v20, 3
- vslh v20, v15, v20 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v14, v13, 1
- vspltb v15, v13, 2
- vspltb v16, v13, 3
- vspltb v17, v13, 4
- vspltb v18, v13, 5
- vspltb v13, v13, 0
-
- vinterp_no_store_8x8 v0, v1, v2, v3, v4, v5
- vinterp_no_store_8x8 v1, v2, v3, v4, v5, v6
- vinterp_no_store_8x8 v2, v3, v4, v5, v6, v7
- vinterp_no_store_8x8 v3, v4, v5, v6, v7, v8
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x4
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
-
- b exit_8x4
-
-store_aligned_8x4:
-
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
-
- b exit_8x4
-
-store_8x4:
- cmpi cr0, r8, 8
- beq cr0, store_aligned2_8x4
-
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
-
- b exit_8x4
-
-store_aligned2_8x4:
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
-
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
-
-exit_8x4:
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-
-;# Because the width that needs to be filtered will fit in a single altivec
-;# register there is no need to loop. Everything can stay in registers.
-sixtap_predict8x8_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq- second_pass_pre_copy_8x8
-
- load_hfilter v13, v14
-
- ;# rounding added in on the multiply
- vspltisw v16, 8
- vspltisw v15, 3
- vslw v15, v16, v15 ;# 0x00000040000000400000004000000040
-
- ;# Load up permutation constants
- load_c v16, B_0123, 0, r9, r10
- load_c v17, B_4567, 0, r9, r10
- load_c v18, B_89AB, 0, r9, r10
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- addi r9, r3, 0
- li r10, 16
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 1
- Read8x8 v9, r3, r4, 1
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# filter a line
- interp_8x8 v2
- interp_8x8 v3
- interp_8x8 v4
- interp_8x8 v5
- interp_8x8 v6
- interp_8x8 v7
- interp_8x8 v8
- interp_8x8 v9
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional 5 lines that are needed
- ;# for the vertical filter.
- beq- store_8x8
-
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r9, r9, r4
- sub r9, r9, r4
-
- Read8x8 v0, r9, r4, 1
- Read8x8 v1, r9, r4, 0
- Read8x8 v10, r3, r4, 1
- Read8x8 v11, r3, r4, 1
- Read8x8 v12, r3, r4, 0
-
- interp_8x8 v0
- interp_8x8 v1
- interp_8x8 v10
- interp_8x8 v11
- interp_8x8 v12
-
- b second_pass_8x8
-
-second_pass_pre_copy_8x8:
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
- li r10, 16
-
- Read8x8 v0, r3, r4, 1
- Read8x8 v1, r3, r4, 1
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 1
- Read8x8 v9, r3, r4, 1
- Read8x8 v10, r3, r4, 1
- Read8x8 v11, r3, r4, 1
- Read8x8 v12, r3, r4, 0
-
- slwi r6, r6, 4 ;# index into vertical filter array
-
-second_pass_8x8:
- load_c v13, VFilter, r6, r9, r10
-
- vspltish v15, 8
- vspltish v20, 3
- vslh v20, v15, v20 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v14, v13, 1
- vspltb v15, v13, 2
- vspltb v16, v13, 3
- vspltb v17, v13, 4
- vspltb v18, v13, 5
- vspltb v13, v13, 0
-
- vinterp_no_store_8x8 v0, v1, v2, v3, v4, v5
- vinterp_no_store_8x8 v1, v2, v3, v4, v5, v6
- vinterp_no_store_8x8 v2, v3, v4, v5, v6, v7
- vinterp_no_store_8x8 v3, v4, v5, v6, v7, v8
- vinterp_no_store_8x8 v4, v5, v6, v7, v8, v9
- vinterp_no_store_8x8 v5, v6, v7, v8, v9, v10
- vinterp_no_store_8x8 v6, v7, v8, v9, v10, v11
- vinterp_no_store_8x8 v7, v8, v9, v10, v11, v12
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x8
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
- w_8x8 v6, r7, r0, r8
- w_8x8 v7, r7, r0, r8
-
- b exit_8x8
-
-store_aligned_8x8:
-
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
- vperm v6, v6, v7, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
- addi r7, r7, 16
- stvx v6, 0, r7
-
- b exit_8x8
-
-store_8x8:
- cmpi cr0, r8, 8
- beq cr0, store_aligned2_8x8
-
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
- w_8x8 v6, r7, r0, r8
- w_8x8 v7, r7, r0, r8
- w_8x8 v8, r7, r0, r8
- w_8x8 v9, r7, r0, r8
-
- b exit_8x8
-
-store_aligned2_8x8:
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
- vperm v6, v6, v7, v10
- vperm v8, v8, v9, v10
-
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
- addi r7, r7, 16
- stvx v6, 0, r7
- addi r7, r7, 16
- stvx v8, 0, r7
-
-exit_8x8:
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-
-;# Two pass filtering. First pass is Horizontal edges, second pass is vertical
-;# edges. One of the filters can be null, but both won't be. Needs to use a
-;# temporary buffer because the source buffer can't be modified and the buffer
-;# for the destination is not large enough to hold the temporary data.
-sixtap_predict16x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xf000
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-416(r1) ;# create space on the stack
-
- ;# Three possiblities
- ;# 1. First filter is null. Don't use a temp buffer.
- ;# 2. Second filter is null. Don't use a temp buffer.
- ;# 3. Neither are null, use temp buffer.
-
- ;# First Pass (horizontal edge)
- ;# setup pointers for src
- ;# if possiblity (1) then setup the src pointer to be the orginal and jump
- ;# to second pass. this is based on if x_offset is 0.
-
- ;# load up horizontal filter
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- load_hfilter v4, v5
-
- beq- copy_horizontal_16x21
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# setup constants
- ;# v14 permutation value for alignment
- load_c v14, b_hperm, 0, r9, r10
-
- ;# These statements are guessing that there won't be a second pass,
- ;# but if there is then inside the bypass they need to be set
- li r0, 16 ;# prepare for no vertical filter
-
- ;# Change the output pointer and pitch to be the actual
- ;# desination instead of a temporary buffer.
- addi r9, r7, 0
- addi r5, r8, 0
-
- ;# no vertical filter, so write the output from the first pass
- ;# directly into the output buffer.
- beq- no_vertical_filter_bypass
-
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
-
- ;# setup counter for the number of lines that are going to be filtered
- li r0, 21
-
- ;# use the stack as temporary storage
- la r9, 48(r1)
- li r5, 16
-
-no_vertical_filter_bypass:
-
- mtctr r0
-
- ;# rounding added in on the multiply
- vspltisw v10, 8
- vspltisw v12, 3
- vslw v12, v10, v12 ;# 0x00000040000000400000004000000040
-
- ;# downshift by 7 ( divide by 128 ) at the end
- vspltish v13, 7
-
- ;# index to the next set of vectors in the row.
- li r10, 16
- li r12, 32
-
-horizontal_loop_16x16:
-
- lvsl v15, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v1, 0, r3
- lvx v2, r10, r3
- lvx v3, r12, r3
-
- vperm v8, v1, v2, v15
- vperm v9, v2, v3, v15 ;# v8 v9 = 21 input pixels left-justified
-
- vsldoi v11, v8, v9, 4
-
- ;# set 0
- vmsummbm v6, v4, v8, v12 ;# taps times elements
- vmsummbm v0, v5, v11, v6
-
- ;# set 1
- vsldoi v10, v8, v9, 1
- vsldoi v11, v8, v9, 5
-
- vmsummbm v6, v4, v10, v12
- vmsummbm v1, v5, v11, v6
-
- ;# set 2
- vsldoi v10, v8, v9, 2
- vsldoi v11, v8, v9, 6
-
- vmsummbm v6, v4, v10, v12
- vmsummbm v2, v5, v11, v6
-
- ;# set 3
- vsldoi v10, v8, v9, 3
- vsldoi v11, v8, v9, 7
-
- vmsummbm v6, v4, v10, v12
- vmsummbm v3, v5, v11, v6
-
- vpkswus v0, v0, v1 ;# v0 = 0 4 8 C 1 5 9 D (16-bit)
- vpkswus v1, v2, v3 ;# v1 = 2 6 A E 3 7 B F
-
- vsrh v0, v0, v13 ;# divide v0, v1 by 128
- vsrh v1, v1, v13
-
- vpkuhus v0, v0, v1 ;# v0 = scrambled 8-bit result
- vperm v0, v0, v0, v14 ;# v0 = correctly-ordered result
-
- stvx v0, 0, r9
- add r9, r9, r5
-
- add r3, r3, r4
-
- bdnz horizontal_loop_16x16
-
- ;# check again to see if vertical filter needs to be done.
- cmpi cr0, r6, 0
- beq cr0, end_16x16
-
- ;# yes there is, so go to the second pass
- b second_pass_16x16
-
-copy_horizontal_16x21:
- li r10, 21
- mtctr r10
-
- li r10, 16
-
- sub r3, r3, r4
- sub r3, r3, r4
-
- ;# this is done above if there is a horizontal filter,
- ;# if not it needs to be done down here.
- slwi r6, r6, 4 ;# index into vertical filter array
-
- ;# always write to the stack when doing a horizontal copy
- la r9, 48(r1)
-
-copy_horizontal_loop_16x21:
- lvsl v15, 0, r3 ;# permutate value for alignment
-
- lvx v1, 0, r3
- lvx v2, r10, r3
-
- vperm v8, v1, v2, v15
-
- stvx v8, 0, r9
- addi r9, r9, 16
-
- add r3, r3, r4
-
- bdnz copy_horizontal_loop_16x21
-
-second_pass_16x16:
-
- ;# always read from the stack when doing a vertical filter
- la r9, 48(r1)
-
- ;# downshift by 7 ( divide by 128 ) at the end
- vspltish v7, 7
-
- vpre_load
-
- luma_vsix
- luma_vsix
- luma_vfour
-
-end_16x16:
-
- addi r1, r1, 416 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .data
-
- .align 4
-HFilter:
- .byte 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, -6,123, 12, 0, -6,123, 12, 0, -6,123, 12, 0, -6,123, 12
- .byte -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0
- .byte 2,-11,108, 36, 2,-11,108, 36, 2,-11,108, 36, 2,-11,108, 36
- .byte -8, 1, 0, 0, -8, 1, 0, 0, -8, 1, 0, 0, -8, 1, 0, 0
- .byte 0, -9, 93, 50, 0, -9, 93, 50, 0, -9, 93, 50, 0, -9, 93, 50
- .byte -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0
- .byte 3,-16, 77, 77, 3,-16, 77, 77, 3,-16, 77, 77, 3,-16, 77, 77
- .byte -16, 3, 0, 0,-16, 3, 0, 0,-16, 3, 0, 0,-16, 3, 0, 0
- .byte 0, -6, 50, 93, 0, -6, 50, 93, 0, -6, 50, 93, 0, -6, 50, 93
- .byte -9, 0, 0, 0, -9, 0, 0, 0, -9, 0, 0, 0, -9, 0, 0, 0
- .byte 1, -8, 36,108, 1, -8, 36,108, 1, -8, 36,108, 1, -8, 36,108
- .byte -11, 2, 0, 0,-11, 2, 0, 0,-11, 2, 0, 0,-11, 2, 0, 0
- .byte 0, -1, 12,123, 0, -1, 12,123, 0, -1, 12,123, 0, -1, 12,123
- .byte -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0
-
- .align 4
-VFilter:
- .byte 0, 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 6,123, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 2, 11,108, 36, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 9, 93, 50, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 3, 16, 77, 77, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 6, 50, 93, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 1, 8, 36,108, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 1, 12,123, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-
- .align 4
-b_hperm:
- .byte 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
-
- .align 4
-B_0123:
- .byte 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6
-
- .align 4
-B_4567:
- .byte 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10
-
- .align 4
-B_89AB:
- .byte 8, 9, 10, 11, 9, 10, 11, 12, 10, 11, 12, 13, 11, 12, 13, 14
-
- .align 4
-b_hilo:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
-
- .align 4
-b_hilo_4x4:
- .byte 0, 1, 2, 3, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_bilinear_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_bilinear_altivec.asm
deleted file mode 100644
index fd8aa66..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/filter_bilinear_altivec.asm
+++ /dev/null
@@ -1,677 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl bilinear_predict4x4_ppc
- .globl bilinear_predict8x4_ppc
- .globl bilinear_predict8x8_ppc
- .globl bilinear_predict16x16_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-.macro load_vfilter V0, V1
- load_c \V0, vfilter_b, r6, r9, r10
-
- addi r6, r6, 16
- lvx \V1, r6, r10
-.endm
-
-.macro HProlog jump_label
- ;# load up horizontal filter
- slwi. r5, r5, 4 ;# index into horizontal filter array
-
- ;# index to the next set of vectors in the row.
- li r10, 16
- li r12, 32
-
- ;# downshift by 7 ( divide by 128 ) at the end
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq \jump_label
-
- load_c v20, hfilter_b, r5, r9, r0
-
- ;# setup constants
- ;# v14 permutation value for alignment
- load_c v28, b_hperm_b, 0, r9, r0
-
- ;# rounding added in on the multiply
- vspltisw v21, 8
- vspltisw v18, 3
- vslw v18, v21, v18 ;# 0x00000040000000400000004000000040
-
- slwi. r6, r6, 5 ;# index into vertical filter array
-.endm
-
-;# Filters a horizontal line
-;# expects:
-;# r3 src_ptr
-;# r4 pitch
-;# r10 16
-;# r12 32
-;# v17 perm intput
-;# v18 rounding
-;# v19 shift
-;# v20 filter taps
-;# v21 tmp
-;# v22 tmp
-;# v23 tmp
-;# v24 tmp
-;# v25 tmp
-;# v26 tmp
-;# v27 tmp
-;# v28 perm output
-;#
-.macro HFilter V
- vperm v24, v21, v21, v10 ;# v20 = 0123 1234 2345 3456
- vperm v25, v21, v21, v11 ;# v21 = 4567 5678 6789 789A
-
- vmsummbm v24, v20, v24, v18
- vmsummbm v25, v20, v25, v18
-
- vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
-
- vsrh v24, v24, v19 ;# divide v0, v1 by 128
-
- vpkuhus \V, v24, v24 ;# \V = scrambled 8-bit result
-.endm
-
-.macro hfilter_8 V, increment_counter
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 9 bytes wide, output is 8 bytes.
- lvx v21, 0, r3
- lvx v22, r10, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
- vperm v21, v21, v22, v17
-
- HFilter \V
-.endm
-
-
-.macro load_and_align_8 V, increment_counter
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, r3
- lvx v22, r10, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
-
- vperm \V, v21, v22, v17
-.endm
-
-.macro write_aligned_8 V, increment_counter
- stvx \V, 0, r7
-
-.if \increment_counter
- add r7, r7, r8
-.endif
-.endm
-
-.macro vfilter_16 P0 P1
- vmuleub v22, \P0, v20 ;# 64 + 4 positive taps
- vadduhm v22, v18, v22
- vmuloub v23, \P0, v20
- vadduhm v23, v18, v23
-
- vmuleub v24, \P1, v21
- vadduhm v22, v22, v24 ;# Re = evens, saturation unnecessary
- vmuloub v25, \P1, v21
- vadduhm v23, v23, v25 ;# Ro = odds
-
- vsrh v22, v22, v19 ;# divide by 128
- vsrh v23, v23, v19 ;# v16 v17 = evens, odds
- vmrghh \P0, v22, v23 ;# v18 v19 = 16-bit result in order
- vmrglh v23, v22, v23
- vpkuhus \P0, \P0, v23 ;# P0 = 8-bit result
-.endm
-
-
-.macro w_8x8 V, D, R, P
- stvx \V, 0, r1
- lwz \R, 0(r1)
- stw \R, 0(r7)
- lwz \R, 4(r1)
- stw \R, 4(r7)
- add \D, \D, \P
-.endm
-
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict4x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf830
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_4x4_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r9, r12
- load_c v11, b_4567_b, 0, r9, r12
-
- hfilter_8 v0, 1
- hfilter_8 v1, 1
- hfilter_8 v2, 1
- hfilter_8 v3, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_4x4_b
-
- hfilter_8 v4, 0
-
- b second_pass_4x4_b
-
-second_pass_4x4_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_8 v0, 1
- load_and_align_8 v1, 1
- load_and_align_8 v2, 1
- load_and_align_8 v3, 1
- load_and_align_8 v4, 1
-
-second_pass_4x4_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
-
-store_out_4x4_b:
-
- stvx v0, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v1, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v2, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v3, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
-
-exit_4x4:
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict8x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf830
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_8x4_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r9, r12
- load_c v11, b_4567_b, 0, r9, r12
-
- hfilter_8 v0, 1
- hfilter_8 v1, 1
- hfilter_8 v2, 1
- hfilter_8 v3, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_8x4_b
-
- hfilter_8 v4, 0
-
- b second_pass_8x4_b
-
-second_pass_8x4_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_8 v0, 1
- load_and_align_8 v1, 1
- load_and_align_8 v2, 1
- load_and_align_8 v3, 1
- load_and_align_8 v4, 1
-
-second_pass_8x4_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
-
-store_out_8x4_b:
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x4_b
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
-
- b exit_8x4
-
-store_aligned_8x4_b:
- load_c v10, b_hilo_b, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
-
-exit_8x4:
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict8x8_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xfff0
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_8x8_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r9, r12
- load_c v11, b_4567_b, 0, r9, r12
-
- hfilter_8 v0, 1
- hfilter_8 v1, 1
- hfilter_8 v2, 1
- hfilter_8 v3, 1
- hfilter_8 v4, 1
- hfilter_8 v5, 1
- hfilter_8 v6, 1
- hfilter_8 v7, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_8x8_b
-
- hfilter_8 v8, 0
-
- b second_pass_8x8_b
-
-second_pass_8x8_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_8 v0, 1
- load_and_align_8 v1, 1
- load_and_align_8 v2, 1
- load_and_align_8 v3, 1
- load_and_align_8 v4, 1
- load_and_align_8 v5, 1
- load_and_align_8 v6, 1
- load_and_align_8 v7, 1
- load_and_align_8 v8, 0
-
-second_pass_8x8_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
-
-store_out_8x8_b:
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x8_b
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
- w_8x8 v6, r7, r0, r8
- w_8x8 v7, r7, r0, r8
-
- b exit_8x8
-
-store_aligned_8x8_b:
- load_c v10, b_hilo_b, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
- vperm v6, v6, v7, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
- addi r7, r7, 16
- stvx v6, 0, r7
-
-exit_8x8:
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# Filters a horizontal line
-;# expects:
-;# r3 src_ptr
-;# r4 pitch
-;# r10 16
-;# r12 32
-;# v17 perm intput
-;# v18 rounding
-;# v19 shift
-;# v20 filter taps
-;# v21 tmp
-;# v22 tmp
-;# v23 tmp
-;# v24 tmp
-;# v25 tmp
-;# v26 tmp
-;# v27 tmp
-;# v28 perm output
-;#
-.macro hfilter_16 V, increment_counter
-
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, r3
- lvx v22, r10, r3
- lvx v23, r12, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
- vperm v21, v21, v22, v17
- vperm v22, v22, v23, v17 ;# v8 v9 = 21 input pixels left-justified
-
- ;# set 0
- vmsummbm v24, v20, v21, v18 ;# taps times elements
-
- ;# set 1
- vsldoi v23, v21, v22, 1
- vmsummbm v25, v20, v23, v18
-
- ;# set 2
- vsldoi v23, v21, v22, 2
- vmsummbm v26, v20, v23, v18
-
- ;# set 3
- vsldoi v23, v21, v22, 3
- vmsummbm v27, v20, v23, v18
-
- vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
- vpkswus v25, v26, v27 ;# v25 = 2 6 A E 3 7 B F
-
- vsrh v24, v24, v19 ;# divide v0, v1 by 128
- vsrh v25, v25, v19
-
- vpkuhus \V, v24, v25 ;# \V = scrambled 8-bit result
- vperm \V, \V, v0, v28 ;# \V = correctly-ordered result
-.endm
-
-.macro load_and_align_16 V, increment_counter
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, r3
- lvx v22, r10, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
-
- vperm \V, v21, v22, v17
-.endm
-
-.macro write_16 V, increment_counter
- stvx \V, 0, r7
-
-.if \increment_counter
- add r7, r7, r8
-.endif
-.endm
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict16x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- HProlog second_pass_16x16_pre_copy_b
-
- hfilter_16 v0, 1
- hfilter_16 v1, 1
- hfilter_16 v2, 1
- hfilter_16 v3, 1
- hfilter_16 v4, 1
- hfilter_16 v5, 1
- hfilter_16 v6, 1
- hfilter_16 v7, 1
- hfilter_16 v8, 1
- hfilter_16 v9, 1
- hfilter_16 v10, 1
- hfilter_16 v11, 1
- hfilter_16 v12, 1
- hfilter_16 v13, 1
- hfilter_16 v14, 1
- hfilter_16 v15, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_16x16_b
-
- hfilter_16 v16, 0
-
- b second_pass_16x16_b
-
-second_pass_16x16_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_16 v0, 1
- load_and_align_16 v1, 1
- load_and_align_16 v2, 1
- load_and_align_16 v3, 1
- load_and_align_16 v4, 1
- load_and_align_16 v5, 1
- load_and_align_16 v6, 1
- load_and_align_16 v7, 1
- load_and_align_16 v8, 1
- load_and_align_16 v9, 1
- load_and_align_16 v10, 1
- load_and_align_16 v11, 1
- load_and_align_16 v12, 1
- load_and_align_16 v13, 1
- load_and_align_16 v14, 1
- load_and_align_16 v15, 1
- load_and_align_16 v16, 0
-
-second_pass_16x16_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
- vfilter_16 v8, v9
- vfilter_16 v9, v10
- vfilter_16 v10, v11
- vfilter_16 v11, v12
- vfilter_16 v12, v13
- vfilter_16 v13, v14
- vfilter_16 v14, v15
- vfilter_16 v15, v16
-
-store_out_16x16_b:
-
- write_16 v0, 1
- write_16 v1, 1
- write_16 v2, 1
- write_16 v3, 1
- write_16 v4, 1
- write_16 v5, 1
- write_16 v6, 1
- write_16 v7, 1
- write_16 v8, 1
- write_16 v9, 1
- write_16 v10, 1
- write_16 v11, 1
- write_16 v12, 1
- write_16 v13, 1
- write_16 v14, 1
- write_16 v15, 0
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .data
-
- .align 4
-hfilter_b:
- .byte 128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0
- .byte 112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0
- .byte 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0
- .byte 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0
- .byte 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0
- .byte 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0
- .byte 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0
- .byte 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0
-
- .align 4
-vfilter_b:
- .byte 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
- .byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
- .byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
- .byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
- .byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
- .byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
- .byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- .byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- .byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
- .byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
- .byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
- .byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
- .byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
- .byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
-
- .align 4
-b_hperm_b:
- .byte 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
-
- .align 4
-b_0123_b:
- .byte 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6
-
- .align 4
-b_4567_b:
- .byte 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10
-
-b_hilo_b:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/idctllm_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/idctllm_altivec.asm
deleted file mode 100644
index 117d9cf..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/idctllm_altivec.asm
+++ /dev/null
@@ -1,189 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl short_idct4x4llm_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-;# r3 short *input
-;# r4 short *output
-;# r5 int pitch
- .align 2
-short_idct4x4llm_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- load_c v8, sinpi8sqrt2, 0, r9, r10
- load_c v9, cospi8sqrt2minus1, 0, r9, r10
- load_c v10, hi_hi, 0, r9, r10
- load_c v11, lo_lo, 0, r9, r10
- load_c v12, shift_16, 0, r9, r10
-
- li r10, 16
- lvx v0, 0, r3 ;# input ip[0], ip[ 4]
- lvx v1, r10, r3 ;# input ip[8], ip[12]
-
- ;# first pass
- vupkhsh v2, v0
- vupkhsh v3, v1
- vaddsws v6, v2, v3 ;# a1 = ip[0]+ip[8]
- vsubsws v7, v2, v3 ;# b1 = ip[0]-ip[8]
-
- vupklsh v0, v0
- vmulosh v4, v0, v8
- vsraw v4, v4, v12
- vaddsws v4, v4, v0 ;# ip[ 4] * sin(pi/8) * sqrt(2)
-
- vupklsh v1, v1
- vmulosh v5, v1, v9
- vsraw v5, v5, v12 ;# ip[12] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v1
-
- vsubsws v4, v4, v5 ;# c1
-
- vmulosh v3, v1, v8
- vsraw v3, v3, v12
- vaddsws v3, v3, v1 ;# ip[12] * sin(pi/8) * sqrt(2)
-
- vmulosh v5, v0, v9
- vsraw v5, v5, v12 ;# ip[ 4] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v0
-
- vaddsws v3, v3, v5 ;# d1
-
- vaddsws v0, v6, v3 ;# a1 + d1
- vsubsws v3, v6, v3 ;# a1 - d1
-
- vaddsws v1, v7, v4 ;# b1 + c1
- vsubsws v2, v7, v4 ;# b1 - c1
-
- ;# transpose input
- vmrghw v4, v0, v1 ;# a0 b0 a1 b1
- vmrghw v5, v2, v3 ;# c0 d0 c1 d1
-
- vmrglw v6, v0, v1 ;# a2 b2 a3 b3
- vmrglw v7, v2, v3 ;# c2 d2 c3 d3
-
- vperm v0, v4, v5, v10 ;# a0 b0 c0 d0
- vperm v1, v4, v5, v11 ;# a1 b1 c1 d1
-
- vperm v2, v6, v7, v10 ;# a2 b2 c2 d2
- vperm v3, v6, v7, v11 ;# a3 b3 c3 d3
-
- ;# second pass
- vaddsws v6, v0, v2 ;# a1 = ip[0]+ip[8]
- vsubsws v7, v0, v2 ;# b1 = ip[0]-ip[8]
-
- vmulosh v4, v1, v8
- vsraw v4, v4, v12
- vaddsws v4, v4, v1 ;# ip[ 4] * sin(pi/8) * sqrt(2)
-
- vmulosh v5, v3, v9
- vsraw v5, v5, v12 ;# ip[12] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v3
-
- vsubsws v4, v4, v5 ;# c1
-
- vmulosh v2, v3, v8
- vsraw v2, v2, v12
- vaddsws v2, v2, v3 ;# ip[12] * sin(pi/8) * sqrt(2)
-
- vmulosh v5, v1, v9
- vsraw v5, v5, v12 ;# ip[ 4] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v1
-
- vaddsws v3, v2, v5 ;# d1
-
- vaddsws v0, v6, v3 ;# a1 + d1
- vsubsws v3, v6, v3 ;# a1 - d1
-
- vaddsws v1, v7, v4 ;# b1 + c1
- vsubsws v2, v7, v4 ;# b1 - c1
-
- vspltish v6, 4
- vspltish v7, 3
-
- vpkswss v0, v0, v1
- vpkswss v1, v2, v3
-
- vaddshs v0, v0, v6
- vaddshs v1, v1, v6
-
- vsrah v0, v0, v7
- vsrah v1, v1, v7
-
- ;# transpose output
- vmrghh v2, v0, v1 ;# a0 c0 a1 c1 a2 c2 a3 c3
- vmrglh v3, v0, v1 ;# b0 d0 b1 d1 b2 d2 b3 d3
-
- vmrghh v0, v2, v3 ;# a0 b0 c0 d0 a1 b1 c1 d1
- vmrglh v1, v2, v3 ;# a2 b2 c2 d2 a3 b3 c3 d3
-
- stwu r1,-416(r1) ;# create space on the stack
-
- stvx v0, 0, r1
- lwz r6, 0(r1)
- stw r6, 0(r4)
- lwz r6, 4(r1)
- stw r6, 4(r4)
-
- add r4, r4, r5
-
- lwz r6, 8(r1)
- stw r6, 0(r4)
- lwz r6, 12(r1)
- stw r6, 4(r4)
-
- add r4, r4, r5
-
- stvx v1, 0, r1
- lwz r6, 0(r1)
- stw r6, 0(r4)
- lwz r6, 4(r1)
- stw r6, 4(r4)
-
- add r4, r4, r5
-
- lwz r6, 8(r1)
- stw r6, 0(r4)
- lwz r6, 12(r1)
- stw r6, 4(r4)
-
- addi r1, r1, 416 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 4
-sinpi8sqrt2:
- .short 35468, 35468, 35468, 35468, 35468, 35468, 35468, 35468
-
- .align 4
-cospi8sqrt2minus1:
- .short 20091, 20091, 20091, 20091, 20091, 20091, 20091, 20091
-
- .align 4
-shift_16:
- .long 16, 16, 16, 16
-
- .align 4
-hi_hi:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
-
- .align 4
-lo_lo:
- .byte 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_altivec.c b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_altivec.c
deleted file mode 100644
index 71bf6e2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_altivec.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "loopfilter.h"
-#include "onyxc_int.h"
-
-typedef void loop_filter_function_y_ppc
-(
- unsigned char *s, // source pointer
- int p, // pitch
- const signed char *flimit,
- const signed char *limit,
- const signed char *thresh
-);
-
-typedef void loop_filter_function_uv_ppc
-(
- unsigned char *u, // source pointer
- unsigned char *v, // source pointer
- int p, // pitch
- const signed char *flimit,
- const signed char *limit,
- const signed char *thresh
-);
-
-typedef void loop_filter_function_s_ppc
-(
- unsigned char *s, // source pointer
- int p, // pitch
- const signed char *flimit
-);
-
-loop_filter_function_y_ppc mbloop_filter_horizontal_edge_y_ppc;
-loop_filter_function_y_ppc mbloop_filter_vertical_edge_y_ppc;
-loop_filter_function_y_ppc loop_filter_horizontal_edge_y_ppc;
-loop_filter_function_y_ppc loop_filter_vertical_edge_y_ppc;
-
-loop_filter_function_uv_ppc mbloop_filter_horizontal_edge_uv_ppc;
-loop_filter_function_uv_ppc mbloop_filter_vertical_edge_uv_ppc;
-loop_filter_function_uv_ppc loop_filter_horizontal_edge_uv_ppc;
-loop_filter_function_uv_ppc loop_filter_vertical_edge_uv_ppc;
-
-loop_filter_function_s_ppc loop_filter_simple_horizontal_edge_ppc;
-loop_filter_function_s_ppc loop_filter_simple_vertical_edge_ppc;
-
-// Horizontal MB filtering
-void loop_filter_mbh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- mbloop_filter_horizontal_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- mbloop_filter_horizontal_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_mbhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_horizontal_edge_ppc(y_ptr, y_stride, lfi->mbflim);
-}
-
-// Vertical MB Filtering
-void loop_filter_mbv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- mbloop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- mbloop_filter_vertical_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_mbvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_vertical_edge_ppc(y_ptr, y_stride, lfi->mbflim);
-}
-
-// Horizontal B Filtering
-void loop_filter_bh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- // These should all be done at once with one call, instead of 3
- loop_filter_horizontal_edge_y_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
- loop_filter_horizontal_edge_y_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
- loop_filter_horizontal_edge_y_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- loop_filter_horizontal_edge_uv_ppc(u_ptr + 4 * uv_stride, v_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_bhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_horizontal_edge_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim);
- loop_filter_simple_horizontal_edge_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim);
- loop_filter_simple_horizontal_edge_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim);
-}
-
-// Vertical B Filtering
-void loop_filter_bv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- loop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->flim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- loop_filter_vertical_edge_uv_ppc(u_ptr + 4, v_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_bvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_vertical_edge_ppc(y_ptr + 4, y_stride, lfi->flim);
- loop_filter_simple_vertical_edge_ppc(y_ptr + 8, y_stride, lfi->flim);
- loop_filter_simple_vertical_edge_ppc(y_ptr + 12, y_stride, lfi->flim);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_filters_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_filters_altivec.asm
deleted file mode 100644
index 61df4e9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/loopfilter_filters_altivec.asm
+++ /dev/null
@@ -1,1253 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl mbloop_filter_horizontal_edge_y_ppc
- .globl loop_filter_horizontal_edge_y_ppc
- .globl mbloop_filter_vertical_edge_y_ppc
- .globl loop_filter_vertical_edge_y_ppc
-
- .globl mbloop_filter_horizontal_edge_uv_ppc
- .globl loop_filter_horizontal_edge_uv_ppc
- .globl mbloop_filter_vertical_edge_uv_ppc
- .globl loop_filter_vertical_edge_uv_ppc
-
- .globl loop_filter_simple_horizontal_edge_ppc
- .globl loop_filter_simple_vertical_edge_ppc
-
- .text
-;# We often need to perform transposes (and other transpose-like operations)
-;# on matrices of data. This is simplified by the fact that we usually
-;# operate on hunks of data whose dimensions are powers of 2, or at least
-;# divisible by highish powers of 2.
-;#
-;# These operations can be very confusing. They become more straightforward
-;# when we think of them as permutations of address bits: Concatenate a
-;# group of vector registers and think of it as occupying a block of
-;# memory beginning at address zero. The low four bits 0...3 of the
-;# address then correspond to position within a register, the higher-order
-;# address bits select the register.
-;#
-;# Although register selection, at the code level, is arbitrary, things
-;# are simpler if we use contiguous ranges of register numbers, simpler
-;# still if the low-order bits of the register number correspond to
-;# conceptual address bits. We do this whenever reasonable.
-;#
-;# A 16x16 transpose can then be thought of as an operation on
-;# a 256-element block of memory. It takes 8 bits 0...7 to address this
-;# memory and the effect of a transpose is to interchange address bit
-;# 0 with 4, 1 with 5, 2 with 6, and 3 with 7. Bits 0...3 index the
-;# column, which is interchanged with the row addressed by bits 4..7.
-;#
-;# The altivec merge instructions provide a rapid means of effecting
-;# many of these transforms. They operate at three widths (8,16,32).
-;# Writing V(x) for vector register #x, paired merges permute address
-;# indices as follows.
-;#
-;# 0->1 1->2 2->3 3->(4+d) (4+s)->0:
-;#
-;# vmrghb V( x), V( y), V( y + (1<<s))
-;# vmrglb V( x + (1<<d)), V( y), V( y + (1<<s))
-;#
-;#
-;# =0= 1->2 2->3 3->(4+d) (4+s)->1:
-;#
-;# vmrghh V( x), V( y), V( y + (1<<s))
-;# vmrglh V( x + (1<<d)), V( y), V( y + (1<<s))
-;#
-;#
-;# =0= =1= 2->3 3->(4+d) (4+s)->2:
-;#
-;# vmrghw V( x), V( y), V( y + (1<<s))
-;# vmrglw V( x + (1<<d)), V( y), V( y + (1<<s))
-;#
-;#
-;# Unfortunately, there is no doubleword merge instruction.
-;# The following sequence uses "vperm" is a substitute.
-;# Assuming that the selection masks b_hihi and b_lolo (defined in LFppc.c)
-;# are in registers Vhihi and Vlolo, we can also effect the permutation
-;#
-;# =0= =1= =2= 3->(4+d) (4+s)->3 by the sequence:
-;#
-;# vperm V( x), V( y), V( y + (1<<s)), Vhihi
-;# vperm V( x + (1<<d)), V( y), V( y + (1<<s)), Vlolo
-;#
-;#
-;# Except for bits s and d, the other relationships between register
-;# number (= high-order part of address) bits are at the disposal of
-;# the programmer.
-;#
-
-;# To avoid excess transposes, we filter all 3 vertical luma subblock
-;# edges together. This requires a single 16x16 transpose, which, in
-;# the above language, amounts to the following permutation of address
-;# indices: 0<->4 1<->5 2<->6 3<->7, which we accomplish by
-;# 4 iterations of the cyclic transform 0->1->2->3->4->5->6->7->0.
-;#
-;# Except for the fact that the destination registers get written
-;# before we are done referencing the old contents, the cyclic transform
-;# is effected by
-;#
-;# x = 0; do {
-;# vmrghb V(2x), V(x), V(x+8);
-;# vmrghb V(2x+1), V(x), V(x+8);
-;# } while( ++x < 8);
-;#
-;# For clarity, and because we can afford it, we do this transpose
-;# using all 32 registers, alternating the banks 0..15 and 16 .. 31,
-;# leaving the final result in 16 .. 31, as the lower registers are
-;# used in the filtering itself.
-;#
-.macro Tpair A, B, X, Y
- vmrghb \A, \X, \Y
- vmrglb \B, \X, \Y
-.endm
-
-;# Each step takes 8*2 = 16 instructions
-
-.macro t16_even
- Tpair v16,v17, v0,v8
- Tpair v18,v19, v1,v9
- Tpair v20,v21, v2,v10
- Tpair v22,v23, v3,v11
- Tpair v24,v25, v4,v12
- Tpair v26,v27, v5,v13
- Tpair v28,v29, v6,v14
- Tpair v30,v31, v7,v15
-.endm
-
-.macro t16_odd
- Tpair v0,v1, v16,v24
- Tpair v2,v3, v17,v25
- Tpair v4,v5, v18,v26
- Tpair v6,v7, v19,v27
- Tpair v8,v9, v20,v28
- Tpair v10,v11, v21,v29
- Tpair v12,v13, v22,v30
- Tpair v14,v15, v23,v31
-.endm
-
-;# Whole transpose takes 4*16 = 64 instructions
-
-.macro t16_full
- t16_odd
- t16_even
- t16_odd
- t16_even
-.endm
-
-;# Vertical edge filtering requires transposes. For the simple filter,
-;# we need to convert 16 rows of 4 pels each into 4 registers of 16 pels
-;# each. Writing 0 ... 63 for the pixel indices, the desired result is:
-;#
-;# v0 = 0 1 ... 14 15
-;# v1 = 16 17 ... 30 31
-;# v2 = 32 33 ... 47 48
-;# v3 = 49 50 ... 62 63
-;#
-;# In frame-buffer memory, the layout is:
-;#
-;# 0 16 32 48
-;# 1 17 33 49
-;# ...
-;# 15 31 47 63.
-;#
-;# We begin by reading the data 32 bits at a time (using scalar operations)
-;# into a temporary array, reading the rows of the array into vector registers,
-;# with the following layout:
-;#
-;# v0 = 0 16 32 48 4 20 36 52 8 24 40 56 12 28 44 60
-;# v1 = 1 17 33 49 5 21 ... 45 61
-;# v2 = 2 18 ... 46 62
-;# v3 = 3 19 ... 47 63
-;#
-;# From the "address-bit" perspective discussed above, we simply need to
-;# interchange bits 0 <-> 4 and 1 <-> 5, leaving bits 2 and 3 alone.
-;# In other words, we transpose each of the four 4x4 submatrices.
-;#
-;# This transformation is its own inverse, and we need to perform it
-;# again before writing the pixels back into the frame buffer.
-;#
-;# It acts in place on registers v0...v3, uses v4...v7 as temporaries,
-;# and assumes that v14/v15 contain the b_hihi/b_lolo selectors
-;# defined above. We think of both groups of 4 registers as having
-;# "addresses" {0,1,2,3} * 16.
-;#
-.macro Transpose4times4x4 Vlo, Vhi
-
- ;# d=s=0 0->1 1->2 2->3 3->4 4->0 =5=
-
- vmrghb v4, v0, v1
- vmrglb v5, v0, v1
- vmrghb v6, v2, v3
- vmrglb v7, v2, v3
-
- ;# d=0 s=1 =0= 1->2 2->3 3->4 4->5 5->1
-
- vmrghh v0, v4, v6
- vmrglh v1, v4, v6
- vmrghh v2, v5, v7
- vmrglh v3, v5, v7
-
- ;# d=s=0 =0= =1= 2->3 3->4 4->2 =5=
-
- vmrghw v4, v0, v1
- vmrglw v5, v0, v1
- vmrghw v6, v2, v3
- vmrglw v7, v2, v3
-
- ;# d=0 s=1 =0= =1= =2= 3->4 4->5 5->3
-
- vperm v0, v4, v6, \Vlo
- vperm v1, v4, v6, \Vhi
- vperm v2, v5, v7, \Vlo
- vperm v3, v5, v7, \Vhi
-.endm
-;# end Transpose4times4x4
-
-
-;# Normal mb vertical edge filter transpose.
-;#
-;# We read 8 columns of data, initially in the following pattern:
-;#
-;# (0,0) (1,0) ... (7,0) (0,1) (1,1) ... (7,1)
-;# (0,2) (1,2) ... (7,2) (0,3) (1,3) ... (7,3)
-;# ...
-;# (0,14) (1,14) .. (7,14) (0,15) (1,15) .. (7,15)
-;#
-;# and wish to convert to:
-;#
-;# (0,0) ... (0,15)
-;# (1,0) ... (1,15)
-;# ...
-;# (7,0) ... (7,15).
-;#
-;# In "address bit" language, we wish to map
-;#
-;# 0->4 1->5 2->6 3->0 4->1 5->2 6->3, i.e., I -> (I+4) mod 7.
-;#
-;# This can be accomplished by 4 iterations of the cyclic transform
-;#
-;# I -> (I+1) mod 7;
-;#
-;# each iteration can be realized by (d=0, s=2):
-;#
-;# x = 0; do Tpair( V(2x),V(2x+1), V(x),V(x+4)) while( ++x < 4);
-;#
-;# The input/output is in registers v0...v7. We use v10...v17 as mirrors;
-;# preserving v8 = sign converter.
-;#
-;# Inverse transpose is similar, except here I -> (I+3) mod 7 and the
-;# result lands in the "mirror" registers v10...v17
-;#
-.macro t8x16_odd
- Tpair v10, v11, v0, v4
- Tpair v12, v13, v1, v5
- Tpair v14, v15, v2, v6
- Tpair v16, v17, v3, v7
-.endm
-
-.macro t8x16_even
- Tpair v0, v1, v10, v14
- Tpair v2, v3, v11, v15
- Tpair v4, v5, v12, v16
- Tpair v6, v7, v13, v17
-.endm
-
-.macro transpose8x16_fwd
- t8x16_odd
- t8x16_even
- t8x16_odd
- t8x16_even
-.endm
-
-.macro transpose8x16_inv
- t8x16_odd
- t8x16_even
- t8x16_odd
-.endm
-
-.macro Transpose16x16
- vmrghb v0, v16, v24
- vmrglb v1, v16, v24
- vmrghb v2, v17, v25
- vmrglb v3, v17, v25
- vmrghb v4, v18, v26
- vmrglb v5, v18, v26
- vmrghb v6, v19, v27
- vmrglb v7, v19, v27
- vmrghb v8, v20, v28
- vmrglb v9, v20, v28
- vmrghb v10, v21, v29
- vmrglb v11, v21, v29
- vmrghb v12, v22, v30
- vmrglb v13, v22, v30
- vmrghb v14, v23, v31
- vmrglb v15, v23, v31
- vmrghb v16, v0, v8
- vmrglb v17, v0, v8
- vmrghb v18, v1, v9
- vmrglb v19, v1, v9
- vmrghb v20, v2, v10
- vmrglb v21, v2, v10
- vmrghb v22, v3, v11
- vmrglb v23, v3, v11
- vmrghb v24, v4, v12
- vmrglb v25, v4, v12
- vmrghb v26, v5, v13
- vmrglb v27, v5, v13
- vmrghb v28, v6, v14
- vmrglb v29, v6, v14
- vmrghb v30, v7, v15
- vmrglb v31, v7, v15
- vmrghb v0, v16, v24
- vmrglb v1, v16, v24
- vmrghb v2, v17, v25
- vmrglb v3, v17, v25
- vmrghb v4, v18, v26
- vmrglb v5, v18, v26
- vmrghb v6, v19, v27
- vmrglb v7, v19, v27
- vmrghb v8, v20, v28
- vmrglb v9, v20, v28
- vmrghb v10, v21, v29
- vmrglb v11, v21, v29
- vmrghb v12, v22, v30
- vmrglb v13, v22, v30
- vmrghb v14, v23, v31
- vmrglb v15, v23, v31
- vmrghb v16, v0, v8
- vmrglb v17, v0, v8
- vmrghb v18, v1, v9
- vmrglb v19, v1, v9
- vmrghb v20, v2, v10
- vmrglb v21, v2, v10
- vmrghb v22, v3, v11
- vmrglb v23, v3, v11
- vmrghb v24, v4, v12
- vmrglb v25, v4, v12
- vmrghb v26, v5, v13
- vmrglb v27, v5, v13
- vmrghb v28, v6, v14
- vmrglb v29, v6, v14
- vmrghb v30, v7, v15
- vmrglb v31, v7, v15
-.endm
-
-;# load_g loads a global vector (whose address is in the local variable Gptr)
-;# into vector register Vreg. Trashes r0
-.macro load_g Vreg, Gptr
- lwz r0, \Gptr
- lvx \Vreg, 0, r0
-.endm
-
-;# exploit the saturation here. if the answer is negative
-;# it will be clamped to 0. orring 0 with a positive
-;# number will be the positive number (abs)
-;# RES = abs( A-B), trashes TMP
-.macro Abs RES, TMP, A, B
- vsububs \RES, \A, \B
- vsububs \TMP, \B, \A
- vor \RES, \RES, \TMP
-.endm
-
-;# RES = Max( RES, abs( A-B)), trashes TMP
-.macro max_abs RES, TMP, A, B
- vsububs \TMP, \A, \B
- vmaxub \RES, \RES, \TMP
- vsububs \TMP, \B, \A
- vmaxub \RES, \RES, \TMP
-.endm
-
-.macro Masks
- ;# build masks
- ;# input is all 8 bit unsigned (0-255). need to
- ;# do abs(vala-valb) > limit. but no need to compare each
- ;# value to the limit. find the max of the absolute differences
- ;# and compare that to the limit.
- ;# First hev
- Abs v14, v13, v2, v3 ;# |P1 - P0|
- max_abs v14, v13, v5, v4 ;# |Q1 - Q0|
-
- vcmpgtub v10, v14, v10 ;# HEV = true if thresh exceeded
-
- ;# Next limit
- max_abs v14, v13, v0, v1 ;# |P3 - P2|
- max_abs v14, v13, v1, v2 ;# |P2 - P1|
- max_abs v14, v13, v6, v5 ;# |Q2 - Q1|
- max_abs v14, v13, v7, v6 ;# |Q3 - Q2|
-
- vcmpgtub v9, v14, v9 ;# R = true if limit exceeded
-
- ;# flimit
- Abs v14, v13, v3, v4 ;# |P0 - Q0|
-
- vcmpgtub v8, v14, v8 ;# X = true if flimit exceeded
-
- vor v8, v8, v9 ;# R = true if flimit or limit exceeded
- ;# done building masks
-.endm
-
-.macro build_constants RFL, RLI, RTH, FL, LI, TH
- ;# build constants
- lvx \FL, 0, \RFL ;# flimit
- lvx \LI, 0, \RLI ;# limit
- lvx \TH, 0, \RTH ;# thresh
-
- vspltisb v11, 8
- vspltisb v12, 4
- vslb v11, v11, v12 ;# 0x80808080808080808080808080808080
-.endm
-
-.macro load_data_y
- ;# setup strides/pointers to be able to access
- ;# all of the data
- add r5, r4, r4 ;# r5 = 2 * stride
- sub r6, r3, r5 ;# r6 -> 2 rows back
- neg r7, r4 ;# r7 = -stride
-
- ;# load 16 pixels worth of data to work on
- sub r0, r6, r5 ;# r0 -> 4 rows back (temp)
- lvx v0, 0, r0 ;# P3 (read only)
- lvx v1, r7, r6 ;# P2
- lvx v2, 0, r6 ;# P1
- lvx v3, r7, r3 ;# P0
- lvx v4, 0, r3 ;# Q0
- lvx v5, r4, r3 ;# Q1
- lvx v6, r5, r3 ;# Q2
- add r0, r3, r5 ;# r0 -> 2 rows fwd (temp)
- lvx v7, r4, r0 ;# Q3 (read only)
-.endm
-
-;# Expects
-;# v10 == HEV
-;# v13 == tmp
-;# v14 == tmp
-.macro common_adjust P0, Q0, P1, Q1, HEV_PRESENT
- vxor \P1, \P1, v11 ;# SP1
- vxor \P0, \P0, v11 ;# SP0
- vxor \Q0, \Q0, v11 ;# SQ0
- vxor \Q1, \Q1, v11 ;# SQ1
-
- vsubsbs v13, \P1, \Q1 ;# f = c (P1 - Q1)
-.if \HEV_PRESENT
- vand v13, v13, v10 ;# f &= hev
-.endif
- vsubsbs v14, \Q0, \P0 ;# -126 <= X = Q0-P0 <= +126
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
-
- vandc v13, v13, v8 ;# f &= mask
-
- vspltisb v8, 3
- vspltisb v9, 4
-
- vaddsbs v14, v13, v9 ;# f1 = c (f+4)
- vaddsbs v15, v13, v8 ;# f2 = c (f+3)
-
- vsrab v13, v14, v8 ;# f1 >>= 3
- vsrab v15, v15, v8 ;# f2 >>= 3
-
- vsubsbs \Q0, \Q0, v13 ;# u1 = c (SQ0 - f1)
- vaddsbs \P0, \P0, v15 ;# u2 = c (SP0 + f2)
-.endm
-
-.macro vp8_mbfilter
- Masks
-
- ;# start the fitering here
- vxor v1, v1, v11 ;# SP2
- vxor v2, v2, v11 ;# SP1
- vxor v3, v3, v11 ;# SP0
- vxor v4, v4, v11 ;# SQ0
- vxor v5, v5, v11 ;# SQ1
- vxor v6, v6, v11 ;# SQ2
-
- ;# add outer taps if we have high edge variance
- vsubsbs v13, v2, v5 ;# f = c (SP1-SQ1)
-
- vsubsbs v14, v4, v3 ;# SQ0-SP0
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14 ;# f = c( c(SP1-SQ1) + 3*(SQ0-SP0))
-
- vandc v13, v13, v8 ;# f &= mask
- vand v15, v13, v10 ;# f2 = f & hev
-
- ;# save bottom 3 bits so that we round one side +4 and the other +3
- vspltisb v8, 3
- vspltisb v9, 4
-
- vaddsbs v14, v15, v9 ;# f1 = c (f+4)
- vaddsbs v15, v15, v8 ;# f2 = c (f+3)
-
- vsrab v14, v14, v8 ;# f1 >>= 3
- vsrab v15, v15, v8 ;# f2 >>= 3
-
- vsubsbs v4, v4, v14 ;# u1 = c (SQ0 - f1)
- vaddsbs v3, v3, v15 ;# u2 = c (SP0 + f2)
-
- ;# only apply wider filter if not high edge variance
- vandc v13, v13, v10 ;# f &= ~hev
-
- vspltisb v9, 2
- vnor v8, v8, v8
- vsrb v9, v8, v9 ;# 0x3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f
- vupkhsb v9, v9 ;# 0x003f003f003f003f003f003f003f003f
- vspltisb v8, 9
-
- ;# roughly 1/7th difference across boundary
- vspltish v10, 7
- vmulosb v14, v8, v13 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
- vmulesb v15, v8, v13
- vaddshs v14, v14, v9 ;# += 63
- vaddshs v15, v15, v9
- vsrah v14, v14, v10 ;# >>= 7
- vsrah v15, v15, v10
- vmrglh v10, v15, v14
- vmrghh v15, v15, v14
-
- vpkshss v10, v15, v10 ;# X = saturated down to bytes
-
- vsubsbs v6, v6, v10 ;# subtract from Q and add to P
- vaddsbs v1, v1, v10
-
- vxor v6, v6, v11
- vxor v1, v1, v11
-
- ;# roughly 2/7th difference across boundary
- vspltish v10, 7
- vaddubm v12, v8, v8
- vmulosb v14, v12, v13 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
- vmulesb v15, v12, v13
- vaddshs v14, v14, v9
- vaddshs v15, v15, v9
- vsrah v14, v14, v10 ;# >>= 7
- vsrah v15, v15, v10
- vmrglh v10, v15, v14
- vmrghh v15, v15, v14
-
- vpkshss v10, v15, v10 ;# X = saturated down to bytes
-
- vsubsbs v5, v5, v10 ;# subtract from Q and add to P
- vaddsbs v2, v2, v10
-
- vxor v5, v5, v11
- vxor v2, v2, v11
-
- ;# roughly 3/7th difference across boundary
- vspltish v10, 7
- vaddubm v12, v12, v8
- vmulosb v14, v12, v13 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
- vmulesb v15, v12, v13
- vaddshs v14, v14, v9
- vaddshs v15, v15, v9
- vsrah v14, v14, v10 ;# >>= 7
- vsrah v15, v15, v10
- vmrglh v10, v15, v14
- vmrghh v15, v15, v14
-
- vpkshss v10, v15, v10 ;# X = saturated down to bytes
-
- vsubsbs v4, v4, v10 ;# subtract from Q and add to P
- vaddsbs v3, v3, v10
-
- vxor v4, v4, v11
- vxor v3, v3, v11
-.endm
-
-.macro SBFilter
- Masks
-
- common_adjust v3, v4, v2, v5, 1
-
- ;# outer tap adjustments
- vspltisb v8, 1
-
- vaddubm v13, v13, v8 ;# f += 1
- vsrab v13, v13, v8 ;# f >>= 1
-
- vandc v13, v13, v10 ;# f &= ~hev
-
- vsubsbs v5, v5, v13 ;# u1 = c (SQ1 - f)
- vaddsbs v2, v2, v13 ;# u2 = c (SP1 + f)
-
- vxor v2, v2, v11
- vxor v3, v3, v11
- vxor v4, v4, v11
- vxor v5, v5, v11
-.endm
-
- .align 2
-mbloop_filter_horizontal_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r5, r6, r7, v8, v9, v10
-
- load_data_y
-
- vp8_mbfilter
-
- stvx v1, r7, r6 ;# P2
- stvx v2, 0, r6 ;# P1
- stvx v3, r7, r3 ;# P0
- stvx v4, 0, r3 ;# Q0
- stvx v5, r4, r3 ;# Q1
- stvx v6, r5, r3 ;# Q2
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-;# r6 const signed char *limit
-;# r7 const signed char *thresh
-loop_filter_horizontal_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r5, r6, r7, v8, v9, v10
-
- load_data_y
-
- SBFilter
-
- stvx v2, 0, r6 ;# P1
- stvx v3, r7, r3 ;# P0
- stvx v4, 0, r3 ;# Q0
- stvx v5, r4, r3 ;# Q1
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# Filtering a vertical mb. Each mb is aligned on a 16 byte boundary.
-;# So we can read in an entire mb aligned. However if we want to filter the mb
-;# edge we run into problems. For the loopfilter we require 4 bytes before the mb
-;# and 4 after for a total of 8 bytes. Reading 16 bytes inorder to get 4 is a bit
-;# of a waste. So this is an even uglier way to get around that.
-;# Using the regular register file words are read in and then saved back out to
-;# memory to align and order them up. Then they are read in using the
-;# vector register file.
-.macro RLVmb V, R
- lwzux r0, r3, r4
- stw r0, 4(\R)
- lwz r0,-4(r3)
- stw r0, 0(\R)
- lwzux r0, r3, r4
- stw r0,12(\R)
- lwz r0,-4(r3)
- stw r0, 8(\R)
- lvx \V, 0, \R
-.endm
-
-.macro WLVmb V, R
- stvx \V, 0, \R
- lwz r0,12(\R)
- stwux r0, r3, r4
- lwz r0, 8(\R)
- stw r0,-4(r3)
- lwz r0, 4(\R)
- stwux r0, r3, r4
- lwz r0, 0(\R)
- stw r0,-4(r3)
-.endm
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-;# r6 const signed char *limit
-;# r7 const signed char *thresh
-mbloop_filter_vertical_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- la r9, -48(r1) ;# temporary space for reading in vectors
- sub r3, r3, r4
-
- RLVmb v0, r9
- RLVmb v1, r9
- RLVmb v2, r9
- RLVmb v3, r9
- RLVmb v4, r9
- RLVmb v5, r9
- RLVmb v6, r9
- RLVmb v7, r9
-
- transpose8x16_fwd
-
- build_constants r5, r6, r7, v8, v9, v10
-
- vp8_mbfilter
-
- transpose8x16_inv
-
- add r3, r3, r4
- neg r4, r4
-
- WLVmb v17, r9
- WLVmb v16, r9
- WLVmb v15, r9
- WLVmb v14, r9
- WLVmb v13, r9
- WLVmb v12, r9
- WLVmb v11, r9
- WLVmb v10, r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro RL V, R, P
- lvx \V, 0, \R
- add \R, \R, \P
-.endm
-
-.macro WL V, R, P
- stvx \V, 0, \R
- add \R, \R, \P
-.endm
-
-.macro Fil P3, P2, P1, P0, Q0, Q1, Q2, Q3
- ;# K = |P0-P1| already
- Abs v14, v13, \Q0, \Q1 ;# M = |Q0-Q1|
- vmaxub v14, v14, v4 ;# M = max( |P0-P1|, |Q0-Q1|)
- vcmpgtub v10, v14, v0
-
- Abs v4, v5, \Q2, \Q3 ;# K = |Q2-Q3| = next |P0-P1]
-
- max_abs v14, v13, \Q1, \Q2 ;# M = max( M, |Q1-Q2|)
- max_abs v14, v13, \P1, \P2 ;# M = max( M, |P1-P2|)
- max_abs v14, v13, \P2, \P3 ;# M = max( M, |P2-P3|)
-
- vmaxub v14, v14, v4 ;# M = max interior abs diff
- vcmpgtub v9, v14, v2 ;# M = true if int_l exceeded
-
- Abs v14, v13, \P0, \Q0 ;# X = Abs( P0-Q0)
- vcmpgtub v8, v14, v3 ;# X = true if edge_l exceeded
- vor v8, v8, v9 ;# M = true if edge_l or int_l exceeded
-
- ;# replace P1,Q1 w/signed versions
- common_adjust \P0, \Q0, \P1, \Q1, 1
-
- vaddubm v13, v13, v1 ;# -16 <= M <= 15, saturation irrelevant
- vsrab v13, v13, v1
- vandc v13, v13, v10 ;# adjust P1,Q1 by (M+1)>>1 if ! hev
- vsubsbs \Q1, \Q1, v13
- vaddsbs \P1, \P1, v13
-
- vxor \P1, \P1, v11 ;# P1
- vxor \P0, \P0, v11 ;# P0
- vxor \Q0, \Q0, v11 ;# Q0
- vxor \Q1, \Q1, v11 ;# Q1
-.endm
-
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-;# r6 const signed char *limit
-;# r7 const signed char *thresh
-loop_filter_vertical_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- addi r9, r3, 0
- RL v16, r9, r4
- RL v17, r9, r4
- RL v18, r9, r4
- RL v19, r9, r4
- RL v20, r9, r4
- RL v21, r9, r4
- RL v22, r9, r4
- RL v23, r9, r4
- RL v24, r9, r4
- RL v25, r9, r4
- RL v26, r9, r4
- RL v27, r9, r4
- RL v28, r9, r4
- RL v29, r9, r4
- RL v30, r9, r4
- lvx v31, 0, r9
-
- Transpose16x16
-
- vspltisb v1, 1
-
- build_constants r5, r6, r7, v3, v2, v0
-
- Abs v4, v5, v19, v18 ;# K(v14) = first |P0-P1|
-
- Fil v16, v17, v18, v19, v20, v21, v22, v23
- Fil v20, v21, v22, v23, v24, v25, v26, v27
- Fil v24, v25, v26, v27, v28, v29, v30, v31
-
- Transpose16x16
-
- addi r9, r3, 0
- WL v16, r9, r4
- WL v17, r9, r4
- WL v18, r9, r4
- WL v19, r9, r4
- WL v20, r9, r4
- WL v21, r9, r4
- WL v22, r9, r4
- WL v23, r9, r4
- WL v24, r9, r4
- WL v25, r9, r4
- WL v26, r9, r4
- WL v27, r9, r4
- WL v28, r9, r4
- WL v29, r9, r4
- WL v30, r9, r4
- stvx v31, 0, r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UV FILTERING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-.macro active_chroma_sel V
- andi. r7, r3, 8 ;# row origin modulo 16
- add r7, r7, r7 ;# selects selectors
- lis r12, _chromaSelectors@ha
- la r0, _chromaSelectors@l(r12)
- lwzux r0, r7, r0 ;# leave selector addr in r7
-
- lvx \V, 0, r0 ;# mask to concatenate active U,V pels
-.endm
-
-.macro hread_uv Dest, U, V, Offs, VMask
- lvx \U, \Offs, r3
- lvx \V, \Offs, r4
- vperm \Dest, \U, \V, \VMask ;# Dest = active part of U then V
-.endm
-
-.macro hwrite_uv New, U, V, Offs, Umask, Vmask
- vperm \U, \New, \U, \Umask ;# Combine new pels with siblings
- vperm \V, \New, \V, \Vmask
- stvx \U, \Offs, r3 ;# Write to frame buffer
- stvx \V, \Offs, r4
-.endm
-
-;# Process U,V in parallel.
-.macro load_chroma_h
- neg r9, r5 ;# r9 = -1 * stride
- add r8, r9, r9 ;# r8 = -2 * stride
- add r10, r5, r5 ;# r10 = 2 * stride
-
- active_chroma_sel v12
-
- ;# P3, Q3 are read-only; need not save addresses or sibling pels
- add r6, r8, r8 ;# r6 = -4 * stride
- hread_uv v0, v14, v15, r6, v12
- add r6, r10, r5 ;# r6 = 3 * stride
- hread_uv v7, v14, v15, r6, v12
-
- ;# Others are read/write; save addresses and sibling pels
-
- add r6, r8, r9 ;# r6 = -3 * stride
- hread_uv v1, v16, v17, r6, v12
- hread_uv v2, v18, v19, r8, v12
- hread_uv v3, v20, v21, r9, v12
- hread_uv v4, v22, v23, 0, v12
- hread_uv v5, v24, v25, r5, v12
- hread_uv v6, v26, v27, r10, v12
-.endm
-
-.macro uresult_sel V
- load_g \V, 4(r7)
-.endm
-
-.macro vresult_sel V
- load_g \V, 8(r7)
-.endm
-
-;# always write P1,P0,Q0,Q1
-.macro store_chroma_h
- uresult_sel v11
- vresult_sel v12
- hwrite_uv v2, v18, v19, r8, v11, v12
- hwrite_uv v3, v20, v21, r9, v11, v12
- hwrite_uv v4, v22, v23, 0, v11, v12
- hwrite_uv v5, v24, v25, r5, v11, v12
-.endm
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-mbloop_filter_horizontal_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r6, r7, r8, v8, v9, v10
-
- load_chroma_h
-
- vp8_mbfilter
-
- store_chroma_h
-
- hwrite_uv v1, v16, v17, r6, v11, v12 ;# v1 == P2
- hwrite_uv v6, v26, v27, r10, v11, v12 ;# v6 == Q2
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-loop_filter_horizontal_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r6, r7, r8, v8, v9, v10
-
- load_chroma_h
-
- SBFilter
-
- store_chroma_h
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro R V, R
- lwzux r0, r3, r5
- stw r0, 4(\R)
- lwz r0,-4(r3)
- stw r0, 0(\R)
- lwzux r0, r4, r5
- stw r0,12(\R)
- lwz r0,-4(r4)
- stw r0, 8(\R)
- lvx \V, 0, \R
-.endm
-
-
-.macro W V, R
- stvx \V, 0, \R
- lwz r0,12(\R)
- stwux r0, r4, r5
- lwz r0, 8(\R)
- stw r0,-4(r4)
- lwz r0, 4(\R)
- stwux r0, r3, r5
- lwz r0, 0(\R)
- stw r0,-4(r3)
-.endm
-
-.macro chroma_vread R
- sub r3, r3, r5 ;# back up one line for simplicity
- sub r4, r4, r5
-
- R v0, \R
- R v1, \R
- R v2, \R
- R v3, \R
- R v4, \R
- R v5, \R
- R v6, \R
- R v7, \R
-
- transpose8x16_fwd
-.endm
-
-.macro chroma_vwrite R
-
- transpose8x16_inv
-
- add r3, r3, r5
- add r4, r4, r5
- neg r5, r5 ;# Write rows back in reverse order
-
- W v17, \R
- W v16, \R
- W v15, \R
- W v14, \R
- W v13, \R
- W v12, \R
- W v11, \R
- W v10, \R
-.endm
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-mbloop_filter_vertical_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- la r9, -48(r1) ;# temporary space for reading in vectors
-
- chroma_vread r9
-
- build_constants r6, r7, r8, v8, v9, v10
-
- vp8_mbfilter
-
- chroma_vwrite r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-loop_filter_vertical_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- la r9, -48(r1) ;# temporary space for reading in vectors
-
- chroma_vread r9
-
- build_constants r6, r7, r8, v8, v9, v10
-
- SBFilter
-
- chroma_vwrite r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# -=-=-=-=-=-=-=-=-=-=-=-=-=-= SIMPLE LOOP FILTER =-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-.macro vp8_simple_filter
- Abs v14, v13, v1, v2 ;# M = abs( P0 - Q0)
- vcmpgtub v8, v14, v8 ;# v5 = true if _over_ limit
-
- ;# preserve unsigned v0 and v3
- common_adjust v1, v2, v0, v3, 0
-
- vxor v1, v1, v11
- vxor v2, v2, v11 ;# cvt Q0, P0 back to pels
-.endm
-
-.macro simple_vertical
- addi r8, 0, 16
- addi r7, r5, 32
-
- lvx v0, 0, r5
- lvx v1, r8, r5
- lvx v2, 0, r7
- lvx v3, r8, r7
-
- lis r12, _B_hihi@ha
- la r0, _B_hihi@l(r12)
- lvx v16, 0, r0
-
- lis r12, _B_lolo@ha
- la r0, _B_lolo@l(r12)
- lvx v17, 0, r0
-
- Transpose4times4x4 v16, v17
- vp8_simple_filter
-
- vxor v0, v0, v11
- vxor v3, v3, v11 ;# cvt Q0, P0 back to pels
-
- Transpose4times4x4 v16, v17
-
- stvx v0, 0, r5
- stvx v1, r8, r5
- stvx v2, 0, r7
- stvx v3, r8, r7
-.endm
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-loop_filter_simple_horizontal_edge_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- ;# build constants
- lvx v8, 0, r5 ;# flimit
-
- vspltisb v11, 8
- vspltisb v12, 4
- vslb v11, v11, v12 ;# 0x80808080808080808080808080808080
-
- neg r5, r4 ;# r5 = -1 * stride
- add r6, r5, r5 ;# r6 = -2 * stride
-
- lvx v0, r6, r3 ;# v0 = P1 = 16 pels two rows above edge
- lvx v1, r5, r3 ;# v1 = P0 = 16 pels one row above edge
- lvx v2, 0, r3 ;# v2 = Q0 = 16 pels one row below edge
- lvx v3, r4, r3 ;# v3 = Q1 = 16 pels two rows below edge
-
- vp8_simple_filter
-
- stvx v1, r5, r3 ;# store P0
- stvx v2, 0, r3 ;# store Q0
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro RLV Offs
- stw r0, (\Offs*4)(r5)
- lwzux r0, r7, r4
-.endm
-
-.macro WLV Offs
- lwz r0, (\Offs*4)(r5)
- stwux r0, r7, r4
-.endm
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-loop_filter_simple_vertical_edge_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- ;# build constants
- lvx v8, 0, r5 ;# flimit
-
- vspltisb v11, 8
- vspltisb v12, 4
- vslb v11, v11, v12 ;# 0x80808080808080808080808080808080
-
- la r5, -96(r1) ;# temporary space for reading in vectors
-
- ;# Store 4 pels at word "Offs" in temp array, then advance r7
- ;# to next row and read another 4 pels from the frame buffer.
-
- subi r7, r3, 2 ;# r7 -> 2 pels before start
- lwzx r0, 0, r7 ;# read first 4 pels
-
- ;# 16 unaligned word accesses
- RLV 0
- RLV 4
- RLV 8
- RLV 12
- RLV 1
- RLV 5
- RLV 9
- RLV 13
- RLV 2
- RLV 6
- RLV 10
- RLV 14
- RLV 3
- RLV 7
- RLV 11
-
- stw r0, (15*4)(r5) ;# write last 4 pels
-
- simple_vertical
-
- ;# Read temp array, write frame buffer.
- subi r7, r3, 2 ;# r7 -> 2 pels before start
- lwzx r0, 0, r5 ;# read/write first 4 pels
- stwx r0, 0, r7
-
- WLV 4
- WLV 8
- WLV 12
- WLV 1
- WLV 5
- WLV 9
- WLV 13
- WLV 2
- WLV 6
- WLV 10
- WLV 14
- WLV 3
- WLV 7
- WLV 11
- WLV 15
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .data
-
-_chromaSelectors:
- .long _B_hihi
- .long _B_Ures0
- .long _B_Vres0
- .long 0
- .long _B_lolo
- .long _B_Ures8
- .long _B_Vres8
- .long 0
-
- .align 4
-_B_Vres8:
- .byte 16, 17, 18, 19, 20, 21, 22, 23, 8, 9, 10, 11, 12, 13, 14, 15
-
- .align 4
-_B_Ures8:
- .byte 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7
-
- .align 4
-_B_lolo:
- .byte 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
-
- .align 4
-_B_Vres0:
- .byte 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
- .align 4
-_B_Ures0:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31
-
- .align 4
-_B_hihi:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/platform_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/platform_altivec.asm
deleted file mode 100644
index f81d86f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/platform_altivec.asm
+++ /dev/null
@@ -1,59 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl save_platform_context
- .globl restore_platform_context
-
-.macro W V P
- stvx \V, 0, \P
- addi \P, \P, 16
-.endm
-
-.macro R V P
- lvx \V, 0, \P
- addi \P, \P, 16
-.endm
-
-;# r3 context_ptr
- .align 2
-save_platform_contex:
- W v20, r3
- W v21, r3
- W v22, r3
- W v23, r3
- W v24, r3
- W v25, r3
- W v26, r3
- W v27, r3
- W v28, r3
- W v29, r3
- W v30, r3
- W v31, r3
-
- blr
-
-;# r3 context_ptr
- .align 2
-restore_platform_context:
- R v20, r3
- R v21, r3
- R v22, r3
- R v23, r3
- R v24, r3
- R v25, r3
- R v26, r3
- R v27, r3
- R v28, r3
- R v29, r3
- R v30, r3
- R v31, r3
-
- blr
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/recon_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/recon_altivec.asm
deleted file mode 100644
index dd39e05..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/recon_altivec.asm
+++ /dev/null
@@ -1,175 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl recon4b_ppc
- .globl recon2b_ppc
- .globl recon_b_ppc
-
-.macro row_of16 Diff Pred Dst Stride
- lvx v1, 0, \Pred ;# v1 = pred = p0..p15
- addi \Pred, \Pred, 16 ;# next pred
- vmrghb v2, v0, v1 ;# v2 = 16-bit p0..p7
- lvx v3, 0, \Diff ;# v3 = d0..d7
- vaddshs v2, v2, v3 ;# v2 = r0..r7
- vmrglb v1, v0, v1 ;# v1 = 16-bit p8..p15
- lvx v3, r8, \Diff ;# v3 = d8..d15
- addi \Diff, \Diff, 32 ;# next diff
- vaddshs v3, v3, v1 ;# v3 = r8..r15
- vpkshus v2, v2, v3 ;# v2 = 8-bit r0..r15
- stvx v2, 0, \Dst ;# to dst
- add \Dst, \Dst, \Stride ;# next dst
-.endm
-
- .text
- .align 2
-;# r3 = short *diff_ptr,
-;# r4 = unsigned char *pred_ptr,
-;# r5 = unsigned char *dst_ptr,
-;# r6 = int stride
-recon4b_ppc:
- mfspr r0, 256 ;# get old VRSAVE
- stw r0, -8(r1) ;# save old VRSAVE to stack
- oris r0, r0, 0xf000
- mtspr 256,r0 ;# set VRSAVE
-
- vxor v0, v0, v0
- li r8, 16
-
- row_of16 r3, r4, r5, r6
- row_of16 r3, r4, r5, r6
- row_of16 r3, r4, r5, r6
- row_of16 r3, r4, r5, r6
-
- lwz r12, -8(r1) ;# restore old VRSAVE from stack
- mtspr 256, r12 ;# reset old VRSAVE
-
- blr
-
-.macro two_rows_of8 Diff Pred Dst Stride write_first_four_pels
- lvx v1, 0, \Pred ;# v1 = pred = p0..p15
- vmrghb v2, v0, v1 ;# v2 = 16-bit p0..p7
- lvx v3, 0, \Diff ;# v3 = d0..d7
- vaddshs v2, v2, v3 ;# v2 = r0..r7
- vmrglb v1, v0, v1 ;# v1 = 16-bit p8..p15
- lvx v3, r8, \Diff ;# v2 = d8..d15
- vaddshs v3, v3, v1 ;# v3 = r8..r15
- vpkshus v2, v2, v3 ;# v3 = 8-bit r0..r15
- stvx v2, 0, r10 ;# 2 rows to dst from buf
- lwz r0, 0(r10)
-.if \write_first_four_pels
- stw r0, 0(\Dst)
- .else
- stwux r0, \Dst, \Stride
-.endif
- lwz r0, 4(r10)
- stw r0, 4(\Dst)
- lwz r0, 8(r10)
- stwux r0, \Dst, \Stride ;# advance dst to next row
- lwz r0, 12(r10)
- stw r0, 4(\Dst)
-.endm
-
- .align 2
-;# r3 = short *diff_ptr,
-;# r4 = unsigned char *pred_ptr,
-;# r5 = unsigned char *dst_ptr,
-;# r6 = int stride
-
-recon2b_ppc:
- mfspr r0, 256 ;# get old VRSAVE
- stw r0, -8(r1) ;# save old VRSAVE to stack
- oris r0, r0, 0xf000
- mtspr 256,r0 ;# set VRSAVE
-
- vxor v0, v0, v0
- li r8, 16
-
- la r10, -48(r1) ;# buf
-
- two_rows_of8 r3, r4, r5, r6, 1
-
- addi r4, r4, 16; ;# next pred
- addi r3, r3, 32; ;# next diff
-
- two_rows_of8 r3, r4, r5, r6, 0
-
- lwz r12, -8(r1) ;# restore old VRSAVE from stack
- mtspr 256, r12 ;# reset old VRSAVE
-
- blr
-
-.macro get_two_diff_rows
- stw r0, 0(r10)
- lwz r0, 4(r3)
- stw r0, 4(r10)
- lwzu r0, 32(r3)
- stw r0, 8(r10)
- lwz r0, 4(r3)
- stw r0, 12(r10)
- lvx v3, 0, r10
-.endm
-
- .align 2
-;# r3 = short *diff_ptr,
-;# r4 = unsigned char *pred_ptr,
-;# r5 = unsigned char *dst_ptr,
-;# r6 = int stride
-recon_b_ppc:
- mfspr r0, 256 ;# get old VRSAVE
- stw r0, -8(r1) ;# save old VRSAVE to stack
- oris r0, r0, 0xf000
- mtspr 256,r0 ;# set VRSAVE
-
- vxor v0, v0, v0
-
- la r10, -48(r1) ;# buf
-
- lwz r0, 0(r4)
- stw r0, 0(r10)
- lwz r0, 16(r4)
- stw r0, 4(r10)
- lwz r0, 32(r4)
- stw r0, 8(r10)
- lwz r0, 48(r4)
- stw r0, 12(r10)
-
- lvx v1, 0, r10; ;# v1 = pred = p0..p15
-
- lwz r0, 0(r3) ;# v3 = d0..d7
-
- get_two_diff_rows
-
- vmrghb v2, v0, v1; ;# v2 = 16-bit p0..p7
- vaddshs v2, v2, v3; ;# v2 = r0..r7
-
- lwzu r0, 32(r3) ;# v3 = d8..d15
-
- get_two_diff_rows
-
- vmrglb v1, v0, v1; ;# v1 = 16-bit p8..p15
- vaddshs v3, v3, v1; ;# v3 = r8..r15
-
- vpkshus v2, v2, v3; ;# v2 = 8-bit r0..r15
- stvx v2, 0, r10; ;# 16 pels to dst from buf
-
- lwz r0, 0(r10)
- stw r0, 0(r5)
- lwz r0, 4(r10)
- stwux r0, r5, r6
- lwz r0, 8(r10)
- stwux r0, r5, r6
- lwz r0, 12(r10)
- stwx r0, r5, r6
-
- lwz r12, -8(r1) ;# restore old VRSAVE from stack
- mtspr 256, r12 ;# reset old VRSAVE
-
- blr
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/sad_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/sad_altivec.asm
deleted file mode 100644
index e5f2638..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/sad_altivec.asm
+++ /dev/null
@@ -1,277 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl vp8_sad16x16_ppc
- .globl vp8_sad16x8_ppc
- .globl vp8_sad8x16_ppc
- .globl vp8_sad8x8_ppc
- .globl vp8_sad4x4_ppc
-
-.macro load_aligned_16 V R O
- lvsl v3, 0, \R ;# permutate value for alignment
-
- lvx v1, 0, \R
- lvx v2, \O, \R
-
- vperm \V, v1, v2, v3
-.endm
-
-.macro prologue
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1, -32(r1) ;# create space on the stack
-
- li r10, 16 ;# load offset and loop counter
-
- vspltisw v8, 0 ;# zero out total to start
-.endm
-
-.macro epilogue
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-.endm
-
-.macro SAD_16
- ;# v6 = abs (v4 - v5)
- vsububs v6, v4, v5
- vsububs v7, v5, v4
- vor v6, v6, v7
-
- ;# v8 += abs (v4 - v5)
- vsum4ubs v8, v6, v8
-.endm
-
-.macro sad_16_loop loop_label
- lvsl v3, 0, r5 ;# only needs to be done once per block
-
- ;# preload a line of data before getting into the loop
- lvx v4, 0, r3
- lvx v1, 0, r5
- lvx v2, r10, r5
-
- add r5, r5, r6
- add r3, r3, r4
-
- vperm v5, v1, v2, v3
-
- .align 4
-\loop_label:
- ;# compute difference on first row
- vsububs v6, v4, v5
- vsububs v7, v5, v4
-
- ;# load up next set of data
- lvx v9, 0, r3
- lvx v1, 0, r5
- lvx v2, r10, r5
-
- ;# perform abs() of difference
- vor v6, v6, v7
- add r3, r3, r4
-
- ;# add to the running tally
- vsum4ubs v8, v6, v8
-
- ;# now onto the next line
- vperm v5, v1, v2, v3
- add r5, r5, r6
- lvx v4, 0, r3
-
- ;# compute difference on second row
- vsububs v6, v9, v5
- lvx v1, 0, r5
- vsububs v7, v5, v9
- lvx v2, r10, r5
- vor v6, v6, v7
- add r3, r3, r4
- vsum4ubs v8, v6, v8
- vperm v5, v1, v2, v3
- add r5, r5, r6
-
- bdnz \loop_label
-
- vspltisw v7, 0
-
- vsumsws v8, v8, v7
-
- stvx v8, 0, r1
- lwz r3, 12(r1)
-.endm
-
-.macro sad_8_loop loop_label
- .align 4
-\loop_label:
- ;# only one of the inputs should need to be aligned.
- load_aligned_16 v4, r3, r10
- load_aligned_16 v5, r5, r10
-
- ;# move onto the next line
- add r3, r3, r4
- add r5, r5, r6
-
- ;# only one of the inputs should need to be aligned.
- load_aligned_16 v6, r3, r10
- load_aligned_16 v7, r5, r10
-
- ;# move onto the next line
- add r3, r3, r4
- add r5, r5, r6
-
- vmrghb v4, v4, v6
- vmrghb v5, v5, v7
-
- SAD_16
-
- bdnz \loop_label
-
- vspltisw v7, 0
-
- vsumsws v8, v8, v7
-
- stvx v8, 0, r1
- lwz r3, 12(r1)
-.endm
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int ref_stride
-;#
-;# r3 return value
-vp8_sad16x16_ppc:
-
- prologue
-
- li r9, 8
- mtctr r9
-
- sad_16_loop sad16x16_loop
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int ref_stride
-;#
-;# r3 return value
-vp8_sad16x8_ppc:
-
- prologue
-
- li r9, 4
- mtctr r9
-
- sad_16_loop sad16x8_loop
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int ref_stride
-;#
-;# r3 return value
-vp8_sad8x16_ppc:
-
- prologue
-
- li r9, 8
- mtctr r9
-
- sad_8_loop sad8x16_loop
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int ref_stride
-;#
-;# r3 return value
-vp8_sad8x8_ppc:
-
- prologue
-
- li r9, 4
- mtctr r9
-
- sad_8_loop sad8x8_loop
-
- epilogue
-
- blr
-
-.macro transfer_4x4 I P
- lwz r0, 0(\I)
- add \I, \I, \P
-
- lwz r7, 0(\I)
- add \I, \I, \P
-
- lwz r8, 0(\I)
- add \I, \I, \P
-
- lwz r9, 0(\I)
-
- stw r0, 0(r1)
- stw r7, 4(r1)
- stw r8, 8(r1)
- stw r9, 12(r1)
-.endm
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int ref_stride
-;#
-;# r3 return value
-vp8_sad4x4_ppc:
-
- prologue
-
- transfer_4x4 r3, r4
- lvx v4, 0, r1
-
- transfer_4x4 r5, r6
- lvx v5, 0, r1
-
- vspltisw v8, 0 ;# zero out total to start
-
- ;# v6 = abs (v4 - v5)
- vsububs v6, v4, v5
- vsububs v7, v5, v4
- vor v6, v6, v7
-
- ;# v8 += abs (v4 - v5)
- vsum4ubs v7, v6, v8
- vsumsws v7, v7, v8
-
- stvx v7, 0, r1
- lwz r3, 12(r1)
-
- epilogue
-
- blr
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/systemdependent.c b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/systemdependent.c
deleted file mode 100644
index 6899c0e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/systemdependent.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "subpixel.h"
-#include "loopfilter.h"
-#include "recon.h"
-#include "onyxc_int.h"
-
-extern void (*vp8_post_proc_down_and_across_mb_row)(
- unsigned char *src_ptr,
- unsigned char *dst_ptr,
- int src_pixels_per_line,
- int dst_pixels_per_line,
- int cols,
- unsigned char *f,
- int size
-);
-
-extern void (*vp8_mbpost_proc_down)(unsigned char *dst, int pitch, int rows, int cols, int flimit);
-extern void vp8_mbpost_proc_down_c(unsigned char *dst, int pitch, int rows, int cols, int flimit);
-extern void (*vp8_mbpost_proc_across_ip)(unsigned char *src, int pitch, int rows, int cols, int flimit);
-extern void vp8_mbpost_proc_across_ip_c(unsigned char *src, int pitch, int rows, int cols, int flimit);
-
-extern void vp8_post_proc_down_and_across_mb_row_c
-(
- unsigned char *src_ptr,
- unsigned char *dst_ptr,
- int src_pixels_per_line,
- int dst_pixels_per_line,
- int cols,
- unsigned char *f,
- int size
-);
-void vp8_plane_add_noise_c(unsigned char *Start, unsigned int Width, unsigned int Height, int Pitch, int q, int a);
-
-extern copy_mem_block_function *vp8_copy_mem16x16;
-extern copy_mem_block_function *vp8_copy_mem8x8;
-extern copy_mem_block_function *vp8_copy_mem8x4;
-
-// PPC
-extern subpixel_predict_function sixtap_predict_ppc;
-extern subpixel_predict_function sixtap_predict8x4_ppc;
-extern subpixel_predict_function sixtap_predict8x8_ppc;
-extern subpixel_predict_function sixtap_predict16x16_ppc;
-extern subpixel_predict_function bilinear_predict4x4_ppc;
-extern subpixel_predict_function bilinear_predict8x4_ppc;
-extern subpixel_predict_function bilinear_predict8x8_ppc;
-extern subpixel_predict_function bilinear_predict16x16_ppc;
-
-extern copy_mem_block_function copy_mem16x16_ppc;
-
-void recon_b_ppc(short *diff_ptr, unsigned char *pred_ptr, unsigned char *dst_ptr, int stride);
-void recon2b_ppc(short *diff_ptr, unsigned char *pred_ptr, unsigned char *dst_ptr, int stride);
-void recon4b_ppc(short *diff_ptr, unsigned char *pred_ptr, unsigned char *dst_ptr, int stride);
-
-extern void short_idct4x4llm_ppc(short *input, short *output, int pitch);
-
-// Generic C
-extern subpixel_predict_function vp8_sixtap_predict_c;
-extern subpixel_predict_function vp8_sixtap_predict8x4_c;
-extern subpixel_predict_function vp8_sixtap_predict8x8_c;
-extern subpixel_predict_function vp8_sixtap_predict16x16_c;
-extern subpixel_predict_function vp8_bilinear_predict4x4_c;
-extern subpixel_predict_function vp8_bilinear_predict8x4_c;
-extern subpixel_predict_function vp8_bilinear_predict8x8_c;
-extern subpixel_predict_function vp8_bilinear_predict16x16_c;
-
-extern copy_mem_block_function vp8_copy_mem16x16_c;
-extern copy_mem_block_function vp8_copy_mem8x8_c;
-extern copy_mem_block_function vp8_copy_mem8x4_c;
-
-void vp8_recon_b_c(short *diff_ptr, unsigned char *pred_ptr, unsigned char *dst_ptr, int stride);
-void vp8_recon2b_c(short *diff_ptr, unsigned char *pred_ptr, unsigned char *dst_ptr, int stride);
-void vp8_recon4b_c(short *diff_ptr, unsigned char *pred_ptr, unsigned char *dst_ptr, int stride);
-
-extern void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch);
-extern void vp8_short_idct4x4llm_c(short *input, short *output, int pitch);
-extern void vp8_dc_only_idct_c(short input_dc, short *output, int pitch);
-
-// PPC
-extern loop_filter_block_function loop_filter_mbv_ppc;
-extern loop_filter_block_function loop_filter_bv_ppc;
-extern loop_filter_block_function loop_filter_mbh_ppc;
-extern loop_filter_block_function loop_filter_bh_ppc;
-
-extern loop_filter_block_function loop_filter_mbvs_ppc;
-extern loop_filter_block_function loop_filter_bvs_ppc;
-extern loop_filter_block_function loop_filter_mbhs_ppc;
-extern loop_filter_block_function loop_filter_bhs_ppc;
-
-// Generic C
-extern loop_filter_block_function vp8_loop_filter_mbv_c;
-extern loop_filter_block_function vp8_loop_filter_bv_c;
-extern loop_filter_block_function vp8_loop_filter_mbh_c;
-extern loop_filter_block_function vp8_loop_filter_bh_c;
-
-extern loop_filter_block_function vp8_loop_filter_mbvs_c;
-extern loop_filter_block_function vp8_loop_filter_bvs_c;
-extern loop_filter_block_function vp8_loop_filter_mbhs_c;
-extern loop_filter_block_function vp8_loop_filter_bhs_c;
-
-extern loop_filter_block_function *vp8_lf_mbvfull;
-extern loop_filter_block_function *vp8_lf_mbhfull;
-extern loop_filter_block_function *vp8_lf_bvfull;
-extern loop_filter_block_function *vp8_lf_bhfull;
-
-extern loop_filter_block_function *vp8_lf_mbvsimple;
-extern loop_filter_block_function *vp8_lf_mbhsimple;
-extern loop_filter_block_function *vp8_lf_bvsimple;
-extern loop_filter_block_function *vp8_lf_bhsimple;
-
-void vp8_clear_c(void)
-{
-}
-
-void vp8_machine_specific_config(void)
-{
- // Pure C:
- vp8_clear_system_state = vp8_clear_c;
- vp8_recon_b = vp8_recon_b_c;
- vp8_recon4b = vp8_recon4b_c;
- vp8_recon2b = vp8_recon2b_c;
-
- vp8_bilinear_predict16x16 = bilinear_predict16x16_ppc;
- vp8_bilinear_predict8x8 = bilinear_predict8x8_ppc;
- vp8_bilinear_predict8x4 = bilinear_predict8x4_ppc;
- vp8_bilinear_predict = bilinear_predict4x4_ppc;
-
- vp8_sixtap_predict16x16 = sixtap_predict16x16_ppc;
- vp8_sixtap_predict8x8 = sixtap_predict8x8_ppc;
- vp8_sixtap_predict8x4 = sixtap_predict8x4_ppc;
- vp8_sixtap_predict = sixtap_predict_ppc;
-
- vp8_short_idct4x4_1 = vp8_short_idct4x4llm_1_c;
- vp8_short_idct4x4 = short_idct4x4llm_ppc;
- vp8_dc_only_idct = vp8_dc_only_idct_c;
-
- vp8_lf_mbvfull = loop_filter_mbv_ppc;
- vp8_lf_bvfull = loop_filter_bv_ppc;
- vp8_lf_mbhfull = loop_filter_mbh_ppc;
- vp8_lf_bhfull = loop_filter_bh_ppc;
-
- vp8_lf_mbvsimple = loop_filter_mbvs_ppc;
- vp8_lf_bvsimple = loop_filter_bvs_ppc;
- vp8_lf_mbhsimple = loop_filter_mbhs_ppc;
- vp8_lf_bhsimple = loop_filter_bhs_ppc;
-
- vp8_post_proc_down_and_across_mb_row = vp8_post_proc_down_and_across_mb_row_c;
- vp8_mbpost_proc_down = vp8_mbpost_proc_down_c;
- vp8_mbpost_proc_across_ip = vp8_mbpost_proc_across_ip_c;
- vp8_plane_add_noise = vp8_plane_add_noise_c;
-
- vp8_copy_mem16x16 = copy_mem16x16_ppc;
- vp8_copy_mem8x8 = vp8_copy_mem8x8_c;
- vp8_copy_mem8x4 = vp8_copy_mem8x4_c;
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_altivec.asm
deleted file mode 100644
index fb8d5bb..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_altivec.asm
+++ /dev/null
@@ -1,375 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl vp8_get8x8var_ppc
- .globl vp8_get16x16var_ppc
- .globl vp8_mse16x16_ppc
- .globl vp8_variance16x16_ppc
- .globl vp8_variance16x8_ppc
- .globl vp8_variance8x16_ppc
- .globl vp8_variance8x8_ppc
- .globl vp8_variance4x4_ppc
-
-.macro load_aligned_16 V R O
- lvsl v3, 0, \R ;# permutate value for alignment
-
- lvx v1, 0, \R
- lvx v2, \O, \R
-
- vperm \V, v1, v2, v3
-.endm
-
-.macro prologue
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1, -32(r1) ;# create space on the stack
-
- li r10, 16 ;# load offset and loop counter
-
- vspltisw v7, 0 ;# zero for merging
- vspltisw v8, 0 ;# zero out total to start
- vspltisw v9, 0 ;# zero out total for dif^2
-.endm
-
-.macro epilogue
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-.endm
-
-.macro compute_sum_sse
- ;# Compute sum first. Unpack to so signed subract
- ;# can be used. Only have a half word signed
- ;# subract. Do high, then low.
- vmrghb v2, v7, v4
- vmrghb v3, v7, v5
- vsubshs v2, v2, v3
- vsum4shs v8, v2, v8
-
- vmrglb v2, v7, v4
- vmrglb v3, v7, v5
- vsubshs v2, v2, v3
- vsum4shs v8, v2, v8
-
- ;# Now compute sse.
- vsububs v2, v4, v5
- vsububs v3, v5, v4
- vor v2, v2, v3
-
- vmsumubm v9, v2, v2, v9
-.endm
-
-.macro variance_16 DS loop_label store_sum
-\loop_label:
- ;# only one of the inputs should need to be aligned.
- load_aligned_16 v4, r3, r10
- load_aligned_16 v5, r5, r10
-
- ;# move onto the next line
- add r3, r3, r4
- add r5, r5, r6
-
- compute_sum_sse
-
- bdnz \loop_label
-
- vsumsws v8, v8, v7
- vsumsws v9, v9, v7
-
- stvx v8, 0, r1
- lwz r3, 12(r1)
-
- stvx v9, 0, r1
- lwz r4, 12(r1)
-
-.if \store_sum
- stw r3, 0(r8) ;# sum
-.endif
- stw r4, 0(r7) ;# sse
-
- mullw r3, r3, r3 ;# sum*sum
- srlwi r3, r3, \DS ;# (sum*sum) >> DS
- subf r3, r3, r4 ;# sse - ((sum*sum) >> DS)
-.endm
-
-.macro variance_8 DS loop_label store_sum
-\loop_label:
- ;# only one of the inputs should need to be aligned.
- load_aligned_16 v4, r3, r10
- load_aligned_16 v5, r5, r10
-
- ;# move onto the next line
- add r3, r3, r4
- add r5, r5, r6
-
- ;# only one of the inputs should need to be aligned.
- load_aligned_16 v6, r3, r10
- load_aligned_16 v0, r5, r10
-
- ;# move onto the next line
- add r3, r3, r4
- add r5, r5, r6
-
- vmrghb v4, v4, v6
- vmrghb v5, v5, v0
-
- compute_sum_sse
-
- bdnz \loop_label
-
- vsumsws v8, v8, v7
- vsumsws v9, v9, v7
-
- stvx v8, 0, r1
- lwz r3, 12(r1)
-
- stvx v9, 0, r1
- lwz r4, 12(r1)
-
-.if \store_sum
- stw r3, 0(r8) ;# sum
-.endif
- stw r4, 0(r7) ;# sse
-
- mullw r3, r3, r3 ;# sum*sum
- srlwi r3, r3, \DS ;# (sum*sum) >> 8
- subf r3, r3, r4 ;# sse - ((sum*sum) >> 8)
-.endm
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *SSE
-;# r8 int *Sum
-;#
-;# r3 return value
-vp8_get8x8var_ppc:
-
- prologue
-
- li r9, 4
- mtctr r9
-
- variance_8 6, get8x8var_loop, 1
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *SSE
-;# r8 int *Sum
-;#
-;# r3 return value
-vp8_get16x16var_ppc:
-
- prologue
-
- mtctr r10
-
- variance_16 8, get16x16var_loop, 1
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *sse
-;#
-;# r 3 return value
-vp8_mse16x16_ppc:
- prologue
-
- mtctr r10
-
-mse16x16_loop:
- ;# only one of the inputs should need to be aligned.
- load_aligned_16 v4, r3, r10
- load_aligned_16 v5, r5, r10
-
- ;# move onto the next line
- add r3, r3, r4
- add r5, r5, r6
-
- ;# Now compute sse.
- vsububs v2, v4, v5
- vsububs v3, v5, v4
- vor v2, v2, v3
-
- vmsumubm v9, v2, v2, v9
-
- bdnz mse16x16_loop
-
- vsumsws v9, v9, v7
-
- stvx v9, 0, r1
- lwz r3, 12(r1)
-
- stvx v9, 0, r1
- lwz r3, 12(r1)
-
- stw r3, 0(r7) ;# sse
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *sse
-;#
-;# r3 return value
-vp8_variance16x16_ppc:
-
- prologue
-
- mtctr r10
-
- variance_16 8, variance16x16_loop, 0
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *sse
-;#
-;# r3 return value
-vp8_variance16x8_ppc:
-
- prologue
-
- li r9, 8
- mtctr r9
-
- variance_16 7, variance16x8_loop, 0
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *sse
-;#
-;# r3 return value
-vp8_variance8x16_ppc:
-
- prologue
-
- li r9, 8
- mtctr r9
-
- variance_8 7, variance8x16_loop, 0
-
- epilogue
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *sse
-;#
-;# r3 return value
-vp8_variance8x8_ppc:
-
- prologue
-
- li r9, 4
- mtctr r9
-
- variance_8 6, variance8x8_loop, 0
-
- epilogue
-
- blr
-
-.macro transfer_4x4 I P
- lwz r0, 0(\I)
- add \I, \I, \P
-
- lwz r10,0(\I)
- add \I, \I, \P
-
- lwz r8, 0(\I)
- add \I, \I, \P
-
- lwz r9, 0(\I)
-
- stw r0, 0(r1)
- stw r10, 4(r1)
- stw r8, 8(r1)
- stw r9, 12(r1)
-.endm
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int source_stride
-;# r5 unsigned char *ref_ptr
-;# r6 int recon_stride
-;# r7 unsigned int *sse
-;#
-;# r3 return value
-vp8_variance4x4_ppc:
-
- prologue
-
- transfer_4x4 r3, r4
- lvx v4, 0, r1
-
- transfer_4x4 r5, r6
- lvx v5, 0, r1
-
- compute_sum_sse
-
- vsumsws v8, v8, v7
- vsumsws v9, v9, v7
-
- stvx v8, 0, r1
- lwz r3, 12(r1)
-
- stvx v9, 0, r1
- lwz r4, 12(r1)
-
- stw r4, 0(r7) ;# sse
-
- mullw r3, r3, r3 ;# sum*sum
- srlwi r3, r3, 4 ;# (sum*sum) >> 4
- subf r3, r3, r4 ;# sse - ((sum*sum) >> 4)
-
- epilogue
-
- blr
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_subpixel_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_subpixel_altivec.asm
deleted file mode 100644
index 2308373..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppc/variance_subpixel_altivec.asm
+++ /dev/null
@@ -1,865 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl vp8_sub_pixel_variance4x4_ppc
- .globl vp8_sub_pixel_variance8x8_ppc
- .globl vp8_sub_pixel_variance8x16_ppc
- .globl vp8_sub_pixel_variance16x8_ppc
- .globl vp8_sub_pixel_variance16x16_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-.macro load_vfilter V0, V1
- load_c \V0, vfilter_b, r6, r12, r10
-
- addi r6, r6, 16
- lvx \V1, r6, r10
-.endm
-
-.macro HProlog jump_label
- ;# load up horizontal filter
- slwi. r5, r5, 4 ;# index into horizontal filter array
-
- ;# index to the next set of vectors in the row.
- li r10, 16
-
- ;# downshift by 7 ( divide by 128 ) at the end
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq \jump_label
-
- load_c v20, hfilter_b, r5, r12, r0
-
- ;# setup constants
- ;# v14 permutation value for alignment
- load_c v28, b_hperm_b, 0, r12, r0
-
- ;# index to the next set of vectors in the row.
- li r12, 32
-
- ;# rounding added in on the multiply
- vspltisw v21, 8
- vspltisw v18, 3
- vslw v18, v21, v18 ;# 0x00000040000000400000004000000040
-
- slwi. r6, r6, 5 ;# index into vertical filter array
-.endm
-
-;# Filters a horizontal line
-;# expects:
-;# r3 src_ptr
-;# r4 pitch
-;# r10 16
-;# r12 32
-;# v17 perm intput
-;# v18 rounding
-;# v19 shift
-;# v20 filter taps
-;# v21 tmp
-;# v22 tmp
-;# v23 tmp
-;# v24 tmp
-;# v25 tmp
-;# v26 tmp
-;# v27 tmp
-;# v28 perm output
-;#
-
-.macro hfilter_8 V, hp, lp, increment_counter
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 9 bytes wide, output is 8 bytes.
- lvx v21, 0, r3
- lvx v22, r10, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
- vperm v21, v21, v22, v17
-
- vperm v24, v21, v21, \hp ;# v20 = 0123 1234 2345 3456
- vperm v25, v21, v21, \lp ;# v21 = 4567 5678 6789 789A
-
- vmsummbm v24, v20, v24, v18
- vmsummbm v25, v20, v25, v18
-
- vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
-
- vsrh v24, v24, v19 ;# divide v0, v1 by 128
-
- vpkuhus \V, v24, v24 ;# \V = scrambled 8-bit result
-.endm
-
-.macro vfilter_16 P0 P1
- vmuleub v22, \P0, v20 ;# 64 + 4 positive taps
- vadduhm v22, v18, v22
- vmuloub v23, \P0, v20
- vadduhm v23, v18, v23
-
- vmuleub v24, \P1, v21
- vadduhm v22, v22, v24 ;# Re = evens, saturation unnecessary
- vmuloub v25, \P1, v21
- vadduhm v23, v23, v25 ;# Ro = odds
-
- vsrh v22, v22, v19 ;# divide by 128
- vsrh v23, v23, v19 ;# v16 v17 = evens, odds
- vmrghh \P0, v22, v23 ;# v18 v19 = 16-bit result in order
- vmrglh v23, v22, v23
- vpkuhus \P0, \P0, v23 ;# P0 = 8-bit result
-.endm
-
-.macro compute_sum_sse src, ref, sum, sse, t1, t2, z0
- ;# Compute sum first. Unpack to so signed subract
- ;# can be used. Only have a half word signed
- ;# subract. Do high, then low.
- vmrghb \t1, \z0, \src
- vmrghb \t2, \z0, \ref
- vsubshs \t1, \t1, \t2
- vsum4shs \sum, \t1, \sum
-
- vmrglb \t1, \z0, \src
- vmrglb \t2, \z0, \ref
- vsubshs \t1, \t1, \t2
- vsum4shs \sum, \t1, \sum
-
- ;# Now compute sse.
- vsububs \t1, \src, \ref
- vsububs \t2, \ref, \src
- vor \t1, \t1, \t2
-
- vmsumubm \sse, \t1, \t1, \sse
-.endm
-
-.macro variance_final sum, sse, z0, DS
- vsumsws \sum, \sum, \z0
- vsumsws \sse, \sse, \z0
-
- stvx \sum, 0, r1
- lwz r3, 12(r1)
-
- stvx \sse, 0, r1
- lwz r4, 12(r1)
-
- stw r4, 0(r9) ;# sse
-
- mullw r3, r3, r3 ;# sum*sum
- srlwi r3, r3, \DS ;# (sum*sum) >> 8
- subf r3, r3, r4 ;# sse - ((sum*sum) >> 8)
-.endm
-
-.macro compute_sum_sse_16 V, increment_counter
- load_and_align_16 v16, r7, r8, \increment_counter
- compute_sum_sse \V, v16, v18, v19, v20, v21, v23
-.endm
-
-.macro load_and_align_16 V, R, P, increment_counter
- lvsl v17, 0, \R ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, \R
- lvx v22, r10, \R
-
-.if \increment_counter
- add \R, \R, \P
-.endif
-
- vperm \V, v21, v22, v17
-.endm
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_pixels_per_line
-;# r5 int xoffset
-;# r6 int yoffset
-;# r7 unsigned char *dst_ptr
-;# r8 int dst_pixels_per_line
-;# r9 unsigned int *sse
-;#
-;# r3 return value
-vp8_sub_pixel_variance4x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf830
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_4x4_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r12, r0
- load_c v11, b_4567_b, 0, r12, r0
-
- hfilter_8 v0, v10, v11, 1
- hfilter_8 v1, v10, v11, 1
- hfilter_8 v2, v10, v11, 1
- hfilter_8 v3, v10, v11, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq compute_sum_sse_4x4_b
-
- hfilter_8 v4, v10, v11, 0
-
- b second_pass_4x4_b
-
-second_pass_4x4_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_16 v0, r3, r4, 1
- load_and_align_16 v1, r3, r4, 1
- load_and_align_16 v2, r3, r4, 1
- load_and_align_16 v3, r3, r4, 1
- load_and_align_16 v4, r3, r4, 0
-
-second_pass_4x4_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
-
-compute_sum_sse_4x4_b:
- vspltish v18, 0 ;# sum
- vspltish v19, 0 ;# sse
- vspltish v23, 0 ;# unpack
- li r10, 16
-
- load_and_align_16 v4, r7, r8, 1
- load_and_align_16 v5, r7, r8, 1
- load_and_align_16 v6, r7, r8, 1
- load_and_align_16 v7, r7, r8, 1
-
- vmrghb v0, v0, v1
- vmrghb v1, v2, v3
-
- vmrghb v2, v4, v5
- vmrghb v3, v6, v7
-
- load_c v10, b_hilo_b, 0, r12, r0
-
- vperm v0, v0, v1, v10
- vperm v1, v2, v3, v10
-
- compute_sum_sse v0, v1, v18, v19, v20, v21, v23
-
- variance_final v18, v19, v23, 4
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_pixels_per_line
-;# r5 int xoffset
-;# r6 int yoffset
-;# r7 unsigned char *dst_ptr
-;# r8 int dst_pixels_per_line
-;# r9 unsigned int *sse
-;#
-;# r3 return value
-vp8_sub_pixel_variance8x8_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xfff0
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_8x8_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r12, r0
- load_c v11, b_4567_b, 0, r12, r0
-
- hfilter_8 v0, v10, v11, 1
- hfilter_8 v1, v10, v11, 1
- hfilter_8 v2, v10, v11, 1
- hfilter_8 v3, v10, v11, 1
- hfilter_8 v4, v10, v11, 1
- hfilter_8 v5, v10, v11, 1
- hfilter_8 v6, v10, v11, 1
- hfilter_8 v7, v10, v11, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq compute_sum_sse_8x8_b
-
- hfilter_8 v8, v10, v11, 0
-
- b second_pass_8x8_b
-
-second_pass_8x8_pre_copy_b:
- slwi. r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_16 v0, r3, r4, 1
- load_and_align_16 v1, r3, r4, 1
- load_and_align_16 v2, r3, r4, 1
- load_and_align_16 v3, r3, r4, 1
- load_and_align_16 v4, r3, r4, 1
- load_and_align_16 v5, r3, r4, 1
- load_and_align_16 v6, r3, r4, 1
- load_and_align_16 v7, r3, r4, 1
- load_and_align_16 v8, r3, r4, 0
-
- beq compute_sum_sse_8x8_b
-
-second_pass_8x8_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
-
-compute_sum_sse_8x8_b:
- vspltish v18, 0 ;# sum
- vspltish v19, 0 ;# sse
- vspltish v23, 0 ;# unpack
- li r10, 16
-
- vmrghb v0, v0, v1
- vmrghb v1, v2, v3
- vmrghb v2, v4, v5
- vmrghb v3, v6, v7
-
- load_and_align_16 v4, r7, r8, 1
- load_and_align_16 v5, r7, r8, 1
- load_and_align_16 v6, r7, r8, 1
- load_and_align_16 v7, r7, r8, 1
- load_and_align_16 v8, r7, r8, 1
- load_and_align_16 v9, r7, r8, 1
- load_and_align_16 v10, r7, r8, 1
- load_and_align_16 v11, r7, r8, 0
-
- vmrghb v4, v4, v5
- vmrghb v5, v6, v7
- vmrghb v6, v8, v9
- vmrghb v7, v10, v11
-
- compute_sum_sse v0, v4, v18, v19, v20, v21, v23
- compute_sum_sse v1, v5, v18, v19, v20, v21, v23
- compute_sum_sse v2, v6, v18, v19, v20, v21, v23
- compute_sum_sse v3, v7, v18, v19, v20, v21, v23
-
- variance_final v18, v19, v23, 6
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_pixels_per_line
-;# r5 int xoffset
-;# r6 int yoffset
-;# r7 unsigned char *dst_ptr
-;# r8 int dst_pixels_per_line
-;# r9 unsigned int *sse
-;#
-;# r3 return value
-vp8_sub_pixel_variance8x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xfffc
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_8x16_pre_copy_b
-
- ;# Load up permutation constants
- load_c v29, b_0123_b, 0, r12, r0
- load_c v30, b_4567_b, 0, r12, r0
-
- hfilter_8 v0, v29, v30, 1
- hfilter_8 v1, v29, v30, 1
- hfilter_8 v2, v29, v30, 1
- hfilter_8 v3, v29, v30, 1
- hfilter_8 v4, v29, v30, 1
- hfilter_8 v5, v29, v30, 1
- hfilter_8 v6, v29, v30, 1
- hfilter_8 v7, v29, v30, 1
- hfilter_8 v8, v29, v30, 1
- hfilter_8 v9, v29, v30, 1
- hfilter_8 v10, v29, v30, 1
- hfilter_8 v11, v29, v30, 1
- hfilter_8 v12, v29, v30, 1
- hfilter_8 v13, v29, v30, 1
- hfilter_8 v14, v29, v30, 1
- hfilter_8 v15, v29, v30, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq compute_sum_sse_8x16_b
-
- hfilter_8 v16, v29, v30, 0
-
- b second_pass_8x16_b
-
-second_pass_8x16_pre_copy_b:
- slwi. r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_16 v0, r3, r4, 1
- load_and_align_16 v1, r3, r4, 1
- load_and_align_16 v2, r3, r4, 1
- load_and_align_16 v3, r3, r4, 1
- load_and_align_16 v4, r3, r4, 1
- load_and_align_16 v5, r3, r4, 1
- load_and_align_16 v6, r3, r4, 1
- load_and_align_16 v7, r3, r4, 1
- load_and_align_16 v8, r3, r4, 1
- load_and_align_16 v9, r3, r4, 1
- load_and_align_16 v10, r3, r4, 1
- load_and_align_16 v11, r3, r4, 1
- load_and_align_16 v12, r3, r4, 1
- load_and_align_16 v13, r3, r4, 1
- load_and_align_16 v14, r3, r4, 1
- load_and_align_16 v15, r3, r4, 1
- load_and_align_16 v16, r3, r4, 0
-
- beq compute_sum_sse_8x16_b
-
-second_pass_8x16_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
- vfilter_16 v8, v9
- vfilter_16 v9, v10
- vfilter_16 v10, v11
- vfilter_16 v11, v12
- vfilter_16 v12, v13
- vfilter_16 v13, v14
- vfilter_16 v14, v15
- vfilter_16 v15, v16
-
-compute_sum_sse_8x16_b:
- vspltish v18, 0 ;# sum
- vspltish v19, 0 ;# sse
- vspltish v23, 0 ;# unpack
- li r10, 16
-
- vmrghb v0, v0, v1
- vmrghb v1, v2, v3
- vmrghb v2, v4, v5
- vmrghb v3, v6, v7
- vmrghb v4, v8, v9
- vmrghb v5, v10, v11
- vmrghb v6, v12, v13
- vmrghb v7, v14, v15
-
- load_and_align_16 v8, r7, r8, 1
- load_and_align_16 v9, r7, r8, 1
- load_and_align_16 v10, r7, r8, 1
- load_and_align_16 v11, r7, r8, 1
- load_and_align_16 v12, r7, r8, 1
- load_and_align_16 v13, r7, r8, 1
- load_and_align_16 v14, r7, r8, 1
- load_and_align_16 v15, r7, r8, 1
-
- vmrghb v8, v8, v9
- vmrghb v9, v10, v11
- vmrghb v10, v12, v13
- vmrghb v11, v14, v15
-
- compute_sum_sse v0, v8, v18, v19, v20, v21, v23
- compute_sum_sse v1, v9, v18, v19, v20, v21, v23
- compute_sum_sse v2, v10, v18, v19, v20, v21, v23
- compute_sum_sse v3, v11, v18, v19, v20, v21, v23
-
- load_and_align_16 v8, r7, r8, 1
- load_and_align_16 v9, r7, r8, 1
- load_and_align_16 v10, r7, r8, 1
- load_and_align_16 v11, r7, r8, 1
- load_and_align_16 v12, r7, r8, 1
- load_and_align_16 v13, r7, r8, 1
- load_and_align_16 v14, r7, r8, 1
- load_and_align_16 v15, r7, r8, 0
-
- vmrghb v8, v8, v9
- vmrghb v9, v10, v11
- vmrghb v10, v12, v13
- vmrghb v11, v14, v15
-
- compute_sum_sse v4, v8, v18, v19, v20, v21, v23
- compute_sum_sse v5, v9, v18, v19, v20, v21, v23
- compute_sum_sse v6, v10, v18, v19, v20, v21, v23
- compute_sum_sse v7, v11, v18, v19, v20, v21, v23
-
- variance_final v18, v19, v23, 7
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
- blr
-
-;# Filters a horizontal line
-;# expects:
-;# r3 src_ptr
-;# r4 pitch
-;# r10 16
-;# r12 32
-;# v17 perm intput
-;# v18 rounding
-;# v19 shift
-;# v20 filter taps
-;# v21 tmp
-;# v22 tmp
-;# v23 tmp
-;# v24 tmp
-;# v25 tmp
-;# v26 tmp
-;# v27 tmp
-;# v28 perm output
-;#
-.macro hfilter_16 V, increment_counter
-
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, r3
- lvx v22, r10, r3
- lvx v23, r12, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
- vperm v21, v21, v22, v17
- vperm v22, v22, v23, v17 ;# v8 v9 = 21 input pixels left-justified
-
- ;# set 0
- vmsummbm v24, v20, v21, v18 ;# taps times elements
-
- ;# set 1
- vsldoi v23, v21, v22, 1
- vmsummbm v25, v20, v23, v18
-
- ;# set 2
- vsldoi v23, v21, v22, 2
- vmsummbm v26, v20, v23, v18
-
- ;# set 3
- vsldoi v23, v21, v22, 3
- vmsummbm v27, v20, v23, v18
-
- vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
- vpkswus v25, v26, v27 ;# v25 = 2 6 A E 3 7 B F
-
- vsrh v24, v24, v19 ;# divide v0, v1 by 128
- vsrh v25, v25, v19
-
- vpkuhus \V, v24, v25 ;# \V = scrambled 8-bit result
- vperm \V, \V, v0, v28 ;# \V = correctly-ordered result
-.endm
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_pixels_per_line
-;# r5 int xoffset
-;# r6 int yoffset
-;# r7 unsigned char *dst_ptr
-;# r8 int dst_pixels_per_line
-;# r9 unsigned int *sse
-;#
-;# r3 return value
-vp8_sub_pixel_variance16x8_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1, -32(r1) ;# create space on the stack
-
- HProlog second_pass_16x8_pre_copy_b
-
- hfilter_16 v0, 1
- hfilter_16 v1, 1
- hfilter_16 v2, 1
- hfilter_16 v3, 1
- hfilter_16 v4, 1
- hfilter_16 v5, 1
- hfilter_16 v6, 1
- hfilter_16 v7, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq compute_sum_sse_16x8_b
-
- hfilter_16 v8, 0
-
- b second_pass_16x8_b
-
-second_pass_16x8_pre_copy_b:
- slwi. r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_16 v0, r3, r4, 1
- load_and_align_16 v1, r3, r4, 1
- load_and_align_16 v2, r3, r4, 1
- load_and_align_16 v3, r3, r4, 1
- load_and_align_16 v4, r3, r4, 1
- load_and_align_16 v5, r3, r4, 1
- load_and_align_16 v6, r3, r4, 1
- load_and_align_16 v7, r3, r4, 1
- load_and_align_16 v8, r3, r4, 1
-
- beq compute_sum_sse_16x8_b
-
-second_pass_16x8_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
-
-compute_sum_sse_16x8_b:
- vspltish v18, 0 ;# sum
- vspltish v19, 0 ;# sse
- vspltish v23, 0 ;# unpack
- li r10, 16
-
- compute_sum_sse_16 v0, 1
- compute_sum_sse_16 v1, 1
- compute_sum_sse_16 v2, 1
- compute_sum_sse_16 v3, 1
- compute_sum_sse_16 v4, 1
- compute_sum_sse_16 v5, 1
- compute_sum_sse_16 v6, 1
- compute_sum_sse_16 v7, 0
-
- variance_final v18, v19, v23, 7
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *src_ptr
-;# r4 int src_pixels_per_line
-;# r5 int xoffset
-;# r6 int yoffset
-;# r7 unsigned char *dst_ptr
-;# r8 int dst_pixels_per_line
-;# r9 unsigned int *sse
-;#
-;# r3 return value
-vp8_sub_pixel_variance16x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1, -32(r1) ;# create space on the stack
-
- HProlog second_pass_16x16_pre_copy_b
-
- hfilter_16 v0, 1
- hfilter_16 v1, 1
- hfilter_16 v2, 1
- hfilter_16 v3, 1
- hfilter_16 v4, 1
- hfilter_16 v5, 1
- hfilter_16 v6, 1
- hfilter_16 v7, 1
- hfilter_16 v8, 1
- hfilter_16 v9, 1
- hfilter_16 v10, 1
- hfilter_16 v11, 1
- hfilter_16 v12, 1
- hfilter_16 v13, 1
- hfilter_16 v14, 1
- hfilter_16 v15, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq compute_sum_sse_16x16_b
-
- hfilter_16 v16, 0
-
- b second_pass_16x16_b
-
-second_pass_16x16_pre_copy_b:
- slwi. r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_16 v0, r3, r4, 1
- load_and_align_16 v1, r3, r4, 1
- load_and_align_16 v2, r3, r4, 1
- load_and_align_16 v3, r3, r4, 1
- load_and_align_16 v4, r3, r4, 1
- load_and_align_16 v5, r3, r4, 1
- load_and_align_16 v6, r3, r4, 1
- load_and_align_16 v7, r3, r4, 1
- load_and_align_16 v8, r3, r4, 1
- load_and_align_16 v9, r3, r4, 1
- load_and_align_16 v10, r3, r4, 1
- load_and_align_16 v11, r3, r4, 1
- load_and_align_16 v12, r3, r4, 1
- load_and_align_16 v13, r3, r4, 1
- load_and_align_16 v14, r3, r4, 1
- load_and_align_16 v15, r3, r4, 1
- load_and_align_16 v16, r3, r4, 0
-
- beq compute_sum_sse_16x16_b
-
-second_pass_16x16_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
- vfilter_16 v8, v9
- vfilter_16 v9, v10
- vfilter_16 v10, v11
- vfilter_16 v11, v12
- vfilter_16 v12, v13
- vfilter_16 v13, v14
- vfilter_16 v14, v15
- vfilter_16 v15, v16
-
-compute_sum_sse_16x16_b:
- vspltish v18, 0 ;# sum
- vspltish v19, 0 ;# sse
- vspltish v23, 0 ;# unpack
- li r10, 16
-
- compute_sum_sse_16 v0, 1
- compute_sum_sse_16 v1, 1
- compute_sum_sse_16 v2, 1
- compute_sum_sse_16 v3, 1
- compute_sum_sse_16 v4, 1
- compute_sum_sse_16 v5, 1
- compute_sum_sse_16 v6, 1
- compute_sum_sse_16 v7, 1
- compute_sum_sse_16 v8, 1
- compute_sum_sse_16 v9, 1
- compute_sum_sse_16 v10, 1
- compute_sum_sse_16 v11, 1
- compute_sum_sse_16 v12, 1
- compute_sum_sse_16 v13, 1
- compute_sum_sse_16 v14, 1
- compute_sum_sse_16 v15, 0
-
- variance_final v18, v19, v23, 8
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .data
-
- .align 4
-hfilter_b:
- .byte 128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0
- .byte 112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0
- .byte 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0
- .byte 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0
- .byte 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0
- .byte 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0
- .byte 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0
- .byte 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0
-
- .align 4
-vfilter_b:
- .byte 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
- .byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
- .byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
- .byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
- .byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
- .byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
- .byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- .byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- .byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
- .byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
- .byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
- .byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
- .byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
- .byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
-
- .align 4
-b_hperm_b:
- .byte 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
-
- .align 4
-b_0123_b:
- .byte 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6
-
- .align 4
-b_4567_b:
- .byte 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10
-
-b_hilo_b:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/ppflags.h b/videocodec/libvpx_internal/libvpx/vp8/common/ppflags.h
deleted file mode 100644
index 768224a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/ppflags.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_PPFLAGS_H_
-#define VP8_COMMON_PPFLAGS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-enum
-{
- VP8D_NOFILTERING = 0,
- VP8D_DEBLOCK = 1<<0,
- VP8D_DEMACROBLOCK = 1<<1,
- VP8D_ADDNOISE = 1<<2,
- VP8D_DEBUG_TXT_FRAME_INFO = 1<<3,
- VP8D_DEBUG_TXT_MBLK_MODES = 1<<4,
- VP8D_DEBUG_TXT_DC_DIFF = 1<<5,
- VP8D_DEBUG_TXT_RATE_INFO = 1<<6,
- VP8D_DEBUG_DRAW_MV = 1<<7,
- VP8D_DEBUG_CLR_BLK_MODES = 1<<8,
- VP8D_DEBUG_CLR_FRM_REF_BLKS = 1<<9,
- VP8D_MFQE = 1<<10
-};
-
-typedef struct
-{
- int post_proc_flag;
- int deblocking_level;
- int noise_level;
- int display_ref_frame_flag;
- int display_mb_modes_flag;
- int display_b_modes_flag;
- int display_mv_flag;
-} vp8_ppflags_t;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_PPFLAGS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/pragmas.h b/videocodec/libvpx_internal/libvpx/vp8/common/pragmas.h
deleted file mode 100644
index 329cc82..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/pragmas.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_COMMON_PRAGMAS_H_
-#define VP8_COMMON_PRAGMAS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __INTEL_COMPILER
-#pragma warning(disable:997 1011 170)
-#endif
-#ifdef _MSC_VER
-#pragma warning(disable:4799)
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_PRAGMAS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/quant_common.c b/videocodec/libvpx_internal/libvpx/vp8/common/quant_common.c
deleted file mode 100644
index 05f9210..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/quant_common.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "quant_common.h"
-
-static const int dc_qlookup[QINDEX_RANGE] =
-{
- 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 17,
- 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
- 91, 93, 95, 96, 98, 100, 101, 102, 104, 106, 108, 110, 112, 114, 116, 118,
- 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 143, 145, 148, 151, 154, 157,
-};
-
-static const int ac_qlookup[QINDEX_RANGE] =
-{
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 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, 60, 62, 64, 66, 68, 70, 72, 74, 76,
- 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108,
- 110, 112, 114, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 149, 152,
- 155, 158, 161, 164, 167, 170, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209,
- 213, 217, 221, 225, 229, 234, 239, 245, 249, 254, 259, 264, 269, 274, 279, 284,
-};
-
-
-int vp8_dc_quant(int QIndex, int Delta)
-{
- int retval;
-
- QIndex = QIndex + Delta;
-
- if (QIndex > 127)
- QIndex = 127;
- else if (QIndex < 0)
- QIndex = 0;
-
- retval = dc_qlookup[ QIndex ];
- return retval;
-}
-
-int vp8_dc2quant(int QIndex, int Delta)
-{
- int retval;
-
- QIndex = QIndex + Delta;
-
- if (QIndex > 127)
- QIndex = 127;
- else if (QIndex < 0)
- QIndex = 0;
-
- retval = dc_qlookup[ QIndex ] * 2;
- return retval;
-
-}
-int vp8_dc_uv_quant(int QIndex, int Delta)
-{
- int retval;
-
- QIndex = QIndex + Delta;
-
- if (QIndex > 127)
- QIndex = 127;
- else if (QIndex < 0)
- QIndex = 0;
-
- retval = dc_qlookup[ QIndex ];
-
- if (retval > 132)
- retval = 132;
-
- return retval;
-}
-
-int vp8_ac_yquant(int QIndex)
-{
- int retval;
-
- if (QIndex > 127)
- QIndex = 127;
- else if (QIndex < 0)
- QIndex = 0;
-
- retval = ac_qlookup[ QIndex ];
- return retval;
-}
-
-int vp8_ac2quant(int QIndex, int Delta)
-{
- int retval;
-
- QIndex = QIndex + Delta;
-
- if (QIndex > 127)
- QIndex = 127;
- else if (QIndex < 0)
- QIndex = 0;
-
- /* For all x in [0..284], x*155/100 is bitwise equal to (x*101581) >> 16.
- * The smallest precision for that is '(x*6349) >> 12' but 16 is a good
- * word size. */
- retval = (ac_qlookup[ QIndex ] * 101581) >> 16;
-
- if (retval < 8)
- retval = 8;
-
- return retval;
-}
-int vp8_ac_uv_quant(int QIndex, int Delta)
-{
- int retval;
-
- QIndex = QIndex + Delta;
-
- if (QIndex > 127)
- QIndex = 127;
- else if (QIndex < 0)
- QIndex = 0;
-
- retval = ac_qlookup[ QIndex ];
- return retval;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/quant_common.h b/videocodec/libvpx_internal/libvpx/vp8/common/quant_common.h
deleted file mode 100644
index 700b5e6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/quant_common.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_COMMON_QUANT_COMMON_H_
-#define VP8_COMMON_QUANT_COMMON_H_
-
-
-#include "string.h"
-#include "blockd.h"
-#include "onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int vp8_ac_yquant(int QIndex);
-extern int vp8_dc_quant(int QIndex, int Delta);
-extern int vp8_dc2quant(int QIndex, int Delta);
-extern int vp8_ac2quant(int QIndex, int Delta);
-extern int vp8_dc_uv_quant(int QIndex, int Delta);
-extern int vp8_ac_uv_quant(int QIndex, int Delta);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_QUANT_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/reconinter.c b/videocodec/libvpx_internal/libvpx/vp8/common/reconinter.c
deleted file mode 100644
index bac3c94..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/reconinter.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <limits.h>
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx/vpx_integer.h"
-#include "blockd.h"
-#include "reconinter.h"
-#if CONFIG_RUNTIME_CPU_DETECT
-#include "onyxc_int.h"
-#endif
-
-void vp8_copy_mem16x16_c(
- unsigned char *src,
- int src_stride,
- unsigned char *dst,
- int dst_stride)
-{
-
- int r;
-
- for (r = 0; r < 16; r++)
- {
-#if !(CONFIG_FAST_UNALIGNED)
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[6];
- dst[7] = src[7];
- dst[8] = src[8];
- dst[9] = src[9];
- dst[10] = src[10];
- dst[11] = src[11];
- dst[12] = src[12];
- dst[13] = src[13];
- dst[14] = src[14];
- dst[15] = src[15];
-
-#else
- ((uint32_t *)dst)[0] = ((uint32_t *)src)[0] ;
- ((uint32_t *)dst)[1] = ((uint32_t *)src)[1] ;
- ((uint32_t *)dst)[2] = ((uint32_t *)src)[2] ;
- ((uint32_t *)dst)[3] = ((uint32_t *)src)[3] ;
-
-#endif
- src += src_stride;
- dst += dst_stride;
-
- }
-
-}
-
-void vp8_copy_mem8x8_c(
- unsigned char *src,
- int src_stride,
- unsigned char *dst,
- int dst_stride)
-{
- int r;
-
- for (r = 0; r < 8; r++)
- {
-#if !(CONFIG_FAST_UNALIGNED)
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[6];
- dst[7] = src[7];
-#else
- ((uint32_t *)dst)[0] = ((uint32_t *)src)[0] ;
- ((uint32_t *)dst)[1] = ((uint32_t *)src)[1] ;
-#endif
- src += src_stride;
- dst += dst_stride;
-
- }
-
-}
-
-void vp8_copy_mem8x4_c(
- unsigned char *src,
- int src_stride,
- unsigned char *dst,
- int dst_stride)
-{
- int r;
-
- for (r = 0; r < 4; r++)
- {
-#if !(CONFIG_FAST_UNALIGNED)
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- dst[4] = src[4];
- dst[5] = src[5];
- dst[6] = src[6];
- dst[7] = src[7];
-#else
- ((uint32_t *)dst)[0] = ((uint32_t *)src)[0] ;
- ((uint32_t *)dst)[1] = ((uint32_t *)src)[1] ;
-#endif
- src += src_stride;
- dst += dst_stride;
-
- }
-
-}
-
-
-void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, unsigned char *base_pre, int pre_stride, vp8_subpix_fn_t sppf)
-{
- int r;
- unsigned char *pred_ptr = d->predictor;
- unsigned char *ptr;
- ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
-
- if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
- {
- sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch);
- }
- else
- {
- for (r = 0; r < 4; r++)
- {
- pred_ptr[0] = ptr[0];
- pred_ptr[1] = ptr[1];
- pred_ptr[2] = ptr[2];
- pred_ptr[3] = ptr[3];
- pred_ptr += pitch;
- ptr += pre_stride;
- }
- }
-}
-
-static void build_inter_predictors4b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride)
-{
- unsigned char *ptr;
- ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
-
- if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
- {
- x->subpixel_predict8x8(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride);
- }
- else
- {
- vp8_copy_mem8x8(ptr, pre_stride, dst, dst_stride);
- }
-}
-
-static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride)
-{
- unsigned char *ptr;
- ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
-
- if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
- {
- x->subpixel_predict8x4(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride);
- }
- else
- {
- vp8_copy_mem8x4(ptr, pre_stride, dst, dst_stride);
- }
-}
-
-static void build_inter_predictors_b(BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride, vp8_subpix_fn_t sppf)
-{
- int r;
- unsigned char *ptr;
- ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
-
- if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
- {
- sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride);
- }
- else
- {
- for (r = 0; r < 4; r++)
- {
- dst[0] = ptr[0];
- dst[1] = ptr[1];
- dst[2] = ptr[2];
- dst[3] = ptr[3];
- dst += dst_stride;
- ptr += pre_stride;
- }
- }
-}
-
-
-/*encoder only*/
-void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x)
-{
- unsigned char *uptr, *vptr;
- unsigned char *upred_ptr = &x->predictor[256];
- unsigned char *vpred_ptr = &x->predictor[320];
-
- int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
- int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
- int offset;
- int pre_stride = x->pre.uv_stride;
-
- /* calc uv motion vectors */
- mv_row += 1 | (mv_row >> (sizeof(int) * CHAR_BIT - 1));
- mv_col += 1 | (mv_col >> (sizeof(int) * CHAR_BIT - 1));
- mv_row /= 2;
- mv_col /= 2;
- mv_row &= x->fullpixel_mask;
- mv_col &= x->fullpixel_mask;
-
- offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
- uptr = x->pre.u_buffer + offset;
- vptr = x->pre.v_buffer + offset;
-
- if ((mv_row | mv_col) & 7)
- {
- x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, upred_ptr, 8);
- x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vpred_ptr, 8);
- }
- else
- {
- vp8_copy_mem8x8(uptr, pre_stride, upred_ptr, 8);
- vp8_copy_mem8x8(vptr, pre_stride, vpred_ptr, 8);
- }
-}
-
-/*encoder only*/
-void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x)
-{
- int i, j;
- int pre_stride = x->pre.uv_stride;
- unsigned char *base_pre;
-
- /* build uv mvs */
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- int yoffset = i * 8 + j * 2;
- int uoffset = 16 + i * 2 + j;
- int voffset = 20 + i * 2 + j;
-
- int temp;
-
- temp = x->block[yoffset ].bmi.mv.as_mv.row
- + x->block[yoffset+1].bmi.mv.as_mv.row
- + x->block[yoffset+4].bmi.mv.as_mv.row
- + x->block[yoffset+5].bmi.mv.as_mv.row;
-
- temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
-
- x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
-
- temp = x->block[yoffset ].bmi.mv.as_mv.col
- + x->block[yoffset+1].bmi.mv.as_mv.col
- + x->block[yoffset+4].bmi.mv.as_mv.col
- + x->block[yoffset+5].bmi.mv.as_mv.col;
-
- temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
-
- x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
-
- x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int;
- }
- }
-
- base_pre = x->pre.u_buffer;
- for (i = 16; i < 20; i += 2)
- {
- BLOCKD *d0 = &x->block[i];
- BLOCKD *d1 = &x->block[i+1];
-
- if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
- build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride);
- else
- {
- vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride, x->subpixel_predict);
- vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride, x->subpixel_predict);
- }
- }
-
- base_pre = x->pre.v_buffer;
- for (i = 20; i < 24; i += 2)
- {
- BLOCKD *d0 = &x->block[i];
- BLOCKD *d1 = &x->block[i+1];
-
- if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
- build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride);
- else
- {
- vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride, x->subpixel_predict);
- vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride, x->subpixel_predict);
- }
- }
-}
-
-
-/*encoder only*/
-void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x,
- unsigned char *dst_y,
- int dst_ystride)
-{
- unsigned char *ptr_base;
- unsigned char *ptr;
- int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
- int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
- int pre_stride = x->pre.y_stride;
-
- ptr_base = x->pre.y_buffer;
- ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3);
-
- if ((mv_row | mv_col) & 7)
- {
- x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7,
- dst_y, dst_ystride);
- }
- else
- {
- vp8_copy_mem16x16(ptr, pre_stride, dst_y,
- dst_ystride);
- }
-}
-
-static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
-{
- /* If the MV points so far into the UMV border that no visible pixels
- * are used for reconstruction, the subpel part of the MV can be
- * discarded and the MV limited to 16 pixels with equivalent results.
- *
- * This limit kicks in at 19 pixels for the top and left edges, for
- * the 16 pixels plus 3 taps right of the central pixel when subpel
- * filtering. The bottom and right edges use 16 pixels plus 2 pixels
- * left of the central pixel when filtering.
- */
- if (mv->col < (xd->mb_to_left_edge - (19 << 3)))
- mv->col = xd->mb_to_left_edge - (16 << 3);
- else if (mv->col > xd->mb_to_right_edge + (18 << 3))
- mv->col = xd->mb_to_right_edge + (16 << 3);
-
- if (mv->row < (xd->mb_to_top_edge - (19 << 3)))
- mv->row = xd->mb_to_top_edge - (16 << 3);
- else if (mv->row > xd->mb_to_bottom_edge + (18 << 3))
- mv->row = xd->mb_to_bottom_edge + (16 << 3);
-}
-
-/* A version of the above function for chroma block MVs.*/
-static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
-{
- mv->col = (2*mv->col < (xd->mb_to_left_edge - (19 << 3))) ?
- (xd->mb_to_left_edge - (16 << 3)) >> 1 : mv->col;
- mv->col = (2*mv->col > xd->mb_to_right_edge + (18 << 3)) ?
- (xd->mb_to_right_edge + (16 << 3)) >> 1 : mv->col;
-
- mv->row = (2*mv->row < (xd->mb_to_top_edge - (19 << 3))) ?
- (xd->mb_to_top_edge - (16 << 3)) >> 1 : mv->row;
- mv->row = (2*mv->row > xd->mb_to_bottom_edge + (18 << 3)) ?
- (xd->mb_to_bottom_edge + (16 << 3)) >> 1 : mv->row;
-}
-
-void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
- unsigned char *dst_y,
- unsigned char *dst_u,
- unsigned char *dst_v,
- int dst_ystride,
- int dst_uvstride)
-{
- int offset;
- unsigned char *ptr;
- unsigned char *uptr, *vptr;
-
- int_mv _16x16mv;
-
- unsigned char *ptr_base = x->pre.y_buffer;
- int pre_stride = x->pre.y_stride;
-
- _16x16mv.as_int = x->mode_info_context->mbmi.mv.as_int;
-
- if (x->mode_info_context->mbmi.need_to_clamp_mvs)
- {
- clamp_mv_to_umv_border(&_16x16mv.as_mv, x);
- }
-
- ptr = ptr_base + ( _16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3);
-
- if ( _16x16mv.as_int & 0x00070007)
- {
- x->subpixel_predict16x16(ptr, pre_stride, _16x16mv.as_mv.col & 7, _16x16mv.as_mv.row & 7, dst_y, dst_ystride);
- }
- else
- {
- vp8_copy_mem16x16(ptr, pre_stride, dst_y, dst_ystride);
- }
-
- /* calc uv motion vectors */
- _16x16mv.as_mv.row += 1 | (_16x16mv.as_mv.row >> (sizeof(int) * CHAR_BIT - 1));
- _16x16mv.as_mv.col += 1 | (_16x16mv.as_mv.col >> (sizeof(int) * CHAR_BIT - 1));
- _16x16mv.as_mv.row /= 2;
- _16x16mv.as_mv.col /= 2;
- _16x16mv.as_mv.row &= x->fullpixel_mask;
- _16x16mv.as_mv.col &= x->fullpixel_mask;
-
- pre_stride >>= 1;
- offset = ( _16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3);
- uptr = x->pre.u_buffer + offset;
- vptr = x->pre.v_buffer + offset;
-
- if ( _16x16mv.as_int & 0x00070007)
- {
- x->subpixel_predict8x8(uptr, pre_stride, _16x16mv.as_mv.col & 7, _16x16mv.as_mv.row & 7, dst_u, dst_uvstride);
- x->subpixel_predict8x8(vptr, pre_stride, _16x16mv.as_mv.col & 7, _16x16mv.as_mv.row & 7, dst_v, dst_uvstride);
- }
- else
- {
- vp8_copy_mem8x8(uptr, pre_stride, dst_u, dst_uvstride);
- vp8_copy_mem8x8(vptr, pre_stride, dst_v, dst_uvstride);
- }
-}
-
-static void build_inter4x4_predictors_mb(MACROBLOCKD *x)
-{
- int i;
- unsigned char *base_dst = x->dst.y_buffer;
- unsigned char *base_pre = x->pre.y_buffer;
-
- if (x->mode_info_context->mbmi.partitioning < 3)
- {
- BLOCKD *b;
- int dst_stride = x->dst.y_stride;
-
- x->block[ 0].bmi = x->mode_info_context->bmi[ 0];
- x->block[ 2].bmi = x->mode_info_context->bmi[ 2];
- x->block[ 8].bmi = x->mode_info_context->bmi[ 8];
- x->block[10].bmi = x->mode_info_context->bmi[10];
- if (x->mode_info_context->mbmi.need_to_clamp_mvs)
- {
- clamp_mv_to_umv_border(&x->block[ 0].bmi.mv.as_mv, x);
- clamp_mv_to_umv_border(&x->block[ 2].bmi.mv.as_mv, x);
- clamp_mv_to_umv_border(&x->block[ 8].bmi.mv.as_mv, x);
- clamp_mv_to_umv_border(&x->block[10].bmi.mv.as_mv, x);
- }
-
- b = &x->block[ 0];
- build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
- b = &x->block[ 2];
- build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
- b = &x->block[ 8];
- build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
- b = &x->block[10];
- build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
- }
- else
- {
- for (i = 0; i < 16; i += 2)
- {
- BLOCKD *d0 = &x->block[i];
- BLOCKD *d1 = &x->block[i+1];
- int dst_stride = x->dst.y_stride;
-
- x->block[i+0].bmi = x->mode_info_context->bmi[i+0];
- x->block[i+1].bmi = x->mode_info_context->bmi[i+1];
- if (x->mode_info_context->mbmi.need_to_clamp_mvs)
- {
- clamp_mv_to_umv_border(&x->block[i+0].bmi.mv.as_mv, x);
- clamp_mv_to_umv_border(&x->block[i+1].bmi.mv.as_mv, x);
- }
-
- if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
- build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride);
- else
- {
- build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
- build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
- }
-
- }
-
- }
- base_dst = x->dst.u_buffer;
- base_pre = x->pre.u_buffer;
- for (i = 16; i < 20; i += 2)
- {
- BLOCKD *d0 = &x->block[i];
- BLOCKD *d1 = &x->block[i+1];
- int dst_stride = x->dst.uv_stride;
-
- /* Note: uv mvs already clamped in build_4x4uvmvs() */
-
- if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
- build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride);
- else
- {
- build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
- build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
- }
- }
-
- base_dst = x->dst.v_buffer;
- base_pre = x->pre.v_buffer;
- for (i = 20; i < 24; i += 2)
- {
- BLOCKD *d0 = &x->block[i];
- BLOCKD *d1 = &x->block[i+1];
- int dst_stride = x->dst.uv_stride;
-
- /* Note: uv mvs already clamped in build_4x4uvmvs() */
-
- if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
- build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride);
- else
- {
- build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
- build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
- }
- }
-}
-
-static
-void build_4x4uvmvs(MACROBLOCKD *x)
-{
- int i, j;
-
- for (i = 0; i < 2; i++)
- {
- for (j = 0; j < 2; j++)
- {
- int yoffset = i * 8 + j * 2;
- int uoffset = 16 + i * 2 + j;
- int voffset = 20 + i * 2 + j;
-
- int temp;
-
- temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.row
- + x->mode_info_context->bmi[yoffset + 1].mv.as_mv.row
- + x->mode_info_context->bmi[yoffset + 4].mv.as_mv.row
- + x->mode_info_context->bmi[yoffset + 5].mv.as_mv.row;
-
- temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
-
- x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
-
- temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.col
- + x->mode_info_context->bmi[yoffset + 1].mv.as_mv.col
- + x->mode_info_context->bmi[yoffset + 4].mv.as_mv.col
- + x->mode_info_context->bmi[yoffset + 5].mv.as_mv.col;
-
- temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
-
- x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
-
- if (x->mode_info_context->mbmi.need_to_clamp_mvs)
- clamp_uvmv_to_umv_border(&x->block[uoffset].bmi.mv.as_mv, x);
-
- x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int;
- }
- }
-}
-
-void vp8_build_inter_predictors_mb(MACROBLOCKD *xd)
-{
- if (xd->mode_info_context->mbmi.mode != SPLITMV)
- {
- vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer,
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.y_stride, xd->dst.uv_stride);
- }
- else
- {
- build_4x4uvmvs(xd);
- build_inter4x4_predictors_mb(xd);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/reconinter.h b/videocodec/libvpx_internal/libvpx/vp8/common/reconinter.h
deleted file mode 100644
index ba979b9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/reconinter.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_RECONINTER_H_
-#define VP8_COMMON_RECONINTER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void vp8_build_inter_predictors_mb(MACROBLOCKD *x);
-extern void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
- unsigned char *dst_y,
- unsigned char *dst_u,
- unsigned char *dst_v,
- int dst_ystride,
- int dst_uvstride);
-
-
-extern void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x,
- unsigned char *dst_y,
- int dst_ystride);
-extern void vp8_build_inter_predictors_b(BLOCKD *d, int pitch,
- unsigned char *base_pre,
- int pre_stride,
- vp8_subpix_fn_t sppf);
-
-extern void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x);
-extern void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_RECONINTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/reconintra.c b/videocodec/libvpx_internal/libvpx/vp8/common/reconintra.c
deleted file mode 100644
index ec51ffe..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/reconintra.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_mem/vpx_mem.h"
-#include "blockd.h"
-
-void vp8_build_intra_predictors_mby_s_c(MACROBLOCKD *x,
- unsigned char * yabove_row,
- unsigned char * yleft,
- int left_stride,
- unsigned char * ypred_ptr,
- int y_stride)
-{
- unsigned char yleft_col[16];
- unsigned char ytop_left = yabove_row[-1];
- int r, c, i;
-
- for (i = 0; i < 16; i++)
- {
- yleft_col[i] = yleft[i* left_stride];
- }
-
- /* for Y */
- switch (x->mode_info_context->mbmi.mode)
- {
- case DC_PRED:
- {
- int expected_dc;
- int shift;
- int average = 0;
-
-
- if (x->up_available || x->left_available)
- {
- if (x->up_available)
- {
- for (i = 0; i < 16; i++)
- {
- average += yabove_row[i];
- }
- }
-
- if (x->left_available)
- {
-
- for (i = 0; i < 16; i++)
- {
- average += yleft_col[i];
- }
-
- }
-
-
-
- shift = 3 + x->up_available + x->left_available;
- expected_dc = (average + (1 << (shift - 1))) >> shift;
- }
- else
- {
- expected_dc = 128;
- }
-
- /*vpx_memset(ypred_ptr, expected_dc, 256);*/
- for (r = 0; r < 16; r++)
- {
- vpx_memset(ypred_ptr, expected_dc, 16);
- ypred_ptr += y_stride;
- }
- }
- break;
- case V_PRED:
- {
-
- for (r = 0; r < 16; r++)
- {
-
- ((int *)ypred_ptr)[0] = ((int *)yabove_row)[0];
- ((int *)ypred_ptr)[1] = ((int *)yabove_row)[1];
- ((int *)ypred_ptr)[2] = ((int *)yabove_row)[2];
- ((int *)ypred_ptr)[3] = ((int *)yabove_row)[3];
- ypred_ptr += y_stride;
- }
- }
- break;
- case H_PRED:
- {
-
- for (r = 0; r < 16; r++)
- {
-
- vpx_memset(ypred_ptr, yleft_col[r], 16);
- ypred_ptr += y_stride;
- }
-
- }
- break;
- case TM_PRED:
- {
-
- for (r = 0; r < 16; r++)
- {
- for (c = 0; c < 16; c++)
- {
- int pred = yleft_col[r] + yabove_row[ c] - ytop_left;
-
- if (pred < 0)
- pred = 0;
-
- if (pred > 255)
- pred = 255;
-
- ypred_ptr[c] = pred;
- }
-
- ypred_ptr += y_stride;
- }
-
- }
- break;
- case B_PRED:
- case NEARESTMV:
- case NEARMV:
- case ZEROMV:
- case NEWMV:
- case SPLITMV:
- case MB_MODE_COUNT:
- break;
- }
-}
-
-void vp8_build_intra_predictors_mbuv_s_c(MACROBLOCKD *x,
- unsigned char * uabove_row,
- unsigned char * vabove_row,
- unsigned char * uleft,
- unsigned char * vleft,
- int left_stride,
- unsigned char * upred_ptr,
- unsigned char * vpred_ptr,
- int pred_stride)
-{
- unsigned char uleft_col[8];
- unsigned char utop_left = uabove_row[-1];
- unsigned char vleft_col[8];
- unsigned char vtop_left = vabove_row[-1];
-
- int i, j;
-
- for (i = 0; i < 8; i++)
- {
- uleft_col[i] = uleft [i* left_stride];
- vleft_col[i] = vleft [i* left_stride];
- }
-
- switch (x->mode_info_context->mbmi.uv_mode)
- {
- case DC_PRED:
- {
- int expected_udc;
- int expected_vdc;
- int shift;
- int Uaverage = 0;
- int Vaverage = 0;
-
- if (x->up_available)
- {
- for (i = 0; i < 8; i++)
- {
- Uaverage += uabove_row[i];
- Vaverage += vabove_row[i];
- }
- }
-
- if (x->left_available)
- {
- for (i = 0; i < 8; i++)
- {
- Uaverage += uleft_col[i];
- Vaverage += vleft_col[i];
- }
- }
-
- if (!x->up_available && !x->left_available)
- {
- expected_udc = 128;
- expected_vdc = 128;
- }
- else
- {
- shift = 2 + x->up_available + x->left_available;
- expected_udc = (Uaverage + (1 << (shift - 1))) >> shift;
- expected_vdc = (Vaverage + (1 << (shift - 1))) >> shift;
- }
-
-
- /*vpx_memset(upred_ptr,expected_udc,64);*/
- /*vpx_memset(vpred_ptr,expected_vdc,64);*/
- for (i = 0; i < 8; i++)
- {
- vpx_memset(upred_ptr, expected_udc, 8);
- vpx_memset(vpred_ptr, expected_vdc, 8);
- upred_ptr += pred_stride;
- vpred_ptr += pred_stride;
- }
- }
- break;
- case V_PRED:
- {
- for (i = 0; i < 8; i++)
- {
- vpx_memcpy(upred_ptr, uabove_row, 8);
- vpx_memcpy(vpred_ptr, vabove_row, 8);
- upred_ptr += pred_stride;
- vpred_ptr += pred_stride;
- }
-
- }
- break;
- case H_PRED:
- {
- for (i = 0; i < 8; i++)
- {
- vpx_memset(upred_ptr, uleft_col[i], 8);
- vpx_memset(vpred_ptr, vleft_col[i], 8);
- upred_ptr += pred_stride;
- vpred_ptr += pred_stride;
- }
- }
-
- break;
- case TM_PRED:
- {
- for (i = 0; i < 8; i++)
- {
- for (j = 0; j < 8; j++)
- {
- int predu = uleft_col[i] + uabove_row[j] - utop_left;
- int predv = vleft_col[i] + vabove_row[j] - vtop_left;
-
- if (predu < 0)
- predu = 0;
-
- if (predu > 255)
- predu = 255;
-
- if (predv < 0)
- predv = 0;
-
- if (predv > 255)
- predv = 255;
-
- upred_ptr[j] = predu;
- vpred_ptr[j] = predv;
- }
-
- upred_ptr += pred_stride;
- vpred_ptr += pred_stride;
- }
-
- }
- break;
- case B_PRED:
- case NEARESTMV:
- case NEARMV:
- case ZEROMV:
- case NEWMV:
- case SPLITMV:
- case MB_MODE_COUNT:
- break;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.c b/videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.c
deleted file mode 100644
index 3d4f2c4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "blockd.h"
-
-void vp8_intra4x4_predict_c(unsigned char *Above,
- unsigned char *yleft, int left_stride,
- int _b_mode,
- unsigned char *dst, int dst_stride,
- unsigned char top_left)
-{
- int i, r, c;
- B_PREDICTION_MODE b_mode = (B_PREDICTION_MODE)_b_mode;
- unsigned char Left[4];
- Left[0] = yleft[0];
- Left[1] = yleft[left_stride];
- Left[2] = yleft[2 * left_stride];
- Left[3] = yleft[3 * left_stride];
-
- switch (b_mode)
- {
- case B_DC_PRED:
- {
- int expected_dc = 0;
-
- for (i = 0; i < 4; i++)
- {
- expected_dc += Above[i];
- expected_dc += Left[i];
- }
-
- expected_dc = (expected_dc + 4) >> 3;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- dst[c] = expected_dc;
- }
-
- dst += dst_stride;
- }
- }
- break;
- case B_TM_PRED:
- {
- /* prediction similar to true_motion prediction */
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- int pred = Above[c] - top_left + Left[r];
-
- if (pred < 0)
- pred = 0;
-
- if (pred > 255)
- pred = 255;
-
- dst[c] = pred;
- }
-
- dst += dst_stride;
- }
- }
- break;
-
- case B_VE_PRED:
- {
-
- unsigned int ap[4];
- ap[0] = (top_left + 2 * Above[0] + Above[1] + 2) >> 2;
- ap[1] = (Above[0] + 2 * Above[1] + Above[2] + 2) >> 2;
- ap[2] = (Above[1] + 2 * Above[2] + Above[3] + 2) >> 2;
- ap[3] = (Above[2] + 2 * Above[3] + Above[4] + 2) >> 2;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
-
- dst[c] = ap[c];
- }
-
- dst += dst_stride;
- }
-
- }
- break;
-
-
- case B_HE_PRED:
- {
-
- unsigned int lp[4];
- lp[0] = (top_left + 2 * Left[0] + Left[1] + 2) >> 2;
- lp[1] = (Left[0] + 2 * Left[1] + Left[2] + 2) >> 2;
- lp[2] = (Left[1] + 2 * Left[2] + Left[3] + 2) >> 2;
- lp[3] = (Left[2] + 2 * Left[3] + Left[3] + 2) >> 2;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- dst[c] = lp[r];
- }
-
- dst += dst_stride;
- }
- }
- break;
- case B_LD_PRED:
- {
- unsigned char *ptr = Above;
- dst[0 * dst_stride + 0] = (ptr[0] + ptr[1] * 2 + ptr[2] + 2) >> 2;
- dst[0 * dst_stride + 1] =
- dst[1 * dst_stride + 0] = (ptr[1] + ptr[2] * 2 + ptr[3] + 2) >> 2;
- dst[0 * dst_stride + 2] =
- dst[1 * dst_stride + 1] =
- dst[2 * dst_stride + 0] = (ptr[2] + ptr[3] * 2 + ptr[4] + 2) >> 2;
- dst[0 * dst_stride + 3] =
- dst[1 * dst_stride + 2] =
- dst[2 * dst_stride + 1] =
- dst[3 * dst_stride + 0] = (ptr[3] + ptr[4] * 2 + ptr[5] + 2) >> 2;
- dst[1 * dst_stride + 3] =
- dst[2 * dst_stride + 2] =
- dst[3 * dst_stride + 1] = (ptr[4] + ptr[5] * 2 + ptr[6] + 2) >> 2;
- dst[2 * dst_stride + 3] =
- dst[3 * dst_stride + 2] = (ptr[5] + ptr[6] * 2 + ptr[7] + 2) >> 2;
- dst[3 * dst_stride + 3] = (ptr[6] + ptr[7] * 2 + ptr[7] + 2) >> 2;
-
- }
- break;
- case B_RD_PRED:
- {
-
- unsigned char pp[9];
-
- pp[0] = Left[3];
- pp[1] = Left[2];
- pp[2] = Left[1];
- pp[3] = Left[0];
- pp[4] = top_left;
- pp[5] = Above[0];
- pp[6] = Above[1];
- pp[7] = Above[2];
- pp[8] = Above[3];
-
- dst[3 * dst_stride + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
- dst[3 * dst_stride + 1] =
- dst[2 * dst_stride + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
- dst[3 * dst_stride + 2] =
- dst[2 * dst_stride + 1] =
- dst[1 * dst_stride + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
- dst[3 * dst_stride + 3] =
- dst[2 * dst_stride + 2] =
- dst[1 * dst_stride + 1] =
- dst[0 * dst_stride + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
- dst[2 * dst_stride + 3] =
- dst[1 * dst_stride + 2] =
- dst[0 * dst_stride + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
- dst[1 * dst_stride + 3] =
- dst[0 * dst_stride + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
- dst[0 * dst_stride + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
-
- }
- break;
- case B_VR_PRED:
- {
-
- unsigned char pp[9];
-
- pp[0] = Left[3];
- pp[1] = Left[2];
- pp[2] = Left[1];
- pp[3] = Left[0];
- pp[4] = top_left;
- pp[5] = Above[0];
- pp[6] = Above[1];
- pp[7] = Above[2];
- pp[8] = Above[3];
-
-
- dst[3 * dst_stride + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
- dst[2 * dst_stride + 0] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
- dst[3 * dst_stride + 1] =
- dst[1 * dst_stride + 0] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
- dst[2 * dst_stride + 1] =
- dst[0 * dst_stride + 0] = (pp[4] + pp[5] + 1) >> 1;
- dst[3 * dst_stride + 2] =
- dst[1 * dst_stride + 1] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
- dst[2 * dst_stride + 2] =
- dst[0 * dst_stride + 1] = (pp[5] + pp[6] + 1) >> 1;
- dst[3 * dst_stride + 3] =
- dst[1 * dst_stride + 2] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
- dst[2 * dst_stride + 3] =
- dst[0 * dst_stride + 2] = (pp[6] + pp[7] + 1) >> 1;
- dst[1 * dst_stride + 3] = (pp[6] + pp[7] * 2 + pp[8] + 2) >> 2;
- dst[0 * dst_stride + 3] = (pp[7] + pp[8] + 1) >> 1;
-
- }
- break;
- case B_VL_PRED:
- {
-
- unsigned char *pp = Above;
-
- dst[0 * dst_stride + 0] = (pp[0] + pp[1] + 1) >> 1;
- dst[1 * dst_stride + 0] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
- dst[2 * dst_stride + 0] =
- dst[0 * dst_stride + 1] = (pp[1] + pp[2] + 1) >> 1;
- dst[1 * dst_stride + 1] =
- dst[3 * dst_stride + 0] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
- dst[2 * dst_stride + 1] =
- dst[0 * dst_stride + 2] = (pp[2] + pp[3] + 1) >> 1;
- dst[3 * dst_stride + 1] =
- dst[1 * dst_stride + 2] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
- dst[0 * dst_stride + 3] =
- dst[2 * dst_stride + 2] = (pp[3] + pp[4] + 1) >> 1;
- dst[1 * dst_stride + 3] =
- dst[3 * dst_stride + 2] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
- dst[2 * dst_stride + 3] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
- dst[3 * dst_stride + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
- }
- break;
-
- case B_HD_PRED:
- {
- unsigned char pp[9];
- pp[0] = Left[3];
- pp[1] = Left[2];
- pp[2] = Left[1];
- pp[3] = Left[0];
- pp[4] = top_left;
- pp[5] = Above[0];
- pp[6] = Above[1];
- pp[7] = Above[2];
- pp[8] = Above[3];
-
-
- dst[3 * dst_stride + 0] = (pp[0] + pp[1] + 1) >> 1;
- dst[3 * dst_stride + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
- dst[2 * dst_stride + 0] =
- dst[3 * dst_stride + 2] = (pp[1] + pp[2] + 1) >> 1;
- dst[2 * dst_stride + 1] =
- dst[3 * dst_stride + 3] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
- dst[2 * dst_stride + 2] =
- dst[1 * dst_stride + 0] = (pp[2] + pp[3] + 1) >> 1;
- dst[2 * dst_stride + 3] =
- dst[1 * dst_stride + 1] = (pp[2] + pp[3] * 2 + pp[4] + 2) >> 2;
- dst[1 * dst_stride + 2] =
- dst[0 * dst_stride + 0] = (pp[3] + pp[4] + 1) >> 1;
- dst[1 * dst_stride + 3] =
- dst[0 * dst_stride + 1] = (pp[3] + pp[4] * 2 + pp[5] + 2) >> 2;
- dst[0 * dst_stride + 2] = (pp[4] + pp[5] * 2 + pp[6] + 2) >> 2;
- dst[0 * dst_stride + 3] = (pp[5] + pp[6] * 2 + pp[7] + 2) >> 2;
- }
- break;
-
-
- case B_HU_PRED:
- {
- unsigned char *pp = Left;
- dst[0 * dst_stride + 0] = (pp[0] + pp[1] + 1) >> 1;
- dst[0 * dst_stride + 1] = (pp[0] + pp[1] * 2 + pp[2] + 2) >> 2;
- dst[0 * dst_stride + 2] =
- dst[1 * dst_stride + 0] = (pp[1] + pp[2] + 1) >> 1;
- dst[0 * dst_stride + 3] =
- dst[1 * dst_stride + 1] = (pp[1] + pp[2] * 2 + pp[3] + 2) >> 2;
- dst[1 * dst_stride + 2] =
- dst[2 * dst_stride + 0] = (pp[2] + pp[3] + 1) >> 1;
- dst[1 * dst_stride + 3] =
- dst[2 * dst_stride + 1] = (pp[2] + pp[3] * 2 + pp[3] + 2) >> 2;
- dst[2 * dst_stride + 2] =
- dst[2 * dst_stride + 3] =
- dst[3 * dst_stride + 0] =
- dst[3 * dst_stride + 1] =
- dst[3 * dst_stride + 2] =
- dst[3 * dst_stride + 3] = pp[3];
- }
- break;
-
- default:
- break;
-
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.h b/videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.h
deleted file mode 100644
index ed59c9e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/reconintra4x4.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_RECONINTRA4X4_H_
-#define VP8_COMMON_RECONINTRA4X4_H_
-#include "vp8/common/blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static void intra_prediction_down_copy(MACROBLOCKD *xd,
- unsigned char *above_right_src)
-{
- int dst_stride = xd->dst.y_stride;
- unsigned char *above_right_dst = xd->dst.y_buffer - dst_stride + 16;
-
- unsigned int *src_ptr = (unsigned int *)above_right_src;
- unsigned int *dst_ptr0 = (unsigned int *)(above_right_dst + 4 * dst_stride);
- unsigned int *dst_ptr1 = (unsigned int *)(above_right_dst + 8 * dst_stride);
- unsigned int *dst_ptr2 = (unsigned int *)(above_right_dst + 12 * dst_stride);
-
- *dst_ptr0 = *src_ptr;
- *dst_ptr1 = *src_ptr;
- *dst_ptr2 = *src_ptr;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_RECONINTRA4X4_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/rtcd.c b/videocodec/libvpx_internal/libvpx/vp8/common/rtcd.c
deleted file mode 100644
index 0b371b0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/rtcd.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "vpx_config.h"
-#define RTCD_C
-#include "vp8_rtcd.h"
-#include "vpx_ports/vpx_once.h"
-
-extern void vpx_scale_rtcd(void);
-
-void vp8_rtcd()
-{
- vpx_scale_rtcd();
- once(setup_rtcd_internal);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/rtcd_defs.pl b/videocodec/libvpx_internal/libvpx/vp8/common/rtcd_defs.pl
deleted file mode 100644
index 130d965..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/rtcd_defs.pl
+++ /dev/null
@@ -1,541 +0,0 @@
-sub vp8_common_forward_decls() {
-print <<EOF
-/*
- * VP8
- */
-
-struct blockd;
-struct macroblockd;
-struct loop_filter_info;
-
-/* Encoder forward decls */
-struct block;
-struct macroblock;
-struct variance_vtable;
-union int_mv;
-struct yv12_buffer_config;
-EOF
-}
-forward_decls qw/vp8_common_forward_decls/;
-
-#
-# system state
-#
-add_proto qw/void vp8_clear_system_state/, "";
-specialize qw/vp8_clear_system_state mmx/;
-$vp8_clear_system_state_mmx=vpx_reset_mmx_state;
-
-#
-# Dequant
-#
-add_proto qw/void vp8_dequantize_b/, "struct blockd*, short *dqc";
-specialize qw/vp8_dequantize_b mmx media neon/;
-$vp8_dequantize_b_media=vp8_dequantize_b_v6;
-
-add_proto qw/void vp8_dequant_idct_add/, "short *input, short *dq, unsigned char *output, int stride";
-specialize qw/vp8_dequant_idct_add mmx media neon dspr2/;
-$vp8_dequant_idct_add_media=vp8_dequant_idct_add_v6;
-$vp8_dequant_idct_add_dspr2=vp8_dequant_idct_add_dspr2;
-
-add_proto qw/void vp8_dequant_idct_add_y_block/, "short *q, short *dq, unsigned char *dst, int stride, char *eobs";
-specialize qw/vp8_dequant_idct_add_y_block mmx sse2 media neon dspr2/;
-$vp8_dequant_idct_add_y_block_media=vp8_dequant_idct_add_y_block_v6;
-$vp8_dequant_idct_add_y_block_dspr2=vp8_dequant_idct_add_y_block_dspr2;
-
-add_proto qw/void vp8_dequant_idct_add_uv_block/, "short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs";
-specialize qw/vp8_dequant_idct_add_uv_block mmx sse2 media neon dspr2/;
-$vp8_dequant_idct_add_uv_block_media=vp8_dequant_idct_add_uv_block_v6;
-$vp8_dequant_idct_add_y_block_dspr2=vp8_dequant_idct_add_y_block_dspr2;
-
-#
-# Loopfilter
-#
-add_proto qw/void vp8_loop_filter_mbv/, "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi";
-specialize qw/vp8_loop_filter_mbv mmx sse2 media neon dspr2/;
-$vp8_loop_filter_mbv_media=vp8_loop_filter_mbv_armv6;
-$vp8_loop_filter_mbv_dspr2=vp8_loop_filter_mbv_dspr2;
-
-add_proto qw/void vp8_loop_filter_bv/, "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi";
-specialize qw/vp8_loop_filter_bv mmx sse2 media neon dspr2/;
-$vp8_loop_filter_bv_media=vp8_loop_filter_bv_armv6;
-$vp8_loop_filter_bv_dspr2=vp8_loop_filter_bv_dspr2;
-
-add_proto qw/void vp8_loop_filter_mbh/, "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi";
-specialize qw/vp8_loop_filter_mbh mmx sse2 media neon dspr2/;
-$vp8_loop_filter_mbh_media=vp8_loop_filter_mbh_armv6;
-$vp8_loop_filter_mbh_dspr2=vp8_loop_filter_mbh_dspr2;
-
-add_proto qw/void vp8_loop_filter_bh/, "unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi";
-specialize qw/vp8_loop_filter_bh mmx sse2 media neon dspr2/;
-$vp8_loop_filter_bh_media=vp8_loop_filter_bh_armv6;
-$vp8_loop_filter_bh_dspr2=vp8_loop_filter_bh_dspr2;
-
-
-add_proto qw/void vp8_loop_filter_simple_mbv/, "unsigned char *y, int ystride, const unsigned char *blimit";
-specialize qw/vp8_loop_filter_simple_mbv mmx sse2 media neon/;
-$vp8_loop_filter_simple_mbv_c=vp8_loop_filter_simple_vertical_edge_c;
-$vp8_loop_filter_simple_mbv_mmx=vp8_loop_filter_simple_vertical_edge_mmx;
-$vp8_loop_filter_simple_mbv_sse2=vp8_loop_filter_simple_vertical_edge_sse2;
-$vp8_loop_filter_simple_mbv_media=vp8_loop_filter_simple_vertical_edge_armv6;
-$vp8_loop_filter_simple_mbv_neon=vp8_loop_filter_mbvs_neon;
-
-add_proto qw/void vp8_loop_filter_simple_mbh/, "unsigned char *y, int ystride, const unsigned char *blimit";
-specialize qw/vp8_loop_filter_simple_mbh mmx sse2 media neon/;
-$vp8_loop_filter_simple_mbh_c=vp8_loop_filter_simple_horizontal_edge_c;
-$vp8_loop_filter_simple_mbh_mmx=vp8_loop_filter_simple_horizontal_edge_mmx;
-$vp8_loop_filter_simple_mbh_sse2=vp8_loop_filter_simple_horizontal_edge_sse2;
-$vp8_loop_filter_simple_mbh_media=vp8_loop_filter_simple_horizontal_edge_armv6;
-$vp8_loop_filter_simple_mbh_neon=vp8_loop_filter_mbhs_neon;
-
-add_proto qw/void vp8_loop_filter_simple_bv/, "unsigned char *y, int ystride, const unsigned char *blimit";
-specialize qw/vp8_loop_filter_simple_bv mmx sse2 media neon/;
-$vp8_loop_filter_simple_bv_c=vp8_loop_filter_bvs_c;
-$vp8_loop_filter_simple_bv_mmx=vp8_loop_filter_bvs_mmx;
-$vp8_loop_filter_simple_bv_sse2=vp8_loop_filter_bvs_sse2;
-$vp8_loop_filter_simple_bv_media=vp8_loop_filter_bvs_armv6;
-$vp8_loop_filter_simple_bv_neon=vp8_loop_filter_bvs_neon;
-
-add_proto qw/void vp8_loop_filter_simple_bh/, "unsigned char *y, int ystride, const unsigned char *blimit";
-specialize qw/vp8_loop_filter_simple_bh mmx sse2 media neon/;
-$vp8_loop_filter_simple_bh_c=vp8_loop_filter_bhs_c;
-$vp8_loop_filter_simple_bh_mmx=vp8_loop_filter_bhs_mmx;
-$vp8_loop_filter_simple_bh_sse2=vp8_loop_filter_bhs_sse2;
-$vp8_loop_filter_simple_bh_media=vp8_loop_filter_bhs_armv6;
-$vp8_loop_filter_simple_bh_neon=vp8_loop_filter_bhs_neon;
-
-#
-# IDCT
-#
-#idct16
-add_proto qw/void vp8_short_idct4x4llm/, "short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride";
-specialize qw/vp8_short_idct4x4llm mmx media neon dspr2/;
-$vp8_short_idct4x4llm_media=vp8_short_idct4x4llm_v6_dual;
-$vp8_short_idct4x4llm_dspr2=vp8_short_idct4x4llm_dspr2;
-
-#iwalsh1
-add_proto qw/void vp8_short_inv_walsh4x4_1/, "short *input, short *output";
-specialize qw/vp8_short_inv_walsh4x4_1 dspr2/;
-$vp8_short_inv_walsh4x4_1_dspr2=vp8_short_inv_walsh4x4_1_dspr2;
-# no asm yet
-
-#iwalsh16
-add_proto qw/void vp8_short_inv_walsh4x4/, "short *input, short *output";
-specialize qw/vp8_short_inv_walsh4x4 mmx sse2 media neon dspr2/;
-$vp8_short_inv_walsh4x4_media=vp8_short_inv_walsh4x4_v6;
-$vp8_short_inv_walsh4x4_dspr2=vp8_short_inv_walsh4x4_dspr2;
-
-#idct1_scalar_add
-add_proto qw/void vp8_dc_only_idct_add/, "short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride";
-specialize qw/vp8_dc_only_idct_add mmx media neon dspr2/;
-$vp8_dc_only_idct_add_media=vp8_dc_only_idct_add_v6;
-$vp8_dc_only_idct_add_dspr2=vp8_dc_only_idct_add_dspr2;
-
-#
-# RECON
-#
-add_proto qw/void vp8_copy_mem16x16/, "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_copy_mem16x16 mmx sse2 media neon dspr2/;
-$vp8_copy_mem16x16_media=vp8_copy_mem16x16_v6;
-$vp8_copy_mem16x16_dspr2=vp8_copy_mem16x16_dspr2;
-
-add_proto qw/void vp8_copy_mem8x8/, "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_copy_mem8x8 mmx media neon dspr2/;
-$vp8_copy_mem8x8_media=vp8_copy_mem8x8_v6;
-$vp8_copy_mem8x8_dspr2=vp8_copy_mem8x8_dspr2;
-
-add_proto qw/void vp8_copy_mem8x4/, "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_copy_mem8x4 mmx media neon dspr2/;
-$vp8_copy_mem8x4_media=vp8_copy_mem8x4_v6;
-$vp8_copy_mem8x4_dspr2=vp8_copy_mem8x4_dspr2;
-
-add_proto qw/void vp8_build_intra_predictors_mby_s/, "struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride";
-specialize qw/vp8_build_intra_predictors_mby_s sse2 ssse3/;
-#TODO: fix assembly for neon
-
-add_proto qw/void vp8_build_intra_predictors_mbuv_s/, "struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride";
-specialize qw/vp8_build_intra_predictors_mbuv_s sse2 ssse3/;
-
-add_proto qw/void vp8_intra4x4_predict/, "unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left";
-specialize qw/vp8_intra4x4_predict media/;
-$vp8_intra4x4_predict_media=vp8_intra4x4_predict_armv6;
-
-#
-# Postproc
-#
-if (vpx_config("CONFIG_POSTPROC") eq "yes") {
- add_proto qw/void vp8_mbpost_proc_down/, "unsigned char *dst, int pitch, int rows, int cols,int flimit";
- specialize qw/vp8_mbpost_proc_down mmx sse2/;
- $vp8_mbpost_proc_down_sse2=vp8_mbpost_proc_down_xmm;
-
- add_proto qw/void vp8_mbpost_proc_across_ip/, "unsigned char *dst, int pitch, int rows, int cols,int flimit";
- specialize qw/vp8_mbpost_proc_across_ip sse2/;
- $vp8_mbpost_proc_across_ip_sse2=vp8_mbpost_proc_across_ip_xmm;
-
- add_proto qw/void vp8_post_proc_down_and_across_mb_row/, "unsigned char *src, unsigned char *dst, int src_pitch, int dst_pitch, int cols, unsigned char *flimits, int size";
- specialize qw/vp8_post_proc_down_and_across_mb_row sse2/;
-
- add_proto qw/void vp8_plane_add_noise/, "unsigned char *s, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int w, unsigned int h, int pitch";
- specialize qw/vp8_plane_add_noise mmx sse2/;
- $vp8_plane_add_noise_sse2=vp8_plane_add_noise_wmt;
-
- add_proto qw/void vp8_blend_mb_inner/, "unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride";
- # no asm yet
-
- add_proto qw/void vp8_blend_mb_outer/, "unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride";
- # no asm yet
-
- add_proto qw/void vp8_blend_b/, "unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride";
- # no asm yet
-
- add_proto qw/void vp8_filter_by_weight16x16/, "unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight";
- specialize qw/vp8_filter_by_weight16x16 sse2/;
-
- add_proto qw/void vp8_filter_by_weight8x8/, "unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight";
- specialize qw/vp8_filter_by_weight8x8 sse2/;
-
- add_proto qw/void vp8_filter_by_weight4x4/, "unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight";
- # no asm yet
-}
-
-#
-# Subpixel
-#
-add_proto qw/void vp8_sixtap_predict16x16/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_sixtap_predict16x16 mmx sse2 ssse3 media neon dspr2/;
-$vp8_sixtap_predict16x16_media=vp8_sixtap_predict16x16_armv6;
-$vp8_sixtap_predict16x16_dspr2=vp8_sixtap_predict16x16_dspr2;
-
-add_proto qw/void vp8_sixtap_predict8x8/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_sixtap_predict8x8 mmx sse2 ssse3 media neon dspr2/;
-$vp8_sixtap_predict8x8_media=vp8_sixtap_predict8x8_armv6;
-$vp8_sixtap_predict8x8_dspr2=vp8_sixtap_predict8x8_dspr2;
-
-add_proto qw/void vp8_sixtap_predict8x4/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_sixtap_predict8x4 mmx sse2 ssse3 media neon dspr2/;
-$vp8_sixtap_predict8x4_media=vp8_sixtap_predict8x4_armv6;
-$vp8_sixtap_predict8x4_dspr2=vp8_sixtap_predict8x4_dspr2;
-
-add_proto qw/void vp8_sixtap_predict4x4/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_sixtap_predict4x4 mmx ssse3 media neon dspr2/;
-$vp8_sixtap_predict4x4_media=vp8_sixtap_predict4x4_armv6;
-$vp8_sixtap_predict4x4_dspr2=vp8_sixtap_predict4x4_dspr2;
-
-add_proto qw/void vp8_bilinear_predict16x16/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_bilinear_predict16x16 mmx sse2 ssse3 media neon/;
-$vp8_bilinear_predict16x16_media=vp8_bilinear_predict16x16_armv6;
-
-add_proto qw/void vp8_bilinear_predict8x8/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_bilinear_predict8x8 mmx sse2 ssse3 media neon/;
-$vp8_bilinear_predict8x8_media=vp8_bilinear_predict8x8_armv6;
-
-add_proto qw/void vp8_bilinear_predict8x4/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_bilinear_predict8x4 mmx media neon/;
-$vp8_bilinear_predict8x4_media=vp8_bilinear_predict8x4_armv6;
-
-add_proto qw/void vp8_bilinear_predict4x4/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_bilinear_predict4x4 mmx media neon/;
-$vp8_bilinear_predict4x4_media=vp8_bilinear_predict4x4_armv6;
-
-#
-# Whole-pixel Variance
-#
-add_proto qw/unsigned int vp8_variance4x4/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance4x4 mmx sse2/;
-$vp8_variance4x4_sse2=vp8_variance4x4_wmt;
-
-add_proto qw/unsigned int vp8_variance8x8/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance8x8 mmx sse2 media neon/;
-$vp8_variance8x8_sse2=vp8_variance8x8_wmt;
-$vp8_variance8x8_media=vp8_variance8x8_armv6;
-
-add_proto qw/unsigned int vp8_variance8x16/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance8x16 mmx sse2 neon/;
-$vp8_variance8x16_sse2=vp8_variance8x16_wmt;
-
-add_proto qw/unsigned int vp8_variance16x8/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance16x8 mmx sse2 neon/;
-$vp8_variance16x8_sse2=vp8_variance16x8_wmt;
-
-add_proto qw/unsigned int vp8_variance16x16/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance16x16 mmx sse2 media neon/;
-$vp8_variance16x16_sse2=vp8_variance16x16_wmt;
-$vp8_variance16x16_media=vp8_variance16x16_armv6;
-
-#
-# Sub-pixel Variance
-#
-add_proto qw/unsigned int vp8_sub_pixel_variance4x4/, "const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse";
-specialize qw/vp8_sub_pixel_variance4x4 mmx sse2/;
-$vp8_sub_pixel_variance4x4_sse2=vp8_sub_pixel_variance4x4_wmt;
-
-add_proto qw/unsigned int vp8_sub_pixel_variance8x8/, "const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse";
-specialize qw/vp8_sub_pixel_variance8x8 mmx sse2 media neon/;
-$vp8_sub_pixel_variance8x8_sse2=vp8_sub_pixel_variance8x8_wmt;
-$vp8_sub_pixel_variance8x8_media=vp8_sub_pixel_variance8x8_armv6;
-
-add_proto qw/unsigned int vp8_sub_pixel_variance8x16/, "const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse";
-specialize qw/vp8_sub_pixel_variance8x16 mmx sse2/;
-$vp8_sub_pixel_variance8x16_sse2=vp8_sub_pixel_variance8x16_wmt;
-
-add_proto qw/unsigned int vp8_sub_pixel_variance16x8/, "const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse";
-specialize qw/vp8_sub_pixel_variance16x8 mmx sse2 ssse3/;
-$vp8_sub_pixel_variance16x8_sse2=vp8_sub_pixel_variance16x8_wmt;
-
-add_proto qw/unsigned int vp8_sub_pixel_variance16x16/, "const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse";
-specialize qw/vp8_sub_pixel_variance16x16 mmx sse2 ssse3 media neon/;
-$vp8_sub_pixel_variance16x16_sse2=vp8_sub_pixel_variance16x16_wmt;
-$vp8_sub_pixel_variance16x16_media=vp8_sub_pixel_variance16x16_armv6;
-
-add_proto qw/unsigned int vp8_variance_halfpixvar16x16_h/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance_halfpixvar16x16_h mmx sse2 media neon/;
-$vp8_variance_halfpixvar16x16_h_sse2=vp8_variance_halfpixvar16x16_h_wmt;
-$vp8_variance_halfpixvar16x16_h_media=vp8_variance_halfpixvar16x16_h_armv6;
-
-add_proto qw/unsigned int vp8_variance_halfpixvar16x16_v/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance_halfpixvar16x16_v mmx sse2 media neon/;
-$vp8_variance_halfpixvar16x16_v_sse2=vp8_variance_halfpixvar16x16_v_wmt;
-$vp8_variance_halfpixvar16x16_v_media=vp8_variance_halfpixvar16x16_v_armv6;
-
-add_proto qw/unsigned int vp8_variance_halfpixvar16x16_hv/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_variance_halfpixvar16x16_hv mmx sse2 media neon/;
-$vp8_variance_halfpixvar16x16_hv_sse2=vp8_variance_halfpixvar16x16_hv_wmt;
-$vp8_variance_halfpixvar16x16_hv_media=vp8_variance_halfpixvar16x16_hv_armv6;
-
-#
-# Single block SAD
-#
-add_proto qw/unsigned int vp8_sad4x4/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp8_sad4x4 mmx sse2 neon/;
-$vp8_sad4x4_sse2=vp8_sad4x4_wmt;
-
-add_proto qw/unsigned int vp8_sad8x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp8_sad8x8 mmx sse2 neon/;
-$vp8_sad8x8_sse2=vp8_sad8x8_wmt;
-
-add_proto qw/unsigned int vp8_sad8x16/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp8_sad8x16 mmx sse2 neon/;
-$vp8_sad8x16_sse2=vp8_sad8x16_wmt;
-
-add_proto qw/unsigned int vp8_sad16x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp8_sad16x8 mmx sse2 neon/;
-$vp8_sad16x8_sse2=vp8_sad16x8_wmt;
-
-add_proto qw/unsigned int vp8_sad16x16/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp8_sad16x16 mmx sse2 sse3 media neon/;
-$vp8_sad16x16_sse2=vp8_sad16x16_wmt;
-$vp8_sad16x16_media=vp8_sad16x16_armv6;
-
-#
-# Multi-block SAD, comparing a reference to N blocks 1 pixel apart horizontally
-#
-add_proto qw/void vp8_sad4x4x3/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad4x4x3 sse3/;
-
-add_proto qw/void vp8_sad8x8x3/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad8x8x3 sse3/;
-
-add_proto qw/void vp8_sad8x16x3/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad8x16x3 sse3/;
-
-add_proto qw/void vp8_sad16x8x3/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad16x8x3 sse3 ssse3/;
-
-add_proto qw/void vp8_sad16x16x3/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad16x16x3 sse3 ssse3/;
-
-# Note the only difference in the following prototypes is that they return into
-# an array of short
-add_proto qw/void vp8_sad4x4x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array";
-specialize qw/vp8_sad4x4x8 sse4_1/;
-$vp8_sad4x4x8_sse4_1=vp8_sad4x4x8_sse4;
-
-add_proto qw/void vp8_sad8x8x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array";
-specialize qw/vp8_sad8x8x8 sse4_1/;
-$vp8_sad8x8x8_sse4_1=vp8_sad8x8x8_sse4;
-
-add_proto qw/void vp8_sad8x16x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array";
-specialize qw/vp8_sad8x16x8 sse4_1/;
-$vp8_sad8x16x8_sse4_1=vp8_sad8x16x8_sse4;
-
-add_proto qw/void vp8_sad16x8x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array";
-specialize qw/vp8_sad16x8x8 sse4_1/;
-$vp8_sad16x8x8_sse4_1=vp8_sad16x8x8_sse4;
-
-add_proto qw/void vp8_sad16x16x8/, "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array";
-specialize qw/vp8_sad16x16x8 sse4_1/;
-$vp8_sad16x16x8_sse4_1=vp8_sad16x16x8_sse4;
-
-#
-# Multi-block SAD, comparing a reference to N independent blocks
-#
-add_proto qw/void vp8_sad4x4x4d/, "const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad4x4x4d sse3/;
-
-add_proto qw/void vp8_sad8x8x4d/, "const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad8x8x4d sse3/;
-
-add_proto qw/void vp8_sad8x16x4d/, "const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad8x16x4d sse3/;
-
-add_proto qw/void vp8_sad16x8x4d/, "const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad16x8x4d sse3/;
-
-add_proto qw/void vp8_sad16x16x4d/, "const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp8_sad16x16x4d sse3/;
-
-#
-# Encoder functions below this point.
-#
-if (vpx_config("CONFIG_VP8_ENCODER") eq "yes") {
-
-#
-# Sum of squares (vector)
-#
-add_proto qw/unsigned int vp8_get_mb_ss/, "const short *";
-specialize qw/vp8_get_mb_ss mmx sse2/;
-
-#
-# SSE (Sum Squared Error)
-#
-add_proto qw/unsigned int vp8_sub_pixel_mse16x16/, "const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse";
-specialize qw/vp8_sub_pixel_mse16x16 mmx sse2/;
-$vp8_sub_pixel_mse16x16_sse2=vp8_sub_pixel_mse16x16_wmt;
-
-add_proto qw/unsigned int vp8_mse16x16/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp8_mse16x16 mmx sse2 media neon/;
-$vp8_mse16x16_sse2=vp8_mse16x16_wmt;
-$vp8_mse16x16_media=vp8_mse16x16_armv6;
-
-add_proto qw/unsigned int vp8_get4x4sse_cs/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride";
-specialize qw/vp8_get4x4sse_cs mmx neon/;
-
-#
-# Block copy
-#
-if ($opts{arch} =~ /x86/) {
- add_proto qw/void vp8_copy32xn/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, int n";
- specialize qw/vp8_copy32xn sse2 sse3/;
-}
-
-#
-# Structured Similarity (SSIM)
-#
-if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") {
- $opts{arch} eq "x86_64" and $sse2_on_x86_64 = "sse2";
-
- add_proto qw/void vp8_ssim_parms_8x8/, "unsigned char *s, int sp, unsigned char *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr";
- specialize qw/vp8_ssim_parms_8x8/, "$sse2_on_x86_64";
-
- add_proto qw/void vp8_ssim_parms_16x16/, "unsigned char *s, int sp, unsigned char *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr";
- specialize qw/vp8_ssim_parms_16x16/, "$sse2_on_x86_64";
-}
-
-#
-# Forward DCT
-#
-add_proto qw/void vp8_short_fdct4x4/, "short *input, short *output, int pitch";
-specialize qw/vp8_short_fdct4x4 mmx sse2 media neon/;
-$vp8_short_fdct4x4_media=vp8_short_fdct4x4_armv6;
-
-add_proto qw/void vp8_short_fdct8x4/, "short *input, short *output, int pitch";
-specialize qw/vp8_short_fdct8x4 mmx sse2 media neon/;
-$vp8_short_fdct8x4_media=vp8_short_fdct8x4_armv6;
-
-add_proto qw/void vp8_short_walsh4x4/, "short *input, short *output, int pitch";
-specialize qw/vp8_short_walsh4x4 sse2 media neon/;
-$vp8_short_walsh4x4_media=vp8_short_walsh4x4_armv6;
-
-#
-# Quantizer
-#
-add_proto qw/void vp8_regular_quantize_b/, "struct block *, struct blockd *";
-specialize qw/vp8_regular_quantize_b sse2/;
-# TODO(johann) Update sse4 implementation and re-enable
-#$vp8_regular_quantize_b_sse4_1=vp8_regular_quantize_b_sse4;
-
-add_proto qw/void vp8_fast_quantize_b/, "struct block *, struct blockd *";
-specialize qw/vp8_fast_quantize_b sse2 ssse3 media neon/;
-$vp8_fast_quantize_b_media=vp8_fast_quantize_b_armv6;
-
-add_proto qw/void vp8_regular_quantize_b_pair/, "struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2";
-# no asm yet
-
-add_proto qw/void vp8_fast_quantize_b_pair/, "struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2";
-specialize qw/vp8_fast_quantize_b_pair neon/;
-
-add_proto qw/void vp8_quantize_mb/, "struct macroblock *";
-specialize qw/vp8_quantize_mb neon/;
-
-add_proto qw/void vp8_quantize_mby/, "struct macroblock *";
-specialize qw/vp8_quantize_mby neon/;
-
-add_proto qw/void vp8_quantize_mbuv/, "struct macroblock *";
-specialize qw/vp8_quantize_mbuv neon/;
-
-#
-# Block subtraction
-#
-add_proto qw/int vp8_block_error/, "short *coeff, short *dqcoeff";
-specialize qw/vp8_block_error mmx sse2/;
-$vp8_block_error_sse2=vp8_block_error_xmm;
-
-add_proto qw/int vp8_mbblock_error/, "struct macroblock *mb, int dc";
-specialize qw/vp8_mbblock_error mmx sse2/;
-$vp8_mbblock_error_sse2=vp8_mbblock_error_xmm;
-
-add_proto qw/int vp8_mbuverror/, "struct macroblock *mb";
-specialize qw/vp8_mbuverror mmx sse2/;
-$vp8_mbuverror_sse2=vp8_mbuverror_xmm;
-
-add_proto qw/void vp8_subtract_b/, "struct block *be, struct blockd *bd, int pitch";
-specialize qw/vp8_subtract_b mmx sse2 media neon/;
-$vp8_subtract_b_media=vp8_subtract_b_armv6;
-
-add_proto qw/void vp8_subtract_mby/, "short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride";
-specialize qw/vp8_subtract_mby mmx sse2 media neon/;
-$vp8_subtract_mby_media=vp8_subtract_mby_armv6;
-
-add_proto qw/void vp8_subtract_mbuv/, "short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride";
-specialize qw/vp8_subtract_mbuv mmx sse2 media neon/;
-$vp8_subtract_mbuv_media=vp8_subtract_mbuv_armv6;
-
-#
-# Motion search
-#
-add_proto qw/int vp8_full_search_sad/, "struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv";
-specialize qw/vp8_full_search_sad sse3 sse4_1/;
-$vp8_full_search_sad_sse3=vp8_full_search_sadx3;
-$vp8_full_search_sad_sse4_1=vp8_full_search_sadx8;
-
-add_proto qw/int vp8_refining_search_sad/, "struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv";
-specialize qw/vp8_refining_search_sad sse3/;
-$vp8_refining_search_sad_sse3=vp8_refining_search_sadx4;
-
-add_proto qw/int vp8_diamond_search_sad/, "struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv";
-$vp8_diamond_search_sad_sse3=vp8_diamond_search_sadx4;
-
-#
-# Alt-ref Noise Reduction (ARNR)
-#
-if (vpx_config("CONFIG_REALTIME_ONLY") ne "yes") {
- add_proto qw/void vp8_temporal_filter_apply/, "unsigned char *frame1, unsigned int stride, unsigned char *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, unsigned short *count";
- specialize qw/vp8_temporal_filter_apply sse2/;
-}
-
-#
-# Pick Loopfilter
-#
-add_proto qw/void vp8_yv12_copy_partial_frame/, "struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
-specialize qw/vp8_yv12_copy_partial_frame neon/;
-
-#
-# Denoiser filter
-#
-if (vpx_config("CONFIG_TEMPORAL_DENOISING") eq "yes") {
- add_proto qw/int vp8_denoiser_filter/, "struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset";
- specialize qw/vp8_denoiser_filter sse2 neon/;
-}
-
-# End of encoder only functions
-}
-1;
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/sad_c.c b/videocodec/libvpx_internal/libvpx/vp8/common/sad_c.c
deleted file mode 100644
index 5f36fc9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/sad_c.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <limits.h>
-#include <stdlib.h>
-#include "vpx_config.h"
-#include "vpx/vpx_integer.h"
-
-static unsigned int sad_mx_n_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int max_sad, int m, int n)
-{
- int r, c;
- unsigned int sad = 0;
-
- for (r = 0; r < n; r++)
- {
- for (c = 0; c < m; c++)
- {
- sad += abs(src_ptr[c] - ref_ptr[c]);
- }
-
- if (sad > max_sad)
- break;
-
- src_ptr += src_stride;
- ref_ptr += ref_stride;
- }
-
- return sad;
-}
-
-/* max_sad is provided as an optional optimization point. Alternative
- * implementations of these functions are not required to check it.
- */
-
-unsigned int vp8_sad16x16_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int max_sad)
-{
- return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, max_sad, 16, 16);
-}
-
-unsigned int vp8_sad8x8_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int max_sad)
-{
- return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, max_sad, 8, 8);
-}
-
-unsigned int vp8_sad16x8_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int max_sad)
-{
- return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, max_sad, 16, 8);
-
-}
-
-unsigned int vp8_sad8x16_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int max_sad)
-{
- return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, max_sad, 8, 16);
-}
-
-unsigned int vp8_sad4x4_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int max_sad)
-{
- return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, max_sad, 4, 4);
-}
-
-void vp8_sad16x16x3_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
-}
-
-void vp8_sad16x16x8_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned short *sad_array)
-{
- sad_array[0] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
- sad_array[3] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, UINT_MAX);
- sad_array[4] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, UINT_MAX);
- sad_array[5] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, UINT_MAX);
- sad_array[6] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, UINT_MAX);
- sad_array[7] = (unsigned short)vp8_sad16x16_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, UINT_MAX);
-}
-
-void vp8_sad16x8x3_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
-}
-
-void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned short *sad_array)
-{
- sad_array[0] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
- sad_array[3] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, UINT_MAX);
- sad_array[4] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, UINT_MAX);
- sad_array[5] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, UINT_MAX);
- sad_array[6] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, UINT_MAX);
- sad_array[7] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, UINT_MAX);
-}
-
-void vp8_sad8x8x3_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
-}
-
-void vp8_sad8x8x8_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned short *sad_array)
-{
- sad_array[0] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
- sad_array[3] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, UINT_MAX);
- sad_array[4] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, UINT_MAX);
- sad_array[5] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, UINT_MAX);
- sad_array[6] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, UINT_MAX);
- sad_array[7] = (unsigned short)vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, UINT_MAX);
-}
-
-void vp8_sad8x16x3_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
-}
-
-void vp8_sad8x16x8_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned short *sad_array)
-{
- sad_array[0] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
- sad_array[3] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, UINT_MAX);
- sad_array[4] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, UINT_MAX);
- sad_array[5] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, UINT_MAX);
- sad_array[6] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, UINT_MAX);
- sad_array[7] = (unsigned short)vp8_sad8x16_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, UINT_MAX);
-}
-
-void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
-}
-
-void vp8_sad4x4x8_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char *ref_ptr, int ref_stride,
- unsigned short *sad_array)
-{
- sad_array[0] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
- sad_array[1] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
- sad_array[2] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
- sad_array[3] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 3, ref_stride, UINT_MAX);
- sad_array[4] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 4, ref_stride, UINT_MAX);
- sad_array[5] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 5, ref_stride, UINT_MAX);
- sad_array[6] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 6, ref_stride, UINT_MAX);
- sad_array[7] = (unsigned short)vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 7, ref_stride, UINT_MAX);
-}
-
-void vp8_sad16x16x4d_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char * const ref_ptr[], int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad16x16_c(src_ptr, src_stride, ref_ptr[0], ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad16x16_c(src_ptr, src_stride, ref_ptr[1], ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad16x16_c(src_ptr, src_stride, ref_ptr[2], ref_stride, UINT_MAX);
- sad_array[3] = vp8_sad16x16_c(src_ptr, src_stride, ref_ptr[3], ref_stride, UINT_MAX);
-}
-
-void vp8_sad16x8x4d_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char * const ref_ptr[], int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad16x8_c(src_ptr, src_stride, ref_ptr[0], ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad16x8_c(src_ptr, src_stride, ref_ptr[1], ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad16x8_c(src_ptr, src_stride, ref_ptr[2], ref_stride, UINT_MAX);
- sad_array[3] = vp8_sad16x8_c(src_ptr, src_stride, ref_ptr[3], ref_stride, UINT_MAX);
-}
-
-void vp8_sad8x8x4d_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char * const ref_ptr[], int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad8x8_c(src_ptr, src_stride, ref_ptr[0], ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad8x8_c(src_ptr, src_stride, ref_ptr[1], ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad8x8_c(src_ptr, src_stride, ref_ptr[2], ref_stride, UINT_MAX);
- sad_array[3] = vp8_sad8x8_c(src_ptr, src_stride, ref_ptr[3], ref_stride, UINT_MAX);
-}
-
-void vp8_sad8x16x4d_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char * const ref_ptr[], int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad8x16_c(src_ptr, src_stride, ref_ptr[0], ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad8x16_c(src_ptr, src_stride, ref_ptr[1], ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad8x16_c(src_ptr, src_stride, ref_ptr[2], ref_stride, UINT_MAX);
- sad_array[3] = vp8_sad8x16_c(src_ptr, src_stride, ref_ptr[3], ref_stride, UINT_MAX);
-}
-
-void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride,
- const unsigned char * const ref_ptr[], int ref_stride,
- unsigned int *sad_array)
-{
- sad_array[0] = vp8_sad4x4_c(src_ptr, src_stride, ref_ptr[0], ref_stride, UINT_MAX);
- sad_array[1] = vp8_sad4x4_c(src_ptr, src_stride, ref_ptr[1], ref_stride, UINT_MAX);
- sad_array[2] = vp8_sad4x4_c(src_ptr, src_stride, ref_ptr[2], ref_stride, UINT_MAX);
- sad_array[3] = vp8_sad4x4_c(src_ptr, src_stride, ref_ptr[3], ref_stride, UINT_MAX);
-}
-
-/* Copy 2 macroblocks to a buffer */
-void vp8_copy32xn_c(unsigned char *src_ptr, int src_stride,
- unsigned char *dst_ptr, int dst_stride,
- int height)
-{
- int r;
-
- for (r = 0; r < height; r++)
- {
-#if !(CONFIG_FAST_UNALIGNED)
- dst_ptr[0] = src_ptr[0];
- dst_ptr[1] = src_ptr[1];
- dst_ptr[2] = src_ptr[2];
- dst_ptr[3] = src_ptr[3];
- dst_ptr[4] = src_ptr[4];
- dst_ptr[5] = src_ptr[5];
- dst_ptr[6] = src_ptr[6];
- dst_ptr[7] = src_ptr[7];
- dst_ptr[8] = src_ptr[8];
- dst_ptr[9] = src_ptr[9];
- dst_ptr[10] = src_ptr[10];
- dst_ptr[11] = src_ptr[11];
- dst_ptr[12] = src_ptr[12];
- dst_ptr[13] = src_ptr[13];
- dst_ptr[14] = src_ptr[14];
- dst_ptr[15] = src_ptr[15];
- dst_ptr[16] = src_ptr[16];
- dst_ptr[17] = src_ptr[17];
- dst_ptr[18] = src_ptr[18];
- dst_ptr[19] = src_ptr[19];
- dst_ptr[20] = src_ptr[20];
- dst_ptr[21] = src_ptr[21];
- dst_ptr[22] = src_ptr[22];
- dst_ptr[23] = src_ptr[23];
- dst_ptr[24] = src_ptr[24];
- dst_ptr[25] = src_ptr[25];
- dst_ptr[26] = src_ptr[26];
- dst_ptr[27] = src_ptr[27];
- dst_ptr[28] = src_ptr[28];
- dst_ptr[29] = src_ptr[29];
- dst_ptr[30] = src_ptr[30];
- dst_ptr[31] = src_ptr[31];
-#else
- ((uint32_t *)dst_ptr)[0] = ((uint32_t *)src_ptr)[0] ;
- ((uint32_t *)dst_ptr)[1] = ((uint32_t *)src_ptr)[1] ;
- ((uint32_t *)dst_ptr)[2] = ((uint32_t *)src_ptr)[2] ;
- ((uint32_t *)dst_ptr)[3] = ((uint32_t *)src_ptr)[3] ;
- ((uint32_t *)dst_ptr)[4] = ((uint32_t *)src_ptr)[4] ;
- ((uint32_t *)dst_ptr)[5] = ((uint32_t *)src_ptr)[5] ;
- ((uint32_t *)dst_ptr)[6] = ((uint32_t *)src_ptr)[6] ;
- ((uint32_t *)dst_ptr)[7] = ((uint32_t *)src_ptr)[7] ;
-#endif
- src_ptr += src_stride;
- dst_ptr += dst_stride;
-
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.c b/videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.c
deleted file mode 100644
index 60afe51..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "setupintrarecon.h"
-#include "vpx_mem/vpx_mem.h"
-
-void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf)
-{
- int i;
-
- /* set up frame new frame for intra coded blocks */
- vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5);
- for (i = 0; i < ybf->y_height; i++)
- ybf->y_buffer[ybf->y_stride *i - 1] = (unsigned char) 129;
-
- vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
- for (i = 0; i < ybf->uv_height; i++)
- ybf->u_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
-
- vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
- for (i = 0; i < ybf->uv_height; i++)
- ybf->v_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
-
-}
-
-void vp8_setup_intra_recon_top_line(YV12_BUFFER_CONFIG *ybf)
-{
- vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5);
- vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
- vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.h b/videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.h
deleted file mode 100644
index 608f4a9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/setupintrarecon.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_COMMON_SETUPINTRARECON_H_
-#define VP8_COMMON_SETUPINTRARECON_H_
-
-#include "vpx_scale/yv12config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf);
-extern void vp8_setup_intra_recon_top_line(YV12_BUFFER_CONFIG *ybf);
-
-static
-void setup_intra_recon_left(unsigned char *y_buffer,
- unsigned char *u_buffer,
- unsigned char *v_buffer,
- int y_stride,
- int uv_stride)
-{
- int i;
-
- for (i = 0; i < 16; i++)
- y_buffer[y_stride *i] = (unsigned char) 129;
-
- for (i = 0; i < 8; i++)
- u_buffer[uv_stride *i] = (unsigned char) 129;
-
- for (i = 0; i < 8; i++)
- v_buffer[uv_stride *i] = (unsigned char) 129;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_SETUPINTRARECON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.c b/videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.c
deleted file mode 100644
index 73656b3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "swapyv12buffer.h"
-
-void vp8_swap_yv12_buffer(YV12_BUFFER_CONFIG *new_frame, YV12_BUFFER_CONFIG *last_frame)
-{
- unsigned char *temp;
-
- temp = last_frame->buffer_alloc;
- last_frame->buffer_alloc = new_frame->buffer_alloc;
- new_frame->buffer_alloc = temp;
-
- temp = last_frame->y_buffer;
- last_frame->y_buffer = new_frame->y_buffer;
- new_frame->y_buffer = temp;
-
- temp = last_frame->u_buffer;
- last_frame->u_buffer = new_frame->u_buffer;
- new_frame->u_buffer = temp;
-
- temp = last_frame->v_buffer;
- last_frame->v_buffer = new_frame->v_buffer;
- new_frame->v_buffer = temp;
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.h b/videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.h
deleted file mode 100644
index 1d66cd3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/swapyv12buffer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_SWAPYV12BUFFER_H_
-#define VP8_COMMON_SWAPYV12BUFFER_H_
-
-#include "vpx_scale/yv12config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_swap_yv12_buffer(YV12_BUFFER_CONFIG *new_frame, YV12_BUFFER_CONFIG *last_frame);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_SWAPYV12BUFFER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/systemdependent.h b/videocodec/libvpx_internal/libvpx/vp8/common/systemdependent.h
deleted file mode 100644
index 3d44e37..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/systemdependent.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_COMMON_SYSTEMDEPENDENT_H_
-#define VP8_COMMON_SYSTEMDEPENDENT_H_
-
-#include "vpx_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP8Common;
-void vp8_machine_specific_config(struct VP8Common *);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_SYSTEMDEPENDENT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/textblit.c b/videocodec/libvpx_internal/libvpx/vp8/common/textblit.c
deleted file mode 100644
index 1756100..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/textblit.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-
-void vp8_blit_text(const char *msg, unsigned char *address, const int pitch)
-{
- int letter_bitmap;
- unsigned char *output_pos = address;
- int colpos;
- const int font[] =
- {
- 0x0, 0x5C00, 0x8020, 0xAFABEA, 0xD7EC0, 0x1111111, 0x1855740, 0x18000,
- 0x45C0, 0x74400, 0x51140, 0x23880, 0xC4000, 0x21080, 0x80000, 0x111110,
- 0xE9D72E, 0x87E40, 0x12AD732, 0xAAD62A, 0x4F94C4, 0x4D6B7, 0x456AA,
- 0x3E8423, 0xAAD6AA, 0xAAD6A2, 0x2800, 0x2A00, 0x8A880, 0x52940, 0x22A20,
- 0x15422, 0x6AD62E, 0x1E4A53E, 0xAAD6BF, 0x8C62E, 0xE8C63F, 0x118D6BF,
- 0x1094BF, 0xCAC62E, 0x1F2109F, 0x118FE31, 0xF8C628, 0x8A89F, 0x108421F,
- 0x1F1105F, 0x1F4105F, 0xE8C62E, 0x2294BF, 0x164C62E, 0x12694BF, 0x8AD6A2,
- 0x10FC21, 0x1F8421F, 0x744107, 0xF8220F, 0x1151151, 0x117041, 0x119D731,
- 0x47E0, 0x1041041, 0xFC400, 0x10440, 0x1084210, 0x820
- };
- colpos = 0;
-
- while (msg[colpos] != 0)
- {
- char letter = msg[colpos];
- int fontcol, fontrow;
-
- if (letter <= 'Z' && letter >= ' ')
- letter_bitmap = font[letter-' '];
- else if (letter <= 'z' && letter >= 'a')
- letter_bitmap = font[letter-'a'+'A' - ' '];
- else
- letter_bitmap = font[0];
-
- for (fontcol = 6; fontcol >= 0 ; fontcol--)
- for (fontrow = 0; fontrow < 5; fontrow++)
- output_pos[fontrow *pitch + fontcol] =
- ((letter_bitmap >> (fontcol * 5)) & (1 << fontrow) ? 255 : 0);
-
- output_pos += 7;
- colpos++;
- }
-}
-
-static void plot (const int x, const int y, unsigned char *image, const int pitch)
-{
- image [x+y*pitch] ^= 255;
-}
-
-/* Bresenham line algorithm */
-void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image, const int pitch)
-{
- int steep = abs(y1 - y0) > abs(x1 - x0);
- int deltax, deltay;
- int error, ystep, y, x;
-
- if (steep)
- {
- int t;
- t = x0;
- x0 = y0;
- y0 = t;
-
- t = x1;
- x1 = y1;
- y1 = t;
- }
-
- if (x0 > x1)
- {
- int t;
- t = x0;
- x0 = x1;
- x1 = t;
-
- t = y0;
- y0 = y1;
- y1 = t;
- }
-
- deltax = x1 - x0;
- deltay = abs(y1 - y0);
- error = deltax / 2;
-
- y = y0;
-
- if (y0 < y1)
- ystep = 1;
- else
- ystep = -1;
-
- if (steep)
- {
- for (x = x0; x <= x1; x++)
- {
- plot(y,x, image, pitch);
-
- error = error - deltay;
- if (error < 0)
- {
- y = y + ystep;
- error = error + deltax;
- }
- }
- }
- else
- {
- for (x = x0; x <= x1; x++)
- {
- plot(x,y, image, pitch);
-
- error = error - deltay;
- if (error < 0)
- {
- y = y + ystep;
- error = error + deltax;
- }
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/threading.h b/videocodec/libvpx_internal/libvpx/vp8/common/threading.h
deleted file mode 100644
index 1b1c1b1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/threading.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_THREADING_H_
-#define VP8_COMMON_THREADING_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if CONFIG_OS_SUPPORT && CONFIG_MULTITHREAD
-
-/* Thread management macros */
-#ifdef _WIN32
-/* Win32 */
-#include <process.h>
-#include <windows.h>
-#define THREAD_FUNCTION DWORD WINAPI
-#define THREAD_FUNCTION_RETURN DWORD
-#define THREAD_SPECIFIC_INDEX DWORD
-#define pthread_t HANDLE
-#define pthread_attr_t DWORD
-#define pthread_create(thhandle,attr,thfunc,tharg) (int)((*thhandle=(HANDLE)_beginthreadex(NULL,0,(unsigned int (__stdcall *)(void *))thfunc,tharg,0,NULL))==NULL)
-#define pthread_join(thread, result) ((WaitForSingleObject((thread),INFINITE)!=WAIT_OBJECT_0) || !CloseHandle(thread))
-#define pthread_detach(thread) if(thread!=NULL)CloseHandle(thread)
-#define thread_sleep(nms) Sleep(nms)
-#define pthread_cancel(thread) terminate_thread(thread,0)
-#define ts_key_create(ts_key, destructor) {ts_key = TlsAlloc();};
-#define pthread_getspecific(ts_key) TlsGetValue(ts_key)
-#define pthread_setspecific(ts_key, value) TlsSetValue(ts_key, (void *)value)
-#define pthread_self() GetCurrentThreadId()
-
-#elif defined(__OS2__)
-/* OS/2 */
-#define INCL_DOS
-#include <os2.h>
-
-#include <stdlib.h>
-#define THREAD_FUNCTION void
-#define THREAD_FUNCTION_RETURN void
-#define THREAD_SPECIFIC_INDEX PULONG
-#define pthread_t TID
-#define pthread_attr_t ULONG
-#define pthread_create(thhandle,attr,thfunc,tharg) \
- ((int)((*(thhandle)=_beginthread(thfunc,NULL,1024*1024,tharg))==-1))
-#define pthread_join(thread, result) ((int)DosWaitThread(&(thread),0))
-#define pthread_detach(thread) 0
-#define thread_sleep(nms) DosSleep(nms)
-#define pthread_cancel(thread) DosKillThread(thread)
-#define ts_key_create(ts_key, destructor) \
- DosAllocThreadLocalMemory(1, &(ts_key));
-#define pthread_getspecific(ts_key) ((void *)(*(ts_key)))
-#define pthread_setspecific(ts_key, value) (*(ts_key)=(ULONG)(value))
-#define pthread_self() _gettid()
-#else
-#ifdef __APPLE__
-#include <mach/mach_init.h>
-#include <mach/semaphore.h>
-#include <mach/task.h>
-#include <time.h>
-#include <unistd.h>
-
-#else
-#include <semaphore.h>
-#endif
-
-#include <pthread.h>
-/* pthreads */
-/* Nearly everything is already defined */
-#define THREAD_FUNCTION void *
-#define THREAD_FUNCTION_RETURN void *
-#define THREAD_SPECIFIC_INDEX pthread_key_t
-#define ts_key_create(ts_key, destructor) pthread_key_create (&(ts_key), destructor);
-#endif
-
-/* Syncrhronization macros: Win32 and Pthreads */
-#ifdef _WIN32
-#define sem_t HANDLE
-#define pause(voidpara) __asm PAUSE
-#define sem_init(sem, sem_attr1, sem_init_value) (int)((*sem = CreateSemaphore(NULL,0,32768,NULL))==NULL)
-#define sem_wait(sem) (int)(WAIT_OBJECT_0 != WaitForSingleObject(*sem,INFINITE))
-#define sem_post(sem) ReleaseSemaphore(*sem,1,NULL)
-#define sem_destroy(sem) if(*sem)((int)(CloseHandle(*sem))==TRUE)
-#define thread_sleep(nms) Sleep(nms)
-
-#elif defined(__OS2__)
-typedef struct
-{
- HEV event;
- HMTX wait_mutex;
- HMTX count_mutex;
- int count;
-} sem_t;
-
-static inline int sem_init(sem_t *sem, int pshared, unsigned int value)
-{
- DosCreateEventSem(NULL, &sem->event, pshared ? DC_SEM_SHARED : 0,
- value > 0 ? TRUE : FALSE);
- DosCreateMutexSem(NULL, &sem->wait_mutex, 0, FALSE);
- DosCreateMutexSem(NULL, &sem->count_mutex, 0, FALSE);
-
- sem->count = value;
-
- return 0;
-}
-
-static inline int sem_wait(sem_t * sem)
-{
- DosRequestMutexSem(sem->wait_mutex, -1);
-
- DosWaitEventSem(sem->event, -1);
-
- DosRequestMutexSem(sem->count_mutex, -1);
-
- sem->count--;
- if (sem->count == 0)
- {
- ULONG post_count;
-
- DosResetEventSem(sem->event, &post_count);
- }
-
- DosReleaseMutexSem(sem->count_mutex);
-
- DosReleaseMutexSem(sem->wait_mutex);
-
- return 0;
-}
-
-static inline int sem_post(sem_t * sem)
-{
- DosRequestMutexSem(sem->count_mutex, -1);
-
- if (sem->count < 32768)
- {
- sem->count++;
- DosPostEventSem(sem->event);
- }
-
- DosReleaseMutexSem(sem->count_mutex);
-
- return 0;
-}
-
-static inline int sem_destroy(sem_t * sem)
-{
- DosCloseEventSem(sem->event);
- DosCloseMutexSem(sem->wait_mutex);
- DosCloseMutexSem(sem->count_mutex);
-
- return 0;
-}
-
-#define thread_sleep(nms) DosSleep(nms)
-
-#else
-
-#ifdef __APPLE__
-#define sem_t semaphore_t
-#define sem_init(X,Y,Z) semaphore_create(mach_task_self(), X, SYNC_POLICY_FIFO, Z)
-#define sem_wait(sem) (semaphore_wait(*sem) )
-#define sem_post(sem) semaphore_signal(*sem)
-#define sem_destroy(sem) semaphore_destroy(mach_task_self(),*sem)
-#define thread_sleep(nms) /* { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */
-#else
-#include <unistd.h>
-#include <sched.h>
-#define thread_sleep(nms) sched_yield();/* {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */
-#endif
-/* Not Windows. Assume pthreads */
-
-#endif
-
-#if ARCH_X86_32 || ARCH_X86_64
-#include "vpx_ports/x86.h"
-#else
-#define x86_pause_hint()
-#endif
-
-#endif /* CONFIG_OS_SUPPORT && CONFIG_MULTITHREAD */
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_THREADING_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/treecoder.c b/videocodec/libvpx_internal/libvpx/vp8/common/treecoder.c
deleted file mode 100644
index d80c64b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/treecoder.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#if CONFIG_DEBUG
-#include <assert.h>
-#endif
-#include <stdio.h>
-
-#include "treecoder.h"
-
-static void tree2tok(
- struct vp8_token_struct *const p,
- vp8_tree t,
- int i,
- int v,
- int L
-)
-{
- v += v;
- ++L;
-
- do
- {
- const vp8_tree_index j = t[i++];
-
- if (j <= 0)
- {
- p[-j].value = v;
- p[-j].Len = L;
- }
- else
- tree2tok(p, t, j, v, L);
- }
- while (++v & 1);
-}
-
-void vp8_tokens_from_tree(struct vp8_token_struct *p, vp8_tree t)
-{
- tree2tok(p, t, 0, 0, 0);
-}
-
-void vp8_tokens_from_tree_offset(struct vp8_token_struct *p, vp8_tree t,
- int offset)
-{
- tree2tok(p - offset, t, 0, 0, 0);
-}
-
-static void branch_counts(
- int n, /* n = size of alphabet */
- vp8_token tok [ /* n */ ],
- vp8_tree tree,
- unsigned int branch_ct [ /* n-1 */ ] [2],
- const unsigned int num_events[ /* n */ ]
-)
-{
- const int tree_len = n - 1;
- int t = 0;
-
-#if CONFIG_DEBUG
- assert(tree_len);
-#endif
-
- do
- {
- branch_ct[t][0] = branch_ct[t][1] = 0;
- }
- while (++t < tree_len);
-
- t = 0;
-
- do
- {
- int L = tok[t].Len;
- const int enc = tok[t].value;
- const unsigned int ct = num_events[t];
-
- vp8_tree_index i = 0;
-
- do
- {
- const int b = (enc >> --L) & 1;
- const int j = i >> 1;
-#if CONFIG_DEBUG
- assert(j < tree_len && 0 <= L);
-#endif
-
- branch_ct [j] [b] += ct;
- i = tree[ i + b];
- }
- while (i > 0);
-
-#if CONFIG_DEBUG
- assert(!L);
-#endif
- }
- while (++t < n);
-
-}
-
-
-void vp8_tree_probs_from_distribution(
- int n, /* n = size of alphabet */
- vp8_token tok [ /* n */ ],
- vp8_tree tree,
- vp8_prob probs [ /* n-1 */ ],
- unsigned int branch_ct [ /* n-1 */ ] [2],
- const unsigned int num_events[ /* n */ ],
- unsigned int Pfac,
- int rd
-)
-{
- const int tree_len = n - 1;
- int t = 0;
-
- branch_counts(n, tok, tree, branch_ct, num_events);
-
- do
- {
- const unsigned int *const c = branch_ct[t];
- const unsigned int tot = c[0] + c[1];
-
-#if CONFIG_DEBUG
- assert(tot < (1 << 24)); /* no overflow below */
-#endif
-
- if (tot)
- {
- const unsigned int p = ((c[0] * Pfac) + (rd ? tot >> 1 : 0)) / tot;
- probs[t] = p < 256 ? (p ? p : 1) : 255; /* agree w/old version for now */
- }
- else
- probs[t] = vp8_prob_half;
- }
- while (++t < tree_len);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/treecoder.h b/videocodec/libvpx_internal/libvpx/vp8/common/treecoder.h
deleted file mode 100644
index d22b7c5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/treecoder.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_TREECODER_H_
-#define VP8_COMMON_TREECODER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef unsigned char vp8bc_index_t; /* probability index */
-
-
-typedef unsigned char vp8_prob;
-
-#define vp8_prob_half ( (vp8_prob) 128)
-
-typedef signed char vp8_tree_index;
-struct bool_coder_spec;
-
-typedef struct bool_coder_spec bool_coder_spec;
-typedef struct bool_writer bool_writer;
-typedef struct bool_reader bool_reader;
-
-typedef const bool_coder_spec c_bool_coder_spec;
-typedef const bool_writer c_bool_writer;
-typedef const bool_reader c_bool_reader;
-
-
-
-# define vp8_complement( x) (255 - x)
-
-
-/* We build coding trees compactly in arrays.
- Each node of the tree is a pair of vp8_tree_indices.
- Array index often references a corresponding probability table.
- Index <= 0 means done encoding/decoding and value = -Index,
- Index > 0 means need another bit, specification at index.
- Nonnegative indices are always even; processing begins at node 0. */
-
-typedef const vp8_tree_index vp8_tree[], *vp8_tree_p;
-
-
-typedef const struct vp8_token_struct
-{
- int value;
- int Len;
-} vp8_token;
-
-/* Construct encoding array from tree. */
-
-void vp8_tokens_from_tree(struct vp8_token_struct *, vp8_tree);
-void vp8_tokens_from_tree_offset(struct vp8_token_struct *, vp8_tree,
- int offset);
-
-
-/* Convert array of token occurrence counts into a table of probabilities
- for the associated binary encoding tree. Also writes count of branches
- taken for each node on the tree; this facilitiates decisions as to
- probability updates. */
-
-void vp8_tree_probs_from_distribution(
- int n, /* n = size of alphabet */
- vp8_token tok [ /* n */ ],
- vp8_tree tree,
- vp8_prob probs [ /* n-1 */ ],
- unsigned int branch_ct [ /* n-1 */ ] [2],
- const unsigned int num_events[ /* n */ ],
- unsigned int Pfactor,
- int Round
-);
-
-/* Variant of above using coder spec rather than hardwired 8-bit probs. */
-
-void vp8bc_tree_probs_from_distribution(
- int n, /* n = size of alphabet */
- vp8_token tok [ /* n */ ],
- vp8_tree tree,
- vp8_prob probs [ /* n-1 */ ],
- unsigned int branch_ct [ /* n-1 */ ] [2],
- const unsigned int num_events[ /* n */ ],
- c_bool_coder_spec *s
-);
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_TREECODER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/variance.h b/videocodec/libvpx_internal/libvpx/vp8/common/variance.h
deleted file mode 100644
index ba9d176..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/variance.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_COMMON_VARIANCE_H_
-#define VP8_COMMON_VARIANCE_H_
-
-#include "vpx_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef unsigned int(*vp8_sad_fn_t)(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int ref_stride,
- unsigned int max_sad);
-
-typedef void (*vp8_copy32xn_fn_t)(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int ref_stride,
- int n);
-
-typedef void (*vp8_sad_multi_fn_t)(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int ref_stride,
- unsigned int *sad_array);
-
-typedef void (*vp8_sad_multi1_fn_t)
- (
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int ref_stride,
- unsigned short *sad_array
- );
-
-typedef void (*vp8_sad_multi_d_fn_t)
- (
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char * const ref_ptr[],
- int ref_stride,
- unsigned int *sad_array
- );
-
-typedef unsigned int (*vp8_variance_fn_t)
- (
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int ref_stride,
- unsigned int *sse
- );
-
-typedef unsigned int (*vp8_subpixvariance_fn_t)
- (
- const unsigned char *src_ptr,
- int source_stride,
- int xoffset,
- int yoffset,
- const unsigned char *ref_ptr,
- int Refstride,
- unsigned int *sse
- );
-
-typedef void (*vp8_ssimpf_fn_t)
- (
- unsigned char *s,
- int sp,
- unsigned char *r,
- int rp,
- unsigned long *sum_s,
- unsigned long *sum_r,
- unsigned long *sum_sq_s,
- unsigned long *sum_sq_r,
- unsigned long *sum_sxr
- );
-
-typedef unsigned int (*vp8_getmbss_fn_t)(const short *);
-
-typedef unsigned int (*vp8_get16x16prederror_fn_t)
- (
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int ref_stride
- );
-
-typedef struct variance_vtable
-{
- vp8_sad_fn_t sdf;
- vp8_variance_fn_t vf;
- vp8_subpixvariance_fn_t svf;
- vp8_variance_fn_t svf_halfpix_h;
- vp8_variance_fn_t svf_halfpix_v;
- vp8_variance_fn_t svf_halfpix_hv;
- vp8_sad_multi_fn_t sdx3f;
- vp8_sad_multi1_fn_t sdx8f;
- vp8_sad_multi_d_fn_t sdx4df;
-#if ARCH_X86_32 || ARCH_X86_64
- vp8_copy32xn_fn_t copymem;
-#endif
-} vp8_variance_fn_ptr_t;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_VARIANCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/variance_c.c b/videocodec/libvpx_internal/libvpx/vp8/common/variance_c.c
deleted file mode 100644
index 773b655..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/variance_c.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "variance.h"
-#include "filter.h"
-
-
-unsigned int vp8_get_mb_ss_c
-(
- const short *src_ptr
-)
-{
- unsigned int i = 0, sum = 0;
-
- do
- {
- sum += (src_ptr[i] * src_ptr[i]);
- i++;
- }
- while (i < 256);
-
- return sum;
-}
-
-
-static void variance(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- int w,
- int h,
- unsigned int *sse,
- int *sum)
-{
- int i, j;
- int diff;
-
- *sum = 0;
- *sse = 0;
-
- for (i = 0; i < h; i++)
- {
- for (j = 0; j < w; j++)
- {
- diff = src_ptr[j] - ref_ptr[j];
- *sum += diff;
- *sse += diff * diff;
- }
-
- src_ptr += source_stride;
- ref_ptr += recon_stride;
- }
-}
-
-
-unsigned int vp8_variance16x16_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 8));
-}
-
-unsigned int vp8_variance8x16_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-}
-
-unsigned int vp8_variance16x8_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-}
-
-
-unsigned int vp8_variance8x8_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 6));
-}
-
-unsigned int vp8_variance4x4_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 4, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 4));
-}
-
-
-unsigned int vp8_mse16x16_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg);
- *sse = var;
- return var;
-}
-
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_first_pass
- *
- * INPUTS : UINT8 *src_ptr : Pointer to source block.
- * UINT32 src_pixels_per_line : Stride of input block.
- * UINT32 pixel_step : Offset between filter input samples (see notes).
- * UINT32 output_height : Input block height.
- * UINT32 output_width : Input block width.
- * INT32 *vp8_filter : Array of 2 bi-linear filter taps.
- *
- * OUTPUTS : INT32 *output_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
- * either horizontal or vertical direction to produce the
- * filtered output block. Used to implement first-pass
- * of 2-D separable filter.
- *
- * SPECIAL NOTES : Produces INT32 output to retain precision for next pass.
- * Two filter taps should sum to VP8_FILTER_WEIGHT.
- * pixel_step defines whether the filter is applied
- * horizontally (pixel_step=1) or vertically (pixel_step=stride).
- * It defines the offset required to move from one input
- * to the next.
- *
- ****************************************************************************/
-static void var_filter_block2d_bil_first_pass
-(
- const unsigned char *src_ptr,
- unsigned short *output_ptr,
- unsigned int src_pixels_per_line,
- int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-)
-{
- unsigned int i, j;
-
- for (i = 0; i < output_height; i++)
- {
- for (j = 0; j < output_width; j++)
- {
- /* Apply bilinear filter */
- output_ptr[j] = (((int)src_ptr[0] * vp8_filter[0]) +
- ((int)src_ptr[pixel_step] * vp8_filter[1]) +
- (VP8_FILTER_WEIGHT / 2)) >> VP8_FILTER_SHIFT;
- src_ptr++;
- }
-
- /* Next row... */
- src_ptr += src_pixels_per_line - output_width;
- output_ptr += output_width;
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_second_pass
- *
- * INPUTS : INT32 *src_ptr : Pointer to source block.
- * UINT32 src_pixels_per_line : Stride of input block.
- * UINT32 pixel_step : Offset between filter input samples (see notes).
- * UINT32 output_height : Input block height.
- * UINT32 output_width : Input block width.
- * INT32 *vp8_filter : Array of 2 bi-linear filter taps.
- *
- * OUTPUTS : UINT16 *output_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
- * either horizontal or vertical direction to produce the
- * filtered output block. Used to implement second-pass
- * of 2-D separable filter.
- *
- * SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_first_pass.
- * Two filter taps should sum to VP8_FILTER_WEIGHT.
- * pixel_step defines whether the filter is applied
- * horizontally (pixel_step=1) or vertically (pixel_step=stride).
- * It defines the offset required to move from one input
- * to the next.
- *
- ****************************************************************************/
-static void var_filter_block2d_bil_second_pass
-(
- const unsigned short *src_ptr,
- unsigned char *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-)
-{
- unsigned int i, j;
- int Temp;
-
- for (i = 0; i < output_height; i++)
- {
- for (j = 0; j < output_width; j++)
- {
- /* Apply filter */
- Temp = ((int)src_ptr[0] * vp8_filter[0]) +
- ((int)src_ptr[pixel_step] * vp8_filter[1]) +
- (VP8_FILTER_WEIGHT / 2);
- output_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
- src_ptr++;
- }
-
- /* Next row... */
- src_ptr += src_pixels_per_line - output_width;
- output_ptr += output_width;
- }
-}
-
-
-unsigned int vp8_sub_pixel_variance4x4_c
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- unsigned char temp2[20*16];
- const short *HFilter, *VFilter;
- unsigned short FData3[5*4]; /* Temp data bufffer used in filtering */
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- /* First filter 1d Horizontal */
- var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, 1, 5, 4, HFilter);
-
- /* Now filter Verticaly */
- var_filter_block2d_bil_second_pass(FData3, temp2, 4, 4, 4, 4, VFilter);
-
- return vp8_variance4x4_c(temp2, 4, dst_ptr, dst_pixels_per_line, sse);
-}
-
-
-unsigned int vp8_sub_pixel_variance8x8_c
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- unsigned short FData3[9*8]; /* Temp data bufffer used in filtering */
- unsigned char temp2[20*16];
- const short *HFilter, *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, 1, 9, 8, HFilter);
- var_filter_block2d_bil_second_pass(FData3, temp2, 8, 8, 8, 8, VFilter);
-
- return vp8_variance8x8_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp8_sub_pixel_variance16x16_c
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- unsigned short FData3[17*16]; /* Temp data bufffer used in filtering */
- unsigned char temp2[20*16];
- const short *HFilter, *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, 1, 17, 16, HFilter);
- var_filter_block2d_bil_second_pass(FData3, temp2, 16, 16, 16, 16, VFilter);
-
- return vp8_variance16x16_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_h_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- return vp8_sub_pixel_variance16x16_c(src_ptr, source_stride, 4, 0,
- ref_ptr, recon_stride, sse);
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_v_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- return vp8_sub_pixel_variance16x16_c(src_ptr, source_stride, 0, 4,
- ref_ptr, recon_stride, sse);
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_hv_c(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- return vp8_sub_pixel_variance16x16_c(src_ptr, source_stride, 4, 4,
- ref_ptr, recon_stride, sse);
-}
-
-
-unsigned int vp8_sub_pixel_mse16x16_c
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- vp8_sub_pixel_variance16x16_c(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse);
- return *sse;
-}
-
-unsigned int vp8_sub_pixel_variance16x8_c
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- unsigned short FData3[16*9]; /* Temp data bufffer used in filtering */
- unsigned char temp2[20*16];
- const short *HFilter, *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, 1, 9, 16, HFilter);
- var_filter_block2d_bil_second_pass(FData3, temp2, 16, 16, 8, 16, VFilter);
-
- return vp8_variance16x8_c(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp8_sub_pixel_variance8x16_c
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- unsigned short FData3[9*16]; /* Temp data bufffer used in filtering */
- unsigned char temp2[20*16];
- const short *HFilter, *VFilter;
-
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
-
- var_filter_block2d_bil_first_pass(src_ptr, FData3, src_pixels_per_line, 1, 17, 8, HFilter);
- var_filter_block2d_bil_second_pass(FData3, temp2, 8, 8, 16, 8, VFilter);
-
- return vp8_variance8x16_c(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/vp8_entropymodedata.h b/videocodec/libvpx_internal/libvpx/vp8/common/vp8_entropymodedata.h
deleted file mode 100644
index c4aed49..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/vp8_entropymodedata.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
-*/
-
-#ifndef VP8_COMMON_VP8_ENTROPYMODEDATA_H_
-#define VP8_COMMON_VP8_ENTROPYMODEDATA_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*Generated file, included by entropymode.c*/
-
-
-const struct vp8_token_struct vp8_bmode_encodings[VP8_BINTRAMODES] =
-{
- { 0, 1 },
- { 2, 2 },
- { 6, 3 },
- { 28, 5 },
- { 30, 5 },
- { 58, 6 },
- { 59, 6 },
- { 62, 6 },
- { 126, 7 },
- { 127, 7 }
-};
-
-const struct vp8_token_struct vp8_ymode_encodings[VP8_YMODES] =
-{
- { 0, 1 },
- { 4, 3 },
- { 5, 3 },
- { 6, 3 },
- { 7, 3 }
-};
-
-const struct vp8_token_struct vp8_kf_ymode_encodings[VP8_YMODES] =
-{
- { 4, 3 },
- { 5, 3 },
- { 6, 3 },
- { 7, 3 },
- { 0, 1 }
-};
-
-const struct vp8_token_struct vp8_uv_mode_encodings[VP8_UV_MODES] =
-{
- { 0, 1 },
- { 2, 2 },
- { 6, 3 },
- { 7, 3 }
-};
-
-const struct vp8_token_struct vp8_mbsplit_encodings[VP8_NUMMBSPLITS] =
-{
- { 6, 3 },
- { 7, 3 },
- { 2, 2 },
- { 0, 1 }
-};
-
-const struct vp8_token_struct vp8_mv_ref_encoding_array[VP8_MVREFS] =
-{
- { 2, 2 },
- { 6, 3 },
- { 0, 1 },
- { 14, 4 },
- { 15, 4 }
-};
-
-const struct vp8_token_struct vp8_sub_mv_ref_encoding_array[VP8_SUBMVREFS] =
-{
- { 0, 1 },
- { 2, 2 },
- { 6, 3 },
- { 7, 3 }
-};
-
-const struct vp8_token_struct vp8_small_mvencodings[8] =
-{
- { 0, 3 },
- { 1, 3 },
- { 2, 3 },
- { 3, 3 },
- { 4, 3 },
- { 5, 3 },
- { 6, 3 },
- { 7, 3 }
-};
-
-const vp8_prob vp8_ymode_prob[VP8_YMODES-1] =
-{
- 112, 86, 140, 37
-};
-
-const vp8_prob vp8_kf_ymode_prob[VP8_YMODES-1] =
-{
- 145, 156, 163, 128
-};
-
-const vp8_prob vp8_uv_mode_prob[VP8_UV_MODES-1] =
-{
- 162, 101, 204
-};
-
-const vp8_prob vp8_kf_uv_mode_prob[VP8_UV_MODES-1] =
-{
- 142, 114, 183
-};
-
-const vp8_prob vp8_bmode_prob[VP8_BINTRAMODES-1] =
-{
- 120, 90, 79, 133, 87, 85, 80, 111, 151
-};
-
-
-
-const vp8_prob vp8_kf_bmode_prob
-[VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1] =
-{
- {
- { 231, 120, 48, 89, 115, 113, 120, 152, 112 },
- { 152, 179, 64, 126, 170, 118, 46, 70, 95 },
- { 175, 69, 143, 80, 85, 82, 72, 155, 103 },
- { 56, 58, 10, 171, 218, 189, 17, 13, 152 },
- { 144, 71, 10, 38, 171, 213, 144, 34, 26 },
- { 114, 26, 17, 163, 44, 195, 21, 10, 173 },
- { 121, 24, 80, 195, 26, 62, 44, 64, 85 },
- { 170, 46, 55, 19, 136, 160, 33, 206, 71 },
- { 63, 20, 8, 114, 114, 208, 12, 9, 226 },
- { 81, 40, 11, 96, 182, 84, 29, 16, 36 }
- },
- {
- { 134, 183, 89, 137, 98, 101, 106, 165, 148 },
- { 72, 187, 100, 130, 157, 111, 32, 75, 80 },
- { 66, 102, 167, 99, 74, 62, 40, 234, 128 },
- { 41, 53, 9, 178, 241, 141, 26, 8, 107 },
- { 104, 79, 12, 27, 217, 255, 87, 17, 7 },
- { 74, 43, 26, 146, 73, 166, 49, 23, 157 },
- { 65, 38, 105, 160, 51, 52, 31, 115, 128 },
- { 87, 68, 71, 44, 114, 51, 15, 186, 23 },
- { 47, 41, 14, 110, 182, 183, 21, 17, 194 },
- { 66, 45, 25, 102, 197, 189, 23, 18, 22 }
- },
- {
- { 88, 88, 147, 150, 42, 46, 45, 196, 205 },
- { 43, 97, 183, 117, 85, 38, 35, 179, 61 },
- { 39, 53, 200, 87, 26, 21, 43, 232, 171 },
- { 56, 34, 51, 104, 114, 102, 29, 93, 77 },
- { 107, 54, 32, 26, 51, 1, 81, 43, 31 },
- { 39, 28, 85, 171, 58, 165, 90, 98, 64 },
- { 34, 22, 116, 206, 23, 34, 43, 166, 73 },
- { 68, 25, 106, 22, 64, 171, 36, 225, 114 },
- { 34, 19, 21, 102, 132, 188, 16, 76, 124 },
- { 62, 18, 78, 95, 85, 57, 50, 48, 51 }
- },
- {
- { 193, 101, 35, 159, 215, 111, 89, 46, 111 },
- { 60, 148, 31, 172, 219, 228, 21, 18, 111 },
- { 112, 113, 77, 85, 179, 255, 38, 120, 114 },
- { 40, 42, 1, 196, 245, 209, 10, 25, 109 },
- { 100, 80, 8, 43, 154, 1, 51, 26, 71 },
- { 88, 43, 29, 140, 166, 213, 37, 43, 154 },
- { 61, 63, 30, 155, 67, 45, 68, 1, 209 },
- { 142, 78, 78, 16, 255, 128, 34, 197, 171 },
- { 41, 40, 5, 102, 211, 183, 4, 1, 221 },
- { 51, 50, 17, 168, 209, 192, 23, 25, 82 }
- },
- {
- { 125, 98, 42, 88, 104, 85, 117, 175, 82 },
- { 95, 84, 53, 89, 128, 100, 113, 101, 45 },
- { 75, 79, 123, 47, 51, 128, 81, 171, 1 },
- { 57, 17, 5, 71, 102, 57, 53, 41, 49 },
- { 115, 21, 2, 10, 102, 255, 166, 23, 6 },
- { 38, 33, 13, 121, 57, 73, 26, 1, 85 },
- { 41, 10, 67, 138, 77, 110, 90, 47, 114 },
- { 101, 29, 16, 10, 85, 128, 101, 196, 26 },
- { 57, 18, 10, 102, 102, 213, 34, 20, 43 },
- { 117, 20, 15, 36, 163, 128, 68, 1, 26 }
- },
- {
- { 138, 31, 36, 171, 27, 166, 38, 44, 229 },
- { 67, 87, 58, 169, 82, 115, 26, 59, 179 },
- { 63, 59, 90, 180, 59, 166, 93, 73, 154 },
- { 40, 40, 21, 116, 143, 209, 34, 39, 175 },
- { 57, 46, 22, 24, 128, 1, 54, 17, 37 },
- { 47, 15, 16, 183, 34, 223, 49, 45, 183 },
- { 46, 17, 33, 183, 6, 98, 15, 32, 183 },
- { 65, 32, 73, 115, 28, 128, 23, 128, 205 },
- { 40, 3, 9, 115, 51, 192, 18, 6, 223 },
- { 87, 37, 9, 115, 59, 77, 64, 21, 47 }
- },
- {
- { 104, 55, 44, 218, 9, 54, 53, 130, 226 },
- { 64, 90, 70, 205, 40, 41, 23, 26, 57 },
- { 54, 57, 112, 184, 5, 41, 38, 166, 213 },
- { 30, 34, 26, 133, 152, 116, 10, 32, 134 },
- { 75, 32, 12, 51, 192, 255, 160, 43, 51 },
- { 39, 19, 53, 221, 26, 114, 32, 73, 255 },
- { 31, 9, 65, 234, 2, 15, 1, 118, 73 },
- { 88, 31, 35, 67, 102, 85, 55, 186, 85 },
- { 56, 21, 23, 111, 59, 205, 45, 37, 192 },
- { 55, 38, 70, 124, 73, 102, 1, 34, 98 }
- },
- {
- { 102, 61, 71, 37, 34, 53, 31, 243, 192 },
- { 69, 60, 71, 38, 73, 119, 28, 222, 37 },
- { 68, 45, 128, 34, 1, 47, 11, 245, 171 },
- { 62, 17, 19, 70, 146, 85, 55, 62, 70 },
- { 75, 15, 9, 9, 64, 255, 184, 119, 16 },
- { 37, 43, 37, 154, 100, 163, 85, 160, 1 },
- { 63, 9, 92, 136, 28, 64, 32, 201, 85 },
- { 86, 6, 28, 5, 64, 255, 25, 248, 1 },
- { 56, 8, 17, 132, 137, 255, 55, 116, 128 },
- { 58, 15, 20, 82, 135, 57, 26, 121, 40 }
- },
- {
- { 164, 50, 31, 137, 154, 133, 25, 35, 218 },
- { 51, 103, 44, 131, 131, 123, 31, 6, 158 },
- { 86, 40, 64, 135, 148, 224, 45, 183, 128 },
- { 22, 26, 17, 131, 240, 154, 14, 1, 209 },
- { 83, 12, 13, 54, 192, 255, 68, 47, 28 },
- { 45, 16, 21, 91, 64, 222, 7, 1, 197 },
- { 56, 21, 39, 155, 60, 138, 23, 102, 213 },
- { 85, 26, 85, 85, 128, 128, 32, 146, 171 },
- { 18, 11, 7, 63, 144, 171, 4, 4, 246 },
- { 35, 27, 10, 146, 174, 171, 12, 26, 128 }
- },
- {
- { 190, 80, 35, 99, 180, 80, 126, 54, 45 },
- { 85, 126, 47, 87, 176, 51, 41, 20, 32 },
- { 101, 75, 128, 139, 118, 146, 116, 128, 85 },
- { 56, 41, 15, 176, 236, 85, 37, 9, 62 },
- { 146, 36, 19, 30, 171, 255, 97, 27, 20 },
- { 71, 30, 17, 119, 118, 255, 17, 18, 138 },
- { 101, 38, 60, 138, 55, 70, 43, 26, 142 },
- { 138, 45, 61, 62, 219, 1, 81, 188, 64 },
- { 32, 41, 20, 117, 151, 142, 20, 21, 163 },
- { 112, 19, 12, 61, 195, 128, 48, 4, 24 }
- }
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_VP8_ENTROPYMODEDATA_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/dequantize_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/dequantize_mmx.asm
deleted file mode 100644
index 4e551f0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/dequantize_mmx.asm
+++ /dev/null
@@ -1,258 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-
-;void vp8_dequantize_b_impl_mmx(short *sq, short *dq, short *q)
-global sym(vp8_dequantize_b_impl_mmx) PRIVATE
-sym(vp8_dequantize_b_impl_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;sq
- mov rdi, arg(1) ;dq
- mov rax, arg(2) ;q
-
- movq mm1, [rsi]
- pmullw mm1, [rax+0] ; mm4 *= kernel 0 modifiers.
- movq [rdi], mm1
-
- movq mm1, [rsi+8]
- pmullw mm1, [rax+8] ; mm4 *= kernel 0 modifiers.
- movq [rdi+8], mm1
-
- movq mm1, [rsi+16]
- pmullw mm1, [rax+16] ; mm4 *= kernel 0 modifiers.
- movq [rdi+16], mm1
-
- movq mm1, [rsi+24]
- pmullw mm1, [rax+24] ; mm4 *= kernel 0 modifiers.
- movq [rdi+24], mm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void dequant_idct_add_mmx(
-;short *input, 0
-;short *dq, 1
-;unsigned char *dest, 2
-;int stride) 3
-global sym(vp8_dequant_idct_add_mmx) PRIVATE
-sym(vp8_dequant_idct_add_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- GET_GOT rbx
- push rdi
- ; end prolog
-
- mov rax, arg(0) ;input
- mov rdx, arg(1) ;dq
-
-
- movq mm0, [rax ]
- pmullw mm0, [rdx]
-
- movq mm1, [rax +8]
- pmullw mm1, [rdx +8]
-
- movq mm2, [rax+16]
- pmullw mm2, [rdx+16]
-
- movq mm3, [rax+24]
- pmullw mm3, [rdx+24]
-
- mov rdx, arg(2) ;dest
-
- pxor mm7, mm7
-
-
- movq [rax], mm7
- movq [rax+8], mm7
-
- movq [rax+16],mm7
- movq [rax+24],mm7
-
-
- movsxd rdi, dword ptr arg(3) ;stride
-
- psubw mm0, mm2 ; b1= 0-2
- paddw mm2, mm2 ;
-
- movq mm5, mm1
- paddw mm2, mm0 ; a1 =0+2
-
- pmulhw mm5, [GLOBAL(x_s1sqr2)];
- paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movq mm7, mm3 ;
- pmulhw mm7, [GLOBAL(x_c1sqr2less1)];
-
- paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw mm7, mm5 ; c1
-
- movq mm5, mm1
- movq mm4, mm3
-
- pmulhw mm5, [GLOBAL(x_c1sqr2less1)]
- paddw mm5, mm1
-
- pmulhw mm3, [GLOBAL(x_s1sqr2)]
- paddw mm3, mm4
-
- paddw mm3, mm5 ; d1
- movq mm6, mm2 ; a1
-
- movq mm4, mm0 ; b1
- paddw mm2, mm3 ;0
-
- paddw mm4, mm7 ;1
- psubw mm0, mm7 ;2
-
- psubw mm6, mm3 ;3
-
- movq mm1, mm2 ; 03 02 01 00
- movq mm3, mm4 ; 23 22 21 20
-
- punpcklwd mm1, mm0 ; 11 01 10 00
- punpckhwd mm2, mm0 ; 13 03 12 02
-
- punpcklwd mm3, mm6 ; 31 21 30 20
- punpckhwd mm4, mm6 ; 33 23 32 22
-
- movq mm0, mm1 ; 11 01 10 00
- movq mm5, mm2 ; 13 03 12 02
-
- punpckldq mm0, mm3 ; 30 20 10 00
- punpckhdq mm1, mm3 ; 31 21 11 01
-
- punpckldq mm2, mm4 ; 32 22 12 02
- punpckhdq mm5, mm4 ; 33 23 13 03
-
- movq mm3, mm5 ; 33 23 13 03
-
- psubw mm0, mm2 ; b1= 0-2
- paddw mm2, mm2 ;
-
- movq mm5, mm1
- paddw mm2, mm0 ; a1 =0+2
-
- pmulhw mm5, [GLOBAL(x_s1sqr2)];
- paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movq mm7, mm3 ;
- pmulhw mm7, [GLOBAL(x_c1sqr2less1)];
-
- paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw mm7, mm5 ; c1
-
- movq mm5, mm1
- movq mm4, mm3
-
- pmulhw mm5, [GLOBAL(x_c1sqr2less1)]
- paddw mm5, mm1
-
- pmulhw mm3, [GLOBAL(x_s1sqr2)]
- paddw mm3, mm4
-
- paddw mm3, mm5 ; d1
- paddw mm0, [GLOBAL(fours)]
-
- paddw mm2, [GLOBAL(fours)]
- movq mm6, mm2 ; a1
-
- movq mm4, mm0 ; b1
- paddw mm2, mm3 ;0
-
- paddw mm4, mm7 ;1
- psubw mm0, mm7 ;2
-
- psubw mm6, mm3 ;3
- psraw mm2, 3
-
- psraw mm0, 3
- psraw mm4, 3
-
- psraw mm6, 3
-
- movq mm1, mm2 ; 03 02 01 00
- movq mm3, mm4 ; 23 22 21 20
-
- punpcklwd mm1, mm0 ; 11 01 10 00
- punpckhwd mm2, mm0 ; 13 03 12 02
-
- punpcklwd mm3, mm6 ; 31 21 30 20
- punpckhwd mm4, mm6 ; 33 23 32 22
-
- movq mm0, mm1 ; 11 01 10 00
- movq mm5, mm2 ; 13 03 12 02
-
- punpckldq mm0, mm3 ; 30 20 10 00
- punpckhdq mm1, mm3 ; 31 21 11 01
-
- punpckldq mm2, mm4 ; 32 22 12 02
- punpckhdq mm5, mm4 ; 33 23 13 03
-
- pxor mm7, mm7
-
- movd mm4, [rdx]
- punpcklbw mm4, mm7
- paddsw mm0, mm4
- packuswb mm0, mm7
- movd [rdx], mm0
-
- movd mm4, [rdx+rdi]
- punpcklbw mm4, mm7
- paddsw mm1, mm4
- packuswb mm1, mm7
- movd [rdx+rdi], mm1
-
- movd mm4, [rdx+2*rdi]
- punpcklbw mm4, mm7
- paddsw mm2, mm4
- packuswb mm2, mm7
- movd [rdx+rdi*2], mm2
-
- add rdx, rdi
-
- movd mm4, [rdx+2*rdi]
- punpcklbw mm4, mm7
- paddsw mm5, mm4
- packuswb mm5, mm7
- movd [rdx+rdi*2], mm5
-
- ; begin epilog
- pop rdi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-x_s1sqr2:
- times 4 dw 0x8A8C
-align 16
-x_c1sqr2less1:
- times 4 dw 0x4E7B
-align 16
-fours:
- times 4 dw 0x0004
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.c
deleted file mode 100644
index 7f496ed..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp8/common/x86/filter_x86.h"
-
-DECLARE_ALIGNED(16, const short, vp8_bilinear_filters_x86_4[8][8]) =
-{
- { 128, 128, 128, 128, 0, 0, 0, 0 },
- { 112, 112, 112, 112, 16, 16, 16, 16 },
- { 96, 96, 96, 96, 32, 32, 32, 32 },
- { 80, 80, 80, 80, 48, 48, 48, 48 },
- { 64, 64, 64, 64, 64, 64, 64, 64 },
- { 48, 48, 48, 48, 80, 80, 80, 80 },
- { 32, 32, 32, 32, 96, 96, 96, 96 },
- { 16, 16, 16, 16, 112, 112, 112, 112 }
-};
-
-DECLARE_ALIGNED(16, const short, vp8_bilinear_filters_x86_8[8][16]) =
-{
- { 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 112, 112, 112, 112, 112, 112, 112, 112, 16, 16, 16, 16, 16, 16, 16, 16 },
- { 96, 96, 96, 96, 96, 96, 96, 96, 32, 32, 32, 32, 32, 32, 32, 32 },
- { 80, 80, 80, 80, 80, 80, 80, 80, 48, 48, 48, 48, 48, 48, 48, 48 },
- { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 },
- { 48, 48, 48, 48, 48, 48, 48, 48, 80, 80, 80, 80, 80, 80, 80, 80 },
- { 32, 32, 32, 32, 32, 32, 32, 32, 96, 96, 96, 96, 96, 96, 96, 96 },
- { 16, 16, 16, 16, 16, 16, 16, 16, 112, 112, 112, 112, 112, 112, 112, 112 }
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.h b/videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.h
deleted file mode 100644
index d282841..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/filter_x86.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_COMMON_X86_FILTER_X86_H_
-#define VP8_COMMON_X86_FILTER_X86_H_
-
-#include "vpx_ports/mem.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* x86 assembly specific copy of vp8/common/filter.c:vp8_bilinear_filters with
- * duplicated values */
-
-/* duplicated 4x */
-extern DECLARE_ALIGNED(16, const short, vp8_bilinear_filters_x86_4[8][8]);
-
-/* duplicated 8x */
-extern DECLARE_ALIGNED(16, const short, vp8_bilinear_filters_x86_8[8][16]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_COMMON_X86_FILTER_X86_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_mmx.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_mmx.c
deleted file mode 100644
index a1e4ce6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_mmx.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vp8/common/blockd.h"
-#include "vpx_mem/vpx_mem.h"
-
-extern void vp8_dequantize_b_impl_mmx(short *sq, short *dq, short *q);
-
-void vp8_dequantize_b_mmx(BLOCKD *d, short *DQC)
-{
- short *sq = (short *) d->qcoeff;
- short *dq = (short *) d->dqcoeff;
-
- vp8_dequantize_b_impl_mmx(sq, dq, DQC);
-}
-
-void vp8_dequant_idct_add_y_block_mmx
- (short *q, short *dq,
- unsigned char *dst, int stride, char *eobs)
-{
- int i;
-
- for (i = 0; i < 4; i++)
- {
- if (eobs[0] > 1)
- vp8_dequant_idct_add_mmx (q, dq, dst, stride);
- else if (eobs[0] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[0]*dq[0], dst, stride, dst, stride);
- vpx_memset(q, 0, 2 * sizeof(q[0]));
- }
-
- if (eobs[1] > 1)
- vp8_dequant_idct_add_mmx (q+16, dq, dst+4, stride);
- else if (eobs[1] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[16]*dq[0], dst+4, stride,
- dst+4, stride);
- vpx_memset(q + 16, 0, 2 * sizeof(q[0]));
- }
-
- if (eobs[2] > 1)
- vp8_dequant_idct_add_mmx (q+32, dq, dst+8, stride);
- else if (eobs[2] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[32]*dq[0], dst+8, stride,
- dst+8, stride);
- vpx_memset(q + 32, 0, 2 * sizeof(q[0]));
- }
-
- if (eobs[3] > 1)
- vp8_dequant_idct_add_mmx (q+48, dq, dst+12, stride);
- else if (eobs[3] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[48]*dq[0], dst+12, stride,
- dst+12, stride);
- vpx_memset(q + 48, 0, 2 * sizeof(q[0]));
- }
-
- q += 64;
- dst += 4*stride;
- eobs += 4;
- }
-}
-
-void vp8_dequant_idct_add_uv_block_mmx
- (short *q, short *dq,
- unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
-{
- int i;
-
- for (i = 0; i < 2; i++)
- {
- if (eobs[0] > 1)
- vp8_dequant_idct_add_mmx (q, dq, dstu, stride);
- else if (eobs[0] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[0]*dq[0], dstu, stride, dstu, stride);
- vpx_memset(q, 0, 2 * sizeof(q[0]));
- }
-
- if (eobs[1] > 1)
- vp8_dequant_idct_add_mmx (q+16, dq, dstu+4, stride);
- else if (eobs[1] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[16]*dq[0], dstu+4, stride,
- dstu+4, stride);
- vpx_memset(q + 16, 0, 2 * sizeof(q[0]));
- }
-
- q += 32;
- dstu += 4*stride;
- eobs += 2;
- }
-
- for (i = 0; i < 2; i++)
- {
- if (eobs[0] > 1)
- vp8_dequant_idct_add_mmx (q, dq, dstv, stride);
- else if (eobs[0] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[0]*dq[0], dstv, stride, dstv, stride);
- vpx_memset(q, 0, 2 * sizeof(q[0]));
- }
-
- if (eobs[1] > 1)
- vp8_dequant_idct_add_mmx (q+16, dq, dstv+4, stride);
- else if (eobs[1] == 1)
- {
- vp8_dc_only_idct_add_mmx (q[16]*dq[0], dstv+4, stride,
- dstv+4, stride);
- vpx_memset(q + 16, 0, 2 * sizeof(q[0]));
- }
-
- q += 32;
- dstv += 4*stride;
- eobs += 2;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_sse2.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_sse2.c
deleted file mode 100644
index ae96ec8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idct_blk_sse2.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-
-void vp8_idct_dequant_0_2x_sse2
- (short *q, short *dq ,
- unsigned char *dst, int dst_stride);
-void vp8_idct_dequant_full_2x_sse2
- (short *q, short *dq ,
- unsigned char *dst, int dst_stride);
-
-void vp8_dequant_idct_add_y_block_sse2
- (short *q, short *dq,
- unsigned char *dst, int stride, char *eobs)
-{
- int i;
-
- for (i = 0; i < 4; i++)
- {
- if (((short *)(eobs))[0])
- {
- if (((short *)(eobs))[0] & 0xfefe)
- vp8_idct_dequant_full_2x_sse2 (q, dq, dst, stride);
- else
- vp8_idct_dequant_0_2x_sse2 (q, dq, dst, stride);
- }
- if (((short *)(eobs))[1])
- {
- if (((short *)(eobs))[1] & 0xfefe)
- vp8_idct_dequant_full_2x_sse2 (q+32, dq, dst+8, stride);
- else
- vp8_idct_dequant_0_2x_sse2 (q+32, dq, dst+8, stride);
- }
- q += 64;
- dst += stride*4;
- eobs += 4;
- }
-}
-
-void vp8_dequant_idct_add_uv_block_sse2
- (short *q, short *dq,
- unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
-{
- if (((short *)(eobs))[0])
- {
- if (((short *)(eobs))[0] & 0xfefe)
- vp8_idct_dequant_full_2x_sse2 (q, dq, dstu, stride);
- else
- vp8_idct_dequant_0_2x_sse2 (q, dq, dstu, stride);
- }
- q += 32;
- dstu += stride*4;
-
- if (((short *)(eobs))[1])
- {
- if (((short *)(eobs))[1] & 0xfefe)
- vp8_idct_dequant_full_2x_sse2 (q, dq, dstu, stride);
- else
- vp8_idct_dequant_0_2x_sse2 (q, dq, dstu, stride);
- }
- q += 32;
-
- if (((short *)(eobs))[2])
- {
- if (((short *)(eobs))[2] & 0xfefe)
- vp8_idct_dequant_full_2x_sse2 (q, dq, dstv, stride);
- else
- vp8_idct_dequant_0_2x_sse2 (q, dq, dstv, stride);
- }
- q += 32;
- dstv += stride*4;
-
- if (((short *)(eobs))[3])
- {
- if (((short *)(eobs))[3] & 0xfefe)
- vp8_idct_dequant_full_2x_sse2 (q, dq, dstv, stride);
- else
- vp8_idct_dequant_0_2x_sse2 (q, dq, dstv, stride);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_mmx.asm
deleted file mode 100644
index 96fa2c6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_mmx.asm
+++ /dev/null
@@ -1,295 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-; /****************************************************************************
-; * Notes:
-; *
-; * This implementation makes use of 16 bit fixed point version of two multiply
-; * constants:
-; * 1. sqrt(2) * cos (pi/8)
-; * 2. sqrt(2) * sin (pi/8)
-; * Because the first constant is bigger than 1, to maintain the same 16 bit
-; * fixed point precision as the second one, we use a trick of
-; * x * a = x + x*(a-1)
-; * so
-; * x * sqrt(2) * cos (pi/8) = x + x * (sqrt(2) *cos(pi/8)-1).
-; *
-; * For the second constant, because of the 16bit version is 35468, which
-; * is bigger than 32768, in signed 16 bit multiply, it becomes a negative
-; * number.
-; * (x * (unsigned)35468 >> 16) = x * (signed)35468 >> 16 + x
-; *
-; **************************************************************************/
-
-
-;void vp8_short_idct4x4llm_mmx(short *input, unsigned char *pred,
-;int pitch, unsigned char *dest,int stride)
-global sym(vp8_short_idct4x4llm_mmx) PRIVATE
-sym(vp8_short_idct4x4llm_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rax, arg(0) ;input
- mov rsi, arg(1) ;pred
-
- movq mm0, [rax ]
- movq mm1, [rax+ 8]
- movq mm2, [rax+16]
- movq mm3, [rax+24]
-
-%if 0
- pxor mm7, mm7
- movq [rax], mm7
- movq [rax+8], mm7
- movq [rax+16],mm7
- movq [rax+24],mm7
-%endif
- movsxd rax, dword ptr arg(2) ;pitch
- mov rdx, arg(3) ;dest
- movsxd rdi, dword ptr arg(4) ;stride
-
-
- psubw mm0, mm2 ; b1= 0-2
- paddw mm2, mm2 ;
-
- movq mm5, mm1
- paddw mm2, mm0 ; a1 =0+2
-
- pmulhw mm5, [GLOBAL(x_s1sqr2)];
- paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movq mm7, mm3 ;
- pmulhw mm7, [GLOBAL(x_c1sqr2less1)];
-
- paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw mm7, mm5 ; c1
-
- movq mm5, mm1
- movq mm4, mm3
-
- pmulhw mm5, [GLOBAL(x_c1sqr2less1)]
- paddw mm5, mm1
-
- pmulhw mm3, [GLOBAL(x_s1sqr2)]
- paddw mm3, mm4
-
- paddw mm3, mm5 ; d1
- movq mm6, mm2 ; a1
-
- movq mm4, mm0 ; b1
- paddw mm2, mm3 ;0
-
- paddw mm4, mm7 ;1
- psubw mm0, mm7 ;2
-
- psubw mm6, mm3 ;3
-
- movq mm1, mm2 ; 03 02 01 00
- movq mm3, mm4 ; 23 22 21 20
-
- punpcklwd mm1, mm0 ; 11 01 10 00
- punpckhwd mm2, mm0 ; 13 03 12 02
-
- punpcklwd mm3, mm6 ; 31 21 30 20
- punpckhwd mm4, mm6 ; 33 23 32 22
-
- movq mm0, mm1 ; 11 01 10 00
- movq mm5, mm2 ; 13 03 12 02
-
- punpckldq mm0, mm3 ; 30 20 10 00
- punpckhdq mm1, mm3 ; 31 21 11 01
-
- punpckldq mm2, mm4 ; 32 22 12 02
- punpckhdq mm5, mm4 ; 33 23 13 03
-
- movq mm3, mm5 ; 33 23 13 03
-
- psubw mm0, mm2 ; b1= 0-2
- paddw mm2, mm2 ;
-
- movq mm5, mm1
- paddw mm2, mm0 ; a1 =0+2
-
- pmulhw mm5, [GLOBAL(x_s1sqr2)];
- paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movq mm7, mm3 ;
- pmulhw mm7, [GLOBAL(x_c1sqr2less1)];
-
- paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw mm7, mm5 ; c1
-
- movq mm5, mm1
- movq mm4, mm3
-
- pmulhw mm5, [GLOBAL(x_c1sqr2less1)]
- paddw mm5, mm1
-
- pmulhw mm3, [GLOBAL(x_s1sqr2)]
- paddw mm3, mm4
-
- paddw mm3, mm5 ; d1
- paddw mm0, [GLOBAL(fours)]
-
- paddw mm2, [GLOBAL(fours)]
- movq mm6, mm2 ; a1
-
- movq mm4, mm0 ; b1
- paddw mm2, mm3 ;0
-
- paddw mm4, mm7 ;1
- psubw mm0, mm7 ;2
-
- psubw mm6, mm3 ;3
- psraw mm2, 3
-
- psraw mm0, 3
- psraw mm4, 3
-
- psraw mm6, 3
-
- movq mm1, mm2 ; 03 02 01 00
- movq mm3, mm4 ; 23 22 21 20
-
- punpcklwd mm1, mm0 ; 11 01 10 00
- punpckhwd mm2, mm0 ; 13 03 12 02
-
- punpcklwd mm3, mm6 ; 31 21 30 20
- punpckhwd mm4, mm6 ; 33 23 32 22
-
- movq mm0, mm1 ; 11 01 10 00
- movq mm5, mm2 ; 13 03 12 02
-
- punpckldq mm0, mm3 ; 30 20 10 00
- punpckhdq mm1, mm3 ; 31 21 11 01
-
- punpckldq mm2, mm4 ; 32 22 12 02
- punpckhdq mm5, mm4 ; 33 23 13 03
-
- pxor mm7, mm7
-
- movd mm4, [rsi]
- punpcklbw mm4, mm7
- paddsw mm0, mm4
- packuswb mm0, mm7
- movd [rdx], mm0
-
- movd mm4, [rsi+rax]
- punpcklbw mm4, mm7
- paddsw mm1, mm4
- packuswb mm1, mm7
- movd [rdx+rdi], mm1
-
- movd mm4, [rsi+2*rax]
- punpcklbw mm4, mm7
- paddsw mm2, mm4
- packuswb mm2, mm7
- movd [rdx+rdi*2], mm2
-
- add rdx, rdi
- add rsi, rax
-
- movd mm4, [rsi+2*rax]
- punpcklbw mm4, mm7
- paddsw mm5, mm4
- packuswb mm5, mm7
- movd [rdx+rdi*2], mm5
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_dc_only_idct_add_mmx(
-;short input_dc,
-;unsigned char *pred_ptr,
-;int pred_stride,
-;unsigned char *dst_ptr,
-;int stride)
-global sym(vp8_dc_only_idct_add_mmx) PRIVATE
-sym(vp8_dc_only_idct_add_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- ; end prolog
-
- movd mm5, arg(0) ;input_dc
- mov rax, arg(1) ;pred_ptr
- movsxd rdx, dword ptr arg(2) ;pred_stride
-
- pxor mm0, mm0
-
- paddw mm5, [GLOBAL(fours)]
- lea rcx, [rdx + rdx*2]
-
- psraw mm5, 3
-
- punpcklwd mm5, mm5
-
- punpckldq mm5, mm5
-
- movd mm1, [rax]
- movd mm2, [rax+rdx]
- movd mm3, [rax+2*rdx]
- movd mm4, [rax+rcx]
-
- mov rax, arg(3) ;d -- destination
- movsxd rdx, dword ptr arg(4) ;dst_stride
-
- punpcklbw mm1, mm0
- paddsw mm1, mm5
- packuswb mm1, mm0 ; pack and unpack to saturate
- lea rcx, [rdx + rdx*2]
-
- punpcklbw mm2, mm0
- paddsw mm2, mm5
- packuswb mm2, mm0 ; pack and unpack to saturate
-
- punpcklbw mm3, mm0
- paddsw mm3, mm5
- packuswb mm3, mm0 ; pack and unpack to saturate
-
- punpcklbw mm4, mm0
- paddsw mm4, mm5
- packuswb mm4, mm0 ; pack and unpack to saturate
-
- movd [rax], mm1
- movd [rax+rdx], mm2
- movd [rax+2*rdx], mm3
- movd [rax+rcx], mm4
-
- ; begin epilog
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-x_s1sqr2:
- times 4 dw 0x8A8C
-align 16
-x_c1sqr2less1:
- times 4 dw 0x4E7B
-align 16
-fours:
- times 4 dw 0x0004
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_sse2.asm
deleted file mode 100644
index bf8e2c4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/idctllm_sse2.asm
+++ /dev/null
@@ -1,708 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_idct_dequant_0_2x_sse2
-; (
-; short *qcoeff - 0
-; short *dequant - 1
-; unsigned char *dst - 2
-; int dst_stride - 3
-; )
-
-global sym(vp8_idct_dequant_0_2x_sse2) PRIVATE
-sym(vp8_idct_dequant_0_2x_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- GET_GOT rbx
- ; end prolog
-
- mov rdx, arg(1) ; dequant
- mov rax, arg(0) ; qcoeff
-
- movd xmm4, [rax]
- movd xmm5, [rdx]
-
- pinsrw xmm4, [rax+32], 4
- pinsrw xmm5, [rdx], 4
-
- pmullw xmm4, xmm5
-
- ; Zero out xmm5, for use unpacking
- pxor xmm5, xmm5
-
- ; clear coeffs
- movd [rax], xmm5
- movd [rax+32], xmm5
-;pshufb
- mov rax, arg(2) ; dst
- movsxd rdx, dword ptr arg(3) ; dst_stride
-
- pshuflw xmm4, xmm4, 00000000b
- pshufhw xmm4, xmm4, 00000000b
-
- lea rcx, [rdx + rdx*2]
- paddw xmm4, [GLOBAL(fours)]
-
- psraw xmm4, 3
-
- movq xmm0, [rax]
- movq xmm1, [rax+rdx]
- movq xmm2, [rax+2*rdx]
- movq xmm3, [rax+rcx]
-
- punpcklbw xmm0, xmm5
- punpcklbw xmm1, xmm5
- punpcklbw xmm2, xmm5
- punpcklbw xmm3, xmm5
-
-
- ; Add to predict buffer
- paddw xmm0, xmm4
- paddw xmm1, xmm4
- paddw xmm2, xmm4
- paddw xmm3, xmm4
-
- ; pack up before storing
- packuswb xmm0, xmm5
- packuswb xmm1, xmm5
- packuswb xmm2, xmm5
- packuswb xmm3, xmm5
-
- ; store blocks back out
- movq [rax], xmm0
- movq [rax + rdx], xmm1
-
- lea rax, [rax + 2*rdx]
-
- movq [rax], xmm2
- movq [rax + rdx], xmm3
-
- ; begin epilog
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_idct_dequant_full_2x_sse2
-; (
-; short *qcoeff - 0
-; short *dequant - 1
-; unsigned char *dst - 2
-; int dst_stride - 3
-; )
-global sym(vp8_idct_dequant_full_2x_sse2) PRIVATE
-sym(vp8_idct_dequant_full_2x_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ; special case when 2 blocks have 0 or 1 coeffs
- ; dc is set as first coeff, so no need to load qcoeff
- mov rax, arg(0) ; qcoeff
- mov rdx, arg(1) ; dequant
- mov rdi, arg(2) ; dst
-
-
- ; Zero out xmm7, for use unpacking
- pxor xmm7, xmm7
-
-
- ; note the transpose of xmm1 and xmm2, necessary for shuffle
- ; to spit out sensicle data
- movdqa xmm0, [rax]
- movdqa xmm2, [rax+16]
- movdqa xmm1, [rax+32]
- movdqa xmm3, [rax+48]
-
- ; Clear out coeffs
- movdqa [rax], xmm7
- movdqa [rax+16], xmm7
- movdqa [rax+32], xmm7
- movdqa [rax+48], xmm7
-
- ; dequantize qcoeff buffer
- pmullw xmm0, [rdx]
- pmullw xmm2, [rdx+16]
- pmullw xmm1, [rdx]
- pmullw xmm3, [rdx+16]
- movsxd rdx, dword ptr arg(3) ; dst_stride
-
- ; repack so block 0 row x and block 1 row x are together
- movdqa xmm4, xmm0
- punpckldq xmm0, xmm1
- punpckhdq xmm4, xmm1
-
- pshufd xmm0, xmm0, 11011000b
- pshufd xmm1, xmm4, 11011000b
-
- movdqa xmm4, xmm2
- punpckldq xmm2, xmm3
- punpckhdq xmm4, xmm3
-
- pshufd xmm2, xmm2, 11011000b
- pshufd xmm3, xmm4, 11011000b
-
- ; first pass
- psubw xmm0, xmm2 ; b1 = 0-2
- paddw xmm2, xmm2 ;
-
- movdqa xmm5, xmm1
- paddw xmm2, xmm0 ; a1 = 0+2
-
- pmulhw xmm5, [GLOBAL(x_s1sqr2)]
- lea rcx, [rdx + rdx*2] ;dst_stride * 3
- paddw xmm5, xmm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movdqa xmm7, xmm3
- pmulhw xmm7, [GLOBAL(x_c1sqr2less1)]
-
- paddw xmm7, xmm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw xmm7, xmm5 ; c1
-
- movdqa xmm5, xmm1
- movdqa xmm4, xmm3
-
- pmulhw xmm5, [GLOBAL(x_c1sqr2less1)]
- paddw xmm5, xmm1
-
- pmulhw xmm3, [GLOBAL(x_s1sqr2)]
- paddw xmm3, xmm4
-
- paddw xmm3, xmm5 ; d1
- movdqa xmm6, xmm2 ; a1
-
- movdqa xmm4, xmm0 ; b1
- paddw xmm2, xmm3 ;0
-
- paddw xmm4, xmm7 ;1
- psubw xmm0, xmm7 ;2
-
- psubw xmm6, xmm3 ;3
-
- ; transpose for the second pass
- movdqa xmm7, xmm2 ; 103 102 101 100 003 002 001 000
- punpcklwd xmm2, xmm0 ; 007 003 006 002 005 001 004 000
- punpckhwd xmm7, xmm0 ; 107 103 106 102 105 101 104 100
-
- movdqa xmm5, xmm4 ; 111 110 109 108 011 010 009 008
- punpcklwd xmm4, xmm6 ; 015 011 014 010 013 009 012 008
- punpckhwd xmm5, xmm6 ; 115 111 114 110 113 109 112 108
-
-
- movdqa xmm1, xmm2 ; 007 003 006 002 005 001 004 000
- punpckldq xmm2, xmm4 ; 013 009 005 001 012 008 004 000
- punpckhdq xmm1, xmm4 ; 015 011 007 003 014 010 006 002
-
- movdqa xmm6, xmm7 ; 107 103 106 102 105 101 104 100
- punpckldq xmm7, xmm5 ; 113 109 105 101 112 108 104 100
- punpckhdq xmm6, xmm5 ; 115 111 107 103 114 110 106 102
-
-
- movdqa xmm5, xmm2 ; 013 009 005 001 012 008 004 000
- punpckldq xmm2, xmm7 ; 112 108 012 008 104 100 004 000
- punpckhdq xmm5, xmm7 ; 113 109 013 009 105 101 005 001
-
- movdqa xmm7, xmm1 ; 015 011 007 003 014 010 006 002
- punpckldq xmm1, xmm6 ; 114 110 014 010 106 102 006 002
- punpckhdq xmm7, xmm6 ; 115 111 015 011 107 103 007 003
-
- pshufd xmm0, xmm2, 11011000b
- pshufd xmm2, xmm1, 11011000b
-
- pshufd xmm1, xmm5, 11011000b
- pshufd xmm3, xmm7, 11011000b
-
- ; second pass
- psubw xmm0, xmm2 ; b1 = 0-2
- paddw xmm2, xmm2
-
- movdqa xmm5, xmm1
- paddw xmm2, xmm0 ; a1 = 0+2
-
- pmulhw xmm5, [GLOBAL(x_s1sqr2)]
- paddw xmm5, xmm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movdqa xmm7, xmm3
- pmulhw xmm7, [GLOBAL(x_c1sqr2less1)]
-
- paddw xmm7, xmm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw xmm7, xmm5 ; c1
-
- movdqa xmm5, xmm1
- movdqa xmm4, xmm3
-
- pmulhw xmm5, [GLOBAL(x_c1sqr2less1)]
- paddw xmm5, xmm1
-
- pmulhw xmm3, [GLOBAL(x_s1sqr2)]
- paddw xmm3, xmm4
-
- paddw xmm3, xmm5 ; d1
- paddw xmm0, [GLOBAL(fours)]
-
- paddw xmm2, [GLOBAL(fours)]
- movdqa xmm6, xmm2 ; a1
-
- movdqa xmm4, xmm0 ; b1
- paddw xmm2, xmm3 ;0
-
- paddw xmm4, xmm7 ;1
- psubw xmm0, xmm7 ;2
-
- psubw xmm6, xmm3 ;3
- psraw xmm2, 3
-
- psraw xmm0, 3
- psraw xmm4, 3
-
- psraw xmm6, 3
-
- ; transpose to save
- movdqa xmm7, xmm2 ; 103 102 101 100 003 002 001 000
- punpcklwd xmm2, xmm0 ; 007 003 006 002 005 001 004 000
- punpckhwd xmm7, xmm0 ; 107 103 106 102 105 101 104 100
-
- movdqa xmm5, xmm4 ; 111 110 109 108 011 010 009 008
- punpcklwd xmm4, xmm6 ; 015 011 014 010 013 009 012 008
- punpckhwd xmm5, xmm6 ; 115 111 114 110 113 109 112 108
-
-
- movdqa xmm1, xmm2 ; 007 003 006 002 005 001 004 000
- punpckldq xmm2, xmm4 ; 013 009 005 001 012 008 004 000
- punpckhdq xmm1, xmm4 ; 015 011 007 003 014 010 006 002
-
- movdqa xmm6, xmm7 ; 107 103 106 102 105 101 104 100
- punpckldq xmm7, xmm5 ; 113 109 105 101 112 108 104 100
- punpckhdq xmm6, xmm5 ; 115 111 107 103 114 110 106 102
-
-
- movdqa xmm5, xmm2 ; 013 009 005 001 012 008 004 000
- punpckldq xmm2, xmm7 ; 112 108 012 008 104 100 004 000
- punpckhdq xmm5, xmm7 ; 113 109 013 009 105 101 005 001
-
- movdqa xmm7, xmm1 ; 015 011 007 003 014 010 006 002
- punpckldq xmm1, xmm6 ; 114 110 014 010 106 102 006 002
- punpckhdq xmm7, xmm6 ; 115 111 015 011 107 103 007 003
-
- pshufd xmm0, xmm2, 11011000b
- pshufd xmm2, xmm1, 11011000b
-
- pshufd xmm1, xmm5, 11011000b
- pshufd xmm3, xmm7, 11011000b
-
- pxor xmm7, xmm7
-
- ; Load up predict blocks
- movq xmm4, [rdi]
- movq xmm5, [rdi+rdx]
-
- punpcklbw xmm4, xmm7
- punpcklbw xmm5, xmm7
-
- paddw xmm0, xmm4
- paddw xmm1, xmm5
-
- movq xmm4, [rdi+2*rdx]
- movq xmm5, [rdi+rcx]
-
- punpcklbw xmm4, xmm7
- punpcklbw xmm5, xmm7
-
- paddw xmm2, xmm4
- paddw xmm3, xmm5
-
-.finish:
-
- ; pack up before storing
- packuswb xmm0, xmm7
- packuswb xmm1, xmm7
- packuswb xmm2, xmm7
- packuswb xmm3, xmm7
-
- ; store blocks back out
- movq [rdi], xmm0
- movq [rdi + rdx], xmm1
- movq [rdi + rdx*2], xmm2
- movq [rdi + rcx], xmm3
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_idct_dequant_dc_0_2x_sse2
-; (
-; short *qcoeff - 0
-; short *dequant - 1
-; unsigned char *dst - 2
-; int dst_stride - 3
-; short *dc - 4
-; )
-global sym(vp8_idct_dequant_dc_0_2x_sse2) PRIVATE
-sym(vp8_idct_dequant_dc_0_2x_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rdi
- ; end prolog
-
- ; special case when 2 blocks have 0 or 1 coeffs
- ; dc is set as first coeff, so no need to load qcoeff
- mov rax, arg(0) ; qcoeff
-
- mov rdi, arg(2) ; dst
- mov rdx, arg(4) ; dc
-
- ; Zero out xmm5, for use unpacking
- pxor xmm5, xmm5
-
- ; load up 2 dc words here == 2*16 = doubleword
- movd xmm4, [rdx]
-
- movsxd rdx, dword ptr arg(3) ; dst_stride
- lea rcx, [rdx + rdx*2]
- ; Load up predict blocks
- movq xmm0, [rdi]
- movq xmm1, [rdi+rdx*1]
- movq xmm2, [rdi+rdx*2]
- movq xmm3, [rdi+rcx]
-
- ; Duplicate and expand dc across
- punpcklwd xmm4, xmm4
- punpckldq xmm4, xmm4
-
- ; Rounding to dequant and downshift
- paddw xmm4, [GLOBAL(fours)]
- psraw xmm4, 3
-
- ; Predict buffer needs to be expanded from bytes to words
- punpcklbw xmm0, xmm5
- punpcklbw xmm1, xmm5
- punpcklbw xmm2, xmm5
- punpcklbw xmm3, xmm5
-
- ; Add to predict buffer
- paddw xmm0, xmm4
- paddw xmm1, xmm4
- paddw xmm2, xmm4
- paddw xmm3, xmm4
-
- ; pack up before storing
- packuswb xmm0, xmm5
- packuswb xmm1, xmm5
- packuswb xmm2, xmm5
- packuswb xmm3, xmm5
-
- ; store blocks back out
- movq [rdi], xmm0
- movq [rdi + rdx], xmm1
- movq [rdi + rdx*2], xmm2
- movq [rdi + rcx], xmm3
-
- ; begin epilog
- pop rdi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-;void vp8_idct_dequant_dc_full_2x_sse2
-; (
-; short *qcoeff - 0
-; short *dequant - 1
-; unsigned char *dst - 2
-; int dst_stride - 3
-; short *dc - 4
-; )
-global sym(vp8_idct_dequant_dc_full_2x_sse2) PRIVATE
-sym(vp8_idct_dequant_dc_full_2x_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rdi
- ; end prolog
-
- ; special case when 2 blocks have 0 or 1 coeffs
- ; dc is set as first coeff, so no need to load qcoeff
- mov rax, arg(0) ; qcoeff
- mov rdx, arg(1) ; dequant
-
- mov rdi, arg(2) ; dst
-
- ; Zero out xmm7, for use unpacking
- pxor xmm7, xmm7
-
-
- ; note the transpose of xmm1 and xmm2, necessary for shuffle
- ; to spit out sensicle data
- movdqa xmm0, [rax]
- movdqa xmm2, [rax+16]
- movdqa xmm1, [rax+32]
- movdqa xmm3, [rax+48]
-
- ; Clear out coeffs
- movdqa [rax], xmm7
- movdqa [rax+16], xmm7
- movdqa [rax+32], xmm7
- movdqa [rax+48], xmm7
-
- ; dequantize qcoeff buffer
- pmullw xmm0, [rdx]
- pmullw xmm2, [rdx+16]
- pmullw xmm1, [rdx]
- pmullw xmm3, [rdx+16]
-
- ; DC component
- mov rdx, arg(4)
-
- ; repack so block 0 row x and block 1 row x are together
- movdqa xmm4, xmm0
- punpckldq xmm0, xmm1
- punpckhdq xmm4, xmm1
-
- pshufd xmm0, xmm0, 11011000b
- pshufd xmm1, xmm4, 11011000b
-
- movdqa xmm4, xmm2
- punpckldq xmm2, xmm3
- punpckhdq xmm4, xmm3
-
- pshufd xmm2, xmm2, 11011000b
- pshufd xmm3, xmm4, 11011000b
-
- ; insert DC component
- pinsrw xmm0, [rdx], 0
- pinsrw xmm0, [rdx+2], 4
-
- ; first pass
- psubw xmm0, xmm2 ; b1 = 0-2
- paddw xmm2, xmm2 ;
-
- movdqa xmm5, xmm1
- paddw xmm2, xmm0 ; a1 = 0+2
-
- pmulhw xmm5, [GLOBAL(x_s1sqr2)]
- paddw xmm5, xmm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movdqa xmm7, xmm3
- pmulhw xmm7, [GLOBAL(x_c1sqr2less1)]
-
- paddw xmm7, xmm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw xmm7, xmm5 ; c1
-
- movdqa xmm5, xmm1
- movdqa xmm4, xmm3
-
- pmulhw xmm5, [GLOBAL(x_c1sqr2less1)]
- paddw xmm5, xmm1
-
- pmulhw xmm3, [GLOBAL(x_s1sqr2)]
- paddw xmm3, xmm4
-
- paddw xmm3, xmm5 ; d1
- movdqa xmm6, xmm2 ; a1
-
- movdqa xmm4, xmm0 ; b1
- paddw xmm2, xmm3 ;0
-
- paddw xmm4, xmm7 ;1
- psubw xmm0, xmm7 ;2
-
- psubw xmm6, xmm3 ;3
-
- ; transpose for the second pass
- movdqa xmm7, xmm2 ; 103 102 101 100 003 002 001 000
- punpcklwd xmm2, xmm0 ; 007 003 006 002 005 001 004 000
- punpckhwd xmm7, xmm0 ; 107 103 106 102 105 101 104 100
-
- movdqa xmm5, xmm4 ; 111 110 109 108 011 010 009 008
- punpcklwd xmm4, xmm6 ; 015 011 014 010 013 009 012 008
- punpckhwd xmm5, xmm6 ; 115 111 114 110 113 109 112 108
-
-
- movdqa xmm1, xmm2 ; 007 003 006 002 005 001 004 000
- punpckldq xmm2, xmm4 ; 013 009 005 001 012 008 004 000
- punpckhdq xmm1, xmm4 ; 015 011 007 003 014 010 006 002
-
- movdqa xmm6, xmm7 ; 107 103 106 102 105 101 104 100
- punpckldq xmm7, xmm5 ; 113 109 105 101 112 108 104 100
- punpckhdq xmm6, xmm5 ; 115 111 107 103 114 110 106 102
-
-
- movdqa xmm5, xmm2 ; 013 009 005 001 012 008 004 000
- punpckldq xmm2, xmm7 ; 112 108 012 008 104 100 004 000
- punpckhdq xmm5, xmm7 ; 113 109 013 009 105 101 005 001
-
- movdqa xmm7, xmm1 ; 015 011 007 003 014 010 006 002
- punpckldq xmm1, xmm6 ; 114 110 014 010 106 102 006 002
- punpckhdq xmm7, xmm6 ; 115 111 015 011 107 103 007 003
-
- pshufd xmm0, xmm2, 11011000b
- pshufd xmm2, xmm1, 11011000b
-
- pshufd xmm1, xmm5, 11011000b
- pshufd xmm3, xmm7, 11011000b
-
- ; second pass
- psubw xmm0, xmm2 ; b1 = 0-2
- paddw xmm2, xmm2
-
- movdqa xmm5, xmm1
- paddw xmm2, xmm0 ; a1 = 0+2
-
- pmulhw xmm5, [GLOBAL(x_s1sqr2)]
- paddw xmm5, xmm1 ; ip1 * sin(pi/8) * sqrt(2)
-
- movdqa xmm7, xmm3
- pmulhw xmm7, [GLOBAL(x_c1sqr2less1)]
-
- paddw xmm7, xmm3 ; ip3 * cos(pi/8) * sqrt(2)
- psubw xmm7, xmm5 ; c1
-
- movdqa xmm5, xmm1
- movdqa xmm4, xmm3
-
- pmulhw xmm5, [GLOBAL(x_c1sqr2less1)]
- paddw xmm5, xmm1
-
- pmulhw xmm3, [GLOBAL(x_s1sqr2)]
- paddw xmm3, xmm4
-
- paddw xmm3, xmm5 ; d1
- paddw xmm0, [GLOBAL(fours)]
-
- paddw xmm2, [GLOBAL(fours)]
- movdqa xmm6, xmm2 ; a1
-
- movdqa xmm4, xmm0 ; b1
- paddw xmm2, xmm3 ;0
-
- paddw xmm4, xmm7 ;1
- psubw xmm0, xmm7 ;2
-
- psubw xmm6, xmm3 ;3
- psraw xmm2, 3
-
- psraw xmm0, 3
- psraw xmm4, 3
-
- psraw xmm6, 3
-
- ; transpose to save
- movdqa xmm7, xmm2 ; 103 102 101 100 003 002 001 000
- punpcklwd xmm2, xmm0 ; 007 003 006 002 005 001 004 000
- punpckhwd xmm7, xmm0 ; 107 103 106 102 105 101 104 100
-
- movdqa xmm5, xmm4 ; 111 110 109 108 011 010 009 008
- punpcklwd xmm4, xmm6 ; 015 011 014 010 013 009 012 008
- punpckhwd xmm5, xmm6 ; 115 111 114 110 113 109 112 108
-
-
- movdqa xmm1, xmm2 ; 007 003 006 002 005 001 004 000
- punpckldq xmm2, xmm4 ; 013 009 005 001 012 008 004 000
- punpckhdq xmm1, xmm4 ; 015 011 007 003 014 010 006 002
-
- movdqa xmm6, xmm7 ; 107 103 106 102 105 101 104 100
- punpckldq xmm7, xmm5 ; 113 109 105 101 112 108 104 100
- punpckhdq xmm6, xmm5 ; 115 111 107 103 114 110 106 102
-
-
- movdqa xmm5, xmm2 ; 013 009 005 001 012 008 004 000
- punpckldq xmm2, xmm7 ; 112 108 012 008 104 100 004 000
- punpckhdq xmm5, xmm7 ; 113 109 013 009 105 101 005 001
-
- movdqa xmm7, xmm1 ; 015 011 007 003 014 010 006 002
- punpckldq xmm1, xmm6 ; 114 110 014 010 106 102 006 002
- punpckhdq xmm7, xmm6 ; 115 111 015 011 107 103 007 003
-
- pshufd xmm0, xmm2, 11011000b
- pshufd xmm2, xmm1, 11011000b
-
- pshufd xmm1, xmm5, 11011000b
- pshufd xmm3, xmm7, 11011000b
-
- pxor xmm7, xmm7
-
- ; Load up predict blocks
- movsxd rdx, dword ptr arg(3) ; dst_stride
- movq xmm4, [rdi]
- movq xmm5, [rdi+rdx]
- lea rcx, [rdx + rdx*2]
-
- punpcklbw xmm4, xmm7
- punpcklbw xmm5, xmm7
-
- paddw xmm0, xmm4
- paddw xmm1, xmm5
-
- movq xmm4, [rdi+rdx*2]
- movq xmm5, [rdi+rcx]
-
- punpcklbw xmm4, xmm7
- punpcklbw xmm5, xmm7
-
- paddw xmm2, xmm4
- paddw xmm3, xmm5
-
-.finish:
-
- ; pack up before storing
- packuswb xmm0, xmm7
- packuswb xmm1, xmm7
- packuswb xmm2, xmm7
- packuswb xmm3, xmm7
-
- ; Load destination stride before writing out,
- ; doesn't need to persist
- movsxd rdx, dword ptr arg(3) ; dst_stride
-
- ; store blocks back out
- movq [rdi], xmm0
- movq [rdi + rdx], xmm1
-
- lea rdi, [rdi + 2*rdx]
-
- movq [rdi], xmm2
- movq [rdi + rdx], xmm3
-
-
- ; begin epilog
- pop rdi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-fours:
- times 8 dw 0x0004
-align 16
-x_s1sqr2:
- times 8 dw 0x8A8C
-align 16
-x_c1sqr2less1:
- times 8 dw 0x4E7B
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_mmx.asm
deleted file mode 100644
index 158c3b7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_mmx.asm
+++ /dev/null
@@ -1,140 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_short_inv_walsh4x4_mmx(short *input, short *output)
-global sym(vp8_short_inv_walsh4x4_mmx) PRIVATE
-sym(vp8_short_inv_walsh4x4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 2
- ; end prolog
-
- mov rdx, arg(0)
- mov rax, 30003h
-
- movq mm0, [rdx + 0] ;ip[0]
- movq mm1, [rdx + 8] ;ip[4]
- movq mm7, rax
-
- movq mm2, [rdx + 16] ;ip[8]
- movq mm3, [rdx + 24] ;ip[12]
- punpcklwd mm7, mm7 ;0003000300030003h
- mov rdx, arg(1)
-
- movq mm4, mm0
- movq mm5, mm1
-
- paddw mm4, mm3 ;ip[0] + ip[12] aka al
- paddw mm5, mm2 ;ip[4] + ip[8] aka bl
-
- movq mm6, mm4 ;temp al
- paddw mm4, mm5 ;al + bl
- psubw mm6, mm5 ;al - bl
-
- psubw mm0, mm3 ;ip[0] - ip[12] aka d1
- psubw mm1, mm2 ;ip[4] - ip[8] aka c1
-
- movq mm5, mm0 ;temp dl
- paddw mm0, mm1 ;dl + cl
- psubw mm5, mm1 ;dl - cl
-
- ; 03 02 01 00
- ; 13 12 11 10
- ; 23 22 21 20
- ; 33 32 31 30
-
- movq mm3, mm4 ; 03 02 01 00
- punpcklwd mm4, mm0 ; 11 01 10 00
- punpckhwd mm3, mm0 ; 13 03 12 02
-
- movq mm1, mm6 ; 23 22 21 20
- punpcklwd mm6, mm5 ; 31 21 30 20
- punpckhwd mm1, mm5 ; 33 23 32 22
-
- movq mm0, mm4 ; 11 01 10 00
- movq mm2, mm3 ; 13 03 12 02
-
- punpckldq mm0, mm6 ; 30 20 10 00 aka ip[0]
- punpckhdq mm4, mm6 ; 31 21 11 01 aka ip[4]
-
- punpckldq mm2, mm1 ; 32 22 12 02 aka ip[8]
- punpckhdq mm3, mm1 ; 33 23 13 03 aka ip[12]
-;~~~~~~~~~~~~~~~~~~~~~
- movq mm1, mm0
- movq mm5, mm4
- paddw mm1, mm3 ;ip[0] + ip[12] aka al
- paddw mm5, mm2 ;ip[4] + ip[8] aka bl
-
- movq mm6, mm1 ;temp al
- paddw mm1, mm5 ;al + bl
- psubw mm6, mm5 ;al - bl
- paddw mm1, mm7
- paddw mm6, mm7
- psraw mm1, 3
- psraw mm6, 3
-
- psubw mm0, mm3 ;ip[0] - ip[12] aka d1
- psubw mm4, mm2 ;ip[4] - ip[8] aka c1
-
- movq mm5, mm0 ;temp dl
- paddw mm0, mm4 ;dl + cl
- psubw mm5, mm4 ;dl - cl
- paddw mm0, mm7
- paddw mm5, mm7
- psraw mm0, 3
- psraw mm5, 3
-;~~~~~~~~~~~~~~~~~~~~~
-
- movd eax, mm1
- movd ecx, mm0
- psrlq mm0, 32
- psrlq mm1, 32
- mov word ptr[rdx+32*0], ax
- mov word ptr[rdx+32*1], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*4], ax
- mov word ptr[rdx+32*5], cx
- movd eax, mm1
- movd ecx, mm0
- mov word ptr[rdx+32*8], ax
- mov word ptr[rdx+32*9], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*12], ax
- mov word ptr[rdx+32*13], cx
-
- movd eax, mm6
- movd ecx, mm5
- psrlq mm5, 32
- psrlq mm6, 32
- mov word ptr[rdx+32*2], ax
- mov word ptr[rdx+32*3], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*6], ax
- mov word ptr[rdx+32*7], cx
- movd eax, mm6
- movd ecx, mm5
- mov word ptr[rdx+32*10], ax
- mov word ptr[rdx+32*11], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*14], ax
- mov word ptr[rdx+32*15], cx
-
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_sse2.asm
deleted file mode 100644
index 06e86a8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/iwalsh_sse2.asm
+++ /dev/null
@@ -1,121 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_short_inv_walsh4x4_sse2(short *input, short *output)
-global sym(vp8_short_inv_walsh4x4_sse2) PRIVATE
-sym(vp8_short_inv_walsh4x4_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 2
- ; end prolog
-
- mov rcx, arg(0)
- mov rdx, arg(1)
- mov rax, 30003h
-
- movdqa xmm0, [rcx + 0] ;ip[4] ip[0]
- movdqa xmm1, [rcx + 16] ;ip[12] ip[8]
-
-
- pshufd xmm2, xmm1, 4eh ;ip[8] ip[12]
- movdqa xmm3, xmm0 ;ip[4] ip[0]
-
- paddw xmm0, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1
- psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1
-
- movdqa xmm4, xmm0
- punpcklqdq xmm0, xmm3 ;d1 a1
- punpckhqdq xmm4, xmm3 ;c1 b1
-
- movdqa xmm1, xmm4 ;c1 b1
- paddw xmm4, xmm0 ;dl+cl a1+b1 aka op[4] op[0]
- psubw xmm0, xmm1 ;d1-c1 a1-b1 aka op[12] op[8]
-
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ; 13 12 11 10 03 02 01 00
- ;
- ; 33 32 31 30 23 22 21 20
- ;
- movdqa xmm3, xmm4 ; 13 12 11 10 03 02 01 00
- punpcklwd xmm4, xmm0 ; 23 03 22 02 21 01 20 00
- punpckhwd xmm3, xmm0 ; 33 13 32 12 31 11 30 10
- movdqa xmm1, xmm4 ; 23 03 22 02 21 01 20 00
- punpcklwd xmm4, xmm3 ; 31 21 11 01 30 20 10 00
- punpckhwd xmm1, xmm3 ; 33 23 13 03 32 22 12 02
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- movd xmm0, eax
- pshufd xmm2, xmm1, 4eh ;ip[8] ip[12]
- movdqa xmm3, xmm4 ;ip[4] ip[0]
-
- pshufd xmm0, xmm0, 0 ;03 03 03 03 03 03 03 03
-
- paddw xmm4, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1
- psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1
-
- movdqa xmm5, xmm4
- punpcklqdq xmm4, xmm3 ;d1 a1
- punpckhqdq xmm5, xmm3 ;c1 b1
-
- movdqa xmm1, xmm5 ;c1 b1
- paddw xmm5, xmm4 ;dl+cl a1+b1 aka op[4] op[0]
- psubw xmm4, xmm1 ;d1-c1 a1-b1 aka op[12] op[8]
-
- paddw xmm5, xmm0
- paddw xmm4, xmm0
- psraw xmm5, 3
- psraw xmm4, 3
-
- movd eax, xmm5
- movd ecx, xmm4
- psrldq xmm5, 4
- psrldq xmm4, 4
- mov word ptr[rdx+32*0], ax
- mov word ptr[rdx+32*2], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*4], ax
- mov word ptr[rdx+32*6], cx
- movd eax, xmm5
- movd ecx, xmm4
- psrldq xmm5, 4
- psrldq xmm4, 4
- mov word ptr[rdx+32*8], ax
- mov word ptr[rdx+32*10], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*12], ax
- mov word ptr[rdx+32*14], cx
-
- movd eax, xmm5
- movd ecx, xmm4
- psrldq xmm5, 4
- psrldq xmm4, 4
- mov word ptr[rdx+32*1], ax
- mov word ptr[rdx+32*3], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*5], ax
- mov word ptr[rdx+32*7], cx
- movd eax, xmm5
- movd ecx, xmm4
- mov word ptr[rdx+32*9], ax
- mov word ptr[rdx+32*11], cx
- shr eax, 16
- shr ecx, 16
- mov word ptr[rdx+32*13], ax
- mov word ptr[rdx+32*15], cx
-
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_block_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_block_sse2.asm
deleted file mode 100644
index 6d5aaa1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_block_sse2.asm
+++ /dev/null
@@ -1,815 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro LF_ABS 2
- ; %1 value not preserved
- ; %2 value preserved
- ; output in %1
- movdqa scratch1, %2 ; v2
-
- psubusb scratch1, %1 ; v2 - v1
- psubusb %1, %2 ; v1 - v2
- por %1, scratch1 ; abs(v2 - v1)
-%endmacro
-
-%macro LF_FILTER_HEV_MASK 8-9
-
- LF_ABS %1, %2 ; abs(p3 - p2)
- LF_ABS %2, %3 ; abs(p2 - p1)
- pmaxub %1, %2 ; accumulate mask
-%if %0 == 8
- movdqa scratch2, %3 ; save p1
- LF_ABS scratch2, %4 ; abs(p1 - p0)
-%endif
- LF_ABS %4, %5 ; abs(p0 - q0)
- LF_ABS %5, %6 ; abs(q0 - q1)
-%if %0 == 8
- pmaxub %5, scratch2 ; accumulate hev
-%else
- pmaxub %5, %9
-%endif
- pmaxub %1, %5 ; accumulate mask
-
- LF_ABS %3, %6 ; abs(p1 - q1)
- LF_ABS %6, %7 ; abs(q1 - q2)
- pmaxub %1, %6 ; accumulate mask
- LF_ABS %7, %8 ; abs(q2 - q3)
- pmaxub %1, %7 ; accumulate mask
-
- paddusb %4, %4 ; 2 * abs(p0 - q0)
- pand %3, [GLOBAL(tfe)]
- psrlw %3, 1 ; abs(p1 - q1) / 2
- paddusb %4, %3 ; abs(p0 - q0) * 2 + abs(p1 - q1) / 2
-
- psubusb %1, [limit]
- psubusb %4, [blimit]
- por %1, %4
- pcmpeqb %1, zero ; mask
-
- psubusb %5, [thresh]
- pcmpeqb %5, zero ; ~hev
-%endmacro
-
-%macro LF_FILTER 6
- ; %1-%4: p1-q1
- ; %5: mask
- ; %6: hev
-
- movdqa scratch2, %6 ; save hev
-
- pxor %1, [GLOBAL(t80)] ; ps1
- pxor %4, [GLOBAL(t80)] ; qs1
- movdqa scratch1, %1
- psubsb scratch1, %4 ; signed_char_clamp(ps1 - qs1)
- pandn scratch2, scratch1 ; vp8_filter &= hev
-
- pxor %2, [GLOBAL(t80)] ; ps0
- pxor %3, [GLOBAL(t80)] ; qs0
- movdqa scratch1, %3
- psubsb scratch1, %2 ; qs0 - ps0
- paddsb scratch2, scratch1 ; vp8_filter += (qs0 - ps0)
- paddsb scratch2, scratch1 ; vp8_filter += (qs0 - ps0)
- paddsb scratch2, scratch1 ; vp8_filter += (qs0 - ps0)
- pand %5, scratch2 ; &= mask
-
- movdqa scratch2, %5
- paddsb %5, [GLOBAL(t4)] ; Filter1
- paddsb scratch2, [GLOBAL(t3)] ; Filter2
-
- ; Filter1 >> 3
- movdqa scratch1, zero
- pcmpgtb scratch1, %5
- psrlw %5, 3
- pand scratch1, [GLOBAL(te0)]
- pand %5, [GLOBAL(t1f)]
- por %5, scratch1
-
- psubsb %3, %5 ; qs0 - Filter1
- pxor %3, [GLOBAL(t80)]
-
- ; Filter2 >> 3
- movdqa scratch1, zero
- pcmpgtb scratch1, scratch2
- psrlw scratch2, 3
- pand scratch1, [GLOBAL(te0)]
- pand scratch2, [GLOBAL(t1f)]
- por scratch2, scratch1
-
- paddsb %2, scratch2 ; ps0 + Filter2
- pxor %2, [GLOBAL(t80)]
-
- ; outer tap adjustments
- paddsb %5, [GLOBAL(t1)]
- movdqa scratch1, zero
- pcmpgtb scratch1, %5
- psrlw %5, 1
- pand scratch1, [GLOBAL(t80)]
- pand %5, [GLOBAL(t7f)]
- por %5, scratch1
- pand %5, %6 ; vp8_filter &= ~hev
-
- psubsb %4, %5 ; qs1 - vp8_filter
- pxor %4, [GLOBAL(t80)]
-
- paddsb %1, %5 ; ps1 + vp8_filter
- pxor %1, [GLOBAL(t80)]
-%endmacro
-
-;void vp8_loop_filter_bh_y_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh
-;)
-global sym(vp8_loop_filter_bh_y_sse2) PRIVATE
-sym(vp8_loop_filter_bh_y_sse2):
-
-%if LIBVPX_YASM_WIN64
- %define src rcx ; src_ptr
- %define stride rdx ; src_pixel_step
- %define blimit r8
- %define limit r9
- %define thresh r10
-
- %define spp rax
- %define stride3 r11
- %define stride5 r12
- %define stride7 r13
-
- push rbp
- mov rbp, rsp
- SAVE_XMM 11
- push r12
- push r13
- mov thresh, arg(4)
-%else
- %define src rdi ; src_ptr
- %define stride rsi ; src_pixel_step
- %define blimit rdx
- %define limit rcx
- %define thresh r8
-
- %define spp rax
- %define stride3 r9
- %define stride5 r10
- %define stride7 r11
-%endif
-
- %define scratch1 xmm5
- %define scratch2 xmm6
- %define zero xmm7
-
- %define i0 [src]
- %define i1 [spp]
- %define i2 [src + 2 * stride]
- %define i3 [spp + 2 * stride]
- %define i4 [src + 4 * stride]
- %define i5 [spp + 4 * stride]
- %define i6 [src + 2 * stride3]
- %define i7 [spp + 2 * stride3]
- %define i8 [src + 8 * stride]
- %define i9 [spp + 8 * stride]
- %define i10 [src + 2 * stride5]
- %define i11 [spp + 2 * stride5]
- %define i12 [src + 4 * stride3]
- %define i13 [spp + 4 * stride3]
- %define i14 [src + 2 * stride7]
- %define i15 [spp + 2 * stride7]
-
- ; prep work
- lea spp, [src + stride]
- lea stride3, [stride + 2 * stride]
- lea stride5, [stride3 + 2 * stride]
- lea stride7, [stride3 + 4 * stride]
- pxor zero, zero
-
- ; load the first set into registers
- movdqa xmm0, i0
- movdqa xmm1, i1
- movdqa xmm2, i2
- movdqa xmm3, i3
- movdqa xmm4, i4
- movdqa xmm8, i5
- movdqa xmm9, i6 ; q2, will contain abs(p1-p0)
- movdqa xmm10, i7
-LF_FILTER_HEV_MASK xmm0, xmm1, xmm2, xmm3, xmm4, xmm8, xmm9, xmm10
-
- movdqa xmm1, i2
- movdqa xmm2, i3
- movdqa xmm3, i4
- movdqa xmm8, i5
-LF_FILTER xmm1, xmm2, xmm3, xmm8, xmm0, xmm4
- movdqa i2, xmm1
- movdqa i3, xmm2
-
-; second set
- movdqa i4, xmm3
- movdqa i5, xmm8
-
- movdqa xmm0, i6
- movdqa xmm1, i7
- movdqa xmm2, i8
- movdqa xmm4, i9
- movdqa xmm10, i10 ; q2, will contain abs(p1-p0)
- movdqa xmm11, i11
-LF_FILTER_HEV_MASK xmm3, xmm8, xmm0, xmm1, xmm2, xmm4, xmm10, xmm11, xmm9
-
- movdqa xmm0, i6
- movdqa xmm1, i7
- movdqa xmm4, i8
- movdqa xmm8, i9
-LF_FILTER xmm0, xmm1, xmm4, xmm8, xmm3, xmm2
- movdqa i6, xmm0
- movdqa i7, xmm1
-
-; last set
- movdqa i8, xmm4
- movdqa i9, xmm8
-
- movdqa xmm0, i10
- movdqa xmm1, i11
- movdqa xmm2, i12
- movdqa xmm3, i13
- movdqa xmm9, i14 ; q2, will contain abs(p1-p0)
- movdqa xmm11, i15
-LF_FILTER_HEV_MASK xmm4, xmm8, xmm0, xmm1, xmm2, xmm3, xmm9, xmm11, xmm10
-
- movdqa xmm0, i10
- movdqa xmm1, i11
- movdqa xmm3, i12
- movdqa xmm8, i13
-LF_FILTER xmm0, xmm1, xmm3, xmm8, xmm4, xmm2
- movdqa i10, xmm0
- movdqa i11, xmm1
- movdqa i12, xmm3
- movdqa i13, xmm8
-
-%if LIBVPX_YASM_WIN64
- pop r13
- pop r12
- RESTORE_XMM
- pop rbp
-%endif
-
- ret
-
-
-;void vp8_loop_filter_bv_y_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh
-;)
-
-global sym(vp8_loop_filter_bv_y_sse2) PRIVATE
-sym(vp8_loop_filter_bv_y_sse2):
-
-%if LIBVPX_YASM_WIN64
- %define src rcx ; src_ptr
- %define stride rdx ; src_pixel_step
- %define blimit r8
- %define limit r9
- %define thresh r10
-
- %define spp rax
- %define stride3 r11
- %define stride5 r12
- %define stride7 r13
-
- push rbp
- mov rbp, rsp
- SAVE_XMM 15
- push r12
- push r13
- mov thresh, arg(4)
-%else
- %define src rdi
- %define stride rsi
- %define blimit rdx
- %define limit rcx
- %define thresh r8
-
- %define spp rax
- %define stride3 r9
- %define stride5 r10
- %define stride7 r11
-%endif
-
- %define scratch1 xmm5
- %define scratch2 xmm6
- %define zero xmm7
-
- %define s0 [src]
- %define s1 [spp]
- %define s2 [src + 2 * stride]
- %define s3 [spp + 2 * stride]
- %define s4 [src + 4 * stride]
- %define s5 [spp + 4 * stride]
- %define s6 [src + 2 * stride3]
- %define s7 [spp + 2 * stride3]
- %define s8 [src + 8 * stride]
- %define s9 [spp + 8 * stride]
- %define s10 [src + 2 * stride5]
- %define s11 [spp + 2 * stride5]
- %define s12 [src + 4 * stride3]
- %define s13 [spp + 4 * stride3]
- %define s14 [src + 2 * stride7]
- %define s15 [spp + 2 * stride7]
-
- %define i0 [rsp]
- %define i1 [rsp + 16]
- %define i2 [rsp + 32]
- %define i3 [rsp + 48]
- %define i4 [rsp + 64]
- %define i5 [rsp + 80]
- %define i6 [rsp + 96]
- %define i7 [rsp + 112]
- %define i8 [rsp + 128]
- %define i9 [rsp + 144]
- %define i10 [rsp + 160]
- %define i11 [rsp + 176]
- %define i12 [rsp + 192]
- %define i13 [rsp + 208]
- %define i14 [rsp + 224]
- %define i15 [rsp + 240]
-
- ALIGN_STACK 16, rax
-
- ; reserve stack space
- %define temp_storage 0 ; size is 256 (16*16)
- %define stack_size 256
- sub rsp, stack_size
-
- ; prep work
- lea spp, [src + stride]
- lea stride3, [stride + 2 * stride]
- lea stride5, [stride3 + 2 * stride]
- lea stride7, [stride3 + 4 * stride]
-
- ; 8-f
- movdqa xmm0, s8
- movdqa xmm1, xmm0
- punpcklbw xmm0, s9 ; 80 90
- punpckhbw xmm1, s9 ; 88 98
-
- movdqa xmm2, s10
- movdqa xmm3, xmm2
- punpcklbw xmm2, s11 ; a0 b0
- punpckhbw xmm3, s11 ; a8 b8
-
- movdqa xmm4, xmm0
- punpcklwd xmm0, xmm2 ; 80 90 a0 b0
- punpckhwd xmm4, xmm2 ; 84 94 a4 b4
-
- movdqa xmm2, xmm1
- punpcklwd xmm1, xmm3 ; 88 98 a8 b8
- punpckhwd xmm2, xmm3 ; 8c 9c ac bc
-
- ; using xmm[0124]
- ; work on next 4 rows
-
- movdqa xmm3, s12
- movdqa xmm5, xmm3
- punpcklbw xmm3, s13 ; c0 d0
- punpckhbw xmm5, s13 ; c8 d8
-
- movdqa xmm6, s14
- movdqa xmm7, xmm6
- punpcklbw xmm6, s15 ; e0 f0
- punpckhbw xmm7, s15 ; e8 f8
-
- movdqa xmm8, xmm3
- punpcklwd xmm3, xmm6 ; c0 d0 e0 f0
- punpckhwd xmm8, xmm6 ; c4 d4 e4 f4
-
- movdqa xmm6, xmm5
- punpcklwd xmm5, xmm7 ; c8 d8 e8 f8
- punpckhwd xmm6, xmm7 ; cc dc ec fc
-
- ; pull the third and fourth sets together
-
- movdqa xmm7, xmm0
- punpckldq xmm0, xmm3 ; 80 90 a0 b0 c0 d0 e0 f0
- punpckhdq xmm7, xmm3 ; 82 92 a2 b2 c2 d2 e2 f2
-
- movdqa xmm3, xmm4
- punpckldq xmm4, xmm8 ; 84 94 a4 b4 c4 d4 e4 f4
- punpckhdq xmm3, xmm8 ; 86 96 a6 b6 c6 d6 e6 f6
-
- movdqa xmm8, xmm1
- punpckldq xmm1, xmm5 ; 88 88 a8 b8 c8 d8 e8 f8
- punpckhdq xmm8, xmm5 ; 8a 9a aa ba ca da ea fa
-
- movdqa xmm5, xmm2
- punpckldq xmm2, xmm6 ; 8c 9c ac bc cc dc ec fc
- punpckhdq xmm5, xmm6 ; 8e 9e ae be ce de ee fe
-
- ; save the calculations. we only have 15 registers ...
- movdqa i0, xmm0
- movdqa i1, xmm7
- movdqa i2, xmm4
- movdqa i3, xmm3
- movdqa i4, xmm1
- movdqa i5, xmm8
- movdqa i6, xmm2
- movdqa i7, xmm5
-
- ; 0-7
- movdqa xmm0, s0
- movdqa xmm1, xmm0
- punpcklbw xmm0, s1 ; 00 10
- punpckhbw xmm1, s1 ; 08 18
-
- movdqa xmm2, s2
- movdqa xmm3, xmm2
- punpcklbw xmm2, s3 ; 20 30
- punpckhbw xmm3, s3 ; 28 38
-
- movdqa xmm4, xmm0
- punpcklwd xmm0, xmm2 ; 00 10 20 30
- punpckhwd xmm4, xmm2 ; 04 14 24 34
-
- movdqa xmm2, xmm1
- punpcklwd xmm1, xmm3 ; 08 18 28 38
- punpckhwd xmm2, xmm3 ; 0c 1c 2c 3c
-
- ; using xmm[0124]
- ; work on next 4 rows
-
- movdqa xmm3, s4
- movdqa xmm5, xmm3
- punpcklbw xmm3, s5 ; 40 50
- punpckhbw xmm5, s5 ; 48 58
-
- movdqa xmm6, s6
- movdqa xmm7, xmm6
- punpcklbw xmm6, s7 ; 60 70
- punpckhbw xmm7, s7 ; 68 78
-
- movdqa xmm8, xmm3
- punpcklwd xmm3, xmm6 ; 40 50 60 70
- punpckhwd xmm8, xmm6 ; 44 54 64 74
-
- movdqa xmm6, xmm5
- punpcklwd xmm5, xmm7 ; 48 58 68 78
- punpckhwd xmm6, xmm7 ; 4c 5c 6c 7c
-
- ; pull the first two sets together
-
- movdqa xmm7, xmm0
- punpckldq xmm0, xmm3 ; 00 10 20 30 40 50 60 70
- punpckhdq xmm7, xmm3 ; 02 12 22 32 42 52 62 72
-
- movdqa xmm3, xmm4
- punpckldq xmm4, xmm8 ; 04 14 24 34 44 54 64 74
- punpckhdq xmm3, xmm8 ; 06 16 26 36 46 56 66 76
-
- movdqa xmm8, xmm1
- punpckldq xmm1, xmm5 ; 08 18 28 38 48 58 68 78
- punpckhdq xmm8, xmm5 ; 0a 1a 2a 3a 4a 5a 6a 7a
-
- movdqa xmm5, xmm2
- punpckldq xmm2, xmm6 ; 0c 1c 2c 3c 4c 5c 6c 7c
- punpckhdq xmm5, xmm6 ; 0e 1e 2e 3e 4e 5e 6e 7e
- ; final combination
-
- movdqa xmm6, xmm0
- punpcklqdq xmm0, i0
- punpckhqdq xmm6, i0
-
- movdqa xmm9, xmm7
- punpcklqdq xmm7, i1
- punpckhqdq xmm9, i1
-
- movdqa xmm10, xmm4
- punpcklqdq xmm4, i2
- punpckhqdq xmm10, i2
-
- movdqa xmm11, xmm3
- punpcklqdq xmm3, i3
- punpckhqdq xmm11, i3
-
- movdqa xmm12, xmm1
- punpcklqdq xmm1, i4
- punpckhqdq xmm12, i4
-
- movdqa xmm13, xmm8
- punpcklqdq xmm8, i5
- punpckhqdq xmm13, i5
-
- movdqa xmm14, xmm2
- punpcklqdq xmm2, i6
- punpckhqdq xmm14, i6
-
- movdqa xmm15, xmm5
- punpcklqdq xmm5, i7
- punpckhqdq xmm15, i7
-
- movdqa i0, xmm0
- movdqa i1, xmm6
- movdqa i2, xmm7
- movdqa i3, xmm9
- movdqa i4, xmm4
- movdqa i5, xmm10
- movdqa i6, xmm3
- movdqa i7, xmm11
- movdqa i8, xmm1
- movdqa i9, xmm12
- movdqa i10, xmm8
- movdqa i11, xmm13
- movdqa i12, xmm2
- movdqa i13, xmm14
- movdqa i14, xmm5
- movdqa i15, xmm15
-
-; TRANSPOSED DATA AVAILABLE ON THE STACK
-
- movdqa xmm12, xmm6
- movdqa xmm13, xmm7
-
- pxor zero, zero
-
-LF_FILTER_HEV_MASK xmm0, xmm12, xmm13, xmm9, xmm4, xmm10, xmm3, xmm11
-
- movdqa xmm1, i2
- movdqa xmm2, i3
- movdqa xmm8, i4
- movdqa xmm9, i5
-LF_FILTER xmm1, xmm2, xmm8, xmm9, xmm0, xmm4
- movdqa i2, xmm1
- movdqa i3, xmm2
-
-; second set
- movdqa i4, xmm8
- movdqa i5, xmm9
-
- movdqa xmm0, i6
- movdqa xmm1, i7
- movdqa xmm2, i8
- movdqa xmm4, i9
- movdqa xmm10, i10 ; q2, will contain abs(p1-p0)
- movdqa xmm11, i11
-LF_FILTER_HEV_MASK xmm8, xmm9, xmm0, xmm1, xmm2, xmm4, xmm10, xmm11, xmm3
-
- movdqa xmm0, i6
- movdqa xmm1, i7
- movdqa xmm3, i8
- movdqa xmm4, i9
-LF_FILTER xmm0, xmm1, xmm3, xmm4, xmm8, xmm2
- movdqa i6, xmm0
- movdqa i7, xmm1
-
-; last set
- movdqa i8, xmm3
- movdqa i9, xmm4
-
- movdqa xmm0, i10
- movdqa xmm1, i11
- movdqa xmm2, i12
- movdqa xmm8, i13
- movdqa xmm9, i14 ; q2, will contain abs(p1-p0)
- movdqa xmm11, i15
-LF_FILTER_HEV_MASK xmm3, xmm4, xmm0, xmm1, xmm2, xmm8, xmm9, xmm11, xmm10
-
- movdqa xmm0, i10
- movdqa xmm1, i11
- movdqa xmm4, i12
- movdqa xmm8, i13
-LF_FILTER xmm0, xmm1, xmm4, xmm8, xmm3, xmm2
- movdqa i10, xmm0
- movdqa i11, xmm1
- movdqa i12, xmm4
- movdqa i13, xmm8
-
-
-; RESHUFFLE AND WRITE OUT
- ; 8-f
- movdqa xmm0, i8
- movdqa xmm1, xmm0
- punpcklbw xmm0, i9 ; 80 90
- punpckhbw xmm1, i9 ; 88 98
-
- movdqa xmm2, i10
- movdqa xmm3, xmm2
- punpcklbw xmm2, i11 ; a0 b0
- punpckhbw xmm3, i11 ; a8 b8
-
- movdqa xmm4, xmm0
- punpcklwd xmm0, xmm2 ; 80 90 a0 b0
- punpckhwd xmm4, xmm2 ; 84 94 a4 b4
-
- movdqa xmm2, xmm1
- punpcklwd xmm1, xmm3 ; 88 98 a8 b8
- punpckhwd xmm2, xmm3 ; 8c 9c ac bc
-
- ; using xmm[0124]
- ; work on next 4 rows
-
- movdqa xmm3, i12
- movdqa xmm5, xmm3
- punpcklbw xmm3, i13 ; c0 d0
- punpckhbw xmm5, i13 ; c8 d8
-
- movdqa xmm6, i14
- movdqa xmm7, xmm6
- punpcklbw xmm6, i15 ; e0 f0
- punpckhbw xmm7, i15 ; e8 f8
-
- movdqa xmm8, xmm3
- punpcklwd xmm3, xmm6 ; c0 d0 e0 f0
- punpckhwd xmm8, xmm6 ; c4 d4 e4 f4
-
- movdqa xmm6, xmm5
- punpcklwd xmm5, xmm7 ; c8 d8 e8 f8
- punpckhwd xmm6, xmm7 ; cc dc ec fc
-
- ; pull the third and fourth sets together
-
- movdqa xmm7, xmm0
- punpckldq xmm0, xmm3 ; 80 90 a0 b0 c0 d0 e0 f0
- punpckhdq xmm7, xmm3 ; 82 92 a2 b2 c2 d2 e2 f2
-
- movdqa xmm3, xmm4
- punpckldq xmm4, xmm8 ; 84 94 a4 b4 c4 d4 e4 f4
- punpckhdq xmm3, xmm8 ; 86 96 a6 b6 c6 d6 e6 f6
-
- movdqa xmm8, xmm1
- punpckldq xmm1, xmm5 ; 88 88 a8 b8 c8 d8 e8 f8
- punpckhdq xmm8, xmm5 ; 8a 9a aa ba ca da ea fa
-
- movdqa xmm5, xmm2
- punpckldq xmm2, xmm6 ; 8c 9c ac bc cc dc ec fc
- punpckhdq xmm5, xmm6 ; 8e 9e ae be ce de ee fe
-
- ; save the calculations. we only have 15 registers ...
- movdqa i8, xmm0
- movdqa i9, xmm7
- movdqa i10, xmm4
- movdqa i11, xmm3
- movdqa i12, xmm1
- movdqa i13, xmm8
- movdqa i14, xmm2
- movdqa i15, xmm5
-
- ; 0-7
- movdqa xmm0, i0
- movdqa xmm1, xmm0
- punpcklbw xmm0, i1 ; 00 10
- punpckhbw xmm1, i1 ; 08 18
-
- movdqa xmm2, i2
- movdqa xmm3, xmm2
- punpcklbw xmm2, i3 ; 20 30
- punpckhbw xmm3, i3 ; 28 38
-
- movdqa xmm4, xmm0
- punpcklwd xmm0, xmm2 ; 00 10 20 30
- punpckhwd xmm4, xmm2 ; 04 14 24 34
-
- movdqa xmm2, xmm1
- punpcklwd xmm1, xmm3 ; 08 18 28 38
- punpckhwd xmm2, xmm3 ; 0c 1c 2c 3c
-
- ; using xmm[0124]
- ; work on next 4 rows
-
- movdqa xmm3, i4
- movdqa xmm5, xmm3
- punpcklbw xmm3, i5 ; 40 50
- punpckhbw xmm5, i5 ; 48 58
-
- movdqa xmm6, i6
- movdqa xmm7, xmm6
- punpcklbw xmm6, i7 ; 60 70
- punpckhbw xmm7, i7 ; 68 78
-
- movdqa xmm8, xmm3
- punpcklwd xmm3, xmm6 ; 40 50 60 70
- punpckhwd xmm8, xmm6 ; 44 54 64 74
-
- movdqa xmm6, xmm5
- punpcklwd xmm5, xmm7 ; 48 58 68 78
- punpckhwd xmm6, xmm7 ; 4c 5c 6c 7c
-
- ; pull the first two sets together
-
- movdqa xmm7, xmm0
- punpckldq xmm0, xmm3 ; 00 10 20 30 40 50 60 70
- punpckhdq xmm7, xmm3 ; 02 12 22 32 42 52 62 72
-
- movdqa xmm3, xmm4
- punpckldq xmm4, xmm8 ; 04 14 24 34 44 54 64 74
- punpckhdq xmm3, xmm8 ; 06 16 26 36 46 56 66 76
-
- movdqa xmm8, xmm1
- punpckldq xmm1, xmm5 ; 08 18 28 38 48 58 68 78
- punpckhdq xmm8, xmm5 ; 0a 1a 2a 3a 4a 5a 6a 7a
-
- movdqa xmm5, xmm2
- punpckldq xmm2, xmm6 ; 0c 1c 2c 3c 4c 5c 6c 7c
- punpckhdq xmm5, xmm6 ; 0e 1e 2e 3e 4e 5e 6e 7e
- ; final combination
-
- movdqa xmm6, xmm0
- punpcklqdq xmm0, i8
- punpckhqdq xmm6, i8
-
- movdqa xmm9, xmm7
- punpcklqdq xmm7, i9
- punpckhqdq xmm9, i9
-
- movdqa xmm10, xmm4
- punpcklqdq xmm4, i10
- punpckhqdq xmm10, i10
-
- movdqa xmm11, xmm3
- punpcklqdq xmm3, i11
- punpckhqdq xmm11, i11
-
- movdqa xmm12, xmm1
- punpcklqdq xmm1, i12
- punpckhqdq xmm12, i12
-
- movdqa xmm13, xmm8
- punpcklqdq xmm8, i13
- punpckhqdq xmm13, i13
-
- movdqa xmm14, xmm2
- punpcklqdq xmm2, i14
- punpckhqdq xmm14, i14
-
- movdqa xmm15, xmm5
- punpcklqdq xmm5, i15
- punpckhqdq xmm15, i15
-
- movdqa s0, xmm0
- movdqa s1, xmm6
- movdqa s2, xmm7
- movdqa s3, xmm9
- movdqa s4, xmm4
- movdqa s5, xmm10
- movdqa s6, xmm3
- movdqa s7, xmm11
- movdqa s8, xmm1
- movdqa s9, xmm12
- movdqa s10, xmm8
- movdqa s11, xmm13
- movdqa s12, xmm2
- movdqa s13, xmm14
- movdqa s14, xmm5
- movdqa s15, xmm15
-
- ; free stack space
- add rsp, stack_size
-
- ; un-ALIGN_STACK
- pop rsp
-
-%if LIBVPX_YASM_WIN64
- pop r13
- pop r12
- RESTORE_XMM
- pop rbp
-%endif
-
- ret
-
-SECTION_RODATA
-align 16
-te0:
- times 16 db 0xe0
-align 16
-t7f:
- times 16 db 0x7f
-align 16
-tfe:
- times 16 db 0xfe
-align 16
-t1f:
- times 16 db 0x1f
-align 16
-t80:
- times 16 db 0x80
-align 16
-t1:
- times 16 db 0x01
-align 16
-t3:
- times 16 db 0x03
-align 16
-t4:
- times 16 db 0x04
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_mmx.asm
deleted file mode 100644
index 88a07b9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_mmx.asm
+++ /dev/null
@@ -1,1753 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-
-;void vp8_loop_filter_horizontal_edge_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; int count
-;)
-global sym(vp8_loop_filter_horizontal_edge_mmx) PRIVATE
-sym(vp8_loop_filter_horizontal_edge_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 32 ; reserve 32 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- movsxd rcx, dword ptr arg(5) ;count
-.next8_h:
- mov rdx, arg(3) ;limit
- movq mm7, [rdx]
- mov rdi, rsi ; rdi points to row +1 for indirect addressing
- add rdi, rax
-
- ; calculate breakout conditions
- movq mm2, [rdi+2*rax] ; q3
- movq mm1, [rsi+2*rax] ; q2
- movq mm6, mm1 ; q2
- psubusb mm1, mm2 ; q2-=q3
- psubusb mm2, mm6 ; q3-=q2
- por mm1, mm2 ; abs(q3-q2)
- psubusb mm1, mm7 ;
-
-
- movq mm4, [rsi+rax] ; q1
- movq mm3, mm4 ; q1
- psubusb mm4, mm6 ; q1-=q2
- psubusb mm6, mm3 ; q2-=q1
- por mm4, mm6 ; abs(q2-q1)
-
- psubusb mm4, mm7
- por mm1, mm4
-
- movq mm4, [rsi] ; q0
- movq mm0, mm4 ; q0
- psubusb mm4, mm3 ; q0-=q1
- psubusb mm3, mm0 ; q1-=q0
- por mm4, mm3 ; abs(q0-q1)
- movq t0, mm4 ; save to t0
- psubusb mm4, mm7
- por mm1, mm4
-
-
- neg rax ; negate pitch to deal with above border
-
- movq mm2, [rsi+4*rax] ; p3
- movq mm4, [rdi+4*rax] ; p2
- movq mm5, mm4 ; p2
- psubusb mm4, mm2 ; p2-=p3
- psubusb mm2, mm5 ; p3-=p2
- por mm4, mm2 ; abs(p3 - p2)
- psubusb mm4, mm7
- por mm1, mm4
-
-
- movq mm4, [rsi+2*rax] ; p1
- movq mm3, mm4 ; p1
- psubusb mm4, mm5 ; p1-=p2
- psubusb mm5, mm3 ; p2-=p1
- por mm4, mm5 ; abs(p2 - p1)
- psubusb mm4, mm7
- por mm1, mm4
-
- movq mm2, mm3 ; p1
-
- movq mm4, [rsi+rax] ; p0
- movq mm5, mm4 ; p0
- psubusb mm4, mm3 ; p0-=p1
- psubusb mm3, mm5 ; p1-=p0
- por mm4, mm3 ; abs(p1 - p0)
- movq t1, mm4 ; save to t1
- psubusb mm4, mm7
- por mm1, mm4
-
- movq mm3, [rdi] ; q1
- movq mm4, mm3 ; q1
- psubusb mm3, mm2 ; q1-=p1
- psubusb mm2, mm4 ; p1-=q1
- por mm2, mm3 ; abs(p1-q1)
- pand mm2, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm2, 1 ; abs(p1-q1)/2
-
- movq mm6, mm5 ; p0
- movq mm3, [rsi] ; q0
- psubusb mm5, mm3 ; p0-=q0
- psubusb mm3, mm6 ; q0-=p0
- por mm5, mm3 ; abs(p0 - q0)
- paddusb mm5, mm5 ; abs(p0-q0)*2
- paddusb mm5, mm2 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- mov rdx, arg(2) ;blimit ; get blimit
- movq mm7, [rdx] ; blimit
-
- psubusb mm5, mm7 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- por mm1, mm5
- pxor mm5, mm5
- pcmpeqb mm1, mm5 ; mask mm1
-
- ; calculate high edge variance
- mov rdx, arg(4) ;thresh ; get thresh
- movq mm7, [rdx] ;
- movq mm4, t0 ; get abs (q1 - q0)
- psubusb mm4, mm7
- movq mm3, t1 ; get abs (p1 - p0)
- psubusb mm3, mm7
- paddb mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
-
- pcmpeqb mm4, mm5
-
- pcmpeqb mm5, mm5
- pxor mm4, mm5
-
-
- ; start work on filters
- movq mm2, [rsi+2*rax] ; p1
- movq mm7, [rdi] ; q1
- pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values
- psubsb mm2, mm7 ; p1 - q1
- pand mm2, mm4 ; high var mask (hvm)(p1 - q1)
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
- pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values
- movq mm3, mm0 ; q0
- psubsb mm0, mm6 ; q0 - p0
- paddsb mm2, mm0 ; 1 * (q0 - p0) + hvm(p1 - q1)
- paddsb mm2, mm0 ; 2 * (q0 - p0) + hvm(p1 - q1)
- paddsb mm2, mm0 ; 3 * (q0 - p0) + hvm(p1 - q1)
- pand mm1, mm2 ; mask filter values we don't care about
- movq mm2, mm1
- paddsb mm1, [GLOBAL(t4)] ; 3* (q0 - p0) + hvm(p1 - q1) + 4
- paddsb mm2, [GLOBAL(t3)] ; 3* (q0 - p0) + hvm(p1 - q1) + 3
-
- pxor mm0, mm0 ;
- pxor mm5, mm5
- punpcklbw mm0, mm2 ;
- punpckhbw mm5, mm2 ;
- psraw mm0, 11 ;
- psraw mm5, 11
- packsswb mm0, mm5
- movq mm2, mm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
-
- pxor mm0, mm0 ; 0
- movq mm5, mm1 ; abcdefgh
- punpcklbw mm0, mm1 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
- pxor mm1, mm1 ; 0
- punpckhbw mm1, mm5 ; a0b0c0d0
- psraw mm1, 11 ; sign extended shift right by 3
- movq mm5, mm0 ; save results
-
- packsswb mm0, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3
- paddsw mm5, [GLOBAL(ones)]
- paddsw mm1, [GLOBAL(ones)]
- psraw mm5, 1 ; partial shifted one more time for 2nd tap
- psraw mm1, 1 ; partial shifted one more time for 2nd tap
- packsswb mm5, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4
- pandn mm4, mm5 ; high edge variance additive
-
- paddsb mm6, mm2 ; p0+= p0 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
- movq [rsi+rax], mm6 ; write back
-
- movq mm6, [rsi+2*rax] ; p1
- pxor mm6, [GLOBAL(t80)] ; reoffset
- paddsb mm6, mm4 ; p1+= p1 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
- movq [rsi+2*rax], mm6 ; write back
-
- psubsb mm3, mm0 ; q0-= q0 add
- pxor mm3, [GLOBAL(t80)] ; unoffset
- movq [rsi], mm3 ; write back
-
- psubsb mm7, mm4 ; q1-= q1 add
- pxor mm7, [GLOBAL(t80)] ; unoffset
- movq [rdi], mm7 ; write back
-
- add rsi,8
- neg rax
- dec rcx
- jnz .next8_h
-
- add rsp, 32
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_loop_filter_vertical_edge_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; int count
-;)
-global sym(vp8_loop_filter_vertical_edge_mmx) PRIVATE
-sym(vp8_loop_filter_vertical_edge_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 64 ; reserve 64 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8];
- %define srct [rsp + 32] ;__declspec(align(16)) char srct[32];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- lea rsi, [rsi + rax*4 - 4]
-
- movsxd rcx, dword ptr arg(5) ;count
-.next8_v:
- mov rdi, rsi ; rdi points to row +1 for indirect addressing
- add rdi, rax
-
-
- ;transpose
- movq mm6, [rsi+2*rax] ; 67 66 65 64 63 62 61 60
- movq mm7, mm6 ; 77 76 75 74 73 72 71 70
-
- punpckhbw mm7, [rdi+2*rax] ; 77 67 76 66 75 65 74 64
- punpcklbw mm6, [rdi+2*rax] ; 73 63 72 62 71 61 70 60
-
- movq mm4, [rsi] ; 47 46 45 44 43 42 41 40
- movq mm5, mm4 ; 47 46 45 44 43 42 41 40
-
- punpckhbw mm5, [rsi+rax] ; 57 47 56 46 55 45 54 44
- punpcklbw mm4, [rsi+rax] ; 53 43 52 42 51 41 50 40
-
- movq mm3, mm5 ; 57 47 56 46 55 45 54 44
- punpckhwd mm5, mm7 ; 77 67 57 47 76 66 56 46
-
- punpcklwd mm3, mm7 ; 75 65 55 45 74 64 54 44
- movq mm2, mm4 ; 53 43 52 42 51 41 50 40
-
- punpckhwd mm4, mm6 ; 73 63 53 43 72 62 52 42
- punpcklwd mm2, mm6 ; 71 61 51 41 70 60 50 40
-
- neg rax
- movq mm6, [rsi+rax*2] ; 27 26 25 24 23 22 21 20
-
- movq mm1, mm6 ; 27 26 25 24 23 22 21 20
- punpckhbw mm6, [rsi+rax] ; 37 27 36 36 35 25 34 24
-
- punpcklbw mm1, [rsi+rax] ; 33 23 32 22 31 21 30 20
- movq mm7, [rsi+rax*4]; ; 07 06 05 04 03 02 01 00
-
- punpckhbw mm7, [rdi+rax*4] ; 17 07 16 06 15 05 14 04
- movq mm0, mm7 ; 17 07 16 06 15 05 14 04
-
- punpckhwd mm7, mm6 ; 37 27 17 07 36 26 16 06
- punpcklwd mm0, mm6 ; 35 25 15 05 34 24 14 04
-
- movq mm6, mm7 ; 37 27 17 07 36 26 16 06
- punpckhdq mm7, mm5 ; 77 67 57 47 37 27 17 07 = q3
-
- punpckldq mm6, mm5 ; 76 66 56 46 36 26 16 06 = q2
-
- movq mm5, mm6 ; 76 66 56 46 36 26 16 06
- psubusb mm5, mm7 ; q2-q3
-
- psubusb mm7, mm6 ; q3-q2
- por mm7, mm5; ; mm7=abs (q3-q2)
-
- movq mm5, mm0 ; 35 25 15 05 34 24 14 04
- punpckhdq mm5, mm3 ; 75 65 55 45 35 25 15 05 = q1
-
- punpckldq mm0, mm3 ; 74 64 54 44 34 24 15 04 = q0
- movq mm3, mm5 ; 75 65 55 45 35 25 15 05 = q1
-
- psubusb mm3, mm6 ; q1-q2
- psubusb mm6, mm5 ; q2-q1
-
- por mm6, mm3 ; mm6=abs(q2-q1)
- lea rdx, srct
-
- movq [rdx+24], mm5 ; save q1
- movq [rdx+16], mm0 ; save q0
-
- movq mm3, [rsi+rax*4] ; 07 06 05 04 03 02 01 00
- punpcklbw mm3, [rdi+rax*4] ; 13 03 12 02 11 01 10 00
-
- movq mm0, mm3 ; 13 03 12 02 11 01 10 00
- punpcklwd mm0, mm1 ; 31 21 11 01 30 20 10 00
-
- punpckhwd mm3, mm1 ; 33 23 13 03 32 22 12 02
- movq mm1, mm0 ; 31 21 11 01 30 20 10 00
-
- punpckldq mm0, mm2 ; 70 60 50 40 30 20 10 00 =p3
- punpckhdq mm1, mm2 ; 71 61 51 41 31 21 11 01 =p2
-
- movq mm2, mm1 ; 71 61 51 41 31 21 11 01 =p2
- psubusb mm2, mm0 ; p2-p3
-
- psubusb mm0, mm1 ; p3-p2
- por mm0, mm2 ; mm0=abs(p3-p2)
-
- movq mm2, mm3 ; 33 23 13 03 32 22 12 02
- punpckldq mm2, mm4 ; 72 62 52 42 32 22 12 02 = p1
-
- punpckhdq mm3, mm4 ; 73 63 53 43 33 23 13 03 = p0
- movq [rdx+8], mm3 ; save p0
-
- movq [rdx], mm2 ; save p1
- movq mm5, mm2 ; mm5 = p1
-
- psubusb mm2, mm1 ; p1-p2
- psubusb mm1, mm5 ; p2-p1
-
- por mm1, mm2 ; mm1=abs(p2-p1)
- mov rdx, arg(3) ;limit
-
- movq mm4, [rdx] ; mm4 = limit
- psubusb mm7, mm4
-
- psubusb mm0, mm4
- psubusb mm1, mm4
-
- psubusb mm6, mm4
- por mm7, mm6
-
- por mm0, mm1
- por mm0, mm7 ; abs(q3-q2) > limit || abs(p3-p2) > limit ||abs(p2-p1) > limit || abs(q2-q1) > limit
-
- movq mm1, mm5 ; p1
-
- movq mm7, mm3 ; mm3=mm7=p0
- psubusb mm7, mm5 ; p0 - p1
-
- psubusb mm5, mm3 ; p1 - p0
- por mm5, mm7 ; abs(p1-p0)
-
- movq t0, mm5 ; save abs(p1-p0)
- lea rdx, srct
-
- psubusb mm5, mm4
- por mm0, mm5 ; mm0=mask
-
- movq mm5, [rdx+16] ; mm5=q0
- movq mm7, [rdx+24] ; mm7=q1
-
- movq mm6, mm5 ; mm6=q0
- movq mm2, mm7 ; q1
- psubusb mm5, mm7 ; q0-q1
-
- psubusb mm7, mm6 ; q1-q0
- por mm7, mm5 ; abs(q1-q0)
-
- movq t1, mm7 ; save abs(q1-q0)
- psubusb mm7, mm4
-
- por mm0, mm7 ; mask
-
- movq mm5, mm2 ; q1
- psubusb mm5, mm1 ; q1-=p1
- psubusb mm1, mm2 ; p1-=q1
- por mm5, mm1 ; abs(p1-q1)
- pand mm5, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm5, 1 ; abs(p1-q1)/2
-
- mov rdx, arg(2) ;blimit ;
-
- movq mm4, [rdx] ;blimit
- movq mm1, mm3 ; mm1=mm3=p0
-
- movq mm7, mm6 ; mm7=mm6=q0
- psubusb mm1, mm7 ; p0-q0
-
- psubusb mm7, mm3 ; q0-p0
- por mm1, mm7 ; abs(q0-p0)
- paddusb mm1, mm1 ; abs(q0-p0)*2
- paddusb mm1, mm5 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- psubusb mm1, mm4 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- por mm1, mm0; ; mask
-
- pxor mm0, mm0
- pcmpeqb mm1, mm0
-
- ; calculate high edge variance
- mov rdx, arg(4) ;thresh ; get thresh
- movq mm7, [rdx]
- ;
- movq mm4, t0 ; get abs (q1 - q0)
- psubusb mm4, mm7
-
- movq mm3, t1 ; get abs (p1 - p0)
- psubusb mm3, mm7
-
- por mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
- pcmpeqb mm4, mm0
-
- pcmpeqb mm0, mm0
- pxor mm4, mm0
-
-
-
- ; start work on filters
- lea rdx, srct
-
- movq mm2, [rdx] ; p1
- movq mm7, [rdx+24] ; q1
-
- movq mm6, [rdx+8] ; p0
- movq mm0, [rdx+16] ; q0
-
- pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values
-
- psubsb mm2, mm7 ; p1 - q1
- pand mm2, mm4 ; high var mask (hvm)(p1 - q1)
-
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
- pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values
-
- movq mm3, mm0 ; q0
- psubsb mm0, mm6 ; q0 - p0
-
- paddsb mm2, mm0 ; 1 * (q0 - p0) + hvm(p1 - q1)
- paddsb mm2, mm0 ; 2 * (q0 - p0) + hvm(p1 - q1)
-
- paddsb mm2, mm0 ; 3 * (q0 - p0) + hvm(p1 - q1)
- pand mm1, mm2 ; mask filter values we don't care about
-
- movq mm2, mm1
- paddsb mm1, [GLOBAL(t4)] ; 3* (q0 - p0) + hvm(p1 - q1) + 4
-
- paddsb mm2, [GLOBAL(t3)] ; 3* (q0 - p0) + hvm(p1 - q1) + 3
- pxor mm0, mm0 ;
-
- pxor mm5, mm5
- punpcklbw mm0, mm2 ;
-
- punpckhbw mm5, mm2 ;
- psraw mm0, 11 ;
-
- psraw mm5, 11
- packsswb mm0, mm5
-
- movq mm2, mm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
-
- pxor mm0, mm0 ; 0
- movq mm5, mm1 ; abcdefgh
-
- punpcklbw mm0, mm1 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
-
- pxor mm1, mm1 ; 0
- punpckhbw mm1, mm5 ; a0b0c0d0
-
- psraw mm1, 11 ; sign extended shift right by 3
- movq mm5, mm0 ; save results
-
- packsswb mm0, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3
- paddsw mm5, [GLOBAL(ones)]
-
- paddsw mm1, [GLOBAL(ones)]
- psraw mm5, 1 ; partial shifted one more time for 2nd tap
-
- psraw mm1, 1 ; partial shifted one more time for 2nd tap
- packsswb mm5, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4
-
- pandn mm4, mm5 ; high edge variance additive
-
- paddsb mm6, mm2 ; p0+= p0 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
-
- ; mm6=p0 ;
- movq mm1, [rdx] ; p1
- pxor mm1, [GLOBAL(t80)] ; reoffset
-
- paddsb mm1, mm4 ; p1+= p1 add
- pxor mm1, [GLOBAL(t80)] ; unoffset
- ; mm6 = p0 mm1 = p1
-
- psubsb mm3, mm0 ; q0-= q0 add
- pxor mm3, [GLOBAL(t80)] ; unoffset
-
- ; mm3 = q0
- psubsb mm7, mm4 ; q1-= q1 add
- pxor mm7, [GLOBAL(t80)] ; unoffset
- ; mm7 = q1
-
- ; transpose and write back
- ; mm1 = 72 62 52 42 32 22 12 02
- ; mm6 = 73 63 53 43 33 23 13 03
- ; mm3 = 74 64 54 44 34 24 14 04
- ; mm7 = 75 65 55 45 35 25 15 05
-
- movq mm2, mm1 ; 72 62 52 42 32 22 12 02
- punpcklbw mm2, mm6 ; 33 32 23 22 13 12 03 02
-
- movq mm4, mm3 ; 74 64 54 44 34 24 14 04
- punpckhbw mm1, mm6 ; 73 72 63 62 53 52 43 42
-
- punpcklbw mm4, mm7 ; 35 34 25 24 15 14 05 04
- punpckhbw mm3, mm7 ; 75 74 65 64 55 54 45 44
-
- movq mm6, mm2 ; 33 32 23 22 13 12 03 02
- punpcklwd mm2, mm4 ; 15 14 13 12 05 04 03 02
-
- punpckhwd mm6, mm4 ; 35 34 33 32 25 24 23 22
- movq mm5, mm1 ; 73 72 63 62 53 52 43 42
-
- punpcklwd mm1, mm3 ; 55 54 53 52 45 44 43 42
- punpckhwd mm5, mm3 ; 75 74 73 72 65 64 63 62
-
-
- ; mm2 = 15 14 13 12 05 04 03 02
- ; mm6 = 35 34 33 32 25 24 23 22
- ; mm5 = 55 54 53 52 45 44 43 42
- ; mm1 = 75 74 73 72 65 64 63 62
-
-
-
- movd [rsi+rax*4+2], mm2
- psrlq mm2, 32
-
- movd [rdi+rax*4+2], mm2
- movd [rsi+rax*2+2], mm6
-
- psrlq mm6, 32
- movd [rsi+rax+2],mm6
-
- movd [rsi+2], mm1
- psrlq mm1, 32
-
- movd [rdi+2], mm1
- neg rax
-
- movd [rdi+rax+2],mm5
- psrlq mm5, 32
-
- movd [rdi+rax*2+2], mm5
-
- lea rsi, [rsi+rax*8]
- dec rcx
- jnz .next8_v
-
- add rsp, 64
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_mbloop_filter_horizontal_edge_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; int count
-;)
-global sym(vp8_mbloop_filter_horizontal_edge_mmx) PRIVATE
-sym(vp8_mbloop_filter_horizontal_edge_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 32 ; reserve 32 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- movsxd rcx, dword ptr arg(5) ;count
-.next8_mbh:
- mov rdx, arg(3) ;limit
- movq mm7, [rdx]
- mov rdi, rsi ; rdi points to row +1 for indirect addressing
- add rdi, rax
-
- ; calculate breakout conditions
- movq mm2, [rdi+2*rax] ; q3
-
- movq mm1, [rsi+2*rax] ; q2
- movq mm6, mm1 ; q2
- psubusb mm1, mm2 ; q2-=q3
- psubusb mm2, mm6 ; q3-=q2
- por mm1, mm2 ; abs(q3-q2)
- psubusb mm1, mm7
-
-
- ; mm1 = abs(q3-q2), mm6 =q2, mm7 = limit
- movq mm4, [rsi+rax] ; q1
- movq mm3, mm4 ; q1
- psubusb mm4, mm6 ; q1-=q2
- psubusb mm6, mm3 ; q2-=q1
- por mm4, mm6 ; abs(q2-q1)
- psubusb mm4, mm7
- por mm1, mm4
-
-
- ; mm1 = mask, mm3=q1, mm7 = limit
-
- movq mm4, [rsi] ; q0
- movq mm0, mm4 ; q0
- psubusb mm4, mm3 ; q0-=q1
- psubusb mm3, mm0 ; q1-=q0
- por mm4, mm3 ; abs(q0-q1)
- movq t0, mm4 ; save to t0
- psubusb mm4, mm7
- por mm1, mm4
-
-
- ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1)
-
- neg rax ; negate pitch to deal with above border
-
- movq mm2, [rsi+4*rax] ; p3
- movq mm4, [rdi+4*rax] ; p2
- movq mm5, mm4 ; p2
- psubusb mm4, mm2 ; p2-=p3
- psubusb mm2, mm5 ; p3-=p2
- por mm4, mm2 ; abs(p3 - p2)
- psubusb mm4, mm7
- por mm1, mm4
- ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1)
-
- movq mm4, [rsi+2*rax] ; p1
- movq mm3, mm4 ; p1
- psubusb mm4, mm5 ; p1-=p2
- psubusb mm5, mm3 ; p2-=p1
- por mm4, mm5 ; abs(p2 - p1)
- psubusb mm4, mm7
- por mm1, mm4
-
- movq mm2, mm3 ; p1
-
-
- ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1)
-
- movq mm4, [rsi+rax] ; p0
- movq mm5, mm4 ; p0
- psubusb mm4, mm3 ; p0-=p1
- psubusb mm3, mm5 ; p1-=p0
- por mm4, mm3 ; abs(p1 - p0)
- movq t1, mm4 ; save to t1
- psubusb mm4, mm7
- por mm1, mm4
- ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1) t1 = abs(p1-p0)
- ; mm5 = p0
- movq mm3, [rdi] ; q1
- movq mm4, mm3 ; q1
- psubusb mm3, mm2 ; q1-=p1
- psubusb mm2, mm4 ; p1-=q1
- por mm2, mm3 ; abs(p1-q1)
- pand mm2, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm2, 1 ; abs(p1-q1)/2
-
- movq mm6, mm5 ; p0
- movq mm3, mm0 ; q0
- psubusb mm5, mm3 ; p0-=q0
- psubusb mm3, mm6 ; q0-=p0
- por mm5, mm3 ; abs(p0 - q0)
- paddusb mm5, mm5 ; abs(p0-q0)*2
- paddusb mm5, mm2 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- mov rdx, arg(2) ;blimit ; get blimit
- movq mm7, [rdx] ; blimit
-
- psubusb mm5, mm7 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- por mm1, mm5
- pxor mm5, mm5
- pcmpeqb mm1, mm5 ; mask mm1
-
- ; mm1 = mask, mm0=q0, mm7 = blimit, t0 = abs(q0-q1) t1 = abs(p1-p0)
- ; mm6 = p0,
-
- ; calculate high edge variance
- mov rdx, arg(4) ;thresh ; get thresh
- movq mm7, [rdx] ;
- movq mm4, t0 ; get abs (q1 - q0)
- psubusb mm4, mm7
- movq mm3, t1 ; get abs (p1 - p0)
- psubusb mm3, mm7
- paddb mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
-
- pcmpeqb mm4, mm5
-
- pcmpeqb mm5, mm5
- pxor mm4, mm5
-
-
-
- ; mm1 = mask, mm0=q0, mm7 = thresh, t0 = abs(q0-q1) t1 = abs(p1-p0)
- ; mm6 = p0, mm4=hev
- ; start work on filters
- movq mm2, [rsi+2*rax] ; p1
- movq mm7, [rdi] ; q1
- pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values
- psubsb mm2, mm7 ; p1 - q1
-
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
- pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values
- movq mm3, mm0 ; q0
- psubsb mm0, mm6 ; q0 - p0
- paddsb mm2, mm0 ; 1 * (q0 - p0) + (p1 - q1)
- paddsb mm2, mm0 ; 2 * (q0 - p0)
- paddsb mm2, mm0 ; 3 * (q0 - p0) + (p1 - q1)
- pand mm1, mm2 ; mask filter values we don't care about
-
-
- ; mm1 = vp8_filter, mm4=hev, mm6=ps0, mm3=qs0
- movq mm2, mm1 ; vp8_filter
- pand mm2, mm4; ; Filter2 = vp8_filter & hev
-
- movq mm5, mm2 ;
- paddsb mm5, [GLOBAL(t3)];
-
- pxor mm0, mm0 ; 0
- pxor mm7, mm7 ; 0
-
- punpcklbw mm0, mm5 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
- punpckhbw mm7, mm5 ; a0b0c0d0
- psraw mm7, 11 ; sign extended shift right by 3
- packsswb mm0, mm7 ; Filter2 >>=3;
-
- movq mm5, mm0 ; Filter2
-
- paddsb mm2, [GLOBAL(t4)] ; vp8_signed_char_clamp(Filter2 + 4)
- pxor mm0, mm0 ; 0
- pxor mm7, mm7 ; 0
-
- punpcklbw mm0, mm2 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
- punpckhbw mm7, mm2 ; a0b0c0d0
- psraw mm7, 11 ; sign extended shift right by 3
- packsswb mm0, mm7 ; Filter2 >>=3;
-
- ; mm0= filter2 mm1 = vp8_filter, mm3 =qs0 mm5=s mm4 =hev mm6=ps0
- psubsb mm3, mm0 ; qs0 =qs0 - filter1
- paddsb mm6, mm5 ; ps0 =ps0 + Fitler2
-
- ; mm1=vp8_filter, mm3=qs0, mm4 =hev mm6=ps0
- ; vp8_filter &= ~hev;
- ; Filter2 = vp8_filter;
- pandn mm4, mm1 ; vp8_filter&=~hev
-
-
- ; mm3=qs0, mm4=filter2, mm6=ps0
-
- ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7);
- ; s = vp8_signed_char_clamp(qs0 - u);
- ; *oq0 = s^0x80;
- ; s = vp8_signed_char_clamp(ps0 + u);
- ; *op0 = s^0x80;
- pxor mm0, mm0
-
- pxor mm1, mm1
- pxor mm2, mm2
- punpcklbw mm1, mm4
- punpckhbw mm2, mm4
- pmulhw mm1, [GLOBAL(s27)]
- pmulhw mm2, [GLOBAL(s27)]
- paddw mm1, [GLOBAL(s63)]
- paddw mm2, [GLOBAL(s63)]
- psraw mm1, 7
- psraw mm2, 7
- packsswb mm1, mm2
-
- psubsb mm3, mm1
- paddsb mm6, mm1
-
- pxor mm3, [GLOBAL(t80)]
- pxor mm6, [GLOBAL(t80)]
- movq [rsi+rax], mm6
- movq [rsi], mm3
-
- ; roughly 2/7th difference across boundary
- ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7);
- ; s = vp8_signed_char_clamp(qs1 - u);
- ; *oq1 = s^0x80;
- ; s = vp8_signed_char_clamp(ps1 + u);
- ; *op1 = s^0x80;
- pxor mm1, mm1
- pxor mm2, mm2
- punpcklbw mm1, mm4
- punpckhbw mm2, mm4
- pmulhw mm1, [GLOBAL(s18)]
- pmulhw mm2, [GLOBAL(s18)]
- paddw mm1, [GLOBAL(s63)]
- paddw mm2, [GLOBAL(s63)]
- psraw mm1, 7
- psraw mm2, 7
- packsswb mm1, mm2
-
- movq mm3, [rdi]
- movq mm6, [rsi+rax*2] ; p1
-
- pxor mm3, [GLOBAL(t80)]
- pxor mm6, [GLOBAL(t80)]
-
- paddsb mm6, mm1
- psubsb mm3, mm1
-
- pxor mm6, [GLOBAL(t80)]
- pxor mm3, [GLOBAL(t80)]
- movq [rdi], mm3
- movq [rsi+rax*2], mm6
-
- ; roughly 1/7th difference across boundary
- ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7);
- ; s = vp8_signed_char_clamp(qs2 - u);
- ; *oq2 = s^0x80;
- ; s = vp8_signed_char_clamp(ps2 + u);
- ; *op2 = s^0x80;
- pxor mm1, mm1
- pxor mm2, mm2
- punpcklbw mm1, mm4
- punpckhbw mm2, mm4
- pmulhw mm1, [GLOBAL(s9)]
- pmulhw mm2, [GLOBAL(s9)]
- paddw mm1, [GLOBAL(s63)]
- paddw mm2, [GLOBAL(s63)]
- psraw mm1, 7
- psraw mm2, 7
- packsswb mm1, mm2
-
-
- movq mm6, [rdi+rax*4]
- neg rax
- movq mm3, [rdi+rax ]
-
- pxor mm6, [GLOBAL(t80)]
- pxor mm3, [GLOBAL(t80)]
-
- paddsb mm6, mm1
- psubsb mm3, mm1
-
- pxor mm6, [GLOBAL(t80)]
- pxor mm3, [GLOBAL(t80)]
- movq [rdi+rax ], mm3
- neg rax
- movq [rdi+rax*4], mm6
-
-;EARLY_BREAK_OUT:
- neg rax
- add rsi,8
- dec rcx
- jnz .next8_mbh
-
- add rsp, 32
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_mbloop_filter_vertical_edge_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; int count
-;)
-global sym(vp8_mbloop_filter_vertical_edge_mmx) PRIVATE
-sym(vp8_mbloop_filter_vertical_edge_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 96 ; reserve 96 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8];
- %define srct [rsp + 32] ;__declspec(align(16)) char srct[64];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- lea rsi, [rsi + rax*4 - 4]
-
- movsxd rcx, dword ptr arg(5) ;count
-.next8_mbv:
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
-
- ;transpose
- movq mm0, [rdi+2*rax] ; 77 76 75 74 73 72 71 70
- movq mm6, [rsi+2*rax] ; 67 66 65 64 63 62 61 60
-
- movq mm7, mm6 ; 77 76 75 74 73 72 71 70
- punpckhbw mm7, mm0 ; 77 67 76 66 75 65 74 64
-
- punpcklbw mm6, mm0 ; 73 63 72 62 71 61 70 60
- movq mm0, [rsi+rax] ; 57 56 55 54 53 52 51 50
-
- movq mm4, [rsi] ; 47 46 45 44 43 42 41 40
- movq mm5, mm4 ; 47 46 45 44 43 42 41 40
-
- punpckhbw mm5, mm0 ; 57 47 56 46 55 45 54 44
- punpcklbw mm4, mm0 ; 53 43 52 42 51 41 50 40
-
- movq mm3, mm5 ; 57 47 56 46 55 45 54 44
- punpckhwd mm5, mm7 ; 77 67 57 47 76 66 56 46
-
- punpcklwd mm3, mm7 ; 75 65 55 45 74 64 54 44
- movq mm2, mm4 ; 53 43 52 42 51 41 50 40
-
- punpckhwd mm4, mm6 ; 73 63 53 43 72 62 52 42
- punpcklwd mm2, mm6 ; 71 61 51 41 70 60 50 40
-
- neg rax
-
- movq mm7, [rsi+rax] ; 37 36 35 34 33 32 31 30
- movq mm6, [rsi+rax*2] ; 27 26 25 24 23 22 21 20
-
- movq mm1, mm6 ; 27 26 25 24 23 22 21 20
- punpckhbw mm6, mm7 ; 37 27 36 36 35 25 34 24
-
- punpcklbw mm1, mm7 ; 33 23 32 22 31 21 30 20
-
- movq mm7, [rsi+rax*4]; ; 07 06 05 04 03 02 01 00
- punpckhbw mm7, [rdi+rax*4] ; 17 07 16 06 15 05 14 04
-
- movq mm0, mm7 ; 17 07 16 06 15 05 14 04
- punpckhwd mm7, mm6 ; 37 27 17 07 36 26 16 06
-
- punpcklwd mm0, mm6 ; 35 25 15 05 34 24 14 04
- movq mm6, mm7 ; 37 27 17 07 36 26 16 06
-
- punpckhdq mm7, mm5 ; 77 67 57 47 37 27 17 07 = q3
- punpckldq mm6, mm5 ; 76 66 56 46 36 26 16 06 = q2
-
- lea rdx, srct
- movq mm5, mm6 ; 76 66 56 46 36 26 16 06
-
- movq [rdx+56], mm7
- psubusb mm5, mm7 ; q2-q3
-
-
- movq [rdx+48], mm6
- psubusb mm7, mm6 ; q3-q2
-
- por mm7, mm5; ; mm7=abs (q3-q2)
- movq mm5, mm0 ; 35 25 15 05 34 24 14 04
-
- punpckhdq mm5, mm3 ; 75 65 55 45 35 25 15 05 = q1
- punpckldq mm0, mm3 ; 74 64 54 44 34 24 15 04 = q0
-
- movq mm3, mm5 ; 75 65 55 45 35 25 15 05 = q1
- psubusb mm3, mm6 ; q1-q2
-
- psubusb mm6, mm5 ; q2-q1
- por mm6, mm3 ; mm6=abs(q2-q1)
-
- movq [rdx+40], mm5 ; save q1
- movq [rdx+32], mm0 ; save q0
-
- movq mm3, [rsi+rax*4] ; 07 06 05 04 03 02 01 00
- punpcklbw mm3, [rdi+rax*4] ; 13 03 12 02 11 01 10 00
-
- movq mm0, mm3 ; 13 03 12 02 11 01 10 00
- punpcklwd mm0, mm1 ; 31 21 11 01 30 20 10 00
-
- punpckhwd mm3, mm1 ; 33 23 13 03 32 22 12 02
- movq mm1, mm0 ; 31 21 11 01 30 20 10 00
-
- punpckldq mm0, mm2 ; 70 60 50 40 30 20 10 00 =p3
- punpckhdq mm1, mm2 ; 71 61 51 41 31 21 11 01 =p2
-
- movq [rdx], mm0 ; save p3
- movq [rdx+8], mm1 ; save p2
-
- movq mm2, mm1 ; 71 61 51 41 31 21 11 01 =p2
- psubusb mm2, mm0 ; p2-p3
-
- psubusb mm0, mm1 ; p3-p2
- por mm0, mm2 ; mm0=abs(p3-p2)
-
- movq mm2, mm3 ; 33 23 13 03 32 22 12 02
- punpckldq mm2, mm4 ; 72 62 52 42 32 22 12 02 = p1
-
- punpckhdq mm3, mm4 ; 73 63 53 43 33 23 13 03 = p0
- movq [rdx+24], mm3 ; save p0
-
- movq [rdx+16], mm2 ; save p1
- movq mm5, mm2 ; mm5 = p1
-
- psubusb mm2, mm1 ; p1-p2
- psubusb mm1, mm5 ; p2-p1
-
- por mm1, mm2 ; mm1=abs(p2-p1)
- mov rdx, arg(3) ;limit
-
- movq mm4, [rdx] ; mm4 = limit
- psubusb mm7, mm4 ; abs(q3-q2) > limit
-
- psubusb mm0, mm4 ; abs(p3-p2) > limit
- psubusb mm1, mm4 ; abs(p2-p1) > limit
-
- psubusb mm6, mm4 ; abs(q2-q1) > limit
- por mm7, mm6 ; or
-
- por mm0, mm1 ;
- por mm0, mm7 ; abs(q3-q2) > limit || abs(p3-p2) > limit ||abs(p2-p1) > limit || abs(q2-q1) > limit
-
- movq mm1, mm5 ; p1
-
- movq mm7, mm3 ; mm3=mm7=p0
- psubusb mm7, mm5 ; p0 - p1
-
- psubusb mm5, mm3 ; p1 - p0
- por mm5, mm7 ; abs(p1-p0)
-
- movq t0, mm5 ; save abs(p1-p0)
- lea rdx, srct
-
- psubusb mm5, mm4 ; mm5 = abs(p1-p0) > limit
- por mm0, mm5 ; mm0=mask
-
- movq mm5, [rdx+32] ; mm5=q0
- movq mm7, [rdx+40] ; mm7=q1
-
- movq mm6, mm5 ; mm6=q0
- movq mm2, mm7 ; q1
- psubusb mm5, mm7 ; q0-q1
-
- psubusb mm7, mm6 ; q1-q0
- por mm7, mm5 ; abs(q1-q0)
-
- movq t1, mm7 ; save abs(q1-q0)
- psubusb mm7, mm4 ; mm7=abs(q1-q0)> limit
-
- por mm0, mm7 ; mask
-
- movq mm5, mm2 ; q1
- psubusb mm5, mm1 ; q1-=p1
- psubusb mm1, mm2 ; p1-=q1
- por mm5, mm1 ; abs(p1-q1)
- pand mm5, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm5, 1 ; abs(p1-q1)/2
-
- mov rdx, arg(2) ;blimit ;
-
- movq mm4, [rdx] ;blimit
- movq mm1, mm3 ; mm1=mm3=p0
-
- movq mm7, mm6 ; mm7=mm6=q0
- psubusb mm1, mm7 ; p0-q0
-
- psubusb mm7, mm3 ; q0-p0
- por mm1, mm7 ; abs(q0-p0)
- paddusb mm1, mm1 ; abs(q0-p0)*2
- paddusb mm1, mm5 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- psubusb mm1, mm4 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- por mm1, mm0; ; mask
-
- pxor mm0, mm0
- pcmpeqb mm1, mm0
-
- ; calculate high edge variance
- mov rdx, arg(4) ;thresh ; get thresh
- movq mm7, [rdx]
- ;
- movq mm4, t0 ; get abs (q1 - q0)
- psubusb mm4, mm7 ; abs(q1 - q0) > thresh
-
- movq mm3, t1 ; get abs (p1 - p0)
- psubusb mm3, mm7 ; abs(p1 - p0)> thresh
-
- por mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
- pcmpeqb mm4, mm0
-
- pcmpeqb mm0, mm0
- pxor mm4, mm0
-
-
-
-
- ; start work on filters
- lea rdx, srct
-
- ; start work on filters
- movq mm2, [rdx+16] ; p1
- movq mm7, [rdx+40] ; q1
- pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values
- psubsb mm2, mm7 ; p1 - q1
-
- movq mm6, [rdx+24] ; p0
- movq mm0, [rdx+32] ; q0
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
- pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values
-
- movq mm3, mm0 ; q0
- psubsb mm0, mm6 ; q0 - p0
- paddsb mm2, mm0 ; 1 * (q0 - p0) + (p1 - q1)
- paddsb mm2, mm0 ; 2 * (q0 - p0)
- paddsb mm2, mm0 ; 3 * (q0 - p0) + (p1 - q1)
- pand mm1, mm2 ; mask filter values we don't care about
-
- ; mm1 = vp8_filter, mm4=hev, mm6=ps0, mm3=qs0
- movq mm2, mm1 ; vp8_filter
- pand mm2, mm4; ; Filter2 = vp8_filter & hev
-
- movq mm5, mm2 ;
- paddsb mm5, [GLOBAL(t3)];
-
- pxor mm0, mm0 ; 0
- pxor mm7, mm7 ; 0
-
- punpcklbw mm0, mm5 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
- punpckhbw mm7, mm5 ; a0b0c0d0
- psraw mm7, 11 ; sign extended shift right by 3
- packsswb mm0, mm7 ; Filter2 >>=3;
-
- movq mm5, mm0 ; Filter2
-
- paddsb mm2, [GLOBAL(t4)] ; vp8_signed_char_clamp(Filter2 + 4)
- pxor mm0, mm0 ; 0
- pxor mm7, mm7 ; 0
-
- punpcklbw mm0, mm2 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
- punpckhbw mm7, mm2 ; a0b0c0d0
- psraw mm7, 11 ; sign extended shift right by 3
- packsswb mm0, mm7 ; Filter2 >>=3;
-
- ; mm0= filter2 mm1 = vp8_filter, mm3 =qs0 mm5=s mm4 =hev mm6=ps0
- psubsb mm3, mm0 ; qs0 =qs0 - filter1
- paddsb mm6, mm5 ; ps0 =ps0 + Fitler2
-
- ; mm1=vp8_filter, mm3=qs0, mm4 =hev mm6=ps0
- ; vp8_filter &= ~hev;
- ; Filter2 = vp8_filter;
- pandn mm4, mm1 ; vp8_filter&=~hev
-
-
- ; mm3=qs0, mm4=filter2, mm6=ps0
-
- ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7);
- ; s = vp8_signed_char_clamp(qs0 - u);
- ; *oq0 = s^0x80;
- ; s = vp8_signed_char_clamp(ps0 + u);
- ; *op0 = s^0x80;
- pxor mm0, mm0
-
- pxor mm1, mm1
- pxor mm2, mm2
- punpcklbw mm1, mm4
- punpckhbw mm2, mm4
- pmulhw mm1, [GLOBAL(s27)]
- pmulhw mm2, [GLOBAL(s27)]
- paddw mm1, [GLOBAL(s63)]
- paddw mm2, [GLOBAL(s63)]
- psraw mm1, 7
- psraw mm2, 7
- packsswb mm1, mm2
-
- psubsb mm3, mm1
- paddsb mm6, mm1
-
- pxor mm3, [GLOBAL(t80)]
- pxor mm6, [GLOBAL(t80)]
- movq [rdx+24], mm6
- movq [rdx+32], mm3
-
- ; roughly 2/7th difference across boundary
- ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7);
- ; s = vp8_signed_char_clamp(qs1 - u);
- ; *oq1 = s^0x80;
- ; s = vp8_signed_char_clamp(ps1 + u);
- ; *op1 = s^0x80;
- pxor mm1, mm1
- pxor mm2, mm2
- punpcklbw mm1, mm4
- punpckhbw mm2, mm4
- pmulhw mm1, [GLOBAL(s18)]
- pmulhw mm2, [GLOBAL(s18)]
- paddw mm1, [GLOBAL(s63)]
- paddw mm2, [GLOBAL(s63)]
- psraw mm1, 7
- psraw mm2, 7
- packsswb mm1, mm2
-
- movq mm3, [rdx + 40]
- movq mm6, [rdx + 16] ; p1
- pxor mm3, [GLOBAL(t80)]
- pxor mm6, [GLOBAL(t80)]
-
- paddsb mm6, mm1
- psubsb mm3, mm1
-
- pxor mm6, [GLOBAL(t80)]
- pxor mm3, [GLOBAL(t80)]
- movq [rdx + 40], mm3
- movq [rdx + 16], mm6
-
- ; roughly 1/7th difference across boundary
- ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7);
- ; s = vp8_signed_char_clamp(qs2 - u);
- ; *oq2 = s^0x80;
- ; s = vp8_signed_char_clamp(ps2 + u);
- ; *op2 = s^0x80;
- pxor mm1, mm1
- pxor mm2, mm2
- punpcklbw mm1, mm4
- punpckhbw mm2, mm4
- pmulhw mm1, [GLOBAL(s9)]
- pmulhw mm2, [GLOBAL(s9)]
- paddw mm1, [GLOBAL(s63)]
- paddw mm2, [GLOBAL(s63)]
- psraw mm1, 7
- psraw mm2, 7
- packsswb mm1, mm2
-
- movq mm6, [rdx+ 8]
- movq mm3, [rdx+48]
-
- pxor mm6, [GLOBAL(t80)]
- pxor mm3, [GLOBAL(t80)]
-
- paddsb mm6, mm1
- psubsb mm3, mm1
-
- pxor mm6, [GLOBAL(t80)] ; mm6 = 71 61 51 41 31 21 11 01
- pxor mm3, [GLOBAL(t80)] ; mm3 = 76 66 56 46 36 26 15 06
-
- ; transpose and write back
- movq mm0, [rdx] ; mm0 = 70 60 50 40 30 20 10 00
- movq mm1, mm0 ; mm0 = 70 60 50 40 30 20 10 00
-
- punpcklbw mm0, mm6 ; mm0 = 31 30 21 20 11 10 01 00
- punpckhbw mm1, mm6 ; mm3 = 71 70 61 60 51 50 41 40
-
- movq mm2, [rdx+16] ; mm2 = 72 62 52 42 32 22 12 02
- movq mm6, mm2 ; mm3 = 72 62 52 42 32 22 12 02
-
- punpcklbw mm2, [rdx+24] ; mm2 = 33 32 23 22 13 12 03 02
- punpckhbw mm6, [rdx+24] ; mm3 = 73 72 63 62 53 52 43 42
-
- movq mm5, mm0 ; mm5 = 31 30 21 20 11 10 01 00
- punpcklwd mm0, mm2 ; mm0 = 13 12 11 10 03 02 01 00
-
- punpckhwd mm5, mm2 ; mm5 = 33 32 31 30 23 22 21 20
- movq mm4, mm1 ; mm4 = 71 70 61 60 51 50 41 40
-
- punpcklwd mm1, mm6 ; mm1 = 53 52 51 50 43 42 41 40
- punpckhwd mm4, mm6 ; mm4 = 73 72 71 70 63 62 61 60
-
- movq mm2, [rdx+32] ; mm2 = 74 64 54 44 34 24 14 04
- punpcklbw mm2, [rdx+40] ; mm2 = 35 34 25 24 15 14 05 04
-
- movq mm6, mm3 ; mm6 = 76 66 56 46 36 26 15 06
- punpcklbw mm6, [rdx+56] ; mm6 = 37 36 27 26 17 16 07 06
-
- movq mm7, mm2 ; mm7 = 35 34 25 24 15 14 05 04
- punpcklwd mm2, mm6 ; mm2 = 17 16 15 14 07 06 05 04
-
- punpckhwd mm7, mm6 ; mm7 = 37 36 35 34 27 26 25 24
- movq mm6, mm0 ; mm6 = 13 12 11 10 03 02 01 00
-
- punpckldq mm0, mm2 ; mm0 = 07 06 05 04 03 02 01 00
- punpckhdq mm6, mm2 ; mm6 = 17 16 15 14 13 12 11 10
-
- movq [rsi+rax*4], mm0 ; write out
- movq [rdi+rax*4], mm6 ; write out
-
- movq mm0, mm5 ; mm0 = 33 32 31 30 23 22 21 20
- punpckldq mm0, mm7 ; mm0 = 27 26 25 24 23 22 20 20
-
- punpckhdq mm5, mm7 ; mm5 = 37 36 35 34 33 32 31 30
- movq [rsi+rax*2], mm0 ; write out
-
- movq [rdi+rax*2], mm5 ; write out
- movq mm2, [rdx+32] ; mm2 = 74 64 54 44 34 24 14 04
-
- punpckhbw mm2, [rdx+40] ; mm2 = 75 74 65 64 54 54 45 44
- punpckhbw mm3, [rdx+56] ; mm3 = 77 76 67 66 57 56 47 46
-
- movq mm5, mm2 ; mm5 = 75 74 65 64 54 54 45 44
- punpcklwd mm2, mm3 ; mm2 = 57 56 55 54 47 46 45 44
-
- punpckhwd mm5, mm3 ; mm5 = 77 76 75 74 67 66 65 64
- movq mm0, mm1 ; mm0= 53 52 51 50 43 42 41 40
-
- movq mm3, mm4 ; mm4 = 73 72 71 70 63 62 61 60
- punpckldq mm0, mm2 ; mm0 = 47 46 45 44 43 42 41 40
-
- punpckhdq mm1, mm2 ; mm1 = 57 56 55 54 53 52 51 50
- movq [rsi], mm0 ; write out
-
- movq [rdi], mm1 ; write out
- neg rax
-
- punpckldq mm3, mm5 ; mm3 = 67 66 65 64 63 62 61 60
- punpckhdq mm4, mm5 ; mm4 = 77 76 75 74 73 72 71 60
-
- movq [rsi+rax*2], mm3
- movq [rdi+rax*2], mm4
-
- lea rsi, [rsi+rax*8]
- dec rcx
-
- jnz .next8_mbv
-
- add rsp, 96
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_loop_filter_simple_horizontal_edge_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit
-;)
-global sym(vp8_loop_filter_simple_horizontal_edge_mmx) PRIVATE
-sym(vp8_loop_filter_simple_horizontal_edge_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- mov rcx, 2 ; count
-.nexts8_h:
- mov rdx, arg(2) ;blimit ; get blimit
- movq mm3, [rdx] ;
-
- mov rdi, rsi ; rdi points to row +1 for indirect addressing
- add rdi, rax
- neg rax
-
- ; calculate mask
- movq mm1, [rsi+2*rax] ; p1
- movq mm0, [rdi] ; q1
- movq mm2, mm1
- movq mm7, mm0
- movq mm4, mm0
- psubusb mm0, mm1 ; q1-=p1
- psubusb mm1, mm4 ; p1-=q1
- por mm1, mm0 ; abs(p1-q1)
- pand mm1, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm1, 1 ; abs(p1-q1)/2
-
- movq mm5, [rsi+rax] ; p0
- movq mm4, [rsi] ; q0
- movq mm0, mm4 ; q0
- movq mm6, mm5 ; p0
- psubusb mm5, mm4 ; p0-=q0
- psubusb mm4, mm6 ; q0-=p0
- por mm5, mm4 ; abs(p0 - q0)
- paddusb mm5, mm5 ; abs(p0-q0)*2
- paddusb mm5, mm1 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- psubusb mm5, mm3 ; abs(p0 - q0) *2 + abs(p1-q1)/2 > blimit
- pxor mm3, mm3
- pcmpeqb mm5, mm3
-
- ; start work on filters
- pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values
- psubsb mm2, mm7 ; p1 - q1
-
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
- pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values
- movq mm3, mm0 ; q0
- psubsb mm0, mm6 ; q0 - p0
- paddsb mm2, mm0 ; p1 - q1 + 1 * (q0 - p0)
- paddsb mm2, mm0 ; p1 - q1 + 2 * (q0 - p0)
- paddsb mm2, mm0 ; p1 - q1 + 3 * (q0 - p0)
- pand mm5, mm2 ; mask filter values we don't care about
-
- ; do + 4 side
- paddsb mm5, [GLOBAL(t4)] ; 3* (q0 - p0) + (p1 - q1) + 4
-
- movq mm0, mm5 ; get a copy of filters
- psllw mm0, 8 ; shift left 8
- psraw mm0, 3 ; arithmetic shift right 11
- psrlw mm0, 8
- movq mm1, mm5 ; get a copy of filters
- psraw mm1, 11 ; arithmetic shift right 11
- psllw mm1, 8 ; shift left 8 to put it back
-
- por mm0, mm1 ; put the two together to get result
-
- psubsb mm3, mm0 ; q0-= q0 add
- pxor mm3, [GLOBAL(t80)] ; unoffset
- movq [rsi], mm3 ; write back
-
-
- ; now do +3 side
- psubsb mm5, [GLOBAL(t1s)] ; +3 instead of +4
-
- movq mm0, mm5 ; get a copy of filters
- psllw mm0, 8 ; shift left 8
- psraw mm0, 3 ; arithmetic shift right 11
- psrlw mm0, 8
- psraw mm5, 11 ; arithmetic shift right 11
- psllw mm5, 8 ; shift left 8 to put it back
- por mm0, mm5 ; put the two together to get result
-
-
- paddsb mm6, mm0 ; p0+= p0 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
- movq [rsi+rax], mm6 ; write back
-
- add rsi,8
- neg rax
- dec rcx
- jnz .nexts8_h
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_loop_filter_simple_vertical_edge_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit
-;)
-global sym(vp8_loop_filter_simple_vertical_edge_mmx) PRIVATE
-sym(vp8_loop_filter_simple_vertical_edge_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 32 ; reserve 32 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- lea rsi, [rsi + rax*4- 2]; ;
- mov rcx, 2 ; count
-.nexts8_v:
-
- lea rdi, [rsi + rax];
- movd mm0, [rdi + rax * 2] ; xx xx xx xx 73 72 71 70
-
- movd mm6, [rsi + rax * 2] ; xx xx xx xx 63 62 61 60
- punpcklbw mm6, mm0 ; 73 63 72 62 71 61 70 60
-
- movd mm0, [rsi + rax] ; xx xx xx xx 53 52 51 50
- movd mm4, [rsi] ; xx xx xx xx 43 42 41 40
-
- punpcklbw mm4, mm0 ; 53 43 52 42 51 41 50 40
- movq mm5, mm4 ; 53 43 52 42 51 41 50 40
-
- punpcklwd mm4, mm6 ; 71 61 51 41 70 60 50 40
- punpckhwd mm5, mm6 ; 73 63 53 43 72 62 52 42
-
- neg rax
-
- movd mm7, [rsi + rax] ; xx xx xx xx 33 32 31 30
- movd mm6, [rsi + rax * 2] ; xx xx xx xx 23 22 21 20
-
- punpcklbw mm6, mm7 ; 33 23 32 22 31 21 30 20
- movd mm1, [rdi + rax * 4] ; xx xx xx xx 13 12 11 10
-
- movd mm0, [rsi + rax * 4] ; xx xx xx xx 03 02 01 00
- punpcklbw mm0, mm1 ; 13 03 12 02 11 01 10 00
-
- movq mm2, mm0 ; 13 03 12 02 11 01 10 00
- punpcklwd mm0, mm6 ; 31 21 11 01 30 20 10 00
-
- punpckhwd mm2, mm6 ; 33 23 13 03 32 22 12 02
- movq mm1, mm0 ; 13 03 12 02 11 01 10 00
-
- punpckldq mm0, mm4 ; 70 60 50 40 30 20 10 00 = p1
- movq mm3, mm2 ; 33 23 13 03 32 22 12 02
-
- punpckhdq mm1, mm4 ; 71 61 51 41 31 21 11 01 = p0
- punpckldq mm2, mm5 ; 72 62 52 42 32 22 12 02 = q0
-
- punpckhdq mm3, mm5 ; 73 63 53 43 33 23 13 03 = q1
-
-
- ; calculate mask
- movq mm6, mm0 ; p1
- movq mm7, mm3 ; q1
- psubusb mm7, mm6 ; q1-=p1
- psubusb mm6, mm3 ; p1-=q1
- por mm6, mm7 ; abs(p1-q1)
- pand mm6, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm6, 1 ; abs(p1-q1)/2
-
- movq mm5, mm1 ; p0
- movq mm4, mm2 ; q0
-
- psubusb mm5, mm2 ; p0-=q0
- psubusb mm4, mm1 ; q0-=p0
-
- por mm5, mm4 ; abs(p0 - q0)
- paddusb mm5, mm5 ; abs(p0-q0)*2
- paddusb mm5, mm6 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- mov rdx, arg(2) ;blimit ; get blimit
- movq mm7, [rdx]
-
- psubusb mm5, mm7 ; abs(p0 - q0) *2 + abs(p1-q1)/2 > blimit
- pxor mm7, mm7
- pcmpeqb mm5, mm7 ; mm5 = mask
-
- ; start work on filters
- movq t0, mm0
- movq t1, mm3
-
- pxor mm0, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm3, [GLOBAL(t80)] ; q1 offset to convert to signed values
-
- psubsb mm0, mm3 ; p1 - q1
- movq mm6, mm1 ; p0
-
- movq mm7, mm2 ; q0
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
-
- pxor mm7, [GLOBAL(t80)] ; offset to convert to signed values
- movq mm3, mm7 ; offseted ; q0
-
- psubsb mm7, mm6 ; q0 - p0
- paddsb mm0, mm7 ; p1 - q1 + 1 * (q0 - p0)
-
- paddsb mm0, mm7 ; p1 - q1 + 2 * (q0 - p0)
- paddsb mm0, mm7 ; p1 - q1 + 3 * (q0 - p0)
-
- pand mm5, mm0 ; mask filter values we don't care about
-
- paddsb mm5, [GLOBAL(t4)] ; 3* (q0 - p0) + (p1 - q1) + 4
-
- movq mm0, mm5 ; get a copy of filters
- psllw mm0, 8 ; shift left 8
- psraw mm0, 3 ; arithmetic shift right 11
- psrlw mm0, 8
-
- movq mm7, mm5 ; get a copy of filters
- psraw mm7, 11 ; arithmetic shift right 11
- psllw mm7, 8 ; shift left 8 to put it back
-
- por mm0, mm7 ; put the two together to get result
-
- psubsb mm3, mm0 ; q0-= q0sz add
- pxor mm3, [GLOBAL(t80)] ; unoffset
-
- ; now do +3 side
- psubsb mm5, [GLOBAL(t1s)] ; +3 instead of +4
-
- movq mm0, mm5 ; get a copy of filters
- psllw mm0, 8 ; shift left 8
- psraw mm0, 3 ; arithmetic shift right 11
- psrlw mm0, 8
-
- psraw mm5, 11 ; arithmetic shift right 11
- psllw mm5, 8 ; shift left 8 to put it back
- por mm0, mm5 ; put the two together to get result
-
- paddsb mm6, mm0 ; p0+= p0 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
-
-
- movq mm0, t0
- movq mm4, t1
-
- ; mm0 = 70 60 50 40 30 20 10 00
- ; mm6 = 71 61 51 41 31 21 11 01
- ; mm3 = 72 62 52 42 32 22 12 02
- ; mm4 = 73 63 53 43 33 23 13 03
- ; transpose back to write out
-
- movq mm1, mm0 ;
- punpcklbw mm0, mm6 ; 31 30 21 20 11 10 01 00
-
- punpckhbw mm1, mm6 ; 71 70 61 60 51 50 41 40
- movq mm2, mm3 ;
-
- punpcklbw mm2, mm4 ; 33 32 23 22 13 12 03 02
- movq mm5, mm1 ; 71 70 61 60 51 50 41 40
-
- punpckhbw mm3, mm4 ; 73 72 63 62 53 52 43 42
- movq mm6, mm0 ; 31 30 21 20 11 10 01 00
-
- punpcklwd mm0, mm2 ; 13 12 11 10 03 02 01 00
- punpckhwd mm6, mm2 ; 33 32 31 30 23 22 21 20
-
- movd [rsi+rax*4], mm0 ; write 03 02 01 00
- punpcklwd mm1, mm3 ; 53 52 51 50 43 42 41 40
-
- psrlq mm0, 32 ; xx xx xx xx 13 12 11 10
- punpckhwd mm5, mm3 ; 73 72 71 70 63 62 61 60
-
- movd [rdi+rax*4], mm0 ; write 13 12 11 10
- movd [rsi+rax*2], mm6 ; write 23 22 21 20
-
- psrlq mm6, 32 ; 33 32 31 30
- movd [rsi], mm1 ; write 43 42 41 40
-
- movd [rsi + rax], mm6 ; write 33 32 31 30
- neg rax
-
- movd [rsi + rax*2], mm5 ; write 63 62 61 60
- psrlq mm1, 32 ; 53 52 51 50
-
- movd [rdi], mm1 ; write out 53 52 51 50
- psrlq mm5, 32 ; 73 72 71 70
-
- movd [rdi + rax*2], mm5 ; write 73 72 71 70
-
- lea rsi, [rsi+rax*8] ; next 8
-
- dec rcx
- jnz .nexts8_v
-
- add rsp, 32
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-;void fast_loop_filter_vertical_edges_mmx(unsigned char *y_ptr,
-; int y_stride,
-; loop_filter_info *lfi)
-;{
-;
-;
-; vp8_loop_filter_simple_vertical_edge_mmx(y_ptr+4, y_stride, lfi->flim,lfi->lim,lfi->thr,2);
-; vp8_loop_filter_simple_vertical_edge_mmx(y_ptr+8, y_stride, lfi->flim,lfi->lim,lfi->thr,2);
-; vp8_loop_filter_simple_vertical_edge_mmx(y_ptr+12, y_stride, lfi->flim,lfi->lim,lfi->thr,2);
-;}
-
-SECTION_RODATA
-align 16
-tfe:
- times 8 db 0xfe
-align 16
-t80:
- times 8 db 0x80
-align 16
-t1s:
- times 8 db 0x01
-align 16
-t3:
- times 8 db 0x03
-align 16
-t4:
- times 8 db 0x04
-align 16
-ones:
- times 4 dw 0x0001
-align 16
-s27:
- times 4 dw 0x1b00
-align 16
-s18:
- times 4 dw 0x1200
-align 16
-s9:
- times 4 dw 0x0900
-align 16
-s63:
- times 4 dw 0x003f
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_sse2.asm
deleted file mode 100644
index 1913abc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_sse2.asm
+++ /dev/null
@@ -1,1640 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-%define _t0 0
-%define _t1 _t0 + 16
-%define _p3 _t1 + 16
-%define _p2 _p3 + 16
-%define _p1 _p2 + 16
-%define _p0 _p1 + 16
-%define _q0 _p0 + 16
-%define _q1 _q0 + 16
-%define _q2 _q1 + 16
-%define _q3 _q2 + 16
-%define lf_var_size 160
-
-; Use of pmaxub instead of psubusb to compute filter mask was seen
-; in ffvp8
-
-%macro LFH_FILTER_AND_HEV_MASK 1
-%if %1
- movdqa xmm2, [rdi+2*rax] ; q3
- movdqa xmm1, [rsi+2*rax] ; q2
- movdqa xmm4, [rsi+rax] ; q1
- movdqa xmm5, [rsi] ; q0
- neg rax ; negate pitch to deal with above border
-%else
- movlps xmm2, [rsi + rcx*2] ; q3
- movlps xmm1, [rsi + rcx] ; q2
- movlps xmm4, [rsi] ; q1
- movlps xmm5, [rsi + rax] ; q0
-
- movhps xmm2, [rdi + rcx*2]
- movhps xmm1, [rdi + rcx]
- movhps xmm4, [rdi]
- movhps xmm5, [rdi + rax]
-
- lea rsi, [rsi + rax*4]
- lea rdi, [rdi + rax*4]
-
- movdqa [rsp+_q2], xmm1 ; store q2
- movdqa [rsp+_q1], xmm4 ; store q1
-%endif
- movdqa xmm7, [rdx] ;limit
-
- movdqa xmm6, xmm1 ; q2
- movdqa xmm3, xmm4 ; q1
-
- psubusb xmm1, xmm2 ; q2-=q3
- psubusb xmm2, xmm6 ; q3-=q2
-
- psubusb xmm4, xmm6 ; q1-=q2
- psubusb xmm6, xmm3 ; q2-=q1
-
- por xmm4, xmm6 ; abs(q2-q1)
- por xmm1, xmm2 ; abs(q3-q2)
-
- movdqa xmm0, xmm5 ; q0
- pmaxub xmm1, xmm4
-
- psubusb xmm5, xmm3 ; q0-=q1
- psubusb xmm3, xmm0 ; q1-=q0
-
- por xmm5, xmm3 ; abs(q0-q1)
- movdqa [rsp+_t0], xmm5 ; save to t0
-
- pmaxub xmm1, xmm5
-
-%if %1
- movdqa xmm2, [rsi+4*rax] ; p3
- movdqa xmm4, [rdi+4*rax] ; p2
- movdqa xmm6, [rsi+2*rax] ; p1
-%else
- movlps xmm2, [rsi + rax] ; p3
- movlps xmm4, [rsi] ; p2
- movlps xmm6, [rsi + rcx] ; p1
-
- movhps xmm2, [rdi + rax]
- movhps xmm4, [rdi]
- movhps xmm6, [rdi + rcx]
-
- movdqa [rsp+_p2], xmm4 ; store p2
- movdqa [rsp+_p1], xmm6 ; store p1
-%endif
-
- movdqa xmm5, xmm4 ; p2
- movdqa xmm3, xmm6 ; p1
-
- psubusb xmm4, xmm2 ; p2-=p3
- psubusb xmm2, xmm5 ; p3-=p2
-
- psubusb xmm3, xmm5 ; p1-=p2
- pmaxub xmm1, xmm4 ; abs(p3 - p2)
-
- psubusb xmm5, xmm6 ; p2-=p1
- pmaxub xmm1, xmm2 ; abs(p3 - p2)
-
- pmaxub xmm1, xmm5 ; abs(p2 - p1)
- movdqa xmm2, xmm6 ; p1
-
- pmaxub xmm1, xmm3 ; abs(p2 - p1)
-%if %1
- movdqa xmm4, [rsi+rax] ; p0
- movdqa xmm3, [rdi] ; q1
-%else
- movlps xmm4, [rsi + rcx*2] ; p0
- movhps xmm4, [rdi + rcx*2]
- movdqa xmm3, [rsp+_q1] ; q1
-%endif
-
- movdqa xmm5, xmm4 ; p0
- psubusb xmm4, xmm6 ; p0-=p1
-
- psubusb xmm6, xmm5 ; p1-=p0
-
- por xmm6, xmm4 ; abs(p1 - p0)
- mov rdx, arg(2) ; get blimit
-
- movdqa [rsp+_t1], xmm6 ; save to t1
-
- movdqa xmm4, xmm3 ; q1
- pmaxub xmm1, xmm6
-
- psubusb xmm3, xmm2 ; q1-=p1
- psubusb xmm2, xmm4 ; p1-=q1
-
- psubusb xmm1, xmm7
- por xmm2, xmm3 ; abs(p1-q1)
-
- movdqa xmm7, [rdx] ; blimit
- mov rdx, arg(4) ; hev get thresh
-
- movdqa xmm3, xmm0 ; q0
- pand xmm2, [GLOBAL(tfe)] ; set lsb of each byte to zero
-
- movdqa xmm6, xmm5 ; p0
- psrlw xmm2, 1 ; abs(p1-q1)/2
-
- psubusb xmm5, xmm3 ; p0-=q0
- psubusb xmm3, xmm6 ; q0-=p0
- por xmm5, xmm3 ; abs(p0 - q0)
-
- paddusb xmm5, xmm5 ; abs(p0-q0)*2
-
- movdqa xmm4, [rsp+_t0] ; hev get abs (q1 - q0)
- movdqa xmm3, [rsp+_t1] ; get abs (p1 - p0)
-
- paddusb xmm5, xmm2 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- movdqa xmm2, [rdx] ; hev
-
- psubusb xmm5, xmm7 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- psubusb xmm4, xmm2 ; hev
-
- psubusb xmm3, xmm2 ; hev
- por xmm1, xmm5
-
- pxor xmm7, xmm7
- paddb xmm4, xmm3 ; hev abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
-
- pcmpeqb xmm4, xmm5 ; hev
- pcmpeqb xmm3, xmm3 ; hev
-
- pcmpeqb xmm1, xmm7 ; mask xmm1
- pxor xmm4, xmm3 ; hev
-%endmacro
-
-%macro B_FILTER 1
- movdqa xmm3, [GLOBAL(t80)]
-%if %1 == 0
- movdqa xmm2, [rsp+_p1] ; p1
- movdqa xmm7, [rsp+_q1] ; q1
-%elif %1 == 1
- movdqa xmm2, [rsi+2*rax] ; p1
- movdqa xmm7, [rdi] ; q1
-%elif %1 == 2
- movdqa xmm2, [rsp+_p1] ; p1
- movdqa xmm6, [rsp+_p0] ; p0
- movdqa xmm0, [rsp+_q0] ; q0
- movdqa xmm7, [rsp+_q1] ; q1
-%endif
-
- pxor xmm2, xmm3 ; p1 offset to convert to signed values
- pxor xmm7, xmm3 ; q1 offset to convert to signed values
-
- psubsb xmm2, xmm7 ; p1 - q1
- pxor xmm6, xmm3 ; offset to convert to signed values
-
- pand xmm2, xmm4 ; high var mask (hvm)(p1 - q1)
- pxor xmm0, xmm3 ; offset to convert to signed values
-
- movdqa xmm3, xmm0 ; q0
- psubsb xmm0, xmm6 ; q0 - p0
- paddsb xmm2, xmm0 ; 1 * (q0 - p0) + hvm(p1 - q1)
- paddsb xmm2, xmm0 ; 2 * (q0 - p0) + hvm(p1 - q1)
- paddsb xmm2, xmm0 ; 3 * (q0 - p0) + hvm(p1 - q1)
- pand xmm1, xmm2 ; mask filter values we don't care about
-
- movdqa xmm2, xmm1
- paddsb xmm1, [GLOBAL(t4)] ; 3* (q0 - p0) + hvm(p1 - q1) + 4
- paddsb xmm2, [GLOBAL(t3)] ; 3* (q0 - p0) + hvm(p1 - q1) + 3
-
- punpckhbw xmm5, xmm2 ; axbxcxdx
- punpcklbw xmm2, xmm2 ; exfxgxhx
-
- punpcklbw xmm0, xmm1 ; exfxgxhx
- psraw xmm5, 11 ; sign extended shift right by 3
-
- punpckhbw xmm1, xmm1 ; axbxcxdx
- psraw xmm2, 11 ; sign extended shift right by 3
-
- packsswb xmm2, xmm5 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
- psraw xmm0, 11 ; sign extended shift right by 3
-
- psraw xmm1, 11 ; sign extended shift right by 3
- movdqa xmm5, xmm0 ; save results
-
- packsswb xmm0, xmm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3
-
- paddsb xmm6, xmm2 ; p0+= p0 add
-
- movdqa xmm2, [GLOBAL(ones)]
- paddsw xmm5, xmm2
- paddsw xmm1, xmm2
- psraw xmm5, 1 ; partial shifted one more time for 2nd tap
- psraw xmm1, 1 ; partial shifted one more time for 2nd tap
- packsswb xmm5, xmm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4
- movdqa xmm2, [GLOBAL(t80)]
-
-%if %1 == 0
- movdqa xmm1, [rsp+_p1] ; p1
- lea rsi, [rsi + rcx*2]
- lea rdi, [rdi + rcx*2]
-%elif %1 == 1
- movdqa xmm1, [rsi+2*rax] ; p1
-%elif %1 == 2
- movdqa xmm1, [rsp+_p1] ; p1
-%endif
-
- pandn xmm4, xmm5 ; high edge variance additive
- pxor xmm6, xmm2 ; unoffset
-
- pxor xmm1, xmm2 ; reoffset
- psubsb xmm3, xmm0 ; q0-= q0 add
-
- paddsb xmm1, xmm4 ; p1+= p1 add
- pxor xmm3, xmm2 ; unoffset
-
- pxor xmm1, xmm2 ; unoffset
- psubsb xmm7, xmm4 ; q1-= q1 add
-
- pxor xmm7, xmm2 ; unoffset
-%if %1 == 0
- movq [rsi], xmm6 ; p0
- movhps [rdi], xmm6
- movq [rsi + rax], xmm1 ; p1
- movhps [rdi + rax], xmm1
- movq [rsi + rcx], xmm3 ; q0
- movhps [rdi + rcx], xmm3
- movq [rsi + rcx*2], xmm7 ; q1
- movhps [rdi + rcx*2], xmm7
-%elif %1 == 1
- movdqa [rsi+rax], xmm6 ; write back
- movdqa [rsi+2*rax], xmm1 ; write back
- movdqa [rsi], xmm3 ; write back
- movdqa [rdi], xmm7 ; write back
-%endif
-
-%endmacro
-
-%if ABI_IS_32BIT
-
-;void vp8_loop_filter_horizontal_edge_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-;)
-global sym(vp8_loop_filter_horizontal_edge_sse2) PRIVATE
-sym(vp8_loop_filter_horizontal_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step
-
- mov rdx, arg(3) ;limit
-
- lea rdi, [rsi+rax] ; rdi points to row +1 for indirect addressing
-
- ; calculate breakout conditions and high edge variance
- LFH_FILTER_AND_HEV_MASK 1
- ; filter and write back the result
- B_FILTER 1
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-%endif
-
-;void vp8_loop_filter_horizontal_edge_uv_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; int count
-;)
-global sym(vp8_loop_filter_horizontal_edge_uv_sse2) PRIVATE
-sym(vp8_loop_filter_horizontal_edge_uv_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ; u
- mov rdi, arg(5) ; v
- movsxd rax, dword ptr arg(1) ; src_pixel_step
- mov rcx, rax
- neg rax ; negate pitch to deal with above border
-
- mov rdx, arg(3) ;limit
-
- lea rsi, [rsi + rcx]
- lea rdi, [rdi + rcx]
-
- ; calculate breakout conditions and high edge variance
- LFH_FILTER_AND_HEV_MASK 0
- ; filter and write back the result
- B_FILTER 0
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-%macro MB_FILTER_AND_WRITEBACK 1
- movdqa xmm3, [GLOBAL(t80)]
-%if %1 == 0
- movdqa xmm2, [rsp+_p1] ; p1
- movdqa xmm7, [rsp+_q1] ; q1
-%elif %1 == 1
- movdqa xmm2, [rsi+2*rax] ; p1
- movdqa xmm7, [rdi] ; q1
-
- mov rcx, rax
- neg rcx
-%elif %1 == 2
- movdqa xmm2, [rsp+_p1] ; p1
- movdqa xmm6, [rsp+_p0] ; p0
- movdqa xmm0, [rsp+_q0] ; q0
- movdqa xmm7, [rsp+_q1] ; q1
-%endif
-
- pxor xmm2, xmm3 ; p1 offset to convert to signed values
- pxor xmm7, xmm3 ; q1 offset to convert to signed values
- pxor xmm6, xmm3 ; offset to convert to signed values
- pxor xmm0, xmm3 ; offset to convert to signed values
-
- psubsb xmm2, xmm7 ; p1 - q1
-
- movdqa xmm3, xmm0 ; q0
- psubsb xmm0, xmm6 ; q0 - p0
- paddsb xmm2, xmm0 ; 1 * (q0 - p0) + (p1 - q1)
- paddsb xmm2, xmm0 ; 2 * (q0 - p0)
- paddsb xmm2, xmm0 ; 3 * (q0 - p0) + (p1 - q1)
- pand xmm1, xmm2 ; mask filter values we don't care about
-
- movdqa xmm2, xmm1 ; vp8_filter
-
- pand xmm2, xmm4 ; Filter2 = vp8_filter & hev
- pxor xmm0, xmm0
-
- pandn xmm4, xmm1 ; vp8_filter&=~hev
- pxor xmm1, xmm1
-
- punpcklbw xmm0, xmm4 ; Filter 2 (hi)
- punpckhbw xmm1, xmm4 ; Filter 2 (lo)
-
- movdqa xmm5, xmm2
-
- movdqa xmm4, [GLOBAL(s9)]
- paddsb xmm5, [GLOBAL(t3)] ; vp8_signed_char_clamp(Filter2 + 3)
- paddsb xmm2, [GLOBAL(t4)] ; vp8_signed_char_clamp(Filter2 + 4)
-
- pmulhw xmm1, xmm4 ; Filter 2 (lo) * 9
- pmulhw xmm0, xmm4 ; Filter 2 (hi) * 9
-
- punpckhbw xmm7, xmm5 ; axbxcxdx
- punpcklbw xmm5, xmm5 ; exfxgxhx
-
- psraw xmm7, 11 ; sign extended shift right by 3
-
- psraw xmm5, 11 ; sign extended shift right by 3
- punpckhbw xmm4, xmm2 ; axbxcxdx
-
- punpcklbw xmm2, xmm2 ; exfxgxhx
- psraw xmm4, 11 ; sign extended shift right by 3
-
- packsswb xmm5, xmm7 ; Filter2 >>=3;
- psraw xmm2, 11 ; sign extended shift right by 3
-
- packsswb xmm2, xmm4 ; Filter1 >>=3;
-
- paddsb xmm6, xmm5 ; ps0 =ps0 + Fitler2
-
- psubsb xmm3, xmm2 ; qs0 =qs0 - Filter1
- movdqa xmm7, xmm1
-
- movdqa xmm4, [GLOBAL(s63)]
- movdqa xmm5, xmm0
- movdqa xmm2, xmm5
- paddw xmm0, xmm4 ; Filter 2 (hi) * 9 + 63
- paddw xmm1, xmm4 ; Filter 2 (lo) * 9 + 63
- movdqa xmm4, xmm7
-
- paddw xmm5, xmm5 ; Filter 2 (hi) * 18
-
- paddw xmm7, xmm7 ; Filter 2 (lo) * 18
- paddw xmm5, xmm0 ; Filter 2 (hi) * 27 + 63
-
- paddw xmm7, xmm1 ; Filter 2 (lo) * 27 + 63
- paddw xmm2, xmm0 ; Filter 2 (hi) * 18 + 63
- psraw xmm0, 7 ; (Filter 2 (hi) * 9 + 63) >> 7
-
- paddw xmm4, xmm1 ; Filter 2 (lo) * 18 + 63
- psraw xmm1, 7 ; (Filter 2 (lo) * 9 + 63) >> 7
- psraw xmm2, 7 ; (Filter 2 (hi) * 18 + 63) >> 7
-
- packsswb xmm0, xmm1 ; u1 = vp8_signed_char_clamp((63 + Filter2 * 9)>>7)
-
- psraw xmm4, 7 ; (Filter 2 (lo) * 18 + 63) >> 7
- psraw xmm5, 7 ; (Filter 2 (hi) * 27 + 63) >> 7
- psraw xmm7, 7 ; (Filter 2 (lo) * 27 + 63) >> 7
-
- packsswb xmm5, xmm7 ; u3 = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
- packsswb xmm2, xmm4 ; u2 = vp8_signed_char_clamp((63 + Filter2 * 18)>>7)
- movdqa xmm7, [GLOBAL(t80)]
-
-%if %1 == 0
- movdqa xmm1, [rsp+_q1] ; q1
- movdqa xmm4, [rsp+_p1] ; p1
- lea rsi, [rsi+rcx*2]
- lea rdi, [rdi+rcx*2]
-
-%elif %1 == 1
- movdqa xmm1, [rdi] ; q1
- movdqa xmm4, [rsi+rax*2] ; p1
-%elif %1 == 2
- movdqa xmm4, [rsp+_p1] ; p1
- movdqa xmm1, [rsp+_q1] ; q1
-%endif
-
- pxor xmm1, xmm7
- pxor xmm4, xmm7
-
- psubsb xmm3, xmm5 ; sq = vp8_signed_char_clamp(qs0 - u3)
- paddsb xmm6, xmm5 ; sp = vp8_signed_char_clamp(ps0 - u3)
- psubsb xmm1, xmm2 ; sq = vp8_signed_char_clamp(qs1 - u2)
- paddsb xmm4, xmm2 ; sp = vp8_signed_char_clamp(ps1 - u2)
-
-%if %1 == 1
- movdqa xmm2, [rdi+rax*4] ; p2
- movdqa xmm5, [rdi+rcx] ; q2
-%else
- movdqa xmm2, [rsp+_p2] ; p2
- movdqa xmm5, [rsp+_q2] ; q2
-%endif
-
- pxor xmm1, xmm7 ; *oq1 = sq^0x80;
- pxor xmm4, xmm7 ; *op1 = sp^0x80;
- pxor xmm2, xmm7
- pxor xmm5, xmm7
- paddsb xmm2, xmm0 ; sp = vp8_signed_char_clamp(ps2 - u)
- psubsb xmm5, xmm0 ; sq = vp8_signed_char_clamp(qs2 - u)
- pxor xmm2, xmm7 ; *op2 = sp^0x80;
- pxor xmm5, xmm7 ; *oq2 = sq^0x80;
- pxor xmm3, xmm7 ; *oq0 = sq^0x80
- pxor xmm6, xmm7 ; *oq0 = sp^0x80
-%if %1 == 0
- movq [rsi], xmm6 ; p0
- movhps [rdi], xmm6
- movq [rsi + rcx], xmm3 ; q0
- movhps [rdi + rcx], xmm3
- lea rdx, [rcx + rcx*2]
- movq [rsi+rcx*2], xmm1 ; q1
- movhps [rdi+rcx*2], xmm1
-
- movq [rsi + rax], xmm4 ; p1
- movhps [rdi + rax], xmm4
-
- movq [rsi+rax*2], xmm2 ; p2
- movhps [rdi+rax*2], xmm2
-
- movq [rsi+rdx], xmm5 ; q2
- movhps [rdi+rdx], xmm5
-%elif %1 == 1
- movdqa [rdi+rcx], xmm5 ; q2
- movdqa [rdi], xmm1 ; q1
- movdqa [rsi], xmm3 ; q0
- movdqa [rsi+rax ], xmm6 ; p0
- movdqa [rsi+rax*2], xmm4 ; p1
- movdqa [rdi+rax*4], xmm2 ; p2
-%elif %1 == 2
- movdqa [rsp+_p1], xmm4 ; p1
- movdqa [rsp+_p0], xmm6 ; p0
- movdqa [rsp+_q0], xmm3 ; q0
- movdqa [rsp+_q1], xmm1 ; q1
-%endif
-
-%endmacro
-
-
-;void vp8_mbloop_filter_horizontal_edge_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-;)
-global sym(vp8_mbloop_filter_horizontal_edge_sse2) PRIVATE
-sym(vp8_mbloop_filter_horizontal_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step
- mov rdx, arg(3) ;limit
-
- lea rdi, [rsi+rax] ; rdi points to row +1 for indirect addressing
-
- ; calculate breakout conditions and high edge variance
- LFH_FILTER_AND_HEV_MASK 1
- ; filter and write back the results
- MB_FILTER_AND_WRITEBACK 1
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_mbloop_filter_horizontal_edge_uv_sse2
-;(
-; unsigned char *u,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; unsigned char *v
-;)
-global sym(vp8_mbloop_filter_horizontal_edge_uv_sse2) PRIVATE
-sym(vp8_mbloop_filter_horizontal_edge_uv_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ; u
- mov rdi, arg(5) ; v
- movsxd rax, dword ptr arg(1) ; src_pixel_step
- mov rcx, rax
- neg rax ; negate pitch to deal with above border
- mov rdx, arg(3) ;limit
-
- lea rsi, [rsi + rcx]
- lea rdi, [rdi + rcx]
-
- ; calculate breakout conditions and high edge variance
- LFH_FILTER_AND_HEV_MASK 0
- ; filter and write back the results
- MB_FILTER_AND_WRITEBACK 0
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-%macro TRANSPOSE_16X8 2
- movq xmm4, [rsi] ; xx xx xx xx xx xx xx xx 07 06 05 04 03 02 01 00
- movq xmm1, [rdi] ; xx xx xx xx xx xx xx xx 17 16 15 14 13 12 11 10
- movq xmm0, [rsi+2*rax] ; xx xx xx xx xx xx xx xx 27 26 25 24 23 22 21 20
- movq xmm7, [rdi+2*rax] ; xx xx xx xx xx xx xx xx 37 36 35 34 33 32 31 30
- movq xmm5, [rsi+4*rax] ; xx xx xx xx xx xx xx xx 47 46 45 44 43 42 41 40
- movq xmm2, [rdi+4*rax] ; xx xx xx xx xx xx xx xx 57 56 55 54 53 52 51 50
-
- punpcklbw xmm4, xmm1 ; 17 07 16 06 15 05 14 04 13 03 12 02 11 01 10 00
-
- movq xmm1, [rdi+2*rcx] ; xx xx xx xx xx xx xx xx 77 76 75 74 73 72 71 70
-
- movdqa xmm3, xmm4 ; 17 07 16 06 15 05 14 04 13 03 12 02 11 01 10 00
- punpcklbw xmm0, xmm7 ; 37 27 36 36 35 25 34 24 33 23 32 22 31 21 30 20
-
- movq xmm7, [rsi+2*rcx] ; xx xx xx xx xx xx xx xx 67 66 65 64 63 62 61 60
-
- punpcklbw xmm5, xmm2 ; 57 47 56 46 55 45 54 44 53 43 52 42 51 41 50 40
-%if %1
- lea rsi, [rsi+rax*8]
- lea rdi, [rdi+rax*8]
-%else
- mov rsi, arg(5) ; v_ptr
-%endif
-
- movdqa xmm6, xmm5 ; 57 47 56 46 55 45 54 44 53 43 52 42 51 41 50 40
- punpcklbw xmm7, xmm1 ; 77 67 76 66 75 65 74 64 73 63 72 62 71 61 70 60
- punpcklwd xmm5, xmm7 ; 73 63 53 43 72 62 52 42 71 61 51 41 70 60 50 40
- punpckhwd xmm6, xmm7 ; 77 67 57 47 76 66 56 46 75 65 55 45 74 64 54 44
- punpcklwd xmm3, xmm0 ; 33 23 13 03 32 22 12 02 31 21 11 01 30 20 10 00
-
-%if %1 == 0
- lea rdi, [rsi + rax - 4] ; rdi points to row +1 for indirect addressing
- lea rsi, [rsi - 4]
-%endif
-
- movdqa xmm2, xmm3 ; 33 23 13 03 32 22 12 02 31 21 11 01 30 20 10 00
- punpckhwd xmm4, xmm0 ; 37 27 17 07 36 26 16 06 35 25 15 05 34 24 14 04
-
- movdqa xmm7, xmm4 ; 37 27 17 07 36 26 16 06 35 25 15 05 34 24 14 04
- punpckhdq xmm3, xmm5 ; 73 63 53 43 33 23 13 03 72 62 52 42 32 22 12 02
-
- punpckhdq xmm7, xmm6 ; 77 67 57 47 37 27 17 07 76 66 56 46 36 26 16 06
-
- punpckldq xmm4, xmm6 ; 75 65 55 45 35 25 15 05 74 64 54 44 34 24 14 04
-
- punpckldq xmm2, xmm5 ; 71 61 51 41 31 21 11 01 70 60 50 40 30 20 10 00
-
- movdqa [rsp+_t0], xmm2 ; save to free XMM2
-
- movq xmm2, [rsi] ; xx xx xx xx xx xx xx xx 87 86 85 84 83 82 81 80
- movq xmm6, [rdi] ; xx xx xx xx xx xx xx xx 97 96 95 94 93 92 91 90
- movq xmm0, [rsi+2*rax] ; xx xx xx xx xx xx xx xx a7 a6 a5 a4 a3 a2 a1 a0
- movq xmm5, [rdi+2*rax] ; xx xx xx xx xx xx xx xx b7 b6 b5 b4 b3 b2 b1 b0
- movq xmm1, [rsi+4*rax] ; xx xx xx xx xx xx xx xx c7 c6 c5 c4 c3 c2 c1 c0
-
- punpcklbw xmm2, xmm6 ; 97 87 96 86 95 85 94 84 93 83 92 82 91 81 90 80
-
- movq xmm6, [rdi+4*rax] ; xx xx xx xx xx xx xx xx d7 d6 d5 d4 d3 d2 d1 d0
-
- punpcklbw xmm0, xmm5 ; b7 a7 b6 a6 b5 a5 b4 a4 b3 a3 b2 a2 b1 a1 b0 a0
-
- movq xmm5, [rsi+2*rcx] ; xx xx xx xx xx xx xx xx e7 e6 e5 e4 e3 e2 e1 e0
-
- punpcklbw xmm1, xmm6 ; d7 c7 d6 c6 d5 c5 d4 c4 d3 c3 d2 c2 d1 e1 d0 c0
-
- movq xmm6, [rdi+2*rcx] ; xx xx xx xx xx xx xx xx f7 f6 f5 f4 f3 f2 f1 f0
-
- punpcklbw xmm5, xmm6 ; f7 e7 f6 e6 f5 e5 f4 e4 f3 e3 f2 e2 f1 e1 f0 e0
-
- movdqa xmm6, xmm1 ;
- punpckhwd xmm6, xmm5 ; f7 e7 d7 c7 f6 e6 d6 c6 f5 e5 d5 c5 f4 e4 d4 c4
-
- punpcklwd xmm1, xmm5 ; f3 e3 d3 c3 f2 e2 d2 c2 f1 e1 d1 c1 f0 e0 d0 c0
- movdqa xmm5, xmm2 ; 97 87 96 86 95 85 94 84 93 83 92 82 91 81 90 80
-
- punpcklwd xmm5, xmm0 ; b3 a3 93 83 b2 a2 92 82 b1 a1 91 81 b0 a0 90 80
-
- punpckhwd xmm2, xmm0 ; b7 a7 97 87 b6 a6 96 86 b5 a5 95 85 b4 a4 94 84
-
- movdqa xmm0, xmm5
- punpckldq xmm0, xmm1 ; f1 e1 d1 c1 b1 a1 91 81 f0 e0 d0 c0 b0 a0 90 80
-
- punpckhdq xmm5, xmm1 ; f3 e3 d3 c3 b3 a3 93 83 f2 e2 d2 c2 b2 a2 92 82
- movdqa xmm1, xmm2 ; b7 a7 97 87 b6 a6 96 86 b5 a5 95 85 b4 a4 94 84
-
- punpckldq xmm1, xmm6 ; f5 e5 d5 c5 b5 a5 95 85 f4 e4 d4 c4 b4 a4 94 84
-
- punpckhdq xmm2, xmm6 ; f7 e7 d7 c7 b7 a7 97 87 f6 e6 d6 c6 b6 a6 96 86
- movdqa xmm6, xmm7 ; 77 67 57 47 37 27 17 07 76 66 56 46 36 26 16 06
-
- punpcklqdq xmm6, xmm2 ; f6 e6 d6 c6 b6 a6 96 86 76 66 56 46 36 26 16 06
-
- punpckhqdq xmm7, xmm2 ; f7 e7 d7 c7 b7 a7 97 87 77 67 57 47 37 27 17 07
-
-%if %2 == 0
- movdqa [rsp+_q3], xmm7 ; save 7
- movdqa [rsp+_q2], xmm6 ; save 6
-%endif
- movdqa xmm2, xmm3 ; 73 63 53 43 33 23 13 03 72 62 52 42 32 22 12 02
- punpckhqdq xmm3, xmm5 ; f3 e3 d3 c3 b3 a3 93 83 73 63 53 43 33 23 13 03
- punpcklqdq xmm2, xmm5 ; f2 e2 d2 c2 b2 a2 92 82 72 62 52 42 32 22 12 02
- movdqa [rsp+_p1], xmm2 ; save 2
-
- movdqa xmm5, xmm4 ; 75 65 55 45 35 25 15 05 74 64 54 44 34 24 14 04
- punpcklqdq xmm4, xmm1 ; f4 e4 d4 c4 b4 a4 94 84 74 64 54 44 34 24 14 04
- movdqa [rsp+_p0], xmm3 ; save 3
-
- punpckhqdq xmm5, xmm1 ; f5 e5 d5 c5 b5 a5 95 85 75 65 55 45 35 25 15 05
-
- movdqa [rsp+_q0], xmm4 ; save 4
- movdqa [rsp+_q1], xmm5 ; save 5
- movdqa xmm1, [rsp+_t0]
-
- movdqa xmm2, xmm1 ;
- punpckhqdq xmm1, xmm0 ; f1 e1 d1 c1 b1 a1 91 81 71 61 51 41 31 21 11 01
- punpcklqdq xmm2, xmm0 ; f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00
-
-%if %2 == 0
- movdqa [rsp+_p2], xmm1
- movdqa [rsp+_p3], xmm2
-%endif
-
-%endmacro
-
-%macro LFV_FILTER_MASK_HEV_MASK 0
- movdqa xmm0, xmm6 ; q2
- psubusb xmm0, xmm7 ; q2-q3
-
- psubusb xmm7, xmm6 ; q3-q2
- movdqa xmm4, xmm5 ; q1
-
- por xmm7, xmm0 ; abs (q3-q2)
- psubusb xmm4, xmm6 ; q1-q2
-
- movdqa xmm0, xmm1
- psubusb xmm6, xmm5 ; q2-q1
-
- por xmm6, xmm4 ; abs (q2-q1)
- psubusb xmm0, xmm2 ; p2 - p3;
-
- psubusb xmm2, xmm1 ; p3 - p2;
- por xmm0, xmm2 ; abs(p2-p3)
-
- movdqa xmm5, [rsp+_p1] ; p1
- pmaxub xmm0, xmm7
-
- movdqa xmm2, xmm5 ; p1
- psubusb xmm5, xmm1 ; p1-p2
- psubusb xmm1, xmm2 ; p2-p1
-
- movdqa xmm7, xmm3 ; p0
- psubusb xmm7, xmm2 ; p0-p1
-
- por xmm1, xmm5 ; abs(p2-p1)
- pmaxub xmm0, xmm6
-
- pmaxub xmm0, xmm1
- movdqa xmm1, xmm2 ; p1
-
- psubusb xmm2, xmm3 ; p1-p0
-
- por xmm2, xmm7 ; abs(p1-p0)
-
- pmaxub xmm0, xmm2
-
- movdqa xmm5, [rsp+_q0] ; q0
- movdqa xmm7, [rsp+_q1] ; q1
-
- mov rdx, arg(3) ; limit
-
- movdqa xmm6, xmm5 ; q0
- movdqa xmm4, xmm7 ; q1
-
- psubusb xmm5, xmm7 ; q0-q1
- psubusb xmm7, xmm6 ; q1-q0
-
- por xmm7, xmm5 ; abs(q1-q0)
-
- pmaxub xmm0, xmm7
-
- psubusb xmm0, [rdx] ; limit
-
- mov rdx, arg(2) ; blimit
- movdqa xmm5, xmm4 ; q1
-
- psubusb xmm5, xmm1 ; q1-=p1
- psubusb xmm1, xmm4 ; p1-=q1
-
- por xmm5, xmm1 ; abs(p1-q1)
- movdqa xmm1, xmm3 ; p0
-
- pand xmm5, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psubusb xmm1, xmm6 ; p0-q0
-
- movdqa xmm4, [rdx] ; blimit
- mov rdx, arg(4) ; get thresh
-
- psrlw xmm5, 1 ; abs(p1-q1)/2
- psubusb xmm6, xmm3 ; q0-p0
-
- por xmm1, xmm6 ; abs(q0-p0)
- paddusb xmm1, xmm1 ; abs(q0-p0)*2
- movdqa xmm3, [rdx]
-
- paddusb xmm1, xmm5 ; abs (p0 - q0) *2 + abs(p1-q1)/2
- psubusb xmm2, xmm3 ; abs(q1 - q0) > thresh
-
- psubusb xmm7, xmm3 ; abs(p1 - p0)> thresh
-
- psubusb xmm1, xmm4 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- por xmm2, xmm7 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
-
- por xmm1, xmm0 ; mask
- pcmpeqb xmm2, xmm0
-
- pxor xmm0, xmm0
- pcmpeqb xmm4, xmm4
-
- pcmpeqb xmm1, xmm0
- pxor xmm4, xmm2
-%endmacro
-
-%macro BV_TRANSPOSE 0
- ; xmm1 = f2 e2 d2 c2 b2 a2 92 82 72 62 52 42 32 22 12 02
- ; xmm6 = f3 e3 d3 c3 b3 a3 93 83 73 63 53 43 33 23 13 03
- ; xmm3 = f4 e4 d4 c4 b4 a4 94 84 74 64 54 44 34 24 14 04
- ; xmm7 = f5 e5 d5 c5 b5 a5 95 85 75 65 55 45 35 25 15 05
- movdqa xmm2, xmm1 ; f2 e2 d2 c2 b2 a2 92 82 72 62 52 42 32 22 12 02
- punpcklbw xmm2, xmm6 ; 73 72 63 62 53 52 43 42 33 32 23 22 13 12 03 02
-
- movdqa xmm4, xmm3 ; f4 e4 d4 c4 b4 a4 94 84 74 64 54 44 34 24 14 04
- punpckhbw xmm1, xmm6 ; f3 f2 e3 e2 d3 d2 c3 c2 b3 b2 a3 a2 93 92 83 82
-
- punpcklbw xmm4, xmm7 ; 75 74 65 64 55 54 45 44 35 34 25 24 15 14 05 04
-
- punpckhbw xmm3, xmm7 ; f5 f4 e5 e4 d5 d4 c5 c4 b5 b4 a5 a4 95 94 85 84
-
- movdqa xmm6, xmm2 ; 73 72 63 62 53 52 43 42 33 32 23 22 13 12 03 02
- punpcklwd xmm2, xmm4 ; 35 34 33 32 25 24 23 22 15 14 13 12 05 04 03 02
-
- punpckhwd xmm6, xmm4 ; 75 74 73 72 65 64 63 62 55 54 53 52 45 44 43 42
- movdqa xmm5, xmm1 ; f3 f2 e3 e2 d3 d2 c3 c2 b3 b2 a3 a2 93 92 83 82
-
- punpcklwd xmm1, xmm3 ; b5 b4 b3 b2 a5 a4 a3 a2 95 94 93 92 85 84 83 82
-
- punpckhwd xmm5, xmm3 ; f5 f4 f3 f2 e5 e4 e3 e2 d5 d4 d3 d2 c5 c4 c3 c2
- ; xmm2 = 35 34 33 32 25 24 23 22 15 14 13 12 05 04 03 02
- ; xmm6 = 75 74 73 72 65 64 63 62 55 54 53 52 45 44 43 42
- ; xmm1 = b5 b4 b3 b2 a5 a4 a3 a2 95 94 93 92 85 84 83 82
- ; xmm5 = f5 f4 f3 f2 e5 e4 e3 e2 d5 d4 d3 d2 c5 c4 c3 c2
-%endmacro
-
-%macro BV_WRITEBACK 2
- movd [rsi+2], %1
- movd [rsi+4*rax+2], %2
- psrldq %1, 4
- psrldq %2, 4
- movd [rdi+2], %1
- movd [rdi+4*rax+2], %2
- psrldq %1, 4
- psrldq %2, 4
- movd [rsi+2*rax+2], %1
- movd [rsi+2*rcx+2], %2
- psrldq %1, 4
- psrldq %2, 4
- movd [rdi+2*rax+2], %1
- movd [rdi+2*rcx+2], %2
-%endmacro
-
-%if ABI_IS_32BIT
-
-;void vp8_loop_filter_vertical_edge_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-;)
-global sym(vp8_loop_filter_vertical_edge_sse2) PRIVATE
-sym(vp8_loop_filter_vertical_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ; src_ptr
- movsxd rax, dword ptr arg(1) ; src_pixel_step
-
- lea rsi, [rsi - 4]
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- lea rcx, [rax*2+rax]
-
- ;transpose 16x8 to 8x16, and store the 8-line result on stack.
- TRANSPOSE_16X8 1, 1
-
- ; calculate filter mask and high edge variance
- LFV_FILTER_MASK_HEV_MASK
-
- ; start work on filters
- B_FILTER 2
-
- ; transpose and write back - only work on q1, q0, p0, p1
- BV_TRANSPOSE
- ; store 16-line result
-
- lea rdx, [rax]
- neg rdx
-
- BV_WRITEBACK xmm1, xmm5
-
- lea rsi, [rsi+rdx*8]
- lea rdi, [rdi+rdx*8]
- BV_WRITEBACK xmm2, xmm6
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-%endif
-
-;void vp8_loop_filter_vertical_edge_uv_sse2
-;(
-; unsigned char *u,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; unsigned char *v
-;)
-global sym(vp8_loop_filter_vertical_edge_uv_sse2) PRIVATE
-sym(vp8_loop_filter_vertical_edge_uv_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ; u_ptr
- movsxd rax, dword ptr arg(1) ; src_pixel_step
-
- lea rsi, [rsi - 4]
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- lea rcx, [rax+2*rax]
-
- ;transpose 16x8 to 8x16, and store the 8-line result on stack.
- TRANSPOSE_16X8 0, 1
-
- ; calculate filter mask and high edge variance
- LFV_FILTER_MASK_HEV_MASK
-
- ; start work on filters
- B_FILTER 2
-
- ; transpose and write back - only work on q1, q0, p0, p1
- BV_TRANSPOSE
-
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
-
- ; store 16-line result
- BV_WRITEBACK xmm1, xmm5
-
- mov rsi, arg(0) ; u_ptr
- lea rsi, [rsi - 4]
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- BV_WRITEBACK xmm2, xmm6
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-%macro MBV_TRANSPOSE 0
- movdqa xmm0, [rsp+_p3] ; f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00
- movdqa xmm1, xmm0 ; f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00
-
- punpcklbw xmm0, xmm2 ; 71 70 61 60 51 50 41 40 31 30 21 20 11 10 01 00
- punpckhbw xmm1, xmm2 ; f1 f0 e1 e0 d1 d0 c1 c0 b1 b0 a1 a0 91 90 81 80
-
- movdqa xmm7, [rsp+_p1] ; f2 e2 d2 c2 b2 a2 92 82 72 62 52 42 32 22 12 02
- movdqa xmm6, xmm7 ; f2 e2 d2 c2 b2 a2 92 82 72 62 52 42 32 22 12 02
-
- punpcklbw xmm7, [rsp+_p0] ; 73 72 63 62 53 52 43 42 33 32 23 22 13 12 03 02
- punpckhbw xmm6, [rsp+_p0] ; f3 f2 e3 e2 d3 d2 c3 c2 b3 b2 a3 a2 93 92 83 82
-
- movdqa xmm3, xmm0 ; 71 70 61 60 51 50 41 40 31 30 21 20 11 10 01 00
- punpcklwd xmm0, xmm7 ; 33 32 31 30 23 22 21 20 13 12 11 10 03 02 01 00
-
- punpckhwd xmm3, xmm7 ; 73 72 71 70 63 62 61 60 53 52 51 50 43 42 41 40
- movdqa xmm4, xmm1 ; f1 f0 e1 e0 d1 d0 c1 c0 b1 b0 a1 a0 91 90 81 80
-
- punpcklwd xmm1, xmm6 ; b3 b2 b1 b0 a3 a2 a1 a0 93 92 91 90 83 82 81 80
- punpckhwd xmm4, xmm6 ; f3 f2 f1 f0 e3 e2 e1 e0 d3 d2 d1 d0 c3 c2 c1 c0
-
- movdqa xmm7, [rsp+_q0] ; f4 e4 d4 c4 b4 a4 94 84 74 64 54 44 34 24 14 04
- punpcklbw xmm7, [rsp+_q1] ; 75 74 65 64 55 54 45 44 35 34 25 24 15 14 05 04
-
- movdqa xmm6, xmm5 ; f6 e6 d6 c6 b6 a6 96 86 76 66 56 46 36 26 16 06
- punpcklbw xmm6, [rsp+_q3] ; 77 76 67 66 57 56 47 46 37 36 27 26 17 16 07 06
-
- movdqa xmm2, xmm7 ; 75 74 65 64 55 54 45 44 35 34 25 24 15 14 05 04
- punpcklwd xmm7, xmm6 ; 37 36 35 34 27 26 25 24 17 16 15 14 07 06 05 04
-
- punpckhwd xmm2, xmm6 ; 77 76 75 74 67 66 65 64 57 56 55 54 47 46 45 44
- movdqa xmm6, xmm0 ; 33 32 31 30 23 22 21 20 13 12 11 10 03 02 01 00
-
- punpckldq xmm0, xmm7 ; 17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00
- punpckhdq xmm6, xmm7 ; 37 36 35 34 33 32 31 30 27 26 25 24 23 22 21 20
-%endmacro
-
-%macro MBV_WRITEBACK_1 0
- movq [rsi], xmm0
- movhps [rdi], xmm0
-
- movq [rsi+2*rax], xmm6
- movhps [rdi+2*rax], xmm6
-
- movdqa xmm0, xmm3 ; 73 72 71 70 63 62 61 60 53 52 51 50 43 42 41 40
- punpckldq xmm0, xmm2 ; 57 56 55 54 53 52 51 50 47 46 45 44 43 42 41 40
- punpckhdq xmm3, xmm2 ; 77 76 75 74 73 72 71 70 67 66 65 64 63 62 61 60
-
- movq [rsi+4*rax], xmm0
- movhps [rdi+4*rax], xmm0
-
- movq [rsi+2*rcx], xmm3
- movhps [rdi+2*rcx], xmm3
-
- movdqa xmm7, [rsp+_q0] ; f4 e4 d4 c4 b4 a4 94 84 74 64 54 44 34 24 14 04
- punpckhbw xmm7, [rsp+_q1] ; f5 f4 e5 e4 d5 d4 c5 c4 b5 b4 a5 a4 95 94 85 84
- punpckhbw xmm5, [rsp+_q3] ; f7 f6 e7 e6 d7 d6 c7 c6 b7 b6 a7 a6 97 96 87 86
-
- movdqa xmm0, xmm7
- punpcklwd xmm0, xmm5 ; b7 b6 b4 b4 a7 a6 a5 a4 97 96 95 94 87 86 85 84
- punpckhwd xmm7, xmm5 ; f7 f6 f5 f4 e7 e6 e5 e4 d7 d6 d5 d4 c7 c6 c5 c4
-
- movdqa xmm5, xmm1 ; b3 b2 b1 b0 a3 a2 a1 a0 93 92 91 90 83 82 81 80
- punpckldq xmm1, xmm0 ; 97 96 95 94 93 92 91 90 87 86 85 83 84 82 81 80
- punpckhdq xmm5, xmm0 ; b7 b6 b5 b4 b3 b2 b1 b0 a7 a6 a5 a4 a3 a2 a1 a0
-%endmacro
-
-%macro MBV_WRITEBACK_2 0
- movq [rsi], xmm1
- movhps [rdi], xmm1
-
- movq [rsi+2*rax], xmm5
- movhps [rdi+2*rax], xmm5
-
- movdqa xmm1, xmm4 ; f3 f2 f1 f0 e3 e2 e1 e0 d3 d2 d1 d0 c3 c2 c1 c0
- punpckldq xmm1, xmm7 ; d7 d6 d5 d4 d3 d2 d1 d0 c7 c6 c5 c4 c3 c2 c1 c0
- punpckhdq xmm4, xmm7 ; f7 f6 f4 f4 f3 f2 f1 f0 e7 e6 e5 e4 e3 e2 e1 e0
-
- movq [rsi+4*rax], xmm1
- movhps [rdi+4*rax], xmm1
-
- movq [rsi+2*rcx], xmm4
- movhps [rdi+2*rcx], xmm4
-%endmacro
-
-
-;void vp8_mbloop_filter_vertical_edge_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-;)
-global sym(vp8_mbloop_filter_vertical_edge_sse2) PRIVATE
-sym(vp8_mbloop_filter_vertical_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ; src_ptr
- movsxd rax, dword ptr arg(1) ; src_pixel_step
-
- lea rsi, [rsi - 4]
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- lea rcx, [rax*2+rax]
-
- ; Transpose
- TRANSPOSE_16X8 1, 0
-
- ; calculate filter mask and high edge variance
- LFV_FILTER_MASK_HEV_MASK
-
- neg rax
- ; start work on filters
- MB_FILTER_AND_WRITEBACK 2
-
- lea rsi, [rsi+rax*8]
- lea rdi, [rdi+rax*8]
-
- ; transpose and write back
- MBV_TRANSPOSE
-
- neg rax
-
- MBV_WRITEBACK_1
-
-
- lea rsi, [rsi+rax*8]
- lea rdi, [rdi+rax*8]
- MBV_WRITEBACK_2
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_mbloop_filter_vertical_edge_uv_sse2
-;(
-; unsigned char *u,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; unsigned char *v
-;)
-global sym(vp8_mbloop_filter_vertical_edge_uv_sse2) PRIVATE
-sym(vp8_mbloop_filter_vertical_edge_uv_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, lf_var_size
-
- mov rsi, arg(0) ; u_ptr
- movsxd rax, dword ptr arg(1) ; src_pixel_step
-
- lea rsi, [rsi - 4]
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- lea rcx, [rax+2*rax]
-
- ; Transpose
- TRANSPOSE_16X8 0, 0
-
- ; calculate filter mask and high edge variance
- LFV_FILTER_MASK_HEV_MASK
-
- ; start work on filters
- MB_FILTER_AND_WRITEBACK 2
-
- ; transpose and write back
- MBV_TRANSPOSE
-
- mov rsi, arg(0) ;u_ptr
- lea rsi, [rsi - 4]
- lea rdi, [rsi + rax]
- MBV_WRITEBACK_1
- mov rsi, arg(5) ;v_ptr
- lea rsi, [rsi - 4]
- lea rdi, [rsi + rax]
- MBV_WRITEBACK_2
-
- add rsp, lf_var_size
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_loop_filter_simple_horizontal_edge_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-;)
-global sym(vp8_loop_filter_simple_horizontal_edge_sse2) PRIVATE
-sym(vp8_loop_filter_simple_horizontal_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- SAVE_XMM 7
- GET_GOT rbx
- ; end prolog
-
- mov rcx, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
- movdqa xmm6, [GLOBAL(tfe)]
- lea rdx, [rcx + rax]
- neg rax
-
- ; calculate mask
- movdqa xmm0, [rdx] ; q1
- mov rdx, arg(2) ;blimit
- movdqa xmm1, [rcx+2*rax] ; p1
-
- movdqa xmm2, xmm1
- movdqa xmm3, xmm0
-
- psubusb xmm0, xmm1 ; q1-=p1
- psubusb xmm1, xmm3 ; p1-=q1
- por xmm1, xmm0 ; abs(p1-q1)
- pand xmm1, xmm6 ; set lsb of each byte to zero
- psrlw xmm1, 1 ; abs(p1-q1)/2
-
- movdqa xmm7, XMMWORD PTR [rdx]
-
- movdqa xmm5, [rcx+rax] ; p0
- movdqa xmm4, [rcx] ; q0
- movdqa xmm0, xmm4 ; q0
- movdqa xmm6, xmm5 ; p0
- psubusb xmm5, xmm4 ; p0-=q0
- psubusb xmm4, xmm6 ; q0-=p0
- por xmm5, xmm4 ; abs(p0 - q0)
-
- movdqa xmm4, [GLOBAL(t80)]
-
- paddusb xmm5, xmm5 ; abs(p0-q0)*2
- paddusb xmm5, xmm1 ; abs (p0 - q0) *2 + abs(p1-q1)/2
- psubusb xmm5, xmm7 ; abs(p0 - q0) *2 + abs(p1-q1)/2 > blimit
- pxor xmm7, xmm7
- pcmpeqb xmm5, xmm7
-
-
- ; start work on filters
- pxor xmm2, xmm4 ; p1 offset to convert to signed values
- pxor xmm3, xmm4 ; q1 offset to convert to signed values
- psubsb xmm2, xmm3 ; p1 - q1
-
- pxor xmm6, xmm4 ; offset to convert to signed values
- pxor xmm0, xmm4 ; offset to convert to signed values
- movdqa xmm3, xmm0 ; q0
- psubsb xmm0, xmm6 ; q0 - p0
- paddsb xmm2, xmm0 ; p1 - q1 + 1 * (q0 - p0)
- paddsb xmm2, xmm0 ; p1 - q1 + 2 * (q0 - p0)
- paddsb xmm2, xmm0 ; p1 - q1 + 3 * (q0 - p0)
- pand xmm5, xmm2 ; mask filter values we don't care about
-
- movdqa xmm0, xmm5
- paddsb xmm5, [GLOBAL(t3)] ; 3* (q0 - p0) + (p1 - q1) + 4
- paddsb xmm0, [GLOBAL(t4)] ; +3 instead of +4
-
- movdqa xmm1, [GLOBAL(te0)]
- movdqa xmm2, [GLOBAL(t1f)]
-
-; pxor xmm7, xmm7
- pcmpgtb xmm7, xmm0 ;save sign
- pand xmm7, xmm1 ;preserve the upper 3 bits
- psrlw xmm0, 3
- pand xmm0, xmm2 ;clear out upper 3 bits
- por xmm0, xmm7 ;add sign
- psubsb xmm3, xmm0 ; q0-= q0sz add
-
- pxor xmm7, xmm7
- pcmpgtb xmm7, xmm5 ;save sign
- pand xmm7, xmm1 ;preserve the upper 3 bits
- psrlw xmm5, 3
- pand xmm5, xmm2 ;clear out upper 3 bits
- por xmm5, xmm7 ;add sign
- paddsb xmm6, xmm5 ; p0+= p0 add
-
- pxor xmm3, xmm4 ; unoffset
- movdqa [rcx], xmm3 ; write back
-
- pxor xmm6, xmm4 ; unoffset
- movdqa [rcx+rax], xmm6 ; write back
-
- ; begin epilog
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_loop_filter_simple_vertical_edge_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-;)
-global sym(vp8_loop_filter_simple_vertical_edge_sse2) PRIVATE
-sym(vp8_loop_filter_simple_vertical_edge_sse2):
- push rbp ; save old base pointer value.
- mov rbp, rsp ; set new base pointer value.
- SHADOW_ARGS_TO_STACK 3
- SAVE_XMM 7
- GET_GOT rbx ; save callee-saved reg
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 32 ; reserve 32 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[16];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[16];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- lea rsi, [rsi - 2 ]
- lea rdi, [rsi + rax]
- lea rdx, [rsi + rax*4]
- lea rcx, [rdx + rax]
-
- movd xmm0, [rsi] ; (high 96 bits unused) 03 02 01 00
- movd xmm1, [rdx] ; (high 96 bits unused) 43 42 41 40
- movd xmm2, [rdi] ; 13 12 11 10
- movd xmm3, [rcx] ; 53 52 51 50
- punpckldq xmm0, xmm1 ; (high 64 bits unused) 43 42 41 40 03 02 01 00
- punpckldq xmm2, xmm3 ; 53 52 51 50 13 12 11 10
-
- movd xmm4, [rsi + rax*2] ; 23 22 21 20
- movd xmm5, [rdx + rax*2] ; 63 62 61 60
- movd xmm6, [rdi + rax*2] ; 33 32 31 30
- movd xmm7, [rcx + rax*2] ; 73 72 71 70
- punpckldq xmm4, xmm5 ; 63 62 61 60 23 22 21 20
- punpckldq xmm6, xmm7 ; 73 72 71 70 33 32 31 30
-
- punpcklbw xmm0, xmm2 ; 53 43 52 42 51 41 50 40 13 03 12 02 11 01 10 00
- punpcklbw xmm4, xmm6 ; 73 63 72 62 71 61 70 60 33 23 32 22 31 21 30 20
-
- movdqa xmm1, xmm0
- punpcklwd xmm0, xmm4 ; 33 23 13 03 32 22 12 02 31 21 11 01 30 20 10 00
- punpckhwd xmm1, xmm4 ; 73 63 53 43 72 62 52 42 71 61 51 41 70 60 50 40
-
- movdqa xmm2, xmm0
- punpckldq xmm0, xmm1 ; 71 61 51 41 31 21 11 01 70 60 50 40 30 20 10 00
- punpckhdq xmm2, xmm1 ; 73 63 53 43 33 23 13 03 72 62 52 42 32 22 12 02
-
- lea rsi, [rsi + rax*8]
- lea rdi, [rsi + rax]
- lea rdx, [rsi + rax*4]
- lea rcx, [rdx + rax]
-
- movd xmm4, [rsi] ; 83 82 81 80
- movd xmm1, [rdx] ; c3 c2 c1 c0
- movd xmm6, [rdi] ; 93 92 91 90
- movd xmm3, [rcx] ; d3 d2 d1 d0
- punpckldq xmm4, xmm1 ; c3 c2 c1 c0 83 82 81 80
- punpckldq xmm6, xmm3 ; d3 d2 d1 d0 93 92 91 90
-
- movd xmm1, [rsi + rax*2] ; a3 a2 a1 a0
- movd xmm5, [rdx + rax*2] ; e3 e2 e1 e0
- movd xmm3, [rdi + rax*2] ; b3 b2 b1 b0
- movd xmm7, [rcx + rax*2] ; f3 f2 f1 f0
- punpckldq xmm1, xmm5 ; e3 e2 e1 e0 a3 a2 a1 a0
- punpckldq xmm3, xmm7 ; f3 f2 f1 f0 b3 b2 b1 b0
-
- punpcklbw xmm4, xmm6 ; d3 c3 d2 c2 d1 c1 d0 c0 93 83 92 82 91 81 90 80
- punpcklbw xmm1, xmm3 ; f3 e3 f2 e2 f1 e1 f0 e0 b3 a3 b2 a2 b1 a1 b0 a0
-
- movdqa xmm7, xmm4
- punpcklwd xmm4, xmm1 ; b3 a3 93 83 b2 a2 92 82 b1 a1 91 81 b0 a0 90 80
- punpckhwd xmm7, xmm1 ; f3 e3 d3 c3 f2 e2 d2 c2 f1 e1 d1 c1 f0 e0 d0 c0
-
- movdqa xmm6, xmm4
- punpckldq xmm4, xmm7 ; f1 e1 d1 c1 b1 a1 91 81 f0 e0 d0 c0 b0 a0 90 80
- punpckhdq xmm6, xmm7 ; f3 e3 d3 c3 b3 a3 93 83 f2 e2 d2 c2 b2 a2 92 82
-
- movdqa xmm1, xmm0
- movdqa xmm3, xmm2
-
- punpcklqdq xmm0, xmm4 ; p1 f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00
- punpckhqdq xmm1, xmm4 ; p0 f1 e1 d1 c1 b1 a1 91 81 71 61 51 41 31 21 11 01
- punpcklqdq xmm2, xmm6 ; q0 f2 e2 d2 c2 b2 a2 92 82 72 62 52 42 32 22 12 02
- punpckhqdq xmm3, xmm6 ; q1 f3 e3 d3 c3 b3 a3 93 83 73 63 53 43 33 23 13 03
-
- mov rdx, arg(2) ;blimit
-
- ; calculate mask
- movdqa xmm6, xmm0 ; p1
- movdqa xmm7, xmm3 ; q1
- psubusb xmm7, xmm0 ; q1-=p1
- psubusb xmm6, xmm3 ; p1-=q1
- por xmm6, xmm7 ; abs(p1-q1)
- pand xmm6, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw xmm6, 1 ; abs(p1-q1)/2
-
- movdqa xmm7, [rdx]
-
- movdqa xmm5, xmm1 ; p0
- movdqa xmm4, xmm2 ; q0
- psubusb xmm5, xmm2 ; p0-=q0
- psubusb xmm4, xmm1 ; q0-=p0
- por xmm5, xmm4 ; abs(p0 - q0)
- paddusb xmm5, xmm5 ; abs(p0-q0)*2
- paddusb xmm5, xmm6 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- movdqa xmm4, [GLOBAL(t80)]
-
- psubusb xmm5, xmm7 ; abs(p0 - q0) *2 + abs(p1-q1)/2 > blimit
- pxor xmm7, xmm7
- pcmpeqb xmm5, xmm7 ; mm5 = mask
-
- ; start work on filters
- movdqa t0, xmm0
- movdqa t1, xmm3
-
- pxor xmm0, xmm4 ; p1 offset to convert to signed values
- pxor xmm3, xmm4 ; q1 offset to convert to signed values
- psubsb xmm0, xmm3 ; p1 - q1
-
- pxor xmm1, xmm4 ; offset to convert to signed values
- pxor xmm2, xmm4 ; offset to convert to signed values
-
- movdqa xmm3, xmm2 ; offseted ; q0
- psubsb xmm2, xmm1 ; q0 - p0
- paddsb xmm0, xmm2 ; p1 - q1 + 1 * (q0 - p0)
- paddsb xmm0, xmm2 ; p1 - q1 + 2 * (q0 - p0)
- paddsb xmm0, xmm2 ; p1 - q1 + 3 * (q0 - p0)
- pand xmm5, xmm0 ; mask filter values we don't care about
-
- movdqa xmm0, xmm5
- paddsb xmm5, [GLOBAL(t3)] ; 3* (q0 - p0) + (p1 - q1) + 4
- paddsb xmm0, [GLOBAL(t4)] ; +3 instead of +4
-
- movdqa xmm6, [GLOBAL(te0)]
- movdqa xmm2, [GLOBAL(t1f)]
-
-; pxor xmm7, xmm7
- pcmpgtb xmm7, xmm0 ;save sign
- pand xmm7, xmm6 ;preserve the upper 3 bits
- psrlw xmm0, 3
- pand xmm0, xmm2 ;clear out upper 3 bits
- por xmm0, xmm7 ;add sign
- psubsb xmm3, xmm0 ; q0-= q0sz add
-
- pxor xmm7, xmm7
- pcmpgtb xmm7, xmm5 ;save sign
- pand xmm7, xmm6 ;preserve the upper 3 bits
- psrlw xmm5, 3
- pand xmm5, xmm2 ;clear out upper 3 bits
- por xmm5, xmm7 ;add sign
- paddsb xmm1, xmm5 ; p0+= p0 add
-
- pxor xmm3, xmm4 ; unoffset q0
- pxor xmm1, xmm4 ; unoffset p0
-
- movdqa xmm0, t0 ; p1
- movdqa xmm4, t1 ; q1
-
- ; write out order: xmm0 xmm2 xmm1 xmm3
- lea rdx, [rsi + rax*4]
-
- ; transpose back to write out
- ; p1 f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00
- ; p0 f1 e1 d1 c1 b1 a1 91 81 71 61 51 41 31 21 11 01
- ; q0 f2 e2 d2 c2 b2 a2 92 82 72 62 52 42 32 22 12 02
- ; q1 f3 e3 d3 c3 b3 a3 93 83 73 63 53 43 33 23 13 03
- movdqa xmm6, xmm0
- punpcklbw xmm0, xmm1 ; 71 70 61 60 51 50 41 40 31 30 21 20 11 10 01 00
- punpckhbw xmm6, xmm1 ; f1 f0 e1 e0 d1 d0 c1 c0 b1 b0 a1 a0 91 90 81 80
-
- movdqa xmm5, xmm3
- punpcklbw xmm3, xmm4 ; 73 72 63 62 53 52 43 42 33 32 23 22 13 12 03 02
- punpckhbw xmm5, xmm4 ; f3 f2 e3 e2 d3 d2 c3 c2 b3 b2 a3 a2 93 92 83 82
-
- movdqa xmm2, xmm0
- punpcklwd xmm0, xmm3 ; 33 32 31 30 23 22 21 20 13 12 11 10 03 02 01 00
- punpckhwd xmm2, xmm3 ; 73 72 71 70 63 62 61 60 53 52 51 50 43 42 41 40
-
- movdqa xmm3, xmm6
- punpcklwd xmm6, xmm5 ; b3 b2 b1 b0 a3 a2 a1 a0 93 92 91 90 83 82 81 80
- punpckhwd xmm3, xmm5 ; f3 f2 f1 f0 e3 e2 e1 e0 d3 d2 d1 d0 c3 c2 c1 c0
-
- movd [rsi], xmm6 ; write the second 8-line result
- movd [rdx], xmm3
- psrldq xmm6, 4
- psrldq xmm3, 4
- movd [rdi], xmm6
- movd [rcx], xmm3
- psrldq xmm6, 4
- psrldq xmm3, 4
- movd [rsi + rax*2], xmm6
- movd [rdx + rax*2], xmm3
- psrldq xmm6, 4
- psrldq xmm3, 4
- movd [rdi + rax*2], xmm6
- movd [rcx + rax*2], xmm3
-
- neg rax
- lea rsi, [rsi + rax*8]
- neg rax
- lea rdi, [rsi + rax]
- lea rdx, [rsi + rax*4]
- lea rcx, [rdx + rax]
-
- movd [rsi], xmm0 ; write the first 8-line result
- movd [rdx], xmm2
- psrldq xmm0, 4
- psrldq xmm2, 4
- movd [rdi], xmm0
- movd [rcx], xmm2
- psrldq xmm0, 4
- psrldq xmm2, 4
- movd [rsi + rax*2], xmm0
- movd [rdx + rax*2], xmm2
- psrldq xmm0, 4
- psrldq xmm2, 4
- movd [rdi + rax*2], xmm0
- movd [rcx + rax*2], xmm2
-
- add rsp, 32
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-tfe:
- times 16 db 0xfe
-align 16
-t80:
- times 16 db 0x80
-align 16
-t1s:
- times 16 db 0x01
-align 16
-t3:
- times 16 db 0x03
-align 16
-t4:
- times 16 db 0x04
-align 16
-ones:
- times 8 dw 0x0001
-align 16
-s9:
- times 8 dw 0x0900
-align 16
-s63:
- times 8 dw 0x003f
-align 16
-te0:
- times 16 db 0xe0
-align 16
-t1f:
- times 16 db 0x1f
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_x86.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_x86.c
deleted file mode 100644
index 6586004..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/loopfilter_x86.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8/common/loopfilter.h"
-
-#define prototype_loopfilter(sym) \
- void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
- const unsigned char *limit, const unsigned char *thresh, int count)
-
-#define prototype_loopfilter_nc(sym) \
- void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
- const unsigned char *limit, const unsigned char *thresh)
-
-#define prototype_simple_loopfilter(sym) \
- void sym(unsigned char *y, int ystride, const unsigned char *blimit)
-
-prototype_loopfilter(vp8_mbloop_filter_vertical_edge_mmx);
-prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_mmx);
-prototype_loopfilter(vp8_loop_filter_vertical_edge_mmx);
-prototype_loopfilter(vp8_loop_filter_horizontal_edge_mmx);
-prototype_simple_loopfilter(vp8_loop_filter_simple_horizontal_edge_mmx);
-prototype_simple_loopfilter(vp8_loop_filter_simple_vertical_edge_mmx);
-
-#if HAVE_SSE2 && ARCH_X86_64
-prototype_loopfilter(vp8_loop_filter_bv_y_sse2);
-prototype_loopfilter(vp8_loop_filter_bh_y_sse2);
-#else
-prototype_loopfilter_nc(vp8_loop_filter_vertical_edge_sse2);
-prototype_loopfilter_nc(vp8_loop_filter_horizontal_edge_sse2);
-#endif
-prototype_loopfilter_nc(vp8_mbloop_filter_vertical_edge_sse2);
-prototype_loopfilter_nc(vp8_mbloop_filter_horizontal_edge_sse2);
-
-extern loop_filter_uvfunction vp8_loop_filter_horizontal_edge_uv_sse2;
-extern loop_filter_uvfunction vp8_loop_filter_vertical_edge_uv_sse2;
-extern loop_filter_uvfunction vp8_mbloop_filter_horizontal_edge_uv_sse2;
-extern loop_filter_uvfunction vp8_mbloop_filter_vertical_edge_uv_sse2;
-
-#if HAVE_MMX
-/* Horizontal MB filtering */
-void vp8_loop_filter_mbh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_mbloop_filter_horizontal_edge_mmx(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_mbloop_filter_horizontal_edge_mmx(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_mbloop_filter_horizontal_edge_mmx(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-
-/* Vertical MB Filtering */
-void vp8_loop_filter_mbv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_mbloop_filter_vertical_edge_mmx(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_mbloop_filter_vertical_edge_mmx(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_mbloop_filter_vertical_edge_mmx(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-
-/* Horizontal B Filtering */
-void vp8_loop_filter_bh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_loop_filter_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_loop_filter_horizontal_edge_mmx(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_loop_filter_horizontal_edge_mmx(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-
-void vp8_loop_filter_bhs_mmx(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
-{
- vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, blimit);
-}
-
-
-/* Vertical B Filtering */
-void vp8_loop_filter_bv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_loop_filter_vertical_edge_mmx(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_vertical_edge_mmx(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp8_loop_filter_vertical_edge_mmx(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp8_loop_filter_vertical_edge_mmx(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp8_loop_filter_vertical_edge_mmx(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-
-void vp8_loop_filter_bvs_mmx(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
-{
- vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 4, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 8, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 12, y_stride, blimit);
-}
-#endif
-
-
-/* Horizontal MB filtering */
-#if HAVE_SSE2
-void vp8_loop_filter_mbh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_mbloop_filter_horizontal_edge_sse2(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr);
-
- if (u_ptr)
- vp8_mbloop_filter_horizontal_edge_uv_sse2(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, v_ptr);
-}
-
-
-/* Vertical MB Filtering */
-void vp8_loop_filter_mbv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
- vp8_mbloop_filter_vertical_edge_sse2(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr);
-
- if (u_ptr)
- vp8_mbloop_filter_vertical_edge_uv_sse2(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, v_ptr);
-}
-
-
-/* Horizontal B Filtering */
-void vp8_loop_filter_bh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
-#if ARCH_X86_64
- vp8_loop_filter_bh_y_sse2(y_ptr, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-#else
- vp8_loop_filter_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr);
- vp8_loop_filter_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr);
- vp8_loop_filter_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr);
-#endif
-
- if (u_ptr)
- vp8_loop_filter_horizontal_edge_uv_sse2(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, v_ptr + 4 * uv_stride);
-}
-
-
-void vp8_loop_filter_bhs_sse2(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
-{
- vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, blimit);
- vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, blimit);
-}
-
-
-/* Vertical B Filtering */
-void vp8_loop_filter_bv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi)
-{
-#if ARCH_X86_64
- vp8_loop_filter_bv_y_sse2(y_ptr, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-#else
- vp8_loop_filter_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr);
- vp8_loop_filter_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr);
- vp8_loop_filter_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr);
-#endif
-
- if (u_ptr)
- vp8_loop_filter_vertical_edge_uv_sse2(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, v_ptr + 4);
-}
-
-
-void vp8_loop_filter_bvs_sse2(unsigned char *y_ptr, int y_stride, const unsigned char *blimit)
-{
- vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 4, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 8, y_stride, blimit);
- vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 12, y_stride, blimit);
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/mfqe_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/mfqe_sse2.asm
deleted file mode 100644
index a8a7f56..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/mfqe_sse2.asm
+++ /dev/null
@@ -1,287 +0,0 @@
-;
-; Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_filter_by_weight16x16_sse2
-;(
-; unsigned char *src,
-; int src_stride,
-; unsigned char *dst,
-; int dst_stride,
-; int src_weight
-;)
-global sym(vp8_filter_by_weight16x16_sse2) PRIVATE
-sym(vp8_filter_by_weight16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movd xmm0, arg(4) ; src_weight
- pshuflw xmm0, xmm0, 0x0 ; replicate to all low words
- punpcklqdq xmm0, xmm0 ; replicate to all hi words
-
- movdqa xmm1, [GLOBAL(tMFQE)]
- psubw xmm1, xmm0 ; dst_weight
-
- mov rax, arg(0) ; src
- mov rsi, arg(1) ; src_stride
- mov rdx, arg(2) ; dst
- mov rdi, arg(3) ; dst_stride
-
- mov rcx, 16 ; loop count
- pxor xmm6, xmm6
-
-.combine
- movdqa xmm2, [rax]
- movdqa xmm4, [rdx]
- add rax, rsi
-
- ; src * src_weight
- movdqa xmm3, xmm2
- punpcklbw xmm2, xmm6
- punpckhbw xmm3, xmm6
- pmullw xmm2, xmm0
- pmullw xmm3, xmm0
-
- ; dst * dst_weight
- movdqa xmm5, xmm4
- punpcklbw xmm4, xmm6
- punpckhbw xmm5, xmm6
- pmullw xmm4, xmm1
- pmullw xmm5, xmm1
-
- ; sum, round and shift
- paddw xmm2, xmm4
- paddw xmm3, xmm5
- paddw xmm2, [GLOBAL(tMFQE_round)]
- paddw xmm3, [GLOBAL(tMFQE_round)]
- psrlw xmm2, 4
- psrlw xmm3, 4
-
- packuswb xmm2, xmm3
- movdqa [rdx], xmm2
- add rdx, rdi
-
- dec rcx
- jnz .combine
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
-
- ret
-
-;void vp8_filter_by_weight8x8_sse2
-;(
-; unsigned char *src,
-; int src_stride,
-; unsigned char *dst,
-; int dst_stride,
-; int src_weight
-;)
-global sym(vp8_filter_by_weight8x8_sse2) PRIVATE
-sym(vp8_filter_by_weight8x8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movd xmm0, arg(4) ; src_weight
- pshuflw xmm0, xmm0, 0x0 ; replicate to all low words
- punpcklqdq xmm0, xmm0 ; replicate to all hi words
-
- movdqa xmm1, [GLOBAL(tMFQE)]
- psubw xmm1, xmm0 ; dst_weight
-
- mov rax, arg(0) ; src
- mov rsi, arg(1) ; src_stride
- mov rdx, arg(2) ; dst
- mov rdi, arg(3) ; dst_stride
-
- mov rcx, 8 ; loop count
- pxor xmm4, xmm4
-
-.combine
- movq xmm2, [rax]
- movq xmm3, [rdx]
- add rax, rsi
-
- ; src * src_weight
- punpcklbw xmm2, xmm4
- pmullw xmm2, xmm0
-
- ; dst * dst_weight
- punpcklbw xmm3, xmm4
- pmullw xmm3, xmm1
-
- ; sum, round and shift
- paddw xmm2, xmm3
- paddw xmm2, [GLOBAL(tMFQE_round)]
- psrlw xmm2, 4
-
- packuswb xmm2, xmm4
- movq [rdx], xmm2
- add rdx, rdi
-
- dec rcx
- jnz .combine
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
-
- ret
-
-;void vp8_variance_and_sad_16x16_sse2 | arg
-;(
-; unsigned char *src1, 0
-; int stride1, 1
-; unsigned char *src2, 2
-; int stride2, 3
-; unsigned int *variance, 4
-; unsigned int *sad, 5
-;)
-global sym(vp8_variance_and_sad_16x16_sse2) PRIVATE
-sym(vp8_variance_and_sad_16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rax, arg(0) ; src1
- mov rcx, arg(1) ; stride1
- mov rdx, arg(2) ; src2
- mov rdi, arg(3) ; stride2
-
- mov rsi, 16 ; block height
-
- ; Prep accumulator registers
- pxor xmm3, xmm3 ; SAD
- pxor xmm4, xmm4 ; sum of src2
- pxor xmm5, xmm5 ; sum of src2^2
-
- ; Because we're working with the actual output frames
- ; we can't depend on any kind of data alignment.
-.accumulate
- movdqa xmm0, [rax] ; src1
- movdqa xmm1, [rdx] ; src2
- add rax, rcx ; src1 + stride1
- add rdx, rdi ; src2 + stride2
-
- ; SAD(src1, src2)
- psadbw xmm0, xmm1
- paddusw xmm3, xmm0
-
- ; SUM(src2)
- pxor xmm2, xmm2
- psadbw xmm2, xmm1 ; sum src2 by misusing SAD against 0
- paddusw xmm4, xmm2
-
- ; pmaddubsw would be ideal if it took two unsigned values. instead,
- ; it expects a signed and an unsigned value. so instead we zero extend
- ; and operate on words.
- pxor xmm2, xmm2
- movdqa xmm0, xmm1
- punpcklbw xmm0, xmm2
- punpckhbw xmm1, xmm2
- pmaddwd xmm0, xmm0
- pmaddwd xmm1, xmm1
- paddd xmm5, xmm0
- paddd xmm5, xmm1
-
- sub rsi, 1
- jnz .accumulate
-
- ; phaddd only operates on adjacent double words.
- ; Finalize SAD and store
- movdqa xmm0, xmm3
- psrldq xmm0, 8
- paddusw xmm0, xmm3
- paddd xmm0, [GLOBAL(t128)]
- psrld xmm0, 8
-
- mov rax, arg(5)
- movd [rax], xmm0
-
- ; Accumulate sum of src2
- movdqa xmm0, xmm4
- psrldq xmm0, 8
- paddusw xmm0, xmm4
- ; Square src2. Ignore high value
- pmuludq xmm0, xmm0
- psrld xmm0, 8
-
- ; phaddw could be used to sum adjacent values but we want
- ; all the values summed. promote to doubles, accumulate,
- ; shift and sum
- pxor xmm2, xmm2
- movdqa xmm1, xmm5
- punpckldq xmm1, xmm2
- punpckhdq xmm5, xmm2
- paddd xmm1, xmm5
- movdqa xmm2, xmm1
- psrldq xmm1, 8
- paddd xmm1, xmm2
-
- psubd xmm1, xmm0
-
- ; (variance + 128) >> 8
- paddd xmm1, [GLOBAL(t128)]
- psrld xmm1, 8
- mov rax, arg(4)
-
- movd [rax], xmm1
-
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-t128:
-%ifndef __NASM_VER__
- ddq 128
-%elif CONFIG_BIG_ENDIAN
- dq 0, 128
-%else
- dq 128, 0
-%endif
-align 16
-tMFQE: ; 1 << MFQE_PRECISION
- times 8 dw 0x10
-align 16
-tMFQE_round: ; 1 << (MFQE_PRECISION - 1)
- times 8 dw 0x08
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_mmx.asm
deleted file mode 100644
index 8be3431..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_mmx.asm
+++ /dev/null
@@ -1,316 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%define VP8_FILTER_WEIGHT 128
-%define VP8_FILTER_SHIFT 7
-
-;void vp8_mbpost_proc_down_mmx(unsigned char *dst,
-; int pitch, int rows, int cols,int flimit)
-extern sym(vp8_rv)
-global sym(vp8_mbpost_proc_down_mmx) PRIVATE
-sym(vp8_mbpost_proc_down_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 136
-
- ; unsigned char d[16][8] at [rsp]
- ; create flimit2 at [rsp+128]
- mov eax, dword ptr arg(4) ;flimit
- mov [rsp+128], eax
- mov [rsp+128+4], eax
-%define flimit2 [rsp+128]
-
-%if ABI_IS_32BIT=0
- lea r8, [GLOBAL(sym(vp8_rv))]
-%endif
-
- ;rows +=8;
- add dword ptr arg(2), 8
-
- ;for(c=0; c<cols; c+=4)
-.loop_col:
- mov rsi, arg(0) ;s
- pxor mm0, mm0 ;
-
- movsxd rax, dword ptr arg(1) ;pitch ;
-
- ; this copies the last row down into the border 8 rows
- mov rdi, rsi
- mov rdx, arg(2)
- sub rdx, 9
- imul rdx, rax
- lea rdi, [rdi+rdx]
- movq mm1, QWORD ptr[rdi] ; first row
- mov rcx, 8
-.init_borderd ; initialize borders
- lea rdi, [rdi + rax]
- movq [rdi], mm1
-
- dec rcx
- jne .init_borderd
-
- neg rax ; rax = -pitch
-
- ; this copies the first row up into the border 8 rows
- mov rdi, rsi
- movq mm1, QWORD ptr[rdi] ; first row
- mov rcx, 8
-.init_border ; initialize borders
- lea rdi, [rdi + rax]
- movq [rdi], mm1
-
- dec rcx
- jne .init_border
-
-
- lea rsi, [rsi + rax*8]; ; rdi = s[-pitch*8]
- neg rax
-
-
- pxor mm5, mm5
- pxor mm6, mm6 ;
-
- pxor mm7, mm7 ;
- mov rdi, rsi
-
- mov rcx, 15 ;
-
-.loop_initvar:
- movd mm1, DWORD PTR [rdi];
- punpcklbw mm1, mm0 ;
-
- paddw mm5, mm1 ;
- pmullw mm1, mm1 ;
-
- movq mm2, mm1 ;
- punpcklwd mm1, mm0 ;
-
- punpckhwd mm2, mm0 ;
- paddd mm6, mm1 ;
-
- paddd mm7, mm2 ;
- lea rdi, [rdi+rax] ;
-
- dec rcx
- jne .loop_initvar
- ;save the var and sum
- xor rdx, rdx
-.loop_row:
- movd mm1, DWORD PTR [rsi] ; [s-pitch*8]
- movd mm2, DWORD PTR [rdi] ; [s+pitch*7]
-
- punpcklbw mm1, mm0
- punpcklbw mm2, mm0
-
- paddw mm5, mm2
- psubw mm5, mm1
-
- pmullw mm2, mm2
- movq mm4, mm2
-
- punpcklwd mm2, mm0
- punpckhwd mm4, mm0
-
- paddd mm6, mm2
- paddd mm7, mm4
-
- pmullw mm1, mm1
- movq mm2, mm1
-
- punpcklwd mm1, mm0
- psubd mm6, mm1
-
- punpckhwd mm2, mm0
- psubd mm7, mm2
-
-
- movq mm3, mm6
- pslld mm3, 4
-
- psubd mm3, mm6
- movq mm1, mm5
-
- movq mm4, mm5
- pmullw mm1, mm1
-
- pmulhw mm4, mm4
- movq mm2, mm1
-
- punpcklwd mm1, mm4
- punpckhwd mm2, mm4
-
- movq mm4, mm7
- pslld mm4, 4
-
- psubd mm4, mm7
-
- psubd mm3, mm1
- psubd mm4, mm2
-
- psubd mm3, flimit2
- psubd mm4, flimit2
-
- psrad mm3, 31
- psrad mm4, 31
-
- packssdw mm3, mm4
- packsswb mm3, mm0
-
- movd mm1, DWORD PTR [rsi+rax*8]
-
- movq mm2, mm1
- punpcklbw mm1, mm0
-
- paddw mm1, mm5
- mov rcx, rdx
-
- and rcx, 127
-%if ABI_IS_32BIT=1 && CONFIG_PIC=1
- push rax
- lea rax, [GLOBAL(sym(vp8_rv))]
- movq mm4, [rax + rcx*2] ;vp8_rv[rcx*2]
- pop rax
-%elif ABI_IS_32BIT=0
- movq mm4, [r8 + rcx*2] ;vp8_rv[rcx*2]
-%else
- movq mm4, [sym(vp8_rv) + rcx*2]
-%endif
- paddw mm1, mm4
- psraw mm1, 4
-
- packuswb mm1, mm0
- pand mm1, mm3
-
- pandn mm3, mm2
- por mm1, mm3
-
- and rcx, 15
- movd DWORD PTR [rsp+rcx*4], mm1 ;d[rcx*4]
-
- cmp edx, 8
- jl .skip_assignment
-
- mov rcx, rdx
- sub rcx, 8
- and rcx, 15
- movd mm1, DWORD PTR [rsp+rcx*4] ;d[rcx*4]
- movd [rsi], mm1
-
-.skip_assignment
- lea rsi, [rsi+rax]
-
- lea rdi, [rdi+rax]
- add rdx, 1
-
- cmp edx, dword arg(2) ;rows
- jl .loop_row
-
-
- add dword arg(0), 4 ; s += 4
- sub dword arg(3), 4 ; cols -= 4
- cmp dword arg(3), 0
- jg .loop_col
-
- add rsp, 136
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef flimit2
-
-
-;void vp8_plane_add_noise_mmx (unsigned char *Start, unsigned char *noise,
-; unsigned char blackclamp[16],
-; unsigned char whiteclamp[16],
-; unsigned char bothclamp[16],
-; unsigned int Width, unsigned int Height, int Pitch)
-extern sym(rand)
-global sym(vp8_plane_add_noise_mmx) PRIVATE
-sym(vp8_plane_add_noise_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-.addnoise_loop:
- call sym(rand) WRT_PLT
- mov rcx, arg(1) ;noise
- and rax, 0xff
- add rcx, rax
-
- ; we rely on the fact that the clamping vectors are stored contiguously
- ; in black/white/both order. Note that we have to reload this here because
- ; rdx could be trashed by rand()
- mov rdx, arg(2) ; blackclamp
-
-
- mov rdi, rcx
- movsxd rcx, dword arg(5) ;[Width]
- mov rsi, arg(0) ;Pos
- xor rax,rax
-
-.addnoise_nextset:
- movq mm1,[rsi+rax] ; get the source
-
- psubusb mm1, [rdx] ;blackclamp ; clamp both sides so we don't outrange adding noise
- paddusb mm1, [rdx+32] ;bothclamp
- psubusb mm1, [rdx+16] ;whiteclamp
-
- movq mm2,[rdi+rax] ; get the noise for this line
- paddb mm1,mm2 ; add it in
- movq [rsi+rax],mm1 ; store the result
-
- add rax,8 ; move to the next line
-
- cmp rax, rcx
- jl .addnoise_nextset
-
- movsxd rax, dword arg(7) ; Pitch
- add arg(0), rax ; Start += Pitch
- sub dword arg(6), 1 ; Height -= 1
- jg .addnoise_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-SECTION_RODATA
-align 16
-Blur:
- times 16 dw 16
- times 8 dw 64
- times 16 dw 16
- times 8 dw 0
-
-rd:
- times 4 dw 0x40
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_sse2.asm
deleted file mode 100644
index f53daa7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_sse2.asm
+++ /dev/null
@@ -1,724 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;macro in deblock functions
-%macro FIRST_2_ROWS 0
- movdqa xmm4, xmm0
- movdqa xmm6, xmm0
- movdqa xmm5, xmm1
- pavgb xmm5, xmm3
-
- ;calculate absolute value
- psubusb xmm4, xmm1
- psubusb xmm1, xmm0
- psubusb xmm6, xmm3
- psubusb xmm3, xmm0
- paddusb xmm4, xmm1
- paddusb xmm6, xmm3
-
- ;get threshold
- movdqa xmm2, flimit
- pxor xmm1, xmm1
- movdqa xmm7, xmm2
-
- ;get mask
- psubusb xmm2, xmm4
- psubusb xmm7, xmm6
- pcmpeqb xmm2, xmm1
- pcmpeqb xmm7, xmm1
- por xmm7, xmm2
-%endmacro
-
-%macro SECOND_2_ROWS 0
- movdqa xmm6, xmm0
- movdqa xmm4, xmm0
- movdqa xmm2, xmm1
- pavgb xmm1, xmm3
-
- ;calculate absolute value
- psubusb xmm6, xmm2
- psubusb xmm2, xmm0
- psubusb xmm4, xmm3
- psubusb xmm3, xmm0
- paddusb xmm6, xmm2
- paddusb xmm4, xmm3
-
- pavgb xmm5, xmm1
-
- ;get threshold
- movdqa xmm2, flimit
- pxor xmm1, xmm1
- movdqa xmm3, xmm2
-
- ;get mask
- psubusb xmm2, xmm6
- psubusb xmm3, xmm4
- pcmpeqb xmm2, xmm1
- pcmpeqb xmm3, xmm1
-
- por xmm7, xmm2
- por xmm7, xmm3
-
- pavgb xmm5, xmm0
-
- ;decide if or not to use filtered value
- pand xmm0, xmm7
- pandn xmm7, xmm5
- paddusb xmm0, xmm7
-%endmacro
-
-%macro UPDATE_FLIMIT 0
- movdqa xmm2, XMMWORD PTR [rbx]
- movdqa [rsp], xmm2
- add rbx, 16
-%endmacro
-
-;void vp8_post_proc_down_and_across_mb_row_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned char *dst_ptr,
-; int src_pixels_per_line,
-; int dst_pixels_per_line,
-; int cols,
-; int *flimits,
-; int size
-;)
-global sym(vp8_post_proc_down_and_across_mb_row_sse2) PRIVATE
-sym(vp8_post_proc_down_and_across_mb_row_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- push rbx
- push rsi
- push rdi
- ; end prolog
- ALIGN_STACK 16, rax
- sub rsp, 16
-
- ; put flimit on stack
- mov rbx, arg(5) ;flimits ptr
- UPDATE_FLIMIT
-
-%define flimit [rsp]
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;dst_ptr
-
- movsxd rax, DWORD PTR arg(2) ;src_pixels_per_line
- movsxd rcx, DWORD PTR arg(6) ;rows in a macroblock
-.nextrow:
- xor rdx, rdx ;col
-.nextcol:
- ;load current and next 2 rows
- movdqu xmm0, XMMWORD PTR [rsi]
- movdqu xmm1, XMMWORD PTR [rsi + rax]
- movdqu xmm3, XMMWORD PTR [rsi + 2*rax]
-
- FIRST_2_ROWS
-
- ;load above 2 rows
- neg rax
- movdqu xmm1, XMMWORD PTR [rsi + 2*rax]
- movdqu xmm3, XMMWORD PTR [rsi + rax]
-
- SECOND_2_ROWS
-
- movdqu XMMWORD PTR [rdi], xmm0
-
- neg rax ; positive stride
- add rsi, 16
- add rdi, 16
-
- add rdx, 16
- cmp edx, dword arg(4) ;cols
- jge .downdone
- UPDATE_FLIMIT
- jmp .nextcol
-
-.downdone:
- ; done with the all cols, start the across filtering in place
- sub rsi, rdx
- sub rdi, rdx
-
- mov rbx, arg(5) ; flimits
- UPDATE_FLIMIT
-
- ; dup the first byte into the left border 8 times
- movq mm1, [rdi]
- punpcklbw mm1, mm1
- punpcklwd mm1, mm1
- punpckldq mm1, mm1
- mov rdx, -8
- movq [rdi+rdx], mm1
-
- ; dup the last byte into the right border
- movsxd rdx, dword arg(4)
- movq mm1, [rdi + rdx + -1]
- punpcklbw mm1, mm1
- punpcklwd mm1, mm1
- punpckldq mm1, mm1
- movq [rdi+rdx], mm1
-
- xor rdx, rdx
- movq mm0, QWORD PTR [rdi-16];
- movq mm1, QWORD PTR [rdi-8];
-
-.acrossnextcol:
- movdqu xmm0, XMMWORD PTR [rdi + rdx]
- movdqu xmm1, XMMWORD PTR [rdi + rdx -2]
- movdqu xmm3, XMMWORD PTR [rdi + rdx -1]
-
- FIRST_2_ROWS
-
- movdqu xmm1, XMMWORD PTR [rdi + rdx +1]
- movdqu xmm3, XMMWORD PTR [rdi + rdx +2]
-
- SECOND_2_ROWS
-
- movq QWORD PTR [rdi+rdx-16], mm0 ; store previous 8 bytes
- movq QWORD PTR [rdi+rdx-8], mm1 ; store previous 8 bytes
- movdq2q mm0, xmm0
- psrldq xmm0, 8
- movdq2q mm1, xmm0
-
- add rdx, 16
- cmp edx, dword arg(4) ;cols
- jge .acrossdone
- UPDATE_FLIMIT
- jmp .acrossnextcol
-
-.acrossdone
- ; last 16 pixels
- movq QWORD PTR [rdi+rdx-16], mm0
-
- cmp edx, dword arg(4)
- jne .throw_last_8
- movq QWORD PTR [rdi+rdx-8], mm1
-.throw_last_8:
- ; done with this rwo
- add rsi,rax ;next src line
- mov eax, dword arg(3) ;dst_pixels_per_line
- add rdi,rax ;next destination
- mov eax, dword arg(2) ;src_pixels_per_line
-
- mov rbx, arg(5) ;flimits
- UPDATE_FLIMIT
-
- dec rcx ;decrement count
- jnz .nextrow ;next row
-
- add rsp, 16
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- pop rbx
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef flimit
-
-;void vp8_mbpost_proc_down_xmm(unsigned char *dst,
-; int pitch, int rows, int cols,int flimit)
-extern sym(vp8_rv)
-global sym(vp8_mbpost_proc_down_xmm) PRIVATE
-sym(vp8_mbpost_proc_down_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 128+16
-
- ; unsigned char d[16][8] at [rsp]
- ; create flimit2 at [rsp+128]
- mov eax, dword ptr arg(4) ;flimit
- mov [rsp+128], eax
- mov [rsp+128+4], eax
- mov [rsp+128+8], eax
- mov [rsp+128+12], eax
-%define flimit4 [rsp+128]
-
-%if ABI_IS_32BIT=0
- lea r8, [GLOBAL(sym(vp8_rv))]
-%endif
-
- ;rows +=8;
- add dword arg(2), 8
-
- ;for(c=0; c<cols; c+=8)
-.loop_col:
- mov rsi, arg(0) ; s
- pxor xmm0, xmm0 ;
-
- movsxd rax, dword ptr arg(1) ;pitch ;
-
- ; this copies the last row down into the border 8 rows
- mov rdi, rsi
- mov rdx, arg(2)
- sub rdx, 9
- imul rdx, rax
- lea rdi, [rdi+rdx]
- movq xmm1, QWORD ptr[rdi] ; first row
- mov rcx, 8
-.init_borderd ; initialize borders
- lea rdi, [rdi + rax]
- movq [rdi], xmm1
-
- dec rcx
- jne .init_borderd
-
- neg rax ; rax = -pitch
-
- ; this copies the first row up into the border 8 rows
- mov rdi, rsi
- movq xmm1, QWORD ptr[rdi] ; first row
- mov rcx, 8
-.init_border ; initialize borders
- lea rdi, [rdi + rax]
- movq [rdi], xmm1
-
- dec rcx
- jne .init_border
-
-
-
- lea rsi, [rsi + rax*8]; ; rdi = s[-pitch*8]
- neg rax
-
- pxor xmm5, xmm5
- pxor xmm6, xmm6 ;
-
- pxor xmm7, xmm7 ;
- mov rdi, rsi
-
- mov rcx, 15 ;
-
-.loop_initvar:
- movq xmm1, QWORD PTR [rdi];
- punpcklbw xmm1, xmm0 ;
-
- paddw xmm5, xmm1 ;
- pmullw xmm1, xmm1 ;
-
- movdqa xmm2, xmm1 ;
- punpcklwd xmm1, xmm0 ;
-
- punpckhwd xmm2, xmm0 ;
- paddd xmm6, xmm1 ;
-
- paddd xmm7, xmm2 ;
- lea rdi, [rdi+rax] ;
-
- dec rcx
- jne .loop_initvar
- ;save the var and sum
- xor rdx, rdx
-.loop_row:
- movq xmm1, QWORD PTR [rsi] ; [s-pitch*8]
- movq xmm2, QWORD PTR [rdi] ; [s+pitch*7]
-
- punpcklbw xmm1, xmm0
- punpcklbw xmm2, xmm0
-
- paddw xmm5, xmm2
- psubw xmm5, xmm1
-
- pmullw xmm2, xmm2
- movdqa xmm4, xmm2
-
- punpcklwd xmm2, xmm0
- punpckhwd xmm4, xmm0
-
- paddd xmm6, xmm2
- paddd xmm7, xmm4
-
- pmullw xmm1, xmm1
- movdqa xmm2, xmm1
-
- punpcklwd xmm1, xmm0
- psubd xmm6, xmm1
-
- punpckhwd xmm2, xmm0
- psubd xmm7, xmm2
-
-
- movdqa xmm3, xmm6
- pslld xmm3, 4
-
- psubd xmm3, xmm6
- movdqa xmm1, xmm5
-
- movdqa xmm4, xmm5
- pmullw xmm1, xmm1
-
- pmulhw xmm4, xmm4
- movdqa xmm2, xmm1
-
- punpcklwd xmm1, xmm4
- punpckhwd xmm2, xmm4
-
- movdqa xmm4, xmm7
- pslld xmm4, 4
-
- psubd xmm4, xmm7
-
- psubd xmm3, xmm1
- psubd xmm4, xmm2
-
- psubd xmm3, flimit4
- psubd xmm4, flimit4
-
- psrad xmm3, 31
- psrad xmm4, 31
-
- packssdw xmm3, xmm4
- packsswb xmm3, xmm0
-
- movq xmm1, QWORD PTR [rsi+rax*8]
-
- movq xmm2, xmm1
- punpcklbw xmm1, xmm0
-
- paddw xmm1, xmm5
- mov rcx, rdx
-
- and rcx, 127
-%if ABI_IS_32BIT=1 && CONFIG_PIC=1
- push rax
- lea rax, [GLOBAL(sym(vp8_rv))]
- movdqu xmm4, [rax + rcx*2] ;vp8_rv[rcx*2]
- pop rax
-%elif ABI_IS_32BIT=0
- movdqu xmm4, [r8 + rcx*2] ;vp8_rv[rcx*2]
-%else
- movdqu xmm4, [sym(vp8_rv) + rcx*2]
-%endif
-
- paddw xmm1, xmm4
- ;paddw xmm1, eight8s
- psraw xmm1, 4
-
- packuswb xmm1, xmm0
- pand xmm1, xmm3
-
- pandn xmm3, xmm2
- por xmm1, xmm3
-
- and rcx, 15
- movq QWORD PTR [rsp + rcx*8], xmm1 ;d[rcx*8]
-
- cmp edx, 8
- jl .skip_assignment
-
- mov rcx, rdx
- sub rcx, 8
- and rcx, 15
- movq mm0, [rsp + rcx*8] ;d[rcx*8]
- movq [rsi], mm0
-
-.skip_assignment
- lea rsi, [rsi+rax]
-
- lea rdi, [rdi+rax]
- add rdx, 1
-
- cmp edx, dword arg(2) ;rows
- jl .loop_row
-
- add dword arg(0), 8 ; s += 8
- sub dword arg(3), 8 ; cols -= 8
- cmp dword arg(3), 0
- jg .loop_col
-
- add rsp, 128+16
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef flimit4
-
-
-;void vp8_mbpost_proc_across_ip_xmm(unsigned char *src,
-; int pitch, int rows, int cols,int flimit)
-global sym(vp8_mbpost_proc_across_ip_xmm) PRIVATE
-sym(vp8_mbpost_proc_across_ip_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16
-
- ; create flimit4 at [rsp]
- mov eax, dword ptr arg(4) ;flimit
- mov [rsp], eax
- mov [rsp+4], eax
- mov [rsp+8], eax
- mov [rsp+12], eax
-%define flimit4 [rsp]
-
-
- ;for(r=0;r<rows;r++)
-.ip_row_loop:
-
- xor rdx, rdx ;sumsq=0;
- xor rcx, rcx ;sum=0;
- mov rsi, arg(0); s
-
-
- ; dup the first byte into the left border 8 times
- movq mm1, [rsi]
- punpcklbw mm1, mm1
- punpcklwd mm1, mm1
- punpckldq mm1, mm1
-
- mov rdi, -8
- movq [rsi+rdi], mm1
-
- ; dup the last byte into the right border
- movsxd rdx, dword arg(3)
- movq mm1, [rsi + rdx + -1]
- punpcklbw mm1, mm1
- punpcklwd mm1, mm1
- punpckldq mm1, mm1
- movq [rsi+rdx], mm1
-
-.ip_var_loop:
- ;for(i=-8;i<=6;i++)
- ;{
- ; sumsq += s[i]*s[i];
- ; sum += s[i];
- ;}
- movzx eax, byte [rsi+rdi]
- add ecx, eax
- mul al
- add edx, eax
- add rdi, 1
- cmp rdi, 6
- jle .ip_var_loop
-
-
- ;mov rax, sumsq
- ;movd xmm7, rax
- movd xmm7, edx
-
- ;mov rax, sum
- ;movd xmm6, rax
- movd xmm6, ecx
-
- mov rsi, arg(0) ;s
- xor rcx, rcx
-
- movsxd rdx, dword arg(3) ;cols
- add rdx, 8
- pxor mm0, mm0
- pxor mm1, mm1
-
- pxor xmm0, xmm0
-.nextcol4:
-
- movd xmm1, DWORD PTR [rsi+rcx-8] ; -8 -7 -6 -5
- movd xmm2, DWORD PTR [rsi+rcx+7] ; +7 +8 +9 +10
-
- punpcklbw xmm1, xmm0 ; expanding
- punpcklbw xmm2, xmm0 ; expanding
-
- punpcklwd xmm1, xmm0 ; expanding to dwords
- punpcklwd xmm2, xmm0 ; expanding to dwords
-
- psubd xmm2, xmm1 ; 7--8 8--7 9--6 10--5
- paddd xmm1, xmm1 ; -8*2 -7*2 -6*2 -5*2
-
- paddd xmm1, xmm2 ; 7+-8 8+-7 9+-6 10+-5
- pmaddwd xmm1, xmm2 ; squared of 7+-8 8+-7 9+-6 10+-5
-
- paddd xmm6, xmm2
- paddd xmm7, xmm1
-
- pshufd xmm6, xmm6, 0 ; duplicate the last ones
- pshufd xmm7, xmm7, 0 ; duplicate the last ones
-
- psrldq xmm1, 4 ; 8--7 9--6 10--5 0000
- psrldq xmm2, 4 ; 8--7 9--6 10--5 0000
-
- pshufd xmm3, xmm1, 3 ; 0000 8--7 8--7 8--7 squared
- pshufd xmm4, xmm2, 3 ; 0000 8--7 8--7 8--7 squared
-
- paddd xmm6, xmm4
- paddd xmm7, xmm3
-
- pshufd xmm3, xmm1, 01011111b ; 0000 0000 9--6 9--6 squared
- pshufd xmm4, xmm2, 01011111b ; 0000 0000 9--6 9--6 squared
-
- paddd xmm7, xmm3
- paddd xmm6, xmm4
-
- pshufd xmm3, xmm1, 10111111b ; 0000 0000 8--7 8--7 squared
- pshufd xmm4, xmm2, 10111111b ; 0000 0000 8--7 8--7 squared
-
- paddd xmm7, xmm3
- paddd xmm6, xmm4
-
- movdqa xmm3, xmm6
- pmaddwd xmm3, xmm3
-
- movdqa xmm5, xmm7
- pslld xmm5, 4
-
- psubd xmm5, xmm7
- psubd xmm5, xmm3
-
- psubd xmm5, flimit4
- psrad xmm5, 31
-
- packssdw xmm5, xmm0
- packsswb xmm5, xmm0
-
- movd xmm1, DWORD PTR [rsi+rcx]
- movq xmm2, xmm1
-
- punpcklbw xmm1, xmm0
- punpcklwd xmm1, xmm0
-
- paddd xmm1, xmm6
- paddd xmm1, [GLOBAL(four8s)]
-
- psrad xmm1, 4
- packssdw xmm1, xmm0
-
- packuswb xmm1, xmm0
- pand xmm1, xmm5
-
- pandn xmm5, xmm2
- por xmm5, xmm1
-
- movd [rsi+rcx-8], mm0
- movq mm0, mm1
-
- movdq2q mm1, xmm5
- psrldq xmm7, 12
-
- psrldq xmm6, 12
- add rcx, 4
-
- cmp rcx, rdx
- jl .nextcol4
-
- ;s+=pitch;
- movsxd rax, dword arg(1)
- add arg(0), rax
-
- sub dword arg(2), 1 ;rows-=1
- cmp dword arg(2), 0
- jg .ip_row_loop
-
- add rsp, 16
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef flimit4
-
-
-;void vp8_plane_add_noise_wmt (unsigned char *Start, unsigned char *noise,
-; unsigned char blackclamp[16],
-; unsigned char whiteclamp[16],
-; unsigned char bothclamp[16],
-; unsigned int Width, unsigned int Height, int Pitch)
-extern sym(rand)
-global sym(vp8_plane_add_noise_wmt) PRIVATE
-sym(vp8_plane_add_noise_wmt):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-.addnoise_loop:
- call sym(rand) WRT_PLT
- mov rcx, arg(1) ;noise
- and rax, 0xff
- add rcx, rax
-
- ; we rely on the fact that the clamping vectors are stored contiguously
- ; in black/white/both order. Note that we have to reload this here because
- ; rdx could be trashed by rand()
- mov rdx, arg(2) ; blackclamp
-
-
- mov rdi, rcx
- movsxd rcx, dword arg(5) ;[Width]
- mov rsi, arg(0) ;Pos
- xor rax,rax
-
-.addnoise_nextset:
- movdqu xmm1,[rsi+rax] ; get the source
-
- psubusb xmm1, [rdx] ;blackclamp ; clamp both sides so we don't outrange adding noise
- paddusb xmm1, [rdx+32] ;bothclamp
- psubusb xmm1, [rdx+16] ;whiteclamp
-
- movdqu xmm2,[rdi+rax] ; get the noise for this line
- paddb xmm1,xmm2 ; add it in
- movdqu [rsi+rax],xmm1 ; store the result
-
- add rax,16 ; move to the next line
-
- cmp rax, rcx
- jl .addnoise_nextset
-
- movsxd rax, dword arg(7) ; Pitch
- add arg(0), rax ; Start += Pitch
- sub dword arg(6), 1 ; Height -= 1
- jg .addnoise_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-SECTION_RODATA
-align 16
-four8s:
- times 4 dd 8
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_x86.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_x86.c
deleted file mode 100644
index 3ec0106..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/postproc_x86.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-/* On Android NDK, rand is inlined function, but postproc needs rand symbol */
-#if defined(__ANDROID__)
-#define rand __rand
-#include <stdlib.h>
-#undef rand
-
-extern int rand(void)
-{
- return __rand();
-}
-#else
-/* ISO C forbids an empty translation unit. */
-int vp8_unused;
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_mmx.asm
deleted file mode 100644
index 15e9871..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_mmx.asm
+++ /dev/null
@@ -1,274 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-
-;void copy_mem8x8_mmx(
-; unsigned char *src,
-; int src_stride,
-; unsigned char *dst,
-; int dst_stride
-; )
-global sym(vp8_copy_mem8x8_mmx) PRIVATE
-sym(vp8_copy_mem8x8_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src;
- movq mm0, [rsi]
-
- movsxd rax, dword ptr arg(1) ;src_stride;
- mov rdi, arg(2) ;dst;
-
- movq mm1, [rsi+rax]
- movq mm2, [rsi+rax*2]
-
- movsxd rcx, dword ptr arg(3) ;dst_stride
- lea rsi, [rsi+rax*2]
-
- movq [rdi], mm0
- add rsi, rax
-
- movq [rdi+rcx], mm1
- movq [rdi+rcx*2], mm2
-
-
- lea rdi, [rdi+rcx*2]
- movq mm3, [rsi]
-
- add rdi, rcx
- movq mm4, [rsi+rax]
-
- movq mm5, [rsi+rax*2]
- movq [rdi], mm3
-
- lea rsi, [rsi+rax*2]
- movq [rdi+rcx], mm4
-
- movq [rdi+rcx*2], mm5
- lea rdi, [rdi+rcx*2]
-
- movq mm0, [rsi+rax]
- movq mm1, [rsi+rax*2]
-
- movq [rdi+rcx], mm0
- movq [rdi+rcx*2],mm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void copy_mem8x4_mmx(
-; unsigned char *src,
-; int src_stride,
-; unsigned char *dst,
-; int dst_stride
-; )
-global sym(vp8_copy_mem8x4_mmx) PRIVATE
-sym(vp8_copy_mem8x4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src;
- movq mm0, [rsi]
-
- movsxd rax, dword ptr arg(1) ;src_stride;
- mov rdi, arg(2) ;dst;
-
- movq mm1, [rsi+rax]
- movq mm2, [rsi+rax*2]
-
- movsxd rcx, dword ptr arg(3) ;dst_stride
- lea rsi, [rsi+rax*2]
-
- movq [rdi], mm0
- movq [rdi+rcx], mm1
-
- movq [rdi+rcx*2], mm2
- lea rdi, [rdi+rcx*2]
-
- movq mm3, [rsi+rax]
- movq [rdi+rcx], mm3
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void copy_mem16x16_mmx(
-; unsigned char *src,
-; int src_stride,
-; unsigned char *dst,
-; int dst_stride
-; )
-global sym(vp8_copy_mem16x16_mmx) PRIVATE
-sym(vp8_copy_mem16x16_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src;
- movsxd rax, dword ptr arg(1) ;src_stride;
-
- mov rdi, arg(2) ;dst;
- movsxd rcx, dword ptr arg(3) ;dst_stride
-
- movq mm0, [rsi]
- movq mm3, [rsi+8];
-
- movq mm1, [rsi+rax]
- movq mm4, [rsi+rax+8]
-
- movq mm2, [rsi+rax*2]
- movq mm5, [rsi+rax*2+8]
-
- lea rsi, [rsi+rax*2]
- add rsi, rax
-
- movq [rdi], mm0
- movq [rdi+8], mm3
-
- movq [rdi+rcx], mm1
- movq [rdi+rcx+8], mm4
-
- movq [rdi+rcx*2], mm2
- movq [rdi+rcx*2+8], mm5
-
- lea rdi, [rdi+rcx*2]
- add rdi, rcx
-
- movq mm0, [rsi]
- movq mm3, [rsi+8];
-
- movq mm1, [rsi+rax]
- movq mm4, [rsi+rax+8]
-
- movq mm2, [rsi+rax*2]
- movq mm5, [rsi+rax*2+8]
-
- lea rsi, [rsi+rax*2]
- add rsi, rax
-
- movq [rdi], mm0
- movq [rdi+8], mm3
-
- movq [rdi+rcx], mm1
- movq [rdi+rcx+8], mm4
-
- movq [rdi+rcx*2], mm2
- movq [rdi+rcx*2+8], mm5
-
- lea rdi, [rdi+rcx*2]
- add rdi, rcx
-
- movq mm0, [rsi]
- movq mm3, [rsi+8];
-
- movq mm1, [rsi+rax]
- movq mm4, [rsi+rax+8]
-
- movq mm2, [rsi+rax*2]
- movq mm5, [rsi+rax*2+8]
-
- lea rsi, [rsi+rax*2]
- add rsi, rax
-
- movq [rdi], mm0
- movq [rdi+8], mm3
-
- movq [rdi+rcx], mm1
- movq [rdi+rcx+8], mm4
-
- movq [rdi+rcx*2], mm2
- movq [rdi+rcx*2+8], mm5
-
- lea rdi, [rdi+rcx*2]
- add rdi, rcx
-
- movq mm0, [rsi]
- movq mm3, [rsi+8];
-
- movq mm1, [rsi+rax]
- movq mm4, [rsi+rax+8]
-
- movq mm2, [rsi+rax*2]
- movq mm5, [rsi+rax*2+8]
-
- lea rsi, [rsi+rax*2]
- add rsi, rax
-
- movq [rdi], mm0
- movq [rdi+8], mm3
-
- movq [rdi+rcx], mm1
- movq [rdi+rcx+8], mm4
-
- movq [rdi+rcx*2], mm2
- movq [rdi+rcx*2+8], mm5
-
- lea rdi, [rdi+rcx*2]
- add rdi, rcx
-
- movq mm0, [rsi]
- movq mm3, [rsi+8];
-
- movq mm1, [rsi+rax]
- movq mm4, [rsi+rax+8]
-
- movq mm2, [rsi+rax*2]
- movq mm5, [rsi+rax*2+8]
-
- lea rsi, [rsi+rax*2]
- add rsi, rax
-
- movq [rdi], mm0
- movq [rdi+8], mm3
-
- movq [rdi+rcx], mm1
- movq [rdi+rcx+8], mm4
-
- movq [rdi+rcx*2], mm2
- movq [rdi+rcx*2+8], mm5
-
- lea rdi, [rdi+rcx*2]
- add rdi, rcx
-
- movq mm0, [rsi]
- movq mm3, [rsi+8];
-
- movq [rdi], mm0
- movq [rdi+8], mm3
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_sse2.asm
deleted file mode 100644
index 1434bcd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_sse2.asm
+++ /dev/null
@@ -1,1082 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void copy_mem16x16_sse2(
-; unsigned char *src,
-; int src_stride,
-; unsigned char *dst,
-; int dst_stride
-; )
-global sym(vp8_copy_mem16x16_sse2) PRIVATE
-sym(vp8_copy_mem16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src;
- movdqu xmm0, [rsi]
-
- movsxd rax, dword ptr arg(1) ;src_stride;
- mov rdi, arg(2) ;dst;
-
- movdqu xmm1, [rsi+rax]
- movdqu xmm2, [rsi+rax*2]
-
- movsxd rcx, dword ptr arg(3) ;dst_stride
- lea rsi, [rsi+rax*2]
-
- movdqa [rdi], xmm0
- add rsi, rax
-
- movdqa [rdi+rcx], xmm1
- movdqa [rdi+rcx*2],xmm2
-
- lea rdi, [rdi+rcx*2]
- movdqu xmm3, [rsi]
-
- add rdi, rcx
- movdqu xmm4, [rsi+rax]
-
- movdqu xmm5, [rsi+rax*2]
- lea rsi, [rsi+rax*2]
-
- movdqa [rdi], xmm3
- add rsi, rax
-
- movdqa [rdi+rcx], xmm4
- movdqa [rdi+rcx*2],xmm5
-
- lea rdi, [rdi+rcx*2]
- movdqu xmm0, [rsi]
-
- add rdi, rcx
- movdqu xmm1, [rsi+rax]
-
- movdqu xmm2, [rsi+rax*2]
- lea rsi, [rsi+rax*2]
-
- movdqa [rdi], xmm0
- add rsi, rax
-
- movdqa [rdi+rcx], xmm1
-
- movdqa [rdi+rcx*2], xmm2
- movdqu xmm3, [rsi]
-
- movdqu xmm4, [rsi+rax]
- lea rdi, [rdi+rcx*2]
-
- add rdi, rcx
- movdqu xmm5, [rsi+rax*2]
-
- lea rsi, [rsi+rax*2]
- movdqa [rdi], xmm3
-
- add rsi, rax
- movdqa [rdi+rcx], xmm4
-
- movdqa [rdi+rcx*2],xmm5
- movdqu xmm0, [rsi]
-
- lea rdi, [rdi+rcx*2]
- movdqu xmm1, [rsi+rax]
-
- add rdi, rcx
- movdqu xmm2, [rsi+rax*2]
-
- lea rsi, [rsi+rax*2]
- movdqa [rdi], xmm0
-
- movdqa [rdi+rcx], xmm1
- movdqa [rdi+rcx*2],xmm2
-
- movdqu xmm3, [rsi+rax]
- lea rdi, [rdi+rcx*2]
-
- movdqa [rdi+rcx], xmm3
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_intra_pred_uv_dc_mmx2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride,
-; )
-global sym(vp8_intra_pred_uv_dc_mmx2) PRIVATE
-sym(vp8_intra_pred_uv_dc_mmx2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- ; from top
- mov rdi, arg(2) ;above;
- mov rsi, arg(3) ;left;
- movsxd rax, dword ptr arg(4) ;left_stride;
- pxor mm0, mm0
- movq mm1, [rdi]
- lea rdi, [rax*3]
- psadbw mm1, mm0
- ; from left
- movzx ecx, byte [rsi]
- movzx edx, byte [rsi+rax*1]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
-
- movzx edx, byte [rsi+rdi]
- lea rsi, [rsi+rax*4]
- add ecx, edx
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
-
- ; add up
- pextrw edx, mm1, 0x0
- lea edx, [edx+ecx+8]
- sar edx, 4
- movd mm1, edx
- movsxd rcx, dword ptr arg(1) ;dst_stride
- pshufw mm1, mm1, 0x0
- mov rdi, arg(0) ;dst;
- packuswb mm1, mm1
-
- ; write out
- lea rax, [rcx*3]
- lea rdx, [rdi+rcx*4]
-
- movq [rdi ], mm1
- movq [rdi+rcx ], mm1
- movq [rdi+rcx*2], mm1
- movq [rdi+rax ], mm1
- movq [rdx ], mm1
- movq [rdx+rcx ], mm1
- movq [rdx+rcx*2], mm1
- movq [rdx+rax ], mm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_uv_dctop_mmx2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride,
-; )
-global sym(vp8_intra_pred_uv_dctop_mmx2) PRIVATE
-sym(vp8_intra_pred_uv_dctop_mmx2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ;arg(3), arg(4) not used
-
- ; from top
- mov rsi, arg(2) ;above;
- pxor mm0, mm0
- movq mm1, [rsi]
- psadbw mm1, mm0
-
- ; add up
- paddw mm1, [GLOBAL(dc_4)]
- psraw mm1, 3
- pshufw mm1, mm1, 0x0
- packuswb mm1, mm1
-
- ; write out
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
- lea rax, [rcx*3]
-
- movq [rdi ], mm1
- movq [rdi+rcx ], mm1
- movq [rdi+rcx*2], mm1
- movq [rdi+rax ], mm1
- lea rdi, [rdi+rcx*4]
- movq [rdi ], mm1
- movq [rdi+rcx ], mm1
- movq [rdi+rcx*2], mm1
- movq [rdi+rax ], mm1
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_uv_dcleft_mmx2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride,
-; )
-global sym(vp8_intra_pred_uv_dcleft_mmx2) PRIVATE
-sym(vp8_intra_pred_uv_dcleft_mmx2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- ;arg(2) not used
-
- ; from left
- mov rsi, arg(3) ;left;
- movsxd rax, dword ptr arg(4) ;left_stride;
- lea rdi, [rax*3]
- movzx ecx, byte [rsi]
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
- lea rsi, [rsi+rax*4]
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- lea edx, [ecx+edx+4]
-
- ; add up
- shr edx, 3
- movd mm1, edx
- pshufw mm1, mm1, 0x0
- packuswb mm1, mm1
-
- ; write out
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
- lea rax, [rcx*3]
-
- movq [rdi ], mm1
- movq [rdi+rcx ], mm1
- movq [rdi+rcx*2], mm1
- movq [rdi+rax ], mm1
- lea rdi, [rdi+rcx*4]
- movq [rdi ], mm1
- movq [rdi+rcx ], mm1
- movq [rdi+rcx*2], mm1
- movq [rdi+rax ], mm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_uv_dc128_mmx(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride,
-; )
-global sym(vp8_intra_pred_uv_dc128_mmx) PRIVATE
-sym(vp8_intra_pred_uv_dc128_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- ; end prolog
-
- ;arg(2), arg(3), arg(4) not used
-
- ; write out
- movq mm1, [GLOBAL(dc_128)]
- mov rax, arg(0) ;dst;
- movsxd rdx, dword ptr arg(1) ;dst_stride
- lea rcx, [rdx*3]
-
- movq [rax ], mm1
- movq [rax+rdx ], mm1
- movq [rax+rdx*2], mm1
- movq [rax+rcx ], mm1
- lea rax, [rax+rdx*4]
- movq [rax ], mm1
- movq [rax+rdx ], mm1
- movq [rax+rdx*2], mm1
- movq [rax+rcx ], mm1
-
- ; begin epilog
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_uv_tm_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride,
-; )
-%macro vp8_intra_pred_uv_tm 1
-global sym(vp8_intra_pred_uv_tm_%1) PRIVATE
-sym(vp8_intra_pred_uv_tm_%1):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ; read top row
- mov edx, 4
- mov rsi, arg(2) ;above
- movsxd rax, dword ptr arg(4) ;left_stride;
- pxor xmm0, xmm0
-%ifidn %1, ssse3
- movdqa xmm2, [GLOBAL(dc_1024)]
-%endif
- movq xmm1, [rsi]
- punpcklbw xmm1, xmm0
-
- ; set up left ptrs ans subtract topleft
- movd xmm3, [rsi-1]
- mov rsi, arg(3) ;left;
-%ifidn %1, sse2
- punpcklbw xmm3, xmm0
- pshuflw xmm3, xmm3, 0x0
- punpcklqdq xmm3, xmm3
-%else
- pshufb xmm3, xmm2
-%endif
- psubw xmm1, xmm3
-
- ; set up dest ptrs
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
-
-.vp8_intra_pred_uv_tm_%1_loop:
- movd xmm3, [rsi]
- movd xmm5, [rsi+rax]
-%ifidn %1, sse2
- punpcklbw xmm3, xmm0
- punpcklbw xmm5, xmm0
- pshuflw xmm3, xmm3, 0x0
- pshuflw xmm5, xmm5, 0x0
- punpcklqdq xmm3, xmm3
- punpcklqdq xmm5, xmm5
-%else
- pshufb xmm3, xmm2
- pshufb xmm5, xmm2
-%endif
- paddw xmm3, xmm1
- paddw xmm5, xmm1
- packuswb xmm3, xmm5
- movq [rdi ], xmm3
- movhps[rdi+rcx], xmm3
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rcx*2]
- dec edx
- jnz .vp8_intra_pred_uv_tm_%1_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-%endmacro
-
-vp8_intra_pred_uv_tm sse2
-vp8_intra_pred_uv_tm ssse3
-
-;void vp8_intra_pred_uv_ve_mmx(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride,
-; )
-global sym(vp8_intra_pred_uv_ve_mmx) PRIVATE
-sym(vp8_intra_pred_uv_ve_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- ; end prolog
-
- ; arg(3), arg(4) not used
-
- ; read from top
- mov rax, arg(2) ;src;
-
- movq mm1, [rax]
-
- ; write out
- mov rax, arg(0) ;dst;
- movsxd rdx, dword ptr arg(1) ;dst_stride
- lea rcx, [rdx*3]
-
- movq [rax ], mm1
- movq [rax+rdx ], mm1
- movq [rax+rdx*2], mm1
- movq [rax+rcx ], mm1
- lea rax, [rax+rdx*4]
- movq [rax ], mm1
- movq [rax+rdx ], mm1
- movq [rax+rdx*2], mm1
- movq [rax+rcx ], mm1
-
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_uv_ho_mmx2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride
-; )
-%macro vp8_intra_pred_uv_ho 1
-global sym(vp8_intra_pred_uv_ho_%1) PRIVATE
-sym(vp8_intra_pred_uv_ho_%1):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
-%ifidn %1, ssse3
-%ifndef GET_GOT_SAVE_ARG
- push rbx
-%endif
- GET_GOT rbx
-%endif
- ; end prolog
-
- ;arg(2) not used
-
- ; read from left and write out
-%ifidn %1, mmx2
- mov edx, 4
-%endif
- mov rsi, arg(3) ;left
- movsxd rax, dword ptr arg(4) ;left_stride;
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
-%ifidn %1, ssse3
- lea rdx, [rcx*3]
- movdqa xmm2, [GLOBAL(dc_00001111)]
- lea rbx, [rax*3]
-%endif
-
-%ifidn %1, mmx2
-.vp8_intra_pred_uv_ho_%1_loop:
- movd mm0, [rsi]
- movd mm1, [rsi+rax]
- punpcklbw mm0, mm0
- punpcklbw mm1, mm1
- pshufw mm0, mm0, 0x0
- pshufw mm1, mm1, 0x0
- movq [rdi ], mm0
- movq [rdi+rcx], mm1
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rcx*2]
- dec edx
- jnz .vp8_intra_pred_uv_ho_%1_loop
-%else
- movd xmm0, [rsi]
- movd xmm3, [rsi+rax]
- movd xmm1, [rsi+rax*2]
- movd xmm4, [rsi+rbx]
- punpcklbw xmm0, xmm3
- punpcklbw xmm1, xmm4
- pshufb xmm0, xmm2
- pshufb xmm1, xmm2
- movq [rdi ], xmm0
- movhps [rdi+rcx], xmm0
- movq [rdi+rcx*2], xmm1
- movhps [rdi+rdx], xmm1
- lea rsi, [rsi+rax*4]
- lea rdi, [rdi+rcx*4]
- movd xmm0, [rsi]
- movd xmm3, [rsi+rax]
- movd xmm1, [rsi+rax*2]
- movd xmm4, [rsi+rbx]
- punpcklbw xmm0, xmm3
- punpcklbw xmm1, xmm4
- pshufb xmm0, xmm2
- pshufb xmm1, xmm2
- movq [rdi ], xmm0
- movhps [rdi+rcx], xmm0
- movq [rdi+rcx*2], xmm1
- movhps [rdi+rdx], xmm1
-%endif
-
- ; begin epilog
-%ifidn %1, ssse3
- RESTORE_GOT
-%ifndef GET_GOT_SAVE_ARG
- pop rbx
-%endif
-%endif
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-%endmacro
-
-vp8_intra_pred_uv_ho mmx2
-vp8_intra_pred_uv_ho ssse3
-
-;void vp8_intra_pred_y_dc_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride
-; )
-global sym(vp8_intra_pred_y_dc_sse2) PRIVATE
-sym(vp8_intra_pred_y_dc_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- ; from top
- mov rdi, arg(2) ;above
- mov rsi, arg(3) ;left
- movsxd rax, dword ptr arg(4) ;left_stride;
-
- pxor xmm0, xmm0
- movdqa xmm1, [rdi]
- psadbw xmm1, xmm0
- movq xmm2, xmm1
- punpckhqdq xmm1, xmm1
- paddw xmm1, xmm2
-
- ; from left
- lea rdi, [rax*3]
-
- movzx ecx, byte [rsi]
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
- lea rsi, [rsi+rax*4]
-
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
- lea rsi, [rsi+rax*4]
-
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
- lea rsi, [rsi+rax*4]
-
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
-
- ; add up
- pextrw edx, xmm1, 0x0
- lea edx, [edx+ecx+16]
- sar edx, 5
- movd xmm1, edx
- ; FIXME use pshufb for ssse3 version
- pshuflw xmm1, xmm1, 0x0
- punpcklqdq xmm1, xmm1
- packuswb xmm1, xmm1
-
- ; write out
- mov rsi, 2
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
- lea rax, [rcx*3]
-
-.label
- movdqa [rdi ], xmm1
- movdqa [rdi+rcx ], xmm1
- movdqa [rdi+rcx*2], xmm1
- movdqa [rdi+rax ], xmm1
- lea rdi, [rdi+rcx*4]
- movdqa [rdi ], xmm1
- movdqa [rdi+rcx ], xmm1
- movdqa [rdi+rcx*2], xmm1
- movdqa [rdi+rax ], xmm1
- lea rdi, [rdi+rcx*4]
- dec rsi
- jnz .label
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_y_dctop_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride
-; )
-global sym(vp8_intra_pred_y_dctop_sse2) PRIVATE
-sym(vp8_intra_pred_y_dctop_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- GET_GOT rbx
- ; end prolog
-
- ;arg(3), arg(4) not used
-
- ; from top
- mov rcx, arg(2) ;above;
- pxor xmm0, xmm0
- movdqa xmm1, [rcx]
- psadbw xmm1, xmm0
- movdqa xmm2, xmm1
- punpckhqdq xmm1, xmm1
- paddw xmm1, xmm2
-
- ; add up
- paddw xmm1, [GLOBAL(dc_8)]
- psraw xmm1, 4
- ; FIXME use pshufb for ssse3 version
- pshuflw xmm1, xmm1, 0x0
- punpcklqdq xmm1, xmm1
- packuswb xmm1, xmm1
-
- ; write out
- mov rsi, 2
- mov rdx, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
- lea rax, [rcx*3]
-
-.label
- movdqa [rdx ], xmm1
- movdqa [rdx+rcx ], xmm1
- movdqa [rdx+rcx*2], xmm1
- movdqa [rdx+rax ], xmm1
- lea rdx, [rdx+rcx*4]
- movdqa [rdx ], xmm1
- movdqa [rdx+rcx ], xmm1
- movdqa [rdx+rcx*2], xmm1
- movdqa [rdx+rax ], xmm1
- lea rdx, [rdx+rcx*4]
- dec rsi
- jnz .label
-
- ; begin epilog
- RESTORE_GOT
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_y_dcleft_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride
-; )
-global sym(vp8_intra_pred_y_dcleft_sse2) PRIVATE
-sym(vp8_intra_pred_y_dcleft_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- ;arg(2) not used
-
- ; from left
- mov rsi, arg(3) ;left;
- movsxd rax, dword ptr arg(4) ;left_stride;
-
- lea rdi, [rax*3]
- movzx ecx, byte [rsi]
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
- lea rsi, [rsi+rax*4]
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
- lea rsi, [rsi+rax*4]
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- add ecx, edx
- lea rsi, [rsi+rax*4]
- movzx edx, byte [rsi]
- add ecx, edx
- movzx edx, byte [rsi+rax]
- add ecx, edx
- movzx edx, byte [rsi+rax*2]
- add ecx, edx
- movzx edx, byte [rsi+rdi]
- lea edx, [ecx+edx+8]
-
- ; add up
- shr edx, 4
- movd xmm1, edx
- ; FIXME use pshufb for ssse3 version
- pshuflw xmm1, xmm1, 0x0
- punpcklqdq xmm1, xmm1
- packuswb xmm1, xmm1
-
- ; write out
- mov rsi, 2
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
- lea rax, [rcx*3]
-
-.label
- movdqa [rdi ], xmm1
- movdqa [rdi+rcx ], xmm1
- movdqa [rdi+rcx*2], xmm1
- movdqa [rdi+rax ], xmm1
- lea rdi, [rdi+rcx*4]
- movdqa [rdi ], xmm1
- movdqa [rdi+rcx ], xmm1
- movdqa [rdi+rcx*2], xmm1
- movdqa [rdi+rax ], xmm1
- lea rdi, [rdi+rcx*4]
- dec rsi
- jnz .label
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_y_dc128_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride
-; )
-global sym(vp8_intra_pred_y_dc128_sse2) PRIVATE
-sym(vp8_intra_pred_y_dc128_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- GET_GOT rbx
- ; end prolog
-
- ;arg(2), arg(3), arg(4) not used
-
- ; write out
- mov rsi, 2
- movdqa xmm1, [GLOBAL(dc_128)]
- mov rax, arg(0) ;dst;
- movsxd rdx, dword ptr arg(1) ;dst_stride
- lea rcx, [rdx*3]
-
-.label
- movdqa [rax ], xmm1
- movdqa [rax+rdx ], xmm1
- movdqa [rax+rdx*2], xmm1
- movdqa [rax+rcx ], xmm1
- lea rax, [rax+rdx*4]
- movdqa [rax ], xmm1
- movdqa [rax+rdx ], xmm1
- movdqa [rax+rdx*2], xmm1
- movdqa [rax+rcx ], xmm1
- lea rax, [rax+rdx*4]
- dec rsi
- jnz .label
-
- ; begin epilog
- RESTORE_GOT
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_y_tm_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride
-; )
-%macro vp8_intra_pred_y_tm 1
-global sym(vp8_intra_pred_y_tm_%1) PRIVATE
-sym(vp8_intra_pred_y_tm_%1):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- push rsi
- push rdi
- GET_GOT rbx
- ; end prolog
-
- ; read top row
- mov edx, 8
- mov rsi, arg(2) ;above
- movsxd rax, dword ptr arg(4) ;left_stride;
- pxor xmm0, xmm0
-%ifidn %1, ssse3
- movdqa xmm3, [GLOBAL(dc_1024)]
-%endif
- movdqa xmm1, [rsi]
- movdqa xmm2, xmm1
- punpcklbw xmm1, xmm0
- punpckhbw xmm2, xmm0
-
- ; set up left ptrs ans subtract topleft
- movd xmm4, [rsi-1]
- mov rsi, arg(3) ;left
-%ifidn %1, sse2
- punpcklbw xmm4, xmm0
- pshuflw xmm4, xmm4, 0x0
- punpcklqdq xmm4, xmm4
-%else
- pshufb xmm4, xmm3
-%endif
- psubw xmm1, xmm4
- psubw xmm2, xmm4
-
- ; set up dest ptrs
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
-vp8_intra_pred_y_tm_%1_loop:
- movd xmm4, [rsi]
- movd xmm5, [rsi+rax]
-%ifidn %1, sse2
- punpcklbw xmm4, xmm0
- punpcklbw xmm5, xmm0
- pshuflw xmm4, xmm4, 0x0
- pshuflw xmm5, xmm5, 0x0
- punpcklqdq xmm4, xmm4
- punpcklqdq xmm5, xmm5
-%else
- pshufb xmm4, xmm3
- pshufb xmm5, xmm3
-%endif
- movdqa xmm6, xmm4
- movdqa xmm7, xmm5
- paddw xmm4, xmm1
- paddw xmm6, xmm2
- paddw xmm5, xmm1
- paddw xmm7, xmm2
- packuswb xmm4, xmm6
- packuswb xmm5, xmm7
- movdqa [rdi ], xmm4
- movdqa [rdi+rcx], xmm5
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rcx*2]
- dec edx
- jnz vp8_intra_pred_y_tm_%1_loop
-
- ; begin epilog
- RESTORE_GOT
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-%endmacro
-
-vp8_intra_pred_y_tm sse2
-vp8_intra_pred_y_tm ssse3
-
-;void vp8_intra_pred_y_ve_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride
-; )
-global sym(vp8_intra_pred_y_ve_sse2) PRIVATE
-sym(vp8_intra_pred_y_ve_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- ; end prolog
-
- ;arg(3), arg(4) not used
-
- mov rax, arg(2) ;above;
- mov rsi, 2
- movsxd rdx, dword ptr arg(1) ;dst_stride
-
- ; read from top
- movdqa xmm1, [rax]
-
- ; write out
- mov rax, arg(0) ;dst;
- lea rcx, [rdx*3]
-
-.label
- movdqa [rax ], xmm1
- movdqa [rax+rdx ], xmm1
- movdqa [rax+rdx*2], xmm1
- movdqa [rax+rcx ], xmm1
- lea rax, [rax+rdx*4]
- movdqa [rax ], xmm1
- movdqa [rax+rdx ], xmm1
- movdqa [rax+rdx*2], xmm1
- movdqa [rax+rcx ], xmm1
- lea rax, [rax+rdx*4]
- dec rsi
- jnz .label
-
- ; begin epilog
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_intra_pred_y_ho_sse2(
-; unsigned char *dst,
-; int dst_stride
-; unsigned char *above,
-; unsigned char *left,
-; int left_stride,
-; )
-global sym(vp8_intra_pred_y_ho_sse2) PRIVATE
-sym(vp8_intra_pred_y_ho_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- ;arg(2) not used
-
- ; read from left and write out
- mov edx, 8
- mov rsi, arg(3) ;left;
- movsxd rax, dword ptr arg(4) ;left_stride;
- mov rdi, arg(0) ;dst;
- movsxd rcx, dword ptr arg(1) ;dst_stride
-
-vp8_intra_pred_y_ho_sse2_loop:
- movd xmm0, [rsi]
- movd xmm1, [rsi+rax]
- ; FIXME use pshufb for ssse3 version
- punpcklbw xmm0, xmm0
- punpcklbw xmm1, xmm1
- pshuflw xmm0, xmm0, 0x0
- pshuflw xmm1, xmm1, 0x0
- punpcklqdq xmm0, xmm0
- punpcklqdq xmm1, xmm1
- movdqa [rdi ], xmm0
- movdqa [rdi+rcx], xmm1
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rcx*2]
- dec edx
- jnz vp8_intra_pred_y_ho_sse2_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-dc_128:
- times 16 db 128
-dc_4:
- times 4 dw 4
-align 16
-dc_8:
- times 8 dw 8
-align 16
-dc_1024:
- times 8 dw 0x400
-align 16
-dc_00001111:
- times 8 db 0
- times 8 db 1
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_wrapper_sse2.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_wrapper_sse2.c
deleted file mode 100644
index 65f4251..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/recon_wrapper_sse2.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/blockd.h"
-
-#define build_intra_predictors_mbuv_prototype(sym) \
- void sym(unsigned char *dst, int dst_stride, \
- const unsigned char *above, \
- const unsigned char *left, int left_stride)
-typedef build_intra_predictors_mbuv_prototype((*build_intra_predictors_mbuv_fn_t));
-
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc_mmx2);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dctop_mmx2);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dcleft_mmx2);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc128_mmx);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ho_mmx2);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ho_ssse3);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ve_mmx);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_sse2);
-extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_ssse3);
-
-static void vp8_build_intra_predictors_mbuv_x86(MACROBLOCKD *x,
- unsigned char * uabove_row,
- unsigned char * vabove_row,
- unsigned char *dst_u,
- unsigned char *dst_v,
- int dst_stride,
- unsigned char * uleft,
- unsigned char * vleft,
- int left_stride,
- build_intra_predictors_mbuv_fn_t tm_func,
- build_intra_predictors_mbuv_fn_t ho_func)
-{
- int mode = x->mode_info_context->mbmi.uv_mode;
- build_intra_predictors_mbuv_fn_t fn;
-
- switch (mode) {
- case V_PRED: fn = vp8_intra_pred_uv_ve_mmx; break;
- case H_PRED: fn = ho_func; break;
- case TM_PRED: fn = tm_func; break;
- case DC_PRED:
- if (x->up_available) {
- if (x->left_available) {
- fn = vp8_intra_pred_uv_dc_mmx2; break;
- } else {
- fn = vp8_intra_pred_uv_dctop_mmx2; break;
- }
- } else if (x->left_available) {
- fn = vp8_intra_pred_uv_dcleft_mmx2; break;
- } else {
- fn = vp8_intra_pred_uv_dc128_mmx; break;
- }
- break;
- default: return;
- }
-
- fn(dst_u, dst_stride, uabove_row, uleft, left_stride);
- fn(dst_v, dst_stride, vabove_row, vleft, left_stride);
-}
-
-void vp8_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *x,
- unsigned char * uabove_row,
- unsigned char * vabove_row,
- unsigned char * uleft,
- unsigned char * vleft,
- int left_stride,
- unsigned char * upred_ptr,
- unsigned char * vpred_ptr,
- int pred_stride)
-{
- vp8_build_intra_predictors_mbuv_x86(x,
- uabove_row, vabove_row,
- upred_ptr,
- vpred_ptr, pred_stride,
- uleft,
- vleft,
- left_stride,
- vp8_intra_pred_uv_tm_sse2,
- vp8_intra_pred_uv_ho_mmx2);
-}
-
-void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x,
- unsigned char * uabove_row,
- unsigned char * vabove_row,
- unsigned char * uleft,
- unsigned char * vleft,
- int left_stride,
- unsigned char * upred_ptr,
- unsigned char * vpred_ptr,
- int pred_stride)
-{
- vp8_build_intra_predictors_mbuv_x86(x,
- uabove_row, vabove_row,
- upred_ptr,
- vpred_ptr, pred_stride,
- uleft,
- vleft,
- left_stride,
- vp8_intra_pred_uv_tm_ssse3,
- vp8_intra_pred_uv_ho_ssse3);
-}
-
-#define build_intra_predictors_mby_prototype(sym) \
- void sym(unsigned char *dst, int dst_stride, \
- const unsigned char *above, \
- const unsigned char *left, int left_stride)
-typedef build_intra_predictors_mby_prototype((*build_intra_predictors_mby_fn_t));
-
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc_sse2);
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dctop_sse2);
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dcleft_sse2);
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc128_sse2);
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ho_sse2);
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ve_sse2);
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_sse2);
-extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_ssse3);
-
-static void vp8_build_intra_predictors_mby_x86(MACROBLOCKD *x,
- unsigned char * yabove_row,
- unsigned char *dst_y,
- int dst_stride,
- unsigned char * yleft,
- int left_stride,
- build_intra_predictors_mby_fn_t tm_func)
-{
- int mode = x->mode_info_context->mbmi.mode;
- build_intra_predictors_mbuv_fn_t fn;
-
- switch (mode) {
- case V_PRED: fn = vp8_intra_pred_y_ve_sse2; break;
- case H_PRED: fn = vp8_intra_pred_y_ho_sse2; break;
- case TM_PRED: fn = tm_func; break;
- case DC_PRED:
- if (x->up_available) {
- if (x->left_available) {
- fn = vp8_intra_pred_y_dc_sse2; break;
- } else {
- fn = vp8_intra_pred_y_dctop_sse2; break;
- }
- } else if (x->left_available) {
- fn = vp8_intra_pred_y_dcleft_sse2; break;
- } else {
- fn = vp8_intra_pred_y_dc128_sse2; break;
- }
- break;
- default: return;
- }
-
- fn(dst_y, dst_stride, yabove_row, yleft, left_stride);
- return;
-}
-
-void vp8_build_intra_predictors_mby_s_sse2(MACROBLOCKD *x,
- unsigned char * yabove_row,
- unsigned char * yleft,
- int left_stride,
- unsigned char * ypred_ptr,
- int y_stride)
-{
- vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr,
- y_stride, yleft, left_stride,
- vp8_intra_pred_y_tm_sse2);
-}
-
-void vp8_build_intra_predictors_mby_s_ssse3(MACROBLOCKD *x,
- unsigned char * yabove_row,
- unsigned char * yleft,
- int left_stride,
- unsigned char * ypred_ptr,
- int y_stride)
-{
- vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr,
- y_stride, yleft, left_stride,
- vp8_intra_pred_y_tm_ssse3);
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_mmx.asm
deleted file mode 100644
index 592112f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_mmx.asm
+++ /dev/null
@@ -1,427 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-global sym(vp8_sad16x16_mmx) PRIVATE
-global sym(vp8_sad8x16_mmx) PRIVATE
-global sym(vp8_sad8x8_mmx) PRIVATE
-global sym(vp8_sad4x4_mmx) PRIVATE
-global sym(vp8_sad16x8_mmx) PRIVATE
-
-;unsigned int vp8_sad16x16_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp8_sad16x16_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
-
- lea rcx, [rcx+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x16x16sad_mmx_loop:
-
- movq mm0, QWORD PTR [rsi]
- movq mm2, QWORD PTR [rsi+8]
-
- movq mm1, QWORD PTR [rdi]
- movq mm3, QWORD PTR [rdi+8]
-
- movq mm4, mm0
- movq mm5, mm2
-
- psubusb mm0, mm1
- psubusb mm1, mm4
-
- psubusb mm2, mm3
- psubusb mm3, mm5
-
- por mm0, mm1
- por mm2, mm3
-
- movq mm1, mm0
- movq mm3, mm2
-
- punpcklbw mm0, mm6
- punpcklbw mm2, mm6
-
- punpckhbw mm1, mm6
- punpckhbw mm3, mm6
-
- paddw mm0, mm2
- paddw mm1, mm3
-
-
- lea rsi, [rsi+rax]
- add rdi, rdx
-
- paddw mm7, mm0
- paddw mm7, mm1
-
- cmp rsi, rcx
- jne .x16x16sad_mmx_loop
-
-
- movq mm0, mm7
-
- punpcklwd mm0, mm6
- punpckhwd mm7, mm6
-
- paddw mm0, mm7
- movq mm7, mm0
-
-
- psrlq mm0, 32
- paddw mm7, mm0
-
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_sad8x16_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp8_sad8x16_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
-
- lea rcx, [rcx+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x8x16sad_mmx_loop:
-
- movq mm0, QWORD PTR [rsi]
- movq mm1, QWORD PTR [rdi]
-
- movq mm2, mm0
- psubusb mm0, mm1
-
- psubusb mm1, mm2
- por mm0, mm1
-
- movq mm2, mm0
- punpcklbw mm0, mm6
-
- punpckhbw mm2, mm6
- lea rsi, [rsi+rax]
-
- add rdi, rdx
- paddw mm7, mm0
-
- paddw mm7, mm2
- cmp rsi, rcx
-
- jne .x8x16sad_mmx_loop
-
- movq mm0, mm7
- punpcklwd mm0, mm6
-
- punpckhwd mm7, mm6
- paddw mm0, mm7
-
- movq mm7, mm0
- psrlq mm0, 32
-
- paddw mm7, mm0
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_sad8x8_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp8_sad8x8_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x8x8sad_mmx_loop:
-
- movq mm0, QWORD PTR [rsi]
- movq mm1, QWORD PTR [rdi]
-
- movq mm2, mm0
- psubusb mm0, mm1
-
- psubusb mm1, mm2
- por mm0, mm1
-
- movq mm2, mm0
- punpcklbw mm0, mm6
-
- punpckhbw mm2, mm6
- paddw mm0, mm2
-
- lea rsi, [rsi+rax]
- add rdi, rdx
-
- paddw mm7, mm0
- cmp rsi, rcx
-
- jne .x8x8sad_mmx_loop
-
- movq mm0, mm7
- punpcklwd mm0, mm6
-
- punpckhwd mm7, mm6
- paddw mm0, mm7
-
- movq mm7, mm0
- psrlq mm0, 32
-
- paddw mm7, mm0
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_sad4x4_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp8_sad4x4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- movd mm0, DWORD PTR [rsi]
- movd mm1, DWORD PTR [rdi]
-
- movd mm2, DWORD PTR [rsi+rax]
- movd mm3, DWORD PTR [rdi+rdx]
-
- punpcklbw mm0, mm2
- punpcklbw mm1, mm3
-
- movq mm2, mm0
- psubusb mm0, mm1
-
- psubusb mm1, mm2
- por mm0, mm1
-
- movq mm2, mm0
- pxor mm3, mm3
-
- punpcklbw mm0, mm3
- punpckhbw mm2, mm3
-
- paddw mm0, mm2
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- movd mm4, DWORD PTR [rsi]
- movd mm5, DWORD PTR [rdi]
-
- movd mm6, DWORD PTR [rsi+rax]
- movd mm7, DWORD PTR [rdi+rdx]
-
- punpcklbw mm4, mm6
- punpcklbw mm5, mm7
-
- movq mm6, mm4
- psubusb mm4, mm5
-
- psubusb mm5, mm6
- por mm4, mm5
-
- movq mm5, mm4
- punpcklbw mm4, mm3
-
- punpckhbw mm5, mm3
- paddw mm4, mm5
-
- paddw mm0, mm4
- movq mm1, mm0
-
- punpcklwd mm0, mm3
- punpckhwd mm1, mm3
-
- paddw mm0, mm1
- movq mm1, mm0
-
- psrlq mm0, 32
- paddw mm0, mm1
-
- movq rax, mm0
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_sad16x8_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp8_sad16x8_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x16x8sad_mmx_loop:
-
- movq mm0, [rsi]
- movq mm1, [rdi]
-
- movq mm2, [rsi+8]
- movq mm3, [rdi+8]
-
- movq mm4, mm0
- movq mm5, mm2
-
- psubusb mm0, mm1
- psubusb mm1, mm4
-
- psubusb mm2, mm3
- psubusb mm3, mm5
-
- por mm0, mm1
- por mm2, mm3
-
- movq mm1, mm0
- movq mm3, mm2
-
- punpcklbw mm0, mm6
- punpckhbw mm1, mm6
-
- punpcklbw mm2, mm6
- punpckhbw mm3, mm6
-
-
- paddw mm0, mm2
- paddw mm1, mm3
-
- paddw mm0, mm1
- lea rsi, [rsi+rax]
-
- add rdi, rdx
- paddw mm7, mm0
-
- cmp rsi, rcx
- jne .x16x8sad_mmx_loop
-
- movq mm0, mm7
- punpcklwd mm0, mm6
-
- punpckhwd mm7, mm6
- paddw mm0, mm7
-
- movq mm7, mm0
- psrlq mm0, 32
-
- paddw mm7, mm0
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse2.asm
deleted file mode 100644
index 8d86abc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse2.asm
+++ /dev/null
@@ -1,410 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;unsigned int vp8_sad16x16_wmt(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-global sym(vp8_sad16x16_wmt) PRIVATE
-sym(vp8_sad16x16_wmt):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- SAVE_XMM 6
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
-
- lea rcx, [rcx+rax*8]
- pxor xmm6, xmm6
-
-.x16x16sad_wmt_loop:
-
- movq xmm0, QWORD PTR [rsi]
- movq xmm2, QWORD PTR [rsi+8]
-
- movq xmm1, QWORD PTR [rdi]
- movq xmm3, QWORD PTR [rdi+8]
-
- movq xmm4, QWORD PTR [rsi+rax]
- movq xmm5, QWORD PTR [rdi+rdx]
-
-
- punpcklbw xmm0, xmm2
- punpcklbw xmm1, xmm3
-
- psadbw xmm0, xmm1
- movq xmm2, QWORD PTR [rsi+rax+8]
-
- movq xmm3, QWORD PTR [rdi+rdx+8]
- lea rsi, [rsi+rax*2]
-
- lea rdi, [rdi+rdx*2]
- punpcklbw xmm4, xmm2
-
- punpcklbw xmm5, xmm3
- psadbw xmm4, xmm5
-
- paddw xmm6, xmm0
- paddw xmm6, xmm4
-
- cmp rsi, rcx
- jne .x16x16sad_wmt_loop
-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movq rax, xmm0
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;unsigned int vp8_sad8x16_wmt(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int max_sad)
-global sym(vp8_sad8x16_wmt) PRIVATE
-sym(vp8_sad8x16_wmt):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rbx, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rbx*8]
-
- lea rcx, [rcx+rbx*8]
- pxor mm7, mm7
-
-.x8x16sad_wmt_loop:
-
- movq rax, mm7
- cmp eax, arg(4)
- ja .x8x16sad_wmt_early_exit
-
- movq mm0, QWORD PTR [rsi]
- movq mm1, QWORD PTR [rdi]
-
- movq mm2, QWORD PTR [rsi+rbx]
- movq mm3, QWORD PTR [rdi+rdx]
-
- psadbw mm0, mm1
- psadbw mm2, mm3
-
- lea rsi, [rsi+rbx*2]
- lea rdi, [rdi+rdx*2]
-
- paddw mm7, mm0
- paddw mm7, mm2
-
- cmp rsi, rcx
- jne .x8x16sad_wmt_loop
-
- movq rax, mm7
-
-.x8x16sad_wmt_early_exit:
-
- ; begin epilog
- pop rdi
- pop rsi
- pop rbx
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_sad8x8_wmt(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-global sym(vp8_sad8x8_wmt) PRIVATE
-sym(vp8_sad8x8_wmt):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rbx, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rbx*8]
- pxor mm7, mm7
-
-.x8x8sad_wmt_loop:
-
- movq rax, mm7
- cmp eax, arg(4)
- ja .x8x8sad_wmt_early_exit
-
- movq mm0, QWORD PTR [rsi]
- movq mm1, QWORD PTR [rdi]
-
- psadbw mm0, mm1
- lea rsi, [rsi+rbx]
-
- add rdi, rdx
- paddw mm7, mm0
-
- cmp rsi, rcx
- jne .x8x8sad_wmt_loop
-
- movq rax, mm7
-.x8x8sad_wmt_early_exit:
-
- ; begin epilog
- pop rdi
- pop rsi
- pop rbx
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;unsigned int vp8_sad4x4_wmt(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-global sym(vp8_sad4x4_wmt) PRIVATE
-sym(vp8_sad4x4_wmt):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- movd mm0, DWORD PTR [rsi]
- movd mm1, DWORD PTR [rdi]
-
- movd mm2, DWORD PTR [rsi+rax]
- movd mm3, DWORD PTR [rdi+rdx]
-
- punpcklbw mm0, mm2
- punpcklbw mm1, mm3
-
- psadbw mm0, mm1
- lea rsi, [rsi+rax*2]
-
- lea rdi, [rdi+rdx*2]
- movd mm4, DWORD PTR [rsi]
-
- movd mm5, DWORD PTR [rdi]
- movd mm6, DWORD PTR [rsi+rax]
-
- movd mm7, DWORD PTR [rdi+rdx]
- punpcklbw mm4, mm6
-
- punpcklbw mm5, mm7
- psadbw mm4, mm5
-
- paddw mm0, mm4
- movq rax, mm0
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_sad16x8_wmt(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-global sym(vp8_sad16x8_wmt) PRIVATE
-sym(vp8_sad16x8_wmt):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rbx
- push rsi
- push rdi
- ; end prolog
-
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rbx, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rbx*8]
- pxor mm7, mm7
-
-.x16x8sad_wmt_loop:
-
- movq rax, mm7
- cmp eax, arg(4)
- ja .x16x8sad_wmt_early_exit
-
- movq mm0, QWORD PTR [rsi]
- movq mm2, QWORD PTR [rsi+8]
-
- movq mm1, QWORD PTR [rdi]
- movq mm3, QWORD PTR [rdi+8]
-
- movq mm4, QWORD PTR [rsi+rbx]
- movq mm5, QWORD PTR [rdi+rdx]
-
- psadbw mm0, mm1
- psadbw mm2, mm3
-
- movq mm1, QWORD PTR [rsi+rbx+8]
- movq mm3, QWORD PTR [rdi+rdx+8]
-
- psadbw mm4, mm5
- psadbw mm1, mm3
-
- lea rsi, [rsi+rbx*2]
- lea rdi, [rdi+rdx*2]
-
- paddw mm0, mm2
- paddw mm4, mm1
-
- paddw mm7, mm0
- paddw mm7, mm4
-
- cmp rsi, rcx
- jne .x16x8sad_wmt_loop
-
- movq rax, mm7
-
-.x16x8sad_wmt_early_exit:
-
- ; begin epilog
- pop rdi
- pop rsi
- pop rbx
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_copy32xn_sse2(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *dst_ptr,
-; int dst_stride,
-; int height);
-global sym(vp8_copy32xn_sse2) PRIVATE
-sym(vp8_copy32xn_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;dst_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;dst_stride
- movsxd rcx, dword ptr arg(4) ;height
-
-.block_copy_sse2_loopx4:
- movdqu xmm0, XMMWORD PTR [rsi]
- movdqu xmm1, XMMWORD PTR [rsi + 16]
- movdqu xmm2, XMMWORD PTR [rsi + rax]
- movdqu xmm3, XMMWORD PTR [rsi + rax + 16]
-
- lea rsi, [rsi+rax*2]
-
- movdqu xmm4, XMMWORD PTR [rsi]
- movdqu xmm5, XMMWORD PTR [rsi + 16]
- movdqu xmm6, XMMWORD PTR [rsi + rax]
- movdqu xmm7, XMMWORD PTR [rsi + rax + 16]
-
- lea rsi, [rsi+rax*2]
-
- movdqa XMMWORD PTR [rdi], xmm0
- movdqa XMMWORD PTR [rdi + 16], xmm1
- movdqa XMMWORD PTR [rdi + rdx], xmm2
- movdqa XMMWORD PTR [rdi + rdx + 16], xmm3
-
- lea rdi, [rdi+rdx*2]
-
- movdqa XMMWORD PTR [rdi], xmm4
- movdqa XMMWORD PTR [rdi + 16], xmm5
- movdqa XMMWORD PTR [rdi + rdx], xmm6
- movdqa XMMWORD PTR [rdi + rdx + 16], xmm7
-
- lea rdi, [rdi+rdx*2]
-
- sub rcx, 4
- cmp rcx, 4
- jge .block_copy_sse2_loopx4
-
- cmp rcx, 0
- je .copy_is_done
-
-.block_copy_sse2_loop:
- movdqu xmm0, XMMWORD PTR [rsi]
- movdqu xmm1, XMMWORD PTR [rsi + 16]
- lea rsi, [rsi+rax]
-
- movdqa XMMWORD PTR [rdi], xmm0
- movdqa XMMWORD PTR [rdi + 16], xmm1
- lea rdi, [rdi+rdx]
-
- sub rcx, 1
- jne .block_copy_sse2_loop
-
-.copy_is_done:
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse3.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse3.asm
deleted file mode 100644
index 69c8d37..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse3.asm
+++ /dev/null
@@ -1,960 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro STACK_FRAME_CREATE_X3 0
-%if ABI_IS_32BIT
- %define src_ptr rsi
- %define src_stride rax
- %define ref_ptr rdi
- %define ref_stride rdx
- %define end_ptr rcx
- %define ret_var rbx
- %define result_ptr arg(4)
- %define max_sad arg(4)
- %define height dword ptr arg(4)
- push rbp
- mov rbp, rsp
- push rsi
- push rdi
- push rbx
-
- mov rsi, arg(0) ; src_ptr
- mov rdi, arg(2) ; ref_ptr
-
- movsxd rax, dword ptr arg(1) ; src_stride
- movsxd rdx, dword ptr arg(3) ; ref_stride
-%else
- %if LIBVPX_YASM_WIN64
- SAVE_XMM 7, u
- %define src_ptr rcx
- %define src_stride rdx
- %define ref_ptr r8
- %define ref_stride r9
- %define end_ptr r10
- %define ret_var r11
- %define result_ptr [rsp+xmm_stack_space+8+4*8]
- %define max_sad [rsp+xmm_stack_space+8+4*8]
- %define height dword ptr [rsp+xmm_stack_space+8+4*8]
- %else
- %define src_ptr rdi
- %define src_stride rsi
- %define ref_ptr rdx
- %define ref_stride rcx
- %define end_ptr r9
- %define ret_var r10
- %define result_ptr r8
- %define max_sad r8
- %define height r8
- %endif
-%endif
-
-%endmacro
-
-%macro STACK_FRAME_DESTROY_X3 0
- %define src_ptr
- %define src_stride
- %define ref_ptr
- %define ref_stride
- %define end_ptr
- %define ret_var
- %define result_ptr
- %define max_sad
- %define height
-
-%if ABI_IS_32BIT
- pop rbx
- pop rdi
- pop rsi
- pop rbp
-%else
- %if LIBVPX_YASM_WIN64
- RESTORE_XMM
- %endif
-%endif
- ret
-%endmacro
-
-%macro STACK_FRAME_CREATE_X4 0
-%if ABI_IS_32BIT
- %define src_ptr rsi
- %define src_stride rax
- %define r0_ptr rcx
- %define r1_ptr rdx
- %define r2_ptr rbx
- %define r3_ptr rdi
- %define ref_stride rbp
- %define result_ptr arg(4)
- push rbp
- mov rbp, rsp
- push rsi
- push rdi
- push rbx
-
- push rbp
- mov rdi, arg(2) ; ref_ptr_base
-
- LOAD_X4_ADDRESSES rdi, rcx, rdx, rax, rdi
-
- mov rsi, arg(0) ; src_ptr
-
- movsxd rbx, dword ptr arg(1) ; src_stride
- movsxd rbp, dword ptr arg(3) ; ref_stride
-
- xchg rbx, rax
-%else
- %if LIBVPX_YASM_WIN64
- SAVE_XMM 7, u
- %define src_ptr rcx
- %define src_stride rdx
- %define r0_ptr rsi
- %define r1_ptr r10
- %define r2_ptr r11
- %define r3_ptr r8
- %define ref_stride r9
- %define result_ptr [rsp+xmm_stack_space+16+4*8]
- push rsi
-
- LOAD_X4_ADDRESSES r8, r0_ptr, r1_ptr, r2_ptr, r3_ptr
- %else
- %define src_ptr rdi
- %define src_stride rsi
- %define r0_ptr r9
- %define r1_ptr r10
- %define r2_ptr r11
- %define r3_ptr rdx
- %define ref_stride rcx
- %define result_ptr r8
-
- LOAD_X4_ADDRESSES rdx, r0_ptr, r1_ptr, r2_ptr, r3_ptr
-
- %endif
-%endif
-%endmacro
-
-%macro STACK_FRAME_DESTROY_X4 0
- %define src_ptr
- %define src_stride
- %define r0_ptr
- %define r1_ptr
- %define r2_ptr
- %define r3_ptr
- %define ref_stride
- %define result_ptr
-
-%if ABI_IS_32BIT
- pop rbx
- pop rdi
- pop rsi
- pop rbp
-%else
- %if LIBVPX_YASM_WIN64
- pop rsi
- RESTORE_XMM
- %endif
-%endif
- ret
-%endmacro
-
-%macro PROCESS_16X2X3 5
-%if %1==0
- movdqa xmm0, XMMWORD PTR [%2]
- lddqu xmm5, XMMWORD PTR [%3]
- lddqu xmm6, XMMWORD PTR [%3+1]
- lddqu xmm7, XMMWORD PTR [%3+2]
-
- psadbw xmm5, xmm0
- psadbw xmm6, xmm0
- psadbw xmm7, xmm0
-%else
- movdqa xmm0, XMMWORD PTR [%2]
- lddqu xmm1, XMMWORD PTR [%3]
- lddqu xmm2, XMMWORD PTR [%3+1]
- lddqu xmm3, XMMWORD PTR [%3+2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endif
- movdqa xmm0, XMMWORD PTR [%2+%4]
- lddqu xmm1, XMMWORD PTR [%3+%5]
- lddqu xmm2, XMMWORD PTR [%3+%5+1]
- lddqu xmm3, XMMWORD PTR [%3+%5+2]
-
-%if %1==0 || %1==1
- lea %2, [%2+%4*2]
- lea %3, [%3+%5*2]
-%endif
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endmacro
-
-%macro PROCESS_8X2X3 5
-%if %1==0
- movq mm0, QWORD PTR [%2]
- movq mm5, QWORD PTR [%3]
- movq mm6, QWORD PTR [%3+1]
- movq mm7, QWORD PTR [%3+2]
-
- psadbw mm5, mm0
- psadbw mm6, mm0
- psadbw mm7, mm0
-%else
- movq mm0, QWORD PTR [%2]
- movq mm1, QWORD PTR [%3]
- movq mm2, QWORD PTR [%3+1]
- movq mm3, QWORD PTR [%3+2]
-
- psadbw mm1, mm0
- psadbw mm2, mm0
- psadbw mm3, mm0
-
- paddw mm5, mm1
- paddw mm6, mm2
- paddw mm7, mm3
-%endif
- movq mm0, QWORD PTR [%2+%4]
- movq mm1, QWORD PTR [%3+%5]
- movq mm2, QWORD PTR [%3+%5+1]
- movq mm3, QWORD PTR [%3+%5+2]
-
-%if %1==0 || %1==1
- lea %2, [%2+%4*2]
- lea %3, [%3+%5*2]
-%endif
-
- psadbw mm1, mm0
- psadbw mm2, mm0
- psadbw mm3, mm0
-
- paddw mm5, mm1
- paddw mm6, mm2
- paddw mm7, mm3
-%endmacro
-
-%macro LOAD_X4_ADDRESSES 5
- mov %2, [%1+REG_SZ_BYTES*0]
- mov %3, [%1+REG_SZ_BYTES*1]
-
- mov %4, [%1+REG_SZ_BYTES*2]
- mov %5, [%1+REG_SZ_BYTES*3]
-%endmacro
-
-%macro PROCESS_16X2X4 8
-%if %1==0
- movdqa xmm0, XMMWORD PTR [%2]
- lddqu xmm4, XMMWORD PTR [%3]
- lddqu xmm5, XMMWORD PTR [%4]
- lddqu xmm6, XMMWORD PTR [%5]
- lddqu xmm7, XMMWORD PTR [%6]
-
- psadbw xmm4, xmm0
- psadbw xmm5, xmm0
- psadbw xmm6, xmm0
- psadbw xmm7, xmm0
-%else
- movdqa xmm0, XMMWORD PTR [%2]
- lddqu xmm1, XMMWORD PTR [%3]
- lddqu xmm2, XMMWORD PTR [%4]
- lddqu xmm3, XMMWORD PTR [%5]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm4, xmm1
- lddqu xmm1, XMMWORD PTR [%6]
- paddw xmm5, xmm2
- paddw xmm6, xmm3
-
- psadbw xmm1, xmm0
- paddw xmm7, xmm1
-%endif
- movdqa xmm0, XMMWORD PTR [%2+%7]
- lddqu xmm1, XMMWORD PTR [%3+%8]
- lddqu xmm2, XMMWORD PTR [%4+%8]
- lddqu xmm3, XMMWORD PTR [%5+%8]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm4, xmm1
- lddqu xmm1, XMMWORD PTR [%6+%8]
- paddw xmm5, xmm2
- paddw xmm6, xmm3
-
-%if %1==0 || %1==1
- lea %2, [%2+%7*2]
- lea %3, [%3+%8*2]
-
- lea %4, [%4+%8*2]
- lea %5, [%5+%8*2]
-
- lea %6, [%6+%8*2]
-%endif
- psadbw xmm1, xmm0
- paddw xmm7, xmm1
-
-%endmacro
-
-%macro PROCESS_8X2X4 8
-%if %1==0
- movq mm0, QWORD PTR [%2]
- movq mm4, QWORD PTR [%3]
- movq mm5, QWORD PTR [%4]
- movq mm6, QWORD PTR [%5]
- movq mm7, QWORD PTR [%6]
-
- psadbw mm4, mm0
- psadbw mm5, mm0
- psadbw mm6, mm0
- psadbw mm7, mm0
-%else
- movq mm0, QWORD PTR [%2]
- movq mm1, QWORD PTR [%3]
- movq mm2, QWORD PTR [%4]
- movq mm3, QWORD PTR [%5]
-
- psadbw mm1, mm0
- psadbw mm2, mm0
- psadbw mm3, mm0
-
- paddw mm4, mm1
- movq mm1, QWORD PTR [%6]
- paddw mm5, mm2
- paddw mm6, mm3
-
- psadbw mm1, mm0
- paddw mm7, mm1
-%endif
- movq mm0, QWORD PTR [%2+%7]
- movq mm1, QWORD PTR [%3+%8]
- movq mm2, QWORD PTR [%4+%8]
- movq mm3, QWORD PTR [%5+%8]
-
- psadbw mm1, mm0
- psadbw mm2, mm0
- psadbw mm3, mm0
-
- paddw mm4, mm1
- movq mm1, QWORD PTR [%6+%8]
- paddw mm5, mm2
- paddw mm6, mm3
-
-%if %1==0 || %1==1
- lea %2, [%2+%7*2]
- lea %3, [%3+%8*2]
-
- lea %4, [%4+%8*2]
- lea %5, [%5+%8*2]
-
- lea %6, [%6+%8*2]
-%endif
- psadbw mm1, mm0
- paddw mm7, mm1
-
-%endmacro
-
-;void int vp8_sad16x16x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad16x16x3_sse3) PRIVATE
-sym(vp8_sad16x16x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_16X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rcx], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rcx+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rcx+8], xmm0
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp8_sad16x8x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad16x8x3_sse3) PRIVATE
-sym(vp8_sad16x8x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_16X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rcx], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rcx+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rcx+8], xmm0
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp8_sad8x16x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad8x16x3_sse3) PRIVATE
-sym(vp8_sad8x16x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_8X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- punpckldq mm5, mm6
-
- movq [rcx], mm5
- movd [rcx+8], mm7
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp8_sad8x8x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad8x8x3_sse3) PRIVATE
-sym(vp8_sad8x8x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_8X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- punpckldq mm5, mm6
-
- movq [rcx], mm5
- movd [rcx+8], mm7
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp8_sad4x4x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad4x4x3_sse3) PRIVATE
-sym(vp8_sad4x4x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- movd mm0, DWORD PTR [src_ptr]
- movd mm1, DWORD PTR [ref_ptr]
-
- movd mm2, DWORD PTR [src_ptr+src_stride]
- movd mm3, DWORD PTR [ref_ptr+ref_stride]
-
- punpcklbw mm0, mm2
- punpcklbw mm1, mm3
-
- movd mm4, DWORD PTR [ref_ptr+1]
- movd mm5, DWORD PTR [ref_ptr+2]
-
- movd mm2, DWORD PTR [ref_ptr+ref_stride+1]
- movd mm3, DWORD PTR [ref_ptr+ref_stride+2]
-
- psadbw mm1, mm0
-
- punpcklbw mm4, mm2
- punpcklbw mm5, mm3
-
- psadbw mm4, mm0
- psadbw mm5, mm0
-
- lea src_ptr, [src_ptr+src_stride*2]
- lea ref_ptr, [ref_ptr+ref_stride*2]
-
- movd mm0, DWORD PTR [src_ptr]
- movd mm2, DWORD PTR [ref_ptr]
-
- movd mm3, DWORD PTR [src_ptr+src_stride]
- movd mm6, DWORD PTR [ref_ptr+ref_stride]
-
- punpcklbw mm0, mm3
- punpcklbw mm2, mm6
-
- movd mm3, DWORD PTR [ref_ptr+1]
- movd mm7, DWORD PTR [ref_ptr+2]
-
- psadbw mm2, mm0
-
- paddw mm1, mm2
-
- movd mm2, DWORD PTR [ref_ptr+ref_stride+1]
- movd mm6, DWORD PTR [ref_ptr+ref_stride+2]
-
- punpcklbw mm3, mm2
- punpcklbw mm7, mm6
-
- psadbw mm3, mm0
- psadbw mm7, mm0
-
- paddw mm3, mm4
- paddw mm7, mm5
-
- mov rcx, result_ptr
-
- punpckldq mm1, mm3
-
- movq [rcx], mm1
- movd [rcx+8], mm7
-
- STACK_FRAME_DESTROY_X3
-
-;unsigned int vp8_sad16x16_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int max_sad)
-;%define lddqu movdqu
-global sym(vp8_sad16x16_sse3) PRIVATE
-sym(vp8_sad16x16_sse3):
-
- STACK_FRAME_CREATE_X3
-
- mov end_ptr, 4
- pxor xmm7, xmm7
-
-.vp8_sad16x16_sse3_loop:
- movdqa xmm0, XMMWORD PTR [src_ptr]
- movdqu xmm1, XMMWORD PTR [ref_ptr]
- movdqa xmm2, XMMWORD PTR [src_ptr+src_stride]
- movdqu xmm3, XMMWORD PTR [ref_ptr+ref_stride]
-
- lea src_ptr, [src_ptr+src_stride*2]
- lea ref_ptr, [ref_ptr+ref_stride*2]
-
- movdqa xmm4, XMMWORD PTR [src_ptr]
- movdqu xmm5, XMMWORD PTR [ref_ptr]
- movdqa xmm6, XMMWORD PTR [src_ptr+src_stride]
-
- psadbw xmm0, xmm1
-
- movdqu xmm1, XMMWORD PTR [ref_ptr+ref_stride]
-
- psadbw xmm2, xmm3
- psadbw xmm4, xmm5
- psadbw xmm6, xmm1
-
- lea src_ptr, [src_ptr+src_stride*2]
- lea ref_ptr, [ref_ptr+ref_stride*2]
-
- paddw xmm7, xmm0
- paddw xmm7, xmm2
- paddw xmm7, xmm4
- paddw xmm7, xmm6
-
- sub end_ptr, 1
- jne .vp8_sad16x16_sse3_loop
-
- movq xmm0, xmm7
- psrldq xmm7, 8
- paddw xmm0, xmm7
- movq rax, xmm0
-
- STACK_FRAME_DESTROY_X3
-
-;void vp8_copy32xn_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *dst_ptr,
-; int dst_stride,
-; int height);
-global sym(vp8_copy32xn_sse3) PRIVATE
-sym(vp8_copy32xn_sse3):
-
- STACK_FRAME_CREATE_X3
-
-.block_copy_sse3_loopx4:
- lea end_ptr, [src_ptr+src_stride*2]
-
- movdqu xmm0, XMMWORD PTR [src_ptr]
- movdqu xmm1, XMMWORD PTR [src_ptr + 16]
- movdqu xmm2, XMMWORD PTR [src_ptr + src_stride]
- movdqu xmm3, XMMWORD PTR [src_ptr + src_stride + 16]
- movdqu xmm4, XMMWORD PTR [end_ptr]
- movdqu xmm5, XMMWORD PTR [end_ptr + 16]
- movdqu xmm6, XMMWORD PTR [end_ptr + src_stride]
- movdqu xmm7, XMMWORD PTR [end_ptr + src_stride + 16]
-
- lea src_ptr, [src_ptr+src_stride*4]
-
- lea end_ptr, [ref_ptr+ref_stride*2]
-
- movdqa XMMWORD PTR [ref_ptr], xmm0
- movdqa XMMWORD PTR [ref_ptr + 16], xmm1
- movdqa XMMWORD PTR [ref_ptr + ref_stride], xmm2
- movdqa XMMWORD PTR [ref_ptr + ref_stride + 16], xmm3
- movdqa XMMWORD PTR [end_ptr], xmm4
- movdqa XMMWORD PTR [end_ptr + 16], xmm5
- movdqa XMMWORD PTR [end_ptr + ref_stride], xmm6
- movdqa XMMWORD PTR [end_ptr + ref_stride + 16], xmm7
-
- lea ref_ptr, [ref_ptr+ref_stride*4]
-
- sub height, 4
- cmp height, 4
- jge .block_copy_sse3_loopx4
-
- ;Check to see if there is more rows need to be copied.
- cmp height, 0
- je .copy_is_done
-
-.block_copy_sse3_loop:
- movdqu xmm0, XMMWORD PTR [src_ptr]
- movdqu xmm1, XMMWORD PTR [src_ptr + 16]
- lea src_ptr, [src_ptr+src_stride]
-
- movdqa XMMWORD PTR [ref_ptr], xmm0
- movdqa XMMWORD PTR [ref_ptr + 16], xmm1
- lea ref_ptr, [ref_ptr+ref_stride]
-
- sub height, 1
- jne .block_copy_sse3_loop
-
-.copy_is_done:
- STACK_FRAME_DESTROY_X3
-
-;void vp8_sad16x16x4d_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr_base,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad16x16x4d_sse3) PRIVATE
-sym(vp8_sad16x16x4d_sse3):
-
- STACK_FRAME_CREATE_X4
-
- PROCESS_16X2X4 0, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 2, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
-
-%if ABI_IS_32BIT
- pop rbp
-%endif
- mov rcx, result_ptr
-
- movq xmm0, xmm4
- psrldq xmm4, 8
-
- paddw xmm0, xmm4
- movd [rcx], xmm0
-;-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rcx+4], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rcx+8], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rcx+12], xmm0
-
- STACK_FRAME_DESTROY_X4
-
-;void vp8_sad16x8x4d_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr_base,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad16x8x4d_sse3) PRIVATE
-sym(vp8_sad16x8x4d_sse3):
-
- STACK_FRAME_CREATE_X4
-
- PROCESS_16X2X4 0, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_16X2X4 2, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
-
-%if ABI_IS_32BIT
- pop rbp
-%endif
- mov rcx, result_ptr
-
- movq xmm0, xmm4
- psrldq xmm4, 8
-
- paddw xmm0, xmm4
- movd [rcx], xmm0
-;-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rcx+4], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rcx+8], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rcx+12], xmm0
-
- STACK_FRAME_DESTROY_X4
-
-;void int vp8_sad8x16x4d_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad8x16x4d_sse3) PRIVATE
-sym(vp8_sad8x16x4d_sse3):
-
- STACK_FRAME_CREATE_X4
-
- PROCESS_8X2X4 0, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 2, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
-
-%if ABI_IS_32BIT
- pop rbp
-%endif
- mov rcx, result_ptr
-
- punpckldq mm4, mm5
- punpckldq mm6, mm7
-
- movq [rcx], mm4
- movq [rcx+8], mm6
-
- STACK_FRAME_DESTROY_X4
-
-;void int vp8_sad8x8x4d_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad8x8x4d_sse3) PRIVATE
-sym(vp8_sad8x8x4d_sse3):
-
- STACK_FRAME_CREATE_X4
-
- PROCESS_8X2X4 0, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 1, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
- PROCESS_8X2X4 2, src_ptr, r0_ptr, r1_ptr, r2_ptr, r3_ptr, src_stride, ref_stride
-
-%if ABI_IS_32BIT
- pop rbp
-%endif
- mov rcx, result_ptr
-
- punpckldq mm4, mm5
- punpckldq mm6, mm7
-
- movq [rcx], mm4
- movq [rcx+8], mm6
-
- STACK_FRAME_DESTROY_X4
-
-;void int vp8_sad4x4x4d_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad4x4x4d_sse3) PRIVATE
-sym(vp8_sad4x4x4d_sse3):
-
- STACK_FRAME_CREATE_X4
-
- movd mm0, DWORD PTR [src_ptr]
- movd mm1, DWORD PTR [r0_ptr]
-
- movd mm2, DWORD PTR [src_ptr+src_stride]
- movd mm3, DWORD PTR [r0_ptr+ref_stride]
-
- punpcklbw mm0, mm2
- punpcklbw mm1, mm3
-
- movd mm4, DWORD PTR [r1_ptr]
- movd mm5, DWORD PTR [r2_ptr]
-
- movd mm6, DWORD PTR [r3_ptr]
- movd mm2, DWORD PTR [r1_ptr+ref_stride]
-
- movd mm3, DWORD PTR [r2_ptr+ref_stride]
- movd mm7, DWORD PTR [r3_ptr+ref_stride]
-
- psadbw mm1, mm0
-
- punpcklbw mm4, mm2
- punpcklbw mm5, mm3
-
- punpcklbw mm6, mm7
- psadbw mm4, mm0
-
- psadbw mm5, mm0
- psadbw mm6, mm0
-
-
-
- lea src_ptr, [src_ptr+src_stride*2]
- lea r0_ptr, [r0_ptr+ref_stride*2]
-
- lea r1_ptr, [r1_ptr+ref_stride*2]
- lea r2_ptr, [r2_ptr+ref_stride*2]
-
- lea r3_ptr, [r3_ptr+ref_stride*2]
-
- movd mm0, DWORD PTR [src_ptr]
- movd mm2, DWORD PTR [r0_ptr]
-
- movd mm3, DWORD PTR [src_ptr+src_stride]
- movd mm7, DWORD PTR [r0_ptr+ref_stride]
-
- punpcklbw mm0, mm3
- punpcklbw mm2, mm7
-
- movd mm3, DWORD PTR [r1_ptr]
- movd mm7, DWORD PTR [r2_ptr]
-
- psadbw mm2, mm0
-%if ABI_IS_32BIT
- mov rax, rbp
-
- pop rbp
-%define ref_stride rax
-%endif
- mov rsi, result_ptr
-
- paddw mm1, mm2
- movd [rsi], mm1
-
- movd mm2, DWORD PTR [r1_ptr+ref_stride]
- movd mm1, DWORD PTR [r2_ptr+ref_stride]
-
- punpcklbw mm3, mm2
- punpcklbw mm7, mm1
-
- psadbw mm3, mm0
- psadbw mm7, mm0
-
- movd mm2, DWORD PTR [r3_ptr]
- movd mm1, DWORD PTR [r3_ptr+ref_stride]
-
- paddw mm3, mm4
- paddw mm7, mm5
-
- movd [rsi+4], mm3
- punpcklbw mm2, mm1
-
- movd [rsi+8], mm7
- psadbw mm2, mm0
-
- paddw mm2, mm6
- movd [rsi+12], mm2
-
-
- STACK_FRAME_DESTROY_X4
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse4.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse4.asm
deleted file mode 100644
index f7fccd7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_sse4.asm
+++ /dev/null
@@ -1,353 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro PROCESS_16X2X8 1
-%if %1
- movdqa xmm0, XMMWORD PTR [rsi]
- movq xmm1, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- movq xmm2, MMWORD PTR [rdi+16]
- punpcklqdq xmm1, xmm3
- punpcklqdq xmm3, xmm2
-
- movdqa xmm2, xmm1
- mpsadbw xmm1, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
-
- psrldq xmm0, 8
-
- movdqa xmm4, xmm3
- mpsadbw xmm3, xmm0, 0x0
- mpsadbw xmm4, xmm0, 0x5
-
- paddw xmm1, xmm2
- paddw xmm1, xmm3
- paddw xmm1, xmm4
-%else
- movdqa xmm0, XMMWORD PTR [rsi]
- movq xmm5, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- movq xmm2, MMWORD PTR [rdi+16]
- punpcklqdq xmm5, xmm3
- punpcklqdq xmm3, xmm2
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
-
- psrldq xmm0, 8
-
- movdqa xmm4, xmm3
- mpsadbw xmm3, xmm0, 0x0
- mpsadbw xmm4, xmm0, 0x5
-
- paddw xmm5, xmm2
- paddw xmm5, xmm3
- paddw xmm5, xmm4
-
- paddw xmm1, xmm5
-%endif
- movdqa xmm0, XMMWORD PTR [rsi + rax]
- movq xmm5, MMWORD PTR [rdi+ rdx]
- movq xmm3, MMWORD PTR [rdi+ rdx+8]
- movq xmm2, MMWORD PTR [rdi+ rdx+16]
- punpcklqdq xmm5, xmm3
- punpcklqdq xmm3, xmm2
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
-
- psrldq xmm0, 8
- movdqa xmm4, xmm3
- mpsadbw xmm3, xmm0, 0x0
- mpsadbw xmm4, xmm0, 0x5
-
- paddw xmm5, xmm2
- paddw xmm5, xmm3
- paddw xmm5, xmm4
-
- paddw xmm1, xmm5
-%endmacro
-
-%macro PROCESS_8X2X8 1
-%if %1
- movq xmm0, MMWORD PTR [rsi]
- movq xmm1, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm1, xmm3
-
- movdqa xmm2, xmm1
- mpsadbw xmm1, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
- paddw xmm1, xmm2
-%else
- movq xmm0, MMWORD PTR [rsi]
- movq xmm5, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm5, xmm3
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
- paddw xmm5, xmm2
-
- paddw xmm1, xmm5
-%endif
- movq xmm0, MMWORD PTR [rsi + rax]
- movq xmm5, MMWORD PTR [rdi+ rdx]
- movq xmm3, MMWORD PTR [rdi+ rdx+8]
- punpcklqdq xmm5, xmm3
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
- paddw xmm5, xmm2
-
- paddw xmm1, xmm5
-%endmacro
-
-%macro PROCESS_4X2X8 1
-%if %1
- movd xmm0, [rsi]
- movq xmm1, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm1, xmm3
-
- mpsadbw xmm1, xmm0, 0x0
-%else
- movd xmm0, [rsi]
- movq xmm5, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm5, xmm3
-
- mpsadbw xmm5, xmm0, 0x0
-
- paddw xmm1, xmm5
-%endif
- movd xmm0, [rsi + rax]
- movq xmm5, MMWORD PTR [rdi+ rdx]
- movq xmm3, MMWORD PTR [rdi+ rdx+8]
- punpcklqdq xmm5, xmm3
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- mpsadbw xmm5, xmm0, 0x0
-
- paddw xmm1, xmm5
-%endmacro
-
-
-;void vp8_sad16x16x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array);
-global sym(vp8_sad16x16x8_sse4) PRIVATE
-sym(vp8_sad16x16x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_16X2X8 1
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
-
- mov rdi, arg(4) ;Results
- movdqa XMMWORD PTR [rdi], xmm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_sad16x8x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp8_sad16x8x8_sse4) PRIVATE
-sym(vp8_sad16x8x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_16X2X8 1
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
-
- mov rdi, arg(4) ;Results
- movdqa XMMWORD PTR [rdi], xmm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_sad8x8x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp8_sad8x8x8_sse4) PRIVATE
-sym(vp8_sad8x8x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_8X2X8 1
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
-
- mov rdi, arg(4) ;Results
- movdqa XMMWORD PTR [rdi], xmm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_sad8x16x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp8_sad8x16x8_sse4) PRIVATE
-sym(vp8_sad8x16x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_8X2X8 1
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- mov rdi, arg(4) ;Results
- movdqa XMMWORD PTR [rdi], xmm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_sad4x4x8_c(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp8_sad4x4x8_sse4) PRIVATE
-sym(vp8_sad4x4x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_4X2X8 1
- PROCESS_4X2X8 0
-
- mov rdi, arg(4) ;Results
- movdqa XMMWORD PTR [rdi], xmm1
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_ssse3.asm
deleted file mode 100644
index 278fc06..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/sad_ssse3.asm
+++ /dev/null
@@ -1,370 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro PROCESS_16X2X3 1
-%if %1
- movdqa xmm0, XMMWORD PTR [rsi]
- lddqu xmm5, XMMWORD PTR [rdi]
- lddqu xmm6, XMMWORD PTR [rdi+1]
- lddqu xmm7, XMMWORD PTR [rdi+2]
-
- psadbw xmm5, xmm0
- psadbw xmm6, xmm0
- psadbw xmm7, xmm0
-%else
- movdqa xmm0, XMMWORD PTR [rsi]
- lddqu xmm1, XMMWORD PTR [rdi]
- lddqu xmm2, XMMWORD PTR [rdi+1]
- lddqu xmm3, XMMWORD PTR [rdi+2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endif
- movdqa xmm0, XMMWORD PTR [rsi+rax]
- lddqu xmm1, XMMWORD PTR [rdi+rdx]
- lddqu xmm2, XMMWORD PTR [rdi+rdx+1]
- lddqu xmm3, XMMWORD PTR [rdi+rdx+2]
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endmacro
-
-%macro PROCESS_16X2X3_OFFSET 2
-%if %1
- movdqa xmm0, XMMWORD PTR [rsi]
- movdqa xmm4, XMMWORD PTR [rdi]
- movdqa xmm7, XMMWORD PTR [rdi+16]
-
- movdqa xmm5, xmm7
- palignr xmm5, xmm4, %2
-
- movdqa xmm6, xmm7
- palignr xmm6, xmm4, (%2+1)
-
- palignr xmm7, xmm4, (%2+2)
-
- psadbw xmm5, xmm0
- psadbw xmm6, xmm0
- psadbw xmm7, xmm0
-%else
- movdqa xmm0, XMMWORD PTR [rsi]
- movdqa xmm4, XMMWORD PTR [rdi]
- movdqa xmm3, XMMWORD PTR [rdi+16]
-
- movdqa xmm1, xmm3
- palignr xmm1, xmm4, %2
-
- movdqa xmm2, xmm3
- palignr xmm2, xmm4, (%2+1)
-
- palignr xmm3, xmm4, (%2+2)
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endif
- movdqa xmm0, XMMWORD PTR [rsi+rax]
- movdqa xmm4, XMMWORD PTR [rdi+rdx]
- movdqa xmm3, XMMWORD PTR [rdi+rdx+16]
-
- movdqa xmm1, xmm3
- palignr xmm1, xmm4, %2
-
- movdqa xmm2, xmm3
- palignr xmm2, xmm4, (%2+1)
-
- palignr xmm3, xmm4, (%2+2)
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endmacro
-
-%macro PROCESS_16X16X3_OFFSET 2
-%2_aligned_by_%1:
-
- sub rdi, %1
-
- PROCESS_16X2X3_OFFSET 1, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
-
- jmp %2_store_off
-
-%endmacro
-
-%macro PROCESS_16X8X3_OFFSET 2
-%2_aligned_by_%1:
-
- sub rdi, %1
-
- PROCESS_16X2X3_OFFSET 1, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
-
- jmp %2_store_off
-
-%endmacro
-
-;void int vp8_sad16x16x3_ssse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad16x16x3_ssse3) PRIVATE
-sym(vp8_sad16x16x3_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- push rsi
- push rdi
- push rcx
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- mov rdx, 0xf
- and rdx, rdi
-
- jmp .vp8_sad16x16x3_ssse3_skiptable
-.vp8_sad16x16x3_ssse3_jumptable:
- dd .vp8_sad16x16x3_ssse3_aligned_by_0 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_1 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_2 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_3 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_4 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_5 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_6 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_7 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_8 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_9 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_10 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_11 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_12 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_13 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_14 - .vp8_sad16x16x3_ssse3_do_jump
- dd .vp8_sad16x16x3_ssse3_aligned_by_15 - .vp8_sad16x16x3_ssse3_do_jump
-.vp8_sad16x16x3_ssse3_skiptable:
-
- call .vp8_sad16x16x3_ssse3_do_jump
-.vp8_sad16x16x3_ssse3_do_jump:
- pop rcx ; get the address of do_jump
- mov rax, .vp8_sad16x16x3_ssse3_jumptable - .vp8_sad16x16x3_ssse3_do_jump
- add rax, rcx ; get the absolute address of vp8_sad16x16x3_ssse3_jumptable
-
- movsxd rax, dword [rax + 4*rdx] ; get the 32 bit offset from the jumptable
- add rcx, rax
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- jmp rcx
-
- PROCESS_16X16X3_OFFSET 0, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 1, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 2, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 3, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 4, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 5, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 6, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 7, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 8, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 9, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 10, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 11, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 12, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 13, .vp8_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 14, .vp8_sad16x16x3_ssse3
-
-.vp8_sad16x16x3_ssse3_aligned_by_15:
- PROCESS_16X2X3 1
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
-
-.vp8_sad16x16x3_ssse3_store_off:
- mov rdi, arg(4) ;Results
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rdi], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rdi+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rdi+8], xmm0
-
- ; begin epilog
- pop rcx
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void int vp8_sad16x8x3_ssse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp8_sad16x8x3_ssse3) PRIVATE
-sym(vp8_sad16x8x3_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- push rsi
- push rdi
- push rcx
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- mov rdx, 0xf
- and rdx, rdi
-
- jmp .vp8_sad16x8x3_ssse3_skiptable
-.vp8_sad16x8x3_ssse3_jumptable:
- dd .vp8_sad16x8x3_ssse3_aligned_by_0 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_1 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_2 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_3 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_4 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_5 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_6 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_7 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_8 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_9 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_10 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_11 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_12 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_13 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_14 - .vp8_sad16x8x3_ssse3_do_jump
- dd .vp8_sad16x8x3_ssse3_aligned_by_15 - .vp8_sad16x8x3_ssse3_do_jump
-.vp8_sad16x8x3_ssse3_skiptable:
-
- call .vp8_sad16x8x3_ssse3_do_jump
-.vp8_sad16x8x3_ssse3_do_jump:
- pop rcx ; get the address of do_jump
- mov rax, .vp8_sad16x8x3_ssse3_jumptable - .vp8_sad16x8x3_ssse3_do_jump
- add rax, rcx ; get the absolute address of vp8_sad16x8x3_ssse3_jumptable
-
- movsxd rax, dword [rax + 4*rdx] ; get the 32 bit offset from the jumptable
- add rcx, rax
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- jmp rcx
-
- PROCESS_16X8X3_OFFSET 0, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 1, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 2, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 3, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 4, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 5, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 6, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 7, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 8, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 9, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 10, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 11, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 12, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 13, .vp8_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 14, .vp8_sad16x8x3_ssse3
-
-.vp8_sad16x8x3_ssse3_aligned_by_15:
-
- PROCESS_16X2X3 1
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
-
-.vp8_sad16x8x3_ssse3_store_off:
- mov rdi, arg(4) ;Results
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rdi], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rdi+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rdi+8], xmm0
-
- ; begin epilog
- pop rcx
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_mmx.asm
deleted file mode 100644
index 47dd452..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_mmx.asm
+++ /dev/null
@@ -1,702 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-extern sym(vp8_bilinear_filters_x86_8)
-
-
-%define BLOCK_HEIGHT_WIDTH 4
-%define vp8_filter_weight 128
-%define VP8_FILTER_SHIFT 7
-
-
-;void vp8_filter_block1d_h6_mmx
-;(
-; unsigned char *src_ptr,
-; unsigned short *output_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned int pixel_step,
-; unsigned int output_height,
-; unsigned int output_width,
-; short * vp8_filter
-;)
-global sym(vp8_filter_block1d_h6_mmx) PRIVATE
-sym(vp8_filter_block1d_h6_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rdx, arg(6) ;vp8_filter
-
- movq mm1, [rdx + 16] ; do both the negative taps first!!!
- movq mm2, [rdx + 32] ;
- movq mm6, [rdx + 48] ;
- movq mm7, [rdx + 64] ;
-
- mov rdi, arg(1) ;output_ptr
- mov rsi, arg(0) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(5) ;output_width ; destination pitch?
- pxor mm0, mm0 ; mm0 = 00000000
-
-.nextrow:
- movq mm3, [rsi-2] ; mm3 = p-2..p5
- movq mm4, mm3 ; mm4 = p-2..p5
- psrlq mm3, 8 ; mm3 = p-1..p5
- punpcklbw mm3, mm0 ; mm3 = p-1..p2
- pmullw mm3, mm1 ; mm3 *= kernel 1 modifiers.
-
- movq mm5, mm4 ; mm5 = p-2..p5
- punpckhbw mm4, mm0 ; mm5 = p2..p5
- pmullw mm4, mm7 ; mm5 *= kernel 4 modifiers
- paddsw mm3, mm4 ; mm3 += mm5
-
- movq mm4, mm5 ; mm4 = p-2..p5;
- psrlq mm5, 16 ; mm5 = p0..p5;
- punpcklbw mm5, mm0 ; mm5 = p0..p3
- pmullw mm5, mm2 ; mm5 *= kernel 2 modifiers
- paddsw mm3, mm5 ; mm3 += mm5
-
- movq mm5, mm4 ; mm5 = p-2..p5
- psrlq mm4, 24 ; mm4 = p1..p5
- punpcklbw mm4, mm0 ; mm4 = p1..p4
- pmullw mm4, mm6 ; mm5 *= kernel 3 modifiers
- paddsw mm3, mm4 ; mm3 += mm5
-
- ; do outer positive taps
- movd mm4, [rsi+3]
- punpcklbw mm4, mm0 ; mm5 = p3..p6
- pmullw mm4, [rdx+80] ; mm5 *= kernel 0 modifiers
- paddsw mm3, mm4 ; mm3 += mm5
-
- punpcklbw mm5, mm0 ; mm5 = p-2..p1
- pmullw mm5, [rdx] ; mm5 *= kernel 5 modifiers
- paddsw mm3, mm5 ; mm3 += mm5
-
- paddsw mm3, [GLOBAL(rd)] ; mm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; mm3 /= 128
- packuswb mm3, mm0 ; pack and unpack to saturate
- punpcklbw mm3, mm0 ;
-
- movq [rdi], mm3 ; store the results in the destination
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(2) ;src_pixels_per_line ; next line
- add rdi, rax;
-%else
- movsxd r8, dword ptr arg(2) ;src_pixels_per_line
- add rdi, rax;
-
- add rsi, r8 ; next line
-%endif
-
- dec rcx ; decrement count
- jnz .nextrow ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_filter_block1dc_v6_mmx
-;(
-; short *src_ptr,
-; unsigned char *output_ptr,
-; int output_pitch,
-; unsigned int pixels_per_line,
-; unsigned int pixel_step,
-; unsigned int output_height,
-; unsigned int output_width,
-; short * vp8_filter
-;)
-global sym(vp8_filter_block1dc_v6_mmx) PRIVATE
-sym(vp8_filter_block1dc_v6_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movq mm5, [GLOBAL(rd)]
- push rbx
- mov rbx, arg(7) ;vp8_filter
- movq mm1, [rbx + 16] ; do both the negative taps first!!!
- movq mm2, [rbx + 32] ;
- movq mm6, [rbx + 48] ;
- movq mm7, [rbx + 64] ;
-
- movsxd rdx, dword ptr arg(3) ;pixels_per_line
- mov rdi, arg(1) ;output_ptr
- mov rsi, arg(0) ;src_ptr
- sub rsi, rdx
- sub rsi, rdx
- movsxd rcx, DWORD PTR arg(5) ;output_height
- movsxd rax, DWORD PTR arg(2) ;output_pitch ; destination pitch?
- pxor mm0, mm0 ; mm0 = 00000000
-
-
-.nextrow_cv:
- movq mm3, [rsi+rdx] ; mm3 = p0..p8 = row -1
- pmullw mm3, mm1 ; mm3 *= kernel 1 modifiers.
-
-
- movq mm4, [rsi + 4*rdx] ; mm4 = p0..p3 = row 2
- pmullw mm4, mm7 ; mm4 *= kernel 4 modifiers.
- paddsw mm3, mm4 ; mm3 += mm4
-
- movq mm4, [rsi + 2*rdx] ; mm4 = p0..p3 = row 0
- pmullw mm4, mm2 ; mm4 *= kernel 2 modifiers.
- paddsw mm3, mm4 ; mm3 += mm4
-
- movq mm4, [rsi] ; mm4 = p0..p3 = row -2
- pmullw mm4, [rbx] ; mm4 *= kernel 0 modifiers.
- paddsw mm3, mm4 ; mm3 += mm4
-
-
- add rsi, rdx ; move source forward 1 line to avoid 3 * pitch
- movq mm4, [rsi + 2*rdx] ; mm4 = p0..p3 = row 1
- pmullw mm4, mm6 ; mm4 *= kernel 3 modifiers.
- paddsw mm3, mm4 ; mm3 += mm4
-
- movq mm4, [rsi + 4*rdx] ; mm4 = p0..p3 = row 3
- pmullw mm4, [rbx +80] ; mm4 *= kernel 3 modifiers.
- paddsw mm3, mm4 ; mm3 += mm4
-
-
- paddsw mm3, mm5 ; mm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; mm3 /= 128
- packuswb mm3, mm0 ; pack and saturate
-
- movd [rdi],mm3 ; store the results in the destination
- ; the subsequent iterations repeat 3 out of 4 of these reads. Since the
- ; recon block should be in cache this shouldn't cost much. Its obviously
- ; avoidable!!!.
- lea rdi, [rdi+rax] ;
- dec rcx ; decrement count
- jnz .nextrow_cv ; next row
-
- pop rbx
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void bilinear_predict8x8_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; int xoffset,
-; int yoffset,
-; unsigned char *dst_ptr,
-; int dst_pitch
-;)
-global sym(vp8_bilinear_predict8x8_mmx) PRIVATE
-sym(vp8_bilinear_predict8x8_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset];
- ;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset];
-
- movsxd rax, dword ptr arg(2) ;xoffset
- mov rdi, arg(4) ;dst_ptr ;
-
- shl rax, 5 ; offset * 32
- lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
-
- add rax, rcx ; HFilter
- mov rsi, arg(0) ;src_ptr ;
-
- movsxd rdx, dword ptr arg(5) ;dst_pitch
- movq mm1, [rax] ;
-
- movq mm2, [rax+16] ;
- movsxd rax, dword ptr arg(3) ;yoffset
-
- pxor mm0, mm0 ;
-
- shl rax, 5 ; offset*32
- add rax, rcx ; VFilter
-
- lea rcx, [rdi+rdx*8] ;
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line ;
-
-
-
- ; get the first horizontal line done ;
- movq mm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movq mm4, mm3 ; make a copy of current line
-
- punpcklbw mm3, mm0 ; xx 00 01 02 03 04 05 06
- punpckhbw mm4, mm0 ;
-
- pmullw mm3, mm1 ;
- pmullw mm4, mm1 ;
-
- movq mm5, [rsi+1] ;
- movq mm6, mm5 ;
-
- punpcklbw mm5, mm0 ;
- punpckhbw mm6, mm0 ;
-
- pmullw mm5, mm2 ;
- pmullw mm6, mm2 ;
-
- paddw mm3, mm5 ;
- paddw mm4, mm6 ;
-
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw mm4, [GLOBAL(rd)] ;
- psraw mm4, VP8_FILTER_SHIFT ;
-
- movq mm7, mm3 ;
- packuswb mm7, mm4 ;
-
- add rsi, rdx ; next line
-.next_row_8x8:
- movq mm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movq mm4, mm3 ; make a copy of current line
-
- punpcklbw mm3, mm0 ; xx 00 01 02 03 04 05 06
- punpckhbw mm4, mm0 ;
-
- pmullw mm3, mm1 ;
- pmullw mm4, mm1 ;
-
- movq mm5, [rsi+1] ;
- movq mm6, mm5 ;
-
- punpcklbw mm5, mm0 ;
- punpckhbw mm6, mm0 ;
-
- pmullw mm5, mm2 ;
- pmullw mm6, mm2 ;
-
- paddw mm3, mm5 ;
- paddw mm4, mm6 ;
-
- movq mm5, mm7 ;
- movq mm6, mm7 ;
-
- punpcklbw mm5, mm0 ;
- punpckhbw mm6, mm0
-
- pmullw mm5, [rax] ;
- pmullw mm6, [rax] ;
-
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw mm4, [GLOBAL(rd)] ;
- psraw mm4, VP8_FILTER_SHIFT ;
-
- movq mm7, mm3 ;
- packuswb mm7, mm4 ;
-
-
- pmullw mm3, [rax+16] ;
- pmullw mm4, [rax+16] ;
-
- paddw mm3, mm5 ;
- paddw mm4, mm6 ;
-
-
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw mm4, [GLOBAL(rd)] ;
- psraw mm4, VP8_FILTER_SHIFT ;
-
- packuswb mm3, mm4
-
- movq [rdi], mm3 ; store the results in the destination
-
-%if ABI_IS_32BIT
- add rsi, rdx ; next line
- add rdi, dword ptr arg(5) ;dst_pitch ;
-%else
- movsxd r8, dword ptr arg(5) ;dst_pitch
- add rsi, rdx ; next line
- add rdi, r8 ;dst_pitch
-%endif
- cmp rdi, rcx ;
- jne .next_row_8x8
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void bilinear_predict8x4_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; int xoffset,
-; int yoffset,
-; unsigned char *dst_ptr,
-; int dst_pitch
-;)
-global sym(vp8_bilinear_predict8x4_mmx) PRIVATE
-sym(vp8_bilinear_predict8x4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset];
- ;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset];
-
- movsxd rax, dword ptr arg(2) ;xoffset
- mov rdi, arg(4) ;dst_ptr ;
-
- lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
- shl rax, 5
-
- mov rsi, arg(0) ;src_ptr ;
- add rax, rcx
-
- movsxd rdx, dword ptr arg(5) ;dst_pitch
- movq mm1, [rax] ;
-
- movq mm2, [rax+16] ;
- movsxd rax, dword ptr arg(3) ;yoffset
-
- pxor mm0, mm0 ;
- shl rax, 5
-
- add rax, rcx
- lea rcx, [rdi+rdx*4] ;
-
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line ;
-
- ; get the first horizontal line done ;
- movq mm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movq mm4, mm3 ; make a copy of current line
-
- punpcklbw mm3, mm0 ; xx 00 01 02 03 04 05 06
- punpckhbw mm4, mm0 ;
-
- pmullw mm3, mm1 ;
- pmullw mm4, mm1 ;
-
- movq mm5, [rsi+1] ;
- movq mm6, mm5 ;
-
- punpcklbw mm5, mm0 ;
- punpckhbw mm6, mm0 ;
-
- pmullw mm5, mm2 ;
- pmullw mm6, mm2 ;
-
- paddw mm3, mm5 ;
- paddw mm4, mm6 ;
-
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw mm4, [GLOBAL(rd)] ;
- psraw mm4, VP8_FILTER_SHIFT ;
-
- movq mm7, mm3 ;
- packuswb mm7, mm4 ;
-
- add rsi, rdx ; next line
-.next_row_8x4:
- movq mm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movq mm4, mm3 ; make a copy of current line
-
- punpcklbw mm3, mm0 ; xx 00 01 02 03 04 05 06
- punpckhbw mm4, mm0 ;
-
- pmullw mm3, mm1 ;
- pmullw mm4, mm1 ;
-
- movq mm5, [rsi+1] ;
- movq mm6, mm5 ;
-
- punpcklbw mm5, mm0 ;
- punpckhbw mm6, mm0 ;
-
- pmullw mm5, mm2 ;
- pmullw mm6, mm2 ;
-
- paddw mm3, mm5 ;
- paddw mm4, mm6 ;
-
- movq mm5, mm7 ;
- movq mm6, mm7 ;
-
- punpcklbw mm5, mm0 ;
- punpckhbw mm6, mm0
-
- pmullw mm5, [rax] ;
- pmullw mm6, [rax] ;
-
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw mm4, [GLOBAL(rd)] ;
- psraw mm4, VP8_FILTER_SHIFT ;
-
- movq mm7, mm3 ;
- packuswb mm7, mm4 ;
-
-
- pmullw mm3, [rax+16] ;
- pmullw mm4, [rax+16] ;
-
- paddw mm3, mm5 ;
- paddw mm4, mm6 ;
-
-
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw mm4, [GLOBAL(rd)] ;
- psraw mm4, VP8_FILTER_SHIFT ;
-
- packuswb mm3, mm4
-
- movq [rdi], mm3 ; store the results in the destination
-
-%if ABI_IS_32BIT
- add rsi, rdx ; next line
- add rdi, dword ptr arg(5) ;dst_pitch ;
-%else
- movsxd r8, dword ptr arg(5) ;dst_pitch
- add rsi, rdx ; next line
- add rdi, r8
-%endif
- cmp rdi, rcx ;
- jne .next_row_8x4
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void bilinear_predict4x4_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; int xoffset,
-; int yoffset,
-; unsigned char *dst_ptr,
-; int dst_pitch
-;)
-global sym(vp8_bilinear_predict4x4_mmx) PRIVATE
-sym(vp8_bilinear_predict4x4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset];
- ;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset];
-
- movsxd rax, dword ptr arg(2) ;xoffset
- mov rdi, arg(4) ;dst_ptr ;
-
- lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
- shl rax, 5
-
- add rax, rcx ; HFilter
- mov rsi, arg(0) ;src_ptr ;
-
- movsxd rdx, dword ptr arg(5) ;ldst_pitch
- movq mm1, [rax] ;
-
- movq mm2, [rax+16] ;
- movsxd rax, dword ptr arg(3) ;yoffset
-
- pxor mm0, mm0 ;
- shl rax, 5
-
- add rax, rcx
- lea rcx, [rdi+rdx*4] ;
-
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line ;
-
- ; get the first horizontal line done ;
- movd mm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- punpcklbw mm3, mm0 ; xx 00 01 02 03 04 05 06
-
- pmullw mm3, mm1 ;
- movd mm5, [rsi+1] ;
-
- punpcklbw mm5, mm0 ;
- pmullw mm5, mm2 ;
-
- paddw mm3, mm5 ;
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
-
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- movq mm7, mm3 ;
- packuswb mm7, mm0 ;
-
- add rsi, rdx ; next line
-.next_row_4x4:
- movd mm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- punpcklbw mm3, mm0 ; xx 00 01 02 03 04 05 06
-
- pmullw mm3, mm1 ;
- movd mm5, [rsi+1] ;
-
- punpcklbw mm5, mm0 ;
- pmullw mm5, mm2 ;
-
- paddw mm3, mm5 ;
-
- movq mm5, mm7 ;
- punpcklbw mm5, mm0 ;
-
- pmullw mm5, [rax] ;
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
-
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- movq mm7, mm3 ;
-
- packuswb mm7, mm0 ;
-
- pmullw mm3, [rax+16] ;
- paddw mm3, mm5 ;
-
-
- paddw mm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw mm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- packuswb mm3, mm0
- movd [rdi], mm3 ; store the results in the destination
-
-%if ABI_IS_32BIT
- add rsi, rdx ; next line
- add rdi, dword ptr arg(5) ;dst_pitch ;
-%else
- movsxd r8, dword ptr arg(5) ;dst_pitch ;
- add rsi, rdx ; next line
- add rdi, r8
-%endif
-
- cmp rdi, rcx ;
- jne .next_row_4x4
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-SECTION_RODATA
-align 16
-rd:
- times 4 dw 0x40
-
-align 16
-global HIDDEN_DATA(sym(vp8_six_tap_mmx))
-sym(vp8_six_tap_mmx):
- times 8 dw 0
- times 8 dw 0
- times 8 dw 128
- times 8 dw 0
- times 8 dw 0
- times 8 dw 0
-
- times 8 dw 0
- times 8 dw -6
- times 8 dw 123
- times 8 dw 12
- times 8 dw -1
- times 8 dw 0
-
- times 8 dw 2
- times 8 dw -11
- times 8 dw 108
- times 8 dw 36
- times 8 dw -8
- times 8 dw 1
-
- times 8 dw 0
- times 8 dw -9
- times 8 dw 93
- times 8 dw 50
- times 8 dw -6
- times 8 dw 0
-
- times 8 dw 3
- times 8 dw -16
- times 8 dw 77
- times 8 dw 77
- times 8 dw -16
- times 8 dw 3
-
- times 8 dw 0
- times 8 dw -6
- times 8 dw 50
- times 8 dw 93
- times 8 dw -9
- times 8 dw 0
-
- times 8 dw 1
- times 8 dw -8
- times 8 dw 36
- times 8 dw 108
- times 8 dw -11
- times 8 dw 2
-
- times 8 dw 0
- times 8 dw -1
- times 8 dw 12
- times 8 dw 123
- times 8 dw -6
- times 8 dw 0
-
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_sse2.asm
deleted file mode 100644
index 69f8d10..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_sse2.asm
+++ /dev/null
@@ -1,1372 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-extern sym(vp8_bilinear_filters_x86_8)
-
-%define BLOCK_HEIGHT_WIDTH 4
-%define VP8_FILTER_WEIGHT 128
-%define VP8_FILTER_SHIFT 7
-
-
-;/************************************************************************************
-; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
-; input pixel array has output_height rows. This routine assumes that output_height is an
-; even number. This function handles 8 pixels in horizontal direction, calculating ONE
-; rows each iteration to take advantage of the 128 bits operations.
-;*************************************************************************************/
-;void vp8_filter_block1d8_h6_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned short *output_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned int pixel_step,
-; unsigned int output_height,
-; unsigned int output_width,
-; short *vp8_filter
-;)
-global sym(vp8_filter_block1d8_h6_sse2) PRIVATE
-sym(vp8_filter_block1d8_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rdx, arg(6) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
-
- mov rdi, arg(1) ;output_ptr
-
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(5) ;output_width
-%endif
- pxor xmm0, xmm0 ; clear xmm0 for unpack
-
-.filter_block1d8_h6_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
-
- prefetcht2 [rsi+rax-2]
-
- pslldq xmm1, 8
- por xmm1, xmm3
-
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
-
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-
-
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-
-
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-
-
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
-
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
-
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
-
- psraw xmm4, 7
-
- packuswb xmm4, xmm0
- punpcklbw xmm4, xmm0
-
- movdqa XMMWORD Ptr [rdi], xmm4
- lea rsi, [rsi + rax]
-
-%if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(5) ;[output_width]
-%else
- add rdi, r8
-%endif
- dec rcx
-
- jnz .filter_block1d8_h6_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_filter_block1d16_h6_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned short *output_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned int pixel_step,
-; unsigned int output_height,
-; unsigned int output_width,
-; short *vp8_filter
-;)
-;/************************************************************************************
-; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
-; input pixel array has output_height rows. This routine assumes that output_height is an
-; even number. This function handles 8 pixels in horizontal direction, calculating ONE
-; rows each iteration to take advantage of the 128 bits operations.
-;*************************************************************************************/
-global sym(vp8_filter_block1d16_h6_sse2) PRIVATE
-sym(vp8_filter_block1d16_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rdx, arg(6) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
-
- mov rdi, arg(1) ;output_ptr
-
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(5) ;output_width
-%endif
-
- pxor xmm0, xmm0 ; clear xmm0 for unpack
-
-.filter_block1d16_h6_sse2_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
-
- movq xmm2, MMWORD PTR [rsi +14]
- pslldq xmm2, 8
-
- por xmm2, xmm1
- prefetcht2 [rsi+rax-2]
-
- pslldq xmm1, 8
- por xmm1, xmm3
-
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
-
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-
-
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-
-
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
-
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
-
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
-
- psraw xmm4, 7
-
- packuswb xmm4, xmm0
- punpcklbw xmm4, xmm0
-
- movdqa XMMWORD Ptr [rdi], xmm4
-
- movdqa xmm3, xmm2
- movdqa xmm4, xmm2
-
- movdqa xmm5, xmm2
- movdqa xmm6, xmm2
-
- movdqa xmm7, xmm2
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-
-
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-
- punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-
-
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
-
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
-
- paddsw xmm4, xmm2
- paddsw xmm4, [GLOBAL(rd)]
-
- psraw xmm4, 7
-
- packuswb xmm4, xmm0
- punpcklbw xmm4, xmm0
-
- movdqa XMMWORD Ptr [rdi+16], xmm4
-
- lea rsi, [rsi + rax]
-%if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(5) ;[output_width]
-%else
- add rdi, r8
-%endif
-
- dec rcx
- jnz .filter_block1d16_h6_sse2_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_filter_block1d8_v6_sse2
-;(
-; short *src_ptr,
-; unsigned char *output_ptr,
-; int dst_ptich,
-; unsigned int pixels_per_line,
-; unsigned int pixel_step,
-; unsigned int output_height,
-; unsigned int output_width,
-; short * vp8_filter
-;)
-;/************************************************************************************
-; Notes: filter_block1d8_v6 applies a 6 tap filter vertically to the input pixels. The
-; input pixel array has output_height rows.
-;*************************************************************************************/
-global sym(vp8_filter_block1d8_v6_sse2) PRIVATE
-sym(vp8_filter_block1d8_v6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rax, arg(7) ;vp8_filter
- movsxd rdx, dword ptr arg(3) ;pixels_per_line
-
- mov rdi, arg(1) ;output_ptr
- mov rsi, arg(0) ;src_ptr
-
- sub rsi, rdx
- sub rsi, rdx
-
- movsxd rcx, DWORD PTR arg(5) ;[output_height]
- pxor xmm0, xmm0 ; clear xmm0
-
- movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(2) ; dst_ptich
-%endif
-
-.vp8_filter_block1d8_v6_sse2_loop:
- movdqa xmm1, XMMWORD PTR [rsi]
- pmullw xmm1, [rax]
-
- movdqa xmm2, XMMWORD PTR [rsi + rdx]
- pmullw xmm2, [rax + 16]
-
- movdqa xmm3, XMMWORD PTR [rsi + rdx * 2]
- pmullw xmm3, [rax + 32]
-
- movdqa xmm5, XMMWORD PTR [rsi + rdx * 4]
- pmullw xmm5, [rax + 64]
-
- add rsi, rdx
- movdqa xmm4, XMMWORD PTR [rsi + rdx * 2]
-
- pmullw xmm4, [rax + 48]
- movdqa xmm6, XMMWORD PTR [rsi + rdx * 4]
-
- pmullw xmm6, [rax + 80]
-
- paddsw xmm2, xmm5
- paddsw xmm2, xmm3
-
- paddsw xmm2, xmm1
- paddsw xmm2, xmm4
-
- paddsw xmm2, xmm6
- paddsw xmm2, xmm7
-
- psraw xmm2, 7
- packuswb xmm2, xmm0 ; pack and saturate
-
- movq QWORD PTR [rdi], xmm2 ; store the results in the destination
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(2) ;[dst_ptich]
-%else
- add rdi, r8
-%endif
- dec rcx ; decrement count
- jnz .vp8_filter_block1d8_v6_sse2_loop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_filter_block1d16_v6_sse2
-;(
-; unsigned short *src_ptr,
-; unsigned char *output_ptr,
-; int dst_ptich,
-; unsigned int pixels_per_line,
-; unsigned int pixel_step,
-; unsigned int output_height,
-; unsigned int output_width,
-; const short *vp8_filter
-;)
-;/************************************************************************************
-; Notes: filter_block1d16_v6 applies a 6 tap filter vertically to the input pixels. The
-; input pixel array has output_height rows.
-;*************************************************************************************/
-global sym(vp8_filter_block1d16_v6_sse2) PRIVATE
-sym(vp8_filter_block1d16_v6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rax, arg(7) ;vp8_filter
- movsxd rdx, dword ptr arg(3) ;pixels_per_line
-
- mov rdi, arg(1) ;output_ptr
- mov rsi, arg(0) ;src_ptr
-
- sub rsi, rdx
- sub rsi, rdx
-
- movsxd rcx, DWORD PTR arg(5) ;[output_height]
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(2) ; dst_ptich
-%endif
-
-.vp8_filter_block1d16_v6_sse2_loop:
-; The order for adding 6-tap is 2 5 3 1 4 6. Read in data in that order.
- movdqa xmm1, XMMWORD PTR [rsi + rdx] ; line 2
- movdqa xmm2, XMMWORD PTR [rsi + rdx + 16]
- pmullw xmm1, [rax + 16]
- pmullw xmm2, [rax + 16]
-
- movdqa xmm3, XMMWORD PTR [rsi + rdx * 4] ; line 5
- movdqa xmm4, XMMWORD PTR [rsi + rdx * 4 + 16]
- pmullw xmm3, [rax + 64]
- pmullw xmm4, [rax + 64]
-
- movdqa xmm5, XMMWORD PTR [rsi + rdx * 2] ; line 3
- movdqa xmm6, XMMWORD PTR [rsi + rdx * 2 + 16]
- pmullw xmm5, [rax + 32]
- pmullw xmm6, [rax + 32]
-
- movdqa xmm7, XMMWORD PTR [rsi] ; line 1
- movdqa xmm0, XMMWORD PTR [rsi + 16]
- pmullw xmm7, [rax]
- pmullw xmm0, [rax]
-
- paddsw xmm1, xmm3
- paddsw xmm2, xmm4
- paddsw xmm1, xmm5
- paddsw xmm2, xmm6
- paddsw xmm1, xmm7
- paddsw xmm2, xmm0
-
- add rsi, rdx
-
- movdqa xmm3, XMMWORD PTR [rsi + rdx * 2] ; line 4
- movdqa xmm4, XMMWORD PTR [rsi + rdx * 2 + 16]
- pmullw xmm3, [rax + 48]
- pmullw xmm4, [rax + 48]
-
- movdqa xmm5, XMMWORD PTR [rsi + rdx * 4] ; line 6
- movdqa xmm6, XMMWORD PTR [rsi + rdx * 4 + 16]
- pmullw xmm5, [rax + 80]
- pmullw xmm6, [rax + 80]
-
- movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
- pxor xmm0, xmm0 ; clear xmm0
-
- paddsw xmm1, xmm3
- paddsw xmm2, xmm4
- paddsw xmm1, xmm5
- paddsw xmm2, xmm6
-
- paddsw xmm1, xmm7
- paddsw xmm2, xmm7
-
- psraw xmm1, 7
- psraw xmm2, 7
-
- packuswb xmm1, xmm2 ; pack and saturate
- movdqa XMMWORD PTR [rdi], xmm1 ; store the results in the destination
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(2) ;[dst_ptich]
-%else
- add rdi, r8
-%endif
- dec rcx ; decrement count
- jnz .vp8_filter_block1d16_v6_sse2_loop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_filter_block1d8_h6_only_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; int dst_ptich,
-; unsigned int output_height,
-; const short *vp8_filter
-;)
-; First-pass filter only when yoffset==0
-global sym(vp8_filter_block1d8_h6_only_sse2) PRIVATE
-sym(vp8_filter_block1d8_h6_only_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rdx, arg(5) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
-
- mov rdi, arg(2) ;output_ptr
-
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(3) ;dst_ptich
-%endif
- pxor xmm0, xmm0 ; clear xmm0 for unpack
-
-.filter_block1d8_h6_only_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
-
- prefetcht2 [rsi+rax-2]
-
- pslldq xmm1, 8
- por xmm1, xmm3
-
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
-
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-
-
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-
-
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-
-
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
-
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
-
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
-
- psraw xmm4, 7
-
- packuswb xmm4, xmm0
-
- movq QWORD PTR [rdi], xmm4 ; store the results in the destination
- lea rsi, [rsi + rax]
-
-%if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(3) ;dst_ptich
-%else
- add rdi, r8
-%endif
- dec rcx
-
- jnz .filter_block1d8_h6_only_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_filter_block1d16_h6_only_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; int dst_ptich,
-; unsigned int output_height,
-; const short *vp8_filter
-;)
-; First-pass filter only when yoffset==0
-global sym(vp8_filter_block1d16_h6_only_sse2) PRIVATE
-sym(vp8_filter_block1d16_h6_only_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rdx, arg(5) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
-
- mov rdi, arg(2) ;output_ptr
-
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(3) ;dst_ptich
-%endif
-
- pxor xmm0, xmm0 ; clear xmm0 for unpack
-
-.filter_block1d16_h6_only_sse2_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
-
- movq xmm2, MMWORD PTR [rsi +14]
- pslldq xmm2, 8
-
- por xmm2, xmm1
- prefetcht2 [rsi+rax-2]
-
- pslldq xmm1, 8
- por xmm1, xmm3
-
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
-
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
-
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
-
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
-
- psraw xmm4, 7
-
- packuswb xmm4, xmm0 ; lower 8 bytes
-
- movq QWORD Ptr [rdi], xmm4 ; store the results in the destination
-
- movdqa xmm3, xmm2
- movdqa xmm4, xmm2
-
- movdqa xmm5, xmm2
- movdqa xmm6, xmm2
-
- movdqa xmm7, xmm2
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-
- punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
-
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
-
- paddsw xmm4, xmm2
- paddsw xmm4, [GLOBAL(rd)]
-
- psraw xmm4, 7
-
- packuswb xmm4, xmm0 ; higher 8 bytes
-
- movq QWORD Ptr [rdi+8], xmm4 ; store the results in the destination
-
- lea rsi, [rsi + rax]
-%if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(3) ;dst_ptich
-%else
- add rdi, r8
-%endif
-
- dec rcx
- jnz .filter_block1d16_h6_only_sse2_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_filter_block1d8_v6_only_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; int dst_ptich,
-; unsigned int output_height,
-; const short *vp8_filter
-;)
-; Second-pass filter only when xoffset==0
-global sym(vp8_filter_block1d8_v6_only_sse2) PRIVATE
-sym(vp8_filter_block1d8_v6_only_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
-
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
-
- mov rax, arg(5) ;vp8_filter
-
- pxor xmm0, xmm0 ; clear xmm0
-
- movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(3) ; dst_ptich
-%endif
-
-.vp8_filter_block1d8_v6_only_sse2_loop:
- movq xmm1, MMWORD PTR [rsi]
- movq xmm2, MMWORD PTR [rsi + rdx]
- movq xmm3, MMWORD PTR [rsi + rdx * 2]
- movq xmm5, MMWORD PTR [rsi + rdx * 4]
- add rsi, rdx
- movq xmm4, MMWORD PTR [rsi + rdx * 2]
- movq xmm6, MMWORD PTR [rsi + rdx * 4]
-
- punpcklbw xmm1, xmm0
- pmullw xmm1, [rax]
-
- punpcklbw xmm2, xmm0
- pmullw xmm2, [rax + 16]
-
- punpcklbw xmm3, xmm0
- pmullw xmm3, [rax + 32]
-
- punpcklbw xmm5, xmm0
- pmullw xmm5, [rax + 64]
-
- punpcklbw xmm4, xmm0
- pmullw xmm4, [rax + 48]
-
- punpcklbw xmm6, xmm0
- pmullw xmm6, [rax + 80]
-
- paddsw xmm2, xmm5
- paddsw xmm2, xmm3
-
- paddsw xmm2, xmm1
- paddsw xmm2, xmm4
-
- paddsw xmm2, xmm6
- paddsw xmm2, xmm7
-
- psraw xmm2, 7
- packuswb xmm2, xmm0 ; pack and saturate
-
- movq QWORD PTR [rdi], xmm2 ; store the results in the destination
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;[dst_ptich]
-%else
- add rdi, r8
-%endif
- dec rcx ; decrement count
- jnz .vp8_filter_block1d8_v6_only_sse2_loop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_unpack_block1d16_h6_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned short *output_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned int output_height,
-; unsigned int output_width
-;)
-global sym(vp8_unpack_block1d16_h6_sse2) PRIVATE
-sym(vp8_unpack_block1d16_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;output_ptr
-
- movsxd rcx, dword ptr arg(3) ;output_height
- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
-
- pxor xmm0, xmm0 ; clear xmm0 for unpack
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
-%endif
-
-.unpack_block1d16_h6_sse2_rowloop:
- movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
- movq xmm3, MMWORD PTR [rsi+8] ; make copy of xmm1
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- punpcklbw xmm1, xmm0
-
- movdqa XMMWORD Ptr [rdi], xmm1
- movdqa XMMWORD Ptr [rdi + 16], xmm3
-
- lea rsi, [rsi + rax]
-%if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(4) ;[output_width]
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .unpack_block1d16_h6_sse2_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_bilinear_predict16x16_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; int xoffset,
-; int yoffset,
-; unsigned char *dst_ptr,
-; int dst_pitch
-;)
-extern sym(vp8_bilinear_filters_x86_8)
-global sym(vp8_bilinear_predict16x16_sse2) PRIVATE
-sym(vp8_bilinear_predict16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset]
- ;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset]
-
- lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
- movsxd rax, dword ptr arg(2) ;xoffset
-
- cmp rax, 0 ;skip first_pass filter if xoffset=0
- je .b16x16_sp_only
-
- shl rax, 5
- add rax, rcx ;HFilter
-
- mov rdi, arg(4) ;dst_ptr
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, dword ptr arg(5) ;dst_pitch
-
- movdqa xmm1, [rax]
- movdqa xmm2, [rax+16]
-
- movsxd rax, dword ptr arg(3) ;yoffset
-
- cmp rax, 0 ;skip second_pass filter if yoffset=0
- je .b16x16_fp_only
-
- shl rax, 5
- add rax, rcx ;VFilter
-
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
-
- pxor xmm0, xmm0
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(5) ;dst_pitch
-%endif
- ; get the first horizontal line done
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movdqa xmm4, xmm3 ; make a copy of current line
-
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
-
- pmullw xmm3, xmm1
- pmullw xmm4, xmm1
-
- movdqu xmm5, [rsi+1]
- movdqa xmm6, xmm5
-
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
-
- pmullw xmm5, xmm2
- pmullw xmm6, xmm2
-
- paddw xmm3, xmm5
- paddw xmm4, xmm6
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
-
- movdqa xmm7, xmm3
- packuswb xmm7, xmm4
-
- add rsi, rdx ; next line
-.next_row:
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movdqa xmm4, xmm3 ; make a copy of current line
-
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
-
- pmullw xmm3, xmm1
- pmullw xmm4, xmm1
-
- movdqu xmm5, [rsi+1]
- movdqa xmm6, xmm5
-
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
-
- pmullw xmm5, xmm2
- pmullw xmm6, xmm2
-
- paddw xmm3, xmm5
- paddw xmm4, xmm6
-
- movdqa xmm5, xmm7
- movdqa xmm6, xmm7
-
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
-
- pmullw xmm5, [rax]
- pmullw xmm6, [rax]
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
-
- movdqa xmm7, xmm3
- packuswb xmm7, xmm4
-
- pmullw xmm3, [rax+16]
- pmullw xmm4, [rax+16]
-
- paddw xmm3, xmm5
- paddw xmm4, xmm6
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
-
- packuswb xmm3, xmm4
- movdqa [rdi], xmm3 ; store the results in the destination
-
- add rsi, rdx ; next line
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(5) ;dst_pitch
-%else
- add rdi, r8
-%endif
-
- cmp rdi, rcx
- jne .next_row
-
- jmp .done
-
-.b16x16_sp_only:
- movsxd rax, dword ptr arg(3) ;yoffset
- shl rax, 5
- add rax, rcx ;VFilter
-
- mov rdi, arg(4) ;dst_ptr
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, dword ptr arg(5) ;dst_pitch
-
- movdqa xmm1, [rax]
- movdqa xmm2, [rax+16]
-
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
-
- pxor xmm0, xmm0
-
- ; get the first horizontal line done
- movdqu xmm7, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
-
- add rsi, rax ; next line
-.next_row_spo:
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
-
- movdqa xmm5, xmm7
- movdqa xmm6, xmm7
-
- movdqa xmm4, xmm3 ; make a copy of current line
- movdqa xmm7, xmm3
-
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
-
- pmullw xmm5, xmm1
- pmullw xmm6, xmm1
- pmullw xmm3, xmm2
- pmullw xmm4, xmm2
-
- paddw xmm3, xmm5
- paddw xmm4, xmm6
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
-
- packuswb xmm3, xmm4
- movdqa [rdi], xmm3 ; store the results in the destination
-
- add rsi, rax ; next line
- add rdi, rdx ;dst_pitch
- cmp rdi, rcx
- jne .next_row_spo
-
- jmp .done
-
-.b16x16_fp_only:
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- pxor xmm0, xmm0
-
-.next_row_fpo:
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movdqa xmm4, xmm3 ; make a copy of current line
-
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
-
- pmullw xmm3, xmm1
- pmullw xmm4, xmm1
-
- movdqu xmm5, [rsi+1]
- movdqa xmm6, xmm5
-
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
-
- pmullw xmm5, xmm2
- pmullw xmm6, xmm2
-
- paddw xmm3, xmm5
- paddw xmm4, xmm6
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
-
- packuswb xmm3, xmm4
- movdqa [rdi], xmm3 ; store the results in the destination
-
- add rsi, rax ; next line
- add rdi, rdx ; dst_pitch
- cmp rdi, rcx
- jne .next_row_fpo
-
-.done:
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_bilinear_predict8x8_sse2
-;(
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; int xoffset,
-; int yoffset,
-; unsigned char *dst_ptr,
-; int dst_pitch
-;)
-global sym(vp8_bilinear_predict8x8_sse2) PRIVATE
-sym(vp8_bilinear_predict8x8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 144 ; reserve 144 bytes
-
- ;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset]
- ;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset]
- lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
-
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
-
- ;Read 9-line unaligned data in and put them on stack. This gives a big
- ;performance boost.
- movdqu xmm0, [rsi]
- lea rax, [rdx + rdx*2]
- movdqu xmm1, [rsi+rdx]
- movdqu xmm2, [rsi+rdx*2]
- add rsi, rax
- movdqu xmm3, [rsi]
- movdqu xmm4, [rsi+rdx]
- movdqu xmm5, [rsi+rdx*2]
- add rsi, rax
- movdqu xmm6, [rsi]
- movdqu xmm7, [rsi+rdx]
-
- movdqa XMMWORD PTR [rsp], xmm0
-
- movdqu xmm0, [rsi+rdx*2]
-
- movdqa XMMWORD PTR [rsp+16], xmm1
- movdqa XMMWORD PTR [rsp+32], xmm2
- movdqa XMMWORD PTR [rsp+48], xmm3
- movdqa XMMWORD PTR [rsp+64], xmm4
- movdqa XMMWORD PTR [rsp+80], xmm5
- movdqa XMMWORD PTR [rsp+96], xmm6
- movdqa XMMWORD PTR [rsp+112], xmm7
- movdqa XMMWORD PTR [rsp+128], xmm0
-
- movsxd rax, dword ptr arg(2) ;xoffset
- shl rax, 5
- add rax, rcx ;HFilter
-
- mov rdi, arg(4) ;dst_ptr
- movsxd rdx, dword ptr arg(5) ;dst_pitch
-
- movdqa xmm1, [rax]
- movdqa xmm2, [rax+16]
-
- movsxd rax, dword ptr arg(3) ;yoffset
- shl rax, 5
- add rax, rcx ;VFilter
-
- lea rcx, [rdi+rdx*8]
-
- movdqa xmm5, [rax]
- movdqa xmm6, [rax+16]
-
- pxor xmm0, xmm0
-
- ; get the first horizontal line done
- movdqa xmm3, XMMWORD PTR [rsp]
- movdqa xmm4, xmm3 ; make a copy of current line
- psrldq xmm4, 1
-
- punpcklbw xmm3, xmm0 ; 00 01 02 03 04 05 06 07
- punpcklbw xmm4, xmm0 ; 01 02 03 04 05 06 07 08
-
- pmullw xmm3, xmm1
- pmullw xmm4, xmm2
-
- paddw xmm3, xmm4
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- movdqa xmm7, xmm3
- add rsp, 16 ; next line
-.next_row8x8:
- movdqa xmm3, XMMWORD PTR [rsp] ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
- movdqa xmm4, xmm3 ; make a copy of current line
- psrldq xmm4, 1
-
- punpcklbw xmm3, xmm0 ; 00 01 02 03 04 05 06 07
- punpcklbw xmm4, xmm0 ; 01 02 03 04 05 06 07 08
-
- pmullw xmm3, xmm1
- pmullw xmm4, xmm2
-
- paddw xmm3, xmm4
- pmullw xmm7, xmm5
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- movdqa xmm4, xmm3
-
- pmullw xmm3, xmm6
- paddw xmm3, xmm7
-
- movdqa xmm7, xmm4
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- packuswb xmm3, xmm0
- movq [rdi], xmm3 ; store the results in the destination
-
- add rsp, 16 ; next line
- add rdi, rdx
-
- cmp rdi, rcx
- jne .next_row8x8
-
- ;add rsp, 144
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-SECTION_RODATA
-align 16
-rd:
- times 8 dw 0x40
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_ssse3.asm
deleted file mode 100644
index c06f245..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/subpixel_ssse3.asm
+++ /dev/null
@@ -1,1508 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%define BLOCK_HEIGHT_WIDTH 4
-%define VP8_FILTER_WEIGHT 128
-%define VP8_FILTER_SHIFT 7
-
-
-;/************************************************************************************
-; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
-; input pixel array has output_height rows. This routine assumes that output_height is an
-; even number. This function handles 8 pixels in horizontal direction, calculating ONE
-; rows each iteration to take advantage of the 128 bits operations.
-;
-; This is an implementation of some of the SSE optimizations first seen in ffvp8
-;
-;*************************************************************************************/
-;void vp8_filter_block1d8_h6_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; unsigned int vp8_filter_index
-;)
-global sym(vp8_filter_block1d8_h6_ssse3) PRIVATE
-sym(vp8_filter_block1d8_h6_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movsxd rdx, DWORD PTR arg(5) ;table index
- xor rsi, rsi
- shl rdx, 4
-
- movdqa xmm7, [GLOBAL(rd)]
-
- lea rax, [GLOBAL(k0_k5)]
- add rax, rdx
- mov rdi, arg(2) ;output_ptr
-
- cmp esi, DWORD PTR [rax]
- je vp8_filter_block1d8_h4_ssse3
-
- movdqa xmm4, XMMWORD PTR [rax] ;k0_k5
- movdqa xmm5, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm6, XMMWORD PTR [rax+128] ;k1_k3
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rcx, dword ptr arg(4) ;output_height
-
- movsxd rdx, dword ptr arg(3) ;output_pitch
-
- sub rdi, rdx
-;xmm3 free
-.filter_block1d8_h6_rowloop_ssse3:
- movq xmm0, MMWORD PTR [rsi - 2] ; -2 -1 0 1 2 3 4 5
-
- movq xmm2, MMWORD PTR [rsi + 3] ; 3 4 5 6 7 8 9 10
-
- punpcklbw xmm0, xmm2 ; -2 3 -1 4 0 5 1 6 2 7 3 8 4 9 5 10
-
- movdqa xmm1, xmm0
- pmaddubsw xmm0, xmm4
-
- movdqa xmm2, xmm1
- pshufb xmm1, [GLOBAL(shuf2bfrom1)]
-
- pshufb xmm2, [GLOBAL(shuf3bfrom1)]
- pmaddubsw xmm1, xmm5
-
- lea rdi, [rdi + rdx]
- pmaddubsw xmm2, xmm6
-
- lea rsi, [rsi + rax]
- dec rcx
-
- paddsw xmm0, xmm1
- paddsw xmm2, xmm7
-
- paddsw xmm0, xmm2
-
- psraw xmm0, 7
-
- packuswb xmm0, xmm0
-
- movq MMWORD Ptr [rdi], xmm0
- jnz .filter_block1d8_h6_rowloop_ssse3
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-vp8_filter_block1d8_h4_ssse3:
- movdqa xmm5, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm6, XMMWORD PTR [rax+128] ;k1_k3
-
- movdqa xmm3, XMMWORD PTR [GLOBAL(shuf2bfrom1)]
- movdqa xmm4, XMMWORD PTR [GLOBAL(shuf3bfrom1)]
-
- mov rsi, arg(0) ;src_ptr
-
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rcx, dword ptr arg(4) ;output_height
-
- movsxd rdx, dword ptr arg(3) ;output_pitch
-
- sub rdi, rdx
-
-.filter_block1d8_h4_rowloop_ssse3:
- movq xmm0, MMWORD PTR [rsi - 2] ; -2 -1 0 1 2 3 4 5
-
- movq xmm1, MMWORD PTR [rsi + 3] ; 3 4 5 6 7 8 9 10
-
- punpcklbw xmm0, xmm1 ; -2 3 -1 4 0 5 1 6 2 7 3 8 4 9 5 10
-
- movdqa xmm2, xmm0
- pshufb xmm0, xmm3
-
- pshufb xmm2, xmm4
- pmaddubsw xmm0, xmm5
-
- lea rdi, [rdi + rdx]
- pmaddubsw xmm2, xmm6
-
- lea rsi, [rsi + rax]
- dec rcx
-
- paddsw xmm0, xmm7
-
- paddsw xmm0, xmm2
-
- psraw xmm0, 7
-
- packuswb xmm0, xmm0
-
- movq MMWORD Ptr [rdi], xmm0
-
- jnz .filter_block1d8_h4_rowloop_ssse3
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-;void vp8_filter_block1d16_h6_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; unsigned int vp8_filter_index
-;)
-global sym(vp8_filter_block1d16_h6_ssse3) PRIVATE
-sym(vp8_filter_block1d16_h6_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movsxd rdx, DWORD PTR arg(5) ;table index
- xor rsi, rsi
- shl rdx, 4 ;
-
- lea rax, [GLOBAL(k0_k5)]
- add rax, rdx
-
- mov rdi, arg(2) ;output_ptr
-
- mov rsi, arg(0) ;src_ptr
-
- movdqa xmm4, XMMWORD PTR [rax] ;k0_k5
- movdqa xmm5, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm6, XMMWORD PTR [rax+128] ;k1_k3
-
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rdx, dword ptr arg(3) ;output_pitch
-
-.filter_block1d16_h6_rowloop_ssse3:
- movq xmm0, MMWORD PTR [rsi - 2] ; -2 -1 0 1 2 3 4 5
-
- movq xmm3, MMWORD PTR [rsi + 3] ; 3 4 5 6 7 8 9 10
-
- punpcklbw xmm0, xmm3 ; -2 3 -1 4 0 5 1 6 2 7 3 8 4 9 5 10
-
- movdqa xmm1, xmm0
- pmaddubsw xmm0, xmm4
-
- movdqa xmm2, xmm1
- pshufb xmm1, [GLOBAL(shuf2bfrom1)]
-
- pshufb xmm2, [GLOBAL(shuf3bfrom1)]
- movq xmm3, MMWORD PTR [rsi + 6]
-
- pmaddubsw xmm1, xmm5
- movq xmm7, MMWORD PTR [rsi + 11]
-
- pmaddubsw xmm2, xmm6
- punpcklbw xmm3, xmm7
-
- paddsw xmm0, xmm1
- movdqa xmm1, xmm3
-
- pmaddubsw xmm3, xmm4
- paddsw xmm0, xmm2
-
- movdqa xmm2, xmm1
- paddsw xmm0, [GLOBAL(rd)]
-
- pshufb xmm1, [GLOBAL(shuf2bfrom1)]
- pshufb xmm2, [GLOBAL(shuf3bfrom1)]
-
- psraw xmm0, 7
- pmaddubsw xmm1, xmm5
-
- pmaddubsw xmm2, xmm6
- packuswb xmm0, xmm0
-
- lea rsi, [rsi + rax]
- paddsw xmm3, xmm1
-
- paddsw xmm3, xmm2
-
- paddsw xmm3, [GLOBAL(rd)]
-
- psraw xmm3, 7
-
- packuswb xmm3, xmm3
-
- punpcklqdq xmm0, xmm3
-
- movdqa XMMWORD Ptr [rdi], xmm0
-
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .filter_block1d16_h6_rowloop_ssse3
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_filter_block1d4_h6_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; unsigned int vp8_filter_index
-;)
-global sym(vp8_filter_block1d4_h6_ssse3) PRIVATE
-sym(vp8_filter_block1d4_h6_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movsxd rdx, DWORD PTR arg(5) ;table index
- xor rsi, rsi
- shl rdx, 4 ;
-
- lea rax, [GLOBAL(k0_k5)]
- add rax, rdx
- movdqa xmm7, [GLOBAL(rd)]
-
- cmp esi, DWORD PTR [rax]
- je .vp8_filter_block1d4_h4_ssse3
-
- movdqa xmm4, XMMWORD PTR [rax] ;k0_k5
- movdqa xmm5, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm6, XMMWORD PTR [rax+128] ;k1_k3
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rcx, dword ptr arg(4) ;output_height
-
- movsxd rdx, dword ptr arg(3) ;output_pitch
-
-;xmm3 free
-.filter_block1d4_h6_rowloop_ssse3:
- movdqu xmm0, XMMWORD PTR [rsi - 2]
-
- movdqa xmm1, xmm0
- pshufb xmm0, [GLOBAL(shuf1b)]
-
- movdqa xmm2, xmm1
- pshufb xmm1, [GLOBAL(shuf2b)]
- pmaddubsw xmm0, xmm4
- pshufb xmm2, [GLOBAL(shuf3b)]
- pmaddubsw xmm1, xmm5
-
-;--
- pmaddubsw xmm2, xmm6
-
- lea rsi, [rsi + rax]
-;--
- paddsw xmm0, xmm1
- paddsw xmm0, xmm7
- pxor xmm1, xmm1
- paddsw xmm0, xmm2
- psraw xmm0, 7
- packuswb xmm0, xmm0
-
- movd DWORD PTR [rdi], xmm0
-
- add rdi, rdx
- dec rcx
- jnz .filter_block1d4_h6_rowloop_ssse3
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-.vp8_filter_block1d4_h4_ssse3:
- movdqa xmm5, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm6, XMMWORD PTR [rax+128] ;k1_k3
- movdqa xmm0, XMMWORD PTR [GLOBAL(shuf2b)]
- movdqa xmm3, XMMWORD PTR [GLOBAL(shuf3b)]
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rcx, dword ptr arg(4) ;output_height
-
- movsxd rdx, dword ptr arg(3) ;output_pitch
-
-.filter_block1d4_h4_rowloop_ssse3:
- movdqu xmm1, XMMWORD PTR [rsi - 2]
-
- movdqa xmm2, xmm1
- pshufb xmm1, xmm0 ;;[GLOBAL(shuf2b)]
- pshufb xmm2, xmm3 ;;[GLOBAL(shuf3b)]
- pmaddubsw xmm1, xmm5
-
-;--
- pmaddubsw xmm2, xmm6
-
- lea rsi, [rsi + rax]
-;--
- paddsw xmm1, xmm7
- paddsw xmm1, xmm2
- psraw xmm1, 7
- packuswb xmm1, xmm1
-
- movd DWORD PTR [rdi], xmm1
-
- add rdi, rdx
- dec rcx
- jnz .filter_block1d4_h4_rowloop_ssse3
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-;void vp8_filter_block1d16_v6_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; unsigned int vp8_filter_index
-;)
-global sym(vp8_filter_block1d16_v6_ssse3) PRIVATE
-sym(vp8_filter_block1d16_v6_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movsxd rdx, DWORD PTR arg(5) ;table index
- xor rsi, rsi
- shl rdx, 4 ;
-
- lea rax, [GLOBAL(k0_k5)]
- add rax, rdx
-
- cmp esi, DWORD PTR [rax]
- je .vp8_filter_block1d16_v4_ssse3
-
- movdqa xmm5, XMMWORD PTR [rax] ;k0_k5
- movdqa xmm6, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm7, XMMWORD PTR [rax+128] ;k1_k3
-
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, DWORD PTR arg(1) ;pixels_per_line
- mov rdi, arg(2) ;output_ptr
-
-%if ABI_IS_32BIT=0
- movsxd r8, DWORD PTR arg(3) ;out_pitch
-%endif
- mov rax, rsi
- movsxd rcx, DWORD PTR arg(4) ;output_height
- add rax, rdx
-
-
-.vp8_filter_block1d16_v6_ssse3_loop:
- movq xmm1, MMWORD PTR [rsi] ;A
- movq xmm2, MMWORD PTR [rsi + rdx] ;B
- movq xmm3, MMWORD PTR [rsi + rdx * 2] ;C
- movq xmm4, MMWORD PTR [rax + rdx * 2] ;D
- movq xmm0, MMWORD PTR [rsi + rdx * 4] ;E
-
- punpcklbw xmm2, xmm4 ;B D
- punpcklbw xmm3, xmm0 ;C E
-
- movq xmm0, MMWORD PTR [rax + rdx * 4] ;F
-
- pmaddubsw xmm3, xmm6
- punpcklbw xmm1, xmm0 ;A F
- pmaddubsw xmm2, xmm7
- pmaddubsw xmm1, xmm5
-
- paddsw xmm2, xmm3
- paddsw xmm2, xmm1
- paddsw xmm2, [GLOBAL(rd)]
- psraw xmm2, 7
- packuswb xmm2, xmm2
-
- movq MMWORD PTR [rdi], xmm2 ;store the results
-
- movq xmm1, MMWORD PTR [rsi + 8] ;A
- movq xmm2, MMWORD PTR [rsi + rdx + 8] ;B
- movq xmm3, MMWORD PTR [rsi + rdx * 2 + 8] ;C
- movq xmm4, MMWORD PTR [rax + rdx * 2 + 8] ;D
- movq xmm0, MMWORD PTR [rsi + rdx * 4 + 8] ;E
-
- punpcklbw xmm2, xmm4 ;B D
- punpcklbw xmm3, xmm0 ;C E
-
- movq xmm0, MMWORD PTR [rax + rdx * 4 + 8] ;F
- pmaddubsw xmm3, xmm6
- punpcklbw xmm1, xmm0 ;A F
- pmaddubsw xmm2, xmm7
- pmaddubsw xmm1, xmm5
-
- add rsi, rdx
- add rax, rdx
-;--
-;--
- paddsw xmm2, xmm3
- paddsw xmm2, xmm1
- paddsw xmm2, [GLOBAL(rd)]
- psraw xmm2, 7
- packuswb xmm2, xmm2
-
- movq MMWORD PTR [rdi+8], xmm2
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;out_pitch
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .vp8_filter_block1d16_v6_ssse3_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-.vp8_filter_block1d16_v4_ssse3:
- movdqa xmm6, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm7, XMMWORD PTR [rax+128] ;k1_k3
-
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, DWORD PTR arg(1) ;pixels_per_line
- mov rdi, arg(2) ;output_ptr
-
-%if ABI_IS_32BIT=0
- movsxd r8, DWORD PTR arg(3) ;out_pitch
-%endif
- mov rax, rsi
- movsxd rcx, DWORD PTR arg(4) ;output_height
- add rax, rdx
-
-.vp8_filter_block1d16_v4_ssse3_loop:
- movq xmm2, MMWORD PTR [rsi + rdx] ;B
- movq xmm3, MMWORD PTR [rsi + rdx * 2] ;C
- movq xmm4, MMWORD PTR [rax + rdx * 2] ;D
- movq xmm0, MMWORD PTR [rsi + rdx * 4] ;E
-
- punpcklbw xmm2, xmm4 ;B D
- punpcklbw xmm3, xmm0 ;C E
-
- pmaddubsw xmm3, xmm6
- pmaddubsw xmm2, xmm7
- movq xmm5, MMWORD PTR [rsi + rdx + 8] ;B
- movq xmm1, MMWORD PTR [rsi + rdx * 2 + 8] ;C
- movq xmm4, MMWORD PTR [rax + rdx * 2 + 8] ;D
- movq xmm0, MMWORD PTR [rsi + rdx * 4 + 8] ;E
-
- paddsw xmm2, [GLOBAL(rd)]
- paddsw xmm2, xmm3
- psraw xmm2, 7
- packuswb xmm2, xmm2
-
- punpcklbw xmm5, xmm4 ;B D
- punpcklbw xmm1, xmm0 ;C E
-
- pmaddubsw xmm1, xmm6
- pmaddubsw xmm5, xmm7
-
- movdqa xmm4, [GLOBAL(rd)]
- add rsi, rdx
- add rax, rdx
-;--
-;--
- paddsw xmm5, xmm1
- paddsw xmm5, xmm4
- psraw xmm5, 7
- packuswb xmm5, xmm5
-
- punpcklqdq xmm2, xmm5
-
- movdqa XMMWORD PTR [rdi], xmm2
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;out_pitch
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .vp8_filter_block1d16_v4_ssse3_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_filter_block1d8_v6_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; unsigned int vp8_filter_index
-;)
-global sym(vp8_filter_block1d8_v6_ssse3) PRIVATE
-sym(vp8_filter_block1d8_v6_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movsxd rdx, DWORD PTR arg(5) ;table index
- xor rsi, rsi
- shl rdx, 4 ;
-
- lea rax, [GLOBAL(k0_k5)]
- add rax, rdx
-
- movsxd rdx, DWORD PTR arg(1) ;pixels_per_line
- mov rdi, arg(2) ;output_ptr
-%if ABI_IS_32BIT=0
- movsxd r8, DWORD PTR arg(3) ; out_pitch
-%endif
- movsxd rcx, DWORD PTR arg(4) ;[output_height]
-
- cmp esi, DWORD PTR [rax]
- je .vp8_filter_block1d8_v4_ssse3
-
- movdqa xmm5, XMMWORD PTR [rax] ;k0_k5
- movdqa xmm6, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm7, XMMWORD PTR [rax+128] ;k1_k3
-
- mov rsi, arg(0) ;src_ptr
-
- mov rax, rsi
- add rax, rdx
-
-.vp8_filter_block1d8_v6_ssse3_loop:
- movq xmm1, MMWORD PTR [rsi] ;A
- movq xmm2, MMWORD PTR [rsi + rdx] ;B
- movq xmm3, MMWORD PTR [rsi + rdx * 2] ;C
- movq xmm4, MMWORD PTR [rax + rdx * 2] ;D
- movq xmm0, MMWORD PTR [rsi + rdx * 4] ;E
-
- punpcklbw xmm2, xmm4 ;B D
- punpcklbw xmm3, xmm0 ;C E
-
- movq xmm0, MMWORD PTR [rax + rdx * 4] ;F
- movdqa xmm4, [GLOBAL(rd)]
-
- pmaddubsw xmm3, xmm6
- punpcklbw xmm1, xmm0 ;A F
- pmaddubsw xmm2, xmm7
- pmaddubsw xmm1, xmm5
- add rsi, rdx
- add rax, rdx
-;--
-;--
- paddsw xmm2, xmm3
- paddsw xmm2, xmm1
- paddsw xmm2, xmm4
- psraw xmm2, 7
- packuswb xmm2, xmm2
-
- movq MMWORD PTR [rdi], xmm2
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;[out_pitch]
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .vp8_filter_block1d8_v6_ssse3_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-.vp8_filter_block1d8_v4_ssse3:
- movdqa xmm6, XMMWORD PTR [rax+256] ;k2_k4
- movdqa xmm7, XMMWORD PTR [rax+128] ;k1_k3
- movdqa xmm5, [GLOBAL(rd)]
-
- mov rsi, arg(0) ;src_ptr
-
- mov rax, rsi
- add rax, rdx
-
-.vp8_filter_block1d8_v4_ssse3_loop:
- movq xmm2, MMWORD PTR [rsi + rdx] ;B
- movq xmm3, MMWORD PTR [rsi + rdx * 2] ;C
- movq xmm4, MMWORD PTR [rax + rdx * 2] ;D
- movq xmm0, MMWORD PTR [rsi + rdx * 4] ;E
-
- punpcklbw xmm2, xmm4 ;B D
- punpcklbw xmm3, xmm0 ;C E
-
- pmaddubsw xmm3, xmm6
- pmaddubsw xmm2, xmm7
- add rsi, rdx
- add rax, rdx
-;--
-;--
- paddsw xmm2, xmm3
- paddsw xmm2, xmm5
- psraw xmm2, 7
- packuswb xmm2, xmm2
-
- movq MMWORD PTR [rdi], xmm2
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;[out_pitch]
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .vp8_filter_block1d8_v4_ssse3_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-;void vp8_filter_block1d4_v6_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; unsigned int vp8_filter_index
-;)
-global sym(vp8_filter_block1d4_v6_ssse3) PRIVATE
-sym(vp8_filter_block1d4_v6_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movsxd rdx, DWORD PTR arg(5) ;table index
- xor rsi, rsi
- shl rdx, 4 ;
-
- lea rax, [GLOBAL(k0_k5)]
- add rax, rdx
-
- movsxd rdx, DWORD PTR arg(1) ;pixels_per_line
- mov rdi, arg(2) ;output_ptr
-%if ABI_IS_32BIT=0
- movsxd r8, DWORD PTR arg(3) ; out_pitch
-%endif
- movsxd rcx, DWORD PTR arg(4) ;[output_height]
-
- cmp esi, DWORD PTR [rax]
- je .vp8_filter_block1d4_v4_ssse3
-
- movq mm5, MMWORD PTR [rax] ;k0_k5
- movq mm6, MMWORD PTR [rax+256] ;k2_k4
- movq mm7, MMWORD PTR [rax+128] ;k1_k3
-
- mov rsi, arg(0) ;src_ptr
-
- mov rax, rsi
- add rax, rdx
-
-.vp8_filter_block1d4_v6_ssse3_loop:
- movd mm1, DWORD PTR [rsi] ;A
- movd mm2, DWORD PTR [rsi + rdx] ;B
- movd mm3, DWORD PTR [rsi + rdx * 2] ;C
- movd mm4, DWORD PTR [rax + rdx * 2] ;D
- movd mm0, DWORD PTR [rsi + rdx * 4] ;E
-
- punpcklbw mm2, mm4 ;B D
- punpcklbw mm3, mm0 ;C E
-
- movd mm0, DWORD PTR [rax + rdx * 4] ;F
-
- movq mm4, [GLOBAL(rd)]
-
- pmaddubsw mm3, mm6
- punpcklbw mm1, mm0 ;A F
- pmaddubsw mm2, mm7
- pmaddubsw mm1, mm5
- add rsi, rdx
- add rax, rdx
-;--
-;--
- paddsw mm2, mm3
- paddsw mm2, mm1
- paddsw mm2, mm4
- psraw mm2, 7
- packuswb mm2, mm2
-
- movd DWORD PTR [rdi], mm2
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;[out_pitch]
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .vp8_filter_block1d4_v6_ssse3_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-.vp8_filter_block1d4_v4_ssse3:
- movq mm6, MMWORD PTR [rax+256] ;k2_k4
- movq mm7, MMWORD PTR [rax+128] ;k1_k3
- movq mm5, MMWORD PTR [GLOBAL(rd)]
-
- mov rsi, arg(0) ;src_ptr
-
- mov rax, rsi
- add rax, rdx
-
-.vp8_filter_block1d4_v4_ssse3_loop:
- movd mm2, DWORD PTR [rsi + rdx] ;B
- movd mm3, DWORD PTR [rsi + rdx * 2] ;C
- movd mm4, DWORD PTR [rax + rdx * 2] ;D
- movd mm0, DWORD PTR [rsi + rdx * 4] ;E
-
- punpcklbw mm2, mm4 ;B D
- punpcklbw mm3, mm0 ;C E
-
- pmaddubsw mm3, mm6
- pmaddubsw mm2, mm7
- add rsi, rdx
- add rax, rdx
-;--
-;--
- paddsw mm2, mm3
- paddsw mm2, mm5
- psraw mm2, 7
- packuswb mm2, mm2
-
- movd DWORD PTR [rdi], mm2
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;[out_pitch]
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .vp8_filter_block1d4_v4_ssse3_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_bilinear_predict16x16_ssse3
-;(
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; int xoffset,
-; int yoffset,
-; unsigned char *dst_ptr,
-; int dst_pitch
-;)
-global sym(vp8_bilinear_predict16x16_ssse3) PRIVATE
-sym(vp8_bilinear_predict16x16_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- lea rcx, [GLOBAL(vp8_bilinear_filters_ssse3)]
- movsxd rax, dword ptr arg(2) ; xoffset
-
- cmp rax, 0 ; skip first_pass filter if xoffset=0
- je .b16x16_sp_only
-
- shl rax, 4
- lea rax, [rax + rcx] ; HFilter
-
- mov rdi, arg(4) ; dst_ptr
- mov rsi, arg(0) ; src_ptr
- movsxd rdx, dword ptr arg(5) ; dst_pitch
-
- movdqa xmm1, [rax]
-
- movsxd rax, dword ptr arg(3) ; yoffset
-
- cmp rax, 0 ; skip second_pass filter if yoffset=0
- je .b16x16_fp_only
-
- shl rax, 4
- lea rax, [rax + rcx] ; VFilter
-
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rdx, dword ptr arg(1) ; src_pixels_per_line
-
- movdqa xmm2, [rax]
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(5) ; dst_pitch
-%endif
- movq xmm3, [rsi] ; 00 01 02 03 04 05 06 07
- movq xmm5, [rsi+1] ; 01 02 03 04 05 06 07 08
-
- punpcklbw xmm3, xmm5 ; 00 01 01 02 02 03 03 04 04 05 05 06 06 07 07 08
- movq xmm4, [rsi+8] ; 08 09 10 11 12 13 14 15
-
- movq xmm5, [rsi+9] ; 09 10 11 12 13 14 15 16
-
- lea rsi, [rsi + rdx] ; next line
-
- pmaddubsw xmm3, xmm1 ; 00 02 04 06 08 10 12 14
-
- punpcklbw xmm4, xmm5 ; 08 09 09 10 10 11 11 12 12 13 13 14 14 15 15 16
- pmaddubsw xmm4, xmm1 ; 01 03 05 07 09 11 13 15
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- paddw xmm4, [GLOBAL(rd)] ; xmm4 += round value
- psraw xmm4, VP8_FILTER_SHIFT ; xmm4 /= 128
-
- movdqa xmm7, xmm3
- packuswb xmm7, xmm4 ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
-
-.next_row:
- movq xmm6, [rsi] ; 00 01 02 03 04 05 06 07
- movq xmm5, [rsi+1] ; 01 02 03 04 05 06 07 08
-
- punpcklbw xmm6, xmm5
- movq xmm4, [rsi+8] ; 08 09 10 11 12 13 14 15
-
- movq xmm5, [rsi+9] ; 09 10 11 12 13 14 15 16
- lea rsi, [rsi + rdx] ; next line
-
- pmaddubsw xmm6, xmm1
-
- punpcklbw xmm4, xmm5
- pmaddubsw xmm4, xmm1
-
- paddw xmm6, [GLOBAL(rd)] ; xmm6 += round value
- psraw xmm6, VP8_FILTER_SHIFT ; xmm6 /= 128
-
- paddw xmm4, [GLOBAL(rd)] ; xmm4 += round value
- psraw xmm4, VP8_FILTER_SHIFT ; xmm4 /= 128
-
- packuswb xmm6, xmm4
- movdqa xmm5, xmm7
-
- punpcklbw xmm5, xmm6
- pmaddubsw xmm5, xmm2
-
- punpckhbw xmm7, xmm6
- pmaddubsw xmm7, xmm2
-
- paddw xmm5, [GLOBAL(rd)] ; xmm5 += round value
- psraw xmm5, VP8_FILTER_SHIFT ; xmm5 /= 128
-
- paddw xmm7, [GLOBAL(rd)] ; xmm7 += round value
- psraw xmm7, VP8_FILTER_SHIFT ; xmm7 /= 128
-
- packuswb xmm5, xmm7
- movdqa xmm7, xmm6
-
- movdqa [rdi], xmm5 ; store the results in the destination
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(5) ; dst_pitch
-%else
- add rdi, r8
-%endif
-
- cmp rdi, rcx
- jne .next_row
-
- jmp .done
-
-.b16x16_sp_only:
- movsxd rax, dword ptr arg(3) ; yoffset
- shl rax, 4
- lea rax, [rax + rcx] ; VFilter
-
- mov rdi, arg(4) ; dst_ptr
- mov rsi, arg(0) ; src_ptr
- movsxd rdx, dword ptr arg(5) ; dst_pitch
-
- movdqa xmm1, [rax] ; VFilter
-
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rax, dword ptr arg(1) ; src_pixels_per_line
-
- ; get the first horizontal line done
- movq xmm4, [rsi] ; load row 0
- movq xmm2, [rsi + 8] ; load row 0
-
- lea rsi, [rsi + rax] ; next line
-.next_row_sp:
- movq xmm3, [rsi] ; load row + 1
- movq xmm5, [rsi + 8] ; load row + 1
-
- punpcklbw xmm4, xmm3
- punpcklbw xmm2, xmm5
-
- pmaddubsw xmm4, xmm1
- movq xmm7, [rsi + rax] ; load row + 2
-
- pmaddubsw xmm2, xmm1
- movq xmm6, [rsi + rax + 8] ; load row + 2
-
- punpcklbw xmm3, xmm7
- punpcklbw xmm5, xmm6
-
- pmaddubsw xmm3, xmm1
- paddw xmm4, [GLOBAL(rd)]
-
- pmaddubsw xmm5, xmm1
- paddw xmm2, [GLOBAL(rd)]
-
- psraw xmm4, VP8_FILTER_SHIFT
- psraw xmm2, VP8_FILTER_SHIFT
-
- packuswb xmm4, xmm2
- paddw xmm3, [GLOBAL(rd)]
-
- movdqa [rdi], xmm4 ; store row 0
- paddw xmm5, [GLOBAL(rd)]
-
- psraw xmm3, VP8_FILTER_SHIFT
- psraw xmm5, VP8_FILTER_SHIFT
-
- packuswb xmm3, xmm5
- movdqa xmm4, xmm7
-
- movdqa [rdi + rdx],xmm3 ; store row 1
- lea rsi, [rsi + 2*rax]
-
- movdqa xmm2, xmm6
- lea rdi, [rdi + 2*rdx]
-
- cmp rdi, rcx
- jne .next_row_sp
-
- jmp .done
-
-.b16x16_fp_only:
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rax, dword ptr arg(1) ; src_pixels_per_line
-
-.next_row_fp:
- movq xmm2, [rsi] ; 00 01 02 03 04 05 06 07
- movq xmm4, [rsi+1] ; 01 02 03 04 05 06 07 08
-
- punpcklbw xmm2, xmm4
- movq xmm3, [rsi+8] ; 08 09 10 11 12 13 14 15
-
- pmaddubsw xmm2, xmm1
- movq xmm4, [rsi+9] ; 09 10 11 12 13 14 15 16
-
- lea rsi, [rsi + rax] ; next line
- punpcklbw xmm3, xmm4
-
- pmaddubsw xmm3, xmm1
- movq xmm5, [rsi]
-
- paddw xmm2, [GLOBAL(rd)]
- movq xmm7, [rsi+1]
-
- movq xmm6, [rsi+8]
- psraw xmm2, VP8_FILTER_SHIFT
-
- punpcklbw xmm5, xmm7
- movq xmm7, [rsi+9]
-
- paddw xmm3, [GLOBAL(rd)]
- pmaddubsw xmm5, xmm1
-
- psraw xmm3, VP8_FILTER_SHIFT
- punpcklbw xmm6, xmm7
-
- packuswb xmm2, xmm3
- pmaddubsw xmm6, xmm1
-
- movdqa [rdi], xmm2 ; store the results in the destination
- paddw xmm5, [GLOBAL(rd)]
-
- lea rdi, [rdi + rdx] ; dst_pitch
- psraw xmm5, VP8_FILTER_SHIFT
-
- paddw xmm6, [GLOBAL(rd)]
- psraw xmm6, VP8_FILTER_SHIFT
-
- packuswb xmm5, xmm6
- lea rsi, [rsi + rax] ; next line
-
- movdqa [rdi], xmm5 ; store the results in the destination
- lea rdi, [rdi + rdx] ; dst_pitch
-
- cmp rdi, rcx
-
- jne .next_row_fp
-
-.done:
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_bilinear_predict8x8_ssse3
-;(
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; int xoffset,
-; int yoffset,
-; unsigned char *dst_ptr,
-; int dst_pitch
-;)
-global sym(vp8_bilinear_predict8x8_ssse3) PRIVATE
-sym(vp8_bilinear_predict8x8_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 144 ; reserve 144 bytes
-
- lea rcx, [GLOBAL(vp8_bilinear_filters_ssse3)]
-
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
-
- ;Read 9-line unaligned data in and put them on stack. This gives a big
- ;performance boost.
- movdqu xmm0, [rsi]
- lea rax, [rdx + rdx*2]
- movdqu xmm1, [rsi+rdx]
- movdqu xmm2, [rsi+rdx*2]
- add rsi, rax
- movdqu xmm3, [rsi]
- movdqu xmm4, [rsi+rdx]
- movdqu xmm5, [rsi+rdx*2]
- add rsi, rax
- movdqu xmm6, [rsi]
- movdqu xmm7, [rsi+rdx]
-
- movdqa XMMWORD PTR [rsp], xmm0
-
- movdqu xmm0, [rsi+rdx*2]
-
- movdqa XMMWORD PTR [rsp+16], xmm1
- movdqa XMMWORD PTR [rsp+32], xmm2
- movdqa XMMWORD PTR [rsp+48], xmm3
- movdqa XMMWORD PTR [rsp+64], xmm4
- movdqa XMMWORD PTR [rsp+80], xmm5
- movdqa XMMWORD PTR [rsp+96], xmm6
- movdqa XMMWORD PTR [rsp+112], xmm7
- movdqa XMMWORD PTR [rsp+128], xmm0
-
- movsxd rax, dword ptr arg(2) ; xoffset
- cmp rax, 0 ; skip first_pass filter if xoffset=0
- je .b8x8_sp_only
-
- shl rax, 4
- add rax, rcx ; HFilter
-
- mov rdi, arg(4) ; dst_ptr
- movsxd rdx, dword ptr arg(5) ; dst_pitch
-
- movdqa xmm0, [rax]
-
- movsxd rax, dword ptr arg(3) ; yoffset
- cmp rax, 0 ; skip second_pass filter if yoffset=0
- je .b8x8_fp_only
-
- shl rax, 4
- lea rax, [rax + rcx] ; VFilter
-
- lea rcx, [rdi+rdx*8]
-
- movdqa xmm1, [rax]
-
- ; get the first horizontal line done
- movdqa xmm3, [rsp] ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
- movdqa xmm5, xmm3 ; 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 xx
-
- psrldq xmm5, 1
- lea rsp, [rsp + 16] ; next line
-
- punpcklbw xmm3, xmm5 ; 00 01 01 02 02 03 03 04 04 05 05 06 06 07 07 08
- pmaddubsw xmm3, xmm0 ; 00 02 04 06 08 10 12 14
-
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
-
- movdqa xmm7, xmm3
- packuswb xmm7, xmm7 ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
-
-.next_row:
- movdqa xmm6, [rsp] ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
- lea rsp, [rsp + 16] ; next line
-
- movdqa xmm5, xmm6
-
- psrldq xmm5, 1
-
- punpcklbw xmm6, xmm5
- pmaddubsw xmm6, xmm0
-
- paddw xmm6, [GLOBAL(rd)] ; xmm6 += round value
- psraw xmm6, VP8_FILTER_SHIFT ; xmm6 /= 128
-
- packuswb xmm6, xmm6
-
- punpcklbw xmm7, xmm6
- pmaddubsw xmm7, xmm1
-
- paddw xmm7, [GLOBAL(rd)] ; xmm7 += round value
- psraw xmm7, VP8_FILTER_SHIFT ; xmm7 /= 128
-
- packuswb xmm7, xmm7
-
- movq [rdi], xmm7 ; store the results in the destination
- lea rdi, [rdi + rdx]
-
- movdqa xmm7, xmm6
-
- cmp rdi, rcx
- jne .next_row
-
- jmp .done8x8
-
-.b8x8_sp_only:
- movsxd rax, dword ptr arg(3) ; yoffset
- shl rax, 4
- lea rax, [rax + rcx] ; VFilter
-
- mov rdi, arg(4) ;dst_ptr
- movsxd rdx, dword ptr arg(5) ; dst_pitch
-
- movdqa xmm0, [rax] ; VFilter
-
- movq xmm1, XMMWORD PTR [rsp]
- movq xmm2, XMMWORD PTR [rsp+16]
-
- movq xmm3, XMMWORD PTR [rsp+32]
- punpcklbw xmm1, xmm2
-
- movq xmm4, XMMWORD PTR [rsp+48]
- punpcklbw xmm2, xmm3
-
- movq xmm5, XMMWORD PTR [rsp+64]
- punpcklbw xmm3, xmm4
-
- movq xmm6, XMMWORD PTR [rsp+80]
- punpcklbw xmm4, xmm5
-
- movq xmm7, XMMWORD PTR [rsp+96]
- punpcklbw xmm5, xmm6
-
- pmaddubsw xmm1, xmm0
- pmaddubsw xmm2, xmm0
-
- pmaddubsw xmm3, xmm0
- pmaddubsw xmm4, xmm0
-
- pmaddubsw xmm5, xmm0
- punpcklbw xmm6, xmm7
-
- pmaddubsw xmm6, xmm0
- paddw xmm1, [GLOBAL(rd)]
-
- paddw xmm2, [GLOBAL(rd)]
- psraw xmm1, VP8_FILTER_SHIFT
-
- paddw xmm3, [GLOBAL(rd)]
- psraw xmm2, VP8_FILTER_SHIFT
-
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm3, VP8_FILTER_SHIFT
-
- paddw xmm5, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
-
- paddw xmm6, [GLOBAL(rd)]
- psraw xmm5, VP8_FILTER_SHIFT
-
- psraw xmm6, VP8_FILTER_SHIFT
- packuswb xmm1, xmm1
-
- packuswb xmm2, xmm2
- movq [rdi], xmm1
-
- packuswb xmm3, xmm3
- movq [rdi+rdx], xmm2
-
- packuswb xmm4, xmm4
- movq xmm1, XMMWORD PTR [rsp+112]
-
- lea rdi, [rdi + 2*rdx]
- movq xmm2, XMMWORD PTR [rsp+128]
-
- packuswb xmm5, xmm5
- movq [rdi], xmm3
-
- packuswb xmm6, xmm6
- movq [rdi+rdx], xmm4
-
- lea rdi, [rdi + 2*rdx]
- punpcklbw xmm7, xmm1
-
- movq [rdi], xmm5
- pmaddubsw xmm7, xmm0
-
- movq [rdi+rdx], xmm6
- punpcklbw xmm1, xmm2
-
- pmaddubsw xmm1, xmm0
- paddw xmm7, [GLOBAL(rd)]
-
- psraw xmm7, VP8_FILTER_SHIFT
- paddw xmm1, [GLOBAL(rd)]
-
- psraw xmm1, VP8_FILTER_SHIFT
- packuswb xmm7, xmm7
-
- packuswb xmm1, xmm1
- lea rdi, [rdi + 2*rdx]
-
- movq [rdi], xmm7
-
- movq [rdi+rdx], xmm1
- lea rsp, [rsp + 144]
-
- jmp .done8x8
-
-.b8x8_fp_only:
- lea rcx, [rdi+rdx*8]
-
-.next_row_fp:
- movdqa xmm1, XMMWORD PTR [rsp]
- movdqa xmm3, XMMWORD PTR [rsp+16]
-
- movdqa xmm2, xmm1
- movdqa xmm5, XMMWORD PTR [rsp+32]
-
- psrldq xmm2, 1
- movdqa xmm7, XMMWORD PTR [rsp+48]
-
- movdqa xmm4, xmm3
- psrldq xmm4, 1
-
- movdqa xmm6, xmm5
- psrldq xmm6, 1
-
- punpcklbw xmm1, xmm2
- pmaddubsw xmm1, xmm0
-
- punpcklbw xmm3, xmm4
- pmaddubsw xmm3, xmm0
-
- punpcklbw xmm5, xmm6
- pmaddubsw xmm5, xmm0
-
- movdqa xmm2, xmm7
- psrldq xmm2, 1
-
- punpcklbw xmm7, xmm2
- pmaddubsw xmm7, xmm0
-
- paddw xmm1, [GLOBAL(rd)]
- psraw xmm1, VP8_FILTER_SHIFT
-
- paddw xmm3, [GLOBAL(rd)]
- psraw xmm3, VP8_FILTER_SHIFT
-
- paddw xmm5, [GLOBAL(rd)]
- psraw xmm5, VP8_FILTER_SHIFT
-
- paddw xmm7, [GLOBAL(rd)]
- psraw xmm7, VP8_FILTER_SHIFT
-
- packuswb xmm1, xmm1
- packuswb xmm3, xmm3
-
- packuswb xmm5, xmm5
- movq [rdi], xmm1
-
- packuswb xmm7, xmm7
- movq [rdi+rdx], xmm3
-
- lea rdi, [rdi + 2*rdx]
- movq [rdi], xmm5
-
- lea rsp, [rsp + 4*16]
- movq [rdi+rdx], xmm7
-
- lea rdi, [rdi + 2*rdx]
- cmp rdi, rcx
-
- jne .next_row_fp
-
- lea rsp, [rsp + 16]
-
-.done8x8:
- ;add rsp, 144
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-shuf1b:
- db 0, 5, 1, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12
-shuf2b:
- db 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11
-shuf3b:
- db 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10
-
-align 16
-shuf2bfrom1:
- db 4, 8, 6, 1, 8, 3, 1, 5, 3, 7, 5, 9, 7,11, 9,13
-align 16
-shuf3bfrom1:
- db 2, 6, 4, 8, 6, 1, 8, 3, 1, 5, 3, 7, 5, 9, 7,11
-
-align 16
-rd:
- times 8 dw 0x40
-
-align 16
-k0_k5:
- times 8 db 0, 0 ;placeholder
- times 8 db 0, 0
- times 8 db 2, 1
- times 8 db 0, 0
- times 8 db 3, 3
- times 8 db 0, 0
- times 8 db 1, 2
- times 8 db 0, 0
-k1_k3:
- times 8 db 0, 0 ;placeholder
- times 8 db -6, 12
- times 8 db -11, 36
- times 8 db -9, 50
- times 8 db -16, 77
- times 8 db -6, 93
- times 8 db -8, 108
- times 8 db -1, 123
-k2_k4:
- times 8 db 128, 0 ;placeholder
- times 8 db 123, -1
- times 8 db 108, -8
- times 8 db 93, -6
- times 8 db 77, -16
- times 8 db 50, -9
- times 8 db 36, -11
- times 8 db 12, -6
-align 16
-vp8_bilinear_filters_ssse3:
- times 8 db 128, 0
- times 8 db 112, 16
- times 8 db 96, 32
- times 8 db 80, 48
- times 8 db 64, 64
- times 8 db 48, 80
- times 8 db 32, 96
- times 8 db 16, 112
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_mmx.asm
deleted file mode 100644
index d9120d0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_mmx.asm
+++ /dev/null
@@ -1,851 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;unsigned int vp8_get_mb_ss_mmx( short *src_ptr )
-global sym(vp8_get_mb_ss_mmx) PRIVATE
-sym(vp8_get_mb_ss_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 8
- ; end prolog
-
- mov rax, arg(0) ;src_ptr
- mov rcx, 16
- pxor mm4, mm4
-
-.NEXTROW:
- movq mm0, [rax]
- movq mm1, [rax+8]
- movq mm2, [rax+16]
- movq mm3, [rax+24]
- pmaddwd mm0, mm0
- pmaddwd mm1, mm1
- pmaddwd mm2, mm2
- pmaddwd mm3, mm3
-
- paddd mm4, mm0
- paddd mm4, mm1
- paddd mm4, mm2
- paddd mm4, mm3
-
- add rax, 32
- dec rcx
- ja .NEXTROW
- movq QWORD PTR [rsp], mm4
-
- ;return sum[0]+sum[1];
- movsxd rax, dword ptr [rsp]
- movsxd rcx, dword ptr [rsp+4]
- add rax, rcx
-
-
- ; begin epilog
- add rsp, 8
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_get8x8var_mmx
-;(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride,
-; unsigned int *SSE,
-; int *Sum
-;)
-global sym(vp8_get8x8var_mmx) PRIVATE
-sym(vp8_get8x8var_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- push rbx
- sub rsp, 16
- ; end prolog
-
-
- pxor mm5, mm5 ; Blank mmx6
- pxor mm6, mm6 ; Blank mmx7
- pxor mm7, mm7 ; Blank mmx7
-
- mov rax, arg(0) ;[src_ptr] ; Load base addresses
- mov rbx, arg(2) ;[ref_ptr]
- movsxd rcx, dword ptr arg(1) ;[source_stride]
- movsxd rdx, dword ptr arg(3) ;[recon_stride]
-
- ; Row 1
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm1, [rbx] ; Copy eight bytes to mm1
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
-
- ; Row 2
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 3
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 4
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 5
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- ; movq mm4, [rbx + rdx]
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 6
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 7
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 8
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Now accumulate the final results.
- movq QWORD PTR [rsp+8], mm5 ; copy back accumulated results into normal memory
- movq QWORD PTR [rsp], mm7 ; copy back accumulated results into normal memory
- movsx rdx, WORD PTR [rsp+8]
- movsx rcx, WORD PTR [rsp+10]
- movsx rbx, WORD PTR [rsp+12]
- movsx rax, WORD PTR [rsp+14]
- add rdx, rcx
- add rbx, rax
- add rdx, rbx ;XSum
- movsxd rax, DWORD PTR [rsp]
- movsxd rcx, DWORD PTR [rsp+4]
- add rax, rcx ;XXSum
- mov rsi, arg(4) ;SSE
- mov rdi, arg(5) ;Sum
- mov dword ptr [rsi], eax
- mov dword ptr [rdi], edx
- xor rax, rax ; return 0
-
-
- ; begin epilog
- add rsp, 16
- pop rbx
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-;unsigned int
-;vp8_get4x4var_mmx
-;(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride,
-; unsigned int *SSE,
-; int *Sum
-;)
-global sym(vp8_get4x4var_mmx) PRIVATE
-sym(vp8_get4x4var_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- push rbx
- sub rsp, 16
- ; end prolog
-
-
- pxor mm5, mm5 ; Blank mmx6
- pxor mm6, mm6 ; Blank mmx7
- pxor mm7, mm7 ; Blank mmx7
-
- mov rax, arg(0) ;[src_ptr] ; Load base addresses
- mov rbx, arg(2) ;[ref_ptr]
- movsxd rcx, dword ptr arg(1) ;[source_stride]
- movsxd rdx, dword ptr arg(3) ;[recon_stride]
-
- ; Row 1
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm1, [rbx] ; Copy eight bytes to mm1
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- paddw mm5, mm0 ; accumulate differences in mm5
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
-
- ; Row 2
- movq mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- paddw mm5, mm0 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 3
- movq mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- paddw mm5, mm0 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 4
- movq mm0, [rax] ; Copy eight bytes to mm0
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
-
- paddw mm5, mm0 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- paddd mm7, mm0 ; accumulate in mm7
-
-
- ; Now accumulate the final results.
- movq QWORD PTR [rsp+8], mm5 ; copy back accumulated results into normal memory
- movq QWORD PTR [rsp], mm7 ; copy back accumulated results into normal memory
- movsx rdx, WORD PTR [rsp+8]
- movsx rcx, WORD PTR [rsp+10]
- movsx rbx, WORD PTR [rsp+12]
- movsx rax, WORD PTR [rsp+14]
- add rdx, rcx
- add rbx, rax
- add rdx, rbx ;XSum
- movsxd rax, DWORD PTR [rsp]
- movsxd rcx, DWORD PTR [rsp+4]
- add rax, rcx ;XXSum
- mov rsi, arg(4) ;SSE
- mov rdi, arg(5) ;Sum
- mov dword ptr [rsi], eax
- mov dword ptr [rdi], edx
- xor rax, rax ; return 0
-
-
- ; begin epilog
- add rsp, 16
- pop rbx
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-;unsigned int
-;vp8_get4x4sse_cs_mmx
-;(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride
-;)
-global sym(vp8_get4x4sse_cs_mmx) PRIVATE
-sym(vp8_get4x4sse_cs_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- push rbx
- ; end prolog
-
-
- pxor mm6, mm6 ; Blank mmx7
- pxor mm7, mm7 ; Blank mmx7
-
- mov rax, arg(0) ;[src_ptr] ; Load base addresses
- mov rbx, arg(2) ;[ref_ptr]
- movsxd rcx, dword ptr arg(1) ;[source_stride]
- movsxd rdx, dword ptr arg(3) ;[recon_stride]
- ; Row 1
- movd mm0, [rax] ; Copy eight bytes to mm0
- movd mm1, [rbx] ; Copy eight bytes to mm1
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 2
- movd mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 3
- movd mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm1, mm6
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- psubsw mm0, mm1 ; A-B (low order) to MM0
-
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 4
- movd mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- pmaddwd mm0, mm0 ; square and accumulate
- paddd mm7, mm0 ; accumulate in mm7
-
- movq mm0, mm7 ;
- psrlq mm7, 32
-
- paddd mm0, mm7
- movq rax, mm0
-
-
- ; begin epilog
- pop rbx
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-%define mmx_filter_shift 7
-
-;void vp8_filter_block2d_bil4x4_var_mmx
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned short *HFilter,
-; unsigned short *VFilter,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_filter_block2d_bil4x4_var_mmx) PRIVATE
-sym(vp8_filter_block2d_bil4x4_var_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 16
- ; end prolog
-
-
- pxor mm6, mm6 ;
- pxor mm7, mm7 ;
-
- mov rax, arg(4) ;HFilter ;
- mov rdx, arg(5) ;VFilter ;
-
- mov rsi, arg(0) ;ref_ptr ;
- mov rdi, arg(2) ;src_ptr ;
-
- mov rcx, 4 ;
- pxor mm0, mm0 ;
-
- movd mm1, [rsi] ;
- movd mm3, [rsi+1] ;
-
- punpcklbw mm1, mm0 ;
- pmullw mm1, [rax] ;
-
- punpcklbw mm3, mm0 ;
- pmullw mm3, [rax+8] ;
-
- paddw mm1, mm3 ;
- paddw mm1, [GLOBAL(mmx_bi_rd)] ;
-
- psraw mm1, mmx_filter_shift ;
- movq mm5, mm1
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line ;
-%else
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line ;
- add rsi, r8
-%endif
-
-.filter_block2d_bil4x4_var_mmx_loop:
-
- movd mm1, [rsi] ;
- movd mm3, [rsi+1] ;
-
- punpcklbw mm1, mm0 ;
- pmullw mm1, [rax] ;
-
- punpcklbw mm3, mm0 ;
- pmullw mm3, [rax+8] ;
-
- paddw mm1, mm3 ;
- paddw mm1, [GLOBAL(mmx_bi_rd)] ;
-
- psraw mm1, mmx_filter_shift ;
- movq mm3, mm5 ;
-
- movq mm5, mm1 ;
- pmullw mm3, [rdx] ;
-
- pmullw mm1, [rdx+8] ;
- paddw mm1, mm3 ;
-
-
- paddw mm1, [GLOBAL(mmx_bi_rd)] ;
- psraw mm1, mmx_filter_shift ;
-
- movd mm3, [rdi] ;
- punpcklbw mm3, mm0 ;
-
- psubw mm1, mm3 ;
- paddw mm6, mm1 ;
-
- pmaddwd mm1, mm1 ;
- paddd mm7, mm1 ;
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line ;
- add rdi, dword ptr arg(3) ;src_pixels_per_line ;
-%else
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
- add rsi, r8
- add rdi, r9
-%endif
- sub rcx, 1 ;
- jnz .filter_block2d_bil4x4_var_mmx_loop ;
-
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rdi, arg(6) ;sum
- mov rsi, arg(7) ;sumsquared
-
- movd dword ptr [rdi], mm2 ;
- movd dword ptr [rsi], mm4 ;
-
-
-
- ; begin epilog
- add rsp, 16
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-
-;void vp8_filter_block2d_bil_var_mmx
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; unsigned short *HFilter,
-; unsigned short *VFilter,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_filter_block2d_bil_var_mmx) PRIVATE
-sym(vp8_filter_block2d_bil_var_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 9
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 16
- ; end prolog
-
- pxor mm6, mm6 ;
- pxor mm7, mm7 ;
- mov rax, arg(5) ;HFilter ;
-
- mov rdx, arg(6) ;VFilter ;
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
-
- pxor mm0, mm0 ;
- movq mm1, [rsi] ;
-
- movq mm3, [rsi+1] ;
- movq mm2, mm1 ;
-
- movq mm4, mm3 ;
- punpcklbw mm1, mm0 ;
-
- punpckhbw mm2, mm0 ;
- pmullw mm1, [rax] ;
-
- pmullw mm2, [rax] ;
- punpcklbw mm3, mm0 ;
-
- punpckhbw mm4, mm0 ;
- pmullw mm3, [rax+8] ;
-
- pmullw mm4, [rax+8] ;
- paddw mm1, mm3 ;
-
- paddw mm2, mm4 ;
- paddw mm1, [GLOBAL(mmx_bi_rd)] ;
-
- psraw mm1, mmx_filter_shift ;
- paddw mm2, [GLOBAL(mmx_bi_rd)] ;
-
- psraw mm2, mmx_filter_shift ;
- movq mm5, mm1
-
- packuswb mm5, mm2 ;
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line
-%else
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- add rsi, r8
-%endif
-
-.filter_block2d_bil_var_mmx_loop:
-
- movq mm1, [rsi] ;
- movq mm3, [rsi+1] ;
-
- movq mm2, mm1 ;
- movq mm4, mm3 ;
-
- punpcklbw mm1, mm0 ;
- punpckhbw mm2, mm0 ;
-
- pmullw mm1, [rax] ;
- pmullw mm2, [rax] ;
-
- punpcklbw mm3, mm0 ;
- punpckhbw mm4, mm0 ;
-
- pmullw mm3, [rax+8] ;
- pmullw mm4, [rax+8] ;
-
- paddw mm1, mm3 ;
- paddw mm2, mm4 ;
-
- paddw mm1, [GLOBAL(mmx_bi_rd)] ;
- psraw mm1, mmx_filter_shift ;
-
- paddw mm2, [GLOBAL(mmx_bi_rd)] ;
- psraw mm2, mmx_filter_shift ;
-
- movq mm3, mm5 ;
- movq mm4, mm5 ;
-
- punpcklbw mm3, mm0 ;
- punpckhbw mm4, mm0 ;
-
- movq mm5, mm1 ;
- packuswb mm5, mm2 ;
-
- pmullw mm3, [rdx] ;
- pmullw mm4, [rdx] ;
-
- pmullw mm1, [rdx+8] ;
- pmullw mm2, [rdx+8] ;
-
- paddw mm1, mm3 ;
- paddw mm2, mm4 ;
-
- paddw mm1, [GLOBAL(mmx_bi_rd)] ;
- paddw mm2, [GLOBAL(mmx_bi_rd)] ;
-
- psraw mm1, mmx_filter_shift ;
- psraw mm2, mmx_filter_shift ;
-
- movq mm3, [rdi] ;
- movq mm4, mm3 ;
-
- punpcklbw mm3, mm0 ;
- punpckhbw mm4, mm0 ;
-
- psubw mm1, mm3 ;
- psubw mm2, mm4 ;
-
- paddw mm6, mm1 ;
- pmaddwd mm1, mm1 ;
-
- paddw mm6, mm2 ;
- pmaddwd mm2, mm2 ;
-
- paddd mm7, mm1 ;
- paddd mm7, mm2 ;
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line ;
- add rdi, dword ptr arg(3) ;src_pixels_per_line ;
-%else
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line ;
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line ;
- add rsi, r8
- add rdi, r9
-%endif
- sub rcx, 1 ;
- jnz .filter_block2d_bil_var_mmx_loop ;
-
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rdi, arg(7) ;sum
- mov rsi, arg(8) ;sumsquared
-
- movd dword ptr [rdi], mm2 ;
- movd dword ptr [rsi], mm4 ;
-
- ; begin epilog
- add rsp, 16
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-SECTION_RODATA
-;short mmx_bi_rd[4] = { 64, 64, 64, 64};
-align 16
-mmx_bi_rd:
- times 4 dw 64
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_sse2.asm
deleted file mode 100644
index 761433c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_sse2.asm
+++ /dev/null
@@ -1,1359 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%define xmm_filter_shift 7
-
-;unsigned int vp8_get_mb_ss_sse2
-;(
-; short *src_ptr
-;)
-global sym(vp8_get_mb_ss_sse2) PRIVATE
-sym(vp8_get_mb_ss_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 1
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 16
- ; end prolog
-
-
- mov rax, arg(0) ;[src_ptr]
- mov rcx, 8
- pxor xmm4, xmm4
-
-.NEXTROW:
- movdqa xmm0, [rax]
- movdqa xmm1, [rax+16]
- movdqa xmm2, [rax+32]
- movdqa xmm3, [rax+48]
- pmaddwd xmm0, xmm0
- pmaddwd xmm1, xmm1
- pmaddwd xmm2, xmm2
- pmaddwd xmm3, xmm3
-
- paddd xmm0, xmm1
- paddd xmm2, xmm3
- paddd xmm4, xmm0
- paddd xmm4, xmm2
-
- add rax, 0x40
- dec rcx
- ja .NEXTROW
-
- movdqa xmm3,xmm4
- psrldq xmm4,8
- paddd xmm4,xmm3
- movdqa xmm3,xmm4
- psrldq xmm4,4
- paddd xmm4,xmm3
- movq rax,xmm4
-
-
- ; begin epilog
- add rsp, 16
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp8_get16x16var_sse2
-;(
-; unsigned char * src_ptr,
-; int source_stride,
-; unsigned char * ref_ptr,
-; int recon_stride,
-; unsigned int * SSE,
-; int * Sum
-;)
-global sym(vp8_get16x16var_sse2) PRIVATE
-sym(vp8_get16x16var_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;[src_ptr]
- mov rdi, arg(2) ;[ref_ptr]
-
- movsxd rax, DWORD PTR arg(1) ;[source_stride]
- movsxd rdx, DWORD PTR arg(3) ;[recon_stride]
-
- ; Prefetch data
- lea rcx, [rax+rax*2]
- prefetcht0 [rsi]
- prefetcht0 [rsi+rax]
- prefetcht0 [rsi+rax*2]
- prefetcht0 [rsi+rcx]
- lea rbx, [rsi+rax*4]
- prefetcht0 [rbx]
- prefetcht0 [rbx+rax]
- prefetcht0 [rbx+rax*2]
- prefetcht0 [rbx+rcx]
-
- lea rcx, [rdx+rdx*2]
- prefetcht0 [rdi]
- prefetcht0 [rdi+rdx]
- prefetcht0 [rdi+rdx*2]
- prefetcht0 [rdi+rcx]
- lea rbx, [rdi+rdx*4]
- prefetcht0 [rbx]
- prefetcht0 [rbx+rdx]
- prefetcht0 [rbx+rdx*2]
- prefetcht0 [rbx+rcx]
-
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- pxor xmm7, xmm7 ; clear xmm7 for accumulating diffs
-
- pxor xmm6, xmm6 ; clear xmm6 for accumulating sse
- mov rcx, 16
-
-.var16loop:
- movdqu xmm1, XMMWORD PTR [rsi]
- movdqu xmm2, XMMWORD PTR [rdi]
-
- prefetcht0 [rsi+rax*8]
- prefetcht0 [rdi+rdx*8]
-
- movdqa xmm3, xmm1
- movdqa xmm4, xmm2
-
-
- punpcklbw xmm1, xmm0
- punpckhbw xmm3, xmm0
-
- punpcklbw xmm2, xmm0
- punpckhbw xmm4, xmm0
-
-
- psubw xmm1, xmm2
- psubw xmm3, xmm4
-
- paddw xmm7, xmm1
- pmaddwd xmm1, xmm1
-
- paddw xmm7, xmm3
- pmaddwd xmm3, xmm3
-
- paddd xmm6, xmm1
- paddd xmm6, xmm3
-
- add rsi, rax
- add rdi, rdx
-
- sub rcx, 1
- jnz .var16loop
-
-
- movdqa xmm1, xmm6
- pxor xmm6, xmm6
-
- pxor xmm5, xmm5
- punpcklwd xmm6, xmm7
-
- punpckhwd xmm5, xmm7
- psrad xmm5, 16
-
- psrad xmm6, 16
- paddd xmm6, xmm5
-
- movdqa xmm2, xmm1
- punpckldq xmm1, xmm0
-
- punpckhdq xmm2, xmm0
- movdqa xmm7, xmm6
-
- paddd xmm1, xmm2
- punpckldq xmm6, xmm0
-
- punpckhdq xmm7, xmm0
- paddd xmm6, xmm7
-
- movdqa xmm2, xmm1
- movdqa xmm7, xmm6
-
- psrldq xmm1, 8
- psrldq xmm6, 8
-
- paddd xmm7, xmm6
- paddd xmm1, xmm2
-
- mov rax, arg(5) ;[Sum]
- mov rdi, arg(4) ;[SSE]
-
- movd DWORD PTR [rax], xmm7
- movd DWORD PTR [rdi], xmm1
-
-
- ; begin epilog
- pop rdi
- pop rsi
- pop rbx
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-
-;unsigned int vp8_get8x8var_sse2
-;(
-; unsigned char * src_ptr,
-; int source_stride,
-; unsigned char * ref_ptr,
-; int recon_stride,
-; unsigned int * SSE,
-; int * Sum
-;)
-global sym(vp8_get8x8var_sse2) PRIVATE
-sym(vp8_get8x8var_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 16
- ; end prolog
-
- mov rsi, arg(0) ;[src_ptr]
- mov rdi, arg(2) ;[ref_ptr]
-
- movsxd rax, DWORD PTR arg(1) ;[source_stride]
- movsxd rdx, DWORD PTR arg(3) ;[recon_stride]
-
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- pxor xmm7, xmm7 ; clear xmm7 for accumulating diffs
-
- movq xmm1, QWORD PTR [rsi]
- movq xmm2, QWORD PTR [rdi]
-
- punpcklbw xmm1, xmm0
- punpcklbw xmm2, xmm0
-
- psubsw xmm1, xmm2
- paddw xmm7, xmm1
-
- pmaddwd xmm1, xmm1
-
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- movq xmm2, QWORD PTR[rsi + rax * 2]
- movq xmm3, QWORD PTR[rdi + rdx * 2]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- lea rsi, [rsi + rax * 2]
- lea rdi, [rdi + rdx * 2]
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
- movq xmm2, QWORD PTR[rsi + rax *2]
- movq xmm3, QWORD PTR[rdi + rdx *2]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- lea rsi, [rsi + rax * 2]
- lea rdi, [rdi + rdx * 2]
-
-
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
- movq xmm2, QWORD PTR[rsi + rax *2]
- movq xmm3, QWORD PTR[rdi + rdx *2]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- lea rsi, [rsi + rax * 2]
- lea rdi, [rdi + rdx * 2]
-
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- movdqa xmm6, xmm7
- punpcklwd xmm6, xmm0
-
- punpckhwd xmm7, xmm0
- movdqa xmm2, xmm1
-
- paddw xmm6, xmm7
- punpckldq xmm1, xmm0
-
- punpckhdq xmm2, xmm0
- movdqa xmm7, xmm6
-
- paddd xmm1, xmm2
- punpckldq xmm6, xmm0
-
- punpckhdq xmm7, xmm0
- paddw xmm6, xmm7
-
- movdqa xmm2, xmm1
- movdqa xmm7, xmm6
-
- psrldq xmm1, 8
- psrldq xmm6, 8
-
- paddw xmm7, xmm6
- paddd xmm1, xmm2
-
- mov rax, arg(5) ;[Sum]
- mov rdi, arg(4) ;[SSE]
-
- movq rdx, xmm7
- movsx rcx, dx
-
- mov dword ptr [rax], ecx
- movd DWORD PTR [rdi], xmm1
-
- ; begin epilog
- add rsp, 16
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_filter_block2d_bil_var_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int xoffset,
-; int yoffset,
-; int *sum,
-; unsigned int *sumsquared;;
-;
-;)
-global sym(vp8_filter_block2d_bil_var_sse2) PRIVATE
-sym(vp8_filter_block2d_bil_var_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 9
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- pxor xmm6, xmm6 ;
- pxor xmm7, xmm7 ;
-
- lea rsi, [GLOBAL(xmm_bi_rd)] ; rounding
- movdqa xmm4, XMMWORD PTR [rsi]
-
- lea rcx, [GLOBAL(vp8_bilinear_filters_sse2)]
- movsxd rax, dword ptr arg(5) ; xoffset
-
- cmp rax, 0 ; skip first_pass filter if xoffset=0
- je filter_block2d_bil_var_sse2_sp_only
-
- shl rax, 5 ; point to filter coeff with xoffset
- lea rax, [rax + rcx] ; HFilter
-
- movsxd rdx, dword ptr arg(6) ; yoffset
-
- cmp rdx, 0 ; skip second_pass filter if yoffset=0
- je filter_block2d_bil_var_sse2_fp_only
-
- shl rdx, 5
- lea rdx, [rdx + rcx] ; VFilter
-
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
-
- pxor xmm0, xmm0 ;
- movq xmm1, QWORD PTR [rsi] ;
- movq xmm3, QWORD PTR [rsi+1] ;
-
- punpcklbw xmm1, xmm0 ;
- pmullw xmm1, [rax] ;
- punpcklbw xmm3, xmm0
- pmullw xmm3, [rax+16] ;
-
- paddw xmm1, xmm3 ;
- paddw xmm1, xmm4 ;
- psraw xmm1, xmm_filter_shift ;
- movdqa xmm5, xmm1
-
- movsxd rbx, dword ptr arg(1) ;ref_pixels_per_line
- lea rsi, [rsi + rbx]
-%if ABI_IS_32BIT=0
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
-filter_block2d_bil_var_sse2_loop:
- movq xmm1, QWORD PTR [rsi] ;
- movq xmm3, QWORD PTR [rsi+1] ;
-
- punpcklbw xmm1, xmm0 ;
- pmullw xmm1, [rax] ;
- punpcklbw xmm3, xmm0 ;
- pmullw xmm3, [rax+16] ;
-
- paddw xmm1, xmm3 ;
- paddw xmm1, xmm4 ;
- psraw xmm1, xmm_filter_shift ;
-
- movdqa xmm3, xmm5 ;
- movdqa xmm5, xmm1 ;
-
- pmullw xmm3, [rdx] ;
- pmullw xmm1, [rdx+16] ;
- paddw xmm1, xmm3 ;
- paddw xmm1, xmm4 ;
- psraw xmm1, xmm_filter_shift ;
-
- movq xmm3, QWORD PTR [rdi] ;
- punpcklbw xmm3, xmm0 ;
-
- psubw xmm1, xmm3 ;
- paddw xmm6, xmm1 ;
-
- pmaddwd xmm1, xmm1 ;
- paddd xmm7, xmm1 ;
-
- lea rsi, [rsi + rbx] ;ref_pixels_per_line
-%if ABI_IS_32BIT
- add rdi, dword ptr arg(3) ;src_pixels_per_line
-%else
- lea rdi, [rdi + r9]
-%endif
-
- sub rcx, 1 ;
- jnz filter_block2d_bil_var_sse2_loop ;
-
- jmp filter_block2d_bil_variance
-
-filter_block2d_bil_var_sse2_sp_only:
- movsxd rdx, dword ptr arg(6) ; yoffset
-
- cmp rdx, 0 ; skip all if both xoffset=0 and yoffset=0
- je filter_block2d_bil_var_sse2_full_pixel
-
- shl rdx, 5
- lea rdx, [rdx + rcx] ; VFilter
-
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
-
- pxor xmm0, xmm0 ;
- movq xmm1, QWORD PTR [rsi] ;
- punpcklbw xmm1, xmm0 ;
-
- movsxd rbx, dword ptr arg(3) ;src_pixels_per_line
- lea rsi, [rsi + rax]
-
-filter_block2d_bil_sp_only_loop:
- movq xmm3, QWORD PTR [rsi] ;
- punpcklbw xmm3, xmm0 ;
- movdqa xmm5, xmm3
-
- pmullw xmm1, [rdx] ;
- pmullw xmm3, [rdx+16] ;
- paddw xmm1, xmm3 ;
- paddw xmm1, xmm4 ;
- psraw xmm1, xmm_filter_shift ;
-
- movq xmm3, QWORD PTR [rdi] ;
- punpcklbw xmm3, xmm0 ;
-
- psubw xmm1, xmm3 ;
- paddw xmm6, xmm1 ;
-
- pmaddwd xmm1, xmm1 ;
- paddd xmm7, xmm1 ;
-
- movdqa xmm1, xmm5 ;
- lea rsi, [rsi + rax] ;ref_pixels_per_line
- lea rdi, [rdi + rbx] ;src_pixels_per_line
-
- sub rcx, 1 ;
- jnz filter_block2d_bil_sp_only_loop ;
-
- jmp filter_block2d_bil_variance
-
-filter_block2d_bil_var_sse2_full_pixel:
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rbx, dword ptr arg(3) ;src_pixels_per_line
- pxor xmm0, xmm0 ;
-
-filter_block2d_bil_full_pixel_loop:
- movq xmm1, QWORD PTR [rsi] ;
- punpcklbw xmm1, xmm0 ;
-
- movq xmm2, QWORD PTR [rdi] ;
- punpcklbw xmm2, xmm0 ;
-
- psubw xmm1, xmm2 ;
- paddw xmm6, xmm1 ;
-
- pmaddwd xmm1, xmm1 ;
- paddd xmm7, xmm1 ;
-
- lea rsi, [rsi + rax] ;ref_pixels_per_line
- lea rdi, [rdi + rbx] ;src_pixels_per_line
-
- sub rcx, 1 ;
- jnz filter_block2d_bil_full_pixel_loop ;
-
- jmp filter_block2d_bil_variance
-
-filter_block2d_bil_var_sse2_fp_only:
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rdx, dword ptr arg(1) ;ref_pixels_per_line
-
- pxor xmm0, xmm0 ;
- movsxd rbx, dword ptr arg(3) ;src_pixels_per_line
-
-filter_block2d_bil_fp_only_loop:
- movq xmm1, QWORD PTR [rsi] ;
- movq xmm3, QWORD PTR [rsi+1] ;
-
- punpcklbw xmm1, xmm0 ;
- pmullw xmm1, [rax] ;
- punpcklbw xmm3, xmm0 ;
- pmullw xmm3, [rax+16] ;
-
- paddw xmm1, xmm3 ;
- paddw xmm1, xmm4 ;
- psraw xmm1, xmm_filter_shift ;
-
- movq xmm3, QWORD PTR [rdi] ;
- punpcklbw xmm3, xmm0 ;
-
- psubw xmm1, xmm3 ;
- paddw xmm6, xmm1 ;
-
- pmaddwd xmm1, xmm1 ;
- paddd xmm7, xmm1 ;
- lea rsi, [rsi + rdx]
- lea rdi, [rdi + rbx] ;src_pixels_per_line
-
- sub rcx, 1 ;
- jnz filter_block2d_bil_fp_only_loop ;
-
- jmp filter_block2d_bil_variance
-
-filter_block2d_bil_variance:
- movdq2q mm6, xmm6 ;
- movdq2q mm7, xmm7 ;
-
- psrldq xmm6, 8
- psrldq xmm7, 8
-
- movdq2q mm2, xmm6
- movdq2q mm3, xmm7
-
- paddw mm6, mm2
- paddd mm7, mm3
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rsi, arg(7) ; sum
- mov rdi, arg(8) ; sumsquared
-
- movd [rsi], mm2 ; xsum
- movd [rdi], mm4 ; xxsum
-
- ; begin epilog
- pop rbx
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_half_horiz_vert_variance8x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_half_horiz_vert_variance8x_h_sse2) PRIVATE
-sym(vp8_half_horiz_vert_variance8x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
-
- pxor xmm0, xmm0 ;
-
- movq xmm5, QWORD PTR [rsi] ; xmm5 = s0,s1,s2..s8
- movq xmm3, QWORD PTR [rsi+1] ; xmm3 = s1,s2,s3..s9
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3) horizontal line 1
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line ; next source
-%else
- add rsi, r8
-%endif
-
-vp8_half_horiz_vert_variance8x_h_1:
-
- movq xmm1, QWORD PTR [rsi] ;
- movq xmm2, QWORD PTR [rsi+1] ;
- pavgb xmm1, xmm2 ; xmm1 = avg(xmm1,xmm3) horizontal line i+1
-
- pavgb xmm5, xmm1 ; xmm = vertical average of the above
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d8
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
-
- movdqa xmm5, xmm1 ; save xmm1 for use on the next row
-
-%if ABI_IS_32BIT
- add esi, dword ptr arg(1) ;ref_pixels_per_line ; next source
- add edi, dword ptr arg(3) ;src_pixels_per_line ; next destination
-%else
- add rsi, r8
- add rdi, r9
-%endif
-
- sub rcx, 1 ;
- jnz vp8_half_horiz_vert_variance8x_h_1 ;
-
- movdq2q mm6, xmm6 ;
- movdq2q mm7, xmm7 ;
-
- psrldq xmm6, 8
- psrldq xmm7, 8
-
- movdq2q mm2, xmm6
- movdq2q mm3, xmm7
-
- paddw mm6, mm2
- paddd mm7, mm3
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rsi, arg(5) ; sum
- mov rdi, arg(6) ; sumsquared
-
- movd [rsi], mm2 ;
- movd [rdi], mm4 ;
-
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_half_horiz_vert_variance16x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_half_horiz_vert_variance16x_h_sse2) PRIVATE
-sym(vp8_half_horiz_vert_variance16x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;src_pixels_per_line
-
- pxor xmm0, xmm0 ;
-
- movdqu xmm5, XMMWORD PTR [rsi]
- movdqu xmm3, XMMWORD PTR [rsi+1]
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3) horizontal line 1
-
- lea rsi, [rsi + rax]
-
-vp8_half_horiz_vert_variance16x_h_1:
- movdqu xmm1, XMMWORD PTR [rsi] ;
- movdqu xmm2, XMMWORD PTR [rsi+1] ;
- pavgb xmm1, xmm2 ; xmm1 = avg(xmm1,xmm3) horizontal line i+1
-
- pavgb xmm5, xmm1 ; xmm = vertical average of the above
-
- movdqa xmm4, xmm5
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
- punpckhbw xmm4, xmm0
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d7
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
- psubw xmm5, xmm3 ; xmm5 -= xmm3
-
- movq xmm3, QWORD PTR [rdi+8]
- punpcklbw xmm3, xmm0
- psubw xmm4, xmm3
-
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- paddw xmm6, xmm4
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- pmaddwd xmm4, xmm4
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
- paddd xmm7, xmm4
-
- movdqa xmm5, xmm1 ; save xmm1 for use on the next row
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
-
- sub rcx, 1 ;
- jnz vp8_half_horiz_vert_variance16x_h_1 ;
-
- pxor xmm1, xmm1
- pxor xmm5, xmm5
-
- punpcklwd xmm0, xmm6
- punpckhwd xmm1, xmm6
- psrad xmm0, 16
- psrad xmm1, 16
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- movdqa xmm6, xmm7
- punpckldq xmm6, xmm5
- punpckhdq xmm7, xmm5
- paddd xmm6, xmm7
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
- paddd xmm0, xmm1
-
- movdqa xmm7, xmm6
- movdqa xmm1, xmm0
-
- psrldq xmm7, 8
- psrldq xmm1, 8
-
- paddd xmm6, xmm7
- paddd xmm0, xmm1
-
- mov rsi, arg(5) ;[Sum]
- mov rdi, arg(6) ;[SSE]
-
- movd [rsi], xmm0
- movd [rdi], xmm6
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_half_vert_variance8x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_half_vert_variance8x_h_sse2) PRIVATE
-sym(vp8_half_vert_variance8x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
-
- pxor xmm0, xmm0 ;
-vp8_half_vert_variance8x_h_1:
- movq xmm5, QWORD PTR [rsi] ; xmm5 = s0,s1,s2..s8
- movq xmm3, QWORD PTR [rsi+rax] ; xmm3 = s1,s2,s3..s9
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d8
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
-
-%if ABI_IS_32BIT
- add esi, dword ptr arg(1) ;ref_pixels_per_line ; next source
- add edi, dword ptr arg(3) ;src_pixels_per_line ; next destination
-%else
- add rsi, r8
- add rdi, r9
-%endif
-
- sub rcx, 1 ;
- jnz vp8_half_vert_variance8x_h_1 ;
-
- movdq2q mm6, xmm6 ;
- movdq2q mm7, xmm7 ;
-
- psrldq xmm6, 8
- psrldq xmm7, 8
-
- movdq2q mm2, xmm6
- movdq2q mm3, xmm7
-
- paddw mm6, mm2
- paddd mm7, mm3
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rsi, arg(5) ; sum
- mov rdi, arg(6) ; sumsquared
-
- movd [rsi], mm2 ;
- movd [rdi], mm4 ;
-
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_half_vert_variance16x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_half_vert_variance16x_h_sse2) PRIVATE
-sym(vp8_half_vert_variance16x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr
-
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;src_pixels_per_line
-
- movdqu xmm5, XMMWORD PTR [rsi]
- lea rsi, [rsi + rax ]
- pxor xmm0, xmm0
-
-vp8_half_vert_variance16x_h_1:
- movdqu xmm3, XMMWORD PTR [rsi]
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- movdqa xmm4, xmm5
- punpcklbw xmm5, xmm0
- punpckhbw xmm4, xmm0
-
- movq xmm2, QWORD PTR [rdi]
- punpcklbw xmm2, xmm0
- psubw xmm5, xmm2
- movq xmm2, QWORD PTR [rdi+8]
- punpcklbw xmm2, xmm0
- psubw xmm4, xmm2
-
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- paddw xmm6, xmm4
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- pmaddwd xmm4, xmm4
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
- paddd xmm7, xmm4
-
- movdqa xmm5, xmm3
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
-
- sub rcx, 1
- jnz vp8_half_vert_variance16x_h_1
-
- pxor xmm1, xmm1
- pxor xmm5, xmm5
-
- punpcklwd xmm0, xmm6
- punpckhwd xmm1, xmm6
- psrad xmm0, 16
- psrad xmm1, 16
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- movdqa xmm6, xmm7
- punpckldq xmm6, xmm5
- punpckhdq xmm7, xmm5
- paddd xmm6, xmm7
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
- paddd xmm0, xmm1
-
- movdqa xmm7, xmm6
- movdqa xmm1, xmm0
-
- psrldq xmm7, 8
- psrldq xmm1, 8
-
- paddd xmm6, xmm7
- paddd xmm0, xmm1
-
- mov rsi, arg(5) ;[Sum]
- mov rdi, arg(6) ;[SSE]
-
- movd [rsi], xmm0
- movd [rdi], xmm6
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_half_horiz_variance8x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_half_horiz_variance8x_h_sse2) PRIVATE
-sym(vp8_half_horiz_variance8x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
-
- pxor xmm0, xmm0 ;
-vp8_half_horiz_variance8x_h_1:
- movq xmm5, QWORD PTR [rsi] ; xmm5 = s0,s1,s2..s8
- movq xmm3, QWORD PTR [rsi+1] ; xmm3 = s1,s2,s3..s9
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d8
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
-
-%if ABI_IS_32BIT
- add esi, dword ptr arg(1) ;ref_pixels_per_line ; next source
- add edi, dword ptr arg(3) ;src_pixels_per_line ; next destination
-%else
- add rsi, r8
- add rdi, r9
-%endif
- sub rcx, 1 ;
- jnz vp8_half_horiz_variance8x_h_1 ;
-
- movdq2q mm6, xmm6 ;
- movdq2q mm7, xmm7 ;
-
- psrldq xmm6, 8
- psrldq xmm7, 8
-
- movdq2q mm2, xmm6
- movdq2q mm3, xmm7
-
- paddw mm6, mm2
- paddd mm7, mm3
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rsi, arg(5) ; sum
- mov rdi, arg(6) ; sumsquared
-
- movd [rsi], mm2 ;
- movd [rdi], mm4 ;
-
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_half_horiz_variance16x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp8_half_horiz_variance16x_h_sse2) PRIVATE
-sym(vp8_half_horiz_variance16x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;src_pixels_per_line
-
- pxor xmm0, xmm0 ;
-
-vp8_half_horiz_variance16x_h_1:
- movdqu xmm5, XMMWORD PTR [rsi] ; xmm5 = s0,s1,s2..s15
- movdqu xmm3, XMMWORD PTR [rsi+1] ; xmm3 = s1,s2,s3..s16
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- movdqa xmm1, xmm5
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
- punpckhbw xmm1, xmm0
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d7
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
- movq xmm2, QWORD PTR [rdi+8]
- punpcklbw xmm2, xmm0
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- psubw xmm1, xmm2
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- paddw xmm6, xmm1
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- pmaddwd xmm1, xmm1
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
- paddd xmm7, xmm1
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
-
- sub rcx, 1 ;
- jnz vp8_half_horiz_variance16x_h_1 ;
-
- pxor xmm1, xmm1
- pxor xmm5, xmm5
-
- punpcklwd xmm0, xmm6
- punpckhwd xmm1, xmm6
- psrad xmm0, 16
- psrad xmm1, 16
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- movdqa xmm6, xmm7
- punpckldq xmm6, xmm5
- punpckhdq xmm7, xmm5
- paddd xmm6, xmm7
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
- paddd xmm0, xmm1
-
- movdqa xmm7, xmm6
- movdqa xmm1, xmm0
-
- psrldq xmm7, 8
- psrldq xmm1, 8
-
- paddd xmm6, xmm7
- paddd xmm0, xmm1
-
- mov rsi, arg(5) ;[Sum]
- mov rdi, arg(6) ;[SSE]
-
- movd [rsi], xmm0
- movd [rdi], xmm6
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-; short xmm_bi_rd[8] = { 64, 64, 64, 64,64, 64, 64, 64};
-align 16
-xmm_bi_rd:
- times 8 dw 64
-align 16
-vp8_bilinear_filters_sse2:
- dw 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0
- dw 112, 112, 112, 112, 112, 112, 112, 112, 16, 16, 16, 16, 16, 16, 16, 16
- dw 96, 96, 96, 96, 96, 96, 96, 96, 32, 32, 32, 32, 32, 32, 32, 32
- dw 80, 80, 80, 80, 80, 80, 80, 80, 48, 48, 48, 48, 48, 48, 48, 48
- dw 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- dw 48, 48, 48, 48, 48, 48, 48, 48, 80, 80, 80, 80, 80, 80, 80, 80
- dw 32, 32, 32, 32, 32, 32, 32, 32, 96, 96, 96, 96, 96, 96, 96, 96
- dw 16, 16, 16, 16, 16, 16, 16, 16, 112, 112, 112, 112, 112, 112, 112, 112
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_ssse3.asm
deleted file mode 100644
index 686b4a9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_impl_ssse3.asm
+++ /dev/null
@@ -1,364 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%define xmm_filter_shift 7
-
-
-;void vp8_filter_block2d_bil_var_ssse3
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int xoffset,
-; int yoffset,
-; int *sum,
-; unsigned int *sumsquared;;
-;
-;)
-;Note: The filter coefficient at offset=0 is 128. Since the second register
-;for Pmaddubsw is signed bytes, we must calculate zero offset seperately.
-global sym(vp8_filter_block2d_bil_var_ssse3) PRIVATE
-sym(vp8_filter_block2d_bil_var_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 9
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- pxor xmm6, xmm6
- pxor xmm7, xmm7
-
- lea rcx, [GLOBAL(vp8_bilinear_filters_ssse3)]
- movsxd rax, dword ptr arg(5) ; xoffset
-
- cmp rax, 0 ; skip first_pass filter if xoffset=0
- je .filter_block2d_bil_var_ssse3_sp_only
-
- shl rax, 4 ; point to filter coeff with xoffset
- lea rax, [rax + rcx] ; HFilter
-
- movsxd rdx, dword ptr arg(6) ; yoffset
-
- cmp rdx, 0 ; skip second_pass filter if yoffset=0
- je .filter_block2d_bil_var_ssse3_fp_only
-
- shl rdx, 4
- lea rdx, [rdx + rcx] ; VFilter
-
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
-
- movdqu xmm0, XMMWORD PTR [rsi]
- movdqu xmm1, XMMWORD PTR [rsi+1]
- movdqa xmm2, xmm0
-
- punpcklbw xmm0, xmm1
- punpckhbw xmm2, xmm1
- pmaddubsw xmm0, [rax]
- pmaddubsw xmm2, [rax]
-
- paddw xmm0, [GLOBAL(xmm_bi_rd)]
- paddw xmm2, [GLOBAL(xmm_bi_rd)]
- psraw xmm0, xmm_filter_shift
- psraw xmm2, xmm_filter_shift
-
- packuswb xmm0, xmm2
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line
-%else
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
- lea rsi, [rsi + r8]
-%endif
-
-.filter_block2d_bil_var_ssse3_loop:
- movdqu xmm1, XMMWORD PTR [rsi]
- movdqu xmm2, XMMWORD PTR [rsi+1]
- movdqa xmm3, xmm1
-
- punpcklbw xmm1, xmm2
- punpckhbw xmm3, xmm2
- pmaddubsw xmm1, [rax]
- pmaddubsw xmm3, [rax]
-
- paddw xmm1, [GLOBAL(xmm_bi_rd)]
- paddw xmm3, [GLOBAL(xmm_bi_rd)]
- psraw xmm1, xmm_filter_shift
- psraw xmm3, xmm_filter_shift
- packuswb xmm1, xmm3
-
- movdqa xmm2, xmm0
- movdqa xmm0, xmm1
- movdqa xmm3, xmm2
-
- punpcklbw xmm2, xmm1
- punpckhbw xmm3, xmm1
- pmaddubsw xmm2, [rdx]
- pmaddubsw xmm3, [rdx]
-
- paddw xmm2, [GLOBAL(xmm_bi_rd)]
- paddw xmm3, [GLOBAL(xmm_bi_rd)]
- psraw xmm2, xmm_filter_shift
- psraw xmm3, xmm_filter_shift
-
- movq xmm1, QWORD PTR [rdi]
- pxor xmm4, xmm4
- punpcklbw xmm1, xmm4
- movq xmm5, QWORD PTR [rdi+8]
- punpcklbw xmm5, xmm4
-
- psubw xmm2, xmm1
- psubw xmm3, xmm5
- paddw xmm6, xmm2
- paddw xmm6, xmm3
- pmaddwd xmm2, xmm2
- pmaddwd xmm3, xmm3
- paddd xmm7, xmm2
- paddd xmm7, xmm3
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line
- add rdi, dword ptr arg(3) ;src_pixels_per_line
-%else
- lea rsi, [rsi + r8]
- lea rdi, [rdi + r9]
-%endif
-
- sub rcx, 1
- jnz .filter_block2d_bil_var_ssse3_loop
-
- jmp .filter_block2d_bil_variance
-
-.filter_block2d_bil_var_ssse3_sp_only:
- movsxd rdx, dword ptr arg(6) ; yoffset
-
- cmp rdx, 0 ; Both xoffset =0 and yoffset=0
- je .filter_block2d_bil_var_ssse3_full_pixel
-
- shl rdx, 4
- lea rdx, [rdx + rcx] ; VFilter
-
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
-
- movdqu xmm1, XMMWORD PTR [rsi]
- movdqa xmm0, xmm1
-
-%if ABI_IS_32BIT=0
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
- lea rsi, [rsi + rax]
-
-.filter_block2d_bil_sp_only_loop:
- movdqu xmm3, XMMWORD PTR [rsi]
- movdqa xmm2, xmm1
- movdqa xmm0, xmm3
-
- punpcklbw xmm1, xmm3
- punpckhbw xmm2, xmm3
- pmaddubsw xmm1, [rdx]
- pmaddubsw xmm2, [rdx]
-
- paddw xmm1, [GLOBAL(xmm_bi_rd)]
- paddw xmm2, [GLOBAL(xmm_bi_rd)]
- psraw xmm1, xmm_filter_shift
- psraw xmm2, xmm_filter_shift
-
- movq xmm3, QWORD PTR [rdi]
- pxor xmm4, xmm4
- punpcklbw xmm3, xmm4
- movq xmm5, QWORD PTR [rdi+8]
- punpcklbw xmm5, xmm4
-
- psubw xmm1, xmm3
- psubw xmm2, xmm5
- paddw xmm6, xmm1
- paddw xmm6, xmm2
- pmaddwd xmm1, xmm1
- pmaddwd xmm2, xmm2
- paddd xmm7, xmm1
- paddd xmm7, xmm2
-
- movdqa xmm1, xmm0
- lea rsi, [rsi + rax] ;ref_pixels_per_line
-
-%if ABI_IS_32BIT
- add rdi, dword ptr arg(3) ;src_pixels_per_line
-%else
- lea rdi, [rdi + r9]
-%endif
-
- sub rcx, 1
- jnz .filter_block2d_bil_sp_only_loop
-
- jmp .filter_block2d_bil_variance
-
-.filter_block2d_bil_var_ssse3_full_pixel:
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;src_pixels_per_line
- pxor xmm0, xmm0
-
-.filter_block2d_bil_full_pixel_loop:
- movq xmm1, QWORD PTR [rsi]
- punpcklbw xmm1, xmm0
- movq xmm2, QWORD PTR [rsi+8]
- punpcklbw xmm2, xmm0
-
- movq xmm3, QWORD PTR [rdi]
- punpcklbw xmm3, xmm0
- movq xmm4, QWORD PTR [rdi+8]
- punpcklbw xmm4, xmm0
-
- psubw xmm1, xmm3
- psubw xmm2, xmm4
- paddw xmm6, xmm1
- paddw xmm6, xmm2
- pmaddwd xmm1, xmm1
- pmaddwd xmm2, xmm2
- paddd xmm7, xmm1
- paddd xmm7, xmm2
-
- lea rsi, [rsi + rax] ;ref_pixels_per_line
- lea rdi, [rdi + rdx] ;src_pixels_per_line
- sub rcx, 1
- jnz .filter_block2d_bil_full_pixel_loop
-
- jmp .filter_block2d_bil_variance
-
-.filter_block2d_bil_var_ssse3_fp_only:
- mov rsi, arg(0) ;ref_ptr
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rdx, dword ptr arg(1) ;ref_pixels_per_line
-
- pxor xmm0, xmm0
-
-%if ABI_IS_32BIT=0
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
-.filter_block2d_bil_fp_only_loop:
- movdqu xmm1, XMMWORD PTR [rsi]
- movdqu xmm2, XMMWORD PTR [rsi+1]
- movdqa xmm3, xmm1
-
- punpcklbw xmm1, xmm2
- punpckhbw xmm3, xmm2
- pmaddubsw xmm1, [rax]
- pmaddubsw xmm3, [rax]
-
- paddw xmm1, [GLOBAL(xmm_bi_rd)]
- paddw xmm3, [GLOBAL(xmm_bi_rd)]
- psraw xmm1, xmm_filter_shift
- psraw xmm3, xmm_filter_shift
-
- movq xmm2, XMMWORD PTR [rdi]
- pxor xmm4, xmm4
- punpcklbw xmm2, xmm4
- movq xmm5, QWORD PTR [rdi+8]
- punpcklbw xmm5, xmm4
-
- psubw xmm1, xmm2
- psubw xmm3, xmm5
- paddw xmm6, xmm1
- paddw xmm6, xmm3
- pmaddwd xmm1, xmm1
- pmaddwd xmm3, xmm3
- paddd xmm7, xmm1
- paddd xmm7, xmm3
-
- lea rsi, [rsi + rdx]
-%if ABI_IS_32BIT
- add rdi, dword ptr arg(3) ;src_pixels_per_line
-%else
- lea rdi, [rdi + r9]
-%endif
-
- sub rcx, 1
- jnz .filter_block2d_bil_fp_only_loop
-
- jmp .filter_block2d_bil_variance
-
-.filter_block2d_bil_variance:
- pxor xmm0, xmm0
- pxor xmm1, xmm1
- pxor xmm5, xmm5
-
- punpcklwd xmm0, xmm6
- punpckhwd xmm1, xmm6
- psrad xmm0, 16
- psrad xmm1, 16
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- movdqa xmm6, xmm7
- punpckldq xmm6, xmm5
- punpckhdq xmm7, xmm5
- paddd xmm6, xmm7
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
- paddd xmm0, xmm1
-
- movdqa xmm7, xmm6
- movdqa xmm1, xmm0
-
- psrldq xmm7, 8
- psrldq xmm1, 8
-
- paddd xmm6, xmm7
- paddd xmm0, xmm1
-
- mov rsi, arg(7) ;[Sum]
- mov rdi, arg(8) ;[SSE]
-
- movd [rsi], xmm0
- movd [rdi], xmm6
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-SECTION_RODATA
-align 16
-xmm_bi_rd:
- times 8 dw 64
-align 16
-vp8_bilinear_filters_ssse3:
- times 8 db 128, 0
- times 8 db 112, 16
- times 8 db 96, 32
- times 8 db 80, 48
- times 8 db 64, 64
- times 8 db 48, 80
- times 8 db 32, 96
- times 8 db 16, 112
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_mmx.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_mmx.c
deleted file mode 100644
index 36995db..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_mmx.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8/common/variance.h"
-#include "vp8/common/pragmas.h"
-#include "vpx_ports/mem.h"
-#include "vp8/common/x86/filter_x86.h"
-
-extern void filter_block1d_h6_mmx
-(
- const unsigned char *src_ptr,
- unsigned short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- short *filter
-);
-extern void filter_block1d_v6_mmx
-(
- const short *src_ptr,
- unsigned char *output_ptr,
- unsigned int pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- short *filter
-);
-
-extern unsigned int vp8_get_mb_ss_mmx(const short *src_ptr);
-extern unsigned int vp8_get8x8var_mmx
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-extern unsigned int vp8_get4x4var_mmx
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-extern void vp8_filter_block2d_bil4x4_var_mmx
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const short *HFilter,
- const short *VFilter,
- int *sum,
- unsigned int *sumsquared
-);
-extern void vp8_filter_block2d_bil_var_mmx
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- const short *HFilter,
- const short *VFilter,
- int *sum,
- unsigned int *sumsquared
-);
-
-
-unsigned int vp8_variance4x4_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
- vp8_get4x4var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 4));
-
-}
-
-unsigned int vp8_variance8x8_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
- vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
- *sse = var;
-
- return (var - (((unsigned int)avg * avg) >> 6));
-
-}
-
-unsigned int vp8_mse16x16_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int sse0, sse1, sse2, sse3, var;
- int sum0, sum1, sum2, sum3;
-
-
- vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- vp8_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1, &sum1);
- vp8_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * recon_stride, recon_stride, &sse2, &sum2) ;
- vp8_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride, ref_ptr + 8 * recon_stride + 8, recon_stride, &sse3, &sum3);
-
- var = sse0 + sse1 + sse2 + sse3;
- *sse = var;
- return var;
-}
-
-
-unsigned int vp8_variance16x16_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int sse0, sse1, sse2, sse3, var;
- int sum0, sum1, sum2, sum3, avg;
-
-
- vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- vp8_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1, &sum1);
- vp8_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * recon_stride, recon_stride, &sse2, &sum2) ;
- vp8_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride, ref_ptr + 8 * recon_stride + 8, recon_stride, &sse3, &sum3);
-
- var = sse0 + sse1 + sse2 + sse3;
- avg = sum0 + sum1 + sum2 + sum3;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 8));
-}
-
-unsigned int vp8_variance16x8_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int sse0, sse1, var;
- int sum0, sum1, avg;
-
- vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- vp8_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1, &sum1);
-
- var = sse0 + sse1;
- avg = sum0 + sum1;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-
-}
-
-
-unsigned int vp8_variance8x16_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int sse0, sse1, var;
- int sum0, sum1, avg;
-
- vp8_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- vp8_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * recon_stride, recon_stride, &sse1, &sum1) ;
-
- var = sse0 + sse1;
- avg = sum0 + sum1;
- *sse = var;
-
- return (var - (((unsigned int)avg * avg) >> 7));
-
-}
-
-
-unsigned int vp8_sub_pixel_variance4x4_mmx
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse)
-
-{
- int xsum;
- unsigned int xxsum;
- vp8_filter_block2d_bil4x4_var_mmx(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum, &xxsum
- );
- *sse = xxsum;
- return (xxsum - (((unsigned int)xsum * xsum) >> 4));
-}
-
-
-unsigned int vp8_sub_pixel_variance8x8_mmx
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
-
- int xsum;
- unsigned int xxsum;
- vp8_filter_block2d_bil_var_mmx(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum, &xxsum
- );
- *sse = xxsum;
- return (xxsum - (((unsigned int)xsum * xsum) >> 6));
-}
-
-unsigned int vp8_sub_pixel_variance16x16_mmx
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
-
- int xsum0, xsum1;
- unsigned int xxsum0, xxsum1;
-
-
- vp8_filter_block2d_bil_var_mmx(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum0, &xxsum0
- );
-
-
- vp8_filter_block2d_bil_var_mmx(
- src_ptr + 8, src_pixels_per_line,
- dst_ptr + 8, dst_pixels_per_line, 16,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum1, &xxsum1
- );
-
- xsum0 += xsum1;
- xxsum0 += xxsum1;
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-
-
-}
-
-unsigned int vp8_sub_pixel_mse16x16_mmx(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- vp8_sub_pixel_variance16x16_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse);
- return *sse;
-}
-
-unsigned int vp8_sub_pixel_variance16x8_mmx
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- int xsum0, xsum1;
- unsigned int xxsum0, xxsum1;
-
-
- vp8_filter_block2d_bil_var_mmx(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum0, &xxsum0
- );
-
-
- vp8_filter_block2d_bil_var_mmx(
- src_ptr + 8, src_pixels_per_line,
- dst_ptr + 8, dst_pixels_per_line, 8,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum1, &xxsum1
- );
-
- xsum0 += xsum1;
- xxsum0 += xxsum1;
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 7));
-}
-
-unsigned int vp8_sub_pixel_variance8x16_mmx
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- int xsum;
- unsigned int xxsum;
- vp8_filter_block2d_bil_var_mmx(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum, &xxsum
- );
- *sse = xxsum;
- return (xxsum - (((unsigned int)xsum * xsum) >> 7));
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_h_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- return vp8_sub_pixel_variance16x16_mmx(src_ptr, source_stride, 4, 0,
- ref_ptr, recon_stride, sse);
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_v_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- return vp8_sub_pixel_variance16x16_mmx(src_ptr, source_stride, 0, 4,
- ref_ptr, recon_stride, sse);
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_hv_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- return vp8_sub_pixel_variance16x16_mmx(src_ptr, source_stride, 4, 4,
- ref_ptr, recon_stride, sse);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_sse2.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_sse2.c
deleted file mode 100644
index 7fa5f53..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_sse2.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8/common/variance.h"
-#include "vp8/common/pragmas.h"
-#include "vpx_ports/mem.h"
-#include "vp8/common/x86/filter_x86.h"
-
-extern void filter_block1d_h6_mmx(const unsigned char *src_ptr, unsigned short *output_ptr, unsigned int src_pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
-extern void filter_block1d_v6_mmx(const short *src_ptr, unsigned char *output_ptr, unsigned int pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
-extern void filter_block1d8_h6_sse2(const unsigned char *src_ptr, unsigned short *output_ptr, unsigned int src_pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
-extern void filter_block1d8_v6_sse2(const short *src_ptr, unsigned char *output_ptr, unsigned int pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, short *filter);
-
-extern void vp8_filter_block2d_bil4x4_var_mmx
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const short *HFilter,
- const short *VFilter,
- int *sum,
- unsigned int *sumsquared
-);
-
-extern unsigned int vp8_get4x4var_mmx
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-
-unsigned int vp8_get_mb_ss_sse2
-(
- const short *src_ptr
-);
-unsigned int vp8_get16x16var_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-unsigned int vp8_get8x8var_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-void vp8_filter_block2d_bil_var_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int xoffset,
- int yoffset,
- int *sum,
- unsigned int *sumsquared
-);
-void vp8_half_horiz_vert_variance8x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp8_half_horiz_vert_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp8_half_horiz_variance8x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp8_half_horiz_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp8_half_vert_variance8x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp8_half_vert_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-
-unsigned int vp8_variance4x4_wmt(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
- vp8_get4x4var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 4));
-
-}
-
-unsigned int vp8_variance8x8_wmt
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int var;
- int avg;
-
- vp8_get8x8var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg) ;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 6));
-
-}
-
-
-unsigned int vp8_variance16x16_wmt
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int sse0;
- int sum0;
-
-
- vp8_get16x16var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- *sse = sse0;
- return (sse0 - (((unsigned int)sum0 * sum0) >> 8));
-}
-unsigned int vp8_mse16x16_wmt(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
-
- unsigned int sse0;
- int sum0;
- vp8_get16x16var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- *sse = sse0;
- return sse0;
-
-}
-
-
-unsigned int vp8_variance16x8_wmt
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int sse0, sse1, var;
- int sum0, sum1, avg;
-
- vp8_get8x8var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- vp8_get8x8var_sse2(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1, &sum1);
-
- var = sse0 + sse1;
- avg = sum0 + sum1;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-
-}
-
-unsigned int vp8_variance8x16_wmt
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse)
-{
- unsigned int sse0, sse1, var;
- int sum0, sum1, avg;
-
- vp8_get8x8var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0) ;
- vp8_get8x8var_sse2(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * recon_stride, recon_stride, &sse1, &sum1) ;
-
- var = sse0 + sse1;
- avg = sum0 + sum1;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-
-}
-
-unsigned int vp8_sub_pixel_variance4x4_wmt
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- int xsum;
- unsigned int xxsum;
- vp8_filter_block2d_bil4x4_var_mmx(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line,
- vp8_bilinear_filters_x86_4[xoffset], vp8_bilinear_filters_x86_4[yoffset],
- &xsum, &xxsum
- );
- *sse = xxsum;
- return (xxsum - (((unsigned int)xsum * xsum) >> 4));
-}
-
-
-unsigned int vp8_sub_pixel_variance8x8_wmt
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- int xsum;
- unsigned int xxsum;
-
- if (xoffset == 4 && yoffset == 0)
- {
- vp8_half_horiz_variance8x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum, &xxsum);
- }
- else if (xoffset == 0 && yoffset == 4)
- {
- vp8_half_vert_variance8x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum, &xxsum);
- }
- else if (xoffset == 4 && yoffset == 4)
- {
- vp8_half_horiz_vert_variance8x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum, &xxsum);
- }
- else
- {
- vp8_filter_block2d_bil_var_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- xoffset, yoffset,
- &xsum, &xxsum);
- }
-
- *sse = xxsum;
- return (xxsum - (((unsigned int)xsum * xsum) >> 6));
-}
-
-unsigned int vp8_sub_pixel_variance16x16_wmt
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- int xsum0, xsum1;
- unsigned int xxsum0, xxsum1;
-
-
- /* note we could avoid these if statements if the calling function
- * just called the appropriate functions inside.
- */
- if (xoffset == 4 && yoffset == 0)
- {
- vp8_half_horiz_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 0 && yoffset == 4)
- {
- vp8_half_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 4 && yoffset == 4)
- {
- vp8_half_horiz_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
- }
- else
- {
- vp8_filter_block2d_bil_var_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- xoffset, yoffset,
- &xsum0, &xxsum0
- );
-
- vp8_filter_block2d_bil_var_sse2(
- src_ptr + 8, src_pixels_per_line,
- dst_ptr + 8, dst_pixels_per_line, 16,
- xoffset, yoffset,
- &xsum1, &xxsum1
- );
- xsum0 += xsum1;
- xxsum0 += xxsum1;
- }
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
-
-unsigned int vp8_sub_pixel_mse16x16_wmt(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- vp8_sub_pixel_variance16x16_wmt(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse);
- return *sse;
-}
-
-unsigned int vp8_sub_pixel_variance16x8_wmt
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-
-)
-{
- int xsum0, xsum1;
- unsigned int xxsum0, xxsum1;
-
- if (xoffset == 4 && yoffset == 0)
- {
- vp8_half_horiz_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 0 && yoffset == 4)
- {
- vp8_half_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 4 && yoffset == 4)
- {
- vp8_half_horiz_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum0, &xxsum0);
- }
- else
- {
- vp8_filter_block2d_bil_var_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- xoffset, yoffset,
- &xsum0, &xxsum0);
-
- vp8_filter_block2d_bil_var_sse2(
- src_ptr + 8, src_pixels_per_line,
- dst_ptr + 8, dst_pixels_per_line, 8,
- xoffset, yoffset,
- &xsum1, &xxsum1);
- xsum0 += xsum1;
- xxsum0 += xxsum1;
- }
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 7));
-}
-
-unsigned int vp8_sub_pixel_variance8x16_wmt
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- int xsum;
- unsigned int xxsum;
-
- if (xoffset == 4 && yoffset == 0)
- {
- vp8_half_horiz_variance8x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum, &xxsum);
- }
- else if (xoffset == 0 && yoffset == 4)
- {
- vp8_half_vert_variance8x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum, &xxsum);
- }
- else if (xoffset == 4 && yoffset == 4)
- {
- vp8_half_horiz_vert_variance8x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum, &xxsum);
- }
- else
- {
- vp8_filter_block2d_bil_var_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- xoffset, yoffset,
- &xsum, &xxsum);
- }
-
- *sse = xxsum;
- return (xxsum - (((unsigned int)xsum * xsum) >> 7));
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_h_wmt(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse)
-{
- int xsum0;
- unsigned int xxsum0;
-
- vp8_half_horiz_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_v_wmt(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse)
-{
- int xsum0;
- unsigned int xxsum0;
- vp8_half_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
-
-
-unsigned int vp8_variance_halfpixvar16x16_hv_wmt(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse)
-{
- int xsum0;
- unsigned int xxsum0;
-
- vp8_half_horiz_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_ssse3.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_ssse3.c
deleted file mode 100644
index f90f811..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/variance_ssse3.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8/common/variance.h"
-#include "vp8/common/pragmas.h"
-#include "vpx_ports/mem.h"
-
-extern unsigned int vp8_get16x16var_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-extern void vp8_half_horiz_vert_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-extern void vp8_half_horiz_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-extern void vp8_half_vert_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-extern void vp8_filter_block2d_bil_var_ssse3
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int xoffset,
- int yoffset,
- int *sum,
- unsigned int *sumsquared
-);
-
-unsigned int vp8_sub_pixel_variance16x16_ssse3
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-)
-{
- int xsum0;
- unsigned int xxsum0;
-
- /* note we could avoid these if statements if the calling function
- * just called the appropriate functions inside.
- */
- if (xoffset == 4 && yoffset == 0)
- {
- vp8_half_horiz_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 0 && yoffset == 4)
- {
- vp8_half_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 4 && yoffset == 4)
- {
- vp8_half_horiz_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
- }
- else
- {
- vp8_filter_block2d_bil_var_ssse3(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- xoffset, yoffset,
- &xsum0, &xxsum0);
- }
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
-
-unsigned int vp8_sub_pixel_variance16x8_ssse3
-(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse
-
-)
-{
- int xsum0;
- unsigned int xxsum0;
-
- if (xoffset == 4 && yoffset == 0)
- {
- vp8_half_horiz_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 0 && yoffset == 4)
- {
- vp8_half_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum0, &xxsum0);
- }
- else if (xoffset == 4 && yoffset == 4)
- {
- vp8_half_horiz_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- &xsum0, &xxsum0);
- }
- else
- {
- vp8_filter_block2d_bil_var_ssse3(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 8,
- xoffset, yoffset,
- &xsum0, &xxsum0);
- }
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 7));
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/common/x86/vp8_asm_stubs.c b/videocodec/libvpx_internal/libvpx/vp8/common/x86/vp8_asm_stubs.c
deleted file mode 100644
index b409293..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/common/x86/vp8_asm_stubs.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_ports/mem.h"
-#include "filter_x86.h"
-
-extern const short vp8_six_tap_mmx[8][6*8];
-
-extern void vp8_filter_block1d_h6_mmx
-(
- unsigned char *src_ptr,
- unsigned short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-);
-extern void vp8_filter_block1dc_v6_mmx
-(
- unsigned short *src_ptr,
- unsigned char *output_ptr,
- int output_pitch,
- unsigned int pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-);
-extern void vp8_filter_block1d8_h6_sse2
-(
- unsigned char *src_ptr,
- unsigned short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-);
-extern void vp8_filter_block1d16_h6_sse2
-(
- unsigned char *src_ptr,
- unsigned short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-);
-extern void vp8_filter_block1d8_v6_sse2
-(
- unsigned short *src_ptr,
- unsigned char *output_ptr,
- int dst_ptich,
- unsigned int pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-);
-extern void vp8_filter_block1d16_v6_sse2
-(
- unsigned short *src_ptr,
- unsigned char *output_ptr,
- int dst_ptich,
- unsigned int pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter
-);
-extern void vp8_unpack_block1d16_h6_sse2
-(
- unsigned char *src_ptr,
- unsigned short *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int output_height,
- unsigned int output_width
-);
-extern void vp8_filter_block1d8_h6_only_sse2
-(
- unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- int dst_ptich,
- unsigned int output_height,
- const short *vp8_filter
-);
-extern void vp8_filter_block1d16_h6_only_sse2
-(
- unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- int dst_ptich,
- unsigned int output_height,
- const short *vp8_filter
-);
-extern void vp8_filter_block1d8_v6_only_sse2
-(
- unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- int dst_ptich,
- unsigned int output_height,
- const short *vp8_filter
-);
-
-
-#if HAVE_MMX
-void vp8_sixtap_predict4x4_mmx
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 16*16); /* Temp data bufffer used in filtering */
- const short *HFilter, *VFilter;
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 8, HFilter);
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1dc_v6_mmx(FData2 + 8, dst_ptr, dst_pitch, 8, 4 , 4, 4, VFilter);
-
-}
-
-
-void vp8_sixtap_predict16x16_mmx
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
-
- DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 24*24); /* Temp data bufffer used in filtering */
-
- const short *HFilter, *VFilter;
-
-
- HFilter = vp8_six_tap_mmx[xoffset];
-
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 21, 32, HFilter);
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 8, FData2 + 8, src_pixels_per_line, 1, 21, 32, HFilter);
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 12, FData2 + 12, src_pixels_per_line, 1, 21, 32, HFilter);
-
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1dc_v6_mmx(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, 16, VFilter);
- vp8_filter_block1dc_v6_mmx(FData2 + 36, dst_ptr + 4, dst_pitch, 32, 16 , 16, 16, VFilter);
- vp8_filter_block1dc_v6_mmx(FData2 + 40, dst_ptr + 8, dst_pitch, 32, 16 , 16, 16, VFilter);
- vp8_filter_block1dc_v6_mmx(FData2 + 44, dst_ptr + 12, dst_pitch, 32, 16 , 16, 16, VFilter);
-
-}
-
-
-void vp8_sixtap_predict8x8_mmx
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
-
- DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
-
- const short *HFilter, *VFilter;
-
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 13, 16, HFilter);
-
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1dc_v6_mmx(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, 8, VFilter);
- vp8_filter_block1dc_v6_mmx(FData2 + 20, dst_ptr + 4, dst_pitch, 16, 8 , 8, 8, VFilter);
-
-}
-
-
-void vp8_sixtap_predict8x4_mmx
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
-
- DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
-
- const short *HFilter, *VFilter;
-
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
- vp8_filter_block1d_h6_mmx(src_ptr - (2 * src_pixels_per_line) + 4, FData2 + 4, src_pixels_per_line, 1, 9, 16, HFilter);
-
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1dc_v6_mmx(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, 8, VFilter);
- vp8_filter_block1dc_v6_mmx(FData2 + 20, dst_ptr + 4, dst_pitch, 16, 8 , 4, 8, VFilter);
-
-}
-
-
-
-void vp8_bilinear_predict16x16_mmx
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- vp8_bilinear_predict8x8_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pitch);
- vp8_bilinear_predict8x8_mmx(src_ptr + 8, src_pixels_per_line, xoffset, yoffset, dst_ptr + 8, dst_pitch);
- vp8_bilinear_predict8x8_mmx(src_ptr + 8 * src_pixels_per_line, src_pixels_per_line, xoffset, yoffset, dst_ptr + dst_pitch * 8, dst_pitch);
- vp8_bilinear_predict8x8_mmx(src_ptr + 8 * src_pixels_per_line + 8, src_pixels_per_line, xoffset, yoffset, dst_ptr + dst_pitch * 8 + 8, dst_pitch);
-}
-#endif
-
-
-#if HAVE_SSE2
-void vp8_sixtap_predict16x16_sse2
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 24*24); /* Temp data bufffer used in filtering */
-
- const short *HFilter, *VFilter;
-
- if (xoffset)
- {
- if (yoffset)
- {
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
- }
- else
- {
- /* First-pass only */
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d16_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 16, HFilter);
- }
- }
- else
- {
- /* Second-pass only */
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_unpack_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 21, 32);
- vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
- }
-}
-
-
-void vp8_sixtap_predict8x8_sse2
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
- const short *HFilter, *VFilter;
-
- if (xoffset)
- {
- if (yoffset)
- {
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, dst_pitch, VFilter);
- }
- else
- {
- /* First-pass only */
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 8, HFilter);
- }
- }
- else
- {
- /* Second-pass only */
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 8, VFilter);
- }
-}
-
-
-void vp8_sixtap_predict8x4_sse2
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned short, FData2, 256); /* Temp data bufffer used in filtering */
- const short *HFilter, *VFilter;
-
- if (xoffset)
- {
- if (yoffset)
- {
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, dst_pitch, VFilter);
- }
- else
- {
- /* First-pass only */
- HFilter = vp8_six_tap_mmx[xoffset];
- vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, HFilter);
- }
- }
- else
- {
- /* Second-pass only */
- VFilter = vp8_six_tap_mmx[yoffset];
- vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, VFilter);
- }
-}
-
-#endif
-
-#if HAVE_SSSE3
-
-extern void vp8_filter_block1d8_h6_ssse3
-(
- unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int output_height,
- unsigned int vp8_filter_index
-);
-
-extern void vp8_filter_block1d16_h6_ssse3
-(
- unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int output_height,
- unsigned int vp8_filter_index
-);
-
-extern void vp8_filter_block1d16_v6_ssse3
-(
- unsigned char *src_ptr,
- unsigned int src_pitch,
- unsigned char *output_ptr,
- unsigned int out_pitch,
- unsigned int output_height,
- unsigned int vp8_filter_index
-);
-
-extern void vp8_filter_block1d8_v6_ssse3
-(
- unsigned char *src_ptr,
- unsigned int src_pitch,
- unsigned char *output_ptr,
- unsigned int out_pitch,
- unsigned int output_height,
- unsigned int vp8_filter_index
-);
-
-extern void vp8_filter_block1d4_h6_ssse3
-(
- unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int output_height,
- unsigned int vp8_filter_index
-);
-
-extern void vp8_filter_block1d4_v6_ssse3
-(
- unsigned char *src_ptr,
- unsigned int src_pitch,
- unsigned char *output_ptr,
- unsigned int out_pitch,
- unsigned int output_height,
- unsigned int vp8_filter_index
-);
-
-void vp8_sixtap_predict16x16_ssse3
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 24*24);
-
- if (xoffset)
- {
- if (yoffset)
- {
- vp8_filter_block1d16_h6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line, FData2,
- 16, 21, xoffset);
- vp8_filter_block1d16_v6_ssse3(FData2 , 16, dst_ptr, dst_pitch,
- 16, yoffset);
- }
- else
- {
- /* First-pass only */
- vp8_filter_block1d16_h6_ssse3(src_ptr, src_pixels_per_line,
- dst_ptr, dst_pitch, 16, xoffset);
- }
- }
- else
- {
- if (yoffset)
- {
- /* Second-pass only */
- vp8_filter_block1d16_v6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line,
- dst_ptr, dst_pitch, 16, yoffset);
- }
- else
- {
- /* ssse3 second-pass only function couldn't handle (xoffset==0 &&
- * yoffset==0) case correctly. Add copy function here to guarantee
- * six-tap function handles all possible offsets. */
- vp8_copy_mem16x16(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch);
- }
- }
-}
-
-void vp8_sixtap_predict8x8_ssse3
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 256);
-
- if (xoffset)
- {
- if (yoffset)
- {
- vp8_filter_block1d8_h6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line, FData2,
- 8, 13, xoffset);
- vp8_filter_block1d8_v6_ssse3(FData2, 8, dst_ptr, dst_pitch,
- 8, yoffset);
- }
- else
- {
- vp8_filter_block1d8_h6_ssse3(src_ptr, src_pixels_per_line,
- dst_ptr, dst_pitch, 8, xoffset);
- }
- }
- else
- {
- if (yoffset)
- {
- /* Second-pass only */
- vp8_filter_block1d8_v6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line,
- dst_ptr, dst_pitch, 8, yoffset);
- }
- else
- {
- /* ssse3 second-pass only function couldn't handle (xoffset==0 &&
- * yoffset==0) case correctly. Add copy function here to guarantee
- * six-tap function handles all possible offsets. */
- vp8_copy_mem8x8(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch);
- }
- }
-}
-
-
-void vp8_sixtap_predict8x4_ssse3
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 256);
-
- if (xoffset)
- {
- if (yoffset)
- {
- vp8_filter_block1d8_h6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line, FData2,
- 8, 9, xoffset);
- vp8_filter_block1d8_v6_ssse3(FData2, 8, dst_ptr, dst_pitch,
- 4, yoffset);
- }
- else
- {
- /* First-pass only */
- vp8_filter_block1d8_h6_ssse3(src_ptr, src_pixels_per_line,
- dst_ptr, dst_pitch, 4, xoffset);
- }
- }
- else
- {
- if (yoffset)
- {
- /* Second-pass only */
- vp8_filter_block1d8_v6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line,
- dst_ptr, dst_pitch, 4, yoffset);
- }
- else
- {
- /* ssse3 second-pass only function couldn't handle (xoffset==0 &&
- * yoffset==0) case correctly. Add copy function here to guarantee
- * six-tap function handles all possible offsets. */
- vp8_copy_mem8x4(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch);
- }
- }
-}
-
-void vp8_sixtap_predict4x4_ssse3
-(
- unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch
-)
-{
- DECLARE_ALIGNED_ARRAY(16, unsigned char, FData2, 4*9);
-
- if (xoffset)
- {
- if (yoffset)
- {
- vp8_filter_block1d4_h6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line,
- FData2, 4, 9, xoffset);
- vp8_filter_block1d4_v6_ssse3(FData2, 4, dst_ptr, dst_pitch,
- 4, yoffset);
- }
- else
- {
- vp8_filter_block1d4_h6_ssse3(src_ptr, src_pixels_per_line,
- dst_ptr, dst_pitch, 4, xoffset);
- }
- }
- else
- {
- if (yoffset)
- {
- vp8_filter_block1d4_v6_ssse3(src_ptr - (2 * src_pixels_per_line),
- src_pixels_per_line,
- dst_ptr, dst_pitch, 4, yoffset);
- }
- else
- {
- /* ssse3 second-pass only function couldn't handle (xoffset==0 &&
- * yoffset==0) case correctly. Add copy function here to guarantee
- * six-tap function handles all possible offsets. */
- int r;
-
- for (r = 0; r < 4; r++)
- {
- dst_ptr[0] = src_ptr[0];
- dst_ptr[1] = src_ptr[1];
- dst_ptr[2] = src_ptr[2];
- dst_ptr[3] = src_ptr[3];
- dst_ptr += dst_pitch;
- src_ptr += src_pixels_per_line;
- }
- }
- }
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.c b/videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.c
deleted file mode 100644
index 0007d7a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "dboolhuff.h"
-
-int vp8dx_start_decode(BOOL_DECODER *br,
- const unsigned char *source,
- unsigned int source_sz,
- vp8_decrypt_cb *decrypt_cb,
- void *decrypt_state)
-{
- br->user_buffer_end = source+source_sz;
- br->user_buffer = source;
- br->value = 0;
- br->count = -8;
- br->range = 255;
- br->decrypt_cb = decrypt_cb;
- br->decrypt_state = decrypt_state;
-
- if (source_sz && !source)
- return 1;
-
- /* Populate the buffer */
- vp8dx_bool_decoder_fill(br);
-
- return 0;
-}
-
-void vp8dx_bool_decoder_fill(BOOL_DECODER *br)
-{
- const unsigned char *bufptr = br->user_buffer;
- VP8_BD_VALUE value = br->value;
- int count = br->count;
- int shift = VP8_BD_VALUE_SIZE - 8 - (count + 8);
- size_t bytes_left = br->user_buffer_end - bufptr;
- size_t bits_left = bytes_left * CHAR_BIT;
- int x = (int)(shift + CHAR_BIT - bits_left);
- int loop_end = 0;
- unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1];
-
- if (br->decrypt_cb) {
- size_t n = bytes_left > sizeof(decrypted) ? sizeof(decrypted) : bytes_left;
- br->decrypt_cb(br->decrypt_state, bufptr, decrypted, (int)n);
- bufptr = decrypted;
- }
-
- if(x >= 0)
- {
- count += VP8_LOTS_OF_BITS;
- loop_end = x;
- }
-
- if (x < 0 || bits_left)
- {
- while(shift >= loop_end)
- {
- count += CHAR_BIT;
- value |= (VP8_BD_VALUE)*bufptr << shift;
- ++bufptr;
- ++br->user_buffer;
- shift -= CHAR_BIT;
- }
- }
-
- br->value = value;
- br->count = count;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.h
deleted file mode 100644
index 36af7ee..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/dboolhuff.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_DECODER_DBOOLHUFF_H_
-#define VP8_DECODER_DBOOLHUFF_H_
-
-#include <stddef.h>
-#include <limits.h>
-
-#include "vpx_config.h"
-#include "vpx_ports/mem.h"
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef size_t VP8_BD_VALUE;
-
-#define VP8_BD_VALUE_SIZE ((int)sizeof(VP8_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 VP8_LOTS_OF_BITS (0x40000000)
-
-/*Decrypt n bytes of data from input -> output, using the decrypt_state
- passed in VP8D_SET_DECRYPTOR.
-*/
-typedef void (vp8_decrypt_cb)(void *decrypt_state, const unsigned char *input,
- unsigned char *output, int count);
-
-typedef struct
-{
- const unsigned char *user_buffer_end;
- const unsigned char *user_buffer;
- VP8_BD_VALUE value;
- int count;
- unsigned int range;
- vp8_decrypt_cb *decrypt_cb;
- void *decrypt_state;
-} BOOL_DECODER;
-
-DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
-
-int vp8dx_start_decode(BOOL_DECODER *br,
- const unsigned char *source,
- unsigned int source_sz,
- vp8_decrypt_cb *decrypt_cb,
- void *decrypt_state);
-
-void vp8dx_bool_decoder_fill(BOOL_DECODER *br);
-
-
-static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
- unsigned int bit = 0;
- VP8_BD_VALUE value;
- unsigned int split;
- VP8_BD_VALUE bigsplit;
- int count;
- unsigned int range;
-
- split = 1 + (((br->range - 1) * probability) >> 8);
-
- if(br->count < 0)
- vp8dx_bool_decoder_fill(br);
-
- value = br->value;
- count = br->count;
-
- bigsplit = (VP8_BD_VALUE)split << (VP8_BD_VALUE_SIZE - 8);
-
- range = split;
-
- if (value >= bigsplit)
- {
- range = br->range - split;
- value = value - bigsplit;
- bit = 1;
- }
-
- {
- register unsigned int shift = vp8_norm[range];
- range <<= shift;
- value <<= shift;
- count -= shift;
- }
- br->value = value;
- br->count = count;
- br->range = range;
-
- return bit;
-}
-
-static int vp8_decode_value(BOOL_DECODER *br, int bits)
-{
- int z = 0;
- int bit;
-
- for (bit = bits - 1; bit >= 0; bit--)
- {
- z |= (vp8dx_decode_bool(br, 0x80) << bit);
- }
-
- return z;
-}
-
-static int vp8dx_bool_error(BOOL_DECODER *br)
-{
- /* 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 VP8_LOTS_OF_BITS. So when
- * count == VP8_LOTS_OF_BITS - 1, the user's data has been exhausted.
- */
- if ((br->count > VP8_BD_VALUE_SIZE) && (br->count < VP8_LOTS_OF_BITS))
- {
- /* We have tried to decode bits after the end of
- * stream was encountered.
- */
- return 1;
- }
-
- /* No error. */
- return 0;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_DBOOLHUFF_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/decodeframe.c b/videocodec/libvpx_internal/libvpx/vp8/decoder/decodeframe.c
deleted file mode 100644
index 2ea6f11..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/decodeframe.c
+++ /dev/null
@@ -1,1389 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "./vpx_scale_rtcd.h"
-#include "onyxd_int.h"
-#include "vp8/common/header.h"
-#include "vp8/common/reconintra4x4.h"
-#include "vp8/common/reconinter.h"
-#include "detokenize.h"
-#include "vp8/common/invtrans.h"
-#include "vp8/common/alloccommon.h"
-#include "vp8/common/entropymode.h"
-#include "vp8/common/quant_common.h"
-#include "vpx_scale/vpx_scale.h"
-#include "vp8/common/setupintrarecon.h"
-
-#include "decodemv.h"
-#include "vp8/common/extend.h"
-#if CONFIG_ERROR_CONCEALMENT
-#include "error_concealment.h"
-#endif
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/threading.h"
-#include "decoderthreading.h"
-#include "dboolhuff.h"
-
-#include <assert.h>
-#include <stdio.h>
-
-void vp8cx_init_de_quantizer(VP8D_COMP *pbi)
-{
- int Q;
- VP8_COMMON *const pc = & pbi->common;
-
- for (Q = 0; Q < QINDEX_RANGE; Q++)
- {
- pc->Y1dequant[Q][0] = (short)vp8_dc_quant(Q, pc->y1dc_delta_q);
- pc->Y2dequant[Q][0] = (short)vp8_dc2quant(Q, pc->y2dc_delta_q);
- pc->UVdequant[Q][0] = (short)vp8_dc_uv_quant(Q, pc->uvdc_delta_q);
-
- pc->Y1dequant[Q][1] = (short)vp8_ac_yquant(Q);
- pc->Y2dequant[Q][1] = (short)vp8_ac2quant(Q, pc->y2ac_delta_q);
- pc->UVdequant[Q][1] = (short)vp8_ac_uv_quant(Q, pc->uvac_delta_q);
- }
-}
-
-void vp8_mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd)
-{
- int i;
- int QIndex;
- MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
- VP8_COMMON *const pc = & pbi->common;
-
- /* Decide whether to use the default or alternate baseline Q value. */
- if (xd->segmentation_enabled)
- {
- /* Abs Value */
- if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
- QIndex = xd->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id];
-
- /* Delta Value */
- else
- {
- QIndex = pc->base_qindex + xd->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id];
- QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0; /* Clamp to valid range */
- }
- }
- else
- QIndex = pc->base_qindex;
-
- /* Set up the macroblock dequant constants */
- xd->dequant_y1_dc[0] = 1;
- xd->dequant_y1[0] = pc->Y1dequant[QIndex][0];
- xd->dequant_y2[0] = pc->Y2dequant[QIndex][0];
- xd->dequant_uv[0] = pc->UVdequant[QIndex][0];
-
- for (i = 1; i < 16; i++)
- {
- xd->dequant_y1_dc[i] =
- xd->dequant_y1[i] = pc->Y1dequant[QIndex][1];
- xd->dequant_y2[i] = pc->Y2dequant[QIndex][1];
- xd->dequant_uv[i] = pc->UVdequant[QIndex][1];
- }
-}
-
-static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
- unsigned int mb_idx)
-{
- MB_PREDICTION_MODE mode;
- int i;
-#if CONFIG_ERROR_CONCEALMENT
- int corruption_detected = 0;
-#endif
- (void)mb_idx;
- if (xd->mode_info_context->mbmi.mb_skip_coeff)
- {
- vp8_reset_mb_tokens_context(xd);
- }
- else if (!vp8dx_bool_error(xd->current_bc))
- {
- int eobtotal;
- eobtotal = vp8_decode_mb_tokens(pbi, xd);
-
- /* Special case: Force the loopfilter to skip when eobtotal is zero */
- xd->mode_info_context->mbmi.mb_skip_coeff = (eobtotal==0);
- }
-
- mode = xd->mode_info_context->mbmi.mode;
-
- if (xd->segmentation_enabled)
- vp8_mb_init_dequantizer(pbi, xd);
-
-
-#if CONFIG_ERROR_CONCEALMENT
-
- if(pbi->ec_active)
- {
- int throw_residual;
- /* When we have independent partitions we can apply residual even
- * though other partitions within the frame are corrupt.
- */
- throw_residual = (!pbi->independent_partitions &&
- pbi->frame_corrupt_residual);
- throw_residual = (throw_residual || vp8dx_bool_error(xd->current_bc));
-
- if ((mb_idx >= pbi->mvs_corrupt_from_mb || throw_residual))
- {
- /* MB with corrupt residuals or corrupt mode/motion vectors.
- * Better to use the predictor as reconstruction.
- */
- pbi->frame_corrupt_residual = 1;
- vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
- vp8_conceal_corrupt_mb(xd);
-
-
- corruption_detected = 1;
-
- /* force idct to be skipped for B_PRED and use the
- * prediction only for reconstruction
- * */
- vpx_memset(xd->eobs, 0, 25);
- }
- }
-#endif
-
- /* do prediction */
- if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
- {
- vp8_build_intra_predictors_mbuv_s(xd,
- xd->recon_above[1],
- xd->recon_above[2],
- xd->recon_left[1],
- xd->recon_left[2],
- xd->recon_left_stride[1],
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.uv_stride);
-
- if (mode != B_PRED)
- {
- vp8_build_intra_predictors_mby_s(xd,
- xd->recon_above[0],
- xd->recon_left[0],
- xd->recon_left_stride[0],
- xd->dst.y_buffer,
- xd->dst.y_stride);
- }
- else
- {
- short *DQC = xd->dequant_y1;
- int dst_stride = xd->dst.y_stride;
-
- /* clear out residual eob info */
- if(xd->mode_info_context->mbmi.mb_skip_coeff)
- vpx_memset(xd->eobs, 0, 25);
-
- intra_prediction_down_copy(xd, xd->recon_above[0] + 16);
-
- for (i = 0; i < 16; i++)
- {
- BLOCKD *b = &xd->block[i];
- unsigned char *dst = xd->dst.y_buffer + b->offset;
- B_PREDICTION_MODE b_mode =
- xd->mode_info_context->bmi[i].as_mode;
- unsigned char *Above = dst - dst_stride;
- unsigned char *yleft = dst - 1;
- int left_stride = dst_stride;
- unsigned char top_left = Above[-1];
-
- vp8_intra4x4_predict(Above, yleft, left_stride, b_mode,
- dst, dst_stride, top_left);
-
- if (xd->eobs[i])
- {
- if (xd->eobs[i] > 1)
- {
- vp8_dequant_idct_add(b->qcoeff, DQC, dst, dst_stride);
- }
- else
- {
- vp8_dc_only_idct_add
- (b->qcoeff[0] * DQC[0],
- dst, dst_stride,
- dst, dst_stride);
- vpx_memset(b->qcoeff, 0, 2 * sizeof(b->qcoeff[0]));
- }
- }
- }
- }
- }
- else
- {
- vp8_build_inter_predictors_mb(xd);
- }
-
-
-#if CONFIG_ERROR_CONCEALMENT
- if (corruption_detected)
- {
- return;
- }
-#endif
-
- if(!xd->mode_info_context->mbmi.mb_skip_coeff)
- {
- /* dequantization and idct */
- if (mode != B_PRED)
- {
- short *DQC = xd->dequant_y1;
-
- if (mode != SPLITMV)
- {
- BLOCKD *b = &xd->block[24];
-
- /* do 2nd order transform on the dc block */
- if (xd->eobs[24] > 1)
- {
- vp8_dequantize_b(b, xd->dequant_y2);
-
- vp8_short_inv_walsh4x4(&b->dqcoeff[0],
- xd->qcoeff);
- vpx_memset(b->qcoeff, 0, 16 * sizeof(b->qcoeff[0]));
- }
- else
- {
- b->dqcoeff[0] = b->qcoeff[0] * xd->dequant_y2[0];
- vp8_short_inv_walsh4x4_1(&b->dqcoeff[0],
- xd->qcoeff);
- vpx_memset(b->qcoeff, 0, 2 * sizeof(b->qcoeff[0]));
- }
-
- /* override the dc dequant constant in order to preserve the
- * dc components
- */
- DQC = xd->dequant_y1_dc;
- }
-
- vp8_dequant_idct_add_y_block
- (xd->qcoeff, DQC,
- xd->dst.y_buffer,
- xd->dst.y_stride, xd->eobs);
- }
-
- vp8_dequant_idct_add_uv_block
- (xd->qcoeff+16*16, xd->dequant_uv,
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.uv_stride, xd->eobs+16);
- }
-}
-
-static int get_delta_q(vp8_reader *bc, int prev, int *q_update)
-{
- int ret_val = 0;
-
- if (vp8_read_bit(bc))
- {
- ret_val = vp8_read_literal(bc, 4);
-
- if (vp8_read_bit(bc))
- ret_val = -ret_val;
- }
-
- /* Trigger a quantizer update if the delta-q value has changed */
- if (ret_val != prev)
- *q_update = 1;
-
- return ret_val;
-}
-
-#ifdef PACKET_TESTING
-#include <stdio.h>
-FILE *vpxlog = 0;
-#endif
-
-static void yv12_extend_frame_top_c(YV12_BUFFER_CONFIG *ybf)
-{
- int i;
- unsigned char *src_ptr1;
- unsigned char *dest_ptr1;
-
- unsigned int Border;
- int plane_stride;
-
- /***********/
- /* Y Plane */
- /***********/
- Border = ybf->border;
- plane_stride = ybf->y_stride;
- src_ptr1 = ybf->y_buffer - Border;
- dest_ptr1 = src_ptr1 - (Border * plane_stride);
-
- for (i = 0; i < (int)Border; i++)
- {
- vpx_memcpy(dest_ptr1, src_ptr1, plane_stride);
- dest_ptr1 += plane_stride;
- }
-
-
- /***********/
- /* U Plane */
- /***********/
- plane_stride = ybf->uv_stride;
- Border /= 2;
- src_ptr1 = ybf->u_buffer - Border;
- dest_ptr1 = src_ptr1 - (Border * plane_stride);
-
- for (i = 0; i < (int)(Border); i++)
- {
- vpx_memcpy(dest_ptr1, src_ptr1, plane_stride);
- dest_ptr1 += plane_stride;
- }
-
- /***********/
- /* V Plane */
- /***********/
-
- src_ptr1 = ybf->v_buffer - Border;
- dest_ptr1 = src_ptr1 - (Border * plane_stride);
-
- for (i = 0; i < (int)(Border); i++)
- {
- vpx_memcpy(dest_ptr1, src_ptr1, plane_stride);
- dest_ptr1 += plane_stride;
- }
-}
-
-static void yv12_extend_frame_bottom_c(YV12_BUFFER_CONFIG *ybf)
-{
- int i;
- unsigned char *src_ptr1, *src_ptr2;
- unsigned char *dest_ptr2;
-
- unsigned int Border;
- int plane_stride;
- int plane_height;
-
- /***********/
- /* Y Plane */
- /***********/
- Border = ybf->border;
- plane_stride = ybf->y_stride;
- plane_height = ybf->y_height;
-
- src_ptr1 = ybf->y_buffer - Border;
- src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride;
- dest_ptr2 = src_ptr2 + plane_stride;
-
- for (i = 0; i < (int)Border; i++)
- {
- vpx_memcpy(dest_ptr2, src_ptr2, plane_stride);
- dest_ptr2 += plane_stride;
- }
-
-
- /***********/
- /* U Plane */
- /***********/
- plane_stride = ybf->uv_stride;
- plane_height = ybf->uv_height;
- Border /= 2;
-
- src_ptr1 = ybf->u_buffer - Border;
- src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride;
- dest_ptr2 = src_ptr2 + plane_stride;
-
- for (i = 0; i < (int)(Border); i++)
- {
- vpx_memcpy(dest_ptr2, src_ptr2, plane_stride);
- dest_ptr2 += plane_stride;
- }
-
- /***********/
- /* V Plane */
- /***********/
-
- src_ptr1 = ybf->v_buffer - Border;
- src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride;
- dest_ptr2 = src_ptr2 + plane_stride;
-
- for (i = 0; i < (int)(Border); i++)
- {
- vpx_memcpy(dest_ptr2, src_ptr2, plane_stride);
- dest_ptr2 += plane_stride;
- }
-}
-
-static void yv12_extend_frame_left_right_c(YV12_BUFFER_CONFIG *ybf,
- unsigned char *y_src,
- unsigned char *u_src,
- unsigned char *v_src)
-{
- int i;
- unsigned char *src_ptr1, *src_ptr2;
- unsigned char *dest_ptr1, *dest_ptr2;
-
- unsigned int Border;
- int plane_stride;
- int plane_height;
- int plane_width;
-
- /***********/
- /* Y Plane */
- /***********/
- Border = ybf->border;
- plane_stride = ybf->y_stride;
- plane_height = 16;
- plane_width = ybf->y_width;
-
- /* copy the left and right most columns out */
- src_ptr1 = y_src;
- src_ptr2 = src_ptr1 + plane_width - 1;
- dest_ptr1 = src_ptr1 - Border;
- dest_ptr2 = src_ptr2 + 1;
-
- for (i = 0; i < plane_height; i++)
- {
- vpx_memset(dest_ptr1, src_ptr1[0], Border);
- vpx_memset(dest_ptr2, src_ptr2[0], Border);
- src_ptr1 += plane_stride;
- src_ptr2 += plane_stride;
- dest_ptr1 += plane_stride;
- dest_ptr2 += plane_stride;
- }
-
- /***********/
- /* U Plane */
- /***********/
- plane_stride = ybf->uv_stride;
- plane_height = 8;
- plane_width = ybf->uv_width;
- Border /= 2;
-
- /* copy the left and right most columns out */
- src_ptr1 = u_src;
- src_ptr2 = src_ptr1 + plane_width - 1;
- dest_ptr1 = src_ptr1 - Border;
- dest_ptr2 = src_ptr2 + 1;
-
- for (i = 0; i < plane_height; i++)
- {
- vpx_memset(dest_ptr1, src_ptr1[0], Border);
- vpx_memset(dest_ptr2, src_ptr2[0], Border);
- src_ptr1 += plane_stride;
- src_ptr2 += plane_stride;
- dest_ptr1 += plane_stride;
- dest_ptr2 += plane_stride;
- }
-
- /***********/
- /* V Plane */
- /***********/
-
- /* copy the left and right most columns out */
- src_ptr1 = v_src;
- src_ptr2 = src_ptr1 + plane_width - 1;
- dest_ptr1 = src_ptr1 - Border;
- dest_ptr2 = src_ptr2 + 1;
-
- for (i = 0; i < plane_height; i++)
- {
- vpx_memset(dest_ptr1, src_ptr1[0], Border);
- vpx_memset(dest_ptr2, src_ptr2[0], Border);
- src_ptr1 += plane_stride;
- src_ptr2 += plane_stride;
- dest_ptr1 += plane_stride;
- dest_ptr2 += plane_stride;
- }
-}
-
-static void decode_mb_rows(VP8D_COMP *pbi)
-{
- VP8_COMMON *const pc = & pbi->common;
- MACROBLOCKD *const xd = & pbi->mb;
-
- MODE_INFO *lf_mic = xd->mode_info_context;
-
- int ibc = 0;
- int num_part = 1 << pc->multi_token_partition;
-
- int recon_yoffset, recon_uvoffset;
- int mb_row, mb_col;
- int mb_idx = 0;
-
- YV12_BUFFER_CONFIG *yv12_fb_new = pbi->dec_fb_ref[INTRA_FRAME];
-
- int recon_y_stride = yv12_fb_new->y_stride;
- int recon_uv_stride = yv12_fb_new->uv_stride;
-
- unsigned char *ref_buffer[MAX_REF_FRAMES][3];
- unsigned char *dst_buffer[3];
- unsigned char *lf_dst[3];
- unsigned char *eb_dst[3];
- int i;
- int ref_fb_corrupted[MAX_REF_FRAMES];
-
- ref_fb_corrupted[INTRA_FRAME] = 0;
-
- for(i = 1; i < MAX_REF_FRAMES; i++)
- {
- YV12_BUFFER_CONFIG *this_fb = pbi->dec_fb_ref[i];
-
- ref_buffer[i][0] = this_fb->y_buffer;
- ref_buffer[i][1] = this_fb->u_buffer;
- ref_buffer[i][2] = this_fb->v_buffer;
-
- ref_fb_corrupted[i] = this_fb->corrupted;
- }
-
- /* Set up the buffer pointers */
- eb_dst[0] = lf_dst[0] = dst_buffer[0] = yv12_fb_new->y_buffer;
- eb_dst[1] = lf_dst[1] = dst_buffer[1] = yv12_fb_new->u_buffer;
- eb_dst[2] = lf_dst[2] = dst_buffer[2] = yv12_fb_new->v_buffer;
-
- xd->up_available = 0;
-
- /* Initialize the loop filter for this frame. */
- if(pc->filter_level)
- vp8_loop_filter_frame_init(pc, xd, pc->filter_level);
-
- vp8_setup_intra_recon_top_line(yv12_fb_new);
-
- /* Decode the individual macro block */
- for (mb_row = 0; mb_row < pc->mb_rows; mb_row++)
- {
- if (num_part > 1)
- {
- xd->current_bc = & pbi->mbc[ibc];
- ibc++;
-
- if (ibc == num_part)
- ibc = 0;
- }
-
- recon_yoffset = mb_row * recon_y_stride * 16;
- recon_uvoffset = mb_row * recon_uv_stride * 8;
-
- /* reset contexts */
- xd->above_context = pc->above_context;
- vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
-
- xd->left_available = 0;
-
- xd->mb_to_top_edge = -((mb_row * 16) << 3);
- xd->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3;
-
- xd->recon_above[0] = dst_buffer[0] + recon_yoffset;
- xd->recon_above[1] = dst_buffer[1] + recon_uvoffset;
- xd->recon_above[2] = dst_buffer[2] + recon_uvoffset;
-
- xd->recon_left[0] = xd->recon_above[0] - 1;
- xd->recon_left[1] = xd->recon_above[1] - 1;
- xd->recon_left[2] = xd->recon_above[2] - 1;
-
- xd->recon_above[0] -= xd->dst.y_stride;
- xd->recon_above[1] -= xd->dst.uv_stride;
- xd->recon_above[2] -= xd->dst.uv_stride;
-
- /* TODO: move to outside row loop */
- xd->recon_left_stride[0] = xd->dst.y_stride;
- xd->recon_left_stride[1] = xd->dst.uv_stride;
-
- setup_intra_recon_left(xd->recon_left[0], xd->recon_left[1],
- xd->recon_left[2], xd->dst.y_stride,
- xd->dst.uv_stride);
-
- for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
- {
- /* Distance of Mb to the various image edges.
- * These are specified to 8th pel as they are always compared to values
- * that are in 1/8th pel units
- */
- xd->mb_to_left_edge = -((mb_col * 16) << 3);
- xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3;
-
-#if CONFIG_ERROR_CONCEALMENT
- {
- int corrupt_residual = (!pbi->independent_partitions &&
- pbi->frame_corrupt_residual) ||
- vp8dx_bool_error(xd->current_bc);
- if (pbi->ec_active &&
- xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME &&
- corrupt_residual)
- {
- /* We have an intra block with corrupt coefficients, better to
- * conceal with an inter block. Interpolate MVs from neighboring
- * MBs.
- *
- * Note that for the first mb with corrupt residual in a frame,
- * we might not discover that before decoding the residual. That
- * happens after this check, and therefore no inter concealment
- * will be done.
- */
- vp8_interpolate_motion(xd,
- mb_row, mb_col,
- pc->mb_rows, pc->mb_cols,
- pc->mode_info_stride);
- }
- }
-#endif
-
- xd->dst.y_buffer = dst_buffer[0] + recon_yoffset;
- xd->dst.u_buffer = dst_buffer[1] + recon_uvoffset;
- xd->dst.v_buffer = dst_buffer[2] + recon_uvoffset;
-
- xd->pre.y_buffer = ref_buffer[xd->mode_info_context->mbmi.ref_frame][0] + recon_yoffset;
- xd->pre.u_buffer = ref_buffer[xd->mode_info_context->mbmi.ref_frame][1] + recon_uvoffset;
- xd->pre.v_buffer = ref_buffer[xd->mode_info_context->mbmi.ref_frame][2] + recon_uvoffset;
-
- /* propagate errors from reference frames */
- xd->corrupted |= ref_fb_corrupted[xd->mode_info_context->mbmi.ref_frame];
-
- decode_macroblock(pbi, xd, mb_idx);
-
- mb_idx++;
- xd->left_available = 1;
-
- /* check if the boolean decoder has suffered an error */
- xd->corrupted |= vp8dx_bool_error(xd->current_bc);
-
- xd->recon_above[0] += 16;
- xd->recon_above[1] += 8;
- xd->recon_above[2] += 8;
- xd->recon_left[0] += 16;
- xd->recon_left[1] += 8;
- xd->recon_left[2] += 8;
-
- recon_yoffset += 16;
- recon_uvoffset += 8;
-
- ++xd->mode_info_context; /* next mb */
-
- xd->above_context++;
- }
-
- /* adjust to the next row of mbs */
- vp8_extend_mb_row(yv12_fb_new, xd->dst.y_buffer + 16,
- xd->dst.u_buffer + 8, xd->dst.v_buffer + 8);
-
- ++xd->mode_info_context; /* skip prediction column */
- xd->up_available = 1;
-
- if(pc->filter_level)
- {
- if(mb_row > 0)
- {
- if (pc->filter_type == NORMAL_LOOPFILTER)
- vp8_loop_filter_row_normal(pc, lf_mic, mb_row-1,
- recon_y_stride, recon_uv_stride,
- lf_dst[0], lf_dst[1], lf_dst[2]);
- else
- vp8_loop_filter_row_simple(pc, lf_mic, mb_row-1,
- recon_y_stride, recon_uv_stride,
- lf_dst[0], lf_dst[1], lf_dst[2]);
- if(mb_row > 1)
- {
- yv12_extend_frame_left_right_c(yv12_fb_new,
- eb_dst[0],
- eb_dst[1],
- eb_dst[2]);
-
- eb_dst[0] += recon_y_stride * 16;
- eb_dst[1] += recon_uv_stride * 8;
- eb_dst[2] += recon_uv_stride * 8;
- }
-
- lf_dst[0] += recon_y_stride * 16;
- lf_dst[1] += recon_uv_stride * 8;
- lf_dst[2] += recon_uv_stride * 8;
- lf_mic += pc->mb_cols;
- lf_mic++; /* Skip border mb */
- }
- }
- else
- {
- if(mb_row > 0)
- {
- /**/
- yv12_extend_frame_left_right_c(yv12_fb_new,
- eb_dst[0],
- eb_dst[1],
- eb_dst[2]);
- eb_dst[0] += recon_y_stride * 16;
- eb_dst[1] += recon_uv_stride * 8;
- eb_dst[2] += recon_uv_stride * 8;
- }
- }
- }
-
- if(pc->filter_level)
- {
- if (pc->filter_type == NORMAL_LOOPFILTER)
- vp8_loop_filter_row_normal(pc, lf_mic, mb_row-1, recon_y_stride,
- recon_uv_stride, lf_dst[0], lf_dst[1],
- lf_dst[2]);
- else
- vp8_loop_filter_row_simple(pc, lf_mic, mb_row-1, recon_y_stride,
- recon_uv_stride, lf_dst[0], lf_dst[1],
- lf_dst[2]);
-
- yv12_extend_frame_left_right_c(yv12_fb_new,
- eb_dst[0],
- eb_dst[1],
- eb_dst[2]);
- eb_dst[0] += recon_y_stride * 16;
- eb_dst[1] += recon_uv_stride * 8;
- eb_dst[2] += recon_uv_stride * 8;
- }
- yv12_extend_frame_left_right_c(yv12_fb_new,
- eb_dst[0],
- eb_dst[1],
- eb_dst[2]);
- yv12_extend_frame_top_c(yv12_fb_new);
- yv12_extend_frame_bottom_c(yv12_fb_new);
-
-}
-
-static unsigned int read_partition_size(VP8D_COMP *pbi,
- const unsigned char *cx_size)
-{
- unsigned char temp[3];
- if (pbi->decrypt_cb)
- {
- pbi->decrypt_cb(pbi->decrypt_state, cx_size, temp, 3);
- cx_size = temp;
- }
- return cx_size[0] + (cx_size[1] << 8) + (cx_size[2] << 16);
-}
-
-static int read_is_valid(const unsigned char *start,
- size_t len,
- const unsigned char *end)
-{
- return (start + len > start && start + len <= end);
-}
-
-static unsigned int read_available_partition_size(
- VP8D_COMP *pbi,
- const unsigned char *token_part_sizes,
- const unsigned char *fragment_start,
- const unsigned char *first_fragment_end,
- const unsigned char *fragment_end,
- int i,
- int num_part)
-{
- VP8_COMMON* pc = &pbi->common;
- const unsigned char *partition_size_ptr = token_part_sizes + i * 3;
- unsigned int partition_size = 0;
- ptrdiff_t bytes_left = fragment_end - fragment_start;
- /* Calculate the length of this partition. The last partition
- * size is implicit. If the partition size can't be read, then
- * either use the remaining data in the buffer (for EC mode)
- * or throw an error.
- */
- if (i < num_part - 1)
- {
- if (read_is_valid(partition_size_ptr, 3, first_fragment_end))
- partition_size = read_partition_size(pbi, partition_size_ptr);
- else if (pbi->ec_active)
- partition_size = (unsigned int)bytes_left;
- else
- vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
- "Truncated partition size data");
- }
- else
- partition_size = (unsigned int)bytes_left;
-
- /* Validate the calculated partition length. If the buffer
- * described by the partition can't be fully read, then restrict
- * it to the portion that can be (for EC mode) or throw an error.
- */
- if (!read_is_valid(fragment_start, partition_size, fragment_end))
- {
- if (pbi->ec_active)
- partition_size = (unsigned int)bytes_left;
- else
- vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt partition "
- "%d length", i + 1);
- }
- return partition_size;
-}
-
-
-static void setup_token_decoder(VP8D_COMP *pbi,
- const unsigned char* token_part_sizes)
-{
- vp8_reader *bool_decoder = &pbi->mbc[0];
- unsigned int partition_idx;
- unsigned int fragment_idx;
- unsigned int num_token_partitions;
- const unsigned char *first_fragment_end = pbi->fragments.ptrs[0] +
- pbi->fragments.sizes[0];
-
- TOKEN_PARTITION multi_token_partition =
- (TOKEN_PARTITION)vp8_read_literal(&pbi->mbc[8], 2);
- if (!vp8dx_bool_error(&pbi->mbc[8]))
- pbi->common.multi_token_partition = multi_token_partition;
- num_token_partitions = 1 << pbi->common.multi_token_partition;
-
- /* Check for partitions within the fragments and unpack the fragments
- * so that each fragment pointer points to its corresponding partition. */
- for (fragment_idx = 0; fragment_idx < pbi->fragments.count; ++fragment_idx)
- {
- unsigned int fragment_size = pbi->fragments.sizes[fragment_idx];
- const unsigned char *fragment_end = pbi->fragments.ptrs[fragment_idx] +
- fragment_size;
- /* Special case for handling the first partition since we have already
- * read its size. */
- if (fragment_idx == 0)
- {
- /* Size of first partition + token partition sizes element */
- ptrdiff_t ext_first_part_size = token_part_sizes -
- pbi->fragments.ptrs[0] + 3 * (num_token_partitions - 1);
- fragment_size -= (unsigned int)ext_first_part_size;
- if (fragment_size > 0)
- {
- pbi->fragments.sizes[0] = (unsigned int)ext_first_part_size;
- /* The fragment contains an additional partition. Move to
- * next. */
- fragment_idx++;
- pbi->fragments.ptrs[fragment_idx] = pbi->fragments.ptrs[0] +
- pbi->fragments.sizes[0];
- }
- }
- /* Split the chunk into partitions read from the bitstream */
- while (fragment_size > 0)
- {
- ptrdiff_t partition_size = read_available_partition_size(
- pbi,
- token_part_sizes,
- pbi->fragments.ptrs[fragment_idx],
- first_fragment_end,
- fragment_end,
- fragment_idx - 1,
- num_token_partitions);
- pbi->fragments.sizes[fragment_idx] = (unsigned int)partition_size;
- fragment_size -= (unsigned int)partition_size;
- assert(fragment_idx <= num_token_partitions);
- if (fragment_size > 0)
- {
- /* The fragment contains an additional partition.
- * Move to next. */
- fragment_idx++;
- pbi->fragments.ptrs[fragment_idx] =
- pbi->fragments.ptrs[fragment_idx - 1] + partition_size;
- }
- }
- }
-
- pbi->fragments.count = num_token_partitions + 1;
-
- for (partition_idx = 1; partition_idx < pbi->fragments.count; ++partition_idx)
- {
- if (vp8dx_start_decode(bool_decoder,
- pbi->fragments.ptrs[partition_idx],
- pbi->fragments.sizes[partition_idx],
- pbi->decrypt_cb, pbi->decrypt_state))
- vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate bool decoder %d",
- partition_idx);
-
- bool_decoder++;
- }
-
-#if CONFIG_MULTITHREAD
- /* Clamp number of decoder threads */
- if (pbi->decoding_thread_count > num_token_partitions - 1)
- pbi->decoding_thread_count = num_token_partitions - 1;
-#endif
-}
-
-
-static void init_frame(VP8D_COMP *pbi)
-{
- VP8_COMMON *const pc = & pbi->common;
- MACROBLOCKD *const xd = & pbi->mb;
-
- if (pc->frame_type == KEY_FRAME)
- {
- /* Various keyframe initializations */
- vpx_memcpy(pc->fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context));
-
- vp8_init_mbmode_probs(pc);
-
- vp8_default_coef_probs(pc);
-
- /* reset the segment feature data to 0 with delta coding (Default state). */
- vpx_memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
- xd->mb_segement_abs_delta = SEGMENT_DELTADATA;
-
- /* reset the mode ref deltasa for loop filter */
- vpx_memset(xd->ref_lf_deltas, 0, sizeof(xd->ref_lf_deltas));
- vpx_memset(xd->mode_lf_deltas, 0, sizeof(xd->mode_lf_deltas));
-
- /* All buffers are implicitly updated on key frames. */
- pc->refresh_golden_frame = 1;
- pc->refresh_alt_ref_frame = 1;
- pc->copy_buffer_to_gf = 0;
- pc->copy_buffer_to_arf = 0;
-
- /* Note that Golden and Altref modes cannot be used on a key frame so
- * ref_frame_sign_bias[] is undefined and meaningless
- */
- pc->ref_frame_sign_bias[GOLDEN_FRAME] = 0;
- pc->ref_frame_sign_bias[ALTREF_FRAME] = 0;
- }
- else
- {
- /* To enable choice of different interploation filters */
- if (!pc->use_bilinear_mc_filter)
- {
- xd->subpixel_predict = vp8_sixtap_predict4x4;
- xd->subpixel_predict8x4 = vp8_sixtap_predict8x4;
- xd->subpixel_predict8x8 = vp8_sixtap_predict8x8;
- xd->subpixel_predict16x16 = vp8_sixtap_predict16x16;
- }
- else
- {
- xd->subpixel_predict = vp8_bilinear_predict4x4;
- xd->subpixel_predict8x4 = vp8_bilinear_predict8x4;
- xd->subpixel_predict8x8 = vp8_bilinear_predict8x8;
- xd->subpixel_predict16x16 = vp8_bilinear_predict16x16;
- }
-
- if (pbi->decoded_key_frame && pbi->ec_enabled && !pbi->ec_active)
- pbi->ec_active = 1;
- }
-
- xd->left_context = &pc->left_context;
- xd->mode_info_context = pc->mi;
- xd->frame_type = pc->frame_type;
- xd->mode_info_context->mbmi.mode = DC_PRED;
- xd->mode_info_stride = pc->mode_info_stride;
- xd->corrupted = 0; /* init without corruption */
-
- xd->fullpixel_mask = 0xffffffff;
- if(pc->full_pixel)
- xd->fullpixel_mask = 0xfffffff8;
-
-}
-
-int vp8_decode_frame(VP8D_COMP *pbi)
-{
- vp8_reader *const bc = &pbi->mbc[8];
- VP8_COMMON *const pc = &pbi->common;
- MACROBLOCKD *const xd = &pbi->mb;
- const unsigned char *data = pbi->fragments.ptrs[0];
- const unsigned char *data_end = data + pbi->fragments.sizes[0];
- ptrdiff_t first_partition_length_in_bytes;
-
- int i, j, k, l;
- const int *const mb_feature_data_bits = vp8_mb_feature_data_bits;
- int corrupt_tokens = 0;
- int prev_independent_partitions = pbi->independent_partitions;
-
- YV12_BUFFER_CONFIG *yv12_fb_new = pbi->dec_fb_ref[INTRA_FRAME];
-
- /* start with no corruption of current frame */
- xd->corrupted = 0;
- yv12_fb_new->corrupted = 0;
-
- if (data_end - data < 3)
- {
- if (!pbi->ec_active)
- {
- vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet");
- }
-
- /* Declare the missing frame as an inter frame since it will
- be handled as an inter frame when we have estimated its
- motion vectors. */
- pc->frame_type = INTER_FRAME;
- pc->version = 0;
- pc->show_frame = 1;
- first_partition_length_in_bytes = 0;
- }
- else
- {
- unsigned char clear_buffer[10];
- const unsigned char *clear = data;
- if (pbi->decrypt_cb)
- {
- int n = (int)(data_end - data);
- if (n > 10) n = 10;
- pbi->decrypt_cb(pbi->decrypt_state, data, clear_buffer, n);
- clear = clear_buffer;
- }
-
- pc->frame_type = (FRAME_TYPE)(clear[0] & 1);
- pc->version = (clear[0] >> 1) & 7;
- pc->show_frame = (clear[0] >> 4) & 1;
- first_partition_length_in_bytes =
- (clear[0] | (clear[1] << 8) | (clear[2] << 16)) >> 5;
-
- if (!pbi->ec_active &&
- (data + first_partition_length_in_bytes > data_end
- || data + first_partition_length_in_bytes < data))
- vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt partition 0 length");
-
- data += 3;
- clear += 3;
-
- vp8_setup_version(pc);
-
-
- if (pc->frame_type == KEY_FRAME)
- {
- /* vet via sync code */
- /* When error concealment is enabled we should only check the sync
- * code if we have enough bits available
- */
- if (!pbi->ec_active || data + 3 < data_end)
- {
- if (clear[0] != 0x9d || clear[1] != 0x01 || clear[2] != 0x2a)
- vpx_internal_error(&pc->error, VPX_CODEC_UNSUP_BITSTREAM,
- "Invalid frame sync code");
- }
-
- /* If error concealment is enabled we should only parse the new size
- * if we have enough data. Otherwise we will end up with the wrong
- * size.
- */
- if (!pbi->ec_active || data + 6 < data_end)
- {
- pc->Width = (clear[3] | (clear[4] << 8)) & 0x3fff;
- pc->horiz_scale = clear[4] >> 6;
- pc->Height = (clear[5] | (clear[6] << 8)) & 0x3fff;
- pc->vert_scale = clear[6] >> 6;
- }
- data += 7;
- clear += 7;
- }
- else
- {
- vpx_memcpy(&xd->pre, yv12_fb_new, sizeof(YV12_BUFFER_CONFIG));
- vpx_memcpy(&xd->dst, yv12_fb_new, sizeof(YV12_BUFFER_CONFIG));
- }
- }
- if ((!pbi->decoded_key_frame && pc->frame_type != KEY_FRAME))
- {
- return -1;
- }
-
- init_frame(pbi);
-
- if (vp8dx_start_decode(bc, data, (unsigned int)(data_end - data),
- pbi->decrypt_cb, pbi->decrypt_state))
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate bool decoder 0");
- if (pc->frame_type == KEY_FRAME) {
- (void)vp8_read_bit(bc); // colorspace
- pc->clamp_type = (CLAMP_TYPE)vp8_read_bit(bc);
- }
-
- /* Is segmentation enabled */
- xd->segmentation_enabled = (unsigned char)vp8_read_bit(bc);
-
- if (xd->segmentation_enabled)
- {
- /* Signal whether or not the segmentation map is being explicitly updated this frame. */
- xd->update_mb_segmentation_map = (unsigned char)vp8_read_bit(bc);
- xd->update_mb_segmentation_data = (unsigned char)vp8_read_bit(bc);
-
- if (xd->update_mb_segmentation_data)
- {
- xd->mb_segement_abs_delta = (unsigned char)vp8_read_bit(bc);
-
- vpx_memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
-
- /* For each segmentation feature (Quant and loop filter level) */
- for (i = 0; i < MB_LVL_MAX; i++)
- {
- for (j = 0; j < MAX_MB_SEGMENTS; j++)
- {
- /* Frame level data */
- if (vp8_read_bit(bc))
- {
- xd->segment_feature_data[i][j] = (signed char)vp8_read_literal(bc, mb_feature_data_bits[i]);
-
- if (vp8_read_bit(bc))
- xd->segment_feature_data[i][j] = -xd->segment_feature_data[i][j];
- }
- else
- xd->segment_feature_data[i][j] = 0;
- }
- }
- }
-
- if (xd->update_mb_segmentation_map)
- {
- /* Which macro block level features are enabled */
- vpx_memset(xd->mb_segment_tree_probs, 255, sizeof(xd->mb_segment_tree_probs));
-
- /* Read the probs used to decode the segment id for each macro block. */
- for (i = 0; i < MB_FEATURE_TREE_PROBS; i++)
- {
- /* If not explicitly set value is defaulted to 255 by memset above */
- if (vp8_read_bit(bc))
- xd->mb_segment_tree_probs[i] = (vp8_prob)vp8_read_literal(bc, 8);
- }
- }
- }
- else
- {
- /* No segmentation updates on this frame */
- xd->update_mb_segmentation_map = 0;
- xd->update_mb_segmentation_data = 0;
- }
-
- /* Read the loop filter level and type */
- pc->filter_type = (LOOPFILTERTYPE) vp8_read_bit(bc);
- pc->filter_level = vp8_read_literal(bc, 6);
- pc->sharpness_level = vp8_read_literal(bc, 3);
-
- /* Read in loop filter deltas applied at the MB level based on mode or ref frame. */
- xd->mode_ref_lf_delta_update = 0;
- xd->mode_ref_lf_delta_enabled = (unsigned char)vp8_read_bit(bc);
-
- if (xd->mode_ref_lf_delta_enabled)
- {
- /* Do the deltas need to be updated */
- xd->mode_ref_lf_delta_update = (unsigned char)vp8_read_bit(bc);
-
- if (xd->mode_ref_lf_delta_update)
- {
- /* Send update */
- for (i = 0; i < MAX_REF_LF_DELTAS; i++)
- {
- if (vp8_read_bit(bc))
- {
- /*sign = vp8_read_bit( bc );*/
- xd->ref_lf_deltas[i] = (signed char)vp8_read_literal(bc, 6);
-
- if (vp8_read_bit(bc)) /* Apply sign */
- xd->ref_lf_deltas[i] = xd->ref_lf_deltas[i] * -1;
- }
- }
-
- /* Send update */
- for (i = 0; i < MAX_MODE_LF_DELTAS; i++)
- {
- if (vp8_read_bit(bc))
- {
- /*sign = vp8_read_bit( bc );*/
- xd->mode_lf_deltas[i] = (signed char)vp8_read_literal(bc, 6);
-
- if (vp8_read_bit(bc)) /* Apply sign */
- xd->mode_lf_deltas[i] = xd->mode_lf_deltas[i] * -1;
- }
- }
- }
- }
-
- setup_token_decoder(pbi, data + first_partition_length_in_bytes);
-
- xd->current_bc = &pbi->mbc[0];
-
- /* Read the default quantizers. */
- {
- int Q, q_update;
-
- Q = vp8_read_literal(bc, 7); /* AC 1st order Q = default */
- pc->base_qindex = Q;
- q_update = 0;
- pc->y1dc_delta_q = get_delta_q(bc, pc->y1dc_delta_q, &q_update);
- pc->y2dc_delta_q = get_delta_q(bc, pc->y2dc_delta_q, &q_update);
- pc->y2ac_delta_q = get_delta_q(bc, pc->y2ac_delta_q, &q_update);
- pc->uvdc_delta_q = get_delta_q(bc, pc->uvdc_delta_q, &q_update);
- pc->uvac_delta_q = get_delta_q(bc, pc->uvac_delta_q, &q_update);
-
- if (q_update)
- vp8cx_init_de_quantizer(pbi);
-
- /* MB level dequantizer setup */
- vp8_mb_init_dequantizer(pbi, &pbi->mb);
- }
-
- /* Determine if the golden frame or ARF buffer should be updated and how.
- * For all non key frames the GF and ARF refresh flags and sign bias
- * flags must be set explicitly.
- */
- if (pc->frame_type != KEY_FRAME)
- {
- /* Should the GF or ARF be updated from the current frame */
- pc->refresh_golden_frame = vp8_read_bit(bc);
-#if CONFIG_ERROR_CONCEALMENT
- /* Assume we shouldn't refresh golden if the bit is missing */
- xd->corrupted |= vp8dx_bool_error(bc);
- if (pbi->ec_active && xd->corrupted)
- pc->refresh_golden_frame = 0;
-#endif
-
- pc->refresh_alt_ref_frame = vp8_read_bit(bc);
-#if CONFIG_ERROR_CONCEALMENT
- /* Assume we shouldn't refresh altref if the bit is missing */
- xd->corrupted |= vp8dx_bool_error(bc);
- if (pbi->ec_active && xd->corrupted)
- pc->refresh_alt_ref_frame = 0;
-#endif
-
- /* Buffer to buffer copy flags. */
- pc->copy_buffer_to_gf = 0;
-
- if (!pc->refresh_golden_frame)
- pc->copy_buffer_to_gf = vp8_read_literal(bc, 2);
-
-#if CONFIG_ERROR_CONCEALMENT
- /* Assume we shouldn't copy to the golden if the bit is missing */
- xd->corrupted |= vp8dx_bool_error(bc);
- if (pbi->ec_active && xd->corrupted)
- pc->copy_buffer_to_gf = 0;
-#endif
-
- pc->copy_buffer_to_arf = 0;
-
- if (!pc->refresh_alt_ref_frame)
- pc->copy_buffer_to_arf = vp8_read_literal(bc, 2);
-
-#if CONFIG_ERROR_CONCEALMENT
- /* Assume we shouldn't copy to the alt-ref if the bit is missing */
- xd->corrupted |= vp8dx_bool_error(bc);
- if (pbi->ec_active && xd->corrupted)
- pc->copy_buffer_to_arf = 0;
-#endif
-
-
- pc->ref_frame_sign_bias[GOLDEN_FRAME] = vp8_read_bit(bc);
- pc->ref_frame_sign_bias[ALTREF_FRAME] = vp8_read_bit(bc);
- }
-
- pc->refresh_entropy_probs = vp8_read_bit(bc);
-#if CONFIG_ERROR_CONCEALMENT
- /* Assume we shouldn't refresh the probabilities if the bit is
- * missing */
- xd->corrupted |= vp8dx_bool_error(bc);
- if (pbi->ec_active && xd->corrupted)
- pc->refresh_entropy_probs = 0;
-#endif
- if (pc->refresh_entropy_probs == 0)
- {
- vpx_memcpy(&pc->lfc, &pc->fc, sizeof(pc->fc));
- }
-
- pc->refresh_last_frame = pc->frame_type == KEY_FRAME || vp8_read_bit(bc);
-
-#if CONFIG_ERROR_CONCEALMENT
- /* Assume we should refresh the last frame if the bit is missing */
- xd->corrupted |= vp8dx_bool_error(bc);
- if (pbi->ec_active && xd->corrupted)
- pc->refresh_last_frame = 1;
-#endif
-
- if (0)
- {
- FILE *z = fopen("decodestats.stt", "a");
- fprintf(z, "%6d F:%d,G:%d,A:%d,L:%d,Q:%d\n",
- pc->current_video_frame,
- pc->frame_type,
- pc->refresh_golden_frame,
- pc->refresh_alt_ref_frame,
- pc->refresh_last_frame,
- pc->base_qindex);
- fclose(z);
- }
-
- {
- pbi->independent_partitions = 1;
-
- /* read coef probability tree */
- for (i = 0; i < BLOCK_TYPES; i++)
- for (j = 0; j < COEF_BANDS; j++)
- for (k = 0; k < PREV_COEF_CONTEXTS; k++)
- for (l = 0; l < ENTROPY_NODES; l++)
- {
-
- vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
-
- if (vp8_read(bc, vp8_coef_update_probs [i][j][k][l]))
- {
- *p = (vp8_prob)vp8_read_literal(bc, 8);
-
- }
- if (k > 0 && *p != pc->fc.coef_probs[i][j][k-1][l])
- pbi->independent_partitions = 0;
-
- }
- }
-
- /* clear out the coeff buffer */
- vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
-
- vp8_decode_mode_mvs(pbi);
-
-#if CONFIG_ERROR_CONCEALMENT
- if (pbi->ec_active &&
- pbi->mvs_corrupt_from_mb < (unsigned int)pc->mb_cols * pc->mb_rows)
- {
- /* Motion vectors are missing in this frame. We will try to estimate
- * them and then continue decoding the frame as usual */
- vp8_estimate_missing_mvs(pbi);
- }
-#endif
-
- vpx_memset(pc->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * pc->mb_cols);
- pbi->frame_corrupt_residual = 0;
-
-#if CONFIG_MULTITHREAD
- if (pbi->b_multithreaded_rd && pc->multi_token_partition != ONE_PARTITION)
- {
- unsigned int thread;
- vp8mt_decode_mb_rows(pbi, xd);
- vp8_yv12_extend_frame_borders(yv12_fb_new);
- for (thread = 0; thread < pbi->decoding_thread_count; ++thread)
- corrupt_tokens |= pbi->mb_row_di[thread].mbd.corrupted;
- }
- else
-#endif
- {
- decode_mb_rows(pbi);
- corrupt_tokens |= xd->corrupted;
- }
-
- /* Collect information about decoder corruption. */
- /* 1. Check first boolean decoder for errors. */
- yv12_fb_new->corrupted = vp8dx_bool_error(bc);
- /* 2. Check the macroblock information */
- yv12_fb_new->corrupted |= corrupt_tokens;
-
- if (!pbi->decoded_key_frame)
- {
- if (pc->frame_type == KEY_FRAME &&
- !yv12_fb_new->corrupted)
- pbi->decoded_key_frame = 1;
- else
- vpx_internal_error(&pbi->common.error, VPX_CODEC_CORRUPT_FRAME,
- "A stream must start with a complete key frame");
- }
-
- /* vpx_log("Decoder: Frame Decoded, Size Roughly:%d bytes \n",bc->pos+pbi->bc2.pos); */
-
- if (pc->refresh_entropy_probs == 0)
- {
- vpx_memcpy(&pc->fc, &pc->lfc, sizeof(pc->fc));
- pbi->independent_partitions = prev_independent_partitions;
- }
-
-#ifdef PACKET_TESTING
- {
- FILE *f = fopen("decompressor.VP8", "ab");
- unsigned int size = pbi->bc2.pos + pbi->bc.pos + 8;
- fwrite((void *) &size, 4, 1, f);
- fwrite((void *) pbi->Source, size, 1, f);
- fclose(f);
- }
-#endif
-
- return 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.c b/videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.c
deleted file mode 100644
index 44a60c2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.c
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "treereader.h"
-#include "vp8/common/entropymv.h"
-#include "vp8/common/entropymode.h"
-#include "onyxd_int.h"
-#include "vp8/common/findnearmv.h"
-
-#if CONFIG_DEBUG
-#include <assert.h>
-#endif
-static B_PREDICTION_MODE read_bmode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_bmode_tree, p);
-
- return (B_PREDICTION_MODE)i;
-}
-
-static MB_PREDICTION_MODE read_ymode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_ymode_tree, p);
-
- return (MB_PREDICTION_MODE)i;
-}
-
-static MB_PREDICTION_MODE read_kf_ymode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_kf_ymode_tree, p);
-
- return (MB_PREDICTION_MODE)i;
-}
-
-static MB_PREDICTION_MODE read_uv_mode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_uv_mode_tree, p);
-
- return (MB_PREDICTION_MODE)i;
-}
-
-static void read_kf_modes(VP8D_COMP *pbi, MODE_INFO *mi)
-{
- vp8_reader *const bc = & pbi->mbc[8];
- const int mis = pbi->common.mode_info_stride;
-
- mi->mbmi.ref_frame = INTRA_FRAME;
- mi->mbmi.mode = read_kf_ymode(bc, vp8_kf_ymode_prob);
-
- if (mi->mbmi.mode == B_PRED)
- {
- int i = 0;
- mi->mbmi.is_4x4 = 1;
-
- do
- {
- const B_PREDICTION_MODE A = above_block_mode(mi, i, mis);
- const B_PREDICTION_MODE L = left_block_mode(mi, i);
-
- mi->bmi[i].as_mode =
- read_bmode(bc, vp8_kf_bmode_prob [A] [L]);
- }
- while (++i < 16);
- }
-
- mi->mbmi.uv_mode = read_uv_mode(bc, vp8_kf_uv_mode_prob);
-}
-
-static int read_mvcomponent(vp8_reader *r, const MV_CONTEXT *mvc)
-{
- const vp8_prob *const p = (const vp8_prob *) mvc;
- int x = 0;
-
- if (vp8_read(r, p [mvpis_short])) /* Large */
- {
- int i = 0;
-
- do
- {
- x += vp8_read(r, p [MVPbits + i]) << i;
- }
- while (++i < 3);
-
- i = mvlong_width - 1; /* Skip bit 3, which is sometimes implicit */
-
- do
- {
- x += vp8_read(r, p [MVPbits + i]) << i;
- }
- while (--i > 3);
-
- if (!(x & 0xFFF0) || vp8_read(r, p [MVPbits + 3]))
- x += 8;
- }
- else /* small */
- x = vp8_treed_read(r, vp8_small_mvtree, p + MVPshort);
-
- if (x && vp8_read(r, p [MVPsign]))
- x = -x;
-
- return x;
-}
-
-static void read_mv(vp8_reader *r, MV *mv, const MV_CONTEXT *mvc)
-{
- mv->row = (short)(read_mvcomponent(r, mvc) * 2);
- mv->col = (short)(read_mvcomponent(r, ++mvc) * 2);
-}
-
-
-static void read_mvcontexts(vp8_reader *bc, MV_CONTEXT *mvc)
-{
- int i = 0;
-
- do
- {
- const vp8_prob *up = vp8_mv_update_probs[i].prob;
- vp8_prob *p = (vp8_prob *)(mvc + i);
- vp8_prob *const pstop = p + MVPcount;
-
- do
- {
- if (vp8_read(bc, *up++))
- {
- const vp8_prob x = (vp8_prob)vp8_read_literal(bc, 7);
-
- *p = x ? x << 1 : 1;
- }
- }
- while (++p < pstop);
- }
- while (++i < 2);
-}
-
-static const unsigned char mbsplit_fill_count[4] = {8, 8, 4, 1};
-static const unsigned char mbsplit_fill_offset[4][16] = {
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
- { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15},
- { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15},
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
-};
-
-
-static void mb_mode_mv_init(VP8D_COMP *pbi)
-{
- vp8_reader *const bc = & pbi->mbc[8];
- MV_CONTEXT *const mvc = pbi->common.fc.mvc;
-
-#if CONFIG_ERROR_CONCEALMENT
- /* Default is that no macroblock is corrupt, therefore we initialize
- * mvs_corrupt_from_mb to something very big, which we can be sure is
- * outside the frame. */
- pbi->mvs_corrupt_from_mb = UINT_MAX;
-#endif
- /* Read the mb_no_coeff_skip flag */
- pbi->common.mb_no_coeff_skip = (int)vp8_read_bit(bc);
-
- pbi->prob_skip_false = 0;
- if (pbi->common.mb_no_coeff_skip)
- pbi->prob_skip_false = (vp8_prob)vp8_read_literal(bc, 8);
-
- if(pbi->common.frame_type != KEY_FRAME)
- {
- pbi->prob_intra = (vp8_prob)vp8_read_literal(bc, 8);
- pbi->prob_last = (vp8_prob)vp8_read_literal(bc, 8);
- pbi->prob_gf = (vp8_prob)vp8_read_literal(bc, 8);
-
- if (vp8_read_bit(bc))
- {
- int i = 0;
-
- do
- {
- pbi->common.fc.ymode_prob[i] =
- (vp8_prob) vp8_read_literal(bc, 8);
- }
- while (++i < 4);
- }
-
- if (vp8_read_bit(bc))
- {
- int i = 0;
-
- do
- {
- pbi->common.fc.uv_mode_prob[i] =
- (vp8_prob) vp8_read_literal(bc, 8);
- }
- while (++i < 3);
- }
-
- read_mvcontexts(bc, mvc);
- }
-}
-
-const vp8_prob vp8_sub_mv_ref_prob3 [8][VP8_SUBMVREFS-1] =
-{
- { 147, 136, 18 }, /* SUBMVREF_NORMAL */
- { 223, 1 , 34 }, /* SUBMVREF_LEFT_ABOVE_SAME */
- { 106, 145, 1 }, /* SUBMVREF_LEFT_ZED */
- { 208, 1 , 1 }, /* SUBMVREF_LEFT_ABOVE_ZED */
- { 179, 121, 1 }, /* SUBMVREF_ABOVE_ZED */
- { 223, 1 , 34 }, /* SUBMVREF_LEFT_ABOVE_SAME */
- { 179, 121, 1 }, /* SUBMVREF_ABOVE_ZED */
- { 208, 1 , 1 } /* SUBMVREF_LEFT_ABOVE_ZED */
-};
-
-static
-const vp8_prob * get_sub_mv_ref_prob(const int left, const int above)
-{
- int lez = (left == 0);
- int aez = (above == 0);
- int lea = (left == above);
- const vp8_prob * prob;
-
- prob = vp8_sub_mv_ref_prob3[(aez << 2) |
- (lez << 1) |
- (lea)];
-
- return prob;
-}
-
-static void decode_split_mv(vp8_reader *const bc, MODE_INFO *mi,
- const MODE_INFO *left_mb, const MODE_INFO *above_mb,
- MB_MODE_INFO *mbmi, int_mv best_mv,
- MV_CONTEXT *const mvc, int mb_to_left_edge,
- int mb_to_right_edge, int mb_to_top_edge,
- int mb_to_bottom_edge)
-{
- int s; /* split configuration (16x8, 8x16, 8x8, 4x4) */
- int num_p; /* number of partitions in the split configuration
- (see vp8_mbsplit_count) */
- int j = 0;
-
- s = 3;
- num_p = 16;
- if( vp8_read(bc, 110) )
- {
- s = 2;
- num_p = 4;
- if( vp8_read(bc, 111) )
- {
- s = vp8_read(bc, 150);
- num_p = 2;
- }
- }
-
- do /* for each subset j */
- {
- int_mv leftmv, abovemv;
- int_mv blockmv;
- int k; /* first block in subset j */
-
- const vp8_prob *prob;
- k = vp8_mbsplit_offset[s][j];
-
- if (!(k & 3))
- {
- /* On L edge, get from MB to left of us */
- if(left_mb->mbmi.mode != SPLITMV)
- leftmv.as_int = left_mb->mbmi.mv.as_int;
- else
- leftmv.as_int = (left_mb->bmi + k + 4 - 1)->mv.as_int;
- }
- else
- leftmv.as_int = (mi->bmi + k - 1)->mv.as_int;
-
- if (!(k >> 2))
- {
- /* On top edge, get from MB above us */
- if(above_mb->mbmi.mode != SPLITMV)
- abovemv.as_int = above_mb->mbmi.mv.as_int;
- else
- abovemv.as_int = (above_mb->bmi + k + 16 - 4)->mv.as_int;
- }
- else
- abovemv.as_int = (mi->bmi + k - 4)->mv.as_int;
-
- prob = get_sub_mv_ref_prob(leftmv.as_int, abovemv.as_int);
-
- if( vp8_read(bc, prob[0]) )
- {
- if( vp8_read(bc, prob[1]) )
- {
- blockmv.as_int = 0;
- if( vp8_read(bc, prob[2]) )
- {
- blockmv.as_mv.row = read_mvcomponent(bc, &mvc[0]) * 2;
- blockmv.as_mv.row += best_mv.as_mv.row;
- blockmv.as_mv.col = read_mvcomponent(bc, &mvc[1]) * 2;
- blockmv.as_mv.col += best_mv.as_mv.col;
- }
- }
- else
- {
- blockmv.as_int = abovemv.as_int;
- }
- }
- else
- {
- blockmv.as_int = leftmv.as_int;
- }
-
- mbmi->need_to_clamp_mvs |= vp8_check_mv_bounds(&blockmv,
- mb_to_left_edge,
- mb_to_right_edge,
- mb_to_top_edge,
- mb_to_bottom_edge);
-
- {
- /* Fill (uniform) modes, mvs of jth subset.
- Must do it here because ensuing subsets can
- refer back to us via "left" or "above". */
- const unsigned char *fill_offset;
- unsigned int fill_count = mbsplit_fill_count[s];
-
- fill_offset = &mbsplit_fill_offset[s]
- [(unsigned char)j * mbsplit_fill_count[s]];
-
- do {
- mi->bmi[ *fill_offset].mv.as_int = blockmv.as_int;
- fill_offset++;
- }while (--fill_count);
- }
-
- }
- while (++j < num_p);
-
- mbmi->partitioning = s;
-}
-
-static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi)
-{
- vp8_reader *const bc = & pbi->mbc[8];
- mbmi->ref_frame = (MV_REFERENCE_FRAME) vp8_read(bc, pbi->prob_intra);
- if (mbmi->ref_frame) /* inter MB */
- {
- enum {CNT_INTRA, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV};
- int cnt[4];
- int *cntx = cnt;
- int_mv near_mvs[4];
- int_mv *nmv = near_mvs;
- const int mis = pbi->mb.mode_info_stride;
- const MODE_INFO *above = mi - mis;
- const MODE_INFO *left = mi - 1;
- const MODE_INFO *aboveleft = above - 1;
- int *ref_frame_sign_bias = pbi->common.ref_frame_sign_bias;
-
- mbmi->need_to_clamp_mvs = 0;
-
- if (vp8_read(bc, pbi->prob_last))
- {
- mbmi->ref_frame =
- (MV_REFERENCE_FRAME)((int)(2 + vp8_read(bc, pbi->prob_gf)));
- }
-
- /* Zero accumulators */
- nmv[0].as_int = nmv[1].as_int = nmv[2].as_int = 0;
- cnt[0] = cnt[1] = cnt[2] = cnt[3] = 0;
-
- /* Process above */
- if (above->mbmi.ref_frame != INTRA_FRAME)
- {
- if (above->mbmi.mv.as_int)
- {
- (++nmv)->as_int = above->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame],
- mbmi->ref_frame, nmv, ref_frame_sign_bias);
- ++cntx;
- }
-
- *cntx += 2;
- }
-
- /* Process left */
- if (left->mbmi.ref_frame != INTRA_FRAME)
- {
- if (left->mbmi.mv.as_int)
- {
- int_mv this_mv;
-
- this_mv.as_int = left->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame],
- mbmi->ref_frame, &this_mv, ref_frame_sign_bias);
-
- if (this_mv.as_int != nmv->as_int)
- {
- (++nmv)->as_int = this_mv.as_int;
- ++cntx;
- }
-
- *cntx += 2;
- }
- else
- cnt[CNT_INTRA] += 2;
- }
-
- /* Process above left */
- if (aboveleft->mbmi.ref_frame != INTRA_FRAME)
- {
- if (aboveleft->mbmi.mv.as_int)
- {
- int_mv this_mv;
-
- this_mv.as_int = aboveleft->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[aboveleft->mbmi.ref_frame],
- mbmi->ref_frame, &this_mv, ref_frame_sign_bias);
-
- if (this_mv.as_int != nmv->as_int)
- {
- (++nmv)->as_int = this_mv.as_int;
- ++cntx;
- }
-
- *cntx += 1;
- }
- else
- cnt[CNT_INTRA] += 1;
- }
-
- if( vp8_read(bc, vp8_mode_contexts [cnt[CNT_INTRA]] [0]) )
- {
-
- /* If we have three distinct MV's ... */
- /* See if above-left MV can be merged with NEAREST */
- cnt[CNT_NEAREST] += ( (cnt[CNT_SPLITMV] > 0) &
- (nmv->as_int == near_mvs[CNT_NEAREST].as_int));
-
- /* Swap near and nearest if necessary */
- if (cnt[CNT_NEAR] > cnt[CNT_NEAREST])
- {
- int tmp;
- tmp = cnt[CNT_NEAREST];
- cnt[CNT_NEAREST] = cnt[CNT_NEAR];
- cnt[CNT_NEAR] = tmp;
- tmp = near_mvs[CNT_NEAREST].as_int;
- near_mvs[CNT_NEAREST].as_int = near_mvs[CNT_NEAR].as_int;
- near_mvs[CNT_NEAR].as_int = tmp;
- }
-
- if( vp8_read(bc, vp8_mode_contexts [cnt[CNT_NEAREST]] [1]) )
- {
-
- if( vp8_read(bc, vp8_mode_contexts [cnt[CNT_NEAR]] [2]) )
- {
- int mb_to_top_edge;
- int mb_to_bottom_edge;
- int mb_to_left_edge;
- int mb_to_right_edge;
- MV_CONTEXT *const mvc = pbi->common.fc.mvc;
- int near_index;
-
- mb_to_top_edge = pbi->mb.mb_to_top_edge;
- mb_to_bottom_edge = pbi->mb.mb_to_bottom_edge;
- mb_to_top_edge -= LEFT_TOP_MARGIN;
- mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
- mb_to_right_edge = pbi->mb.mb_to_right_edge;
- mb_to_right_edge += RIGHT_BOTTOM_MARGIN;
- mb_to_left_edge = pbi->mb.mb_to_left_edge;
- mb_to_left_edge -= LEFT_TOP_MARGIN;
-
- /* Use near_mvs[0] to store the "best" MV */
- near_index = CNT_INTRA +
- (cnt[CNT_NEAREST] >= cnt[CNT_INTRA]);
-
- vp8_clamp_mv2(&near_mvs[near_index], &pbi->mb);
-
- cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV)
- + (left->mbmi.mode == SPLITMV)) * 2
- + (aboveleft->mbmi.mode == SPLITMV);
-
- if( vp8_read(bc, vp8_mode_contexts [cnt[CNT_SPLITMV]] [3]) )
- {
- decode_split_mv(bc, mi, left, above,
- mbmi,
- near_mvs[near_index],
- mvc, mb_to_left_edge,
- mb_to_right_edge,
- mb_to_top_edge,
- mb_to_bottom_edge);
- mbmi->mv.as_int = mi->bmi[15].mv.as_int;
- mbmi->mode = SPLITMV;
- mbmi->is_4x4 = 1;
- }
- else
- {
- int_mv *const mbmi_mv = & mbmi->mv;
- read_mv(bc, &mbmi_mv->as_mv, (const MV_CONTEXT *) mvc);
- mbmi_mv->as_mv.row += near_mvs[near_index].as_mv.row;
- mbmi_mv->as_mv.col += near_mvs[near_index].as_mv.col;
-
- /* Don't need to check this on NEARMV and NEARESTMV
- * modes since those modes clamp the MV. The NEWMV mode
- * does not, so signal to the prediction stage whether
- * special handling may be required.
- */
- mbmi->need_to_clamp_mvs =
- vp8_check_mv_bounds(mbmi_mv, mb_to_left_edge,
- mb_to_right_edge,
- mb_to_top_edge,
- mb_to_bottom_edge);
- mbmi->mode = NEWMV;
- }
- }
- else
- {
- mbmi->mode = NEARMV;
- mbmi->mv.as_int = near_mvs[CNT_NEAR].as_int;
- vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
- }
- }
- else
- {
- mbmi->mode = NEARESTMV;
- mbmi->mv.as_int = near_mvs[CNT_NEAREST].as_int;
- vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
- }
- }
- else
- {
- mbmi->mode = ZEROMV;
- mbmi->mv.as_int = 0;
- }
-
-#if CONFIG_ERROR_CONCEALMENT
- if(pbi->ec_enabled && (mbmi->mode != SPLITMV))
- {
- mi->bmi[ 0].mv.as_int =
- mi->bmi[ 1].mv.as_int =
- mi->bmi[ 2].mv.as_int =
- mi->bmi[ 3].mv.as_int =
- mi->bmi[ 4].mv.as_int =
- mi->bmi[ 5].mv.as_int =
- mi->bmi[ 6].mv.as_int =
- mi->bmi[ 7].mv.as_int =
- mi->bmi[ 8].mv.as_int =
- mi->bmi[ 9].mv.as_int =
- mi->bmi[10].mv.as_int =
- mi->bmi[11].mv.as_int =
- mi->bmi[12].mv.as_int =
- mi->bmi[13].mv.as_int =
- mi->bmi[14].mv.as_int =
- mi->bmi[15].mv.as_int = mbmi->mv.as_int;
- }
-#endif
- }
- else
- {
- /* required for left and above block mv */
- mbmi->mv.as_int = 0;
-
- /* MB is intra coded */
- if ((mbmi->mode = read_ymode(bc, pbi->common.fc.ymode_prob)) == B_PRED)
- {
- int j = 0;
- mbmi->is_4x4 = 1;
- do
- {
- mi->bmi[j].as_mode = read_bmode(bc, pbi->common.fc.bmode_prob);
- }
- while (++j < 16);
- }
-
- mbmi->uv_mode = read_uv_mode(bc, pbi->common.fc.uv_mode_prob);
- }
-
-}
-
-static void read_mb_features(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x)
-{
- /* Is segmentation enabled */
- if (x->segmentation_enabled && x->update_mb_segmentation_map)
- {
- /* If so then read the segment id. */
- if (vp8_read(r, x->mb_segment_tree_probs[0]))
- mi->segment_id =
- (unsigned char)(2 + vp8_read(r, x->mb_segment_tree_probs[2]));
- else
- mi->segment_id =
- (unsigned char)(vp8_read(r, x->mb_segment_tree_probs[1]));
- }
-}
-
-static void decode_mb_mode_mvs(VP8D_COMP *pbi, MODE_INFO *mi)
-{
- /* Read the Macroblock segmentation map if it is being updated explicitly
- * this frame (reset to 0 above by default)
- * By default on a key frame reset all MBs to segment 0
- */
- if (pbi->mb.update_mb_segmentation_map)
- read_mb_features(&pbi->mbc[8], &mi->mbmi, &pbi->mb);
- else if(pbi->common.frame_type == KEY_FRAME)
- mi->mbmi.segment_id = 0;
-
- /* Read the macroblock coeff skip flag if this feature is in use,
- * else default to 0 */
- if (pbi->common.mb_no_coeff_skip)
- mi->mbmi.mb_skip_coeff = vp8_read(&pbi->mbc[8], pbi->prob_skip_false);
- else
- mi->mbmi.mb_skip_coeff = 0;
-
- mi->mbmi.is_4x4 = 0;
- if(pbi->common.frame_type == KEY_FRAME)
- read_kf_modes(pbi, mi);
- else
- read_mb_modes_mv(pbi, mi, &mi->mbmi);
-
-}
-
-void vp8_decode_mode_mvs(VP8D_COMP *pbi)
-{
- MODE_INFO *mi = pbi->common.mi;
- int mb_row = -1;
- int mb_to_right_edge_start;
-
- mb_mode_mv_init(pbi);
-
- pbi->mb.mb_to_top_edge = 0;
- pbi->mb.mb_to_bottom_edge = ((pbi->common.mb_rows - 1) * 16) << 3;
- mb_to_right_edge_start = ((pbi->common.mb_cols - 1) * 16) << 3;
-
- while (++mb_row < pbi->common.mb_rows)
- {
- int mb_col = -1;
-
- pbi->mb.mb_to_left_edge = 0;
- pbi->mb.mb_to_right_edge = mb_to_right_edge_start;
-
- while (++mb_col < pbi->common.mb_cols)
- {
-#if CONFIG_ERROR_CONCEALMENT
- int mb_num = mb_row * pbi->common.mb_cols + mb_col;
-#endif
-
- decode_mb_mode_mvs(pbi, mi);
-
-#if CONFIG_ERROR_CONCEALMENT
- /* look for corruption. set mvs_corrupt_from_mb to the current
- * mb_num if the frame is corrupt from this macroblock. */
- if (vp8dx_bool_error(&pbi->mbc[8]) && mb_num <
- (int)pbi->mvs_corrupt_from_mb)
- {
- pbi->mvs_corrupt_from_mb = mb_num;
- /* no need to continue since the partition is corrupt from
- * here on.
- */
- return;
- }
-#endif
-
- pbi->mb.mb_to_left_edge -= (16 << 3);
- pbi->mb.mb_to_right_edge -= (16 << 3);
- mi++; /* next macroblock */
- }
- pbi->mb.mb_to_top_edge -= (16 << 3);
- pbi->mb.mb_to_bottom_edge -= (16 << 3);
-
- mi++; /* skip left predictor each row */
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.h
deleted file mode 100644
index f33b073..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/decodemv.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_DECODER_DECODEMV_H_
-#define VP8_DECODER_DECODEMV_H_
-
-#include "onyxd_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_decode_mode_mvs(VP8D_COMP *);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_DECODEMV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/decoderthreading.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/decoderthreading.h
deleted file mode 100644
index c563cf6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/decoderthreading.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_DECODER_DECODERTHREADING_H_
-#define VP8_DECODER_DECODERTHREADING_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if CONFIG_MULTITHREAD
-void vp8mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd);
-void vp8_decoder_remove_threads(VP8D_COMP *pbi);
-void vp8_decoder_create_threads(VP8D_COMP *pbi);
-void vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows);
-void vp8mt_de_alloc_temp_buffers(VP8D_COMP *pbi, int mb_rows);
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_DECODERTHREADING_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.c b/videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.c
deleted file mode 100644
index 452ff6c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/common/blockd.h"
-#include "onyxd_int.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/mem.h"
-#include "detokenize.h"
-
-void vp8_reset_mb_tokens_context(MACROBLOCKD *x)
-{
- ENTROPY_CONTEXT *a_ctx = ((ENTROPY_CONTEXT *)x->above_context);
- ENTROPY_CONTEXT *l_ctx = ((ENTROPY_CONTEXT *)x->left_context);
-
- vpx_memset(a_ctx, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1);
- vpx_memset(l_ctx, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1);
-
- /* Clear entropy contexts for Y2 blocks */
- if (!x->mode_info_context->mbmi.is_4x4)
- {
- a_ctx[8] = l_ctx[8] = 0;
- }
-}
-
-/*
- ------------------------------------------------------------------------------
- Residual decoding (Paragraph 13.2 / 13.3)
-*/
-static const uint8_t kBands[16 + 1] = {
- 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7,
- 0 /* extra entry as sentinel */
-};
-
-static const uint8_t kCat3[] = { 173, 148, 140, 0 };
-static const uint8_t kCat4[] = { 176, 155, 140, 135, 0 };
-static const uint8_t kCat5[] = { 180, 157, 141, 134, 130, 0 };
-static const uint8_t kCat6[] =
- { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 };
-static const uint8_t* const kCat3456[] = { kCat3, kCat4, kCat5, kCat6 };
-static const uint8_t kZigzag[16] = {
- 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
-};
-
-#define VP8GetBit vp8dx_decode_bool
-#define NUM_PROBAS 11
-#define NUM_CTX 3
-
-/* for const-casting */
-typedef const uint8_t (*ProbaArray)[NUM_CTX][NUM_PROBAS];
-
-static int GetSigned(BOOL_DECODER *br, int value_to_sign)
-{
- int split = (br->range + 1) >> 1;
- VP8_BD_VALUE bigsplit = (VP8_BD_VALUE)split << (VP8_BD_VALUE_SIZE - 8);
- int v;
-
- if(br->count < 0)
- vp8dx_bool_decoder_fill(br);
-
- if ( br->value < bigsplit )
- {
- br->range = split;
- v= value_to_sign;
- }
- else
- {
- br->range = br->range-split;
- br->value = br->value-bigsplit;
- v = -value_to_sign;
- }
- br->range +=br->range;
- br->value +=br->value;
- br->count--;
-
- return v;
-}
-/*
- Returns the position of the last non-zero coeff plus one
- (and 0 if there's no coeff at all)
-*/
-static int GetCoeffs(BOOL_DECODER *br, ProbaArray prob,
- int ctx, int n, int16_t* out)
-{
- const uint8_t* p = prob[n][ctx];
- if (!VP8GetBit(br, p[0]))
- { /* first EOB is more a 'CBP' bit. */
- return 0;
- }
- while (1)
- {
- ++n;
- if (!VP8GetBit(br, p[1]))
- {
- p = prob[kBands[n]][0];
- }
- else
- { /* non zero coeff */
- int v, j;
- if (!VP8GetBit(br, p[2]))
- {
- p = prob[kBands[n]][1];
- v = 1;
- }
- else
- {
- if (!VP8GetBit(br, p[3]))
- {
- if (!VP8GetBit(br, p[4]))
- {
- v = 2;
- }
- else
- {
- v = 3 + VP8GetBit(br, p[5]);
- }
- }
- else
- {
- if (!VP8GetBit(br, p[6]))
- {
- if (!VP8GetBit(br, p[7]))
- {
- v = 5 + VP8GetBit(br, 159);
- } else
- {
- v = 7 + 2 * VP8GetBit(br, 165);
- v += VP8GetBit(br, 145);
- }
- }
- else
- {
- const uint8_t* tab;
- const int bit1 = VP8GetBit(br, p[8]);
- const int bit0 = VP8GetBit(br, p[9 + bit1]);
- const int cat = 2 * bit1 + bit0;
- v = 0;
- for (tab = kCat3456[cat]; *tab; ++tab)
- {
- v += v + VP8GetBit(br, *tab);
- }
- v += 3 + (8 << cat);
- }
- }
- p = prob[kBands[n]][2];
- }
- j = kZigzag[n - 1];
-
- out[j] = GetSigned(br, v);
-
- if (n == 16 || !VP8GetBit(br, p[0]))
- { /* EOB */
- return n;
- }
- }
- if (n == 16)
- {
- return 16;
- }
- }
-}
-
-int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *x)
-{
- BOOL_DECODER *bc = x->current_bc;
- const FRAME_CONTEXT * const fc = &dx->common.fc;
- char *eobs = x->eobs;
-
- int i;
- int nonzeros;
- int eobtotal = 0;
-
- short *qcoeff_ptr;
- ProbaArray coef_probs;
- ENTROPY_CONTEXT *a_ctx = ((ENTROPY_CONTEXT *)x->above_context);
- ENTROPY_CONTEXT *l_ctx = ((ENTROPY_CONTEXT *)x->left_context);
- ENTROPY_CONTEXT *a;
- ENTROPY_CONTEXT *l;
- int skip_dc = 0;
-
- qcoeff_ptr = &x->qcoeff[0];
-
- if (!x->mode_info_context->mbmi.is_4x4)
- {
- a = a_ctx + 8;
- l = l_ctx + 8;
-
- coef_probs = fc->coef_probs [1];
-
- nonzeros = GetCoeffs(bc, coef_probs, (*a + *l), 0, qcoeff_ptr + 24 * 16);
- *a = *l = (nonzeros > 0);
-
- eobs[24] = nonzeros;
- eobtotal += nonzeros - 16;
-
- coef_probs = fc->coef_probs [0];
- skip_dc = 1;
- }
- else
- {
- coef_probs = fc->coef_probs [3];
- skip_dc = 0;
- }
-
- for (i = 0; i < 16; ++i)
- {
- a = a_ctx + (i&3);
- l = l_ctx + ((i&0xc)>>2);
-
- nonzeros = GetCoeffs(bc, coef_probs, (*a + *l), skip_dc, qcoeff_ptr);
- *a = *l = (nonzeros > 0);
-
- nonzeros += skip_dc;
- eobs[i] = nonzeros;
- eobtotal += nonzeros;
- qcoeff_ptr += 16;
- }
-
- coef_probs = fc->coef_probs [2];
-
- a_ctx += 4;
- l_ctx += 4;
- for (i = 16; i < 24; ++i)
- {
- a = a_ctx + ((i > 19)<<1) + (i&1);
- l = l_ctx + ((i > 19)<<1) + ((i&3)>1);
-
- nonzeros = GetCoeffs(bc, coef_probs, (*a + *l), 0, qcoeff_ptr);
- *a = *l = (nonzeros > 0);
-
- eobs[i] = nonzeros;
- eobtotal += nonzeros;
- qcoeff_ptr += 16;
- }
-
- return eobtotal;
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.h
deleted file mode 100644
index f0b1254..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/detokenize.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_DECODER_DETOKENIZE_H_
-#define VP8_DECODER_DETOKENIZE_H_
-
-#include "onyxd_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_reset_mb_tokens_context(MACROBLOCKD *x);
-int vp8_decode_mb_tokens(VP8D_COMP *, MACROBLOCKD *);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_DETOKENIZE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/ec_types.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/ec_types.h
deleted file mode 100644
index 3af5ca8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/ec_types.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_DECODER_EC_TYPES_H_
-#define VP8_DECODER_EC_TYPES_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_OVERLAPS 16
-
-
-/* The area (pixel area in Q6) the block pointed to by bmi overlaps
- * another block with.
- */
-typedef struct
-{
- int overlap;
- union b_mode_info *bmi;
-} OVERLAP_NODE;
-
-/* Structure to keep track of overlapping blocks on a block level. */
-typedef struct
-{
- /* TODO(holmer): This array should be exchanged for a linked list */
- OVERLAP_NODE overlaps[MAX_OVERLAPS];
-} B_OVERLAP;
-
-/* Structure used to hold all the overlaps of a macroblock. The overlaps of a
- * macroblock is further divided into block overlaps.
- */
-typedef struct
-{
- B_OVERLAP overlaps[16];
-} MB_OVERLAP;
-
-/* Structure for keeping track of motion vectors and which reference frame they
- * refer to. Used for motion vector interpolation.
- */
-typedef struct
-{
- MV mv;
- MV_REFERENCE_FRAME ref_frame;
-} EC_BLOCK;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_EC_TYPES_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.c b/videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.c
deleted file mode 100644
index 0b58c98..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "error_concealment.h"
-#include "onyxd_int.h"
-#include "decodemv.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/findnearmv.h"
-
-#define MIN(x,y) (((x)<(y))?(x):(y))
-#define MAX(x,y) (((x)>(y))?(x):(y))
-
-#define FLOOR(x,q) ((x) & -(1 << (q)))
-
-#define NUM_NEIGHBORS 20
-
-typedef struct ec_position
-{
- int row;
- int col;
-} EC_POS;
-
-/*
- * Regenerate the table in Matlab with:
- * x = meshgrid((1:4), (1:4));
- * y = meshgrid((1:4), (1:4))';
- * W = round((1./(sqrt(x.^2 + y.^2))*2^7));
- * W(1,1) = 0;
- */
-static const int weights_q7[5][5] = {
- { 0, 128, 64, 43, 32 },
- {128, 91, 57, 40, 31 },
- { 64, 57, 45, 36, 29 },
- { 43, 40, 36, 30, 26 },
- { 32, 31, 29, 26, 23 }
-};
-
-int vp8_alloc_overlap_lists(VP8D_COMP *pbi)
-{
- if (pbi->overlaps != NULL)
- {
- vpx_free(pbi->overlaps);
- pbi->overlaps = NULL;
- }
-
- pbi->overlaps = vpx_calloc(pbi->common.mb_rows * pbi->common.mb_cols,
- sizeof(MB_OVERLAP));
-
- if (pbi->overlaps == NULL)
- return -1;
-
- return 0;
-}
-
-void vp8_de_alloc_overlap_lists(VP8D_COMP *pbi)
-{
- vpx_free(pbi->overlaps);
- pbi->overlaps = NULL;
-}
-
-/* Inserts a new overlap area value to the list of overlaps of a block */
-static void assign_overlap(OVERLAP_NODE* overlaps,
- union b_mode_info *bmi,
- int overlap)
-{
- int i;
- if (overlap <= 0)
- return;
- /* Find and assign to the next empty overlap node in the list of overlaps.
- * Empty is defined as bmi == NULL */
- for (i = 0; i < MAX_OVERLAPS; i++)
- {
- if (overlaps[i].bmi == NULL)
- {
- overlaps[i].bmi = bmi;
- overlaps[i].overlap = overlap;
- break;
- }
- }
-}
-
-/* Calculates the overlap area between two 4x4 squares, where the first
- * square has its upper-left corner at (b1_row, b1_col) and the second
- * square has its upper-left corner at (b2_row, b2_col). Doesn't
- * properly handle squares which do not overlap.
- */
-static int block_overlap(int b1_row, int b1_col, int b2_row, int b2_col)
-{
- const int int_top = MAX(b1_row, b2_row); // top
- const int int_left = MAX(b1_col, b2_col); // left
- /* Since each block is 4x4 pixels, adding 4 (Q3) to the left/top edge
- * gives us the right/bottom edge.
- */
- const int int_right = MIN(b1_col + (4<<3), b2_col + (4<<3)); // right
- const int int_bottom = MIN(b1_row + (4<<3), b2_row + (4<<3)); // bottom
- return (int_bottom - int_top) * (int_right - int_left);
-}
-
-/* Calculates the overlap area for all blocks in a macroblock at position
- * (mb_row, mb_col) in macroblocks, which are being overlapped by a given
- * overlapping block at position (new_row, new_col) (in pixels, Q3). The
- * first block being overlapped in the macroblock has position (first_blk_row,
- * first_blk_col) in blocks relative the upper-left corner of the image.
- */
-static void calculate_overlaps_mb(B_OVERLAP *b_overlaps, union b_mode_info *bmi,
- int new_row, int new_col,
- int mb_row, int mb_col,
- int first_blk_row, int first_blk_col)
-{
- /* Find the blocks within this MB (defined by mb_row, mb_col) which are
- * overlapped by bmi and calculate and assign overlap for each of those
- * blocks. */
-
- /* Block coordinates relative the upper-left block */
- const int rel_ol_blk_row = first_blk_row - mb_row * 4;
- const int rel_ol_blk_col = first_blk_col - mb_col * 4;
- /* If the block partly overlaps any previous MB, these coordinates
- * can be < 0. We don't want to access blocks in previous MBs.
- */
- const int blk_idx = MAX(rel_ol_blk_row,0) * 4 + MAX(rel_ol_blk_col,0);
- /* Upper left overlapping block */
- B_OVERLAP *b_ol_ul = &(b_overlaps[blk_idx]);
-
- /* Calculate and assign overlaps for all blocks in this MB
- * which the motion compensated block overlaps
- */
- /* Avoid calculating overlaps for blocks in later MBs */
- int end_row = MIN(4 + mb_row * 4 - first_blk_row, 2);
- int end_col = MIN(4 + mb_col * 4 - first_blk_col, 2);
- int row, col;
-
- /* Check if new_row and new_col are evenly divisible by 4 (Q3),
- * and if so we shouldn't check neighboring blocks
- */
- if (new_row >= 0 && (new_row & 0x1F) == 0)
- end_row = 1;
- if (new_col >= 0 && (new_col & 0x1F) == 0)
- end_col = 1;
-
- /* Check if the overlapping block partly overlaps a previous MB
- * and if so, we're overlapping fewer blocks in this MB.
- */
- if (new_row < (mb_row*16)<<3)
- end_row = 1;
- if (new_col < (mb_col*16)<<3)
- end_col = 1;
-
- for (row = 0; row < end_row; ++row)
- {
- for (col = 0; col < end_col; ++col)
- {
- /* input in Q3, result in Q6 */
- const int overlap = block_overlap(new_row, new_col,
- (((first_blk_row + row) *
- 4) << 3),
- (((first_blk_col + col) *
- 4) << 3));
- assign_overlap(b_ol_ul[row * 4 + col].overlaps, bmi, overlap);
- }
- }
-}
-
-void vp8_calculate_overlaps(MB_OVERLAP *overlap_ul,
- int mb_rows, int mb_cols,
- union b_mode_info *bmi,
- int b_row, int b_col)
-{
- MB_OVERLAP *mb_overlap;
- int row, col, rel_row, rel_col;
- int new_row, new_col;
- int end_row, end_col;
- int overlap_b_row, overlap_b_col;
- int overlap_mb_row, overlap_mb_col;
-
- /* mb subpixel position */
- row = (4 * b_row) << 3; /* Q3 */
- col = (4 * b_col) << 3; /* Q3 */
-
- /* reverse compensate for motion */
- new_row = row - bmi->mv.as_mv.row;
- new_col = col - bmi->mv.as_mv.col;
-
- if (new_row >= ((16*mb_rows) << 3) || new_col >= ((16*mb_cols) << 3))
- {
- /* the new block ended up outside the frame */
- return;
- }
-
- if (new_row <= (-4 << 3) || new_col <= (-4 << 3))
- {
- /* outside the frame */
- return;
- }
- /* overlapping block's position in blocks */
- overlap_b_row = FLOOR(new_row / 4, 3) >> 3;
- overlap_b_col = FLOOR(new_col / 4, 3) >> 3;
-
- /* overlapping block's MB position in MBs
- * operations are done in Q3
- */
- overlap_mb_row = FLOOR((overlap_b_row << 3) / 4, 3) >> 3;
- overlap_mb_col = FLOOR((overlap_b_col << 3) / 4, 3) >> 3;
-
- end_row = MIN(mb_rows - overlap_mb_row, 2);
- end_col = MIN(mb_cols - overlap_mb_col, 2);
-
- /* Don't calculate overlap for MBs we don't overlap */
- /* Check if the new block row starts at the last block row of the MB */
- if (abs(new_row - ((16*overlap_mb_row) << 3)) < ((3*4) << 3))
- end_row = 1;
- /* Check if the new block col starts at the last block col of the MB */
- if (abs(new_col - ((16*overlap_mb_col) << 3)) < ((3*4) << 3))
- end_col = 1;
-
- /* find the MB(s) this block is overlapping */
- for (rel_row = 0; rel_row < end_row; ++rel_row)
- {
- for (rel_col = 0; rel_col < end_col; ++rel_col)
- {
- if (overlap_mb_row + rel_row < 0 ||
- overlap_mb_col + rel_col < 0)
- continue;
- mb_overlap = overlap_ul + (overlap_mb_row + rel_row) * mb_cols +
- overlap_mb_col + rel_col;
-
- calculate_overlaps_mb(mb_overlap->overlaps, bmi,
- new_row, new_col,
- overlap_mb_row + rel_row,
- overlap_mb_col + rel_col,
- overlap_b_row + rel_row,
- overlap_b_col + rel_col);
- }
- }
-}
-
-/* Estimates a motion vector given the overlapping blocks' motion vectors.
- * Filters out all overlapping blocks which do not refer to the correct
- * reference frame type.
- */
-static void estimate_mv(const OVERLAP_NODE *overlaps, union b_mode_info *bmi)
-{
- int i;
- int overlap_sum = 0;
- int row_acc = 0;
- int col_acc = 0;
-
- bmi->mv.as_int = 0;
- for (i=0; i < MAX_OVERLAPS; ++i)
- {
- if (overlaps[i].bmi == NULL)
- break;
- col_acc += overlaps[i].overlap * overlaps[i].bmi->mv.as_mv.col;
- row_acc += overlaps[i].overlap * overlaps[i].bmi->mv.as_mv.row;
- overlap_sum += overlaps[i].overlap;
- }
- if (overlap_sum > 0)
- {
- /* Q9 / Q6 = Q3 */
- bmi->mv.as_mv.col = col_acc / overlap_sum;
- bmi->mv.as_mv.row = row_acc / overlap_sum;
- }
- else
- {
- bmi->mv.as_mv.col = 0;
- bmi->mv.as_mv.row = 0;
- }
-}
-
-/* Estimates all motion vectors for a macroblock given the lists of
- * overlaps for each block. Decides whether or not the MVs must be clamped.
- */
-static void estimate_mb_mvs(const B_OVERLAP *block_overlaps,
- MODE_INFO *mi,
- int mb_to_left_edge,
- int mb_to_right_edge,
- int mb_to_top_edge,
- int mb_to_bottom_edge)
-{
- int row, col;
- int non_zero_count = 0;
- MV * const filtered_mv = &(mi->mbmi.mv.as_mv);
- union b_mode_info * const bmi = mi->bmi;
- filtered_mv->col = 0;
- filtered_mv->row = 0;
- mi->mbmi.need_to_clamp_mvs = 0;
- for (row = 0; row < 4; ++row)
- {
- int this_b_to_top_edge = mb_to_top_edge + ((row*4)<<3);
- int this_b_to_bottom_edge = mb_to_bottom_edge - ((row*4)<<3);
- for (col = 0; col < 4; ++col)
- {
- int i = row * 4 + col;
- int this_b_to_left_edge = mb_to_left_edge + ((col*4)<<3);
- int this_b_to_right_edge = mb_to_right_edge - ((col*4)<<3);
- /* Estimate vectors for all blocks which are overlapped by this */
- /* type. Interpolate/extrapolate the rest of the block's MVs */
- estimate_mv(block_overlaps[i].overlaps, &(bmi[i]));
- mi->mbmi.need_to_clamp_mvs |= vp8_check_mv_bounds(
- &bmi[i].mv,
- this_b_to_left_edge,
- this_b_to_right_edge,
- this_b_to_top_edge,
- this_b_to_bottom_edge);
- if (bmi[i].mv.as_int != 0)
- {
- ++non_zero_count;
- filtered_mv->col += bmi[i].mv.as_mv.col;
- filtered_mv->row += bmi[i].mv.as_mv.row;
- }
- }
- }
- if (non_zero_count > 0)
- {
- filtered_mv->col /= non_zero_count;
- filtered_mv->row /= non_zero_count;
- }
-}
-
-static void calc_prev_mb_overlaps(MB_OVERLAP *overlaps, MODE_INFO *prev_mi,
- int mb_row, int mb_col,
- int mb_rows, int mb_cols)
-{
- int sub_row;
- int sub_col;
- for (sub_row = 0; sub_row < 4; ++sub_row)
- {
- for (sub_col = 0; sub_col < 4; ++sub_col)
- {
- vp8_calculate_overlaps(
- overlaps, mb_rows, mb_cols,
- &(prev_mi->bmi[sub_row * 4 + sub_col]),
- 4 * mb_row + sub_row,
- 4 * mb_col + sub_col);
- }
- }
-}
-
-/* Estimate all missing motion vectors. This function does the same as the one
- * above, but has different input arguments. */
-static void estimate_missing_mvs(MB_OVERLAP *overlaps,
- MODE_INFO *mi, MODE_INFO *prev_mi,
- int mb_rows, int mb_cols,
- unsigned int first_corrupt)
-{
- int mb_row, mb_col;
- vpx_memset(overlaps, 0, sizeof(MB_OVERLAP) * mb_rows * mb_cols);
- /* First calculate the overlaps for all blocks */
- for (mb_row = 0; mb_row < mb_rows; ++mb_row)
- {
- for (mb_col = 0; mb_col < mb_cols; ++mb_col)
- {
- /* We're only able to use blocks referring to the last frame
- * when extrapolating new vectors.
- */
- if (prev_mi->mbmi.ref_frame == LAST_FRAME)
- {
- calc_prev_mb_overlaps(overlaps, prev_mi,
- mb_row, mb_col,
- mb_rows, mb_cols);
- }
- ++prev_mi;
- }
- ++prev_mi;
- }
-
- mb_row = first_corrupt / mb_cols;
- mb_col = first_corrupt - mb_row * mb_cols;
- mi += mb_row*(mb_cols + 1) + mb_col;
- /* Go through all macroblocks in the current image with missing MVs
- * and calculate new MVs using the overlaps.
- */
- for (; mb_row < mb_rows; ++mb_row)
- {
- int mb_to_top_edge = -((mb_row * 16)) << 3;
- int mb_to_bottom_edge = ((mb_rows - 1 - mb_row) * 16) << 3;
- for (; mb_col < mb_cols; ++mb_col)
- {
- int mb_to_left_edge = -((mb_col * 16) << 3);
- int mb_to_right_edge = ((mb_cols - 1 - mb_col) * 16) << 3;
- const B_OVERLAP *block_overlaps =
- overlaps[mb_row*mb_cols + mb_col].overlaps;
- mi->mbmi.ref_frame = LAST_FRAME;
- mi->mbmi.mode = SPLITMV;
- mi->mbmi.uv_mode = DC_PRED;
- mi->mbmi.partitioning = 3;
- mi->mbmi.segment_id = 0;
- estimate_mb_mvs(block_overlaps,
- mi,
- mb_to_left_edge,
- mb_to_right_edge,
- mb_to_top_edge,
- mb_to_bottom_edge);
- ++mi;
- }
- mb_col = 0;
- ++mi;
- }
-}
-
-void vp8_estimate_missing_mvs(VP8D_COMP *pbi)
-{
- VP8_COMMON * const pc = &pbi->common;
- estimate_missing_mvs(pbi->overlaps,
- pc->mi, pc->prev_mi,
- pc->mb_rows, pc->mb_cols,
- pbi->mvs_corrupt_from_mb);
-}
-
-static void assign_neighbor(EC_BLOCK *neighbor, MODE_INFO *mi, int block_idx)
-{
- assert(mi->mbmi.ref_frame < MAX_REF_FRAMES);
- neighbor->ref_frame = mi->mbmi.ref_frame;
- neighbor->mv = mi->bmi[block_idx].mv.as_mv;
-}
-
-/* Finds the neighboring blocks of a macroblocks. In the general case
- * 20 blocks are found. If a fewer number of blocks are found due to
- * image boundaries, those positions in the EC_BLOCK array are left "empty".
- * The neighbors are enumerated with the upper-left neighbor as the first
- * element, the second element refers to the neighbor to right of the previous
- * neighbor, and so on. The last element refers to the neighbor below the first
- * neighbor.
- */
-static void find_neighboring_blocks(MODE_INFO *mi,
- EC_BLOCK *neighbors,
- int mb_row, int mb_col,
- int mb_rows, int mb_cols,
- int mi_stride)
-{
- int i = 0;
- int j;
- if (mb_row > 0)
- {
- /* upper left */
- if (mb_col > 0)
- assign_neighbor(&neighbors[i], mi - mi_stride - 1, 15);
- ++i;
- /* above */
- for (j = 12; j < 16; ++j, ++i)
- assign_neighbor(&neighbors[i], mi - mi_stride, j);
- }
- else
- i += 5;
- if (mb_col < mb_cols - 1)
- {
- /* upper right */
- if (mb_row > 0)
- assign_neighbor(&neighbors[i], mi - mi_stride + 1, 12);
- ++i;
- /* right */
- for (j = 0; j <= 12; j += 4, ++i)
- assign_neighbor(&neighbors[i], mi + 1, j);
- }
- else
- i += 5;
- if (mb_row < mb_rows - 1)
- {
- /* lower right */
- if (mb_col < mb_cols - 1)
- assign_neighbor(&neighbors[i], mi + mi_stride + 1, 0);
- ++i;
- /* below */
- for (j = 0; j < 4; ++j, ++i)
- assign_neighbor(&neighbors[i], mi + mi_stride, j);
- }
- else
- i += 5;
- if (mb_col > 0)
- {
- /* lower left */
- if (mb_row < mb_rows - 1)
- assign_neighbor(&neighbors[i], mi + mi_stride - 1, 4);
- ++i;
- /* left */
- for (j = 3; j < 16; j += 4, ++i)
- {
- assign_neighbor(&neighbors[i], mi - 1, j);
- }
- }
- else
- i += 5;
- assert(i == 20);
-}
-
-/* Interpolates all motion vectors for a macroblock from the neighboring blocks'
- * motion vectors.
- */
-static void interpolate_mvs(MACROBLOCKD *mb,
- EC_BLOCK *neighbors,
- MV_REFERENCE_FRAME dom_ref_frame)
-{
- int row, col, i;
- MODE_INFO * const mi = mb->mode_info_context;
- /* Table with the position of the neighboring blocks relative the position
- * of the upper left block of the current MB. Starting with the upper left
- * neighbor and going to the right.
- */
- const EC_POS neigh_pos[NUM_NEIGHBORS] = {
- {-1,-1}, {-1,0}, {-1,1}, {-1,2}, {-1,3},
- {-1,4}, {0,4}, {1,4}, {2,4}, {3,4},
- {4,4}, {4,3}, {4,2}, {4,1}, {4,0},
- {4,-1}, {3,-1}, {2,-1}, {1,-1}, {0,-1}
- };
- mi->mbmi.need_to_clamp_mvs = 0;
- for (row = 0; row < 4; ++row)
- {
- int mb_to_top_edge = mb->mb_to_top_edge + ((row*4)<<3);
- int mb_to_bottom_edge = mb->mb_to_bottom_edge - ((row*4)<<3);
- for (col = 0; col < 4; ++col)
- {
- int mb_to_left_edge = mb->mb_to_left_edge + ((col*4)<<3);
- int mb_to_right_edge = mb->mb_to_right_edge - ((col*4)<<3);
- int w_sum = 0;
- int mv_row_sum = 0;
- int mv_col_sum = 0;
- int_mv * const mv = &(mi->bmi[row*4 + col].mv);
- mv->as_int = 0;
- for (i = 0; i < NUM_NEIGHBORS; ++i)
- {
- /* Calculate the weighted sum of neighboring MVs referring
- * to the dominant frame type.
- */
- const int w = weights_q7[abs(row - neigh_pos[i].row)]
- [abs(col - neigh_pos[i].col)];
- if (neighbors[i].ref_frame != dom_ref_frame)
- continue;
- w_sum += w;
- /* Q7 * Q3 = Q10 */
- mv_row_sum += w*neighbors[i].mv.row;
- mv_col_sum += w*neighbors[i].mv.col;
- }
- if (w_sum > 0)
- {
- /* Avoid division by zero.
- * Normalize with the sum of the coefficients
- * Q3 = Q10 / Q7
- */
- mv->as_mv.row = mv_row_sum / w_sum;
- mv->as_mv.col = mv_col_sum / w_sum;
- mi->mbmi.need_to_clamp_mvs |= vp8_check_mv_bounds(
- mv,
- mb_to_left_edge,
- mb_to_right_edge,
- mb_to_top_edge,
- mb_to_bottom_edge);
- }
- }
- }
-}
-
-void vp8_interpolate_motion(MACROBLOCKD *mb,
- int mb_row, int mb_col,
- int mb_rows, int mb_cols,
- int mi_stride)
-{
- /* Find relevant neighboring blocks */
- EC_BLOCK neighbors[NUM_NEIGHBORS];
- int i;
- /* Initialize the array. MAX_REF_FRAMES is interpreted as "doesn't exist" */
- for (i = 0; i < NUM_NEIGHBORS; ++i)
- {
- neighbors[i].ref_frame = MAX_REF_FRAMES;
- neighbors[i].mv.row = neighbors[i].mv.col = 0;
- }
- find_neighboring_blocks(mb->mode_info_context,
- neighbors,
- mb_row, mb_col,
- mb_rows, mb_cols,
- mb->mode_info_stride);
- /* Interpolate MVs for the missing blocks from the surrounding
- * blocks which refer to the last frame. */
- interpolate_mvs(mb, neighbors, LAST_FRAME);
-
- mb->mode_info_context->mbmi.ref_frame = LAST_FRAME;
- mb->mode_info_context->mbmi.mode = SPLITMV;
- mb->mode_info_context->mbmi.uv_mode = DC_PRED;
- mb->mode_info_context->mbmi.partitioning = 3;
- mb->mode_info_context->mbmi.segment_id = 0;
-}
-
-void vp8_conceal_corrupt_mb(MACROBLOCKD *xd)
-{
- /* This macroblock has corrupt residual, use the motion compensated
- image (predictor) for concealment */
-
- /* The build predictor functions now output directly into the dst buffer,
- * so the copies are no longer necessary */
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.h
deleted file mode 100644
index 9a1e024..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/error_concealment.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_DECODER_ERROR_CONCEALMENT_H_
-#define VP8_DECODER_ERROR_CONCEALMENT_H_
-
-#include "onyxd_int.h"
-#include "ec_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Allocate memory for the overlap lists */
-int vp8_alloc_overlap_lists(VP8D_COMP *pbi);
-
-/* Deallocate the overlap lists */
-void vp8_de_alloc_overlap_lists(VP8D_COMP *pbi);
-
-/* Estimate all missing motion vectors. */
-void vp8_estimate_missing_mvs(VP8D_COMP *pbi);
-
-/* Functions for spatial MV interpolation */
-
-/* Interpolates all motion vectors for a macroblock mb at position
- * (mb_row, mb_col). */
-void vp8_interpolate_motion(MACROBLOCKD *mb,
- int mb_row, int mb_col,
- int mb_rows, int mb_cols,
- int mi_stride);
-
-/* Conceal a macroblock with corrupt residual.
- * Copies the prediction signal to the reconstructed image.
- */
-void vp8_conceal_corrupt_mb(MACROBLOCKD *xd);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_ERROR_CONCEALMENT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_if.c b/videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_if.c
deleted file mode 100644
index 35b541e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_if.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/common/onyxc_int.h"
-#if CONFIG_POSTPROC
-#include "vp8/common/postproc.h"
-#endif
-#include "vp8/common/onyxd.h"
-#include "onyxd_int.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/alloccommon.h"
-#include "vp8/common/loopfilter.h"
-#include "vp8/common/swapyv12buffer.h"
-#include "vp8/common/threading.h"
-#include "decoderthreading.h"
-#include <stdio.h>
-#include <assert.h>
-
-#include "vp8/common/quant_common.h"
-#include "./vpx_scale_rtcd.h"
-#include "vpx_scale/vpx_scale.h"
-#include "vp8/common/systemdependent.h"
-#include "vpx_ports/vpx_timer.h"
-#include "detokenize.h"
-#if CONFIG_ERROR_CONCEALMENT
-#include "error_concealment.h"
-#endif
-#if ARCH_ARM
-#include "vpx_ports/arm.h"
-#endif
-
-extern void vp8_init_loop_filter(VP8_COMMON *cm);
-extern void vp8cx_init_de_quantizer(VP8D_COMP *pbi);
-static int get_free_fb (VP8_COMMON *cm);
-static void ref_cnt_fb (int *buf, int *idx, int new_idx);
-
-static void remove_decompressor(VP8D_COMP *pbi)
-{
-#if CONFIG_ERROR_CONCEALMENT
- vp8_de_alloc_overlap_lists(pbi);
-#endif
- vp8_remove_common(&pbi->common);
- vpx_free(pbi);
-}
-
-static struct VP8D_COMP * create_decompressor(VP8D_CONFIG *oxcf)
-{
- VP8D_COMP *pbi = vpx_memalign(32, sizeof(VP8D_COMP));
- (void)oxcf;
- if (!pbi)
- return NULL;
-
- vpx_memset(pbi, 0, sizeof(VP8D_COMP));
-
- if (setjmp(pbi->common.error.jmp))
- {
- pbi->common.error.setjmp = 0;
- remove_decompressor(pbi);
- return 0;
- }
-
- pbi->common.error.setjmp = 1;
-
- vp8_create_common(&pbi->common);
-
- pbi->common.current_video_frame = 0;
- pbi->ready_for_new_data = 1;
-
- /* vp8cx_init_de_quantizer() is first called here. Add check in frame_init_dequantizer() to avoid
- * unnecessary calling of vp8cx_init_de_quantizer() for every frame.
- */
- vp8cx_init_de_quantizer(pbi);
-
- vp8_loop_filter_init(&pbi->common);
-
- pbi->common.error.setjmp = 0;
-
-#if CONFIG_ERROR_CONCEALMENT
- pbi->ec_enabled = oxcf->error_concealment;
- pbi->overlaps = NULL;
-#else
- pbi->ec_enabled = 0;
-#endif
- /* Error concealment is activated after a key frame has been
- * decoded without errors when error concealment is enabled.
- */
- pbi->ec_active = 0;
-
- pbi->decoded_key_frame = 0;
-
- /* Independent partitions is activated when a frame updates the
- * token probability table to have equal probabilities over the
- * PREV_COEF context.
- */
- pbi->independent_partitions = 0;
-
- vp8_setup_block_dptrs(&pbi->mb);
-
- return pbi;
-}
-
-vpx_codec_err_t vp8dx_get_reference(VP8D_COMP *pbi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd)
-{
- VP8_COMMON *cm = &pbi->common;
- int ref_fb_idx;
-
- if (ref_frame_flag == VP8_LAST_FRAME)
- ref_fb_idx = cm->lst_fb_idx;
- else if (ref_frame_flag == VP8_GOLD_FRAME)
- ref_fb_idx = cm->gld_fb_idx;
- else if (ref_frame_flag == VP8_ALTR_FRAME)
- ref_fb_idx = cm->alt_fb_idx;
- else{
- vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR,
- "Invalid reference frame");
- return pbi->common.error.error_code;
- }
-
- if(cm->yv12_fb[ref_fb_idx].y_height != sd->y_height ||
- cm->yv12_fb[ref_fb_idx].y_width != sd->y_width ||
- cm->yv12_fb[ref_fb_idx].uv_height != sd->uv_height ||
- cm->yv12_fb[ref_fb_idx].uv_width != sd->uv_width){
- vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR,
- "Incorrect buffer dimensions");
- }
- else
- vp8_yv12_copy_frame(&cm->yv12_fb[ref_fb_idx], sd);
-
- return pbi->common.error.error_code;
-}
-
-
-vpx_codec_err_t vp8dx_set_reference(VP8D_COMP *pbi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd)
-{
- VP8_COMMON *cm = &pbi->common;
- int *ref_fb_ptr = NULL;
- int free_fb;
-
- if (ref_frame_flag == VP8_LAST_FRAME)
- ref_fb_ptr = &cm->lst_fb_idx;
- else if (ref_frame_flag == VP8_GOLD_FRAME)
- ref_fb_ptr = &cm->gld_fb_idx;
- else if (ref_frame_flag == VP8_ALTR_FRAME)
- ref_fb_ptr = &cm->alt_fb_idx;
- else{
- vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR,
- "Invalid reference frame");
- return pbi->common.error.error_code;
- }
-
- if(cm->yv12_fb[*ref_fb_ptr].y_height != sd->y_height ||
- cm->yv12_fb[*ref_fb_ptr].y_width != sd->y_width ||
- cm->yv12_fb[*ref_fb_ptr].uv_height != sd->uv_height ||
- cm->yv12_fb[*ref_fb_ptr].uv_width != sd->uv_width){
- vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR,
- "Incorrect buffer dimensions");
- }
- else{
- /* Find an empty frame buffer. */
- free_fb = get_free_fb(cm);
- /* Decrease fb_idx_ref_cnt since it will be increased again in
- * ref_cnt_fb() below. */
- cm->fb_idx_ref_cnt[free_fb]--;
-
- /* Manage the reference counters and copy image. */
- ref_cnt_fb (cm->fb_idx_ref_cnt, ref_fb_ptr, free_fb);
- vp8_yv12_copy_frame(sd, &cm->yv12_fb[*ref_fb_ptr]);
- }
-
- return pbi->common.error.error_code;
-}
-
-/*For ARM NEON, d8-d15 are callee-saved registers, and need to be saved by us.*/
-#if HAVE_NEON
-extern void vp8_push_neon(int64_t *store);
-extern void vp8_pop_neon(int64_t *store);
-#endif
-
-static int get_free_fb (VP8_COMMON *cm)
-{
- int i;
- for (i = 0; i < NUM_YV12_BUFFERS; i++)
- if (cm->fb_idx_ref_cnt[i] == 0)
- break;
-
- assert(i < NUM_YV12_BUFFERS);
- cm->fb_idx_ref_cnt[i] = 1;
- return i;
-}
-
-static void ref_cnt_fb (int *buf, int *idx, int new_idx)
-{
- if (buf[*idx] > 0)
- buf[*idx]--;
-
- *idx = new_idx;
-
- buf[new_idx]++;
-}
-
-/* If any buffer copy / swapping is signalled it should be done here. */
-static int swap_frame_buffers (VP8_COMMON *cm)
-{
- int err = 0;
-
- /* The alternate reference frame or golden frame can be updated
- * using the new, last, or golden/alt ref frame. If it
- * is updated using the newly decoded frame it is a refresh.
- * An update using the last or golden/alt ref frame is a copy.
- */
- if (cm->copy_buffer_to_arf)
- {
- int new_fb = 0;
-
- if (cm->copy_buffer_to_arf == 1)
- new_fb = cm->lst_fb_idx;
- else if (cm->copy_buffer_to_arf == 2)
- new_fb = cm->gld_fb_idx;
- else
- err = -1;
-
- ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->alt_fb_idx, new_fb);
- }
-
- if (cm->copy_buffer_to_gf)
- {
- int new_fb = 0;
-
- if (cm->copy_buffer_to_gf == 1)
- new_fb = cm->lst_fb_idx;
- else if (cm->copy_buffer_to_gf == 2)
- new_fb = cm->alt_fb_idx;
- else
- err = -1;
-
- ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->gld_fb_idx, new_fb);
- }
-
- if (cm->refresh_golden_frame)
- ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->gld_fb_idx, cm->new_fb_idx);
-
- if (cm->refresh_alt_ref_frame)
- ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->alt_fb_idx, cm->new_fb_idx);
-
- if (cm->refresh_last_frame)
- {
- ref_cnt_fb (cm->fb_idx_ref_cnt, &cm->lst_fb_idx, cm->new_fb_idx);
-
- cm->frame_to_show = &cm->yv12_fb[cm->lst_fb_idx];
- }
- else
- cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
-
- cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
-
- return err;
-}
-
-int check_fragments_for_errors(VP8D_COMP *pbi)
-{
- if (!pbi->ec_active &&
- pbi->fragments.count <= 1 && pbi->fragments.sizes[0] == 0)
- {
- VP8_COMMON *cm = &pbi->common;
-
- /* If error concealment is disabled we won't signal missing frames
- * to the decoder.
- */
- if (cm->fb_idx_ref_cnt[cm->lst_fb_idx] > 1)
- {
- /* The last reference shares buffer with another reference
- * buffer. Move it to its own buffer before setting it as
- * corrupt, otherwise we will make multiple buffers corrupt.
- */
- const int prev_idx = cm->lst_fb_idx;
- cm->fb_idx_ref_cnt[prev_idx]--;
- cm->lst_fb_idx = get_free_fb(cm);
- vp8_yv12_copy_frame(&cm->yv12_fb[prev_idx],
- &cm->yv12_fb[cm->lst_fb_idx]);
- }
- /* This is used to signal that we are missing frames.
- * We do not know if the missing frame(s) was supposed to update
- * any of the reference buffers, but we act conservative and
- * mark only the last buffer as corrupted.
- */
- cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
-
- /* Signal that we have no frame to show. */
- cm->show_frame = 0;
-
- /* Nothing more to do. */
- return 0;
- }
-
- return 1;
-}
-
-int vp8dx_receive_compressed_data(VP8D_COMP *pbi, size_t size,
- const uint8_t *source,
- int64_t time_stamp)
-{
-#if HAVE_NEON
- int64_t dx_store_reg[8];
-#endif
- VP8_COMMON *cm = &pbi->common;
- volatile int retcode;
-
- (void) size;
- (void) source;
- pbi->common.error.error_code = VPX_CODEC_OK;
-
- retcode = check_fragments_for_errors(pbi);
- if(retcode <= 0)
- return retcode;
-
-#if HAVE_NEON
-#if CONFIG_RUNTIME_CPU_DETECT
- if (cm->cpu_caps & HAS_NEON)
-#endif
- {
- vp8_push_neon(dx_store_reg);
- }
-#endif
-
- cm->new_fb_idx = get_free_fb (cm);
-
- /* setup reference frames for vp8_decode_frame */
- pbi->dec_fb_ref[INTRA_FRAME] = &cm->yv12_fb[cm->new_fb_idx];
- pbi->dec_fb_ref[LAST_FRAME] = &cm->yv12_fb[cm->lst_fb_idx];
- pbi->dec_fb_ref[GOLDEN_FRAME] = &cm->yv12_fb[cm->gld_fb_idx];
- pbi->dec_fb_ref[ALTREF_FRAME] = &cm->yv12_fb[cm->alt_fb_idx];
-
- if (setjmp(pbi->common.error.jmp))
- {
- /* We do not know if the missing frame(s) was supposed to update
- * any of the reference buffers, but we act conservative and
- * mark only the last buffer as corrupted.
- */
- cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
-
- if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
- cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
-
- goto decode_exit;
- }
-
- pbi->common.error.setjmp = 1;
-
- retcode = vp8_decode_frame(pbi);
-
- if (retcode < 0)
- {
- if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
- cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
-
- pbi->common.error.error_code = VPX_CODEC_ERROR;
- goto decode_exit;
- }
-
- if (swap_frame_buffers (cm))
- {
- pbi->common.error.error_code = VPX_CODEC_ERROR;
- goto decode_exit;
- }
-
- vp8_clear_system_state();
-
- if (cm->show_frame)
- {
- cm->current_video_frame++;
- cm->show_frame_mi = cm->mi;
- }
-
- #if CONFIG_ERROR_CONCEALMENT
- /* swap the mode infos to storage for future error concealment */
- if (pbi->ec_enabled && pbi->common.prev_mi)
- {
- MODE_INFO* tmp = pbi->common.prev_mi;
- int row, col;
- pbi->common.prev_mi = pbi->common.mi;
- pbi->common.mi = tmp;
-
- /* Propagate the segment_ids to the next frame */
- for (row = 0; row < pbi->common.mb_rows; ++row)
- {
- for (col = 0; col < pbi->common.mb_cols; ++col)
- {
- const int i = row*pbi->common.mode_info_stride + col;
- pbi->common.mi[i].mbmi.segment_id =
- pbi->common.prev_mi[i].mbmi.segment_id;
- }
- }
- }
-#endif
-
- pbi->ready_for_new_data = 0;
- pbi->last_time_stamp = time_stamp;
-
-decode_exit:
-#if HAVE_NEON
-#if CONFIG_RUNTIME_CPU_DETECT
- if (cm->cpu_caps & HAS_NEON)
-#endif
- {
- vp8_pop_neon(dx_store_reg);
- }
-#endif
-
- pbi->common.error.setjmp = 0;
- return retcode;
-}
-int vp8dx_get_raw_frame(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags)
-{
- int ret = -1;
-
- if (pbi->ready_for_new_data == 1)
- return ret;
-
- /* ie no raw frame to show!!! */
- if (pbi->common.show_frame == 0)
- return ret;
-
- pbi->ready_for_new_data = 1;
- *time_stamp = pbi->last_time_stamp;
- *time_end_stamp = 0;
-
-#if CONFIG_POSTPROC
- ret = vp8_post_proc_frame(&pbi->common, sd, flags);
-#else
-
- if (pbi->common.frame_to_show)
- {
- *sd = *pbi->common.frame_to_show;
- sd->y_width = pbi->common.Width;
- sd->y_height = pbi->common.Height;
- sd->uv_height = pbi->common.Height / 2;
- ret = 0;
- }
- else
- {
- ret = -1;
- }
-
-#endif /*!CONFIG_POSTPROC*/
- vp8_clear_system_state();
- return ret;
-}
-
-
-/* This function as written isn't decoder specific, but the encoder has
- * much faster ways of computing this, so it's ok for it to live in a
- * decode specific file.
- */
-int vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame )
-{
- const MODE_INFO *mi = oci->mi;
- int mb_row, mb_col;
-
- for (mb_row = 0; mb_row < oci->mb_rows; mb_row++)
- {
- for (mb_col = 0; mb_col < oci->mb_cols; mb_col++,mi++)
- {
- if( mi->mbmi.ref_frame == ref_frame)
- return 1;
- }
- mi++;
- }
- return 0;
-
-}
-
-int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf)
-{
- if(!fb->use_frame_threads)
- {
- /* decoder instance for single thread mode */
- fb->pbi[0] = create_decompressor(oxcf);
- if(!fb->pbi[0])
- return VPX_CODEC_ERROR;
-
-#if CONFIG_MULTITHREAD
- /* enable row-based threading only when use_frame_threads
- * is disabled */
- fb->pbi[0]->max_threads = oxcf->max_threads;
- vp8_decoder_create_threads(fb->pbi[0]);
-#endif
- }
- else
- {
- /* TODO : create frame threads and decoder instances for each
- * thread here */
- }
-
- return VPX_CODEC_OK;
-}
-
-int vp8_remove_decoder_instances(struct frame_buffers *fb)
-{
- if(!fb->use_frame_threads)
- {
- VP8D_COMP *pbi = fb->pbi[0];
-
- if (!pbi)
- return VPX_CODEC_ERROR;
-#if CONFIG_MULTITHREAD
- if (pbi->b_multithreaded_rd)
- vp8mt_de_alloc_temp_buffers(pbi, pbi->common.mb_rows);
- vp8_decoder_remove_threads(pbi);
-#endif
-
- /* decoder instance for single thread mode */
- remove_decompressor(pbi);
- }
- else
- {
- /* TODO : remove frame threads and decoder instances for each
- * thread here */
- }
-
- return VPX_CODEC_OK;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_int.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_int.h
deleted file mode 100644
index 8ef4894..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/onyxd_int.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_DECODER_ONYXD_INT_H_
-#define VP8_DECODER_ONYXD_INT_H_
-
-#include "vpx_config.h"
-#include "vp8/common/onyxd.h"
-#include "treereader.h"
-#include "vp8/common/onyxc_int.h"
-#include "vp8/common/threading.h"
-
-#if CONFIG_ERROR_CONCEALMENT
-#include "ec_types.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct
-{
- int ithread;
- void *ptr1;
- void *ptr2;
-} DECODETHREAD_DATA;
-
-typedef struct
-{
- MACROBLOCKD mbd;
-} MB_ROW_DEC;
-
-
-typedef struct
-{
- int enabled;
- unsigned int count;
- const unsigned char *ptrs[MAX_PARTITIONS];
- unsigned int sizes[MAX_PARTITIONS];
-} FRAGMENT_DATA;
-
-#define MAX_FB_MT_DEC 32
-
-struct frame_buffers
-{
- /*
- * this struct will be populated with frame buffer management
- * info in future commits. */
-
- /* enable/disable frame-based threading */
- int use_frame_threads;
-
- /* decoder instances */
- struct VP8D_COMP *pbi[MAX_FB_MT_DEC];
-
-};
-
-typedef struct VP8D_COMP
-{
- DECLARE_ALIGNED(16, MACROBLOCKD, mb);
-
- YV12_BUFFER_CONFIG *dec_fb_ref[NUM_YV12_BUFFERS];
-
- DECLARE_ALIGNED(16, VP8_COMMON, common);
-
- /* the last partition will be used for the modes/mvs */
- vp8_reader mbc[MAX_PARTITIONS];
-
- VP8D_CONFIG oxcf;
-
- FRAGMENT_DATA fragments;
-
-#if CONFIG_MULTITHREAD
- /* variable for threading */
-
- volatile int b_multithreaded_rd;
- int max_threads;
- int current_mb_col_main;
- unsigned int decoding_thread_count;
- int allocated_decoding_thread_count;
-
- int mt_baseline_filter_level[MAX_MB_SEGMENTS];
- int sync_range;
- int *mt_current_mb_col; /* Each row remembers its already decoded column. */
-
- unsigned char **mt_yabove_row; /* mb_rows x width */
- unsigned char **mt_uabove_row;
- unsigned char **mt_vabove_row;
- unsigned char **mt_yleft_col; /* mb_rows x 16 */
- unsigned char **mt_uleft_col; /* mb_rows x 8 */
- unsigned char **mt_vleft_col; /* mb_rows x 8 */
-
- MB_ROW_DEC *mb_row_di;
- DECODETHREAD_DATA *de_thread_data;
-
- pthread_t *h_decoding_thread;
- sem_t *h_event_start_decoding;
- sem_t h_event_end_decoding;
- /* end of threading data */
-#endif
-
- int64_t last_time_stamp;
- int ready_for_new_data;
-
- vp8_prob prob_intra;
- vp8_prob prob_last;
- vp8_prob prob_gf;
- vp8_prob prob_skip_false;
-
-#if CONFIG_ERROR_CONCEALMENT
- MB_OVERLAP *overlaps;
- /* the mb num from which modes and mvs (first partition) are corrupt */
- unsigned int mvs_corrupt_from_mb;
-#endif
- int ec_enabled;
- int ec_active;
- int decoded_key_frame;
- int independent_partitions;
- int frame_corrupt_residual;
-
- vp8_decrypt_cb *decrypt_cb;
- void *decrypt_state;
-} VP8D_COMP;
-
-int vp8_decode_frame(VP8D_COMP *cpi);
-
-int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf);
-int vp8_remove_decoder_instances(struct frame_buffers *fb);
-
-#if CONFIG_DEBUG
-#define CHECK_MEM_ERROR(lval,expr) do {\
- lval = (expr); \
- if(!lval) \
- vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
- "Failed to allocate "#lval" at %s:%d", \
- __FILE__,__LINE__);\
- } while(0)
-#else
-#define CHECK_MEM_ERROR(lval,expr) do {\
- lval = (expr); \
- if(!lval) \
- vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,\
- "Failed to allocate "#lval);\
- } while(0)
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_ONYXD_INT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/threading.c b/videocodec/libvpx_internal/libvpx/vp8/decoder/threading.c
deleted file mode 100644
index bc82071..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/threading.c
+++ /dev/null
@@ -1,910 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#if !defined(WIN32) && CONFIG_OS_SUPPORT == 1
-# include <unistd.h>
-#endif
-#include "onyxd_int.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/threading.h"
-
-#include "vp8/common/loopfilter.h"
-#include "vp8/common/extend.h"
-#include "vpx_ports/vpx_timer.h"
-#include "detokenize.h"
-#include "vp8/common/reconintra4x4.h"
-#include "vp8/common/reconinter.h"
-#include "vp8/common/setupintrarecon.h"
-#if CONFIG_ERROR_CONCEALMENT
-#include "error_concealment.h"
-#endif
-
-#define CALLOC_ARRAY(p, n) CHECK_MEM_ERROR((p), vpx_calloc(sizeof(*(p)), (n)))
-#define CALLOC_ARRAY_ALIGNED(p, n, algn) do { \
- CHECK_MEM_ERROR((p), vpx_memalign((algn), sizeof(*(p)) * (n))); \
- memset((p), 0, (n) * sizeof(*(p))); \
-} while (0)
-
-
-void vp8_mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd);
-
-static void setup_decoding_thread_data(VP8D_COMP *pbi, MACROBLOCKD *xd, MB_ROW_DEC *mbrd, int count)
-{
- VP8_COMMON *const pc = & pbi->common;
- int i;
-
- for (i = 0; i < count; i++)
- {
- MACROBLOCKD *mbd = &mbrd[i].mbd;
- mbd->subpixel_predict = xd->subpixel_predict;
- mbd->subpixel_predict8x4 = xd->subpixel_predict8x4;
- mbd->subpixel_predict8x8 = xd->subpixel_predict8x8;
- mbd->subpixel_predict16x16 = xd->subpixel_predict16x16;
-
- mbd->mode_info_context = pc->mi + pc->mode_info_stride * (i + 1);
- mbd->mode_info_stride = pc->mode_info_stride;
-
- mbd->frame_type = pc->frame_type;
- mbd->pre = xd->pre;
- mbd->dst = xd->dst;
-
- mbd->segmentation_enabled = xd->segmentation_enabled;
- mbd->mb_segement_abs_delta = xd->mb_segement_abs_delta;
- vpx_memcpy(mbd->segment_feature_data, xd->segment_feature_data, sizeof(xd->segment_feature_data));
-
- /*signed char ref_lf_deltas[MAX_REF_LF_DELTAS];*/
- vpx_memcpy(mbd->ref_lf_deltas, xd->ref_lf_deltas, sizeof(xd->ref_lf_deltas));
- /*signed char mode_lf_deltas[MAX_MODE_LF_DELTAS];*/
- vpx_memcpy(mbd->mode_lf_deltas, xd->mode_lf_deltas, sizeof(xd->mode_lf_deltas));
- /*unsigned char mode_ref_lf_delta_enabled;
- unsigned char mode_ref_lf_delta_update;*/
- mbd->mode_ref_lf_delta_enabled = xd->mode_ref_lf_delta_enabled;
- mbd->mode_ref_lf_delta_update = xd->mode_ref_lf_delta_update;
-
- mbd->current_bc = &pbi->mbc[0];
-
- vpx_memcpy(mbd->dequant_y1_dc, xd->dequant_y1_dc, sizeof(xd->dequant_y1_dc));
- vpx_memcpy(mbd->dequant_y1, xd->dequant_y1, sizeof(xd->dequant_y1));
- vpx_memcpy(mbd->dequant_y2, xd->dequant_y2, sizeof(xd->dequant_y2));
- vpx_memcpy(mbd->dequant_uv, xd->dequant_uv, sizeof(xd->dequant_uv));
-
- mbd->fullpixel_mask = 0xffffffff;
-
- if (pc->full_pixel)
- mbd->fullpixel_mask = 0xfffffff8;
-
- }
-
- for (i = 0; i < pc->mb_rows; i++)
- pbi->mt_current_mb_col[i] = -1;
-}
-
-static void mt_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
- unsigned int mb_idx)
-{
- MB_PREDICTION_MODE mode;
- int i;
-#if CONFIG_ERROR_CONCEALMENT
- int corruption_detected = 0;
-#endif
- (void)mb_idx;
- if (xd->mode_info_context->mbmi.mb_skip_coeff)
- {
- vp8_reset_mb_tokens_context(xd);
- }
- else if (!vp8dx_bool_error(xd->current_bc))
- {
- int eobtotal;
- eobtotal = vp8_decode_mb_tokens(pbi, xd);
-
- /* Special case: Force the loopfilter to skip when eobtotal is zero */
- xd->mode_info_context->mbmi.mb_skip_coeff = (eobtotal==0);
- }
-
- mode = xd->mode_info_context->mbmi.mode;
-
- if (xd->segmentation_enabled)
- vp8_mb_init_dequantizer(pbi, xd);
-
-
-#if CONFIG_ERROR_CONCEALMENT
-
- if(pbi->ec_active)
- {
- int throw_residual;
- /* When we have independent partitions we can apply residual even
- * though other partitions within the frame are corrupt.
- */
- throw_residual = (!pbi->independent_partitions &&
- pbi->frame_corrupt_residual);
- throw_residual = (throw_residual || vp8dx_bool_error(xd->current_bc));
-
- if ((mb_idx >= pbi->mvs_corrupt_from_mb || throw_residual))
- {
- /* MB with corrupt residuals or corrupt mode/motion vectors.
- * Better to use the predictor as reconstruction.
- */
- pbi->frame_corrupt_residual = 1;
- vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
- vp8_conceal_corrupt_mb(xd);
-
-
- corruption_detected = 1;
-
- /* force idct to be skipped for B_PRED and use the
- * prediction only for reconstruction
- * */
- vpx_memset(xd->eobs, 0, 25);
- }
- }
-#endif
-
- /* do prediction */
- if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
- {
- vp8_build_intra_predictors_mbuv_s(xd,
- xd->recon_above[1],
- xd->recon_above[2],
- xd->recon_left[1],
- xd->recon_left[2],
- xd->recon_left_stride[1],
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.uv_stride);
-
- if (mode != B_PRED)
- {
- vp8_build_intra_predictors_mby_s(xd,
- xd->recon_above[0],
- xd->recon_left[0],
- xd->recon_left_stride[0],
- xd->dst.y_buffer,
- xd->dst.y_stride);
- }
- else
- {
- short *DQC = xd->dequant_y1;
- int dst_stride = xd->dst.y_stride;
-
- /* clear out residual eob info */
- if(xd->mode_info_context->mbmi.mb_skip_coeff)
- vpx_memset(xd->eobs, 0, 25);
-
- intra_prediction_down_copy(xd, xd->recon_above[0] + 16);
-
- for (i = 0; i < 16; i++)
- {
- BLOCKD *b = &xd->block[i];
- unsigned char *dst = xd->dst.y_buffer + b->offset;
- B_PREDICTION_MODE b_mode =
- xd->mode_info_context->bmi[i].as_mode;
- unsigned char *Above;
- unsigned char *yleft;
- int left_stride;
- unsigned char top_left;
-
- /*Caution: For some b_mode, it needs 8 pixels (4 above + 4 above-right).*/
- if (i < 4 && pbi->common.filter_level)
- Above = xd->recon_above[0] + b->offset;
- else
- Above = dst - dst_stride;
-
- if (i%4==0 && pbi->common.filter_level)
- {
- yleft = xd->recon_left[0] + i;
- left_stride = 1;
- }
- else
- {
- yleft = dst - 1;
- left_stride = dst_stride;
- }
-
- if ((i==4 || i==8 || i==12) && pbi->common.filter_level)
- top_left = *(xd->recon_left[0] + i - 1);
- else
- top_left = Above[-1];
-
- vp8_intra4x4_predict(Above, yleft, left_stride,
- b_mode, dst, dst_stride, top_left);
-
- if (xd->eobs[i] )
- {
- if (xd->eobs[i] > 1)
- {
- vp8_dequant_idct_add(b->qcoeff, DQC, dst, dst_stride);
- }
- else
- {
- vp8_dc_only_idct_add(b->qcoeff[0] * DQC[0],
- dst, dst_stride, dst, dst_stride);
- vpx_memset(b->qcoeff, 0, 2 * sizeof(b->qcoeff[0]));
- }
- }
- }
- }
- }
- else
- {
- vp8_build_inter_predictors_mb(xd);
- }
-
-
-#if CONFIG_ERROR_CONCEALMENT
- if (corruption_detected)
- {
- return;
- }
-#endif
-
- if(!xd->mode_info_context->mbmi.mb_skip_coeff)
- {
- /* dequantization and idct */
- if (mode != B_PRED)
- {
- short *DQC = xd->dequant_y1;
-
- if (mode != SPLITMV)
- {
- BLOCKD *b = &xd->block[24];
-
- /* do 2nd order transform on the dc block */
- if (xd->eobs[24] > 1)
- {
- vp8_dequantize_b(b, xd->dequant_y2);
-
- vp8_short_inv_walsh4x4(&b->dqcoeff[0],
- xd->qcoeff);
- vpx_memset(b->qcoeff, 0, 16 * sizeof(b->qcoeff[0]));
- }
- else
- {
- b->dqcoeff[0] = b->qcoeff[0] * xd->dequant_y2[0];
- vp8_short_inv_walsh4x4_1(&b->dqcoeff[0],
- xd->qcoeff);
- vpx_memset(b->qcoeff, 0, 2 * sizeof(b->qcoeff[0]));
- }
-
- /* override the dc dequant constant in order to preserve the
- * dc components
- */
- DQC = xd->dequant_y1_dc;
- }
-
- vp8_dequant_idct_add_y_block
- (xd->qcoeff, DQC,
- xd->dst.y_buffer,
- xd->dst.y_stride, xd->eobs);
- }
-
- vp8_dequant_idct_add_uv_block
- (xd->qcoeff+16*16, xd->dequant_uv,
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.uv_stride, xd->eobs+16);
- }
-}
-
-static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd, int start_mb_row)
-{
- volatile const int *last_row_current_mb_col;
- volatile int *current_mb_col;
- int mb_row;
- VP8_COMMON *pc = &pbi->common;
- const int nsync = pbi->sync_range;
- const int first_row_no_sync_above = pc->mb_cols + nsync;
- int num_part = 1 << pbi->common.multi_token_partition;
- int last_mb_row = start_mb_row;
-
- YV12_BUFFER_CONFIG *yv12_fb_new = pbi->dec_fb_ref[INTRA_FRAME];
- YV12_BUFFER_CONFIG *yv12_fb_lst = pbi->dec_fb_ref[LAST_FRAME];
-
- int recon_y_stride = yv12_fb_new->y_stride;
- int recon_uv_stride = yv12_fb_new->uv_stride;
-
- unsigned char *ref_buffer[MAX_REF_FRAMES][3];
- unsigned char *dst_buffer[3];
- int i;
- int ref_fb_corrupted[MAX_REF_FRAMES];
-
- ref_fb_corrupted[INTRA_FRAME] = 0;
-
- for(i = 1; i < MAX_REF_FRAMES; i++)
- {
- YV12_BUFFER_CONFIG *this_fb = pbi->dec_fb_ref[i];
-
- ref_buffer[i][0] = this_fb->y_buffer;
- ref_buffer[i][1] = this_fb->u_buffer;
- ref_buffer[i][2] = this_fb->v_buffer;
-
- ref_fb_corrupted[i] = this_fb->corrupted;
- }
-
- dst_buffer[0] = yv12_fb_new->y_buffer;
- dst_buffer[1] = yv12_fb_new->u_buffer;
- dst_buffer[2] = yv12_fb_new->v_buffer;
-
- xd->up_available = (start_mb_row != 0);
-
- for (mb_row = start_mb_row; mb_row < pc->mb_rows; mb_row += (pbi->decoding_thread_count + 1))
- {
- int recon_yoffset, recon_uvoffset;
- int mb_col;
- int filter_level;
- loop_filter_info_n *lfi_n = &pc->lf_info;
-
- /* save last row processed by this thread */
- last_mb_row = mb_row;
- /* select bool coder for current partition */
- xd->current_bc = &pbi->mbc[mb_row%num_part];
-
- if (mb_row > 0)
- last_row_current_mb_col = &pbi->mt_current_mb_col[mb_row -1];
- else
- last_row_current_mb_col = &first_row_no_sync_above;
-
- current_mb_col = &pbi->mt_current_mb_col[mb_row];
-
- recon_yoffset = mb_row * recon_y_stride * 16;
- recon_uvoffset = mb_row * recon_uv_stride * 8;
-
- /* reset contexts */
- xd->above_context = pc->above_context;
- vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
-
- xd->left_available = 0;
-
- xd->mb_to_top_edge = -((mb_row * 16)) << 3;
- xd->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3;
-
- if (pbi->common.filter_level)
- {
- xd->recon_above[0] = pbi->mt_yabove_row[mb_row] + 0*16 +32;
- xd->recon_above[1] = pbi->mt_uabove_row[mb_row] + 0*8 +16;
- xd->recon_above[2] = pbi->mt_vabove_row[mb_row] + 0*8 +16;
-
- xd->recon_left[0] = pbi->mt_yleft_col[mb_row];
- xd->recon_left[1] = pbi->mt_uleft_col[mb_row];
- xd->recon_left[2] = pbi->mt_vleft_col[mb_row];
-
- /* TODO: move to outside row loop */
- xd->recon_left_stride[0] = 1;
- xd->recon_left_stride[1] = 1;
- }
- else
- {
- xd->recon_above[0] = dst_buffer[0] + recon_yoffset;
- xd->recon_above[1] = dst_buffer[1] + recon_uvoffset;
- xd->recon_above[2] = dst_buffer[2] + recon_uvoffset;
-
- xd->recon_left[0] = xd->recon_above[0] - 1;
- xd->recon_left[1] = xd->recon_above[1] - 1;
- xd->recon_left[2] = xd->recon_above[2] - 1;
-
- xd->recon_above[0] -= xd->dst.y_stride;
- xd->recon_above[1] -= xd->dst.uv_stride;
- xd->recon_above[2] -= xd->dst.uv_stride;
-
- /* TODO: move to outside row loop */
- xd->recon_left_stride[0] = xd->dst.y_stride;
- xd->recon_left_stride[1] = xd->dst.uv_stride;
-
- setup_intra_recon_left(xd->recon_left[0], xd->recon_left[1],
- xd->recon_left[2], xd->dst.y_stride,
- xd->dst.uv_stride);
- }
-
- for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
- {
- *current_mb_col = mb_col - 1;
-
- if ((mb_col & (nsync - 1)) == 0)
- {
- while (mb_col > (*last_row_current_mb_col - nsync))
- {
- x86_pause_hint();
- thread_sleep(0);
- }
- }
-
- /* Distance of MB to the various image edges.
- * These are specified to 8th pel as they are always
- * compared to values that are in 1/8th pel units.
- */
- xd->mb_to_left_edge = -((mb_col * 16) << 3);
- xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3;
-
- #if CONFIG_ERROR_CONCEALMENT
- {
- int corrupt_residual =
- (!pbi->independent_partitions &&
- pbi->frame_corrupt_residual) ||
- vp8dx_bool_error(xd->current_bc);
- if (pbi->ec_active &&
- (xd->mode_info_context->mbmi.ref_frame ==
- INTRA_FRAME) &&
- corrupt_residual)
- {
- /* We have an intra block with corrupt
- * coefficients, better to conceal with an inter
- * block.
- * Interpolate MVs from neighboring MBs
- *
- * Note that for the first mb with corrupt
- * residual in a frame, we might not discover
- * that before decoding the residual. That
- * happens after this check, and therefore no
- * inter concealment will be done.
- */
- vp8_interpolate_motion(xd,
- mb_row, mb_col,
- pc->mb_rows, pc->mb_cols,
- pc->mode_info_stride);
- }
- }
- #endif
-
-
- xd->dst.y_buffer = dst_buffer[0] + recon_yoffset;
- xd->dst.u_buffer = dst_buffer[1] + recon_uvoffset;
- xd->dst.v_buffer = dst_buffer[2] + recon_uvoffset;
-
- xd->pre.y_buffer = ref_buffer[xd->mode_info_context->mbmi.ref_frame][0] + recon_yoffset;
- xd->pre.u_buffer = ref_buffer[xd->mode_info_context->mbmi.ref_frame][1] + recon_uvoffset;
- xd->pre.v_buffer = ref_buffer[xd->mode_info_context->mbmi.ref_frame][2] + recon_uvoffset;
-
- /* propagate errors from reference frames */
- xd->corrupted |= ref_fb_corrupted[xd->mode_info_context->mbmi.ref_frame];
-
- mt_decode_macroblock(pbi, xd, 0);
-
- xd->left_available = 1;
-
- /* check if the boolean decoder has suffered an error */
- xd->corrupted |= vp8dx_bool_error(xd->current_bc);
-
- xd->recon_above[0] += 16;
- xd->recon_above[1] += 8;
- xd->recon_above[2] += 8;
-
- if (!pbi->common.filter_level)
- {
- xd->recon_left[0] += 16;
- xd->recon_left[1] += 8;
- xd->recon_left[2] += 8;
- }
-
- if (pbi->common.filter_level)
- {
- int skip_lf = (xd->mode_info_context->mbmi.mode != B_PRED &&
- xd->mode_info_context->mbmi.mode != SPLITMV &&
- xd->mode_info_context->mbmi.mb_skip_coeff);
-
- const int mode_index = lfi_n->mode_lf_lut[xd->mode_info_context->mbmi.mode];
- const int seg = xd->mode_info_context->mbmi.segment_id;
- const int ref_frame = xd->mode_info_context->mbmi.ref_frame;
-
- filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
-
- if( mb_row != pc->mb_rows-1 )
- {
- /* Save decoded MB last row data for next-row decoding */
- vpx_memcpy((pbi->mt_yabove_row[mb_row + 1] + 32 + mb_col*16), (xd->dst.y_buffer + 15 * recon_y_stride), 16);
- vpx_memcpy((pbi->mt_uabove_row[mb_row + 1] + 16 + mb_col*8), (xd->dst.u_buffer + 7 * recon_uv_stride), 8);
- vpx_memcpy((pbi->mt_vabove_row[mb_row + 1] + 16 + mb_col*8), (xd->dst.v_buffer + 7 * recon_uv_stride), 8);
- }
-
- /* save left_col for next MB decoding */
- if(mb_col != pc->mb_cols-1)
- {
- MODE_INFO *next = xd->mode_info_context +1;
-
- if (next->mbmi.ref_frame == INTRA_FRAME)
- {
- for (i = 0; i < 16; i++)
- pbi->mt_yleft_col[mb_row][i] = xd->dst.y_buffer [i* recon_y_stride + 15];
- for (i = 0; i < 8; i++)
- {
- pbi->mt_uleft_col[mb_row][i] = xd->dst.u_buffer [i* recon_uv_stride + 7];
- pbi->mt_vleft_col[mb_row][i] = xd->dst.v_buffer [i* recon_uv_stride + 7];
- }
- }
- }
-
- /* loopfilter on this macroblock. */
- if (filter_level)
- {
- if(pc->filter_type == NORMAL_LOOPFILTER)
- {
- loop_filter_info lfi;
- FRAME_TYPE frame_type = pc->frame_type;
- const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
- lfi.mblim = lfi_n->mblim[filter_level];
- lfi.blim = lfi_n->blim[filter_level];
- lfi.lim = lfi_n->lim[filter_level];
- lfi.hev_thr = lfi_n->hev_thr[hev_index];
-
- if (mb_col > 0)
- vp8_loop_filter_mbv
- (xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bv
- (xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_mbh
- (xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi);
-
- if (!skip_lf)
- vp8_loop_filter_bh
- (xd->dst.y_buffer, xd->dst.u_buffer, xd->dst.v_buffer, recon_y_stride, recon_uv_stride, &lfi);
- }
- else
- {
- if (mb_col > 0)
- vp8_loop_filter_simple_mbv
- (xd->dst.y_buffer, recon_y_stride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bv
- (xd->dst.y_buffer, recon_y_stride, lfi_n->blim[filter_level]);
-
- /* don't apply across umv border */
- if (mb_row > 0)
- vp8_loop_filter_simple_mbh
- (xd->dst.y_buffer, recon_y_stride, lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp8_loop_filter_simple_bh
- (xd->dst.y_buffer, recon_y_stride, lfi_n->blim[filter_level]);
- }
- }
-
- }
-
- recon_yoffset += 16;
- recon_uvoffset += 8;
-
- ++xd->mode_info_context; /* next mb */
-
- xd->above_context++;
- }
-
- /* adjust to the next row of mbs */
- if (pbi->common.filter_level)
- {
- if(mb_row != pc->mb_rows-1)
- {
- int lasty = yv12_fb_lst->y_width + VP8BORDERINPIXELS;
- int lastuv = (yv12_fb_lst->y_width>>1) + (VP8BORDERINPIXELS>>1);
-
- for (i = 0; i < 4; i++)
- {
- pbi->mt_yabove_row[mb_row +1][lasty + i] = pbi->mt_yabove_row[mb_row +1][lasty -1];
- pbi->mt_uabove_row[mb_row +1][lastuv + i] = pbi->mt_uabove_row[mb_row +1][lastuv -1];
- pbi->mt_vabove_row[mb_row +1][lastuv + i] = pbi->mt_vabove_row[mb_row +1][lastuv -1];
- }
- }
- }
- else
- vp8_extend_mb_row(yv12_fb_new, xd->dst.y_buffer + 16,
- xd->dst.u_buffer + 8, xd->dst.v_buffer + 8);
-
- /* last MB of row is ready just after extension is done */
- *current_mb_col = mb_col + nsync;
-
- ++xd->mode_info_context; /* skip prediction column */
- xd->up_available = 1;
-
- /* since we have multithread */
- xd->mode_info_context += xd->mode_info_stride * pbi->decoding_thread_count;
- }
-
- /* signal end of frame decoding if this thread processed the last mb_row */
- if (last_mb_row == (pc->mb_rows - 1))
- sem_post(&pbi->h_event_end_decoding);
-
-}
-
-
-static THREAD_FUNCTION thread_decoding_proc(void *p_data)
-{
- int ithread = ((DECODETHREAD_DATA *)p_data)->ithread;
- VP8D_COMP *pbi = (VP8D_COMP *)(((DECODETHREAD_DATA *)p_data)->ptr1);
- MB_ROW_DEC *mbrd = (MB_ROW_DEC *)(((DECODETHREAD_DATA *)p_data)->ptr2);
- ENTROPY_CONTEXT_PLANES mb_row_left_context;
-
- while (1)
- {
- if (pbi->b_multithreaded_rd == 0)
- break;
-
- if (sem_wait(&pbi->h_event_start_decoding[ithread]) == 0)
- {
- if (pbi->b_multithreaded_rd == 0)
- break;
- else
- {
- MACROBLOCKD *xd = &mbrd->mbd;
- xd->left_context = &mb_row_left_context;
-
- mt_decode_mb_rows(pbi, xd, ithread+1);
- }
- }
- }
-
- return 0 ;
-}
-
-
-void vp8_decoder_create_threads(VP8D_COMP *pbi)
-{
- int core_count = 0;
- unsigned int ithread;
-
- pbi->b_multithreaded_rd = 0;
- pbi->allocated_decoding_thread_count = 0;
-
- /* limit decoding threads to the max number of token partitions */
- core_count = (pbi->max_threads > 8) ? 8 : pbi->max_threads;
-
- /* limit decoding threads to the available cores */
- if (core_count > pbi->common.processor_core_count)
- core_count = pbi->common.processor_core_count;
-
- if (core_count > 1)
- {
- pbi->b_multithreaded_rd = 1;
- pbi->decoding_thread_count = core_count - 1;
-
- CALLOC_ARRAY(pbi->h_decoding_thread, pbi->decoding_thread_count);
- CALLOC_ARRAY(pbi->h_event_start_decoding, pbi->decoding_thread_count);
- CALLOC_ARRAY_ALIGNED(pbi->mb_row_di, pbi->decoding_thread_count, 32);
- CALLOC_ARRAY(pbi->de_thread_data, pbi->decoding_thread_count);
-
- for (ithread = 0; ithread < pbi->decoding_thread_count; ithread++)
- {
- sem_init(&pbi->h_event_start_decoding[ithread], 0, 0);
-
- vp8_setup_block_dptrs(&pbi->mb_row_di[ithread].mbd);
-
- pbi->de_thread_data[ithread].ithread = ithread;
- pbi->de_thread_data[ithread].ptr1 = (void *)pbi;
- pbi->de_thread_data[ithread].ptr2 = (void *) &pbi->mb_row_di[ithread];
-
- pthread_create(&pbi->h_decoding_thread[ithread], 0, thread_decoding_proc, (&pbi->de_thread_data[ithread]));
- }
-
- sem_init(&pbi->h_event_end_decoding, 0, 0);
-
- pbi->allocated_decoding_thread_count = pbi->decoding_thread_count;
- }
-}
-
-
-void vp8mt_de_alloc_temp_buffers(VP8D_COMP *pbi, int mb_rows)
-{
- int i;
-
- if (pbi->b_multithreaded_rd)
- {
- vpx_free(pbi->mt_current_mb_col);
- pbi->mt_current_mb_col = NULL ;
-
- /* Free above_row buffers. */
- if (pbi->mt_yabove_row)
- {
- for (i=0; i< mb_rows; i++)
- {
- vpx_free(pbi->mt_yabove_row[i]);
- pbi->mt_yabove_row[i] = NULL ;
- }
- vpx_free(pbi->mt_yabove_row);
- pbi->mt_yabove_row = NULL ;
- }
-
- if (pbi->mt_uabove_row)
- {
- for (i=0; i< mb_rows; i++)
- {
- vpx_free(pbi->mt_uabove_row[i]);
- pbi->mt_uabove_row[i] = NULL ;
- }
- vpx_free(pbi->mt_uabove_row);
- pbi->mt_uabove_row = NULL ;
- }
-
- if (pbi->mt_vabove_row)
- {
- for (i=0; i< mb_rows; i++)
- {
- vpx_free(pbi->mt_vabove_row[i]);
- pbi->mt_vabove_row[i] = NULL ;
- }
- vpx_free(pbi->mt_vabove_row);
- pbi->mt_vabove_row = NULL ;
- }
-
- /* Free left_col buffers. */
- if (pbi->mt_yleft_col)
- {
- for (i=0; i< mb_rows; i++)
- {
- vpx_free(pbi->mt_yleft_col[i]);
- pbi->mt_yleft_col[i] = NULL ;
- }
- vpx_free(pbi->mt_yleft_col);
- pbi->mt_yleft_col = NULL ;
- }
-
- if (pbi->mt_uleft_col)
- {
- for (i=0; i< mb_rows; i++)
- {
- vpx_free(pbi->mt_uleft_col[i]);
- pbi->mt_uleft_col[i] = NULL ;
- }
- vpx_free(pbi->mt_uleft_col);
- pbi->mt_uleft_col = NULL ;
- }
-
- if (pbi->mt_vleft_col)
- {
- for (i=0; i< mb_rows; i++)
- {
- vpx_free(pbi->mt_vleft_col[i]);
- pbi->mt_vleft_col[i] = NULL ;
- }
- vpx_free(pbi->mt_vleft_col);
- pbi->mt_vleft_col = NULL ;
- }
- }
-}
-
-
-void vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows)
-{
- VP8_COMMON *const pc = & pbi->common;
- int i;
- int uv_width;
-
- if (pbi->b_multithreaded_rd)
- {
- vp8mt_de_alloc_temp_buffers(pbi, prev_mb_rows);
-
- /* our internal buffers are always multiples of 16 */
- if ((width & 0xf) != 0)
- width += 16 - (width & 0xf);
-
- if (width < 640) pbi->sync_range = 1;
- else if (width <= 1280) pbi->sync_range = 8;
- else if (width <= 2560) pbi->sync_range =16;
- else pbi->sync_range = 32;
-
- uv_width = width >>1;
-
- /* Allocate an int for each mb row. */
- CALLOC_ARRAY(pbi->mt_current_mb_col, pc->mb_rows);
-
- /* Allocate memory for above_row buffers. */
- CALLOC_ARRAY(pbi->mt_yabove_row, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; i++)
- CHECK_MEM_ERROR(pbi->mt_yabove_row[i], vpx_memalign(16,sizeof(unsigned char) * (width + (VP8BORDERINPIXELS<<1))));
-
- CALLOC_ARRAY(pbi->mt_uabove_row, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; i++)
- CHECK_MEM_ERROR(pbi->mt_uabove_row[i], vpx_memalign(16,sizeof(unsigned char) * (uv_width + VP8BORDERINPIXELS)));
-
- CALLOC_ARRAY(pbi->mt_vabove_row, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; i++)
- CHECK_MEM_ERROR(pbi->mt_vabove_row[i], vpx_memalign(16,sizeof(unsigned char) * (uv_width + VP8BORDERINPIXELS)));
-
- /* Allocate memory for left_col buffers. */
- CALLOC_ARRAY(pbi->mt_yleft_col, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; i++)
- CHECK_MEM_ERROR(pbi->mt_yleft_col[i], vpx_calloc(sizeof(unsigned char) * 16, 1));
-
- CALLOC_ARRAY(pbi->mt_uleft_col, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; i++)
- CHECK_MEM_ERROR(pbi->mt_uleft_col[i], vpx_calloc(sizeof(unsigned char) * 8, 1));
-
- CALLOC_ARRAY(pbi->mt_vleft_col, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; i++)
- CHECK_MEM_ERROR(pbi->mt_vleft_col[i], vpx_calloc(sizeof(unsigned char) * 8, 1));
- }
-}
-
-
-void vp8_decoder_remove_threads(VP8D_COMP *pbi)
-{
- /* shutdown MB Decoding thread; */
- if (pbi->b_multithreaded_rd)
- {
- int i;
-
- pbi->b_multithreaded_rd = 0;
-
- /* allow all threads to exit */
- for (i = 0; i < pbi->allocated_decoding_thread_count; i++)
- {
- sem_post(&pbi->h_event_start_decoding[i]);
- pthread_join(pbi->h_decoding_thread[i], NULL);
- }
-
- for (i = 0; i < pbi->allocated_decoding_thread_count; i++)
- {
- sem_destroy(&pbi->h_event_start_decoding[i]);
- }
-
- sem_destroy(&pbi->h_event_end_decoding);
-
- vpx_free(pbi->h_decoding_thread);
- pbi->h_decoding_thread = NULL;
-
- vpx_free(pbi->h_event_start_decoding);
- pbi->h_event_start_decoding = NULL;
-
- vpx_free(pbi->mb_row_di);
- pbi->mb_row_di = NULL ;
-
- vpx_free(pbi->de_thread_data);
- pbi->de_thread_data = NULL;
- }
-}
-
-void vp8mt_decode_mb_rows( VP8D_COMP *pbi, MACROBLOCKD *xd)
-{
- VP8_COMMON *pc = &pbi->common;
- unsigned int i;
- int j;
-
- int filter_level = pc->filter_level;
- YV12_BUFFER_CONFIG *yv12_fb_new = pbi->dec_fb_ref[INTRA_FRAME];
-
- if (filter_level)
- {
- /* Set above_row buffer to 127 for decoding first MB row */
- vpx_memset(pbi->mt_yabove_row[0] + VP8BORDERINPIXELS-1, 127, yv12_fb_new->y_width + 5);
- vpx_memset(pbi->mt_uabove_row[0] + (VP8BORDERINPIXELS>>1)-1, 127, (yv12_fb_new->y_width>>1) +5);
- vpx_memset(pbi->mt_vabove_row[0] + (VP8BORDERINPIXELS>>1)-1, 127, (yv12_fb_new->y_width>>1) +5);
-
- for (j=1; j<pc->mb_rows; j++)
- {
- vpx_memset(pbi->mt_yabove_row[j] + VP8BORDERINPIXELS-1, (unsigned char)129, 1);
- vpx_memset(pbi->mt_uabove_row[j] + (VP8BORDERINPIXELS>>1)-1, (unsigned char)129, 1);
- vpx_memset(pbi->mt_vabove_row[j] + (VP8BORDERINPIXELS>>1)-1, (unsigned char)129, 1);
- }
-
- /* Set left_col to 129 initially */
- for (j=0; j<pc->mb_rows; j++)
- {
- vpx_memset(pbi->mt_yleft_col[j], (unsigned char)129, 16);
- vpx_memset(pbi->mt_uleft_col[j], (unsigned char)129, 8);
- vpx_memset(pbi->mt_vleft_col[j], (unsigned char)129, 8);
- }
-
- /* Initialize the loop filter for this frame. */
- vp8_loop_filter_frame_init(pc, &pbi->mb, filter_level);
- }
- else
- vp8_setup_intra_recon_top_line(yv12_fb_new);
-
- setup_decoding_thread_data(pbi, xd, pbi->mb_row_di, pbi->decoding_thread_count);
-
- for (i = 0; i < pbi->decoding_thread_count; i++)
- sem_post(&pbi->h_event_start_decoding[i]);
-
- mt_decode_mb_rows(pbi, xd, 0);
-
- sem_wait(&pbi->h_event_end_decoding); /* add back for each frame */
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/decoder/treereader.h b/videocodec/libvpx_internal/libvpx/vp8/decoder/treereader.h
deleted file mode 100644
index 35ee696..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/decoder/treereader.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_DECODER_TREEREADER_H_
-#define VP8_DECODER_TREEREADER_H_
-
-#include "vp8/common/treecoder.h"
-#include "dboolhuff.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef BOOL_DECODER vp8_reader;
-
-#define vp8_read vp8dx_decode_bool
-#define vp8_read_literal vp8_decode_value
-#define vp8_read_bit(R) vp8_read(R, vp8_prob_half)
-
-
-/* Intent of tree data structure is to make decoding trivial. */
-
-static int vp8_treed_read(
- vp8_reader *const r, /* !!! must return a 0 or 1 !!! */
- vp8_tree t,
- const vp8_prob *const p
-)
-{
- register vp8_tree_index i = 0;
-
- while ((i = t[ i + vp8_read(r, p[i>>1])]) > 0) ;
-
- return -i;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_DECODER_TREEREADER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm
deleted file mode 100644
index 4abe818..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/boolhuff_armv5te.asm
+++ /dev/null
@@ -1,310 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_start_encode|
- EXPORT |vp8_encode_bool|
- EXPORT |vp8_stop_encode|
- EXPORT |vp8_encode_value|
- IMPORT |vp8_validate_buffer_arm|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY
-
- ; macro for validating write buffer position
- ; needs vp8_writer in r0
- ; start shall not be in r1
- MACRO
- VALIDATE_POS $start, $pos
- push {r0-r3, r12, lr} ; rest of regs are preserved by subroutine call
- ldr r2, [r0, #vp8_writer_buffer_end]
- ldr r3, [r0, #vp8_writer_error]
- mov r1, $pos
- mov r0, $start
- bl vp8_validate_buffer_arm
- pop {r0-r3, r12, lr}
- MEND
-
-; r0 BOOL_CODER *br
-; r1 unsigned char *source
-; r2 unsigned char *source_end
-|vp8_start_encode| PROC
- str r2, [r0, #vp8_writer_buffer_end]
- mov r12, #0
- mov r3, #255
- mvn r2, #23
- str r12, [r0, #vp8_writer_lowvalue]
- str r3, [r0, #vp8_writer_range]
- str r2, [r0, #vp8_writer_count]
- str r12, [r0, #vp8_writer_pos]
- str r1, [r0, #vp8_writer_buffer]
- bx lr
- ENDP
-
-; r0 BOOL_CODER *br
-; r1 int bit
-; r2 int probability
-|vp8_encode_bool| PROC
- push {r4-r10, lr}
-
- mov r4, r2
-
- ldr r2, [r0, #vp8_writer_lowvalue]
- ldr r5, [r0, #vp8_writer_range]
- ldr r3, [r0, #vp8_writer_count]
-
- sub r7, r5, #1 ; range-1
-
- cmp r1, #0
- mul r6, r4, r7 ; ((range-1) * probability)
-
- mov r7, #1
- add r4, r7, r6, lsr #8 ; 1 + (((range-1) * probability) >> 8)
-
- addne r2, r2, r4 ; if (bit) lowvalue += split
- subne r4, r5, r4 ; if (bit) range = range-split
-
- ; Counting the leading zeros is used to normalize range.
- clz r6, r4
- sub r6, r6, #24 ; shift
-
- ; Flag is set on the sum of count. This flag is used later
- ; to determine if count >= 0
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi token_count_lt_zero ; if(count >= 0)
-
- sub r6, r6, r3 ; offset = shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl token_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos-1
- b token_zero_while_start
-token_zero_while_loop
- mov r9, #0
- strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-token_zero_while_start
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r1, [r7, r4]
- cmpge r1, #0xff
- beq token_zero_while_loop
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r9, [r7, r4] ; w->buffer[x]
- add r9, r9, #1
- strb r9, [r7, r4] ; w->buffer[x] + 1
-token_high_bit_not_set
- rsb r4, r6, #24 ; 24-offset
- ldr r9, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r1, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r1, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r9, r1 ; validate_buffer at pos
-
- strb r7, [r9, r4] ; w->buffer[w->pos++]
-
-token_count_lt_zero
- lsl r2, r2, r6 ; lowvalue <<= shift
-
- str r2, [r0, #vp8_writer_lowvalue]
- str r5, [r0, #vp8_writer_range]
- str r3, [r0, #vp8_writer_count]
- pop {r4-r10, pc}
- ENDP
-
-; r0 BOOL_CODER *br
-|vp8_stop_encode| PROC
- push {r4-r10, lr}
-
- ldr r2, [r0, #vp8_writer_lowvalue]
- ldr r5, [r0, #vp8_writer_range]
- ldr r3, [r0, #vp8_writer_count]
-
- mov r10, #32
-
-stop_encode_loop
- sub r7, r5, #1 ; range-1
-
- mov r4, r7, lsl #7 ; ((range-1) * 128)
-
- mov r7, #1
- add r4, r7, r4, lsr #8 ; 1 + (((range-1) * 128) >> 8)
-
- ; Counting the leading zeros is used to normalize range.
- clz r6, r4
- sub r6, r6, #24 ; shift
-
- ; Flag is set on the sum of count. This flag is used later
- ; to determine if count >= 0
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi token_count_lt_zero_se ; if(count >= 0)
-
- sub r6, r6, r3 ; offset = shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl token_high_bit_not_set_se
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos-1
- b token_zero_while_start_se
-token_zero_while_loop_se
- mov r9, #0
- strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-token_zero_while_start_se
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r1, [r7, r4]
- cmpge r1, #0xff
- beq token_zero_while_loop_se
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r9, [r7, r4] ; w->buffer[x]
- add r9, r9, #1
- strb r9, [r7, r4] ; w->buffer[x] + 1
-token_high_bit_not_set_se
- rsb r4, r6, #24 ; 24-offset
- ldr r9, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r1, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r1, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r9, r1 ; validate_buffer at pos
-
- strb r7, [r9, r4] ; w->buffer[w->pos++]
-
-token_count_lt_zero_se
- lsl r2, r2, r6 ; lowvalue <<= shift
-
- subs r10, r10, #1
- bne stop_encode_loop
-
- str r2, [r0, #vp8_writer_lowvalue]
- str r5, [r0, #vp8_writer_range]
- str r3, [r0, #vp8_writer_count]
- pop {r4-r10, pc}
-
- ENDP
-
-; r0 BOOL_CODER *br
-; r1 int data
-; r2 int bits
-|vp8_encode_value| PROC
- push {r4-r12, lr}
-
- mov r10, r2
-
- ldr r2, [r0, #vp8_writer_lowvalue]
- ldr r5, [r0, #vp8_writer_range]
- ldr r3, [r0, #vp8_writer_count]
-
- rsb r4, r10, #32 ; 32-n
-
- ; v is kept in r1 during the token pack loop
- lsl r1, r1, r4 ; r1 = v << 32 - n
-
-encode_value_loop
- sub r7, r5, #1 ; range-1
-
- ; Decisions are made based on the bit value shifted
- ; off of v, so set a flag here based on this.
- ; This value is refered to as "bb"
- lsls r1, r1, #1 ; bit = v >> n
- mov r4, r7, lsl #7 ; ((range-1) * 128)
-
- mov r7, #1
- add r4, r7, r4, lsr #8 ; 1 + (((range-1) * 128) >> 8)
-
- addcs r2, r2, r4 ; if (bit) lowvalue += split
- subcs r4, r5, r4 ; if (bit) range = range-split
-
- ; Counting the leading zeros is used to normalize range.
- clz r6, r4
- sub r6, r6, #24 ; shift
-
- ; Flag is set on the sum of count. This flag is used later
- ; to determine if count >= 0
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi token_count_lt_zero_ev ; if(count >= 0)
-
- sub r6, r6, r3 ; offset = shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl token_high_bit_not_set_ev
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos-1
- b token_zero_while_start_ev
-token_zero_while_loop_ev
- mov r9, #0
- strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-token_zero_while_start_ev
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq token_zero_while_loop_ev
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r9, [r7, r4] ; w->buffer[x]
- add r9, r9, #1
- strb r9, [r7, r4] ; w->buffer[x] + 1
-token_high_bit_not_set_ev
- rsb r4, r6, #24 ; 24-offset
- ldr r9, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r9, r11 ; validate_buffer at pos
-
- strb r7, [r9, r4] ; w->buffer[w->pos++]
-
-token_count_lt_zero_ev
- lsl r2, r2, r6 ; lowvalue <<= shift
-
- subs r10, r10, #1
- bne encode_value_loop
-
- str r2, [r0, #vp8_writer_lowvalue]
- str r5, [r0, #vp8_writer_range]
- str r3, [r0, #vp8_writer_count]
- pop {r4-r12, pc}
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm
deleted file mode 100644
index 90a141c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_armv5.asm
+++ /dev/null
@@ -1,317 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8cx_pack_tokens_armv5|
- IMPORT |vp8_validate_buffer_arm|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY
-
-
- ; macro for validating write buffer position
- ; needs vp8_writer in r0
- ; start shall not be in r1
- MACRO
- VALIDATE_POS $start, $pos
- push {r0-r3, r12, lr} ; rest of regs are preserved by subroutine call
- ldr r2, [r0, #vp8_writer_buffer_end]
- ldr r3, [r0, #vp8_writer_error]
- mov r1, $pos
- mov r0, $start
- bl vp8_validate_buffer_arm
- pop {r0-r3, r12, lr}
- MEND
-
-
-; r0 vp8_writer *w
-; r1 const TOKENEXTRA *p
-; r2 int xcount
-; r3 vp8_coef_encodings
-; s0 vp8_extra_bits
-; s1 vp8_coef_tree
-|vp8cx_pack_tokens_armv5| PROC
- push {r4-r12, lr}
- sub sp, sp, #16
-
- ; Add size of xcount * sizeof (TOKENEXTRA) to get stop
- ; sizeof (TOKENEXTRA) is 8
- add r2, r1, r2, lsl #3 ; stop = p + xcount*sizeof(TOKENEXTRA)
- str r2, [sp, #0]
- str r3, [sp, #8] ; save vp8_coef_encodings
- ldr r2, [r0, #vp8_writer_lowvalue]
- ldr r5, [r0, #vp8_writer_range]
- ldr r3, [r0, #vp8_writer_count]
- b check_p_lt_stop
-
-while_p_lt_stop
- ldrb r6, [r1, #tokenextra_token] ; t
- ldr r4, [sp, #8] ; vp8_coef_encodings
- mov lr, #0
- add r4, r4, r6, lsl #3 ; a = vp8_coef_encodings + t
- ldr r9, [r1, #tokenextra_context_tree] ; pp
-
- ldrb r7, [r1, #tokenextra_skip_eob_node]
-
- ldr r6, [r4, #vp8_token_value] ; v
- ldr r8, [r4, #vp8_token_len] ; n
-
- ; vp8 specific skip_eob_node
- cmp r7, #0
- movne lr, #2 ; i = 2
- subne r8, r8, #1 ; --n
-
- rsb r4, r8, #32 ; 32-n
- ldr r10, [sp, #60] ; vp8_coef_tree
-
- ; v is kept in r12 during the token pack loop
- lsl r12, r6, r4 ; r12 = v << 32 - n
-
-; loop start
-token_loop
- ldrb r4, [r9, lr, asr #1] ; pp [i>>1]
- sub r7, r5, #1 ; range-1
-
- ; Decisions are made based on the bit value shifted
- ; off of v, so set a flag here based on this.
- ; This value is refered to as "bb"
- lsls r12, r12, #1 ; bb = v >> n
- mul r6, r4, r7 ; ((range-1) * pp[i>>1]))
-
- ; bb can only be 0 or 1. So only execute this statement
- ; if bb == 1, otherwise it will act like i + 0
- addcs lr, lr, #1 ; i + bb
-
- mov r7, #1
- ldrsb lr, [r10, lr] ; i = vp8_coef_tree[i+bb]
- add r4, r7, r6, lsr #8 ; 1 + (((range-1) * pp[i>>1]) >> 8)
-
- addcs r2, r2, r4 ; if (bb) lowvalue += split
- subcs r4, r5, r4 ; if (bb) range = range-split
-
- ; Counting the leading zeros is used to normalize range.
- clz r6, r4
- sub r6, r6, #24 ; shift
-
- ; Flag is set on the sum of count. This flag is used later
- ; to determine if count >= 0
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi token_count_lt_zero ; if(count >= 0)
-
- sub r6, r6, r3 ; offset = shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl token_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos-1
- b token_zero_while_start
-token_zero_while_loop
- mov r10, #0
- strb r10, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-token_zero_while_start
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq token_zero_while_loop
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r10, [r7, r4] ; w->buffer[x]
- add r10, r10, #1
- strb r10, [r7, r4] ; w->buffer[x] + 1
-token_high_bit_not_set
- rsb r4, r6, #24 ; 24-offset
- ldr r10, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r10, r11 ; validate_buffer at pos
-
- strb r7, [r10, r4] ; w->buffer[w->pos++]
-
- ; r10 is used earlier in the loop, but r10 is used as
- ; temp variable here. So after r10 is used, reload
- ; vp8_coef_tree_dcd into r10
- ldr r10, [sp, #60] ; vp8_coef_tree
-
-token_count_lt_zero
- lsl r2, r2, r6 ; lowvalue <<= shift
-
- subs r8, r8, #1 ; --n
- bne token_loop
-
- ldrb r6, [r1, #tokenextra_token] ; t
- ldr r7, [sp, #56] ; vp8_extra_bits
- ; Add t * sizeof (vp8_extra_bit_struct) to get the desired
- ; element. Here vp8_extra_bit_struct == 16
- add r12, r7, r6, lsl #4 ; b = vp8_extra_bits + t
-
- ldr r4, [r12, #vp8_extra_bit_struct_base_val]
- cmp r4, #0
- beq skip_extra_bits
-
-; if( b->base_val)
- ldr r8, [r12, #vp8_extra_bit_struct_len] ; L
- ldrsh lr, [r1, #tokenextra_extra] ; e = p->Extra
- cmp r8, #0 ; if( L)
- beq no_extra_bits
-
- ldr r9, [r12, #vp8_extra_bit_struct_prob]
- asr r7, lr, #1 ; v=e>>1
-
- ldr r10, [r12, #vp8_extra_bit_struct_tree]
- str r10, [sp, #4] ; b->tree
-
- rsb r4, r8, #32
- lsl r12, r7, r4
-
- mov lr, #0 ; i = 0
-
-extra_bits_loop
- ldrb r4, [r9, lr, asr #1] ; pp[i>>1]
- sub r7, r5, #1 ; range-1
- lsls r12, r12, #1 ; v >> n
- mul r6, r4, r7 ; (range-1) * pp[i>>1]
- addcs lr, lr, #1 ; i + bb
-
- mov r7, #1
- ldrsb lr, [r10, lr] ; i = b->tree[i+bb]
- add r4, r7, r6, lsr #8 ; split = 1 + (((range-1) * pp[i>>1]) >> 8)
-
- addcs r2, r2, r4 ; if (bb) lowvalue += split
- subcs r4, r5, r4 ; if (bb) range = range-split
-
- clz r6, r4
- sub r6, r6, #24
-
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi extra_count_lt_zero ; if(count >= 0)
-
- sub r6, r6, r3 ; offset= shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl extra_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos - 1
- b extra_zero_while_start
-extra_zero_while_loop
- mov r10, #0
- strb r10, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-extra_zero_while_start
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq extra_zero_while_loop
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r10, [r7, r4]
- add r10, r10, #1
- strb r10, [r7, r4]
-extra_high_bit_not_set
- rsb r4, r6, #24 ; 24-offset
- ldr r10, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos]
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r10, r11 ; validate_buffer at pos
-
- strb r7, [r10, r4] ; w->buffer[w->pos++]=(lowvalue >> (24-offset))
- ldr r10, [sp, #4] ; b->tree
-extra_count_lt_zero
- lsl r2, r2, r6
-
- subs r8, r8, #1 ; --n
- bne extra_bits_loop ; while (n)
-
-no_extra_bits
- ldr lr, [r1, #4] ; e = p->Extra
- add r4, r5, #1 ; range + 1
- tst lr, #1
- lsr r4, r4, #1 ; split = (range + 1) >> 1
- addne r2, r2, r4 ; lowvalue += split
- subne r4, r5, r4 ; range = range-split
- tst r2, #0x80000000 ; lowvalue & 0x80000000
- lsl r5, r4, #1 ; range <<= 1
- beq end_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos]
- mov r7, #0
- sub r4, r4, #1
- b end_zero_while_start
-end_zero_while_loop
- strb r7, [r6, r4]
- sub r4, r4, #1 ; x--
-end_zero_while_start
- cmp r4, #0
- ldrge r6, [r0, #vp8_writer_buffer]
- ldrb r12, [r6, r4]
- cmpge r12, #0xff
- beq end_zero_while_loop
-
- ldr r6, [r0, #vp8_writer_buffer]
- ldrb r7, [r6, r4]
- add r7, r7, #1
- strb r7, [r6, r4]
-end_high_bit_not_set
- adds r3, r3, #1 ; ++count
- lsl r2, r2, #1 ; lowvalue <<= 1
- bne end_count_zero
-
- ldr r4, [r0, #vp8_writer_pos]
- mvn r3, #7
- ldr r7, [r0, #vp8_writer_buffer]
- lsr r6, r2, #24 ; lowvalue >> 24
- add r12, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r12, [r0, #vp8_writer_pos]
-
- VALIDATE_POS r7, r12 ; validate_buffer at pos
-
- strb r6, [r7, r4]
-end_count_zero
-skip_extra_bits
- add r1, r1, #TOKENEXTRA_SZ ; ++p
-check_p_lt_stop
- ldr r4, [sp, #0] ; stop
- cmp r1, r4 ; while( p < stop)
- bcc while_p_lt_stop
-
- str r2, [r0, #vp8_writer_lowvalue]
- str r5, [r0, #vp8_writer_range]
- str r3, [r0, #vp8_writer_count]
- add sp, sp, #16
- pop {r4-r12, pc}
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm
deleted file mode 100644
index 3a8d17a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_mbrow_armv5.asm
+++ /dev/null
@@ -1,352 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8cx_pack_mb_row_tokens_armv5|
- IMPORT |vp8_validate_buffer_arm|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY
-
-
- ; macro for validating write buffer position
- ; needs vp8_writer in r0
- ; start shall not be in r1
- MACRO
- VALIDATE_POS $start, $pos
- push {r0-r3, r12, lr} ; rest of regs are preserved by subroutine call
- ldr r2, [r0, #vp8_writer_buffer_end]
- ldr r3, [r0, #vp8_writer_error]
- mov r1, $pos
- mov r0, $start
- bl vp8_validate_buffer_arm
- pop {r0-r3, r12, lr}
- MEND
-
-; r0 VP8_COMP *cpi
-; r1 vp8_writer *w
-; r2 vp8_coef_encodings
-; r3 vp8_extra_bits
-; s0 vp8_coef_tree
-
-|vp8cx_pack_mb_row_tokens_armv5| PROC
- push {r4-r12, lr}
- sub sp, sp, #24
-
- ; Compute address of cpi->common.mb_rows
- ldr r4, _VP8_COMP_common_
- ldr r6, _VP8_COMMON_MBrows_
- add r4, r0, r4
-
- ldr r5, [r4, r6] ; load up mb_rows
-
- str r2, [sp, #20] ; save vp8_coef_encodings
- str r5, [sp, #12] ; save mb_rows
- str r3, [sp, #8] ; save vp8_extra_bits
-
- ldr r4, _VP8_COMP_tplist_
- add r4, r0, r4
- ldr r7, [r4, #0] ; dereference cpi->tp_list
-
- mov r0, r1 ; keep same as other loops
-
- ldr r2, [r0, #vp8_writer_lowvalue]
- ldr r5, [r0, #vp8_writer_range]
- ldr r3, [r0, #vp8_writer_count]
-
-mb_row_loop
-
- ldr r1, [r7, #tokenlist_start]
- ldr r9, [r7, #tokenlist_stop]
- str r9, [sp, #0] ; save stop for later comparison
- str r7, [sp, #16] ; tokenlist address for next time
-
- b check_p_lt_stop
-
- ; actuall work gets done here!
-
-while_p_lt_stop
- ldrb r6, [r1, #tokenextra_token] ; t
- ldr r4, [sp, #20] ; vp8_coef_encodings
- mov lr, #0
- add r4, r4, r6, lsl #3 ; a = vp8_coef_encodings + t
- ldr r9, [r1, #tokenextra_context_tree] ; pp
-
- ldrb r7, [r1, #tokenextra_skip_eob_node]
-
- ldr r6, [r4, #vp8_token_value] ; v
- ldr r8, [r4, #vp8_token_len] ; n
-
- ; vp8 specific skip_eob_node
- cmp r7, #0
- movne lr, #2 ; i = 2
- subne r8, r8, #1 ; --n
-
- rsb r4, r8, #32 ; 32-n
- ldr r10, [sp, #64] ; vp8_coef_tree
-
- ; v is kept in r12 during the token pack loop
- lsl r12, r6, r4 ; r12 = v << 32 - n
-
-; loop start
-token_loop
- ldrb r4, [r9, lr, asr #1] ; pp [i>>1]
- sub r7, r5, #1 ; range-1
-
- ; Decisions are made based on the bit value shifted
- ; off of v, so set a flag here based on this.
- ; This value is refered to as "bb"
- lsls r12, r12, #1 ; bb = v >> n
- mul r6, r4, r7 ; ((range-1) * pp[i>>1]))
-
- ; bb can only be 0 or 1. So only execute this statement
- ; if bb == 1, otherwise it will act like i + 0
- addcs lr, lr, #1 ; i + bb
-
- mov r7, #1
- ldrsb lr, [r10, lr] ; i = vp8_coef_tree[i+bb]
- add r4, r7, r6, lsr #8 ; 1 + (((range-1) * pp[i>>1]) >> 8)
-
- addcs r2, r2, r4 ; if (bb) lowvalue += split
- subcs r4, r5, r4 ; if (bb) range = range-split
-
- ; Counting the leading zeros is used to normalize range.
- clz r6, r4
- sub r6, r6, #24 ; shift
-
- ; Flag is set on the sum of count. This flag is used later
- ; to determine if count >= 0
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi token_count_lt_zero ; if(count >= 0)
-
- sub r6, r6, r3 ; offset = shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl token_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos-1
- b token_zero_while_start
-token_zero_while_loop
- mov r10, #0
- strb r10, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-token_zero_while_start
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq token_zero_while_loop
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r10, [r7, r4] ; w->buffer[x]
- add r10, r10, #1
- strb r10, [r7, r4] ; w->buffer[x] + 1
-token_high_bit_not_set
- rsb r4, r6, #24 ; 24-offset
- ldr r10, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r10, r11 ; validate_buffer at pos
-
- strb r7, [r10, r4] ; w->buffer[w->pos++]
-
- ; r10 is used earlier in the loop, but r10 is used as
- ; temp variable here. So after r10 is used, reload
- ; vp8_coef_tree_dcd into r10
- ldr r10, [sp, #64] ; vp8_coef_tree
-
-token_count_lt_zero
- lsl r2, r2, r6 ; lowvalue <<= shift
-
- subs r8, r8, #1 ; --n
- bne token_loop
-
- ldrb r6, [r1, #tokenextra_token] ; t
- ldr r7, [sp, #8] ; vp8_extra_bits
- ; Add t * sizeof (vp8_extra_bit_struct) to get the desired
- ; element. Here vp8_extra_bit_struct == 16
- add r12, r7, r6, lsl #4 ; b = vp8_extra_bits + t
-
- ldr r4, [r12, #vp8_extra_bit_struct_base_val]
- cmp r4, #0
- beq skip_extra_bits
-
-; if( b->base_val)
- ldr r8, [r12, #vp8_extra_bit_struct_len] ; L
- ldrsh lr, [r1, #tokenextra_extra] ; e = p->Extra
- cmp r8, #0 ; if( L)
- beq no_extra_bits
-
- ldr r9, [r12, #vp8_extra_bit_struct_prob]
- asr r7, lr, #1 ; v=e>>1
-
- ldr r10, [r12, #vp8_extra_bit_struct_tree]
- str r10, [sp, #4] ; b->tree
-
- rsb r4, r8, #32
- lsl r12, r7, r4
-
- mov lr, #0 ; i = 0
-
-extra_bits_loop
- ldrb r4, [r9, lr, asr #1] ; pp[i>>1]
- sub r7, r5, #1 ; range-1
- lsls r12, r12, #1 ; v >> n
- mul r6, r4, r7 ; (range-1) * pp[i>>1]
- addcs lr, lr, #1 ; i + bb
-
- mov r7, #1
- ldrsb lr, [r10, lr] ; i = b->tree[i+bb]
- add r4, r7, r6, lsr #8 ; split = 1 + (((range-1) * pp[i>>1]) >> 8)
-
- addcs r2, r2, r4 ; if (bb) lowvalue += split
- subcs r4, r5, r4 ; if (bb) range = range-split
-
- clz r6, r4
- sub r6, r6, #24
-
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi extra_count_lt_zero ; if(count >= 0)
-
- sub r6, r6, r3 ; offset= shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl extra_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos - 1
- b extra_zero_while_start
-extra_zero_while_loop
- mov r10, #0
- strb r10, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-extra_zero_while_start
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq extra_zero_while_loop
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r10, [r7, r4]
- add r10, r10, #1
- strb r10, [r7, r4]
-extra_high_bit_not_set
- rsb r4, r6, #24 ; 24-offset
- ldr r10, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos]
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r10, r11 ; validate_buffer at pos
-
- strb r7, [r10, r4] ; w->buffer[w->pos++]=(lowvalue >> (24-offset))
- ldr r10, [sp, #4] ; b->tree
-extra_count_lt_zero
- lsl r2, r2, r6
-
- subs r8, r8, #1 ; --n
- bne extra_bits_loop ; while (n)
-
-no_extra_bits
- ldr lr, [r1, #4] ; e = p->Extra
- add r4, r5, #1 ; range + 1
- tst lr, #1
- lsr r4, r4, #1 ; split = (range + 1) >> 1
- addne r2, r2, r4 ; lowvalue += split
- subne r4, r5, r4 ; range = range-split
- tst r2, #0x80000000 ; lowvalue & 0x80000000
- lsl r5, r4, #1 ; range <<= 1
- beq end_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos]
- mov r7, #0
- sub r4, r4, #1
- b end_zero_while_start
-end_zero_while_loop
- strb r7, [r6, r4]
- sub r4, r4, #1 ; x--
-end_zero_while_start
- cmp r4, #0
- ldrge r6, [r0, #vp8_writer_buffer]
- ldrb r12, [r6, r4]
- cmpge r12, #0xff
- beq end_zero_while_loop
-
- ldr r6, [r0, #vp8_writer_buffer]
- ldrb r7, [r6, r4]
- add r7, r7, #1
- strb r7, [r6, r4]
-end_high_bit_not_set
- adds r3, r3, #1 ; ++count
- lsl r2, r2, #1 ; lowvalue <<= 1
- bne end_count_zero
-
- ldr r4, [r0, #vp8_writer_pos]
- mvn r3, #7
- ldr r7, [r0, #vp8_writer_buffer]
- lsr r6, r2, #24 ; lowvalue >> 24
- add r12, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r12, [r0, #vp8_writer_pos]
-
- VALIDATE_POS r7, r12 ; validate_buffer at pos
-
- strb r6, [r7, r4]
-end_count_zero
-skip_extra_bits
- add r1, r1, #TOKENEXTRA_SZ ; ++p
-check_p_lt_stop
- ldr r4, [sp, #0] ; stop
- cmp r1, r4 ; while( p < stop)
- bcc while_p_lt_stop
-
- ldr r6, [sp, #12] ; mb_rows
- ldr r7, [sp, #16] ; tokenlist address
- subs r6, r6, #1
- add r7, r7, #TOKENLIST_SZ ; next element in the array
- str r6, [sp, #12]
- bne mb_row_loop
-
- str r2, [r0, #vp8_writer_lowvalue]
- str r5, [r0, #vp8_writer_range]
- str r3, [r0, #vp8_writer_count]
- add sp, sp, #24
- pop {r4-r12, pc}
- ENDP
-
-_VP8_COMP_common_
- DCD vp8_comp_common
-_VP8_COMMON_MBrows_
- DCD vp8_common_mb_rows
-_VP8_COMP_tplist_
- DCD vp8_comp_tplist
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
deleted file mode 100644
index e9aa495..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv5te/vp8_packtokens_partitions_armv5.asm
+++ /dev/null
@@ -1,471 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8cx_pack_tokens_into_partitions_armv5|
- IMPORT |vp8_validate_buffer_arm|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY
-
- ; macro for validating write buffer position
- ; needs vp8_writer in r0
- ; start shall not be in r1
- MACRO
- VALIDATE_POS $start, $pos
- push {r0-r3, r12, lr} ; rest of regs are preserved by subroutine call
- ldr r2, [r0, #vp8_writer_buffer_end]
- ldr r3, [r0, #vp8_writer_error]
- mov r1, $pos
- mov r0, $start
- bl vp8_validate_buffer_arm
- pop {r0-r3, r12, lr}
- MEND
-
-; r0 VP8_COMP *cpi
-; r1 unsigned char *cx_data
-; r2 const unsigned char *cx_data_end
-; r3 int num_part
-; s0 vp8_coef_encodings
-; s1 vp8_extra_bits,
-; s2 const vp8_tree_index *
-
-|vp8cx_pack_tokens_into_partitions_armv5| PROC
- push {r4-r12, lr}
- sub sp, sp, #40
-
- ; Compute address of cpi->common.mb_rows
- ldr r4, _VP8_COMP_common_
- ldr r6, _VP8_COMMON_MBrows_
- add r4, r0, r4
-
- ldr r5, [r4, r6] ; load up mb_rows
-
- str r5, [sp, #36] ; save mb_rows
- str r1, [sp, #24] ; save ptr = cx_data
- str r3, [sp, #20] ; save num_part
- str r2, [sp, #8] ; save cx_data_end
-
- ldr r4, _VP8_COMP_tplist_
- add r4, r0, r4
- ldr r7, [r4, #0] ; dereference cpi->tp_list
- str r7, [sp, #32] ; store start of cpi->tp_list
-
- ldr r11, _VP8_COMP_bc_ ; load up vp8_writer out of cpi
- add r0, r0, r11
-
- mov r11, #0
- str r11, [sp, #28] ; i
-
-numparts_loop
- ldr r2, _vp8_writer_sz_ ; load up sizeof(vp8_writer)
- add r0, r2 ; bc[i + 1]
-
- ldr r10, [sp, #24] ; ptr
- ldr r5, [sp, #36] ; move mb_rows to the counting section
- subs r5, r5, r11 ; move start point with each partition
- ; mb_rows starts at i
- str r5, [sp, #12]
-
- ; Reset all of the VP8 Writer data for each partition that
- ; is processed.
- ; start_encode
-
- ldr r3, [sp, #8]
- str r3, [r0, #vp8_writer_buffer_end]
-
- mov r2, #0 ; vp8_writer_lowvalue
- mov r5, #255 ; vp8_writer_range
- mvn r3, #23 ; vp8_writer_count
-
- str r2, [r0, #vp8_writer_pos]
- str r10, [r0, #vp8_writer_buffer]
-
- ble end_partition ; if (mb_rows <= 0) end partition
-
-mb_row_loop
-
- ldr r1, [r7, #tokenlist_start]
- ldr r9, [r7, #tokenlist_stop]
- str r9, [sp, #0] ; save stop for later comparison
- str r7, [sp, #16] ; tokenlist address for next time
-
- b check_p_lt_stop
-
- ; actual work gets done here!
-
-while_p_lt_stop
- ldrb r6, [r1, #tokenextra_token] ; t
- ldr r4, [sp, #80] ; vp8_coef_encodings
- mov lr, #0
- add r4, r4, r6, lsl #3 ; a = vp8_coef_encodings + t
- ldr r9, [r1, #tokenextra_context_tree] ; pp
-
- ldrb r7, [r1, #tokenextra_skip_eob_node]
-
- ldr r6, [r4, #vp8_token_value] ; v
- ldr r8, [r4, #vp8_token_len] ; n
-
- ; vp8 specific skip_eob_node
- cmp r7, #0
- movne lr, #2 ; i = 2
- subne r8, r8, #1 ; --n
-
- rsb r4, r8, #32 ; 32-n
- ldr r10, [sp, #88] ; vp8_coef_tree
-
- ; v is kept in r12 during the token pack loop
- lsl r12, r6, r4 ; r12 = v << 32 - n
-
-; loop start
-token_loop
- ldrb r4, [r9, lr, asr #1] ; pp [i>>1]
- sub r7, r5, #1 ; range-1
-
- ; Decisions are made based on the bit value shifted
- ; off of v, so set a flag here based on this.
- ; This value is refered to as "bb"
- lsls r12, r12, #1 ; bb = v >> n
- mul r6, r4, r7 ; ((range-1) * pp[i>>1]))
-
- ; bb can only be 0 or 1. So only execute this statement
- ; if bb == 1, otherwise it will act like i + 0
- addcs lr, lr, #1 ; i + bb
-
- mov r7, #1
- ldrsb lr, [r10, lr] ; i = vp8_coef_tree[i+bb]
- add r4, r7, r6, lsr #8 ; 1 + (((range-1) * pp[i>>1]) >> 8)
-
- addcs r2, r2, r4 ; if (bb) lowvalue += split
- subcs r4, r5, r4 ; if (bb) range = range-split
-
- ; Counting the leading zeros is used to normalize range.
- clz r6, r4
- sub r6, r6, #24 ; shift
-
- ; Flag is set on the sum of count. This flag is used later
- ; to determine if count >= 0
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi token_count_lt_zero ; if(count >= 0)
-
- sub r6, r6, r3 ; offset = shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl token_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos-1
- b token_zero_while_start
-token_zero_while_loop
- mov r10, #0
- strb r10, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-token_zero_while_start
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq token_zero_while_loop
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r10, [r7, r4] ; w->buffer[x]
- add r10, r10, #1
- strb r10, [r7, r4] ; w->buffer[x] + 1
-token_high_bit_not_set
- rsb r4, r6, #24 ; 24-offset
- ldr r10, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r10, r11 ; validate_buffer at pos
-
- strb r7, [r10, r4] ; w->buffer[w->pos++]
-
- ; r10 is used earlier in the loop, but r10 is used as
- ; temp variable here. So after r10 is used, reload
- ; vp8_coef_tree_dcd into r10
- ldr r10, [sp, #88] ; vp8_coef_tree
-
-token_count_lt_zero
- lsl r2, r2, r6 ; lowvalue <<= shift
-
- subs r8, r8, #1 ; --n
- bne token_loop
-
- ldrb r6, [r1, #tokenextra_token] ; t
- ldr r7, [sp, #84] ; vp8_extra_bits
- ; Add t * sizeof (vp8_extra_bit_struct) to get the desired
- ; element. Here vp8_extra_bit_struct == 16
- add r12, r7, r6, lsl #4 ; b = vp8_extra_bits + t
-
- ldr r4, [r12, #vp8_extra_bit_struct_base_val]
- cmp r4, #0
- beq skip_extra_bits
-
-; if( b->base_val)
- ldr r8, [r12, #vp8_extra_bit_struct_len] ; L
- ldrsh lr, [r1, #tokenextra_extra] ; e = p->Extra
- cmp r8, #0 ; if( L)
- beq no_extra_bits
-
- ldr r9, [r12, #vp8_extra_bit_struct_prob]
- asr r7, lr, #1 ; v=e>>1
-
- ldr r10, [r12, #vp8_extra_bit_struct_tree]
- str r10, [sp, #4] ; b->tree
-
- rsb r4, r8, #32
- lsl r12, r7, r4
-
- mov lr, #0 ; i = 0
-
-extra_bits_loop
- ldrb r4, [r9, lr, asr #1] ; pp[i>>1]
- sub r7, r5, #1 ; range-1
- lsls r12, r12, #1 ; v >> n
- mul r6, r4, r7 ; (range-1) * pp[i>>1]
- addcs lr, lr, #1 ; i + bb
-
- mov r7, #1
- ldrsb lr, [r10, lr] ; i = b->tree[i+bb]
- add r4, r7, r6, lsr #8 ; split = 1 + (((range-1) * pp[i>>1]) >> 8)
-
- addcs r2, r2, r4 ; if (bb) lowvalue += split
- subcs r4, r5, r4 ; if (bb) range = range-split
-
- clz r6, r4
- sub r6, r6, #24
-
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi extra_count_lt_zero ; if(count >= 0)
-
- sub r6, r6, r3 ; offset= shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl extra_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos - 1
- b extra_zero_while_start
-extra_zero_while_loop
- mov r10, #0
- strb r10, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-extra_zero_while_start
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq extra_zero_while_loop
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r10, [r7, r4]
- add r10, r10, #1
- strb r10, [r7, r4]
-extra_high_bit_not_set
- rsb r4, r6, #24 ; 24-offset
- ldr r10, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos]
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r10, r11 ; validate_buffer at pos
-
- strb r7, [r10, r4] ; w->buffer[w->pos++]=(lowvalue >> (24-offset))
- ldr r10, [sp, #4] ; b->tree
-extra_count_lt_zero
- lsl r2, r2, r6
-
- subs r8, r8, #1 ; --n
- bne extra_bits_loop ; while (n)
-
-no_extra_bits
- ldr lr, [r1, #4] ; e = p->Extra
- add r4, r5, #1 ; range + 1
- tst lr, #1
- lsr r4, r4, #1 ; split = (range + 1) >> 1
- addne r2, r2, r4 ; lowvalue += split
- subne r4, r5, r4 ; range = range-split
- tst r2, #0x80000000 ; lowvalue & 0x80000000
- lsl r5, r4, #1 ; range <<= 1
- beq end_high_bit_not_set
-
- ldr r4, [r0, #vp8_writer_pos]
- mov r7, #0
- sub r4, r4, #1
- b end_zero_while_start
-end_zero_while_loop
- strb r7, [r6, r4]
- sub r4, r4, #1 ; x--
-end_zero_while_start
- cmp r4, #0
- ldrge r6, [r0, #vp8_writer_buffer]
- ldrb r12, [r6, r4]
- cmpge r12, #0xff
- beq end_zero_while_loop
-
- ldr r6, [r0, #vp8_writer_buffer]
- ldrb r7, [r6, r4]
- add r7, r7, #1
- strb r7, [r6, r4]
-end_high_bit_not_set
- adds r3, r3, #1 ; ++count
- lsl r2, r2, #1 ; lowvalue <<= 1
- bne end_count_zero
-
- ldr r4, [r0, #vp8_writer_pos]
- mvn r3, #7 ; count = -8
- ldr r7, [r0, #vp8_writer_buffer]
- lsr r6, r2, #24 ; lowvalue >> 24
- add r12, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r12, [r0, #vp8_writer_pos]
-
- VALIDATE_POS r7, r12 ; validate_buffer at pos
-
- strb r6, [r7, r4]
-end_count_zero
-skip_extra_bits
- add r1, r1, #TOKENEXTRA_SZ ; ++p
-check_p_lt_stop
- ldr r4, [sp, #0] ; stop
- cmp r1, r4 ; while( p < stop)
- bcc while_p_lt_stop
-
- ldr r10, [sp, #20] ; num_parts
- mov r1, #TOKENLIST_SZ
- mul r1, r10, r1
-
- ldr r6, [sp, #12] ; mb_rows
- ldr r7, [sp, #16] ; tokenlist address
- subs r6, r6, r10
- add r7, r7, r1 ; next element in the array
- str r6, [sp, #12]
- bgt mb_row_loop
-
-end_partition
- mov r12, #32
-
-stop_encode_loop
- sub r7, r5, #1 ; range-1
-
- mov r4, r7, lsl #7 ; ((range-1) * 128)
-
- mov r7, #1
- add r4, r7, r4, lsr #8 ; 1 + (((range-1) * 128) >> 8)
-
- ; Counting the leading zeros is used to normalize range.
- clz r6, r4
- sub r6, r6, #24 ; shift
-
- ; Flag is set on the sum of count. This flag is used later
- ; to determine if count >= 0
- adds r3, r3, r6 ; count += shift
- lsl r5, r4, r6 ; range <<= shift
- bmi token_count_lt_zero_se ; if(count >= 0)
-
- sub r6, r6, r3 ; offset = shift - count
- sub r4, r6, #1 ; offset-1
- lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
- bpl token_high_bit_not_set_se
-
- ldr r4, [r0, #vp8_writer_pos] ; x
- sub r4, r4, #1 ; x = w->pos-1
- b token_zero_while_start_se
-token_zero_while_loop_se
- mov r10, #0
- strb r10, [r7, r4] ; w->buffer[x] =(unsigned char)0
- sub r4, r4, #1 ; x--
-token_zero_while_start_se
- cmp r4, #0
- ldrge r7, [r0, #vp8_writer_buffer]
- ldrb r11, [r7, r4]
- cmpge r11, #0xff
- beq token_zero_while_loop_se
-
- ldr r7, [r0, #vp8_writer_buffer]
- ldrb r10, [r7, r4] ; w->buffer[x]
- add r10, r10, #1
- strb r10, [r7, r4] ; w->buffer[x] + 1
-token_high_bit_not_set_se
- rsb r4, r6, #24 ; 24-offset
- ldr r10, [r0, #vp8_writer_buffer]
- lsr r7, r2, r4 ; lowvalue >> (24-offset)
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- lsl r2, r2, r6 ; lowvalue <<= offset
- mov r6, r3 ; shift = count
- add r11, r4, #1 ; w->pos++
- bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
- str r11, [r0, #vp8_writer_pos]
- sub r3, r3, #8 ; count -= 8
-
- VALIDATE_POS r10, r11 ; validate_buffer at pos
-
- strb r7, [r10, r4] ; w->buffer[w->pos++]
-
-token_count_lt_zero_se
- lsl r2, r2, r6 ; lowvalue <<= shift
-
- subs r12, r12, #1
- bne stop_encode_loop
-
- ldr r4, [r0, #vp8_writer_pos] ; w->pos
- ldr r12, [sp, #24] ; ptr
- add r12, r12, r4 ; ptr += w->pos
- str r12, [sp, #24]
-
- ldr r11, [sp, #28] ; i
- ldr r10, [sp, #20] ; num_parts
-
- add r11, r11, #1 ; i++
- str r11, [sp, #28]
-
- ldr r7, [sp, #32] ; cpi->tp_list[i]
- mov r1, #TOKENLIST_SZ
- add r7, r7, r1 ; next element in cpi->tp_list
- str r7, [sp, #32] ; cpi->tp_list[i+1]
-
- cmp r10, r11
- bgt numparts_loop
-
- add sp, sp, #40
- pop {r4-r12, pc}
- ENDP
-
-_VP8_COMP_common_
- DCD vp8_comp_common
-_VP8_COMMON_MBrows_
- DCD vp8_common_mb_rows
-_VP8_COMP_tplist_
- DCD vp8_comp_tplist
-_VP8_COMP_bc_
- DCD vp8_comp_bc
-_vp8_writer_sz_
- DCD vp8_writer_sz
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm
deleted file mode 100644
index de35a1e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_fast_quantize_b_armv6.asm
+++ /dev/null
@@ -1,225 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_fast_quantize_b_armv6|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 BLOCK *b
-; r1 BLOCKD *d
-|vp8_fast_quantize_b_armv6| PROC
- stmfd sp!, {r1, r4-r11, lr}
-
- ldr r3, [r0, #vp8_block_coeff] ; coeff
- ldr r4, [r0, #vp8_block_quant_fast] ; quant_fast
- ldr r5, [r0, #vp8_block_round] ; round
- ldr r6, [r1, #vp8_blockd_qcoeff] ; qcoeff
- ldr r7, [r1, #vp8_blockd_dqcoeff] ; dqcoeff
- ldr r8, [r1, #vp8_blockd_dequant] ; dequant
-
- ldr r2, loop_count ; loop_count=0x1000000. 'lsls' instruction
- ; is used to update the counter so that
- ; it can be used to mark nonzero
- ; quantized coefficient pairs.
-
- mov r1, #0 ; flags for quantized coeffs
-
- ; PART 1: quantization and dequantization loop
-loop
- ldr r9, [r3], #4 ; [z1 | z0]
- ldr r10, [r5], #4 ; [r1 | r0]
- ldr r11, [r4], #4 ; [q1 | q0]
-
- ssat16 lr, #1, r9 ; [sz1 | sz0]
- eor r9, r9, lr ; [z1 ^ sz1 | z0 ^ sz0]
- ssub16 r9, r9, lr ; x = (z ^ sz) - sz
- sadd16 r9, r9, r10 ; [x1+r1 | x0+r0]
-
- ldr r12, [r3], #4 ; [z3 | z2]
-
- smulbb r0, r9, r11 ; [(x0+r0)*q0]
- smultt r9, r9, r11 ; [(x1+r1)*q1]
-
- ldr r10, [r5], #4 ; [r3 | r2]
-
- ssat16 r11, #1, r12 ; [sz3 | sz2]
- eor r12, r12, r11 ; [z3 ^ sz3 | z2 ^ sz2]
- pkhtb r0, r9, r0, asr #16 ; [y1 | y0]
- ldr r9, [r4], #4 ; [q3 | q2]
- ssub16 r12, r12, r11 ; x = (z ^ sz) - sz
-
- sadd16 r12, r12, r10 ; [x3+r3 | x2+r2]
-
- eor r0, r0, lr ; [(y1 ^ sz1) | (y0 ^ sz0)]
-
- smulbb r10, r12, r9 ; [(x2+r2)*q2]
- smultt r12, r12, r9 ; [(x3+r3)*q3]
-
- ssub16 r0, r0, lr ; x = (y ^ sz) - sz
-
- cmp r0, #0 ; check if zero
- orrne r1, r1, r2, lsr #24 ; add flag for nonzero coeffs
-
- str r0, [r6], #4 ; *qcoeff++ = x
- ldr r9, [r8], #4 ; [dq1 | dq0]
-
- pkhtb r10, r12, r10, asr #16 ; [y3 | y2]
- eor r10, r10, r11 ; [(y3 ^ sz3) | (y2 ^ sz2)]
- ssub16 r10, r10, r11 ; x = (y ^ sz) - sz
-
- cmp r10, #0 ; check if zero
- orrne r1, r1, r2, lsr #23 ; add flag for nonzero coeffs
-
- str r10, [r6], #4 ; *qcoeff++ = x
- ldr r11, [r8], #4 ; [dq3 | dq2]
-
- smulbb r12, r0, r9 ; [x0*dq0]
- smultt r0, r0, r9 ; [x1*dq1]
-
- smulbb r9, r10, r11 ; [x2*dq2]
- smultt r10, r10, r11 ; [x3*dq3]
-
- lsls r2, r2, #2 ; update loop counter
- strh r12, [r7, #0] ; dqcoeff[0] = [x0*dq0]
- strh r0, [r7, #2] ; dqcoeff[1] = [x1*dq1]
- strh r9, [r7, #4] ; dqcoeff[2] = [x2*dq2]
- strh r10, [r7, #6] ; dqcoeff[3] = [x3*dq3]
- add r7, r7, #8 ; dqcoeff += 8
- bne loop
-
- ; PART 2: check position for eob...
- ldr r11, [sp, #0] ; restore BLOCKD pointer
- mov lr, #0 ; init eob
- cmp r1, #0 ; coeffs after quantization?
- ldr r12, [r11, #vp8_blockd_eob]
- beq end ; skip eob calculations if all zero
-
- ldr r0, [r11, #vp8_blockd_qcoeff]
-
- ; check shortcut for nonzero qcoeffs
- tst r1, #0x80
- bne quant_coeff_15_14
- tst r1, #0x20
- bne quant_coeff_13_11
- tst r1, #0x8
- bne quant_coeff_12_7
- tst r1, #0x40
- bne quant_coeff_10_9
- tst r1, #0x10
- bne quant_coeff_8_3
- tst r1, #0x2
- bne quant_coeff_6_5
- tst r1, #0x4
- bne quant_coeff_4_2
- b quant_coeff_1_0
-
-quant_coeff_15_14
- ldrh r2, [r0, #30] ; rc=15, i=15
- mov lr, #16
- cmp r2, #0
- bne end
-
- ldrh r3, [r0, #28] ; rc=14, i=14
- mov lr, #15
- cmp r3, #0
- bne end
-
-quant_coeff_13_11
- ldrh r2, [r0, #22] ; rc=11, i=13
- mov lr, #14
- cmp r2, #0
- bne end
-
-quant_coeff_12_7
- ldrh r3, [r0, #14] ; rc=7, i=12
- mov lr, #13
- cmp r3, #0
- bne end
-
- ldrh r2, [r0, #20] ; rc=10, i=11
- mov lr, #12
- cmp r2, #0
- bne end
-
-quant_coeff_10_9
- ldrh r3, [r0, #26] ; rc=13, i=10
- mov lr, #11
- cmp r3, #0
- bne end
-
- ldrh r2, [r0, #24] ; rc=12, i=9
- mov lr, #10
- cmp r2, #0
- bne end
-
-quant_coeff_8_3
- ldrh r3, [r0, #18] ; rc=9, i=8
- mov lr, #9
- cmp r3, #0
- bne end
-
- ldrh r2, [r0, #12] ; rc=6, i=7
- mov lr, #8
- cmp r2, #0
- bne end
-
-quant_coeff_6_5
- ldrh r3, [r0, #6] ; rc=3, i=6
- mov lr, #7
- cmp r3, #0
- bne end
-
- ldrh r2, [r0, #4] ; rc=2, i=5
- mov lr, #6
- cmp r2, #0
- bne end
-
-quant_coeff_4_2
- ldrh r3, [r0, #10] ; rc=5, i=4
- mov lr, #5
- cmp r3, #0
- bne end
-
- ldrh r2, [r0, #16] ; rc=8, i=3
- mov lr, #4
- cmp r2, #0
- bne end
-
- ldrh r3, [r0, #8] ; rc=4, i=2
- mov lr, #3
- cmp r3, #0
- bne end
-
-quant_coeff_1_0
- ldrh r2, [r0, #2] ; rc=1, i=1
- mov lr, #2
- cmp r2, #0
- bne end
-
- mov lr, #1 ; rc=0, i=0
-
-end
- strb lr, [r12]
- ldmfd sp!, {r1, r4-r11, pc}
-
- ENDP
-
-loop_count
- DCD 0x1000000
-
- END
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
deleted file mode 100644
index 000805d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_mse16x16_armv6.asm
+++ /dev/null
@@ -1,138 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_mse16x16_armv6|
-
- ARM
-
- 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
-;
-;note: Based on vp8_variance16x16_armv6. In this function, sum is never used.
-; So, we can remove this part of calculation.
-
-|vp8_mse16x16_armv6| 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
-
-loop
- ; 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 loop
-
- ; 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/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm
deleted file mode 100644
index 8034c1d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_short_fdct4x4_armv6.asm
+++ /dev/null
@@ -1,262 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp8_short_fdct4x4_armv6|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY
-; void vp8_short_fdct4x4_c(short *input, short *output, int pitch)
-|vp8_short_fdct4x4_armv6| PROC
-
- stmfd sp!, {r4 - r12, lr}
-
- ; PART 1
-
- ; coeffs 0-3
- ldrd r4, r5, [r0] ; [i1 | i0] [i3 | i2]
-
- ldr r10, c7500
- ldr r11, c14500
- ldr r12, c0x22a453a0 ; [2217*4 | 5352*4]
- ldr lr, c0x00080008
- ror r5, r5, #16 ; [i2 | i3]
-
- qadd16 r6, r4, r5 ; [i1+i2 | i0+i3] = [b1 | a1] without shift
- qsub16 r7, r4, r5 ; [i1-i2 | i0-i3] = [c1 | d1] without shift
-
- add r0, r0, r2 ; update input pointer
-
- qadd16 r7, r7, r7 ; 2*[c1|d1] --> we can use smlad and smlsd
- ; with 2217*4 and 5352*4 without losing the
- ; sign bit (overflow)
-
- smuad r4, r6, lr ; o0 = (i1+i2)*8 + (i0+i3)*8
- smusd r5, r6, lr ; o2 = (i1+i2)*8 - (i0+i3)*8
-
- smlad r6, r7, r12, r11 ; o1 = (c1 * 2217 + d1 * 5352 + 14500)
- smlsdx r7, r7, r12, r10 ; o3 = (d1 * 2217 - c1 * 5352 + 7500)
-
- ldrd r8, r9, [r0] ; [i5 | i4] [i7 | i6]
-
- pkhbt r3, r4, r6, lsl #4 ; [o1 | o0], keep in register for PART 2
- pkhbt r6, r5, r7, lsl #4 ; [o3 | o2]
-
- str r6, [r1, #4]
-
- ; coeffs 4-7
- ror r9, r9, #16 ; [i6 | i7]
-
- qadd16 r6, r8, r9 ; [i5+i6 | i4+i7] = [b1 | a1] without shift
- qsub16 r7, r8, r9 ; [i5-i6 | i4-i7] = [c1 | d1] without shift
-
- add r0, r0, r2 ; update input pointer
-
- qadd16 r7, r7, r7 ; 2x[c1|d1] --> we can use smlad and smlsd
- ; with 2217*4 and 5352*4 without losing the
- ; sign bit (overflow)
-
- smuad r9, r6, lr ; o4 = (i5+i6)*8 + (i4+i7)*8
- smusd r8, r6, lr ; o6 = (i5+i6)*8 - (i4+i7)*8
-
- smlad r6, r7, r12, r11 ; o5 = (c1 * 2217 + d1 * 5352 + 14500)
- smlsdx r7, r7, r12, r10 ; o7 = (d1 * 2217 - c1 * 5352 + 7500)
-
- ldrd r4, r5, [r0] ; [i9 | i8] [i11 | i10]
-
- pkhbt r9, r9, r6, lsl #4 ; [o5 | o4], keep in register for PART 2
- pkhbt r6, r8, r7, lsl #4 ; [o7 | o6]
-
- str r6, [r1, #12]
-
- ; coeffs 8-11
- ror r5, r5, #16 ; [i10 | i11]
-
- qadd16 r6, r4, r5 ; [i9+i10 | i8+i11]=[b1 | a1] without shift
- qsub16 r7, r4, r5 ; [i9-i10 | i8-i11]=[c1 | d1] without shift
-
- add r0, r0, r2 ; update input pointer
-
- qadd16 r7, r7, r7 ; 2x[c1|d1] --> we can use smlad and smlsd
- ; with 2217*4 and 5352*4 without losing the
- ; sign bit (overflow)
-
- smuad r2, r6, lr ; o8 = (i9+i10)*8 + (i8+i11)*8
- smusd r8, r6, lr ; o10 = (i9+i10)*8 - (i8+i11)*8
-
- smlad r6, r7, r12, r11 ; o9 = (c1 * 2217 + d1 * 5352 + 14500)
- smlsdx r7, r7, r12, r10 ; o11 = (d1 * 2217 - c1 * 5352 + 7500)
-
- ldrd r4, r5, [r0] ; [i13 | i12] [i15 | i14]
-
- pkhbt r2, r2, r6, lsl #4 ; [o9 | o8], keep in register for PART 2
- pkhbt r6, r8, r7, lsl #4 ; [o11 | o10]
-
- str r6, [r1, #20]
-
- ; coeffs 12-15
- ror r5, r5, #16 ; [i14 | i15]
-
- qadd16 r6, r4, r5 ; [i13+i14 | i12+i15]=[b1|a1] without shift
- qsub16 r7, r4, r5 ; [i13-i14 | i12-i15]=[c1|d1] without shift
-
- qadd16 r7, r7, r7 ; 2x[c1|d1] --> we can use smlad and smlsd
- ; with 2217*4 and 5352*4 without losing the
- ; sign bit (overflow)
-
- smuad r4, r6, lr ; o12 = (i13+i14)*8 + (i12+i15)*8
- smusd r5, r6, lr ; o14 = (i13+i14)*8 - (i12+i15)*8
-
- smlad r6, r7, r12, r11 ; o13 = (c1 * 2217 + d1 * 5352 + 14500)
- smlsdx r7, r7, r12, r10 ; o15 = (d1 * 2217 - c1 * 5352 + 7500)
-
- pkhbt r0, r4, r6, lsl #4 ; [o13 | o12], keep in register for PART 2
- pkhbt r6, r5, r7, lsl #4 ; [o15 | o14]
-
- str r6, [r1, #28]
-
-
- ; PART 2 -------------------------------------------------
- ldr r11, c12000
- ldr r10, c51000
- ldr lr, c0x00070007
-
- qadd16 r4, r3, r0 ; a1 = [i1+i13 | i0+i12]
- qadd16 r5, r9, r2 ; b1 = [i5+i9 | i4+i8]
- qsub16 r6, r9, r2 ; c1 = [i5-i9 | i4-i8]
- qsub16 r7, r3, r0 ; d1 = [i1-i13 | i0-i12]
-
- qadd16 r4, r4, lr ; a1 + 7
-
- add r0, r11, #0x10000 ; add (d!=0)
-
- qadd16 r2, r4, r5 ; a1 + b1 + 7
- qsub16 r3, r4, r5 ; a1 - b1 + 7
-
- ldr r12, c0x08a914e8 ; [2217 | 5352]
-
- lsl r8, r2, #16 ; prepare bottom halfword for scaling
- asr r2, r2, #4 ; scale top halfword
- lsl r9, r3, #16 ; prepare bottom halfword for scaling
- asr r3, r3, #4 ; scale top halfword
- pkhtb r4, r2, r8, asr #20 ; pack and scale bottom halfword
- pkhtb r5, r3, r9, asr #20 ; pack and scale bottom halfword
-
- smulbt r2, r6, r12 ; [ ------ | c1*2217]
- str r4, [r1, #0] ; [ o1 | o0]
- smultt r3, r6, r12 ; [c1*2217 | ------ ]
- str r5, [r1, #16] ; [ o9 | o8]
-
- smlabb r8, r7, r12, r2 ; [ ------ | d1*5352]
- smlatb r9, r7, r12, r3 ; [d1*5352 | ------ ]
-
- smulbb r2, r6, r12 ; [ ------ | c1*5352]
- smultb r3, r6, r12 ; [c1*5352 | ------ ]
-
- lsls r6, r7, #16 ; d1 != 0 ?
- addeq r8, r8, r11 ; c1_b*2217+d1_b*5352+12000 + (d==0)
- addne r8, r8, r0 ; c1_b*2217+d1_b*5352+12000 + (d!=0)
- asrs r6, r7, #16
- addeq r9, r9, r11 ; c1_t*2217+d1_t*5352+12000 + (d==0)
- addne r9, r9, r0 ; c1_t*2217+d1_t*5352+12000 + (d!=0)
-
- smlabt r4, r7, r12, r10 ; [ ------ | d1*2217] + 51000
- smlatt r5, r7, r12, r10 ; [d1*2217 | ------ ] + 51000
-
- pkhtb r9, r9, r8, asr #16
-
- sub r4, r4, r2
- sub r5, r5, r3
-
- ldr r3, [r1, #4] ; [i3 | i2]
-
- pkhtb r5, r5, r4, asr #16 ; [o13|o12]
-
- str r9, [r1, #8] ; [o5 | 04]
-
- ldr r9, [r1, #12] ; [i7 | i6]
- ldr r8, [r1, #28] ; [i15|i14]
- ldr r2, [r1, #20] ; [i11|i10]
- str r5, [r1, #24] ; [o13|o12]
-
- qadd16 r4, r3, r8 ; a1 = [i3+i15 | i2+i14]
- qadd16 r5, r9, r2 ; b1 = [i7+i11 | i6+i10]
-
- qadd16 r4, r4, lr ; a1 + 7
-
- qsub16 r6, r9, r2 ; c1 = [i7-i11 | i6-i10]
- qadd16 r2, r4, r5 ; a1 + b1 + 7
- qsub16 r7, r3, r8 ; d1 = [i3-i15 | i2-i14]
- qsub16 r3, r4, r5 ; a1 - b1 + 7
-
- lsl r8, r2, #16 ; prepare bottom halfword for scaling
- asr r2, r2, #4 ; scale top halfword
- lsl r9, r3, #16 ; prepare bottom halfword for scaling
- asr r3, r3, #4 ; scale top halfword
- pkhtb r4, r2, r8, asr #20 ; pack and scale bottom halfword
- pkhtb r5, r3, r9, asr #20 ; pack and scale bottom halfword
-
- smulbt r2, r6, r12 ; [ ------ | c1*2217]
- str r4, [r1, #4] ; [ o3 | o2]
- smultt r3, r6, r12 ; [c1*2217 | ------ ]
- str r5, [r1, #20] ; [ o11 | o10]
-
- smlabb r8, r7, r12, r2 ; [ ------ | d1*5352]
- smlatb r9, r7, r12, r3 ; [d1*5352 | ------ ]
-
- smulbb r2, r6, r12 ; [ ------ | c1*5352]
- smultb r3, r6, r12 ; [c1*5352 | ------ ]
-
- lsls r6, r7, #16 ; d1 != 0 ?
- addeq r8, r8, r11 ; c1_b*2217+d1_b*5352+12000 + (d==0)
- addne r8, r8, r0 ; c1_b*2217+d1_b*5352+12000 + (d!=0)
-
- asrs r6, r7, #16
- addeq r9, r9, r11 ; c1_t*2217+d1_t*5352+12000 + (d==0)
- addne r9, r9, r0 ; c1_t*2217+d1_t*5352+12000 + (d!=0)
-
- smlabt r4, r7, r12, r10 ; [ ------ | d1*2217] + 51000
- smlatt r5, r7, r12, r10 ; [d1*2217 | ------ ] + 51000
-
- pkhtb r9, r9, r8, asr #16
-
- sub r4, r4, r2
- sub r5, r5, r3
-
- str r9, [r1, #12] ; [o7 | o6]
- pkhtb r5, r5, r4, asr #16 ; [o15|o14]
-
- str r5, [r1, #28] ; [o15|o14]
-
- ldmfd sp!, {r4 - r12, pc}
-
- ENDP
-
-; Used constants
-c7500
- DCD 7500
-c14500
- DCD 14500
-c0x22a453a0
- DCD 0x22a453a0
-c0x00080008
- DCD 0x00080008
-c12000
- DCD 12000
-c51000
- DCD 51000
-c0x00070007
- DCD 0x00070007
-c0x08a914e8
- DCD 0x08a914e8
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_subtract_armv6.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_subtract_armv6.asm
deleted file mode 100644
index 05746cf..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/vp8_subtract_armv6.asm
+++ /dev/null
@@ -1,272 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_subtract_mby_armv6|
- EXPORT |vp8_subtract_mbuv_armv6|
- EXPORT |vp8_subtract_b_armv6|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; r0 BLOCK *be
-; r1 BLOCKD *bd
-; r2 int pitch
-|vp8_subtract_b_armv6| PROC
-
- stmfd sp!, {r4-r9}
-
- ldr r4, [r0, #vp8_block_base_src]
- ldr r5, [r0, #vp8_block_src]
- ldr r6, [r0, #vp8_block_src_diff]
-
- ldr r3, [r4]
- ldr r7, [r0, #vp8_block_src_stride]
- add r3, r3, r5 ; src = *base_src + src
- ldr r8, [r1, #vp8_blockd_predictor]
-
- mov r9, #4 ; loop count
-
-loop_block
-
- ldr r0, [r3], r7 ; src
- ldr r1, [r8], r2 ; pred
-
- uxtb16 r4, r0 ; [s2 | s0]
- uxtb16 r5, r1 ; [p2 | p0]
- uxtb16 r0, r0, ror #8 ; [s3 | s1]
- uxtb16 r1, r1, ror #8 ; [p3 | p1]
-
- usub16 r4, r4, r5 ; [d2 | d0]
- usub16 r5, r0, r1 ; [d3 | d1]
-
- subs r9, r9, #1 ; decrement loop counter
-
- pkhbt r0, r4, r5, lsl #16 ; [d1 | d0]
- pkhtb r1, r5, r4, asr #16 ; [d3 | d2]
-
- str r0, [r6, #0] ; diff
- str r1, [r6, #4] ; diff
-
- add r6, r6, r2, lsl #1 ; update diff pointer
- bne loop_block
-
- ldmfd sp!, {r4-r9}
- mov pc, lr
-
- ENDP
-
-
-; r0 short *diff
-; r1 unsigned char *usrc
-; r2 unsigned char *vsrc
-; r3 int src_stride
-; sp unsigned char *upred
-; sp unsigned char *vpred
-; sp int pred_stride
-|vp8_subtract_mbuv_armv6| PROC
-
- stmfd sp!, {r4-r11}
-
- add r0, r0, #512 ; set *diff point to Cb
- mov r4, #8 ; loop count
- ldr r5, [sp, #32] ; upred
- ldr r12, [sp, #40] ; pred_stride
-
- ; Subtract U block
-loop_u
- ldr r6, [r1] ; usrc (A)
- ldr r7, [r5] ; upred (A)
-
- uxtb16 r8, r6 ; [s2 | s0] (A)
- uxtb16 r9, r7 ; [p2 | p0] (A)
- uxtb16 r10, r6, ror #8 ; [s3 | s1] (A)
- uxtb16 r11, r7, ror #8 ; [p3 | p1] (A)
-
- usub16 r6, r8, r9 ; [d2 | d0] (A)
- usub16 r7, r10, r11 ; [d3 | d1] (A)
-
- ldr r10, [r1, #4] ; usrc (B)
- ldr r11, [r5, #4] ; upred (B)
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (A)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (A)
-
- str r8, [r0], #4 ; diff (A)
- uxtb16 r8, r10 ; [s2 | s0] (B)
- str r9, [r0], #4 ; diff (A)
-
- uxtb16 r9, r11 ; [p2 | p0] (B)
- uxtb16 r10, r10, ror #8 ; [s3 | s1] (B)
- uxtb16 r11, r11, ror #8 ; [p3 | p1] (B)
-
- usub16 r6, r8, r9 ; [d2 | d0] (B)
- usub16 r7, r10, r11 ; [d3 | d1] (B)
-
- add r1, r1, r3 ; update usrc pointer
- add r5, r5, r12 ; update upred pointer
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (B)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (B)
-
- str r8, [r0], #4 ; diff (B)
- subs r4, r4, #1 ; update loop counter
- str r9, [r0], #4 ; diff (B)
-
- bne loop_u
-
- ldr r5, [sp, #36] ; vpred
- mov r4, #8 ; loop count
-
- ; Subtract V block
-loop_v
- ldr r6, [r2] ; vsrc (A)
- ldr r7, [r5] ; vpred (A)
-
- uxtb16 r8, r6 ; [s2 | s0] (A)
- uxtb16 r9, r7 ; [p2 | p0] (A)
- uxtb16 r10, r6, ror #8 ; [s3 | s1] (A)
- uxtb16 r11, r7, ror #8 ; [p3 | p1] (A)
-
- usub16 r6, r8, r9 ; [d2 | d0] (A)
- usub16 r7, r10, r11 ; [d3 | d1] (A)
-
- ldr r10, [r2, #4] ; vsrc (B)
- ldr r11, [r5, #4] ; vpred (B)
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (A)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (A)
-
- str r8, [r0], #4 ; diff (A)
- uxtb16 r8, r10 ; [s2 | s0] (B)
- str r9, [r0], #4 ; diff (A)
-
- uxtb16 r9, r11 ; [p2 | p0] (B)
- uxtb16 r10, r10, ror #8 ; [s3 | s1] (B)
- uxtb16 r11, r11, ror #8 ; [p3 | p1] (B)
-
- usub16 r6, r8, r9 ; [d2 | d0] (B)
- usub16 r7, r10, r11 ; [d3 | d1] (B)
-
- add r2, r2, r3 ; update vsrc pointer
- add r5, r5, r12 ; update vpred pointer
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (B)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (B)
-
- str r8, [r0], #4 ; diff (B)
- subs r4, r4, #1 ; update loop counter
- str r9, [r0], #4 ; diff (B)
-
- bne loop_v
-
- ldmfd sp!, {r4-r11}
- bx lr
-
- ENDP
-
-
-; r0 short *diff
-; r1 unsigned char *src
-; r2 int src_stride
-; r3 unsigned char *pred
-; sp int pred_stride
-|vp8_subtract_mby_armv6| PROC
-
- stmfd sp!, {r4-r11}
- ldr r12, [sp, #32] ; pred_stride
- mov r4, #16
-loop
- ldr r6, [r1] ; src (A)
- ldr r7, [r3] ; pred (A)
-
- uxtb16 r8, r6 ; [s2 | s0] (A)
- uxtb16 r9, r7 ; [p2 | p0] (A)
- uxtb16 r10, r6, ror #8 ; [s3 | s1] (A)
- uxtb16 r11, r7, ror #8 ; [p3 | p1] (A)
-
- usub16 r6, r8, r9 ; [d2 | d0] (A)
- usub16 r7, r10, r11 ; [d3 | d1] (A)
-
- ldr r10, [r1, #4] ; src (B)
- ldr r11, [r3, #4] ; pred (B)
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (A)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (A)
-
- str r8, [r0], #4 ; diff (A)
- uxtb16 r8, r10 ; [s2 | s0] (B)
- str r9, [r0], #4 ; diff (A)
-
- uxtb16 r9, r11 ; [p2 | p0] (B)
- uxtb16 r10, r10, ror #8 ; [s3 | s1] (B)
- uxtb16 r11, r11, ror #8 ; [p3 | p1] (B)
-
- usub16 r6, r8, r9 ; [d2 | d0] (B)
- usub16 r7, r10, r11 ; [d3 | d1] (B)
-
- ldr r10, [r1, #8] ; src (C)
- ldr r11, [r3, #8] ; pred (C)
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (B)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (B)
-
- str r8, [r0], #4 ; diff (B)
- uxtb16 r8, r10 ; [s2 | s0] (C)
- str r9, [r0], #4 ; diff (B)
-
- uxtb16 r9, r11 ; [p2 | p0] (C)
- uxtb16 r10, r10, ror #8 ; [s3 | s1] (C)
- uxtb16 r11, r11, ror #8 ; [p3 | p1] (C)
-
- usub16 r6, r8, r9 ; [d2 | d0] (C)
- usub16 r7, r10, r11 ; [d3 | d1] (C)
-
- ldr r10, [r1, #12] ; src (D)
- ldr r11, [r3, #12] ; pred (D)
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (C)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (C)
-
- str r8, [r0], #4 ; diff (C)
- uxtb16 r8, r10 ; [s2 | s0] (D)
- str r9, [r0], #4 ; diff (C)
-
- uxtb16 r9, r11 ; [p2 | p0] (D)
- uxtb16 r10, r10, ror #8 ; [s3 | s1] (D)
- uxtb16 r11, r11, ror #8 ; [p3 | p1] (D)
-
- usub16 r6, r8, r9 ; [d2 | d0] (D)
- usub16 r7, r10, r11 ; [d3 | d1] (D)
-
- add r1, r1, r2 ; update src pointer
- add r3, r3, r12 ; update pred pointer
-
- pkhbt r8, r6, r7, lsl #16 ; [d1 | d0] (D)
- pkhtb r9, r7, r6, asr #16 ; [d3 | d2] (D)
-
- str r8, [r0], #4 ; diff (D)
- subs r4, r4, #1 ; update loop counter
- str r9, [r0], #4 ; diff (D)
-
- bne loop
-
- ldmfd sp!, {r4-r11}
- bx lr
-
- ENDP
-
- END
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/walsh_v6.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/walsh_v6.asm
deleted file mode 100644
index 5eaf3f2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/armv6/walsh_v6.asm
+++ /dev/null
@@ -1,212 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp8_short_walsh4x4_armv6|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA |.text|, CODE, READONLY ; name this block of code
-
-;short vp8_short_walsh4x4_armv6(short *input, short *output, int pitch)
-; r0 short *input,
-; r1 short *output,
-; r2 int pitch
-|vp8_short_walsh4x4_armv6| PROC
-
- stmdb sp!, {r4 - r11, lr}
-
- ldrd r4, r5, [r0], r2
- ldr lr, c00040004
- ldrd r6, r7, [r0], r2
-
- ; 0-3
- qadd16 r3, r4, r5 ; [d1|a1] [1+3 | 0+2]
- qsub16 r4, r4, r5 ; [c1|b1] [1-3 | 0-2]
-
- ldrd r8, r9, [r0], r2
- ; 4-7
- qadd16 r5, r6, r7 ; [d1|a1] [5+7 | 4+6]
- qsub16 r6, r6, r7 ; [c1|b1] [5-7 | 4-6]
-
- ldrd r10, r11, [r0]
- ; 8-11
- qadd16 r7, r8, r9 ; [d1|a1] [9+11 | 8+10]
- qsub16 r8, r8, r9 ; [c1|b1] [9-11 | 8-10]
-
- ; 12-15
- qadd16 r9, r10, r11 ; [d1|a1] [13+15 | 12+14]
- qsub16 r10, r10, r11 ; [c1|b1] [13-15 | 12-14]
-
-
- lsls r2, r3, #16
- smuad r11, r3, lr ; A0 = a1<<2 + d1<<2
- addne r11, r11, #1 ; A0 += (a1!=0)
-
- lsls r2, r7, #16
- smuad r12, r7, lr ; C0 = a1<<2 + d1<<2
- addne r12, r12, #1 ; C0 += (a1!=0)
-
- add r0, r11, r12 ; a1_0 = A0 + C0
- sub r11, r11, r12 ; b1_0 = A0 - C0
-
- lsls r2, r5, #16
- smuad r12, r5, lr ; B0 = a1<<2 + d1<<2
- addne r12, r12, #1 ; B0 += (a1!=0)
-
- lsls r2, r9, #16
- smuad r2, r9, lr ; D0 = a1<<2 + d1<<2
- addne r2, r2, #1 ; D0 += (a1!=0)
-
- add lr, r12, r2 ; d1_0 = B0 + D0
- sub r12, r12, r2 ; c1_0 = B0 - D0
-
- ; op[0,4,8,12]
- adds r2, r0, lr ; a2 = a1_0 + d1_0
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- subs r0, r0, lr ; d2 = a1_0 - d1_0
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1] ; op[0]
-
- addmi r0, r0, #1 ; += a2 < 0
- add r0, r0, #3 ; += 3
- ldr lr, c00040004
- mov r0, r0, asr #3 ; >> 3
- strh r0, [r1, #24] ; op[12]
-
- adds r2, r11, r12 ; b2 = b1_0 + c1_0
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- subs r0, r11, r12 ; c2 = b1_0 - c1_0
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1, #8] ; op[4]
-
- addmi r0, r0, #1 ; += a2 < 0
- add r0, r0, #3 ; += 3
- smusd r3, r3, lr ; A3 = a1<<2 - d1<<2
- smusd r7, r7, lr ; C3 = a1<<2 - d1<<2
- mov r0, r0, asr #3 ; >> 3
- strh r0, [r1, #16] ; op[8]
-
-
- ; op[3,7,11,15]
- add r0, r3, r7 ; a1_3 = A3 + C3
- sub r3, r3, r7 ; b1_3 = A3 - C3
-
- smusd r5, r5, lr ; B3 = a1<<2 - d1<<2
- smusd r9, r9, lr ; D3 = a1<<2 - d1<<2
- add r7, r5, r9 ; d1_3 = B3 + D3
- sub r5, r5, r9 ; c1_3 = B3 - D3
-
- adds r2, r0, r7 ; a2 = a1_3 + d1_3
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- adds r9, r3, r5 ; b2 = b1_3 + c1_3
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1, #6] ; op[3]
-
- addmi r9, r9, #1 ; += a2 < 0
- add r9, r9, #3 ; += 3
- subs r2, r3, r5 ; c2 = b1_3 - c1_3
- mov r9, r9, asr #3 ; >> 3
- strh r9, [r1, #14] ; op[7]
-
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- subs r9, r0, r7 ; d2 = a1_3 - d1_3
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1, #22] ; op[11]
-
- addmi r9, r9, #1 ; += a2 < 0
- add r9, r9, #3 ; += 3
- smuad r3, r4, lr ; A1 = b1<<2 + c1<<2
- smuad r5, r8, lr ; C1 = b1<<2 + c1<<2
- mov r9, r9, asr #3 ; >> 3
- strh r9, [r1, #30] ; op[15]
-
- ; op[1,5,9,13]
- add r0, r3, r5 ; a1_1 = A1 + C1
- sub r3, r3, r5 ; b1_1 = A1 - C1
-
- smuad r7, r6, lr ; B1 = b1<<2 + c1<<2
- smuad r9, r10, lr ; D1 = b1<<2 + c1<<2
- add r5, r7, r9 ; d1_1 = B1 + D1
- sub r7, r7, r9 ; c1_1 = B1 - D1
-
- adds r2, r0, r5 ; a2 = a1_1 + d1_1
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- adds r9, r3, r7 ; b2 = b1_1 + c1_1
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1, #2] ; op[1]
-
- addmi r9, r9, #1 ; += a2 < 0
- add r9, r9, #3 ; += 3
- subs r2, r3, r7 ; c2 = b1_1 - c1_1
- mov r9, r9, asr #3 ; >> 3
- strh r9, [r1, #10] ; op[5]
-
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- subs r9, r0, r5 ; d2 = a1_1 - d1_1
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1, #18] ; op[9]
-
- addmi r9, r9, #1 ; += a2 < 0
- add r9, r9, #3 ; += 3
- smusd r4, r4, lr ; A2 = b1<<2 - c1<<2
- smusd r8, r8, lr ; C2 = b1<<2 - c1<<2
- mov r9, r9, asr #3 ; >> 3
- strh r9, [r1, #26] ; op[13]
-
-
- ; op[2,6,10,14]
- add r11, r4, r8 ; a1_2 = A2 + C2
- sub r12, r4, r8 ; b1_2 = A2 - C2
-
- smusd r6, r6, lr ; B2 = b1<<2 - c1<<2
- smusd r10, r10, lr ; D2 = b1<<2 - c1<<2
- add r4, r6, r10 ; d1_2 = B2 + D2
- sub r8, r6, r10 ; c1_2 = B2 - D2
-
- adds r2, r11, r4 ; a2 = a1_2 + d1_2
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- adds r9, r12, r8 ; b2 = b1_2 + c1_2
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1, #4] ; op[2]
-
- addmi r9, r9, #1 ; += a2 < 0
- add r9, r9, #3 ; += 3
- subs r2, r12, r8 ; c2 = b1_2 - c1_2
- mov r9, r9, asr #3 ; >> 3
- strh r9, [r1, #12] ; op[6]
-
- addmi r2, r2, #1 ; += a2 < 0
- add r2, r2, #3 ; += 3
- subs r9, r11, r4 ; d2 = a1_2 - d1_2
- mov r2, r2, asr #3 ; >> 3
- strh r2, [r1, #20] ; op[10]
-
- addmi r9, r9, #1 ; += a2 < 0
- add r9, r9, #3 ; += 3
- mov r9, r9, asr #3 ; >> 3
- strh r9, [r1, #28] ; op[14]
-
-
- ldmia sp!, {r4 - r11, pc}
- ENDP ; |vp8_short_walsh4x4_armv6|
-
-c00040004
- DCD 0x00040004
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/boolhuff_arm.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/boolhuff_arm.c
deleted file mode 100644
index 17a941b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/boolhuff_arm.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/encoder/boolhuff.h"
-#include "vpx/internal/vpx_codec_internal.h"
-
-const unsigned int vp8_prob_cost[256] =
-{
- 2047, 2047, 1791, 1641, 1535, 1452, 1385, 1328, 1279, 1235, 1196, 1161, 1129, 1099, 1072, 1046,
- 1023, 1000, 979, 959, 940, 922, 905, 889, 873, 858, 843, 829, 816, 803, 790, 778,
- 767, 755, 744, 733, 723, 713, 703, 693, 684, 675, 666, 657, 649, 641, 633, 625,
- 617, 609, 602, 594, 587, 580, 573, 567, 560, 553, 547, 541, 534, 528, 522, 516,
- 511, 505, 499, 494, 488, 483, 477, 472, 467, 462, 457, 452, 447, 442, 437, 433,
- 428, 424, 419, 415, 410, 406, 401, 397, 393, 389, 385, 381, 377, 373, 369, 365,
- 361, 357, 353, 349, 346, 342, 338, 335, 331, 328, 324, 321, 317, 314, 311, 307,
- 304, 301, 297, 294, 291, 288, 285, 281, 278, 275, 272, 269, 266, 263, 260, 257,
- 255, 252, 249, 246, 243, 240, 238, 235, 232, 229, 227, 224, 221, 219, 216, 214,
- 211, 208, 206, 203, 201, 198, 196, 194, 191, 189, 186, 184, 181, 179, 177, 174,
- 172, 170, 168, 165, 163, 161, 159, 156, 154, 152, 150, 148, 145, 143, 141, 139,
- 137, 135, 133, 131, 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107,
- 105, 103, 101, 99, 97, 95, 93, 92, 90, 88, 86, 84, 82, 81, 79, 77,
- 75, 73, 72, 70, 68, 66, 65, 63, 61, 60, 58, 56, 55, 53, 51, 50,
- 48, 46, 45, 43, 41, 40, 38, 37, 35, 33, 32, 30, 29, 27, 25, 24,
- 22, 21, 19, 18, 16, 15, 13, 12, 10, 9, 7, 6, 4, 3, 1, 1
-};
-
-int vp8_validate_buffer_arm(const unsigned char *start,
- size_t len,
- const unsigned char *end,
- struct vpx_internal_error_info *error)
-{
- return validate_buffer(start, len, end, error);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/dct_arm.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/dct_arm.c
deleted file mode 100644
index f71300d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/dct_arm.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-
-#if HAVE_MEDIA
-
-void vp8_short_fdct8x4_armv6(short *input, short *output, int pitch)
-{
- vp8_short_fdct4x4_armv6(input, output, pitch);
- vp8_short_fdct4x4_armv6(input + 4, output + 16, pitch);
-}
-
-#endif /* HAVE_MEDIA */
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/denoising_neon.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/denoising_neon.c
deleted file mode 100644
index 3f85397..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/denoising_neon.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <arm_neon.h>
-
-#include "vp8/encoder/denoising.h"
-#include "vpx_mem/vpx_mem.h"
-#include "./vp8_rtcd.h"
-
-/*
- * The filter function was modified to reduce the computational complexity.
- *
- * Step 1:
- * Instead of applying tap coefficients for each pixel, we calculated the
- * pixel adjustments vs. pixel diff value ahead of time.
- * adjustment = filtered_value - current_raw
- * = (filter_coefficient * diff + 128) >> 8
- * where
- * filter_coefficient = (255 << 8) / (256 + ((abs_diff * 330) >> 3));
- * filter_coefficient += filter_coefficient /
- * (3 + motion_magnitude_adjustment);
- * filter_coefficient is clamped to 0 ~ 255.
- *
- * Step 2:
- * The adjustment vs. diff curve becomes flat very quick when diff increases.
- * This allowed us to use only several levels to approximate the curve without
- * changing the filtering algorithm too much.
- * The adjustments were further corrected by checking the motion magnitude.
- * The levels used are:
- * diff level adjustment w/o adjustment w/
- * motion correction motion correction
- * [-255, -16] 3 -6 -7
- * [-15, -8] 2 -4 -5
- * [-7, -4] 1 -3 -4
- * [-3, 3] 0 diff diff
- * [4, 7] 1 3 4
- * [8, 15] 2 4 5
- * [16, 255] 3 6 7
- */
-
-int vp8_denoiser_filter_neon(YV12_BUFFER_CONFIG *mc_running_avg,
- YV12_BUFFER_CONFIG *running_avg,
- MACROBLOCK *signal, unsigned int motion_magnitude,
- int y_offset, int uv_offset) {
- /* If motion_magnitude is small, making the denoiser more aggressive by
- * increasing the adjustment for each level, level1 adjustment is
- * increased, the deltas stay the same.
- */
- const uint8x16_t v_level1_adjustment = vdupq_n_u8(
- (motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD) ? 4 : 3);
- const uint8x16_t v_delta_level_1_and_2 = vdupq_n_u8(1);
- const uint8x16_t v_delta_level_2_and_3 = vdupq_n_u8(2);
- const uint8x16_t v_level1_threshold = vdupq_n_u8(4);
- const uint8x16_t v_level2_threshold = vdupq_n_u8(8);
- const uint8x16_t v_level3_threshold = vdupq_n_u8(16);
-
- /* Local variables for array pointers and strides. */
- unsigned char *sig = signal->thismb;
- int sig_stride = 16;
- unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset;
- int mc_running_avg_y_stride = mc_running_avg->y_stride;
- unsigned char *running_avg_y = running_avg->y_buffer + y_offset;
- int running_avg_y_stride = running_avg->y_stride;
-
- /* Go over lines. */
- int i;
- int sum_diff = 0;
- for (i = 0; i < 16; ++i) {
- int8x16_t v_sum_diff = vdupq_n_s8(0);
- uint8x16_t v_running_avg_y;
-
- /* Load inputs. */
- const uint8x16_t v_sig = vld1q_u8(sig);
- const uint8x16_t v_mc_running_avg_y = vld1q_u8(mc_running_avg_y);
-
- /* Calculate absolute difference and sign masks. */
- const uint8x16_t v_abs_diff = vabdq_u8(v_sig, v_mc_running_avg_y);
- const uint8x16_t v_diff_pos_mask = vcltq_u8(v_sig, v_mc_running_avg_y);
- const uint8x16_t v_diff_neg_mask = vcgtq_u8(v_sig, v_mc_running_avg_y);
-
- /* Figure out which level that put us in. */
- const uint8x16_t v_level1_mask = vcleq_u8(v_level1_threshold,
- v_abs_diff);
- const uint8x16_t v_level2_mask = vcleq_u8(v_level2_threshold,
- v_abs_diff);
- const uint8x16_t v_level3_mask = vcleq_u8(v_level3_threshold,
- v_abs_diff);
-
- /* Calculate absolute adjustments for level 1, 2 and 3. */
- const uint8x16_t v_level2_adjustment = vandq_u8(v_level2_mask,
- v_delta_level_1_and_2);
- const uint8x16_t v_level3_adjustment = vandq_u8(v_level3_mask,
- v_delta_level_2_and_3);
- const uint8x16_t v_level1and2_adjustment = vaddq_u8(v_level1_adjustment,
- v_level2_adjustment);
- const uint8x16_t v_level1and2and3_adjustment = vaddq_u8(
- v_level1and2_adjustment, v_level3_adjustment);
-
- /* Figure adjustment absolute value by selecting between the absolute
- * difference if in level0 or the value for level 1, 2 and 3.
- */
- const uint8x16_t v_abs_adjustment = vbslq_u8(v_level1_mask,
- v_level1and2and3_adjustment, v_abs_diff);
-
- /* Calculate positive and negative adjustments. Apply them to the signal
- * and accumulate them. Adjustments are less than eight and the maximum
- * sum of them (7 * 16) can fit in a signed char.
- */
- const uint8x16_t v_pos_adjustment = vandq_u8(v_diff_pos_mask,
- v_abs_adjustment);
- const uint8x16_t v_neg_adjustment = vandq_u8(v_diff_neg_mask,
- v_abs_adjustment);
- v_running_avg_y = vqaddq_u8(v_sig, v_pos_adjustment);
- v_running_avg_y = vqsubq_u8(v_running_avg_y, v_neg_adjustment);
- v_sum_diff = vqaddq_s8(v_sum_diff,
- vreinterpretq_s8_u8(v_pos_adjustment));
- v_sum_diff = vqsubq_s8(v_sum_diff,
- vreinterpretq_s8_u8(v_neg_adjustment));
-
- /* Store results. */
- vst1q_u8(running_avg_y, v_running_avg_y);
-
- /* Sum all the accumulators to have the sum of all pixel differences
- * for this macroblock.
- */
- {
- int s0 = vgetq_lane_s8(v_sum_diff, 0) +
- vgetq_lane_s8(v_sum_diff, 1) +
- vgetq_lane_s8(v_sum_diff, 2) +
- vgetq_lane_s8(v_sum_diff, 3);
- int s1 = vgetq_lane_s8(v_sum_diff, 4) +
- vgetq_lane_s8(v_sum_diff, 5) +
- vgetq_lane_s8(v_sum_diff, 6) +
- vgetq_lane_s8(v_sum_diff, 7);
- int s2 = vgetq_lane_s8(v_sum_diff, 8) +
- vgetq_lane_s8(v_sum_diff, 9) +
- vgetq_lane_s8(v_sum_diff, 10) +
- vgetq_lane_s8(v_sum_diff, 11);
- int s3 = vgetq_lane_s8(v_sum_diff, 12) +
- vgetq_lane_s8(v_sum_diff, 13) +
- vgetq_lane_s8(v_sum_diff, 14) +
- vgetq_lane_s8(v_sum_diff, 15);
- sum_diff += s0 + s1+ s2 + s3;
- }
-
- /* Update pointers for next iteration. */
- sig += sig_stride;
- mc_running_avg_y += mc_running_avg_y_stride;
- running_avg_y += running_avg_y_stride;
- }
-
- /* Too much adjustments => copy block. */
- if (abs(sum_diff) > SUM_DIFF_THRESHOLD)
- return COPY_BLOCK;
-
- /* Tell above level that block was filtered. */
- vp8_copy_mem16x16(running_avg->y_buffer + y_offset, running_avg_y_stride,
- signal->thismb, sig_stride);
- return FILTER_BLOCK;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm
deleted file mode 100644
index 9374310..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/fastquantizeb_neon.asm
+++ /dev/null
@@ -1,258 +0,0 @@
-;
-; Copyright (c) 2011 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_fast_quantize_b_neon|
- EXPORT |vp8_fast_quantize_b_pair_neon|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=4
-
-;vp8_fast_quantize_b_pair_neon(BLOCK *b1, BLOCK *b2, BLOCKD *d1, BLOCKD *d2);
-|vp8_fast_quantize_b_pair_neon| PROC
-
- stmfd sp!, {r4-r9}
- vstmdb sp!, {q4-q7}
-
- ldr r4, [r0, #vp8_block_coeff]
- ldr r5, [r0, #vp8_block_quant_fast]
- ldr r6, [r0, #vp8_block_round]
-
- vld1.16 {q0, q1}, [r4@128] ; load z
-
- ldr r7, [r2, #vp8_blockd_qcoeff]
-
- vabs.s16 q4, q0 ; calculate x = abs(z)
- vabs.s16 q5, q1
-
- ;right shift 15 to get sign, all 0 if it is positive, all 1 if it is negative
- vshr.s16 q2, q0, #15 ; sz
- vshr.s16 q3, q1, #15
-
- vld1.s16 {q6, q7}, [r6@128] ; load round_ptr [0-15]
- vld1.s16 {q8, q9}, [r5@128] ; load quant_ptr [0-15]
-
- ldr r4, [r1, #vp8_block_coeff]
-
- vadd.s16 q4, q6 ; x + Round
- vadd.s16 q5, q7
-
- vld1.16 {q0, q1}, [r4@128] ; load z2
-
- vqdmulh.s16 q4, q8 ; y = ((Round+abs(z)) * Quant) >> 16
- vqdmulh.s16 q5, q9
-
- vabs.s16 q10, q0 ; calculate x2 = abs(z_2)
- vabs.s16 q11, q1
- vshr.s16 q12, q0, #15 ; sz2
- vshr.s16 q13, q1, #15
-
- ;modify data to have its original sign
- veor.s16 q4, q2 ; y^sz
- veor.s16 q5, q3
-
- vadd.s16 q10, q6 ; x2 + Round
- vadd.s16 q11, q7
-
- ldr r8, [r2, #vp8_blockd_dequant]
-
- vqdmulh.s16 q10, q8 ; y2 = ((Round+abs(z)) * Quant) >> 16
- vqdmulh.s16 q11, q9
-
- vshr.s16 q4, #1 ; right shift 1 after vqdmulh
- vshr.s16 q5, #1
-
- vld1.s16 {q6, q7}, [r8@128] ;load dequant_ptr[i]
-
- vsub.s16 q4, q2 ; x1=(y^sz)-sz = (y^sz)-(-1) (2's complement)
- vsub.s16 q5, q3
-
- vshr.s16 q10, #1 ; right shift 1 after vqdmulh
- vshr.s16 q11, #1
-
- ldr r9, [r2, #vp8_blockd_dqcoeff]
-
- veor.s16 q10, q12 ; y2^sz2
- veor.s16 q11, q13
-
- vst1.s16 {q4, q5}, [r7] ; store: qcoeff = x1
-
-
- vsub.s16 q10, q12 ; x2=(y^sz)-sz = (y^sz)-(-1) (2's complement)
- vsub.s16 q11, q13
-
- ldr r6, [r3, #vp8_blockd_qcoeff]
-
- vmul.s16 q2, q6, q4 ; x * Dequant
- vmul.s16 q3, q7, q5
-
- adr r0, inv_zig_zag ; load ptr of inverse zigzag table
-
- vceq.s16 q8, q8 ; set q8 to all 1
-
- vst1.s16 {q10, q11}, [r6] ; store: qcoeff = x2
-
- vmul.s16 q12, q6, q10 ; x2 * Dequant
- vmul.s16 q13, q7, q11
-
- vld1.16 {q6, q7}, [r0@128] ; load inverse scan order
-
- vtst.16 q14, q4, q8 ; now find eob
- vtst.16 q15, q5, q8 ; non-zero element is set to all 1
-
- vst1.s16 {q2, q3}, [r9] ; store dqcoeff = x * Dequant
-
- ldr r7, [r3, #vp8_blockd_dqcoeff]
-
- vand q0, q6, q14 ; get all valid numbers from scan array
- vand q1, q7, q15
-
- vst1.s16 {q12, q13}, [r7] ; store dqcoeff = x * Dequant
-
- vtst.16 q2, q10, q8 ; now find eob
- vtst.16 q3, q11, q8 ; non-zero element is set to all 1
-
- vmax.u16 q0, q0, q1 ; find maximum value in q0, q1
-
- vand q10, q6, q2 ; get all valid numbers from scan array
- vand q11, q7, q3
- vmax.u16 q10, q10, q11 ; find maximum value in q10, q11
-
- vmax.u16 d0, d0, d1
- vmax.u16 d20, d20, d21
- vmovl.u16 q0, d0
- vmovl.u16 q10, d20
-
- vmax.u32 d0, d0, d1
- vmax.u32 d20, d20, d21
- vpmax.u32 d0, d0, d0
- vpmax.u32 d20, d20, d20
-
- ldr r4, [r2, #vp8_blockd_eob]
- ldr r5, [r3, #vp8_blockd_eob]
-
- vst1.8 {d0[0]}, [r4] ; store eob
- vst1.8 {d20[0]}, [r5] ; store eob
-
- vldmia sp!, {q4-q7}
- ldmfd sp!, {r4-r9}
- bx lr
-
- ENDP
-
-;void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
-|vp8_fast_quantize_b_neon| PROC
-
- stmfd sp!, {r4-r7}
-
- ldr r3, [r0, #vp8_block_coeff]
- ldr r4, [r0, #vp8_block_quant_fast]
- ldr r5, [r0, #vp8_block_round]
-
- vld1.16 {q0, q1}, [r3@128] ; load z
- vorr.s16 q14, q0, q1 ; check if all zero (step 1)
- ldr r6, [r1, #vp8_blockd_qcoeff]
- ldr r7, [r1, #vp8_blockd_dqcoeff]
- vorr.s16 d28, d28, d29 ; check if all zero (step 2)
-
- vabs.s16 q12, q0 ; calculate x = abs(z)
- vabs.s16 q13, q1
-
- ;right shift 15 to get sign, all 0 if it is positive, all 1 if it is negative
- vshr.s16 q2, q0, #15 ; sz
- vmov r2, r3, d28 ; check if all zero (step 3)
- vshr.s16 q3, q1, #15
-
- vld1.s16 {q14, q15}, [r5@128]; load round_ptr [0-15]
- vld1.s16 {q8, q9}, [r4@128] ; load quant_ptr [0-15]
-
- vadd.s16 q12, q14 ; x + Round
- vadd.s16 q13, q15
-
- adr r0, inv_zig_zag ; load ptr of inverse zigzag table
-
- vqdmulh.s16 q12, q8 ; y = ((Round+abs(z)) * Quant) >> 16
- vqdmulh.s16 q13, q9
-
- vld1.16 {q10, q11}, [r0@128]; load inverse scan order
-
- vceq.s16 q8, q8 ; set q8 to all 1
-
- ldr r4, [r1, #vp8_blockd_dequant]
-
- vshr.s16 q12, #1 ; right shift 1 after vqdmulh
- vshr.s16 q13, #1
-
- ldr r5, [r1, #vp8_blockd_eob]
-
- orr r2, r2, r3 ; check if all zero (step 4)
- cmp r2, #0 ; check if all zero (step 5)
- beq zero_output ; check if all zero (step 6)
-
- ;modify data to have its original sign
- veor.s16 q12, q2 ; y^sz
- veor.s16 q13, q3
-
- vsub.s16 q12, q2 ; x1=(y^sz)-sz = (y^sz)-(-1) (2's complement)
- vsub.s16 q13, q3
-
- vld1.s16 {q2, q3}, [r4@128] ; load dequant_ptr[i]
-
- vtst.16 q14, q12, q8 ; now find eob
- vtst.16 q15, q13, q8 ; non-zero element is set to all 1
-
- vst1.s16 {q12, q13}, [r6@128]; store: qcoeff = x1
-
- vand q10, q10, q14 ; get all valid numbers from scan array
- vand q11, q11, q15
-
-
- vmax.u16 q0, q10, q11 ; find maximum value in q0, q1
- vmax.u16 d0, d0, d1
- vmovl.u16 q0, d0
-
- vmul.s16 q2, q12 ; x * Dequant
- vmul.s16 q3, q13
-
- vmax.u32 d0, d0, d1
- vpmax.u32 d0, d0, d0
-
- vst1.s16 {q2, q3}, [r7@128] ; store dqcoeff = x * Dequant
-
- vst1.8 {d0[0]}, [r5] ; store eob
-
- ldmfd sp!, {r4-r7}
- bx lr
-
-zero_output
- strb r2, [r5] ; store eob
- vst1.s16 {q0, q1}, [r6@128] ; qcoeff = 0
- vst1.s16 {q0, q1}, [r7@128] ; dqcoeff = 0
-
- ldmfd sp!, {r4-r7}
- bx lr
-
- ENDP
-
-; default inverse zigzag table is defined in vp8/common/entropy.c
- ALIGN 16 ; enable use of @128 bit aligned loads
-inv_zig_zag
- DCW 0x0001, 0x0002, 0x0006, 0x0007
- DCW 0x0003, 0x0005, 0x0008, 0x000d
- DCW 0x0004, 0x0009, 0x000c, 0x000e
- DCW 0x000a, 0x000b, 0x000f, 0x0010
-
- END
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/picklpf_arm.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/picklpf_arm.c
deleted file mode 100644
index ec8071e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/picklpf_arm.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp8/common/loopfilter.h"
-#include "vpx_scale/yv12config.h"
-
-extern void vp8_memcpy_partial_neon(unsigned char *dst_ptr,
- unsigned char *src_ptr,
- int sz);
-
-
-void vp8_yv12_copy_partial_frame_neon(YV12_BUFFER_CONFIG *src_ybc,
- YV12_BUFFER_CONFIG *dst_ybc)
-{
- unsigned char *src_y, *dst_y;
- int yheight;
- int ystride;
- int yoffset;
- int linestocopy;
-
- yheight = src_ybc->y_height;
- ystride = src_ybc->y_stride;
-
- /* number of MB rows to use in partial filtering */
- linestocopy = (yheight >> 4) / PARTIAL_FRAME_FRACTION;
- linestocopy = linestocopy ? linestocopy << 4 : 16; /* 16 lines per MB */
-
- /* Copy extra 4 so that full filter context is available if filtering done
- * on the copied partial frame and not original. Partial filter does mb
- * filtering for top row also, which can modify3 pixels above.
- */
- linestocopy += 4;
- /* partial image starts at ~middle of frame (macroblock border) */
- yoffset = ystride * (((yheight >> 5) * 16) - 4);
- src_y = src_ybc->y_buffer + yoffset;
- dst_y = dst_ybc->y_buffer + yoffset;
-
- vp8_memcpy_partial_neon(dst_y, src_y, ystride * linestocopy);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/shortfdct_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/shortfdct_neon.asm
deleted file mode 100644
index 5ea8dd8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/shortfdct_neon.asm
+++ /dev/null
@@ -1,221 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_short_fdct4x4_neon|
- EXPORT |vp8_short_fdct8x4_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=4
-
-
- ALIGN 16 ; enable use of @128 bit aligned loads
-coeff
- DCW 5352, 5352, 5352, 5352
- DCW 2217, 2217, 2217, 2217
- DCD 14500, 14500, 14500, 14500
- DCD 7500, 7500, 7500, 7500
- DCD 12000, 12000, 12000, 12000
- DCD 51000, 51000, 51000, 51000
-
-;void vp8_short_fdct4x4_c(short *input, short *output, int pitch)
-|vp8_short_fdct4x4_neon| PROC
-
- ; Part one
- vld1.16 {d0}, [r0@64], r2
- adr r12, coeff
- vld1.16 {d1}, [r0@64], r2
- vld1.16 {q8}, [r12@128]! ; d16=5352, d17=2217
- vld1.16 {d2}, [r0@64], r2
- vld1.32 {q9, q10}, [r12@128]! ; q9=14500, q10=7500
- vld1.16 {d3}, [r0@64], r2
-
- ; transpose d0=ip[0], d1=ip[1], d2=ip[2], d3=ip[3]
- vtrn.32 d0, d2
- vtrn.32 d1, d3
- vld1.32 {q11,q12}, [r12@128] ; q11=12000, q12=51000
- vtrn.16 d0, d1
- vtrn.16 d2, d3
-
- vadd.s16 d4, d0, d3 ; a1 = ip[0] + ip[3]
- vadd.s16 d5, d1, d2 ; b1 = ip[1] + ip[2]
- vsub.s16 d6, d1, d2 ; c1 = ip[1] - ip[2]
- vsub.s16 d7, d0, d3 ; d1 = ip[0] - ip[3]
-
- vshl.s16 q2, q2, #3 ; (a1, b1) << 3
- vshl.s16 q3, q3, #3 ; (c1, d1) << 3
-
- vadd.s16 d0, d4, d5 ; op[0] = a1 + b1
- vsub.s16 d2, d4, d5 ; op[2] = a1 - b1
-
- vmlal.s16 q9, d7, d16 ; d1*5352 + 14500
- vmlal.s16 q10, d7, d17 ; d1*2217 + 7500
- vmlal.s16 q9, d6, d17 ; c1*2217 + d1*5352 + 14500
- vmlsl.s16 q10, d6, d16 ; d1*2217 - c1*5352 + 7500
-
- vshrn.s32 d1, q9, #12 ; op[1] = (c1*2217 + d1*5352 + 14500)>>12
- vshrn.s32 d3, q10, #12 ; op[3] = (d1*2217 - c1*5352 + 7500)>>12
-
-
- ; Part two
-
- ; transpose d0=ip[0], d1=ip[4], d2=ip[8], d3=ip[12]
- vtrn.32 d0, d2
- vtrn.32 d1, d3
- vtrn.16 d0, d1
- vtrn.16 d2, d3
-
- vmov.s16 d26, #7
-
- vadd.s16 d4, d0, d3 ; a1 = ip[0] + ip[12]
- vadd.s16 d5, d1, d2 ; b1 = ip[4] + ip[8]
- vsub.s16 d6, d1, d2 ; c1 = ip[4] - ip[8]
- vadd.s16 d4, d4, d26 ; a1 + 7
- vsub.s16 d7, d0, d3 ; d1 = ip[0] - ip[12]
-
- vadd.s16 d0, d4, d5 ; op[0] = a1 + b1 + 7
- vsub.s16 d2, d4, d5 ; op[8] = a1 - b1 + 7
-
- vmlal.s16 q11, d7, d16 ; d1*5352 + 12000
- vmlal.s16 q12, d7, d17 ; d1*2217 + 51000
-
- vceq.s16 d4, d7, #0
-
- vshr.s16 d0, d0, #4
- vshr.s16 d2, d2, #4
-
- vmlal.s16 q11, d6, d17 ; c1*2217 + d1*5352 + 12000
- vmlsl.s16 q12, d6, d16 ; d1*2217 - c1*5352 + 51000
-
- vmvn d4, d4
- vshrn.s32 d1, q11, #16 ; op[4] = (c1*2217 + d1*5352 + 12000)>>16
- vsub.s16 d1, d1, d4 ; op[4] += (d1!=0)
- vshrn.s32 d3, q12, #16 ; op[12]= (d1*2217 - c1*5352 + 51000)>>16
-
- vst1.16 {q0, q1}, [r1@128]
-
- bx lr
-
- ENDP
-
-;void vp8_short_fdct8x4_c(short *input, short *output, int pitch)
-|vp8_short_fdct8x4_neon| PROC
-
- ; Part one
-
- vld1.16 {q0}, [r0@128], r2
- adr r12, coeff
- vld1.16 {q1}, [r0@128], r2
- vld1.16 {q8}, [r12@128]! ; d16=5352, d17=2217
- vld1.16 {q2}, [r0@128], r2
- vld1.32 {q9, q10}, [r12@128]! ; q9=14500, q10=7500
- vld1.16 {q3}, [r0@128], r2
-
- ; transpose q0=ip[0], q1=ip[1], q2=ip[2], q3=ip[3]
- vtrn.32 q0, q2 ; [A0|B0]
- vtrn.32 q1, q3 ; [A1|B1]
- vtrn.16 q0, q1 ; [A2|B2]
- vtrn.16 q2, q3 ; [A3|B3]
-
- vadd.s16 q11, q0, q3 ; a1 = ip[0] + ip[3]
- vadd.s16 q12, q1, q2 ; b1 = ip[1] + ip[2]
- vsub.s16 q13, q1, q2 ; c1 = ip[1] - ip[2]
- vsub.s16 q14, q0, q3 ; d1 = ip[0] - ip[3]
-
- vshl.s16 q11, q11, #3 ; a1 << 3
- vshl.s16 q12, q12, #3 ; b1 << 3
- vshl.s16 q13, q13, #3 ; c1 << 3
- vshl.s16 q14, q14, #3 ; d1 << 3
-
- vadd.s16 q0, q11, q12 ; [A0 | B0] = a1 + b1
- vsub.s16 q2, q11, q12 ; [A2 | B2] = a1 - b1
-
- vmov.s16 q11, q9 ; 14500
- vmov.s16 q12, q10 ; 7500
-
- vmlal.s16 q9, d28, d16 ; A[1] = d1*5352 + 14500
- vmlal.s16 q10, d28, d17 ; A[3] = d1*2217 + 7500
- vmlal.s16 q11, d29, d16 ; B[1] = d1*5352 + 14500
- vmlal.s16 q12, d29, d17 ; B[3] = d1*2217 + 7500
-
- vmlal.s16 q9, d26, d17 ; A[1] = c1*2217 + d1*5352 + 14500
- vmlsl.s16 q10, d26, d16 ; A[3] = d1*2217 - c1*5352 + 7500
- vmlal.s16 q11, d27, d17 ; B[1] = c1*2217 + d1*5352 + 14500
- vmlsl.s16 q12, d27, d16 ; B[3] = d1*2217 - c1*5352 + 7500
-
- vshrn.s32 d2, q9, #12 ; A[1] = (c1*2217 + d1*5352 + 14500)>>12
- vshrn.s32 d6, q10, #12 ; A[3] = (d1*2217 - c1*5352 + 7500)>>12
- vshrn.s32 d3, q11, #12 ; B[1] = (c1*2217 + d1*5352 + 14500)>>12
- vshrn.s32 d7, q12, #12 ; B[3] = (d1*2217 - c1*5352 + 7500)>>12
-
-
- ; Part two
- vld1.32 {q9,q10}, [r12@128] ; q9=12000, q10=51000
-
- ; transpose q0=ip[0], q1=ip[4], q2=ip[8], q3=ip[12]
- vtrn.32 q0, q2 ; q0=[A0 | B0]
- vtrn.32 q1, q3 ; q1=[A4 | B4]
- vtrn.16 q0, q1 ; q2=[A8 | B8]
- vtrn.16 q2, q3 ; q3=[A12|B12]
-
- vmov.s16 q15, #7
-
- vadd.s16 q11, q0, q3 ; a1 = ip[0] + ip[12]
- vadd.s16 q12, q1, q2 ; b1 = ip[4] + ip[8]
- vadd.s16 q11, q11, q15 ; a1 + 7
- vsub.s16 q13, q1, q2 ; c1 = ip[4] - ip[8]
- vsub.s16 q14, q0, q3 ; d1 = ip[0] - ip[12]
-
- vadd.s16 q0, q11, q12 ; a1 + b1 + 7
- vsub.s16 q1, q11, q12 ; a1 - b1 + 7
-
- vmov.s16 q11, q9 ; 12000
- vmov.s16 q12, q10 ; 51000
-
- vshr.s16 d0, d0, #4 ; A[0] = (a1 + b1 + 7)>>4
- vshr.s16 d4, d1, #4 ; B[0] = (a1 + b1 + 7)>>4
- vshr.s16 d2, d2, #4 ; A[8] = (a1 + b1 + 7)>>4
- vshr.s16 d6, d3, #4 ; B[8] = (a1 + b1 + 7)>>4
-
-
- vmlal.s16 q9, d28, d16 ; A[4] = d1*5352 + 12000
- vmlal.s16 q10, d28, d17 ; A[12] = d1*2217 + 51000
- vmlal.s16 q11, d29, d16 ; B[4] = d1*5352 + 12000
- vmlal.s16 q12, d29, d17 ; B[12] = d1*2217 + 51000
-
- vceq.s16 q14, q14, #0
-
- vmlal.s16 q9, d26, d17 ; A[4] = c1*2217 + d1*5352 + 12000
- vmlsl.s16 q10, d26, d16 ; A[12] = d1*2217 - c1*5352 + 51000
- vmlal.s16 q11, d27, d17 ; B[4] = c1*2217 + d1*5352 + 12000
- vmlsl.s16 q12, d27, d16 ; B[12] = d1*2217 - c1*5352 + 51000
-
- vmvn q14, q14
-
- vshrn.s32 d1, q9, #16 ; A[4] = (c1*2217 + d1*5352 + 12000)>>16
- vshrn.s32 d3, q10, #16 ; A[12]= (d1*2217 - c1*5352 + 51000)>>16
- vsub.s16 d1, d1, d28 ; A[4] += (d1!=0)
-
- vshrn.s32 d5, q11, #16 ; B[4] = (c1*2217 + d1*5352 + 12000)>>16
- vshrn.s32 d7, q12, #16 ; B[12]= (d1*2217 - c1*5352 + 51000)>>16
- vsub.s16 d5, d5, d29 ; B[4] += (d1!=0)
-
- vst1.16 {q0, q1}, [r1@128]! ; block A
- vst1.16 {q2, q3}, [r1@128]! ; block B
-
- bx lr
-
- ENDP
-
- END
-
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/subtract_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/subtract_neon.asm
deleted file mode 100644
index 5bda786..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/subtract_neon.asm
+++ /dev/null
@@ -1,199 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp8_subtract_b_neon|
- EXPORT |vp8_subtract_mby_neon|
- EXPORT |vp8_subtract_mbuv_neon|
-
- INCLUDE vp8_asm_enc_offsets.asm
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp8_subtract_b_neon(BLOCK *be, BLOCKD *bd, int pitch)
-|vp8_subtract_b_neon| PROC
-
- stmfd sp!, {r4-r7}
-
- ldr r3, [r0, #vp8_block_base_src]
- ldr r4, [r0, #vp8_block_src]
- ldr r5, [r0, #vp8_block_src_diff]
- ldr r3, [r3]
- ldr r6, [r0, #vp8_block_src_stride]
- add r3, r3, r4 ; src = *base_src + src
- ldr r7, [r1, #vp8_blockd_predictor]
-
- vld1.8 {d0}, [r3], r6 ;load src
- vld1.8 {d1}, [r7], r2 ;load pred
- vld1.8 {d2}, [r3], r6
- vld1.8 {d3}, [r7], r2
- vld1.8 {d4}, [r3], r6
- vld1.8 {d5}, [r7], r2
- vld1.8 {d6}, [r3], r6
- vld1.8 {d7}, [r7], r2
-
- vsubl.u8 q10, d0, d1
- vsubl.u8 q11, d2, d3
- vsubl.u8 q12, d4, d5
- vsubl.u8 q13, d6, d7
-
- mov r2, r2, lsl #1
-
- vst1.16 {d20}, [r5], r2 ;store diff
- vst1.16 {d22}, [r5], r2
- vst1.16 {d24}, [r5], r2
- vst1.16 {d26}, [r5], r2
-
- ldmfd sp!, {r4-r7}
- bx lr
-
- ENDP
-
-
-;==========================================
-;void vp8_subtract_mby_neon(short *diff, unsigned char *src, int src_stride
-; unsigned char *pred, int pred_stride)
-|vp8_subtract_mby_neon| PROC
- push {r4-r7}
- mov r12, #4
- ldr r4, [sp, #16] ; pred_stride
- mov r6, #32 ; "diff" stride x2
- add r5, r0, #16 ; second diff pointer
-
-subtract_mby_loop
- vld1.8 {q0}, [r1], r2 ;load src
- vld1.8 {q1}, [r3], r4 ;load pred
- vld1.8 {q2}, [r1], r2
- vld1.8 {q3}, [r3], r4
- vld1.8 {q4}, [r1], r2
- vld1.8 {q5}, [r3], r4
- vld1.8 {q6}, [r1], r2
- vld1.8 {q7}, [r3], r4
-
- vsubl.u8 q8, d0, d2
- vsubl.u8 q9, d1, d3
- vsubl.u8 q10, d4, d6
- vsubl.u8 q11, d5, d7
- vsubl.u8 q12, d8, d10
- vsubl.u8 q13, d9, d11
- vsubl.u8 q14, d12, d14
- vsubl.u8 q15, d13, d15
-
- vst1.16 {q8}, [r0], r6 ;store diff
- vst1.16 {q9}, [r5], r6
- vst1.16 {q10}, [r0], r6
- vst1.16 {q11}, [r5], r6
- vst1.16 {q12}, [r0], r6
- vst1.16 {q13}, [r5], r6
- vst1.16 {q14}, [r0], r6
- vst1.16 {q15}, [r5], r6
-
- subs r12, r12, #1
- bne subtract_mby_loop
-
- pop {r4-r7}
- bx lr
- ENDP
-
-;=================================
-;void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc,
-; int src_stride, unsigned char *upred,
-; unsigned char *vpred, int pred_stride)
-
-|vp8_subtract_mbuv_neon| PROC
- push {r4-r7}
- ldr r4, [sp, #16] ; upred
- ldr r5, [sp, #20] ; vpred
- ldr r6, [sp, #24] ; pred_stride
- add r0, r0, #512 ; short *udiff = diff + 256;
- mov r12, #32 ; "diff" stride x2
- add r7, r0, #16 ; second diff pointer
-
-;u
- vld1.8 {d0}, [r1], r3 ;load usrc
- vld1.8 {d1}, [r4], r6 ;load upred
- vld1.8 {d2}, [r1], r3
- vld1.8 {d3}, [r4], r6
- vld1.8 {d4}, [r1], r3
- vld1.8 {d5}, [r4], r6
- vld1.8 {d6}, [r1], r3
- vld1.8 {d7}, [r4], r6
- vld1.8 {d8}, [r1], r3
- vld1.8 {d9}, [r4], r6
- vld1.8 {d10}, [r1], r3
- vld1.8 {d11}, [r4], r6
- vld1.8 {d12}, [r1], r3
- vld1.8 {d13}, [r4], r6
- vld1.8 {d14}, [r1], r3
- vld1.8 {d15}, [r4], r6
-
- vsubl.u8 q8, d0, d1
- vsubl.u8 q9, d2, d3
- vsubl.u8 q10, d4, d5
- vsubl.u8 q11, d6, d7
- vsubl.u8 q12, d8, d9
- vsubl.u8 q13, d10, d11
- vsubl.u8 q14, d12, d13
- vsubl.u8 q15, d14, d15
-
- vst1.16 {q8}, [r0], r12 ;store diff
- vst1.16 {q9}, [r7], r12
- vst1.16 {q10}, [r0], r12
- vst1.16 {q11}, [r7], r12
- vst1.16 {q12}, [r0], r12
- vst1.16 {q13}, [r7], r12
- vst1.16 {q14}, [r0], r12
- vst1.16 {q15}, [r7], r12
-
-;v
- vld1.8 {d0}, [r2], r3 ;load vsrc
- vld1.8 {d1}, [r5], r6 ;load vpred
- vld1.8 {d2}, [r2], r3
- vld1.8 {d3}, [r5], r6
- vld1.8 {d4}, [r2], r3
- vld1.8 {d5}, [r5], r6
- vld1.8 {d6}, [r2], r3
- vld1.8 {d7}, [r5], r6
- vld1.8 {d8}, [r2], r3
- vld1.8 {d9}, [r5], r6
- vld1.8 {d10}, [r2], r3
- vld1.8 {d11}, [r5], r6
- vld1.8 {d12}, [r2], r3
- vld1.8 {d13}, [r5], r6
- vld1.8 {d14}, [r2], r3
- vld1.8 {d15}, [r5], r6
-
- vsubl.u8 q8, d0, d1
- vsubl.u8 q9, d2, d3
- vsubl.u8 q10, d4, d5
- vsubl.u8 q11, d6, d7
- vsubl.u8 q12, d8, d9
- vsubl.u8 q13, d10, d11
- vsubl.u8 q14, d12, d13
- vsubl.u8 q15, d14, d15
-
- vst1.16 {q8}, [r0], r12 ;store diff
- vst1.16 {q9}, [r7], r12
- vst1.16 {q10}, [r0], r12
- vst1.16 {q11}, [r7], r12
- vst1.16 {q12}, [r0], r12
- vst1.16 {q13}, [r7], r12
- vst1.16 {q14}, [r0], r12
- vst1.16 {q15}, [r7], r12
-
- pop {r4-r7}
- bx lr
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_memcpy_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
deleted file mode 100644
index 5b9f11e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_memcpy_partial_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-;=========================================
-;this is not a full memcpy function!!!
-;void vp8_memcpy_partial_neon(unsigned char *dst_ptr, unsigned char *src_ptr,
-; int sz);
-|vp8_memcpy_partial_neon| PROC
- ;pld [r1] ;preload pred data
- ;pld [r1, #128]
- ;pld [r1, #256]
- ;pld [r1, #384]
-
- mov r12, r2, lsr #8 ;copy 256 bytes data at one time
-
-memcpy_neon_loop
- vld1.8 {q0, q1}, [r1]! ;load src data
- subs r12, r12, #1
- vld1.8 {q2, q3}, [r1]!
- vst1.8 {q0, q1}, [r0]! ;copy to dst_ptr
- vld1.8 {q4, q5}, [r1]!
- vst1.8 {q2, q3}, [r0]!
- vld1.8 {q6, q7}, [r1]!
- vst1.8 {q4, q5}, [r0]!
- vld1.8 {q8, q9}, [r1]!
- vst1.8 {q6, q7}, [r0]!
- vld1.8 {q10, q11}, [r1]!
- vst1.8 {q8, q9}, [r0]!
- vld1.8 {q12, q13}, [r1]!
- vst1.8 {q10, q11}, [r0]!
- vld1.8 {q14, q15}, [r1]!
- vst1.8 {q12, q13}, [r0]!
- vst1.8 {q14, q15}, [r0]!
-
- ;pld [r1] ;preload pred data -- need to adjust for real device
- ;pld [r1, #128]
- ;pld [r1, #256]
- ;pld [r1, #384]
-
- bne memcpy_neon_loop
-
- ands r3, r2, #0xff ;extra copy
- beq done_copy_neon_loop
-
-extra_copy_neon_loop
- vld1.8 {q0}, [r1]! ;load src data
- subs r3, r3, #16
- vst1.8 {q0}, [r0]!
- bne extra_copy_neon_loop
-
-done_copy_neon_loop
- bx lr
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
deleted file mode 100644
index 55edbf5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
+++ /dev/null
@@ -1,116 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_mse16x16_neon|
- EXPORT |vp8_get4x4sse_cs_neon|
-
- 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
-;note: in this function, sum is never used. So, we can remove this part of calculation
-;from vp8_variance().
-
-|vp8_mse16x16_neon| PROC
- vmov.i8 q7, #0 ;q7, q8, q9, q10 - sse
- vmov.i8 q8, #0
- vmov.i8 q9, #0
- vmov.i8 q10, #0
-
- mov r12, #8
-
-mse16x16_neon_loop
- vld1.8 {q0}, [r0], r1 ;Load up source and reference
- vld1.8 {q2}, [r2], r3
- vld1.8 {q1}, [r0], r1
- vld1.8 {q3}, [r2], r3
-
- vsubl.u8 q11, d0, d4
- vsubl.u8 q12, d1, d5
- vsubl.u8 q13, d2, d6
- vsubl.u8 q14, d3, d7
-
- vmlal.s16 q7, d22, d22
- vmlal.s16 q8, d23, d23
-
- subs r12, r12, #1
-
- vmlal.s16 q9, d24, d24
- vmlal.s16 q10, d25, d25
- vmlal.s16 q7, d26, d26
- vmlal.s16 q8, d27, d27
- vmlal.s16 q9, d28, d28
- vmlal.s16 q10, d29, d29
-
- bne mse16x16_neon_loop
-
- vadd.u32 q7, q7, q8
- vadd.u32 q9, q9, q10
-
- ldr r12, [sp] ;load *sse from stack
-
- vadd.u32 q10, q7, q9
- vpaddl.u32 q1, q10
- vadd.u64 d0, d2, d3
-
- vst1.32 {d0[0]}, [r12]
- vmov.32 r0, d0[0]
-
- bx lr
-
- ENDP
-
-
-;=============================
-; r0 unsigned char *src_ptr,
-; r1 int source_stride,
-; r2 unsigned char *ref_ptr,
-; r3 int recon_stride
-|vp8_get4x4sse_cs_neon| PROC
- vld1.8 {d0}, [r0], r1 ;Load up source and reference
- vld1.8 {d4}, [r2], r3
- vld1.8 {d1}, [r0], r1
- vld1.8 {d5}, [r2], r3
- vld1.8 {d2}, [r0], r1
- vld1.8 {d6}, [r2], r3
- vld1.8 {d3}, [r0], r1
- vld1.8 {d7}, [r2], r3
-
- vsubl.u8 q11, d0, d4
- vsubl.u8 q12, d1, d5
- vsubl.u8 q13, d2, d6
- vsubl.u8 q14, d3, d7
-
- vmull.s16 q7, d22, d22
- vmull.s16 q8, d24, d24
- vmull.s16 q9, d26, d26
- vmull.s16 q10, d28, d28
-
- vadd.u32 q7, q7, q8
- vadd.u32 q9, q9, q10
- vadd.u32 q9, q7, q9
-
- vpaddl.u32 q1, q9
- vadd.u64 d0, d2, d3
-
- vmov.32 r0, d0[0]
- bx lr
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
deleted file mode 100644
index 2226629..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
+++ /dev/null
@@ -1,103 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_short_walsh4x4_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-;void vp8_short_walsh4x4_neon(short *input, short *output, int pitch)
-; r0 short *input,
-; r1 short *output,
-; r2 int pitch
-|vp8_short_walsh4x4_neon| PROC
-
- vld1.16 {d0}, [r0@64], r2 ; load input
- vld1.16 {d1}, [r0@64], r2
- vld1.16 {d2}, [r0@64], r2
- vld1.16 {d3}, [r0@64]
-
- ;First for-loop
- ;transpose d0, d1, d2, d3. Then, d0=ip[0], d1=ip[1], d2=ip[2], d3=ip[3]
- vtrn.32 d0, d2
- vtrn.32 d1, d3
-
- vmov.s32 q15, #3 ; add 3 to all values
-
- vtrn.16 d0, d1
- vtrn.16 d2, d3
-
- vadd.s16 d4, d0, d2 ; ip[0] + ip[2]
- vadd.s16 d5, d1, d3 ; ip[1] + ip[3]
- vsub.s16 d6, d1, d3 ; ip[1] - ip[3]
- vsub.s16 d7, d0, d2 ; ip[0] - ip[2]
-
- vshl.s16 d4, d4, #2 ; a1 = (ip[0] + ip[2]) << 2
- vshl.s16 d5, d5, #2 ; d1 = (ip[1] + ip[3]) << 2
- vshl.s16 d6, d6, #2 ; c1 = (ip[1] - ip[3]) << 2
- vceq.s16 d16, d4, #0 ; a1 == 0
- vshl.s16 d7, d7, #2 ; b1 = (ip[0] - ip[2]) << 2
-
- vadd.s16 d0, d4, d5 ; a1 + d1
- vmvn d16, d16 ; a1 != 0
- vsub.s16 d3, d4, d5 ; op[3] = a1 - d1
- vadd.s16 d1, d7, d6 ; op[1] = b1 + c1
- vsub.s16 d2, d7, d6 ; op[2] = b1 - c1
- vsub.s16 d0, d0, d16 ; op[0] = a1 + d1 + (a1 != 0)
-
- ;Second for-loop
- ;transpose d0, d1, d2, d3, Then, d0=ip[0], d1=ip[4], d2=ip[8], d3=ip[12]
- vtrn.32 d1, d3
- vtrn.32 d0, d2
- vtrn.16 d2, d3
- vtrn.16 d0, d1
-
- vaddl.s16 q8, d0, d2 ; a1 = ip[0]+ip[8]
- vaddl.s16 q9, d1, d3 ; d1 = ip[4]+ip[12]
- vsubl.s16 q10, d1, d3 ; c1 = ip[4]-ip[12]
- vsubl.s16 q11, d0, d2 ; b1 = ip[0]-ip[8]
-
- vadd.s32 q0, q8, q9 ; a2 = a1 + d1
- vadd.s32 q1, q11, q10 ; b2 = b1 + c1
- vsub.s32 q2, q11, q10 ; c2 = b1 - c1
- vsub.s32 q3, q8, q9 ; d2 = a1 - d1
-
- vclt.s32 q8, q0, #0
- vclt.s32 q9, q1, #0
- vclt.s32 q10, q2, #0
- vclt.s32 q11, q3, #0
-
- ; subtract -1 (or 0)
- vsub.s32 q0, q0, q8 ; a2 += a2 < 0
- vsub.s32 q1, q1, q9 ; b2 += b2 < 0
- vsub.s32 q2, q2, q10 ; c2 += c2 < 0
- vsub.s32 q3, q3, q11 ; d2 += d2 < 0
-
- vadd.s32 q8, q0, q15 ; a2 + 3
- vadd.s32 q9, q1, q15 ; b2 + 3
- vadd.s32 q10, q2, q15 ; c2 + 3
- vadd.s32 q11, q3, q15 ; d2 + 3
-
- ; vrshrn? would add 1 << 3-1 = 2
- vshrn.s32 d0, q8, #3
- vshrn.s32 d1, q9, #3
- vshrn.s32 d2, q10, #3
- vshrn.s32 d3, q11, #3
-
- vst1.16 {q0, q1}, [r1@128]
-
- bx lr
-
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/quantize_arm.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/quantize_arm.c
deleted file mode 100644
index 80d9ad0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/arm/quantize_arm.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vp8/encoder/block.h"
-#include <math.h>
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/encoder/quantize.h"
-#include "vp8/common/entropy.h"
-
-
-#if HAVE_NEON
-
-/* vp8_quantize_mbX functions here differs from corresponding ones in
- * quantize.c only by using quantize_b_pair function pointer instead of
- * the regular quantize_b function pointer */
-void vp8_quantize_mby_neon(MACROBLOCK *x)
-{
- int i;
- int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
-
- for (i = 0; i < 16; i+=2)
- x->quantize_b_pair(&x->block[i], &x->block[i+1],
- &x->e_mbd.block[i], &x->e_mbd.block[i+1]);
-
- if(has_2nd_order)
- x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
-}
-
-void vp8_quantize_mb_neon(MACROBLOCK *x)
-{
- int i;
- int has_2nd_order=(x->e_mbd.mode_info_context->mbmi.mode != B_PRED
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
-
- for (i = 0; i < 24; i+=2)
- x->quantize_b_pair(&x->block[i], &x->block[i+1],
- &x->e_mbd.block[i], &x->e_mbd.block[i+1]);
-
- if (has_2nd_order)
- x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
-}
-
-
-void vp8_quantize_mbuv_neon(MACROBLOCK *x)
-{
- int i;
-
- for (i = 16; i < 24; i+=2)
- x->quantize_b_pair(&x->block[i], &x->block[i+1],
- &x->e_mbd.block[i], &x->e_mbd.block[i+1]);
-}
-
-#endif /* HAVE_NEON */
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.c
deleted file mode 100644
index 78e54e2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.c
+++ /dev/null
@@ -1,1738 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/common/header.h"
-#include "encodemv.h"
-#include "vp8/common/entropymode.h"
-#include "vp8/common/findnearmv.h"
-#include "mcomp.h"
-#include "vp8/common/systemdependent.h"
-#include <assert.h>
-#include <stdio.h>
-#include <limits.h>
-#include "vp8/common/pragmas.h"
-#include "vpx/vpx_encoder.h"
-#include "vpx_mem/vpx_mem.h"
-#include "bitstream.h"
-
-#include "defaultcoefcounts.h"
-#include "vp8/common/common.h"
-
-const int vp8cx_base_skip_false_prob[128] =
-{
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255,
- 251, 248, 244, 240, 236, 232, 229, 225,
- 221, 217, 213, 208, 204, 199, 194, 190,
- 187, 183, 179, 175, 172, 168, 164, 160,
- 157, 153, 149, 145, 142, 138, 134, 130,
- 127, 124, 120, 117, 114, 110, 107, 104,
- 101, 98, 95, 92, 89, 86, 83, 80,
- 77, 74, 71, 68, 65, 62, 59, 56,
- 53, 50, 47, 44, 41, 38, 35, 32,
- 30, 28, 26, 24, 22, 20, 18, 16,
-};
-
-#if defined(SECTIONBITS_OUTPUT)
-unsigned __int64 Sectionbits[500];
-#endif
-
-#ifdef VP8_ENTROPY_STATS
-int intra_mode_stats[10][10][10];
-static unsigned int tree_update_hist [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] [2];
-extern unsigned int active_section;
-#endif
-
-#ifdef MODE_STATS
-int count_mb_seg[4] = { 0, 0, 0, 0 };
-#endif
-
-
-static void update_mode(
- vp8_writer *const w,
- int n,
- vp8_token tok [/* n */],
- vp8_tree tree,
- vp8_prob Pnew [/* n-1 */],
- vp8_prob Pcur [/* n-1 */],
- unsigned int bct [/* n-1 */] [2],
- const unsigned int num_events[/* n */]
-)
-{
- unsigned int new_b = 0, old_b = 0;
- int i = 0;
-
- vp8_tree_probs_from_distribution(
- n--, tok, tree,
- Pnew, bct, num_events,
- 256, 1
- );
-
- do
- {
- new_b += vp8_cost_branch(bct[i], Pnew[i]);
- old_b += vp8_cost_branch(bct[i], Pcur[i]);
- }
- while (++i < n);
-
- if (new_b + (n << 8) < old_b)
- {
- int j = 0;
-
- vp8_write_bit(w, 1);
-
- do
- {
- const vp8_prob p = Pnew[j];
-
- vp8_write_literal(w, Pcur[j] = p ? p : 1, 8);
- }
- while (++j < n);
- }
- else
- vp8_write_bit(w, 0);
-}
-
-static void update_mbintra_mode_probs(VP8_COMP *cpi)
-{
- VP8_COMMON *const x = & cpi->common;
-
- vp8_writer *const w = cpi->bc;
-
- {
- vp8_prob Pnew [VP8_YMODES-1];
- unsigned int bct [VP8_YMODES-1] [2];
-
- update_mode(
- w, VP8_YMODES, vp8_ymode_encodings, vp8_ymode_tree,
- Pnew, x->fc.ymode_prob, bct, (unsigned int *)cpi->mb.ymode_count
- );
- }
- {
- vp8_prob Pnew [VP8_UV_MODES-1];
- unsigned int bct [VP8_UV_MODES-1] [2];
-
- update_mode(
- w, VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
- Pnew, x->fc.uv_mode_prob, bct, (unsigned int *)cpi->mb.uv_mode_count
- );
- }
-}
-
-static void write_ymode(vp8_writer *bc, int m, const vp8_prob *p)
-{
- vp8_write_token(bc, vp8_ymode_tree, p, vp8_ymode_encodings + m);
-}
-
-static void kfwrite_ymode(vp8_writer *bc, int m, const vp8_prob *p)
-{
- vp8_write_token(bc, vp8_kf_ymode_tree, p, vp8_kf_ymode_encodings + m);
-}
-
-static void write_uv_mode(vp8_writer *bc, int m, const vp8_prob *p)
-{
- vp8_write_token(bc, vp8_uv_mode_tree, p, vp8_uv_mode_encodings + m);
-}
-
-
-static void write_bmode(vp8_writer *bc, int m, const vp8_prob *p)
-{
- vp8_write_token(bc, vp8_bmode_tree, p, vp8_bmode_encodings + m);
-}
-
-static void write_split(vp8_writer *bc, int x)
-{
- vp8_write_token(
- bc, vp8_mbsplit_tree, vp8_mbsplit_probs, vp8_mbsplit_encodings + x
- );
-}
-
-void vp8_pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount)
-{
- const TOKENEXTRA *stop = p + xcount;
- unsigned int split;
- unsigned int shift;
- int count = w->count;
- unsigned int range = w->range;
- unsigned int lowvalue = w->lowvalue;
-
- while (p < stop)
- {
- const int t = p->Token;
- vp8_token *a = vp8_coef_encodings + t;
- const vp8_extra_bit_struct *b = vp8_extra_bits + t;
- int i = 0;
- const unsigned char *pp = p->context_tree;
- int v = a->value;
- int n = a->Len;
-
- if (p->skip_eob_node)
- {
- n--;
- i = 2;
- }
-
- do
- {
- const int bb = (v >> --n) & 1;
- split = 1 + (((range - 1) * pp[i>>1]) >> 8);
- i = vp8_coef_tree[i+bb];
-
- if (bb)
- {
- lowvalue += split;
- range = range - split;
- }
- else
- {
- range = split;
- }
-
- shift = vp8_norm[range];
- range <<= shift;
- count += shift;
-
- if (count >= 0)
- {
- int offset = shift - count;
-
- if ((lowvalue << (offset - 1)) & 0x80000000)
- {
- int x = w->pos - 1;
-
- while (x >= 0 && w->buffer[x] == 0xff)
- {
- w->buffer[x] = (unsigned char)0;
- x--;
- }
-
- w->buffer[x] += 1;
- }
-
- validate_buffer(w->buffer + w->pos,
- 1,
- w->buffer_end,
- w->error);
-
- w->buffer[w->pos++] = (lowvalue >> (24 - offset));
- lowvalue <<= offset;
- shift = count;
- lowvalue &= 0xffffff;
- count -= 8 ;
- }
-
- lowvalue <<= shift;
- }
- while (n);
-
-
- if (b->base_val)
- {
- const int e = p->Extra, L = b->Len;
-
- if (L)
- {
- const unsigned char *proba = b->prob;
- const int v2 = e >> 1;
- int n2 = L; /* number of bits in v2, assumed nonzero */
- i = 0;
-
- do
- {
- const int bb = (v2 >> --n2) & 1;
- split = 1 + (((range - 1) * proba[i>>1]) >> 8);
- i = b->tree[i+bb];
-
- if (bb)
- {
- lowvalue += split;
- range = range - split;
- }
- else
- {
- range = split;
- }
-
- shift = vp8_norm[range];
- range <<= shift;
- count += shift;
-
- if (count >= 0)
- {
- int offset = shift - count;
-
- if ((lowvalue << (offset - 1)) & 0x80000000)
- {
- int x = w->pos - 1;
-
- while (x >= 0 && w->buffer[x] == 0xff)
- {
- w->buffer[x] = (unsigned char)0;
- x--;
- }
-
- w->buffer[x] += 1;
- }
-
- validate_buffer(w->buffer + w->pos,
- 1,
- w->buffer_end,
- w->error);
-
- w->buffer[w->pos++] = (lowvalue >> (24 - offset));
- lowvalue <<= offset;
- shift = count;
- lowvalue &= 0xffffff;
- count -= 8 ;
- }
-
- lowvalue <<= shift;
- }
- while (n2);
- }
-
-
- {
-
- split = (range + 1) >> 1;
-
- if (e & 1)
- {
- lowvalue += split;
- range = range - split;
- }
- else
- {
- range = split;
- }
-
- range <<= 1;
-
- if ((lowvalue & 0x80000000))
- {
- int x = w->pos - 1;
-
- while (x >= 0 && w->buffer[x] == 0xff)
- {
- w->buffer[x] = (unsigned char)0;
- x--;
- }
-
- w->buffer[x] += 1;
-
- }
-
- lowvalue <<= 1;
-
- if (!++count)
- {
- count = -8;
-
- validate_buffer(w->buffer + w->pos,
- 1,
- w->buffer_end,
- w->error);
-
- w->buffer[w->pos++] = (lowvalue >> 24);
- lowvalue &= 0xffffff;
- }
- }
-
- }
-
- ++p;
- }
-
- w->count = count;
- w->lowvalue = lowvalue;
- w->range = range;
-
-}
-
-static void write_partition_size(unsigned char *cx_data, int size)
-{
- signed char csize;
-
- csize = size & 0xff;
- *cx_data = csize;
- csize = (size >> 8) & 0xff;
- *(cx_data + 1) = csize;
- csize = (size >> 16) & 0xff;
- *(cx_data + 2) = csize;
-
-}
-
-static void pack_tokens_into_partitions_c(VP8_COMP *cpi, unsigned char *cx_data,
- unsigned char * cx_data_end,
- int num_part)
-{
-
- int i;
- unsigned char *ptr = cx_data;
- unsigned char *ptr_end = cx_data_end;
- vp8_writer * w;
-
- for (i = 0; i < num_part; i++)
- {
- int mb_row;
-
- w = cpi->bc + i + 1;
-
- vp8_start_encode(w, ptr, ptr_end);
-
- for (mb_row = i; mb_row < cpi->common.mb_rows; mb_row += num_part)
- {
- const TOKENEXTRA *p = cpi->tplist[mb_row].start;
- const TOKENEXTRA *stop = cpi->tplist[mb_row].stop;
- int tokens = (int)(stop - p);
-
- vp8_pack_tokens_c(w, p, tokens);
- }
-
- vp8_stop_encode(w);
- ptr += w->pos;
- }
-}
-
-
-static void pack_mb_row_tokens_c(VP8_COMP *cpi, vp8_writer *w)
-{
- int mb_row;
-
- for (mb_row = 0; mb_row < cpi->common.mb_rows; mb_row++)
- {
- const TOKENEXTRA *p = cpi->tplist[mb_row].start;
- const TOKENEXTRA *stop = cpi->tplist[mb_row].stop;
- int tokens = (int)(stop - p);
-
- vp8_pack_tokens_c(w, p, tokens);
- }
-
-}
-
-static void write_mv_ref
-(
- vp8_writer *w, MB_PREDICTION_MODE m, const vp8_prob *p
-)
-{
-#if CONFIG_DEBUG
- assert(NEARESTMV <= m && m <= SPLITMV);
-#endif
- vp8_write_token(w, vp8_mv_ref_tree, p,
- vp8_mv_ref_encoding_array + (m - NEARESTMV));
-}
-
-static void write_sub_mv_ref
-(
- vp8_writer *w, B_PREDICTION_MODE m, const vp8_prob *p
-)
-{
-#if CONFIG_DEBUG
- assert(LEFT4X4 <= m && m <= NEW4X4);
-#endif
- vp8_write_token(w, vp8_sub_mv_ref_tree, p,
- vp8_sub_mv_ref_encoding_array + (m - LEFT4X4));
-}
-
-static void write_mv
-(
- vp8_writer *w, const MV *mv, const int_mv *ref, const MV_CONTEXT *mvc
-)
-{
- MV e;
- e.row = mv->row - ref->as_mv.row;
- e.col = mv->col - ref->as_mv.col;
-
- vp8_encode_motion_vector(w, &e, mvc);
-}
-
-static void write_mb_features(vp8_writer *w, const MB_MODE_INFO *mi, const MACROBLOCKD *x)
-{
- /* Encode the MB segment id. */
- if (x->segmentation_enabled && x->update_mb_segmentation_map)
- {
- switch (mi->segment_id)
- {
- case 0:
- vp8_write(w, 0, x->mb_segment_tree_probs[0]);
- vp8_write(w, 0, x->mb_segment_tree_probs[1]);
- break;
- case 1:
- vp8_write(w, 0, x->mb_segment_tree_probs[0]);
- vp8_write(w, 1, x->mb_segment_tree_probs[1]);
- break;
- case 2:
- vp8_write(w, 1, x->mb_segment_tree_probs[0]);
- vp8_write(w, 0, x->mb_segment_tree_probs[2]);
- break;
- case 3:
- vp8_write(w, 1, x->mb_segment_tree_probs[0]);
- vp8_write(w, 1, x->mb_segment_tree_probs[2]);
- break;
-
- /* TRAP.. This should not happen */
- default:
- vp8_write(w, 0, x->mb_segment_tree_probs[0]);
- vp8_write(w, 0, x->mb_segment_tree_probs[1]);
- break;
- }
- }
-}
-void vp8_convert_rfct_to_prob(VP8_COMP *const cpi)
-{
- const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
- const int rf_intra = rfct[INTRA_FRAME];
- const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
-
- /* Calculate the probabilities used to code the ref frame based on usage */
- if (!(cpi->prob_intra_coded = rf_intra * 255 / (rf_intra + rf_inter)))
- cpi->prob_intra_coded = 1;
-
- cpi->prob_last_coded = rf_inter ? (rfct[LAST_FRAME] * 255) / rf_inter : 128;
-
- if (!cpi->prob_last_coded)
- cpi->prob_last_coded = 1;
-
- cpi->prob_gf_coded = (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME])
- ? (rfct[GOLDEN_FRAME] * 255) / (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME]) : 128;
-
- if (!cpi->prob_gf_coded)
- cpi->prob_gf_coded = 1;
-
-}
-
-static void pack_inter_mode_mvs(VP8_COMP *const cpi)
-{
- VP8_COMMON *const pc = & cpi->common;
- vp8_writer *const w = cpi->bc;
- const MV_CONTEXT *mvc = pc->fc.mvc;
-
-
- MODE_INFO *m = pc->mi;
- const int mis = pc->mode_info_stride;
- int mb_row = -1;
-
- int prob_skip_false = 0;
-
- cpi->mb.partition_info = cpi->mb.pi;
-
- vp8_convert_rfct_to_prob(cpi);
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 1;
-#endif
-
- if (pc->mb_no_coeff_skip)
- {
- int total_mbs = pc->mb_rows * pc->mb_cols;
-
- prob_skip_false = (total_mbs - cpi->mb.skip_true_count ) * 256 / total_mbs;
-
- if (prob_skip_false <= 1)
- prob_skip_false = 1;
-
- if (prob_skip_false > 255)
- prob_skip_false = 255;
-
- cpi->prob_skip_false = prob_skip_false;
- vp8_write_literal(w, prob_skip_false, 8);
- }
-
- vp8_write_literal(w, cpi->prob_intra_coded, 8);
- vp8_write_literal(w, cpi->prob_last_coded, 8);
- vp8_write_literal(w, cpi->prob_gf_coded, 8);
-
- update_mbintra_mode_probs(cpi);
-
- vp8_write_mvprobs(cpi);
-
- while (++mb_row < pc->mb_rows)
- {
- int mb_col = -1;
-
- while (++mb_col < pc->mb_cols)
- {
- const MB_MODE_INFO *const mi = & m->mbmi;
- const MV_REFERENCE_FRAME rf = mi->ref_frame;
- const MB_PREDICTION_MODE mode = mi->mode;
-
- MACROBLOCKD *xd = &cpi->mb.e_mbd;
-
- /* Distance of Mb to the various image edges.
- * These specified to 8th pel as they are always compared to MV
- * values that are in 1/8th pel units
- */
- xd->mb_to_left_edge = -((mb_col * 16) << 3);
- xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3;
- xd->mb_to_top_edge = -((mb_row * 16) << 3);
- xd->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3;
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 9;
-#endif
-
- if (cpi->mb.e_mbd.update_mb_segmentation_map)
- write_mb_features(w, mi, &cpi->mb.e_mbd);
-
- if (pc->mb_no_coeff_skip)
- vp8_encode_bool(w, m->mbmi.mb_skip_coeff, prob_skip_false);
-
- if (rf == INTRA_FRAME)
- {
- vp8_write(w, 0, cpi->prob_intra_coded);
-#ifdef VP8_ENTROPY_STATS
- active_section = 6;
-#endif
- write_ymode(w, mode, pc->fc.ymode_prob);
-
- if (mode == B_PRED)
- {
- int j = 0;
-
- do
- write_bmode(w, m->bmi[j].as_mode, pc->fc.bmode_prob);
- while (++j < 16);
- }
-
- write_uv_mode(w, mi->uv_mode, pc->fc.uv_mode_prob);
- }
- else /* inter coded */
- {
- int_mv best_mv;
- vp8_prob mv_ref_p [VP8_MVREFS-1];
-
- vp8_write(w, 1, cpi->prob_intra_coded);
-
- if (rf == LAST_FRAME)
- vp8_write(w, 0, cpi->prob_last_coded);
- else
- {
- vp8_write(w, 1, cpi->prob_last_coded);
- vp8_write(w, (rf == GOLDEN_FRAME) ? 0 : 1, cpi->prob_gf_coded);
- }
-
- {
- int_mv n1, n2;
- int ct[4];
-
- vp8_find_near_mvs(xd, m, &n1, &n2, &best_mv, ct, rf, cpi->common.ref_frame_sign_bias);
- vp8_clamp_mv2(&best_mv, xd);
-
- vp8_mv_ref_probs(mv_ref_p, ct);
-
-#ifdef VP8_ENTROPY_STATS
- accum_mv_refs(mode, ct);
-#endif
-
- }
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 3;
-#endif
-
- write_mv_ref(w, mode, mv_ref_p);
-
- switch (mode) /* new, split require MVs */
- {
- case NEWMV:
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 5;
-#endif
-
- write_mv(w, &mi->mv.as_mv, &best_mv, mvc);
- break;
-
- case SPLITMV:
- {
- int j = 0;
-
-#ifdef MODE_STATS
- ++count_mb_seg [mi->partitioning];
-#endif
-
- write_split(w, mi->partitioning);
-
- do
- {
- B_PREDICTION_MODE blockmode;
- int_mv blockmv;
- const int *const L = vp8_mbsplits [mi->partitioning];
- int k = -1; /* first block in subset j */
- int mv_contz;
- int_mv leftmv, abovemv;
-
- blockmode = cpi->mb.partition_info->bmi[j].mode;
- blockmv = cpi->mb.partition_info->bmi[j].mv;
-#if CONFIG_DEBUG
- while (j != L[++k])
- if (k >= 16)
- assert(0);
-#else
- while (j != L[++k]);
-#endif
- leftmv.as_int = left_block_mv(m, k);
- abovemv.as_int = above_block_mv(m, k, mis);
- mv_contz = vp8_mv_cont(&leftmv, &abovemv);
-
- write_sub_mv_ref(w, blockmode, vp8_sub_mv_ref_prob2 [mv_contz]);
-
- if (blockmode == NEW4X4)
- {
-#ifdef VP8_ENTROPY_STATS
- active_section = 11;
-#endif
- write_mv(w, &blockmv.as_mv, &best_mv, (const MV_CONTEXT *) mvc);
- }
- }
- while (++j < cpi->mb.partition_info->count);
- }
- break;
- default:
- break;
- }
- }
-
- ++m;
- cpi->mb.partition_info++;
- }
-
- ++m; /* skip L prediction border */
- cpi->mb.partition_info++;
- }
-}
-
-
-static void write_kfmodes(VP8_COMP *cpi)
-{
- vp8_writer *const bc = cpi->bc;
- const VP8_COMMON *const c = & cpi->common;
- /* const */
- MODE_INFO *m = c->mi;
-
- int mb_row = -1;
- int prob_skip_false = 0;
-
- if (c->mb_no_coeff_skip)
- {
- int total_mbs = c->mb_rows * c->mb_cols;
-
- prob_skip_false = (total_mbs - cpi->mb.skip_true_count ) * 256 / total_mbs;
-
- if (prob_skip_false <= 1)
- prob_skip_false = 1;
-
- if (prob_skip_false >= 255)
- prob_skip_false = 255;
-
- cpi->prob_skip_false = prob_skip_false;
- vp8_write_literal(bc, prob_skip_false, 8);
- }
-
- while (++mb_row < c->mb_rows)
- {
- int mb_col = -1;
-
- while (++mb_col < c->mb_cols)
- {
- const int ym = m->mbmi.mode;
-
- if (cpi->mb.e_mbd.update_mb_segmentation_map)
- write_mb_features(bc, &m->mbmi, &cpi->mb.e_mbd);
-
- if (c->mb_no_coeff_skip)
- vp8_encode_bool(bc, m->mbmi.mb_skip_coeff, prob_skip_false);
-
- kfwrite_ymode(bc, ym, vp8_kf_ymode_prob);
-
- if (ym == B_PRED)
- {
- const int mis = c->mode_info_stride;
- int i = 0;
-
- do
- {
- const B_PREDICTION_MODE A = above_block_mode(m, i, mis);
- const B_PREDICTION_MODE L = left_block_mode(m, i);
- const int bm = m->bmi[i].as_mode;
-
-#ifdef VP8_ENTROPY_STATS
- ++intra_mode_stats [A] [L] [bm];
-#endif
-
- write_bmode(bc, bm, vp8_kf_bmode_prob [A] [L]);
- }
- while (++i < 16);
- }
-
- write_uv_mode(bc, (m++)->mbmi.uv_mode, vp8_kf_uv_mode_prob);
- }
-
- m++; /* skip L prediction border */
- }
-}
-
-#if 0
-/* This function is used for debugging probability trees. */
-static void print_prob_tree(vp8_prob
- coef_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES])
-{
- /* print coef probability tree */
- int i,j,k,l;
- FILE* f = fopen("enc_tree_probs.txt", "a");
- fprintf(f, "{\n");
- for (i = 0; i < BLOCK_TYPES; i++)
- {
- fprintf(f, " {\n");
- for (j = 0; j < COEF_BANDS; j++)
- {
- fprintf(f, " {\n");
- for (k = 0; k < PREV_COEF_CONTEXTS; k++)
- {
- fprintf(f, " {");
- for (l = 0; l < ENTROPY_NODES; l++)
- {
- fprintf(f, "%3u, ",
- (unsigned int)(coef_probs [i][j][k][l]));
- }
- fprintf(f, " }\n");
- }
- fprintf(f, " }\n");
- }
- fprintf(f, " }\n");
- }
- fprintf(f, "}\n");
- fclose(f);
-}
-#endif
-
-static void sum_probs_over_prev_coef_context(
- const unsigned int probs[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS],
- unsigned int* out)
-{
- int i, j;
- for (i=0; i < MAX_ENTROPY_TOKENS; ++i)
- {
- for (j=0; j < PREV_COEF_CONTEXTS; ++j)
- {
- const unsigned int tmp = out[i];
- out[i] += probs[j][i];
- /* check for wrap */
- if (out[i] < tmp)
- out[i] = UINT_MAX;
- }
- }
-}
-
-static int prob_update_savings(const unsigned int *ct,
- const vp8_prob oldp, const vp8_prob newp,
- const vp8_prob upd)
-{
- const int old_b = vp8_cost_branch(ct, oldp);
- const int new_b = vp8_cost_branch(ct, newp);
- const int update_b = 8 +
- ((vp8_cost_one(upd) - vp8_cost_zero(upd)) >> 8);
-
- return old_b - new_b - update_b;
-}
-
-static int independent_coef_context_savings(VP8_COMP *cpi)
-{
- MACROBLOCK *const x = & cpi->mb;
- int savings = 0;
- int i = 0;
- do
- {
- int j = 0;
- do
- {
- int k = 0;
- unsigned int prev_coef_count_sum[MAX_ENTROPY_TOKENS] = {0};
- int prev_coef_savings[MAX_ENTROPY_TOKENS] = {0};
- const unsigned int (*probs)[MAX_ENTROPY_TOKENS];
- /* Calculate new probabilities given the constraint that
- * they must be equal over the prev coef contexts
- */
-
- probs = (const unsigned int (*)[MAX_ENTROPY_TOKENS])
- x->coef_counts[i][j];
-
- /* Reset to default probabilities at key frames */
- if (cpi->common.frame_type == KEY_FRAME)
- probs = default_coef_counts[i][j];
-
- sum_probs_over_prev_coef_context(probs, prev_coef_count_sum);
-
- do
- {
- /* at every context */
-
- /* calc probs and branch cts for this frame only */
- int t = 0; /* token/prob index */
-
- vp8_tree_probs_from_distribution(
- MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
- cpi->frame_coef_probs[i][j][k],
- cpi->frame_branch_ct [i][j][k],
- prev_coef_count_sum,
- 256, 1);
-
- do
- {
- const unsigned int *ct = cpi->frame_branch_ct [i][j][k][t];
- const vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
- const vp8_prob oldp = cpi->common.fc.coef_probs [i][j][k][t];
- const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
- const int s = prob_update_savings(ct, oldp, newp, upd);
-
- if (cpi->common.frame_type != KEY_FRAME ||
- (cpi->common.frame_type == KEY_FRAME && newp != oldp))
- prev_coef_savings[t] += s;
- }
- while (++t < ENTROPY_NODES);
- }
- while (++k < PREV_COEF_CONTEXTS);
- k = 0;
- do
- {
- /* We only update probabilities if we can save bits, except
- * for key frames where we have to update all probabilities
- * to get the equal probabilities across the prev coef
- * contexts.
- */
- if (prev_coef_savings[k] > 0 ||
- cpi->common.frame_type == KEY_FRAME)
- savings += prev_coef_savings[k];
- }
- while (++k < ENTROPY_NODES);
- }
- while (++j < COEF_BANDS);
- }
- while (++i < BLOCK_TYPES);
- return savings;
-}
-
-static int default_coef_context_savings(VP8_COMP *cpi)
-{
- MACROBLOCK *const x = & cpi->mb;
- int savings = 0;
- int i = 0;
- do
- {
- int j = 0;
- do
- {
- int k = 0;
- do
- {
- /* at every context */
-
- /* calc probs and branch cts for this frame only */
- int t = 0; /* token/prob index */
-
- vp8_tree_probs_from_distribution(
- MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
- cpi->frame_coef_probs [i][j][k],
- cpi->frame_branch_ct [i][j][k],
- x->coef_counts [i][j][k],
- 256, 1
- );
-
- do
- {
- const unsigned int *ct = cpi->frame_branch_ct [i][j][k][t];
- const vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
- const vp8_prob oldp = cpi->common.fc.coef_probs [i][j][k][t];
- const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
- const int s = prob_update_savings(ct, oldp, newp, upd);
-
- if (s > 0)
- {
- savings += s;
- }
- }
- while (++t < ENTROPY_NODES);
- }
- while (++k < PREV_COEF_CONTEXTS);
- }
- while (++j < COEF_BANDS);
- }
- while (++i < BLOCK_TYPES);
- return savings;
-}
-
-void vp8_calc_ref_frame_costs(int *ref_frame_cost,
- int prob_intra,
- int prob_last,
- int prob_garf
- )
-{
- assert(prob_intra >= 0);
- assert(prob_intra <= 255);
- assert(prob_last >= 0);
- assert(prob_last <= 255);
- assert(prob_garf >= 0);
- assert(prob_garf <= 255);
- ref_frame_cost[INTRA_FRAME] = vp8_cost_zero(prob_intra);
- ref_frame_cost[LAST_FRAME] = vp8_cost_one(prob_intra)
- + vp8_cost_zero(prob_last);
- ref_frame_cost[GOLDEN_FRAME] = vp8_cost_one(prob_intra)
- + vp8_cost_one(prob_last)
- + vp8_cost_zero(prob_garf);
- ref_frame_cost[ALTREF_FRAME] = vp8_cost_one(prob_intra)
- + vp8_cost_one(prob_last)
- + vp8_cost_one(prob_garf);
-
-}
-
-int vp8_estimate_entropy_savings(VP8_COMP *cpi)
-{
- int savings = 0;
-
- const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
- const int rf_intra = rfct[INTRA_FRAME];
- const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
- int new_intra, new_last, new_garf, oldtotal, newtotal;
- int ref_frame_cost[MAX_REF_FRAMES];
-
- vp8_clear_system_state();
-
- if (cpi->common.frame_type != KEY_FRAME)
- {
- if (!(new_intra = rf_intra * 255 / (rf_intra + rf_inter)))
- new_intra = 1;
-
- new_last = rf_inter ? (rfct[LAST_FRAME] * 255) / rf_inter : 128;
-
- new_garf = (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME])
- ? (rfct[GOLDEN_FRAME] * 255) / (rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME]) : 128;
-
-
- vp8_calc_ref_frame_costs(ref_frame_cost,new_intra,new_last,new_garf);
-
- newtotal =
- rfct[INTRA_FRAME] * ref_frame_cost[INTRA_FRAME] +
- rfct[LAST_FRAME] * ref_frame_cost[LAST_FRAME] +
- rfct[GOLDEN_FRAME] * ref_frame_cost[GOLDEN_FRAME] +
- rfct[ALTREF_FRAME] * ref_frame_cost[ALTREF_FRAME];
-
-
- /* old costs */
- vp8_calc_ref_frame_costs(ref_frame_cost,cpi->prob_intra_coded,
- cpi->prob_last_coded,cpi->prob_gf_coded);
-
- oldtotal =
- rfct[INTRA_FRAME] * ref_frame_cost[INTRA_FRAME] +
- rfct[LAST_FRAME] * ref_frame_cost[LAST_FRAME] +
- rfct[GOLDEN_FRAME] * ref_frame_cost[GOLDEN_FRAME] +
- rfct[ALTREF_FRAME] * ref_frame_cost[ALTREF_FRAME];
-
- savings += (oldtotal - newtotal) / 256;
- }
-
-
- if (cpi->oxcf.error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS)
- savings += independent_coef_context_savings(cpi);
- else
- savings += default_coef_context_savings(cpi);
-
-
- return savings;
-}
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
-int vp8_update_coef_context(VP8_COMP *cpi)
-{
- int savings = 0;
-
-
- if (cpi->common.frame_type == KEY_FRAME)
- {
- /* Reset to default counts/probabilities at key frames */
- vp8_copy(cpi->mb.coef_counts, default_coef_counts);
- }
-
- if (cpi->oxcf.error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS)
- savings += independent_coef_context_savings(cpi);
- else
- savings += default_coef_context_savings(cpi);
-
- return savings;
-}
-#endif
-
-void vp8_update_coef_probs(VP8_COMP *cpi)
-{
- int i = 0;
-#if !(CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- vp8_writer *const w = cpi->bc;
-#endif
- int savings = 0;
-
- vp8_clear_system_state();
-
- do
- {
- int j = 0;
-
- do
- {
- int k = 0;
- int prev_coef_savings[ENTROPY_NODES] = {0};
- if (cpi->oxcf.error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS)
- {
- for (k = 0; k < PREV_COEF_CONTEXTS; ++k)
- {
- int t; /* token/prob index */
- for (t = 0; t < ENTROPY_NODES; ++t)
- {
- const unsigned int *ct = cpi->frame_branch_ct [i][j]
- [k][t];
- const vp8_prob newp = cpi->frame_coef_probs[i][j][k][t];
- const vp8_prob oldp = cpi->common.fc.coef_probs[i][j]
- [k][t];
- const vp8_prob upd = vp8_coef_update_probs[i][j][k][t];
-
- prev_coef_savings[t] +=
- prob_update_savings(ct, oldp, newp, upd);
- }
- }
- k = 0;
- }
- do
- {
- /* note: use result from vp8_estimate_entropy_savings, so no
- * need to call vp8_tree_probs_from_distribution here.
- */
-
- /* at every context */
-
- /* calc probs and branch cts for this frame only */
- int t = 0; /* token/prob index */
-
- do
- {
- const vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
-
- vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
- const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
-
- int s = prev_coef_savings[t];
- int u = 0;
-
- if (!(cpi->oxcf.error_resilient_mode &
- VPX_ERROR_RESILIENT_PARTITIONS))
- {
- s = prob_update_savings(
- cpi->frame_branch_ct [i][j][k][t],
- *Pold, newp, upd);
- }
-
- if (s > 0)
- u = 1;
-
- /* Force updates on key frames if the new is different,
- * so that we can be sure we end up with equal probabilities
- * over the prev coef contexts.
- */
- if ((cpi->oxcf.error_resilient_mode &
- VPX_ERROR_RESILIENT_PARTITIONS) &&
- cpi->common.frame_type == KEY_FRAME && newp != *Pold)
- u = 1;
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- cpi->update_probs[i][j][k][t] = u;
-#else
- vp8_write(w, u, upd);
-#endif
-
-
-#ifdef VP8_ENTROPY_STATS
- ++ tree_update_hist [i][j][k][t] [u];
-#endif
-
- if (u)
- {
- /* send/use new probability */
-
- *Pold = newp;
-#if !(CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- vp8_write_literal(w, newp, 8);
-#endif
-
- savings += s;
-
- }
-
- }
- while (++t < ENTROPY_NODES);
-
- /* Accum token counts for generation of default statistics */
-#ifdef VP8_ENTROPY_STATS
- t = 0;
-
- do
- {
- context_counters [i][j][k][t] += cpi->coef_counts [i][j][k][t];
- }
- while (++t < MAX_ENTROPY_TOKENS);
-
-#endif
-
- }
- while (++k < PREV_COEF_CONTEXTS);
- }
- while (++j < COEF_BANDS);
- }
- while (++i < BLOCK_TYPES);
-
-}
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
-static void pack_coef_probs(VP8_COMP *cpi)
-{
- int i = 0;
- vp8_writer *const w = cpi->bc;
-
- do
- {
- int j = 0;
-
- do
- {
- int k = 0;
-
- do
- {
- int t = 0; /* token/prob index */
-
- do
- {
- const vp8_prob newp = cpi->common.fc.coef_probs [i][j][k][t];
- const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
-
- const char u = cpi->update_probs[i][j][k][t] ;
-
- vp8_write(w, u, upd);
-
- if (u)
- {
- /* send/use new probability */
- vp8_write_literal(w, newp, 8);
- }
- }
- while (++t < ENTROPY_NODES);
- }
- while (++k < PREV_COEF_CONTEXTS);
- }
- while (++j < COEF_BANDS);
- }
- while (++i < BLOCK_TYPES);
-}
-#endif
-
-#ifdef PACKET_TESTING
-FILE *vpxlogc = 0;
-#endif
-
-static void put_delta_q(vp8_writer *bc, int delta_q)
-{
- if (delta_q != 0)
- {
- vp8_write_bit(bc, 1);
- vp8_write_literal(bc, abs(delta_q), 4);
-
- if (delta_q < 0)
- vp8_write_bit(bc, 1);
- else
- vp8_write_bit(bc, 0);
- }
- else
- vp8_write_bit(bc, 0);
-}
-
-void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest_end, unsigned long *size)
-{
- int i, j;
- VP8_HEADER oh;
- VP8_COMMON *const pc = & cpi->common;
- vp8_writer *const bc = cpi->bc;
- MACROBLOCKD *const xd = & cpi->mb.e_mbd;
- int extra_bytes_packed = 0;
-
- unsigned char *cx_data = dest;
- unsigned char *cx_data_end = dest_end;
- const int *mb_feature_data_bits;
-
- oh.show_frame = (int) pc->show_frame;
- oh.type = (int)pc->frame_type;
- oh.version = pc->version;
- oh.first_partition_length_in_bytes = 0;
-
- mb_feature_data_bits = vp8_mb_feature_data_bits;
-
- bc[0].error = &pc->error;
-
- validate_buffer(cx_data, 3, cx_data_end, &cpi->common.error);
- cx_data += 3;
-
-#if defined(SECTIONBITS_OUTPUT)
- Sectionbits[active_section = 1] += sizeof(VP8_HEADER) * 8 * 256;
-#endif
-
- /* every keyframe send startcode, width, height, scale factor, clamp
- * and color type
- */
- if (oh.type == KEY_FRAME)
- {
- int v;
-
- validate_buffer(cx_data, 7, cx_data_end, &cpi->common.error);
-
- /* Start / synch code */
- cx_data[0] = 0x9D;
- cx_data[1] = 0x01;
- cx_data[2] = 0x2a;
-
- v = (pc->horiz_scale << 14) | pc->Width;
- cx_data[3] = v;
- cx_data[4] = v >> 8;
-
- v = (pc->vert_scale << 14) | pc->Height;
- cx_data[5] = v;
- cx_data[6] = v >> 8;
-
-
- extra_bytes_packed = 7;
- cx_data += extra_bytes_packed ;
-
- vp8_start_encode(bc, cx_data, cx_data_end);
-
- /* signal clr type */
- vp8_write_bit(bc, 0);
- vp8_write_bit(bc, pc->clamp_type);
-
- }
- else
- vp8_start_encode(bc, cx_data, cx_data_end);
-
-
- /* Signal whether or not Segmentation is enabled */
- vp8_write_bit(bc, xd->segmentation_enabled);
-
- /* Indicate which features are enabled */
- if (xd->segmentation_enabled)
- {
- /* Signal whether or not the segmentation map is being updated. */
- vp8_write_bit(bc, xd->update_mb_segmentation_map);
- vp8_write_bit(bc, xd->update_mb_segmentation_data);
-
- if (xd->update_mb_segmentation_data)
- {
- signed char Data;
-
- vp8_write_bit(bc, xd->mb_segement_abs_delta);
-
- /* For each segmentation feature (Quant and loop filter level) */
- for (i = 0; i < MB_LVL_MAX; i++)
- {
- /* For each of the segments */
- for (j = 0; j < MAX_MB_SEGMENTS; j++)
- {
- Data = xd->segment_feature_data[i][j];
-
- /* Frame level data */
- if (Data)
- {
- vp8_write_bit(bc, 1);
-
- if (Data < 0)
- {
- Data = - Data;
- vp8_write_literal(bc, Data, mb_feature_data_bits[i]);
- vp8_write_bit(bc, 1);
- }
- else
- {
- vp8_write_literal(bc, Data, mb_feature_data_bits[i]);
- vp8_write_bit(bc, 0);
- }
- }
- else
- vp8_write_bit(bc, 0);
- }
- }
- }
-
- if (xd->update_mb_segmentation_map)
- {
- /* Write the probs used to decode the segment id for each mb */
- for (i = 0; i < MB_FEATURE_TREE_PROBS; i++)
- {
- int Data = xd->mb_segment_tree_probs[i];
-
- if (Data != 255)
- {
- vp8_write_bit(bc, 1);
- vp8_write_literal(bc, Data, 8);
- }
- else
- vp8_write_bit(bc, 0);
- }
- }
- }
-
- vp8_write_bit(bc, pc->filter_type);
- vp8_write_literal(bc, pc->filter_level, 6);
- vp8_write_literal(bc, pc->sharpness_level, 3);
-
- /* Write out loop filter deltas applied at the MB level based on mode
- * or ref frame (if they are enabled).
- */
- vp8_write_bit(bc, xd->mode_ref_lf_delta_enabled);
-
- if (xd->mode_ref_lf_delta_enabled)
- {
- /* Do the deltas need to be updated */
- int send_update = xd->mode_ref_lf_delta_update
- || cpi->oxcf.error_resilient_mode;
-
- vp8_write_bit(bc, send_update);
- if (send_update)
- {
- int Data;
-
- /* Send update */
- for (i = 0; i < MAX_REF_LF_DELTAS; i++)
- {
- Data = xd->ref_lf_deltas[i];
-
- /* Frame level data */
- if (xd->ref_lf_deltas[i] != xd->last_ref_lf_deltas[i]
- || cpi->oxcf.error_resilient_mode)
- {
- xd->last_ref_lf_deltas[i] = xd->ref_lf_deltas[i];
- vp8_write_bit(bc, 1);
-
- if (Data > 0)
- {
- vp8_write_literal(bc, (Data & 0x3F), 6);
- vp8_write_bit(bc, 0); /* sign */
- }
- else
- {
- Data = -Data;
- vp8_write_literal(bc, (Data & 0x3F), 6);
- vp8_write_bit(bc, 1); /* sign */
- }
- }
- else
- vp8_write_bit(bc, 0);
- }
-
- /* Send update */
- for (i = 0; i < MAX_MODE_LF_DELTAS; i++)
- {
- Data = xd->mode_lf_deltas[i];
-
- if (xd->mode_lf_deltas[i] != xd->last_mode_lf_deltas[i]
- || cpi->oxcf.error_resilient_mode)
- {
- xd->last_mode_lf_deltas[i] = xd->mode_lf_deltas[i];
- vp8_write_bit(bc, 1);
-
- if (Data > 0)
- {
- vp8_write_literal(bc, (Data & 0x3F), 6);
- vp8_write_bit(bc, 0); /* sign */
- }
- else
- {
- Data = -Data;
- vp8_write_literal(bc, (Data & 0x3F), 6);
- vp8_write_bit(bc, 1); /* sign */
- }
- }
- else
- vp8_write_bit(bc, 0);
- }
- }
- }
-
- /* signal here is multi token partition is enabled */
- vp8_write_literal(bc, pc->multi_token_partition, 2);
-
- /* Frame Qbaseline quantizer index */
- vp8_write_literal(bc, pc->base_qindex, 7);
-
- /* Transmit Dc, Second order and Uv quantizer delta information */
- put_delta_q(bc, pc->y1dc_delta_q);
- put_delta_q(bc, pc->y2dc_delta_q);
- put_delta_q(bc, pc->y2ac_delta_q);
- put_delta_q(bc, pc->uvdc_delta_q);
- put_delta_q(bc, pc->uvac_delta_q);
-
- /* When there is a key frame all reference buffers are updated using
- * the new key frame
- */
- if (pc->frame_type != KEY_FRAME)
- {
- /* Should the GF or ARF be updated using the transmitted frame
- * or buffer
- */
- vp8_write_bit(bc, pc->refresh_golden_frame);
- vp8_write_bit(bc, pc->refresh_alt_ref_frame);
-
- /* If not being updated from current frame should either GF or ARF
- * be updated from another buffer
- */
- if (!pc->refresh_golden_frame)
- vp8_write_literal(bc, pc->copy_buffer_to_gf, 2);
-
- if (!pc->refresh_alt_ref_frame)
- vp8_write_literal(bc, pc->copy_buffer_to_arf, 2);
-
- /* Indicate reference frame sign bias for Golden and ARF frames
- * (always 0 for last frame buffer)
- */
- vp8_write_bit(bc, pc->ref_frame_sign_bias[GOLDEN_FRAME]);
- vp8_write_bit(bc, pc->ref_frame_sign_bias[ALTREF_FRAME]);
- }
-
-#if !(CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- if (cpi->oxcf.error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS)
- {
- if (pc->frame_type == KEY_FRAME)
- pc->refresh_entropy_probs = 1;
- else
- pc->refresh_entropy_probs = 0;
- }
-#endif
-
- vp8_write_bit(bc, pc->refresh_entropy_probs);
-
- if (pc->frame_type != KEY_FRAME)
- vp8_write_bit(bc, pc->refresh_last_frame);
-
-#ifdef VP8_ENTROPY_STATS
-
- if (pc->frame_type == INTER_FRAME)
- active_section = 0;
- else
- active_section = 7;
-
-#endif
-
- vp8_clear_system_state();
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- pack_coef_probs(cpi);
-#else
- if (pc->refresh_entropy_probs == 0)
- {
- /* save a copy for later refresh */
- vpx_memcpy(&cpi->common.lfc, &cpi->common.fc, sizeof(cpi->common.fc));
- }
-
- vp8_update_coef_probs(cpi);
-#endif
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 2;
-#endif
-
- /* Write out the mb_no_coeff_skip flag */
- vp8_write_bit(bc, pc->mb_no_coeff_skip);
-
- if (pc->frame_type == KEY_FRAME)
- {
- write_kfmodes(cpi);
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 8;
-#endif
- }
- else
- {
- pack_inter_mode_mvs(cpi);
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 1;
-#endif
- }
-
- vp8_stop_encode(bc);
-
- cx_data += bc->pos;
-
- oh.first_partition_length_in_bytes = cpi->bc->pos;
-
- /* update frame tag */
- {
- int v = (oh.first_partition_length_in_bytes << 5) |
- (oh.show_frame << 4) |
- (oh.version << 1) |
- oh.type;
-
- dest[0] = v;
- dest[1] = v >> 8;
- dest[2] = v >> 16;
- }
-
- *size = VP8_HEADER_SIZE + extra_bytes_packed + cpi->bc->pos;
-
- cpi->partition_sz[0] = *size;
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- {
- const int num_part = (1 << pc->multi_token_partition);
- unsigned char * dp = cpi->partition_d[0] + cpi->partition_sz[0];
-
- if (num_part > 1)
- {
- /* write token part sizes (all but last) if more than 1 */
- validate_buffer(dp, 3 * (num_part - 1), cpi->partition_d_end[0],
- &pc->error);
-
- cpi->partition_sz[0] += 3*(num_part-1);
-
- for(i = 1; i < num_part; i++)
- {
- write_partition_size(dp, cpi->partition_sz[i]);
- dp += 3;
- }
- }
-
- if (!cpi->output_partition)
- {
- /* concatenate partition buffers */
- for(i = 0; i < num_part; i++)
- {
- vpx_memmove(dp, cpi->partition_d[i+1], cpi->partition_sz[i+1]);
- cpi->partition_d[i+1] = dp;
- dp += cpi->partition_sz[i+1];
- }
- }
-
- /* update total size */
- *size = 0;
- for(i = 0; i < num_part+1; i++)
- {
- *size += cpi->partition_sz[i];
- }
- }
-#else
- if (pc->multi_token_partition != ONE_PARTITION)
- {
- int num_part = 1 << pc->multi_token_partition;
-
- /* partition size table at the end of first partition */
- cpi->partition_sz[0] += 3 * (num_part - 1);
- *size += 3 * (num_part - 1);
-
- validate_buffer(cx_data, 3 * (num_part - 1), cx_data_end,
- &pc->error);
-
- for(i = 1; i < num_part + 1; i++)
- {
- cpi->bc[i].error = &pc->error;
- }
-
- pack_tokens_into_partitions(cpi, cx_data + 3 * (num_part - 1),
- cx_data_end, num_part);
-
- for(i = 1; i < num_part; i++)
- {
- cpi->partition_sz[i] = cpi->bc[i].pos;
- write_partition_size(cx_data, cpi->partition_sz[i]);
- cx_data += 3;
- *size += cpi->partition_sz[i]; /* add to total */
- }
-
- /* add last partition to total size */
- cpi->partition_sz[i] = cpi->bc[i].pos;
- *size += cpi->partition_sz[i];
- }
- else
- {
- bc[1].error = &pc->error;
-
- vp8_start_encode(&cpi->bc[1], cx_data, cx_data_end);
-
-#if CONFIG_MULTITHREAD
- if (cpi->b_multi_threaded)
- pack_mb_row_tokens(cpi, &cpi->bc[1]);
- else
-#endif
- pack_tokens(&cpi->bc[1], cpi->tok, cpi->tok_count);
-
- vp8_stop_encode(&cpi->bc[1]);
-
- *size += cpi->bc[1].pos;
- cpi->partition_sz[1] = cpi->bc[1].pos;
- }
-#endif
-}
-
-#ifdef VP8_ENTROPY_STATS
-void print_tree_update_probs()
-{
- int i, j, k, l;
- FILE *f = fopen("context.c", "a");
- int Sum;
- fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n");
- fprintf(f, "const vp8_prob tree_update_probs[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {\n");
-
- for (i = 0; i < BLOCK_TYPES; i++)
- {
- fprintf(f, " { \n");
-
- for (j = 0; j < COEF_BANDS; j++)
- {
- fprintf(f, " {\n");
-
- for (k = 0; k < PREV_COEF_CONTEXTS; k++)
- {
- fprintf(f, " {");
-
- for (l = 0; l < ENTROPY_NODES; l++)
- {
- Sum = tree_update_hist[i][j][k][l][0] + tree_update_hist[i][j][k][l][1];
-
- if (Sum > 0)
- {
- if (((tree_update_hist[i][j][k][l][0] * 255) / Sum) > 0)
- fprintf(f, "%3ld, ", (tree_update_hist[i][j][k][l][0] * 255) / Sum);
- else
- fprintf(f, "%3ld, ", 1);
- }
- else
- fprintf(f, "%3ld, ", 128);
- }
-
- fprintf(f, "},\n");
- }
-
- fprintf(f, " },\n");
- }
-
- fprintf(f, " },\n");
- }
-
- fprintf(f, "};\n");
- fclose(f);
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.h
deleted file mode 100644
index eef2d79..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/bitstream.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_BITSTREAM_H_
-#define VP8_ENCODER_BITSTREAM_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if HAVE_EDSP
-void vp8cx_pack_tokens_armv5(vp8_writer *w, const TOKENEXTRA *p, int xcount,
- const vp8_token *,
- const vp8_extra_bit_struct *,
- const vp8_tree_index *);
-void vp8cx_pack_tokens_into_partitions_armv5(VP8_COMP *,
- unsigned char * cx_data,
- const unsigned char *cx_data_end,
- int num_parts,
- const vp8_token *,
- const vp8_extra_bit_struct *,
- const vp8_tree_index *);
-void vp8cx_pack_mb_row_tokens_armv5(VP8_COMP *cpi, vp8_writer *w,
- const vp8_token *,
- const vp8_extra_bit_struct *,
- const vp8_tree_index *);
-# define pack_tokens(a,b,c) \
- vp8cx_pack_tokens_armv5(a,b,c,vp8_coef_encodings,vp8_extra_bits,vp8_coef_tree)
-# define pack_tokens_into_partitions(a,b,c,d) \
- vp8cx_pack_tokens_into_partitions_armv5(a,b,c,d,vp8_coef_encodings,vp8_extra_bits,vp8_coef_tree)
-# define pack_mb_row_tokens(a,b) \
- vp8cx_pack_mb_row_tokens_armv5(a,b,vp8_coef_encodings,vp8_extra_bits,vp8_coef_tree)
-#else
-
-void vp8_pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount);
-
-# define pack_tokens(a,b,c) vp8_pack_tokens_c(a,b,c)
-# define pack_tokens_into_partitions(a,b,c,d) pack_tokens_into_partitions_c(a,b,c,d)
-# define pack_mb_row_tokens(a,b) pack_mb_row_tokens_c(a,b)
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_BITSTREAM_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/block.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/block.h
deleted file mode 100644
index dd733e5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/block.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_BLOCK_H_
-#define VP8_ENCODER_BLOCK_H_
-
-#include "vp8/common/onyx.h"
-#include "vp8/common/blockd.h"
-#include "vp8/common/entropymv.h"
-#include "vp8/common/entropy.h"
-#include "vpx_ports/mem.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_MODES 20
-#define MAX_ERROR_BINS 1024
-
-/* motion search site */
-typedef struct
-{
- MV mv;
- int offset;
-} search_site;
-
-typedef struct block
-{
- /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
- short *src_diff;
- short *coeff;
-
- /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
- short *quant;
- short *quant_fast;
- short *quant_shift;
- short *zbin;
- short *zrun_zbin_boost;
- short *round;
-
- /* Zbin Over Quant value */
- short zbin_extra;
-
- unsigned char **base_src;
- int src;
- int src_stride;
-} BLOCK;
-
-typedef struct
-{
- int count;
- struct
- {
- B_PREDICTION_MODE mode;
- int_mv mv;
- } bmi[16];
-} PARTITION_INFO;
-
-typedef struct macroblock
-{
- DECLARE_ALIGNED(16, short, src_diff[400]); /* 25 blocks Y,U,V,Y2 */
- DECLARE_ALIGNED(16, short, coeff[400]); /* 25 blocks Y,U,V,Y2 */
- DECLARE_ALIGNED(16, unsigned char, thismb[256]);
-
- unsigned char *thismb_ptr;
- /* 16 Y, 4 U, 4 V, 1 DC 2nd order block */
- BLOCK block[25];
-
- YV12_BUFFER_CONFIG src;
-
- MACROBLOCKD e_mbd;
- PARTITION_INFO *partition_info; /* work pointer */
- PARTITION_INFO *pi; /* Corresponds to upper left visible macroblock */
- PARTITION_INFO *pip; /* Base of allocated array */
-
- int ref_frame_cost[MAX_REF_FRAMES];
-
- search_site *ss;
- int ss_count;
- int searches_per_step;
-
- int errorperbit;
- int sadperbit16;
- int sadperbit4;
- int rddiv;
- int rdmult;
- unsigned int * mb_activity_ptr;
- int * mb_norm_activity_ptr;
- signed int act_zbin_adj;
- signed int last_act_zbin_adj;
-
- int *mvcost[2];
- int *mvsadcost[2];
- int (*mbmode_cost)[MB_MODE_COUNT];
- int (*intra_uv_mode_cost)[MB_MODE_COUNT];
- int (*bmode_costs)[10][10];
- int *inter_bmode_costs;
- int (*token_costs)[COEF_BANDS][PREV_COEF_CONTEXTS]
- [MAX_ENTROPY_TOKENS];
-
- /* These define limits to motion vector components to prevent
- * them from extending outside the UMV borders.
- */
- int mv_col_min;
- int mv_col_max;
- int mv_row_min;
- int mv_row_max;
-
- int skip;
-
- unsigned int encode_breakout;
-
- signed char *gf_active_ptr;
-
- unsigned char *active_ptr;
- MV_CONTEXT *mvc;
-
- int optimize;
- int q_index;
-
-#if CONFIG_TEMPORAL_DENOISING
- MB_PREDICTION_MODE best_sse_inter_mode;
- int_mv best_sse_mv;
- MV_REFERENCE_FRAME best_reference_frame;
- MV_REFERENCE_FRAME best_zeromv_reference_frame;
- unsigned char need_to_clamp_best_mvs;
-#endif
-
- int skip_true_count;
- unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
- unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
- int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */
- int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
- int64_t prediction_error;
- int64_t intra_error;
- int count_mb_ref_frame_usage[MAX_REF_FRAMES];
-
- int rd_thresh_mult[MAX_MODES];
- int rd_threshes[MAX_MODES];
- unsigned int mbs_tested_so_far;
- unsigned int mode_test_hit_counts[MAX_MODES];
- int zbin_mode_boost_enabled;
- int zbin_mode_boost;
- int last_zbin_mode_boost;
-
- int last_zbin_over_quant;
- int zbin_over_quant;
- int error_bins[MAX_ERROR_BINS];
-
- void (*short_fdct4x4)(short *input, short *output, int pitch);
- void (*short_fdct8x4)(short *input, short *output, int pitch);
- void (*short_walsh4x4)(short *input, short *output, int pitch);
- void (*quantize_b)(BLOCK *b, BLOCKD *d);
- void (*quantize_b_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1);
-
-} MACROBLOCK;
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_BLOCK_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.c
deleted file mode 100644
index 3b0c03a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "boolhuff.h"
-
-#if defined(SECTIONBITS_OUTPUT)
-unsigned __int64 Sectionbits[500];
-
-#endif
-
-#ifdef VP8_ENTROPY_STATS
-unsigned int active_section = 0;
-#endif
-
-const unsigned int vp8_prob_cost[256] =
-{
- 2047, 2047, 1791, 1641, 1535, 1452, 1385, 1328, 1279, 1235, 1196, 1161, 1129, 1099, 1072, 1046,
- 1023, 1000, 979, 959, 940, 922, 905, 889, 873, 858, 843, 829, 816, 803, 790, 778,
- 767, 755, 744, 733, 723, 713, 703, 693, 684, 675, 666, 657, 649, 641, 633, 625,
- 617, 609, 602, 594, 587, 580, 573, 567, 560, 553, 547, 541, 534, 528, 522, 516,
- 511, 505, 499, 494, 488, 483, 477, 472, 467, 462, 457, 452, 447, 442, 437, 433,
- 428, 424, 419, 415, 410, 406, 401, 397, 393, 389, 385, 381, 377, 373, 369, 365,
- 361, 357, 353, 349, 346, 342, 338, 335, 331, 328, 324, 321, 317, 314, 311, 307,
- 304, 301, 297, 294, 291, 288, 285, 281, 278, 275, 272, 269, 266, 263, 260, 257,
- 255, 252, 249, 246, 243, 240, 238, 235, 232, 229, 227, 224, 221, 219, 216, 214,
- 211, 208, 206, 203, 201, 198, 196, 194, 191, 189, 186, 184, 181, 179, 177, 174,
- 172, 170, 168, 165, 163, 161, 159, 156, 154, 152, 150, 148, 145, 143, 141, 139,
- 137, 135, 133, 131, 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107,
- 105, 103, 101, 99, 97, 95, 93, 92, 90, 88, 86, 84, 82, 81, 79, 77,
- 75, 73, 72, 70, 68, 66, 65, 63, 61, 60, 58, 56, 55, 53, 51, 50,
- 48, 46, 45, 43, 41, 40, 38, 37, 35, 33, 32, 30, 29, 27, 25, 24,
- 22, 21, 19, 18, 16, 15, 13, 12, 10, 9, 7, 6, 4, 3, 1, 1
-};
-
-void vp8_start_encode(BOOL_CODER *br, unsigned char *source, unsigned char *source_end)
-{
-
- br->lowvalue = 0;
- br->range = 255;
- br->count = -24;
- br->buffer = source;
- br->buffer_end = source_end;
- br->pos = 0;
-}
-
-void vp8_stop_encode(BOOL_CODER *br)
-{
- int i;
-
- for (i = 0; i < 32; i++)
- vp8_encode_bool(br, 0, 128);
-}
-
-
-void vp8_encode_value(BOOL_CODER *br, int data, int bits)
-{
- int bit;
-
- for (bit = bits - 1; bit >= 0; bit--)
- vp8_encode_bool(br, (1 & (data >> bit)), 0x80);
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.h
deleted file mode 100644
index 6114215..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/boolhuff.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
-*
-* Module Title : boolhuff.h
-*
-* Description : Bool Coder header file.
-*
-****************************************************************************/
-#ifndef VP8_ENCODER_BOOLHUFF_H_
-#define VP8_ENCODER_BOOLHUFF_H_
-
-#include "vpx_ports/mem.h"
-#include "vpx/internal/vpx_codec_internal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct
-{
- unsigned int lowvalue;
- unsigned int range;
- int count;
- unsigned int pos;
- unsigned char *buffer;
- unsigned char *buffer_end;
- struct vpx_internal_error_info *error;
-
- /* Variables used to track bit costs without outputing to the bitstream */
- unsigned int measure_cost;
- unsigned long bit_counter;
-} BOOL_CODER;
-
-extern void vp8_start_encode(BOOL_CODER *bc, unsigned char *buffer, unsigned char *buffer_end);
-
-extern void vp8_encode_value(BOOL_CODER *br, int data, int bits);
-extern void vp8_stop_encode(BOOL_CODER *bc);
-extern const unsigned int vp8_prob_cost[256];
-
-
-DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
-
-static int validate_buffer(const unsigned char *start,
- size_t len,
- const unsigned char *end,
- struct vpx_internal_error_info *error)
-{
- if (start + len > start && start + len < end)
- return 1;
- else
- vpx_internal_error(error, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt partition ");
-
- return 0;
-}
-static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability)
-{
- unsigned int split;
- int count = br->count;
- unsigned int range = br->range;
- unsigned int lowvalue = br->lowvalue;
- register unsigned int shift;
-
-#ifdef VP8_ENTROPY_STATS
-#if defined(SECTIONBITS_OUTPUT)
-
- if (bit)
- Sectionbits[active_section] += vp8_prob_cost[255-probability];
- else
- Sectionbits[active_section] += vp8_prob_cost[probability];
-
-#endif
-#endif
-
- split = 1 + (((range - 1) * probability) >> 8);
-
- range = split;
-
- if (bit)
- {
- lowvalue += split;
- range = br->range - split;
- }
-
- shift = vp8_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] = (unsigned char)0;
- x--;
- }
-
- br->buffer[x] += 1;
- }
-
- validate_buffer(br->buffer + br->pos, 1, br->buffer_end, br->error);
- 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 // VP8_ENCODER_BOOLHUFF_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/dct.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/dct.c
deleted file mode 100644
index 091554a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/dct.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <math.h>
-
-void vp8_short_fdct4x4_c(short *input, short *output, int pitch)
-{
- int i;
- int a1, b1, c1, d1;
- short *ip = input;
- short *op = output;
-
- for (i = 0; i < 4; i++)
- {
- a1 = ((ip[0] + ip[3]) * 8);
- b1 = ((ip[1] + ip[2]) * 8);
- c1 = ((ip[1] - ip[2]) * 8);
- d1 = ((ip[0] - ip[3]) * 8);
-
- op[0] = a1 + b1;
- op[2] = a1 - b1;
-
- op[1] = (c1 * 2217 + d1 * 5352 + 14500)>>12;
- op[3] = (d1 * 2217 - c1 * 5352 + 7500)>>12;
-
- ip += pitch / 2;
- op += 4;
-
- }
- ip = output;
- op = output;
- for (i = 0; i < 4; i++)
- {
- a1 = ip[0] + ip[12];
- b1 = ip[4] + ip[8];
- c1 = ip[4] - ip[8];
- d1 = ip[0] - ip[12];
-
- op[0] = ( a1 + b1 + 7)>>4;
- op[8] = ( a1 - b1 + 7)>>4;
-
- op[4] =((c1 * 2217 + d1 * 5352 + 12000)>>16) + (d1!=0);
- op[12] = (d1 * 2217 - c1 * 5352 + 51000)>>16;
-
- ip++;
- op++;
- }
-}
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch)
-{
- vp8_short_fdct4x4_c(input, output, pitch);
- vp8_short_fdct4x4_c(input + 4, output + 16, pitch);
-}
-
-void vp8_short_walsh4x4_c(short *input, short *output, int pitch)
-{
- int i;
- int a1, b1, c1, d1;
- int a2, b2, c2, d2;
- short *ip = input;
- short *op = output;
-
-
- for (i = 0; i < 4; i++)
- {
- a1 = ((ip[0] + ip[2]) * 4);
- d1 = ((ip[1] + ip[3]) * 4);
- c1 = ((ip[1] - ip[3]) * 4);
- b1 = ((ip[0] - ip[2]) * 4);
-
- op[0] = a1 + d1 + (a1!=0);
- op[1] = b1 + c1;
- op[2] = b1 - c1;
- op[3] = a1 - d1;
- ip += pitch / 2;
- op += 4;
- }
-
- ip = output;
- op = output;
-
- for (i = 0; i < 4; i++)
- {
- a1 = ip[0] + ip[8];
- d1 = ip[4] + ip[12];
- c1 = ip[4] - ip[12];
- b1 = ip[0] - ip[8];
-
- a2 = a1 + d1;
- b2 = b1 + c1;
- c2 = b1 - c1;
- d2 = a1 - d1;
-
- a2 += a2<0;
- b2 += b2<0;
- c2 += c2<0;
- d2 += d2<0;
-
- op[0] = (a2+3) >> 3;
- op[4] = (b2+3) >> 3;
- op[8] = (c2+3) >> 3;
- op[12]= (d2+3) >> 3;
-
- ip++;
- op++;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_cost.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_cost.h
deleted file mode 100644
index 1cd3eec..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_cost.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_ENCODER_DCT_VALUE_COST_H_
-#define VP8_ENCODER_DCT_VALUE_COST_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Generated file, included by tokenize.c */
-/* Values generated by fill_value_tokens() */
-
-static const short dct_value_cost[2048*2] =
-{
- 8285, 8277, 8267, 8259, 8253, 8245, 8226, 8218, 8212, 8204, 8194, 8186,
- 8180, 8172, 8150, 8142, 8136, 8128, 8118, 8110, 8104, 8096, 8077, 8069,
- 8063, 8055, 8045, 8037, 8031, 8023, 7997, 7989, 7983, 7975, 7965, 7957,
- 7951, 7943, 7924, 7916, 7910, 7902, 7892, 7884, 7878, 7870, 7848, 7840,
- 7834, 7826, 7816, 7808, 7802, 7794, 7775, 7767, 7761, 7753, 7743, 7735,
- 7729, 7721, 7923, 7915, 7909, 7901, 7891, 7883, 7877, 7869, 7850, 7842,
- 7836, 7828, 7818, 7810, 7804, 7796, 7774, 7766, 7760, 7752, 7742, 7734,
- 7728, 7720, 7701, 7693, 7687, 7679, 7669, 7661, 7655, 7647, 7621, 7613,
- 7607, 7599, 7589, 7581, 7575, 7567, 7548, 7540, 7534, 7526, 7516, 7508,
- 7502, 7494, 7472, 7464, 7458, 7450, 7440, 7432, 7426, 7418, 7399, 7391,
- 7385, 7377, 7367, 7359, 7353, 7345, 7479, 7471, 7465, 7457, 7447, 7439,
- 7433, 7425, 7406, 7398, 7392, 7384, 7374, 7366, 7360, 7352, 7330, 7322,
- 7316, 7308, 7298, 7290, 7284, 7276, 7257, 7249, 7243, 7235, 7225, 7217,
- 7211, 7203, 7177, 7169, 7163, 7155, 7145, 7137, 7131, 7123, 7104, 7096,
- 7090, 7082, 7072, 7064, 7058, 7050, 7028, 7020, 7014, 7006, 6996, 6988,
- 6982, 6974, 6955, 6947, 6941, 6933, 6923, 6915, 6909, 6901, 7632, 7624,
- 7618, 7610, 7600, 7592, 7586, 7578, 7559, 7551, 7545, 7537, 7527, 7519,
- 7513, 7505, 7483, 7475, 7469, 7461, 7451, 7443, 7437, 7429, 7410, 7402,
- 7396, 7388, 7378, 7370, 7364, 7356, 7330, 7322, 7316, 7308, 7298, 7290,
- 7284, 7276, 7257, 7249, 7243, 7235, 7225, 7217, 7211, 7203, 7181, 7173,
- 7167, 7159, 7149, 7141, 7135, 7127, 7108, 7100, 7094, 7086, 7076, 7068,
- 7062, 7054, 7188, 7180, 7174, 7166, 7156, 7148, 7142, 7134, 7115, 7107,
- 7101, 7093, 7083, 7075, 7069, 7061, 7039, 7031, 7025, 7017, 7007, 6999,
- 6993, 6985, 6966, 6958, 6952, 6944, 6934, 6926, 6920, 6912, 6886, 6878,
- 6872, 6864, 6854, 6846, 6840, 6832, 6813, 6805, 6799, 6791, 6781, 6773,
- 6767, 6759, 6737, 6729, 6723, 6715, 6705, 6697, 6691, 6683, 6664, 6656,
- 6650, 6642, 6632, 6624, 6618, 6610, 6812, 6804, 6798, 6790, 6780, 6772,
- 6766, 6758, 6739, 6731, 6725, 6717, 6707, 6699, 6693, 6685, 6663, 6655,
- 6649, 6641, 6631, 6623, 6617, 6609, 6590, 6582, 6576, 6568, 6558, 6550,
- 6544, 6536, 6510, 6502, 6496, 6488, 6478, 6470, 6464, 6456, 6437, 6429,
- 6423, 6415, 6405, 6397, 6391, 6383, 6361, 6353, 6347, 6339, 6329, 6321,
- 6315, 6307, 6288, 6280, 6274, 6266, 6256, 6248, 6242, 6234, 6368, 6360,
- 6354, 6346, 6336, 6328, 6322, 6314, 6295, 6287, 6281, 6273, 6263, 6255,
- 6249, 6241, 6219, 6211, 6205, 6197, 6187, 6179, 6173, 6165, 6146, 6138,
- 6132, 6124, 6114, 6106, 6100, 6092, 6066, 6058, 6052, 6044, 6034, 6026,
- 6020, 6012, 5993, 5985, 5979, 5971, 5961, 5953, 5947, 5939, 5917, 5909,
- 5903, 5895, 5885, 5877, 5871, 5863, 5844, 5836, 5830, 5822, 5812, 5804,
- 5798, 5790, 6697, 6689, 6683, 6675, 6665, 6657, 6651, 6643, 6624, 6616,
- 6610, 6602, 6592, 6584, 6578, 6570, 6548, 6540, 6534, 6526, 6516, 6508,
- 6502, 6494, 6475, 6467, 6461, 6453, 6443, 6435, 6429, 6421, 6395, 6387,
- 6381, 6373, 6363, 6355, 6349, 6341, 6322, 6314, 6308, 6300, 6290, 6282,
- 6276, 6268, 6246, 6238, 6232, 6224, 6214, 6206, 6200, 6192, 6173, 6165,
- 6159, 6151, 6141, 6133, 6127, 6119, 6253, 6245, 6239, 6231, 6221, 6213,
- 6207, 6199, 6180, 6172, 6166, 6158, 6148, 6140, 6134, 6126, 6104, 6096,
- 6090, 6082, 6072, 6064, 6058, 6050, 6031, 6023, 6017, 6009, 5999, 5991,
- 5985, 5977, 5951, 5943, 5937, 5929, 5919, 5911, 5905, 5897, 5878, 5870,
- 5864, 5856, 5846, 5838, 5832, 5824, 5802, 5794, 5788, 5780, 5770, 5762,
- 5756, 5748, 5729, 5721, 5715, 5707, 5697, 5689, 5683, 5675, 5877, 5869,
- 5863, 5855, 5845, 5837, 5831, 5823, 5804, 5796, 5790, 5782, 5772, 5764,
- 5758, 5750, 5728, 5720, 5714, 5706, 5696, 5688, 5682, 5674, 5655, 5647,
- 5641, 5633, 5623, 5615, 5609, 5601, 5575, 5567, 5561, 5553, 5543, 5535,
- 5529, 5521, 5502, 5494, 5488, 5480, 5470, 5462, 5456, 5448, 5426, 5418,
- 5412, 5404, 5394, 5386, 5380, 5372, 5353, 5345, 5339, 5331, 5321, 5313,
- 5307, 5299, 5433, 5425, 5419, 5411, 5401, 5393, 5387, 5379, 5360, 5352,
- 5346, 5338, 5328, 5320, 5314, 5306, 5284, 5276, 5270, 5262, 5252, 5244,
- 5238, 5230, 5211, 5203, 5197, 5189, 5179, 5171, 5165, 5157, 5131, 5123,
- 5117, 5109, 5099, 5091, 5085, 5077, 5058, 5050, 5044, 5036, 5026, 5018,
- 5012, 5004, 4982, 4974, 4968, 4960, 4950, 4942, 4936, 4928, 4909, 4901,
- 4895, 4887, 4877, 4869, 4863, 4855, 5586, 5578, 5572, 5564, 5554, 5546,
- 5540, 5532, 5513, 5505, 5499, 5491, 5481, 5473, 5467, 5459, 5437, 5429,
- 5423, 5415, 5405, 5397, 5391, 5383, 5364, 5356, 5350, 5342, 5332, 5324,
- 5318, 5310, 5284, 5276, 5270, 5262, 5252, 5244, 5238, 5230, 5211, 5203,
- 5197, 5189, 5179, 5171, 5165, 5157, 5135, 5127, 5121, 5113, 5103, 5095,
- 5089, 5081, 5062, 5054, 5048, 5040, 5030, 5022, 5016, 5008, 5142, 5134,
- 5128, 5120, 5110, 5102, 5096, 5088, 5069, 5061, 5055, 5047, 5037, 5029,
- 5023, 5015, 4993, 4985, 4979, 4971, 4961, 4953, 4947, 4939, 4920, 4912,
- 4906, 4898, 4888, 4880, 4874, 4866, 4840, 4832, 4826, 4818, 4808, 4800,
- 4794, 4786, 4767, 4759, 4753, 4745, 4735, 4727, 4721, 4713, 4691, 4683,
- 4677, 4669, 4659, 4651, 4645, 4637, 4618, 4610, 4604, 4596, 4586, 4578,
- 4572, 4564, 4766, 4758, 4752, 4744, 4734, 4726, 4720, 4712, 4693, 4685,
- 4679, 4671, 4661, 4653, 4647, 4639, 4617, 4609, 4603, 4595, 4585, 4577,
- 4571, 4563, 4544, 4536, 4530, 4522, 4512, 4504, 4498, 4490, 4464, 4456,
- 4450, 4442, 4432, 4424, 4418, 4410, 4391, 4383, 4377, 4369, 4359, 4351,
- 4345, 4337, 4315, 4307, 4301, 4293, 4283, 4275, 4269, 4261, 4242, 4234,
- 4228, 4220, 4210, 4202, 4196, 4188, 4322, 4314, 4308, 4300, 4290, 4282,
- 4276, 4268, 4249, 4241, 4235, 4227, 4217, 4209, 4203, 4195, 4173, 4165,
- 4159, 4151, 4141, 4133, 4127, 4119, 4100, 4092, 4086, 4078, 4068, 4060,
- 4054, 4046, 4020, 4012, 4006, 3998, 3988, 3980, 3974, 3966, 3947, 3939,
- 3933, 3925, 3915, 3907, 3901, 3893, 3871, 3863, 3857, 3849, 3839, 3831,
- 3825, 3817, 3798, 3790, 3784, 3776, 3766, 3758, 3752, 3744, 6697, 6689,
- 6683, 6675, 6665, 6657, 6651, 6643, 6624, 6616, 6610, 6602, 6592, 6584,
- 6578, 6570, 6548, 6540, 6534, 6526, 6516, 6508, 6502, 6494, 6475, 6467,
- 6461, 6453, 6443, 6435, 6429, 6421, 6395, 6387, 6381, 6373, 6363, 6355,
- 6349, 6341, 6322, 6314, 6308, 6300, 6290, 6282, 6276, 6268, 6246, 6238,
- 6232, 6224, 6214, 6206, 6200, 6192, 6173, 6165, 6159, 6151, 6141, 6133,
- 6127, 6119, 6253, 6245, 6239, 6231, 6221, 6213, 6207, 6199, 6180, 6172,
- 6166, 6158, 6148, 6140, 6134, 6126, 6104, 6096, 6090, 6082, 6072, 6064,
- 6058, 6050, 6031, 6023, 6017, 6009, 5999, 5991, 5985, 5977, 5951, 5943,
- 5937, 5929, 5919, 5911, 5905, 5897, 5878, 5870, 5864, 5856, 5846, 5838,
- 5832, 5824, 5802, 5794, 5788, 5780, 5770, 5762, 5756, 5748, 5729, 5721,
- 5715, 5707, 5697, 5689, 5683, 5675, 5877, 5869, 5863, 5855, 5845, 5837,
- 5831, 5823, 5804, 5796, 5790, 5782, 5772, 5764, 5758, 5750, 5728, 5720,
- 5714, 5706, 5696, 5688, 5682, 5674, 5655, 5647, 5641, 5633, 5623, 5615,
- 5609, 5601, 5575, 5567, 5561, 5553, 5543, 5535, 5529, 5521, 5502, 5494,
- 5488, 5480, 5470, 5462, 5456, 5448, 5426, 5418, 5412, 5404, 5394, 5386,
- 5380, 5372, 5353, 5345, 5339, 5331, 5321, 5313, 5307, 5299, 5433, 5425,
- 5419, 5411, 5401, 5393, 5387, 5379, 5360, 5352, 5346, 5338, 5328, 5320,
- 5314, 5306, 5284, 5276, 5270, 5262, 5252, 5244, 5238, 5230, 5211, 5203,
- 5197, 5189, 5179, 5171, 5165, 5157, 5131, 5123, 5117, 5109, 5099, 5091,
- 5085, 5077, 5058, 5050, 5044, 5036, 5026, 5018, 5012, 5004, 4982, 4974,
- 4968, 4960, 4950, 4942, 4936, 4928, 4909, 4901, 4895, 4887, 4877, 4869,
- 4863, 4855, 5586, 5578, 5572, 5564, 5554, 5546, 5540, 5532, 5513, 5505,
- 5499, 5491, 5481, 5473, 5467, 5459, 5437, 5429, 5423, 5415, 5405, 5397,
- 5391, 5383, 5364, 5356, 5350, 5342, 5332, 5324, 5318, 5310, 5284, 5276,
- 5270, 5262, 5252, 5244, 5238, 5230, 5211, 5203, 5197, 5189, 5179, 5171,
- 5165, 5157, 5135, 5127, 5121, 5113, 5103, 5095, 5089, 5081, 5062, 5054,
- 5048, 5040, 5030, 5022, 5016, 5008, 5142, 5134, 5128, 5120, 5110, 5102,
- 5096, 5088, 5069, 5061, 5055, 5047, 5037, 5029, 5023, 5015, 4993, 4985,
- 4979, 4971, 4961, 4953, 4947, 4939, 4920, 4912, 4906, 4898, 4888, 4880,
- 4874, 4866, 4840, 4832, 4826, 4818, 4808, 4800, 4794, 4786, 4767, 4759,
- 4753, 4745, 4735, 4727, 4721, 4713, 4691, 4683, 4677, 4669, 4659, 4651,
- 4645, 4637, 4618, 4610, 4604, 4596, 4586, 4578, 4572, 4564, 4766, 4758,
- 4752, 4744, 4734, 4726, 4720, 4712, 4693, 4685, 4679, 4671, 4661, 4653,
- 4647, 4639, 4617, 4609, 4603, 4595, 4585, 4577, 4571, 4563, 4544, 4536,
- 4530, 4522, 4512, 4504, 4498, 4490, 4464, 4456, 4450, 4442, 4432, 4424,
- 4418, 4410, 4391, 4383, 4377, 4369, 4359, 4351, 4345, 4337, 4315, 4307,
- 4301, 4293, 4283, 4275, 4269, 4261, 4242, 4234, 4228, 4220, 4210, 4202,
- 4196, 4188, 4322, 4314, 4308, 4300, 4290, 4282, 4276, 4268, 4249, 4241,
- 4235, 4227, 4217, 4209, 4203, 4195, 4173, 4165, 4159, 4151, 4141, 4133,
- 4127, 4119, 4100, 4092, 4086, 4078, 4068, 4060, 4054, 4046, 4020, 4012,
- 4006, 3998, 3988, 3980, 3974, 3966, 3947, 3939, 3933, 3925, 3915, 3907,
- 3901, 3893, 3871, 3863, 3857, 3849, 3839, 3831, 3825, 3817, 3798, 3790,
- 3784, 3776, 3766, 3758, 3752, 3744, 4651, 4643, 4637, 4629, 4619, 4611,
- 4605, 4597, 4578, 4570, 4564, 4556, 4546, 4538, 4532, 4524, 4502, 4494,
- 4488, 4480, 4470, 4462, 4456, 4448, 4429, 4421, 4415, 4407, 4397, 4389,
- 4383, 4375, 4349, 4341, 4335, 4327, 4317, 4309, 4303, 4295, 4276, 4268,
- 4262, 4254, 4244, 4236, 4230, 4222, 4200, 4192, 4186, 4178, 4168, 4160,
- 4154, 4146, 4127, 4119, 4113, 4105, 4095, 4087, 4081, 4073, 4207, 4199,
- 4193, 4185, 4175, 4167, 4161, 4153, 4134, 4126, 4120, 4112, 4102, 4094,
- 4088, 4080, 4058, 4050, 4044, 4036, 4026, 4018, 4012, 4004, 3985, 3977,
- 3971, 3963, 3953, 3945, 3939, 3931, 3905, 3897, 3891, 3883, 3873, 3865,
- 3859, 3851, 3832, 3824, 3818, 3810, 3800, 3792, 3786, 3778, 3756, 3748,
- 3742, 3734, 3724, 3716, 3710, 3702, 3683, 3675, 3669, 3661, 3651, 3643,
- 3637, 3629, 3831, 3823, 3817, 3809, 3799, 3791, 3785, 3777, 3758, 3750,
- 3744, 3736, 3726, 3718, 3712, 3704, 3682, 3674, 3668, 3660, 3650, 3642,
- 3636, 3628, 3609, 3601, 3595, 3587, 3577, 3569, 3563, 3555, 3529, 3521,
- 3515, 3507, 3497, 3489, 3483, 3475, 3456, 3448, 3442, 3434, 3424, 3416,
- 3410, 3402, 3380, 3372, 3366, 3358, 3348, 3340, 3334, 3326, 3307, 3299,
- 3293, 3285, 3275, 3267, 3261, 3253, 3387, 3379, 3373, 3365, 3355, 3347,
- 3341, 3333, 3314, 3306, 3300, 3292, 3282, 3274, 3268, 3260, 3238, 3230,
- 3224, 3216, 3206, 3198, 3192, 3184, 3165, 3157, 3151, 3143, 3133, 3125,
- 3119, 3111, 3085, 3077, 3071, 3063, 3053, 3045, 3039, 3031, 3012, 3004,
- 2998, 2990, 2980, 2972, 2966, 2958, 2936, 2928, 2922, 2914, 2904, 2896,
- 2890, 2882, 2863, 2855, 2849, 2841, 2831, 2823, 2817, 2809, 3540, 3532,
- 3526, 3518, 3508, 3500, 3494, 3486, 3467, 3459, 3453, 3445, 3435, 3427,
- 3421, 3413, 3391, 3383, 3377, 3369, 3359, 3351, 3345, 3337, 3318, 3310,
- 3304, 3296, 3286, 3278, 3272, 3264, 3238, 3230, 3224, 3216, 3206, 3198,
- 3192, 3184, 3165, 3157, 3151, 3143, 3133, 3125, 3119, 3111, 3089, 3081,
- 3075, 3067, 3057, 3049, 3043, 3035, 3016, 3008, 3002, 2994, 2984, 2976,
- 2970, 2962, 3096, 3088, 3082, 3074, 3064, 3056, 3050, 3042, 3023, 3015,
- 3009, 3001, 2991, 2983, 2977, 2969, 2947, 2939, 2933, 2925, 2915, 2907,
- 2901, 2893, 2874, 2866, 2860, 2852, 2842, 2834, 2828, 2820, 2794, 2786,
- 2780, 2772, 2762, 2754, 2748, 2740, 2721, 2713, 2707, 2699, 2689, 2681,
- 2675, 2667, 2645, 2637, 2631, 2623, 2613, 2605, 2599, 2591, 2572, 2564,
- 2558, 2550, 2540, 2532, 2526, 2518, 2720, 2712, 2706, 2698, 2688, 2680,
- 2674, 2666, 2647, 2639, 2633, 2625, 2615, 2607, 2601, 2593, 2571, 2563,
- 2557, 2549, 2539, 2531, 2525, 2517, 2498, 2490, 2484, 2476, 2466, 2458,
- 2452, 2444, 2418, 2410, 2404, 2396, 2386, 2378, 2372, 2364, 2345, 2337,
- 2331, 2323, 2313, 2305, 2299, 2291, 2269, 2261, 2255, 2247, 2237, 2229,
- 2223, 2215, 2196, 2188, 2182, 2174, 2164, 2156, 2150, 2142, 2276, 2268,
- 2262, 2254, 2244, 2236, 2230, 2222, 2203, 2195, 2189, 2181, 2171, 2163,
- 2157, 2149, 2127, 2119, 2113, 2105, 2095, 2087, 2081, 2073, 2054, 2046,
- 2040, 2032, 2022, 2014, 2008, 2000, 1974, 1966, 1960, 1952, 1942, 1934,
- 1928, 1920, 1901, 1893, 1887, 1879, 1869, 1861, 1855, 1847, 1825, 1817,
- 1811, 1803, 1793, 1785, 1779, 1771, 1752, 1744, 1738, 1730, 1720, 1712,
- 1706, 1698, 1897, 1883, 1860, 1846, 1819, 1805, 1782, 1768, 1723, 1709,
- 1686, 1672, 1645, 1631, 1608, 1594, 1574, 1560, 1537, 1523, 1496, 1482,
- 1459, 1445, 1400, 1386, 1363, 1349, 1322, 1308, 1285, 1271, 1608, 1565,
- 1535, 1492, 1446, 1403, 1373, 1330, 1312, 1269, 1239, 1196, 1150, 1107,
- 1077, 1034, 1291, 1218, 1171, 1098, 1015, 942, 895, 822, 953, 850,
- 729, 626, 618, 431, 257, 257, 257, 257, 0, 255, 255, 255,
- 255, 429, 616, 624, 727, 848, 951, 820, 893, 940, 1013, 1096,
- 1169, 1216, 1289, 1032, 1075, 1105, 1148, 1194, 1237, 1267, 1310, 1328,
- 1371, 1401, 1444, 1490, 1533, 1563, 1606, 1269, 1283, 1306, 1320, 1347,
- 1361, 1384, 1398, 1443, 1457, 1480, 1494, 1521, 1535, 1558, 1572, 1592,
- 1606, 1629, 1643, 1670, 1684, 1707, 1721, 1766, 1780, 1803, 1817, 1844,
- 1858, 1881, 1895, 1696, 1704, 1710, 1718, 1728, 1736, 1742, 1750, 1769,
- 1777, 1783, 1791, 1801, 1809, 1815, 1823, 1845, 1853, 1859, 1867, 1877,
- 1885, 1891, 1899, 1918, 1926, 1932, 1940, 1950, 1958, 1964, 1972, 1998,
- 2006, 2012, 2020, 2030, 2038, 2044, 2052, 2071, 2079, 2085, 2093, 2103,
- 2111, 2117, 2125, 2147, 2155, 2161, 2169, 2179, 2187, 2193, 2201, 2220,
- 2228, 2234, 2242, 2252, 2260, 2266, 2274, 2140, 2148, 2154, 2162, 2172,
- 2180, 2186, 2194, 2213, 2221, 2227, 2235, 2245, 2253, 2259, 2267, 2289,
- 2297, 2303, 2311, 2321, 2329, 2335, 2343, 2362, 2370, 2376, 2384, 2394,
- 2402, 2408, 2416, 2442, 2450, 2456, 2464, 2474, 2482, 2488, 2496, 2515,
- 2523, 2529, 2537, 2547, 2555, 2561, 2569, 2591, 2599, 2605, 2613, 2623,
- 2631, 2637, 2645, 2664, 2672, 2678, 2686, 2696, 2704, 2710, 2718, 2516,
- 2524, 2530, 2538, 2548, 2556, 2562, 2570, 2589, 2597, 2603, 2611, 2621,
- 2629, 2635, 2643, 2665, 2673, 2679, 2687, 2697, 2705, 2711, 2719, 2738,
- 2746, 2752, 2760, 2770, 2778, 2784, 2792, 2818, 2826, 2832, 2840, 2850,
- 2858, 2864, 2872, 2891, 2899, 2905, 2913, 2923, 2931, 2937, 2945, 2967,
- 2975, 2981, 2989, 2999, 3007, 3013, 3021, 3040, 3048, 3054, 3062, 3072,
- 3080, 3086, 3094, 2960, 2968, 2974, 2982, 2992, 3000, 3006, 3014, 3033,
- 3041, 3047, 3055, 3065, 3073, 3079, 3087, 3109, 3117, 3123, 3131, 3141,
- 3149, 3155, 3163, 3182, 3190, 3196, 3204, 3214, 3222, 3228, 3236, 3262,
- 3270, 3276, 3284, 3294, 3302, 3308, 3316, 3335, 3343, 3349, 3357, 3367,
- 3375, 3381, 3389, 3411, 3419, 3425, 3433, 3443, 3451, 3457, 3465, 3484,
- 3492, 3498, 3506, 3516, 3524, 3530, 3538, 2807, 2815, 2821, 2829, 2839,
- 2847, 2853, 2861, 2880, 2888, 2894, 2902, 2912, 2920, 2926, 2934, 2956,
- 2964, 2970, 2978, 2988, 2996, 3002, 3010, 3029, 3037, 3043, 3051, 3061,
- 3069, 3075, 3083, 3109, 3117, 3123, 3131, 3141, 3149, 3155, 3163, 3182,
- 3190, 3196, 3204, 3214, 3222, 3228, 3236, 3258, 3266, 3272, 3280, 3290,
- 3298, 3304, 3312, 3331, 3339, 3345, 3353, 3363, 3371, 3377, 3385, 3251,
- 3259, 3265, 3273, 3283, 3291, 3297, 3305, 3324, 3332, 3338, 3346, 3356,
- 3364, 3370, 3378, 3400, 3408, 3414, 3422, 3432, 3440, 3446, 3454, 3473,
- 3481, 3487, 3495, 3505, 3513, 3519, 3527, 3553, 3561, 3567, 3575, 3585,
- 3593, 3599, 3607, 3626, 3634, 3640, 3648, 3658, 3666, 3672, 3680, 3702,
- 3710, 3716, 3724, 3734, 3742, 3748, 3756, 3775, 3783, 3789, 3797, 3807,
- 3815, 3821, 3829, 3627, 3635, 3641, 3649, 3659, 3667, 3673, 3681, 3700,
- 3708, 3714, 3722, 3732, 3740, 3746, 3754, 3776, 3784, 3790, 3798, 3808,
- 3816, 3822, 3830, 3849, 3857, 3863, 3871, 3881, 3889, 3895, 3903, 3929,
- 3937, 3943, 3951, 3961, 3969, 3975, 3983, 4002, 4010, 4016, 4024, 4034,
- 4042, 4048, 4056, 4078, 4086, 4092, 4100, 4110, 4118, 4124, 4132, 4151,
- 4159, 4165, 4173, 4183, 4191, 4197, 4205, 4071, 4079, 4085, 4093, 4103,
- 4111, 4117, 4125, 4144, 4152, 4158, 4166, 4176, 4184, 4190, 4198, 4220,
- 4228, 4234, 4242, 4252, 4260, 4266, 4274, 4293, 4301, 4307, 4315, 4325,
- 4333, 4339, 4347, 4373, 4381, 4387, 4395, 4405, 4413, 4419, 4427, 4446,
- 4454, 4460, 4468, 4478, 4486, 4492, 4500, 4522, 4530, 4536, 4544, 4554,
- 4562, 4568, 4576, 4595, 4603, 4609, 4617, 4627, 4635, 4641, 4649, 3742,
- 3750, 3756, 3764, 3774, 3782, 3788, 3796, 3815, 3823, 3829, 3837, 3847,
- 3855, 3861, 3869, 3891, 3899, 3905, 3913, 3923, 3931, 3937, 3945, 3964,
- 3972, 3978, 3986, 3996, 4004, 4010, 4018, 4044, 4052, 4058, 4066, 4076,
- 4084, 4090, 4098, 4117, 4125, 4131, 4139, 4149, 4157, 4163, 4171, 4193,
- 4201, 4207, 4215, 4225, 4233, 4239, 4247, 4266, 4274, 4280, 4288, 4298,
- 4306, 4312, 4320, 4186, 4194, 4200, 4208, 4218, 4226, 4232, 4240, 4259,
- 4267, 4273, 4281, 4291, 4299, 4305, 4313, 4335, 4343, 4349, 4357, 4367,
- 4375, 4381, 4389, 4408, 4416, 4422, 4430, 4440, 4448, 4454, 4462, 4488,
- 4496, 4502, 4510, 4520, 4528, 4534, 4542, 4561, 4569, 4575, 4583, 4593,
- 4601, 4607, 4615, 4637, 4645, 4651, 4659, 4669, 4677, 4683, 4691, 4710,
- 4718, 4724, 4732, 4742, 4750, 4756, 4764, 4562, 4570, 4576, 4584, 4594,
- 4602, 4608, 4616, 4635, 4643, 4649, 4657, 4667, 4675, 4681, 4689, 4711,
- 4719, 4725, 4733, 4743, 4751, 4757, 4765, 4784, 4792, 4798, 4806, 4816,
- 4824, 4830, 4838, 4864, 4872, 4878, 4886, 4896, 4904, 4910, 4918, 4937,
- 4945, 4951, 4959, 4969, 4977, 4983, 4991, 5013, 5021, 5027, 5035, 5045,
- 5053, 5059, 5067, 5086, 5094, 5100, 5108, 5118, 5126, 5132, 5140, 5006,
- 5014, 5020, 5028, 5038, 5046, 5052, 5060, 5079, 5087, 5093, 5101, 5111,
- 5119, 5125, 5133, 5155, 5163, 5169, 5177, 5187, 5195, 5201, 5209, 5228,
- 5236, 5242, 5250, 5260, 5268, 5274, 5282, 5308, 5316, 5322, 5330, 5340,
- 5348, 5354, 5362, 5381, 5389, 5395, 5403, 5413, 5421, 5427, 5435, 5457,
- 5465, 5471, 5479, 5489, 5497, 5503, 5511, 5530, 5538, 5544, 5552, 5562,
- 5570, 5576, 5584, 4853, 4861, 4867, 4875, 4885, 4893, 4899, 4907, 4926,
- 4934, 4940, 4948, 4958, 4966, 4972, 4980, 5002, 5010, 5016, 5024, 5034,
- 5042, 5048, 5056, 5075, 5083, 5089, 5097, 5107, 5115, 5121, 5129, 5155,
- 5163, 5169, 5177, 5187, 5195, 5201, 5209, 5228, 5236, 5242, 5250, 5260,
- 5268, 5274, 5282, 5304, 5312, 5318, 5326, 5336, 5344, 5350, 5358, 5377,
- 5385, 5391, 5399, 5409, 5417, 5423, 5431, 5297, 5305, 5311, 5319, 5329,
- 5337, 5343, 5351, 5370, 5378, 5384, 5392, 5402, 5410, 5416, 5424, 5446,
- 5454, 5460, 5468, 5478, 5486, 5492, 5500, 5519, 5527, 5533, 5541, 5551,
- 5559, 5565, 5573, 5599, 5607, 5613, 5621, 5631, 5639, 5645, 5653, 5672,
- 5680, 5686, 5694, 5704, 5712, 5718, 5726, 5748, 5756, 5762, 5770, 5780,
- 5788, 5794, 5802, 5821, 5829, 5835, 5843, 5853, 5861, 5867, 5875, 5673,
- 5681, 5687, 5695, 5705, 5713, 5719, 5727, 5746, 5754, 5760, 5768, 5778,
- 5786, 5792, 5800, 5822, 5830, 5836, 5844, 5854, 5862, 5868, 5876, 5895,
- 5903, 5909, 5917, 5927, 5935, 5941, 5949, 5975, 5983, 5989, 5997, 6007,
- 6015, 6021, 6029, 6048, 6056, 6062, 6070, 6080, 6088, 6094, 6102, 6124,
- 6132, 6138, 6146, 6156, 6164, 6170, 6178, 6197, 6205, 6211, 6219, 6229,
- 6237, 6243, 6251, 6117, 6125, 6131, 6139, 6149, 6157, 6163, 6171, 6190,
- 6198, 6204, 6212, 6222, 6230, 6236, 6244, 6266, 6274, 6280, 6288, 6298,
- 6306, 6312, 6320, 6339, 6347, 6353, 6361, 6371, 6379, 6385, 6393, 6419,
- 6427, 6433, 6441, 6451, 6459, 6465, 6473, 6492, 6500, 6506, 6514, 6524,
- 6532, 6538, 6546, 6568, 6576, 6582, 6590, 6600, 6608, 6614, 6622, 6641,
- 6649, 6655, 6663, 6673, 6681, 6687, 6695, 3742, 3750, 3756, 3764, 3774,
- 3782, 3788, 3796, 3815, 3823, 3829, 3837, 3847, 3855, 3861, 3869, 3891,
- 3899, 3905, 3913, 3923, 3931, 3937, 3945, 3964, 3972, 3978, 3986, 3996,
- 4004, 4010, 4018, 4044, 4052, 4058, 4066, 4076, 4084, 4090, 4098, 4117,
- 4125, 4131, 4139, 4149, 4157, 4163, 4171, 4193, 4201, 4207, 4215, 4225,
- 4233, 4239, 4247, 4266, 4274, 4280, 4288, 4298, 4306, 4312, 4320, 4186,
- 4194, 4200, 4208, 4218, 4226, 4232, 4240, 4259, 4267, 4273, 4281, 4291,
- 4299, 4305, 4313, 4335, 4343, 4349, 4357, 4367, 4375, 4381, 4389, 4408,
- 4416, 4422, 4430, 4440, 4448, 4454, 4462, 4488, 4496, 4502, 4510, 4520,
- 4528, 4534, 4542, 4561, 4569, 4575, 4583, 4593, 4601, 4607, 4615, 4637,
- 4645, 4651, 4659, 4669, 4677, 4683, 4691, 4710, 4718, 4724, 4732, 4742,
- 4750, 4756, 4764, 4562, 4570, 4576, 4584, 4594, 4602, 4608, 4616, 4635,
- 4643, 4649, 4657, 4667, 4675, 4681, 4689, 4711, 4719, 4725, 4733, 4743,
- 4751, 4757, 4765, 4784, 4792, 4798, 4806, 4816, 4824, 4830, 4838, 4864,
- 4872, 4878, 4886, 4896, 4904, 4910, 4918, 4937, 4945, 4951, 4959, 4969,
- 4977, 4983, 4991, 5013, 5021, 5027, 5035, 5045, 5053, 5059, 5067, 5086,
- 5094, 5100, 5108, 5118, 5126, 5132, 5140, 5006, 5014, 5020, 5028, 5038,
- 5046, 5052, 5060, 5079, 5087, 5093, 5101, 5111, 5119, 5125, 5133, 5155,
- 5163, 5169, 5177, 5187, 5195, 5201, 5209, 5228, 5236, 5242, 5250, 5260,
- 5268, 5274, 5282, 5308, 5316, 5322, 5330, 5340, 5348, 5354, 5362, 5381,
- 5389, 5395, 5403, 5413, 5421, 5427, 5435, 5457, 5465, 5471, 5479, 5489,
- 5497, 5503, 5511, 5530, 5538, 5544, 5552, 5562, 5570, 5576, 5584, 4853,
- 4861, 4867, 4875, 4885, 4893, 4899, 4907, 4926, 4934, 4940, 4948, 4958,
- 4966, 4972, 4980, 5002, 5010, 5016, 5024, 5034, 5042, 5048, 5056, 5075,
- 5083, 5089, 5097, 5107, 5115, 5121, 5129, 5155, 5163, 5169, 5177, 5187,
- 5195, 5201, 5209, 5228, 5236, 5242, 5250, 5260, 5268, 5274, 5282, 5304,
- 5312, 5318, 5326, 5336, 5344, 5350, 5358, 5377, 5385, 5391, 5399, 5409,
- 5417, 5423, 5431, 5297, 5305, 5311, 5319, 5329, 5337, 5343, 5351, 5370,
- 5378, 5384, 5392, 5402, 5410, 5416, 5424, 5446, 5454, 5460, 5468, 5478,
- 5486, 5492, 5500, 5519, 5527, 5533, 5541, 5551, 5559, 5565, 5573, 5599,
- 5607, 5613, 5621, 5631, 5639, 5645, 5653, 5672, 5680, 5686, 5694, 5704,
- 5712, 5718, 5726, 5748, 5756, 5762, 5770, 5780, 5788, 5794, 5802, 5821,
- 5829, 5835, 5843, 5853, 5861, 5867, 5875, 5673, 5681, 5687, 5695, 5705,
- 5713, 5719, 5727, 5746, 5754, 5760, 5768, 5778, 5786, 5792, 5800, 5822,
- 5830, 5836, 5844, 5854, 5862, 5868, 5876, 5895, 5903, 5909, 5917, 5927,
- 5935, 5941, 5949, 5975, 5983, 5989, 5997, 6007, 6015, 6021, 6029, 6048,
- 6056, 6062, 6070, 6080, 6088, 6094, 6102, 6124, 6132, 6138, 6146, 6156,
- 6164, 6170, 6178, 6197, 6205, 6211, 6219, 6229, 6237, 6243, 6251, 6117,
- 6125, 6131, 6139, 6149, 6157, 6163, 6171, 6190, 6198, 6204, 6212, 6222,
- 6230, 6236, 6244, 6266, 6274, 6280, 6288, 6298, 6306, 6312, 6320, 6339,
- 6347, 6353, 6361, 6371, 6379, 6385, 6393, 6419, 6427, 6433, 6441, 6451,
- 6459, 6465, 6473, 6492, 6500, 6506, 6514, 6524, 6532, 6538, 6546, 6568,
- 6576, 6582, 6590, 6600, 6608, 6614, 6622, 6641, 6649, 6655, 6663, 6673,
- 6681, 6687, 6695, 5788, 5796, 5802, 5810, 5820, 5828, 5834, 5842, 5861,
- 5869, 5875, 5883, 5893, 5901, 5907, 5915, 5937, 5945, 5951, 5959, 5969,
- 5977, 5983, 5991, 6010, 6018, 6024, 6032, 6042, 6050, 6056, 6064, 6090,
- 6098, 6104, 6112, 6122, 6130, 6136, 6144, 6163, 6171, 6177, 6185, 6195,
- 6203, 6209, 6217, 6239, 6247, 6253, 6261, 6271, 6279, 6285, 6293, 6312,
- 6320, 6326, 6334, 6344, 6352, 6358, 6366, 6232, 6240, 6246, 6254, 6264,
- 6272, 6278, 6286, 6305, 6313, 6319, 6327, 6337, 6345, 6351, 6359, 6381,
- 6389, 6395, 6403, 6413, 6421, 6427, 6435, 6454, 6462, 6468, 6476, 6486,
- 6494, 6500, 6508, 6534, 6542, 6548, 6556, 6566, 6574, 6580, 6588, 6607,
- 6615, 6621, 6629, 6639, 6647, 6653, 6661, 6683, 6691, 6697, 6705, 6715,
- 6723, 6729, 6737, 6756, 6764, 6770, 6778, 6788, 6796, 6802, 6810, 6608,
- 6616, 6622, 6630, 6640, 6648, 6654, 6662, 6681, 6689, 6695, 6703, 6713,
- 6721, 6727, 6735, 6757, 6765, 6771, 6779, 6789, 6797, 6803, 6811, 6830,
- 6838, 6844, 6852, 6862, 6870, 6876, 6884, 6910, 6918, 6924, 6932, 6942,
- 6950, 6956, 6964, 6983, 6991, 6997, 7005, 7015, 7023, 7029, 7037, 7059,
- 7067, 7073, 7081, 7091, 7099, 7105, 7113, 7132, 7140, 7146, 7154, 7164,
- 7172, 7178, 7186, 7052, 7060, 7066, 7074, 7084, 7092, 7098, 7106, 7125,
- 7133, 7139, 7147, 7157, 7165, 7171, 7179, 7201, 7209, 7215, 7223, 7233,
- 7241, 7247, 7255, 7274, 7282, 7288, 7296, 7306, 7314, 7320, 7328, 7354,
- 7362, 7368, 7376, 7386, 7394, 7400, 7408, 7427, 7435, 7441, 7449, 7459,
- 7467, 7473, 7481, 7503, 7511, 7517, 7525, 7535, 7543, 7549, 7557, 7576,
- 7584, 7590, 7598, 7608, 7616, 7622, 7630, 6899, 6907, 6913, 6921, 6931,
- 6939, 6945, 6953, 6972, 6980, 6986, 6994, 7004, 7012, 7018, 7026, 7048,
- 7056, 7062, 7070, 7080, 7088, 7094, 7102, 7121, 7129, 7135, 7143, 7153,
- 7161, 7167, 7175, 7201, 7209, 7215, 7223, 7233, 7241, 7247, 7255, 7274,
- 7282, 7288, 7296, 7306, 7314, 7320, 7328, 7350, 7358, 7364, 7372, 7382,
- 7390, 7396, 7404, 7423, 7431, 7437, 7445, 7455, 7463, 7469, 7477, 7343,
- 7351, 7357, 7365, 7375, 7383, 7389, 7397, 7416, 7424, 7430, 7438, 7448,
- 7456, 7462, 7470, 7492, 7500, 7506, 7514, 7524, 7532, 7538, 7546, 7565,
- 7573, 7579, 7587, 7597, 7605, 7611, 7619, 7645, 7653, 7659, 7667, 7677,
- 7685, 7691, 7699, 7718, 7726, 7732, 7740, 7750, 7758, 7764, 7772, 7794,
- 7802, 7808, 7816, 7826, 7834, 7840, 7848, 7867, 7875, 7881, 7889, 7899,
- 7907, 7913, 7921, 7719, 7727, 7733, 7741, 7751, 7759, 7765, 7773, 7792,
- 7800, 7806, 7814, 7824, 7832, 7838, 7846, 7868, 7876, 7882, 7890, 7900,
- 7908, 7914, 7922, 7941, 7949, 7955, 7963, 7973, 7981, 7987, 7995, 8021,
- 8029, 8035, 8043, 8053, 8061, 8067, 8075, 8094, 8102, 8108, 8116, 8126,
- 8134, 8140, 8148, 8170, 8178, 8184, 8192, 8202, 8210, 8216, 8224, 8243,
- 8251, 8257, 8265, 8275
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_DCT_VALUE_COST_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_tokens.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_tokens.h
deleted file mode 100644
index c2aadef..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/dct_value_tokens.h
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_ENCODER_DCT_VALUE_TOKENS_H_
-#define VP8_ENCODER_DCT_VALUE_TOKENS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Generated file, included by tokenize.c */
-/* Values generated by fill_value_tokens() */
-
-static const TOKENVALUE dct_value_tokens[2048*2] =
-{
- {10, 3963}, {10, 3961}, {10, 3959}, {10, 3957}, {10, 3955}, {10, 3953},
- {10, 3951}, {10, 3949}, {10, 3947}, {10, 3945}, {10, 3943}, {10, 3941},
- {10, 3939}, {10, 3937}, {10, 3935}, {10, 3933}, {10, 3931}, {10, 3929},
- {10, 3927}, {10, 3925}, {10, 3923}, {10, 3921}, {10, 3919}, {10, 3917},
- {10, 3915}, {10, 3913}, {10, 3911}, {10, 3909}, {10, 3907}, {10, 3905},
- {10, 3903}, {10, 3901}, {10, 3899}, {10, 3897}, {10, 3895}, {10, 3893},
- {10, 3891}, {10, 3889}, {10, 3887}, {10, 3885}, {10, 3883}, {10, 3881},
- {10, 3879}, {10, 3877}, {10, 3875}, {10, 3873}, {10, 3871}, {10, 3869},
- {10, 3867}, {10, 3865}, {10, 3863}, {10, 3861}, {10, 3859}, {10, 3857},
- {10, 3855}, {10, 3853}, {10, 3851}, {10, 3849}, {10, 3847}, {10, 3845},
- {10, 3843}, {10, 3841}, {10, 3839}, {10, 3837}, {10, 3835}, {10, 3833},
- {10, 3831}, {10, 3829}, {10, 3827}, {10, 3825}, {10, 3823}, {10, 3821},
- {10, 3819}, {10, 3817}, {10, 3815}, {10, 3813}, {10, 3811}, {10, 3809},
- {10, 3807}, {10, 3805}, {10, 3803}, {10, 3801}, {10, 3799}, {10, 3797},
- {10, 3795}, {10, 3793}, {10, 3791}, {10, 3789}, {10, 3787}, {10, 3785},
- {10, 3783}, {10, 3781}, {10, 3779}, {10, 3777}, {10, 3775}, {10, 3773},
- {10, 3771}, {10, 3769}, {10, 3767}, {10, 3765}, {10, 3763}, {10, 3761},
- {10, 3759}, {10, 3757}, {10, 3755}, {10, 3753}, {10, 3751}, {10, 3749},
- {10, 3747}, {10, 3745}, {10, 3743}, {10, 3741}, {10, 3739}, {10, 3737},
- {10, 3735}, {10, 3733}, {10, 3731}, {10, 3729}, {10, 3727}, {10, 3725},
- {10, 3723}, {10, 3721}, {10, 3719}, {10, 3717}, {10, 3715}, {10, 3713},
- {10, 3711}, {10, 3709}, {10, 3707}, {10, 3705}, {10, 3703}, {10, 3701},
- {10, 3699}, {10, 3697}, {10, 3695}, {10, 3693}, {10, 3691}, {10, 3689},
- {10, 3687}, {10, 3685}, {10, 3683}, {10, 3681}, {10, 3679}, {10, 3677},
- {10, 3675}, {10, 3673}, {10, 3671}, {10, 3669}, {10, 3667}, {10, 3665},
- {10, 3663}, {10, 3661}, {10, 3659}, {10, 3657}, {10, 3655}, {10, 3653},
- {10, 3651}, {10, 3649}, {10, 3647}, {10, 3645}, {10, 3643}, {10, 3641},
- {10, 3639}, {10, 3637}, {10, 3635}, {10, 3633}, {10, 3631}, {10, 3629},
- {10, 3627}, {10, 3625}, {10, 3623}, {10, 3621}, {10, 3619}, {10, 3617},
- {10, 3615}, {10, 3613}, {10, 3611}, {10, 3609}, {10, 3607}, {10, 3605},
- {10, 3603}, {10, 3601}, {10, 3599}, {10, 3597}, {10, 3595}, {10, 3593},
- {10, 3591}, {10, 3589}, {10, 3587}, {10, 3585}, {10, 3583}, {10, 3581},
- {10, 3579}, {10, 3577}, {10, 3575}, {10, 3573}, {10, 3571}, {10, 3569},
- {10, 3567}, {10, 3565}, {10, 3563}, {10, 3561}, {10, 3559}, {10, 3557},
- {10, 3555}, {10, 3553}, {10, 3551}, {10, 3549}, {10, 3547}, {10, 3545},
- {10, 3543}, {10, 3541}, {10, 3539}, {10, 3537}, {10, 3535}, {10, 3533},
- {10, 3531}, {10, 3529}, {10, 3527}, {10, 3525}, {10, 3523}, {10, 3521},
- {10, 3519}, {10, 3517}, {10, 3515}, {10, 3513}, {10, 3511}, {10, 3509},
- {10, 3507}, {10, 3505}, {10, 3503}, {10, 3501}, {10, 3499}, {10, 3497},
- {10, 3495}, {10, 3493}, {10, 3491}, {10, 3489}, {10, 3487}, {10, 3485},
- {10, 3483}, {10, 3481}, {10, 3479}, {10, 3477}, {10, 3475}, {10, 3473},
- {10, 3471}, {10, 3469}, {10, 3467}, {10, 3465}, {10, 3463}, {10, 3461},
- {10, 3459}, {10, 3457}, {10, 3455}, {10, 3453}, {10, 3451}, {10, 3449},
- {10, 3447}, {10, 3445}, {10, 3443}, {10, 3441}, {10, 3439}, {10, 3437},
- {10, 3435}, {10, 3433}, {10, 3431}, {10, 3429}, {10, 3427}, {10, 3425},
- {10, 3423}, {10, 3421}, {10, 3419}, {10, 3417}, {10, 3415}, {10, 3413},
- {10, 3411}, {10, 3409}, {10, 3407}, {10, 3405}, {10, 3403}, {10, 3401},
- {10, 3399}, {10, 3397}, {10, 3395}, {10, 3393}, {10, 3391}, {10, 3389},
- {10, 3387}, {10, 3385}, {10, 3383}, {10, 3381}, {10, 3379}, {10, 3377},
- {10, 3375}, {10, 3373}, {10, 3371}, {10, 3369}, {10, 3367}, {10, 3365},
- {10, 3363}, {10, 3361}, {10, 3359}, {10, 3357}, {10, 3355}, {10, 3353},
- {10, 3351}, {10, 3349}, {10, 3347}, {10, 3345}, {10, 3343}, {10, 3341},
- {10, 3339}, {10, 3337}, {10, 3335}, {10, 3333}, {10, 3331}, {10, 3329},
- {10, 3327}, {10, 3325}, {10, 3323}, {10, 3321}, {10, 3319}, {10, 3317},
- {10, 3315}, {10, 3313}, {10, 3311}, {10, 3309}, {10, 3307}, {10, 3305},
- {10, 3303}, {10, 3301}, {10, 3299}, {10, 3297}, {10, 3295}, {10, 3293},
- {10, 3291}, {10, 3289}, {10, 3287}, {10, 3285}, {10, 3283}, {10, 3281},
- {10, 3279}, {10, 3277}, {10, 3275}, {10, 3273}, {10, 3271}, {10, 3269},
- {10, 3267}, {10, 3265}, {10, 3263}, {10, 3261}, {10, 3259}, {10, 3257},
- {10, 3255}, {10, 3253}, {10, 3251}, {10, 3249}, {10, 3247}, {10, 3245},
- {10, 3243}, {10, 3241}, {10, 3239}, {10, 3237}, {10, 3235}, {10, 3233},
- {10, 3231}, {10, 3229}, {10, 3227}, {10, 3225}, {10, 3223}, {10, 3221},
- {10, 3219}, {10, 3217}, {10, 3215}, {10, 3213}, {10, 3211}, {10, 3209},
- {10, 3207}, {10, 3205}, {10, 3203}, {10, 3201}, {10, 3199}, {10, 3197},
- {10, 3195}, {10, 3193}, {10, 3191}, {10, 3189}, {10, 3187}, {10, 3185},
- {10, 3183}, {10, 3181}, {10, 3179}, {10, 3177}, {10, 3175}, {10, 3173},
- {10, 3171}, {10, 3169}, {10, 3167}, {10, 3165}, {10, 3163}, {10, 3161},
- {10, 3159}, {10, 3157}, {10, 3155}, {10, 3153}, {10, 3151}, {10, 3149},
- {10, 3147}, {10, 3145}, {10, 3143}, {10, 3141}, {10, 3139}, {10, 3137},
- {10, 3135}, {10, 3133}, {10, 3131}, {10, 3129}, {10, 3127}, {10, 3125},
- {10, 3123}, {10, 3121}, {10, 3119}, {10, 3117}, {10, 3115}, {10, 3113},
- {10, 3111}, {10, 3109}, {10, 3107}, {10, 3105}, {10, 3103}, {10, 3101},
- {10, 3099}, {10, 3097}, {10, 3095}, {10, 3093}, {10, 3091}, {10, 3089},
- {10, 3087}, {10, 3085}, {10, 3083}, {10, 3081}, {10, 3079}, {10, 3077},
- {10, 3075}, {10, 3073}, {10, 3071}, {10, 3069}, {10, 3067}, {10, 3065},
- {10, 3063}, {10, 3061}, {10, 3059}, {10, 3057}, {10, 3055}, {10, 3053},
- {10, 3051}, {10, 3049}, {10, 3047}, {10, 3045}, {10, 3043}, {10, 3041},
- {10, 3039}, {10, 3037}, {10, 3035}, {10, 3033}, {10, 3031}, {10, 3029},
- {10, 3027}, {10, 3025}, {10, 3023}, {10, 3021}, {10, 3019}, {10, 3017},
- {10, 3015}, {10, 3013}, {10, 3011}, {10, 3009}, {10, 3007}, {10, 3005},
- {10, 3003}, {10, 3001}, {10, 2999}, {10, 2997}, {10, 2995}, {10, 2993},
- {10, 2991}, {10, 2989}, {10, 2987}, {10, 2985}, {10, 2983}, {10, 2981},
- {10, 2979}, {10, 2977}, {10, 2975}, {10, 2973}, {10, 2971}, {10, 2969},
- {10, 2967}, {10, 2965}, {10, 2963}, {10, 2961}, {10, 2959}, {10, 2957},
- {10, 2955}, {10, 2953}, {10, 2951}, {10, 2949}, {10, 2947}, {10, 2945},
- {10, 2943}, {10, 2941}, {10, 2939}, {10, 2937}, {10, 2935}, {10, 2933},
- {10, 2931}, {10, 2929}, {10, 2927}, {10, 2925}, {10, 2923}, {10, 2921},
- {10, 2919}, {10, 2917}, {10, 2915}, {10, 2913}, {10, 2911}, {10, 2909},
- {10, 2907}, {10, 2905}, {10, 2903}, {10, 2901}, {10, 2899}, {10, 2897},
- {10, 2895}, {10, 2893}, {10, 2891}, {10, 2889}, {10, 2887}, {10, 2885},
- {10, 2883}, {10, 2881}, {10, 2879}, {10, 2877}, {10, 2875}, {10, 2873},
- {10, 2871}, {10, 2869}, {10, 2867}, {10, 2865}, {10, 2863}, {10, 2861},
- {10, 2859}, {10, 2857}, {10, 2855}, {10, 2853}, {10, 2851}, {10, 2849},
- {10, 2847}, {10, 2845}, {10, 2843}, {10, 2841}, {10, 2839}, {10, 2837},
- {10, 2835}, {10, 2833}, {10, 2831}, {10, 2829}, {10, 2827}, {10, 2825},
- {10, 2823}, {10, 2821}, {10, 2819}, {10, 2817}, {10, 2815}, {10, 2813},
- {10, 2811}, {10, 2809}, {10, 2807}, {10, 2805}, {10, 2803}, {10, 2801},
- {10, 2799}, {10, 2797}, {10, 2795}, {10, 2793}, {10, 2791}, {10, 2789},
- {10, 2787}, {10, 2785}, {10, 2783}, {10, 2781}, {10, 2779}, {10, 2777},
- {10, 2775}, {10, 2773}, {10, 2771}, {10, 2769}, {10, 2767}, {10, 2765},
- {10, 2763}, {10, 2761}, {10, 2759}, {10, 2757}, {10, 2755}, {10, 2753},
- {10, 2751}, {10, 2749}, {10, 2747}, {10, 2745}, {10, 2743}, {10, 2741},
- {10, 2739}, {10, 2737}, {10, 2735}, {10, 2733}, {10, 2731}, {10, 2729},
- {10, 2727}, {10, 2725}, {10, 2723}, {10, 2721}, {10, 2719}, {10, 2717},
- {10, 2715}, {10, 2713}, {10, 2711}, {10, 2709}, {10, 2707}, {10, 2705},
- {10, 2703}, {10, 2701}, {10, 2699}, {10, 2697}, {10, 2695}, {10, 2693},
- {10, 2691}, {10, 2689}, {10, 2687}, {10, 2685}, {10, 2683}, {10, 2681},
- {10, 2679}, {10, 2677}, {10, 2675}, {10, 2673}, {10, 2671}, {10, 2669},
- {10, 2667}, {10, 2665}, {10, 2663}, {10, 2661}, {10, 2659}, {10, 2657},
- {10, 2655}, {10, 2653}, {10, 2651}, {10, 2649}, {10, 2647}, {10, 2645},
- {10, 2643}, {10, 2641}, {10, 2639}, {10, 2637}, {10, 2635}, {10, 2633},
- {10, 2631}, {10, 2629}, {10, 2627}, {10, 2625}, {10, 2623}, {10, 2621},
- {10, 2619}, {10, 2617}, {10, 2615}, {10, 2613}, {10, 2611}, {10, 2609},
- {10, 2607}, {10, 2605}, {10, 2603}, {10, 2601}, {10, 2599}, {10, 2597},
- {10, 2595}, {10, 2593}, {10, 2591}, {10, 2589}, {10, 2587}, {10, 2585},
- {10, 2583}, {10, 2581}, {10, 2579}, {10, 2577}, {10, 2575}, {10, 2573},
- {10, 2571}, {10, 2569}, {10, 2567}, {10, 2565}, {10, 2563}, {10, 2561},
- {10, 2559}, {10, 2557}, {10, 2555}, {10, 2553}, {10, 2551}, {10, 2549},
- {10, 2547}, {10, 2545}, {10, 2543}, {10, 2541}, {10, 2539}, {10, 2537},
- {10, 2535}, {10, 2533}, {10, 2531}, {10, 2529}, {10, 2527}, {10, 2525},
- {10, 2523}, {10, 2521}, {10, 2519}, {10, 2517}, {10, 2515}, {10, 2513},
- {10, 2511}, {10, 2509}, {10, 2507}, {10, 2505}, {10, 2503}, {10, 2501},
- {10, 2499}, {10, 2497}, {10, 2495}, {10, 2493}, {10, 2491}, {10, 2489},
- {10, 2487}, {10, 2485}, {10, 2483}, {10, 2481}, {10, 2479}, {10, 2477},
- {10, 2475}, {10, 2473}, {10, 2471}, {10, 2469}, {10, 2467}, {10, 2465},
- {10, 2463}, {10, 2461}, {10, 2459}, {10, 2457}, {10, 2455}, {10, 2453},
- {10, 2451}, {10, 2449}, {10, 2447}, {10, 2445}, {10, 2443}, {10, 2441},
- {10, 2439}, {10, 2437}, {10, 2435}, {10, 2433}, {10, 2431}, {10, 2429},
- {10, 2427}, {10, 2425}, {10, 2423}, {10, 2421}, {10, 2419}, {10, 2417},
- {10, 2415}, {10, 2413}, {10, 2411}, {10, 2409}, {10, 2407}, {10, 2405},
- {10, 2403}, {10, 2401}, {10, 2399}, {10, 2397}, {10, 2395}, {10, 2393},
- {10, 2391}, {10, 2389}, {10, 2387}, {10, 2385}, {10, 2383}, {10, 2381},
- {10, 2379}, {10, 2377}, {10, 2375}, {10, 2373}, {10, 2371}, {10, 2369},
- {10, 2367}, {10, 2365}, {10, 2363}, {10, 2361}, {10, 2359}, {10, 2357},
- {10, 2355}, {10, 2353}, {10, 2351}, {10, 2349}, {10, 2347}, {10, 2345},
- {10, 2343}, {10, 2341}, {10, 2339}, {10, 2337}, {10, 2335}, {10, 2333},
- {10, 2331}, {10, 2329}, {10, 2327}, {10, 2325}, {10, 2323}, {10, 2321},
- {10, 2319}, {10, 2317}, {10, 2315}, {10, 2313}, {10, 2311}, {10, 2309},
- {10, 2307}, {10, 2305}, {10, 2303}, {10, 2301}, {10, 2299}, {10, 2297},
- {10, 2295}, {10, 2293}, {10, 2291}, {10, 2289}, {10, 2287}, {10, 2285},
- {10, 2283}, {10, 2281}, {10, 2279}, {10, 2277}, {10, 2275}, {10, 2273},
- {10, 2271}, {10, 2269}, {10, 2267}, {10, 2265}, {10, 2263}, {10, 2261},
- {10, 2259}, {10, 2257}, {10, 2255}, {10, 2253}, {10, 2251}, {10, 2249},
- {10, 2247}, {10, 2245}, {10, 2243}, {10, 2241}, {10, 2239}, {10, 2237},
- {10, 2235}, {10, 2233}, {10, 2231}, {10, 2229}, {10, 2227}, {10, 2225},
- {10, 2223}, {10, 2221}, {10, 2219}, {10, 2217}, {10, 2215}, {10, 2213},
- {10, 2211}, {10, 2209}, {10, 2207}, {10, 2205}, {10, 2203}, {10, 2201},
- {10, 2199}, {10, 2197}, {10, 2195}, {10, 2193}, {10, 2191}, {10, 2189},
- {10, 2187}, {10, 2185}, {10, 2183}, {10, 2181}, {10, 2179}, {10, 2177},
- {10, 2175}, {10, 2173}, {10, 2171}, {10, 2169}, {10, 2167}, {10, 2165},
- {10, 2163}, {10, 2161}, {10, 2159}, {10, 2157}, {10, 2155}, {10, 2153},
- {10, 2151}, {10, 2149}, {10, 2147}, {10, 2145}, {10, 2143}, {10, 2141},
- {10, 2139}, {10, 2137}, {10, 2135}, {10, 2133}, {10, 2131}, {10, 2129},
- {10, 2127}, {10, 2125}, {10, 2123}, {10, 2121}, {10, 2119}, {10, 2117},
- {10, 2115}, {10, 2113}, {10, 2111}, {10, 2109}, {10, 2107}, {10, 2105},
- {10, 2103}, {10, 2101}, {10, 2099}, {10, 2097}, {10, 2095}, {10, 2093},
- {10, 2091}, {10, 2089}, {10, 2087}, {10, 2085}, {10, 2083}, {10, 2081},
- {10, 2079}, {10, 2077}, {10, 2075}, {10, 2073}, {10, 2071}, {10, 2069},
- {10, 2067}, {10, 2065}, {10, 2063}, {10, 2061}, {10, 2059}, {10, 2057},
- {10, 2055}, {10, 2053}, {10, 2051}, {10, 2049}, {10, 2047}, {10, 2045},
- {10, 2043}, {10, 2041}, {10, 2039}, {10, 2037}, {10, 2035}, {10, 2033},
- {10, 2031}, {10, 2029}, {10, 2027}, {10, 2025}, {10, 2023}, {10, 2021},
- {10, 2019}, {10, 2017}, {10, 2015}, {10, 2013}, {10, 2011}, {10, 2009},
- {10, 2007}, {10, 2005}, {10, 2003}, {10, 2001}, {10, 1999}, {10, 1997},
- {10, 1995}, {10, 1993}, {10, 1991}, {10, 1989}, {10, 1987}, {10, 1985},
- {10, 1983}, {10, 1981}, {10, 1979}, {10, 1977}, {10, 1975}, {10, 1973},
- {10, 1971}, {10, 1969}, {10, 1967}, {10, 1965}, {10, 1963}, {10, 1961},
- {10, 1959}, {10, 1957}, {10, 1955}, {10, 1953}, {10, 1951}, {10, 1949},
- {10, 1947}, {10, 1945}, {10, 1943}, {10, 1941}, {10, 1939}, {10, 1937},
- {10, 1935}, {10, 1933}, {10, 1931}, {10, 1929}, {10, 1927}, {10, 1925},
- {10, 1923}, {10, 1921}, {10, 1919}, {10, 1917}, {10, 1915}, {10, 1913},
- {10, 1911}, {10, 1909}, {10, 1907}, {10, 1905}, {10, 1903}, {10, 1901},
- {10, 1899}, {10, 1897}, {10, 1895}, {10, 1893}, {10, 1891}, {10, 1889},
- {10, 1887}, {10, 1885}, {10, 1883}, {10, 1881}, {10, 1879}, {10, 1877},
- {10, 1875}, {10, 1873}, {10, 1871}, {10, 1869}, {10, 1867}, {10, 1865},
- {10, 1863}, {10, 1861}, {10, 1859}, {10, 1857}, {10, 1855}, {10, 1853},
- {10, 1851}, {10, 1849}, {10, 1847}, {10, 1845}, {10, 1843}, {10, 1841},
- {10, 1839}, {10, 1837}, {10, 1835}, {10, 1833}, {10, 1831}, {10, 1829},
- {10, 1827}, {10, 1825}, {10, 1823}, {10, 1821}, {10, 1819}, {10, 1817},
- {10, 1815}, {10, 1813}, {10, 1811}, {10, 1809}, {10, 1807}, {10, 1805},
- {10, 1803}, {10, 1801}, {10, 1799}, {10, 1797}, {10, 1795}, {10, 1793},
- {10, 1791}, {10, 1789}, {10, 1787}, {10, 1785}, {10, 1783}, {10, 1781},
- {10, 1779}, {10, 1777}, {10, 1775}, {10, 1773}, {10, 1771}, {10, 1769},
- {10, 1767}, {10, 1765}, {10, 1763}, {10, 1761}, {10, 1759}, {10, 1757},
- {10, 1755}, {10, 1753}, {10, 1751}, {10, 1749}, {10, 1747}, {10, 1745},
- {10, 1743}, {10, 1741}, {10, 1739}, {10, 1737}, {10, 1735}, {10, 1733},
- {10, 1731}, {10, 1729}, {10, 1727}, {10, 1725}, {10, 1723}, {10, 1721},
- {10, 1719}, {10, 1717}, {10, 1715}, {10, 1713}, {10, 1711}, {10, 1709},
- {10, 1707}, {10, 1705}, {10, 1703}, {10, 1701}, {10, 1699}, {10, 1697},
- {10, 1695}, {10, 1693}, {10, 1691}, {10, 1689}, {10, 1687}, {10, 1685},
- {10, 1683}, {10, 1681}, {10, 1679}, {10, 1677}, {10, 1675}, {10, 1673},
- {10, 1671}, {10, 1669}, {10, 1667}, {10, 1665}, {10, 1663}, {10, 1661},
- {10, 1659}, {10, 1657}, {10, 1655}, {10, 1653}, {10, 1651}, {10, 1649},
- {10, 1647}, {10, 1645}, {10, 1643}, {10, 1641}, {10, 1639}, {10, 1637},
- {10, 1635}, {10, 1633}, {10, 1631}, {10, 1629}, {10, 1627}, {10, 1625},
- {10, 1623}, {10, 1621}, {10, 1619}, {10, 1617}, {10, 1615}, {10, 1613},
- {10, 1611}, {10, 1609}, {10, 1607}, {10, 1605}, {10, 1603}, {10, 1601},
- {10, 1599}, {10, 1597}, {10, 1595}, {10, 1593}, {10, 1591}, {10, 1589},
- {10, 1587}, {10, 1585}, {10, 1583}, {10, 1581}, {10, 1579}, {10, 1577},
- {10, 1575}, {10, 1573}, {10, 1571}, {10, 1569}, {10, 1567}, {10, 1565},
- {10, 1563}, {10, 1561}, {10, 1559}, {10, 1557}, {10, 1555}, {10, 1553},
- {10, 1551}, {10, 1549}, {10, 1547}, {10, 1545}, {10, 1543}, {10, 1541},
- {10, 1539}, {10, 1537}, {10, 1535}, {10, 1533}, {10, 1531}, {10, 1529},
- {10, 1527}, {10, 1525}, {10, 1523}, {10, 1521}, {10, 1519}, {10, 1517},
- {10, 1515}, {10, 1513}, {10, 1511}, {10, 1509}, {10, 1507}, {10, 1505},
- {10, 1503}, {10, 1501}, {10, 1499}, {10, 1497}, {10, 1495}, {10, 1493},
- {10, 1491}, {10, 1489}, {10, 1487}, {10, 1485}, {10, 1483}, {10, 1481},
- {10, 1479}, {10, 1477}, {10, 1475}, {10, 1473}, {10, 1471}, {10, 1469},
- {10, 1467}, {10, 1465}, {10, 1463}, {10, 1461}, {10, 1459}, {10, 1457},
- {10, 1455}, {10, 1453}, {10, 1451}, {10, 1449}, {10, 1447}, {10, 1445},
- {10, 1443}, {10, 1441}, {10, 1439}, {10, 1437}, {10, 1435}, {10, 1433},
- {10, 1431}, {10, 1429}, {10, 1427}, {10, 1425}, {10, 1423}, {10, 1421},
- {10, 1419}, {10, 1417}, {10, 1415}, {10, 1413}, {10, 1411}, {10, 1409},
- {10, 1407}, {10, 1405}, {10, 1403}, {10, 1401}, {10, 1399}, {10, 1397},
- {10, 1395}, {10, 1393}, {10, 1391}, {10, 1389}, {10, 1387}, {10, 1385},
- {10, 1383}, {10, 1381}, {10, 1379}, {10, 1377}, {10, 1375}, {10, 1373},
- {10, 1371}, {10, 1369}, {10, 1367}, {10, 1365}, {10, 1363}, {10, 1361},
- {10, 1359}, {10, 1357}, {10, 1355}, {10, 1353}, {10, 1351}, {10, 1349},
- {10, 1347}, {10, 1345}, {10, 1343}, {10, 1341}, {10, 1339}, {10, 1337},
- {10, 1335}, {10, 1333}, {10, 1331}, {10, 1329}, {10, 1327}, {10, 1325},
- {10, 1323}, {10, 1321}, {10, 1319}, {10, 1317}, {10, 1315}, {10, 1313},
- {10, 1311}, {10, 1309}, {10, 1307}, {10, 1305}, {10, 1303}, {10, 1301},
- {10, 1299}, {10, 1297}, {10, 1295}, {10, 1293}, {10, 1291}, {10, 1289},
- {10, 1287}, {10, 1285}, {10, 1283}, {10, 1281}, {10, 1279}, {10, 1277},
- {10, 1275}, {10, 1273}, {10, 1271}, {10, 1269}, {10, 1267}, {10, 1265},
- {10, 1263}, {10, 1261}, {10, 1259}, {10, 1257}, {10, 1255}, {10, 1253},
- {10, 1251}, {10, 1249}, {10, 1247}, {10, 1245}, {10, 1243}, {10, 1241},
- {10, 1239}, {10, 1237}, {10, 1235}, {10, 1233}, {10, 1231}, {10, 1229},
- {10, 1227}, {10, 1225}, {10, 1223}, {10, 1221}, {10, 1219}, {10, 1217},
- {10, 1215}, {10, 1213}, {10, 1211}, {10, 1209}, {10, 1207}, {10, 1205},
- {10, 1203}, {10, 1201}, {10, 1199}, {10, 1197}, {10, 1195}, {10, 1193},
- {10, 1191}, {10, 1189}, {10, 1187}, {10, 1185}, {10, 1183}, {10, 1181},
- {10, 1179}, {10, 1177}, {10, 1175}, {10, 1173}, {10, 1171}, {10, 1169},
- {10, 1167}, {10, 1165}, {10, 1163}, {10, 1161}, {10, 1159}, {10, 1157},
- {10, 1155}, {10, 1153}, {10, 1151}, {10, 1149}, {10, 1147}, {10, 1145},
- {10, 1143}, {10, 1141}, {10, 1139}, {10, 1137}, {10, 1135}, {10, 1133},
- {10, 1131}, {10, 1129}, {10, 1127}, {10, 1125}, {10, 1123}, {10, 1121},
- {10, 1119}, {10, 1117}, {10, 1115}, {10, 1113}, {10, 1111}, {10, 1109},
- {10, 1107}, {10, 1105}, {10, 1103}, {10, 1101}, {10, 1099}, {10, 1097},
- {10, 1095}, {10, 1093}, {10, 1091}, {10, 1089}, {10, 1087}, {10, 1085},
- {10, 1083}, {10, 1081}, {10, 1079}, {10, 1077}, {10, 1075}, {10, 1073},
- {10, 1071}, {10, 1069}, {10, 1067}, {10, 1065}, {10, 1063}, {10, 1061},
- {10, 1059}, {10, 1057}, {10, 1055}, {10, 1053}, {10, 1051}, {10, 1049},
- {10, 1047}, {10, 1045}, {10, 1043}, {10, 1041}, {10, 1039}, {10, 1037},
- {10, 1035}, {10, 1033}, {10, 1031}, {10, 1029}, {10, 1027}, {10, 1025},
- {10, 1023}, {10, 1021}, {10, 1019}, {10, 1017}, {10, 1015}, {10, 1013},
- {10, 1011}, {10, 1009}, {10, 1007}, {10, 1005}, {10, 1003}, {10, 1001},
- {10, 999}, {10, 997}, {10, 995}, {10, 993}, {10, 991}, {10, 989},
- {10, 987}, {10, 985}, {10, 983}, {10, 981}, {10, 979}, {10, 977},
- {10, 975}, {10, 973}, {10, 971}, {10, 969}, {10, 967}, {10, 965},
- {10, 963}, {10, 961}, {10, 959}, {10, 957}, {10, 955}, {10, 953},
- {10, 951}, {10, 949}, {10, 947}, {10, 945}, {10, 943}, {10, 941},
- {10, 939}, {10, 937}, {10, 935}, {10, 933}, {10, 931}, {10, 929},
- {10, 927}, {10, 925}, {10, 923}, {10, 921}, {10, 919}, {10, 917},
- {10, 915}, {10, 913}, {10, 911}, {10, 909}, {10, 907}, {10, 905},
- {10, 903}, {10, 901}, {10, 899}, {10, 897}, {10, 895}, {10, 893},
- {10, 891}, {10, 889}, {10, 887}, {10, 885}, {10, 883}, {10, 881},
- {10, 879}, {10, 877}, {10, 875}, {10, 873}, {10, 871}, {10, 869},
- {10, 867}, {10, 865}, {10, 863}, {10, 861}, {10, 859}, {10, 857},
- {10, 855}, {10, 853}, {10, 851}, {10, 849}, {10, 847}, {10, 845},
- {10, 843}, {10, 841}, {10, 839}, {10, 837}, {10, 835}, {10, 833},
- {10, 831}, {10, 829}, {10, 827}, {10, 825}, {10, 823}, {10, 821},
- {10, 819}, {10, 817}, {10, 815}, {10, 813}, {10, 811}, {10, 809},
- {10, 807}, {10, 805}, {10, 803}, {10, 801}, {10, 799}, {10, 797},
- {10, 795}, {10, 793}, {10, 791}, {10, 789}, {10, 787}, {10, 785},
- {10, 783}, {10, 781}, {10, 779}, {10, 777}, {10, 775}, {10, 773},
- {10, 771}, {10, 769}, {10, 767}, {10, 765}, {10, 763}, {10, 761},
- {10, 759}, {10, 757}, {10, 755}, {10, 753}, {10, 751}, {10, 749},
- {10, 747}, {10, 745}, {10, 743}, {10, 741}, {10, 739}, {10, 737},
- {10, 735}, {10, 733}, {10, 731}, {10, 729}, {10, 727}, {10, 725},
- {10, 723}, {10, 721}, {10, 719}, {10, 717}, {10, 715}, {10, 713},
- {10, 711}, {10, 709}, {10, 707}, {10, 705}, {10, 703}, {10, 701},
- {10, 699}, {10, 697}, {10, 695}, {10, 693}, {10, 691}, {10, 689},
- {10, 687}, {10, 685}, {10, 683}, {10, 681}, {10, 679}, {10, 677},
- {10, 675}, {10, 673}, {10, 671}, {10, 669}, {10, 667}, {10, 665},
- {10, 663}, {10, 661}, {10, 659}, {10, 657}, {10, 655}, {10, 653},
- {10, 651}, {10, 649}, {10, 647}, {10, 645}, {10, 643}, {10, 641},
- {10, 639}, {10, 637}, {10, 635}, {10, 633}, {10, 631}, {10, 629},
- {10, 627}, {10, 625}, {10, 623}, {10, 621}, {10, 619}, {10, 617},
- {10, 615}, {10, 613}, {10, 611}, {10, 609}, {10, 607}, {10, 605},
- {10, 603}, {10, 601}, {10, 599}, {10, 597}, {10, 595}, {10, 593},
- {10, 591}, {10, 589}, {10, 587}, {10, 585}, {10, 583}, {10, 581},
- {10, 579}, {10, 577}, {10, 575}, {10, 573}, {10, 571}, {10, 569},
- {10, 567}, {10, 565}, {10, 563}, {10, 561}, {10, 559}, {10, 557},
- {10, 555}, {10, 553}, {10, 551}, {10, 549}, {10, 547}, {10, 545},
- {10, 543}, {10, 541}, {10, 539}, {10, 537}, {10, 535}, {10, 533},
- {10, 531}, {10, 529}, {10, 527}, {10, 525}, {10, 523}, {10, 521},
- {10, 519}, {10, 517}, {10, 515}, {10, 513}, {10, 511}, {10, 509},
- {10, 507}, {10, 505}, {10, 503}, {10, 501}, {10, 499}, {10, 497},
- {10, 495}, {10, 493}, {10, 491}, {10, 489}, {10, 487}, {10, 485},
- {10, 483}, {10, 481}, {10, 479}, {10, 477}, {10, 475}, {10, 473},
- {10, 471}, {10, 469}, {10, 467}, {10, 465}, {10, 463}, {10, 461},
- {10, 459}, {10, 457}, {10, 455}, {10, 453}, {10, 451}, {10, 449},
- {10, 447}, {10, 445}, {10, 443}, {10, 441}, {10, 439}, {10, 437},
- {10, 435}, {10, 433}, {10, 431}, {10, 429}, {10, 427}, {10, 425},
- {10, 423}, {10, 421}, {10, 419}, {10, 417}, {10, 415}, {10, 413},
- {10, 411}, {10, 409}, {10, 407}, {10, 405}, {10, 403}, {10, 401},
- {10, 399}, {10, 397}, {10, 395}, {10, 393}, {10, 391}, {10, 389},
- {10, 387}, {10, 385}, {10, 383}, {10, 381}, {10, 379}, {10, 377},
- {10, 375}, {10, 373}, {10, 371}, {10, 369}, {10, 367}, {10, 365},
- {10, 363}, {10, 361}, {10, 359}, {10, 357}, {10, 355}, {10, 353},
- {10, 351}, {10, 349}, {10, 347}, {10, 345}, {10, 343}, {10, 341},
- {10, 339}, {10, 337}, {10, 335}, {10, 333}, {10, 331}, {10, 329},
- {10, 327}, {10, 325}, {10, 323}, {10, 321}, {10, 319}, {10, 317},
- {10, 315}, {10, 313}, {10, 311}, {10, 309}, {10, 307}, {10, 305},
- {10, 303}, {10, 301}, {10, 299}, {10, 297}, {10, 295}, {10, 293},
- {10, 291}, {10, 289}, {10, 287}, {10, 285}, {10, 283}, {10, 281},
- {10, 279}, {10, 277}, {10, 275}, {10, 273}, {10, 271}, {10, 269},
- {10, 267}, {10, 265}, {10, 263}, {10, 261}, {10, 259}, {10, 257},
- {10, 255}, {10, 253}, {10, 251}, {10, 249}, {10, 247}, {10, 245},
- {10, 243}, {10, 241}, {10, 239}, {10, 237}, {10, 235}, {10, 233},
- {10, 231}, {10, 229}, {10, 227}, {10, 225}, {10, 223}, {10, 221},
- {10, 219}, {10, 217}, {10, 215}, {10, 213}, {10, 211}, {10, 209},
- {10, 207}, {10, 205}, {10, 203}, {10, 201}, {10, 199}, {10, 197},
- {10, 195}, {10, 193}, {10, 191}, {10, 189}, {10, 187}, {10, 185},
- {10, 183}, {10, 181}, {10, 179}, {10, 177}, {10, 175}, {10, 173},
- {10, 171}, {10, 169}, {10, 167}, {10, 165}, {10, 163}, {10, 161},
- {10, 159}, {10, 157}, {10, 155}, {10, 153}, {10, 151}, {10, 149},
- {10, 147}, {10, 145}, {10, 143}, {10, 141}, {10, 139}, {10, 137},
- {10, 135}, {10, 133}, {10, 131}, {10, 129}, {10, 127}, {10, 125},
- {10, 123}, {10, 121}, {10, 119}, {10, 117}, {10, 115}, {10, 113},
- {10, 111}, {10, 109}, {10, 107}, {10, 105}, {10, 103}, {10, 101},
- {10, 99}, {10, 97}, {10, 95}, {10, 93}, {10, 91}, {10, 89},
- {10, 87}, {10, 85}, {10, 83}, {10, 81}, {10, 79}, {10, 77},
- {10, 75}, {10, 73}, {10, 71}, {10, 69}, {10, 67}, {10, 65},
- {10, 63}, {10, 61}, {10, 59}, {10, 57}, {10, 55}, {10, 53},
- {10, 51}, {10, 49}, {10, 47}, {10, 45}, {10, 43}, {10, 41},
- {10, 39}, {10, 37}, {10, 35}, {10, 33}, {10, 31}, {10, 29},
- {10, 27}, {10, 25}, {10, 23}, {10, 21}, {10, 19}, {10, 17},
- {10, 15}, {10, 13}, {10, 11}, {10, 9}, {10, 7}, {10, 5},
- {10, 3}, {10, 1}, {9, 63}, {9, 61}, {9, 59}, {9, 57},
- {9, 55}, {9, 53}, {9, 51}, {9, 49}, {9, 47}, {9, 45},
- {9, 43}, {9, 41}, {9, 39}, {9, 37}, {9, 35}, {9, 33},
- {9, 31}, {9, 29}, {9, 27}, {9, 25}, {9, 23}, {9, 21},
- {9, 19}, {9, 17}, {9, 15}, {9, 13}, {9, 11}, {9, 9},
- {9, 7}, {9, 5}, {9, 3}, {9, 1}, {8, 31}, {8, 29},
- {8, 27}, {8, 25}, {8, 23}, {8, 21}, {8, 19}, {8, 17},
- {8, 15}, {8, 13}, {8, 11}, {8, 9}, {8, 7}, {8, 5},
- {8, 3}, {8, 1}, {7, 15}, {7, 13}, {7, 11}, {7, 9},
- {7, 7}, {7, 5}, {7, 3}, {7, 1}, {6, 7}, {6, 5},
- {6, 3}, {6, 1}, {5, 3}, {5, 1}, {4, 1}, {3, 1},
- {2, 1}, {1, 1}, {0, 0}, {1, 0}, {2, 0}, {3, 0},
- {4, 0}, {5, 0}, {5, 2}, {6, 0}, {6, 2}, {6, 4},
- {6, 6}, {7, 0}, {7, 2}, {7, 4}, {7, 6}, {7, 8},
- {7, 10}, {7, 12}, {7, 14}, {8, 0}, {8, 2}, {8, 4},
- {8, 6}, {8, 8}, {8, 10}, {8, 12}, {8, 14}, {8, 16},
- {8, 18}, {8, 20}, {8, 22}, {8, 24}, {8, 26}, {8, 28},
- {8, 30}, {9, 0}, {9, 2}, {9, 4}, {9, 6}, {9, 8},
- {9, 10}, {9, 12}, {9, 14}, {9, 16}, {9, 18}, {9, 20},
- {9, 22}, {9, 24}, {9, 26}, {9, 28}, {9, 30}, {9, 32},
- {9, 34}, {9, 36}, {9, 38}, {9, 40}, {9, 42}, {9, 44},
- {9, 46}, {9, 48}, {9, 50}, {9, 52}, {9, 54}, {9, 56},
- {9, 58}, {9, 60}, {9, 62}, {10, 0}, {10, 2}, {10, 4},
- {10, 6}, {10, 8}, {10, 10}, {10, 12}, {10, 14}, {10, 16},
- {10, 18}, {10, 20}, {10, 22}, {10, 24}, {10, 26}, {10, 28},
- {10, 30}, {10, 32}, {10, 34}, {10, 36}, {10, 38}, {10, 40},
- {10, 42}, {10, 44}, {10, 46}, {10, 48}, {10, 50}, {10, 52},
- {10, 54}, {10, 56}, {10, 58}, {10, 60}, {10, 62}, {10, 64},
- {10, 66}, {10, 68}, {10, 70}, {10, 72}, {10, 74}, {10, 76},
- {10, 78}, {10, 80}, {10, 82}, {10, 84}, {10, 86}, {10, 88},
- {10, 90}, {10, 92}, {10, 94}, {10, 96}, {10, 98}, {10, 100},
- {10, 102}, {10, 104}, {10, 106}, {10, 108}, {10, 110}, {10, 112},
- {10, 114}, {10, 116}, {10, 118}, {10, 120}, {10, 122}, {10, 124},
- {10, 126}, {10, 128}, {10, 130}, {10, 132}, {10, 134}, {10, 136},
- {10, 138}, {10, 140}, {10, 142}, {10, 144}, {10, 146}, {10, 148},
- {10, 150}, {10, 152}, {10, 154}, {10, 156}, {10, 158}, {10, 160},
- {10, 162}, {10, 164}, {10, 166}, {10, 168}, {10, 170}, {10, 172},
- {10, 174}, {10, 176}, {10, 178}, {10, 180}, {10, 182}, {10, 184},
- {10, 186}, {10, 188}, {10, 190}, {10, 192}, {10, 194}, {10, 196},
- {10, 198}, {10, 200}, {10, 202}, {10, 204}, {10, 206}, {10, 208},
- {10, 210}, {10, 212}, {10, 214}, {10, 216}, {10, 218}, {10, 220},
- {10, 222}, {10, 224}, {10, 226}, {10, 228}, {10, 230}, {10, 232},
- {10, 234}, {10, 236}, {10, 238}, {10, 240}, {10, 242}, {10, 244},
- {10, 246}, {10, 248}, {10, 250}, {10, 252}, {10, 254}, {10, 256},
- {10, 258}, {10, 260}, {10, 262}, {10, 264}, {10, 266}, {10, 268},
- {10, 270}, {10, 272}, {10, 274}, {10, 276}, {10, 278}, {10, 280},
- {10, 282}, {10, 284}, {10, 286}, {10, 288}, {10, 290}, {10, 292},
- {10, 294}, {10, 296}, {10, 298}, {10, 300}, {10, 302}, {10, 304},
- {10, 306}, {10, 308}, {10, 310}, {10, 312}, {10, 314}, {10, 316},
- {10, 318}, {10, 320}, {10, 322}, {10, 324}, {10, 326}, {10, 328},
- {10, 330}, {10, 332}, {10, 334}, {10, 336}, {10, 338}, {10, 340},
- {10, 342}, {10, 344}, {10, 346}, {10, 348}, {10, 350}, {10, 352},
- {10, 354}, {10, 356}, {10, 358}, {10, 360}, {10, 362}, {10, 364},
- {10, 366}, {10, 368}, {10, 370}, {10, 372}, {10, 374}, {10, 376},
- {10, 378}, {10, 380}, {10, 382}, {10, 384}, {10, 386}, {10, 388},
- {10, 390}, {10, 392}, {10, 394}, {10, 396}, {10, 398}, {10, 400},
- {10, 402}, {10, 404}, {10, 406}, {10, 408}, {10, 410}, {10, 412},
- {10, 414}, {10, 416}, {10, 418}, {10, 420}, {10, 422}, {10, 424},
- {10, 426}, {10, 428}, {10, 430}, {10, 432}, {10, 434}, {10, 436},
- {10, 438}, {10, 440}, {10, 442}, {10, 444}, {10, 446}, {10, 448},
- {10, 450}, {10, 452}, {10, 454}, {10, 456}, {10, 458}, {10, 460},
- {10, 462}, {10, 464}, {10, 466}, {10, 468}, {10, 470}, {10, 472},
- {10, 474}, {10, 476}, {10, 478}, {10, 480}, {10, 482}, {10, 484},
- {10, 486}, {10, 488}, {10, 490}, {10, 492}, {10, 494}, {10, 496},
- {10, 498}, {10, 500}, {10, 502}, {10, 504}, {10, 506}, {10, 508},
- {10, 510}, {10, 512}, {10, 514}, {10, 516}, {10, 518}, {10, 520},
- {10, 522}, {10, 524}, {10, 526}, {10, 528}, {10, 530}, {10, 532},
- {10, 534}, {10, 536}, {10, 538}, {10, 540}, {10, 542}, {10, 544},
- {10, 546}, {10, 548}, {10, 550}, {10, 552}, {10, 554}, {10, 556},
- {10, 558}, {10, 560}, {10, 562}, {10, 564}, {10, 566}, {10, 568},
- {10, 570}, {10, 572}, {10, 574}, {10, 576}, {10, 578}, {10, 580},
- {10, 582}, {10, 584}, {10, 586}, {10, 588}, {10, 590}, {10, 592},
- {10, 594}, {10, 596}, {10, 598}, {10, 600}, {10, 602}, {10, 604},
- {10, 606}, {10, 608}, {10, 610}, {10, 612}, {10, 614}, {10, 616},
- {10, 618}, {10, 620}, {10, 622}, {10, 624}, {10, 626}, {10, 628},
- {10, 630}, {10, 632}, {10, 634}, {10, 636}, {10, 638}, {10, 640},
- {10, 642}, {10, 644}, {10, 646}, {10, 648}, {10, 650}, {10, 652},
- {10, 654}, {10, 656}, {10, 658}, {10, 660}, {10, 662}, {10, 664},
- {10, 666}, {10, 668}, {10, 670}, {10, 672}, {10, 674}, {10, 676},
- {10, 678}, {10, 680}, {10, 682}, {10, 684}, {10, 686}, {10, 688},
- {10, 690}, {10, 692}, {10, 694}, {10, 696}, {10, 698}, {10, 700},
- {10, 702}, {10, 704}, {10, 706}, {10, 708}, {10, 710}, {10, 712},
- {10, 714}, {10, 716}, {10, 718}, {10, 720}, {10, 722}, {10, 724},
- {10, 726}, {10, 728}, {10, 730}, {10, 732}, {10, 734}, {10, 736},
- {10, 738}, {10, 740}, {10, 742}, {10, 744}, {10, 746}, {10, 748},
- {10, 750}, {10, 752}, {10, 754}, {10, 756}, {10, 758}, {10, 760},
- {10, 762}, {10, 764}, {10, 766}, {10, 768}, {10, 770}, {10, 772},
- {10, 774}, {10, 776}, {10, 778}, {10, 780}, {10, 782}, {10, 784},
- {10, 786}, {10, 788}, {10, 790}, {10, 792}, {10, 794}, {10, 796},
- {10, 798}, {10, 800}, {10, 802}, {10, 804}, {10, 806}, {10, 808},
- {10, 810}, {10, 812}, {10, 814}, {10, 816}, {10, 818}, {10, 820},
- {10, 822}, {10, 824}, {10, 826}, {10, 828}, {10, 830}, {10, 832},
- {10, 834}, {10, 836}, {10, 838}, {10, 840}, {10, 842}, {10, 844},
- {10, 846}, {10, 848}, {10, 850}, {10, 852}, {10, 854}, {10, 856},
- {10, 858}, {10, 860}, {10, 862}, {10, 864}, {10, 866}, {10, 868},
- {10, 870}, {10, 872}, {10, 874}, {10, 876}, {10, 878}, {10, 880},
- {10, 882}, {10, 884}, {10, 886}, {10, 888}, {10, 890}, {10, 892},
- {10, 894}, {10, 896}, {10, 898}, {10, 900}, {10, 902}, {10, 904},
- {10, 906}, {10, 908}, {10, 910}, {10, 912}, {10, 914}, {10, 916},
- {10, 918}, {10, 920}, {10, 922}, {10, 924}, {10, 926}, {10, 928},
- {10, 930}, {10, 932}, {10, 934}, {10, 936}, {10, 938}, {10, 940},
- {10, 942}, {10, 944}, {10, 946}, {10, 948}, {10, 950}, {10, 952},
- {10, 954}, {10, 956}, {10, 958}, {10, 960}, {10, 962}, {10, 964},
- {10, 966}, {10, 968}, {10, 970}, {10, 972}, {10, 974}, {10, 976},
- {10, 978}, {10, 980}, {10, 982}, {10, 984}, {10, 986}, {10, 988},
- {10, 990}, {10, 992}, {10, 994}, {10, 996}, {10, 998}, {10, 1000},
- {10, 1002}, {10, 1004}, {10, 1006}, {10, 1008}, {10, 1010}, {10, 1012},
- {10, 1014}, {10, 1016}, {10, 1018}, {10, 1020}, {10, 1022}, {10, 1024},
- {10, 1026}, {10, 1028}, {10, 1030}, {10, 1032}, {10, 1034}, {10, 1036},
- {10, 1038}, {10, 1040}, {10, 1042}, {10, 1044}, {10, 1046}, {10, 1048},
- {10, 1050}, {10, 1052}, {10, 1054}, {10, 1056}, {10, 1058}, {10, 1060},
- {10, 1062}, {10, 1064}, {10, 1066}, {10, 1068}, {10, 1070}, {10, 1072},
- {10, 1074}, {10, 1076}, {10, 1078}, {10, 1080}, {10, 1082}, {10, 1084},
- {10, 1086}, {10, 1088}, {10, 1090}, {10, 1092}, {10, 1094}, {10, 1096},
- {10, 1098}, {10, 1100}, {10, 1102}, {10, 1104}, {10, 1106}, {10, 1108},
- {10, 1110}, {10, 1112}, {10, 1114}, {10, 1116}, {10, 1118}, {10, 1120},
- {10, 1122}, {10, 1124}, {10, 1126}, {10, 1128}, {10, 1130}, {10, 1132},
- {10, 1134}, {10, 1136}, {10, 1138}, {10, 1140}, {10, 1142}, {10, 1144},
- {10, 1146}, {10, 1148}, {10, 1150}, {10, 1152}, {10, 1154}, {10, 1156},
- {10, 1158}, {10, 1160}, {10, 1162}, {10, 1164}, {10, 1166}, {10, 1168},
- {10, 1170}, {10, 1172}, {10, 1174}, {10, 1176}, {10, 1178}, {10, 1180},
- {10, 1182}, {10, 1184}, {10, 1186}, {10, 1188}, {10, 1190}, {10, 1192},
- {10, 1194}, {10, 1196}, {10, 1198}, {10, 1200}, {10, 1202}, {10, 1204},
- {10, 1206}, {10, 1208}, {10, 1210}, {10, 1212}, {10, 1214}, {10, 1216},
- {10, 1218}, {10, 1220}, {10, 1222}, {10, 1224}, {10, 1226}, {10, 1228},
- {10, 1230}, {10, 1232}, {10, 1234}, {10, 1236}, {10, 1238}, {10, 1240},
- {10, 1242}, {10, 1244}, {10, 1246}, {10, 1248}, {10, 1250}, {10, 1252},
- {10, 1254}, {10, 1256}, {10, 1258}, {10, 1260}, {10, 1262}, {10, 1264},
- {10, 1266}, {10, 1268}, {10, 1270}, {10, 1272}, {10, 1274}, {10, 1276},
- {10, 1278}, {10, 1280}, {10, 1282}, {10, 1284}, {10, 1286}, {10, 1288},
- {10, 1290}, {10, 1292}, {10, 1294}, {10, 1296}, {10, 1298}, {10, 1300},
- {10, 1302}, {10, 1304}, {10, 1306}, {10, 1308}, {10, 1310}, {10, 1312},
- {10, 1314}, {10, 1316}, {10, 1318}, {10, 1320}, {10, 1322}, {10, 1324},
- {10, 1326}, {10, 1328}, {10, 1330}, {10, 1332}, {10, 1334}, {10, 1336},
- {10, 1338}, {10, 1340}, {10, 1342}, {10, 1344}, {10, 1346}, {10, 1348},
- {10, 1350}, {10, 1352}, {10, 1354}, {10, 1356}, {10, 1358}, {10, 1360},
- {10, 1362}, {10, 1364}, {10, 1366}, {10, 1368}, {10, 1370}, {10, 1372},
- {10, 1374}, {10, 1376}, {10, 1378}, {10, 1380}, {10, 1382}, {10, 1384},
- {10, 1386}, {10, 1388}, {10, 1390}, {10, 1392}, {10, 1394}, {10, 1396},
- {10, 1398}, {10, 1400}, {10, 1402}, {10, 1404}, {10, 1406}, {10, 1408},
- {10, 1410}, {10, 1412}, {10, 1414}, {10, 1416}, {10, 1418}, {10, 1420},
- {10, 1422}, {10, 1424}, {10, 1426}, {10, 1428}, {10, 1430}, {10, 1432},
- {10, 1434}, {10, 1436}, {10, 1438}, {10, 1440}, {10, 1442}, {10, 1444},
- {10, 1446}, {10, 1448}, {10, 1450}, {10, 1452}, {10, 1454}, {10, 1456},
- {10, 1458}, {10, 1460}, {10, 1462}, {10, 1464}, {10, 1466}, {10, 1468},
- {10, 1470}, {10, 1472}, {10, 1474}, {10, 1476}, {10, 1478}, {10, 1480},
- {10, 1482}, {10, 1484}, {10, 1486}, {10, 1488}, {10, 1490}, {10, 1492},
- {10, 1494}, {10, 1496}, {10, 1498}, {10, 1500}, {10, 1502}, {10, 1504},
- {10, 1506}, {10, 1508}, {10, 1510}, {10, 1512}, {10, 1514}, {10, 1516},
- {10, 1518}, {10, 1520}, {10, 1522}, {10, 1524}, {10, 1526}, {10, 1528},
- {10, 1530}, {10, 1532}, {10, 1534}, {10, 1536}, {10, 1538}, {10, 1540},
- {10, 1542}, {10, 1544}, {10, 1546}, {10, 1548}, {10, 1550}, {10, 1552},
- {10, 1554}, {10, 1556}, {10, 1558}, {10, 1560}, {10, 1562}, {10, 1564},
- {10, 1566}, {10, 1568}, {10, 1570}, {10, 1572}, {10, 1574}, {10, 1576},
- {10, 1578}, {10, 1580}, {10, 1582}, {10, 1584}, {10, 1586}, {10, 1588},
- {10, 1590}, {10, 1592}, {10, 1594}, {10, 1596}, {10, 1598}, {10, 1600},
- {10, 1602}, {10, 1604}, {10, 1606}, {10, 1608}, {10, 1610}, {10, 1612},
- {10, 1614}, {10, 1616}, {10, 1618}, {10, 1620}, {10, 1622}, {10, 1624},
- {10, 1626}, {10, 1628}, {10, 1630}, {10, 1632}, {10, 1634}, {10, 1636},
- {10, 1638}, {10, 1640}, {10, 1642}, {10, 1644}, {10, 1646}, {10, 1648},
- {10, 1650}, {10, 1652}, {10, 1654}, {10, 1656}, {10, 1658}, {10, 1660},
- {10, 1662}, {10, 1664}, {10, 1666}, {10, 1668}, {10, 1670}, {10, 1672},
- {10, 1674}, {10, 1676}, {10, 1678}, {10, 1680}, {10, 1682}, {10, 1684},
- {10, 1686}, {10, 1688}, {10, 1690}, {10, 1692}, {10, 1694}, {10, 1696},
- {10, 1698}, {10, 1700}, {10, 1702}, {10, 1704}, {10, 1706}, {10, 1708},
- {10, 1710}, {10, 1712}, {10, 1714}, {10, 1716}, {10, 1718}, {10, 1720},
- {10, 1722}, {10, 1724}, {10, 1726}, {10, 1728}, {10, 1730}, {10, 1732},
- {10, 1734}, {10, 1736}, {10, 1738}, {10, 1740}, {10, 1742}, {10, 1744},
- {10, 1746}, {10, 1748}, {10, 1750}, {10, 1752}, {10, 1754}, {10, 1756},
- {10, 1758}, {10, 1760}, {10, 1762}, {10, 1764}, {10, 1766}, {10, 1768},
- {10, 1770}, {10, 1772}, {10, 1774}, {10, 1776}, {10, 1778}, {10, 1780},
- {10, 1782}, {10, 1784}, {10, 1786}, {10, 1788}, {10, 1790}, {10, 1792},
- {10, 1794}, {10, 1796}, {10, 1798}, {10, 1800}, {10, 1802}, {10, 1804},
- {10, 1806}, {10, 1808}, {10, 1810}, {10, 1812}, {10, 1814}, {10, 1816},
- {10, 1818}, {10, 1820}, {10, 1822}, {10, 1824}, {10, 1826}, {10, 1828},
- {10, 1830}, {10, 1832}, {10, 1834}, {10, 1836}, {10, 1838}, {10, 1840},
- {10, 1842}, {10, 1844}, {10, 1846}, {10, 1848}, {10, 1850}, {10, 1852},
- {10, 1854}, {10, 1856}, {10, 1858}, {10, 1860}, {10, 1862}, {10, 1864},
- {10, 1866}, {10, 1868}, {10, 1870}, {10, 1872}, {10, 1874}, {10, 1876},
- {10, 1878}, {10, 1880}, {10, 1882}, {10, 1884}, {10, 1886}, {10, 1888},
- {10, 1890}, {10, 1892}, {10, 1894}, {10, 1896}, {10, 1898}, {10, 1900},
- {10, 1902}, {10, 1904}, {10, 1906}, {10, 1908}, {10, 1910}, {10, 1912},
- {10, 1914}, {10, 1916}, {10, 1918}, {10, 1920}, {10, 1922}, {10, 1924},
- {10, 1926}, {10, 1928}, {10, 1930}, {10, 1932}, {10, 1934}, {10, 1936},
- {10, 1938}, {10, 1940}, {10, 1942}, {10, 1944}, {10, 1946}, {10, 1948},
- {10, 1950}, {10, 1952}, {10, 1954}, {10, 1956}, {10, 1958}, {10, 1960},
- {10, 1962}, {10, 1964}, {10, 1966}, {10, 1968}, {10, 1970}, {10, 1972},
- {10, 1974}, {10, 1976}, {10, 1978}, {10, 1980}, {10, 1982}, {10, 1984},
- {10, 1986}, {10, 1988}, {10, 1990}, {10, 1992}, {10, 1994}, {10, 1996},
- {10, 1998}, {10, 2000}, {10, 2002}, {10, 2004}, {10, 2006}, {10, 2008},
- {10, 2010}, {10, 2012}, {10, 2014}, {10, 2016}, {10, 2018}, {10, 2020},
- {10, 2022}, {10, 2024}, {10, 2026}, {10, 2028}, {10, 2030}, {10, 2032},
- {10, 2034}, {10, 2036}, {10, 2038}, {10, 2040}, {10, 2042}, {10, 2044},
- {10, 2046}, {10, 2048}, {10, 2050}, {10, 2052}, {10, 2054}, {10, 2056},
- {10, 2058}, {10, 2060}, {10, 2062}, {10, 2064}, {10, 2066}, {10, 2068},
- {10, 2070}, {10, 2072}, {10, 2074}, {10, 2076}, {10, 2078}, {10, 2080},
- {10, 2082}, {10, 2084}, {10, 2086}, {10, 2088}, {10, 2090}, {10, 2092},
- {10, 2094}, {10, 2096}, {10, 2098}, {10, 2100}, {10, 2102}, {10, 2104},
- {10, 2106}, {10, 2108}, {10, 2110}, {10, 2112}, {10, 2114}, {10, 2116},
- {10, 2118}, {10, 2120}, {10, 2122}, {10, 2124}, {10, 2126}, {10, 2128},
- {10, 2130}, {10, 2132}, {10, 2134}, {10, 2136}, {10, 2138}, {10, 2140},
- {10, 2142}, {10, 2144}, {10, 2146}, {10, 2148}, {10, 2150}, {10, 2152},
- {10, 2154}, {10, 2156}, {10, 2158}, {10, 2160}, {10, 2162}, {10, 2164},
- {10, 2166}, {10, 2168}, {10, 2170}, {10, 2172}, {10, 2174}, {10, 2176},
- {10, 2178}, {10, 2180}, {10, 2182}, {10, 2184}, {10, 2186}, {10, 2188},
- {10, 2190}, {10, 2192}, {10, 2194}, {10, 2196}, {10, 2198}, {10, 2200},
- {10, 2202}, {10, 2204}, {10, 2206}, {10, 2208}, {10, 2210}, {10, 2212},
- {10, 2214}, {10, 2216}, {10, 2218}, {10, 2220}, {10, 2222}, {10, 2224},
- {10, 2226}, {10, 2228}, {10, 2230}, {10, 2232}, {10, 2234}, {10, 2236},
- {10, 2238}, {10, 2240}, {10, 2242}, {10, 2244}, {10, 2246}, {10, 2248},
- {10, 2250}, {10, 2252}, {10, 2254}, {10, 2256}, {10, 2258}, {10, 2260},
- {10, 2262}, {10, 2264}, {10, 2266}, {10, 2268}, {10, 2270}, {10, 2272},
- {10, 2274}, {10, 2276}, {10, 2278}, {10, 2280}, {10, 2282}, {10, 2284},
- {10, 2286}, {10, 2288}, {10, 2290}, {10, 2292}, {10, 2294}, {10, 2296},
- {10, 2298}, {10, 2300}, {10, 2302}, {10, 2304}, {10, 2306}, {10, 2308},
- {10, 2310}, {10, 2312}, {10, 2314}, {10, 2316}, {10, 2318}, {10, 2320},
- {10, 2322}, {10, 2324}, {10, 2326}, {10, 2328}, {10, 2330}, {10, 2332},
- {10, 2334}, {10, 2336}, {10, 2338}, {10, 2340}, {10, 2342}, {10, 2344},
- {10, 2346}, {10, 2348}, {10, 2350}, {10, 2352}, {10, 2354}, {10, 2356},
- {10, 2358}, {10, 2360}, {10, 2362}, {10, 2364}, {10, 2366}, {10, 2368},
- {10, 2370}, {10, 2372}, {10, 2374}, {10, 2376}, {10, 2378}, {10, 2380},
- {10, 2382}, {10, 2384}, {10, 2386}, {10, 2388}, {10, 2390}, {10, 2392},
- {10, 2394}, {10, 2396}, {10, 2398}, {10, 2400}, {10, 2402}, {10, 2404},
- {10, 2406}, {10, 2408}, {10, 2410}, {10, 2412}, {10, 2414}, {10, 2416},
- {10, 2418}, {10, 2420}, {10, 2422}, {10, 2424}, {10, 2426}, {10, 2428},
- {10, 2430}, {10, 2432}, {10, 2434}, {10, 2436}, {10, 2438}, {10, 2440},
- {10, 2442}, {10, 2444}, {10, 2446}, {10, 2448}, {10, 2450}, {10, 2452},
- {10, 2454}, {10, 2456}, {10, 2458}, {10, 2460}, {10, 2462}, {10, 2464},
- {10, 2466}, {10, 2468}, {10, 2470}, {10, 2472}, {10, 2474}, {10, 2476},
- {10, 2478}, {10, 2480}, {10, 2482}, {10, 2484}, {10, 2486}, {10, 2488},
- {10, 2490}, {10, 2492}, {10, 2494}, {10, 2496}, {10, 2498}, {10, 2500},
- {10, 2502}, {10, 2504}, {10, 2506}, {10, 2508}, {10, 2510}, {10, 2512},
- {10, 2514}, {10, 2516}, {10, 2518}, {10, 2520}, {10, 2522}, {10, 2524},
- {10, 2526}, {10, 2528}, {10, 2530}, {10, 2532}, {10, 2534}, {10, 2536},
- {10, 2538}, {10, 2540}, {10, 2542}, {10, 2544}, {10, 2546}, {10, 2548},
- {10, 2550}, {10, 2552}, {10, 2554}, {10, 2556}, {10, 2558}, {10, 2560},
- {10, 2562}, {10, 2564}, {10, 2566}, {10, 2568}, {10, 2570}, {10, 2572},
- {10, 2574}, {10, 2576}, {10, 2578}, {10, 2580}, {10, 2582}, {10, 2584},
- {10, 2586}, {10, 2588}, {10, 2590}, {10, 2592}, {10, 2594}, {10, 2596},
- {10, 2598}, {10, 2600}, {10, 2602}, {10, 2604}, {10, 2606}, {10, 2608},
- {10, 2610}, {10, 2612}, {10, 2614}, {10, 2616}, {10, 2618}, {10, 2620},
- {10, 2622}, {10, 2624}, {10, 2626}, {10, 2628}, {10, 2630}, {10, 2632},
- {10, 2634}, {10, 2636}, {10, 2638}, {10, 2640}, {10, 2642}, {10, 2644},
- {10, 2646}, {10, 2648}, {10, 2650}, {10, 2652}, {10, 2654}, {10, 2656},
- {10, 2658}, {10, 2660}, {10, 2662}, {10, 2664}, {10, 2666}, {10, 2668},
- {10, 2670}, {10, 2672}, {10, 2674}, {10, 2676}, {10, 2678}, {10, 2680},
- {10, 2682}, {10, 2684}, {10, 2686}, {10, 2688}, {10, 2690}, {10, 2692},
- {10, 2694}, {10, 2696}, {10, 2698}, {10, 2700}, {10, 2702}, {10, 2704},
- {10, 2706}, {10, 2708}, {10, 2710}, {10, 2712}, {10, 2714}, {10, 2716},
- {10, 2718}, {10, 2720}, {10, 2722}, {10, 2724}, {10, 2726}, {10, 2728},
- {10, 2730}, {10, 2732}, {10, 2734}, {10, 2736}, {10, 2738}, {10, 2740},
- {10, 2742}, {10, 2744}, {10, 2746}, {10, 2748}, {10, 2750}, {10, 2752},
- {10, 2754}, {10, 2756}, {10, 2758}, {10, 2760}, {10, 2762}, {10, 2764},
- {10, 2766}, {10, 2768}, {10, 2770}, {10, 2772}, {10, 2774}, {10, 2776},
- {10, 2778}, {10, 2780}, {10, 2782}, {10, 2784}, {10, 2786}, {10, 2788},
- {10, 2790}, {10, 2792}, {10, 2794}, {10, 2796}, {10, 2798}, {10, 2800},
- {10, 2802}, {10, 2804}, {10, 2806}, {10, 2808}, {10, 2810}, {10, 2812},
- {10, 2814}, {10, 2816}, {10, 2818}, {10, 2820}, {10, 2822}, {10, 2824},
- {10, 2826}, {10, 2828}, {10, 2830}, {10, 2832}, {10, 2834}, {10, 2836},
- {10, 2838}, {10, 2840}, {10, 2842}, {10, 2844}, {10, 2846}, {10, 2848},
- {10, 2850}, {10, 2852}, {10, 2854}, {10, 2856}, {10, 2858}, {10, 2860},
- {10, 2862}, {10, 2864}, {10, 2866}, {10, 2868}, {10, 2870}, {10, 2872},
- {10, 2874}, {10, 2876}, {10, 2878}, {10, 2880}, {10, 2882}, {10, 2884},
- {10, 2886}, {10, 2888}, {10, 2890}, {10, 2892}, {10, 2894}, {10, 2896},
- {10, 2898}, {10, 2900}, {10, 2902}, {10, 2904}, {10, 2906}, {10, 2908},
- {10, 2910}, {10, 2912}, {10, 2914}, {10, 2916}, {10, 2918}, {10, 2920},
- {10, 2922}, {10, 2924}, {10, 2926}, {10, 2928}, {10, 2930}, {10, 2932},
- {10, 2934}, {10, 2936}, {10, 2938}, {10, 2940}, {10, 2942}, {10, 2944},
- {10, 2946}, {10, 2948}, {10, 2950}, {10, 2952}, {10, 2954}, {10, 2956},
- {10, 2958}, {10, 2960}, {10, 2962}, {10, 2964}, {10, 2966}, {10, 2968},
- {10, 2970}, {10, 2972}, {10, 2974}, {10, 2976}, {10, 2978}, {10, 2980},
- {10, 2982}, {10, 2984}, {10, 2986}, {10, 2988}, {10, 2990}, {10, 2992},
- {10, 2994}, {10, 2996}, {10, 2998}, {10, 3000}, {10, 3002}, {10, 3004},
- {10, 3006}, {10, 3008}, {10, 3010}, {10, 3012}, {10, 3014}, {10, 3016},
- {10, 3018}, {10, 3020}, {10, 3022}, {10, 3024}, {10, 3026}, {10, 3028},
- {10, 3030}, {10, 3032}, {10, 3034}, {10, 3036}, {10, 3038}, {10, 3040},
- {10, 3042}, {10, 3044}, {10, 3046}, {10, 3048}, {10, 3050}, {10, 3052},
- {10, 3054}, {10, 3056}, {10, 3058}, {10, 3060}, {10, 3062}, {10, 3064},
- {10, 3066}, {10, 3068}, {10, 3070}, {10, 3072}, {10, 3074}, {10, 3076},
- {10, 3078}, {10, 3080}, {10, 3082}, {10, 3084}, {10, 3086}, {10, 3088},
- {10, 3090}, {10, 3092}, {10, 3094}, {10, 3096}, {10, 3098}, {10, 3100},
- {10, 3102}, {10, 3104}, {10, 3106}, {10, 3108}, {10, 3110}, {10, 3112},
- {10, 3114}, {10, 3116}, {10, 3118}, {10, 3120}, {10, 3122}, {10, 3124},
- {10, 3126}, {10, 3128}, {10, 3130}, {10, 3132}, {10, 3134}, {10, 3136},
- {10, 3138}, {10, 3140}, {10, 3142}, {10, 3144}, {10, 3146}, {10, 3148},
- {10, 3150}, {10, 3152}, {10, 3154}, {10, 3156}, {10, 3158}, {10, 3160},
- {10, 3162}, {10, 3164}, {10, 3166}, {10, 3168}, {10, 3170}, {10, 3172},
- {10, 3174}, {10, 3176}, {10, 3178}, {10, 3180}, {10, 3182}, {10, 3184},
- {10, 3186}, {10, 3188}, {10, 3190}, {10, 3192}, {10, 3194}, {10, 3196},
- {10, 3198}, {10, 3200}, {10, 3202}, {10, 3204}, {10, 3206}, {10, 3208},
- {10, 3210}, {10, 3212}, {10, 3214}, {10, 3216}, {10, 3218}, {10, 3220},
- {10, 3222}, {10, 3224}, {10, 3226}, {10, 3228}, {10, 3230}, {10, 3232},
- {10, 3234}, {10, 3236}, {10, 3238}, {10, 3240}, {10, 3242}, {10, 3244},
- {10, 3246}, {10, 3248}, {10, 3250}, {10, 3252}, {10, 3254}, {10, 3256},
- {10, 3258}, {10, 3260}, {10, 3262}, {10, 3264}, {10, 3266}, {10, 3268},
- {10, 3270}, {10, 3272}, {10, 3274}, {10, 3276}, {10, 3278}, {10, 3280},
- {10, 3282}, {10, 3284}, {10, 3286}, {10, 3288}, {10, 3290}, {10, 3292},
- {10, 3294}, {10, 3296}, {10, 3298}, {10, 3300}, {10, 3302}, {10, 3304},
- {10, 3306}, {10, 3308}, {10, 3310}, {10, 3312}, {10, 3314}, {10, 3316},
- {10, 3318}, {10, 3320}, {10, 3322}, {10, 3324}, {10, 3326}, {10, 3328},
- {10, 3330}, {10, 3332}, {10, 3334}, {10, 3336}, {10, 3338}, {10, 3340},
- {10, 3342}, {10, 3344}, {10, 3346}, {10, 3348}, {10, 3350}, {10, 3352},
- {10, 3354}, {10, 3356}, {10, 3358}, {10, 3360}, {10, 3362}, {10, 3364},
- {10, 3366}, {10, 3368}, {10, 3370}, {10, 3372}, {10, 3374}, {10, 3376},
- {10, 3378}, {10, 3380}, {10, 3382}, {10, 3384}, {10, 3386}, {10, 3388},
- {10, 3390}, {10, 3392}, {10, 3394}, {10, 3396}, {10, 3398}, {10, 3400},
- {10, 3402}, {10, 3404}, {10, 3406}, {10, 3408}, {10, 3410}, {10, 3412},
- {10, 3414}, {10, 3416}, {10, 3418}, {10, 3420}, {10, 3422}, {10, 3424},
- {10, 3426}, {10, 3428}, {10, 3430}, {10, 3432}, {10, 3434}, {10, 3436},
- {10, 3438}, {10, 3440}, {10, 3442}, {10, 3444}, {10, 3446}, {10, 3448},
- {10, 3450}, {10, 3452}, {10, 3454}, {10, 3456}, {10, 3458}, {10, 3460},
- {10, 3462}, {10, 3464}, {10, 3466}, {10, 3468}, {10, 3470}, {10, 3472},
- {10, 3474}, {10, 3476}, {10, 3478}, {10, 3480}, {10, 3482}, {10, 3484},
- {10, 3486}, {10, 3488}, {10, 3490}, {10, 3492}, {10, 3494}, {10, 3496},
- {10, 3498}, {10, 3500}, {10, 3502}, {10, 3504}, {10, 3506}, {10, 3508},
- {10, 3510}, {10, 3512}, {10, 3514}, {10, 3516}, {10, 3518}, {10, 3520},
- {10, 3522}, {10, 3524}, {10, 3526}, {10, 3528}, {10, 3530}, {10, 3532},
- {10, 3534}, {10, 3536}, {10, 3538}, {10, 3540}, {10, 3542}, {10, 3544},
- {10, 3546}, {10, 3548}, {10, 3550}, {10, 3552}, {10, 3554}, {10, 3556},
- {10, 3558}, {10, 3560}, {10, 3562}, {10, 3564}, {10, 3566}, {10, 3568},
- {10, 3570}, {10, 3572}, {10, 3574}, {10, 3576}, {10, 3578}, {10, 3580},
- {10, 3582}, {10, 3584}, {10, 3586}, {10, 3588}, {10, 3590}, {10, 3592},
- {10, 3594}, {10, 3596}, {10, 3598}, {10, 3600}, {10, 3602}, {10, 3604},
- {10, 3606}, {10, 3608}, {10, 3610}, {10, 3612}, {10, 3614}, {10, 3616},
- {10, 3618}, {10, 3620}, {10, 3622}, {10, 3624}, {10, 3626}, {10, 3628},
- {10, 3630}, {10, 3632}, {10, 3634}, {10, 3636}, {10, 3638}, {10, 3640},
- {10, 3642}, {10, 3644}, {10, 3646}, {10, 3648}, {10, 3650}, {10, 3652},
- {10, 3654}, {10, 3656}, {10, 3658}, {10, 3660}, {10, 3662}, {10, 3664},
- {10, 3666}, {10, 3668}, {10, 3670}, {10, 3672}, {10, 3674}, {10, 3676},
- {10, 3678}, {10, 3680}, {10, 3682}, {10, 3684}, {10, 3686}, {10, 3688},
- {10, 3690}, {10, 3692}, {10, 3694}, {10, 3696}, {10, 3698}, {10, 3700},
- {10, 3702}, {10, 3704}, {10, 3706}, {10, 3708}, {10, 3710}, {10, 3712},
- {10, 3714}, {10, 3716}, {10, 3718}, {10, 3720}, {10, 3722}, {10, 3724},
- {10, 3726}, {10, 3728}, {10, 3730}, {10, 3732}, {10, 3734}, {10, 3736},
- {10, 3738}, {10, 3740}, {10, 3742}, {10, 3744}, {10, 3746}, {10, 3748},
- {10, 3750}, {10, 3752}, {10, 3754}, {10, 3756}, {10, 3758}, {10, 3760},
- {10, 3762}, {10, 3764}, {10, 3766}, {10, 3768}, {10, 3770}, {10, 3772},
- {10, 3774}, {10, 3776}, {10, 3778}, {10, 3780}, {10, 3782}, {10, 3784},
- {10, 3786}, {10, 3788}, {10, 3790}, {10, 3792}, {10, 3794}, {10, 3796},
- {10, 3798}, {10, 3800}, {10, 3802}, {10, 3804}, {10, 3806}, {10, 3808},
- {10, 3810}, {10, 3812}, {10, 3814}, {10, 3816}, {10, 3818}, {10, 3820},
- {10, 3822}, {10, 3824}, {10, 3826}, {10, 3828}, {10, 3830}, {10, 3832},
- {10, 3834}, {10, 3836}, {10, 3838}, {10, 3840}, {10, 3842}, {10, 3844},
- {10, 3846}, {10, 3848}, {10, 3850}, {10, 3852}, {10, 3854}, {10, 3856},
- {10, 3858}, {10, 3860}, {10, 3862}, {10, 3864}, {10, 3866}, {10, 3868},
- {10, 3870}, {10, 3872}, {10, 3874}, {10, 3876}, {10, 3878}, {10, 3880},
- {10, 3882}, {10, 3884}, {10, 3886}, {10, 3888}, {10, 3890}, {10, 3892},
- {10, 3894}, {10, 3896}, {10, 3898}, {10, 3900}, {10, 3902}, {10, 3904},
- {10, 3906}, {10, 3908}, {10, 3910}, {10, 3912}, {10, 3914}, {10, 3916},
- {10, 3918}, {10, 3920}, {10, 3922}, {10, 3924}, {10, 3926}, {10, 3928},
- {10, 3930}, {10, 3932}, {10, 3934}, {10, 3936}, {10, 3938}, {10, 3940},
- {10, 3942}, {10, 3944}, {10, 3946}, {10, 3948}, {10, 3950}, {10, 3952},
- {10, 3954}, {10, 3956}, {10, 3958}, {10, 3960}
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_DCT_VALUE_TOKENS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/defaultcoefcounts.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/defaultcoefcounts.h
deleted file mode 100644
index 1e8e804..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/defaultcoefcounts.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_ENCODER_DEFAULTCOEFCOUNTS_H_
-#define VP8_ENCODER_DEFAULTCOEFCOUNTS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Generated file, included by entropy.c */
-
-static const unsigned int default_coef_counts[BLOCK_TYPES]
- [COEF_BANDS]
- [PREV_COEF_CONTEXTS]
- [MAX_ENTROPY_TOKENS] =
-{
-
- {
- /* Block Type ( 0 ) */
- {
- /* Coeff Band ( 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,},
- },
- {
- /* Coeff Band ( 1 ) */
- {30190, 26544, 225, 24, 4, 0, 0, 0, 0, 0, 0, 4171593,},
- {26846, 25157, 1241, 130, 26, 6, 1, 0, 0, 0, 0, 149987,},
- {10484, 9538, 1006, 160, 36, 18, 0, 0, 0, 0, 0, 15104,},
- },
- {
- /* Coeff Band ( 2 ) */
- {25842, 40456, 1126, 83, 11, 2, 0, 0, 0, 0, 0, 0,},
- {9338, 8010, 512, 73, 7, 3, 2, 0, 0, 0, 0, 43294,},
- {1047, 751, 149, 31, 13, 6, 1, 0, 0, 0, 0, 879,},
- },
- {
- /* Coeff Band ( 3 ) */
- {26136, 9826, 252, 13, 0, 0, 0, 0, 0, 0, 0, 0,},
- {8134, 5574, 191, 14, 2, 0, 0, 0, 0, 0, 0, 35302,},
- { 605, 677, 116, 9, 1, 0, 0, 0, 0, 0, 0, 611,},
- },
- {
- /* Coeff Band ( 4 ) */
- {10263, 15463, 283, 17, 0, 0, 0, 0, 0, 0, 0, 0,},
- {2773, 2191, 128, 9, 2, 2, 0, 0, 0, 0, 0, 10073,},
- { 134, 125, 32, 4, 0, 2, 0, 0, 0, 0, 0, 50,},
- },
- {
- /* Coeff Band ( 5 ) */
- {10483, 2663, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0,},
- {2137, 1251, 27, 1, 1, 0, 0, 0, 0, 0, 0, 14362,},
- { 116, 156, 14, 2, 1, 0, 0, 0, 0, 0, 0, 190,},
- },
- {
- /* Coeff Band ( 6 ) */
- {40977, 27614, 412, 28, 0, 0, 0, 0, 0, 0, 0, 0,},
- {6113, 5213, 261, 22, 3, 0, 0, 0, 0, 0, 0, 26164,},
- { 382, 312, 50, 14, 2, 0, 0, 0, 0, 0, 0, 345,},
- },
- {
- /* Coeff Band ( 7 ) */
- { 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319,},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,},
- },
- },
- {
- /* Block Type ( 1 ) */
- {
- /* Coeff Band ( 0 ) */
- {3268, 19382, 1043, 250, 93, 82, 49, 26, 17, 8, 25, 82289,},
- {8758, 32110, 5436, 1832, 827, 668, 420, 153, 24, 0, 3, 52914,},
- {9337, 23725, 8487, 3954, 2107, 1836, 1069, 399, 59, 0, 0, 18620,},
- },
- {
- /* Coeff Band ( 1 ) */
- {12419, 8420, 452, 62, 9, 1, 0, 0, 0, 0, 0, 0,},
- {11715, 8705, 693, 92, 15, 7, 2, 0, 0, 0, 0, 53988,},
- {7603, 8585, 2306, 778, 270, 145, 39, 5, 0, 0, 0, 9136,},
- },
- {
- /* Coeff Band ( 2 ) */
- {15938, 14335, 1207, 184, 55, 13, 4, 1, 0, 0, 0, 0,},
- {7415, 6829, 1138, 244, 71, 26, 7, 0, 0, 0, 0, 9980,},
- {1580, 1824, 655, 241, 89, 46, 10, 2, 0, 0, 0, 429,},
- },
- {
- /* Coeff Band ( 3 ) */
- {19453, 5260, 201, 19, 0, 0, 0, 0, 0, 0, 0, 0,},
- {9173, 3758, 213, 22, 1, 1, 0, 0, 0, 0, 0, 9820,},
- {1689, 1277, 276, 51, 17, 4, 0, 0, 0, 0, 0, 679,},
- },
- {
- /* Coeff Band ( 4 ) */
- {12076, 10667, 620, 85, 19, 9, 5, 0, 0, 0, 0, 0,},
- {4665, 3625, 423, 55, 19, 9, 0, 0, 0, 0, 0, 5127,},
- { 415, 440, 143, 34, 20, 7, 2, 0, 0, 0, 0, 101,},
- },
- {
- /* Coeff Band ( 5 ) */
- {12183, 4846, 115, 11, 1, 0, 0, 0, 0, 0, 0, 0,},
- {4226, 3149, 177, 21, 2, 0, 0, 0, 0, 0, 0, 7157,},
- { 375, 621, 189, 51, 11, 4, 1, 0, 0, 0, 0, 198,},
- },
- {
- /* Coeff Band ( 6 ) */
- {61658, 37743, 1203, 94, 10, 3, 0, 0, 0, 0, 0, 0,},
- {15514, 11563, 903, 111, 14, 5, 0, 0, 0, 0, 0, 25195,},
- { 929, 1077, 291, 78, 14, 7, 1, 0, 0, 0, 0, 507,},
- },
- {
- /* Coeff Band ( 7 ) */
- { 0, 990, 15, 3, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 0, 412, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1641,},
- { 0, 18, 7, 1, 0, 0, 0, 0, 0, 0, 0, 30,},
- },
- },
- {
- /* Block Type ( 2 ) */
- {
- /* Coeff Band ( 0 ) */
- { 953, 24519, 628, 120, 28, 12, 4, 0, 0, 0, 0, 2248798,},
- {1525, 25654, 2647, 617, 239, 143, 42, 5, 0, 0, 0, 66837,},
- {1180, 11011, 3001, 1237, 532, 448, 239, 54, 5, 0, 0, 7122,},
- },
- {
- /* Coeff Band ( 1 ) */
- {1356, 2220, 67, 10, 4, 1, 0, 0, 0, 0, 0, 0,},
- {1450, 2544, 102, 18, 4, 3, 0, 0, 0, 0, 0, 57063,},
- {1182, 2110, 470, 130, 41, 21, 0, 0, 0, 0, 0, 6047,},
- },
- {
- /* Coeff Band ( 2 ) */
- { 370, 3378, 200, 30, 5, 4, 1, 0, 0, 0, 0, 0,},
- { 293, 1006, 131, 29, 11, 0, 0, 0, 0, 0, 0, 5404,},
- { 114, 387, 98, 23, 4, 8, 1, 0, 0, 0, 0, 236,},
- },
- {
- /* Coeff Band ( 3 ) */
- { 579, 194, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 395, 213, 5, 1, 0, 0, 0, 0, 0, 0, 0, 4157,},
- { 119, 122, 4, 0, 0, 0, 0, 0, 0, 0, 0, 300,},
- },
- {
- /* Coeff Band ( 4 ) */
- { 38, 557, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 21, 114, 12, 1, 0, 0, 0, 0, 0, 0, 0, 427,},
- { 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,},
- },
- {
- /* Coeff Band ( 5 ) */
- { 52, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 18, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652,},
- { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,},
- },
- {
- /* Coeff Band ( 6 ) */
- { 640, 569, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 25, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 517,},
- { 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,},
- },
- {
- /* Coeff Band ( 7 ) */
- { 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,},
- },
- },
- {
- /* Block Type ( 3 ) */
- {
- /* Coeff Band ( 0 ) */
- {2506, 20161, 2707, 767, 261, 178, 107, 30, 14, 3, 0, 100694,},
- {8806, 36478, 8817, 3268, 1280, 850, 401, 114, 42, 0, 0, 58572,},
- {11003, 27214, 11798, 5716, 2482, 2072, 1048, 175, 32, 0, 0, 19284,},
- },
- {
- /* Coeff Band ( 1 ) */
- {9738, 11313, 959, 205, 70, 18, 11, 1, 0, 0, 0, 0,},
- {12628, 15085, 1507, 273, 52, 19, 9, 0, 0, 0, 0, 54280,},
- {10701, 15846, 5561, 1926, 813, 570, 249, 36, 0, 0, 0, 6460,},
- },
- {
- /* Coeff Band ( 2 ) */
- {6781, 22539, 2784, 634, 182, 123, 20, 4, 0, 0, 0, 0,},
- {6263, 11544, 2649, 790, 259, 168, 27, 5, 0, 0, 0, 20539,},
- {3109, 4075, 2031, 896, 457, 386, 158, 29, 0, 0, 0, 1138,},
- },
- {
- /* Coeff Band ( 3 ) */
- {11515, 4079, 465, 73, 5, 14, 2, 0, 0, 0, 0, 0,},
- {9361, 5834, 650, 96, 24, 8, 4, 0, 0, 0, 0, 22181,},
- {4343, 3974, 1360, 415, 132, 96, 14, 1, 0, 0, 0, 1267,},
- },
- {
- /* Coeff Band ( 4 ) */
- {4787, 9297, 823, 168, 44, 12, 4, 0, 0, 0, 0, 0,},
- {3619, 4472, 719, 198, 60, 31, 3, 0, 0, 0, 0, 8401,},
- {1157, 1175, 483, 182, 88, 31, 8, 0, 0, 0, 0, 268,},
- },
- {
- /* Coeff Band ( 5 ) */
- {8299, 1226, 32, 5, 1, 0, 0, 0, 0, 0, 0, 0,},
- {3502, 1568, 57, 4, 1, 1, 0, 0, 0, 0, 0, 9811,},
- {1055, 1070, 166, 29, 6, 1, 0, 0, 0, 0, 0, 527,},
- },
- {
- /* Coeff Band ( 6 ) */
- {27414, 27927, 1989, 347, 69, 26, 0, 0, 0, 0, 0, 0,},
- {5876, 10074, 1574, 341, 91, 24, 4, 0, 0, 0, 0, 21954,},
- {1571, 2171, 778, 324, 124, 65, 16, 0, 0, 0, 0, 979,},
- },
- {
- /* Coeff Band ( 7 ) */
- { 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
- { 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 459,},
- { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13,},
- },
- },
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_DEFAULTCOEFCOUNTS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.c
deleted file mode 100644
index efe4a47..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "denoising.h"
-
-#include "vp8/common/reconinter.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8_rtcd.h"
-
-static const unsigned int NOISE_MOTION_THRESHOLD = 25 * 25;
-/* SSE_DIFF_THRESHOLD is selected as ~95% confidence assuming
- * var(noise) ~= 100.
- */
-static const unsigned int SSE_DIFF_THRESHOLD = 16 * 16 * 20;
-static const unsigned int SSE_THRESHOLD = 16 * 16 * 40;
-
-/*
- * The filter function was modified to reduce the computational complexity.
- * Step 1:
- * Instead of applying tap coefficients for each pixel, we calculated the
- * pixel adjustments vs. pixel diff value ahead of time.
- * adjustment = filtered_value - current_raw
- * = (filter_coefficient * diff + 128) >> 8
- * where
- * filter_coefficient = (255 << 8) / (256 + ((absdiff * 330) >> 3));
- * filter_coefficient += filter_coefficient /
- * (3 + motion_magnitude_adjustment);
- * filter_coefficient is clamped to 0 ~ 255.
- *
- * Step 2:
- * The adjustment vs. diff curve becomes flat very quick when diff increases.
- * This allowed us to use only several levels to approximate the curve without
- * changing the filtering algorithm too much.
- * The adjustments were further corrected by checking the motion magnitude.
- * The levels used are:
- * diff adjustment w/o motion correction adjustment w/ motion correction
- * [-255, -16] -6 -7
- * [-15, -8] -4 -5
- * [-7, -4] -3 -4
- * [-3, 3] diff diff
- * [4, 7] 3 4
- * [8, 15] 4 5
- * [16, 255] 6 7
- */
-
-int vp8_denoiser_filter_c(YV12_BUFFER_CONFIG *mc_running_avg,
- YV12_BUFFER_CONFIG *running_avg, MACROBLOCK *signal,
- unsigned int motion_magnitude, int y_offset,
- int uv_offset)
-{
- unsigned char *sig = signal->thismb;
- int sig_stride = 16;
- unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset;
- int mc_avg_y_stride = mc_running_avg->y_stride;
- unsigned char *running_avg_y = running_avg->y_buffer + y_offset;
- int avg_y_stride = running_avg->y_stride;
- int r, c, i;
- int sum_diff = 0;
- int adj_val[3] = {3, 4, 6};
- (void)uv_offset;
-
- /* If motion_magnitude is small, making the denoiser more aggressive by
- * increasing the adjustment for each level. */
- if (motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD)
- {
- for (i = 0; i < 3; i++)
- adj_val[i] += 1;
- }
-
- for (r = 0; r < 16; ++r)
- {
- for (c = 0; c < 16; ++c)
- {
- int diff = 0;
- int adjustment = 0;
- int absdiff = 0;
-
- diff = mc_running_avg_y[c] - sig[c];
- absdiff = abs(diff);
-
- /* When |diff| < 4, use pixel value from last denoised raw. */
- if (absdiff <= 3)
- {
- running_avg_y[c] = mc_running_avg_y[c];
- sum_diff += diff;
- }
- else
- {
- if (absdiff >= 4 && absdiff <= 7)
- adjustment = adj_val[0];
- else if (absdiff >= 8 && absdiff <= 15)
- adjustment = adj_val[1];
- else
- adjustment = adj_val[2];
-
- if (diff > 0)
- {
- if ((sig[c] + adjustment) > 255)
- running_avg_y[c] = 255;
- else
- running_avg_y[c] = sig[c] + adjustment;
-
- sum_diff += adjustment;
- }
- else
- {
- if ((sig[c] - adjustment) < 0)
- running_avg_y[c] = 0;
- else
- running_avg_y[c] = sig[c] - adjustment;
-
- sum_diff -= adjustment;
- }
- }
- }
-
- /* Update pointers for next iteration. */
- sig += sig_stride;
- mc_running_avg_y += mc_avg_y_stride;
- running_avg_y += avg_y_stride;
- }
-
- if (abs(sum_diff) > SUM_DIFF_THRESHOLD)
- return COPY_BLOCK;
-
- vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride,
- signal->thismb, sig_stride);
- return FILTER_BLOCK;
-}
-
-int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height)
-{
- int i;
- assert(denoiser);
-
- for (i = 0; i < MAX_REF_FRAMES; i++)
- {
- denoiser->yv12_running_avg[i].flags = 0;
-
- if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_running_avg[i]), width,
- height, VP8BORDERINPIXELS)
- < 0)
- {
- vp8_denoiser_free(denoiser);
- return 1;
- }
- vpx_memset(denoiser->yv12_running_avg[i].buffer_alloc, 0,
- denoiser->yv12_running_avg[i].frame_size);
-
- }
- denoiser->yv12_mc_running_avg.flags = 0;
-
- if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_mc_running_avg), width,
- height, VP8BORDERINPIXELS) < 0)
- {
- vp8_denoiser_free(denoiser);
- return 1;
- }
-
- vpx_memset(denoiser->yv12_mc_running_avg.buffer_alloc, 0,
- denoiser->yv12_mc_running_avg.frame_size);
- return 0;
-}
-
-void vp8_denoiser_free(VP8_DENOISER *denoiser)
-{
- int i;
- assert(denoiser);
-
- for (i = 0; i < MAX_REF_FRAMES ; i++)
- {
- vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]);
- }
- vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_mc_running_avg);
-}
-
-
-void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
- MACROBLOCK *x,
- unsigned int best_sse,
- unsigned int zero_mv_sse,
- int recon_yoffset,
- int recon_uvoffset)
-{
- int mv_row;
- int mv_col;
- unsigned int motion_magnitude2;
-
- MV_REFERENCE_FRAME frame = x->best_reference_frame;
- MV_REFERENCE_FRAME zero_frame = x->best_zeromv_reference_frame;
-
- enum vp8_denoiser_decision decision = FILTER_BLOCK;
-
- if (zero_frame)
- {
- YV12_BUFFER_CONFIG *src = &denoiser->yv12_running_avg[frame];
- YV12_BUFFER_CONFIG *dst = &denoiser->yv12_mc_running_avg;
- YV12_BUFFER_CONFIG saved_pre,saved_dst;
- MB_MODE_INFO saved_mbmi;
- MACROBLOCKD *filter_xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &filter_xd->mode_info_context->mbmi;
- int sse_diff = zero_mv_sse - best_sse;
-
- saved_mbmi = *mbmi;
-
- /* Use the best MV for the compensation. */
- mbmi->ref_frame = x->best_reference_frame;
- mbmi->mode = x->best_sse_inter_mode;
- mbmi->mv = x->best_sse_mv;
- mbmi->need_to_clamp_mvs = x->need_to_clamp_best_mvs;
- mv_col = x->best_sse_mv.as_mv.col;
- mv_row = x->best_sse_mv.as_mv.row;
-
- if (frame == INTRA_FRAME ||
- ((unsigned int)(mv_row *mv_row + mv_col *mv_col)
- <= NOISE_MOTION_THRESHOLD &&
- sse_diff < (int)SSE_DIFF_THRESHOLD))
- {
- /*
- * Handle intra blocks as referring to last frame with zero motion
- * and let the absolute pixel difference affect the filter factor.
- * Also consider small amount of motion as being random walk due
- * to noise, if it doesn't mean that we get a much bigger error.
- * Note that any changes to the mode info only affects the
- * denoising.
- */
- mbmi->ref_frame =
- x->best_zeromv_reference_frame;
-
- src = &denoiser->yv12_running_avg[zero_frame];
-
- mbmi->mode = ZEROMV;
- mbmi->mv.as_int = 0;
- x->best_sse_inter_mode = ZEROMV;
- x->best_sse_mv.as_int = 0;
- best_sse = zero_mv_sse;
- }
-
- saved_pre = filter_xd->pre;
- saved_dst = filter_xd->dst;
-
- /* Compensate the running average. */
- filter_xd->pre.y_buffer = src->y_buffer + recon_yoffset;
- filter_xd->pre.u_buffer = src->u_buffer + recon_uvoffset;
- filter_xd->pre.v_buffer = src->v_buffer + recon_uvoffset;
- /* Write the compensated running average to the destination buffer. */
- filter_xd->dst.y_buffer = dst->y_buffer + recon_yoffset;
- filter_xd->dst.u_buffer = dst->u_buffer + recon_uvoffset;
- filter_xd->dst.v_buffer = dst->v_buffer + recon_uvoffset;
-
- if (!x->skip)
- {
- vp8_build_inter_predictors_mb(filter_xd);
- }
- else
- {
- vp8_build_inter16x16_predictors_mb(filter_xd,
- filter_xd->dst.y_buffer,
- filter_xd->dst.u_buffer,
- filter_xd->dst.v_buffer,
- filter_xd->dst.y_stride,
- filter_xd->dst.uv_stride);
- }
- filter_xd->pre = saved_pre;
- filter_xd->dst = saved_dst;
- *mbmi = saved_mbmi;
-
- }
-
- mv_row = x->best_sse_mv.as_mv.row;
- mv_col = x->best_sse_mv.as_mv.col;
- motion_magnitude2 = mv_row * mv_row + mv_col * mv_col;
- if (best_sse > SSE_THRESHOLD || motion_magnitude2
- > 8 * NOISE_MOTION_THRESHOLD)
- {
- decision = COPY_BLOCK;
- }
-
- if (decision == FILTER_BLOCK)
- {
- /* Filter. */
- decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg,
- &denoiser->yv12_running_avg[INTRA_FRAME],
- x,
- motion_magnitude2,
- recon_yoffset, recon_uvoffset);
- }
- if (decision == COPY_BLOCK)
- {
- /* No filtering of this block; it differs too much from the predictor,
- * or the motion vector magnitude is considered too big.
- */
- vp8_copy_mem16x16(
- x->thismb, 16,
- denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset,
- denoiser->yv12_running_avg[INTRA_FRAME].y_stride);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.h
deleted file mode 100644
index cc9913a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/denoising.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_ENCODER_DENOISING_H_
-#define VP8_ENCODER_DENOISING_H_
-
-#include "block.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SUM_DIFF_THRESHOLD (16 * 16 * 2)
-#define MOTION_MAGNITUDE_THRESHOLD (8*3)
-
-enum vp8_denoiser_decision
-{
- COPY_BLOCK,
- FILTER_BLOCK
-};
-
-typedef struct vp8_denoiser
-{
- YV12_BUFFER_CONFIG yv12_running_avg[MAX_REF_FRAMES];
- YV12_BUFFER_CONFIG yv12_mc_running_avg;
-} VP8_DENOISER;
-
-int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height);
-
-void vp8_denoiser_free(VP8_DENOISER *denoiser);
-
-void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
- MACROBLOCK *x,
- unsigned int best_sse,
- unsigned int zero_mv_sse,
- int recon_yoffset,
- int recon_uvoffset);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_DENOISING_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.c
deleted file mode 100644
index 90c9596..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.c
+++ /dev/null
@@ -1,1405 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "encodemb.h"
-#include "encodemv.h"
-#include "vp8/common/common.h"
-#include "onyx_int.h"
-#include "vp8/common/extend.h"
-#include "vp8/common/entropymode.h"
-#include "vp8/common/quant_common.h"
-#include "segmentation.h"
-#include "vp8/common/setupintrarecon.h"
-#include "encodeintra.h"
-#include "vp8/common/reconinter.h"
-#include "rdopt.h"
-#include "pickinter.h"
-#include "vp8/common/findnearmv.h"
-#include <stdio.h>
-#include <limits.h>
-#include "vp8/common/invtrans.h"
-#include "vpx_ports/vpx_timer.h"
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
-#include "bitstream.h"
-#endif
-#include "encodeframe.h"
-
-extern void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t) ;
-extern void vp8_calc_ref_frame_costs(int *ref_frame_cost,
- int prob_intra,
- int prob_last,
- int prob_garf
- );
-extern void vp8_convert_rfct_to_prob(VP8_COMP *const cpi);
-extern void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex);
-extern void vp8_auto_select_speed(VP8_COMP *cpi);
-extern void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
- MACROBLOCK *x,
- MB_ROW_COMP *mbr_ei,
- int count);
-static void adjust_act_zbin( VP8_COMP *cpi, MACROBLOCK *x );
-
-#ifdef MODE_STATS
-unsigned int inter_y_modes[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-unsigned int inter_uv_modes[4] = {0, 0, 0, 0};
-unsigned int inter_b_modes[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-unsigned int y_modes[5] = {0, 0, 0, 0, 0};
-unsigned int uv_modes[4] = {0, 0, 0, 0};
-unsigned int b_modes[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-#endif
-
-
-/* activity_avg must be positive, or flat regions could get a zero weight
- * (infinite lambda), which confounds analysis.
- * This also avoids the need for divide by zero checks in
- * vp8_activity_masking().
- */
-#define VP8_ACTIVITY_AVG_MIN (64)
-
-/* This is used as a reference when computing the source variance for the
- * purposes of activity masking.
- * Eventually this should be replaced by custom no-reference routines,
- * which will be faster.
- */
-static const unsigned char VP8_VAR_OFFS[16]=
-{
- 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
-};
-
-
-/* Original activity measure from Tim T's code. */
-static unsigned int tt_activity_measure( VP8_COMP *cpi, MACROBLOCK *x )
-{
- unsigned int act;
- unsigned int sse;
- /* TODO: This could also be done over smaller areas (8x8), but that would
- * require extensive changes elsewhere, as lambda is assumed to be fixed
- * over an entire MB in most of the code.
- * Another option is to compute four 8x8 variances, and pick a single
- * lambda using a non-linear combination (e.g., the smallest, or second
- * smallest, etc.).
- */
- (void)cpi;
- act = vp8_variance16x16(x->src.y_buffer,
- x->src.y_stride, VP8_VAR_OFFS, 0, &sse);
- act = act<<4;
-
- /* If the region is flat, lower the activity some more. */
- if (act < 8<<12)
- act = act < 5<<12 ? act : 5<<12;
-
- return act;
-}
-
-/* Stub for alternative experimental activity measures. */
-static unsigned int alt_activity_measure( VP8_COMP *cpi,
- MACROBLOCK *x, int use_dc_pred )
-{
- return vp8_encode_intra(cpi,x, use_dc_pred);
-}
-
-
-/* Measure the activity of the current macroblock
- * What we measure here is TBD so abstracted to this function
- */
-#define ALT_ACT_MEASURE 1
-static unsigned int mb_activity_measure( VP8_COMP *cpi, MACROBLOCK *x,
- int mb_row, int mb_col)
-{
- unsigned int mb_activity;
-
- if ( ALT_ACT_MEASURE )
- {
- int use_dc_pred = (mb_col || mb_row) && (!mb_col || !mb_row);
-
- /* Or use and alternative. */
- mb_activity = alt_activity_measure( cpi, x, use_dc_pred );
- }
- else
- {
- /* Original activity measure from Tim T's code. */
- mb_activity = tt_activity_measure( cpi, x );
- }
-
- if ( mb_activity < VP8_ACTIVITY_AVG_MIN )
- mb_activity = VP8_ACTIVITY_AVG_MIN;
-
- return mb_activity;
-}
-
-/* Calculate an "average" mb activity value for the frame */
-#define ACT_MEDIAN 0
-static void calc_av_activity( VP8_COMP *cpi, int64_t activity_sum )
-{
-#if ACT_MEDIAN
- /* Find median: Simple n^2 algorithm for experimentation */
- {
- unsigned int median;
- unsigned int i,j;
- unsigned int * sortlist;
- unsigned int tmp;
-
- /* Create a list to sort to */
- CHECK_MEM_ERROR(sortlist,
- vpx_calloc(sizeof(unsigned int),
- cpi->common.MBs));
-
- /* Copy map to sort list */
- vpx_memcpy( sortlist, cpi->mb_activity_map,
- sizeof(unsigned int) * cpi->common.MBs );
-
-
- /* Ripple each value down to its correct position */
- for ( i = 1; i < cpi->common.MBs; i ++ )
- {
- for ( j = i; j > 0; j -- )
- {
- if ( sortlist[j] < sortlist[j-1] )
- {
- /* Swap values */
- tmp = sortlist[j-1];
- sortlist[j-1] = sortlist[j];
- sortlist[j] = tmp;
- }
- else
- break;
- }
- }
-
- /* Even number MBs so estimate median as mean of two either side. */
- median = ( 1 + sortlist[cpi->common.MBs >> 1] +
- sortlist[(cpi->common.MBs >> 1) + 1] ) >> 1;
-
- cpi->activity_avg = median;
-
- vpx_free(sortlist);
- }
-#else
- /* Simple mean for now */
- cpi->activity_avg = (unsigned int)(activity_sum/cpi->common.MBs);
-#endif
-
- if (cpi->activity_avg < VP8_ACTIVITY_AVG_MIN)
- cpi->activity_avg = VP8_ACTIVITY_AVG_MIN;
-
- /* Experimental code: return fixed value normalized for several clips */
- if ( ALT_ACT_MEASURE )
- cpi->activity_avg = 100000;
-}
-
-#define USE_ACT_INDEX 0
-#define OUTPUT_NORM_ACT_STATS 0
-
-#if USE_ACT_INDEX
-/* Calculate and activity index for each mb */
-static void calc_activity_index( VP8_COMP *cpi, MACROBLOCK *x )
-{
- VP8_COMMON *const cm = & cpi->common;
- int mb_row, mb_col;
-
- int64_t act;
- int64_t a;
- int64_t b;
-
-#if OUTPUT_NORM_ACT_STATS
- FILE *f = fopen("norm_act.stt", "a");
- fprintf(f, "\n%12d\n", cpi->activity_avg );
-#endif
-
- /* Reset pointers to start of activity map */
- x->mb_activity_ptr = cpi->mb_activity_map;
-
- /* Calculate normalized mb activity number. */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
- {
- /* for each macroblock col in image */
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
- /* Read activity from the map */
- act = *(x->mb_activity_ptr);
-
- /* Calculate a normalized activity number */
- a = act + 4*cpi->activity_avg;
- b = 4*act + cpi->activity_avg;
-
- if ( b >= a )
- *(x->activity_ptr) = (int)((b + (a>>1))/a) - 1;
- else
- *(x->activity_ptr) = 1 - (int)((a + (b>>1))/b);
-
-#if OUTPUT_NORM_ACT_STATS
- fprintf(f, " %6d", *(x->mb_activity_ptr));
-#endif
- /* Increment activity map pointers */
- x->mb_activity_ptr++;
- }
-
-#if OUTPUT_NORM_ACT_STATS
- fprintf(f, "\n");
-#endif
-
- }
-
-#if OUTPUT_NORM_ACT_STATS
- fclose(f);
-#endif
-
-}
-#endif
-
-/* Loop through all MBs. Note activity of each, average activity and
- * calculate a normalized activity for each
- */
-static void build_activity_map( VP8_COMP *cpi )
-{
- MACROBLOCK *const x = & cpi->mb;
- MACROBLOCKD *xd = &x->e_mbd;
- VP8_COMMON *const cm = & cpi->common;
-
-#if ALT_ACT_MEASURE
- YV12_BUFFER_CONFIG *new_yv12 = &cm->yv12_fb[cm->new_fb_idx];
- int recon_yoffset;
- int recon_y_stride = new_yv12->y_stride;
-#endif
-
- int mb_row, mb_col;
- unsigned int mb_activity;
- int64_t activity_sum = 0;
-
- /* for each macroblock row in image */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
- {
-#if ALT_ACT_MEASURE
- /* reset above block coeffs */
- xd->up_available = (mb_row != 0);
- recon_yoffset = (mb_row * recon_y_stride * 16);
-#endif
- /* for each macroblock col in image */
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
-#if ALT_ACT_MEASURE
- xd->dst.y_buffer = new_yv12->y_buffer + recon_yoffset;
- xd->left_available = (mb_col != 0);
- recon_yoffset += 16;
-#endif
- /* Copy current mb to a buffer */
- vp8_copy_mem16x16(x->src.y_buffer, x->src.y_stride, x->thismb, 16);
-
- /* measure activity */
- mb_activity = mb_activity_measure( cpi, x, mb_row, mb_col );
-
- /* Keep frame sum */
- activity_sum += mb_activity;
-
- /* Store MB level activity details. */
- *x->mb_activity_ptr = mb_activity;
-
- /* Increment activity map pointer */
- x->mb_activity_ptr++;
-
- /* adjust to the next column of source macroblocks */
- x->src.y_buffer += 16;
- }
-
-
- /* adjust to the next row of mbs */
- x->src.y_buffer += 16 * x->src.y_stride - 16 * cm->mb_cols;
-
-#if ALT_ACT_MEASURE
- /* extend the recon for intra prediction */
- vp8_extend_mb_row(new_yv12, xd->dst.y_buffer + 16,
- xd->dst.u_buffer + 8, xd->dst.v_buffer + 8);
-#endif
-
- }
-
- /* Calculate an "average" MB activity */
- calc_av_activity(cpi, activity_sum);
-
-#if USE_ACT_INDEX
- /* Calculate an activity index number of each mb */
- calc_activity_index( cpi, x );
-#endif
-
-}
-
-/* Macroblock activity masking */
-void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x)
-{
-#if USE_ACT_INDEX
- x->rdmult += *(x->mb_activity_ptr) * (x->rdmult >> 2);
- x->errorperbit = x->rdmult * 100 /(110 * x->rddiv);
- x->errorperbit += (x->errorperbit==0);
-#else
- int64_t a;
- int64_t b;
- int64_t act = *(x->mb_activity_ptr);
-
- /* Apply the masking to the RD multiplier. */
- a = act + (2*cpi->activity_avg);
- b = (2*act) + cpi->activity_avg;
-
- x->rdmult = (unsigned int)(((int64_t)x->rdmult*b + (a>>1))/a);
- x->errorperbit = x->rdmult * 100 /(110 * x->rddiv);
- x->errorperbit += (x->errorperbit==0);
-#endif
-
- /* Activity based Zbin adjustment */
- adjust_act_zbin(cpi, x);
-}
-
-static
-void encode_mb_row(VP8_COMP *cpi,
- VP8_COMMON *cm,
- int mb_row,
- MACROBLOCK *x,
- MACROBLOCKD *xd,
- TOKENEXTRA **tp,
- int *segment_counts,
- int *totalrate)
-{
- int recon_yoffset, recon_uvoffset;
- int mb_col;
- int ref_fb_idx = cm->lst_fb_idx;
- int dst_fb_idx = cm->new_fb_idx;
- int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride;
- int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
- int map_index = (mb_row * cpi->common.mb_cols);
-
-#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- const int num_part = (1 << cm->multi_token_partition);
- TOKENEXTRA * tp_start = cpi->tok;
- vp8_writer *w;
-#endif
-
-#if CONFIG_MULTITHREAD
- const int nsync = cpi->mt_sync_range;
- const int rightmost_col = cm->mb_cols + nsync;
- volatile const int *last_row_current_mb_col;
- volatile int *current_mb_col = &cpi->mt_current_mb_col[mb_row];
-
- if ((cpi->b_multi_threaded != 0) && (mb_row != 0))
- last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1];
- else
- last_row_current_mb_col = &rightmost_col;
-#endif
-
-#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- if(num_part > 1)
- w= &cpi->bc[1 + (mb_row % num_part)];
- else
- w = &cpi->bc[1];
-#endif
-
- /* reset above block coeffs */
- xd->above_context = cm->above_context;
-
- xd->up_available = (mb_row != 0);
- recon_yoffset = (mb_row * recon_y_stride * 16);
- recon_uvoffset = (mb_row * recon_uv_stride * 8);
-
- cpi->tplist[mb_row].start = *tp;
- /* printf("Main mb_row = %d\n", mb_row); */
-
- /* Distance of Mb to the top & bottom edges, specified in 1/8th pel
- * units as they are always compared to values that are in 1/8th pel
- */
- xd->mb_to_top_edge = -((mb_row * 16) << 3);
- xd->mb_to_bottom_edge = ((cm->mb_rows - 1 - mb_row) * 16) << 3;
-
- /* Set up limit values for vertical motion vector components
- * to prevent them extending beyond the UMV borders
- */
- x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16)
- + (VP8BORDERINPIXELS - 16);
-
- /* Set the mb activity pointer to the start of the row. */
- x->mb_activity_ptr = &cpi->mb_activity_map[map_index];
-
- /* for each macroblock col in image */
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
-
-#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- *tp = cpi->tok;
-#endif
- /* Distance of Mb to the left & right edges, specified in
- * 1/8th pel units as they are always compared to values
- * that are in 1/8th pel units
- */
- xd->mb_to_left_edge = -((mb_col * 16) << 3);
- xd->mb_to_right_edge = ((cm->mb_cols - 1 - mb_col) * 16) << 3;
-
- /* Set up limit values for horizontal motion vector components
- * to prevent them extending beyond the UMV borders
- */
- x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16)
- + (VP8BORDERINPIXELS - 16);
-
- xd->dst.y_buffer = cm->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset;
- xd->dst.u_buffer = cm->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset;
- xd->dst.v_buffer = cm->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset;
- xd->left_available = (mb_col != 0);
-
- x->rddiv = cpi->RDDIV;
- x->rdmult = cpi->RDMULT;
-
- /* Copy current mb to a buffer */
- vp8_copy_mem16x16(x->src.y_buffer, x->src.y_stride, x->thismb, 16);
-
-#if CONFIG_MULTITHREAD
- if (cpi->b_multi_threaded != 0)
- {
- *current_mb_col = mb_col - 1; /* set previous MB done */
-
- if ((mb_col & (nsync - 1)) == 0)
- {
- while (mb_col > (*last_row_current_mb_col - nsync))
- {
- x86_pause_hint();
- thread_sleep(0);
- }
- }
- }
-#endif
-
- if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
- vp8_activity_masking(cpi, x);
-
- /* Is segmentation enabled */
- /* MB level adjustment to quantizer */
- if (xd->segmentation_enabled)
- {
- /* Code to set segment id in xd->mbmi.segment_id for current MB
- * (with range checking)
- */
- if (cpi->segmentation_map[map_index+mb_col] <= 3)
- xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[map_index+mb_col];
- else
- xd->mode_info_context->mbmi.segment_id = 0;
-
- vp8cx_mb_init_quantizer(cpi, x, 1);
- }
- else
- /* Set to Segment 0 by default */
- xd->mode_info_context->mbmi.segment_id = 0;
-
- x->active_ptr = cpi->active_map + map_index + mb_col;
-
- if (cm->frame_type == KEY_FRAME)
- {
- *totalrate += vp8cx_encode_intra_macroblock(cpi, x, tp);
-#ifdef MODE_STATS
- y_modes[xd->mbmi.mode] ++;
-#endif
- }
- else
- {
- *totalrate += vp8cx_encode_inter_macroblock(cpi, x, tp, recon_yoffset, recon_uvoffset, mb_row, mb_col);
-
-#ifdef MODE_STATS
- inter_y_modes[xd->mbmi.mode] ++;
-
- if (xd->mbmi.mode == SPLITMV)
- {
- int b;
-
- for (b = 0; b < xd->mbmi.partition_count; b++)
- {
- inter_b_modes[x->partition->bmi[b].mode] ++;
- }
- }
-
-#endif
-
- /* Special case code for cyclic refresh
- * If cyclic update enabled then copy xd->mbmi.segment_id; (which
- * may have been updated based on mode during
- * vp8cx_encode_inter_macroblock()) back into the global
- * segmentation map
- */
- if ((cpi->current_layer == 0) &&
- (cpi->cyclic_refresh_mode_enabled &&
- xd->segmentation_enabled))
- {
- cpi->segmentation_map[map_index+mb_col] = xd->mode_info_context->mbmi.segment_id;
-
- /* If the block has been refreshed mark it as clean (the
- * magnitude of the -ve influences how long it will be before
- * we consider another refresh):
- * Else if it was coded (last frame 0,0) and has not already
- * been refreshed then mark it as a candidate for cleanup
- * next time (marked 0) else mark it as dirty (1).
- */
- if (xd->mode_info_context->mbmi.segment_id)
- cpi->cyclic_refresh_map[map_index+mb_col] = -1;
- else if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
- {
- if (cpi->cyclic_refresh_map[map_index+mb_col] == 1)
- cpi->cyclic_refresh_map[map_index+mb_col] = 0;
- }
- else
- cpi->cyclic_refresh_map[map_index+mb_col] = 1;
-
- }
- }
-
- cpi->tplist[mb_row].stop = *tp;
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- /* pack tokens for this MB */
- {
- int tok_count = *tp - tp_start;
- pack_tokens(w, tp_start, tok_count);
- }
-#endif
- /* Increment pointer into gf usage flags structure. */
- x->gf_active_ptr++;
-
- /* Increment the activity mask pointers. */
- x->mb_activity_ptr++;
-
- /* adjust to the next column of macroblocks */
- x->src.y_buffer += 16;
- x->src.u_buffer += 8;
- x->src.v_buffer += 8;
-
- recon_yoffset += 16;
- recon_uvoffset += 8;
-
- /* Keep track of segment usage */
- segment_counts[xd->mode_info_context->mbmi.segment_id] ++;
-
- /* skip to next mb */
- xd->mode_info_context++;
- x->partition_info++;
- xd->above_context++;
- }
-
- /* extend the recon for intra prediction */
- vp8_extend_mb_row( &cm->yv12_fb[dst_fb_idx],
- xd->dst.y_buffer + 16,
- xd->dst.u_buffer + 8,
- xd->dst.v_buffer + 8);
-
-#if CONFIG_MULTITHREAD
- if (cpi->b_multi_threaded != 0)
- *current_mb_col = rightmost_col;
-#endif
-
- /* this is to account for the border */
- xd->mode_info_context++;
- x->partition_info++;
-}
-
-static void init_encode_frame_mb_context(VP8_COMP *cpi)
-{
- MACROBLOCK *const x = & cpi->mb;
- VP8_COMMON *const cm = & cpi->common;
- MACROBLOCKD *const xd = & x->e_mbd;
-
- /* GF active flags data structure */
- x->gf_active_ptr = (signed char *)cpi->gf_active_flags;
-
- /* Activity map pointer */
- x->mb_activity_ptr = cpi->mb_activity_map;
-
- x->act_zbin_adj = 0;
-
- x->partition_info = x->pi;
-
- xd->mode_info_context = cm->mi;
- xd->mode_info_stride = cm->mode_info_stride;
-
- xd->frame_type = cm->frame_type;
-
- /* reset intra mode contexts */
- if (cm->frame_type == KEY_FRAME)
- vp8_init_mbmode_probs(cm);
-
- /* Copy data over into macro block data structures. */
- x->src = * cpi->Source;
- xd->pre = cm->yv12_fb[cm->lst_fb_idx];
- xd->dst = cm->yv12_fb[cm->new_fb_idx];
-
- /* set up frame for intra coded blocks */
- vp8_setup_intra_recon(&cm->yv12_fb[cm->new_fb_idx]);
-
- vp8_build_block_offsets(x);
-
- xd->mode_info_context->mbmi.mode = DC_PRED;
- xd->mode_info_context->mbmi.uv_mode = DC_PRED;
-
- xd->left_context = &cm->left_context;
-
- x->mvc = cm->fc.mvc;
-
- vpx_memset(cm->above_context, 0,
- sizeof(ENTROPY_CONTEXT_PLANES) * cm->mb_cols);
-
- /* Special case treatment when GF and ARF are not sensible options
- * for reference
- */
- if (cpi->ref_frame_flags == VP8_LAST_FRAME)
- vp8_calc_ref_frame_costs(x->ref_frame_cost,
- cpi->prob_intra_coded,255,128);
- else if ((cpi->oxcf.number_of_layers > 1) &&
- (cpi->ref_frame_flags == VP8_GOLD_FRAME))
- vp8_calc_ref_frame_costs(x->ref_frame_cost,
- cpi->prob_intra_coded,1,255);
- else if ((cpi->oxcf.number_of_layers > 1) &&
- (cpi->ref_frame_flags == VP8_ALTR_FRAME))
- vp8_calc_ref_frame_costs(x->ref_frame_cost,
- cpi->prob_intra_coded,1,1);
- else
- vp8_calc_ref_frame_costs(x->ref_frame_cost,
- cpi->prob_intra_coded,
- cpi->prob_last_coded,
- cpi->prob_gf_coded);
-
- xd->fullpixel_mask = 0xffffffff;
- if(cm->full_pixel)
- xd->fullpixel_mask = 0xfffffff8;
-
- vp8_zero(x->coef_counts);
- vp8_zero(x->ymode_count);
- vp8_zero(x->uv_mode_count)
- x->prediction_error = 0;
- x->intra_error = 0;
- vp8_zero(x->count_mb_ref_frame_usage);
-}
-
-static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread)
-{
- int i = 0;
- do
- {
- int j = 0;
- do
- {
- int k = 0;
- do
- {
- /* at every context */
-
- /* calc probs and branch cts for this frame only */
- int t = 0; /* token/prob index */
-
- do
- {
- x->coef_counts [i][j][k][t] +=
- x_thread->coef_counts [i][j][k][t];
- }
- while (++t < ENTROPY_NODES);
- }
- while (++k < PREV_COEF_CONTEXTS);
- }
- while (++j < COEF_BANDS);
- }
- while (++i < BLOCK_TYPES);
-}
-
-void vp8_encode_frame(VP8_COMP *cpi)
-{
- int mb_row;
- MACROBLOCK *const x = & cpi->mb;
- VP8_COMMON *const cm = & cpi->common;
- MACROBLOCKD *const xd = & x->e_mbd;
- TOKENEXTRA *tp = cpi->tok;
- int segment_counts[MAX_MB_SEGMENTS];
- int totalrate;
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- BOOL_CODER * bc = &cpi->bc[1]; /* bc[0] is for control partition */
- const int num_part = (1 << cm->multi_token_partition);
-#endif
-
- vpx_memset(segment_counts, 0, sizeof(segment_counts));
- totalrate = 0;
-
- if (cpi->compressor_speed == 2)
- {
- if (cpi->oxcf.cpu_used < 0)
- cpi->Speed = -(cpi->oxcf.cpu_used);
- else
- vp8_auto_select_speed(cpi);
- }
-
- /* Functions setup for all frame types so we can use MC in AltRef */
- if(!cm->use_bilinear_mc_filter)
- {
- xd->subpixel_predict = vp8_sixtap_predict4x4;
- xd->subpixel_predict8x4 = vp8_sixtap_predict8x4;
- xd->subpixel_predict8x8 = vp8_sixtap_predict8x8;
- xd->subpixel_predict16x16 = vp8_sixtap_predict16x16;
- }
- else
- {
- xd->subpixel_predict = vp8_bilinear_predict4x4;
- xd->subpixel_predict8x4 = vp8_bilinear_predict8x4;
- xd->subpixel_predict8x8 = vp8_bilinear_predict8x8;
- xd->subpixel_predict16x16 = vp8_bilinear_predict16x16;
- }
-
- cpi->mb.skip_true_count = 0;
- cpi->tok_count = 0;
-
-#if 0
- /* Experimental code */
- cpi->frame_distortion = 0;
- cpi->last_mb_distortion = 0;
-#endif
-
- xd->mode_info_context = cm->mi;
-
- vp8_zero(cpi->mb.MVcount);
-
- vp8cx_frame_init_quantizer(cpi);
-
- vp8_initialize_rd_consts(cpi, x,
- vp8_dc_quant(cm->base_qindex, cm->y1dc_delta_q));
-
- vp8cx_initialize_me_consts(cpi, cm->base_qindex);
-
- if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
- {
- /* Initialize encode frame context. */
- init_encode_frame_mb_context(cpi);
-
- /* Build a frame level activity map */
- build_activity_map(cpi);
- }
-
- /* re-init encode frame context. */
- init_encode_frame_mb_context(cpi);
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- {
- int i;
- for(i = 0; i < num_part; i++)
- {
- vp8_start_encode(&bc[i], cpi->partition_d[i + 1],
- cpi->partition_d_end[i + 1]);
- bc[i].error = &cm->error;
- }
- }
-
-#endif
-
- {
- struct vpx_usec_timer emr_timer;
- vpx_usec_timer_start(&emr_timer);
-
-#if CONFIG_MULTITHREAD
- if (cpi->b_multi_threaded)
- {
- int i;
-
- vp8cx_init_mbrthread_data(cpi, x, cpi->mb_row_ei,
- cpi->encoding_thread_count);
-
- for (i = 0; i < cm->mb_rows; i++)
- cpi->mt_current_mb_col[i] = -1;
-
- for (i = 0; i < cpi->encoding_thread_count; i++)
- {
- sem_post(&cpi->h_event_start_encoding[i]);
- }
-
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row += (cpi->encoding_thread_count + 1))
- {
- vp8_zero(cm->left_context)
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- tp = cpi->tok;
-#else
- tp = cpi->tok + mb_row * (cm->mb_cols * 16 * 24);
-#endif
-
- encode_mb_row(cpi, cm, mb_row, x, xd, &tp, segment_counts, &totalrate);
-
- /* adjust to the next row of mbs */
- x->src.y_buffer += 16 * x->src.y_stride * (cpi->encoding_thread_count + 1) - 16 * cm->mb_cols;
- x->src.u_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_count + 1) - 8 * cm->mb_cols;
- x->src.v_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_count + 1) - 8 * cm->mb_cols;
-
- xd->mode_info_context += xd->mode_info_stride * cpi->encoding_thread_count;
- x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count;
- x->gf_active_ptr += cm->mb_cols * cpi->encoding_thread_count;
-
- if(mb_row == cm->mb_rows - 1)
- {
- sem_post(&cpi->h_event_end_encoding); /* signal frame encoding end */
- }
- }
-
- sem_wait(&cpi->h_event_end_encoding); /* wait for other threads to finish */
-
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row ++)
- {
- cpi->tok_count += (unsigned int)
- (cpi->tplist[mb_row].stop - cpi->tplist[mb_row].start);
- }
-
- if (xd->segmentation_enabled)
- {
- int j;
-
- if (xd->segmentation_enabled)
- {
- for (i = 0; i < cpi->encoding_thread_count; i++)
- {
- for (j = 0; j < 4; j++)
- segment_counts[j] += cpi->mb_row_ei[i].segment_counts[j];
- }
- }
- }
-
- for (i = 0; i < cpi->encoding_thread_count; i++)
- {
- int mode_count;
- int c_idx;
- totalrate += cpi->mb_row_ei[i].totalrate;
-
- cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count;
-
- for(mode_count = 0; mode_count < VP8_YMODES; mode_count++)
- cpi->mb.ymode_count[mode_count] +=
- cpi->mb_row_ei[i].mb.ymode_count[mode_count];
-
- for(mode_count = 0; mode_count < VP8_UV_MODES; mode_count++)
- cpi->mb.uv_mode_count[mode_count] +=
- cpi->mb_row_ei[i].mb.uv_mode_count[mode_count];
-
- for(c_idx = 0; c_idx < MVvals; c_idx++)
- {
- cpi->mb.MVcount[0][c_idx] +=
- cpi->mb_row_ei[i].mb.MVcount[0][c_idx];
- cpi->mb.MVcount[1][c_idx] +=
- cpi->mb_row_ei[i].mb.MVcount[1][c_idx];
- }
-
- cpi->mb.prediction_error +=
- cpi->mb_row_ei[i].mb.prediction_error;
- cpi->mb.intra_error += cpi->mb_row_ei[i].mb.intra_error;
-
- for(c_idx = 0; c_idx < MAX_REF_FRAMES; c_idx++)
- cpi->mb.count_mb_ref_frame_usage[c_idx] +=
- cpi->mb_row_ei[i].mb.count_mb_ref_frame_usage[c_idx];
-
- for(c_idx = 0; c_idx < MAX_ERROR_BINS; c_idx++)
- cpi->mb.error_bins[c_idx] +=
- cpi->mb_row_ei[i].mb.error_bins[c_idx];
-
- /* add up counts for each thread */
- sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
- }
-
- }
- else
-#endif
- {
-
- /* for each macroblock row in image */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
- {
- vp8_zero(cm->left_context)
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- tp = cpi->tok;
-#endif
-
- encode_mb_row(cpi, cm, mb_row, x, xd, &tp, segment_counts, &totalrate);
-
- /* adjust to the next row of mbs */
- x->src.y_buffer += 16 * x->src.y_stride - 16 * cm->mb_cols;
- x->src.u_buffer += 8 * x->src.uv_stride - 8 * cm->mb_cols;
- x->src.v_buffer += 8 * x->src.uv_stride - 8 * cm->mb_cols;
- }
-
- cpi->tok_count = (unsigned int)(tp - cpi->tok);
- }
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- {
- int i;
- for(i = 0; i < num_part; i++)
- {
- vp8_stop_encode(&bc[i]);
- cpi->partition_sz[i+1] = bc[i].pos;
- }
- }
-#endif
-
- vpx_usec_timer_mark(&emr_timer);
- cpi->time_encode_mb_row += vpx_usec_timer_elapsed(&emr_timer);
- }
-
-
- // Work out the segment probabilities if segmentation is enabled
- // and needs to be updated
- if (xd->segmentation_enabled && xd->update_mb_segmentation_map)
- {
- int tot_count;
- int i;
-
- /* Set to defaults */
- vpx_memset(xd->mb_segment_tree_probs, 255 , sizeof(xd->mb_segment_tree_probs));
-
- tot_count = segment_counts[0] + segment_counts[1] + segment_counts[2] + segment_counts[3];
-
- if (tot_count)
- {
- xd->mb_segment_tree_probs[0] = ((segment_counts[0] + segment_counts[1]) * 255) / tot_count;
-
- tot_count = segment_counts[0] + segment_counts[1];
-
- if (tot_count > 0)
- {
- xd->mb_segment_tree_probs[1] = (segment_counts[0] * 255) / tot_count;
- }
-
- tot_count = segment_counts[2] + segment_counts[3];
-
- if (tot_count > 0)
- xd->mb_segment_tree_probs[2] = (segment_counts[2] * 255) / tot_count;
-
- /* Zero probabilities not allowed */
- for (i = 0; i < MB_FEATURE_TREE_PROBS; i ++)
- {
- if (xd->mb_segment_tree_probs[i] == 0)
- xd->mb_segment_tree_probs[i] = 1;
- }
- }
- }
-
- /* projected_frame_size in units of BYTES */
- cpi->projected_frame_size = totalrate >> 8;
-
- /* Make a note of the percentage MBs coded Intra. */
- if (cm->frame_type == KEY_FRAME)
- {
- cpi->this_frame_percent_intra = 100;
- }
- else
- {
- int tot_modes;
-
- tot_modes = cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME]
- + cpi->mb.count_mb_ref_frame_usage[LAST_FRAME]
- + cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME]
- + cpi->mb.count_mb_ref_frame_usage[ALTREF_FRAME];
-
- if (tot_modes)
- cpi->this_frame_percent_intra =
- cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME] * 100 / tot_modes;
-
- }
-
-#if ! CONFIG_REALTIME_ONLY
- /* Adjust the projected reference frame usage probability numbers to
- * reflect what we have just seen. This may be useful when we make
- * multiple iterations of the recode loop rather than continuing to use
- * values from the previous frame.
- */
- if ((cm->frame_type != KEY_FRAME) && ((cpi->oxcf.number_of_layers > 1) ||
- (!cm->refresh_alt_ref_frame && !cm->refresh_golden_frame)))
- {
- vp8_convert_rfct_to_prob(cpi);
- }
-#endif
-}
-void vp8_setup_block_ptrs(MACROBLOCK *x)
-{
- int r, c;
- int i;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- x->block[r*4+c].src_diff = x->src_diff + r * 4 * 16 + c * 4;
- }
- }
-
- for (r = 0; r < 2; r++)
- {
- for (c = 0; c < 2; c++)
- {
- x->block[16 + r*2+c].src_diff = x->src_diff + 256 + r * 4 * 8 + c * 4;
- }
- }
-
-
- for (r = 0; r < 2; r++)
- {
- for (c = 0; c < 2; c++)
- {
- x->block[20 + r*2+c].src_diff = x->src_diff + 320 + r * 4 * 8 + c * 4;
- }
- }
-
- x->block[24].src_diff = x->src_diff + 384;
-
-
- for (i = 0; i < 25; i++)
- {
- x->block[i].coeff = x->coeff + i * 16;
- }
-}
-
-void vp8_build_block_offsets(MACROBLOCK *x)
-{
- int block = 0;
- int br, bc;
-
- vp8_build_block_doffsets(&x->e_mbd);
-
- /* y blocks */
- x->thismb_ptr = &x->thismb[0];
- for (br = 0; br < 4; br++)
- {
- for (bc = 0; bc < 4; bc++)
- {
- BLOCK *this_block = &x->block[block];
- this_block->base_src = &x->thismb_ptr;
- this_block->src_stride = 16;
- this_block->src = 4 * br * 16 + 4 * bc;
- ++block;
- }
- }
-
- /* u blocks */
- for (br = 0; br < 2; br++)
- {
- for (bc = 0; bc < 2; bc++)
- {
- BLOCK *this_block = &x->block[block];
- this_block->base_src = &x->src.u_buffer;
- this_block->src_stride = x->src.uv_stride;
- this_block->src = 4 * br * this_block->src_stride + 4 * bc;
- ++block;
- }
- }
-
- /* v blocks */
- for (br = 0; br < 2; br++)
- {
- for (bc = 0; bc < 2; bc++)
- {
- BLOCK *this_block = &x->block[block];
- this_block->base_src = &x->src.v_buffer;
- this_block->src_stride = x->src.uv_stride;
- this_block->src = 4 * br * this_block->src_stride + 4 * bc;
- ++block;
- }
- }
-}
-
-static void sum_intra_stats(VP8_COMP *cpi, MACROBLOCK *x)
-{
- const MACROBLOCKD *xd = & x->e_mbd;
- const MB_PREDICTION_MODE m = xd->mode_info_context->mbmi.mode;
- const MB_PREDICTION_MODE uvm = xd->mode_info_context->mbmi.uv_mode;
-
-#ifdef MODE_STATS
- const int is_key = cpi->common.frame_type == KEY_FRAME;
-
- ++ (is_key ? uv_modes : inter_uv_modes)[uvm];
-
- if (m == B_PRED)
- {
- unsigned int *const bct = is_key ? b_modes : inter_b_modes;
-
- int b = 0;
-
- do
- {
- ++ bct[xd->block[b].bmi.mode];
- }
- while (++b < 16);
- }
-
-#endif
- (void)cpi;
- ++x->ymode_count[m];
- ++x->uv_mode_count[uvm];
-
-}
-
-/* Experimental stub function to create a per MB zbin adjustment based on
- * some previously calculated measure of MB activity.
- */
-static void adjust_act_zbin( VP8_COMP *cpi, MACROBLOCK *x )
-{
-#if USE_ACT_INDEX
- x->act_zbin_adj = *(x->mb_activity_ptr);
-#else
- int64_t a;
- int64_t b;
- int64_t act = *(x->mb_activity_ptr);
-
- /* Apply the masking to the RD multiplier. */
- a = act + 4*cpi->activity_avg;
- b = 4*act + cpi->activity_avg;
-
- if ( act > cpi->activity_avg )
- x->act_zbin_adj = (int)(((int64_t)b + (a>>1))/a) - 1;
- else
- x->act_zbin_adj = 1 - (int)(((int64_t)a + (b>>1))/b);
-#endif
-}
-
-int vp8cx_encode_intra_macroblock(VP8_COMP *cpi, MACROBLOCK *x,
- TOKENEXTRA **t)
-{
- MACROBLOCKD *xd = &x->e_mbd;
- int rate;
-
- if (cpi->sf.RD && cpi->compressor_speed != 2)
- vp8_rd_pick_intra_mode(x, &rate);
- else
- vp8_pick_intra_mode(x, &rate);
-
- if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
- {
- adjust_act_zbin( cpi, x );
- vp8_update_zbin_extra(cpi, x);
- }
-
- if (x->e_mbd.mode_info_context->mbmi.mode == B_PRED)
- vp8_encode_intra4x4mby(x);
- else
- vp8_encode_intra16x16mby(x);
-
- vp8_encode_intra16x16mbuv(x);
-
- sum_intra_stats(cpi, x);
-
- vp8_tokenize_mb(cpi, x, t);
-
- if (xd->mode_info_context->mbmi.mode != B_PRED)
- vp8_inverse_transform_mby(xd);
-
- vp8_dequant_idct_add_uv_block
- (xd->qcoeff+16*16, xd->dequant_uv,
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.uv_stride, xd->eobs+16);
- return rate;
-}
-#ifdef SPEEDSTATS
-extern int cnt_pm;
-#endif
-
-extern void vp8_fix_contexts(MACROBLOCKD *x);
-
-int vp8cx_encode_inter_macroblock
-(
- VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t,
- int recon_yoffset, int recon_uvoffset,
- int mb_row, int mb_col
-)
-{
- MACROBLOCKD *const xd = &x->e_mbd;
- int intra_error = 0;
- int rate;
- int distortion;
-
- x->skip = 0;
-
- if (xd->segmentation_enabled)
- x->encode_breakout = cpi->segment_encode_breakout[xd->mode_info_context->mbmi.segment_id];
- else
- x->encode_breakout = cpi->oxcf.encode_breakout;
-
-#if CONFIG_TEMPORAL_DENOISING
- /* Reset the best sse mode/mv for each macroblock. */
- x->best_reference_frame = INTRA_FRAME;
- x->best_zeromv_reference_frame = INTRA_FRAME;
- x->best_sse_inter_mode = 0;
- x->best_sse_mv.as_int = 0;
- x->need_to_clamp_best_mvs = 0;
-#endif
-
- if (cpi->sf.RD)
- {
- int zbin_mode_boost_enabled = x->zbin_mode_boost_enabled;
-
- /* Are we using the fast quantizer for the mode selection? */
- if(cpi->sf.use_fastquant_for_pick)
- {
- x->quantize_b = vp8_fast_quantize_b;
- x->quantize_b_pair = vp8_fast_quantize_b_pair;
-
- /* the fast quantizer does not use zbin_extra, so
- * do not recalculate */
- x->zbin_mode_boost_enabled = 0;
- }
- vp8_rd_pick_inter_mode(cpi, x, recon_yoffset, recon_uvoffset, &rate,
- &distortion, &intra_error);
-
- /* switch back to the regular quantizer for the encode */
- if (cpi->sf.improved_quant)
- {
- x->quantize_b = vp8_regular_quantize_b;
- x->quantize_b_pair = vp8_regular_quantize_b_pair;
- }
-
- /* restore cpi->zbin_mode_boost_enabled */
- x->zbin_mode_boost_enabled = zbin_mode_boost_enabled;
-
- }
- else
- {
- vp8_pick_inter_mode(cpi, x, recon_yoffset, recon_uvoffset, &rate,
- &distortion, &intra_error, mb_row, mb_col);
- }
-
- x->prediction_error += distortion;
- x->intra_error += intra_error;
-
- if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
- {
- /* Adjust the zbin based on this MB rate. */
- adjust_act_zbin( cpi, x );
- }
-
-#if 0
- /* Experimental RD code */
- cpi->frame_distortion += distortion;
- cpi->last_mb_distortion = distortion;
-#endif
-
- /* MB level adjutment to quantizer setup */
- if (xd->segmentation_enabled)
- {
- /* If cyclic update enabled */
- if (cpi->current_layer == 0 && cpi->cyclic_refresh_mode_enabled)
- {
- /* Clear segment_id back to 0 if not coded (last frame 0,0) */
- if ((xd->mode_info_context->mbmi.segment_id == 1) &&
- ((xd->mode_info_context->mbmi.ref_frame != LAST_FRAME) || (xd->mode_info_context->mbmi.mode != ZEROMV)))
- {
- xd->mode_info_context->mbmi.segment_id = 0;
-
- /* segment_id changed, so update */
- vp8cx_mb_init_quantizer(cpi, x, 1);
- }
- }
- }
-
- {
- /* Experimental code.
- * Special case for gf and arf zeromv modes, for 1 temporal layer.
- * Increase zbin size to supress noise.
- */
- x->zbin_mode_boost = 0;
- if (x->zbin_mode_boost_enabled)
- {
- if ( xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME )
- {
- if (xd->mode_info_context->mbmi.mode == ZEROMV)
- {
- if (xd->mode_info_context->mbmi.ref_frame != LAST_FRAME &&
- cpi->oxcf.number_of_layers == 1)
- x->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
- else
- x->zbin_mode_boost = LF_ZEROMV_ZBIN_BOOST;
- }
- else if (xd->mode_info_context->mbmi.mode == SPLITMV)
- x->zbin_mode_boost = 0;
- else
- x->zbin_mode_boost = MV_ZBIN_BOOST;
- }
- }
-
- /* The fast quantizer doesn't use zbin_extra, only do so with
- * the regular quantizer. */
- if (cpi->sf.improved_quant)
- vp8_update_zbin_extra(cpi, x);
- }
-
- x->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame] ++;
-
- if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
- {
- vp8_encode_intra16x16mbuv(x);
-
- if (xd->mode_info_context->mbmi.mode == B_PRED)
- {
- vp8_encode_intra4x4mby(x);
- }
- else
- {
- vp8_encode_intra16x16mby(x);
- }
-
- sum_intra_stats(cpi, x);
- }
- else
- {
- int ref_fb_idx;
-
- if (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)
- ref_fb_idx = cpi->common.lst_fb_idx;
- else if (xd->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
- ref_fb_idx = cpi->common.gld_fb_idx;
- else
- ref_fb_idx = cpi->common.alt_fb_idx;
-
- xd->pre.y_buffer = cpi->common.yv12_fb[ref_fb_idx].y_buffer + recon_yoffset;
- xd->pre.u_buffer = cpi->common.yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
- xd->pre.v_buffer = cpi->common.yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
-
- if (!x->skip)
- {
- vp8_encode_inter16x16(x);
- }
- else
- vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer,
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.y_stride, xd->dst.uv_stride);
-
- }
-
- if (!x->skip)
- {
- vp8_tokenize_mb(cpi, x, t);
-
- if (xd->mode_info_context->mbmi.mode != B_PRED)
- vp8_inverse_transform_mby(xd);
-
- vp8_dequant_idct_add_uv_block
- (xd->qcoeff+16*16, xd->dequant_uv,
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.uv_stride, xd->eobs+16);
- }
- else
- {
- /* always set mb_skip_coeff as it is needed by the loopfilter */
- xd->mode_info_context->mbmi.mb_skip_coeff = 1;
-
- if (cpi->common.mb_no_coeff_skip)
- {
- x->skip_true_count ++;
- vp8_fix_contexts(xd);
- }
- else
- {
- vp8_stuff_mb(cpi, x, t);
- }
- }
-
- return rate;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.h
deleted file mode 100644
index e185c10..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeframe.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VP8_ENCODER_ENCODEFRAME_H_
-#define VP8_ENCODER_ENCODEFRAME_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x);
-
-extern void vp8_build_block_offsets(MACROBLOCK *x);
-
-extern void vp8_setup_block_ptrs(MACROBLOCK *x);
-
-extern void vp8_encode_frame(VP8_COMP *cpi);
-
-extern int vp8cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x,
- TOKENEXTRA **t,
- int recon_yoffset, int recon_uvoffset,
- int mb_row, int mb_col);
-
-extern int vp8cx_encode_intra_macroblock(VP8_COMP *cpi, MACROBLOCK *x,
- TOKENEXTRA **t);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_ENCODEFRAME_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.c
deleted file mode 100644
index cfa4cb9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "quantize.h"
-#include "vp8/common/reconintra4x4.h"
-#include "encodemb.h"
-#include "vp8/common/invtrans.h"
-#include "encodeintra.h"
-
-
-int vp8_encode_intra(VP8_COMP *cpi, MACROBLOCK *x, int use_dc_pred)
-{
-
- int i;
- int intra_pred_var = 0;
- (void) cpi;
-
- if (use_dc_pred)
- {
- x->e_mbd.mode_info_context->mbmi.mode = DC_PRED;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
-
- vp8_encode_intra16x16mby(x);
-
- vp8_inverse_transform_mby(&x->e_mbd);
- }
- else
- {
- for (i = 0; i < 16; i++)
- {
- x->e_mbd.block[i].bmi.as_mode = B_DC_PRED;
- vp8_encode_intra4x4block(x, i);
- }
- }
-
- intra_pred_var = vp8_get_mb_ss(x->src_diff);
-
- return intra_pred_var;
-}
-
-void vp8_encode_intra4x4block(MACROBLOCK *x, int ib)
-{
- BLOCKD *b = &x->e_mbd.block[ib];
- BLOCK *be = &x->block[ib];
- int dst_stride = x->e_mbd.dst.y_stride;
- unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset;
- unsigned char *Above = dst - dst_stride;
- unsigned char *yleft = dst - 1;
- unsigned char top_left = Above[-1];
-
- vp8_intra4x4_predict(Above, yleft, dst_stride, b->bmi.as_mode,
- b->predictor, 16, top_left);
-
- vp8_subtract_b(be, b, 16);
-
- x->short_fdct4x4(be->src_diff, be->coeff, 32);
-
- x->quantize_b(be, b);
-
- if (*b->eob > 1)
- {
- vp8_short_idct4x4llm(b->dqcoeff, b->predictor, 16, dst, dst_stride);
- }
- else
- {
- vp8_dc_only_idct_add(b->dqcoeff[0], b->predictor, 16, dst, dst_stride);
- }
-}
-
-void vp8_encode_intra4x4mby(MACROBLOCK *mb)
-{
- int i;
-
- MACROBLOCKD *xd = &mb->e_mbd;
- intra_prediction_down_copy(xd, xd->dst.y_buffer - xd->dst.y_stride + 16);
-
- for (i = 0; i < 16; i++)
- vp8_encode_intra4x4block(mb, i);
- return;
-}
-
-void vp8_encode_intra16x16mby(MACROBLOCK *x)
-{
- BLOCK *b = &x->block[0];
- MACROBLOCKD *xd = &x->e_mbd;
-
- vp8_build_intra_predictors_mby_s(xd,
- xd->dst.y_buffer - xd->dst.y_stride,
- xd->dst.y_buffer - 1,
- xd->dst.y_stride,
- xd->dst.y_buffer,
- xd->dst.y_stride);
-
- vp8_subtract_mby(x->src_diff, *(b->base_src),
- b->src_stride, xd->dst.y_buffer, xd->dst.y_stride);
-
- vp8_transform_intra_mby(x);
-
- vp8_quantize_mby(x);
-
- if (x->optimize)
- vp8_optimize_mby(x);
-}
-
-void vp8_encode_intra16x16mbuv(MACROBLOCK *x)
-{
- MACROBLOCKD *xd = &x->e_mbd;
-
- vp8_build_intra_predictors_mbuv_s(xd, xd->dst.u_buffer - xd->dst.uv_stride,
- xd->dst.v_buffer - xd->dst.uv_stride,
- xd->dst.u_buffer - 1,
- xd->dst.v_buffer - 1,
- xd->dst.uv_stride,
- xd->dst.u_buffer, xd->dst.v_buffer,
- xd->dst.uv_stride);
-
- vp8_subtract_mbuv(x->src_diff, x->src.u_buffer,
- x->src.v_buffer, x->src.uv_stride, xd->dst.u_buffer,
- xd->dst.v_buffer, xd->dst.uv_stride);
-
- vp8_transform_mbuv(x);
-
- vp8_quantize_mbuv(x);
-
- if (x->optimize)
- vp8_optimize_mbuv(x);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.h
deleted file mode 100644
index a8d0284..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodeintra.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_ENCODEINTRA_H_
-#define VP8_ENCODER_ENCODEINTRA_H_
-#include "onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int vp8_encode_intra(VP8_COMP *cpi, MACROBLOCK *x, int use_dc_pred);
-void vp8_encode_intra16x16mby(MACROBLOCK *x);
-void vp8_encode_intra16x16mbuv(MACROBLOCK *x);
-void vp8_encode_intra4x4mby(MACROBLOCK *mb);
-void vp8_encode_intra4x4block(MACROBLOCK *x, int ib);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_ENCODEINTRA_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.c
deleted file mode 100644
index 7ed2fe1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "encodemb.h"
-#include "vp8/common/reconinter.h"
-#include "quantize.h"
-#include "tokenize.h"
-#include "vp8/common/invtrans.h"
-#include "vpx_mem/vpx_mem.h"
-#include "rdopt.h"
-
-void vp8_subtract_b_c(BLOCK *be, BLOCKD *bd, int pitch)
-{
- unsigned char *src_ptr = (*(be->base_src) + be->src);
- short *diff_ptr = be->src_diff;
- unsigned char *pred_ptr = bd->predictor;
- int src_stride = be->src_stride;
-
- int r, c;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- diff_ptr[c] = src_ptr[c] - pred_ptr[c];
- }
-
- diff_ptr += pitch;
- pred_ptr += pitch;
- src_ptr += src_stride;
- }
-}
-
-void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc,
- int src_stride, unsigned char *upred,
- unsigned char *vpred, int pred_stride)
-{
- short *udiff = diff + 256;
- short *vdiff = diff + 320;
-
- int r, c;
-
- for (r = 0; r < 8; r++)
- {
- for (c = 0; c < 8; c++)
- {
- udiff[c] = usrc[c] - upred[c];
- }
-
- udiff += 8;
- upred += pred_stride;
- usrc += src_stride;
- }
-
- for (r = 0; r < 8; r++)
- {
- for (c = 0; c < 8; c++)
- {
- vdiff[c] = vsrc[c] - vpred[c];
- }
-
- vdiff += 8;
- vpred += pred_stride;
- vsrc += src_stride;
- }
-}
-
-void vp8_subtract_mby_c(short *diff, unsigned char *src, int src_stride,
- unsigned char *pred, int pred_stride)
-{
- int r, c;
-
- for (r = 0; r < 16; r++)
- {
- for (c = 0; c < 16; c++)
- {
- diff[c] = src[c] - pred[c];
- }
-
- diff += 16;
- pred += pred_stride;
- src += src_stride;
- }
-}
-
-static void vp8_subtract_mb(MACROBLOCK *x)
-{
- BLOCK *b = &x->block[0];
-
- vp8_subtract_mby(x->src_diff, *(b->base_src),
- b->src_stride, x->e_mbd.dst.y_buffer, x->e_mbd.dst.y_stride);
- vp8_subtract_mbuv(x->src_diff, x->src.u_buffer,
- x->src.v_buffer, x->src.uv_stride, x->e_mbd.dst.u_buffer,
- x->e_mbd.dst.v_buffer, x->e_mbd.dst.uv_stride);
-}
-
-static void build_dcblock(MACROBLOCK *x)
-{
- short *src_diff_ptr = &x->src_diff[384];
- int i;
-
- for (i = 0; i < 16; i++)
- {
- src_diff_ptr[i] = x->coeff[i * 16];
- }
-}
-
-void vp8_transform_mbuv(MACROBLOCK *x)
-{
- int i;
-
- for (i = 16; i < 24; i += 2)
- {
- x->short_fdct8x4(&x->block[i].src_diff[0],
- &x->block[i].coeff[0], 16);
- }
-}
-
-
-void vp8_transform_intra_mby(MACROBLOCK *x)
-{
- int i;
-
- for (i = 0; i < 16; i += 2)
- {
- x->short_fdct8x4(&x->block[i].src_diff[0],
- &x->block[i].coeff[0], 32);
- }
-
- /* build dc block from 16 y dc values */
- build_dcblock(x);
-
- /* do 2nd order transform on the dc block */
- x->short_walsh4x4(&x->block[24].src_diff[0],
- &x->block[24].coeff[0], 8);
-
-}
-
-
-static void transform_mb(MACROBLOCK *x)
-{
- int i;
-
- for (i = 0; i < 16; i += 2)
- {
- x->short_fdct8x4(&x->block[i].src_diff[0],
- &x->block[i].coeff[0], 32);
- }
-
- /* build dc block from 16 y dc values */
- if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
- build_dcblock(x);
-
- for (i = 16; i < 24; i += 2)
- {
- x->short_fdct8x4(&x->block[i].src_diff[0],
- &x->block[i].coeff[0], 16);
- }
-
- /* do 2nd order transform on the dc block */
- if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
- x->short_walsh4x4(&x->block[24].src_diff[0],
- &x->block[24].coeff[0], 8);
-
-}
-
-
-static void transform_mby(MACROBLOCK *x)
-{
- int i;
-
- for (i = 0; i < 16; i += 2)
- {
- x->short_fdct8x4(&x->block[i].src_diff[0],
- &x->block[i].coeff[0], 32);
- }
-
- /* build dc block from 16 y dc values */
- if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
- {
- build_dcblock(x);
- x->short_walsh4x4(&x->block[24].src_diff[0],
- &x->block[24].coeff[0], 8);
- }
-}
-
-
-
-#define RDTRUNC(RM,DM,R,D) ( (128+(R)*(RM)) & 0xFF )
-
-typedef struct vp8_token_state vp8_token_state;
-
-struct vp8_token_state{
- int rate;
- int error;
- signed char next;
- signed char token;
- short qc;
-};
-
-/* TODO: experiments to find optimal multiple numbers */
-#define Y1_RD_MULT 4
-#define UV_RD_MULT 2
-#define Y2_RD_MULT 16
-
-static const int plane_rd_mult[4]=
-{
- Y1_RD_MULT,
- Y2_RD_MULT,
- UV_RD_MULT,
- Y1_RD_MULT
-};
-
-static void optimize_b(MACROBLOCK *mb, int ib, int type,
- ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l)
-{
- BLOCK *b;
- BLOCKD *d;
- vp8_token_state tokens[17][2];
- unsigned best_mask[2];
- const short *dequant_ptr;
- const short *coeff_ptr;
- short *qcoeff_ptr;
- short *dqcoeff_ptr;
- int eob;
- int i0;
- int rc;
- int x;
- int sz = 0;
- int next;
- int rdmult;
- int rddiv;
- int final_eob;
- int rd_cost0;
- int rd_cost1;
- int rate0;
- int rate1;
- int error0;
- int error1;
- int t0;
- int t1;
- int best;
- int band;
- int pt;
- int i;
- int err_mult = plane_rd_mult[type];
-
- b = &mb->block[ib];
- d = &mb->e_mbd.block[ib];
-
- /* Enable this to test the effect of RDO as a replacement for the dynamic
- * zero bin instead of an augmentation of it.
- */
-#if 0
- vp8_strict_quantize_b(b, d);
-#endif
-
- dequant_ptr = d->dequant;
- coeff_ptr = b->coeff;
- qcoeff_ptr = d->qcoeff;
- dqcoeff_ptr = d->dqcoeff;
- i0 = !type;
- eob = *d->eob;
-
- /* Now set up a Viterbi trellis to evaluate alternative roundings. */
- rdmult = mb->rdmult * err_mult;
- if(mb->e_mbd.mode_info_context->mbmi.ref_frame==INTRA_FRAME)
- rdmult = (rdmult * 9)>>4;
-
- rddiv = mb->rddiv;
- best_mask[0] = best_mask[1] = 0;
- /* Initialize the sentinel node of the trellis. */
- tokens[eob][0].rate = 0;
- tokens[eob][0].error = 0;
- tokens[eob][0].next = 16;
- tokens[eob][0].token = DCT_EOB_TOKEN;
- tokens[eob][0].qc = 0;
- *(tokens[eob] + 1) = *(tokens[eob] + 0);
- next = eob;
- for (i = eob; i-- > i0;)
- {
- int base_bits;
- int d2;
- int dx;
-
- rc = vp8_default_zig_zag1d[i];
- x = qcoeff_ptr[rc];
- /* Only add a trellis state for non-zero coefficients. */
- if (x)
- {
- int shortcut=0;
- error0 = tokens[next][0].error;
- error1 = tokens[next][1].error;
- /* Evaluate the first possibility for this state. */
- rate0 = tokens[next][0].rate;
- rate1 = tokens[next][1].rate;
- t0 = (vp8_dct_value_tokens_ptr + x)->Token;
- /* Consider both possible successor states. */
- if (next < 16)
- {
- band = vp8_coef_bands[i + 1];
- pt = vp8_prev_token_class[t0];
- rate0 +=
- mb->token_costs[type][band][pt][tokens[next][0].token];
- rate1 +=
- mb->token_costs[type][band][pt][tokens[next][1].token];
- }
- rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);
- rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);
- if (rd_cost0 == rd_cost1)
- {
- rd_cost0 = RDTRUNC(rdmult, rddiv, rate0, error0);
- rd_cost1 = RDTRUNC(rdmult, rddiv, rate1, error1);
- }
- /* And pick the best. */
- best = rd_cost1 < rd_cost0;
- base_bits = *(vp8_dct_value_cost_ptr + x);
- dx = dqcoeff_ptr[rc] - coeff_ptr[rc];
- d2 = dx*dx;
- tokens[i][0].rate = base_bits + (best ? rate1 : rate0);
- tokens[i][0].error = d2 + (best ? error1 : error0);
- tokens[i][0].next = next;
- tokens[i][0].token = t0;
- tokens[i][0].qc = x;
- best_mask[0] |= best << i;
- /* Evaluate the second possibility for this state. */
- rate0 = tokens[next][0].rate;
- rate1 = tokens[next][1].rate;
-
- if((abs(x)*dequant_ptr[rc]>abs(coeff_ptr[rc])) &&
- (abs(x)*dequant_ptr[rc]<abs(coeff_ptr[rc])+dequant_ptr[rc]))
- shortcut = 1;
- else
- shortcut = 0;
-
- if(shortcut)
- {
- sz = -(x < 0);
- x -= 2*sz + 1;
- }
-
- /* Consider both possible successor states. */
- if (!x)
- {
- /* If we reduced this coefficient to zero, check to see if
- * we need to move the EOB back here.
- */
- t0 = tokens[next][0].token == DCT_EOB_TOKEN ?
- DCT_EOB_TOKEN : ZERO_TOKEN;
- t1 = tokens[next][1].token == DCT_EOB_TOKEN ?
- DCT_EOB_TOKEN : ZERO_TOKEN;
- }
- else
- {
- t0=t1 = (vp8_dct_value_tokens_ptr + x)->Token;
- }
- if (next < 16)
- {
- band = vp8_coef_bands[i + 1];
- if(t0!=DCT_EOB_TOKEN)
- {
- pt = vp8_prev_token_class[t0];
- rate0 += mb->token_costs[type][band][pt][
- tokens[next][0].token];
- }
- if(t1!=DCT_EOB_TOKEN)
- {
- pt = vp8_prev_token_class[t1];
- rate1 += mb->token_costs[type][band][pt][
- tokens[next][1].token];
- }
- }
-
- rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);
- rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);
- if (rd_cost0 == rd_cost1)
- {
- rd_cost0 = RDTRUNC(rdmult, rddiv, rate0, error0);
- rd_cost1 = RDTRUNC(rdmult, rddiv, rate1, error1);
- }
- /* And pick the best. */
- best = rd_cost1 < rd_cost0;
- base_bits = *(vp8_dct_value_cost_ptr + x);
-
- if(shortcut)
- {
- dx -= (dequant_ptr[rc] + sz) ^ sz;
- d2 = dx*dx;
- }
- tokens[i][1].rate = base_bits + (best ? rate1 : rate0);
- tokens[i][1].error = d2 + (best ? error1 : error0);
- tokens[i][1].next = next;
- tokens[i][1].token =best?t1:t0;
- tokens[i][1].qc = x;
- best_mask[1] |= best << i;
- /* Finally, make this the new head of the trellis. */
- next = i;
- }
- /* There's no choice to make for a zero coefficient, so we don't
- * add a new trellis node, but we do need to update the costs.
- */
- else
- {
- band = vp8_coef_bands[i + 1];
- t0 = tokens[next][0].token;
- t1 = tokens[next][1].token;
- /* Update the cost of each path if we're past the EOB token. */
- if (t0 != DCT_EOB_TOKEN)
- {
- tokens[next][0].rate += mb->token_costs[type][band][0][t0];
- tokens[next][0].token = ZERO_TOKEN;
- }
- if (t1 != DCT_EOB_TOKEN)
- {
- tokens[next][1].rate += mb->token_costs[type][band][0][t1];
- tokens[next][1].token = ZERO_TOKEN;
- }
- /* Don't update next, because we didn't add a new node. */
- }
- }
-
- /* Now pick the best path through the whole trellis. */
- band = vp8_coef_bands[i + 1];
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
- rate0 = tokens[next][0].rate;
- rate1 = tokens[next][1].rate;
- error0 = tokens[next][0].error;
- error1 = tokens[next][1].error;
- t0 = tokens[next][0].token;
- t1 = tokens[next][1].token;
- rate0 += mb->token_costs[type][band][pt][t0];
- rate1 += mb->token_costs[type][band][pt][t1];
- rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);
- rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);
- if (rd_cost0 == rd_cost1)
- {
- rd_cost0 = RDTRUNC(rdmult, rddiv, rate0, error0);
- rd_cost1 = RDTRUNC(rdmult, rddiv, rate1, error1);
- }
- best = rd_cost1 < rd_cost0;
- final_eob = i0 - 1;
- for (i = next; i < eob; i = next)
- {
- x = tokens[i][best].qc;
- if (x)
- final_eob = i;
- rc = vp8_default_zig_zag1d[i];
- qcoeff_ptr[rc] = x;
- dqcoeff_ptr[rc] = x * dequant_ptr[rc];
- next = tokens[i][best].next;
- best = (best_mask[best] >> i) & 1;
- }
- final_eob++;
-
- *a = *l = (final_eob != !type);
- *d->eob = (char)final_eob;
-}
-static void check_reset_2nd_coeffs(MACROBLOCKD *x, int type,
- ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l)
-{
- int sum=0;
- int i;
- BLOCKD *bd = &x->block[24];
-
- if(bd->dequant[0]>=35 && bd->dequant[1]>=35)
- return;
-
- for(i=0;i<(*bd->eob);i++)
- {
- int coef = bd->dqcoeff[vp8_default_zig_zag1d[i]];
- sum+= (coef>=0)?coef:-coef;
- if(sum>=35)
- return;
- }
- /**************************************************************************
- our inverse hadamard transform effectively is weighted sum of all 16 inputs
- with weight either 1 or -1. It has a last stage scaling of (sum+3)>>3. And
- dc only idct is (dc+4)>>3. So if all the sums are between -35 and 29, the
- output after inverse wht and idct will be all zero. A sum of absolute value
- smaller than 35 guarantees all 16 different (+1/-1) weighted sums in wht
- fall between -35 and +35.
- **************************************************************************/
- if(sum < 35)
- {
- for(i=0;i<(*bd->eob);i++)
- {
- int rc = vp8_default_zig_zag1d[i];
- bd->qcoeff[rc]=0;
- bd->dqcoeff[rc]=0;
- }
- *bd->eob = 0;
- *a = *l = (*bd->eob != !type);
- }
-}
-
-static void optimize_mb(MACROBLOCK *x)
-{
- int b;
- int type;
- int has_2nd_order;
-
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
-
- vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
-
- has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
- type = has_2nd_order ? PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC;
-
- for (b = 0; b < 16; b++)
- {
- optimize_b(x, b, type,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- }
-
- for (b = 16; b < 24; b++)
- {
- optimize_b(x, b, PLANE_TYPE_UV,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- }
-
- if (has_2nd_order)
- {
- b=24;
- optimize_b(x, b, PLANE_TYPE_Y2,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- check_reset_2nd_coeffs(&x->e_mbd, PLANE_TYPE_Y2,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- }
-}
-
-
-void vp8_optimize_mby(MACROBLOCK *x)
-{
- int b;
- int type;
- int has_2nd_order;
-
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
-
- if (!x->e_mbd.above_context)
- return;
-
- if (!x->e_mbd.left_context)
- return;
-
- vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
-
- has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
- type = has_2nd_order ? PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC;
-
- for (b = 0; b < 16; b++)
- {
- optimize_b(x, b, type,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- }
-
-
- if (has_2nd_order)
- {
- b=24;
- optimize_b(x, b, PLANE_TYPE_Y2,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- check_reset_2nd_coeffs(&x->e_mbd, PLANE_TYPE_Y2,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- }
-}
-
-void vp8_optimize_mbuv(MACROBLOCK *x)
-{
- int b;
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
-
- if (!x->e_mbd.above_context)
- return;
-
- if (!x->e_mbd.left_context)
- return;
-
- vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
-
- for (b = 16; b < 24; b++)
- {
- optimize_b(x, b, PLANE_TYPE_UV,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
- }
-}
-
-void vp8_encode_inter16x16(MACROBLOCK *x)
-{
- vp8_build_inter_predictors_mb(&x->e_mbd);
-
- vp8_subtract_mb(x);
-
- transform_mb(x);
-
- vp8_quantize_mb(x);
-
- if (x->optimize)
- optimize_mb(x);
-}
-
-/* this funciton is used by first pass only */
-void vp8_encode_inter16x16y(MACROBLOCK *x)
-{
- BLOCK *b = &x->block[0];
-
- vp8_build_inter16x16_predictors_mby(&x->e_mbd, x->e_mbd.dst.y_buffer,
- x->e_mbd.dst.y_stride);
-
- vp8_subtract_mby(x->src_diff, *(b->base_src),
- b->src_stride, x->e_mbd.dst.y_buffer, x->e_mbd.dst.y_stride);
-
- transform_mby(x);
-
- vp8_quantize_mby(x);
-
- vp8_inverse_transform_mby(&x->e_mbd);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.h
deleted file mode 100644
index 0b3ec87..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemb.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_ENCODEMB_H_
-#define VP8_ENCODER_ENCODEMB_H_
-
-#include "onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void vp8_encode_inter16x16(MACROBLOCK *x);
-
-void vp8_build_dcblock(MACROBLOCK *b);
-void vp8_transform_mb(MACROBLOCK *mb);
-void vp8_transform_mbuv(MACROBLOCK *x);
-void vp8_transform_intra_mby(MACROBLOCK *x);
-
-void vp8_optimize_mby(MACROBLOCK *x);
-void vp8_optimize_mbuv(MACROBLOCK *x);
-void vp8_encode_inter16x16y(MACROBLOCK *x);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_ENCODEMB_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.c
deleted file mode 100644
index 2a74ff4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/common/common.h"
-#include "encodemv.h"
-#include "vp8/common/entropymode.h"
-#include "vp8/common/systemdependent.h"
-
-#include <math.h>
-
-#ifdef VP8_ENTROPY_STATS
-extern unsigned int active_section;
-#endif
-
-static void encode_mvcomponent(
- vp8_writer *const w,
- const int v,
- const struct mv_context *mvc
-)
-{
- const vp8_prob *p = mvc->prob;
- const int x = v < 0 ? -v : v;
-
- if (x < mvnum_short) /* Small */
- {
- vp8_write(w, 0, p [mvpis_short]);
- vp8_treed_write(w, vp8_small_mvtree, p + MVPshort, x, 3);
-
- if (!x)
- return; /* no sign bit */
- }
- else /* Large */
- {
- int i = 0;
-
- vp8_write(w, 1, p [mvpis_short]);
-
- do
- vp8_write(w, (x >> i) & 1, p [MVPbits + i]);
-
- while (++i < 3);
-
- i = mvlong_width - 1; /* Skip bit 3, which is sometimes implicit */
-
- do
- vp8_write(w, (x >> i) & 1, p [MVPbits + i]);
-
- while (--i > 3);
-
- if (x & 0xFFF0)
- vp8_write(w, (x >> 3) & 1, p [MVPbits + 3]);
- }
-
- vp8_write(w, v < 0, p [MVPsign]);
-}
-#if 0
-static int max_mv_r = 0;
-static int max_mv_c = 0;
-#endif
-void vp8_encode_motion_vector(vp8_writer *w, const MV *mv, const MV_CONTEXT *mvc)
-{
-
-#if 0
- {
- if (abs(mv->row >> 1) > max_mv_r)
- {
- FILE *f = fopen("maxmv.stt", "a");
- max_mv_r = abs(mv->row >> 1);
- fprintf(f, "New Mv Row Max %6d\n", (mv->row >> 1));
-
- if ((abs(mv->row) / 2) != max_mv_r)
- fprintf(f, "MV Row conversion error %6d\n", abs(mv->row) / 2);
-
- fclose(f);
- }
-
- if (abs(mv->col >> 1) > max_mv_c)
- {
- FILE *f = fopen("maxmv.stt", "a");
- fprintf(f, "New Mv Col Max %6d\n", (mv->col >> 1));
- max_mv_c = abs(mv->col >> 1);
- fclose(f);
- }
- }
-#endif
-
- encode_mvcomponent(w, mv->row >> 1, &mvc[0]);
- encode_mvcomponent(w, mv->col >> 1, &mvc[1]);
-}
-
-
-static unsigned int cost_mvcomponent(const int v, const struct mv_context *mvc)
-{
- const vp8_prob *p = mvc->prob;
- const int x = v;
- unsigned int cost;
-
- if (x < mvnum_short)
- {
- cost = vp8_cost_zero(p [mvpis_short])
- + vp8_treed_cost(vp8_small_mvtree, p + MVPshort, x, 3);
-
- if (!x)
- return cost;
- }
- else
- {
- int i = 0;
- cost = vp8_cost_one(p [mvpis_short]);
-
- do
- cost += vp8_cost_bit(p [MVPbits + i], (x >> i) & 1);
-
- while (++i < 3);
-
- i = mvlong_width - 1; /* Skip bit 3, which is sometimes implicit */
-
- do
- cost += vp8_cost_bit(p [MVPbits + i], (x >> i) & 1);
-
- while (--i > 3);
-
- if (x & 0xFFF0)
- cost += vp8_cost_bit(p [MVPbits + 3], (x >> 3) & 1);
- }
-
- return cost; /* + vp8_cost_bit( p [MVPsign], v < 0); */
-}
-
-void vp8_build_component_cost_table(int *mvcost[2], const MV_CONTEXT *mvc, int mvc_flag[2])
-{
- int i = 1;
- unsigned int cost0 = 0;
- unsigned int cost1 = 0;
-
- vp8_clear_system_state();
-
- i = 1;
-
- if (mvc_flag[0])
- {
- mvcost [0] [0] = cost_mvcomponent(0, &mvc[0]);
-
- do
- {
- cost0 = cost_mvcomponent(i, &mvc[0]);
-
- mvcost [0] [i] = cost0 + vp8_cost_zero(mvc[0].prob[MVPsign]);
- mvcost [0] [-i] = cost0 + vp8_cost_one(mvc[0].prob[MVPsign]);
- }
- while (++i <= mv_max);
- }
-
- i = 1;
-
- if (mvc_flag[1])
- {
- mvcost [1] [0] = cost_mvcomponent(0, &mvc[1]);
-
- do
- {
- cost1 = cost_mvcomponent(i, &mvc[1]);
-
- mvcost [1] [i] = cost1 + vp8_cost_zero(mvc[1].prob[MVPsign]);
- mvcost [1] [-i] = cost1 + vp8_cost_one(mvc[1].prob[MVPsign]);
- }
- while (++i <= mv_max);
- }
-}
-
-
-/* Motion vector probability table update depends on benefit.
- * Small correction allows for the fact that an update to an MV probability
- * may have benefit in subsequent frames as well as the current one.
- */
-#define MV_PROB_UPDATE_CORRECTION -1
-
-
-static void calc_prob(vp8_prob *p, const unsigned int ct[2])
-{
- const unsigned int tot = ct[0] + ct[1];
-
- if (tot)
- {
- const vp8_prob x = ((ct[0] * 255) / tot) & -2;
- *p = x ? x : 1;
- }
-}
-
-static void update(
- vp8_writer *const w,
- const unsigned int ct[2],
- vp8_prob *const cur_p,
- const vp8_prob new_p,
- const vp8_prob update_p,
- int *updated
-)
-{
- const int cur_b = vp8_cost_branch(ct, *cur_p);
- const int new_b = vp8_cost_branch(ct, new_p);
- const int cost = 7 + MV_PROB_UPDATE_CORRECTION + ((vp8_cost_one(update_p) - vp8_cost_zero(update_p) + 128) >> 8);
-
- if (cur_b - new_b > cost)
- {
- *cur_p = new_p;
- vp8_write(w, 1, update_p);
- vp8_write_literal(w, new_p >> 1, 7);
- *updated = 1;
-
- }
- else
- vp8_write(w, 0, update_p);
-}
-
-static void write_component_probs(
- vp8_writer *const w,
- struct mv_context *cur_mvc,
- const struct mv_context *default_mvc_,
- const struct mv_context *update_mvc,
- const unsigned int events [MVvals],
- unsigned int rc,
- int *updated
-)
-{
- vp8_prob *Pcur = cur_mvc->prob;
- const vp8_prob *default_mvc = default_mvc_->prob;
- const vp8_prob *Pupdate = update_mvc->prob;
- unsigned int is_short_ct[2], sign_ct[2];
-
- unsigned int bit_ct [mvlong_width] [2];
-
- unsigned int short_ct [mvnum_short];
- unsigned int short_bct [mvnum_short-1] [2];
-
- vp8_prob Pnew [MVPcount];
-
- (void) rc;
- vp8_copy_array(Pnew, default_mvc, MVPcount);
-
- vp8_zero(is_short_ct)
- vp8_zero(sign_ct)
- vp8_zero(bit_ct)
- vp8_zero(short_ct)
- vp8_zero(short_bct)
-
-
- /* j=0 */
- {
- const int c = events [mv_max];
-
- is_short_ct [0] += c; /* Short vector */
- short_ct [0] += c; /* Magnitude distribution */
- }
-
- /* j: 1 ~ mv_max (1023) */
- {
- int j = 1;
-
- do
- {
- const int c1 = events [mv_max + j]; /* positive */
- const int c2 = events [mv_max - j]; /* negative */
- const int c = c1 + c2;
- int a = j;
-
- sign_ct [0] += c1;
- sign_ct [1] += c2;
-
- if (a < mvnum_short)
- {
- is_short_ct [0] += c; /* Short vector */
- short_ct [a] += c; /* Magnitude distribution */
- }
- else
- {
- int k = mvlong_width - 1;
- is_short_ct [1] += c; /* Long vector */
-
- /* bit 3 not always encoded. */
- do
- bit_ct [k] [(a >> k) & 1] += c;
-
- while (--k >= 0);
- }
- }
- while (++j <= mv_max);
- }
-
- calc_prob(Pnew + mvpis_short, is_short_ct);
-
- calc_prob(Pnew + MVPsign, sign_ct);
-
- {
- vp8_prob p [mvnum_short - 1]; /* actually only need branch ct */
- int j = 0;
-
- vp8_tree_probs_from_distribution(
- 8, vp8_small_mvencodings, vp8_small_mvtree,
- p, short_bct, short_ct,
- 256, 1
- );
-
- do
- calc_prob(Pnew + MVPshort + j, short_bct[j]);
-
- while (++j < mvnum_short - 1);
- }
-
- {
- int j = 0;
-
- do
- calc_prob(Pnew + MVPbits + j, bit_ct[j]);
-
- while (++j < mvlong_width);
- }
-
- update(w, is_short_ct, Pcur + mvpis_short, Pnew[mvpis_short], *Pupdate++, updated);
-
- update(w, sign_ct, Pcur + MVPsign, Pnew[MVPsign], *Pupdate++, updated);
-
- {
- const vp8_prob *const new_p = Pnew + MVPshort;
- vp8_prob *const cur_p = Pcur + MVPshort;
-
- int j = 0;
-
- do
-
- update(w, short_bct[j], cur_p + j, new_p[j], *Pupdate++, updated);
-
- while (++j < mvnum_short - 1);
- }
-
- {
- const vp8_prob *const new_p = Pnew + MVPbits;
- vp8_prob *const cur_p = Pcur + MVPbits;
-
- int j = 0;
-
- do
-
- update(w, bit_ct[j], cur_p + j, new_p[j], *Pupdate++, updated);
-
- while (++j < mvlong_width);
- }
-}
-
-void vp8_write_mvprobs(VP8_COMP *cpi)
-{
- vp8_writer *const w = cpi->bc;
- MV_CONTEXT *mvc = cpi->common.fc.mvc;
- int flags[2] = {0, 0};
-#ifdef VP8_ENTROPY_STATS
- active_section = 4;
-#endif
- write_component_probs(
- w, &mvc[0], &vp8_default_mv_context[0], &vp8_mv_update_probs[0],
- cpi->mb.MVcount[0], 0, &flags[0]
- );
- write_component_probs(
- w, &mvc[1], &vp8_default_mv_context[1], &vp8_mv_update_probs[1],
- cpi->mb.MVcount[1], 1, &flags[1]
- );
-
- if (flags[0] || flags[1])
- vp8_build_component_cost_table(cpi->mb.mvcost, (const MV_CONTEXT *) cpi->common.fc.mvc, flags);
-
-#ifdef VP8_ENTROPY_STATS
- active_section = 5;
-#endif
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.h
deleted file mode 100644
index 722162b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/encodemv.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_ENCODEMV_H_
-#define VP8_ENCODER_ENCODEMV_H_
-
-#include "onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_write_mvprobs(VP8_COMP *);
-void vp8_encode_motion_vector(vp8_writer *, const MV *, const MV_CONTEXT *);
-void vp8_build_component_cost_table(int *mvcost[2], const MV_CONTEXT *mvc, int mvc_flag[2]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_ENCODEMV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ethreading.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/ethreading.c
deleted file mode 100644
index d4b17ce..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ethreading.c
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "onyx_int.h"
-#include "vp8/common/threading.h"
-#include "vp8/common/common.h"
-#include "vp8/common/extend.h"
-#include "bitstream.h"
-#include "encodeframe.h"
-
-#if CONFIG_MULTITHREAD
-
-extern void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip);
-
-extern void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm);
-
-static THREAD_FUNCTION thread_loopfilter(void *p_data)
-{
- VP8_COMP *cpi = (VP8_COMP *)(((LPFTHREAD_DATA *)p_data)->ptr1);
- VP8_COMMON *cm = &cpi->common;
-
- while (1)
- {
- if (cpi->b_multi_threaded == 0)
- break;
-
- if (sem_wait(&cpi->h_event_start_lpf) == 0)
- {
- if (cpi->b_multi_threaded == 0) /* we're shutting down */
- break;
-
- vp8_loopfilter_frame(cpi, cm);
-
- sem_post(&cpi->h_event_end_lpf);
- }
- }
-
- return 0;
-}
-
-static
-THREAD_FUNCTION thread_encoding_proc(void *p_data)
-{
- int ithread = ((ENCODETHREAD_DATA *)p_data)->ithread;
- VP8_COMP *cpi = (VP8_COMP *)(((ENCODETHREAD_DATA *)p_data)->ptr1);
- MB_ROW_COMP *mbri = (MB_ROW_COMP *)(((ENCODETHREAD_DATA *)p_data)->ptr2);
- ENTROPY_CONTEXT_PLANES mb_row_left_context;
-
- while (1)
- {
- if (cpi->b_multi_threaded == 0)
- break;
-
- if (sem_wait(&cpi->h_event_start_encoding[ithread]) == 0)
- {
- const int nsync = cpi->mt_sync_range;
- VP8_COMMON *cm = &cpi->common;
- int mb_row;
- MACROBLOCK *x = &mbri->mb;
- MACROBLOCKD *xd = &x->e_mbd;
- TOKENEXTRA *tp ;
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- TOKENEXTRA *tp_start = cpi->tok + (1 + ithread) * (16 * 24);
- const int num_part = (1 << cm->multi_token_partition);
-#endif
-
- int *segment_counts = mbri->segment_counts;
- int *totalrate = &mbri->totalrate;
-
- if (cpi->b_multi_threaded == 0) /* we're shutting down */
- break;
-
- for (mb_row = ithread + 1; mb_row < cm->mb_rows; mb_row += (cpi->encoding_thread_count + 1))
- {
-
- int recon_yoffset, recon_uvoffset;
- int mb_col;
- int ref_fb_idx = cm->lst_fb_idx;
- int dst_fb_idx = cm->new_fb_idx;
- int recon_y_stride = cm->yv12_fb[ref_fb_idx].y_stride;
- int recon_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
- int map_index = (mb_row * cm->mb_cols);
- volatile const int *last_row_current_mb_col;
- volatile int *current_mb_col = &cpi->mt_current_mb_col[mb_row];
-
-#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- vp8_writer *w = &cpi->bc[1 + (mb_row % num_part)];
-#else
- tp = cpi->tok + (mb_row * (cm->mb_cols * 16 * 24));
- cpi->tplist[mb_row].start = tp;
-#endif
-
- last_row_current_mb_col = &cpi->mt_current_mb_col[mb_row - 1];
-
- /* reset above block coeffs */
- xd->above_context = cm->above_context;
- xd->left_context = &mb_row_left_context;
-
- vp8_zero(mb_row_left_context);
-
- xd->up_available = (mb_row != 0);
- recon_yoffset = (mb_row * recon_y_stride * 16);
- recon_uvoffset = (mb_row * recon_uv_stride * 8);
-
- /* Set the mb activity pointer to the start of the row. */
- x->mb_activity_ptr = &cpi->mb_activity_map[map_index];
-
- /* for each macroblock col in image */
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
- *current_mb_col = mb_col - 1;
-
- if ((mb_col & (nsync - 1)) == 0)
- {
- while (mb_col > (*last_row_current_mb_col - nsync))
- {
- x86_pause_hint();
- thread_sleep(0);
- }
- }
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- tp = tp_start;
-#endif
-
- /* Distance of Mb to the various image edges.
- * These specified to 8th pel as they are always compared
- * to values that are in 1/8th pel units
- */
- xd->mb_to_left_edge = -((mb_col * 16) << 3);
- xd->mb_to_right_edge = ((cm->mb_cols - 1 - mb_col) * 16) << 3;
- xd->mb_to_top_edge = -((mb_row * 16) << 3);
- xd->mb_to_bottom_edge = ((cm->mb_rows - 1 - mb_row) * 16) << 3;
-
- /* Set up limit values for motion vectors used to prevent
- * them extending outside the UMV borders
- */
- x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + (VP8BORDERINPIXELS - 16);
- x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + (VP8BORDERINPIXELS - 16);
-
- xd->dst.y_buffer = cm->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset;
- xd->dst.u_buffer = cm->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset;
- xd->dst.v_buffer = cm->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset;
- xd->left_available = (mb_col != 0);
-
- x->rddiv = cpi->RDDIV;
- x->rdmult = cpi->RDMULT;
-
- /* Copy current mb to a buffer */
- vp8_copy_mem16x16(x->src.y_buffer, x->src.y_stride, x->thismb, 16);
-
- if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
- vp8_activity_masking(cpi, x);
-
- /* Is segmentation enabled */
- /* MB level adjustment to quantizer */
- if (xd->segmentation_enabled)
- {
- /* Code to set segment id in xd->mbmi.segment_id for
- * current MB (with range checking)
- */
- if (cpi->segmentation_map[map_index + mb_col] <= 3)
- xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[map_index + mb_col];
- else
- xd->mode_info_context->mbmi.segment_id = 0;
-
- vp8cx_mb_init_quantizer(cpi, x, 1);
- }
- else
- /* Set to Segment 0 by default */
- xd->mode_info_context->mbmi.segment_id = 0;
-
- x->active_ptr = cpi->active_map + map_index + mb_col;
-
- if (cm->frame_type == KEY_FRAME)
- {
- *totalrate += vp8cx_encode_intra_macroblock(cpi, x, &tp);
-#ifdef MODE_STATS
- y_modes[xd->mbmi.mode] ++;
-#endif
- }
- else
- {
- *totalrate += vp8cx_encode_inter_macroblock(cpi, x, &tp, recon_yoffset, recon_uvoffset, mb_row, mb_col);
-
-#ifdef MODE_STATS
- inter_y_modes[xd->mbmi.mode] ++;
-
- if (xd->mbmi.mode == SPLITMV)
- {
- int b;
-
- for (b = 0; b < xd->mbmi.partition_count; b++)
- {
- inter_b_modes[x->partition->bmi[b].mode] ++;
- }
- }
-
-#endif
-
- /* Special case code for cyclic refresh
- * If cyclic update enabled then copy
- * xd->mbmi.segment_id; (which may have been updated
- * based on mode during
- * vp8cx_encode_inter_macroblock()) back into the
- * global segmentation map
- */
- if ((cpi->current_layer == 0) &&
- (cpi->cyclic_refresh_mode_enabled &&
- xd->segmentation_enabled))
- {
- const MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi;
- cpi->segmentation_map[map_index + mb_col] = mbmi->segment_id;
-
- /* If the block has been refreshed mark it as clean
- * (the magnitude of the -ve influences how long it
- * will be before we consider another refresh):
- * Else if it was coded (last frame 0,0) and has
- * not already been refreshed then mark it as a
- * candidate for cleanup next time (marked 0) else
- * mark it as dirty (1).
- */
- if (mbmi->segment_id)
- cpi->cyclic_refresh_map[map_index + mb_col] = -1;
- else if ((mbmi->mode == ZEROMV) && (mbmi->ref_frame == LAST_FRAME))
- {
- if (cpi->cyclic_refresh_map[map_index + mb_col] == 1)
- cpi->cyclic_refresh_map[map_index + mb_col] = 0;
- }
- else
- cpi->cyclic_refresh_map[map_index + mb_col] = 1;
-
- }
- }
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- /* pack tokens for this MB */
- {
- int tok_count = tp - tp_start;
- pack_tokens(w, tp_start, tok_count);
- }
-#else
- cpi->tplist[mb_row].stop = tp;
-#endif
- /* Increment pointer into gf usage flags structure. */
- x->gf_active_ptr++;
-
- /* Increment the activity mask pointers. */
- x->mb_activity_ptr++;
-
- /* adjust to the next column of macroblocks */
- x->src.y_buffer += 16;
- x->src.u_buffer += 8;
- x->src.v_buffer += 8;
-
- recon_yoffset += 16;
- recon_uvoffset += 8;
-
- /* Keep track of segment usage */
- segment_counts[xd->mode_info_context->mbmi.segment_id]++;
-
- /* skip to next mb */
- xd->mode_info_context++;
- x->partition_info++;
- xd->above_context++;
- }
-
- vp8_extend_mb_row( &cm->yv12_fb[dst_fb_idx],
- xd->dst.y_buffer + 16,
- xd->dst.u_buffer + 8,
- xd->dst.v_buffer + 8);
-
- *current_mb_col = mb_col + nsync;
-
- /* this is to account for the border */
- xd->mode_info_context++;
- x->partition_info++;
-
- x->src.y_buffer += 16 * x->src.y_stride * (cpi->encoding_thread_count + 1) - 16 * cm->mb_cols;
- x->src.u_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_count + 1) - 8 * cm->mb_cols;
- x->src.v_buffer += 8 * x->src.uv_stride * (cpi->encoding_thread_count + 1) - 8 * cm->mb_cols;
-
- xd->mode_info_context += xd->mode_info_stride * cpi->encoding_thread_count;
- x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count;
- x->gf_active_ptr += cm->mb_cols * cpi->encoding_thread_count;
-
- if (mb_row == cm->mb_rows - 1)
- {
- sem_post(&cpi->h_event_end_encoding); /* signal frame encoding end */
- }
- }
- }
- }
-
- /* printf("exit thread %d\n", ithread); */
- return 0;
-}
-
-static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc)
-{
-
- MACROBLOCK *x = mbsrc;
- MACROBLOCK *z = mbdst;
- int i;
-
- z->ss = x->ss;
- z->ss_count = x->ss_count;
- z->searches_per_step = x->searches_per_step;
- z->errorperbit = x->errorperbit;
-
- z->sadperbit16 = x->sadperbit16;
- z->sadperbit4 = x->sadperbit4;
-
- /*
- z->mv_col_min = x->mv_col_min;
- z->mv_col_max = x->mv_col_max;
- z->mv_row_min = x->mv_row_min;
- z->mv_row_max = x->mv_row_max;
- */
-
- z->short_fdct4x4 = x->short_fdct4x4;
- z->short_fdct8x4 = x->short_fdct8x4;
- z->short_walsh4x4 = x->short_walsh4x4;
- z->quantize_b = x->quantize_b;
- z->quantize_b_pair = x->quantize_b_pair;
- z->optimize = x->optimize;
-
- /*
- z->mvc = x->mvc;
- z->src.y_buffer = x->src.y_buffer;
- z->src.u_buffer = x->src.u_buffer;
- z->src.v_buffer = x->src.v_buffer;
- */
-
- z->mvcost[0] = x->mvcost[0];
- z->mvcost[1] = x->mvcost[1];
- z->mvsadcost[0] = x->mvsadcost[0];
- z->mvsadcost[1] = x->mvsadcost[1];
-
- z->token_costs = x->token_costs;
- z->inter_bmode_costs = x->inter_bmode_costs;
- z->mbmode_cost = x->mbmode_cost;
- z->intra_uv_mode_cost = x->intra_uv_mode_cost;
- z->bmode_costs = x->bmode_costs;
-
- for (i = 0; i < 25; i++)
- {
- z->block[i].quant = x->block[i].quant;
- z->block[i].quant_fast = x->block[i].quant_fast;
- z->block[i].quant_shift = x->block[i].quant_shift;
- z->block[i].zbin = x->block[i].zbin;
- z->block[i].zrun_zbin_boost = x->block[i].zrun_zbin_boost;
- z->block[i].round = x->block[i].round;
- z->block[i].src_stride = x->block[i].src_stride;
- }
-
- z->q_index = x->q_index;
- z->act_zbin_adj = x->act_zbin_adj;
- z->last_act_zbin_adj = x->last_act_zbin_adj;
-
- {
- MACROBLOCKD *xd = &x->e_mbd;
- MACROBLOCKD *zd = &z->e_mbd;
-
- /*
- zd->mode_info_context = xd->mode_info_context;
- zd->mode_info = xd->mode_info;
-
- zd->mode_info_stride = xd->mode_info_stride;
- zd->frame_type = xd->frame_type;
- zd->up_available = xd->up_available ;
- zd->left_available = xd->left_available;
- zd->left_context = xd->left_context;
- zd->last_frame_dc = xd->last_frame_dc;
- zd->last_frame_dccons = xd->last_frame_dccons;
- zd->gold_frame_dc = xd->gold_frame_dc;
- zd->gold_frame_dccons = xd->gold_frame_dccons;
- zd->mb_to_left_edge = xd->mb_to_left_edge;
- zd->mb_to_right_edge = xd->mb_to_right_edge;
- zd->mb_to_top_edge = xd->mb_to_top_edge ;
- zd->mb_to_bottom_edge = xd->mb_to_bottom_edge;
- zd->gf_active_ptr = xd->gf_active_ptr;
- zd->frames_since_golden = xd->frames_since_golden;
- zd->frames_till_alt_ref_frame = xd->frames_till_alt_ref_frame;
- */
- zd->subpixel_predict = xd->subpixel_predict;
- zd->subpixel_predict8x4 = xd->subpixel_predict8x4;
- zd->subpixel_predict8x8 = xd->subpixel_predict8x8;
- zd->subpixel_predict16x16 = xd->subpixel_predict16x16;
- zd->segmentation_enabled = xd->segmentation_enabled;
- zd->mb_segement_abs_delta = xd->mb_segement_abs_delta;
- vpx_memcpy(zd->segment_feature_data, xd->segment_feature_data,
- sizeof(xd->segment_feature_data));
-
- vpx_memcpy(zd->dequant_y1_dc, xd->dequant_y1_dc,
- sizeof(xd->dequant_y1_dc));
- vpx_memcpy(zd->dequant_y1, xd->dequant_y1, sizeof(xd->dequant_y1));
- vpx_memcpy(zd->dequant_y2, xd->dequant_y2, sizeof(xd->dequant_y2));
- vpx_memcpy(zd->dequant_uv, xd->dequant_uv, sizeof(xd->dequant_uv));
-
-#if 1
- /*TODO: Remove dequant from BLOCKD. This is a temporary solution until
- * the quantizer code uses a passed in pointer to the dequant constants.
- * This will also require modifications to the x86 and neon assembly.
- * */
- for (i = 0; i < 16; i++)
- zd->block[i].dequant = zd->dequant_y1;
- for (i = 16; i < 24; i++)
- zd->block[i].dequant = zd->dequant_uv;
- zd->block[24].dequant = zd->dequant_y2;
-#endif
-
-
- vpx_memcpy(z->rd_threshes, x->rd_threshes, sizeof(x->rd_threshes));
- vpx_memcpy(z->rd_thresh_mult, x->rd_thresh_mult,
- sizeof(x->rd_thresh_mult));
-
- z->zbin_over_quant = x->zbin_over_quant;
- z->zbin_mode_boost_enabled = x->zbin_mode_boost_enabled;
- z->zbin_mode_boost = x->zbin_mode_boost;
-
- vpx_memset(z->error_bins, 0, sizeof(z->error_bins));
- }
-}
-
-void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
- MACROBLOCK *x,
- MB_ROW_COMP *mbr_ei,
- int count
- )
-{
-
- VP8_COMMON *const cm = & cpi->common;
- MACROBLOCKD *const xd = & x->e_mbd;
- int i;
-
- for (i = 0; i < count; i++)
- {
- MACROBLOCK *mb = & mbr_ei[i].mb;
- MACROBLOCKD *mbd = &mb->e_mbd;
-
- mbd->subpixel_predict = xd->subpixel_predict;
- mbd->subpixel_predict8x4 = xd->subpixel_predict8x4;
- mbd->subpixel_predict8x8 = xd->subpixel_predict8x8;
- mbd->subpixel_predict16x16 = xd->subpixel_predict16x16;
- mb->gf_active_ptr = x->gf_active_ptr;
-
- vpx_memset(mbr_ei[i].segment_counts, 0, sizeof(mbr_ei[i].segment_counts));
- mbr_ei[i].totalrate = 0;
-
- mb->partition_info = x->pi + x->e_mbd.mode_info_stride * (i + 1);
-
- mbd->mode_info_context = cm->mi + x->e_mbd.mode_info_stride * (i + 1);
- mbd->mode_info_stride = cm->mode_info_stride;
-
- mbd->frame_type = cm->frame_type;
-
- mb->src = * cpi->Source;
- mbd->pre = cm->yv12_fb[cm->lst_fb_idx];
- mbd->dst = cm->yv12_fb[cm->new_fb_idx];
-
- mb->src.y_buffer += 16 * x->src.y_stride * (i + 1);
- mb->src.u_buffer += 8 * x->src.uv_stride * (i + 1);
- mb->src.v_buffer += 8 * x->src.uv_stride * (i + 1);
-
- vp8_build_block_offsets(mb);
-
- mbd->left_context = &cm->left_context;
- mb->mvc = cm->fc.mvc;
-
- setup_mbby_copy(&mbr_ei[i].mb, x);
-
- mbd->fullpixel_mask = 0xffffffff;
- if(cm->full_pixel)
- mbd->fullpixel_mask = 0xfffffff8;
-
- vp8_zero(mb->coef_counts);
- vp8_zero(x->ymode_count);
- mb->skip_true_count = 0;
- vp8_zero(mb->MVcount);
- mb->prediction_error = 0;
- mb->intra_error = 0;
- vp8_zero(mb->count_mb_ref_frame_usage);
- mb->mbs_tested_so_far = 0;
- }
-}
-
-int vp8cx_create_encoder_threads(VP8_COMP *cpi)
-{
- const VP8_COMMON * cm = &cpi->common;
-
- cpi->b_multi_threaded = 0;
- cpi->encoding_thread_count = 0;
- cpi->b_lpf_running = 0;
-
- if (cm->processor_core_count > 1 && cpi->oxcf.multi_threaded > 1)
- {
- int ithread;
- int th_count = cpi->oxcf.multi_threaded - 1;
- int rc = 0;
-
- /* don't allocate more threads than cores available */
- if (cpi->oxcf.multi_threaded > cm->processor_core_count)
- th_count = cm->processor_core_count - 1;
-
- /* we have th_count + 1 (main) threads processing one row each */
- /* no point to have more threads than the sync range allows */
- if(th_count > ((cm->mb_cols / cpi->mt_sync_range) - 1))
- {
- th_count = (cm->mb_cols / cpi->mt_sync_range) - 1;
- }
-
- if(th_count == 0)
- return 0;
-
- CHECK_MEM_ERROR(cpi->h_encoding_thread,
- vpx_malloc(sizeof(pthread_t) * th_count));
- CHECK_MEM_ERROR(cpi->h_event_start_encoding,
- vpx_malloc(sizeof(sem_t) * th_count));
- CHECK_MEM_ERROR(cpi->mb_row_ei,
- vpx_memalign(32, sizeof(MB_ROW_COMP) * th_count));
- vpx_memset(cpi->mb_row_ei, 0, sizeof(MB_ROW_COMP) * th_count);
- CHECK_MEM_ERROR(cpi->en_thread_data,
- vpx_malloc(sizeof(ENCODETHREAD_DATA) * th_count));
-
- sem_init(&cpi->h_event_end_encoding, 0, 0);
-
- cpi->b_multi_threaded = 1;
- cpi->encoding_thread_count = th_count;
-
- /*
- printf("[VP8:] multi_threaded encoding is enabled with %d threads\n\n",
- (cpi->encoding_thread_count +1));
- */
-
- for (ithread = 0; ithread < th_count; ithread++)
- {
- ENCODETHREAD_DATA *ethd = &cpi->en_thread_data[ithread];
-
- /* Setup block ptrs and offsets */
- vp8_setup_block_ptrs(&cpi->mb_row_ei[ithread].mb);
- vp8_setup_block_dptrs(&cpi->mb_row_ei[ithread].mb.e_mbd);
-
- sem_init(&cpi->h_event_start_encoding[ithread], 0, 0);
-
- ethd->ithread = ithread;
- ethd->ptr1 = (void *)cpi;
- ethd->ptr2 = (void *)&cpi->mb_row_ei[ithread];
-
- rc = pthread_create(&cpi->h_encoding_thread[ithread], 0,
- thread_encoding_proc, ethd);
- if(rc)
- break;
- }
-
- if(rc)
- {
- /* shutdown other threads */
- cpi->b_multi_threaded = 0;
- for(--ithread; ithread >= 0; ithread--)
- {
- pthread_join(cpi->h_encoding_thread[ithread], 0);
- sem_destroy(&cpi->h_event_start_encoding[ithread]);
- }
- sem_destroy(&cpi->h_event_end_encoding);
-
- /* free thread related resources */
- vpx_free(cpi->h_event_start_encoding);
- vpx_free(cpi->h_encoding_thread);
- vpx_free(cpi->mb_row_ei);
- vpx_free(cpi->en_thread_data);
-
- return -1;
- }
-
-
- {
- LPFTHREAD_DATA * lpfthd = &cpi->lpf_thread_data;
-
- sem_init(&cpi->h_event_start_lpf, 0, 0);
- sem_init(&cpi->h_event_end_lpf, 0, 0);
-
- lpfthd->ptr1 = (void *)cpi;
- rc = pthread_create(&cpi->h_filter_thread, 0, thread_loopfilter,
- lpfthd);
-
- if(rc)
- {
- /* shutdown other threads */
- cpi->b_multi_threaded = 0;
- for(--ithread; ithread >= 0; ithread--)
- {
- sem_post(&cpi->h_event_start_encoding[ithread]);
- pthread_join(cpi->h_encoding_thread[ithread], 0);
- sem_destroy(&cpi->h_event_start_encoding[ithread]);
- }
- sem_destroy(&cpi->h_event_end_encoding);
- sem_destroy(&cpi->h_event_end_lpf);
- sem_destroy(&cpi->h_event_start_lpf);
-
- /* free thread related resources */
- vpx_free(cpi->h_event_start_encoding);
- vpx_free(cpi->h_encoding_thread);
- vpx_free(cpi->mb_row_ei);
- vpx_free(cpi->en_thread_data);
-
- return -2;
- }
- }
- }
- return 0;
-}
-
-void vp8cx_remove_encoder_threads(VP8_COMP *cpi)
-{
- if (cpi->b_multi_threaded)
- {
- /* shutdown other threads */
- cpi->b_multi_threaded = 0;
- {
- int i;
-
- for (i = 0; i < cpi->encoding_thread_count; i++)
- {
- sem_post(&cpi->h_event_start_encoding[i]);
- pthread_join(cpi->h_encoding_thread[i], 0);
-
- sem_destroy(&cpi->h_event_start_encoding[i]);
- }
-
- sem_post(&cpi->h_event_start_lpf);
- pthread_join(cpi->h_filter_thread, 0);
- }
-
- sem_destroy(&cpi->h_event_end_encoding);
- sem_destroy(&cpi->h_event_end_lpf);
- sem_destroy(&cpi->h_event_start_lpf);
-
- /* free thread related resources */
- vpx_free(cpi->h_event_start_encoding);
- vpx_free(cpi->h_encoding_thread);
- vpx_free(cpi->mb_row_ei);
- vpx_free(cpi->en_thread_data);
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.c
deleted file mode 100644
index b7b2582..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.c
+++ /dev/null
@@ -1,3370 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <limits.h>
-#include <stdio.h>
-
-#include "./vpx_scale_rtcd.h"
-#include "block.h"
-#include "onyx_int.h"
-#include "vp8/common/variance.h"
-#include "encodeintra.h"
-#include "vp8/common/setupintrarecon.h"
-#include "vp8/common/systemdependent.h"
-#include "mcomp.h"
-#include "firstpass.h"
-#include "vpx_scale/vpx_scale.h"
-#include "encodemb.h"
-#include "vp8/common/extend.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/swapyv12buffer.h"
-#include "rdopt.h"
-#include "vp8/common/quant_common.h"
-#include "encodemv.h"
-#include "encodeframe.h"
-
-/* #define OUTPUT_FPF 1 */
-
-extern void vp8cx_frame_init_quantizer(VP8_COMP *cpi);
-extern void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv);
-extern void vp8_alloc_compressor_data(VP8_COMP *cpi);
-
-#define GFQ_ADJUSTMENT vp8_gf_boost_qadjustment[Q]
-extern int vp8_kf_boost_qadjustment[QINDEX_RANGE];
-
-extern const int vp8_gf_boost_qadjustment[QINDEX_RANGE];
-
-#define IIFACTOR 1.5
-#define IIKFACTOR1 1.40
-#define IIKFACTOR2 1.5
-#define RMAX 14.0
-#define GF_RMAX 48.0
-
-#define KF_MB_INTRA_MIN 300
-#define GF_MB_INTRA_MIN 200
-
-#define DOUBLE_DIVIDE_CHECK(X) ((X)<0?(X)-.000001:(X)+.000001)
-
-#define POW1 (double)cpi->oxcf.two_pass_vbrbias/100.0
-#define POW2 (double)cpi->oxcf.two_pass_vbrbias/100.0
-
-#define NEW_BOOST 1
-
-static int vscale_lookup[7] = {0, 1, 1, 2, 2, 3, 3};
-static int hscale_lookup[7] = {0, 0, 1, 1, 2, 2, 3};
-
-
-static const int cq_level[QINDEX_RANGE] =
-{
- 0,0,1,1,2,3,3,4,4,5,6,6,7,8,8,9,
- 9,10,11,11,12,13,13,14,15,15,16,17,17,18,19,20,
- 20,21,22,22,23,24,24,25,26,27,27,28,29,30,30,31,
- 32,33,33,34,35,36,36,37,38,39,39,40,41,42,42,43,
- 44,45,46,46,47,48,49,50,50,51,52,53,54,55,55,56,
- 57,58,59,60,60,61,62,63,64,65,66,67,67,68,69,70,
- 71,72,73,74,75,75,76,77,78,79,80,81,82,83,84,85,
- 86,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100
-};
-
-static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame);
-
-/* Resets the first pass file to the given position using a relative seek
- * from the current position
- */
-static void reset_fpf_position(VP8_COMP *cpi, FIRSTPASS_STATS *Position)
-{
- cpi->twopass.stats_in = Position;
-}
-
-static int lookup_next_frame_stats(VP8_COMP *cpi, FIRSTPASS_STATS *next_frame)
-{
- if (cpi->twopass.stats_in >= cpi->twopass.stats_in_end)
- return EOF;
-
- *next_frame = *cpi->twopass.stats_in;
- return 1;
-}
-
-/* Read frame stats at an offset from the current position */
-static int read_frame_stats( VP8_COMP *cpi,
- FIRSTPASS_STATS *frame_stats,
- int offset )
-{
- FIRSTPASS_STATS * fps_ptr = cpi->twopass.stats_in;
-
- /* Check legality of offset */
- if ( offset >= 0 )
- {
- if ( &fps_ptr[offset] >= cpi->twopass.stats_in_end )
- return EOF;
- }
- else if ( offset < 0 )
- {
- if ( &fps_ptr[offset] < cpi->twopass.stats_in_start )
- return EOF;
- }
-
- *frame_stats = fps_ptr[offset];
- return 1;
-}
-
-static int input_stats(VP8_COMP *cpi, FIRSTPASS_STATS *fps)
-{
- if (cpi->twopass.stats_in >= cpi->twopass.stats_in_end)
- return EOF;
-
- *fps = *cpi->twopass.stats_in;
- cpi->twopass.stats_in =
- (void*)((char *)cpi->twopass.stats_in + sizeof(FIRSTPASS_STATS));
- return 1;
-}
-
-static void output_stats(const VP8_COMP *cpi,
- struct vpx_codec_pkt_list *pktlist,
- FIRSTPASS_STATS *stats)
-{
- struct vpx_codec_cx_pkt pkt;
- pkt.kind = VPX_CODEC_STATS_PKT;
- pkt.data.twopass_stats.buf = stats;
- pkt.data.twopass_stats.sz = sizeof(FIRSTPASS_STATS);
- vpx_codec_pkt_list_add(pktlist, &pkt);
- (void)cpi;
-/* TEMP debug code */
-#if OUTPUT_FPF
-
- {
- FILE *fpfile;
- fpfile = fopen("firstpass.stt", "a");
-
- fprintf(fpfile, "%12.0f %12.0f %12.0f %12.4f %12.4f %12.4f %12.4f"
- " %12.4f %12.4f %12.4f %12.4f %12.4f %12.4f %12.4f %12.4f"
- " %12.0f %12.0f %12.4f\n",
- stats->frame,
- stats->intra_error,
- stats->coded_error,
- stats->ssim_weighted_pred_err,
- stats->pcnt_inter,
- stats->pcnt_motion,
- stats->pcnt_second_ref,
- stats->pcnt_neutral,
- stats->MVr,
- stats->mvr_abs,
- stats->MVc,
- stats->mvc_abs,
- stats->MVrv,
- stats->MVcv,
- stats->mv_in_out_count,
- stats->new_mv_count,
- stats->count,
- stats->duration);
- fclose(fpfile);
- }
-#endif
-}
-
-static void zero_stats(FIRSTPASS_STATS *section)
-{
- section->frame = 0.0;
- section->intra_error = 0.0;
- section->coded_error = 0.0;
- section->ssim_weighted_pred_err = 0.0;
- section->pcnt_inter = 0.0;
- section->pcnt_motion = 0.0;
- section->pcnt_second_ref = 0.0;
- section->pcnt_neutral = 0.0;
- section->MVr = 0.0;
- section->mvr_abs = 0.0;
- section->MVc = 0.0;
- section->mvc_abs = 0.0;
- section->MVrv = 0.0;
- section->MVcv = 0.0;
- section->mv_in_out_count = 0.0;
- section->new_mv_count = 0.0;
- section->count = 0.0;
- section->duration = 1.0;
-}
-
-static void accumulate_stats(FIRSTPASS_STATS *section, FIRSTPASS_STATS *frame)
-{
- section->frame += frame->frame;
- section->intra_error += frame->intra_error;
- section->coded_error += frame->coded_error;
- section->ssim_weighted_pred_err += frame->ssim_weighted_pred_err;
- section->pcnt_inter += frame->pcnt_inter;
- section->pcnt_motion += frame->pcnt_motion;
- section->pcnt_second_ref += frame->pcnt_second_ref;
- section->pcnt_neutral += frame->pcnt_neutral;
- section->MVr += frame->MVr;
- section->mvr_abs += frame->mvr_abs;
- section->MVc += frame->MVc;
- section->mvc_abs += frame->mvc_abs;
- section->MVrv += frame->MVrv;
- section->MVcv += frame->MVcv;
- section->mv_in_out_count += frame->mv_in_out_count;
- section->new_mv_count += frame->new_mv_count;
- section->count += frame->count;
- section->duration += frame->duration;
-}
-
-static void subtract_stats(FIRSTPASS_STATS *section, FIRSTPASS_STATS *frame)
-{
- section->frame -= frame->frame;
- section->intra_error -= frame->intra_error;
- section->coded_error -= frame->coded_error;
- section->ssim_weighted_pred_err -= frame->ssim_weighted_pred_err;
- section->pcnt_inter -= frame->pcnt_inter;
- section->pcnt_motion -= frame->pcnt_motion;
- section->pcnt_second_ref -= frame->pcnt_second_ref;
- section->pcnt_neutral -= frame->pcnt_neutral;
- section->MVr -= frame->MVr;
- section->mvr_abs -= frame->mvr_abs;
- section->MVc -= frame->MVc;
- section->mvc_abs -= frame->mvc_abs;
- section->MVrv -= frame->MVrv;
- section->MVcv -= frame->MVcv;
- section->mv_in_out_count -= frame->mv_in_out_count;
- section->new_mv_count -= frame->new_mv_count;
- section->count -= frame->count;
- section->duration -= frame->duration;
-}
-
-static void avg_stats(FIRSTPASS_STATS *section)
-{
- if (section->count < 1.0)
- return;
-
- section->intra_error /= section->count;
- section->coded_error /= section->count;
- section->ssim_weighted_pred_err /= section->count;
- section->pcnt_inter /= section->count;
- section->pcnt_second_ref /= section->count;
- section->pcnt_neutral /= section->count;
- section->pcnt_motion /= section->count;
- section->MVr /= section->count;
- section->mvr_abs /= section->count;
- section->MVc /= section->count;
- section->mvc_abs /= section->count;
- section->MVrv /= section->count;
- section->MVcv /= section->count;
- section->mv_in_out_count /= section->count;
- section->duration /= section->count;
-}
-
-/* Calculate a modified Error used in distributing bits between easier
- * and harder frames
- */
-static double calculate_modified_err(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
-{
- double av_err = ( cpi->twopass.total_stats.ssim_weighted_pred_err /
- cpi->twopass.total_stats.count );
- double this_err = this_frame->ssim_weighted_pred_err;
- double modified_err;
- (void)cpi;
- if (this_err > av_err)
- modified_err = av_err * pow((this_err / DOUBLE_DIVIDE_CHECK(av_err)), POW1);
- else
- modified_err = av_err * pow((this_err / DOUBLE_DIVIDE_CHECK(av_err)), POW2);
-
- return modified_err;
-}
-
-static const double weight_table[256] = {
-0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
-0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
-0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
-0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
-0.020000, 0.031250, 0.062500, 0.093750, 0.125000, 0.156250, 0.187500, 0.218750,
-0.250000, 0.281250, 0.312500, 0.343750, 0.375000, 0.406250, 0.437500, 0.468750,
-0.500000, 0.531250, 0.562500, 0.593750, 0.625000, 0.656250, 0.687500, 0.718750,
-0.750000, 0.781250, 0.812500, 0.843750, 0.875000, 0.906250, 0.937500, 0.968750,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
-1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000
-};
-
-static double simple_weight(YV12_BUFFER_CONFIG *source)
-{
- int i, j;
-
- unsigned char *src = source->y_buffer;
- double sum_weights = 0.0;
-
- /* Loop throught the Y plane raw examining levels and creating a weight
- * for the image
- */
- i = source->y_height;
- do
- {
- j = source->y_width;
- do
- {
- sum_weights += weight_table[ *src];
- src++;
- }while(--j);
- src -= source->y_width;
- src += source->y_stride;
- }while(--i);
-
- sum_weights /= (source->y_height * source->y_width);
-
- return sum_weights;
-}
-
-
-/* This function returns the current per frame maximum bitrate target */
-static int frame_max_bits(VP8_COMP *cpi)
-{
- /* Max allocation for a single frame based on the max section guidelines
- * passed in and how many bits are left
- */
- int max_bits;
-
- /* For CBR we need to also consider buffer fullness.
- * If we are running below the optimal level then we need to gradually
- * tighten up on max_bits.
- */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- double buffer_fullness_ratio = (double)cpi->buffer_level / DOUBLE_DIVIDE_CHECK((double)cpi->oxcf.optimal_buffer_level);
-
- /* For CBR base this on the target average bits per frame plus the
- * maximum sedction rate passed in by the user
- */
- max_bits = (int)(cpi->av_per_frame_bandwidth * ((double)cpi->oxcf.two_pass_vbrmax_section / 100.0));
-
- /* If our buffer is below the optimum level */
- if (buffer_fullness_ratio < 1.0)
- {
- /* The lower of max_bits / 4 or cpi->av_per_frame_bandwidth / 4. */
- int min_max_bits = ((cpi->av_per_frame_bandwidth >> 2) < (max_bits >> 2)) ? cpi->av_per_frame_bandwidth >> 2 : max_bits >> 2;
-
- max_bits = (int)(max_bits * buffer_fullness_ratio);
-
- /* Lowest value we will set ... which should allow the buffer to
- * refill.
- */
- if (max_bits < min_max_bits)
- max_bits = min_max_bits;
- }
- }
- /* VBR */
- else
- {
- /* For VBR base this on the bits and frames left plus the
- * two_pass_vbrmax_section rate passed in by the user
- */
- max_bits = (int)(((double)cpi->twopass.bits_left / (cpi->twopass.total_stats.count - (double)cpi->common.current_video_frame)) * ((double)cpi->oxcf.two_pass_vbrmax_section / 100.0));
- }
-
- /* Trap case where we are out of bits */
- if (max_bits < 0)
- max_bits = 0;
-
- return max_bits;
-}
-
-void vp8_init_first_pass(VP8_COMP *cpi)
-{
- zero_stats(&cpi->twopass.total_stats);
-}
-
-void vp8_end_first_pass(VP8_COMP *cpi)
-{
- output_stats(cpi, cpi->output_pkt_list, &cpi->twopass.total_stats);
-}
-
-static void zz_motion_search( VP8_COMP *cpi, MACROBLOCK * x,
- YV12_BUFFER_CONFIG * raw_buffer,
- int * raw_motion_err,
- YV12_BUFFER_CONFIG * recon_buffer,
- int * best_motion_err, int recon_yoffset)
-{
- MACROBLOCKD * const xd = & x->e_mbd;
- BLOCK *b = &x->block[0];
- BLOCKD *d = &x->e_mbd.block[0];
- unsigned char *src_ptr = (*(b->base_src) + b->src);
- int src_stride = b->src_stride;
- unsigned char *raw_ptr;
- int raw_stride = raw_buffer->y_stride;
- unsigned char *ref_ptr;
- int ref_stride = x->e_mbd.pre.y_stride;
-
- (void)cpi;
- /* Set up pointers for this macro block raw buffer */
- raw_ptr = (unsigned char *)(raw_buffer->y_buffer + recon_yoffset
- + d->offset);
- vp8_mse16x16 ( src_ptr, src_stride, raw_ptr, raw_stride,
- (unsigned int *)(raw_motion_err));
-
- /* Set up pointers for this macro block recon buffer */
- xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;
- ref_ptr = (unsigned char *)(xd->pre.y_buffer + d->offset );
- vp8_mse16x16 ( src_ptr, src_stride, ref_ptr, ref_stride,
- (unsigned int *)(best_motion_err));
-}
-
-static void first_pass_motion_search(VP8_COMP *cpi, MACROBLOCK *x,
- int_mv *ref_mv, MV *best_mv,
- YV12_BUFFER_CONFIG *recon_buffer,
- int *best_motion_err, int recon_yoffset )
-{
- MACROBLOCKD *const xd = & x->e_mbd;
- BLOCK *b = &x->block[0];
- BLOCKD *d = &x->e_mbd.block[0];
- int num00;
-
- int_mv tmp_mv;
- int_mv ref_mv_full;
-
- int tmp_err;
- int step_param = 3; /* Dont search over full range for first pass */
- int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
- int n;
- vp8_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
- int new_mv_mode_penalty = 256;
-
- /* override the default variance function to use MSE */
- v_fn_ptr.vf = vp8_mse16x16;
-
- /* Set up pointers for this macro block recon buffer */
- xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;
-
- /* Initial step/diamond search centred on best mv */
- tmp_mv.as_int = 0;
- ref_mv_full.as_mv.col = ref_mv->as_mv.col>>3;
- ref_mv_full.as_mv.row = ref_mv->as_mv.row>>3;
- tmp_err = cpi->diamond_search_sad(x, b, d, &ref_mv_full, &tmp_mv, step_param,
- x->sadperbit16, &num00, &v_fn_ptr,
- x->mvcost, ref_mv);
- if ( tmp_err < INT_MAX-new_mv_mode_penalty )
- tmp_err += new_mv_mode_penalty;
-
- if (tmp_err < *best_motion_err)
- {
- *best_motion_err = tmp_err;
- best_mv->row = tmp_mv.as_mv.row;
- best_mv->col = tmp_mv.as_mv.col;
- }
-
- /* Further step/diamond searches as necessary */
- n = num00;
- num00 = 0;
-
- while (n < further_steps)
- {
- n++;
-
- if (num00)
- num00--;
- else
- {
- tmp_err = cpi->diamond_search_sad(x, b, d, &ref_mv_full, &tmp_mv,
- step_param + n, x->sadperbit16,
- &num00, &v_fn_ptr, x->mvcost,
- ref_mv);
- if ( tmp_err < INT_MAX-new_mv_mode_penalty )
- tmp_err += new_mv_mode_penalty;
-
- if (tmp_err < *best_motion_err)
- {
- *best_motion_err = tmp_err;
- best_mv->row = tmp_mv.as_mv.row;
- best_mv->col = tmp_mv.as_mv.col;
- }
- }
- }
-}
-
-void vp8_first_pass(VP8_COMP *cpi)
-{
- int mb_row, mb_col;
- MACROBLOCK *const x = & cpi->mb;
- VP8_COMMON *const cm = & cpi->common;
- MACROBLOCKD *const xd = & x->e_mbd;
-
- int recon_yoffset, recon_uvoffset;
- YV12_BUFFER_CONFIG *lst_yv12 = &cm->yv12_fb[cm->lst_fb_idx];
- YV12_BUFFER_CONFIG *new_yv12 = &cm->yv12_fb[cm->new_fb_idx];
- YV12_BUFFER_CONFIG *gld_yv12 = &cm->yv12_fb[cm->gld_fb_idx];
- int recon_y_stride = lst_yv12->y_stride;
- int recon_uv_stride = lst_yv12->uv_stride;
- int64_t intra_error = 0;
- int64_t coded_error = 0;
-
- int sum_mvr = 0, sum_mvc = 0;
- int sum_mvr_abs = 0, sum_mvc_abs = 0;
- int sum_mvrs = 0, sum_mvcs = 0;
- int mvcount = 0;
- int intercount = 0;
- int second_ref_count = 0;
- int intrapenalty = 256;
- int neutral_count = 0;
- int new_mv_count = 0;
- int sum_in_vectors = 0;
- uint32_t lastmv_as_int = 0;
-
- int_mv zero_ref_mv;
-
- zero_ref_mv.as_int = 0;
-
- vp8_clear_system_state();
-
- x->src = * cpi->Source;
- xd->pre = *lst_yv12;
- xd->dst = *new_yv12;
-
- x->partition_info = x->pi;
-
- xd->mode_info_context = cm->mi;
-
- if(!cm->use_bilinear_mc_filter)
- {
- xd->subpixel_predict = vp8_sixtap_predict4x4;
- xd->subpixel_predict8x4 = vp8_sixtap_predict8x4;
- xd->subpixel_predict8x8 = vp8_sixtap_predict8x8;
- xd->subpixel_predict16x16 = vp8_sixtap_predict16x16;
- }
- else
- {
- xd->subpixel_predict = vp8_bilinear_predict4x4;
- xd->subpixel_predict8x4 = vp8_bilinear_predict8x4;
- xd->subpixel_predict8x8 = vp8_bilinear_predict8x8;
- xd->subpixel_predict16x16 = vp8_bilinear_predict16x16;
- }
-
- vp8_build_block_offsets(x);
-
- /* set up frame new frame for intra coded blocks */
- vp8_setup_intra_recon(new_yv12);
- vp8cx_frame_init_quantizer(cpi);
-
- /* Initialise the MV cost table to the defaults */
- {
- int flag[2] = {1, 1};
- vp8_initialize_rd_consts(cpi, x, vp8_dc_quant(cm->base_qindex, cm->y1dc_delta_q));
- vpx_memcpy(cm->fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context));
- vp8_build_component_cost_table(cpi->mb.mvcost, (const MV_CONTEXT *) cm->fc.mvc, flag);
- }
-
- /* for each macroblock row in image */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
- {
- int_mv best_ref_mv;
-
- best_ref_mv.as_int = 0;
-
- /* reset above block coeffs */
- xd->up_available = (mb_row != 0);
- recon_yoffset = (mb_row * recon_y_stride * 16);
- recon_uvoffset = (mb_row * recon_uv_stride * 8);
-
- /* Set up limit values for motion vectors to prevent them extending
- * outside the UMV borders
- */
- x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + (VP8BORDERINPIXELS - 16);
-
-
- /* for each macroblock col in image */
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
- int this_error;
- int gf_motion_error = INT_MAX;
- int use_dc_pred = (mb_col || mb_row) && (!mb_col || !mb_row);
-
- xd->dst.y_buffer = new_yv12->y_buffer + recon_yoffset;
- xd->dst.u_buffer = new_yv12->u_buffer + recon_uvoffset;
- xd->dst.v_buffer = new_yv12->v_buffer + recon_uvoffset;
- xd->left_available = (mb_col != 0);
-
- /* Copy current mb to a buffer */
- vp8_copy_mem16x16(x->src.y_buffer, x->src.y_stride, x->thismb, 16);
-
- /* do intra 16x16 prediction */
- this_error = vp8_encode_intra(cpi, x, use_dc_pred);
-
- /* "intrapenalty" below deals with situations where the intra
- * and inter error scores are very low (eg a plain black frame)
- * We do not have special cases in first pass for 0,0 and
- * nearest etc so all inter modes carry an overhead cost
- * estimate fot the mv. When the error score is very low this
- * causes us to pick all or lots of INTRA modes and throw lots
- * of key frames. This penalty adds a cost matching that of a
- * 0,0 mv to the intra case.
- */
- this_error += intrapenalty;
-
- /* Cumulative intra error total */
- intra_error += (int64_t)this_error;
-
- /* Set up limit values for motion vectors to prevent them
- * extending outside the UMV borders
- */
- x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
- x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + (VP8BORDERINPIXELS - 16);
-
- /* Other than for the first frame do a motion search */
- if (cm->current_video_frame > 0)
- {
- BLOCKD *d = &x->e_mbd.block[0];
- MV tmp_mv = {0, 0};
- int tmp_err;
- int motion_error = INT_MAX;
- int raw_motion_error = INT_MAX;
-
- /* Simple 0,0 motion with no mv overhead */
- zz_motion_search( cpi, x, cpi->last_frame_unscaled_source,
- &raw_motion_error, lst_yv12, &motion_error,
- recon_yoffset );
- d->bmi.mv.as_mv.row = 0;
- d->bmi.mv.as_mv.col = 0;
-
- if (raw_motion_error < cpi->oxcf.encode_breakout)
- goto skip_motion_search;
-
- /* Test last reference frame using the previous best mv as the
- * starting point (best reference) for the search
- */
- first_pass_motion_search(cpi, x, &best_ref_mv,
- &d->bmi.mv.as_mv, lst_yv12,
- &motion_error, recon_yoffset);
-
- /* If the current best reference mv is not centred on 0,0
- * then do a 0,0 based search as well
- */
- if (best_ref_mv.as_int)
- {
- tmp_err = INT_MAX;
- first_pass_motion_search(cpi, x, &zero_ref_mv, &tmp_mv,
- lst_yv12, &tmp_err, recon_yoffset);
-
- if ( tmp_err < motion_error )
- {
- motion_error = tmp_err;
- d->bmi.mv.as_mv.row = tmp_mv.row;
- d->bmi.mv.as_mv.col = tmp_mv.col;
- }
- }
-
- /* Experimental search in a second reference frame ((0,0)
- * based only)
- */
- if (cm->current_video_frame > 1)
- {
- first_pass_motion_search(cpi, x, &zero_ref_mv, &tmp_mv, gld_yv12, &gf_motion_error, recon_yoffset);
-
- if ((gf_motion_error < motion_error) && (gf_motion_error < this_error))
- {
- second_ref_count++;
- }
-
- /* Reset to last frame as reference buffer */
- xd->pre.y_buffer = lst_yv12->y_buffer + recon_yoffset;
- xd->pre.u_buffer = lst_yv12->u_buffer + recon_uvoffset;
- xd->pre.v_buffer = lst_yv12->v_buffer + recon_uvoffset;
- }
-
-skip_motion_search:
- /* Intra assumed best */
- best_ref_mv.as_int = 0;
-
- if (motion_error <= this_error)
- {
- /* Keep a count of cases where the inter and intra were
- * very close and very low. This helps with scene cut
- * detection for example in cropped clips with black bars
- * at the sides or top and bottom.
- */
- if( (((this_error-intrapenalty) * 9) <=
- (motion_error*10)) &&
- (this_error < (2*intrapenalty)) )
- {
- neutral_count++;
- }
-
- d->bmi.mv.as_mv.row *= 8;
- d->bmi.mv.as_mv.col *= 8;
- this_error = motion_error;
- vp8_set_mbmode_and_mvs(x, NEWMV, &d->bmi.mv);
- vp8_encode_inter16x16y(x);
- sum_mvr += d->bmi.mv.as_mv.row;
- sum_mvr_abs += abs(d->bmi.mv.as_mv.row);
- sum_mvc += d->bmi.mv.as_mv.col;
- sum_mvc_abs += abs(d->bmi.mv.as_mv.col);
- sum_mvrs += d->bmi.mv.as_mv.row * d->bmi.mv.as_mv.row;
- sum_mvcs += d->bmi.mv.as_mv.col * d->bmi.mv.as_mv.col;
- intercount++;
-
- best_ref_mv.as_int = d->bmi.mv.as_int;
-
- /* Was the vector non-zero */
- if (d->bmi.mv.as_int)
- {
- mvcount++;
-
- /* Was it different from the last non zero vector */
- if ( d->bmi.mv.as_int != lastmv_as_int )
- new_mv_count++;
- lastmv_as_int = d->bmi.mv.as_int;
-
- /* Does the Row vector point inwards or outwards */
- if (mb_row < cm->mb_rows / 2)
- {
- if (d->bmi.mv.as_mv.row > 0)
- sum_in_vectors--;
- else if (d->bmi.mv.as_mv.row < 0)
- sum_in_vectors++;
- }
- else if (mb_row > cm->mb_rows / 2)
- {
- if (d->bmi.mv.as_mv.row > 0)
- sum_in_vectors++;
- else if (d->bmi.mv.as_mv.row < 0)
- sum_in_vectors--;
- }
-
- /* Does the Row vector point inwards or outwards */
- if (mb_col < cm->mb_cols / 2)
- {
- if (d->bmi.mv.as_mv.col > 0)
- sum_in_vectors--;
- else if (d->bmi.mv.as_mv.col < 0)
- sum_in_vectors++;
- }
- else if (mb_col > cm->mb_cols / 2)
- {
- if (d->bmi.mv.as_mv.col > 0)
- sum_in_vectors++;
- else if (d->bmi.mv.as_mv.col < 0)
- sum_in_vectors--;
- }
- }
- }
- }
-
- coded_error += (int64_t)this_error;
-
- /* adjust to the next column of macroblocks */
- x->src.y_buffer += 16;
- x->src.u_buffer += 8;
- x->src.v_buffer += 8;
-
- recon_yoffset += 16;
- recon_uvoffset += 8;
- }
-
- /* adjust to the next row of mbs */
- x->src.y_buffer += 16 * x->src.y_stride - 16 * cm->mb_cols;
- x->src.u_buffer += 8 * x->src.uv_stride - 8 * cm->mb_cols;
- x->src.v_buffer += 8 * x->src.uv_stride - 8 * cm->mb_cols;
-
- /* extend the recon for intra prediction */
- vp8_extend_mb_row(new_yv12, xd->dst.y_buffer + 16, xd->dst.u_buffer + 8, xd->dst.v_buffer + 8);
- vp8_clear_system_state();
- }
-
- vp8_clear_system_state();
- {
- double weight = 0.0;
-
- FIRSTPASS_STATS fps;
-
- fps.frame = cm->current_video_frame ;
- fps.intra_error = (double)(intra_error >> 8);
- fps.coded_error = (double)(coded_error >> 8);
- weight = simple_weight(cpi->Source);
-
-
- if (weight < 0.1)
- weight = 0.1;
-
- fps.ssim_weighted_pred_err = fps.coded_error * weight;
-
- fps.pcnt_inter = 0.0;
- fps.pcnt_motion = 0.0;
- fps.MVr = 0.0;
- fps.mvr_abs = 0.0;
- fps.MVc = 0.0;
- fps.mvc_abs = 0.0;
- fps.MVrv = 0.0;
- fps.MVcv = 0.0;
- fps.mv_in_out_count = 0.0;
- fps.new_mv_count = 0.0;
- fps.count = 1.0;
-
- fps.pcnt_inter = 1.0 * (double)intercount / cm->MBs;
- fps.pcnt_second_ref = 1.0 * (double)second_ref_count / cm->MBs;
- fps.pcnt_neutral = 1.0 * (double)neutral_count / cm->MBs;
-
- if (mvcount > 0)
- {
- fps.MVr = (double)sum_mvr / (double)mvcount;
- fps.mvr_abs = (double)sum_mvr_abs / (double)mvcount;
- fps.MVc = (double)sum_mvc / (double)mvcount;
- fps.mvc_abs = (double)sum_mvc_abs / (double)mvcount;
- fps.MVrv = ((double)sum_mvrs - (fps.MVr * fps.MVr / (double)mvcount)) / (double)mvcount;
- fps.MVcv = ((double)sum_mvcs - (fps.MVc * fps.MVc / (double)mvcount)) / (double)mvcount;
- fps.mv_in_out_count = (double)sum_in_vectors / (double)(mvcount * 2);
- fps.new_mv_count = new_mv_count;
-
- fps.pcnt_motion = 1.0 * (double)mvcount / cpi->common.MBs;
- }
-
- /* TODO: handle the case when duration is set to 0, or something less
- * than the full time between subsequent cpi->source_time_stamps
- */
- fps.duration = (double)(cpi->source->ts_end
- - cpi->source->ts_start);
-
- /* don't want to do output stats with a stack variable! */
- memcpy(&cpi->twopass.this_frame_stats,
- &fps,
- sizeof(FIRSTPASS_STATS));
- output_stats(cpi, cpi->output_pkt_list, &cpi->twopass.this_frame_stats);
- accumulate_stats(&cpi->twopass.total_stats, &fps);
- }
-
- /* Copy the previous Last Frame into the GF buffer if specific
- * conditions for doing so are met
- */
- if ((cm->current_video_frame > 0) &&
- (cpi->twopass.this_frame_stats.pcnt_inter > 0.20) &&
- ((cpi->twopass.this_frame_stats.intra_error /
- DOUBLE_DIVIDE_CHECK(cpi->twopass.this_frame_stats.coded_error)) >
- 2.0))
- {
- vp8_yv12_copy_frame(lst_yv12, gld_yv12);
- }
-
- /* swap frame pointers so last frame refers to the frame we just
- * compressed
- */
- vp8_swap_yv12_buffer(lst_yv12, new_yv12);
- vp8_yv12_extend_frame_borders(lst_yv12);
-
- /* Special case for the first frame. Copy into the GF buffer as a
- * second reference.
- */
- if (cm->current_video_frame == 0)
- {
- vp8_yv12_copy_frame(lst_yv12, gld_yv12);
- }
-
-
- /* use this to see what the first pass reconstruction looks like */
- if (0)
- {
- char filename[512];
- FILE *recon_file;
- sprintf(filename, "enc%04d.yuv", (int) cm->current_video_frame);
-
- if (cm->current_video_frame == 0)
- recon_file = fopen(filename, "wb");
- else
- recon_file = fopen(filename, "ab");
-
- (void) fwrite(lst_yv12->buffer_alloc, lst_yv12->frame_size, 1,
- recon_file);
- fclose(recon_file);
- }
-
- cm->current_video_frame++;
-
-}
-extern const int vp8_bits_per_mb[2][QINDEX_RANGE];
-
-/* Estimate a cost per mb attributable to overheads such as the coding of
- * modes and motion vectors.
- * Currently simplistic in its assumptions for testing.
- */
-
-static double bitcost( double prob )
-{
- if (prob > 0.000122)
- return -log(prob) / log(2.0);
- else
- return 13.0;
-}
-static int64_t estimate_modemvcost(VP8_COMP *cpi,
- FIRSTPASS_STATS * fpstats)
-{
- int mv_cost;
- int64_t mode_cost;
-
- double av_pct_inter = fpstats->pcnt_inter / fpstats->count;
- double av_pct_motion = fpstats->pcnt_motion / fpstats->count;
- double av_intra = (1.0 - av_pct_inter);
-
- double zz_cost;
- double motion_cost;
- double intra_cost;
-
- zz_cost = bitcost(av_pct_inter - av_pct_motion);
- motion_cost = bitcost(av_pct_motion);
- intra_cost = bitcost(av_intra);
-
- /* Estimate of extra bits per mv overhead for mbs
- * << 9 is the normalization to the (bits * 512) used in vp8_bits_per_mb
- */
- mv_cost = ((int)(fpstats->new_mv_count / fpstats->count) * 8) << 9;
-
- /* Crude estimate of overhead cost from modes
- * << 9 is the normalization to (bits * 512) used in vp8_bits_per_mb
- */
- mode_cost = (int64_t)((((av_pct_inter - av_pct_motion) * zz_cost) +
- (av_pct_motion * motion_cost) +
- (av_intra * intra_cost)) * cpi->common.MBs) * 512;
-
- return mv_cost + mode_cost;
-}
-
-static double calc_correction_factor( double err_per_mb,
- double err_devisor,
- double pt_low,
- double pt_high,
- int Q )
-{
- double power_term;
- double error_term = err_per_mb / err_devisor;
- double correction_factor;
-
- /* Adjustment based on Q to power term. */
- power_term = pt_low + (Q * 0.01);
- power_term = (power_term > pt_high) ? pt_high : power_term;
-
- /* Adjustments to error term */
- /* TBD */
-
- /* Calculate correction factor */
- correction_factor = pow(error_term, power_term);
-
- /* Clip range */
- correction_factor =
- (correction_factor < 0.05)
- ? 0.05 : (correction_factor > 5.0) ? 5.0 : correction_factor;
-
- return correction_factor;
-}
-
-static int estimate_max_q(VP8_COMP *cpi,
- FIRSTPASS_STATS * fpstats,
- int section_target_bandwitdh,
- int overhead_bits )
-{
- int Q;
- int num_mbs = cpi->common.MBs;
- int target_norm_bits_per_mb;
-
- double section_err = (fpstats->coded_error / fpstats->count);
- double err_per_mb = section_err / num_mbs;
- double err_correction_factor;
- double speed_correction = 1.0;
- int overhead_bits_per_mb;
-
- if (section_target_bandwitdh <= 0)
- return cpi->twopass.maxq_max_limit; /* Highest value allowed */
-
- target_norm_bits_per_mb =
- (section_target_bandwitdh < (1 << 20))
- ? (512 * section_target_bandwitdh) / num_mbs
- : 512 * (section_target_bandwitdh / num_mbs);
-
- /* Calculate a corrective factor based on a rolling ratio of bits spent
- * vs target bits
- */
- if ((cpi->rolling_target_bits > 0) &&
- (cpi->active_worst_quality < cpi->worst_quality))
- {
- double rolling_ratio;
-
- rolling_ratio = (double)cpi->rolling_actual_bits /
- (double)cpi->rolling_target_bits;
-
- if (rolling_ratio < 0.95)
- cpi->twopass.est_max_qcorrection_factor -= 0.005;
- else if (rolling_ratio > 1.05)
- cpi->twopass.est_max_qcorrection_factor += 0.005;
-
- cpi->twopass.est_max_qcorrection_factor =
- (cpi->twopass.est_max_qcorrection_factor < 0.1)
- ? 0.1
- : (cpi->twopass.est_max_qcorrection_factor > 10.0)
- ? 10.0 : cpi->twopass.est_max_qcorrection_factor;
- }
-
- /* Corrections for higher compression speed settings
- * (reduced compression expected)
- */
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
- {
- if (cpi->oxcf.cpu_used <= 5)
- speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
- else
- speed_correction = 1.25;
- }
-
- /* Estimate of overhead bits per mb */
- /* Correction to overhead bits for min allowed Q. */
- overhead_bits_per_mb = overhead_bits / num_mbs;
- overhead_bits_per_mb = (int)(overhead_bits_per_mb *
- pow( 0.98, (double)cpi->twopass.maxq_min_limit ));
-
- /* Try and pick a max Q that will be high enough to encode the
- * content at the given rate.
- */
- for (Q = cpi->twopass.maxq_min_limit; Q < cpi->twopass.maxq_max_limit; Q++)
- {
- int bits_per_mb_at_this_q;
-
- /* Error per MB based correction factor */
- err_correction_factor =
- calc_correction_factor(err_per_mb, 150.0, 0.40, 0.90, Q);
-
- bits_per_mb_at_this_q =
- vp8_bits_per_mb[INTER_FRAME][Q] + overhead_bits_per_mb;
-
- bits_per_mb_at_this_q = (int)(.5 + err_correction_factor
- * speed_correction * cpi->twopass.est_max_qcorrection_factor
- * cpi->twopass.section_max_qfactor
- * (double)bits_per_mb_at_this_q);
-
- /* Mode and motion overhead */
- /* As Q rises in real encode loop rd code will force overhead down
- * We make a crude adjustment for this here as *.98 per Q step.
- */
- overhead_bits_per_mb = (int)((double)overhead_bits_per_mb * 0.98);
-
- if (bits_per_mb_at_this_q <= target_norm_bits_per_mb)
- break;
- }
-
- /* Restriction on active max q for constrained quality mode. */
- if ( (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (Q < cpi->cq_target_quality) )
- {
- Q = cpi->cq_target_quality;
- }
-
- /* Adjust maxq_min_limit and maxq_max_limit limits based on
- * average q observed in clip for non kf/gf.arf frames
- * Give average a chance to settle though.
- */
- if ( (cpi->ni_frames >
- ((int)cpi->twopass.total_stats.count >> 8)) &&
- (cpi->ni_frames > 150) )
- {
- cpi->twopass.maxq_max_limit = ((cpi->ni_av_qi + 32) < cpi->worst_quality)
- ? (cpi->ni_av_qi + 32) : cpi->worst_quality;
- cpi->twopass.maxq_min_limit = ((cpi->ni_av_qi - 32) > cpi->best_quality)
- ? (cpi->ni_av_qi - 32) : cpi->best_quality;
- }
-
- return Q;
-}
-
-/* For cq mode estimate a cq level that matches the observed
- * complexity and data rate.
- */
-static int estimate_cq( VP8_COMP *cpi,
- FIRSTPASS_STATS * fpstats,
- int section_target_bandwitdh,
- int overhead_bits )
-{
- int Q;
- int num_mbs = cpi->common.MBs;
- int target_norm_bits_per_mb;
-
- double section_err = (fpstats->coded_error / fpstats->count);
- double err_per_mb = section_err / num_mbs;
- double err_correction_factor;
- double speed_correction = 1.0;
- double clip_iiratio;
- double clip_iifactor;
- int overhead_bits_per_mb;
-
- if (0)
- {
- FILE *f = fopen("epmp.stt", "a");
- fprintf(f, "%10.2f\n", err_per_mb );
- fclose(f);
- }
-
- target_norm_bits_per_mb = (section_target_bandwitdh < (1 << 20))
- ? (512 * section_target_bandwitdh) / num_mbs
- : 512 * (section_target_bandwitdh / num_mbs);
-
- /* Estimate of overhead bits per mb */
- overhead_bits_per_mb = overhead_bits / num_mbs;
-
- /* Corrections for higher compression speed settings
- * (reduced compression expected)
- */
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
- {
- if (cpi->oxcf.cpu_used <= 5)
- speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
- else
- speed_correction = 1.25;
- }
-
- /* II ratio correction factor for clip as a whole */
- clip_iiratio = cpi->twopass.total_stats.intra_error /
- DOUBLE_DIVIDE_CHECK(cpi->twopass.total_stats.coded_error);
- clip_iifactor = 1.0 - ((clip_iiratio - 10.0) * 0.025);
- if (clip_iifactor < 0.80)
- clip_iifactor = 0.80;
-
- /* Try and pick a Q that can encode the content at the given rate. */
- for (Q = 0; Q < MAXQ; Q++)
- {
- int bits_per_mb_at_this_q;
-
- /* Error per MB based correction factor */
- err_correction_factor =
- calc_correction_factor(err_per_mb, 100.0, 0.40, 0.90, Q);
-
- bits_per_mb_at_this_q =
- vp8_bits_per_mb[INTER_FRAME][Q] + overhead_bits_per_mb;
-
- bits_per_mb_at_this_q =
- (int)( .5 + err_correction_factor *
- speed_correction *
- clip_iifactor *
- (double)bits_per_mb_at_this_q);
-
- /* Mode and motion overhead */
- /* As Q rises in real encode loop rd code will force overhead down
- * We make a crude adjustment for this here as *.98 per Q step.
- */
- overhead_bits_per_mb = (int)((double)overhead_bits_per_mb * 0.98);
-
- if (bits_per_mb_at_this_q <= target_norm_bits_per_mb)
- break;
- }
-
- /* Clip value to range "best allowed to (worst allowed - 1)" */
- Q = cq_level[Q];
- if ( Q >= cpi->worst_quality )
- Q = cpi->worst_quality - 1;
- if ( Q < cpi->best_quality )
- Q = cpi->best_quality;
-
- return Q;
-}
-
-static int estimate_q(VP8_COMP *cpi, double section_err, int section_target_bandwitdh)
-{
- int Q;
- int num_mbs = cpi->common.MBs;
- int target_norm_bits_per_mb;
-
- double err_per_mb = section_err / num_mbs;
- double err_correction_factor;
- double speed_correction = 1.0;
-
- target_norm_bits_per_mb = (section_target_bandwitdh < (1 << 20)) ? (512 * section_target_bandwitdh) / num_mbs : 512 * (section_target_bandwitdh / num_mbs);
-
- /* Corrections for higher compression speed settings
- * (reduced compression expected)
- */
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
- {
- if (cpi->oxcf.cpu_used <= 5)
- speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
- else
- speed_correction = 1.25;
- }
-
- /* Try and pick a Q that can encode the content at the given rate. */
- for (Q = 0; Q < MAXQ; Q++)
- {
- int bits_per_mb_at_this_q;
-
- /* Error per MB based correction factor */
- err_correction_factor =
- calc_correction_factor(err_per_mb, 150.0, 0.40, 0.90, Q);
-
- bits_per_mb_at_this_q =
- (int)( .5 + ( err_correction_factor *
- speed_correction *
- cpi->twopass.est_max_qcorrection_factor *
- (double)vp8_bits_per_mb[INTER_FRAME][Q] / 1.0 ) );
-
- if (bits_per_mb_at_this_q <= target_norm_bits_per_mb)
- break;
- }
-
- return Q;
-}
-
-/* Estimate a worst case Q for a KF group */
-static int estimate_kf_group_q(VP8_COMP *cpi, double section_err, int section_target_bandwitdh, double group_iiratio)
-{
- int Q;
- int num_mbs = cpi->common.MBs;
- int target_norm_bits_per_mb = (512 * section_target_bandwitdh) / num_mbs;
- int bits_per_mb_at_this_q;
-
- double err_per_mb = section_err / num_mbs;
- double err_correction_factor;
- double speed_correction = 1.0;
- double current_spend_ratio = 1.0;
-
- double pow_highq = (POW1 < 0.6) ? POW1 + 0.3 : 0.90;
- double pow_lowq = (POW1 < 0.7) ? POW1 + 0.1 : 0.80;
-
- double iiratio_correction_factor = 1.0;
-
- double combined_correction_factor;
-
- /* Trap special case where the target is <= 0 */
- if (target_norm_bits_per_mb <= 0)
- return MAXQ * 2;
-
- /* Calculate a corrective factor based on a rolling ratio of bits spent
- * vs target bits
- * This is clamped to the range 0.1 to 10.0
- */
- if (cpi->long_rolling_target_bits <= 0)
- current_spend_ratio = 10.0;
- else
- {
- current_spend_ratio = (double)cpi->long_rolling_actual_bits / (double)cpi->long_rolling_target_bits;
- current_spend_ratio = (current_spend_ratio > 10.0) ? 10.0 : (current_spend_ratio < 0.1) ? 0.1 : current_spend_ratio;
- }
-
- /* Calculate a correction factor based on the quality of prediction in
- * the sequence as indicated by intra_inter error score ratio (IIRatio)
- * The idea here is to favour subsampling in the hardest sections vs
- * the easyest.
- */
- iiratio_correction_factor = 1.0 - ((group_iiratio - 6.0) * 0.1);
-
- if (iiratio_correction_factor < 0.5)
- iiratio_correction_factor = 0.5;
-
- /* Corrections for higher compression speed settings
- * (reduced compression expected)
- */
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
- {
- if (cpi->oxcf.cpu_used <= 5)
- speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
- else
- speed_correction = 1.25;
- }
-
- /* Combine the various factors calculated above */
- combined_correction_factor = speed_correction * iiratio_correction_factor * current_spend_ratio;
-
- /* Try and pick a Q that should be high enough to encode the content at
- * the given rate.
- */
- for (Q = 0; Q < MAXQ; Q++)
- {
- /* Error per MB based correction factor */
- err_correction_factor =
- calc_correction_factor(err_per_mb, 150.0, pow_lowq, pow_highq, Q);
-
- bits_per_mb_at_this_q =
- (int)(.5 + ( err_correction_factor *
- combined_correction_factor *
- (double)vp8_bits_per_mb[INTER_FRAME][Q]) );
-
- if (bits_per_mb_at_this_q <= target_norm_bits_per_mb)
- break;
- }
-
- /* If we could not hit the target even at Max Q then estimate what Q
- * would have been required
- */
- while ((bits_per_mb_at_this_q > target_norm_bits_per_mb) && (Q < (MAXQ * 2)))
- {
-
- bits_per_mb_at_this_q = (int)(0.96 * bits_per_mb_at_this_q);
- Q++;
- }
-
- if (0)
- {
- FILE *f = fopen("estkf_q.stt", "a");
- fprintf(f, "%8d %8d %8d %8.2f %8.3f %8.2f %8.3f %8.3f %8.3f %8d\n", cpi->common.current_video_frame, bits_per_mb_at_this_q,
- target_norm_bits_per_mb, err_per_mb, err_correction_factor,
- current_spend_ratio, group_iiratio, iiratio_correction_factor,
- (double)cpi->buffer_level / (double)cpi->oxcf.optimal_buffer_level, Q);
- fclose(f);
- }
-
- return Q;
-}
-
-extern void vp8_new_framerate(VP8_COMP *cpi, double framerate);
-
-void vp8_init_second_pass(VP8_COMP *cpi)
-{
- FIRSTPASS_STATS this_frame;
- FIRSTPASS_STATS *start_pos;
-
- double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
-
- zero_stats(&cpi->twopass.total_stats);
- zero_stats(&cpi->twopass.total_left_stats);
-
- if (!cpi->twopass.stats_in_end)
- return;
-
- cpi->twopass.total_stats = *cpi->twopass.stats_in_end;
- cpi->twopass.total_left_stats = cpi->twopass.total_stats;
-
- /* each frame can have a different duration, as the frame rate in the
- * source isn't guaranteed to be constant. The frame rate prior to
- * the first frame encoded in the second pass is a guess. However the
- * sum duration is not. Its calculated based on the actual durations of
- * all frames from the first pass.
- */
- vp8_new_framerate(cpi, 10000000.0 * cpi->twopass.total_stats.count / cpi->twopass.total_stats.duration);
-
- cpi->output_framerate = cpi->framerate;
- cpi->twopass.bits_left = (int64_t)(cpi->twopass.total_stats.duration * cpi->oxcf.target_bandwidth / 10000000.0) ;
- cpi->twopass.bits_left -= (int64_t)(cpi->twopass.total_stats.duration * two_pass_min_rate / 10000000.0);
-
- /* Calculate a minimum intra value to be used in determining the IIratio
- * scores used in the second pass. We have this minimum to make sure
- * that clips that are static but "low complexity" in the intra domain
- * are still boosted appropriately for KF/GF/ARF
- */
- cpi->twopass.kf_intra_err_min = KF_MB_INTRA_MIN * cpi->common.MBs;
- cpi->twopass.gf_intra_err_min = GF_MB_INTRA_MIN * cpi->common.MBs;
-
- /* Scan the first pass file and calculate an average Intra / Inter error
- * score ratio for the sequence
- */
- {
- double sum_iiratio = 0.0;
- double IIRatio;
-
- start_pos = cpi->twopass.stats_in; /* Note starting "file" position */
-
- while (input_stats(cpi, &this_frame) != EOF)
- {
- IIRatio = this_frame.intra_error / DOUBLE_DIVIDE_CHECK(this_frame.coded_error);
- IIRatio = (IIRatio < 1.0) ? 1.0 : (IIRatio > 20.0) ? 20.0 : IIRatio;
- sum_iiratio += IIRatio;
- }
-
- cpi->twopass.avg_iiratio = sum_iiratio / DOUBLE_DIVIDE_CHECK((double)cpi->twopass.total_stats.count);
-
- /* Reset file position */
- reset_fpf_position(cpi, start_pos);
- }
-
- /* Scan the first pass file and calculate a modified total error based
- * upon the bias/power function used to allocate bits
- */
- {
- start_pos = cpi->twopass.stats_in; /* Note starting "file" position */
-
- cpi->twopass.modified_error_total = 0.0;
- cpi->twopass.modified_error_used = 0.0;
-
- while (input_stats(cpi, &this_frame) != EOF)
- {
- cpi->twopass.modified_error_total += calculate_modified_err(cpi, &this_frame);
- }
- cpi->twopass.modified_error_left = cpi->twopass.modified_error_total;
-
- reset_fpf_position(cpi, start_pos); /* Reset file position */
-
- }
-}
-
-void vp8_end_second_pass(VP8_COMP *cpi)
-{
- (void)cpi;
-}
-
-/* This function gives and estimate of how badly we believe the prediction
- * quality is decaying from frame to frame.
- */
-static double get_prediction_decay_rate(VP8_COMP *cpi, FIRSTPASS_STATS *next_frame)
-{
- double prediction_decay_rate;
- double motion_decay;
- double motion_pct = next_frame->pcnt_motion;
-
- (void)cpi;
- /* Initial basis is the % mbs inter coded */
- prediction_decay_rate = next_frame->pcnt_inter;
- /* High % motion -> somewhat higher decay rate */
- motion_decay = (1.0 - (motion_pct / 20.0));
- if (motion_decay < prediction_decay_rate)
- prediction_decay_rate = motion_decay;
-
- /* Adjustment to decay rate based on speed of motion */
- {
- double this_mv_rabs;
- double this_mv_cabs;
- double distance_factor;
-
- this_mv_rabs = fabs(next_frame->mvr_abs * motion_pct);
- this_mv_cabs = fabs(next_frame->mvc_abs * motion_pct);
-
- distance_factor = sqrt((this_mv_rabs * this_mv_rabs) +
- (this_mv_cabs * this_mv_cabs)) / 250.0;
- distance_factor = ((distance_factor > 1.0)
- ? 0.0 : (1.0 - distance_factor));
- if (distance_factor < prediction_decay_rate)
- prediction_decay_rate = distance_factor;
- }
-
- return prediction_decay_rate;
-}
-
-/* Function to test for a condition where a complex transition is followed
- * by a static section. For example in slide shows where there is a fade
- * between slides. This is to help with more optimal kf and gf positioning.
- */
-static int detect_transition_to_still(
- VP8_COMP *cpi,
- int frame_interval,
- int still_interval,
- double loop_decay_rate,
- double decay_accumulator )
-{
- int trans_to_still = 0;
-
- /* Break clause to detect very still sections after motion
- * For example a static image after a fade or other transition
- * instead of a clean scene cut.
- */
- if ( (frame_interval > MIN_GF_INTERVAL) &&
- (loop_decay_rate >= 0.999) &&
- (decay_accumulator < 0.9) )
- {
- int j;
- FIRSTPASS_STATS * position = cpi->twopass.stats_in;
- FIRSTPASS_STATS tmp_next_frame;
- double decay_rate;
-
- /* Look ahead a few frames to see if static condition persists... */
- for ( j = 0; j < still_interval; j++ )
- {
- if (EOF == input_stats(cpi, &tmp_next_frame))
- break;
-
- decay_rate = get_prediction_decay_rate(cpi, &tmp_next_frame);
- if ( decay_rate < 0.999 )
- break;
- }
- /* Reset file position */
- reset_fpf_position(cpi, position);
-
- /* Only if it does do we signal a transition to still */
- if ( j == still_interval )
- trans_to_still = 1;
- }
-
- return trans_to_still;
-}
-
-/* This function detects a flash through the high relative pcnt_second_ref
- * score in the frame following a flash frame. The offset passed in should
- * reflect this
- */
-static int detect_flash( VP8_COMP *cpi, int offset )
-{
- FIRSTPASS_STATS next_frame;
-
- int flash_detected = 0;
-
- /* Read the frame data. */
- /* The return is 0 (no flash detected) if not a valid frame */
- if ( read_frame_stats(cpi, &next_frame, offset) != EOF )
- {
- /* What we are looking for here is a situation where there is a
- * brief break in prediction (such as a flash) but subsequent frames
- * are reasonably well predicted by an earlier (pre flash) frame.
- * The recovery after a flash is indicated by a high pcnt_second_ref
- * comapred to pcnt_inter.
- */
- if ( (next_frame.pcnt_second_ref > next_frame.pcnt_inter) &&
- (next_frame.pcnt_second_ref >= 0.5 ) )
- {
- flash_detected = 1;
-
- /*if (1)
- {
- FILE *f = fopen("flash.stt", "a");
- fprintf(f, "%8.0f %6.2f %6.2f\n",
- next_frame.frame,
- next_frame.pcnt_inter,
- next_frame.pcnt_second_ref);
- fclose(f);
- }*/
- }
- }
-
- return flash_detected;
-}
-
-/* Update the motion related elements to the GF arf boost calculation */
-static void accumulate_frame_motion_stats(
- VP8_COMP *cpi,
- FIRSTPASS_STATS * this_frame,
- double * this_frame_mv_in_out,
- double * mv_in_out_accumulator,
- double * abs_mv_in_out_accumulator,
- double * mv_ratio_accumulator )
-{
- double this_frame_mvr_ratio;
- double this_frame_mvc_ratio;
- double motion_pct;
-
- (void)cpi;
- /* Accumulate motion stats. */
- motion_pct = this_frame->pcnt_motion;
-
- /* Accumulate Motion In/Out of frame stats */
- *this_frame_mv_in_out = this_frame->mv_in_out_count * motion_pct;
- *mv_in_out_accumulator += this_frame->mv_in_out_count * motion_pct;
- *abs_mv_in_out_accumulator +=
- fabs(this_frame->mv_in_out_count * motion_pct);
-
- /* Accumulate a measure of how uniform (or conversely how random)
- * the motion field is. (A ratio of absmv / mv)
- */
- if (motion_pct > 0.05)
- {
- this_frame_mvr_ratio = fabs(this_frame->mvr_abs) /
- DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVr));
-
- this_frame_mvc_ratio = fabs(this_frame->mvc_abs) /
- DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVc));
-
- *mv_ratio_accumulator +=
- (this_frame_mvr_ratio < this_frame->mvr_abs)
- ? (this_frame_mvr_ratio * motion_pct)
- : this_frame->mvr_abs * motion_pct;
-
- *mv_ratio_accumulator +=
- (this_frame_mvc_ratio < this_frame->mvc_abs)
- ? (this_frame_mvc_ratio * motion_pct)
- : this_frame->mvc_abs * motion_pct;
-
- }
-}
-
-/* Calculate a baseline boost number for the current frame. */
-static double calc_frame_boost(
- VP8_COMP *cpi,
- FIRSTPASS_STATS * this_frame,
- double this_frame_mv_in_out )
-{
- double frame_boost;
-
- /* Underlying boost factor is based on inter intra error ratio */
- if (this_frame->intra_error > cpi->twopass.gf_intra_err_min)
- frame_boost = (IIFACTOR * this_frame->intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame->coded_error));
- else
- frame_boost = (IIFACTOR * cpi->twopass.gf_intra_err_min /
- DOUBLE_DIVIDE_CHECK(this_frame->coded_error));
-
- /* Increase boost for frames where new data coming into frame
- * (eg zoom out). Slightly reduce boost if there is a net balance
- * of motion out of the frame (zoom in).
- * The range for this_frame_mv_in_out is -1.0 to +1.0
- */
- if (this_frame_mv_in_out > 0.0)
- frame_boost += frame_boost * (this_frame_mv_in_out * 2.0);
- /* In extreme case boost is halved */
- else
- frame_boost += frame_boost * (this_frame_mv_in_out / 2.0);
-
- /* Clip to maximum */
- if (frame_boost > GF_RMAX)
- frame_boost = GF_RMAX;
-
- return frame_boost;
-}
-
-#if NEW_BOOST
-static int calc_arf_boost(
- VP8_COMP *cpi,
- int offset,
- int f_frames,
- int b_frames,
- int *f_boost,
- int *b_boost )
-{
- FIRSTPASS_STATS this_frame;
-
- int i;
- double boost_score = 0.0;
- double mv_ratio_accumulator = 0.0;
- double decay_accumulator = 1.0;
- double this_frame_mv_in_out = 0.0;
- double mv_in_out_accumulator = 0.0;
- double abs_mv_in_out_accumulator = 0.0;
- double r;
- int flash_detected = 0;
-
- /* Search forward from the proposed arf/next gf position */
- for ( i = 0; i < f_frames; i++ )
- {
- if ( read_frame_stats(cpi, &this_frame, (i+offset)) == EOF )
- break;
-
- /* Update the motion related elements to the boost calculation */
- accumulate_frame_motion_stats( cpi, &this_frame,
- &this_frame_mv_in_out, &mv_in_out_accumulator,
- &abs_mv_in_out_accumulator, &mv_ratio_accumulator );
-
- /* Calculate the baseline boost number for this frame */
- r = calc_frame_boost( cpi, &this_frame, this_frame_mv_in_out );
-
- /* We want to discount the the flash frame itself and the recovery
- * frame that follows as both will have poor scores.
- */
- flash_detected = detect_flash(cpi, (i+offset)) ||
- detect_flash(cpi, (i+offset+1));
-
- /* Cumulative effect of prediction quality decay */
- if ( !flash_detected )
- {
- decay_accumulator =
- decay_accumulator *
- get_prediction_decay_rate(cpi, &this_frame);
- decay_accumulator =
- decay_accumulator < 0.1 ? 0.1 : decay_accumulator;
- }
- boost_score += (decay_accumulator * r);
-
- /* Break out conditions. */
- if ( (!flash_detected) &&
- ((mv_ratio_accumulator > 100.0) ||
- (abs_mv_in_out_accumulator > 3.0) ||
- (mv_in_out_accumulator < -2.0) ) )
- {
- break;
- }
- }
-
- *f_boost = (int)(boost_score * 100.0) >> 4;
-
- /* Reset for backward looking loop */
- boost_score = 0.0;
- mv_ratio_accumulator = 0.0;
- decay_accumulator = 1.0;
- this_frame_mv_in_out = 0.0;
- mv_in_out_accumulator = 0.0;
- abs_mv_in_out_accumulator = 0.0;
-
- /* Search forward from the proposed arf/next gf position */
- for ( i = -1; i >= -b_frames; i-- )
- {
- if ( read_frame_stats(cpi, &this_frame, (i+offset)) == EOF )
- break;
-
- /* Update the motion related elements to the boost calculation */
- accumulate_frame_motion_stats( cpi, &this_frame,
- &this_frame_mv_in_out, &mv_in_out_accumulator,
- &abs_mv_in_out_accumulator, &mv_ratio_accumulator );
-
- /* Calculate the baseline boost number for this frame */
- r = calc_frame_boost( cpi, &this_frame, this_frame_mv_in_out );
-
- /* We want to discount the the flash frame itself and the recovery
- * frame that follows as both will have poor scores.
- */
- flash_detected = detect_flash(cpi, (i+offset)) ||
- detect_flash(cpi, (i+offset+1));
-
- /* Cumulative effect of prediction quality decay */
- if ( !flash_detected )
- {
- decay_accumulator =
- decay_accumulator *
- get_prediction_decay_rate(cpi, &this_frame);
- decay_accumulator =
- decay_accumulator < 0.1 ? 0.1 : decay_accumulator;
- }
-
- boost_score += (decay_accumulator * r);
-
- /* Break out conditions. */
- if ( (!flash_detected) &&
- ((mv_ratio_accumulator > 100.0) ||
- (abs_mv_in_out_accumulator > 3.0) ||
- (mv_in_out_accumulator < -2.0) ) )
- {
- break;
- }
- }
- *b_boost = (int)(boost_score * 100.0) >> 4;
-
- return (*f_boost + *b_boost);
-}
-#endif
-
-/* Analyse and define a gf/arf group . */
-static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
-{
- FIRSTPASS_STATS next_frame;
- FIRSTPASS_STATS *start_pos;
- int i;
- double r;
- double boost_score = 0.0;
- double old_boost_score = 0.0;
- double gf_group_err = 0.0;
- double gf_first_frame_err = 0.0;
- double mod_frame_err = 0.0;
-
- double mv_ratio_accumulator = 0.0;
- double decay_accumulator = 1.0;
-
- double loop_decay_rate = 1.00; /* Starting decay rate */
-
- double this_frame_mv_in_out = 0.0;
- double mv_in_out_accumulator = 0.0;
- double abs_mv_in_out_accumulator = 0.0;
- double mod_err_per_mb_accumulator = 0.0;
-
- int max_bits = frame_max_bits(cpi); /* Max for a single frame */
-
- unsigned int allow_alt_ref =
- cpi->oxcf.play_alternate && cpi->oxcf.lag_in_frames;
-
- int alt_boost = 0;
- int f_boost = 0;
- int b_boost = 0;
- int flash_detected;
-
- cpi->twopass.gf_group_bits = 0;
- cpi->twopass.gf_decay_rate = 0;
-
- vp8_clear_system_state();
-
- start_pos = cpi->twopass.stats_in;
-
- vpx_memset(&next_frame, 0, sizeof(next_frame)); /* assure clean */
-
- /* Load stats for the current frame. */
- mod_frame_err = calculate_modified_err(cpi, this_frame);
-
- /* Note the error of the frame at the start of the group (this will be
- * the GF frame error if we code a normal gf
- */
- gf_first_frame_err = mod_frame_err;
-
- /* Special treatment if the current frame is a key frame (which is also
- * a gf). If it is then its error score (and hence bit allocation) need
- * to be subtracted out from the calculation for the GF group
- */
- if (cpi->common.frame_type == KEY_FRAME)
- gf_group_err -= gf_first_frame_err;
-
- /* Scan forward to try and work out how many frames the next gf group
- * should contain and what level of boost is appropriate for the GF
- * or ARF that will be coded with the group
- */
- i = 0;
-
- while (((i < cpi->twopass.static_scene_max_gf_interval) ||
- ((cpi->twopass.frames_to_key - i) < MIN_GF_INTERVAL)) &&
- (i < cpi->twopass.frames_to_key))
- {
- i++;
-
- /* Accumulate error score of frames in this gf group */
- mod_frame_err = calculate_modified_err(cpi, this_frame);
-
- gf_group_err += mod_frame_err;
-
- mod_err_per_mb_accumulator +=
- mod_frame_err / DOUBLE_DIVIDE_CHECK((double)cpi->common.MBs);
-
- if (EOF == input_stats(cpi, &next_frame))
- break;
-
- /* Test for the case where there is a brief flash but the prediction
- * quality back to an earlier frame is then restored.
- */
- flash_detected = detect_flash(cpi, 0);
-
- /* Update the motion related elements to the boost calculation */
- accumulate_frame_motion_stats( cpi, &next_frame,
- &this_frame_mv_in_out, &mv_in_out_accumulator,
- &abs_mv_in_out_accumulator, &mv_ratio_accumulator );
-
- /* Calculate a baseline boost number for this frame */
- r = calc_frame_boost( cpi, &next_frame, this_frame_mv_in_out );
-
- /* Cumulative effect of prediction quality decay */
- if ( !flash_detected )
- {
- loop_decay_rate = get_prediction_decay_rate(cpi, &next_frame);
- decay_accumulator = decay_accumulator * loop_decay_rate;
- decay_accumulator =
- decay_accumulator < 0.1 ? 0.1 : decay_accumulator;
- }
- boost_score += (decay_accumulator * r);
-
- /* Break clause to detect very still sections after motion
- * For example a staic image after a fade or other transition.
- */
- if ( detect_transition_to_still( cpi, i, 5,
- loop_decay_rate,
- decay_accumulator ) )
- {
- allow_alt_ref = 0;
- boost_score = old_boost_score;
- break;
- }
-
- /* Break out conditions. */
- if (
- /* Break at cpi->max_gf_interval unless almost totally static */
- (i >= cpi->max_gf_interval && (decay_accumulator < 0.995)) ||
- (
- /* Dont break out with a very short interval */
- (i > MIN_GF_INTERVAL) &&
- /* Dont break out very close to a key frame */
- ((cpi->twopass.frames_to_key - i) >= MIN_GF_INTERVAL) &&
- ((boost_score > 20.0) || (next_frame.pcnt_inter < 0.75)) &&
- (!flash_detected) &&
- ((mv_ratio_accumulator > 100.0) ||
- (abs_mv_in_out_accumulator > 3.0) ||
- (mv_in_out_accumulator < -2.0) ||
- ((boost_score - old_boost_score) < 2.0))
- ) )
- {
- boost_score = old_boost_score;
- break;
- }
-
- vpx_memcpy(this_frame, &next_frame, sizeof(*this_frame));
-
- old_boost_score = boost_score;
- }
-
- cpi->twopass.gf_decay_rate =
- (i > 0) ? (int)(100.0 * (1.0 - decay_accumulator)) / i : 0;
-
- /* When using CBR apply additional buffer related upper limits */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- double max_boost;
-
- /* For cbr apply buffer related limits */
- if (cpi->drop_frames_allowed)
- {
- int64_t df_buffer_level = cpi->oxcf.drop_frames_water_mark *
- (cpi->oxcf.optimal_buffer_level / 100);
-
- if (cpi->buffer_level > df_buffer_level)
- max_boost = ((double)((cpi->buffer_level - df_buffer_level) * 2 / 3) * 16.0) / DOUBLE_DIVIDE_CHECK((double)cpi->av_per_frame_bandwidth);
- else
- max_boost = 0.0;
- }
- else if (cpi->buffer_level > 0)
- {
- max_boost = ((double)(cpi->buffer_level * 2 / 3) * 16.0) / DOUBLE_DIVIDE_CHECK((double)cpi->av_per_frame_bandwidth);
- }
- else
- {
- max_boost = 0.0;
- }
-
- if (boost_score > max_boost)
- boost_score = max_boost;
- }
-
- /* Dont allow conventional gf too near the next kf */
- if ((cpi->twopass.frames_to_key - i) < MIN_GF_INTERVAL)
- {
- while (i < cpi->twopass.frames_to_key)
- {
- i++;
-
- if (EOF == input_stats(cpi, this_frame))
- break;
-
- if (i < cpi->twopass.frames_to_key)
- {
- mod_frame_err = calculate_modified_err(cpi, this_frame);
- gf_group_err += mod_frame_err;
- }
- }
- }
-
- cpi->gfu_boost = (int)(boost_score * 100.0) >> 4;
-
-#if NEW_BOOST
- /* Alterrnative boost calculation for alt ref */
- alt_boost = calc_arf_boost( cpi, 0, (i-1), (i-1), &f_boost, &b_boost );
-#endif
-
- /* Should we use the alternate refernce frame */
- if (allow_alt_ref &&
- (i >= MIN_GF_INTERVAL) &&
- /* dont use ARF very near next kf */
- (i <= (cpi->twopass.frames_to_key - MIN_GF_INTERVAL)) &&
-#if NEW_BOOST
- ((next_frame.pcnt_inter > 0.75) ||
- (next_frame.pcnt_second_ref > 0.5)) &&
- ((mv_in_out_accumulator / (double)i > -0.2) ||
- (mv_in_out_accumulator > -2.0)) &&
- (b_boost > 100) &&
- (f_boost > 100) )
-#else
- (next_frame.pcnt_inter > 0.75) &&
- ((mv_in_out_accumulator / (double)i > -0.2) ||
- (mv_in_out_accumulator > -2.0)) &&
- (cpi->gfu_boost > 100) &&
- (cpi->twopass.gf_decay_rate <=
- (ARF_DECAY_THRESH + (cpi->gfu_boost / 200))) )
-#endif
- {
- int Boost;
- int allocation_chunks;
- int Q = (cpi->oxcf.fixed_q < 0)
- ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
- int tmp_q;
- int arf_frame_bits = 0;
- int group_bits;
-
-#if NEW_BOOST
- cpi->gfu_boost = alt_boost;
-#endif
-
- /* Estimate the bits to be allocated to the group as a whole */
- if ((cpi->twopass.kf_group_bits > 0) &&
- (cpi->twopass.kf_group_error_left > 0))
- {
- group_bits = (int)((double)cpi->twopass.kf_group_bits *
- (gf_group_err / (double)cpi->twopass.kf_group_error_left));
- }
- else
- group_bits = 0;
-
- /* Boost for arf frame */
-#if NEW_BOOST
- Boost = (alt_boost * GFQ_ADJUSTMENT) / 100;
-#else
- Boost = (cpi->gfu_boost * 3 * GFQ_ADJUSTMENT) / (2 * 100);
-#endif
- Boost += (i * 50);
-
- /* Set max and minimum boost and hence minimum allocation */
- if (Boost > ((cpi->baseline_gf_interval + 1) * 200))
- Boost = ((cpi->baseline_gf_interval + 1) * 200);
- else if (Boost < 125)
- Boost = 125;
-
- allocation_chunks = (i * 100) + Boost;
-
- /* Normalize Altboost and allocations chunck down to prevent overflow */
- while (Boost > 1000)
- {
- Boost /= 2;
- allocation_chunks /= 2;
- }
-
- /* Calculate the number of bits to be spent on the arf based on the
- * boost number
- */
- arf_frame_bits = (int)((double)Boost * (group_bits /
- (double)allocation_chunks));
-
- /* Estimate if there are enough bits available to make worthwhile use
- * of an arf.
- */
- tmp_q = estimate_q(cpi, mod_frame_err, (int)arf_frame_bits);
-
- /* Only use an arf if it is likely we will be able to code
- * it at a lower Q than the surrounding frames.
- */
- if (tmp_q < cpi->worst_quality)
- {
- int half_gf_int;
- int frames_after_arf;
- int frames_bwd = cpi->oxcf.arnr_max_frames - 1;
- int frames_fwd = cpi->oxcf.arnr_max_frames - 1;
-
- cpi->source_alt_ref_pending = 1;
-
- /*
- * For alt ref frames the error score for the end frame of the
- * group (the alt ref frame) should not contribute to the group
- * total and hence the number of bit allocated to the group.
- * Rather it forms part of the next group (it is the GF at the
- * start of the next group)
- * gf_group_err -= mod_frame_err;
- *
- * For alt ref frames alt ref frame is technically part of the
- * GF frame for the next group but we always base the error
- * calculation and bit allocation on the current group of frames.
- *
- * Set the interval till the next gf or arf.
- * For ARFs this is the number of frames to be coded before the
- * future frame that is coded as an ARF.
- * The future frame itself is part of the next group
- */
- cpi->baseline_gf_interval = i;
-
- /*
- * Define the arnr filter width for this group of frames:
- * We only filter frames that lie within a distance of half
- * the GF interval from the ARF frame. We also have to trap
- * cases where the filter extends beyond the end of clip.
- * Note: this_frame->frame has been updated in the loop
- * so it now points at the ARF frame.
- */
- half_gf_int = cpi->baseline_gf_interval >> 1;
- frames_after_arf = (int)(cpi->twopass.total_stats.count -
- this_frame->frame - 1);
-
- switch (cpi->oxcf.arnr_type)
- {
- case 1: /* Backward filter */
- frames_fwd = 0;
- if (frames_bwd > half_gf_int)
- frames_bwd = half_gf_int;
- break;
-
- case 2: /* Forward filter */
- if (frames_fwd > half_gf_int)
- frames_fwd = half_gf_int;
- if (frames_fwd > frames_after_arf)
- frames_fwd = frames_after_arf;
- frames_bwd = 0;
- break;
-
- case 3: /* Centered filter */
- default:
- frames_fwd >>= 1;
- if (frames_fwd > frames_after_arf)
- frames_fwd = frames_after_arf;
- if (frames_fwd > half_gf_int)
- frames_fwd = half_gf_int;
-
- frames_bwd = frames_fwd;
-
- /* For even length filter there is one more frame backward
- * than forward: e.g. len=6 ==> bbbAff, len=7 ==> bbbAfff.
- */
- if (frames_bwd < half_gf_int)
- frames_bwd += (cpi->oxcf.arnr_max_frames+1) & 0x1;
- break;
- }
-
- cpi->active_arnr_frames = frames_bwd + 1 + frames_fwd;
- }
- else
- {
- cpi->source_alt_ref_pending = 0;
- cpi->baseline_gf_interval = i;
- }
- }
- else
- {
- cpi->source_alt_ref_pending = 0;
- cpi->baseline_gf_interval = i;
- }
-
- /*
- * Now decide how many bits should be allocated to the GF group as a
- * proportion of those remaining in the kf group.
- * The final key frame group in the clip is treated as a special case
- * where cpi->twopass.kf_group_bits is tied to cpi->twopass.bits_left.
- * This is also important for short clips where there may only be one
- * key frame.
- */
- if (cpi->twopass.frames_to_key >= (int)(cpi->twopass.total_stats.count -
- cpi->common.current_video_frame))
- {
- cpi->twopass.kf_group_bits =
- (cpi->twopass.bits_left > 0) ? cpi->twopass.bits_left : 0;
- }
-
- /* Calculate the bits to be allocated to the group as a whole */
- if ((cpi->twopass.kf_group_bits > 0) &&
- (cpi->twopass.kf_group_error_left > 0))
- {
- cpi->twopass.gf_group_bits =
- (int64_t)(cpi->twopass.kf_group_bits *
- (gf_group_err / cpi->twopass.kf_group_error_left));
- }
- else
- cpi->twopass.gf_group_bits = 0;
-
- cpi->twopass.gf_group_bits =
- (cpi->twopass.gf_group_bits < 0)
- ? 0
- : (cpi->twopass.gf_group_bits > cpi->twopass.kf_group_bits)
- ? cpi->twopass.kf_group_bits : cpi->twopass.gf_group_bits;
-
- /* Clip cpi->twopass.gf_group_bits based on user supplied data rate
- * variability limit (cpi->oxcf.two_pass_vbrmax_section)
- */
- if (cpi->twopass.gf_group_bits >
- (int64_t)max_bits * cpi->baseline_gf_interval)
- cpi->twopass.gf_group_bits =
- (int64_t)max_bits * cpi->baseline_gf_interval;
-
- /* Reset the file position */
- reset_fpf_position(cpi, start_pos);
-
- /* Update the record of error used so far (only done once per gf group) */
- cpi->twopass.modified_error_used += gf_group_err;
-
- /* Assign bits to the arf or gf. */
- for (i = 0; i <= (cpi->source_alt_ref_pending && cpi->common.frame_type != KEY_FRAME); i++) {
- int Boost;
- int allocation_chunks;
- int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
- int gf_bits;
-
- /* For ARF frames */
- if (cpi->source_alt_ref_pending && i == 0)
- {
-#if NEW_BOOST
- Boost = (alt_boost * GFQ_ADJUSTMENT) / 100;
-#else
- Boost = (cpi->gfu_boost * 3 * GFQ_ADJUSTMENT) / (2 * 100);
-#endif
- Boost += (cpi->baseline_gf_interval * 50);
-
- /* Set max and minimum boost and hence minimum allocation */
- if (Boost > ((cpi->baseline_gf_interval + 1) * 200))
- Boost = ((cpi->baseline_gf_interval + 1) * 200);
- else if (Boost < 125)
- Boost = 125;
-
- allocation_chunks =
- ((cpi->baseline_gf_interval + 1) * 100) + Boost;
- }
- /* Else for standard golden frames */
- else
- {
- /* boost based on inter / intra ratio of subsequent frames */
- Boost = (cpi->gfu_boost * GFQ_ADJUSTMENT) / 100;
-
- /* Set max and minimum boost and hence minimum allocation */
- if (Boost > (cpi->baseline_gf_interval * 150))
- Boost = (cpi->baseline_gf_interval * 150);
- else if (Boost < 125)
- Boost = 125;
-
- allocation_chunks =
- (cpi->baseline_gf_interval * 100) + (Boost - 100);
- }
-
- /* Normalize Altboost and allocations chunck down to prevent overflow */
- while (Boost > 1000)
- {
- Boost /= 2;
- allocation_chunks /= 2;
- }
-
- /* Calculate the number of bits to be spent on the gf or arf based on
- * the boost number
- */
- gf_bits = (int)((double)Boost *
- (cpi->twopass.gf_group_bits /
- (double)allocation_chunks));
-
- /* If the frame that is to be boosted is simpler than the average for
- * the gf/arf group then use an alternative calculation
- * based on the error score of the frame itself
- */
- if (mod_frame_err < gf_group_err / (double)cpi->baseline_gf_interval)
- {
- double alt_gf_grp_bits;
- int alt_gf_bits;
-
- alt_gf_grp_bits =
- (double)cpi->twopass.kf_group_bits *
- (mod_frame_err * (double)cpi->baseline_gf_interval) /
- DOUBLE_DIVIDE_CHECK((double)cpi->twopass.kf_group_error_left);
-
- alt_gf_bits = (int)((double)Boost * (alt_gf_grp_bits /
- (double)allocation_chunks));
-
- if (gf_bits > alt_gf_bits)
- {
- gf_bits = alt_gf_bits;
- }
- }
- /* Else if it is harder than other frames in the group make sure it at
- * least receives an allocation in keeping with its relative error
- * score, otherwise it may be worse off than an "un-boosted" frame
- */
- else
- {
- int alt_gf_bits =
- (int)((double)cpi->twopass.kf_group_bits *
- mod_frame_err /
- DOUBLE_DIVIDE_CHECK((double)cpi->twopass.kf_group_error_left));
-
- if (alt_gf_bits > gf_bits)
- {
- gf_bits = alt_gf_bits;
- }
- }
-
- /* Apply an additional limit for CBR */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- if (cpi->twopass.gf_bits > (int)(cpi->buffer_level >> 1))
- cpi->twopass.gf_bits = (int)(cpi->buffer_level >> 1);
- }
-
- /* Dont allow a negative value for gf_bits */
- if (gf_bits < 0)
- gf_bits = 0;
-
- /* Add in minimum for a frame */
- gf_bits += cpi->min_frame_bandwidth;
-
- if (i == 0)
- {
- cpi->twopass.gf_bits = gf_bits;
- }
- if (i == 1 || (!cpi->source_alt_ref_pending && (cpi->common.frame_type != KEY_FRAME)))
- {
- /* Per frame bit target for this frame */
- cpi->per_frame_bandwidth = gf_bits;
- }
- }
-
- {
- /* Adjust KF group bits and error remainin */
- cpi->twopass.kf_group_error_left -= (int64_t)gf_group_err;
- cpi->twopass.kf_group_bits -= cpi->twopass.gf_group_bits;
-
- if (cpi->twopass.kf_group_bits < 0)
- cpi->twopass.kf_group_bits = 0;
-
- /* Note the error score left in the remaining frames of the group.
- * For normal GFs we want to remove the error score for the first
- * frame of the group (except in Key frame case where this has
- * already happened)
- */
- if (!cpi->source_alt_ref_pending && cpi->common.frame_type != KEY_FRAME)
- cpi->twopass.gf_group_error_left = (int)(gf_group_err -
- gf_first_frame_err);
- else
- cpi->twopass.gf_group_error_left = (int) gf_group_err;
-
- cpi->twopass.gf_group_bits -= cpi->twopass.gf_bits - cpi->min_frame_bandwidth;
-
- if (cpi->twopass.gf_group_bits < 0)
- cpi->twopass.gf_group_bits = 0;
-
- /* This condition could fail if there are two kfs very close together
- * despite (MIN_GF_INTERVAL) and would cause a devide by 0 in the
- * calculation of cpi->twopass.alt_extra_bits.
- */
- if ( cpi->baseline_gf_interval >= 3 )
- {
-#if NEW_BOOST
- int boost = (cpi->source_alt_ref_pending)
- ? b_boost : cpi->gfu_boost;
-#else
- int boost = cpi->gfu_boost;
-#endif
- if ( boost >= 150 )
- {
- int pct_extra;
-
- pct_extra = (boost - 100) / 50;
- pct_extra = (pct_extra > 20) ? 20 : pct_extra;
-
- cpi->twopass.alt_extra_bits =
- (int)(cpi->twopass.gf_group_bits * pct_extra) / 100;
- cpi->twopass.gf_group_bits -= cpi->twopass.alt_extra_bits;
- cpi->twopass.alt_extra_bits /=
- ((cpi->baseline_gf_interval-1)>>1);
- }
- else
- cpi->twopass.alt_extra_bits = 0;
- }
- else
- cpi->twopass.alt_extra_bits = 0;
- }
-
- /* Adjustments based on a measure of complexity of the section */
- if (cpi->common.frame_type != KEY_FRAME)
- {
- FIRSTPASS_STATS sectionstats;
- double Ratio;
-
- zero_stats(&sectionstats);
- reset_fpf_position(cpi, start_pos);
-
- for (i = 0 ; i < cpi->baseline_gf_interval ; i++)
- {
- input_stats(cpi, &next_frame);
- accumulate_stats(&sectionstats, &next_frame);
- }
-
- avg_stats(&sectionstats);
-
- cpi->twopass.section_intra_rating = (unsigned int)
- (sectionstats.intra_error /
- DOUBLE_DIVIDE_CHECK(sectionstats.coded_error));
-
- Ratio = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error);
- cpi->twopass.section_max_qfactor = 1.0 - ((Ratio - 10.0) * 0.025);
-
- if (cpi->twopass.section_max_qfactor < 0.80)
- cpi->twopass.section_max_qfactor = 0.80;
-
- reset_fpf_position(cpi, start_pos);
- }
-}
-
-/* Allocate bits to a normal frame that is neither a gf an arf or a key frame. */
-static void assign_std_frame_bits(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
-{
- int target_frame_size;
-
- double modified_err;
- double err_fraction;
-
- int max_bits = frame_max_bits(cpi); /* Max for a single frame */
-
- /* Calculate modified prediction error used in bit allocation */
- modified_err = calculate_modified_err(cpi, this_frame);
-
- /* What portion of the remaining GF group error is used by this frame */
- if (cpi->twopass.gf_group_error_left > 0)
- err_fraction = modified_err / cpi->twopass.gf_group_error_left;
- else
- err_fraction = 0.0;
-
- /* How many of those bits available for allocation should we give it? */
- target_frame_size = (int)((double)cpi->twopass.gf_group_bits * err_fraction);
-
- /* Clip to target size to 0 - max_bits (or cpi->twopass.gf_group_bits)
- * at the top end.
- */
- if (target_frame_size < 0)
- target_frame_size = 0;
- else
- {
- if (target_frame_size > max_bits)
- target_frame_size = max_bits;
-
- if (target_frame_size > cpi->twopass.gf_group_bits)
- target_frame_size = (int)cpi->twopass.gf_group_bits;
- }
-
- /* Adjust error and bits remaining */
- cpi->twopass.gf_group_error_left -= (int)modified_err;
- cpi->twopass.gf_group_bits -= target_frame_size;
-
- if (cpi->twopass.gf_group_bits < 0)
- cpi->twopass.gf_group_bits = 0;
-
- /* Add in the minimum number of bits that is set aside for every frame. */
- target_frame_size += cpi->min_frame_bandwidth;
-
- /* Every other frame gets a few extra bits */
- if ( (cpi->frames_since_golden & 0x01) &&
- (cpi->frames_till_gf_update_due > 0) )
- {
- target_frame_size += cpi->twopass.alt_extra_bits;
- }
-
- /* Per frame bit target for this frame */
- cpi->per_frame_bandwidth = target_frame_size;
-}
-
-void vp8_second_pass(VP8_COMP *cpi)
-{
- int tmp_q;
- int frames_left = (int)(cpi->twopass.total_stats.count - cpi->common.current_video_frame);
-
- FIRSTPASS_STATS this_frame;
- FIRSTPASS_STATS this_frame_copy;
-
- double this_frame_intra_error;
- double this_frame_coded_error;
-
- int overhead_bits;
-
- memset(&this_frame, 0, sizeof(FIRSTPASS_STATS));
- if (!cpi->twopass.stats_in)
- {
- return ;
- }
-
- vp8_clear_system_state();
-
- if (EOF == input_stats(cpi, &this_frame))
- return;
-
- this_frame_intra_error = this_frame.intra_error;
- this_frame_coded_error = this_frame.coded_error;
-
- /* keyframe and section processing ! */
- if (cpi->twopass.frames_to_key == 0)
- {
- /* Define next KF group and assign bits to it */
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
- find_next_key_frame(cpi, &this_frame_copy);
-
- /* Special case: Error error_resilient_mode mode does not make much
- * sense for two pass but with its current meaning this code is
- * designed to stop outlandish behaviour if someone does set it when
- * using two pass. It effectively disables GF groups. This is
- * temporary code until we decide what should really happen in this
- * case.
- */
- if (cpi->oxcf.error_resilient_mode)
- {
- cpi->twopass.gf_group_bits = cpi->twopass.kf_group_bits;
- cpi->twopass.gf_group_error_left =
- (int)cpi->twopass.kf_group_error_left;
- cpi->baseline_gf_interval = cpi->twopass.frames_to_key;
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
- cpi->source_alt_ref_pending = 0;
- }
-
- }
-
- /* Is this a GF / ARF (Note that a KF is always also a GF) */
- if (cpi->frames_till_gf_update_due == 0)
- {
- /* Define next gf group and assign bits to it */
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
- define_gf_group(cpi, &this_frame_copy);
-
- /* If we are going to code an altref frame at the end of the group
- * and the current frame is not a key frame.... If the previous
- * group used an arf this frame has already benefited from that arf
- * boost and it should not be given extra bits If the previous
- * group was NOT coded using arf we may want to apply some boost to
- * this GF as well
- */
- if (cpi->source_alt_ref_pending && (cpi->common.frame_type != KEY_FRAME))
- {
- /* Assign a standard frames worth of bits from those allocated
- * to the GF group
- */
- int bak = cpi->per_frame_bandwidth;
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
- assign_std_frame_bits(cpi, &this_frame_copy);
- cpi->per_frame_bandwidth = bak;
- }
- }
-
- /* Otherwise this is an ordinary frame */
- else
- {
- /* Special case: Error error_resilient_mode mode does not make much
- * sense for two pass but with its current meaning but this code is
- * designed to stop outlandish behaviour if someone does set it
- * when using two pass. It effectively disables GF groups. This is
- * temporary code till we decide what should really happen in this
- * case.
- */
- if (cpi->oxcf.error_resilient_mode)
- {
- cpi->frames_till_gf_update_due = cpi->twopass.frames_to_key;
-
- if (cpi->common.frame_type != KEY_FRAME)
- {
- /* Assign bits from those allocated to the GF group */
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
- assign_std_frame_bits(cpi, &this_frame_copy);
- }
- }
- else
- {
- /* Assign bits from those allocated to the GF group */
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
- assign_std_frame_bits(cpi, &this_frame_copy);
- }
- }
-
- /* Keep a globally available copy of this and the next frame's iiratio. */
- cpi->twopass.this_iiratio = (unsigned int)(this_frame_intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame_coded_error));
- {
- FIRSTPASS_STATS next_frame;
- if ( lookup_next_frame_stats(cpi, &next_frame) != EOF )
- {
- cpi->twopass.next_iiratio = (unsigned int)(next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
- }
- }
-
- /* Set nominal per second bandwidth for this frame */
- cpi->target_bandwidth = (int)
- (cpi->per_frame_bandwidth * cpi->output_framerate);
- if (cpi->target_bandwidth < 0)
- cpi->target_bandwidth = 0;
-
-
- /* Account for mv, mode and other overheads. */
- overhead_bits = (int)estimate_modemvcost(
- cpi, &cpi->twopass.total_left_stats );
-
- /* Special case code for first frame. */
- if (cpi->common.current_video_frame == 0)
- {
- cpi->twopass.est_max_qcorrection_factor = 1.0;
-
- /* Set a cq_level in constrained quality mode. */
- if ( cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY )
- {
- int est_cq;
-
- est_cq =
- estimate_cq( cpi,
- &cpi->twopass.total_left_stats,
- (int)(cpi->twopass.bits_left / frames_left),
- overhead_bits );
-
- cpi->cq_target_quality = cpi->oxcf.cq_level;
- if ( est_cq > cpi->cq_target_quality )
- cpi->cq_target_quality = est_cq;
- }
-
- /* guess at maxq needed in 2nd pass */
- cpi->twopass.maxq_max_limit = cpi->worst_quality;
- cpi->twopass.maxq_min_limit = cpi->best_quality;
-
- tmp_q = estimate_max_q(
- cpi,
- &cpi->twopass.total_left_stats,
- (int)(cpi->twopass.bits_left / frames_left),
- overhead_bits );
-
- /* Limit the maxq value returned subsequently.
- * This increases the risk of overspend or underspend if the initial
- * estimate for the clip is bad, but helps prevent excessive
- * variation in Q, especially near the end of a clip
- * where for example a small overspend may cause Q to crash
- */
- cpi->twopass.maxq_max_limit = ((tmp_q + 32) < cpi->worst_quality)
- ? (tmp_q + 32) : cpi->worst_quality;
- cpi->twopass.maxq_min_limit = ((tmp_q - 32) > cpi->best_quality)
- ? (tmp_q - 32) : cpi->best_quality;
-
- cpi->active_worst_quality = tmp_q;
- cpi->ni_av_qi = tmp_q;
- }
-
- /* The last few frames of a clip almost always have to few or too many
- * bits and for the sake of over exact rate control we dont want to make
- * radical adjustments to the allowed quantizer range just to use up a
- * few surplus bits or get beneath the target rate.
- */
- else if ( (cpi->common.current_video_frame <
- (((unsigned int)cpi->twopass.total_stats.count * 255)>>8)) &&
- ((cpi->common.current_video_frame + cpi->baseline_gf_interval) <
- (unsigned int)cpi->twopass.total_stats.count) )
- {
- if (frames_left < 1)
- frames_left = 1;
-
- tmp_q = estimate_max_q(
- cpi,
- &cpi->twopass.total_left_stats,
- (int)(cpi->twopass.bits_left / frames_left),
- overhead_bits );
-
- /* Move active_worst_quality but in a damped way */
- if (tmp_q > cpi->active_worst_quality)
- cpi->active_worst_quality ++;
- else if (tmp_q < cpi->active_worst_quality)
- cpi->active_worst_quality --;
-
- cpi->active_worst_quality =
- ((cpi->active_worst_quality * 3) + tmp_q + 2) / 4;
- }
-
- cpi->twopass.frames_to_key --;
-
- /* Update the total stats remaining sturcture */
- subtract_stats(&cpi->twopass.total_left_stats, &this_frame );
-}
-
-
-static int test_candidate_kf(VP8_COMP *cpi, FIRSTPASS_STATS *last_frame, FIRSTPASS_STATS *this_frame, FIRSTPASS_STATS *next_frame)
-{
- int is_viable_kf = 0;
-
- /* Does the frame satisfy the primary criteria of a key frame
- * If so, then examine how well it predicts subsequent frames
- */
- if ((this_frame->pcnt_second_ref < 0.10) &&
- (next_frame->pcnt_second_ref < 0.10) &&
- ((this_frame->pcnt_inter < 0.05) ||
- (
- ((this_frame->pcnt_inter - this_frame->pcnt_neutral) < .25) &&
- ((this_frame->intra_error / DOUBLE_DIVIDE_CHECK(this_frame->coded_error)) < 2.5) &&
- ((fabs(last_frame->coded_error - this_frame->coded_error) / DOUBLE_DIVIDE_CHECK(this_frame->coded_error) > .40) ||
- (fabs(last_frame->intra_error - this_frame->intra_error) / DOUBLE_DIVIDE_CHECK(this_frame->intra_error) > .40) ||
- ((next_frame->intra_error / DOUBLE_DIVIDE_CHECK(next_frame->coded_error)) > 3.5)
- )
- )
- )
- )
- {
- int i;
- FIRSTPASS_STATS *start_pos;
-
- FIRSTPASS_STATS local_next_frame;
-
- double boost_score = 0.0;
- double old_boost_score = 0.0;
- double decay_accumulator = 1.0;
- double next_iiratio;
-
- vpx_memcpy(&local_next_frame, next_frame, sizeof(*next_frame));
-
- /* Note the starting file position so we can reset to it */
- start_pos = cpi->twopass.stats_in;
-
- /* Examine how well the key frame predicts subsequent frames */
- for (i = 0 ; i < 16; i++)
- {
- next_iiratio = (IIKFACTOR1 * local_next_frame.intra_error / DOUBLE_DIVIDE_CHECK(local_next_frame.coded_error)) ;
-
- if (next_iiratio > RMAX)
- next_iiratio = RMAX;
-
- /* Cumulative effect of decay in prediction quality */
- if (local_next_frame.pcnt_inter > 0.85)
- decay_accumulator = decay_accumulator * local_next_frame.pcnt_inter;
- else
- decay_accumulator = decay_accumulator * ((0.85 + local_next_frame.pcnt_inter) / 2.0);
-
- /* Keep a running total */
- boost_score += (decay_accumulator * next_iiratio);
-
- /* Test various breakout clauses */
- if ((local_next_frame.pcnt_inter < 0.05) ||
- (next_iiratio < 1.5) ||
- (((local_next_frame.pcnt_inter -
- local_next_frame.pcnt_neutral) < 0.20) &&
- (next_iiratio < 3.0)) ||
- ((boost_score - old_boost_score) < 0.5) ||
- (local_next_frame.intra_error < 200)
- )
- {
- break;
- }
-
- old_boost_score = boost_score;
-
- /* Get the next frame details */
- if (EOF == input_stats(cpi, &local_next_frame))
- break;
- }
-
- /* If there is tolerable prediction for at least the next 3 frames
- * then break out else discard this pottential key frame and move on
- */
- if (boost_score > 5.0 && (i > 3))
- is_viable_kf = 1;
- else
- {
- /* Reset the file position */
- reset_fpf_position(cpi, start_pos);
-
- is_viable_kf = 0;
- }
- }
-
- return is_viable_kf;
-}
-static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
-{
- int i,j;
- FIRSTPASS_STATS last_frame;
- FIRSTPASS_STATS first_frame;
- FIRSTPASS_STATS next_frame;
- FIRSTPASS_STATS *start_position;
-
- double decay_accumulator = 1.0;
- double boost_score = 0;
- double old_boost_score = 0.0;
- double loop_decay_rate;
-
- double kf_mod_err = 0.0;
- double kf_group_err = 0.0;
- double kf_group_intra_err = 0.0;
- double kf_group_coded_err = 0.0;
- double recent_loop_decay[8] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0};
-
- vpx_memset(&next_frame, 0, sizeof(next_frame));
-
- vp8_clear_system_state();
- start_position = cpi->twopass.stats_in;
-
- cpi->common.frame_type = KEY_FRAME;
-
- /* is this a forced key frame by interval */
- cpi->this_key_frame_forced = cpi->next_key_frame_forced;
-
- /* Clear the alt ref active flag as this can never be active on a key
- * frame
- */
- cpi->source_alt_ref_active = 0;
-
- /* Kf is always a gf so clear frames till next gf counter */
- cpi->frames_till_gf_update_due = 0;
-
- cpi->twopass.frames_to_key = 1;
-
- /* Take a copy of the initial frame details */
- vpx_memcpy(&first_frame, this_frame, sizeof(*this_frame));
-
- cpi->twopass.kf_group_bits = 0;
- cpi->twopass.kf_group_error_left = 0;
-
- kf_mod_err = calculate_modified_err(cpi, this_frame);
-
- /* find the next keyframe */
- i = 0;
- while (cpi->twopass.stats_in < cpi->twopass.stats_in_end)
- {
- /* Accumulate kf group error */
- kf_group_err += calculate_modified_err(cpi, this_frame);
-
- /* These figures keep intra and coded error counts for all frames
- * including key frames in the group. The effect of the key frame
- * itself can be subtracted out using the first_frame data
- * collected above
- */
- kf_group_intra_err += this_frame->intra_error;
- kf_group_coded_err += this_frame->coded_error;
-
- /* Load the next frame's stats. */
- vpx_memcpy(&last_frame, this_frame, sizeof(*this_frame));
- input_stats(cpi, this_frame);
-
- /* Provided that we are not at the end of the file... */
- if (cpi->oxcf.auto_key
- && lookup_next_frame_stats(cpi, &next_frame) != EOF)
- {
- /* Normal scene cut check */
- if ( ( i >= MIN_GF_INTERVAL ) &&
- test_candidate_kf(cpi, &last_frame, this_frame, &next_frame) )
- {
- break;
- }
-
- /* How fast is prediction quality decaying */
- loop_decay_rate = get_prediction_decay_rate(cpi, &next_frame);
-
- /* We want to know something about the recent past... rather than
- * as used elsewhere where we are concened with decay in prediction
- * quality since the last GF or KF.
- */
- recent_loop_decay[i%8] = loop_decay_rate;
- decay_accumulator = 1.0;
- for (j = 0; j < 8; j++)
- {
- decay_accumulator = decay_accumulator * recent_loop_decay[j];
- }
-
- /* Special check for transition or high motion followed by a
- * static scene.
- */
- if ( detect_transition_to_still( cpi, i,
- (cpi->key_frame_frequency-i),
- loop_decay_rate,
- decay_accumulator ) )
- {
- break;
- }
-
-
- /* Step on to the next frame */
- cpi->twopass.frames_to_key ++;
-
- /* If we don't have a real key frame within the next two
- * forcekeyframeevery intervals then break out of the loop.
- */
- if (cpi->twopass.frames_to_key >= 2 *(int)cpi->key_frame_frequency)
- break;
- } else
- cpi->twopass.frames_to_key ++;
-
- i++;
- }
-
- /* If there is a max kf interval set by the user we must obey it.
- * We already breakout of the loop above at 2x max.
- * This code centers the extra kf if the actual natural
- * interval is between 1x and 2x
- */
- if (cpi->oxcf.auto_key
- && cpi->twopass.frames_to_key > (int)cpi->key_frame_frequency )
- {
- FIRSTPASS_STATS *current_pos = cpi->twopass.stats_in;
- FIRSTPASS_STATS tmp_frame;
-
- cpi->twopass.frames_to_key /= 2;
-
- /* Copy first frame details */
- vpx_memcpy(&tmp_frame, &first_frame, sizeof(first_frame));
-
- /* Reset to the start of the group */
- reset_fpf_position(cpi, start_position);
-
- kf_group_err = 0;
- kf_group_intra_err = 0;
- kf_group_coded_err = 0;
-
- /* Rescan to get the correct error data for the forced kf group */
- for( i = 0; i < cpi->twopass.frames_to_key; i++ )
- {
- /* Accumulate kf group errors */
- kf_group_err += calculate_modified_err(cpi, &tmp_frame);
- kf_group_intra_err += tmp_frame.intra_error;
- kf_group_coded_err += tmp_frame.coded_error;
-
- /* Load a the next frame's stats */
- input_stats(cpi, &tmp_frame);
- }
-
- /* Reset to the start of the group */
- reset_fpf_position(cpi, current_pos);
-
- cpi->next_key_frame_forced = 1;
- }
- else
- cpi->next_key_frame_forced = 0;
-
- /* Special case for the last frame of the file */
- if (cpi->twopass.stats_in >= cpi->twopass.stats_in_end)
- {
- /* Accumulate kf group error */
- kf_group_err += calculate_modified_err(cpi, this_frame);
-
- /* These figures keep intra and coded error counts for all frames
- * including key frames in the group. The effect of the key frame
- * itself can be subtracted out using the first_frame data
- * collected above
- */
- kf_group_intra_err += this_frame->intra_error;
- kf_group_coded_err += this_frame->coded_error;
- }
-
- /* Calculate the number of bits that should be assigned to the kf group. */
- if ((cpi->twopass.bits_left > 0) && (cpi->twopass.modified_error_left > 0.0))
- {
- /* Max for a single normal frame (not key frame) */
- int max_bits = frame_max_bits(cpi);
-
- /* Maximum bits for the kf group */
- int64_t max_grp_bits;
-
- /* Default allocation based on bits left and relative
- * complexity of the section
- */
- cpi->twopass.kf_group_bits = (int64_t)( cpi->twopass.bits_left *
- ( kf_group_err /
- cpi->twopass.modified_error_left ));
-
- /* Clip based on maximum per frame rate defined by the user. */
- max_grp_bits = (int64_t)max_bits * (int64_t)cpi->twopass.frames_to_key;
- if (cpi->twopass.kf_group_bits > max_grp_bits)
- cpi->twopass.kf_group_bits = max_grp_bits;
-
- /* Additional special case for CBR if buffer is getting full. */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- int64_t opt_buffer_lvl = cpi->oxcf.optimal_buffer_level;
- int64_t buffer_lvl = cpi->buffer_level;
-
- /* If the buffer is near or above the optimal and this kf group is
- * not being allocated much then increase the allocation a bit.
- */
- if (buffer_lvl >= opt_buffer_lvl)
- {
- int64_t high_water_mark = (opt_buffer_lvl +
- cpi->oxcf.maximum_buffer_size) >> 1;
-
- int64_t av_group_bits;
-
- /* Av bits per frame * number of frames */
- av_group_bits = (int64_t)cpi->av_per_frame_bandwidth *
- (int64_t)cpi->twopass.frames_to_key;
-
- /* We are at or above the maximum. */
- if (cpi->buffer_level >= high_water_mark)
- {
- int64_t min_group_bits;
-
- min_group_bits = av_group_bits +
- (int64_t)(buffer_lvl -
- high_water_mark);
-
- if (cpi->twopass.kf_group_bits < min_group_bits)
- cpi->twopass.kf_group_bits = min_group_bits;
- }
- /* We are above optimal but below the maximum */
- else if (cpi->twopass.kf_group_bits < av_group_bits)
- {
- int64_t bits_below_av = av_group_bits -
- cpi->twopass.kf_group_bits;
-
- cpi->twopass.kf_group_bits +=
- (int64_t)((double)bits_below_av *
- (double)(buffer_lvl - opt_buffer_lvl) /
- (double)(high_water_mark - opt_buffer_lvl));
- }
- }
- }
- }
- else
- cpi->twopass.kf_group_bits = 0;
-
- /* Reset the first pass file position */
- reset_fpf_position(cpi, start_position);
-
- /* determine how big to make this keyframe based on how well the
- * subsequent frames use inter blocks
- */
- decay_accumulator = 1.0;
- boost_score = 0.0;
- loop_decay_rate = 1.00; /* Starting decay rate */
-
- for (i = 0 ; i < cpi->twopass.frames_to_key ; i++)
- {
- double r;
-
- if (EOF == input_stats(cpi, &next_frame))
- break;
-
- if (next_frame.intra_error > cpi->twopass.kf_intra_err_min)
- r = (IIKFACTOR2 * next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
- else
- r = (IIKFACTOR2 * cpi->twopass.kf_intra_err_min /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
-
- if (r > RMAX)
- r = RMAX;
-
- /* How fast is prediction quality decaying */
- loop_decay_rate = get_prediction_decay_rate(cpi, &next_frame);
-
- decay_accumulator = decay_accumulator * loop_decay_rate;
- decay_accumulator = decay_accumulator < 0.1 ? 0.1 : decay_accumulator;
-
- boost_score += (decay_accumulator * r);
-
- if ((i > MIN_GF_INTERVAL) &&
- ((boost_score - old_boost_score) < 1.0))
- {
- break;
- }
-
- old_boost_score = boost_score;
- }
-
- if (1)
- {
- FIRSTPASS_STATS sectionstats;
- double Ratio;
-
- zero_stats(&sectionstats);
- reset_fpf_position(cpi, start_position);
-
- for (i = 0 ; i < cpi->twopass.frames_to_key ; i++)
- {
- input_stats(cpi, &next_frame);
- accumulate_stats(&sectionstats, &next_frame);
- }
-
- avg_stats(&sectionstats);
-
- cpi->twopass.section_intra_rating = (unsigned int)
- (sectionstats.intra_error
- / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error));
-
- Ratio = sectionstats.intra_error / DOUBLE_DIVIDE_CHECK(sectionstats.coded_error);
- cpi->twopass.section_max_qfactor = 1.0 - ((Ratio - 10.0) * 0.025);
-
- if (cpi->twopass.section_max_qfactor < 0.80)
- cpi->twopass.section_max_qfactor = 0.80;
- }
-
- /* When using CBR apply additional buffer fullness related upper limits */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- double max_boost;
-
- if (cpi->drop_frames_allowed)
- {
- int df_buffer_level = (int)(cpi->oxcf.drop_frames_water_mark
- * (cpi->oxcf.optimal_buffer_level / 100));
-
- if (cpi->buffer_level > df_buffer_level)
- max_boost = ((double)((cpi->buffer_level - df_buffer_level) * 2 / 3) * 16.0) / DOUBLE_DIVIDE_CHECK((double)cpi->av_per_frame_bandwidth);
- else
- max_boost = 0.0;
- }
- else if (cpi->buffer_level > 0)
- {
- max_boost = ((double)(cpi->buffer_level * 2 / 3) * 16.0) / DOUBLE_DIVIDE_CHECK((double)cpi->av_per_frame_bandwidth);
- }
- else
- {
- max_boost = 0.0;
- }
-
- if (boost_score > max_boost)
- boost_score = max_boost;
- }
-
- /* Reset the first pass file position */
- reset_fpf_position(cpi, start_position);
-
- /* Work out how many bits to allocate for the key frame itself */
- if (1)
- {
- int kf_boost = (int)boost_score;
- int allocation_chunks;
- int Counter = cpi->twopass.frames_to_key;
- int alt_kf_bits;
- YV12_BUFFER_CONFIG *lst_yv12 = &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
- /* Min boost based on kf interval */
-#if 0
-
- while ((kf_boost < 48) && (Counter > 0))
- {
- Counter -= 2;
- kf_boost ++;
- }
-
-#endif
-
- if (kf_boost < 48)
- {
- kf_boost += ((Counter + 1) >> 1);
-
- if (kf_boost > 48) kf_boost = 48;
- }
-
- /* bigger frame sizes need larger kf boosts, smaller frames smaller
- * boosts...
- */
- if ((lst_yv12->y_width * lst_yv12->y_height) > (320 * 240))
- kf_boost += 2 * (lst_yv12->y_width * lst_yv12->y_height) / (320 * 240);
- else if ((lst_yv12->y_width * lst_yv12->y_height) < (320 * 240))
- kf_boost -= 4 * (320 * 240) / (lst_yv12->y_width * lst_yv12->y_height);
-
- /* Min KF boost */
- kf_boost = (int)((double)kf_boost * 100.0) >> 4; /* Scale 16 to 100 */
- if (kf_boost < 250)
- kf_boost = 250;
-
- /*
- * We do three calculations for kf size.
- * The first is based on the error score for the whole kf group.
- * The second (optionaly) on the key frames own error if this is
- * smaller than the average for the group.
- * The final one insures that the frame receives at least the
- * allocation it would have received based on its own error score vs
- * the error score remaining
- * Special case if the sequence appears almost totaly static
- * as measured by the decay accumulator. In this case we want to
- * spend almost all of the bits on the key frame.
- * cpi->twopass.frames_to_key-1 because key frame itself is taken
- * care of by kf_boost.
- */
- if ( decay_accumulator >= 0.99 )
- {
- allocation_chunks =
- ((cpi->twopass.frames_to_key - 1) * 10) + kf_boost;
- }
- else
- {
- allocation_chunks =
- ((cpi->twopass.frames_to_key - 1) * 100) + kf_boost;
- }
-
- /* Normalize Altboost and allocations chunck down to prevent overflow */
- while (kf_boost > 1000)
- {
- kf_boost /= 2;
- allocation_chunks /= 2;
- }
-
- cpi->twopass.kf_group_bits = (cpi->twopass.kf_group_bits < 0) ? 0 : cpi->twopass.kf_group_bits;
-
- /* Calculate the number of bits to be spent on the key frame */
- cpi->twopass.kf_bits = (int)((double)kf_boost * ((double)cpi->twopass.kf_group_bits / (double)allocation_chunks));
-
- /* Apply an additional limit for CBR */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- if (cpi->twopass.kf_bits > (int)((3 * cpi->buffer_level) >> 2))
- cpi->twopass.kf_bits = (int)((3 * cpi->buffer_level) >> 2);
- }
-
- /* If the key frame is actually easier than the average for the
- * kf group (which does sometimes happen... eg a blank intro frame)
- * Then use an alternate calculation based on the kf error score
- * which should give a smaller key frame.
- */
- if (kf_mod_err < kf_group_err / cpi->twopass.frames_to_key)
- {
- double alt_kf_grp_bits =
- ((double)cpi->twopass.bits_left *
- (kf_mod_err * (double)cpi->twopass.frames_to_key) /
- DOUBLE_DIVIDE_CHECK(cpi->twopass.modified_error_left));
-
- alt_kf_bits = (int)((double)kf_boost *
- (alt_kf_grp_bits / (double)allocation_chunks));
-
- if (cpi->twopass.kf_bits > alt_kf_bits)
- {
- cpi->twopass.kf_bits = alt_kf_bits;
- }
- }
- /* Else if it is much harder than other frames in the group make sure
- * it at least receives an allocation in keeping with its relative
- * error score
- */
- else
- {
- alt_kf_bits =
- (int)((double)cpi->twopass.bits_left *
- (kf_mod_err /
- DOUBLE_DIVIDE_CHECK(cpi->twopass.modified_error_left)));
-
- if (alt_kf_bits > cpi->twopass.kf_bits)
- {
- cpi->twopass.kf_bits = alt_kf_bits;
- }
- }
-
- cpi->twopass.kf_group_bits -= cpi->twopass.kf_bits;
- /* Add in the minimum frame allowance */
- cpi->twopass.kf_bits += cpi->min_frame_bandwidth;
-
- /* Peer frame bit target for this frame */
- cpi->per_frame_bandwidth = cpi->twopass.kf_bits;
-
- /* Convert to a per second bitrate */
- cpi->target_bandwidth = (int)(cpi->twopass.kf_bits *
- cpi->output_framerate);
- }
-
- /* Note the total error score of the kf group minus the key frame itself */
- cpi->twopass.kf_group_error_left = (int)(kf_group_err - kf_mod_err);
-
- /* Adjust the count of total modified error left. The count of bits left
- * is adjusted elsewhere based on real coded frame sizes
- */
- cpi->twopass.modified_error_left -= kf_group_err;
-
- if (cpi->oxcf.allow_spatial_resampling)
- {
- int resample_trigger = 0;
- int last_kf_resampled = 0;
- int kf_q;
- int scale_val = 0;
- int hr, hs, vr, vs;
- int new_width = cpi->oxcf.Width;
- int new_height = cpi->oxcf.Height;
-
- int projected_buffer_level = (int)cpi->buffer_level;
- int tmp_q;
-
- double projected_bits_perframe;
- double group_iiratio = (kf_group_intra_err - first_frame.intra_error) / (kf_group_coded_err - first_frame.coded_error);
- double err_per_frame = kf_group_err / cpi->twopass.frames_to_key;
- double bits_per_frame;
- double av_bits_per_frame;
- double effective_size_ratio;
-
- if ((cpi->common.Width != cpi->oxcf.Width) || (cpi->common.Height != cpi->oxcf.Height))
- last_kf_resampled = 1;
-
- /* Set back to unscaled by defaults */
- cpi->common.horiz_scale = NORMAL;
- cpi->common.vert_scale = NORMAL;
-
- /* Calculate Average bits per frame. */
- av_bits_per_frame = cpi->oxcf.target_bandwidth / DOUBLE_DIVIDE_CHECK((double)cpi->framerate);
-
- /* CBR... Use the clip average as the target for deciding resample */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- bits_per_frame = av_bits_per_frame;
- }
-
- /* In VBR we want to avoid downsampling in easy section unless we
- * are under extreme pressure So use the larger of target bitrate
- * for this section or average bitrate for sequence
- */
- else
- {
- /* This accounts for how hard the section is... */
- bits_per_frame = (double)
- (cpi->twopass.kf_group_bits / cpi->twopass.frames_to_key);
-
- /* Dont turn to resampling in easy sections just because they
- * have been assigned a small number of bits
- */
- if (bits_per_frame < av_bits_per_frame)
- bits_per_frame = av_bits_per_frame;
- }
-
- /* bits_per_frame should comply with our minimum */
- if (bits_per_frame < (cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100))
- bits_per_frame = (cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
-
- /* Work out if spatial resampling is necessary */
- kf_q = estimate_kf_group_q(cpi, err_per_frame,
- (int)bits_per_frame, group_iiratio);
-
- /* If we project a required Q higher than the maximum allowed Q then
- * make a guess at the actual size of frames in this section
- */
- projected_bits_perframe = bits_per_frame;
- tmp_q = kf_q;
-
- while (tmp_q > cpi->worst_quality)
- {
- projected_bits_perframe *= 1.04;
- tmp_q--;
- }
-
- /* Guess at buffer level at the end of the section */
- projected_buffer_level = (int)
- (cpi->buffer_level - (int)
- ((projected_bits_perframe - av_bits_per_frame) *
- cpi->twopass.frames_to_key));
-
- if (0)
- {
- FILE *f = fopen("Subsamle.stt", "a");
- fprintf(f, " %8d %8d %8d %8d %12.0f %8d %8d %8d\n", cpi->common.current_video_frame, kf_q, cpi->common.horiz_scale, cpi->common.vert_scale, kf_group_err / cpi->twopass.frames_to_key, (int)(cpi->twopass.kf_group_bits / cpi->twopass.frames_to_key), new_height, new_width);
- fclose(f);
- }
-
- /* The trigger for spatial resampling depends on the various
- * parameters such as whether we are streaming (CBR) or VBR.
- */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- /* Trigger resample if we are projected to fall below down
- * sample level or resampled last time and are projected to
- * remain below the up sample level
- */
- if ((projected_buffer_level < (cpi->oxcf.resample_down_water_mark * cpi->oxcf.optimal_buffer_level / 100)) ||
- (last_kf_resampled && (projected_buffer_level < (cpi->oxcf.resample_up_water_mark * cpi->oxcf.optimal_buffer_level / 100))))
- resample_trigger = 1;
- else
- resample_trigger = 0;
- }
- else
- {
- int64_t clip_bits = (int64_t)(cpi->twopass.total_stats.count * cpi->oxcf.target_bandwidth / DOUBLE_DIVIDE_CHECK((double)cpi->framerate));
- int64_t over_spend = cpi->oxcf.starting_buffer_level - cpi->buffer_level;
-
- /* If triggered last time the threshold for triggering again is
- * reduced:
- *
- * Projected Q higher than allowed and Overspend > 5% of total
- * bits
- */
- if ((last_kf_resampled && (kf_q > cpi->worst_quality)) ||
- ((kf_q > cpi->worst_quality) &&
- (over_spend > clip_bits / 20)))
- resample_trigger = 1;
- else
- resample_trigger = 0;
-
- }
-
- if (resample_trigger)
- {
- while ((kf_q >= cpi->worst_quality) && (scale_val < 6))
- {
- scale_val ++;
-
- cpi->common.vert_scale = vscale_lookup[scale_val];
- cpi->common.horiz_scale = hscale_lookup[scale_val];
-
- Scale2Ratio(cpi->common.horiz_scale, &hr, &hs);
- Scale2Ratio(cpi->common.vert_scale, &vr, &vs);
-
- new_width = ((hs - 1) + (cpi->oxcf.Width * hr)) / hs;
- new_height = ((vs - 1) + (cpi->oxcf.Height * vr)) / vs;
-
- /* Reducing the area to 1/4 does not reduce the complexity
- * (err_per_frame) to 1/4... effective_sizeratio attempts
- * to provide a crude correction for this
- */
- effective_size_ratio = (double)(new_width * new_height) / (double)(cpi->oxcf.Width * cpi->oxcf.Height);
- effective_size_ratio = (1.0 + (3.0 * effective_size_ratio)) / 4.0;
-
- /* Now try again and see what Q we get with the smaller
- * image size
- */
- kf_q = estimate_kf_group_q(cpi,
- err_per_frame * effective_size_ratio,
- (int)bits_per_frame, group_iiratio);
-
- if (0)
- {
- FILE *f = fopen("Subsamle.stt", "a");
- fprintf(f, "******** %8d %8d %8d %12.0f %8d %8d %8d\n", kf_q, cpi->common.horiz_scale, cpi->common.vert_scale, kf_group_err / cpi->twopass.frames_to_key, (int)(cpi->twopass.kf_group_bits / cpi->twopass.frames_to_key), new_height, new_width);
- fclose(f);
- }
- }
- }
-
- if ((cpi->common.Width != new_width) || (cpi->common.Height != new_height))
- {
- cpi->common.Width = new_width;
- cpi->common.Height = new_height;
- vp8_alloc_compressor_data(cpi);
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.h
deleted file mode 100644
index c409ebc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/firstpass.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_FIRSTPASS_H_
-#define VP8_ENCODER_FIRSTPASS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void vp8_init_first_pass(VP8_COMP *cpi);
-extern void vp8_first_pass(VP8_COMP *cpi);
-extern void vp8_end_first_pass(VP8_COMP *cpi);
-
-extern void vp8_init_second_pass(VP8_COMP *cpi);
-extern void vp8_second_pass(VP8_COMP *cpi);
-extern void vp8_end_second_pass(VP8_COMP *cpi);
-
-extern size_t vp8_firstpass_stats_sz(unsigned int mb_count);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_FIRSTPASS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.c
deleted file mode 100644
index ce2ce08..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <assert.h>
-#include <stdlib.h>
-#include "vpx_config.h"
-#include "lookahead.h"
-#include "vp8/common/extend.h"
-
-#define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25)
-
-struct lookahead_ctx
-{
- unsigned int max_sz; /* Absolute size of the queue */
- unsigned int sz; /* Number of buffers currently in the queue */
- unsigned int read_idx; /* Read index */
- unsigned int write_idx; /* Write index */
- struct lookahead_entry *buf; /* Buffer list */
-};
-
-
-/* Return the buffer at the given absolute index and increment the index */
-static struct lookahead_entry *
-pop(struct lookahead_ctx *ctx,
- unsigned int *idx)
-{
- unsigned int index = *idx;
- struct lookahead_entry *buf = ctx->buf + index;
-
- assert(index < ctx->max_sz);
- if(++index >= ctx->max_sz)
- index -= ctx->max_sz;
- *idx = index;
- return buf;
-}
-
-
-void
-vp8_lookahead_destroy(struct lookahead_ctx *ctx)
-{
- if(ctx)
- {
- if(ctx->buf)
- {
- unsigned int i;
-
- for(i = 0; i < ctx->max_sz; i++)
- vp8_yv12_de_alloc_frame_buffer(&ctx->buf[i].img);
- free(ctx->buf);
- }
- free(ctx);
- }
-}
-
-
-struct lookahead_ctx*
-vp8_lookahead_init(unsigned int width,
- unsigned int height,
- unsigned int depth)
-{
- struct lookahead_ctx *ctx = NULL;
- unsigned int i;
-
- /* Clamp the lookahead queue depth */
- if(depth < 1)
- depth = 1;
- else if(depth > MAX_LAG_BUFFERS)
- depth = MAX_LAG_BUFFERS;
-
- /* Keep last frame in lookahead buffer by increasing depth by 1.*/
- depth += 1;
-
- /* Align the buffer dimensions */
- width = (width + 15) & ~15;
- height = (height + 15) & ~15;
-
- /* Allocate the lookahead structures */
- ctx = calloc(1, sizeof(*ctx));
- if(ctx)
- {
- ctx->max_sz = depth;
- ctx->buf = calloc(depth, sizeof(*ctx->buf));
- if(!ctx->buf)
- goto bail;
- for(i=0; i<depth; i++)
- if (vp8_yv12_alloc_frame_buffer(&ctx->buf[i].img,
- width, height, VP8BORDERINPIXELS))
- goto bail;
- }
- return ctx;
-bail:
- vp8_lookahead_destroy(ctx);
- return NULL;
-}
-
-
-int
-vp8_lookahead_push(struct lookahead_ctx *ctx,
- YV12_BUFFER_CONFIG *src,
- int64_t ts_start,
- int64_t ts_end,
- unsigned int flags,
- unsigned char *active_map)
-{
- struct lookahead_entry* buf;
- int row, col, active_end;
- int mb_rows = (src->y_height + 15) >> 4;
- int mb_cols = (src->y_width + 15) >> 4;
-
- if(ctx->sz + 2 > ctx->max_sz)
- return 1;
- ctx->sz++;
- buf = pop(ctx, &ctx->write_idx);
-
- /* Only do this partial copy if the following conditions are all met:
- * 1. Lookahead queue has has size of 1.
- * 2. Active map is provided.
- * 3. This is not a key frame, golden nor altref frame.
- */
- if (ctx->max_sz == 1 && active_map && !flags)
- {
- for (row = 0; row < mb_rows; ++row)
- {
- col = 0;
-
- while (1)
- {
- /* Find the first active macroblock in this row. */
- for (; col < mb_cols; ++col)
- {
- if (active_map[col])
- break;
- }
-
- /* No more active macroblock in this row. */
- if (col == mb_cols)
- break;
-
- /* Find the end of active region in this row. */
- active_end = col;
-
- for (; active_end < mb_cols; ++active_end)
- {
- if (!active_map[active_end])
- break;
- }
-
- /* Only copy this active region. */
- vp8_copy_and_extend_frame_with_rect(src, &buf->img,
- row << 4,
- col << 4, 16,
- (active_end - col) << 4);
-
- /* Start again from the end of this active region. */
- col = active_end;
- }
-
- active_map += mb_cols;
- }
- }
- else
- {
- vp8_copy_and_extend_frame(src, &buf->img);
- }
- buf->ts_start = ts_start;
- buf->ts_end = ts_end;
- buf->flags = flags;
- return 0;
-}
-
-
-struct lookahead_entry*
-vp8_lookahead_pop(struct lookahead_ctx *ctx,
- int drain)
-{
- struct lookahead_entry* buf = NULL;
-
- if(ctx->sz && (drain || ctx->sz == ctx->max_sz - 1))
- {
- buf = pop(ctx, &ctx->read_idx);
- ctx->sz--;
- }
- return buf;
-}
-
-
-struct lookahead_entry*
-vp8_lookahead_peek(struct lookahead_ctx *ctx,
- unsigned int index,
- int direction)
-{
- struct lookahead_entry* buf = NULL;
-
- if (direction == PEEK_FORWARD)
- {
- assert(index < ctx->max_sz - 1);
- if(index < ctx->sz)
- {
- index += ctx->read_idx;
- if(index >= ctx->max_sz)
- index -= ctx->max_sz;
- buf = ctx->buf + index;
- }
- }
- else if (direction == PEEK_BACKWARD)
- {
- assert(index == 1);
-
- if(ctx->read_idx == 0)
- index = ctx->max_sz - 1;
- else
- index = ctx->read_idx - index;
- buf = ctx->buf + index;
- }
-
- return buf;
-}
-
-
-unsigned int
-vp8_lookahead_depth(struct lookahead_ctx *ctx)
-{
- return ctx->sz;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.h
deleted file mode 100644
index cad68e6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/lookahead.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VP8_ENCODER_LOOKAHEAD_H_
-#define VP8_ENCODER_LOOKAHEAD_H_
-#include "vpx_scale/yv12config.h"
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct lookahead_entry
-{
- YV12_BUFFER_CONFIG img;
- int64_t ts_start;
- int64_t ts_end;
- unsigned int flags;
-};
-
-
-struct lookahead_ctx;
-
-/**\brief Initializes the lookahead stage
- *
- * The lookahead stage is a queue of frame buffers on which some analysis
- * may be done when buffers are enqueued.
- *
- *
- */
-struct lookahead_ctx* vp8_lookahead_init(unsigned int width,
- unsigned int height,
- unsigned int depth
- );
-
-
-/**\brief Destroys the lookahead stage
- *
- */
-void vp8_lookahead_destroy(struct lookahead_ctx *ctx);
-
-
-/**\brief Enqueue a source buffer
- *
- * This function will copy the source image into a new framebuffer with
- * the expected stride/border.
- *
- * If active_map is non-NULL and there is only one frame in the queue, then copy
- * only active macroblocks.
- *
- * \param[in] ctx Pointer to the lookahead context
- * \param[in] src Pointer to the image to enqueue
- * \param[in] ts_start Timestamp for the start of this frame
- * \param[in] ts_end Timestamp for the end of this frame
- * \param[in] flags Flags set on this frame
- * \param[in] active_map Map that specifies which macroblock is active
- */
-int
-vp8_lookahead_push(struct lookahead_ctx *ctx,
- YV12_BUFFER_CONFIG *src,
- int64_t ts_start,
- int64_t ts_end,
- unsigned int flags,
- unsigned char *active_map);
-
-
-/**\brief Get the next source buffer to encode
- *
- *
- * \param[in] ctx Pointer to the lookahead context
- * \param[in] drain Flag indicating the buffer should be drained
- * (return a buffer regardless of the current queue depth)
- *
- * \retval NULL, if drain set and queue is empty
- * \retval NULL, if drain not set and queue not of the configured depth
- *
- */
-struct lookahead_entry*
-vp8_lookahead_pop(struct lookahead_ctx *ctx,
- int drain);
-
-
-#define PEEK_FORWARD 1
-#define PEEK_BACKWARD -1
-/**\brief Get a future source buffer to encode
- *
- * \param[in] ctx Pointer to the lookahead context
- * \param[in] index Index of the frame to be returned, 0 == next frame
- *
- * \retval NULL, if no buffer exists at the specified index
- *
- */
-struct lookahead_entry*
-vp8_lookahead_peek(struct lookahead_ctx *ctx,
- unsigned int index,
- int direction);
-
-
-/**\brief Get the number of frames currently in the lookahead queue
- *
- * \param[in] ctx Pointer to the lookahead context
- */
-unsigned int
-vp8_lookahead_depth(struct lookahead_ctx *ctx);
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_LOOKAHEAD_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.c
deleted file mode 100644
index 6e2e394..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.c
+++ /dev/null
@@ -1,2031 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "onyx_int.h"
-#include "mcomp.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_config.h"
-#include <stdio.h>
-#include <limits.h>
-#include <math.h>
-#include "vp8/common/findnearmv.h"
-
-#ifdef VP8_ENTROPY_STATS
-static int mv_ref_ct [31] [4] [2];
-static int mv_mode_cts [4] [2];
-#endif
-
-int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight)
-{
- /* MV costing is based on the distribution of vectors in the previous
- * frame and as such will tend to over state the cost of vectors. In
- * addition coding a new vector can have a knock on effect on the cost
- * of subsequent vectors and the quality of prediction from NEAR and
- * NEAREST for subsequent blocks. The "Weight" parameter allows, to a
- * limited extent, for some account to be taken of these factors.
- */
- return ((mvcost[0][(mv->as_mv.row - ref->as_mv.row) >> 1] + mvcost[1][(mv->as_mv.col - ref->as_mv.col) >> 1]) * Weight) >> 7;
-}
-
-static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int error_per_bit)
-{
- /* Ignore mv costing if mvcost is NULL */
- if (mvcost)
- return ((mvcost[0][(mv->as_mv.row - ref->as_mv.row) >> 1] +
- mvcost[1][(mv->as_mv.col - ref->as_mv.col) >> 1])
- * error_per_bit + 128) >> 8;
- return 0;
-}
-
-static int mvsad_err_cost(int_mv *mv, int_mv *ref, int *mvsadcost[2], int error_per_bit)
-{
- /* Calculate sad error cost on full pixel basis. */
- /* Ignore mv costing if mvsadcost is NULL */
- if (mvsadcost)
- return ((mvsadcost[0][(mv->as_mv.row - ref->as_mv.row)] +
- mvsadcost[1][(mv->as_mv.col - ref->as_mv.col)])
- * error_per_bit + 128) >> 8;
- return 0;
-}
-
-void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride)
-{
- int Len;
- int search_site_count = 0;
-
-
- /* Generate offsets for 4 search sites per step. */
- Len = MAX_FIRST_STEP;
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = 0;
- search_site_count++;
-
- while (Len > 0)
- {
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = -Len;
- x->ss[search_site_count].offset = -Len * stride;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = Len;
- x->ss[search_site_count].offset = Len * stride;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = -Len;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = -Len;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = Len;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = Len;
- search_site_count++;
-
- /* Contract. */
- Len /= 2;
- }
-
- x->ss_count = search_site_count;
- x->searches_per_step = 4;
-}
-
-void vp8_init3smotion_compensation(MACROBLOCK *x, int stride)
-{
- int Len;
- int search_site_count = 0;
-
- /* Generate offsets for 8 search sites per step. */
- Len = MAX_FIRST_STEP;
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = 0;
- search_site_count++;
-
- while (Len > 0)
- {
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = -Len;
- x->ss[search_site_count].offset = -Len * stride;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = Len;
- x->ss[search_site_count].offset = Len * stride;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = -Len;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = -Len;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = Len;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = Len;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = -Len;
- x->ss[search_site_count].mv.row = -Len;
- x->ss[search_site_count].offset = -Len * stride - Len;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = Len;
- x->ss[search_site_count].mv.row = -Len;
- x->ss[search_site_count].offset = -Len * stride + Len;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = -Len;
- x->ss[search_site_count].mv.row = Len;
- x->ss[search_site_count].offset = Len * stride - Len;
- search_site_count++;
-
- /* Compute offsets for search sites. */
- x->ss[search_site_count].mv.col = Len;
- x->ss[search_site_count].mv.row = Len;
- x->ss[search_site_count].offset = Len * stride + Len;
- search_site_count++;
-
-
- /* Contract. */
- Len /= 2;
- }
-
- x->ss_count = search_site_count;
- x->searches_per_step = 8;
-}
-
-/*
- * To avoid the penalty for crossing cache-line read, preload the reference
- * area in a small buffer, which is aligned to make sure there won't be crossing
- * cache-line read while reading from this buffer. This reduced the cpu
- * cycles spent on reading ref data in sub-pixel filter functions.
- * TODO: Currently, since sub-pixel search range here is -3 ~ 3, copy 22 rows x
- * 32 cols area that is enough for 16x16 macroblock. Later, for SPLITMV, we
- * could reduce the area.
- */
-
-/* estimated cost of a motion vector (r,c) */
-#define MVC(r,c) (mvcost ? ((mvcost[0][(r)-rr] + mvcost[1][(c) - rc]) * error_per_bit + 128 )>>8 : 0)
-/* pointer to predictor base of a motionvector */
-#define PRE(r,c) (y + (((r)>>2) * y_stride + ((c)>>2) -(offset)))
-/* convert motion vector component to offset for svf calc */
-#define SP(x) (((x)&3)<<1)
-/* returns subpixel variance error function. */
-#define DIST(r,c) vfp->svf( PRE(r,c), y_stride, SP(c),SP(r), z,b->src_stride,&sse)
-#define IFMVCV(r,c,s,e) if ( c >= minc && c <= maxc && r >= minr && r <= maxr) s else e;
-/* returns distortion + motion vector cost */
-#define ERR(r,c) (MVC(r,c)+DIST(r,c))
-/* checks if (r,c) has better score than previous best */
-#define CHECK_BETTER(v,r,c) IFMVCV(r,c,{thismse = DIST(r,c); if((v = (MVC(r,c)+thismse)) < besterr) { besterr = v; br=r; bc=c; *distortion = thismse; *sse1 = sse; }}, v=UINT_MAX;)
-
-int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
- int_mv *bestmv, int_mv *ref_mv,
- int error_per_bit,
- const vp8_variance_fn_ptr_t *vfp,
- int *mvcost[2], int *distortion,
- unsigned int *sse1)
-{
- unsigned char *z = (*(b->base_src) + b->src);
-
- int rr = ref_mv->as_mv.row >> 1, rc = ref_mv->as_mv.col >> 1;
- int br = bestmv->as_mv.row * 4, bc = bestmv->as_mv.col * 4;
- int tr = br, tc = bc;
- unsigned int besterr;
- unsigned int left, right, up, down, diag;
- unsigned int sse;
- unsigned int whichdir;
- unsigned int halfiters = 4;
- unsigned int quarteriters = 4;
- int thismse;
-
- int minc = MAX(x->mv_col_min * 4,
- (ref_mv->as_mv.col >> 1) - ((1 << mvlong_width) - 1));
- int maxc = MIN(x->mv_col_max * 4,
- (ref_mv->as_mv.col >> 1) + ((1 << mvlong_width) - 1));
- int minr = MAX(x->mv_row_min * 4,
- (ref_mv->as_mv.row >> 1) - ((1 << mvlong_width) - 1));
- int maxr = MIN(x->mv_row_max * 4,
- (ref_mv->as_mv.row >> 1) + ((1 << mvlong_width) - 1));
-
- int y_stride;
- int offset;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
-
-
-#if ARCH_X86_32 || ARCH_X86_64
- MACROBLOCKD *xd = &x->e_mbd;
- unsigned char *y_0 = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
- unsigned char *y;
- int buf_r1, buf_r2, buf_c1;
-
- /* Clamping to avoid out-of-range data access */
- buf_r1 = ((bestmv->as_mv.row - 3) < x->mv_row_min)?(bestmv->as_mv.row - x->mv_row_min):3;
- buf_r2 = ((bestmv->as_mv.row + 3) > x->mv_row_max)?(x->mv_row_max - bestmv->as_mv.row):3;
- buf_c1 = ((bestmv->as_mv.col - 3) < x->mv_col_min)?(bestmv->as_mv.col - x->mv_col_min):3;
- y_stride = 32;
-
- /* Copy to intermediate buffer before searching. */
- vfp->copymem(y_0 - buf_c1 - pre_stride*buf_r1, pre_stride, xd->y_buf, y_stride, 16+buf_r1+buf_r2);
- y = xd->y_buf + y_stride*buf_r1 +buf_c1;
-#else
- unsigned char *y = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
- y_stride = pre_stride;
-#endif
-
- offset = (bestmv->as_mv.row) * y_stride + bestmv->as_mv.col;
-
- /* central mv */
- bestmv->as_mv.row *= 8;
- bestmv->as_mv.col *= 8;
-
- /* calculate central point error */
- besterr = vfp->vf(y, y_stride, z, b->src_stride, sse1);
- *distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
-
- /* TODO: Each subsequent iteration checks at least one point in common
- * with the last iteration could be 2 ( if diag selected)
- */
- while (--halfiters)
- {
- /* 1/2 pel */
- CHECK_BETTER(left, tr, tc - 2);
- CHECK_BETTER(right, tr, tc + 2);
- CHECK_BETTER(up, tr - 2, tc);
- CHECK_BETTER(down, tr + 2, tc);
-
- whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
-
- switch (whichdir)
- {
- case 0:
- CHECK_BETTER(diag, tr - 2, tc - 2);
- break;
- case 1:
- CHECK_BETTER(diag, tr - 2, tc + 2);
- break;
- case 2:
- CHECK_BETTER(diag, tr + 2, tc - 2);
- break;
- case 3:
- CHECK_BETTER(diag, tr + 2, tc + 2);
- break;
- }
-
- /* no reason to check the same one again. */
- if (tr == br && tc == bc)
- break;
-
- tr = br;
- tc = bc;
- }
-
- /* TODO: Each subsequent iteration checks at least one point in common
- * with the last iteration could be 2 ( if diag selected)
- */
-
- /* 1/4 pel */
- while (--quarteriters)
- {
- CHECK_BETTER(left, tr, tc - 1);
- CHECK_BETTER(right, tr, tc + 1);
- CHECK_BETTER(up, tr - 1, tc);
- CHECK_BETTER(down, tr + 1, tc);
-
- whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
-
- switch (whichdir)
- {
- case 0:
- CHECK_BETTER(diag, tr - 1, tc - 1);
- break;
- case 1:
- CHECK_BETTER(diag, tr - 1, tc + 1);
- break;
- case 2:
- CHECK_BETTER(diag, tr + 1, tc - 1);
- break;
- case 3:
- CHECK_BETTER(diag, tr + 1, tc + 1);
- break;
- }
-
- /* no reason to check the same one again. */
- if (tr == br && tc == bc)
- break;
-
- tr = br;
- tc = bc;
- }
-
- bestmv->as_mv.row = br * 2;
- bestmv->as_mv.col = bc * 2;
-
- if ((abs(bestmv->as_mv.col - ref_mv->as_mv.col) > (MAX_FULL_PEL_VAL<<3)) ||
- (abs(bestmv->as_mv.row - ref_mv->as_mv.row) > (MAX_FULL_PEL_VAL<<3)))
- return INT_MAX;
-
- return besterr;
-}
-#undef MVC
-#undef PRE
-#undef SP
-#undef DIST
-#undef IFMVCV
-#undef ERR
-#undef CHECK_BETTER
-
-int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
- int_mv *bestmv, int_mv *ref_mv,
- int error_per_bit,
- const vp8_variance_fn_ptr_t *vfp,
- int *mvcost[2], int *distortion,
- unsigned int *sse1)
-{
- int bestmse = INT_MAX;
- int_mv startmv;
- int_mv this_mv;
- unsigned char *z = (*(b->base_src) + b->src);
- int left, right, up, down, diag;
- unsigned int sse;
- int whichdir ;
- int thismse;
- int y_stride;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
-
-#if ARCH_X86_32 || ARCH_X86_64
- MACROBLOCKD *xd = &x->e_mbd;
- unsigned char *y_0 = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
- unsigned char *y;
-
- y_stride = 32;
- /* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
- vfp->copymem(y_0 - 1 - pre_stride, pre_stride, xd->y_buf, y_stride, 18);
- y = xd->y_buf + y_stride + 1;
-#else
- unsigned char *y = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
- y_stride = pre_stride;
-#endif
-
- /* central mv */
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
- startmv = *bestmv;
-
- /* calculate central point error */
- bestmse = vfp->vf(y, y_stride, z, b->src_stride, sse1);
- *distortion = bestmse;
- bestmse += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
-
- /* go left then right and check error */
- this_mv.as_mv.row = startmv.as_mv.row;
- this_mv.as_mv.col = ((startmv.as_mv.col - 8) | 4);
- thismse = vfp->svf_halfpix_h(y - 1, y_stride, z, b->src_stride, &sse);
- left = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (left < bestmse)
- {
- *bestmv = this_mv;
- bestmse = left;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- this_mv.as_mv.col += 8;
- thismse = vfp->svf_halfpix_h(y, y_stride, z, b->src_stride, &sse);
- right = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (right < bestmse)
- {
- *bestmv = this_mv;
- bestmse = right;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- /* go up then down and check error */
- this_mv.as_mv.col = startmv.as_mv.col;
- this_mv.as_mv.row = ((startmv.as_mv.row - 8) | 4);
- thismse = vfp->svf_halfpix_v(y - y_stride, y_stride, z, b->src_stride, &sse);
- up = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (up < bestmse)
- {
- *bestmv = this_mv;
- bestmse = up;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- this_mv.as_mv.row += 8;
- thismse = vfp->svf_halfpix_v(y, y_stride, z, b->src_stride, &sse);
- down = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (down < bestmse)
- {
- *bestmv = this_mv;
- bestmse = down;
- *distortion = thismse;
- *sse1 = sse;
- }
-
-
- /* now check 1 more diagonal */
- whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
- this_mv = startmv;
-
- switch (whichdir)
- {
- case 0:
- this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
- this_mv.as_mv.row = (this_mv.as_mv.row - 8) | 4;
- thismse = vfp->svf_halfpix_hv(y - 1 - y_stride, y_stride, z, b->src_stride, &sse);
- break;
- case 1:
- this_mv.as_mv.col += 4;
- this_mv.as_mv.row = (this_mv.as_mv.row - 8) | 4;
- thismse = vfp->svf_halfpix_hv(y - y_stride, y_stride, z, b->src_stride, &sse);
- break;
- case 2:
- this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
- this_mv.as_mv.row += 4;
- thismse = vfp->svf_halfpix_hv(y - 1, y_stride, z, b->src_stride, &sse);
- break;
- case 3:
- default:
- this_mv.as_mv.col += 4;
- this_mv.as_mv.row += 4;
- thismse = vfp->svf_halfpix_hv(y, y_stride, z, b->src_stride, &sse);
- break;
- }
-
- diag = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (diag < bestmse)
- {
- *bestmv = this_mv;
- bestmse = diag;
- *distortion = thismse;
- *sse1 = sse;
- }
-
-
- /* time to check quarter pels. */
- if (bestmv->as_mv.row < startmv.as_mv.row)
- y -= y_stride;
-
- if (bestmv->as_mv.col < startmv.as_mv.col)
- y--;
-
- startmv = *bestmv;
-
-
-
- /* go left then right and check error */
- this_mv.as_mv.row = startmv.as_mv.row;
-
- if (startmv.as_mv.col & 7)
- {
- this_mv.as_mv.col = startmv.as_mv.col - 2;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- }
- else
- {
- this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
- thismse = vfp->svf(y - 1, y_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- }
-
- left = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (left < bestmse)
- {
- *bestmv = this_mv;
- bestmse = left;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- this_mv.as_mv.col += 4;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- right = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (right < bestmse)
- {
- *bestmv = this_mv;
- bestmse = right;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- /* go up then down and check error */
- this_mv.as_mv.col = startmv.as_mv.col;
-
- if (startmv.as_mv.row & 7)
- {
- this_mv.as_mv.row = startmv.as_mv.row - 2;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- }
- else
- {
- this_mv.as_mv.row = (startmv.as_mv.row - 8) | 6;
- thismse = vfp->svf(y - y_stride, y_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
- }
-
- up = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (up < bestmse)
- {
- *bestmv = this_mv;
- bestmse = up;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- this_mv.as_mv.row += 4;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- down = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (down < bestmse)
- {
- *bestmv = this_mv;
- bestmse = down;
- *distortion = thismse;
- *sse1 = sse;
- }
-
-
- /* now check 1 more diagonal */
- whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
-
- this_mv = startmv;
-
- switch (whichdir)
- {
- case 0:
-
- if (startmv.as_mv.row & 7)
- {
- this_mv.as_mv.row -= 2;
-
- if (startmv.as_mv.col & 7)
- {
- this_mv.as_mv.col -= 2;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- }
- else
- {
- this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
- thismse = vfp->svf(y - 1, y_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);;
- }
- }
- else
- {
- this_mv.as_mv.row = (startmv.as_mv.row - 8) | 6;
-
- if (startmv.as_mv.col & 7)
- {
- this_mv.as_mv.col -= 2;
- thismse = vfp->svf(y - y_stride, y_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
- }
- else
- {
- this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
- thismse = vfp->svf(y - y_stride - 1, y_stride, 6, 6, z, b->src_stride, &sse);
- }
- }
-
- break;
- case 1:
- this_mv.as_mv.col += 2;
-
- if (startmv.as_mv.row & 7)
- {
- this_mv.as_mv.row -= 2;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- }
- else
- {
- this_mv.as_mv.row = (startmv.as_mv.row - 8) | 6;
- thismse = vfp->svf(y - y_stride, y_stride, this_mv.as_mv.col & 7, 6, z, b->src_stride, &sse);
- }
-
- break;
- case 2:
- this_mv.as_mv.row += 2;
-
- if (startmv.as_mv.col & 7)
- {
- this_mv.as_mv.col -= 2;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- }
- else
- {
- this_mv.as_mv.col = (startmv.as_mv.col - 8) | 6;
- thismse = vfp->svf(y - 1, y_stride, 6, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- }
-
- break;
- case 3:
- this_mv.as_mv.col += 2;
- this_mv.as_mv.row += 2;
- thismse = vfp->svf(y, y_stride, this_mv.as_mv.col & 7, this_mv.as_mv.row & 7, z, b->src_stride, &sse);
- break;
- }
-
- diag = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (diag < bestmse)
- {
- *bestmv = this_mv;
- bestmse = diag;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- return bestmse;
-}
-
-int vp8_find_best_half_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
- int_mv *bestmv, int_mv *ref_mv,
- int error_per_bit,
- const vp8_variance_fn_ptr_t *vfp,
- int *mvcost[2], int *distortion,
- unsigned int *sse1)
-{
- int bestmse = INT_MAX;
- int_mv startmv;
- int_mv this_mv;
- unsigned char *z = (*(b->base_src) + b->src);
- int left, right, up, down, diag;
- unsigned int sse;
- int whichdir ;
- int thismse;
- int y_stride;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
-
-#if ARCH_X86_32 || ARCH_X86_64
- MACROBLOCKD *xd = &x->e_mbd;
- unsigned char *y_0 = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
- unsigned char *y;
-
- y_stride = 32;
- /* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
- vfp->copymem(y_0 - 1 - pre_stride, pre_stride, xd->y_buf, y_stride, 18);
- y = xd->y_buf + y_stride + 1;
-#else
- unsigned char *y = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
- y_stride = pre_stride;
-#endif
-
- /* central mv */
- bestmv->as_mv.row *= 8;
- bestmv->as_mv.col *= 8;
- startmv = *bestmv;
-
- /* calculate central point error */
- bestmse = vfp->vf(y, y_stride, z, b->src_stride, sse1);
- *distortion = bestmse;
- bestmse += mv_err_cost(bestmv, ref_mv, mvcost, error_per_bit);
-
- /* go left then right and check error */
- this_mv.as_mv.row = startmv.as_mv.row;
- this_mv.as_mv.col = ((startmv.as_mv.col - 8) | 4);
- thismse = vfp->svf_halfpix_h(y - 1, y_stride, z, b->src_stride, &sse);
- left = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (left < bestmse)
- {
- *bestmv = this_mv;
- bestmse = left;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- this_mv.as_mv.col += 8;
- thismse = vfp->svf_halfpix_h(y, y_stride, z, b->src_stride, &sse);
- right = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (right < bestmse)
- {
- *bestmv = this_mv;
- bestmse = right;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- /* go up then down and check error */
- this_mv.as_mv.col = startmv.as_mv.col;
- this_mv.as_mv.row = ((startmv.as_mv.row - 8) | 4);
- thismse = vfp->svf_halfpix_v(y - y_stride, y_stride, z, b->src_stride, &sse);
- up = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (up < bestmse)
- {
- *bestmv = this_mv;
- bestmse = up;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- this_mv.as_mv.row += 8;
- thismse = vfp->svf_halfpix_v(y, y_stride, z, b->src_stride, &sse);
- down = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (down < bestmse)
- {
- *bestmv = this_mv;
- bestmse = down;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- /* now check 1 more diagonal - */
- whichdir = (left < right ? 0 : 1) + (up < down ? 0 : 2);
- this_mv = startmv;
-
- switch (whichdir)
- {
- case 0:
- this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
- this_mv.as_mv.row = (this_mv.as_mv.row - 8) | 4;
- thismse = vfp->svf_halfpix_hv(y - 1 - y_stride, y_stride, z, b->src_stride, &sse);
- break;
- case 1:
- this_mv.as_mv.col += 4;
- this_mv.as_mv.row = (this_mv.as_mv.row - 8) | 4;
- thismse = vfp->svf_halfpix_hv(y - y_stride, y_stride, z, b->src_stride, &sse);
- break;
- case 2:
- this_mv.as_mv.col = (this_mv.as_mv.col - 8) | 4;
- this_mv.as_mv.row += 4;
- thismse = vfp->svf_halfpix_hv(y - 1, y_stride, z, b->src_stride, &sse);
- break;
- case 3:
- default:
- this_mv.as_mv.col += 4;
- this_mv.as_mv.row += 4;
- thismse = vfp->svf_halfpix_hv(y, y_stride, z, b->src_stride, &sse);
- break;
- }
-
- diag = thismse + mv_err_cost(&this_mv, ref_mv, mvcost, error_per_bit);
-
- if (diag < bestmse)
- {
- *bestmv = this_mv;
- bestmse = diag;
- *distortion = thismse;
- *sse1 = sse;
- }
-
- return bestmse;
-}
-
-#define CHECK_BOUNDS(range) \
-{\
- all_in = 1;\
- all_in &= ((br-range) >= x->mv_row_min);\
- all_in &= ((br+range) <= x->mv_row_max);\
- all_in &= ((bc-range) >= x->mv_col_min);\
- all_in &= ((bc+range) <= x->mv_col_max);\
-}
-
-#define CHECK_POINT \
-{\
- if (this_mv.as_mv.col < x->mv_col_min) continue;\
- if (this_mv.as_mv.col > x->mv_col_max) continue;\
- if (this_mv.as_mv.row < x->mv_row_min) continue;\
- if (this_mv.as_mv.row > x->mv_row_max) continue;\
-}
-
-#define CHECK_BETTER \
-{\
- if (thissad < bestsad)\
- {\
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv, mvsadcost, sad_per_bit);\
- if (thissad < bestsad)\
- {\
- bestsad = thissad;\
- best_site = i;\
- }\
- }\
-}
-
-static const MV next_chkpts[6][3] =
-{
- {{ -2, 0}, { -1, -2}, {1, -2}},
- {{ -1, -2}, {1, -2}, {2, 0}},
- {{1, -2}, {2, 0}, {1, 2}},
- {{2, 0}, {1, 2}, { -1, 2}},
- {{1, 2}, { -1, 2}, { -2, 0}},
- {{ -1, 2}, { -2, 0}, { -1, -2}}
-};
-
-int vp8_hex_search
-(
- MACROBLOCK *x,
- BLOCK *b,
- BLOCKD *d,
- int_mv *ref_mv,
- int_mv *best_mv,
- int search_param,
- int sad_per_bit,
- const vp8_variance_fn_ptr_t *vfp,
- int *mvsadcost[2],
- int *mvcost[2],
- int_mv *center_mv
-)
-{
- MV hex[6] = { { -1, -2}, {1, -2}, {2, 0}, {1, 2}, { -1, 2}, { -2, 0} } ;
- MV neighbors[4] = {{0, -1}, { -1, 0}, {1, 0}, {0, 1}} ;
- int i, j;
-
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
-
- int in_what_stride = pre_stride;
- int br, bc;
- int_mv this_mv;
- unsigned int bestsad;
- unsigned int thissad;
- unsigned char *base_offset;
- unsigned char *this_offset;
- int k = -1;
- int all_in;
- int best_site = -1;
- int hex_range = 127;
- int dia_range = 8;
-
- int_mv fcenter_mv;
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- (void)mvcost;
- (void)search_param;
- /* adjust ref_mv to make sure it is within MV range */
- vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- br = ref_mv->as_mv.row;
- bc = ref_mv->as_mv.col;
-
- /* Work out the start point for the search */
- base_offset = (unsigned char *)(base_pre + d->offset);
- this_offset = base_offset + (br * (pre_stride)) + bc;
- this_mv.as_mv.row = br;
- this_mv.as_mv.col = bc;
- bestsad = vfp->sdf(what, what_stride, this_offset, in_what_stride, UINT_MAX)
- + mvsad_err_cost(&this_mv, &fcenter_mv, mvsadcost, sad_per_bit);
-
-#if CONFIG_MULTI_RES_ENCODING
- /* Lower search range based on prediction info */
- if (search_param >= 6) goto cal_neighbors;
- else if (search_param >= 5) hex_range = 4;
- else if (search_param >= 4) hex_range = 6;
- else if (search_param >= 3) hex_range = 15;
- else if (search_param >= 2) hex_range = 31;
- else if (search_param >= 1) hex_range = 63;
-
- dia_range = 8;
-#endif
-
- /* hex search */
- CHECK_BOUNDS(2)
-
- if(all_in)
- {
- for (i = 0; i < 6; i++)
- {
- this_mv.as_mv.row = br + hex[i].row;
- this_mv.as_mv.col = bc + hex[i].col;
- this_offset = base_offset + (this_mv.as_mv.row * in_what_stride) + this_mv.as_mv.col;
- thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad);
- CHECK_BETTER
- }
- }else
- {
- for (i = 0; i < 6; i++)
- {
- this_mv.as_mv.row = br + hex[i].row;
- this_mv.as_mv.col = bc + hex[i].col;
- CHECK_POINT
- this_offset = base_offset + (this_mv.as_mv.row * in_what_stride) + this_mv.as_mv.col;
- thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad);
- CHECK_BETTER
- }
- }
-
- if (best_site == -1)
- goto cal_neighbors;
- else
- {
- br += hex[best_site].row;
- bc += hex[best_site].col;
- k = best_site;
- }
-
- for (j = 1; j < hex_range; j++)
- {
- best_site = -1;
- CHECK_BOUNDS(2)
-
- if(all_in)
- {
- for (i = 0; i < 3; i++)
- {
- this_mv.as_mv.row = br + next_chkpts[k][i].row;
- this_mv.as_mv.col = bc + next_chkpts[k][i].col;
- this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
- thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad);
- CHECK_BETTER
- }
- }else
- {
- for (i = 0; i < 3; i++)
- {
- this_mv.as_mv.row = br + next_chkpts[k][i].row;
- this_mv.as_mv.col = bc + next_chkpts[k][i].col;
- CHECK_POINT
- this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
- thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad);
- CHECK_BETTER
- }
- }
-
- if (best_site == -1)
- break;
- else
- {
- br += next_chkpts[k][best_site].row;
- bc += next_chkpts[k][best_site].col;
- k += 5 + best_site;
- if (k >= 12) k -= 12;
- else if (k >= 6) k -= 6;
- }
- }
-
- /* check 4 1-away neighbors */
-cal_neighbors:
- for (j = 0; j < dia_range; j++)
- {
- best_site = -1;
- CHECK_BOUNDS(1)
-
- if(all_in)
- {
- for (i = 0; i < 4; i++)
- {
- this_mv.as_mv.row = br + neighbors[i].row;
- this_mv.as_mv.col = bc + neighbors[i].col;
- this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
- thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad);
- CHECK_BETTER
- }
- }else
- {
- for (i = 0; i < 4; i++)
- {
- this_mv.as_mv.row = br + neighbors[i].row;
- this_mv.as_mv.col = bc + neighbors[i].col;
- CHECK_POINT
- this_offset = base_offset + (this_mv.as_mv.row * (in_what_stride)) + this_mv.as_mv.col;
- thissad = vfp->sdf(what, what_stride, this_offset, in_what_stride, bestsad);
- CHECK_BETTER
- }
- }
-
- if (best_site == -1)
- break;
- else
- {
- br += neighbors[best_site].row;
- bc += neighbors[best_site].col;
- }
- }
-
- best_mv->as_mv.row = br;
- best_mv->as_mv.col = bc;
-
- return bestsad;
-}
-#undef CHECK_BOUNDS
-#undef CHECK_POINT
-#undef CHECK_BETTER
-
-int vp8_diamond_search_sad_c
-(
- MACROBLOCK *x,
- BLOCK *b,
- BLOCKD *d,
- int_mv *ref_mv,
- int_mv *best_mv,
- int search_param,
- int sad_per_bit,
- int *num00,
- vp8_variance_fn_ptr_t *fn_ptr,
- int *mvcost[2],
- int_mv *center_mv
-)
-{
- int i, j, step;
-
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- unsigned char *in_what;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- int in_what_stride = pre_stride;
- unsigned char *best_address;
-
- int tot_steps;
- int_mv this_mv;
-
- unsigned int bestsad;
- unsigned int thissad;
- int best_site = 0;
- int last_site = 0;
-
- int ref_row;
- int ref_col;
- int this_row_offset;
- int this_col_offset;
- search_site *ss;
-
- unsigned char *check_here;
-
- int *mvsadcost[2];
- int_mv fcenter_mv;
-
- mvsadcost[0] = x->mvsadcost[0];
- mvsadcost[1] = x->mvsadcost[1];
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->as_mv.row;
- ref_col = ref_mv->as_mv.col;
- *num00 = 0;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
-
- /* Work out the start point for the search */
- in_what = (unsigned char *)(base_pre + d->offset + (ref_row * pre_stride) + ref_col);
- best_address = in_what;
-
- /* Check the starting position */
- bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, UINT_MAX)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
-
- /* 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.
- */
- ss = &x->ss[search_param * x->searches_per_step];
- tot_steps = (x->ss_count / x->searches_per_step) - search_param;
-
- i = 1;
-
- for (step = 0; step < tot_steps ; step++)
- {
- for (j = 0 ; j < x->searches_per_step ; j++)
- {
- /* Trap illegal vectors */
- this_row_offset = best_mv->as_mv.row + ss[i].mv.row;
- this_col_offset = best_mv->as_mv.col + ss[i].mv.col;
-
- if ((this_col_offset > x->mv_col_min) && (this_col_offset < x->mv_col_max) &&
- (this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max))
-
- {
- check_here = ss[i].offset + best_address;
- thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad);
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_site = i;
- }
- }
- }
-
- i++;
- }
-
- if (best_site != last_site)
- {
- best_mv->as_mv.row += ss[best_site].mv.row;
- best_mv->as_mv.col += ss[best_site].mv.col;
- best_address += ss[best_site].offset;
- last_site = best_site;
- }
- else if (best_address == in_what)
- (*num00)++;
- }
-
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
-
- return fn_ptr->vf(what, what_stride, best_address, in_what_stride, &thissad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
-}
-
-int vp8_diamond_search_sadx4
-(
- MACROBLOCK *x,
- BLOCK *b,
- BLOCKD *d,
- int_mv *ref_mv,
- int_mv *best_mv,
- int search_param,
- int sad_per_bit,
- int *num00,
- vp8_variance_fn_ptr_t *fn_ptr,
- int *mvcost[2],
- int_mv *center_mv
-)
-{
- int i, j, step;
-
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- unsigned char *in_what;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- int in_what_stride = pre_stride;
- unsigned char *best_address;
-
- int tot_steps;
- int_mv this_mv;
-
- unsigned int bestsad;
- unsigned int thissad;
- int best_site = 0;
- int last_site = 0;
-
- int ref_row;
- int ref_col;
- int this_row_offset;
- int this_col_offset;
- search_site *ss;
-
- unsigned char *check_here;
-
- int *mvsadcost[2];
- int_mv fcenter_mv;
-
- mvsadcost[0] = x->mvsadcost[0];
- mvsadcost[1] = x->mvsadcost[1];
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- vp8_clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->as_mv.row;
- ref_col = ref_mv->as_mv.col;
- *num00 = 0;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
-
- /* Work out the start point for the search */
- in_what = (unsigned char *)(base_pre + d->offset + (ref_row * pre_stride) + ref_col);
- best_address = in_what;
-
- /* Check the starting position */
- bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, UINT_MAX)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
-
- /* 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.
- */
- ss = &x->ss[search_param * x->searches_per_step];
- tot_steps = (x->ss_count / x->searches_per_step) - search_param;
-
- i = 1;
-
- for (step = 0; step < tot_steps ; step++)
- {
- int all_in = 1, t;
-
- /* To know if all neighbor points are within the bounds, 4 bounds
- * checking are enough instead of checking 4 bounds for each
- * points.
- */
- all_in &= ((best_mv->as_mv.row + ss[i].mv.row)> x->mv_row_min);
- all_in &= ((best_mv->as_mv.row + ss[i+1].mv.row) < x->mv_row_max);
- all_in &= ((best_mv->as_mv.col + ss[i+2].mv.col) > x->mv_col_min);
- all_in &= ((best_mv->as_mv.col + ss[i+3].mv.col) < x->mv_col_max);
-
- if (all_in)
- {
- unsigned int sad_array[4];
-
- for (j = 0 ; j < x->searches_per_step ; j += 4)
- {
- const unsigned char *block_offset[4];
-
- for (t = 0; t < 4; t++)
- block_offset[t] = ss[i+t].offset + best_address;
-
- fn_ptr->sdx4df(what, what_stride, block_offset, in_what_stride, sad_array);
-
- for (t = 0; t < 4; t++, i++)
- {
- if (sad_array[t] < bestsad)
- {
- this_mv.as_mv.row = best_mv->as_mv.row + ss[i].mv.row;
- this_mv.as_mv.col = best_mv->as_mv.col + ss[i].mv.col;
- sad_array[t] += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (sad_array[t] < bestsad)
- {
- bestsad = sad_array[t];
- best_site = i;
- }
- }
- }
- }
- }
- else
- {
- for (j = 0 ; j < x->searches_per_step ; j++)
- {
- /* Trap illegal vectors */
- this_row_offset = best_mv->as_mv.row + ss[i].mv.row;
- this_col_offset = best_mv->as_mv.col + ss[i].mv.col;
-
- if ((this_col_offset > x->mv_col_min) && (this_col_offset < x->mv_col_max) &&
- (this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max))
- {
- check_here = ss[i].offset + best_address;
- thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad);
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_site = i;
- }
- }
- }
- i++;
- }
- }
-
- if (best_site != last_site)
- {
- best_mv->as_mv.row += ss[best_site].mv.row;
- best_mv->as_mv.col += ss[best_site].mv.col;
- best_address += ss[best_site].offset;
- last_site = best_site;
- }
- else if (best_address == in_what)
- (*num00)++;
- }
-
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
-
- return fn_ptr->vf(what, what_stride, best_address, in_what_stride, &thissad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
-}
-
-int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
- int sad_per_bit, int distance,
- vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2],
- int_mv *center_mv)
-{
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- unsigned char *in_what;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- int in_what_stride = pre_stride;
- int mv_stride = pre_stride;
- unsigned char *bestaddress;
- int_mv *best_mv = &d->bmi.mv;
- int_mv this_mv;
- unsigned int bestsad;
- unsigned int thissad;
- int r, c;
-
- unsigned char *check_here;
-
- int ref_row = ref_mv->as_mv.row;
- int ref_col = ref_mv->as_mv.col;
-
- int row_min = ref_row - distance;
- int row_max = ref_row + distance;
- int col_min = ref_col - distance;
- int col_max = ref_col + distance;
-
- int *mvsadcost[2];
- int_mv fcenter_mv;
-
- mvsadcost[0] = x->mvsadcost[0];
- mvsadcost[1] = x->mvsadcost[1];
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- /* Work out the mid point for the search */
- in_what = base_pre + d->offset;
- bestaddress = in_what + (ref_row * pre_stride) + ref_col;
-
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
-
- /* Baseline value at the centre */
- bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
- in_what_stride, UINT_MAX)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
-
- /* Apply further limits to prevent us looking using vectors that
- * stretch beyiond the UMV border
- */
- if (col_min < x->mv_col_min)
- col_min = x->mv_col_min;
-
- if (col_max > x->mv_col_max)
- col_max = x->mv_col_max;
-
- if (row_min < x->mv_row_min)
- row_min = x->mv_row_min;
-
- if (row_max > x->mv_row_max)
- row_max = x->mv_row_max;
-
- for (r = row_min; r < row_max ; r++)
- {
- this_mv.as_mv.row = r;
- check_here = r * mv_stride + in_what + col_min;
-
- for (c = col_min; c < col_max; c++)
- {
- thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad);
-
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
- bestaddress = check_here;
- }
-
- check_here++;
- }
- }
-
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
-
- return fn_ptr->vf(what, what_stride, bestaddress, in_what_stride, &thissad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
-}
-
-int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
- int sad_per_bit, int distance,
- vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2],
- int_mv *center_mv)
-{
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- unsigned char *in_what;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- int in_what_stride = pre_stride;
- int mv_stride = pre_stride;
- unsigned char *bestaddress;
- int_mv *best_mv = &d->bmi.mv;
- int_mv this_mv;
- unsigned int bestsad;
- unsigned int thissad;
- int r, c;
-
- unsigned char *check_here;
-
- int ref_row = ref_mv->as_mv.row;
- int ref_col = ref_mv->as_mv.col;
-
- int row_min = ref_row - distance;
- int row_max = ref_row + distance;
- int col_min = ref_col - distance;
- int col_max = ref_col + distance;
-
- unsigned int sad_array[3];
-
- int *mvsadcost[2];
- int_mv fcenter_mv;
-
- mvsadcost[0] = x->mvsadcost[0];
- mvsadcost[1] = x->mvsadcost[1];
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- /* Work out the mid point for the search */
- in_what = base_pre + d->offset;
- bestaddress = in_what + (ref_row * pre_stride) + ref_col;
-
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
-
- /* Baseline value at the centre */
- bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
- in_what_stride, UINT_MAX)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
-
- /* Apply further limits to prevent us looking using vectors that stretch
- * beyond the UMV border
- */
- if (col_min < x->mv_col_min)
- col_min = x->mv_col_min;
-
- if (col_max > x->mv_col_max)
- col_max = x->mv_col_max;
-
- if (row_min < x->mv_row_min)
- row_min = x->mv_row_min;
-
- if (row_max > x->mv_row_max)
- row_max = x->mv_row_max;
-
- for (r = row_min; r < row_max ; r++)
- {
- this_mv.as_mv.row = r;
- check_here = r * mv_stride + in_what + col_min;
- c = col_min;
-
- while ((c + 2) < col_max)
- {
- int i;
-
- fn_ptr->sdx3f(what, what_stride, check_here, in_what_stride, sad_array);
-
- for (i = 0; i < 3; i++)
- {
- thissad = sad_array[i];
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
- bestaddress = check_here;
- }
- }
-
- check_here++;
- c++;
- }
- }
-
- while (c < col_max)
- {
- thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride, bestsad);
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
- bestaddress = check_here;
- }
- }
-
- check_here ++;
- c ++;
- }
-
- }
-
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
-
- return fn_ptr->vf(what, what_stride, bestaddress, in_what_stride, &thissad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
-}
-
-int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
- int sad_per_bit, int distance,
- vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2],
- int_mv *center_mv)
-{
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- unsigned char *in_what;
- int in_what_stride = pre_stride;
- int mv_stride = pre_stride;
- unsigned char *bestaddress;
- int_mv *best_mv = &d->bmi.mv;
- int_mv this_mv;
- unsigned int bestsad;
- unsigned int thissad;
- int r, c;
-
- unsigned char *check_here;
-
- int ref_row = ref_mv->as_mv.row;
- int ref_col = ref_mv->as_mv.col;
-
- int row_min = ref_row - distance;
- int row_max = ref_row + distance;
- int col_min = ref_col - distance;
- int col_max = ref_col + distance;
-
- DECLARE_ALIGNED_ARRAY(16, unsigned short, sad_array8, 8);
- unsigned int sad_array[3];
-
- int *mvsadcost[2];
- int_mv fcenter_mv;
-
- mvsadcost[0] = x->mvsadcost[0];
- mvsadcost[1] = x->mvsadcost[1];
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- /* Work out the mid point for the search */
- in_what = base_pre + d->offset;
- bestaddress = in_what + (ref_row * pre_stride) + ref_col;
-
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
-
- /* Baseline value at the centre */
- bestsad = fn_ptr->sdf(what, what_stride,
- bestaddress, in_what_stride, UINT_MAX)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvsadcost, sad_per_bit);
-
- /* Apply further limits to prevent us looking using vectors that stretch
- * beyond the UMV border
- */
- if (col_min < x->mv_col_min)
- col_min = x->mv_col_min;
-
- if (col_max > x->mv_col_max)
- col_max = x->mv_col_max;
-
- if (row_min < x->mv_row_min)
- row_min = x->mv_row_min;
-
- if (row_max > x->mv_row_max)
- row_max = x->mv_row_max;
-
- for (r = row_min; r < row_max ; r++)
- {
- this_mv.as_mv.row = r;
- check_here = r * mv_stride + in_what + col_min;
- c = col_min;
-
- while ((c + 7) < col_max)
- {
- int i;
-
- fn_ptr->sdx8f(what, what_stride, check_here, in_what_stride, sad_array8);
-
- for (i = 0; i < 8; i++)
- {
- thissad = sad_array8[i];
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
- bestaddress = check_here;
- }
- }
-
- check_here++;
- c++;
- }
- }
-
- while ((c + 2) < col_max)
- {
- int i;
-
- fn_ptr->sdx3f(what, what_stride, check_here , in_what_stride, sad_array);
-
- for (i = 0; i < 3; i++)
- {
- thissad = sad_array[i];
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
- bestaddress = check_here;
- }
- }
-
- check_here++;
- c++;
- }
- }
-
- while (c < col_max)
- {
- thissad = fn_ptr->sdf(what, what_stride, check_here , in_what_stride, bestsad);
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvsadcost, sad_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
- bestaddress = check_here;
- }
- }
-
- check_here ++;
- c ++;
- }
- }
-
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
-
- return fn_ptr->vf(what, what_stride, bestaddress, in_what_stride, &thissad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
-}
-
-int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
- int error_per_bit, int search_range,
- vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2],
- int_mv *center_mv)
-{
- MV neighbors[4] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
- int i, j;
- short this_row_offset, this_col_offset;
-
- int what_stride = b->src_stride;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- int in_what_stride = pre_stride;
- unsigned char *what = (*(b->base_src) + b->src);
- unsigned char *best_address = (unsigned char *)(base_pre + d->offset +
- (ref_mv->as_mv.row * pre_stride) + ref_mv->as_mv.col);
- unsigned char *check_here;
- int_mv this_mv;
- unsigned int bestsad;
- unsigned int thissad;
-
- int *mvsadcost[2];
- int_mv fcenter_mv;
-
- mvsadcost[0] = x->mvsadcost[0];
- mvsadcost[1] = x->mvsadcost[1];
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- bestsad = fn_ptr->sdf(what, what_stride, best_address,
- in_what_stride, UINT_MAX)
- + mvsad_err_cost(ref_mv, &fcenter_mv, mvsadcost, error_per_bit);
-
- for (i=0; i<search_range; i++)
- {
- int best_site = -1;
-
- for (j = 0 ; j < 4 ; j++)
- {
- this_row_offset = ref_mv->as_mv.row + neighbors[j].row;
- this_col_offset = ref_mv->as_mv.col + neighbors[j].col;
-
- if ((this_col_offset > x->mv_col_min) && (this_col_offset < x->mv_col_max) &&
- (this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max))
- {
- check_here = (neighbors[j].row)*in_what_stride + neighbors[j].col + best_address;
- thissad = fn_ptr->sdf(what, what_stride, check_here , in_what_stride, bestsad);
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv, mvsadcost, error_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_site = j;
- }
- }
- }
- }
-
- if (best_site == -1)
- break;
- else
- {
- ref_mv->as_mv.row += neighbors[best_site].row;
- ref_mv->as_mv.col += neighbors[best_site].col;
- best_address += (neighbors[best_site].row)*in_what_stride + neighbors[best_site].col;
- }
- }
-
- this_mv.as_mv.row = ref_mv->as_mv.row << 3;
- this_mv.as_mv.col = ref_mv->as_mv.col << 3;
-
- return fn_ptr->vf(what, what_stride, best_address, in_what_stride, &thissad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
-}
-
-int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
- int_mv *ref_mv, int error_per_bit,
- int search_range, vp8_variance_fn_ptr_t *fn_ptr,
- int *mvcost[2], int_mv *center_mv)
-{
- MV neighbors[4] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
- int i, j;
- short this_row_offset, this_col_offset;
-
- int what_stride = b->src_stride;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- int in_what_stride = pre_stride;
- unsigned char *what = (*(b->base_src) + b->src);
- unsigned char *best_address = (unsigned char *)(base_pre + d->offset +
- (ref_mv->as_mv.row * pre_stride) + ref_mv->as_mv.col);
- unsigned char *check_here;
- int_mv this_mv;
- unsigned int bestsad;
- unsigned int thissad;
-
- int *mvsadcost[2];
- int_mv fcenter_mv;
-
- mvsadcost[0] = x->mvsadcost[0];
- mvsadcost[1] = x->mvsadcost[1];
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
-
- bestsad = fn_ptr->sdf(what, what_stride, best_address,
- in_what_stride, UINT_MAX)
- + mvsad_err_cost(ref_mv, &fcenter_mv, mvsadcost, error_per_bit);
-
- for (i=0; i<search_range; i++)
- {
- int best_site = -1;
- int all_in = 1;
-
- all_in &= ((ref_mv->as_mv.row - 1) > x->mv_row_min);
- all_in &= ((ref_mv->as_mv.row + 1) < x->mv_row_max);
- all_in &= ((ref_mv->as_mv.col - 1) > x->mv_col_min);
- all_in &= ((ref_mv->as_mv.col + 1) < x->mv_col_max);
-
- if(all_in)
- {
- unsigned int sad_array[4];
- const unsigned char *block_offset[4];
- block_offset[0] = best_address - in_what_stride;
- block_offset[1] = best_address - 1;
- block_offset[2] = best_address + 1;
- block_offset[3] = best_address + in_what_stride;
-
- fn_ptr->sdx4df(what, what_stride, block_offset, in_what_stride, sad_array);
-
- for (j = 0; j < 4; j++)
- {
- if (sad_array[j] < bestsad)
- {
- this_mv.as_mv.row = ref_mv->as_mv.row + neighbors[j].row;
- this_mv.as_mv.col = ref_mv->as_mv.col + neighbors[j].col;
- sad_array[j] += mvsad_err_cost(&this_mv, &fcenter_mv, mvsadcost, error_per_bit);
-
- if (sad_array[j] < bestsad)
- {
- bestsad = sad_array[j];
- best_site = j;
- }
- }
- }
- }
- else
- {
- for (j = 0 ; j < 4 ; j++)
- {
- this_row_offset = ref_mv->as_mv.row + neighbors[j].row;
- this_col_offset = ref_mv->as_mv.col + neighbors[j].col;
-
- if ((this_col_offset > x->mv_col_min) && (this_col_offset < x->mv_col_max) &&
- (this_row_offset > x->mv_row_min) && (this_row_offset < x->mv_row_max))
- {
- check_here = (neighbors[j].row)*in_what_stride + neighbors[j].col + best_address;
- thissad = fn_ptr->sdf(what, what_stride, check_here , in_what_stride, bestsad);
-
- if (thissad < bestsad)
- {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv, mvsadcost, error_per_bit);
-
- if (thissad < bestsad)
- {
- bestsad = thissad;
- best_site = j;
- }
- }
- }
- }
- }
-
- if (best_site == -1)
- break;
- else
- {
- ref_mv->as_mv.row += neighbors[best_site].row;
- ref_mv->as_mv.col += neighbors[best_site].col;
- best_address += (neighbors[best_site].row)*in_what_stride + neighbors[best_site].col;
- }
- }
-
- this_mv.as_mv.row = ref_mv->as_mv.row * 8;
- this_mv.as_mv.col = ref_mv->as_mv.col * 8;
-
- return fn_ptr->vf(what, what_stride, best_address, in_what_stride, &thissad)
- + mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
-}
-
-#ifdef VP8_ENTROPY_STATS
-void print_mode_context(void)
-{
- FILE *f = fopen("modecont.c", "w");
- int i, j;
-
- fprintf(f, "#include \"entropy.h\"\n");
- fprintf(f, "const int vp8_mode_contexts[6][4] =\n");
- fprintf(f, "{\n");
-
- for (j = 0; j < 6; j++)
- {
- fprintf(f, " { /* %d */\n", j);
- fprintf(f, " ");
-
- for (i = 0; i < 4; i++)
- {
- int overal_prob;
- int this_prob;
- int count;
-
- /* Overall probs */
- count = mv_mode_cts[i][0] + mv_mode_cts[i][1];
-
- if (count)
- overal_prob = 256 * mv_mode_cts[i][0] / count;
- else
- overal_prob = 128;
-
- if (overal_prob == 0)
- overal_prob = 1;
-
- /* context probs */
- count = mv_ref_ct[j][i][0] + mv_ref_ct[j][i][1];
-
- if (count)
- this_prob = 256 * mv_ref_ct[j][i][0] / count;
- else
- this_prob = 128;
-
- if (this_prob == 0)
- this_prob = 1;
-
- fprintf(f, "%5d, ", this_prob);
- }
-
- fprintf(f, " },\n");
- }
-
- fprintf(f, "};\n");
- fclose(f);
-}
-
-/* MV ref count VP8_ENTROPY_STATS stats code */
-#ifdef VP8_ENTROPY_STATS
-void init_mv_ref_counts()
-{
- vpx_memset(mv_ref_ct, 0, sizeof(mv_ref_ct));
- vpx_memset(mv_mode_cts, 0, sizeof(mv_mode_cts));
-}
-
-void accum_mv_refs(MB_PREDICTION_MODE m, const int ct[4])
-{
- if (m == ZEROMV)
- {
- ++mv_ref_ct [ct[0]] [0] [0];
- ++mv_mode_cts[0][0];
- }
- else
- {
- ++mv_ref_ct [ct[0]] [0] [1];
- ++mv_mode_cts[0][1];
-
- if (m == NEARESTMV)
- {
- ++mv_ref_ct [ct[1]] [1] [0];
- ++mv_mode_cts[1][0];
- }
- else
- {
- ++mv_ref_ct [ct[1]] [1] [1];
- ++mv_mode_cts[1][1];
-
- if (m == NEARMV)
- {
- ++mv_ref_ct [ct[2]] [2] [0];
- ++mv_mode_cts[2][0];
- }
- else
- {
- ++mv_ref_ct [ct[2]] [2] [1];
- ++mv_mode_cts[2][1];
-
- if (m == NEWMV)
- {
- ++mv_ref_ct [ct[3]] [3] [0];
- ++mv_mode_cts[3][0];
- }
- else
- {
- ++mv_ref_ct [ct[3]] [3] [1];
- ++mv_mode_cts[3][1];
- }
- }
- }
- }
-}
-
-#endif/* END MV ref count VP8_ENTROPY_STATS stats code */
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.h
deleted file mode 100644
index f284f7c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/mcomp.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_MCOMP_H_
-#define VP8_ENCODER_MCOMP_H_
-
-#include "block.h"
-#include "vp8/common/variance.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef VP8_ENTROPY_STATS
-extern void init_mv_ref_counts();
-extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
-#endif
-
-
-/* The maximum number of steps in a step search given the largest allowed
- * initial step
- */
-#define MAX_MVSEARCH_STEPS 8
-
-/* Max full pel mv specified in 1 pel units */
-#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1)
-
-/* Maximum size of the first step in full pel units */
-#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1))
-
-extern void print_mode_context(void);
-extern int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight);
-extern void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride);
-extern void vp8_init3smotion_compensation(MACROBLOCK *x, int stride);
-
-
-extern int vp8_hex_search
-(
- MACROBLOCK *x,
- BLOCK *b,
- BLOCKD *d,
- int_mv *ref_mv,
- int_mv *best_mv,
- int search_param,
- int error_per_bit,
- const vp8_variance_fn_ptr_t *vf,
- int *mvsadcost[2],
- int *mvcost[2],
- int_mv *center_mv
-);
-
-typedef int (fractional_mv_step_fp)
- (MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *bestmv, int_mv *ref_mv,
- int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2],
- int *distortion, unsigned int *sse);
-
-extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;
-extern fractional_mv_step_fp vp8_find_best_sub_pixel_step;
-extern fractional_mv_step_fp vp8_find_best_half_pixel_step;
-extern fractional_mv_step_fp vp8_skip_fractional_mv_step;
-
-typedef int (*vp8_full_search_fn_t)
- (
- MACROBLOCK *x,
- BLOCK *b,
- BLOCKD *d,
- int_mv *ref_mv,
- int sad_per_bit,
- int distance,
- vp8_variance_fn_ptr_t *fn_ptr,
- int *mvcost[2],
- int_mv *center_mv
- );
-
-typedef int (*vp8_refining_search_fn_t)
- (
- MACROBLOCK *x,
- BLOCK *b,
- BLOCKD *d,
- int_mv *ref_mv,
- int sad_per_bit,
- int distance,
- vp8_variance_fn_ptr_t *fn_ptr,
- int *mvcost[2],
- int_mv *center_mv
- );
-
-typedef int (*vp8_diamond_search_fn_t)
- (
- MACROBLOCK *x,
- BLOCK *b,
- BLOCKD *d,
- int_mv *ref_mv,
- int_mv *best_mv,
- int search_param,
- int sad_per_bit,
- int *num00,
- vp8_variance_fn_ptr_t *fn_ptr,
- int *mvcost[2],
- int_mv *center_mv
- );
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_MCOMP_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.c
deleted file mode 100644
index c61563c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/common/blockd.h"
-#include "onyx_int.h"
-#include "treewriter.h"
-#include "vp8/common/entropymode.h"
-
-
-void vp8_init_mode_costs(VP8_COMP *c)
-{
- VP8_COMMON *x = &c->common;
- struct rd_costs_struct *rd_costs = &c->rd_costs;
-
- {
- const vp8_tree_p T = vp8_bmode_tree;
-
- int i = 0;
-
- do
- {
- int j = 0;
-
- do
- {
- vp8_cost_tokens(rd_costs->bmode_costs[i][j],
- vp8_kf_bmode_prob[i][j], T);
- }
- while (++j < VP8_BINTRAMODES);
- }
- while (++i < VP8_BINTRAMODES);
-
- vp8_cost_tokens(rd_costs->inter_bmode_costs, x->fc.bmode_prob, T);
- }
- vp8_cost_tokens(rd_costs->inter_bmode_costs, x->fc.sub_mv_ref_prob,
- vp8_sub_mv_ref_tree);
-
- vp8_cost_tokens(rd_costs->mbmode_cost[1], x->fc.ymode_prob, vp8_ymode_tree);
- vp8_cost_tokens(rd_costs->mbmode_cost[0], vp8_kf_ymode_prob,
- vp8_kf_ymode_tree);
-
- vp8_cost_tokens(rd_costs->intra_uv_mode_cost[1], x->fc.uv_mode_prob,
- vp8_uv_mode_tree);
- vp8_cost_tokens(rd_costs->intra_uv_mode_cost[0], vp8_kf_uv_mode_prob,
- vp8_uv_mode_tree);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.h
deleted file mode 100644
index 9281551..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/modecosts.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_MODECOSTS_H_
-#define VP8_ENCODER_MODECOSTS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_init_mode_costs(VP8_COMP *x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_MODECOSTS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.c
deleted file mode 100644
index 71218cc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <limits.h>
-#include "vpx_config.h"
-#include "onyx_int.h"
-#include "mr_dissim.h"
-#include "vpx_mem/vpx_mem.h"
-#include "rdopt.h"
-
-void vp8_cal_low_res_mb_cols(VP8_COMP *cpi)
-{
- int low_res_w;
-
- /* Support arbitrary down-sampling factor */
- unsigned int iw = cpi->oxcf.Width*cpi->oxcf.mr_down_sampling_factor.den
- + cpi->oxcf.mr_down_sampling_factor.num - 1;
-
- low_res_w = iw/cpi->oxcf.mr_down_sampling_factor.num;
- cpi->mr_low_res_mb_cols = ((low_res_w + 15) >> 4);
-}
-
-#define GET_MV(x) \
-if(x->mbmi.ref_frame !=INTRA_FRAME) \
-{ \
- mvx[cnt] = x->mbmi.mv.as_mv.row; \
- mvy[cnt] = x->mbmi.mv.as_mv.col; \
- cnt++; \
-}
-
-#define GET_MV_SIGN(x) \
-if(x->mbmi.ref_frame !=INTRA_FRAME) \
-{ \
- mvx[cnt] = x->mbmi.mv.as_mv.row; \
- mvy[cnt] = x->mbmi.mv.as_mv.col; \
- if (cm->ref_frame_sign_bias[x->mbmi.ref_frame] \
- != cm->ref_frame_sign_bias[tmp->mbmi.ref_frame]) \
- { \
- mvx[cnt] *= -1; \
- mvy[cnt] *= -1; \
- } \
- cnt++; \
-}
-
-void vp8_cal_dissimilarity(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
- int i;
-
- /* Note: The first row & first column in mip are outside the frame, which
- * were initialized to all 0.(ref_frame, mode, mv...)
- * Their ref_frame = 0 means they won't be counted in the following
- * calculation.
- */
- if (cpi->oxcf.mr_total_resolutions >1
- && cpi->oxcf.mr_encoder_id < (cpi->oxcf.mr_total_resolutions - 1))
- {
- /* Store info for show/no-show frames for supporting alt_ref.
- * If parent frame is alt_ref, child has one too.
- */
- LOWER_RES_FRAME_INFO* store_info
- = (LOWER_RES_FRAME_INFO*)cpi->oxcf.mr_low_res_mode_info;
-
- store_info->frame_type = cm->frame_type;
-
- if(cm->frame_type != KEY_FRAME)
- {
- store_info->is_frame_dropped = 0;
- for (i = 1; i < MAX_REF_FRAMES; i++)
- store_info->low_res_ref_frames[i] = cpi->current_ref_frames[i];
- }
-
- if(cm->frame_type != KEY_FRAME)
- {
- int mb_row;
- int mb_col;
- /* Point to beginning of allocated MODE_INFO arrays. */
- MODE_INFO *tmp = cm->mip + cm->mode_info_stride;
- LOWER_RES_MB_INFO* store_mode_info = store_info->mb_info;
-
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row ++)
- {
- tmp++;
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col ++)
- {
- int dissim = INT_MAX;
-
- if(tmp->mbmi.ref_frame !=INTRA_FRAME)
- {
- int mvx[8];
- int mvy[8];
- int mmvx;
- int mmvy;
- int cnt=0;
- const MODE_INFO *here = tmp;
- const MODE_INFO *above = here - cm->mode_info_stride;
- const MODE_INFO *left = here - 1;
- const MODE_INFO *aboveleft = above - 1;
- const MODE_INFO *aboveright = NULL;
- const MODE_INFO *right = NULL;
- const MODE_INFO *belowleft = NULL;
- const MODE_INFO *below = NULL;
- const MODE_INFO *belowright = NULL;
-
- /* If alternate reference frame is used, we have to
- * check sign of MV. */
- if(cpi->oxcf.play_alternate)
- {
- /* Gather mv of neighboring MBs */
- GET_MV_SIGN(above)
- GET_MV_SIGN(left)
- GET_MV_SIGN(aboveleft)
-
- if(mb_col < (cm->mb_cols-1))
- {
- right = here + 1;
- aboveright = above + 1;
- GET_MV_SIGN(right)
- GET_MV_SIGN(aboveright)
- }
-
- if(mb_row < (cm->mb_rows-1))
- {
- below = here + cm->mode_info_stride;
- belowleft = below - 1;
- GET_MV_SIGN(below)
- GET_MV_SIGN(belowleft)
- }
-
- if(mb_col < (cm->mb_cols-1)
- && mb_row < (cm->mb_rows-1))
- {
- belowright = below + 1;
- GET_MV_SIGN(belowright)
- }
- }else
- {
- /* No alt_ref and gather mv of neighboring MBs */
- GET_MV(above)
- GET_MV(left)
- GET_MV(aboveleft)
-
- if(mb_col < (cm->mb_cols-1))
- {
- right = here + 1;
- aboveright = above + 1;
- GET_MV(right)
- GET_MV(aboveright)
- }
-
- if(mb_row < (cm->mb_rows-1))
- {
- below = here + cm->mode_info_stride;
- belowleft = below - 1;
- GET_MV(below)
- GET_MV(belowleft)
- }
-
- if(mb_col < (cm->mb_cols-1)
- && mb_row < (cm->mb_rows-1))
- {
- belowright = below + 1;
- GET_MV(belowright)
- }
- }
-
- if (cnt > 0)
- {
- int max_mvx = mvx[0];
- int min_mvx = mvx[0];
- int max_mvy = mvy[0];
- int min_mvy = mvy[0];
- int i;
-
- if (cnt > 1)
- {
- for (i=1; i< cnt; i++)
- {
- if (mvx[i] > max_mvx) max_mvx = mvx[i];
- else if (mvx[i] < min_mvx) min_mvx = mvx[i];
- if (mvy[i] > max_mvy) max_mvy = mvy[i];
- else if (mvy[i] < min_mvy) min_mvy = mvy[i];
- }
- }
-
- mmvx = MAX(abs(min_mvx - here->mbmi.mv.as_mv.row),
- abs(max_mvx - here->mbmi.mv.as_mv.row));
- mmvy = MAX(abs(min_mvy - here->mbmi.mv.as_mv.col),
- abs(max_mvy - here->mbmi.mv.as_mv.col));
- dissim = MAX(mmvx, mmvy);
- }
- }
-
- /* Store mode info for next resolution encoding */
- store_mode_info->mode = tmp->mbmi.mode;
- store_mode_info->ref_frame = tmp->mbmi.ref_frame;
- store_mode_info->mv.as_int = tmp->mbmi.mv.as_int;
- store_mode_info->dissim = dissim;
- tmp++;
- store_mode_info++;
- }
- }
- }
- }
-}
-
-/* This function is called only when this frame is dropped at current
- resolution level. */
-void vp8_store_drop_frame_info(VP8_COMP *cpi)
-{
- /* If the frame is dropped in lower-resolution encoding, this information
- is passed to higher resolution level so that the encoder knows there
- is no mode & motion info available.
- */
- if (cpi->oxcf.mr_total_resolutions >1
- && cpi->oxcf.mr_encoder_id < (cpi->oxcf.mr_total_resolutions - 1))
- {
- /* Store info for show/no-show frames for supporting alt_ref.
- * If parent frame is alt_ref, child has one too.
- */
- LOWER_RES_FRAME_INFO* store_info
- = (LOWER_RES_FRAME_INFO*)cpi->oxcf.mr_low_res_mode_info;
-
- /* Set frame_type to be INTER_FRAME since we won't drop key frame. */
- store_info->frame_type = INTER_FRAME;
- store_info->is_frame_dropped = 1;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.h
deleted file mode 100644
index 5a59ce6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/mr_dissim.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_MR_DISSIM_H_
-#define VP8_ENCODER_MR_DISSIM_H_
-#include "vpx_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void vp8_cal_low_res_mb_cols(VP8_COMP *cpi);
-extern void vp8_cal_dissimilarity(VP8_COMP *cpi);
-extern void vp8_store_drop_frame_info(VP8_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_MR_DISSIM_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_if.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_if.c
deleted file mode 100644
index fd15718..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_if.c
+++ /dev/null
@@ -1,5605 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "./vpx_scale_rtcd.h"
-#include "vp8/common/onyxc_int.h"
-#include "vp8/common/blockd.h"
-#include "onyx_int.h"
-#include "vp8/common/systemdependent.h"
-#include "quantize.h"
-#include "vp8/common/alloccommon.h"
-#include "mcomp.h"
-#include "firstpass.h"
-#include "vpx/internal/vpx_psnr.h"
-#include "vpx_scale/vpx_scale.h"
-#include "vp8/common/extend.h"
-#include "ratectrl.h"
-#include "vp8/common/quant_common.h"
-#include "segmentation.h"
-#if CONFIG_POSTPROC
-#include "vp8/common/postproc.h"
-#endif
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/swapyv12buffer.h"
-#include "vp8/common/threading.h"
-#include "vpx_ports/vpx_timer.h"
-#if ARCH_ARM
-#include "vpx_ports/arm.h"
-#endif
-#if CONFIG_MULTI_RES_ENCODING
-#include "mr_dissim.h"
-#endif
-#include "encodeframe.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <limits.h>
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
-extern int vp8_update_coef_context(VP8_COMP *cpi);
-extern void vp8_update_coef_probs(VP8_COMP *cpi);
-#endif
-
-extern void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi);
-extern void vp8cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val);
-extern void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi);
-
-extern void vp8_deblock_frame(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post, int filt_lvl, int low_var_thresh, int flag);
-extern void print_parms(VP8_CONFIG *ocf, char *filenam);
-extern unsigned int vp8_get_processor_freq();
-extern void print_tree_update_probs();
-extern int vp8cx_create_encoder_threads(VP8_COMP *cpi);
-extern void vp8cx_remove_encoder_threads(VP8_COMP *cpi);
-
-int vp8_estimate_entropy_savings(VP8_COMP *cpi);
-
-int vp8_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest);
-
-extern void vp8_temporal_filter_prepare_c(VP8_COMP *cpi, int distance);
-
-static void set_default_lf_deltas(VP8_COMP *cpi);
-
-extern const int vp8_gf_interval_table[101];
-
-#if CONFIG_INTERNAL_STATS
-#include "math.h"
-
-extern double vp8_calc_ssim
-(
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *dest,
- int lumamask,
- double *weight
-);
-
-
-extern double vp8_calc_ssimg
-(
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *dest,
- double *ssim_y,
- double *ssim_u,
- double *ssim_v
-);
-
-
-#endif
-
-
-#ifdef OUTPUT_YUV_SRC
-FILE *yuv_file;
-#endif
-
-#if 0
-FILE *framepsnr;
-FILE *kf_list;
-FILE *keyfile;
-#endif
-
-#if 0
-extern int skip_true_count;
-extern int skip_false_count;
-#endif
-
-
-#ifdef VP8_ENTROPY_STATS
-extern int intra_mode_stats[10][10][10];
-#endif
-
-#ifdef SPEEDSTATS
-unsigned int frames_at_speed[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-unsigned int tot_pm = 0;
-unsigned int cnt_pm = 0;
-unsigned int tot_ef = 0;
-unsigned int cnt_ef = 0;
-#endif
-
-#ifdef MODE_STATS
-extern unsigned __int64 Sectionbits[50];
-extern int y_modes[5] ;
-extern int uv_modes[4] ;
-extern int b_modes[10] ;
-
-extern int inter_y_modes[10] ;
-extern int inter_uv_modes[4] ;
-extern unsigned int inter_b_modes[15];
-#endif
-
-extern const int vp8_bits_per_mb[2][QINDEX_RANGE];
-
-extern const int qrounding_factors[129];
-extern const int qzbin_factors[129];
-extern void vp8cx_init_quantizer(VP8_COMP *cpi);
-extern const int vp8cx_base_skip_false_prob[128];
-
-/* Tables relating active max Q to active min Q */
-static const unsigned char kf_low_motion_minq[QINDEX_RANGE] =
-{
- 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,1,1,1,1,1,1,1,1,2,2,2,2,
- 3,3,3,3,3,3,4,4,4,5,5,5,5,5,6,6,
- 6,6,7,7,8,8,8,8,9,9,10,10,10,10,11,11,
- 11,11,12,12,13,13,13,13,14,14,15,15,15,15,16,16,
- 16,16,17,17,18,18,18,18,19,20,20,21,21,22,23,23
-};
-static const unsigned char kf_high_motion_minq[QINDEX_RANGE] =
-{
- 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,
- 1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,
- 3,3,3,3,4,4,4,4,5,5,5,5,5,5,6,6,
- 6,6,7,7,8,8,8,8,9,9,10,10,10,10,11,11,
- 11,11,12,12,13,13,13,13,14,14,15,15,15,15,16,16,
- 16,16,17,17,18,18,18,18,19,19,20,20,20,20,21,21,
- 21,21,22,22,23,23,24,25,25,26,26,27,28,28,29,30
-};
-static const unsigned char gf_low_motion_minq[QINDEX_RANGE] =
-{
- 0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,
- 3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,
- 7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,
- 11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,
- 19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,
- 27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,
- 35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,
- 43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58
-};
-static const unsigned char gf_mid_motion_minq[QINDEX_RANGE] =
-{
- 0,0,0,0,1,1,1,1,1,1,2,2,3,3,3,4,
- 4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,
- 9,10,10,10,10,11,11,11,12,12,12,12,13,13,13,14,
- 14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,
- 22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,
- 30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,
- 38,39,39,40,40,41,41,42,42,43,43,44,45,46,47,48,
- 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
-};
-static const unsigned char gf_high_motion_minq[QINDEX_RANGE] =
-{
- 0,0,0,0,1,1,1,1,1,2,2,2,3,3,3,4,
- 4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,
- 9,10,10,10,11,11,12,12,13,13,14,14,15,15,16,16,
- 17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,
- 25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,
- 33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,
- 41,41,42,42,43,44,45,46,47,48,49,50,51,52,53,54,
- 55,56,57,58,59,60,62,64,66,68,70,72,74,76,78,80
-};
-static const unsigned char inter_minq[QINDEX_RANGE] =
-{
- 0,0,1,1,2,3,3,4,4,5,6,6,7,8,8,9,
- 9,10,11,11,12,13,13,14,15,15,16,17,17,18,19,20,
- 20,21,22,22,23,24,24,25,26,27,27,28,29,30,30,31,
- 32,33,33,34,35,36,36,37,38,39,39,40,41,42,42,43,
- 44,45,46,46,47,48,49,50,50,51,52,53,54,55,55,56,
- 57,58,59,60,60,61,62,63,64,65,66,67,67,68,69,70,
- 71,72,73,74,75,75,76,77,78,79,80,81,82,83,84,85,
- 86,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100
-};
-
-#ifdef PACKET_TESTING
-extern FILE *vpxlogc;
-#endif
-
-static void save_layer_context(VP8_COMP *cpi)
-{
- LAYER_CONTEXT *lc = &cpi->layer_context[cpi->current_layer];
-
- /* Save layer dependent coding state */
- lc->target_bandwidth = cpi->target_bandwidth;
- lc->starting_buffer_level = cpi->oxcf.starting_buffer_level;
- lc->optimal_buffer_level = cpi->oxcf.optimal_buffer_level;
- lc->maximum_buffer_size = cpi->oxcf.maximum_buffer_size;
- lc->starting_buffer_level_in_ms = cpi->oxcf.starting_buffer_level_in_ms;
- lc->optimal_buffer_level_in_ms = cpi->oxcf.optimal_buffer_level_in_ms;
- lc->maximum_buffer_size_in_ms = cpi->oxcf.maximum_buffer_size_in_ms;
- lc->buffer_level = cpi->buffer_level;
- lc->bits_off_target = cpi->bits_off_target;
- lc->total_actual_bits = cpi->total_actual_bits;
- lc->worst_quality = cpi->worst_quality;
- lc->active_worst_quality = cpi->active_worst_quality;
- lc->best_quality = cpi->best_quality;
- lc->active_best_quality = cpi->active_best_quality;
- lc->ni_av_qi = cpi->ni_av_qi;
- lc->ni_tot_qi = cpi->ni_tot_qi;
- lc->ni_frames = cpi->ni_frames;
- lc->avg_frame_qindex = cpi->avg_frame_qindex;
- lc->rate_correction_factor = cpi->rate_correction_factor;
- lc->key_frame_rate_correction_factor = cpi->key_frame_rate_correction_factor;
- lc->gf_rate_correction_factor = cpi->gf_rate_correction_factor;
- lc->zbin_over_quant = cpi->mb.zbin_over_quant;
- lc->inter_frame_target = cpi->inter_frame_target;
- lc->total_byte_count = cpi->total_byte_count;
- lc->filter_level = cpi->common.filter_level;
-
- lc->last_frame_percent_intra = cpi->last_frame_percent_intra;
-
- memcpy (lc->count_mb_ref_frame_usage,
- cpi->mb.count_mb_ref_frame_usage,
- sizeof(cpi->mb.count_mb_ref_frame_usage));
-}
-
-static void restore_layer_context(VP8_COMP *cpi, const int layer)
-{
- LAYER_CONTEXT *lc = &cpi->layer_context[layer];
-
- /* Restore layer dependent coding state */
- cpi->current_layer = layer;
- cpi->target_bandwidth = lc->target_bandwidth;
- cpi->oxcf.target_bandwidth = lc->target_bandwidth;
- cpi->oxcf.starting_buffer_level = lc->starting_buffer_level;
- cpi->oxcf.optimal_buffer_level = lc->optimal_buffer_level;
- cpi->oxcf.maximum_buffer_size = lc->maximum_buffer_size;
- cpi->oxcf.starting_buffer_level_in_ms = lc->starting_buffer_level_in_ms;
- cpi->oxcf.optimal_buffer_level_in_ms = lc->optimal_buffer_level_in_ms;
- cpi->oxcf.maximum_buffer_size_in_ms = lc->maximum_buffer_size_in_ms;
- cpi->buffer_level = lc->buffer_level;
- cpi->bits_off_target = lc->bits_off_target;
- cpi->total_actual_bits = lc->total_actual_bits;
- cpi->active_worst_quality = lc->active_worst_quality;
- cpi->active_best_quality = lc->active_best_quality;
- cpi->ni_av_qi = lc->ni_av_qi;
- cpi->ni_tot_qi = lc->ni_tot_qi;
- cpi->ni_frames = lc->ni_frames;
- cpi->avg_frame_qindex = lc->avg_frame_qindex;
- cpi->rate_correction_factor = lc->rate_correction_factor;
- cpi->key_frame_rate_correction_factor = lc->key_frame_rate_correction_factor;
- cpi->gf_rate_correction_factor = lc->gf_rate_correction_factor;
- cpi->mb.zbin_over_quant = lc->zbin_over_quant;
- cpi->inter_frame_target = lc->inter_frame_target;
- cpi->total_byte_count = lc->total_byte_count;
- cpi->common.filter_level = lc->filter_level;
-
- cpi->last_frame_percent_intra = lc->last_frame_percent_intra;
-
- memcpy (cpi->mb.count_mb_ref_frame_usage,
- lc->count_mb_ref_frame_usage,
- sizeof(cpi->mb.count_mb_ref_frame_usage));
-}
-
-static int rescale(int val, int num, int denom)
-{
- int64_t llnum = num;
- int64_t llden = denom;
- int64_t llval = val;
-
- return (int)(llval * llnum / llden);
-}
-
-static void init_temporal_layer_context(VP8_COMP *cpi,
- VP8_CONFIG *oxcf,
- const int layer,
- double prev_layer_framerate)
-{
- LAYER_CONTEXT *lc = &cpi->layer_context[layer];
-
- lc->framerate = cpi->output_framerate / cpi->oxcf.rate_decimator[layer];
- lc->target_bandwidth = cpi->oxcf.target_bitrate[layer] * 1000;
-
- lc->starting_buffer_level_in_ms = oxcf->starting_buffer_level;
- lc->optimal_buffer_level_in_ms = oxcf->optimal_buffer_level;
- lc->maximum_buffer_size_in_ms = oxcf->maximum_buffer_size;
-
- lc->starting_buffer_level =
- rescale((int)(oxcf->starting_buffer_level),
- lc->target_bandwidth, 1000);
-
- if (oxcf->optimal_buffer_level == 0)
- lc->optimal_buffer_level = lc->target_bandwidth / 8;
- else
- lc->optimal_buffer_level =
- rescale((int)(oxcf->optimal_buffer_level),
- lc->target_bandwidth, 1000);
-
- if (oxcf->maximum_buffer_size == 0)
- lc->maximum_buffer_size = lc->target_bandwidth / 8;
- else
- lc->maximum_buffer_size =
- rescale((int)(oxcf->maximum_buffer_size),
- lc->target_bandwidth, 1000);
-
- /* Work out the average size of a frame within this layer */
- if (layer > 0)
- lc->avg_frame_size_for_layer =
- (int)((cpi->oxcf.target_bitrate[layer] -
- cpi->oxcf.target_bitrate[layer-1]) * 1000 /
- (lc->framerate - prev_layer_framerate));
-
- lc->active_worst_quality = cpi->oxcf.worst_allowed_q;
- lc->active_best_quality = cpi->oxcf.best_allowed_q;
- lc->avg_frame_qindex = cpi->oxcf.worst_allowed_q;
-
- lc->buffer_level = lc->starting_buffer_level;
- lc->bits_off_target = lc->starting_buffer_level;
-
- lc->total_actual_bits = 0;
- lc->ni_av_qi = 0;
- lc->ni_tot_qi = 0;
- lc->ni_frames = 0;
- lc->rate_correction_factor = 1.0;
- lc->key_frame_rate_correction_factor = 1.0;
- lc->gf_rate_correction_factor = 1.0;
- lc->inter_frame_target = 0;
-}
-
-// Upon a run-time change in temporal layers, reset the layer context parameters
-// for any "new" layers. For "existing" layers, let them inherit the parameters
-// from the previous layer state (at the same layer #). In future we may want
-// to better map the previous layer state(s) to the "new" ones.
-static void reset_temporal_layer_change(VP8_COMP *cpi,
- VP8_CONFIG *oxcf,
- const int prev_num_layers)
-{
- int i;
- double prev_layer_framerate = 0;
- const int curr_num_layers = cpi->oxcf.number_of_layers;
- // If the previous state was 1 layer, get current layer context from cpi.
- // We need this to set the layer context for the new layers below.
- if (prev_num_layers == 1)
- {
- cpi->current_layer = 0;
- save_layer_context(cpi);
- }
- for (i = 0; i < curr_num_layers; i++)
- {
- LAYER_CONTEXT *lc = &cpi->layer_context[i];
- if (i >= prev_num_layers)
- {
- init_temporal_layer_context(cpi, oxcf, i, prev_layer_framerate);
- }
- // The initial buffer levels are set based on their starting levels.
- // We could set the buffer levels based on the previous state (normalized
- // properly by the layer bandwidths) but we would need to keep track of
- // the previous set of layer bandwidths (i.e., target_bitrate[i])
- // before the layer change. For now, reset to the starting levels.
- lc->buffer_level = cpi->oxcf.starting_buffer_level_in_ms *
- cpi->oxcf.target_bitrate[i];
- lc->bits_off_target = lc->buffer_level;
- // TDOD(marpan): Should we set the rate_correction_factor and
- // active_worst/best_quality to values derived from the previous layer
- // state (to smooth-out quality dips/rate fluctuation at transition)?
-
- // We need to treat the 1 layer case separately: oxcf.target_bitrate[i]
- // is not set for 1 layer, and the restore_layer_context/save_context()
- // are not called in the encoding loop, so we need to call it here to
- // pass the layer context state to |cpi|.
- if (curr_num_layers == 1)
- {
- lc->target_bandwidth = cpi->oxcf.target_bandwidth;
- lc->buffer_level = cpi->oxcf.starting_buffer_level_in_ms *
- lc->target_bandwidth / 1000;
- lc->bits_off_target = lc->buffer_level;
- restore_layer_context(cpi, 0);
- }
- prev_layer_framerate = cpi->output_framerate /
- cpi->oxcf.rate_decimator[i];
- }
-}
-
-static void setup_features(VP8_COMP *cpi)
-{
- // If segmentation enabled set the update flags
- if ( cpi->mb.e_mbd.segmentation_enabled )
- {
- cpi->mb.e_mbd.update_mb_segmentation_map = 1;
- cpi->mb.e_mbd.update_mb_segmentation_data = 1;
- }
- else
- {
- cpi->mb.e_mbd.update_mb_segmentation_map = 0;
- cpi->mb.e_mbd.update_mb_segmentation_data = 0;
- }
-
- cpi->mb.e_mbd.mode_ref_lf_delta_enabled = 0;
- cpi->mb.e_mbd.mode_ref_lf_delta_update = 0;
- vpx_memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas));
- vpx_memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas));
- vpx_memset(cpi->mb.e_mbd.last_ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas));
- vpx_memset(cpi->mb.e_mbd.last_mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas));
-
- set_default_lf_deltas(cpi);
-
-}
-
-
-static void dealloc_raw_frame_buffers(VP8_COMP *cpi);
-
-
-static void dealloc_compressor_data(VP8_COMP *cpi)
-{
- vpx_free(cpi->tplist);
- cpi->tplist = NULL;
-
- /* Delete last frame MV storage buffers */
- vpx_free(cpi->lfmv);
- cpi->lfmv = 0;
-
- vpx_free(cpi->lf_ref_frame_sign_bias);
- cpi->lf_ref_frame_sign_bias = 0;
-
- vpx_free(cpi->lf_ref_frame);
- cpi->lf_ref_frame = 0;
-
- /* Delete sementation map */
- vpx_free(cpi->segmentation_map);
- cpi->segmentation_map = 0;
-
- vpx_free(cpi->active_map);
- cpi->active_map = 0;
-
- vp8_de_alloc_frame_buffers(&cpi->common);
-
- vp8_yv12_de_alloc_frame_buffer(&cpi->pick_lf_lvl_frame);
- vp8_yv12_de_alloc_frame_buffer(&cpi->scaled_source);
- dealloc_raw_frame_buffers(cpi);
-
- vpx_free(cpi->tok);
- cpi->tok = 0;
-
- /* Structure used to monitor GF usage */
- vpx_free(cpi->gf_active_flags);
- cpi->gf_active_flags = 0;
-
- /* Activity mask based per mb zbin adjustments */
- vpx_free(cpi->mb_activity_map);
- cpi->mb_activity_map = 0;
-
- vpx_free(cpi->mb.pip);
- cpi->mb.pip = 0;
-
-#if CONFIG_MULTITHREAD
- vpx_free(cpi->mt_current_mb_col);
- cpi->mt_current_mb_col = NULL;
-#endif
-}
-
-static void enable_segmentation(VP8_COMP *cpi)
-{
- /* Set the appropriate feature bit */
- cpi->mb.e_mbd.segmentation_enabled = 1;
- cpi->mb.e_mbd.update_mb_segmentation_map = 1;
- cpi->mb.e_mbd.update_mb_segmentation_data = 1;
-}
-static void disable_segmentation(VP8_COMP *cpi)
-{
- /* Clear the appropriate feature bit */
- cpi->mb.e_mbd.segmentation_enabled = 0;
-}
-
-/* Valid values for a segment are 0 to 3
- * Segmentation map is arrange as [Rows][Columns]
- */
-static void set_segmentation_map(VP8_COMP *cpi, unsigned char *segmentation_map)
-{
- /* Copy in the new segmentation map */
- vpx_memcpy(cpi->segmentation_map, segmentation_map, (cpi->common.mb_rows * cpi->common.mb_cols));
-
- /* Signal that the map should be updated. */
- cpi->mb.e_mbd.update_mb_segmentation_map = 1;
- cpi->mb.e_mbd.update_mb_segmentation_data = 1;
-}
-
-/* The values given for each segment can be either deltas (from the default
- * value chosen for the frame) or absolute values.
- *
- * Valid range for abs values is:
- * (0-127 for MB_LVL_ALT_Q), (0-63 for SEGMENT_ALT_LF)
- * Valid range for delta values are:
- * (+/-127 for MB_LVL_ALT_Q), (+/-63 for SEGMENT_ALT_LF)
- *
- * abs_delta = SEGMENT_DELTADATA (deltas)
- * abs_delta = SEGMENT_ABSDATA (use the absolute values given).
- *
- */
-static void set_segment_data(VP8_COMP *cpi, signed char *feature_data, unsigned char abs_delta)
-{
- cpi->mb.e_mbd.mb_segement_abs_delta = abs_delta;
- vpx_memcpy(cpi->segment_feature_data, feature_data, sizeof(cpi->segment_feature_data));
-}
-
-
-static void segmentation_test_function(VP8_COMP *cpi)
-{
- unsigned char *seg_map;
- signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
-
- // Create a temporary map for segmentation data.
- CHECK_MEM_ERROR(seg_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
-
- // Set the segmentation Map
- set_segmentation_map(cpi, seg_map);
-
- // Activate segmentation.
- enable_segmentation(cpi);
-
- // Set up the quant segment data
- feature_data[MB_LVL_ALT_Q][0] = 0;
- feature_data[MB_LVL_ALT_Q][1] = 4;
- feature_data[MB_LVL_ALT_Q][2] = 0;
- feature_data[MB_LVL_ALT_Q][3] = 0;
- // Set up the loop segment data
- feature_data[MB_LVL_ALT_LF][0] = 0;
- feature_data[MB_LVL_ALT_LF][1] = 0;
- feature_data[MB_LVL_ALT_LF][2] = 0;
- feature_data[MB_LVL_ALT_LF][3] = 0;
-
- // Initialise the feature data structure
- // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
- set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA);
-
- // Delete sementation map
- vpx_free(seg_map);
-
- seg_map = 0;
-}
-
-/* A simple function to cyclically refresh the background at a lower Q */
-static void cyclic_background_refresh(VP8_COMP *cpi, int Q, int lf_adjustment)
-{
- unsigned char *seg_map = cpi->segmentation_map;
- signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
- int i;
- int block_count = cpi->cyclic_refresh_mode_max_mbs_perframe;
- int mbs_in_frame = cpi->common.mb_rows * cpi->common.mb_cols;
-
- cpi->cyclic_refresh_q = Q / 2;
-
- // Set every macroblock to be eligible for update.
- // For key frame this will reset seg map to 0.
- vpx_memset(cpi->segmentation_map, 0, mbs_in_frame);
-
- if (cpi->common.frame_type != KEY_FRAME)
- {
- /* Cycle through the macro_block rows */
- /* MB loop to set local segmentation map */
- i = cpi->cyclic_refresh_mode_index;
- assert(i < mbs_in_frame);
- do
- {
- /* If the MB is as a candidate for clean up then mark it for
- * possible boost/refresh (segment 1) The segment id may get
- * reset to 0 later if the MB gets coded anything other than
- * last frame 0,0 as only (last frame 0,0) MBs are eligable for
- * refresh : that is to say Mbs likely to be background blocks.
- */
- if (cpi->cyclic_refresh_map[i] == 0)
- {
- seg_map[i] = 1;
- block_count --;
- }
- else if (cpi->cyclic_refresh_map[i] < 0)
- cpi->cyclic_refresh_map[i]++;
-
- i++;
- if (i == mbs_in_frame)
- i = 0;
-
- }
- while(block_count && i != cpi->cyclic_refresh_mode_index);
-
- cpi->cyclic_refresh_mode_index = i;
- }
-
- /* Activate segmentation. */
- cpi->mb.e_mbd.update_mb_segmentation_map = 1;
- cpi->mb.e_mbd.update_mb_segmentation_data = 1;
- enable_segmentation(cpi);
-
- /* Set up the quant segment data */
- feature_data[MB_LVL_ALT_Q][0] = 0;
- feature_data[MB_LVL_ALT_Q][1] = (cpi->cyclic_refresh_q - Q);
- feature_data[MB_LVL_ALT_Q][2] = 0;
- feature_data[MB_LVL_ALT_Q][3] = 0;
-
- /* Set up the loop segment data */
- feature_data[MB_LVL_ALT_LF][0] = 0;
- feature_data[MB_LVL_ALT_LF][1] = lf_adjustment;
- feature_data[MB_LVL_ALT_LF][2] = 0;
- feature_data[MB_LVL_ALT_LF][3] = 0;
-
- /* Initialise the feature data structure */
- set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA);
-
-}
-
-static void set_default_lf_deltas(VP8_COMP *cpi)
-{
- cpi->mb.e_mbd.mode_ref_lf_delta_enabled = 1;
- cpi->mb.e_mbd.mode_ref_lf_delta_update = 1;
-
- vpx_memset(cpi->mb.e_mbd.ref_lf_deltas, 0, sizeof(cpi->mb.e_mbd.ref_lf_deltas));
- vpx_memset(cpi->mb.e_mbd.mode_lf_deltas, 0, sizeof(cpi->mb.e_mbd.mode_lf_deltas));
-
- /* Test of ref frame deltas */
- cpi->mb.e_mbd.ref_lf_deltas[INTRA_FRAME] = 2;
- cpi->mb.e_mbd.ref_lf_deltas[LAST_FRAME] = 0;
- cpi->mb.e_mbd.ref_lf_deltas[GOLDEN_FRAME] = -2;
- cpi->mb.e_mbd.ref_lf_deltas[ALTREF_FRAME] = -2;
-
- cpi->mb.e_mbd.mode_lf_deltas[0] = 4; /* BPRED */
-
- if(cpi->oxcf.Mode == MODE_REALTIME)
- cpi->mb.e_mbd.mode_lf_deltas[1] = -12; /* Zero */
- else
- cpi->mb.e_mbd.mode_lf_deltas[1] = -2; /* Zero */
-
- cpi->mb.e_mbd.mode_lf_deltas[2] = 2; /* New mv */
- cpi->mb.e_mbd.mode_lf_deltas[3] = 4; /* Split mv */
-}
-
-/* Convenience macros for mapping speed and mode into a continuous
- * range
- */
-#define GOOD(x) (x+1)
-#define RT(x) (x+7)
-
-static int speed_map(int speed, const int *map)
-{
- int res;
-
- do
- {
- res = *map++;
- } while(speed >= *map++);
- return res;
-}
-
-static const int thresh_mult_map_znn[] = {
- /* map common to zero, nearest, and near */
- 0, GOOD(2), 1500, GOOD(3), 2000, RT(0), 1000, RT(2), 2000, INT_MAX
-};
-
-static const int thresh_mult_map_vhpred[] = {
- 1000, GOOD(2), 1500, GOOD(3), 2000, RT(0), 1000, RT(1), 2000,
- RT(7), INT_MAX, INT_MAX
-};
-
-static const int thresh_mult_map_bpred[] = {
- 2000, GOOD(0), 2500, GOOD(2), 5000, GOOD(3), 7500, RT(0), 2500, RT(1), 5000,
- RT(6), INT_MAX, INT_MAX
-};
-
-static const int thresh_mult_map_tm[] = {
- 1000, GOOD(2), 1500, GOOD(3), 2000, RT(0), 0, RT(1), 1000, RT(2), 2000,
- RT(7), INT_MAX, INT_MAX
-};
-
-static const int thresh_mult_map_new1[] = {
- 1000, GOOD(2), 2000, RT(0), 2000, INT_MAX
-};
-
-static const int thresh_mult_map_new2[] = {
- 1000, GOOD(2), 2000, GOOD(3), 2500, GOOD(5), 4000, RT(0), 2000, RT(2), 2500,
- RT(5), 4000, INT_MAX
-};
-
-static const int thresh_mult_map_split1[] = {
- 2500, GOOD(0), 1700, GOOD(2), 10000, GOOD(3), 25000, GOOD(4), INT_MAX,
- RT(0), 5000, RT(1), 10000, RT(2), 25000, RT(3), INT_MAX, INT_MAX
-};
-
-static const int thresh_mult_map_split2[] = {
- 5000, GOOD(0), 4500, GOOD(2), 20000, GOOD(3), 50000, GOOD(4), INT_MAX,
- RT(0), 10000, RT(1), 20000, RT(2), 50000, RT(3), INT_MAX, INT_MAX
-};
-
-static const int mode_check_freq_map_zn2[] = {
- /* {zero,nearest}{2,3} */
- 0, RT(10), 1<<1, RT(11), 1<<2, RT(12), 1<<3, INT_MAX
-};
-
-static const int mode_check_freq_map_vhbpred[] = {
- 0, GOOD(5), 2, RT(0), 0, RT(3), 2, RT(5), 4, INT_MAX
-};
-
-static const int mode_check_freq_map_near2[] = {
- 0, GOOD(5), 2, RT(0), 0, RT(3), 2, RT(10), 1<<2, RT(11), 1<<3, RT(12), 1<<4,
- INT_MAX
-};
-
-static const int mode_check_freq_map_new1[] = {
- 0, RT(10), 1<<1, RT(11), 1<<2, RT(12), 1<<3, INT_MAX
-};
-
-static const int mode_check_freq_map_new2[] = {
- 0, GOOD(5), 4, RT(0), 0, RT(3), 4, RT(10), 1<<3, RT(11), 1<<4, RT(12), 1<<5,
- INT_MAX
-};
-
-static const int mode_check_freq_map_split1[] = {
- 0, GOOD(2), 2, GOOD(3), 7, RT(1), 2, RT(2), 7, INT_MAX
-};
-
-static const int mode_check_freq_map_split2[] = {
- 0, GOOD(1), 2, GOOD(2), 4, GOOD(3), 15, RT(1), 4, RT(2), 15, INT_MAX
-};
-
-void vp8_set_speed_features(VP8_COMP *cpi)
-{
- SPEED_FEATURES *sf = &cpi->sf;
- int Mode = cpi->compressor_speed;
- int Speed = cpi->Speed;
- int i;
- VP8_COMMON *cm = &cpi->common;
- int last_improved_quant = sf->improved_quant;
- int ref_frames;
-
- /* Initialise default mode frequency sampling variables */
- for (i = 0; i < MAX_MODES; i ++)
- {
- cpi->mode_check_freq[i] = 0;
- }
-
- cpi->mb.mbs_tested_so_far = 0;
-
- /* best quality defaults */
- sf->RD = 1;
- sf->search_method = NSTEP;
- sf->improved_quant = 1;
- sf->improved_dct = 1;
- sf->auto_filter = 1;
- sf->recode_loop = 1;
- sf->quarter_pixel_search = 1;
- sf->half_pixel_search = 1;
- sf->iterative_sub_pixel = 1;
- sf->optimize_coefficients = 1;
- sf->use_fastquant_for_pick = 0;
- sf->no_skip_block4x4_search = 1;
-
- sf->first_step = 0;
- sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
- sf->improved_mv_pred = 1;
-
- /* default thresholds to 0 */
- for (i = 0; i < MAX_MODES; i++)
- sf->thresh_mult[i] = 0;
-
- /* Count enabled references */
- ref_frames = 1;
- if (cpi->ref_frame_flags & VP8_LAST_FRAME)
- ref_frames++;
- if (cpi->ref_frame_flags & VP8_GOLD_FRAME)
- ref_frames++;
- if (cpi->ref_frame_flags & VP8_ALTR_FRAME)
- ref_frames++;
-
- /* Convert speed to continuous range, with clamping */
- if (Mode == 0)
- Speed = 0;
- else if (Mode == 2)
- Speed = RT(Speed);
- else
- {
- if (Speed > 5)
- Speed = 5;
- Speed = GOOD(Speed);
- }
-
- sf->thresh_mult[THR_ZERO1] =
- sf->thresh_mult[THR_NEAREST1] =
- sf->thresh_mult[THR_NEAR1] =
- sf->thresh_mult[THR_DC] = 0; /* always */
-
- sf->thresh_mult[THR_ZERO2] =
- sf->thresh_mult[THR_ZERO3] =
- sf->thresh_mult[THR_NEAREST2] =
- sf->thresh_mult[THR_NEAREST3] =
- sf->thresh_mult[THR_NEAR2] =
- sf->thresh_mult[THR_NEAR3] = speed_map(Speed, thresh_mult_map_znn);
-
- sf->thresh_mult[THR_V_PRED] =
- sf->thresh_mult[THR_H_PRED] = speed_map(Speed, thresh_mult_map_vhpred);
- sf->thresh_mult[THR_B_PRED] = speed_map(Speed, thresh_mult_map_bpred);
- sf->thresh_mult[THR_TM] = speed_map(Speed, thresh_mult_map_tm);
- sf->thresh_mult[THR_NEW1] = speed_map(Speed, thresh_mult_map_new1);
- sf->thresh_mult[THR_NEW2] =
- sf->thresh_mult[THR_NEW3] = speed_map(Speed, thresh_mult_map_new2);
- sf->thresh_mult[THR_SPLIT1] = speed_map(Speed, thresh_mult_map_split1);
- sf->thresh_mult[THR_SPLIT2] =
- sf->thresh_mult[THR_SPLIT3] = speed_map(Speed, thresh_mult_map_split2);
-
- cpi->mode_check_freq[THR_ZERO1] =
- cpi->mode_check_freq[THR_NEAREST1] =
- cpi->mode_check_freq[THR_NEAR1] =
- cpi->mode_check_freq[THR_TM] =
- cpi->mode_check_freq[THR_DC] = 0; /* always */
-
- cpi->mode_check_freq[THR_ZERO2] =
- cpi->mode_check_freq[THR_ZERO3] =
- cpi->mode_check_freq[THR_NEAREST2] =
- cpi->mode_check_freq[THR_NEAREST3] = speed_map(Speed,
- mode_check_freq_map_zn2);
-
- cpi->mode_check_freq[THR_NEAR2] =
- cpi->mode_check_freq[THR_NEAR3] = speed_map(Speed,
- mode_check_freq_map_near2);
-
- cpi->mode_check_freq[THR_V_PRED] =
- cpi->mode_check_freq[THR_H_PRED] =
- cpi->mode_check_freq[THR_B_PRED] = speed_map(Speed,
- mode_check_freq_map_vhbpred);
- cpi->mode_check_freq[THR_NEW1] = speed_map(Speed,
- mode_check_freq_map_new1);
- cpi->mode_check_freq[THR_NEW2] =
- cpi->mode_check_freq[THR_NEW3] = speed_map(Speed,
- mode_check_freq_map_new2);
- cpi->mode_check_freq[THR_SPLIT1] = speed_map(Speed,
- mode_check_freq_map_split1);
- cpi->mode_check_freq[THR_SPLIT2] =
- cpi->mode_check_freq[THR_SPLIT3] = speed_map(Speed,
- mode_check_freq_map_split2);
- Speed = cpi->Speed;
- switch (Mode)
- {
-#if !(CONFIG_REALTIME_ONLY)
- case 0: /* best quality mode */
- sf->first_step = 0;
- sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
- break;
- case 1:
- case 3:
- if (Speed > 0)
- {
- /* Disable coefficient optimization above speed 0 */
- sf->optimize_coefficients = 0;
- sf->use_fastquant_for_pick = 1;
- sf->no_skip_block4x4_search = 0;
-
- sf->first_step = 1;
- }
-
- if (Speed > 2)
- {
- sf->improved_quant = 0;
- sf->improved_dct = 0;
-
- /* Only do recode loop on key frames, golden frames and
- * alt ref frames
- */
- sf->recode_loop = 2;
-
- }
-
- if (Speed > 3)
- {
- sf->auto_filter = 1;
- sf->recode_loop = 0; /* recode loop off */
- sf->RD = 0; /* Turn rd off */
-
- }
-
- if (Speed > 4)
- {
- sf->auto_filter = 0; /* Faster selection of loop filter */
- }
-
- break;
-#endif
- case 2:
- sf->optimize_coefficients = 0;
- sf->recode_loop = 0;
- sf->auto_filter = 1;
- sf->iterative_sub_pixel = 1;
- sf->search_method = NSTEP;
-
- if (Speed > 0)
- {
- sf->improved_quant = 0;
- sf->improved_dct = 0;
-
- sf->use_fastquant_for_pick = 1;
- sf->no_skip_block4x4_search = 0;
- sf->first_step = 1;
- }
-
- if (Speed > 2)
- sf->auto_filter = 0; /* Faster selection of loop filter */
-
- if (Speed > 3)
- {
- sf->RD = 0;
- sf->auto_filter = 1;
- }
-
- if (Speed > 4)
- {
- sf->auto_filter = 0; /* Faster selection of loop filter */
- sf->search_method = HEX;
- sf->iterative_sub_pixel = 0;
- }
-
- if (Speed > 6)
- {
- unsigned int sum = 0;
- unsigned int total_mbs = cm->MBs;
- int thresh;
- unsigned int total_skip;
-
- int min = 2000;
-
- if (cpi->oxcf.encode_breakout > 2000)
- min = cpi->oxcf.encode_breakout;
-
- min >>= 7;
-
- for (i = 0; i < min; i++)
- {
- sum += cpi->mb.error_bins[i];
- }
-
- total_skip = sum;
- sum = 0;
-
- /* i starts from 2 to make sure thresh started from 2048 */
- for (; i < 1024; i++)
- {
- sum += cpi->mb.error_bins[i];
-
- if (10 * sum >= (unsigned int)(cpi->Speed - 6)*(total_mbs - total_skip))
- break;
- }
-
- i--;
- thresh = (i << 7);
-
- if (thresh < 2000)
- thresh = 2000;
-
- if (ref_frames > 1)
- {
- sf->thresh_mult[THR_NEW1 ] = thresh;
- sf->thresh_mult[THR_NEAREST1 ] = thresh >> 1;
- sf->thresh_mult[THR_NEAR1 ] = thresh >> 1;
- }
-
- if (ref_frames > 2)
- {
- sf->thresh_mult[THR_NEW2] = thresh << 1;
- sf->thresh_mult[THR_NEAREST2 ] = thresh;
- sf->thresh_mult[THR_NEAR2 ] = thresh;
- }
-
- if (ref_frames > 3)
- {
- sf->thresh_mult[THR_NEW3] = thresh << 1;
- sf->thresh_mult[THR_NEAREST3 ] = thresh;
- sf->thresh_mult[THR_NEAR3 ] = thresh;
- }
-
- sf->improved_mv_pred = 0;
- }
-
- if (Speed > 8)
- sf->quarter_pixel_search = 0;
-
- if(cm->version == 0)
- {
- cm->filter_type = NORMAL_LOOPFILTER;
-
- if (Speed >= 14)
- cm->filter_type = SIMPLE_LOOPFILTER;
- }
- else
- {
- cm->filter_type = SIMPLE_LOOPFILTER;
- }
-
- /* This has a big hit on quality. Last resort */
- if (Speed >= 15)
- sf->half_pixel_search = 0;
-
- vpx_memset(cpi->mb.error_bins, 0, sizeof(cpi->mb.error_bins));
-
- }; /* switch */
-
- /* Slow quant, dct and trellis not worthwhile for first pass
- * so make sure they are always turned off.
- */
- if ( cpi->pass == 1 )
- {
- sf->improved_quant = 0;
- sf->optimize_coefficients = 0;
- sf->improved_dct = 0;
- }
-
- if (cpi->sf.search_method == NSTEP)
- {
- vp8_init3smotion_compensation(&cpi->mb, cm->yv12_fb[cm->lst_fb_idx].y_stride);
- }
- else if (cpi->sf.search_method == DIAMOND)
- {
- vp8_init_dsmotion_compensation(&cpi->mb, cm->yv12_fb[cm->lst_fb_idx].y_stride);
- }
-
- if (cpi->sf.improved_dct)
- {
- cpi->mb.short_fdct8x4 = vp8_short_fdct8x4;
- cpi->mb.short_fdct4x4 = vp8_short_fdct4x4;
- }
- else
- {
- /* No fast FDCT defined for any platform at this time. */
- cpi->mb.short_fdct8x4 = vp8_short_fdct8x4;
- cpi->mb.short_fdct4x4 = vp8_short_fdct4x4;
- }
-
- cpi->mb.short_walsh4x4 = vp8_short_walsh4x4;
-
- if (cpi->sf.improved_quant)
- {
- cpi->mb.quantize_b = vp8_regular_quantize_b;
- cpi->mb.quantize_b_pair = vp8_regular_quantize_b_pair;
- }
- else
- {
- cpi->mb.quantize_b = vp8_fast_quantize_b;
- cpi->mb.quantize_b_pair = vp8_fast_quantize_b_pair;
- }
- if (cpi->sf.improved_quant != last_improved_quant)
- vp8cx_init_quantizer(cpi);
-
- if (cpi->sf.iterative_sub_pixel == 1)
- {
- cpi->find_fractional_mv_step = vp8_find_best_sub_pixel_step_iteratively;
- }
- else if (cpi->sf.quarter_pixel_search)
- {
- cpi->find_fractional_mv_step = vp8_find_best_sub_pixel_step;
- }
- else if (cpi->sf.half_pixel_search)
- {
- cpi->find_fractional_mv_step = vp8_find_best_half_pixel_step;
- }
- else
- {
- cpi->find_fractional_mv_step = vp8_skip_fractional_mv_step;
- }
-
- if (cpi->sf.optimize_coefficients == 1 && cpi->pass!=1)
- cpi->mb.optimize = 1;
- else
- cpi->mb.optimize = 0;
-
- if (cpi->common.full_pixel)
- cpi->find_fractional_mv_step = vp8_skip_fractional_mv_step;
-
-#ifdef SPEEDSTATS
- frames_at_speed[cpi->Speed]++;
-#endif
-}
-#undef GOOD
-#undef RT
-
-static void alloc_raw_frame_buffers(VP8_COMP *cpi)
-{
-#if VP8_TEMPORAL_ALT_REF
- int width = (cpi->oxcf.Width + 15) & ~15;
- int height = (cpi->oxcf.Height + 15) & ~15;
-#endif
-
- cpi->lookahead = vp8_lookahead_init(cpi->oxcf.Width, cpi->oxcf.Height,
- cpi->oxcf.lag_in_frames);
- if(!cpi->lookahead)
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate lag buffers");
-
-#if VP8_TEMPORAL_ALT_REF
-
- if (vp8_yv12_alloc_frame_buffer(&cpi->alt_ref_buffer,
- width, height, VP8BORDERINPIXELS))
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate altref buffer");
-
-#endif
-}
-
-
-static void dealloc_raw_frame_buffers(VP8_COMP *cpi)
-{
-#if VP8_TEMPORAL_ALT_REF
- vp8_yv12_de_alloc_frame_buffer(&cpi->alt_ref_buffer);
-#endif
- vp8_lookahead_destroy(cpi->lookahead);
-}
-
-
-static int vp8_alloc_partition_data(VP8_COMP *cpi)
-{
- vpx_free(cpi->mb.pip);
-
- cpi->mb.pip = vpx_calloc((cpi->common.mb_cols + 1) *
- (cpi->common.mb_rows + 1),
- sizeof(PARTITION_INFO));
- if(!cpi->mb.pip)
- return 1;
-
- cpi->mb.pi = cpi->mb.pip + cpi->common.mode_info_stride + 1;
-
- return 0;
-}
-
-void vp8_alloc_compressor_data(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = & cpi->common;
-
- int width = cm->Width;
- int height = cm->Height;
-
- if (vp8_alloc_frame_buffers(cm, width, height))
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate frame buffers");
-
- if (vp8_alloc_partition_data(cpi))
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate partition data");
-
-
- if ((width & 0xf) != 0)
- width += 16 - (width & 0xf);
-
- if ((height & 0xf) != 0)
- height += 16 - (height & 0xf);
-
-
- if (vp8_yv12_alloc_frame_buffer(&cpi->pick_lf_lvl_frame,
- width, height, VP8BORDERINPIXELS))
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate last frame buffer");
-
- if (vp8_yv12_alloc_frame_buffer(&cpi->scaled_source,
- width, height, VP8BORDERINPIXELS))
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate scaled source buffer");
-
- vpx_free(cpi->tok);
-
- {
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- unsigned int tokens = 8 * 24 * 16; /* one MB for each thread */
-#else
- unsigned int tokens = cm->mb_rows * cm->mb_cols * 24 * 16;
-#endif
- CHECK_MEM_ERROR(cpi->tok, vpx_calloc(tokens, sizeof(*cpi->tok)));
- }
-
- /* Data used for real time vc mode to see if gf needs refreshing */
- cpi->zeromv_count = 0;
-
-
- /* Structures used to monitor GF usage */
- vpx_free(cpi->gf_active_flags);
- CHECK_MEM_ERROR(cpi->gf_active_flags,
- vpx_calloc(sizeof(*cpi->gf_active_flags),
- cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
- vpx_free(cpi->mb_activity_map);
- CHECK_MEM_ERROR(cpi->mb_activity_map,
- vpx_calloc(sizeof(*cpi->mb_activity_map),
- cm->mb_rows * cm->mb_cols));
-
- /* allocate memory for storing last frame's MVs for MV prediction. */
- vpx_free(cpi->lfmv);
- CHECK_MEM_ERROR(cpi->lfmv, vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
- sizeof(*cpi->lfmv)));
- vpx_free(cpi->lf_ref_frame_sign_bias);
- CHECK_MEM_ERROR(cpi->lf_ref_frame_sign_bias,
- vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
- sizeof(*cpi->lf_ref_frame_sign_bias)));
- vpx_free(cpi->lf_ref_frame);
- CHECK_MEM_ERROR(cpi->lf_ref_frame,
- vpx_calloc((cm->mb_rows+2) * (cm->mb_cols+2),
- sizeof(*cpi->lf_ref_frame)));
-
- /* Create the encoder segmentation map and set all entries to 0 */
- vpx_free(cpi->segmentation_map);
- CHECK_MEM_ERROR(cpi->segmentation_map,
- vpx_calloc(cm->mb_rows * cm->mb_cols,
- sizeof(*cpi->segmentation_map)));
- cpi->cyclic_refresh_mode_index = 0;
- vpx_free(cpi->active_map);
- CHECK_MEM_ERROR(cpi->active_map,
- vpx_calloc(cm->mb_rows * cm->mb_cols,
- sizeof(*cpi->active_map)));
- vpx_memset(cpi->active_map , 1, (cm->mb_rows * cm->mb_cols));
-
-#if CONFIG_MULTITHREAD
- if (width < 640)
- cpi->mt_sync_range = 1;
- else if (width <= 1280)
- cpi->mt_sync_range = 4;
- else if (width <= 2560)
- cpi->mt_sync_range = 8;
- else
- cpi->mt_sync_range = 16;
-
- if (cpi->oxcf.multi_threaded > 1)
- {
- vpx_free(cpi->mt_current_mb_col);
- CHECK_MEM_ERROR(cpi->mt_current_mb_col,
- vpx_malloc(sizeof(*cpi->mt_current_mb_col) * cm->mb_rows));
- }
-
-#endif
-
- vpx_free(cpi->tplist);
- CHECK_MEM_ERROR(cpi->tplist, vpx_malloc(sizeof(TOKENLIST) * cm->mb_rows));
-}
-
-
-/* Quant MOD */
-static const int q_trans[] =
-{
- 0, 1, 2, 3, 4, 5, 7, 8,
- 9, 10, 12, 13, 15, 17, 18, 19,
- 20, 21, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 33, 35, 37, 39, 41,
- 43, 45, 47, 49, 51, 53, 55, 57,
- 59, 61, 64, 67, 70, 73, 76, 79,
- 82, 85, 88, 91, 94, 97, 100, 103,
- 106, 109, 112, 115, 118, 121, 124, 127,
-};
-
-int vp8_reverse_trans(int x)
-{
- int i;
-
- for (i = 0; i < 64; i++)
- if (q_trans[i] >= x)
- return i;
-
- return 63;
-}
-void vp8_new_framerate(VP8_COMP *cpi, double framerate)
-{
- if(framerate < .1)
- framerate = 30;
-
- cpi->framerate = framerate;
- cpi->output_framerate = framerate;
- cpi->per_frame_bandwidth = (int)(cpi->oxcf.target_bandwidth /
- cpi->output_framerate);
- cpi->av_per_frame_bandwidth = cpi->per_frame_bandwidth;
- cpi->min_frame_bandwidth = (int)(cpi->av_per_frame_bandwidth *
- cpi->oxcf.two_pass_vbrmin_section / 100);
-
- /* Set Maximum gf/arf interval */
- cpi->max_gf_interval = ((int)(cpi->output_framerate / 2.0) + 2);
-
- if(cpi->max_gf_interval < 12)
- cpi->max_gf_interval = 12;
-
- /* Extended interval for genuinely static scenes */
- cpi->twopass.static_scene_max_gf_interval = cpi->key_frame_frequency >> 1;
-
- /* Special conditions when altr ref frame enabled in lagged compress mode */
- if (cpi->oxcf.play_alternate && cpi->oxcf.lag_in_frames)
- {
- if (cpi->max_gf_interval > cpi->oxcf.lag_in_frames - 1)
- cpi->max_gf_interval = cpi->oxcf.lag_in_frames - 1;
-
- if (cpi->twopass.static_scene_max_gf_interval > cpi->oxcf.lag_in_frames - 1)
- cpi->twopass.static_scene_max_gf_interval = cpi->oxcf.lag_in_frames - 1;
- }
-
- if ( cpi->max_gf_interval > cpi->twopass.static_scene_max_gf_interval )
- cpi->max_gf_interval = cpi->twopass.static_scene_max_gf_interval;
-}
-
-
-static void init_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
-{
- VP8_COMMON *cm = &cpi->common;
-
- cpi->oxcf = *oxcf;
-
- cpi->auto_gold = 1;
- cpi->auto_adjust_gold_quantizer = 1;
-
- cm->version = oxcf->Version;
- vp8_setup_version(cm);
-
- /* frame rate is not available on the first frame, as it's derived from
- * the observed timestamps. The actual value used here doesn't matter
- * too much, as it will adapt quickly. If the reciprocal of the timebase
- * seems like a reasonable framerate, then use that as a guess, otherwise
- * use 30.
- */
- cpi->framerate = (double)(oxcf->timebase.den) /
- (double)(oxcf->timebase.num);
-
- if (cpi->framerate > 180)
- cpi->framerate = 30;
-
- cpi->ref_framerate = cpi->framerate;
-
- /* change includes all joint functionality */
- vp8_change_config(cpi, oxcf);
-
- /* Initialize active best and worst q and average q values. */
- cpi->active_worst_quality = cpi->oxcf.worst_allowed_q;
- cpi->active_best_quality = cpi->oxcf.best_allowed_q;
- cpi->avg_frame_qindex = cpi->oxcf.worst_allowed_q;
-
- /* Initialise the starting buffer levels */
- cpi->buffer_level = cpi->oxcf.starting_buffer_level;
- cpi->bits_off_target = cpi->oxcf.starting_buffer_level;
-
- cpi->rolling_target_bits = cpi->av_per_frame_bandwidth;
- cpi->rolling_actual_bits = cpi->av_per_frame_bandwidth;
- cpi->long_rolling_target_bits = cpi->av_per_frame_bandwidth;
- cpi->long_rolling_actual_bits = cpi->av_per_frame_bandwidth;
-
- cpi->total_actual_bits = 0;
- cpi->total_target_vs_actual = 0;
-
- /* Temporal scalabilty */
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
- double prev_layer_framerate=0;
-
- for (i=0; i<cpi->oxcf.number_of_layers; i++)
- {
- init_temporal_layer_context(cpi, oxcf, i, prev_layer_framerate);
- prev_layer_framerate = cpi->output_framerate /
- cpi->oxcf.rate_decimator[i];
- }
- }
-
-#if VP8_TEMPORAL_ALT_REF
- {
- int i;
-
- cpi->fixed_divide[0] = 0;
-
- for (i = 1; i < 512; i++)
- cpi->fixed_divide[i] = 0x80000 / i;
- }
-#endif
-}
-
-static void update_layer_contexts (VP8_COMP *cpi)
-{
- VP8_CONFIG *oxcf = &cpi->oxcf;
-
- /* Update snapshots of the layer contexts to reflect new parameters */
- if (oxcf->number_of_layers > 1)
- {
- unsigned int i;
- double prev_layer_framerate=0;
-
- assert(oxcf->number_of_layers <= VPX_TS_MAX_LAYERS);
- for (i=0; i<oxcf->number_of_layers; i++)
- {
- LAYER_CONTEXT *lc = &cpi->layer_context[i];
-
- lc->framerate =
- cpi->ref_framerate / oxcf->rate_decimator[i];
- lc->target_bandwidth = oxcf->target_bitrate[i] * 1000;
-
- lc->starting_buffer_level = rescale(
- (int)oxcf->starting_buffer_level_in_ms,
- lc->target_bandwidth, 1000);
-
- if (oxcf->optimal_buffer_level == 0)
- lc->optimal_buffer_level = lc->target_bandwidth / 8;
- else
- lc->optimal_buffer_level = rescale(
- (int)oxcf->optimal_buffer_level_in_ms,
- lc->target_bandwidth, 1000);
-
- if (oxcf->maximum_buffer_size == 0)
- lc->maximum_buffer_size = lc->target_bandwidth / 8;
- else
- lc->maximum_buffer_size = rescale(
- (int)oxcf->maximum_buffer_size_in_ms,
- lc->target_bandwidth, 1000);
-
- /* Work out the average size of a frame within this layer */
- if (i > 0)
- lc->avg_frame_size_for_layer =
- (int)((oxcf->target_bitrate[i] -
- oxcf->target_bitrate[i-1]) * 1000 /
- (lc->framerate - prev_layer_framerate));
-
- prev_layer_framerate = lc->framerate;
- }
- }
-}
-
-void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
-{
- VP8_COMMON *cm = &cpi->common;
- int last_w, last_h;
- uint32_t prev_number_of_layers;
-
- if (!cpi)
- return;
-
- if (!oxcf)
- return;
-
-#if CONFIG_MULTITHREAD
- /* wait for the last picture loopfilter thread done */
- if (cpi->b_lpf_running)
- {
- sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
- }
-#endif
-
- if (cm->version != oxcf->Version)
- {
- cm->version = oxcf->Version;
- vp8_setup_version(cm);
- }
-
- last_w = cpi->oxcf.Width;
- last_h = cpi->oxcf.Height;
- prev_number_of_layers = cpi->oxcf.number_of_layers;
-
- cpi->oxcf = *oxcf;
-
- switch (cpi->oxcf.Mode)
- {
-
- case MODE_REALTIME:
- cpi->pass = 0;
- cpi->compressor_speed = 2;
-
- if (cpi->oxcf.cpu_used < -16)
- {
- cpi->oxcf.cpu_used = -16;
- }
-
- if (cpi->oxcf.cpu_used > 16)
- cpi->oxcf.cpu_used = 16;
-
- break;
-
- case MODE_GOODQUALITY:
- cpi->pass = 0;
- cpi->compressor_speed = 1;
-
- if (cpi->oxcf.cpu_used < -5)
- {
- cpi->oxcf.cpu_used = -5;
- }
-
- if (cpi->oxcf.cpu_used > 5)
- cpi->oxcf.cpu_used = 5;
-
- break;
-
- case MODE_BESTQUALITY:
- cpi->pass = 0;
- cpi->compressor_speed = 0;
- break;
-
- case MODE_FIRSTPASS:
- cpi->pass = 1;
- cpi->compressor_speed = 1;
- break;
- case MODE_SECONDPASS:
- cpi->pass = 2;
- cpi->compressor_speed = 1;
-
- if (cpi->oxcf.cpu_used < -5)
- {
- cpi->oxcf.cpu_used = -5;
- }
-
- if (cpi->oxcf.cpu_used > 5)
- cpi->oxcf.cpu_used = 5;
-
- break;
- case MODE_SECONDPASS_BEST:
- cpi->pass = 2;
- cpi->compressor_speed = 0;
- break;
- }
-
- if (cpi->pass == 0)
- cpi->auto_worst_q = 1;
-
- cpi->oxcf.worst_allowed_q = q_trans[oxcf->worst_allowed_q];
- cpi->oxcf.best_allowed_q = q_trans[oxcf->best_allowed_q];
- cpi->oxcf.cq_level = q_trans[cpi->oxcf.cq_level];
-
- if (oxcf->fixed_q >= 0)
- {
- if (oxcf->worst_allowed_q < 0)
- cpi->oxcf.fixed_q = q_trans[0];
- else
- cpi->oxcf.fixed_q = q_trans[oxcf->worst_allowed_q];
-
- if (oxcf->alt_q < 0)
- cpi->oxcf.alt_q = q_trans[0];
- else
- cpi->oxcf.alt_q = q_trans[oxcf->alt_q];
-
- if (oxcf->key_q < 0)
- cpi->oxcf.key_q = q_trans[0];
- else
- cpi->oxcf.key_q = q_trans[oxcf->key_q];
-
- if (oxcf->gold_q < 0)
- cpi->oxcf.gold_q = q_trans[0];
- else
- cpi->oxcf.gold_q = q_trans[oxcf->gold_q];
-
- }
-
- cpi->baseline_gf_interval =
- cpi->oxcf.alt_freq ? cpi->oxcf.alt_freq : DEFAULT_GF_INTERVAL;
-
- cpi->ref_frame_flags = VP8_ALTR_FRAME | VP8_GOLD_FRAME | VP8_LAST_FRAME;
-
- cm->refresh_golden_frame = 0;
- cm->refresh_last_frame = 1;
- cm->refresh_entropy_probs = 1;
-
-#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- cpi->oxcf.token_partitions = 3;
-#endif
-
- if (cpi->oxcf.token_partitions >= 0 && cpi->oxcf.token_partitions <= 3)
- cm->multi_token_partition =
- (TOKEN_PARTITION) cpi->oxcf.token_partitions;
-
- setup_features(cpi);
-
- {
- int i;
-
- for (i = 0; i < MAX_MB_SEGMENTS; i++)
- cpi->segment_encode_breakout[i] = cpi->oxcf.encode_breakout;
- }
-
- /* At the moment the first order values may not be > MAXQ */
- if (cpi->oxcf.fixed_q > MAXQ)
- cpi->oxcf.fixed_q = MAXQ;
-
- /* local file playback mode == really big buffer */
- if (cpi->oxcf.end_usage == USAGE_LOCAL_FILE_PLAYBACK)
- {
- cpi->oxcf.starting_buffer_level = 60000;
- cpi->oxcf.optimal_buffer_level = 60000;
- cpi->oxcf.maximum_buffer_size = 240000;
- cpi->oxcf.starting_buffer_level_in_ms = 60000;
- cpi->oxcf.optimal_buffer_level_in_ms = 60000;
- cpi->oxcf.maximum_buffer_size_in_ms = 240000;
- }
-
- /* Convert target bandwidth from Kbit/s to Bit/s */
- cpi->oxcf.target_bandwidth *= 1000;
-
- cpi->oxcf.starting_buffer_level =
- rescale((int)cpi->oxcf.starting_buffer_level,
- cpi->oxcf.target_bandwidth, 1000);
-
- /* Set or reset optimal and maximum buffer levels. */
- if (cpi->oxcf.optimal_buffer_level == 0)
- cpi->oxcf.optimal_buffer_level = cpi->oxcf.target_bandwidth / 8;
- else
- cpi->oxcf.optimal_buffer_level =
- rescale((int)cpi->oxcf.optimal_buffer_level,
- cpi->oxcf.target_bandwidth, 1000);
-
- if (cpi->oxcf.maximum_buffer_size == 0)
- cpi->oxcf.maximum_buffer_size = cpi->oxcf.target_bandwidth / 8;
- else
- cpi->oxcf.maximum_buffer_size =
- rescale((int)cpi->oxcf.maximum_buffer_size,
- cpi->oxcf.target_bandwidth, 1000);
- // Under a configuration change, where maximum_buffer_size may change,
- // keep buffer level clipped to the maximum allowed buffer size.
- if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size) {
- cpi->bits_off_target = cpi->oxcf.maximum_buffer_size;
- cpi->buffer_level = cpi->bits_off_target;
- }
-
- /* Set up frame rate and related parameters rate control values. */
- vp8_new_framerate(cpi, cpi->framerate);
-
- /* Set absolute upper and lower quality limits */
- cpi->worst_quality = cpi->oxcf.worst_allowed_q;
- cpi->best_quality = cpi->oxcf.best_allowed_q;
-
- /* active values should only be modified if out of new range */
- if (cpi->active_worst_quality > cpi->oxcf.worst_allowed_q)
- {
- cpi->active_worst_quality = cpi->oxcf.worst_allowed_q;
- }
- /* less likely */
- else if (cpi->active_worst_quality < cpi->oxcf.best_allowed_q)
- {
- cpi->active_worst_quality = cpi->oxcf.best_allowed_q;
- }
- if (cpi->active_best_quality < cpi->oxcf.best_allowed_q)
- {
- cpi->active_best_quality = cpi->oxcf.best_allowed_q;
- }
- /* less likely */
- else if (cpi->active_best_quality > cpi->oxcf.worst_allowed_q)
- {
- cpi->active_best_quality = cpi->oxcf.worst_allowed_q;
- }
-
- cpi->buffered_mode = cpi->oxcf.optimal_buffer_level > 0;
-
- cpi->cq_target_quality = cpi->oxcf.cq_level;
-
- /* Only allow dropped frames in buffered mode */
- cpi->drop_frames_allowed = cpi->oxcf.allow_df && cpi->buffered_mode;
-
- cpi->target_bandwidth = cpi->oxcf.target_bandwidth;
-
- // Check if the number of temporal layers has changed, and if so reset the
- // pattern counter and set/initialize the temporal layer context for the
- // new layer configuration.
- if (cpi->oxcf.number_of_layers != prev_number_of_layers)
- {
- // If the number of temporal layers are changed we must start at the
- // base of the pattern cycle, so reset temporal_pattern_counter.
- cpi->temporal_pattern_counter = 0;
- reset_temporal_layer_change(cpi, oxcf, prev_number_of_layers);
- }
-
- cm->Width = cpi->oxcf.Width;
- cm->Height = cpi->oxcf.Height;
-
- /* TODO(jkoleszar): if an internal spatial resampling is active,
- * and we downsize the input image, maybe we should clear the
- * internal scale immediately rather than waiting for it to
- * correct.
- */
-
- /* VP8 sharpness level mapping 0-7 (vs 0-10 in general VPx dialogs) */
- if (cpi->oxcf.Sharpness > 7)
- cpi->oxcf.Sharpness = 7;
-
- cm->sharpness_level = cpi->oxcf.Sharpness;
-
- if (cm->horiz_scale != NORMAL || cm->vert_scale != NORMAL)
- {
- int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs);
- int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs);
-
- Scale2Ratio(cm->horiz_scale, &hr, &hs);
- Scale2Ratio(cm->vert_scale, &vr, &vs);
-
- /* always go to the next whole number */
- cm->Width = (hs - 1 + cpi->oxcf.Width * hr) / hs;
- cm->Height = (vs - 1 + cpi->oxcf.Height * vr) / vs;
- }
-
- if (last_w != cpi->oxcf.Width || last_h != cpi->oxcf.Height)
- cpi->force_next_frame_intra = 1;
-
- if (((cm->Width + 15) & 0xfffffff0) !=
- (uint32_t)(cm->yv12_fb[cm->lst_fb_idx].y_width) ||
- ((cm->Height + 15) & 0xfffffff0) !=
- (uint32_t)(cm->yv12_fb[cm->lst_fb_idx].y_height) ||
- cm->yv12_fb[cm->lst_fb_idx].y_width == 0)
- {
- dealloc_raw_frame_buffers(cpi);
- alloc_raw_frame_buffers(cpi);
- vp8_alloc_compressor_data(cpi);
- }
-
- if (cpi->oxcf.fixed_q >= 0)
- {
- cpi->last_q[0] = cpi->oxcf.fixed_q;
- cpi->last_q[1] = cpi->oxcf.fixed_q;
- }
-
- cpi->Speed = cpi->oxcf.cpu_used;
-
- /* force to allowlag to 0 if lag_in_frames is 0; */
- if (cpi->oxcf.lag_in_frames == 0)
- {
- cpi->oxcf.allow_lag = 0;
- }
- /* Limit on lag buffers as these are not currently dynamically allocated */
- else if (cpi->oxcf.lag_in_frames > MAX_LAG_BUFFERS)
- cpi->oxcf.lag_in_frames = MAX_LAG_BUFFERS;
-
- /* YX Temp */
- cpi->alt_ref_source = NULL;
- cpi->is_src_frame_alt_ref = 0;
-
-#if CONFIG_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity)
- {
- if (!cpi->denoiser.yv12_mc_running_avg.buffer_alloc)
- {
- int width = (cpi->oxcf.Width + 15) & ~15;
- int height = (cpi->oxcf.Height + 15) & ~15;
- vp8_denoiser_allocate(&cpi->denoiser, width, height);
- }
- }
-#endif
-
-#if 0
- /* Experimental RD Code */
- cpi->frame_distortion = 0;
- cpi->last_frame_distortion = 0;
-#endif
-
-}
-
-#define M_LOG2_E 0.693147180559945309417
-#define log2f(x) (log (x) / (float) M_LOG2_E)
-static void cal_mvsadcosts(int *mvsadcost[2])
-{
- int i = 1;
-
- mvsadcost [0] [0] = 300;
- mvsadcost [1] [0] = 300;
-
- 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 <= mvfp_max);
-}
-
-struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
-{
- int i;
-
- VP8_COMP *cpi;
- VP8_COMMON *cm;
-
- cpi = vpx_memalign(32, sizeof(VP8_COMP));
- /* Check that the CPI instance is valid */
- if (!cpi)
- return 0;
-
- cm = &cpi->common;
-
- vpx_memset(cpi, 0, sizeof(VP8_COMP));
-
- if (setjmp(cm->error.jmp))
- {
- cpi->common.error.setjmp = 0;
- vp8_remove_compressor(&cpi);
- return 0;
- }
-
- cpi->common.error.setjmp = 1;
-
- CHECK_MEM_ERROR(cpi->mb.ss, vpx_calloc(sizeof(search_site), (MAX_MVSEARCH_STEPS * 8) + 1));
-
- vp8_create_common(&cpi->common);
-
- init_config(cpi, oxcf);
-
- memcpy(cpi->base_skip_false_prob, vp8cx_base_skip_false_prob, sizeof(vp8cx_base_skip_false_prob));
- cpi->common.current_video_frame = 0;
- cpi->temporal_pattern_counter = 0;
- cpi->kf_overspend_bits = 0;
- cpi->kf_bitrate_adjustment = 0;
- cpi->frames_till_gf_update_due = 0;
- cpi->gf_overspend_bits = 0;
- cpi->non_gf_bitrate_adjustment = 0;
- cpi->prob_last_coded = 128;
- cpi->prob_gf_coded = 128;
- cpi->prob_intra_coded = 63;
-
- /* Prime the recent reference frame usage counters.
- * Hereafter they will be maintained as a sort of moving average
- */
- cpi->recent_ref_frame_usage[INTRA_FRAME] = 1;
- cpi->recent_ref_frame_usage[LAST_FRAME] = 1;
- cpi->recent_ref_frame_usage[GOLDEN_FRAME] = 1;
- cpi->recent_ref_frame_usage[ALTREF_FRAME] = 1;
-
- /* Set reference frame sign bias for ALTREF frame to 1 (for now) */
- cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 1;
-
- cpi->twopass.gf_decay_rate = 0;
- cpi->baseline_gf_interval = DEFAULT_GF_INTERVAL;
-
- cpi->gold_is_last = 0 ;
- cpi->alt_is_last = 0 ;
- cpi->gold_is_alt = 0 ;
-
- cpi->active_map_enabled = 0;
-
-#if 0
- /* Experimental code for lagged and one pass */
- /* Initialise one_pass GF frames stats */
- /* Update stats used for GF selection */
- if (cpi->pass == 0)
- {
- cpi->one_pass_frame_index = 0;
-
- for (i = 0; i < MAX_LAG_BUFFERS; i++)
- {
- cpi->one_pass_frame_stats[i].frames_so_far = 0;
- cpi->one_pass_frame_stats[i].frame_intra_error = 0.0;
- cpi->one_pass_frame_stats[i].frame_coded_error = 0.0;
- cpi->one_pass_frame_stats[i].frame_pcnt_inter = 0.0;
- cpi->one_pass_frame_stats[i].frame_pcnt_motion = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvr = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvr_abs = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvc = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvc_abs = 0.0;
- }
- }
-#endif
-
- /* Should we use the cyclic refresh method.
- * Currently this is tied to error resilliant mode
- */
- cpi->cyclic_refresh_mode_enabled = cpi->oxcf.error_resilient_mode;
- cpi->cyclic_refresh_mode_max_mbs_perframe = (cpi->common.mb_rows * cpi->common.mb_cols) / 5;
- cpi->cyclic_refresh_mode_index = 0;
- cpi->cyclic_refresh_q = 32;
-
- if (cpi->cyclic_refresh_mode_enabled)
- {
- CHECK_MEM_ERROR(cpi->cyclic_refresh_map, vpx_calloc((cpi->common.mb_rows * cpi->common.mb_cols), 1));
- }
- else
- cpi->cyclic_refresh_map = (signed char *) NULL;
-
-#ifdef VP8_ENTROPY_STATS
- init_context_counters();
-#endif
-
- /*Initialize the feed-forward activity masking.*/
- cpi->activity_avg = 90<<12;
-
- /* Give a sensible default for the first frame. */
- cpi->frames_since_key = 8;
- cpi->key_frame_frequency = cpi->oxcf.key_freq;
- cpi->this_key_frame_forced = 0;
- cpi->next_key_frame_forced = 0;
-
- cpi->source_alt_ref_pending = 0;
- cpi->source_alt_ref_active = 0;
- cpi->common.refresh_alt_ref_frame = 0;
-
- cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
-#if CONFIG_INTERNAL_STATS
- cpi->b_calculate_ssimg = 0;
-
- cpi->count = 0;
- cpi->bytes = 0;
-
- if (cpi->b_calculate_psnr)
- {
- cpi->total_sq_error = 0.0;
- cpi->total_sq_error2 = 0.0;
- cpi->total_y = 0.0;
- cpi->total_u = 0.0;
- cpi->total_v = 0.0;
- cpi->total = 0.0;
- cpi->totalp_y = 0.0;
- cpi->totalp_u = 0.0;
- cpi->totalp_v = 0.0;
- cpi->totalp = 0.0;
- cpi->tot_recode_hits = 0;
- cpi->summed_quality = 0;
- cpi->summed_weights = 0;
- }
-
- if (cpi->b_calculate_ssimg)
- {
- cpi->total_ssimg_y = 0;
- cpi->total_ssimg_u = 0;
- cpi->total_ssimg_v = 0;
- cpi->total_ssimg_all = 0;
- }
-
-#endif
-
- cpi->first_time_stamp_ever = 0x7FFFFFFF;
-
- cpi->frames_till_gf_update_due = 0;
- cpi->key_frame_count = 1;
-
- cpi->ni_av_qi = cpi->oxcf.worst_allowed_q;
- cpi->ni_tot_qi = 0;
- cpi->ni_frames = 0;
- cpi->total_byte_count = 0;
-
- cpi->drop_frame = 0;
-
- cpi->rate_correction_factor = 1.0;
- cpi->key_frame_rate_correction_factor = 1.0;
- cpi->gf_rate_correction_factor = 1.0;
- cpi->twopass.est_max_qcorrection_factor = 1.0;
-
- for (i = 0; i < KEY_FRAME_CONTEXT; i++)
- {
- cpi->prior_key_frame_distance[i] = (int)cpi->output_framerate;
- }
-
-#ifdef OUTPUT_YUV_SRC
- yuv_file = fopen("bd.yuv", "ab");
-#endif
-
-#if 0
- framepsnr = fopen("framepsnr.stt", "a");
- kf_list = fopen("kf_list.stt", "w");
-#endif
-
- cpi->output_pkt_list = oxcf->output_pkt_list;
-
-#if !(CONFIG_REALTIME_ONLY)
-
- if (cpi->pass == 1)
- {
- vp8_init_first_pass(cpi);
- }
- else if (cpi->pass == 2)
- {
- size_t packet_sz = sizeof(FIRSTPASS_STATS);
- int packets = (int)(oxcf->two_pass_stats_in.sz / packet_sz);
-
- cpi->twopass.stats_in_start = oxcf->two_pass_stats_in.buf;
- cpi->twopass.stats_in = cpi->twopass.stats_in_start;
- cpi->twopass.stats_in_end = (void*)((char *)cpi->twopass.stats_in
- + (packets - 1) * packet_sz);
- vp8_init_second_pass(cpi);
- }
-
-#endif
-
- if (cpi->compressor_speed == 2)
- {
- cpi->avg_encode_time = 0;
- cpi->avg_pick_mode_time = 0;
- }
-
- vp8_set_speed_features(cpi);
-
- /* Set starting values of RD threshold multipliers (128 = *1) */
- for (i = 0; i < MAX_MODES; i++)
- {
- cpi->mb.rd_thresh_mult[i] = 128;
- }
-
-#ifdef VP8_ENTROPY_STATS
- init_mv_ref_counts();
-#endif
-
-#if CONFIG_MULTITHREAD
- if(vp8cx_create_encoder_threads(cpi))
- {
- vp8_remove_compressor(&cpi);
- return 0;
- }
-#endif
-
- cpi->fn_ptr[BLOCK_16X16].sdf = vp8_sad16x16;
- cpi->fn_ptr[BLOCK_16X16].vf = vp8_variance16x16;
- cpi->fn_ptr[BLOCK_16X16].svf = vp8_sub_pixel_variance16x16;
- cpi->fn_ptr[BLOCK_16X16].svf_halfpix_h = vp8_variance_halfpixvar16x16_h;
- cpi->fn_ptr[BLOCK_16X16].svf_halfpix_v = vp8_variance_halfpixvar16x16_v;
- cpi->fn_ptr[BLOCK_16X16].svf_halfpix_hv = vp8_variance_halfpixvar16x16_hv;
- cpi->fn_ptr[BLOCK_16X16].sdx3f = vp8_sad16x16x3;
- cpi->fn_ptr[BLOCK_16X16].sdx8f = vp8_sad16x16x8;
- cpi->fn_ptr[BLOCK_16X16].sdx4df = vp8_sad16x16x4d;
-
- cpi->fn_ptr[BLOCK_16X8].sdf = vp8_sad16x8;
- cpi->fn_ptr[BLOCK_16X8].vf = vp8_variance16x8;
- cpi->fn_ptr[BLOCK_16X8].svf = vp8_sub_pixel_variance16x8;
- cpi->fn_ptr[BLOCK_16X8].svf_halfpix_h = NULL;
- cpi->fn_ptr[BLOCK_16X8].svf_halfpix_v = NULL;
- cpi->fn_ptr[BLOCK_16X8].svf_halfpix_hv = NULL;
- cpi->fn_ptr[BLOCK_16X8].sdx3f = vp8_sad16x8x3;
- cpi->fn_ptr[BLOCK_16X8].sdx8f = vp8_sad16x8x8;
- cpi->fn_ptr[BLOCK_16X8].sdx4df = vp8_sad16x8x4d;
-
- cpi->fn_ptr[BLOCK_8X16].sdf = vp8_sad8x16;
- cpi->fn_ptr[BLOCK_8X16].vf = vp8_variance8x16;
- cpi->fn_ptr[BLOCK_8X16].svf = vp8_sub_pixel_variance8x16;
- cpi->fn_ptr[BLOCK_8X16].svf_halfpix_h = NULL;
- cpi->fn_ptr[BLOCK_8X16].svf_halfpix_v = NULL;
- cpi->fn_ptr[BLOCK_8X16].svf_halfpix_hv = NULL;
- cpi->fn_ptr[BLOCK_8X16].sdx3f = vp8_sad8x16x3;
- cpi->fn_ptr[BLOCK_8X16].sdx8f = vp8_sad8x16x8;
- cpi->fn_ptr[BLOCK_8X16].sdx4df = vp8_sad8x16x4d;
-
- cpi->fn_ptr[BLOCK_8X8].sdf = vp8_sad8x8;
- cpi->fn_ptr[BLOCK_8X8].vf = vp8_variance8x8;
- cpi->fn_ptr[BLOCK_8X8].svf = vp8_sub_pixel_variance8x8;
- cpi->fn_ptr[BLOCK_8X8].svf_halfpix_h = NULL;
- cpi->fn_ptr[BLOCK_8X8].svf_halfpix_v = NULL;
- cpi->fn_ptr[BLOCK_8X8].svf_halfpix_hv = NULL;
- cpi->fn_ptr[BLOCK_8X8].sdx3f = vp8_sad8x8x3;
- cpi->fn_ptr[BLOCK_8X8].sdx8f = vp8_sad8x8x8;
- cpi->fn_ptr[BLOCK_8X8].sdx4df = vp8_sad8x8x4d;
-
- cpi->fn_ptr[BLOCK_4X4].sdf = vp8_sad4x4;
- cpi->fn_ptr[BLOCK_4X4].vf = vp8_variance4x4;
- cpi->fn_ptr[BLOCK_4X4].svf = vp8_sub_pixel_variance4x4;
- cpi->fn_ptr[BLOCK_4X4].svf_halfpix_h = NULL;
- cpi->fn_ptr[BLOCK_4X4].svf_halfpix_v = NULL;
- cpi->fn_ptr[BLOCK_4X4].svf_halfpix_hv = NULL;
- cpi->fn_ptr[BLOCK_4X4].sdx3f = vp8_sad4x4x3;
- cpi->fn_ptr[BLOCK_4X4].sdx8f = vp8_sad4x4x8;
- cpi->fn_ptr[BLOCK_4X4].sdx4df = vp8_sad4x4x4d;
-
-#if ARCH_X86_32 || ARCH_X86_64
- cpi->fn_ptr[BLOCK_16X16].copymem = vp8_copy32xn;
- cpi->fn_ptr[BLOCK_16X8].copymem = vp8_copy32xn;
- cpi->fn_ptr[BLOCK_8X16].copymem = vp8_copy32xn;
- cpi->fn_ptr[BLOCK_8X8].copymem = vp8_copy32xn;
- cpi->fn_ptr[BLOCK_4X4].copymem = vp8_copy32xn;
-#endif
-
- cpi->full_search_sad = vp8_full_search_sad;
- cpi->diamond_search_sad = vp8_diamond_search_sad;
- cpi->refining_search_sad = vp8_refining_search_sad;
-
- /* make sure frame 1 is okay */
- cpi->mb.error_bins[0] = cpi->common.MBs;
-
- /* vp8cx_init_quantizer() is first called here. Add check in
- * vp8cx_frame_init_quantizer() so that vp8cx_init_quantizer is only
- * called later when needed. This will avoid unnecessary calls of
- * vp8cx_init_quantizer() for every frame.
- */
- vp8cx_init_quantizer(cpi);
-
- vp8_loop_filter_init(cm);
-
- cpi->common.error.setjmp = 0;
-
-#if CONFIG_MULTI_RES_ENCODING
-
- /* Calculate # of MBs in a row in lower-resolution level image. */
- if (cpi->oxcf.mr_encoder_id > 0)
- vp8_cal_low_res_mb_cols(cpi);
-
-#endif
-
- /* setup RD costs to MACROBLOCK struct */
-
- cpi->mb.mvcost[0] = &cpi->rd_costs.mvcosts[0][mv_max+1];
- cpi->mb.mvcost[1] = &cpi->rd_costs.mvcosts[1][mv_max+1];
- cpi->mb.mvsadcost[0] = &cpi->rd_costs.mvsadcosts[0][mvfp_max+1];
- cpi->mb.mvsadcost[1] = &cpi->rd_costs.mvsadcosts[1][mvfp_max+1];
-
- cal_mvsadcosts(cpi->mb.mvsadcost);
-
- cpi->mb.mbmode_cost = cpi->rd_costs.mbmode_cost;
- cpi->mb.intra_uv_mode_cost = cpi->rd_costs.intra_uv_mode_cost;
- cpi->mb.bmode_costs = cpi->rd_costs.bmode_costs;
- cpi->mb.inter_bmode_costs = cpi->rd_costs.inter_bmode_costs;
- cpi->mb.token_costs = cpi->rd_costs.token_costs;
-
- /* setup block ptrs & offsets */
- vp8_setup_block_ptrs(&cpi->mb);
- vp8_setup_block_dptrs(&cpi->mb.e_mbd);
-
- return cpi;
-}
-
-
-void vp8_remove_compressor(VP8_COMP **ptr)
-{
- VP8_COMP *cpi = *ptr;
-
- if (!cpi)
- return;
-
- if (cpi && (cpi->common.current_video_frame > 0))
- {
-#if !(CONFIG_REALTIME_ONLY)
-
- if (cpi->pass == 2)
- {
- vp8_end_second_pass(cpi);
- }
-
-#endif
-
-#ifdef VP8_ENTROPY_STATS
- print_context_counters();
- print_tree_update_probs();
- print_mode_context();
-#endif
-
-#if CONFIG_INTERNAL_STATS
-
- if (cpi->pass != 1)
- {
- FILE *f = fopen("opsnr.stt", "a");
- double time_encoded = (cpi->last_end_time_stamp_seen
- - cpi->first_time_stamp_ever) / 10000000.000;
- double total_encode_time = (cpi->time_receive_data +
- cpi->time_compress_data) / 1000.000;
- double dr = (double)cpi->bytes * 8.0 / 1000.0 / time_encoded;
-
- if (cpi->b_calculate_psnr)
- {
- YV12_BUFFER_CONFIG *lst_yv12 =
- &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- int i;
-
- fprintf(f, "Layer\tBitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\t"
- "GLPsnrP\tVPXSSIM\t\n");
- for (i=0; i<(int)cpi->oxcf.number_of_layers; i++)
- {
- double dr = (double)cpi->bytes_in_layer[i] *
- 8.0 / 1000.0 / time_encoded;
- double samples = 3.0 / 2 * cpi->frames_in_layer[i] *
- lst_yv12->y_width * lst_yv12->y_height;
- double total_psnr =
- vpx_sse_to_psnr(samples, 255.0,
- cpi->total_error2[i]);
- double total_psnr2 =
- vpx_sse_to_psnr(samples, 255.0,
- cpi->total_error2_p[i]);
- double total_ssim = 100 * pow(cpi->sum_ssim[i] /
- cpi->sum_weights[i], 8.0);
-
- fprintf(f, "%5d\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t"
- "%7.3f\t%7.3f\n",
- i, dr,
- cpi->sum_psnr[i] / cpi->frames_in_layer[i],
- total_psnr,
- cpi->sum_psnr_p[i] / cpi->frames_in_layer[i],
- total_psnr2, total_ssim);
- }
- }
- else
- {
- double samples = 3.0 / 2 * cpi->count *
- lst_yv12->y_width * lst_yv12->y_height;
- double total_psnr = vpx_sse_to_psnr(samples, 255.0,
- cpi->total_sq_error);
- double total_psnr2 = vpx_sse_to_psnr(samples, 255.0,
- cpi->total_sq_error2);
- double total_ssim = 100 * pow(cpi->summed_quality /
- cpi->summed_weights, 8.0);
-
- fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\t"
- "GLPsnrP\tVPXSSIM\t Time(us)\n");
- fprintf(f, "%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t"
- "%7.3f\t%8.0f\n",
- dr, cpi->total / cpi->count, total_psnr,
- cpi->totalp / cpi->count, total_psnr2,
- total_ssim, total_encode_time);
- }
- }
-
- if (cpi->b_calculate_ssimg)
- {
- if (cpi->oxcf.number_of_layers > 1)
- {
- int i;
-
- fprintf(f, "Layer\tBitRate\tSSIM_Y\tSSIM_U\tSSIM_V\tSSIM_A\t"
- "Time(us)\n");
- for (i=0; i<(int)cpi->oxcf.number_of_layers; i++)
- {
- double dr = (double)cpi->bytes_in_layer[i] *
- 8.0 / 1000.0 / time_encoded;
- fprintf(f, "%5d\t%7.3f\t%6.4f\t"
- "%6.4f\t%6.4f\t%6.4f\t%8.0f\n",
- i, dr,
- cpi->total_ssimg_y_in_layer[i] /
- cpi->frames_in_layer[i],
- cpi->total_ssimg_u_in_layer[i] /
- cpi->frames_in_layer[i],
- cpi->total_ssimg_v_in_layer[i] /
- cpi->frames_in_layer[i],
- cpi->total_ssimg_all_in_layer[i] /
- cpi->frames_in_layer[i],
- total_encode_time);
- }
- }
- else
- {
- fprintf(f, "BitRate\tSSIM_Y\tSSIM_U\tSSIM_V\tSSIM_A\t"
- "Time(us)\n");
- fprintf(f, "%7.3f\t%6.4f\t%6.4f\t%6.4f\t%6.4f\t%8.0f\n", dr,
- cpi->total_ssimg_y / cpi->count,
- cpi->total_ssimg_u / cpi->count,
- cpi->total_ssimg_v / cpi->count,
- cpi->total_ssimg_all / cpi->count, total_encode_time);
- }
- }
-
- fclose(f);
-#if 0
- f = fopen("qskip.stt", "a");
- fprintf(f, "minq:%d -maxq:%d skiptrue:skipfalse = %d:%d\n", cpi->oxcf.best_allowed_q, cpi->oxcf.worst_allowed_q, skiptruecount, skipfalsecount);
- fclose(f);
-#endif
-
- }
-
-#endif
-
-
-#ifdef SPEEDSTATS
-
- if (cpi->compressor_speed == 2)
- {
- int i;
- FILE *f = fopen("cxspeed.stt", "a");
- cnt_pm /= cpi->common.MBs;
-
- for (i = 0; i < 16; i++)
- fprintf(f, "%5d", frames_at_speed[i]);
-
- fprintf(f, "\n");
- fclose(f);
- }
-
-#endif
-
-
-#ifdef MODE_STATS
- {
- extern int count_mb_seg[4];
- FILE *f = fopen("modes.stt", "a");
- double dr = (double)cpi->framerate * (double)bytes * (double)8 / (double)count / (double)1000 ;
- fprintf(f, "intra_mode in Intra Frames:\n");
- fprintf(f, "Y: %8d, %8d, %8d, %8d, %8d\n", y_modes[0], y_modes[1], y_modes[2], y_modes[3], y_modes[4]);
- fprintf(f, "UV:%8d, %8d, %8d, %8d\n", uv_modes[0], uv_modes[1], uv_modes[2], uv_modes[3]);
- fprintf(f, "B: ");
- {
- int i;
-
- for (i = 0; i < 10; i++)
- fprintf(f, "%8d, ", b_modes[i]);
-
- fprintf(f, "\n");
-
- }
-
- fprintf(f, "Modes in Inter Frames:\n");
- fprintf(f, "Y: %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d\n",
- inter_y_modes[0], inter_y_modes[1], inter_y_modes[2], inter_y_modes[3], inter_y_modes[4],
- inter_y_modes[5], inter_y_modes[6], inter_y_modes[7], inter_y_modes[8], inter_y_modes[9]);
- fprintf(f, "UV:%8d, %8d, %8d, %8d\n", inter_uv_modes[0], inter_uv_modes[1], inter_uv_modes[2], inter_uv_modes[3]);
- fprintf(f, "B: ");
- {
- int i;
-
- for (i = 0; i < 15; i++)
- fprintf(f, "%8d, ", inter_b_modes[i]);
-
- fprintf(f, "\n");
-
- }
- fprintf(f, "P:%8d, %8d, %8d, %8d\n", count_mb_seg[0], count_mb_seg[1], count_mb_seg[2], count_mb_seg[3]);
- fprintf(f, "PB:%8d, %8d, %8d, %8d\n", inter_b_modes[LEFT4X4], inter_b_modes[ABOVE4X4], inter_b_modes[ZERO4X4], inter_b_modes[NEW4X4]);
-
-
-
- fclose(f);
- }
-#endif
-
-#ifdef VP8_ENTROPY_STATS
- {
- int i, j, k;
- FILE *fmode = fopen("modecontext.c", "w");
-
- fprintf(fmode, "\n#include \"entropymode.h\"\n\n");
- fprintf(fmode, "const unsigned int vp8_kf_default_bmode_counts ");
- fprintf(fmode, "[VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES] =\n{\n");
-
- for (i = 0; i < 10; i++)
- {
-
- fprintf(fmode, " { /* Above Mode : %d */\n", i);
-
- for (j = 0; j < 10; j++)
- {
-
- fprintf(fmode, " {");
-
- for (k = 0; k < 10; k++)
- {
- if (!intra_mode_stats[i][j][k])
- fprintf(fmode, " %5d, ", 1);
- else
- fprintf(fmode, " %5d, ", intra_mode_stats[i][j][k]);
- }
-
- fprintf(fmode, "}, /* left_mode %d */\n", j);
-
- }
-
- fprintf(fmode, " },\n");
-
- }
-
- fprintf(fmode, "};\n");
- fclose(fmode);
- }
-#endif
-
-
-#if defined(SECTIONBITS_OUTPUT)
-
- if (0)
- {
- int i;
- FILE *f = fopen("tokenbits.stt", "a");
-
- for (i = 0; i < 28; i++)
- fprintf(f, "%8d", (int)(Sectionbits[i] / 256));
-
- fprintf(f, "\n");
- fclose(f);
- }
-
-#endif
-
-#if 0
- {
- printf("\n_pick_loop_filter_level:%d\n", cpi->time_pick_lpf / 1000);
- printf("\n_frames recive_data encod_mb_row compress_frame Total\n");
- printf("%6d %10ld %10ld %10ld %10ld\n", cpi->common.current_video_frame, cpi->time_receive_data / 1000, cpi->time_encode_mb_row / 1000, cpi->time_compress_data / 1000, (cpi->time_receive_data + cpi->time_compress_data) / 1000);
- }
-#endif
-
- }
-
-#if CONFIG_MULTITHREAD
- vp8cx_remove_encoder_threads(cpi);
-#endif
-
-#if CONFIG_TEMPORAL_DENOISING
- vp8_denoiser_free(&cpi->denoiser);
-#endif
- dealloc_compressor_data(cpi);
- vpx_free(cpi->mb.ss);
- vpx_free(cpi->tok);
- vpx_free(cpi->cyclic_refresh_map);
-
- vp8_remove_common(&cpi->common);
- vpx_free(cpi);
- *ptr = 0;
-
-#ifdef OUTPUT_YUV_SRC
- fclose(yuv_file);
-#endif
-
-#if 0
-
- if (keyfile)
- fclose(keyfile);
-
- if (framepsnr)
- fclose(framepsnr);
-
- if (kf_list)
- fclose(kf_list);
-
-#endif
-
-}
-
-
-static uint64_t calc_plane_error(unsigned char *orig, int orig_stride,
- unsigned char *recon, int recon_stride,
- unsigned int cols, unsigned int rows)
-{
- unsigned int row, col;
- uint64_t total_sse = 0;
- int diff;
-
- for (row = 0; row + 16 <= rows; row += 16)
- {
- for (col = 0; col + 16 <= cols; col += 16)
- {
- unsigned int sse;
-
- vp8_mse16x16(orig + col, orig_stride,
- recon + col, recon_stride,
- &sse);
- total_sse += sse;
- }
-
- /* Handle odd-sized width */
- if (col < cols)
- {
- unsigned int border_row, border_col;
- unsigned char *border_orig = orig;
- unsigned char *border_recon = recon;
-
- for (border_row = 0; border_row < 16; border_row++)
- {
- for (border_col = col; border_col < cols; border_col++)
- {
- diff = border_orig[border_col] - border_recon[border_col];
- total_sse += diff * diff;
- }
-
- border_orig += orig_stride;
- border_recon += recon_stride;
- }
- }
-
- orig += orig_stride * 16;
- recon += recon_stride * 16;
- }
-
- /* Handle odd-sized height */
- for (; row < rows; row++)
- {
- for (col = 0; col < cols; col++)
- {
- diff = orig[col] - recon[col];
- total_sse += diff * diff;
- }
-
- orig += orig_stride;
- recon += recon_stride;
- }
-
- vp8_clear_system_state();
- return total_sse;
-}
-
-
-static void generate_psnr_packet(VP8_COMP *cpi)
-{
- YV12_BUFFER_CONFIG *orig = cpi->Source;
- YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show;
- struct vpx_codec_cx_pkt pkt;
- uint64_t sse;
- int i;
- unsigned int width = cpi->common.Width;
- unsigned int height = cpi->common.Height;
-
- pkt.kind = VPX_CODEC_PSNR_PKT;
- sse = calc_plane_error(orig->y_buffer, orig->y_stride,
- recon->y_buffer, recon->y_stride,
- width, height);
- pkt.data.psnr.sse[0] = sse;
- pkt.data.psnr.sse[1] = sse;
- pkt.data.psnr.samples[0] = width * height;
- pkt.data.psnr.samples[1] = width * height;
-
- width = (width + 1) / 2;
- height = (height + 1) / 2;
-
- sse = calc_plane_error(orig->u_buffer, orig->uv_stride,
- recon->u_buffer, recon->uv_stride,
- width, height);
- pkt.data.psnr.sse[0] += sse;
- pkt.data.psnr.sse[2] = sse;
- pkt.data.psnr.samples[0] += width * height;
- pkt.data.psnr.samples[2] = width * height;
-
- sse = calc_plane_error(orig->v_buffer, orig->uv_stride,
- recon->v_buffer, recon->uv_stride,
- width, height);
- pkt.data.psnr.sse[0] += sse;
- pkt.data.psnr.sse[3] = sse;
- pkt.data.psnr.samples[0] += width * height;
- pkt.data.psnr.samples[3] = width * height;
-
- for (i = 0; i < 4; i++)
- pkt.data.psnr.psnr[i] = vpx_sse_to_psnr(pkt.data.psnr.samples[i], 255.0,
- (double)(pkt.data.psnr.sse[i]));
-
- vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt);
-}
-
-
-int vp8_use_as_reference(VP8_COMP *cpi, int ref_frame_flags)
-{
- if (ref_frame_flags > 7)
- return -1 ;
-
- cpi->ref_frame_flags = ref_frame_flags;
- return 0;
-}
-int vp8_update_reference(VP8_COMP *cpi, int ref_frame_flags)
-{
- if (ref_frame_flags > 7)
- return -1 ;
-
- cpi->common.refresh_golden_frame = 0;
- cpi->common.refresh_alt_ref_frame = 0;
- cpi->common.refresh_last_frame = 0;
-
- if (ref_frame_flags & VP8_LAST_FRAME)
- cpi->common.refresh_last_frame = 1;
-
- if (ref_frame_flags & VP8_GOLD_FRAME)
- cpi->common.refresh_golden_frame = 1;
-
- if (ref_frame_flags & VP8_ALTR_FRAME)
- cpi->common.refresh_alt_ref_frame = 1;
-
- return 0;
-}
-
-int vp8_get_reference(VP8_COMP *cpi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd)
-{
- VP8_COMMON *cm = &cpi->common;
- int ref_fb_idx;
-
- if (ref_frame_flag == VP8_LAST_FRAME)
- ref_fb_idx = cm->lst_fb_idx;
- else if (ref_frame_flag == VP8_GOLD_FRAME)
- ref_fb_idx = cm->gld_fb_idx;
- else if (ref_frame_flag == VP8_ALTR_FRAME)
- ref_fb_idx = cm->alt_fb_idx;
- else
- return -1;
-
- vp8_yv12_copy_frame(&cm->yv12_fb[ref_fb_idx], sd);
-
- return 0;
-}
-int vp8_set_reference(VP8_COMP *cpi, enum vpx_ref_frame_type ref_frame_flag, YV12_BUFFER_CONFIG *sd)
-{
- VP8_COMMON *cm = &cpi->common;
-
- int ref_fb_idx;
-
- if (ref_frame_flag == VP8_LAST_FRAME)
- ref_fb_idx = cm->lst_fb_idx;
- else if (ref_frame_flag == VP8_GOLD_FRAME)
- ref_fb_idx = cm->gld_fb_idx;
- else if (ref_frame_flag == VP8_ALTR_FRAME)
- ref_fb_idx = cm->alt_fb_idx;
- else
- return -1;
-
- vp8_yv12_copy_frame(sd, &cm->yv12_fb[ref_fb_idx]);
-
- return 0;
-}
-int vp8_update_entropy(VP8_COMP *cpi, int update)
-{
- VP8_COMMON *cm = &cpi->common;
- cm->refresh_entropy_probs = update;
-
- return 0;
-}
-
-
-#if OUTPUT_YUV_SRC
-void vp8_write_yuv_frame(const char *name, YV12_BUFFER_CONFIG *s)
-{
- FILE *yuv_file = fopen(name, "ab");
- unsigned char *src = s->y_buffer;
- int h = s->y_height;
-
- do
- {
- fwrite(src, s->y_width, 1, yuv_file);
- src += s->y_stride;
- }
- while (--h);
-
- src = s->u_buffer;
- h = s->uv_height;
-
- do
- {
- fwrite(src, s->uv_width, 1, yuv_file);
- src += s->uv_stride;
- }
- while (--h);
-
- src = s->v_buffer;
- h = s->uv_height;
-
- do
- {
- fwrite(src, s->uv_width, 1, yuv_file);
- src += s->uv_stride;
- }
- while (--h);
-
- fclose(yuv_file);
-}
-#endif
-
-
-static void scale_and_extend_source(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- /* are we resizing the image */
- if (cm->horiz_scale != 0 || cm->vert_scale != 0)
- {
-#if CONFIG_SPATIAL_RESAMPLING
- int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs);
- int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs);
- int tmp_height;
-
- if (cm->vert_scale == 3)
- tmp_height = 9;
- else
- tmp_height = 11;
-
- Scale2Ratio(cm->horiz_scale, &hr, &hs);
- Scale2Ratio(cm->vert_scale, &vr, &vs);
-
- vpx_scale_frame(sd, &cpi->scaled_source, cm->temp_scale_frame.y_buffer,
- tmp_height, hs, hr, vs, vr, 0);
-
- vp8_yv12_extend_frame_borders(&cpi->scaled_source);
- cpi->Source = &cpi->scaled_source;
-#endif
- }
- else
- cpi->Source = sd;
-}
-
-
-static int resize_key_frame(VP8_COMP *cpi)
-{
-#if CONFIG_SPATIAL_RESAMPLING
- VP8_COMMON *cm = &cpi->common;
-
- /* Do we need to apply resampling for one pass cbr.
- * In one pass this is more limited than in two pass cbr.
- * The test and any change is only made once per key frame sequence.
- */
- if (cpi->oxcf.allow_spatial_resampling && (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER))
- {
- int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs);
- int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs);
- int new_width, new_height;
-
- /* If we are below the resample DOWN watermark then scale down a
- * notch.
- */
- if (cpi->buffer_level < (cpi->oxcf.resample_down_water_mark * cpi->oxcf.optimal_buffer_level / 100))
- {
- cm->horiz_scale = (cm->horiz_scale < ONETWO) ? cm->horiz_scale + 1 : ONETWO;
- cm->vert_scale = (cm->vert_scale < ONETWO) ? cm->vert_scale + 1 : ONETWO;
- }
- /* Should we now start scaling back up */
- else if (cpi->buffer_level > (cpi->oxcf.resample_up_water_mark * cpi->oxcf.optimal_buffer_level / 100))
- {
- cm->horiz_scale = (cm->horiz_scale > NORMAL) ? cm->horiz_scale - 1 : NORMAL;
- cm->vert_scale = (cm->vert_scale > NORMAL) ? cm->vert_scale - 1 : NORMAL;
- }
-
- /* Get the new height and width */
- Scale2Ratio(cm->horiz_scale, &hr, &hs);
- Scale2Ratio(cm->vert_scale, &vr, &vs);
- new_width = ((hs - 1) + (cpi->oxcf.Width * hr)) / hs;
- new_height = ((vs - 1) + (cpi->oxcf.Height * vr)) / vs;
-
- /* If the image size has changed we need to reallocate the buffers
- * and resample the source image
- */
- if ((cm->Width != new_width) || (cm->Height != new_height))
- {
- cm->Width = new_width;
- cm->Height = new_height;
- vp8_alloc_compressor_data(cpi);
- scale_and_extend_source(cpi->un_scaled_source, cpi);
- return 1;
- }
- }
-
-#endif
- return 0;
-}
-
-
-static void update_alt_ref_frame_stats(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- /* Select an interval before next GF or altref */
- if (!cpi->auto_gold)
- cpi->frames_till_gf_update_due = DEFAULT_GF_INTERVAL;
-
- if ((cpi->pass != 2) && cpi->frames_till_gf_update_due)
- {
- cpi->current_gf_interval = cpi->frames_till_gf_update_due;
-
- /* Set the bits per frame that we should try and recover in
- * subsequent inter frames to account for the extra GF spend...
- * note that his does not apply for GF updates that occur
- * coincident with a key frame as the extra cost of key frames is
- * dealt with elsewhere.
- */
- cpi->gf_overspend_bits += cpi->projected_frame_size;
- cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frames_till_gf_update_due;
- }
-
- /* Update data structure that monitors level of reference to last GF */
- vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
- /* this frame refreshes means next frames don't unless specified by user */
- cpi->frames_since_golden = 0;
-
- /* Clear the alternate reference update pending flag. */
- cpi->source_alt_ref_pending = 0;
-
- /* Set the alternate reference frame active flag */
- cpi->source_alt_ref_active = 1;
-
-
-}
-static void update_golden_frame_stats(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- /* Update the Golden frame usage counts. */
- if (cm->refresh_golden_frame)
- {
- /* Select an interval before next GF */
- if (!cpi->auto_gold)
- cpi->frames_till_gf_update_due = DEFAULT_GF_INTERVAL;
-
- if ((cpi->pass != 2) && (cpi->frames_till_gf_update_due > 0))
- {
- cpi->current_gf_interval = cpi->frames_till_gf_update_due;
-
- /* Set the bits per frame that we should try and recover in
- * subsequent inter frames to account for the extra GF spend...
- * note that his does not apply for GF updates that occur
- * coincident with a key frame as the extra cost of key frames
- * is dealt with elsewhere.
- */
- if ((cm->frame_type != KEY_FRAME) && !cpi->source_alt_ref_active)
- {
- /* Calcluate GF bits to be recovered
- * Projected size - av frame bits available for inter
- * frames for clip as a whole
- */
- cpi->gf_overspend_bits += (cpi->projected_frame_size - cpi->inter_frame_target);
- }
-
- cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frames_till_gf_update_due;
-
- }
-
- /* Update data structure that monitors level of reference to last GF */
- vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
- /* this frame refreshes means next frames don't unless specified by
- * user
- */
- cm->refresh_golden_frame = 0;
- cpi->frames_since_golden = 0;
-
- cpi->recent_ref_frame_usage[INTRA_FRAME] = 1;
- cpi->recent_ref_frame_usage[LAST_FRAME] = 1;
- cpi->recent_ref_frame_usage[GOLDEN_FRAME] = 1;
- cpi->recent_ref_frame_usage[ALTREF_FRAME] = 1;
-
- /* ******** Fixed Q test code only ************ */
- /* If we are going to use the ALT reference for the next group of
- * frames set a flag to say so.
- */
- if (cpi->oxcf.fixed_q >= 0 &&
- cpi->oxcf.play_alternate && !cpi->common.refresh_alt_ref_frame)
- {
- cpi->source_alt_ref_pending = 1;
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
- }
-
- if (!cpi->source_alt_ref_pending)
- cpi->source_alt_ref_active = 0;
-
- /* Decrement count down till next gf */
- if (cpi->frames_till_gf_update_due > 0)
- cpi->frames_till_gf_update_due--;
-
- }
- else if (!cpi->common.refresh_alt_ref_frame)
- {
- /* Decrement count down till next gf */
- if (cpi->frames_till_gf_update_due > 0)
- cpi->frames_till_gf_update_due--;
-
- if (cpi->frames_till_alt_ref_frame)
- cpi->frames_till_alt_ref_frame --;
-
- cpi->frames_since_golden ++;
-
- if (cpi->frames_since_golden > 1)
- {
- cpi->recent_ref_frame_usage[INTRA_FRAME] +=
- cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME];
- cpi->recent_ref_frame_usage[LAST_FRAME] +=
- cpi->mb.count_mb_ref_frame_usage[LAST_FRAME];
- cpi->recent_ref_frame_usage[GOLDEN_FRAME] +=
- cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME];
- cpi->recent_ref_frame_usage[ALTREF_FRAME] +=
- cpi->mb.count_mb_ref_frame_usage[ALTREF_FRAME];
- }
- }
-}
-
-/* This function updates the reference frame probability estimates that
- * will be used during mode selection
- */
-static void update_rd_ref_frame_probs(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
- const int rf_intra = rfct[INTRA_FRAME];
- const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
-
- if (cm->frame_type == KEY_FRAME)
- {
- cpi->prob_intra_coded = 255;
- cpi->prob_last_coded = 128;
- cpi->prob_gf_coded = 128;
- }
- else if (!(rf_intra + rf_inter))
- {
- cpi->prob_intra_coded = 63;
- cpi->prob_last_coded = 128;
- cpi->prob_gf_coded = 128;
- }
-
- /* update reference frame costs since we can do better than what we got
- * last frame.
- */
- if (cpi->oxcf.number_of_layers == 1)
- {
- if (cpi->common.refresh_alt_ref_frame)
- {
- cpi->prob_intra_coded += 40;
- if (cpi->prob_intra_coded > 255)
- cpi->prob_intra_coded = 255;
- cpi->prob_last_coded = 200;
- cpi->prob_gf_coded = 1;
- }
- else if (cpi->frames_since_golden == 0)
- {
- cpi->prob_last_coded = 214;
- }
- else if (cpi->frames_since_golden == 1)
- {
- cpi->prob_last_coded = 192;
- cpi->prob_gf_coded = 220;
- }
- else if (cpi->source_alt_ref_active)
- {
- cpi->prob_gf_coded -= 20;
-
- if (cpi->prob_gf_coded < 10)
- cpi->prob_gf_coded = 10;
- }
- if (!cpi->source_alt_ref_active)
- cpi->prob_gf_coded = 255;
- }
-}
-
-
-/* 1 = key, 0 = inter */
-static int decide_key_frame(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- int code_key_frame = 0;
-
- cpi->kf_boost = 0;
-
- if (cpi->Speed > 11)
- return 0;
-
- /* Clear down mmx registers */
- vp8_clear_system_state();
-
- if ((cpi->compressor_speed == 2) && (cpi->Speed >= 5) && (cpi->sf.RD == 0))
- {
- double change = 1.0 * abs((int)(cpi->mb.intra_error -
- cpi->last_intra_error)) / (1 + cpi->last_intra_error);
- double change2 = 1.0 * abs((int)(cpi->mb.prediction_error -
- cpi->last_prediction_error)) / (1 + cpi->last_prediction_error);
- double minerror = cm->MBs * 256;
-
- cpi->last_intra_error = cpi->mb.intra_error;
- cpi->last_prediction_error = cpi->mb.prediction_error;
-
- if (10 * cpi->mb.intra_error / (1 + cpi->mb.prediction_error) < 15
- && cpi->mb.prediction_error > minerror
- && (change > .25 || change2 > .25))
- {
- /*(change > 1.4 || change < .75)&& cpi->this_frame_percent_intra > cpi->last_frame_percent_intra + 3*/
- return 1;
- }
-
- return 0;
-
- }
-
- /* If the following are true we might as well code a key frame */
- if (((cpi->this_frame_percent_intra == 100) &&
- (cpi->this_frame_percent_intra > (cpi->last_frame_percent_intra + 2))) ||
- ((cpi->this_frame_percent_intra > 95) &&
- (cpi->this_frame_percent_intra >= (cpi->last_frame_percent_intra + 5))))
- {
- code_key_frame = 1;
- }
- /* in addition if the following are true and this is not a golden frame
- * then code a key frame Note that on golden frames there often seems
- * to be a pop in intra useage anyway hence this restriction is
- * designed to prevent spurious key frames. The Intra pop needs to be
- * investigated.
- */
- else if (((cpi->this_frame_percent_intra > 60) &&
- (cpi->this_frame_percent_intra > (cpi->last_frame_percent_intra * 2))) ||
- ((cpi->this_frame_percent_intra > 75) &&
- (cpi->this_frame_percent_intra > (cpi->last_frame_percent_intra * 3 / 2))) ||
- ((cpi->this_frame_percent_intra > 90) &&
- (cpi->this_frame_percent_intra > (cpi->last_frame_percent_intra + 10))))
- {
- if (!cm->refresh_golden_frame)
- code_key_frame = 1;
- }
-
- return code_key_frame;
-
-}
-
-#if !(CONFIG_REALTIME_ONLY)
-static void Pass1Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags)
-{
- (void) size;
- (void) dest;
- (void) frame_flags;
- vp8_set_quantizer(cpi, 26);
-
- vp8_first_pass(cpi);
-}
-#endif
-
-#if 0
-void write_cx_frame_to_file(YV12_BUFFER_CONFIG *frame, int this_frame)
-{
-
- /* write the frame */
- FILE *yframe;
- int i;
- char filename[255];
-
- sprintf(filename, "cx\\y%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->y_height; i++)
- fwrite(frame->y_buffer + i * frame->y_stride, frame->y_width, 1, yframe);
-
- fclose(yframe);
- sprintf(filename, "cx\\u%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->uv_height; i++)
- fwrite(frame->u_buffer + i * frame->uv_stride, frame->uv_width, 1, yframe);
-
- fclose(yframe);
- sprintf(filename, "cx\\v%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->uv_height; i++)
- fwrite(frame->v_buffer + i * frame->uv_stride, frame->uv_width, 1, yframe);
-
- fclose(yframe);
-}
-#endif
-/* return of 0 means drop frame */
-
-/* Function to test for conditions that indeicate we should loop
- * back and recode a frame.
- */
-static int recode_loop_test( VP8_COMP *cpi,
- int high_limit, int low_limit,
- int q, int maxq, int minq )
-{
- int force_recode = 0;
- VP8_COMMON *cm = &cpi->common;
-
- /* Is frame recode allowed at all
- * Yes if either recode mode 1 is selected or mode two is selcted
- * and the frame is a key frame. golden frame or alt_ref_frame
- */
- if ( (cpi->sf.recode_loop == 1) ||
- ( (cpi->sf.recode_loop == 2) &&
- ( (cm->frame_type == KEY_FRAME) ||
- cm->refresh_golden_frame ||
- cm->refresh_alt_ref_frame ) ) )
- {
- /* General over and under shoot tests */
- if ( ((cpi->projected_frame_size > high_limit) && (q < maxq)) ||
- ((cpi->projected_frame_size < low_limit) && (q > minq)) )
- {
- force_recode = 1;
- }
- /* Special Constrained quality tests */
- else if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
- {
- /* Undershoot and below auto cq level */
- if ( (q > cpi->cq_target_quality) &&
- (cpi->projected_frame_size <
- ((cpi->this_frame_target * 7) >> 3)))
- {
- force_recode = 1;
- }
- /* Severe undershoot and between auto and user cq level */
- else if ( (q > cpi->oxcf.cq_level) &&
- (cpi->projected_frame_size < cpi->min_frame_bandwidth) &&
- (cpi->active_best_quality > cpi->oxcf.cq_level))
- {
- force_recode = 1;
- cpi->active_best_quality = cpi->oxcf.cq_level;
- }
- }
- }
-
- return force_recode;
-}
-
-static void update_reference_frames(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
- YV12_BUFFER_CONFIG *yv12_fb = cm->yv12_fb;
-
- /* At this point the new frame has been encoded.
- * If any buffer copy / swapping is signaled it should be done here.
- */
-
- if (cm->frame_type == KEY_FRAME)
- {
- yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FRAME | VP8_ALTR_FRAME ;
-
- yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME;
- yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME;
-
- cm->alt_fb_idx = cm->gld_fb_idx = cm->new_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[GOLDEN_FRAME] = cm->current_video_frame;
- cpi->current_ref_frames[ALTREF_FRAME] = cm->current_video_frame;
-#endif
- }
- else /* For non key frames */
- {
- if (cm->refresh_alt_ref_frame)
- {
- assert(!cm->copy_buffer_to_arf);
-
- cm->yv12_fb[cm->new_fb_idx].flags |= VP8_ALTR_FRAME;
- cm->yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME;
- cm->alt_fb_idx = cm->new_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[ALTREF_FRAME] = cm->current_video_frame;
-#endif
- }
- else if (cm->copy_buffer_to_arf)
- {
- assert(!(cm->copy_buffer_to_arf & ~0x3));
-
- if (cm->copy_buffer_to_arf == 1)
- {
- if(cm->alt_fb_idx != cm->lst_fb_idx)
- {
- yv12_fb[cm->lst_fb_idx].flags |= VP8_ALTR_FRAME;
- yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME;
- cm->alt_fb_idx = cm->lst_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[ALTREF_FRAME] =
- cpi->current_ref_frames[LAST_FRAME];
-#endif
- }
- }
- else /* if (cm->copy_buffer_to_arf == 2) */
- {
- if(cm->alt_fb_idx != cm->gld_fb_idx)
- {
- yv12_fb[cm->gld_fb_idx].flags |= VP8_ALTR_FRAME;
- yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALTR_FRAME;
- cm->alt_fb_idx = cm->gld_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[ALTREF_FRAME] =
- cpi->current_ref_frames[GOLDEN_FRAME];
-#endif
- }
- }
- }
-
- if (cm->refresh_golden_frame)
- {
- assert(!cm->copy_buffer_to_gf);
-
- cm->yv12_fb[cm->new_fb_idx].flags |= VP8_GOLD_FRAME;
- cm->yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME;
- cm->gld_fb_idx = cm->new_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[GOLDEN_FRAME] = cm->current_video_frame;
-#endif
- }
- else if (cm->copy_buffer_to_gf)
- {
- assert(!(cm->copy_buffer_to_arf & ~0x3));
-
- if (cm->copy_buffer_to_gf == 1)
- {
- if(cm->gld_fb_idx != cm->lst_fb_idx)
- {
- yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FRAME;
- yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME;
- cm->gld_fb_idx = cm->lst_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[GOLDEN_FRAME] =
- cpi->current_ref_frames[LAST_FRAME];
-#endif
- }
- }
- else /* if (cm->copy_buffer_to_gf == 2) */
- {
- if(cm->alt_fb_idx != cm->gld_fb_idx)
- {
- yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FRAME;
- yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FRAME;
- cm->gld_fb_idx = cm->alt_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[GOLDEN_FRAME] =
- cpi->current_ref_frames[ALTREF_FRAME];
-#endif
- }
- }
- }
- }
-
- if (cm->refresh_last_frame)
- {
- cm->yv12_fb[cm->new_fb_idx].flags |= VP8_LAST_FRAME;
- cm->yv12_fb[cm->lst_fb_idx].flags &= ~VP8_LAST_FRAME;
- cm->lst_fb_idx = cm->new_fb_idx;
-
-#if CONFIG_MULTI_RES_ENCODING
- cpi->current_ref_frames[LAST_FRAME] = cm->current_video_frame;
-#endif
- }
-
-#if CONFIG_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity)
- {
- /* we shouldn't have to keep multiple copies as we know in advance which
- * buffer we should start - for now to get something up and running
- * I've chosen to copy the buffers
- */
- if (cm->frame_type == KEY_FRAME)
- {
- int i;
- vp8_yv12_copy_frame(
- cpi->Source,
- &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
-
- vp8_yv12_extend_frame_borders(
- &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
-
- for (i = 2; i < MAX_REF_FRAMES - 1; i++)
- vp8_yv12_copy_frame(
- &cpi->denoiser.yv12_running_avg[LAST_FRAME],
- &cpi->denoiser.yv12_running_avg[i]);
- }
- else /* For non key frames */
- {
- vp8_yv12_extend_frame_borders(
- &cpi->denoiser.yv12_running_avg[INTRA_FRAME]);
-
- if (cm->refresh_alt_ref_frame || cm->copy_buffer_to_arf)
- {
- vp8_yv12_copy_frame(
- &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
- &cpi->denoiser.yv12_running_avg[ALTREF_FRAME]);
- }
- if (cm->refresh_golden_frame || cm->copy_buffer_to_gf)
- {
- vp8_yv12_copy_frame(
- &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
- &cpi->denoiser.yv12_running_avg[GOLDEN_FRAME]);
- }
- if(cm->refresh_last_frame)
- {
- vp8_yv12_copy_frame(
- &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
- &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
- }
- }
-
- }
-#endif
-
-}
-
-void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
-{
- const FRAME_TYPE frame_type = cm->frame_type;
-
- if (cm->no_lpf)
- {
- cm->filter_level = 0;
- }
- else
- {
- struct vpx_usec_timer timer;
-
- vp8_clear_system_state();
-
- vpx_usec_timer_start(&timer);
- if (cpi->sf.auto_filter == 0)
- vp8cx_pick_filter_level_fast(cpi->Source, cpi);
-
- else
- vp8cx_pick_filter_level(cpi->Source, cpi);
-
- if (cm->filter_level > 0)
- {
- vp8cx_set_alt_lf_level(cpi, cm->filter_level);
- }
-
- vpx_usec_timer_mark(&timer);
- cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
- }
-
-#if CONFIG_MULTITHREAD
- if (cpi->b_multi_threaded)
- sem_post(&cpi->h_event_end_lpf); /* signal that we have set filter_level */
-#endif
-
- if (cm->filter_level > 0)
- {
- vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, frame_type);
- }
-
- vp8_yv12_extend_frame_borders(cm->frame_to_show);
-
-}
-
-static void encode_frame_to_data_rate
-(
- VP8_COMP *cpi,
- unsigned long *size,
- unsigned char *dest,
- unsigned char* dest_end,
- unsigned int *frame_flags
-)
-{
- int Q;
- int frame_over_shoot_limit;
- int frame_under_shoot_limit;
-
- int Loop = 0;
- int loop_count;
-
- VP8_COMMON *cm = &cpi->common;
- int active_worst_qchanged = 0;
-
-#if !(CONFIG_REALTIME_ONLY)
- int q_low;
- int q_high;
- int zbin_oq_high;
- int zbin_oq_low = 0;
- int top_index;
- int bottom_index;
- int overshoot_seen = 0;
- int undershoot_seen = 0;
-#endif
-
- int drop_mark = (int)(cpi->oxcf.drop_frames_water_mark *
- cpi->oxcf.optimal_buffer_level / 100);
- int drop_mark75 = drop_mark * 2 / 3;
- int drop_mark50 = drop_mark / 4;
- int drop_mark25 = drop_mark / 8;
-
-
- /* Clear down mmx registers to allow floating point in what follows */
- vp8_clear_system_state();
-
-#if CONFIG_MULTITHREAD
- /* wait for the last picture loopfilter thread done */
- if (cpi->b_lpf_running)
- {
- sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
- }
-#endif
-
- if(cpi->force_next_frame_intra)
- {
- cm->frame_type = KEY_FRAME; /* delayed intra frame */
- cpi->force_next_frame_intra = 0;
- }
-
- /* For an alt ref frame in 2 pass we skip the call to the second pass
- * function that sets the target bandwidth
- */
-#if !(CONFIG_REALTIME_ONLY)
-
- if (cpi->pass == 2)
- {
- if (cpi->common.refresh_alt_ref_frame)
- {
- /* Per frame bit target for the alt ref frame */
- cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
- /* per second target bitrate */
- cpi->target_bandwidth = (int)(cpi->twopass.gf_bits *
- cpi->output_framerate);
- }
- }
- else
-#endif
- cpi->per_frame_bandwidth = (int)(cpi->target_bandwidth / cpi->output_framerate);
-
- /* Default turn off buffer to buffer copying */
- cm->copy_buffer_to_gf = 0;
- cm->copy_buffer_to_arf = 0;
-
- /* Clear zbin over-quant value and mode boost values. */
- cpi->mb.zbin_over_quant = 0;
- cpi->mb.zbin_mode_boost = 0;
-
- /* Enable or disable mode based tweaking of the zbin
- * For 2 Pass Only used where GF/ARF prediction quality
- * is above a threshold
- */
- cpi->mb.zbin_mode_boost_enabled = 1;
- if (cpi->pass == 2)
- {
- if ( cpi->gfu_boost <= 400 )
- {
- cpi->mb.zbin_mode_boost_enabled = 0;
- }
- }
-
- /* Current default encoder behaviour for the altref sign bias */
- if (cpi->source_alt_ref_active)
- cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 1;
- else
- cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 0;
-
- /* Check to see if a key frame is signaled
- * For two pass with auto key frame enabled cm->frame_type may already
- * be set, but not for one pass.
- */
- if ((cm->current_video_frame == 0) ||
- (cm->frame_flags & FRAMEFLAGS_KEY) ||
- (cpi->oxcf.auto_key && (cpi->frames_since_key % cpi->key_frame_frequency == 0)))
- {
- /* Key frame from VFW/auto-keyframe/first frame */
- cm->frame_type = KEY_FRAME;
- }
-
-#if CONFIG_MULTI_RES_ENCODING
- /* In multi-resolution encoding, frame_type is decided by lowest-resolution
- * encoder. Same frame_type is adopted while encoding at other resolution.
- */
- if (cpi->oxcf.mr_encoder_id)
- {
- LOWER_RES_FRAME_INFO* low_res_frame_info
- = (LOWER_RES_FRAME_INFO*)cpi->oxcf.mr_low_res_mode_info;
-
- cm->frame_type = low_res_frame_info->frame_type;
-
- if(cm->frame_type != KEY_FRAME)
- {
- cpi->mr_low_res_mv_avail = 1;
- cpi->mr_low_res_mv_avail &= !(low_res_frame_info->is_frame_dropped);
-
- if (cpi->ref_frame_flags & VP8_LAST_FRAME)
- cpi->mr_low_res_mv_avail &= (cpi->current_ref_frames[LAST_FRAME]
- == low_res_frame_info->low_res_ref_frames[LAST_FRAME]);
-
- if (cpi->ref_frame_flags & VP8_GOLD_FRAME)
- cpi->mr_low_res_mv_avail &= (cpi->current_ref_frames[GOLDEN_FRAME]
- == low_res_frame_info->low_res_ref_frames[GOLDEN_FRAME]);
-
- if (cpi->ref_frame_flags & VP8_ALTR_FRAME)
- cpi->mr_low_res_mv_avail &= (cpi->current_ref_frames[ALTREF_FRAME]
- == low_res_frame_info->low_res_ref_frames[ALTREF_FRAME]);
- }
- }
-#endif
-
- /* Set various flags etc to special state if it is a key frame */
- if (cm->frame_type == KEY_FRAME)
- {
- int i;
-
- // Set the loop filter deltas and segmentation map update
- setup_features(cpi);
-
- /* The alternate reference frame cannot be active for a key frame */
- cpi->source_alt_ref_active = 0;
-
- /* Reset the RD threshold multipliers to default of * 1 (128) */
- for (i = 0; i < MAX_MODES; i++)
- {
- cpi->mb.rd_thresh_mult[i] = 128;
- }
- }
-
-#if 0
- /* Experimental code for lagged compress and one pass
- * Initialise one_pass GF frames stats
- * Update stats used for GF selection
- */
- {
- cpi->one_pass_frame_index = cm->current_video_frame % MAX_LAG_BUFFERS;
-
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frames_so_far = 0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_intra_error = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_coded_error = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_pcnt_inter = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_pcnt_motion = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvr = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvr_abs = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvc = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvc_abs = 0.0;
- }
-#endif
-
- update_rd_ref_frame_probs(cpi);
-
- if (cpi->drop_frames_allowed)
- {
- /* The reset to decimation 0 is only done here for one pass.
- * Once it is set two pass leaves decimation on till the next kf.
- */
- if ((cpi->buffer_level > drop_mark) && (cpi->decimation_factor > 0))
- cpi->decimation_factor --;
-
- if (cpi->buffer_level > drop_mark75 && cpi->decimation_factor > 0)
- cpi->decimation_factor = 1;
-
- else if (cpi->buffer_level < drop_mark25 && (cpi->decimation_factor == 2 || cpi->decimation_factor == 3))
- {
- cpi->decimation_factor = 3;
- }
- else if (cpi->buffer_level < drop_mark50 && (cpi->decimation_factor == 1 || cpi->decimation_factor == 2))
- {
- cpi->decimation_factor = 2;
- }
- else if (cpi->buffer_level < drop_mark75 && (cpi->decimation_factor == 0 || cpi->decimation_factor == 1))
- {
- cpi->decimation_factor = 1;
- }
- }
-
- /* The following decimates the frame rate according to a regular
- * pattern (i.e. to 1/2 or 2/3 frame rate) This can be used to help
- * prevent buffer under-run in CBR mode. Alternatively it might be
- * desirable in some situations to drop frame rate but throw more bits
- * at each frame.
- *
- * Note that dropping a key frame can be problematic if spatial
- * resampling is also active
- */
- if (cpi->decimation_factor > 0)
- {
- switch (cpi->decimation_factor)
- {
- case 1:
- cpi->per_frame_bandwidth = cpi->per_frame_bandwidth * 3 / 2;
- break;
- case 2:
- cpi->per_frame_bandwidth = cpi->per_frame_bandwidth * 5 / 4;
- break;
- case 3:
- cpi->per_frame_bandwidth = cpi->per_frame_bandwidth * 5 / 4;
- break;
- }
-
- /* Note that we should not throw out a key frame (especially when
- * spatial resampling is enabled).
- */
- if (cm->frame_type == KEY_FRAME)
- {
- cpi->decimation_count = cpi->decimation_factor;
- }
- else if (cpi->decimation_count > 0)
- {
- cpi->decimation_count --;
-
- cpi->bits_off_target += cpi->av_per_frame_bandwidth;
- if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size)
- cpi->bits_off_target = cpi->oxcf.maximum_buffer_size;
-
-#if CONFIG_MULTI_RES_ENCODING
- vp8_store_drop_frame_info(cpi);
-#endif
-
- cm->current_video_frame++;
- cpi->frames_since_key++;
- // We advance the temporal pattern for dropped frames.
- cpi->temporal_pattern_counter++;
-
-#if CONFIG_INTERNAL_STATS
- cpi->count ++;
-#endif
-
- cpi->buffer_level = cpi->bits_off_target;
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
-
- /* Propagate bits saved by dropping the frame to higher
- * layers
- */
- for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++)
- {
- LAYER_CONTEXT *lc = &cpi->layer_context[i];
- lc->bits_off_target += (int)(lc->target_bandwidth /
- lc->framerate);
- if (lc->bits_off_target > lc->maximum_buffer_size)
- lc->bits_off_target = lc->maximum_buffer_size;
- lc->buffer_level = lc->bits_off_target;
- }
- }
-
- return;
- }
- else
- cpi->decimation_count = cpi->decimation_factor;
- }
- else
- cpi->decimation_count = 0;
-
- /* Decide how big to make the frame */
- if (!vp8_pick_frame_size(cpi))
- {
- /*TODO: 2 drop_frame and return code could be put together. */
-#if CONFIG_MULTI_RES_ENCODING
- vp8_store_drop_frame_info(cpi);
-#endif
- cm->current_video_frame++;
- cpi->frames_since_key++;
- // We advance the temporal pattern for dropped frames.
- cpi->temporal_pattern_counter++;
- return;
- }
-
- /* Reduce active_worst_allowed_q for CBR if our buffer is getting too full.
- * This has a knock on effect on active best quality as well.
- * For CBR if the buffer reaches its maximum level then we can no longer
- * save up bits for later frames so we might as well use them up
- * on the current frame.
- */
- if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
- (cpi->buffer_level >= cpi->oxcf.optimal_buffer_level) && cpi->buffered_mode)
- {
- /* Max adjustment is 1/4 */
- int Adjustment = cpi->active_worst_quality / 4;
-
- if (Adjustment)
- {
- int buff_lvl_step;
-
- if (cpi->buffer_level < cpi->oxcf.maximum_buffer_size)
- {
- buff_lvl_step = (int)
- ((cpi->oxcf.maximum_buffer_size -
- cpi->oxcf.optimal_buffer_level) /
- Adjustment);
-
- if (buff_lvl_step)
- Adjustment = (int)
- ((cpi->buffer_level -
- cpi->oxcf.optimal_buffer_level) /
- buff_lvl_step);
- else
- Adjustment = 0;
- }
-
- cpi->active_worst_quality -= Adjustment;
-
- if(cpi->active_worst_quality < cpi->active_best_quality)
- cpi->active_worst_quality = cpi->active_best_quality;
- }
- }
-
- /* Set an active best quality and if necessary active worst quality
- * There is some odd behavior for one pass here that needs attention.
- */
- if ( (cpi->pass == 2) || (cpi->ni_frames > 150))
- {
- vp8_clear_system_state();
-
- Q = cpi->active_worst_quality;
-
- if ( cm->frame_type == KEY_FRAME )
- {
- if ( cpi->pass == 2 )
- {
- if (cpi->gfu_boost > 600)
- cpi->active_best_quality = kf_low_motion_minq[Q];
- else
- cpi->active_best_quality = kf_high_motion_minq[Q];
-
- /* Special case for key frames forced because we have reached
- * the maximum key frame interval. Here force the Q to a range
- * based on the ambient Q to reduce the risk of popping
- */
- if ( cpi->this_key_frame_forced )
- {
- if ( cpi->active_best_quality > cpi->avg_frame_qindex * 7/8)
- cpi->active_best_quality = cpi->avg_frame_qindex * 7/8;
- else if ( cpi->active_best_quality < cpi->avg_frame_qindex >> 2 )
- cpi->active_best_quality = cpi->avg_frame_qindex >> 2;
- }
- }
- /* One pass more conservative */
- else
- cpi->active_best_quality = kf_high_motion_minq[Q];
- }
-
- else if (cpi->oxcf.number_of_layers==1 &&
- (cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame))
- {
- /* Use the lower of cpi->active_worst_quality and recent
- * average Q as basis for GF/ARF Q limit unless last frame was
- * a key frame.
- */
- if ( (cpi->frames_since_key > 1) &&
- (cpi->avg_frame_qindex < cpi->active_worst_quality) )
- {
- Q = cpi->avg_frame_qindex;
- }
-
- /* For constrained quality dont allow Q less than the cq level */
- if ( (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (Q < cpi->cq_target_quality) )
- {
- Q = cpi->cq_target_quality;
- }
-
- if ( cpi->pass == 2 )
- {
- if ( cpi->gfu_boost > 1000 )
- cpi->active_best_quality = gf_low_motion_minq[Q];
- else if ( cpi->gfu_boost < 400 )
- cpi->active_best_quality = gf_high_motion_minq[Q];
- else
- cpi->active_best_quality = gf_mid_motion_minq[Q];
-
- /* Constrained quality use slightly lower active best. */
- if ( cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY )
- {
- cpi->active_best_quality =
- cpi->active_best_quality * 15/16;
- }
- }
- /* One pass more conservative */
- else
- cpi->active_best_quality = gf_high_motion_minq[Q];
- }
- else
- {
- cpi->active_best_quality = inter_minq[Q];
-
- /* For the constant/constrained quality mode we dont want
- * q to fall below the cq level.
- */
- if ((cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (cpi->active_best_quality < cpi->cq_target_quality) )
- {
- /* If we are strongly undershooting the target rate in the last
- * frames then use the user passed in cq value not the auto
- * cq value.
- */
- if ( cpi->rolling_actual_bits < cpi->min_frame_bandwidth )
- cpi->active_best_quality = cpi->oxcf.cq_level;
- else
- cpi->active_best_quality = cpi->cq_target_quality;
- }
- }
-
- /* If CBR and the buffer is as full then it is reasonable to allow
- * higher quality on the frames to prevent bits just going to waste.
- */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- /* Note that the use of >= here elliminates the risk of a devide
- * by 0 error in the else if clause
- */
- if (cpi->buffer_level >= cpi->oxcf.maximum_buffer_size)
- cpi->active_best_quality = cpi->best_quality;
-
- else if (cpi->buffer_level > cpi->oxcf.optimal_buffer_level)
- {
- int Fraction = (int)
- (((cpi->buffer_level - cpi->oxcf.optimal_buffer_level) * 128)
- / (cpi->oxcf.maximum_buffer_size -
- cpi->oxcf.optimal_buffer_level));
- int min_qadjustment = ((cpi->active_best_quality -
- cpi->best_quality) * Fraction) / 128;
-
- cpi->active_best_quality -= min_qadjustment;
- }
- }
- }
- /* Make sure constrained quality mode limits are adhered to for the first
- * few frames of one pass encodes
- */
- else if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
- {
- if ( (cm->frame_type == KEY_FRAME) ||
- cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame )
- {
- cpi->active_best_quality = cpi->best_quality;
- }
- else if (cpi->active_best_quality < cpi->cq_target_quality)
- {
- cpi->active_best_quality = cpi->cq_target_quality;
- }
- }
-
- /* Clip the active best and worst quality values to limits */
- if (cpi->active_worst_quality > cpi->worst_quality)
- cpi->active_worst_quality = cpi->worst_quality;
-
- if (cpi->active_best_quality < cpi->best_quality)
- cpi->active_best_quality = cpi->best_quality;
-
- if ( cpi->active_worst_quality < cpi->active_best_quality )
- cpi->active_worst_quality = cpi->active_best_quality;
-
- /* Determine initial Q to try */
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
-
-#if !(CONFIG_REALTIME_ONLY)
-
- /* Set highest allowed value for Zbin over quant */
- if (cm->frame_type == KEY_FRAME)
- zbin_oq_high = 0;
- else if ((cpi->oxcf.number_of_layers == 1) && ((cm->refresh_alt_ref_frame ||
- (cm->refresh_golden_frame && !cpi->source_alt_ref_active))))
- {
- zbin_oq_high = 16;
- }
- else
- zbin_oq_high = ZBIN_OQ_MAX;
-#endif
-
- /* Setup background Q adjustment for error resilient mode.
- * For multi-layer encodes only enable this for the base layer.
- */
- if (cpi->cyclic_refresh_mode_enabled)
- {
- if (cpi->current_layer==0)
- cyclic_background_refresh(cpi, Q, 0);
- else
- disable_segmentation(cpi);
- }
-
- vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_shoot_limit);
-
-#if !(CONFIG_REALTIME_ONLY)
- /* Limit Q range for the adaptive loop. */
- bottom_index = cpi->active_best_quality;
- top_index = cpi->active_worst_quality;
- q_low = cpi->active_best_quality;
- q_high = cpi->active_worst_quality;
-#endif
-
- vp8_save_coding_context(cpi);
-
- loop_count = 0;
-
- scale_and_extend_source(cpi->un_scaled_source, cpi);
-
-#if !(CONFIG_REALTIME_ONLY) && CONFIG_POSTPROC && !(CONFIG_TEMPORAL_DENOISING)
-
- if (cpi->oxcf.noise_sensitivity > 0)
- {
- unsigned char *src;
- int l = 0;
-
- switch (cpi->oxcf.noise_sensitivity)
- {
- case 1:
- l = 20;
- break;
- case 2:
- l = 40;
- break;
- case 3:
- l = 60;
- break;
- case 4:
- l = 80;
- break;
- case 5:
- l = 100;
- break;
- case 6:
- l = 150;
- break;
- }
-
-
- if (cm->frame_type == KEY_FRAME)
- {
- vp8_de_noise(cm, cpi->Source, cpi->Source, l , 1, 0);
- }
- else
- {
- vp8_de_noise(cm, cpi->Source, cpi->Source, l , 1, 0);
-
- src = cpi->Source->y_buffer;
-
- if (cpi->Source->y_stride < 0)
- {
- src += cpi->Source->y_stride * (cpi->Source->y_height - 1);
- }
- }
- }
-
-#endif
-
-#ifdef OUTPUT_YUV_SRC
- vp8_write_yuv_frame(cpi->Source);
-#endif
-
- do
- {
- vp8_clear_system_state();
-
- vp8_set_quantizer(cpi, Q);
-
- /* setup skip prob for costing in mode/mv decision */
- if (cpi->common.mb_no_coeff_skip)
- {
- cpi->prob_skip_false = cpi->base_skip_false_prob[Q];
-
- if (cm->frame_type != KEY_FRAME)
- {
- if (cpi->common.refresh_alt_ref_frame)
- {
- if (cpi->last_skip_false_probs[2] != 0)
- cpi->prob_skip_false = cpi->last_skip_false_probs[2];
-
- /*
- if(cpi->last_skip_false_probs[2]!=0 && abs(Q- cpi->last_skip_probs_q[2])<=16 )
- cpi->prob_skip_false = cpi->last_skip_false_probs[2];
- else if (cpi->last_skip_false_probs[2]!=0)
- cpi->prob_skip_false = (cpi->last_skip_false_probs[2] + cpi->prob_skip_false ) / 2;
- */
- }
- else if (cpi->common.refresh_golden_frame)
- {
- if (cpi->last_skip_false_probs[1] != 0)
- cpi->prob_skip_false = cpi->last_skip_false_probs[1];
-
- /*
- if(cpi->last_skip_false_probs[1]!=0 && abs(Q- cpi->last_skip_probs_q[1])<=16 )
- cpi->prob_skip_false = cpi->last_skip_false_probs[1];
- else if (cpi->last_skip_false_probs[1]!=0)
- cpi->prob_skip_false = (cpi->last_skip_false_probs[1] + cpi->prob_skip_false ) / 2;
- */
- }
- else
- {
- if (cpi->last_skip_false_probs[0] != 0)
- cpi->prob_skip_false = cpi->last_skip_false_probs[0];
-
- /*
- if(cpi->last_skip_false_probs[0]!=0 && abs(Q- cpi->last_skip_probs_q[0])<=16 )
- cpi->prob_skip_false = cpi->last_skip_false_probs[0];
- else if(cpi->last_skip_false_probs[0]!=0)
- cpi->prob_skip_false = (cpi->last_skip_false_probs[0] + cpi->prob_skip_false ) / 2;
- */
- }
-
- /* as this is for cost estimate, let's make sure it does not
- * go extreme eitehr way
- */
- if (cpi->prob_skip_false < 5)
- cpi->prob_skip_false = 5;
-
- if (cpi->prob_skip_false > 250)
- cpi->prob_skip_false = 250;
-
- if (cpi->oxcf.number_of_layers == 1 && cpi->is_src_frame_alt_ref)
- cpi->prob_skip_false = 1;
- }
-
-#if 0
-
- if (cpi->pass != 1)
- {
- FILE *f = fopen("skip.stt", "a");
- fprintf(f, "%d, %d, %4d ", cpi->common.refresh_golden_frame, cpi->common.refresh_alt_ref_frame, cpi->prob_skip_false);
- fclose(f);
- }
-
-#endif
-
- }
-
- if (cm->frame_type == KEY_FRAME)
- {
- if(resize_key_frame(cpi))
- {
- /* If the frame size has changed, need to reset Q, quantizer,
- * and background refresh.
- */
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
- if (cpi->cyclic_refresh_mode_enabled)
- {
- if (cpi->current_layer==0)
- cyclic_background_refresh(cpi, Q, 0);
- else
- disable_segmentation(cpi);
- }
- vp8_set_quantizer(cpi, Q);
- }
-
- vp8_setup_key_frame(cpi);
- }
-
-
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- {
- if(cpi->oxcf.error_resilient_mode)
- cm->refresh_entropy_probs = 0;
-
- if (cpi->oxcf.error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS)
- {
- if (cm->frame_type == KEY_FRAME)
- cm->refresh_entropy_probs = 1;
- }
-
- if (cm->refresh_entropy_probs == 0)
- {
- /* save a copy for later refresh */
- vpx_memcpy(&cm->lfc, &cm->fc, sizeof(cm->fc));
- }
-
- vp8_update_coef_context(cpi);
-
- vp8_update_coef_probs(cpi);
-
- /* transform / motion compensation build reconstruction frame
- * +pack coef partitions
- */
- vp8_encode_frame(cpi);
-
- /* cpi->projected_frame_size is not needed for RT mode */
- }
-#else
- /* transform / motion compensation build reconstruction frame */
- vp8_encode_frame(cpi);
-
- cpi->projected_frame_size -= vp8_estimate_entropy_savings(cpi);
- cpi->projected_frame_size = (cpi->projected_frame_size > 0) ? cpi->projected_frame_size : 0;
-#endif
- vp8_clear_system_state();
-
- /* Test to see if the stats generated for this frame indicate that
- * we should have coded a key frame (assuming that we didn't)!
- */
-
- if (cpi->pass != 2 && cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME
- && cpi->compressor_speed != 2)
- {
-#if !(CONFIG_REALTIME_ONLY)
- if (decide_key_frame(cpi))
- {
- /* Reset all our sizing numbers and recode */
- cm->frame_type = KEY_FRAME;
-
- vp8_pick_frame_size(cpi);
-
- /* Clear the Alt reference frame active flag when we have
- * a key frame
- */
- cpi->source_alt_ref_active = 0;
-
- // Set the loop filter deltas and segmentation map update
- setup_features(cpi);
-
- vp8_restore_coding_context(cpi);
-
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
-
- vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_shoot_limit);
-
- /* Limit Q range for the adaptive loop. */
- bottom_index = cpi->active_best_quality;
- top_index = cpi->active_worst_quality;
- q_low = cpi->active_best_quality;
- q_high = cpi->active_worst_quality;
-
- loop_count++;
- Loop = 1;
-
- continue;
- }
-#endif
- }
-
- vp8_clear_system_state();
-
- if (frame_over_shoot_limit == 0)
- frame_over_shoot_limit = 1;
-
- /* Are we are overshooting and up against the limit of active max Q. */
- if (((cpi->pass != 2) || (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)) &&
- (Q == cpi->active_worst_quality) &&
- (cpi->active_worst_quality < cpi->worst_quality) &&
- (cpi->projected_frame_size > frame_over_shoot_limit))
- {
- int over_size_percent = ((cpi->projected_frame_size - frame_over_shoot_limit) * 100) / frame_over_shoot_limit;
-
- /* If so is there any scope for relaxing it */
- while ((cpi->active_worst_quality < cpi->worst_quality) && (over_size_percent > 0))
- {
- cpi->active_worst_quality++;
- /* Assume 1 qstep = about 4% on frame size. */
- over_size_percent = (int)(over_size_percent * 0.96);
- }
-#if !(CONFIG_REALTIME_ONLY)
- top_index = cpi->active_worst_quality;
-#endif
- /* If we have updated the active max Q do not call
- * vp8_update_rate_correction_factors() this loop.
- */
- active_worst_qchanged = 1;
- }
- else
- active_worst_qchanged = 0;
-
-#if !(CONFIG_REALTIME_ONLY)
- /* Special case handling for forced key frames */
- if ( (cm->frame_type == KEY_FRAME) && cpi->this_key_frame_forced )
- {
- int last_q = Q;
- int kf_err = vp8_calc_ss_err(cpi->Source,
- &cm->yv12_fb[cm->new_fb_idx]);
-
- /* The key frame is not good enough */
- if ( kf_err > ((cpi->ambient_err * 7) >> 3) )
- {
- /* Lower q_high */
- q_high = (Q > q_low) ? (Q - 1) : q_low;
-
- /* Adjust Q */
- Q = (q_high + q_low) >> 1;
- }
- /* The key frame is much better than the previous frame */
- else if ( kf_err < (cpi->ambient_err >> 1) )
- {
- /* Raise q_low */
- q_low = (Q < q_high) ? (Q + 1) : q_high;
-
- /* Adjust Q */
- Q = (q_high + q_low + 1) >> 1;
- }
-
- /* Clamp Q to upper and lower limits: */
- if (Q > q_high)
- Q = q_high;
- else if (Q < q_low)
- Q = q_low;
-
- Loop = Q != last_q;
- }
-
- /* Is the projected frame size out of range and are we allowed
- * to attempt to recode.
- */
- else if ( recode_loop_test( cpi,
- frame_over_shoot_limit, frame_under_shoot_limit,
- Q, top_index, bottom_index ) )
- {
- int last_q = Q;
- int Retries = 0;
-
- /* Frame size out of permitted range. Update correction factor
- * & compute new Q to try...
- */
-
- /* Frame is too large */
- if (cpi->projected_frame_size > cpi->this_frame_target)
- {
- /* Raise Qlow as to at least the current value */
- q_low = (Q < q_high) ? (Q + 1) : q_high;
-
- /* If we are using over quant do the same for zbin_oq_low */
- if (cpi->mb.zbin_over_quant > 0)
- zbin_oq_low = (cpi->mb.zbin_over_quant < zbin_oq_high) ?
- (cpi->mb.zbin_over_quant + 1) : zbin_oq_high;
-
- if (undershoot_seen)
- {
- /* Update rate_correction_factor unless
- * cpi->active_worst_quality has changed.
- */
- if (!active_worst_qchanged)
- vp8_update_rate_correction_factors(cpi, 1);
-
- Q = (q_high + q_low + 1) / 2;
-
- /* Adjust cpi->zbin_over_quant (only allowed when Q
- * is max)
- */
- if (Q < MAXQ)
- cpi->mb.zbin_over_quant = 0;
- else
- {
- zbin_oq_low = (cpi->mb.zbin_over_quant < zbin_oq_high) ?
- (cpi->mb.zbin_over_quant + 1) : zbin_oq_high;
- cpi->mb.zbin_over_quant =
- (zbin_oq_high + zbin_oq_low) / 2;
- }
- }
- else
- {
- /* Update rate_correction_factor unless
- * cpi->active_worst_quality has changed.
- */
- if (!active_worst_qchanged)
- vp8_update_rate_correction_factors(cpi, 0);
-
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
-
- while (((Q < q_low) ||
- (cpi->mb.zbin_over_quant < zbin_oq_low)) &&
- (Retries < 10))
- {
- vp8_update_rate_correction_factors(cpi, 0);
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
- Retries ++;
- }
- }
-
- overshoot_seen = 1;
- }
- /* Frame is too small */
- else
- {
- if (cpi->mb.zbin_over_quant == 0)
- /* Lower q_high if not using over quant */
- q_high = (Q > q_low) ? (Q - 1) : q_low;
- else
- /* else lower zbin_oq_high */
- zbin_oq_high = (cpi->mb.zbin_over_quant > zbin_oq_low) ?
- (cpi->mb.zbin_over_quant - 1) : zbin_oq_low;
-
- if (overshoot_seen)
- {
- /* Update rate_correction_factor unless
- * cpi->active_worst_quality has changed.
- */
- if (!active_worst_qchanged)
- vp8_update_rate_correction_factors(cpi, 1);
-
- Q = (q_high + q_low) / 2;
-
- /* Adjust cpi->zbin_over_quant (only allowed when Q
- * is max)
- */
- if (Q < MAXQ)
- cpi->mb.zbin_over_quant = 0;
- else
- cpi->mb.zbin_over_quant =
- (zbin_oq_high + zbin_oq_low) / 2;
- }
- else
- {
- /* Update rate_correction_factor unless
- * cpi->active_worst_quality has changed.
- */
- if (!active_worst_qchanged)
- vp8_update_rate_correction_factors(cpi, 0);
-
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
-
- /* Special case reset for qlow for constrained quality.
- * This should only trigger where there is very substantial
- * undershoot on a frame and the auto cq level is above
- * the user passsed in value.
- */
- if ( (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (Q < q_low) )
- {
- q_low = Q;
- }
-
- while (((Q > q_high) ||
- (cpi->mb.zbin_over_quant > zbin_oq_high)) &&
- (Retries < 10))
- {
- vp8_update_rate_correction_factors(cpi, 0);
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
- Retries ++;
- }
- }
-
- undershoot_seen = 1;
- }
-
- /* Clamp Q to upper and lower limits: */
- if (Q > q_high)
- Q = q_high;
- else if (Q < q_low)
- Q = q_low;
-
- /* Clamp cpi->zbin_over_quant */
- cpi->mb.zbin_over_quant = (cpi->mb.zbin_over_quant < zbin_oq_low) ?
- zbin_oq_low : (cpi->mb.zbin_over_quant > zbin_oq_high) ?
- zbin_oq_high : cpi->mb.zbin_over_quant;
-
- Loop = Q != last_q;
- }
- else
-#endif
- Loop = 0;
-
- if (cpi->is_src_frame_alt_ref)
- Loop = 0;
-
- if (Loop == 1)
- {
- vp8_restore_coding_context(cpi);
- loop_count++;
-#if CONFIG_INTERNAL_STATS
- cpi->tot_recode_hits++;
-#endif
- }
- }
- while (Loop == 1);
-
-#if 0
- /* Experimental code for lagged and one pass
- * Update stats used for one pass GF selection
- */
- {
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index].frame_coded_error = (double)cpi->prediction_error;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index].frame_intra_error = (double)cpi->intra_error;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index].frame_pcnt_inter = (double)(100 - cpi->this_frame_percent_intra) / 100.0;
- }
-#endif
-
- /* Special case code to reduce pulsing when key frames are forced at a
- * fixed interval. Note the reconstruction error if it is the frame before
- * the force key frame
- */
- if ( cpi->next_key_frame_forced && (cpi->twopass.frames_to_key == 0) )
- {
- cpi->ambient_err = vp8_calc_ss_err(cpi->Source,
- &cm->yv12_fb[cm->new_fb_idx]);
- }
-
- /* This frame's MVs are saved and will be used in next frame's MV predictor.
- * Last frame has one more line(add to bottom) and one more column(add to
- * right) than cm->mip. The edge elements are initialized to 0.
- */
-#if CONFIG_MULTI_RES_ENCODING
- if(!cpi->oxcf.mr_encoder_id && cm->show_frame)
-#else
- if(cm->show_frame) /* do not save for altref frame */
-#endif
- {
- int mb_row;
- int mb_col;
- /* Point to beginning of allocated MODE_INFO arrays. */
- MODE_INFO *tmp = cm->mip;
-
- if(cm->frame_type != KEY_FRAME)
- {
- for (mb_row = 0; mb_row < cm->mb_rows+1; mb_row ++)
- {
- for (mb_col = 0; mb_col < cm->mb_cols+1; mb_col ++)
- {
- if(tmp->mbmi.ref_frame != INTRA_FRAME)
- cpi->lfmv[mb_col + mb_row*(cm->mode_info_stride+1)].as_int = tmp->mbmi.mv.as_int;
-
- cpi->lf_ref_frame_sign_bias[mb_col + mb_row*(cm->mode_info_stride+1)] = cm->ref_frame_sign_bias[tmp->mbmi.ref_frame];
- cpi->lf_ref_frame[mb_col + mb_row*(cm->mode_info_stride+1)] = tmp->mbmi.ref_frame;
- tmp++;
- }
- }
- }
- }
-
- /* Count last ref frame 0,0 usage on current encoded frame. */
- {
- int mb_row;
- int mb_col;
- /* Point to beginning of MODE_INFO arrays. */
- MODE_INFO *tmp = cm->mi;
-
- cpi->zeromv_count = 0;
-
- if(cm->frame_type != KEY_FRAME)
- {
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row ++)
- {
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col ++)
- {
- if(tmp->mbmi.mode == ZEROMV)
- cpi->zeromv_count++;
- tmp++;
- }
- tmp++;
- }
- }
- }
-
-#if CONFIG_MULTI_RES_ENCODING
- vp8_cal_dissimilarity(cpi);
-#endif
-
- /* Update the GF useage maps.
- * This is done after completing the compression of a frame when all
- * modes etc. are finalized but before loop filter
- */
- if (cpi->oxcf.number_of_layers == 1)
- vp8_update_gf_useage_maps(cpi, cm, &cpi->mb);
-
- if (cm->frame_type == KEY_FRAME)
- cm->refresh_last_frame = 1;
-
-#if 0
- {
- FILE *f = fopen("gfactive.stt", "a");
- fprintf(f, "%8d %8d %8d %8d %8d\n", cm->current_video_frame, (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols), cpi->this_iiratio, cpi->next_iiratio, cm->refresh_golden_frame);
- fclose(f);
- }
-#endif
-
- /* For inter frames the current default behavior is that when
- * cm->refresh_golden_frame is set we copy the old GF over to the ARF buffer
- * This is purely an encoder decision at present.
- */
- if (!cpi->oxcf.error_resilient_mode && cm->refresh_golden_frame)
- cm->copy_buffer_to_arf = 2;
- else
- cm->copy_buffer_to_arf = 0;
-
- cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
-
-#if CONFIG_MULTITHREAD
- if (cpi->b_multi_threaded)
- {
- /* start loopfilter in separate thread */
- sem_post(&cpi->h_event_start_lpf);
- cpi->b_lpf_running = 1;
- }
- else
-#endif
- {
- vp8_loopfilter_frame(cpi, cm);
- }
-
- update_reference_frames(cpi);
-
-#if !(CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- if (cpi->oxcf.error_resilient_mode)
- {
- cm->refresh_entropy_probs = 0;
- }
-#endif
-
-#if CONFIG_MULTITHREAD
- /* wait that filter_level is picked so that we can continue with stream packing */
- if (cpi->b_multi_threaded)
- sem_wait(&cpi->h_event_end_lpf);
-#endif
-
- /* build the bitstream */
- vp8_pack_bitstream(cpi, dest, dest_end, size);
-
-#if CONFIG_MULTITHREAD
- /* if PSNR packets are generated we have to wait for the lpf */
- if (cpi->b_lpf_running && cpi->b_calculate_psnr)
- {
- sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
- }
-#endif
-
- /* Move storing frame_type out of the above loop since it is also
- * needed in motion search besides loopfilter */
- cm->last_frame_type = cm->frame_type;
-
- /* Update rate control heuristics */
- cpi->total_byte_count += (*size);
- cpi->projected_frame_size = (*size) << 3;
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
- for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++)
- cpi->layer_context[i].total_byte_count += (*size);
- }
-
- if (!active_worst_qchanged)
- vp8_update_rate_correction_factors(cpi, 2);
-
- cpi->last_q[cm->frame_type] = cm->base_qindex;
-
- if (cm->frame_type == KEY_FRAME)
- {
- vp8_adjust_key_frame_context(cpi);
- }
-
- /* Keep a record of ambient average Q. */
- if (cm->frame_type != KEY_FRAME)
- cpi->avg_frame_qindex = (2 + 3 * cpi->avg_frame_qindex + cm->base_qindex) >> 2;
-
- /* Keep a record from which we can calculate the average Q excluding
- * GF updates and key frames
- */
- if ((cm->frame_type != KEY_FRAME) && ((cpi->oxcf.number_of_layers > 1) ||
- (!cm->refresh_golden_frame && !cm->refresh_alt_ref_frame)))
- {
- cpi->ni_frames++;
-
- /* Calculate the average Q for normal inter frames (not key or GFU
- * frames).
- */
- if ( cpi->pass == 2 )
- {
- cpi->ni_tot_qi += Q;
- cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
- }
- else
- {
- /* Damp value for first few frames */
- if (cpi->ni_frames > 150 )
- {
- cpi->ni_tot_qi += Q;
- cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
- }
- /* For one pass, early in the clip ... average the current frame Q
- * value with the worstq entered by the user as a dampening measure
- */
- else
- {
- cpi->ni_tot_qi += Q;
- cpi->ni_av_qi = ((cpi->ni_tot_qi / cpi->ni_frames) + cpi->worst_quality + 1) / 2;
- }
-
- /* If the average Q is higher than what was used in the last
- * frame (after going through the recode loop to keep the frame
- * size within range) then use the last frame value - 1. The -1
- * is designed to stop Q and hence the data rate, from
- * progressively falling away during difficult sections, but at
- * the same time reduce the number of itterations around the
- * recode loop.
- */
- if (Q > cpi->ni_av_qi)
- cpi->ni_av_qi = Q - 1;
- }
- }
-
- /* Update the buffer level variable. */
- /* Non-viewable frames are a special case and are treated as pure overhead. */
- if ( !cm->show_frame )
- cpi->bits_off_target -= cpi->projected_frame_size;
- else
- cpi->bits_off_target += cpi->av_per_frame_bandwidth - cpi->projected_frame_size;
-
- /* Clip the buffer level to the maximum specified buffer size */
- if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size)
- cpi->bits_off_target = cpi->oxcf.maximum_buffer_size;
-
- /* Rolling monitors of whether we are over or underspending used to
- * help regulate min and Max Q in two pass.
- */
- cpi->rolling_target_bits = ((cpi->rolling_target_bits * 3) + cpi->this_frame_target + 2) / 4;
- cpi->rolling_actual_bits = ((cpi->rolling_actual_bits * 3) + cpi->projected_frame_size + 2) / 4;
- cpi->long_rolling_target_bits = ((cpi->long_rolling_target_bits * 31) + cpi->this_frame_target + 16) / 32;
- cpi->long_rolling_actual_bits = ((cpi->long_rolling_actual_bits * 31) + cpi->projected_frame_size + 16) / 32;
-
- /* Actual bits spent */
- cpi->total_actual_bits += cpi->projected_frame_size;
-
- /* Debug stats */
- cpi->total_target_vs_actual += (cpi->this_frame_target - cpi->projected_frame_size);
-
- cpi->buffer_level = cpi->bits_off_target;
-
- /* Propagate values to higher temporal layers */
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
-
- for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++)
- {
- LAYER_CONTEXT *lc = &cpi->layer_context[i];
- int bits_off_for_this_layer =
- (int)(lc->target_bandwidth / lc->framerate -
- cpi->projected_frame_size);
-
- lc->bits_off_target += bits_off_for_this_layer;
-
- /* Clip buffer level to maximum buffer size for the layer */
- if (lc->bits_off_target > lc->maximum_buffer_size)
- lc->bits_off_target = lc->maximum_buffer_size;
-
- lc->total_actual_bits += cpi->projected_frame_size;
- lc->total_target_vs_actual += bits_off_for_this_layer;
- lc->buffer_level = lc->bits_off_target;
- }
- }
-
- /* Update bits left to the kf and gf groups to account for overshoot
- * or undershoot on these frames
- */
- if (cm->frame_type == KEY_FRAME)
- {
- cpi->twopass.kf_group_bits += cpi->this_frame_target - cpi->projected_frame_size;
-
- if (cpi->twopass.kf_group_bits < 0)
- cpi->twopass.kf_group_bits = 0 ;
- }
- else if (cm->refresh_golden_frame || cm->refresh_alt_ref_frame)
- {
- cpi->twopass.gf_group_bits += cpi->this_frame_target - cpi->projected_frame_size;
-
- if (cpi->twopass.gf_group_bits < 0)
- cpi->twopass.gf_group_bits = 0 ;
- }
-
- if (cm->frame_type != KEY_FRAME)
- {
- if (cpi->common.refresh_alt_ref_frame)
- {
- cpi->last_skip_false_probs[2] = cpi->prob_skip_false;
- cpi->last_skip_probs_q[2] = cm->base_qindex;
- }
- else if (cpi->common.refresh_golden_frame)
- {
- cpi->last_skip_false_probs[1] = cpi->prob_skip_false;
- cpi->last_skip_probs_q[1] = cm->base_qindex;
- }
- else
- {
- cpi->last_skip_false_probs[0] = cpi->prob_skip_false;
- cpi->last_skip_probs_q[0] = cm->base_qindex;
-
- /* update the baseline */
- cpi->base_skip_false_prob[cm->base_qindex] = cpi->prob_skip_false;
-
- }
- }
-
-#if 0 && CONFIG_INTERNAL_STATS
- {
- FILE *f = fopen("tmp.stt", "a");
-
- vp8_clear_system_state();
-
- if (cpi->twopass.total_left_stats.coded_error != 0.0)
- fprintf(f, "%10d %10d %10d %10d %10d %10"PRId64" %10"PRId64
- "%10"PRId64" %10d %6d %6d %6d %6d %5d %5d %5d %8d "
- "%8.2lf %"PRId64" %10.3lf %10"PRId64" %8d\n",
- cpi->common.current_video_frame, cpi->this_frame_target,
- cpi->projected_frame_size,
- (cpi->projected_frame_size - cpi->this_frame_target),
- cpi->total_target_vs_actual,
- cpi->buffer_level,
- (cpi->oxcf.starting_buffer_level-cpi->bits_off_target),
- cpi->total_actual_bits, cm->base_qindex,
- cpi->active_best_quality, cpi->active_worst_quality,
- cpi->ni_av_qi, cpi->cq_target_quality,
- cm->refresh_golden_frame, cm->refresh_alt_ref_frame,
- cm->frame_type, cpi->gfu_boost,
- cpi->twopass.est_max_qcorrection_factor,
- cpi->twopass.bits_left,
- cpi->twopass.total_left_stats.coded_error,
- (double)cpi->twopass.bits_left /
- cpi->twopass.total_left_stats.coded_error,
- cpi->tot_recode_hits);
- else
- fprintf(f, "%10d %10d %10d %10d %10d %10"PRId64" %10"PRId64
- "%10"PRId64" %10d %6d %6d %6d %6d %5d %5d %5d %8d "
- "%8.2lf %"PRId64" %10.3lf %8d\n",
- cpi->common.current_video_frame, cpi->this_frame_target,
- cpi->projected_frame_size,
- (cpi->projected_frame_size - cpi->this_frame_target),
- cpi->total_target_vs_actual,
- cpi->buffer_level,
- (cpi->oxcf.starting_buffer_level-cpi->bits_off_target),
- cpi->total_actual_bits, cm->base_qindex,
- cpi->active_best_quality, cpi->active_worst_quality,
- cpi->ni_av_qi, cpi->cq_target_quality,
- cm->refresh_golden_frame, cm->refresh_alt_ref_frame,
- cm->frame_type, cpi->gfu_boost,
- cpi->twopass.est_max_qcorrection_factor,
- cpi->twopass.bits_left,
- cpi->twopass.total_left_stats.coded_error,
- cpi->tot_recode_hits);
-
- fclose(f);
-
- {
- FILE *fmodes = fopen("Modes.stt", "a");
-
- fprintf(fmodes, "%6d:%1d:%1d:%1d ",
- cpi->common.current_video_frame,
- cm->frame_type, cm->refresh_golden_frame,
- cm->refresh_alt_ref_frame);
-
- fprintf(fmodes, "\n");
-
- fclose(fmodes);
- }
- }
-
-#endif
-
- if (cm->refresh_golden_frame == 1)
- cm->frame_flags = cm->frame_flags | FRAMEFLAGS_GOLDEN;
- else
- cm->frame_flags = cm->frame_flags&~FRAMEFLAGS_GOLDEN;
-
- if (cm->refresh_alt_ref_frame == 1)
- cm->frame_flags = cm->frame_flags | FRAMEFLAGS_ALTREF;
- else
- cm->frame_flags = cm->frame_flags&~FRAMEFLAGS_ALTREF;
-
-
- if (cm->refresh_last_frame & cm->refresh_golden_frame)
- /* both refreshed */
- cpi->gold_is_last = 1;
- else if (cm->refresh_last_frame ^ cm->refresh_golden_frame)
- /* 1 refreshed but not the other */
- cpi->gold_is_last = 0;
-
- if (cm->refresh_last_frame & cm->refresh_alt_ref_frame)
- /* both refreshed */
- cpi->alt_is_last = 1;
- else if (cm->refresh_last_frame ^ cm->refresh_alt_ref_frame)
- /* 1 refreshed but not the other */
- cpi->alt_is_last = 0;
-
- if (cm->refresh_alt_ref_frame & cm->refresh_golden_frame)
- /* both refreshed */
- cpi->gold_is_alt = 1;
- else if (cm->refresh_alt_ref_frame ^ cm->refresh_golden_frame)
- /* 1 refreshed but not the other */
- cpi->gold_is_alt = 0;
-
- cpi->ref_frame_flags = VP8_ALTR_FRAME | VP8_GOLD_FRAME | VP8_LAST_FRAME;
-
- if (cpi->gold_is_last)
- cpi->ref_frame_flags &= ~VP8_GOLD_FRAME;
-
- if (cpi->alt_is_last)
- cpi->ref_frame_flags &= ~VP8_ALTR_FRAME;
-
- if (cpi->gold_is_alt)
- cpi->ref_frame_flags &= ~VP8_ALTR_FRAME;
-
-
- if (!cpi->oxcf.error_resilient_mode)
- {
- if (cpi->oxcf.play_alternate && cm->refresh_alt_ref_frame && (cm->frame_type != KEY_FRAME))
- /* Update the alternate reference frame stats as appropriate. */
- update_alt_ref_frame_stats(cpi);
- else
- /* Update the Golden frame stats as appropriate. */
- update_golden_frame_stats(cpi);
- }
-
- if (cm->frame_type == KEY_FRAME)
- {
- /* Tell the caller that the frame was coded as a key frame */
- *frame_flags = cm->frame_flags | FRAMEFLAGS_KEY;
-
- /* As this frame is a key frame the next defaults to an inter frame. */
- cm->frame_type = INTER_FRAME;
-
- cpi->last_frame_percent_intra = 100;
- }
- else
- {
- *frame_flags = cm->frame_flags&~FRAMEFLAGS_KEY;
-
- cpi->last_frame_percent_intra = cpi->this_frame_percent_intra;
- }
-
- /* Clear the one shot update flags for segmentation map and mode/ref
- * loop filter deltas.
- */
- cpi->mb.e_mbd.update_mb_segmentation_map = 0;
- cpi->mb.e_mbd.update_mb_segmentation_data = 0;
- cpi->mb.e_mbd.mode_ref_lf_delta_update = 0;
-
-
- /* Dont increment frame counters if this was an altref buffer update
- * not a real frame
- */
- if (cm->show_frame)
- {
- cm->current_video_frame++;
- cpi->frames_since_key++;
- cpi->temporal_pattern_counter++;
- }
-
- /* reset to normal state now that we are done. */
-
-
-
-#if 0
- {
- char filename[512];
- FILE *recon_file;
- sprintf(filename, "enc%04d.yuv", (int) cm->current_video_frame);
- recon_file = fopen(filename, "wb");
- fwrite(cm->yv12_fb[cm->lst_fb_idx].buffer_alloc,
- cm->yv12_fb[cm->lst_fb_idx].frame_size, 1, recon_file);
- fclose(recon_file);
- }
-#endif
-
- /* DEBUG */
- /* vp8_write_yuv_frame("encoder_recon.yuv", cm->frame_to_show); */
-
-
-}
-#if !(CONFIG_REALTIME_ONLY)
-static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned char * dest_end, unsigned int *frame_flags)
-{
-
- if (!cpi->common.refresh_alt_ref_frame)
- vp8_second_pass(cpi);
-
- encode_frame_to_data_rate(cpi, size, dest, dest_end, frame_flags);
- cpi->twopass.bits_left -= 8 * *size;
-
- if (!cpi->common.refresh_alt_ref_frame)
- {
- double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
- *cpi->oxcf.two_pass_vbrmin_section / 100);
- cpi->twopass.bits_left += (int64_t)(two_pass_min_rate / cpi->framerate);
- }
-}
-#endif
-
-/* For ARM NEON, d8-d15 are callee-saved registers, and need to be saved. */
-#if HAVE_NEON
-extern void vp8_push_neon(int64_t *store);
-extern void vp8_pop_neon(int64_t *store);
-#endif
-
-
-int vp8_receive_raw_frame(VP8_COMP *cpi, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time)
-{
-#if HAVE_NEON
- int64_t store_reg[8];
-#if CONFIG_RUNTIME_CPU_DETECT
- VP8_COMMON *cm = &cpi->common;
-#endif
-#endif
- struct vpx_usec_timer timer;
- int res = 0;
-
-#if HAVE_NEON
-#if CONFIG_RUNTIME_CPU_DETECT
- if (cm->cpu_caps & HAS_NEON)
-#endif
- {
- vp8_push_neon(store_reg);
- }
-#endif
-
- vpx_usec_timer_start(&timer);
-
- /* Reinit the lookahead buffer if the frame size changes */
- if (sd->y_width != cpi->oxcf.Width || sd->y_height != cpi->oxcf.Height)
- {
- assert(cpi->oxcf.lag_in_frames < 2);
- dealloc_raw_frame_buffers(cpi);
- alloc_raw_frame_buffers(cpi);
- }
-
- if(vp8_lookahead_push(cpi->lookahead, sd, time_stamp, end_time,
- frame_flags, cpi->active_map_enabled ? cpi->active_map : NULL))
- res = -1;
- vpx_usec_timer_mark(&timer);
- cpi->time_receive_data += vpx_usec_timer_elapsed(&timer);
-
-#if HAVE_NEON
-#if CONFIG_RUNTIME_CPU_DETECT
- if (cm->cpu_caps & HAS_NEON)
-#endif
- {
- vp8_pop_neon(store_reg);
- }
-#endif
-
- return res;
-}
-
-
-static int frame_is_reference(const VP8_COMP *cpi)
-{
- const VP8_COMMON *cm = &cpi->common;
- const MACROBLOCKD *xd = &cpi->mb.e_mbd;
-
- return cm->frame_type == KEY_FRAME || cm->refresh_last_frame
- || cm->refresh_golden_frame || cm->refresh_alt_ref_frame
- || cm->copy_buffer_to_gf || cm->copy_buffer_to_arf
- || cm->refresh_entropy_probs
- || xd->mode_ref_lf_delta_update
- || xd->update_mb_segmentation_map || xd->update_mb_segmentation_data;
-}
-
-
-int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, unsigned char *dest_end, int64_t *time_stamp, int64_t *time_end, int flush)
-{
-#if HAVE_NEON
- int64_t store_reg[8];
-#endif
- VP8_COMMON *cm;
- struct vpx_usec_timer tsctimer;
- struct vpx_usec_timer ticktimer;
- struct vpx_usec_timer cmptimer;
- YV12_BUFFER_CONFIG *force_src_buffer;
-
- if (!cpi)
- return -1;
-
- cm = &cpi->common;
-
- if (setjmp(cpi->common.error.jmp))
- {
- cpi->common.error.setjmp = 0;
- return VPX_CODEC_CORRUPT_FRAME;
- }
-
- force_src_buffer = NULL;
- cpi->common.error.setjmp = 1;
-
-#if HAVE_NEON
-#if CONFIG_RUNTIME_CPU_DETECT
- if (cm->cpu_caps & HAS_NEON)
-#endif
- {
- vp8_push_neon(store_reg);
- }
-#endif
-
- vpx_usec_timer_start(&cmptimer);
-
- cpi->source = NULL;
-
-#if !(CONFIG_REALTIME_ONLY)
- /* Should we code an alternate reference frame */
- if (cpi->oxcf.error_resilient_mode == 0 &&
- cpi->oxcf.play_alternate &&
- cpi->source_alt_ref_pending)
- {
- if ((cpi->source = vp8_lookahead_peek(cpi->lookahead,
- cpi->frames_till_gf_update_due,
- PEEK_FORWARD)))
- {
- cpi->alt_ref_source = cpi->source;
- if (cpi->oxcf.arnr_max_frames > 0)
- {
- vp8_temporal_filter_prepare_c(cpi,
- cpi->frames_till_gf_update_due);
- force_src_buffer = &cpi->alt_ref_buffer;
- }
- cpi->frames_till_alt_ref_frame = cpi->frames_till_gf_update_due;
- cm->refresh_alt_ref_frame = 1;
- cm->refresh_golden_frame = 0;
- cm->refresh_last_frame = 0;
- cm->show_frame = 0;
- /* Clear Pending alt Ref flag. */
- cpi->source_alt_ref_pending = 0;
- cpi->is_src_frame_alt_ref = 0;
- }
- }
-#endif
-
- if (!cpi->source)
- {
- /* Read last frame source if we are encoding first pass. */
- if (cpi->pass == 1 && cm->current_video_frame > 0)
- {
- if((cpi->last_source = vp8_lookahead_peek(cpi->lookahead, 1,
- PEEK_BACKWARD)) == NULL)
- return -1;
- }
-
-
- if ((cpi->source = vp8_lookahead_pop(cpi->lookahead, flush)))
- {
- cm->show_frame = 1;
-
- cpi->is_src_frame_alt_ref = cpi->alt_ref_source
- && (cpi->source == cpi->alt_ref_source);
-
- if(cpi->is_src_frame_alt_ref)
- cpi->alt_ref_source = NULL;
- }
- }
-
- if (cpi->source)
- {
- cpi->Source = force_src_buffer ? force_src_buffer : &cpi->source->img;
- cpi->un_scaled_source = cpi->Source;
- *time_stamp = cpi->source->ts_start;
- *time_end = cpi->source->ts_end;
- *frame_flags = cpi->source->flags;
-
- if (cpi->pass == 1 && cm->current_video_frame > 0)
- {
- cpi->last_frame_unscaled_source = &cpi->last_source->img;
- }
- }
- else
- {
- *size = 0;
-#if !(CONFIG_REALTIME_ONLY)
-
- if (flush && cpi->pass == 1 && !cpi->twopass.first_pass_done)
- {
- vp8_end_first_pass(cpi); /* get last stats packet */
- cpi->twopass.first_pass_done = 1;
- }
-
-#endif
-
-#if HAVE_NEON
-#if CONFIG_RUNTIME_CPU_DETECT
- if (cm->cpu_caps & HAS_NEON)
-#endif
- {
- vp8_pop_neon(store_reg);
- }
-#endif
- return -1;
- }
-
- if (cpi->source->ts_start < cpi->first_time_stamp_ever)
- {
- cpi->first_time_stamp_ever = cpi->source->ts_start;
- cpi->last_end_time_stamp_seen = cpi->source->ts_start;
- }
-
- /* adjust frame rates based on timestamps given */
- if (cm->show_frame)
- {
- int64_t this_duration;
- int step = 0;
-
- if (cpi->source->ts_start == cpi->first_time_stamp_ever)
- {
- this_duration = cpi->source->ts_end - cpi->source->ts_start;
- step = 1;
- }
- else
- {
- int64_t last_duration;
-
- this_duration = cpi->source->ts_end - cpi->last_end_time_stamp_seen;
- last_duration = cpi->last_end_time_stamp_seen
- - cpi->last_time_stamp_seen;
- /* do a step update if the duration changes by 10% */
- if (last_duration)
- step = (int)(((this_duration - last_duration) *
- 10 / last_duration));
- }
-
- if (this_duration)
- {
- if (step)
- cpi->ref_framerate = 10000000.0 / this_duration;
- else
- {
- double avg_duration, interval;
-
- /* Average this frame's rate into the last second's average
- * frame rate. If we haven't seen 1 second yet, then average
- * over the whole interval seen.
- */
- interval = (double)(cpi->source->ts_end -
- cpi->first_time_stamp_ever);
- if(interval > 10000000.0)
- interval = 10000000;
-
- avg_duration = 10000000.0 / cpi->ref_framerate;
- avg_duration *= (interval - avg_duration + this_duration);
- avg_duration /= interval;
-
- cpi->ref_framerate = 10000000.0 / avg_duration;
- }
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
-
- /* Update frame rates for each layer */
- assert(cpi->oxcf.number_of_layers <= VPX_TS_MAX_LAYERS);
- for (i=0; i<cpi->oxcf.number_of_layers; i++)
- {
- LAYER_CONTEXT *lc = &cpi->layer_context[i];
- lc->framerate = cpi->ref_framerate /
- cpi->oxcf.rate_decimator[i];
- }
- }
- else
- vp8_new_framerate(cpi, cpi->ref_framerate);
- }
-
- cpi->last_time_stamp_seen = cpi->source->ts_start;
- cpi->last_end_time_stamp_seen = cpi->source->ts_end;
- }
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- int layer;
-
- update_layer_contexts (cpi);
-
- /* Restore layer specific context & set frame rate */
- layer = cpi->oxcf.layer_id[
- cpi->temporal_pattern_counter % cpi->oxcf.periodicity];
- restore_layer_context (cpi, layer);
- vp8_new_framerate(cpi, cpi->layer_context[layer].framerate);
- }
-
- if (cpi->compressor_speed == 2)
- {
- vpx_usec_timer_start(&tsctimer);
- vpx_usec_timer_start(&ticktimer);
- }
-
- cpi->lf_zeromv_pct = (cpi->zeromv_count * 100)/cm->MBs;
-
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- {
- int i;
- const int num_part = (1 << cm->multi_token_partition);
- /* the available bytes in dest */
- const unsigned long dest_size = dest_end - dest;
- const int tok_part_buff_size = (dest_size * 9) / (10 * num_part);
-
- unsigned char *dp = dest;
-
- cpi->partition_d[0] = dp;
- dp += dest_size/10; /* reserve 1/10 for control partition */
- cpi->partition_d_end[0] = dp;
-
- for(i = 0; i < num_part; i++)
- {
- cpi->partition_d[i + 1] = dp;
- dp += tok_part_buff_size;
- cpi->partition_d_end[i + 1] = dp;
- }
- }
-#endif
-
- /* start with a 0 size frame */
- *size = 0;
-
- /* Clear down mmx registers */
- vp8_clear_system_state();
-
- cm->frame_type = INTER_FRAME;
- cm->frame_flags = *frame_flags;
-
-#if 0
-
- if (cm->refresh_alt_ref_frame)
- {
- cm->refresh_golden_frame = 0;
- cm->refresh_last_frame = 0;
- }
- else
- {
- cm->refresh_golden_frame = 0;
- cm->refresh_last_frame = 1;
- }
-
-#endif
- /* find a free buffer for the new frame */
- {
- int i = 0;
- for(; i < NUM_YV12_BUFFERS; i++)
- {
- if(!cm->yv12_fb[i].flags)
- {
- cm->new_fb_idx = i;
- break;
- }
- }
-
- assert(i < NUM_YV12_BUFFERS );
- }
-#if !(CONFIG_REALTIME_ONLY)
-
- if (cpi->pass == 1)
- {
- Pass1Encode(cpi, size, dest, frame_flags);
- }
- else if (cpi->pass == 2)
- {
- Pass2Encode(cpi, size, dest, dest_end, frame_flags);
- }
- else
-#endif
- encode_frame_to_data_rate(cpi, size, dest, dest_end, frame_flags);
-
- if (cpi->compressor_speed == 2)
- {
- unsigned int duration, duration2;
- vpx_usec_timer_mark(&tsctimer);
- vpx_usec_timer_mark(&ticktimer);
-
- duration = (int)(vpx_usec_timer_elapsed(&ticktimer));
- duration2 = (unsigned int)((double)duration / 2);
-
- if (cm->frame_type != KEY_FRAME)
- {
- if (cpi->avg_encode_time == 0)
- cpi->avg_encode_time = duration;
- else
- cpi->avg_encode_time = (7 * cpi->avg_encode_time + duration) >> 3;
- }
-
- if (duration2)
- {
- {
-
- if (cpi->avg_pick_mode_time == 0)
- cpi->avg_pick_mode_time = duration2;
- else
- cpi->avg_pick_mode_time = (7 * cpi->avg_pick_mode_time + duration2) >> 3;
- }
- }
-
- }
-
- if (cm->refresh_entropy_probs == 0)
- {
- vpx_memcpy(&cm->fc, &cm->lfc, sizeof(cm->fc));
- }
-
- /* Save the contexts separately for alt ref, gold and last. */
- /* (TODO jbb -> Optimize this with pointers to avoid extra copies. ) */
- if(cm->refresh_alt_ref_frame)
- vpx_memcpy(&cpi->lfc_a, &cm->fc, sizeof(cm->fc));
-
- if(cm->refresh_golden_frame)
- vpx_memcpy(&cpi->lfc_g, &cm->fc, sizeof(cm->fc));
-
- if(cm->refresh_last_frame)
- vpx_memcpy(&cpi->lfc_n, &cm->fc, sizeof(cm->fc));
-
- /* if its a dropped frame honor the requests on subsequent frames */
- if (*size > 0)
- {
- cpi->droppable = !frame_is_reference(cpi);
-
- /* return to normal state */
- cm->refresh_entropy_probs = 1;
- cm->refresh_alt_ref_frame = 0;
- cm->refresh_golden_frame = 0;
- cm->refresh_last_frame = 1;
- cm->frame_type = INTER_FRAME;
-
- }
-
- /* Save layer specific state */
- if (cpi->oxcf.number_of_layers > 1)
- save_layer_context (cpi);
-
- vpx_usec_timer_mark(&cmptimer);
- cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer);
-
- if (cpi->b_calculate_psnr && cpi->pass != 1 && cm->show_frame)
- {
- generate_psnr_packet(cpi);
- }
-
-#if CONFIG_INTERNAL_STATS
-
- if (cpi->pass != 1)
- {
- cpi->bytes += *size;
-
- if (cm->show_frame)
- {
- cpi->common.show_frame_mi = cpi->common.mi;
- cpi->count ++;
-
- if (cpi->b_calculate_psnr)
- {
- uint64_t ye,ue,ve;
- double frame_psnr;
- YV12_BUFFER_CONFIG *orig = cpi->Source;
- YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show;
- int y_samples = orig->y_height * orig->y_width ;
- int uv_samples = orig->uv_height * orig->uv_width ;
- int t_samples = y_samples + 2 * uv_samples;
- double sq_error, sq_error2;
-
- ye = calc_plane_error(orig->y_buffer, orig->y_stride,
- recon->y_buffer, recon->y_stride, orig->y_width, orig->y_height);
-
- ue = calc_plane_error(orig->u_buffer, orig->uv_stride,
- recon->u_buffer, recon->uv_stride, orig->uv_width, orig->uv_height);
-
- ve = calc_plane_error(orig->v_buffer, orig->uv_stride,
- recon->v_buffer, recon->uv_stride, orig->uv_width, orig->uv_height);
-
- sq_error = (double)(ye + ue + ve);
-
- frame_psnr = vpx_sse_to_psnr(t_samples, 255.0, sq_error);
-
- cpi->total_y += vpx_sse_to_psnr(y_samples, 255.0, (double)ye);
- cpi->total_u += vpx_sse_to_psnr(uv_samples, 255.0, (double)ue);
- cpi->total_v += vpx_sse_to_psnr(uv_samples, 255.0, (double)ve);
- cpi->total_sq_error += sq_error;
- cpi->total += frame_psnr;
-#if CONFIG_POSTPROC
- {
- YV12_BUFFER_CONFIG *pp = &cm->post_proc_buffer;
- double frame_psnr2, frame_ssim2 = 0;
- double weight = 0;
-
- vp8_deblock(cm, cm->frame_to_show, &cm->post_proc_buffer, cm->filter_level * 10 / 6, 1, 0);
- vp8_clear_system_state();
-
- ye = calc_plane_error(orig->y_buffer, orig->y_stride,
- pp->y_buffer, pp->y_stride, orig->y_width, orig->y_height);
-
- ue = calc_plane_error(orig->u_buffer, orig->uv_stride,
- pp->u_buffer, pp->uv_stride, orig->uv_width, orig->uv_height);
-
- ve = calc_plane_error(orig->v_buffer, orig->uv_stride,
- pp->v_buffer, pp->uv_stride, orig->uv_width, orig->uv_height);
-
- sq_error2 = (double)(ye + ue + ve);
-
- frame_psnr2 = vpx_sse_to_psnr(t_samples, 255.0, sq_error2);
-
- cpi->totalp_y += vpx_sse_to_psnr(y_samples,
- 255.0, (double)ye);
- cpi->totalp_u += vpx_sse_to_psnr(uv_samples,
- 255.0, (double)ue);
- cpi->totalp_v += vpx_sse_to_psnr(uv_samples,
- 255.0, (double)ve);
- cpi->total_sq_error2 += sq_error2;
- cpi->totalp += frame_psnr2;
-
- frame_ssim2 = vp8_calc_ssim(cpi->Source,
- &cm->post_proc_buffer, 1, &weight);
-
- cpi->summed_quality += frame_ssim2 * weight;
- cpi->summed_weights += weight;
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
-
- for (i=cpi->current_layer;
- i<cpi->oxcf.number_of_layers; i++)
- {
- cpi->frames_in_layer[i]++;
-
- cpi->bytes_in_layer[i] += *size;
- cpi->sum_psnr[i] += frame_psnr;
- cpi->sum_psnr_p[i] += frame_psnr2;
- cpi->total_error2[i] += sq_error;
- cpi->total_error2_p[i] += sq_error2;
- cpi->sum_ssim[i] += frame_ssim2 * weight;
- cpi->sum_weights[i] += weight;
- }
- }
- }
-#endif
- }
-
- if (cpi->b_calculate_ssimg)
- {
- double y, u, v, frame_all;
- frame_all = vp8_calc_ssimg(cpi->Source, cm->frame_to_show,
- &y, &u, &v);
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
-
- for (i=cpi->current_layer;
- i<cpi->oxcf.number_of_layers; i++)
- {
- if (!cpi->b_calculate_psnr)
- cpi->frames_in_layer[i]++;
-
- cpi->total_ssimg_y_in_layer[i] += y;
- cpi->total_ssimg_u_in_layer[i] += u;
- cpi->total_ssimg_v_in_layer[i] += v;
- cpi->total_ssimg_all_in_layer[i] += frame_all;
- }
- }
- else
- {
- cpi->total_ssimg_y += y;
- cpi->total_ssimg_u += u;
- cpi->total_ssimg_v += v;
- cpi->total_ssimg_all += frame_all;
- }
- }
-
- }
- }
-
-#if 0
-
- if (cpi->common.frame_type != 0 && cpi->common.base_qindex == cpi->oxcf.worst_allowed_q)
- {
- skiptruecount += cpi->skip_true_count;
- skipfalsecount += cpi->skip_false_count;
- }
-
-#endif
-#if 0
-
- if (cpi->pass != 1)
- {
- FILE *f = fopen("skip.stt", "a");
- fprintf(f, "frame:%4d flags:%4x Q:%4d P:%4d Size:%5d\n", cpi->common.current_video_frame, *frame_flags, cpi->common.base_qindex, cpi->prob_skip_false, *size);
-
- if (cpi->is_src_frame_alt_ref == 1)
- fprintf(f, "skipcount: %4d framesize: %d\n", cpi->skip_true_count , *size);
-
- fclose(f);
- }
-
-#endif
-#endif
-
-#if HAVE_NEON
-#if CONFIG_RUNTIME_CPU_DETECT
- if (cm->cpu_caps & HAS_NEON)
-#endif
- {
- vp8_pop_neon(store_reg);
- }
-#endif
-
- cpi->common.error.setjmp = 0;
-
- return 0;
-}
-
-int vp8_get_preview_raw_frame(VP8_COMP *cpi, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags)
-{
- if (cpi->common.refresh_alt_ref_frame)
- return -1;
- else
- {
- int ret;
-
-#if CONFIG_MULTITHREAD
- if(cpi->b_lpf_running)
- {
- sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
- }
-#endif
-
-#if CONFIG_POSTPROC
- cpi->common.show_frame_mi = cpi->common.mi;
- ret = vp8_post_proc_frame(&cpi->common, dest, flags);
-#else
-
- if (cpi->common.frame_to_show)
- {
- *dest = *cpi->common.frame_to_show;
- dest->y_width = cpi->common.Width;
- dest->y_height = cpi->common.Height;
- dest->uv_height = cpi->common.Height / 2;
- ret = 0;
- }
- else
- {
- ret = -1;
- }
-
-#endif
- vp8_clear_system_state();
- return ret;
- }
-}
-
-int vp8_set_roimap(VP8_COMP *cpi, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4])
-{
- signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
- int internal_delta_q[MAX_MB_SEGMENTS];
- const int range = 63;
- int i;
-
- // This method is currently incompatible with the cyclic refresh method
- if ( cpi->cyclic_refresh_mode_enabled )
- return -1;
-
- // Check number of rows and columns match
- if (cpi->common.mb_rows != (int)rows || cpi->common.mb_cols != (int)cols)
- return -1;
-
- // Range check the delta Q values and convert the external Q range values
- // to internal ones.
- if ( (abs(delta_q[0]) > range) || (abs(delta_q[1]) > range) ||
- (abs(delta_q[2]) > range) || (abs(delta_q[3]) > range) )
- return -1;
-
- // Range check the delta lf values
- if ( (abs(delta_lf[0]) > range) || (abs(delta_lf[1]) > range) ||
- (abs(delta_lf[2]) > range) || (abs(delta_lf[3]) > range) )
- return -1;
-
- if (!map)
- {
- disable_segmentation(cpi);
- return 0;
- }
-
- // Translate the external delta q values to internal values.
- for ( i = 0; i < MAX_MB_SEGMENTS; i++ )
- internal_delta_q[i] =
- ( delta_q[i] >= 0 ) ? q_trans[delta_q[i]] : -q_trans[-delta_q[i]];
-
- /* Set the segmentation Map */
- set_segmentation_map(cpi, map);
-
- /* Activate segmentation. */
- enable_segmentation(cpi);
-
- /* Set up the quant segment data */
- feature_data[MB_LVL_ALT_Q][0] = internal_delta_q[0];
- feature_data[MB_LVL_ALT_Q][1] = internal_delta_q[1];
- feature_data[MB_LVL_ALT_Q][2] = internal_delta_q[2];
- feature_data[MB_LVL_ALT_Q][3] = internal_delta_q[3];
-
- /* Set up the loop segment data s */
- feature_data[MB_LVL_ALT_LF][0] = delta_lf[0];
- feature_data[MB_LVL_ALT_LF][1] = delta_lf[1];
- feature_data[MB_LVL_ALT_LF][2] = delta_lf[2];
- feature_data[MB_LVL_ALT_LF][3] = delta_lf[3];
-
- cpi->segment_encode_breakout[0] = threshold[0];
- cpi->segment_encode_breakout[1] = threshold[1];
- cpi->segment_encode_breakout[2] = threshold[2];
- cpi->segment_encode_breakout[3] = threshold[3];
-
- /* Initialise the feature data structure */
- set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA);
-
- return 0;
-}
-
-int vp8_set_active_map(VP8_COMP *cpi, unsigned char *map, unsigned int rows, unsigned int cols)
-{
- if ((int)rows == cpi->common.mb_rows && (int)cols == cpi->common.mb_cols)
- {
- if (map)
- {
- vpx_memcpy(cpi->active_map, map, rows * cols);
- cpi->active_map_enabled = 1;
- }
- else
- cpi->active_map_enabled = 0;
-
- return 0;
- }
- else
- {
- return -1 ;
- }
-}
-
-int vp8_set_internal_size(VP8_COMP *cpi, VPX_SCALING horiz_mode, VPX_SCALING vert_mode)
-{
- if (horiz_mode <= ONETWO)
- cpi->common.horiz_scale = horiz_mode;
- else
- return -1;
-
- if (vert_mode <= ONETWO)
- cpi->common.vert_scale = vert_mode;
- else
- return -1;
-
- return 0;
-}
-
-
-
-int vp8_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest)
-{
- int i, j;
- int Total = 0;
-
- unsigned char *src = source->y_buffer;
- unsigned char *dst = dest->y_buffer;
-
- /* Loop through the Y plane raw and reconstruction data summing
- * (square differences)
- */
- for (i = 0; i < source->y_height; i += 16)
- {
- for (j = 0; j < source->y_width; j += 16)
- {
- unsigned int sse;
- Total += vp8_mse16x16(src + j, source->y_stride, dst + j, dest->y_stride, &sse);
- }
-
- src += 16 * source->y_stride;
- dst += 16 * dest->y_stride;
- }
-
- return Total;
-}
-
-
-int vp8_get_quantizer(VP8_COMP *cpi)
-{
- return cpi->common.base_qindex;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_int.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_int.h
deleted file mode 100644
index 6b37167..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/onyx_int.h
+++ /dev/null
@@ -1,732 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_ONYX_INT_H_
-#define VP8_ENCODER_ONYX_INT_H_
-
-#include <stdio.h>
-#include "vpx_config.h"
-#include "vp8/common/onyx.h"
-#include "treewriter.h"
-#include "tokenize.h"
-#include "vp8/common/onyxc_int.h"
-#include "vp8/common/variance.h"
-#include "encodemb.h"
-#include "quantize.h"
-#include "vp8/common/entropy.h"
-#include "vp8/common/threading.h"
-#include "vpx_ports/mem.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "vpx/vp8.h"
-#include "mcomp.h"
-#include "vp8/common/findnearmv.h"
-#include "lookahead.h"
-#if CONFIG_TEMPORAL_DENOISING
-#include "vp8/encoder/denoising.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MIN_GF_INTERVAL 4
-#define DEFAULT_GF_INTERVAL 7
-
-#define KEY_FRAME_CONTEXT 5
-
-#define MAX_LAG_BUFFERS (CONFIG_REALTIME_ONLY? 1 : 25)
-
-#define AF_THRESH 25
-#define AF_THRESH2 100
-#define ARF_DECAY_THRESH 12
-
-
-#define MIN_THRESHMULT 32
-#define MAX_THRESHMULT 512
-
-#define GF_ZEROMV_ZBIN_BOOST 12
-#define LF_ZEROMV_ZBIN_BOOST 6
-#define MV_ZBIN_BOOST 4
-#define ZBIN_OQ_MAX 192
-
-#if !(CONFIG_REALTIME_ONLY)
-#define VP8_TEMPORAL_ALT_REF 1
-#endif
-
-#define MAX(x,y) (((x)>(y))?(x):(y))
-#define MIN(x,y) (((x)<(y))?(x):(y))
-
-typedef struct
-{
- int kf_indicated;
- unsigned int frames_since_key;
- unsigned int frames_since_golden;
- int filter_level;
- int frames_till_gf_update_due;
- int recent_ref_frame_usage[MAX_REF_FRAMES];
-
- MV_CONTEXT mvc[2];
- int mvcosts[2][MVvals+1];
-
-#ifdef MODE_STATS
- int y_modes[5];
- int uv_modes[4];
- int b_modes[10];
- int inter_y_modes[10];
- int inter_uv_modes[4];
- int inter_b_modes[10];
-#endif
-
- vp8_prob ymode_prob[4], uv_mode_prob[3]; /* interframe intra mode probs */
- vp8_prob kf_ymode_prob[4], kf_uv_mode_prob[3]; /* keyframe "" */
-
- int ymode_count[5], uv_mode_count[4]; /* intra MB type cts this frame */
-
- int count_mb_ref_frame_usage[MAX_REF_FRAMES];
-
- int this_frame_percent_intra;
- int last_frame_percent_intra;
-
-
-} CODING_CONTEXT;
-
-typedef struct
-{
- double frame;
- double intra_error;
- double coded_error;
- double ssim_weighted_pred_err;
- double pcnt_inter;
- double pcnt_motion;
- double pcnt_second_ref;
- double pcnt_neutral;
- double MVr;
- double mvr_abs;
- double MVc;
- double mvc_abs;
- double MVrv;
- double MVcv;
- double mv_in_out_count;
- double new_mv_count;
- double duration;
- double count;
-}
-FIRSTPASS_STATS;
-
-typedef struct
-{
- int frames_so_far;
- double frame_intra_error;
- double frame_coded_error;
- double frame_pcnt_inter;
- double frame_pcnt_motion;
- double frame_mvr;
- double frame_mvr_abs;
- double frame_mvc;
- double frame_mvc_abs;
-
-} ONEPASS_FRAMESTATS;
-
-
-typedef enum
-{
- THR_ZERO1 = 0,
- THR_DC = 1,
-
- THR_NEAREST1 = 2,
- THR_NEAR1 = 3,
-
- THR_ZERO2 = 4,
- THR_NEAREST2 = 5,
-
- THR_ZERO3 = 6,
- THR_NEAREST3 = 7,
-
- THR_NEAR2 = 8,
- THR_NEAR3 = 9,
-
- THR_V_PRED = 10,
- THR_H_PRED = 11,
- THR_TM = 12,
-
- THR_NEW1 = 13,
- THR_NEW2 = 14,
- THR_NEW3 = 15,
-
- THR_SPLIT1 = 16,
- THR_SPLIT2 = 17,
- THR_SPLIT3 = 18,
-
- THR_B_PRED = 19
-}
-THR_MODES;
-
-typedef enum
-{
- DIAMOND = 0,
- NSTEP = 1,
- HEX = 2
-} SEARCH_METHODS;
-
-typedef struct
-{
- int RD;
- SEARCH_METHODS search_method;
- int improved_quant;
- int improved_dct;
- int auto_filter;
- int recode_loop;
- int iterative_sub_pixel;
- int half_pixel_search;
- int quarter_pixel_search;
- int thresh_mult[MAX_MODES];
- int max_step_search_steps;
- int first_step;
- int optimize_coefficients;
-
- int use_fastquant_for_pick;
- int no_skip_block4x4_search;
- int improved_mv_pred;
-
-} SPEED_FEATURES;
-
-typedef struct
-{
- MACROBLOCK mb;
- int segment_counts[MAX_MB_SEGMENTS];
- int totalrate;
-} MB_ROW_COMP;
-
-typedef struct
-{
- TOKENEXTRA *start;
- TOKENEXTRA *stop;
-} TOKENLIST;
-
-typedef struct
-{
- int ithread;
- void *ptr1;
- void *ptr2;
-} ENCODETHREAD_DATA;
-typedef struct
-{
- int ithread;
- void *ptr1;
-} LPFTHREAD_DATA;
-
-enum
-{
- BLOCK_16X8,
- BLOCK_8X16,
- BLOCK_8X8,
- BLOCK_4X4,
- BLOCK_16X16,
- BLOCK_MAX_SEGMENTS
-};
-
-typedef struct
-{
- /* Layer configuration */
- double framerate;
- int target_bandwidth;
-
- /* Layer specific coding parameters */
- int64_t starting_buffer_level;
- int64_t optimal_buffer_level;
- int64_t maximum_buffer_size;
- int64_t starting_buffer_level_in_ms;
- int64_t optimal_buffer_level_in_ms;
- int64_t maximum_buffer_size_in_ms;
-
- int avg_frame_size_for_layer;
-
- int64_t buffer_level;
- int64_t bits_off_target;
-
- int64_t total_actual_bits;
- int total_target_vs_actual;
-
- int worst_quality;
- int active_worst_quality;
- int best_quality;
- int active_best_quality;
-
- int ni_av_qi;
- int ni_tot_qi;
- int ni_frames;
- int avg_frame_qindex;
-
- double rate_correction_factor;
- double key_frame_rate_correction_factor;
- double gf_rate_correction_factor;
-
- int zbin_over_quant;
-
- int inter_frame_target;
- int64_t total_byte_count;
-
- int filter_level;
-
- int last_frame_percent_intra;
-
- int count_mb_ref_frame_usage[MAX_REF_FRAMES];
-
-} LAYER_CONTEXT;
-
-typedef struct VP8_COMP
-{
-
- DECLARE_ALIGNED(16, short, Y1quant[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y1quant_shift[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]);
-
- DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y2quant_shift[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]);
-
- DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, UVquant_shift[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]);
-
- DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, zrun_zbin_boost_uv[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y1quant_fast[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, Y2quant_fast[QINDEX_RANGE][16]);
- DECLARE_ALIGNED(16, short, UVquant_fast[QINDEX_RANGE][16]);
-
-
- MACROBLOCK mb;
- VP8_COMMON common;
- vp8_writer bc[9]; /* one boolcoder for each partition */
-
- VP8_CONFIG oxcf;
-
- struct lookahead_ctx *lookahead;
- struct lookahead_entry *source;
- struct lookahead_entry *alt_ref_source;
- struct lookahead_entry *last_source;
-
- YV12_BUFFER_CONFIG *Source;
- YV12_BUFFER_CONFIG *un_scaled_source;
- YV12_BUFFER_CONFIG scaled_source;
- YV12_BUFFER_CONFIG *last_frame_unscaled_source;
-
- unsigned int frames_till_alt_ref_frame;
- /* frame in src_buffers has been identified to be encoded as an alt ref */
- int source_alt_ref_pending;
- /* an alt ref frame has been encoded and is usable */
- int source_alt_ref_active;
- /* source of frame to encode is an exact copy of an alt ref frame */
- int is_src_frame_alt_ref;
-
- /* golden frame same as last frame ( short circuit gold searches) */
- int gold_is_last;
- /* Alt reference frame same as last ( short circuit altref search) */
- int alt_is_last;
- /* don't do both alt and gold search ( just do gold). */
- int gold_is_alt;
-
- YV12_BUFFER_CONFIG pick_lf_lvl_frame;
-
- TOKENEXTRA *tok;
- unsigned int tok_count;
-
-
- unsigned int frames_since_key;
- unsigned int key_frame_frequency;
- unsigned int this_key_frame_forced;
- unsigned int next_key_frame_forced;
-
- /* Ambient reconstruction err target for force key frames */
- int ambient_err;
-
- unsigned int mode_check_freq[MAX_MODES];
-
- int rd_baseline_thresh[MAX_MODES];
-
- int RDMULT;
- int RDDIV ;
-
- CODING_CONTEXT coding_context;
-
- /* Rate targetting variables */
- int64_t last_prediction_error;
- int64_t last_intra_error;
-
- int this_frame_target;
- int projected_frame_size;
- int last_q[2]; /* Separate values for Intra/Inter */
-
- double rate_correction_factor;
- double key_frame_rate_correction_factor;
- double gf_rate_correction_factor;
-
- unsigned int frames_since_golden;
- /* Count down till next GF */
- int frames_till_gf_update_due;
-
- /* GF interval chosen when we coded the last GF */
- int current_gf_interval;
-
- /* Total bits overspent becasue of GF boost (cumulative) */
- int gf_overspend_bits;
-
- /* Used in the few frames following a GF to recover the extra bits
- * spent in that GF
- */
- int non_gf_bitrate_adjustment;
-
- /* Extra bits spent on key frames that need to be recovered */
- int kf_overspend_bits;
-
- /* Current number of bit s to try and recover on each inter frame. */
- int kf_bitrate_adjustment;
- int max_gf_interval;
- int baseline_gf_interval;
- int active_arnr_frames;
-
- int64_t key_frame_count;
- int prior_key_frame_distance[KEY_FRAME_CONTEXT];
- /* Current section per frame bandwidth target */
- int per_frame_bandwidth;
- /* Average frame size target for clip */
- int av_per_frame_bandwidth;
- /* Minimum allocation that should be used for any frame */
- int min_frame_bandwidth;
- int inter_frame_target;
- double output_framerate;
- int64_t last_time_stamp_seen;
- int64_t last_end_time_stamp_seen;
- int64_t first_time_stamp_ever;
-
- int ni_av_qi;
- int ni_tot_qi;
- int ni_frames;
- int avg_frame_qindex;
-
- int64_t total_byte_count;
-
- int buffered_mode;
-
- double framerate;
- double ref_framerate;
- int64_t buffer_level;
- int64_t bits_off_target;
-
- int rolling_target_bits;
- int rolling_actual_bits;
-
- int long_rolling_target_bits;
- int long_rolling_actual_bits;
-
- int64_t total_actual_bits;
- int total_target_vs_actual; /* debug stats */
-
- int worst_quality;
- int active_worst_quality;
- int best_quality;
- int active_best_quality;
-
- int cq_target_quality;
-
- int drop_frames_allowed; /* Are we permitted to drop frames? */
- int drop_frame; /* Drop this frame? */
-
- vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
- char update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-
- unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
-
- int gfu_boost;
- int kf_boost;
- int last_boost;
-
- int target_bandwidth;
- struct vpx_codec_pkt_list *output_pkt_list;
-
-#if 0
- /* Experimental code for lagged and one pass */
- ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS];
- int one_pass_frame_index;
-#endif
-
- int decimation_factor;
- int decimation_count;
-
- /* for real time encoding */
- int avg_encode_time; /* microsecond */
- int avg_pick_mode_time; /* microsecond */
- int Speed;
- int compressor_speed;
-
- int auto_gold;
- int auto_adjust_gold_quantizer;
- int auto_worst_q;
- int cpu_used;
- int pass;
-
-
- int prob_intra_coded;
- int prob_last_coded;
- int prob_gf_coded;
- int prob_skip_false;
- int last_skip_false_probs[3];
- int last_skip_probs_q[3];
- int recent_ref_frame_usage[MAX_REF_FRAMES];
-
- int this_frame_percent_intra;
- int last_frame_percent_intra;
-
- int ref_frame_flags;
-
- SPEED_FEATURES sf;
-
- /* Count ZEROMV on all reference frames. */
- int zeromv_count;
- int lf_zeromv_pct;
-
- unsigned char *segmentation_map;
- signed char segment_feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
- int segment_encode_breakout[MAX_MB_SEGMENTS];
-
- unsigned char *active_map;
- unsigned int active_map_enabled;
-
- /* Video conferencing cyclic refresh mode flags. This is a mode
- * designed to clean up the background over time in live encoding
- * scenarious. It uses segmentation.
- */
- int cyclic_refresh_mode_enabled;
- int cyclic_refresh_mode_max_mbs_perframe;
- int cyclic_refresh_mode_index;
- int cyclic_refresh_q;
- signed char *cyclic_refresh_map;
-
- // Frame counter for the temporal pattern. Counter is rest when the temporal
- // layers are changed dynamically (run-time change).
- unsigned int temporal_pattern_counter;
-
-#if CONFIG_MULTITHREAD
- /* multithread data */
- int * mt_current_mb_col;
- int mt_sync_range;
- int b_multi_threaded;
- int encoding_thread_count;
- int b_lpf_running;
-
- pthread_t *h_encoding_thread;
- pthread_t h_filter_thread;
-
- MB_ROW_COMP *mb_row_ei;
- ENCODETHREAD_DATA *en_thread_data;
- LPFTHREAD_DATA lpf_thread_data;
-
- /* events */
- sem_t *h_event_start_encoding;
- sem_t h_event_end_encoding;
- sem_t h_event_start_lpf;
- sem_t h_event_end_lpf;
-#endif
-
- TOKENLIST *tplist;
- unsigned int partition_sz[MAX_PARTITIONS];
- unsigned char *partition_d[MAX_PARTITIONS];
- unsigned char *partition_d_end[MAX_PARTITIONS];
-
-
- fractional_mv_step_fp *find_fractional_mv_step;
- vp8_full_search_fn_t full_search_sad;
- vp8_refining_search_fn_t refining_search_sad;
- vp8_diamond_search_fn_t diamond_search_sad;
- vp8_variance_fn_ptr_t fn_ptr[BLOCK_MAX_SEGMENTS];
- uint64_t time_receive_data;
- uint64_t time_compress_data;
- uint64_t time_pick_lpf;
- uint64_t time_encode_mb_row;
-
- int base_skip_false_prob[128];
-
- FRAME_CONTEXT lfc_n; /* last frame entropy */
- FRAME_CONTEXT lfc_a; /* last alt ref entropy */
- FRAME_CONTEXT lfc_g; /* last gold ref entropy */
-
-
- struct twopass_rc
- {
- unsigned int section_intra_rating;
- double section_max_qfactor;
- unsigned int next_iiratio;
- unsigned int this_iiratio;
- FIRSTPASS_STATS total_stats;
- FIRSTPASS_STATS this_frame_stats;
- FIRSTPASS_STATS *stats_in, *stats_in_end, *stats_in_start;
- FIRSTPASS_STATS total_left_stats;
- int first_pass_done;
- int64_t bits_left;
- int64_t clip_bits_total;
- double avg_iiratio;
- double modified_error_total;
- double modified_error_used;
- double modified_error_left;
- double kf_intra_err_min;
- double gf_intra_err_min;
- int frames_to_key;
- int maxq_max_limit;
- int maxq_min_limit;
- int gf_decay_rate;
- int static_scene_max_gf_interval;
- int kf_bits;
- /* Remaining error from uncoded frames in a gf group. */
- int gf_group_error_left;
- /* Projected total bits available for a key frame group of frames */
- int64_t kf_group_bits;
- /* Error score of frames still to be coded in kf group */
- int64_t kf_group_error_left;
- /* Projected Bits available for a group including 1 GF or ARF */
- int64_t gf_group_bits;
- /* Bits for the golden frame or ARF */
- int gf_bits;
- int alt_extra_bits;
- double est_max_qcorrection_factor;
- } twopass;
-
-#if VP8_TEMPORAL_ALT_REF
- YV12_BUFFER_CONFIG alt_ref_buffer;
- YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
- int fixed_divide[512];
-#endif
-
-#if CONFIG_INTERNAL_STATS
- int count;
- double total_y;
- double total_u;
- double total_v;
- double total ;
- double total_sq_error;
- double totalp_y;
- double totalp_u;
- double totalp_v;
- double totalp;
- double total_sq_error2;
- int bytes;
- double summed_quality;
- double summed_weights;
- unsigned int tot_recode_hits;
-
-
- double total_ssimg_y;
- double total_ssimg_u;
- double total_ssimg_v;
- double total_ssimg_all;
-
- int b_calculate_ssimg;
-#endif
- int b_calculate_psnr;
-
- /* Per MB activity measurement */
- unsigned int activity_avg;
- unsigned int * mb_activity_map;
-
- /* Record of which MBs still refer to last golden frame either
- * directly or through 0,0
- */
- unsigned char *gf_active_flags;
- int gf_active_count;
-
- int output_partition;
-
- /* Store last frame's MV info for next frame MV prediction */
- int_mv *lfmv;
- int *lf_ref_frame_sign_bias;
- int *lf_ref_frame;
-
- /* force next frame to intra when kf_auto says so */
- int force_next_frame_intra;
-
- int droppable;
-
-#if CONFIG_TEMPORAL_DENOISING
- VP8_DENOISER denoiser;
-#endif
-
- /* Coding layer state variables */
- unsigned int current_layer;
- LAYER_CONTEXT layer_context[VPX_TS_MAX_LAYERS];
-
- int64_t frames_in_layer[VPX_TS_MAX_LAYERS];
- int64_t bytes_in_layer[VPX_TS_MAX_LAYERS];
- double sum_psnr[VPX_TS_MAX_LAYERS];
- double sum_psnr_p[VPX_TS_MAX_LAYERS];
- double total_error2[VPX_TS_MAX_LAYERS];
- double total_error2_p[VPX_TS_MAX_LAYERS];
- double sum_ssim[VPX_TS_MAX_LAYERS];
- double sum_weights[VPX_TS_MAX_LAYERS];
-
- double total_ssimg_y_in_layer[VPX_TS_MAX_LAYERS];
- double total_ssimg_u_in_layer[VPX_TS_MAX_LAYERS];
- double total_ssimg_v_in_layer[VPX_TS_MAX_LAYERS];
- double total_ssimg_all_in_layer[VPX_TS_MAX_LAYERS];
-
-#if CONFIG_MULTI_RES_ENCODING
- /* Number of MBs per row at lower-resolution level */
- int mr_low_res_mb_cols;
- /* Indicate if lower-res mv info is available */
- unsigned char mr_low_res_mv_avail;
- /* The frame number of each reference frames */
- unsigned int current_ref_frames[MAX_REF_FRAMES];
-#endif
-
- struct rd_costs_struct
- {
- int mvcosts[2][MVvals+1];
- int mvsadcosts[2][MVfpvals+1];
- int mbmode_cost[2][MB_MODE_COUNT];
- int intra_uv_mode_cost[2][MB_MODE_COUNT];
- int bmode_costs[10][10][10];
- int inter_bmode_costs[B_MODE_COUNT];
- int token_costs[BLOCK_TYPES][COEF_BANDS]
- [PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
- } rd_costs;
-} VP8_COMP;
-
-void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest,
- unsigned char *dest_end, unsigned long *size);
-
-void vp8_tokenize_mb(VP8_COMP *, MACROBLOCK *, TOKENEXTRA **);
-
-void vp8_set_speed_features(VP8_COMP *cpi);
-
-#if CONFIG_DEBUG
-#define CHECK_MEM_ERROR(lval,expr) do {\
- lval = (expr); \
- if(!lval) \
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\
- "Failed to allocate "#lval" at %s:%d", \
- __FILE__,__LINE__);\
- } while(0)
-#else
-#define CHECK_MEM_ERROR(lval,expr) do {\
- lval = (expr); \
- if(!lval) \
- vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,\
- "Failed to allocate "#lval);\
- } while(0)
-#endif
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_ONYX_INT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.c
deleted file mode 100644
index 6f09d78..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.c
+++ /dev/null
@@ -1,1299 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <limits.h>
-#include "vpx_config.h"
-#include "onyx_int.h"
-#include "modecosts.h"
-#include "encodeintra.h"
-#include "vp8/common/entropymode.h"
-#include "pickinter.h"
-#include "vp8/common/findnearmv.h"
-#include "encodemb.h"
-#include "vp8/common/reconinter.h"
-#include "vp8/common/reconintra4x4.h"
-#include "vp8/common/variance.h"
-#include "mcomp.h"
-#include "rdopt.h"
-#include "vpx_mem/vpx_mem.h"
-#if CONFIG_TEMPORAL_DENOISING
-#include "denoising.h"
-#endif
-
-extern int VP8_UVSSE(MACROBLOCK *x);
-
-#ifdef SPEEDSTATS
-extern unsigned int cnt_pm;
-#endif
-
-extern const int vp8_ref_frame_order[MAX_MODES];
-extern const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES];
-
-extern int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]);
-
-
-int vp8_skip_fractional_mv_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
- int_mv *bestmv, int_mv *ref_mv,
- int error_per_bit,
- const vp8_variance_fn_ptr_t *vfp,
- int *mvcost[2], int *distortion,
- unsigned int *sse)
-{
- (void) b;
- (void) d;
- (void) ref_mv;
- (void) error_per_bit;
- (void) vfp;
- (void) mvcost;
- (void) distortion;
- (void) sse;
- (void) mb;
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
- return 0;
-}
-
-
-int vp8_get_inter_mbpred_error(MACROBLOCK *mb,
- const vp8_variance_fn_ptr_t *vfp,
- unsigned int *sse,
- int_mv this_mv)
-{
-
- BLOCK *b = &mb->block[0];
- BLOCKD *d = &mb->e_mbd.block[0];
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- int pre_stride = mb->e_mbd.pre.y_stride;
- unsigned char *in_what = mb->e_mbd.pre.y_buffer + d->offset ;
- int in_what_stride = pre_stride;
- int xoffset = this_mv.as_mv.col & 7;
- int yoffset = this_mv.as_mv.row & 7;
-
- in_what += (this_mv.as_mv.row >> 3) * pre_stride + (this_mv.as_mv.col >> 3);
-
- if (xoffset | yoffset)
- {
- return vfp->svf(in_what, in_what_stride, xoffset, yoffset, what, what_stride, sse);
- }
- else
- {
- return vfp->vf(what, what_stride, in_what, in_what_stride, sse);
- }
-
-}
-
-
-unsigned int vp8_get4x4sse_cs_c
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride
-)
-{
- int distortion = 0;
- int r, c;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- int diff = src_ptr[c] - ref_ptr[c];
- distortion += diff * diff;
- }
-
- src_ptr += source_stride;
- ref_ptr += recon_stride;
- }
-
- return distortion;
-}
-
-static int get_prediction_error(BLOCK *be, BLOCKD *b)
-{
- unsigned char *sptr;
- unsigned char *dptr;
- sptr = (*(be->base_src) + be->src);
- dptr = b->predictor;
-
- return vp8_get4x4sse_cs(sptr, be->src_stride, dptr, 16);
-
-}
-
-static int pick_intra4x4block(
- MACROBLOCK *x,
- int ib,
- B_PREDICTION_MODE *best_mode,
- const int *mode_costs,
-
- int *bestrate,
- int *bestdistortion)
-{
-
- BLOCKD *b = &x->e_mbd.block[ib];
- BLOCK *be = &x->block[ib];
- int dst_stride = x->e_mbd.dst.y_stride;
- unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset;
- B_PREDICTION_MODE mode;
- int best_rd = INT_MAX;
- int rate;
- int distortion;
-
- unsigned char *Above = dst - dst_stride;
- unsigned char *yleft = dst - 1;
- unsigned char top_left = Above[-1];
-
- for (mode = B_DC_PRED; mode <= B_HE_PRED; mode++)
- {
- int this_rd;
-
- rate = mode_costs[mode];
-
- vp8_intra4x4_predict(Above, yleft, dst_stride, mode,
- b->predictor, 16, top_left);
- distortion = get_prediction_error(be, b);
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (this_rd < best_rd)
- {
- *bestrate = rate;
- *bestdistortion = distortion;
- best_rd = this_rd;
- *best_mode = mode;
- }
- }
-
- b->bmi.as_mode = *best_mode;
- vp8_encode_intra4x4block(x, ib);
- return best_rd;
-}
-
-
-static int pick_intra4x4mby_modes
-(
- MACROBLOCK *mb,
- int *Rate,
- int *best_dist
-)
-{
- MACROBLOCKD *const xd = &mb->e_mbd;
- int i;
- int cost = mb->mbmode_cost [xd->frame_type] [B_PRED];
- int error;
- int distortion = 0;
- const int *bmode_costs;
-
- intra_prediction_down_copy(xd, xd->dst.y_buffer - xd->dst.y_stride + 16);
-
- bmode_costs = mb->inter_bmode_costs;
-
- for (i = 0; i < 16; i++)
- {
- MODE_INFO *const mic = xd->mode_info_context;
- const int mis = xd->mode_info_stride;
-
- B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
- int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(d);
- d = 0; r = 0; best_mode = 0;
-
- if (mb->e_mbd.frame_type == KEY_FRAME)
- {
- const B_PREDICTION_MODE A = above_block_mode(mic, i, mis);
- const B_PREDICTION_MODE L = left_block_mode(mic, i);
-
- bmode_costs = mb->bmode_costs[A][L];
- }
-
-
- pick_intra4x4block(mb, i, &best_mode, bmode_costs, &r, &d);
-
- cost += r;
- distortion += d;
- mic->bmi[i].as_mode = best_mode;
-
- /* Break out case where we have already exceeded best so far value
- * that was passed in
- */
- if (distortion > *best_dist)
- break;
- }
-
- *Rate = cost;
-
- if (i == 16)
- {
- *best_dist = distortion;
- error = RDCOST(mb->rdmult, mb->rddiv, cost, distortion);
- }
- else
- {
- *best_dist = INT_MAX;
- error = INT_MAX;
- }
-
- return error;
-}
-
-static void pick_intra_mbuv_mode(MACROBLOCK *mb)
-{
-
- MACROBLOCKD *x = &mb->e_mbd;
- unsigned char *uabove_row = x->dst.u_buffer - x->dst.uv_stride;
- unsigned char *vabove_row = x->dst.v_buffer - x->dst.uv_stride;
- unsigned char *usrc_ptr = (mb->block[16].src + *mb->block[16].base_src);
- unsigned char *vsrc_ptr = (mb->block[20].src + *mb->block[20].base_src);
- int uvsrc_stride = mb->block[16].src_stride;
- unsigned char uleft_col[8];
- unsigned char vleft_col[8];
- unsigned char utop_left = uabove_row[-1];
- unsigned char vtop_left = vabove_row[-1];
- int i, j;
- int expected_udc;
- int expected_vdc;
- int shift;
- int Uaverage = 0;
- int Vaverage = 0;
- int diff;
- int pred_error[4] = {0, 0, 0, 0}, best_error = INT_MAX;
- MB_PREDICTION_MODE best_mode = DC_PRED;
-
-
- for (i = 0; i < 8; i++)
- {
- uleft_col[i] = x->dst.u_buffer [i* x->dst.uv_stride -1];
- vleft_col[i] = x->dst.v_buffer [i* x->dst.uv_stride -1];
- }
-
- if (!x->up_available && !x->left_available)
- {
- expected_udc = 128;
- expected_vdc = 128;
- }
- else
- {
- shift = 2;
-
- if (x->up_available)
- {
-
- for (i = 0; i < 8; i++)
- {
- Uaverage += uabove_row[i];
- Vaverage += vabove_row[i];
- }
-
- shift ++;
-
- }
-
- if (x->left_available)
- {
- for (i = 0; i < 8; i++)
- {
- Uaverage += uleft_col[i];
- Vaverage += vleft_col[i];
- }
-
- shift ++;
-
- }
-
- expected_udc = (Uaverage + (1 << (shift - 1))) >> shift;
- expected_vdc = (Vaverage + (1 << (shift - 1))) >> shift;
- }
-
-
- for (i = 0; i < 8; i++)
- {
- for (j = 0; j < 8; j++)
- {
-
- int predu = uleft_col[i] + uabove_row[j] - utop_left;
- int predv = vleft_col[i] + vabove_row[j] - vtop_left;
- int u_p, v_p;
-
- u_p = usrc_ptr[j];
- v_p = vsrc_ptr[j];
-
- if (predu < 0)
- predu = 0;
-
- if (predu > 255)
- predu = 255;
-
- if (predv < 0)
- predv = 0;
-
- if (predv > 255)
- predv = 255;
-
-
- diff = u_p - expected_udc;
- pred_error[DC_PRED] += diff * diff;
- diff = v_p - expected_vdc;
- pred_error[DC_PRED] += diff * diff;
-
-
- diff = u_p - uabove_row[j];
- pred_error[V_PRED] += diff * diff;
- diff = v_p - vabove_row[j];
- pred_error[V_PRED] += diff * diff;
-
-
- diff = u_p - uleft_col[i];
- pred_error[H_PRED] += diff * diff;
- diff = v_p - vleft_col[i];
- pred_error[H_PRED] += diff * diff;
-
-
- diff = u_p - predu;
- pred_error[TM_PRED] += diff * diff;
- diff = v_p - predv;
- pred_error[TM_PRED] += diff * diff;
-
-
- }
-
- usrc_ptr += uvsrc_stride;
- vsrc_ptr += uvsrc_stride;
-
- if (i == 3)
- {
- usrc_ptr = (mb->block[18].src + *mb->block[18].base_src);
- vsrc_ptr = (mb->block[22].src + *mb->block[22].base_src);
- }
-
-
-
- }
-
-
- for (i = DC_PRED; i <= TM_PRED; i++)
- {
- if (best_error > pred_error[i])
- {
- best_error = pred_error[i];
- best_mode = (MB_PREDICTION_MODE)i;
- }
- }
-
-
- mb->e_mbd.mode_info_context->mbmi.uv_mode = best_mode;
-
-}
-
-static void update_mvcount(MACROBLOCK *x, int_mv *best_ref_mv)
-{
- MACROBLOCKD *xd = &x->e_mbd;
- /* Split MV modes currently not supported when RD is nopt enabled,
- * therefore, only need to modify MVcount in NEWMV mode. */
- if (xd->mode_info_context->mbmi.mode == NEWMV)
- {
- x->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row -
- best_ref_mv->as_mv.row) >> 1)]++;
- x->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col -
- best_ref_mv->as_mv.col) >> 1)]++;
- }
-}
-
-
-#if CONFIG_MULTI_RES_ENCODING
-static
-void get_lower_res_motion_info(VP8_COMP *cpi, MACROBLOCKD *xd, int *dissim,
- int *parent_ref_frame,
- MB_PREDICTION_MODE *parent_mode,
- int_mv *parent_ref_mv, int mb_row, int mb_col)
-{
- LOWER_RES_MB_INFO* store_mode_info
- = ((LOWER_RES_FRAME_INFO*)cpi->oxcf.mr_low_res_mode_info)->mb_info;
- unsigned int parent_mb_index;
-
- /* Consider different down_sampling_factor. */
- {
- /* TODO: Removed the loop that supports special down_sampling_factor
- * such as 2, 4, 8. Will revisit it if needed.
- * Should also try using a look-up table to see if it helps
- * performance. */
- int parent_mb_row, parent_mb_col;
-
- parent_mb_row = mb_row*cpi->oxcf.mr_down_sampling_factor.den
- /cpi->oxcf.mr_down_sampling_factor.num;
- parent_mb_col = mb_col*cpi->oxcf.mr_down_sampling_factor.den
- /cpi->oxcf.mr_down_sampling_factor.num;
- parent_mb_index = parent_mb_row*cpi->mr_low_res_mb_cols + parent_mb_col;
- }
-
- /* Read lower-resolution mode & motion result from memory.*/
- *parent_ref_frame = store_mode_info[parent_mb_index].ref_frame;
- *parent_mode = store_mode_info[parent_mb_index].mode;
- *dissim = store_mode_info[parent_mb_index].dissim;
-
- /* For highest-resolution encoder, adjust dissim value. Lower its quality
- * for good performance. */
- if (cpi->oxcf.mr_encoder_id == (cpi->oxcf.mr_total_resolutions - 1))
- *dissim>>=1;
-
- if(*parent_ref_frame != INTRA_FRAME)
- {
- /* Consider different down_sampling_factor.
- * The result can be rounded to be more precise, but it takes more time.
- */
- (*parent_ref_mv).as_mv.row = store_mode_info[parent_mb_index].mv.as_mv.row
- *cpi->oxcf.mr_down_sampling_factor.num
- /cpi->oxcf.mr_down_sampling_factor.den;
- (*parent_ref_mv).as_mv.col = store_mode_info[parent_mb_index].mv.as_mv.col
- *cpi->oxcf.mr_down_sampling_factor.num
- /cpi->oxcf.mr_down_sampling_factor.den;
-
- vp8_clamp_mv2(parent_ref_mv, xd);
- }
-}
-#endif
-
-static void check_for_encode_breakout(unsigned int sse, MACROBLOCK* x)
-{
- MACROBLOCKD *xd = &x->e_mbd;
-
- unsigned int threshold = (xd->block[0].dequant[1]
- * xd->block[0].dequant[1] >>4);
-
- if(threshold < x->encode_breakout)
- threshold = x->encode_breakout;
-
- if (sse < threshold )
- {
- /* Check u and v to make sure skip is ok */
- unsigned int sse2 = 0;
-
- sse2 = VP8_UVSSE(x);
-
- if (sse2 * 2 < x->encode_breakout)
- x->skip = 1;
- else
- x->skip = 0;
- }
-}
-
-static int evaluate_inter_mode(unsigned int* sse, int rate2, int* distortion2,
- VP8_COMP *cpi, MACROBLOCK *x, int rd_adj)
-{
- MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode;
- int_mv mv = x->e_mbd.mode_info_context->mbmi.mv;
- int this_rd;
- /* Exit early and don't compute the distortion if this macroblock
- * is marked inactive. */
- if (cpi->active_map_enabled && x->active_ptr[0] == 0)
- {
- *sse = 0;
- *distortion2 = 0;
- x->skip = 1;
- return INT_MAX;
- }
-
- if((this_mode != NEWMV) ||
- !(cpi->sf.half_pixel_search) || cpi->common.full_pixel==1)
- *distortion2 = vp8_get_inter_mbpred_error(x,
- &cpi->fn_ptr[BLOCK_16X16],
- sse, mv);
-
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, *distortion2);
-
- /* Adjust rd to bias to ZEROMV */
- if(this_mode == ZEROMV)
- {
- /* Bias to ZEROMV on LAST_FRAME reference when it is available. */
- if ((cpi->ref_frame_flags & VP8_LAST_FRAME &
- cpi->common.refresh_last_frame)
- && x->e_mbd.mode_info_context->mbmi.ref_frame != LAST_FRAME)
- rd_adj = 100;
-
- // rd_adj <= 100
- this_rd = ((int64_t)this_rd) * rd_adj / 100;
- }
-
- check_for_encode_breakout(*sse, x);
- return this_rd;
-}
-
-static void calculate_zeromv_rd_adjustment(VP8_COMP *cpi, MACROBLOCK *x,
- int *rd_adjustment)
-{
- MODE_INFO *mic = x->e_mbd.mode_info_context;
- int_mv mv_l, mv_a, mv_al;
- int local_motion_check = 0;
-
- if (cpi->lf_zeromv_pct > 40)
- {
- /* left mb */
- mic -= 1;
- mv_l = mic->mbmi.mv;
-
- if (mic->mbmi.ref_frame != INTRA_FRAME)
- if( abs(mv_l.as_mv.row) < 8 && abs(mv_l.as_mv.col) < 8)
- local_motion_check++;
-
- /* above-left mb */
- mic -= x->e_mbd.mode_info_stride;
- mv_al = mic->mbmi.mv;
-
- if (mic->mbmi.ref_frame != INTRA_FRAME)
- if( abs(mv_al.as_mv.row) < 8 && abs(mv_al.as_mv.col) < 8)
- local_motion_check++;
-
- /* above mb */
- mic += 1;
- mv_a = mic->mbmi.mv;
-
- if (mic->mbmi.ref_frame != INTRA_FRAME)
- if( abs(mv_a.as_mv.row) < 8 && abs(mv_a.as_mv.col) < 8)
- local_motion_check++;
-
- if (((!x->e_mbd.mb_to_top_edge || !x->e_mbd.mb_to_left_edge)
- && local_motion_check >0) || local_motion_check >2 )
- *rd_adjustment = 80;
- else if (local_motion_check > 0)
- *rd_adjustment = 90;
- }
-}
-
-void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
- int recon_uvoffset, int *returnrate,
- int *returndistortion, int *returnintra, int mb_row,
- int mb_col)
-{
- BLOCK *b = &x->block[0];
- BLOCKD *d = &x->e_mbd.block[0];
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO best_mbmode;
-
- int_mv best_ref_mv_sb[2];
- int_mv mode_mv_sb[2][MB_MODE_COUNT];
- int_mv best_ref_mv;
- int_mv *mode_mv;
- MB_PREDICTION_MODE this_mode;
- int num00;
- int mdcounts[4];
- int best_rd = INT_MAX;
- int rd_adjustment = 100;
- int best_intra_rd = INT_MAX;
- int mode_index;
- int rate;
- int rate2;
- int distortion2;
- int bestsme = INT_MAX;
- int best_mode_index = 0;
- unsigned int sse = INT_MAX, best_rd_sse = INT_MAX;
-#if CONFIG_TEMPORAL_DENOISING
- unsigned int zero_mv_sse = INT_MAX, best_sse = INT_MAX;
-#endif
-
- int sf_improved_mv_pred = cpi->sf.improved_mv_pred;
- int_mv mvp;
-
- int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- int saddone=0;
- /* search range got from mv_pred(). It uses step_param levels. (0-7) */
- int sr=0;
-
- unsigned char *plane[4][3];
- int ref_frame_map[4];
- int sign_bias = 0;
-
- (void)mb_row;
- (void)mb_col;
-#if CONFIG_MULTI_RES_ENCODING
- int dissim = INT_MAX;
- int parent_ref_frame = 0;
- int parent_ref_valid = cpi->oxcf.mr_encoder_id && cpi->mr_low_res_mv_avail;
- int_mv parent_ref_mv;
- MB_PREDICTION_MODE parent_mode = 0;
- if (parent_ref_valid)
- {
- int parent_ref_flag;
-
- get_lower_res_motion_info(cpi, xd, &dissim, &parent_ref_frame,
- &parent_mode, &parent_ref_mv, mb_row, mb_col);
-
- /* TODO(jkoleszar): The references available (ref_frame_flags) to the
- * lower res encoder should match those available to this encoder, but
- * there seems to be a situation where this mismatch can happen in the
- * case of frame dropping and temporal layers. For example,
- * GOLD being disallowed in ref_frame_flags, but being returned as
- * parent_ref_frame.
- *
- * In this event, take the conservative approach of disabling the
- * lower res info for this MB.
- */
- parent_ref_flag = 0;
- if (parent_ref_frame == LAST_FRAME)
- parent_ref_flag = (cpi->ref_frame_flags & VP8_LAST_FRAME);
- else if (parent_ref_frame == GOLDEN_FRAME)
- parent_ref_flag = (cpi->ref_frame_flags & VP8_GOLD_FRAME);
- else if (parent_ref_frame == ALTREF_FRAME)
- parent_ref_flag = (cpi->ref_frame_flags & VP8_ALTR_FRAME);
-
- //assert(!parent_ref_frame || parent_ref_flag);
- if (parent_ref_frame && !parent_ref_flag)
- parent_ref_valid = 0;
- }
-#endif
-
- mode_mv = mode_mv_sb[sign_bias];
- best_ref_mv.as_int = 0;
- vpx_memset(mode_mv_sb, 0, sizeof(mode_mv_sb));
- vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
-
- /* Setup search priorities */
-#if CONFIG_MULTI_RES_ENCODING
- if (parent_ref_valid && parent_ref_frame && dissim < 8)
- {
- ref_frame_map[0] = -1;
- ref_frame_map[1] = parent_ref_frame;
- ref_frame_map[2] = -1;
- ref_frame_map[3] = -1;
- } else
-#endif
- get_reference_search_order(cpi, ref_frame_map);
-
- /* Check to see if there is at least 1 valid reference frame that we need
- * to calculate near_mvs.
- */
- if (ref_frame_map[1] > 0)
- {
- sign_bias = vp8_find_near_mvs_bias(&x->e_mbd,
- x->e_mbd.mode_info_context,
- mode_mv_sb,
- best_ref_mv_sb,
- mdcounts,
- ref_frame_map[1],
- cpi->common.ref_frame_sign_bias);
-
- mode_mv = mode_mv_sb[sign_bias];
- best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
- }
-
- get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
-
- /* Count of the number of MBs tested so far this frame */
- x->mbs_tested_so_far++;
-
- *returnintra = INT_MAX;
- x->skip = 0;
-
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
-
- /* If the frame has big static background and current MB is in low
- * motion area, its mode decision is biased to ZEROMV mode.
- */
- calculate_zeromv_rd_adjustment(cpi, x, &rd_adjustment);
-
- /* if we encode a new mv this is important
- * find the best new motion vector
- */
- for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
- {
- int frame_cost;
- int this_rd = INT_MAX;
- int this_ref_frame = ref_frame_map[vp8_ref_frame_order[mode_index]];
-
- if (best_rd <= x->rd_threshes[mode_index])
- continue;
-
- if (this_ref_frame < 0)
- continue;
-
- x->e_mbd.mode_info_context->mbmi.ref_frame = this_ref_frame;
-
- /* everything but intra */
- if (x->e_mbd.mode_info_context->mbmi.ref_frame)
- {
- x->e_mbd.pre.y_buffer = plane[this_ref_frame][0];
- x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
- x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
-
- if (sign_bias != cpi->common.ref_frame_sign_bias[this_ref_frame])
- {
- sign_bias = cpi->common.ref_frame_sign_bias[this_ref_frame];
- mode_mv = mode_mv_sb[sign_bias];
- best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
- }
-
-#if CONFIG_MULTI_RES_ENCODING
- if (parent_ref_valid)
- {
- if (vp8_mode_order[mode_index] == NEARESTMV &&
- mode_mv[NEARESTMV].as_int ==0)
- continue;
- if (vp8_mode_order[mode_index] == NEARMV &&
- mode_mv[NEARMV].as_int ==0)
- continue;
-
- if (vp8_mode_order[mode_index] == NEWMV && parent_mode == ZEROMV
- && best_ref_mv.as_int==0)
- continue;
- else if(vp8_mode_order[mode_index] == NEWMV && dissim==0
- && best_ref_mv.as_int==parent_ref_mv.as_int)
- continue;
- }
-#endif
- }
-
- /* Check to see if the testing frequency for this mode is at its max
- * If so then prevent it from being tested and increase the threshold
- * for its testing */
- if (x->mode_test_hit_counts[mode_index] &&
- (cpi->mode_check_freq[mode_index] > 1))
- {
- if (x->mbs_tested_so_far <= (cpi->mode_check_freq[mode_index] *
- x->mode_test_hit_counts[mode_index]))
- {
- /* Increase the threshold for coding this mode to make it less
- * likely to be chosen */
- x->rd_thresh_mult[mode_index] += 4;
-
- if (x->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
- x->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
-
- x->rd_threshes[mode_index] =
- (cpi->rd_baseline_thresh[mode_index] >> 7) *
- x->rd_thresh_mult[mode_index];
- continue;
- }
- }
-
- /* We have now reached the point where we are going to test the current
- * mode so increment the counter for the number of times it has been
- * tested */
- x->mode_test_hit_counts[mode_index] ++;
-
- rate2 = 0;
- distortion2 = 0;
-
- this_mode = vp8_mode_order[mode_index];
-
- x->e_mbd.mode_info_context->mbmi.mode = this_mode;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
-
- /* Work out the cost assosciated with selecting the reference frame */
- frame_cost =
- x->ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
- rate2 += frame_cost;
-
- /* Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
- * unless ARNR filtering is enabled in which case we want
- * an unfiltered alternative */
- if (cpi->is_src_frame_alt_ref && (cpi->oxcf.arnr_max_frames == 0))
- {
- if (this_mode != ZEROMV ||
- x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME)
- continue;
- }
-
- switch (this_mode)
- {
- case B_PRED:
- /* Pass best so far to pick_intra4x4mby_modes to use as breakout */
- distortion2 = best_rd_sse;
- pick_intra4x4mby_modes(x, &rate, &distortion2);
-
- if (distortion2 == INT_MAX)
- {
- this_rd = INT_MAX;
- }
- else
- {
- rate2 += rate;
- distortion2 = vp8_variance16x16(
- *(b->base_src), b->src_stride,
- x->e_mbd.predictor, 16, &sse);
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
-
- if (this_rd < best_intra_rd)
- {
- best_intra_rd = this_rd;
- *returnintra = distortion2;
- }
- }
-
- break;
-
- case SPLITMV:
-
- /* Split MV modes currently not supported when RD is not enabled. */
- break;
-
- case DC_PRED:
- case V_PRED:
- case H_PRED:
- case TM_PRED:
- vp8_build_intra_predictors_mby_s(xd,
- xd->dst.y_buffer - xd->dst.y_stride,
- xd->dst.y_buffer - 1,
- xd->dst.y_stride,
- xd->predictor,
- 16);
- distortion2 = vp8_variance16x16
- (*(b->base_src), b->src_stride,
- x->e_mbd.predictor, 16, &sse);
- rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
-
- if (this_rd < best_intra_rd)
- {
- best_intra_rd = this_rd;
- *returnintra = distortion2;
- }
- break;
-
- case NEWMV:
- {
- int thissme;
- int step_param;
- int further_steps;
- int n = 0;
- int sadpb = x->sadperbit16;
- int_mv mvp_full;
-
- int col_min = ((best_ref_mv.as_mv.col+7)>>3) - MAX_FULL_PEL_VAL;
- int row_min = ((best_ref_mv.as_mv.row+7)>>3) - MAX_FULL_PEL_VAL;
- int col_max = (best_ref_mv.as_mv.col>>3)
- + MAX_FULL_PEL_VAL;
- int row_max = (best_ref_mv.as_mv.row>>3)
- + MAX_FULL_PEL_VAL;
-
- int tmp_col_min = x->mv_col_min;
- int tmp_col_max = x->mv_col_max;
- int tmp_row_min = x->mv_row_min;
- int tmp_row_max = x->mv_row_max;
-
- int speed_adjust = (cpi->Speed > 5) ? ((cpi->Speed >= 8)? 3 : 2) : 1;
-
- /* Further step/diamond searches as necessary */
- step_param = cpi->sf.first_step + speed_adjust;
-
-#if CONFIG_MULTI_RES_ENCODING
- /* If lower-res drops this frame, then higher-res encoder does
- motion search without any previous knowledge. Also, since
- last frame motion info is not stored, then we can not
- use improved_mv_pred. */
- if (cpi->oxcf.mr_encoder_id && !parent_ref_valid)
- sf_improved_mv_pred = 0;
-
- if (parent_ref_valid && parent_ref_frame)
- {
- /* Use parent MV as predictor. Adjust search range
- * accordingly.
- */
- mvp.as_int = parent_ref_mv.as_int;
- mvp_full.as_mv.col = parent_ref_mv.as_mv.col>>3;
- mvp_full.as_mv.row = parent_ref_mv.as_mv.row>>3;
-
- if(dissim <=32) step_param += 3;
- else if(dissim <=128) step_param += 2;
- else step_param += 1;
- }else
-#endif
- {
- if(sf_improved_mv_pred)
- {
- if(!saddone)
- {
- vp8_cal_sad(cpi,xd,x, recon_yoffset ,&near_sadidx[0] );
- saddone = 1;
- }
-
- vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context,
- &mvp,x->e_mbd.mode_info_context->mbmi.ref_frame,
- cpi->common.ref_frame_sign_bias, &sr,
- &near_sadidx[0]);
-
- sr += speed_adjust;
- /* adjust search range according to sr from mv prediction */
- if(sr > step_param)
- step_param = sr;
-
- mvp_full.as_mv.col = mvp.as_mv.col>>3;
- mvp_full.as_mv.row = mvp.as_mv.row>>3;
- }else
- {
- mvp.as_int = best_ref_mv.as_int;
- mvp_full.as_mv.col = best_ref_mv.as_mv.col>>3;
- mvp_full.as_mv.row = best_ref_mv.as_mv.row>>3;
- }
- }
-
-#if CONFIG_MULTI_RES_ENCODING
- if (parent_ref_valid && parent_ref_frame && dissim <= 2 &&
- MAX(abs(best_ref_mv.as_mv.row - parent_ref_mv.as_mv.row),
- abs(best_ref_mv.as_mv.col - parent_ref_mv.as_mv.col)) <= 4)
- {
- d->bmi.mv.as_int = mvp_full.as_int;
- mode_mv[NEWMV].as_int = mvp_full.as_int;
-
- cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, &best_ref_mv,
- x->errorperbit,
- &cpi->fn_ptr[BLOCK_16X16],
- cpi->mb.mvcost,
- &distortion2,&sse);
- }else
-#endif
- {
- /* Get intersection of UMV window and valid MV window to
- * reduce # of checks in diamond search. */
- if (x->mv_col_min < col_min )
- x->mv_col_min = col_min;
- if (x->mv_col_max > col_max )
- x->mv_col_max = col_max;
- if (x->mv_row_min < row_min )
- x->mv_row_min = row_min;
- if (x->mv_row_max > row_max )
- x->mv_row_max = row_max;
-
- further_steps = (cpi->Speed >= 8)?
- 0: (cpi->sf.max_step_search_steps - 1 - step_param);
-
- if (cpi->sf.search_method == HEX)
- {
-#if CONFIG_MULTI_RES_ENCODING
- /* TODO: In higher-res pick_inter_mode, step_param is used to
- * modify hex search range. Here, set step_param to 0 not to
- * change the behavior in lowest-resolution encoder.
- * Will improve it later.
- */
- /* Set step_param to 0 to ensure large-range motion search
- when encoder drops this frame at lower-resolution.
- */
- if (!parent_ref_valid)
- step_param = 0;
-#endif
- bestsme = vp8_hex_search(x, b, d, &mvp_full, &d->bmi.mv,
- step_param, sadpb,
- &cpi->fn_ptr[BLOCK_16X16],
- x->mvsadcost, x->mvcost, &best_ref_mv);
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
- }
- else
- {
- bestsme = cpi->diamond_search_sad(x, b, d, &mvp_full,
- &d->bmi.mv, step_param, sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16],
- x->mvcost, &best_ref_mv);
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
-
- /* Further step/diamond searches as necessary */
- n = num00;
- num00 = 0;
-
- while (n < further_steps)
- {
- n++;
-
- if (num00)
- num00--;
- else
- {
- thissme =
- cpi->diamond_search_sad(x, b, d, &mvp_full,
- &d->bmi.mv,
- step_param + n,
- sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16],
- x->mvcost, &best_ref_mv);
- if (thissme < bestsme)
- {
- bestsme = thissme;
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
- }
- else
- {
- d->bmi.mv.as_int = mode_mv[NEWMV].as_int;
- }
- }
- }
- }
-
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
-
- if (bestsme < INT_MAX)
- cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv,
- &best_ref_mv, x->errorperbit,
- &cpi->fn_ptr[BLOCK_16X16],
- cpi->mb.mvcost,
- &distortion2,&sse);
- }
-
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
-
- /* mv cost; */
- rate2 += vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv,
- cpi->mb.mvcost, 128);
- }
-
- case NEARESTMV:
- case NEARMV:
-
- if (mode_mv[this_mode].as_int == 0)
- continue;
-
- case ZEROMV:
-
- /* Trap vectors that reach beyond the UMV borders
- * Note that ALL New MV, Nearest MV Near MV and Zero MV code drops
- * through to this point because of the lack of break statements
- * in the previous two cases.
- */
- if (((mode_mv[this_mode].as_mv.row >> 3) < x->mv_row_min) ||
- ((mode_mv[this_mode].as_mv.row >> 3) > x->mv_row_max) ||
- ((mode_mv[this_mode].as_mv.col >> 3) < x->mv_col_min) ||
- ((mode_mv[this_mode].as_mv.col >> 3) > x->mv_col_max))
- continue;
-
- rate2 += vp8_cost_mv_ref(this_mode, mdcounts);
- x->e_mbd.mode_info_context->mbmi.mv.as_int =
- mode_mv[this_mode].as_int;
- this_rd = evaluate_inter_mode(&sse, rate2, &distortion2, cpi, x,
- rd_adjustment);
-
- break;
- default:
- break;
- }
-
-#if CONFIG_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity)
- {
-
- /* Store for later use by denoiser. */
- if (this_mode == ZEROMV && sse < zero_mv_sse )
- {
- zero_mv_sse = sse;
- x->best_zeromv_reference_frame =
- x->e_mbd.mode_info_context->mbmi.ref_frame;
- }
-
- /* Store the best NEWMV in x for later use in the denoiser. */
- if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV &&
- sse < best_sse)
- {
- best_sse = sse;
- x->best_sse_inter_mode = NEWMV;
- x->best_sse_mv = x->e_mbd.mode_info_context->mbmi.mv;
- x->need_to_clamp_best_mvs =
- x->e_mbd.mode_info_context->mbmi.need_to_clamp_mvs;
- x->best_reference_frame =
- x->e_mbd.mode_info_context->mbmi.ref_frame;
- }
- }
-#endif
-
- if (this_rd < best_rd || x->skip)
- {
- /* Note index of best mode */
- best_mode_index = mode_index;
-
- *returnrate = rate2;
- *returndistortion = distortion2;
- best_rd_sse = sse;
- best_rd = this_rd;
- vpx_memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi,
- sizeof(MB_MODE_INFO));
-
- /* Testing this mode gave rise to an improvement in best error
- * score. Lower threshold a bit for next time
- */
- x->rd_thresh_mult[mode_index] =
- (x->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ?
- x->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT;
- x->rd_threshes[mode_index] =
- (cpi->rd_baseline_thresh[mode_index] >> 7) *
- x->rd_thresh_mult[mode_index];
- }
-
- /* If the mode did not help improve the best error case then raise the
- * threshold for testing that mode next time around.
- */
- else
- {
- x->rd_thresh_mult[mode_index] += 4;
-
- if (x->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
- x->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
-
- x->rd_threshes[mode_index] =
- (cpi->rd_baseline_thresh[mode_index] >> 7) *
- x->rd_thresh_mult[mode_index];
- }
-
- if (x->skip)
- break;
- }
-
- /* Reduce the activation RD thresholds for the best choice mode */
- if ((cpi->rd_baseline_thresh[best_mode_index] > 0) && (cpi->rd_baseline_thresh[best_mode_index] < (INT_MAX >> 2)))
- {
- int best_adjustment = (x->rd_thresh_mult[best_mode_index] >> 3);
-
- x->rd_thresh_mult[best_mode_index] =
- (x->rd_thresh_mult[best_mode_index]
- >= (MIN_THRESHMULT + best_adjustment)) ?
- x->rd_thresh_mult[best_mode_index] - best_adjustment :
- MIN_THRESHMULT;
- x->rd_threshes[best_mode_index] =
- (cpi->rd_baseline_thresh[best_mode_index] >> 7) *
- x->rd_thresh_mult[best_mode_index];
- }
-
-
- {
- int this_rdbin = (*returndistortion >> 7);
-
- if (this_rdbin >= 1024)
- {
- this_rdbin = 1023;
- }
-
- x->error_bins[this_rdbin] ++;
- }
-
-#if CONFIG_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity)
- {
- if (x->best_sse_inter_mode == DC_PRED)
- {
- /* No best MV found. */
- x->best_sse_inter_mode = best_mbmode.mode;
- x->best_sse_mv = best_mbmode.mv;
- x->need_to_clamp_best_mvs = best_mbmode.need_to_clamp_mvs;
- x->best_reference_frame = best_mbmode.ref_frame;
- best_sse = best_rd_sse;
- }
- vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse,
- recon_yoffset, recon_uvoffset);
-
-
- /* Reevaluate ZEROMV after denoising. */
- if (best_mbmode.ref_frame == INTRA_FRAME &&
- x->best_zeromv_reference_frame != INTRA_FRAME)
- {
- int this_rd = 0;
- int this_ref_frame = x->best_zeromv_reference_frame;
- rate2 = x->ref_frame_cost[this_ref_frame] +
- vp8_cost_mv_ref(ZEROMV, mdcounts);
- distortion2 = 0;
-
- /* set up the proper prediction buffers for the frame */
- x->e_mbd.mode_info_context->mbmi.ref_frame = this_ref_frame;
- x->e_mbd.pre.y_buffer = plane[this_ref_frame][0];
- x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
- x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
-
- x->e_mbd.mode_info_context->mbmi.mode = ZEROMV;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
- x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
- this_rd = evaluate_inter_mode(&sse, rate2, &distortion2, cpi, x,
- rd_adjustment);
-
- if (this_rd < best_rd)
- {
- vpx_memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi,
- sizeof(MB_MODE_INFO));
- }
- }
-
- }
-#endif
-
- if (cpi->is_src_frame_alt_ref &&
- (best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME))
- {
- x->e_mbd.mode_info_context->mbmi.mode = ZEROMV;
- x->e_mbd.mode_info_context->mbmi.ref_frame = ALTREF_FRAME;
- x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
- x->e_mbd.mode_info_context->mbmi.mb_skip_coeff =
- (cpi->common.mb_no_coeff_skip);
- x->e_mbd.mode_info_context->mbmi.partitioning = 0;
-
- return;
- }
-
- /* set to the best mb mode, this copy can be skip if x->skip since it
- * already has the right content */
- if (!x->skip)
- vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode,
- sizeof(MB_MODE_INFO));
-
- if (best_mbmode.mode <= B_PRED)
- {
- /* set mode_info_context->mbmi.uv_mode */
- pick_intra_mbuv_mode(x);
- }
-
- if (sign_bias
- != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame])
- best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int;
-
- update_mvcount(x, &best_ref_mv);
-}
-
-
-void vp8_pick_intra_mode(MACROBLOCK *x, int *rate_)
-{
- int error4x4, error16x16 = INT_MAX;
- int rate, best_rate = 0, distortion, best_sse = 0;
- MB_PREDICTION_MODE mode, best_mode = DC_PRED;
- int this_rd;
- unsigned int sse;
- BLOCK *b = &x->block[0];
- MACROBLOCKD *xd = &x->e_mbd;
-
- xd->mode_info_context->mbmi.ref_frame = INTRA_FRAME;
-
- pick_intra_mbuv_mode(x);
-
- for (mode = DC_PRED; mode <= TM_PRED; mode ++)
- {
- xd->mode_info_context->mbmi.mode = mode;
- vp8_build_intra_predictors_mby_s(xd,
- xd->dst.y_buffer - xd->dst.y_stride,
- xd->dst.y_buffer - 1,
- xd->dst.y_stride,
- xd->predictor,
- 16);
- distortion = vp8_variance16x16
- (*(b->base_src), b->src_stride, xd->predictor, 16, &sse);
- rate = x->mbmode_cost[xd->frame_type][mode];
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (error16x16 > this_rd)
- {
- error16x16 = this_rd;
- best_mode = mode;
- best_sse = sse;
- best_rate = rate;
- }
- }
- xd->mode_info_context->mbmi.mode = best_mode;
-
- error4x4 = pick_intra4x4mby_modes(x, &rate,
- &best_sse);
- if (error4x4 < error16x16)
- {
- xd->mode_info_context->mbmi.mode = B_PRED;
- best_rate = rate;
- }
-
- *rate_ = best_rate;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.h
deleted file mode 100644
index cf3b1f8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/pickinter.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_PICKINTER_H_
-#define VP8_ENCODER_PICKINTER_H_
-#include "vpx_config.h"
-#include "vp8/common/onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
- int recon_uvoffset, int *returnrate,
- int *returndistortion, int *returnintra,
- int mb_row, int mb_col);
-extern void vp8_pick_intra_mode(MACROBLOCK *x, int *rate);
-
-extern int vp8_get_inter_mbpred_error(MACROBLOCK *mb,
- const vp8_variance_fn_ptr_t *vfp,
- unsigned int *sse,
- int_mv this_mv);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_PICKINTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/picklpf.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/picklpf.c
deleted file mode 100644
index 250d04c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/picklpf.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "./vpx_scale_rtcd.h"
-#include "vp8/common/onyxc_int.h"
-#include "onyx_int.h"
-#include "quantize.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_scale/vpx_scale.h"
-#include "vp8/common/alloccommon.h"
-#include "vp8/common/loopfilter.h"
-#if ARCH_ARM
-#include "vpx_ports/arm.h"
-#endif
-
-extern int vp8_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest);
-
-void vp8_yv12_copy_partial_frame_c(YV12_BUFFER_CONFIG *src_ybc,
- YV12_BUFFER_CONFIG *dst_ybc)
-{
- unsigned char *src_y, *dst_y;
- int yheight;
- int ystride;
- int yoffset;
- int linestocopy;
-
- yheight = src_ybc->y_height;
- ystride = src_ybc->y_stride;
-
- /* number of MB rows to use in partial filtering */
- linestocopy = (yheight >> 4) / PARTIAL_FRAME_FRACTION;
- linestocopy = linestocopy ? linestocopy << 4 : 16; /* 16 lines per MB */
-
- /* Copy extra 4 so that full filter context is available if filtering done
- * on the copied partial frame and not original. Partial filter does mb
- * filtering for top row also, which can modify3 pixels above.
- */
- linestocopy += 4;
- /* partial image starts at ~middle of frame (macroblock border)*/
- yoffset = ystride * (((yheight >> 5) * 16) - 4);
- src_y = src_ybc->y_buffer + yoffset;
- dst_y = dst_ybc->y_buffer + yoffset;
-
- vpx_memcpy(dst_y, src_y, ystride * linestocopy);
-}
-
-static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *dest)
-{
- int i, j;
- int Total = 0;
- int srcoffset, dstoffset;
- unsigned char *src = source->y_buffer;
- unsigned char *dst = dest->y_buffer;
-
- int linestocopy;
-
- /* number of MB rows to use in partial filtering */
- linestocopy = (source->y_height >> 4) / PARTIAL_FRAME_FRACTION;
- linestocopy = linestocopy ? linestocopy << 4 : 16; /* 16 lines per MB */
-
-
- /* partial image starts at ~middle of frame (macroblock border)*/
- srcoffset = source->y_stride * ((dest->y_height >> 5) * 16);
- dstoffset = dest->y_stride * ((dest->y_height >> 5) * 16);
-
- src += srcoffset;
- dst += dstoffset;
-
- /* Loop through the Y plane raw and reconstruction data summing
- * (square differences)
- */
- for (i = 0; i < linestocopy; i += 16)
- {
- for (j = 0; j < source->y_width; j += 16)
- {
- unsigned int sse;
- Total += vp8_mse16x16(src + j, source->y_stride,
- dst + j, dest->y_stride,
- &sse);
- }
-
- src += 16 * source->y_stride;
- dst += 16 * dest->y_stride;
- }
-
- return Total;
-}
-
-/* Enforce a minimum filter level based upon baseline Q */
-static int get_min_filter_level(VP8_COMP *cpi, int base_qindex)
-{
- int min_filter_level;
-
- if (cpi->source_alt_ref_active && cpi->common.refresh_golden_frame &&
- !cpi->common.refresh_alt_ref_frame)
- min_filter_level = 0;
- else
- {
- if (base_qindex <= 6)
- min_filter_level = 0;
- else if (base_qindex <= 16)
- min_filter_level = 1;
- else
- min_filter_level = (base_qindex / 8);
- }
-
- return min_filter_level;
-}
-
-/* Enforce a maximum filter level based upon baseline Q */
-static int get_max_filter_level(VP8_COMP *cpi, int base_qindex)
-{
- /* PGW August 2006: Highest filter values almost always a bad idea */
-
- /* jbb chg: 20100118 - not so any more with this overquant stuff allow
- * high values with lots of intra coming in.
- */
- int max_filter_level = MAX_LOOP_FILTER;
- (void)base_qindex;
-
- if (cpi->twopass.section_intra_rating > 8)
- max_filter_level = MAX_LOOP_FILTER * 3 / 4;
-
- return max_filter_level;
-}
-
-void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- int best_err = 0;
- int filt_err = 0;
- int min_filter_level = get_min_filter_level(cpi, cm->base_qindex);
- int max_filter_level = get_max_filter_level(cpi, cm->base_qindex);
- int filt_val;
- int best_filt_val = cm->filter_level;
- YV12_BUFFER_CONFIG * saved_frame = cm->frame_to_show;
-
- /* Replace unfiltered frame buffer with a new one */
- cm->frame_to_show = &cpi->pick_lf_lvl_frame;
-
- if (cm->frame_type == KEY_FRAME)
- cm->sharpness_level = 0;
- else
- cm->sharpness_level = cpi->oxcf.Sharpness;
-
- if (cm->sharpness_level != cm->last_sharpness_level)
- {
- vp8_loop_filter_update_sharpness(&cm->lf_info, cm->sharpness_level);
- cm->last_sharpness_level = cm->sharpness_level;
- }
-
- /* Start the search at the previous frame filter level unless it is
- * now out of range.
- */
- if (cm->filter_level < min_filter_level)
- cm->filter_level = min_filter_level;
- else if (cm->filter_level > max_filter_level)
- cm->filter_level = max_filter_level;
-
- filt_val = cm->filter_level;
- best_filt_val = filt_val;
-
- /* Get the err using the previous frame's filter value. */
-
- /* Copy the unfiltered / processed recon buffer to the new buffer */
- vp8_yv12_copy_partial_frame(saved_frame, cm->frame_to_show);
- vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
-
- best_err = calc_partial_ssl_err(sd, cm->frame_to_show);
-
- filt_val -= 1 + (filt_val > 10);
-
- /* Search lower filter levels */
- while (filt_val >= min_filter_level)
- {
- /* Apply the loop filter */
- vp8_yv12_copy_partial_frame(saved_frame, cm->frame_to_show);
- vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
-
- /* Get the err for filtered frame */
- filt_err = calc_partial_ssl_err(sd, cm->frame_to_show);
-
- /* Update the best case record or exit loop. */
- if (filt_err < best_err)
- {
- best_err = filt_err;
- best_filt_val = filt_val;
- }
- else
- break;
-
- /* Adjust filter level */
- filt_val -= 1 + (filt_val > 10);
- }
-
- /* Search up (note that we have already done filt_val = cm->filter_level) */
- filt_val = cm->filter_level + 1 + (filt_val > 10);
-
- if (best_filt_val == cm->filter_level)
- {
- /* Resist raising filter level for very small gains */
- best_err -= (best_err >> 10);
-
- while (filt_val < max_filter_level)
- {
- /* Apply the loop filter */
- vp8_yv12_copy_partial_frame(saved_frame, cm->frame_to_show);
-
- vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val);
-
- /* Get the err for filtered frame */
- filt_err = calc_partial_ssl_err(sd, cm->frame_to_show);
-
- /* Update the best case record or exit loop. */
- if (filt_err < best_err)
- {
- /* Do not raise filter level if improvement is < 1 part
- * in 4096
- */
- best_err = filt_err - (filt_err >> 10);
-
- best_filt_val = filt_val;
- }
- else
- break;
-
- /* Adjust filter level */
- filt_val += 1 + (filt_val > 10);
- }
- }
-
- cm->filter_level = best_filt_val;
-
- if (cm->filter_level < min_filter_level)
- cm->filter_level = min_filter_level;
-
- if (cm->filter_level > max_filter_level)
- cm->filter_level = max_filter_level;
-
- /* restore unfiltered frame pointer */
- cm->frame_to_show = saved_frame;
-}
-
-/* Stub function for now Alt LF not used */
-void vp8cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val)
-{
- MACROBLOCKD *mbd = &cpi->mb.e_mbd;
- (void) filt_val;
-
- mbd->segment_feature_data[MB_LVL_ALT_LF][0] = cpi->segment_feature_data[MB_LVL_ALT_LF][0];
- mbd->segment_feature_data[MB_LVL_ALT_LF][1] = cpi->segment_feature_data[MB_LVL_ALT_LF][1];
- mbd->segment_feature_data[MB_LVL_ALT_LF][2] = cpi->segment_feature_data[MB_LVL_ALT_LF][2];
- mbd->segment_feature_data[MB_LVL_ALT_LF][3] = cpi->segment_feature_data[MB_LVL_ALT_LF][3];
-}
-
-void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- int best_err = 0;
- int filt_err = 0;
- int min_filter_level = get_min_filter_level(cpi, cm->base_qindex);
- int max_filter_level = get_max_filter_level(cpi, cm->base_qindex);
-
- int filter_step;
- int filt_high = 0;
- /* Start search at previous frame filter level */
- int filt_mid = cm->filter_level;
- int filt_low = 0;
- int filt_best;
- int filt_direction = 0;
-
- /* Bias against raising loop filter and in favor of lowering it */
- int Bias = 0;
-
- int ss_err[MAX_LOOP_FILTER + 1];
-
- YV12_BUFFER_CONFIG * saved_frame = cm->frame_to_show;
-
- vpx_memset(ss_err, 0, sizeof(ss_err));
-
- /* Replace unfiltered frame buffer with a new one */
- cm->frame_to_show = &cpi->pick_lf_lvl_frame;
-
- if (cm->frame_type == KEY_FRAME)
- cm->sharpness_level = 0;
- else
- cm->sharpness_level = cpi->oxcf.Sharpness;
-
- /* Start the search at the previous frame filter level unless it is
- * now out of range.
- */
- filt_mid = cm->filter_level;
-
- if (filt_mid < min_filter_level)
- filt_mid = min_filter_level;
- else if (filt_mid > max_filter_level)
- filt_mid = max_filter_level;
-
- /* Define the initial step size */
- filter_step = (filt_mid < 16) ? 4 : filt_mid / 4;
-
- /* Get baseline error score */
-
- /* Copy the unfiltered / processed recon buffer to the new buffer */
- vpx_yv12_copy_y(saved_frame, cm->frame_to_show);
-
- vp8cx_set_alt_lf_level(cpi, filt_mid);
- vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_mid);
-
- best_err = vp8_calc_ss_err(sd, cm->frame_to_show);
-
- ss_err[filt_mid] = best_err;
-
- filt_best = filt_mid;
-
- while (filter_step > 0)
- {
- Bias = (best_err >> (15 - (filt_mid / 8))) * filter_step;
-
- if (cpi->twopass.section_intra_rating < 20)
- Bias = Bias * cpi->twopass.section_intra_rating / 20;
-
- filt_high = ((filt_mid + filter_step) > max_filter_level) ? max_filter_level : (filt_mid + filter_step);
- filt_low = ((filt_mid - filter_step) < min_filter_level) ? min_filter_level : (filt_mid - filter_step);
-
- if ((filt_direction <= 0) && (filt_low != filt_mid))
- {
- if(ss_err[filt_low] == 0)
- {
- /* Get Low filter error score */
- vpx_yv12_copy_y(saved_frame, cm->frame_to_show);
- vp8cx_set_alt_lf_level(cpi, filt_low);
- vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_low);
-
- filt_err = vp8_calc_ss_err(sd, cm->frame_to_show);
- ss_err[filt_low] = filt_err;
- }
- else
- filt_err = ss_err[filt_low];
-
- /* If value is close to the best so far then bias towards a
- * lower loop filter value.
- */
- if ((filt_err - Bias) < best_err)
- {
- /* Was it actually better than the previous best? */
- if (filt_err < best_err)
- best_err = filt_err;
-
- filt_best = filt_low;
- }
- }
-
- /* Now look at filt_high */
- if ((filt_direction >= 0) && (filt_high != filt_mid))
- {
- if(ss_err[filt_high] == 0)
- {
- vpx_yv12_copy_y(saved_frame, cm->frame_to_show);
- vp8cx_set_alt_lf_level(cpi, filt_high);
- vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_high);
-
- filt_err = vp8_calc_ss_err(sd, cm->frame_to_show);
- ss_err[filt_high] = filt_err;
- }
- else
- filt_err = ss_err[filt_high];
-
- /* Was it better than the previous best? */
- if (filt_err < (best_err - Bias))
- {
- best_err = filt_err;
- filt_best = filt_high;
- }
- }
-
- /* Half the step distance if the best filter value was the same
- * as last time
- */
- if (filt_best == filt_mid)
- {
- filter_step = filter_step / 2;
- filt_direction = 0;
- }
- else
- {
- filt_direction = (filt_best < filt_mid) ? -1 : 1;
- filt_mid = filt_best;
- }
- }
-
- cm->filter_level = filt_best;
-
- /* restore unfiltered frame pointer */
- cm->frame_to_show = saved_frame;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/csystemdependent.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/csystemdependent.c
deleted file mode 100644
index 63f2357..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/csystemdependent.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/encoder/variance.h"
-#include "vp8/encoder/onyx_int.h"
-
-SADFunction *vp8_sad16x16;
-SADFunction *vp8_sad16x8;
-SADFunction *vp8_sad8x16;
-SADFunction *vp8_sad8x8;
-SADFunction *vp8_sad4x4;
-
-variance_function *vp8_variance4x4;
-variance_function *vp8_variance8x8;
-variance_function *vp8_variance8x16;
-variance_function *vp8_variance16x8;
-variance_function *vp8_variance16x16;
-
-variance_function *vp8_mse16x16;
-
-sub_pixel_variance_function *vp8_sub_pixel_variance4x4;
-sub_pixel_variance_function *vp8_sub_pixel_variance8x8;
-sub_pixel_variance_function *vp8_sub_pixel_variance8x16;
-sub_pixel_variance_function *vp8_sub_pixel_variance16x8;
-sub_pixel_variance_function *vp8_sub_pixel_variance16x16;
-
-int (*vp8_block_error)(short *coeff, short *dqcoeff);
-int (*vp8_mbblock_error)(MACROBLOCK *mb, int dc);
-
-int (*vp8_mbuverror)(MACROBLOCK *mb);
-unsigned int (*vp8_get_mb_ss)(short *);
-void (*vp8_short_fdct4x4)(short *input, short *output, int pitch);
-void (*vp8_short_fdct8x4)(short *input, short *output, int pitch);
-void (*vp8_fast_fdct4x4)(short *input, short *output, int pitch);
-void (*vp8_fast_fdct8x4)(short *input, short *output, int pitch);
-void (*short_walsh4x4)(short *input, short *output, int pitch);
-
-void (*vp8_subtract_b)(BLOCK *be, BLOCKD *bd, int pitch);
-void (*vp8_subtract_mby)(short *diff, unsigned char *src, unsigned char *pred, int stride);
-void (*vp8_subtract_mbuv)(short *diff, unsigned char *usrc, unsigned char *vsrc, unsigned char *pred, int stride);
-void (*vp8_fast_quantize_b)(BLOCK *b, BLOCKD *d);
-
-unsigned int (*vp8_get4x4sse_cs)(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride);
-
-// c imports
-extern int block_error_c(short *coeff, short *dqcoeff);
-extern int vp8_mbblock_error_c(MACROBLOCK *mb, int dc);
-
-extern int vp8_mbuverror_c(MACROBLOCK *mb);
-extern unsigned int vp8_get8x8var_c(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride, unsigned int *SSE, int *Sum);
-extern void short_fdct4x4_c(short *input, short *output, int pitch);
-extern void short_fdct8x4_c(short *input, short *output, int pitch);
-extern void vp8_short_walsh4x4_c(short *input, short *output, int pitch);
-
-extern void vp8_subtract_b_c(BLOCK *be, BLOCKD *bd, int pitch);
-extern void subtract_mby_c(short *diff, unsigned char *src, unsigned char *pred, int stride);
-extern void subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc, unsigned char *pred, int stride);
-extern void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d);
-
-extern SADFunction sad16x16_c;
-extern SADFunction sad16x8_c;
-extern SADFunction sad8x16_c;
-extern SADFunction sad8x8_c;
-extern SADFunction sad4x4_c;
-
-extern variance_function variance16x16_c;
-extern variance_function variance8x16_c;
-extern variance_function variance16x8_c;
-extern variance_function variance8x8_c;
-extern variance_function variance4x4_c;
-extern variance_function mse16x16_c;
-
-extern sub_pixel_variance_function sub_pixel_variance4x4_c;
-extern sub_pixel_variance_function sub_pixel_variance8x8_c;
-extern sub_pixel_variance_function sub_pixel_variance8x16_c;
-extern sub_pixel_variance_function sub_pixel_variance16x8_c;
-extern sub_pixel_variance_function sub_pixel_variance16x16_c;
-
-extern unsigned int vp8_get_mb_ss_c(short *);
-extern unsigned int vp8_get4x4sse_cs_c(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride);
-
-// ppc
-extern int vp8_block_error_ppc(short *coeff, short *dqcoeff);
-
-extern void vp8_short_fdct4x4_ppc(short *input, short *output, int pitch);
-extern void vp8_short_fdct8x4_ppc(short *input, short *output, int pitch);
-
-extern void vp8_subtract_mby_ppc(short *diff, unsigned char *src, unsigned char *pred, int stride);
-extern void vp8_subtract_mbuv_ppc(short *diff, unsigned char *usrc, unsigned char *vsrc, unsigned char *pred, int stride);
-
-extern SADFunction vp8_sad16x16_ppc;
-extern SADFunction vp8_sad16x8_ppc;
-extern SADFunction vp8_sad8x16_ppc;
-extern SADFunction vp8_sad8x8_ppc;
-extern SADFunction vp8_sad4x4_ppc;
-
-extern variance_function vp8_variance16x16_ppc;
-extern variance_function vp8_variance8x16_ppc;
-extern variance_function vp8_variance16x8_ppc;
-extern variance_function vp8_variance8x8_ppc;
-extern variance_function vp8_variance4x4_ppc;
-extern variance_function vp8_mse16x16_ppc;
-
-extern sub_pixel_variance_function vp8_sub_pixel_variance4x4_ppc;
-extern sub_pixel_variance_function vp8_sub_pixel_variance8x8_ppc;
-extern sub_pixel_variance_function vp8_sub_pixel_variance8x16_ppc;
-extern sub_pixel_variance_function vp8_sub_pixel_variance16x8_ppc;
-extern sub_pixel_variance_function vp8_sub_pixel_variance16x16_ppc;
-
-extern unsigned int vp8_get8x8var_ppc(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride, unsigned int *SSE, int *Sum);
-extern unsigned int vp8_get16x16var_ppc(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride, unsigned int *SSE, int *Sum);
-
-void vp8_cmachine_specific_config(void)
-{
- // Pure C:
- vp8_mbuverror = vp8_mbuverror_c;
- vp8_fast_quantize_b = vp8_fast_quantize_b_c;
- vp8_short_fdct4x4 = vp8_short_fdct4x4_ppc;
- vp8_short_fdct8x4 = vp8_short_fdct8x4_ppc;
- vp8_fast_fdct4x4 = vp8_short_fdct4x4_ppc;
- vp8_fast_fdct8x4 = vp8_short_fdct8x4_ppc;
- short_walsh4x4 = vp8_short_walsh4x4_c;
-
- vp8_variance4x4 = vp8_variance4x4_ppc;
- vp8_variance8x8 = vp8_variance8x8_ppc;
- vp8_variance8x16 = vp8_variance8x16_ppc;
- vp8_variance16x8 = vp8_variance16x8_ppc;
- vp8_variance16x16 = vp8_variance16x16_ppc;
- vp8_mse16x16 = vp8_mse16x16_ppc;
-
- vp8_sub_pixel_variance4x4 = vp8_sub_pixel_variance4x4_ppc;
- vp8_sub_pixel_variance8x8 = vp8_sub_pixel_variance8x8_ppc;
- vp8_sub_pixel_variance8x16 = vp8_sub_pixel_variance8x16_ppc;
- vp8_sub_pixel_variance16x8 = vp8_sub_pixel_variance16x8_ppc;
- vp8_sub_pixel_variance16x16 = vp8_sub_pixel_variance16x16_ppc;
-
- vp8_get_mb_ss = vp8_get_mb_ss_c;
- vp8_get4x4sse_cs = vp8_get4x4sse_cs_c;
-
- vp8_sad16x16 = vp8_sad16x16_ppc;
- vp8_sad16x8 = vp8_sad16x8_ppc;
- vp8_sad8x16 = vp8_sad8x16_ppc;
- vp8_sad8x8 = vp8_sad8x8_ppc;
- vp8_sad4x4 = vp8_sad4x4_ppc;
-
- vp8_block_error = vp8_block_error_ppc;
- vp8_mbblock_error = vp8_mbblock_error_c;
-
- vp8_subtract_b = vp8_subtract_b_c;
- vp8_subtract_mby = vp8_subtract_mby_ppc;
- vp8_subtract_mbuv = vp8_subtract_mbuv_ppc;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/encodemb_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/encodemb_altivec.asm
deleted file mode 100644
index 6e0099d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/encodemb_altivec.asm
+++ /dev/null
@@ -1,153 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl vp8_subtract_mbuv_ppc
- .globl vp8_subtract_mby_ppc
-
-;# r3 short *diff
-;# r4 unsigned char *usrc
-;# r5 unsigned char *vsrc
-;# r6 unsigned char *pred
-;# r7 int stride
-vp8_subtract_mbuv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf000
- mtspr 256, r12 ;# set VRSAVE
-
- li r9, 256
- add r3, r3, r9
- add r3, r3, r9
- add r6, r6, r9
-
- li r10, 16
- li r9, 4
- mtctr r9
-
- vspltisw v0, 0
-
-mbu_loop:
- lvsl v5, 0, r4 ;# permutate value for alignment
- lvx v1, 0, r4 ;# src
- lvx v2, 0, r6 ;# pred
-
- add r4, r4, r7
- addi r6, r6, 16
-
- vperm v1, v1, v0, v5
-
- vmrghb v3, v0, v1 ;# unpack high src to short
- vmrghb v4, v0, v2 ;# unpack high pred to short
-
- lvsl v5, 0, r4 ;# permutate value for alignment
- lvx v1, 0, r4 ;# src
-
- add r4, r4, r7
-
- vsubshs v3, v3, v4
-
- stvx v3, 0, r3 ;# store out diff
-
- vperm v1, v1, v0, v5
-
- vmrghb v3, v0, v1 ;# unpack high src to short
- vmrglb v4, v0, v2 ;# unpack high pred to short
-
- vsubshs v3, v3, v4
-
- stvx v3, r10, r3 ;# store out diff
-
- addi r3, r3, 32
-
- bdnz mbu_loop
-
- mtctr r9
-
-mbv_loop:
- lvsl v5, 0, r5 ;# permutate value for alignment
- lvx v1, 0, r5 ;# src
- lvx v2, 0, r6 ;# pred
-
- add r5, r5, r7
- addi r6, r6, 16
-
- vperm v1, v1, v0, v5
-
- vmrghb v3, v0, v1 ;# unpack high src to short
- vmrghb v4, v0, v2 ;# unpack high pred to short
-
- lvsl v5, 0, r5 ;# permutate value for alignment
- lvx v1, 0, r5 ;# src
-
- add r5, r5, r7
-
- vsubshs v3, v3, v4
-
- stvx v3, 0, r3 ;# store out diff
-
- vperm v1, v1, v0, v5
-
- vmrghb v3, v0, v1 ;# unpack high src to short
- vmrglb v4, v0, v2 ;# unpack high pred to short
-
- vsubshs v3, v3, v4
-
- stvx v3, r10, r3 ;# store out diff
-
- addi r3, r3, 32
-
- bdnz mbv_loop
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# r3 short *diff
-;# r4 unsigned char *src
-;# r5 unsigned char *pred
-;# r6 int stride
-vp8_subtract_mby_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf800
- mtspr 256, r12 ;# set VRSAVE
-
- li r10, 16
- mtctr r10
-
- vspltisw v0, 0
-
-mby_loop:
- lvx v1, 0, r4 ;# src
- lvx v2, 0, r5 ;# pred
-
- add r4, r4, r6
- addi r5, r5, 16
-
- vmrghb v3, v0, v1 ;# unpack high src to short
- vmrghb v4, v0, v2 ;# unpack high pred to short
-
- vsubshs v3, v3, v4
-
- stvx v3, 0, r3 ;# store out diff
-
- vmrglb v3, v0, v1 ;# unpack low src to short
- vmrglb v4, v0, v2 ;# unpack low pred to short
-
- vsubshs v3, v3, v4
-
- stvx v3, r10, r3 ;# store out diff
-
- addi r3, r3, 32
-
- bdnz mby_loop
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/fdct_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/fdct_altivec.asm
deleted file mode 100644
index 935d0cb..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/fdct_altivec.asm
+++ /dev/null
@@ -1,205 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl vp8_short_fdct4x4_ppc
- .globl vp8_short_fdct8x4_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-;# Forward and inverse DCTs are nearly identical; only differences are
-;# in normalization (fwd is twice unitary, inv is half unitary)
-;# and that they are of course transposes of each other.
-;#
-;# The following three accomplish most of implementation and
-;# are used only by ppc_idct.c and ppc_fdct.c.
-.macro prologue
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xfffc
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- li r6, 16
-
- load_c v0, dct_tab, 0, r9, r10
- lvx v1, r6, r10
- addi r10, r10, 32
- lvx v2, 0, r10
- lvx v3, r6, r10
-
- load_c v4, ppc_dctperm_tab, 0, r9, r10
- load_c v5, ppc_dctperm_tab, r6, r9, r10
-
- load_c v6, round_tab, 0, r10, r9
-.endm
-
-.macro epilogue
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-.endm
-
-;# Do horiz xf on two rows of coeffs v8 = a0 a1 a2 a3 b0 b1 b2 b3.
-;# a/A are the even rows 0,2 b/B are the odd rows 1,3
-;# For fwd transform, indices are horizontal positions, then frequencies.
-;# For inverse transform, frequencies then positions.
-;# The two resulting A0..A3 B0..B3 are later combined
-;# and vertically transformed.
-
-.macro two_rows_horiz Dst
- vperm v9, v8, v8, v4 ;# v9 = a2 a3 a0 a1 b2 b3 b0 b1
-
- vmsumshm v10, v0, v8, v6
- vmsumshm v10, v1, v9, v10
- vsraw v10, v10, v7 ;# v10 = A0 A1 B0 B1
-
- vmsumshm v11, v2, v8, v6
- vmsumshm v11, v3, v9, v11
- vsraw v11, v11, v7 ;# v11 = A2 A3 B2 B3
-
- vpkuwum v10, v10, v11 ;# v10 = A0 A1 B0 B1 A2 A3 B2 B3
- vperm \Dst, v10, v10, v5 ;# Dest = A0 B0 A1 B1 A2 B2 A3 B3
-.endm
-
-;# Vertical xf on two rows. DCT values in comments are for inverse transform;
-;# forward transform uses transpose.
-
-.macro two_rows_vert Ceven, Codd
- vspltw v8, \Ceven, 0 ;# v8 = c00 c10 or c02 c12 four times
- vspltw v9, \Codd, 0 ;# v9 = c20 c30 or c22 c32 ""
- vmsumshm v8, v8, v12, v6
- vmsumshm v8, v9, v13, v8
- vsraw v10, v8, v7
-
- vspltw v8, \Codd, 1 ;# v8 = c01 c11 or c03 c13
- vspltw v9, \Ceven, 1 ;# v9 = c21 c31 or c23 c33
- vmsumshm v8, v8, v12, v6
- vmsumshm v8, v9, v13, v8
- vsraw v8, v8, v7
-
- vpkuwum v8, v10, v8 ;# v8 = rows 0,1 or 2,3
-.endm
-
-.macro two_rows_h Dest
- stw r0, 0(r8)
- lwz r0, 4(r3)
- stw r0, 4(r8)
- lwzux r0, r3,r5
- stw r0, 8(r8)
- lwz r0, 4(r3)
- stw r0, 12(r8)
- lvx v8, 0,r8
- two_rows_horiz \Dest
-.endm
-
- .align 2
-;# r3 short *input
-;# r4 short *output
-;# r5 int pitch
-vp8_short_fdct4x4_ppc:
-
- prologue
-
- vspltisw v7, 14 ;# == 14, fits in 5 signed bits
- addi r8, r1, 0
-
-
- lwz r0, 0(r3)
- two_rows_h v12 ;# v12 = H00 H10 H01 H11 H02 H12 H03 H13
-
- lwzux r0, r3, r5
- two_rows_h v13 ;# v13 = H20 H30 H21 H31 H22 H32 H23 H33
-
- lvx v6, r6, r9 ;# v6 = Vround
- vspltisw v7, -16 ;# == 16 == -16, only low 5 bits matter
-
- two_rows_vert v0, v1
- stvx v8, 0, r4
- two_rows_vert v2, v3
- stvx v8, r6, r4
-
- epilogue
-
- blr
-
- .align 2
-;# r3 short *input
-;# r4 short *output
-;# r5 int pitch
-vp8_short_fdct8x4_ppc:
- prologue
-
- vspltisw v7, 14 ;# == 14, fits in 5 signed bits
- addi r8, r1, 0
- addi r10, r3, 0
-
- lwz r0, 0(r3)
- two_rows_h v12 ;# v12 = H00 H10 H01 H11 H02 H12 H03 H13
-
- lwzux r0, r3, r5
- two_rows_h v13 ;# v13 = H20 H30 H21 H31 H22 H32 H23 H33
-
- lvx v6, r6, r9 ;# v6 = Vround
- vspltisw v7, -16 ;# == 16 == -16, only low 5 bits matter
-
- two_rows_vert v0, v1
- stvx v8, 0, r4
- two_rows_vert v2, v3
- stvx v8, r6, r4
-
- ;# Next block
- addi r3, r10, 8
- addi r4, r4, 32
- lvx v6, 0, r9 ;# v6 = Hround
-
- vspltisw v7, 14 ;# == 14, fits in 5 signed bits
- addi r8, r1, 0
-
- lwz r0, 0(r3)
- two_rows_h v12 ;# v12 = H00 H10 H01 H11 H02 H12 H03 H13
-
- lwzux r0, r3, r5
- two_rows_h v13 ;# v13 = H20 H30 H21 H31 H22 H32 H23 H33
-
- lvx v6, r6, r9 ;# v6 = Vround
- vspltisw v7, -16 ;# == 16 == -16, only low 5 bits matter
-
- two_rows_vert v0, v1
- stvx v8, 0, r4
- two_rows_vert v2, v3
- stvx v8, r6, r4
-
- epilogue
-
- blr
-
- .data
- .align 4
-ppc_dctperm_tab:
- .byte 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11
- .byte 0,1,4,5, 2,3,6,7, 8,9,12,13, 10,11,14,15
-
- .align 4
-dct_tab:
- .short 23170, 23170,-12540,-30274, 23170, 23170,-12540,-30274
- .short 23170, 23170, 30274, 12540, 23170, 23170, 30274, 12540
-
- .short 23170,-23170, 30274,-12540, 23170,-23170, 30274,-12540
- .short -23170, 23170, 12540,-30274,-23170, 23170, 12540,-30274
-
- .align 4
-round_tab:
- .long (1 << (14-1)), (1 << (14-1)), (1 << (14-1)), (1 << (14-1))
- .long (1 << (16-1)), (1 << (16-1)), (1 << (16-1)), (1 << (16-1))
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/rdopt_altivec.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/rdopt_altivec.asm
deleted file mode 100644
index ba48230..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ppc/rdopt_altivec.asm
+++ /dev/null
@@ -1,51 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- .globl vp8_block_error_ppc
-
- .align 2
-;# r3 short *Coeff
-;# r4 short *dqcoeff
-vp8_block_error_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf800
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- stw r5, 12(r1) ;# tranfer dc to vector register
-
- lvx v0, 0, r3 ;# Coeff
- lvx v1, 0, r4 ;# dqcoeff
-
- li r10, 16
-
- vspltisw v3, 0
-
- vsubshs v0, v0, v1
-
- vmsumshm v2, v0, v0, v3 ;# multiply differences
-
- lvx v0, r10, r3 ;# Coeff
- lvx v1, r10, r4 ;# dqcoeff
-
- vsubshs v0, v0, v1
-
- vmsumshm v1, v0, v0, v2 ;# multiply differences
- vsumsws v1, v1, v3 ;# sum up
-
- stvx v1, 0, r1
- lwz r3, 12(r1) ;# return value
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.c
deleted file mode 100644
index fda997f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.c
+++ /dev/null
@@ -1,815 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <math.h>
-#include "vpx_mem/vpx_mem.h"
-
-#include "onyx_int.h"
-#include "quantize.h"
-#include "vp8/common/quant_common.h"
-
-#define EXACT_QUANT
-
-#ifdef EXACT_FASTQUANT
-void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
-{
- int i, rc, eob;
- int zbin;
- int x, y, z, sz;
- short *coeff_ptr = b->coeff;
- short *zbin_ptr = b->zbin;
- short *round_ptr = b->round;
- short *quant_ptr = b->quant_fast;
- unsigned char *quant_shift_ptr = b->quant_shift;
- short *qcoeff_ptr = d->qcoeff;
- short *dqcoeff_ptr = d->dqcoeff;
- short *dequant_ptr = d->dequant;
-
- vpx_memset(qcoeff_ptr, 0, 32);
- vpx_memset(dqcoeff_ptr, 0, 32);
-
- eob = -1;
-
- for (i = 0; i < 16; i++)
- {
- rc = vp8_default_zig_zag1d[i];
- z = coeff_ptr[rc];
- zbin = zbin_ptr[rc] ;
-
- sz = (z >> 31); /* sign of z */
- x = (z ^ sz) - sz; /* x = abs(z) */
-
- if (x >= zbin)
- {
- x += round_ptr[rc];
- y = ((((x * quant_ptr[rc]) >> 16) + x)
- * quant_shift_ptr[rc]) >> 16; /* quantize (x) */
- x = (y ^ sz) - sz; /* get the sign back */
- qcoeff_ptr[rc] = x; /* write to destination */
- dqcoeff_ptr[rc] = x * dequant_ptr[rc]; /* dequantized value */
-
- if (y)
- {
- eob = i; /* last nonzero coeffs */
- }
- }
- }
- *d->eob = (char)(eob + 1);
-}
-
-#else
-
-void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
-{
- int i, rc, eob;
- int x, y, z, sz;
- short *coeff_ptr = b->coeff;
- short *round_ptr = b->round;
- short *quant_ptr = b->quant_fast;
- short *qcoeff_ptr = d->qcoeff;
- short *dqcoeff_ptr = d->dqcoeff;
- short *dequant_ptr = d->dequant;
-
- eob = -1;
- for (i = 0; i < 16; i++)
- {
- rc = vp8_default_zig_zag1d[i];
- z = coeff_ptr[rc];
-
- sz = (z >> 31); /* sign of z */
- x = (z ^ sz) - sz; /* x = abs(z) */
-
- y = ((x + round_ptr[rc]) * quant_ptr[rc]) >> 16; /* quantize (x) */
- x = (y ^ sz) - sz; /* get the sign back */
- qcoeff_ptr[rc] = x; /* write to destination */
- dqcoeff_ptr[rc] = x * dequant_ptr[rc]; /* dequantized value */
-
- if (y)
- {
- eob = i; /* last nonzero coeffs */
- }
- }
- *d->eob = (char)(eob + 1);
-}
-
-#endif
-
-#ifdef EXACT_QUANT
-void vp8_regular_quantize_b_c(BLOCK *b, BLOCKD *d)
-{
- int i, rc, eob;
- int zbin;
- int x, y, z, sz;
- short *zbin_boost_ptr = b->zrun_zbin_boost;
- short *coeff_ptr = b->coeff;
- short *zbin_ptr = b->zbin;
- short *round_ptr = b->round;
- short *quant_ptr = b->quant;
- short *quant_shift_ptr = b->quant_shift;
- short *qcoeff_ptr = d->qcoeff;
- short *dqcoeff_ptr = d->dqcoeff;
- short *dequant_ptr = d->dequant;
- short zbin_oq_value = b->zbin_extra;
-
- vpx_memset(qcoeff_ptr, 0, 32);
- vpx_memset(dqcoeff_ptr, 0, 32);
-
- eob = -1;
-
- for (i = 0; i < 16; i++)
- {
- rc = vp8_default_zig_zag1d[i];
- z = coeff_ptr[rc];
-
- zbin = zbin_ptr[rc] + *zbin_boost_ptr + zbin_oq_value;
-
- zbin_boost_ptr ++;
- sz = (z >> 31); /* sign of z */
- x = (z ^ sz) - sz; /* x = abs(z) */
-
- if (x >= zbin)
- {
- x += round_ptr[rc];
- y = ((((x * quant_ptr[rc]) >> 16) + x)
- * quant_shift_ptr[rc]) >> 16; /* quantize (x) */
- x = (y ^ sz) - sz; /* get the sign back */
- qcoeff_ptr[rc] = x; /* write to destination */
- dqcoeff_ptr[rc] = x * dequant_ptr[rc]; /* dequantized value */
-
- if (y)
- {
- eob = i; /* last nonzero coeffs */
- zbin_boost_ptr = b->zrun_zbin_boost; /* reset zero runlength */
- }
- }
- }
-
- *d->eob = (char)(eob + 1);
-}
-
-/* Perform regular quantization, with unbiased rounding and no zero bin. */
-void vp8_strict_quantize_b_c(BLOCK *b, BLOCKD *d)
-{
- int i;
- int rc;
- int eob;
- int x;
- int y;
- int z;
- int sz;
- short *coeff_ptr;
- short *quant_ptr;
- short *quant_shift_ptr;
- short *qcoeff_ptr;
- short *dqcoeff_ptr;
- short *dequant_ptr;
-
- coeff_ptr = b->coeff;
- quant_ptr = b->quant;
- quant_shift_ptr = b->quant_shift;
- qcoeff_ptr = d->qcoeff;
- dqcoeff_ptr = d->dqcoeff;
- dequant_ptr = d->dequant;
- eob = - 1;
- vpx_memset(qcoeff_ptr, 0, 32);
- vpx_memset(dqcoeff_ptr, 0, 32);
- for (i = 0; i < 16; i++)
- {
- int dq;
- int rounding;
-
- /*TODO: These arrays should be stored in zig-zag order.*/
- rc = vp8_default_zig_zag1d[i];
- z = coeff_ptr[rc];
- dq = dequant_ptr[rc];
- rounding = dq >> 1;
- /* Sign of z. */
- sz = -(z < 0);
- x = (z + sz) ^ sz;
- x += rounding;
- if (x >= dq)
- {
- /* Quantize x. */
- y = ((((x * quant_ptr[rc]) >> 16) + x) * quant_shift_ptr[rc]) >> 16;
- /* Put the sign back. */
- x = (y + sz) ^ sz;
- /* Save the coefficient and its dequantized value. */
- qcoeff_ptr[rc] = x;
- dqcoeff_ptr[rc] = x * dq;
- /* Remember the last non-zero coefficient. */
- if (y)
- eob = i;
- }
- }
-
- *d->eob = (char)(eob + 1);
-}
-
-#else
-
-void vp8_regular_quantize_b_c(BLOCK *b, BLOCKD *d)
-{
- int i, rc, eob;
- int zbin;
- int x, y, z, sz;
- short *zbin_boost_ptr = b->zrun_zbin_boost;
- short *coeff_ptr = b->coeff;
- short *zbin_ptr = b->zbin;
- short *round_ptr = b->round;
- short *quant_ptr = b->quant;
- short *qcoeff_ptr = d->qcoeff;
- short *dqcoeff_ptr = d->dqcoeff;
- short *dequant_ptr = d->dequant;
- short zbin_oq_value = b->zbin_extra;
-
- vpx_memset(qcoeff_ptr, 0, 32);
- vpx_memset(dqcoeff_ptr, 0, 32);
-
- eob = -1;
-
- for (i = 0; i < 16; i++)
- {
- rc = vp8_default_zig_zag1d[i];
- z = coeff_ptr[rc];
-
- zbin = zbin_ptr[rc] + *zbin_boost_ptr + zbin_oq_value;
-
- zbin_boost_ptr ++;
- sz = (z >> 31); /* sign of z */
- x = (z ^ sz) - sz; /* x = abs(z) */
-
- if (x >= zbin)
- {
- y = ((x + round_ptr[rc]) * quant_ptr[rc]) >> 16; /* quantize (x) */
- x = (y ^ sz) - sz; /* get the sign back */
- qcoeff_ptr[rc] = x; /* write to destination */
- dqcoeff_ptr[rc] = x * dequant_ptr[rc]; /* dequantized value */
-
- if (y)
- {
- eob = i; /* last nonzero coeffs */
- zbin_boost_ptr = &b->zrun_zbin_boost[0]; /* reset zrl */
- }
- }
- }
-
- *d->eob = (char)(eob + 1);
-}
-
-#endif
-
-void vp8_quantize_mby_c(MACROBLOCK *x)
-{
- int i;
- int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
-
- for (i = 0; i < 16; i++)
- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-
- if(has_2nd_order)
- x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
-}
-
-void vp8_quantize_mb_c(MACROBLOCK *x)
-{
- int i;
- int has_2nd_order=(x->e_mbd.mode_info_context->mbmi.mode != B_PRED
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
-
- for (i = 0; i < 24+has_2nd_order; i++)
- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-}
-
-
-void vp8_quantize_mbuv_c(MACROBLOCK *x)
-{
- int i;
-
- for (i = 16; i < 24; i++)
- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-}
-
-/* quantize_b_pair function pointer in MACROBLOCK structure is set to one of
- * these two C functions if corresponding optimized routine is not available.
- * NEON optimized version implements currently the fast quantization for pair
- * of blocks. */
-void vp8_regular_quantize_b_pair(BLOCK *b1, BLOCK *b2, BLOCKD *d1, BLOCKD *d2)
-{
- vp8_regular_quantize_b(b1, d1);
- vp8_regular_quantize_b(b2, d2);
-}
-
-void vp8_fast_quantize_b_pair_c(BLOCK *b1, BLOCK *b2, BLOCKD *d1, BLOCKD *d2)
-{
- vp8_fast_quantize_b_c(b1, d1);
- vp8_fast_quantize_b_c(b2, d2);
-}
-
-
-static const int qrounding_factors[129] =
-{
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48
-};
-
-
-static const int qzbin_factors[129] =
-{
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80
-};
-
-
-static const int qrounding_factors_y2[129] =
-{
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48,
- 48
-};
-
-
-static const int qzbin_factors_y2[129] =
-{
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80,
- 80
-};
-
-
-#define EXACT_QUANT
-#ifdef EXACT_QUANT
-static void invert_quant(int improved_quant, short *quant,
- short *shift, short d)
-{
- if(improved_quant)
- {
- unsigned t;
- int l;
- t = d;
- for(l = 0; t > 1; l++)
- t>>=1;
- t = 1 + (1<<(16+l))/d;
- *quant = (short)(t - (1<<16));
- *shift = l;
- /* use multiplication and constant shift by 16 */
- *shift = 1 << (16 - *shift);
- }
- else
- {
- *quant = (1 << 16) / d;
- *shift = 0;
- /* use multiplication and constant shift by 16 */
- *shift = 1 << (16 - *shift);
- }
-}
-
-
-void vp8cx_init_quantizer(VP8_COMP *cpi)
-{
- int i;
- int quant_val;
- int Q;
-
- int zbin_boost[16] = {0, 0, 8, 10, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44,
- 44, 44};
-
- for (Q = 0; Q < QINDEX_RANGE; Q++)
- {
- /* dc values */
- quant_val = vp8_dc_quant(Q, cpi->common.y1dc_delta_q);
- cpi->Y1quant_fast[Q][0] = (1 << 16) / quant_val;
- invert_quant(cpi->sf.improved_quant, cpi->Y1quant[Q] + 0,
- cpi->Y1quant_shift[Q] + 0, quant_val);
- cpi->Y1zbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;
- cpi->Y1round[Q][0] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.Y1dequant[Q][0] = quant_val;
- cpi->zrun_zbin_boost_y1[Q][0] = (quant_val * zbin_boost[0]) >> 7;
-
- quant_val = vp8_dc2quant(Q, cpi->common.y2dc_delta_q);
- cpi->Y2quant_fast[Q][0] = (1 << 16) / quant_val;
- invert_quant(cpi->sf.improved_quant, cpi->Y2quant[Q] + 0,
- cpi->Y2quant_shift[Q] + 0, quant_val);
- cpi->Y2zbin[Q][0] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7;
- cpi->Y2round[Q][0] = (qrounding_factors_y2[Q] * quant_val) >> 7;
- cpi->common.Y2dequant[Q][0] = quant_val;
- cpi->zrun_zbin_boost_y2[Q][0] = (quant_val * zbin_boost[0]) >> 7;
-
- quant_val = vp8_dc_uv_quant(Q, cpi->common.uvdc_delta_q);
- cpi->UVquant_fast[Q][0] = (1 << 16) / quant_val;
- invert_quant(cpi->sf.improved_quant, cpi->UVquant[Q] + 0,
- cpi->UVquant_shift[Q] + 0, quant_val);
- cpi->UVzbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;;
- cpi->UVround[Q][0] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.UVdequant[Q][0] = quant_val;
- cpi->zrun_zbin_boost_uv[Q][0] = (quant_val * zbin_boost[0]) >> 7;
-
- /* all the ac values = ; */
- quant_val = vp8_ac_yquant(Q);
- cpi->Y1quant_fast[Q][1] = (1 << 16) / quant_val;
- invert_quant(cpi->sf.improved_quant, cpi->Y1quant[Q] + 1,
- cpi->Y1quant_shift[Q] + 1, quant_val);
- cpi->Y1zbin[Q][1] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;
- cpi->Y1round[Q][1] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.Y1dequant[Q][1] = quant_val;
- cpi->zrun_zbin_boost_y1[Q][1] = (quant_val * zbin_boost[1]) >> 7;
-
- quant_val = vp8_ac2quant(Q, cpi->common.y2ac_delta_q);
- cpi->Y2quant_fast[Q][1] = (1 << 16) / quant_val;
- invert_quant(cpi->sf.improved_quant, cpi->Y2quant[Q] + 1,
- cpi->Y2quant_shift[Q] + 1, quant_val);
- cpi->Y2zbin[Q][1] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7;
- cpi->Y2round[Q][1] = (qrounding_factors_y2[Q] * quant_val) >> 7;
- cpi->common.Y2dequant[Q][1] = quant_val;
- cpi->zrun_zbin_boost_y2[Q][1] = (quant_val * zbin_boost[1]) >> 7;
-
- quant_val = vp8_ac_uv_quant(Q, cpi->common.uvac_delta_q);
- cpi->UVquant_fast[Q][1] = (1 << 16) / quant_val;
- invert_quant(cpi->sf.improved_quant, cpi->UVquant[Q] + 1,
- cpi->UVquant_shift[Q] + 1, quant_val);
- cpi->UVzbin[Q][1] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;
- cpi->UVround[Q][1] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.UVdequant[Q][1] = quant_val;
- cpi->zrun_zbin_boost_uv[Q][1] = (quant_val * zbin_boost[1]) >> 7;
-
- for (i = 2; i < 16; i++)
- {
- cpi->Y1quant_fast[Q][i] = cpi->Y1quant_fast[Q][1];
- cpi->Y1quant[Q][i] = cpi->Y1quant[Q][1];
- cpi->Y1quant_shift[Q][i] = cpi->Y1quant_shift[Q][1];
- cpi->Y1zbin[Q][i] = cpi->Y1zbin[Q][1];
- cpi->Y1round[Q][i] = cpi->Y1round[Q][1];
- cpi->zrun_zbin_boost_y1[Q][i] = (cpi->common.Y1dequant[Q][1] *
- zbin_boost[i]) >> 7;
-
- cpi->Y2quant_fast[Q][i] = cpi->Y2quant_fast[Q][1];
- cpi->Y2quant[Q][i] = cpi->Y2quant[Q][1];
- cpi->Y2quant_shift[Q][i] = cpi->Y2quant_shift[Q][1];
- cpi->Y2zbin[Q][i] = cpi->Y2zbin[Q][1];
- cpi->Y2round[Q][i] = cpi->Y2round[Q][1];
- cpi->zrun_zbin_boost_y2[Q][i] = (cpi->common.Y2dequant[Q][1] *
- zbin_boost[i]) >> 7;
-
- cpi->UVquant_fast[Q][i] = cpi->UVquant_fast[Q][1];
- cpi->UVquant[Q][i] = cpi->UVquant[Q][1];
- cpi->UVquant_shift[Q][i] = cpi->UVquant_shift[Q][1];
- cpi->UVzbin[Q][i] = cpi->UVzbin[Q][1];
- cpi->UVround[Q][i] = cpi->UVround[Q][1];
- cpi->zrun_zbin_boost_uv[Q][i] = (cpi->common.UVdequant[Q][1] *
- zbin_boost[i]) >> 7;
- }
- }
-}
-#else
-void vp8cx_init_quantizer(VP8_COMP *cpi)
-{
- int i;
- int quant_val;
- int Q;
-
- int zbin_boost[16] = {0, 0, 8, 10, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 44, 44};
-
- for (Q = 0; Q < QINDEX_RANGE; Q++)
- {
- /* dc values */
- quant_val = vp8_dc_quant(Q, cpi->common.y1dc_delta_q);
- cpi->Y1quant[Q][0] = (1 << 16) / quant_val;
- cpi->Y1zbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;
- cpi->Y1round[Q][0] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.Y1dequant[Q][0] = quant_val;
- cpi->zrun_zbin_boost_y1[Q][0] = (quant_val * zbin_boost[0]) >> 7;
-
- quant_val = vp8_dc2quant(Q, cpi->common.y2dc_delta_q);
- cpi->Y2quant[Q][0] = (1 << 16) / quant_val;
- cpi->Y2zbin[Q][0] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7;
- cpi->Y2round[Q][0] = (qrounding_factors_y2[Q] * quant_val) >> 7;
- cpi->common.Y2dequant[Q][0] = quant_val;
- cpi->zrun_zbin_boost_y2[Q][0] = (quant_val * zbin_boost[0]) >> 7;
-
- quant_val = vp8_dc_uv_quant(Q, cpi->common.uvdc_delta_q);
- cpi->UVquant[Q][0] = (1 << 16) / quant_val;
- cpi->UVzbin[Q][0] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;;
- cpi->UVround[Q][0] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.UVdequant[Q][0] = quant_val;
- cpi->zrun_zbin_boost_uv[Q][0] = (quant_val * zbin_boost[0]) >> 7;
-
- /* all the ac values = ; */
- for (i = 1; i < 16; i++)
- {
- int rc = vp8_default_zig_zag1d[i];
-
- quant_val = vp8_ac_yquant(Q);
- cpi->Y1quant[Q][rc] = (1 << 16) / quant_val;
- cpi->Y1zbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;
- cpi->Y1round[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.Y1dequant[Q][rc] = quant_val;
- cpi->zrun_zbin_boost_y1[Q][i] = (quant_val * zbin_boost[i]) >> 7;
-
- quant_val = vp8_ac2quant(Q, cpi->common.y2ac_delta_q);
- cpi->Y2quant[Q][rc] = (1 << 16) / quant_val;
- cpi->Y2zbin[Q][rc] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7;
- cpi->Y2round[Q][rc] = (qrounding_factors_y2[Q] * quant_val) >> 7;
- cpi->common.Y2dequant[Q][rc] = quant_val;
- cpi->zrun_zbin_boost_y2[Q][i] = (quant_val * zbin_boost[i]) >> 7;
-
- quant_val = vp8_ac_uv_quant(Q, cpi->common.uvac_delta_q);
- cpi->UVquant[Q][rc] = (1 << 16) / quant_val;
- cpi->UVzbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7;
- cpi->UVround[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7;
- cpi->common.UVdequant[Q][rc] = quant_val;
- cpi->zrun_zbin_boost_uv[Q][i] = (quant_val * zbin_boost[i]) >> 7;
- }
- }
-}
-#endif
-
-#define ZBIN_EXTRA_Y \
- (( cpi->common.Y1dequant[QIndex][1] * \
- ( x->zbin_over_quant + \
- x->zbin_mode_boost + \
- x->act_zbin_adj ) ) >> 7)
-
-#define ZBIN_EXTRA_UV \
- (( cpi->common.UVdequant[QIndex][1] * \
- ( x->zbin_over_quant + \
- x->zbin_mode_boost + \
- x->act_zbin_adj ) ) >> 7)
-
-#define ZBIN_EXTRA_Y2 \
- (( cpi->common.Y2dequant[QIndex][1] * \
- ( (x->zbin_over_quant / 2) + \
- x->zbin_mode_boost + \
- x->act_zbin_adj ) ) >> 7)
-
-void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x, int ok_to_skip)
-{
- int i;
- int QIndex;
- MACROBLOCKD *xd = &x->e_mbd;
- int zbin_extra;
-
- /* Select the baseline MB Q index. */
- if (xd->segmentation_enabled)
- {
- /* Abs Value */
- if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
- QIndex = xd->segment_feature_data[MB_LVL_ALT_Q][xd->mode_info_context->mbmi.segment_id];
- /* Delta Value */
- else
- {
- QIndex = cpi->common.base_qindex + xd->segment_feature_data[MB_LVL_ALT_Q][xd->mode_info_context->mbmi.segment_id];
- /* Clamp to valid range */
- QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;
- }
- }
- else
- QIndex = cpi->common.base_qindex;
-
- /* This initialization should be called at least once. Use ok_to_skip to
- * decide if it is ok to skip.
- * Before encoding a frame, this function is always called with ok_to_skip
- * =0, which means no skiping of calculations. The "last" values are
- * initialized at that time.
- */
- if (!ok_to_skip || QIndex != x->q_index)
- {
-
- xd->dequant_y1_dc[0] = 1;
- xd->dequant_y1[0] = cpi->common.Y1dequant[QIndex][0];
- xd->dequant_y2[0] = cpi->common.Y2dequant[QIndex][0];
- xd->dequant_uv[0] = cpi->common.UVdequant[QIndex][0];
-
- for (i = 1; i < 16; i++)
- {
- xd->dequant_y1_dc[i] =
- xd->dequant_y1[i] = cpi->common.Y1dequant[QIndex][1];
- xd->dequant_y2[i] = cpi->common.Y2dequant[QIndex][1];
- xd->dequant_uv[i] = cpi->common.UVdequant[QIndex][1];
- }
-#if 1
- /*TODO: Remove dequant from BLOCKD. This is a temporary solution until
- * the quantizer code uses a passed in pointer to the dequant constants.
- * This will also require modifications to the x86 and neon assembly.
- * */
- for (i = 0; i < 16; i++)
- x->e_mbd.block[i].dequant = xd->dequant_y1;
- for (i = 16; i < 24; i++)
- x->e_mbd.block[i].dequant = xd->dequant_uv;
- x->e_mbd.block[24].dequant = xd->dequant_y2;
-#endif
-
- /* Y */
- zbin_extra = ZBIN_EXTRA_Y;
-
- for (i = 0; i < 16; i++)
- {
- x->block[i].quant = cpi->Y1quant[QIndex];
- x->block[i].quant_fast = cpi->Y1quant_fast[QIndex];
- x->block[i].quant_shift = cpi->Y1quant_shift[QIndex];
- x->block[i].zbin = cpi->Y1zbin[QIndex];
- x->block[i].round = cpi->Y1round[QIndex];
- x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex];
- x->block[i].zbin_extra = (short)zbin_extra;
- }
-
- /* UV */
- zbin_extra = ZBIN_EXTRA_UV;
-
- for (i = 16; i < 24; i++)
- {
- x->block[i].quant = cpi->UVquant[QIndex];
- x->block[i].quant_fast = cpi->UVquant_fast[QIndex];
- x->block[i].quant_shift = cpi->UVquant_shift[QIndex];
- x->block[i].zbin = cpi->UVzbin[QIndex];
- x->block[i].round = cpi->UVround[QIndex];
- x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[QIndex];
- x->block[i].zbin_extra = (short)zbin_extra;
- }
-
- /* Y2 */
- zbin_extra = ZBIN_EXTRA_Y2;
-
- x->block[24].quant_fast = cpi->Y2quant_fast[QIndex];
- x->block[24].quant = cpi->Y2quant[QIndex];
- x->block[24].quant_shift = cpi->Y2quant_shift[QIndex];
- x->block[24].zbin = cpi->Y2zbin[QIndex];
- x->block[24].round = cpi->Y2round[QIndex];
- x->block[24].zrun_zbin_boost = cpi->zrun_zbin_boost_y2[QIndex];
- x->block[24].zbin_extra = (short)zbin_extra;
-
- /* save this macroblock QIndex for vp8_update_zbin_extra() */
- x->q_index = QIndex;
-
- x->last_zbin_over_quant = x->zbin_over_quant;
- x->last_zbin_mode_boost = x->zbin_mode_boost;
- x->last_act_zbin_adj = x->act_zbin_adj;
-
-
-
- }
- else if(x->last_zbin_over_quant != x->zbin_over_quant
- || x->last_zbin_mode_boost != x->zbin_mode_boost
- || x->last_act_zbin_adj != x->act_zbin_adj)
- {
- /* Y */
- zbin_extra = ZBIN_EXTRA_Y;
-
- for (i = 0; i < 16; i++)
- x->block[i].zbin_extra = (short)zbin_extra;
-
- /* UV */
- zbin_extra = ZBIN_EXTRA_UV;
-
- for (i = 16; i < 24; i++)
- x->block[i].zbin_extra = (short)zbin_extra;
-
- /* Y2 */
- zbin_extra = ZBIN_EXTRA_Y2;
- x->block[24].zbin_extra = (short)zbin_extra;
-
- x->last_zbin_over_quant = x->zbin_over_quant;
- x->last_zbin_mode_boost = x->zbin_mode_boost;
- x->last_act_zbin_adj = x->act_zbin_adj;
- }
-}
-
-void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x)
-{
- int i;
- int QIndex = x->q_index;
- int zbin_extra;
-
- /* Y */
- zbin_extra = ZBIN_EXTRA_Y;
-
- for (i = 0; i < 16; i++)
- x->block[i].zbin_extra = (short)zbin_extra;
-
- /* UV */
- zbin_extra = ZBIN_EXTRA_UV;
-
- for (i = 16; i < 24; i++)
- x->block[i].zbin_extra = (short)zbin_extra;
-
- /* Y2 */
- zbin_extra = ZBIN_EXTRA_Y2;
- x->block[24].zbin_extra = (short)zbin_extra;
-}
-#undef ZBIN_EXTRA_Y
-#undef ZBIN_EXTRA_UV
-#undef ZBIN_EXTRA_Y2
-
-void vp8cx_frame_init_quantizer(VP8_COMP *cpi)
-{
- /* Clear Zbin mode boost for default case */
- cpi->mb.zbin_mode_boost = 0;
-
- /* MB level quantizer setup */
- vp8cx_mb_init_quantizer(cpi, &cpi->mb, 0);
-}
-
-
-void vp8_set_quantizer(struct VP8_COMP *cpi, int Q)
-{
- VP8_COMMON *cm = &cpi->common;
- MACROBLOCKD *mbd = &cpi->mb.e_mbd;
- int update = 0;
- int new_delta_q;
- cm->base_qindex = Q;
-
- /* if any of the delta_q values are changing update flag has to be set */
- /* currently only y2dc_delta_q may change */
-
- cm->y1dc_delta_q = 0;
- cm->y2ac_delta_q = 0;
- cm->uvdc_delta_q = 0;
- cm->uvac_delta_q = 0;
-
- if (Q < 4)
- {
- new_delta_q = 4-Q;
- }
- else
- new_delta_q = 0;
-
- update |= cm->y2dc_delta_q != new_delta_q;
- cm->y2dc_delta_q = new_delta_q;
-
-
- /* Set Segment specific quatizers */
- mbd->segment_feature_data[MB_LVL_ALT_Q][0] = cpi->segment_feature_data[MB_LVL_ALT_Q][0];
- mbd->segment_feature_data[MB_LVL_ALT_Q][1] = cpi->segment_feature_data[MB_LVL_ALT_Q][1];
- mbd->segment_feature_data[MB_LVL_ALT_Q][2] = cpi->segment_feature_data[MB_LVL_ALT_Q][2];
- mbd->segment_feature_data[MB_LVL_ALT_Q][3] = cpi->segment_feature_data[MB_LVL_ALT_Q][3];
-
- /* quantizer has to be reinitialized for any delta_q changes */
- if(update)
- vp8cx_init_quantizer(cpi);
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.h
deleted file mode 100644
index c739b26..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/quantize.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_QUANTIZE_H_
-#define VP8_ENCODER_QUANTIZE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP8_COMP;
-struct macroblock;
-extern void vp8_set_quantizer(struct VP8_COMP *cpi, int Q);
-extern void vp8cx_frame_init_quantizer(struct VP8_COMP *cpi);
-extern void vp8_update_zbin_extra(struct VP8_COMP *cpi, struct macroblock *x);
-extern void vp8cx_mb_init_quantizer(struct VP8_COMP *cpi, struct macroblock *x, int ok_to_skip);
-extern void vp8cx_init_quantizer(struct VP8_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_QUANTIZE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.c
deleted file mode 100644
index 77e4ce7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.c
+++ /dev/null
@@ -1,1555 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-
-#include "math.h"
-#include "vp8/common/common.h"
-#include "ratectrl.h"
-#include "vp8/common/entropymode.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/systemdependent.h"
-#include "encodemv.h"
-
-
-#define MIN_BPB_FACTOR 0.01
-#define MAX_BPB_FACTOR 50
-
-extern const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES];
-
-
-
-#ifdef MODE_STATS
-extern int y_modes[5];
-extern int uv_modes[4];
-extern int b_modes[10];
-
-extern int inter_y_modes[10];
-extern int inter_uv_modes[4];
-extern int inter_b_modes[10];
-#endif
-
-/* Bits Per MB at different Q (Multiplied by 512) */
-#define BPER_MB_NORMBITS 9
-
-/* Work in progress recalibration of baseline rate tables based on
- * the assumption that bits per mb is inversely proportional to the
- * quantizer value.
- */
-const int vp8_bits_per_mb[2][QINDEX_RANGE] =
-{
- /* Intra case 450000/Qintra */
- {
- 1125000,900000, 750000, 642857, 562500, 500000, 450000, 450000,
- 409090, 375000, 346153, 321428, 300000, 281250, 264705, 264705,
- 250000, 236842, 225000, 225000, 214285, 214285, 204545, 204545,
- 195652, 195652, 187500, 180000, 180000, 173076, 166666, 160714,
- 155172, 150000, 145161, 140625, 136363, 132352, 128571, 125000,
- 121621, 121621, 118421, 115384, 112500, 109756, 107142, 104651,
- 102272, 100000, 97826, 97826, 95744, 93750, 91836, 90000,
- 88235, 86538, 84905, 83333, 81818, 80357, 78947, 77586,
- 76271, 75000, 73770, 72580, 71428, 70312, 69230, 68181,
- 67164, 66176, 65217, 64285, 63380, 62500, 61643, 60810,
- 60000, 59210, 59210, 58441, 57692, 56962, 56250, 55555,
- 54878, 54216, 53571, 52941, 52325, 51724, 51136, 50561,
- 49450, 48387, 47368, 46875, 45918, 45000, 44554, 44117,
- 43269, 42452, 41666, 40909, 40178, 39473, 38793, 38135,
- 36885, 36290, 35714, 35156, 34615, 34090, 33582, 33088,
- 32608, 32142, 31468, 31034, 30405, 29801, 29220, 28662,
- },
- /* Inter case 285000/Qinter */
- {
- 712500, 570000, 475000, 407142, 356250, 316666, 285000, 259090,
- 237500, 219230, 203571, 190000, 178125, 167647, 158333, 150000,
- 142500, 135714, 129545, 123913, 118750, 114000, 109615, 105555,
- 101785, 98275, 95000, 91935, 89062, 86363, 83823, 81428,
- 79166, 77027, 75000, 73076, 71250, 69512, 67857, 66279,
- 64772, 63333, 61956, 60638, 59375, 58163, 57000, 55882,
- 54807, 53773, 52777, 51818, 50892, 50000, 49137, 47500,
- 45967, 44531, 43181, 41911, 40714, 39583, 38513, 37500,
- 36538, 35625, 34756, 33928, 33139, 32386, 31666, 30978,
- 30319, 29687, 29081, 28500, 27941, 27403, 26886, 26388,
- 25909, 25446, 25000, 24568, 23949, 23360, 22800, 22265,
- 21755, 21268, 20802, 20357, 19930, 19520, 19127, 18750,
- 18387, 18037, 17701, 17378, 17065, 16764, 16473, 16101,
- 15745, 15405, 15079, 14766, 14467, 14179, 13902, 13636,
- 13380, 13133, 12895, 12666, 12445, 12179, 11924, 11632,
- 11445, 11220, 11003, 10795, 10594, 10401, 10215, 10035,
- }
-};
-
-static const int kf_boost_qadjustment[QINDEX_RANGE] =
-{
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167,
- 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 200, 201, 201, 202, 203, 203, 203,
- 204, 204, 205, 205, 206, 206, 207, 207,
- 208, 208, 209, 209, 210, 210, 211, 211,
- 212, 212, 213, 213, 214, 214, 215, 215,
- 216, 216, 217, 217, 218, 218, 219, 219,
- 220, 220, 220, 220, 220, 220, 220, 220,
- 220, 220, 220, 220, 220, 220, 220, 220,
-};
-
-/* #define GFQ_ADJUSTMENT (Q+100) */
-#define GFQ_ADJUSTMENT vp8_gf_boost_qadjustment[Q]
-const int vp8_gf_boost_qadjustment[QINDEX_RANGE] =
-{
- 80, 82, 84, 86, 88, 90, 92, 94,
- 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167,
- 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 184, 185, 185, 186, 186, 187, 187,
- 188, 188, 189, 189, 190, 190, 191, 191,
- 192, 192, 193, 193, 194, 194, 194, 194,
- 195, 195, 196, 196, 197, 197, 198, 198
-};
-
-/*
-const int vp8_gf_boost_qadjustment[QINDEX_RANGE] =
-{
- 100,101,102,103,104,105,105,106,
- 106,107,107,108,109,109,110,111,
- 112,113,114,115,116,117,118,119,
- 120,121,122,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,
- 136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,
- 152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,
- 168,169,170,170,171,171,172,172,
- 173,173,173,174,174,174,175,175,
- 175,176,176,176,177,177,177,177,
- 178,178,179,179,180,180,181,181,
- 182,182,183,183,184,184,185,185,
- 186,186,187,187,188,188,189,189,
- 190,190,191,191,192,192,193,193,
-};
-*/
-
-static const int kf_gf_boost_qlimits[QINDEX_RANGE] =
-{
- 150, 155, 160, 165, 170, 175, 180, 185,
- 190, 195, 200, 205, 210, 215, 220, 225,
- 230, 235, 240, 245, 250, 255, 260, 265,
- 270, 275, 280, 285, 290, 295, 300, 305,
- 310, 320, 330, 340, 350, 360, 370, 380,
- 390, 400, 410, 420, 430, 440, 450, 460,
- 470, 480, 490, 500, 510, 520, 530, 540,
- 550, 560, 570, 580, 590, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
- 600, 600, 600, 600, 600, 600, 600, 600,
-};
-
-static const int gf_adjust_table[101] =
-{
- 100,
- 115, 130, 145, 160, 175, 190, 200, 210, 220, 230,
- 240, 260, 270, 280, 290, 300, 310, 320, 330, 340,
- 350, 360, 370, 380, 390, 400, 400, 400, 400, 400,
- 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
- 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
- 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
- 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
- 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
- 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
- 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
-};
-
-static const int gf_intra_usage_adjustment[20] =
-{
- 125, 120, 115, 110, 105, 100, 95, 85, 80, 75,
- 70, 65, 60, 55, 50, 50, 50, 50, 50, 50,
-};
-
-static const int gf_interval_table[101] =
-{
- 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-};
-
-static const unsigned int prior_key_frame_weight[KEY_FRAME_CONTEXT] = { 1, 2, 3, 4, 5 };
-
-
-void vp8_save_coding_context(VP8_COMP *cpi)
-{
- CODING_CONTEXT *const cc = & cpi->coding_context;
-
- /* Stores a snapshot of key state variables which can subsequently be
- * restored with a call to vp8_restore_coding_context. These functions are
- * intended for use in a re-code loop in vp8_compress_frame where the
- * quantizer value is adjusted between loop iterations.
- */
-
- cc->frames_since_key = cpi->frames_since_key;
- cc->filter_level = cpi->common.filter_level;
- cc->frames_till_gf_update_due = cpi->frames_till_gf_update_due;
- cc->frames_since_golden = cpi->frames_since_golden;
-
- vp8_copy(cc->mvc, cpi->common.fc.mvc);
- vp8_copy(cc->mvcosts, cpi->rd_costs.mvcosts);
-
- vp8_copy(cc->ymode_prob, cpi->common.fc.ymode_prob);
- vp8_copy(cc->uv_mode_prob, cpi->common.fc.uv_mode_prob);
-
- vp8_copy(cc->ymode_count, cpi->mb.ymode_count);
- vp8_copy(cc->uv_mode_count, cpi->mb.uv_mode_count);
-
-
- /* Stats */
-#ifdef MODE_STATS
- vp8_copy(cc->y_modes, y_modes);
- vp8_copy(cc->uv_modes, uv_modes);
- vp8_copy(cc->b_modes, b_modes);
- vp8_copy(cc->inter_y_modes, inter_y_modes);
- vp8_copy(cc->inter_uv_modes, inter_uv_modes);
- vp8_copy(cc->inter_b_modes, inter_b_modes);
-#endif
-
- cc->this_frame_percent_intra = cpi->this_frame_percent_intra;
-}
-
-
-void vp8_restore_coding_context(VP8_COMP *cpi)
-{
- CODING_CONTEXT *const cc = & cpi->coding_context;
-
- /* Restore key state variables to the snapshot state stored in the
- * previous call to vp8_save_coding_context.
- */
-
- cpi->frames_since_key = cc->frames_since_key;
- cpi->common.filter_level = cc->filter_level;
- cpi->frames_till_gf_update_due = cc->frames_till_gf_update_due;
- cpi->frames_since_golden = cc->frames_since_golden;
-
- vp8_copy(cpi->common.fc.mvc, cc->mvc);
-
- vp8_copy(cpi->rd_costs.mvcosts, cc->mvcosts);
-
- vp8_copy(cpi->common.fc.ymode_prob, cc->ymode_prob);
- vp8_copy(cpi->common.fc.uv_mode_prob, cc->uv_mode_prob);
-
- vp8_copy(cpi->mb.ymode_count, cc->ymode_count);
- vp8_copy(cpi->mb.uv_mode_count, cc->uv_mode_count);
-
- /* Stats */
-#ifdef MODE_STATS
- vp8_copy(y_modes, cc->y_modes);
- vp8_copy(uv_modes, cc->uv_modes);
- vp8_copy(b_modes, cc->b_modes);
- vp8_copy(inter_y_modes, cc->inter_y_modes);
- vp8_copy(inter_uv_modes, cc->inter_uv_modes);
- vp8_copy(inter_b_modes, cc->inter_b_modes);
-#endif
-
-
- cpi->this_frame_percent_intra = cc->this_frame_percent_intra;
-}
-
-
-void vp8_setup_key_frame(VP8_COMP *cpi)
-{
- /* Setup for Key frame: */
-
- vp8_default_coef_probs(& cpi->common);
-
- vpx_memcpy(cpi->common.fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context));
- {
- int flag[2] = {1, 1};
- vp8_build_component_cost_table(cpi->mb.mvcost, (const MV_CONTEXT *) cpi->common.fc.mvc, flag);
- }
-
- /* Make sure we initialize separate contexts for altref,gold, and normal.
- * TODO shouldn't need 3 different copies of structure to do this!
- */
- vpx_memcpy(&cpi->lfc_a, &cpi->common.fc, sizeof(cpi->common.fc));
- vpx_memcpy(&cpi->lfc_g, &cpi->common.fc, sizeof(cpi->common.fc));
- vpx_memcpy(&cpi->lfc_n, &cpi->common.fc, sizeof(cpi->common.fc));
-
- cpi->common.filter_level = cpi->common.base_qindex * 3 / 8 ;
-
- /* Provisional interval before next GF */
- if (cpi->auto_gold)
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
- else
- cpi->frames_till_gf_update_due = DEFAULT_GF_INTERVAL;
-
- cpi->common.refresh_golden_frame = 1;
- cpi->common.refresh_alt_ref_frame = 1;
-}
-
-
-static int estimate_bits_at_q(int frame_kind, int Q, int MBs,
- double correction_factor)
-{
- int Bpm = (int)(.5 + correction_factor * vp8_bits_per_mb[frame_kind][Q]);
-
- /* Attempt to retain reasonable accuracy without overflow. The cutoff is
- * chosen such that the maximum product of Bpm and MBs fits 31 bits. The
- * largest Bpm takes 20 bits.
- */
- if (MBs > (1 << 11))
- return (Bpm >> BPER_MB_NORMBITS) * MBs;
- else
- return (Bpm * MBs) >> BPER_MB_NORMBITS;
-}
-
-
-static void calc_iframe_target_size(VP8_COMP *cpi)
-{
- /* boost defaults to half second */
- int kf_boost;
- uint64_t target;
-
- /* Clear down mmx registers to allow floating point in what follows */
- vp8_clear_system_state();
-
- if (cpi->oxcf.fixed_q >= 0)
- {
- int Q = cpi->oxcf.key_q;
-
- target = estimate_bits_at_q(INTRA_FRAME, Q, cpi->common.MBs,
- cpi->key_frame_rate_correction_factor);
- }
- else if (cpi->pass == 2)
- {
- /* New Two pass RC */
- target = cpi->per_frame_bandwidth;
- }
- /* First Frame is a special case */
- else if (cpi->common.current_video_frame == 0)
- {
- /* 1 Pass there is no information on which to base size so use
- * bandwidth per second * fraction of the initial buffer
- * level
- */
- target = cpi->oxcf.starting_buffer_level / 2;
-
- if(target > cpi->oxcf.target_bandwidth * 3 / 2)
- target = cpi->oxcf.target_bandwidth * 3 / 2;
- }
- else
- {
- /* if this keyframe was forced, use a more recent Q estimate */
- int Q = (cpi->common.frame_flags & FRAMEFLAGS_KEY)
- ? cpi->avg_frame_qindex : cpi->ni_av_qi;
-
- int initial_boost = 32; /* |3.0 * per_frame_bandwidth| */
- /* Boost depends somewhat on frame rate: only used for 1 layer case. */
- if (cpi->oxcf.number_of_layers == 1) {
- kf_boost = MAX(initial_boost, (int)(2 * cpi->output_framerate - 16));
- }
- else {
- /* Initial factor: set target size to: |3.0 * per_frame_bandwidth|. */
- kf_boost = initial_boost;
- }
-
- /* adjustment up based on q: this factor ranges from ~1.2 to 2.2. */
- kf_boost = kf_boost * kf_boost_qadjustment[Q] / 100;
-
- /* frame separation adjustment ( down) */
- if (cpi->frames_since_key < cpi->output_framerate / 2)
- kf_boost = (int)(kf_boost
- * cpi->frames_since_key / (cpi->output_framerate / 2));
-
- /* Minimal target size is |2* per_frame_bandwidth|. */
- if (kf_boost < 16)
- kf_boost = 16;
-
- target = ((16 + kf_boost) * cpi->per_frame_bandwidth) >> 4;
- }
-
-
- if (cpi->oxcf.rc_max_intra_bitrate_pct)
- {
- unsigned int max_rate = cpi->per_frame_bandwidth
- * cpi->oxcf.rc_max_intra_bitrate_pct / 100;
-
- if (target > max_rate)
- target = max_rate;
- }
-
- cpi->this_frame_target = (int)target;
-
- /* TODO: if we separate rate targeting from Q targetting, move this.
- * Reset the active worst quality to the baseline value for key frames.
- */
- if (cpi->pass != 2)
- cpi->active_worst_quality = cpi->worst_quality;
-
-#if 0
- {
- FILE *f;
-
- f = fopen("kf_boost.stt", "a");
- fprintf(f, " %8u %10d %10d %10d\n",
- cpi->common.current_video_frame, cpi->gfu_boost, cpi->baseline_gf_interval, cpi->source_alt_ref_pending);
-
- fclose(f);
- }
-#endif
-}
-
-
-/* Do the best we can to define the parameters for the next GF based on what
- * information we have available.
- */
-static void calc_gf_params(VP8_COMP *cpi)
-{
- int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
- int Boost = 0;
-
- int gf_frame_useage = 0; /* Golden frame useage since last GF */
- int tot_mbs = cpi->recent_ref_frame_usage[INTRA_FRAME] +
- cpi->recent_ref_frame_usage[LAST_FRAME] +
- cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
- cpi->recent_ref_frame_usage[ALTREF_FRAME];
-
- int pct_gf_active = (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
-
- if (tot_mbs)
- gf_frame_useage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] + cpi->recent_ref_frame_usage[ALTREF_FRAME]) * 100 / tot_mbs;
-
- if (pct_gf_active > gf_frame_useage)
- gf_frame_useage = pct_gf_active;
-
- /* Not two pass */
- if (cpi->pass != 2)
- {
- /* Single Pass lagged mode: TBD */
- if (0)
- {
- }
-
- /* Single Pass compression: Has to use current and historical data */
- else
- {
-#if 0
- /* Experimental code */
- int index = cpi->one_pass_frame_index;
- int frames_to_scan = (cpi->max_gf_interval <= MAX_LAG_BUFFERS) ? cpi->max_gf_interval : MAX_LAG_BUFFERS;
-
- /* ************** Experimental code - incomplete */
- /*
- double decay_val = 1.0;
- double IIAccumulator = 0.0;
- double last_iiaccumulator = 0.0;
- double IIRatio;
-
- cpi->one_pass_frame_index = cpi->common.current_video_frame%MAX_LAG_BUFFERS;
-
- for ( i = 0; i < (frames_to_scan - 1); i++ )
- {
- if ( index < 0 )
- index = MAX_LAG_BUFFERS;
- index --;
-
- if ( cpi->one_pass_frame_stats[index].frame_coded_error > 0.0 )
- {
- IIRatio = cpi->one_pass_frame_stats[index].frame_intra_error / cpi->one_pass_frame_stats[index].frame_coded_error;
-
- if ( IIRatio > 30.0 )
- IIRatio = 30.0;
- }
- else
- IIRatio = 30.0;
-
- IIAccumulator += IIRatio * decay_val;
-
- decay_val = decay_val * cpi->one_pass_frame_stats[index].frame_pcnt_inter;
-
- if ( (i > MIN_GF_INTERVAL) &&
- ((IIAccumulator - last_iiaccumulator) < 2.0) )
- {
- break;
- }
- last_iiaccumulator = IIAccumulator;
- }
-
- Boost = IIAccumulator*100.0/16.0;
- cpi->baseline_gf_interval = i;
-
- */
-#else
-
- /*************************************************************/
- /* OLD code */
-
- /* Adjust boost based upon ambient Q */
- Boost = GFQ_ADJUSTMENT;
-
- /* Adjust based upon most recently measure intra useage */
- Boost = Boost * gf_intra_usage_adjustment[(cpi->this_frame_percent_intra < 15) ? cpi->this_frame_percent_intra : 14] / 100;
-
- /* Adjust gf boost based upon GF usage since last GF */
- Boost = Boost * gf_adjust_table[gf_frame_useage] / 100;
-#endif
- }
-
- /* golden frame boost without recode loop often goes awry. be
- * safe by keeping numbers down.
- */
- if (!cpi->sf.recode_loop)
- {
- if (cpi->compressor_speed == 2)
- Boost = Boost / 2;
- }
-
- /* Apply an upper limit based on Q for 1 pass encodes */
- if (Boost > kf_gf_boost_qlimits[Q] && (cpi->pass == 0))
- Boost = kf_gf_boost_qlimits[Q];
-
- /* Apply lower limits to boost. */
- else if (Boost < 110)
- Boost = 110;
-
- /* Note the boost used */
- cpi->last_boost = Boost;
-
- }
-
- /* Estimate next interval
- * This is updated once the real frame size/boost is known.
- */
- if (cpi->oxcf.fixed_q == -1)
- {
- if (cpi->pass == 2) /* 2 Pass */
- {
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
- }
- else /* 1 Pass */
- {
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
-
- if (cpi->last_boost > 750)
- cpi->frames_till_gf_update_due++;
-
- if (cpi->last_boost > 1000)
- cpi->frames_till_gf_update_due++;
-
- if (cpi->last_boost > 1250)
- cpi->frames_till_gf_update_due++;
-
- if (cpi->last_boost >= 1500)
- cpi->frames_till_gf_update_due ++;
-
- if (gf_interval_table[gf_frame_useage] > cpi->frames_till_gf_update_due)
- cpi->frames_till_gf_update_due = gf_interval_table[gf_frame_useage];
-
- if (cpi->frames_till_gf_update_due > cpi->max_gf_interval)
- cpi->frames_till_gf_update_due = cpi->max_gf_interval;
- }
- }
- else
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
-
- /* ARF on or off */
- if (cpi->pass != 2)
- {
- /* For now Alt ref is not allowed except in 2 pass modes. */
- cpi->source_alt_ref_pending = 0;
-
- /*if ( cpi->oxcf.fixed_q == -1)
- {
- if ( cpi->oxcf.play_alternate && (cpi->last_boost > (100 + (AF_THRESH*cpi->frames_till_gf_update_due)) ) )
- cpi->source_alt_ref_pending = 1;
- else
- cpi->source_alt_ref_pending = 0;
- }*/
- }
-}
-
-
-static void calc_pframe_target_size(VP8_COMP *cpi)
-{
- int min_frame_target;
- int old_per_frame_bandwidth = cpi->per_frame_bandwidth;
-
- if ( cpi->current_layer > 0)
- cpi->per_frame_bandwidth =
- cpi->layer_context[cpi->current_layer].avg_frame_size_for_layer;
-
- min_frame_target = 0;
-
- if (cpi->pass == 2)
- {
- min_frame_target = cpi->min_frame_bandwidth;
-
- if (min_frame_target < (cpi->av_per_frame_bandwidth >> 5))
- min_frame_target = cpi->av_per_frame_bandwidth >> 5;
- }
- else if (min_frame_target < cpi->per_frame_bandwidth / 4)
- min_frame_target = cpi->per_frame_bandwidth / 4;
-
-
- /* Special alt reference frame case */
- if((cpi->common.refresh_alt_ref_frame) && (cpi->oxcf.number_of_layers == 1))
- {
- if (cpi->pass == 2)
- {
- /* Per frame bit target for the alt ref frame */
- cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
- cpi->this_frame_target = cpi->per_frame_bandwidth;
- }
-
- /* One Pass ??? TBD */
- }
-
- /* Normal frames (gf,and inter) */
- else
- {
- /* 2 pass */
- if (cpi->pass == 2)
- {
- cpi->this_frame_target = cpi->per_frame_bandwidth;
- }
- /* 1 pass */
- else
- {
- int Adjustment;
- /* Make rate adjustment to recover bits spent in key frame
- * Test to see if the key frame inter data rate correction
- * should still be in force
- */
- if (cpi->kf_overspend_bits > 0)
- {
- Adjustment = (cpi->kf_bitrate_adjustment <= cpi->kf_overspend_bits) ? cpi->kf_bitrate_adjustment : cpi->kf_overspend_bits;
-
- if (Adjustment > (cpi->per_frame_bandwidth - min_frame_target))
- Adjustment = (cpi->per_frame_bandwidth - min_frame_target);
-
- cpi->kf_overspend_bits -= Adjustment;
-
- /* Calculate an inter frame bandwidth target for the next
- * few frames designed to recover any extra bits spent on
- * the key frame.
- */
- cpi->this_frame_target = cpi->per_frame_bandwidth - Adjustment;
-
- if (cpi->this_frame_target < min_frame_target)
- cpi->this_frame_target = min_frame_target;
- }
- else
- cpi->this_frame_target = cpi->per_frame_bandwidth;
-
- /* If appropriate make an adjustment to recover bits spent on a
- * recent GF
- */
- if ((cpi->gf_overspend_bits > 0) && (cpi->this_frame_target > min_frame_target))
- {
- Adjustment = (cpi->non_gf_bitrate_adjustment <= cpi->gf_overspend_bits) ? cpi->non_gf_bitrate_adjustment : cpi->gf_overspend_bits;
-
- if (Adjustment > (cpi->this_frame_target - min_frame_target))
- Adjustment = (cpi->this_frame_target - min_frame_target);
-
- cpi->gf_overspend_bits -= Adjustment;
- cpi->this_frame_target -= Adjustment;
- }
-
- /* Apply small + and - boosts for non gf frames */
- if ((cpi->last_boost > 150) && (cpi->frames_till_gf_update_due > 0) &&
- (cpi->current_gf_interval >= (MIN_GF_INTERVAL << 1)))
- {
- /* % Adjustment limited to the range 1% to 10% */
- Adjustment = (cpi->last_boost - 100) >> 5;
-
- if (Adjustment < 1)
- Adjustment = 1;
- else if (Adjustment > 10)
- Adjustment = 10;
-
- /* Convert to bits */
- Adjustment = (cpi->this_frame_target * Adjustment) / 100;
-
- if (Adjustment > (cpi->this_frame_target - min_frame_target))
- Adjustment = (cpi->this_frame_target - min_frame_target);
-
- if (cpi->frames_since_golden == (uint32_t)(cpi->current_gf_interval >> 1))
- cpi->this_frame_target += ((cpi->current_gf_interval - 1) * Adjustment);
- else
- cpi->this_frame_target -= Adjustment;
- }
- }
- }
-
- /* Sanity check that the total sum of adjustments is not above the
- * maximum allowed That is that having allowed for KF and GF penalties
- * we have not pushed the current interframe target to low. If the
- * adjustment we apply here is not capable of recovering all the extra
- * bits we have spent in the KF or GF then the remainder will have to
- * be recovered over a longer time span via other buffer / rate control
- * mechanisms.
- */
- if (cpi->this_frame_target < min_frame_target)
- cpi->this_frame_target = min_frame_target;
-
- if (!cpi->common.refresh_alt_ref_frame)
- /* Note the baseline target data rate for this inter frame. */
- cpi->inter_frame_target = cpi->this_frame_target;
-
- /* One Pass specific code */
- if (cpi->pass == 0)
- {
- /* Adapt target frame size with respect to any buffering constraints: */
- if (cpi->buffered_mode)
- {
- int one_percent_bits = (int)
- (1 + cpi->oxcf.optimal_buffer_level / 100);
-
- if ((cpi->buffer_level < cpi->oxcf.optimal_buffer_level) ||
- (cpi->bits_off_target < cpi->oxcf.optimal_buffer_level))
- {
- int percent_low = 0;
-
- /* Decide whether or not we need to adjust the frame data
- * rate target.
- *
- * If we are are below the optimal buffer fullness level
- * and adherence to buffering constraints is important to
- * the end usage then adjust the per frame target.
- */
- if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
- (cpi->buffer_level < cpi->oxcf.optimal_buffer_level))
- {
- percent_low = (int)
- ((cpi->oxcf.optimal_buffer_level - cpi->buffer_level) /
- one_percent_bits);
- }
- /* Are we overshooting the long term clip data rate... */
- else if (cpi->bits_off_target < 0)
- {
- /* Adjust per frame data target downwards to compensate. */
- percent_low = (int)(100 * -cpi->bits_off_target /
- (cpi->total_byte_count * 8));
- }
-
- if (percent_low > cpi->oxcf.under_shoot_pct)
- percent_low = cpi->oxcf.under_shoot_pct;
- else if (percent_low < 0)
- percent_low = 0;
-
- /* lower the target bandwidth for this frame. */
- cpi->this_frame_target -=
- (cpi->this_frame_target * percent_low) / 200;
-
- /* Are we using allowing control of active_worst_allowed_q
- * according to buffer level.
- */
- if (cpi->auto_worst_q && cpi->ni_frames > 150)
- {
- int64_t critical_buffer_level;
-
- /* For streaming applications the most important factor is
- * cpi->buffer_level as this takes into account the
- * specified short term buffering constraints. However,
- * hitting the long term clip data rate target is also
- * important.
- */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- /* Take the smaller of cpi->buffer_level and
- * cpi->bits_off_target
- */
- critical_buffer_level =
- (cpi->buffer_level < cpi->bits_off_target)
- ? cpi->buffer_level : cpi->bits_off_target;
- }
- /* For local file playback short term buffering constraints
- * are less of an issue
- */
- else
- {
- /* Consider only how we are doing for the clip as a
- * whole
- */
- critical_buffer_level = cpi->bits_off_target;
- }
-
- /* Set the active worst quality based upon the selected
- * buffer fullness number.
- */
- if (critical_buffer_level < cpi->oxcf.optimal_buffer_level)
- {
- if ( critical_buffer_level >
- (cpi->oxcf.optimal_buffer_level >> 2) )
- {
- int64_t qadjustment_range =
- cpi->worst_quality - cpi->ni_av_qi;
- int64_t above_base =
- (critical_buffer_level -
- (cpi->oxcf.optimal_buffer_level >> 2));
-
- /* Step active worst quality down from
- * cpi->ni_av_qi when (critical_buffer_level ==
- * cpi->optimal_buffer_level) to
- * cpi->worst_quality when
- * (critical_buffer_level ==
- * cpi->optimal_buffer_level >> 2)
- */
- cpi->active_worst_quality =
- cpi->worst_quality -
- (int)((qadjustment_range * above_base) /
- (cpi->oxcf.optimal_buffer_level*3>>2));
- }
- else
- {
- cpi->active_worst_quality = cpi->worst_quality;
- }
- }
- else
- {
- cpi->active_worst_quality = cpi->ni_av_qi;
- }
- }
- else
- {
- cpi->active_worst_quality = cpi->worst_quality;
- }
- }
- else
- {
- int percent_high = 0;
-
- if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- && (cpi->buffer_level > cpi->oxcf.optimal_buffer_level))
- {
- percent_high = (int)((cpi->buffer_level
- - cpi->oxcf.optimal_buffer_level)
- / one_percent_bits);
- }
- else if (cpi->bits_off_target > cpi->oxcf.optimal_buffer_level)
- {
- percent_high = (int)((100 * cpi->bits_off_target)
- / (cpi->total_byte_count * 8));
- }
-
- if (percent_high > cpi->oxcf.over_shoot_pct)
- percent_high = cpi->oxcf.over_shoot_pct;
- else if (percent_high < 0)
- percent_high = 0;
-
- cpi->this_frame_target += (cpi->this_frame_target *
- percent_high) / 200;
-
- /* Are we allowing control of active_worst_allowed_q according
- * to buffer level.
- */
- if (cpi->auto_worst_q && cpi->ni_frames > 150)
- {
- /* When using the relaxed buffer model stick to the
- * user specified value
- */
- cpi->active_worst_quality = cpi->ni_av_qi;
- }
- else
- {
- cpi->active_worst_quality = cpi->worst_quality;
- }
- }
-
- /* Set active_best_quality to prevent quality rising too high */
- cpi->active_best_quality = cpi->best_quality;
-
- /* Worst quality obviously must not be better than best quality */
- if (cpi->active_worst_quality <= cpi->active_best_quality)
- cpi->active_worst_quality = cpi->active_best_quality + 1;
-
- if(cpi->active_worst_quality > 127)
- cpi->active_worst_quality = 127;
- }
- /* Unbuffered mode (eg. video conferencing) */
- else
- {
- /* Set the active worst quality */
- cpi->active_worst_quality = cpi->worst_quality;
- }
-
- /* Special trap for constrained quality mode
- * "active_worst_quality" may never drop below cq level
- * for any frame type.
- */
- if ( cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY &&
- cpi->active_worst_quality < cpi->cq_target_quality)
- {
- cpi->active_worst_quality = cpi->cq_target_quality;
- }
- }
-
- /* Test to see if we have to drop a frame
- * The auto-drop frame code is only used in buffered mode.
- * In unbufferd mode (eg vide conferencing) the descision to
- * code or drop a frame is made outside the codec in response to real
- * world comms or buffer considerations.
- */
- if (cpi->drop_frames_allowed &&
- (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
- ((cpi->common.frame_type != KEY_FRAME)))
- {
- /* Check for a buffer underun-crisis in which case we have to drop
- * a frame
- */
- if ((cpi->buffer_level < 0))
- {
-#if 0
- FILE *f = fopen("dec.stt", "a");
- fprintf(f, "%10d %10d %10d %10d ***** BUFFER EMPTY\n",
- (int) cpi->common.current_video_frame,
- cpi->decimation_factor, cpi->common.horiz_scale,
- (cpi->buffer_level * 100) / cpi->oxcf.optimal_buffer_level);
- fclose(f);
-#endif
- cpi->drop_frame = 1;
-
- /* Update the buffer level variable. */
- cpi->bits_off_target += cpi->av_per_frame_bandwidth;
- if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size)
- cpi->bits_off_target = (int)cpi->oxcf.maximum_buffer_size;
- cpi->buffer_level = cpi->bits_off_target;
-
- if (cpi->oxcf.number_of_layers > 1) {
- unsigned int i;
-
- // Propagate bits saved by dropping the frame to higher layers.
- for (i = cpi->current_layer + 1; i < cpi->oxcf.number_of_layers;
- i++) {
- LAYER_CONTEXT *lc = &cpi->layer_context[i];
- lc->bits_off_target += (int)(lc->target_bandwidth /
- lc->framerate);
- if (lc->bits_off_target > lc->maximum_buffer_size)
- lc->bits_off_target = lc->maximum_buffer_size;
- lc->buffer_level = lc->bits_off_target;
- }
- }
- }
- }
-
- /* Adjust target frame size for Golden Frames: */
- if (cpi->oxcf.error_resilient_mode == 0 &&
- (cpi->frames_till_gf_update_due == 0) && !cpi->drop_frame)
- {
- int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
-
- int gf_frame_useage = 0; /* Golden frame useage since last GF */
- int tot_mbs = cpi->recent_ref_frame_usage[INTRA_FRAME] +
- cpi->recent_ref_frame_usage[LAST_FRAME] +
- cpi->recent_ref_frame_usage[GOLDEN_FRAME] +
- cpi->recent_ref_frame_usage[ALTREF_FRAME];
-
- int pct_gf_active = (100 * cpi->gf_active_count) / (cpi->common.mb_rows * cpi->common.mb_cols);
-
- if (tot_mbs)
- gf_frame_useage = (cpi->recent_ref_frame_usage[GOLDEN_FRAME] + cpi->recent_ref_frame_usage[ALTREF_FRAME]) * 100 / tot_mbs;
-
- if (pct_gf_active > gf_frame_useage)
- gf_frame_useage = pct_gf_active;
-
- /* Is a fixed manual GF frequency being used */
- if (cpi->auto_gold)
- {
- /* For one pass throw a GF if recent frame intra useage is
- * low or the GF useage is high
- */
- if ((cpi->pass == 0) && (cpi->this_frame_percent_intra < 15 || gf_frame_useage >= 5))
- cpi->common.refresh_golden_frame = 1;
-
- /* Two pass GF descision */
- else if (cpi->pass == 2)
- cpi->common.refresh_golden_frame = 1;
- }
-
-#if 0
-
- /* Debug stats */
- if (0)
- {
- FILE *f;
-
- f = fopen("gf_useaget.stt", "a");
- fprintf(f, " %8ld %10ld %10ld %10ld %10ld\n",
- cpi->common.current_video_frame, cpi->gfu_boost, GFQ_ADJUSTMENT, cpi->gfu_boost, gf_frame_useage);
- fclose(f);
- }
-
-#endif
-
- if (cpi->common.refresh_golden_frame == 1)
- {
-#if 0
-
- if (0)
- {
- FILE *f;
-
- f = fopen("GFexit.stt", "a");
- fprintf(f, "%8ld GF coded\n", cpi->common.current_video_frame);
- fclose(f);
- }
-
-#endif
-
- if (cpi->auto_adjust_gold_quantizer)
- {
- calc_gf_params(cpi);
- }
-
- /* If we are using alternate ref instead of gf then do not apply the
- * boost It will instead be applied to the altref update Jims
- * modified boost
- */
- if (!cpi->source_alt_ref_active)
- {
- if (cpi->oxcf.fixed_q < 0)
- {
- if (cpi->pass == 2)
- {
- /* The spend on the GF is defined in the two pass
- * code for two pass encodes
- */
- cpi->this_frame_target = cpi->per_frame_bandwidth;
- }
- else
- {
- int Boost = cpi->last_boost;
- int frames_in_section = cpi->frames_till_gf_update_due + 1;
- int allocation_chunks = (frames_in_section * 100) + (Boost - 100);
- int bits_in_section = cpi->inter_frame_target * frames_in_section;
-
- /* Normalize Altboost and allocations chunck down to
- * prevent overflow
- */
- while (Boost > 1000)
- {
- Boost /= 2;
- allocation_chunks /= 2;
- }
-
- /* Avoid loss of precision but avoid overflow */
- if ((bits_in_section >> 7) > allocation_chunks)
- cpi->this_frame_target = Boost * (bits_in_section / allocation_chunks);
- else
- cpi->this_frame_target = (Boost * bits_in_section) / allocation_chunks;
- }
- }
- else
- cpi->this_frame_target =
- (estimate_bits_at_q(1, Q, cpi->common.MBs, 1.0)
- * cpi->last_boost) / 100;
-
- }
- /* If there is an active ARF at this location use the minimum
- * bits on this frame even if it is a contructed arf.
- * The active maximum quantizer insures that an appropriate
- * number of bits will be spent if needed for contstructed ARFs.
- */
- else
- {
- cpi->this_frame_target = 0;
- }
-
- cpi->current_gf_interval = cpi->frames_till_gf_update_due;
-
- }
- }
-
- cpi->per_frame_bandwidth = old_per_frame_bandwidth;
-}
-
-
-void vp8_update_rate_correction_factors(VP8_COMP *cpi, int damp_var)
-{
- int Q = cpi->common.base_qindex;
- int correction_factor = 100;
- double rate_correction_factor;
- double adjustment_limit;
-
- int projected_size_based_on_q = 0;
-
- /* Clear down mmx registers to allow floating point in what follows */
- vp8_clear_system_state();
-
- if (cpi->common.frame_type == KEY_FRAME)
- {
- rate_correction_factor = cpi->key_frame_rate_correction_factor;
- }
- else
- {
- if (cpi->oxcf.number_of_layers == 1 &&
- (cpi->common.refresh_alt_ref_frame ||
- cpi->common.refresh_golden_frame))
- rate_correction_factor = cpi->gf_rate_correction_factor;
- else
- rate_correction_factor = cpi->rate_correction_factor;
- }
-
- /* Work out how big we would have expected the frame to be at this Q
- * given the current correction factor. Stay in double to avoid int
- * overflow when values are large
- */
- projected_size_based_on_q = (int)(((.5 + rate_correction_factor * vp8_bits_per_mb[cpi->common.frame_type][Q]) * cpi->common.MBs) / (1 << BPER_MB_NORMBITS));
-
- /* Make some allowance for cpi->zbin_over_quant */
- if (cpi->mb.zbin_over_quant > 0)
- {
- int Z = cpi->mb.zbin_over_quant;
- double Factor = 0.99;
- double factor_adjustment = 0.01 / 256.0;
-
- while (Z > 0)
- {
- Z --;
- projected_size_based_on_q =
- (int)(Factor * projected_size_based_on_q);
- Factor += factor_adjustment;
-
- if (Factor >= 0.999)
- Factor = 0.999;
- }
- }
-
- /* Work out a size correction factor. */
- if (projected_size_based_on_q > 0)
- correction_factor = (100 * cpi->projected_frame_size) / projected_size_based_on_q;
-
- /* More heavily damped adjustment used if we have been oscillating
- * either side of target
- */
- switch (damp_var)
- {
- case 0:
- adjustment_limit = 0.75;
- break;
- case 1:
- adjustment_limit = 0.375;
- break;
- case 2:
- default:
- adjustment_limit = 0.25;
- break;
- }
-
- if (correction_factor > 102)
- {
- /* We are not already at the worst allowable quality */
- correction_factor = (int)(100.5 + ((correction_factor - 100) * adjustment_limit));
- rate_correction_factor = ((rate_correction_factor * correction_factor) / 100);
-
- /* Keep rate_correction_factor within limits */
- if (rate_correction_factor > MAX_BPB_FACTOR)
- rate_correction_factor = MAX_BPB_FACTOR;
- }
- else if (correction_factor < 99)
- {
- /* We are not already at the best allowable quality */
- correction_factor = (int)(100.5 - ((100 - correction_factor) * adjustment_limit));
- rate_correction_factor = ((rate_correction_factor * correction_factor) / 100);
-
- /* Keep rate_correction_factor within limits */
- if (rate_correction_factor < MIN_BPB_FACTOR)
- rate_correction_factor = MIN_BPB_FACTOR;
- }
-
- if (cpi->common.frame_type == KEY_FRAME)
- cpi->key_frame_rate_correction_factor = rate_correction_factor;
- else
- {
- if (cpi->oxcf.number_of_layers == 1 &&
- (cpi->common.refresh_alt_ref_frame ||
- cpi->common.refresh_golden_frame))
- cpi->gf_rate_correction_factor = rate_correction_factor;
- else
- cpi->rate_correction_factor = rate_correction_factor;
- }
-}
-
-
-int vp8_regulate_q(VP8_COMP *cpi, int target_bits_per_frame)
-{
- int Q = cpi->active_worst_quality;
-
- /* Reset Zbin OQ value */
- cpi->mb.zbin_over_quant = 0;
-
- if (cpi->oxcf.fixed_q >= 0)
- {
- Q = cpi->oxcf.fixed_q;
-
- if (cpi->common.frame_type == KEY_FRAME)
- {
- Q = cpi->oxcf.key_q;
- }
- else if (cpi->oxcf.number_of_layers == 1 &&
- cpi->common.refresh_alt_ref_frame)
- {
- Q = cpi->oxcf.alt_q;
- }
- else if (cpi->oxcf.number_of_layers == 1 &&
- cpi->common.refresh_golden_frame)
- {
- Q = cpi->oxcf.gold_q;
- }
- }
- else
- {
- int i;
- int last_error = INT_MAX;
- int target_bits_per_mb;
- int bits_per_mb_at_this_q;
- double correction_factor;
-
- /* Select the appropriate correction factor based upon type of frame. */
- if (cpi->common.frame_type == KEY_FRAME)
- correction_factor = cpi->key_frame_rate_correction_factor;
- else
- {
- if (cpi->oxcf.number_of_layers == 1 &&
- (cpi->common.refresh_alt_ref_frame ||
- cpi->common.refresh_golden_frame))
- correction_factor = cpi->gf_rate_correction_factor;
- else
- correction_factor = cpi->rate_correction_factor;
- }
-
- /* Calculate required scaling factor based on target frame size and
- * size of frame produced using previous Q
- */
- if (target_bits_per_frame >= (INT_MAX >> BPER_MB_NORMBITS))
- /* Case where we would overflow int */
- target_bits_per_mb = (target_bits_per_frame / cpi->common.MBs) << BPER_MB_NORMBITS;
- else
- target_bits_per_mb = (target_bits_per_frame << BPER_MB_NORMBITS) / cpi->common.MBs;
-
- i = cpi->active_best_quality;
-
- do
- {
- bits_per_mb_at_this_q = (int)(.5 + correction_factor * vp8_bits_per_mb[cpi->common.frame_type][i]);
-
- if (bits_per_mb_at_this_q <= target_bits_per_mb)
- {
- if ((target_bits_per_mb - bits_per_mb_at_this_q) <= last_error)
- Q = i;
- else
- Q = i - 1;
-
- break;
- }
- else
- last_error = bits_per_mb_at_this_q - target_bits_per_mb;
- }
- while (++i <= cpi->active_worst_quality);
-
-
- /* If we are at MAXQ then enable Q over-run which seeks to claw
- * back additional bits through things like the RD multiplier
- * and zero bin size.
- */
- if (Q >= MAXQ)
- {
- int zbin_oqmax;
-
- double Factor = 0.99;
- double factor_adjustment = 0.01 / 256.0;
-
- if (cpi->common.frame_type == KEY_FRAME)
- zbin_oqmax = 0;
- else if (cpi->oxcf.number_of_layers == 1 &&
- (cpi->common.refresh_alt_ref_frame ||
- (cpi->common.refresh_golden_frame &&
- !cpi->source_alt_ref_active)))
- zbin_oqmax = 16;
- else
- zbin_oqmax = ZBIN_OQ_MAX;
-
- /*{
- double Factor = (double)target_bits_per_mb/(double)bits_per_mb_at_this_q;
- double Oq;
-
- Factor = Factor/1.2683;
-
- Oq = pow( Factor, (1.0/-0.165) );
-
- if ( Oq > zbin_oqmax )
- Oq = zbin_oqmax;
-
- cpi->zbin_over_quant = (int)Oq;
- }*/
-
- /* Each incrment in the zbin is assumed to have a fixed effect
- * on bitrate. This is not of course true. The effect will be
- * highly clip dependent and may well have sudden steps. The
- * idea here is to acheive higher effective quantizers than the
- * normal maximum by expanding the zero bin and hence
- * decreasing the number of low magnitude non zero coefficients.
- */
- while (cpi->mb.zbin_over_quant < zbin_oqmax)
- {
- cpi->mb.zbin_over_quant ++;
-
- if (cpi->mb.zbin_over_quant > zbin_oqmax)
- cpi->mb.zbin_over_quant = zbin_oqmax;
-
- /* Adjust bits_per_mb_at_this_q estimate */
- bits_per_mb_at_this_q = (int)(Factor * bits_per_mb_at_this_q);
- Factor += factor_adjustment;
-
- if (Factor >= 0.999)
- Factor = 0.999;
-
- /* Break out if we get down to the target rate */
- if (bits_per_mb_at_this_q <= target_bits_per_mb)
- break;
- }
-
- }
- }
-
- return Q;
-}
-
-
-static int estimate_keyframe_frequency(VP8_COMP *cpi)
-{
- int i;
-
- /* Average key frame frequency */
- int av_key_frame_frequency = 0;
-
- /* First key frame at start of sequence is a special case. We have no
- * frequency data.
- */
- if (cpi->key_frame_count == 1)
- {
- /* Assume a default of 1 kf every 2 seconds, or the max kf interval,
- * whichever is smaller.
- */
- int key_freq = cpi->oxcf.key_freq>0 ? cpi->oxcf.key_freq : 1;
- av_key_frame_frequency = 1 + (int)cpi->output_framerate * 2;
-
- if (cpi->oxcf.auto_key && av_key_frame_frequency > key_freq)
- av_key_frame_frequency = key_freq;
-
- cpi->prior_key_frame_distance[KEY_FRAME_CONTEXT - 1]
- = av_key_frame_frequency;
- }
- else
- {
- unsigned int total_weight = 0;
- int last_kf_interval =
- (cpi->frames_since_key > 0) ? cpi->frames_since_key : 1;
-
- /* reset keyframe context and calculate weighted average of last
- * KEY_FRAME_CONTEXT keyframes
- */
- for (i = 0; i < KEY_FRAME_CONTEXT; i++)
- {
- if (i < KEY_FRAME_CONTEXT - 1)
- cpi->prior_key_frame_distance[i]
- = cpi->prior_key_frame_distance[i+1];
- else
- cpi->prior_key_frame_distance[i] = last_kf_interval;
-
- av_key_frame_frequency += prior_key_frame_weight[i]
- * cpi->prior_key_frame_distance[i];
- total_weight += prior_key_frame_weight[i];
- }
-
- av_key_frame_frequency /= total_weight;
-
- }
- // TODO (marpan): Given the checks above, |av_key_frame_frequency|
- // should always be above 0. But for now we keep the sanity check in.
- if (av_key_frame_frequency == 0)
- av_key_frame_frequency = 1;
- return av_key_frame_frequency;
-}
-
-
-void vp8_adjust_key_frame_context(VP8_COMP *cpi)
-{
- /* Clear down mmx registers to allow floating point in what follows */
- vp8_clear_system_state();
-
- /* Do we have any key frame overspend to recover? */
- /* Two-pass overspend handled elsewhere. */
- if ((cpi->pass != 2)
- && (cpi->projected_frame_size > cpi->per_frame_bandwidth))
- {
- int overspend;
-
- /* Update the count of key frame overspend to be recovered in
- * subsequent frames. A portion of the KF overspend is treated as gf
- * overspend (and hence recovered more quickly) as the kf is also a
- * gf. Otherwise the few frames following each kf tend to get more
- * bits allocated than those following other gfs.
- */
- overspend = (cpi->projected_frame_size - cpi->per_frame_bandwidth);
-
- if (cpi->oxcf.number_of_layers > 1)
- cpi->kf_overspend_bits += overspend;
- else
- {
- cpi->kf_overspend_bits += overspend * 7 / 8;
- cpi->gf_overspend_bits += overspend * 1 / 8;
- }
-
- /* Work out how much to try and recover per frame. */
- cpi->kf_bitrate_adjustment = cpi->kf_overspend_bits
- / estimate_keyframe_frequency(cpi);
- }
-
- cpi->frames_since_key = 0;
- cpi->key_frame_count++;
-}
-
-
-void vp8_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_limit, int *frame_over_shoot_limit)
-{
- /* Set-up bounds on acceptable frame size: */
- if (cpi->oxcf.fixed_q >= 0)
- {
- /* Fixed Q scenario: frame size never outranges target
- * (there is no target!)
- */
- *frame_under_shoot_limit = 0;
- *frame_over_shoot_limit = INT_MAX;
- }
- else
- {
- if (cpi->common.frame_type == KEY_FRAME)
- {
- *frame_over_shoot_limit = cpi->this_frame_target * 9 / 8;
- *frame_under_shoot_limit = cpi->this_frame_target * 7 / 8;
- }
- else
- {
- if (cpi->oxcf.number_of_layers > 1 ||
- cpi->common.refresh_alt_ref_frame ||
- cpi->common.refresh_golden_frame)
- {
- *frame_over_shoot_limit = cpi->this_frame_target * 9 / 8;
- *frame_under_shoot_limit = cpi->this_frame_target * 7 / 8;
- }
- else
- {
- /* For CBR take buffer fullness into account */
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- if (cpi->buffer_level >= ((cpi->oxcf.optimal_buffer_level + cpi->oxcf.maximum_buffer_size) >> 1))
- {
- /* Buffer is too full so relax overshoot and tighten
- * undershoot
- */
- *frame_over_shoot_limit = cpi->this_frame_target * 12 / 8;
- *frame_under_shoot_limit = cpi->this_frame_target * 6 / 8;
- }
- else if (cpi->buffer_level <= (cpi->oxcf.optimal_buffer_level >> 1))
- {
- /* Buffer is too low so relax undershoot and tighten
- * overshoot
- */
- *frame_over_shoot_limit = cpi->this_frame_target * 10 / 8;
- *frame_under_shoot_limit = cpi->this_frame_target * 4 / 8;
- }
- else
- {
- *frame_over_shoot_limit = cpi->this_frame_target * 11 / 8;
- *frame_under_shoot_limit = cpi->this_frame_target * 5 / 8;
- }
- }
- /* VBR and CQ mode */
- /* Note that tighter restrictions here can help quality
- * but hurt encode speed
- */
- else
- {
- /* Stron overshoot limit for constrained quality */
- if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
- {
- *frame_over_shoot_limit = cpi->this_frame_target * 11 / 8;
- *frame_under_shoot_limit = cpi->this_frame_target * 2 / 8;
- }
- else
- {
- *frame_over_shoot_limit = cpi->this_frame_target * 11 / 8;
- *frame_under_shoot_limit = cpi->this_frame_target * 5 / 8;
- }
- }
- }
- }
-
- /* For very small rate targets where the fractional adjustment
- * (eg * 7/8) may be tiny make sure there is at least a minimum
- * range.
- */
- *frame_over_shoot_limit += 200;
- *frame_under_shoot_limit -= 200;
- if ( *frame_under_shoot_limit < 0 )
- *frame_under_shoot_limit = 0;
-
- }
-}
-
-
-/* return of 0 means drop frame */
-int vp8_pick_frame_size(VP8_COMP *cpi)
-{
- VP8_COMMON *cm = &cpi->common;
-
- if (cm->frame_type == KEY_FRAME)
- calc_iframe_target_size(cpi);
- else
- {
- calc_pframe_target_size(cpi);
-
- /* Check if we're dropping the frame: */
- if (cpi->drop_frame)
- {
- cpi->drop_frame = 0;
- return 0;
- }
- }
- return 1;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.h
deleted file mode 100644
index 829697f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ratectrl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_RATECTRL_H_
-#define VP8_ENCODER_RATECTRL_H_
-
-#include "onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void vp8_save_coding_context(VP8_COMP *cpi);
-extern void vp8_restore_coding_context(VP8_COMP *cpi);
-
-extern void vp8_setup_key_frame(VP8_COMP *cpi);
-extern void vp8_update_rate_correction_factors(VP8_COMP *cpi, int damp_var);
-extern int vp8_regulate_q(VP8_COMP *cpi, int target_bits_per_frame);
-extern void vp8_adjust_key_frame_context(VP8_COMP *cpi);
-extern void vp8_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_limit, int *frame_over_shoot_limit);
-
-/* return of 0 means drop frame */
-extern int vp8_pick_frame_size(VP8_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_RATECTRL_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.c
deleted file mode 100644
index db587f8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.c
+++ /dev/null
@@ -1,2644 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdio.h>
-#include <math.h>
-#include <limits.h>
-#include <assert.h>
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vp8/common/pragmas.h"
-#include "tokenize.h"
-#include "treewriter.h"
-#include "onyx_int.h"
-#include "modecosts.h"
-#include "encodeintra.h"
-#include "pickinter.h"
-#include "vp8/common/entropymode.h"
-#include "vp8/common/reconinter.h"
-#include "vp8/common/reconintra4x4.h"
-#include "vp8/common/findnearmv.h"
-#include "vp8/common/quant_common.h"
-#include "encodemb.h"
-#include "quantize.h"
-#include "vp8/common/variance.h"
-#include "mcomp.h"
-#include "rdopt.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/systemdependent.h"
-#if CONFIG_TEMPORAL_DENOISING
-#include "denoising.h"
-#endif
-extern void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x);
-
-#define MAXF(a,b) (((a) > (b)) ? (a) : (b))
-
-typedef struct rate_distortion_struct
-{
- int rate2;
- int rate_y;
- int rate_uv;
- int distortion2;
- int distortion_uv;
-} RATE_DISTORTION;
-
-typedef struct best_mode_struct
-{
- int yrd;
- int rd;
- int intra_rd;
- MB_MODE_INFO mbmode;
- union b_mode_info bmodes[16];
- PARTITION_INFO partition;
-} BEST_MODE;
-
-static const int auto_speed_thresh[17] =
-{
- 1000,
- 200,
- 150,
- 130,
- 150,
- 125,
- 120,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 105
-};
-
-const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES] =
-{
- ZEROMV,
- DC_PRED,
-
- NEARESTMV,
- NEARMV,
-
- ZEROMV,
- NEARESTMV,
-
- ZEROMV,
- NEARESTMV,
-
- NEARMV,
- NEARMV,
-
- V_PRED,
- H_PRED,
- TM_PRED,
-
- NEWMV,
- NEWMV,
- NEWMV,
-
- SPLITMV,
- SPLITMV,
- SPLITMV,
-
- B_PRED,
-};
-
-/* This table determines the search order in reference frame priority order,
- * which may not necessarily match INTRA,LAST,GOLDEN,ARF
- */
-const int vp8_ref_frame_order[MAX_MODES] =
-{
- 1,
- 0,
-
- 1,
- 1,
-
- 2,
- 2,
-
- 3,
- 3,
-
- 2,
- 3,
-
- 0,
- 0,
- 0,
-
- 1,
- 2,
- 3,
-
- 1,
- 2,
- 3,
-
- 0,
-};
-
-static void fill_token_costs(
- int c[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS],
- const vp8_prob p[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]
-)
-{
- int i, j, k;
-
-
- for (i = 0; i < BLOCK_TYPES; i++)
- for (j = 0; j < COEF_BANDS; j++)
- for (k = 0; k < PREV_COEF_CONTEXTS; k++)
-
- /* check for pt=0 and band > 1 if block type 0
- * and 0 if blocktype 1
- */
- if (k == 0 && j > (i == 0))
- vp8_cost_tokens2(c[i][j][k], p [i][j][k], vp8_coef_tree, 2);
- else
- vp8_cost_tokens(c[i][j][k], p [i][j][k], vp8_coef_tree);
-}
-
-static const int rd_iifactor[32] =
-{
- 4, 4, 3, 2, 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
-};
-
-/* values are now correlated to quantizer */
-static const int sad_per_bit16lut[QINDEX_RANGE] =
-{
- 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 10, 10,
- 10, 10, 10, 10, 10, 10, 11, 11,
- 11, 11, 11, 11, 12, 12, 12, 12,
- 12, 12, 13, 13, 13, 13, 14, 14
-};
-static const int sad_per_bit4lut[QINDEX_RANGE] =
-{
- 2, 2, 2, 2, 2, 2, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 5, 5,
- 5, 5, 5, 5, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 8, 8, 8,
- 8, 8, 9, 9, 9, 9, 9, 9,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 14, 14, 14, 14, 15, 15, 15, 15,
- 16, 16, 16, 16, 17, 17, 17, 18,
- 18, 18, 19, 19, 19, 20, 20, 20,
-};
-
-void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex)
-{
- cpi->mb.sadperbit16 = sad_per_bit16lut[QIndex];
- cpi->mb.sadperbit4 = sad_per_bit4lut[QIndex];
-}
-
-void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue)
-{
- int q;
- int i;
- double capped_q = (Qvalue < 160) ? (double)Qvalue : 160.0;
- double rdconst = 2.80;
-
- vp8_clear_system_state();
-
- /* Further tests required to see if optimum is different
- * for key frames, golden frames and arf frames.
- */
- cpi->RDMULT = (int)(rdconst * (capped_q * capped_q));
-
- /* Extend rate multiplier along side quantizer zbin increases */
- if (cpi->mb.zbin_over_quant > 0)
- {
- double oq_factor;
- double modq;
-
- /* Experimental code using the same basic equation as used for Q above
- * The units of cpi->mb.zbin_over_quant are 1/128 of Q bin size
- */
- oq_factor = 1.0 + ((double)0.0015625 * cpi->mb.zbin_over_quant);
- modq = (int)((double)capped_q * oq_factor);
- cpi->RDMULT = (int)(rdconst * (modq * modq));
- }
-
- if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME))
- {
- if (cpi->twopass.next_iiratio > 31)
- cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) >> 4;
- else
- cpi->RDMULT +=
- (cpi->RDMULT * rd_iifactor[cpi->twopass.next_iiratio]) >> 4;
- }
-
- cpi->mb.errorperbit = (cpi->RDMULT / 110);
- cpi->mb.errorperbit += (cpi->mb.errorperbit==0);
-
- vp8_set_speed_features(cpi);
-
- for (i = 0; i < MAX_MODES; i++)
- {
- x->mode_test_hit_counts[i] = 0;
- }
-
- q = (int)pow(Qvalue, 1.25);
-
- if (q < 8)
- q = 8;
-
- if (cpi->RDMULT > 1000)
- {
- cpi->RDDIV = 1;
- cpi->RDMULT /= 100;
-
- for (i = 0; i < MAX_MODES; i++)
- {
- if (cpi->sf.thresh_mult[i] < INT_MAX)
- {
- x->rd_threshes[i] = cpi->sf.thresh_mult[i] * q / 100;
- }
- else
- {
- x->rd_threshes[i] = INT_MAX;
- }
-
- cpi->rd_baseline_thresh[i] = x->rd_threshes[i];
- }
- }
- else
- {
- cpi->RDDIV = 100;
-
- for (i = 0; i < MAX_MODES; i++)
- {
- if (cpi->sf.thresh_mult[i] < (INT_MAX / q))
- {
- x->rd_threshes[i] = cpi->sf.thresh_mult[i] * q;
- }
- else
- {
- x->rd_threshes[i] = INT_MAX;
- }
-
- cpi->rd_baseline_thresh[i] = x->rd_threshes[i];
- }
- }
-
- {
- /* build token cost array for the type of frame we have now */
- FRAME_CONTEXT *l = &cpi->lfc_n;
-
- if(cpi->common.refresh_alt_ref_frame)
- l = &cpi->lfc_a;
- else if(cpi->common.refresh_golden_frame)
- l = &cpi->lfc_g;
-
- fill_token_costs(
- cpi->mb.token_costs,
- (const vp8_prob( *)[8][3][11]) l->coef_probs
- );
- /*
- fill_token_costs(
- cpi->mb.token_costs,
- (const vp8_prob( *)[8][3][11]) cpi->common.fc.coef_probs);
- */
-
-
- /* TODO make these mode costs depend on last,alt or gold too. (jbb) */
- vp8_init_mode_costs(cpi);
- }
-
-}
-
-void vp8_auto_select_speed(VP8_COMP *cpi)
-{
- int milliseconds_for_compress = (int)(1000000 / cpi->framerate);
-
- milliseconds_for_compress = milliseconds_for_compress * (16 - cpi->oxcf.cpu_used) / 16;
-
-#if 0
-
- if (0)
- {
- FILE *f;
-
- f = fopen("speed.stt", "a");
- fprintf(f, " %8ld %10ld %10ld %10ld\n",
- cpi->common.current_video_frame, cpi->Speed, milliseconds_for_compress, cpi->avg_pick_mode_time);
- fclose(f);
- }
-
-#endif
-
- if (cpi->avg_pick_mode_time < milliseconds_for_compress && (cpi->avg_encode_time - cpi->avg_pick_mode_time) < milliseconds_for_compress)
- {
- if (cpi->avg_pick_mode_time == 0)
- {
- cpi->Speed = 4;
- }
- else
- {
- if (milliseconds_for_compress * 100 < cpi->avg_encode_time * 95)
- {
- cpi->Speed += 2;
- cpi->avg_pick_mode_time = 0;
- cpi->avg_encode_time = 0;
-
- if (cpi->Speed > 16)
- {
- cpi->Speed = 16;
- }
- }
-
- if (milliseconds_for_compress * 100 > cpi->avg_encode_time * auto_speed_thresh[cpi->Speed])
- {
- cpi->Speed -= 1;
- cpi->avg_pick_mode_time = 0;
- cpi->avg_encode_time = 0;
-
- /* In real-time mode, cpi->speed is in [4, 16]. */
- if (cpi->Speed < 4)
- {
- cpi->Speed = 4;
- }
- }
- }
- }
- else
- {
- cpi->Speed += 4;
-
- if (cpi->Speed > 16)
- cpi->Speed = 16;
-
-
- cpi->avg_pick_mode_time = 0;
- cpi->avg_encode_time = 0;
- }
-}
-
-int vp8_block_error_c(short *coeff, short *dqcoeff)
-{
- int i;
- int error = 0;
-
- for (i = 0; i < 16; i++)
- {
- int this_diff = coeff[i] - dqcoeff[i];
- error += this_diff * this_diff;
- }
-
- return error;
-}
-
-int vp8_mbblock_error_c(MACROBLOCK *mb, int dc)
-{
- BLOCK *be;
- BLOCKD *bd;
- int i, j;
- int berror, error = 0;
-
- for (i = 0; i < 16; i++)
- {
- be = &mb->block[i];
- bd = &mb->e_mbd.block[i];
-
- berror = 0;
-
- for (j = dc; j < 16; j++)
- {
- int this_diff = be->coeff[j] - bd->dqcoeff[j];
- berror += this_diff * this_diff;
- }
-
- error += berror;
- }
-
- return error;
-}
-
-int vp8_mbuverror_c(MACROBLOCK *mb)
-{
-
- BLOCK *be;
- BLOCKD *bd;
-
-
- int i;
- int error = 0;
-
- for (i = 16; i < 24; i++)
- {
- be = &mb->block[i];
- bd = &mb->e_mbd.block[i];
-
- error += vp8_block_error_c(be->coeff, bd->dqcoeff);
- }
-
- return error;
-}
-
-int VP8_UVSSE(MACROBLOCK *x)
-{
- unsigned char *uptr, *vptr;
- unsigned char *upred_ptr = (*(x->block[16].base_src) + x->block[16].src);
- unsigned char *vpred_ptr = (*(x->block[20].base_src) + x->block[20].src);
- int uv_stride = x->block[16].src_stride;
-
- unsigned int sse1 = 0;
- unsigned int sse2 = 0;
- int mv_row = x->e_mbd.mode_info_context->mbmi.mv.as_mv.row;
- int mv_col = x->e_mbd.mode_info_context->mbmi.mv.as_mv.col;
- int offset;
- int pre_stride = x->e_mbd.pre.uv_stride;
-
- if (mv_row < 0)
- mv_row -= 1;
- else
- mv_row += 1;
-
- if (mv_col < 0)
- mv_col -= 1;
- else
- mv_col += 1;
-
- mv_row /= 2;
- mv_col /= 2;
-
- offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
- uptr = x->e_mbd.pre.u_buffer + offset;
- vptr = x->e_mbd.pre.v_buffer + offset;
-
- if ((mv_row | mv_col) & 7)
- {
- vp8_sub_pixel_variance8x8(uptr, pre_stride,
- mv_col & 7, mv_row & 7, upred_ptr, uv_stride, &sse2);
- vp8_sub_pixel_variance8x8(vptr, pre_stride,
- mv_col & 7, mv_row & 7, vpred_ptr, uv_stride, &sse1);
- sse2 += sse1;
- }
- else
- {
- vp8_variance8x8(uptr, pre_stride,
- upred_ptr, uv_stride, &sse2);
- vp8_variance8x8(vptr, pre_stride,
- vpred_ptr, uv_stride, &sse1);
- sse2 += sse1;
- }
- return sse2;
-
-}
-
-static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l)
-{
- int c = !type; /* start at coef 0, unless Y with Y2 */
- int eob = (int)(*b->eob);
- int pt ; /* surrounding block/prev coef predictor */
- int cost = 0;
- short *qcoeff_ptr = b->qcoeff;
-
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
-
- assert(eob <= 16);
- for (; c < eob; c++)
- {
- const int v = qcoeff_ptr[vp8_default_zig_zag1d[c]];
- const int t = vp8_dct_value_tokens_ptr[v].Token;
- cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [t];
- cost += vp8_dct_value_cost_ptr[v];
- pt = vp8_prev_token_class[t];
- }
-
- if (c < 16)
- cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [DCT_EOB_TOKEN];
-
- pt = (c != !type); /* is eob first coefficient; */
- *a = *l = pt;
-
- return cost;
-}
-
-static int vp8_rdcost_mby(MACROBLOCK *mb)
-{
- int cost = 0;
- int b;
- MACROBLOCKD *x = &mb->e_mbd;
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
-
- vpx_memcpy(&t_above, mb->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, mb->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
-
- for (b = 0; b < 16; b++)
- cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_Y_NO_DC,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
-
- cost += cost_coeffs(mb, x->block + 24, PLANE_TYPE_Y2,
- ta + vp8_block2above[24], tl + vp8_block2left[24]);
-
- return cost;
-}
-
-static void macro_block_yrd( MACROBLOCK *mb,
- int *Rate,
- int *Distortion)
-{
- int b;
- MACROBLOCKD *const x = &mb->e_mbd;
- BLOCK *const mb_y2 = mb->block + 24;
- BLOCKD *const x_y2 = x->block + 24;
- short *Y2DCPtr = mb_y2->src_diff;
- BLOCK *beptr;
- int d;
-
- vp8_subtract_mby( mb->src_diff, *(mb->block[0].base_src),
- mb->block[0].src_stride, mb->e_mbd.predictor, 16);
-
- /* Fdct and building the 2nd order block */
- for (beptr = mb->block; beptr < mb->block + 16; beptr += 2)
- {
- mb->short_fdct8x4(beptr->src_diff, beptr->coeff, 32);
- *Y2DCPtr++ = beptr->coeff[0];
- *Y2DCPtr++ = beptr->coeff[16];
- }
-
- /* 2nd order fdct */
- mb->short_walsh4x4(mb_y2->src_diff, mb_y2->coeff, 8);
-
- /* Quantization */
- for (b = 0; b < 16; b++)
- {
- mb->quantize_b(&mb->block[b], &mb->e_mbd.block[b]);
- }
-
- /* DC predication and Quantization of 2nd Order block */
- mb->quantize_b(mb_y2, x_y2);
-
- /* Distortion */
- d = vp8_mbblock_error(mb, 1) << 2;
- d += vp8_block_error(mb_y2->coeff, x_y2->dqcoeff);
-
- *Distortion = (d >> 4);
-
- /* rate */
- *Rate = vp8_rdcost_mby(mb);
-}
-
-static void copy_predictor(unsigned char *dst, const unsigned char *predictor)
-{
- const unsigned int *p = (const unsigned int *)predictor;
- unsigned int *d = (unsigned int *)dst;
- d[0] = p[0];
- d[4] = p[4];
- d[8] = p[8];
- d[12] = p[12];
-}
-static int rd_pick_intra4x4block(
- MACROBLOCK *x,
- BLOCK *be,
- BLOCKD *b,
- B_PREDICTION_MODE *best_mode,
- const int *bmode_costs,
- ENTROPY_CONTEXT *a,
- ENTROPY_CONTEXT *l,
-
- int *bestrate,
- int *bestratey,
- int *bestdistortion)
-{
- B_PREDICTION_MODE mode;
- int best_rd = INT_MAX;
- int rate = 0;
- int distortion;
-
- ENTROPY_CONTEXT ta = *a, tempa = *a;
- ENTROPY_CONTEXT tl = *l, templ = *l;
- /*
- * The predictor buffer is a 2d buffer with a stride of 16. Create
- * a temp buffer that meets the stride requirements, but we are only
- * interested in the left 4x4 block
- * */
- DECLARE_ALIGNED_ARRAY(16, unsigned char, best_predictor, 16*4);
- DECLARE_ALIGNED_ARRAY(16, short, best_dqcoeff, 16);
- int dst_stride = x->e_mbd.dst.y_stride;
- unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset;
-
- unsigned char *Above = dst - dst_stride;
- unsigned char *yleft = dst - 1;
- unsigned char top_left = Above[-1];
-
- for (mode = B_DC_PRED; mode <= B_HU_PRED; mode++)
- {
- int this_rd;
- int ratey;
-
- rate = bmode_costs[mode];
-
- vp8_intra4x4_predict(Above, yleft, dst_stride, mode,
- b->predictor, 16, top_left);
- vp8_subtract_b(be, b, 16);
- x->short_fdct4x4(be->src_diff, be->coeff, 32);
- x->quantize_b(be, b);
-
- tempa = ta;
- templ = tl;
-
- ratey = cost_coeffs(x, b, PLANE_TYPE_Y_WITH_DC, &tempa, &templ);
- rate += ratey;
- distortion = vp8_block_error(be->coeff, b->dqcoeff) >> 2;
-
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (this_rd < best_rd)
- {
- *bestrate = rate;
- *bestratey = ratey;
- *bestdistortion = distortion;
- best_rd = this_rd;
- *best_mode = mode;
- *a = tempa;
- *l = templ;
- copy_predictor(best_predictor, b->predictor);
- vpx_memcpy(best_dqcoeff, b->dqcoeff, 32);
- }
- }
- b->bmi.as_mode = *best_mode;
-
- vp8_short_idct4x4llm(best_dqcoeff, best_predictor, 16, dst, dst_stride);
-
- return best_rd;
-}
-
-static int rd_pick_intra4x4mby_modes(MACROBLOCK *mb, int *Rate,
- int *rate_y, int *Distortion, int best_rd)
-{
- MACROBLOCKD *const xd = &mb->e_mbd;
- int i;
- int cost = mb->mbmode_cost [xd->frame_type] [B_PRED];
- int distortion = 0;
- int tot_rate_y = 0;
- int64_t total_rd = 0;
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
- const int *bmode_costs;
-
- vpx_memcpy(&t_above, mb->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, mb->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
-
- intra_prediction_down_copy(xd, xd->dst.y_buffer - xd->dst.y_stride + 16);
-
- bmode_costs = mb->inter_bmode_costs;
-
- for (i = 0; i < 16; i++)
- {
- MODE_INFO *const mic = xd->mode_info_context;
- const int mis = xd->mode_info_stride;
- B_PREDICTION_MODE best_mode = 0;
- int r = 0, ry = 0, d = 0;
-
- if (mb->e_mbd.frame_type == KEY_FRAME)
- {
- const B_PREDICTION_MODE A = above_block_mode(mic, i, mis);
- const B_PREDICTION_MODE L = left_block_mode(mic, i);
-
- bmode_costs = mb->bmode_costs[A][L];
- }
-
- total_rd += rd_pick_intra4x4block(
- mb, mb->block + i, xd->block + i, &best_mode, bmode_costs,
- ta + vp8_block2above[i],
- tl + vp8_block2left[i], &r, &ry, &d);
-
- cost += r;
- distortion += d;
- tot_rate_y += ry;
-
- mic->bmi[i].as_mode = best_mode;
-
- if(total_rd >= (int64_t)best_rd)
- break;
- }
-
- if(total_rd >= (int64_t)best_rd)
- return INT_MAX;
-
- *Rate = cost;
- *rate_y = tot_rate_y;
- *Distortion = distortion;
-
- return RDCOST(mb->rdmult, mb->rddiv, cost, distortion);
-}
-
-
-static int rd_pick_intra16x16mby_mode(MACROBLOCK *x,
- int *Rate,
- int *rate_y,
- int *Distortion)
-{
- MB_PREDICTION_MODE mode;
- MB_PREDICTION_MODE mode_selected;
- int rate, ratey;
- int distortion;
- int best_rd = INT_MAX;
- int this_rd;
- MACROBLOCKD *xd = &x->e_mbd;
- mode_selected = 0;
-
- /* Y Search for 16x16 intra prediction mode */
- for (mode = DC_PRED; mode <= TM_PRED; mode++)
- {
- xd->mode_info_context->mbmi.mode = mode;
-
- vp8_build_intra_predictors_mby_s(xd,
- xd->dst.y_buffer - xd->dst.y_stride,
- xd->dst.y_buffer - 1,
- xd->dst.y_stride,
- xd->predictor,
- 16);
-
- macro_block_yrd(x, &ratey, &distortion);
- rate = ratey + x->mbmode_cost[xd->frame_type]
- [xd->mode_info_context->mbmi.mode];
-
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (this_rd < best_rd)
- {
- mode_selected = mode;
- best_rd = this_rd;
- *Rate = rate;
- *rate_y = ratey;
- *Distortion = distortion;
- }
- }
-
- xd->mode_info_context->mbmi.mode = mode_selected;
- return best_rd;
-}
-
-static int rd_cost_mbuv(MACROBLOCK *mb)
-{
- int b;
- int cost = 0;
- MACROBLOCKD *x = &mb->e_mbd;
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
-
- vpx_memcpy(&t_above, mb->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, mb->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
-
- for (b = 16; b < 24; b++)
- cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_UV,
- ta + vp8_block2above[b], tl + vp8_block2left[b]);
-
- return cost;
-}
-
-
-static int rd_inter16x16_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
- int *distortion, int fullpixel)
-{
- UNINITIALIZED_IS_SAFE(cpi);
- UNINITIALIZED_IS_SAFE(fullpixel);
- vp8_build_inter16x16_predictors_mbuv(&x->e_mbd);
- vp8_subtract_mbuv(x->src_diff,
- x->src.u_buffer, x->src.v_buffer, x->src.uv_stride,
- &x->e_mbd.predictor[256], &x->e_mbd.predictor[320], 8);
-
- vp8_transform_mbuv(x);
- vp8_quantize_mbuv(x);
-
- *rate = rd_cost_mbuv(x);
- *distortion = vp8_mbuverror(x) / 4;
-
- return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
-}
-
-static int rd_inter4x4_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
- int *distortion, int fullpixel)
-{
- UNINITIALIZED_IS_SAFE(cpi);
- UNINITIALIZED_IS_SAFE(fullpixel);
- vp8_build_inter4x4_predictors_mbuv(&x->e_mbd);
- vp8_subtract_mbuv(x->src_diff,
- x->src.u_buffer, x->src.v_buffer, x->src.uv_stride,
- &x->e_mbd.predictor[256], &x->e_mbd.predictor[320], 8);
-
- vp8_transform_mbuv(x);
- vp8_quantize_mbuv(x);
-
- *rate = rd_cost_mbuv(x);
- *distortion = vp8_mbuverror(x) / 4;
-
- return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
-}
-
-static void rd_pick_intra_mbuv_mode(MACROBLOCK *x, int *rate,
- int *rate_tokenonly, int *distortion)
-{
- MB_PREDICTION_MODE mode;
- MB_PREDICTION_MODE mode_selected;
- int best_rd = INT_MAX;
- int d = 0, r = 0;
- int rate_to;
- MACROBLOCKD *xd = &x->e_mbd;
- mode_selected = 0;
- for (mode = DC_PRED; mode <= TM_PRED; mode++)
- {
- int this_rate;
- int this_distortion;
- int this_rd;
-
- xd->mode_info_context->mbmi.uv_mode = mode;
-
- vp8_build_intra_predictors_mbuv_s(xd,
- xd->dst.u_buffer - xd->dst.uv_stride,
- xd->dst.v_buffer - xd->dst.uv_stride,
- xd->dst.u_buffer - 1,
- xd->dst.v_buffer - 1,
- xd->dst.uv_stride,
- &xd->predictor[256], &xd->predictor[320],
- 8);
-
-
- vp8_subtract_mbuv(x->src_diff,
- x->src.u_buffer, x->src.v_buffer, x->src.uv_stride,
- &xd->predictor[256], &xd->predictor[320], 8);
- vp8_transform_mbuv(x);
- vp8_quantize_mbuv(x);
-
- rate_to = rd_cost_mbuv(x);
- this_rate = rate_to + x->intra_uv_mode_cost[xd->frame_type][xd->mode_info_context->mbmi.uv_mode];
-
- this_distortion = vp8_mbuverror(x) / 4;
-
- this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
-
- if (this_rd < best_rd)
- {
- best_rd = this_rd;
- d = this_distortion;
- r = this_rate;
- *rate_tokenonly = rate_to;
- mode_selected = mode;
- }
- }
-
- *rate = r;
- *distortion = d;
-
- xd->mode_info_context->mbmi.uv_mode = mode_selected;
-}
-
-int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4])
-{
- vp8_prob p [VP8_MVREFS-1];
- assert(NEARESTMV <= m && m <= SPLITMV);
- vp8_mv_ref_probs(p, near_mv_ref_ct);
- return vp8_cost_token(vp8_mv_ref_tree, p,
- vp8_mv_ref_encoding_array + (m - NEARESTMV));
-}
-
-void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv)
-{
- x->e_mbd.mode_info_context->mbmi.mode = mb;
- x->e_mbd.mode_info_context->mbmi.mv.as_int = mv->as_int;
-}
-
-static int labels2mode(
- MACROBLOCK *x,
- int const *labelings, int which_label,
- B_PREDICTION_MODE this_mode,
- int_mv *this_mv, int_mv *best_ref_mv,
- int *mvcost[2]
-)
-{
- MACROBLOCKD *const xd = & x->e_mbd;
- MODE_INFO *const mic = xd->mode_info_context;
- const int mis = xd->mode_info_stride;
-
- int cost = 0;
- int thismvcost = 0;
-
- /* We have to be careful retrieving previously-encoded motion vectors.
- Ones from this macroblock have to be pulled from the BLOCKD array
- as they have not yet made it to the bmi array in our MB_MODE_INFO. */
-
- int i = 0;
-
- do
- {
- BLOCKD *const d = xd->block + i;
- const int row = i >> 2, col = i & 3;
-
- B_PREDICTION_MODE m;
-
- if (labelings[i] != which_label)
- continue;
-
- if (col && labelings[i] == labelings[i-1])
- m = LEFT4X4;
- else if (row && labelings[i] == labelings[i-4])
- m = ABOVE4X4;
- else
- {
- /* the only time we should do costing for new motion vector
- * or mode is when we are on a new label (jbb May 08, 2007)
- */
- switch (m = this_mode)
- {
- case NEW4X4 :
- thismvcost = vp8_mv_bit_cost(this_mv, best_ref_mv, mvcost, 102);
- break;
- case LEFT4X4:
- this_mv->as_int = col ? d[-1].bmi.mv.as_int : (uint32_t)left_block_mv(mic, i);
- break;
- case ABOVE4X4:
- this_mv->as_int = row ? d[-4].bmi.mv.as_int : (uint32_t)above_block_mv(mic, i, mis);
- break;
- case ZERO4X4:
- this_mv->as_int = 0;
- break;
- default:
- break;
- }
-
- if (m == ABOVE4X4) /* replace above with left if same */
- {
- int_mv left_mv;
-
- left_mv.as_int = col ? d[-1].bmi.mv.as_int :
- (uint32_t)left_block_mv(mic, i);
-
- if (left_mv.as_int == this_mv->as_int)
- m = LEFT4X4;
- }
-
- cost = x->inter_bmode_costs[ m];
- }
-
- d->bmi.mv.as_int = this_mv->as_int;
-
- x->partition_info->bmi[i].mode = m;
- x->partition_info->bmi[i].mv.as_int = this_mv->as_int;
-
- }
- while (++i < 16);
-
- cost += thismvcost ;
- return cost;
-}
-
-static int rdcost_mbsegment_y(MACROBLOCK *mb, const int *labels,
- int which_label, ENTROPY_CONTEXT *ta,
- ENTROPY_CONTEXT *tl)
-{
- int cost = 0;
- int b;
- MACROBLOCKD *x = &mb->e_mbd;
-
- for (b = 0; b < 16; b++)
- if (labels[ b] == which_label)
- cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_Y_WITH_DC,
- ta + vp8_block2above[b],
- tl + vp8_block2left[b]);
-
- return cost;
-
-}
-static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels, int which_label)
-{
- int i;
- unsigned int distortion = 0;
- int pre_stride = x->e_mbd.pre.y_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
-
-
- for (i = 0; i < 16; i++)
- {
- if (labels[i] == which_label)
- {
- BLOCKD *bd = &x->e_mbd.block[i];
- BLOCK *be = &x->block[i];
-
- vp8_build_inter_predictors_b(bd, 16, base_pre, pre_stride, x->e_mbd.subpixel_predict);
- vp8_subtract_b(be, bd, 16);
- x->short_fdct4x4(be->src_diff, be->coeff, 32);
- x->quantize_b(be, bd);
-
- distortion += vp8_block_error(be->coeff, bd->dqcoeff);
- }
- }
-
- return distortion;
-}
-
-
-static const unsigned int segmentation_to_sseshift[4] = {3, 3, 2, 0};
-
-
-typedef struct
-{
- int_mv *ref_mv;
- int_mv mvp;
-
- int segment_rd;
- int segment_num;
- int r;
- int d;
- int segment_yrate;
- B_PREDICTION_MODE modes[16];
- int_mv mvs[16];
- unsigned char eobs[16];
-
- int mvthresh;
- int *mdcounts;
-
- int_mv sv_mvp[4]; /* save 4 mvp from 8x8 */
- int sv_istep[2]; /* save 2 initial step_param for 16x8/8x16 */
-
-} BEST_SEG_INFO;
-
-
-static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
- BEST_SEG_INFO *bsi, unsigned int segmentation)
-{
- int i;
- int const *labels;
- int br = 0;
- int bd = 0;
- B_PREDICTION_MODE this_mode;
-
-
- int label_count;
- int this_segment_rd = 0;
- int label_mv_thresh;
- int rate = 0;
- int sbr = 0;
- int sbd = 0;
- int segmentyrate = 0;
-
- vp8_variance_fn_ptr_t *v_fn_ptr;
-
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
- ENTROPY_CONTEXT_PLANES t_above_b, t_left_b;
- ENTROPY_CONTEXT *ta_b;
- ENTROPY_CONTEXT *tl_b;
-
- vpx_memcpy(&t_above, x->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, x->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
- ta_b = (ENTROPY_CONTEXT *)&t_above_b;
- tl_b = (ENTROPY_CONTEXT *)&t_left_b;
-
- br = 0;
- bd = 0;
-
- v_fn_ptr = &cpi->fn_ptr[segmentation];
- labels = vp8_mbsplits[segmentation];
- label_count = vp8_mbsplit_count[segmentation];
-
- /* 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 */
- rate = vp8_cost_token(vp8_mbsplit_tree, vp8_mbsplit_probs, vp8_mbsplit_encodings + segmentation);
- rate += vp8_cost_mv_ref(SPLITMV, bsi->mdcounts);
- this_segment_rd += RDCOST(x->rdmult, x->rddiv, rate, 0);
- br += rate;
-
- for (i = 0; i < label_count; i++)
- {
- int_mv mode_mv[B_MODE_COUNT];
- int best_label_rd = INT_MAX;
- B_PREDICTION_MODE mode_selected = ZERO4X4;
- int bestlabelyrate = 0;
-
- /* search for the best motion vector on this segment */
- for (this_mode = LEFT4X4; this_mode <= NEW4X4 ; this_mode ++)
- {
- int this_rd;
- int distortion;
- int labelyrate;
- ENTROPY_CONTEXT_PLANES t_above_s, t_left_s;
- ENTROPY_CONTEXT *ta_s;
- ENTROPY_CONTEXT *tl_s;
-
- vpx_memcpy(&t_above_s, &t_above, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left_s, &t_left, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta_s = (ENTROPY_CONTEXT *)&t_above_s;
- tl_s = (ENTROPY_CONTEXT *)&t_left_s;
-
- if (this_mode == NEW4X4)
- {
- int sseshift;
- int num00;
- int step_param = 0;
- int further_steps;
- int n;
- int thissme;
- int bestsme = INT_MAX;
- int_mv temp_mv;
- BLOCK *c;
- BLOCKD *e;
-
- /* Is the best so far sufficiently good that we cant justify
- * doing a new motion search.
- */
- if (best_label_rd < label_mv_thresh)
- break;
-
- if(cpi->compressor_speed)
- {
- if (segmentation == BLOCK_8X16 || segmentation == BLOCK_16X8)
- {
- bsi->mvp.as_int = bsi->sv_mvp[i].as_int;
- if (i==1 && segmentation == BLOCK_16X8)
- bsi->mvp.as_int = bsi->sv_mvp[2].as_int;
-
- step_param = bsi->sv_istep[i];
- }
-
- /* use previous block's result as next block's MV
- * predictor.
- */
- if (segmentation == BLOCK_4X4 && i>0)
- {
- bsi->mvp.as_int = x->e_mbd.block[i-1].bmi.mv.as_int;
- if (i==4 || i==8 || i==12)
- bsi->mvp.as_int = x->e_mbd.block[i-4].bmi.mv.as_int;
- step_param = 2;
- }
- }
-
- further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
-
- {
- int sadpb = x->sadperbit4;
- int_mv mvp_full;
-
- mvp_full.as_mv.row = bsi->mvp.as_mv.row >>3;
- mvp_full.as_mv.col = bsi->mvp.as_mv.col >>3;
-
- /* find first label */
- n = vp8_mbsplit_offset[segmentation][i];
-
- c = &x->block[n];
- e = &x->e_mbd.block[n];
-
- {
- bestsme = cpi->diamond_search_sad(x, c, e, &mvp_full,
- &mode_mv[NEW4X4], step_param,
- sadpb, &num00, v_fn_ptr,
- x->mvcost, bsi->ref_mv);
-
- n = num00;
- num00 = 0;
-
- while (n < further_steps)
- {
- n++;
-
- if (num00)
- num00--;
- else
- {
- thissme = cpi->diamond_search_sad(x, c, e,
- &mvp_full, &temp_mv,
- step_param + n, sadpb,
- &num00, v_fn_ptr,
- x->mvcost, bsi->ref_mv);
-
- if (thissme < bestsme)
- {
- bestsme = thissme;
- mode_mv[NEW4X4].as_int = temp_mv.as_int;
- }
- }
- }
- }
-
- sseshift = segmentation_to_sseshift[segmentation];
-
- /* Should we do a full search (best quality only) */
- if ((cpi->compressor_speed == 0) && (bestsme >> sseshift) > 4000)
- {
- /* Check if mvp_full is within the range. */
- vp8_clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
-
- thissme = cpi->full_search_sad(x, c, e, &mvp_full,
- sadpb, 16, v_fn_ptr,
- x->mvcost, bsi->ref_mv);
-
- if (thissme < bestsme)
- {
- bestsme = thissme;
- mode_mv[NEW4X4].as_int = e->bmi.mv.as_int;
- }
- else
- {
- /* The full search result is actually worse so
- * re-instate the previous best vector
- */
- e->bmi.mv.as_int = mode_mv[NEW4X4].as_int;
- }
- }
- }
-
- if (bestsme < INT_MAX)
- {
- int disto;
- unsigned int sse;
- cpi->find_fractional_mv_step(x, c, e, &mode_mv[NEW4X4],
- bsi->ref_mv, x->errorperbit, v_fn_ptr, x->mvcost,
- &disto, &sse);
- }
- } /* NEW4X4 */
-
- rate = labels2mode(x, labels, i, this_mode, &mode_mv[this_mode],
- bsi->ref_mv, x->mvcost);
-
- /* Trap vectors that reach beyond the UMV borders */
- if (((mode_mv[this_mode].as_mv.row >> 3) < x->mv_row_min) || ((mode_mv[this_mode].as_mv.row >> 3) > x->mv_row_max) ||
- ((mode_mv[this_mode].as_mv.col >> 3) < x->mv_col_min) || ((mode_mv[this_mode].as_mv.col >> 3) > x->mv_col_max))
- {
- continue;
- }
-
- distortion = vp8_encode_inter_mb_segment(x, labels, i) / 4;
-
- labelyrate = rdcost_mbsegment_y(x, labels, i, ta_s, tl_s);
- rate += labelyrate;
-
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (this_rd < best_label_rd)
- {
- sbr = rate;
- sbd = distortion;
- bestlabelyrate = labelyrate;
- mode_selected = this_mode;
- best_label_rd = this_rd;
-
- vpx_memcpy(ta_b, ta_s, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(tl_b, tl_s, sizeof(ENTROPY_CONTEXT_PLANES));
-
- }
- } /*for each 4x4 mode*/
-
- vpx_memcpy(ta, ta_b, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(tl, tl_b, sizeof(ENTROPY_CONTEXT_PLANES));
-
- labels2mode(x, labels, i, mode_selected, &mode_mv[mode_selected],
- bsi->ref_mv, x->mvcost);
-
- br += sbr;
- bd += sbd;
- segmentyrate += bestlabelyrate;
- this_segment_rd += best_label_rd;
-
- if (this_segment_rd >= bsi->segment_rd)
- break;
-
- } /* for each label */
-
- if (this_segment_rd < bsi->segment_rd)
- {
- bsi->r = br;
- bsi->d = bd;
- bsi->segment_yrate = segmentyrate;
- bsi->segment_rd = this_segment_rd;
- bsi->segment_num = segmentation;
-
- /* store everything needed to come back to this!! */
- for (i = 0; i < 16; i++)
- {
- bsi->mvs[i].as_mv = x->partition_info->bmi[i].mv.as_mv;
- bsi->modes[i] = x->partition_info->bmi[i].mode;
- bsi->eobs[i] = x->e_mbd.eobs[i];
- }
- }
-}
-
-static
-void vp8_cal_step_param(int sr, int *sp)
-{
- int step = 0;
-
- if (sr > MAX_FIRST_STEP) sr = MAX_FIRST_STEP;
- else if (sr < 1) sr = 1;
-
- while (sr>>=1)
- step++;
-
- *sp = MAX_MVSEARCH_STEPS - 1 - step;
-}
-
-static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x,
- int_mv *best_ref_mv, int best_rd,
- int *mdcounts, int *returntotrate,
- int *returnyrate, int *returndistortion,
- int mvthresh)
-{
- int i;
- BEST_SEG_INFO bsi;
-
- vpx_memset(&bsi, 0, sizeof(bsi));
-
- bsi.segment_rd = best_rd;
- bsi.ref_mv = best_ref_mv;
- bsi.mvp.as_int = best_ref_mv->as_int;
- bsi.mvthresh = mvthresh;
- bsi.mdcounts = mdcounts;
-
- for(i = 0; i < 16; i++)
- {
- bsi.modes[i] = ZERO4X4;
- }
-
- if(cpi->compressor_speed == 0)
- {
- /* for now, we will keep the original segmentation order
- when in best quality mode */
- rd_check_segment(cpi, x, &bsi, BLOCK_16X8);
- rd_check_segment(cpi, x, &bsi, BLOCK_8X16);
- rd_check_segment(cpi, x, &bsi, BLOCK_8X8);
- rd_check_segment(cpi, x, &bsi, BLOCK_4X4);
- }
- else
- {
- int sr;
-
- rd_check_segment(cpi, x, &bsi, BLOCK_8X8);
-
- if (bsi.segment_rd < best_rd)
- {
- int col_min = ((best_ref_mv->as_mv.col+7)>>3) - MAX_FULL_PEL_VAL;
- int row_min = ((best_ref_mv->as_mv.row+7)>>3) - MAX_FULL_PEL_VAL;
- int col_max = (best_ref_mv->as_mv.col>>3) + MAX_FULL_PEL_VAL;
- int row_max = (best_ref_mv->as_mv.row>>3) + MAX_FULL_PEL_VAL;
-
- int tmp_col_min = x->mv_col_min;
- int tmp_col_max = x->mv_col_max;
- int tmp_row_min = x->mv_row_min;
- int tmp_row_max = x->mv_row_max;
-
- /* Get intersection of UMV window and valid MV window to reduce # of checks in diamond search. */
- if (x->mv_col_min < col_min )
- x->mv_col_min = col_min;
- if (x->mv_col_max > col_max )
- x->mv_col_max = col_max;
- if (x->mv_row_min < row_min )
- x->mv_row_min = row_min;
- if (x->mv_row_max > row_max )
- x->mv_row_max = row_max;
-
- /* Get 8x8 result */
- bsi.sv_mvp[0].as_int = bsi.mvs[0].as_int;
- bsi.sv_mvp[1].as_int = bsi.mvs[2].as_int;
- bsi.sv_mvp[2].as_int = bsi.mvs[8].as_int;
- bsi.sv_mvp[3].as_int = bsi.mvs[10].as_int;
-
- /* Use 8x8 result as 16x8/8x16's predictor MV. Adjust search range according to the closeness of 2 MV. */
- /* block 8X16 */
- {
- sr = MAXF((abs(bsi.sv_mvp[0].as_mv.row - bsi.sv_mvp[2].as_mv.row))>>3, (abs(bsi.sv_mvp[0].as_mv.col - bsi.sv_mvp[2].as_mv.col))>>3);
- vp8_cal_step_param(sr, &bsi.sv_istep[0]);
-
- sr = MAXF((abs(bsi.sv_mvp[1].as_mv.row - bsi.sv_mvp[3].as_mv.row))>>3, (abs(bsi.sv_mvp[1].as_mv.col - bsi.sv_mvp[3].as_mv.col))>>3);
- vp8_cal_step_param(sr, &bsi.sv_istep[1]);
-
- rd_check_segment(cpi, x, &bsi, BLOCK_8X16);
- }
-
- /* block 16X8 */
- {
- sr = MAXF((abs(bsi.sv_mvp[0].as_mv.row - bsi.sv_mvp[1].as_mv.row))>>3, (abs(bsi.sv_mvp[0].as_mv.col - bsi.sv_mvp[1].as_mv.col))>>3);
- vp8_cal_step_param(sr, &bsi.sv_istep[0]);
-
- sr = MAXF((abs(bsi.sv_mvp[2].as_mv.row - bsi.sv_mvp[3].as_mv.row))>>3, (abs(bsi.sv_mvp[2].as_mv.col - bsi.sv_mvp[3].as_mv.col))>>3);
- vp8_cal_step_param(sr, &bsi.sv_istep[1]);
-
- rd_check_segment(cpi, x, &bsi, BLOCK_16X8);
- }
-
- /* If 8x8 is better than 16x8/8x16, then do 4x4 search */
- /* Not skip 4x4 if speed=0 (good quality) */
- if (cpi->sf.no_skip_block4x4_search || bsi.segment_num == BLOCK_8X8) /* || (sv_segment_rd8x8-bsi.segment_rd) < sv_segment_rd8x8>>5) */
- {
- bsi.mvp.as_int = bsi.sv_mvp[0].as_int;
- rd_check_segment(cpi, x, &bsi, BLOCK_4X4);
- }
-
- /* restore UMV window */
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
- }
- }
-
- /* set it to the best */
- for (i = 0; i < 16; i++)
- {
- BLOCKD *bd = &x->e_mbd.block[i];
-
- bd->bmi.mv.as_int = bsi.mvs[i].as_int;
- *bd->eob = bsi.eobs[i];
- }
-
- *returntotrate = bsi.r;
- *returndistortion = bsi.d;
- *returnyrate = bsi.segment_yrate;
-
- /* save partitions */
- x->e_mbd.mode_info_context->mbmi.partitioning = bsi.segment_num;
- x->partition_info->count = vp8_mbsplit_count[bsi.segment_num];
-
- for (i = 0; i < x->partition_info->count; i++)
- {
- int j;
-
- j = vp8_mbsplit_offset[bsi.segment_num][i];
-
- x->partition_info->bmi[i].mode = bsi.modes[j];
- x->partition_info->bmi[i].mv.as_mv = bsi.mvs[j].as_mv;
- }
- /*
- * used to set x->e_mbd.mode_info_context->mbmi.mv.as_int
- */
- x->partition_info->bmi[15].mv.as_int = bsi.mvs[15].as_int;
-
- return bsi.segment_rd;
-}
-
-/* The improved MV prediction */
-void vp8_mv_pred
-(
- VP8_COMP *cpi,
- MACROBLOCKD *xd,
- const MODE_INFO *here,
- int_mv *mvp,
- int refframe,
- int *ref_frame_sign_bias,
- int *sr,
- int near_sadidx[]
-)
-{
- const MODE_INFO *above = here - xd->mode_info_stride;
- const MODE_INFO *left = here - 1;
- const MODE_INFO *aboveleft = above - 1;
- int_mv near_mvs[8];
- int near_ref[8];
- int_mv mv;
- int vcnt=0;
- int find=0;
- int mb_offset;
-
- int mvx[8];
- int mvy[8];
- int i;
-
- mv.as_int = 0;
-
- if(here->mbmi.ref_frame != INTRA_FRAME)
- {
- near_mvs[0].as_int = near_mvs[1].as_int = near_mvs[2].as_int = near_mvs[3].as_int = near_mvs[4].as_int = near_mvs[5].as_int = near_mvs[6].as_int = near_mvs[7].as_int = 0;
- near_ref[0] = near_ref[1] = near_ref[2] = near_ref[3] = near_ref[4] = near_ref[5] = near_ref[6] = near_ref[7] = 0;
-
- /* read in 3 nearby block's MVs from current frame as prediction
- * candidates.
- */
- if (above->mbmi.ref_frame != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = above->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = above->mbmi.ref_frame;
- }
- vcnt++;
- if (left->mbmi.ref_frame != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = left->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = left->mbmi.ref_frame;
- }
- vcnt++;
- if (aboveleft->mbmi.ref_frame != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = aboveleft->mbmi.mv.as_int;
- mv_bias(ref_frame_sign_bias[aboveleft->mbmi.ref_frame], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = aboveleft->mbmi.ref_frame;
- }
- vcnt++;
-
- /* read in 5 nearby block's MVs from last frame. */
- if(cpi->common.last_frame_type != KEY_FRAME)
- {
- mb_offset = (-xd->mb_to_top_edge/128 + 1) * (xd->mode_info_stride +1) + (-xd->mb_to_left_edge/128 +1) ;
-
- /* current in last frame */
- if (cpi->lf_ref_frame[mb_offset] != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = cpi->lfmv[mb_offset].as_int;
- mv_bias(cpi->lf_ref_frame_sign_bias[mb_offset], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = cpi->lf_ref_frame[mb_offset];
- }
- vcnt++;
-
- /* above in last frame */
- if (cpi->lf_ref_frame[mb_offset - xd->mode_info_stride-1] != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = cpi->lfmv[mb_offset - xd->mode_info_stride-1].as_int;
- mv_bias(cpi->lf_ref_frame_sign_bias[mb_offset - xd->mode_info_stride-1], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = cpi->lf_ref_frame[mb_offset - xd->mode_info_stride-1];
- }
- vcnt++;
-
- /* left in last frame */
- if (cpi->lf_ref_frame[mb_offset-1] != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = cpi->lfmv[mb_offset -1].as_int;
- mv_bias(cpi->lf_ref_frame_sign_bias[mb_offset -1], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = cpi->lf_ref_frame[mb_offset - 1];
- }
- vcnt++;
-
- /* right in last frame */
- if (cpi->lf_ref_frame[mb_offset +1] != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = cpi->lfmv[mb_offset +1].as_int;
- mv_bias(cpi->lf_ref_frame_sign_bias[mb_offset +1], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = cpi->lf_ref_frame[mb_offset +1];
- }
- vcnt++;
-
- /* below in last frame */
- if (cpi->lf_ref_frame[mb_offset + xd->mode_info_stride +1] != INTRA_FRAME)
- {
- near_mvs[vcnt].as_int = cpi->lfmv[mb_offset + xd->mode_info_stride +1].as_int;
- mv_bias(cpi->lf_ref_frame_sign_bias[mb_offset + xd->mode_info_stride +1], refframe, &near_mvs[vcnt], ref_frame_sign_bias);
- near_ref[vcnt] = cpi->lf_ref_frame[mb_offset + xd->mode_info_stride +1];
- }
- vcnt++;
- }
-
- for(i=0; i< vcnt; i++)
- {
- if(near_ref[near_sadidx[i]] != INTRA_FRAME)
- {
- if(here->mbmi.ref_frame == near_ref[near_sadidx[i]])
- {
- mv.as_int = near_mvs[near_sadidx[i]].as_int;
- find = 1;
- if (i < 3)
- *sr = 3;
- else
- *sr = 2;
- break;
- }
- }
- }
-
- if(!find)
- {
- for(i=0; i<vcnt; i++)
- {
- mvx[i] = near_mvs[i].as_mv.row;
- mvy[i] = near_mvs[i].as_mv.col;
- }
-
- insertsortmv(mvx, vcnt);
- insertsortmv(mvy, vcnt);
- mv.as_mv.row = mvx[vcnt/2];
- mv.as_mv.col = mvy[vcnt/2];
-
- find = 1;
- /* sr is set to 0 to allow calling function to decide the search
- * range.
- */
- *sr = 0;
- }
- }
-
- /* Set up return values */
- mvp->as_int = mv.as_int;
- vp8_clamp_mv2(mvp, xd);
-}
-
-void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffset, int near_sadidx[])
-{
- /* near_sad indexes:
- * 0-cf above, 1-cf left, 2-cf aboveleft,
- * 3-lf current, 4-lf above, 5-lf left, 6-lf right, 7-lf below
- */
- int near_sad[8] = {0};
- BLOCK *b = &x->block[0];
- unsigned char *src_y_ptr = *(b->base_src);
-
- /* calculate sad for current frame 3 nearby MBs. */
- if( xd->mb_to_top_edge==0 && xd->mb_to_left_edge ==0)
- {
- near_sad[0] = near_sad[1] = near_sad[2] = INT_MAX;
- }else if(xd->mb_to_top_edge==0)
- { /* only has left MB for sad calculation. */
- near_sad[0] = near_sad[2] = INT_MAX;
- near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - 16,xd->dst.y_stride, UINT_MAX);
- }else if(xd->mb_to_left_edge ==0)
- { /* only has left MB for sad calculation. */
- near_sad[1] = near_sad[2] = INT_MAX;
- near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,xd->dst.y_stride, UINT_MAX);
- }else
- {
- near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,xd->dst.y_stride, UINT_MAX);
- near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - 16,xd->dst.y_stride, UINT_MAX);
- near_sad[2] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16 -16,xd->dst.y_stride, UINT_MAX);
- }
-
- if(cpi->common.last_frame_type != KEY_FRAME)
- {
- /* calculate sad for last frame 5 nearby MBs. */
- unsigned char *pre_y_buffer = cpi->common.yv12_fb[cpi->common.lst_fb_idx].y_buffer + recon_yoffset;
- int pre_y_stride = cpi->common.yv12_fb[cpi->common.lst_fb_idx].y_stride;
-
- if(xd->mb_to_top_edge==0) near_sad[4] = INT_MAX;
- if(xd->mb_to_left_edge ==0) near_sad[5] = INT_MAX;
- if(xd->mb_to_right_edge ==0) near_sad[6] = INT_MAX;
- if(xd->mb_to_bottom_edge==0) near_sad[7] = INT_MAX;
-
- if(near_sad[4] != INT_MAX)
- near_sad[4] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer - pre_y_stride *16, pre_y_stride, UINT_MAX);
- if(near_sad[5] != INT_MAX)
- near_sad[5] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer - 16, pre_y_stride, UINT_MAX);
- near_sad[3] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer, pre_y_stride, UINT_MAX);
- if(near_sad[6] != INT_MAX)
- near_sad[6] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer + 16, pre_y_stride, UINT_MAX);
- if(near_sad[7] != INT_MAX)
- near_sad[7] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer + pre_y_stride *16, pre_y_stride, UINT_MAX);
- }
-
- if(cpi->common.last_frame_type != KEY_FRAME)
- {
- insertsortsad(near_sad, near_sadidx, 8);
- }else
- {
- insertsortsad(near_sad, near_sadidx, 3);
- }
-}
-
-static void rd_update_mvcount(MACROBLOCK *x, int_mv *best_ref_mv)
-{
- if (x->e_mbd.mode_info_context->mbmi.mode == SPLITMV)
- {
- int i;
-
- for (i = 0; i < x->partition_info->count; i++)
- {
- if (x->partition_info->bmi[i].mode == NEW4X4)
- {
- x->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row
- - best_ref_mv->as_mv.row) >> 1)]++;
- x->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col
- - best_ref_mv->as_mv.col) >> 1)]++;
- }
- }
- }
- else if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV)
- {
- x->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row
- - best_ref_mv->as_mv.row) >> 1)]++;
- x->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col
- - best_ref_mv->as_mv.col) >> 1)]++;
- }
-}
-
-static int evaluate_inter_mode_rd(int mdcounts[4],
- RATE_DISTORTION* rd,
- int* disable_skip,
- VP8_COMP *cpi, MACROBLOCK *x)
-{
- MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode;
- BLOCK *b = &x->block[0];
- MACROBLOCKD *xd = &x->e_mbd;
- int distortion;
- vp8_build_inter16x16_predictors_mby(&x->e_mbd, x->e_mbd.predictor, 16);
-
- if (cpi->active_map_enabled && x->active_ptr[0] == 0) {
- x->skip = 1;
- }
- else if (x->encode_breakout)
- {
- unsigned int sse;
- unsigned int var;
- unsigned int threshold = (xd->block[0].dequant[1]
- * xd->block[0].dequant[1] >>4);
-
- if(threshold < x->encode_breakout)
- threshold = x->encode_breakout;
-
- var = vp8_variance16x16
- (*(b->base_src), b->src_stride,
- x->e_mbd.predictor, 16, &sse);
-
- if (sse < threshold)
- {
- unsigned int q2dc = xd->block[24].dequant[0];
- /* If theres is no codeable 2nd order dc
- or a very small uniform pixel change change */
- if ((sse - var < q2dc * q2dc >>4) ||
- (sse /2 > var && sse-var < 64))
- {
- /* Check u and v to make sure skip is ok */
- unsigned int sse2 = VP8_UVSSE(x);
- if (sse2 * 2 < threshold)
- {
- x->skip = 1;
- rd->distortion2 = sse + sse2;
- rd->rate2 = 500;
-
- /* for best_yrd calculation */
- rd->rate_uv = 0;
- rd->distortion_uv = sse2;
-
- *disable_skip = 1;
- return RDCOST(x->rdmult, x->rddiv, rd->rate2,
- rd->distortion2);
- }
- }
- }
- }
-
-
- /* Add in the Mv/mode cost */
- rd->rate2 += vp8_cost_mv_ref(this_mode, mdcounts);
-
- /* Y cost and distortion */
- macro_block_yrd(x, &rd->rate_y, &distortion);
- rd->rate2 += rd->rate_y;
- rd->distortion2 += distortion;
-
- /* UV cost and distortion */
- rd_inter16x16_uv(cpi, x, &rd->rate_uv, &rd->distortion_uv,
- cpi->common.full_pixel);
- rd->rate2 += rd->rate_uv;
- rd->distortion2 += rd->distortion_uv;
- return INT_MAX;
-}
-
-static int calculate_final_rd_costs(int this_rd,
- RATE_DISTORTION* rd,
- int* other_cost,
- int disable_skip,
- int uv_intra_tteob,
- int intra_rd_penalty,
- VP8_COMP *cpi, MACROBLOCK *x)
-{
- MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode;
-
- /* Where skip is allowable add in the default per mb cost for the no
- * skip case. where we then decide to skip we have to delete this and
- * replace it with the cost of signalling a skip
- */
- if (cpi->common.mb_no_coeff_skip)
- {
- *other_cost += vp8_cost_bit(cpi->prob_skip_false, 0);
- rd->rate2 += *other_cost;
- }
-
- /* Estimate the reference frame signaling cost and add it
- * to the rolling cost variable.
- */
- rd->rate2 +=
- x->ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
-
- if (!disable_skip)
- {
- /* Test for the condition where skip block will be activated
- * because there are no non zero coefficients and make any
- * necessary adjustment for rate
- */
- if (cpi->common.mb_no_coeff_skip)
- {
- int i;
- int tteob;
- int has_y2_block = (this_mode!=SPLITMV && this_mode!=B_PRED);
-
- tteob = 0;
- if(has_y2_block)
- tteob += x->e_mbd.eobs[24];
-
- for (i = 0; i < 16; i++)
- tteob += (x->e_mbd.eobs[i] > has_y2_block);
-
- if (x->e_mbd.mode_info_context->mbmi.ref_frame)
- {
- for (i = 16; i < 24; i++)
- tteob += x->e_mbd.eobs[i];
- }
- else
- tteob += uv_intra_tteob;
-
- if (tteob == 0)
- {
- rd->rate2 -= (rd->rate_y + rd->rate_uv);
- /* for best_yrd calculation */
- rd->rate_uv = 0;
-
- /* Back out no skip flag costing and add in skip flag costing */
- if (cpi->prob_skip_false)
- {
- int prob_skip_cost;
-
- prob_skip_cost = vp8_cost_bit(cpi->prob_skip_false, 1);
- prob_skip_cost -= vp8_cost_bit(cpi->prob_skip_false, 0);
- rd->rate2 += prob_skip_cost;
- *other_cost += prob_skip_cost;
- }
- }
- }
- /* Calculate the final RD estimate for this mode */
- this_rd = RDCOST(x->rdmult, x->rddiv, rd->rate2, rd->distortion2);
- if (this_rd < INT_MAX && x->e_mbd.mode_info_context->mbmi.ref_frame
- == INTRA_FRAME)
- this_rd += intra_rd_penalty;
- }
- return this_rd;
-}
-
-static void update_best_mode(BEST_MODE* best_mode, int this_rd,
- RATE_DISTORTION* rd, int other_cost, MACROBLOCK *x)
-{
- MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode;
-
- other_cost +=
- x->ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
-
- /* Calculate the final y RD estimate for this mode */
- best_mode->yrd = RDCOST(x->rdmult, x->rddiv, (rd->rate2-rd->rate_uv-other_cost),
- (rd->distortion2-rd->distortion_uv));
-
- best_mode->rd = this_rd;
- vpx_memcpy(&best_mode->mbmode, &x->e_mbd.mode_info_context->mbmi, sizeof(MB_MODE_INFO));
- vpx_memcpy(&best_mode->partition, x->partition_info, sizeof(PARTITION_INFO));
-
- if ((this_mode == B_PRED) || (this_mode == SPLITMV))
- {
- int i;
- for (i = 0; i < 16; i++)
- {
- best_mode->bmodes[i] = x->e_mbd.block[i].bmi;
- }
- }
-}
-
-void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
- int recon_uvoffset, int *returnrate,
- int *returndistortion, int *returnintra)
-{
- BLOCK *b = &x->block[0];
- BLOCKD *d = &x->e_mbd.block[0];
- MACROBLOCKD *xd = &x->e_mbd;
- int_mv best_ref_mv_sb[2];
- int_mv mode_mv_sb[2][MB_MODE_COUNT];
- int_mv best_ref_mv;
- int_mv *mode_mv;
- MB_PREDICTION_MODE this_mode;
- int num00;
- int best_mode_index = 0;
- BEST_MODE best_mode;
-
- int i;
- int mode_index;
- int mdcounts[4];
- int rate;
- RATE_DISTORTION rd;
- int uv_intra_rate = 0, uv_intra_distortion = 0, uv_intra_rate_tokenonly = 0;
- int uv_intra_tteob = 0;
- int uv_intra_done = 0;
-
- MB_PREDICTION_MODE uv_intra_mode = 0;
- int_mv mvp;
- int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- int saddone=0;
- /* search range got from mv_pred(). It uses step_param levels. (0-7) */
- int sr=0;
-
- unsigned char *plane[4][3];
- int ref_frame_map[4];
- int sign_bias = 0;
-
- int intra_rd_penalty = 10* vp8_dc_quant(cpi->common.base_qindex,
- cpi->common.y1dc_delta_q);
-
-#if CONFIG_TEMPORAL_DENOISING
- unsigned int zero_mv_sse = INT_MAX, best_sse = INT_MAX,
- best_rd_sse = INT_MAX;
-#endif
-
- mode_mv = mode_mv_sb[sign_bias];
- best_ref_mv.as_int = 0;
- best_mode.rd = INT_MAX;
- best_mode.yrd = INT_MAX;
- best_mode.intra_rd = INT_MAX;
- vpx_memset(mode_mv_sb, 0, sizeof(mode_mv_sb));
- vpx_memset(&best_mode.mbmode, 0, sizeof(best_mode.mbmode));
- vpx_memset(&best_mode.bmodes, 0, sizeof(best_mode.bmodes));
-
- /* Setup search priorities */
- get_reference_search_order(cpi, ref_frame_map);
-
- /* Check to see if there is at least 1 valid reference frame that we need
- * to calculate near_mvs.
- */
- if (ref_frame_map[1] > 0)
- {
- sign_bias = vp8_find_near_mvs_bias(&x->e_mbd,
- x->e_mbd.mode_info_context,
- mode_mv_sb,
- best_ref_mv_sb,
- mdcounts,
- ref_frame_map[1],
- cpi->common.ref_frame_sign_bias);
-
- mode_mv = mode_mv_sb[sign_bias];
- best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
- }
-
- get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
-
- *returnintra = INT_MAX;
- /* Count of the number of MBs tested so far this frame */
- x->mbs_tested_so_far++;
-
- x->skip = 0;
-
- for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
- {
- int this_rd = INT_MAX;
- int disable_skip = 0;
- int other_cost = 0;
- int this_ref_frame = ref_frame_map[vp8_ref_frame_order[mode_index]];
-
- /* Test best rd so far against threshold for trying this mode. */
- if (best_mode.rd <= x->rd_threshes[mode_index])
- continue;
-
- if (this_ref_frame < 0)
- continue;
-
- /* These variables hold are rolling total cost and distortion for
- * this mode
- */
- rd.rate2 = 0;
- rd.distortion2 = 0;
-
- this_mode = vp8_mode_order[mode_index];
-
- x->e_mbd.mode_info_context->mbmi.mode = this_mode;
- x->e_mbd.mode_info_context->mbmi.ref_frame = this_ref_frame;
-
- /* Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
- * unless ARNR filtering is enabled in which case we want
- * an unfiltered alternative
- */
- if (cpi->is_src_frame_alt_ref && (cpi->oxcf.arnr_max_frames == 0))
- {
- if (this_mode != ZEROMV || x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME)
- continue;
- }
-
- /* everything but intra */
- if (x->e_mbd.mode_info_context->mbmi.ref_frame)
- {
- x->e_mbd.pre.y_buffer = plane[this_ref_frame][0];
- x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
- x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
-
- if (sign_bias != cpi->common.ref_frame_sign_bias[this_ref_frame])
- {
- sign_bias = cpi->common.ref_frame_sign_bias[this_ref_frame];
- mode_mv = mode_mv_sb[sign_bias];
- best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
- }
- }
-
- /* Check to see if the testing frequency for this mode is at its
- * max If so then prevent it from being tested and increase the
- * threshold for its testing
- */
- if (x->mode_test_hit_counts[mode_index] && (cpi->mode_check_freq[mode_index] > 1))
- {
- if (x->mbs_tested_so_far <= cpi->mode_check_freq[mode_index] * x->mode_test_hit_counts[mode_index])
- {
- /* Increase the threshold for coding this mode to make it
- * less likely to be chosen
- */
- x->rd_thresh_mult[mode_index] += 4;
-
- if (x->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
- x->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
-
- x->rd_threshes[mode_index] =
- (cpi->rd_baseline_thresh[mode_index] >> 7) *
- x->rd_thresh_mult[mode_index];
-
- continue;
- }
- }
-
- /* We have now reached the point where we are going to test the
- * current mode so increment the counter for the number of times
- * it has been tested
- */
- x->mode_test_hit_counts[mode_index] ++;
-
- /* Experimental code. Special case for gf and arf zeromv modes.
- * Increase zbin size to supress noise
- */
- if (x->zbin_mode_boost_enabled)
- {
- if ( this_ref_frame == INTRA_FRAME )
- x->zbin_mode_boost = 0;
- else
- {
- if (vp8_mode_order[mode_index] == ZEROMV)
- {
- if (this_ref_frame != LAST_FRAME)
- x->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
- else
- x->zbin_mode_boost = LF_ZEROMV_ZBIN_BOOST;
- }
- else if (vp8_mode_order[mode_index] == SPLITMV)
- x->zbin_mode_boost = 0;
- else
- x->zbin_mode_boost = MV_ZBIN_BOOST;
- }
-
- vp8_update_zbin_extra(cpi, x);
- }
-
- if(!uv_intra_done && this_ref_frame == INTRA_FRAME)
- {
- rd_pick_intra_mbuv_mode(x, &uv_intra_rate,
- &uv_intra_rate_tokenonly,
- &uv_intra_distortion);
- uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
-
- /*
- * Total of the eobs is used later to further adjust rate2. Since uv
- * block's intra eobs will be overwritten when we check inter modes,
- * we need to save uv_intra_tteob here.
- */
- for (i = 16; i < 24; i++)
- uv_intra_tteob += x->e_mbd.eobs[i];
-
- uv_intra_done = 1;
- }
-
- switch (this_mode)
- {
- case B_PRED:
- {
- int tmp_rd;
-
- /* Note the rate value returned here includes the cost of
- * coding the BPRED mode: x->mbmode_cost[x->e_mbd.frame_type][BPRED]
- */
- int distortion;
- tmp_rd = rd_pick_intra4x4mby_modes(x, &rate, &rd.rate_y, &distortion, best_mode.yrd);
- rd.rate2 += rate;
- rd.distortion2 += distortion;
-
- if(tmp_rd < best_mode.yrd)
- {
- rd.rate2 += uv_intra_rate;
- rd.rate_uv = uv_intra_rate_tokenonly;
- rd.distortion2 += uv_intra_distortion;
- rd.distortion_uv = uv_intra_distortion;
- }
- else
- {
- this_rd = INT_MAX;
- disable_skip = 1;
- }
- }
- break;
-
- case SPLITMV:
- {
- int tmp_rd;
- int this_rd_thresh;
- int distortion;
-
- this_rd_thresh = (vp8_ref_frame_order[mode_index] == 1) ?
- x->rd_threshes[THR_NEW1] : x->rd_threshes[THR_NEW3];
- this_rd_thresh = (vp8_ref_frame_order[mode_index] == 2) ?
- x->rd_threshes[THR_NEW2] : this_rd_thresh;
-
- tmp_rd = vp8_rd_pick_best_mbsegmentation(cpi, x, &best_ref_mv,
- best_mode.yrd, mdcounts,
- &rate, &rd.rate_y, &distortion, this_rd_thresh) ;
-
- rd.rate2 += rate;
- rd.distortion2 += distortion;
-
- /* If even the 'Y' rd value of split is higher than best so far
- * then dont bother looking at UV
- */
- if (tmp_rd < best_mode.yrd)
- {
- /* Now work out UV cost and add it in */
- rd_inter4x4_uv(cpi, x, &rd.rate_uv, &rd.distortion_uv, cpi->common.full_pixel);
- rd.rate2 += rd.rate_uv;
- rd.distortion2 += rd.distortion_uv;
- }
- else
- {
- this_rd = INT_MAX;
- disable_skip = 1;
- }
- }
- break;
- case DC_PRED:
- case V_PRED:
- case H_PRED:
- case TM_PRED:
- {
- int distortion;
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
-
- vp8_build_intra_predictors_mby_s(xd,
- xd->dst.y_buffer - xd->dst.y_stride,
- xd->dst.y_buffer - 1,
- xd->dst.y_stride,
- xd->predictor,
- 16);
- macro_block_yrd(x, &rd.rate_y, &distortion) ;
- rd.rate2 += rd.rate_y;
- rd.distortion2 += distortion;
- rd.rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
- rd.rate2 += uv_intra_rate;
- rd.rate_uv = uv_intra_rate_tokenonly;
- rd.distortion2 += uv_intra_distortion;
- rd.distortion_uv = uv_intra_distortion;
- }
- break;
-
- case NEWMV:
- {
- int thissme;
- int bestsme = INT_MAX;
- int step_param = cpi->sf.first_step;
- int further_steps;
- int n;
- int do_refine=1; /* If last step (1-away) of n-step search doesn't pick the center point as the best match,
- we will do a final 1-away diamond refining search */
-
- int sadpb = x->sadperbit16;
- int_mv mvp_full;
-
- int col_min = ((best_ref_mv.as_mv.col+7)>>3) - MAX_FULL_PEL_VAL;
- int row_min = ((best_ref_mv.as_mv.row+7)>>3) - MAX_FULL_PEL_VAL;
- int col_max = (best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL;
- int row_max = (best_ref_mv.as_mv.row>>3) + MAX_FULL_PEL_VAL;
-
- int tmp_col_min = x->mv_col_min;
- int tmp_col_max = x->mv_col_max;
- int tmp_row_min = x->mv_row_min;
- int tmp_row_max = x->mv_row_max;
-
- if(!saddone)
- {
- vp8_cal_sad(cpi,xd,x, recon_yoffset ,&near_sadidx[0] );
- saddone = 1;
- }
-
- vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context, &mvp,
- x->e_mbd.mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias, &sr, &near_sadidx[0]);
-
- mvp_full.as_mv.col = mvp.as_mv.col>>3;
- mvp_full.as_mv.row = mvp.as_mv.row>>3;
-
- /* Get intersection of UMV window and valid MV window to
- * reduce # of checks in diamond search.
- */
- if (x->mv_col_min < col_min )
- x->mv_col_min = col_min;
- if (x->mv_col_max > col_max )
- x->mv_col_max = col_max;
- if (x->mv_row_min < row_min )
- x->mv_row_min = row_min;
- if (x->mv_row_max > row_max )
- x->mv_row_max = row_max;
-
- /* adjust search range according to sr from mv prediction */
- if(sr > step_param)
- step_param = sr;
-
- /* Initial step/diamond search */
- {
- bestsme = cpi->diamond_search_sad(x, b, d, &mvp_full, &d->bmi.mv,
- step_param, sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16],
- x->mvcost, &best_ref_mv);
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
-
- /* Further step/diamond searches as necessary */
- n = 0;
- further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
-
- n = num00;
- num00 = 0;
-
- /* 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 = cpi->diamond_search_sad(x, b, d, &mvp_full,
- &d->bmi.mv, step_param + n, sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16], x->mvcost,
- &best_ref_mv);
-
- /* check to see if refining search is needed. */
- if (num00 > (further_steps-n))
- do_refine = 0;
-
- if (thissme < bestsme)
- {
- bestsme = thissme;
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
- }
- else
- {
- d->bmi.mv.as_int = mode_mv[NEWMV].as_int;
- }
- }
- }
- }
-
- /* final 1-away diamond refining search */
- if (do_refine == 1)
- {
- int search_range;
-
- search_range = 8;
-
- thissme = cpi->refining_search_sad(x, b, d, &d->bmi.mv, sadpb,
- search_range, &cpi->fn_ptr[BLOCK_16X16],
- x->mvcost, &best_ref_mv);
-
- if (thissme < bestsme)
- {
- bestsme = thissme;
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
- }
- else
- {
- d->bmi.mv.as_int = mode_mv[NEWMV].as_int;
- }
- }
-
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
-
- if (bestsme < INT_MAX)
- {
- int dis; /* TODO: use dis in distortion calculation later. */
- unsigned int sse;
- cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, &best_ref_mv,
- x->errorperbit,
- &cpi->fn_ptr[BLOCK_16X16],
- x->mvcost, &dis, &sse);
- }
-
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
-
- /* Add the new motion vector cost to our rolling cost variable */
- rd.rate2 += vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv, x->mvcost, 96);
- }
-
- case NEARESTMV:
- case NEARMV:
- /* Clip "next_nearest" so that it does not extend to far out
- * of image
- */
- vp8_clamp_mv2(&mode_mv[this_mode], xd);
-
- /* Do not bother proceeding if the vector (from newmv, nearest
- * or near) is 0,0 as this should then be coded using the zeromv
- * mode.
- */
- if (((this_mode == NEARMV) || (this_mode == NEARESTMV)) && (mode_mv[this_mode].as_int == 0))
- continue;
-
- case ZEROMV:
-
- /* Trap vectors that reach beyond the UMV borders
- * Note that ALL New MV, Nearest MV Near MV and Zero MV code
- * drops through to this point because of the lack of break
- * statements in the previous two cases.
- */
- if (((mode_mv[this_mode].as_mv.row >> 3) < x->mv_row_min) || ((mode_mv[this_mode].as_mv.row >> 3) > x->mv_row_max) ||
- ((mode_mv[this_mode].as_mv.col >> 3) < x->mv_col_min) || ((mode_mv[this_mode].as_mv.col >> 3) > x->mv_col_max))
- continue;
-
- vp8_set_mbmode_and_mvs(x, this_mode, &mode_mv[this_mode]);
- this_rd = evaluate_inter_mode_rd(mdcounts, &rd,
- &disable_skip, cpi, x);
- break;
-
- default:
- break;
- }
-
- this_rd = calculate_final_rd_costs(this_rd, &rd, &other_cost,
- disable_skip, uv_intra_tteob,
- intra_rd_penalty, cpi, x);
-
- /* Keep record of best intra distortion */
- if ((x->e_mbd.mode_info_context->mbmi.ref_frame == INTRA_FRAME) &&
- (this_rd < best_mode.intra_rd) )
- {
- best_mode.intra_rd = this_rd;
- *returnintra = rd.distortion2 ;
- }
-#if CONFIG_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity)
- {
- unsigned int sse;
- vp8_get_inter_mbpred_error(x,&cpi->fn_ptr[BLOCK_16X16],&sse,
- mode_mv[this_mode]);
-
- if (sse < best_rd_sse)
- best_rd_sse = sse;
-
- /* Store for later use by denoiser. */
- if (this_mode == ZEROMV && sse < zero_mv_sse )
- {
- zero_mv_sse = sse;
- x->best_zeromv_reference_frame =
- x->e_mbd.mode_info_context->mbmi.ref_frame;
- }
-
- /* Store the best NEWMV in x for later use in the denoiser. */
- if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV &&
- sse < best_sse)
- {
- best_sse = sse;
- vp8_get_inter_mbpred_error(x,&cpi->fn_ptr[BLOCK_16X16],&best_sse,
- mode_mv[this_mode]);
- x->best_sse_inter_mode = NEWMV;
- x->best_sse_mv = x->e_mbd.mode_info_context->mbmi.mv;
- x->need_to_clamp_best_mvs =
- x->e_mbd.mode_info_context->mbmi.need_to_clamp_mvs;
- x->best_reference_frame =
- x->e_mbd.mode_info_context->mbmi.ref_frame;
- }
- }
-#endif
-
- /* Did this mode help.. i.i is it the new best mode */
- if (this_rd < best_mode.rd || x->skip)
- {
- /* Note index of best mode so far */
- best_mode_index = mode_index;
- *returnrate = rd.rate2;
- *returndistortion = rd.distortion2;
- if (this_mode <= B_PRED)
- {
- x->e_mbd.mode_info_context->mbmi.uv_mode = uv_intra_mode;
- /* required for left and above block mv */
- x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
- }
- update_best_mode(&best_mode, this_rd, &rd, other_cost, x);
-
-
- /* Testing this mode gave rise to an improvement in best error
- * score. Lower threshold a bit for next time
- */
- x->rd_thresh_mult[mode_index] =
- (x->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ?
- x->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT;
- }
-
- /* If the mode did not help improve the best error case then raise
- * the threshold for testing that mode next time around.
- */
- else
- {
- x->rd_thresh_mult[mode_index] += 4;
-
- if (x->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
- x->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
- }
- x->rd_threshes[mode_index] =
- (cpi->rd_baseline_thresh[mode_index] >> 7) *
- x->rd_thresh_mult[mode_index];
-
- if (x->skip)
- break;
-
- }
-
- /* Reduce the activation RD thresholds for the best choice mode */
- if ((cpi->rd_baseline_thresh[best_mode_index] > 0) && (cpi->rd_baseline_thresh[best_mode_index] < (INT_MAX >> 2)))
- {
- int best_adjustment = (x->rd_thresh_mult[best_mode_index] >> 2);
-
- x->rd_thresh_mult[best_mode_index] =
- (x->rd_thresh_mult[best_mode_index] >=
- (MIN_THRESHMULT + best_adjustment)) ?
- x->rd_thresh_mult[best_mode_index] - best_adjustment :
- MIN_THRESHMULT;
- x->rd_threshes[best_mode_index] =
- (cpi->rd_baseline_thresh[best_mode_index] >> 7) *
- x->rd_thresh_mult[best_mode_index];
- }
-
-#if CONFIG_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity)
- {
- if (x->best_sse_inter_mode == DC_PRED)
- {
- /* No best MV found. */
- x->best_sse_inter_mode = best_mode.mbmode.mode;
- x->best_sse_mv = best_mode.mbmode.mv;
- x->need_to_clamp_best_mvs = best_mode.mbmode.need_to_clamp_mvs;
- x->best_reference_frame = best_mode.mbmode.ref_frame;
- best_sse = best_rd_sse;
- }
- vp8_denoiser_denoise_mb(&cpi->denoiser, x, best_sse, zero_mv_sse,
- recon_yoffset, recon_uvoffset);
-
-
- /* Reevaluate ZEROMV after denoising. */
- if (best_mode.mbmode.ref_frame == INTRA_FRAME &&
- x->best_zeromv_reference_frame != INTRA_FRAME)
- {
- int this_rd = INT_MAX;
- int disable_skip = 0;
- int other_cost = 0;
- int this_ref_frame = x->best_zeromv_reference_frame;
- rd.rate2 = x->ref_frame_cost[this_ref_frame] +
- vp8_cost_mv_ref(ZEROMV, mdcounts);
- rd.distortion2 = 0;
-
- /* set up the proper prediction buffers for the frame */
- x->e_mbd.mode_info_context->mbmi.ref_frame = this_ref_frame;
- x->e_mbd.pre.y_buffer = plane[this_ref_frame][0];
- x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
- x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
-
- x->e_mbd.mode_info_context->mbmi.mode = ZEROMV;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
- x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
-
- this_rd = evaluate_inter_mode_rd(mdcounts, &rd, &disable_skip, cpi, x);
- this_rd = calculate_final_rd_costs(this_rd, &rd, &other_cost,
- disable_skip, uv_intra_tteob,
- intra_rd_penalty, cpi, x);
- if (this_rd < best_mode.rd || x->skip)
- {
- /* Note index of best mode so far */
- best_mode_index = mode_index;
- *returnrate = rd.rate2;
- *returndistortion = rd.distortion2;
- update_best_mode(&best_mode, this_rd, &rd, other_cost, x);
- }
- }
-
- }
-#endif
-
- if (cpi->is_src_frame_alt_ref &&
- (best_mode.mbmode.mode != ZEROMV || best_mode.mbmode.ref_frame != ALTREF_FRAME))
- {
- x->e_mbd.mode_info_context->mbmi.mode = ZEROMV;
- x->e_mbd.mode_info_context->mbmi.ref_frame = ALTREF_FRAME;
- x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
- x->e_mbd.mode_info_context->mbmi.mb_skip_coeff =
- (cpi->common.mb_no_coeff_skip);
- x->e_mbd.mode_info_context->mbmi.partitioning = 0;
- return;
- }
-
-
- /* macroblock modes */
- vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mode.mbmode, sizeof(MB_MODE_INFO));
-
- if (best_mode.mbmode.mode == B_PRED)
- {
- for (i = 0; i < 16; i++)
- xd->mode_info_context->bmi[i].as_mode = best_mode.bmodes[i].as_mode;
- }
-
- if (best_mode.mbmode.mode == SPLITMV)
- {
- for (i = 0; i < 16; i++)
- xd->mode_info_context->bmi[i].mv.as_int = best_mode.bmodes[i].mv.as_int;
-
- vpx_memcpy(x->partition_info, &best_mode.partition, sizeof(PARTITION_INFO));
-
- x->e_mbd.mode_info_context->mbmi.mv.as_int =
- x->partition_info->bmi[15].mv.as_int;
- }
-
- if (sign_bias
- != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame])
- best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int;
-
- rd_update_mvcount(x, &best_ref_mv);
-}
-
-void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate_)
-{
- int error4x4, error16x16;
- int rate4x4, rate16x16 = 0, rateuv;
- int dist4x4, dist16x16, distuv;
- int rate;
- int rate4x4_tokenonly = 0;
- int rate16x16_tokenonly = 0;
- int rateuv_tokenonly = 0;
-
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
-
- rd_pick_intra_mbuv_mode(x, &rateuv, &rateuv_tokenonly, &distuv);
- rate = rateuv;
-
- error16x16 = rd_pick_intra16x16mby_mode(x, &rate16x16, &rate16x16_tokenonly,
- &dist16x16);
-
- error4x4 = rd_pick_intra4x4mby_modes(x, &rate4x4, &rate4x4_tokenonly,
- &dist4x4, error16x16);
-
- if (error4x4 < error16x16)
- {
- x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
- rate += rate4x4;
- }
- else
- {
- rate += rate16x16;
- }
-
- *rate_ = rate;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.h
deleted file mode 100644
index fe21b8e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/rdopt.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_RDOPT_H_
-#define VP8_ENCODER_RDOPT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) )
-
-static void insertsortmv(int arr[], int len)
-{
- int i, j, k;
-
- for ( i = 1 ; i <= len-1 ; i++ )
- {
- for ( j = 0 ; j < i ; j++ )
- {
- if ( arr[j] > arr[i] )
- {
- int temp;
-
- temp = arr[i];
-
- for ( k = i; k >j; k--)
- arr[k] = arr[k - 1] ;
-
- arr[j] = temp ;
- }
- }
- }
-}
-
-static void insertsortsad(int arr[],int idx[], int len)
-{
- int i, j, k;
-
- for ( i = 1 ; i <= len-1 ; i++ )
- {
- for ( j = 0 ; j < i ; j++ )
- {
- if ( arr[j] > arr[i] )
- {
- int temp, tempi;
-
- temp = arr[i];
- tempi = idx[i];
-
- for ( k = i; k >j; k--)
- {
- arr[k] = arr[k - 1] ;
- idx[k] = idx[k - 1];
- }
-
- arr[j] = temp ;
- idx[j] = tempi;
- }
- }
- }
-}
-
-extern void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue);
-extern void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra);
-extern void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate);
-
-
-static void get_plane_pointers(const YV12_BUFFER_CONFIG *fb,
- unsigned char *plane[3],
- unsigned int recon_yoffset,
- unsigned int recon_uvoffset)
-{
- plane[0] = fb->y_buffer + recon_yoffset;
- plane[1] = fb->u_buffer + recon_uvoffset;
- plane[2] = fb->v_buffer + recon_uvoffset;
-}
-
-
-static void get_predictor_pointers(const VP8_COMP *cpi,
- unsigned char *plane[4][3],
- unsigned int recon_yoffset,
- unsigned int recon_uvoffset)
-{
- if (cpi->ref_frame_flags & VP8_LAST_FRAME)
- get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx],
- plane[LAST_FRAME], recon_yoffset, recon_uvoffset);
-
- if (cpi->ref_frame_flags & VP8_GOLD_FRAME)
- get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx],
- plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset);
-
- if (cpi->ref_frame_flags & VP8_ALTR_FRAME)
- get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx],
- plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset);
-}
-
-
-static void get_reference_search_order(const VP8_COMP *cpi,
- int ref_frame_map[4])
-{
- int i=0;
-
- ref_frame_map[i++] = INTRA_FRAME;
- if (cpi->ref_frame_flags & VP8_LAST_FRAME)
- ref_frame_map[i++] = LAST_FRAME;
- if (cpi->ref_frame_flags & VP8_GOLD_FRAME)
- ref_frame_map[i++] = GOLDEN_FRAME;
- if (cpi->ref_frame_flags & VP8_ALTR_FRAME)
- ref_frame_map[i++] = ALTREF_FRAME;
- for(; i<4; i++)
- ref_frame_map[i] = -1;
-}
-
-
-extern void vp8_mv_pred
-(
- VP8_COMP *cpi,
- MACROBLOCKD *xd,
- const MODE_INFO *here,
- int_mv *mvp,
- int refframe,
- int *ref_frame_sign_bias,
- int *sr,
- int near_sadidx[]
-);
-void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffset, int near_sadidx[]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_RDOPT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.c
deleted file mode 100644
index 37972e2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "segmentation.h"
-#include "vpx_mem/vpx_mem.h"
-
-void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x)
-{
- int mb_row, mb_col;
-
- MODE_INFO *this_mb_mode_info = cm->mi;
-
- x->gf_active_ptr = (signed char *)cpi->gf_active_flags;
-
- if ((cm->frame_type == KEY_FRAME) || (cm->refresh_golden_frame))
- {
- /* Reset Gf useage monitors */
- vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
- }
- else
- {
- /* for each macroblock row in image */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
- {
- /* for each macroblock col in image */
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
- {
-
- /* If using golden then set GF active flag if not already set.
- * If using last frame 0,0 mode then leave flag as it is
- * else if using non 0,0 motion or intra modes then clear
- * flag if it is currently set
- */
- if ((this_mb_mode_info->mbmi.ref_frame == GOLDEN_FRAME) || (this_mb_mode_info->mbmi.ref_frame == ALTREF_FRAME))
- {
- if (*(x->gf_active_ptr) == 0)
- {
- *(x->gf_active_ptr) = 1;
- cpi->gf_active_count ++;
- }
- }
- else if ((this_mb_mode_info->mbmi.mode != ZEROMV) && *(x->gf_active_ptr))
- {
- *(x->gf_active_ptr) = 0;
- cpi->gf_active_count--;
- }
-
- x->gf_active_ptr++; /* Step onto next entry */
- this_mb_mode_info++; /* skip to next mb */
-
- }
-
- /* this is to account for the border */
- this_mb_mode_info++;
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.h
deleted file mode 100644
index 6b55005..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/segmentation.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP8_ENCODER_SEGMENTATION_H_
-#define VP8_ENCODER_SEGMENTATION_H_
-
-#include "string.h"
-#include "vp8/common/blockd.h"
-#include "onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_SEGMENTATION_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/ssim.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/ssim.c
deleted file mode 100644
index e751608..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/ssim.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "onyx_int.h"
-
-void vp8_ssim_parms_16x16_c
-(
- unsigned char *s,
- int sp,
- unsigned char *r,
- int rp,
- unsigned long *sum_s,
- unsigned long *sum_r,
- unsigned long *sum_sq_s,
- unsigned long *sum_sq_r,
- unsigned long *sum_sxr
-)
-{
- int i,j;
- for(i=0;i<16;i++,s+=sp,r+=rp)
- {
- for(j=0;j<16;j++)
- {
- *sum_s += s[j];
- *sum_r += r[j];
- *sum_sq_s += s[j] * s[j];
- *sum_sq_r += r[j] * r[j];
- *sum_sxr += s[j] * r[j];
- }
- }
-}
-void vp8_ssim_parms_8x8_c
-(
- unsigned char *s,
- int sp,
- unsigned char *r,
- int rp,
- unsigned long *sum_s,
- unsigned long *sum_r,
- unsigned long *sum_sq_s,
- unsigned long *sum_sq_r,
- unsigned long *sum_sxr
-)
-{
- int i,j;
- for(i=0;i<8;i++,s+=sp,r+=rp)
- {
- for(j=0;j<8;j++)
- {
- *sum_s += s[j];
- *sum_r += r[j];
- *sum_sq_s += s[j] * s[j];
- *sum_sq_r += r[j] * r[j];
- *sum_sxr += s[j] * r[j];
- }
- }
-}
-
-const static int64_t cc1 = 26634; // (64^2*(.01*255)^2
-const static int64_t cc2 = 239708; // (64^2*(.03*255)^2
-
-static double similarity
-(
- unsigned long sum_s,
- unsigned long sum_r,
- unsigned long sum_sq_s,
- unsigned long sum_sq_r,
- unsigned long sum_sxr,
- int count
-)
-{
- int64_t ssim_n, ssim_d;
- int64_t c1, c2;
-
- //scale the constants by number of pixels
- c1 = (cc1*count*count)>>12;
- c2 = (cc2*count*count)>>12;
-
- ssim_n = (2*sum_s*sum_r+ c1)*((int64_t) 2*count*sum_sxr-
- (int64_t) 2*sum_s*sum_r+c2);
-
- ssim_d = (sum_s*sum_s +sum_r*sum_r+c1)*
- ((int64_t)count*sum_sq_s-(int64_t)sum_s*sum_s +
- (int64_t)count*sum_sq_r-(int64_t) sum_r*sum_r +c2) ;
-
- return ssim_n * 1.0 / ssim_d;
-}
-
-static double ssim_16x16(unsigned char *s,int sp, unsigned char *r,int rp)
-{
- unsigned long sum_s=0,sum_r=0,sum_sq_s=0,sum_sq_r=0,sum_sxr=0;
- vp8_ssim_parms_16x16(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r, &sum_sxr);
- return similarity(sum_s, sum_r, sum_sq_s, sum_sq_r, sum_sxr, 256);
-}
-static double ssim_8x8(unsigned char *s,int sp, unsigned char *r,int rp)
-{
- unsigned long sum_s=0,sum_r=0,sum_sq_s=0,sum_sq_r=0,sum_sxr=0;
- vp8_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r, &sum_sxr);
- return similarity(sum_s, sum_r, sum_sq_s, sum_sq_r, sum_sxr, 64);
-}
-
-// TODO: (jbb) tried to scale this function such that we may be able to use it
-// for distortion metric in mode selection code ( provided we do a reconstruction)
-long dssim(unsigned char *s,int sp, unsigned char *r,int rp)
-{
- unsigned long sum_s=0,sum_r=0,sum_sq_s=0,sum_sq_r=0,sum_sxr=0;
- int64_t ssim3;
- int64_t ssim_n1,ssim_n2;
- int64_t ssim_d1,ssim_d2;
- int64_t ssim_t1,ssim_t2;
- int64_t c1, c2;
-
- // normalize by 256/64
- c1 = cc1*16;
- c2 = cc2*16;
-
- vp8_ssim_parms_16x16(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r, &sum_sxr);
- ssim_n1 = (2*sum_s*sum_r+ c1);
-
- ssim_n2 =((int64_t) 2*256*sum_sxr-(int64_t) 2*sum_s*sum_r+c2);
-
- ssim_d1 =((int64_t)sum_s*sum_s +(int64_t)sum_r*sum_r+c1);
-
- ssim_d2 = (256 * (int64_t) sum_sq_s-(int64_t) sum_s*sum_s +
- (int64_t) 256*sum_sq_r-(int64_t) sum_r*sum_r +c2) ;
-
- ssim_t1 = 256 - 256 * ssim_n1 / ssim_d1;
- ssim_t2 = 256 - 256 * ssim_n2 / ssim_d2;
-
- ssim3 = 256 *ssim_t1 * ssim_t2;
- if(ssim3 <0 )
- ssim3=0;
- return (long)( ssim3 );
-}
-
-// We are using a 8x8 moving window with starting location of each 8x8 window
-// on the 4x4 pixel grid. Such arrangement allows the windows to overlap
-// block boundaries to penalize blocking artifacts.
-double vp8_ssim2
-(
- unsigned char *img1,
- unsigned char *img2,
- int stride_img1,
- int stride_img2,
- int width,
- int height
-)
-{
- int i,j;
- int samples =0;
- double ssim_total=0;
-
- // sample point start with each 4x4 location
- for(i=0; i < height-8; i+=4, img1 += stride_img1*4, img2 += stride_img2*4)
- {
- for(j=0; j < width-8; j+=4 )
- {
- double v = ssim_8x8(img1+j, stride_img1, img2+j, stride_img2);
- ssim_total += v;
- samples++;
- }
- }
- ssim_total /= samples;
- return ssim_total;
-}
-double vp8_calc_ssim
-(
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *dest,
- int lumamask,
- double *weight
-)
-{
- double a, b, c;
- double ssimv;
-
- a = vp8_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride, source->y_width,
- source->y_height);
-
- b = vp8_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
-
- c = vp8_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
-
- ssimv = a * .8 + .1 * (b + c);
-
- *weight = 1;
-
- return ssimv;
-}
-
-double vp8_calc_ssimg
-(
- YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *dest,
- double *ssim_y,
- double *ssim_u,
- double *ssim_v
-)
-{
- double ssim_all = 0;
- double a, b, c;
-
- a = vp8_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride, source->y_width,
- source->y_height);
-
- b = vp8_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
-
- c = vp8_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
- *ssim_y = a;
- *ssim_u = b;
- *ssim_v = c;
- ssim_all = (a * 4 + b + c) /6;
-
- return ssim_all;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/temporal_filter.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/temporal_filter.c
deleted file mode 100644
index eb57252..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/temporal_filter.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8/common/onyxc_int.h"
-#include "onyx_int.h"
-#include "vp8/common/systemdependent.h"
-#include "quantize.h"
-#include "vp8/common/alloccommon.h"
-#include "mcomp.h"
-#include "firstpass.h"
-#include "vpx_scale/vpx_scale.h"
-#include "vp8/common/extend.h"
-#include "ratectrl.h"
-#include "vp8/common/quant_common.h"
-#include "segmentation.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/common/swapyv12buffer.h"
-#include "vp8/common/threading.h"
-#include "vpx_ports/vpx_timer.h"
-
-#include <math.h>
-#include <limits.h>
-
-#define ALT_REF_MC_ENABLED 1 /* dis/enable MC in AltRef filtering */
-#define ALT_REF_SUBPEL_ENABLED 1 /* dis/enable subpel in MC AltRef filtering */
-
-#if VP8_TEMPORAL_ALT_REF
-
-static void vp8_temporal_filter_predictors_mb_c
-(
- MACROBLOCKD *x,
- unsigned char *y_mb_ptr,
- unsigned char *u_mb_ptr,
- unsigned char *v_mb_ptr,
- int stride,
- int mv_row,
- int mv_col,
- unsigned char *pred
-)
-{
- int offset;
- unsigned char *yptr, *uptr, *vptr;
-
- /* Y */
- yptr = y_mb_ptr + (mv_row >> 3) * stride + (mv_col >> 3);
-
- if ((mv_row | mv_col) & 7)
- {
- x->subpixel_predict16x16(yptr, stride,
- mv_col & 7, mv_row & 7, &pred[0], 16);
- }
- else
- {
- vp8_copy_mem16x16(yptr, stride, &pred[0], 16);
- }
-
- /* U & V */
- mv_row >>= 1;
- mv_col >>= 1;
- stride = (stride + 1) >> 1;
- offset = (mv_row >> 3) * stride + (mv_col >> 3);
- uptr = u_mb_ptr + offset;
- vptr = v_mb_ptr + offset;
-
- if ((mv_row | mv_col) & 7)
- {
- x->subpixel_predict8x8(uptr, stride,
- mv_col & 7, mv_row & 7, &pred[256], 8);
- x->subpixel_predict8x8(vptr, stride,
- mv_col & 7, mv_row & 7, &pred[320], 8);
- }
- else
- {
- vp8_copy_mem8x8(uptr, stride, &pred[256], 8);
- vp8_copy_mem8x8(vptr, stride, &pred[320], 8);
- }
-}
-void vp8_temporal_filter_apply_c
-(
- unsigned char *frame1,
- unsigned int stride,
- unsigned char *frame2,
- unsigned int block_size,
- int strength,
- int filter_weight,
- unsigned int *accumulator,
- unsigned short *count
-)
-{
- unsigned int i, j, k;
- int modifier;
- int byte = 0;
-
- for (i = 0,k = 0; i < block_size; i++)
- {
- for (j = 0; j < block_size; j++, k++)
- {
-
- int src_byte = frame1[byte];
- int pixel_value = *frame2++;
-
- modifier = src_byte - pixel_value;
- /* This is an integer approximation of:
- * float coeff = (3.0 * modifer * modifier) / pow(2, strength);
- * modifier = (int)roundf(coeff > 16 ? 0 : 16-coeff);
- */
- modifier *= modifier;
- modifier *= 3;
- modifier += 1 << (strength - 1);
- modifier >>= strength;
-
- if (modifier > 16)
- modifier = 16;
-
- modifier = 16 - modifier;
- modifier *= filter_weight;
-
- count[k] += modifier;
- accumulator[k] += modifier * pixel_value;
-
- byte++;
- }
-
- byte += stride - block_size;
- }
-}
-
-#if ALT_REF_MC_ENABLED
-
-static int vp8_temporal_filter_find_matching_mb_c
-(
- VP8_COMP *cpi,
- YV12_BUFFER_CONFIG *arf_frame,
- YV12_BUFFER_CONFIG *frame_ptr,
- int mb_offset,
- int error_thresh
-)
-{
- MACROBLOCK *x = &cpi->mb;
- int step_param;
- int sadpb = x->sadperbit16;
- int bestsme = INT_MAX;
-
- BLOCK *b = &x->block[0];
- BLOCKD *d = &x->e_mbd.block[0];
- int_mv best_ref_mv1;
- int_mv best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
-
- /* Save input state */
- unsigned char **base_src = b->base_src;
- int src = b->src;
- int src_stride = b->src_stride;
- unsigned char *base_pre = x->e_mbd.pre.y_buffer;
- int pre = d->offset;
- int pre_stride = x->e_mbd.pre.y_stride;
-
- best_ref_mv1.as_int = 0;
- best_ref_mv1_full.as_mv.col = best_ref_mv1.as_mv.col >>3;
- best_ref_mv1_full.as_mv.row = best_ref_mv1.as_mv.row >>3;
-
- /* Setup frame pointers */
- b->base_src = &arf_frame->y_buffer;
- b->src_stride = arf_frame->y_stride;
- b->src = mb_offset;
-
- x->e_mbd.pre.y_buffer = frame_ptr->y_buffer;
- x->e_mbd.pre.y_stride = frame_ptr->y_stride;
- d->offset = mb_offset;
- (void)error_thresh;
- /* Further step/diamond searches as necessary */
- if (cpi->Speed < 8)
- {
- step_param = cpi->sf.first_step + (cpi->Speed > 5);
- }
- else
- {
- step_param = cpi->sf.first_step + 2;
- }
-
- /* TODO Check that the 16x16 vf & sdf are selected here */
- /* Ignore mv costing by sending NULL cost arrays */
- bestsme = vp8_hex_search(x, b, d, &best_ref_mv1_full, &d->bmi.mv,
- step_param, sadpb,
- &cpi->fn_ptr[BLOCK_16X16],
- NULL, NULL, &best_ref_mv1);
-
-#if ALT_REF_SUBPEL_ENABLED
- /* Try sub-pixel MC? */
- {
- int distortion;
- unsigned int sse;
- /* Ignore mv costing by sending NULL cost array */
- bestsme = cpi->find_fractional_mv_step(x, b, d,
- &d->bmi.mv,
- &best_ref_mv1,
- x->errorperbit,
- &cpi->fn_ptr[BLOCK_16X16],
- NULL, &distortion, &sse);
- }
-#endif
-
- /* Save input state */
- b->base_src = base_src;
- b->src = src;
- b->src_stride = src_stride;
- x->e_mbd.pre.y_buffer = base_pre;
- d->offset = pre;
- x->e_mbd.pre.y_stride = pre_stride;
-
- return bestsme;
-}
-#endif
-
-static void vp8_temporal_filter_iterate_c
-(
- VP8_COMP *cpi,
- int frame_count,
- int alt_ref_index,
- int strength
-)
-{
- int byte;
- int frame;
- int mb_col, mb_row;
- unsigned int filter_weight;
- int mb_cols = cpi->common.mb_cols;
- int mb_rows = cpi->common.mb_rows;
- int mb_y_offset = 0;
- int mb_uv_offset = 0;
- DECLARE_ALIGNED_ARRAY(16, unsigned int, accumulator, 16*16 + 8*8 + 8*8);
- DECLARE_ALIGNED_ARRAY(16, unsigned short, count, 16*16 + 8*8 + 8*8);
- MACROBLOCKD *mbd = &cpi->mb.e_mbd;
- YV12_BUFFER_CONFIG *f = cpi->frames[alt_ref_index];
- unsigned char *dst1, *dst2;
- DECLARE_ALIGNED_ARRAY(16, unsigned char, predictor, 16*16 + 8*8 + 8*8);
-
- /* Save input state */
- unsigned char *y_buffer = mbd->pre.y_buffer;
- unsigned char *u_buffer = mbd->pre.u_buffer;
- unsigned char *v_buffer = mbd->pre.v_buffer;
-
- for (mb_row = 0; mb_row < mb_rows; mb_row++)
- {
-#if ALT_REF_MC_ENABLED
- /* Source frames are extended to 16 pixels. This is different than
- * L/A/G reference frames that have a border of 32 (VP8BORDERINPIXELS)
- * A 6 tap filter is used for motion search. This requires 2 pixels
- * before and 3 pixels after. So the largest Y mv on a border would
- * then be 16 - 3. The UV blocks are half the size of the Y and
- * therefore only extended by 8. The largest mv that a UV block
- * can support is 8 - 3. A UV mv is half of a Y mv.
- * (16 - 3) >> 1 == 6 which is greater than 8 - 3.
- * To keep the mv in play for both Y and UV planes the max that it
- * can be on a border is therefore 16 - 5.
- */
- cpi->mb.mv_row_min = -((mb_row * 16) + (16 - 5));
- cpi->mb.mv_row_max = ((cpi->common.mb_rows - 1 - mb_row) * 16)
- + (16 - 5);
-#endif
-
- for (mb_col = 0; mb_col < mb_cols; mb_col++)
- {
- int i, j, k;
- int stride;
-
- vpx_memset(accumulator, 0, 384*sizeof(unsigned int));
- vpx_memset(count, 0, 384*sizeof(unsigned short));
-
-#if ALT_REF_MC_ENABLED
- cpi->mb.mv_col_min = -((mb_col * 16) + (16 - 5));
- cpi->mb.mv_col_max = ((cpi->common.mb_cols - 1 - mb_col) * 16)
- + (16 - 5);
-#endif
-
- for (frame = 0; frame < frame_count; frame++)
- {
- if (cpi->frames[frame] == NULL)
- continue;
-
- mbd->block[0].bmi.mv.as_mv.row = 0;
- mbd->block[0].bmi.mv.as_mv.col = 0;
-
- if (frame == alt_ref_index)
- {
- filter_weight = 2;
- }
- else
- {
- int err = 0;
-#if ALT_REF_MC_ENABLED
-#define THRESH_LOW 10000
-#define THRESH_HIGH 20000
- /* Find best match in this frame by MC */
- err = vp8_temporal_filter_find_matching_mb_c
- (cpi,
- cpi->frames[alt_ref_index],
- cpi->frames[frame],
- mb_y_offset,
- THRESH_LOW);
-#endif
- /* Assign higher weight to matching MB if it's error
- * score is lower. If not applying MC default behavior
- * is to weight all MBs equal.
- */
- filter_weight = err<THRESH_LOW
- ? 2 : err<THRESH_HIGH ? 1 : 0;
- }
-
- if (filter_weight != 0)
- {
- /* Construct the predictors */
- vp8_temporal_filter_predictors_mb_c
- (mbd,
- cpi->frames[frame]->y_buffer + mb_y_offset,
- cpi->frames[frame]->u_buffer + mb_uv_offset,
- cpi->frames[frame]->v_buffer + mb_uv_offset,
- cpi->frames[frame]->y_stride,
- mbd->block[0].bmi.mv.as_mv.row,
- mbd->block[0].bmi.mv.as_mv.col,
- predictor);
-
- /* Apply the filter (YUV) */
- vp8_temporal_filter_apply
- (f->y_buffer + mb_y_offset,
- f->y_stride,
- predictor,
- 16,
- strength,
- filter_weight,
- accumulator,
- count);
-
- vp8_temporal_filter_apply
- (f->u_buffer + mb_uv_offset,
- f->uv_stride,
- predictor + 256,
- 8,
- strength,
- filter_weight,
- accumulator + 256,
- count + 256);
-
- vp8_temporal_filter_apply
- (f->v_buffer + mb_uv_offset,
- f->uv_stride,
- predictor + 320,
- 8,
- strength,
- filter_weight,
- accumulator + 320,
- count + 320);
- }
- }
-
- /* Normalize filter output to produce AltRef frame */
- dst1 = cpi->alt_ref_buffer.y_buffer;
- stride = cpi->alt_ref_buffer.y_stride;
- byte = mb_y_offset;
- for (i = 0,k = 0; i < 16; i++)
- {
- for (j = 0; j < 16; j++, k++)
- {
- unsigned int pval = accumulator[k] + (count[k] >> 1);
- pval *= cpi->fixed_divide[count[k]];
- pval >>= 19;
-
- dst1[byte] = (unsigned char)pval;
-
- /* move to next pixel */
- byte++;
- }
-
- byte += stride - 16;
- }
-
- dst1 = cpi->alt_ref_buffer.u_buffer;
- dst2 = cpi->alt_ref_buffer.v_buffer;
- stride = cpi->alt_ref_buffer.uv_stride;
- byte = mb_uv_offset;
- for (i = 0,k = 256; i < 8; i++)
- {
- for (j = 0; j < 8; j++, k++)
- {
- int m=k+64;
-
- /* U */
- unsigned int pval = accumulator[k] + (count[k] >> 1);
- pval *= cpi->fixed_divide[count[k]];
- pval >>= 19;
- dst1[byte] = (unsigned char)pval;
-
- /* V */
- pval = accumulator[m] + (count[m] >> 1);
- pval *= cpi->fixed_divide[count[m]];
- pval >>= 19;
- dst2[byte] = (unsigned char)pval;
-
- /* move to next pixel */
- byte++;
- }
-
- byte += stride - 8;
- }
-
- mb_y_offset += 16;
- mb_uv_offset += 8;
- }
-
- mb_y_offset += 16*(f->y_stride-mb_cols);
- mb_uv_offset += 8*(f->uv_stride-mb_cols);
- }
-
- /* Restore input state */
- mbd->pre.y_buffer = y_buffer;
- mbd->pre.u_buffer = u_buffer;
- mbd->pre.v_buffer = v_buffer;
-}
-
-void vp8_temporal_filter_prepare_c
-(
- VP8_COMP *cpi,
- int distance
-)
-{
- int frame = 0;
-
- int num_frames_backward = 0;
- int num_frames_forward = 0;
- int frames_to_blur_backward = 0;
- int frames_to_blur_forward = 0;
- int frames_to_blur = 0;
- int start_frame = 0;
-
- int strength = cpi->oxcf.arnr_strength;
-
- int blur_type = cpi->oxcf.arnr_type;
-
- int max_frames = cpi->active_arnr_frames;
-
- num_frames_backward = distance;
- num_frames_forward = vp8_lookahead_depth(cpi->lookahead)
- - (num_frames_backward + 1);
-
- switch (blur_type)
- {
- case 1:
- /* Backward Blur */
-
- frames_to_blur_backward = num_frames_backward;
-
- if (frames_to_blur_backward >= max_frames)
- frames_to_blur_backward = max_frames - 1;
-
- frames_to_blur = frames_to_blur_backward + 1;
- break;
-
- case 2:
- /* Forward Blur */
-
- frames_to_blur_forward = num_frames_forward;
-
- if (frames_to_blur_forward >= max_frames)
- frames_to_blur_forward = max_frames - 1;
-
- frames_to_blur = frames_to_blur_forward + 1;
- break;
-
- case 3:
- default:
- /* Center Blur */
- frames_to_blur_forward = num_frames_forward;
- frames_to_blur_backward = num_frames_backward;
-
- if (frames_to_blur_forward > frames_to_blur_backward)
- frames_to_blur_forward = frames_to_blur_backward;
-
- if (frames_to_blur_backward > frames_to_blur_forward)
- frames_to_blur_backward = frames_to_blur_forward;
-
- /* When max_frames is even we have 1 more frame backward than forward */
- if (frames_to_blur_forward > (max_frames - 1) / 2)
- frames_to_blur_forward = ((max_frames - 1) / 2);
-
- if (frames_to_blur_backward > (max_frames / 2))
- frames_to_blur_backward = (max_frames / 2);
-
- frames_to_blur = frames_to_blur_backward + frames_to_blur_forward + 1;
- break;
- }
-
- start_frame = distance + frames_to_blur_forward;
-
- /* Setup frame pointers, NULL indicates frame not included in filter */
- vpx_memset(cpi->frames, 0, max_frames*sizeof(YV12_BUFFER_CONFIG *));
- for (frame = 0; frame < frames_to_blur; frame++)
- {
- int which_buffer = start_frame - frame;
- struct lookahead_entry* buf = vp8_lookahead_peek(cpi->lookahead,
- which_buffer,
- PEEK_FORWARD);
- cpi->frames[frames_to_blur-1-frame] = &buf->img;
- }
-
- vp8_temporal_filter_iterate_c (
- cpi,
- frames_to_blur,
- frames_to_blur_backward,
- strength );
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.c
deleted file mode 100644
index 2dc8205..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include "onyx_int.h"
-#include "tokenize.h"
-#include "vpx_mem/vpx_mem.h"
-
-/* Global event counters used for accumulating statistics across several
- compressions, then generating context.c = initial stats. */
-
-#ifdef VP8_ENTROPY_STATS
-_int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
-#endif
-void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t) ;
-void vp8_fix_contexts(MACROBLOCKD *x);
-
-#include "dct_value_tokens.h"
-#include "dct_value_cost.h"
-
-const TOKENVALUE *const vp8_dct_value_tokens_ptr = dct_value_tokens +
- DCT_MAX_VALUE;
-const short *const vp8_dct_value_cost_ptr = dct_value_cost + DCT_MAX_VALUE;
-
-#if 0
-int skip_true_count = 0;
-int skip_false_count = 0;
-#endif
-
-/* function used to generate dct_value_tokens and dct_value_cost tables */
-/*
-static void fill_value_tokens()
-{
-
- TOKENVALUE *t = dct_value_tokens + DCT_MAX_VALUE;
- const vp8_extra_bit_struct *e = vp8_extra_bits;
-
- int i = -DCT_MAX_VALUE;
- int sign = 1;
-
- do
- {
- if (!i)
- sign = 0;
-
- {
- const int a = sign ? -i : i;
- int eb = sign;
-
- if (a > 4)
- {
- int j = 4;
-
- while (++j < 11 && e[j].base_val <= a) {}
-
- t[i].Token = --j;
- eb |= (a - e[j].base_val) << 1;
- }
- else
- t[i].Token = a;
-
- t[i].Extra = eb;
- }
-
- // initialize the cost for extra bits for all possible coefficient value.
- {
- int cost = 0;
- const vp8_extra_bit_struct *p = vp8_extra_bits + t[i].Token;
-
- if (p->base_val)
- {
- const int extra = t[i].Extra;
- const int Length = p->Len;
-
- if (Length)
- cost += vp8_treed_cost(p->tree, p->prob, extra >> 1, Length);
-
- cost += vp8_cost_bit(vp8_prob_half, extra & 1); // sign
- dct_value_cost[i + DCT_MAX_VALUE] = cost;
- }
-
- }
-
- }
- while (++i < DCT_MAX_VALUE);
-
- vp8_dct_value_tokens_ptr = dct_value_tokens + DCT_MAX_VALUE;
- vp8_dct_value_cost_ptr = dct_value_cost + DCT_MAX_VALUE;
-}
-*/
-
-static void tokenize2nd_order_b
-(
- MACROBLOCK *x,
- TOKENEXTRA **tp,
- VP8_COMP *cpi
-)
-{
- MACROBLOCKD *xd = &x->e_mbd;
- int pt; /* near block/prev token context index */
- int c; /* start at DC */
- TOKENEXTRA *t = *tp;/* store tokens starting here */
- const BLOCKD *b;
- const short *qcoeff_ptr;
- ENTROPY_CONTEXT * a;
- ENTROPY_CONTEXT * l;
- int band, rc, v, token;
- int eob;
-
- b = xd->block + 24;
- qcoeff_ptr = b->qcoeff;
- a = (ENTROPY_CONTEXT *)xd->above_context + 8;
- l = (ENTROPY_CONTEXT *)xd->left_context + 8;
- eob = xd->eobs[24];
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
-
- if(!eob)
- {
- /* c = band for this case */
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt];
- t->skip_eob_node = 0;
-
- ++x->coef_counts [1] [0] [pt] [DCT_EOB_TOKEN];
- t++;
- *tp = t;
- *a = *l = 0;
- return;
- }
-
- v = qcoeff_ptr[0];
- t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
- token = vp8_dct_value_tokens_ptr[v].Token;
- t->Token = token;
-
- t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt];
- t->skip_eob_node = 0;
- ++x->coef_counts [1] [0] [pt] [token];
- pt = vp8_prev_token_class[token];
- t++;
- c = 1;
-
- for (; c < eob; c++)
- {
- rc = vp8_default_zig_zag1d[c];
- band = vp8_coef_bands[c];
- v = qcoeff_ptr[rc];
-
- t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
- token = vp8_dct_value_tokens_ptr[v].Token;
-
- t->Token = token;
- t->context_tree = cpi->common.fc.coef_probs [1] [band] [pt];
-
- t->skip_eob_node = ((pt == 0));
-
- ++x->coef_counts [1] [band] [pt] [token];
-
- pt = vp8_prev_token_class[token];
- t++;
- }
- if (c < 16)
- {
- band = vp8_coef_bands[c];
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [1] [band] [pt];
-
- t->skip_eob_node = 0;
-
- ++x->coef_counts [1] [band] [pt] [DCT_EOB_TOKEN];
-
- t++;
- }
-
- *tp = t;
- *a = *l = 1;
-
-}
-
-static void tokenize1st_order_b
-(
- MACROBLOCK *x,
- TOKENEXTRA **tp,
- int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
- VP8_COMP *cpi
-)
-{
- MACROBLOCKD *xd = &x->e_mbd;
- unsigned int block;
- const BLOCKD *b;
- int pt; /* near block/prev token context index */
- int c;
- int token;
- TOKENEXTRA *t = *tp;/* store tokens starting here */
- const short *qcoeff_ptr;
- ENTROPY_CONTEXT * a;
- ENTROPY_CONTEXT * l;
- int band, rc, v;
- int tmp1, tmp2;
-
- b = xd->block;
- /* Luma */
- for (block = 0; block < 16; block++, b++)
- {
- const int eob = *b->eob;
- tmp1 = vp8_block2above[block];
- tmp2 = vp8_block2left[block];
- qcoeff_ptr = b->qcoeff;
- a = (ENTROPY_CONTEXT *)xd->above_context + tmp1;
- l = (ENTROPY_CONTEXT *)xd->left_context + tmp2;
-
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
-
- c = type ? 0 : 1;
-
- if(c >= eob)
- {
- /* c = band for this case */
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [type] [c] [pt];
- t->skip_eob_node = 0;
-
- ++x->coef_counts [type] [c] [pt] [DCT_EOB_TOKEN];
- t++;
- *tp = t;
- *a = *l = 0;
- continue;
- }
-
- v = qcoeff_ptr[c];
-
- t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
- token = vp8_dct_value_tokens_ptr[v].Token;
- t->Token = token;
-
- t->context_tree = cpi->common.fc.coef_probs [type] [c] [pt];
- t->skip_eob_node = 0;
- ++x->coef_counts [type] [c] [pt] [token];
- pt = vp8_prev_token_class[token];
- t++;
- c++;
-
- assert(eob <= 16);
- for (; c < eob; c++)
- {
- rc = vp8_default_zig_zag1d[c];
- band = vp8_coef_bands[c];
- v = qcoeff_ptr[rc];
-
- t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
- token = vp8_dct_value_tokens_ptr[v].Token;
-
- t->Token = token;
- t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
-
- t->skip_eob_node = (pt == 0);
- ++x->coef_counts [type] [band] [pt] [token];
-
- pt = vp8_prev_token_class[token];
- t++;
- }
- if (c < 16)
- {
- band = vp8_coef_bands[c];
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
-
- t->skip_eob_node = 0;
- ++x->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN];
-
- t++;
- }
- *tp = t;
- *a = *l = 1;
- }
-
- /* Chroma */
- for (block = 16; block < 24; block++, b++)
- {
- const int eob = *b->eob;
- tmp1 = vp8_block2above[block];
- tmp2 = vp8_block2left[block];
- qcoeff_ptr = b->qcoeff;
- a = (ENTROPY_CONTEXT *)xd->above_context + tmp1;
- l = (ENTROPY_CONTEXT *)xd->left_context + tmp2;
-
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
-
- if(!eob)
- {
- /* c = band for this case */
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt];
- t->skip_eob_node = 0;
-
- ++x->coef_counts [2] [0] [pt] [DCT_EOB_TOKEN];
- t++;
- *tp = t;
- *a = *l = 0;
- continue;
- }
-
- v = qcoeff_ptr[0];
-
- t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
- token = vp8_dct_value_tokens_ptr[v].Token;
- t->Token = token;
-
- t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt];
- t->skip_eob_node = 0;
- ++x->coef_counts [2] [0] [pt] [token];
- pt = vp8_prev_token_class[token];
- t++;
- c = 1;
-
- assert(eob <= 16);
- for (; c < eob; c++)
- {
- rc = vp8_default_zig_zag1d[c];
- band = vp8_coef_bands[c];
- v = qcoeff_ptr[rc];
-
- t->Extra = vp8_dct_value_tokens_ptr[v].Extra;
- token = vp8_dct_value_tokens_ptr[v].Token;
-
- t->Token = token;
- t->context_tree = cpi->common.fc.coef_probs [2] [band] [pt];
-
- t->skip_eob_node = (pt == 0);
-
- ++x->coef_counts [2] [band] [pt] [token];
-
- pt = vp8_prev_token_class[token];
- t++;
- }
- if (c < 16)
- {
- band = vp8_coef_bands[c];
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [2] [band] [pt];
-
- t->skip_eob_node = 0;
-
- ++x->coef_counts [2] [band] [pt] [DCT_EOB_TOKEN];
-
- t++;
- }
- *tp = t;
- *a = *l = 1;
- }
-}
-
-
-static int mb_is_skippable(MACROBLOCKD *x, int has_y2_block)
-{
- int skip = 1;
- int i = 0;
-
- if (has_y2_block)
- {
- for (i = 0; i < 16; i++)
- skip &= (x->eobs[i] < 2);
- }
-
- for (; i < 24 + has_y2_block; i++)
- skip &= (!x->eobs[i]);
-
- return skip;
-}
-
-
-void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
-{
- MACROBLOCKD *xd = &x->e_mbd;
- int plane_type;
- int has_y2_block;
-
- has_y2_block = (xd->mode_info_context->mbmi.mode != B_PRED
- && xd->mode_info_context->mbmi.mode != SPLITMV);
-
- xd->mode_info_context->mbmi.mb_skip_coeff =
- mb_is_skippable(xd, has_y2_block);
- if (xd->mode_info_context->mbmi.mb_skip_coeff)
- {
- if (!cpi->common.mb_no_coeff_skip)
- {
- vp8_stuff_mb(cpi, x, t);
- }
- else
- {
- vp8_fix_contexts(xd);
- x->skip_true_count++;
- }
-
- return;
- }
-
- plane_type = 3;
- if(has_y2_block)
- {
- tokenize2nd_order_b(x, t, cpi);
- plane_type = 0;
- }
-
- tokenize1st_order_b(x, t, plane_type, cpi);
-}
-
-
-#ifdef VP8_ENTROPY_STATS
-
-void init_context_counters(void)
-{
- vpx_memset(context_counters, 0, sizeof(context_counters));
-}
-
-void print_context_counters()
-{
-
- int type, band, pt, t;
-
- FILE *const f = fopen("context.c", "w");
-
- fprintf(f, "#include \"entropy.h\"\n");
-
- fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n");
-
- fprintf(f, "int Contexts[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];\n\n");
-
- fprintf(f, "const int default_contexts[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
-
-# define Comma( X) (X? ",":"")
-
- type = 0;
-
- do
- {
- fprintf(f, "%s\n { /* block Type %d */", Comma(type), type);
-
- band = 0;
-
- do
- {
- fprintf(f, "%s\n { /* Coeff Band %d */", Comma(band), band);
-
- pt = 0;
-
- do
- {
- fprintf(f, "%s\n {", Comma(pt));
-
- t = 0;
-
- do
- {
- const _int64 x = context_counters [type] [band] [pt] [t];
- const int y = (int) x;
-
- assert(x == (_int64) y); /* no overflow handling yet */
- fprintf(f, "%s %d", Comma(t), y);
-
- }
- while (++t < MAX_ENTROPY_TOKENS);
-
- fprintf(f, "}");
- }
- while (++pt < PREV_COEF_CONTEXTS);
-
- fprintf(f, "\n }");
-
- }
- while (++band < COEF_BANDS);
-
- fprintf(f, "\n }");
- }
- while (++type < BLOCK_TYPES);
-
- fprintf(f, "\n};\n");
- fclose(f);
-}
-#endif
-
-
-static void stuff2nd_order_b
-(
- TOKENEXTRA **tp,
- ENTROPY_CONTEXT *a,
- ENTROPY_CONTEXT *l,
- VP8_COMP *cpi,
- MACROBLOCK *x
-)
-{
- int pt; /* near block/prev token context index */
- TOKENEXTRA *t = *tp; /* store tokens starting here */
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
-
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt];
- t->skip_eob_node = 0;
- ++x->coef_counts [1] [0] [pt] [DCT_EOB_TOKEN];
- ++t;
-
- *tp = t;
- pt = 0;
- *a = *l = pt;
-}
-
-static void stuff1st_order_b
-(
- TOKENEXTRA **tp,
- ENTROPY_CONTEXT *a,
- ENTROPY_CONTEXT *l,
- int type,
- VP8_COMP *cpi,
- MACROBLOCK *x
-)
-{
- int pt; /* near block/prev token context index */
- int band;
- TOKENEXTRA *t = *tp; /* store tokens starting here */
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
- band = type ? 0 : 1;
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
- t->skip_eob_node = 0;
- ++x->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN];
- ++t;
- *tp = t;
- pt = 0; /* 0 <-> all coeff data is zero */
- *a = *l = pt;
-}
-
-static
-void stuff1st_order_buv
-(
- TOKENEXTRA **tp,
- ENTROPY_CONTEXT *a,
- ENTROPY_CONTEXT *l,
- VP8_COMP *cpi,
- MACROBLOCK *x
-)
-{
- int pt; /* near block/prev token context index */
- TOKENEXTRA *t = *tp; /* store tokens starting here */
- VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
-
- t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt];
- t->skip_eob_node = 0;
- ++x->coef_counts[2] [0] [pt] [DCT_EOB_TOKEN];
- ++t;
- *tp = t;
- pt = 0; /* 0 <-> all coeff data is zero */
- *a = *l = pt;
-}
-
-void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
-{
- MACROBLOCKD *xd = &x->e_mbd;
- ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *)xd->above_context;
- ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *)xd->left_context;
- int plane_type;
- int b;
- plane_type = 3;
- if((xd->mode_info_context->mbmi.mode != B_PRED
- && xd->mode_info_context->mbmi.mode != SPLITMV))
- {
- stuff2nd_order_b(t,
- A + vp8_block2above[24], L + vp8_block2left[24], cpi, x);
- plane_type = 0;
- }
-
- for (b = 0; b < 16; b++)
- stuff1st_order_b(t,
- A + vp8_block2above[b],
- L + vp8_block2left[b], plane_type, cpi, x);
-
- for (b = 16; b < 24; b++)
- stuff1st_order_buv(t,
- A + vp8_block2above[b],
- L + vp8_block2left[b], cpi, x);
-
-}
-void vp8_fix_contexts(MACROBLOCKD *x)
-{
- /* Clear entropy contexts for Y2 blocks */
- if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
- {
- vpx_memset(x->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memset(x->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
- }
- else
- {
- vpx_memset(x->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1);
- vpx_memset(x->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1);
- }
-
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.h
deleted file mode 100644
index b73a9ee..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/tokenize.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_TOKENIZE_H_
-#define VP8_ENCODER_TOKENIZE_H_
-
-#include "vp8/common/entropy.h"
-#include "block.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp8_tokenize_initialize();
-
-typedef struct
-{
- short Token;
- short Extra;
-} TOKENVALUE;
-
-typedef struct
-{
- const vp8_prob *context_tree;
- short Extra;
- unsigned char Token;
- unsigned char skip_eob_node;
-} TOKENEXTRA;
-
-int rd_cost_mby(MACROBLOCKD *);
-
-#ifdef VP8_ENTROPY_STATS
-void init_context_counters();
-void print_context_counters();
-
-extern _int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
-#endif
-
-extern const short *const vp8_dct_value_cost_ptr;
-/* TODO: The Token field should be broken out into a separate char array to
- * improve cache locality, since it's needed for costing when the rest of the
- * fields are not.
- */
-extern const TOKENVALUE *const vp8_dct_value_tokens_ptr;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_TOKENIZE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.c
deleted file mode 100644
index ef25f67..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "treewriter.h"
-
-static void cost(
- int *const C,
- vp8_tree T,
- const vp8_prob *const P,
- int i,
- int c
-)
-{
- const vp8_prob p = P [i>>1];
-
- do
- {
- const vp8_tree_index j = T[i];
- const int d = c + vp8_cost_bit(p, i & 1);
-
- if (j <= 0)
- C[-j] = d;
- else
- cost(C, T, P, j, d);
- }
- while (++i & 1);
-}
-void vp8_cost_tokens(int *c, const vp8_prob *p, vp8_tree t)
-{
- cost(c, t, p, 0, 0);
-}
-void vp8_cost_tokens2(int *c, const vp8_prob *p, vp8_tree t,int start)
-{
- cost(c, t, p, start, 0);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.h b/videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.h
deleted file mode 100644
index cfb2730..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/treewriter.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP8_ENCODER_TREEWRITER_H_
-#define VP8_ENCODER_TREEWRITER_H_
-
-/* Trees map alphabets into huffman-like codes suitable for an arithmetic
- bit coder. Timothy S Murphy 11 October 2004 */
-
-#include "vp8/common/treecoder.h"
-
-#include "boolhuff.h" /* for now */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef BOOL_CODER vp8_writer;
-
-#define vp8_write vp8_encode_bool
-#define vp8_write_literal vp8_encode_value
-#define vp8_write_bit( W, V) vp8_write( W, V, vp8_prob_half)
-
-#define vp8bc_write vp8bc_write_bool
-#define vp8bc_write_literal vp8bc_write_bits
-#define vp8bc_write_bit( W, V) vp8bc_write_bits( W, V, 1)
-
-
-/* Approximate length of an encoded bool in 256ths of a bit at given prob */
-
-#define vp8_cost_zero( x) ( vp8_prob_cost[x])
-#define vp8_cost_one( x) vp8_cost_zero( vp8_complement(x))
-
-#define vp8_cost_bit( x, b) vp8_cost_zero( (b)? vp8_complement(x) : (x) )
-
-/* VP8BC version is scaled by 2^20 rather than 2^8; see bool_coder.h */
-
-
-/* Both of these return bits, not scaled bits. */
-
-static unsigned int vp8_cost_branch(const unsigned int ct[2], vp8_prob p)
-{
- /* Imitate existing calculation */
-
- return ((ct[0] * vp8_cost_zero(p))
- + (ct[1] * vp8_cost_one(p))) >> 8;
-}
-
-/* Small functions to write explicit values and tokens, as well as
- estimate their lengths. */
-
-static void vp8_treed_write
-(
- vp8_writer *const w,
- vp8_tree t,
- const vp8_prob *const p,
- int v,
- int n /* number of bits in v, assumed nonzero */
-)
-{
- vp8_tree_index i = 0;
-
- do
- {
- const int b = (v >> --n) & 1;
- vp8_write(w, b, p[i>>1]);
- i = t[i+b];
- }
- while (n);
-}
-static void vp8_write_token
-(
- vp8_writer *const w,
- vp8_tree t,
- const vp8_prob *const p,
- vp8_token *const x
-)
-{
- vp8_treed_write(w, t, p, x->value, x->Len);
-}
-
-static int vp8_treed_cost(
- vp8_tree t,
- const vp8_prob *const p,
- int v,
- int n /* number of bits in v, assumed nonzero */
-)
-{
- int c = 0;
- vp8_tree_index i = 0;
-
- do
- {
- const int b = (v >> --n) & 1;
- c += vp8_cost_bit(p[i>>1], b);
- i = t[i+b];
- }
- while (n);
-
- return c;
-}
-static int vp8_cost_token
-(
- vp8_tree t,
- const vp8_prob *const p,
- vp8_token *const x
-)
-{
- return vp8_treed_cost(t, p, x->value, x->Len);
-}
-
-/* Fill array of costs for all possible token values. */
-
-void vp8_cost_tokens(
- int *Costs, const vp8_prob *, vp8_tree
-);
-
-void vp8_cost_tokens2(
- int *Costs, const vp8_prob *, vp8_tree, int
-);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP8_ENCODER_TREEWRITER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/vp8_asm_enc_offsets.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/vp8_asm_enc_offsets.c
deleted file mode 100644
index a4169b3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/vp8_asm_enc_offsets.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_ports/asm_offsets.h"
-#include "vpx_config.h"
-#include "block.h"
-#include "vp8/common/blockd.h"
-#include "onyx_int.h"
-#include "treewriter.h"
-#include "tokenize.h"
-
-BEGIN
-
-/* regular quantize */
-DEFINE(vp8_block_coeff, offsetof(BLOCK, coeff));
-DEFINE(vp8_block_zbin, offsetof(BLOCK, zbin));
-DEFINE(vp8_block_round, offsetof(BLOCK, round));
-DEFINE(vp8_block_quant, offsetof(BLOCK, quant));
-DEFINE(vp8_block_quant_fast, offsetof(BLOCK, quant_fast));
-DEFINE(vp8_block_zbin_extra, offsetof(BLOCK, zbin_extra));
-DEFINE(vp8_block_zrun_zbin_boost, offsetof(BLOCK, zrun_zbin_boost));
-DEFINE(vp8_block_quant_shift, offsetof(BLOCK, quant_shift));
-
-DEFINE(vp8_blockd_qcoeff, offsetof(BLOCKD, qcoeff));
-DEFINE(vp8_blockd_dequant, offsetof(BLOCKD, dequant));
-DEFINE(vp8_blockd_dqcoeff, offsetof(BLOCKD, dqcoeff));
-DEFINE(vp8_blockd_eob, offsetof(BLOCKD, eob));
-
-/* subtract */
-DEFINE(vp8_block_base_src, offsetof(BLOCK, base_src));
-DEFINE(vp8_block_src, offsetof(BLOCK, src));
-DEFINE(vp8_block_src_diff, offsetof(BLOCK, src_diff));
-DEFINE(vp8_block_src_stride, offsetof(BLOCK, src_stride));
-
-DEFINE(vp8_blockd_predictor, offsetof(BLOCKD, predictor));
-
-/* pack tokens */
-DEFINE(vp8_writer_lowvalue, offsetof(vp8_writer, lowvalue));
-DEFINE(vp8_writer_range, offsetof(vp8_writer, range));
-DEFINE(vp8_writer_count, offsetof(vp8_writer, count));
-DEFINE(vp8_writer_pos, offsetof(vp8_writer, pos));
-DEFINE(vp8_writer_buffer, offsetof(vp8_writer, buffer));
-DEFINE(vp8_writer_buffer_end, offsetof(vp8_writer, buffer_end));
-DEFINE(vp8_writer_error, offsetof(vp8_writer, error));
-
-DEFINE(tokenextra_token, offsetof(TOKENEXTRA, Token));
-DEFINE(tokenextra_extra, offsetof(TOKENEXTRA, Extra));
-DEFINE(tokenextra_context_tree, offsetof(TOKENEXTRA, context_tree));
-DEFINE(tokenextra_skip_eob_node, offsetof(TOKENEXTRA, skip_eob_node));
-DEFINE(TOKENEXTRA_SZ, sizeof(TOKENEXTRA));
-
-DEFINE(vp8_extra_bit_struct_sz, sizeof(vp8_extra_bit_struct));
-
-DEFINE(vp8_token_value, offsetof(vp8_token, value));
-DEFINE(vp8_token_len, offsetof(vp8_token, Len));
-
-DEFINE(vp8_extra_bit_struct_tree, offsetof(vp8_extra_bit_struct, tree));
-DEFINE(vp8_extra_bit_struct_prob, offsetof(vp8_extra_bit_struct, prob));
-DEFINE(vp8_extra_bit_struct_len, offsetof(vp8_extra_bit_struct, Len));
-DEFINE(vp8_extra_bit_struct_base_val, offsetof(vp8_extra_bit_struct, base_val));
-
-DEFINE(vp8_comp_tplist, offsetof(VP8_COMP, tplist));
-DEFINE(vp8_comp_common, offsetof(VP8_COMP, common));
-DEFINE(vp8_comp_bc , offsetof(VP8_COMP, bc));
-DEFINE(vp8_writer_sz , sizeof(vp8_writer));
-
-DEFINE(tokenlist_start, offsetof(TOKENLIST, start));
-DEFINE(tokenlist_stop, offsetof(TOKENLIST, stop));
-DEFINE(TOKENLIST_SZ, sizeof(TOKENLIST));
-
-DEFINE(vp8_common_mb_rows, offsetof(VP8_COMMON, mb_rows));
-
-END
-
-/* add asserts for any offset that is not supported by assembly code
- * add asserts for any size that is not supported by assembly code
-
- * These are used in vp8cx_pack_tokens. They are hard coded so if their sizes
- * change they will have to be adjusted.
- */
-
-#if HAVE_EDSP
-ct_assert(TOKENEXTRA_SZ, sizeof(TOKENEXTRA) == 8)
-ct_assert(vp8_extra_bit_struct_sz, sizeof(vp8_extra_bit_struct) == 16)
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_mmx.asm
deleted file mode 100644
index 6f188cb..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_mmx.asm
+++ /dev/null
@@ -1,241 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_short_fdct4x4_mmx(short *input, short *output, int pitch)
-global sym(vp8_short_fdct4x4_mmx) PRIVATE
-sym(vp8_short_fdct4x4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ; input
- mov rdi, arg(1) ; output
-
- movsxd rax, dword ptr arg(2) ;pitch
-
- lea rcx, [rsi + rax*2]
- ; read the input data
- movq mm0, [rsi]
- movq mm1, [rsi + rax]
-
- movq mm2, [rcx]
- movq mm4, [rcx + rax]
-
- ; transpose for the first stage
- movq mm3, mm0 ; 00 01 02 03
- movq mm5, mm2 ; 20 21 22 23
-
- punpcklwd mm0, mm1 ; 00 10 01 11
- punpckhwd mm3, mm1 ; 02 12 03 13
-
- punpcklwd mm2, mm4 ; 20 30 21 31
- punpckhwd mm5, mm4 ; 22 32 23 33
-
- movq mm1, mm0 ; 00 10 01 11
- punpckldq mm0, mm2 ; 00 10 20 30
-
- punpckhdq mm1, mm2 ; 01 11 21 31
-
- movq mm2, mm3 ; 02 12 03 13
- punpckldq mm2, mm5 ; 02 12 22 32
-
- punpckhdq mm3, mm5 ; 03 13 23 33
-
- ; mm0 0
- ; mm1 1
- ; mm2 2
- ; mm3 3
-
- ; first stage
- movq mm5, mm0
- movq mm4, mm1
-
- paddw mm0, mm3 ; a1 = 0 + 3
- paddw mm1, mm2 ; b1 = 1 + 2
-
- psubw mm4, mm2 ; c1 = 1 - 2
- psubw mm5, mm3 ; d1 = 0 - 3
-
- psllw mm5, 3
- psllw mm4, 3
-
- psllw mm0, 3
- psllw mm1, 3
-
- ; output 0 and 2
- movq mm2, mm0 ; a1
-
- paddw mm0, mm1 ; op[0] = a1 + b1
- psubw mm2, mm1 ; op[2] = a1 - b1
-
- ; output 1 and 3
- ; interleave c1, d1
- movq mm1, mm5 ; d1
- punpcklwd mm1, mm4 ; c1 d1
- punpckhwd mm5, mm4 ; c1 d1
-
- movq mm3, mm1
- movq mm4, mm5
-
- pmaddwd mm1, MMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
- pmaddwd mm4, MMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
-
- pmaddwd mm3, MMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
- pmaddwd mm5, MMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
-
- paddd mm1, MMWORD PTR[GLOBAL(_14500)]
- paddd mm4, MMWORD PTR[GLOBAL(_14500)]
- paddd mm3, MMWORD PTR[GLOBAL(_7500)]
- paddd mm5, MMWORD PTR[GLOBAL(_7500)]
-
- psrad mm1, 12 ; (c1 * 2217 + d1 * 5352 + 14500)>>12
- psrad mm4, 12 ; (c1 * 2217 + d1 * 5352 + 14500)>>12
- psrad mm3, 12 ; (d1 * 2217 - c1 * 5352 + 7500)>>12
- psrad mm5, 12 ; (d1 * 2217 - c1 * 5352 + 7500)>>12
-
- packssdw mm1, mm4 ; op[1]
- packssdw mm3, mm5 ; op[3]
-
- ; done with vertical
- ; transpose for the second stage
- movq mm4, mm0 ; 00 10 20 30
- movq mm5, mm2 ; 02 12 22 32
-
- punpcklwd mm0, mm1 ; 00 01 10 11
- punpckhwd mm4, mm1 ; 20 21 30 31
-
- punpcklwd mm2, mm3 ; 02 03 12 13
- punpckhwd mm5, mm3 ; 22 23 32 33
-
- movq mm1, mm0 ; 00 01 10 11
- punpckldq mm0, mm2 ; 00 01 02 03
-
- punpckhdq mm1, mm2 ; 01 22 12 13
-
- movq mm2, mm4 ; 20 31 30 31
- punpckldq mm2, mm5 ; 20 21 22 23
-
- punpckhdq mm4, mm5 ; 30 31 32 33
-
- ; mm0 0
- ; mm1 1
- ; mm2 2
- ; mm3 4
-
- movq mm5, mm0
- movq mm3, mm1
-
- paddw mm0, mm4 ; a1 = 0 + 3
- paddw mm1, mm2 ; b1 = 1 + 2
-
- psubw mm3, mm2 ; c1 = 1 - 2
- psubw mm5, mm4 ; d1 = 0 - 3
-
- pxor mm6, mm6 ; zero out for compare
-
- pcmpeqw mm6, mm5 ; d1 != 0
-
- pandn mm6, MMWORD PTR[GLOBAL(_cmp_mask)] ; clear upper,
- ; and keep bit 0 of lower
-
- ; output 0 and 2
- movq mm2, mm0 ; a1
-
- paddw mm0, mm1 ; a1 + b1
- psubw mm2, mm1 ; a1 - b1
-
- paddw mm0, MMWORD PTR[GLOBAL(_7w)]
- paddw mm2, MMWORD PTR[GLOBAL(_7w)]
-
- psraw mm0, 4 ; op[0] = (a1 + b1 + 7)>>4
- psraw mm2, 4 ; op[8] = (a1 - b1 + 7)>>4
-
- movq MMWORD PTR[rdi + 0 ], mm0
- movq MMWORD PTR[rdi + 16], mm2
-
- ; output 1 and 3
- ; interleave c1, d1
- movq mm1, mm5 ; d1
- punpcklwd mm1, mm3 ; c1 d1
- punpckhwd mm5, mm3 ; c1 d1
-
- movq mm3, mm1
- movq mm4, mm5
-
- pmaddwd mm1, MMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
- pmaddwd mm4, MMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
-
- pmaddwd mm3, MMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
- pmaddwd mm5, MMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
-
- paddd mm1, MMWORD PTR[GLOBAL(_12000)]
- paddd mm4, MMWORD PTR[GLOBAL(_12000)]
- paddd mm3, MMWORD PTR[GLOBAL(_51000)]
- paddd mm5, MMWORD PTR[GLOBAL(_51000)]
-
- psrad mm1, 16 ; (c1 * 2217 + d1 * 5352 + 14500)>>16
- psrad mm4, 16 ; (c1 * 2217 + d1 * 5352 + 14500)>>16
- psrad mm3, 16 ; (d1 * 2217 - c1 * 5352 + 7500)>>16
- psrad mm5, 16 ; (d1 * 2217 - c1 * 5352 + 7500)>>16
-
- packssdw mm1, mm4 ; op[4]
- packssdw mm3, mm5 ; op[12]
-
- paddw mm1, mm6 ; op[4] += (d1!=0)
-
- movq MMWORD PTR[rdi + 8 ], mm1
- movq MMWORD PTR[rdi + 24], mm3
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 8
-_5352_2217:
- dw 5352
- dw 2217
- dw 5352
- dw 2217
-align 8
-_2217_neg5352:
- dw 2217
- dw -5352
- dw 2217
- dw -5352
-align 8
-_cmp_mask:
- times 4 dw 1
-align 8
-_7w:
- times 4 dw 7
-align 8
-_14500:
- times 2 dd 14500
-align 8
-_7500:
- times 2 dd 7500
-align 8
-_12000:
- times 2 dd 12000
-align 8
-_51000:
- times 2 dd 51000
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_sse2.asm
deleted file mode 100644
index d06bca5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/dct_sse2.asm
+++ /dev/null
@@ -1,432 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro STACK_FRAME_CREATE 0
-%if ABI_IS_32BIT
- %define input rsi
- %define output rdi
- %define pitch rax
- push rbp
- mov rbp, rsp
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0)
- mov rdi, arg(1)
-
- movsxd rax, dword ptr arg(2)
- lea rcx, [rsi + rax*2]
-%else
- %if LIBVPX_YASM_WIN64
- %define input rcx
- %define output rdx
- %define pitch r8
- SAVE_XMM 7, u
- %else
- %define input rdi
- %define output rsi
- %define pitch rdx
- %endif
-%endif
-%endmacro
-
-%macro STACK_FRAME_DESTROY 0
- %define input
- %define output
- %define pitch
-
-%if ABI_IS_32BIT
- pop rdi
- pop rsi
- RESTORE_GOT
- pop rbp
-%else
- %if LIBVPX_YASM_WIN64
- RESTORE_XMM
- %endif
-%endif
- ret
-%endmacro
-
-;void vp8_short_fdct4x4_sse2(short *input, short *output, int pitch)
-global sym(vp8_short_fdct4x4_sse2) PRIVATE
-sym(vp8_short_fdct4x4_sse2):
-
- STACK_FRAME_CREATE
-
- movq xmm0, MMWORD PTR[input ] ;03 02 01 00
- movq xmm2, MMWORD PTR[input+ pitch] ;13 12 11 10
- lea input, [input+2*pitch]
- movq xmm1, MMWORD PTR[input ] ;23 22 21 20
- movq xmm3, MMWORD PTR[input+ pitch] ;33 32 31 30
-
- punpcklqdq xmm0, xmm2 ;13 12 11 10 03 02 01 00
- punpcklqdq xmm1, xmm3 ;33 32 31 30 23 22 21 20
-
- movdqa xmm2, xmm0
- punpckldq xmm0, xmm1 ;23 22 03 02 21 20 01 00
- punpckhdq xmm2, xmm1 ;33 32 13 12 31 30 11 10
- movdqa xmm1, xmm0
- punpckldq xmm0, xmm2 ;31 21 30 20 11 10 01 00
- pshufhw xmm1, xmm1, 0b1h ;22 23 02 03 xx xx xx xx
- pshufhw xmm2, xmm2, 0b1h ;32 33 12 13 xx xx xx xx
-
- punpckhdq xmm1, xmm2 ;32 33 22 23 12 13 02 03
- movdqa xmm3, xmm0
- paddw xmm0, xmm1 ;b1 a1 b1 a1 b1 a1 b1 a1
- psubw xmm3, xmm1 ;c1 d1 c1 d1 c1 d1 c1 d1
- psllw xmm0, 3 ;b1 <<= 3 a1 <<= 3
- psllw xmm3, 3 ;c1 <<= 3 d1 <<= 3
-
- movdqa xmm1, xmm0
- pmaddwd xmm0, XMMWORD PTR[GLOBAL(_mult_add)] ;a1 + b1
- pmaddwd xmm1, XMMWORD PTR[GLOBAL(_mult_sub)] ;a1 - b1
- movdqa xmm4, xmm3
- pmaddwd xmm3, XMMWORD PTR[GLOBAL(_5352_2217)] ;c1*2217 + d1*5352
- pmaddwd xmm4, XMMWORD PTR[GLOBAL(_2217_neg5352)];d1*2217 - c1*5352
-
- paddd xmm3, XMMWORD PTR[GLOBAL(_14500)]
- paddd xmm4, XMMWORD PTR[GLOBAL(_7500)]
- psrad xmm3, 12 ;(c1 * 2217 + d1 * 5352 + 14500)>>12
- psrad xmm4, 12 ;(d1 * 2217 - c1 * 5352 + 7500)>>12
-
- packssdw xmm0, xmm1 ;op[2] op[0]
- packssdw xmm3, xmm4 ;op[3] op[1]
- ; 23 22 21 20 03 02 01 00
- ;
- ; 33 32 31 30 13 12 11 10
- ;
- movdqa xmm2, xmm0
- punpcklqdq xmm0, xmm3 ;13 12 11 10 03 02 01 00
- punpckhqdq xmm2, xmm3 ;23 22 21 20 33 32 31 30
-
- movdqa xmm3, xmm0
- punpcklwd xmm0, xmm2 ;32 30 22 20 12 10 02 00
- punpckhwd xmm3, xmm2 ;33 31 23 21 13 11 03 01
- movdqa xmm2, xmm0
- punpcklwd xmm0, xmm3 ;13 12 11 10 03 02 01 00
- punpckhwd xmm2, xmm3 ;33 32 31 30 23 22 21 20
-
- movdqa xmm5, XMMWORD PTR[GLOBAL(_7)]
- pshufd xmm2, xmm2, 04eh
- movdqa xmm3, xmm0
- paddw xmm0, xmm2 ;b1 b1 b1 b1 a1 a1 a1 a1
- psubw xmm3, xmm2 ;c1 c1 c1 c1 d1 d1 d1 d1
-
- pshufd xmm0, xmm0, 0d8h ;b1 b1 a1 a1 b1 b1 a1 a1
- movdqa xmm2, xmm3 ;save d1 for compare
- pshufd xmm3, xmm3, 0d8h ;c1 c1 d1 d1 c1 c1 d1 d1
- pshuflw xmm0, xmm0, 0d8h ;b1 b1 a1 a1 b1 a1 b1 a1
- pshuflw xmm3, xmm3, 0d8h ;c1 c1 d1 d1 c1 d1 c1 d1
- pshufhw xmm0, xmm0, 0d8h ;b1 a1 b1 a1 b1 a1 b1 a1
- pshufhw xmm3, xmm3, 0d8h ;c1 d1 c1 d1 c1 d1 c1 d1
- movdqa xmm1, xmm0
- pmaddwd xmm0, XMMWORD PTR[GLOBAL(_mult_add)] ;a1 + b1
- pmaddwd xmm1, XMMWORD PTR[GLOBAL(_mult_sub)] ;a1 - b1
-
- pxor xmm4, xmm4 ;zero out for compare
- paddd xmm0, xmm5
- paddd xmm1, xmm5
- pcmpeqw xmm2, xmm4
- psrad xmm0, 4 ;(a1 + b1 + 7)>>4
- psrad xmm1, 4 ;(a1 - b1 + 7)>>4
- pandn xmm2, XMMWORD PTR[GLOBAL(_cmp_mask)] ;clear upper,
- ;and keep bit 0 of lower
-
- movdqa xmm4, xmm3
- pmaddwd xmm3, XMMWORD PTR[GLOBAL(_5352_2217)] ;c1*2217 + d1*5352
- pmaddwd xmm4, XMMWORD PTR[GLOBAL(_2217_neg5352)] ;d1*2217 - c1*5352
- paddd xmm3, XMMWORD PTR[GLOBAL(_12000)]
- paddd xmm4, XMMWORD PTR[GLOBAL(_51000)]
- packssdw xmm0, xmm1 ;op[8] op[0]
- psrad xmm3, 16 ;(c1 * 2217 + d1 * 5352 + 12000)>>16
- psrad xmm4, 16 ;(d1 * 2217 - c1 * 5352 + 51000)>>16
-
- packssdw xmm3, xmm4 ;op[12] op[4]
- movdqa xmm1, xmm0
- paddw xmm3, xmm2 ;op[4] += (d1!=0)
- punpcklqdq xmm0, xmm3 ;op[4] op[0]
- punpckhqdq xmm1, xmm3 ;op[12] op[8]
-
- movdqa XMMWORD PTR[output + 0], xmm0
- movdqa XMMWORD PTR[output + 16], xmm1
-
- STACK_FRAME_DESTROY
-
-;void vp8_short_fdct8x4_sse2(short *input, short *output, int pitch)
-global sym(vp8_short_fdct8x4_sse2) PRIVATE
-sym(vp8_short_fdct8x4_sse2):
-
- STACK_FRAME_CREATE
-
- ; read the input data
- movdqa xmm0, [input ]
- movdqa xmm2, [input+ pitch]
- lea input, [input+2*pitch]
- movdqa xmm4, [input ]
- movdqa xmm3, [input+ pitch]
-
- ; transpose for the first stage
- movdqa xmm1, xmm0 ; 00 01 02 03 04 05 06 07
- movdqa xmm5, xmm4 ; 20 21 22 23 24 25 26 27
-
- punpcklwd xmm0, xmm2 ; 00 10 01 11 02 12 03 13
- punpckhwd xmm1, xmm2 ; 04 14 05 15 06 16 07 17
-
- punpcklwd xmm4, xmm3 ; 20 30 21 31 22 32 23 33
- punpckhwd xmm5, xmm3 ; 24 34 25 35 26 36 27 37
-
- movdqa xmm2, xmm0 ; 00 10 01 11 02 12 03 13
- punpckldq xmm0, xmm4 ; 00 10 20 30 01 11 21 31
-
- punpckhdq xmm2, xmm4 ; 02 12 22 32 03 13 23 33
-
- movdqa xmm4, xmm1 ; 04 14 05 15 06 16 07 17
- punpckldq xmm4, xmm5 ; 04 14 24 34 05 15 25 35
-
- punpckhdq xmm1, xmm5 ; 06 16 26 36 07 17 27 37
- movdqa xmm3, xmm2 ; 02 12 22 32 03 13 23 33
-
- punpckhqdq xmm3, xmm1 ; 03 13 23 33 07 17 27 37
- punpcklqdq xmm2, xmm1 ; 02 12 22 32 06 16 26 36
-
- movdqa xmm1, xmm0 ; 00 10 20 30 01 11 21 31
- punpcklqdq xmm0, xmm4 ; 00 10 20 30 04 14 24 34
-
- punpckhqdq xmm1, xmm4 ; 01 11 21 32 05 15 25 35
-
- ; xmm0 0
- ; xmm1 1
- ; xmm2 2
- ; xmm3 3
-
- ; first stage
- movdqa xmm5, xmm0
- movdqa xmm4, xmm1
-
- paddw xmm0, xmm3 ; a1 = 0 + 3
- paddw xmm1, xmm2 ; b1 = 1 + 2
-
- psubw xmm4, xmm2 ; c1 = 1 - 2
- psubw xmm5, xmm3 ; d1 = 0 - 3
-
- psllw xmm5, 3
- psllw xmm4, 3
-
- psllw xmm0, 3
- psllw xmm1, 3
-
- ; output 0 and 2
- movdqa xmm2, xmm0 ; a1
-
- paddw xmm0, xmm1 ; op[0] = a1 + b1
- psubw xmm2, xmm1 ; op[2] = a1 - b1
-
- ; output 1 and 3
- ; interleave c1, d1
- movdqa xmm1, xmm5 ; d1
- punpcklwd xmm1, xmm4 ; c1 d1
- punpckhwd xmm5, xmm4 ; c1 d1
-
- movdqa xmm3, xmm1
- movdqa xmm4, xmm5
-
- pmaddwd xmm1, XMMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
- pmaddwd xmm4, XMMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
-
- pmaddwd xmm3, XMMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
- pmaddwd xmm5, XMMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
-
- paddd xmm1, XMMWORD PTR[GLOBAL(_14500)]
- paddd xmm4, XMMWORD PTR[GLOBAL(_14500)]
- paddd xmm3, XMMWORD PTR[GLOBAL(_7500)]
- paddd xmm5, XMMWORD PTR[GLOBAL(_7500)]
-
- psrad xmm1, 12 ; (c1 * 2217 + d1 * 5352 + 14500)>>12
- psrad xmm4, 12 ; (c1 * 2217 + d1 * 5352 + 14500)>>12
- psrad xmm3, 12 ; (d1 * 2217 - c1 * 5352 + 7500)>>12
- psrad xmm5, 12 ; (d1 * 2217 - c1 * 5352 + 7500)>>12
-
- packssdw xmm1, xmm4 ; op[1]
- packssdw xmm3, xmm5 ; op[3]
-
- ; done with vertical
- ; transpose for the second stage
- movdqa xmm4, xmm0 ; 00 10 20 30 04 14 24 34
- movdqa xmm5, xmm2 ; 02 12 22 32 06 16 26 36
-
- punpcklwd xmm0, xmm1 ; 00 01 10 11 20 21 30 31
- punpckhwd xmm4, xmm1 ; 04 05 14 15 24 25 34 35
-
- punpcklwd xmm2, xmm3 ; 02 03 12 13 22 23 32 33
- punpckhwd xmm5, xmm3 ; 06 07 16 17 26 27 36 37
-
- movdqa xmm1, xmm0 ; 00 01 10 11 20 21 30 31
- punpckldq xmm0, xmm2 ; 00 01 02 03 10 11 12 13
-
- punpckhdq xmm1, xmm2 ; 20 21 22 23 30 31 32 33
-
- movdqa xmm2, xmm4 ; 04 05 14 15 24 25 34 35
- punpckldq xmm2, xmm5 ; 04 05 06 07 14 15 16 17
-
- punpckhdq xmm4, xmm5 ; 24 25 26 27 34 35 36 37
- movdqa xmm3, xmm1 ; 20 21 22 23 30 31 32 33
-
- punpckhqdq xmm3, xmm4 ; 30 31 32 33 34 35 36 37
- punpcklqdq xmm1, xmm4 ; 20 21 22 23 24 25 26 27
-
- movdqa xmm4, xmm0 ; 00 01 02 03 10 11 12 13
- punpcklqdq xmm0, xmm2 ; 00 01 02 03 04 05 06 07
-
- punpckhqdq xmm4, xmm2 ; 10 11 12 13 14 15 16 17
-
- ; xmm0 0
- ; xmm1 4
- ; xmm2 1
- ; xmm3 3
-
- movdqa xmm5, xmm0
- movdqa xmm2, xmm1
-
- paddw xmm0, xmm3 ; a1 = 0 + 3
- paddw xmm1, xmm4 ; b1 = 1 + 2
-
- psubw xmm4, xmm2 ; c1 = 1 - 2
- psubw xmm5, xmm3 ; d1 = 0 - 3
-
- pxor xmm6, xmm6 ; zero out for compare
-
- pcmpeqw xmm6, xmm5 ; d1 != 0
-
- pandn xmm6, XMMWORD PTR[GLOBAL(_cmp_mask8x4)] ; clear upper,
- ; and keep bit 0 of lower
-
- ; output 0 and 2
- movdqa xmm2, xmm0 ; a1
-
- paddw xmm0, xmm1 ; a1 + b1
- psubw xmm2, xmm1 ; a1 - b1
-
- paddw xmm0, XMMWORD PTR[GLOBAL(_7w)]
- paddw xmm2, XMMWORD PTR[GLOBAL(_7w)]
-
- psraw xmm0, 4 ; op[0] = (a1 + b1 + 7)>>4
- psraw xmm2, 4 ; op[8] = (a1 - b1 + 7)>>4
-
- ; output 1 and 3
- ; interleave c1, d1
- movdqa xmm1, xmm5 ; d1
- punpcklwd xmm1, xmm4 ; c1 d1
- punpckhwd xmm5, xmm4 ; c1 d1
-
- movdqa xmm3, xmm1
- movdqa xmm4, xmm5
-
- pmaddwd xmm1, XMMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
- pmaddwd xmm4, XMMWORD PTR[GLOBAL (_5352_2217)] ; c1*2217 + d1*5352
-
- pmaddwd xmm3, XMMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
- pmaddwd xmm5, XMMWORD PTR[GLOBAL(_2217_neg5352)] ; d1*2217 - c1*5352
-
- paddd xmm1, XMMWORD PTR[GLOBAL(_12000)]
- paddd xmm4, XMMWORD PTR[GLOBAL(_12000)]
- paddd xmm3, XMMWORD PTR[GLOBAL(_51000)]
- paddd xmm5, XMMWORD PTR[GLOBAL(_51000)]
-
- psrad xmm1, 16 ; (c1 * 2217 + d1 * 5352 + 14500)>>16
- psrad xmm4, 16 ; (c1 * 2217 + d1 * 5352 + 14500)>>16
- psrad xmm3, 16 ; (d1 * 2217 - c1 * 5352 + 7500)>>16
- psrad xmm5, 16 ; (d1 * 2217 - c1 * 5352 + 7500)>>16
-
- packssdw xmm1, xmm4 ; op[4]
- packssdw xmm3, xmm5 ; op[12]
-
- paddw xmm1, xmm6 ; op[4] += (d1!=0)
-
- movdqa xmm4, xmm0
- movdqa xmm5, xmm2
-
- punpcklqdq xmm0, xmm1
- punpckhqdq xmm4, xmm1
-
- punpcklqdq xmm2, xmm3
- punpckhqdq xmm5, xmm3
-
- movdqa XMMWORD PTR[output + 0 ], xmm0
- movdqa XMMWORD PTR[output + 16], xmm2
- movdqa XMMWORD PTR[output + 32], xmm4
- movdqa XMMWORD PTR[output + 48], xmm5
-
- STACK_FRAME_DESTROY
-
-SECTION_RODATA
-align 16
-_5352_2217:
- dw 5352
- dw 2217
- dw 5352
- dw 2217
- dw 5352
- dw 2217
- dw 5352
- dw 2217
-align 16
-_2217_neg5352:
- dw 2217
- dw -5352
- dw 2217
- dw -5352
- dw 2217
- dw -5352
- dw 2217
- dw -5352
-align 16
-_mult_add:
- times 8 dw 1
-align 16
-_cmp_mask:
- times 4 dw 1
- times 4 dw 0
-align 16
-_cmp_mask8x4:
- times 8 dw 1
-align 16
-_mult_sub:
- dw 1
- dw -1
- dw 1
- dw -1
- dw 1
- dw -1
- dw 1
- dw -1
-align 16
-_7:
- times 4 dd 7
-align 16
-_7w:
- times 8 dw 7
-align 16
-_14500:
- times 4 dd 14500
-align 16
-_7500:
- times 4 dd 7500
-align 16
-_12000:
- times 4 dd 12000
-align 16
-_51000:
- times 4 dd 51000
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/denoising_sse2.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/denoising_sse2.c
deleted file mode 100644
index 5a2f75f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/denoising_sse2.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp8/encoder/denoising.h"
-#include "vp8/common/reconinter.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8_rtcd.h"
-
-#include <emmintrin.h>
-#include "vpx_ports/emmintrin_compat.h"
-
-union sum_union {
- __m128i v;
- signed char e[16];
-};
-
-int vp8_denoiser_filter_sse2(YV12_BUFFER_CONFIG *mc_running_avg,
- YV12_BUFFER_CONFIG *running_avg,
- MACROBLOCK *signal, unsigned int motion_magnitude,
- int y_offset, int uv_offset)
-{
- unsigned char *sig = signal->thismb;
- int sig_stride = 16;
- unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset;
- int mc_avg_y_stride = mc_running_avg->y_stride;
- unsigned char *running_avg_y = running_avg->y_buffer + y_offset;
- int avg_y_stride = running_avg->y_stride;
- int r;
- (void)uv_offset;
- __m128i acc_diff = _mm_setzero_si128();
- const __m128i k_0 = _mm_setzero_si128();
- const __m128i k_4 = _mm_set1_epi8(4);
- const __m128i k_8 = _mm_set1_epi8(8);
- const __m128i k_16 = _mm_set1_epi8(16);
- /* Modify each level's adjustment according to motion_magnitude. */
- const __m128i l3 = _mm_set1_epi8(
- (motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD) ? 7 : 6);
- /* Difference between level 3 and level 2 is 2. */
- const __m128i l32 = _mm_set1_epi8(2);
- /* Difference between level 2 and level 1 is 1. */
- const __m128i l21 = _mm_set1_epi8(1);
-
- for (r = 0; r < 16; ++r)
- {
- /* Calculate differences */
- const __m128i v_sig = _mm_loadu_si128((__m128i *)(&sig[0]));
- const __m128i v_mc_running_avg_y = _mm_loadu_si128(
- (__m128i *)(&mc_running_avg_y[0]));
- __m128i v_running_avg_y;
- const __m128i pdiff = _mm_subs_epu8(v_mc_running_avg_y, v_sig);
- const __m128i ndiff = _mm_subs_epu8(v_sig, v_mc_running_avg_y);
- /* Obtain the sign. FF if diff is negative. */
- const __m128i diff_sign = _mm_cmpeq_epi8(pdiff, k_0);
- /* Clamp absolute difference to 16 to be used to get mask. Doing this
- * allows us to use _mm_cmpgt_epi8, which operates on signed byte. */
- const __m128i clamped_absdiff = _mm_min_epu8(
- _mm_or_si128(pdiff, ndiff), k_16);
- /* Get masks for l2 l1 and l0 adjustments */
- const __m128i mask2 = _mm_cmpgt_epi8(k_16, clamped_absdiff);
- const __m128i mask1 = _mm_cmpgt_epi8(k_8, clamped_absdiff);
- const __m128i mask0 = _mm_cmpgt_epi8(k_4, clamped_absdiff);
- /* Get adjustments for l2, l1, and l0 */
- __m128i adj2 = _mm_and_si128(mask2, l32);
- const __m128i adj1 = _mm_and_si128(mask1, l21);
- const __m128i adj0 = _mm_and_si128(mask0, clamped_absdiff);
- __m128i adj, padj, nadj;
-
- /* Combine the adjustments and get absolute adjustments. */
- adj2 = _mm_add_epi8(adj2, adj1);
- adj = _mm_sub_epi8(l3, adj2);
- adj = _mm_andnot_si128(mask0, adj);
- adj = _mm_or_si128(adj, adj0);
-
- /* Restore the sign and get positive and negative adjustments. */
- padj = _mm_andnot_si128(diff_sign, adj);
- nadj = _mm_and_si128(diff_sign, adj);
-
- /* Calculate filtered value. */
- v_running_avg_y = _mm_adds_epu8(v_sig, padj);
- v_running_avg_y = _mm_subs_epu8(v_running_avg_y, nadj);
- _mm_storeu_si128((__m128i *)running_avg_y, v_running_avg_y);
-
- /* Adjustments <=7, and each element in acc_diff can fit in signed
- * char.
- */
- acc_diff = _mm_adds_epi8(acc_diff, padj);
- acc_diff = _mm_subs_epi8(acc_diff, nadj);
-
- /* Update pointers for next iteration. */
- sig += sig_stride;
- mc_running_avg_y += mc_avg_y_stride;
- running_avg_y += avg_y_stride;
- }
-
- {
- /* Compute the sum of all pixel differences of this MB. */
- union sum_union s;
- int sum_diff = 0;
- s.v = acc_diff;
- sum_diff = s.e[0] + s.e[1] + s.e[2] + s.e[3] + s.e[4] + s.e[5]
- + s.e[6] + s.e[7] + s.e[8] + s.e[9] + s.e[10] + s.e[11]
- + s.e[12] + s.e[13] + s.e[14] + s.e[15];
-
- if (abs(sum_diff) > SUM_DIFF_THRESHOLD)
- {
- return COPY_BLOCK;
- }
- }
-
- vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride,
- signal->thismb, sig_stride);
- return FILTER_BLOCK;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/encodeopt.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/encodeopt.asm
deleted file mode 100644
index fe26b18..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/encodeopt.asm
+++ /dev/null
@@ -1,386 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;int vp8_block_error_xmm(short *coeff_ptr, short *dcoef_ptr)
-global sym(vp8_block_error_xmm) PRIVATE
-sym(vp8_block_error_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 2
- push rsi
- push rdi
- ; end prologue
-
- mov rsi, arg(0) ;coeff_ptr
- mov rdi, arg(1) ;dcoef_ptr
-
- movdqa xmm0, [rsi]
- movdqa xmm1, [rdi]
-
- movdqa xmm2, [rsi+16]
- movdqa xmm3, [rdi+16]
-
- psubw xmm0, xmm1
- psubw xmm2, xmm3
-
- pmaddwd xmm0, xmm0
- pmaddwd xmm2, xmm2
-
- paddd xmm0, xmm2
-
- pxor xmm5, xmm5
- movdqa xmm1, xmm0
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
-
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- psrldq xmm0, 8
- paddd xmm0, xmm1
-
- movq rax, xmm0
-
- pop rdi
- pop rsi
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;int vp8_block_error_mmx(short *coeff_ptr, short *dcoef_ptr)
-global sym(vp8_block_error_mmx) PRIVATE
-sym(vp8_block_error_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 2
- push rsi
- push rdi
- ; end prolog
-
-
- mov rsi, arg(0) ;coeff_ptr
- pxor mm7, mm7
-
- mov rdi, arg(1) ;dcoef_ptr
- movq mm3, [rsi]
-
- movq mm4, [rdi]
- movq mm5, [rsi+8]
-
- movq mm6, [rdi+8]
- pxor mm1, mm1 ; from movd mm1, dc ; dc =0
-
- movq mm2, mm7
- psubw mm5, mm6
-
- por mm1, mm2
- pmaddwd mm5, mm5
-
- pcmpeqw mm1, mm7
- psubw mm3, mm4
-
- pand mm1, mm3
- pmaddwd mm1, mm1
-
- paddd mm1, mm5
- movq mm3, [rsi+16]
-
- movq mm4, [rdi+16]
- movq mm5, [rsi+24]
-
- movq mm6, [rdi+24]
- psubw mm5, mm6
-
- pmaddwd mm5, mm5
- psubw mm3, mm4
-
- pmaddwd mm3, mm3
- paddd mm3, mm5
-
- paddd mm1, mm3
- movq mm0, mm1
-
- psrlq mm1, 32
- paddd mm0, mm1
-
- movq rax, mm0
-
- pop rdi
- pop rsi
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;int vp8_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
-global sym(vp8_mbblock_error_mmx_impl) PRIVATE
-sym(vp8_mbblock_error_mmx_impl):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- push rsi
- push rdi
- ; end prolog
-
-
- mov rsi, arg(0) ;coeff_ptr
- pxor mm7, mm7
-
- mov rdi, arg(1) ;dcoef_ptr
- pxor mm2, mm2
-
- movd mm1, dword ptr arg(2) ;dc
- por mm1, mm2
-
- pcmpeqw mm1, mm7
- mov rcx, 16
-
-.mberror_loop_mmx:
- movq mm3, [rsi]
- movq mm4, [rdi]
-
- movq mm5, [rsi+8]
- movq mm6, [rdi+8]
-
-
- psubw mm5, mm6
- pmaddwd mm5, mm5
-
- psubw mm3, mm4
- pand mm3, mm1
-
- pmaddwd mm3, mm3
- paddd mm2, mm5
-
- paddd mm2, mm3
- movq mm3, [rsi+16]
-
- movq mm4, [rdi+16]
- movq mm5, [rsi+24]
-
- movq mm6, [rdi+24]
- psubw mm5, mm6
-
- pmaddwd mm5, mm5
- psubw mm3, mm4
-
- pmaddwd mm3, mm3
- paddd mm2, mm5
-
- paddd mm2, mm3
- add rsi, 32
-
- add rdi, 32
- sub rcx, 1
-
- jnz .mberror_loop_mmx
-
- movq mm0, mm2
- psrlq mm2, 32
-
- paddd mm0, mm2
- movq rax, mm0
-
- pop rdi
- pop rsi
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;int vp8_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
-global sym(vp8_mbblock_error_xmm_impl) PRIVATE
-sym(vp8_mbblock_error_xmm_impl):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- SAVE_XMM 6
- push rsi
- push rdi
- ; end prolog
-
-
- mov rsi, arg(0) ;coeff_ptr
- pxor xmm6, xmm6
-
- mov rdi, arg(1) ;dcoef_ptr
- pxor xmm4, xmm4
-
- movd xmm5, dword ptr arg(2) ;dc
- por xmm5, xmm4
-
- pcmpeqw xmm5, xmm6
- mov rcx, 16
-
-.mberror_loop:
- movdqa xmm0, [rsi]
- movdqa xmm1, [rdi]
-
- movdqa xmm2, [rsi+16]
- movdqa xmm3, [rdi+16]
-
-
- psubw xmm2, xmm3
- pmaddwd xmm2, xmm2
-
- psubw xmm0, xmm1
- pand xmm0, xmm5
-
- pmaddwd xmm0, xmm0
- add rsi, 32
-
- add rdi, 32
-
- sub rcx, 1
- paddd xmm4, xmm2
-
- paddd xmm4, xmm0
- jnz .mberror_loop
-
- movdqa xmm0, xmm4
- punpckldq xmm0, xmm6
-
- punpckhdq xmm4, xmm6
- paddd xmm0, xmm4
-
- movdqa xmm1, xmm0
- psrldq xmm0, 8
-
- paddd xmm0, xmm1
- movq rax, xmm0
-
- pop rdi
- pop rsi
- ; begin epilog
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;int vp8_mbuverror_mmx_impl(short *s_ptr, short *d_ptr);
-global sym(vp8_mbuverror_mmx_impl) PRIVATE
-sym(vp8_mbuverror_mmx_impl):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 2
- push rsi
- push rdi
- ; end prolog
-
-
- mov rsi, arg(0) ;s_ptr
- mov rdi, arg(1) ;d_ptr
-
- mov rcx, 16
- pxor mm7, mm7
-
-.mbuverror_loop_mmx:
-
- movq mm1, [rsi]
- movq mm2, [rdi]
-
- psubw mm1, mm2
- pmaddwd mm1, mm1
-
-
- movq mm3, [rsi+8]
- movq mm4, [rdi+8]
-
- psubw mm3, mm4
- pmaddwd mm3, mm3
-
-
- paddd mm7, mm1
- paddd mm7, mm3
-
-
- add rsi, 16
- add rdi, 16
-
- dec rcx
- jnz .mbuverror_loop_mmx
-
- movq mm0, mm7
- psrlq mm7, 32
-
- paddd mm0, mm7
- movq rax, mm0
-
- pop rdi
- pop rsi
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;int vp8_mbuverror_xmm_impl(short *s_ptr, short *d_ptr);
-global sym(vp8_mbuverror_xmm_impl) PRIVATE
-sym(vp8_mbuverror_xmm_impl):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 2
- push rsi
- push rdi
- ; end prolog
-
-
- mov rsi, arg(0) ;s_ptr
- mov rdi, arg(1) ;d_ptr
-
- mov rcx, 16
- pxor xmm3, xmm3
-
-.mbuverror_loop:
-
- movdqa xmm1, [rsi]
- movdqa xmm2, [rdi]
-
- psubw xmm1, xmm2
- pmaddwd xmm1, xmm1
-
- paddd xmm3, xmm1
-
- add rsi, 16
- add rdi, 16
-
- dec rcx
- jnz .mbuverror_loop
-
- pxor xmm0, xmm0
- movdqa xmm1, xmm3
-
- movdqa xmm2, xmm1
- punpckldq xmm1, xmm0
-
- punpckhdq xmm2, xmm0
- paddd xmm1, xmm2
-
- movdqa xmm2, xmm1
-
- psrldq xmm1, 8
- paddd xmm1, xmm2
-
- movq rax, xmm1
-
- pop rdi
- pop rsi
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/fwalsh_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/fwalsh_sse2.asm
deleted file mode 100644
index f498927..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/fwalsh_sse2.asm
+++ /dev/null
@@ -1,164 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_short_walsh4x4_sse2(short *input, short *output, int pitch)
-global sym(vp8_short_walsh4x4_sse2) PRIVATE
-sym(vp8_short_walsh4x4_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 3
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ; input
- mov rdi, arg(1) ; output
- movsxd rdx, dword ptr arg(2) ; pitch
-
- ; first for loop
- movq xmm0, MMWORD PTR [rsi] ; load input
- movq xmm1, MMWORD PTR [rsi + rdx]
- lea rsi, [rsi + rdx*2]
- movq xmm2, MMWORD PTR [rsi]
- movq xmm3, MMWORD PTR [rsi + rdx]
-
- punpcklwd xmm0, xmm1
- punpcklwd xmm2, xmm3
-
- movdqa xmm1, xmm0
- punpckldq xmm0, xmm2 ; ip[1] ip[0]
- punpckhdq xmm1, xmm2 ; ip[3] ip[2]
-
- movdqa xmm2, xmm0
- paddw xmm0, xmm1
- psubw xmm2, xmm1
-
- psllw xmm0, 2 ; d1 a1
- psllw xmm2, 2 ; c1 b1
-
- movdqa xmm1, xmm0
- punpcklqdq xmm0, xmm2 ; b1 a1
- punpckhqdq xmm1, xmm2 ; c1 d1
-
- pxor xmm6, xmm6
- movq xmm6, xmm0
- pxor xmm7, xmm7
- pcmpeqw xmm7, xmm6
- paddw xmm7, [GLOBAL(c1)]
-
- movdqa xmm2, xmm0
- paddw xmm0, xmm1 ; b1+c1 a1+d1
- psubw xmm2, xmm1 ; b1-c1 a1-d1
- paddw xmm0, xmm7 ; b1+c1 a1+d1+(a1!=0)
-
- ; second for loop
- ; input: 13 9 5 1 12 8 4 0 (xmm0)
- ; 14 10 6 2 15 11 7 3 (xmm2)
- ; after shuffle:
- ; 13 5 9 1 12 4 8 0 (xmm0)
- ; 14 6 10 2 15 7 11 3 (xmm1)
- pshuflw xmm3, xmm0, 0xd8
- pshufhw xmm0, xmm3, 0xd8
- pshuflw xmm3, xmm2, 0xd8
- pshufhw xmm1, xmm3, 0xd8
-
- movdqa xmm2, xmm0
- pmaddwd xmm0, [GLOBAL(c1)] ; d11 a11 d10 a10
- pmaddwd xmm2, [GLOBAL(cn1)] ; c11 b11 c10 b10
- movdqa xmm3, xmm1
- pmaddwd xmm1, [GLOBAL(c1)] ; d12 a12 d13 a13
- pmaddwd xmm3, [GLOBAL(cn1)] ; c12 b12 c13 b13
-
- pshufd xmm4, xmm0, 0xd8 ; d11 d10 a11 a10
- pshufd xmm5, xmm2, 0xd8 ; c11 c10 b11 b10
- pshufd xmm6, xmm1, 0x72 ; d13 d12 a13 a12
- pshufd xmm7, xmm3, 0x72 ; c13 c12 b13 b12
-
- movdqa xmm0, xmm4
- punpcklqdq xmm0, xmm5 ; b11 b10 a11 a10
- punpckhqdq xmm4, xmm5 ; c11 c10 d11 d10
- movdqa xmm1, xmm6
- punpcklqdq xmm1, xmm7 ; b13 b12 a13 a12
- punpckhqdq xmm6, xmm7 ; c13 c12 d13 d12
-
- movdqa xmm2, xmm0
- paddd xmm0, xmm4 ; b21 b20 a21 a20
- psubd xmm2, xmm4 ; c21 c20 d21 d20
- movdqa xmm3, xmm1
- paddd xmm1, xmm6 ; b23 b22 a23 a22
- psubd xmm3, xmm6 ; c23 c22 d23 d22
-
- pxor xmm4, xmm4
- movdqa xmm5, xmm4
- pcmpgtd xmm4, xmm0
- pcmpgtd xmm5, xmm2
- pand xmm4, [GLOBAL(cd1)]
- pand xmm5, [GLOBAL(cd1)]
-
- pxor xmm6, xmm6
- movdqa xmm7, xmm6
- pcmpgtd xmm6, xmm1
- pcmpgtd xmm7, xmm3
- pand xmm6, [GLOBAL(cd1)]
- pand xmm7, [GLOBAL(cd1)]
-
- paddd xmm0, xmm4
- paddd xmm2, xmm5
- paddd xmm0, [GLOBAL(cd3)]
- paddd xmm2, [GLOBAL(cd3)]
- paddd xmm1, xmm6
- paddd xmm3, xmm7
- paddd xmm1, [GLOBAL(cd3)]
- paddd xmm3, [GLOBAL(cd3)]
-
- psrad xmm0, 3
- psrad xmm1, 3
- psrad xmm2, 3
- psrad xmm3, 3
- movdqa xmm4, xmm0
- punpcklqdq xmm0, xmm1 ; a23 a22 a21 a20
- punpckhqdq xmm4, xmm1 ; b23 b22 b21 b20
- movdqa xmm5, xmm2
- punpckhqdq xmm2, xmm3 ; c23 c22 c21 c20
- punpcklqdq xmm5, xmm3 ; d23 d22 d21 d20
-
- packssdw xmm0, xmm4 ; b23 b22 b21 b20 a23 a22 a21 a20
- packssdw xmm2, xmm5 ; d23 d22 d21 d20 c23 c22 c21 c20
-
- movdqa XMMWORD PTR [rdi], xmm0
- movdqa XMMWORD PTR [rdi + 16], xmm2
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-c1:
- dw 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001
-align 16
-cn1:
- dw 0x0001, 0xffff, 0x0001, 0xffff, 0x0001, 0xffff, 0x0001, 0xffff
-align 16
-cd1:
- dd 0x00000001, 0x00000001, 0x00000001, 0x00000001
-align 16
-cd3:
- dd 0x00000003, 0x00000003, 0x00000003, 0x00000003
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_mmx.asm
deleted file mode 100644
index 2864ce1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_mmx.asm
+++ /dev/null
@@ -1,286 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;int vp8_fast_quantize_b_impl_mmx(short *coeff_ptr, short *zbin_ptr,
-; short *qcoeff_ptr,short *dequant_ptr,
-; short *scan_mask, short *round_ptr,
-; short *quant_ptr, short *dqcoeff_ptr);
-global sym(vp8_fast_quantize_b_impl_mmx) PRIVATE
-sym(vp8_fast_quantize_b_impl_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- push rsi
- push rdi
- ; end prolog
-
-
- mov rsi, arg(0) ;coeff_ptr
- movq mm0, [rsi]
-
- mov rax, arg(1) ;zbin_ptr
- movq mm1, [rax]
-
- movq mm3, mm0
- psraw mm0, 15
-
- pxor mm3, mm0
- psubw mm3, mm0 ; abs
-
- movq mm2, mm3
- pcmpgtw mm1, mm2
-
- pandn mm1, mm2
- movq mm3, mm1
-
- mov rdx, arg(6) ;quant_ptr
- movq mm1, [rdx]
-
- mov rcx, arg(5) ;round_ptr
- movq mm2, [rcx]
-
- paddw mm3, mm2
- pmulhuw mm3, mm1
-
- pxor mm3, mm0
- psubw mm3, mm0 ;gain the sign back
-
- mov rdi, arg(2) ;qcoeff_ptr
- movq mm0, mm3
-
- movq [rdi], mm3
-
- mov rax, arg(3) ;dequant_ptr
- movq mm2, [rax]
-
- pmullw mm3, mm2
- mov rax, arg(7) ;dqcoeff_ptr
-
- movq [rax], mm3
-
- ; next 8
- movq mm4, [rsi+8]
-
- mov rax, arg(1) ;zbin_ptr
- movq mm5, [rax+8]
-
- movq mm7, mm4
- psraw mm4, 15
-
- pxor mm7, mm4
- psubw mm7, mm4 ; abs
-
- movq mm6, mm7
- pcmpgtw mm5, mm6
-
- pandn mm5, mm6
- movq mm7, mm5
-
- movq mm5, [rdx+8]
- movq mm6, [rcx+8]
-
- paddw mm7, mm6
- pmulhuw mm7, mm5
-
- pxor mm7, mm4
- psubw mm7, mm4;gain the sign back
-
- mov rdi, arg(2) ;qcoeff_ptr
-
- movq mm1, mm7
- movq [rdi+8], mm7
-
- mov rax, arg(3) ;dequant_ptr
- movq mm6, [rax+8]
-
- pmullw mm7, mm6
- mov rax, arg(7) ;dqcoeff_ptr
-
- movq [rax+8], mm7
-
-
- ; next 8
- movq mm4, [rsi+16]
-
- mov rax, arg(1) ;zbin_ptr
- movq mm5, [rax+16]
-
- movq mm7, mm4
- psraw mm4, 15
-
- pxor mm7, mm4
- psubw mm7, mm4 ; abs
-
- movq mm6, mm7
- pcmpgtw mm5, mm6
-
- pandn mm5, mm6
- movq mm7, mm5
-
- movq mm5, [rdx+16]
- movq mm6, [rcx+16]
-
- paddw mm7, mm6
- pmulhuw mm7, mm5
-
- pxor mm7, mm4
- psubw mm7, mm4;gain the sign back
-
- mov rdi, arg(2) ;qcoeff_ptr
-
- movq mm1, mm7
- movq [rdi+16], mm7
-
- mov rax, arg(3) ;dequant_ptr
- movq mm6, [rax+16]
-
- pmullw mm7, mm6
- mov rax, arg(7) ;dqcoeff_ptr
-
- movq [rax+16], mm7
-
-
- ; next 8
- movq mm4, [rsi+24]
-
- mov rax, arg(1) ;zbin_ptr
- movq mm5, [rax+24]
-
- movq mm7, mm4
- psraw mm4, 15
-
- pxor mm7, mm4
- psubw mm7, mm4 ; abs
-
- movq mm6, mm7
- pcmpgtw mm5, mm6
-
- pandn mm5, mm6
- movq mm7, mm5
-
- movq mm5, [rdx+24]
- movq mm6, [rcx+24]
-
- paddw mm7, mm6
- pmulhuw mm7, mm5
-
- pxor mm7, mm4
- psubw mm7, mm4;gain the sign back
-
- mov rdi, arg(2) ;qcoeff_ptr
-
- movq mm1, mm7
- movq [rdi+24], mm7
-
- mov rax, arg(3) ;dequant_ptr
- movq mm6, [rax+24]
-
- pmullw mm7, mm6
- mov rax, arg(7) ;dqcoeff_ptr
-
- movq [rax+24], mm7
-
-
-
- mov rdi, arg(4) ;scan_mask
- mov rsi, arg(2) ;qcoeff_ptr
-
- pxor mm5, mm5
- pxor mm7, mm7
-
- movq mm0, [rsi]
- movq mm1, [rsi+8]
-
- movq mm2, [rdi]
- movq mm3, [rdi+8];
-
- pcmpeqw mm0, mm7
- pcmpeqw mm1, mm7
-
- pcmpeqw mm6, mm6
- pxor mm0, mm6
-
- pxor mm1, mm6
- psrlw mm0, 15
-
- psrlw mm1, 15
- pmaddwd mm0, mm2
-
- pmaddwd mm1, mm3
- movq mm5, mm0
-
- paddd mm5, mm1
-
- movq mm0, [rsi+16]
- movq mm1, [rsi+24]
-
- movq mm2, [rdi+16]
- movq mm3, [rdi+24];
-
- pcmpeqw mm0, mm7
- pcmpeqw mm1, mm7
-
- pcmpeqw mm6, mm6
- pxor mm0, mm6
-
- pxor mm1, mm6
- psrlw mm0, 15
-
- psrlw mm1, 15
- pmaddwd mm0, mm2
-
- pmaddwd mm1, mm3
- paddd mm5, mm0
-
- paddd mm5, mm1
- movq mm0, mm5
-
- psrlq mm5, 32
- paddd mm0, mm5
-
- ; eob adjustment begins here
- movq rcx, mm0
- and rcx, 0xffff
-
- xor rdx, rdx
- sub rdx, rcx ; rdx=-rcx
-
- bsr rax, rcx
- inc rax
-
- sar rdx, 31
- and rax, rdx
- ; Substitute the sse assembly for the old mmx mixed assembly/C. The
- ; following is kept as reference
- ; movq rcx, mm0
- ; bsr rax, rcx
- ;
- ; mov eob, rax
- ; mov eee, rcx
- ;
- ;if(eee==0)
- ;{
- ; eob=-1;
- ;}
- ;else if(eee<0)
- ;{
- ; eob=15;
- ;}
- ;d->eob = eob+1;
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse2.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse2.c
deleted file mode 100644
index f495bf2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse2.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_ports/x86.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vp8/encoder/block.h"
-#include "vp8/common/entropy.h" /* vp8_default_inv_zig_zag */
-
-#include <mmintrin.h> /* MMX */
-#include <xmmintrin.h> /* SSE */
-#include <emmintrin.h> /* SSE2 */
-
-#define SELECT_EOB(i, z) \
- do { \
- short boost = *zbin_boost_ptr; \
- int cmp = (x[z] < boost) | (y[z] == 0); \
- zbin_boost_ptr++; \
- if (cmp) \
- goto select_eob_end_##i; \
- qcoeff_ptr[z] = y[z]; \
- eob = i; \
- zbin_boost_ptr = b->zrun_zbin_boost; \
- select_eob_end_##i:; \
- } while (0)
-
-void vp8_regular_quantize_b_sse2(BLOCK *b, BLOCKD *d)
-{
- char eob = 0;
- short *zbin_boost_ptr = b->zrun_zbin_boost;
- short *qcoeff_ptr = d->qcoeff;
- DECLARE_ALIGNED_ARRAY(16, short, x, 16);
- DECLARE_ALIGNED_ARRAY(16, short, y, 16);
-
- __m128i sz0, x0, sz1, x1, y0, y1, x_minus_zbin0, x_minus_zbin1;
- __m128i quant_shift0 = _mm_load_si128((__m128i *)(b->quant_shift));
- __m128i quant_shift1 = _mm_load_si128((__m128i *)(b->quant_shift + 8));
- __m128i z0 = _mm_load_si128((__m128i *)(b->coeff));
- __m128i z1 = _mm_load_si128((__m128i *)(b->coeff+8));
- __m128i zbin_extra = _mm_cvtsi32_si128(b->zbin_extra);
- __m128i zbin0 = _mm_load_si128((__m128i *)(b->zbin));
- __m128i zbin1 = _mm_load_si128((__m128i *)(b->zbin + 8));
- __m128i round0 = _mm_load_si128((__m128i *)(b->round));
- __m128i round1 = _mm_load_si128((__m128i *)(b->round + 8));
- __m128i quant0 = _mm_load_si128((__m128i *)(b->quant));
- __m128i quant1 = _mm_load_si128((__m128i *)(b->quant + 8));
- __m128i dequant0 = _mm_load_si128((__m128i *)(d->dequant));
- __m128i dequant1 = _mm_load_si128((__m128i *)(d->dequant + 8));
-
- vpx_memset(qcoeff_ptr, 0, 32);
-
- /* Duplicate to all lanes. */
- zbin_extra = _mm_shufflelo_epi16(zbin_extra, 0);
- zbin_extra = _mm_unpacklo_epi16(zbin_extra, zbin_extra);
-
- /* Sign of z: z >> 15 */
- sz0 = _mm_srai_epi16(z0, 15);
- sz1 = _mm_srai_epi16(z1, 15);
-
- /* x = abs(z): (z ^ sz) - sz */
- x0 = _mm_xor_si128(z0, sz0);
- x1 = _mm_xor_si128(z1, sz1);
- x0 = _mm_sub_epi16(x0, sz0);
- x1 = _mm_sub_epi16(x1, sz1);
-
- /* zbin[] + zbin_extra */
- zbin0 = _mm_add_epi16(zbin0, zbin_extra);
- zbin1 = _mm_add_epi16(zbin1, zbin_extra);
-
- /* In C x is compared to zbin where zbin = zbin[] + boost + extra. Rebalance
- * the equation because boost is the only value which can change:
- * x - (zbin[] + extra) >= boost */
- x_minus_zbin0 = _mm_sub_epi16(x0, zbin0);
- x_minus_zbin1 = _mm_sub_epi16(x1, zbin1);
-
- _mm_store_si128((__m128i *)(x), x_minus_zbin0);
- _mm_store_si128((__m128i *)(x + 8), x_minus_zbin1);
-
- /* All the remaining calculations are valid whether they are done now with
- * simd or later inside the loop one at a time. */
- x0 = _mm_add_epi16(x0, round0);
- x1 = _mm_add_epi16(x1, round1);
-
- y0 = _mm_mulhi_epi16(x0, quant0);
- y1 = _mm_mulhi_epi16(x1, quant1);
-
- y0 = _mm_add_epi16(y0, x0);
- y1 = _mm_add_epi16(y1, x1);
-
- /* Instead of shifting each value independently we convert the scaling
- * factor with 1 << (16 - shift) so we can use multiply/return high half. */
- y0 = _mm_mulhi_epi16(y0, quant_shift0);
- y1 = _mm_mulhi_epi16(y1, quant_shift1);
-
- /* Return the sign: (y ^ sz) - sz */
- y0 = _mm_xor_si128(y0, sz0);
- y1 = _mm_xor_si128(y1, sz1);
- y0 = _mm_sub_epi16(y0, sz0);
- y1 = _mm_sub_epi16(y1, sz1);
-
- _mm_store_si128((__m128i *)(y), y0);
- _mm_store_si128((__m128i *)(y + 8), y1);
-
- zbin_boost_ptr = b->zrun_zbin_boost;
-
- /* The loop gets unrolled anyway. Avoid the vp8_default_zig_zag1d lookup. */
- SELECT_EOB(1, 0);
- SELECT_EOB(2, 1);
- SELECT_EOB(3, 4);
- SELECT_EOB(4, 8);
- SELECT_EOB(5, 5);
- SELECT_EOB(6, 2);
- SELECT_EOB(7, 3);
- SELECT_EOB(8, 6);
- SELECT_EOB(9, 9);
- SELECT_EOB(10, 12);
- SELECT_EOB(11, 13);
- SELECT_EOB(12, 10);
- SELECT_EOB(13, 7);
- SELECT_EOB(14, 11);
- SELECT_EOB(15, 14);
- SELECT_EOB(16, 15);
-
- y0 = _mm_load_si128((__m128i *)(d->qcoeff));
- y1 = _mm_load_si128((__m128i *)(d->qcoeff + 8));
-
- /* dqcoeff = qcoeff * dequant */
- y0 = _mm_mullo_epi16(y0, dequant0);
- y1 = _mm_mullo_epi16(y1, dequant1);
-
- _mm_store_si128((__m128i *)(d->dqcoeff), y0);
- _mm_store_si128((__m128i *)(d->dqcoeff + 8), y1);
-
- *d->eob = eob;
-}
-
-void vp8_fast_quantize_b_sse2(BLOCK *b, BLOCKD *d)
-{
- __m128i z0 = _mm_load_si128((__m128i *)(b->coeff));
- __m128i z1 = _mm_load_si128((__m128i *)(b->coeff + 8));
- __m128i round0 = _mm_load_si128((__m128i *)(b->round));
- __m128i round1 = _mm_load_si128((__m128i *)(b->round + 8));
- __m128i quant_fast0 = _mm_load_si128((__m128i *)(b->quant_fast));
- __m128i quant_fast1 = _mm_load_si128((__m128i *)(b->quant_fast + 8));
- __m128i dequant0 = _mm_load_si128((__m128i *)(d->dequant));
- __m128i dequant1 = _mm_load_si128((__m128i *)(d->dequant + 8));
- __m128i inv_zig_zag0 = _mm_load_si128((const __m128i *)(vp8_default_inv_zig_zag));
- __m128i inv_zig_zag1 = _mm_load_si128((const __m128i *)(vp8_default_inv_zig_zag + 8));
-
- __m128i sz0, sz1, x0, x1, y0, y1, xdq0, xdq1, zeros, ones;
-
- /* sign of z: z >> 15 */
- sz0 = _mm_srai_epi16(z0, 15);
- sz1 = _mm_srai_epi16(z1, 15);
-
- /* x = abs(z): (z ^ sz) - sz */
- x0 = _mm_xor_si128(z0, sz0);
- x1 = _mm_xor_si128(z1, sz1);
- x0 = _mm_sub_epi16(x0, sz0);
- x1 = _mm_sub_epi16(x1, sz1);
-
- /* x += round */
- x0 = _mm_add_epi16(x0, round0);
- x1 = _mm_add_epi16(x1, round1);
-
- /* y = (x * quant) >> 16 */
- y0 = _mm_mulhi_epi16(x0, quant_fast0);
- y1 = _mm_mulhi_epi16(x1, quant_fast1);
-
- /* x = abs(y) = (y ^ sz) - sz */
- y0 = _mm_xor_si128(y0, sz0);
- y1 = _mm_xor_si128(y1, sz1);
- x0 = _mm_sub_epi16(y0, sz0);
- x1 = _mm_sub_epi16(y1, sz1);
-
- /* qcoeff = x */
- _mm_store_si128((__m128i *)(d->qcoeff), x0);
- _mm_store_si128((__m128i *)(d->qcoeff + 8), x1);
-
- /* x * dequant */
- xdq0 = _mm_mullo_epi16(x0, dequant0);
- xdq1 = _mm_mullo_epi16(x1, dequant1);
-
- /* dqcoeff = x * dequant */
- _mm_store_si128((__m128i *)(d->dqcoeff), xdq0);
- _mm_store_si128((__m128i *)(d->dqcoeff + 8), xdq1);
-
- /* build a mask for the zig zag */
- zeros = _mm_setzero_si128();
-
- x0 = _mm_cmpeq_epi16(x0, zeros);
- x1 = _mm_cmpeq_epi16(x1, zeros);
-
- ones = _mm_cmpeq_epi16(zeros, zeros);
-
- x0 = _mm_xor_si128(x0, ones);
- x1 = _mm_xor_si128(x1, ones);
-
- x0 = _mm_and_si128(x0, inv_zig_zag0);
- x1 = _mm_and_si128(x1, inv_zig_zag1);
-
- x0 = _mm_max_epi16(x0, x1);
-
- /* now down to 8 */
- x1 = _mm_shuffle_epi32(x0, 0xE); // 0b00001110
-
- x0 = _mm_max_epi16(x0, x1);
-
- /* only 4 left */
- x1 = _mm_shufflelo_epi16(x0, 0xE); // 0b00001110
-
- x0 = _mm_max_epi16(x0, x1);
-
- /* okay, just 2! */
- x1 = _mm_shufflelo_epi16(x0, 0x1); // 0b00000001
-
- x0 = _mm_max_epi16(x0, x1);
-
- *d->eob = 0xFF & _mm_cvtsi128_si32(x0);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse4.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse4.asm
deleted file mode 100644
index dbd171b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_sse4.asm
+++ /dev/null
@@ -1,256 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-%include "vp8_asm_enc_offsets.asm"
-
-
-; void vp8_regular_quantize_b_sse4 | arg
-; (BLOCK *b, | 0
-; BLOCKD *d) | 1
-
-global sym(vp8_regular_quantize_b_sse4) PRIVATE
-sym(vp8_regular_quantize_b_sse4):
-
-%if ABI_IS_32BIT
- push rbp
- mov rbp, rsp
- GET_GOT rbx
- push rdi
- push rsi
-
- ALIGN_STACK 16, rax
- %define qcoeff 0 ; 32
- %define stack_size 32
- sub rsp, stack_size
-%else
- %if LIBVPX_YASM_WIN64
- SAVE_XMM 8, u
- push rdi
- push rsi
- %endif
-%endif
- ; end prolog
-
-%if ABI_IS_32BIT
- mov rdi, arg(0) ; BLOCK *b
- mov rsi, arg(1) ; BLOCKD *d
-%else
- %if LIBVPX_YASM_WIN64
- mov rdi, rcx ; BLOCK *b
- mov rsi, rdx ; BLOCKD *d
- %else
- ;mov rdi, rdi ; BLOCK *b
- ;mov rsi, rsi ; BLOCKD *d
- %endif
-%endif
-
- mov rax, [rdi + vp8_block_coeff]
- mov rcx, [rdi + vp8_block_zbin]
- mov rdx, [rdi + vp8_block_round]
- movd xmm7, [rdi + vp8_block_zbin_extra]
-
- ; z
- movdqa xmm0, [rax]
- movdqa xmm1, [rax + 16]
-
- ; duplicate zbin_oq_value
- pshuflw xmm7, xmm7, 0
- punpcklwd xmm7, xmm7
-
- movdqa xmm2, xmm0
- movdqa xmm3, xmm1
-
- ; sz
- psraw xmm0, 15
- psraw xmm1, 15
-
- ; (z ^ sz)
- pxor xmm2, xmm0
- pxor xmm3, xmm1
-
- ; x = abs(z)
- psubw xmm2, xmm0
- psubw xmm3, xmm1
-
- ; zbin
- movdqa xmm4, [rcx]
- movdqa xmm5, [rcx + 16]
-
- ; *zbin_ptr + zbin_oq_value
- paddw xmm4, xmm7
- paddw xmm5, xmm7
-
- movdqa xmm6, xmm2
- movdqa xmm7, xmm3
-
- ; x - (*zbin_ptr + zbin_oq_value)
- psubw xmm6, xmm4
- psubw xmm7, xmm5
-
- ; round
- movdqa xmm4, [rdx]
- movdqa xmm5, [rdx + 16]
-
- mov rax, [rdi + vp8_block_quant_shift]
- mov rcx, [rdi + vp8_block_quant]
- mov rdx, [rdi + vp8_block_zrun_zbin_boost]
-
- ; x + round
- paddw xmm2, xmm4
- paddw xmm3, xmm5
-
- ; quant
- movdqa xmm4, [rcx]
- movdqa xmm5, [rcx + 16]
-
- ; y = x * quant_ptr >> 16
- pmulhw xmm4, xmm2
- pmulhw xmm5, xmm3
-
- ; y += x
- paddw xmm2, xmm4
- paddw xmm3, xmm5
-
- pxor xmm4, xmm4
-%if ABI_IS_32BIT
- movdqa [rsp + qcoeff], xmm4
- movdqa [rsp + qcoeff + 16], xmm4
-%else
- pxor xmm8, xmm8
-%endif
-
- ; quant_shift
- movdqa xmm5, [rax]
-
- ; zrun_zbin_boost
- mov rax, rdx
-
-%macro ZIGZAG_LOOP 5
- ; x
- pextrw ecx, %4, %2
-
- ; if (x >= zbin)
- sub cx, WORD PTR[rdx] ; x - zbin
- lea rdx, [rdx + 2] ; zbin_boost_ptr++
- jl .rq_zigzag_loop_%1 ; x < zbin
-
- pextrw edi, %3, %2 ; y
-
- ; downshift by quant_shift[rc]
- pextrb ecx, xmm5, %1 ; quant_shift[rc]
- sar edi, cl ; also sets Z bit
- je .rq_zigzag_loop_%1 ; !y
-%if ABI_IS_32BIT
- mov WORD PTR[rsp + qcoeff + %1 *2], di
-%else
- pinsrw %5, edi, %2 ; qcoeff[rc]
-%endif
- mov rdx, rax ; reset to b->zrun_zbin_boost
-.rq_zigzag_loop_%1:
-%endmacro
-; in vp8_default_zig_zag1d order: see vp8/common/entropy.c
-ZIGZAG_LOOP 0, 0, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 1, 1, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 4, 4, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 8, 0, xmm3, xmm7, xmm8
-ZIGZAG_LOOP 5, 5, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 2, 2, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 3, 3, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 6, 6, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 9, 1, xmm3, xmm7, xmm8
-ZIGZAG_LOOP 12, 4, xmm3, xmm7, xmm8
-ZIGZAG_LOOP 13, 5, xmm3, xmm7, xmm8
-ZIGZAG_LOOP 10, 2, xmm3, xmm7, xmm8
-ZIGZAG_LOOP 7, 7, xmm2, xmm6, xmm4
-ZIGZAG_LOOP 11, 3, xmm3, xmm7, xmm8
-ZIGZAG_LOOP 14, 6, xmm3, xmm7, xmm8
-ZIGZAG_LOOP 15, 7, xmm3, xmm7, xmm8
-
- mov rcx, [rsi + vp8_blockd_dequant]
- mov rdi, [rsi + vp8_blockd_dqcoeff]
-
-%if ABI_IS_32BIT
- movdqa xmm4, [rsp + qcoeff]
- movdqa xmm5, [rsp + qcoeff + 16]
-%else
- %define xmm5 xmm8
-%endif
-
- ; y ^ sz
- pxor xmm4, xmm0
- pxor xmm5, xmm1
- ; x = (y ^ sz) - sz
- psubw xmm4, xmm0
- psubw xmm5, xmm1
-
- ; dequant
- movdqa xmm0, [rcx]
- movdqa xmm1, [rcx + 16]
-
- mov rcx, [rsi + vp8_blockd_qcoeff]
-
- pmullw xmm0, xmm4
- pmullw xmm1, xmm5
-
- ; store qcoeff
- movdqa [rcx], xmm4
- movdqa [rcx + 16], xmm5
-
- ; store dqcoeff
- movdqa [rdi], xmm0
- movdqa [rdi + 16], xmm1
-
- mov rcx, [rsi + vp8_blockd_eob]
-
- ; select the last value (in zig_zag order) for EOB
- pxor xmm6, xmm6
- pcmpeqw xmm4, xmm6
- pcmpeqw xmm5, xmm6
-
- packsswb xmm4, xmm5
- pshufb xmm4, [GLOBAL(zig_zag1d)]
- pmovmskb edx, xmm4
- xor rdi, rdi
- mov eax, -1
- xor dx, ax
- bsr eax, edx
- sub edi, edx
- sar edi, 31
- add eax, 1
- and eax, edi
-
- mov BYTE PTR [rcx], al ; store eob
-
- ; begin epilog
-%if ABI_IS_32BIT
- add rsp, stack_size
- pop rsp
-
- pop rsi
- pop rdi
- RESTORE_GOT
- pop rbp
-%else
- %undef xmm5
- %if LIBVPX_YASM_WIN64
- pop rsi
- pop rdi
- RESTORE_XMM
- %endif
-%endif
-
- ret
-
-SECTION_RODATA
-align 16
-; vp8/common/entropy.c: vp8_default_zig_zag1d
-zig_zag1d:
- db 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_ssse3.asm
deleted file mode 100644
index 7b1dc11..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/quantize_ssse3.asm
+++ /dev/null
@@ -1,138 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-%include "vp8_asm_enc_offsets.asm"
-
-
-; void vp8_fast_quantize_b_ssse3 | arg
-; (BLOCK *b, | 0
-; BLOCKD *d) | 1
-;
-
-global sym(vp8_fast_quantize_b_ssse3) PRIVATE
-sym(vp8_fast_quantize_b_ssse3):
- push rbp
- mov rbp, rsp
- GET_GOT rbx
-
-%if ABI_IS_32BIT
- push rdi
- push rsi
-%else
- %if LIBVPX_YASM_WIN64
- push rdi
- push rsi
- %endif
-%endif
- ; end prolog
-
-%if ABI_IS_32BIT
- mov rdi, arg(0) ; BLOCK *b
- mov rsi, arg(1) ; BLOCKD *d
-%else
- %if LIBVPX_YASM_WIN64
- mov rdi, rcx ; BLOCK *b
- mov rsi, rdx ; BLOCKD *d
- %else
- ;mov rdi, rdi ; BLOCK *b
- ;mov rsi, rsi ; BLOCKD *d
- %endif
-%endif
-
- mov rax, [rdi + vp8_block_coeff]
- mov rcx, [rdi + vp8_block_round]
- mov rdx, [rdi + vp8_block_quant_fast]
-
- ; coeff
- movdqa xmm0, [rax]
- movdqa xmm4, [rax + 16]
-
- ; round
- movdqa xmm2, [rcx]
- movdqa xmm3, [rcx + 16]
-
- movdqa xmm1, xmm0
- movdqa xmm5, xmm4
-
- ; sz = z >> 15
- psraw xmm0, 15
- psraw xmm4, 15
-
- pabsw xmm1, xmm1
- pabsw xmm5, xmm5
-
- paddw xmm1, xmm2
- paddw xmm5, xmm3
-
- ; quant_fast
- pmulhw xmm1, [rdx]
- pmulhw xmm5, [rdx + 16]
-
- mov rax, [rsi + vp8_blockd_qcoeff]
- mov rdi, [rsi + vp8_blockd_dequant]
- mov rcx, [rsi + vp8_blockd_dqcoeff]
-
- movdqa xmm2, xmm1 ;store y for getting eob
- movdqa xmm3, xmm5
-
- pxor xmm1, xmm0
- pxor xmm5, xmm4
- psubw xmm1, xmm0
- psubw xmm5, xmm4
-
- movdqa [rax], xmm1
- movdqa [rax + 16], xmm5
-
- movdqa xmm0, [rdi]
- movdqa xmm4, [rdi + 16]
-
- pmullw xmm0, xmm1
- pmullw xmm4, xmm5
- pxor xmm1, xmm1
-
- pcmpgtw xmm2, xmm1 ;calculate eob
- pcmpgtw xmm3, xmm1
- packsswb xmm2, xmm3
- pshufb xmm2, [GLOBAL(zz_shuf)]
-
- pmovmskb edx, xmm2
-
- movdqa [rcx], xmm0 ;store dqcoeff
- movdqa [rcx + 16], xmm4 ;store dqcoeff
- mov rcx, [rsi + vp8_blockd_eob]
-
- bsr eax, edx ;count 0
- add eax, 1
-
- cmp edx, 0 ;if all 0, eob=0
- cmove eax, edx
-
- mov BYTE PTR [rcx], al ;store eob
-
- ; begin epilog
-%if ABI_IS_32BIT
- pop rsi
- pop rdi
-%else
- %if LIBVPX_YASM_WIN64
- pop rsi
- pop rdi
- %endif
-%endif
-
- RESTORE_GOT
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-zz_shuf:
- db 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/ssim_opt.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/ssim_opt.asm
deleted file mode 100644
index 5964a85..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/ssim_opt.asm
+++ /dev/null
@@ -1,216 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "vpx_ports/x86_abi_support.asm"
-
-; tabulate_ssim - sums sum_s,sum_r,sum_sq_s,sum_sq_r, sum_sxr
-%macro TABULATE_SSIM 0
- paddusw xmm15, xmm3 ; sum_s
- paddusw xmm14, xmm4 ; sum_r
- movdqa xmm1, xmm3
- pmaddwd xmm1, xmm1
- paddd xmm13, xmm1 ; sum_sq_s
- movdqa xmm2, xmm4
- pmaddwd xmm2, xmm2
- paddd xmm12, xmm2 ; sum_sq_r
- pmaddwd xmm3, xmm4
- paddd xmm11, xmm3 ; sum_sxr
-%endmacro
-
-; Sum across the register %1 starting with q words
-%macro SUM_ACROSS_Q 1
- movdqa xmm2,%1
- punpckldq %1,xmm0
- punpckhdq xmm2,xmm0
- paddq %1,xmm2
- movdqa xmm2,%1
- punpcklqdq %1,xmm0
- punpckhqdq xmm2,xmm0
- paddq %1,xmm2
-%endmacro
-
-; Sum across the register %1 starting with q words
-%macro SUM_ACROSS_W 1
- movdqa xmm1, %1
- punpcklwd %1,xmm0
- punpckhwd xmm1,xmm0
- paddd %1, xmm1
- SUM_ACROSS_Q %1
-%endmacro
-;void ssim_parms_sse2(
-; unsigned char *s,
-; int sp,
-; unsigned char *r,
-; int rp
-; unsigned long *sum_s,
-; unsigned long *sum_r,
-; unsigned long *sum_sq_s,
-; unsigned long *sum_sq_r,
-; unsigned long *sum_sxr);
-;
-; TODO: Use parm passing through structure, probably don't need the pxors
-; ( calling app will initialize to 0 ) could easily fit everything in sse2
-; without too much hastle, and can probably do better estimates with psadw
-; or pavgb At this point this is just meant to be first pass for calculating
-; all the parms needed for 16x16 ssim so we can play with dssim as distortion
-; in mode selection code.
-global sym(vp8_ssim_parms_16x16_sse2) PRIVATE
-sym(vp8_ssim_parms_16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 9
- SAVE_XMM 15
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;s
- mov rcx, arg(1) ;sp
- mov rdi, arg(2) ;r
- mov rax, arg(3) ;rp
-
- pxor xmm0, xmm0
- pxor xmm15,xmm15 ;sum_s
- pxor xmm14,xmm14 ;sum_r
- pxor xmm13,xmm13 ;sum_sq_s
- pxor xmm12,xmm12 ;sum_sq_r
- pxor xmm11,xmm11 ;sum_sxr
-
- mov rdx, 16 ;row counter
-.NextRow:
-
- ;grab source and reference pixels
- movdqu xmm5, [rsi]
- movdqu xmm6, [rdi]
- movdqa xmm3, xmm5
- movdqa xmm4, xmm6
- punpckhbw xmm3, xmm0 ; high_s
- punpckhbw xmm4, xmm0 ; high_r
-
- TABULATE_SSIM
-
- movdqa xmm3, xmm5
- movdqa xmm4, xmm6
- punpcklbw xmm3, xmm0 ; low_s
- punpcklbw xmm4, xmm0 ; low_r
-
- TABULATE_SSIM
-
- add rsi, rcx ; next s row
- add rdi, rax ; next r row
-
- dec rdx ; counter
- jnz .NextRow
-
- SUM_ACROSS_W xmm15
- SUM_ACROSS_W xmm14
- SUM_ACROSS_Q xmm13
- SUM_ACROSS_Q xmm12
- SUM_ACROSS_Q xmm11
-
- mov rdi,arg(4)
- movd [rdi], xmm15;
- mov rdi,arg(5)
- movd [rdi], xmm14;
- mov rdi,arg(6)
- movd [rdi], xmm13;
- mov rdi,arg(7)
- movd [rdi], xmm12;
- mov rdi,arg(8)
- movd [rdi], xmm11;
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void ssim_parms_sse2(
-; unsigned char *s,
-; int sp,
-; unsigned char *r,
-; int rp
-; unsigned long *sum_s,
-; unsigned long *sum_r,
-; unsigned long *sum_sq_s,
-; unsigned long *sum_sq_r,
-; unsigned long *sum_sxr);
-;
-; TODO: Use parm passing through structure, probably don't need the pxors
-; ( calling app will initialize to 0 ) could easily fit everything in sse2
-; without too much hastle, and can probably do better estimates with psadw
-; or pavgb At this point this is just meant to be first pass for calculating
-; all the parms needed for 16x16 ssim so we can play with dssim as distortion
-; in mode selection code.
-global sym(vp8_ssim_parms_8x8_sse2) PRIVATE
-sym(vp8_ssim_parms_8x8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 9
- SAVE_XMM 15
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;s
- mov rcx, arg(1) ;sp
- mov rdi, arg(2) ;r
- mov rax, arg(3) ;rp
-
- pxor xmm0, xmm0
- pxor xmm15,xmm15 ;sum_s
- pxor xmm14,xmm14 ;sum_r
- pxor xmm13,xmm13 ;sum_sq_s
- pxor xmm12,xmm12 ;sum_sq_r
- pxor xmm11,xmm11 ;sum_sxr
-
- mov rdx, 8 ;row counter
-.NextRow:
-
- ;grab source and reference pixels
- movq xmm3, [rsi]
- movq xmm4, [rdi]
- punpcklbw xmm3, xmm0 ; low_s
- punpcklbw xmm4, xmm0 ; low_r
-
- TABULATE_SSIM
-
- add rsi, rcx ; next s row
- add rdi, rax ; next r row
-
- dec rdx ; counter
- jnz .NextRow
-
- SUM_ACROSS_W xmm15
- SUM_ACROSS_W xmm14
- SUM_ACROSS_Q xmm13
- SUM_ACROSS_Q xmm12
- SUM_ACROSS_Q xmm11
-
- mov rdi,arg(4)
- movd [rdi], xmm15;
- mov rdi,arg(5)
- movd [rdi], xmm14;
- mov rdi,arg(6)
- movd [rdi], xmm13;
- mov rdi,arg(7)
- movd [rdi], xmm12;
- mov rdi,arg(8)
- movd [rdi], xmm11;
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_mmx.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_mmx.asm
deleted file mode 100644
index 794dd22..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_mmx.asm
+++ /dev/null
@@ -1,223 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_subtract_b_mmx_impl(unsigned char *z, int src_stride,
-; short *diff, unsigned char *Predictor,
-; int pitch);
-global sym(vp8_subtract_b_mmx_impl) PRIVATE
-sym(vp8_subtract_b_mmx_impl):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
-
- mov rdi, arg(2) ;diff
- mov rax, arg(3) ;Predictor
- mov rsi, arg(0) ;z
- movsxd rdx, dword ptr arg(1);src_stride;
- movsxd rcx, dword ptr arg(4);pitch
- pxor mm7, mm7
-
- movd mm0, [rsi]
- movd mm1, [rax]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq [rdi], mm0
-
-
- movd mm0, [rsi+rdx]
- movd mm1, [rax+rcx]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq [rdi+rcx*2],mm0
-
-
- movd mm0, [rsi+rdx*2]
- movd mm1, [rax+rcx*2]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq [rdi+rcx*4], mm0
-
- lea rsi, [rsi+rdx*2]
- lea rcx, [rcx+rcx*2]
-
-
-
- movd mm0, [rsi+rdx]
- movd mm1, [rax+rcx]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq [rdi+rcx*2], mm0
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp8_subtract_mby_mmx(short *diff, unsigned char *src, int src_stride,
-;unsigned char *pred, int pred_stride)
-global sym(vp8_subtract_mby_mmx) PRIVATE
-sym(vp8_subtract_mby_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rdi, arg(0) ;diff
- mov rsi, arg(1) ;src
- movsxd rdx, dword ptr arg(2);src_stride
- mov rax, arg(3) ;pred
- push rbx
- movsxd rbx, dword ptr arg(4);pred_stride
-
- pxor mm0, mm0
- mov rcx, 16
-
-
-.submby_loop:
- movq mm1, [rsi]
- movq mm3, [rax]
-
- movq mm2, mm1
- movq mm4, mm3
-
- punpcklbw mm1, mm0
- punpcklbw mm3, mm0
-
- punpckhbw mm2, mm0
- punpckhbw mm4, mm0
-
- psubw mm1, mm3
- psubw mm2, mm4
-
- movq [rdi], mm1
- movq [rdi+8], mm2
-
- movq mm1, [rsi+8]
- movq mm3, [rax+8]
-
- movq mm2, mm1
- movq mm4, mm3
-
- punpcklbw mm1, mm0
- punpcklbw mm3, mm0
-
- punpckhbw mm2, mm0
- punpckhbw mm4, mm0
-
- psubw mm1, mm3
- psubw mm2, mm4
-
- movq [rdi+16], mm1
- movq [rdi+24], mm2
- add rdi, 32
- lea rax, [rax+rbx]
- lea rsi, [rsi+rdx]
- dec rcx
- jnz .submby_loop
-
- pop rbx
- pop rdi
- pop rsi
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;vp8_subtract_mbuv_mmx(short *diff, unsigned char *usrc, unsigned char *vsrc,
-; int src_stride, unsigned char *upred,
-; unsigned char *vpred, int pred_stride)
-
-global sym(vp8_subtract_mbuv_mmx) PRIVATE
-sym(vp8_subtract_mbuv_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- push rsi
- push rdi
- ; end prolog
-
- mov rdi, arg(0) ;diff
- mov rsi, arg(1) ;usrc
- movsxd rdx, dword ptr arg(3);src_stride;
- mov rax, arg(4) ;upred
- add rdi, 256*2 ;diff = diff + 256 (shorts)
- mov rcx, 8
- push rbx
- movsxd rbx, dword ptr arg(6);pred_stride
-
- pxor mm7, mm7
-
-.submbu_loop:
- movq mm0, [rsi]
- movq mm1, [rax]
- movq mm3, mm0
- movq mm4, mm1
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- punpckhbw mm3, mm7
- punpckhbw mm4, mm7
- psubw mm0, mm1
- psubw mm3, mm4
- movq [rdi], mm0
- movq [rdi+8], mm3
- add rdi, 16
- add rsi, rdx
- add rax, rbx
-
- dec rcx
- jnz .submbu_loop
-
- mov rsi, arg(2) ;vsrc
- mov rax, arg(5) ;vpred
- mov rcx, 8
-
-.submbv_loop:
- movq mm0, [rsi]
- movq mm1, [rax]
- movq mm3, mm0
- movq mm4, mm1
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- punpckhbw mm3, mm7
- punpckhbw mm4, mm7
- psubw mm0, mm1
- psubw mm3, mm4
- movq [rdi], mm0
- movq [rdi+8], mm3
- add rdi, 16
- add rsi, rdx
- add rax, rbx
-
- dec rcx
- jnz .submbv_loop
-
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_sse2.asm
deleted file mode 100644
index a5d17f5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/subtract_sse2.asm
+++ /dev/null
@@ -1,245 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp8_subtract_b_sse2_impl(unsigned char *z, int src_stride,
-; short *diff, unsigned char *Predictor,
-; int pitch);
-global sym(vp8_subtract_b_sse2_impl) PRIVATE
-sym(vp8_subtract_b_sse2_impl):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rdi, arg(2) ;diff
- mov rax, arg(3) ;Predictor
- mov rsi, arg(0) ;z
- movsxd rdx, dword ptr arg(1);src_stride;
- movsxd rcx, dword ptr arg(4);pitch
- pxor mm7, mm7
-
- movd mm0, [rsi]
- movd mm1, [rax]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq MMWORD PTR [rdi], mm0
-
- movd mm0, [rsi+rdx]
- movd mm1, [rax+rcx]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq MMWORD PTR [rdi+rcx*2], mm0
-
- movd mm0, [rsi+rdx*2]
- movd mm1, [rax+rcx*2]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq MMWORD PTR [rdi+rcx*4], mm0
-
- lea rsi, [rsi+rdx*2]
- lea rcx, [rcx+rcx*2]
-
- movd mm0, [rsi+rdx]
- movd mm1, [rax+rcx]
- punpcklbw mm0, mm7
- punpcklbw mm1, mm7
- psubw mm0, mm1
- movq MMWORD PTR [rdi+rcx*2], mm0
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp8_subtract_mby_sse2(short *diff, unsigned char *src, int src_stride,
-;unsigned char *pred, int pred_stride)
-global sym(vp8_subtract_mby_sse2) PRIVATE
-sym(vp8_subtract_mby_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rdi, arg(0) ;diff
- mov rsi, arg(1) ;src
- movsxd rdx, dword ptr arg(2);src_stride
- mov rax, arg(3) ;pred
- movdqa xmm4, [GLOBAL(t80)]
- push rbx
- mov rcx, 8 ; do two lines at one time
- movsxd rbx, dword ptr arg(4);pred_stride
-
-.submby_loop:
- movdqa xmm0, [rsi] ; src
- movdqa xmm1, [rax] ; pred
-
- movdqa xmm2, xmm0
- psubb xmm0, xmm1
-
- pxor xmm1, xmm4 ;convert to signed values
- pxor xmm2, xmm4
- pcmpgtb xmm1, xmm2 ; obtain sign information
-
- movdqa xmm2, xmm0
- punpcklbw xmm0, xmm1 ; put sign back to subtraction
- punpckhbw xmm2, xmm1 ; put sign back to subtraction
-
- movdqa xmm3, [rsi + rdx]
- movdqa xmm5, [rax + rbx]
-
- lea rsi, [rsi+rdx*2]
- lea rax, [rax+rbx*2]
-
- movdqa [rdi], xmm0
- movdqa [rdi +16], xmm2
-
- movdqa xmm1, xmm3
- psubb xmm3, xmm5
-
- pxor xmm5, xmm4 ;convert to signed values
- pxor xmm1, xmm4
- pcmpgtb xmm5, xmm1 ; obtain sign information
-
- movdqa xmm1, xmm3
- punpcklbw xmm3, xmm5 ; put sign back to subtraction
- punpckhbw xmm1, xmm5 ; put sign back to subtraction
-
- movdqa [rdi +32], xmm3
- movdqa [rdi +48], xmm1
-
- add rdi, 64
- dec rcx
- jnz .submby_loop
-
- pop rbx
- pop rdi
- pop rsi
- ; begin epilog
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;vp8_subtract_mbuv_sse2(short *diff, unsigned char *usrc, unsigned char *vsrc,
-; int src_stride, unsigned char *upred,
-; unsigned char *vpred, int pred_stride)
-global sym(vp8_subtract_mbuv_sse2) PRIVATE
-sym(vp8_subtract_mbuv_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- movdqa xmm4, [GLOBAL(t80)]
- mov rdi, arg(0) ;diff
- mov rsi, arg(1) ;usrc
- movsxd rdx, dword ptr arg(3);src_stride;
- mov rax, arg(4) ;upred
- add rdi, 256*2 ;diff = diff + 256 (shorts)
- mov rcx, 4
- push rbx
- movsxd rbx, dword ptr arg(6);pred_stride
-
- ;u
-.submbu_loop:
- movq xmm0, [rsi] ; src
- movq xmm2, [rsi+rdx] ; src -- next line
- movq xmm1, [rax] ; pred
- movq xmm3, [rax+rbx] ; pred -- next line
- lea rsi, [rsi + rdx*2]
- lea rax, [rax + rbx*2]
-
- punpcklqdq xmm0, xmm2
- punpcklqdq xmm1, xmm3
-
- movdqa xmm2, xmm0
- psubb xmm0, xmm1 ; subtraction with sign missed
-
- pxor xmm1, xmm4 ;convert to signed values
- pxor xmm2, xmm4
- pcmpgtb xmm1, xmm2 ; obtain sign information
-
- movdqa xmm2, xmm0
- movdqa xmm3, xmm1
- punpcklbw xmm0, xmm1 ; put sign back to subtraction
- punpckhbw xmm2, xmm3 ; put sign back to subtraction
-
- movdqa [rdi], xmm0 ; store difference
- movdqa [rdi +16], xmm2 ; store difference
- add rdi, 32
- sub rcx, 1
- jnz .submbu_loop
-
- mov rsi, arg(2) ;vsrc
- mov rax, arg(5) ;vpred
- mov rcx, 4
-
- ;v
-.submbv_loop:
- movq xmm0, [rsi] ; src
- movq xmm2, [rsi+rdx] ; src -- next line
- movq xmm1, [rax] ; pred
- movq xmm3, [rax+rbx] ; pred -- next line
- lea rsi, [rsi + rdx*2]
- lea rax, [rax + rbx*2]
-
- punpcklqdq xmm0, xmm2
- punpcklqdq xmm1, xmm3
-
- movdqa xmm2, xmm0
- psubb xmm0, xmm1 ; subtraction with sign missed
-
- pxor xmm1, xmm4 ;convert to signed values
- pxor xmm2, xmm4
- pcmpgtb xmm1, xmm2 ; obtain sign information
-
- movdqa xmm2, xmm0
- movdqa xmm3, xmm1
- punpcklbw xmm0, xmm1 ; put sign back to subtraction
- punpckhbw xmm2, xmm3 ; put sign back to subtraction
-
- movdqa [rdi], xmm0 ; store difference
- movdqa [rdi +16], xmm2 ; store difference
- add rdi, 32
- sub rcx, 1
- jnz .submbv_loop
-
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-t80:
- times 16 db 0x80
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm
deleted file mode 100644
index bd92b39..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/temporal_filter_apply_sse2.asm
+++ /dev/null
@@ -1,207 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-; void vp8_temporal_filter_apply_sse2 | arg
-; (unsigned char *frame1, | 0
-; unsigned int stride, | 1
-; unsigned char *frame2, | 2
-; unsigned int block_size, | 3
-; int strength, | 4
-; int filter_weight, | 5
-; unsigned int *accumulator, | 6
-; unsigned short *count) | 7
-global sym(vp8_temporal_filter_apply_sse2) PRIVATE
-sym(vp8_temporal_filter_apply_sse2):
-
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ALIGN_STACK 16, rax
- %define block_size 0
- %define strength 16
- %define filter_weight 32
- %define rounding_bit 48
- %define rbp_backup 64
- %define stack_size 80
- sub rsp, stack_size
- mov [rsp + rbp_backup], rbp
- ; end prolog
-
- mov rdx, arg(3)
- mov [rsp + block_size], rdx
- movd xmm6, arg(4)
- movdqa [rsp + strength], xmm6 ; where strength is used, all 16 bytes are read
-
- ; calculate the rounding bit outside the loop
- ; 0x8000 >> (16 - strength)
- mov rdx, 16
- sub rdx, arg(4) ; 16 - strength
- movq xmm4, rdx ; can't use rdx w/ shift
- movdqa xmm5, [GLOBAL(_const_top_bit)]
- psrlw xmm5, xmm4
- movdqa [rsp + rounding_bit], xmm5
-
- mov rsi, arg(0) ; src/frame1
- mov rdx, arg(2) ; predictor frame
- mov rdi, arg(6) ; accumulator
- mov rax, arg(7) ; count
-
- ; dup the filter weight and store for later
- movd xmm0, arg(5) ; filter_weight
- pshuflw xmm0, xmm0, 0
- punpcklwd xmm0, xmm0
- movdqa [rsp + filter_weight], xmm0
-
- mov rbp, arg(1) ; stride
- pxor xmm7, xmm7 ; zero for extraction
-
- lea rcx, [rdx + 16*16*1]
- cmp dword ptr [rsp + block_size], 8
- jne .temporal_filter_apply_load_16
- lea rcx, [rdx + 8*8*1]
-
-.temporal_filter_apply_load_8:
- movq xmm0, [rsi] ; first row
- lea rsi, [rsi + rbp] ; += stride
- punpcklbw xmm0, xmm7 ; src[ 0- 7]
- movq xmm1, [rsi] ; second row
- lea rsi, [rsi + rbp] ; += stride
- punpcklbw xmm1, xmm7 ; src[ 8-15]
- jmp .temporal_filter_apply_load_finished
-
-.temporal_filter_apply_load_16:
- movdqa xmm0, [rsi] ; src (frame1)
- lea rsi, [rsi + rbp] ; += stride
- movdqa xmm1, xmm0
- punpcklbw xmm0, xmm7 ; src[ 0- 7]
- punpckhbw xmm1, xmm7 ; src[ 8-15]
-
-.temporal_filter_apply_load_finished:
- movdqa xmm2, [rdx] ; predictor (frame2)
- movdqa xmm3, xmm2
- punpcklbw xmm2, xmm7 ; pred[ 0- 7]
- punpckhbw xmm3, xmm7 ; pred[ 8-15]
-
- ; modifier = src_byte - pixel_value
- psubw xmm0, xmm2 ; src - pred[ 0- 7]
- psubw xmm1, xmm3 ; src - pred[ 8-15]
-
- ; modifier *= modifier
- pmullw xmm0, xmm0 ; modifer[ 0- 7]^2
- pmullw xmm1, xmm1 ; modifer[ 8-15]^2
-
- ; modifier *= 3
- pmullw xmm0, [GLOBAL(_const_3w)]
- pmullw xmm1, [GLOBAL(_const_3w)]
-
- ; modifer += 0x8000 >> (16 - strength)
- paddw xmm0, [rsp + rounding_bit]
- paddw xmm1, [rsp + rounding_bit]
-
- ; modifier >>= strength
- psrlw xmm0, [rsp + strength]
- psrlw xmm1, [rsp + strength]
-
- ; modifier = 16 - modifier
- ; saturation takes care of modifier > 16
- movdqa xmm3, [GLOBAL(_const_16w)]
- movdqa xmm2, [GLOBAL(_const_16w)]
- psubusw xmm3, xmm1
- psubusw xmm2, xmm0
-
- ; modifier *= filter_weight
- pmullw xmm2, [rsp + filter_weight]
- pmullw xmm3, [rsp + filter_weight]
-
- ; count
- movdqa xmm4, [rax]
- movdqa xmm5, [rax+16]
- ; += modifier
- paddw xmm4, xmm2
- paddw xmm5, xmm3
- ; write back
- movdqa [rax], xmm4
- movdqa [rax+16], xmm5
- lea rax, [rax + 16*2] ; count += 16*(sizeof(short))
-
- ; load and extract the predictor up to shorts
- pxor xmm7, xmm7
- movdqa xmm0, [rdx]
- lea rdx, [rdx + 16*1] ; pred += 16*(sizeof(char))
- movdqa xmm1, xmm0
- punpcklbw xmm0, xmm7 ; pred[ 0- 7]
- punpckhbw xmm1, xmm7 ; pred[ 8-15]
-
- ; modifier *= pixel_value
- pmullw xmm0, xmm2
- pmullw xmm1, xmm3
-
- ; expand to double words
- movdqa xmm2, xmm0
- punpcklwd xmm0, xmm7 ; [ 0- 3]
- punpckhwd xmm2, xmm7 ; [ 4- 7]
- movdqa xmm3, xmm1
- punpcklwd xmm1, xmm7 ; [ 8-11]
- punpckhwd xmm3, xmm7 ; [12-15]
-
- ; accumulator
- movdqa xmm4, [rdi]
- movdqa xmm5, [rdi+16]
- movdqa xmm6, [rdi+32]
- movdqa xmm7, [rdi+48]
- ; += modifier
- paddd xmm4, xmm0
- paddd xmm5, xmm2
- paddd xmm6, xmm1
- paddd xmm7, xmm3
- ; write back
- movdqa [rdi], xmm4
- movdqa [rdi+16], xmm5
- movdqa [rdi+32], xmm6
- movdqa [rdi+48], xmm7
- lea rdi, [rdi + 16*4] ; accumulator += 16*(sizeof(int))
-
- cmp rdx, rcx
- je .temporal_filter_apply_epilog
- pxor xmm7, xmm7 ; zero for extraction
- cmp dword ptr [rsp + block_size], 16
- je .temporal_filter_apply_load_16
- jmp .temporal_filter_apply_load_8
-
-.temporal_filter_apply_epilog:
- ; begin epilog
- mov rbp, [rsp + rbp_backup]
- add rsp, stack_size
- pop rsp
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-_const_3w:
- times 8 dw 3
-align 16
-_const_top_bit:
- times 8 dw 1<<15
-align 16
-_const_16w
- times 8 dw 16
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_mmx.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_mmx.c
deleted file mode 100644
index cf3d8ca..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_mmx.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_ports/x86.h"
-#include "vp8/encoder/block.h"
-
-void vp8_short_fdct4x4_mmx(short *input, short *output, int pitch);
-void vp8_short_fdct8x4_mmx(short *input, short *output, int pitch)
-{
- vp8_short_fdct4x4_mmx(input, output, pitch);
- vp8_short_fdct4x4_mmx(input + 4, output + 16, pitch);
-}
-
-int vp8_fast_quantize_b_impl_mmx(short *coeff_ptr, short *zbin_ptr,
- short *qcoeff_ptr, short *dequant_ptr,
- const short *scan_mask, short *round_ptr,
- short *quant_ptr, short *dqcoeff_ptr);
-void vp8_fast_quantize_b_mmx(BLOCK *b, BLOCKD *d)
-{
- const short *scan_mask = vp8_default_zig_zag_mask;
- short *coeff_ptr = b->coeff;
- short *zbin_ptr = b->zbin;
- short *round_ptr = b->round;
- short *quant_ptr = b->quant_fast;
- short *qcoeff_ptr = d->qcoeff;
- short *dqcoeff_ptr = d->dqcoeff;
- short *dequant_ptr = d->dequant;
-
- *d->eob = (char)vp8_fast_quantize_b_impl_mmx(
- coeff_ptr,
- zbin_ptr,
- qcoeff_ptr,
- dequant_ptr,
- scan_mask,
-
- round_ptr,
- quant_ptr,
- dqcoeff_ptr
- );
-}
-
-int vp8_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
-int vp8_mbblock_error_mmx(MACROBLOCK *mb, int dc)
-{
- short *coeff_ptr = mb->block[0].coeff;
- short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff;
- return vp8_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr, dc);
-}
-
-int vp8_mbuverror_mmx_impl(short *s_ptr, short *d_ptr);
-int vp8_mbuverror_mmx(MACROBLOCK *mb)
-{
- short *s_ptr = &mb->coeff[256];
- short *d_ptr = &mb->e_mbd.dqcoeff[256];
- return vp8_mbuverror_mmx_impl(s_ptr, d_ptr);
-}
-
-void vp8_subtract_b_mmx_impl(unsigned char *z, int src_stride,
- short *diff, unsigned char *predictor,
- int pitch);
-void vp8_subtract_b_mmx(BLOCK *be, BLOCKD *bd, int pitch)
-{
- unsigned char *z = *(be->base_src) + be->src;
- unsigned int src_stride = be->src_stride;
- short *diff = &be->src_diff[0];
- unsigned char *predictor = &bd->predictor[0];
- vp8_subtract_b_mmx_impl(z, src_stride, diff, predictor, pitch);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_sse2.c b/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_sse2.c
deleted file mode 100644
index 3dfbee3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/encoder/x86/vp8_enc_stubs_sse2.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_config.h"
-#include "vp8_rtcd.h"
-#include "vpx_ports/x86.h"
-#include "vp8/encoder/block.h"
-
-int vp8_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
-int vp8_mbblock_error_xmm(MACROBLOCK *mb, int dc)
-{
- short *coeff_ptr = mb->block[0].coeff;
- short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff;
- return vp8_mbblock_error_xmm_impl(coeff_ptr, dcoef_ptr, dc);
-}
-
-int vp8_mbuverror_xmm_impl(short *s_ptr, short *d_ptr);
-int vp8_mbuverror_xmm(MACROBLOCK *mb)
-{
- short *s_ptr = &mb->coeff[256];
- short *d_ptr = &mb->e_mbd.dqcoeff[256];
- return vp8_mbuverror_xmm_impl(s_ptr, d_ptr);
-}
-
-void vp8_subtract_b_sse2_impl(unsigned char *z, int src_stride,
- short *diff, unsigned char *predictor,
- int pitch);
-void vp8_subtract_b_sse2(BLOCK *be, BLOCKD *bd, int pitch)
-{
- unsigned char *z = *(be->base_src) + be->src;
- unsigned int src_stride = be->src_stride;
- short *diff = &be->src_diff[0];
- unsigned char *predictor = &bd->predictor[0];
- vp8_subtract_b_sse2_impl(z, src_stride, diff, predictor, pitch);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp8/exports_dec b/videocodec/libvpx_internal/libvpx/vp8/exports_dec
deleted file mode 100644
index 100ac5c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/exports_dec
+++ /dev/null
@@ -1,2 +0,0 @@
-data vpx_codec_vp8_dx_algo
-text vpx_codec_vp8_dx
diff --git a/videocodec/libvpx_internal/libvpx/vp8/exports_enc b/videocodec/libvpx_internal/libvpx/vp8/exports_enc
deleted file mode 100644
index 29ff35e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/exports_enc
+++ /dev/null
@@ -1,2 +0,0 @@
-data vpx_codec_vp8_cx_algo
-text vpx_codec_vp8_cx
diff --git a/videocodec/libvpx_internal/libvpx/vp8/vp8_common.mk b/videocodec/libvpx_internal/libvpx/vp8/vp8_common.mk
deleted file mode 100644
index dfb54a5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/vp8_common.mk
+++ /dev/null
@@ -1,192 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-VP8_COMMON_SRCS-yes += vp8_common.mk
-VP8_COMMON_SRCS-yes += common/pragmas.h
-VP8_COMMON_SRCS-yes += common/ppflags.h
-VP8_COMMON_SRCS-yes += common/onyx.h
-VP8_COMMON_SRCS-yes += common/onyxd.h
-VP8_COMMON_SRCS-yes += common/alloccommon.c
-VP8_COMMON_SRCS-yes += common/blockd.c
-VP8_COMMON_SRCS-yes += common/coefupdateprobs.h
-VP8_COMMON_SRCS-yes += common/debugmodes.c
-VP8_COMMON_SRCS-yes += common/default_coef_probs.h
-VP8_COMMON_SRCS-yes += common/dequantize.c
-VP8_COMMON_SRCS-yes += common/entropy.c
-VP8_COMMON_SRCS-yes += common/entropymode.c
-VP8_COMMON_SRCS-yes += common/entropymv.c
-VP8_COMMON_SRCS-yes += common/extend.c
-VP8_COMMON_SRCS-yes += common/filter.c
-VP8_COMMON_SRCS-yes += common/filter.h
-VP8_COMMON_SRCS-yes += common/findnearmv.c
-VP8_COMMON_SRCS-yes += common/generic/systemdependent.c
-VP8_COMMON_SRCS-yes += common/idct_blk.c
-VP8_COMMON_SRCS-yes += common/idctllm.c
-VP8_COMMON_SRCS-yes += common/alloccommon.h
-VP8_COMMON_SRCS-yes += common/blockd.h
-VP8_COMMON_SRCS-yes += common/common.h
-VP8_COMMON_SRCS-yes += common/entropy.h
-VP8_COMMON_SRCS-yes += common/entropymode.h
-VP8_COMMON_SRCS-yes += common/entropymv.h
-VP8_COMMON_SRCS-yes += common/extend.h
-VP8_COMMON_SRCS-yes += common/findnearmv.h
-VP8_COMMON_SRCS-yes += common/header.h
-VP8_COMMON_SRCS-yes += common/invtrans.h
-VP8_COMMON_SRCS-yes += common/loopfilter.h
-VP8_COMMON_SRCS-yes += common/modecont.h
-VP8_COMMON_SRCS-yes += common/mv.h
-VP8_COMMON_SRCS-yes += common/onyxc_int.h
-VP8_COMMON_SRCS-yes += common/quant_common.h
-VP8_COMMON_SRCS-yes += common/reconinter.h
-VP8_COMMON_SRCS-yes += common/reconintra4x4.h
-VP8_COMMON_SRCS-yes += common/rtcd.c
-VP8_COMMON_SRCS-yes += common/rtcd_defs.pl
-VP8_COMMON_SRCS-yes += common/setupintrarecon.h
-VP8_COMMON_SRCS-yes += common/swapyv12buffer.h
-VP8_COMMON_SRCS-yes += common/systemdependent.h
-VP8_COMMON_SRCS-yes += common/threading.h
-VP8_COMMON_SRCS-yes += common/treecoder.h
-VP8_COMMON_SRCS-yes += common/loopfilter.c
-VP8_COMMON_SRCS-yes += common/loopfilter_filters.c
-VP8_COMMON_SRCS-yes += common/mbpitch.c
-VP8_COMMON_SRCS-yes += common/modecont.c
-VP8_COMMON_SRCS-yes += common/quant_common.c
-VP8_COMMON_SRCS-yes += common/reconinter.c
-VP8_COMMON_SRCS-yes += common/reconintra.c
-VP8_COMMON_SRCS-yes += common/reconintra4x4.c
-VP8_COMMON_SRCS-yes += common/sad_c.c
-VP8_COMMON_SRCS-yes += common/setupintrarecon.c
-VP8_COMMON_SRCS-yes += common/swapyv12buffer.c
-VP8_COMMON_SRCS-yes += common/variance_c.c
-VP8_COMMON_SRCS-yes += common/variance.h
-VP8_COMMON_SRCS-yes += common/vp8_entropymodedata.h
-
-
-
-VP8_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER) += common/textblit.c
-VP8_COMMON_SRCS-yes += common/treecoder.c
-
-VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/filter_x86.c
-VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/filter_x86.h
-VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp8_asm_stubs.c
-VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/loopfilter_x86.c
-VP8_COMMON_SRCS-$(CONFIG_POSTPROC) += common/mfqe.c
-VP8_COMMON_SRCS-$(CONFIG_POSTPROC) += common/postproc.h
-VP8_COMMON_SRCS-$(CONFIG_POSTPROC) += common/postproc.c
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/dequantize_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idct_blk_mmx.c
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idctllm_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/iwalsh_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/loopfilter_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/recon_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/sad_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/subpixel_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/variance_mmx.c
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/variance_impl_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/idct_blk_sse2.c
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/idctllm_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/recon_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/recon_wrapper_sse2.c
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/sad_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/subpixel_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/loopfilter_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/iwalsh_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/variance_sse2.c
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/variance_impl_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE3) += common/x86/sad_sse3.asm
-VP8_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/sad_ssse3.asm
-VP8_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/subpixel_ssse3.asm
-VP8_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/variance_ssse3.c
-VP8_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/variance_impl_ssse3.asm
-VP8_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/sad_sse4.asm
-
-ifeq ($(CONFIG_POSTPROC),yes)
-VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/postproc_x86.c
-VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/postproc_mmx.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/mfqe_sse2.asm
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/postproc_sse2.asm
-endif
-
-ifeq ($(ARCH_X86_64),yes)
-VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/loopfilter_block_sse2.asm
-endif
-
-# common (c)
-VP8_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/idctllm_dspr2.c
-VP8_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/filter_dspr2.c
-VP8_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/loopfilter_filters_dspr2.c
-VP8_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/reconinter_dspr2.c
-VP8_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/idct_blk_dspr2.c
-VP8_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/dequantize_dspr2.c
-
-# common (c)
-VP8_COMMON_SRCS-$(ARCH_ARM) += common/arm/filter_arm.c
-VP8_COMMON_SRCS-$(ARCH_ARM) += common/arm/loopfilter_arm.c
-VP8_COMMON_SRCS-$(ARCH_ARM) += common/arm/reconintra_arm.c
-VP8_COMMON_SRCS-$(ARCH_ARM) += common/arm/dequantize_arm.c
-VP8_COMMON_SRCS-$(ARCH_ARM) += common/arm/variance_arm.c
-
-# common (media)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/bilinearfilter_arm.c
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/bilinearfilter_arm.h
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/bilinearfilter_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/copymem8x4_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/copymem8x8_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/copymem16x16_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/dc_only_idct_add_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/iwalsh_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/filter_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/idct_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/loopfilter_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/simpleloopfilter_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/sixtappredict8x4_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/intra4x4_predict_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/dequant_idct_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/dequantize_v6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/idct_blk_v6.c
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/vp8_sad16x16_armv6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/vp8_variance8x8_armv6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/vp8_variance16x16_armv6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/vp8_variance_halfpixvar16x16_h_armv6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/vp8_variance_halfpixvar16x16_v_armv6$(ASM)
-VP8_COMMON_SRCS-$(HAVE_MEDIA) += common/arm/armv6/vp8_variance_halfpixvar16x16_hv_armv6$(ASM)
-
-# common (neon)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/iwalsh_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/loopfilter_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/loopfiltersimplehorizontaledge_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/loopfiltersimpleverticaledge_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/mbloopfilter_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/shortidct4x4llm_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/sad8_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/sad16_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/sixtappredict4x4_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/sixtappredict8x4_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/sixtappredict8x8_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/sixtappredict16x16_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/buildintrapredictorsmby_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/save_reg_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/idct_dequant_full_2x_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/idct_dequant_0_2x_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/idct_blk_neon.c
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/variance_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp8_subpixelvariance8x8_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp8_subpixelvariance16x16_neon$(ASM)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp8_subpixelvariance16x16s_neon$(ASM)
-
-# common (neon intrinsics)
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/bilinearpredict_neon.c
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/copymem_neon.c
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/dc_only_idct_add_neon.c
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/dequant_idct_neon.c
-VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/dequantizeb_neon.c
-
-
-$(eval $(call rtcd_h_template,vp8_rtcd,vp8/common/rtcd_defs.pl))
diff --git a/videocodec/libvpx_internal/libvpx/vp8/vp8_cx_iface.c b/videocodec/libvpx_internal/libvpx/vp8/vp8_cx_iface.c
deleted file mode 100644
index ce0902f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/vp8_cx_iface.c
+++ /dev/null
@@ -1,1316 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp8_rtcd.h"
-#include "vpx/vpx_codec.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "vpx_version.h"
-#include "vp8/encoder/onyx_int.h"
-#include "vpx/vp8cx.h"
-#include "vp8/encoder/firstpass.h"
-#include "vp8/common/onyx.h"
-#include <stdlib.h>
-#include <string.h>
-
-struct vp8_extracfg
-{
- struct vpx_codec_pkt_list *pkt_list;
- int cpu_used; /** available cpu percentage in 1/16*/
- unsigned int enable_auto_alt_ref; /** if encoder decides to uses alternate reference frame */
- unsigned int noise_sensitivity;
- unsigned int Sharpness;
- unsigned int static_thresh;
- unsigned int token_partitions;
- unsigned int arnr_max_frames; /* alt_ref Noise Reduction Max Frame Count */
- unsigned int arnr_strength; /* alt_ref Noise Reduction Strength */
- unsigned int arnr_type; /* alt_ref filter type */
- vp8e_tuning tuning;
- unsigned int cq_level; /* constrained quality level */
- unsigned int rc_max_intra_bitrate_pct;
-
-};
-
-struct extraconfig_map
-{
- int usage;
- struct vp8_extracfg cfg;
-};
-
-static const struct extraconfig_map extracfg_map[] =
-{
- {
- 0,
- {
- NULL,
-#if !(CONFIG_REALTIME_ONLY)
- 0, /* cpu_used */
-#else
- 4, /* cpu_used */
-#endif
- 0, /* enable_auto_alt_ref */
- 0, /* noise_sensitivity */
- 0, /* Sharpness */
- 0, /* static_thresh */
-#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- VP8_EIGHT_TOKENPARTITION,
-#else
- VP8_ONE_TOKENPARTITION, /* token_partitions */
-#endif
- 0, /* arnr_max_frames */
- 3, /* arnr_strength */
- 3, /* arnr_type*/
- 0, /* tuning*/
- 10, /* cq_level */
- 0, /* rc_max_intra_bitrate_pct */
- }
- }
-};
-
-struct vpx_codec_alg_priv
-{
- vpx_codec_priv_t base;
- vpx_codec_enc_cfg_t cfg;
- struct vp8_extracfg vp8_cfg;
- VP8_CONFIG oxcf;
- struct VP8_COMP *cpi;
- unsigned char *cx_data;
- unsigned int cx_data_sz;
- vpx_image_t preview_img;
- unsigned int next_frame_flag;
- vp8_postproc_cfg_t preview_ppcfg;
- /* pkt_list size depends on the maximum number of lagged frames allowed. */
- vpx_codec_pkt_list_decl(64) pkt_list;
- unsigned int fixed_kf_cntr;
-};
-
-
-static vpx_codec_err_t
-update_error_state(vpx_codec_alg_priv_t *ctx,
- const struct vpx_internal_error_info *error)
-{
- vpx_codec_err_t res;
-
- if ((res = error->error_code))
- ctx->base.err_detail = error->has_detail
- ? error->detail
- : NULL;
-
- return res;
-}
-
-
-#undef ERROR
-#define ERROR(str) do {\
- ctx->base.err_detail = str;\
- return VPX_CODEC_INVALID_PARAM;\
- } while(0)
-
-#define RANGE_CHECK(p,memb,lo,hi) do {\
- if(!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \
- ERROR(#memb " out of range ["#lo".."#hi"]");\
- } while(0)
-
-#define RANGE_CHECK_HI(p,memb,hi) do {\
- if(!((p)->memb <= (hi))) \
- ERROR(#memb " out of range [.."#hi"]");\
- } while(0)
-
-#define RANGE_CHECK_LO(p,memb,lo) do {\
- if(!((p)->memb >= (lo))) \
- ERROR(#memb " out of range ["#lo"..]");\
- } while(0)
-
-#define RANGE_CHECK_BOOL(p,memb) do {\
- if(!!((p)->memb) != (p)->memb) ERROR(#memb " expected boolean");\
- } while(0)
-
-static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
- const vpx_codec_enc_cfg_t *cfg,
- const struct vp8_extracfg *vp8_cfg,
- int finalize)
-{
- RANGE_CHECK(cfg, g_w, 1, 16383); /* 14 bits available */
- RANGE_CHECK(cfg, g_h, 1, 16383); /* 14 bits available */
- RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000);
- RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den);
- RANGE_CHECK_HI(cfg, g_profile, 3);
- RANGE_CHECK_HI(cfg, rc_max_quantizer, 63);
- RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer);
- RANGE_CHECK_HI(cfg, g_threads, 64);
-#if CONFIG_REALTIME_ONLY
- RANGE_CHECK_HI(cfg, g_lag_in_frames, 0);
-#elif CONFIG_MULTI_RES_ENCODING
- if (ctx->base.enc.total_encoders > 1)
- RANGE_CHECK_HI(cfg, g_lag_in_frames, 0);
-#else
- RANGE_CHECK_HI(cfg, g_lag_in_frames, 25);
-#endif
- RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q);
- RANGE_CHECK_HI(cfg, rc_undershoot_pct, 1000);
- RANGE_CHECK_HI(cfg, rc_overshoot_pct, 1000);
- RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100);
- RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO);
-
-/* TODO: add spatial re-sampling support and frame dropping in
- * multi-res-encoder.*/
-#if CONFIG_MULTI_RES_ENCODING
- if (ctx->base.enc.total_encoders > 1)
- RANGE_CHECK_HI(cfg, rc_resize_allowed, 0);
-#else
- RANGE_CHECK_BOOL(cfg, rc_resize_allowed);
-#endif
- RANGE_CHECK_HI(cfg, rc_dropframe_thresh, 100);
- RANGE_CHECK_HI(cfg, rc_resize_up_thresh, 100);
- RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100);
-
-#if CONFIG_REALTIME_ONLY
- RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_ONE_PASS);
-#elif CONFIG_MULTI_RES_ENCODING
- if (ctx->base.enc.total_encoders > 1)
- RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_ONE_PASS);
-#else
- RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS);
-#endif
-
- /* VP8 does not support a lower bound on the keyframe interval in
- * automatic keyframe placement mode.
- */
- if (cfg->kf_mode != VPX_KF_DISABLED && cfg->kf_min_dist != cfg->kf_max_dist
- && cfg->kf_min_dist > 0)
- ERROR("kf_min_dist not supported in auto mode, use 0 "
- "or kf_max_dist instead.");
-
- RANGE_CHECK_BOOL(vp8_cfg, enable_auto_alt_ref);
- RANGE_CHECK(vp8_cfg, cpu_used, -16, 16);
-
-#if CONFIG_REALTIME_ONLY && !CONFIG_TEMPORAL_DENOISING
- RANGE_CHECK(vp8_cfg, noise_sensitivity, 0, 0);
-#else
- RANGE_CHECK_HI(vp8_cfg, noise_sensitivity, 6);
-#endif
-
- RANGE_CHECK(vp8_cfg, token_partitions, VP8_ONE_TOKENPARTITION,
- VP8_EIGHT_TOKENPARTITION);
- RANGE_CHECK_HI(vp8_cfg, Sharpness, 7);
- RANGE_CHECK(vp8_cfg, arnr_max_frames, 0, 15);
- RANGE_CHECK_HI(vp8_cfg, arnr_strength, 6);
- RANGE_CHECK(vp8_cfg, arnr_type, 1, 3);
- RANGE_CHECK(vp8_cfg, cq_level, 0, 63);
- if (finalize && (cfg->rc_end_usage == VPX_CQ || cfg->rc_end_usage == VPX_Q))
- RANGE_CHECK(vp8_cfg, cq_level,
- cfg->rc_min_quantizer, cfg->rc_max_quantizer);
-
-#if !(CONFIG_REALTIME_ONLY)
- if (cfg->g_pass == VPX_RC_LAST_PASS)
- {
- size_t packet_sz = sizeof(FIRSTPASS_STATS);
- int n_packets = (int)(cfg->rc_twopass_stats_in.sz /
- packet_sz);
- FIRSTPASS_STATS *stats;
-
- if (!cfg->rc_twopass_stats_in.buf)
- ERROR("rc_twopass_stats_in.buf not set.");
-
- if (cfg->rc_twopass_stats_in.sz % packet_sz)
- ERROR("rc_twopass_stats_in.sz indicates truncated packet.");
-
- if (cfg->rc_twopass_stats_in.sz < 2 * packet_sz)
- ERROR("rc_twopass_stats_in requires at least two packets.");
-
- stats = (void*)((char *)cfg->rc_twopass_stats_in.buf
- + (n_packets - 1) * packet_sz);
-
- if ((int)(stats->count + 0.5) != n_packets - 1)
- ERROR("rc_twopass_stats_in missing EOS stats packet");
- }
-#endif
-
- RANGE_CHECK(cfg, ts_number_layers, 1, 5);
-
- if (cfg->ts_number_layers > 1)
- {
- unsigned int i;
- RANGE_CHECK_HI(cfg, ts_periodicity, 16);
-
- for (i=1; i<cfg->ts_number_layers; i++)
- if (cfg->ts_target_bitrate[i] <= cfg->ts_target_bitrate[i-1])
- ERROR("ts_target_bitrate entries are not strictly increasing");
-
- RANGE_CHECK(cfg, ts_rate_decimator[cfg->ts_number_layers-1], 1, 1);
- for (i=cfg->ts_number_layers-2; i>0; i--)
- if (cfg->ts_rate_decimator[i-1] != 2*cfg->ts_rate_decimator[i])
- ERROR("ts_rate_decimator factors are not powers of 2");
-
- RANGE_CHECK_HI(cfg, ts_layer_id[i], cfg->ts_number_layers-1);
- }
-
-#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
- if(cfg->g_threads > (1 << vp8_cfg->token_partitions))
- ERROR("g_threads cannot be bigger than number of token partitions");
-#endif
-
- return VPX_CODEC_OK;
-}
-
-
-static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx,
- const vpx_image_t *img)
-{
- switch (img->fmt)
- {
- case VPX_IMG_FMT_YV12:
- case VPX_IMG_FMT_I420:
- case VPX_IMG_FMT_VPXI420:
- case VPX_IMG_FMT_VPXYV12:
- break;
- default:
- ERROR("Invalid image format. Only YV12 and I420 images are supported");
- }
-
- if ((img->d_w != ctx->cfg.g_w) || (img->d_h != ctx->cfg.g_h))
- ERROR("Image size must match encoder init configuration size");
-
- return VPX_CODEC_OK;
-}
-
-
-static vpx_codec_err_t set_vp8e_config(VP8_CONFIG *oxcf,
- vpx_codec_enc_cfg_t cfg,
- struct vp8_extracfg vp8_cfg,
- vpx_codec_priv_enc_mr_cfg_t *mr_cfg)
-{
- oxcf->multi_threaded = cfg.g_threads;
- oxcf->Version = cfg.g_profile;
-
- oxcf->Width = cfg.g_w;
- oxcf->Height = cfg.g_h;
- oxcf->timebase = cfg.g_timebase;
-
- oxcf->error_resilient_mode = cfg.g_error_resilient;
-
- (void)mr_cfg;
-
- switch (cfg.g_pass)
- {
- case VPX_RC_ONE_PASS:
- oxcf->Mode = MODE_BESTQUALITY;
- break;
- case VPX_RC_FIRST_PASS:
- oxcf->Mode = MODE_FIRSTPASS;
- break;
- case VPX_RC_LAST_PASS:
- oxcf->Mode = MODE_SECONDPASS_BEST;
- break;
- }
-
- if (cfg.g_pass == VPX_RC_FIRST_PASS || cfg.g_pass == VPX_RC_ONE_PASS)
- {
- oxcf->allow_lag = 0;
- oxcf->lag_in_frames = 0;
- }
- else
- {
- oxcf->allow_lag = (cfg.g_lag_in_frames) > 0;
- oxcf->lag_in_frames = cfg.g_lag_in_frames;
- }
-
- oxcf->allow_df = (cfg.rc_dropframe_thresh > 0);
- oxcf->drop_frames_water_mark = cfg.rc_dropframe_thresh;
-
- oxcf->allow_spatial_resampling = cfg.rc_resize_allowed;
- oxcf->resample_up_water_mark = cfg.rc_resize_up_thresh;
- oxcf->resample_down_water_mark = cfg.rc_resize_down_thresh;
-
- if (cfg.rc_end_usage == VPX_VBR) {
- oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK;
- } else if (cfg.rc_end_usage == VPX_CBR) {
- oxcf->end_usage = USAGE_STREAM_FROM_SERVER;
- } else if (cfg.rc_end_usage == VPX_CQ) {
- oxcf->end_usage = USAGE_CONSTRAINED_QUALITY;
- } else if (cfg.rc_end_usage == VPX_Q) {
- oxcf->end_usage = USAGE_CONSTANT_QUALITY;
- }
-
- oxcf->target_bandwidth = cfg.rc_target_bitrate;
- oxcf->rc_max_intra_bitrate_pct = vp8_cfg.rc_max_intra_bitrate_pct;
-
- oxcf->best_allowed_q = cfg.rc_min_quantizer;
- oxcf->worst_allowed_q = cfg.rc_max_quantizer;
- oxcf->cq_level = vp8_cfg.cq_level;
- oxcf->fixed_q = -1;
-
- oxcf->under_shoot_pct = cfg.rc_undershoot_pct;
- oxcf->over_shoot_pct = cfg.rc_overshoot_pct;
-
- oxcf->maximum_buffer_size_in_ms = cfg.rc_buf_sz;
- oxcf->starting_buffer_level_in_ms = cfg.rc_buf_initial_sz;
- oxcf->optimal_buffer_level_in_ms = cfg.rc_buf_optimal_sz;
-
- oxcf->maximum_buffer_size = cfg.rc_buf_sz;
- oxcf->starting_buffer_level = cfg.rc_buf_initial_sz;
- oxcf->optimal_buffer_level = cfg.rc_buf_optimal_sz;
-
- oxcf->two_pass_vbrbias = cfg.rc_2pass_vbr_bias_pct;
- oxcf->two_pass_vbrmin_section = cfg.rc_2pass_vbr_minsection_pct;
- oxcf->two_pass_vbrmax_section = cfg.rc_2pass_vbr_maxsection_pct;
-
- oxcf->auto_key = cfg.kf_mode == VPX_KF_AUTO
- && cfg.kf_min_dist != cfg.kf_max_dist;
- oxcf->key_freq = cfg.kf_max_dist;
-
- oxcf->number_of_layers = cfg.ts_number_layers;
- oxcf->periodicity = cfg.ts_periodicity;
-
- if (oxcf->number_of_layers > 1)
- {
- memcpy (oxcf->target_bitrate, cfg.ts_target_bitrate,
- sizeof(cfg.ts_target_bitrate));
- memcpy (oxcf->rate_decimator, cfg.ts_rate_decimator,
- sizeof(cfg.ts_rate_decimator));
- memcpy (oxcf->layer_id, cfg.ts_layer_id, sizeof(cfg.ts_layer_id));
- }
-
-#if CONFIG_MULTI_RES_ENCODING
- /* When mr_cfg is NULL, oxcf->mr_total_resolutions and oxcf->mr_encoder_id
- * are both memset to 0, which ensures the correct logic under this
- * situation.
- */
- if(mr_cfg)
- {
- oxcf->mr_total_resolutions = mr_cfg->mr_total_resolutions;
- oxcf->mr_encoder_id = mr_cfg->mr_encoder_id;
- oxcf->mr_down_sampling_factor.num = mr_cfg->mr_down_sampling_factor.num;
- oxcf->mr_down_sampling_factor.den = mr_cfg->mr_down_sampling_factor.den;
- oxcf->mr_low_res_mode_info = mr_cfg->mr_low_res_mode_info;
- }
-#endif
-
- oxcf->cpu_used = vp8_cfg.cpu_used;
- oxcf->encode_breakout = vp8_cfg.static_thresh;
- oxcf->play_alternate = vp8_cfg.enable_auto_alt_ref;
- oxcf->noise_sensitivity = vp8_cfg.noise_sensitivity;
- oxcf->Sharpness = vp8_cfg.Sharpness;
- oxcf->token_partitions = vp8_cfg.token_partitions;
-
- oxcf->two_pass_stats_in = cfg.rc_twopass_stats_in;
- oxcf->output_pkt_list = vp8_cfg.pkt_list;
-
- oxcf->arnr_max_frames = vp8_cfg.arnr_max_frames;
- oxcf->arnr_strength = vp8_cfg.arnr_strength;
- oxcf->arnr_type = vp8_cfg.arnr_type;
-
- oxcf->tuning = vp8_cfg.tuning;
-
- /*
- printf("Current VP8 Settings: \n");
- printf("target_bandwidth: %d\n", oxcf->target_bandwidth);
- printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity);
- printf("Sharpness: %d\n", oxcf->Sharpness);
- printf("cpu_used: %d\n", oxcf->cpu_used);
- printf("Mode: %d\n", oxcf->Mode);
- printf("auto_key: %d\n", oxcf->auto_key);
- printf("key_freq: %d\n", oxcf->key_freq);
- printf("end_usage: %d\n", oxcf->end_usage);
- printf("under_shoot_pct: %d\n", oxcf->under_shoot_pct);
- printf("over_shoot_pct: %d\n", oxcf->over_shoot_pct);
- printf("starting_buffer_level: %d\n", oxcf->starting_buffer_level);
- printf("optimal_buffer_level: %d\n", oxcf->optimal_buffer_level);
- printf("maximum_buffer_size: %d\n", oxcf->maximum_buffer_size);
- printf("fixed_q: %d\n", oxcf->fixed_q);
- printf("worst_allowed_q: %d\n", oxcf->worst_allowed_q);
- printf("best_allowed_q: %d\n", oxcf->best_allowed_q);
- printf("allow_spatial_resampling: %d\n", oxcf->allow_spatial_resampling);
- printf("resample_down_water_mark: %d\n", oxcf->resample_down_water_mark);
- printf("resample_up_water_mark: %d\n", oxcf->resample_up_water_mark);
- printf("allow_df: %d\n", oxcf->allow_df);
- printf("drop_frames_water_mark: %d\n", oxcf->drop_frames_water_mark);
- printf("two_pass_vbrbias: %d\n", oxcf->two_pass_vbrbias);
- printf("two_pass_vbrmin_section: %d\n", oxcf->two_pass_vbrmin_section);
- printf("two_pass_vbrmax_section: %d\n", oxcf->two_pass_vbrmax_section);
- printf("allow_lag: %d\n", oxcf->allow_lag);
- printf("lag_in_frames: %d\n", oxcf->lag_in_frames);
- printf("play_alternate: %d\n", oxcf->play_alternate);
- printf("Version: %d\n", oxcf->Version);
- printf("multi_threaded: %d\n", oxcf->multi_threaded);
- printf("encode_breakout: %d\n", oxcf->encode_breakout);
- */
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp8e_set_config(vpx_codec_alg_priv_t *ctx,
- const vpx_codec_enc_cfg_t *cfg)
-{
- vpx_codec_err_t res;
-
- if (((cfg->g_w != ctx->cfg.g_w) || (cfg->g_h != ctx->cfg.g_h))
- && (cfg->g_lag_in_frames > 1 || cfg->g_pass != VPX_RC_ONE_PASS))
- ERROR("Cannot change width or height after initialization");
-
- /* Prevent increasing lag_in_frames. This check is stricter than it needs
- * to be -- the limit is not increasing past the first lag_in_frames
- * value, but we don't track the initial config, only the last successful
- * config.
- */
- if ((cfg->g_lag_in_frames > ctx->cfg.g_lag_in_frames))
- ERROR("Cannot increase lag_in_frames");
-
- res = validate_config(ctx, cfg, &ctx->vp8_cfg, 0);
-
- if (!res)
- {
- ctx->cfg = *cfg;
- set_vp8e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg, NULL);
- vp8_change_config(ctx->cpi, &ctx->oxcf);
- }
-
- return res;
-}
-
-
-int vp8_reverse_trans(int);
-
-
-static vpx_codec_err_t get_param(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args)
-{
- void *arg = va_arg(args, void *);
-
-#define MAP(id, var) case id: *(RECAST(id, arg)) = var; break
-
- if (!arg)
- return VPX_CODEC_INVALID_PARAM;
-
- switch (ctrl_id)
- {
- MAP(VP8E_GET_LAST_QUANTIZER, vp8_get_quantizer(ctx->cpi));
- MAP(VP8E_GET_LAST_QUANTIZER_64, vp8_reverse_trans(vp8_get_quantizer(ctx->cpi)));
- }
-
- return VPX_CODEC_OK;
-#undef MAP
-}
-
-
-static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
- struct vp8_extracfg xcfg = ctx->vp8_cfg;
-
-#define MAP(id, var) case id: var = CAST(id, args); break;
-
- switch (ctrl_id)
- {
- MAP(VP8E_SET_CPUUSED, xcfg.cpu_used);
- MAP(VP8E_SET_ENABLEAUTOALTREF, xcfg.enable_auto_alt_ref);
- MAP(VP8E_SET_NOISE_SENSITIVITY, xcfg.noise_sensitivity);
- MAP(VP8E_SET_SHARPNESS, xcfg.Sharpness);
- MAP(VP8E_SET_STATIC_THRESHOLD, xcfg.static_thresh);
- MAP(VP8E_SET_TOKEN_PARTITIONS, xcfg.token_partitions);
-
- MAP(VP8E_SET_ARNR_MAXFRAMES, xcfg.arnr_max_frames);
- MAP(VP8E_SET_ARNR_STRENGTH , xcfg.arnr_strength);
- MAP(VP8E_SET_ARNR_TYPE , xcfg.arnr_type);
- MAP(VP8E_SET_TUNING, xcfg.tuning);
- MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level);
- MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct);
-
- }
-
- res = validate_config(ctx, &ctx->cfg, &xcfg, 0);
-
- if (!res)
- {
- ctx->vp8_cfg = xcfg;
- set_vp8e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg, NULL);
- vp8_change_config(ctx->cpi, &ctx->oxcf);
- }
-
- return res;
-#undef MAP
-}
-
-static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg,
- void **mem_loc)
-{
- vpx_codec_err_t res = 0;
- (void)cfg;
- (void)mem_loc;
-#if CONFIG_MULTI_RES_ENCODING
- LOWER_RES_FRAME_INFO *shared_mem_loc;
- int mb_rows = ((cfg->g_w + 15) >>4);
- int mb_cols = ((cfg->g_h + 15) >>4);
-
- shared_mem_loc = calloc(1, sizeof(LOWER_RES_FRAME_INFO));
- if(!shared_mem_loc)
- {
- res = VPX_CODEC_MEM_ERROR;
- }
-
- shared_mem_loc->mb_info = calloc(mb_rows*mb_cols, sizeof(LOWER_RES_MB_INFO));
- if(!(shared_mem_loc->mb_info))
- {
- res = VPX_CODEC_MEM_ERROR;
- }
- else
- {
- *mem_loc = (void *)shared_mem_loc;
- res = VPX_CODEC_OK;
- }
-#endif
- return res;
-}
-
-static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
- vpx_codec_priv_enc_mr_cfg_t *mr_cfg)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
- struct vpx_codec_alg_priv *priv;
- vpx_codec_enc_cfg_t *cfg;
- unsigned int i;
-
- struct VP8_COMP *optr;
-
- vp8_rtcd();
-
- if (!ctx->priv)
- {
- priv = calloc(1, sizeof(struct vpx_codec_alg_priv));
-
- if (!priv)
- {
- return VPX_CODEC_MEM_ERROR;
- }
-
- ctx->priv = &priv->base;
- ctx->priv->sz = sizeof(*ctx->priv);
- ctx->priv->iface = ctx->iface;
- ctx->priv->alg_priv = priv;
- ctx->priv->init_flags = ctx->init_flags;
-
- if (ctx->config.enc)
- {
- /* Update the reference to the config structure to an
- * internal copy.
- */
- ctx->priv->alg_priv->cfg = *ctx->config.enc;
- ctx->config.enc = &ctx->priv->alg_priv->cfg;
- }
-
- cfg = &ctx->priv->alg_priv->cfg;
-
- /* Select the extra vp8 configuration table based on the current
- * usage value. If the current usage value isn't found, use the
- * values for usage case 0.
- */
- for (i = 0;
- extracfg_map[i].usage && extracfg_map[i].usage != (int32_t)cfg->g_usage;
- i++);
-
- priv->vp8_cfg = extracfg_map[i].cfg;
- priv->vp8_cfg.pkt_list = &priv->pkt_list.head;
-
- priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 2;
-
- if (priv->cx_data_sz < 32768) priv->cx_data_sz = 32768;
-
- priv->cx_data = malloc(priv->cx_data_sz);
-
- if (!priv->cx_data)
- {
- return VPX_CODEC_MEM_ERROR;
- }
-
- if(mr_cfg)
- ctx->priv->enc.total_encoders = mr_cfg->mr_total_resolutions;
- else
- ctx->priv->enc.total_encoders = 1;
-
- res = validate_config(priv, &priv->cfg, &priv->vp8_cfg, 0);
-
- if (!res)
- {
- set_vp8e_config(&ctx->priv->alg_priv->oxcf,
- ctx->priv->alg_priv->cfg,
- ctx->priv->alg_priv->vp8_cfg,
- mr_cfg);
-
- optr = vp8_create_compressor(&ctx->priv->alg_priv->oxcf);
-
- if (!optr)
- res = VPX_CODEC_MEM_ERROR;
- else
- ctx->priv->alg_priv->cpi = optr;
- }
- }
-
- return res;
-}
-
-static vpx_codec_err_t vp8e_destroy(vpx_codec_alg_priv_t *ctx)
-{
-#if CONFIG_MULTI_RES_ENCODING
- /* Free multi-encoder shared memory */
- if (ctx->oxcf.mr_total_resolutions > 0 && (ctx->oxcf.mr_encoder_id == ctx->oxcf.mr_total_resolutions-1))
- {
- LOWER_RES_FRAME_INFO *shared_mem_loc = (LOWER_RES_FRAME_INFO *)ctx->oxcf.mr_low_res_mode_info;
- free(shared_mem_loc->mb_info);
- free(ctx->oxcf.mr_low_res_mode_info);
- }
-#endif
-
- free(ctx->cx_data);
- vp8_remove_compressor(&ctx->cpi);
- free(ctx);
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
- YV12_BUFFER_CONFIG *yv12)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
- yv12->y_buffer = img->planes[VPX_PLANE_Y];
- yv12->u_buffer = img->planes[VPX_PLANE_U];
- yv12->v_buffer = img->planes[VPX_PLANE_V];
-
- yv12->y_crop_width = img->d_w;
- yv12->y_crop_height = img->d_h;
- yv12->y_width = img->d_w;
- yv12->y_height = img->d_h;
- yv12->uv_width = (1 + yv12->y_width) / 2;
- yv12->uv_height = (1 + yv12->y_height) / 2;
-
- yv12->y_stride = img->stride[VPX_PLANE_Y];
- yv12->uv_stride = img->stride[VPX_PLANE_U];
-
- yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
- return res;
-}
-
-static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
- unsigned long duration,
- unsigned long deadline)
-{
- unsigned int new_qc;
-
-#if !(CONFIG_REALTIME_ONLY)
- /* Use best quality mode if no deadline is given. */
- new_qc = MODE_BESTQUALITY;
-
- if (deadline)
- {
- uint64_t duration_us;
-
- /* Convert duration parameter from stream timebase to microseconds */
- duration_us = (uint64_t)duration * 1000000
- * (uint64_t)ctx->cfg.g_timebase.num
- / (uint64_t)ctx->cfg.g_timebase.den;
-
- /* If the deadline is more that the duration this frame is to be shown,
- * use good quality mode. Otherwise use realtime mode.
- */
- new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
- }
-
-#else
- new_qc = MODE_REALTIME;
-#endif
-
- if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
- new_qc = MODE_FIRSTPASS;
- else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
- new_qc = (new_qc == MODE_BESTQUALITY)
- ? MODE_SECONDPASS_BEST
- : MODE_SECONDPASS;
-
- if (ctx->oxcf.Mode != (int32_t)new_qc)
- {
- ctx->oxcf.Mode = new_qc;
- vp8_change_config(ctx->cpi, &ctx->oxcf);
- }
-}
-
-
-static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx,
- const vpx_image_t *img,
- vpx_codec_pts_t pts,
- unsigned long duration,
- vpx_enc_frame_flags_t flags,
- unsigned long deadline)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if (!ctx->cfg.rc_target_bitrate)
- return res;
-
- if (img)
- res = validate_img(ctx, img);
-
- if (!res)
- res = validate_config(ctx, &ctx->cfg, &ctx->vp8_cfg, 1);
-
- pick_quickcompress_mode(ctx, duration, deadline);
- vpx_codec_pkt_list_init(&ctx->pkt_list);
-
- /* Handle Flags */
- if (((flags & VP8_EFLAG_NO_UPD_GF) && (flags & VP8_EFLAG_FORCE_GF))
- || ((flags & VP8_EFLAG_NO_UPD_ARF) && (flags & VP8_EFLAG_FORCE_ARF)))
- {
- ctx->base.err_detail = "Conflicting flags.";
- return VPX_CODEC_INVALID_PARAM;
- }
-
- if (flags & (VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF
- | VP8_EFLAG_NO_REF_ARF))
- {
- int ref = 7;
-
- if (flags & VP8_EFLAG_NO_REF_LAST)
- ref ^= VP8_LAST_FRAME;
-
- if (flags & VP8_EFLAG_NO_REF_GF)
- ref ^= VP8_GOLD_FRAME;
-
- if (flags & VP8_EFLAG_NO_REF_ARF)
- ref ^= VP8_ALTR_FRAME;
-
- vp8_use_as_reference(ctx->cpi, ref);
- }
-
- if (flags & (VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF
- | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_FORCE_GF
- | VP8_EFLAG_FORCE_ARF))
- {
- int upd = 7;
-
- if (flags & VP8_EFLAG_NO_UPD_LAST)
- upd ^= VP8_LAST_FRAME;
-
- if (flags & VP8_EFLAG_NO_UPD_GF)
- upd ^= VP8_GOLD_FRAME;
-
- if (flags & VP8_EFLAG_NO_UPD_ARF)
- upd ^= VP8_ALTR_FRAME;
-
- vp8_update_reference(ctx->cpi, upd);
- }
-
- if (flags & VP8_EFLAG_NO_UPD_ENTROPY)
- {
- vp8_update_entropy(ctx->cpi, 0);
- }
-
- /* Handle fixed keyframe intervals */
- if (ctx->cfg.kf_mode == VPX_KF_AUTO
- && ctx->cfg.kf_min_dist == ctx->cfg.kf_max_dist)
- {
- if (++ctx->fixed_kf_cntr > ctx->cfg.kf_min_dist)
- {
- flags |= VPX_EFLAG_FORCE_KF;
- ctx->fixed_kf_cntr = 1;
- }
- }
-
- /* Initialize the encoder instance on the first frame*/
- if (!res && ctx->cpi)
- {
- unsigned int lib_flags;
- YV12_BUFFER_CONFIG sd;
- int64_t dst_time_stamp, dst_end_time_stamp;
- unsigned long size, cx_data_sz;
- unsigned char *cx_data;
- unsigned char *cx_data_end;
- int comp_data_state = 0;
-
- /* Set up internal flags */
- if (ctx->base.init_flags & VPX_CODEC_USE_PSNR)
- ((VP8_COMP *)ctx->cpi)->b_calculate_psnr = 1;
-
- if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION)
- ((VP8_COMP *)ctx->cpi)->output_partition = 1;
-
- /* Convert API flags to internal codec lib flags */
- lib_flags = (flags & VPX_EFLAG_FORCE_KF) ? FRAMEFLAGS_KEY : 0;
-
- /* vp8 use 10,000,000 ticks/second as time stamp */
- dst_time_stamp = pts * 10000000 * ctx->cfg.g_timebase.num / ctx->cfg.g_timebase.den;
- dst_end_time_stamp = (pts + duration) * 10000000 * ctx->cfg.g_timebase.num / ctx->cfg.g_timebase.den;
-
- if (img != NULL)
- {
- res = image2yuvconfig(img, &sd);
-
- if (vp8_receive_raw_frame(ctx->cpi, ctx->next_frame_flag | lib_flags,
- &sd, dst_time_stamp, dst_end_time_stamp))
- {
- VP8_COMP *cpi = (VP8_COMP *)ctx->cpi;
- res = update_error_state(ctx, &cpi->common.error);
- }
-
- /* reset for next frame */
- ctx->next_frame_flag = 0;
- }
-
- cx_data = ctx->cx_data;
- cx_data_sz = ctx->cx_data_sz;
- cx_data_end = ctx->cx_data + cx_data_sz;
- lib_flags = 0;
-
- while (cx_data_sz >= ctx->cx_data_sz / 2)
- {
- comp_data_state = vp8_get_compressed_data(ctx->cpi,
- &lib_flags,
- &size,
- cx_data,
- cx_data_end,
- &dst_time_stamp,
- &dst_end_time_stamp,
- !img);
-
- if(comp_data_state == VPX_CODEC_CORRUPT_FRAME)
- return VPX_CODEC_CORRUPT_FRAME;
- else if(comp_data_state == -1)
- break;
-
- if (size)
- {
- vpx_codec_pts_t round, delta;
- vpx_codec_cx_pkt_t pkt;
- VP8_COMP *cpi = (VP8_COMP *)ctx->cpi;
-
- /* Add the frame packet to the list of returned packets. */
- round = (vpx_codec_pts_t)1000000
- * ctx->cfg.g_timebase.num / 2 - 1;
- delta = (dst_end_time_stamp - dst_time_stamp);
- pkt.kind = VPX_CODEC_CX_FRAME_PKT;
- pkt.data.frame.pts =
- (dst_time_stamp * ctx->cfg.g_timebase.den + round)
- / ctx->cfg.g_timebase.num / 10000000;
- pkt.data.frame.duration = (unsigned long)
- ((delta * ctx->cfg.g_timebase.den + round)
- / ctx->cfg.g_timebase.num / 10000000);
- pkt.data.frame.flags = lib_flags << 16;
-
- if (lib_flags & FRAMEFLAGS_KEY)
- pkt.data.frame.flags |= VPX_FRAME_IS_KEY;
-
- if (!cpi->common.show_frame)
- {
- pkt.data.frame.flags |= VPX_FRAME_IS_INVISIBLE;
-
- /* This timestamp should be as close as possible to the
- * prior PTS so that if a decoder uses pts to schedule when
- * to do this, we start right after last frame was decoded.
- * Invisible frames have no duration.
- */
- pkt.data.frame.pts = ((cpi->last_time_stamp_seen
- * ctx->cfg.g_timebase.den + round)
- / ctx->cfg.g_timebase.num / 10000000) + 1;
- pkt.data.frame.duration = 0;
- }
-
- if (cpi->droppable)
- pkt.data.frame.flags |= VPX_FRAME_IS_DROPPABLE;
-
- if (cpi->output_partition)
- {
- int i;
- const int num_partitions =
- (1 << cpi->common.multi_token_partition) + 1;
-
- pkt.data.frame.flags |= VPX_FRAME_IS_FRAGMENT;
-
- for (i = 0; i < num_partitions; ++i)
- {
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- pkt.data.frame.buf = cpi->partition_d[i];
-#else
- pkt.data.frame.buf = cx_data;
- cx_data += cpi->partition_sz[i];
- cx_data_sz -= cpi->partition_sz[i];
-#endif
- pkt.data.frame.sz = cpi->partition_sz[i];
- pkt.data.frame.partition_id = i;
- /* don't set the fragment bit for the last partition */
- if (i == (num_partitions - 1))
- pkt.data.frame.flags &= ~VPX_FRAME_IS_FRAGMENT;
- vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
- }
-#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
- /* In lagged mode the encoder can buffer multiple frames.
- * We don't want this in partitioned output because
- * partitions are spread all over the output buffer.
- * So, force an exit!
- */
- cx_data_sz -= ctx->cx_data_sz / 2;
-#endif
- }
- else
- {
- pkt.data.frame.buf = cx_data;
- pkt.data.frame.sz = size;
- pkt.data.frame.partition_id = -1;
- vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
- cx_data += size;
- cx_data_sz -= size;
- }
- }
- }
- }
-
- return res;
-}
-
-
-static const vpx_codec_cx_pkt_t *vp8e_get_cxdata(vpx_codec_alg_priv_t *ctx,
- vpx_codec_iter_t *iter)
-{
- return vpx_codec_pkt_list_get(&ctx->pkt_list.head, iter);
-}
-
-static vpx_codec_err_t vp8e_set_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
- vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
- (void)ctr_id;
- if (data)
- {
- vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data;
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
- vp8_set_reference(ctx->cpi, frame->frame_type, &sd);
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-
-}
-
-static vpx_codec_err_t vp8e_get_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
-
- vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
- (void)ctr_id;
- if (data)
- {
- vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data;
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
- vp8_get_reference(ctx->cpi, frame->frame_type, &sd);
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-}
-
-static vpx_codec_err_t vp8e_set_previewpp(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
-#if CONFIG_POSTPROC
- vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *);
- (void)ctr_id;
-
- if (data)
- {
- ctx->preview_ppcfg = *((vp8_postproc_cfg_t *)data);
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-#else
- (void)ctx;
- (void)ctr_id;
- (void)args;
- return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-
-static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx)
-{
-
- YV12_BUFFER_CONFIG sd;
- vp8_ppflags_t flags = {0};
-
- if (ctx->preview_ppcfg.post_proc_flag)
- {
- flags.post_proc_flag = ctx->preview_ppcfg.post_proc_flag;
- flags.deblocking_level = ctx->preview_ppcfg.deblocking_level;
- flags.noise_level = ctx->preview_ppcfg.noise_level;
- }
-
- if (0 == vp8_get_preview_raw_frame(ctx->cpi, &sd, &flags))
- {
-
- /*
- vpx_img_wrap(&ctx->preview_img, VPX_IMG_FMT_YV12,
- sd.y_width + 2*VP8BORDERINPIXELS,
- sd.y_height + 2*VP8BORDERINPIXELS,
- 1,
- sd.buffer_alloc);
- vpx_img_set_rect(&ctx->preview_img,
- VP8BORDERINPIXELS, VP8BORDERINPIXELS,
- sd.y_width, sd.y_height);
- */
-
- ctx->preview_img.bps = 12;
- ctx->preview_img.planes[VPX_PLANE_Y] = sd.y_buffer;
- ctx->preview_img.planes[VPX_PLANE_U] = sd.u_buffer;
- ctx->preview_img.planes[VPX_PLANE_V] = sd.v_buffer;
-
- ctx->preview_img.fmt = VPX_IMG_FMT_I420;
- ctx->preview_img.x_chroma_shift = 1;
- ctx->preview_img.y_chroma_shift = 1;
-
- ctx->preview_img.d_w = sd.y_width;
- ctx->preview_img.d_h = sd.y_height;
- ctx->preview_img.stride[VPX_PLANE_Y] = sd.y_stride;
- ctx->preview_img.stride[VPX_PLANE_U] = sd.uv_stride;
- ctx->preview_img.stride[VPX_PLANE_V] = sd.uv_stride;
- ctx->preview_img.w = sd.y_width;
- ctx->preview_img.h = sd.y_height;
-
- return &ctx->preview_img;
- }
- else
- return NULL;
-}
-
-static vpx_codec_err_t vp8e_update_entropy(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
- int update = va_arg(args, int);
- (void)ctr_id;
- vp8_update_entropy(ctx->cpi, update);
- return VPX_CODEC_OK;
-
-}
-
-static vpx_codec_err_t vp8e_update_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
- int update = va_arg(args, int);
- (void)ctr_id;
- vp8_update_reference(ctx->cpi, update);
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp8e_use_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
- int reference_flag = va_arg(args, int);
- (void)ctr_id;
- vp8_use_as_reference(ctx->cpi, reference_flag);
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp8e_set_roi_map(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
- vpx_roi_map_t *data = va_arg(args, vpx_roi_map_t *);
- (void)ctr_id;
- if (data)
- {
- vpx_roi_map_t *roi = (vpx_roi_map_t *)data;
-
- if (!vp8_set_roimap(ctx->cpi, roi->roi_map, roi->rows, roi->cols, roi->delta_q, roi->delta_lf, roi->static_threshold))
- return VPX_CODEC_OK;
- else
- return VPX_CODEC_INVALID_PARAM;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-}
-
-
-static vpx_codec_err_t vp8e_set_activemap(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
- vpx_active_map_t *data = va_arg(args, vpx_active_map_t *);
- (void)ctr_id;
- if (data)
- {
-
- vpx_active_map_t *map = (vpx_active_map_t *)data;
-
- if (!vp8_set_active_map(ctx->cpi, map->active_map, map->rows, map->cols))
- return VPX_CODEC_OK;
- else
- return VPX_CODEC_INVALID_PARAM;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-}
-
-static vpx_codec_err_t vp8e_set_scalemode(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
-
- vpx_scaling_mode_t *data = va_arg(args, vpx_scaling_mode_t *);
- (void)ctr_id;
- if (data)
- {
- int res;
- vpx_scaling_mode_t scalemode = *(vpx_scaling_mode_t *)data ;
- res = vp8_set_internal_size(ctx->cpi,
- (VPX_SCALING)scalemode.h_scaling_mode,
- (VPX_SCALING)scalemode.v_scaling_mode);
-
- if (!res)
- {
- /*force next frame a key frame to effect scaling mode */
- ctx->next_frame_flag |= FRAMEFLAGS_KEY;
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-}
-
-
-static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] =
-{
- {VP8_SET_REFERENCE, vp8e_set_reference},
- {VP8_COPY_REFERENCE, vp8e_get_reference},
- {VP8_SET_POSTPROC, vp8e_set_previewpp},
- {VP8E_UPD_ENTROPY, vp8e_update_entropy},
- {VP8E_UPD_REFERENCE, vp8e_update_reference},
- {VP8E_USE_REFERENCE, vp8e_use_reference},
- {VP8E_SET_ROI_MAP, vp8e_set_roi_map},
- {VP8E_SET_ACTIVEMAP, vp8e_set_activemap},
- {VP8E_SET_SCALEMODE, vp8e_set_scalemode},
- {VP8E_SET_CPUUSED, set_param},
- {VP8E_SET_NOISE_SENSITIVITY, set_param},
- {VP8E_SET_ENABLEAUTOALTREF, set_param},
- {VP8E_SET_SHARPNESS, set_param},
- {VP8E_SET_STATIC_THRESHOLD, set_param},
- {VP8E_SET_TOKEN_PARTITIONS, set_param},
- {VP8E_GET_LAST_QUANTIZER, get_param},
- {VP8E_GET_LAST_QUANTIZER_64, get_param},
- {VP8E_SET_ARNR_MAXFRAMES, set_param},
- {VP8E_SET_ARNR_STRENGTH , set_param},
- {VP8E_SET_ARNR_TYPE , set_param},
- {VP8E_SET_TUNING, set_param},
- {VP8E_SET_CQ_LEVEL, set_param},
- {VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param},
- { -1, NULL},
-};
-
-static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] =
-{
- {
- 0,
- {
- 0, /* g_usage */
- 0, /* g_threads */
- 0, /* g_profile */
-
- 320, /* g_width */
- 240, /* g_height */
- {1, 30}, /* g_timebase */
-
- 0, /* g_error_resilient */
-
- VPX_RC_ONE_PASS, /* g_pass */
-
- 0, /* g_lag_in_frames */
-
- 0, /* rc_dropframe_thresh */
- 0, /* rc_resize_allowed */
- 60, /* rc_resize_down_thresold */
- 30, /* rc_resize_up_thresold */
-
- VPX_VBR, /* rc_end_usage */
-#if VPX_ENCODER_ABI_VERSION > (1 + VPX_CODEC_ABI_VERSION)
- {0}, /* rc_twopass_stats_in */
-#endif
- 256, /* rc_target_bandwidth */
- 4, /* rc_min_quantizer */
- 63, /* rc_max_quantizer */
- 100, /* rc_undershoot_pct */
- 100, /* rc_overshoot_pct */
-
- 6000, /* rc_max_buffer_size */
- 4000, /* rc_buffer_initial_size; */
- 5000, /* rc_buffer_optimal_size; */
-
- 50, /* rc_two_pass_vbrbias */
- 0, /* rc_two_pass_vbrmin_section */
- 400, /* rc_two_pass_vbrmax_section */
-
- /* keyframing settings (kf) */
- VPX_KF_AUTO, /* g_kfmode*/
- 0, /* kf_min_dist */
- 128, /* kf_max_dist */
-
-#if VPX_ENCODER_ABI_VERSION == (1 + VPX_CODEC_ABI_VERSION)
- "vp8.fpf" /* first pass filename */
-#endif
- VPX_SS_DEFAULT_LAYERS, /* ss_number_layers */
- {0}, /* ss_target_bitrate */
- 1, /* ts_number_layers */
- {0}, /* ts_target_bitrate */
- {0}, /* ts_rate_decimator */
- 0, /* ts_periodicity */
- {0}, /* ts_layer_id */
- }},
- { -1, {NOT_IMPLEMENTED}}
-};
-
-
-#ifndef VERSION_STRING
-#define VERSION_STRING
-#endif
-CODEC_INTERFACE(vpx_codec_vp8_cx) =
-{
- "WebM Project VP8 Encoder" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR |
- VPX_CODEC_CAP_OUTPUT_PARTITION,
- /* vpx_codec_caps_t caps; */
- vp8e_init, /* vpx_codec_init_fn_t init; */
- vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */
- vp8e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
- NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
- NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
- {
- NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */
- NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */
- NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */
- NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */
- NOT_IMPLEMENTED, /*vpx_codec_frame_set_fn_t set_fb_fn*/
- },
- {
- vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */
- vp8e_encode, /* vpx_codec_encode_fn_t encode; */
- vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */
- vp8e_set_config,
- NOT_IMPLEMENTED,
- vp8e_get_preview,
- vp8e_mr_alloc_mem,
- } /* encoder functions */
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp8/vp8_dx_iface.c b/videocodec/libvpx_internal/libvpx/vp8/vp8_dx_iface.c
deleted file mode 100644
index de2e3ce..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/vp8_dx_iface.c
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include "vp8_rtcd.h"
-#include "vpx/vpx_decoder.h"
-#include "vpx/vp8dx.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "vpx_version.h"
-#include "common/onyxd.h"
-#include "decoder/onyxd_int.h"
-#include "common/alloccommon.h"
-#include "vpx_mem/vpx_mem.h"
-#if CONFIG_ERROR_CONCEALMENT
-#include "decoder/error_concealment.h"
-#endif
-#include "decoder/decoderthreading.h"
-
-#define VP8_CAP_POSTPROC (CONFIG_POSTPROC ? VPX_CODEC_CAP_POSTPROC : 0)
-#define VP8_CAP_ERROR_CONCEALMENT (CONFIG_ERROR_CONCEALMENT ? \
- VPX_CODEC_CAP_ERROR_CONCEALMENT : 0)
-
-typedef vpx_codec_stream_info_t vp8_stream_info_t;
-
-/* Structures for handling memory allocations */
-typedef enum
-{
- VP8_SEG_ALG_PRIV = 256,
- VP8_SEG_MAX
-} mem_seg_id_t;
-#define NELEMENTS(x) ((int)(sizeof(x)/sizeof(x[0])))
-
-static unsigned long vp8_priv_sz(const vpx_codec_dec_cfg_t *si, vpx_codec_flags_t);
-
-static const mem_req_t vp8_mem_req_segs[] =
-{
- {VP8_SEG_ALG_PRIV, 0, 8, VPX_CODEC_MEM_ZERO, vp8_priv_sz},
- {VP8_SEG_MAX, 0, 0, 0, NULL}
-};
-
-struct vpx_codec_alg_priv
-{
- vpx_codec_priv_t base;
- vpx_codec_mmap_t mmaps[NELEMENTS(vp8_mem_req_segs)-1];
- vpx_codec_dec_cfg_t cfg;
- vp8_stream_info_t si;
- int defer_alloc;
- int decoder_init;
- int postproc_cfg_set;
- vp8_postproc_cfg_t postproc_cfg;
-#if CONFIG_POSTPROC_VISUALIZER
- unsigned int dbg_postproc_flag;
- int dbg_color_ref_frame_flag;
- int dbg_color_mb_modes_flag;
- int dbg_color_b_modes_flag;
- int dbg_display_mv_flag;
-#endif
- vp8_decrypt_cb *decrypt_cb;
- void *decrypt_state;
- vpx_image_t img;
- int img_setup;
- struct frame_buffers yv12_frame_buffers;
- void *user_priv;
- FRAGMENT_DATA fragments;
-};
-
-static unsigned long vp8_priv_sz(const vpx_codec_dec_cfg_t *si, vpx_codec_flags_t flags)
-{
- /* Although this declaration is constant, we can't use it in the requested
- * segments list because we want to define the requested segments list
- * before defining the private type (so that the number of memory maps is
- * known)
- */
- (void)si;
- (void)flags;
- return sizeof(vpx_codec_alg_priv_t);
-}
-
-static void vp8_init_ctx(vpx_codec_ctx_t *ctx, const vpx_codec_mmap_t *mmap)
-{
- int i;
-
- ctx->priv = mmap->base;
- ctx->priv->sz = sizeof(*ctx->priv);
- ctx->priv->iface = ctx->iface;
- ctx->priv->alg_priv = mmap->base;
-
- for (i = 0; i < NELEMENTS(ctx->priv->alg_priv->mmaps); i++)
- ctx->priv->alg_priv->mmaps[i].id = vp8_mem_req_segs[i].id;
-
- ctx->priv->alg_priv->mmaps[0] = *mmap;
- ctx->priv->alg_priv->si.sz = sizeof(ctx->priv->alg_priv->si);
- ctx->priv->alg_priv->decrypt_cb = NULL;
- ctx->priv->alg_priv->decrypt_state = NULL;
- ctx->priv->init_flags = ctx->init_flags;
-
- if (ctx->config.dec)
- {
- /* Update the reference to the config structure to an internal copy. */
- ctx->priv->alg_priv->cfg = *ctx->config.dec;
- ctx->config.dec = &ctx->priv->alg_priv->cfg;
- }
-}
-
-static void vp8_finalize_mmaps(vpx_codec_alg_priv_t *ctx)
-{
- (void)ctx;
- /* nothing to clean up */
-}
-
-static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx,
- vpx_codec_priv_enc_mr_cfg_t *data)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
- (void) data;
-
- vp8_rtcd();
-
- /* This function only allocates space for the vpx_codec_alg_priv_t
- * structure. More memory may be required at the time the stream
- * information becomes known.
- */
- if (!ctx->priv)
- {
- vpx_codec_mmap_t mmap;
-
- mmap.id = vp8_mem_req_segs[0].id;
- mmap.sz = sizeof(vpx_codec_alg_priv_t);
- mmap.align = vp8_mem_req_segs[0].align;
- mmap.flags = vp8_mem_req_segs[0].flags;
-
- res = vpx_mmap_alloc(&mmap);
- if (res != VPX_CODEC_OK) return res;
-
- vp8_init_ctx(ctx, &mmap);
-
- /* initialize number of fragments to zero */
- ctx->priv->alg_priv->fragments.count = 0;
- /* is input fragments enabled? */
- ctx->priv->alg_priv->fragments.enabled =
- (ctx->priv->alg_priv->base.init_flags &
- VPX_CODEC_USE_INPUT_FRAGMENTS);
-
- ctx->priv->alg_priv->defer_alloc = 1;
- /*post processing level initialized to do nothing */
- }
-
- ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads =
- (ctx->priv->alg_priv->base.init_flags &
- VPX_CODEC_USE_FRAME_THREADING);
-
- /* for now, disable frame threading */
- ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads = 0;
-
- if(ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads &&
- (( ctx->priv->alg_priv->base.init_flags &
- VPX_CODEC_USE_ERROR_CONCEALMENT)
- || ( ctx->priv->alg_priv->base.init_flags &
- VPX_CODEC_USE_INPUT_FRAGMENTS) ) )
- {
- /* row-based threading, error concealment, and input fragments will
- * not be supported when using frame-based threading */
- res = VPX_CODEC_INVALID_PARAM;
- }
-
- return res;
-}
-
-static vpx_codec_err_t vp8_destroy(vpx_codec_alg_priv_t *ctx)
-{
- int i;
-
- vp8_remove_decoder_instances(&ctx->yv12_frame_buffers);
-
- for (i = NELEMENTS(ctx->mmaps) - 1; i >= 0; i--)
- {
- if (ctx->mmaps[i].dtor)
- ctx->mmaps[i].dtor(&ctx->mmaps[i]);
- }
-
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp8_peek_si_internal(const uint8_t *data,
- unsigned int data_sz,
- vpx_codec_stream_info_t *si,
- vp8_decrypt_cb *decrypt_cb,
- void *decrypt_state)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if(data + data_sz <= data)
- {
- res = VPX_CODEC_INVALID_PARAM;
- }
- else
- {
- /* Parse uncompresssed part of key frame header.
- * 3 bytes:- including version, frame type and an offset
- * 3 bytes:- sync code (0x9d, 0x01, 0x2a)
- * 4 bytes:- including image width and height in the lowest 14 bits
- * of each 2-byte value.
- */
- uint8_t clear_buffer[10];
- const uint8_t *clear = data;
- if (decrypt_cb)
- {
- int n = data_sz > 10 ? 10 : data_sz;
- decrypt_cb(decrypt_state, data, clear_buffer, n);
- clear = clear_buffer;
- }
- si->is_kf = 0;
-
- if (data_sz >= 10 && !(clear[0] & 0x01)) /* I-Frame */
- {
- si->is_kf = 1;
-
- /* vet via sync code */
- if (clear[3] != 0x9d || clear[4] != 0x01 || clear[5] != 0x2a)
- res = VPX_CODEC_UNSUP_BITSTREAM;
-
- si->w = (clear[6] | (clear[7] << 8)) & 0x3fff;
- si->h = (clear[8] | (clear[9] << 8)) & 0x3fff;
-
- /*printf("w=%d, h=%d\n", si->w, si->h);*/
- if (!(si->h | si->w))
- res = VPX_CODEC_UNSUP_BITSTREAM;
- }
- else
- {
- res = VPX_CODEC_UNSUP_BITSTREAM;
- }
- }
-
- return res;
-}
-
-static vpx_codec_err_t vp8_peek_si(const uint8_t *data,
- unsigned int data_sz,
- vpx_codec_stream_info_t *si) {
- return vp8_peek_si_internal(data, data_sz, si, NULL, NULL);
-}
-
-static vpx_codec_err_t vp8_get_si(vpx_codec_alg_priv_t *ctx,
- vpx_codec_stream_info_t *si)
-{
-
- unsigned int sz;
-
- if (si->sz >= sizeof(vp8_stream_info_t))
- sz = sizeof(vp8_stream_info_t);
- else
- sz = sizeof(vpx_codec_stream_info_t);
-
- memcpy(si, &ctx->si, sz);
- si->sz = sz;
-
- return VPX_CODEC_OK;
-}
-
-
-static vpx_codec_err_t
-update_error_state(vpx_codec_alg_priv_t *ctx,
- const struct vpx_internal_error_info *error)
-{
- vpx_codec_err_t res;
-
- if ((res = error->error_code))
- ctx->base.err_detail = error->has_detail
- ? error->detail
- : NULL;
-
- return res;
-}
-
-static void yuvconfig2image(vpx_image_t *img,
- const YV12_BUFFER_CONFIG *yv12,
- void *user_priv)
-{
- /** vpx_img_wrap() doesn't allow specifying independent strides for
- * the Y, U, and V planes, nor other alignment adjustments that
- * might be representable by a YV12_BUFFER_CONFIG, so we just
- * initialize all the fields.*/
- img->fmt = VPX_IMG_FMT_I420;
- img->w = yv12->y_stride;
- img->h = (yv12->y_height + 2 * VP8BORDERINPIXELS + 15) & ~15;
- img->d_w = yv12->y_width;
- img->d_h = yv12->y_height;
- img->x_chroma_shift = 1;
- img->y_chroma_shift = 1;
- img->planes[VPX_PLANE_Y] = yv12->y_buffer;
- img->planes[VPX_PLANE_U] = yv12->u_buffer;
- img->planes[VPX_PLANE_V] = yv12->v_buffer;
- img->planes[VPX_PLANE_ALPHA] = NULL;
- img->stride[VPX_PLANE_Y] = yv12->y_stride;
- img->stride[VPX_PLANE_U] = yv12->uv_stride;
- img->stride[VPX_PLANE_V] = yv12->uv_stride;
- img->stride[VPX_PLANE_ALPHA] = yv12->y_stride;
- img->bps = 12;
- img->user_priv = user_priv;
- img->img_data = yv12->buffer_alloc;
- img->img_data_owner = 0;
- img->self_allocd = 0;
-}
-
-static int
-update_fragments(vpx_codec_alg_priv_t *ctx,
- const uint8_t *data,
- unsigned int data_sz,
- vpx_codec_err_t *res)
-{
- *res = VPX_CODEC_OK;
-
- if (ctx->fragments.count == 0)
- {
- /* New frame, reset fragment pointers and sizes */
- vpx_memset((void*)ctx->fragments.ptrs, 0, sizeof(ctx->fragments.ptrs));
- vpx_memset(ctx->fragments.sizes, 0, sizeof(ctx->fragments.sizes));
- }
- if (ctx->fragments.enabled && !(data == NULL && data_sz == 0))
- {
- /* Store a pointer to this fragment and return. We haven't
- * received the complete frame yet, so we will wait with decoding.
- */
- ctx->fragments.ptrs[ctx->fragments.count] = data;
- ctx->fragments.sizes[ctx->fragments.count] = data_sz;
- ctx->fragments.count++;
- if (ctx->fragments.count > (1 << EIGHT_PARTITION) + 1)
- {
- ctx->fragments.count = 0;
- *res = VPX_CODEC_INVALID_PARAM;
- return -1;
- }
- return 0;
- }
-
- if (!ctx->fragments.enabled)
- {
- ctx->fragments.ptrs[0] = data;
- ctx->fragments.sizes[0] = data_sz;
- ctx->fragments.count = 1;
- }
-
- return 1;
-}
-
-static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
- const uint8_t *data,
- unsigned int data_sz,
- void *user_priv,
- long deadline)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
- unsigned int resolution_change = 0;
- unsigned int w, h;
-
-
- /* Update the input fragment data */
- if(update_fragments(ctx, data, data_sz, &res) <= 0)
- return res;
-
- /* Determine the stream parameters. Note that we rely on peek_si to
- * validate that we have a buffer that does not wrap around the top
- * of the heap.
- */
- w = ctx->si.w;
- h = ctx->si.h;
-
- res = vp8_peek_si_internal(ctx->fragments.ptrs[0], ctx->fragments.sizes[0],
- &ctx->si, ctx->decrypt_cb, ctx->decrypt_state);
-
- if((res == VPX_CODEC_UNSUP_BITSTREAM) && !ctx->si.is_kf)
- {
- /* the peek function returns an error for non keyframes, however for
- * this case, it is not an error */
- res = VPX_CODEC_OK;
- }
-
- if(!ctx->decoder_init && !ctx->si.is_kf)
- res = VPX_CODEC_UNSUP_BITSTREAM;
-
- if ((ctx->si.h != h) || (ctx->si.w != w))
- resolution_change = 1;
-
- /* Perform deferred allocations, if required */
- if (!res && ctx->defer_alloc)
- {
- int i;
-
- for (i = 1; !res && i < NELEMENTS(ctx->mmaps); i++)
- {
- vpx_codec_dec_cfg_t cfg;
-
- cfg.w = ctx->si.w;
- cfg.h = ctx->si.h;
- ctx->mmaps[i].id = vp8_mem_req_segs[i].id;
- ctx->mmaps[i].sz = vp8_mem_req_segs[i].sz;
- ctx->mmaps[i].align = vp8_mem_req_segs[i].align;
- ctx->mmaps[i].flags = vp8_mem_req_segs[i].flags;
-
- if (!ctx->mmaps[i].sz)
- ctx->mmaps[i].sz = vp8_mem_req_segs[i].calc_sz(&cfg,
- ctx->base.init_flags);
-
- res = vpx_mmap_alloc(&ctx->mmaps[i]);
- }
-
- if (!res)
- vp8_finalize_mmaps(ctx);
-
- ctx->defer_alloc = 0;
- }
-
- /* Initialize the decoder instance on the first frame*/
- if (!res && !ctx->decoder_init)
- {
- res = vpx_validate_mmaps(&ctx->si, ctx->mmaps,
- vp8_mem_req_segs, NELEMENTS(vp8_mem_req_segs),
- ctx->base.init_flags);
-
- if (!res)
- {
- VP8D_CONFIG oxcf;
-
- oxcf.Width = ctx->si.w;
- oxcf.Height = ctx->si.h;
- oxcf.Version = 9;
- oxcf.postprocess = 0;
- oxcf.max_threads = ctx->cfg.threads;
- oxcf.error_concealment =
- (ctx->base.init_flags & VPX_CODEC_USE_ERROR_CONCEALMENT);
-
- /* If postprocessing was enabled by the application and a
- * configuration has not been provided, default it.
- */
- if (!ctx->postproc_cfg_set
- && (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC))
- {
- ctx->postproc_cfg.post_proc_flag =
- VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE;
- ctx->postproc_cfg.deblocking_level = 4;
- ctx->postproc_cfg.noise_level = 0;
- }
-
- res = vp8_create_decoder_instances(&ctx->yv12_frame_buffers, &oxcf);
- ctx->yv12_frame_buffers.pbi[0]->decrypt_cb = ctx->decrypt_cb;
- ctx->yv12_frame_buffers.pbi[0]->decrypt_state = ctx->decrypt_state;
- }
-
- ctx->decoder_init = 1;
- }
-
- if (!res)
- {
- VP8D_COMP *pbi = ctx->yv12_frame_buffers.pbi[0];
- if(resolution_change)
- {
- VP8_COMMON *const pc = & pbi->common;
- MACROBLOCKD *const xd = & pbi->mb;
-#if CONFIG_MULTITHREAD
- int i;
-#endif
- pc->Width = ctx->si.w;
- pc->Height = ctx->si.h;
- {
- int prev_mb_rows = pc->mb_rows;
-
- if (setjmp(pbi->common.error.jmp))
- {
- pbi->common.error.setjmp = 0;
- /* same return value as used in vp8dx_receive_compressed_data */
- return -1;
- }
-
- pbi->common.error.setjmp = 1;
-
- if (pc->Width <= 0)
- {
- pc->Width = w;
- vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
- "Invalid frame width");
- }
-
- if (pc->Height <= 0)
- {
- pc->Height = h;
- vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
- "Invalid frame height");
- }
-
- if (vp8_alloc_frame_buffers(pc, pc->Width, pc->Height))
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate frame buffers");
-
- xd->pre = pc->yv12_fb[pc->lst_fb_idx];
- xd->dst = pc->yv12_fb[pc->new_fb_idx];
-
-#if CONFIG_MULTITHREAD
- for (i = 0; i < pbi->allocated_decoding_thread_count; i++)
- {
- pbi->mb_row_di[i].mbd.dst = pc->yv12_fb[pc->new_fb_idx];
- vp8_build_block_doffsets(&pbi->mb_row_di[i].mbd);
- }
-#endif
- vp8_build_block_doffsets(&pbi->mb);
-
- /* allocate memory for last frame MODE_INFO array */
-#if CONFIG_ERROR_CONCEALMENT
-
- if (pbi->ec_enabled)
- {
- /* old prev_mip was released by vp8_de_alloc_frame_buffers()
- * called in vp8_alloc_frame_buffers() */
- pc->prev_mip = vpx_calloc(
- (pc->mb_cols + 1) * (pc->mb_rows + 1),
- sizeof(MODE_INFO));
-
- if (!pc->prev_mip)
- {
- vp8_de_alloc_frame_buffers(pc);
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate"
- "last frame MODE_INFO array");
- }
-
- pc->prev_mi = pc->prev_mip + pc->mode_info_stride + 1;
-
- if (vp8_alloc_overlap_lists(pbi))
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate overlap lists "
- "for error concealment");
- }
-
-#endif
-
-#if CONFIG_MULTITHREAD
- if (pbi->b_multithreaded_rd)
- vp8mt_alloc_temp_buffers(pbi, pc->Width, prev_mb_rows);
-#else
- (void)prev_mb_rows;
-#endif
- }
-
- pbi->common.error.setjmp = 0;
-
- /* required to get past the first get_free_fb() call */
- pbi->common.fb_idx_ref_cnt[0] = 0;
- }
-
- /* update the pbi fragment data */
- pbi->fragments = ctx->fragments;
-
- ctx->user_priv = user_priv;
- if (vp8dx_receive_compressed_data(pbi, data_sz, data, deadline))
- {
- res = update_error_state(ctx, &pbi->common.error);
- }
-
- /* get ready for the next series of fragments */
- ctx->fragments.count = 0;
- }
-
- return res;
-}
-
-static vpx_image_t *vp8_get_frame(vpx_codec_alg_priv_t *ctx,
- vpx_codec_iter_t *iter)
-{
- vpx_image_t *img = NULL;
-
- /* iter acts as a flip flop, so an image is only returned on the first
- * call to get_frame.
- */
- if (!(*iter) && ctx->yv12_frame_buffers.pbi[0])
- {
- YV12_BUFFER_CONFIG sd;
- int64_t time_stamp = 0, time_end_stamp = 0;
- vp8_ppflags_t flags = {0};
-
- if (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC)
- {
- flags.post_proc_flag= ctx->postproc_cfg.post_proc_flag
-#if CONFIG_POSTPROC_VISUALIZER
-
- | ((ctx->dbg_color_ref_frame_flag != 0) ? VP8D_DEBUG_CLR_FRM_REF_BLKS : 0)
- | ((ctx->dbg_color_mb_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0)
- | ((ctx->dbg_color_b_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0)
- | ((ctx->dbg_display_mv_flag != 0) ? VP8D_DEBUG_DRAW_MV : 0)
-#endif
- ;
- flags.deblocking_level = ctx->postproc_cfg.deblocking_level;
- flags.noise_level = ctx->postproc_cfg.noise_level;
-#if CONFIG_POSTPROC_VISUALIZER
- flags.display_ref_frame_flag= ctx->dbg_color_ref_frame_flag;
- flags.display_mb_modes_flag = ctx->dbg_color_mb_modes_flag;
- flags.display_b_modes_flag = ctx->dbg_color_b_modes_flag;
- flags.display_mv_flag = ctx->dbg_display_mv_flag;
-#endif
- }
-
- if (0 == vp8dx_get_raw_frame(ctx->yv12_frame_buffers.pbi[0], &sd,
- &time_stamp, &time_end_stamp, &flags))
- {
- yuvconfig2image(&ctx->img, &sd, ctx->user_priv);
-
- img = &ctx->img;
- *iter = img;
- }
- }
-
- return img;
-}
-
-
-static
-vpx_codec_err_t vp8_xma_get_mmap(const vpx_codec_ctx_t *ctx,
- vpx_codec_mmap_t *mmap,
- vpx_codec_iter_t *iter)
-{
- vpx_codec_err_t res;
- const mem_req_t *seg_iter = *iter;
-
- /* Get address of next segment request */
- do
- {
- if (!seg_iter)
- seg_iter = vp8_mem_req_segs;
- else if (seg_iter->id != VP8_SEG_MAX)
- seg_iter++;
-
- *iter = (vpx_codec_iter_t)seg_iter;
-
- if (seg_iter->id != VP8_SEG_MAX)
- {
- mmap->id = seg_iter->id;
- mmap->sz = seg_iter->sz;
- mmap->align = seg_iter->align;
- mmap->flags = seg_iter->flags;
-
- if (!seg_iter->sz)
- mmap->sz = seg_iter->calc_sz(ctx->config.dec, ctx->init_flags);
-
- res = VPX_CODEC_OK;
- }
- else
- res = VPX_CODEC_LIST_END;
- }
- while (!mmap->sz && res != VPX_CODEC_LIST_END);
-
- return res;
-}
-
-static vpx_codec_err_t vp8_xma_set_mmap(vpx_codec_ctx_t *ctx,
- const vpx_codec_mmap_t *mmap)
-{
- vpx_codec_err_t res = VPX_CODEC_MEM_ERROR;
- int i, done;
-
- if (!ctx->priv)
- {
- if (mmap->id == VP8_SEG_ALG_PRIV)
- {
- if (!ctx->priv)
- {
- vp8_init_ctx(ctx, mmap);
- res = VPX_CODEC_OK;
- }
- }
- }
-
- done = 1;
-
- if (!res && ctx->priv->alg_priv)
- {
- for (i = 0; i < NELEMENTS(ctx->priv->alg_priv->mmaps); i++)
- {
- if (ctx->priv->alg_priv->mmaps[i].id == mmap->id)
- if (!ctx->priv->alg_priv->mmaps[i].base)
- {
- ctx->priv->alg_priv->mmaps[i] = *mmap;
- res = VPX_CODEC_OK;
- }
-
- done &= (ctx->priv->alg_priv->mmaps[i].base != NULL);
- }
- }
-
- if (done && !res)
- {
- vp8_finalize_mmaps(ctx->priv->alg_priv);
- res = ctx->iface->init(ctx, NULL);
- }
-
- return res;
-}
-
-static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
- YV12_BUFFER_CONFIG *yv12)
-{
- vpx_codec_err_t res = VPX_CODEC_OK;
- yv12->y_buffer = img->planes[VPX_PLANE_Y];
- yv12->u_buffer = img->planes[VPX_PLANE_U];
- yv12->v_buffer = img->planes[VPX_PLANE_V];
-
- yv12->y_crop_width = img->d_w;
- yv12->y_crop_height = img->d_h;
- yv12->y_width = img->d_w;
- yv12->y_height = img->d_h;
- yv12->uv_width = yv12->y_width / 2;
- yv12->uv_height = yv12->y_height / 2;
-
- yv12->y_stride = img->stride[VPX_PLANE_Y];
- yv12->uv_stride = img->stride[VPX_PLANE_U];
-
- yv12->border = (img->stride[VPX_PLANE_Y] - img->d_w) / 2;
- return res;
-}
-
-
-static vpx_codec_err_t vp8_set_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
-
- vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
- (void)ctr_id;
- if (data && !ctx->yv12_frame_buffers.use_frame_threads)
- {
- vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data;
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
-
- return vp8dx_set_reference(ctx->yv12_frame_buffers.pbi[0],
- frame->frame_type, &sd);
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-
-}
-
-static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
-
- vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
- (void)ctr_id;
- if (data && !ctx->yv12_frame_buffers.use_frame_threads)
- {
- vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data;
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
-
- return vp8dx_get_reference(ctx->yv12_frame_buffers.pbi[0],
- frame->frame_type, &sd);
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-
-}
-
-static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args)
-{
- (void)ctr_id;
-#if CONFIG_POSTPROC
- vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *);
-
- if (data)
- {
- ctx->postproc_cfg_set = 1;
- ctx->postproc_cfg = *((vp8_postproc_cfg_t *)data);
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-
-#else
- return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-static vpx_codec_err_t vp8_set_dbg_options(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args)
-{
-
- (void)ctrl_id;
- (void)ctx;
- (void)args;
-#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
- int data = va_arg(args, int);
-
-#define MAP(id, var) case id: var = data; break;
-
- switch (ctrl_id)
- {
- MAP (VP8_SET_DBG_COLOR_REF_FRAME, ctx->dbg_color_ref_frame_flag);
- MAP (VP8_SET_DBG_COLOR_MB_MODES, ctx->dbg_color_mb_modes_flag);
- MAP (VP8_SET_DBG_COLOR_B_MODES, ctx->dbg_color_b_modes_flag);
- MAP (VP8_SET_DBG_DISPLAY_MV, ctx->dbg_display_mv_flag);
- }
-
- return VPX_CODEC_OK;
-#else
- return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args)
-{
- int *update_info = va_arg(args, int *);
- (void)ctrl_id;
- if (update_info && !ctx->yv12_frame_buffers.use_frame_threads)
- {
- VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0];
-
- *update_info = pbi->common.refresh_alt_ref_frame * (int) VP8_ALTR_FRAME
- + pbi->common.refresh_golden_frame * (int) VP8_GOLD_FRAME
- + pbi->common.refresh_last_frame * (int) VP8_LAST_FRAME;
-
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-}
-
-extern int vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame );
-static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args)
-{
- int *ref_info = va_arg(args, int *);
- (void)ctrl_id;
- if (ref_info && !ctx->yv12_frame_buffers.use_frame_threads)
- {
- VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0];
- VP8_COMMON *oci = &pbi->common;
- *ref_info =
- (vp8dx_references_buffer( oci, ALTREF_FRAME )?VP8_ALTR_FRAME:0) |
- (vp8dx_references_buffer( oci, GOLDEN_FRAME )?VP8_GOLD_FRAME:0) |
- (vp8dx_references_buffer( oci, LAST_FRAME )?VP8_LAST_FRAME:0);
-
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-}
-
-static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args)
-{
-
- int *corrupted = va_arg(args, int *);
- (void)ctrl_id;
- VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0];
-
- if (corrupted && pbi)
- {
- *corrupted = pbi->common.frame_to_show->corrupted;
-
- return VPX_CODEC_OK;
- }
- else
- return VPX_CODEC_INVALID_PARAM;
-
-}
-
-static vpx_codec_err_t vp8_set_decryptor(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args)
-{
- vp8_decrypt_init *init = va_arg(args, vp8_decrypt_init *);
- (void)ctrl_id;
- if (init)
- {
- ctx->decrypt_cb = init->decrypt_cb;
- ctx->decrypt_state = init->decrypt_state;
- }
- else
- {
- ctx->decrypt_cb = NULL;
- ctx->decrypt_state = NULL;
- }
- return VPX_CODEC_OK;
-}
-
-vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] =
-{
- {VP8_SET_REFERENCE, vp8_set_reference},
- {VP8_COPY_REFERENCE, vp8_get_reference},
- {VP8_SET_POSTPROC, vp8_set_postproc},
- {VP8_SET_DBG_COLOR_REF_FRAME, vp8_set_dbg_options},
- {VP8_SET_DBG_COLOR_MB_MODES, vp8_set_dbg_options},
- {VP8_SET_DBG_COLOR_B_MODES, vp8_set_dbg_options},
- {VP8_SET_DBG_DISPLAY_MV, vp8_set_dbg_options},
- {VP8D_GET_LAST_REF_UPDATES, vp8_get_last_ref_updates},
- {VP8D_GET_FRAME_CORRUPTED, vp8_get_frame_corrupted},
- {VP8D_GET_LAST_REF_USED, vp8_get_last_ref_frame},
- {VP8D_SET_DECRYPTOR, vp8_set_decryptor},
- { -1, NULL},
-};
-
-
-#ifndef VERSION_STRING
-#define VERSION_STRING
-#endif
-CODEC_INTERFACE(vpx_codec_vp8_dx) =
-{
- "WebM Project VP8 Decoder" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC | VP8_CAP_ERROR_CONCEALMENT |
- VPX_CODEC_CAP_INPUT_FRAGMENTS,
- /* vpx_codec_caps_t caps; */
- vp8_init, /* vpx_codec_init_fn_t init; */
- vp8_destroy, /* vpx_codec_destroy_fn_t destroy; */
- vp8_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
- vp8_xma_get_mmap, /* vpx_codec_get_mmap_fn_t get_mmap; */
- vp8_xma_set_mmap, /* vpx_codec_set_mmap_fn_t set_mmap; */
- {
- vp8_peek_si, /* vpx_codec_peek_si_fn_t peek_si; */
- vp8_get_si, /* vpx_codec_get_si_fn_t get_si; */
- vp8_decode, /* vpx_codec_decode_fn_t decode; */
- vp8_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */
- NOT_IMPLEMENTED,
- },
- { /* encoder functions */
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- }
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp8/vp8cx.mk b/videocodec/libvpx_internal/libvpx/vp8/vp8cx.mk
deleted file mode 100644
index d7c6dd1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/vp8cx.mk
+++ /dev/null
@@ -1,112 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-VP8_CX_EXPORTS += exports_enc
-
-VP8_CX_SRCS-yes += $(VP8_COMMON_SRCS-yes)
-VP8_CX_SRCS-no += $(VP8_COMMON_SRCS-no)
-VP8_CX_SRCS_REMOVE-yes += $(VP8_COMMON_SRCS_REMOVE-yes)
-VP8_CX_SRCS_REMOVE-no += $(VP8_COMMON_SRCS_REMOVE-no)
-
-ifeq ($(ARCH_ARM),yes)
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx_arm.mk
-endif
-
-VP8_CX_SRCS-yes += vp8cx.mk
-
-VP8_CX_SRCS-yes += vp8_cx_iface.c
-
-VP8_CX_SRCS-yes += encoder/defaultcoefcounts.h
-VP8_CX_SRCS-yes += encoder/bitstream.c
-VP8_CX_SRCS-yes += encoder/boolhuff.c
-VP8_CX_SRCS-yes += encoder/dct.c
-VP8_CX_SRCS-yes += encoder/encodeframe.c
-VP8_CX_SRCS-yes += encoder/encodeframe.h
-VP8_CX_SRCS-yes += encoder/encodeintra.c
-VP8_CX_SRCS-yes += encoder/encodemb.c
-VP8_CX_SRCS-yes += encoder/encodemv.c
-VP8_CX_SRCS-$(CONFIG_MULTITHREAD) += encoder/ethreading.c
-VP8_CX_SRCS-yes += encoder/firstpass.c
-VP8_CX_SRCS-yes += encoder/block.h
-VP8_CX_SRCS-yes += encoder/boolhuff.h
-VP8_CX_SRCS-yes += encoder/bitstream.h
-VP8_CX_SRCS-$(CONFIG_TEMPORAL_DENOISING) += encoder/denoising.h
-VP8_CX_SRCS-$(CONFIG_TEMPORAL_DENOISING) += encoder/denoising.c
-VP8_CX_SRCS-yes += encoder/encodeintra.h
-VP8_CX_SRCS-yes += encoder/encodemb.h
-VP8_CX_SRCS-yes += encoder/encodemv.h
-VP8_CX_SRCS-yes += encoder/firstpass.h
-VP8_CX_SRCS-yes += encoder/lookahead.c
-VP8_CX_SRCS-yes += encoder/lookahead.h
-VP8_CX_SRCS-yes += encoder/mcomp.h
-VP8_CX_SRCS-yes += encoder/modecosts.h
-VP8_CX_SRCS-yes += encoder/onyx_int.h
-VP8_CX_SRCS-yes += encoder/pickinter.h
-VP8_CX_SRCS-yes += encoder/quantize.h
-VP8_CX_SRCS-yes += encoder/ratectrl.h
-VP8_CX_SRCS-yes += encoder/rdopt.h
-VP8_CX_SRCS-yes += encoder/tokenize.h
-VP8_CX_SRCS-yes += encoder/treewriter.h
-VP8_CX_SRCS-yes += encoder/mcomp.c
-VP8_CX_SRCS-yes += encoder/modecosts.c
-VP8_CX_SRCS-yes += encoder/onyx_if.c
-VP8_CX_SRCS-yes += encoder/pickinter.c
-VP8_CX_SRCS-yes += encoder/picklpf.c
-VP8_CX_SRCS-yes += encoder/quantize.c
-VP8_CX_SRCS-yes += encoder/ratectrl.c
-VP8_CX_SRCS-yes += encoder/rdopt.c
-VP8_CX_SRCS-yes += encoder/segmentation.c
-VP8_CX_SRCS-yes += encoder/segmentation.h
-VP8_CX_SRCS-$(CONFIG_INTERNAL_STATS) += encoder/ssim.c
-VP8_CX_SRCS-yes += encoder/tokenize.c
-VP8_CX_SRCS-yes += encoder/dct_value_cost.h
-VP8_CX_SRCS-yes += encoder/dct_value_tokens.h
-VP8_CX_SRCS-yes += encoder/treewriter.c
-VP8_CX_SRCS-$(CONFIG_INTERNAL_STATS) += common/postproc.h
-VP8_CX_SRCS-$(CONFIG_INTERNAL_STATS) += common/postproc.c
-VP8_CX_SRCS-yes += encoder/temporal_filter.c
-VP8_CX_SRCS-$(CONFIG_MULTI_RES_ENCODING) += encoder/mr_dissim.c
-VP8_CX_SRCS-$(CONFIG_MULTI_RES_ENCODING) += encoder/mr_dissim.h
-VP8_CX_SRCS-yes += encoder/vp8_asm_enc_offsets.c
-
-ifeq ($(CONFIG_REALTIME_ONLY),yes)
-VP8_CX_SRCS_REMOVE-yes += encoder/firstpass.c
-VP8_CX_SRCS_REMOVE-yes += encoder/temporal_filter.c
-endif
-
-VP8_CX_SRCS-$(HAVE_MMX) += encoder/x86/dct_mmx.asm
-VP8_CX_SRCS-$(HAVE_MMX) += encoder/x86/subtract_mmx.asm
-VP8_CX_SRCS-$(HAVE_MMX) += encoder/x86/vp8_enc_stubs_mmx.c
-VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_sse2.asm
-VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/fwalsh_sse2.asm
-VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/quantize_sse2.c
-
-ifeq ($(CONFIG_TEMPORAL_DENOISING),yes)
-VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/denoising_sse2.c
-endif
-
-VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/subtract_sse2.asm
-VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/temporal_filter_apply_sse2.asm
-VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp8_enc_stubs_sse2.c
-VP8_CX_SRCS-$(HAVE_SSSE3) += encoder/x86/quantize_ssse3.asm
-VP8_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/quantize_sse4.asm
-VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/quantize_mmx.asm
-VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/encodeopt.asm
-VP8_CX_SRCS-$(ARCH_X86_64) += encoder/x86/ssim_opt.asm
-
-ifeq ($(CONFIG_REALTIME_ONLY),yes)
-VP8_CX_SRCS_REMOVE-$(HAVE_SSE2) += encoder/x86/temporal_filter_apply_sse2.asm
-endif
-
-VP8_CX_SRCS-yes := $(filter-out $(VP8_CX_SRCS_REMOVE-yes),$(VP8_CX_SRCS-yes))
-
-$(eval $(call asm_offsets_template,\
- vp8_asm_enc_offsets.asm, $(VP8_PREFIX)encoder/vp8_asm_enc_offsets.c))
diff --git a/videocodec/libvpx_internal/libvpx/vp8/vp8cx_arm.mk b/videocodec/libvpx_internal/libvpx/vp8/vp8cx_arm.mk
deleted file mode 100644
index 398172a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/vp8cx_arm.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-VP8_CX_SRCS-$(ARCH_ARM) += vp8cx_arm.mk
-
-#File list for arm
-# encoder
-VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/dct_arm.c
-VP8_CX_SRCS-$(ARCH_ARM) += encoder/arm/quantize_arm.c
-
-#File list for edsp
-# encoder
-VP8_CX_SRCS-$(HAVE_EDSP) += encoder/arm/boolhuff_arm.c
-VP8_CX_SRCS_REMOVE-$(HAVE_EDSP) += encoder/boolhuff.c
-VP8_CX_SRCS-$(HAVE_EDSP) += encoder/arm/armv5te/boolhuff_armv5te$(ASM)
-VP8_CX_SRCS-$(HAVE_EDSP) += encoder/arm/armv5te/vp8_packtokens_armv5$(ASM)
-VP8_CX_SRCS-$(HAVE_EDSP) += encoder/arm/armv5te/vp8_packtokens_mbrow_armv5$(ASM)
-VP8_CX_SRCS-$(HAVE_EDSP) += encoder/arm/armv5te/vp8_packtokens_partitions_armv5$(ASM)
-
-#File list for media
-# encoder
-VP8_CX_SRCS-$(HAVE_MEDIA) += encoder/arm/armv6/vp8_subtract_armv6$(ASM)
-VP8_CX_SRCS-$(HAVE_MEDIA) += encoder/arm/armv6/vp8_short_fdct4x4_armv6$(ASM)
-VP8_CX_SRCS-$(HAVE_MEDIA) += encoder/arm/armv6/vp8_fast_quantize_b_armv6$(ASM)
-VP8_CX_SRCS-$(HAVE_MEDIA) += encoder/arm/armv6/vp8_mse16x16_armv6$(ASM)
-VP8_CX_SRCS-$(HAVE_MEDIA) += encoder/arm/armv6/walsh_v6$(ASM)
-
-#File list for neon
-# encoder
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/fastquantizeb_neon$(ASM)
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/picklpf_arm.c
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/denoising_neon.c
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/shortfdct_neon$(ASM)
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/subtract_neon$(ASM)
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/vp8_mse16x16_neon$(ASM)
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/vp8_memcpy_neon$(ASM)
-VP8_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/vp8_shortwalsh4x4_neon$(ASM)
diff --git a/videocodec/libvpx_internal/libvpx/vp8/vp8dx.mk b/videocodec/libvpx_internal/libvpx/vp8/vp8dx.mk
deleted file mode 100644
index 892ed70..0000000
--- a/videocodec/libvpx_internal/libvpx/vp8/vp8dx.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-VP8_DX_EXPORTS += exports_dec
-
-VP8_DX_SRCS-yes += $(VP8_COMMON_SRCS-yes)
-VP8_DX_SRCS-no += $(VP8_COMMON_SRCS-no)
-VP8_DX_SRCS_REMOVE-yes += $(VP8_COMMON_SRCS_REMOVE-yes)
-VP8_DX_SRCS_REMOVE-no += $(VP8_COMMON_SRCS_REMOVE-no)
-
-VP8_DX_SRCS-yes += vp8dx.mk
-
-VP8_DX_SRCS-yes += vp8_dx_iface.c
-
-VP8_DX_SRCS-yes += decoder/dboolhuff.c
-VP8_DX_SRCS-yes += decoder/decodemv.c
-VP8_DX_SRCS-yes += decoder/decodeframe.c
-VP8_DX_SRCS-yes += decoder/detokenize.c
-VP8_DX_SRCS-$(CONFIG_ERROR_CONCEALMENT) += decoder/ec_types.h
-VP8_DX_SRCS-$(CONFIG_ERROR_CONCEALMENT) += decoder/error_concealment.h
-VP8_DX_SRCS-$(CONFIG_ERROR_CONCEALMENT) += decoder/error_concealment.c
-VP8_DX_SRCS-yes += decoder/dboolhuff.h
-VP8_DX_SRCS-yes += decoder/decodemv.h
-VP8_DX_SRCS-yes += decoder/decoderthreading.h
-VP8_DX_SRCS-yes += decoder/detokenize.h
-VP8_DX_SRCS-yes += decoder/onyxd_int.h
-VP8_DX_SRCS-yes += decoder/treereader.h
-VP8_DX_SRCS-yes += decoder/onyxd_if.c
-VP8_DX_SRCS-$(CONFIG_MULTITHREAD) += decoder/threading.c
-
-VP8_DX_SRCS-yes := $(filter-out $(VP8_DX_SRCS_REMOVE-yes),$(VP8_DX_SRCS-yes))
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_avg_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_avg_neon.asm
deleted file mode 100644
index 7d24530..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_avg_neon.asm
+++ /dev/null
@@ -1,116 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_convolve_avg_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-|vp9_convolve_avg_neon| PROC
- push {r4-r6, lr}
- ldrd r4, r5, [sp, #32]
- mov r6, r2
-
- cmp r4, #32
- bgt avg64
- beq avg32
- cmp r4, #8
- bgt avg16
- beq avg8
- b avg4
-
-avg64
- sub lr, r1, #32
- sub r4, r3, #32
-avg64_h
- pld [r0, r1, lsl #1]
- vld1.8 {q0-q1}, [r0]!
- vld1.8 {q2-q3}, [r0], lr
- pld [r2, r3]
- vld1.8 {q8-q9}, [r6@128]!
- vld1.8 {q10-q11}, [r6@128], r4
- vrhadd.u8 q0, q0, q8
- vrhadd.u8 q1, q1, q9
- vrhadd.u8 q2, q2, q10
- vrhadd.u8 q3, q3, q11
- vst1.8 {q0-q1}, [r2@128]!
- vst1.8 {q2-q3}, [r2@128], r4
- subs r5, r5, #1
- bgt avg64_h
- pop {r4-r6, pc}
-
-avg32
- vld1.8 {q0-q1}, [r0], r1
- vld1.8 {q2-q3}, [r0], r1
- vld1.8 {q8-q9}, [r6@128], r3
- vld1.8 {q10-q11}, [r6@128], r3
- pld [r0]
- vrhadd.u8 q0, q0, q8
- pld [r0, r1]
- vrhadd.u8 q1, q1, q9
- pld [r6]
- vrhadd.u8 q2, q2, q10
- pld [r6, r3]
- vrhadd.u8 q3, q3, q11
- vst1.8 {q0-q1}, [r2@128], r3
- vst1.8 {q2-q3}, [r2@128], r3
- subs r5, r5, #2
- bgt avg32
- pop {r4-r6, pc}
-
-avg16
- vld1.8 {q0}, [r0], r1
- vld1.8 {q1}, [r0], r1
- vld1.8 {q2}, [r6@128], r3
- vld1.8 {q3}, [r6@128], r3
- pld [r0]
- pld [r0, r1]
- vrhadd.u8 q0, q0, q2
- pld [r6]
- pld [r6, r3]
- vrhadd.u8 q1, q1, q3
- vst1.8 {q0}, [r2@128], r3
- vst1.8 {q1}, [r2@128], r3
- subs r5, r5, #2
- bgt avg16
- pop {r4-r6, pc}
-
-avg8
- vld1.8 {d0}, [r0], r1
- vld1.8 {d1}, [r0], r1
- vld1.8 {d2}, [r6@64], r3
- vld1.8 {d3}, [r6@64], r3
- pld [r0]
- pld [r0, r1]
- vrhadd.u8 q0, q0, q1
- pld [r6]
- pld [r6, r3]
- vst1.8 {d0}, [r2@64], r3
- vst1.8 {d1}, [r2@64], r3
- subs r5, r5, #2
- bgt avg8
- pop {r4-r6, pc}
-
-avg4
- vld1.32 {d0[0]}, [r0], r1
- vld1.32 {d0[1]}, [r0], r1
- vld1.32 {d2[0]}, [r6@32], r3
- vld1.32 {d2[1]}, [r6@32], r3
- vrhadd.u8 d0, d0, d2
- vst1.32 {d0[0]}, [r2@32], r3
- vst1.32 {d0[1]}, [r2@32], r3
- subs r5, r5, #2
- bgt avg4
- pop {r4-r6, pc}
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_avg_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_avg_neon.asm
deleted file mode 100644
index 6b20cb9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_avg_neon.asm
+++ /dev/null
@@ -1,302 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- ; These functions are only valid when:
- ; x_step_q4 == 16
- ; w%4 == 0
- ; h%4 == 0
- ; taps == 8
- ; VP9_FILTER_WEIGHT == 128
- ; VP9_FILTER_SHIFT == 7
-
- EXPORT |vp9_convolve8_avg_horiz_neon|
- EXPORT |vp9_convolve8_avg_vert_neon|
- IMPORT |vp9_convolve8_avg_horiz_c|
- IMPORT |vp9_convolve8_avg_vert_c|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- ; Multiply and accumulate by q0
- MACRO
- MULTIPLY_BY_Q0 $dst, $src0, $src1, $src2, $src3, $src4, $src5, $src6, $src7
- vmull.s16 $dst, $src0, d0[0]
- vmlal.s16 $dst, $src1, d0[1]
- vmlal.s16 $dst, $src2, d0[2]
- vmlal.s16 $dst, $src3, d0[3]
- vmlal.s16 $dst, $src4, d1[0]
- vmlal.s16 $dst, $src5, d1[1]
- vmlal.s16 $dst, $src6, d1[2]
- vmlal.s16 $dst, $src7, d1[3]
- MEND
-
-; r0 const uint8_t *src
-; r1 int src_stride
-; r2 uint8_t *dst
-; r3 int dst_stride
-; sp[]const int16_t *filter_x
-; sp[]int x_step_q4
-; sp[]const int16_t *filter_y ; unused
-; sp[]int y_step_q4 ; unused
-; sp[]int w
-; sp[]int h
-
-|vp9_convolve8_avg_horiz_neon| PROC
- ldr r12, [sp, #4] ; x_step_q4
- cmp r12, #16
- bne vp9_convolve8_avg_horiz_c
-
- push {r4-r10, lr}
-
- sub r0, r0, #3 ; adjust for taps
-
- ldr r5, [sp, #32] ; filter_x
- ldr r6, [sp, #48] ; w
- ldr r7, [sp, #52] ; h
-
- vld1.s16 {q0}, [r5] ; filter_x
-
- sub r8, r1, r1, lsl #2 ; -src_stride * 3
- add r8, r8, #4 ; -src_stride * 3 + 4
-
- sub r4, r3, r3, lsl #2 ; -dst_stride * 3
- add r4, r4, #4 ; -dst_stride * 3 + 4
-
- rsb r9, r6, r1, lsl #2 ; reset src for outer loop
- sub r9, r9, #7
- rsb r12, r6, r3, lsl #2 ; reset dst for outer loop
-
- mov r10, r6 ; w loop counter
-
-loop_horiz_v
- vld1.8 {d24}, [r0], r1
- vld1.8 {d25}, [r0], r1
- vld1.8 {d26}, [r0], r1
- vld1.8 {d27}, [r0], r8
-
- vtrn.16 q12, q13
- vtrn.8 d24, d25
- vtrn.8 d26, d27
-
- pld [r0, r1, lsl #2]
-
- vmovl.u8 q8, d24
- vmovl.u8 q9, d25
- vmovl.u8 q10, d26
- vmovl.u8 q11, d27
-
- ; save a few instructions in the inner loop
- vswp d17, d18
- vmov d23, d21
-
- add r0, r0, #3
-
-loop_horiz
- add r5, r0, #64
-
- vld1.32 {d28[]}, [r0], r1
- vld1.32 {d29[]}, [r0], r1
- vld1.32 {d31[]}, [r0], r1
- vld1.32 {d30[]}, [r0], r8
-
- pld [r5]
-
- vtrn.16 d28, d31
- vtrn.16 d29, d30
- vtrn.8 d28, d29
- vtrn.8 d31, d30
-
- pld [r5, r1]
-
- ; extract to s16
- vtrn.32 q14, q15
- vmovl.u8 q12, d28
- vmovl.u8 q13, d29
-
- pld [r5, r1, lsl #1]
-
- ; slightly out of order load to match the existing data
- vld1.u32 {d6[0]}, [r2], r3
- vld1.u32 {d7[0]}, [r2], r3
- vld1.u32 {d6[1]}, [r2], r3
- vld1.u32 {d7[1]}, [r2], r3
-
- sub r2, r2, r3, lsl #2 ; reset for store
-
- ; src[] * filter_x
- MULTIPLY_BY_Q0 q1, d16, d17, d20, d22, d18, d19, d23, d24
- MULTIPLY_BY_Q0 q2, d17, d20, d22, d18, d19, d23, d24, d26
- MULTIPLY_BY_Q0 q14, d20, d22, d18, d19, d23, d24, d26, d27
- MULTIPLY_BY_Q0 q15, d22, d18, d19, d23, d24, d26, d27, d25
-
- pld [r5, -r8]
-
- ; += 64 >> 7
- vqrshrun.s32 d2, q1, #7
- vqrshrun.s32 d3, q2, #7
- vqrshrun.s32 d4, q14, #7
- vqrshrun.s32 d5, q15, #7
-
- ; saturate
- vqmovn.u16 d2, q1
- vqmovn.u16 d3, q2
-
- ; transpose
- vtrn.16 d2, d3
- vtrn.32 d2, d3
- vtrn.8 d2, d3
-
- ; average the new value and the dst value
- vrhadd.u8 q1, q1, q3
-
- vst1.u32 {d2[0]}, [r2@32], r3
- vst1.u32 {d3[0]}, [r2@32], r3
- vst1.u32 {d2[1]}, [r2@32], r3
- vst1.u32 {d3[1]}, [r2@32], r4
-
- vmov q8, q9
- vmov d20, d23
- vmov q11, q12
- vmov q9, q13
-
- subs r6, r6, #4 ; w -= 4
- bgt loop_horiz
-
- ; outer loop
- mov r6, r10 ; restore w counter
- add r0, r0, r9 ; src += src_stride * 4 - w
- add r2, r2, r12 ; dst += dst_stride * 4 - w
- subs r7, r7, #4 ; h -= 4
- bgt loop_horiz_v
-
- pop {r4-r10, pc}
-
- ENDP
-
-|vp9_convolve8_avg_vert_neon| PROC
- ldr r12, [sp, #12]
- cmp r12, #16
- bne vp9_convolve8_avg_vert_c
-
- push {r4-r8, lr}
-
- ; adjust for taps
- sub r0, r0, r1
- sub r0, r0, r1, lsl #1
-
- ldr r4, [sp, #32] ; filter_y
- ldr r6, [sp, #40] ; w
- ldr lr, [sp, #44] ; h
-
- vld1.s16 {q0}, [r4] ; filter_y
-
- lsl r1, r1, #1
- lsl r3, r3, #1
-
-loop_vert_h
- mov r4, r0
- add r7, r0, r1, asr #1
- mov r5, r2
- add r8, r2, r3, asr #1
- mov r12, lr ; h loop counter
-
- vld1.u32 {d16[0]}, [r4], r1
- vld1.u32 {d16[1]}, [r7], r1
- vld1.u32 {d18[0]}, [r4], r1
- vld1.u32 {d18[1]}, [r7], r1
- vld1.u32 {d20[0]}, [r4], r1
- vld1.u32 {d20[1]}, [r7], r1
- vld1.u32 {d22[0]}, [r4], r1
-
- vmovl.u8 q8, d16
- vmovl.u8 q9, d18
- vmovl.u8 q10, d20
- vmovl.u8 q11, d22
-
-loop_vert
- ; always process a 4x4 block at a time
- vld1.u32 {d24[0]}, [r7], r1
- vld1.u32 {d26[0]}, [r4], r1
- vld1.u32 {d26[1]}, [r7], r1
- vld1.u32 {d24[1]}, [r4], r1
-
- ; extract to s16
- vmovl.u8 q12, d24
- vmovl.u8 q13, d26
-
- vld1.u32 {d6[0]}, [r5@32], r3
- vld1.u32 {d6[1]}, [r8@32], r3
- vld1.u32 {d7[0]}, [r5@32], r3
- vld1.u32 {d7[1]}, [r8@32], r3
-
- pld [r7]
- pld [r4]
-
- ; src[] * filter_y
- MULTIPLY_BY_Q0 q1, d16, d17, d18, d19, d20, d21, d22, d24
-
- pld [r7, r1]
- pld [r4, r1]
-
- MULTIPLY_BY_Q0 q2, d17, d18, d19, d20, d21, d22, d24, d26
-
- pld [r5]
- pld [r8]
-
- MULTIPLY_BY_Q0 q14, d18, d19, d20, d21, d22, d24, d26, d27
-
- pld [r5, r3]
- pld [r8, r3]
-
- MULTIPLY_BY_Q0 q15, d19, d20, d21, d22, d24, d26, d27, d25
-
- ; += 64 >> 7
- vqrshrun.s32 d2, q1, #7
- vqrshrun.s32 d3, q2, #7
- vqrshrun.s32 d4, q14, #7
- vqrshrun.s32 d5, q15, #7
-
- ; saturate
- vqmovn.u16 d2, q1
- vqmovn.u16 d3, q2
-
- ; average the new value and the dst value
- vrhadd.u8 q1, q1, q3
-
- sub r5, r5, r3, lsl #1 ; reset for store
- sub r8, r8, r3, lsl #1
-
- vst1.u32 {d2[0]}, [r5@32], r3
- vst1.u32 {d2[1]}, [r8@32], r3
- vst1.u32 {d3[0]}, [r5@32], r3
- vst1.u32 {d3[1]}, [r8@32], r3
-
- vmov q8, q10
- vmov d18, d22
- vmov d19, d24
- vmov q10, q13
- vmov d22, d25
-
- subs r12, r12, #4 ; h -= 4
- bgt loop_vert
-
- ; outer loop
- add r0, r0, #4
- add r2, r2, #4
- subs r6, r6, #4 ; w -= 4
- bgt loop_vert_h
-
- pop {r4-r8, pc}
-
- ENDP
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_neon.asm
deleted file mode 100644
index 4525845..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve8_neon.asm
+++ /dev/null
@@ -1,280 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- ; These functions are only valid when:
- ; x_step_q4 == 16
- ; w%4 == 0
- ; h%4 == 0
- ; taps == 8
- ; VP9_FILTER_WEIGHT == 128
- ; VP9_FILTER_SHIFT == 7
-
- EXPORT |vp9_convolve8_horiz_neon|
- EXPORT |vp9_convolve8_vert_neon|
- IMPORT |vp9_convolve8_horiz_c|
- IMPORT |vp9_convolve8_vert_c|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- ; Multiply and accumulate by q0
- MACRO
- MULTIPLY_BY_Q0 $dst, $src0, $src1, $src2, $src3, $src4, $src5, $src6, $src7
- vmull.s16 $dst, $src0, d0[0]
- vmlal.s16 $dst, $src1, d0[1]
- vmlal.s16 $dst, $src2, d0[2]
- vmlal.s16 $dst, $src3, d0[3]
- vmlal.s16 $dst, $src4, d1[0]
- vmlal.s16 $dst, $src5, d1[1]
- vmlal.s16 $dst, $src6, d1[2]
- vmlal.s16 $dst, $src7, d1[3]
- MEND
-
-; r0 const uint8_t *src
-; r1 int src_stride
-; r2 uint8_t *dst
-; r3 int dst_stride
-; sp[]const int16_t *filter_x
-; sp[]int x_step_q4
-; sp[]const int16_t *filter_y ; unused
-; sp[]int y_step_q4 ; unused
-; sp[]int w
-; sp[]int h
-
-|vp9_convolve8_horiz_neon| PROC
- ldr r12, [sp, #4] ; x_step_q4
- cmp r12, #16
- bne vp9_convolve8_horiz_c
-
- push {r4-r10, lr}
-
- sub r0, r0, #3 ; adjust for taps
-
- ldr r5, [sp, #32] ; filter_x
- ldr r6, [sp, #48] ; w
- ldr r7, [sp, #52] ; h
-
- vld1.s16 {q0}, [r5] ; filter_x
-
- sub r8, r1, r1, lsl #2 ; -src_stride * 3
- add r8, r8, #4 ; -src_stride * 3 + 4
-
- sub r4, r3, r3, lsl #2 ; -dst_stride * 3
- add r4, r4, #4 ; -dst_stride * 3 + 4
-
- rsb r9, r6, r1, lsl #2 ; reset src for outer loop
- sub r9, r9, #7
- rsb r12, r6, r3, lsl #2 ; reset dst for outer loop
-
- mov r10, r6 ; w loop counter
-
-loop_horiz_v
- vld1.8 {d24}, [r0], r1
- vld1.8 {d25}, [r0], r1
- vld1.8 {d26}, [r0], r1
- vld1.8 {d27}, [r0], r8
-
- vtrn.16 q12, q13
- vtrn.8 d24, d25
- vtrn.8 d26, d27
-
- pld [r0, r1, lsl #2]
-
- vmovl.u8 q8, d24
- vmovl.u8 q9, d25
- vmovl.u8 q10, d26
- vmovl.u8 q11, d27
-
- ; save a few instructions in the inner loop
- vswp d17, d18
- vmov d23, d21
-
- add r0, r0, #3
-
-loop_horiz
- add r5, r0, #64
-
- vld1.32 {d28[]}, [r0], r1
- vld1.32 {d29[]}, [r0], r1
- vld1.32 {d31[]}, [r0], r1
- vld1.32 {d30[]}, [r0], r8
-
- pld [r5]
-
- vtrn.16 d28, d31
- vtrn.16 d29, d30
- vtrn.8 d28, d29
- vtrn.8 d31, d30
-
- pld [r5, r1]
-
- ; extract to s16
- vtrn.32 q14, q15
- vmovl.u8 q12, d28
- vmovl.u8 q13, d29
-
- pld [r5, r1, lsl #1]
-
- ; src[] * filter_x
- MULTIPLY_BY_Q0 q1, d16, d17, d20, d22, d18, d19, d23, d24
- MULTIPLY_BY_Q0 q2, d17, d20, d22, d18, d19, d23, d24, d26
- MULTIPLY_BY_Q0 q14, d20, d22, d18, d19, d23, d24, d26, d27
- MULTIPLY_BY_Q0 q15, d22, d18, d19, d23, d24, d26, d27, d25
-
- pld [r5, -r8]
-
- ; += 64 >> 7
- vqrshrun.s32 d2, q1, #7
- vqrshrun.s32 d3, q2, #7
- vqrshrun.s32 d4, q14, #7
- vqrshrun.s32 d5, q15, #7
-
- ; saturate
- vqmovn.u16 d2, q1
- vqmovn.u16 d3, q2
-
- ; transpose
- vtrn.16 d2, d3
- vtrn.32 d2, d3
- vtrn.8 d2, d3
-
- vst1.u32 {d2[0]}, [r2@32], r3
- vst1.u32 {d3[0]}, [r2@32], r3
- vst1.u32 {d2[1]}, [r2@32], r3
- vst1.u32 {d3[1]}, [r2@32], r4
-
- vmov q8, q9
- vmov d20, d23
- vmov q11, q12
- vmov q9, q13
-
- subs r6, r6, #4 ; w -= 4
- bgt loop_horiz
-
- ; outer loop
- mov r6, r10 ; restore w counter
- add r0, r0, r9 ; src += src_stride * 4 - w
- add r2, r2, r12 ; dst += dst_stride * 4 - w
- subs r7, r7, #4 ; h -= 4
- bgt loop_horiz_v
-
- pop {r4-r10, pc}
-
- ENDP
-
-|vp9_convolve8_vert_neon| PROC
- ldr r12, [sp, #12]
- cmp r12, #16
- bne vp9_convolve8_vert_c
-
- push {r4-r8, lr}
-
- ; adjust for taps
- sub r0, r0, r1
- sub r0, r0, r1, lsl #1
-
- ldr r4, [sp, #32] ; filter_y
- ldr r6, [sp, #40] ; w
- ldr lr, [sp, #44] ; h
-
- vld1.s16 {q0}, [r4] ; filter_y
-
- lsl r1, r1, #1
- lsl r3, r3, #1
-
-loop_vert_h
- mov r4, r0
- add r7, r0, r1, asr #1
- mov r5, r2
- add r8, r2, r3, asr #1
- mov r12, lr ; h loop counter
-
- vld1.u32 {d16[0]}, [r4], r1
- vld1.u32 {d16[1]}, [r7], r1
- vld1.u32 {d18[0]}, [r4], r1
- vld1.u32 {d18[1]}, [r7], r1
- vld1.u32 {d20[0]}, [r4], r1
- vld1.u32 {d20[1]}, [r7], r1
- vld1.u32 {d22[0]}, [r4], r1
-
- vmovl.u8 q8, d16
- vmovl.u8 q9, d18
- vmovl.u8 q10, d20
- vmovl.u8 q11, d22
-
-loop_vert
- ; always process a 4x4 block at a time
- vld1.u32 {d24[0]}, [r7], r1
- vld1.u32 {d26[0]}, [r4], r1
- vld1.u32 {d26[1]}, [r7], r1
- vld1.u32 {d24[1]}, [r4], r1
-
- ; extract to s16
- vmovl.u8 q12, d24
- vmovl.u8 q13, d26
-
- pld [r5]
- pld [r8]
-
- ; src[] * filter_y
- MULTIPLY_BY_Q0 q1, d16, d17, d18, d19, d20, d21, d22, d24
-
- pld [r5, r3]
- pld [r8, r3]
-
- MULTIPLY_BY_Q0 q2, d17, d18, d19, d20, d21, d22, d24, d26
-
- pld [r7]
- pld [r4]
-
- MULTIPLY_BY_Q0 q14, d18, d19, d20, d21, d22, d24, d26, d27
-
- pld [r7, r1]
- pld [r4, r1]
-
- MULTIPLY_BY_Q0 q15, d19, d20, d21, d22, d24, d26, d27, d25
-
- ; += 64 >> 7
- vqrshrun.s32 d2, q1, #7
- vqrshrun.s32 d3, q2, #7
- vqrshrun.s32 d4, q14, #7
- vqrshrun.s32 d5, q15, #7
-
- ; saturate
- vqmovn.u16 d2, q1
- vqmovn.u16 d3, q2
-
- vst1.u32 {d2[0]}, [r5@32], r3
- vst1.u32 {d2[1]}, [r8@32], r3
- vst1.u32 {d3[0]}, [r5@32], r3
- vst1.u32 {d3[1]}, [r8@32], r3
-
- vmov q8, q10
- vmov d18, d22
- vmov d19, d24
- vmov q10, q13
- vmov d22, d25
-
- subs r12, r12, #4 ; h -= 4
- bgt loop_vert
-
- ; outer loop
- add r0, r0, #4
- add r2, r2, #4
- subs r6, r6, #4 ; w -= 4
- bgt loop_vert_h
-
- pop {r4-r8, pc}
-
- ENDP
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve_neon.c b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve_neon.c
deleted file mode 100644
index d8b24bf..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_convolve_neon.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx_ports/mem.h"
-
-void vp9_convolve8_neon(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) {
- /* Given our constraints: w <= 64, h <= 64, taps == 8 we can reduce the
- * maximum buffer size to 64 * 64 + 7 (+ 1 to make it divisible by 4).
- */
- DECLARE_ALIGNED_ARRAY(8, uint8_t, temp, 64 * 72);
-
- // Account for the vertical phase needing 3 lines prior and 4 lines post
- int intermediate_height = h + 7;
-
- if (x_step_q4 != 16 || y_step_q4 != 16)
- return vp9_convolve8_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
-
- /* Filter starting 3 lines back. The neon implementation will ignore the
- * given height and filter a multiple of 4 lines. Since this goes in to
- * the temp buffer which has lots of extra room and is subsequently discarded
- * this is safe if somewhat less than ideal.
- */
- vp9_convolve8_horiz_neon(src - src_stride * 3, src_stride,
- temp, 64,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, intermediate_height);
-
- /* Step into the temp buffer 3 lines to get the actual frame data */
- vp9_convolve8_vert_neon(temp + 64 * 3, 64,
- dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h);
-}
-
-void vp9_convolve8_avg_neon(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) {
- DECLARE_ALIGNED_ARRAY(8, uint8_t, temp, 64 * 72);
- int intermediate_height = h + 7;
-
- if (x_step_q4 != 16 || y_step_q4 != 16)
- return vp9_convolve8_avg_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
-
- /* This implementation has the same issues as above. In addition, we only want
- * to average the values after both passes.
- */
- vp9_convolve8_horiz_neon(src - src_stride * 3, src_stride,
- temp, 64,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, intermediate_height);
- vp9_convolve8_avg_vert_neon(temp + 64 * 3,
- 64, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_copy_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_copy_neon.asm
deleted file mode 100644
index a0bd04a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_copy_neon.asm
+++ /dev/null
@@ -1,84 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_convolve_copy_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-|vp9_convolve_copy_neon| PROC
- push {r4-r5, lr}
- ldrd r4, r5, [sp, #28]
-
- cmp r4, #32
- bgt copy64
- beq copy32
- cmp r4, #8
- bgt copy16
- beq copy8
- b copy4
-
-copy64
- sub lr, r1, #32
- sub r3, r3, #32
-copy64_h
- pld [r0, r1, lsl #1]
- vld1.8 {q0-q1}, [r0]!
- vld1.8 {q2-q3}, [r0], lr
- vst1.8 {q0-q1}, [r2@128]!
- vst1.8 {q2-q3}, [r2@128], r3
- subs r5, r5, #1
- bgt copy64_h
- pop {r4-r5, pc}
-
-copy32
- pld [r0, r1, lsl #1]
- vld1.8 {q0-q1}, [r0], r1
- pld [r0, r1, lsl #1]
- vld1.8 {q2-q3}, [r0], r1
- vst1.8 {q0-q1}, [r2@128], r3
- vst1.8 {q2-q3}, [r2@128], r3
- subs r5, r5, #2
- bgt copy32
- pop {r4-r5, pc}
-
-copy16
- pld [r0, r1, lsl #1]
- vld1.8 {q0}, [r0], r1
- pld [r0, r1, lsl #1]
- vld1.8 {q1}, [r0], r1
- vst1.8 {q0}, [r2@128], r3
- vst1.8 {q1}, [r2@128], r3
- subs r5, r5, #2
- bgt copy16
- pop {r4-r5, pc}
-
-copy8
- pld [r0, r1, lsl #1]
- vld1.8 {d0}, [r0], r1
- pld [r0, r1, lsl #1]
- vld1.8 {d2}, [r0], r1
- vst1.8 {d0}, [r2@64], r3
- vst1.8 {d2}, [r2@64], r3
- subs r5, r5, #2
- bgt copy8
- pop {r4-r5, pc}
-
-copy4
- ldr r12, [r0], r1
- str r12, [r2], r3
- subs r5, r5, #1
- bgt copy4
- pop {r4-r5, pc}
- ENDP
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_dc_only_idct_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_dc_only_idct_add_neon.asm
deleted file mode 100644
index 60a0d98..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_dc_only_idct_add_neon.asm
+++ /dev/null
@@ -1,69 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
-
- EXPORT |vp9_dc_only_idct_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp9_dc_only_idct_add_neon(int input_dc, uint8_t *pred_ptr,
-; uint8_t *dst_ptr, int pitch, int stride)
-;
-; r0 int input_dc
-; r1 uint8_t *pred_ptr
-; r2 uint8_t *dst_ptr
-; r3 int pitch
-; sp int stride
-
-|vp9_dc_only_idct_add_neon| PROC
-
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- mul r0, r0, r12 ; input_dc * cospi_16_64
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; dct_const_round_shift(out * cospi_16_64)
- mul r0, r0, r12 ; out * cospi_16_64
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; ROUND_POWER_OF_TWO(out, 4)
- add r0, r0, #8 ; + (1 <<((4) - 1))
- asr r0, r0, #4 ; >> 4
-
- vdup.16 q0, r0; ; duplicate a1
- ldr r12, [sp] ; load stride
-
- vld1.32 {d2[0]}, [r1], r3
- vld1.32 {d2[1]}, [r1], r3
- vld1.32 {d4[0]}, [r1], r3
- vld1.32 {d4[1]}, [r1]
-
- vaddw.u8 q1, q0, d2 ; a1 + pred_ptr[c]
- vaddw.u8 q2, q0, d4
-
- vqmovun.s16 d2, q1 ; clip_pixel
- vqmovun.s16 d4, q2
-
- vst1.32 {d2[0]}, [r2], r12
- vst1.32 {d2[1]}, [r2], r12
- vst1.32 {d4[0]}, [r2], r12
- vst1.32 {d4[1]}, [r2]
-
- bx lr
- ENDP ; |vp9_dc_only_idct_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.asm
deleted file mode 100644
index b1fd21b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_1_add_neon.asm
+++ /dev/null
@@ -1,198 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
-
- EXPORT |vp9_idct16x16_1_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp9_idct16x16_1_add_neon(int16_t *input, uint8_t *dest,
-; int dest_stride)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride)
-
-|vp9_idct16x16_1_add_neon| PROC
- ldrsh r0, [r0]
-
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
-
- ; out = dct_const_round_shift(input[0] * cospi_16_64)
- mul r0, r0, r12 ; input[0] * cospi_16_64
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; out = dct_const_round_shift(out * cospi_16_64)
- mul r0, r0, r12 ; out * cospi_16_64
- mov r12, r1 ; save dest
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; a1 = ROUND_POWER_OF_TWO(out, 6)
- add r0, r0, #32 ; + (1 <<((6) - 1))
- asr r0, r0, #6 ; >> 6
-
- vdup.s16 q0, r0 ; duplicate a1
- mov r0, #8
- sub r2, #8
-
- ; load destination data row0 - row3
- vld1.64 {d2}, [r1], r0
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r0
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r0
- vld1.64 {d7}, [r1], r2
- vld1.64 {d16}, [r1], r0
- vld1.64 {d17}, [r1], r2
-
- vaddw.u8 q9, q0, d2 ; dest[x] + a1
- vaddw.u8 q10, q0, d3 ; dest[x] + a1
- vaddw.u8 q11, q0, d4 ; dest[x] + a1
- vaddw.u8 q12, q0, d5 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- vaddw.u8 q9, q0, d6 ; dest[x] + a1
- vaddw.u8 q10, q0, d7 ; dest[x] + a1
- vaddw.u8 q11, q0, d16 ; dest[x] + a1
- vaddw.u8 q12, q0, d17 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- ; load destination data row4 - row7
- vld1.64 {d2}, [r1], r0
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r0
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r0
- vld1.64 {d7}, [r1], r2
- vld1.64 {d16}, [r1], r0
- vld1.64 {d17}, [r1], r2
-
- vaddw.u8 q9, q0, d2 ; dest[x] + a1
- vaddw.u8 q10, q0, d3 ; dest[x] + a1
- vaddw.u8 q11, q0, d4 ; dest[x] + a1
- vaddw.u8 q12, q0, d5 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- vaddw.u8 q9, q0, d6 ; dest[x] + a1
- vaddw.u8 q10, q0, d7 ; dest[x] + a1
- vaddw.u8 q11, q0, d16 ; dest[x] + a1
- vaddw.u8 q12, q0, d17 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- ; load destination data row8 - row11
- vld1.64 {d2}, [r1], r0
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r0
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r0
- vld1.64 {d7}, [r1], r2
- vld1.64 {d16}, [r1], r0
- vld1.64 {d17}, [r1], r2
-
- vaddw.u8 q9, q0, d2 ; dest[x] + a1
- vaddw.u8 q10, q0, d3 ; dest[x] + a1
- vaddw.u8 q11, q0, d4 ; dest[x] + a1
- vaddw.u8 q12, q0, d5 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- vaddw.u8 q9, q0, d6 ; dest[x] + a1
- vaddw.u8 q10, q0, d7 ; dest[x] + a1
- vaddw.u8 q11, q0, d16 ; dest[x] + a1
- vaddw.u8 q12, q0, d17 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- ; load destination data row12 - row15
- vld1.64 {d2}, [r1], r0
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r0
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r0
- vld1.64 {d7}, [r1], r2
- vld1.64 {d16}, [r1], r0
- vld1.64 {d17}, [r1], r2
-
- vaddw.u8 q9, q0, d2 ; dest[x] + a1
- vaddw.u8 q10, q0, d3 ; dest[x] + a1
- vaddw.u8 q11, q0, d4 ; dest[x] + a1
- vaddw.u8 q12, q0, d5 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- vaddw.u8 q9, q0, d6 ; dest[x] + a1
- vaddw.u8 q10, q0, d7 ; dest[x] + a1
- vaddw.u8 q11, q0, d16 ; dest[x] + a1
- vaddw.u8 q12, q0, d17 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r0
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r0
- vst1.64 {d31}, [r12], r2
-
- bx lr
- ENDP ; |vp9_idct16x16_1_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_add_neon.asm
deleted file mode 100644
index a13c0d0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_add_neon.asm
+++ /dev/null
@@ -1,1179 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_idct16x16_256_add_neon_pass1|
- EXPORT |vp9_idct16x16_256_add_neon_pass2|
- EXPORT |vp9_idct16x16_10_add_neon_pass1|
- EXPORT |vp9_idct16x16_10_add_neon_pass2|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- ; Transpose a 8x8 16bit data matrix. Datas are loaded in q8-q15.
- MACRO
- TRANSPOSE8X8
- vswp d17, d24
- vswp d23, d30
- vswp d21, d28
- vswp d19, d26
- vtrn.32 q8, q10
- vtrn.32 q9, q11
- vtrn.32 q12, q14
- vtrn.32 q13, q15
- vtrn.16 q8, q9
- vtrn.16 q10, q11
- vtrn.16 q12, q13
- vtrn.16 q14, q15
- MEND
-
- AREA Block, CODE, READONLY ; name this block of code
-;void |vp9_idct16x16_256_add_neon_pass1|(int16_t *input,
-; int16_t *output, int output_stride)
-;
-; r0 int16_t input
-; r1 int16_t *output
-; r2 int output_stride)
-
-; idct16 stage1 - stage6 on all the elements loaded in q8-q15. The output
-; will be stored back into q8-q15 registers. This function will touch q0-q7
-; registers and use them as buffer during calculation.
-|vp9_idct16x16_256_add_neon_pass1| PROC
-
- ; TODO(hkuang): Find a better way to load the elements.
- ; load elements of 0, 2, 4, 6, 8, 10, 12, 14 into q8 - q15
- vld2.s16 {q8,q9}, [r0]!
- vld2.s16 {q9,q10}, [r0]!
- vld2.s16 {q10,q11}, [r0]!
- vld2.s16 {q11,q12}, [r0]!
- vld2.s16 {q12,q13}, [r0]!
- vld2.s16 {q13,q14}, [r0]!
- vld2.s16 {q14,q15}, [r0]!
- vld2.s16 {q1,q2}, [r0]!
- vmov.s16 q15, q1
-
- ; generate cospi_28_64 = 3196
- mov r3, #0xc00
- add r3, #0x7c
-
- ; generate cospi_4_64 = 16069
- mov r12, #0x3e00
- add r12, #0xc5
-
- ; transpose the input data
- TRANSPOSE8X8
-
- ; stage 3
- vdup.16 d0, r3 ; duplicate cospi_28_64
- vdup.16 d1, r12 ; duplicate cospi_4_64
-
- ; preloading to avoid stall
- ; generate cospi_12_64 = 13623
- mov r3, #0x3500
- add r3, #0x37
-
- ; generate cospi_20_64 = 9102
- mov r12, #0x2300
- add r12, #0x8e
-
- ; step2[4] * cospi_28_64
- vmull.s16 q2, d18, d0
- vmull.s16 q3, d19, d0
-
- ; step2[4] * cospi_4_64
- vmull.s16 q5, d18, d1
- vmull.s16 q6, d19, d1
-
- ; temp1 = step2[4] * cospi_28_64 - step2[7] * cospi_4_64
- vmlsl.s16 q2, d30, d1
- vmlsl.s16 q3, d31, d1
-
- ; temp2 = step2[4] * cospi_4_64 + step2[7] * cospi_28_64
- vmlal.s16 q5, d30, d0
- vmlal.s16 q6, d31, d0
-
- vdup.16 d2, r3 ; duplicate cospi_12_64
- vdup.16 d3, r12 ; duplicate cospi_20_64
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d8, q2, #14 ; >> 14
- vqrshrn.s32 d9, q3, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d14, q5, #14 ; >> 14
- vqrshrn.s32 d15, q6, #14 ; >> 14
-
- ; preloading to avoid stall
- ; generate cospi_16_64 = 11585
- mov r3, #0x2d00
- add r3, #0x41
-
- ; generate cospi_24_64 = 6270
- mov r12, #0x1800
- add r12, #0x7e
-
- ; step2[5] * cospi_12_64
- vmull.s16 q2, d26, d2
- vmull.s16 q3, d27, d2
-
- ; step2[5] * cospi_20_64
- vmull.s16 q9, d26, d3
- vmull.s16 q15, d27, d3
-
- ; temp1 = input[5] * cospi_12_64 - input[3] * cospi_20_64
- vmlsl.s16 q2, d22, d3
- vmlsl.s16 q3, d23, d3
-
- ; temp2 = step2[5] * cospi_20_64 + step2[6] * cospi_12_64
- vmlal.s16 q9, d22, d2
- vmlal.s16 q15, d23, d2
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d10, q2, #14 ; >> 14
- vqrshrn.s32 d11, q3, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d12, q9, #14 ; >> 14
- vqrshrn.s32 d13, q15, #14 ; >> 14
-
- ; stage 4
- vdup.16 d30, r3 ; cospi_16_64
-
- ; step1[0] * cospi_16_64
- vmull.s16 q2, d16, d30
- vmull.s16 q11, d17, d30
-
- ; step1[1] * cospi_16_64
- vmull.s16 q0, d24, d30
- vmull.s16 q1, d25, d30
-
- ; generate cospi_8_64 = 15137
- mov r3, #0x3b00
- add r3, #0x21
-
- vdup.16 d30, r12 ; duplicate cospi_24_64
- vdup.16 d31, r3 ; duplicate cospi_8_64
-
- ; temp1 = (step1[0] + step1[1]) * cospi_16_64
- vadd.s32 q3, q2, q0
- vadd.s32 q12, q11, q1
-
- ; temp2 = (step1[0] - step1[1]) * cospi_16_64
- vsub.s32 q13, q2, q0
- vsub.s32 q1, q11, q1
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d16, q3, #14 ; >> 14
- vqrshrn.s32 d17, q12, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d18, q13, #14 ; >> 14
- vqrshrn.s32 d19, q1, #14 ; >> 14
-
- ; step1[2] * cospi_24_64 - step1[3] * cospi_8_64;
- ; step1[2] * cospi_8_64
- vmull.s16 q0, d20, d31
- vmull.s16 q1, d21, d31
-
- ; step1[2] * cospi_24_64
- vmull.s16 q12, d20, d30
- vmull.s16 q13, d21, d30
-
- ; temp2 = input[1] * cospi_8_64 + input[3] * cospi_24_64
- vmlal.s16 q0, d28, d30
- vmlal.s16 q1, d29, d30
-
- ; temp1 = input[1] * cospi_24_64 - input[3] * cospi_8_64
- vmlsl.s16 q12, d28, d31
- vmlsl.s16 q13, d29, d31
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d22, q0, #14 ; >> 14
- vqrshrn.s32 d23, q1, #14 ; >> 14
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d20, q12, #14 ; >> 14
- vqrshrn.s32 d21, q13, #14 ; >> 14
-
- vsub.s16 q13, q4, q5 ; step2[5] = step1[4] - step1[5];
- vadd.s16 q4, q4, q5 ; step2[4] = step1[4] + step1[5];
- vsub.s16 q14, q7, q6 ; step2[6] = -step1[6] + step1[7];
- vadd.s16 q15, q6, q7 ; step2[7] = step1[6] + step1[7];
-
- ; generate cospi_16_64 = 11585
- mov r3, #0x2d00
- add r3, #0x41
-
- ; stage 5
- vadd.s16 q0, q8, q11 ; step1[0] = step2[0] + step2[3];
- vadd.s16 q1, q9, q10 ; step1[1] = step2[1] + step2[2];
- vsub.s16 q2, q9, q10 ; step1[2] = step2[1] - step2[2];
- vsub.s16 q3, q8, q11 ; step1[3] = step2[0] - step2[3];
-
- vdup.16 d16, r3; ; duplicate cospi_16_64
-
- ; step2[5] * cospi_16_64
- vmull.s16 q11, d26, d16
- vmull.s16 q12, d27, d16
-
- ; step2[6] * cospi_16_64
- vmull.s16 q9, d28, d16
- vmull.s16 q10, d29, d16
-
- ; temp1 = (step2[6] - step2[5]) * cospi_16_64
- vsub.s32 q6, q9, q11
- vsub.s32 q13, q10, q12
-
- ; temp2 = (step2[5] + step2[6]) * cospi_16_64
- vadd.s32 q9, q9, q11
- vadd.s32 q10, q10, q12
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d10, q6, #14 ; >> 14
- vqrshrn.s32 d11, q13, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d12, q9, #14 ; >> 14
- vqrshrn.s32 d13, q10, #14 ; >> 14
-
- ; stage 6
- vadd.s16 q8, q0, q15 ; step2[0] = step1[0] + step1[7];
- vadd.s16 q9, q1, q6 ; step2[1] = step1[1] + step1[6];
- vadd.s16 q10, q2, q5 ; step2[2] = step1[2] + step1[5];
- vadd.s16 q11, q3, q4 ; step2[3] = step1[3] + step1[4];
- vsub.s16 q12, q3, q4 ; step2[4] = step1[3] - step1[4];
- vsub.s16 q13, q2, q5 ; step2[5] = step1[2] - step1[5];
- vsub.s16 q14, q1, q6 ; step2[6] = step1[1] - step1[6];
- vsub.s16 q15, q0, q15 ; step2[7] = step1[0] - step1[7];
-
- ; store the data
- vst1.64 {d16}, [r1], r2
- vst1.64 {d17}, [r1], r2
- vst1.64 {d18}, [r1], r2
- vst1.64 {d19}, [r1], r2
- vst1.64 {d20}, [r1], r2
- vst1.64 {d21}, [r1], r2
- vst1.64 {d22}, [r1], r2
- vst1.64 {d23}, [r1], r2
- vst1.64 {d24}, [r1], r2
- vst1.64 {d25}, [r1], r2
- vst1.64 {d26}, [r1], r2
- vst1.64 {d27}, [r1], r2
- vst1.64 {d28}, [r1], r2
- vst1.64 {d29}, [r1], r2
- vst1.64 {d30}, [r1], r2
- vst1.64 {d31}, [r1], r2
-
- bx lr
- ENDP ; |vp9_idct16x16_256_add_neon_pass1|
-
-;void vp9_idct16x16_256_add_neon_pass2(int16_t *src,
-; int16_t *output,
-; int16_t *pass1Output,
-; int16_t skip_adding,
-; uint8_t *dest,
-; int dest_stride)
-;
-; r0 int16_t *src
-; r1 int16_t *output,
-; r2 int16_t *pass1Output,
-; r3 int16_t skip_adding,
-; r4 uint8_t *dest,
-; r5 int dest_stride)
-
-; idct16 stage1 - stage7 on all the elements loaded in q8-q15. The output
-; will be stored back into q8-q15 registers. This function will touch q0-q7
-; registers and use them as buffer during calculation.
-|vp9_idct16x16_256_add_neon_pass2| PROC
- push {r3-r9}
-
- ; TODO(hkuang): Find a better way to load the elements.
- ; load elements of 1, 3, 5, 7, 9, 11, 13, 15 into q8 - q15
- vld2.s16 {q8,q9}, [r0]!
- vld2.s16 {q9,q10}, [r0]!
- vld2.s16 {q10,q11}, [r0]!
- vld2.s16 {q11,q12}, [r0]!
- vld2.s16 {q12,q13}, [r0]!
- vld2.s16 {q13,q14}, [r0]!
- vld2.s16 {q14,q15}, [r0]!
- vld2.s16 {q0,q1}, [r0]!
- vmov.s16 q15, q0;
-
- ; generate cospi_30_64 = 1606
- mov r3, #0x0600
- add r3, #0x46
-
- ; generate cospi_2_64 = 16305
- mov r12, #0x3f00
- add r12, #0xb1
-
- ; transpose the input data
- TRANSPOSE8X8
-
- ; stage 3
- vdup.16 d12, r3 ; duplicate cospi_30_64
- vdup.16 d13, r12 ; duplicate cospi_2_64
-
- ; preloading to avoid stall
- ; generate cospi_14_64 = 12665
- mov r3, #0x3100
- add r3, #0x79
-
- ; generate cospi_18_64 = 10394
- mov r12, #0x2800
- add r12, #0x9a
-
- ; step1[8] * cospi_30_64
- vmull.s16 q2, d16, d12
- vmull.s16 q3, d17, d12
-
- ; step1[8] * cospi_2_64
- vmull.s16 q1, d16, d13
- vmull.s16 q4, d17, d13
-
- ; temp1 = step1[8] * cospi_30_64 - step1[15] * cospi_2_64
- vmlsl.s16 q2, d30, d13
- vmlsl.s16 q3, d31, d13
-
- ; temp2 = step1[8] * cospi_2_64 + step1[15] * cospi_30_64
- vmlal.s16 q1, d30, d12
- vmlal.s16 q4, d31, d12
-
- vdup.16 d30, r3 ; duplicate cospi_14_64
- vdup.16 d31, r12 ; duplicate cospi_18_64
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d0, q2, #14 ; >> 14
- vqrshrn.s32 d1, q3, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d14, q1, #14 ; >> 14
- vqrshrn.s32 d15, q4, #14 ; >> 14
-
- ; preloading to avoid stall
- ; generate cospi_22_64 = 7723
- mov r3, #0x1e00
- add r3, #0x2b
-
- ; generate cospi_10_64 = 14449
- mov r12, #0x3800
- add r12, #0x71
-
- ; step1[9] * cospi_14_64
- vmull.s16 q2, d24, d30
- vmull.s16 q3, d25, d30
-
- ; step1[9] * cospi_18_64
- vmull.s16 q4, d24, d31
- vmull.s16 q5, d25, d31
-
- ; temp1 = step1[9] * cospi_14_64 - step1[14] * cospi_18_64
- vmlsl.s16 q2, d22, d31
- vmlsl.s16 q3, d23, d31
-
- ; temp2 = step1[9] * cospi_18_64 + step1[14] * cospi_14_64
- vmlal.s16 q4, d22, d30
- vmlal.s16 q5, d23, d30
-
- vdup.16 d30, r3 ; duplicate cospi_22_64
- vdup.16 d31, r12 ; duplicate cospi_10_64
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d2, q2, #14 ; >> 14
- vqrshrn.s32 d3, q3, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d12, q4, #14 ; >> 14
- vqrshrn.s32 d13, q5, #14 ; >> 14
-
- ; step1[10] * cospi_22_64
- vmull.s16 q11, d20, d30
- vmull.s16 q12, d21, d30
-
- ; step1[10] * cospi_10_64
- vmull.s16 q4, d20, d31
- vmull.s16 q5, d21, d31
-
- ; temp1 = step1[10] * cospi_22_64 - step1[13] * cospi_10_64
- vmlsl.s16 q11, d26, d31
- vmlsl.s16 q12, d27, d31
-
- ; temp2 = step1[10] * cospi_10_64 + step1[13] * cospi_22_64
- vmlal.s16 q4, d26, d30
- vmlal.s16 q5, d27, d30
-
- ; preloading to avoid stall
- ; generate cospi_6_64 = 15679
- mov r3, #0x3d00
- add r3, #0x3f
-
- ; generate cospi_26_64 = 4756
- mov r12, #0x1200
- add r12, #0x94
-
- vdup.16 d30, r3 ; duplicate cospi_6_64
- vdup.16 d31, r12 ; duplicate cospi_26_64
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d4, q11, #14 ; >> 14
- vqrshrn.s32 d5, q12, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d11, q5, #14 ; >> 14
- vqrshrn.s32 d10, q4, #14 ; >> 14
-
- ; step1[11] * cospi_6_64
- vmull.s16 q10, d28, d30
- vmull.s16 q11, d29, d30
-
- ; step1[11] * cospi_26_64
- vmull.s16 q12, d28, d31
- vmull.s16 q13, d29, d31
-
- ; temp1 = step1[11] * cospi_6_64 - step1[12] * cospi_26_64
- vmlsl.s16 q10, d18, d31
- vmlsl.s16 q11, d19, d31
-
- ; temp2 = step1[11] * cospi_26_64 + step1[12] * cospi_6_64
- vmlal.s16 q12, d18, d30
- vmlal.s16 q13, d19, d30
-
- vsub.s16 q9, q0, q1 ; step1[9]=step2[8]-step2[9]
- vadd.s16 q0, q0, q1 ; step1[8]=step2[8]+step2[9]
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d6, q10, #14 ; >> 14
- vqrshrn.s32 d7, q11, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d8, q12, #14 ; >> 14
- vqrshrn.s32 d9, q13, #14 ; >> 14
-
- ; stage 3
- vsub.s16 q10, q3, q2 ; step1[10]=-step2[10]+step2[11]
- vadd.s16 q11, q2, q3 ; step1[11]=step2[10]+step2[11]
- vadd.s16 q12, q4, q5 ; step1[12]=step2[12]+step2[13]
- vsub.s16 q13, q4, q5 ; step1[13]=step2[12]-step2[13]
- vsub.s16 q14, q7, q6 ; step1[14]=-step2[14]+tep2[15]
- vadd.s16 q7, q6, q7 ; step1[15]=step2[14]+step2[15]
-
- ; stage 4
- ; generate cospi_24_64 = 6270
- mov r3, #0x1800
- add r3, #0x7e
-
- ; generate cospi_8_64 = 15137
- mov r12, #0x3b00
- add r12, #0x21
-
- ; -step1[9] * cospi_8_64 + step1[14] * cospi_24_64
- vdup.16 d30, r12 ; duplicate cospi_8_64
- vdup.16 d31, r3 ; duplicate cospi_24_64
-
- ; step1[9] * cospi_24_64
- vmull.s16 q2, d18, d31
- vmull.s16 q3, d19, d31
-
- ; step1[14] * cospi_24_64
- vmull.s16 q4, d28, d31
- vmull.s16 q5, d29, d31
-
- ; temp2 = step1[9] * cospi_24_64 + step1[14] * cospi_8_64
- vmlal.s16 q2, d28, d30
- vmlal.s16 q3, d29, d30
-
- ; temp1 = -step1[9] * cospi_8_64 + step1[14] * cospi_24_64
- vmlsl.s16 q4, d18, d30
- vmlsl.s16 q5, d19, d30
-
- rsb r12, #0
- vdup.16 d30, r12 ; duplicate -cospi_8_64
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d12, q2, #14 ; >> 14
- vqrshrn.s32 d13, q3, #14 ; >> 14
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d2, q4, #14 ; >> 14
- vqrshrn.s32 d3, q5, #14 ; >> 14
-
- vmov.s16 q3, q11
- vmov.s16 q4, q12
-
- ; - step1[13] * cospi_8_64
- vmull.s16 q11, d26, d30
- vmull.s16 q12, d27, d30
-
- ; -step1[10] * cospi_8_64
- vmull.s16 q8, d20, d30
- vmull.s16 q9, d21, d30
-
- ; temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64
- vmlsl.s16 q11, d20, d31
- vmlsl.s16 q12, d21, d31
-
- ; temp1 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64
- vmlal.s16 q8, d26, d31
- vmlal.s16 q9, d27, d31
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d4, q11, #14 ; >> 14
- vqrshrn.s32 d5, q12, #14 ; >> 14
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d10, q8, #14 ; >> 14
- vqrshrn.s32 d11, q9, #14 ; >> 14
-
- ; stage 5
- vadd.s16 q8, q0, q3 ; step1[8] = step2[8]+step2[11];
- vadd.s16 q9, q1, q2 ; step1[9] = step2[9]+step2[10];
- vsub.s16 q10, q1, q2 ; step1[10] = step2[9]-step2[10];
- vsub.s16 q11, q0, q3 ; step1[11] = step2[8]-step2[11];
- vsub.s16 q12, q7, q4 ; step1[12] =-step2[12]+step2[15];
- vsub.s16 q13, q6, q5 ; step1[13] =-step2[13]+step2[14];
- vadd.s16 q14, q6, q5 ; step1[14] =step2[13]+step2[14];
- vadd.s16 q15, q7, q4 ; step1[15] =step2[12]+step2[15];
-
- ; stage 6.
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
-
- vdup.16 d14, r12 ; duplicate cospi_16_64
-
- ; step1[13] * cospi_16_64
- vmull.s16 q3, d26, d14
- vmull.s16 q4, d27, d14
-
- ; step1[10] * cospi_16_64
- vmull.s16 q0, d20, d14
- vmull.s16 q1, d21, d14
-
- ; temp1 = (-step1[10] + step1[13]) * cospi_16_64
- vsub.s32 q5, q3, q0
- vsub.s32 q6, q4, q1
-
- ; temp2 = (step1[10] + step1[13]) * cospi_16_64
- vadd.s32 q10, q3, q0
- vadd.s32 q4, q4, q1
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d4, q5, #14 ; >> 14
- vqrshrn.s32 d5, q6, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d10, q10, #14 ; >> 14
- vqrshrn.s32 d11, q4, #14 ; >> 14
-
- ; step1[11] * cospi_16_64
- vmull.s16 q0, d22, d14
- vmull.s16 q1, d23, d14
-
- ; step1[12] * cospi_16_64
- vmull.s16 q13, d24, d14
- vmull.s16 q6, d25, d14
-
- ; temp1 = (-step1[11] + step1[12]) * cospi_16_64
- vsub.s32 q10, q13, q0
- vsub.s32 q4, q6, q1
-
- ; temp2 = (step1[11] + step1[12]) * cospi_16_64
- vadd.s32 q13, q13, q0
- vadd.s32 q6, q6, q1
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d6, q10, #14 ; >> 14
- vqrshrn.s32 d7, q4, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d8, q13, #14 ; >> 14
- vqrshrn.s32 d9, q6, #14 ; >> 14
-
- mov r4, #16 ; pass1Output stride
- ldr r3, [sp] ; load skip_adding
- cmp r3, #0 ; check if need adding dest data
- beq skip_adding_dest
-
- ldr r7, [sp, #28] ; dest used to save element 0-7
- mov r9, r7 ; save dest pointer for later use
- ldr r8, [sp, #32] ; load dest_stride
-
- ; stage 7
- ; load the data in pass1
- vld1.s16 {q0}, [r2], r4 ; load data step2[0]
- vld1.s16 {q1}, [r2], r4 ; load data step2[1]
- vld1.s16 {q10}, [r2], r4 ; load data step2[2]
- vld1.s16 {q11}, [r2], r4 ; load data step2[3]
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vadd.s16 q12, q0, q15 ; step2[0] + step2[15]
- vadd.s16 q13, q1, q14 ; step2[1] + step2[14]
- vrshr.s16 q12, q12, #6 ; ROUND_POWER_OF_TWO
- vrshr.s16 q13, q13, #6 ; ROUND_POWER_OF_TWO
- vaddw.u8 q12, q12, d12 ; + dest[j * dest_stride + i]
- vaddw.u8 q13, q13, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q12 ; clip pixel
- vqmovun.s16 d13, q13 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vst1.64 {d13}, [r9], r8 ; store the data
- vsub.s16 q14, q1, q14 ; step2[1] - step2[14]
- vsub.s16 q15, q0, q15 ; step2[0] - step2[15]
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vadd.s16 q12, q10, q5 ; step2[2] + step2[13]
- vadd.s16 q13, q11, q4 ; step2[3] + step2[12]
- vrshr.s16 q12, q12, #6 ; ROUND_POWER_OF_TWO
- vrshr.s16 q13, q13, #6 ; ROUND_POWER_OF_TWO
- vaddw.u8 q12, q12, d12 ; + dest[j * dest_stride + i]
- vaddw.u8 q13, q13, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q12 ; clip pixel
- vqmovun.s16 d13, q13 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vst1.64 {d13}, [r9], r8 ; store the data
- vsub.s16 q4, q11, q4 ; step2[3] - step2[12]
- vsub.s16 q5, q10, q5 ; step2[2] - step2[13]
- vld1.s16 {q0}, [r2], r4 ; load data step2[4]
- vld1.s16 {q1}, [r2], r4 ; load data step2[5]
- vld1.s16 {q10}, [r2], r4 ; load data step2[6]
- vld1.s16 {q11}, [r2], r4 ; load data step2[7]
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vadd.s16 q12, q0, q3 ; step2[4] + step2[11]
- vadd.s16 q13, q1, q2 ; step2[5] + step2[10]
- vrshr.s16 q12, q12, #6 ; ROUND_POWER_OF_TWO
- vrshr.s16 q13, q13, #6 ; ROUND_POWER_OF_TWO
- vaddw.u8 q12, q12, d12 ; + dest[j * dest_stride + i]
- vaddw.u8 q13, q13, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q12 ; clip pixel
- vqmovun.s16 d13, q13 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vst1.64 {d13}, [r9], r8 ; store the data
- vsub.s16 q2, q1, q2 ; step2[5] - step2[10]
- vsub.s16 q3, q0, q3 ; step2[4] - step2[11]
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vadd.s16 q12, q10, q9 ; step2[6] + step2[9]
- vadd.s16 q13, q11, q8 ; step2[7] + step2[8]
- vrshr.s16 q12, q12, #6 ; ROUND_POWER_OF_TWO
- vrshr.s16 q13, q13, #6 ; ROUND_POWER_OF_TWO
- vaddw.u8 q12, q12, d12 ; + dest[j * dest_stride + i]
- vaddw.u8 q13, q13, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q12 ; clip pixel
- vqmovun.s16 d13, q13 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vst1.64 {d13}, [r9], r8 ; store the data
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vsub.s16 q8, q11, q8 ; step2[7] - step2[8]
- vsub.s16 q9, q10, q9 ; step2[6] - step2[9]
-
- ; store the data output 8,9,10,11,12,13,14,15
- vrshr.s16 q8, q8, #6 ; ROUND_POWER_OF_TWO
- vaddw.u8 q8, q8, d12 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q8 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vrshr.s16 q9, q9, #6
- vaddw.u8 q9, q9, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d13, q9 ; clip pixel
- vst1.64 {d13}, [r9], r8 ; store the data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vrshr.s16 q2, q2, #6
- vaddw.u8 q2, q2, d12 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q2 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vrshr.s16 q3, q3, #6
- vaddw.u8 q3, q3, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d13, q3 ; clip pixel
- vst1.64 {d13}, [r9], r8 ; store the data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vrshr.s16 q4, q4, #6
- vaddw.u8 q4, q4, d12 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q4 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vrshr.s16 q5, q5, #6
- vaddw.u8 q5, q5, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d13, q5 ; clip pixel
- vst1.64 {d13}, [r9], r8 ; store the data
- vld1.64 {d13}, [r7], r8 ; load destinatoin data
- vrshr.s16 q14, q14, #6
- vaddw.u8 q14, q14, d12 ; + dest[j * dest_stride + i]
- vqmovun.s16 d12, q14 ; clip pixel
- vst1.64 {d12}, [r9], r8 ; store the data
- vld1.64 {d12}, [r7], r8 ; load destinatoin data
- vrshr.s16 q15, q15, #6
- vaddw.u8 q15, q15, d13 ; + dest[j * dest_stride + i]
- vqmovun.s16 d13, q15 ; clip pixel
- vst1.64 {d13}, [r9], r8 ; store the data
- b end_idct16x16_pass2
-
-skip_adding_dest
- ; stage 7
- ; load the data in pass1
- mov r5, #24
- mov r3, #8
-
- vld1.s16 {q0}, [r2], r4 ; load data step2[0]
- vld1.s16 {q1}, [r2], r4 ; load data step2[1]
- vadd.s16 q12, q0, q15 ; step2[0] + step2[15]
- vadd.s16 q13, q1, q14 ; step2[1] + step2[14]
- vld1.s16 {q10}, [r2], r4 ; load data step2[2]
- vld1.s16 {q11}, [r2], r4 ; load data step2[3]
- vst1.64 {d24}, [r1], r3 ; store output[0]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[1]
- vst1.64 {d27}, [r1], r5
- vadd.s16 q12, q10, q5 ; step2[2] + step2[13]
- vadd.s16 q13, q11, q4 ; step2[3] + step2[12]
- vsub.s16 q14, q1, q14 ; step2[1] - step2[14]
- vsub.s16 q15, q0, q15 ; step2[0] - step2[15]
- vst1.64 {d24}, [r1], r3 ; store output[2]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[3]
- vst1.64 {d27}, [r1], r5
- vsub.s16 q4, q11, q4 ; step2[3] - step2[12]
- vsub.s16 q5, q10, q5 ; step2[2] - step2[13]
- vld1.s16 {q0}, [r2], r4 ; load data step2[4]
- vld1.s16 {q1}, [r2], r4 ; load data step2[5]
- vadd.s16 q12, q0, q3 ; step2[4] + step2[11]
- vadd.s16 q13, q1, q2 ; step2[5] + step2[10]
- vld1.s16 {q10}, [r2], r4 ; load data step2[6]
- vld1.s16 {q11}, [r2], r4 ; load data step2[7]
- vst1.64 {d24}, [r1], r3 ; store output[4]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[5]
- vst1.64 {d27}, [r1], r5
- vadd.s16 q12, q10, q9 ; step2[6] + step2[9]
- vadd.s16 q13, q11, q8 ; step2[7] + step2[8]
- vsub.s16 q2, q1, q2 ; step2[5] - step2[10]
- vsub.s16 q3, q0, q3 ; step2[4] - step2[11]
- vsub.s16 q8, q11, q8 ; step2[7] - step2[8]
- vsub.s16 q9, q10, q9 ; step2[6] - step2[9]
- vst1.64 {d24}, [r1], r3 ; store output[6]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[7]
- vst1.64 {d27}, [r1], r5
-
- ; store the data output 8,9,10,11,12,13,14,15
- vst1.64 {d16}, [r1], r3
- vst1.64 {d17}, [r1], r5
- vst1.64 {d18}, [r1], r3
- vst1.64 {d19}, [r1], r5
- vst1.64 {d4}, [r1], r3
- vst1.64 {d5}, [r1], r5
- vst1.64 {d6}, [r1], r3
- vst1.64 {d7}, [r1], r5
- vst1.64 {d8}, [r1], r3
- vst1.64 {d9}, [r1], r5
- vst1.64 {d10}, [r1], r3
- vst1.64 {d11}, [r1], r5
- vst1.64 {d28}, [r1], r3
- vst1.64 {d29}, [r1], r5
- vst1.64 {d30}, [r1], r3
- vst1.64 {d31}, [r1], r5
-end_idct16x16_pass2
- pop {r3-r9}
- bx lr
- ENDP ; |vp9_idct16x16_256_add_neon_pass2|
-
-;void |vp9_idct16x16_10_add_neon_pass1|(int16_t *input,
-; int16_t *output, int output_stride)
-;
-; r0 int16_t input
-; r1 int16_t *output
-; r2 int output_stride)
-
-; idct16 stage1 - stage6 on all the elements loaded in q8-q15. The output
-; will be stored back into q8-q15 registers. This function will touch q0-q7
-; registers and use them as buffer during calculation.
-|vp9_idct16x16_10_add_neon_pass1| PROC
-
- ; TODO(hkuang): Find a better way to load the elements.
- ; load elements of 0, 2, 4, 6, 8, 10, 12, 14 into q8 - q15
- vld2.s16 {q8,q9}, [r0]!
- vld2.s16 {q9,q10}, [r0]!
- vld2.s16 {q10,q11}, [r0]!
- vld2.s16 {q11,q12}, [r0]!
- vld2.s16 {q12,q13}, [r0]!
- vld2.s16 {q13,q14}, [r0]!
- vld2.s16 {q14,q15}, [r0]!
- vld2.s16 {q1,q2}, [r0]!
- vmov.s16 q15, q1
-
- ; generate cospi_28_64*2 = 6392
- mov r3, #0x1800
- add r3, #0xf8
-
- ; generate cospi_4_64*2 = 32138
- mov r12, #0x7d00
- add r12, #0x8a
-
- ; transpose the input data
- TRANSPOSE8X8
-
- ; stage 3
- vdup.16 q0, r3 ; duplicate cospi_28_64*2
- vdup.16 q1, r12 ; duplicate cospi_4_64*2
-
- ; The following instructions use vqrdmulh to do the
- ; dct_const_round_shift(step2[4] * cospi_28_64). vvqrdmulh will multiply,
- ; double, and return the high 16 bits, effectively giving >> 15. Doubling
- ; the constant will change this to >> 14.
- ; dct_const_round_shift(step2[4] * cospi_28_64);
- vqrdmulh.s16 q4, q9, q0
-
- ; preloading to avoid stall
- ; generate cospi_16_64*2 = 23170
- mov r3, #0x5a00
- add r3, #0x82
-
- ; dct_const_round_shift(step2[4] * cospi_4_64);
- vqrdmulh.s16 q7, q9, q1
-
- ; stage 4
- vdup.16 q1, r3 ; cospi_16_64*2
-
- ; generate cospi_16_64 = 11585
- mov r3, #0x2d00
- add r3, #0x41
-
- vdup.16 d4, r3; ; duplicate cospi_16_64
-
- ; dct_const_round_shift(step1[0] * cospi_16_64)
- vqrdmulh.s16 q8, q8, q1
-
- ; step2[6] * cospi_16_64
- vmull.s16 q9, d14, d4
- vmull.s16 q10, d15, d4
-
- ; step2[5] * cospi_16_64
- vmull.s16 q12, d9, d4
- vmull.s16 q11, d8, d4
-
- ; temp1 = (step2[6] - step2[5]) * cospi_16_64
- vsub.s32 q15, q10, q12
- vsub.s32 q6, q9, q11
-
- ; temp2 = (step2[5] + step2[6]) * cospi_16_64
- vadd.s32 q9, q9, q11
- vadd.s32 q10, q10, q12
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d11, q15, #14 ; >> 14
- vqrshrn.s32 d10, q6, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d12, q9, #14 ; >> 14
- vqrshrn.s32 d13, q10, #14 ; >> 14
-
- ; stage 6
- vadd.s16 q2, q8, q7 ; step2[0] = step1[0] + step1[7];
- vadd.s16 q10, q8, q5 ; step2[2] = step1[2] + step1[5];
- vadd.s16 q11, q8, q4 ; step2[3] = step1[3] + step1[4];
- vadd.s16 q9, q8, q6 ; step2[1] = step1[1] + step1[6];
- vsub.s16 q12, q8, q4 ; step2[4] = step1[3] - step1[4];
- vsub.s16 q13, q8, q5 ; step2[5] = step1[2] - step1[5];
- vsub.s16 q14, q8, q6 ; step2[6] = step1[1] - step1[6];
- vsub.s16 q15, q8, q7 ; step2[7] = step1[0] - step1[7];
-
- ; store the data
- vst1.64 {d4}, [r1], r2
- vst1.64 {d5}, [r1], r2
- vst1.64 {d18}, [r1], r2
- vst1.64 {d19}, [r1], r2
- vst1.64 {d20}, [r1], r2
- vst1.64 {d21}, [r1], r2
- vst1.64 {d22}, [r1], r2
- vst1.64 {d23}, [r1], r2
- vst1.64 {d24}, [r1], r2
- vst1.64 {d25}, [r1], r2
- vst1.64 {d26}, [r1], r2
- vst1.64 {d27}, [r1], r2
- vst1.64 {d28}, [r1], r2
- vst1.64 {d29}, [r1], r2
- vst1.64 {d30}, [r1], r2
- vst1.64 {d31}, [r1], r2
-
- bx lr
- ENDP ; |vp9_idct16x16_10_add_neon_pass1|
-
-;void vp9_idct16x16_10_add_neon_pass2(int16_t *src,
-; int16_t *output,
-; int16_t *pass1Output,
-; int16_t skip_adding,
-; uint8_t *dest,
-; int dest_stride)
-;
-; r0 int16_t *src
-; r1 int16_t *output,
-; r2 int16_t *pass1Output,
-; r3 int16_t skip_adding,
-; r4 uint8_t *dest,
-; r5 int dest_stride)
-
-; idct16 stage1 - stage7 on all the elements loaded in q8-q15. The output
-; will be stored back into q8-q15 registers. This function will touch q0-q7
-; registers and use them as buffer during calculation.
-|vp9_idct16x16_10_add_neon_pass2| PROC
- push {r3-r9}
-
- ; TODO(hkuang): Find a better way to load the elements.
- ; load elements of 1, 3, 5, 7, 9, 11, 13, 15 into q8 - q15
- vld2.s16 {q8,q9}, [r0]!
- vld2.s16 {q9,q10}, [r0]!
- vld2.s16 {q10,q11}, [r0]!
- vld2.s16 {q11,q12}, [r0]!
- vld2.s16 {q12,q13}, [r0]!
- vld2.s16 {q13,q14}, [r0]!
- vld2.s16 {q14,q15}, [r0]!
- vld2.s16 {q0,q1}, [r0]!
- vmov.s16 q15, q0;
-
- ; generate 2*cospi_30_64 = 3212
- mov r3, #0xc00
- add r3, #0x8c
-
- ; generate 2*cospi_2_64 = 32610
- mov r12, #0x7f00
- add r12, #0x62
-
- ; transpose the input data
- TRANSPOSE8X8
-
- ; stage 3
- vdup.16 q6, r3 ; duplicate 2*cospi_30_64
-
- ; dct_const_round_shift(step1[8] * cospi_30_64)
- vqrdmulh.s16 q0, q8, q6
-
- vdup.16 q6, r12 ; duplicate 2*cospi_2_64
-
- ; dct_const_round_shift(step1[8] * cospi_2_64)
- vqrdmulh.s16 q7, q8, q6
-
- ; preloading to avoid stall
- ; generate 2*cospi_26_64 = 9512
- mov r12, #0x2500
- add r12, #0x28
- rsb r12, #0
- vdup.16 q15, r12 ; duplicate -2*cospi_26_64
-
- ; generate 2*cospi_6_64 = 31358
- mov r3, #0x7a00
- add r3, #0x7e
- vdup.16 q14, r3 ; duplicate 2*cospi_6_64
-
- ; dct_const_round_shift(- step1[12] * cospi_26_64)
- vqrdmulh.s16 q3, q9, q15
-
- ; dct_const_round_shift(step1[12] * cospi_6_64)
- vqrdmulh.s16 q4, q9, q14
-
- ; stage 4
- ; generate cospi_24_64 = 6270
- mov r3, #0x1800
- add r3, #0x7e
- vdup.16 d31, r3 ; duplicate cospi_24_64
-
- ; generate cospi_8_64 = 15137
- mov r12, #0x3b00
- add r12, #0x21
- vdup.16 d30, r12 ; duplicate cospi_8_64
-
- ; step1[14] * cospi_24_64
- vmull.s16 q12, d14, d31
- vmull.s16 q5, d15, d31
-
- ; step1[9] * cospi_24_64
- vmull.s16 q2, d0, d31
- vmull.s16 q11, d1, d31
-
- ; temp1 = -step1[9] * cospi_8_64 + step1[14] * cospi_24_64
- vmlsl.s16 q12, d0, d30
- vmlsl.s16 q5, d1, d30
-
- ; temp2 = step1[9] * cospi_24_64 + step1[14] * cospi_8_64
- vmlal.s16 q2, d14, d30
- vmlal.s16 q11, d15, d30
-
- rsb r12, #0
- vdup.16 d30, r12 ; duplicate -cospi_8_64
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d2, q12, #14 ; >> 14
- vqrshrn.s32 d3, q5, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d12, q2, #14 ; >> 14
- vqrshrn.s32 d13, q11, #14 ; >> 14
-
- ; - step1[13] * cospi_8_64
- vmull.s16 q10, d8, d30
- vmull.s16 q13, d9, d30
-
- ; -step1[10] * cospi_8_64
- vmull.s16 q8, d6, d30
- vmull.s16 q9, d7, d30
-
- ; temp1 = -step1[10] * cospi_24_64 - step1[13] * cospi_8_64
- vmlsl.s16 q10, d6, d31
- vmlsl.s16 q13, d7, d31
-
- ; temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64
- vmlal.s16 q8, d8, d31
- vmlal.s16 q9, d9, d31
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d4, q10, #14 ; >> 14
- vqrshrn.s32 d5, q13, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d10, q8, #14 ; >> 14
- vqrshrn.s32 d11, q9, #14 ; >> 14
-
- ; stage 5
- vadd.s16 q8, q0, q3 ; step1[8] = step2[8]+step2[11];
- vadd.s16 q9, q1, q2 ; step1[9] = step2[9]+step2[10];
- vsub.s16 q10, q1, q2 ; step1[10] = step2[9]-step2[10];
- vsub.s16 q11, q0, q3 ; step1[11] = step2[8]-step2[11];
- vsub.s16 q12, q7, q4 ; step1[12] =-step2[12]+step2[15];
- vsub.s16 q13, q6, q5 ; step1[13] =-step2[13]+step2[14];
- vadd.s16 q14, q6, q5 ; step1[14] =step2[13]+step2[14];
- vadd.s16 q15, q7, q4 ; step1[15] =step2[12]+step2[15];
-
- ; stage 6.
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
-
- vdup.16 d14, r12 ; duplicate cospi_16_64
-
- ; step1[13] * cospi_16_64
- vmull.s16 q3, d26, d14
- vmull.s16 q4, d27, d14
-
- ; step1[10] * cospi_16_64
- vmull.s16 q0, d20, d14
- vmull.s16 q1, d21, d14
-
- ; temp1 = (-step1[10] + step1[13]) * cospi_16_64
- vsub.s32 q5, q3, q0
- vsub.s32 q6, q4, q1
-
- ; temp2 = (step1[10] + step1[13]) * cospi_16_64
- vadd.s32 q0, q3, q0
- vadd.s32 q1, q4, q1
-
- ; dct_const_round_shift(temp1)
- vqrshrn.s32 d4, q5, #14 ; >> 14
- vqrshrn.s32 d5, q6, #14 ; >> 14
-
- ; dct_const_round_shift(temp2)
- vqrshrn.s32 d10, q0, #14 ; >> 14
- vqrshrn.s32 d11, q1, #14 ; >> 14
-
- ; step1[11] * cospi_16_64
- vmull.s16 q0, d22, d14
- vmull.s16 q1, d23, d14
-
- ; step1[12] * cospi_16_64
- vmull.s16 q13, d24, d14
- vmull.s16 q6, d25, d14
-
- ; temp1 = (-step1[11] + step1[12]) * cospi_16_64
- vsub.s32 q10, q13, q0
- vsub.s32 q4, q6, q1
-
- ; temp2 = (step1[11] + step1[12]) * cospi_16_64
- vadd.s32 q13, q13, q0
- vadd.s32 q6, q6, q1
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d6, q10, #14 ; >> 14
- vqrshrn.s32 d7, q4, #14 ; >> 14
-
- ; dct_const_round_shift((step1[11] + step1[12]) * cospi_16_64);
- vqrshrn.s32 d8, q13, #14 ; >> 14
- vqrshrn.s32 d9, q6, #14 ; >> 14
-
- mov r4, #16 ; pass1Output stride
- ldr r3, [sp] ; load skip_adding
-
- ; stage 7
- ; load the data in pass1
- mov r5, #24
- mov r3, #8
-
- vld1.s16 {q0}, [r2], r4 ; load data step2[0]
- vld1.s16 {q1}, [r2], r4 ; load data step2[1]
- vadd.s16 q12, q0, q15 ; step2[0] + step2[15]
- vadd.s16 q13, q1, q14 ; step2[1] + step2[14]
- vld1.s16 {q10}, [r2], r4 ; load data step2[2]
- vld1.s16 {q11}, [r2], r4 ; load data step2[3]
- vst1.64 {d24}, [r1], r3 ; store output[0]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[1]
- vst1.64 {d27}, [r1], r5
- vadd.s16 q12, q10, q5 ; step2[2] + step2[13]
- vadd.s16 q13, q11, q4 ; step2[3] + step2[12]
- vsub.s16 q14, q1, q14 ; step2[1] - step2[14]
- vsub.s16 q15, q0, q15 ; step2[0] - step2[15]
- vst1.64 {d24}, [r1], r3 ; store output[2]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[3]
- vst1.64 {d27}, [r1], r5
- vsub.s16 q4, q11, q4 ; step2[3] - step2[12]
- vsub.s16 q5, q10, q5 ; step2[2] - step2[13]
- vld1.s16 {q0}, [r2], r4 ; load data step2[4]
- vld1.s16 {q1}, [r2], r4 ; load data step2[5]
- vadd.s16 q12, q0, q3 ; step2[4] + step2[11]
- vadd.s16 q13, q1, q2 ; step2[5] + step2[10]
- vld1.s16 {q10}, [r2], r4 ; load data step2[6]
- vld1.s16 {q11}, [r2], r4 ; load data step2[7]
- vst1.64 {d24}, [r1], r3 ; store output[4]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[5]
- vst1.64 {d27}, [r1], r5
- vadd.s16 q12, q10, q9 ; step2[6] + step2[9]
- vadd.s16 q13, q11, q8 ; step2[7] + step2[8]
- vsub.s16 q2, q1, q2 ; step2[5] - step2[10]
- vsub.s16 q3, q0, q3 ; step2[4] - step2[11]
- vsub.s16 q8, q11, q8 ; step2[7] - step2[8]
- vsub.s16 q9, q10, q9 ; step2[6] - step2[9]
- vst1.64 {d24}, [r1], r3 ; store output[6]
- vst1.64 {d25}, [r1], r5
- vst1.64 {d26}, [r1], r3 ; store output[7]
- vst1.64 {d27}, [r1], r5
-
- ; store the data output 8,9,10,11,12,13,14,15
- vst1.64 {d16}, [r1], r3
- vst1.64 {d17}, [r1], r5
- vst1.64 {d18}, [r1], r3
- vst1.64 {d19}, [r1], r5
- vst1.64 {d4}, [r1], r3
- vst1.64 {d5}, [r1], r5
- vst1.64 {d6}, [r1], r3
- vst1.64 {d7}, [r1], r5
- vst1.64 {d8}, [r1], r3
- vst1.64 {d9}, [r1], r5
- vst1.64 {d10}, [r1], r3
- vst1.64 {d11}, [r1], r5
- vst1.64 {d28}, [r1], r3
- vst1.64 {d29}, [r1], r5
- vst1.64 {d30}, [r1], r3
- vst1.64 {d31}, [r1], r5
-end_idct10_16x16_pass2
- pop {r3-r9}
- bx lr
- ENDP ; |vp9_idct16x16_10_add_neon_pass2|
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_neon.c b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_neon.c
deleted file mode 100644
index 0b9fc09..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct16x16_neon.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-
-void vp9_idct16x16_256_add_neon_pass1(const int16_t *input,
- int16_t *output,
- int output_stride);
-void vp9_idct16x16_256_add_neon_pass2(const int16_t *src,
- int16_t *output,
- int16_t *pass1Output,
- int16_t skip_adding,
- uint8_t *dest,
- int dest_stride);
-void vp9_idct16x16_10_add_neon_pass1(const int16_t *input,
- int16_t *output,
- int output_stride);
-void vp9_idct16x16_10_add_neon_pass2(const int16_t *src,
- int16_t *output,
- int16_t *pass1Output,
- int16_t skip_adding,
- uint8_t *dest,
- int dest_stride);
-
-/* For ARM NEON, d8-d15 are callee-saved registers, and need to be saved. */
-extern void vp9_push_neon(int64_t *store);
-extern void vp9_pop_neon(int64_t *store);
-
-void vp9_idct16x16_256_add_neon(const int16_t *input,
- uint8_t *dest, int dest_stride) {
- int64_t store_reg[8];
- int16_t pass1_output[16*16] = {0};
- int16_t row_idct_output[16*16] = {0};
-
- // save d8-d15 register values.
- vp9_push_neon(store_reg);
-
- /* Parallel idct on the upper 8 rows */
- // First pass processes even elements 0, 2, 4, 6, 8, 10, 12, 14 and save the
- // stage 6 result in pass1_output.
- vp9_idct16x16_256_add_neon_pass1(input, pass1_output, 8);
-
- // Second pass processes odd elements 1, 3, 5, 7, 9, 11, 13, 15 and combines
- // with result in pass1(pass1_output) to calculate final result in stage 7
- // which will be saved into row_idct_output.
- vp9_idct16x16_256_add_neon_pass2(input+1,
- row_idct_output,
- pass1_output,
- 0,
- dest,
- dest_stride);
-
- /* Parallel idct on the lower 8 rows */
- // First pass processes even elements 0, 2, 4, 6, 8, 10, 12, 14 and save the
- // stage 6 result in pass1_output.
- vp9_idct16x16_256_add_neon_pass1(input+8*16, pass1_output, 8);
-
- // Second pass processes odd elements 1, 3, 5, 7, 9, 11, 13, 15 and combines
- // with result in pass1(pass1_output) to calculate final result in stage 7
- // which will be saved into row_idct_output.
- vp9_idct16x16_256_add_neon_pass2(input+8*16+1,
- row_idct_output+8,
- pass1_output,
- 0,
- dest,
- dest_stride);
-
- /* Parallel idct on the left 8 columns */
- // First pass processes even elements 0, 2, 4, 6, 8, 10, 12, 14 and save the
- // stage 6 result in pass1_output.
- vp9_idct16x16_256_add_neon_pass1(row_idct_output, pass1_output, 8);
-
- // Second pass processes odd elements 1, 3, 5, 7, 9, 11, 13, 15 and combines
- // with result in pass1(pass1_output) to calculate final result in stage 7.
- // Then add the result to the destination data.
- vp9_idct16x16_256_add_neon_pass2(row_idct_output+1,
- row_idct_output,
- pass1_output,
- 1,
- dest,
- dest_stride);
-
- /* Parallel idct on the right 8 columns */
- // First pass processes even elements 0, 2, 4, 6, 8, 10, 12, 14 and save the
- // stage 6 result in pass1_output.
- vp9_idct16x16_256_add_neon_pass1(row_idct_output+8*16, pass1_output, 8);
-
- // Second pass processes odd elements 1, 3, 5, 7, 9, 11, 13, 15 and combines
- // with result in pass1(pass1_output) to calculate final result in stage 7.
- // Then add the result to the destination data.
- vp9_idct16x16_256_add_neon_pass2(row_idct_output+8*16+1,
- row_idct_output+8,
- pass1_output,
- 1,
- dest+8,
- dest_stride);
-
- // restore d8-d15 register values.
- vp9_pop_neon(store_reg);
-
- return;
-}
-
-void vp9_idct16x16_10_add_neon(const int16_t *input,
- uint8_t *dest, int dest_stride) {
- int64_t store_reg[8];
- int16_t pass1_output[16*16] = {0};
- int16_t row_idct_output[16*16] = {0};
-
- // save d8-d15 register values.
- vp9_push_neon(store_reg);
-
- /* Parallel idct on the upper 8 rows */
- // First pass processes even elements 0, 2, 4, 6, 8, 10, 12, 14 and save the
- // stage 6 result in pass1_output.
- vp9_idct16x16_10_add_neon_pass1(input, pass1_output, 8);
-
- // Second pass processes odd elements 1, 3, 5, 7, 9, 11, 13, 15 and combines
- // with result in pass1(pass1_output) to calculate final result in stage 7
- // which will be saved into row_idct_output.
- vp9_idct16x16_10_add_neon_pass2(input+1,
- row_idct_output,
- pass1_output,
- 0,
- dest,
- dest_stride);
-
- /* Skip Parallel idct on the lower 8 rows as they are all 0s */
-
- /* Parallel idct on the left 8 columns */
- // First pass processes even elements 0, 2, 4, 6, 8, 10, 12, 14 and save the
- // stage 6 result in pass1_output.
- vp9_idct16x16_256_add_neon_pass1(row_idct_output, pass1_output, 8);
-
- // Second pass processes odd elements 1, 3, 5, 7, 9, 11, 13, 15 and combines
- // with result in pass1(pass1_output) to calculate final result in stage 7.
- // Then add the result to the destination data.
- vp9_idct16x16_256_add_neon_pass2(row_idct_output+1,
- row_idct_output,
- pass1_output,
- 1,
- dest,
- dest_stride);
-
- /* Parallel idct on the right 8 columns */
- // First pass processes even elements 0, 2, 4, 6, 8, 10, 12, 14 and save the
- // stage 6 result in pass1_output.
- vp9_idct16x16_256_add_neon_pass1(row_idct_output+8*16, pass1_output, 8);
-
- // Second pass processes odd elements 1, 3, 5, 7, 9, 11, 13, 15 and combines
- // with result in pass1(pass1_output) to calculate final result in stage 7.
- // Then add the result to the destination data.
- vp9_idct16x16_256_add_neon_pass2(row_idct_output+8*16+1,
- row_idct_output+8,
- pass1_output,
- 1,
- dest+8,
- dest_stride);
-
- // restore d8-d15 register values.
- vp9_pop_neon(store_reg);
-
- return;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.asm
deleted file mode 100644
index d290d07..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_1_add_neon.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
- EXPORT |vp9_idct32x32_1_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- ;TODO(hkuang): put the following macros in a seperate
- ;file so other idct function could also use them.
- MACRO
- LD_16x8 $src, $stride
- vld1.8 {q8}, [$src], $stride
- vld1.8 {q9}, [$src], $stride
- vld1.8 {q10}, [$src], $stride
- vld1.8 {q11}, [$src], $stride
- vld1.8 {q12}, [$src], $stride
- vld1.8 {q13}, [$src], $stride
- vld1.8 {q14}, [$src], $stride
- vld1.8 {q15}, [$src], $stride
- MEND
-
- MACRO
- ADD_DIFF_16x8 $diff
- vqadd.u8 q8, q8, $diff
- vqadd.u8 q9, q9, $diff
- vqadd.u8 q10, q10, $diff
- vqadd.u8 q11, q11, $diff
- vqadd.u8 q12, q12, $diff
- vqadd.u8 q13, q13, $diff
- vqadd.u8 q14, q14, $diff
- vqadd.u8 q15, q15, $diff
- MEND
-
- MACRO
- SUB_DIFF_16x8 $diff
- vqsub.u8 q8, q8, $diff
- vqsub.u8 q9, q9, $diff
- vqsub.u8 q10, q10, $diff
- vqsub.u8 q11, q11, $diff
- vqsub.u8 q12, q12, $diff
- vqsub.u8 q13, q13, $diff
- vqsub.u8 q14, q14, $diff
- vqsub.u8 q15, q15, $diff
- MEND
-
- MACRO
- ST_16x8 $dst, $stride
- vst1.8 {q8}, [$dst], $stride
- vst1.8 {q9}, [$dst], $stride
- vst1.8 {q10},[$dst], $stride
- vst1.8 {q11},[$dst], $stride
- vst1.8 {q12},[$dst], $stride
- vst1.8 {q13},[$dst], $stride
- vst1.8 {q14},[$dst], $stride
- vst1.8 {q15},[$dst], $stride
- MEND
-
-;void vp9_idct32x32_1_add_neon(int16_t *input, uint8_t *dest,
-; int dest_stride)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride
-
-|vp9_idct32x32_1_add_neon| PROC
- push {lr}
- pld [r1]
- add r3, r1, #16 ; r3 dest + 16 for second loop
- ldrsh r0, [r0]
-
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
-
- ; out = dct_const_round_shift(input[0] * cospi_16_64)
- mul r0, r0, r12 ; input[0] * cospi_16_64
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; out = dct_const_round_shift(out * cospi_16_64)
- mul r0, r0, r12 ; out * cospi_16_64
- mov r12, r1 ; save dest
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; a1 = ROUND_POWER_OF_TWO(out, 6)
- add r0, r0, #32 ; + (1 <<((6) - 1))
- asrs r0, r0, #6 ; >> 6
- bge diff_positive_32_32
-
-diff_negative_32_32
- neg r0, r0
- usat r0, #8, r0
- vdup.u8 q0, r0
- mov r0, #4
-
-diff_negative_32_32_loop
- sub r0, #1
- LD_16x8 r1, r2
- SUB_DIFF_16x8 q0
- ST_16x8 r12, r2
-
- LD_16x8 r1, r2
- SUB_DIFF_16x8 q0
- ST_16x8 r12, r2
- cmp r0, #2
- moveq r1, r3
- moveq r12, r3
- cmp r0, #0
- bne diff_negative_32_32_loop
- pop {pc}
-
-diff_positive_32_32
- usat r0, #8, r0
- vdup.u8 q0, r0
- mov r0, #4
-
-diff_positive_32_32_loop
- sub r0, #1
- LD_16x8 r1, r2
- ADD_DIFF_16x8 q0
- ST_16x8 r12, r2
-
- LD_16x8 r1, r2
- ADD_DIFF_16x8 q0
- ST_16x8 r12, r2
- cmp r0, #2
- moveq r1, r3
- moveq r12, r3
- cmp r0, #0
- bne diff_positive_32_32_loop
- pop {pc}
-
- ENDP ; |vp9_idct32x32_1_add_neon|
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_add_neon.asm
deleted file mode 100644
index 72e933e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct32x32_add_neon.asm
+++ /dev/null
@@ -1,1299 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-;TODO(cd): adjust these constant to be able to use vqdmulh for faster
-; dct_const_round_shift(a * b) within butterfly calculations.
-cospi_1_64 EQU 16364
-cospi_2_64 EQU 16305
-cospi_3_64 EQU 16207
-cospi_4_64 EQU 16069
-cospi_5_64 EQU 15893
-cospi_6_64 EQU 15679
-cospi_7_64 EQU 15426
-cospi_8_64 EQU 15137
-cospi_9_64 EQU 14811
-cospi_10_64 EQU 14449
-cospi_11_64 EQU 14053
-cospi_12_64 EQU 13623
-cospi_13_64 EQU 13160
-cospi_14_64 EQU 12665
-cospi_15_64 EQU 12140
-cospi_16_64 EQU 11585
-cospi_17_64 EQU 11003
-cospi_18_64 EQU 10394
-cospi_19_64 EQU 9760
-cospi_20_64 EQU 9102
-cospi_21_64 EQU 8423
-cospi_22_64 EQU 7723
-cospi_23_64 EQU 7005
-cospi_24_64 EQU 6270
-cospi_25_64 EQU 5520
-cospi_26_64 EQU 4756
-cospi_27_64 EQU 3981
-cospi_28_64 EQU 3196
-cospi_29_64 EQU 2404
-cospi_30_64 EQU 1606
-cospi_31_64 EQU 804
-
-
- EXPORT |vp9_idct32x32_1024_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- AREA Block, CODE, READONLY
-
- ; --------------------------------------------------------------------------
- ; Load from transposed_buffer
- ; q13 = transposed_buffer[first_offset]
- ; q14 = transposed_buffer[second_offset]
- ; for proper address calculation, the last offset used when manipulating
- ; transposed_buffer must be passed in. use 0 for first use.
- MACRO
- LOAD_FROM_TRANSPOSED $prev_offset, $first_offset, $second_offset
- ; address calculation with proper stride and loading
- add r0, #($first_offset - $prev_offset )*8*2
- vld1.s16 {q14}, [r0]
- add r0, #($second_offset - $first_offset)*8*2
- vld1.s16 {q13}, [r0]
- ; (used) two registers (q14, q13)
- MEND
- ; --------------------------------------------------------------------------
- ; Load from output (used as temporary storage)
- ; reg1 = output[first_offset]
- ; reg2 = output[second_offset]
- ; for proper address calculation, the last offset used when manipulating
- ; output, whether reading or storing) must be passed in. use 0 for first
- ; use.
- MACRO
- LOAD_FROM_OUTPUT $prev_offset, $first_offset, $second_offset, $reg1, $reg2
- ; address calculation with proper stride and loading
- add r1, #($first_offset - $prev_offset )*32*2
- vld1.s16 {$reg1}, [r1]
- add r1, #($second_offset - $first_offset)*32*2
- vld1.s16 {$reg2}, [r1]
- ; (used) two registers ($reg1, $reg2)
- MEND
- ; --------------------------------------------------------------------------
- ; Store into output (sometimes as as temporary storage)
- ; output[first_offset] = reg1
- ; output[second_offset] = reg2
- ; for proper address calculation, the last offset used when manipulating
- ; output, whether reading or storing) must be passed in. use 0 for first
- ; use.
- MACRO
- STORE_IN_OUTPUT $prev_offset, $first_offset, $second_offset, $reg1, $reg2
- ; address calculation with proper stride and storing
- add r1, #($first_offset - $prev_offset )*32*2
- vst1.16 {$reg1}, [r1]
- add r1, #($second_offset - $first_offset)*32*2
- vst1.16 {$reg2}, [r1]
- MEND
- ; --------------------------------------------------------------------------
- ; Combine-add results with current destination content
- ; q6-q9 contain the results (out[j * 32 + 0-31])
- MACRO
- STORE_COMBINE_CENTER_RESULTS
- ; load dest[j * dest_stride + 0-31]
- vld1.s16 {d8}, [r10], r2
- vld1.s16 {d11}, [r9], r11
- vld1.s16 {d9}, [r10]
- vld1.s16 {d10}, [r9]
- ; ROUND_POWER_OF_TWO
- vrshr.s16 q7, q7, #6
- vrshr.s16 q8, q8, #6
- vrshr.s16 q9, q9, #6
- vrshr.s16 q6, q6, #6
- ; add to dest[j * dest_stride + 0-31]
- vaddw.u8 q7, q7, d9
- vaddw.u8 q8, q8, d10
- vaddw.u8 q9, q9, d11
- vaddw.u8 q6, q6, d8
- ; clip pixel
- vqmovun.s16 d9, q7
- vqmovun.s16 d10, q8
- vqmovun.s16 d11, q9
- vqmovun.s16 d8, q6
- ; store back into dest[j * dest_stride + 0-31]
- vst1.16 {d9}, [r10], r11
- vst1.16 {d10}, [r9], r2
- vst1.16 {d8}, [r10]
- vst1.16 {d11}, [r9]
- ; update pointers (by dest_stride * 2)
- sub r9, r9, r2, lsl #1
- add r10, r10, r2, lsl #1
- MEND
- ; --------------------------------------------------------------------------
- ; Combine-add results with current destination content
- ; q6-q9 contain the results (out[j * 32 + 0-31])
- MACRO
- STORE_COMBINE_CENTER_RESULTS_LAST
- ; load dest[j * dest_stride + 0-31]
- vld1.s16 {d8}, [r10], r2
- vld1.s16 {d11}, [r9], r11
- vld1.s16 {d9}, [r10]
- vld1.s16 {d10}, [r9]
- ; ROUND_POWER_OF_TWO
- vrshr.s16 q7, q7, #6
- vrshr.s16 q8, q8, #6
- vrshr.s16 q9, q9, #6
- vrshr.s16 q6, q6, #6
- ; add to dest[j * dest_stride + 0-31]
- vaddw.u8 q7, q7, d9
- vaddw.u8 q8, q8, d10
- vaddw.u8 q9, q9, d11
- vaddw.u8 q6, q6, d8
- ; clip pixel
- vqmovun.s16 d9, q7
- vqmovun.s16 d10, q8
- vqmovun.s16 d11, q9
- vqmovun.s16 d8, q6
- ; store back into dest[j * dest_stride + 0-31]
- vst1.16 {d9}, [r10], r11
- vst1.16 {d10}, [r9], r2
- vst1.16 {d8}, [r10]!
- vst1.16 {d11}, [r9]!
- ; update pointers (by dest_stride * 2)
- sub r9, r9, r2, lsl #1
- add r10, r10, r2, lsl #1
- MEND
- ; --------------------------------------------------------------------------
- ; Combine-add results with current destination content
- ; q4-q7 contain the results (out[j * 32 + 0-31])
- MACRO
- STORE_COMBINE_EXTREME_RESULTS
- ; load dest[j * dest_stride + 0-31]
- vld1.s16 {d4}, [r7], r2
- vld1.s16 {d7}, [r6], r11
- vld1.s16 {d5}, [r7]
- vld1.s16 {d6}, [r6]
- ; ROUND_POWER_OF_TWO
- vrshr.s16 q5, q5, #6
- vrshr.s16 q6, q6, #6
- vrshr.s16 q7, q7, #6
- vrshr.s16 q4, q4, #6
- ; add to dest[j * dest_stride + 0-31]
- vaddw.u8 q5, q5, d5
- vaddw.u8 q6, q6, d6
- vaddw.u8 q7, q7, d7
- vaddw.u8 q4, q4, d4
- ; clip pixel
- vqmovun.s16 d5, q5
- vqmovun.s16 d6, q6
- vqmovun.s16 d7, q7
- vqmovun.s16 d4, q4
- ; store back into dest[j * dest_stride + 0-31]
- vst1.16 {d5}, [r7], r11
- vst1.16 {d6}, [r6], r2
- vst1.16 {d7}, [r6]
- vst1.16 {d4}, [r7]
- ; update pointers (by dest_stride * 2)
- sub r6, r6, r2, lsl #1
- add r7, r7, r2, lsl #1
- MEND
- ; --------------------------------------------------------------------------
- ; Combine-add results with current destination content
- ; q4-q7 contain the results (out[j * 32 + 0-31])
- MACRO
- STORE_COMBINE_EXTREME_RESULTS_LAST
- ; load dest[j * dest_stride + 0-31]
- vld1.s16 {d4}, [r7], r2
- vld1.s16 {d7}, [r6], r11
- vld1.s16 {d5}, [r7]
- vld1.s16 {d6}, [r6]
- ; ROUND_POWER_OF_TWO
- vrshr.s16 q5, q5, #6
- vrshr.s16 q6, q6, #6
- vrshr.s16 q7, q7, #6
- vrshr.s16 q4, q4, #6
- ; add to dest[j * dest_stride + 0-31]
- vaddw.u8 q5, q5, d5
- vaddw.u8 q6, q6, d6
- vaddw.u8 q7, q7, d7
- vaddw.u8 q4, q4, d4
- ; clip pixel
- vqmovun.s16 d5, q5
- vqmovun.s16 d6, q6
- vqmovun.s16 d7, q7
- vqmovun.s16 d4, q4
- ; store back into dest[j * dest_stride + 0-31]
- vst1.16 {d5}, [r7], r11
- vst1.16 {d6}, [r6], r2
- vst1.16 {d7}, [r6]!
- vst1.16 {d4}, [r7]!
- ; update pointers (by dest_stride * 2)
- sub r6, r6, r2, lsl #1
- add r7, r7, r2, lsl #1
- MEND
- ; --------------------------------------------------------------------------
- ; Touches q8-q12, q15 (q13-q14 are preserved)
- ; valid output registers are anything but q8-q11
- MACRO
- DO_BUTTERFLY $regC, $regD, $regA, $regB, $first_constant, $second_constant, $reg1, $reg2, $reg3, $reg4
- ; TODO(cd): have special case to re-use constants when they are similar for
- ; consecutive butterflies
- ; TODO(cd): have special case when both constants are the same, do the
- ; additions/subtractions before the multiplies.
- ; generate the constants
- ; generate scalar constants
- mov r8, #$first_constant & 0xFF00
- mov r12, #$second_constant & 0xFF00
- add r8, #$first_constant & 0x00FF
- add r12, #$second_constant & 0x00FF
- ; generate vector constants
- vdup.16 d30, r8
- vdup.16 d31, r12
- ; (used) two for inputs (regA-regD), one for constants (q15)
- ; do some multiplications (ordered for maximum latency hiding)
- vmull.s16 q8, $regC, d30
- vmull.s16 q10, $regA, d31
- vmull.s16 q9, $regD, d30
- vmull.s16 q11, $regB, d31
- vmull.s16 q12, $regC, d31
- ; (used) five for intermediate (q8-q12), one for constants (q15)
- ; do some addition/subtractions (to get back two register)
- vsub.s32 q8, q8, q10
- vsub.s32 q9, q9, q11
- ; do more multiplications (ordered for maximum latency hiding)
- vmull.s16 q10, $regD, d31
- vmull.s16 q11, $regA, d30
- vmull.s16 q15, $regB, d30
- ; (used) six for intermediate (q8-q12, q15)
- ; do more addition/subtractions
- vadd.s32 q11, q12, q11
- vadd.s32 q10, q10, q15
- ; (used) four for intermediate (q8-q11)
- ; dct_const_round_shift
- vqrshrn.s32 $reg1, q8, #14
- vqrshrn.s32 $reg2, q9, #14
- vqrshrn.s32 $reg3, q11, #14
- vqrshrn.s32 $reg4, q10, #14
- ; (used) two for results, well four d registers
- MEND
- ; --------------------------------------------------------------------------
- ; Touches q8-q12, q15 (q13-q14 are preserved)
- ; valid output registers are anything but q8-q11
- MACRO
- DO_BUTTERFLY_STD $first_constant, $second_constant, $reg1, $reg2, $reg3, $reg4
- DO_BUTTERFLY d28, d29, d26, d27, $first_constant, $second_constant, $reg1, $reg2, $reg3, $reg4
- MEND
- ; --------------------------------------------------------------------------
-
-;void vp9_idct32x32_1024_add_neon(int16_t *input, uint8_t *dest, int dest_stride);
-;
-; r0 int16_t *input,
-; r1 uint8_t *dest,
-; r2 int dest_stride)
-; loop counters
-; r4 bands loop counter
-; r5 pass loop counter
-; r8 transpose loop counter
-; combine-add pointers
-; r6 dest + 31 * dest_stride, descending (30, 29, 28, ...)
-; r7 dest + 0 * dest_stride, ascending (1, 2, 3, ...)
-; r9 dest + 15 * dest_stride, descending (14, 13, 12, ...)
-; r10 dest + 16 * dest_stride, ascending (17, 18, 19, ...)
-
-|vp9_idct32x32_1024_add_neon| PROC
- ; This function does one pass of idct32x32 transform.
- ;
- ; This is done by transposing the input and then doing a 1d transform on
- ; columns. In the first pass, the transposed columns are the original
- ; rows. In the second pass, after the transposition, the colums are the
- ; original columns.
- ; The 1d transform is done by looping over bands of eight columns (the
- ; idct32_bands loop). For each band, the transform input transposition
- ; is done on demand, one band of four 8x8 matrices at a time. The four
- ; matrices are transposed by pairs (the idct32_transpose_pair loop).
- push {r4-r11}
- vpush {d8-d15}
- ; stack operation
- ; internal buffer used to transpose 8 lines into before transforming them
- ; int16_t transpose_buffer[32 * 8];
- ; at sp + [4096, 4607]
- ; results of the first pass (transpose and transform rows)
- ; int16_t pass1[32 * 32];
- ; at sp + [0, 2047]
- ; results of the second pass (transpose and transform columns)
- ; int16_t pass2[32 * 32];
- ; at sp + [2048, 4095]
- sub sp, sp, #512+2048+2048
-
- ; r6 = dest + 31 * dest_stride
- ; r7 = dest + 0 * dest_stride
- ; r9 = dest + 15 * dest_stride
- ; r10 = dest + 16 * dest_stride
- rsb r6, r2, r2, lsl #5
- rsb r9, r2, r2, lsl #4
- add r10, r1, r2, lsl #4
- mov r7, r1
- add r6, r6, r1
- add r9, r9, r1
- ; r11 = -dest_stride
- neg r11, r2
- ; r3 = input
- mov r3, r0
- ; parameters for first pass
- ; r0 = transpose_buffer[32 * 8]
- add r0, sp, #4096
- ; r1 = pass1[32 * 32]
- mov r1, sp
-
- mov r5, #0 ; initialize pass loop counter
-idct32_pass_loop
- mov r4, #4 ; initialize bands loop counter
-idct32_bands_loop
- mov r8, #2 ; initialize transpose loop counter
-idct32_transpose_pair_loop
- ; Load two horizontally consecutive 8x8 16bit data matrices. The first one
- ; into q0-q7 and the second one into q8-q15. There is a stride of 64,
- ; adjusted to 32 because of the two post-increments.
- vld1.s16 {q8}, [r3]!
- vld1.s16 {q0}, [r3]!
- add r3, #32
- vld1.s16 {q9}, [r3]!
- vld1.s16 {q1}, [r3]!
- add r3, #32
- vld1.s16 {q10}, [r3]!
- vld1.s16 {q2}, [r3]!
- add r3, #32
- vld1.s16 {q11}, [r3]!
- vld1.s16 {q3}, [r3]!
- add r3, #32
- vld1.s16 {q12}, [r3]!
- vld1.s16 {q4}, [r3]!
- add r3, #32
- vld1.s16 {q13}, [r3]!
- vld1.s16 {q5}, [r3]!
- add r3, #32
- vld1.s16 {q14}, [r3]!
- vld1.s16 {q6}, [r3]!
- add r3, #32
- vld1.s16 {q15}, [r3]!
- vld1.s16 {q7}, [r3]!
-
- ; Transpose the two 8x8 16bit data matrices.
- vswp d17, d24
- vswp d23, d30
- vswp d21, d28
- vswp d19, d26
- vswp d1, d8
- vswp d7, d14
- vswp d5, d12
- vswp d3, d10
- vtrn.32 q8, q10
- vtrn.32 q9, q11
- vtrn.32 q12, q14
- vtrn.32 q13, q15
- vtrn.32 q0, q2
- vtrn.32 q1, q3
- vtrn.32 q4, q6
- vtrn.32 q5, q7
- vtrn.16 q8, q9
- vtrn.16 q10, q11
- vtrn.16 q12, q13
- vtrn.16 q14, q15
- vtrn.16 q0, q1
- vtrn.16 q2, q3
- vtrn.16 q4, q5
- vtrn.16 q6, q7
-
- ; Store both matrices after each other. There is a stride of 32, which
- ; adjusts to nothing because of the post-increments.
- vst1.16 {q8}, [r0]!
- vst1.16 {q9}, [r0]!
- vst1.16 {q10}, [r0]!
- vst1.16 {q11}, [r0]!
- vst1.16 {q12}, [r0]!
- vst1.16 {q13}, [r0]!
- vst1.16 {q14}, [r0]!
- vst1.16 {q15}, [r0]!
- vst1.16 {q0}, [r0]!
- vst1.16 {q1}, [r0]!
- vst1.16 {q2}, [r0]!
- vst1.16 {q3}, [r0]!
- vst1.16 {q4}, [r0]!
- vst1.16 {q5}, [r0]!
- vst1.16 {q6}, [r0]!
- vst1.16 {q7}, [r0]!
-
- ; increment pointers by adjusted stride (not necessary for r0/out)
- ; go back by 7*32 for the seven lines moved fully by read and add
- ; go back by 32 for the eigth line only read
- ; advance by 16*2 to go the next pair
- sub r3, r3, #7*32*2 + 32 - 16*2
- ; transpose pair loop processing
- subs r8, r8, #1
- bne idct32_transpose_pair_loop
-
- ; restore r0/input to its original value
- sub r0, r0, #32*8*2
-
- ; Instead of doing the transforms stage by stage, it is done by loading
- ; some input values and doing as many stages as possible to minimize the
- ; storing/loading of intermediate results. To fit within registers, the
- ; final coefficients are cut into four blocks:
- ; BLOCK A: 16-19,28-31
- ; BLOCK B: 20-23,24-27
- ; BLOCK C: 8-10,11-15
- ; BLOCK D: 0-3,4-7
- ; Blocks A and C are straight calculation through the various stages. In
- ; block B, further calculations are performed using the results from
- ; block A. In block D, further calculations are performed using the results
- ; from block C and then the final calculations are done using results from
- ; block A and B which have been combined at the end of block B.
-
- ; --------------------------------------------------------------------------
- ; BLOCK A: 16-19,28-31
- ; --------------------------------------------------------------------------
- ; generate 16,17,30,31
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[1 * 32] * cospi_31_64 - input[31 * 32] * cospi_1_64;
- ;temp2 = input[1 * 32] * cospi_1_64 + input[31 * 32] * cospi_31_64;
- ;step1b[16][i] = dct_const_round_shift(temp1);
- ;step1b[31][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 0, 1, 31
- DO_BUTTERFLY_STD cospi_31_64, cospi_1_64, d0, d1, d4, d5
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[17 * 32] * cospi_15_64 - input[15 * 32] * cospi_17_64;
- ;temp2 = input[17 * 32] * cospi_17_64 + input[15 * 32] * cospi_15_64;
- ;step1b[17][i] = dct_const_round_shift(temp1);
- ;step1b[30][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 31, 17, 15
- DO_BUTTERFLY_STD cospi_15_64, cospi_17_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;step2[16] = step1b[16][i] + step1b[17][i];
- ;step2[17] = step1b[16][i] - step1b[17][i];
- ;step2[30] = -step1b[30][i] + step1b[31][i];
- ;step2[31] = step1b[30][i] + step1b[31][i];
- vadd.s16 q4, q0, q1
- vsub.s16 q13, q0, q1
- vadd.s16 q6, q2, q3
- vsub.s16 q14, q2, q3
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;temp1 = step1b[30][i] * cospi_28_64 - step1b[17][i] * cospi_4_64;
- ;temp2 = step1b[30][i] * cospi_4_64 - step1b[17][i] * cospi_28_64;
- ;step3[17] = dct_const_round_shift(temp1);
- ;step3[30] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_28_64, cospi_4_64, d10, d11, d14, d15
- ; --------------------------------------------------------------------------
- ; generate 18,19,28,29
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[9 * 32] * cospi_23_64 - input[23 * 32] * cospi_9_64;
- ;temp2 = input[9 * 32] * cospi_9_64 + input[23 * 32] * cospi_23_64;
- ;step1b[18][i] = dct_const_round_shift(temp1);
- ;step1b[29][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 15, 9, 23
- DO_BUTTERFLY_STD cospi_23_64, cospi_9_64, d0, d1, d4, d5
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[25 * 32] * cospi_7_64 - input[7 * 32] * cospi_25_64;
- ;temp2 = input[25 * 32] * cospi_25_64 + input[7 * 32] * cospi_7_64;
- ;step1b[19][i] = dct_const_round_shift(temp1);
- ;step1b[28][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 23, 25, 7
- DO_BUTTERFLY_STD cospi_7_64, cospi_25_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;step2[18] = -step1b[18][i] + step1b[19][i];
- ;step2[19] = step1b[18][i] + step1b[19][i];
- ;step2[28] = step1b[28][i] + step1b[29][i];
- ;step2[29] = step1b[28][i] - step1b[29][i];
- vsub.s16 q13, q3, q2
- vadd.s16 q3, q3, q2
- vsub.s16 q14, q1, q0
- vadd.s16 q2, q1, q0
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;temp1 = step1b[18][i] * (-cospi_4_64) - step1b[29][i] * (-cospi_28_64);
- ;temp2 = step1b[18][i] * (-cospi_28_64) + step1b[29][i] * (-cospi_4_64);
- ;step3[29] = dct_const_round_shift(temp1);
- ;step3[18] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD (-cospi_4_64), (-cospi_28_64), d2, d3, d0, d1
- ; --------------------------------------------------------------------------
- ; combine 16-19,28-31
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;step1[16] = step1b[16][i] + step1b[19][i];
- ;step1[17] = step1b[17][i] + step1b[18][i];
- ;step1[18] = step1b[17][i] - step1b[18][i];
- ;step1[29] = step1b[30][i] - step1b[29][i];
- ;step1[30] = step1b[30][i] + step1b[29][i];
- ;step1[31] = step1b[31][i] + step1b[28][i];
- vadd.s16 q8, q4, q2
- vadd.s16 q9, q5, q0
- vadd.s16 q10, q7, q1
- vadd.s16 q15, q6, q3
- vsub.s16 q13, q5, q0
- vsub.s16 q14, q7, q1
- STORE_IN_OUTPUT 0, 16, 31, q8, q15
- STORE_IN_OUTPUT 31, 17, 30, q9, q10
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;temp1 = step1b[29][i] * cospi_24_64 - step1b[18][i] * cospi_8_64;
- ;temp2 = step1b[29][i] * cospi_8_64 + step1b[18][i] * cospi_24_64;
- ;step2[18] = dct_const_round_shift(temp1);
- ;step2[29] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d0, d1, d2, d3
- STORE_IN_OUTPUT 30, 29, 18, q1, q0
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;step1[19] = step1b[16][i] - step1b[19][i];
- ;step1[28] = step1b[31][i] - step1b[28][i];
- vsub.s16 q13, q4, q2
- vsub.s16 q14, q6, q3
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;temp1 = step1b[28][i] * cospi_24_64 - step1b[19][i] * cospi_8_64;
- ;temp2 = step1b[28][i] * cospi_8_64 + step1b[19][i] * cospi_24_64;
- ;step2[19] = dct_const_round_shift(temp1);
- ;step2[28] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d8, d9, d12, d13
- STORE_IN_OUTPUT 18, 19, 28, q4, q6
- ; --------------------------------------------------------------------------
-
-
- ; --------------------------------------------------------------------------
- ; BLOCK B: 20-23,24-27
- ; --------------------------------------------------------------------------
- ; generate 20,21,26,27
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[5 * 32] * cospi_27_64 - input[27 * 32] * cospi_5_64;
- ;temp2 = input[5 * 32] * cospi_5_64 + input[27 * 32] * cospi_27_64;
- ;step1b[20][i] = dct_const_round_shift(temp1);
- ;step1b[27][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 7, 5, 27
- DO_BUTTERFLY_STD cospi_27_64, cospi_5_64, d0, d1, d4, d5
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[21 * 32] * cospi_11_64 - input[11 * 32] * cospi_21_64;
- ;temp2 = input[21 * 32] * cospi_21_64 + input[11 * 32] * cospi_11_64;
- ;step1b[21][i] = dct_const_round_shift(temp1);
- ;step1b[26][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 27, 21, 11
- DO_BUTTERFLY_STD cospi_11_64, cospi_21_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;step2[20] = step1b[20][i] + step1b[21][i];
- ;step2[21] = step1b[20][i] - step1b[21][i];
- ;step2[26] = -step1b[26][i] + step1b[27][i];
- ;step2[27] = step1b[26][i] + step1b[27][i];
- vsub.s16 q13, q0, q1
- vadd.s16 q0, q0, q1
- vsub.s16 q14, q2, q3
- vadd.s16 q2, q2, q3
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;temp1 = step1b[26][i] * cospi_12_64 - step1b[21][i] * cospi_20_64;
- ;temp2 = step1b[26][i] * cospi_20_64 + step1b[21][i] * cospi_12_64;
- ;step3[21] = dct_const_round_shift(temp1);
- ;step3[26] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_12_64, cospi_20_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; generate 22,23,24,25
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[13 * 32] * cospi_19_64 - input[19 * 32] * cospi_13_64;
- ;temp2 = input[13 * 32] * cospi_13_64 + input[19 * 32] * cospi_19_64;
- ;step1b[22][i] = dct_const_round_shift(temp1);
- ;step1b[25][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 11, 13, 19
- DO_BUTTERFLY_STD cospi_19_64, cospi_13_64, d10, d11, d14, d15
- ; --------------------------------------------------------------------------
- ; part of stage 1
- ;temp1 = input[29 * 32] * cospi_3_64 - input[3 * 32] * cospi_29_64;
- ;temp2 = input[29 * 32] * cospi_29_64 + input[3 * 32] * cospi_3_64;
- ;step1b[23][i] = dct_const_round_shift(temp1);
- ;step1b[24][i] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 19, 29, 3
- DO_BUTTERFLY_STD cospi_3_64, cospi_29_64, d8, d9, d12, d13
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;step2[22] = -step1b[22][i] + step1b[23][i];
- ;step2[23] = step1b[22][i] + step1b[23][i];
- ;step2[24] = step1b[24][i] + step1b[25][i];
- ;step2[25] = step1b[24][i] - step1b[25][i];
- vsub.s16 q14, q4, q5
- vadd.s16 q5, q4, q5
- vsub.s16 q13, q6, q7
- vadd.s16 q6, q6, q7
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;temp1 = step1b[22][i] * (-cospi_20_64) - step1b[25][i] * (-cospi_12_64);
- ;temp2 = step1b[22][i] * (-cospi_12_64) + step1b[25][i] * (-cospi_20_64);
- ;step3[25] = dct_const_round_shift(temp1);
- ;step3[22] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD (-cospi_20_64), (-cospi_12_64), d8, d9, d14, d15
- ; --------------------------------------------------------------------------
- ; combine 20-23,24-27
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;step1[22] = step1b[22][i] + step1b[21][i];
- ;step1[23] = step1b[23][i] + step1b[20][i];
- vadd.s16 q10, q7, q1
- vadd.s16 q11, q5, q0
- ;step1[24] = step1b[24][i] + step1b[27][i];
- ;step1[25] = step1b[25][i] + step1b[26][i];
- vadd.s16 q12, q6, q2
- vadd.s16 q15, q4, q3
- ; --------------------------------------------------------------------------
- ; part of stage 6
- ;step3[16] = step1b[16][i] + step1b[23][i];
- ;step3[17] = step1b[17][i] + step1b[22][i];
- ;step3[22] = step1b[17][i] - step1b[22][i];
- ;step3[23] = step1b[16][i] - step1b[23][i];
- LOAD_FROM_OUTPUT 28, 16, 17, q14, q13
- vadd.s16 q8, q14, q11
- vadd.s16 q9, q13, q10
- vsub.s16 q13, q13, q10
- vsub.s16 q11, q14, q11
- STORE_IN_OUTPUT 17, 17, 16, q9, q8
- ; --------------------------------------------------------------------------
- ; part of stage 6
- ;step3[24] = step1b[31][i] - step1b[24][i];
- ;step3[25] = step1b[30][i] - step1b[25][i];
- ;step3[30] = step1b[30][i] + step1b[25][i];
- ;step3[31] = step1b[31][i] + step1b[24][i];
- LOAD_FROM_OUTPUT 16, 30, 31, q14, q9
- vsub.s16 q8, q9, q12
- vadd.s16 q10, q14, q15
- vsub.s16 q14, q14, q15
- vadd.s16 q12, q9, q12
- STORE_IN_OUTPUT 31, 30, 31, q10, q12
- ; --------------------------------------------------------------------------
- ; TODO(cd) do some register allocation change to remove these push/pop
- vpush {q8} ; [24]
- vpush {q11} ; [23]
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;temp1 = (step1b[25][i] - step1b[22][i]) * cospi_16_64;
- ;temp2 = (step1b[25][i] + step1b[22][i]) * cospi_16_64;
- ;step1[22] = dct_const_round_shift(temp1);
- ;step1[25] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d26, d27, d28, d29
- STORE_IN_OUTPUT 31, 25, 22, q14, q13
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;temp1 = (step1b[24][i] - step1b[23][i]) * cospi_16_64;
- ;temp2 = (step1b[24][i] + step1b[23][i]) * cospi_16_64;
- ;step1[23] = dct_const_round_shift(temp1);
- ;step1[24] = dct_const_round_shift(temp2);
- ; TODO(cd) do some register allocation change to remove these push/pop
- vpop {q13} ; [23]
- vpop {q14} ; [24]
- DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d26, d27, d28, d29
- STORE_IN_OUTPUT 22, 24, 23, q14, q13
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;step1[20] = step1b[23][i] - step1b[20][i];
- ;step1[27] = step1b[24][i] - step1b[27][i];
- vsub.s16 q14, q5, q0
- vsub.s16 q13, q6, q2
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;temp1 = step1b[20][i] * (-cospi_8_64) - step1b[27][i] * (-cospi_24_64);
- ;temp2 = step1b[20][i] * (-cospi_24_64) + step1b[27][i] * (-cospi_8_64);
- ;step2[27] = dct_const_round_shift(temp1);
- ;step2[20] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD (-cospi_8_64), (-cospi_24_64), d10, d11, d12, d13
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;step1[21] = step1b[22][i] - step1b[21][i];
- ;step1[26] = step1b[25][i] - step1b[26][i];
- vsub.s16 q14, q7, q1
- vsub.s16 q13, q4, q3
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;temp1 = step1b[21][i] * (-cospi_8_64) - step1b[26][i] * (-cospi_24_64);
- ;temp2 = step1b[21][i] * (-cospi_24_64) + step1b[26][i] * (-cospi_8_64);
- ;step2[26] = dct_const_round_shift(temp1);
- ;step2[21] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD (-cospi_8_64), (-cospi_24_64), d0, d1, d2, d3
- ; --------------------------------------------------------------------------
- ; part of stage 6
- ;step3[18] = step1b[18][i] + step1b[21][i];
- ;step3[19] = step1b[19][i] + step1b[20][i];
- ;step3[20] = step1b[19][i] - step1b[20][i];
- ;step3[21] = step1b[18][i] - step1b[21][i];
- LOAD_FROM_OUTPUT 23, 18, 19, q14, q13
- vadd.s16 q8, q14, q1
- vadd.s16 q9, q13, q6
- vsub.s16 q13, q13, q6
- vsub.s16 q1, q14, q1
- STORE_IN_OUTPUT 19, 18, 19, q8, q9
- ; --------------------------------------------------------------------------
- ; part of stage 6
- ;step3[27] = step1b[28][i] - step1b[27][i];
- ;step3[28] = step1b[28][i] + step1b[27][i];
- ;step3[29] = step1b[29][i] + step1b[26][i];
- ;step3[26] = step1b[29][i] - step1b[26][i];
- LOAD_FROM_OUTPUT 19, 28, 29, q8, q9
- vsub.s16 q14, q8, q5
- vadd.s16 q10, q8, q5
- vadd.s16 q11, q9, q0
- vsub.s16 q0, q9, q0
- STORE_IN_OUTPUT 29, 28, 29, q10, q11
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;temp1 = (step1b[27][i] - step1b[20][i]) * cospi_16_64;
- ;temp2 = (step1b[27][i] + step1b[20][i]) * cospi_16_64;
- ;step1[20] = dct_const_round_shift(temp1);
- ;step1[27] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d26, d27, d28, d29
- STORE_IN_OUTPUT 29, 20, 27, q13, q14
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;temp1 = (step1b[26][i] - step1b[21][i]) * cospi_16_64;
- ;temp2 = (step1b[26][i] + step1b[21][i]) * cospi_16_64;
- ;step1[21] = dct_const_round_shift(temp1);
- ;step1[26] = dct_const_round_shift(temp2);
- DO_BUTTERFLY d0, d1, d2, d3, cospi_16_64, cospi_16_64, d2, d3, d0, d1
- STORE_IN_OUTPUT 27, 21, 26, q1, q0
- ; --------------------------------------------------------------------------
-
-
- ; --------------------------------------------------------------------------
- ; BLOCK C: 8-10,11-15
- ; --------------------------------------------------------------------------
- ; generate 8,9,14,15
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;temp1 = input[2 * 32] * cospi_30_64 - input[30 * 32] * cospi_2_64;
- ;temp2 = input[2 * 32] * cospi_2_64 + input[30 * 32] * cospi_30_64;
- ;step2[8] = dct_const_round_shift(temp1);
- ;step2[15] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 3, 2, 30
- DO_BUTTERFLY_STD cospi_30_64, cospi_2_64, d0, d1, d4, d5
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;temp1 = input[18 * 32] * cospi_14_64 - input[14 * 32] * cospi_18_64;
- ;temp2 = input[18 * 32] * cospi_18_64 + input[14 * 32] * cospi_14_64;
- ;step2[9] = dct_const_round_shift(temp1);
- ;step2[14] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 30, 18, 14
- DO_BUTTERFLY_STD cospi_14_64, cospi_18_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;step3[8] = step1b[8][i] + step1b[9][i];
- ;step3[9] = step1b[8][i] - step1b[9][i];
- ;step3[14] = step1b[15][i] - step1b[14][i];
- ;step3[15] = step1b[15][i] + step1b[14][i];
- vsub.s16 q13, q0, q1
- vadd.s16 q0, q0, q1
- vsub.s16 q14, q2, q3
- vadd.s16 q2, q2, q3
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;temp1 = step1b[14][i] * cospi_24_64 - step1b[9][i] * cospi_8_64;
- ;temp2 = step1b[14][i] * cospi_8_64 + step1b[9][i] * cospi_24_64;
- ;step1[9] = dct_const_round_shift(temp1);
- ;step1[14] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; generate 10,11,12,13
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;temp1 = input[10 * 32] * cospi_22_64 - input[22 * 32] * cospi_10_64;
- ;temp2 = input[10 * 32] * cospi_10_64 + input[22 * 32] * cospi_22_64;
- ;step2[10] = dct_const_round_shift(temp1);
- ;step2[13] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 14, 10, 22
- DO_BUTTERFLY_STD cospi_22_64, cospi_10_64, d10, d11, d14, d15
- ; --------------------------------------------------------------------------
- ; part of stage 2
- ;temp1 = input[26 * 32] * cospi_6_64 - input[6 * 32] * cospi_26_64;
- ;temp2 = input[26 * 32] * cospi_26_64 + input[6 * 32] * cospi_6_64;
- ;step2[11] = dct_const_round_shift(temp1);
- ;step2[12] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 22, 26, 6
- DO_BUTTERFLY_STD cospi_6_64, cospi_26_64, d8, d9, d12, d13
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;step3[10] = step1b[11][i] - step1b[10][i];
- ;step3[11] = step1b[11][i] + step1b[10][i];
- ;step3[12] = step1b[12][i] + step1b[13][i];
- ;step3[13] = step1b[12][i] - step1b[13][i];
- vsub.s16 q14, q4, q5
- vadd.s16 q5, q4, q5
- vsub.s16 q13, q6, q7
- vadd.s16 q6, q6, q7
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;temp1 = step1b[10][i] * (-cospi_8_64) - step1b[13][i] * (-cospi_24_64);
- ;temp2 = step1b[10][i] * (-cospi_24_64) + step1b[13][i] * (-cospi_8_64);
- ;step1[13] = dct_const_round_shift(temp1);
- ;step1[10] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD (-cospi_8_64), (-cospi_24_64), d8, d9, d14, d15
- ; --------------------------------------------------------------------------
- ; combine 8-10,11-15
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;step2[8] = step1b[8][i] + step1b[11][i];
- ;step2[9] = step1b[9][i] + step1b[10][i];
- ;step2[10] = step1b[9][i] - step1b[10][i];
- vadd.s16 q8, q0, q5
- vadd.s16 q9, q1, q7
- vsub.s16 q13, q1, q7
- ;step2[13] = step1b[14][i] - step1b[13][i];
- ;step2[14] = step1b[14][i] + step1b[13][i];
- ;step2[15] = step1b[15][i] + step1b[12][i];
- vsub.s16 q14, q3, q4
- vadd.s16 q10, q3, q4
- vadd.s16 q15, q2, q6
- STORE_IN_OUTPUT 26, 8, 15, q8, q15
- STORE_IN_OUTPUT 15, 9, 14, q9, q10
- ; --------------------------------------------------------------------------
- ; part of stage 6
- ;temp1 = (step1b[13][i] - step1b[10][i]) * cospi_16_64;
- ;temp2 = (step1b[13][i] + step1b[10][i]) * cospi_16_64;
- ;step3[10] = dct_const_round_shift(temp1);
- ;step3[13] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d2, d3, d6, d7
- STORE_IN_OUTPUT 14, 13, 10, q3, q1
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;step2[11] = step1b[8][i] - step1b[11][i];
- ;step2[12] = step1b[15][i] - step1b[12][i];
- vsub.s16 q13, q0, q5
- vsub.s16 q14, q2, q6
- ; --------------------------------------------------------------------------
- ; part of stage 6
- ;temp1 = (step1b[12][i] - step1b[11][i]) * cospi_16_64;
- ;temp2 = (step1b[12][i] + step1b[11][i]) * cospi_16_64;
- ;step3[11] = dct_const_round_shift(temp1);
- ;step3[12] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d2, d3, d6, d7
- STORE_IN_OUTPUT 10, 11, 12, q1, q3
- ; --------------------------------------------------------------------------
-
-
- ; --------------------------------------------------------------------------
- ; BLOCK D: 0-3,4-7
- ; --------------------------------------------------------------------------
- ; generate 4,5,6,7
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;temp1 = input[4 * 32] * cospi_28_64 - input[28 * 32] * cospi_4_64;
- ;temp2 = input[4 * 32] * cospi_4_64 + input[28 * 32] * cospi_28_64;
- ;step3[4] = dct_const_round_shift(temp1);
- ;step3[7] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 6, 4, 28
- DO_BUTTERFLY_STD cospi_28_64, cospi_4_64, d0, d1, d4, d5
- ; --------------------------------------------------------------------------
- ; part of stage 3
- ;temp1 = input[20 * 32] * cospi_12_64 - input[12 * 32] * cospi_20_64;
- ;temp2 = input[20 * 32] * cospi_20_64 + input[12 * 32] * cospi_12_64;
- ;step3[5] = dct_const_round_shift(temp1);
- ;step3[6] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 28, 20, 12
- DO_BUTTERFLY_STD cospi_12_64, cospi_20_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;step1[4] = step1b[4][i] + step1b[5][i];
- ;step1[5] = step1b[4][i] - step1b[5][i];
- ;step1[6] = step1b[7][i] - step1b[6][i];
- ;step1[7] = step1b[7][i] + step1b[6][i];
- vsub.s16 q13, q0, q1
- vadd.s16 q0, q0, q1
- vsub.s16 q14, q2, q3
- vadd.s16 q2, q2, q3
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;temp1 = (step1b[6][i] - step1b[5][i]) * cospi_16_64;
- ;temp2 = (step1b[5][i] + step1b[6][i]) * cospi_16_64;
- ;step2[5] = dct_const_round_shift(temp1);
- ;step2[6] = dct_const_round_shift(temp2);
- DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d2, d3, d6, d7
- ; --------------------------------------------------------------------------
- ; generate 0,1,2,3
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;temp1 = (input[0 * 32] - input[16 * 32]) * cospi_16_64;
- ;temp2 = (input[0 * 32] + input[16 * 32]) * cospi_16_64;
- ;step1[1] = dct_const_round_shift(temp1);
- ;step1[0] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 12, 0, 16
- DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d10, d11, d14, d15
- ; --------------------------------------------------------------------------
- ; part of stage 4
- ;temp1 = input[8 * 32] * cospi_24_64 - input[24 * 32] * cospi_8_64;
- ;temp2 = input[8 * 32] * cospi_8_64 + input[24 * 32] * cospi_24_64;
- ;step1[2] = dct_const_round_shift(temp1);
- ;step1[3] = dct_const_round_shift(temp2);
- LOAD_FROM_TRANSPOSED 16, 8, 24
- DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d28, d29, d12, d13
- ; --------------------------------------------------------------------------
- ; part of stage 5
- ;step2[0] = step1b[0][i] + step1b[3][i];
- ;step2[1] = step1b[1][i] + step1b[2][i];
- ;step2[2] = step1b[1][i] - step1b[2][i];
- ;step2[3] = step1b[0][i] - step1b[3][i];
- vadd.s16 q4, q7, q6
- vsub.s16 q7, q7, q6
- vsub.s16 q6, q5, q14
- vadd.s16 q5, q5, q14
- ; --------------------------------------------------------------------------
- ; combine 0-3,4-7
- ; --------------------------------------------------------------------------
- ; part of stage 6
- ;step3[0] = step1b[0][i] + step1b[7][i];
- ;step3[1] = step1b[1][i] + step1b[6][i];
- ;step3[2] = step1b[2][i] + step1b[5][i];
- ;step3[3] = step1b[3][i] + step1b[4][i];
- vadd.s16 q8, q4, q2
- vadd.s16 q9, q5, q3
- vadd.s16 q10, q6, q1
- vadd.s16 q11, q7, q0
- ;step3[4] = step1b[3][i] - step1b[4][i];
- ;step3[5] = step1b[2][i] - step1b[5][i];
- ;step3[6] = step1b[1][i] - step1b[6][i];
- ;step3[7] = step1b[0][i] - step1b[7][i];
- vsub.s16 q12, q7, q0
- vsub.s16 q13, q6, q1
- vsub.s16 q14, q5, q3
- vsub.s16 q15, q4, q2
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;step1[0] = step1b[0][i] + step1b[15][i];
- ;step1[1] = step1b[1][i] + step1b[14][i];
- ;step1[14] = step1b[1][i] - step1b[14][i];
- ;step1[15] = step1b[0][i] - step1b[15][i];
- LOAD_FROM_OUTPUT 12, 14, 15, q0, q1
- vadd.s16 q2, q8, q1
- vadd.s16 q3, q9, q0
- vsub.s16 q4, q9, q0
- vsub.s16 q5, q8, q1
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[14 * 32] = step1b[14][i] + step1b[17][i];
- ;output[15 * 32] = step1b[15][i] + step1b[16][i];
- ;output[16 * 32] = step1b[15][i] - step1b[16][i];
- ;output[17 * 32] = step1b[14][i] - step1b[17][i];
- LOAD_FROM_OUTPUT 15, 16, 17, q0, q1
- vadd.s16 q8, q4, q1
- vadd.s16 q9, q5, q0
- vsub.s16 q6, q5, q0
- vsub.s16 q7, q4, q1
-
- cmp r5, #0
- bgt idct32_bands_end_2nd_pass
-
-idct32_bands_end_1st_pass
- STORE_IN_OUTPUT 17, 16, 17, q6, q7
- STORE_IN_OUTPUT 17, 14, 15, q8, q9
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 0 * 32] = step1b[0][i] + step1b[31][i];
- ;output[ 1 * 32] = step1b[1][i] + step1b[30][i];
- ;output[30 * 32] = step1b[1][i] - step1b[30][i];
- ;output[31 * 32] = step1b[0][i] - step1b[31][i];
- LOAD_FROM_OUTPUT 15, 30, 31, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_IN_OUTPUT 31, 30, 31, q6, q7
- STORE_IN_OUTPUT 31, 0, 1, q4, q5
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;step1[2] = step1b[2][i] + step1b[13][i];
- ;step1[3] = step1b[3][i] + step1b[12][i];
- ;step1[12] = step1b[3][i] - step1b[12][i];
- ;step1[13] = step1b[2][i] - step1b[13][i];
- LOAD_FROM_OUTPUT 1, 12, 13, q0, q1
- vadd.s16 q2, q10, q1
- vadd.s16 q3, q11, q0
- vsub.s16 q4, q11, q0
- vsub.s16 q5, q10, q1
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[12 * 32] = step1b[12][i] + step1b[19][i];
- ;output[13 * 32] = step1b[13][i] + step1b[18][i];
- ;output[18 * 32] = step1b[13][i] - step1b[18][i];
- ;output[19 * 32] = step1b[12][i] - step1b[19][i];
- LOAD_FROM_OUTPUT 13, 18, 19, q0, q1
- vadd.s16 q8, q4, q1
- vadd.s16 q9, q5, q0
- vsub.s16 q6, q5, q0
- vsub.s16 q7, q4, q1
- STORE_IN_OUTPUT 19, 18, 19, q6, q7
- STORE_IN_OUTPUT 19, 12, 13, q8, q9
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 2 * 32] = step1b[2][i] + step1b[29][i];
- ;output[ 3 * 32] = step1b[3][i] + step1b[28][i];
- ;output[28 * 32] = step1b[3][i] - step1b[28][i];
- ;output[29 * 32] = step1b[2][i] - step1b[29][i];
- LOAD_FROM_OUTPUT 13, 28, 29, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_IN_OUTPUT 29, 28, 29, q6, q7
- STORE_IN_OUTPUT 29, 2, 3, q4, q5
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;step1[4] = step1b[4][i] + step1b[11][i];
- ;step1[5] = step1b[5][i] + step1b[10][i];
- ;step1[10] = step1b[5][i] - step1b[10][i];
- ;step1[11] = step1b[4][i] - step1b[11][i];
- LOAD_FROM_OUTPUT 3, 10, 11, q0, q1
- vadd.s16 q2, q12, q1
- vadd.s16 q3, q13, q0
- vsub.s16 q4, q13, q0
- vsub.s16 q5, q12, q1
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[10 * 32] = step1b[10][i] + step1b[21][i];
- ;output[11 * 32] = step1b[11][i] + step1b[20][i];
- ;output[20 * 32] = step1b[11][i] - step1b[20][i];
- ;output[21 * 32] = step1b[10][i] - step1b[21][i];
- LOAD_FROM_OUTPUT 11, 20, 21, q0, q1
- vadd.s16 q8, q4, q1
- vadd.s16 q9, q5, q0
- vsub.s16 q6, q5, q0
- vsub.s16 q7, q4, q1
- STORE_IN_OUTPUT 21, 20, 21, q6, q7
- STORE_IN_OUTPUT 21, 10, 11, q8, q9
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 4 * 32] = step1b[4][i] + step1b[27][i];
- ;output[ 5 * 32] = step1b[5][i] + step1b[26][i];
- ;output[26 * 32] = step1b[5][i] - step1b[26][i];
- ;output[27 * 32] = step1b[4][i] - step1b[27][i];
- LOAD_FROM_OUTPUT 11, 26, 27, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_IN_OUTPUT 27, 26, 27, q6, q7
- STORE_IN_OUTPUT 27, 4, 5, q4, q5
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;step1[6] = step1b[6][i] + step1b[9][i];
- ;step1[7] = step1b[7][i] + step1b[8][i];
- ;step1[8] = step1b[7][i] - step1b[8][i];
- ;step1[9] = step1b[6][i] - step1b[9][i];
- LOAD_FROM_OUTPUT 5, 8, 9, q0, q1
- vadd.s16 q2, q14, q1
- vadd.s16 q3, q15, q0
- vsub.s16 q4, q15, q0
- vsub.s16 q5, q14, q1
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 8 * 32] = step1b[8][i] + step1b[23][i];
- ;output[ 9 * 32] = step1b[9][i] + step1b[22][i];
- ;output[22 * 32] = step1b[9][i] - step1b[22][i];
- ;output[23 * 32] = step1b[8][i] - step1b[23][i];
- LOAD_FROM_OUTPUT 9, 22, 23, q0, q1
- vadd.s16 q8, q4, q1
- vadd.s16 q9, q5, q0
- vsub.s16 q6, q5, q0
- vsub.s16 q7, q4, q1
- STORE_IN_OUTPUT 23, 22, 23, q6, q7
- STORE_IN_OUTPUT 23, 8, 9, q8, q9
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 6 * 32] = step1b[6][i] + step1b[25][i];
- ;output[ 7 * 32] = step1b[7][i] + step1b[24][i];
- ;output[24 * 32] = step1b[7][i] - step1b[24][i];
- ;output[25 * 32] = step1b[6][i] - step1b[25][i];
- LOAD_FROM_OUTPUT 9, 24, 25, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_IN_OUTPUT 25, 24, 25, q6, q7
- STORE_IN_OUTPUT 25, 6, 7, q4, q5
-
- ; restore r0 by removing the last offset from the last
- ; operation (LOAD_FROM_TRANSPOSED 16, 8, 24) => 24*8*2
- sub r0, r0, #24*8*2
- ; restore r1 by removing the last offset from the last
- ; operation (STORE_IN_OUTPUT 24, 6, 7) => 7*32*2
- ; advance by 8 columns => 8*2
- sub r1, r1, #7*32*2 - 8*2
- ; advance by 8 lines (8*32*2)
- ; go back by the two pairs from the loop (32*2)
- add r3, r3, #8*32*2 - 32*2
-
- ; bands loop processing
- subs r4, r4, #1
- bne idct32_bands_loop
-
- ; parameters for second pass
- ; the input of pass2 is the result of pass1. we have to remove the offset
- ; of 32 columns induced by the above idct32_bands_loop
- sub r3, r1, #32*2
- ; r1 = pass2[32 * 32]
- add r1, sp, #2048
-
- ; pass loop processing
- add r5, r5, #1
- b idct32_pass_loop
-
-idct32_bands_end_2nd_pass
- STORE_COMBINE_CENTER_RESULTS
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 0 * 32] = step1b[0][i] + step1b[31][i];
- ;output[ 1 * 32] = step1b[1][i] + step1b[30][i];
- ;output[30 * 32] = step1b[1][i] - step1b[30][i];
- ;output[31 * 32] = step1b[0][i] - step1b[31][i];
- LOAD_FROM_OUTPUT 17, 30, 31, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_COMBINE_EXTREME_RESULTS
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;step1[2] = step1b[2][i] + step1b[13][i];
- ;step1[3] = step1b[3][i] + step1b[12][i];
- ;step1[12] = step1b[3][i] - step1b[12][i];
- ;step1[13] = step1b[2][i] - step1b[13][i];
- LOAD_FROM_OUTPUT 31, 12, 13, q0, q1
- vadd.s16 q2, q10, q1
- vadd.s16 q3, q11, q0
- vsub.s16 q4, q11, q0
- vsub.s16 q5, q10, q1
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[12 * 32] = step1b[12][i] + step1b[19][i];
- ;output[13 * 32] = step1b[13][i] + step1b[18][i];
- ;output[18 * 32] = step1b[13][i] - step1b[18][i];
- ;output[19 * 32] = step1b[12][i] - step1b[19][i];
- LOAD_FROM_OUTPUT 13, 18, 19, q0, q1
- vadd.s16 q8, q4, q1
- vadd.s16 q9, q5, q0
- vsub.s16 q6, q5, q0
- vsub.s16 q7, q4, q1
- STORE_COMBINE_CENTER_RESULTS
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 2 * 32] = step1b[2][i] + step1b[29][i];
- ;output[ 3 * 32] = step1b[3][i] + step1b[28][i];
- ;output[28 * 32] = step1b[3][i] - step1b[28][i];
- ;output[29 * 32] = step1b[2][i] - step1b[29][i];
- LOAD_FROM_OUTPUT 19, 28, 29, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_COMBINE_EXTREME_RESULTS
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;step1[4] = step1b[4][i] + step1b[11][i];
- ;step1[5] = step1b[5][i] + step1b[10][i];
- ;step1[10] = step1b[5][i] - step1b[10][i];
- ;step1[11] = step1b[4][i] - step1b[11][i];
- LOAD_FROM_OUTPUT 29, 10, 11, q0, q1
- vadd.s16 q2, q12, q1
- vadd.s16 q3, q13, q0
- vsub.s16 q4, q13, q0
- vsub.s16 q5, q12, q1
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[10 * 32] = step1b[10][i] + step1b[21][i];
- ;output[11 * 32] = step1b[11][i] + step1b[20][i];
- ;output[20 * 32] = step1b[11][i] - step1b[20][i];
- ;output[21 * 32] = step1b[10][i] - step1b[21][i];
- LOAD_FROM_OUTPUT 11, 20, 21, q0, q1
- vadd.s16 q8, q4, q1
- vadd.s16 q9, q5, q0
- vsub.s16 q6, q5, q0
- vsub.s16 q7, q4, q1
- STORE_COMBINE_CENTER_RESULTS
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 4 * 32] = step1b[4][i] + step1b[27][i];
- ;output[ 5 * 32] = step1b[5][i] + step1b[26][i];
- ;output[26 * 32] = step1b[5][i] - step1b[26][i];
- ;output[27 * 32] = step1b[4][i] - step1b[27][i];
- LOAD_FROM_OUTPUT 21, 26, 27, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_COMBINE_EXTREME_RESULTS
- ; --------------------------------------------------------------------------
- ; part of stage 7
- ;step1[6] = step1b[6][i] + step1b[9][i];
- ;step1[7] = step1b[7][i] + step1b[8][i];
- ;step1[8] = step1b[7][i] - step1b[8][i];
- ;step1[9] = step1b[6][i] - step1b[9][i];
- LOAD_FROM_OUTPUT 27, 8, 9, q0, q1
- vadd.s16 q2, q14, q1
- vadd.s16 q3, q15, q0
- vsub.s16 q4, q15, q0
- vsub.s16 q5, q14, q1
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 8 * 32] = step1b[8][i] + step1b[23][i];
- ;output[ 9 * 32] = step1b[9][i] + step1b[22][i];
- ;output[22 * 32] = step1b[9][i] - step1b[22][i];
- ;output[23 * 32] = step1b[8][i] - step1b[23][i];
- LOAD_FROM_OUTPUT 9, 22, 23, q0, q1
- vadd.s16 q8, q4, q1
- vadd.s16 q9, q5, q0
- vsub.s16 q6, q5, q0
- vsub.s16 q7, q4, q1
- STORE_COMBINE_CENTER_RESULTS_LAST
- ; --------------------------------------------------------------------------
- ; part of final stage
- ;output[ 6 * 32] = step1b[6][i] + step1b[25][i];
- ;output[ 7 * 32] = step1b[7][i] + step1b[24][i];
- ;output[24 * 32] = step1b[7][i] - step1b[24][i];
- ;output[25 * 32] = step1b[6][i] - step1b[25][i];
- LOAD_FROM_OUTPUT 23, 24, 25, q0, q1
- vadd.s16 q4, q2, q1
- vadd.s16 q5, q3, q0
- vsub.s16 q6, q3, q0
- vsub.s16 q7, q2, q1
- STORE_COMBINE_EXTREME_RESULTS_LAST
- ; --------------------------------------------------------------------------
- ; restore pointers to their initial indices for next band pass by
- ; removing/adding dest_stride * 8. The actual increment by eight
- ; is taken care of within the _LAST macros.
- add r6, r6, r2, lsl #3
- add r9, r9, r2, lsl #3
- sub r7, r7, r2, lsl #3
- sub r10, r10, r2, lsl #3
-
- ; restore r0 by removing the last offset from the last
- ; operation (LOAD_FROM_TRANSPOSED 16, 8, 24) => 24*8*2
- sub r0, r0, #24*8*2
- ; restore r1 by removing the last offset from the last
- ; operation (LOAD_FROM_OUTPUT 23, 24, 25) => 25*32*2
- ; advance by 8 columns => 8*2
- sub r1, r1, #25*32*2 - 8*2
- ; advance by 8 lines (8*32*2)
- ; go back by the two pairs from the loop (32*2)
- add r3, r3, #8*32*2 - 32*2
-
- ; bands loop processing
- subs r4, r4, #1
- bne idct32_bands_loop
-
- ; stack operation
- add sp, sp, #512+2048+2048
- vpop {d8-d15}
- pop {r4-r11}
- bx lr
- ENDP ; |vp9_idct32x32_1024_add_neon|
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.asm
deleted file mode 100644
index 0d4a721..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_1_add_neon.asm
+++ /dev/null
@@ -1,68 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
-
- EXPORT |vp9_idct4x4_1_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp9_idct4x4_1_add_neon(int16_t *input, uint8_t *dest,
-; int dest_stride)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride)
-
-|vp9_idct4x4_1_add_neon| PROC
- ldrsh r0, [r0]
-
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
-
- ; out = dct_const_round_shift(input[0] * cospi_16_64)
- mul r0, r0, r12 ; input[0] * cospi_16_64
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; out = dct_const_round_shift(out * cospi_16_64)
- mul r0, r0, r12 ; out * cospi_16_64
- mov r12, r1 ; save dest
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; a1 = ROUND_POWER_OF_TWO(out, 4)
- add r0, r0, #8 ; + (1 <<((4) - 1))
- asr r0, r0, #4 ; >> 4
-
- vdup.s16 q0, r0 ; duplicate a1
-
- vld1.32 {d2[0]}, [r1], r2
- vld1.32 {d2[1]}, [r1], r2
- vld1.32 {d4[0]}, [r1], r2
- vld1.32 {d4[1]}, [r1]
-
- vaddw.u8 q8, q0, d2 ; dest[x] + a1
- vaddw.u8 q9, q0, d4
-
- vqmovun.s16 d6, q8 ; clip_pixel
- vqmovun.s16 d7, q9
-
- vst1.32 {d6[0]}, [r12], r2
- vst1.32 {d6[1]}, [r12], r2
- vst1.32 {d7[0]}, [r12], r2
- vst1.32 {d7[1]}, [r12]
-
- bx lr
- ENDP ; |vp9_idct4x4_1_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_add_neon.asm
deleted file mode 100644
index 00283fc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct4x4_add_neon.asm
+++ /dev/null
@@ -1,190 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_idct4x4_16_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- AREA Block, CODE, READONLY ; name this block of code
-;void vp9_idct4x4_16_add_neon(int16_t *input, uint8_t *dest, int dest_stride)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride)
-
-|vp9_idct4x4_16_add_neon| PROC
-
- ; The 2D transform is done with two passes which are actually pretty
- ; similar. We first transform the rows. This is done by transposing
- ; the inputs, doing an SIMD column transform (the columns are the
- ; transposed rows) and then transpose the results (so that it goes back
- ; in normal/row positions). Then, we transform the columns by doing
- ; another SIMD column transform.
- ; So, two passes of a transpose followed by a column transform.
-
- ; load the inputs into q8-q9, d16-d19
- vld1.s16 {q8,q9}, [r0]!
-
- ; generate scalar constants
- ; cospi_8_64 = 15137 = 0x3b21
- mov r0, #0x3b00
- add r0, #0x21
- ; cospi_16_64 = 11585 = 0x2d41
- mov r3, #0x2d00
- add r3, #0x41
- ; cospi_24_64 = 6270 = 0x 187e
- mov r12, #0x1800
- add r12, #0x7e
-
- ; transpose the input data
- ; 00 01 02 03 d16
- ; 10 11 12 13 d17
- ; 20 21 22 23 d18
- ; 30 31 32 33 d19
- vtrn.16 d16, d17
- vtrn.16 d18, d19
-
- ; generate constant vectors
- vdup.16 d20, r0 ; replicate cospi_8_64
- vdup.16 d21, r3 ; replicate cospi_16_64
-
- ; 00 10 02 12 d16
- ; 01 11 03 13 d17
- ; 20 30 22 32 d18
- ; 21 31 23 33 d19
- vtrn.32 q8, q9
- ; 00 10 20 30 d16
- ; 01 11 21 31 d17
- ; 02 12 22 32 d18
- ; 03 13 23 33 d19
-
- vdup.16 d22, r12 ; replicate cospi_24_64
-
- ; do the transform on transposed rows
-
- ; stage 1
- vadd.s16 d23, d16, d18 ; (input[0] + input[2])
- vsub.s16 d24, d16, d18 ; (input[0] - input[2])
-
- vmull.s16 q15, d17, d22 ; input[1] * cospi_24_64
- vmull.s16 q1, d17, d20 ; input[1] * cospi_8_64
-
- ; (input[0] + input[2]) * cospi_16_64;
- ; (input[0] - input[2]) * cospi_16_64;
- vmull.s16 q13, d23, d21
- vmull.s16 q14, d24, d21
-
- ; input[1] * cospi_24_64 - input[3] * cospi_8_64;
- ; input[1] * cospi_8_64 + input[3] * cospi_24_64;
- vmlsl.s16 q15, d19, d20
- vmlal.s16 q1, d19, d22
-
- ; dct_const_round_shift
- vqrshrn.s32 d26, q13, #14
- vqrshrn.s32 d27, q14, #14
- vqrshrn.s32 d29, q15, #14
- vqrshrn.s32 d28, q1, #14
-
- ; stage 2
- ; output[0] = step[0] + step[3];
- ; output[1] = step[1] + step[2];
- ; output[3] = step[0] - step[3];
- ; output[2] = step[1] - step[2];
- vadd.s16 q8, q13, q14
- vsub.s16 q9, q13, q14
- vswp d18, d19
-
- ; transpose the results
- ; 00 01 02 03 d16
- ; 10 11 12 13 d17
- ; 20 21 22 23 d18
- ; 30 31 32 33 d19
- vtrn.16 d16, d17
- vtrn.16 d18, d19
- ; 00 10 02 12 d16
- ; 01 11 03 13 d17
- ; 20 30 22 32 d18
- ; 21 31 23 33 d19
- vtrn.32 q8, q9
- ; 00 10 20 30 d16
- ; 01 11 21 31 d17
- ; 02 12 22 32 d18
- ; 03 13 23 33 d19
-
- ; do the transform on columns
-
- ; stage 1
- vadd.s16 d23, d16, d18 ; (input[0] + input[2])
- vsub.s16 d24, d16, d18 ; (input[0] - input[2])
-
- vmull.s16 q15, d17, d22 ; input[1] * cospi_24_64
- vmull.s16 q1, d17, d20 ; input[1] * cospi_8_64
-
- ; (input[0] + input[2]) * cospi_16_64;
- ; (input[0] - input[2]) * cospi_16_64;
- vmull.s16 q13, d23, d21
- vmull.s16 q14, d24, d21
-
- ; input[1] * cospi_24_64 - input[3] * cospi_8_64;
- ; input[1] * cospi_8_64 + input[3] * cospi_24_64;
- vmlsl.s16 q15, d19, d20
- vmlal.s16 q1, d19, d22
-
- ; dct_const_round_shift
- vqrshrn.s32 d26, q13, #14
- vqrshrn.s32 d27, q14, #14
- vqrshrn.s32 d29, q15, #14
- vqrshrn.s32 d28, q1, #14
-
- ; stage 2
- ; output[0] = step[0] + step[3];
- ; output[1] = step[1] + step[2];
- ; output[3] = step[0] - step[3];
- ; output[2] = step[1] - step[2];
- vadd.s16 q8, q13, q14
- vsub.s16 q9, q13, q14
-
- ; The results are in two registers, one of them being swapped. This will
- ; be taken care of by loading the 'dest' value in a swapped fashion and
- ; also storing them in the same swapped fashion.
- ; temp_out[0, 1] = d16, d17 = q8
- ; temp_out[2, 3] = d19, d18 = q9 swapped
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 4)
- vrshr.s16 q8, q8, #4
- vrshr.s16 q9, q9, #4
-
- vld1.32 {d26[0]}, [r1], r2
- vld1.32 {d26[1]}, [r1], r2
- vld1.32 {d27[1]}, [r1], r2
- vld1.32 {d27[0]}, [r1] ; no post-increment
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 4) + dest[j * dest_stride + i]
- vaddw.u8 q8, q8, d26
- vaddw.u8 q9, q9, d27
-
- ; clip_pixel
- vqmovun.s16 d26, q8
- vqmovun.s16 d27, q9
-
- ; do the stores in reverse order with negative post-increment, by changing
- ; the sign of the stride
- rsb r2, r2, #0
- vst1.32 {d27[0]}, [r1], r2
- vst1.32 {d27[1]}, [r1], r2
- vst1.32 {d26[1]}, [r1], r2
- vst1.32 {d26[0]}, [r1] ; no post-increment
- bx lr
- ENDP ; |vp9_idct4x4_16_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.asm
deleted file mode 100644
index 421d202..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_1_add_neon.asm
+++ /dev/null
@@ -1,88 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license and patent
-; grant that can be found in the LICENSE file in the root of the source
-; tree. All contributing project authors may be found in the AUTHORS
-; file in the root of the source tree.
-;
-
-
- EXPORT |vp9_idct8x8_1_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp9_idct8x8_1_add_neon(int16_t *input, uint8_t *dest,
-; int dest_stride)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride)
-
-|vp9_idct8x8_1_add_neon| PROC
- ldrsh r0, [r0]
-
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
-
- ; out = dct_const_round_shift(input[0] * cospi_16_64)
- mul r0, r0, r12 ; input[0] * cospi_16_64
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; out = dct_const_round_shift(out * cospi_16_64)
- mul r0, r0, r12 ; out * cospi_16_64
- mov r12, r1 ; save dest
- add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
- asr r0, r0, #14 ; >> DCT_CONST_BITS
-
- ; a1 = ROUND_POWER_OF_TWO(out, 5)
- add r0, r0, #16 ; + (1 <<((5) - 1))
- asr r0, r0, #5 ; >> 5
-
- vdup.s16 q0, r0 ; duplicate a1
-
- ; load destination data
- vld1.64 {d2}, [r1], r2
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r2
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r2
- vld1.64 {d7}, [r1], r2
- vld1.64 {d16}, [r1], r2
- vld1.64 {d17}, [r1]
-
- vaddw.u8 q9, q0, d2 ; dest[x] + a1
- vaddw.u8 q10, q0, d3 ; dest[x] + a1
- vaddw.u8 q11, q0, d4 ; dest[x] + a1
- vaddw.u8 q12, q0, d5 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r2
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r2
- vst1.64 {d31}, [r12], r2
-
- vaddw.u8 q9, q0, d6 ; dest[x] + a1
- vaddw.u8 q10, q0, d7 ; dest[x] + a1
- vaddw.u8 q11, q0, d16 ; dest[x] + a1
- vaddw.u8 q12, q0, d17 ; dest[x] + a1
- vqmovun.s16 d2, q9 ; clip_pixel
- vqmovun.s16 d3, q10 ; clip_pixel
- vqmovun.s16 d30, q11 ; clip_pixel
- vqmovun.s16 d31, q12 ; clip_pixel
- vst1.64 {d2}, [r12], r2
- vst1.64 {d3}, [r12], r2
- vst1.64 {d30}, [r12], r2
- vst1.64 {d31}, [r12], r2
-
- bx lr
- ENDP ; |vp9_idct8x8_1_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_add_neon.asm
deleted file mode 100644
index 5476400..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_idct8x8_add_neon.asm
+++ /dev/null
@@ -1,519 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_idct8x8_64_add_neon|
- EXPORT |vp9_idct8x8_10_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- ; Parallel 1D IDCT on all the columns of a 8x8 16bit data matrix which are
- ; loaded in q8-q15. The output will be stored back into q8-q15 registers.
- ; This macro will touch q0-q7 registers and use them as buffer during
- ; calculation.
- MACRO
- IDCT8x8_1D
- ; stage 1
- vdup.16 d0, r3 ; duplicate cospi_28_64
- vdup.16 d1, r4 ; duplicate cospi_4_64
- vdup.16 d2, r5 ; duplicate cospi_12_64
- vdup.16 d3, r6 ; duplicate cospi_20_64
-
- ; input[1] * cospi_28_64
- vmull.s16 q2, d18, d0
- vmull.s16 q3, d19, d0
-
- ; input[5] * cospi_12_64
- vmull.s16 q5, d26, d2
- vmull.s16 q6, d27, d2
-
- ; input[1]*cospi_28_64-input[7]*cospi_4_64
- vmlsl.s16 q2, d30, d1
- vmlsl.s16 q3, d31, d1
-
- ; input[5] * cospi_12_64 - input[3] * cospi_20_64
- vmlsl.s16 q5, d22, d3
- vmlsl.s16 q6, d23, d3
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d8, q2, #14 ; >> 14
- vqrshrn.s32 d9, q3, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d10, q5, #14 ; >> 14
- vqrshrn.s32 d11, q6, #14 ; >> 14
-
- ; input[1] * cospi_4_64
- vmull.s16 q2, d18, d1
- vmull.s16 q3, d19, d1
-
- ; input[5] * cospi_20_64
- vmull.s16 q9, d26, d3
- vmull.s16 q13, d27, d3
-
- ; input[1]*cospi_4_64+input[7]*cospi_28_64
- vmlal.s16 q2, d30, d0
- vmlal.s16 q3, d31, d0
-
- ; input[5] * cospi_20_64 + input[3] * cospi_12_64
- vmlal.s16 q9, d22, d2
- vmlal.s16 q13, d23, d2
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d14, q2, #14 ; >> 14
- vqrshrn.s32 d15, q3, #14 ; >> 14
-
- ; stage 2 & stage 3 - even half
- vdup.16 d0, r7 ; duplicate cospi_16_64
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d12, q9, #14 ; >> 14
- vqrshrn.s32 d13, q13, #14 ; >> 14
-
- ; input[0] * cospi_16_64
- vmull.s16 q2, d16, d0
- vmull.s16 q3, d17, d0
-
- ; input[0] * cospi_16_64
- vmull.s16 q13, d16, d0
- vmull.s16 q15, d17, d0
-
- ; (input[0] + input[2]) * cospi_16_64
- vmlal.s16 q2, d24, d0
- vmlal.s16 q3, d25, d0
-
- ; (input[0] - input[2]) * cospi_16_64
- vmlsl.s16 q13, d24, d0
- vmlsl.s16 q15, d25, d0
-
- vdup.16 d0, r8 ; duplicate cospi_24_64
- vdup.16 d1, r9 ; duplicate cospi_8_64
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d18, q2, #14 ; >> 14
- vqrshrn.s32 d19, q3, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d22, q13, #14 ; >> 14
- vqrshrn.s32 d23, q15, #14 ; >> 14
-
- ; input[1] * cospi_24_64 - input[3] * cospi_8_64
- ; input[1] * cospi_24_64
- vmull.s16 q2, d20, d0
- vmull.s16 q3, d21, d0
-
- ; input[1] * cospi_8_64
- vmull.s16 q8, d20, d1
- vmull.s16 q12, d21, d1
-
- ; input[1] * cospi_24_64 - input[3] * cospi_8_64
- vmlsl.s16 q2, d28, d1
- vmlsl.s16 q3, d29, d1
-
- ; input[1] * cospi_8_64 + input[3] * cospi_24_64
- vmlal.s16 q8, d28, d0
- vmlal.s16 q12, d29, d0
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d26, q2, #14 ; >> 14
- vqrshrn.s32 d27, q3, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d30, q8, #14 ; >> 14
- vqrshrn.s32 d31, q12, #14 ; >> 14
-
- vadd.s16 q0, q9, q15 ; output[0] = step[0] + step[3]
- vadd.s16 q1, q11, q13 ; output[1] = step[1] + step[2]
- vsub.s16 q2, q11, q13 ; output[2] = step[1] - step[2]
- vsub.s16 q3, q9, q15 ; output[3] = step[0] - step[3]
-
- ; stage 3 -odd half
- vdup.16 d16, r7 ; duplicate cospi_16_64
-
- ; stage 2 - odd half
- vsub.s16 q13, q4, q5 ; step2[5] = step1[4] - step1[5]
- vadd.s16 q4, q4, q5 ; step2[4] = step1[4] + step1[5]
- vsub.s16 q14, q7, q6 ; step2[6] = -step1[6] + step1[7]
- vadd.s16 q7, q7, q6 ; step2[7] = step1[6] + step1[7]
-
- ; step2[6] * cospi_16_64
- vmull.s16 q9, d28, d16
- vmull.s16 q10, d29, d16
-
- ; step2[6] * cospi_16_64
- vmull.s16 q11, d28, d16
- vmull.s16 q12, d29, d16
-
- ; (step2[6] - step2[5]) * cospi_16_64
- vmlsl.s16 q9, d26, d16
- vmlsl.s16 q10, d27, d16
-
- ; (step2[5] + step2[6]) * cospi_16_64
- vmlal.s16 q11, d26, d16
- vmlal.s16 q12, d27, d16
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d10, q9, #14 ; >> 14
- vqrshrn.s32 d11, q10, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d12, q11, #14 ; >> 14
- vqrshrn.s32 d13, q12, #14 ; >> 14
-
- ; stage 4
- vadd.s16 q8, q0, q7 ; output[0] = step1[0] + step1[7];
- vadd.s16 q9, q1, q6 ; output[1] = step1[1] + step1[6];
- vadd.s16 q10, q2, q5 ; output[2] = step1[2] + step1[5];
- vadd.s16 q11, q3, q4 ; output[3] = step1[3] + step1[4];
- vsub.s16 q12, q3, q4 ; output[4] = step1[3] - step1[4];
- vsub.s16 q13, q2, q5 ; output[5] = step1[2] - step1[5];
- vsub.s16 q14, q1, q6 ; output[6] = step1[1] - step1[6];
- vsub.s16 q15, q0, q7 ; output[7] = step1[0] - step1[7];
- MEND
-
- ; Transpose a 8x8 16bit data matrix. Datas are loaded in q8-q15.
- MACRO
- TRANSPOSE8X8
- vswp d17, d24
- vswp d23, d30
- vswp d21, d28
- vswp d19, d26
- vtrn.32 q8, q10
- vtrn.32 q9, q11
- vtrn.32 q12, q14
- vtrn.32 q13, q15
- vtrn.16 q8, q9
- vtrn.16 q10, q11
- vtrn.16 q12, q13
- vtrn.16 q14, q15
- MEND
-
- AREA Block, CODE, READONLY ; name this block of code
-;void vp9_idct8x8_64_add_neon(int16_t *input, uint8_t *dest, int dest_stride)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride)
-
-|vp9_idct8x8_64_add_neon| PROC
- push {r4-r9}
- vpush {d8-d15}
- vld1.s16 {q8,q9}, [r0]!
- vld1.s16 {q10,q11}, [r0]!
- vld1.s16 {q12,q13}, [r0]!
- vld1.s16 {q14,q15}, [r0]!
-
- ; transpose the input data
- TRANSPOSE8X8
-
- ; generate cospi_28_64 = 3196
- mov r3, #0x0c00
- add r3, #0x7c
-
- ; generate cospi_4_64 = 16069
- mov r4, #0x3e00
- add r4, #0xc5
-
- ; generate cospi_12_64 = 13623
- mov r5, #0x3500
- add r5, #0x37
-
- ; generate cospi_20_64 = 9102
- mov r6, #0x2300
- add r6, #0x8e
-
- ; generate cospi_16_64 = 11585
- mov r7, #0x2d00
- add r7, #0x41
-
- ; generate cospi_24_64 = 6270
- mov r8, #0x1800
- add r8, #0x7e
-
- ; generate cospi_8_64 = 15137
- mov r9, #0x3b00
- add r9, #0x21
-
- ; First transform rows
- IDCT8x8_1D
-
- ; Transpose the matrix
- TRANSPOSE8X8
-
- ; Then transform columns
- IDCT8x8_1D
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 5)
- vrshr.s16 q8, q8, #5
- vrshr.s16 q9, q9, #5
- vrshr.s16 q10, q10, #5
- vrshr.s16 q11, q11, #5
- vrshr.s16 q12, q12, #5
- vrshr.s16 q13, q13, #5
- vrshr.s16 q14, q14, #5
- vrshr.s16 q15, q15, #5
-
- ; save dest pointer
- mov r0, r1
-
- ; load destination data
- vld1.64 {d0}, [r1], r2
- vld1.64 {d1}, [r1], r2
- vld1.64 {d2}, [r1], r2
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r2
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r2
- vld1.64 {d7}, [r1]
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 5) + dest[j * dest_stride + i]
- vaddw.u8 q8, q8, d0
- vaddw.u8 q9, q9, d1
- vaddw.u8 q10, q10, d2
- vaddw.u8 q11, q11, d3
- vaddw.u8 q12, q12, d4
- vaddw.u8 q13, q13, d5
- vaddw.u8 q14, q14, d6
- vaddw.u8 q15, q15, d7
-
- ; clip_pixel
- vqmovun.s16 d0, q8
- vqmovun.s16 d1, q9
- vqmovun.s16 d2, q10
- vqmovun.s16 d3, q11
- vqmovun.s16 d4, q12
- vqmovun.s16 d5, q13
- vqmovun.s16 d6, q14
- vqmovun.s16 d7, q15
-
- ; store the data
- vst1.64 {d0}, [r0], r2
- vst1.64 {d1}, [r0], r2
- vst1.64 {d2}, [r0], r2
- vst1.64 {d3}, [r0], r2
- vst1.64 {d4}, [r0], r2
- vst1.64 {d5}, [r0], r2
- vst1.64 {d6}, [r0], r2
- vst1.64 {d7}, [r0], r2
-
- vpop {d8-d15}
- pop {r4-r9}
- bx lr
- ENDP ; |vp9_idct8x8_64_add_neon|
-
-;void vp9_idct8x8_10_add_neon(int16_t *input, uint8_t *dest, int dest_stride)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride)
-
-|vp9_idct8x8_10_add_neon| PROC
- push {r4-r9}
- vpush {d8-d15}
- vld1.s16 {q8,q9}, [r0]!
- vld1.s16 {q10,q11}, [r0]!
- vld1.s16 {q12,q13}, [r0]!
- vld1.s16 {q14,q15}, [r0]!
-
- ; transpose the input data
- TRANSPOSE8X8
-
- ; generate cospi_28_64 = 3196
- mov r3, #0x0c00
- add r3, #0x7c
-
- ; generate cospi_4_64 = 16069
- mov r4, #0x3e00
- add r4, #0xc5
-
- ; generate cospi_12_64 = 13623
- mov r5, #0x3500
- add r5, #0x37
-
- ; generate cospi_20_64 = 9102
- mov r6, #0x2300
- add r6, #0x8e
-
- ; generate cospi_16_64 = 11585
- mov r7, #0x2d00
- add r7, #0x41
-
- ; generate cospi_24_64 = 6270
- mov r8, #0x1800
- add r8, #0x7e
-
- ; generate cospi_8_64 = 15137
- mov r9, #0x3b00
- add r9, #0x21
-
- ; First transform rows
- ; stage 1
- ; The following instructions use vqrdmulh to do the
- ; dct_const_round_shift(input[1] * cospi_28_64). vqrdmulh will do doubling
- ; multiply and shift the result by 16 bits instead of 14 bits. So we need
- ; to double the constants before multiplying to compensate this.
- mov r12, r3, lsl #1
- vdup.16 q0, r12 ; duplicate cospi_28_64*2
- mov r12, r4, lsl #1
- vdup.16 q1, r12 ; duplicate cospi_4_64*2
-
- ; dct_const_round_shift(input[1] * cospi_28_64)
- vqrdmulh.s16 q4, q9, q0
-
- mov r12, r6, lsl #1
- rsb r12, #0
- vdup.16 q0, r12 ; duplicate -cospi_20_64*2
-
- ; dct_const_round_shift(input[1] * cospi_4_64)
- vqrdmulh.s16 q7, q9, q1
-
- mov r12, r5, lsl #1
- vdup.16 q1, r12 ; duplicate cospi_12_64*2
-
- ; dct_const_round_shift(- input[3] * cospi_20_64)
- vqrdmulh.s16 q5, q11, q0
-
- mov r12, r7, lsl #1
- vdup.16 q0, r12 ; duplicate cospi_16_64*2
-
- ; dct_const_round_shift(input[3] * cospi_12_64)
- vqrdmulh.s16 q6, q11, q1
-
- ; stage 2 & stage 3 - even half
- mov r12, r8, lsl #1
- vdup.16 q1, r12 ; duplicate cospi_24_64*2
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrdmulh.s16 q9, q8, q0
-
- mov r12, r9, lsl #1
- vdup.16 q0, r12 ; duplicate cospi_8_64*2
-
- ; dct_const_round_shift(input[1] * cospi_24_64)
- vqrdmulh.s16 q13, q10, q1
-
- ; dct_const_round_shift(input[1] * cospi_8_64)
- vqrdmulh.s16 q15, q10, q0
-
- ; stage 3 -odd half
- vdup.16 d16, r7 ; duplicate cospi_16_64
-
- vadd.s16 q0, q9, q15 ; output[0] = step[0] + step[3]
- vadd.s16 q1, q9, q13 ; output[1] = step[1] + step[2]
- vsub.s16 q2, q9, q13 ; output[2] = step[1] - step[2]
- vsub.s16 q3, q9, q15 ; output[3] = step[0] - step[3]
-
- ; stage 2 - odd half
- vsub.s16 q13, q4, q5 ; step2[5] = step1[4] - step1[5]
- vadd.s16 q4, q4, q5 ; step2[4] = step1[4] + step1[5]
- vsub.s16 q14, q7, q6 ; step2[6] = -step1[6] + step1[7]
- vadd.s16 q7, q7, q6 ; step2[7] = step1[6] + step1[7]
-
- ; step2[6] * cospi_16_64
- vmull.s16 q9, d28, d16
- vmull.s16 q10, d29, d16
-
- ; step2[6] * cospi_16_64
- vmull.s16 q11, d28, d16
- vmull.s16 q12, d29, d16
-
- ; (step2[6] - step2[5]) * cospi_16_64
- vmlsl.s16 q9, d26, d16
- vmlsl.s16 q10, d27, d16
-
- ; (step2[5] + step2[6]) * cospi_16_64
- vmlal.s16 q11, d26, d16
- vmlal.s16 q12, d27, d16
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d10, q9, #14 ; >> 14
- vqrshrn.s32 d11, q10, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d12, q11, #14 ; >> 14
- vqrshrn.s32 d13, q12, #14 ; >> 14
-
- ; stage 4
- vadd.s16 q8, q0, q7 ; output[0] = step1[0] + step1[7];
- vadd.s16 q9, q1, q6 ; output[1] = step1[1] + step1[6];
- vadd.s16 q10, q2, q5 ; output[2] = step1[2] + step1[5];
- vadd.s16 q11, q3, q4 ; output[3] = step1[3] + step1[4];
- vsub.s16 q12, q3, q4 ; output[4] = step1[3] - step1[4];
- vsub.s16 q13, q2, q5 ; output[5] = step1[2] - step1[5];
- vsub.s16 q14, q1, q6 ; output[6] = step1[1] - step1[6];
- vsub.s16 q15, q0, q7 ; output[7] = step1[0] - step1[7];
-
- ; Transpose the matrix
- TRANSPOSE8X8
-
- ; Then transform columns
- IDCT8x8_1D
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 5)
- vrshr.s16 q8, q8, #5
- vrshr.s16 q9, q9, #5
- vrshr.s16 q10, q10, #5
- vrshr.s16 q11, q11, #5
- vrshr.s16 q12, q12, #5
- vrshr.s16 q13, q13, #5
- vrshr.s16 q14, q14, #5
- vrshr.s16 q15, q15, #5
-
- ; save dest pointer
- mov r0, r1
-
- ; load destination data
- vld1.64 {d0}, [r1], r2
- vld1.64 {d1}, [r1], r2
- vld1.64 {d2}, [r1], r2
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r2
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r2
- vld1.64 {d7}, [r1]
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 5) + dest[j * dest_stride + i]
- vaddw.u8 q8, q8, d0
- vaddw.u8 q9, q9, d1
- vaddw.u8 q10, q10, d2
- vaddw.u8 q11, q11, d3
- vaddw.u8 q12, q12, d4
- vaddw.u8 q13, q13, d5
- vaddw.u8 q14, q14, d6
- vaddw.u8 q15, q15, d7
-
- ; clip_pixel
- vqmovun.s16 d0, q8
- vqmovun.s16 d1, q9
- vqmovun.s16 d2, q10
- vqmovun.s16 d3, q11
- vqmovun.s16 d4, q12
- vqmovun.s16 d5, q13
- vqmovun.s16 d6, q14
- vqmovun.s16 d7, q15
-
- ; store the data
- vst1.64 {d0}, [r0], r2
- vst1.64 {d1}, [r0], r2
- vst1.64 {d2}, [r0], r2
- vst1.64 {d3}, [r0], r2
- vst1.64 {d4}, [r0], r2
- vst1.64 {d5}, [r0], r2
- vst1.64 {d6}, [r0], r2
- vst1.64 {d7}, [r0], r2
-
- vpop {d8-d15}
- pop {r4-r9}
- bx lr
- ENDP ; |vp9_idct8x8_10_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht4x4_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht4x4_add_neon.asm
deleted file mode 100644
index 2f326e2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht4x4_add_neon.asm
+++ /dev/null
@@ -1,237 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_iht4x4_16_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- ; Parallel 1D IDCT on all the columns of a 4x4 16bits data matrix which are
- ; loaded in d16-d19. d0 must contain cospi_8_64. d1 must contain
- ; cospi_16_64. d2 must contain cospi_24_64. The output will be stored back
- ; into d16-d19 registers. This macro will touch q10- q15 registers and use
- ; them as buffer during calculation.
- MACRO
- IDCT4x4_1D
- ; stage 1
- vadd.s16 d23, d16, d18 ; (input[0] + input[2])
- vsub.s16 d24, d16, d18 ; (input[0] - input[2])
-
- vmull.s16 q15, d17, d2 ; input[1] * cospi_24_64
- vmull.s16 q10, d17, d0 ; input[1] * cospi_8_64
- vmull.s16 q13, d23, d1 ; (input[0] + input[2]) * cospi_16_64
- vmull.s16 q14, d24, d1 ; (input[0] - input[2]) * cospi_16_64
- vmlsl.s16 q15, d19, d0 ; input[1] * cospi_24_64 - input[3] * cospi_8_64
- vmlal.s16 q10, d19, d2 ; input[1] * cospi_8_64 + input[3] * cospi_24_64
-
- ; dct_const_round_shift
- vqrshrn.s32 d26, q13, #14
- vqrshrn.s32 d27, q14, #14
- vqrshrn.s32 d29, q15, #14
- vqrshrn.s32 d28, q10, #14
-
- ; stage 2
- ; output[0] = step[0] + step[3];
- ; output[1] = step[1] + step[2];
- ; output[3] = step[0] - step[3];
- ; output[2] = step[1] - step[2];
- vadd.s16 q8, q13, q14
- vsub.s16 q9, q13, q14
- vswp d18, d19
- MEND
-
- ; Parallel 1D IADST on all the columns of a 4x4 16bits data matrix which
- ; loaded in d16-d19. d3 must contain sinpi_1_9. d4 must contain sinpi_2_9.
- ; d5 must contain sinpi_4_9. d6 must contain sinpi_3_9. The output will be
- ; stored back into d16-d19 registers. This macro will touch q11,q12,q13,
- ; q14,q15 registers and use them as buffer during calculation.
- MACRO
- IADST4x4_1D
- vmull.s16 q10, d3, d16 ; s0 = sinpi_1_9 * x0
- vmull.s16 q11, d4, d16 ; s1 = sinpi_2_9 * x0
- vmull.s16 q12, d6, d17 ; s2 = sinpi_3_9 * x1
- vmull.s16 q13, d5, d18 ; s3 = sinpi_4_9 * x2
- vmull.s16 q14, d3, d18 ; s4 = sinpi_1_9 * x2
- vmovl.s16 q15, d16 ; expand x0 from 16 bit to 32 bit
- vaddw.s16 q15, q15, d19 ; x0 + x3
- vmull.s16 q8, d4, d19 ; s5 = sinpi_2_9 * x3
- vsubw.s16 q15, q15, d18 ; s7 = x0 + x3 - x2
- vmull.s16 q9, d5, d19 ; s6 = sinpi_4_9 * x3
-
- vadd.s32 q10, q10, q13 ; x0 = s0 + s3 + s5
- vadd.s32 q10, q10, q8
- vsub.s32 q11, q11, q14 ; x1 = s1 - s4 - s6
- vdup.32 q8, r0 ; duplicate sinpi_3_9
- vsub.s32 q11, q11, q9
- vmul.s32 q15, q15, q8 ; x2 = sinpi_3_9 * s7
-
- vadd.s32 q13, q10, q12 ; s0 = x0 + x3
- vadd.s32 q10, q10, q11 ; x0 + x1
- vadd.s32 q14, q11, q12 ; s1 = x1 + x3
- vsub.s32 q10, q10, q12 ; s3 = x0 + x1 - x3
-
- ; dct_const_round_shift
- vqrshrn.s32 d16, q13, #14
- vqrshrn.s32 d17, q14, #14
- vqrshrn.s32 d18, q15, #14
- vqrshrn.s32 d19, q10, #14
- MEND
-
- ; Generate cosine constants in d6 - d8 for the IDCT
- MACRO
- GENERATE_COSINE_CONSTANTS
- ; cospi_8_64 = 15137 = 0x3b21
- mov r0, #0x3b00
- add r0, #0x21
- ; cospi_16_64 = 11585 = 0x2d41
- mov r3, #0x2d00
- add r3, #0x41
- ; cospi_24_64 = 6270 = 0x187e
- mov r12, #0x1800
- add r12, #0x7e
-
- ; generate constant vectors
- vdup.16 d0, r0 ; duplicate cospi_8_64
- vdup.16 d1, r3 ; duplicate cospi_16_64
- vdup.16 d2, r12 ; duplicate cospi_24_64
- MEND
-
- ; Generate sine constants in d1 - d4 for the IADST.
- MACRO
- GENERATE_SINE_CONSTANTS
- ; sinpi_1_9 = 5283 = 0x14A3
- mov r0, #0x1400
- add r0, #0xa3
- ; sinpi_2_9 = 9929 = 0x26C9
- mov r3, #0x2600
- add r3, #0xc9
- ; sinpi_4_9 = 15212 = 0x3B6C
- mov r12, #0x3b00
- add r12, #0x6c
-
- ; generate constant vectors
- vdup.16 d3, r0 ; duplicate sinpi_1_9
-
- ; sinpi_3_9 = 13377 = 0x3441
- mov r0, #0x3400
- add r0, #0x41
-
- vdup.16 d4, r3 ; duplicate sinpi_2_9
- vdup.16 d5, r12 ; duplicate sinpi_4_9
- vdup.16 q3, r0 ; duplicate sinpi_3_9
- MEND
-
- ; Transpose a 4x4 16bits data matrix. Datas are loaded in d16-d19.
- MACRO
- TRANSPOSE4X4
- vtrn.16 d16, d17
- vtrn.16 d18, d19
- vtrn.32 q8, q9
- MEND
-
- AREA Block, CODE, READONLY ; name this block of code
-;void vp9_iht4x4_16_add_neon(int16_t *input, uint8_t *dest,
-; int dest_stride, int tx_type)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride
-; r3 int tx_type)
-; This function will only handle tx_type of 1,2,3.
-|vp9_iht4x4_16_add_neon| PROC
-
- ; load the inputs into d16-d19
- vld1.s16 {q8,q9}, [r0]!
-
- ; transpose the input data
- TRANSPOSE4X4
-
- ; decide the type of transform
- cmp r3, #2
- beq idct_iadst
- cmp r3, #3
- beq iadst_iadst
-
-iadst_idct
- ; generate constants
- GENERATE_COSINE_CONSTANTS
- GENERATE_SINE_CONSTANTS
-
- ; first transform rows
- IDCT4x4_1D
-
- ; transpose the matrix
- TRANSPOSE4X4
-
- ; then transform columns
- IADST4x4_1D
-
- b end_vp9_iht4x4_16_add_neon
-
-idct_iadst
- ; generate constants
- GENERATE_COSINE_CONSTANTS
- GENERATE_SINE_CONSTANTS
-
- ; first transform rows
- IADST4x4_1D
-
- ; transpose the matrix
- TRANSPOSE4X4
-
- ; then transform columns
- IDCT4x4_1D
-
- b end_vp9_iht4x4_16_add_neon
-
-iadst_iadst
- ; generate constants
- GENERATE_SINE_CONSTANTS
-
- ; first transform rows
- IADST4x4_1D
-
- ; transpose the matrix
- TRANSPOSE4X4
-
- ; then transform columns
- IADST4x4_1D
-
-end_vp9_iht4x4_16_add_neon
- ; ROUND_POWER_OF_TWO(temp_out[j], 4)
- vrshr.s16 q8, q8, #4
- vrshr.s16 q9, q9, #4
-
- vld1.32 {d26[0]}, [r1], r2
- vld1.32 {d26[1]}, [r1], r2
- vld1.32 {d27[0]}, [r1], r2
- vld1.32 {d27[1]}, [r1]
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 4) + dest[j * dest_stride + i]
- vaddw.u8 q8, q8, d26
- vaddw.u8 q9, q9, d27
-
- ; clip_pixel
- vqmovun.s16 d26, q8
- vqmovun.s16 d27, q9
-
- ; do the stores in reverse order with negative post-increment, by changing
- ; the sign of the stride
- rsb r2, r2, #0
- vst1.32 {d27[1]}, [r1], r2
- vst1.32 {d27[0]}, [r1], r2
- vst1.32 {d26[1]}, [r1], r2
- vst1.32 {d26[0]}, [r1] ; no post-increment
- bx lr
- ENDP ; |vp9_iht4x4_16_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht8x8_add_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht8x8_add_neon.asm
deleted file mode 100644
index b41f566..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_iht8x8_add_neon.asm
+++ /dev/null
@@ -1,698 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_iht8x8_64_add_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
- ; Generate IADST constants in r0 - r12 for the IADST.
- MACRO
- GENERATE_IADST_CONSTANTS
- ; generate cospi_2_64 = 16305
- mov r0, #0x3f00
- add r0, #0xb1
-
- ; generate cospi_30_64 = 1606
- mov r1, #0x600
- add r1, #0x46
-
- ; generate cospi_10_64 = 14449
- mov r2, #0x3800
- add r2, #0x71
-
- ; generate cospi_22_64 = 7723
- mov r3, #0x1e00
- add r3, #0x2b
-
- ; generate cospi_18_64 = 10394
- mov r4, #0x2800
- add r4, #0x9a
-
- ; generate cospi_14_64 = 12665
- mov r5, #0x3100
- add r5, #0x79
-
- ; generate cospi_26_64 = 4756
- mov r6, #0x1200
- add r6, #0x94
-
- ; generate cospi_6_64 = 15679
- mov r7, #0x3d00
- add r7, #0x3f
-
- ; generate cospi_8_64 = 15137
- mov r8, #0x3b00
- add r8, #0x21
-
- ; generate cospi_24_64 = 6270
- mov r9, #0x1800
- add r9, #0x7e
-
- ; generate 0
- mov r10, #0
-
- ; generate cospi_16_64 = 11585
- mov r12, #0x2d00
- add r12, #0x41
- MEND
-
- ; Generate IDCT constants in r3 - r9 for the IDCT.
- MACRO
- GENERATE_IDCT_CONSTANTS
- ; generate cospi_28_64 = 3196
- mov r3, #0x0c00
- add r3, #0x7c
-
- ; generate cospi_4_64 = 16069
- mov r4, #0x3e00
- add r4, #0xc5
-
- ; generate cospi_12_64 = 13623
- mov r5, #0x3500
- add r5, #0x37
-
- ; generate cospi_20_64 = 9102
- mov r6, #0x2300
- add r6, #0x8e
-
- ; generate cospi_16_64 = 11585
- mov r7, #0x2d00
- add r7, #0x41
-
- ; generate cospi_24_64 = 6270
- mov r8, #0x1800
- add r8, #0x7e
-
- ; generate cospi_8_64 = 15137
- mov r9, #0x3b00
- add r9, #0x21
- MEND
-
- ; Transpose a 8x8 16bits data matrix. Datas are loaded in q8-q15.
- MACRO
- TRANSPOSE8X8
- vswp d17, d24
- vswp d23, d30
- vswp d21, d28
- vswp d19, d26
- vtrn.32 q8, q10
- vtrn.32 q9, q11
- vtrn.32 q12, q14
- vtrn.32 q13, q15
- vtrn.16 q8, q9
- vtrn.16 q10, q11
- vtrn.16 q12, q13
- vtrn.16 q14, q15
- MEND
-
- ; Parallel 1D IDCT on all the columns of a 8x8 16bits data matrix which are
- ; loaded in q8-q15. The IDCT constants are loaded in r3 - r9. The output
- ; will be stored back into q8-q15 registers. This macro will touch q0-q7
- ; registers and use them as buffer during calculation.
- MACRO
- IDCT8x8_1D
- ; stage 1
- vdup.16 d0, r3 ; duplicate cospi_28_64
- vdup.16 d1, r4 ; duplicate cospi_4_64
- vdup.16 d2, r5 ; duplicate cospi_12_64
- vdup.16 d3, r6 ; duplicate cospi_20_64
-
- ; input[1] * cospi_28_64
- vmull.s16 q2, d18, d0
- vmull.s16 q3, d19, d0
-
- ; input[5] * cospi_12_64
- vmull.s16 q5, d26, d2
- vmull.s16 q6, d27, d2
-
- ; input[1]*cospi_28_64-input[7]*cospi_4_64
- vmlsl.s16 q2, d30, d1
- vmlsl.s16 q3, d31, d1
-
- ; input[5] * cospi_12_64 - input[3] * cospi_20_64
- vmlsl.s16 q5, d22, d3
- vmlsl.s16 q6, d23, d3
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d8, q2, #14 ; >> 14
- vqrshrn.s32 d9, q3, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d10, q5, #14 ; >> 14
- vqrshrn.s32 d11, q6, #14 ; >> 14
-
- ; input[1] * cospi_4_64
- vmull.s16 q2, d18, d1
- vmull.s16 q3, d19, d1
-
- ; input[5] * cospi_20_64
- vmull.s16 q9, d26, d3
- vmull.s16 q13, d27, d3
-
- ; input[1]*cospi_4_64+input[7]*cospi_28_64
- vmlal.s16 q2, d30, d0
- vmlal.s16 q3, d31, d0
-
- ; input[5] * cospi_20_64 + input[3] * cospi_12_64
- vmlal.s16 q9, d22, d2
- vmlal.s16 q13, d23, d2
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d14, q2, #14 ; >> 14
- vqrshrn.s32 d15, q3, #14 ; >> 14
-
- ; stage 2 & stage 3 - even half
- vdup.16 d0, r7 ; duplicate cospi_16_64
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d12, q9, #14 ; >> 14
- vqrshrn.s32 d13, q13, #14 ; >> 14
-
- ; input[0] * cospi_16_64
- vmull.s16 q2, d16, d0
- vmull.s16 q3, d17, d0
-
- ; input[0] * cospi_16_64
- vmull.s16 q13, d16, d0
- vmull.s16 q15, d17, d0
-
- ; (input[0] + input[2]) * cospi_16_64
- vmlal.s16 q2, d24, d0
- vmlal.s16 q3, d25, d0
-
- ; (input[0] - input[2]) * cospi_16_64
- vmlsl.s16 q13, d24, d0
- vmlsl.s16 q15, d25, d0
-
- vdup.16 d0, r8 ; duplicate cospi_24_64
- vdup.16 d1, r9 ; duplicate cospi_8_64
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d18, q2, #14 ; >> 14
- vqrshrn.s32 d19, q3, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d22, q13, #14 ; >> 14
- vqrshrn.s32 d23, q15, #14 ; >> 14
-
- ; input[1] * cospi_24_64
- vmull.s16 q2, d20, d0
- vmull.s16 q3, d21, d0
-
- ; input[1] * cospi_8_64
- vmull.s16 q8, d20, d1
- vmull.s16 q12, d21, d1
-
- ; input[1] * cospi_24_64 - input[3] * cospi_8_64
- vmlsl.s16 q2, d28, d1
- vmlsl.s16 q3, d29, d1
-
- ; input[1] * cospi_8_64 + input[3] * cospi_24_64
- vmlal.s16 q8, d28, d0
- vmlal.s16 q12, d29, d0
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d26, q2, #14 ; >> 14
- vqrshrn.s32 d27, q3, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d30, q8, #14 ; >> 14
- vqrshrn.s32 d31, q12, #14 ; >> 14
-
- vadd.s16 q0, q9, q15 ; output[0] = step[0] + step[3]
- vadd.s16 q1, q11, q13 ; output[1] = step[1] + step[2]
- vsub.s16 q2, q11, q13 ; output[2] = step[1] - step[2]
- vsub.s16 q3, q9, q15 ; output[3] = step[0] - step[3]
-
- ; stage 3 -odd half
- vdup.16 d16, r7 ; duplicate cospi_16_64
-
- ; stage 2 - odd half
- vsub.s16 q13, q4, q5 ; step2[5] = step1[4] - step1[5]
- vadd.s16 q4, q4, q5 ; step2[4] = step1[4] + step1[5]
- vsub.s16 q14, q7, q6 ; step2[6] = -step1[6] + step1[7]
- vadd.s16 q7, q7, q6 ; step2[7] = step1[6] + step1[7]
-
- ; step2[6] * cospi_16_64
- vmull.s16 q9, d28, d16
- vmull.s16 q10, d29, d16
-
- ; step2[6] * cospi_16_64
- vmull.s16 q11, d28, d16
- vmull.s16 q12, d29, d16
-
- ; (step2[6] - step2[5]) * cospi_16_64
- vmlsl.s16 q9, d26, d16
- vmlsl.s16 q10, d27, d16
-
- ; (step2[5] + step2[6]) * cospi_16_64
- vmlal.s16 q11, d26, d16
- vmlal.s16 q12, d27, d16
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d10, q9, #14 ; >> 14
- vqrshrn.s32 d11, q10, #14 ; >> 14
-
- ; dct_const_round_shift(input_dc * cospi_16_64)
- vqrshrn.s32 d12, q11, #14 ; >> 14
- vqrshrn.s32 d13, q12, #14 ; >> 14
-
- ; stage 4
- vadd.s16 q8, q0, q7 ; output[0] = step1[0] + step1[7];
- vadd.s16 q9, q1, q6 ; output[1] = step1[1] + step1[6];
- vadd.s16 q10, q2, q5 ; output[2] = step1[2] + step1[5];
- vadd.s16 q11, q3, q4 ; output[3] = step1[3] + step1[4];
- vsub.s16 q12, q3, q4 ; output[4] = step1[3] - step1[4];
- vsub.s16 q13, q2, q5 ; output[5] = step1[2] - step1[5];
- vsub.s16 q14, q1, q6 ; output[6] = step1[1] - step1[6];
- vsub.s16 q15, q0, q7 ; output[7] = step1[0] - step1[7];
- MEND
-
- ; Parallel 1D IADST on all the columns of a 8x8 16bits data matrix which
- ; loaded in q8-q15. IADST constants are loaded in r0 - r12 registers. The
- ; output will be stored back into q8-q15 registers. This macro will touch
- ; q0 - q7 registers and use them as buffer during calculation.
- MACRO
- IADST8X8_1D
- vdup.16 d14, r0 ; duplicate cospi_2_64
- vdup.16 d15, r1 ; duplicate cospi_30_64
-
- ; cospi_2_64 * x0
- vmull.s16 q1, d30, d14
- vmull.s16 q2, d31, d14
-
- ; cospi_30_64 * x0
- vmull.s16 q3, d30, d15
- vmull.s16 q4, d31, d15
-
- vdup.16 d30, r4 ; duplicate cospi_18_64
- vdup.16 d31, r5 ; duplicate cospi_14_64
-
- ; s0 = cospi_2_64 * x0 + cospi_30_64 * x1;
- vmlal.s16 q1, d16, d15
- vmlal.s16 q2, d17, d15
-
- ; s1 = cospi_30_64 * x0 - cospi_2_64 * x1
- vmlsl.s16 q3, d16, d14
- vmlsl.s16 q4, d17, d14
-
- ; cospi_18_64 * x4
- vmull.s16 q5, d22, d30
- vmull.s16 q6, d23, d30
-
- ; cospi_14_64 * x4
- vmull.s16 q7, d22, d31
- vmull.s16 q8, d23, d31
-
- ; s4 = cospi_18_64 * x4 + cospi_14_64 * x5;
- vmlal.s16 q5, d24, d31
- vmlal.s16 q6, d25, d31
-
- ; s5 = cospi_14_64 * x4 - cospi_18_64 * x5
- vmlsl.s16 q7, d24, d30
- vmlsl.s16 q8, d25, d30
-
- ; (s0 + s4)
- vadd.s32 q11, q1, q5
- vadd.s32 q12, q2, q6
-
- vdup.16 d0, r2 ; duplicate cospi_10_64
- vdup.16 d1, r3 ; duplicate cospi_22_64
-
- ; (s0 - s4)
- vsub.s32 q1, q1, q5
- vsub.s32 q2, q2, q6
-
- ; x0 = dct_const_round_shift(s0 + s4);
- vqrshrn.s32 d22, q11, #14 ; >> 14
- vqrshrn.s32 d23, q12, #14 ; >> 14
-
- ; (s1 + s5)
- vadd.s32 q12, q3, q7
- vadd.s32 q15, q4, q8
-
- ; (s1 - s5)
- vsub.s32 q3, q3, q7
- vsub.s32 q4, q4, q8
-
- ; x4 = dct_const_round_shift(s0 - s4);
- vqrshrn.s32 d2, q1, #14 ; >> 14
- vqrshrn.s32 d3, q2, #14 ; >> 14
-
- ; x1 = dct_const_round_shift(s1 + s5);
- vqrshrn.s32 d24, q12, #14 ; >> 14
- vqrshrn.s32 d25, q15, #14 ; >> 14
-
- ; x5 = dct_const_round_shift(s1 - s5);
- vqrshrn.s32 d6, q3, #14 ; >> 14
- vqrshrn.s32 d7, q4, #14 ; >> 14
-
- ; cospi_10_64 * x2
- vmull.s16 q4, d26, d0
- vmull.s16 q5, d27, d0
-
- ; cospi_22_64 * x2
- vmull.s16 q2, d26, d1
- vmull.s16 q6, d27, d1
-
- vdup.16 d30, r6 ; duplicate cospi_26_64
- vdup.16 d31, r7 ; duplicate cospi_6_64
-
- ; s2 = cospi_10_64 * x2 + cospi_22_64 * x3;
- vmlal.s16 q4, d20, d1
- vmlal.s16 q5, d21, d1
-
- ; s3 = cospi_22_64 * x2 - cospi_10_64 * x3;
- vmlsl.s16 q2, d20, d0
- vmlsl.s16 q6, d21, d0
-
- ; cospi_26_64 * x6
- vmull.s16 q0, d18, d30
- vmull.s16 q13, d19, d30
-
- ; s6 = cospi_26_64 * x6 + cospi_6_64 * x7;
- vmlal.s16 q0, d28, d31
- vmlal.s16 q13, d29, d31
-
- ; cospi_6_64 * x6
- vmull.s16 q10, d18, d31
- vmull.s16 q9, d19, d31
-
- ; s7 = cospi_6_64 * x6 - cospi_26_64 * x7;
- vmlsl.s16 q10, d28, d30
- vmlsl.s16 q9, d29, d30
-
- ; (s3 + s7)
- vadd.s32 q14, q2, q10
- vadd.s32 q15, q6, q9
-
- ; (s3 - s7)
- vsub.s32 q2, q2, q10
- vsub.s32 q6, q6, q9
-
- ; x3 = dct_const_round_shift(s3 + s7);
- vqrshrn.s32 d28, q14, #14 ; >> 14
- vqrshrn.s32 d29, q15, #14 ; >> 14
-
- ; x7 = dct_const_round_shift(s3 - s7);
- vqrshrn.s32 d4, q2, #14 ; >> 14
- vqrshrn.s32 d5, q6, #14 ; >> 14
-
- ; (s2 + s6)
- vadd.s32 q9, q4, q0
- vadd.s32 q10, q5, q13
-
- ; (s2 - s6)
- vsub.s32 q4, q4, q0
- vsub.s32 q5, q5, q13
-
- vdup.16 d30, r8 ; duplicate cospi_8_64
- vdup.16 d31, r9 ; duplicate cospi_24_64
-
- ; x2 = dct_const_round_shift(s2 + s6);
- vqrshrn.s32 d18, q9, #14 ; >> 14
- vqrshrn.s32 d19, q10, #14 ; >> 14
-
- ; x6 = dct_const_round_shift(s2 - s6);
- vqrshrn.s32 d8, q4, #14 ; >> 14
- vqrshrn.s32 d9, q5, #14 ; >> 14
-
- ; cospi_8_64 * x4
- vmull.s16 q5, d2, d30
- vmull.s16 q6, d3, d30
-
- ; cospi_24_64 * x4
- vmull.s16 q7, d2, d31
- vmull.s16 q0, d3, d31
-
- ; s4 = cospi_8_64 * x4 + cospi_24_64 * x5;
- vmlal.s16 q5, d6, d31
- vmlal.s16 q6, d7, d31
-
- ; s5 = cospi_24_64 * x4 - cospi_8_64 * x5;
- vmlsl.s16 q7, d6, d30
- vmlsl.s16 q0, d7, d30
-
- ; cospi_8_64 * x7
- vmull.s16 q1, d4, d30
- vmull.s16 q3, d5, d30
-
- ; cospi_24_64 * x7
- vmull.s16 q10, d4, d31
- vmull.s16 q2, d5, d31
-
- ; s6 = -cospi_24_64 * x6 + cospi_8_64 * x7;
- vmlsl.s16 q1, d8, d31
- vmlsl.s16 q3, d9, d31
-
- ; s7 = cospi_8_64 * x6 + cospi_24_64 * x7;
- vmlal.s16 q10, d8, d30
- vmlal.s16 q2, d9, d30
-
- vadd.s16 q8, q11, q9 ; x0 = s0 + s2;
-
- vsub.s16 q11, q11, q9 ; x2 = s0 - s2;
-
- vadd.s16 q4, q12, q14 ; x1 = s1 + s3;
-
- vsub.s16 q12, q12, q14 ; x3 = s1 - s3;
-
- ; (s4 + s6)
- vadd.s32 q14, q5, q1
- vadd.s32 q15, q6, q3
-
- ; (s4 - s6)
- vsub.s32 q5, q5, q1
- vsub.s32 q6, q6, q3
-
- ; x4 = dct_const_round_shift(s4 + s6);
- vqrshrn.s32 d18, q14, #14 ; >> 14
- vqrshrn.s32 d19, q15, #14 ; >> 14
-
- ; x6 = dct_const_round_shift(s4 - s6);
- vqrshrn.s32 d10, q5, #14 ; >> 14
- vqrshrn.s32 d11, q6, #14 ; >> 14
-
- ; (s5 + s7)
- vadd.s32 q1, q7, q10
- vadd.s32 q3, q0, q2
-
- ; (s5 - s7))
- vsub.s32 q7, q7, q10
- vsub.s32 q0, q0, q2
-
- ; x5 = dct_const_round_shift(s5 + s7);
- vqrshrn.s32 d28, q1, #14 ; >> 14
- vqrshrn.s32 d29, q3, #14 ; >> 14
-
- ; x7 = dct_const_round_shift(s5 - s7);
- vqrshrn.s32 d14, q7, #14 ; >> 14
- vqrshrn.s32 d15, q0, #14 ; >> 14
-
- vdup.16 d30, r12 ; duplicate cospi_16_64
-
- ; cospi_16_64 * x2
- vmull.s16 q2, d22, d30
- vmull.s16 q3, d23, d30
-
- ; cospi_6_64 * x6
- vmull.s16 q13, d22, d30
- vmull.s16 q1, d23, d30
-
- ; cospi_16_64 * x2 + cospi_16_64 * x3;
- vmlal.s16 q2, d24, d30
- vmlal.s16 q3, d25, d30
-
- ; cospi_16_64 * x2 - cospi_16_64 * x3;
- vmlsl.s16 q13, d24, d30
- vmlsl.s16 q1, d25, d30
-
- ; x2 = dct_const_round_shift(s2);
- vqrshrn.s32 d4, q2, #14 ; >> 14
- vqrshrn.s32 d5, q3, #14 ; >> 14
-
- ;x3 = dct_const_round_shift(s3);
- vqrshrn.s32 d24, q13, #14 ; >> 14
- vqrshrn.s32 d25, q1, #14 ; >> 14
-
- ; cospi_16_64 * x6
- vmull.s16 q13, d10, d30
- vmull.s16 q1, d11, d30
-
- ; cospi_6_64 * x6
- vmull.s16 q11, d10, d30
- vmull.s16 q0, d11, d30
-
- ; cospi_16_64 * x6 + cospi_16_64 * x7;
- vmlal.s16 q13, d14, d30
- vmlal.s16 q1, d15, d30
-
- ; cospi_16_64 * x6 - cospi_16_64 * x7;
- vmlsl.s16 q11, d14, d30
- vmlsl.s16 q0, d15, d30
-
- ; x6 = dct_const_round_shift(s6);
- vqrshrn.s32 d20, q13, #14 ; >> 14
- vqrshrn.s32 d21, q1, #14 ; >> 14
-
- ;x7 = dct_const_round_shift(s7);
- vqrshrn.s32 d12, q11, #14 ; >> 14
- vqrshrn.s32 d13, q0, #14 ; >> 14
-
- vdup.16 q5, r10 ; duplicate 0
-
- vsub.s16 q9, q5, q9 ; output[1] = -x4;
- vsub.s16 q11, q5, q2 ; output[3] = -x2;
- vsub.s16 q13, q5, q6 ; output[5] = -x7;
- vsub.s16 q15, q5, q4 ; output[7] = -x1;
- MEND
-
-
- AREA Block, CODE, READONLY ; name this block of code
-;void vp9_iht8x8_64_add_neon(int16_t *input, uint8_t *dest,
-; int dest_stride, int tx_type)
-;
-; r0 int16_t input
-; r1 uint8_t *dest
-; r2 int dest_stride
-; r3 int tx_type)
-; This function will only handle tx_type of 1,2,3.
-|vp9_iht8x8_64_add_neon| PROC
-
- ; load the inputs into d16-d19
- vld1.s16 {q8,q9}, [r0]!
- vld1.s16 {q10,q11}, [r0]!
- vld1.s16 {q12,q13}, [r0]!
- vld1.s16 {q14,q15}, [r0]!
-
- push {r0-r10}
- vpush {d8-d15}
-
- ; transpose the input data
- TRANSPOSE8X8
-
- ; decide the type of transform
- cmp r3, #2
- beq idct_iadst
- cmp r3, #3
- beq iadst_iadst
-
-iadst_idct
- ; generate IDCT constants
- GENERATE_IDCT_CONSTANTS
-
- ; first transform rows
- IDCT8x8_1D
-
- ; transpose the matrix
- TRANSPOSE8X8
-
- ; generate IADST constants
- GENERATE_IADST_CONSTANTS
-
- ; then transform columns
- IADST8X8_1D
-
- b end_vp9_iht8x8_64_add_neon
-
-idct_iadst
- ; generate IADST constants
- GENERATE_IADST_CONSTANTS
-
- ; first transform rows
- IADST8X8_1D
-
- ; transpose the matrix
- TRANSPOSE8X8
-
- ; generate IDCT constants
- GENERATE_IDCT_CONSTANTS
-
- ; then transform columns
- IDCT8x8_1D
-
- b end_vp9_iht8x8_64_add_neon
-
-iadst_iadst
- ; generate IADST constants
- GENERATE_IADST_CONSTANTS
-
- ; first transform rows
- IADST8X8_1D
-
- ; transpose the matrix
- TRANSPOSE8X8
-
- ; then transform columns
- IADST8X8_1D
-
-end_vp9_iht8x8_64_add_neon
- vpop {d8-d15}
- pop {r0-r10}
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 5)
- vrshr.s16 q8, q8, #5
- vrshr.s16 q9, q9, #5
- vrshr.s16 q10, q10, #5
- vrshr.s16 q11, q11, #5
- vrshr.s16 q12, q12, #5
- vrshr.s16 q13, q13, #5
- vrshr.s16 q14, q14, #5
- vrshr.s16 q15, q15, #5
-
- ; save dest pointer
- mov r0, r1
-
- ; load destination data
- vld1.64 {d0}, [r1], r2
- vld1.64 {d1}, [r1], r2
- vld1.64 {d2}, [r1], r2
- vld1.64 {d3}, [r1], r2
- vld1.64 {d4}, [r1], r2
- vld1.64 {d5}, [r1], r2
- vld1.64 {d6}, [r1], r2
- vld1.64 {d7}, [r1]
-
- ; ROUND_POWER_OF_TWO(temp_out[j], 5) + dest[j * dest_stride + i]
- vaddw.u8 q8, q8, d0
- vaddw.u8 q9, q9, d1
- vaddw.u8 q10, q10, d2
- vaddw.u8 q11, q11, d3
- vaddw.u8 q12, q12, d4
- vaddw.u8 q13, q13, d5
- vaddw.u8 q14, q14, d6
- vaddw.u8 q15, q15, d7
-
- ; clip_pixel
- vqmovun.s16 d0, q8
- vqmovun.s16 d1, q9
- vqmovun.s16 d2, q10
- vqmovun.s16 d3, q11
- vqmovun.s16 d4, q12
- vqmovun.s16 d5, q13
- vqmovun.s16 d6, q14
- vqmovun.s16 d7, q15
-
- ; store the data
- vst1.64 {d0}, [r0], r2
- vst1.64 {d1}, [r0], r2
- vst1.64 {d2}, [r0], r2
- vst1.64 {d3}, [r0], r2
- vst1.64 {d4}, [r0], r2
- vst1.64 {d5}, [r0], r2
- vst1.64 {d6}, [r0], r2
- vst1.64 {d7}, [r0], r2
- bx lr
- ENDP ; |vp9_iht8x8_64_add_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.asm
deleted file mode 100644
index 5b8ec20..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.asm
+++ /dev/null
@@ -1,199 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_lpf_horizontal_4_dual_neon|
- ARM
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp9_lpf_horizontal_4_dual_neon(uint8_t *s, int p,
-; const uint8_t *blimit0,
-; const uint8_t *limit0,
-; const uint8_t *thresh0,
-; const uint8_t *blimit1,
-; const uint8_t *limit1,
-; const uint8_t *thresh1)
-; r0 uint8_t *s,
-; r1 int p,
-; r2 const uint8_t *blimit0,
-; r3 const uint8_t *limit0,
-; sp const uint8_t *thresh0,
-; sp+4 const uint8_t *blimit1,
-; sp+8 const uint8_t *limit1,
-; sp+12 const uint8_t *thresh1,
-
-|vp9_lpf_horizontal_4_dual_neon| PROC
- push {lr}
-
- ldr r12, [sp, #4] ; load thresh0
- vld1.8 {d0}, [r2] ; load blimit0 to first half q
- vld1.8 {d2}, [r3] ; load limit0 to first half q
-
- add r1, r1, r1 ; double pitch
- ldr r2, [sp, #8] ; load blimit1
-
- vld1.8 {d4}, [r12] ; load thresh0 to first half q
-
- ldr r3, [sp, #12] ; load limit1
- ldr r12, [sp, #16] ; load thresh1
- vld1.8 {d1}, [r2] ; load blimit1 to 2nd half q
-
- sub r2, r0, r1, lsl #1 ; s[-4 * p]
-
- vld1.8 {d3}, [r3] ; load limit1 to 2nd half q
- vld1.8 {d5}, [r12] ; load thresh1 to 2nd half q
-
- vpush {d8-d15} ; save neon registers
-
- add r3, r2, r1, lsr #1 ; s[-3 * p]
-
- vld1.u8 {q3}, [r2@64], r1 ; p3
- vld1.u8 {q4}, [r3@64], r1 ; p2
- vld1.u8 {q5}, [r2@64], r1 ; p1
- vld1.u8 {q6}, [r3@64], r1 ; p0
- vld1.u8 {q7}, [r2@64], r1 ; q0
- vld1.u8 {q8}, [r3@64], r1 ; q1
- vld1.u8 {q9}, [r2@64] ; q2
- vld1.u8 {q10}, [r3@64] ; q3
-
- sub r2, r2, r1, lsl #1
- sub r3, r3, r1, lsl #1
-
- bl vp9_loop_filter_neon_16
-
- vst1.u8 {q5}, [r2@64], r1 ; store op1
- vst1.u8 {q6}, [r3@64], r1 ; store op0
- vst1.u8 {q7}, [r2@64], r1 ; store oq0
- vst1.u8 {q8}, [r3@64], r1 ; store oq1
-
- vpop {d8-d15} ; restore neon registers
-
- pop {pc}
- ENDP ; |vp9_lpf_horizontal_4_dual_neon|
-
-; void vp9_loop_filter_neon_16();
-; This is a helper function for the loopfilters. The invidual functions do the
-; necessary load, transpose (if necessary) and store. This function uses
-; registers d8-d15, so the calling function must save those registers.
-;
-; r0-r3, r12 PRESERVE
-; q0 blimit
-; q1 limit
-; q2 thresh
-; q3 p3
-; q4 p2
-; q5 p1
-; q6 p0
-; q7 q0
-; q8 q1
-; q9 q2
-; q10 q3
-;
-; Outputs:
-; q5 op1
-; q6 op0
-; q7 oq0
-; q8 oq1
-|vp9_loop_filter_neon_16| PROC
-
- ; filter_mask
- vabd.u8 q11, q3, q4 ; m1 = abs(p3 - p2)
- vabd.u8 q12, q4, q5 ; m2 = abs(p2 - p1)
- vabd.u8 q13, q5, q6 ; m3 = abs(p1 - p0)
- vabd.u8 q14, q8, q7 ; m4 = abs(q1 - q0)
- vabd.u8 q3, q9, q8 ; m5 = abs(q2 - q1)
- vabd.u8 q4, q10, q9 ; m6 = abs(q3 - q2)
-
- ; only compare the largest value to limit
- vmax.u8 q11, q11, q12 ; m7 = max(m1, m2)
- vmax.u8 q12, q13, q14 ; m8 = max(m3, m4)
-
- vabd.u8 q9, q6, q7 ; abs(p0 - q0)
-
- vmax.u8 q3, q3, q4 ; m9 = max(m5, m6)
-
- vmov.u8 q10, #0x80
-
- vmax.u8 q15, q11, q12 ; m10 = max(m7, m8)
-
- vcgt.u8 q13, q13, q2 ; (abs(p1 - p0) > thresh)*-1
- vcgt.u8 q14, q14, q2 ; (abs(q1 - q0) > thresh)*-1
- vmax.u8 q15, q15, q3 ; m11 = max(m10, m9)
-
- vabd.u8 q2, q5, q8 ; a = abs(p1 - q1)
- vqadd.u8 q9, q9, q9 ; b = abs(p0 - q0) * 2
-
- veor q7, q7, q10 ; qs0
-
- vcge.u8 q15, q1, q15 ; abs(m11) > limit
-
- vshr.u8 q2, q2, #1 ; a = a / 2
- veor q6, q6, q10 ; ps0
-
- veor q5, q5, q10 ; ps1
- vqadd.u8 q9, q9, q2 ; a = b + a
-
- veor q8, q8, q10 ; qs1
-
- vmov.u16 q4, #3
-
- vsubl.s8 q2, d14, d12 ; ( qs0 - ps0)
- vsubl.s8 q11, d15, d13
-
- vcge.u8 q9, q0, q9 ; a > blimit
-
- vqsub.s8 q1, q5, q8 ; filter = clamp(ps1-qs1)
- vorr q14, q13, q14 ; hev
-
- vmul.i16 q2, q2, q4 ; 3 * ( qs0 - ps0)
- vmul.i16 q11, q11, q4
-
- vand q1, q1, q14 ; filter &= hev
- vand q15, q15, q9 ; mask
-
- vmov.u8 q4, #3
-
- vaddw.s8 q2, q2, d2 ; filter + 3 * (qs0 - ps0)
- vaddw.s8 q11, q11, d3
-
- vmov.u8 q9, #4
-
- ; filter = clamp(filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d2, q2
- vqmovn.s16 d3, q11
- vand q1, q1, q15 ; filter &= mask
-
- vqadd.s8 q2, q1, q4 ; filter2 = clamp(filter+3)
- vqadd.s8 q1, q1, q9 ; filter1 = clamp(filter+4)
- vshr.s8 q2, q2, #3 ; filter2 >>= 3
- vshr.s8 q1, q1, #3 ; filter1 >>= 3
-
-
- vqadd.s8 q11, q6, q2 ; u = clamp(ps0 + filter2)
- vqsub.s8 q0, q7, q1 ; u = clamp(qs0 - filter1)
-
- ; outer tap adjustments
- vrshr.s8 q1, q1, #1 ; filter = ++filter1 >> 1
-
- veor q7, q0, q10 ; *oq0 = u^0x80
-
- vbic q1, q1, q14 ; filter &= ~hev
-
- vqadd.s8 q13, q5, q1 ; u = clamp(ps1 + filter)
- vqsub.s8 q12, q8, q1 ; u = clamp(qs1 - filter)
-
- veor q6, q11, q10 ; *op0 = u^0x80
- veor q5, q13, q10 ; *op1 = u^0x80
- veor q8, q12, q10 ; *oq1 = u^0x80
-
- bx lr
- ENDP ; |vp9_loop_filter_neon_16|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.c b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.c
deleted file mode 100644
index 0820db2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_16_neon.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vp9_rtcd.h"
-
-void vp9_lpf_horizontal_8_dual_neon(uint8_t *s, int p /* pitch */,
- const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_horizontal_8(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_horizontal_8(s + 8, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_vertical_4_dual_neon(uint8_t *s, int p,
- const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_vertical_4_neon(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_vertical_4_neon(s + 8 * p, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_vertical_8_dual_neon(uint8_t *s, int p,
- const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_vertical_8_neon(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_vertical_8_neon(s + 8 * p, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_vertical_16_dual_neon(uint8_t *s, int p,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh) {
- vp9_lpf_vertical_16_neon(s, p, blimit, limit, thresh);
- vp9_lpf_vertical_16_neon(s + 8 * p, p, blimit, limit, thresh);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_neon.asm
deleted file mode 100644
index 4430322..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_loopfilter_neon.asm
+++ /dev/null
@@ -1,708 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_lpf_horizontal_4_neon|
- EXPORT |vp9_lpf_vertical_4_neon|
- EXPORT |vp9_lpf_horizontal_8_neon|
- EXPORT |vp9_lpf_vertical_8_neon|
- ARM
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; Currently vp9 only works on iterations 8 at a time. The vp8 loop filter
-; works on 16 iterations at a time.
-; TODO(fgalligan): See about removing the count code as this function is only
-; called with a count of 1.
-;
-; void vp9_lpf_horizontal_4_neon(uint8_t *s,
-; int p /* pitch */,
-; const uint8_t *blimit,
-; const uint8_t *limit,
-; const uint8_t *thresh,
-; int count)
-;
-; r0 uint8_t *s,
-; r1 int p, /* pitch */
-; r2 const uint8_t *blimit,
-; r3 const uint8_t *limit,
-; sp const uint8_t *thresh,
-; sp+4 int count
-|vp9_lpf_horizontal_4_neon| PROC
- push {lr}
-
- vld1.8 {d0[]}, [r2] ; duplicate *blimit
- ldr r12, [sp, #8] ; load count
- ldr r2, [sp, #4] ; load thresh
- add r1, r1, r1 ; double pitch
-
- cmp r12, #0
- beq end_vp9_lf_h_edge
-
- vld1.8 {d1[]}, [r3] ; duplicate *limit
- vld1.8 {d2[]}, [r2] ; duplicate *thresh
-
-count_lf_h_loop
- sub r2, r0, r1, lsl #1 ; move src pointer down by 4 lines
- add r3, r2, r1, lsr #1 ; set to 3 lines down
-
- vld1.u8 {d3}, [r2@64], r1 ; p3
- vld1.u8 {d4}, [r3@64], r1 ; p2
- vld1.u8 {d5}, [r2@64], r1 ; p1
- vld1.u8 {d6}, [r3@64], r1 ; p0
- vld1.u8 {d7}, [r2@64], r1 ; q0
- vld1.u8 {d16}, [r3@64], r1 ; q1
- vld1.u8 {d17}, [r2@64] ; q2
- vld1.u8 {d18}, [r3@64] ; q3
-
- sub r2, r2, r1, lsl #1
- sub r3, r3, r1, lsl #1
-
- bl vp9_loop_filter_neon
-
- vst1.u8 {d4}, [r2@64], r1 ; store op1
- vst1.u8 {d5}, [r3@64], r1 ; store op0
- vst1.u8 {d6}, [r2@64], r1 ; store oq0
- vst1.u8 {d7}, [r3@64], r1 ; store oq1
-
- add r0, r0, #8
- subs r12, r12, #1
- bne count_lf_h_loop
-
-end_vp9_lf_h_edge
- pop {pc}
- ENDP ; |vp9_lpf_horizontal_4_neon|
-
-; Currently vp9 only works on iterations 8 at a time. The vp8 loop filter
-; works on 16 iterations at a time.
-; TODO(fgalligan): See about removing the count code as this function is only
-; called with a count of 1.
-;
-; void vp9_lpf_vertical_4_neon(uint8_t *s,
-; int p /* pitch */,
-; const uint8_t *blimit,
-; const uint8_t *limit,
-; const uint8_t *thresh,
-; int count)
-;
-; r0 uint8_t *s,
-; r1 int p, /* pitch */
-; r2 const uint8_t *blimit,
-; r3 const uint8_t *limit,
-; sp const uint8_t *thresh,
-; sp+4 int count
-|vp9_lpf_vertical_4_neon| PROC
- push {lr}
-
- vld1.8 {d0[]}, [r2] ; duplicate *blimit
- ldr r12, [sp, #8] ; load count
- vld1.8 {d1[]}, [r3] ; duplicate *limit
-
- ldr r3, [sp, #4] ; load thresh
- sub r2, r0, #4 ; move s pointer down by 4 columns
- cmp r12, #0
- beq end_vp9_lf_v_edge
-
- vld1.8 {d2[]}, [r3] ; duplicate *thresh
-
-count_lf_v_loop
- vld1.u8 {d3}, [r2], r1 ; load s data
- vld1.u8 {d4}, [r2], r1
- vld1.u8 {d5}, [r2], r1
- vld1.u8 {d6}, [r2], r1
- vld1.u8 {d7}, [r2], r1
- vld1.u8 {d16}, [r2], r1
- vld1.u8 {d17}, [r2], r1
- vld1.u8 {d18}, [r2]
-
- ;transpose to 8x16 matrix
- vtrn.32 d3, d7
- vtrn.32 d4, d16
- vtrn.32 d5, d17
- vtrn.32 d6, d18
-
- vtrn.16 d3, d5
- vtrn.16 d4, d6
- vtrn.16 d7, d17
- vtrn.16 d16, d18
-
- vtrn.8 d3, d4
- vtrn.8 d5, d6
- vtrn.8 d7, d16
- vtrn.8 d17, d18
-
- bl vp9_loop_filter_neon
-
- sub r0, r0, #2
-
- ;store op1, op0, oq0, oq1
- vst4.8 {d4[0], d5[0], d6[0], d7[0]}, [r0], r1
- vst4.8 {d4[1], d5[1], d6[1], d7[1]}, [r0], r1
- vst4.8 {d4[2], d5[2], d6[2], d7[2]}, [r0], r1
- vst4.8 {d4[3], d5[3], d6[3], d7[3]}, [r0], r1
- vst4.8 {d4[4], d5[4], d6[4], d7[4]}, [r0], r1
- vst4.8 {d4[5], d5[5], d6[5], d7[5]}, [r0], r1
- vst4.8 {d4[6], d5[6], d6[6], d7[6]}, [r0], r1
- vst4.8 {d4[7], d5[7], d6[7], d7[7]}, [r0]
-
- add r0, r0, r1, lsl #3 ; s += pitch * 8
- subs r12, r12, #1
- subne r2, r0, #4 ; move s pointer down by 4 columns
- bne count_lf_v_loop
-
-end_vp9_lf_v_edge
- pop {pc}
- ENDP ; |vp9_lpf_vertical_4_neon|
-
-; void vp9_loop_filter_neon();
-; This is a helper function for the loopfilters. The invidual functions do the
-; necessary load, transpose (if necessary) and store. The function does not use
-; registers d8-d15.
-;
-; Inputs:
-; r0-r3, r12 PRESERVE
-; d0 blimit
-; d1 limit
-; d2 thresh
-; d3 p3
-; d4 p2
-; d5 p1
-; d6 p0
-; d7 q0
-; d16 q1
-; d17 q2
-; d18 q3
-;
-; Outputs:
-; d4 op1
-; d5 op0
-; d6 oq0
-; d7 oq1
-|vp9_loop_filter_neon| PROC
- ; filter_mask
- vabd.u8 d19, d3, d4 ; m1 = abs(p3 - p2)
- vabd.u8 d20, d4, d5 ; m2 = abs(p2 - p1)
- vabd.u8 d21, d5, d6 ; m3 = abs(p1 - p0)
- vabd.u8 d22, d16, d7 ; m4 = abs(q1 - q0)
- vabd.u8 d3, d17, d16 ; m5 = abs(q2 - q1)
- vabd.u8 d4, d18, d17 ; m6 = abs(q3 - q2)
-
- ; only compare the largest value to limit
- vmax.u8 d19, d19, d20 ; m1 = max(m1, m2)
- vmax.u8 d20, d21, d22 ; m2 = max(m3, m4)
-
- vabd.u8 d17, d6, d7 ; abs(p0 - q0)
-
- vmax.u8 d3, d3, d4 ; m3 = max(m5, m6)
-
- vmov.u8 d18, #0x80
-
- vmax.u8 d23, d19, d20 ; m1 = max(m1, m2)
-
- ; hevmask
- vcgt.u8 d21, d21, d2 ; (abs(p1 - p0) > thresh)*-1
- vcgt.u8 d22, d22, d2 ; (abs(q1 - q0) > thresh)*-1
- vmax.u8 d23, d23, d3 ; m1 = max(m1, m3)
-
- vabd.u8 d28, d5, d16 ; a = abs(p1 - q1)
- vqadd.u8 d17, d17, d17 ; b = abs(p0 - q0) * 2
-
- veor d7, d7, d18 ; qs0
-
- vcge.u8 d23, d1, d23 ; abs(m1) > limit
-
- ; filter() function
- ; convert to signed
-
- vshr.u8 d28, d28, #1 ; a = a / 2
- veor d6, d6, d18 ; ps0
-
- veor d5, d5, d18 ; ps1
- vqadd.u8 d17, d17, d28 ; a = b + a
-
- veor d16, d16, d18 ; qs1
-
- vmov.u8 d19, #3
-
- vsub.s8 d28, d7, d6 ; ( qs0 - ps0)
-
- vcge.u8 d17, d0, d17 ; a > blimit
-
- vqsub.s8 d27, d5, d16 ; filter = clamp(ps1-qs1)
- vorr d22, d21, d22 ; hevmask
-
- vmull.s8 q12, d28, d19 ; 3 * ( qs0 - ps0)
-
- vand d27, d27, d22 ; filter &= hev
- vand d23, d23, d17 ; filter_mask
-
- vaddw.s8 q12, q12, d27 ; filter + 3 * (qs0 - ps0)
-
- vmov.u8 d17, #4
-
- ; filter = clamp(filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d27, q12
-
- vand d27, d27, d23 ; filter &= mask
-
- vqadd.s8 d28, d27, d19 ; filter2 = clamp(filter+3)
- vqadd.s8 d27, d27, d17 ; filter1 = clamp(filter+4)
- vshr.s8 d28, d28, #3 ; filter2 >>= 3
- vshr.s8 d27, d27, #3 ; filter1 >>= 3
-
- vqadd.s8 d19, d6, d28 ; u = clamp(ps0 + filter2)
- vqsub.s8 d26, d7, d27 ; u = clamp(qs0 - filter1)
-
- ; outer tap adjustments
- vrshr.s8 d27, d27, #1 ; filter = ++filter1 >> 1
-
- veor d6, d26, d18 ; *oq0 = u^0x80
-
- vbic d27, d27, d22 ; filter &= ~hev
-
- vqadd.s8 d21, d5, d27 ; u = clamp(ps1 + filter)
- vqsub.s8 d20, d16, d27 ; u = clamp(qs1 - filter)
-
- veor d5, d19, d18 ; *op0 = u^0x80
- veor d4, d21, d18 ; *op1 = u^0x80
- veor d7, d20, d18 ; *oq1 = u^0x80
-
- bx lr
- ENDP ; |vp9_loop_filter_neon|
-
-; void vp9_lpf_horizontal_8_neon(uint8_t *s, int p,
-; const uint8_t *blimit,
-; const uint8_t *limit,
-; const uint8_t *thresh,
-; int count)
-; r0 uint8_t *s,
-; r1 int p, /* pitch */
-; r2 const uint8_t *blimit,
-; r3 const uint8_t *limit,
-; sp const uint8_t *thresh,
-; sp+4 int count
-|vp9_lpf_horizontal_8_neon| PROC
- push {r4-r5, lr}
-
- vld1.8 {d0[]}, [r2] ; duplicate *blimit
- ldr r12, [sp, #16] ; load count
- ldr r2, [sp, #12] ; load thresh
- add r1, r1, r1 ; double pitch
-
- cmp r12, #0
- beq end_vp9_mblf_h_edge
-
- vld1.8 {d1[]}, [r3] ; duplicate *limit
- vld1.8 {d2[]}, [r2] ; duplicate *thresh
-
-count_mblf_h_loop
- sub r3, r0, r1, lsl #1 ; move src pointer down by 4 lines
- add r2, r3, r1, lsr #1 ; set to 3 lines down
-
- vld1.u8 {d3}, [r3@64], r1 ; p3
- vld1.u8 {d4}, [r2@64], r1 ; p2
- vld1.u8 {d5}, [r3@64], r1 ; p1
- vld1.u8 {d6}, [r2@64], r1 ; p0
- vld1.u8 {d7}, [r3@64], r1 ; q0
- vld1.u8 {d16}, [r2@64], r1 ; q1
- vld1.u8 {d17}, [r3@64] ; q2
- vld1.u8 {d18}, [r2@64], r1 ; q3
-
- sub r3, r3, r1, lsl #1
- sub r2, r2, r1, lsl #2
-
- bl vp9_mbloop_filter_neon
-
- vst1.u8 {d0}, [r2@64], r1 ; store op2
- vst1.u8 {d1}, [r3@64], r1 ; store op1
- vst1.u8 {d2}, [r2@64], r1 ; store op0
- vst1.u8 {d3}, [r3@64], r1 ; store oq0
- vst1.u8 {d4}, [r2@64], r1 ; store oq1
- vst1.u8 {d5}, [r3@64], r1 ; store oq2
-
- add r0, r0, #8
- subs r12, r12, #1
- bne count_mblf_h_loop
-
-end_vp9_mblf_h_edge
- pop {r4-r5, pc}
-
- ENDP ; |vp9_lpf_horizontal_8_neon|
-
-; void vp9_lpf_vertical_8_neon(uint8_t *s,
-; int pitch,
-; const uint8_t *blimit,
-; const uint8_t *limit,
-; const uint8_t *thresh,
-; int count)
-;
-; r0 uint8_t *s,
-; r1 int pitch,
-; r2 const uint8_t *blimit,
-; r3 const uint8_t *limit,
-; sp const uint8_t *thresh,
-; sp+4 int count
-|vp9_lpf_vertical_8_neon| PROC
- push {r4-r5, lr}
-
- vld1.8 {d0[]}, [r2] ; duplicate *blimit
- ldr r12, [sp, #16] ; load count
- vld1.8 {d1[]}, [r3] ; duplicate *limit
-
- ldr r3, [sp, #12] ; load thresh
- sub r2, r0, #4 ; move s pointer down by 4 columns
- cmp r12, #0
- beq end_vp9_mblf_v_edge
-
- vld1.8 {d2[]}, [r3] ; duplicate *thresh
-
-count_mblf_v_loop
- vld1.u8 {d3}, [r2], r1 ; load s data
- vld1.u8 {d4}, [r2], r1
- vld1.u8 {d5}, [r2], r1
- vld1.u8 {d6}, [r2], r1
- vld1.u8 {d7}, [r2], r1
- vld1.u8 {d16}, [r2], r1
- vld1.u8 {d17}, [r2], r1
- vld1.u8 {d18}, [r2]
-
- ;transpose to 8x16 matrix
- vtrn.32 d3, d7
- vtrn.32 d4, d16
- vtrn.32 d5, d17
- vtrn.32 d6, d18
-
- vtrn.16 d3, d5
- vtrn.16 d4, d6
- vtrn.16 d7, d17
- vtrn.16 d16, d18
-
- vtrn.8 d3, d4
- vtrn.8 d5, d6
- vtrn.8 d7, d16
- vtrn.8 d17, d18
-
- sub r2, r0, #3
- add r3, r0, #1
-
- bl vp9_mbloop_filter_neon
-
- ;store op2, op1, op0, oq0
- vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r2], r1
- vst4.8 {d0[1], d1[1], d2[1], d3[1]}, [r2], r1
- vst4.8 {d0[2], d1[2], d2[2], d3[2]}, [r2], r1
- vst4.8 {d0[3], d1[3], d2[3], d3[3]}, [r2], r1
- vst4.8 {d0[4], d1[4], d2[4], d3[4]}, [r2], r1
- vst4.8 {d0[5], d1[5], d2[5], d3[5]}, [r2], r1
- vst4.8 {d0[6], d1[6], d2[6], d3[6]}, [r2], r1
- vst4.8 {d0[7], d1[7], d2[7], d3[7]}, [r2]
-
- ;store oq1, oq2
- vst2.8 {d4[0], d5[0]}, [r3], r1
- vst2.8 {d4[1], d5[1]}, [r3], r1
- vst2.8 {d4[2], d5[2]}, [r3], r1
- vst2.8 {d4[3], d5[3]}, [r3], r1
- vst2.8 {d4[4], d5[4]}, [r3], r1
- vst2.8 {d4[5], d5[5]}, [r3], r1
- vst2.8 {d4[6], d5[6]}, [r3], r1
- vst2.8 {d4[7], d5[7]}, [r3]
-
- add r0, r0, r1, lsl #3 ; s += pitch * 8
- subs r12, r12, #1
- subne r2, r0, #4 ; move s pointer down by 4 columns
- bne count_mblf_v_loop
-
-end_vp9_mblf_v_edge
- pop {r4-r5, pc}
- ENDP ; |vp9_lpf_vertical_8_neon|
-
-; void vp9_mbloop_filter_neon();
-; This is a helper function for the loopfilters. The invidual functions do the
-; necessary load, transpose (if necessary) and store. The function does not use
-; registers d8-d15.
-;
-; Inputs:
-; r0-r3, r12 PRESERVE
-; d0 blimit
-; d1 limit
-; d2 thresh
-; d3 p3
-; d4 p2
-; d5 p1
-; d6 p0
-; d7 q0
-; d16 q1
-; d17 q2
-; d18 q3
-;
-; Outputs:
-; d0 op2
-; d1 op1
-; d2 op0
-; d3 oq0
-; d4 oq1
-; d5 oq2
-|vp9_mbloop_filter_neon| PROC
- ; filter_mask
- vabd.u8 d19, d3, d4 ; m1 = abs(p3 - p2)
- vabd.u8 d20, d4, d5 ; m2 = abs(p2 - p1)
- vabd.u8 d21, d5, d6 ; m3 = abs(p1 - p0)
- vabd.u8 d22, d16, d7 ; m4 = abs(q1 - q0)
- vabd.u8 d23, d17, d16 ; m5 = abs(q2 - q1)
- vabd.u8 d24, d18, d17 ; m6 = abs(q3 - q2)
-
- ; only compare the largest value to limit
- vmax.u8 d19, d19, d20 ; m1 = max(m1, m2)
- vmax.u8 d20, d21, d22 ; m2 = max(m3, m4)
-
- vabd.u8 d25, d6, d4 ; m7 = abs(p0 - p2)
-
- vmax.u8 d23, d23, d24 ; m3 = max(m5, m6)
-
- vabd.u8 d26, d7, d17 ; m8 = abs(q0 - q2)
-
- vmax.u8 d19, d19, d20
-
- vabd.u8 d24, d6, d7 ; m9 = abs(p0 - q0)
- vabd.u8 d27, d3, d6 ; m10 = abs(p3 - p0)
- vabd.u8 d28, d18, d7 ; m11 = abs(q3 - q0)
-
- vmax.u8 d19, d19, d23
-
- vabd.u8 d23, d5, d16 ; a = abs(p1 - q1)
- vqadd.u8 d24, d24, d24 ; b = abs(p0 - q0) * 2
-
- ; abs () > limit
- vcge.u8 d19, d1, d19
-
- ; only compare the largest value to thresh
- vmax.u8 d25, d25, d26 ; m4 = max(m7, m8)
- vmax.u8 d26, d27, d28 ; m5 = max(m10, m11)
-
- vshr.u8 d23, d23, #1 ; a = a / 2
-
- vmax.u8 d25, d25, d26 ; m4 = max(m4, m5)
-
- vqadd.u8 d24, d24, d23 ; a = b + a
-
- vmax.u8 d20, d20, d25 ; m2 = max(m2, m4)
-
- vmov.u8 d23, #1
- vcge.u8 d24, d0, d24 ; a > blimit
-
- vcgt.u8 d21, d21, d2 ; (abs(p1 - p0) > thresh)*-1
-
- vcge.u8 d20, d23, d20 ; flat
-
- vand d19, d19, d24 ; mask
-
- vcgt.u8 d23, d22, d2 ; (abs(q1 - q0) > thresh)*-1
-
- vand d20, d20, d19 ; flat & mask
-
- vmov.u8 d22, #0x80
-
- vorr d23, d21, d23 ; hev
-
- ; This instruction will truncate the "flat & mask" masks down to 4 bits
- ; each to fit into one 32 bit arm register. The values are stored in
- ; q10.64[0].
- vshrn.u16 d30, q10, #4
- vmov.u32 r4, d30[0] ; flat & mask 4bits
-
- adds r5, r4, #1 ; Check for all 1's
-
- ; If mask and flat are 1's for all vectors, then we only need to execute
- ; the power branch for all vectors.
- beq power_branch_only
-
- cmp r4, #0 ; Check for 0, set flag for later
-
- ; mbfilter() function
- ; filter() function
- ; convert to signed
- veor d21, d7, d22 ; qs0
- veor d24, d6, d22 ; ps0
- veor d25, d5, d22 ; ps1
- veor d26, d16, d22 ; qs1
-
- vmov.u8 d27, #3
-
- vsub.s8 d28, d21, d24 ; ( qs0 - ps0)
-
- vqsub.s8 d29, d25, d26 ; filter = clamp(ps1-qs1)
-
- vmull.s8 q15, d28, d27 ; 3 * ( qs0 - ps0)
-
- vand d29, d29, d23 ; filter &= hev
-
- vaddw.s8 q15, q15, d29 ; filter + 3 * (qs0 - ps0)
-
- vmov.u8 d29, #4
-
- ; filter = clamp(filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d28, q15
-
- vand d28, d28, d19 ; filter &= mask
-
- vqadd.s8 d30, d28, d27 ; filter2 = clamp(filter+3)
- vqadd.s8 d29, d28, d29 ; filter1 = clamp(filter+4)
- vshr.s8 d30, d30, #3 ; filter2 >>= 3
- vshr.s8 d29, d29, #3 ; filter1 >>= 3
-
- vqadd.s8 d24, d24, d30 ; op0 = clamp(ps0 + filter2)
- vqsub.s8 d21, d21, d29 ; oq0 = clamp(qs0 - filter1)
-
- ; outer tap adjustments: ++filter1 >> 1
- vrshr.s8 d29, d29, #1
- vbic d29, d29, d23 ; filter &= ~hev
-
- vqadd.s8 d25, d25, d29 ; op1 = clamp(ps1 + filter)
- vqsub.s8 d26, d26, d29 ; oq1 = clamp(qs1 - filter)
-
- ; If mask and flat are 0's for all vectors, then we only need to execute
- ; the filter branch for all vectors.
- beq filter_branch_only
-
- ; If mask and flat are mixed then we must perform both branches and
- ; combine the data.
- veor d24, d24, d22 ; *f_op0 = u^0x80
- veor d21, d21, d22 ; *f_oq0 = u^0x80
- veor d25, d25, d22 ; *f_op1 = u^0x80
- veor d26, d26, d22 ; *f_oq1 = u^0x80
-
- ; At this point we have already executed the filter branch. The filter
- ; branch does not set op2 or oq2, so use p2 and q2. Execute the power
- ; branch and combine the data.
- vmov.u8 d23, #2
- vaddl.u8 q14, d6, d7 ; r_op2 = p0 + q0
- vmlal.u8 q14, d3, d27 ; r_op2 += p3 * 3
- vmlal.u8 q14, d4, d23 ; r_op2 += p2 * 2
-
- vbif d0, d4, d20 ; op2 |= p2 & ~(flat & mask)
-
- vaddw.u8 q14, d5 ; r_op2 += p1
-
- vbif d1, d25, d20 ; op1 |= f_op1 & ~(flat & mask)
-
- vqrshrn.u16 d30, q14, #3 ; r_op2
-
- vsubw.u8 q14, d3 ; r_op1 = r_op2 - p3
- vsubw.u8 q14, d4 ; r_op1 -= p2
- vaddw.u8 q14, d5 ; r_op1 += p1
- vaddw.u8 q14, d16 ; r_op1 += q1
-
- vbif d2, d24, d20 ; op0 |= f_op0 & ~(flat & mask)
-
- vqrshrn.u16 d31, q14, #3 ; r_op1
-
- vsubw.u8 q14, d3 ; r_op0 = r_op1 - p3
- vsubw.u8 q14, d5 ; r_op0 -= p1
- vaddw.u8 q14, d6 ; r_op0 += p0
- vaddw.u8 q14, d17 ; r_op0 += q2
-
- vbit d0, d30, d20 ; op2 |= r_op2 & (flat & mask)
-
- vqrshrn.u16 d23, q14, #3 ; r_op0
-
- vsubw.u8 q14, d3 ; r_oq0 = r_op0 - p3
- vsubw.u8 q14, d6 ; r_oq0 -= p0
- vaddw.u8 q14, d7 ; r_oq0 += q0
-
- vbit d1, d31, d20 ; op1 |= r_op1 & (flat & mask)
-
- vaddw.u8 q14, d18 ; oq0 += q3
-
- vbit d2, d23, d20 ; op0 |= r_op0 & (flat & mask)
-
- vqrshrn.u16 d22, q14, #3 ; r_oq0
-
- vsubw.u8 q14, d4 ; r_oq1 = r_oq0 - p2
- vsubw.u8 q14, d7 ; r_oq1 -= q0
- vaddw.u8 q14, d16 ; r_oq1 += q1
-
- vbif d3, d21, d20 ; oq0 |= f_oq0 & ~(flat & mask)
-
- vaddw.u8 q14, d18 ; r_oq1 += q3
-
- vbif d4, d26, d20 ; oq1 |= f_oq1 & ~(flat & mask)
-
- vqrshrn.u16 d6, q14, #3 ; r_oq1
-
- vsubw.u8 q14, d5 ; r_oq2 = r_oq1 - p1
- vsubw.u8 q14, d16 ; r_oq2 -= q1
- vaddw.u8 q14, d17 ; r_oq2 += q2
- vaddw.u8 q14, d18 ; r_oq2 += q3
-
- vbif d5, d17, d20 ; oq2 |= q2 & ~(flat & mask)
-
- vqrshrn.u16 d7, q14, #3 ; r_oq2
-
- vbit d3, d22, d20 ; oq0 |= r_oq0 & (flat & mask)
- vbit d4, d6, d20 ; oq1 |= r_oq1 & (flat & mask)
- vbit d5, d7, d20 ; oq2 |= r_oq2 & (flat & mask)
-
- bx lr
-
-power_branch_only
- vmov.u8 d27, #3
- vmov.u8 d21, #2
- vaddl.u8 q14, d6, d7 ; op2 = p0 + q0
- vmlal.u8 q14, d3, d27 ; op2 += p3 * 3
- vmlal.u8 q14, d4, d21 ; op2 += p2 * 2
- vaddw.u8 q14, d5 ; op2 += p1
- vqrshrn.u16 d0, q14, #3 ; op2
-
- vsubw.u8 q14, d3 ; op1 = op2 - p3
- vsubw.u8 q14, d4 ; op1 -= p2
- vaddw.u8 q14, d5 ; op1 += p1
- vaddw.u8 q14, d16 ; op1 += q1
- vqrshrn.u16 d1, q14, #3 ; op1
-
- vsubw.u8 q14, d3 ; op0 = op1 - p3
- vsubw.u8 q14, d5 ; op0 -= p1
- vaddw.u8 q14, d6 ; op0 += p0
- vaddw.u8 q14, d17 ; op0 += q2
- vqrshrn.u16 d2, q14, #3 ; op0
-
- vsubw.u8 q14, d3 ; oq0 = op0 - p3
- vsubw.u8 q14, d6 ; oq0 -= p0
- vaddw.u8 q14, d7 ; oq0 += q0
- vaddw.u8 q14, d18 ; oq0 += q3
- vqrshrn.u16 d3, q14, #3 ; oq0
-
- vsubw.u8 q14, d4 ; oq1 = oq0 - p2
- vsubw.u8 q14, d7 ; oq1 -= q0
- vaddw.u8 q14, d16 ; oq1 += q1
- vaddw.u8 q14, d18 ; oq1 += q3
- vqrshrn.u16 d4, q14, #3 ; oq1
-
- vsubw.u8 q14, d5 ; oq2 = oq1 - p1
- vsubw.u8 q14, d16 ; oq2 -= q1
- vaddw.u8 q14, d17 ; oq2 += q2
- vaddw.u8 q14, d18 ; oq2 += q3
- vqrshrn.u16 d5, q14, #3 ; oq2
-
- bx lr
-
-filter_branch_only
- ; TODO(fgalligan): See if we can rearange registers so we do not need to
- ; do the 2 vswp.
- vswp d0, d4 ; op2
- vswp d5, d17 ; oq2
- veor d2, d24, d22 ; *op0 = u^0x80
- veor d3, d21, d22 ; *oq0 = u^0x80
- veor d1, d25, d22 ; *op1 = u^0x80
- veor d4, d26, d22 ; *oq1 = u^0x80
-
- bx lr
-
- ENDP ; |vp9_mbloop_filter_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_mb_lpf_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_mb_lpf_neon.asm
deleted file mode 100644
index 5fe2bba..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_mb_lpf_neon.asm
+++ /dev/null
@@ -1,606 +0,0 @@
-;
-; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_lpf_horizontal_16_neon|
- EXPORT |vp9_lpf_vertical_16_neon|
- ARM
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-; void vp9_lpf_horizontal_16_neon(uint8_t *s, int p,
-; const uint8_t *blimit,
-; const uint8_t *limit,
-; const uint8_t *thresh
-; int count)
-; r0 uint8_t *s,
-; r1 int p, /* pitch */
-; r2 const uint8_t *blimit,
-; r3 const uint8_t *limit,
-; sp const uint8_t *thresh,
-|vp9_lpf_horizontal_16_neon| PROC
- push {r4-r8, lr}
- vpush {d8-d15}
- ldr r4, [sp, #88] ; load thresh
- ldr r12, [sp, #92] ; load count
-
-h_count
- vld1.8 {d16[]}, [r2] ; load *blimit
- vld1.8 {d17[]}, [r3] ; load *limit
- vld1.8 {d18[]}, [r4] ; load *thresh
-
- sub r8, r0, r1, lsl #3 ; move src pointer down by 8 lines
-
- vld1.u8 {d0}, [r8@64], r1 ; p7
- vld1.u8 {d1}, [r8@64], r1 ; p6
- vld1.u8 {d2}, [r8@64], r1 ; p5
- vld1.u8 {d3}, [r8@64], r1 ; p4
- vld1.u8 {d4}, [r8@64], r1 ; p3
- vld1.u8 {d5}, [r8@64], r1 ; p2
- vld1.u8 {d6}, [r8@64], r1 ; p1
- vld1.u8 {d7}, [r8@64], r1 ; p0
- vld1.u8 {d8}, [r8@64], r1 ; q0
- vld1.u8 {d9}, [r8@64], r1 ; q1
- vld1.u8 {d10}, [r8@64], r1 ; q2
- vld1.u8 {d11}, [r8@64], r1 ; q3
- vld1.u8 {d12}, [r8@64], r1 ; q4
- vld1.u8 {d13}, [r8@64], r1 ; q5
- vld1.u8 {d14}, [r8@64], r1 ; q6
- vld1.u8 {d15}, [r8@64], r1 ; q7
-
- bl vp9_wide_mbfilter_neon
-
- tst r7, #1
- beq h_mbfilter
-
- ; flat && mask were not set for any of the channels. Just store the values
- ; from filter.
- sub r8, r0, r1, lsl #1
-
- vst1.u8 {d25}, [r8@64], r1 ; store op1
- vst1.u8 {d24}, [r8@64], r1 ; store op0
- vst1.u8 {d23}, [r8@64], r1 ; store oq0
- vst1.u8 {d26}, [r8@64], r1 ; store oq1
-
- b h_next
-
-h_mbfilter
- tst r7, #2
- beq h_wide_mbfilter
-
- ; flat2 was not set for any of the channels. Just store the values from
- ; mbfilter.
- sub r8, r0, r1, lsl #1
- sub r8, r8, r1
-
- vst1.u8 {d18}, [r8@64], r1 ; store op2
- vst1.u8 {d19}, [r8@64], r1 ; store op1
- vst1.u8 {d20}, [r8@64], r1 ; store op0
- vst1.u8 {d21}, [r8@64], r1 ; store oq0
- vst1.u8 {d22}, [r8@64], r1 ; store oq1
- vst1.u8 {d23}, [r8@64], r1 ; store oq2
-
- b h_next
-
-h_wide_mbfilter
- sub r8, r0, r1, lsl #3
- add r8, r8, r1
-
- vst1.u8 {d16}, [r8@64], r1 ; store op6
- vst1.u8 {d24}, [r8@64], r1 ; store op5
- vst1.u8 {d25}, [r8@64], r1 ; store op4
- vst1.u8 {d26}, [r8@64], r1 ; store op3
- vst1.u8 {d27}, [r8@64], r1 ; store op2
- vst1.u8 {d18}, [r8@64], r1 ; store op1
- vst1.u8 {d19}, [r8@64], r1 ; store op0
- vst1.u8 {d20}, [r8@64], r1 ; store oq0
- vst1.u8 {d21}, [r8@64], r1 ; store oq1
- vst1.u8 {d22}, [r8@64], r1 ; store oq2
- vst1.u8 {d23}, [r8@64], r1 ; store oq3
- vst1.u8 {d1}, [r8@64], r1 ; store oq4
- vst1.u8 {d2}, [r8@64], r1 ; store oq5
- vst1.u8 {d3}, [r8@64], r1 ; store oq6
-
-h_next
- add r0, r0, #8
- subs r12, r12, #1
- bne h_count
-
- vpop {d8-d15}
- pop {r4-r8, pc}
-
- ENDP ; |vp9_lpf_horizontal_16_neon|
-
-; void vp9_lpf_vertical_16_neon(uint8_t *s, int p,
-; const uint8_t *blimit,
-; const uint8_t *limit,
-; const uint8_t *thresh)
-; r0 uint8_t *s,
-; r1 int p, /* pitch */
-; r2 const uint8_t *blimit,
-; r3 const uint8_t *limit,
-; sp const uint8_t *thresh,
-|vp9_lpf_vertical_16_neon| PROC
- push {r4-r8, lr}
- vpush {d8-d15}
- ldr r4, [sp, #88] ; load thresh
-
- vld1.8 {d16[]}, [r2] ; load *blimit
- vld1.8 {d17[]}, [r3] ; load *limit
- vld1.8 {d18[]}, [r4] ; load *thresh
-
- sub r8, r0, #8
-
- vld1.8 {d0}, [r8@64], r1
- vld1.8 {d8}, [r0@64], r1
- vld1.8 {d1}, [r8@64], r1
- vld1.8 {d9}, [r0@64], r1
- vld1.8 {d2}, [r8@64], r1
- vld1.8 {d10}, [r0@64], r1
- vld1.8 {d3}, [r8@64], r1
- vld1.8 {d11}, [r0@64], r1
- vld1.8 {d4}, [r8@64], r1
- vld1.8 {d12}, [r0@64], r1
- vld1.8 {d5}, [r8@64], r1
- vld1.8 {d13}, [r0@64], r1
- vld1.8 {d6}, [r8@64], r1
- vld1.8 {d14}, [r0@64], r1
- vld1.8 {d7}, [r8@64], r1
- vld1.8 {d15}, [r0@64], r1
-
- sub r0, r0, r1, lsl #3
-
- vtrn.32 q0, q2
- vtrn.32 q1, q3
- vtrn.32 q4, q6
- vtrn.32 q5, q7
-
- vtrn.16 q0, q1
- vtrn.16 q2, q3
- vtrn.16 q4, q5
- vtrn.16 q6, q7
-
- vtrn.8 d0, d1
- vtrn.8 d2, d3
- vtrn.8 d4, d5
- vtrn.8 d6, d7
-
- vtrn.8 d8, d9
- vtrn.8 d10, d11
- vtrn.8 d12, d13
- vtrn.8 d14, d15
-
- bl vp9_wide_mbfilter_neon
-
- tst r7, #1
- beq v_mbfilter
-
- ; flat && mask were not set for any of the channels. Just store the values
- ; from filter.
- sub r8, r0, #2
-
- vswp d23, d25
-
- vst4.8 {d23[0], d24[0], d25[0], d26[0]}, [r8], r1
- vst4.8 {d23[1], d24[1], d25[1], d26[1]}, [r8], r1
- vst4.8 {d23[2], d24[2], d25[2], d26[2]}, [r8], r1
- vst4.8 {d23[3], d24[3], d25[3], d26[3]}, [r8], r1
- vst4.8 {d23[4], d24[4], d25[4], d26[4]}, [r8], r1
- vst4.8 {d23[5], d24[5], d25[5], d26[5]}, [r8], r1
- vst4.8 {d23[6], d24[6], d25[6], d26[6]}, [r8], r1
- vst4.8 {d23[7], d24[7], d25[7], d26[7]}, [r8], r1
-
- b v_end
-
-v_mbfilter
- tst r7, #2
- beq v_wide_mbfilter
-
- ; flat2 was not set for any of the channels. Just store the values from
- ; mbfilter.
- sub r8, r0, #3
-
- vst3.8 {d18[0], d19[0], d20[0]}, [r8], r1
- vst3.8 {d21[0], d22[0], d23[0]}, [r0], r1
- vst3.8 {d18[1], d19[1], d20[1]}, [r8], r1
- vst3.8 {d21[1], d22[1], d23[1]}, [r0], r1
- vst3.8 {d18[2], d19[2], d20[2]}, [r8], r1
- vst3.8 {d21[2], d22[2], d23[2]}, [r0], r1
- vst3.8 {d18[3], d19[3], d20[3]}, [r8], r1
- vst3.8 {d21[3], d22[3], d23[3]}, [r0], r1
- vst3.8 {d18[4], d19[4], d20[4]}, [r8], r1
- vst3.8 {d21[4], d22[4], d23[4]}, [r0], r1
- vst3.8 {d18[5], d19[5], d20[5]}, [r8], r1
- vst3.8 {d21[5], d22[5], d23[5]}, [r0], r1
- vst3.8 {d18[6], d19[6], d20[6]}, [r8], r1
- vst3.8 {d21[6], d22[6], d23[6]}, [r0], r1
- vst3.8 {d18[7], d19[7], d20[7]}, [r8], r1
- vst3.8 {d21[7], d22[7], d23[7]}, [r0], r1
-
- b v_end
-
-v_wide_mbfilter
- sub r8, r0, #8
-
- vtrn.32 d0, d26
- vtrn.32 d16, d27
- vtrn.32 d24, d18
- vtrn.32 d25, d19
-
- vtrn.16 d0, d24
- vtrn.16 d16, d25
- vtrn.16 d26, d18
- vtrn.16 d27, d19
-
- vtrn.8 d0, d16
- vtrn.8 d24, d25
- vtrn.8 d26, d27
- vtrn.8 d18, d19
-
- vtrn.32 d20, d1
- vtrn.32 d21, d2
- vtrn.32 d22, d3
- vtrn.32 d23, d15
-
- vtrn.16 d20, d22
- vtrn.16 d21, d23
- vtrn.16 d1, d3
- vtrn.16 d2, d15
-
- vtrn.8 d20, d21
- vtrn.8 d22, d23
- vtrn.8 d1, d2
- vtrn.8 d3, d15
-
- vst1.8 {d0}, [r8@64], r1
- vst1.8 {d20}, [r0@64], r1
- vst1.8 {d16}, [r8@64], r1
- vst1.8 {d21}, [r0@64], r1
- vst1.8 {d24}, [r8@64], r1
- vst1.8 {d22}, [r0@64], r1
- vst1.8 {d25}, [r8@64], r1
- vst1.8 {d23}, [r0@64], r1
- vst1.8 {d26}, [r8@64], r1
- vst1.8 {d1}, [r0@64], r1
- vst1.8 {d27}, [r8@64], r1
- vst1.8 {d2}, [r0@64], r1
- vst1.8 {d18}, [r8@64], r1
- vst1.8 {d3}, [r0@64], r1
- vst1.8 {d19}, [r8@64], r1
- vst1.8 {d15}, [r0@64], r1
-
-v_end
- vpop {d8-d15}
- pop {r4-r8, pc}
-
- ENDP ; |vp9_lpf_vertical_16_neon|
-
-; void vp9_wide_mbfilter_neon();
-; This is a helper function for the loopfilters. The invidual functions do the
-; necessary load, transpose (if necessary) and store.
-;
-; r0-r3 PRESERVE
-; d16 blimit
-; d17 limit
-; d18 thresh
-; d0 p7
-; d1 p6
-; d2 p5
-; d3 p4
-; d4 p3
-; d5 p2
-; d6 p1
-; d7 p0
-; d8 q0
-; d9 q1
-; d10 q2
-; d11 q3
-; d12 q4
-; d13 q5
-; d14 q6
-; d15 q7
-|vp9_wide_mbfilter_neon| PROC
- mov r7, #0
-
- ; filter_mask
- vabd.u8 d19, d4, d5 ; abs(p3 - p2)
- vabd.u8 d20, d5, d6 ; abs(p2 - p1)
- vabd.u8 d21, d6, d7 ; abs(p1 - p0)
- vabd.u8 d22, d9, d8 ; abs(q1 - q0)
- vabd.u8 d23, d10, d9 ; abs(q2 - q1)
- vabd.u8 d24, d11, d10 ; abs(q3 - q2)
-
- ; only compare the largest value to limit
- vmax.u8 d19, d19, d20 ; max(abs(p3 - p2), abs(p2 - p1))
- vmax.u8 d20, d21, d22 ; max(abs(p1 - p0), abs(q1 - q0))
- vmax.u8 d23, d23, d24 ; max(abs(q2 - q1), abs(q3 - q2))
- vmax.u8 d19, d19, d20
-
- vabd.u8 d24, d7, d8 ; abs(p0 - q0)
-
- vmax.u8 d19, d19, d23
-
- vabd.u8 d23, d6, d9 ; a = abs(p1 - q1)
- vqadd.u8 d24, d24, d24 ; b = abs(p0 - q0) * 2
-
- ; abs () > limit
- vcge.u8 d19, d17, d19
-
- ; flatmask4
- vabd.u8 d25, d7, d5 ; abs(p0 - p2)
- vabd.u8 d26, d8, d10 ; abs(q0 - q2)
- vabd.u8 d27, d4, d7 ; abs(p3 - p0)
- vabd.u8 d28, d11, d8 ; abs(q3 - q0)
-
- ; only compare the largest value to thresh
- vmax.u8 d25, d25, d26 ; max(abs(p0 - p2), abs(q0 - q2))
- vmax.u8 d26, d27, d28 ; max(abs(p3 - p0), abs(q3 - q0))
- vmax.u8 d25, d25, d26
- vmax.u8 d20, d20, d25
-
- vshr.u8 d23, d23, #1 ; a = a / 2
- vqadd.u8 d24, d24, d23 ; a = b + a
-
- vmov.u8 d30, #1
- vcge.u8 d24, d16, d24 ; (a > blimit * 2 + limit) * -1
-
- vcge.u8 d20, d30, d20 ; flat
-
- vand d19, d19, d24 ; mask
-
- ; hevmask
- vcgt.u8 d21, d21, d18 ; (abs(p1 - p0) > thresh)*-1
- vcgt.u8 d22, d22, d18 ; (abs(q1 - q0) > thresh)*-1
- vorr d21, d21, d22 ; hev
-
- vand d16, d20, d19 ; flat && mask
- vmov r5, r6, d16
-
- ; flatmask5(1, p7, p6, p5, p4, p0, q0, q4, q5, q6, q7)
- vabd.u8 d22, d3, d7 ; abs(p4 - p0)
- vabd.u8 d23, d12, d8 ; abs(q4 - q0)
- vabd.u8 d24, d7, d2 ; abs(p0 - p5)
- vabd.u8 d25, d8, d13 ; abs(q0 - q5)
- vabd.u8 d26, d1, d7 ; abs(p6 - p0)
- vabd.u8 d27, d14, d8 ; abs(q6 - q0)
- vabd.u8 d28, d0, d7 ; abs(p7 - p0)
- vabd.u8 d29, d15, d8 ; abs(q7 - q0)
-
- ; only compare the largest value to thresh
- vmax.u8 d22, d22, d23 ; max(abs(p4 - p0), abs(q4 - q0))
- vmax.u8 d23, d24, d25 ; max(abs(p0 - p5), abs(q0 - q5))
- vmax.u8 d24, d26, d27 ; max(abs(p6 - p0), abs(q6 - q0))
- vmax.u8 d25, d28, d29 ; max(abs(p7 - p0), abs(q7 - q0))
-
- vmax.u8 d26, d22, d23
- vmax.u8 d27, d24, d25
- vmax.u8 d23, d26, d27
-
- vcge.u8 d18, d30, d23 ; flat2
-
- vmov.u8 d22, #0x80
-
- orrs r5, r5, r6 ; Check for 0
- orreq r7, r7, #1 ; Only do filter branch
-
- vand d17, d18, d16 ; flat2 && flat && mask
- vmov r5, r6, d17
-
- ; mbfilter() function
-
- ; filter() function
- ; convert to signed
- veor d23, d8, d22 ; qs0
- veor d24, d7, d22 ; ps0
- veor d25, d6, d22 ; ps1
- veor d26, d9, d22 ; qs1
-
- vmov.u8 d27, #3
-
- vsub.s8 d28, d23, d24 ; ( qs0 - ps0)
- vqsub.s8 d29, d25, d26 ; filter = clamp(ps1-qs1)
- vmull.s8 q15, d28, d27 ; 3 * ( qs0 - ps0)
- vand d29, d29, d21 ; filter &= hev
- vaddw.s8 q15, q15, d29 ; filter + 3 * (qs0 - ps0)
- vmov.u8 d29, #4
-
- ; filter = clamp(filter + 3 * ( qs0 - ps0))
- vqmovn.s16 d28, q15
-
- vand d28, d28, d19 ; filter &= mask
-
- vqadd.s8 d30, d28, d27 ; filter2 = clamp(filter+3)
- vqadd.s8 d29, d28, d29 ; filter1 = clamp(filter+4)
- vshr.s8 d30, d30, #3 ; filter2 >>= 3
- vshr.s8 d29, d29, #3 ; filter1 >>= 3
-
-
- vqadd.s8 d24, d24, d30 ; op0 = clamp(ps0 + filter2)
- vqsub.s8 d23, d23, d29 ; oq0 = clamp(qs0 - filter1)
-
- ; outer tap adjustments: ++filter1 >> 1
- vrshr.s8 d29, d29, #1
- vbic d29, d29, d21 ; filter &= ~hev
-
- vqadd.s8 d25, d25, d29 ; op1 = clamp(ps1 + filter)
- vqsub.s8 d26, d26, d29 ; oq1 = clamp(qs1 - filter)
-
- veor d24, d24, d22 ; *f_op0 = u^0x80
- veor d23, d23, d22 ; *f_oq0 = u^0x80
- veor d25, d25, d22 ; *f_op1 = u^0x80
- veor d26, d26, d22 ; *f_oq1 = u^0x80
-
- tst r7, #1
- bxne lr
-
- orrs r5, r5, r6 ; Check for 0
- orreq r7, r7, #2 ; Only do mbfilter branch
-
- ; mbfilter flat && mask branch
- ; TODO(fgalligan): Can I decrease the cycles shifting to consective d's
- ; and using vibt on the q's?
- vmov.u8 d29, #2
- vaddl.u8 q15, d7, d8 ; op2 = p0 + q0
- vmlal.u8 q15, d4, d27 ; op2 = p0 + q0 + p3 * 3
- vmlal.u8 q15, d5, d29 ; op2 = p0 + q0 + p3 * 3 + p2 * 2
- vaddl.u8 q10, d4, d5
- vaddw.u8 q15, d6 ; op2=p1 + p0 + q0 + p3 * 3 + p2 *2
- vaddl.u8 q14, d6, d9
- vqrshrn.u16 d18, q15, #3 ; r_op2
-
- vsub.i16 q15, q10
- vaddl.u8 q10, d4, d6
- vadd.i16 q15, q14
- vaddl.u8 q14, d7, d10
- vqrshrn.u16 d19, q15, #3 ; r_op1
-
- vsub.i16 q15, q10
- vadd.i16 q15, q14
- vaddl.u8 q14, d8, d11
- vqrshrn.u16 d20, q15, #3 ; r_op0
-
- vsubw.u8 q15, d4 ; oq0 = op0 - p3
- vsubw.u8 q15, d7 ; oq0 -= p0
- vadd.i16 q15, q14
- vaddl.u8 q14, d9, d11
- vqrshrn.u16 d21, q15, #3 ; r_oq0
-
- vsubw.u8 q15, d5 ; oq1 = oq0 - p2
- vsubw.u8 q15, d8 ; oq1 -= q0
- vadd.i16 q15, q14
- vaddl.u8 q14, d10, d11
- vqrshrn.u16 d22, q15, #3 ; r_oq1
-
- vsubw.u8 q15, d6 ; oq2 = oq0 - p1
- vsubw.u8 q15, d9 ; oq2 -= q1
- vadd.i16 q15, q14
- vqrshrn.u16 d27, q15, #3 ; r_oq2
-
- ; Filter does not set op2 or oq2, so use p2 and q2.
- vbif d18, d5, d16 ; t_op2 |= p2 & ~(flat & mask)
- vbif d19, d25, d16 ; t_op1 |= f_op1 & ~(flat & mask)
- vbif d20, d24, d16 ; t_op0 |= f_op0 & ~(flat & mask)
- vbif d21, d23, d16 ; t_oq0 |= f_oq0 & ~(flat & mask)
- vbif d22, d26, d16 ; t_oq1 |= f_oq1 & ~(flat & mask)
-
- vbit d23, d27, d16 ; t_oq2 |= r_oq2 & (flat & mask)
- vbif d23, d10, d16 ; t_oq2 |= q2 & ~(flat & mask)
-
- tst r7, #2
- bxne lr
-
- ; wide_mbfilter flat2 && flat && mask branch
- vmov.u8 d16, #7
- vaddl.u8 q15, d7, d8 ; op6 = p0 + q0
- vaddl.u8 q12, d2, d3
- vaddl.u8 q13, d4, d5
- vaddl.u8 q14, d1, d6
- vmlal.u8 q15, d0, d16 ; op6 += p7 * 3
- vadd.i16 q12, q13
- vadd.i16 q15, q14
- vaddl.u8 q14, d2, d9
- vadd.i16 q15, q12
- vaddl.u8 q12, d0, d1
- vaddw.u8 q15, d1
- vaddl.u8 q13, d0, d2
- vadd.i16 q14, q15, q14
- vqrshrn.u16 d16, q15, #4 ; w_op6
-
- vsub.i16 q15, q14, q12
- vaddl.u8 q14, d3, d10
- vqrshrn.u16 d24, q15, #4 ; w_op5
-
- vsub.i16 q15, q13
- vaddl.u8 q13, d0, d3
- vadd.i16 q15, q14
- vaddl.u8 q14, d4, d11
- vqrshrn.u16 d25, q15, #4 ; w_op4
-
- vadd.i16 q15, q14
- vaddl.u8 q14, d0, d4
- vsub.i16 q15, q13
- vsub.i16 q14, q15, q14
- vqrshrn.u16 d26, q15, #4 ; w_op3
-
- vaddw.u8 q15, q14, d5 ; op2 += p2
- vaddl.u8 q14, d0, d5
- vaddw.u8 q15, d12 ; op2 += q4
- vbif d26, d4, d17 ; op3 |= p3 & ~(f2 & f & m)
- vqrshrn.u16 d27, q15, #4 ; w_op2
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d0, d6
- vaddw.u8 q15, d6 ; op1 += p1
- vaddw.u8 q15, d13 ; op1 += q5
- vbif d27, d18, d17 ; op2 |= t_op2 & ~(f2 & f & m)
- vqrshrn.u16 d18, q15, #4 ; w_op1
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d0, d7
- vaddw.u8 q15, d7 ; op0 += p0
- vaddw.u8 q15, d14 ; op0 += q6
- vbif d18, d19, d17 ; op1 |= t_op1 & ~(f2 & f & m)
- vqrshrn.u16 d19, q15, #4 ; w_op0
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d1, d8
- vaddw.u8 q15, d8 ; oq0 += q0
- vaddw.u8 q15, d15 ; oq0 += q7
- vbif d19, d20, d17 ; op0 |= t_op0 & ~(f2 & f & m)
- vqrshrn.u16 d20, q15, #4 ; w_oq0
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d2, d9
- vaddw.u8 q15, d9 ; oq1 += q1
- vaddl.u8 q4, d10, d15
- vaddw.u8 q15, d15 ; oq1 += q7
- vbif d20, d21, d17 ; oq0 |= t_oq0 & ~(f2 & f & m)
- vqrshrn.u16 d21, q15, #4 ; w_oq1
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d3, d10
- vadd.i16 q15, q4
- vaddl.u8 q4, d11, d15
- vbif d21, d22, d17 ; oq1 |= t_oq1 & ~(f2 & f & m)
- vqrshrn.u16 d22, q15, #4 ; w_oq2
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d4, d11
- vadd.i16 q15, q4
- vaddl.u8 q4, d12, d15
- vbif d22, d23, d17 ; oq2 |= t_oq2 & ~(f2 & f & m)
- vqrshrn.u16 d23, q15, #4 ; w_oq3
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d5, d12
- vadd.i16 q15, q4
- vaddl.u8 q4, d13, d15
- vbif d16, d1, d17 ; op6 |= p6 & ~(f2 & f & m)
- vqrshrn.u16 d1, q15, #4 ; w_oq4
-
- vsub.i16 q15, q14
- vaddl.u8 q14, d6, d13
- vadd.i16 q15, q4
- vaddl.u8 q4, d14, d15
- vbif d24, d2, d17 ; op5 |= p5 & ~(f2 & f & m)
- vqrshrn.u16 d2, q15, #4 ; w_oq5
-
- vsub.i16 q15, q14
- vbif d25, d3, d17 ; op4 |= p4 & ~(f2 & f & m)
- vadd.i16 q15, q4
- vbif d23, d11, d17 ; oq3 |= q3 & ~(f2 & f & m)
- vqrshrn.u16 d3, q15, #4 ; w_oq6
- vbif d1, d12, d17 ; oq4 |= q4 & ~(f2 & f & m)
- vbif d2, d13, d17 ; oq5 |= q5 & ~(f2 & f & m)
- vbif d3, d14, d17 ; oq6 |= q6 & ~(f2 & f & m)
-
- bx lr
- ENDP ; |vp9_wide_mbfilter_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_reconintra_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_reconintra_neon.asm
deleted file mode 100644
index dc9856f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_reconintra_neon.asm
+++ /dev/null
@@ -1,634 +0,0 @@
-;
-; Copyright (c) 2014 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
- EXPORT |vp9_v_predictor_4x4_neon|
- EXPORT |vp9_v_predictor_8x8_neon|
- EXPORT |vp9_v_predictor_16x16_neon|
- EXPORT |vp9_v_predictor_32x32_neon|
- EXPORT |vp9_h_predictor_4x4_neon|
- EXPORT |vp9_h_predictor_8x8_neon|
- EXPORT |vp9_h_predictor_16x16_neon|
- EXPORT |vp9_h_predictor_32x32_neon|
- EXPORT |vp9_tm_predictor_4x4_neon|
- EXPORT |vp9_tm_predictor_8x8_neon|
- EXPORT |vp9_tm_predictor_16x16_neon|
- EXPORT |vp9_tm_predictor_32x32_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp9_v_predictor_4x4_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_v_predictor_4x4_neon| PROC
- vld1.32 {d0[0]}, [r2]
- vst1.32 {d0[0]}, [r0], r1
- vst1.32 {d0[0]}, [r0], r1
- vst1.32 {d0[0]}, [r0], r1
- vst1.32 {d0[0]}, [r0], r1
- bx lr
- ENDP ; |vp9_v_predictor_4x4_neon|
-
-;void vp9_v_predictor_8x8_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_v_predictor_8x8_neon| PROC
- vld1.8 {d0}, [r2]
- vst1.8 {d0}, [r0], r1
- vst1.8 {d0}, [r0], r1
- vst1.8 {d0}, [r0], r1
- vst1.8 {d0}, [r0], r1
- vst1.8 {d0}, [r0], r1
- vst1.8 {d0}, [r0], r1
- vst1.8 {d0}, [r0], r1
- vst1.8 {d0}, [r0], r1
- bx lr
- ENDP ; |vp9_v_predictor_8x8_neon|
-
-;void vp9_v_predictor_16x16_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_v_predictor_16x16_neon| PROC
- vld1.8 {q0}, [r2]
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- vst1.8 {q0}, [r0], r1
- bx lr
- ENDP ; |vp9_v_predictor_16x16_neon|
-
-;void vp9_v_predictor_32x32_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_v_predictor_32x32_neon| PROC
- vld1.8 {q0, q1}, [r2]
- mov r2, #2
-loop_v
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- vst1.8 {q0, q1}, [r0], r1
- subs r2, r2, #1
- bgt loop_v
- bx lr
- ENDP ; |vp9_v_predictor_32x32_neon|
-
-;void vp9_h_predictor_4x4_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_h_predictor_4x4_neon| PROC
- vld1.32 {d1[0]}, [r3]
- vdup.8 d0, d1[0]
- vst1.32 {d0[0]}, [r0], r1
- vdup.8 d0, d1[1]
- vst1.32 {d0[0]}, [r0], r1
- vdup.8 d0, d1[2]
- vst1.32 {d0[0]}, [r0], r1
- vdup.8 d0, d1[3]
- vst1.32 {d0[0]}, [r0], r1
- bx lr
- ENDP ; |vp9_h_predictor_4x4_neon|
-
-;void vp9_h_predictor_8x8_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_h_predictor_8x8_neon| PROC
- vld1.64 {d1}, [r3]
- vdup.8 d0, d1[0]
- vst1.64 {d0}, [r0], r1
- vdup.8 d0, d1[1]
- vst1.64 {d0}, [r0], r1
- vdup.8 d0, d1[2]
- vst1.64 {d0}, [r0], r1
- vdup.8 d0, d1[3]
- vst1.64 {d0}, [r0], r1
- vdup.8 d0, d1[4]
- vst1.64 {d0}, [r0], r1
- vdup.8 d0, d1[5]
- vst1.64 {d0}, [r0], r1
- vdup.8 d0, d1[6]
- vst1.64 {d0}, [r0], r1
- vdup.8 d0, d1[7]
- vst1.64 {d0}, [r0], r1
- bx lr
- ENDP ; |vp9_h_predictor_8x8_neon|
-
-;void vp9_h_predictor_16x16_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_h_predictor_16x16_neon| PROC
- vld1.8 {q1}, [r3]
- vdup.8 q0, d2[0]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[1]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[2]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[3]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[4]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[5]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[6]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[7]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[0]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[1]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[2]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[3]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[4]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[5]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[6]
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[7]
- vst1.8 {q0}, [r0], r1
- bx lr
- ENDP ; |vp9_h_predictor_16x16_neon|
-
-;void vp9_h_predictor_32x32_neon(uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_h_predictor_32x32_neon| PROC
- sub r1, r1, #16
- mov r2, #2
-loop_h
- vld1.8 {q1}, [r3]!
- vdup.8 q0, d2[0]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[1]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[2]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[3]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[4]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[5]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[6]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d2[7]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[0]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[1]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[2]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[3]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[4]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[5]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[6]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- vdup.8 q0, d3[7]
- vst1.8 {q0}, [r0]!
- vst1.8 {q0}, [r0], r1
- subs r2, r2, #1
- bgt loop_h
- bx lr
- ENDP ; |vp9_h_predictor_32x32_neon|
-
-;void vp9_tm_predictor_4x4_neon (uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_tm_predictor_4x4_neon| PROC
- ; Load ytop_left = above[-1];
- sub r12, r2, #1
- ldrb r12, [r12]
- vdup.u8 d0, r12
-
- ; Load above 4 pixels
- vld1.32 {d2[0]}, [r2]
-
- ; Compute above - ytop_left
- vsubl.u8 q3, d2, d0
-
- ; Load left row by row and compute left + (above - ytop_left)
- ; 1st row and 2nd row
- ldrb r12, [r3], #1
- ldrb r2, [r3], #1
- vdup.u16 q1, r12
- vdup.u16 q2, r2
- vadd.s16 q1, q1, q3
- vadd.s16 q2, q2, q3
- vqmovun.s16 d0, q1
- vqmovun.s16 d1, q2
- vst1.32 {d0[0]}, [r0], r1
- vst1.32 {d1[0]}, [r0], r1
-
- ; 3rd row and 4th row
- ldrb r12, [r3], #1
- ldrb r2, [r3], #1
- vdup.u16 q1, r12
- vdup.u16 q2, r2
- vadd.s16 q1, q1, q3
- vadd.s16 q2, q2, q3
- vqmovun.s16 d0, q1
- vqmovun.s16 d1, q2
- vst1.32 {d0[0]}, [r0], r1
- vst1.32 {d1[0]}, [r0], r1
- bx lr
- ENDP ; |vp9_tm_predictor_4x4_neon|
-
-;void vp9_tm_predictor_8x8_neon (uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_tm_predictor_8x8_neon| PROC
- ; Load ytop_left = above[-1];
- sub r12, r2, #1
- ldrb r12, [r12]
- vdup.u8 d0, r12
-
- ; preload 8 left
- vld1.8 {d30}, [r3]
-
- ; Load above 8 pixels
- vld1.64 {d2}, [r2]
-
- vmovl.u8 q10, d30
-
- ; Compute above - ytop_left
- vsubl.u8 q3, d2, d0
-
- ; Load left row by row and compute left + (above - ytop_left)
- ; 1st row and 2nd row
- vdup.16 q0, d20[0]
- vdup.16 q1, d20[1]
- vadd.s16 q0, q3, q0
- vadd.s16 q1, q3, q1
-
- ; 3rd row and 4th row
- vdup.16 q8, d20[2]
- vdup.16 q9, d20[3]
- vadd.s16 q8, q3, q8
- vadd.s16 q9, q3, q9
-
- vqmovun.s16 d0, q0
- vqmovun.s16 d1, q1
- vqmovun.s16 d2, q8
- vqmovun.s16 d3, q9
-
- vst1.64 {d0}, [r0], r1
- vst1.64 {d1}, [r0], r1
- vst1.64 {d2}, [r0], r1
- vst1.64 {d3}, [r0], r1
-
- ; 5th row and 6th row
- vdup.16 q0, d21[0]
- vdup.16 q1, d21[1]
- vadd.s16 q0, q3, q0
- vadd.s16 q1, q3, q1
-
- ; 7th row and 8th row
- vdup.16 q8, d21[2]
- vdup.16 q9, d21[3]
- vadd.s16 q8, q3, q8
- vadd.s16 q9, q3, q9
-
- vqmovun.s16 d0, q0
- vqmovun.s16 d1, q1
- vqmovun.s16 d2, q8
- vqmovun.s16 d3, q9
-
- vst1.64 {d0}, [r0], r1
- vst1.64 {d1}, [r0], r1
- vst1.64 {d2}, [r0], r1
- vst1.64 {d3}, [r0], r1
-
- bx lr
- ENDP ; |vp9_tm_predictor_8x8_neon|
-
-;void vp9_tm_predictor_16x16_neon (uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_tm_predictor_16x16_neon| PROC
- ; Load ytop_left = above[-1];
- sub r12, r2, #1
- ldrb r12, [r12]
- vdup.u8 q0, r12
-
- ; Load above 8 pixels
- vld1.8 {q1}, [r2]
-
- ; preload 8 left into r12
- vld1.8 {d18}, [r3]!
-
- ; Compute above - ytop_left
- vsubl.u8 q2, d2, d0
- vsubl.u8 q3, d3, d1
-
- vmovl.u8 q10, d18
-
- ; Load left row by row and compute left + (above - ytop_left)
- ; Process 8 rows in each single loop and loop 2 times to process 16 rows.
- mov r2, #2
-
-loop_16x16_neon
- ; Process two rows.
- vdup.16 q0, d20[0]
- vdup.16 q8, d20[1]
- vadd.s16 q1, q0, q2
- vadd.s16 q0, q0, q3
- vadd.s16 q11, q8, q2
- vadd.s16 q8, q8, q3
- vqmovun.s16 d2, q1
- vqmovun.s16 d3, q0
- vqmovun.s16 d22, q11
- vqmovun.s16 d23, q8
- vdup.16 q0, d20[2] ; proload next 2 rows data
- vdup.16 q8, d20[3]
- vst1.64 {d2,d3}, [r0], r1
- vst1.64 {d22,d23}, [r0], r1
-
- ; Process two rows.
- vadd.s16 q1, q0, q2
- vadd.s16 q0, q0, q3
- vadd.s16 q11, q8, q2
- vadd.s16 q8, q8, q3
- vqmovun.s16 d2, q1
- vqmovun.s16 d3, q0
- vqmovun.s16 d22, q11
- vqmovun.s16 d23, q8
- vdup.16 q0, d21[0] ; proload next 2 rows data
- vdup.16 q8, d21[1]
- vst1.64 {d2,d3}, [r0], r1
- vst1.64 {d22,d23}, [r0], r1
-
- vadd.s16 q1, q0, q2
- vadd.s16 q0, q0, q3
- vadd.s16 q11, q8, q2
- vadd.s16 q8, q8, q3
- vqmovun.s16 d2, q1
- vqmovun.s16 d3, q0
- vqmovun.s16 d22, q11
- vqmovun.s16 d23, q8
- vdup.16 q0, d21[2] ; proload next 2 rows data
- vdup.16 q8, d21[3]
- vst1.64 {d2,d3}, [r0], r1
- vst1.64 {d22,d23}, [r0], r1
-
-
- vadd.s16 q1, q0, q2
- vadd.s16 q0, q0, q3
- vadd.s16 q11, q8, q2
- vadd.s16 q8, q8, q3
- vqmovun.s16 d2, q1
- vqmovun.s16 d3, q0
- vqmovun.s16 d22, q11
- vqmovun.s16 d23, q8
- vld1.8 {d18}, [r3]! ; preload 8 left into r12
- vmovl.u8 q10, d18
- vst1.64 {d2,d3}, [r0], r1
- vst1.64 {d22,d23}, [r0], r1
-
- subs r2, r2, #1
- bgt loop_16x16_neon
-
- bx lr
- ENDP ; |vp9_tm_predictor_16x16_neon|
-
-;void vp9_tm_predictor_32x32_neon (uint8_t *dst, ptrdiff_t y_stride,
-; const uint8_t *above,
-; const uint8_t *left)
-; r0 uint8_t *dst
-; r1 ptrdiff_t y_stride
-; r2 const uint8_t *above
-; r3 const uint8_t *left
-
-|vp9_tm_predictor_32x32_neon| PROC
- ; Load ytop_left = above[-1];
- sub r12, r2, #1
- ldrb r12, [r12]
- vdup.u8 q0, r12
-
- ; Load above 32 pixels
- vld1.8 {q1}, [r2]!
- vld1.8 {q2}, [r2]
-
- ; preload 8 left pixels
- vld1.8 {d26}, [r3]!
-
- ; Compute above - ytop_left
- vsubl.u8 q8, d2, d0
- vsubl.u8 q9, d3, d1
- vsubl.u8 q10, d4, d0
- vsubl.u8 q11, d5, d1
-
- vmovl.u8 q3, d26
-
- ; Load left row by row and compute left + (above - ytop_left)
- ; Process 8 rows in each single loop and loop 4 times to process 32 rows.
- mov r2, #4
-
-loop_32x32_neon
- ; Process two rows.
- vdup.16 q0, d6[0]
- vdup.16 q2, d6[1]
- vadd.s16 q12, q0, q8
- vadd.s16 q13, q0, q9
- vadd.s16 q14, q0, q10
- vadd.s16 q15, q0, q11
- vqmovun.s16 d0, q12
- vqmovun.s16 d1, q13
- vadd.s16 q12, q2, q8
- vadd.s16 q13, q2, q9
- vqmovun.s16 d2, q14
- vqmovun.s16 d3, q15
- vadd.s16 q14, q2, q10
- vadd.s16 q15, q2, q11
- vst1.64 {d0-d3}, [r0], r1
- vqmovun.s16 d24, q12
- vqmovun.s16 d25, q13
- vqmovun.s16 d26, q14
- vqmovun.s16 d27, q15
- vdup.16 q1, d6[2]
- vdup.16 q2, d6[3]
- vst1.64 {d24-d27}, [r0], r1
-
- ; Process two rows.
- vadd.s16 q12, q1, q8
- vadd.s16 q13, q1, q9
- vadd.s16 q14, q1, q10
- vadd.s16 q15, q1, q11
- vqmovun.s16 d0, q12
- vqmovun.s16 d1, q13
- vadd.s16 q12, q2, q8
- vadd.s16 q13, q2, q9
- vqmovun.s16 d2, q14
- vqmovun.s16 d3, q15
- vadd.s16 q14, q2, q10
- vadd.s16 q15, q2, q11
- vst1.64 {d0-d3}, [r0], r1
- vqmovun.s16 d24, q12
- vqmovun.s16 d25, q13
- vqmovun.s16 d26, q14
- vqmovun.s16 d27, q15
- vdup.16 q0, d7[0]
- vdup.16 q2, d7[1]
- vst1.64 {d24-d27}, [r0], r1
-
- ; Process two rows.
- vadd.s16 q12, q0, q8
- vadd.s16 q13, q0, q9
- vadd.s16 q14, q0, q10
- vadd.s16 q15, q0, q11
- vqmovun.s16 d0, q12
- vqmovun.s16 d1, q13
- vadd.s16 q12, q2, q8
- vadd.s16 q13, q2, q9
- vqmovun.s16 d2, q14
- vqmovun.s16 d3, q15
- vadd.s16 q14, q2, q10
- vadd.s16 q15, q2, q11
- vst1.64 {d0-d3}, [r0], r1
- vqmovun.s16 d24, q12
- vqmovun.s16 d25, q13
- vqmovun.s16 d26, q14
- vqmovun.s16 d27, q15
- vdup.16 q0, d7[2]
- vdup.16 q2, d7[3]
- vst1.64 {d24-d27}, [r0], r1
-
- ; Process two rows.
- vadd.s16 q12, q0, q8
- vadd.s16 q13, q0, q9
- vadd.s16 q14, q0, q10
- vadd.s16 q15, q0, q11
- vqmovun.s16 d0, q12
- vqmovun.s16 d1, q13
- vadd.s16 q12, q2, q8
- vadd.s16 q13, q2, q9
- vqmovun.s16 d2, q14
- vqmovun.s16 d3, q15
- vadd.s16 q14, q2, q10
- vadd.s16 q15, q2, q11
- vst1.64 {d0-d3}, [r0], r1
- vqmovun.s16 d24, q12
- vqmovun.s16 d25, q13
- vld1.8 {d0}, [r3]! ; preload 8 left pixels
- vqmovun.s16 d26, q14
- vqmovun.s16 d27, q15
- vmovl.u8 q3, d0
- vst1.64 {d24-d27}, [r0], r1
-
- subs r2, r2, #1
- bgt loop_32x32_neon
-
- bx lr
- ENDP ; |vp9_tm_predictor_32x32_neon|
-
- END
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_save_reg_neon.asm b/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_save_reg_neon.asm
deleted file mode 100644
index 71c3e70..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_save_reg_neon.asm
+++ /dev/null
@@ -1,36 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp9_push_neon|
- EXPORT |vp9_pop_neon|
-
- ARM
- REQUIRE8
- PRESERVE8
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-|vp9_push_neon| PROC
- vst1.i64 {d8, d9, d10, d11}, [r0]!
- vst1.i64 {d12, d13, d14, d15}, [r0]!
- bx lr
-
- ENDP
-
-|vp9_pop_neon| PROC
- vld1.i64 {d8, d9, d10, d11}, [r0]!
- vld1.i64 {d12, d13, d14, d15}, [r0]!
- bx lr
-
- ENDP
-
- END
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_common_dspr2.h b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_common_dspr2.h
deleted file mode 100644
index 6ebea9f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_common_dspr2.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_MIPS_DSPR2_VP9_COMMON_DSPR2_H_
-#define VP9_COMMON_MIPS_DSPR2_VP9_COMMON_DSPR2_H_
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if HAVE_DSPR2
-#define CROP_WIDTH 512
-extern uint8_t *vp9_ff_cropTbl;
-
-#define DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input) ({ \
- \
- int32_t tmp, out; \
- int dct_cost_rounding = DCT_CONST_ROUNDING; \
- int in = input; \
- \
- __asm__ __volatile__ ( \
- /* out = dct_const_round_shift(input_dc * cospi_16_64); */ \
- "mtlo %[dct_cost_rounding], $ac1 \n\t"\
- "mthi $zero, $ac1 \n\t"\
- "madd $ac1, %[in], %[cospi_16_64] \n\t"\
- "extp %[tmp], $ac1, 31 \n\t"\
- \
- /* out = dct_const_round_shift(out * cospi_16_64); */ \
- "mtlo %[dct_cost_rounding], $ac2 \n\t"\
- "mthi $zero, $ac2 \n\t"\
- "madd $ac2, %[tmp], %[cospi_16_64] \n\t"\
- "extp %[out], $ac2, 31 \n\t"\
- \
- : [tmp] "=&r" (tmp), [out] "=r" (out) \
- : [in] "r" (in), \
- [dct_cost_rounding] "r" (dct_cost_rounding), \
- [cospi_16_64] "r" (cospi_16_64) \
- ); \
- out; })
-
-static INLINE void vp9_prefetch_load(const unsigned char *src) {
- __asm__ __volatile__ (
- "pref 0, 0(%[src]) \n\t"
- :
- : [src] "r" (src)
- );
-}
-
-/* prefetch data for store */
-static INLINE void vp9_prefetch_store(unsigned char *dst) {
- __asm__ __volatile__ (
- "pref 1, 0(%[dst]) \n\t"
- :
- : [dst] "r" (dst)
- );
-}
-
-static INLINE void vp9_prefetch_load_streamed(const unsigned char *src) {
- __asm__ __volatile__ (
- "pref 4, 0(%[src]) \n\t"
- :
- : [src] "r" (src)
- );
-}
-
-/* prefetch data for store */
-static INLINE void vp9_prefetch_store_streamed(unsigned char *dst) {
- __asm__ __volatile__ (
- "pref 5, 0(%[dst]) \n\t"
- :
- : [dst] "r" (dst)
- );
-}
-
-void vp9_idct32_cols_add_blk_dspr2(int16_t *input, uint8_t *dest,
- int dest_stride);
-
-void vp9_convolve2_horiz_dspr2(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);
-
-void vp9_convolve2_avg_horiz_dspr2(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);
-
-void vp9_convolve2_avg_vert_dspr2(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);
-
-void vp9_convolve2_dspr2(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter,
- int w, int h);
-
-void vp9_convolve2_vert_dspr2(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);
-
-#endif // #if HAVE_DSPR2
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_MIPS_DSPR2_VP9_COMMON_DSPR2_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_dspr2.c
deleted file mode 100644
index 91d62bc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_dspr2.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_bi_avg_vert_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t w,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2;
- uint32_t p1, p2;
- uint32_t scratch1, scratch2;
- uint32_t store1, store2;
- int32_t Temp1, Temp2;
- const int16_t *filter = &filter_y[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
-
- for (x = 0; x < w; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t"
-
- "extp %[Temp1], $ac0, 31 \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "lbu %[scratch1], 0(%[dst_ptr]) \n\t"
- "lbu %[scratch2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 1 */
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 2 */
- "extp %[Temp2], $ac3, 31 \n\t"
- "lbu %[scratch1], 2(%[dst_ptr]) \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
- "lbu %[scratch2], 3(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 3 */
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 4 */
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [scratch1] "=&r" (scratch1), [scratch2] "=&r" (scratch2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [filter45] "r" (filter45), [vector4a] "r" (vector4a),
- [src_stride] "r" (src_stride), [cm] "r" (cm),
- [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_bi_avg_vert_64_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2;
- uint32_t p1, p2;
- uint32_t scratch1, scratch2;
- uint32_t store1, store2;
- int32_t Temp1, Temp2;
- const int16_t *filter = &filter_y[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
- vp9_prefetch_store(dst + dst_stride + 32);
-
- for (x = 0; x < 64; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t"
-
- "extp %[Temp1], $ac0, 31 \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "lbu %[scratch1], 0(%[dst_ptr]) \n\t"
- "lbu %[scratch2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 1 */
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 2 */
- "extp %[Temp2], $ac3, 31 \n\t"
- "lbu %[scratch1], 2(%[dst_ptr]) \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
- "lbu %[scratch2], 3(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 3 */
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 4 */
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [scratch1] "=&r" (scratch1), [scratch2] "=&r" (scratch2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [filter45] "r" (filter45), [vector4a] "r" (vector4a),
- [src_stride] "r" (src_stride), [cm] "r" (cm),
- [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve2_avg_vert_dspr2(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) {
- if (16 == y_step_q4) {
- uint32_t pos = 38;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- case 8:
- case 16:
- case 32:
- convolve_bi_avg_vert_4_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, w, h);
- break;
- case 64:
- vp9_prefetch_store(dst + 32);
- convolve_bi_avg_vert_64_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, h);
- break;
- default:
- vp9_convolve8_avg_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_avg_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_horiz_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_horiz_dspr2.c
deleted file mode 100644
index 148b20f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_avg_horiz_dspr2.c
+++ /dev/null
@@ -1,833 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_bi_avg_horiz_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- int32_t Temp1, Temp2, Temp3, Temp4;
- uint32_t vector4a = 64;
- uint32_t tp1, tp2;
- uint32_t p1, p2, p3;
- uint32_t tn1, tn2;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- "lbu %[p2], 3(%[dst]) \n\t" /* load odd 2 */
-
- /* odd 1. pixel */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t" /* even 1 */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "lbu %[Temp1], 1(%[dst]) \n\t" /* load odd 1 */
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p3], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "lbu %[tn2], 0(%[dst]) \n\t" /* load even 1 */
-
- /* odd 2. pixel */
- "lbux %[tp2], %[Temp3](%[cm]) \n\t" /* even 2 */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "lbux %[tn1], %[Temp2](%[cm]) \n\t" /* odd 1 */
- "addqh_r.w %[tn2], %[tn2], %[tp1] \n\t" /* average even 1 */
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t"
- "extp %[Temp4], $ac2, 31 \n\t"
-
- "lbu %[tp1], 2(%[dst]) \n\t" /* load even 2 */
- "sb %[tn2], 0(%[dst]) \n\t" /* store even 1 */
-
- /* clamp */
- "addqh_r.w %[Temp1], %[Temp1], %[tn1] \n\t" /* average odd 1 */
- "lbux %[p3], %[Temp4](%[cm]) \n\t" /* odd 2 */
- "sb %[Temp1], 1(%[dst]) \n\t" /* store odd 1 */
-
- "addqh_r.w %[tp1], %[tp1], %[tp2] \n\t" /* average even 2 */
- "sb %[tp1], 2(%[dst]) \n\t" /* store even 2 */
-
- "addqh_r.w %[p2], %[p2], %[p3] \n\t" /* average odd 2 */
- "sb %[p2], 3(%[dst]) \n\t" /* store odd 2 */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [filter45] "r" (filter45), [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_bi_avg_horiz_8_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t tp1, tp2, tp3, tp4;
- uint32_t p1, p2, p3, p4, n1;
- uint32_t st0, st1;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "ulw %[tp3], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
- "lbu %[Temp2], 0(%[dst]) \n\t"
- "lbu %[tp4], 2(%[dst]) \n\t"
-
- /* even 2. pixel */
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* even 3. pixel */
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "lbux %[st1], %[Temp3](%[cm]) \n\t"
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t"
- "extp %[Temp1], $ac1, 31 \n\t"
-
- "addqh_r.w %[Temp2], %[Temp2], %[st0] \n\t"
- "addqh_r.w %[tp4], %[tp4], %[st1] \n\t"
- "sb %[Temp2], 0(%[dst]) \n\t"
- "sb %[tp4], 2(%[dst]) \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "balign %[tp3], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
-
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
- "lbu %[Temp2], 4(%[dst]) \n\t"
- "addqh_r.w %[Temp2], %[Temp2], %[st0] \n\t"
-
- "dpa.w.ph $ac2, %[p4], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "sb %[Temp2], 4(%[dst]) \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "preceu.ph.qbr %[p3], %[tp3] \n\t"
- "preceu.ph.qbl %[p4], %[tp3] \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "lbu %[tp1], 6(%[dst]) \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "lbux %[st0], %[Temp3](%[cm]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t"
- "extp %[Temp3], $ac1, 31 \n\t"
-
- "lbu %[tp2], 1(%[dst]) \n\t"
- "lbu %[tp3], 3(%[dst]) \n\t"
- "addqh_r.w %[tp1], %[tp1], %[st0] \n\t"
-
- /* odd 3. pixel */
- "lbux %[st1], %[Temp2](%[cm]) \n\t"
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t"
- "addqh_r.w %[tp2], %[tp2], %[st1] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "lbu %[tp4], 5(%[dst]) \n\t"
-
- /* odd 4. pixel */
- "sb %[tp2], 1(%[dst]) \n\t"
- "sb %[tp1], 6(%[dst]) \n\t"
- "dpa.w.ph $ac2, %[p4], %[filter45] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbu %[tp1], 7(%[dst]) \n\t"
-
- /* clamp */
- "lbux %[p4], %[Temp3](%[cm]) \n\t"
- "addqh_r.w %[tp3], %[tp3], %[p4] \n\t"
-
- "lbux %[p2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[tp4], %[tp4], %[p2] \n\t"
-
- "lbux %[p1], %[Temp1](%[cm]) \n\t"
- "addqh_r.w %[tp1], %[tp1], %[p1] \n\t"
-
- /* store bytes */
- "sb %[tp3], 3(%[dst]) \n\t"
- "sb %[tp4], 5(%[dst]) \n\t"
- "sb %[tp1], 7(%[dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4),
- [st0] "=&r" (st0), [st1] "=&r" (st1),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [n1] "=&r" (n1),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter45] "r" (filter45), [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_bi_avg_horiz_16_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h,
- int32_t count) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_store(dst_ptr + dst_stride);
-
- for (c = 0; c < count; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
- "lbu %[st2], 0(%[dst]) \n\t" /* load even 1 from dst */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- "lbu %[qload3], 2(%[dst]) \n\t" /* load even 2 from dst */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* store even 1 to dst */
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st2] \n\t" /* average even 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 2(%[dst]) \n\t" /* store even 2 to dst */
- "lbu %[qload3], 4(%[dst]) \n\t" /* load even 3 from dst */
- "lbu %[qload1], 6(%[dst]) \n\t" /* load even 4 from dst */
- "dpa.w.ph $ac1, %[p4], %[filter45] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 3 */
- "sb %[qload3], 4(%[dst]) \n\t" /* store even 3 to dst */
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average even 4 */
- "sb %[qload1], 6(%[dst]) \n\t" /* store even 4 to dst */
- "dpa.w.ph $ac3, %[p5], %[filter45] \n\t" /* even 6 */
- "lbu %[qload2], 8(%[dst]) \n\t" /* load even 5 from dst */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 5 */
- "sb %[qload2], 8(%[dst]) \n\t" /* store even 5 to dst */
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* even 7 */
- "lbu %[qload3], 10(%[dst]) \n\t" /* load even 6 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- "lbu %[st2], 12(%[dst]) \n\t" /* load even 7 from dst */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 6 */
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* even 8 */
- "sb %[qload3], 10(%[dst]) \n\t" /* store even 6 to dst */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 7 */
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st2], 12(%[dst]) \n\t" /* store even 7 to dst */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t" /* odd 1 */
- "lbu %[qload2], 14(%[dst]) \n\t" /* load even 8 from dst */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- "lbu %[st1], 1(%[dst]) \n\t" /* load odd 1 from dst */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 8 */
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[qload2], 14(%[dst]) \n\t" /* store even 8 to dst */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* odd 2 */
- "lbu %[qload3], 3(%[dst]) \n\t" /* load odd 2 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st3], %[st3], %[st1] \n\t" /* average odd 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* odd 3 */
- "sb %[st3], 1(%[dst]) \n\t" /* store odd 1 to dst */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st1] \n\t" /* average odd 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 3(%[dst]) \n\t" /* store odd 2 to dst */
- "lbu %[qload1], 5(%[dst]) \n\t" /* load odd 3 from dst */
- "dpa.w.ph $ac3, %[p4], %[filter45] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- "lbu %[st1], 7(%[dst]) \n\t" /* load odd 4 from dst */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st2] \n\t" /* average odd 3 */
- "sb %[qload1], 5(%[dst]) \n\t" /* store odd 3 to dst */
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- "lbu %[qload1], 9(%[dst]) \n\t" /* load odd 5 from dst */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st1], %[st1], %[st3] \n\t" /* average odd 4 */
- "sb %[st1], 7(%[dst]) \n\t" /* store odd 4 to dst */
- "dpa.w.ph $ac2, %[p5], %[filter45] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 5 */
- "sb %[qload1], 9(%[dst]) \n\t" /* store odd 5 to dst */
- "lbu %[qload2], 11(%[dst]) \n\t" /* load odd 6 from dst */
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- "lbu %[qload3], 13(%[dst]) \n\t" /* load odd 7 from dst */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbu %[qload1], 15(%[dst]) \n\t" /* load odd 8 from dst */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average odd 6 */
-
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average odd 7 */
-
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 8 */
-
- "sb %[qload2], 11(%[dst]) \n\t" /* store odd 6 to dst */
- "sb %[qload3], 13(%[dst]) \n\t" /* store odd 7 to dst */
- "sb %[qload1], 15(%[dst]) \n\t" /* store odd 8 to dst */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [qload3] "=&r" (qload3), [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter45] "r" (filter45), [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-static void convolve_bi_avg_horiz_64_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_load(src_ptr + src_stride + 64);
- vp9_prefetch_store(dst_ptr + dst_stride);
- vp9_prefetch_store(dst_ptr + dst_stride + 32);
-
- for (c = 0; c < 4; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
- "lbu %[st2], 0(%[dst]) \n\t" /* load even 1 from dst */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- "lbu %[qload3], 2(%[dst]) \n\t" /* load even 2 from dst */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* store even 1 to dst */
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st2] \n\t" /* average even 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 2(%[dst]) \n\t" /* store even 2 to dst */
- "lbu %[qload3], 4(%[dst]) \n\t" /* load even 3 from dst */
- "lbu %[qload1], 6(%[dst]) \n\t" /* load even 4 from dst */
- "dpa.w.ph $ac1, %[p4], %[filter45] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 3 */
- "sb %[qload3], 4(%[dst]) \n\t" /* store even 3 to dst */
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average even 4 */
- "sb %[qload1], 6(%[dst]) \n\t" /* store even 4 to dst */
- "dpa.w.ph $ac3, %[p5], %[filter45] \n\t" /* even 6 */
- "lbu %[qload2], 8(%[dst]) \n\t" /* load even 5 from dst */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 5 */
- "sb %[qload2], 8(%[dst]) \n\t" /* store even 5 to dst */
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* even 7 */
- "lbu %[qload3], 10(%[dst]) \n\t" /* load even 6 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- "lbu %[st2], 12(%[dst]) \n\t" /* load even 7 from dst */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 6 */
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* even 8 */
- "sb %[qload3], 10(%[dst]) \n\t" /* store even 6 to dst */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 7 */
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st2], 12(%[dst]) \n\t" /* store even 7 to dst */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t" /* odd 1 */
- "lbu %[qload2], 14(%[dst]) \n\t" /* load even 8 from dst */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- "lbu %[st1], 1(%[dst]) \n\t" /* load odd 1 from dst */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 8 */
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[qload2], 14(%[dst]) \n\t" /* store even 8 to dst */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* odd 2 */
- "lbu %[qload3], 3(%[dst]) \n\t" /* load odd 2 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st3], %[st3], %[st1] \n\t" /* average odd 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* odd 3 */
- "sb %[st3], 1(%[dst]) \n\t" /* store odd 1 to dst */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st1] \n\t" /* average odd 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 3(%[dst]) \n\t" /* store odd 2 to dst */
- "lbu %[qload1], 5(%[dst]) \n\t" /* load odd 3 from dst */
- "dpa.w.ph $ac3, %[p4], %[filter45] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- "lbu %[st1], 7(%[dst]) \n\t" /* load odd 4 from dst */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st2] \n\t" /* average odd 3 */
- "sb %[qload1], 5(%[dst]) \n\t" /* store odd 3 to dst */
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- "lbu %[qload1], 9(%[dst]) \n\t" /* load odd 5 from dst */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st1], %[st1], %[st3] \n\t" /* average odd 4 */
- "sb %[st1], 7(%[dst]) \n\t" /* store odd 4 to dst */
- "dpa.w.ph $ac2, %[p5], %[filter45] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 5 */
- "sb %[qload1], 9(%[dst]) \n\t" /* store odd 5 to dst */
- "lbu %[qload2], 11(%[dst]) \n\t" /* load odd 6 from dst */
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- "lbu %[qload3], 13(%[dst]) \n\t" /* load odd 7 from dst */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbu %[qload1], 15(%[dst]) \n\t" /* load odd 8 from dst */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average odd 6 */
-
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average odd 7 */
-
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 8 */
-
- "sb %[qload2], 11(%[dst]) \n\t" /* store odd 6 to dst */
- "sb %[qload3], 13(%[dst]) \n\t" /* store odd 7 to dst */
- "sb %[qload1], 15(%[dst]) \n\t" /* store odd 8 to dst */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [qload3] "=&r" (qload3), [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter45] "r" (filter45), [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-void vp9_convolve2_avg_horiz_dspr2(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) {
- if (16 == x_step_q4) {
- uint32_t pos = 38;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- convolve_bi_avg_horiz_4_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h);
- break;
- case 8:
- convolve_bi_avg_horiz_8_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h);
- break;
- case 16:
- convolve_bi_avg_horiz_16_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h, 1);
- break;
- case 32:
- convolve_bi_avg_horiz_16_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h, 2);
- break;
- case 64:
- vp9_prefetch_load(src + 64);
- vp9_prefetch_store(dst + 32);
-
- convolve_bi_avg_horiz_64_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h);
- break;
- default:
- vp9_convolve8_avg_horiz_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_avg_horiz_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_dspr2.c
deleted file mode 100644
index 92644f2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_dspr2.c
+++ /dev/null
@@ -1,784 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_filter.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_bi_horiz_4_transposed_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint8_t *dst_ptr;
- int32_t Temp1, Temp2;
- uint32_t vector4a = 64;
- uint32_t tp1, tp2;
- uint32_t p1, p2;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- dst_ptr = dst;
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp2], $ac2, 31 \n\t"
-
- /* odd 1. pixel */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "lbux %[tp2], %[Temp2](%[cm]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp2], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[p1], %[Temp1](%[cm]) \n\t"
- "lbux %[p2], %[Temp2](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- "sb %[p1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- "sb %[tp2], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- "sb %[p2], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [dst_ptr] "+r" (dst_ptr)
- : [filter45] "r" (filter45),[vector4a] "r" (vector4a),
- [cm] "r" (cm), [src] "r" (src), [dst_stride] "r" (dst_stride)
- );
-
- /* Next row... */
- src += src_stride;
- dst += 1;
- }
-}
-
-static void convolve_bi_horiz_8_transposed_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint8_t *dst_ptr;
- uint32_t vector4a = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t tp1, tp2, tp3;
- uint32_t p1, p2, p3, p4;
- uint8_t *odd_dst;
- uint32_t dst_pitch_2 = (dst_stride << 1);
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
-
- dst_ptr = dst;
- odd_dst = (dst_ptr + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "ulw %[tp3], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* even 3. pixel */
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "balign %[tp3], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t"
- "lbux %[tp1], %[Temp3](%[cm]) \n\t"
- "extp %[p3], $ac1, 31 \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "sb %[Temp2], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
-
- "dpa.w.ph $ac2, %[p4], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- "lbux %[Temp1], %[p3](%[cm]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "preceu.ph.qbr %[p3], %[tp3] \n\t"
- "preceu.ph.qbl %[p4], %[tp3] \n\t"
- "sb %[Temp1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
-
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "lbux %[tp1], %[Temp3](%[cm]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t"
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
- "extp %[Temp3], $ac1, 31 \n\t"
-
- /* odd 3. pixel */
- "lbux %[tp3], %[Temp2](%[cm]) \n\t"
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 4. pixel */
- "sb %[tp3], 0(%[odd_dst]) \n\t"
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p4], %[filter45] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[p4], %[Temp3](%[cm]) \n\t"
- "lbux %[p2], %[Temp2](%[cm]) \n\t"
- "lbux %[p1], %[Temp1](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[p4], 0(%[odd_dst]) \n\t"
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[p2], 0(%[odd_dst]) \n\t"
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[p1], 0(%[odd_dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tp3] "=&r" (tp3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [dst_ptr] "+r" (dst_ptr), [odd_dst] "+r" (odd_dst)
- : [filter45] "r" (filter45),[vector4a] "r" (vector4a), [cm] "r" (cm),
- [src] "r" (src), [dst_pitch_2] "r" (dst_pitch_2)
- );
-
- /* Next row... */
- src += src_stride;
- dst += 1;
- }
-}
-
-static void convolve_bi_horiz_16_transposed_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h,
- int32_t count) {
- int32_t c, y;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- uint32_t dst_pitch_2 = (dst_stride << 1);
- uint8_t *odd_dst;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
-
- src = src_ptr;
- dst = dst_ptr;
-
- odd_dst = (dst + dst_stride);
-
- for (c = 0; c < count; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload1], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p5], %[qload1] \n\t"
- "ulw %[qload2], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload2] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 2 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p4], %[filter45] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 0(%[dst]) \n\t" /* even 3 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 4 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter45] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 5 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* even 8 */
- "sb %[st3], 0(%[dst]) \n\t" /* even 6 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 7 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload2] \n\t"
- "preceu.ph.qbl %[p5], %[qload2] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 1 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 2 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter45] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 3 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 4 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter45] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 5 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 6 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 7 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [p5] "=&r" (p5),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [dst] "+r" (dst), [odd_dst] "+r" (odd_dst)
- : [filter45] "r" (filter45), [vector_64] "r" (vector_64),
- [cm] "r" (cm),
- [src] "r" (src), [dst_pitch_2] "r" (dst_pitch_2)
- );
-
- src += 16;
- dst = (dst_ptr + ((c + 1) * 16 * dst_stride));
- odd_dst = (dst + dst_stride);
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += 1;
- }
-}
-
-static void convolve_bi_horiz_64_transposed_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t c, y;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- uint32_t dst_pitch_2 = (dst_stride << 1);
- uint8_t *odd_dst;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_load(src_ptr + src_stride + 64);
-
- src = src_ptr;
- dst = dst_ptr;
-
- odd_dst = (dst + dst_stride);
-
- for (c = 0; c < 4; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload1], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p5], %[qload1] \n\t"
- "ulw %[qload2], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload2] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 2 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p4], %[filter45] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 0(%[dst]) \n\t" /* even 3 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 4 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter45] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 5 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* even 8 */
- "sb %[st3], 0(%[dst]) \n\t" /* even 6 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 7 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload2] \n\t"
- "preceu.ph.qbl %[p5], %[qload2] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 1 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 2 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter45] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 3 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 4 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter45] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 5 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 6 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 7 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [p5] "=&r" (p5),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [dst] "+r" (dst), [odd_dst] "+r" (odd_dst)
- : [filter45] "r" (filter45), [vector_64] "r" (vector_64),
- [cm] "r" (cm),
- [src] "r" (src), [dst_pitch_2] "r" (dst_pitch_2)
- );
-
- src += 16;
- dst = (dst_ptr + ((c + 1) * 16 * dst_stride));
- odd_dst = (dst + dst_stride);
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += 1;
- }
-}
-
-void convolve_bi_horiz_transposed(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter, int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- int sum = 0;
-
- sum += src[x] * filter[3];
- sum += src[x + 1] * filter[4];
-
- dst[x * dst_stride] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
- }
-
- src += src_stride;
- dst += 1;
- }
-}
-
-void vp9_convolve2_dspr2(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter,
- int w, int h) {
- uint32_t pos = 38;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
-
- switch (w) {
- case 4:
- convolve_bi_horiz_4_transposed_dspr2(src, src_stride,
- dst, dst_stride,
- filter, h);
- break;
- case 8:
- convolve_bi_horiz_8_transposed_dspr2(src, src_stride,
- dst, dst_stride,
- filter, h);
- break;
- case 16:
- case 32:
- convolve_bi_horiz_16_transposed_dspr2(src, src_stride,
- dst, dst_stride,
- filter, h,
- (w/16));
- break;
- case 64:
- vp9_prefetch_load(src + 32);
- convolve_bi_horiz_64_transposed_dspr2(src, src_stride,
- dst, dst_stride,
- filter, h);
- break;
- default:
- convolve_bi_horiz_transposed(src, src_stride,
- dst, dst_stride,
- filter, w, h);
- break;
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_horiz_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_horiz_dspr2.c
deleted file mode 100644
index 1debdb4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_horiz_dspr2.c
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_bi_horiz_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- int32_t Temp1, Temp2, Temp3, Temp4;
- uint32_t vector4a = 64;
- uint32_t tp1, tp2;
- uint32_t p1, p2;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* odd 1. pixel */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "lbux %[tp2], %[Temp3](%[cm]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp4], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[p1], %[Temp2](%[cm]) \n\t"
- "lbux %[p2], %[Temp4](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[tp1], 0(%[dst]) \n\t"
- "sb %[p1], 1(%[dst]) \n\t"
- "sb %[tp2], 2(%[dst]) \n\t"
- "sb %[p2], 3(%[dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [filter45] "r" (filter45), [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_bi_horiz_8_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t tp1, tp2, tp3;
- uint32_t p1, p2, p3, p4;
- uint32_t st0, st1;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "ulw %[tp3], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* even 3. pixel */
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t"
- "extp %[Temp1], $ac1, 31 \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "sb %[st0], 0(%[dst]) \n\t"
- "lbux %[st1], %[Temp3](%[cm]) \n\t"
-
- "balign %[tp3], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
-
- "dpa.w.ph $ac2, %[p4], %[filter45] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 2(%[dst]) \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "preceu.ph.qbr %[p3], %[tp3] \n\t"
- "preceu.ph.qbl %[p4], %[tp3] \n\t"
- "sb %[st0], 4(%[dst]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "lbux %[st0], %[Temp3](%[cm]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t"
- "extp %[Temp3], $ac1, 31 \n\t"
-
- /* odd 3. pixel */
- "lbux %[st1], %[Temp2](%[cm]) \n\t"
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 4. pixel */
- "sb %[st1], 1(%[dst]) \n\t"
- "sb %[st0], 6(%[dst]) \n\t"
- "dpa.w.ph $ac2, %[p4], %[filter45] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[p4], %[Temp3](%[cm]) \n\t"
- "lbux %[p2], %[Temp2](%[cm]) \n\t"
- "lbux %[p1], %[Temp1](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[p4], 3(%[dst]) \n\t"
- "sb %[p2], 5(%[dst]) \n\t"
- "sb %[p1], 7(%[dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tp3] "=&r" (tp3),
- [st0] "=&r" (st0), [st1] "=&r" (st1),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter45] "r" (filter45), [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_bi_horiz_16_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h,
- int32_t count) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_store(dst_ptr + dst_stride);
-
- for (c = 0; c < count; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st2], 2(%[dst]) \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter45] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 4(%[dst]) \n\t" /* even 3 */
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 6(%[dst]) \n\t" /* even 4 */
- "dpa.w.ph $ac3, %[p5], %[filter45] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "sb %[st2], 8(%[dst]) \n\t" /* even 5 */
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* even 8 */
- "sb %[st3], 10(%[dst]) \n\t" /* even 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 12(%[dst]) \n\t" /* even 7 */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[st2], 14(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 1(%[dst]) \n\t" /* odd 1 */
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 3(%[dst]) \n\t" /* odd 2 */
- "dpa.w.ph $ac3, %[p4], %[filter45] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "sb %[st2], 5(%[dst]) \n\t" /* odd 3 */
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 7(%[dst]) \n\t" /* odd 4 */
- "dpa.w.ph $ac2, %[p5], %[filter45] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 9(%[dst]) \n\t" /* odd 5 */
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 11(%[dst]) \n\t" /* odd 6 */
- "sb %[st3], 13(%[dst]) \n\t" /* odd 7 */
- "sb %[st1], 15(%[dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [qload3] "=&r" (qload3),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter45] "r" (filter45), [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-static void convolve_bi_horiz_64_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- const int16_t *filter = &filter_x0[3];
- uint32_t filter45;;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_load(src_ptr + src_stride + 64);
- vp9_prefetch_store(dst_ptr + dst_stride);
- vp9_prefetch_store(dst_ptr + dst_stride + 32);
-
- for (c = 0; c < 4; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter45] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "dpa.w.ph $ac3, %[p3], %[filter45] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st2], 2(%[dst]) \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter45] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 4(%[dst]) \n\t" /* even 3 */
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 6(%[dst]) \n\t" /* even 4 */
- "dpa.w.ph $ac3, %[p5], %[filter45] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "sb %[st2], 8(%[dst]) \n\t" /* even 5 */
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* even 8 */
- "sb %[st3], 10(%[dst]) \n\t" /* even 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 12(%[dst]) \n\t" /* even 7 */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter45] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[st2], 14(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 1(%[dst]) \n\t" /* odd 1 */
- "dpa.w.ph $ac2, %[p3], %[filter45] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 3(%[dst]) \n\t" /* odd 2 */
- "dpa.w.ph $ac3, %[p4], %[filter45] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "sb %[st2], 5(%[dst]) \n\t" /* odd 3 */
- "dpa.w.ph $ac1, %[p1], %[filter45] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "sb %[st3], 7(%[dst]) \n\t" /* odd 4 */
- "dpa.w.ph $ac2, %[p5], %[filter45] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 9(%[dst]) \n\t" /* odd 5 */
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter45] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 11(%[dst]) \n\t" /* odd 6 */
- "sb %[st3], 13(%[dst]) \n\t" /* odd 7 */
- "sb %[st1], 15(%[dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [qload3] "=&r" (qload3),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter45] "r" (filter45), [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-void vp9_convolve2_horiz_dspr2(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) {
- if (16 == x_step_q4) {
- uint32_t pos = 38;
-
- vp9_prefetch_load((const uint8_t *)filter_x);
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- convolve_bi_horiz_4_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h);
- break;
- case 8:
- convolve_bi_horiz_8_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h);
- break;
- case 16:
- convolve_bi_horiz_16_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h, 1);
- break;
- case 32:
- convolve_bi_horiz_16_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h, 2);
- break;
- case 64:
- vp9_prefetch_load(src + 64);
- vp9_prefetch_store(dst + 32);
-
- convolve_bi_horiz_64_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h);
- break;
- default:
- vp9_convolve8_horiz_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_horiz_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_vert_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_vert_dspr2.c
deleted file mode 100644
index bf01f11..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve2_vert_dspr2.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_bi_vert_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t w,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2;
- uint32_t p1, p2;
- uint32_t scratch1;
- uint32_t store1, store2;
- int32_t Temp1, Temp2;
- const int16_t *filter = &filter_y[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
-
- for (x = 0; x < w; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t"
-
- "extp %[Temp1], $ac0, 31 \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [scratch1] "=&r" (scratch1),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [filter45] "r" (filter45),[vector4a] "r" (vector4a),
- [src_stride] "r" (src_stride),
- [cm] "r" (cm), [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_bi_vert_64_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2;
- uint32_t p1, p2;
- uint32_t scratch1;
- uint32_t store1, store2;
- int32_t Temp1, Temp2;
- const int16_t *filter = &filter_y[3];
- uint32_t filter45;
-
- filter45 = ((const int32_t *)filter)[0];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
-
- for (x = 0; x < 64; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter45] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[filter45] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter45] \n\t"
-
- "extp %[Temp1], $ac0, 31 \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [scratch1] "=&r" (scratch1),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [filter45] "r" (filter45),[vector4a] "r" (vector4a),
- [src_stride] "r" (src_stride),
- [cm] "r" (cm), [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve2_vert_dspr2(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) {
- if (16 == y_step_q4) {
- uint32_t pos = 38;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4 :
- case 8 :
- case 16 :
- case 32 :
- convolve_bi_vert_4_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, w, h);
- break;
- case 64 :
- vp9_prefetch_store(dst + 32);
- convolve_bi_vert_64_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, h);
- break;
- default:
- vp9_convolve8_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_dspr2.c
deleted file mode 100644
index ab18490..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_dspr2.c
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_avg_vert_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t w,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2, load3, load4;
- uint32_t p1, p2;
- uint32_t n1, n2;
- uint32_t scratch1, scratch2;
- uint32_t store1, store2;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2;
-
- vector1b = ((const int32_t *)filter_y)[0];
- vector2b = ((const int32_t *)filter_y)[1];
- vector3b = ((const int32_t *)filter_y)[2];
- vector4b = ((const int32_t *)filter_y)[3];
-
- src -= 3 * src_stride;
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
-
- for (x = 0; x < w; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector2b] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
-
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac0, 31 \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector4b] \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "lbu %[scratch1], 0(%[dst_ptr]) \n\t"
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
- "lbu %[scratch2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 1 */
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector4b] \n\t"
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 2 */
- "extp %[Temp2], $ac3, 31 \n\t"
- "lbu %[scratch1], 2(%[dst_ptr]) \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
- "lbu %[scratch2], 3(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 3 */
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 4 */
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [n1] "=&r" (n1), [n2] "=&r" (n2),
- [scratch1] "=&r" (scratch1), [scratch2] "=&r" (scratch2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a),
- [src_stride] "r" (src_stride), [cm] "r" (cm), [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_avg_vert_64_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2, load3, load4;
- uint32_t p1, p2;
- uint32_t n1, n2;
- uint32_t scratch1, scratch2;
- uint32_t store1, store2;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2;
-
- vector1b = ((const int32_t *)filter_y)[0];
- vector2b = ((const int32_t *)filter_y)[1];
- vector3b = ((const int32_t *)filter_y)[2];
- vector4b = ((const int32_t *)filter_y)[3];
-
- src -= 3 * src_stride;
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
- vp9_prefetch_store(dst + dst_stride + 32);
-
- for (x = 0; x < 64; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector2b] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
-
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac0, 31 \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector4b] \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "lbu %[scratch1], 0(%[dst_ptr]) \n\t"
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
- "lbu %[scratch2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 1 */
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector4b] \n\t"
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 2 */
- "extp %[Temp2], $ac3, 31 \n\t"
- "lbu %[scratch1], 2(%[dst_ptr]) \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
- "lbu %[scratch2], 3(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[store1], %[store1], %[scratch1] \n\t" /* pixel 3 */
- "addqh_r.w %[store2], %[store2], %[scratch2] \n\t" /* pixel 4 */
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [n1] "=&r" (n1), [n2] "=&r" (n2),
- [scratch1] "=&r" (scratch1), [scratch2] "=&r" (scratch2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a),
- [src_stride] "r" (src_stride), [cm] "r" (cm), [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve8_avg_vert_dspr2(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) {
- if (((const int32_t *)filter_y)[1] == 0x800000) {
- vp9_convolve_avg(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else if (((const int32_t *)filter_y)[0] == 0) {
- vp9_convolve2_avg_vert_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else {
- if (16 == y_step_q4) {
- uint32_t pos = 38;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- case 8:
- case 16:
- case 32:
- convolve_avg_vert_4_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, w, h);
- break;
- case 64:
- vp9_prefetch_store(dst + 32);
- convolve_avg_vert_64_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, h);
- break;
- default:
- vp9_convolve8_avg_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_avg_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
- }
-}
-
-void vp9_convolve8_avg_dspr2(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) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(32, uint8_t, temp, 64 * 135);
- int32_t intermediate_height = ((h * y_step_q4) >> 4) + 7;
-
- assert(w <= 64);
- assert(h <= 64);
-
- if (intermediate_height < h)
- intermediate_height = h;
-
- if (x_step_q4 != 16 || y_step_q4 != 16)
- return vp9_convolve8_avg_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
-
- vp9_convolve8_horiz(src - (src_stride * 3), src_stride,
- temp, 64,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, intermediate_height);
-
- vp9_convolve8_avg_vert(temp + 64 * 3, 64,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
-}
-
-void vp9_convolve_avg_dspr2(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
- uint32_t tp1, tp2, tn1;
- uint32_t tp3, tp4, tn2;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- /* 1 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 0(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "sw %[tn1], 0(%[dst]) \n\t" /* store */
-
- : [tn1] "=&r" (tn1), [tp1] "=&r" (tp1),
- [tp2] "=&r" (tp2)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- break;
- case 8:
- /* 2 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 0(%[dst]) \n\t"
- "ulw %[tp3], 4(%[src]) \n\t"
- "ulw %[tp4], 4(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "sw %[tn1], 0(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 4(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- break;
- case 16:
- /* 4 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 0(%[dst]) \n\t"
- "ulw %[tp3], 4(%[src]) \n\t"
- "ulw %[tp4], 4(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 8(%[src]) \n\t"
- "ulw %[tp2], 8(%[dst]) \n\t"
- "sw %[tn1], 0(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 4(%[dst]) \n\t" /* store */
- "ulw %[tp3], 12(%[src]) \n\t"
- "ulw %[tp4], 12(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "sw %[tn1], 8(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 12(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- break;
- case 32:
- /* 8 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 0(%[dst]) \n\t"
- "ulw %[tp3], 4(%[src]) \n\t"
- "ulw %[tp4], 4(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 8(%[src]) \n\t"
- "ulw %[tp2], 8(%[dst]) \n\t"
- "sw %[tn1], 0(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 4(%[dst]) \n\t" /* store */
- "ulw %[tp3], 12(%[src]) \n\t"
- "ulw %[tp4], 12(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 16(%[src]) \n\t"
- "ulw %[tp2], 16(%[dst]) \n\t"
- "sw %[tn1], 8(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 12(%[dst]) \n\t" /* store */
- "ulw %[tp3], 20(%[src]) \n\t"
- "ulw %[tp4], 20(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 24(%[src]) \n\t"
- "ulw %[tp2], 24(%[dst]) \n\t"
- "sw %[tn1], 16(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 20(%[dst]) \n\t" /* store */
- "ulw %[tp3], 28(%[src]) \n\t"
- "ulw %[tp4], 28(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "sw %[tn1], 24(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 28(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- break;
- case 64:
- vp9_prefetch_load(src + 64);
- vp9_prefetch_store(dst + 32);
-
- /* 16 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_load(src + src_stride + 64);
- vp9_prefetch_store(dst + dst_stride);
- vp9_prefetch_store(dst + dst_stride + 32);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 0(%[dst]) \n\t"
- "ulw %[tp3], 4(%[src]) \n\t"
- "ulw %[tp4], 4(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 8(%[src]) \n\t"
- "ulw %[tp2], 8(%[dst]) \n\t"
- "sw %[tn1], 0(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 4(%[dst]) \n\t" /* store */
- "ulw %[tp3], 12(%[src]) \n\t"
- "ulw %[tp4], 12(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 16(%[src]) \n\t"
- "ulw %[tp2], 16(%[dst]) \n\t"
- "sw %[tn1], 8(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 12(%[dst]) \n\t" /* store */
- "ulw %[tp3], 20(%[src]) \n\t"
- "ulw %[tp4], 20(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 24(%[src]) \n\t"
- "ulw %[tp2], 24(%[dst]) \n\t"
- "sw %[tn1], 16(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 20(%[dst]) \n\t" /* store */
- "ulw %[tp3], 28(%[src]) \n\t"
- "ulw %[tp4], 28(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 32(%[src]) \n\t"
- "ulw %[tp2], 32(%[dst]) \n\t"
- "sw %[tn1], 24(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 28(%[dst]) \n\t" /* store */
- "ulw %[tp3], 36(%[src]) \n\t"
- "ulw %[tp4], 36(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 40(%[src]) \n\t"
- "ulw %[tp2], 40(%[dst]) \n\t"
- "sw %[tn1], 32(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 36(%[dst]) \n\t" /* store */
- "ulw %[tp3], 44(%[src]) \n\t"
- "ulw %[tp4], 44(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 48(%[src]) \n\t"
- "ulw %[tp2], 48(%[dst]) \n\t"
- "sw %[tn1], 40(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 44(%[dst]) \n\t" /* store */
- "ulw %[tp3], 52(%[src]) \n\t"
- "ulw %[tp4], 52(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "ulw %[tp1], 56(%[src]) \n\t"
- "ulw %[tp2], 56(%[dst]) \n\t"
- "sw %[tn1], 48(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 52(%[dst]) \n\t" /* store */
- "ulw %[tp3], 60(%[src]) \n\t"
- "ulw %[tp4], 60(%[dst]) \n\t"
- "adduh_r.qb %[tn1], %[tp2], %[tp1] \n\t" /* average */
- "sw %[tn1], 56(%[dst]) \n\t" /* store */
- "adduh_r.qb %[tn2], %[tp3], %[tp4] \n\t" /* average */
- "sw %[tn2], 60(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- break;
- default:
- for (y = h; y > 0; --y) {
- for (x = 0; x < w; ++x) {
- dst[x] = (dst[x] + src[x] + 1) >> 1;
- }
-
- src += src_stride;
- dst += dst_stride;
- }
- break;
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_horiz_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_horiz_dspr2.c
deleted file mode 100644
index 69da1cf..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_avg_horiz_dspr2.c
+++ /dev/null
@@ -1,1038 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_avg_horiz_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2, Temp3, Temp4;
- uint32_t vector4a = 64;
- uint32_t tp1, tp2;
- uint32_t p1, p2, p3, p4;
- uint32_t n1, n2, n3, n4;
- uint32_t tn1, tn2;
-
- vector1b = ((const int32_t *)filter_x0)[0];
- vector2b = ((const int32_t *)filter_x0)[1];
- vector3b = ((const int32_t *)filter_x0)[2];
- vector4b = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "ulw %[tn2], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tn2] \n\t"
- "balign %[tn1], %[tn2], 3 \n\t"
- "balign %[tn2], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- "lbu %[p2], 3(%[dst]) \n\t" /* load odd 2 */
-
- /* odd 1. pixel */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t" /* even 1 */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "lbu %[Temp1], 1(%[dst]) \n\t" /* load odd 1 */
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn2] \n\t"
- "preceu.ph.qbl %[n4], %[tn2] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n4], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "lbu %[tn2], 0(%[dst]) \n\t" /* load even 1 */
-
- /* odd 2. pixel */
- "lbux %[tp2], %[Temp3](%[cm]) \n\t" /* even 2 */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[n1], %[tn1] \n\t"
- "lbux %[tn1], %[Temp2](%[cm]) \n\t" /* odd 1 */
- "addqh_r.w %[tn2], %[tn2], %[tp1] \n\t" /* average even 1 */
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector4b] \n\t"
- "extp %[Temp4], $ac2, 31 \n\t"
-
- "lbu %[tp1], 2(%[dst]) \n\t" /* load even 2 */
- "sb %[tn2], 0(%[dst]) \n\t" /* store even 1 */
-
- /* clamp */
- "addqh_r.w %[Temp1], %[Temp1], %[tn1] \n\t" /* average odd 1 */
- "lbux %[n2], %[Temp4](%[cm]) \n\t" /* odd 2 */
- "sb %[Temp1], 1(%[dst]) \n\t" /* store odd 1 */
-
- "addqh_r.w %[tp1], %[tp1], %[tp2] \n\t" /* average even 2 */
- "sb %[tp1], 2(%[dst]) \n\t" /* store even 2 */
-
- "addqh_r.w %[p2], %[p2], %[n2] \n\t" /* average odd 2 */
- "sb %[p2], 3(%[dst]) \n\t" /* store odd 2 */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [n1] "=&r" (n1), [n2] "=&r" (n2), [n3] "=&r" (n3), [n4] "=&r" (n4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_avg_horiz_8_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2, Temp3;
- uint32_t tp1, tp2;
- uint32_t p1, p2, p3, p4, n1;
- uint32_t tn1, tn2, tn3;
- uint32_t st0, st1;
-
- vector1b = ((const int32_t *)filter_x0)[0];
- vector2b = ((const int32_t *)filter_x0)[1];
- vector3b = ((const int32_t *)filter_x0)[2];
- vector4b = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "ulw %[tn2], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
- "lbu %[Temp2], 0(%[dst]) \n\t"
- "lbu %[tn3], 2(%[dst]) \n\t"
-
- /* even 2. pixel */
- "preceu.ph.qbr %[p1], %[tn2] \n\t"
- "preceu.ph.qbl %[n1], %[tn2] \n\t"
- "ulw %[tn1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* even 3. pixel */
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[tn1] \n\t"
- "lbux %[st1], %[Temp3](%[cm]) \n\t"
- "dpa.w.ph $ac1, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector4b] \n\t"
- "extp %[Temp1], $ac1, 31 \n\t"
-
- "addqh_r.w %[Temp2], %[Temp2], %[st0] \n\t"
- "addqh_r.w %[tn3], %[tn3], %[st1] \n\t"
- "sb %[Temp2], 0(%[dst]) \n\t"
- "sb %[tn3], 2(%[dst]) \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "balign %[tn3], %[tn1], 3 \n\t"
- "balign %[tn1], %[tn2], 3 \n\t"
- "balign %[tn2], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
-
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
- "lbu %[Temp2], 4(%[dst]) \n\t"
- "addqh_r.w %[Temp2], %[Temp2], %[st0] \n\t"
-
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "sb %[Temp2], 4(%[dst]) \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "preceu.ph.qbr %[p3], %[tn2] \n\t"
- "preceu.ph.qbl %[p4], %[tn2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "lbu %[tp1], 6(%[dst]) \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tn1] \n\t"
- "preceu.ph.qbl %[n1], %[tn1] \n\t"
- "lbux %[st0], %[Temp3](%[cm]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac1, 31 \n\t"
-
- "lbu %[tp2], 1(%[dst]) \n\t"
- "lbu %[tn2], 3(%[dst]) \n\t"
- "addqh_r.w %[tp1], %[tp1], %[st0] \n\t"
-
- /* odd 3. pixel */
- "lbux %[st1], %[Temp2](%[cm]) \n\t"
- "preceu.ph.qbr %[p2], %[tn3] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector4b] \n\t"
- "addqh_r.w %[tp2], %[tp2], %[st1] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "lbu %[tn3], 5(%[dst]) \n\t"
-
- /* odd 4. pixel */
- "sb %[tp2], 1(%[dst]) \n\t"
- "sb %[tp1], 6(%[dst]) \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbu %[tn1], 7(%[dst]) \n\t"
-
- /* clamp */
- "lbux %[p4], %[Temp3](%[cm]) \n\t"
- "addqh_r.w %[tn2], %[tn2], %[p4] \n\t"
-
- "lbux %[p2], %[Temp2](%[cm]) \n\t"
- "addqh_r.w %[tn3], %[tn3], %[p2] \n\t"
-
- "lbux %[n1], %[Temp1](%[cm]) \n\t"
- "addqh_r.w %[tn1], %[tn1], %[n1] \n\t"
-
- /* store bytes */
- "sb %[tn2], 3(%[dst]) \n\t"
- "sb %[tn3], 5(%[dst]) \n\t"
- "sb %[tn1], 7(%[dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2), [tn3] "=&r" (tn3),
- [st0] "=&r" (st0), [st1] "=&r" (st1),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [n1] "=&r" (n1),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_avg_horiz_16_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h,
- int32_t count) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t filter12, filter34, filter56, filter78;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
-
- filter12 = ((const int32_t *)filter_x0)[0];
- filter34 = ((const int32_t *)filter_x0)[1];
- filter56 = ((const int32_t *)filter_x0)[2];
- filter78 = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_store(dst_ptr + dst_stride);
-
- for (c = 0; c < count; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p2], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p3], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter78] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
- "lbu %[st2], 0(%[dst]) \n\t" /* load even 1 from dst */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p3], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p4], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p1], %[filter78] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- "lbu %[qload3], 2(%[dst]) \n\t" /* load even 2 from dst */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* store even 1 to dst */
- "dpa.w.ph $ac3, %[p3], %[filter12] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p4], %[filter34] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p1], %[filter56] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p5], %[filter78] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st2] \n\t" /* average even 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 2(%[dst]) \n\t" /* store even 2 to dst */
- "ulw %[qload2], 16(%[src]) \n\t"
- "lbu %[qload3], 4(%[dst]) \n\t" /* load even 3 from dst */
- "lbu %[qload1], 6(%[dst]) \n\t" /* load even 4 from dst */
- "dpa.w.ph $ac1, %[p4], %[filter12] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p1], %[filter34] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p5], %[filter56] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p2], %[filter78] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 3 */
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[qload3], 4(%[dst]) \n\t" /* store even 3 to dst */
- "dpa.w.ph $ac2, %[p1], %[filter12] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p5], %[filter34] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p2], %[filter56] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p3], %[filter78] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average even 4 */
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[qload1], 6(%[dst]) \n\t" /* store even 4 to dst */
- "ulw %[qload3], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter12] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* even 6 */
- "lbu %[qload2], 8(%[dst]) \n\t" /* load even 5 from dst */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 5 */
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[qload2], 8(%[dst]) \n\t" /* store even 5 to dst */
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* even 7 */
- "lbu %[qload3], 10(%[dst]) \n\t" /* load even 6 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- "lbu %[st2], 12(%[dst]) \n\t" /* load even 7 from dst */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 6 */
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* even 8 */
- "sb %[qload3], 10(%[dst]) \n\t" /* store even 6 to dst */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* even 8 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 7 */
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st2], 12(%[dst]) \n\t" /* store even 7 to dst */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter12] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* odd 1 */
- "lbu %[qload2], 14(%[dst]) \n\t" /* load even 8 from dst */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- "lbu %[st1], 1(%[dst]) \n\t" /* load odd 1 from dst */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 8 */
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[qload2], 14(%[dst]) \n\t" /* store even 8 to dst */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* odd 2 */
- "lbu %[qload3], 3(%[dst]) \n\t" /* load odd 2 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st3], %[st3], %[st1] \n\t" /* average odd 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* odd 3 */
- "sb %[st3], 1(%[dst]) \n\t" /* store odd 1 to dst */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st1] \n\t" /* average odd 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 3(%[dst]) \n\t" /* store odd 2 to dst */
- "lbu %[qload1], 5(%[dst]) \n\t" /* load odd 3 from dst */
- "ulw %[qload2], 17(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter12] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p1], %[filter34] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p5], %[filter56] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p2], %[filter78] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- "lbu %[st1], 7(%[dst]) \n\t" /* load odd 4 from dst */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st2] \n\t" /* average odd 3 */
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[qload1], 5(%[dst]) \n\t" /* store odd 3 to dst */
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p5], %[filter34] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p2], %[filter56] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p3], %[filter78] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- "lbu %[qload1], 9(%[dst]) \n\t" /* load odd 5 from dst */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st1], %[st1], %[st3] \n\t" /* average odd 4 */
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st1], 7(%[dst]) \n\t" /* store odd 4 to dst */
- "ulw %[qload3], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter12] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p2], %[filter34] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p3], %[filter56] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p4], %[filter78] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 5 */
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[qload1], 9(%[dst]) \n\t" /* store odd 5 to dst */
- "lbu %[qload2], 11(%[dst]) \n\t" /* load odd 6 from dst */
- "dpa.w.ph $ac3, %[p2], %[filter12] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p3], %[filter34] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p4], %[filter56] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p1], %[filter78] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- "lbu %[qload3], 13(%[dst]) \n\t" /* load odd 7 from dst */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter12] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p4], %[filter34] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p1], %[filter56] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p5], %[filter78] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbu %[qload1], 15(%[dst]) \n\t" /* load odd 8 from dst */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average odd 6 */
-
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average odd 7 */
-
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 8 */
-
- "sb %[qload2], 11(%[dst]) \n\t" /* store odd 6 to dst */
- "sb %[qload3], 13(%[dst]) \n\t" /* store odd 7 to dst */
- "sb %[qload1], 15(%[dst]) \n\t" /* store odd 8 to dst */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [qload3] "=&r" (qload3), [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter12] "r" (filter12), [filter34] "r" (filter34),
- [filter56] "r" (filter56), [filter78] "r" (filter78),
- [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-static void convolve_avg_horiz_64_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t filter12, filter34, filter56, filter78;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
-
- filter12 = ((const int32_t *)filter_x0)[0];
- filter34 = ((const int32_t *)filter_x0)[1];
- filter56 = ((const int32_t *)filter_x0)[2];
- filter78 = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_load(src_ptr + src_stride + 64);
- vp9_prefetch_store(dst_ptr + dst_stride);
- vp9_prefetch_store(dst_ptr + dst_stride + 32);
-
- for (c = 0; c < 4; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p2], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p3], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter78] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
- "lbu %[st2], 0(%[dst]) \n\t" /* load even 1 from dst */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p3], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p4], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p1], %[filter78] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- "lbu %[qload3], 2(%[dst]) \n\t" /* load even 2 from dst */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* store even 1 to dst */
- "dpa.w.ph $ac3, %[p3], %[filter12] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p4], %[filter34] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p1], %[filter56] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p5], %[filter78] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st2] \n\t" /* average even 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 2(%[dst]) \n\t" /* store even 2 to dst */
- "ulw %[qload2], 16(%[src]) \n\t"
- "lbu %[qload3], 4(%[dst]) \n\t" /* load even 3 from dst */
- "lbu %[qload1], 6(%[dst]) \n\t" /* load even 4 from dst */
- "dpa.w.ph $ac1, %[p4], %[filter12] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p1], %[filter34] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p5], %[filter56] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p2], %[filter78] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 3 */
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[qload3], 4(%[dst]) \n\t" /* store even 3 to dst */
- "dpa.w.ph $ac2, %[p1], %[filter12] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p5], %[filter34] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p2], %[filter56] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p3], %[filter78] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average even 4 */
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[qload1], 6(%[dst]) \n\t" /* store even 4 to dst */
- "ulw %[qload3], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter12] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* even 6 */
- "lbu %[qload2], 8(%[dst]) \n\t" /* load even 5 from dst */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 5 */
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[qload2], 8(%[dst]) \n\t" /* store even 5 to dst */
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* even 7 */
- "lbu %[qload3], 10(%[dst]) \n\t" /* load even 6 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- "lbu %[st2], 12(%[dst]) \n\t" /* load even 7 from dst */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average even 6 */
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* even 8 */
- "sb %[qload3], 10(%[dst]) \n\t" /* store even 6 to dst */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* even 8 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- "addqh_r.w %[st2], %[st2], %[st1] \n\t" /* average even 7 */
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st2], 12(%[dst]) \n\t" /* store even 7 to dst */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter12] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* odd 1 */
- "lbu %[qload2], 14(%[dst]) \n\t" /* load even 8 from dst */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- "lbu %[st1], 1(%[dst]) \n\t" /* load odd 1 from dst */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average even 8 */
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[qload2], 14(%[dst]) \n\t" /* store even 8 to dst */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* odd 2 */
- "lbu %[qload3], 3(%[dst]) \n\t" /* load odd 2 from dst */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st3], %[st3], %[st1] \n\t" /* average odd 1 */
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* odd 3 */
- "sb %[st3], 1(%[dst]) \n\t" /* store odd 1 to dst */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload3], %[qload3], %[st1] \n\t" /* average odd 2 */
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[qload3], 3(%[dst]) \n\t" /* store odd 2 to dst */
- "lbu %[qload1], 5(%[dst]) \n\t" /* load odd 3 from dst */
- "ulw %[qload2], 17(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter12] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p1], %[filter34] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p5], %[filter56] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p2], %[filter78] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- "lbu %[st1], 7(%[dst]) \n\t" /* load odd 4 from dst */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st2] \n\t" /* average odd 3 */
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[qload1], 5(%[dst]) \n\t" /* store odd 3 to dst */
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p5], %[filter34] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p2], %[filter56] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p3], %[filter78] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- "lbu %[qload1], 9(%[dst]) \n\t" /* load odd 5 from dst */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "addqh_r.w %[st1], %[st1], %[st3] \n\t" /* average odd 4 */
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st1], 7(%[dst]) \n\t" /* store odd 4 to dst */
- "ulw %[qload3], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter12] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p2], %[filter34] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p3], %[filter56] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p4], %[filter78] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 5 */
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[qload1], 9(%[dst]) \n\t" /* store odd 5 to dst */
- "lbu %[qload2], 11(%[dst]) \n\t" /* load odd 6 from dst */
- "dpa.w.ph $ac3, %[p2], %[filter12] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p3], %[filter34] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p4], %[filter56] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p1], %[filter78] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- "lbu %[qload3], 13(%[dst]) \n\t" /* load odd 7 from dst */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter12] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p4], %[filter34] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p1], %[filter56] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p5], %[filter78] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbu %[qload1], 15(%[dst]) \n\t" /* load odd 8 from dst */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "addqh_r.w %[qload2], %[qload2], %[st2] \n\t" /* average odd 6 */
-
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "addqh_r.w %[qload3], %[qload3], %[st3] \n\t" /* average odd 7 */
-
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
- "addqh_r.w %[qload1], %[qload1], %[st1] \n\t" /* average odd 8 */
-
- "sb %[qload2], 11(%[dst]) \n\t" /* store odd 6 to dst */
- "sb %[qload3], 13(%[dst]) \n\t" /* store odd 7 to dst */
- "sb %[qload1], 15(%[dst]) \n\t" /* store odd 8 to dst */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [qload3] "=&r" (qload3), [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter12] "r" (filter12), [filter34] "r" (filter34),
- [filter56] "r" (filter56), [filter78] "r" (filter78),
- [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-void vp9_convolve8_avg_horiz_dspr2(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) {
- if (((const int32_t *)filter_x)[1] == 0x800000) {
- vp9_convolve_avg(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else if (((const int32_t *)filter_x)[0] == 0) {
- vp9_convolve2_avg_horiz_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else {
- if (16 == x_step_q4) {
- uint32_t pos = 38;
-
- src -= 3;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- convolve_avg_horiz_4_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h);
- break;
- case 8:
- convolve_avg_horiz_8_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h);
- break;
- case 16:
- convolve_avg_horiz_16_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h, 1);
- break;
- case 32:
- convolve_avg_horiz_16_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h, 2);
- break;
- case 64:
- vp9_prefetch_load(src + 64);
- vp9_prefetch_store(dst + 32);
-
- convolve_avg_horiz_64_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, h);
- break;
- default:
- vp9_convolve8_avg_horiz_c(src + 3, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_avg_horiz_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_dspr2.c
deleted file mode 100644
index 0ef9dd5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_dspr2.c
+++ /dev/null
@@ -1,1284 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_filter.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-uint8_t vp9_ff_cropTbl_a[256 + 2 * CROP_WIDTH];
-uint8_t *vp9_ff_cropTbl;
-
-void vp9_dsputil_static_init(void) {
- int i;
-
- for (i = 0; i < 256; i++) vp9_ff_cropTbl_a[i + CROP_WIDTH] = i;
-
- for (i = 0; i < CROP_WIDTH; i++) {
- vp9_ff_cropTbl_a[i] = 0;
- vp9_ff_cropTbl_a[i + CROP_WIDTH + 256] = 255;
- }
-
- vp9_ff_cropTbl = &vp9_ff_cropTbl_a[CROP_WIDTH];
-}
-
-static void convolve_horiz_4_transposed_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint8_t *dst_ptr;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2, Temp3, Temp4;
- uint32_t vector4a = 64;
- uint32_t tp1, tp2;
- uint32_t p1, p2, p3, p4;
- uint32_t tn1, tn2;
-
- vector1b = ((const int32_t *)filter_x0)[0];
- vector2b = ((const int32_t *)filter_x0)[1];
- vector3b = ((const int32_t *)filter_x0)[2];
- vector4b = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- dst_ptr = dst;
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "ulw %[tn2], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tn2] \n\t"
- "balign %[tn1], %[tn2], 3 \n\t"
- "balign %[tn2], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* odd 1. pixel */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "preceu.ph.qbr %[p3], %[tn2] \n\t"
- "preceu.ph.qbl %[p4], %[tn2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "lbux %[tp2], %[Temp3](%[cm]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tn1] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector4b] \n\t"
- "extp %[Temp4], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[tn1], %[Temp2](%[cm]) \n\t"
- "lbux %[p2], %[Temp4](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- "sb %[tn1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- "sb %[tp2], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- "sb %[p2], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_stride] \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tn1] "=&r" (tn1), [tn2] "=&r" (tn2),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4),
- [dst_ptr] "+r" (dst_ptr)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a),
- [cm] "r" (cm), [src] "r" (src), [dst_stride] "r" (dst_stride)
- );
-
- /* Next row... */
- src += src_stride;
- dst += 1;
- }
-}
-
-static void convolve_horiz_8_transposed_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint8_t *dst_ptr;
- uint32_t vector4a = 64;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2, Temp3;
- uint32_t tp1, tp2, tp3;
- uint32_t p1, p2, p3, p4, n1;
- uint8_t *odd_dst;
- uint32_t dst_pitch_2 = (dst_stride << 1);
-
- vector1b = ((const int32_t *)filter_x0)[0];
- vector2b = ((const int32_t *)filter_x0)[1];
- vector3b = ((const int32_t *)filter_x0)[2];
- vector4b = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
-
- dst_ptr = dst;
- odd_dst = (dst_ptr + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp2], 0(%[src]) \n\t"
- "ulw %[tp1], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "preceu.ph.qbr %[p3], %[tp1] \n\t"
- "preceu.ph.qbl %[p4], %[tp1] \n\t"
- "ulw %[tp3], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "preceu.ph.qbr %[p1], %[tp3] \n\t"
- "preceu.ph.qbl %[n1], %[tp3] \n\t"
- "ulw %[tp2], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* even 3. pixel */
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[tp2] \n\t"
- "dpa.w.ph $ac1, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[p1], %[vector3b] \n\t"
- "lbux %[tp3], %[Temp3](%[cm]) \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector4b] \n\t"
- "extp %[p3], $ac1, 31 \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "sb %[Temp2], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
- "sb %[tp3], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
-
- "ulw %[tp1], 1(%[src]) \n\t"
- "ulw %[tp3], 5(%[src]) \n\t"
-
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- "lbux %[tp2], %[p3](%[cm]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp3] \n\t"
- "preceu.ph.qbl %[p4], %[tp3] \n\t"
- "sb %[tp2], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
- "ulw %[tp2], 9(%[src]) \n\t"
-
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "lbux %[tp1], %[Temp3](%[cm]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[n1], %[tp2] \n\t"
- "ulw %[Temp1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[vector1b] \n\t"
- "sb %[tp1], 0(%[dst_ptr]) \n\t"
- "addu %[dst_ptr], %[dst_ptr], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac1, 31 \n\t"
-
- /* odd 3. pixel */
- "lbux %[tp3], %[Temp2](%[cm]) \n\t"
- "preceu.ph.qbr %[p2], %[Temp1] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 4. pixel */
- "sb %[tp3], 0(%[odd_dst]) \n\t"
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[p4], %[Temp3](%[cm]) \n\t"
- "lbux %[p2], %[Temp2](%[cm]) \n\t"
- "lbux %[n1], %[Temp1](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[p4], 0(%[odd_dst]) \n\t"
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[p2], 0(%[odd_dst]) \n\t"
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[n1], 0(%[odd_dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2), [tp3] "=&r" (tp3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [n1] "=&r" (n1),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [dst_ptr] "+r" (dst_ptr), [odd_dst] "+r" (odd_dst)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a), [cm] "r" (cm),
- [src] "r" (src), [dst_pitch_2] "r" (dst_pitch_2)
- );
-
- /* Next row... */
- src += src_stride;
- dst += 1;
- }
-}
-
-static void convolve_horiz_16_transposed_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h,
- int32_t count) {
- int32_t c, y;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t filter12, filter34, filter56, filter78;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- uint32_t dst_pitch_2 = (dst_stride << 1);
- uint8_t *odd_dst;
-
- filter12 = ((const int32_t *)filter_x0)[0];
- filter34 = ((const int32_t *)filter_x0)[1];
- filter56 = ((const int32_t *)filter_x0)[2];
- filter78 = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
-
- src = src_ptr;
- dst = dst_ptr;
-
- odd_dst = (dst + dst_stride);
-
- for (c = 0; c < count; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "ulw %[qload2], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p2], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p3], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter78] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload2] \n\t"
- "preceu.ph.qbl %[p5], %[qload2] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p3], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p4], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p1], %[filter78] \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p3], %[filter12] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p4], %[filter34] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p1], %[filter56] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p5], %[filter78] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 2 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 16(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p4], %[filter12] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p1], %[filter34] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p5], %[filter56] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p2], %[filter78] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st3], 0(%[dst]) \n\t" /* even 3 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p1], %[filter12] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p5], %[filter34] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p2], %[filter56] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p3], %[filter78] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 4 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter12] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 5 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* even 8 */
- "sb %[st3], 0(%[dst]) \n\t" /* even 6 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* even 8 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 7 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter12] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload2] \n\t"
- "preceu.ph.qbl %[p5], %[qload2] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 1 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 2 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 17(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter12] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p1], %[filter34] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p5], %[filter56] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p2], %[filter78] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 3 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p5], %[filter34] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p2], %[filter56] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p3], %[filter78] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 4 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter12] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p2], %[filter34] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p3], %[filter56] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p4], %[filter78] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 5 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter12] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p3], %[filter34] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p4], %[filter56] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p1], %[filter78] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter12] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p4], %[filter34] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p1], %[filter56] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p5], %[filter78] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 6 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 7 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [p5] "=&r" (p5),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [dst] "+r" (dst), [odd_dst] "+r" (odd_dst)
- : [filter12] "r" (filter12), [filter34] "r" (filter34),
- [filter56] "r" (filter56), [filter78] "r" (filter78),
- [vector_64] "r" (vector_64), [cm] "r" (cm),
- [src] "r" (src), [dst_pitch_2] "r" (dst_pitch_2)
- );
-
- src += 16;
- dst = (dst_ptr + ((c + 1) * 16 * dst_stride));
- odd_dst = (dst + dst_stride);
- }
-
- /* Next row... */
- src_ptr += src_stride;
-
- dst_ptr += 1;
- }
-}
-
-static void convolve_horiz_64_transposed_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t c, y;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t filter12, filter34, filter56, filter78;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
- uint32_t dst_pitch_2 = (dst_stride << 1);
- uint8_t *odd_dst;
-
- filter12 = ((const int32_t *)filter_x0)[0];
- filter34 = ((const int32_t *)filter_x0)[1];
- filter56 = ((const int32_t *)filter_x0)[2];
- filter78 = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_load(src_ptr + src_stride + 64);
-
- src = src_ptr;
- dst = dst_ptr;
-
- odd_dst = (dst + dst_stride);
-
- for (c = 0; c < 4; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "ulw %[qload2], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p2], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p3], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter78] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload2] \n\t"
- "preceu.ph.qbl %[p5], %[qload2] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p3], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p4], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p1], %[filter78] \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p3], %[filter12] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p4], %[filter34] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p1], %[filter56] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p5], %[filter78] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 2 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 16(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p4], %[filter12] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p1], %[filter34] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p5], %[filter56] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p2], %[filter78] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st3], 0(%[dst]) \n\t" /* even 3 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p1], %[filter12] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p5], %[filter34] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p2], %[filter56] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p3], %[filter78] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 4 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter12] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 5 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* even 8 */
- "sb %[st3], 0(%[dst]) \n\t" /* even 6 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* even 8 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 7 */
- "addu %[dst], %[dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter12] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload2] \n\t"
- "preceu.ph.qbl %[p5], %[qload2] \n\t"
- "sb %[st2], 0(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 1 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 2 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "ulw %[qload2], 17(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter12] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p1], %[filter34] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p5], %[filter56] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p2], %[filter78] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 3 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p5], %[filter34] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p2], %[filter56] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p3], %[filter78] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 4 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "ulw %[qload1], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter12] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p2], %[filter34] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p3], %[filter56] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p4], %[filter78] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p5], %[qload1] \n\t"
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 5 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
- "dpa.w.ph $ac3, %[p2], %[filter12] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p3], %[filter34] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p4], %[filter56] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p1], %[filter78] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter12] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p4], %[filter34] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p1], %[filter56] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p5], %[filter78] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 0(%[odd_dst]) \n\t" /* odd 6 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st3], 0(%[odd_dst]) \n\t" /* odd 7 */
- "addu %[odd_dst], %[odd_dst], %[dst_pitch_2] \n\t"
-
- "sb %[st1], 0(%[odd_dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [p5] "=&r" (p5),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [dst] "+r" (dst), [odd_dst] "+r" (odd_dst)
- : [filter12] "r" (filter12), [filter34] "r" (filter34),
- [filter56] "r" (filter56), [filter78] "r" (filter78),
- [vector_64] "r" (vector_64), [cm] "r" (cm),
- [src] "r" (src), [dst_pitch_2] "r" (dst_pitch_2)
- );
-
- src += 16;
- dst = (dst_ptr + ((c + 1) * 16 * dst_stride));
- odd_dst = (dst + dst_stride);
- }
-
- /* Next row... */
- src_ptr += src_stride;
-
- dst_ptr += 1;
- }
-}
-
-void convolve_horiz_transposed(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter, int w, int h) {
- int x, y, k;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- int sum = 0;
-
- for (k = 0; k < 8; ++k)
- sum += src[x + k] * filter[k];
-
- dst[x * dst_stride] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
- }
-
- src += src_stride;
- dst += 1;
- }
-}
-
-void copy_horiz_transposed(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dst[x * dst_stride] = src[x];
- }
-
- src += src_stride;
- dst += 1;
- }
-}
-
-void vp9_convolve8_dspr2(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) {
- DECLARE_ALIGNED_ARRAY(32, uint8_t, temp, 64 * 135);
- int32_t intermediate_height = ((h * y_step_q4) >> 4) + 7;
- uint32_t pos = 38;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- if (intermediate_height < h)
- intermediate_height = h;
-
- if (x_step_q4 != 16 || y_step_q4 != 16)
- return vp9_convolve8_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
-
- if ((((const int32_t *)filter_x)[1] == 0x800000)
- && (((const int32_t *)filter_y)[1] == 0x800000))
- return vp9_convolve_copy(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
-
- /* copy the src to dst */
- if (filter_x[3] == 0x80) {
- copy_horiz_transposed(src - src_stride * 3, src_stride,
- temp, intermediate_height,
- w, intermediate_height);
- } else if (((const int32_t *)filter_x)[0] == 0) {
- vp9_convolve2_dspr2(src - src_stride * 3, src_stride,
- temp, intermediate_height,
- filter_x,
- w, intermediate_height);
- } else {
- src -= (src_stride * 3 + 3);
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
-
- switch (w) {
- case 4:
- convolve_horiz_4_transposed_dspr2(src, src_stride,
- temp, intermediate_height,
- filter_x, intermediate_height);
- break;
- case 8:
- convolve_horiz_8_transposed_dspr2(src, src_stride,
- temp, intermediate_height,
- filter_x, intermediate_height);
- break;
- case 16:
- case 32:
- convolve_horiz_16_transposed_dspr2(src, src_stride,
- temp, intermediate_height,
- filter_x, intermediate_height,
- (w/16));
- break;
- case 64:
- vp9_prefetch_load(src + 32);
- convolve_horiz_64_transposed_dspr2(src, src_stride,
- temp, intermediate_height,
- filter_x, intermediate_height);
- break;
- default:
- convolve_horiz_transposed(src, src_stride,
- temp, intermediate_height,
- filter_x, w, intermediate_height);
- break;
- }
- }
-
- /* copy the src to dst */
- if (filter_y[3] == 0x80) {
- copy_horiz_transposed(temp + 3, intermediate_height,
- dst, dst_stride,
- h, w);
- } else if (((const int32_t *)filter_y)[0] == 0) {
- vp9_convolve2_dspr2(temp + 3, intermediate_height,
- dst, dst_stride,
- filter_y,
- h, w);
- } else {
- switch (h) {
- case 4:
- convolve_horiz_4_transposed_dspr2(temp, intermediate_height,
- dst, dst_stride,
- filter_y, w);
- break;
- case 8:
- convolve_horiz_8_transposed_dspr2(temp, intermediate_height,
- dst, dst_stride,
- filter_y, w);
- break;
- case 16:
- case 32:
- convolve_horiz_16_transposed_dspr2(temp, intermediate_height,
- dst, dst_stride,
- filter_y, w, (h/16));
- break;
- case 64:
- convolve_horiz_64_transposed_dspr2(temp, intermediate_height,
- dst, dst_stride,
- filter_y, w);
- break;
- default:
- convolve_horiz_transposed(temp, intermediate_height,
- dst, dst_stride,
- filter_y, h, w);
- break;
- }
- }
-}
-
-void vp9_convolve_copy_dspr2(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- {
- uint32_t tp1;
-
- /* 1 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], (%[src]) \n\t"
- "sw %[tp1], (%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- }
- break;
- case 8:
- {
- uint32_t tp1, tp2;
-
- /* 2 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
- "sw %[tp1], 0(%[dst]) \n\t" /* store */
- "sw %[tp2], 4(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- }
- break;
- case 16:
- {
- uint32_t tp1, tp2, tp3, tp4;
-
- /* 4 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
- "ulw %[tp3], 8(%[src]) \n\t"
- "ulw %[tp4], 12(%[src]) \n\t"
-
- "sw %[tp1], 0(%[dst]) \n\t" /* store */
- "sw %[tp2], 4(%[dst]) \n\t" /* store */
- "sw %[tp3], 8(%[dst]) \n\t" /* store */
- "sw %[tp4], 12(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- }
- break;
- case 32:
- {
- uint32_t tp1, tp2, tp3, tp4;
- uint32_t tp5, tp6, tp7, tp8;
-
- /* 8 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
- "ulw %[tp3], 8(%[src]) \n\t"
- "ulw %[tp4], 12(%[src]) \n\t"
- "ulw %[tp5], 16(%[src]) \n\t"
- "ulw %[tp6], 20(%[src]) \n\t"
- "ulw %[tp7], 24(%[src]) \n\t"
- "ulw %[tp8], 28(%[src]) \n\t"
-
- "sw %[tp1], 0(%[dst]) \n\t" /* store */
- "sw %[tp2], 4(%[dst]) \n\t" /* store */
- "sw %[tp3], 8(%[dst]) \n\t" /* store */
- "sw %[tp4], 12(%[dst]) \n\t" /* store */
- "sw %[tp5], 16(%[dst]) \n\t" /* store */
- "sw %[tp6], 20(%[dst]) \n\t" /* store */
- "sw %[tp7], 24(%[dst]) \n\t" /* store */
- "sw %[tp8], 28(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4),
- [tp5] "=&r" (tp5), [tp6] "=&r" (tp6),
- [tp7] "=&r" (tp7), [tp8] "=&r" (tp8)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- }
- break;
- case 64:
- {
- uint32_t tp1, tp2, tp3, tp4;
- uint32_t tp5, tp6, tp7, tp8;
-
- vp9_prefetch_load(src + 64);
- vp9_prefetch_store(dst + 32);
-
- /* 16 word storage */
- for (y = h; y--; ) {
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_load(src + src_stride + 64);
- vp9_prefetch_store(dst + dst_stride);
- vp9_prefetch_store(dst + dst_stride + 32);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
- "ulw %[tp3], 8(%[src]) \n\t"
- "ulw %[tp4], 12(%[src]) \n\t"
- "ulw %[tp5], 16(%[src]) \n\t"
- "ulw %[tp6], 20(%[src]) \n\t"
- "ulw %[tp7], 24(%[src]) \n\t"
- "ulw %[tp8], 28(%[src]) \n\t"
-
- "sw %[tp1], 0(%[dst]) \n\t" /* store */
- "sw %[tp2], 4(%[dst]) \n\t" /* store */
- "sw %[tp3], 8(%[dst]) \n\t" /* store */
- "sw %[tp4], 12(%[dst]) \n\t" /* store */
- "sw %[tp5], 16(%[dst]) \n\t" /* store */
- "sw %[tp6], 20(%[dst]) \n\t" /* store */
- "sw %[tp7], 24(%[dst]) \n\t" /* store */
- "sw %[tp8], 28(%[dst]) \n\t" /* store */
-
- "ulw %[tp1], 32(%[src]) \n\t"
- "ulw %[tp2], 36(%[src]) \n\t"
- "ulw %[tp3], 40(%[src]) \n\t"
- "ulw %[tp4], 44(%[src]) \n\t"
- "ulw %[tp5], 48(%[src]) \n\t"
- "ulw %[tp6], 52(%[src]) \n\t"
- "ulw %[tp7], 56(%[src]) \n\t"
- "ulw %[tp8], 60(%[src]) \n\t"
-
- "sw %[tp1], 32(%[dst]) \n\t" /* store */
- "sw %[tp2], 36(%[dst]) \n\t" /* store */
- "sw %[tp3], 40(%[dst]) \n\t" /* store */
- "sw %[tp4], 44(%[dst]) \n\t" /* store */
- "sw %[tp5], 48(%[dst]) \n\t" /* store */
- "sw %[tp6], 52(%[dst]) \n\t" /* store */
- "sw %[tp7], 56(%[dst]) \n\t" /* store */
- "sw %[tp8], 60(%[dst]) \n\t" /* store */
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tp3] "=&r" (tp3), [tp4] "=&r" (tp4),
- [tp5] "=&r" (tp5), [tp6] "=&r" (tp6),
- [tp7] "=&r" (tp7), [tp8] "=&r" (tp8)
- : [src] "r" (src), [dst] "r" (dst)
- );
-
- src += src_stride;
- dst += dst_stride;
- }
- }
- break;
- default:
- for (y = h; y--; ) {
- for (x = 0; x < w; ++x) {
- dst[x] = src[x];
- }
-
- src += src_stride;
- dst += dst_stride;
- }
- break;
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_horiz_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_horiz_dspr2.c
deleted file mode 100644
index 0303896..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_horiz_dspr2.c
+++ /dev/null
@@ -1,923 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_horiz_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2, Temp3, Temp4;
- uint32_t vector4a = 64;
- uint32_t tp1, tp2;
- uint32_t p1, p2, p3, p4;
- uint32_t n1, n2, n3, n4;
- uint32_t tn1, tn2;
-
- vector1b = ((const int32_t *)filter_x0)[0];
- vector2b = ((const int32_t *)filter_x0)[1];
- vector3b = ((const int32_t *)filter_x0)[2];
- vector4b = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "ulw %[tn2], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tn2] \n\t"
- "balign %[tn1], %[tn2], 3 \n\t"
- "balign %[tn2], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* odd 1. pixel */
- "lbux %[tp1], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[n1], %[tp2] \n\t"
- "preceu.ph.qbl %[n2], %[tp2] \n\t"
- "preceu.ph.qbr %[n3], %[tn2] \n\t"
- "preceu.ph.qbl %[n4], %[tn2] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n4], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "lbux %[tp2], %[Temp3](%[cm]) \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[n1], %[tn1] \n\t"
- "dpa.w.ph $ac2, %[n2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[n3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector4b] \n\t"
- "extp %[Temp4], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[tn1], %[Temp2](%[cm]) \n\t"
- "lbux %[n2], %[Temp4](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[tp1], 0(%[dst]) \n\t"
- "sb %[tn1], 1(%[dst]) \n\t"
- "sb %[tp2], 2(%[dst]) \n\t"
- "sb %[n2], 3(%[dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [n1] "=&r" (n1), [n2] "=&r" (n2), [n3] "=&r" (n3), [n4] "=&r" (n4),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [Temp3] "=&r" (Temp3), [Temp4] "=&r" (Temp4)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_horiz_8_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2, Temp3;
- uint32_t tp1, tp2;
- uint32_t p1, p2, p3, p4, n1;
- uint32_t tn1, tn2, tn3;
- uint32_t st0, st1;
-
- vector1b = ((const int32_t *)filter_x0)[0];
- vector2b = ((const int32_t *)filter_x0)[1];
- vector3b = ((const int32_t *)filter_x0)[2];
- vector4b = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_load(src + src_stride);
- vp9_prefetch_load(src + src_stride + 32);
- vp9_prefetch_store(dst + dst_stride);
-
- __asm__ __volatile__ (
- "ulw %[tp1], 0(%[src]) \n\t"
- "ulw %[tp2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tp1] \n\t"
- "preceu.ph.qbl %[p2], %[tp1] \n\t"
- "preceu.ph.qbr %[p3], %[tp2] \n\t"
- "preceu.ph.qbl %[p4], %[tp2] \n\t"
- "ulw %[tn2], 8(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp1], $ac3, 31 \n\t"
-
- /* even 2. pixel */
- "preceu.ph.qbr %[p1], %[tn2] \n\t"
- "preceu.ph.qbl %[n1], %[tn2] \n\t"
- "ulw %[tn1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- /* even 3. pixel */
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[tn1] \n\t"
- "dpa.w.ph $ac1, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector4b] \n\t"
- "extp %[Temp1], $ac1, 31 \n\t"
-
- /* even 4. pixel */
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "sb %[st0], 0(%[dst]) \n\t"
- "lbux %[st1], %[Temp3](%[cm]) \n\t"
-
- "balign %[tn3], %[tn1], 3 \n\t"
- "balign %[tn1], %[tn2], 3 \n\t"
- "balign %[tn2], %[tp2], 3 \n\t"
- "balign %[tp2], %[tp1], 3 \n\t"
-
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp3], $ac2, 31 \n\t"
-
- "lbux %[st0], %[Temp1](%[cm]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector4a], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "sb %[st1], 2(%[dst]) \n\t"
- "preceu.ph.qbr %[p1], %[tp2] \n\t"
- "preceu.ph.qbl %[p2], %[tp2] \n\t"
- "preceu.ph.qbr %[p3], %[tn2] \n\t"
- "preceu.ph.qbl %[p4], %[tn2] \n\t"
- "sb %[st0], 4(%[dst]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 2. pixel */
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[tn1] \n\t"
- "preceu.ph.qbl %[n1], %[tn1] \n\t"
- "lbux %[st0], %[Temp3](%[cm]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[p3], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[p4], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[p1], %[vector4b] \n\t"
- "extp %[Temp3], $ac1, 31 \n\t"
-
- /* odd 3. pixel */
- "lbux %[st1], %[Temp2](%[cm]) \n\t"
- "preceu.ph.qbr %[p2], %[tn3] \n\t"
- "dpa.w.ph $ac3, %[p3], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[p4], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- /* odd 4. pixel */
- "sb %[st1], 1(%[dst]) \n\t"
- "sb %[st0], 6(%[dst]) \n\t"
- "dpa.w.ph $ac2, %[p4], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector2b] \n\t"
- "dpa.w.ph $ac2, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- /* clamp */
- "lbux %[p4], %[Temp3](%[cm]) \n\t"
- "lbux %[p2], %[Temp2](%[cm]) \n\t"
- "lbux %[n1], %[Temp1](%[cm]) \n\t"
-
- /* store bytes */
- "sb %[p4], 3(%[dst]) \n\t"
- "sb %[p2], 5(%[dst]) \n\t"
- "sb %[n1], 7(%[dst]) \n\t"
-
- : [tp1] "=&r" (tp1), [tp2] "=&r" (tp2),
- [tn1] "=&r" (tn1), [tn2] "=&r" (tn2), [tn3] "=&r" (tn3),
- [st0] "=&r" (st0), [st1] "=&r" (st1),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [n1] "=&r" (n1),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a),
- [cm] "r" (cm), [dst] "r" (dst), [src] "r" (src)
- );
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_horiz_16_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h,
- int32_t count) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t filter12, filter34, filter56, filter78;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
-
- filter12 = ((const int32_t *)filter_x0)[0];
- filter34 = ((const int32_t *)filter_x0)[1];
- filter56 = ((const int32_t *)filter_x0)[2];
- filter78 = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_store(dst_ptr + dst_stride);
-
- for (c = 0; c < count; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p2], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p3], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter78] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p3], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p4], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p1], %[filter78] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "dpa.w.ph $ac3, %[p3], %[filter12] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p4], %[filter34] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p1], %[filter56] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p5], %[filter78] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st2], 2(%[dst]) \n\t" /* even 1 */
- "ulw %[qload2], 16(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p4], %[filter12] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p1], %[filter34] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p5], %[filter56] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p2], %[filter78] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st3], 4(%[dst]) \n\t" /* even 3 */
- "dpa.w.ph $ac2, %[p1], %[filter12] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p5], %[filter34] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p2], %[filter56] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p3], %[filter78] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st1], 6(%[dst]) \n\t" /* even 4 */
- "ulw %[qload3], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter12] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[st2], 8(%[dst]) \n\t" /* even 5 */
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* even 8 */
- "sb %[st3], 10(%[dst]) \n\t" /* even 6 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* even 8 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 12(%[dst]) \n\t" /* even 7 */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter12] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[st2], 14(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 1(%[dst]) \n\t" /* odd 1 */
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 3(%[dst]) \n\t" /* odd 2 */
- "ulw %[qload2], 17(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter12] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p1], %[filter34] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p5], %[filter56] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p2], %[filter78] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st2], 5(%[dst]) \n\t" /* odd 3 */
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p5], %[filter34] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p2], %[filter56] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p3], %[filter78] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st3], 7(%[dst]) \n\t" /* odd 4 */
- "ulw %[qload3], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter12] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p2], %[filter34] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p3], %[filter56] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p4], %[filter78] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[st1], 9(%[dst]) \n\t" /* odd 5 */
- "dpa.w.ph $ac3, %[p2], %[filter12] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p3], %[filter34] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p4], %[filter56] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p1], %[filter78] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter12] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p4], %[filter34] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p1], %[filter56] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p5], %[filter78] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 11(%[dst]) \n\t" /* odd 6 */
- "sb %[st3], 13(%[dst]) \n\t" /* odd 7 */
- "sb %[st1], 15(%[dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [qload3] "=&r" (qload3),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter12] "r" (filter12), [filter34] "r" (filter34),
- [filter56] "r" (filter56), [filter78] "r" (filter78),
- [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst),
- [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-static void convolve_horiz_64_dspr2(const uint8_t *src_ptr,
- int32_t src_stride,
- uint8_t *dst_ptr,
- int32_t dst_stride,
- const int16_t *filter_x0,
- int32_t h) {
- int32_t y, c;
- const uint8_t *src;
- uint8_t *dst;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector_64 = 64;
- int32_t filter12, filter34, filter56, filter78;
- int32_t Temp1, Temp2, Temp3;
- uint32_t qload1, qload2, qload3;
- uint32_t p1, p2, p3, p4, p5;
- uint32_t st1, st2, st3;
-
- filter12 = ((const int32_t *)filter_x0)[0];
- filter34 = ((const int32_t *)filter_x0)[1];
- filter56 = ((const int32_t *)filter_x0)[2];
- filter78 = ((const int32_t *)filter_x0)[3];
-
- for (y = h; y--;) {
- src = src_ptr;
- dst = dst_ptr;
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src_ptr + src_stride);
- vp9_prefetch_load(src_ptr + src_stride + 32);
- vp9_prefetch_load(src_ptr + src_stride + 64);
- vp9_prefetch_store(dst_ptr + dst_stride);
- vp9_prefetch_store(dst_ptr + dst_stride + 32);
-
- for (c = 0; c < 4; c++) {
- __asm__ __volatile__ (
- "ulw %[qload1], 0(%[src]) \n\t"
- "ulw %[qload2], 4(%[src]) \n\t"
-
- /* even 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 1 */
- "mthi $zero, $ac1 \n\t"
- "mtlo %[vector_64], $ac2 \n\t" /* even 2 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "ulw %[qload3], 8(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p2], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p3], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac1, %[p4], %[filter78] \n\t" /* even 1 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 1 */
-
- /* even 2. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 3 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "ulw %[qload1], 12(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p2], %[filter12] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p3], %[filter34] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p4], %[filter56] \n\t" /* even 1 */
- "dpa.w.ph $ac2, %[p1], %[filter78] \n\t" /* even 1 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 1 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 1 */
-
- /* even 3. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 4 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st1], 0(%[dst]) \n\t" /* even 1 */
- "dpa.w.ph $ac3, %[p3], %[filter12] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p4], %[filter34] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p1], %[filter56] \n\t" /* even 3 */
- "dpa.w.ph $ac3, %[p5], %[filter78] \n\t" /* even 3 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 3 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 1 */
-
- /* even 4. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 5 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st2], 2(%[dst]) \n\t" /* even 1 */
- "ulw %[qload2], 16(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p4], %[filter12] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p1], %[filter34] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p5], %[filter56] \n\t" /* even 4 */
- "dpa.w.ph $ac1, %[p2], %[filter78] \n\t" /* even 4 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 4 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 3 */
-
- /* even 5. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* even 6 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st3], 4(%[dst]) \n\t" /* even 3 */
- "dpa.w.ph $ac2, %[p1], %[filter12] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p5], %[filter34] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p2], %[filter56] \n\t" /* even 5 */
- "dpa.w.ph $ac2, %[p3], %[filter78] \n\t" /* even 5 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 5 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 4 */
-
- /* even 6. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* even 7 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st1], 6(%[dst]) \n\t" /* even 4 */
- "ulw %[qload3], 20(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p5], %[filter12] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* even 6 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* even 6 */
- "extp %[Temp3], $ac3, 31 \n\t" /* even 6 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 5 */
-
- /* even 7. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* even 8 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[st2], 8(%[dst]) \n\t" /* even 5 */
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* even 7 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* even 7 */
- "extp %[Temp1], $ac1, 31 \n\t" /* even 7 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* even 6 */
-
- /* even 8. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 1 */
- "mthi $zero, $ac3 \n\t"
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* even 8 */
- "sb %[st3], 10(%[dst]) \n\t" /* even 6 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* even 8 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* even 8 */
- "extp %[Temp2], $ac2, 31 \n\t" /* even 8 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* even 7 */
-
- /* ODD pixels */
- "ulw %[qload1], 1(%[src]) \n\t"
- "ulw %[qload2], 5(%[src]) \n\t"
-
- /* odd 1. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 2 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p1], %[qload1] \n\t"
- "preceu.ph.qbl %[p2], %[qload1] \n\t"
- "preceu.ph.qbr %[p3], %[qload2] \n\t"
- "preceu.ph.qbl %[p4], %[qload2] \n\t"
- "sb %[st1], 12(%[dst]) \n\t" /* even 7 */
- "ulw %[qload3], 9(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p1], %[filter12] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p2], %[filter34] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p3], %[filter56] \n\t" /* odd 1 */
- "dpa.w.ph $ac3, %[p4], %[filter78] \n\t" /* odd 1 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 1 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* even 8 */
-
- /* odd 2. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 3 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p1], %[qload3] \n\t"
- "preceu.ph.qbl %[p5], %[qload3] \n\t"
- "sb %[st2], 14(%[dst]) \n\t" /* even 8 */
- "ulw %[qload1], 13(%[src]) \n\t"
- "dpa.w.ph $ac1, %[p2], %[filter12] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p3], %[filter34] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p4], %[filter56] \n\t" /* odd 2 */
- "dpa.w.ph $ac1, %[p1], %[filter78] \n\t" /* odd 2 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 2 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 1 */
-
- /* odd 3. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 4 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbr %[p2], %[qload1] \n\t"
- "sb %[st3], 1(%[dst]) \n\t" /* odd 1 */
- "dpa.w.ph $ac2, %[p3], %[filter12] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p4], %[filter34] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p1], %[filter56] \n\t" /* odd 3 */
- "dpa.w.ph $ac2, %[p5], %[filter78] \n\t" /* odd 3 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 3 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 2 */
-
- /* odd 4. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 5 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbl %[p3], %[qload1] \n\t"
- "sb %[st1], 3(%[dst]) \n\t" /* odd 2 */
- "ulw %[qload2], 17(%[src]) \n\t"
- "dpa.w.ph $ac3, %[p4], %[filter12] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p1], %[filter34] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p5], %[filter56] \n\t" /* odd 4 */
- "dpa.w.ph $ac3, %[p2], %[filter78] \n\t" /* odd 4 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 4 */
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 3 */
-
- /* odd 5. pixel */
- "mtlo %[vector_64], $ac2 \n\t" /* odd 6 */
- "mthi $zero, $ac2 \n\t"
- "preceu.ph.qbr %[p4], %[qload2] \n\t"
- "sb %[st2], 5(%[dst]) \n\t" /* odd 3 */
- "dpa.w.ph $ac1, %[p1], %[filter12] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p5], %[filter34] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p2], %[filter56] \n\t" /* odd 5 */
- "dpa.w.ph $ac1, %[p3], %[filter78] \n\t" /* odd 5 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 5 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 4 */
-
- /* odd 6. pixel */
- "mtlo %[vector_64], $ac3 \n\t" /* odd 7 */
- "mthi $zero, $ac3 \n\t"
- "preceu.ph.qbl %[p1], %[qload2] \n\t"
- "sb %[st3], 7(%[dst]) \n\t" /* odd 4 */
- "ulw %[qload3], 21(%[src]) \n\t"
- "dpa.w.ph $ac2, %[p5], %[filter12] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p2], %[filter34] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p3], %[filter56] \n\t" /* odd 6 */
- "dpa.w.ph $ac2, %[p4], %[filter78] \n\t" /* odd 6 */
- "extp %[Temp2], $ac2, 31 \n\t" /* odd 6 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 5 */
-
- /* odd 7. pixel */
- "mtlo %[vector_64], $ac1 \n\t" /* odd 8 */
- "mthi $zero, $ac1 \n\t"
- "preceu.ph.qbr %[p5], %[qload3] \n\t"
- "sb %[st1], 9(%[dst]) \n\t" /* odd 5 */
- "dpa.w.ph $ac3, %[p2], %[filter12] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p3], %[filter34] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p4], %[filter56] \n\t" /* odd 7 */
- "dpa.w.ph $ac3, %[p1], %[filter78] \n\t" /* odd 7 */
- "extp %[Temp3], $ac3, 31 \n\t" /* odd 7 */
-
- /* odd 8. pixel */
- "dpa.w.ph $ac1, %[p3], %[filter12] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p4], %[filter34] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p1], %[filter56] \n\t" /* odd 8 */
- "dpa.w.ph $ac1, %[p5], %[filter78] \n\t" /* odd 8 */
- "extp %[Temp1], $ac1, 31 \n\t" /* odd 8 */
-
- "lbux %[st2], %[Temp2](%[cm]) \n\t" /* odd 6 */
- "lbux %[st3], %[Temp3](%[cm]) \n\t" /* odd 7 */
- "lbux %[st1], %[Temp1](%[cm]) \n\t" /* odd 8 */
-
- "sb %[st2], 11(%[dst]) \n\t" /* odd 6 */
- "sb %[st3], 13(%[dst]) \n\t" /* odd 7 */
- "sb %[st1], 15(%[dst]) \n\t" /* odd 8 */
-
- : [qload1] "=&r" (qload1), [qload2] "=&r" (qload2), [qload3] "=&r" (qload3),
- [st1] "=&r" (st1), [st2] "=&r" (st2), [st3] "=&r" (st3),
- [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4),
- [p5] "=&r" (p5),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3)
- : [filter12] "r" (filter12), [filter34] "r" (filter34),
- [filter56] "r" (filter56), [filter78] "r" (filter78),
- [vector_64] "r" (vector_64),
- [cm] "r" (cm), [dst] "r" (dst),
- [src] "r" (src)
- );
-
- src += 16;
- dst += 16;
- }
-
- /* Next row... */
- src_ptr += src_stride;
- dst_ptr += dst_stride;
- }
-}
-
-void vp9_convolve8_horiz_dspr2(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) {
- if (((const int32_t *)filter_x)[1] == 0x800000) {
- vp9_convolve_copy(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else if (((const int32_t *)filter_x)[0] == 0) {
- vp9_convolve2_horiz_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else {
- if (16 == x_step_q4) {
- uint32_t pos = 38;
-
- vp9_prefetch_load((const uint8_t *)filter_x);
- src -= 3;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- /* prefetch data to cache memory */
- vp9_prefetch_load(src);
- vp9_prefetch_load(src + 32);
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4:
- convolve_horiz_4_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h);
- break;
- case 8:
- convolve_horiz_8_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h);
- break;
- case 16:
- convolve_horiz_16_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h, 1);
- break;
- case 32:
- convolve_horiz_16_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h, 2);
- break;
- case 64:
- vp9_prefetch_load(src + 64);
- vp9_prefetch_store(dst + 32);
-
- convolve_horiz_64_dspr2(src, (int32_t)src_stride,
- dst, (int32_t)dst_stride,
- filter_x, (int32_t)h);
- break;
- default:
- vp9_convolve8_horiz_c(src + 3, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_horiz_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
- }
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_vert_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_vert_dspr2.c
deleted file mode 100644
index 0930bb3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_convolve8_vert_dspr2.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void convolve_vert_4_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t w,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2, load3, load4;
- uint32_t p1, p2;
- uint32_t n1, n2;
- uint32_t scratch1, scratch2;
- uint32_t store1, store2;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2;
-
- vector1b = ((const int32_t *)filter_y)[0];
- vector2b = ((const int32_t *)filter_y)[1];
- vector3b = ((const int32_t *)filter_y)[2];
- vector4b = ((const int32_t *)filter_y)[3];
-
- src -= 3 * src_stride;
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
-
- for (x = 0; x < w; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector2b] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
-
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac0, 31 \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector4b] \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [n1] "=&r" (n1), [n2] "=&r" (n2),
- [scratch1] "=&r" (scratch1), [scratch2] "=&r" (scratch2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a), [src_stride] "r" (src_stride),
- [cm] "r" (cm), [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_vert_64_dspr2(const uint8_t *src,
- int32_t src_stride,
- uint8_t *dst,
- int32_t dst_stride,
- const int16_t *filter_y,
- int32_t h) {
- int32_t x, y;
- const uint8_t *src_ptr;
- uint8_t *dst_ptr;
- uint8_t *cm = vp9_ff_cropTbl;
- uint32_t vector4a = 64;
- uint32_t load1, load2, load3, load4;
- uint32_t p1, p2;
- uint32_t n1, n2;
- uint32_t scratch1, scratch2;
- uint32_t store1, store2;
- int32_t vector1b, vector2b, vector3b, vector4b;
- int32_t Temp1, Temp2;
-
- vector1b = ((const int32_t *)filter_y)[0];
- vector2b = ((const int32_t *)filter_y)[1];
- vector3b = ((const int32_t *)filter_y)[2];
- vector4b = ((const int32_t *)filter_y)[3];
-
- src -= 3 * src_stride;
-
- for (y = h; y--;) {
- /* prefetch data to cache memory */
- vp9_prefetch_store(dst + dst_stride);
- vp9_prefetch_store(dst + dst_stride + 32);
-
- for (x = 0; x < 64; x += 4) {
- src_ptr = src + x;
- dst_ptr = dst + x;
-
- __asm__ __volatile__ (
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "mtlo %[vector4a], $ac0 \n\t"
- "mtlo %[vector4a], $ac1 \n\t"
- "mtlo %[vector4a], $ac2 \n\t"
- "mtlo %[vector4a], $ac3 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector2b] \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac2, %[p1], %[vector1b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector2b] \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector1b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector2b] \n\t"
-
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load1], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load2], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load3], 0(%[src_ptr]) \n\t"
- "add %[src_ptr], %[src_ptr], %[src_stride] \n\t"
- "ulw %[load4], 0(%[src_ptr]) \n\t"
-
- "preceu.ph.qbr %[scratch1], %[load1] \n\t"
- "preceu.ph.qbr %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbr %[scratch2], %[load3] \n\t"
- "preceu.ph.qbr %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "dpa.w.ph $ac0, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac0, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac0, 31 \n\t"
- "dpa.w.ph $ac1, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac1, %[n2], %[vector4b] \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- "preceu.ph.qbl %[scratch1], %[load1] \n\t"
- "preceu.ph.qbl %[p1], %[load2] \n\t"
- "precrq.ph.w %[n1], %[p1], %[scratch1] \n\t" /* pixel 2 */
- "append %[p1], %[scratch1], 16 \n\t" /* pixel 1 */
- "preceu.ph.qbl %[scratch2], %[load3] \n\t"
- "preceu.ph.qbl %[p2], %[load4] \n\t"
- "precrq.ph.w %[n2], %[p2], %[scratch2] \n\t" /* pixel 2 */
- "append %[p2], %[scratch2], 16 \n\t" /* pixel 1 */
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "dpa.w.ph $ac2, %[p1], %[vector3b] \n\t"
- "dpa.w.ph $ac2, %[p2], %[vector4b] \n\t"
- "extp %[Temp1], $ac2, 31 \n\t"
-
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
- "dpa.w.ph $ac3, %[n1], %[vector3b] \n\t"
- "dpa.w.ph $ac3, %[n2], %[vector4b] \n\t"
- "extp %[Temp2], $ac3, 31 \n\t"
-
- "sb %[store1], 0(%[dst_ptr]) \n\t"
- "sb %[store2], 1(%[dst_ptr]) \n\t"
-
- "lbux %[store1], %[Temp1](%[cm]) \n\t"
- "lbux %[store2], %[Temp2](%[cm]) \n\t"
-
- "sb %[store1], 2(%[dst_ptr]) \n\t"
- "sb %[store2], 3(%[dst_ptr]) \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [p1] "=&r" (p1), [p2] "=&r" (p2),
- [n1] "=&r" (n1), [n2] "=&r" (n2),
- [scratch1] "=&r" (scratch1), [scratch2] "=&r" (scratch2),
- [Temp1] "=&r" (Temp1), [Temp2] "=&r" (Temp2),
- [store1] "=&r" (store1), [store2] "=&r" (store2),
- [src_ptr] "+r" (src_ptr)
- : [vector1b] "r" (vector1b), [vector2b] "r" (vector2b),
- [vector3b] "r" (vector3b), [vector4b] "r" (vector4b),
- [vector4a] "r" (vector4a), [src_stride] "r" (src_stride),
- [cm] "r" (cm), [dst_ptr] "r" (dst_ptr)
- );
- }
-
- /* Next row... */
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve8_vert_dspr2(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) {
- if (((const int32_t *)filter_y)[1] == 0x800000) {
- vp9_convolve_copy(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else if (((const int32_t *)filter_y)[0] == 0) {
- vp9_convolve2_vert_dspr2(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- } else {
- if (16 == y_step_q4) {
- uint32_t pos = 38;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- vp9_prefetch_store(dst);
-
- switch (w) {
- case 4 :
- case 8 :
- case 16 :
- case 32 :
- convolve_vert_4_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, w, h);
- break;
- case 64 :
- vp9_prefetch_store(dst + 32);
- convolve_vert_64_dspr2(src, src_stride,
- dst, dst_stride,
- filter_y, h);
- break;
- default:
- vp9_convolve8_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- break;
- }
- } else {
- vp9_convolve8_vert_c(src, src_stride,
- dst, dst_stride,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- }
- }
-}
-
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred16_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred16_dspr2.c
deleted file mode 100644
index b0dc496..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred16_dspr2.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_h_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
- int32_t tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
-
- __asm__ __volatile__ (
- "lb %[tmp1], (%[left]) \n\t"
- "lb %[tmp2], 1(%[left]) \n\t"
- "lb %[tmp3], 2(%[left]) \n\t"
- "lb %[tmp4], 3(%[left]) \n\t"
- "lb %[tmp5], 4(%[left]) \n\t"
- "lb %[tmp6], 5(%[left]) \n\t"
- "lb %[tmp7], 6(%[left]) \n\t"
- "lb %[tmp8], 7(%[left]) \n\t"
- "lb %[tmp9], 8(%[left]) \n\t"
- "lb %[tmp10], 9(%[left]) \n\t"
- "lb %[tmp11], 10(%[left]) \n\t"
- "lb %[tmp12], 11(%[left]) \n\t"
- "lb %[tmp13], 12(%[left]) \n\t"
- "lb %[tmp14], 13(%[left]) \n\t"
- "lb %[tmp15], 14(%[left]) \n\t"
- "lb %[tmp16], 15(%[left]) \n\t"
-
- "replv.qb %[tmp1], %[tmp1] \n\t"
- "replv.qb %[tmp2], %[tmp2] \n\t"
- "replv.qb %[tmp3], %[tmp3] \n\t"
- "replv.qb %[tmp4], %[tmp4] \n\t"
- "replv.qb %[tmp5], %[tmp5] \n\t"
- "replv.qb %[tmp6], %[tmp6] \n\t"
- "replv.qb %[tmp7], %[tmp7] \n\t"
- "replv.qb %[tmp8], %[tmp8] \n\t"
- "replv.qb %[tmp9], %[tmp9] \n\t"
- "replv.qb %[tmp10], %[tmp10] \n\t"
- "replv.qb %[tmp11], %[tmp11] \n\t"
- "replv.qb %[tmp12], %[tmp12] \n\t"
- "replv.qb %[tmp13], %[tmp13] \n\t"
- "replv.qb %[tmp14], %[tmp14] \n\t"
- "replv.qb %[tmp15], %[tmp15] \n\t"
- "replv.qb %[tmp16], %[tmp16] \n\t"
-
- "sw %[tmp1], (%[dst]) \n\t"
- "sw %[tmp1], 4(%[dst]) \n\t"
- "sw %[tmp1], 8(%[dst]) \n\t"
- "sw %[tmp1], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp2], (%[dst]) \n\t"
- "sw %[tmp2], 4(%[dst]) \n\t"
- "sw %[tmp2], 8(%[dst]) \n\t"
- "sw %[tmp2], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp3], (%[dst]) \n\t"
- "sw %[tmp3], 4(%[dst]) \n\t"
- "sw %[tmp3], 8(%[dst]) \n\t"
- "sw %[tmp3], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp4], (%[dst]) \n\t"
- "sw %[tmp4], 4(%[dst]) \n\t"
- "sw %[tmp4], 8(%[dst]) \n\t"
- "sw %[tmp4], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp5], (%[dst]) \n\t"
- "sw %[tmp5], 4(%[dst]) \n\t"
- "sw %[tmp5], 8(%[dst]) \n\t"
- "sw %[tmp5], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp6], (%[dst]) \n\t"
- "sw %[tmp6], 4(%[dst]) \n\t"
- "sw %[tmp6], 8(%[dst]) \n\t"
- "sw %[tmp6], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp7], (%[dst]) \n\t"
- "sw %[tmp7], 4(%[dst]) \n\t"
- "sw %[tmp7], 8(%[dst]) \n\t"
- "sw %[tmp7], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp8], (%[dst]) \n\t"
- "sw %[tmp8], 4(%[dst]) \n\t"
- "sw %[tmp8], 8(%[dst]) \n\t"
- "sw %[tmp8], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp9], (%[dst]) \n\t"
- "sw %[tmp9], 4(%[dst]) \n\t"
- "sw %[tmp9], 8(%[dst]) \n\t"
- "sw %[tmp9], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp10], (%[dst]) \n\t"
- "sw %[tmp10], 4(%[dst]) \n\t"
- "sw %[tmp10], 8(%[dst]) \n\t"
- "sw %[tmp10], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp11], (%[dst]) \n\t"
- "sw %[tmp11], 4(%[dst]) \n\t"
- "sw %[tmp11], 8(%[dst]) \n\t"
- "sw %[tmp11], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp12], (%[dst]) \n\t"
- "sw %[tmp12], 4(%[dst]) \n\t"
- "sw %[tmp12], 8(%[dst]) \n\t"
- "sw %[tmp12], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp13], (%[dst]) \n\t"
- "sw %[tmp13], 4(%[dst]) \n\t"
- "sw %[tmp13], 8(%[dst]) \n\t"
- "sw %[tmp13], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp14], (%[dst]) \n\t"
- "sw %[tmp14], 4(%[dst]) \n\t"
- "sw %[tmp14], 8(%[dst]) \n\t"
- "sw %[tmp14], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp15], (%[dst]) \n\t"
- "sw %[tmp15], 4(%[dst]) \n\t"
- "sw %[tmp15], 8(%[dst]) \n\t"
- "sw %[tmp15], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp16], (%[dst]) \n\t"
- "sw %[tmp16], 4(%[dst]) \n\t"
- "sw %[tmp16], 8(%[dst]) \n\t"
- "sw %[tmp16], 12(%[dst]) \n\t"
-
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2),
- [tmp3] "=&r" (tmp3), [tmp4] "=&r" (tmp4),
- [tmp5] "=&r" (tmp5), [tmp7] "=&r" (tmp7),
- [tmp6] "=&r" (tmp6), [tmp8] "=&r" (tmp8),
- [tmp9] "=&r" (tmp9), [tmp10] "=&r" (tmp10),
- [tmp11] "=&r" (tmp11), [tmp12] "=&r" (tmp12),
- [tmp13] "=&r" (tmp13), [tmp14] "=&r" (tmp14),
- [tmp15] "=&r" (tmp15), [tmp16] "=&r" (tmp16)
- : [left] "r" (left), [dst] "r" (dst), [stride] "r" (stride)
- );
-}
-
-void vp9_dc_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t expected_dc;
- int32_t average;
- int32_t tmp, above1, above_l1, above_r1, left1, left_r1, left_l1;
- int32_t above2, left2;
-
- __asm__ __volatile__ (
- "lw %[above1], (%[above]) \n\t"
- "lw %[above2], 4(%[above]) \n\t"
- "lw %[left1], (%[left]) \n\t"
- "lw %[left2], 4(%[left]) \n\t"
-
- "preceu.ph.qbl %[above_l1], %[above1] \n\t"
- "preceu.ph.qbr %[above_r1], %[above1] \n\t"
- "preceu.ph.qbl %[left_l1], %[left1] \n\t"
- "preceu.ph.qbr %[left_r1], %[left1] \n\t"
-
- "addu.ph %[average], %[above_r1], %[above_l1] \n\t"
- "addu.ph %[average], %[average], %[left_l1] \n\t"
- "addu.ph %[average], %[average], %[left_r1] \n\t"
-
- "preceu.ph.qbl %[above_l1], %[above2] \n\t"
- "preceu.ph.qbr %[above_r1], %[above2] \n\t"
- "preceu.ph.qbl %[left_l1], %[left2] \n\t"
- "preceu.ph.qbr %[left_r1], %[left2] \n\t"
-
- "addu.ph %[average], %[average], %[above_l1] \n\t"
- "addu.ph %[average], %[average], %[above_r1] \n\t"
- "addu.ph %[average], %[average], %[left_l1] \n\t"
- "addu.ph %[average], %[average], %[left_r1] \n\t"
-
- "lw %[above1], 8(%[above]) \n\t"
- "lw %[above2], 12(%[above]) \n\t"
- "lw %[left1], 8(%[left]) \n\t"
- "lw %[left2], 12(%[left]) \n\t"
-
- "preceu.ph.qbl %[above_l1], %[above1] \n\t"
- "preceu.ph.qbr %[above_r1], %[above1] \n\t"
- "preceu.ph.qbl %[left_l1], %[left1] \n\t"
- "preceu.ph.qbr %[left_r1], %[left1] \n\t"
-
- "addu.ph %[average], %[average], %[above_l1] \n\t"
- "addu.ph %[average], %[average], %[above_r1] \n\t"
- "addu.ph %[average], %[average], %[left_l1] \n\t"
- "addu.ph %[average], %[average], %[left_r1] \n\t"
-
- "preceu.ph.qbl %[above_l1], %[above2] \n\t"
- "preceu.ph.qbr %[above_r1], %[above2] \n\t"
- "preceu.ph.qbl %[left_l1], %[left2] \n\t"
- "preceu.ph.qbr %[left_r1], %[left2] \n\t"
-
- "addu.ph %[average], %[average], %[above_l1] \n\t"
- "addu.ph %[average], %[average], %[above_r1] \n\t"
- "addu.ph %[average], %[average], %[left_l1] \n\t"
- "addu.ph %[average], %[average], %[left_r1] \n\t"
-
- "addiu %[average], %[average], 16 \n\t"
- "srl %[tmp], %[average], 16 \n\t"
- "addu.ph %[average], %[tmp], %[average] \n\t"
- "srl %[expected_dc], %[average], 5 \n\t"
- "replv.qb %[expected_dc], %[expected_dc] \n\t"
-
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
- "sw %[expected_dc], 8(%[dst]) \n\t"
- "sw %[expected_dc], 12(%[dst]) \n\t"
-
- : [left1] "=&r" (left1), [above1] "=&r" (above1),
- [left_l1] "=&r" (left_l1), [above_l1] "=&r" (above_l1),
- [left_r1] "=&r" (left_r1), [above_r1] "=&r" (above_r1),
- [above2] "=&r" (above2), [left2] "=&r" (left2),
- [average] "=&r" (average), [tmp] "=&r" (tmp),
- [expected_dc] "=&r" (expected_dc)
- : [above] "r" (above), [left] "r" (left),
- [dst] "r" (dst), [stride] "r" (stride)
- );
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred4_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred4_dspr2.c
deleted file mode 100644
index a53c623..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred4_dspr2.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_h_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t tmp1, tmp2, tmp3, tmp4;
-
- __asm__ __volatile__ (
- "lb %[tmp1], (%[left]) \n\t"
- "lb %[tmp2], 1(%[left]) \n\t"
- "lb %[tmp3], 2(%[left]) \n\t"
- "lb %[tmp4], 3(%[left]) \n\t"
- "replv.qb %[tmp1], %[tmp1] \n\t"
- "replv.qb %[tmp2], %[tmp2] \n\t"
- "replv.qb %[tmp3], %[tmp3] \n\t"
- "replv.qb %[tmp4], %[tmp4] \n\t"
- "sw %[tmp1], (%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp2], (%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp3], (%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp4], (%[dst]) \n\t"
-
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2),
- [tmp3] "=&r" (tmp3), [tmp4] "=&r" (tmp4)
- : [left] "r" (left), [dst] "r" (dst), [stride] "r" (stride)
- );
-}
-
-void vp9_dc_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t expected_dc;
- int32_t average;
- int32_t tmp, above_c, above_l, above_r, left_c, left_r, left_l;
-
- __asm__ __volatile__ (
- "lw %[above_c], (%[above]) \n\t"
- "lw %[left_c], (%[left]) \n\t"
-
- "preceu.ph.qbl %[above_l], %[above_c] \n\t"
- "preceu.ph.qbr %[above_r], %[above_c] \n\t"
- "preceu.ph.qbl %[left_l], %[left_c] \n\t"
- "preceu.ph.qbr %[left_r], %[left_c] \n\t"
-
- "addu.ph %[average], %[above_r], %[above_l] \n\t"
- "addu.ph %[average], %[average], %[left_l] \n\t"
- "addu.ph %[average], %[average], %[left_r] \n\t"
- "addiu %[average], %[average], 4 \n\t"
- "srl %[tmp], %[average], 16 \n\t"
- "addu.ph %[average], %[tmp], %[average] \n\t"
- "srl %[expected_dc], %[average], 3 \n\t"
- "replv.qb %[expected_dc], %[expected_dc] \n\t"
-
- "sw %[expected_dc], (%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
-
- : [above_c] "=&r" (above_c), [above_l] "=&r" (above_l),
- [above_r] "=&r" (above_r), [left_c] "=&r" (left_c),
- [left_l] "=&r" (left_l), [left_r] "=&r" (left_r),
- [average] "=&r" (average), [tmp] "=&r" (tmp),
- [expected_dc] "=&r" (expected_dc)
- : [above] "r" (above), [left] "r" (left),
- [dst] "r" (dst), [stride] "r" (stride)
- );
-}
-
-void vp9_tm_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t abovel, abover;
- int32_t left0, left1, left2, left3;
- int32_t res0, res1;
- int32_t resl;
- int32_t resr;
- int32_t top_left;
- uint8_t *cm = vp9_ff_cropTbl;
-
- __asm__ __volatile__ (
- "ulw %[resl], (%[above]) \n\t"
-
- "lbu %[left0], (%[left]) \n\t"
- "lbu %[left1], 1(%[left]) \n\t"
- "lbu %[left2], 2(%[left]) \n\t"
- "lbu %[left3], 3(%[left]) \n\t"
-
- "lbu %[top_left], -1(%[above]) \n\t"
-
- "preceu.ph.qbl %[abovel], %[resl] \n\t"
- "preceu.ph.qbr %[abover], %[resl] \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "replv.ph %[left1], %[left1] \n\t"
- "replv.ph %[left2], %[left2] \n\t"
- "replv.ph %[left3], %[left3] \n\t"
-
- "replv.ph %[top_left], %[top_left] \n\t"
-
- "addu.ph %[resl], %[abovel], %[left0] \n\t"
- "subu.ph %[resl], %[resl], %[top_left] \n\t"
-
- "addu.ph %[resr], %[abover], %[left0] \n\t"
- "subu.ph %[resr], %[resr], %[top_left] \n\t"
-
- "sll %[res0], %[resr], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
-
- "sra %[res1], %[resr], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "sb %[res0], (%[dst]) \n\t"
-
- "sll %[res0], %[resl], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
-
- "sra %[res1], %[resl], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
-
- "addu.ph %[resl], %[abovel], %[left1] \n\t"
- "subu.ph %[resl], %[resl], %[top_left] \n\t"
-
- "addu.ph %[resr], %[abover], %[left1] \n\t"
- "subu.ph %[resr], %[resr], %[top_left] \n\t"
-
- "sb %[res0], 2(%[dst]) \n\t"
- "sb %[res1], 3(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
-
- "sll %[res0], %[resr], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
-
- "sra %[res1], %[resr], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "sb %[res0], (%[dst]) \n\t"
-
- "sll %[res0], %[resl], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
-
- "sb %[res1], 1(%[dst]) \n\t"
- "sra %[res1], %[resl], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
-
- "addu.ph %[resl], %[abovel], %[left2] \n\t"
- "subu.ph %[resl], %[resl], %[top_left] \n\t"
-
- "addu.ph %[resr], %[abover], %[left2] \n\t"
- "subu.ph %[resr], %[resr], %[top_left] \n\t"
-
- "sb %[res0], 2(%[dst]) \n\t"
- "sb %[res1], 3(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
-
- "sll %[res0], %[resr], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
-
-
- "sra %[res1], %[resr], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "sb %[res0], (%[dst]) \n\t"
-
- "sll %[res0], %[resl], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
-
-
- "sb %[res1], 1(%[dst]) \n\t"
- "sra %[res1], %[resl], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
-
- "addu.ph %[resl], %[abovel], %[left3] \n\t"
- "subu.ph %[resl], %[resl], %[top_left] \n\t"
-
- "addu.ph %[resr], %[abover], %[left3] \n\t"
- "subu.ph %[resr], %[resr], %[top_left] \n\t"
-
- "sb %[res0], 2(%[dst]) \n\t"
- "sb %[res1], 3(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
-
- "sll %[res0], %[resr], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
-
- "sra %[res1], %[resr], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "sb %[res0], (%[dst]) \n\t"
-
- "sll %[res0], %[resl], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
-
- "sra %[res1], %[resl], 16 \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
-
- "sb %[res0], 2(%[dst]) \n\t"
- "sb %[res1], 3(%[dst]) \n\t"
-
- : [abovel] "=&r" (abovel), [abover] "=&r" (abover),
- [left0] "=&r" (left0), [left1] "=&r" (left1), [left2] "=&r" (left2),
- [res0] "=&r" (res0), [res1] "=&r" (res1), [left3] "=&r" (left3),
- [resl] "=&r" (resl), [resr] "=&r" (resr), [top_left] "=&r" (top_left)
- : [above] "r" (above), [left] "r" (left),
- [dst] "r" (dst), [stride] "r" (stride), [cm] "r" (cm)
- );
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred8_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred8_dspr2.c
deleted file mode 100644
index 40d93ae..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_intrapred8_dspr2.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_h_predictor_8x8_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
-
- __asm__ __volatile__ (
- "lb %[tmp1], (%[left]) \n\t"
- "lb %[tmp2], 1(%[left]) \n\t"
- "lb %[tmp3], 2(%[left]) \n\t"
- "lb %[tmp4], 3(%[left]) \n\t"
- "lb %[tmp5], 4(%[left]) \n\t"
- "lb %[tmp6], 5(%[left]) \n\t"
- "lb %[tmp7], 6(%[left]) \n\t"
- "lb %[tmp8], 7(%[left]) \n\t"
-
- "replv.qb %[tmp1], %[tmp1] \n\t"
- "replv.qb %[tmp2], %[tmp2] \n\t"
- "replv.qb %[tmp3], %[tmp3] \n\t"
- "replv.qb %[tmp4], %[tmp4] \n\t"
- "replv.qb %[tmp5], %[tmp5] \n\t"
- "replv.qb %[tmp6], %[tmp6] \n\t"
- "replv.qb %[tmp7], %[tmp7] \n\t"
- "replv.qb %[tmp8], %[tmp8] \n\t"
-
- "sw %[tmp1], (%[dst]) \n\t"
- "sw %[tmp1], 4(%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp2], (%[dst]) \n\t"
- "sw %[tmp2], 4(%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp3], (%[dst]) \n\t"
- "sw %[tmp3], 4(%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp4], (%[dst]) \n\t"
- "sw %[tmp4], 4(%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp5], (%[dst]) \n\t"
- "sw %[tmp5], 4(%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp6], (%[dst]) \n\t"
- "sw %[tmp6], 4(%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp7], (%[dst]) \n\t"
- "sw %[tmp7], 4(%[dst]) \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[tmp8], (%[dst]) \n\t"
- "sw %[tmp8], 4(%[dst]) \n\t"
-
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2),
- [tmp3] "=&r" (tmp3), [tmp4] "=&r" (tmp4),
- [tmp5] "=&r" (tmp5), [tmp7] "=&r" (tmp7),
- [tmp6] "=&r" (tmp6), [tmp8] "=&r" (tmp8)
- : [left] "r" (left), [dst] "r" (dst),
- [stride] "r" (stride)
- );
-}
-
-void vp9_dc_predictor_8x8_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t expected_dc;
- int32_t average;
- int32_t tmp, above1, above_l1, above_r1, left1, left_r1, left_l1;
- int32_t above2, above_l2, above_r2, left2, left_r2, left_l2;
-
- __asm__ __volatile__ (
- "lw %[above1], (%[above]) \n\t"
- "lw %[above2], 4(%[above]) \n\t"
- "lw %[left1], (%[left]) \n\t"
- "lw %[left2], 4(%[left]) \n\t"
-
- "preceu.ph.qbl %[above_l1], %[above1] \n\t"
- "preceu.ph.qbr %[above_r1], %[above1] \n\t"
- "preceu.ph.qbl %[left_l1], %[left1] \n\t"
- "preceu.ph.qbr %[left_r1], %[left1] \n\t"
-
- "preceu.ph.qbl %[above_l2], %[above2] \n\t"
- "preceu.ph.qbr %[above_r2], %[above2] \n\t"
- "preceu.ph.qbl %[left_l2], %[left2] \n\t"
- "preceu.ph.qbr %[left_r2], %[left2] \n\t"
-
- "addu.ph %[average], %[above_r1], %[above_l1] \n\t"
- "addu.ph %[average], %[average], %[left_l1] \n\t"
- "addu.ph %[average], %[average], %[left_r1] \n\t"
-
- "addu.ph %[average], %[average], %[above_l2] \n\t"
- "addu.ph %[average], %[average], %[above_r2] \n\t"
- "addu.ph %[average], %[average], %[left_l2] \n\t"
- "addu.ph %[average], %[average], %[left_r2] \n\t"
-
- "addiu %[average], %[average], 8 \n\t"
-
- "srl %[tmp], %[average], 16 \n\t"
- "addu.ph %[average], %[tmp], %[average] \n\t"
- "srl %[expected_dc], %[average], 4 \n\t"
- "replv.qb %[expected_dc], %[expected_dc] \n\t"
-
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- "add %[dst], %[dst], %[stride] \n\t"
- "sw %[expected_dc], (%[dst]) \n\t"
- "sw %[expected_dc], 4(%[dst]) \n\t"
-
- : [above1] "=&r" (above1), [above_l1] "=&r" (above_l1),
- [above_r1] "=&r" (above_r1), [left1] "=&r" (left1),
- [left_l1] "=&r" (left_l1), [left_r1] "=&r" (left_r1),
- [above2] "=&r" (above2), [above_l2] "=&r" (above_l2),
- [above_r2] "=&r" (above_r2), [left2] "=&r" (left2),
- [left_l2] "=&r" (left_l2), [left_r2] "=&r" (left_r2),
- [average] "=&r" (average), [tmp] "=&r" (tmp),
- [expected_dc] "=&r" (expected_dc)
- : [above] "r" (above), [left] "r" (left), [dst] "r" (dst),
- [stride] "r" (stride)
- );
-}
-
-void vp9_tm_predictor_8x8_dspr2(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left) {
- int32_t abovel, abover;
- int32_t abovel_1, abover_1;
- int32_t left0;
- int32_t res0, res1, res2, res3;
- int32_t reshw;
- int32_t top_left;
- uint8_t *cm = vp9_ff_cropTbl;
-
- __asm__ __volatile__ (
- "ulw %[reshw], (%[above]) \n\t"
- "ulw %[top_left], 4(%[above]) \n\t"
-
- "lbu %[left0], (%[left]) \n\t"
-
- "preceu.ph.qbl %[abovel], %[reshw] \n\t"
- "preceu.ph.qbr %[abover], %[reshw] \n\t"
- "preceu.ph.qbl %[abovel_1], %[top_left] \n\t"
- "preceu.ph.qbr %[abover_1], %[top_left] \n\t"
-
- "lbu %[top_left], -1(%[above]) \n\t"
- "replv.ph %[left0], %[left0] \n\t"
-
- "replv.ph %[top_left], %[top_left] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbu %[left0], 1(%[left]) \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbu %[left0], 2(%[left]) \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbu %[left0], 3(%[left]) \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbu %[left0], 4(%[left]) \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbu %[left0], 5(%[left]) \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbu %[left0], 6(%[left]) \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbu %[left0], 7(%[left]) \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- "replv.ph %[left0], %[left0] \n\t"
- "add %[dst], %[dst], %[stride] \n\t"
-
- "addu.ph %[reshw], %[abovel], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], (%[dst]) \n\t"
- "sb %[res1], 1(%[dst]) \n\t"
- "sb %[res2], 2(%[dst]) \n\t"
- "sb %[res3], 3(%[dst]) \n\t"
-
- "addu.ph %[reshw], %[abovel_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res2], %[reshw], 16 \n\t"
- "sra %[res2], %[res2], 16 \n\t"
- "sra %[res3], %[reshw], 16 \n\t"
-
- "addu.ph %[reshw], %[abover_1], %[left0] \n\t"
- "subu.ph %[reshw], %[reshw], %[top_left] \n\t"
-
- "sll %[res0], %[reshw], 16 \n\t"
- "sra %[res0], %[res0], 16 \n\t"
- "sra %[res1], %[reshw], 16 \n\t"
-
- "lbux %[res0], %[res0](%[cm]) \n\t"
- "lbux %[res1], %[res1](%[cm]) \n\t"
- "lbux %[res2], %[res2](%[cm]) \n\t"
- "lbux %[res3], %[res3](%[cm]) \n\t"
-
- "sb %[res0], 4(%[dst]) \n\t"
- "sb %[res1], 5(%[dst]) \n\t"
- "sb %[res2], 6(%[dst]) \n\t"
- "sb %[res3], 7(%[dst]) \n\t"
-
- : [abovel] "=&r" (abovel), [abover] "=&r" (abover),
- [abovel_1] "=&r" (abovel_1), [abover_1] "=&r" (abover_1),
- [left0] "=&r" (left0), [res2] "=&r" (res2), [res3] "=&r" (res3),
- [res0] "=&r" (res0), [res1] "=&r" (res1),
- [reshw] "=&r" (reshw), [top_left] "=&r" (top_left)
- : [above] "r" (above), [left] "r" (left),
- [dst] "r" (dst), [stride] "r" (stride), [cm] "r" (cm)
- );
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c
deleted file mode 100644
index 19c582f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans16_dspr2.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void idct16_rows_dspr2(const int16_t *input, int16_t *output,
- uint32_t no_rows) {
- int i;
- int step1_0, step1_1, step1_2, step1_3, step1_4, step1_5, step1_6, step1_7;
- int step1_10, step1_11, step1_12, step1_13;
- int step2_0, step2_1, step2_2, step2_3;
- int step2_8, step2_9, step2_10, step2_11;
- int step2_12, step2_13, step2_14, step2_15;
- int load1, load2, load3, load4, load5, load6, load7, load8;
- int result1, result2, result3, result4;
- const int const_2_power_13 = 8192;
-
- for (i = no_rows; i--; ) {
- /* prefetch row */
- vp9_prefetch_load((const uint8_t *)(input + 16));
-
- __asm__ __volatile__ (
- "lh %[load1], 0(%[input]) \n\t"
- "lh %[load2], 16(%[input]) \n\t"
- "lh %[load3], 8(%[input]) \n\t"
- "lh %[load4], 24(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "add %[result1], %[load1], %[load2] \n\t"
- "sub %[result2], %[load1], %[load2] \n\t"
- "madd $ac1, %[result1], %[cospi_16_64] \n\t"
- "madd $ac2, %[result2], %[cospi_16_64] \n\t"
- "extp %[step2_0], $ac1, 31 \n\t"
- "extp %[step2_1], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "madd $ac3, %[load3], %[cospi_24_64] \n\t"
- "msub $ac3, %[load4], %[cospi_8_64] \n\t"
- "extp %[step2_2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "madd $ac1, %[load3], %[cospi_8_64] \n\t"
- "madd $ac1, %[load4], %[cospi_24_64] \n\t"
- "extp %[step2_3], $ac1, 31 \n\t"
-
- "add %[step1_0], %[step2_0], %[step2_3] \n\t"
- "add %[step1_1], %[step2_1], %[step2_2] \n\t"
- "sub %[step1_2], %[step2_1], %[step2_2] \n\t"
- "sub %[step1_3], %[step2_0], %[step2_3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [step2_0] "=&r" (step2_0), [step2_1] "=&r" (step2_1),
- [step2_2] "=&r" (step2_2), [step2_3] "=&r" (step2_3),
- [step1_0] "=r" (step1_0), [step1_1] "=r" (step1_1),
- [step1_2] "=r" (step1_2), [step1_3] "=r" (step1_3)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load5], 2(%[input]) \n\t"
- "lh %[load6], 30(%[input]) \n\t"
- "lh %[load7], 18(%[input]) \n\t"
- "lh %[load8], 14(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load5], %[cospi_30_64] \n\t"
- "msub $ac1, %[load6], %[cospi_2_64] \n\t"
- "extp %[result1], $ac1, 31 \n\t"
-
- "madd $ac3, %[load7], %[cospi_14_64] \n\t"
- "msub $ac3, %[load8], %[cospi_18_64] \n\t"
- "extp %[result2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac1, %[load7], %[cospi_18_64] \n\t"
- "madd $ac1, %[load8], %[cospi_14_64] \n\t"
- "extp %[result3], $ac1, 31 \n\t"
-
- "madd $ac2, %[load5], %[cospi_2_64] \n\t"
- "madd $ac2, %[load6], %[cospi_30_64] \n\t"
- "extp %[result4], $ac2, 31 \n\t"
-
- "sub %[load5], %[result1], %[result2] \n\t"
- "sub %[load6], %[result4], %[result3] \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load6], %[cospi_24_64] \n\t"
- "msub $ac1, %[load5], %[cospi_8_64] \n\t"
- "madd $ac3, %[load5], %[cospi_24_64] \n\t"
- "madd $ac3, %[load6], %[cospi_8_64] \n\t"
-
- "extp %[step2_9], $ac1, 31 \n\t"
- "extp %[step2_14], $ac3, 31 \n\t"
- "add %[step2_8], %[result1], %[result2] \n\t"
- "add %[step2_15], %[result4], %[result3] \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6),
- [load7] "=&r" (load7), [load8] "=&r" (load8),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [result3] "=&r" (result3), [result4] "=&r" (result4),
- [step2_8] "=r" (step2_8), [step2_15] "=r" (step2_15),
- [step2_9] "=r" (step2_9), [step2_14] "=r" (step2_14)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_30_64] "r" (cospi_30_64), [cospi_2_64] "r" (cospi_2_64),
- [cospi_14_64] "r" (cospi_14_64), [cospi_18_64] "r" (cospi_18_64),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 10(%[input]) \n\t"
- "lh %[load2], 22(%[input]) \n\t"
- "lh %[load3], 26(%[input]) \n\t"
- "lh %[load4], 6(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_22_64] \n\t"
- "msub $ac1, %[load2], %[cospi_10_64] \n\t"
- "extp %[result1], $ac1, 31 \n\t"
-
- "madd $ac3, %[load3], %[cospi_6_64] \n\t"
- "msub $ac3, %[load4], %[cospi_26_64] \n\t"
- "extp %[result2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac1, %[load1], %[cospi_10_64] \n\t"
- "madd $ac1, %[load2], %[cospi_22_64] \n\t"
- "extp %[result3], $ac1, 31 \n\t"
-
- "madd $ac2, %[load3], %[cospi_26_64] \n\t"
- "madd $ac2, %[load4], %[cospi_6_64] \n\t"
- "extp %[result4], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[result2], %[result1] \n\t"
- "sub %[load2], %[result4], %[result3] \n\t"
-
- "msub $ac1, %[load1], %[cospi_24_64] \n\t"
- "msub $ac1, %[load2], %[cospi_8_64] \n\t"
- "madd $ac3, %[load2], %[cospi_24_64] \n\t"
- "msub $ac3, %[load1], %[cospi_8_64] \n\t"
-
- "extp %[step2_10], $ac1, 31 \n\t"
- "extp %[step2_13], $ac3, 31 \n\t"
- "add %[step2_11], %[result1], %[result2] \n\t"
- "add %[step2_12], %[result4], %[result3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [result3] "=&r" (result3), [result4] "=&r" (result4),
- [step2_10] "=r" (step2_10), [step2_11] "=r" (step2_11),
- [step2_12] "=r" (step2_12), [step2_13] "=r" (step2_13)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_22_64] "r" (cospi_22_64), [cospi_10_64] "r" (cospi_10_64),
- [cospi_6_64] "r" (cospi_6_64), [cospi_26_64] "r" (cospi_26_64),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load5], 4(%[input]) \n\t"
- "lh %[load6], 28(%[input]) \n\t"
- "lh %[load7], 20(%[input]) \n\t"
- "lh %[load8], 12(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load5], %[cospi_28_64] \n\t"
- "msub $ac1, %[load6], %[cospi_4_64] \n\t"
- "extp %[result1], $ac1, 31 \n\t"
-
- "madd $ac3, %[load7], %[cospi_12_64] \n\t"
- "msub $ac3, %[load8], %[cospi_20_64] \n\t"
- "extp %[result2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac1, %[load7], %[cospi_20_64] \n\t"
- "madd $ac1, %[load8], %[cospi_12_64] \n\t"
- "extp %[result3], $ac1, 31 \n\t"
-
- "madd $ac2, %[load5], %[cospi_4_64] \n\t"
- "madd $ac2, %[load6], %[cospi_28_64] \n\t"
- "extp %[result4], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load5], %[result4], %[result3] \n\t"
- "sub %[load5], %[load5], %[result1] \n\t"
- "add %[load5], %[load5], %[result2] \n\t"
-
- "sub %[load6], %[result1], %[result2] \n\t"
- "sub %[load6], %[load6], %[result3] \n\t"
- "add %[load6], %[load6], %[result4] \n\t"
-
- "madd $ac1, %[load5], %[cospi_16_64] \n\t"
- "madd $ac3, %[load6], %[cospi_16_64] \n\t"
-
- "extp %[step1_5], $ac1, 31 \n\t"
- "extp %[step1_6], $ac3, 31 \n\t"
- "add %[step1_4], %[result1], %[result2] \n\t"
- "add %[step1_7], %[result4], %[result3] \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6),
- [load7] "=&r" (load7), [load8] "=&r" (load8),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [result3] "=&r" (result3), [result4] "=&r" (result4),
- [step1_4] "=r" (step1_4), [step1_5] "=r" (step1_5),
- [step1_6] "=r" (step1_6), [step1_7] "=r" (step1_7)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_20_64] "r" (cospi_20_64), [cospi_12_64] "r" (cospi_12_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_28_64] "r" (cospi_28_64),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
-
- "sub %[load5], %[step2_14], %[step2_13] \n\t"
- "sub %[load5], %[load5], %[step2_9] \n\t"
- "add %[load5], %[load5], %[step2_10] \n\t"
-
- "madd $ac0, %[load5], %[cospi_16_64] \n\t"
-
- "sub %[load6], %[step2_14], %[step2_13] \n\t"
- "sub %[load6], %[load6], %[step2_10] \n\t"
- "add %[load6], %[load6], %[step2_9] \n\t"
-
- "madd $ac1, %[load6], %[cospi_16_64] \n\t"
-
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load5], %[step2_15], %[step2_12] \n\t"
- "sub %[load5], %[load5], %[step2_8] \n\t"
- "add %[load5], %[load5], %[step2_11] \n\t"
-
- "madd $ac2, %[load5], %[cospi_16_64] \n\t"
-
- "sub %[load6], %[step2_15], %[step2_12] \n\t"
- "sub %[load6], %[load6], %[step2_11] \n\t"
- "add %[load6], %[load6], %[step2_8] \n\t"
-
- "madd $ac3, %[load6], %[cospi_16_64] \n\t"
-
- "extp %[step1_10], $ac0, 31 \n\t"
- "extp %[step1_13], $ac1, 31 \n\t"
- "extp %[step1_11], $ac2, 31 \n\t"
- "extp %[step1_12], $ac3, 31 \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6),
- [step1_10] "=r" (step1_10), [step1_11] "=r" (step1_11),
- [step1_12] "=r" (step1_12), [step1_13] "=r" (step1_13)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_14] "r" (step2_14), [step2_13] "r" (step2_13),
- [step2_9] "r" (step2_9), [step2_10] "r" (step2_10),
- [step2_15] "r" (step2_15), [step2_12] "r" (step2_12),
- [step2_8] "r" (step2_8), [step2_11] "r" (step2_11),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- __asm__ __volatile__ (
- "add %[load5], %[step1_0], %[step1_7] \n\t"
- "add %[load5], %[load5], %[step2_12] \n\t"
- "add %[load5], %[load5], %[step2_15] \n\t"
- "add %[load6], %[step1_1], %[step1_6] \n\t"
- "add %[load6], %[load6], %[step2_13] \n\t"
- "add %[load6], %[load6], %[step2_14] \n\t"
- "sh %[load5], 0(%[output]) \n\t"
- "sh %[load6], 32(%[output]) \n\t"
- "sub %[load5], %[step1_1], %[step1_6] \n\t"
- "add %[load5], %[load5], %[step2_9] \n\t"
- "add %[load5], %[load5], %[step2_10] \n\t"
- "sub %[load6], %[step1_0], %[step1_7] \n\t"
- "add %[load6], %[load6], %[step2_8] \n\t"
- "add %[load6], %[load6], %[step2_11] \n\t"
- "sh %[load5], 192(%[output]) \n\t"
- "sh %[load6], 224(%[output]) \n\t"
- "sub %[load5], %[step1_0], %[step1_7] \n\t"
- "sub %[load5], %[load5], %[step2_8] \n\t"
- "sub %[load5], %[load5], %[step2_11] \n\t"
- "sub %[load6], %[step1_1], %[step1_6] \n\t"
- "sub %[load6], %[load6], %[step2_9] \n\t"
- "sub %[load6], %[load6], %[step2_10] \n\t"
- "sh %[load5], 256(%[output]) \n\t"
- "sh %[load6], 288(%[output]) \n\t"
- "add %[load5], %[step1_1], %[step1_6] \n\t"
- "sub %[load5], %[load5], %[step2_13] \n\t"
- "sub %[load5], %[load5], %[step2_14] \n\t"
- "add %[load6], %[step1_0], %[step1_7] \n\t"
- "sub %[load6], %[load6], %[step2_12] \n\t"
- "sub %[load6], %[load6], %[step2_15] \n\t"
- "sh %[load5], 448(%[output]) \n\t"
- "sh %[load6], 480(%[output]) \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6)
- : [output] "r" (output),
- [step1_0] "r" (step1_0), [step1_1] "r" (step1_1),
- [step1_6] "r" (step1_6), [step1_7] "r" (step1_7),
- [step2_8] "r" (step2_8), [step2_9] "r" (step2_9),
- [step2_10] "r" (step2_10), [step2_11] "r" (step2_11),
- [step2_12] "r" (step2_12), [step2_13] "r" (step2_13),
- [step2_14] "r" (step2_14), [step2_15] "r" (step2_15)
- );
-
- __asm__ __volatile__ (
- "add %[load5], %[step1_2], %[step1_5] \n\t"
- "add %[load5], %[load5], %[step1_13] \n\t"
- "add %[load6], %[step1_3], %[step1_4] \n\t"
- "add %[load6], %[load6], %[step1_12] \n\t"
- "sh %[load5], 64(%[output]) \n\t"
- "sh %[load6], 96(%[output]) \n\t"
- "sub %[load5], %[step1_3], %[step1_4] \n\t"
- "add %[load5], %[load5], %[step1_11] \n\t"
- "sub %[load6], %[step1_2], %[step1_5] \n\t"
- "add %[load6], %[load6], %[step1_10] \n\t"
- "sh %[load5], 128(%[output]) \n\t"
- "sh %[load6], 160(%[output]) \n\t"
- "sub %[load5], %[step1_2], %[step1_5] \n\t"
- "sub %[load5], %[load5], %[step1_10] \n\t"
- "sub %[load6], %[step1_3], %[step1_4] \n\t"
- "sub %[load6], %[load6], %[step1_11] \n\t"
- "sh %[load5], 320(%[output]) \n\t"
- "sh %[load6], 352(%[output]) \n\t"
- "add %[load5], %[step1_3], %[step1_4] \n\t"
- "sub %[load5], %[load5], %[step1_12] \n\t"
- "add %[load6], %[step1_2], %[step1_5] \n\t"
- "sub %[load6], %[load6], %[step1_13] \n\t"
- "sh %[load5], 384(%[output]) \n\t"
- "sh %[load6], 416(%[output]) \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6)
- : [output] "r" (output),
- [step1_2] "r" (step1_2), [step1_3] "r" (step1_3),
- [step1_4] "r" (step1_4), [step1_5] "r" (step1_5),
- [step1_10] "r" (step1_10), [step1_11] "r" (step1_11),
- [step1_12] "r" (step1_12), [step1_13] "r" (step1_13)
- );
-
- input += 16;
- output += 1;
- }
-}
-
-static void idct16_cols_add_blk_dspr2(int16_t *input, uint8_t *dest,
- int dest_stride) {
- int i;
- int step1_0, step1_1, step1_2, step1_3, step1_4, step1_5, step1_6, step1_7;
- int step1_8, step1_9, step1_10, step1_11;
- int step1_12, step1_13, step1_14, step1_15;
- int step2_0, step2_1, step2_2, step2_3;
- int step2_8, step2_9, step2_10, step2_11;
- int step2_12, step2_13, step2_14, step2_15;
- int load1, load2, load3, load4, load5, load6, load7, load8;
- int result1, result2, result3, result4;
- const int const_2_power_13 = 8192;
- uint8_t *dest_pix;
- uint8_t *cm = vp9_ff_cropTbl;
-
- /* prefetch vp9_ff_cropTbl */
- vp9_prefetch_load(vp9_ff_cropTbl);
- vp9_prefetch_load(vp9_ff_cropTbl + 32);
- vp9_prefetch_load(vp9_ff_cropTbl + 64);
- vp9_prefetch_load(vp9_ff_cropTbl + 96);
- vp9_prefetch_load(vp9_ff_cropTbl + 128);
- vp9_prefetch_load(vp9_ff_cropTbl + 160);
- vp9_prefetch_load(vp9_ff_cropTbl + 192);
- vp9_prefetch_load(vp9_ff_cropTbl + 224);
-
- for (i = 0; i < 16; ++i) {
- dest_pix = (dest + i);
- __asm__ __volatile__ (
- "lh %[load1], 0(%[input]) \n\t"
- "lh %[load2], 16(%[input]) \n\t"
- "lh %[load3], 8(%[input]) \n\t"
- "lh %[load4], 24(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "add %[result1], %[load1], %[load2] \n\t"
- "sub %[result2], %[load1], %[load2] \n\t"
- "madd $ac1, %[result1], %[cospi_16_64] \n\t"
- "madd $ac2, %[result2], %[cospi_16_64] \n\t"
- "extp %[step2_0], $ac1, 31 \n\t"
- "extp %[step2_1], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "madd $ac3, %[load3], %[cospi_24_64] \n\t"
- "msub $ac3, %[load4], %[cospi_8_64] \n\t"
- "extp %[step2_2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "madd $ac1, %[load3], %[cospi_8_64] \n\t"
- "madd $ac1, %[load4], %[cospi_24_64] \n\t"
- "extp %[step2_3], $ac1, 31 \n\t"
-
- "add %[step1_0], %[step2_0], %[step2_3] \n\t"
- "add %[step1_1], %[step2_1], %[step2_2] \n\t"
- "sub %[step1_2], %[step2_1], %[step2_2] \n\t"
- "sub %[step1_3], %[step2_0], %[step2_3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [step2_0] "=&r" (step2_0), [step2_1] "=&r" (step2_1),
- [step2_2] "=&r" (step2_2), [step2_3] "=&r" (step2_3),
- [step1_0] "=r" (step1_0), [step1_1] "=r" (step1_1),
- [step1_2] "=r" (step1_2), [step1_3] "=r" (step1_3)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load5], 2(%[input]) \n\t"
- "lh %[load6], 30(%[input]) \n\t"
- "lh %[load7], 18(%[input]) \n\t"
- "lh %[load8], 14(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load5], %[cospi_30_64] \n\t"
- "msub $ac1, %[load6], %[cospi_2_64] \n\t"
- "extp %[result1], $ac1, 31 \n\t"
-
- "madd $ac3, %[load7], %[cospi_14_64] \n\t"
- "msub $ac3, %[load8], %[cospi_18_64] \n\t"
- "extp %[result2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac1, %[load7], %[cospi_18_64] \n\t"
- "madd $ac1, %[load8], %[cospi_14_64] \n\t"
- "extp %[result3], $ac1, 31 \n\t"
-
- "madd $ac2, %[load5], %[cospi_2_64] \n\t"
- "madd $ac2, %[load6], %[cospi_30_64] \n\t"
- "extp %[result4], $ac2, 31 \n\t"
-
- "sub %[load5], %[result1], %[result2] \n\t"
- "sub %[load6], %[result4], %[result3] \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load6], %[cospi_24_64] \n\t"
- "msub $ac1, %[load5], %[cospi_8_64] \n\t"
- "madd $ac3, %[load5], %[cospi_24_64] \n\t"
- "madd $ac3, %[load6], %[cospi_8_64] \n\t"
-
- "extp %[step2_9], $ac1, 31 \n\t"
- "extp %[step2_14], $ac3, 31 \n\t"
- "add %[step2_8], %[result1], %[result2] \n\t"
- "add %[step2_15], %[result4], %[result3] \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6),
- [load7] "=&r" (load7), [load8] "=&r" (load8),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [result3] "=&r" (result3), [result4] "=&r" (result4),
- [step2_8] "=r" (step2_8), [step2_15] "=r" (step2_15),
- [step2_9] "=r" (step2_9), [step2_14] "=r" (step2_14)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_30_64] "r" (cospi_30_64), [cospi_2_64] "r" (cospi_2_64),
- [cospi_14_64] "r" (cospi_14_64), [cospi_18_64] "r" (cospi_18_64),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 10(%[input]) \n\t"
- "lh %[load2], 22(%[input]) \n\t"
- "lh %[load3], 26(%[input]) \n\t"
- "lh %[load4], 6(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_22_64] \n\t"
- "msub $ac1, %[load2], %[cospi_10_64] \n\t"
- "extp %[result1], $ac1, 31 \n\t"
-
- "madd $ac3, %[load3], %[cospi_6_64] \n\t"
- "msub $ac3, %[load4], %[cospi_26_64] \n\t"
- "extp %[result2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac1, %[load1], %[cospi_10_64] \n\t"
- "madd $ac1, %[load2], %[cospi_22_64] \n\t"
- "extp %[result3], $ac1, 31 \n\t"
-
- "madd $ac2, %[load3], %[cospi_26_64] \n\t"
- "madd $ac2, %[load4], %[cospi_6_64] \n\t"
- "extp %[result4], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[result2], %[result1] \n\t"
- "sub %[load2], %[result4], %[result3] \n\t"
-
- "msub $ac1, %[load1], %[cospi_24_64] \n\t"
- "msub $ac1, %[load2], %[cospi_8_64] \n\t"
- "madd $ac3, %[load2], %[cospi_24_64] \n\t"
- "msub $ac3, %[load1], %[cospi_8_64] \n\t"
-
- "extp %[step2_10], $ac1, 31 \n\t"
- "extp %[step2_13], $ac3, 31 \n\t"
- "add %[step2_11], %[result1], %[result2] \n\t"
- "add %[step2_12], %[result4], %[result3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [result3] "=&r" (result3), [result4] "=&r" (result4),
- [step2_10] "=r" (step2_10), [step2_11] "=r" (step2_11),
- [step2_12] "=r" (step2_12), [step2_13] "=r" (step2_13)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_22_64] "r" (cospi_22_64), [cospi_10_64] "r" (cospi_10_64),
- [cospi_6_64] "r" (cospi_6_64), [cospi_26_64] "r" (cospi_26_64),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load5], 4(%[input]) \n\t"
- "lh %[load6], 28(%[input]) \n\t"
- "lh %[load7], 20(%[input]) \n\t"
- "lh %[load8], 12(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load5], %[cospi_28_64] \n\t"
- "msub $ac1, %[load6], %[cospi_4_64] \n\t"
- "extp %[result1], $ac1, 31 \n\t"
-
- "madd $ac3, %[load7], %[cospi_12_64] \n\t"
- "msub $ac3, %[load8], %[cospi_20_64] \n\t"
- "extp %[result2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac1, %[load7], %[cospi_20_64] \n\t"
- "madd $ac1, %[load8], %[cospi_12_64] \n\t"
- "extp %[result3], $ac1, 31 \n\t"
-
- "madd $ac2, %[load5], %[cospi_4_64] \n\t"
- "madd $ac2, %[load6], %[cospi_28_64] \n\t"
- "extp %[result4], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load5], %[result4], %[result3] \n\t"
- "sub %[load5], %[load5], %[result1] \n\t"
- "add %[load5], %[load5], %[result2] \n\t"
-
- "sub %[load6], %[result1], %[result2] \n\t"
- "sub %[load6], %[load6], %[result3] \n\t"
- "add %[load6], %[load6], %[result4] \n\t"
-
- "madd $ac1, %[load5], %[cospi_16_64] \n\t"
- "madd $ac3, %[load6], %[cospi_16_64] \n\t"
-
- "extp %[step1_5], $ac1, 31 \n\t"
- "extp %[step1_6], $ac3, 31 \n\t"
-
- "add %[step1_4], %[result1], %[result2] \n\t"
- "add %[step1_7], %[result4], %[result3] \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6),
- [load7] "=&r" (load7), [load8] "=&r" (load8),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [result3] "=&r" (result3), [result4] "=&r" (result4),
- [step1_4] "=r" (step1_4), [step1_5] "=r" (step1_5),
- [step1_6] "=r" (step1_6), [step1_7] "=r" (step1_7)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_20_64] "r" (cospi_20_64), [cospi_12_64] "r" (cospi_12_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_28_64] "r" (cospi_28_64),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
-
- "sub %[load5], %[step2_14], %[step2_13] \n\t"
- "sub %[load5], %[load5], %[step2_9] \n\t"
- "add %[load5], %[load5], %[step2_10] \n\t"
-
- "madd $ac0, %[load5], %[cospi_16_64] \n\t"
-
- "sub %[load6], %[step2_14], %[step2_13] \n\t"
- "sub %[load6], %[load6], %[step2_10] \n\t"
- "add %[load6], %[load6], %[step2_9] \n\t"
-
- "madd $ac1, %[load6], %[cospi_16_64] \n\t"
-
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load5], %[step2_15], %[step2_12] \n\t"
- "sub %[load5], %[load5], %[step2_8] \n\t"
- "add %[load5], %[load5], %[step2_11] \n\t"
-
- "madd $ac2, %[load5], %[cospi_16_64] \n\t"
-
- "sub %[load6], %[step2_15], %[step2_12] \n\t"
- "sub %[load6], %[load6], %[step2_11] \n\t"
- "add %[load6], %[load6], %[step2_8] \n\t"
-
- "madd $ac3, %[load6], %[cospi_16_64] \n\t"
-
- "extp %[step1_10], $ac0, 31 \n\t"
- "extp %[step1_13], $ac1, 31 \n\t"
- "extp %[step1_11], $ac2, 31 \n\t"
- "extp %[step1_12], $ac3, 31 \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6),
- [step1_10] "=r" (step1_10), [step1_11] "=r" (step1_11),
- [step1_12] "=r" (step1_12), [step1_13] "=r" (step1_13)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_14] "r" (step2_14), [step2_13] "r" (step2_13),
- [step2_9] "r" (step2_9), [step2_10] "r" (step2_10),
- [step2_15] "r" (step2_15), [step2_12] "r" (step2_12),
- [step2_8] "r" (step2_8), [step2_11] "r" (step2_11),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- step1_8 = step2_8 + step2_11;
- step1_9 = step2_9 + step2_10;
- step1_14 = step2_13 + step2_14;
- step1_15 = step2_12 + step2_15;
-
- __asm__ __volatile__ (
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "add %[load5], %[step1_0], %[step1_7] \n\t"
- "add %[load5], %[load5], %[step1_15] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "add %[load6], %[step1_1], %[step1_6] \n\t"
- "add %[load6], %[load6], %[step1_14] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "add %[load5], %[step1_2], %[step1_5] \n\t"
- "add %[load5], %[load5], %[step1_13] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "add %[load6], %[step1_3], %[step1_4] \n\t"
- "add %[load6], %[load6], %[step1_12] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "sub %[load5], %[step1_3], %[step1_4] \n\t"
- "add %[load5], %[load5], %[step1_11] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "sub %[load6], %[step1_2], %[step1_5] \n\t"
- "add %[load6], %[load6], %[step1_10] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "sub %[load5], %[step1_1], %[step1_6] \n\t"
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "add %[load5], %[load5], %[step1_9] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "sub %[load6], %[step1_0], %[step1_7] \n\t"
- "add %[load6], %[load6], %[step1_8] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "sub %[load5], %[step1_0], %[step1_7] \n\t"
- "sub %[load5], %[load5], %[step1_8] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "sub %[load6], %[step1_1], %[step1_6] \n\t"
- "sub %[load6], %[load6], %[step1_9] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "sub %[load5], %[step1_2], %[step1_5] \n\t"
- "sub %[load5], %[load5], %[step1_10] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "sub %[load6], %[step1_3], %[step1_4] \n\t"
- "sub %[load6], %[load6], %[step1_11] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "add %[load5], %[step1_3], %[step1_4] \n\t"
- "sub %[load5], %[load5], %[step1_12] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "add %[load6], %[step1_2], %[step1_5] \n\t"
- "sub %[load6], %[load6], %[step1_13] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[load7], 0(%[dest_pix]) \n\t"
- "add %[load5], %[step1_1], %[step1_6] \n\t"
- "sub %[load5], %[load5], %[step1_14] \n\t"
- "addi %[load5], %[load5], 32 \n\t"
- "sra %[load5], %[load5], 6 \n\t"
- "add %[load7], %[load7], %[load5] \n\t"
- "lbux %[load5], %[load7](%[cm]) \n\t"
- "add %[load6], %[step1_0], %[step1_7] \n\t"
- "sub %[load6], %[load6], %[step1_15] \n\t"
- "sb %[load5], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[load8], 0(%[dest_pix]) \n\t"
- "addi %[load6], %[load6], 32 \n\t"
- "sra %[load6], %[load6], 6 \n\t"
- "add %[load8], %[load8], %[load6] \n\t"
- "lbux %[load6], %[load8](%[cm]) \n\t"
- "sb %[load6], 0(%[dest_pix]) \n\t"
-
- : [load5] "=&r" (load5), [load6] "=&r" (load6), [load7] "=&r" (load7),
- [load8] "=&r" (load8), [dest_pix] "+r" (dest_pix)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step1_0] "r" (step1_0), [step1_1] "r" (step1_1),
- [step1_2] "r" (step1_2), [step1_3] "r" (step1_3),
- [step1_4] "r" (step1_4), [step1_5] "r" (step1_5),
- [step1_6] "r" (step1_6), [step1_7] "r" (step1_7),
- [step1_8] "r" (step1_8), [step1_9] "r" (step1_9),
- [step1_10] "r" (step1_10), [step1_11] "r" (step1_11),
- [step1_12] "r" (step1_12), [step1_13] "r" (step1_13),
- [step1_14] "r" (step1_14), [step1_15] "r" (step1_15)
- );
-
- input += 16;
- }
-}
-
-void vp9_idct16x16_256_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- DECLARE_ALIGNED(32, int16_t, out[16 * 16]);
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- // First transform rows
- idct16_rows_dspr2(input, out, 16);
-
- // Then transform columns and add to dest
- idct16_cols_add_blk_dspr2(out, dest, dest_stride);
-}
-
-static void iadst16(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
-
- int x0 = input[15];
- int x1 = input[0];
- int x2 = input[13];
- int x3 = input[2];
- int x4 = input[11];
- int x5 = input[4];
- int x6 = input[9];
- int x7 = input[6];
- int x8 = input[7];
- int x9 = input[8];
- int x10 = input[5];
- int x11 = input[10];
- int x12 = input[3];
- int x13 = input[12];
- int x14 = input[1];
- int x15 = input[14];
-
- if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8
- | x9 | x10 | x11 | x12 | x13 | x14 | x15)) {
- output[0] = output[1] = output[2] = output[3] = output[4]
- = output[5] = output[6] = output[7] = output[8]
- = output[9] = output[10] = output[11] = output[12]
- = output[13] = output[14] = output[15] = 0;
- 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 = dct_const_round_shift(s0 + s8);
- x1 = dct_const_round_shift(s1 + s9);
- x2 = dct_const_round_shift(s2 + s10);
- x3 = dct_const_round_shift(s3 + s11);
- x4 = dct_const_round_shift(s4 + s12);
- x5 = dct_const_round_shift(s5 + s13);
- x6 = dct_const_round_shift(s6 + s14);
- x7 = dct_const_round_shift(s7 + s15);
- x8 = dct_const_round_shift(s0 - s8);
- x9 = dct_const_round_shift(s1 - s9);
- x10 = dct_const_round_shift(s2 - s10);
- x11 = dct_const_round_shift(s3 - s11);
- x12 = dct_const_round_shift(s4 - s12);
- x13 = dct_const_round_shift(s5 - s13);
- x14 = dct_const_round_shift(s6 - s14);
- x15 = dct_const_round_shift(s7 - s15);
-
- // 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 = s0 + s4;
- x1 = s1 + s5;
- x2 = s2 + s6;
- x3 = s3 + s7;
- x4 = s0 - s4;
- x5 = s1 - s5;
- x6 = s2 - s6;
- x7 = s3 - s7;
- x8 = dct_const_round_shift(s8 + s12);
- x9 = dct_const_round_shift(s9 + s13);
- x10 = dct_const_round_shift(s10 + s14);
- x11 = dct_const_round_shift(s11 + s15);
- x12 = dct_const_round_shift(s8 - s12);
- x13 = dct_const_round_shift(s9 - s13);
- x14 = dct_const_round_shift(s10 - s14);
- x15 = dct_const_round_shift(s11 - s15);
-
- // 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 = s0 + s2;
- x1 = s1 + s3;
- x2 = s0 - s2;
- x3 = s1 - s3;
- x4 = dct_const_round_shift(s4 + s6);
- x5 = dct_const_round_shift(s5 + s7);
- x6 = dct_const_round_shift(s4 - s6);
- x7 = dct_const_round_shift(s5 - s7);
- x8 = s8 + s10;
- x9 = s9 + s11;
- x10 = s8 - s10;
- x11 = s9 - s11;
- x12 = dct_const_round_shift(s12 + s14);
- x13 = dct_const_round_shift(s13 + s15);
- x14 = dct_const_round_shift(s12 - s14);
- x15 = dct_const_round_shift(s13 - s15);
-
- // 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 = dct_const_round_shift(s2);
- x3 = dct_const_round_shift(s3);
- x6 = dct_const_round_shift(s6);
- x7 = dct_const_round_shift(s7);
- x10 = dct_const_round_shift(s10);
- x11 = dct_const_round_shift(s11);
- x14 = dct_const_round_shift(s14);
- x15 = dct_const_round_shift(s15);
-
- output[0] = x0;
- output[1] = -x8;
- output[2] = x12;
- output[3] = -x4;
- output[4] = x6;
- output[5] = x14;
- output[6] = x10;
- output[7] = x2;
- output[8] = x3;
- output[9] = x11;
- output[10] = x15;
- output[11] = x7;
- output[12] = x5;
- output[13] = -x13;
- output[14] = x9;
- output[15] = -x1;
-}
-
-void vp9_iht16x16_256_add_dspr2(const int16_t *input, uint8_t *dest,
- int pitch, int tx_type) {
- int i, j;
- DECLARE_ALIGNED(32, int16_t, out[16 * 16]);
- int16_t *outptr = out;
- int16_t temp_out[16];
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- switch (tx_type) {
- case DCT_DCT: // DCT in both horizontal and vertical
- idct16_rows_dspr2(input, outptr, 16);
- idct16_cols_add_blk_dspr2(out, dest, pitch);
- break;
- case ADST_DCT: // ADST in vertical, DCT in horizontal
- idct16_rows_dspr2(input, outptr, 16);
-
- outptr = out;
-
- for (i = 0; i < 16; ++i) {
- iadst16(outptr, temp_out);
-
- for (j = 0; j < 16; ++j)
- dest[j * pitch + i] =
- clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
- + dest[j * pitch + i]);
- outptr += 16;
- }
- break;
- case DCT_ADST: // DCT in vertical, ADST in horizontal
- {
- int16_t temp_in[16 * 16];
-
- for (i = 0; i < 16; ++i) {
- /* prefetch row */
- vp9_prefetch_load((const uint8_t *)(input + 16));
-
- iadst16(input, outptr);
- input += 16;
- outptr += 16;
- }
-
- for (i = 0; i < 16; ++i)
- for (j = 0; j < 16; ++j)
- temp_in[j * 16 + i] = out[i * 16 + j];
-
- idct16_cols_add_blk_dspr2(temp_in, dest, pitch);
- }
- break;
- case ADST_ADST: // ADST in both directions
- {
- int16_t temp_in[16];
-
- for (i = 0; i < 16; ++i) {
- /* prefetch row */
- vp9_prefetch_load((const uint8_t *)(input + 16));
-
- iadst16(input, outptr);
- input += 16;
- outptr += 16;
- }
-
- for (i = 0; i < 16; ++i) {
- for (j = 0; j < 16; ++j)
- temp_in[j] = out[j * 16 + i];
- iadst16(temp_in, temp_out);
- for (j = 0; j < 16; ++j)
- dest[j * pitch + i] =
- clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
- + dest[j * pitch + i]);
- }
- }
- break;
- default:
- printf("vp9_short_iht16x16_add_dspr2 : Invalid tx_type\n");
- break;
- }
-}
-
-void vp9_idct16x16_10_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- DECLARE_ALIGNED(32, int16_t, out[16 * 16]);
- int16_t *outptr = out;
- uint32_t i;
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- // First transform rows. Since all non-zero dct coefficients are in
- // upper-left 4x4 area, we only need to calculate first 4 rows here.
- idct16_rows_dspr2(input, outptr, 4);
-
- outptr += 4;
- for (i = 0; i < 6; ++i) {
- __asm__ __volatile__ (
- "sw $zero, 0(%[outptr]) \n\t"
- "sw $zero, 32(%[outptr]) \n\t"
- "sw $zero, 64(%[outptr]) \n\t"
- "sw $zero, 96(%[outptr]) \n\t"
- "sw $zero, 128(%[outptr]) \n\t"
- "sw $zero, 160(%[outptr]) \n\t"
- "sw $zero, 192(%[outptr]) \n\t"
- "sw $zero, 224(%[outptr]) \n\t"
- "sw $zero, 256(%[outptr]) \n\t"
- "sw $zero, 288(%[outptr]) \n\t"
- "sw $zero, 320(%[outptr]) \n\t"
- "sw $zero, 352(%[outptr]) \n\t"
- "sw $zero, 384(%[outptr]) \n\t"
- "sw $zero, 416(%[outptr]) \n\t"
- "sw $zero, 448(%[outptr]) \n\t"
- "sw $zero, 480(%[outptr]) \n\t"
-
- :
- : [outptr] "r" (outptr)
- );
-
- outptr += 2;
- }
-
- // Then transform columns
- idct16_cols_add_blk_dspr2(out, dest, dest_stride);
-}
-
-void vp9_idct16x16_1_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- uint32_t pos = 45;
- int32_t out;
- int32_t r;
- int32_t a1, absa1;
- int32_t vector_a1;
- int32_t t1, t2, t3, t4;
- int32_t vector_1, vector_2, vector_3, vector_4;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
-
- :
- : [pos] "r" (pos)
- );
-
- out = DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input[0]);
- __asm__ __volatile__ (
- "addi %[out], %[out], 32 \n\t"
- "sra %[a1], %[out], 6 \n\t"
-
- : [out] "+r" (out), [a1] "=r" (a1)
- :
- );
-
- if (a1 < 0) {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "abs %[absa1], %[a1] \n\t"
- "replv.qb %[vector_a1], %[absa1] \n\t"
-
- : [absa1] "=r" (absa1), [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 16; r--;) {
- __asm__ __volatile__ (
- "lw %[t1], 0(%[dest]) \n\t"
- "lw %[t2], 4(%[dest]) \n\t"
- "lw %[t3], 8(%[dest]) \n\t"
- "lw %[t4], 12(%[dest]) \n\t"
- "subu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "subu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "subu_s.qb %[vector_3], %[t3], %[vector_a1] \n\t"
- "subu_s.qb %[vector_4], %[t4], %[vector_a1] \n\t"
- "sw %[vector_1], 0(%[dest]) \n\t"
- "sw %[vector_2], 4(%[dest]) \n\t"
- "sw %[vector_3], 8(%[dest]) \n\t"
- "sw %[vector_4], 12(%[dest]) \n\t"
- "add %[dest], %[dest], %[dest_stride] \n\t"
-
- : [t1] "=&r" (t1), [t2] "=&r" (t2), [t3] "=&r" (t3), [t4] "=&r" (t4),
- [vector_1] "=&r" (vector_1), [vector_2] "=&r" (vector_2),
- [vector_3] "=&r" (vector_3), [vector_4] "=&r" (vector_4),
- [dest] "+&r" (dest)
- : [dest_stride] "r" (dest_stride), [vector_a1] "r" (vector_a1)
- );
- }
- } else {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "replv.qb %[vector_a1], %[a1] \n\t"
-
- : [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 16; r--;) {
- __asm__ __volatile__ (
- "lw %[t1], 0(%[dest]) \n\t"
- "lw %[t2], 4(%[dest]) \n\t"
- "lw %[t3], 8(%[dest]) \n\t"
- "lw %[t4], 12(%[dest]) \n\t"
- "addu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "addu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "addu_s.qb %[vector_3], %[t3], %[vector_a1] \n\t"
- "addu_s.qb %[vector_4], %[t4], %[vector_a1] \n\t"
- "sw %[vector_1], 0(%[dest]) \n\t"
- "sw %[vector_2], 4(%[dest]) \n\t"
- "sw %[vector_3], 8(%[dest]) \n\t"
- "sw %[vector_4], 12(%[dest]) \n\t"
- "add %[dest], %[dest], %[dest_stride] \n\t"
-
- : [t1] "=&r" (t1), [t2] "=&r" (t2), [t3] "=&r" (t3), [t4] "=&r" (t4),
- [vector_1] "=&r" (vector_1), [vector_2] "=&r" (vector_2),
- [vector_3] "=&r" (vector_3), [vector_4] "=&r" (vector_4),
- [dest] "+&r" (dest)
- : [dest_stride] "r" (dest_stride), [vector_a1] "r" (vector_a1)
- );
- }
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c
deleted file mode 100644
index 132d88c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c
+++ /dev/null
@@ -1,1073 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_idct32_cols_add_blk_dspr2(int16_t *input, uint8_t *dest,
- int dest_stride) {
- int16_t step1_0, step1_1, step1_2, step1_3, step1_4, step1_5, step1_6;
- int16_t step1_7, step1_8, step1_9, step1_10, step1_11, step1_12, step1_13;
- int16_t step1_14, step1_15, step1_16, step1_17, step1_18, step1_19;
- int16_t step1_20, step1_21, step1_22, step1_23, step1_24, step1_25, step1_26;
- int16_t step1_27, step1_28, step1_29, step1_30, step1_31;
- int16_t step2_0, step2_1, step2_2, step2_3, step2_4, step2_5, step2_6;
- int16_t step2_7, step2_8, step2_9, step2_10, step2_11, step2_12, step2_13;
- int16_t step2_14, step2_15, step2_16, step2_17, step2_18, step2_19, step2_20;
- int16_t step2_21, step2_22, step2_23, step2_24, step2_25, step2_26, step2_27;
- int16_t step2_28, step2_29, step2_30, step2_31;
- int16_t step3_8, step3_9, step3_10, step3_11, step3_12, step3_13, step3_14;
- int16_t step3_15, step3_16, step3_17, step3_18, step3_19, step3_20, step3_21;
- int16_t step3_22, step3_23, step3_24, step3_25, step3_26, step3_27;
- int16_t step3_28, step3_29, step3_30, step3_31;
- int temp0, temp1, temp2, temp3;
- int load1, load2, load3, load4;
- int result1, result2;
- int i, temp21;
- uint8_t *dest_pix, *dest_pix1;
- const int const_2_power_13 = 8192;
- uint8_t *cm = vp9_ff_cropTbl;
-
- /* prefetch vp9_ff_cropTbl */
- vp9_prefetch_load(vp9_ff_cropTbl);
- vp9_prefetch_load(vp9_ff_cropTbl + 32);
- vp9_prefetch_load(vp9_ff_cropTbl + 64);
- vp9_prefetch_load(vp9_ff_cropTbl + 96);
- vp9_prefetch_load(vp9_ff_cropTbl + 128);
- vp9_prefetch_load(vp9_ff_cropTbl + 160);
- vp9_prefetch_load(vp9_ff_cropTbl + 192);
- vp9_prefetch_load(vp9_ff_cropTbl + 224);
-
- for (i = 0; i < 32; ++i) {
- dest_pix = dest + i;
- dest_pix1 = dest + i + 31 * dest_stride;
-
- __asm__ __volatile__ (
- "lh %[load1], 2(%[input]) \n\t"
- "lh %[load2], 62(%[input]) \n\t"
- "lh %[load3], 34(%[input]) \n\t"
- "lh %[load4], 30(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_31_64] \n\t"
- "msub $ac1, %[load2], %[cospi_1_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_1_64] \n\t"
- "madd $ac3, %[load2], %[cospi_31_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_15_64] \n\t"
- "msub $ac2, %[load4], %[cospi_17_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_17_64] \n\t"
- "madd $ac1, %[load4], %[cospi_15_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp3], %[temp2] \n\t"
- "sub %[load2], %[temp0], %[temp1] \n\t"
-
- "madd $ac1, %[load1], %[cospi_28_64] \n\t"
- "msub $ac1, %[load2], %[cospi_4_64] \n\t"
- "madd $ac3, %[load1], %[cospi_4_64] \n\t"
- "madd $ac3, %[load2], %[cospi_28_64] \n\t"
-
- "extp %[step1_17], $ac1, 31 \n\t"
- "extp %[step1_30], $ac3, 31 \n\t"
- "add %[step1_16], %[temp0], %[temp1] \n\t"
- "add %[step1_31], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
- [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_16] "=r" (step1_16), [step1_17] "=r" (step1_17),
- [step1_30] "=r" (step1_30), [step1_31] "=r" (step1_31)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_31_64] "r" (cospi_31_64), [cospi_1_64] "r" (cospi_1_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_17_64] "r" (cospi_17_64),
- [cospi_15_64] "r" (cospi_15_64), [cospi_28_64] "r" (cospi_28_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 18(%[input]) \n\t"
- "lh %[load2], 46(%[input]) \n\t"
- "lh %[load3], 50(%[input]) \n\t"
- "lh %[load4], 14(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_23_64] \n\t"
- "msub $ac1, %[load2], %[cospi_9_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_9_64] \n\t"
- "madd $ac3, %[load2], %[cospi_23_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_7_64] \n\t"
- "msub $ac2, %[load4], %[cospi_25_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_25_64] \n\t"
- "madd $ac1, %[load4], %[cospi_7_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp1], %[temp0] \n\t"
- "sub %[load2], %[temp2], %[temp3] \n\t"
-
- "msub $ac1, %[load1], %[cospi_28_64] \n\t"
- "msub $ac1, %[load2], %[cospi_4_64] \n\t"
- "msub $ac3, %[load1], %[cospi_4_64] \n\t"
- "madd $ac3, %[load2], %[cospi_28_64] \n\t"
-
- "extp %[step1_18], $ac1, 31 \n\t"
- "extp %[step1_29], $ac3, 31 \n\t"
- "add %[step1_19], %[temp0], %[temp1] \n\t"
- "add %[step1_28], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
- [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_18] "=r" (step1_18), [step1_19] "=r" (step1_19),
- [step1_28] "=r" (step1_28), [step1_29] "=r" (step1_29)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_23_64] "r" (cospi_23_64), [cospi_9_64] "r" (cospi_9_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_7_64] "r" (cospi_7_64),
- [cospi_25_64] "r" (cospi_25_64), [cospi_28_64] "r" (cospi_28_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 10(%[input]) \n\t"
- "lh %[load2], 54(%[input]) \n\t"
- "lh %[load3], 42(%[input]) \n\t"
- "lh %[load4], 22(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_27_64] \n\t"
- "msub $ac1, %[load2], %[cospi_5_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_5_64] \n\t"
- "madd $ac3, %[load2], %[cospi_27_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_11_64] \n\t"
- "msub $ac2, %[load4], %[cospi_21_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_21_64] \n\t"
- "madd $ac1, %[load4], %[cospi_11_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp0], %[temp1] \n\t"
- "sub %[load2], %[temp3], %[temp2] \n\t"
-
- "madd $ac1, %[load2], %[cospi_12_64] \n\t"
- "msub $ac1, %[load1], %[cospi_20_64] \n\t"
- "madd $ac3, %[load1], %[cospi_12_64] \n\t"
- "madd $ac3, %[load2], %[cospi_20_64] \n\t"
-
- "extp %[step1_21], $ac1, 31 \n\t"
- "extp %[step1_26], $ac3, 31 \n\t"
- "add %[step1_20], %[temp0], %[temp1] \n\t"
- "add %[step1_27], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
- [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_20] "=r" (step1_20), [step1_21] "=r" (step1_21),
- [step1_26] "=r" (step1_26), [step1_27] "=r" (step1_27)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_27_64] "r" (cospi_27_64), [cospi_5_64] "r" (cospi_5_64),
- [cospi_11_64] "r" (cospi_11_64), [cospi_21_64] "r" (cospi_21_64),
- [cospi_12_64] "r" (cospi_12_64), [cospi_20_64] "r" (cospi_20_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 26(%[input]) \n\t"
- "lh %[load2], 38(%[input]) \n\t"
- "lh %[load3], 58(%[input]) \n\t"
- "lh %[load4], 6(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_19_64] \n\t"
- "msub $ac1, %[load2], %[cospi_13_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
- "madd $ac3, %[load1], %[cospi_13_64] \n\t"
- "madd $ac3, %[load2], %[cospi_19_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_3_64] \n\t"
- "msub $ac2, %[load4], %[cospi_29_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
- "madd $ac1, %[load3], %[cospi_29_64] \n\t"
- "madd $ac1, %[load4], %[cospi_3_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp1], %[temp0] \n\t"
- "sub %[load2], %[temp2], %[temp3] \n\t"
- "msub $ac1, %[load1], %[cospi_12_64] \n\t"
- "msub $ac1, %[load2], %[cospi_20_64] \n\t"
- "msub $ac3, %[load1], %[cospi_20_64] \n\t"
- "madd $ac3, %[load2], %[cospi_12_64] \n\t"
- "extp %[step1_22], $ac1, 31 \n\t"
- "extp %[step1_25], $ac3, 31 \n\t"
- "add %[step1_23], %[temp0], %[temp1] \n\t"
- "add %[step1_24], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
- [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_22] "=r" (step1_22), [step1_23] "=r" (step1_23),
- [step1_24] "=r" (step1_24), [step1_25] "=r" (step1_25)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_19_64] "r" (cospi_19_64), [cospi_13_64] "r" (cospi_13_64),
- [cospi_3_64] "r" (cospi_3_64), [cospi_29_64] "r" (cospi_29_64),
- [cospi_12_64] "r" (cospi_12_64), [cospi_20_64] "r" (cospi_20_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 4(%[input]) \n\t"
- "lh %[load2], 60(%[input]) \n\t"
- "lh %[load3], 36(%[input]) \n\t"
- "lh %[load4], 28(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_30_64] \n\t"
- "msub $ac1, %[load2], %[cospi_2_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
- "madd $ac3, %[load1], %[cospi_2_64] \n\t"
- "madd $ac3, %[load2], %[cospi_30_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_14_64] \n\t"
- "msub $ac2, %[load4], %[cospi_18_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
- "madd $ac1, %[load3], %[cospi_18_64] \n\t"
- "madd $ac1, %[load4], %[cospi_14_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp0], %[temp1] \n\t"
- "sub %[load2], %[temp3], %[temp2] \n\t"
- "msub $ac1, %[load1], %[cospi_8_64] \n\t"
- "madd $ac1, %[load2], %[cospi_24_64] \n\t"
- "madd $ac3, %[load1], %[cospi_24_64] \n\t"
- "madd $ac3, %[load2], %[cospi_8_64] \n\t"
- "extp %[step2_9], $ac1, 31 \n\t"
- "extp %[step2_14], $ac3, 31 \n\t"
- "add %[step2_8], %[temp0], %[temp1] \n\t"
- "add %[step2_15], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
- [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step2_8] "=r" (step2_8), [step2_9] "=r" (step2_9),
- [step2_14] "=r" (step2_14), [step2_15] "=r" (step2_15)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_30_64] "r" (cospi_30_64), [cospi_2_64] "r" (cospi_2_64),
- [cospi_14_64] "r" (cospi_14_64), [cospi_18_64] "r" (cospi_18_64),
- [cospi_8_64] "r" (cospi_8_64), [cospi_24_64] "r" (cospi_24_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 20(%[input]) \n\t"
- "lh %[load2], 44(%[input]) \n\t"
- "lh %[load3], 52(%[input]) \n\t"
- "lh %[load4], 12(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_22_64] \n\t"
- "msub $ac1, %[load2], %[cospi_10_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
- "madd $ac3, %[load1], %[cospi_10_64] \n\t"
- "madd $ac3, %[load2], %[cospi_22_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_6_64] \n\t"
- "msub $ac2, %[load4], %[cospi_26_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
- "madd $ac1, %[load3], %[cospi_26_64] \n\t"
- "madd $ac1, %[load4], %[cospi_6_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp1], %[temp0] \n\t"
- "sub %[load2], %[temp2], %[temp3] \n\t"
- "msub $ac1, %[load1], %[cospi_24_64] \n\t"
- "msub $ac1, %[load2], %[cospi_8_64] \n\t"
- "madd $ac3, %[load2], %[cospi_24_64] \n\t"
- "msub $ac3, %[load1], %[cospi_8_64] \n\t"
- "extp %[step2_10], $ac1, 31 \n\t"
- "extp %[step2_13], $ac3, 31 \n\t"
- "add %[step2_11], %[temp0], %[temp1] \n\t"
- "add %[step2_12], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
- [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step2_10] "=r" (step2_10), [step2_11] "=r" (step2_11),
- [step2_12] "=r" (step2_12), [step2_13] "=r" (step2_13)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_22_64] "r" (cospi_22_64), [cospi_10_64] "r" (cospi_10_64),
- [cospi_6_64] "r" (cospi_6_64), [cospi_26_64] "r" (cospi_26_64),
- [cospi_8_64] "r" (cospi_8_64), [cospi_24_64] "r" (cospi_24_64)
- );
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "sub %[temp0], %[step2_14], %[step2_13] \n\t"
- "sub %[temp0], %[temp0], %[step2_9] \n\t"
- "add %[temp0], %[temp0], %[step2_10] \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "sub %[temp1], %[step2_14], %[step2_13] \n\t"
- "add %[temp1], %[temp1], %[step2_9] \n\t"
- "sub %[temp1], %[temp1], %[step2_10] \n\t"
- "madd $ac1, %[temp1], %[cospi_16_64] \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "sub %[temp0], %[step2_15], %[step2_12] \n\t"
- "sub %[temp0], %[temp0], %[step2_8] \n\t"
- "add %[temp0], %[temp0], %[step2_11] \n\t"
- "madd $ac2, %[temp0], %[cospi_16_64] \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "sub %[temp1], %[step2_15], %[step2_12] \n\t"
- "add %[temp1], %[temp1], %[step2_8] \n\t"
- "sub %[temp1], %[temp1], %[step2_11] \n\t"
- "madd $ac3, %[temp1], %[cospi_16_64] \n\t"
-
- "add %[step3_8], %[step2_8], %[step2_11] \n\t"
- "add %[step3_9], %[step2_9], %[step2_10] \n\t"
- "add %[step3_14], %[step2_13], %[step2_14] \n\t"
- "add %[step3_15], %[step2_12], %[step2_15] \n\t"
- "extp %[step3_10], $ac0, 31 \n\t"
- "extp %[step3_13], $ac1, 31 \n\t"
- "extp %[step3_11], $ac2, 31 \n\t"
- "extp %[step3_12], $ac3, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [step3_8] "=r" (step3_8), [step3_9] "=r" (step3_9),
- [step3_10] "=r" (step3_10), [step3_11] "=r" (step3_11),
- [step3_12] "=r" (step3_12), [step3_13] "=r" (step3_13),
- [step3_14] "=r" (step3_14), [step3_15] "=r" (step3_15)
- : [const_2_power_13] "r" (const_2_power_13), [step2_8] "r" (step2_8),
- [step2_9] "r" (step2_9), [step2_10] "r" (step2_10),
- [step2_11] "r" (step2_11), [step2_12] "r" (step2_12),
- [step2_13] "r" (step2_13), [step2_14] "r" (step2_14),
- [step2_15] "r" (step2_15), [cospi_16_64] "r" (cospi_16_64)
- );
-
- step2_18 = step1_17 - step1_18;
- step2_29 = step1_30 - step1_29;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "msub $ac0, %[step2_18], %[cospi_8_64] \n\t"
- "madd $ac0, %[step2_29], %[cospi_24_64] \n\t"
- "extp %[step3_18], $ac0, 31 \n\t"
-
- : [step3_18] "=r" (step3_18)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_18] "r" (step2_18), [step2_29] "r" (step2_29),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = step2_18 * cospi_24_64 + step2_29 * cospi_8_64;
- step3_29 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step2_19 = step1_16 - step1_19;
- step2_28 = step1_31 - step1_28;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "msub $ac0, %[step2_19], %[cospi_8_64] \n\t"
- "madd $ac0, %[step2_28], %[cospi_24_64] \n\t"
- "extp %[step3_19], $ac0, 31 \n\t"
-
- : [step3_19] "=r" (step3_19)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_19] "r" (step2_19), [step2_28] "r" (step2_28),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = step2_19 * cospi_24_64 + step2_28 * cospi_8_64;
- step3_28 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step3_16 = step1_16 + step1_19;
- step3_17 = step1_17 + step1_18;
- step3_30 = step1_29 + step1_30;
- step3_31 = step1_28 + step1_31;
-
- step2_20 = step1_23 - step1_20;
- step2_27 = step1_24 - step1_27;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "msub $ac0, %[step2_20], %[cospi_24_64] \n\t"
- "msub $ac0, %[step2_27], %[cospi_8_64] \n\t"
- "extp %[step3_20], $ac0, 31 \n\t"
-
- : [step3_20] "=r" (step3_20)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_20] "r" (step2_20), [step2_27] "r" (step2_27),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = -step2_20 * cospi_8_64 + step2_27 * cospi_24_64;
- step3_27 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step2_21 = step1_22 - step1_21;
- step2_26 = step1_25 - step1_26;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "msub $ac1, %[step2_21], %[cospi_24_64] \n\t"
- "msub $ac1, %[step2_26], %[cospi_8_64] \n\t"
- "extp %[step3_21], $ac1, 31 \n\t"
-
- : [step3_21] "=r" (step3_21)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_21] "r" (step2_21), [step2_26] "r" (step2_26),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = -step2_21 * cospi_8_64 + step2_26 * cospi_24_64;
- step3_26 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step3_22 = step1_21 + step1_22;
- step3_23 = step1_20 + step1_23;
- step3_24 = step1_24 + step1_27;
- step3_25 = step1_25 + step1_26;
-
- step2_16 = step3_16 + step3_23;
- step2_17 = step3_17 + step3_22;
- step2_18 = step3_18 + step3_21;
- step2_19 = step3_19 + step3_20;
- step2_20 = step3_19 - step3_20;
- step2_21 = step3_18 - step3_21;
- step2_22 = step3_17 - step3_22;
- step2_23 = step3_16 - step3_23;
-
- step2_24 = step3_31 - step3_24;
- step2_25 = step3_30 - step3_25;
- step2_26 = step3_29 - step3_26;
- step2_27 = step3_28 - step3_27;
- step2_28 = step3_28 + step3_27;
- step2_29 = step3_29 + step3_26;
- step2_30 = step3_30 + step3_25;
- step2_31 = step3_31 + step3_24;
-
- __asm__ __volatile__ (
- "lh %[load1], 0(%[input]) \n\t"
- "lh %[load2], 32(%[input]) \n\t"
- "lh %[load3], 16(%[input]) \n\t"
- "lh %[load4], 48(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "add %[result1], %[load1], %[load2] \n\t"
- "sub %[result2], %[load1], %[load2] \n\t"
- "madd $ac1, %[result1], %[cospi_16_64] \n\t"
- "madd $ac2, %[result2], %[cospi_16_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "madd $ac3, %[load3], %[cospi_24_64] \n\t"
- "msub $ac3, %[load4], %[cospi_8_64] \n\t"
- "extp %[temp2], $ac3, 31 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "madd $ac1, %[load3], %[cospi_8_64] \n\t"
- "madd $ac1, %[load4], %[cospi_24_64] \n\t"
- "extp %[temp3], $ac1, 31 \n\t"
- "add %[step1_0], %[temp0], %[temp3] \n\t"
- "add %[step1_1], %[temp1], %[temp2] \n\t"
- "sub %[step1_2], %[temp1], %[temp2] \n\t"
- "sub %[step1_3], %[temp0], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_0] "=r" (step1_0), [step1_1] "=r" (step1_1),
- [step1_2] "=r" (step1_2), [step1_3] "=r" (step1_3)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 8(%[input]) \n\t"
- "lh %[load2], 56(%[input]) \n\t"
- "lh %[load3], 40(%[input]) \n\t"
- "lh %[load4], 24(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_28_64] \n\t"
- "msub $ac1, %[load2], %[cospi_4_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
- "madd $ac3, %[load1], %[cospi_4_64] \n\t"
- "madd $ac3, %[load2], %[cospi_28_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_12_64] \n\t"
- "msub $ac2, %[load4], %[cospi_20_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
- "madd $ac1, %[load3], %[cospi_20_64] \n\t"
- "madd $ac1, %[load4], %[cospi_12_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp3], %[temp2] \n\t"
- "sub %[load1], %[load1], %[temp0] \n\t"
- "add %[load1], %[load1], %[temp1] \n\t"
- "sub %[load2], %[temp0], %[temp1] \n\t"
- "sub %[load2], %[load2], %[temp2] \n\t"
- "add %[load2], %[load2], %[temp3] \n\t"
- "madd $ac1, %[load1], %[cospi_16_64] \n\t"
- "madd $ac3, %[load2], %[cospi_16_64] \n\t"
-
- "extp %[step1_5], $ac1, 31 \n\t"
- "extp %[step1_6], $ac3, 31 \n\t"
- "add %[step1_4], %[temp0], %[temp1] \n\t"
- "add %[step1_7], %[temp3], %[temp2] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_4] "=r" (step1_4), [step1_5] "=r" (step1_5),
- [step1_6] "=r" (step1_6), [step1_7] "=r" (step1_7)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_20_64] "r" (cospi_20_64), [cospi_12_64] "r" (cospi_12_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_28_64] "r" (cospi_28_64),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- step2_0 = step1_0 + step1_7;
- step2_1 = step1_1 + step1_6;
- step2_2 = step1_2 + step1_5;
- step2_3 = step1_3 + step1_4;
- step2_4 = step1_3 - step1_4;
- step2_5 = step1_2 - step1_5;
- step2_6 = step1_1 - step1_6;
- step2_7 = step1_0 - step1_7;
-
- // stage 7
- step1_0 = step2_0 + step3_15;
- step1_1 = step2_1 + step3_14;
- step1_2 = step2_2 + step3_13;
- step1_3 = step2_3 + step3_12;
- step1_4 = step2_4 + step3_11;
- step1_5 = step2_5 + step3_10;
- step1_6 = step2_6 + step3_9;
- step1_7 = step2_7 + step3_8;
- step1_8 = step2_7 - step3_8;
- step1_9 = step2_6 - step3_9;
- step1_10 = step2_5 - step3_10;
- step1_11 = step2_4 - step3_11;
- step1_12 = step2_3 - step3_12;
- step1_13 = step2_2 - step3_13;
- step1_14 = step2_1 - step3_14;
- step1_15 = step2_0 - step3_15;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_27], %[step2_20] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_20], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_20] "=r" (step1_20)
- : [const_2_power_13] "r" (const_2_power_13), [step2_20] "r" (step2_20),
- [step2_27] "r" (step2_27), [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_20 + step2_27) * cospi_16_64;
- step1_27 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_26], %[step2_21] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_21], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_21] "=r" (step1_21)
- : [const_2_power_13] "r" (const_2_power_13), [step2_26] "r" (step2_26),
- [step2_21] "r" (step2_21), [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_21 + step2_26) * cospi_16_64;
- step1_26 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_25], %[step2_22] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_22], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_22] "=r" (step1_22)
- : [const_2_power_13] "r" (const_2_power_13), [step2_25] "r" (step2_25),
- [step2_22] "r" (step2_22), [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_22 + step2_25) * cospi_16_64;
- step1_25 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_24], %[step2_23] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_23], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_23] "=r" (step1_23)
- : [const_2_power_13] "r" (const_2_power_13), [step2_24] "r" (step2_24),
- [step2_23] "r" (step2_23), [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_23 + step2_24) * cospi_16_64;
- step1_24 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_0], %[step2_31] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_1], %[step2_30] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_2], %[step2_29] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_3], %[step2_28] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step1_0] "r" (step1_0), [step1_1] "r" (step1_1),
- [step1_2] "r" (step1_2), [step1_3] "r" (step1_3),
- [step2_28] "r" (step2_28), [step2_29] "r" (step2_29),
- [step2_30] "r" (step2_30), [step2_31] "r" (step2_31)
- );
-
- step3_12 = ROUND_POWER_OF_TWO((step1_3 - step2_28), 6);
- step3_13 = ROUND_POWER_OF_TWO((step1_2 - step2_29), 6);
- step3_14 = ROUND_POWER_OF_TWO((step1_1 - step2_30), 6);
- step3_15 = ROUND_POWER_OF_TWO((step1_0 - step2_31), 6);
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_15] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_14] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_13] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_12] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
- [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
- );
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_4], %[step1_27] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_5], %[step1_26] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_6], %[step1_25] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_7], %[step1_24] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step1_4] "r" (step1_4), [step1_5] "r" (step1_5),
- [step1_6] "r" (step1_6), [step1_7] "r" (step1_7),
- [step1_24] "r" (step1_24), [step1_25] "r" (step1_25),
- [step1_26] "r" (step1_26), [step1_27] "r" (step1_27)
- );
-
- step3_12 = ROUND_POWER_OF_TWO((step1_7 - step1_24), 6);
- step3_13 = ROUND_POWER_OF_TWO((step1_6 - step1_25), 6);
- step3_14 = ROUND_POWER_OF_TWO((step1_5 - step1_26), 6);
- step3_15 = ROUND_POWER_OF_TWO((step1_4 - step1_27), 6);
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_15] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_14] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_13] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_12] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
- [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
- );
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_8], %[step1_23] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_9], %[step1_22] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_10], %[step1_21] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_11], %[step1_20] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step1_8] "r" (step1_8), [step1_9] "r" (step1_9),
- [step1_10] "r" (step1_10), [step1_11] "r" (step1_11),
- [step1_20] "r" (step1_20), [step1_21] "r" (step1_21),
- [step1_22] "r" (step1_22), [step1_23] "r" (step1_23)
- );
-
- step3_12 = ROUND_POWER_OF_TWO((step1_11 - step1_20), 6);
- step3_13 = ROUND_POWER_OF_TWO((step1_10 - step1_21), 6);
- step3_14 = ROUND_POWER_OF_TWO((step1_9 - step1_22), 6);
- step3_15 = ROUND_POWER_OF_TWO((step1_8 - step1_23), 6);
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_15] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_14] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_13] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_12] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
- [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
- );
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_12], %[step2_19] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_13], %[step2_18] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix]) \n\t"
- "add %[temp0], %[step1_14], %[step2_17] \n\t"
- "addi %[temp0], %[temp0], 32 \n\t"
- "sra %[temp0], %[temp0], 6 \n\t"
- "add %[temp2], %[temp2], %[temp0] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "add %[temp1], %[step1_15], %[step2_16] \n\t"
- "sb %[temp0], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix]) \n\t"
- "addi %[temp1], %[temp1], 32 \n\t"
- "sra %[temp1], %[temp1], 6 \n\t"
- "add %[temp3], %[temp3], %[temp1] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix]) \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step1_12] "r" (step1_12), [step1_13] "r" (step1_13),
- [step1_14] "r" (step1_14), [step1_15] "r" (step1_15),
- [step2_16] "r" (step2_16), [step2_17] "r" (step2_17),
- [step2_18] "r" (step2_18), [step2_19] "r" (step2_19)
- );
-
- step3_12 = ROUND_POWER_OF_TWO((step1_15 - step2_16), 6);
- step3_13 = ROUND_POWER_OF_TWO((step1_14 - step2_17), 6);
- step3_14 = ROUND_POWER_OF_TWO((step1_13 - step2_18), 6);
- step3_15 = ROUND_POWER_OF_TWO((step1_12 - step2_19), 6);
-
- __asm__ __volatile__ (
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_15] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_14] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
-
- "lbu %[temp2], 0(%[dest_pix1]) \n\t"
- "add %[temp2], %[temp2], %[step3_13] \n\t"
- "lbux %[temp0], %[temp2](%[cm]) \n\t"
- "sb %[temp0], 0(%[dest_pix1]) \n\t"
- "subu %[dest_pix1], %[dest_pix1], %[dest_stride] \n\t"
- "lbu %[temp3], 0(%[dest_pix1]) \n\t"
- "add %[temp3], %[temp3], %[step3_12] \n\t"
- "lbux %[temp1], %[temp3](%[cm]) \n\t"
- "sb %[temp1], 0(%[dest_pix1]) \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
- : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
- [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
- [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
- );
-
- input += 32;
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_dspr2.c
deleted file mode 100644
index 74a90b0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans32_dspr2.c
+++ /dev/null
@@ -1,1076 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void idct32_rows_dspr2(const int16_t *input, int16_t *output,
- uint32_t no_rows) {
- int16_t step1_0, step1_1, step1_2, step1_3, step1_4, step1_5, step1_6;
- int16_t step1_7, step1_8, step1_9, step1_10, step1_11, step1_12, step1_13;
- int16_t step1_14, step1_15, step1_16, step1_17, step1_18, step1_19, step1_20;
- int16_t step1_21, step1_22, step1_23, step1_24, step1_25, step1_26, step1_27;
- int16_t step1_28, step1_29, step1_30, step1_31;
- int16_t step2_0, step2_1, step2_2, step2_3, step2_4, step2_5, step2_6;
- int16_t step2_7, step2_8, step2_9, step2_10, step2_11, step2_12, step2_13;
- int16_t step2_14, step2_15, step2_16, step2_17, step2_18, step2_19, step2_20;
- int16_t step2_21, step2_22, step2_23, step2_24, step2_25, step2_26, step2_27;
- int16_t step2_28, step2_29, step2_30, step2_31;
- int16_t step3_8, step3_9, step3_10, step3_11, step3_12, step3_13, step3_14;
- int16_t step3_15, step3_16, step3_17, step3_18, step3_19, step3_20, step3_21;
- int16_t step3_22, step3_23, step3_24, step3_25, step3_26, step3_27, step3_28;
- int16_t step3_29, step3_30, step3_31;
- int temp0, temp1, temp2, temp3;
- int load1, load2, load3, load4;
- int result1, result2;
- int temp21;
- int i;
- const int const_2_power_13 = 8192;
- const int32_t *input_int;
-
- for (i = no_rows; i--; ) {
- input_int = (const int32_t *)input;
-
- if (!(input_int[0] | input_int[1] | input_int[2] | input_int[3] |
- input_int[4] | input_int[5] | input_int[6] | input_int[7] |
- input_int[8] | input_int[9] | input_int[10] | input_int[11] |
- input_int[12] | input_int[13] | input_int[14] | input_int[15])) {
- input += 32;
-
- __asm__ __volatile__ (
- "sh $zero, 0(%[output]) \n\t"
- "sh $zero, 64(%[output]) \n\t"
- "sh $zero, 128(%[output]) \n\t"
- "sh $zero, 192(%[output]) \n\t"
- "sh $zero, 256(%[output]) \n\t"
- "sh $zero, 320(%[output]) \n\t"
- "sh $zero, 384(%[output]) \n\t"
- "sh $zero, 448(%[output]) \n\t"
- "sh $zero, 512(%[output]) \n\t"
- "sh $zero, 576(%[output]) \n\t"
- "sh $zero, 640(%[output]) \n\t"
- "sh $zero, 704(%[output]) \n\t"
- "sh $zero, 768(%[output]) \n\t"
- "sh $zero, 832(%[output]) \n\t"
- "sh $zero, 896(%[output]) \n\t"
- "sh $zero, 960(%[output]) \n\t"
- "sh $zero, 1024(%[output]) \n\t"
- "sh $zero, 1088(%[output]) \n\t"
- "sh $zero, 1152(%[output]) \n\t"
- "sh $zero, 1216(%[output]) \n\t"
- "sh $zero, 1280(%[output]) \n\t"
- "sh $zero, 1344(%[output]) \n\t"
- "sh $zero, 1408(%[output]) \n\t"
- "sh $zero, 1472(%[output]) \n\t"
- "sh $zero, 1536(%[output]) \n\t"
- "sh $zero, 1600(%[output]) \n\t"
- "sh $zero, 1664(%[output]) \n\t"
- "sh $zero, 1728(%[output]) \n\t"
- "sh $zero, 1792(%[output]) \n\t"
- "sh $zero, 1856(%[output]) \n\t"
- "sh $zero, 1920(%[output]) \n\t"
- "sh $zero, 1984(%[output]) \n\t"
-
- :
- : [output] "r" (output)
- );
-
- output += 1;
-
- continue;
- }
-
- /* prefetch row */
- vp9_prefetch_load((const uint8_t *)(input + 32));
- vp9_prefetch_load((const uint8_t *)(input + 48));
-
- __asm__ __volatile__ (
- "lh %[load1], 2(%[input]) \n\t"
- "lh %[load2], 62(%[input]) \n\t"
- "lh %[load3], 34(%[input]) \n\t"
- "lh %[load4], 30(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_31_64] \n\t"
- "msub $ac1, %[load2], %[cospi_1_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_1_64] \n\t"
- "madd $ac3, %[load2], %[cospi_31_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_15_64] \n\t"
- "msub $ac2, %[load4], %[cospi_17_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_17_64] \n\t"
- "madd $ac1, %[load4], %[cospi_15_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp3], %[temp2] \n\t"
- "sub %[load2], %[temp0], %[temp1] \n\t"
-
- "madd $ac1, %[load1], %[cospi_28_64] \n\t"
- "msub $ac1, %[load2], %[cospi_4_64] \n\t"
- "madd $ac3, %[load1], %[cospi_4_64] \n\t"
- "madd $ac3, %[load2], %[cospi_28_64] \n\t"
-
- "extp %[step1_17], $ac1, 31 \n\t"
- "extp %[step1_30], $ac3, 31 \n\t"
- "add %[step1_16], %[temp0], %[temp1] \n\t"
- "add %[step1_31], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_16] "=r" (step1_16), [step1_17] "=r" (step1_17),
- [step1_30] "=r" (step1_30), [step1_31] "=r" (step1_31)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_31_64] "r" (cospi_31_64), [cospi_1_64] "r" (cospi_1_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_17_64] "r" (cospi_17_64),
- [cospi_15_64] "r" (cospi_15_64), [cospi_28_64] "r" (cospi_28_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 18(%[input]) \n\t"
- "lh %[load2], 46(%[input]) \n\t"
- "lh %[load3], 50(%[input]) \n\t"
- "lh %[load4], 14(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_23_64] \n\t"
- "msub $ac1, %[load2], %[cospi_9_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_9_64] \n\t"
- "madd $ac3, %[load2], %[cospi_23_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_7_64] \n\t"
- "msub $ac2, %[load4], %[cospi_25_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_25_64] \n\t"
- "madd $ac1, %[load4], %[cospi_7_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp1], %[temp0] \n\t"
- "sub %[load2], %[temp2], %[temp3] \n\t"
-
- "msub $ac1, %[load1], %[cospi_28_64] \n\t"
- "msub $ac1, %[load2], %[cospi_4_64] \n\t"
- "msub $ac3, %[load1], %[cospi_4_64] \n\t"
- "madd $ac3, %[load2], %[cospi_28_64] \n\t"
-
- "extp %[step1_18], $ac1, 31 \n\t"
- "extp %[step1_29], $ac3, 31 \n\t"
- "add %[step1_19], %[temp0], %[temp1] \n\t"
- "add %[step1_28], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_18] "=r" (step1_18), [step1_19] "=r" (step1_19),
- [step1_28] "=r" (step1_28), [step1_29] "=r" (step1_29)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_23_64] "r" (cospi_23_64), [cospi_9_64] "r" (cospi_9_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_7_64] "r" (cospi_7_64),
- [cospi_25_64] "r" (cospi_25_64), [cospi_28_64] "r" (cospi_28_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 10(%[input]) \n\t"
- "lh %[load2], 54(%[input]) \n\t"
- "lh %[load3], 42(%[input]) \n\t"
- "lh %[load4], 22(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_27_64] \n\t"
- "msub $ac1, %[load2], %[cospi_5_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_5_64] \n\t"
- "madd $ac3, %[load2], %[cospi_27_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_11_64] \n\t"
- "msub $ac2, %[load4], %[cospi_21_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_21_64] \n\t"
- "madd $ac1, %[load4], %[cospi_11_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp0], %[temp1] \n\t"
- "sub %[load2], %[temp3], %[temp2] \n\t"
-
- "madd $ac1, %[load2], %[cospi_12_64] \n\t"
- "msub $ac1, %[load1], %[cospi_20_64] \n\t"
- "madd $ac3, %[load1], %[cospi_12_64] \n\t"
- "madd $ac3, %[load2], %[cospi_20_64] \n\t"
-
- "extp %[step1_21], $ac1, 31 \n\t"
- "extp %[step1_26], $ac3, 31 \n\t"
- "add %[step1_20], %[temp0], %[temp1] \n\t"
- "add %[step1_27], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_20] "=r" (step1_20), [step1_21] "=r" (step1_21),
- [step1_26] "=r" (step1_26), [step1_27] "=r" (step1_27)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_27_64] "r" (cospi_27_64), [cospi_5_64] "r" (cospi_5_64),
- [cospi_11_64] "r" (cospi_11_64), [cospi_21_64] "r" (cospi_21_64),
- [cospi_12_64] "r" (cospi_12_64), [cospi_20_64] "r" (cospi_20_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 26(%[input]) \n\t"
- "lh %[load2], 38(%[input]) \n\t"
- "lh %[load3], 58(%[input]) \n\t"
- "lh %[load4], 6(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_19_64] \n\t"
- "msub $ac1, %[load2], %[cospi_13_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_13_64] \n\t"
- "madd $ac3, %[load2], %[cospi_19_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_3_64] \n\t"
- "msub $ac2, %[load4], %[cospi_29_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_29_64] \n\t"
- "madd $ac1, %[load4], %[cospi_3_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp1], %[temp0] \n\t"
- "sub %[load2], %[temp2], %[temp3] \n\t"
-
- "msub $ac1, %[load1], %[cospi_12_64] \n\t"
- "msub $ac1, %[load2], %[cospi_20_64] \n\t"
- "msub $ac3, %[load1], %[cospi_20_64] \n\t"
- "madd $ac3, %[load2], %[cospi_12_64] \n\t"
-
- "extp %[step1_22], $ac1, 31 \n\t"
- "extp %[step1_25], $ac3, 31 \n\t"
- "add %[step1_23], %[temp0], %[temp1] \n\t"
- "add %[step1_24], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_22] "=r" (step1_22), [step1_23] "=r" (step1_23),
- [step1_24] "=r" (step1_24), [step1_25] "=r" (step1_25)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_19_64] "r" (cospi_19_64), [cospi_13_64] "r" (cospi_13_64),
- [cospi_3_64] "r" (cospi_3_64), [cospi_29_64] "r" (cospi_29_64),
- [cospi_12_64] "r" (cospi_12_64), [cospi_20_64] "r" (cospi_20_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 4(%[input]) \n\t"
- "lh %[load2], 60(%[input]) \n\t"
- "lh %[load3], 36(%[input]) \n\t"
- "lh %[load4], 28(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_30_64] \n\t"
- "msub $ac1, %[load2], %[cospi_2_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_2_64] \n\t"
- "madd $ac3, %[load2], %[cospi_30_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_14_64] \n\t"
- "msub $ac2, %[load4], %[cospi_18_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_18_64] \n\t"
- "madd $ac1, %[load4], %[cospi_14_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp0], %[temp1] \n\t"
- "sub %[load2], %[temp3], %[temp2] \n\t"
-
- "msub $ac1, %[load1], %[cospi_8_64] \n\t"
- "madd $ac1, %[load2], %[cospi_24_64] \n\t"
- "madd $ac3, %[load1], %[cospi_24_64] \n\t"
- "madd $ac3, %[load2], %[cospi_8_64] \n\t"
-
- "extp %[step2_9], $ac1, 31 \n\t"
- "extp %[step2_14], $ac3, 31 \n\t"
- "add %[step2_8], %[temp0], %[temp1] \n\t"
- "add %[step2_15], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step2_8] "=r" (step2_8), [step2_9] "=r" (step2_9),
- [step2_14] "=r" (step2_14), [step2_15] "=r" (step2_15)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_30_64] "r" (cospi_30_64), [cospi_2_64] "r" (cospi_2_64),
- [cospi_14_64] "r" (cospi_14_64), [cospi_18_64] "r" (cospi_18_64),
- [cospi_8_64] "r" (cospi_8_64), [cospi_24_64] "r" (cospi_24_64)
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 20(%[input]) \n\t"
- "lh %[load2], 44(%[input]) \n\t"
- "lh %[load3], 52(%[input]) \n\t"
- "lh %[load4], 12(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_22_64] \n\t"
- "msub $ac1, %[load2], %[cospi_10_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_10_64] \n\t"
- "madd $ac3, %[load2], %[cospi_22_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_6_64] \n\t"
- "msub $ac2, %[load4], %[cospi_26_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_26_64] \n\t"
- "madd $ac1, %[load4], %[cospi_6_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp1], %[temp0] \n\t"
- "sub %[load2], %[temp2], %[temp3] \n\t"
-
- "msub $ac1, %[load1], %[cospi_24_64] \n\t"
- "msub $ac1, %[load2], %[cospi_8_64] \n\t"
- "madd $ac3, %[load2], %[cospi_24_64] \n\t"
- "msub $ac3, %[load1], %[cospi_8_64] \n\t"
-
- "extp %[step2_10], $ac1, 31 \n\t"
- "extp %[step2_13], $ac3, 31 \n\t"
- "add %[step2_11], %[temp0], %[temp1] \n\t"
- "add %[step2_12], %[temp2], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step2_10] "=r" (step2_10), [step2_11] "=r" (step2_11),
- [step2_12] "=r" (step2_12), [step2_13] "=r" (step2_13)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_22_64] "r" (cospi_22_64), [cospi_10_64] "r" (cospi_10_64),
- [cospi_6_64] "r" (cospi_6_64), [cospi_26_64] "r" (cospi_26_64),
- [cospi_8_64] "r" (cospi_8_64), [cospi_24_64] "r" (cospi_24_64)
- );
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "sub %[temp0], %[step2_14], %[step2_13] \n\t"
- "sub %[temp0], %[temp0], %[step2_9] \n\t"
- "add %[temp0], %[temp0], %[step2_10] \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "sub %[temp1], %[step2_14], %[step2_13] \n\t"
- "add %[temp1], %[temp1], %[step2_9] \n\t"
- "sub %[temp1], %[temp1], %[step2_10] \n\t"
- "madd $ac1, %[temp1], %[cospi_16_64] \n\t"
-
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "sub %[temp0], %[step2_15], %[step2_12] \n\t"
- "sub %[temp0], %[temp0], %[step2_8] \n\t"
- "add %[temp0], %[temp0], %[step2_11] \n\t"
- "madd $ac2, %[temp0], %[cospi_16_64] \n\t"
-
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "sub %[temp1], %[step2_15], %[step2_12] \n\t"
- "add %[temp1], %[temp1], %[step2_8] \n\t"
- "sub %[temp1], %[temp1], %[step2_11] \n\t"
- "madd $ac3, %[temp1], %[cospi_16_64] \n\t"
-
- "add %[step3_8], %[step2_8], %[step2_11] \n\t"
- "add %[step3_9], %[step2_9], %[step2_10] \n\t"
- "add %[step3_14], %[step2_13], %[step2_14] \n\t"
- "add %[step3_15], %[step2_12], %[step2_15] \n\t"
-
- "extp %[step3_10], $ac0, 31 \n\t"
- "extp %[step3_13], $ac1, 31 \n\t"
- "extp %[step3_11], $ac2, 31 \n\t"
- "extp %[step3_12], $ac3, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [step3_8] "=r" (step3_8), [step3_9] "=r" (step3_9),
- [step3_10] "=r" (step3_10), [step3_11] "=r" (step3_11),
- [step3_12] "=r" (step3_12), [step3_13] "=r" (step3_13),
- [step3_14] "=r" (step3_14), [step3_15] "=r" (step3_15)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_8] "r" (step2_8), [step2_9] "r" (step2_9),
- [step2_10] "r" (step2_10), [step2_11] "r" (step2_11),
- [step2_12] "r" (step2_12), [step2_13] "r" (step2_13),
- [step2_14] "r" (step2_14), [step2_15] "r" (step2_15),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- step2_18 = step1_17 - step1_18;
- step2_29 = step1_30 - step1_29;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "msub $ac0, %[step2_18], %[cospi_8_64] \n\t"
- "madd $ac0, %[step2_29], %[cospi_24_64] \n\t"
- "extp %[step3_18], $ac0, 31 \n\t"
-
- : [step3_18] "=r" (step3_18)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_18] "r" (step2_18), [step2_29] "r" (step2_29),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = step2_18 * cospi_24_64 + step2_29 * cospi_8_64;
- step3_29 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step2_19 = step1_16 - step1_19;
- step2_28 = step1_31 - step1_28;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "msub $ac0, %[step2_19], %[cospi_8_64] \n\t"
- "madd $ac0, %[step2_28], %[cospi_24_64] \n\t"
- "extp %[step3_19], $ac0, 31 \n\t"
-
- : [step3_19] "=r" (step3_19)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_19] "r" (step2_19), [step2_28] "r" (step2_28),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = step2_19 * cospi_24_64 + step2_28 * cospi_8_64;
- step3_28 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step3_16 = step1_16 + step1_19;
- step3_17 = step1_17 + step1_18;
- step3_30 = step1_29 + step1_30;
- step3_31 = step1_28 + step1_31;
-
- step2_20 = step1_23 - step1_20;
- step2_27 = step1_24 - step1_27;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "msub $ac0, %[step2_20], %[cospi_24_64] \n\t"
- "msub $ac0, %[step2_27], %[cospi_8_64] \n\t"
- "extp %[step3_20], $ac0, 31 \n\t"
-
- : [step3_20] "=r" (step3_20)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_20] "r" (step2_20), [step2_27] "r" (step2_27),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = -step2_20 * cospi_8_64 + step2_27 * cospi_24_64;
- step3_27 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step2_21 = step1_22 - step1_21;
- step2_26 = step1_25 - step1_26;
-
- __asm__ __volatile__ (
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "msub $ac1, %[step2_21], %[cospi_24_64] \n\t"
- "msub $ac1, %[step2_26], %[cospi_8_64] \n\t"
- "extp %[step3_21], $ac1, 31 \n\t"
-
- : [step3_21] "=r" (step3_21)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_21] "r" (step2_21), [step2_26] "r" (step2_26),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
- );
-
- temp21 = -step2_21 * cospi_8_64 + step2_26 * cospi_24_64;
- step3_26 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- step3_22 = step1_21 + step1_22;
- step3_23 = step1_20 + step1_23;
- step3_24 = step1_24 + step1_27;
- step3_25 = step1_25 + step1_26;
-
- step2_16 = step3_16 + step3_23;
- step2_17 = step3_17 + step3_22;
- step2_18 = step3_18 + step3_21;
- step2_19 = step3_19 + step3_20;
- step2_20 = step3_19 - step3_20;
- step2_21 = step3_18 - step3_21;
- step2_22 = step3_17 - step3_22;
- step2_23 = step3_16 - step3_23;
-
- step2_24 = step3_31 - step3_24;
- step2_25 = step3_30 - step3_25;
- step2_26 = step3_29 - step3_26;
- step2_27 = step3_28 - step3_27;
- step2_28 = step3_28 + step3_27;
- step2_29 = step3_29 + step3_26;
- step2_30 = step3_30 + step3_25;
- step2_31 = step3_31 + step3_24;
-
- __asm__ __volatile__ (
- "lh %[load1], 0(%[input]) \n\t"
- "lh %[load2], 32(%[input]) \n\t"
- "lh %[load3], 16(%[input]) \n\t"
- "lh %[load4], 48(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
- "add %[result1], %[load1], %[load2] \n\t"
- "sub %[result2], %[load1], %[load2] \n\t"
- "madd $ac1, %[result1], %[cospi_16_64] \n\t"
- "madd $ac2, %[result2], %[cospi_16_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
- "madd $ac3, %[load3], %[cospi_24_64] \n\t"
- "msub $ac3, %[load4], %[cospi_8_64] \n\t"
- "extp %[temp2], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "madd $ac1, %[load3], %[cospi_8_64] \n\t"
- "madd $ac1, %[load4], %[cospi_24_64] \n\t"
- "extp %[temp3], $ac1, 31 \n\t"
-
- "add %[step1_0], %[temp0], %[temp3] \n\t"
- "add %[step1_1], %[temp1], %[temp2] \n\t"
- "sub %[step1_2], %[temp1], %[temp2] \n\t"
- "sub %[step1_3], %[temp0], %[temp3] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [result1] "=&r" (result1), [result2] "=&r" (result2),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_0] "=r" (step1_0), [step1_1] "=r" (step1_1),
- [step1_2] "=r" (step1_2), [step1_3] "=r" (step1_3)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_16_64] "r" (cospi_16_64),
- [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
-
- );
-
- __asm__ __volatile__ (
- "lh %[load1], 8(%[input]) \n\t"
- "lh %[load2], 56(%[input]) \n\t"
- "lh %[load3], 40(%[input]) \n\t"
- "lh %[load4], 24(%[input]) \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "madd $ac1, %[load1], %[cospi_28_64] \n\t"
- "msub $ac1, %[load2], %[cospi_4_64] \n\t"
- "extp %[temp0], $ac1, 31 \n\t"
-
- "madd $ac3, %[load1], %[cospi_4_64] \n\t"
- "madd $ac3, %[load2], %[cospi_28_64] \n\t"
- "extp %[temp3], $ac3, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac2 \n\t"
- "mthi $zero, $ac2 \n\t"
-
- "madd $ac2, %[load3], %[cospi_12_64] \n\t"
- "msub $ac2, %[load4], %[cospi_20_64] \n\t"
- "extp %[temp1], $ac2, 31 \n\t"
-
- "madd $ac1, %[load3], %[cospi_20_64] \n\t"
- "madd $ac1, %[load4], %[cospi_12_64] \n\t"
- "extp %[temp2], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "mtlo %[const_2_power_13], $ac3 \n\t"
- "mthi $zero, $ac3 \n\t"
-
- "sub %[load1], %[temp3], %[temp2] \n\t"
- "sub %[load1], %[load1], %[temp0] \n\t"
- "add %[load1], %[load1], %[temp1] \n\t"
-
- "sub %[load2], %[temp0], %[temp1] \n\t"
- "sub %[load2], %[load2], %[temp2] \n\t"
- "add %[load2], %[load2], %[temp3] \n\t"
-
- "madd $ac1, %[load1], %[cospi_16_64] \n\t"
- "madd $ac3, %[load2], %[cospi_16_64] \n\t"
-
- "extp %[step1_5], $ac1, 31 \n\t"
- "extp %[step1_6], $ac3, 31 \n\t"
- "add %[step1_4], %[temp0], %[temp1] \n\t"
- "add %[step1_7], %[temp3], %[temp2] \n\t"
-
- : [load1] "=&r" (load1), [load2] "=&r" (load2),
- [load3] "=&r" (load3), [load4] "=&r" (load4),
- [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
- [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [step1_4] "=r" (step1_4), [step1_5] "=r" (step1_5),
- [step1_6] "=r" (step1_6), [step1_7] "=r" (step1_7)
- : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
- [cospi_20_64] "r" (cospi_20_64), [cospi_12_64] "r" (cospi_12_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_28_64] "r" (cospi_28_64),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- step2_0 = step1_0 + step1_7;
- step2_1 = step1_1 + step1_6;
- step2_2 = step1_2 + step1_5;
- step2_3 = step1_3 + step1_4;
- step2_4 = step1_3 - step1_4;
- step2_5 = step1_2 - step1_5;
- step2_6 = step1_1 - step1_6;
- step2_7 = step1_0 - step1_7;
-
- step1_0 = step2_0 + step3_15;
- step1_1 = step2_1 + step3_14;
- step1_2 = step2_2 + step3_13;
- step1_3 = step2_3 + step3_12;
- step1_4 = step2_4 + step3_11;
- step1_5 = step2_5 + step3_10;
- step1_6 = step2_6 + step3_9;
- step1_7 = step2_7 + step3_8;
- step1_8 = step2_7 - step3_8;
- step1_9 = step2_6 - step3_9;
- step1_10 = step2_5 - step3_10;
- step1_11 = step2_4 - step3_11;
- step1_12 = step2_3 - step3_12;
- step1_13 = step2_2 - step3_13;
- step1_14 = step2_1 - step3_14;
- step1_15 = step2_0 - step3_15;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_27], %[step2_20] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_20], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_20] "=r" (step1_20)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_20] "r" (step2_20), [step2_27] "r" (step2_27),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_20 + step2_27) * cospi_16_64;
- step1_27 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_26], %[step2_21] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_21], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_21] "=r" (step1_21)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_26] "r" (step2_26), [step2_21] "r" (step2_21),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_21 + step2_26) * cospi_16_64;
- step1_26 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_25], %[step2_22] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_22], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_22] "=r" (step1_22)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_25] "r" (step2_25), [step2_22] "r" (step2_22),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_22 + step2_25) * cospi_16_64;
- step1_25 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- __asm__ __volatile__ (
- "sub %[temp0], %[step2_24], %[step2_23] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "madd $ac0, %[temp0], %[cospi_16_64] \n\t"
- "extp %[step1_23], $ac0, 31 \n\t"
-
- : [temp0] "=&r" (temp0), [step1_23] "=r" (step1_23)
- : [const_2_power_13] "r" (const_2_power_13),
- [step2_24] "r" (step2_24), [step2_23] "r" (step2_23),
- [cospi_16_64] "r" (cospi_16_64)
- );
-
- temp21 = (step2_23 + step2_24) * cospi_16_64;
- step1_24 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
-
- // final stage
- output[0 * 32] = step1_0 + step2_31;
- output[1 * 32] = step1_1 + step2_30;
- output[2 * 32] = step1_2 + step2_29;
- output[3 * 32] = step1_3 + step2_28;
- output[4 * 32] = step1_4 + step1_27;
- output[5 * 32] = step1_5 + step1_26;
- output[6 * 32] = step1_6 + step1_25;
- output[7 * 32] = step1_7 + step1_24;
- output[8 * 32] = step1_8 + step1_23;
- output[9 * 32] = step1_9 + step1_22;
- output[10 * 32] = step1_10 + step1_21;
- output[11 * 32] = step1_11 + step1_20;
- output[12 * 32] = step1_12 + step2_19;
- output[13 * 32] = step1_13 + step2_18;
- output[14 * 32] = step1_14 + step2_17;
- output[15 * 32] = step1_15 + step2_16;
- output[16 * 32] = step1_15 - step2_16;
- output[17 * 32] = step1_14 - step2_17;
- output[18 * 32] = step1_13 - step2_18;
- output[19 * 32] = step1_12 - step2_19;
- output[20 * 32] = step1_11 - step1_20;
- output[21 * 32] = step1_10 - step1_21;
- output[22 * 32] = step1_9 - step1_22;
- output[23 * 32] = step1_8 - step1_23;
- output[24 * 32] = step1_7 - step1_24;
- output[25 * 32] = step1_6 - step1_25;
- output[26 * 32] = step1_5 - step1_26;
- output[27 * 32] = step1_4 - step1_27;
- output[28 * 32] = step1_3 - step2_28;
- output[29 * 32] = step1_2 - step2_29;
- output[30 * 32] = step1_1 - step2_30;
- output[31 * 32] = step1_0 - step2_31;
-
- input += 32;
- output += 1;
- }
-}
-
-void vp9_idct32x32_1024_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- DECLARE_ALIGNED(32, int16_t, out[32 * 32]);
- int16_t *outptr = out;
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- // Rows
- idct32_rows_dspr2(input, outptr, 32);
-
- // Columns
- vp9_idct32_cols_add_blk_dspr2(out, dest, dest_stride);
-}
-
-void vp9_idct32x32_34_add_dspr2(const int16_t *input, uint8_t *dest,
- int stride) {
- DECLARE_ALIGNED(32, int16_t, out[32 * 32]);
- int16_t *outptr = out;
- uint32_t i;
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- // Rows
- idct32_rows_dspr2(input, outptr, 8);
-
- outptr += 8;
- __asm__ __volatile__ (
- "sw $zero, 0(%[outptr]) \n\t"
- "sw $zero, 4(%[outptr]) \n\t"
- "sw $zero, 8(%[outptr]) \n\t"
- "sw $zero, 12(%[outptr]) \n\t"
- "sw $zero, 16(%[outptr]) \n\t"
- "sw $zero, 20(%[outptr]) \n\t"
- "sw $zero, 24(%[outptr]) \n\t"
- "sw $zero, 28(%[outptr]) \n\t"
- "sw $zero, 32(%[outptr]) \n\t"
- "sw $zero, 36(%[outptr]) \n\t"
- "sw $zero, 40(%[outptr]) \n\t"
- "sw $zero, 44(%[outptr]) \n\t"
-
- :
- : [outptr] "r" (outptr)
- );
-
- for (i = 0; i < 31; ++i) {
- outptr += 32;
-
- __asm__ __volatile__ (
- "sw $zero, 0(%[outptr]) \n\t"
- "sw $zero, 4(%[outptr]) \n\t"
- "sw $zero, 8(%[outptr]) \n\t"
- "sw $zero, 12(%[outptr]) \n\t"
- "sw $zero, 16(%[outptr]) \n\t"
- "sw $zero, 20(%[outptr]) \n\t"
- "sw $zero, 24(%[outptr]) \n\t"
- "sw $zero, 28(%[outptr]) \n\t"
- "sw $zero, 32(%[outptr]) \n\t"
- "sw $zero, 36(%[outptr]) \n\t"
- "sw $zero, 40(%[outptr]) \n\t"
- "sw $zero, 44(%[outptr]) \n\t"
-
- :
- : [outptr] "r" (outptr)
- );
- }
-
- // Columns
- vp9_idct32_cols_add_blk_dspr2(out, dest, stride);
-}
-
-void vp9_idct32x32_1_add_dspr2(const int16_t *input, uint8_t *dest,
- int stride) {
- int r, out;
- int32_t a1, absa1;
- int32_t vector_a1;
- int32_t t1, t2, t3, t4;
- int32_t vector_1, vector_2, vector_3, vector_4;
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
-
- :
- : [pos] "r" (pos)
- );
-
- out = DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input[0]);
- __asm__ __volatile__ (
- "addi %[out], %[out], 32 \n\t"
- "sra %[a1], %[out], 6 \n\t"
-
- : [out] "+r" (out), [a1] "=r" (a1)
- :
- );
-
- if (a1 < 0) {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "abs %[absa1], %[a1] \n\t"
- "replv.qb %[vector_a1], %[absa1] \n\t"
-
- : [absa1] "=r" (absa1), [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 32; r--;) {
- __asm__ __volatile__ (
- "lw %[t1], 0(%[dest]) \n\t"
- "lw %[t2], 4(%[dest]) \n\t"
- "lw %[t3], 8(%[dest]) \n\t"
- "lw %[t4], 12(%[dest]) \n\t"
- "subu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "subu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "subu_s.qb %[vector_3], %[t3], %[vector_a1] \n\t"
- "subu_s.qb %[vector_4], %[t4], %[vector_a1] \n\t"
- "sw %[vector_1], 0(%[dest]) \n\t"
- "sw %[vector_2], 4(%[dest]) \n\t"
- "sw %[vector_3], 8(%[dest]) \n\t"
- "sw %[vector_4], 12(%[dest]) \n\t"
-
- "lw %[t1], 16(%[dest]) \n\t"
- "lw %[t2], 20(%[dest]) \n\t"
- "lw %[t3], 24(%[dest]) \n\t"
- "lw %[t4], 28(%[dest]) \n\t"
- "subu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "subu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "subu_s.qb %[vector_3], %[t3], %[vector_a1] \n\t"
- "subu_s.qb %[vector_4], %[t4], %[vector_a1] \n\t"
- "sw %[vector_1], 16(%[dest]) \n\t"
- "sw %[vector_2], 20(%[dest]) \n\t"
- "sw %[vector_3], 24(%[dest]) \n\t"
- "sw %[vector_4], 28(%[dest]) \n\t"
-
- "add %[dest], %[dest], %[stride] \n\t"
-
- : [t1] "=&r" (t1), [t2] "=&r" (t2), [t3] "=&r" (t3), [t4] "=&r" (t4),
- [vector_1] "=&r" (vector_1), [vector_2] "=&r" (vector_2),
- [vector_3] "=&r" (vector_3), [vector_4] "=&r" (vector_4),
- [dest] "+&r" (dest)
- : [stride] "r" (stride), [vector_a1] "r" (vector_a1)
- );
- }
- } else {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "replv.qb %[vector_a1], %[a1] \n\t"
-
- : [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 32; r--;) {
- __asm__ __volatile__ (
- "lw %[t1], 0(%[dest]) \n\t"
- "lw %[t2], 4(%[dest]) \n\t"
- "lw %[t3], 8(%[dest]) \n\t"
- "lw %[t4], 12(%[dest]) \n\t"
- "addu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "addu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "addu_s.qb %[vector_3], %[t3], %[vector_a1] \n\t"
- "addu_s.qb %[vector_4], %[t4], %[vector_a1] \n\t"
- "sw %[vector_1], 0(%[dest]) \n\t"
- "sw %[vector_2], 4(%[dest]) \n\t"
- "sw %[vector_3], 8(%[dest]) \n\t"
- "sw %[vector_4], 12(%[dest]) \n\t"
-
- "lw %[t1], 16(%[dest]) \n\t"
- "lw %[t2], 20(%[dest]) \n\t"
- "lw %[t3], 24(%[dest]) \n\t"
- "lw %[t4], 28(%[dest]) \n\t"
- "addu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "addu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "addu_s.qb %[vector_3], %[t3], %[vector_a1] \n\t"
- "addu_s.qb %[vector_4], %[t4], %[vector_a1] \n\t"
- "sw %[vector_1], 16(%[dest]) \n\t"
- "sw %[vector_2], 20(%[dest]) \n\t"
- "sw %[vector_3], 24(%[dest]) \n\t"
- "sw %[vector_4], 28(%[dest]) \n\t"
-
- "add %[dest], %[dest], %[stride] \n\t"
-
- : [t1] "=&r" (t1), [t2] "=&r" (t2), [t3] "=&r" (t3), [t4] "=&r" (t4),
- [vector_1] "=&r" (vector_1), [vector_2] "=&r" (vector_2),
- [vector_3] "=&r" (vector_3), [vector_4] "=&r" (vector_4),
- [dest] "+&r" (dest)
- : [stride] "r" (stride), [vector_a1] "r" (vector_a1)
- );
- }
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c
deleted file mode 100644
index 1990348..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans4_dspr2.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void vp9_idct4_rows_dspr2(const int16_t *input, int16_t *output) {
- int16_t step_0, step_1, step_2, step_3;
- int Temp0, Temp1, Temp2, Temp3;
- const int const_2_power_13 = 8192;
- int i;
-
- for (i = 4; i--; ) {
- __asm__ __volatile__ (
- /*
- temp_1 = (input[0] + input[2]) * cospi_16_64;
- step_0 = dct_const_round_shift(temp_1);
-
- temp_2 = (input[0] - input[2]) * cospi_16_64;
- step_1 = dct_const_round_shift(temp_2);
- */
- "lh %[Temp0], 0(%[input]) \n\t"
- "lh %[Temp1], 4(%[input]) \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "add %[Temp2], %[Temp0], %[Temp1] \n\t"
- "sub %[Temp3], %[Temp0], %[Temp1] \n\t"
- "madd $ac0, %[Temp2], %[cospi_16_64] \n\t"
- "lh %[Temp0], 2(%[input]) \n\t"
- "lh %[Temp1], 6(%[input]) \n\t"
- "extp %[step_0], $ac0, 31 \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
-
- "madd $ac1, %[Temp3], %[cospi_16_64] \n\t"
- "extp %[step_1], $ac1, 31 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
-
- /*
- temp1 = input[1] * cospi_24_64 - input[3] * cospi_8_64;
- step_2 = dct_const_round_shift(temp1);
- */
- "madd $ac0, %[Temp0], %[cospi_24_64] \n\t"
- "msub $ac0, %[Temp1], %[cospi_8_64] \n\t"
- "extp %[step_2], $ac0, 31 \n\t"
-
- /*
- temp2 = input[1] * cospi_8_64 + input[3] * cospi_24_64;
- step_3 = dct_const_round_shift(temp2);
- */
- "madd $ac1, %[Temp0], %[cospi_8_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_24_64] \n\t"
- "extp %[step_3], $ac1, 31 \n\t"
-
- /*
- output[0] = step_0 + step_3;
- output[4] = step_1 + step_2;
- output[8] = step_1 - step_2;
- output[12] = step_0 - step_3;
- */
- "add %[Temp0], %[step_0], %[step_3] \n\t"
- "sh %[Temp0], 0(%[output]) \n\t"
-
- "add %[Temp1], %[step_1], %[step_2] \n\t"
- "sh %[Temp1], 8(%[output]) \n\t"
-
- "sub %[Temp2], %[step_1], %[step_2] \n\t"
- "sh %[Temp2], 16(%[output]) \n\t"
-
- "sub %[Temp3], %[step_0], %[step_3] \n\t"
- "sh %[Temp3], 24(%[output]) \n\t"
-
- : [Temp0] "=&r" (Temp0), [Temp1] "=&r" (Temp1),
- [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [step_0] "=&r" (step_0), [step_1] "=&r" (step_1),
- [step_2] "=&r" (step_2), [step_3] "=&r" (step_3),
- [output] "+r" (output)
- : [const_2_power_13] "r" (const_2_power_13),
- [cospi_8_64] "r" (cospi_8_64), [cospi_16_64] "r" (cospi_16_64),
- [cospi_24_64] "r" (cospi_24_64),
- [input] "r" (input)
- );
-
- input += 4;
- output += 1;
- }
-}
-
-static void vp9_idct4_columns_add_blk_dspr2(int16_t *input, uint8_t *dest,
- int dest_stride) {
- int16_t step_0, step_1, step_2, step_3;
- int Temp0, Temp1, Temp2, Temp3;
- const int const_2_power_13 = 8192;
- int i;
- uint8_t *dest_pix;
- uint8_t *cm = vp9_ff_cropTbl;
-
- /* prefetch vp9_ff_cropTbl */
- vp9_prefetch_load(vp9_ff_cropTbl);
- vp9_prefetch_load(vp9_ff_cropTbl + 32);
- vp9_prefetch_load(vp9_ff_cropTbl + 64);
- vp9_prefetch_load(vp9_ff_cropTbl + 96);
- vp9_prefetch_load(vp9_ff_cropTbl + 128);
- vp9_prefetch_load(vp9_ff_cropTbl + 160);
- vp9_prefetch_load(vp9_ff_cropTbl + 192);
- vp9_prefetch_load(vp9_ff_cropTbl + 224);
-
- for (i = 0; i < 4; ++i) {
- dest_pix = (dest + i);
-
- __asm__ __volatile__ (
- /*
- temp_1 = (input[0] + input[2]) * cospi_16_64;
- step_0 = dct_const_round_shift(temp_1);
-
- temp_2 = (input[0] - input[2]) * cospi_16_64;
- step_1 = dct_const_round_shift(temp_2);
- */
- "lh %[Temp0], 0(%[input]) \n\t"
- "lh %[Temp1], 4(%[input]) \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "add %[Temp2], %[Temp0], %[Temp1] \n\t"
- "sub %[Temp3], %[Temp0], %[Temp1] \n\t"
- "madd $ac0, %[Temp2], %[cospi_16_64] \n\t"
- "lh %[Temp0], 2(%[input]) \n\t"
- "lh %[Temp1], 6(%[input]) \n\t"
- "extp %[step_0], $ac0, 31 \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
-
- "madd $ac1, %[Temp3], %[cospi_16_64] \n\t"
- "extp %[step_1], $ac1, 31 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
-
- /*
- temp1 = input[1] * cospi_24_64 - input[3] * cospi_8_64;
- step_2 = dct_const_round_shift(temp1);
- */
- "madd $ac0, %[Temp0], %[cospi_24_64] \n\t"
- "msub $ac0, %[Temp1], %[cospi_8_64] \n\t"
- "extp %[step_2], $ac0, 31 \n\t"
-
- /*
- temp2 = input[1] * cospi_8_64 + input[3] * cospi_24_64;
- step_3 = dct_const_round_shift(temp2);
- */
- "madd $ac1, %[Temp0], %[cospi_8_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_24_64] \n\t"
- "extp %[step_3], $ac1, 31 \n\t"
-
- /*
- output[0] = step_0 + step_3;
- output[4] = step_1 + step_2;
- output[8] = step_1 - step_2;
- output[12] = step_0 - step_3;
- */
- "add %[Temp0], %[step_0], %[step_3] \n\t"
- "addi %[Temp0], %[Temp0], 8 \n\t"
- "sra %[Temp0], %[Temp0], 4 \n\t"
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "add %[Temp0], %[step_1], %[step_2] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "addi %[Temp0], %[Temp0], 8 \n\t"
- "sra %[Temp0], %[Temp0], 4 \n\t"
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "sub %[Temp0], %[step_1], %[step_2] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "addi %[Temp0], %[Temp0], 8 \n\t"
- "sra %[Temp0], %[Temp0], 4 \n\t"
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "sub %[Temp0], %[step_0], %[step_3] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "addi %[Temp0], %[Temp0], 8 \n\t"
- "sra %[Temp0], %[Temp0], 4 \n\t"
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
-
- : [Temp0] "=&r" (Temp0), [Temp1] "=&r" (Temp1),
- [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [step_0] "=&r" (step_0), [step_1] "=&r" (step_1),
- [step_2] "=&r" (step_2), [step_3] "=&r" (step_3),
- [dest_pix] "+r" (dest_pix)
- : [const_2_power_13] "r" (const_2_power_13),
- [cospi_8_64] "r" (cospi_8_64), [cospi_16_64] "r" (cospi_16_64),
- [cospi_24_64] "r" (cospi_24_64),
- [input] "r" (input), [cm] "r" (cm), [dest_stride] "r" (dest_stride)
- );
-
- input += 4;
- }
-}
-
-void vp9_idct4x4_16_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- DECLARE_ALIGNED(32, int16_t, out[4 * 4]);
- int16_t *outptr = out;
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- // Rows
- vp9_idct4_rows_dspr2(input, outptr);
-
- // Columns
- vp9_idct4_columns_add_blk_dspr2(&out[0], dest, dest_stride);
-}
-
-void vp9_idct4x4_1_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- int a1, absa1;
- int r;
- int32_t out;
- int t2, vector_a1, vector_a;
- uint32_t pos = 45;
- int16_t input_dc = input[0];
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
-
- :
- : [pos] "r" (pos)
- );
-
- out = DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input_dc);
- __asm__ __volatile__ (
- "addi %[out], %[out], 8 \n\t"
- "sra %[a1], %[out], 4 \n\t"
-
- : [out] "+r" (out), [a1] "=r" (a1)
- :
- );
-
- if (a1 < 0) {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "abs %[absa1], %[a1] \n\t"
- "replv.qb %[vector_a1], %[absa1] \n\t"
-
- : [absa1] "=r" (absa1), [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 4; r--;) {
- __asm__ __volatile__ (
- "lw %[t2], 0(%[dest]) \n\t"
- "subu_s.qb %[vector_a], %[t2], %[vector_a1] \n\t"
- "sw %[vector_a], 0(%[dest]) \n\t"
- "add %[dest], %[dest], %[dest_stride] \n\t"
-
- : [t2] "=&r" (t2), [vector_a] "=&r" (vector_a),
- [dest] "+&r" (dest)
- : [dest_stride] "r" (dest_stride), [vector_a1] "r" (vector_a1)
- );
- }
- } else {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "replv.qb %[vector_a1], %[a1] \n\t"
- : [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 4; r--;) {
- __asm__ __volatile__ (
- "lw %[t2], 0(%[dest]) \n\t"
- "addu_s.qb %[vector_a], %[t2], %[vector_a1] \n\t"
- "sw %[vector_a], 0(%[dest]) \n\t"
- "add %[dest], %[dest], %[dest_stride] \n\t"
-
- : [t2] "=&r" (t2), [vector_a] "=&r" (vector_a),
- [dest] "+&r" (dest)
- : [dest_stride] "r" (dest_stride), [vector_a1] "r" (vector_a1)
- );
- }
- }
-}
-
-static void iadst4_dspr2(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7;
- int x0, x1, x2, x3;
-
- x0 = input[0];
- x1 = input[1];
- x2 = input[2];
- x3 = input[3];
-
- if (!(x0 | x1 | x2 | x3)) {
- output[0] = output[1] = output[2] = output[3] = 0;
- 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 = x0 - x2 + x3;
-
- x0 = s0 + s3 + s5;
- x1 = s1 - s4 - s6;
- x2 = sinpi_3_9 * s7;
- x3 = s2;
-
- s0 = x0 + x3;
- s1 = x1 + x3;
- s2 = x2;
- s3 = x0 + x1 - x3;
-
- // 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] = dct_const_round_shift(s0);
- output[1] = dct_const_round_shift(s1);
- output[2] = dct_const_round_shift(s2);
- output[3] = dct_const_round_shift(s3);
-}
-
-void vp9_iht4x4_16_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride, int tx_type) {
- int i, j;
- DECLARE_ALIGNED(32, int16_t, out[4 * 4]);
- int16_t *outptr = out;
- int16_t temp_in[4 * 4], temp_out[4];
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- switch (tx_type) {
- case DCT_DCT: // DCT in both horizontal and vertical
- vp9_idct4_rows_dspr2(input, outptr);
- vp9_idct4_columns_add_blk_dspr2(&out[0], dest, dest_stride);
- break;
- case ADST_DCT: // ADST in vertical, DCT in horizontal
- vp9_idct4_rows_dspr2(input, outptr);
-
- outptr = out;
-
- for (i = 0; i < 4; ++i) {
- iadst4_dspr2(outptr, temp_out);
-
- for (j = 0; j < 4; ++j)
- dest[j * dest_stride + i] =
- clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 4)
- + dest[j * dest_stride + i]);
-
- outptr += 4;
- }
- break;
- case DCT_ADST: // DCT in vertical, ADST in horizontal
- for (i = 0; i < 4; ++i) {
- iadst4_dspr2(input, outptr);
- input += 4;
- outptr += 4;
- }
-
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j) {
- temp_in[i * 4 + j] = out[j * 4 + i];
- }
- }
- vp9_idct4_columns_add_blk_dspr2(&temp_in[0], dest, dest_stride);
- break;
- case ADST_ADST: // ADST in both directions
- for (i = 0; i < 4; ++i) {
- iadst4_dspr2(input, outptr);
- input += 4;
- outptr += 4;
- }
-
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- temp_in[j] = out[j * 4 + i];
- iadst4_dspr2(temp_in, temp_out);
-
- for (j = 0; j < 4; ++j)
- dest[j * dest_stride + i] =
- clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 4)
- + dest[j * dest_stride + i]);
- }
- break;
- default:
- printf("vp9_short_iht4x4_add_dspr2 : Invalid tx_type\n");
- break;
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c
deleted file mode 100644
index acccaea..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_itrans8_dspr2.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-
-#if HAVE_DSPR2
-static void idct8_rows_dspr2(const int16_t *input, int16_t *output,
- uint32_t no_rows) {
- int step1_0, step1_1, step1_2, step1_3, step1_4, step1_5, step1_6, step1_7;
- const int const_2_power_13 = 8192;
- int Temp0, Temp1, Temp2, Temp3, Temp4;
- int i;
-
- for (i = no_rows; i--; ) {
- __asm__ __volatile__ (
- /*
- temp_1 = (input[0] + input[4]) * cospi_16_64;
- step2_0 = dct_const_round_shift(temp_1);
-
- temp_2 = (input[0] - input[4]) * cospi_16_64;
- step2_1 = dct_const_round_shift(temp_2);
- */
- "lh %[Temp0], 0(%[input]) \n\t"
- "lh %[Temp1], 8(%[input]) \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "add %[Temp2], %[Temp0], %[Temp1] \n\t"
- "madd $ac0, %[Temp2], %[cospi_16_64] \n\t"
- "extp %[Temp4], $ac0, 31 \n\t"
-
- "sub %[Temp3], %[Temp0], %[Temp1] \n\t"
- "madd $ac1, %[Temp3], %[cospi_16_64] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- /*
- temp_1 = input[2] * cospi_24_64 - input[6] * cospi_8_64;
- step2_2 = dct_const_round_shift(temp_1);
- */
- "lh %[Temp0], 4(%[input]) \n\t"
- "lh %[Temp1], 12(%[input]) \n\t"
- "madd $ac0, %[Temp0], %[cospi_24_64] \n\t"
- "msub $ac0, %[Temp1], %[cospi_8_64] \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "extp %[Temp3], $ac0, 31 \n\t"
-
- /*
- step1_1 = step2_1 + step2_2;
- step1_2 = step2_1 - step2_2;
- */
- "add %[step1_1], %[Temp2], %[Temp3] \n\t"
- "sub %[step1_2], %[Temp2], %[Temp3] \n\t"
-
- /*
- temp_2 = input[2] * cospi_8_64 + input[6] * cospi_24_64;
- step2_3 = dct_const_round_shift(temp_2);
- */
- "madd $ac1, %[Temp0], %[cospi_8_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_24_64] \n\t"
- "extp %[Temp1], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
-
- /*
- step1_0 = step2_0 + step2_3;
- step1_3 = step2_0 - step2_3;
- */
- "add %[step1_0], %[Temp4], %[Temp1] \n\t"
- "sub %[step1_3], %[Temp4], %[Temp1] \n\t"
-
- /*
- temp_1 = input[1] * cospi_28_64 - input[7] * cospi_4_64;
- step1_4 = dct_const_round_shift(temp_1);
- */
- "lh %[Temp0], 2(%[input]) \n\t"
- "madd $ac0, %[Temp0], %[cospi_28_64] \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "lh %[Temp1], 14(%[input]) \n\t"
- "lh %[Temp0], 2(%[input]) \n\t"
- "msub $ac0, %[Temp1], %[cospi_4_64] \n\t"
- "extp %[step1_4], $ac0, 31 \n\t"
-
- /*
- temp_2 = input[1] * cospi_4_64 + input[7] * cospi_28_64;
- step1_7 = dct_const_round_shift(temp_2);
- */
- "madd $ac1, %[Temp0], %[cospi_4_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_28_64] \n\t"
- "extp %[step1_7], $ac1, 31 \n\t"
-
- /*
- temp_1 = input[5] * cospi_12_64 - input[3] * cospi_20_64;
- step1_5 = dct_const_round_shift(temp_1);
- */
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "lh %[Temp0], 10(%[input]) \n\t"
- "madd $ac0, %[Temp0], %[cospi_12_64] \n\t"
- "lh %[Temp1], 6(%[input]) \n\t"
- "msub $ac0, %[Temp1], %[cospi_20_64] \n\t"
- "extp %[step1_5], $ac0, 31 \n\t"
-
- /*
- temp_2 = input[5] * cospi_20_64 + input[3] * cospi_12_64;
- step1_6 = dct_const_round_shift(temp_2);
- */
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "lh %[Temp0], 10(%[input]) \n\t"
- "madd $ac1, %[Temp0], %[cospi_20_64] \n\t"
- "lh %[Temp1], 6(%[input]) \n\t"
- "madd $ac1, %[Temp1], %[cospi_12_64] \n\t"
- "extp %[step1_6], $ac1, 31 \n\t"
-
- /*
- temp_1 = (step1_7 - step1_6 - step1_4 + step1_5) * cospi_16_64;
- temp_2 = (step1_4 - step1_5 - step1_6 + step1_7) * cospi_16_64;
- */
- "sub %[Temp0], %[step1_7], %[step1_6] \n\t"
- "sub %[Temp0], %[Temp0], %[step1_4] \n\t"
- "add %[Temp0], %[Temp0], %[step1_5] \n\t"
- "sub %[Temp1], %[step1_4], %[step1_5] \n\t"
- "sub %[Temp1], %[Temp1], %[step1_6] \n\t"
- "add %[Temp1], %[Temp1], %[step1_7] \n\t"
-
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
-
- "madd $ac0, %[Temp0], %[cospi_16_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_16_64] \n\t"
-
- /*
- step1_4 = step1_4 + step1_5;
- step1_7 = step1_6 + step1_7;
- */
- "add %[step1_4], %[step1_4], %[step1_5] \n\t"
- "add %[step1_7], %[step1_7], %[step1_6] \n\t"
-
- "extp %[step1_5], $ac0, 31 \n\t"
- "extp %[step1_6], $ac1, 31 \n\t"
-
- "add %[Temp0], %[step1_0], %[step1_7] \n\t"
- "sh %[Temp0], 0(%[output]) \n\t"
- "add %[Temp1], %[step1_1], %[step1_6] \n\t"
- "sh %[Temp1], 16(%[output]) \n\t"
- "add %[Temp0], %[step1_2], %[step1_5] \n\t"
- "sh %[Temp0], 32(%[output]) \n\t"
- "add %[Temp1], %[step1_3], %[step1_4] \n\t"
- "sh %[Temp1], 48(%[output]) \n\t"
-
- "sub %[Temp0], %[step1_3], %[step1_4] \n\t"
- "sh %[Temp0], 64(%[output]) \n\t"
- "sub %[Temp1], %[step1_2], %[step1_5] \n\t"
- "sh %[Temp1], 80(%[output]) \n\t"
- "sub %[Temp0], %[step1_1], %[step1_6] \n\t"
- "sh %[Temp0], 96(%[output]) \n\t"
- "sub %[Temp1], %[step1_0], %[step1_7] \n\t"
- "sh %[Temp1], 112(%[output]) \n\t"
-
- : [step1_0] "=&r" (step1_0), [step1_1] "=&r" (step1_1),
- [step1_2] "=&r" (step1_2), [step1_3] "=&r" (step1_3),
- [step1_4] "=&r" (step1_4), [step1_5] "=&r" (step1_5),
- [step1_6] "=&r" (step1_6), [step1_7] "=&r" (step1_7),
- [Temp0] "=&r" (Temp0), [Temp1] "=&r" (Temp1),
- [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [Temp4] "=&r" (Temp4)
- : [const_2_power_13] "r" (const_2_power_13),
- [cospi_16_64] "r" (cospi_16_64), [cospi_28_64] "r" (cospi_28_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_12_64] "r" (cospi_12_64),
- [cospi_20_64] "r" (cospi_20_64), [cospi_8_64] "r" (cospi_8_64),
- [cospi_24_64] "r" (cospi_24_64),
- [output] "r" (output), [input] "r" (input)
- );
-
- input += 8;
- output += 1;
- }
-}
-
-static void idct8_columns_add_blk_dspr2(int16_t *input, uint8_t *dest,
- int dest_stride) {
- int step1_0, step1_1, step1_2, step1_3, step1_4, step1_5, step1_6, step1_7;
- int Temp0, Temp1, Temp2, Temp3;
- int i;
- const int const_2_power_13 = 8192;
- uint8_t *dest_pix;
- uint8_t *cm = vp9_ff_cropTbl;
-
- /* prefetch vp9_ff_cropTbl */
- vp9_prefetch_load(vp9_ff_cropTbl);
- vp9_prefetch_load(vp9_ff_cropTbl + 32);
- vp9_prefetch_load(vp9_ff_cropTbl + 64);
- vp9_prefetch_load(vp9_ff_cropTbl + 96);
- vp9_prefetch_load(vp9_ff_cropTbl + 128);
- vp9_prefetch_load(vp9_ff_cropTbl + 160);
- vp9_prefetch_load(vp9_ff_cropTbl + 192);
- vp9_prefetch_load(vp9_ff_cropTbl + 224);
-
- for (i = 0; i < 8; ++i) {
- dest_pix = (dest + i);
-
- __asm__ __volatile__ (
- /*
- temp_1 = (input[0] + input[4]) * cospi_16_64;
- step2_0 = dct_const_round_shift(temp_1);
-
- temp_2 = (input[0] - input[4]) * cospi_16_64;
- step2_1 = dct_const_round_shift(temp_2);
- */
- "lh %[Temp0], 0(%[input]) \n\t"
- "lh %[Temp1], 8(%[input]) \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "add %[Temp2], %[Temp0], %[Temp1] \n\t"
- "madd $ac0, %[Temp2], %[cospi_16_64] \n\t"
- "extp %[step1_6], $ac0, 31 \n\t"
-
- "sub %[Temp3], %[Temp0], %[Temp1] \n\t"
- "madd $ac1, %[Temp3], %[cospi_16_64] \n\t"
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "extp %[Temp2], $ac1, 31 \n\t"
-
- /*
- temp_1 = input[2] * cospi_24_64 - input[6] * cospi_8_64;
- step2_2 = dct_const_round_shift(temp_1);
- */
- "lh %[Temp0], 4(%[input]) \n\t"
- "lh %[Temp1], 12(%[input]) \n\t"
- "madd $ac0, %[Temp0], %[cospi_24_64] \n\t"
- "msub $ac0, %[Temp1], %[cospi_8_64] \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "extp %[Temp3], $ac0, 31 \n\t"
-
- /*
- step1_1 = step2_1 + step2_2;
- step1_2 = step2_1 - step2_2;
- */
- "add %[step1_1], %[Temp2], %[Temp3] \n\t"
- "sub %[step1_2], %[Temp2], %[Temp3] \n\t"
-
- /*
- temp_2 = input[2] * cospi_8_64 + input[6] * cospi_24_64;
- step2_3 = dct_const_round_shift(temp_2);
- */
- "madd $ac1, %[Temp0], %[cospi_8_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_24_64] \n\t"
- "extp %[Temp1], $ac1, 31 \n\t"
-
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
-
- /*
- step1_0 = step2_0 + step2_3;
- step1_3 = step2_0 - step2_3;
- */
- "add %[step1_0], %[step1_6], %[Temp1] \n\t"
- "sub %[step1_3], %[step1_6], %[Temp1] \n\t"
-
- /*
- temp_1 = input[1] * cospi_28_64 - input[7] * cospi_4_64;
- step1_4 = dct_const_round_shift(temp_1);
- */
- "lh %[Temp0], 2(%[input]) \n\t"
- "madd $ac0, %[Temp0], %[cospi_28_64] \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "lh %[Temp1], 14(%[input]) \n\t"
- "lh %[Temp0], 2(%[input]) \n\t"
- "msub $ac0, %[Temp1], %[cospi_4_64] \n\t"
- "extp %[step1_4], $ac0, 31 \n\t"
-
- /*
- temp_2 = input[1] * cospi_4_64 + input[7] * cospi_28_64;
- step1_7 = dct_const_round_shift(temp_2);
- */
- "madd $ac1, %[Temp0], %[cospi_4_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_28_64] \n\t"
- "extp %[step1_7], $ac1, 31 \n\t"
-
- /*
- temp_1 = input[5] * cospi_12_64 - input[3] * cospi_20_64;
- step1_5 = dct_const_round_shift(temp_1);
- */
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "lh %[Temp0], 10(%[input]) \n\t"
- "madd $ac0, %[Temp0], %[cospi_12_64] \n\t"
- "lh %[Temp1], 6(%[input]) \n\t"
- "msub $ac0, %[Temp1], %[cospi_20_64] \n\t"
- "extp %[step1_5], $ac0, 31 \n\t"
-
- /*
- temp_2 = input[5] * cospi_20_64 + input[3] * cospi_12_64;
- step1_6 = dct_const_round_shift(temp_2);
- */
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
- "lh %[Temp0], 10(%[input]) \n\t"
- "madd $ac1, %[Temp0], %[cospi_20_64] \n\t"
- "lh %[Temp1], 6(%[input]) \n\t"
- "madd $ac1, %[Temp1], %[cospi_12_64] \n\t"
- "extp %[step1_6], $ac1, 31 \n\t"
-
- /*
- temp_1 = (step1_7 - step1_6 - step1_4 + step1_5) * cospi_16_64;
- temp_2 = (step1_4 - step1_5 - step1_6 + step1_7) * cospi_16_64;
- */
- "sub %[Temp0], %[step1_7], %[step1_6] \n\t"
- "sub %[Temp0], %[Temp0], %[step1_4] \n\t"
- "add %[Temp0], %[Temp0], %[step1_5] \n\t"
- "sub %[Temp1], %[step1_4], %[step1_5] \n\t"
- "sub %[Temp1], %[Temp1], %[step1_6] \n\t"
- "add %[Temp1], %[Temp1], %[step1_7] \n\t"
-
- "mtlo %[const_2_power_13], $ac0 \n\t"
- "mthi $zero, $ac0 \n\t"
- "mtlo %[const_2_power_13], $ac1 \n\t"
- "mthi $zero, $ac1 \n\t"
-
- "madd $ac0, %[Temp0], %[cospi_16_64] \n\t"
- "madd $ac1, %[Temp1], %[cospi_16_64] \n\t"
-
- /*
- step1_4 = step1_4 + step1_5;
- step1_7 = step1_6 + step1_7;
- */
- "add %[step1_4], %[step1_4], %[step1_5] \n\t"
- "add %[step1_7], %[step1_7], %[step1_6] \n\t"
-
- "extp %[step1_5], $ac0, 31 \n\t"
- "extp %[step1_6], $ac1, 31 \n\t"
-
- /* add block */
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "add %[Temp0], %[step1_0], %[step1_7] \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "add %[Temp0], %[step1_1], %[step1_6] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "add %[Temp0], %[step1_2], %[step1_5] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "add %[Temp0], %[step1_3], %[step1_4] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "sub %[Temp0], %[step1_3], %[step1_4] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "sub %[Temp0], %[step1_2], %[step1_5] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "sub %[Temp0], %[step1_1], %[step1_6] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "sub %[Temp0], %[step1_0], %[step1_7] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
- "addu %[dest_pix], %[dest_pix], %[dest_stride] \n\t"
-
- "lbu %[Temp1], 0(%[dest_pix]) \n\t"
- "addi %[Temp0], %[Temp0], 16 \n\t"
- "sra %[Temp0], %[Temp0], 5 \n\t"
- "add %[Temp1], %[Temp1], %[Temp0] \n\t"
- "lbux %[Temp2], %[Temp1](%[cm]) \n\t"
- "sb %[Temp2], 0(%[dest_pix]) \n\t"
-
- : [step1_0] "=&r" (step1_0), [step1_1] "=&r" (step1_1),
- [step1_2] "=&r" (step1_2), [step1_3] "=&r" (step1_3),
- [step1_4] "=&r" (step1_4), [step1_5] "=&r" (step1_5),
- [step1_6] "=&r" (step1_6), [step1_7] "=&r" (step1_7),
- [Temp0] "=&r" (Temp0), [Temp1] "=&r" (Temp1),
- [Temp2] "=&r" (Temp2), [Temp3] "=&r" (Temp3),
- [dest_pix] "+r" (dest_pix)
- : [const_2_power_13] "r" (const_2_power_13),
- [cospi_16_64] "r" (cospi_16_64), [cospi_28_64] "r" (cospi_28_64),
- [cospi_4_64] "r" (cospi_4_64), [cospi_12_64] "r" (cospi_12_64),
- [cospi_20_64] "r" (cospi_20_64), [cospi_8_64] "r" (cospi_8_64),
- [cospi_24_64] "r" (cospi_24_64),
- [input] "r" (input), [cm] "r" (cm), [dest_stride] "r" (dest_stride)
- );
-
- input += 8;
- }
-}
-
-void vp9_idct8x8_64_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- DECLARE_ALIGNED(32, int16_t, out[8 * 8]);
- int16_t *outptr = out;
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- // First transform rows
- idct8_rows_dspr2(input, outptr, 8);
-
- // Then transform columns and add to dest
- idct8_columns_add_blk_dspr2(&out[0], dest, dest_stride);
-}
-
-static void iadst8_dspr2(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7;
- int x0, x1, x2, x3, x4, x5, x6, x7;
-
- x0 = input[7];
- x1 = input[0];
- x2 = input[5];
- x3 = input[2];
- x4 = input[3];
- x5 = input[4];
- x6 = input[1];
- x7 = input[6];
-
- if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7)) {
- output[0] = output[1] = output[2] = output[3] = output[4]
- = output[5] = output[6] = output[7] = 0;
- 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 = ROUND_POWER_OF_TWO((s0 + s4), DCT_CONST_BITS);
- x1 = ROUND_POWER_OF_TWO((s1 + s5), DCT_CONST_BITS);
- x2 = ROUND_POWER_OF_TWO((s2 + s6), DCT_CONST_BITS);
- x3 = ROUND_POWER_OF_TWO((s3 + s7), DCT_CONST_BITS);
- x4 = ROUND_POWER_OF_TWO((s0 - s4), DCT_CONST_BITS);
- x5 = ROUND_POWER_OF_TWO((s1 - s5), DCT_CONST_BITS);
- x6 = ROUND_POWER_OF_TWO((s2 - s6), DCT_CONST_BITS);
- x7 = ROUND_POWER_OF_TWO((s3 - s7), DCT_CONST_BITS);
-
- // 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 = s0 + s2;
- x1 = s1 + s3;
- x2 = s0 - s2;
- x3 = s1 - s3;
- x4 = ROUND_POWER_OF_TWO((s4 + s6), DCT_CONST_BITS);
- x5 = ROUND_POWER_OF_TWO((s5 + s7), DCT_CONST_BITS);
- x6 = ROUND_POWER_OF_TWO((s4 - s6), DCT_CONST_BITS);
- x7 = ROUND_POWER_OF_TWO((s5 - s7), DCT_CONST_BITS);
-
- // 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 = ROUND_POWER_OF_TWO((s2), DCT_CONST_BITS);
- x3 = ROUND_POWER_OF_TWO((s3), DCT_CONST_BITS);
- x6 = ROUND_POWER_OF_TWO((s6), DCT_CONST_BITS);
- x7 = ROUND_POWER_OF_TWO((s7), DCT_CONST_BITS);
-
- output[0] = x0;
- output[1] = -x4;
- output[2] = x6;
- output[3] = -x2;
- output[4] = x3;
- output[5] = -x7;
- output[6] = x5;
- output[7] = -x1;
-}
-
-void vp9_iht8x8_64_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride, int tx_type) {
- int i, j;
- DECLARE_ALIGNED(32, int16_t, out[8 * 8]);
- int16_t *outptr = out;
- int16_t temp_in[8 * 8], temp_out[8];
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- switch (tx_type) {
- case DCT_DCT: // DCT in both horizontal and vertical
- idct8_rows_dspr2(input, outptr, 8);
- idct8_columns_add_blk_dspr2(&out[0], dest, dest_stride);
- break;
- case ADST_DCT: // ADST in vertical, DCT in horizontal
- idct8_rows_dspr2(input, outptr, 8);
-
- for (i = 0; i < 8; ++i) {
- iadst8_dspr2(&out[i * 8], temp_out);
-
- for (j = 0; j < 8; ++j)
- dest[j * dest_stride + i] =
- clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
- + dest[j * dest_stride + i]);
- }
- break;
- case DCT_ADST: // DCT in vertical, ADST in horizontal
- for (i = 0; i < 8; ++i) {
- iadst8_dspr2(input, outptr);
- input += 8;
- outptr += 8;
- }
-
- for (i = 0; i < 8; ++i) {
- for (j = 0; j < 8; ++j) {
- temp_in[i * 8 + j] = out[j * 8 + i];
- }
- }
- idct8_columns_add_blk_dspr2(&temp_in[0], dest, dest_stride);
- break;
- case ADST_ADST: // ADST in both directions
- for (i = 0; i < 8; ++i) {
- iadst8_dspr2(input, outptr);
- input += 8;
- outptr += 8;
- }
-
- for (i = 0; i < 8; ++i) {
- for (j = 0; j < 8; ++j)
- temp_in[j] = out[j * 8 + i];
-
- iadst8_dspr2(temp_in, temp_out);
-
- for (j = 0; j < 8; ++j)
- dest[j * dest_stride + i] =
- clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
- + dest[j * dest_stride + i]);
- }
- break;
- default:
- printf("vp9_short_iht8x8_add_dspr2 : Invalid tx_type\n");
- break;
- }
-}
-
-void vp9_idct8x8_10_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- DECLARE_ALIGNED(32, int16_t, out[8 * 8]);
- int16_t *outptr = out;
- uint32_t pos = 45;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
- :
- : [pos] "r" (pos)
- );
-
- // First transform rows
- idct8_rows_dspr2(input, outptr, 4);
-
- outptr += 4;
-
- __asm__ __volatile__ (
- "sw $zero, 0(%[outptr]) \n\t"
- "sw $zero, 4(%[outptr]) \n\t"
- "sw $zero, 16(%[outptr]) \n\t"
- "sw $zero, 20(%[outptr]) \n\t"
- "sw $zero, 32(%[outptr]) \n\t"
- "sw $zero, 36(%[outptr]) \n\t"
- "sw $zero, 48(%[outptr]) \n\t"
- "sw $zero, 52(%[outptr]) \n\t"
- "sw $zero, 64(%[outptr]) \n\t"
- "sw $zero, 68(%[outptr]) \n\t"
- "sw $zero, 80(%[outptr]) \n\t"
- "sw $zero, 84(%[outptr]) \n\t"
- "sw $zero, 96(%[outptr]) \n\t"
- "sw $zero, 100(%[outptr]) \n\t"
- "sw $zero, 112(%[outptr]) \n\t"
- "sw $zero, 116(%[outptr]) \n\t"
-
- :
- : [outptr] "r" (outptr)
- );
-
-
- // Then transform columns and add to dest
- idct8_columns_add_blk_dspr2(&out[0], dest, dest_stride);
-}
-
-void vp9_idct8x8_1_add_dspr2(const int16_t *input, uint8_t *dest,
- int dest_stride) {
- uint32_t pos = 45;
- int32_t out;
- int32_t r;
- int32_t a1, absa1;
- int32_t t1, t2, vector_a1, vector_1, vector_2;
-
- /* bit positon for extract from acc */
- __asm__ __volatile__ (
- "wrdsp %[pos], 1 \n\t"
-
- :
- : [pos] "r" (pos)
- );
-
- out = DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input[0]);
- __asm__ __volatile__ (
- "addi %[out], %[out], 16 \n\t"
- "sra %[a1], %[out], 5 \n\t"
-
- : [out] "+r" (out), [a1] "=r" (a1)
- :
- );
-
- if (a1 < 0) {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "abs %[absa1], %[a1] \n\t"
- "replv.qb %[vector_a1], %[absa1] \n\t"
-
- : [absa1] "=r" (absa1), [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 8; r--;) {
- __asm__ __volatile__ (
- "lw %[t1], 0(%[dest]) \n\t"
- "lw %[t2], 4(%[dest]) \n\t"
- "subu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "subu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "sw %[vector_1], 0(%[dest]) \n\t"
- "sw %[vector_2], 4(%[dest]) \n\t"
- "add %[dest], %[dest], %[dest_stride] \n\t"
-
- : [t1] "=&r" (t1), [t2] "=&r" (t2),
- [vector_1] "=&r" (vector_1), [vector_2] "=&r" (vector_2),
- [dest] "+&r" (dest)
- : [dest_stride] "r" (dest_stride), [vector_a1] "r" (vector_a1)
- );
- }
- } else {
- /* use quad-byte
- * input and output memory are four byte aligned */
- __asm__ __volatile__ (
- "replv.qb %[vector_a1], %[a1] \n\t"
-
- : [vector_a1] "=r" (vector_a1)
- : [a1] "r" (a1)
- );
-
- for (r = 8; r--;) {
- __asm__ __volatile__ (
- "lw %[t1], 0(%[dest]) \n\t"
- "lw %[t2], 4(%[dest]) \n\t"
- "addu_s.qb %[vector_1], %[t1], %[vector_a1] \n\t"
- "addu_s.qb %[vector_2], %[t2], %[vector_a1] \n\t"
- "sw %[vector_1], 0(%[dest]) \n\t"
- "sw %[vector_2], 4(%[dest]) \n\t"
- "add %[dest], %[dest], %[dest_stride] \n\t"
-
- : [t1] "=&r" (t1), [t2] "=&r" (t2),
- [vector_1] "=&r" (vector_1), [vector_2] "=&r" (vector_2),
- [dest] "+r" (dest)
- : [dest_stride] "r" (dest_stride), [vector_a1] "r" (vector_a1)
- );
- }
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.c
deleted file mode 100644
index 3df7f4c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_lpf_horizontal_4_dspr2(unsigned char *s,
- int pitch,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh,
- int count) {
- uint8_t i;
- uint32_t mask;
- uint32_t hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- uint8_t *sm1, *s0, *s1, *s2, *s3, *s4, *s5, *s6;
- uint32_t thresh_vec, flimit_vec, limit_vec;
- uint32_t uflimit, ulimit, uthresh;
-
- uflimit = *blimit;
- ulimit = *limit;
- uthresh = *thresh;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[uthresh] \n\t"
- "replv.qb %[flimit_vec], %[uflimit] \n\t"
- "replv.qb %[limit_vec], %[ulimit] \n\t"
-
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec),
- [limit_vec] "=r" (limit_vec)
- : [uthresh] "r" (uthresh), [uflimit] "r" (uflimit), [ulimit] "r" (ulimit)
- );
-
- /* prefetch data for store */
- vp9_prefetch_store(s);
-
- /* loop filter designed to work using chars so that we can make maximum use
- of 8 bit simd instructions. */
- for (i = 0; i < 2; i++) {
- sm1 = s - (pitch << 2);
- s0 = sm1 + pitch;
- s1 = s0 + pitch;
- s2 = s - pitch;
- s3 = s;
- s4 = s + pitch;
- s5 = s4 + pitch;
- s6 = s5 + pitch;
-
- __asm__ __volatile__ (
- "lw %[p1], (%[s1]) \n\t"
- "lw %[p2], (%[s2]) \n\t"
- "lw %[p3], (%[s3]) \n\t"
- "lw %[p4], (%[s4]) \n\t"
-
- : [p1] "=&r" (p1), [p2] "=&r" (p2), [p3] "=&r" (p3), [p4] "=&r" (p4)
- : [s1] "r" (s1), [s2] "r" (s2), [s3] "r" (s3), [s4] "r" (s4)
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- mask will be zero and filtering is not needed */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0))) {
- __asm__ __volatile__ (
- "lw %[pm1], (%[sm1]) \n\t"
- "lw %[p0], (%[s0]) \n\t"
- "lw %[p5], (%[s5]) \n\t"
- "lw %[p6], (%[s6]) \n\t"
-
- : [pm1] "=&r" (pm1), [p0] "=&r" (p0), [p5] "=&r" (p5),
- [p6] "=&r" (p6)
- : [sm1] "r" (sm1), [s0] "r" (s0), [s5] "r" (s5), [s6] "r" (s6)
- );
-
- vp9_filter_hev_mask_dspr2(limit_vec, flimit_vec, p1, p2,
- pm1, p0, p3, p4, p5, p6,
- thresh_vec, &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask) {
- /* filtering */
- vp9_filter_dspr2(mask, hev, &p1, &p2, &p3, &p4);
-
- __asm__ __volatile__ (
- "sw %[p1], (%[s1]) \n\t"
- "sw %[p2], (%[s2]) \n\t"
- "sw %[p3], (%[s3]) \n\t"
- "sw %[p4], (%[s4]) \n\t"
-
- :
- : [p1] "r" (p1), [p2] "r" (p2), [p3] "r" (p3), [p4] "r" (p4),
- [s1] "r" (s1), [s2] "r" (s2), [s3] "r" (s3), [s4] "r" (s4)
- );
- }
- }
-
- s = s + 4;
- }
-}
-
-void vp9_lpf_vertical_4_dspr2(unsigned char *s,
- int pitch,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh,
- int count) {
- uint8_t i;
- uint32_t mask, hev;
- uint32_t pm1, p0, p1, p2, p3, p4, p5, p6;
- uint8_t *s1, *s2, *s3, *s4;
- uint32_t prim1, prim2, sec3, sec4, prim3, prim4;
- uint32_t thresh_vec, flimit_vec, limit_vec;
- uint32_t uflimit, ulimit, uthresh;
-
- uflimit = *blimit;
- ulimit = *limit;
- uthresh = *thresh;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[uthresh] \n\t"
- "replv.qb %[flimit_vec], %[uflimit] \n\t"
- "replv.qb %[limit_vec], %[ulimit] \n\t"
-
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec),
- [limit_vec] "=r" (limit_vec)
- : [uthresh] "r" (uthresh), [uflimit] "r" (uflimit), [ulimit] "r" (ulimit)
- );
-
- /* prefetch data for store */
- vp9_prefetch_store(s + pitch);
-
- for (i = 0; i < 2; i++) {
- s1 = s;
- s2 = s + pitch;
- s3 = s2 + pitch;
- s4 = s3 + pitch;
- s = s4 + pitch;
-
- /* load quad-byte vectors
- * memory is 4 byte aligned
- */
- p2 = *((uint32_t *)(s1 - 4));
- p6 = *((uint32_t *)(s1));
- p1 = *((uint32_t *)(s2 - 4));
- p5 = *((uint32_t *)(s2));
- p0 = *((uint32_t *)(s3 - 4));
- p4 = *((uint32_t *)(s3));
- pm1 = *((uint32_t *)(s4 - 4));
- p3 = *((uint32_t *)(s4));
-
- /* transpose pm1, p0, p1, p2 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p2], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p2], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p0], %[pm1] \n\t"
- "precr.qb.ph %[prim4], %[p0], %[pm1] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[pm1], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p2], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p0], %[pm1], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[pm1], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0), [pm1] "+r" (pm1),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p3, p4, p5, p6 */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p6], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p6], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p4], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p4], %[p3] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p6], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p4], %[p3], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p6] "+r" (p6), [p5] "+r" (p5), [p4] "+r" (p4), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* if (p1 - p4 == 0) and (p2 - p3 == 0)
- * mask will be zero and filtering is not needed
- */
- if (!(((p1 - p4) == 0) && ((p2 - p3) == 0))) {
- vp9_filter_hev_mask_dspr2(limit_vec, flimit_vec, p1, p2, pm1,
- p0, p3, p4, p5, p6, thresh_vec,
- &hev, &mask);
-
- /* if mask == 0 do filtering is not needed */
- if (mask) {
- /* filtering */
- vp9_filter_dspr2(mask, hev, &p1, &p2, &p3, &p4);
-
- /* unpack processed 4x4 neighborhood
- * don't use transpose on output data
- * because memory isn't aligned
- */
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s4]) \n\t"
- "sb %[p3], 0(%[s4]) \n\t"
- "sb %[p2], -1(%[s4]) \n\t"
- "sb %[p1], -2(%[s4]) \n\t"
-
- :
- : [p4] "r" (p4), [p3] "r" (p3), [p2] "r" (p2), [p1] "r" (p1),
- [s4] "r" (s4)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
-
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s3]) \n\t"
- "sb %[p3], 0(%[s3]) \n\t"
- "sb %[p2], -1(%[s3]) \n\t"
- "sb %[p1], -2(%[s3]) \n\t"
-
- : [p1] "+r" (p1)
- : [p4] "r" (p4), [p3] "r" (p3), [p2] "r" (p2), [s3] "r" (s3)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
-
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s2]) \n\t"
- "sb %[p3], 0(%[s2]) \n\t"
- "sb %[p2], -1(%[s2]) \n\t"
- "sb %[p1], -2(%[s2]) \n\t"
-
- :
- : [p4] "r" (p4), [p3] "r" (p3), [p2] "r" (p2), [p1] "r" (p1),
- [s2] "r" (s2)
- );
-
- __asm__ __volatile__ (
- "srl %[p4], %[p4], 8 \n\t"
- "srl %[p3], %[p3], 8 \n\t"
- "srl %[p2], %[p2], 8 \n\t"
- "srl %[p1], %[p1], 8 \n\t"
-
- : [p4] "+r" (p4), [p3] "+r" (p3), [p2] "+r" (p2), [p1] "+r" (p1)
- :
- );
-
- __asm__ __volatile__ (
- "sb %[p4], 1(%[s1]) \n\t"
- "sb %[p3], 0(%[s1]) \n\t"
- "sb %[p2], -1(%[s1]) \n\t"
- "sb %[p1], -2(%[s1]) \n\t"
-
- :
- : [p4] "r" (p4), [p3] "r" (p3), [p2] "r" (p2), [p1] "r" (p1),
- [s1] "r" (s1)
- );
- }
- }
- }
-}
-
-void vp9_lpf_horizontal_4_dual_dspr2(uint8_t *s, int p /* pitch */,
- const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_horizontal_4_dspr2(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_horizontal_4_dspr2(s + 8, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_horizontal_8_dual_dspr2(uint8_t *s, int p /* pitch */,
- const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_horizontal_8_dspr2(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_horizontal_8_dspr2(s + 8, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_vertical_4_dual_dspr2(uint8_t *s, int p,
- const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_vertical_4_dspr2(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_vertical_4_dspr2(s + 8 * p, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_vertical_8_dual_dspr2(uint8_t *s, int p,
- const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_vertical_8_dspr2(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_vertical_8_dspr2(s + 8 * p, p, blimit1, limit1, thresh1,
- 1);
-}
-
-void vp9_lpf_vertical_16_dual_dspr2(uint8_t *s, int p,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh) {
- vp9_lpf_vertical_16_dspr2(s, p, blimit, limit, thresh);
- vp9_lpf_vertical_16_dspr2(s + 8 * p, p, blimit, limit, thresh);
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h
deleted file mode 100644
index 008cf8c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_FILTERS_DSPR2_H_
-#define VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_FILTERS_DSPR2_H_
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if HAVE_DSPR2
-/* inputs & outputs are quad-byte vectors */
-static INLINE void vp9_filter_dspr2(uint32_t mask, uint32_t hev,
- uint32_t *ps1, uint32_t *ps0,
- uint32_t *qs0, uint32_t *qs1) {
- int32_t vp9_filter_l, vp9_filter_r;
- int32_t Filter1_l, Filter1_r, Filter2_l, Filter2_r;
- int32_t subr_r, subr_l;
- uint32_t t1, t2, HWM, t3;
- uint32_t hev_l, hev_r, mask_l, mask_r, invhev_l, invhev_r;
- int32_t vps1, vps0, vqs0, vqs1;
- int32_t vps1_l, vps1_r, vps0_l, vps0_r, vqs0_l, vqs0_r, vqs1_l, vqs1_r;
- uint32_t N128;
-
- N128 = 0x80808080;
- t1 = 0x03000300;
- t2 = 0x04000400;
- t3 = 0x01000100;
- HWM = 0xFF00FF00;
-
- vps0 = (*ps0) ^ N128;
- vps1 = (*ps1) ^ N128;
- vqs0 = (*qs0) ^ N128;
- vqs1 = (*qs1) ^ N128;
-
- /* use halfword pairs instead quad-bytes because of accuracy */
- vps0_l = vps0 & HWM;
- vps0_r = vps0 << 8;
- vps0_r = vps0_r & HWM;
-
- vps1_l = vps1 & HWM;
- vps1_r = vps1 << 8;
- vps1_r = vps1_r & HWM;
-
- vqs0_l = vqs0 & HWM;
- vqs0_r = vqs0 << 8;
- vqs0_r = vqs0_r & HWM;
-
- vqs1_l = vqs1 & HWM;
- vqs1_r = vqs1 << 8;
- vqs1_r = vqs1_r & HWM;
-
- mask_l = mask & HWM;
- mask_r = mask << 8;
- mask_r = mask_r & HWM;
-
- hev_l = hev & HWM;
- hev_r = hev << 8;
- hev_r = hev_r & HWM;
-
- __asm__ __volatile__ (
- /* vp9_filter = vp8_signed_char_clamp(ps1 - qs1); */
- "subq_s.ph %[vp9_filter_l], %[vps1_l], %[vqs1_l] \n\t"
- "subq_s.ph %[vp9_filter_r], %[vps1_r], %[vqs1_r] \n\t"
-
- /* qs0 - ps0 */
- "subq_s.ph %[subr_l], %[vqs0_l], %[vps0_l] \n\t"
- "subq_s.ph %[subr_r], %[vqs0_r], %[vps0_r] \n\t"
-
- /* vp9_filter &= hev; */
- "and %[vp9_filter_l], %[vp9_filter_l], %[hev_l] \n\t"
- "and %[vp9_filter_r], %[vp9_filter_r], %[hev_r] \n\t"
-
- /* vp9_filter = vp8_signed_char_clamp(vp9_filter + 3 * (qs0 - ps0)); */
- "addq_s.ph %[vp9_filter_l], %[vp9_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp9_filter_r], %[vp9_filter_r], %[subr_r] \n\t"
- "xor %[invhev_l], %[hev_l], %[HWM] \n\t"
- "addq_s.ph %[vp9_filter_l], %[vp9_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp9_filter_r], %[vp9_filter_r], %[subr_r] \n\t"
- "xor %[invhev_r], %[hev_r], %[HWM] \n\t"
- "addq_s.ph %[vp9_filter_l], %[vp9_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp9_filter_r], %[vp9_filter_r], %[subr_r] \n\t"
-
- /* vp9_filter &= mask; */
- "and %[vp9_filter_l], %[vp9_filter_l], %[mask_l] \n\t"
- "and %[vp9_filter_r], %[vp9_filter_r], %[mask_r] \n\t"
-
- : [vp9_filter_l] "=&r" (vp9_filter_l),
- [vp9_filter_r] "=&r" (vp9_filter_r),
- [subr_l] "=&r" (subr_l), [subr_r] "=&r" (subr_r),
- [invhev_l] "=&r" (invhev_l), [invhev_r] "=&r" (invhev_r)
- : [vps0_l] "r" (vps0_l), [vps0_r] "r" (vps0_r), [vps1_l] "r" (vps1_l),
- [vps1_r] "r" (vps1_r), [vqs0_l] "r" (vqs0_l), [vqs0_r] "r" (vqs0_r),
- [vqs1_l] "r" (vqs1_l), [vqs1_r] "r" (vqs1_r),
- [mask_l] "r" (mask_l), [mask_r] "r" (mask_r),
- [hev_l] "r" (hev_l), [hev_r] "r" (hev_r),
- [HWM] "r" (HWM)
- );
-
- /* save bottom 3 bits so that we round one side +4 and the other +3 */
- __asm__ __volatile__ (
- /* Filter2 = vp8_signed_char_clamp(vp9_filter + 3) >>= 3; */
- "addq_s.ph %[Filter1_l], %[vp9_filter_l], %[t2] \n\t"
- "addq_s.ph %[Filter1_r], %[vp9_filter_r], %[t2] \n\t"
-
- /* Filter1 = vp8_signed_char_clamp(vp9_filter + 4) >>= 3; */
- "addq_s.ph %[Filter2_l], %[vp9_filter_l], %[t1] \n\t"
- "addq_s.ph %[Filter2_r], %[vp9_filter_r], %[t1] \n\t"
- "shra.ph %[Filter1_r], %[Filter1_r], 3 \n\t"
- "shra.ph %[Filter1_l], %[Filter1_l], 3 \n\t"
-
- "shra.ph %[Filter2_l], %[Filter2_l], 3 \n\t"
- "shra.ph %[Filter2_r], %[Filter2_r], 3 \n\t"
-
- "and %[Filter1_l], %[Filter1_l], %[HWM] \n\t"
- "and %[Filter1_r], %[Filter1_r], %[HWM] \n\t"
-
- /* vps0 = vp8_signed_char_clamp(ps0 + Filter2); */
- "addq_s.ph %[vps0_l], %[vps0_l], %[Filter2_l] \n\t"
- "addq_s.ph %[vps0_r], %[vps0_r], %[Filter2_r] \n\t"
-
- /* vqs0 = vp8_signed_char_clamp(qs0 - Filter1); */
- "subq_s.ph %[vqs0_l], %[vqs0_l], %[Filter1_l] \n\t"
- "subq_s.ph %[vqs0_r], %[vqs0_r], %[Filter1_r] \n\t"
-
- : [Filter1_l] "=&r" (Filter1_l), [Filter1_r] "=&r" (Filter1_r),
- [Filter2_l] "=&r" (Filter2_l), [Filter2_r] "=&r" (Filter2_r),
- [vps0_l] "+r" (vps0_l), [vps0_r] "+r" (vps0_r),
- [vqs0_l] "+r" (vqs0_l), [vqs0_r] "+r" (vqs0_r)
- : [t1] "r" (t1), [t2] "r" (t2), [HWM] "r" (HWM),
- [vp9_filter_l] "r" (vp9_filter_l), [vp9_filter_r] "r" (vp9_filter_r)
- );
-
- __asm__ __volatile__ (
- /* (vp9_filter += 1) >>= 1 */
- "addqh.ph %[Filter1_l], %[Filter1_l], %[t3] \n\t"
- "addqh.ph %[Filter1_r], %[Filter1_r], %[t3] \n\t"
-
- /* vp9_filter &= ~hev; */
- "and %[Filter1_l], %[Filter1_l], %[invhev_l] \n\t"
- "and %[Filter1_r], %[Filter1_r], %[invhev_r] \n\t"
-
- /* vps1 = vp8_signed_char_clamp(ps1 + vp9_filter); */
- "addq_s.ph %[vps1_l], %[vps1_l], %[Filter1_l] \n\t"
- "addq_s.ph %[vps1_r], %[vps1_r], %[Filter1_r] \n\t"
-
- /* vqs1 = vp8_signed_char_clamp(qs1 - vp9_filter); */
- "subq_s.ph %[vqs1_l], %[vqs1_l], %[Filter1_l] \n\t"
- "subq_s.ph %[vqs1_r], %[vqs1_r], %[Filter1_r] \n\t"
-
- : [Filter1_l] "+r" (Filter1_l), [Filter1_r] "+r" (Filter1_r),
- [vps1_l] "+r" (vps1_l), [vps1_r] "+r" (vps1_r),
- [vqs1_l] "+r" (vqs1_l), [vqs1_r] "+r" (vqs1_r)
- : [t3] "r" (t3), [invhev_l] "r" (invhev_l), [invhev_r] "r" (invhev_r)
- );
-
- /* Create quad-bytes from halfword pairs */
- vqs0_l = vqs0_l & HWM;
- vqs1_l = vqs1_l & HWM;
- vps0_l = vps0_l & HWM;
- vps1_l = vps1_l & HWM;
-
- __asm__ __volatile__ (
- "shrl.ph %[vqs0_r], %[vqs0_r], 8 \n\t"
- "shrl.ph %[vps0_r], %[vps0_r], 8 \n\t"
- "shrl.ph %[vqs1_r], %[vqs1_r], 8 \n\t"
- "shrl.ph %[vps1_r], %[vps1_r], 8 \n\t"
-
- : [vps1_r] "+r" (vps1_r), [vqs1_r] "+r" (vqs1_r),
- [vps0_r] "+r" (vps0_r), [vqs0_r] "+r" (vqs0_r)
- :
- );
-
- vqs0 = vqs0_l | vqs0_r;
- vqs1 = vqs1_l | vqs1_r;
- vps0 = vps0_l | vps0_r;
- vps1 = vps1_l | vps1_r;
-
- *ps0 = vps0 ^ N128;
- *ps1 = vps1 ^ N128;
- *qs0 = vqs0 ^ N128;
- *qs1 = vqs1 ^ N128;
-}
-
-static INLINE void vp9_filter1_dspr2(uint32_t mask, uint32_t hev,
- uint32_t ps1, uint32_t ps0,
- uint32_t qs0, uint32_t qs1,
- uint32_t *p1_f0, uint32_t *p0_f0,
- uint32_t *q0_f0, uint32_t *q1_f0) {
- int32_t vp9_filter_l, vp9_filter_r;
- int32_t Filter1_l, Filter1_r, Filter2_l, Filter2_r;
- int32_t subr_r, subr_l;
- uint32_t t1, t2, HWM, t3;
- uint32_t hev_l, hev_r, mask_l, mask_r, invhev_l, invhev_r;
- int32_t vps1, vps0, vqs0, vqs1;
- int32_t vps1_l, vps1_r, vps0_l, vps0_r, vqs0_l, vqs0_r, vqs1_l, vqs1_r;
- uint32_t N128;
-
- N128 = 0x80808080;
- t1 = 0x03000300;
- t2 = 0x04000400;
- t3 = 0x01000100;
- HWM = 0xFF00FF00;
-
- vps0 = (ps0) ^ N128;
- vps1 = (ps1) ^ N128;
- vqs0 = (qs0) ^ N128;
- vqs1 = (qs1) ^ N128;
-
- /* use halfword pairs instead quad-bytes because of accuracy */
- vps0_l = vps0 & HWM;
- vps0_r = vps0 << 8;
- vps0_r = vps0_r & HWM;
-
- vps1_l = vps1 & HWM;
- vps1_r = vps1 << 8;
- vps1_r = vps1_r & HWM;
-
- vqs0_l = vqs0 & HWM;
- vqs0_r = vqs0 << 8;
- vqs0_r = vqs0_r & HWM;
-
- vqs1_l = vqs1 & HWM;
- vqs1_r = vqs1 << 8;
- vqs1_r = vqs1_r & HWM;
-
- mask_l = mask & HWM;
- mask_r = mask << 8;
- mask_r = mask_r & HWM;
-
- hev_l = hev & HWM;
- hev_r = hev << 8;
- hev_r = hev_r & HWM;
-
- __asm__ __volatile__ (
- /* vp9_filter = vp8_signed_char_clamp(ps1 - qs1); */
- "subq_s.ph %[vp9_filter_l], %[vps1_l], %[vqs1_l] \n\t"
- "subq_s.ph %[vp9_filter_r], %[vps1_r], %[vqs1_r] \n\t"
-
- /* qs0 - ps0 */
- "subq_s.ph %[subr_l], %[vqs0_l], %[vps0_l] \n\t"
- "subq_s.ph %[subr_r], %[vqs0_r], %[vps0_r] \n\t"
-
- /* vp9_filter &= hev; */
- "and %[vp9_filter_l], %[vp9_filter_l], %[hev_l] \n\t"
- "and %[vp9_filter_r], %[vp9_filter_r], %[hev_r] \n\t"
-
- /* vp9_filter = vp8_signed_char_clamp(vp9_filter + 3 * (qs0 - ps0)); */
- "addq_s.ph %[vp9_filter_l], %[vp9_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp9_filter_r], %[vp9_filter_r], %[subr_r] \n\t"
- "xor %[invhev_l], %[hev_l], %[HWM] \n\t"
- "addq_s.ph %[vp9_filter_l], %[vp9_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp9_filter_r], %[vp9_filter_r], %[subr_r] \n\t"
- "xor %[invhev_r], %[hev_r], %[HWM] \n\t"
- "addq_s.ph %[vp9_filter_l], %[vp9_filter_l], %[subr_l] \n\t"
- "addq_s.ph %[vp9_filter_r], %[vp9_filter_r], %[subr_r] \n\t"
-
- /* vp9_filter &= mask; */
- "and %[vp9_filter_l], %[vp9_filter_l], %[mask_l] \n\t"
- "and %[vp9_filter_r], %[vp9_filter_r], %[mask_r] \n\t"
-
- : [vp9_filter_l] "=&r" (vp9_filter_l),
- [vp9_filter_r] "=&r" (vp9_filter_r),
- [subr_l] "=&r" (subr_l), [subr_r] "=&r" (subr_r),
- [invhev_l] "=&r" (invhev_l), [invhev_r] "=&r" (invhev_r)
- : [vps0_l] "r" (vps0_l), [vps0_r] "r" (vps0_r), [vps1_l] "r" (vps1_l),
- [vps1_r] "r" (vps1_r), [vqs0_l] "r" (vqs0_l), [vqs0_r] "r" (vqs0_r),
- [vqs1_l] "r" (vqs1_l), [vqs1_r] "r" (vqs1_r),
- [mask_l] "r" (mask_l), [mask_r] "r" (mask_r),
- [hev_l] "r" (hev_l), [hev_r] "r" (hev_r), [HWM] "r" (HWM)
- );
-
- /* save bottom 3 bits so that we round one side +4 and the other +3 */
- __asm__ __volatile__ (
- /* Filter2 = vp8_signed_char_clamp(vp9_filter + 3) >>= 3; */
- "addq_s.ph %[Filter1_l], %[vp9_filter_l], %[t2] \n\t"
- "addq_s.ph %[Filter1_r], %[vp9_filter_r], %[t2] \n\t"
-
- /* Filter1 = vp8_signed_char_clamp(vp9_filter + 4) >>= 3; */
- "addq_s.ph %[Filter2_l], %[vp9_filter_l], %[t1] \n\t"
- "addq_s.ph %[Filter2_r], %[vp9_filter_r], %[t1] \n\t"
- "shra.ph %[Filter1_r], %[Filter1_r], 3 \n\t"
- "shra.ph %[Filter1_l], %[Filter1_l], 3 \n\t"
-
- "shra.ph %[Filter2_l], %[Filter2_l], 3 \n\t"
- "shra.ph %[Filter2_r], %[Filter2_r], 3 \n\t"
-
- "and %[Filter1_l], %[Filter1_l], %[HWM] \n\t"
- "and %[Filter1_r], %[Filter1_r], %[HWM] \n\t"
-
- /* vps0 = vp8_signed_char_clamp(ps0 + Filter2); */
- "addq_s.ph %[vps0_l], %[vps0_l], %[Filter2_l] \n\t"
- "addq_s.ph %[vps0_r], %[vps0_r], %[Filter2_r] \n\t"
-
- /* vqs0 = vp8_signed_char_clamp(qs0 - Filter1); */
- "subq_s.ph %[vqs0_l], %[vqs0_l], %[Filter1_l] \n\t"
- "subq_s.ph %[vqs0_r], %[vqs0_r], %[Filter1_r] \n\t"
-
- : [Filter1_l] "=&r" (Filter1_l), [Filter1_r] "=&r" (Filter1_r),
- [Filter2_l] "=&r" (Filter2_l), [Filter2_r] "=&r" (Filter2_r),
- [vps0_l] "+r" (vps0_l), [vps0_r] "+r" (vps0_r),
- [vqs0_l] "+r" (vqs0_l), [vqs0_r] "+r" (vqs0_r)
- : [t1] "r" (t1), [t2] "r" (t2), [HWM] "r" (HWM),
- [vp9_filter_l] "r" (vp9_filter_l), [vp9_filter_r] "r" (vp9_filter_r)
- );
-
- __asm__ __volatile__ (
- /* (vp9_filter += 1) >>= 1 */
- "addqh.ph %[Filter1_l], %[Filter1_l], %[t3] \n\t"
- "addqh.ph %[Filter1_r], %[Filter1_r], %[t3] \n\t"
-
- /* vp9_filter &= ~hev; */
- "and %[Filter1_l], %[Filter1_l], %[invhev_l] \n\t"
- "and %[Filter1_r], %[Filter1_r], %[invhev_r] \n\t"
-
- /* vps1 = vp8_signed_char_clamp(ps1 + vp9_filter); */
- "addq_s.ph %[vps1_l], %[vps1_l], %[Filter1_l] \n\t"
- "addq_s.ph %[vps1_r], %[vps1_r], %[Filter1_r] \n\t"
-
- /* vqs1 = vp8_signed_char_clamp(qs1 - vp9_filter); */
- "subq_s.ph %[vqs1_l], %[vqs1_l], %[Filter1_l] \n\t"
- "subq_s.ph %[vqs1_r], %[vqs1_r], %[Filter1_r] \n\t"
-
- : [Filter1_l] "+r" (Filter1_l), [Filter1_r] "+r" (Filter1_r),
- [vps1_l] "+r" (vps1_l), [vps1_r] "+r" (vps1_r),
- [vqs1_l] "+r" (vqs1_l), [vqs1_r] "+r" (vqs1_r)
- : [t3] "r" (t3), [invhev_l] "r" (invhev_l), [invhev_r] "r" (invhev_r)
- );
-
- /* Create quad-bytes from halfword pairs */
- vqs0_l = vqs0_l & HWM;
- vqs1_l = vqs1_l & HWM;
- vps0_l = vps0_l & HWM;
- vps1_l = vps1_l & HWM;
-
- __asm__ __volatile__ (
- "shrl.ph %[vqs0_r], %[vqs0_r], 8 \n\t"
- "shrl.ph %[vps0_r], %[vps0_r], 8 \n\t"
- "shrl.ph %[vqs1_r], %[vqs1_r], 8 \n\t"
- "shrl.ph %[vps1_r], %[vps1_r], 8 \n\t"
-
- : [vps1_r] "+r" (vps1_r), [vqs1_r] "+r" (vqs1_r),
- [vps0_r] "+r" (vps0_r), [vqs0_r] "+r" (vqs0_r)
- :
- );
-
- vqs0 = vqs0_l | vqs0_r;
- vqs1 = vqs1_l | vqs1_r;
- vps0 = vps0_l | vps0_r;
- vps1 = vps1_l | vps1_r;
-
- *p0_f0 = vps0 ^ N128;
- *p1_f0 = vps1 ^ N128;
- *q0_f0 = vqs0 ^ N128;
- *q1_f0 = vqs1 ^ N128;
-}
-
-static INLINE void vp9_mbfilter_dspr2(uint32_t *op3, uint32_t *op2,
- uint32_t *op1, uint32_t *op0,
- uint32_t *oq0, uint32_t *oq1,
- uint32_t *oq2, uint32_t *oq3) {
- /* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
- const uint32_t p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
- const uint32_t q0 = *oq0, q1 = *oq1, q2 = *oq2, q3 = *oq3;
- uint32_t res_op2, res_op1, res_op0;
- uint32_t res_oq0, res_oq1, res_oq2;
- uint32_t tmp;
- uint32_t add_p210_q012;
- uint32_t u32Four = 0x00040004;
-
- /* *op2 = ROUND_POWER_OF_TWO(p3 + p3 + p3 + p2 + p2 + p1 + p0 + q0, 3) 1 */
- /* *op1 = ROUND_POWER_OF_TWO(p3 + p3 + p2 + p1 + p1 + p0 + q0 + q1, 3) 2 */
- /* *op0 = ROUND_POWER_OF_TWO(p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2, 3) 3 */
- /* *oq0 = ROUND_POWER_OF_TWO(p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3, 3) 4 */
- /* *oq1 = ROUND_POWER_OF_TWO(p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3, 3) 5 */
- /* *oq2 = ROUND_POWER_OF_TWO(p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3, 3) 6 */
-
- __asm__ __volatile__ (
- "addu.ph %[add_p210_q012], %[p2], %[p1] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[p0] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[q0] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[q1] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[q2] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[u32Four] \n\t"
-
- "shll.ph %[tmp], %[p3], 1 \n\t"
- "addu.ph %[res_op2], %[tmp], %[p3] \n\t"
- "addu.ph %[res_op1], %[p3], %[p3] \n\t"
- "addu.ph %[res_op2], %[res_op2], %[p2] \n\t"
- "addu.ph %[res_op1], %[res_op1], %[p1] \n\t"
- "addu.ph %[res_op2], %[res_op2], %[add_p210_q012] \n\t"
- "addu.ph %[res_op1], %[res_op1], %[add_p210_q012] \n\t"
- "subu.ph %[res_op2], %[res_op2], %[q1] \n\t"
- "subu.ph %[res_op1], %[res_op1], %[q2] \n\t"
- "subu.ph %[res_op2], %[res_op2], %[q2] \n\t"
- "shrl.ph %[res_op1], %[res_op1], 3 \n\t"
- "shrl.ph %[res_op2], %[res_op2], 3 \n\t"
- "addu.ph %[res_op0], %[p3], %[p0] \n\t"
- "addu.ph %[res_oq0], %[q0], %[q3] \n\t"
- "addu.ph %[res_op0], %[res_op0], %[add_p210_q012] \n\t"
- "addu.ph %[res_oq0], %[res_oq0], %[add_p210_q012] \n\t"
- "addu.ph %[res_oq1], %[q3], %[q3] \n\t"
- "shll.ph %[tmp], %[q3], 1 \n\t"
- "addu.ph %[res_oq1], %[res_oq1], %[q1] \n\t"
- "addu.ph %[res_oq2], %[tmp], %[q3] \n\t"
- "addu.ph %[res_oq1], %[res_oq1], %[add_p210_q012] \n\t"
- "addu.ph %[res_oq2], %[res_oq2], %[add_p210_q012] \n\t"
- "subu.ph %[res_oq1], %[res_oq1], %[p2] \n\t"
- "addu.ph %[res_oq2], %[res_oq2], %[q2] \n\t"
- "shrl.ph %[res_oq1], %[res_oq1], 3 \n\t"
- "subu.ph %[res_oq2], %[res_oq2], %[p2] \n\t"
- "shrl.ph %[res_oq0], %[res_oq0], 3 \n\t"
- "subu.ph %[res_oq2], %[res_oq2], %[p1] \n\t"
- "shrl.ph %[res_op0], %[res_op0], 3 \n\t"
- "shrl.ph %[res_oq2], %[res_oq2], 3 \n\t"
-
- : [add_p210_q012] "=&r" (add_p210_q012),
- [tmp] "=&r" (tmp), [res_op2] "=&r" (res_op2),
- [res_op1] "=&r" (res_op1), [res_op0] "=&r" (res_op0),
- [res_oq0] "=&r" (res_oq0), [res_oq1] "=&r" (res_oq1),
- [res_oq2] "=&r" (res_oq2)
- : [p0] "r" (p0), [q0] "r" (q0), [p1] "r" (p1), [q1] "r" (q1),
- [p2] "r" (p2), [q2] "r" (q2), [p3] "r" (p3), [q3] "r" (q3),
- [u32Four] "r" (u32Four)
- );
-
- *op2 = res_op2;
- *op1 = res_op1;
- *op0 = res_op0;
- *oq0 = res_oq0;
- *oq1 = res_oq1;
- *oq2 = res_oq2;
-}
-
-static INLINE void vp9_mbfilter1_dspr2(uint32_t p3, uint32_t p2,
- uint32_t p1, uint32_t p0,
- uint32_t q0, uint32_t q1,
- uint32_t q2, uint32_t q3,
- uint32_t *op2_f1,
- uint32_t *op1_f1, uint32_t *op0_f1,
- uint32_t *oq0_f1, uint32_t *oq1_f1,
- uint32_t *oq2_f1) {
- /* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
- uint32_t res_op2, res_op1, res_op0;
- uint32_t res_oq0, res_oq1, res_oq2;
- uint32_t tmp;
- uint32_t add_p210_q012;
- uint32_t u32Four = 0x00040004;
-
- /* *op2 = ROUND_POWER_OF_TWO(p3 + p3 + p3 + p2 + p2 + p1 + p0 + q0, 3) 1 */
- /* *op1 = ROUND_POWER_OF_TWO(p3 + p3 + p2 + p1 + p1 + p0 + q0 + q1, 3) 2 */
- /* *op0 = ROUND_POWER_OF_TWO(p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2, 3) 3 */
- /* *oq0 = ROUND_POWER_OF_TWO(p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3, 3) 4 */
- /* *oq1 = ROUND_POWER_OF_TWO(p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3, 3) 5 */
- /* *oq2 = ROUND_POWER_OF_TWO(p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3, 3) 6 */
-
- __asm__ __volatile__ (
- "addu.ph %[add_p210_q012], %[p2], %[p1] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[p0] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[q0] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[q1] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[q2] \n\t"
- "addu.ph %[add_p210_q012], %[add_p210_q012], %[u32Four] \n\t"
-
- "shll.ph %[tmp], %[p3], 1 \n\t"
- "addu.ph %[res_op2], %[tmp], %[p3] \n\t"
- "addu.ph %[res_op1], %[p3], %[p3] \n\t"
- "addu.ph %[res_op2], %[res_op2], %[p2] \n\t"
- "addu.ph %[res_op1], %[res_op1], %[p1] \n\t"
- "addu.ph %[res_op2], %[res_op2], %[add_p210_q012] \n\t"
- "addu.ph %[res_op1], %[res_op1], %[add_p210_q012] \n\t"
- "subu.ph %[res_op2], %[res_op2], %[q1] \n\t"
- "subu.ph %[res_op1], %[res_op1], %[q2] \n\t"
- "subu.ph %[res_op2], %[res_op2], %[q2] \n\t"
- "shrl.ph %[res_op1], %[res_op1], 3 \n\t"
- "shrl.ph %[res_op2], %[res_op2], 3 \n\t"
- "addu.ph %[res_op0], %[p3], %[p0] \n\t"
- "addu.ph %[res_oq0], %[q0], %[q3] \n\t"
- "addu.ph %[res_op0], %[res_op0], %[add_p210_q012] \n\t"
- "addu.ph %[res_oq0], %[res_oq0], %[add_p210_q012] \n\t"
- "addu.ph %[res_oq1], %[q3], %[q3] \n\t"
- "shll.ph %[tmp], %[q3], 1 \n\t"
- "addu.ph %[res_oq1], %[res_oq1], %[q1] \n\t"
- "addu.ph %[res_oq2], %[tmp], %[q3] \n\t"
- "addu.ph %[res_oq1], %[res_oq1], %[add_p210_q012] \n\t"
- "addu.ph %[res_oq2], %[res_oq2], %[add_p210_q012] \n\t"
- "subu.ph %[res_oq1], %[res_oq1], %[p2] \n\t"
- "addu.ph %[res_oq2], %[res_oq2], %[q2] \n\t"
- "shrl.ph %[res_oq1], %[res_oq1], 3 \n\t"
- "subu.ph %[res_oq2], %[res_oq2], %[p2] \n\t"
- "shrl.ph %[res_oq0], %[res_oq0], 3 \n\t"
- "subu.ph %[res_oq2], %[res_oq2], %[p1] \n\t"
- "shrl.ph %[res_op0], %[res_op0], 3 \n\t"
- "shrl.ph %[res_oq2], %[res_oq2], 3 \n\t"
-
- : [add_p210_q012] "=&r" (add_p210_q012), [tmp] "=&r" (tmp),
- [res_op2] "=&r" (res_op2), [res_op1] "=&r" (res_op1),
- [res_op0] "=&r" (res_op0), [res_oq0] "=&r" (res_oq0),
- [res_oq1] "=&r" (res_oq1), [res_oq2] "=&r" (res_oq2)
- : [p0] "r" (p0), [q0] "r" (q0), [p1] "r" (p1), [q1] "r" (q1),
- [p2] "r" (p2), [q2] "r" (q2), [p3] "r" (p3), [q3] "r" (q3),
- [u32Four] "r" (u32Four)
- );
-
- *op2_f1 = res_op2;
- *op1_f1 = res_op1;
- *op0_f1 = res_op0;
- *oq0_f1 = res_oq0;
- *oq1_f1 = res_oq1;
- *oq2_f1 = res_oq2;
-}
-
-static INLINE void vp9_wide_mbfilter_dspr2(uint32_t *op7, uint32_t *op6,
- uint32_t *op5, uint32_t *op4,
- uint32_t *op3, uint32_t *op2,
- uint32_t *op1, uint32_t *op0,
- uint32_t *oq0, uint32_t *oq1,
- uint32_t *oq2, uint32_t *oq3,
- uint32_t *oq4, uint32_t *oq5,
- uint32_t *oq6, uint32_t *oq7) {
- const uint32_t p7 = *op7, p6 = *op6, p5 = *op5, p4 = *op4;
- const uint32_t p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
- const uint32_t q0 = *oq0, q1 = *oq1, q2 = *oq2, q3 = *oq3;
- const uint32_t q4 = *oq4, q5 = *oq5, q6 = *oq6, q7 = *oq7;
- uint32_t res_op6, res_op5, res_op4, res_op3, res_op2, res_op1, res_op0;
- uint32_t res_oq0, res_oq1, res_oq2, res_oq3, res_oq4, res_oq5, res_oq6;
- uint32_t tmp;
- uint32_t add_p6toq6;
- uint32_t u32Eight = 0x00080008;
-
- __asm__ __volatile__ (
- /* addition of p6,p5,p4,p3,p2,p1,p0,q0,q1,q2,q3,q4,q5,q6
- which is used most of the time */
- "addu.ph %[add_p6toq6], %[p6], %[p5] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[p4] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[p3] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[p2] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[p1] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[p0] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[q0] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[q1] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[q2] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[q3] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[q4] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[q5] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[q6] \n\t"
- "addu.ph %[add_p6toq6], %[add_p6toq6], %[u32Eight] \n\t"
-
- : [add_p6toq6] "=&r" (add_p6toq6)
- : [p6] "r" (p6), [p5] "r" (p5), [p4] "r" (p4),
- [p3] "r" (p3), [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0),
- [q0] "r" (q0), [q1] "r" (q1), [q2] "r" (q2), [q3] "r" (q3),
- [q4] "r" (q4), [q5] "r" (q5), [q6] "r" (q6),
- [u32Eight] "r" (u32Eight)
- );
-
- __asm__ __volatile__ (
- /* *op6 = ROUND_POWER_OF_TWO(p7 * 7 + p6 * 2 + p5 + p4 +
- p3 + p2 + p1 + p0 + q0, 4) */
- "shll.ph %[tmp], %[p7], 3 \n\t"
- "subu.ph %[res_op6], %[tmp], %[p7] \n\t"
- "addu.ph %[res_op6], %[res_op6], %[p6] \n\t"
- "addu.ph %[res_op6], %[res_op6], %[add_p6toq6] \n\t"
- "subu.ph %[res_op6], %[res_op6], %[q1] \n\t"
- "subu.ph %[res_op6], %[res_op6], %[q2] \n\t"
- "subu.ph %[res_op6], %[res_op6], %[q3] \n\t"
- "subu.ph %[res_op6], %[res_op6], %[q4] \n\t"
- "subu.ph %[res_op6], %[res_op6], %[q5] \n\t"
- "subu.ph %[res_op6], %[res_op6], %[q6] \n\t"
- "shrl.ph %[res_op6], %[res_op6], 4 \n\t"
-
- /* *op5 = ROUND_POWER_OF_TWO(p7 * 6 + p6 + p5 * 2 + p4 + p3 +
- p2 + p1 + p0 + q0 + q1, 4) */
- "shll.ph %[tmp], %[p7], 2 \n\t"
- "addu.ph %[res_op5], %[tmp], %[p7] \n\t"
- "addu.ph %[res_op5], %[res_op5], %[p7] \n\t"
- "addu.ph %[res_op5], %[res_op5], %[p5] \n\t"
- "addu.ph %[res_op5], %[res_op5], %[add_p6toq6] \n\t"
- "subu.ph %[res_op5], %[res_op5], %[q2] \n\t"
- "subu.ph %[res_op5], %[res_op5], %[q3] \n\t"
- "subu.ph %[res_op5], %[res_op5], %[q4] \n\t"
- "subu.ph %[res_op5], %[res_op5], %[q5] \n\t"
- "subu.ph %[res_op5], %[res_op5], %[q6] \n\t"
- "shrl.ph %[res_op5], %[res_op5], 4 \n\t"
-
- /* *op4 = ROUND_POWER_OF_TWO(p7 * 5 + p6 + p5 + p4 * 2 + p3 + p2 +
- p1 + p0 + q0 + q1 + q2, 4) */
- "shll.ph %[tmp], %[p7], 2 \n\t"
- "addu.ph %[res_op4], %[tmp], %[p7] \n\t"
- "addu.ph %[res_op4], %[res_op4], %[p4] \n\t"
- "addu.ph %[res_op4], %[res_op4], %[add_p6toq6] \n\t"
- "subu.ph %[res_op4], %[res_op4], %[q3] \n\t"
- "subu.ph %[res_op4], %[res_op4], %[q4] \n\t"
- "subu.ph %[res_op4], %[res_op4], %[q5] \n\t"
- "subu.ph %[res_op4], %[res_op4], %[q6] \n\t"
- "shrl.ph %[res_op4], %[res_op4], 4 \n\t"
-
- /* *op3 = ROUND_POWER_OF_TWO(p7 * 4 + p6 + p5 + p4 + p3 * 2 + p2 +
- p1 + p0 + q0 + q1 + q2 + q3, 4) */
- "shll.ph %[tmp], %[p7], 2 \n\t"
- "addu.ph %[res_op3], %[tmp], %[p3] \n\t"
- "addu.ph %[res_op3], %[res_op3], %[add_p6toq6] \n\t"
- "subu.ph %[res_op3], %[res_op3], %[q4] \n\t"
- "subu.ph %[res_op3], %[res_op3], %[q5] \n\t"
- "subu.ph %[res_op3], %[res_op3], %[q6] \n\t"
- "shrl.ph %[res_op3], %[res_op3], 4 \n\t"
-
- /* *op2 = ROUND_POWER_OF_TWO(p7 * 3 + p6 + p5 + p4 + p3 + p2 * 2 + p1 +
- p0 + q0 + q1 + q2 + q3 + q4, 4) */
- "shll.ph %[tmp], %[p7], 1 \n\t"
- "addu.ph %[res_op2], %[tmp], %[p7] \n\t"
- "addu.ph %[res_op2], %[res_op2], %[p2] \n\t"
- "addu.ph %[res_op2], %[res_op2], %[add_p6toq6] \n\t"
- "subu.ph %[res_op2], %[res_op2], %[q5] \n\t"
- "subu.ph %[res_op2], %[res_op2], %[q6] \n\t"
- "shrl.ph %[res_op2], %[res_op2], 4 \n\t"
-
- /* *op1 = ROUND_POWER_OF_TWO(p7 * 2 + p6 + p5 + p4 + p3 + p2 + p1 * 2 +
- p0 + q0 + q1 + q2 + q3 + q4 + q5, 4); */
- "shll.ph %[tmp], %[p7], 1 \n\t"
- "addu.ph %[res_op1], %[tmp], %[p1] \n\t"
- "addu.ph %[res_op1], %[res_op1], %[add_p6toq6] \n\t"
- "subu.ph %[res_op1], %[res_op1], %[q6] \n\t"
- "shrl.ph %[res_op1], %[res_op1], 4 \n\t"
-
- /* *op0 = ROUND_POWER_OF_TWO(p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0 * 2 +
- q0 + q1 + q2 + q3 + q4 + q5 + q6, 4) */
- "addu.ph %[res_op0], %[p7], %[p0] \n\t"
- "addu.ph %[res_op0], %[res_op0], %[add_p6toq6] \n\t"
- "shrl.ph %[res_op0], %[res_op0], 4 \n\t"
-
- : [res_op6] "=&r" (res_op6), [res_op5] "=&r" (res_op5),
- [res_op4] "=&r" (res_op4), [res_op3] "=&r" (res_op3),
- [res_op2] "=&r" (res_op2), [res_op1] "=&r" (res_op1),
- [res_op0] "=&r" (res_op0), [tmp] "=&r" (tmp)
- : [p7] "r" (p7), [p6] "r" (p6), [p5] "r" (p5), [p4] "r" (p4),
- [p3] "r" (p3), [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0),
- [q2] "r" (q2), [q1] "r" (q1),
- [q3] "r" (q3), [q4] "r" (q4), [q5] "r" (q5), [q6] "r" (q6),
- [add_p6toq6] "r" (add_p6toq6)
- );
-
- *op6 = res_op6;
- *op5 = res_op5;
- *op4 = res_op4;
- *op3 = res_op3;
- *op2 = res_op2;
- *op1 = res_op1;
- *op0 = res_op0;
-
- __asm__ __volatile__ (
- /* *oq0 = ROUND_POWER_OF_TWO(p6 + p5 + p4 + p3 + p2 + p1 + p0 + q0 * 2 +
- q1 + q2 + q3 + q4 + q5 + q6 + q7, 4); */
- "addu.ph %[res_oq0], %[q7], %[q0] \n\t"
- "addu.ph %[res_oq0], %[res_oq0], %[add_p6toq6] \n\t"
- "shrl.ph %[res_oq0], %[res_oq0], 4 \n\t"
-
- /* *oq1 = ROUND_POWER_OF_TWO(p5 + p4 + p3 + p2 + p1 + p0 + q0 + q1 * 2 +
- q2 + q3 + q4 + q5 + q6 + q7 * 2, 4) */
- "shll.ph %[tmp], %[q7], 1 \n\t"
- "addu.ph %[res_oq1], %[tmp], %[q1] \n\t"
- "addu.ph %[res_oq1], %[res_oq1], %[add_p6toq6] \n\t"
- "subu.ph %[res_oq1], %[res_oq1], %[p6] \n\t"
- "shrl.ph %[res_oq1], %[res_oq1], 4 \n\t"
-
- /* *oq2 = ROUND_POWER_OF_TWO(p4 + p3 + p2 + p1 + p0 + q0 + q1 + q2 * 2 +
- q3 + q4 + q5 + q6 + q7 * 3, 4) */
- "shll.ph %[tmp], %[q7], 1 \n\t"
- "addu.ph %[res_oq2], %[tmp], %[q7] \n\t"
- "addu.ph %[res_oq2], %[res_oq2], %[q2] \n\t"
- "addu.ph %[res_oq2], %[res_oq2], %[add_p6toq6] \n\t"
- "subu.ph %[res_oq2], %[res_oq2], %[p5] \n\t"
- "subu.ph %[res_oq2], %[res_oq2], %[p6] \n\t"
- "shrl.ph %[res_oq2], %[res_oq2], 4 \n\t"
-
- /* *oq3 = ROUND_POWER_OF_TWO(p3 + p2 + p1 + p0 + q0 + q1 + q2 +
- q3 * 2 + q4 + q5 + q6 + q7 * 4, 4) */
- "shll.ph %[tmp], %[q7], 2 \n\t"
- "addu.ph %[res_oq3], %[tmp], %[q3] \n\t"
- "addu.ph %[res_oq3], %[res_oq3], %[add_p6toq6] \n\t"
- "subu.ph %[res_oq3], %[res_oq3], %[p4] \n\t"
- "subu.ph %[res_oq3], %[res_oq3], %[p5] \n\t"
- "subu.ph %[res_oq3], %[res_oq3], %[p6] \n\t"
- "shrl.ph %[res_oq3], %[res_oq3], 4 \n\t"
-
- /* *oq4 = ROUND_POWER_OF_TWO(p2 + p1 + p0 + q0 + q1 + q2 + q3 +
- q4 * 2 + q5 + q6 + q7 * 5, 4) */
- "shll.ph %[tmp], %[q7], 2 \n\t"
- "addu.ph %[res_oq4], %[tmp], %[q7] \n\t"
- "addu.ph %[res_oq4], %[res_oq4], %[q4] \n\t"
- "addu.ph %[res_oq4], %[res_oq4], %[add_p6toq6] \n\t"
- "subu.ph %[res_oq4], %[res_oq4], %[p3] \n\t"
- "subu.ph %[res_oq4], %[res_oq4], %[p4] \n\t"
- "subu.ph %[res_oq4], %[res_oq4], %[p5] \n\t"
- "subu.ph %[res_oq4], %[res_oq4], %[p6] \n\t"
- "shrl.ph %[res_oq4], %[res_oq4], 4 \n\t"
-
- /* *oq5 = ROUND_POWER_OF_TWO(p1 + p0 + q0 + q1 + q2 + q3 + q4 +
- q5 * 2 + q6 + q7 * 6, 4) */
- "shll.ph %[tmp], %[q7], 2 \n\t"
- "addu.ph %[res_oq5], %[tmp], %[q7] \n\t"
- "addu.ph %[res_oq5], %[res_oq5], %[q7] \n\t"
- "addu.ph %[res_oq5], %[res_oq5], %[q5] \n\t"
- "addu.ph %[res_oq5], %[res_oq5], %[add_p6toq6] \n\t"
- "subu.ph %[res_oq5], %[res_oq5], %[p2] \n\t"
- "subu.ph %[res_oq5], %[res_oq5], %[p3] \n\t"
- "subu.ph %[res_oq5], %[res_oq5], %[p4] \n\t"
- "subu.ph %[res_oq5], %[res_oq5], %[p5] \n\t"
- "subu.ph %[res_oq5], %[res_oq5], %[p6] \n\t"
- "shrl.ph %[res_oq5], %[res_oq5], 4 \n\t"
-
- /* *oq6 = ROUND_POWER_OF_TWO(p0 + q0 + q1 + q2 + q3 +
- q4 + q5 + q6 * 2 + q7 * 7, 4) */
- "shll.ph %[tmp], %[q7], 3 \n\t"
- "subu.ph %[res_oq6], %[tmp], %[q7] \n\t"
- "addu.ph %[res_oq6], %[res_oq6], %[q6] \n\t"
- "addu.ph %[res_oq6], %[res_oq6], %[add_p6toq6] \n\t"
- "subu.ph %[res_oq6], %[res_oq6], %[p1] \n\t"
- "subu.ph %[res_oq6], %[res_oq6], %[p2] \n\t"
- "subu.ph %[res_oq6], %[res_oq6], %[p3] \n\t"
- "subu.ph %[res_oq6], %[res_oq6], %[p4] \n\t"
- "subu.ph %[res_oq6], %[res_oq6], %[p5] \n\t"
- "subu.ph %[res_oq6], %[res_oq6], %[p6] \n\t"
- "shrl.ph %[res_oq6], %[res_oq6], 4 \n\t"
-
- : [res_oq6] "=&r" (res_oq6), [res_oq5] "=&r" (res_oq5),
- [res_oq4] "=&r" (res_oq4), [res_oq3] "=&r" (res_oq3),
- [res_oq2] "=&r" (res_oq2), [res_oq1] "=&r" (res_oq1),
- [res_oq0] "=&r" (res_oq0), [tmp] "=&r" (tmp)
- : [q7] "r" (q7), [q6] "r" (q6), [q5] "r" (q5), [q4] "r" (q4),
- [q3] "r" (q3), [q2] "r" (q2), [q1] "r" (q1), [q0] "r" (q0),
- [p1] "r" (p1), [p2] "r" (p2),
- [p3] "r" (p3), [p4] "r" (p4), [p5] "r" (p5), [p6] "r" (p6),
- [add_p6toq6] "r" (add_p6toq6)
- );
-
- *oq0 = res_oq0;
- *oq1 = res_oq1;
- *oq2 = res_oq2;
- *oq3 = res_oq3;
- *oq4 = res_oq4;
- *oq5 = res_oq5;
- *oq6 = res_oq6;
-}
-#endif // #if HAVE_DSPR2
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_FILTERS_DSPR2_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h
deleted file mode 100644
index ca01a6a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MACROS_DSPR2_H_
-#define VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MACROS_DSPR2_H_
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if HAVE_DSPR2
-#define STORE_F0() { \
- __asm__ __volatile__ ( \
- "sb %[q1_f0], 1(%[s4]) \n\t" \
- "sb %[q0_f0], 0(%[s4]) \n\t" \
- "sb %[p0_f0], -1(%[s4]) \n\t" \
- "sb %[p1_f0], -2(%[s4]) \n\t" \
- \
- : \
- : [q1_f0] "r" (q1_f0), [q0_f0] "r" (q0_f0), \
- [p0_f0] "r" (p0_f0), [p1_f0] "r" (p1_f0), \
- [s4] "r" (s4) \
- ); \
- \
- __asm__ __volatile__ ( \
- "srl %[q1_f0], %[q1_f0], 8 \n\t" \
- "srl %[q0_f0], %[q0_f0], 8 \n\t" \
- "srl %[p0_f0], %[p0_f0], 8 \n\t" \
- "srl %[p1_f0], %[p1_f0], 8 \n\t" \
- \
- : [q1_f0] "+r" (q1_f0), [q0_f0] "+r" (q0_f0), \
- [p0_f0] "+r" (p0_f0), [p1_f0] "+r" (p1_f0) \
- : \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q1_f0], 1(%[s3]) \n\t" \
- "sb %[q0_f0], 0(%[s3]) \n\t" \
- "sb %[p0_f0], -1(%[s3]) \n\t" \
- "sb %[p1_f0], -2(%[s3]) \n\t" \
- \
- : [p1_f0] "+r" (p1_f0) \
- : [q1_f0] "r" (q1_f0), [q0_f0] "r" (q0_f0), \
- [s3] "r" (s3), [p0_f0] "r" (p0_f0) \
- ); \
- \
- __asm__ __volatile__ ( \
- "srl %[q1_f0], %[q1_f0], 8 \n\t" \
- "srl %[q0_f0], %[q0_f0], 8 \n\t" \
- "srl %[p0_f0], %[p0_f0], 8 \n\t" \
- "srl %[p1_f0], %[p1_f0], 8 \n\t" \
- \
- : [q1_f0] "+r" (q1_f0), [q0_f0] "+r" (q0_f0), \
- [p0_f0] "+r" (p0_f0), [p1_f0] "+r" (p1_f0) \
- : \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q1_f0], 1(%[s2]) \n\t" \
- "sb %[q0_f0], 0(%[s2]) \n\t" \
- "sb %[p0_f0], -1(%[s2]) \n\t" \
- "sb %[p1_f0], -2(%[s2]) \n\t" \
- \
- : \
- : [q1_f0] "r" (q1_f0), [q0_f0] "r" (q0_f0), \
- [p0_f0] "r" (p0_f0), [p1_f0] "r" (p1_f0), \
- [s2] "r" (s2) \
- ); \
- \
- __asm__ __volatile__ ( \
- "srl %[q1_f0], %[q1_f0], 8 \n\t" \
- "srl %[q0_f0], %[q0_f0], 8 \n\t" \
- "srl %[p0_f0], %[p0_f0], 8 \n\t" \
- "srl %[p1_f0], %[p1_f0], 8 \n\t" \
- \
- : [q1_f0] "+r" (q1_f0), [q0_f0] "+r" (q0_f0), \
- [p0_f0] "+r" (p0_f0), [p1_f0] "+r" (p1_f0) \
- : \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q1_f0], 1(%[s1]) \n\t" \
- "sb %[q0_f0], 0(%[s1]) \n\t" \
- "sb %[p0_f0], -1(%[s1]) \n\t" \
- "sb %[p1_f0], -2(%[s1]) \n\t" \
- \
- : \
- : [q1_f0] "r" (q1_f0), [q0_f0] "r" (q0_f0), \
- [p0_f0] "r" (p0_f0), [p1_f0] "r" (p1_f0), \
- [s1] "r" (s1) \
- ); \
-}
-
-#define STORE_F1() { \
- __asm__ __volatile__ ( \
- "sb %[q2_r], 2(%[s4]) \n\t" \
- "sb %[q1_r], 1(%[s4]) \n\t" \
- "sb %[q0_r], 0(%[s4]) \n\t" \
- "sb %[p0_r], -1(%[s4]) \n\t" \
- "sb %[p1_r], -2(%[s4]) \n\t" \
- "sb %[p2_r], -3(%[s4]) \n\t" \
- \
- : \
- : [q2_r] "r" (q2_r), [q1_r] "r" (q1_r), [q0_r] "r" (q0_r), \
- [p0_r] "r" (p0_r), [p1_r] "r" (p1_r), [p2_r] "r" (p2_r), \
- [s4] "r" (s4) \
- ); \
- \
- __asm__ __volatile__ ( \
- "srl %[q2_r], %[q2_r], 16 \n\t" \
- "srl %[q1_r], %[q1_r], 16 \n\t" \
- "srl %[q0_r], %[q0_r], 16 \n\t" \
- "srl %[p0_r], %[p0_r], 16 \n\t" \
- "srl %[p1_r], %[p1_r], 16 \n\t" \
- "srl %[p2_r], %[p2_r], 16 \n\t" \
- \
- : [q2_r] "+r" (q2_r), [q1_r] "+r" (q1_r), [q0_r] "+r" (q0_r), \
- [p0_r] "+r" (p0_r), [p1_r] "+r" (p1_r), [p2_r] "+r" (p2_r) \
- : \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q2_r], 2(%[s3]) \n\t" \
- "sb %[q1_r], 1(%[s3]) \n\t" \
- "sb %[q0_r], 0(%[s3]) \n\t" \
- "sb %[p0_r], -1(%[s3]) \n\t" \
- "sb %[p1_r], -2(%[s3]) \n\t" \
- "sb %[p2_r], -3(%[s3]) \n\t" \
- \
- : \
- : [q2_r] "r" (q2_r), [q1_r] "r" (q1_r), [q0_r] "r" (q0_r), \
- [p0_r] "r" (p0_r), [p1_r] "r" (p1_r), [p2_r] "r" (p2_r), \
- [s3] "r" (s3) \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q2_l], 2(%[s2]) \n\t" \
- "sb %[q1_l], 1(%[s2]) \n\t" \
- "sb %[q0_l], 0(%[s2]) \n\t" \
- "sb %[p0_l], -1(%[s2]) \n\t" \
- "sb %[p1_l], -2(%[s2]) \n\t" \
- "sb %[p2_l], -3(%[s2]) \n\t" \
- \
- : \
- : [q2_l] "r" (q2_l), [q1_l] "r" (q1_l), [q0_l] "r" (q0_l), \
- [p0_l] "r" (p0_l), [p1_l] "r" (p1_l), [p2_l] "r" (p2_l), \
- [s2] "r" (s2) \
- ); \
- \
- __asm__ __volatile__ ( \
- "srl %[q2_l], %[q2_l], 16 \n\t" \
- "srl %[q1_l], %[q1_l], 16 \n\t" \
- "srl %[q0_l], %[q0_l], 16 \n\t" \
- "srl %[p0_l], %[p0_l], 16 \n\t" \
- "srl %[p1_l], %[p1_l], 16 \n\t" \
- "srl %[p2_l], %[p2_l], 16 \n\t" \
- \
- : [q2_l] "+r" (q2_l), [q1_l] "+r" (q1_l), [q0_l] "+r" (q0_l), \
- [p0_l] "+r" (p0_l), [p1_l] "+r" (p1_l), [p2_l] "+r" (p2_l) \
- : \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q2_l], 2(%[s1]) \n\t" \
- "sb %[q1_l], 1(%[s1]) \n\t" \
- "sb %[q0_l], 0(%[s1]) \n\t" \
- "sb %[p0_l], -1(%[s1]) \n\t" \
- "sb %[p1_l], -2(%[s1]) \n\t" \
- "sb %[p2_l], -3(%[s1]) \n\t" \
- \
- : \
- : [q2_l] "r" (q2_l), [q1_l] "r" (q1_l), [q0_l] "r" (q0_l), \
- [p0_l] "r" (p0_l), [p1_l] "r" (p1_l), [p2_l] "r" (p2_l), \
- [s1] "r" (s1) \
- ); \
-}
-
-#define STORE_F2() { \
- __asm__ __volatile__ ( \
- "sb %[q6_r], 6(%[s4]) \n\t" \
- "sb %[q5_r], 5(%[s4]) \n\t" \
- "sb %[q4_r], 4(%[s4]) \n\t" \
- "sb %[q3_r], 3(%[s4]) \n\t" \
- "sb %[q2_r], 2(%[s4]) \n\t" \
- "sb %[q1_r], 1(%[s4]) \n\t" \
- "sb %[q0_r], 0(%[s4]) \n\t" \
- "sb %[p0_r], -1(%[s4]) \n\t" \
- "sb %[p1_r], -2(%[s4]) \n\t" \
- "sb %[p2_r], -3(%[s4]) \n\t" \
- "sb %[p3_r], -4(%[s4]) \n\t" \
- "sb %[p4_r], -5(%[s4]) \n\t" \
- "sb %[p5_r], -6(%[s4]) \n\t" \
- "sb %[p6_r], -7(%[s4]) \n\t" \
- \
- : \
- : [q6_r] "r" (q6_r), [q5_r] "r" (q5_r), [q4_r] "r" (q4_r), \
- [q3_r] "r" (q3_r), [q2_r] "r" (q2_r), [q1_r] "r" (q1_r), \
- [q0_r] "r" (q0_r), \
- [p0_r] "r" (p0_r), [p1_r] "r" (p1_r), [p2_r] "r" (p2_r), \
- [p3_r] "r" (p3_r), [p4_r] "r" (p4_r), [p5_r] "r" (p5_r), \
- [p6_r] "r" (p6_r), \
- [s4] "r" (s4) \
- ); \
- \
- __asm__ __volatile__ ( \
- "srl %[q6_r], %[q6_r], 16 \n\t" \
- "srl %[q5_r], %[q5_r], 16 \n\t" \
- "srl %[q4_r], %[q4_r], 16 \n\t" \
- "srl %[q3_r], %[q3_r], 16 \n\t" \
- "srl %[q2_r], %[q2_r], 16 \n\t" \
- "srl %[q1_r], %[q1_r], 16 \n\t" \
- "srl %[q0_r], %[q0_r], 16 \n\t" \
- "srl %[p0_r], %[p0_r], 16 \n\t" \
- "srl %[p1_r], %[p1_r], 16 \n\t" \
- "srl %[p2_r], %[p2_r], 16 \n\t" \
- "srl %[p3_r], %[p3_r], 16 \n\t" \
- "srl %[p4_r], %[p4_r], 16 \n\t" \
- "srl %[p5_r], %[p5_r], 16 \n\t" \
- "srl %[p6_r], %[p6_r], 16 \n\t" \
- \
- : [q6_r] "+r" (q6_r), [q5_r] "+r" (q5_r), [q4_r] "+r" (q4_r), \
- [q3_r] "+r" (q3_r), [q2_r] "+r" (q2_r), [q1_r] "+r" (q1_r), \
- [q0_r] "+r" (q0_r), \
- [p0_r] "+r" (p0_r), [p1_r] "+r" (p1_r), [p2_r] "+r" (p2_r), \
- [p3_r] "+r" (p3_r), [p4_r] "+r" (p4_r), [p5_r] "+r" (p5_r), \
- [p6_r] "+r" (p6_r) \
- : \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q6_r], 6(%[s3]) \n\t" \
- "sb %[q5_r], 5(%[s3]) \n\t" \
- "sb %[q4_r], 4(%[s3]) \n\t" \
- "sb %[q3_r], 3(%[s3]) \n\t" \
- "sb %[q2_r], 2(%[s3]) \n\t" \
- "sb %[q1_r], 1(%[s3]) \n\t" \
- "sb %[q0_r], 0(%[s3]) \n\t" \
- "sb %[p0_r], -1(%[s3]) \n\t" \
- "sb %[p1_r], -2(%[s3]) \n\t" \
- "sb %[p2_r], -3(%[s3]) \n\t" \
- "sb %[p3_r], -4(%[s3]) \n\t" \
- "sb %[p4_r], -5(%[s3]) \n\t" \
- "sb %[p5_r], -6(%[s3]) \n\t" \
- "sb %[p6_r], -7(%[s3]) \n\t" \
- \
- : \
- : [q6_r] "r" (q6_r), [q5_r] "r" (q5_r), [q4_r] "r" (q4_r), \
- [q3_r] "r" (q3_r), [q2_r] "r" (q2_r), [q1_r] "r" (q1_r), \
- [q0_r] "r" (q0_r), \
- [p0_r] "r" (p0_r), [p1_r] "r" (p1_r), [p2_r] "r" (p2_r), \
- [p3_r] "r" (p3_r), [p4_r] "r" (p4_r), [p5_r] "r" (p5_r), \
- [p6_r] "r" (p6_r), \
- [s3] "r" (s3) \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q6_l], 6(%[s2]) \n\t" \
- "sb %[q5_l], 5(%[s2]) \n\t" \
- "sb %[q4_l], 4(%[s2]) \n\t" \
- "sb %[q3_l], 3(%[s2]) \n\t" \
- "sb %[q2_l], 2(%[s2]) \n\t" \
- "sb %[q1_l], 1(%[s2]) \n\t" \
- "sb %[q0_l], 0(%[s2]) \n\t" \
- "sb %[p0_l], -1(%[s2]) \n\t" \
- "sb %[p1_l], -2(%[s2]) \n\t" \
- "sb %[p2_l], -3(%[s2]) \n\t" \
- "sb %[p3_l], -4(%[s2]) \n\t" \
- "sb %[p4_l], -5(%[s2]) \n\t" \
- "sb %[p5_l], -6(%[s2]) \n\t" \
- "sb %[p6_l], -7(%[s2]) \n\t" \
- \
- : \
- : [q6_l] "r" (q6_l), [q5_l] "r" (q5_l), [q4_l] "r" (q4_l), \
- [q3_l] "r" (q3_l), [q2_l] "r" (q2_l), [q1_l] "r" (q1_l), \
- [q0_l] "r" (q0_l), \
- [p0_l] "r" (p0_l), [p1_l] "r" (p1_l), [p2_l] "r" (p2_l), \
- [p3_l] "r" (p3_l), [p4_l] "r" (p4_l), [p5_l] "r" (p5_l), \
- [p6_l] "r" (p6_l), \
- [s2] "r" (s2) \
- ); \
- \
- __asm__ __volatile__ ( \
- "srl %[q6_l], %[q6_l], 16 \n\t" \
- "srl %[q5_l], %[q5_l], 16 \n\t" \
- "srl %[q4_l], %[q4_l], 16 \n\t" \
- "srl %[q3_l], %[q3_l], 16 \n\t" \
- "srl %[q2_l], %[q2_l], 16 \n\t" \
- "srl %[q1_l], %[q1_l], 16 \n\t" \
- "srl %[q0_l], %[q0_l], 16 \n\t" \
- "srl %[p0_l], %[p0_l], 16 \n\t" \
- "srl %[p1_l], %[p1_l], 16 \n\t" \
- "srl %[p2_l], %[p2_l], 16 \n\t" \
- "srl %[p3_l], %[p3_l], 16 \n\t" \
- "srl %[p4_l], %[p4_l], 16 \n\t" \
- "srl %[p5_l], %[p5_l], 16 \n\t" \
- "srl %[p6_l], %[p6_l], 16 \n\t" \
- \
- : [q6_l] "+r" (q6_l), [q5_l] "+r" (q5_l), [q4_l] "+r" (q4_l), \
- [q3_l] "+r" (q3_l), [q2_l] "+r" (q2_l), [q1_l] "+r" (q1_l), \
- [q0_l] "+r" (q0_l), \
- [p0_l] "+r" (p0_l), [p1_l] "+r" (p1_l), [p2_l] "+r" (p2_l), \
- [p3_l] "+r" (p3_l), [p4_l] "+r" (p4_l), [p5_l] "+r" (p5_l), \
- [p6_l] "+r" (p6_l) \
- : \
- ); \
- \
- __asm__ __volatile__ ( \
- "sb %[q6_l], 6(%[s1]) \n\t" \
- "sb %[q5_l], 5(%[s1]) \n\t" \
- "sb %[q4_l], 4(%[s1]) \n\t" \
- "sb %[q3_l], 3(%[s1]) \n\t" \
- "sb %[q2_l], 2(%[s1]) \n\t" \
- "sb %[q1_l], 1(%[s1]) \n\t" \
- "sb %[q0_l], 0(%[s1]) \n\t" \
- "sb %[p0_l], -1(%[s1]) \n\t" \
- "sb %[p1_l], -2(%[s1]) \n\t" \
- "sb %[p2_l], -3(%[s1]) \n\t" \
- "sb %[p3_l], -4(%[s1]) \n\t" \
- "sb %[p4_l], -5(%[s1]) \n\t" \
- "sb %[p5_l], -6(%[s1]) \n\t" \
- "sb %[p6_l], -7(%[s1]) \n\t" \
- \
- : \
- : [q6_l] "r" (q6_l), [q5_l] "r" (q5_l), [q4_l] "r" (q4_l), \
- [q3_l] "r" (q3_l), [q2_l] "r" (q2_l), [q1_l] "r" (q1_l), \
- [q0_l] "r" (q0_l), \
- [p0_l] "r" (p0_l), [p1_l] "r" (p1_l), [p2_l] "r" (p2_l), \
- [p3_l] "r" (p3_l), [p4_l] "r" (p4_l), [p5_l] "r" (p5_l), \
- [p6_l] "r" (p6_l), \
- [s1] "r" (s1) \
- ); \
-}
-
-#define PACK_LEFT_0TO3() { \
- __asm__ __volatile__ ( \
- "preceu.ph.qbl %[p3_l], %[p3] \n\t" \
- "preceu.ph.qbl %[p2_l], %[p2] \n\t" \
- "preceu.ph.qbl %[p1_l], %[p1] \n\t" \
- "preceu.ph.qbl %[p0_l], %[p0] \n\t" \
- "preceu.ph.qbl %[q0_l], %[q0] \n\t" \
- "preceu.ph.qbl %[q1_l], %[q1] \n\t" \
- "preceu.ph.qbl %[q2_l], %[q2] \n\t" \
- "preceu.ph.qbl %[q3_l], %[q3] \n\t" \
- \
- : [p3_l] "=&r" (p3_l), [p2_l] "=&r" (p2_l), \
- [p1_l] "=&r" (p1_l), [p0_l] "=&r" (p0_l), \
- [q0_l] "=&r" (q0_l), [q1_l] "=&r" (q1_l), \
- [q2_l] "=&r" (q2_l), [q3_l] "=&r" (q3_l) \
- : [p3] "r" (p3), [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0), \
- [q0] "r" (q0), [q1] "r" (q1), [q2] "r" (q2), [q3] "r" (q3) \
- ); \
-}
-
-#define PACK_LEFT_4TO7() { \
- __asm__ __volatile__ ( \
- "preceu.ph.qbl %[p7_l], %[p7] \n\t" \
- "preceu.ph.qbl %[p6_l], %[p6] \n\t" \
- "preceu.ph.qbl %[p5_l], %[p5] \n\t" \
- "preceu.ph.qbl %[p4_l], %[p4] \n\t" \
- "preceu.ph.qbl %[q4_l], %[q4] \n\t" \
- "preceu.ph.qbl %[q5_l], %[q5] \n\t" \
- "preceu.ph.qbl %[q6_l], %[q6] \n\t" \
- "preceu.ph.qbl %[q7_l], %[q7] \n\t" \
- \
- : [p7_l] "=&r" (p7_l), [p6_l] "=&r" (p6_l), \
- [p5_l] "=&r" (p5_l), [p4_l] "=&r" (p4_l), \
- [q4_l] "=&r" (q4_l), [q5_l] "=&r" (q5_l), \
- [q6_l] "=&r" (q6_l), [q7_l] "=&r" (q7_l) \
- : [p7] "r" (p7), [p6] "r" (p6), [p5] "r" (p5), [p4] "r" (p4), \
- [q4] "r" (q4), [q5] "r" (q5), [q6] "r" (q6), [q7] "r" (q7) \
- ); \
-}
-
-#define PACK_RIGHT_0TO3() { \
- __asm__ __volatile__ ( \
- "preceu.ph.qbr %[p3_r], %[p3] \n\t" \
- "preceu.ph.qbr %[p2_r], %[p2] \n\t" \
- "preceu.ph.qbr %[p1_r], %[p1] \n\t" \
- "preceu.ph.qbr %[p0_r], %[p0] \n\t" \
- "preceu.ph.qbr %[q0_r], %[q0] \n\t" \
- "preceu.ph.qbr %[q1_r], %[q1] \n\t" \
- "preceu.ph.qbr %[q2_r], %[q2] \n\t" \
- "preceu.ph.qbr %[q3_r], %[q3] \n\t" \
- \
- : [p3_r] "=&r" (p3_r), [p2_r] "=&r" (p2_r), \
- [p1_r] "=&r" (p1_r), [p0_r] "=&r" (p0_r), \
- [q0_r] "=&r" (q0_r), [q1_r] "=&r" (q1_r), \
- [q2_r] "=&r" (q2_r), [q3_r] "=&r" (q3_r) \
- : [p3] "r" (p3), [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0), \
- [q0] "r" (q0), [q1] "r" (q1), [q2] "r" (q2), [q3] "r" (q3) \
- ); \
-}
-
-#define PACK_RIGHT_4TO7() { \
- __asm__ __volatile__ ( \
- "preceu.ph.qbr %[p7_r], %[p7] \n\t" \
- "preceu.ph.qbr %[p6_r], %[p6] \n\t" \
- "preceu.ph.qbr %[p5_r], %[p5] \n\t" \
- "preceu.ph.qbr %[p4_r], %[p4] \n\t" \
- "preceu.ph.qbr %[q4_r], %[q4] \n\t" \
- "preceu.ph.qbr %[q5_r], %[q5] \n\t" \
- "preceu.ph.qbr %[q6_r], %[q6] \n\t" \
- "preceu.ph.qbr %[q7_r], %[q7] \n\t" \
- \
- : [p7_r] "=&r" (p7_r), [p6_r] "=&r" (p6_r), \
- [p5_r] "=&r" (p5_r), [p4_r] "=&r" (p4_r), \
- [q4_r] "=&r" (q4_r), [q5_r] "=&r" (q5_r), \
- [q6_r] "=&r" (q6_r), [q7_r] "=&r" (q7_r) \
- : [p7] "r" (p7), [p6] "r" (p6), [p5] "r" (p5), [p4] "r" (p4), \
- [q4] "r" (q4), [q5] "r" (q5), [q6] "r" (q6), [q7] "r" (q7) \
- ); \
-}
-
-#define COMBINE_LEFT_RIGHT_0TO2() { \
- __asm__ __volatile__ ( \
- "precr.qb.ph %[p2], %[p2_l], %[p2_r] \n\t" \
- "precr.qb.ph %[p1], %[p1_l], %[p1_r] \n\t" \
- "precr.qb.ph %[p0], %[p0_l], %[p0_r] \n\t" \
- "precr.qb.ph %[q0], %[q0_l], %[q0_r] \n\t" \
- "precr.qb.ph %[q1], %[q1_l], %[q1_r] \n\t" \
- "precr.qb.ph %[q2], %[q2_l], %[q2_r] \n\t" \
- \
- : [p2] "=&r" (p2), [p1] "=&r" (p1), [p0] "=&r" (p0), \
- [q0] "=&r" (q0), [q1] "=&r" (q1), [q2] "=&r" (q2) \
- : [p2_l] "r" (p2_l), [p2_r] "r" (p2_r), \
- [p1_l] "r" (p1_l), [p1_r] "r" (p1_r), \
- [p0_l] "r" (p0_l), [p0_r] "r" (p0_r), \
- [q0_l] "r" (q0_l), [q0_r] "r" (q0_r), \
- [q1_l] "r" (q1_l), [q1_r] "r" (q1_r), \
- [q2_l] "r" (q2_l), [q2_r] "r" (q2_r) \
- ); \
-}
-
-#define COMBINE_LEFT_RIGHT_3TO6() { \
- __asm__ __volatile__ ( \
- "precr.qb.ph %[p6], %[p6_l], %[p6_r] \n\t" \
- "precr.qb.ph %[p5], %[p5_l], %[p5_r] \n\t" \
- "precr.qb.ph %[p4], %[p4_l], %[p4_r] \n\t" \
- "precr.qb.ph %[p3], %[p3_l], %[p3_r] \n\t" \
- "precr.qb.ph %[q3], %[q3_l], %[q3_r] \n\t" \
- "precr.qb.ph %[q4], %[q4_l], %[q4_r] \n\t" \
- "precr.qb.ph %[q5], %[q5_l], %[q5_r] \n\t" \
- "precr.qb.ph %[q6], %[q6_l], %[q6_r] \n\t" \
- \
- : [p6] "=&r" (p6),[p5] "=&r" (p5), \
- [p4] "=&r" (p4),[p3] "=&r" (p3), \
- [q3] "=&r" (q3),[q4] "=&r" (q4), \
- [q5] "=&r" (q5),[q6] "=&r" (q6) \
- : [p6_l] "r" (p6_l), [p5_l] "r" (p5_l), \
- [p4_l] "r" (p4_l), [p3_l] "r" (p3_l), \
- [p6_r] "r" (p6_r), [p5_r] "r" (p5_r), \
- [p4_r] "r" (p4_r), [p3_r] "r" (p3_r), \
- [q3_l] "r" (q3_l), [q4_l] "r" (q4_l), \
- [q5_l] "r" (q5_l), [q6_l] "r" (q6_l), \
- [q3_r] "r" (q3_r), [q4_r] "r" (q4_r), \
- [q5_r] "r" (q5_r), [q6_r] "r" (q6_r) \
- ); \
-}
-
-#endif // #if HAVE_DSPR2
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MACROS_DSPR2_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h
deleted file mode 100644
index 5b0d9cc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MASKS_DSPR2_H_
-#define VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MASKS_DSPR2_H_
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if HAVE_DSPR2
-/* processing 4 pixels at the same time
- * compute hev and mask in the same function */
-static INLINE void vp9_filter_hev_mask_dspr2(uint32_t limit, uint32_t flimit,
- uint32_t p1, uint32_t p0,
- uint32_t p3, uint32_t p2,
- uint32_t q0, uint32_t q1,
- uint32_t q2, uint32_t q3,
- uint32_t thresh, uint32_t *hev,
- uint32_t *mask) {
- uint32_t c, r, r3, r_k;
- uint32_t s1, s2, s3;
- uint32_t ones = 0xFFFFFFFF;
- uint32_t hev1;
-
- __asm__ __volatile__ (
- /* mask |= (abs(p3 - p2) > limit) */
- "subu_s.qb %[c], %[p3], %[p2] \n\t"
- "subu_s.qb %[r_k], %[p2], %[p3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], $0, %[c] \n\t"
-
- /* mask |= (abs(p2 - p1) > limit) */
- "subu_s.qb %[c], %[p2], %[p1] \n\t"
- "subu_s.qb %[r_k], %[p1], %[p2] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- /* mask |= (abs(p1 - p0) > limit)
- * hev |= (abs(p1 - p0) > thresh)
- */
- "subu_s.qb %[c], %[p1], %[p0] \n\t"
- "subu_s.qb %[r_k], %[p0], %[p1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[thresh], %[r_k] \n\t"
- "or %[r3], $0, %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- /* mask |= (abs(q1 - q0) > limit)
- * hev |= (abs(q1 - q0) > thresh)
- */
- "subu_s.qb %[c], %[q1], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[q1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[thresh], %[r_k] \n\t"
- "or %[r3], %[r3], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- /* mask |= (abs(q2 - q1) > limit) */
- "subu_s.qb %[c], %[q2], %[q1] \n\t"
- "subu_s.qb %[r_k], %[q1], %[q2] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "sll %[r3], %[r3], 24 \n\t"
-
- /* mask |= (abs(q3 - q2) > limit) */
- "subu_s.qb %[c], %[q3], %[q2] \n\t"
- "subu_s.qb %[r_k], %[q2], %[q3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- : [c] "=&r" (c), [r_k] "=&r" (r_k),
- [r] "=&r" (r), [r3] "=&r" (r3)
- : [limit] "r" (limit), [p3] "r" (p3), [p2] "r" (p2),
- [p1] "r" (p1), [p0] "r" (p0), [q1] "r" (q1), [q0] "r" (q0),
- [q2] "r" (q2), [q3] "r" (q3), [thresh] "r" (thresh)
- );
-
- __asm__ __volatile__ (
- /* abs(p0 - q0) */
- "subu_s.qb %[c], %[p0], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[p0] \n\t"
- "wrdsp %[r3] \n\t"
- "or %[s1], %[r_k], %[c] \n\t"
-
- /* abs(p1 - q1) */
- "subu_s.qb %[c], %[p1], %[q1] \n\t"
- "addu_s.qb %[s3], %[s1], %[s1] \n\t"
- "pick.qb %[hev1], %[ones], $0 \n\t"
- "subu_s.qb %[r_k], %[q1], %[p1] \n\t"
- "or %[s2], %[r_k], %[c] \n\t"
-
- /* abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > flimit * 2 + limit */
- "shrl.qb %[s2], %[s2], 1 \n\t"
- "addu_s.qb %[s1], %[s2], %[s3] \n\t"
- "cmpgu.lt.qb %[c], %[flimit], %[s1] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "sll %[r], %[r], 24 \n\t"
-
- "wrdsp %[r] \n\t"
- "pick.qb %[s2], $0, %[ones] \n\t"
-
- : [c] "=&r" (c), [r_k] "=&r" (r_k), [s1] "=&r" (s1), [hev1] "=&r" (hev1),
- [s2] "=&r" (s2), [r] "+r" (r), [s3] "=&r" (s3)
- : [p0] "r" (p0), [q0] "r" (q0), [p1] "r" (p1), [r3] "r" (r3),
- [q1] "r" (q1), [ones] "r" (ones), [flimit] "r" (flimit)
- );
-
- *hev = hev1;
- *mask = s2;
-}
-
-static INLINE void vp9_filter_hev_mask_flatmask4_dspr2(uint32_t limit,
- uint32_t flimit,
- uint32_t thresh,
- uint32_t p1, uint32_t p0,
- uint32_t p3, uint32_t p2,
- uint32_t q0, uint32_t q1,
- uint32_t q2, uint32_t q3,
- uint32_t *hev,
- uint32_t *mask,
- uint32_t *flat) {
- uint32_t c, r, r3, r_k, r_flat;
- uint32_t s1, s2, s3;
- uint32_t ones = 0xFFFFFFFF;
- uint32_t flat_thresh = 0x01010101;
- uint32_t hev1;
- uint32_t flat1;
-
- __asm__ __volatile__ (
- /* mask |= (abs(p3 - p2) > limit) */
- "subu_s.qb %[c], %[p3], %[p2] \n\t"
- "subu_s.qb %[r_k], %[p2], %[p3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], $0, %[c] \n\t"
-
- /* mask |= (abs(p2 - p1) > limit) */
- "subu_s.qb %[c], %[p2], %[p1] \n\t"
- "subu_s.qb %[r_k], %[p1], %[p2] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- /* mask |= (abs(p1 - p0) > limit)
- * hev |= (abs(p1 - p0) > thresh)
- * flat |= (abs(p1 - p0) > thresh)
- */
- "subu_s.qb %[c], %[p1], %[p0] \n\t"
- "subu_s.qb %[r_k], %[p0], %[p1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[thresh], %[r_k] \n\t"
- "or %[r3], $0, %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], $0, %[c] \n\t"
-
- /* mask |= (abs(q1 - q0) > limit)
- * hev |= (abs(q1 - q0) > thresh)
- * flat |= (abs(q1 - q0) > thresh)
- */
- "subu_s.qb %[c], %[q1], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[q1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[thresh], %[r_k] \n\t"
- "or %[r3], %[r3], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(p0 - p2) > thresh) */
- "subu_s.qb %[c], %[p0], %[p2] \n\t"
- "subu_s.qb %[r_k], %[p2], %[p0] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(q0 - q2) > thresh) */
- "subu_s.qb %[c], %[q0], %[q2] \n\t"
- "subu_s.qb %[r_k], %[q2], %[q0] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(p3 - p0) > thresh) */
- "subu_s.qb %[c], %[p3], %[p0] \n\t"
- "subu_s.qb %[r_k], %[p0], %[p3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(q3 - q0) > thresh) */
- "subu_s.qb %[c], %[q3], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[q3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
- "sll %[r_flat], %[r_flat], 24 \n\t"
- /* look at stall here */
- "wrdsp %[r_flat] \n\t"
- "pick.qb %[flat1], $0, %[ones] \n\t"
-
- /* mask |= (abs(q2 - q1) > limit) */
- "subu_s.qb %[c], %[q2], %[q1] \n\t"
- "subu_s.qb %[r_k], %[q1], %[q2] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "sll %[r3], %[r3], 24 \n\t"
-
- /* mask |= (abs(q3 - q2) > limit) */
- "subu_s.qb %[c], %[q3], %[q2] \n\t"
- "subu_s.qb %[r_k], %[q2], %[q3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[limit], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
-
- : [c] "=&r" (c), [r_k] "=&r" (r_k), [r] "=&r" (r), [r3] "=&r" (r3),
- [r_flat] "=&r" (r_flat), [flat1] "=&r" (flat1)
- : [limit] "r" (limit), [p3] "r" (p3), [p2] "r" (p2),
- [p1] "r" (p1), [p0] "r" (p0), [q1] "r" (q1), [q0] "r" (q0),
- [q2] "r" (q2), [q3] "r" (q3), [thresh] "r" (thresh),
- [flat_thresh] "r" (flat_thresh), [ones] "r" (ones)
- );
-
- __asm__ __volatile__ (
- /* abs(p0 - q0) */
- "subu_s.qb %[c], %[p0], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[p0] \n\t"
- "wrdsp %[r3] \n\t"
- "or %[s1], %[r_k], %[c] \n\t"
-
- /* abs(p1 - q1) */
- "subu_s.qb %[c], %[p1], %[q1] \n\t"
- "addu_s.qb %[s3], %[s1], %[s1] \n\t"
- "pick.qb %[hev1], %[ones], $0 \n\t"
- "subu_s.qb %[r_k], %[q1], %[p1] \n\t"
- "or %[s2], %[r_k], %[c] \n\t"
-
- /* abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > flimit * 2 + limit */
- "shrl.qb %[s2], %[s2], 1 \n\t"
- "addu_s.qb %[s1], %[s2], %[s3] \n\t"
- "cmpgu.lt.qb %[c], %[flimit], %[s1] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "sll %[r], %[r], 24 \n\t"
-
- "wrdsp %[r] \n\t"
- "pick.qb %[s2], $0, %[ones] \n\t"
-
- : [c] "=&r" (c), [r_k] "=&r" (r_k), [s1] "=&r" (s1), [hev1] "=&r" (hev1),
- [s2] "=&r" (s2), [r] "+r" (r), [s3] "=&r" (s3)
- : [p0] "r" (p0), [q0] "r" (q0), [p1] "r" (p1), [r3] "r" (r3),
- [q1] "r" (q1), [ones] "r" (ones), [flimit] "r" (flimit)
- );
-
- *hev = hev1;
- *mask = s2;
- *flat = flat1;
-}
-
-static INLINE void vp9_flatmask5(uint32_t p4, uint32_t p3,
- uint32_t p2, uint32_t p1,
- uint32_t p0, uint32_t q0,
- uint32_t q1, uint32_t q2,
- uint32_t q3, uint32_t q4,
- uint32_t *flat2) {
- uint32_t c, r, r_k, r_flat;
- uint32_t ones = 0xFFFFFFFF;
- uint32_t flat_thresh = 0x01010101;
- uint32_t flat1, flat3;
-
- __asm__ __volatile__ (
- /* flat |= (abs(p4 - p0) > thresh) */
- "subu_s.qb %[c], %[p4], %[p0] \n\t"
- "subu_s.qb %[r_k], %[p0], %[p4] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r], $0, %[c] \n\t"
-
- /* flat |= (abs(q4 - q0) > thresh) */
- "subu_s.qb %[c], %[q4], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[q4] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r], %[r], %[c] \n\t"
- "sll %[r], %[r], 24 \n\t"
- "wrdsp %[r] \n\t"
- "pick.qb %[flat3], $0, %[ones] \n\t"
-
- /* flat |= (abs(p1 - p0) > thresh) */
- "subu_s.qb %[c], %[p1], %[p0] \n\t"
- "subu_s.qb %[r_k], %[p0], %[p1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], $0, %[c] \n\t"
-
- /* flat |= (abs(q1 - q0) > thresh) */
- "subu_s.qb %[c], %[q1], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[q1] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(p0 - p2) > thresh) */
- "subu_s.qb %[c], %[p0], %[p2] \n\t"
- "subu_s.qb %[r_k], %[p2], %[p0] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(q0 - q2) > thresh) */
- "subu_s.qb %[c], %[q0], %[q2] \n\t"
- "subu_s.qb %[r_k], %[q2], %[q0] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(p3 - p0) > thresh) */
- "subu_s.qb %[c], %[p3], %[p0] \n\t"
- "subu_s.qb %[r_k], %[p0], %[p3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
-
- /* flat |= (abs(q3 - q0) > thresh) */
- "subu_s.qb %[c], %[q3], %[q0] \n\t"
- "subu_s.qb %[r_k], %[q0], %[q3] \n\t"
- "or %[r_k], %[r_k], %[c] \n\t"
- "cmpgu.lt.qb %[c], %[flat_thresh], %[r_k] \n\t"
- "or %[r_flat], %[r_flat], %[c] \n\t"
- "sll %[r_flat], %[r_flat], 24 \n\t"
- "wrdsp %[r_flat] \n\t"
- "pick.qb %[flat1], $0, %[ones] \n\t"
- /* flat & flatmask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3) */
- "and %[flat1], %[flat3], %[flat1] \n\t"
-
- : [c] "=&r" (c), [r_k] "=&r" (r_k), [r] "=&r" (r),
- [r_flat] "=&r" (r_flat), [flat1] "=&r" (flat1), [flat3] "=&r" (flat3)
- : [p4] "r" (p4), [p3] "r" (p3), [p2] "r" (p2),
- [p1] "r" (p1), [p0] "r" (p0), [q0] "r" (q0), [q1] "r" (q1),
- [q2] "r" (q2), [q3] "r" (q3), [q4] "r" (q4),
- [flat_thresh] "r" (flat_thresh), [ones] "r" (ones)
- );
-
- *flat2 = flat1;
-}
-#endif // #if HAVE_DSPR2
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MASKS_DSPR2_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mbloop_loopfilter_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mbloop_loopfilter_dspr2.c
deleted file mode 100644
index 7cd0b63..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mbloop_loopfilter_dspr2.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_lpf_horizontal_8_dspr2(unsigned char *s,
- int pitch,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh,
- int count) {
- uint32_t mask;
- uint32_t hev, flat;
- uint8_t i;
- uint8_t *sp3, *sp2, *sp1, *sp0, *sq0, *sq1, *sq2, *sq3;
- uint32_t thresh_vec, flimit_vec, limit_vec;
- uint32_t uflimit, ulimit, uthresh;
- uint32_t p1_f0, p0_f0, q0_f0, q1_f0;
- uint32_t p3, p2, p1, p0, q0, q1, q2, q3;
- uint32_t p0_l, p1_l, p2_l, p3_l, q0_l, q1_l, q2_l, q3_l;
- uint32_t p0_r, p1_r, p2_r, p3_r, q0_r, q1_r, q2_r, q3_r;
-
- uflimit = *blimit;
- ulimit = *limit;
- uthresh = *thresh;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[uthresh] \n\t"
- "replv.qb %[flimit_vec], %[uflimit] \n\t"
- "replv.qb %[limit_vec], %[ulimit] \n\t"
-
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec),
- [limit_vec] "=r" (limit_vec)
- : [uthresh] "r" (uthresh), [uflimit] "r" (uflimit), [ulimit] "r" (ulimit)
- );
-
- /* prefetch data for store */
- vp9_prefetch_store(s);
-
- for (i = 0; i < 2; i++) {
- sp3 = s - (pitch << 2);
- sp2 = sp3 + pitch;
- sp1 = sp2 + pitch;
- sp0 = sp1 + pitch;
- sq0 = s;
- sq1 = s + pitch;
- sq2 = sq1 + pitch;
- sq3 = sq2 + pitch;
-
- __asm__ __volatile__ (
- "lw %[p3], (%[sp3]) \n\t"
- "lw %[p2], (%[sp2]) \n\t"
- "lw %[p1], (%[sp1]) \n\t"
- "lw %[p0], (%[sp0]) \n\t"
- "lw %[q0], (%[sq0]) \n\t"
- "lw %[q1], (%[sq1]) \n\t"
- "lw %[q2], (%[sq2]) \n\t"
- "lw %[q3], (%[sq3]) \n\t"
-
- : [p3] "=&r" (p3), [p2] "=&r" (p2), [p1] "=&r" (p1), [p0] "=&r" (p0),
- [q3] "=&r" (q3), [q2] "=&r" (q2), [q1] "=&r" (q1), [q0] "=&r" (q0)
- : [sp3] "r" (sp3), [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq3] "r" (sq3), [sq2] "r" (sq2), [sq1] "r" (sq1), [sq0] "r" (sq0)
- );
-
- vp9_filter_hev_mask_flatmask4_dspr2(limit_vec, flimit_vec, thresh_vec,
- p1, p0, p3, p2, q0, q1, q2, q3,
- &hev, &mask, &flat);
-
- if ((flat == 0) && (mask != 0)) {
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- __asm__ __volatile__ (
- "sw %[p1_f0], (%[sp1]) \n\t"
- "sw %[p0_f0], (%[sp0]) \n\t"
- "sw %[q0_f0], (%[sq0]) \n\t"
- "sw %[q1_f0], (%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- } else if ((mask & flat) == 0xFFFFFFFF) {
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- COMBINE_LEFT_RIGHT_0TO2()
-
- __asm__ __volatile__ (
- "sw %[p2], (%[sp2]) \n\t"
- "sw %[p1], (%[sp1]) \n\t"
- "sw %[p0], (%[sp0]) \n\t"
- "sw %[q0], (%[sq0]) \n\t"
- "sw %[q1], (%[sq1]) \n\t"
- "sw %[q2], (%[sq2]) \n\t"
-
- :
- : [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0),
- [q0] "r" (q0), [q1] "r" (q1), [q2] "r" (q2),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if ((flat != 0) && (mask != 0)) {
- /* filtering */
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- if (mask & flat & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p2_r], (%[sp2]) \n\t"
- "sb %[p1_r], (%[sp1]) \n\t"
- "sb %[p0_r], (%[sp0]) \n\t"
- "sb %[q0_r], (%[sq0]) \n\t"
- "sb %[q1_r], (%[sq1]) \n\t"
- "sb %[q2_r], (%[sq2]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p1_f0], (%[sp1]) \n\t"
- "sb %[p0_f0], (%[sp0]) \n\t"
- "sb %[q0_f0], (%[sq0]) \n\t"
- "sb %[q1_f0], (%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_r], %[p2_r], 16 \n\t"
- "srl %[p1_r], %[p1_r], 16 \n\t"
- "srl %[p0_r], %[p0_r], 16 \n\t"
- "srl %[q0_r], %[q0_r], 16 \n\t"
- "srl %[q1_r], %[q1_r], 16 \n\t"
- "srl %[q2_r], %[q2_r], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_r] "+r" (p2_r), [p1_r] "+r" (p1_r), [p0_r] "+r" (p0_r),
- [q0_r] "+r" (q0_r), [q1_r] "+r" (q1_r), [q2_r] "+r" (q2_r),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p2_r], +1(%[sp2]) \n\t"
- "sb %[p1_r], +1(%[sp1]) \n\t"
- "sb %[p0_r], +1(%[sp0]) \n\t"
- "sb %[q0_r], +1(%[sq0]) \n\t"
- "sb %[q1_r], +1(%[sq1]) \n\t"
- "sb %[q2_r], +1(%[sq2]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +1(%[sp1]) \n\t"
- "sb %[p0_f0], +1(%[sp0]) \n\t"
- "sb %[q0_f0], +1(%[sq0]) \n\t"
- "sb %[q1_f0], +1(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0),
- [q0] "+r" (q0), [q1] "+r" (q1), [q2] "+r" (q2),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p2_l], +2(%[sp2]) \n\t"
- "sb %[p1_l], +2(%[sp1]) \n\t"
- "sb %[p0_l], +2(%[sp0]) \n\t"
- "sb %[q0_l], +2(%[sq0]) \n\t"
- "sb %[q1_l], +2(%[sq1]) \n\t"
- "sb %[q2_l], +2(%[sq2]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +2(%[sp1]) \n\t"
- "sb %[p0_f0], +2(%[sp0]) \n\t"
- "sb %[q0_f0], +2(%[sq0]) \n\t"
- "sb %[q1_f0], +2(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_l], %[p2_l], 16 \n\t"
- "srl %[p1_l], %[p1_l], 16 \n\t"
- "srl %[p0_l], %[p0_l], 16 \n\t"
- "srl %[q0_l], %[q0_l], 16 \n\t"
- "srl %[q1_l], %[q1_l], 16 \n\t"
- "srl %[q2_l], %[q2_l], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_l] "+r" (p2_l), [p1_l] "+r" (p1_l), [p0_l] "+r" (p0_l),
- [q0_l] "+r" (q0_l), [q1_l] "+r" (q1_l), [q2_l] "+r" (q2_l),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p2_l], +3(%[sp2]) \n\t"
- "sb %[p1_l], +3(%[sp1]) \n\t"
- "sb %[p0_l], +3(%[sp0]) \n\t"
- "sb %[q0_l], +3(%[sq0]) \n\t"
- "sb %[q1_l], +3(%[sq1]) \n\t"
- "sb %[q2_l], +3(%[sq2]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +3(%[sp1]) \n\t"
- "sb %[p0_f0], +3(%[sp0]) \n\t"
- "sb %[q0_f0], +3(%[sq0]) \n\t"
- "sb %[q1_f0], +3(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
- }
-
- s = s + 4;
- }
-}
-
-void vp9_lpf_vertical_8_dspr2(unsigned char *s,
- int pitch,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh,
- int count) {
- uint8_t i;
- uint32_t mask, hev, flat;
- uint8_t *s1, *s2, *s3, *s4;
- uint32_t prim1, prim2, sec3, sec4, prim3, prim4;
- uint32_t thresh_vec, flimit_vec, limit_vec;
- uint32_t uflimit, ulimit, uthresh;
- uint32_t p3, p2, p1, p0, q3, q2, q1, q0;
- uint32_t p1_f0, p0_f0, q0_f0, q1_f0;
- uint32_t p0_l, p1_l, p2_l, p3_l, q0_l, q1_l, q2_l, q3_l;
- uint32_t p0_r, p1_r, p2_r, p3_r, q0_r, q1_r, q2_r, q3_r;
-
- uflimit = *blimit;
- ulimit = *limit;
- uthresh = *thresh;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[uthresh] \n\t"
- "replv.qb %[flimit_vec], %[uflimit] \n\t"
- "replv.qb %[limit_vec], %[ulimit] \n\t"
-
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec),
- [limit_vec] "=r" (limit_vec)
- : [uthresh] "r" (uthresh), [uflimit] "r" (uflimit), [ulimit] "r" (ulimit)
- );
-
- vp9_prefetch_store(s + pitch);
-
- for (i = 0; i < 2; i++) {
- s1 = s;
- s2 = s + pitch;
- s3 = s2 + pitch;
- s4 = s3 + pitch;
- s = s4 + pitch;
-
- __asm__ __volatile__ (
- "lw %[p0], -4(%[s1]) \n\t"
- "lw %[p1], -4(%[s2]) \n\t"
- "lw %[p2], -4(%[s3]) \n\t"
- "lw %[p3], -4(%[s4]) \n\t"
- "lw %[q3], (%[s1]) \n\t"
- "lw %[q2], (%[s2]) \n\t"
- "lw %[q1], (%[s3]) \n\t"
- "lw %[q0], (%[s4]) \n\t"
-
- : [p3] "=&r" (p3), [p2] "=&r" (p2), [p1] "=&r" (p1), [p0] "=&r" (p0),
- [q0] "=&r" (q0), [q1] "=&r" (q1), [q2] "=&r" (q2), [q3] "=&r" (q3)
- : [s1] "r" (s1), [s2] "r" (s2), [s3] "r" (s3), [s4] "r" (s4)
- );
-
- /* transpose p3, p2, p1, p0
- original (when loaded from memory)
- register -4 -3 -2 -1
- p0 p0_0 p0_1 p0_2 p0_3
- p1 p1_0 p1_1 p1_2 p1_3
- p2 p2_0 p2_1 p2_2 p2_3
- p3 p3_0 p3_1 p3_2 p3_3
-
- after transpose
- register
- p0 p3_3 p2_3 p1_3 p0_3
- p1 p3_2 p2_2 p1_2 p0_2
- p2 p3_1 p2_1 p1_1 p0_1
- p3 p3_0 p2_0 p1_0 p0_0
- */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p0], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p0], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p2], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p2], %[p3] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p0], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p2], %[p3], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p0] "+r" (p0), [p1] "+r" (p1), [p2] "+r" (p2), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose q0, q1, q2, q3
- original (when loaded from memory)
- register +1 +2 +3 +4
- q3 q3_0 q3_1 q3_2 q3_3
- q2 q2_0 q2_1 q2_2 q2_3
- q1 q1_0 q1_1 q1_2 q1_3
- q0 q0_0 q0_1 q0_2 q0_3
-
- after transpose
- register
- q3 q0_3 q1_3 q2_3 q3_3
- q2 q0_2 q1_2 q2_2 q3_2
- q1 q0_1 q1_1 q2_1 q3_1
- q0 q0_0 q1_0 q2_0 q3_0
- */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[q3], %[q2] \n\t"
- "precr.qb.ph %[prim2], %[q3], %[q2] \n\t"
- "precrq.qb.ph %[prim3], %[q1], %[q0] \n\t"
- "precr.qb.ph %[prim4], %[q1], %[q0] \n\t"
-
- "precrq.qb.ph %[q2], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[q0], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[q3], %[q2], %[sec3] \n\t"
- "precrq.ph.w %[q1], %[q0], %[sec4] \n\t"
- "append %[q2], %[sec3], 16 \n\t"
- "append %[q0], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [q3] "+r" (q3), [q2] "+r" (q2), [q1] "+r" (q1), [q0] "+r" (q0),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- vp9_filter_hev_mask_flatmask4_dspr2(limit_vec, flimit_vec, thresh_vec,
- p1, p0, p3, p2, q0, q1, q2, q3,
- &hev, &mask, &flat);
-
- if ((flat == 0) && (mask != 0)) {
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
- STORE_F0()
- } else if ((mask & flat) == 0xFFFFFFFF) {
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- STORE_F1()
- } else if ((flat != 0) && (mask != 0)) {
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- if (mask & flat & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p2_r], -3(%[s4]) \n\t"
- "sb %[p1_r], -2(%[s4]) \n\t"
- "sb %[p0_r], -1(%[s4]) \n\t"
- "sb %[q0_r], (%[s4]) \n\t"
- "sb %[q1_r], +1(%[s4]) \n\t"
- "sb %[q2_r], +2(%[s4]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [s4] "r" (s4)
- );
- } else if (mask & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s4]) \n\t"
- "sb %[p0_f0], -1(%[s4]) \n\t"
- "sb %[q0_f0], (%[s4]) \n\t"
- "sb %[q1_f0], +1(%[s4]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s4] "r" (s4)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_r], %[p2_r], 16 \n\t"
- "srl %[p1_r], %[p1_r], 16 \n\t"
- "srl %[p0_r], %[p0_r], 16 \n\t"
- "srl %[q0_r], %[q0_r], 16 \n\t"
- "srl %[q1_r], %[q1_r], 16 \n\t"
- "srl %[q2_r], %[q2_r], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_r] "+r" (p2_r), [p1_r] "+r" (p1_r), [p0_r] "+r" (p0_r),
- [q0_r] "+r" (q0_r), [q1_r] "+r" (q1_r), [q2_r] "+r" (q2_r),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p2_r], -3(%[s3]) \n\t"
- "sb %[p1_r], -2(%[s3]) \n\t"
- "sb %[p0_r], -1(%[s3]) \n\t"
- "sb %[q0_r], (%[s3]) \n\t"
- "sb %[q1_r], +1(%[s3]) \n\t"
- "sb %[q2_r], +2(%[s3]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [s3] "r" (s3)
- );
- } else if (mask & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s3]) \n\t"
- "sb %[p0_f0], -1(%[s3]) \n\t"
- "sb %[q0_f0], (%[s3]) \n\t"
- "sb %[q1_f0], +1(%[s3]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s3] "r" (s3)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2] "+r" (p2), [p1] "+r" (p1), [p0] "+r" (p0),
- [q0] "+r" (q0), [q1] "+r" (q1), [q2] "+r" (q2),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p2_l], -3(%[s2]) \n\t"
- "sb %[p1_l], -2(%[s2]) \n\t"
- "sb %[p0_l], -1(%[s2]) \n\t"
- "sb %[q0_l], (%[s2]) \n\t"
- "sb %[q1_l], +1(%[s2]) \n\t"
- "sb %[q2_l], +2(%[s2]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [s2] "r" (s2)
- );
- } else if (mask & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s2]) \n\t"
- "sb %[p0_f0], -1(%[s2]) \n\t"
- "sb %[q0_f0], (%[s2]) \n\t"
- "sb %[q1_f0], +1(%[s2]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s2] "r" (s2)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_l], %[p2_l], 16 \n\t"
- "srl %[p1_l], %[p1_l], 16 \n\t"
- "srl %[p0_l], %[p0_l], 16 \n\t"
- "srl %[q0_l], %[q0_l], 16 \n\t"
- "srl %[q1_l], %[q1_l], 16 \n\t"
- "srl %[q2_l], %[q2_l], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_l] "+r" (p2_l), [p1_l] "+r" (p1_l), [p0_l] "+r" (p0_l),
- [q0_l] "+r" (q0_l), [q1_l] "+r" (q1_l), [q2_l] "+r" (q2_l),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p2_l], -3(%[s1]) \n\t"
- "sb %[p1_l], -2(%[s1]) \n\t"
- "sb %[p0_l], -1(%[s1]) \n\t"
- "sb %[q0_l], (%[s1]) \n\t"
- "sb %[q1_l], +1(%[s1]) \n\t"
- "sb %[q2_l], +2(%[s1]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [s1] "r" (s1)
- );
- } else if (mask & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s1]) \n\t"
- "sb %[p0_f0], -1(%[s1]) \n\t"
- "sb %[q0_f0], (%[s1]) \n\t"
- "sb %[q1_f0], +1(%[s1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0), [q0_f0] "r" (q0_f0),
- [q1_f0] "r" (q1_f0), [s1] "r" (s1)
- );
- }
- }
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_horiz_loopfilter_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_horiz_loopfilter_dspr2.c
deleted file mode 100644
index 6c94674..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_horiz_loopfilter_dspr2.c
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_lpf_horizontal_16_dspr2(unsigned char *s,
- int pitch,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh,
- int count) {
- uint32_t mask;
- uint32_t hev, flat, flat2;
- uint8_t i;
- uint8_t *sp7, *sp6, *sp5, *sp4, *sp3, *sp2, *sp1, *sp0;
- uint8_t *sq0, *sq1, *sq2, *sq3, *sq4, *sq5, *sq6, *sq7;
- uint32_t thresh_vec, flimit_vec, limit_vec;
- uint32_t uflimit, ulimit, uthresh;
- uint32_t p7, p6, p5, p4, p3, p2, p1, p0, q0, q1, q2, q3, q4, q5, q6, q7;
- uint32_t p1_f0, p0_f0, q0_f0, q1_f0;
- uint32_t p7_l, p6_l, p5_l, p4_l, p3_l, p2_l, p1_l, p0_l;
- uint32_t q0_l, q1_l, q2_l, q3_l, q4_l, q5_l, q6_l, q7_l;
- uint32_t p7_r, p6_r, p5_r, p4_r, p3_r, p2_r, p1_r, p0_r;
- uint32_t q0_r, q1_r, q2_r, q3_r, q4_r, q5_r, q6_r, q7_r;
- uint32_t p2_l_f1, p1_l_f1, p0_l_f1, p2_r_f1, p1_r_f1, p0_r_f1;
- uint32_t q0_l_f1, q1_l_f1, q2_l_f1, q0_r_f1, q1_r_f1, q2_r_f1;
-
- uflimit = *blimit;
- ulimit = *limit;
- uthresh = *thresh;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[uthresh] \n\t"
- "replv.qb %[flimit_vec], %[uflimit] \n\t"
- "replv.qb %[limit_vec], %[ulimit] \n\t"
-
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec),
- [limit_vec] "=r" (limit_vec)
- : [uthresh] "r" (uthresh), [uflimit] "r" (uflimit), [ulimit] "r" (ulimit)
- );
-
- /* prefetch data for store */
- vp9_prefetch_store(s);
-
- for (i = 0; i < (2 * count); i++) {
- sp7 = s - (pitch << 3);
- sp6 = sp7 + pitch;
- sp5 = sp6 + pitch;
- sp4 = sp5 + pitch;
- sp3 = sp4 + pitch;
- sp2 = sp3 + pitch;
- sp1 = sp2 + pitch;
- sp0 = sp1 + pitch;
- sq0 = s;
- sq1 = s + pitch;
- sq2 = sq1 + pitch;
- sq3 = sq2 + pitch;
- sq4 = sq3 + pitch;
- sq5 = sq4 + pitch;
- sq6 = sq5 + pitch;
- sq7 = sq6 + pitch;
-
- __asm__ __volatile__ (
- "lw %[p7], (%[sp7]) \n\t"
- "lw %[p6], (%[sp6]) \n\t"
- "lw %[p5], (%[sp5]) \n\t"
- "lw %[p4], (%[sp4]) \n\t"
- "lw %[p3], (%[sp3]) \n\t"
- "lw %[p2], (%[sp2]) \n\t"
- "lw %[p1], (%[sp1]) \n\t"
- "lw %[p0], (%[sp0]) \n\t"
-
- : [p3] "=&r" (p3), [p2] "=&r" (p2), [p1] "=&r" (p1), [p0] "=&r" (p0),
- [p7] "=&r" (p7), [p6] "=&r" (p6), [p5] "=&r" (p5), [p4] "=&r" (p4)
- : [sp3] "r" (sp3), [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sp4] "r" (sp4), [sp5] "r" (sp5), [sp6] "r" (sp6), [sp7] "r" (sp7)
- );
-
- __asm__ __volatile__ (
- "lw %[q0], (%[sq0]) \n\t"
- "lw %[q1], (%[sq1]) \n\t"
- "lw %[q2], (%[sq2]) \n\t"
- "lw %[q3], (%[sq3]) \n\t"
- "lw %[q4], (%[sq4]) \n\t"
- "lw %[q5], (%[sq5]) \n\t"
- "lw %[q6], (%[sq6]) \n\t"
- "lw %[q7], (%[sq7]) \n\t"
-
- : [q3] "=&r" (q3), [q2] "=&r" (q2), [q1] "=&r" (q1), [q0] "=&r" (q0),
- [q7] "=&r" (q7), [q6] "=&r" (q6), [q5] "=&r" (q5), [q4] "=&r" (q4)
- : [sq3] "r" (sq3), [sq2] "r" (sq2), [sq1] "r" (sq1), [sq0] "r" (sq0),
- [sq4] "r" (sq4), [sq5] "r" (sq5), [sq6] "r" (sq6), [sq7] "r" (sq7)
- );
-
- vp9_filter_hev_mask_flatmask4_dspr2(limit_vec, flimit_vec, thresh_vec,
- p1, p0, p3, p2, q0, q1, q2, q3,
- &hev, &mask, &flat);
-
- vp9_flatmask5(p7, p6, p5, p4, p0, q0, q4, q5, q6, q7, &flat2);
-
- /* f0 */
- if (((flat2 == 0) && (flat == 0) && (mask != 0)) ||
- ((flat2 != 0) && (flat == 0) && (mask != 0))) {
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- __asm__ __volatile__ (
- "sw %[p1_f0], (%[sp1]) \n\t"
- "sw %[p0_f0], (%[sp0]) \n\t"
- "sw %[q0_f0], (%[sq0]) \n\t"
- "sw %[q1_f0], (%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- } else if ((flat2 == 0XFFFFFFFF) && (flat == 0xFFFFFFFF) &&
- (mask == 0xFFFFFFFF)) {
- /* f2 */
- PACK_LEFT_0TO3()
- PACK_LEFT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_l, &p6_l, &p5_l, &p4_l,
- &p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l,
- &q4_l, &q5_l, &q6_l, &q7_l);
-
- PACK_RIGHT_0TO3()
- PACK_RIGHT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_r, &p6_r, &p5_r, &p4_r,
- &p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r,
- &q4_r, &q5_r, &q6_r, &q7_r);
-
- COMBINE_LEFT_RIGHT_0TO2()
- COMBINE_LEFT_RIGHT_3TO6()
-
- __asm__ __volatile__ (
- "sw %[p6], (%[sp6]) \n\t"
- "sw %[p5], (%[sp5]) \n\t"
- "sw %[p4], (%[sp4]) \n\t"
- "sw %[p3], (%[sp3]) \n\t"
- "sw %[p2], (%[sp2]) \n\t"
- "sw %[p1], (%[sp1]) \n\t"
- "sw %[p0], (%[sp0]) \n\t"
-
- :
- : [p6] "r" (p6), [p5] "r" (p5), [p4] "r" (p4), [p3] "r" (p3),
- [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0),
- [sp6] "r" (sp6), [sp5] "r" (sp5), [sp4] "r" (sp4), [sp3] "r" (sp3),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0)
- );
-
- __asm__ __volatile__ (
- "sw %[q6], (%[sq6]) \n\t"
- "sw %[q5], (%[sq5]) \n\t"
- "sw %[q4], (%[sq4]) \n\t"
- "sw %[q3], (%[sq3]) \n\t"
- "sw %[q2], (%[sq2]) \n\t"
- "sw %[q1], (%[sq1]) \n\t"
- "sw %[q0], (%[sq0]) \n\t"
-
- :
- : [q6] "r" (q6), [q5] "r" (q5), [q4] "r" (q4), [q3] "r" (q3),
- [q2] "r" (q2), [q1] "r" (q1), [q0] "r" (q0),
- [sq6] "r" (sq6), [sq5] "r" (sq5), [sq4] "r" (sq4), [sq3] "r" (sq3),
- [sq2] "r" (sq2), [sq1] "r" (sq1), [sq0] "r" (sq0)
- );
- } else if ((flat2 == 0) && (flat == 0xFFFFFFFF) && (mask == 0xFFFFFFFF)) {
- /* f1 */
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- COMBINE_LEFT_RIGHT_0TO2()
-
- __asm__ __volatile__ (
- "sw %[p2], (%[sp2]) \n\t"
- "sw %[p1], (%[sp1]) \n\t"
- "sw %[p0], (%[sp0]) \n\t"
- "sw %[q0], (%[sq0]) \n\t"
- "sw %[q1], (%[sq1]) \n\t"
- "sw %[q2], (%[sq2]) \n\t"
-
- :
- : [p2] "r" (p2), [p1] "r" (p1), [p0] "r" (p0),
- [q0] "r" (q0), [q1] "r" (q1), [q2] "r" (q2),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if ((flat2 == 0) && (flat != 0) && (mask != 0)) {
- /* f0+f1 */
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- if (mask & flat & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p2_r], (%[sp2]) \n\t"
- "sb %[p1_r], (%[sp1]) \n\t"
- "sb %[p0_r], (%[sp0]) \n\t"
- "sb %[q0_r], (%[sq0]) \n\t"
- "sb %[q1_r], (%[sq1]) \n\t"
- "sb %[q2_r], (%[sq2]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p1_f0], (%[sp1]) \n\t"
- "sb %[p0_f0], (%[sp0]) \n\t"
- "sb %[q0_f0], (%[sq0]) \n\t"
- "sb %[q1_f0], (%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_r], %[p2_r], 16 \n\t"
- "srl %[p1_r], %[p1_r], 16 \n\t"
- "srl %[p0_r], %[p0_r], 16 \n\t"
- "srl %[q0_r], %[q0_r], 16 \n\t"
- "srl %[q1_r], %[q1_r], 16 \n\t"
- "srl %[q2_r], %[q2_r], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_r] "+r" (p2_r), [p1_r] "+r" (p1_r), [p0_r] "+r" (p0_r),
- [q0_r] "+r" (q0_r), [q1_r] "+r" (q1_r), [q2_r] "+r" (q2_r),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p2_r], +1(%[sp2]) \n\t"
- "sb %[p1_r], +1(%[sp1]) \n\t"
- "sb %[p0_r], +1(%[sp0]) \n\t"
- "sb %[q0_r], +1(%[sq0]) \n\t"
- "sb %[q1_r], +1(%[sq1]) \n\t"
- "sb %[q2_r], +1(%[sq2]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +1(%[sp1]) \n\t"
- "sb %[p0_f0], +1(%[sp0]) \n\t"
- "sb %[q0_f0], +1(%[sq0]) \n\t"
- "sb %[q1_f0], +1(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p2_l], +2(%[sp2]) \n\t"
- "sb %[p1_l], +2(%[sp1]) \n\t"
- "sb %[p0_l], +2(%[sp0]) \n\t"
- "sb %[q0_l], +2(%[sq0]) \n\t"
- "sb %[q1_l], +2(%[sq1]) \n\t"
- "sb %[q2_l], +2(%[sq2]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +2(%[sp1]) \n\t"
- "sb %[p0_f0], +2(%[sp0]) \n\t"
- "sb %[q0_f0], +2(%[sq0]) \n\t"
- "sb %[q1_f0], +2(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_l], %[p2_l], 16 \n\t"
- "srl %[p1_l], %[p1_l], 16 \n\t"
- "srl %[p0_l], %[p0_l], 16 \n\t"
- "srl %[q0_l], %[q0_l], 16 \n\t"
- "srl %[q1_l], %[q1_l], 16 \n\t"
- "srl %[q2_l], %[q2_l], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_l] "+r" (p2_l), [p1_l] "+r" (p1_l), [p0_l] "+r" (p0_l),
- [q0_l] "+r" (q0_l), [q1_l] "+r" (q1_l), [q2_l] "+r" (q2_l),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p2_l], +3(%[sp2]) \n\t"
- "sb %[p1_l], +3(%[sp1]) \n\t"
- "sb %[p0_l], +3(%[sp0]) \n\t"
- "sb %[q0_l], +3(%[sq0]) \n\t"
- "sb %[q1_l], +3(%[sq1]) \n\t"
- "sb %[q2_l], +3(%[sq2]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +3(%[sp1]) \n\t"
- "sb %[p0_f0], +3(%[sp0]) \n\t"
- "sb %[q0_f0], +3(%[sq0]) \n\t"
- "sb %[q1_f0], +3(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
- } else if ((flat2 != 0) && (flat != 0) && (mask != 0)) {
- /* f0 + f1 + f2 */
- /* f0 function */
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- /* f1 function */
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter1_dspr2(p3_l, p2_l, p1_l, p0_l,
- q0_l, q1_l, q2_l, q3_l,
- &p2_l_f1, &p1_l_f1, &p0_l_f1,
- &q0_l_f1, &q1_l_f1, &q2_l_f1);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter1_dspr2(p3_r, p2_r, p1_r, p0_r,
- q0_r, q1_r, q2_r, q3_r,
- &p2_r_f1, &p1_r_f1, &p0_r_f1,
- &q0_r_f1, &q1_r_f1, &q2_r_f1);
-
- /* f2 function */
- PACK_LEFT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_l, &p6_l, &p5_l, &p4_l,
- &p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l,
- &q4_l, &q5_l, &q6_l, &q7_l);
-
- PACK_RIGHT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_r, &p6_r, &p5_r, &p4_r,
- &p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r,
- &q4_r, &q5_r, &q6_r, &q7_r);
-
- if (mask & flat & flat2 & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p6_r], (%[sp6]) \n\t"
- "sb %[p5_r], (%[sp5]) \n\t"
- "sb %[p4_r], (%[sp4]) \n\t"
- "sb %[p3_r], (%[sp3]) \n\t"
- "sb %[p2_r], (%[sp2]) \n\t"
- "sb %[p1_r], (%[sp1]) \n\t"
- "sb %[p0_r], (%[sp0]) \n\t"
-
- :
- : [p6_r] "r" (p6_r), [p5_r] "r" (p5_r), [p4_r] "r" (p4_r),
- [p3_r] "r" (p3_r), [p2_r] "r" (p2_r), [p1_r] "r" (p1_r),
- [sp6] "r" (sp6), [sp5] "r" (sp5), [sp4] "r" (sp4),
- [sp3] "r" (sp3), [sp2] "r" (sp2), [sp1] "r" (sp1),
- [p0_r] "r" (p0_r), [sp0] "r" (sp0)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_r], (%[sq0]) \n\t"
- "sb %[q1_r], (%[sq1]) \n\t"
- "sb %[q2_r], (%[sq2]) \n\t"
- "sb %[q3_r], (%[sq3]) \n\t"
- "sb %[q4_r], (%[sq4]) \n\t"
- "sb %[q5_r], (%[sq5]) \n\t"
- "sb %[q6_r], (%[sq6]) \n\t"
-
- :
- : [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [q3_r] "r" (q3_r), [q4_r] "r" (q4_r), [q5_r] "r" (q5_r),
- [q6_r] "r" (q6_r),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2),
- [sq3] "r" (sq3), [sq4] "r" (sq4), [sq5] "r" (sq5),
- [sq6] "r" (sq6)
- );
- } else if (mask & flat & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p2_r_f1], (%[sp2]) \n\t"
- "sb %[p1_r_f1], (%[sp1]) \n\t"
- "sb %[p0_r_f1], (%[sp0]) \n\t"
- "sb %[q0_r_f1], (%[sq0]) \n\t"
- "sb %[q1_r_f1], (%[sq1]) \n\t"
- "sb %[q2_r_f1], (%[sq2]) \n\t"
-
- :
- : [p2_r_f1] "r" (p2_r_f1), [p1_r_f1] "r" (p1_r_f1),
- [p0_r_f1] "r" (p0_r_f1), [q0_r_f1] "r" (q0_r_f1),
- [q1_r_f1] "r" (q1_r_f1), [q2_r_f1] "r" (q2_r_f1),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p1_f0], (%[sp1]) \n\t"
- "sb %[p0_f0], (%[sp0]) \n\t"
- "sb %[q0_f0], (%[sq0]) \n\t"
- "sb %[q1_f0], (%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0), [q0_f0] "r" (q0_f0),
- [q1_f0] "r" (q1_f0), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p6_r], %[p6_r], 16 \n\t"
- "srl %[p5_r], %[p5_r], 16 \n\t"
- "srl %[p4_r], %[p4_r], 16 \n\t"
- "srl %[p3_r], %[p3_r], 16 \n\t"
- "srl %[p2_r], %[p2_r], 16 \n\t"
- "srl %[p1_r], %[p1_r], 16 \n\t"
- "srl %[p0_r], %[p0_r], 16 \n\t"
- "srl %[q0_r], %[q0_r], 16 \n\t"
- "srl %[q1_r], %[q1_r], 16 \n\t"
- "srl %[q2_r], %[q2_r], 16 \n\t"
- "srl %[q3_r], %[q3_r], 16 \n\t"
- "srl %[q4_r], %[q4_r], 16 \n\t"
- "srl %[q5_r], %[q5_r], 16 \n\t"
- "srl %[q6_r], %[q6_r], 16 \n\t"
-
- : [q0_r] "+r" (q0_r), [q1_r] "+r" (q1_r), [q2_r] "+r" (q2_r),
- [q3_r] "+r" (q3_r), [q4_r] "+r" (q4_r), [q5_r] "+r" (q5_r),
- [p6_r] "+r" (p6_r), [p5_r] "+r" (p5_r), [p4_r] "+r" (p4_r),
- [p3_r] "+r" (p3_r), [p2_r] "+r" (p2_r), [p1_r] "+r" (p1_r),
- [q6_r] "+r" (q6_r), [p0_r] "+r" (p0_r)
- :
- );
-
- __asm__ __volatile__ (
- "srl %[p2_r_f1], %[p2_r_f1], 16 \n\t"
- "srl %[p1_r_f1], %[p1_r_f1], 16 \n\t"
- "srl %[p0_r_f1], %[p0_r_f1], 16 \n\t"
- "srl %[q0_r_f1], %[q0_r_f1], 16 \n\t"
- "srl %[q1_r_f1], %[q1_r_f1], 16 \n\t"
- "srl %[q2_r_f1], %[q2_r_f1], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_r_f1] "+r" (p2_r_f1), [p1_r_f1] "+r" (p1_r_f1),
- [p0_r_f1] "+r" (p0_r_f1), [q0_r_f1] "+r" (q0_r_f1),
- [q1_r_f1] "+r" (q1_r_f1), [q2_r_f1] "+r" (q2_r_f1),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & flat2 & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p6_r], +1(%[sp6]) \n\t"
- "sb %[p5_r], +1(%[sp5]) \n\t"
- "sb %[p4_r], +1(%[sp4]) \n\t"
- "sb %[p3_r], +1(%[sp3]) \n\t"
- "sb %[p2_r], +1(%[sp2]) \n\t"
- "sb %[p1_r], +1(%[sp1]) \n\t"
- "sb %[p0_r], +1(%[sp0]) \n\t"
-
- :
- : [p6_r] "r" (p6_r), [p5_r] "r" (p5_r), [p4_r] "r" (p4_r),
- [p3_r] "r" (p3_r), [p2_r] "r" (p2_r), [p1_r] "r" (p1_r),
- [p0_r] "r" (p0_r), [sp6] "r" (sp6), [sp5] "r" (sp5),
- [sp4] "r" (sp4), [sp3] "r" (sp3),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_r], +1(%[sq0]) \n\t"
- "sb %[q1_r], +1(%[sq1]) \n\t"
- "sb %[q2_r], +1(%[sq2]) \n\t"
- "sb %[q3_r], +1(%[sq3]) \n\t"
- "sb %[q4_r], +1(%[sq4]) \n\t"
- "sb %[q5_r], +1(%[sq5]) \n\t"
- "sb %[q6_r], +1(%[sq6]) \n\t"
-
- :
- : [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [q3_r] "r" (q3_r), [q4_r] "r" (q4_r), [q5_r] "r" (q5_r),
- [q6_r] "r" (q6_r), [sq0] "r" (sq0), [sq1] "r" (sq1),
- [sq2] "r" (sq2), [sq3] "r" (sq3),
- [sq4] "r" (sq4), [sq5] "r" (sq5), [sq6] "r" (sq6)
- );
- } else if (mask & flat & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p2_r_f1], +1(%[sp2]) \n\t"
- "sb %[p1_r_f1], +1(%[sp1]) \n\t"
- "sb %[p0_r_f1], +1(%[sp0]) \n\t"
- "sb %[q0_r_f1], +1(%[sq0]) \n\t"
- "sb %[q1_r_f1], +1(%[sq1]) \n\t"
- "sb %[q2_r_f1], +1(%[sq2]) \n\t"
-
- :
- : [p2_r_f1] "r" (p2_r_f1), [p1_r_f1] "r" (p1_r_f1),
- [p0_r_f1] "r" (p0_r_f1), [q0_r_f1] "r" (q0_r_f1),
- [q1_r_f1] "r" (q1_r_f1), [q2_r_f1] "r" (q2_r_f1),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +1(%[sp1]) \n\t"
- "sb %[p0_f0], +1(%[sp0]) \n\t"
- "sb %[q0_f0], +1(%[sq0]) \n\t"
- "sb %[q1_f0], +1(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0), [q0_f0] "r" (q0_f0),
- [q1_f0] "r" (q1_f0), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & flat2 & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p6_l], +2(%[sp6]) \n\t"
- "sb %[p5_l], +2(%[sp5]) \n\t"
- "sb %[p4_l], +2(%[sp4]) \n\t"
- "sb %[p3_l], +2(%[sp3]) \n\t"
- "sb %[p2_l], +2(%[sp2]) \n\t"
- "sb %[p1_l], +2(%[sp1]) \n\t"
- "sb %[p0_l], +2(%[sp0]) \n\t"
-
- :
- : [p6_l] "r" (p6_l), [p5_l] "r" (p5_l), [p4_l] "r" (p4_l),
- [p3_l] "r" (p3_l), [p2_l] "r" (p2_l), [p1_l] "r" (p1_l),
- [p0_l] "r" (p0_l), [sp6] "r" (sp6), [sp5] "r" (sp5),
- [sp4] "r" (sp4), [sp3] "r" (sp3),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_l], +2(%[sq0]) \n\t"
- "sb %[q1_l], +2(%[sq1]) \n\t"
- "sb %[q2_l], +2(%[sq2]) \n\t"
- "sb %[q3_l], +2(%[sq3]) \n\t"
- "sb %[q4_l], +2(%[sq4]) \n\t"
- "sb %[q5_l], +2(%[sq5]) \n\t"
- "sb %[q6_l], +2(%[sq6]) \n\t"
-
- :
- : [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [q3_l] "r" (q3_l), [q4_l] "r" (q4_l), [q5_l] "r" (q5_l),
- [q6_l] "r" (q6_l), [sq0] "r" (sq0), [sq1] "r" (sq1),
- [sq2] "r" (sq2), [sq3] "r" (sq3),
- [sq4] "r" (sq4), [sq5] "r" (sq5), [sq6] "r" (sq6)
- );
- } else if (mask & flat & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p2_l_f1], +2(%[sp2]) \n\t"
- "sb %[p1_l_f1], +2(%[sp1]) \n\t"
- "sb %[p0_l_f1], +2(%[sp0]) \n\t"
- "sb %[q0_l_f1], +2(%[sq0]) \n\t"
- "sb %[q1_l_f1], +2(%[sq1]) \n\t"
- "sb %[q2_l_f1], +2(%[sq2]) \n\t"
-
- :
- : [p2_l_f1] "r" (p2_l_f1), [p1_l_f1] "r" (p1_l_f1),
- [p0_l_f1] "r" (p0_l_f1), [q0_l_f1] "r" (q0_l_f1),
- [q1_l_f1] "r" (q1_l_f1), [q2_l_f1] "r" (q2_l_f1),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +2(%[sp1]) \n\t"
- "sb %[p0_f0], +2(%[sp0]) \n\t"
- "sb %[q0_f0], +2(%[sq0]) \n\t"
- "sb %[q1_f0], +2(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0), [q0_f0] "r" (q0_f0),
- [q1_f0] "r" (q1_f0), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p6_l], %[p6_l], 16 \n\t"
- "srl %[p5_l], %[p5_l], 16 \n\t"
- "srl %[p4_l], %[p4_l], 16 \n\t"
- "srl %[p3_l], %[p3_l], 16 \n\t"
- "srl %[p2_l], %[p2_l], 16 \n\t"
- "srl %[p1_l], %[p1_l], 16 \n\t"
- "srl %[p0_l], %[p0_l], 16 \n\t"
- "srl %[q0_l], %[q0_l], 16 \n\t"
- "srl %[q1_l], %[q1_l], 16 \n\t"
- "srl %[q2_l], %[q2_l], 16 \n\t"
- "srl %[q3_l], %[q3_l], 16 \n\t"
- "srl %[q4_l], %[q4_l], 16 \n\t"
- "srl %[q5_l], %[q5_l], 16 \n\t"
- "srl %[q6_l], %[q6_l], 16 \n\t"
-
- : [q0_l] "+r" (q0_l), [q1_l] "+r" (q1_l), [q2_l] "+r" (q2_l),
- [q3_l] "+r" (q3_l), [q4_l] "+r" (q4_l), [q5_l] "+r" (q5_l),
- [q6_l] "+r" (q6_l), [p6_l] "+r" (p6_l), [p5_l] "+r" (p5_l),
- [p4_l] "+r" (p4_l), [p3_l] "+r" (p3_l), [p2_l] "+r" (p2_l),
- [p1_l] "+r" (p1_l), [p0_l] "+r" (p0_l)
- :
- );
-
- __asm__ __volatile__ (
- "srl %[p2_l_f1], %[p2_l_f1], 16 \n\t"
- "srl %[p1_l_f1], %[p1_l_f1], 16 \n\t"
- "srl %[p0_l_f1], %[p0_l_f1], 16 \n\t"
- "srl %[q0_l_f1], %[q0_l_f1], 16 \n\t"
- "srl %[q1_l_f1], %[q1_l_f1], 16 \n\t"
- "srl %[q2_l_f1], %[q2_l_f1], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_l_f1] "+r" (p2_l_f1), [p1_l_f1] "+r" (p1_l_f1),
- [p0_l_f1] "+r" (p0_l_f1), [q0_l_f1] "+r" (q0_l_f1),
- [q1_l_f1] "+r" (q1_l_f1), [q2_l_f1] "+r" (q2_l_f1),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & flat2 & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p6_l], +3(%[sp6]) \n\t"
- "sb %[p5_l], +3(%[sp5]) \n\t"
- "sb %[p4_l], +3(%[sp4]) \n\t"
- "sb %[p3_l], +3(%[sp3]) \n\t"
- "sb %[p2_l], +3(%[sp2]) \n\t"
- "sb %[p1_l], +3(%[sp1]) \n\t"
- "sb %[p0_l], +3(%[sp0]) \n\t"
-
- :
- : [p6_l] "r" (p6_l), [p5_l] "r" (p5_l), [p4_l] "r" (p4_l),
- [p3_l] "r" (p3_l), [p2_l] "r" (p2_l), [p1_l] "r" (p1_l),
- [p0_l] "r" (p0_l), [sp6] "r" (sp6), [sp5] "r" (sp5),
- [sp4] "r" (sp4), [sp3] "r" (sp3), [sp2] "r" (sp2),
- [sp1] "r" (sp1), [sp0] "r" (sp0)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_l], +3(%[sq0]) \n\t"
- "sb %[q1_l], +3(%[sq1]) \n\t"
- "sb %[q2_l], +3(%[sq2]) \n\t"
- "sb %[q3_l], +3(%[sq3]) \n\t"
- "sb %[q4_l], +3(%[sq4]) \n\t"
- "sb %[q5_l], +3(%[sq5]) \n\t"
- "sb %[q6_l], +3(%[sq6]) \n\t"
-
- :
- : [q0_l] "r" (q0_l), [q1_l] "r" (q1_l),
- [q2_l] "r" (q2_l), [q3_l] "r" (q3_l),
- [q4_l] "r" (q4_l), [q5_l] "r" (q5_l),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2),
- [sq3] "r" (sq3), [sq4] "r" (sq4), [sq5] "r" (sq5),
- [q6_l] "r" (q6_l), [sq6] "r" (sq6)
- );
- } else if (mask & flat & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p2_l_f1], +3(%[sp2]) \n\t"
- "sb %[p1_l_f1], +3(%[sp1]) \n\t"
- "sb %[p0_l_f1], +3(%[sp0]) \n\t"
- "sb %[q0_l_f1], +3(%[sq0]) \n\t"
- "sb %[q1_l_f1], +3(%[sq1]) \n\t"
- "sb %[q2_l_f1], +3(%[sq2]) \n\t"
-
- :
- : [p2_l_f1] "r" (p2_l_f1), [p1_l_f1] "r" (p1_l_f1),
- [p0_l_f1] "r" (p0_l_f1), [q0_l_f1] "r" (q0_l_f1),
- [q1_l_f1] "r" (q1_l_f1), [q2_l_f1] "r" (q2_l_f1),
- [sp2] "r" (sp2), [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1), [sq2] "r" (sq2)
- );
- } else if (mask & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], +3(%[sp1]) \n\t"
- "sb %[p0_f0], +3(%[sp0]) \n\t"
- "sb %[q0_f0], +3(%[sq0]) \n\t"
- "sb %[q1_f0], +3(%[sq1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [sp1] "r" (sp1), [sp0] "r" (sp0),
- [sq0] "r" (sq0), [sq1] "r" (sq1)
- );
- }
- }
-
- s = s + 4;
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_vert_loopfilter_dspr2.c b/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_vert_loopfilter_dspr2.c
deleted file mode 100644
index 851fc6c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/mips/dspr2/vp9_mblpf_vert_loopfilter_dspr2.c
+++ /dev/null
@@ -1,840 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/mips/dspr2/vp9_common_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h"
-#include "vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h"
-
-#if HAVE_DSPR2
-void vp9_lpf_vertical_16_dspr2(uint8_t *s,
- int pitch,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh) {
- uint8_t i;
- uint32_t mask, hev, flat, flat2;
- uint8_t *s1, *s2, *s3, *s4;
- uint32_t prim1, prim2, sec3, sec4, prim3, prim4;
- uint32_t thresh_vec, flimit_vec, limit_vec;
- uint32_t uflimit, ulimit, uthresh;
- uint32_t p7, p6, p5, p4, p3, p2, p1, p0, q0, q1, q2, q3, q4, q5, q6, q7;
- uint32_t p1_f0, p0_f0, q0_f0, q1_f0;
- uint32_t p7_l, p6_l, p5_l, p4_l, p3_l, p2_l, p1_l, p0_l;
- uint32_t q0_l, q1_l, q2_l, q3_l, q4_l, q5_l, q6_l, q7_l;
- uint32_t p7_r, p6_r, p5_r, p4_r, p3_r, p2_r, p1_r, p0_r;
- uint32_t q0_r, q1_r, q2_r, q3_r, q4_r, q5_r, q6_r, q7_r;
- uint32_t p2_l_f1, p1_l_f1, p0_l_f1, p2_r_f1, p1_r_f1, p0_r_f1;
- uint32_t q0_l_f1, q1_l_f1, q2_l_f1, q0_r_f1, q1_r_f1, q2_r_f1;
-
- uflimit = *blimit;
- ulimit = *limit;
- uthresh = *thresh;
-
- /* create quad-byte */
- __asm__ __volatile__ (
- "replv.qb %[thresh_vec], %[uthresh] \n\t"
- "replv.qb %[flimit_vec], %[uflimit] \n\t"
- "replv.qb %[limit_vec], %[ulimit] \n\t"
-
- : [thresh_vec] "=&r" (thresh_vec), [flimit_vec] "=&r" (flimit_vec),
- [limit_vec] "=r" (limit_vec)
- : [uthresh] "r" (uthresh), [uflimit] "r" (uflimit), [ulimit] "r" (ulimit)
- );
-
- vp9_prefetch_store(s + pitch);
-
- for (i = 0; i < 2; i++) {
- s1 = s;
- s2 = s + pitch;
- s3 = s2 + pitch;
- s4 = s3 + pitch;
- s = s4 + pitch;
-
- __asm__ __volatile__ (
- "lw %[p0], -4(%[s1]) \n\t"
- "lw %[p1], -4(%[s2]) \n\t"
- "lw %[p2], -4(%[s3]) \n\t"
- "lw %[p3], -4(%[s4]) \n\t"
- "lw %[p4], -8(%[s1]) \n\t"
- "lw %[p5], -8(%[s2]) \n\t"
- "lw %[p6], -8(%[s3]) \n\t"
- "lw %[p7], -8(%[s4]) \n\t"
-
- : [p3] "=&r" (p3), [p2] "=&r" (p2), [p1] "=&r" (p1),
- [p0] "=&r" (p0), [p7] "=&r" (p7), [p6] "=&r" (p6),
- [p5] "=&r" (p5), [p4] "=&r" (p4)
- : [s1] "r" (s1), [s2] "r" (s2), [s3] "r" (s3), [s4] "r" (s4)
- );
-
- __asm__ __volatile__ (
- "lw %[q3], (%[s1]) \n\t"
- "lw %[q2], (%[s2]) \n\t"
- "lw %[q1], (%[s3]) \n\t"
- "lw %[q0], (%[s4]) \n\t"
- "lw %[q7], +4(%[s1]) \n\t"
- "lw %[q6], +4(%[s2]) \n\t"
- "lw %[q5], +4(%[s3]) \n\t"
- "lw %[q4], +4(%[s4]) \n\t"
-
- : [q3] "=&r" (q3), [q2] "=&r" (q2), [q1] "=&r" (q1),
- [q0] "=&r" (q0), [q7] "=&r" (q7), [q6] "=&r" (q6),
- [q5] "=&r" (q5), [q4] "=&r" (q4)
- : [s1] "r" (s1), [s2] "r" (s2), [s3] "r" (s3), [s4] "r" (s4)
- );
-
- /* transpose p3, p2, p1, p0
- original (when loaded from memory)
- register -4 -3 -2 -1
- p0 p0_0 p0_1 p0_2 p0_3
- p1 p1_0 p1_1 p1_2 p1_3
- p2 p2_0 p2_1 p2_2 p2_3
- p3 p3_0 p3_1 p3_2 p3_3
-
- after transpose
- register
- p0 p3_3 p2_3 p1_3 p0_3
- p1 p3_2 p2_2 p1_2 p0_2
- p2 p3_1 p2_1 p1_1 p0_1
- p3 p3_0 p2_0 p1_0 p0_0
- */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p0], %[p1] \n\t"
- "precr.qb.ph %[prim2], %[p0], %[p1] \n\t"
- "precrq.qb.ph %[prim3], %[p2], %[p3] \n\t"
- "precr.qb.ph %[prim4], %[p2], %[p3] \n\t"
-
- "precrq.qb.ph %[p1], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p3], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p0], %[p1], %[sec3] \n\t"
- "precrq.ph.w %[p2], %[p3], %[sec4] \n\t"
- "append %[p1], %[sec3], 16 \n\t"
- "append %[p3], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p0] "+r" (p0), [p1] "+r" (p1), [p2] "+r" (p2), [p3] "+r" (p3),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose q0, q1, q2, q3
- original (when loaded from memory)
- register +1 +2 +3 +4
- q3 q3_0 q3_1 q3_2 q3_3
- q2 q2_0 q2_1 q2_2 q2_3
- q1 q1_0 q1_1 q1_2 q1_3
- q0 q0_0 q0_1 q0_2 q0_3
-
- after transpose
- register
- q3 q0_3 q1_3 q2_3 q3_3
- q2 q0_2 q1_2 q2_2 q3_2
- q1 q0_1 q1_1 q2_1 q3_1
- q0 q0_0 q1_0 q2_0 q3_0
- */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[q3], %[q2] \n\t"
- "precr.qb.ph %[prim2], %[q3], %[q2] \n\t"
- "precrq.qb.ph %[prim3], %[q1], %[q0] \n\t"
- "precr.qb.ph %[prim4], %[q1], %[q0] \n\t"
-
- "precrq.qb.ph %[q2], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[q0], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[q3], %[q2], %[sec3] \n\t"
- "precrq.ph.w %[q1], %[q0], %[sec4] \n\t"
- "append %[q2], %[sec3], 16 \n\t"
- "append %[q0], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [q3] "+r" (q3), [q2] "+r" (q2), [q1] "+r" (q1), [q0] "+r" (q0),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose p7, p6, p5, p4
- original (when loaded from memory)
- register -8 -7 -6 -5
- p4 p4_0 p4_1 p4_2 p4_3
- p5 p5_0 p5_1 p5_2 p5_3
- p6 p6_0 p6_1 p6_2 p6_3
- p7 p7_0 p7_1 p7_2 p7_3
-
- after transpose
- register
- p4 p7_3 p6_3 p5_3 p4_3
- p5 p7_2 p6_2 p5_2 p4_2
- p6 p7_1 p6_1 p5_1 p4_1
- p7 p7_0 p6_0 p5_0 p4_0
- */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[p4], %[p5] \n\t"
- "precr.qb.ph %[prim2], %[p4], %[p5] \n\t"
- "precrq.qb.ph %[prim3], %[p6], %[p7] \n\t"
- "precr.qb.ph %[prim4], %[p6], %[p7] \n\t"
-
- "precrq.qb.ph %[p5], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[p7], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[p4], %[p5], %[sec3] \n\t"
- "precrq.ph.w %[p6], %[p7], %[sec4] \n\t"
- "append %[p5], %[sec3], 16 \n\t"
- "append %[p7], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [p4] "+r" (p4), [p5] "+r" (p5), [p6] "+r" (p6), [p7] "+r" (p7),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- /* transpose q4, q5, q6, q7
- original (when loaded from memory)
- register +5 +6 +7 +8
- q7 q7_0 q7_1 q7_2 q7_3
- q6 q6_0 q6_1 q6_2 q6_3
- q5 q5_0 q5_1 q5_2 q5_3
- q4 q4_0 q4_1 q4_2 q4_3
-
- after transpose
- register
- q7 q4_3 q5_3 q26_3 q7_3
- q6 q4_2 q5_2 q26_2 q7_2
- q5 q4_1 q5_1 q26_1 q7_1
- q4 q4_0 q5_0 q26_0 q7_0
- */
- __asm__ __volatile__ (
- "precrq.qb.ph %[prim1], %[q7], %[q6] \n\t"
- "precr.qb.ph %[prim2], %[q7], %[q6] \n\t"
- "precrq.qb.ph %[prim3], %[q5], %[q4] \n\t"
- "precr.qb.ph %[prim4], %[q5], %[q4] \n\t"
-
- "precrq.qb.ph %[q6], %[prim1], %[prim2] \n\t"
- "precr.qb.ph %[q4], %[prim1], %[prim2] \n\t"
- "precrq.qb.ph %[sec3], %[prim3], %[prim4] \n\t"
- "precr.qb.ph %[sec4], %[prim3], %[prim4] \n\t"
-
- "precrq.ph.w %[q7], %[q6], %[sec3] \n\t"
- "precrq.ph.w %[q5], %[q4], %[sec4] \n\t"
- "append %[q6], %[sec3], 16 \n\t"
- "append %[q4], %[sec4], 16 \n\t"
-
- : [prim1] "=&r" (prim1), [prim2] "=&r" (prim2),
- [prim3] "=&r" (prim3), [prim4] "=&r" (prim4),
- [q7] "+r" (q7), [q6] "+r" (q6), [q5] "+r" (q5), [q4] "+r" (q4),
- [sec3] "=&r" (sec3), [sec4] "=&r" (sec4)
- :
- );
-
- vp9_filter_hev_mask_flatmask4_dspr2(limit_vec, flimit_vec, thresh_vec,
- p1, p0, p3, p2, q0, q1, q2, q3,
- &hev, &mask, &flat);
-
- vp9_flatmask5(p7, p6, p5, p4, p0, q0, q4, q5, q6, q7, &flat2);
-
- /* f0 */
- if (((flat2 == 0) && (flat == 0) && (mask != 0)) ||
- ((flat2 != 0) && (flat == 0) && (mask != 0))) {
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
- STORE_F0()
- } else if ((flat2 == 0XFFFFFFFF) && (flat == 0xFFFFFFFF) &&
- (mask == 0xFFFFFFFF)) {
- /* f2 */
- PACK_LEFT_0TO3()
- PACK_LEFT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_l, &p6_l, &p5_l, &p4_l,
- &p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l,
- &q4_l, &q5_l, &q6_l, &q7_l);
-
- PACK_RIGHT_0TO3()
- PACK_RIGHT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_r, &p6_r, &p5_r, &p4_r,
- &p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r,
- &q4_r, &q5_r, &q6_r, &q7_r);
-
- STORE_F2()
- } else if ((flat2 == 0) && (flat == 0xFFFFFFFF) && (mask == 0xFFFFFFFF)) {
- /* f1 */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- STORE_F1()
- } else if ((flat2 == 0) && (flat != 0) && (mask != 0)) {
- /* f0 + f1 */
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- /* left 2 element operation */
- PACK_LEFT_0TO3()
- vp9_mbfilter_dspr2(&p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l);
-
- /* right 2 element operation */
- PACK_RIGHT_0TO3()
- vp9_mbfilter_dspr2(&p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r);
-
- if (mask & flat & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p2_r], -3(%[s4]) \n\t"
- "sb %[p1_r], -2(%[s4]) \n\t"
- "sb %[p0_r], -1(%[s4]) \n\t"
- "sb %[q0_r], (%[s4]) \n\t"
- "sb %[q1_r], +1(%[s4]) \n\t"
- "sb %[q2_r], +2(%[s4]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [s4] "r" (s4)
- );
- } else if (mask & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s4]) \n\t"
- "sb %[p0_f0], -1(%[s4]) \n\t"
- "sb %[q0_f0], (%[s4]) \n\t"
- "sb %[q1_f0], +1(%[s4]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s4] "r" (s4)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_r], %[p2_r], 16 \n\t"
- "srl %[p1_r], %[p1_r], 16 \n\t"
- "srl %[p0_r], %[p0_r], 16 \n\t"
- "srl %[q0_r], %[q0_r], 16 \n\t"
- "srl %[q1_r], %[q1_r], 16 \n\t"
- "srl %[q2_r], %[q2_r], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_r] "+r" (p2_r), [p1_r] "+r" (p1_r), [p0_r] "+r" (p0_r),
- [q0_r] "+r" (q0_r), [q1_r] "+r" (q1_r), [q2_r] "+r" (q2_r),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p2_r], -3(%[s3]) \n\t"
- "sb %[p1_r], -2(%[s3]) \n\t"
- "sb %[p0_r], -1(%[s3]) \n\t"
- "sb %[q0_r], (%[s3]) \n\t"
- "sb %[q1_r], +1(%[s3]) \n\t"
- "sb %[q2_r], +2(%[s3]) \n\t"
-
- :
- : [p2_r] "r" (p2_r), [p1_r] "r" (p1_r), [p0_r] "r" (p0_r),
- [q0_r] "r" (q0_r), [q1_r] "r" (q1_r), [q2_r] "r" (q2_r),
- [s3] "r" (s3)
- );
- } else if (mask & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s3]) \n\t"
- "sb %[p0_f0], -1(%[s3]) \n\t"
- "sb %[q0_f0], (%[s3]) \n\t"
- "sb %[q1_f0], +1(%[s3]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s3] "r" (s3)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p2_l], -3(%[s2]) \n\t"
- "sb %[p1_l], -2(%[s2]) \n\t"
- "sb %[p0_l], -1(%[s2]) \n\t"
- "sb %[q0_l], (%[s2]) \n\t"
- "sb %[q1_l], +1(%[s2]) \n\t"
- "sb %[q2_l], +2(%[s2]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [s2] "r" (s2)
- );
- } else if (mask & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s2]) \n\t"
- "sb %[p0_f0], -1(%[s2]) \n\t"
- "sb %[q0_f0], (%[s2]) \n\t"
- "sb %[q1_f0], +1(%[s2]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s2] "r" (s2)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p2_l], %[p2_l], 16 \n\t"
- "srl %[p1_l], %[p1_l], 16 \n\t"
- "srl %[p0_l], %[p0_l], 16 \n\t"
- "srl %[q0_l], %[q0_l], 16 \n\t"
- "srl %[q1_l], %[q1_l], 16 \n\t"
- "srl %[q2_l], %[q2_l], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_l] "+r" (p2_l), [p1_l] "+r" (p1_l), [p0_l] "+r" (p0_l),
- [q0_l] "+r" (q0_l), [q1_l] "+r" (q1_l), [q2_l] "+r" (q2_l),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p2_l], -3(%[s1]) \n\t"
- "sb %[p1_l], -2(%[s1]) \n\t"
- "sb %[p0_l], -1(%[s1]) \n\t"
- "sb %[q0_l], (%[s1]) \n\t"
- "sb %[q1_l], +1(%[s1]) \n\t"
- "sb %[q2_l], +2(%[s1]) \n\t"
-
- :
- : [p2_l] "r" (p2_l), [p1_l] "r" (p1_l), [p0_l] "r" (p0_l),
- [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [s1] "r" (s1)
- );
- } else if (mask & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s1]) \n\t"
- "sb %[p0_f0], -1(%[s1]) \n\t"
- "sb %[q0_f0], (%[s1]) \n\t"
- "sb %[q1_f0], +1(%[s1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s1] "r" (s1)
- );
- }
- } else if ((flat2 != 0) && (flat != 0) && (mask != 0)) {
- /* f0+f1+f2 */
- vp9_filter1_dspr2(mask, hev, p1, p0, q0, q1,
- &p1_f0, &p0_f0, &q0_f0, &q1_f0);
-
- PACK_LEFT_0TO3()
- vp9_mbfilter1_dspr2(p3_l, p2_l, p1_l, p0_l,
- q0_l, q1_l, q2_l, q3_l,
- &p2_l_f1, &p1_l_f1, &p0_l_f1,
- &q0_l_f1, &q1_l_f1, &q2_l_f1);
-
- PACK_RIGHT_0TO3()
- vp9_mbfilter1_dspr2(p3_r, p2_r, p1_r, p0_r,
- q0_r, q1_r, q2_r, q3_r,
- &p2_r_f1, &p1_r_f1, &p0_r_f1,
- &q0_r_f1, &q1_r_f1, &q2_r_f1);
-
- PACK_LEFT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_l, &p6_l, &p5_l, &p4_l,
- &p3_l, &p2_l, &p1_l, &p0_l,
- &q0_l, &q1_l, &q2_l, &q3_l,
- &q4_l, &q5_l, &q6_l, &q7_l);
-
- PACK_RIGHT_4TO7()
- vp9_wide_mbfilter_dspr2(&p7_r, &p6_r, &p5_r, &p4_r,
- &p3_r, &p2_r, &p1_r, &p0_r,
- &q0_r, &q1_r, &q2_r, &q3_r,
- &q4_r, &q5_r, &q6_r, &q7_r);
-
- if (mask & flat & flat2 & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p6_r], -7(%[s4]) \n\t"
- "sb %[p5_r], -6(%[s4]) \n\t"
- "sb %[p4_r], -5(%[s4]) \n\t"
- "sb %[p3_r], -4(%[s4]) \n\t"
- "sb %[p2_r], -3(%[s4]) \n\t"
- "sb %[p1_r], -2(%[s4]) \n\t"
- "sb %[p0_r], -1(%[s4]) \n\t"
-
- :
- : [p6_r] "r" (p6_r), [p5_r] "r" (p5_r),
- [p4_r] "r" (p4_r), [p3_r] "r" (p3_r),
- [p2_r] "r" (p2_r), [p1_r] "r" (p1_r),
- [p0_r] "r" (p0_r), [s4] "r" (s4)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_r], (%[s4]) \n\t"
- "sb %[q1_r], +1(%[s4]) \n\t"
- "sb %[q2_r], +2(%[s4]) \n\t"
- "sb %[q3_r], +3(%[s4]) \n\t"
- "sb %[q4_r], +4(%[s4]) \n\t"
- "sb %[q5_r], +5(%[s4]) \n\t"
- "sb %[q6_r], +6(%[s4]) \n\t"
-
- :
- : [q0_r] "r" (q0_r), [q1_r] "r" (q1_r),
- [q2_r] "r" (q2_r), [q3_r] "r" (q3_r),
- [q4_r] "r" (q4_r), [q5_r] "r" (q5_r),
- [q6_r] "r" (q6_r), [s4] "r" (s4)
- );
- } else if (mask & flat & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p2_r_f1], -3(%[s4]) \n\t"
- "sb %[p1_r_f1], -2(%[s4]) \n\t"
- "sb %[p0_r_f1], -1(%[s4]) \n\t"
- "sb %[q0_r_f1], (%[s4]) \n\t"
- "sb %[q1_r_f1], +1(%[s4]) \n\t"
- "sb %[q2_r_f1], +2(%[s4]) \n\t"
-
- :
- : [p2_r_f1] "r" (p2_r_f1), [p1_r_f1] "r" (p1_r_f1),
- [p0_r_f1] "r" (p0_r_f1), [q0_r_f1] "r" (q0_r_f1),
- [q1_r_f1] "r" (q1_r_f1), [q2_r_f1] "r" (q2_r_f1),
- [s4] "r" (s4)
- );
- } else if (mask & 0x000000FF) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s4]) \n\t"
- "sb %[p0_f0], -1(%[s4]) \n\t"
- "sb %[q0_f0], (%[s4]) \n\t"
- "sb %[q1_f0], +1(%[s4]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s4] "r" (s4)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p6_r], %[p6_r], 16 \n\t"
- "srl %[p5_r], %[p5_r], 16 \n\t"
- "srl %[p4_r], %[p4_r], 16 \n\t"
- "srl %[p3_r], %[p3_r], 16 \n\t"
- "srl %[p2_r], %[p2_r], 16 \n\t"
- "srl %[p1_r], %[p1_r], 16 \n\t"
- "srl %[p0_r], %[p0_r], 16 \n\t"
- "srl %[q0_r], %[q0_r], 16 \n\t"
- "srl %[q1_r], %[q1_r], 16 \n\t"
- "srl %[q2_r], %[q2_r], 16 \n\t"
- "srl %[q3_r], %[q3_r], 16 \n\t"
- "srl %[q4_r], %[q4_r], 16 \n\t"
- "srl %[q5_r], %[q5_r], 16 \n\t"
- "srl %[q6_r], %[q6_r], 16 \n\t"
-
- : [q0_r] "+r" (q0_r), [q1_r] "+r" (q1_r),
- [q2_r] "+r" (q2_r), [q3_r] "+r" (q3_r),
- [q4_r] "+r" (q4_r), [q5_r] "+r" (q5_r),
- [q6_r] "+r" (q6_r), [p6_r] "+r" (p6_r),
- [p5_r] "+r" (p5_r), [p4_r] "+r" (p4_r),
- [p3_r] "+r" (p3_r), [p2_r] "+r" (p2_r),
- [p1_r] "+r" (p1_r), [p0_r] "+r" (p0_r)
- :
- );
-
- __asm__ __volatile__ (
- "srl %[p2_r_f1], %[p2_r_f1], 16 \n\t"
- "srl %[p1_r_f1], %[p1_r_f1], 16 \n\t"
- "srl %[p0_r_f1], %[p0_r_f1], 16 \n\t"
- "srl %[q0_r_f1], %[q0_r_f1], 16 \n\t"
- "srl %[q1_r_f1], %[q1_r_f1], 16 \n\t"
- "srl %[q2_r_f1], %[q2_r_f1], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_r_f1] "+r" (p2_r_f1), [p1_r_f1] "+r" (p1_r_f1),
- [p0_r_f1] "+r" (p0_r_f1), [q0_r_f1] "+r" (q0_r_f1),
- [q1_r_f1] "+r" (q1_r_f1), [q2_r_f1] "+r" (q2_r_f1),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & flat2 & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p6_r], -7(%[s3]) \n\t"
- "sb %[p5_r], -6(%[s3]) \n\t"
- "sb %[p4_r], -5(%[s3]) \n\t"
- "sb %[p3_r], -4(%[s3]) \n\t"
- "sb %[p2_r], -3(%[s3]) \n\t"
- "sb %[p1_r], -2(%[s3]) \n\t"
- "sb %[p0_r], -1(%[s3]) \n\t"
-
- :
- : [p6_r] "r" (p6_r), [p5_r] "r" (p5_r), [p4_r] "r" (p4_r),
- [p3_r] "r" (p3_r), [p2_r] "r" (p2_r), [p1_r] "r" (p1_r),
- [p0_r] "r" (p0_r), [s3] "r" (s3)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_r], (%[s3]) \n\t"
- "sb %[q1_r], +1(%[s3]) \n\t"
- "sb %[q2_r], +2(%[s3]) \n\t"
- "sb %[q3_r], +3(%[s3]) \n\t"
- "sb %[q4_r], +4(%[s3]) \n\t"
- "sb %[q5_r], +5(%[s3]) \n\t"
- "sb %[q6_r], +6(%[s3]) \n\t"
-
- :
- : [q0_r] "r" (q0_r), [q1_r] "r" (q1_r),
- [q2_r] "r" (q2_r), [q3_r] "r" (q3_r),
- [q4_r] "r" (q4_r), [q5_r] "r" (q5_r),
- [q6_r] "r" (q6_r), [s3] "r" (s3)
- );
- } else if (mask & flat & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p2_r_f1], -3(%[s3]) \n\t"
- "sb %[p1_r_f1], -2(%[s3]) \n\t"
- "sb %[p0_r_f1], -1(%[s3]) \n\t"
- "sb %[q0_r_f1], (%[s3]) \n\t"
- "sb %[q1_r_f1], +1(%[s3]) \n\t"
- "sb %[q2_r_f1], +2(%[s3]) \n\t"
-
- :
- : [p2_r_f1] "r" (p2_r_f1), [p1_r_f1] "r" (p1_r_f1),
- [p0_r_f1] "r" (p0_r_f1), [q0_r_f1] "r" (q0_r_f1),
- [q1_r_f1] "r" (q1_r_f1), [q2_r_f1] "r" (q2_r_f1),
- [s3] "r" (s3)
- );
- } else if (mask & 0x0000FF00) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s3]) \n\t"
- "sb %[p0_f0], -1(%[s3]) \n\t"
- "sb %[q0_f0], (%[s3]) \n\t"
- "sb %[q1_f0], +1(%[s3]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s3] "r" (s3)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & flat2 & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p6_l], -7(%[s2]) \n\t"
- "sb %[p5_l], -6(%[s2]) \n\t"
- "sb %[p4_l], -5(%[s2]) \n\t"
- "sb %[p3_l], -4(%[s2]) \n\t"
- "sb %[p2_l], -3(%[s2]) \n\t"
- "sb %[p1_l], -2(%[s2]) \n\t"
- "sb %[p0_l], -1(%[s2]) \n\t"
-
- :
- : [p6_l] "r" (p6_l), [p5_l] "r" (p5_l), [p4_l] "r" (p4_l),
- [p3_l] "r" (p3_l), [p2_l] "r" (p2_l), [p1_l] "r" (p1_l),
- [p0_l] "r" (p0_l), [s2] "r" (s2)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_l], (%[s2]) \n\t"
- "sb %[q1_l], +1(%[s2]) \n\t"
- "sb %[q2_l], +2(%[s2]) \n\t"
- "sb %[q3_l], +3(%[s2]) \n\t"
- "sb %[q4_l], +4(%[s2]) \n\t"
- "sb %[q5_l], +5(%[s2]) \n\t"
- "sb %[q6_l], +6(%[s2]) \n\t"
-
- :
- : [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [q3_l] "r" (q3_l), [q4_l] "r" (q4_l), [q5_l] "r" (q5_l),
- [q6_l] "r" (q6_l), [s2] "r" (s2)
- );
- } else if (mask & flat & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p2_l_f1], -3(%[s2]) \n\t"
- "sb %[p1_l_f1], -2(%[s2]) \n\t"
- "sb %[p0_l_f1], -1(%[s2]) \n\t"
- "sb %[q0_l_f1], (%[s2]) \n\t"
- "sb %[q1_l_f1], +1(%[s2]) \n\t"
- "sb %[q2_l_f1], +2(%[s2]) \n\t"
-
- :
- : [p2_l_f1] "r" (p2_l_f1), [p1_l_f1] "r" (p1_l_f1),
- [p0_l_f1] "r" (p0_l_f1), [q0_l_f1] "r" (q0_l_f1),
- [q1_l_f1] "r" (q1_l_f1), [q2_l_f1] "r" (q2_l_f1),
- [s2] "r" (s2)
- );
- } else if (mask & 0x00FF0000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s2]) \n\t"
- "sb %[p0_f0], -1(%[s2]) \n\t"
- "sb %[q0_f0], (%[s2]) \n\t"
- "sb %[q1_f0], +1(%[s2]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s2] "r" (s2)
- );
- }
-
- __asm__ __volatile__ (
- "srl %[p6_l], %[p6_l], 16 \n\t"
- "srl %[p5_l], %[p5_l], 16 \n\t"
- "srl %[p4_l], %[p4_l], 16 \n\t"
- "srl %[p3_l], %[p3_l], 16 \n\t"
- "srl %[p2_l], %[p2_l], 16 \n\t"
- "srl %[p1_l], %[p1_l], 16 \n\t"
- "srl %[p0_l], %[p0_l], 16 \n\t"
- "srl %[q0_l], %[q0_l], 16 \n\t"
- "srl %[q1_l], %[q1_l], 16 \n\t"
- "srl %[q2_l], %[q2_l], 16 \n\t"
- "srl %[q3_l], %[q3_l], 16 \n\t"
- "srl %[q4_l], %[q4_l], 16 \n\t"
- "srl %[q5_l], %[q5_l], 16 \n\t"
- "srl %[q6_l], %[q6_l], 16 \n\t"
-
- : [q0_l] "+r" (q0_l), [q1_l] "+r" (q1_l), [q2_l] "+r" (q2_l),
- [q3_l] "+r" (q3_l), [q4_l] "+r" (q4_l), [q5_l] "+r" (q5_l),
- [q6_l] "+r" (q6_l), [p6_l] "+r" (p6_l), [p5_l] "+r" (p5_l),
- [p4_l] "+r" (p4_l), [p3_l] "+r" (p3_l), [p2_l] "+r" (p2_l),
- [p1_l] "+r" (p1_l), [p0_l] "+r" (p0_l)
- :
- );
-
- __asm__ __volatile__ (
- "srl %[p2_l_f1], %[p2_l_f1], 16 \n\t"
- "srl %[p1_l_f1], %[p1_l_f1], 16 \n\t"
- "srl %[p0_l_f1], %[p0_l_f1], 16 \n\t"
- "srl %[q0_l_f1], %[q0_l_f1], 16 \n\t"
- "srl %[q1_l_f1], %[q1_l_f1], 16 \n\t"
- "srl %[q2_l_f1], %[q2_l_f1], 16 \n\t"
- "srl %[p1_f0], %[p1_f0], 8 \n\t"
- "srl %[p0_f0], %[p0_f0], 8 \n\t"
- "srl %[q0_f0], %[q0_f0], 8 \n\t"
- "srl %[q1_f0], %[q1_f0], 8 \n\t"
-
- : [p2_l_f1] "+r" (p2_l_f1), [p1_l_f1] "+r" (p1_l_f1),
- [p0_l_f1] "+r" (p0_l_f1), [q0_l_f1] "+r" (q0_l_f1),
- [q1_l_f1] "+r" (q1_l_f1), [q2_l_f1] "+r" (q2_l_f1),
- [p1_f0] "+r" (p1_f0), [p0_f0] "+r" (p0_f0),
- [q0_f0] "+r" (q0_f0), [q1_f0] "+r" (q1_f0)
- :
- );
-
- if (mask & flat & flat2 & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p6_l], -7(%[s1]) \n\t"
- "sb %[p5_l], -6(%[s1]) \n\t"
- "sb %[p4_l], -5(%[s1]) \n\t"
- "sb %[p3_l], -4(%[s1]) \n\t"
- "sb %[p2_l], -3(%[s1]) \n\t"
- "sb %[p1_l], -2(%[s1]) \n\t"
- "sb %[p0_l], -1(%[s1]) \n\t"
-
- :
- : [p6_l] "r" (p6_l), [p5_l] "r" (p5_l), [p4_l] "r" (p4_l),
- [p3_l] "r" (p3_l), [p2_l] "r" (p2_l), [p1_l] "r" (p1_l),
- [p0_l] "r" (p0_l),
- [s1] "r" (s1)
- );
-
- __asm__ __volatile__ (
- "sb %[q0_l], (%[s1]) \n\t"
- "sb %[q1_l], 1(%[s1]) \n\t"
- "sb %[q2_l], 2(%[s1]) \n\t"
- "sb %[q3_l], 3(%[s1]) \n\t"
- "sb %[q4_l], 4(%[s1]) \n\t"
- "sb %[q5_l], 5(%[s1]) \n\t"
- "sb %[q6_l], 6(%[s1]) \n\t"
-
- :
- : [q0_l] "r" (q0_l), [q1_l] "r" (q1_l), [q2_l] "r" (q2_l),
- [q3_l] "r" (q3_l), [q4_l] "r" (q4_l), [q5_l] "r" (q5_l),
- [q6_l] "r" (q6_l),
- [s1] "r" (s1)
- );
- } else if (mask & flat & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p2_l_f1], -3(%[s1]) \n\t"
- "sb %[p1_l_f1], -2(%[s1]) \n\t"
- "sb %[p0_l_f1], -1(%[s1]) \n\t"
- "sb %[q0_l_f1], (%[s1]) \n\t"
- "sb %[q1_l_f1], +1(%[s1]) \n\t"
- "sb %[q2_l_f1], +2(%[s1]) \n\t"
-
- :
- : [p2_l_f1] "r" (p2_l_f1), [p1_l_f1] "r" (p1_l_f1),
- [p0_l_f1] "r" (p0_l_f1), [q0_l_f1] "r" (q0_l_f1),
- [q1_l_f1] "r" (q1_l_f1), [q2_l_f1] "r" (q2_l_f1),
- [s1] "r" (s1)
- );
- } else if (mask & 0xFF000000) {
- __asm__ __volatile__ (
- "sb %[p1_f0], -2(%[s1]) \n\t"
- "sb %[p0_f0], -1(%[s1]) \n\t"
- "sb %[q0_f0], (%[s1]) \n\t"
- "sb %[q1_f0], +1(%[s1]) \n\t"
-
- :
- : [p1_f0] "r" (p1_f0), [p0_f0] "r" (p0_f0),
- [q0_f0] "r" (q0_f0), [q1_f0] "r" (q1_f0),
- [s1] "r" (s1)
- );
- }
- }
- }
-}
-#endif // #if HAVE_DSPR2
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.c
deleted file mode 100644
index f44ada1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_entropymv.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-static void clear_mi_border(const VP9_COMMON *cm, MODE_INFO *mi) {
- int i;
-
- // Top border row
- vpx_memset(mi, 0, sizeof(*mi) * cm->mi_stride);
-
- // Left border column
- for (i = 1; i < cm->mi_rows + 1; ++i)
- vpx_memset(&mi[i * cm->mi_stride], 0, sizeof(*mi));
-}
-
-static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) {
- cm->mi_cols = aligned_width >> MI_SIZE_LOG2;
- cm->mi_rows = aligned_height >> MI_SIZE_LOG2;
- cm->mi_stride = cm->mi_cols + MI_BLOCK_SIZE;
-
- cm->mb_cols = (cm->mi_cols + 1) >> 1;
- cm->mb_rows = (cm->mi_rows + 1) >> 1;
- cm->MBs = cm->mb_rows * cm->mb_cols;
-}
-
-static void setup_mi(VP9_COMMON *cm) {
- cm->mi = cm->mip + cm->mi_stride + 1;
- cm->prev_mi = cm->prev_mip + cm->mi_stride + 1;
- cm->mi_grid_visible = cm->mi_grid_base + cm->mi_stride + 1;
- cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mi_stride + 1;
-
- vpx_memset(cm->mip, 0, cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip));
-
- vpx_memset(cm->mi_grid_base, 0, cm->mi_stride * (cm->mi_rows + 1) *
- sizeof(*cm->mi_grid_base));
-
- clear_mi_border(cm, cm->prev_mip);
-}
-
-static int alloc_mi(VP9_COMMON *cm, int mi_size) {
- cm->mip = (MODE_INFO *)vpx_calloc(mi_size, sizeof(*cm->mip));
- if (cm->mip == NULL)
- return 1;
-
- cm->prev_mip = (MODE_INFO *)vpx_calloc(mi_size, sizeof(*cm->prev_mip));
- if (cm->prev_mip == NULL)
- return 1;
-
- cm->mi_grid_base =
- (MODE_INFO **)vpx_calloc(mi_size, sizeof(*cm->mi_grid_base));
- if (cm->mi_grid_base == NULL)
- return 1;
-
- cm->prev_mi_grid_base =
- (MODE_INFO **)vpx_calloc(mi_size, sizeof(*cm->prev_mi_grid_base));
- if (cm->prev_mi_grid_base == NULL)
- return 1;
-
- return 0;
-}
-
-static void free_mi(VP9_COMMON *cm) {
- vpx_free(cm->mip);
- vpx_free(cm->prev_mip);
- vpx_free(cm->mi_grid_base);
- vpx_free(cm->prev_mi_grid_base);
-
- cm->mip = NULL;
- cm->prev_mip = NULL;
- cm->mi_grid_base = NULL;
- cm->prev_mi_grid_base = NULL;
-}
-
-void vp9_free_frame_buffers(VP9_COMMON *cm) {
- int i;
-
- for (i = 0; i < FRAME_BUFFERS; ++i) {
- vp9_free_frame_buffer(&cm->frame_bufs[i].buf);
-
- if (cm->frame_bufs[i].ref_count > 0 &&
- cm->frame_bufs[i].raw_frame_buffer.data != NULL) {
- cm->release_fb_cb(cm->cb_priv, &cm->frame_bufs[i].raw_frame_buffer);
- cm->frame_bufs[i].ref_count = 0;
- }
- }
-
- vp9_free_frame_buffer(&cm->post_proc_buffer);
-
- free_mi(cm);
-
- vpx_free(cm->last_frame_seg_map);
- cm->last_frame_seg_map = NULL;
-
- vpx_free(cm->above_context);
- cm->above_context = NULL;
-
- vpx_free(cm->above_seg_context);
- cm->above_seg_context = NULL;
-}
-
-int vp9_resize_frame_buffers(VP9_COMMON *cm, int width, int height) {
- const int aligned_width = ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2);
- const int aligned_height = ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2);
- const int ss_x = cm->subsampling_x;
- const int ss_y = cm->subsampling_y;
-
- if (vp9_realloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y,
- VP9_DEC_BORDER_IN_PIXELS, NULL, NULL, NULL) < 0)
- goto fail;
-
- set_mb_mi(cm, aligned_width, aligned_height);
-
- free_mi(cm);
- if (alloc_mi(cm, cm->mi_stride * (cm->mi_rows + MI_BLOCK_SIZE)))
- goto fail;
-
- setup_mi(cm);
-
- // Create the segmentation map structure and set to 0.
- vpx_free(cm->last_frame_seg_map);
- cm->last_frame_seg_map = (uint8_t *)vpx_calloc(cm->mi_rows * cm->mi_cols, 1);
- if (!cm->last_frame_seg_map)
- goto fail;
-
- vpx_free(cm->above_context);
- cm->above_context =
- (ENTROPY_CONTEXT *)vpx_calloc(2 * mi_cols_aligned_to_sb(cm->mi_cols) *
- MAX_MB_PLANE,
- sizeof(*cm->above_context));
- if (!cm->above_context)
- goto fail;
-
- vpx_free(cm->above_seg_context);
- cm->above_seg_context =
- (PARTITION_CONTEXT *)vpx_calloc(mi_cols_aligned_to_sb(cm->mi_cols),
- sizeof(*cm->above_seg_context));
- if (!cm->above_seg_context)
- goto fail;
-
- return 0;
-
- fail:
- vp9_free_frame_buffers(cm);
- return 1;
-}
-
-int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) {
- const int aligned_width = ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2);
- const int aligned_height = ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2);
- const int ss_x = cm->subsampling_x;
- const int ss_y = cm->subsampling_y;
- int i;
-
- vp9_free_frame_buffers(cm);
-
- for (i = 0; i < FRAME_BUFFERS; i++) {
- cm->frame_bufs[i].ref_count = 0;
- if (vp9_alloc_frame_buffer(&cm->frame_bufs[i].buf, width, height,
- ss_x, ss_y, VP9_ENC_BORDER_IN_PIXELS) < 0)
- goto fail;
- }
-
- cm->new_fb_idx = FRAME_BUFFERS - 1;
- cm->frame_bufs[cm->new_fb_idx].ref_count = 1;
-
- for (i = 0; i < REF_FRAMES; i++) {
- cm->ref_frame_map[i] = i;
- cm->frame_bufs[i].ref_count = 1;
- }
-
- if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y,
- VP9_ENC_BORDER_IN_PIXELS) < 0)
- goto fail;
-
- set_mb_mi(cm, aligned_width, aligned_height);
-
- if (alloc_mi(cm, cm->mi_stride * (cm->mi_rows + MI_BLOCK_SIZE)))
- goto fail;
-
- setup_mi(cm);
-
- // Create the segmentation map structure and set to 0.
- cm->last_frame_seg_map = (uint8_t *)vpx_calloc(cm->mi_rows * cm->mi_cols, 1);
- if (!cm->last_frame_seg_map)
- goto fail;
-
- cm->above_context =
- (ENTROPY_CONTEXT *)vpx_calloc(2 * mi_cols_aligned_to_sb(cm->mi_cols) *
- MAX_MB_PLANE,
- sizeof(*cm->above_context));
- if (!cm->above_context)
- goto fail;
-
- cm->above_seg_context =
- (PARTITION_CONTEXT *)vpx_calloc(mi_cols_aligned_to_sb(cm->mi_cols),
- sizeof(*cm->above_seg_context));
- if (!cm->above_seg_context)
- goto fail;
-
- return 0;
-
- fail:
- vp9_free_frame_buffers(cm);
- return 1;
-}
-
-void vp9_remove_common(VP9_COMMON *cm) {
- vp9_free_frame_buffers(cm);
- vp9_free_internal_frame_buffers(&cm->int_frame_buffers);
-}
-
-void vp9_update_frame_size(VP9_COMMON *cm) {
- const int aligned_width = ALIGN_POWER_OF_TWO(cm->width, MI_SIZE_LOG2);
- const int aligned_height = ALIGN_POWER_OF_TWO(cm->height, MI_SIZE_LOG2);
-
- set_mb_mi(cm, aligned_width, aligned_height);
- setup_mi(cm);
-
- // Initialize the previous frame segment map to 0.
- if (cm->last_frame_seg_map)
- vpx_memset(cm->last_frame_seg_map, 0, cm->mi_rows * cm->mi_cols);
-}
-
-void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm) {
- // Current mip will be the prev_mip for the next frame.
- MODE_INFO *temp = cm->prev_mip;
- MODE_INFO **temp2 = cm->prev_mi_grid_base;
- cm->prev_mip = cm->mip;
- cm->mip = temp;
- cm->prev_mi_grid_base = cm->mi_grid_base;
- cm->mi_grid_base = temp2;
-
- // Update the upper left visible macroblock ptrs.
- cm->mi = cm->mip + cm->mi_stride + 1;
- cm->prev_mi = cm->prev_mip + cm->mi_stride + 1;
- cm->mi_grid_visible = cm->mi_grid_base + cm->mi_stride + 1;
- cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mi_stride + 1;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.h
deleted file mode 100644
index 06636a9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_alloccommon.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_COMMON_VP9_ALLOCCOMMON_H_
-#define VP9_COMMON_VP9_ALLOCCOMMON_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP9Common;
-
-void vp9_remove_common(struct VP9Common *cm);
-
-int vp9_resize_frame_buffers(struct VP9Common *cm, int width, int height);
-
-int vp9_alloc_frame_buffers(struct VP9Common *cm, int width, int height);
-
-void vp9_free_frame_buffers(struct VP9Common *cm);
-
-void vp9_update_frame_size(struct VP9Common *cm);
-
-void vp9_swap_mi_and_prev_mi(struct VP9Common *cm);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_ALLOCCOMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.c
deleted file mode 100644
index fedfb18..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_blockd.h"
-
-MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
- const MODE_INFO *left_mi, int b) {
- if (b == 0 || b == 2) {
- if (!left_mi || is_inter_block(&left_mi->mbmi))
- return DC_PRED;
-
- return get_y_mode(left_mi, b + 1);
- } else {
- assert(b == 1 || b == 3);
- return cur_mi->bmi[b - 1].as_mode;
- }
-}
-
-MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi,
- const MODE_INFO *above_mi, int b) {
- if (b == 0 || b == 1) {
- if (!above_mi || is_inter_block(&above_mi->mbmi))
- return DC_PRED;
-
- return get_y_mode(above_mi, b + 2);
- } else {
- assert(b == 2 || b == 3);
- return cur_mi->bmi[b - 2].as_mode;
- }
-}
-
-void vp9_foreach_transformed_block_in_plane(
- const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
- foreach_transformed_block_visitor visit, void *arg) {
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- const MB_MODE_INFO* mbmi = &xd->mi[0]->mbmi;
- // 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 = plane ? get_uv_tx_size(mbmi)
- : mbmi->tx_size;
- const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
- 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 step = 1 << (tx_size << 1);
- int i;
-
- // 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.
- if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
- int r, c;
-
- int max_blocks_wide = num_4x4_w;
- int max_blocks_high = num_4x4_h;
-
- // xd->mb_to_right_edge is in units of pixels * 8. This converts
- // it to 4x4 block sizes.
- if (xd->mb_to_right_edge < 0)
- max_blocks_wide += (xd->mb_to_right_edge >> (5 + pd->subsampling_x));
-
- if (xd->mb_to_bottom_edge < 0)
- max_blocks_high += (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
-
- i = 0;
- // Unlike the normal case - in here we have to 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 < num_4x4_h; r += (1 << tx_size)) {
- for (c = 0; c < num_4x4_w; c += (1 << tx_size)) {
- if (r < max_blocks_high && c < max_blocks_wide)
- visit(plane, i, plane_bsize, tx_size, arg);
- i += step;
- }
- }
- } else {
- for (i = 0; i < num_4x4_w * num_4x4_h; i += step)
- visit(plane, i, plane_bsize, tx_size, arg);
- }
-}
-
-void vp9_foreach_transformed_block(const MACROBLOCKD* const xd,
- BLOCK_SIZE bsize,
- foreach_transformed_block_visitor visit,
- void *arg) {
- int plane;
-
- for (plane = 0; plane < MAX_MB_PLANE; plane++)
- vp9_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
-}
-
-void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
- int aoff, int loff) {
- ENTROPY_CONTEXT *const a = pd->above_context + aoff;
- ENTROPY_CONTEXT *const l = pd->left_context + loff;
- const int tx_size_in_blocks = 1 << tx_size;
-
- // above
- if (has_eob && xd->mb_to_right_edge < 0) {
- int i;
- const int blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize] +
- (xd->mb_to_right_edge >> (5 + pd->subsampling_x));
- int above_contexts = tx_size_in_blocks;
- if (above_contexts + aoff > blocks_wide)
- above_contexts = blocks_wide - aoff;
-
- for (i = 0; i < above_contexts; ++i)
- a[i] = has_eob;
- for (i = above_contexts; i < tx_size_in_blocks; ++i)
- a[i] = 0;
- } else {
- vpx_memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
- }
-
- // left
- if (has_eob && xd->mb_to_bottom_edge < 0) {
- int i;
- const int blocks_high = num_4x4_blocks_high_lookup[plane_bsize] +
- (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
- int left_contexts = tx_size_in_blocks;
- if (left_contexts + loff > blocks_high)
- left_contexts = blocks_high - loff;
-
- for (i = 0; i < left_contexts; ++i)
- l[i] = has_eob;
- for (i = left_contexts; i < tx_size_in_blocks; ++i)
- l[i] = 0;
- } else {
- vpx_memset(l, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
- }
-}
-
-void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
- int i;
-
- for (i = 0; i < MAX_MB_PLANE; i++) {
- xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y;
- xd->plane[i].subsampling_x = i ? ss_x : 0;
- xd->plane[i].subsampling_y = i ? ss_y : 0;
- }
-#if CONFIG_ALPHA
- // TODO(jkoleszar): Using the Y w/h for now
- xd->plane[3].plane_type = PLANE_TYPE_Y;
- xd->plane[3].subsampling_x = 0;
- xd->plane[3].subsampling_y = 0;
-#endif
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.h
deleted file mode 100644
index 55320a6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_blockd.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_COMMON_VP9_BLOCKD_H_
-#define VP9_COMMON_VP9_BLOCKD_H_
-
-#include "./vpx_config.h"
-
-#include "vpx_ports/mem.h"
-#include "vpx_scale/yv12config.h"
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_common_data.h"
-#include "vp9/common/vp9_enums.h"
-#include "vp9/common/vp9_filter.h"
-#include "vp9/common/vp9_mv.h"
-#include "vp9/common/vp9_scale.h"
-#include "vp9/common/vp9_seg_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BLOCK_SIZE_GROUPS 4
-#define SKIP_CONTEXTS 3
-#define INTER_MODE_CONTEXTS 7
-
-/* Segment Feature Masks */
-#define MAX_MV_REF_CANDIDATES 2
-
-#define INTRA_INTER_CONTEXTS 4
-#define COMP_INTER_CONTEXTS 5
-#define REF_CONTEXTS 5
-
-typedef enum {
- PLANE_TYPE_Y = 0,
- PLANE_TYPE_UV = 1,
- PLANE_TYPES
-} PLANE_TYPE;
-
-typedef char ENTROPY_CONTEXT;
-
-typedef char PARTITION_CONTEXT;
-
-static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a,
- ENTROPY_CONTEXT b) {
- return (a != 0) + (b != 0);
-}
-
-typedef enum {
- KEY_FRAME = 0,
- INTER_FRAME = 1,
- FRAME_TYPES,
-} FRAME_TYPE;
-
-typedef enum {
- DC_PRED, // Average of above and left pixels
- V_PRED, // Vertical
- H_PRED, // Horizontal
- D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi)
- D135_PRED, // Directional 135 deg = 180 - 45
- D117_PRED, // Directional 117 deg = 180 - 63
- D153_PRED, // Directional 153 deg = 180 - 27
- D207_PRED, // Directional 207 deg = 180 + 27
- D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
- TM_PRED, // True-motion
- NEARESTMV,
- NEARMV,
- ZEROMV,
- NEWMV,
- MB_MODE_COUNT
-} MB_PREDICTION_MODE;
-
-static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) {
- return mode >= NEARESTMV && mode <= NEWMV;
-}
-
-#define INTRA_MODES (TM_PRED + 1)
-
-#define INTER_MODES (1 + NEWMV - NEARESTMV)
-
-#define INTER_OFFSET(mode) ((mode) - NEARESTMV)
-
-/* For keyframes, intra block modes are predicted by the (already decoded)
- modes for the Y blocks to the left and above us; for interframes, there
- is a single probability table. */
-
-typedef struct {
- MB_PREDICTION_MODE as_mode;
- int_mv as_mv[2]; // first, second inter predictor motion vectors
-} b_mode_info;
-
-typedef enum {
- NONE = -1,
- INTRA_FRAME = 0,
- LAST_FRAME = 1,
- GOLDEN_FRAME = 2,
- ALTREF_FRAME = 3,
- MAX_REF_FRAMES = 4
-} MV_REFERENCE_FRAME;
-
-static INLINE int b_width_log2(BLOCK_SIZE sb_type) {
- return b_width_log2_lookup[sb_type];
-}
-static INLINE int b_height_log2(BLOCK_SIZE sb_type) {
- return b_height_log2_lookup[sb_type];
-}
-
-static INLINE int mi_width_log2(BLOCK_SIZE sb_type) {
- return mi_width_log2_lookup[sb_type];
-}
-
-// This structure now relates to 8x8 block regions.
-typedef struct {
- // Common for both INTER and INTRA blocks
- BLOCK_SIZE sb_type;
- MB_PREDICTION_MODE mode;
- TX_SIZE tx_size;
- uint8_t skip;
- uint8_t segment_id;
- uint8_t seg_id_predicted; // valid only when temporal_update is enabled
-
- // Only for INTRA blocks
- MB_PREDICTION_MODE uv_mode;
-
- // Only for INTER blocks
- MV_REFERENCE_FRAME ref_frame[2];
- int_mv mv[2];
- int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
- uint8_t mode_context[MAX_REF_FRAMES];
- INTERP_FILTER interp_filter;
-} MB_MODE_INFO;
-
-typedef struct {
- MB_MODE_INFO mbmi;
- b_mode_info bmi[4];
-} MODE_INFO;
-
-static INLINE MB_PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) {
- return mi->mbmi.sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode
- : mi->mbmi.mode;
-}
-
-static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) {
- return mbmi->ref_frame[0] > INTRA_FRAME;
-}
-
-static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) {
- return mbmi->ref_frame[1] > INTRA_FRAME;
-}
-
-MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
- const MODE_INFO *left_mi, int b);
-
-MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi,
- const MODE_INFO *above_mi, int b);
-
-enum mv_precision {
- MV_PRECISION_Q3,
- MV_PRECISION_Q4
-};
-
-#if CONFIG_ALPHA
-enum { MAX_MB_PLANE = 4 };
-#else
-enum { MAX_MB_PLANE = 3 };
-#endif
-
-struct buf_2d {
- uint8_t *buf;
- int stride;
-};
-
-struct macroblockd_plane {
- int16_t *dqcoeff;
- PLANE_TYPE plane_type;
- int subsampling_x;
- int subsampling_y;
- struct buf_2d dst;
- struct buf_2d pre[2];
- const int16_t *dequant;
- ENTROPY_CONTEXT *above_context;
- ENTROPY_CONTEXT *left_context;
-};
-
-#define BLOCK_OFFSET(x, i) ((x) + (i) * 16)
-
-typedef struct RefBuffer {
- // TODO(dkovalev): idx is not really required and should be removed, now it
- // is used in vp9_onyxd_if.c
- int idx;
- YV12_BUFFER_CONFIG *buf;
- struct scale_factors sf;
-} RefBuffer;
-
-typedef struct macroblockd {
- struct macroblockd_plane plane[MAX_MB_PLANE];
-
- int mi_stride;
-
- // A NULL indicates that the 8x8 is not part of the image
- MODE_INFO **mi;
-
- int up_available;
- int left_available;
-
- /* Distance of MB away from frame edges */
- int mb_to_left_edge;
- int mb_to_right_edge;
- int mb_to_top_edge;
- int mb_to_bottom_edge;
-
- /* pointers to reference frames */
- RefBuffer *block_refs[2];
-
- /* pointer to current frame */
- const YV12_BUFFER_CONFIG *cur_buf;
-
- /* mc buffer */
- DECLARE_ALIGNED(16, uint8_t, mc_buf[80 * 2 * 80 * 2]);
-
- int lossless;
- /* Inverse transform function pointers. */
- void (*itxm_add)(const int16_t *input, uint8_t *dest, int stride, int eob);
-
- int corrupted;
-
- DECLARE_ALIGNED(16, int16_t, dqcoeff[MAX_MB_PLANE][64 * 64]);
-
- ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
- ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16];
-
- PARTITION_CONTEXT *above_seg_context;
- PARTITION_CONTEXT left_seg_context[8];
-} MACROBLOCKD;
-
-static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
- PARTITION_TYPE partition) {
- const BLOCK_SIZE subsize = subsize_lookup[partition][bsize];
- assert(subsize < BLOCK_SIZES);
- return subsize;
-}
-
-extern const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES];
-
-static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
- const MACROBLOCKD *xd) {
- const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
-
- if (plane_type != PLANE_TYPE_Y || is_inter_block(mbmi))
- return DCT_DCT;
- return intra_mode_to_tx_type_lookup[mbmi->mode];
-}
-
-static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
- const MACROBLOCKD *xd, int ib) {
- const MODE_INFO *const mi = xd->mi[0];
-
- if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(&mi->mbmi))
- return DCT_DCT;
-
- return intra_mode_to_tx_type_lookup[get_y_mode(mi, ib)];
-}
-
-void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
-
-static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) {
- if (bsize < BLOCK_8X8) {
- return TX_4X4;
- } else {
- // TODO(dkovalev): Assuming YUV420 (ss_x == 1, ss_y == 1)
- const BLOCK_SIZE plane_bsize = ss_size_lookup[bsize][1][1];
- return MIN(y_tx_size, max_txsize_lookup[plane_bsize]);
- }
-}
-
-static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi) {
- return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type);
-}
-
-static INLINE BLOCK_SIZE get_plane_block_size(BLOCK_SIZE bsize,
- const struct macroblockd_plane *pd) {
- BLOCK_SIZE bs = ss_size_lookup[bsize][pd->subsampling_x][pd->subsampling_y];
- assert(bs < BLOCK_SIZES);
- return bs;
-}
-
-typedef void (*foreach_transformed_block_visitor)(int plane, int block,
- BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size,
- void *arg);
-
-void vp9_foreach_transformed_block_in_plane(
- const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
- foreach_transformed_block_visitor visit, void *arg);
-
-
-void vp9_foreach_transformed_block(
- const MACROBLOCKD* const xd, BLOCK_SIZE bsize,
- foreach_transformed_block_visitor visit, void *arg);
-
-static INLINE void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, int block,
- int *x, int *y) {
- const int bwl = b_width_log2(plane_bsize);
- const int tx_cols_log2 = bwl - tx_size;
- const int tx_cols = 1 << tx_cols_log2;
- const int raster_mb = block >> (tx_size << 1);
- *x = (raster_mb & (tx_cols - 1)) << tx_size;
- *y = (raster_mb >> tx_cols_log2) << tx_size;
-}
-
-void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
- int aoff, int loff);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_BLOCKD_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common.h
deleted file mode 100644
index a9fe64d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_COMMON_H_
-#define VP9_COMMON_VP9_COMMON_H_
-
-/* Interface header for common constant data structures and lookup tables */
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#define MAX(x, y) (((x) > (y)) ? (x) : (y))
-
-#define ROUND_POWER_OF_TWO(value, n) \
- (((value) + (1 << ((n) - 1))) >> (n))
-
-#define ALIGN_POWER_OF_TWO(value, n) \
- (((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
-
-// Only need this for fixed-size arrays, for structs just assign.
-#define vp9_copy(dest, src) { \
- assert(sizeof(dest) == sizeof(src)); \
- vpx_memcpy(dest, src, sizeof(src)); \
- }
-
-// Use this for variably-sized arrays.
-#define vp9_copy_array(dest, src, n) { \
- assert(sizeof(*dest) == sizeof(*src)); \
- vpx_memcpy(dest, src, n * sizeof(*src)); \
- }
-
-#define vp9_zero(dest) vpx_memset(&dest, 0, sizeof(dest))
-#define vp9_zero_array(dest, n) vpx_memset(dest, 0, n * sizeof(*dest))
-
-static INLINE uint8_t clip_pixel(int val) {
- return (val > 255) ? 255 : (val < 0) ? 0 : val;
-}
-
-static INLINE int clamp(int value, int low, int high) {
- return value < low ? low : (value > high ? high : value);
-}
-
-static INLINE double fclamp(double value, double low, double high) {
- return value < low ? low : (value > high ? high : value);
-}
-
-static INLINE int get_unsigned_bits(unsigned int num_values) {
- return num_values > 0 ? get_msb(num_values) + 1 : 0;
-}
-
-#if CONFIG_DEBUG
-#define CHECK_MEM_ERROR(cm, lval, expr) do { \
- lval = (expr); \
- if (!lval) \
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \
- "Failed to allocate "#lval" at %s:%d", \
- __FILE__, __LINE__); \
- } while (0)
-#else
-#define CHECK_MEM_ERROR(cm, lval, expr) do { \
- lval = (expr); \
- if (!lval) \
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \
- "Failed to allocate "#lval); \
- } while (0)
-#endif
-
-#define VP9_SYNC_CODE_0 0x49
-#define VP9_SYNC_CODE_1 0x83
-#define VP9_SYNC_CODE_2 0x42
-
-#define VP9_FRAME_MARKER 0x2
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.c
deleted file mode 100644
index a927823..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_common_data.h"
-
-// Log 2 conversion lookup tables for block width and height
-const int b_width_log2_lookup[BLOCK_SIZES] =
- {0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4};
-const int b_height_log2_lookup[BLOCK_SIZES] =
- {0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4};
-const int num_4x4_blocks_wide_lookup[BLOCK_SIZES] =
- {1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16};
-const int num_4x4_blocks_high_lookup[BLOCK_SIZES] =
- {1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16};
-// Log 2 conversion lookup tables for modeinfo width and height
-const int mi_width_log2_lookup[BLOCK_SIZES] =
- {0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3};
-const int num_8x8_blocks_wide_lookup[BLOCK_SIZES] =
- {1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8};
-const int num_8x8_blocks_high_lookup[BLOCK_SIZES] =
- {1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8};
-
-// MIN(3, MIN(b_width_log2(bsize), b_height_log2(bsize)))
-const int size_group_lookup[BLOCK_SIZES] =
- {0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3};
-
-const int num_pels_log2_lookup[BLOCK_SIZES] =
- {4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12};
-
-
-const PARTITION_TYPE partition_lookup[][BLOCK_SIZES] = {
- { // 4X4
- // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
- PARTITION_NONE, PARTITION_INVALID, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
- PARTITION_INVALID
- }, { // 8X8
- // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
- PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE,
- PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID
- }, { // 16X16
- // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
- PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
- PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID
- }, { // 32X32
- // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
- PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
- PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT,
- PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID,
- PARTITION_INVALID, PARTITION_INVALID
- }, { // 64X64
- // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
- PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
- PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
- PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ,
- PARTITION_NONE
- }
-};
-
-const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = {
- { // PARTITION_NONE
- BLOCK_4X4, BLOCK_4X8, BLOCK_8X4,
- BLOCK_8X8, BLOCK_8X16, BLOCK_16X8,
- BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
- BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
- BLOCK_64X64,
- }, { // PARTITION_HORZ
- BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_8X4, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_16X8, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_32X16, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_64X32,
- }, { // PARTITION_VERT
- BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_4X8, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_8X16, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_16X32, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_32X64,
- }, { // PARTITION_SPLIT
- BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_4X4, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_8X8, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_16X16, BLOCK_INVALID, BLOCK_INVALID,
- BLOCK_32X32,
- }
-};
-
-const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
- TX_4X4, TX_4X4, TX_4X4,
- TX_8X8, TX_8X8, TX_8X8,
- TX_16X16, TX_16X16, TX_16X16,
- TX_32X32, TX_32X32, TX_32X32, TX_32X32
-};
-
-const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
- TX_4X4, // ONLY_4X4
- TX_8X8, // ALLOW_8X8
- TX_16X16, // ALLOW_16X16
- TX_32X32, // ALLOW_32X32
- TX_32X32, // TX_MODE_SELECT
-};
-
-const BLOCK_SIZE ss_size_lookup[BLOCK_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
- {{BLOCK_4X4, BLOCK_INVALID}, {BLOCK_INVALID, BLOCK_INVALID}},
- {{BLOCK_4X8, BLOCK_4X4}, {BLOCK_INVALID, BLOCK_INVALID}},
- {{BLOCK_8X4, BLOCK_INVALID}, {BLOCK_4X4, BLOCK_INVALID}},
- {{BLOCK_8X8, BLOCK_8X4}, {BLOCK_4X8, BLOCK_4X4}},
- {{BLOCK_8X16, BLOCK_8X8}, {BLOCK_INVALID, BLOCK_4X8}},
- {{BLOCK_16X8, BLOCK_INVALID}, {BLOCK_8X8, BLOCK_8X4}},
- {{BLOCK_16X16, BLOCK_16X8}, {BLOCK_8X16, BLOCK_8X8}},
- {{BLOCK_16X32, BLOCK_16X16}, {BLOCK_INVALID, BLOCK_8X16}},
- {{BLOCK_32X16, BLOCK_INVALID}, {BLOCK_16X16, BLOCK_16X8}},
- {{BLOCK_32X32, BLOCK_32X16}, {BLOCK_16X32, BLOCK_16X16}},
- {{BLOCK_32X64, BLOCK_32X32}, {BLOCK_INVALID, BLOCK_16X32}},
- {{BLOCK_64X32, BLOCK_INVALID}, {BLOCK_32X32, BLOCK_32X16}},
- {{BLOCK_64X64, BLOCK_64X32}, {BLOCK_32X64, BLOCK_32X32}},
-};
-
-// Generates 4 bit field in which each bit set to 1 represents
-// a blocksize partition 1111 means we split 64x64, 32x32, 16x16
-// and 8x8. 1000 means we just split the 64x64 to 32x32
-const struct {
- PARTITION_CONTEXT above;
- PARTITION_CONTEXT left;
-} partition_context_lookup[BLOCK_SIZES]= {
- {15, 15}, // 4X4 - {0b1111, 0b1111}
- {15, 14}, // 4X8 - {0b1111, 0b1110}
- {14, 15}, // 8X4 - {0b1110, 0b1111}
- {14, 14}, // 8X8 - {0b1110, 0b1110}
- {14, 12}, // 8X16 - {0b1110, 0b1100}
- {12, 14}, // 16X8 - {0b1100, 0b1110}
- {12, 12}, // 16X16 - {0b1100, 0b1100}
- {12, 8 }, // 16X32 - {0b1100, 0b1000}
- {8, 12}, // 32X16 - {0b1000, 0b1100}
- {8, 8 }, // 32X32 - {0b1000, 0b1000}
- {8, 0 }, // 32X64 - {0b1000, 0b0000}
- {0, 8 }, // 64X32 - {0b0000, 0b1000}
- {0, 0 }, // 64X64 - {0b0000, 0b0000}
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.h
deleted file mode 100644
index f419627..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_common_data.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_COMMON_DATA_H_
-#define VP9_COMMON_VP9_COMMON_DATA_H_
-
-#include "vp9/common/vp9_enums.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const int b_width_log2_lookup[BLOCK_SIZES];
-extern const int b_height_log2_lookup[BLOCK_SIZES];
-extern const int mi_width_log2_lookup[BLOCK_SIZES];
-extern const int num_8x8_blocks_wide_lookup[BLOCK_SIZES];
-extern const int num_8x8_blocks_high_lookup[BLOCK_SIZES];
-extern const int num_4x4_blocks_high_lookup[BLOCK_SIZES];
-extern const int num_4x4_blocks_wide_lookup[BLOCK_SIZES];
-extern const int size_group_lookup[BLOCK_SIZES];
-extern const int num_pels_log2_lookup[BLOCK_SIZES];
-extern const PARTITION_TYPE partition_lookup[][BLOCK_SIZES];
-extern const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES];
-extern const TX_SIZE max_txsize_lookup[BLOCK_SIZES];
-extern const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES];
-extern const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2];
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_COMMON_DATA_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.c
deleted file mode 100644
index 622faed..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_convolve.h"
-#include "vp9/common/vp9_filter.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-
-static void convolve_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;
- 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;
- 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));
- x_q4 += x_step_q4;
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_avg_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;
- 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;
- for (k = 0; k < SUBPEL_TAPS; ++k)
- sum += src_x[k] * x_filter[k];
- dst[x] = ROUND_POWER_OF_TWO(dst[x] +
- clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)), 1);
- x_q4 += x_step_q4;
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-static void convolve_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;
- 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 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;
- 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));
- y_q4 += y_step_q4;
- }
- ++src;
- ++dst;
- }
-}
-
-static void convolve_avg_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;
- 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 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;
- for (k = 0; k < SUBPEL_TAPS; ++k)
- sum += src_y[k * src_stride] * y_filter[k];
- dst[y * dst_stride] = ROUND_POWER_OF_TWO(dst[y * dst_stride] +
- clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)), 1);
- y_q4 += y_step_q4;
- }
- ++src;
- ++dst;
- }
-}
-
-static void convolve(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) {
- // Fixed size intermediate buffer places limits on parameters.
- // Maximum intermediate_height is 324, for y_step_q4 == 80,
- // h == 64, taps == 8.
- // y_step_q4 of 80 allows for 1/10 scale for 5 layer svc
- uint8_t temp[64 * 324];
- int intermediate_height = (((h - 1) * y_step_q4 + 15) >> 4) + SUBPEL_TAPS;
-
- assert(w <= 64);
- assert(h <= 64);
- assert(y_step_q4 <= 80);
- assert(x_step_q4 <= 80);
-
- if (intermediate_height < h)
- intermediate_height = h;
-
- convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride, temp, 64,
- x_filters, x0_q4, x_step_q4, w, intermediate_height);
- convolve_vert(temp + 64 * (SUBPEL_TAPS / 2 - 1), 64, dst, dst_stride,
- y_filters, y0_q4, y_step_q4, w, h);
-}
-
-static const InterpKernel *get_filter_base(const int16_t *filter) {
- // NOTE: This assumes that the filter table is 256-byte aligned.
- // TODO(agrange) Modify to make independent of table alignment.
- return (const InterpKernel *)(((intptr_t)filter) & ~((intptr_t)0xFF));
-}
-
-static int get_filter_offset(const int16_t *f, const InterpKernel *base) {
- return (int)((const InterpKernel *)(intptr_t)f - base);
-}
-
-void vp9_convolve8_horiz_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);
- (void)filter_y;
- (void)y_step_q4;
- convolve_horiz(src, src_stride, dst, dst_stride, filters_x,
- x0_q4, x_step_q4, w, h);
-}
-
-void vp9_convolve8_avg_horiz_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);
- (void)filter_y;
- (void)y_step_q4;
-
- convolve_avg_horiz(src, src_stride, dst, dst_stride, filters_x,
- x0_q4, x_step_q4, w, h);
-}
-
-void vp9_convolve8_vert_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_y = get_filter_base(filter_y);
- const int y0_q4 = get_filter_offset(filter_y, filters_y);
- (void)x_step_q4;
- (void)filter_x;
- convolve_vert(src, src_stride, dst, dst_stride, filters_y,
- y0_q4, y_step_q4, w, h);
-}
-
-void vp9_convolve8_avg_vert_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_y = get_filter_base(filter_y);
- const int y0_q4 = get_filter_offset(filter_y, filters_y);
- (void)x_step_q4;
- (void)filter_x;
- convolve_avg_vert(src, src_stride, dst, dst_stride, filters_y,
- y0_q4, y_step_q4, w, h);
-}
-
-void vp9_convolve8_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(src, src_stride, dst, dst_stride,
- filters_x, x0_q4, x_step_q4,
- filters_y, y0_q4, y_step_q4, w, h);
-}
-
-void vp9_convolve8_avg_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) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 64 * 64);
- assert(w <= 64);
- assert(h <= 64);
-
- vp9_convolve8_c(src, src_stride, temp, 64,
- filter_x, x_step_q4, filter_y, y_step_q4, w, h);
- vp9_convolve_avg_c(temp, 64, dst, dst_stride, NULL, 0, NULL, 0, w, h);
-}
-
-void vp9_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int r;
- (void)filter_x;
- (void)filter_y;
- (void)filter_x_stride;
- (void)filter_y_stride;
- for (r = h; r > 0; --r) {
- vpx_memcpy(dst, src, w);
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve_avg_c(const uint8_t *src, ptrdiff_t src_stride,
- uint8_t *dst, ptrdiff_t dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
- (void)filter_x;
- (void)filter_y;
- (void)filter_x_stride;
- (void)filter_y_stride;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x)
- dst[x] = ROUND_POWER_OF_TWO(dst[x] + src[x], 1);
-
- src += src_stride;
- dst += dst_stride;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.h
deleted file mode 100644
index 6bf71fc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_convolve.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VP9_COMMON_VP9_CONVOLVE_H_
-#define VP9_COMMON_VP9_CONVOLVE_H_
-
-#include "./vpx_config.h"
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#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,
- const int16_t *filter_y, int y_step_q4,
- int w, int h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_CONVOLVE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_debugmodes.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_debugmodes.c
deleted file mode 100644
index 8f150a4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_debugmodes.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdio.h>
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-static void log_frame_info(VP9_COMMON *cm, const char *str, FILE *f) {
- fprintf(f, "%s", str);
- fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame,
- cm->show_frame, cm->base_qindex);
-}
-/* This function dereferences a pointer to the mbmi structure
- * and uses the passed in member offset to print out the value of an integer
- * for each mbmi member value in the mi structure.
- */
-static void print_mi_data(VP9_COMMON *cm, FILE *file, const char *descriptor,
- size_t member_offset) {
- int mi_row;
- int mi_col;
- int mi_index = 0;
- MODE_INFO **mi_8x8 = cm->mi_grid_visible;
- int rows = cm->mi_rows;
- int cols = cm->mi_cols;
- char prefix = descriptor[0];
-
- log_frame_info(cm, descriptor, file);
- mi_index = 0;
- 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_8x8[mi_index]->mbmi) +
- member_offset)));
- mi_index++;
- }
- fprintf(file, "\n");
- mi_index += 8;
- }
- fprintf(file, "\n");
-}
-void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, const char *file) {
- int mi_row;
- int mi_col;
- int mi_index = 0;
- FILE *mvs = fopen(file, "a");
- MODE_INFO **mi_8x8 = cm->mi_grid_visible;
- int rows = cm->mi_rows;
- int cols = cm->mi_cols;
-
- print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type));
- print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode));
- print_mi_data(cm, mvs, "Skips:", offsetof(MB_MODE_INFO, skip));
- print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0]));
- print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size));
- print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode));
-
- log_frame_info(cm, "Vectors ", mvs);
- for (mi_row = 0; mi_row < rows; mi_row++) {
- fprintf(mvs, "V ");
- for (mi_col = 0; mi_col < cols; mi_col++) {
- fprintf(mvs, "%4d:%4d ", mi_8x8[mi_index]->mbmi.mv[0].as_mv.row,
- mi_8x8[mi_index]->mbmi.mv[0].as_mv.col);
- mi_index++;
- }
- fprintf(mvs, "\n");
- mi_index += 8;
- }
- fprintf(mvs, "\n");
-
- fclose(mvs);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.c
deleted file mode 100644
index bc12f9a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.c
+++ /dev/null
@@ -1,783 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx/vpx_integer.h"
-
-
-const uint8_t vp9_coefband_trans_8x8plus[1024] = {
- 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 5,
- // beyond MAXBAND_INDEX+1 all values are filled as 5
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-};
-
-const uint8_t vp9_coefband_trans_4x4[16] = {
- 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5,
-};
-
-const uint8_t vp9_pt_energy_class[ENTROPY_TOKENS] = {
- 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5
-};
-
-const vp9_tree_index vp9_coefmodel_tree[TREE_SIZE(UNCONSTRAINED_NODES + 1)] = {
- -EOB_MODEL_TOKEN, 2,
- -ZERO_TOKEN, 4,
- -ONE_TOKEN, -TWO_TOKEN,
-};
-
-// Model obtained from a 2-sided zero-centerd distribuition derived
-// from a Pareto distribution. The cdf of the distribution is:
-// cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta]
-//
-// For a given beta and a given probablity of the 1-node, the alpha
-// is first solved, and then the {alpha, beta} pair is used to generate
-// the probabilities for the rest of the nodes.
-
-// beta = 8
-
-// Every odd line in this table can be generated from the even lines
-// by averaging :
-// vp9_pareto8_full[l][node] = (vp9_pareto8_full[l-1][node] +
-// vp9_pareto8_full[l+1][node] ) >> 1;
-const vp9_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
- { 3, 86, 128, 6, 86, 23, 88, 29},
- { 6, 86, 128, 11, 87, 42, 91, 52},
- { 9, 86, 129, 17, 88, 61, 94, 76},
- { 12, 86, 129, 22, 88, 77, 97, 93},
- { 15, 87, 129, 28, 89, 93, 100, 110},
- { 17, 87, 129, 33, 90, 105, 103, 123},
- { 20, 88, 130, 38, 91, 118, 106, 136},
- { 23, 88, 130, 43, 91, 128, 108, 146},
- { 26, 89, 131, 48, 92, 139, 111, 156},
- { 28, 89, 131, 53, 93, 147, 114, 163},
- { 31, 90, 131, 58, 94, 156, 117, 171},
- { 34, 90, 131, 62, 94, 163, 119, 177},
- { 37, 90, 132, 66, 95, 171, 122, 184},
- { 39, 90, 132, 70, 96, 177, 124, 189},
- { 42, 91, 132, 75, 97, 183, 127, 194},
- { 44, 91, 132, 79, 97, 188, 129, 198},
- { 47, 92, 133, 83, 98, 193, 132, 202},
- { 49, 92, 133, 86, 99, 197, 134, 205},
- { 52, 93, 133, 90, 100, 201, 137, 208},
- { 54, 93, 133, 94, 100, 204, 139, 211},
- { 57, 94, 134, 98, 101, 208, 142, 214},
- { 59, 94, 134, 101, 102, 211, 144, 216},
- { 62, 94, 135, 105, 103, 214, 146, 218},
- { 64, 94, 135, 108, 103, 216, 148, 220},
- { 66, 95, 135, 111, 104, 219, 151, 222},
- { 68, 95, 135, 114, 105, 221, 153, 223},
- { 71, 96, 136, 117, 106, 224, 155, 225},
- { 73, 96, 136, 120, 106, 225, 157, 226},
- { 76, 97, 136, 123, 107, 227, 159, 228},
- { 78, 97, 136, 126, 108, 229, 160, 229},
- { 80, 98, 137, 129, 109, 231, 162, 231},
- { 82, 98, 137, 131, 109, 232, 164, 232},
- { 84, 98, 138, 134, 110, 234, 166, 233},
- { 86, 98, 138, 137, 111, 235, 168, 234},
- { 89, 99, 138, 140, 112, 236, 170, 235},
- { 91, 99, 138, 142, 112, 237, 171, 235},
- { 93, 100, 139, 145, 113, 238, 173, 236},
- { 95, 100, 139, 147, 114, 239, 174, 237},
- { 97, 101, 140, 149, 115, 240, 176, 238},
- { 99, 101, 140, 151, 115, 241, 177, 238},
- {101, 102, 140, 154, 116, 242, 179, 239},
- {103, 102, 140, 156, 117, 242, 180, 239},
- {105, 103, 141, 158, 118, 243, 182, 240},
- {107, 103, 141, 160, 118, 243, 183, 240},
- {109, 104, 141, 162, 119, 244, 185, 241},
- {111, 104, 141, 164, 119, 244, 186, 241},
- {113, 104, 142, 166, 120, 245, 187, 242},
- {114, 104, 142, 168, 121, 245, 188, 242},
- {116, 105, 143, 170, 122, 246, 190, 243},
- {118, 105, 143, 171, 122, 246, 191, 243},
- {120, 106, 143, 173, 123, 247, 192, 244},
- {121, 106, 143, 175, 124, 247, 193, 244},
- {123, 107, 144, 177, 125, 248, 195, 244},
- {125, 107, 144, 178, 125, 248, 196, 244},
- {127, 108, 145, 180, 126, 249, 197, 245},
- {128, 108, 145, 181, 127, 249, 198, 245},
- {130, 109, 145, 183, 128, 249, 199, 245},
- {132, 109, 145, 184, 128, 249, 200, 245},
- {134, 110, 146, 186, 129, 250, 201, 246},
- {135, 110, 146, 187, 130, 250, 202, 246},
- {137, 111, 147, 189, 131, 251, 203, 246},
- {138, 111, 147, 190, 131, 251, 204, 246},
- {140, 112, 147, 192, 132, 251, 205, 247},
- {141, 112, 147, 193, 132, 251, 206, 247},
- {143, 113, 148, 194, 133, 251, 207, 247},
- {144, 113, 148, 195, 134, 251, 207, 247},
- {146, 114, 149, 197, 135, 252, 208, 248},
- {147, 114, 149, 198, 135, 252, 209, 248},
- {149, 115, 149, 199, 136, 252, 210, 248},
- {150, 115, 149, 200, 137, 252, 210, 248},
- {152, 115, 150, 201, 138, 252, 211, 248},
- {153, 115, 150, 202, 138, 252, 212, 248},
- {155, 116, 151, 204, 139, 253, 213, 249},
- {156, 116, 151, 205, 139, 253, 213, 249},
- {158, 117, 151, 206, 140, 253, 214, 249},
- {159, 117, 151, 207, 141, 253, 215, 249},
- {161, 118, 152, 208, 142, 253, 216, 249},
- {162, 118, 152, 209, 142, 253, 216, 249},
- {163, 119, 153, 210, 143, 253, 217, 249},
- {164, 119, 153, 211, 143, 253, 217, 249},
- {166, 120, 153, 212, 144, 254, 218, 250},
- {167, 120, 153, 212, 145, 254, 219, 250},
- {168, 121, 154, 213, 146, 254, 220, 250},
- {169, 121, 154, 214, 146, 254, 220, 250},
- {171, 122, 155, 215, 147, 254, 221, 250},
- {172, 122, 155, 216, 147, 254, 221, 250},
- {173, 123, 155, 217, 148, 254, 222, 250},
- {174, 123, 155, 217, 149, 254, 222, 250},
- {176, 124, 156, 218, 150, 254, 223, 250},
- {177, 124, 156, 219, 150, 254, 223, 250},
- {178, 125, 157, 220, 151, 254, 224, 251},
- {179, 125, 157, 220, 151, 254, 224, 251},
- {180, 126, 157, 221, 152, 254, 225, 251},
- {181, 126, 157, 221, 152, 254, 225, 251},
- {183, 127, 158, 222, 153, 254, 226, 251},
- {184, 127, 158, 223, 154, 254, 226, 251},
- {185, 128, 159, 224, 155, 255, 227, 251},
- {186, 128, 159, 224, 155, 255, 227, 251},
- {187, 129, 160, 225, 156, 255, 228, 251},
- {188, 130, 160, 225, 156, 255, 228, 251},
- {189, 131, 160, 226, 157, 255, 228, 251},
- {190, 131, 160, 226, 158, 255, 228, 251},
- {191, 132, 161, 227, 159, 255, 229, 251},
- {192, 132, 161, 227, 159, 255, 229, 251},
- {193, 133, 162, 228, 160, 255, 230, 252},
- {194, 133, 162, 229, 160, 255, 230, 252},
- {195, 134, 163, 230, 161, 255, 231, 252},
- {196, 134, 163, 230, 161, 255, 231, 252},
- {197, 135, 163, 231, 162, 255, 231, 252},
- {198, 135, 163, 231, 162, 255, 231, 252},
- {199, 136, 164, 232, 163, 255, 232, 252},
- {200, 136, 164, 232, 164, 255, 232, 252},
- {201, 137, 165, 233, 165, 255, 233, 252},
- {201, 137, 165, 233, 165, 255, 233, 252},
- {202, 138, 166, 233, 166, 255, 233, 252},
- {203, 138, 166, 233, 166, 255, 233, 252},
- {204, 139, 166, 234, 167, 255, 234, 252},
- {205, 139, 166, 234, 167, 255, 234, 252},
- {206, 140, 167, 235, 168, 255, 235, 252},
- {206, 140, 167, 235, 168, 255, 235, 252},
- {207, 141, 168, 236, 169, 255, 235, 252},
- {208, 141, 168, 236, 170, 255, 235, 252},
- {209, 142, 169, 237, 171, 255, 236, 252},
- {209, 143, 169, 237, 171, 255, 236, 252},
- {210, 144, 169, 237, 172, 255, 236, 252},
- {211, 144, 169, 237, 172, 255, 236, 252},
- {212, 145, 170, 238, 173, 255, 237, 252},
- {213, 145, 170, 238, 173, 255, 237, 252},
- {214, 146, 171, 239, 174, 255, 237, 253},
- {214, 146, 171, 239, 174, 255, 237, 253},
- {215, 147, 172, 240, 175, 255, 238, 253},
- {215, 147, 172, 240, 175, 255, 238, 253},
- {216, 148, 173, 240, 176, 255, 238, 253},
- {217, 148, 173, 240, 176, 255, 238, 253},
- {218, 149, 173, 241, 177, 255, 239, 253},
- {218, 149, 173, 241, 178, 255, 239, 253},
- {219, 150, 174, 241, 179, 255, 239, 253},
- {219, 151, 174, 241, 179, 255, 239, 253},
- {220, 152, 175, 242, 180, 255, 240, 253},
- {221, 152, 175, 242, 180, 255, 240, 253},
- {222, 153, 176, 242, 181, 255, 240, 253},
- {222, 153, 176, 242, 181, 255, 240, 253},
- {223, 154, 177, 243, 182, 255, 240, 253},
- {223, 154, 177, 243, 182, 255, 240, 253},
- {224, 155, 178, 244, 183, 255, 241, 253},
- {224, 155, 178, 244, 183, 255, 241, 253},
- {225, 156, 178, 244, 184, 255, 241, 253},
- {225, 157, 178, 244, 184, 255, 241, 253},
- {226, 158, 179, 244, 185, 255, 242, 253},
- {227, 158, 179, 244, 185, 255, 242, 253},
- {228, 159, 180, 245, 186, 255, 242, 253},
- {228, 159, 180, 245, 186, 255, 242, 253},
- {229, 160, 181, 245, 187, 255, 242, 253},
- {229, 160, 181, 245, 187, 255, 242, 253},
- {230, 161, 182, 246, 188, 255, 243, 253},
- {230, 162, 182, 246, 188, 255, 243, 253},
- {231, 163, 183, 246, 189, 255, 243, 253},
- {231, 163, 183, 246, 189, 255, 243, 253},
- {232, 164, 184, 247, 190, 255, 243, 253},
- {232, 164, 184, 247, 190, 255, 243, 253},
- {233, 165, 185, 247, 191, 255, 244, 253},
- {233, 165, 185, 247, 191, 255, 244, 253},
- {234, 166, 185, 247, 192, 255, 244, 253},
- {234, 167, 185, 247, 192, 255, 244, 253},
- {235, 168, 186, 248, 193, 255, 244, 253},
- {235, 168, 186, 248, 193, 255, 244, 253},
- {236, 169, 187, 248, 194, 255, 244, 253},
- {236, 169, 187, 248, 194, 255, 244, 253},
- {236, 170, 188, 248, 195, 255, 245, 253},
- {236, 170, 188, 248, 195, 255, 245, 253},
- {237, 171, 189, 249, 196, 255, 245, 254},
- {237, 172, 189, 249, 196, 255, 245, 254},
- {238, 173, 190, 249, 197, 255, 245, 254},
- {238, 173, 190, 249, 197, 255, 245, 254},
- {239, 174, 191, 249, 198, 255, 245, 254},
- {239, 174, 191, 249, 198, 255, 245, 254},
- {240, 175, 192, 249, 199, 255, 246, 254},
- {240, 176, 192, 249, 199, 255, 246, 254},
- {240, 177, 193, 250, 200, 255, 246, 254},
- {240, 177, 193, 250, 200, 255, 246, 254},
- {241, 178, 194, 250, 201, 255, 246, 254},
- {241, 178, 194, 250, 201, 255, 246, 254},
- {242, 179, 195, 250, 202, 255, 246, 254},
- {242, 180, 195, 250, 202, 255, 246, 254},
- {242, 181, 196, 250, 203, 255, 247, 254},
- {242, 181, 196, 250, 203, 255, 247, 254},
- {243, 182, 197, 251, 204, 255, 247, 254},
- {243, 183, 197, 251, 204, 255, 247, 254},
- {244, 184, 198, 251, 205, 255, 247, 254},
- {244, 184, 198, 251, 205, 255, 247, 254},
- {244, 185, 199, 251, 206, 255, 247, 254},
- {244, 185, 199, 251, 206, 255, 247, 254},
- {245, 186, 200, 251, 207, 255, 247, 254},
- {245, 187, 200, 251, 207, 255, 247, 254},
- {246, 188, 201, 252, 207, 255, 248, 254},
- {246, 188, 201, 252, 207, 255, 248, 254},
- {246, 189, 202, 252, 208, 255, 248, 254},
- {246, 190, 202, 252, 208, 255, 248, 254},
- {247, 191, 203, 252, 209, 255, 248, 254},
- {247, 191, 203, 252, 209, 255, 248, 254},
- {247, 192, 204, 252, 210, 255, 248, 254},
- {247, 193, 204, 252, 210, 255, 248, 254},
- {248, 194, 205, 252, 211, 255, 248, 254},
- {248, 194, 205, 252, 211, 255, 248, 254},
- {248, 195, 206, 252, 212, 255, 249, 254},
- {248, 196, 206, 252, 212, 255, 249, 254},
- {249, 197, 207, 253, 213, 255, 249, 254},
- {249, 197, 207, 253, 213, 255, 249, 254},
- {249, 198, 208, 253, 214, 255, 249, 254},
- {249, 199, 209, 253, 214, 255, 249, 254},
- {250, 200, 210, 253, 215, 255, 249, 254},
- {250, 200, 210, 253, 215, 255, 249, 254},
- {250, 201, 211, 253, 215, 255, 249, 254},
- {250, 202, 211, 253, 215, 255, 249, 254},
- {250, 203, 212, 253, 216, 255, 249, 254},
- {250, 203, 212, 253, 216, 255, 249, 254},
- {251, 204, 213, 253, 217, 255, 250, 254},
- {251, 205, 213, 253, 217, 255, 250, 254},
- {251, 206, 214, 254, 218, 255, 250, 254},
- {251, 206, 215, 254, 218, 255, 250, 254},
- {252, 207, 216, 254, 219, 255, 250, 254},
- {252, 208, 216, 254, 219, 255, 250, 254},
- {252, 209, 217, 254, 220, 255, 250, 254},
- {252, 210, 217, 254, 220, 255, 250, 254},
- {252, 211, 218, 254, 221, 255, 250, 254},
- {252, 212, 218, 254, 221, 255, 250, 254},
- {253, 213, 219, 254, 222, 255, 250, 254},
- {253, 213, 220, 254, 222, 255, 250, 254},
- {253, 214, 221, 254, 223, 255, 250, 254},
- {253, 215, 221, 254, 223, 255, 250, 254},
- {253, 216, 222, 254, 224, 255, 251, 254},
- {253, 217, 223, 254, 224, 255, 251, 254},
- {253, 218, 224, 254, 225, 255, 251, 254},
- {253, 219, 224, 254, 225, 255, 251, 254},
- {254, 220, 225, 254, 225, 255, 251, 254},
- {254, 221, 226, 254, 225, 255, 251, 254},
- {254, 222, 227, 255, 226, 255, 251, 254},
- {254, 223, 227, 255, 226, 255, 251, 254},
- {254, 224, 228, 255, 227, 255, 251, 254},
- {254, 225, 229, 255, 227, 255, 251, 254},
- {254, 226, 230, 255, 228, 255, 251, 254},
- {254, 227, 230, 255, 229, 255, 251, 254},
- {255, 228, 231, 255, 230, 255, 251, 254},
- {255, 229, 232, 255, 230, 255, 251, 254},
- {255, 230, 233, 255, 231, 255, 252, 254},
- {255, 231, 234, 255, 231, 255, 252, 254},
- {255, 232, 235, 255, 232, 255, 252, 254},
- {255, 233, 236, 255, 232, 255, 252, 254},
- {255, 235, 237, 255, 233, 255, 252, 254},
- {255, 236, 238, 255, 234, 255, 252, 254},
- {255, 238, 240, 255, 235, 255, 252, 255},
- {255, 239, 241, 255, 235, 255, 252, 254},
- {255, 241, 243, 255, 236, 255, 252, 254},
- {255, 243, 245, 255, 237, 255, 252, 254},
- {255, 246, 247, 255, 239, 255, 253, 255},
- {255, 246, 247, 255, 239, 255, 253, 255},
-};
-
-static const vp9_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 vp9_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 vp9_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 vp9_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 }
- }
- }
- }
-};
-
-static void extend_to_full_distribution(vp9_prob *probs, vp9_prob p) {
- vpx_memcpy(probs, vp9_pareto8_full[p = 0 ? 0 : p - 1],
- MODEL_NODES * sizeof(vp9_prob));
-}
-
-void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full) {
- if (full != model)
- vpx_memcpy(full, model, sizeof(vp9_prob) * UNCONSTRAINED_NODES);
- extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
-}
-
-void vp9_default_coef_probs(VP9_COMMON *cm) {
- vp9_copy(cm->fc.coef_probs[TX_4X4], default_coef_probs_4x4);
- vp9_copy(cm->fc.coef_probs[TX_8X8], default_coef_probs_8x8);
- vp9_copy(cm->fc.coef_probs[TX_16X16], default_coef_probs_16x16);
- vp9_copy(cm->fc.coef_probs[TX_32X32], default_coef_probs_32x32);
-}
-
-#define COEF_COUNT_SAT 24
-#define COEF_MAX_UPDATE_FACTOR 112
-#define COEF_COUNT_SAT_KEY 24
-#define COEF_MAX_UPDATE_FACTOR_KEY 112
-#define COEF_COUNT_SAT_AFTER_KEY 24
-#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
-
-static void adapt_coef_probs(VP9_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];
- vp9_coeff_probs_model *const probs = cm->fc.coef_probs[tx_size];
- const vp9_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size];
- vp9_coeff_count_model *counts = cm->counts.coef[tx_size];
- unsigned int (*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
- cm->counts.eob_branch[tx_size];
- int i, j, k, l, m;
-
- 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) {
- const int n0 = counts[i][j][k][l][ZERO_TOKEN];
- const int n1 = counts[i][j][k][l][ONE_TOKEN];
- const int n2 = counts[i][j][k][l][TWO_TOKEN];
- const int neob = counts[i][j][k][l][EOB_MODEL_TOKEN];
- const unsigned int branch_ct[UNCONSTRAINED_NODES][2] = {
- { neob, eob_counts[i][j][k][l] - neob },
- { n0, n1 + n2 },
- { n1, n2 }
- };
- for (m = 0; m < UNCONSTRAINED_NODES; ++m)
- probs[i][j][k][l][m] = merge_probs(pre_probs[i][j][k][l][m],
- branch_ct[m],
- count_sat, update_factor);
- }
-}
-
-void vp9_adapt_coef_probs(VP9_COMMON *cm) {
- TX_SIZE t;
- unsigned int count_sat, update_factor;
-
- if (frame_is_intra_only(cm)) {
- update_factor = COEF_MAX_UPDATE_FACTOR_KEY;
- count_sat = COEF_COUNT_SAT_KEY;
- } else if (cm->last_frame_type == KEY_FRAME) {
- update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */
- count_sat = COEF_COUNT_SAT_AFTER_KEY;
- } else {
- update_factor = COEF_MAX_UPDATE_FACTOR;
- count_sat = COEF_COUNT_SAT;
- }
- for (t = TX_4X4; t <= TX_32X32; t++)
- adapt_coef_probs(cm, t, count_sat, update_factor);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.h
deleted file mode 100644
index 6014492..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropy.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_ENTROPY_H_
-#define VP9_COMMON_VP9_ENTROPY_H_
-
-#include "vpx/vpx_integer.h"
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_scan.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define DIFF_UPDATE_PROB 252
-
-// Coefficient token alphabet
-#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
-#define ONE_TOKEN 1 // 1 Extra Bits 0+1
-#define TWO_TOKEN 2 // 2 Extra Bits 0+1
-#define THREE_TOKEN 3 // 3 Extra Bits 0+1
-#define FOUR_TOKEN 4 // 4 Extra Bits 0+1
-#define CATEGORY1_TOKEN 5 // 5-6 Extra Bits 1+1
-#define CATEGORY2_TOKEN 6 // 7-10 Extra Bits 2+1
-#define CATEGORY3_TOKEN 7 // 11-18 Extra Bits 3+1
-#define CATEGORY4_TOKEN 8 // 19-34 Extra Bits 4+1
-#define CATEGORY5_TOKEN 9 // 35-66 Extra Bits 5+1
-#define CATEGORY6_TOKEN 10 // 67+ Extra Bits 14+1
-#define EOB_TOKEN 11 // EOB Extra Bits 0+0
-
-#define ENTROPY_TOKENS 12
-
-#define ENTROPY_NODES 11
-
-DECLARE_ALIGNED(16, extern const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]);
-
-#define EOB_MODEL_TOKEN 3
-extern const vp9_tree_index vp9_coefmodel_tree[];
-
-typedef struct {
- const vp9_tree_index *tree;
- const vp9_prob *prob;
- int len;
- int base_val;
-} vp9_extra_bit;
-
-// indexed by token value
-extern const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS];
-
-#define DCT_MAX_VALUE 16384
-
-/* Coefficients are predicted via a 3-dimensional probability table. */
-
-#define REF_TYPES 2 // intra=0, inter=1
-
-/* Middle dimension reflects the coefficient position within the transform. */
-#define COEF_BANDS 6
-
-/* Inside dimension is measure of nearby complexity, that reflects the energy
- of nearby coefficients are nonzero. For the first coefficient (DC, unless
- block type is 0), we look at the (already encoded) blocks above and to the
- left of the current block. The context index is then the number (0,1,or 2)
- of these blocks having nonzero coefficients.
- After decoding a coefficient, the measure is determined by the size of the
- most recently decoded coefficient.
- Note that the intuitive meaning of this measure changes as coefficients
- are decoded, e.g., prior to the first token, a zero means that my neighbors
- are empty while, after the first token, because of the use of end-of-block,
- a zero means we just decoded a zero and hence guarantees that a non-zero
- coefficient will appear later in this block. However, this shift
- in meaning is perfectly OK because our context depends also on the
- coefficient band (and since zigzag positions 0, 1, and 2 are in
- distinct bands). */
-
-#define COEFF_CONTEXTS 6
-#define BAND_COEFF_CONTEXTS(band) ((band) == 0 ? 3 : COEFF_CONTEXTS)
-
-// #define ENTROPY_STATS
-
-typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
- [ENTROPY_TOKENS];
-typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
- [ENTROPY_NODES][2];
-
-#define SUBEXP_PARAM 4 /* Subexponential code parameter */
-#define MODULUS_PARAM 13 /* Modulus parameter */
-
-struct VP9Common;
-void vp9_default_coef_probs(struct VP9Common *cm);
-void vp9_adapt_coef_probs(struct VP9Common *cm);
-
-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);
- vpx_memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) *
- num_4x4_blocks_wide_lookup[plane_bsize]);
- vpx_memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) *
- num_4x4_blocks_high_lookup[plane_bsize]);
- }
-}
-
-// This is the index in the scan order beyond which all coefficients for
-// 8x8 transform and above are in the top band.
-// This macro is currently unused but may be used by certain implementations
-#define MAXBAND_INDEX 21
-
-DECLARE_ALIGNED(16, extern const uint8_t, vp9_coefband_trans_8x8plus[1024]);
-DECLARE_ALIGNED(16, extern const uint8_t, vp9_coefband_trans_4x4[16]);
-
-static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
- return tx_size == TX_4X4 ? vp9_coefband_trans_4x4
- : vp9_coefband_trans_8x8plus;
-}
-
-// 128 lists of probabilities are stored for the following ONE node probs:
-// 1, 3, 5, 7, ..., 253, 255
-// In between probabilities are interpolated linearly
-
-#define COEFF_PROB_MODELS 256
-
-#define UNCONSTRAINED_NODES 3
-
-#define PIVOT_NODE 2 // which node is pivot
-
-#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
-extern const vp9_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
-
-typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS]
- [COEFF_CONTEXTS][UNCONSTRAINED_NODES];
-
-typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS]
- [COEFF_CONTEXTS]
- [UNCONSTRAINED_NODES + 1];
-
-void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full);
-
-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;
-
- switch (tx_size) {
- case TX_4X4:
- above_ec = a[0] != 0;
- left_ec = l[0] != 0;
- break;
- case TX_8X8:
- above_ec = !!*(const uint16_t *)a;
- left_ec = !!*(const uint16_t *)l;
- break;
- case TX_16X16:
- above_ec = !!*(const uint32_t *)a;
- left_ec = !!*(const uint32_t *)l;
- break;
- case TX_32X32:
- above_ec = !!*(const uint64_t *)a;
- left_ec = !!*(const uint64_t *)l;
- break;
- default:
- assert(0 && "Invalid transform size.");
- }
-
- return combine_entropy_contexts(above_ec, left_ec);
-}
-
-INLINE static const scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
- PLANE_TYPE type, int block_idx) {
- const MODE_INFO *const mi = xd->mi[0];
-
- if (is_inter_block(&mi->mbmi) || type != PLANE_TYPE_Y || xd->lossless) {
- return &vp9_default_scan_orders[tx_size];
- } else {
- const MB_PREDICTION_MODE mode = get_y_mode(mi, block_idx);
- return &vp9_scan_orders[tx_size][intra_mode_to_tx_type_lookup[mode]];
- }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_ENTROPY_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.c
deleted file mode 100644
index 5b00b00..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_seg_common.h"
-
-const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
- { // above = dc
- { 137, 30, 42, 148, 151, 207, 70, 52, 91 }, // left = dc
- { 92, 45, 102, 136, 116, 180, 74, 90, 100 }, // left = v
- { 73, 32, 19, 187, 222, 215, 46, 34, 100 }, // left = h
- { 91, 30, 32, 116, 121, 186, 93, 86, 94 }, // left = d45
- { 72, 35, 36, 149, 68, 206, 68, 63, 105 }, // left = d135
- { 73, 31, 28, 138, 57, 124, 55, 122, 151 }, // left = d117
- { 67, 23, 21, 140, 126, 197, 40, 37, 171 }, // left = d153
- { 86, 27, 28, 128, 154, 212, 45, 43, 53 }, // left = d207
- { 74, 32, 27, 107, 86, 160, 63, 134, 102 }, // left = d63
- { 59, 67, 44, 140, 161, 202, 78, 67, 119 } // left = tm
- }, { // above = v
- { 63, 36, 126, 146, 123, 158, 60, 90, 96 }, // left = dc
- { 43, 46, 168, 134, 107, 128, 69, 142, 92 }, // left = v
- { 44, 29, 68, 159, 201, 177, 50, 57, 77 }, // left = h
- { 58, 38, 76, 114, 97, 172, 78, 133, 92 }, // left = d45
- { 46, 41, 76, 140, 63, 184, 69, 112, 57 }, // left = d135
- { 38, 32, 85, 140, 46, 112, 54, 151, 133 }, // left = d117
- { 39, 27, 61, 131, 110, 175, 44, 75, 136 }, // left = d153
- { 52, 30, 74, 113, 130, 175, 51, 64, 58 }, // left = d207
- { 47, 35, 80, 100, 74, 143, 64, 163, 74 }, // left = d63
- { 36, 61, 116, 114, 128, 162, 80, 125, 82 } // left = tm
- }, { // above = h
- { 82, 26, 26, 171, 208, 204, 44, 32, 105 }, // left = dc
- { 55, 44, 68, 166, 179, 192, 57, 57, 108 }, // left = v
- { 42, 26, 11, 199, 241, 228, 23, 15, 85 }, // left = h
- { 68, 42, 19, 131, 160, 199, 55, 52, 83 }, // left = d45
- { 58, 50, 25, 139, 115, 232, 39, 52, 118 }, // left = d135
- { 50, 35, 33, 153, 104, 162, 64, 59, 131 }, // left = d117
- { 44, 24, 16, 150, 177, 202, 33, 19, 156 }, // left = d153
- { 55, 27, 12, 153, 203, 218, 26, 27, 49 }, // left = d207
- { 53, 49, 21, 110, 116, 168, 59, 80, 76 }, // left = d63
- { 38, 72, 19, 168, 203, 212, 50, 50, 107 } // left = tm
- }, { // above = d45
- { 103, 26, 36, 129, 132, 201, 83, 80, 93 }, // left = dc
- { 59, 38, 83, 112, 103, 162, 98, 136, 90 }, // left = v
- { 62, 30, 23, 158, 200, 207, 59, 57, 50 }, // left = h
- { 67, 30, 29, 84, 86, 191, 102, 91, 59 }, // left = d45
- { 60, 32, 33, 112, 71, 220, 64, 89, 104 }, // left = d135
- { 53, 26, 34, 130, 56, 149, 84, 120, 103 }, // left = d117
- { 53, 21, 23, 133, 109, 210, 56, 77, 172 }, // left = d153
- { 77, 19, 29, 112, 142, 228, 55, 66, 36 }, // left = d207
- { 61, 29, 29, 93, 97, 165, 83, 175, 162 }, // left = d63
- { 47, 47, 43, 114, 137, 181, 100, 99, 95 } // left = tm
- }, { // above = d135
- { 69, 23, 29, 128, 83, 199, 46, 44, 101 }, // left = dc
- { 53, 40, 55, 139, 69, 183, 61, 80, 110 }, // left = v
- { 40, 29, 19, 161, 180, 207, 43, 24, 91 }, // left = h
- { 60, 34, 19, 105, 61, 198, 53, 64, 89 }, // left = d45
- { 52, 31, 22, 158, 40, 209, 58, 62, 89 }, // left = d135
- { 44, 31, 29, 147, 46, 158, 56, 102, 198 }, // left = d117
- { 35, 19, 12, 135, 87, 209, 41, 45, 167 }, // left = d153
- { 55, 25, 21, 118, 95, 215, 38, 39, 66 }, // left = d207
- { 51, 38, 25, 113, 58, 164, 70, 93, 97 }, // left = d63
- { 47, 54, 34, 146, 108, 203, 72, 103, 151 } // left = tm
- }, { // above = d117
- { 64, 19, 37, 156, 66, 138, 49, 95, 133 }, // left = dc
- { 46, 27, 80, 150, 55, 124, 55, 121, 135 }, // left = v
- { 36, 23, 27, 165, 149, 166, 54, 64, 118 }, // left = h
- { 53, 21, 36, 131, 63, 163, 60, 109, 81 }, // left = d45
- { 40, 26, 35, 154, 40, 185, 51, 97, 123 }, // left = d135
- { 35, 19, 34, 179, 19, 97, 48, 129, 124 }, // left = d117
- { 36, 20, 26, 136, 62, 164, 33, 77, 154 }, // left = d153
- { 45, 18, 32, 130, 90, 157, 40, 79, 91 }, // left = d207
- { 45, 26, 28, 129, 45, 129, 49, 147, 123 }, // left = d63
- { 38, 44, 51, 136, 74, 162, 57, 97, 121 } // left = tm
- }, { // above = d153
- { 75, 17, 22, 136, 138, 185, 32, 34, 166 }, // left = dc
- { 56, 39, 58, 133, 117, 173, 48, 53, 187 }, // left = v
- { 35, 21, 12, 161, 212, 207, 20, 23, 145 }, // left = h
- { 56, 29, 19, 117, 109, 181, 55, 68, 112 }, // left = d45
- { 47, 29, 17, 153, 64, 220, 59, 51, 114 }, // left = d135
- { 46, 16, 24, 136, 76, 147, 41, 64, 172 }, // left = d117
- { 34, 17, 11, 108, 152, 187, 13, 15, 209 }, // left = d153
- { 51, 24, 14, 115, 133, 209, 32, 26, 104 }, // left = d207
- { 55, 30, 18, 122, 79, 179, 44, 88, 116 }, // left = d63
- { 37, 49, 25, 129, 168, 164, 41, 54, 148 } // left = tm
- }, { // above = d207
- { 82, 22, 32, 127, 143, 213, 39, 41, 70 }, // left = dc
- { 62, 44, 61, 123, 105, 189, 48, 57, 64 }, // left = v
- { 47, 25, 17, 175, 222, 220, 24, 30, 86 }, // left = h
- { 68, 36, 17, 106, 102, 206, 59, 74, 74 }, // left = d45
- { 57, 39, 23, 151, 68, 216, 55, 63, 58 }, // left = d135
- { 49, 30, 35, 141, 70, 168, 82, 40, 115 }, // left = d117
- { 51, 25, 15, 136, 129, 202, 38, 35, 139 }, // left = d153
- { 68, 26, 16, 111, 141, 215, 29, 28, 28 }, // left = d207
- { 59, 39, 19, 114, 75, 180, 77, 104, 42 }, // left = d63
- { 40, 61, 26, 126, 152, 206, 61, 59, 93 } // left = tm
- }, { // above = d63
- { 78, 23, 39, 111, 117, 170, 74, 124, 94 }, // left = dc
- { 48, 34, 86, 101, 92, 146, 78, 179, 134 }, // left = v
- { 47, 22, 24, 138, 187, 178, 68, 69, 59 }, // left = h
- { 56, 25, 33, 105, 112, 187, 95, 177, 129 }, // left = d45
- { 48, 31, 27, 114, 63, 183, 82, 116, 56 }, // left = d135
- { 43, 28, 37, 121, 63, 123, 61, 192, 169 }, // left = d117
- { 42, 17, 24, 109, 97, 177, 56, 76, 122 }, // left = d153
- { 58, 18, 28, 105, 139, 182, 70, 92, 63 }, // left = d207
- { 46, 23, 32, 74, 86, 150, 67, 183, 88 }, // left = d63
- { 36, 38, 48, 92, 122, 165, 88, 137, 91 } // left = tm
- }, { // above = tm
- { 65, 70, 60, 155, 159, 199, 61, 60, 81 }, // left = dc
- { 44, 78, 115, 132, 119, 173, 71, 112, 93 }, // left = v
- { 39, 38, 21, 184, 227, 206, 42, 32, 64 }, // left = h
- { 58, 47, 36, 124, 137, 193, 80, 82, 78 }, // left = d45
- { 49, 50, 35, 144, 95, 205, 63, 78, 59 }, // left = d135
- { 41, 53, 52, 148, 71, 142, 65, 128, 51 }, // left = d117
- { 40, 36, 28, 143, 143, 202, 40, 55, 137 }, // left = d153
- { 52, 34, 29, 129, 183, 227, 42, 35, 43 }, // left = d207
- { 42, 44, 44, 104, 105, 164, 64, 130, 80 }, // left = d63
- { 43, 81, 53, 140, 169, 204, 68, 84, 72 } // left = tm
- }
-};
-
-const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = {
- { 144, 11, 54, 157, 195, 130, 46, 58, 108 }, // y = dc
- { 118, 15, 123, 148, 131, 101, 44, 93, 131 }, // y = v
- { 113, 12, 23, 188, 226, 142, 26, 32, 125 }, // y = h
- { 120, 11, 50, 123, 163, 135, 64, 77, 103 }, // y = d45
- { 113, 9, 36, 155, 111, 157, 32, 44, 161 }, // y = d135
- { 116, 9, 55, 176, 76, 96, 37, 61, 149 }, // y = d117
- { 115, 9, 28, 141, 161, 167, 21, 25, 193 }, // y = d153
- { 120, 12, 32, 145, 195, 142, 32, 38, 86 }, // y = d207
- { 116, 12, 64, 120, 140, 125, 49, 115, 121 }, // y = d63
- { 102, 19, 66, 162, 182, 122, 35, 59, 128 } // y = tm
-};
-
-static const vp9_prob default_if_y_probs[BLOCK_SIZE_GROUPS][INTRA_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
-};
-
-static const vp9_prob default_if_uv_probs[INTRA_MODES][INTRA_MODES - 1] = {
- { 120, 7, 76, 176, 208, 126, 28, 54, 103 }, // y = dc
- { 48, 12, 154, 155, 139, 90, 34, 117, 119 }, // y = v
- { 67, 6, 25, 204, 243, 158, 13, 21, 96 }, // y = h
- { 97, 5, 44, 131, 176, 139, 48, 68, 97 }, // y = d45
- { 83, 5, 42, 156, 111, 152, 26, 49, 152 }, // y = d135
- { 80, 5, 58, 178, 74, 83, 33, 62, 145 }, // y = d117
- { 86, 5, 32, 154, 192, 168, 14, 22, 163 }, // y = d153
- { 85, 5, 32, 156, 216, 148, 19, 29, 73 }, // y = d207
- { 77, 7, 64, 116, 132, 122, 37, 126, 120 }, // y = d63
- { 101, 21, 107, 181, 192, 103, 19, 67, 125 } // y = tm
-};
-
-const vp9_prob vp9_kf_partition_probs[PARTITION_CONTEXTS]
- [PARTITION_TYPES - 1] = {
- // 8x8 -> 4x4
- { 158, 97, 94 }, // a/l both not split
- { 93, 24, 99 }, // a split, l not split
- { 85, 119, 44 }, // l split, a not split
- { 62, 59, 67 }, // a/l both split
- // 16x16 -> 8x8
- { 149, 53, 53 }, // a/l both not split
- { 94, 20, 48 }, // a split, l not split
- { 83, 53, 24 }, // l split, a not split
- { 52, 18, 18 }, // a/l both split
- // 32x32 -> 16x16
- { 150, 40, 39 }, // a/l both not split
- { 78, 12, 26 }, // a split, l not split
- { 67, 33, 11 }, // l split, a not split
- { 24, 7, 5 }, // a/l both split
- // 64x64 -> 32x32
- { 174, 35, 49 }, // a/l both not split
- { 68, 11, 27 }, // a split, l not split
- { 57, 15, 9 }, // l split, a not split
- { 12, 3, 3 }, // a/l both split
-};
-
-static const vp9_prob default_partition_probs[PARTITION_CONTEXTS]
- [PARTITION_TYPES - 1] = {
- // 8x8 -> 4x4
- { 199, 122, 141 }, // a/l both not split
- { 147, 63, 159 }, // a split, l not split
- { 148, 133, 118 }, // l split, a not split
- { 121, 104, 114 }, // a/l both split
- // 16x16 -> 8x8
- { 174, 73, 87 }, // a/l both not split
- { 92, 41, 83 }, // a split, l not split
- { 82, 99, 50 }, // l split, a not split
- { 53, 39, 39 }, // a/l both split
- // 32x32 -> 16x16
- { 177, 58, 59 }, // a/l both not split
- { 68, 26, 63 }, // a split, l not split
- { 52, 79, 25 }, // l split, a not split
- { 17, 14, 12 }, // a/l both split
- // 64x64 -> 32x32
- { 222, 34, 30 }, // a/l both not split
- { 72, 16, 44 }, // a split, l not split
- { 58, 32, 12 }, // l split, a not split
- { 10, 7, 6 }, // a/l both split
-};
-
-static const vp9_prob default_inter_mode_probs[INTER_MODE_CONTEXTS]
- [INTER_MODES - 1] = {
- {2, 173, 34}, // 0 = both zero mv
- {7, 145, 85}, // 1 = one zero mv + one a predicted mv
- {7, 166, 63}, // 2 = two predicted mvs
- {7, 94, 66}, // 3 = one predicted/zero and one new mv
- {8, 64, 46}, // 4 = two new mvs
- {17, 81, 31}, // 5 = one intra neighbour + x
- {25, 29, 30}, // 6 = two intra neighbours
-};
-
-/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
-const vp9_tree_index vp9_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, -D207_PRED /* 8 = D153_NODE */
-};
-
-const vp9_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)] = {
- -INTER_OFFSET(ZEROMV), 2,
- -INTER_OFFSET(NEARESTMV), 4,
- -INTER_OFFSET(NEARMV), -INTER_OFFSET(NEWMV)
-};
-
-const vp9_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)] = {
- -PARTITION_NONE, 2,
- -PARTITION_HORZ, 4,
- -PARTITION_VERT, -PARTITION_SPLIT
-};
-
-static const vp9_prob default_intra_inter_p[INTRA_INTER_CONTEXTS] = {
- 9, 102, 187, 225
-};
-
-static const vp9_prob default_comp_inter_p[COMP_INTER_CONTEXTS] = {
- 239, 183, 119, 96, 41
-};
-
-static const vp9_prob default_comp_ref_p[REF_CONTEXTS] = {
- 50, 126, 123, 221, 226
-};
-
-static const vp9_prob default_single_ref_p[REF_CONTEXTS][2] = {
- { 33, 16 },
- { 77, 74 },
- { 142, 142 },
- { 172, 170 },
- { 238, 247 }
-};
-
-static const struct tx_probs default_tx_probs = {
- { { 3, 136, 37 },
- { 5, 52, 13 } },
-
- { { 20, 152 },
- { 15, 101 } },
-
- { { 100 },
- { 66 } }
-};
-
-void tx_counts_to_branch_counts_32x32(const unsigned int *tx_count_32x32p,
- unsigned int (*ct_32x32p)[2]) {
- ct_32x32p[0][0] = tx_count_32x32p[TX_4X4];
- ct_32x32p[0][1] = tx_count_32x32p[TX_8X8] +
- tx_count_32x32p[TX_16X16] +
- tx_count_32x32p[TX_32X32];
- ct_32x32p[1][0] = tx_count_32x32p[TX_8X8];
- ct_32x32p[1][1] = tx_count_32x32p[TX_16X16] +
- tx_count_32x32p[TX_32X32];
- ct_32x32p[2][0] = tx_count_32x32p[TX_16X16];
- ct_32x32p[2][1] = tx_count_32x32p[TX_32X32];
-}
-
-void tx_counts_to_branch_counts_16x16(const unsigned int *tx_count_16x16p,
- unsigned int (*ct_16x16p)[2]) {
- ct_16x16p[0][0] = tx_count_16x16p[TX_4X4];
- ct_16x16p[0][1] = tx_count_16x16p[TX_8X8] + tx_count_16x16p[TX_16X16];
- ct_16x16p[1][0] = tx_count_16x16p[TX_8X8];
- ct_16x16p[1][1] = tx_count_16x16p[TX_16X16];
-}
-
-void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
- unsigned int (*ct_8x8p)[2]) {
- ct_8x8p[0][0] = tx_count_8x8p[TX_4X4];
- ct_8x8p[0][1] = tx_count_8x8p[TX_8X8];
-}
-
-static const vp9_prob default_skip_probs[SKIP_CONTEXTS] = {
- 192, 128, 64
-};
-
-static const vp9_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
- [SWITCHABLE_FILTERS - 1] = {
- { 235, 162, },
- { 36, 255, },
- { 34, 3, },
- { 149, 144, },
-};
-
-void vp9_init_mode_probs(FRAME_CONTEXT *fc) {
- vp9_copy(fc->uv_mode_prob, default_if_uv_probs);
- vp9_copy(fc->y_mode_prob, default_if_y_probs);
- vp9_copy(fc->switchable_interp_prob, default_switchable_interp_prob);
- vp9_copy(fc->partition_prob, default_partition_probs);
- vp9_copy(fc->intra_inter_prob, default_intra_inter_p);
- vp9_copy(fc->comp_inter_prob, default_comp_inter_p);
- vp9_copy(fc->comp_ref_prob, default_comp_ref_p);
- vp9_copy(fc->single_ref_prob, default_single_ref_p);
- fc->tx_probs = default_tx_probs;
- vp9_copy(fc->skip_probs, default_skip_probs);
- vp9_copy(fc->inter_mode_probs, default_inter_mode_probs);
-}
-
-const vp9_tree_index vp9_switchable_interp_tree
- [TREE_SIZE(SWITCHABLE_FILTERS)] = {
- -EIGHTTAP, 2,
- -EIGHTTAP_SMOOTH, -EIGHTTAP_SHARP
-};
-
-#define COUNT_SAT 20
-#define MAX_UPDATE_FACTOR 128
-
-static int adapt_prob(vp9_prob pre_prob, const unsigned int ct[2]) {
- return merge_probs(pre_prob, ct, COUNT_SAT, MAX_UPDATE_FACTOR);
-}
-
-static void adapt_probs(const vp9_tree_index *tree,
- const vp9_prob *pre_probs, const unsigned int *counts,
- vp9_prob *probs) {
- vp9_tree_merge_probs(tree, pre_probs, counts, COUNT_SAT, MAX_UPDATE_FACTOR,
- probs);
-}
-
-void vp9_adapt_mode_probs(VP9_COMMON *cm) {
- int i, j;
- FRAME_CONTEXT *fc = &cm->fc;
- const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
- const FRAME_COUNTS *counts = &cm->counts;
-
- for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
- fc->intra_inter_prob[i] = adapt_prob(pre_fc->intra_inter_prob[i],
- counts->intra_inter[i]);
- for (i = 0; i < COMP_INTER_CONTEXTS; i++)
- fc->comp_inter_prob[i] = adapt_prob(pre_fc->comp_inter_prob[i],
- counts->comp_inter[i]);
- for (i = 0; i < REF_CONTEXTS; i++)
- fc->comp_ref_prob[i] = adapt_prob(pre_fc->comp_ref_prob[i],
- counts->comp_ref[i]);
- for (i = 0; i < REF_CONTEXTS; i++)
- for (j = 0; j < 2; j++)
- fc->single_ref_prob[i][j] = adapt_prob(pre_fc->single_ref_prob[i][j],
- counts->single_ref[i][j]);
-
- for (i = 0; i < INTER_MODE_CONTEXTS; i++)
- adapt_probs(vp9_inter_mode_tree, pre_fc->inter_mode_probs[i],
- counts->inter_mode[i], fc->inter_mode_probs[i]);
-
- for (i = 0; i < BLOCK_SIZE_GROUPS; i++)
- adapt_probs(vp9_intra_mode_tree, pre_fc->y_mode_prob[i],
- counts->y_mode[i], fc->y_mode_prob[i]);
-
- for (i = 0; i < INTRA_MODES; ++i)
- adapt_probs(vp9_intra_mode_tree, pre_fc->uv_mode_prob[i],
- counts->uv_mode[i], fc->uv_mode_prob[i]);
-
- for (i = 0; i < PARTITION_CONTEXTS; i++)
- adapt_probs(vp9_partition_tree, pre_fc->partition_prob[i],
- counts->partition[i], fc->partition_prob[i]);
-
- if (cm->interp_filter == SWITCHABLE) {
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
- adapt_probs(vp9_switchable_interp_tree, pre_fc->switchable_interp_prob[i],
- counts->switchable_interp[i], fc->switchable_interp_prob[i]);
- }
-
- if (cm->tx_mode == TX_MODE_SELECT) {
- int j;
- unsigned int branch_ct_8x8p[TX_SIZES - 3][2];
- unsigned int branch_ct_16x16p[TX_SIZES - 2][2];
- unsigned int branch_ct_32x32p[TX_SIZES - 1][2];
-
- for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
- tx_counts_to_branch_counts_8x8(counts->tx.p8x8[i], branch_ct_8x8p);
- for (j = 0; j < TX_SIZES - 3; ++j)
- fc->tx_probs.p8x8[i][j] = adapt_prob(pre_fc->tx_probs.p8x8[i][j],
- branch_ct_8x8p[j]);
-
- tx_counts_to_branch_counts_16x16(counts->tx.p16x16[i], branch_ct_16x16p);
- for (j = 0; j < TX_SIZES - 2; ++j)
- fc->tx_probs.p16x16[i][j] = adapt_prob(pre_fc->tx_probs.p16x16[i][j],
- branch_ct_16x16p[j]);
-
- tx_counts_to_branch_counts_32x32(counts->tx.p32x32[i], branch_ct_32x32p);
- for (j = 0; j < TX_SIZES - 1; ++j)
- fc->tx_probs.p32x32[i][j] = adapt_prob(pre_fc->tx_probs.p32x32[i][j],
- branch_ct_32x32p[j]);
- }
- }
-
- for (i = 0; i < SKIP_CONTEXTS; ++i)
- fc->skip_probs[i] = adapt_prob(pre_fc->skip_probs[i], counts->skip[i]);
-}
-
-static void set_default_lf_deltas(struct loopfilter *lf) {
- lf->mode_ref_delta_enabled = 1;
- lf->mode_ref_delta_update = 1;
-
- lf->ref_deltas[INTRA_FRAME] = 1;
- lf->ref_deltas[LAST_FRAME] = 0;
- lf->ref_deltas[GOLDEN_FRAME] = -1;
- lf->ref_deltas[ALTREF_FRAME] = -1;
-
- lf->mode_deltas[0] = 0;
- lf->mode_deltas[1] = 0;
-}
-
-void vp9_setup_past_independence(VP9_COMMON *cm) {
- // Reset the segment feature data to the default stats:
- // Features disabled, 0, with delta coding (Default state).
- struct loopfilter *const lf = &cm->lf;
-
- int i;
- vp9_clearall_segfeatures(&cm->seg);
- cm->seg.abs_delta = SEGMENT_DELTADATA;
- if (cm->last_frame_seg_map)
- vpx_memset(cm->last_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols));
-
- // Reset the mode ref deltas for loop filter
- vp9_zero(lf->last_ref_deltas);
- vp9_zero(lf->last_mode_deltas);
- set_default_lf_deltas(lf);
-
- // To force update of the sharpness
- lf->last_sharpness_level = -1;
-
- vp9_default_coef_probs(cm);
- vp9_init_mode_probs(&cm->fc);
- vp9_init_mv_probs(cm);
-
- if (cm->frame_type == KEY_FRAME ||
- cm->error_resilient_mode || cm->reset_frame_context == 3) {
- // Reset all frame contexts.
- for (i = 0; i < FRAME_CONTEXTS; ++i)
- cm->frame_contexts[i] = cm->fc;
- } else if (cm->reset_frame_context == 2) {
- // Reset only the frame context specified in the frame header.
- cm->frame_contexts[cm->frame_context_idx] = cm->fc;
- }
-
- if (frame_is_intra_only(cm))
- vpx_memset(cm->prev_mip, 0, cm->mi_stride * (cm->mi_rows + 1) *
- sizeof(*cm->prev_mip));
-
- vpx_memset(cm->mip, 0, cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip));
-
- vp9_zero(cm->ref_frame_sign_bias);
-
- cm->frame_context_idx = 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.h
deleted file mode 100644
index c7b1911..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymode.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_ENTROPYMODE_H_
-#define VP9_COMMON_VP9_ENTROPYMODE_H_
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymv.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TX_SIZE_CONTEXTS 2
-#define SWITCHABLE_FILTERS 3 // number of switchable filters
-#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
-
-struct VP9Common;
-
-struct tx_probs {
- vp9_prob p32x32[TX_SIZE_CONTEXTS][TX_SIZES - 1];
- vp9_prob p16x16[TX_SIZE_CONTEXTS][TX_SIZES - 2];
- vp9_prob p8x8[TX_SIZE_CONTEXTS][TX_SIZES - 3];
-};
-
-struct tx_counts {
- unsigned int p32x32[TX_SIZE_CONTEXTS][TX_SIZES];
- unsigned int p16x16[TX_SIZE_CONTEXTS][TX_SIZES - 1];
- unsigned int p8x8[TX_SIZE_CONTEXTS][TX_SIZES - 2];
-};
-
-typedef struct frame_contexts {
- vp9_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
- vp9_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
- vp9_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
- vp9_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
- vp9_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
- [SWITCHABLE_FILTERS - 1];
- vp9_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
- vp9_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
- vp9_prob comp_inter_prob[COMP_INTER_CONTEXTS];
- vp9_prob single_ref_prob[REF_CONTEXTS][2];
- vp9_prob comp_ref_prob[REF_CONTEXTS];
- struct tx_probs tx_probs;
- vp9_prob skip_probs[SKIP_CONTEXTS];
- nmv_context nmvc;
-} FRAME_CONTEXT;
-
-typedef struct {
- unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
- unsigned int uv_mode[INTRA_MODES][INTRA_MODES];
- unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
- vp9_coeff_count_model coef[TX_SIZES][PLANE_TYPES];
- unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES]
- [COEF_BANDS][COEFF_CONTEXTS];
- unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
- [SWITCHABLE_FILTERS];
- unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES];
- unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
- unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
- unsigned int single_ref[REF_CONTEXTS][2][2];
- unsigned int comp_ref[REF_CONTEXTS][2];
- struct tx_counts tx;
- unsigned int skip[SKIP_CONTEXTS][2];
- nmv_context_counts mv;
-} FRAME_COUNTS;
-
-extern const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
-extern const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
- [INTRA_MODES - 1];
-extern const vp9_prob vp9_kf_partition_probs[PARTITION_CONTEXTS]
- [PARTITION_TYPES - 1];
-extern const vp9_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
-extern const vp9_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)];
-extern const vp9_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)];
-extern const vp9_tree_index vp9_switchable_interp_tree
- [TREE_SIZE(SWITCHABLE_FILTERS)];
-
-void vp9_setup_past_independence(struct VP9Common *cm);
-
-void vp9_init_mode_probs(FRAME_CONTEXT *fc);
-
-void vp9_adapt_mode_probs(struct VP9Common *cm);
-
-void tx_counts_to_branch_counts_32x32(const unsigned int *tx_count_32x32p,
- unsigned int (*ct_32x32p)[2]);
-void tx_counts_to_branch_counts_16x16(const unsigned int *tx_count_16x16p,
- unsigned int (*ct_16x16p)[2]);
-void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
- unsigned int (*ct_8x8p)[2]);
-
-static INLINE const vp9_prob *get_y_mode_probs(const MODE_INFO *mi,
- const MODE_INFO *above_mi,
- const MODE_INFO *left_mi,
- int block) {
- const MB_PREDICTION_MODE above = vp9_above_block_mode(mi, above_mi, block);
- const MB_PREDICTION_MODE left = vp9_left_block_mode(mi, left_mi, block);
- return vp9_kf_y_mode_prob[above][left];
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_ENTROPYMODE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.c
deleted file mode 100644
index 5bb0482..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_entropymv.h"
-
-#define MV_COUNT_SAT 20
-#define MV_MAX_UPDATE_FACTOR 128
-
-// Integer pel reference mv threshold for use of high-precision 1/8 mv
-#define COMPANDED_MVREF_THRESH 8
-
-const vp9_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = {
- -MV_JOINT_ZERO, 2,
- -MV_JOINT_HNZVZ, 4,
- -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
-};
-
-const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
- -MV_CLASS_0, 2,
- -MV_CLASS_1, 4,
- 6, 8,
- -MV_CLASS_2, -MV_CLASS_3,
- 10, 12,
- -MV_CLASS_4, -MV_CLASS_5,
- -MV_CLASS_6, 14,
- 16, 18,
- -MV_CLASS_7, -MV_CLASS_8,
- -MV_CLASS_9, -MV_CLASS_10,
-};
-
-const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = {
- -0, -1,
-};
-
-const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = {
- -0, 2,
- -1, 4,
- -2, -3
-};
-
-static const nmv_context default_nmv_context = {
- {32, 64, 96},
- {
- { // Vertical component
- 128, // sign
- {224, 144, 192, 168, 192, 176, 192, 198, 198, 245}, // class
- {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
- 160, // class0_hp bit
- 128, // hp
- },
- { // Horizontal component
- 128, // sign
- {216, 128, 176, 160, 176, 176, 192, 198, 198, 208}, // class
- {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
- 160, // class0_hp bit
- 128, // hp
- }
- },
-};
-
-static const uint8_t log_in_base_2[] = {
- 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10
-};
-
-static INLINE int mv_class_base(MV_CLASS_TYPE c) {
- return c ? CLASS0_SIZE << (c + 2) : 0;
-}
-
-MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
- const MV_CLASS_TYPE c = (z >= CLASS0_SIZE * 4096) ?
- MV_CLASS_10 : (MV_CLASS_TYPE)log_in_base_2[z >> 3];
- if (offset)
- *offset = z - mv_class_base(c);
- return c;
-}
-
-int vp9_use_mv_hp(const MV *ref) {
- return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH &&
- (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH;
-}
-
-int vp9_get_mv_mag(MV_CLASS_TYPE c, int offset) {
- return mv_class_base(c) + offset;
-}
-
-static void inc_mv_component(int v, nmv_component_counts *comp_counts,
- int incr, int usehp) {
- int s, z, c, o, d, e, f;
- assert(v != 0); /* should not be zero */
- s = v < 0;
- comp_counts->sign[s] += incr;
- z = (s ? -v : v) - 1; /* magnitude - 1 */
-
- c = vp9_get_mv_class(z, &o);
- comp_counts->classes[c] += incr;
-
- d = (o >> 3); /* int mv data */
- f = (o >> 1) & 3; /* fractional pel mv data */
- e = (o & 1); /* high precision mv data */
-
- if (c == MV_CLASS_0) {
- comp_counts->class0[d] += incr;
- comp_counts->class0_fp[d][f] += incr;
- comp_counts->class0_hp[e] += usehp * incr;
- } else {
- int i;
- int b = c + CLASS0_BITS - 1; // number of bits
- for (i = 0; i < b; ++i)
- comp_counts->bits[i][((d >> i) & 1)] += incr;
- comp_counts->fp[f] += incr;
- comp_counts->hp[e] += usehp * incr;
- }
-}
-
-void vp9_inc_mv(const MV *mv, nmv_context_counts *counts) {
- if (counts != NULL) {
- const MV_JOINT_TYPE j = vp9_get_mv_joint(mv);
- ++counts->joints[j];
-
- if (mv_joint_vertical(j)) {
- inc_mv_component(mv->row, &counts->comps[0], 1, 1);
- }
-
- if (mv_joint_horizontal(j)) {
- inc_mv_component(mv->col, &counts->comps[1], 1, 1);
- }
- }
-}
-
-static vp9_prob adapt_prob(vp9_prob prep, const unsigned int ct[2]) {
- return merge_probs(prep, ct, MV_COUNT_SAT, MV_MAX_UPDATE_FACTOR);
-}
-
-static void adapt_probs(const vp9_tree_index *tree, const vp9_prob *pre_probs,
- const unsigned int *counts, vp9_prob *probs) {
- vp9_tree_merge_probs(tree, pre_probs, counts, MV_COUNT_SAT,
- MV_MAX_UPDATE_FACTOR, probs);
-}
-
-void vp9_adapt_mv_probs(VP9_COMMON *cm, int allow_hp) {
- int i, j;
-
- 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;
-
- adapt_probs(vp9_mv_joint_tree, pre_fc->joints, counts->joints, fc->joints);
-
- for (i = 0; i < 2; ++i) {
- nmv_component *comp = &fc->comps[i];
- const nmv_component *pre_comp = &pre_fc->comps[i];
- const nmv_component_counts *c = &counts->comps[i];
-
- comp->sign = adapt_prob(pre_comp->sign, c->sign);
- adapt_probs(vp9_mv_class_tree, pre_comp->classes, c->classes,
- comp->classes);
- adapt_probs(vp9_mv_class0_tree, pre_comp->class0, c->class0, comp->class0);
-
- for (j = 0; j < MV_OFFSET_BITS; ++j)
- comp->bits[j] = adapt_prob(pre_comp->bits[j], c->bits[j]);
-
- for (j = 0; j < CLASS0_SIZE; ++j)
- adapt_probs(vp9_mv_fp_tree, pre_comp->class0_fp[j], c->class0_fp[j],
- comp->class0_fp[j]);
-
- adapt_probs(vp9_mv_fp_tree, pre_comp->fp, c->fp, comp->fp);
-
- if (allow_hp) {
- comp->class0_hp = adapt_prob(pre_comp->class0_hp, c->class0_hp);
- comp->hp = adapt_prob(pre_comp->hp, c->hp);
- }
- }
-}
-
-void vp9_init_mv_probs(VP9_COMMON *cm) {
- cm->fc.nmvc = default_nmv_context;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.h
deleted file mode 100644
index e7033e4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_entropymv.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_COMMON_VP9_ENTROPYMV_H_
-#define VP9_COMMON_VP9_ENTROPYMV_H_
-
-#include "./vpx_config.h"
-#include "vp9/common/vp9_blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP9Common;
-
-void vp9_init_mv_probs(struct VP9Common *cm);
-
-void vp9_adapt_mv_probs(struct VP9Common *cm, int usehp);
-int vp9_use_mv_hp(const MV *ref);
-
-#define MV_UPDATE_PROB 252
-
-/* Symbols for coding which components are zero jointly */
-#define MV_JOINTS 4
-typedef enum {
- MV_JOINT_ZERO = 0, /* Zero vector */
- MV_JOINT_HNZVZ = 1, /* Vert zero, hor nonzero */
- MV_JOINT_HZVNZ = 2, /* Hor zero, vert nonzero */
- MV_JOINT_HNZVNZ = 3, /* Both components nonzero */
-} MV_JOINT_TYPE;
-
-static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
- return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
-}
-
-static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
- return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ;
-}
-
-/* Symbols for coding magnitude class of nonzero components */
-#define MV_CLASSES 11
-typedef enum {
- MV_CLASS_0 = 0, /* (0, 2] integer pel */
- MV_CLASS_1 = 1, /* (2, 4] integer pel */
- MV_CLASS_2 = 2, /* (4, 8] integer pel */
- MV_CLASS_3 = 3, /* (8, 16] integer pel */
- MV_CLASS_4 = 4, /* (16, 32] integer pel */
- MV_CLASS_5 = 5, /* (32, 64] integer pel */
- MV_CLASS_6 = 6, /* (64, 128] integer pel */
- MV_CLASS_7 = 7, /* (128, 256] integer pel */
- MV_CLASS_8 = 8, /* (256, 512] integer pel */
- MV_CLASS_9 = 9, /* (512, 1024] integer pel */
- MV_CLASS_10 = 10, /* (1024,2048] integer pel */
-} MV_CLASS_TYPE;
-
-#define CLASS0_BITS 1 /* bits at integer precision for class 0 */
-#define CLASS0_SIZE (1 << CLASS0_BITS)
-#define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2)
-#define MV_FP_SIZE 4
-
-#define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2)
-#define MV_MAX ((1 << MV_MAX_BITS) - 1)
-#define MV_VALS ((MV_MAX << 1) + 1)
-
-#define MV_IN_USE_BITS 14
-#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
-#define MV_LOW (-(1 << MV_IN_USE_BITS))
-
-extern const vp9_tree_index vp9_mv_joint_tree[];
-extern const vp9_tree_index vp9_mv_class_tree[];
-extern const vp9_tree_index vp9_mv_class0_tree[];
-extern const vp9_tree_index vp9_mv_fp_tree[];
-
-typedef struct {
- vp9_prob sign;
- vp9_prob classes[MV_CLASSES - 1];
- vp9_prob class0[CLASS0_SIZE - 1];
- vp9_prob bits[MV_OFFSET_BITS];
- vp9_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
- vp9_prob fp[MV_FP_SIZE - 1];
- vp9_prob class0_hp;
- vp9_prob hp;
-} nmv_component;
-
-typedef struct {
- vp9_prob joints[MV_JOINTS - 1];
- nmv_component comps[2];
-} nmv_context;
-
-static INLINE MV_JOINT_TYPE vp9_get_mv_joint(const MV *mv) {
- if (mv->row == 0) {
- return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ;
- } else {
- return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ;
- }
-}
-
-MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset);
-int vp9_get_mv_mag(MV_CLASS_TYPE c, int offset);
-
-
-typedef struct {
- unsigned int sign[2];
- unsigned int classes[MV_CLASSES];
- unsigned int class0[CLASS0_SIZE];
- unsigned int bits[MV_OFFSET_BITS][2];
- unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE];
- unsigned int fp[MV_FP_SIZE];
- unsigned int class0_hp[2];
- unsigned int hp[2];
-} nmv_component_counts;
-
-typedef struct {
- unsigned int joints[MV_JOINTS];
- nmv_component_counts comps[2];
-} nmv_context_counts;
-
-void vp9_inc_mv(const MV *mv, nmv_context_counts *mvctx);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_ENTROPYMV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_enums.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_enums.h
deleted file mode 100644
index 779dce0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_enums.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_ENUMS_H_
-#define VP9_COMMON_VP9_ENUMS_H_
-
-#include "./vpx_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MI_SIZE_LOG2 3
-#define MI_BLOCK_SIZE_LOG2 (6 - MI_SIZE_LOG2) // 64 = 2^6
-
-#define MI_SIZE (1 << MI_SIZE_LOG2) // pixels per mi-unit
-#define MI_BLOCK_SIZE (1 << MI_BLOCK_SIZE_LOG2) // mi-units per max block
-
-#define MI_MASK (MI_BLOCK_SIZE - 1)
-
-
-typedef enum BLOCK_SIZE {
- BLOCK_4X4,
- BLOCK_4X8,
- BLOCK_8X4,
- BLOCK_8X8,
- BLOCK_8X16,
- BLOCK_16X8,
- BLOCK_16X16,
- BLOCK_16X32,
- BLOCK_32X16,
- BLOCK_32X32,
- BLOCK_32X64,
- BLOCK_64X32,
- BLOCK_64X64,
- BLOCK_SIZES,
- BLOCK_INVALID = BLOCK_SIZES
-} BLOCK_SIZE;
-
-typedef enum PARTITION_TYPE {
- PARTITION_NONE,
- PARTITION_HORZ,
- PARTITION_VERT,
- PARTITION_SPLIT,
- PARTITION_TYPES,
- PARTITION_INVALID = PARTITION_TYPES
-} PARTITION_TYPE;
-
-#define PARTITION_PLOFFSET 4 // number of probability models per block size
-#define PARTITION_CONTEXTS (4 * PARTITION_PLOFFSET)
-
-// block transform size
-typedef enum {
- TX_4X4 = 0, // 4x4 transform
- TX_8X8 = 1, // 8x8 transform
- TX_16X16 = 2, // 16x16 transform
- TX_32X32 = 3, // 32x32 transform
- TX_SIZES
-} TX_SIZE;
-
-// frame transform mode
-typedef enum {
- ONLY_4X4 = 0, // only 4x4 transform used
- ALLOW_8X8 = 1, // allow block transform size up to 8x8
- ALLOW_16X16 = 2, // allow block transform size up to 16x16
- ALLOW_32X32 = 3, // allow block transform size up to 32x32
- TX_MODE_SELECT = 4, // transform specified for each block
- TX_MODES = 5,
-} TX_MODE;
-
-typedef enum {
- DCT_DCT = 0, // DCT in both horizontal and vertical
- ADST_DCT = 1, // ADST in vertical, DCT in horizontal
- DCT_ADST = 2, // DCT in vertical, ADST in horizontal
- ADST_ADST = 3, // ADST in both directions
- TX_TYPES = 4
-} TX_TYPE;
-
-typedef enum {
- UNKNOWN = 0,
- BT_601 = 1, // YUV
- BT_709 = 2, // YUV
- SMPTE_170 = 3, // YUV
- SMPTE_240 = 4, // YUV
- RESERVED_1 = 5,
- RESERVED_2 = 6,
- SRGB = 7 // RGB
-} COLOR_SPACE;
-
-typedef enum {
- VP9_LAST_FLAG = 1 << 0,
- VP9_GOLD_FLAG = 1 << 1,
- VP9_ALT_FLAG = 1 << 2,
-} VP9_REFFRAME;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_ENUMS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.c
deleted file mode 100644
index 7474a88..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "vp9/common/vp9_filter.h"
-
-const InterpKernel vp9_bilinear_filters[SUBPEL_SHIFTS] = {
- { 0, 0, 0, 128, 0, 0, 0, 0 },
- { 0, 0, 0, 120, 8, 0, 0, 0 },
- { 0, 0, 0, 112, 16, 0, 0, 0 },
- { 0, 0, 0, 104, 24, 0, 0, 0 },
- { 0, 0, 0, 96, 32, 0, 0, 0 },
- { 0, 0, 0, 88, 40, 0, 0, 0 },
- { 0, 0, 0, 80, 48, 0, 0, 0 },
- { 0, 0, 0, 72, 56, 0, 0, 0 },
- { 0, 0, 0, 64, 64, 0, 0, 0 },
- { 0, 0, 0, 56, 72, 0, 0, 0 },
- { 0, 0, 0, 48, 80, 0, 0, 0 },
- { 0, 0, 0, 40, 88, 0, 0, 0 },
- { 0, 0, 0, 32, 96, 0, 0, 0 },
- { 0, 0, 0, 24, 104, 0, 0, 0 },
- { 0, 0, 0, 16, 112, 0, 0, 0 },
- { 0, 0, 0, 8, 120, 0, 0, 0 }
-};
-
-// Lagrangian interpolation filter
-const InterpKernel vp9_sub_pel_filters_8[SUBPEL_SHIFTS] = {
- { 0, 0, 0, 128, 0, 0, 0, 0},
- { 0, 1, -5, 126, 8, -3, 1, 0},
- { -1, 3, -10, 122, 18, -6, 2, 0},
- { -1, 4, -13, 118, 27, -9, 3, -1},
- { -1, 4, -16, 112, 37, -11, 4, -1},
- { -1, 5, -18, 105, 48, -14, 4, -1},
- { -1, 5, -19, 97, 58, -16, 5, -1},
- { -1, 6, -19, 88, 68, -18, 5, -1},
- { -1, 6, -19, 78, 78, -19, 6, -1},
- { -1, 5, -18, 68, 88, -19, 6, -1},
- { -1, 5, -16, 58, 97, -19, 5, -1},
- { -1, 4, -14, 48, 105, -18, 5, -1},
- { -1, 4, -11, 37, 112, -16, 4, -1},
- { -1, 3, -9, 27, 118, -13, 4, -1},
- { 0, 2, -6, 18, 122, -10, 3, -1},
- { 0, 1, -3, 8, 126, -5, 1, 0}
-};
-
-// DCT based filter
-const InterpKernel vp9_sub_pel_filters_8s[SUBPEL_SHIFTS] = {
- {0, 0, 0, 128, 0, 0, 0, 0},
- {-1, 3, -7, 127, 8, -3, 1, 0},
- {-2, 5, -13, 125, 17, -6, 3, -1},
- {-3, 7, -17, 121, 27, -10, 5, -2},
- {-4, 9, -20, 115, 37, -13, 6, -2},
- {-4, 10, -23, 108, 48, -16, 8, -3},
- {-4, 10, -24, 100, 59, -19, 9, -3},
- {-4, 11, -24, 90, 70, -21, 10, -4},
- {-4, 11, -23, 80, 80, -23, 11, -4},
- {-4, 10, -21, 70, 90, -24, 11, -4},
- {-3, 9, -19, 59, 100, -24, 10, -4},
- {-3, 8, -16, 48, 108, -23, 10, -4},
- {-2, 6, -13, 37, 115, -20, 9, -4},
- {-2, 5, -10, 27, 121, -17, 7, -3},
- {-1, 3, -6, 17, 125, -13, 5, -2},
- {0, 1, -3, 8, 127, -7, 3, -1}
-};
-
-// freqmultiplier = 0.5
-const InterpKernel vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS] = {
- { 0, 0, 0, 128, 0, 0, 0, 0},
- {-3, -1, 32, 64, 38, 1, -3, 0},
- {-2, -2, 29, 63, 41, 2, -3, 0},
- {-2, -2, 26, 63, 43, 4, -4, 0},
- {-2, -3, 24, 62, 46, 5, -4, 0},
- {-2, -3, 21, 60, 49, 7, -4, 0},
- {-1, -4, 18, 59, 51, 9, -4, 0},
- {-1, -4, 16, 57, 53, 12, -4, -1},
- {-1, -4, 14, 55, 55, 14, -4, -1},
- {-1, -4, 12, 53, 57, 16, -4, -1},
- { 0, -4, 9, 51, 59, 18, -4, -1},
- { 0, -4, 7, 49, 60, 21, -3, -2},
- { 0, -4, 5, 46, 62, 24, -3, -2},
- { 0, -4, 4, 43, 63, 26, -2, -2},
- { 0, -3, 2, 41, 63, 29, -2, -2},
- { 0, -3, 1, 38, 64, 32, -1, -3}
-};
-
-
-static const InterpKernel* vp9_filter_kernels[4] = {
- vp9_sub_pel_filters_8,
- vp9_sub_pel_filters_8lp,
- vp9_sub_pel_filters_8s,
- vp9_bilinear_filters
-};
-
-const InterpKernel *vp9_get_interp_kernel(INTERP_FILTER filter) {
- assert(filter != SWITCHABLE);
- return vp9_filter_kernels[filter];
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.h
deleted file mode 100644
index 29d3867..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_filter.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_FILTER_H_
-#define VP9_COMMON_VP9_FILTER_H_
-
-#include "./vpx_config.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FILTER_BITS 7
-
-#define SUBPEL_BITS 4
-#define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1)
-#define SUBPEL_SHIFTS (1 << SUBPEL_BITS)
-#define SUBPEL_TAPS 8
-
-typedef enum {
- EIGHTTAP = 0,
- EIGHTTAP_SMOOTH = 1,
- EIGHTTAP_SHARP = 2,
- BILINEAR = 3,
- SWITCHABLE = 4 /* should be the last one */
-} INTERP_FILTER;
-
-typedef int16_t InterpKernel[SUBPEL_TAPS];
-
-const InterpKernel *vp9_get_interp_kernel(INTERP_FILTER filter);
-
-DECLARE_ALIGNED(256, extern const InterpKernel,
- vp9_bilinear_filters[SUBPEL_SHIFTS]);
-DECLARE_ALIGNED(256, extern const InterpKernel,
- vp9_sub_pel_filters_8[SUBPEL_SHIFTS]);
-DECLARE_ALIGNED(256, extern const InterpKernel,
- vp9_sub_pel_filters_8s[SUBPEL_SHIFTS]);
-DECLARE_ALIGNED(256, extern const InterpKernel,
- vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS]);
-
-// The VP9_BILINEAR_FILTERS_2TAP macro returns a pointer to the bilinear
-// filter kernel as a 2 tap filter.
-#define BILINEAR_FILTERS_2TAP(x) \
- (vp9_bilinear_filters[(x)] + SUBPEL_TAPS/2 - 1)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_FILTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.c
deleted file mode 100644
index a0b1e03..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "vp9/common/vp9_frame_buffers.h"
-#include "vpx_mem/vpx_mem.h"
-
-int vp9_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
- assert(list != NULL);
- vp9_free_internal_frame_buffers(list);
-
- list->num_internal_frame_buffers =
- VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
- list->int_fb =
- (InternalFrameBuffer *)vpx_calloc(list->num_internal_frame_buffers,
- sizeof(*list->int_fb));
- return (list->int_fb == NULL);
-}
-
-void vp9_free_internal_frame_buffers(InternalFrameBufferList *list) {
- int i;
-
- assert(list != NULL);
-
- for (i = 0; i < list->num_internal_frame_buffers; ++i) {
- vpx_free(list->int_fb[i].data);
- list->int_fb[i].data = NULL;
- }
- vpx_free(list->int_fb);
- list->int_fb = NULL;
-}
-
-int vp9_get_frame_buffer(void *cb_priv, size_t min_size,
- vpx_codec_frame_buffer_t *fb) {
- int i;
- InternalFrameBufferList *const int_fb_list =
- (InternalFrameBufferList *)cb_priv;
- if (int_fb_list == NULL)
- return -1;
-
- // Find a free frame buffer.
- for (i = 0; i < int_fb_list->num_internal_frame_buffers; ++i) {
- if (!int_fb_list->int_fb[i].in_use)
- break;
- }
-
- if (i == int_fb_list->num_internal_frame_buffers)
- return -1;
-
- if (int_fb_list->int_fb[i].size < min_size) {
- int_fb_list->int_fb[i].data =
- (uint8_t *)vpx_realloc(int_fb_list->int_fb[i].data, min_size);
- if (!int_fb_list->int_fb[i].data)
- return -1;
-
- int_fb_list->int_fb[i].size = min_size;
- }
-
- fb->data = int_fb_list->int_fb[i].data;
- fb->size = int_fb_list->int_fb[i].size;
- int_fb_list->int_fb[i].in_use = 1;
-
- // Set the frame buffer's private data to point at the internal frame buffer.
- fb->priv = &int_fb_list->int_fb[i];
- return 0;
-}
-
-int vp9_release_frame_buffer(void *cb_priv, vpx_codec_frame_buffer_t *fb) {
- InternalFrameBuffer *const int_fb = (InternalFrameBuffer *)fb->priv;
- (void)cb_priv;
- int_fb->in_use = 0;
- return 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.h
deleted file mode 100644
index e2cfe61..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_frame_buffers.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_FRAME_BUFFERS_H_
-#define VP9_COMMON_VP9_FRAME_BUFFERS_H_
-
-#include "vpx/vpx_frame_buffer.h"
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct InternalFrameBuffer {
- uint8_t *data;
- size_t size;
- int in_use;
-} InternalFrameBuffer;
-
-typedef struct InternalFrameBufferList {
- int num_internal_frame_buffers;
- InternalFrameBuffer *int_fb;
-} InternalFrameBufferList;
-
-// Initializes |list|. Returns 0 on success.
-int vp9_alloc_internal_frame_buffers(InternalFrameBufferList *list);
-
-// Free any data allocated to the frame buffers.
-void vp9_free_internal_frame_buffers(InternalFrameBufferList *list);
-
-// Callback used by libvpx to request an external frame buffer. |cb_priv|
-// Callback private data, which points to an InternalFrameBufferList.
-// |min_size| is the minimum size in bytes needed to decode the next frame.
-// |fb| pointer to the frame buffer.
-int vp9_get_frame_buffer(void *cb_priv, size_t min_size,
- vpx_codec_frame_buffer_t *fb);
-
-// Callback used by libvpx when there are no references to the frame buffer.
-// |cb_priv| is not used. |fb| pointer to the frame buffer.
-int vp9_release_frame_buffer(void *cb_priv, vpx_codec_frame_buffer_t *fb);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_FRAME_BUFFERS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.c
deleted file mode 100644
index 20b78bf..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.c
+++ /dev/null
@@ -1,1406 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <math.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_systemdependent.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_idct.h"
-
-void vp9_iwht4x4_16_add_c(const int16_t *input, uint8_t *dest, int stride) {
-/* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds,
- 0.5 shifts per pixel. */
- int i;
- int16_t output[16];
- int a1, b1, c1, d1, e1;
- const int16_t *ip = input;
- int16_t *op = output;
-
- for (i = 0; i < 4; i++) {
- a1 = ip[0] >> UNIT_QUANT_SHIFT;
- c1 = ip[1] >> UNIT_QUANT_SHIFT;
- d1 = ip[2] >> UNIT_QUANT_SHIFT;
- b1 = ip[3] >> UNIT_QUANT_SHIFT;
- a1 += c1;
- d1 -= b1;
- e1 = (a1 - d1) >> 1;
- b1 = e1 - b1;
- c1 = e1 - c1;
- a1 -= b1;
- d1 += c1;
- op[0] = a1;
- op[1] = b1;
- op[2] = c1;
- op[3] = d1;
- ip += 4;
- op += 4;
- }
-
- ip = output;
- for (i = 0; i < 4; i++) {
- a1 = ip[4 * 0];
- c1 = ip[4 * 1];
- d1 = ip[4 * 2];
- b1 = ip[4 * 3];
- a1 += c1;
- d1 -= b1;
- e1 = (a1 - d1) >> 1;
- b1 = e1 - b1;
- c1 = e1 - c1;
- a1 -= b1;
- d1 += c1;
- dest[stride * 0] = clip_pixel(dest[stride * 0] + a1);
- dest[stride * 1] = clip_pixel(dest[stride * 1] + b1);
- dest[stride * 2] = clip_pixel(dest[stride * 2] + c1);
- dest[stride * 3] = clip_pixel(dest[stride * 3] + d1);
-
- ip++;
- dest++;
- }
-}
-
-void vp9_iwht4x4_1_add_c(const int16_t *in, uint8_t *dest, int dest_stride) {
- int i;
- int a1, e1;
- int16_t tmp[4];
- const int16_t *ip = in;
- int16_t *op = tmp;
-
- a1 = ip[0] >> UNIT_QUANT_SHIFT;
- e1 = a1 >> 1;
- a1 -= e1;
- op[0] = a1;
- op[1] = op[2] = op[3] = e1;
-
- ip = tmp;
- for (i = 0; i < 4; i++) {
- e1 = ip[0] >> 1;
- a1 = ip[0] - e1;
- dest[dest_stride * 0] = clip_pixel(dest[dest_stride * 0] + a1);
- dest[dest_stride * 1] = clip_pixel(dest[dest_stride * 1] + e1);
- dest[dest_stride * 2] = clip_pixel(dest[dest_stride * 2] + e1);
- dest[dest_stride * 3] = clip_pixel(dest[dest_stride * 3] + e1);
- ip++;
- dest++;
- }
-}
-
-static void idct4(const int16_t *input, int16_t *output) {
- int16_t step[4];
- int temp1, temp2;
- // stage 1
- temp1 = (input[0] + input[2]) * cospi_16_64;
- temp2 = (input[0] - input[2]) * cospi_16_64;
- step[0] = dct_const_round_shift(temp1);
- step[1] = dct_const_round_shift(temp2);
- temp1 = input[1] * cospi_24_64 - input[3] * cospi_8_64;
- temp2 = input[1] * cospi_8_64 + input[3] * cospi_24_64;
- step[2] = dct_const_round_shift(temp1);
- step[3] = dct_const_round_shift(temp2);
-
- // stage 2
- output[0] = step[0] + step[3];
- output[1] = step[1] + step[2];
- output[2] = step[1] - step[2];
- output[3] = step[0] - step[3];
-}
-
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int16_t out[4 * 4];
- int16_t *outptr = out;
- int i, j;
- int16_t temp_in[4], temp_out[4];
-
- // Rows
- for (i = 0; i < 4; ++i) {
- idct4(input, outptr);
- input += 4;
- outptr += 4;
- }
-
- // Columns
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- temp_in[j] = out[j * 4 + i];
- idct4(temp_in, temp_out);
- for (j = 0; j < 4; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 4)
- + dest[j * stride + i]);
- }
-}
-
-void vp9_idct4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride) {
- int i;
- int a1;
- int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
- out = dct_const_round_shift(out * cospi_16_64);
- a1 = ROUND_POWER_OF_TWO(out, 4);
-
- for (i = 0; i < 4; i++) {
- dest[0] = clip_pixel(dest[0] + a1);
- dest[1] = clip_pixel(dest[1] + a1);
- dest[2] = clip_pixel(dest[2] + a1);
- dest[3] = clip_pixel(dest[3] + a1);
- dest += dest_stride;
- }
-}
-
-static void idct8(const int16_t *input, int16_t *output) {
- int16_t step1[8], step2[8];
- int 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] = dct_const_round_shift(temp1);
- step1[7] = dct_const_round_shift(temp2);
- temp1 = input[5] * cospi_12_64 - input[3] * cospi_20_64;
- temp2 = input[5] * cospi_20_64 + input[3] * cospi_12_64;
- step1[5] = dct_const_round_shift(temp1);
- step1[6] = dct_const_round_shift(temp2);
-
- // stage 2 & stage 3 - even half
- idct4(step1, step1);
-
- // stage 2 - odd half
- step2[4] = step1[4] + step1[5];
- step2[5] = step1[4] - step1[5];
- step2[6] = -step1[6] + step1[7];
- step2[7] = step1[6] + step1[7];
-
- // 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] = dct_const_round_shift(temp1);
- step1[6] = dct_const_round_shift(temp2);
- step1[7] = step2[7];
-
- // stage 4
- output[0] = step1[0] + step1[7];
- output[1] = step1[1] + step1[6];
- output[2] = step1[2] + step1[5];
- output[3] = step1[3] + step1[4];
- output[4] = step1[3] - step1[4];
- output[5] = step1[2] - step1[5];
- output[6] = step1[1] - step1[6];
- output[7] = step1[0] - step1[7];
-}
-
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int16_t out[8 * 8];
- int16_t *outptr = out;
- int i, j;
- int16_t temp_in[8], temp_out[8];
-
- // First transform rows
- for (i = 0; i < 8; ++i) {
- idct8(input, outptr);
- input += 8;
- outptr += 8;
- }
-
- // Then transform columns
- for (i = 0; i < 8; ++i) {
- for (j = 0; j < 8; ++j)
- temp_in[j] = out[j * 8 + i];
- idct8(temp_in, temp_out);
- for (j = 0; j < 8; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
- + dest[j * stride + i]);
- }
-}
-
-void vp9_idct8x8_1_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int i, j;
- int a1;
- int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
- out = dct_const_round_shift(out * cospi_16_64);
- a1 = ROUND_POWER_OF_TWO(out, 5);
- for (j = 0; j < 8; ++j) {
- for (i = 0; i < 8; ++i)
- dest[i] = clip_pixel(dest[i] + a1);
- dest += stride;
- }
-}
-
-static void iadst4(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7;
-
- int x0 = input[0];
- int x1 = input[1];
- int x2 = input[2];
- int x3 = input[3];
-
- if (!(x0 | x1 | x2 | x3)) {
- output[0] = output[1] = output[2] = output[3] = 0;
- 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 = x0 - x2 + x3;
-
- x0 = s0 + s3 + s5;
- x1 = s1 - s4 - s6;
- x2 = sinpi_3_9 * s7;
- x3 = s2;
-
- s0 = x0 + x3;
- s1 = x1 + x3;
- s2 = x2;
- s3 = x0 + x1 - x3;
-
- // 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] = dct_const_round_shift(s0);
- output[1] = dct_const_round_shift(s1);
- output[2] = dct_const_round_shift(s2);
- output[3] = dct_const_round_shift(s3);
-}
-
-void vp9_iht4x4_16_add_c(const int16_t *input, uint8_t *dest, int stride,
- int tx_type) {
- const transform_2d IHT_4[] = {
- { idct4, idct4 }, // DCT_DCT = 0
- { iadst4, idct4 }, // ADST_DCT = 1
- { idct4, iadst4 }, // DCT_ADST = 2
- { iadst4, iadst4 } // ADST_ADST = 3
- };
-
- int i, j;
- int16_t out[4 * 4];
- int16_t *outptr = out;
- int16_t temp_in[4], temp_out[4];
-
- // inverse transform row vectors
- for (i = 0; i < 4; ++i) {
- IHT_4[tx_type].rows(input, outptr);
- input += 4;
- outptr += 4;
- }
-
- // inverse transform column vectors
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- temp_in[j] = out[j * 4 + i];
- IHT_4[tx_type].cols(temp_in, temp_out);
- for (j = 0; j < 4; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 4)
- + dest[j * stride + i]);
- }
-}
-static void iadst8(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7;
-
- int x0 = input[7];
- int x1 = input[0];
- int x2 = input[5];
- int x3 = input[2];
- int x4 = input[3];
- int x5 = input[4];
- int x6 = input[1];
- int x7 = input[6];
-
- if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7)) {
- output[0] = output[1] = output[2] = output[3] = output[4]
- = output[5] = output[6] = output[7] = 0;
- 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 = dct_const_round_shift(s0 + s4);
- x1 = dct_const_round_shift(s1 + s5);
- x2 = dct_const_round_shift(s2 + s6);
- x3 = dct_const_round_shift(s3 + s7);
- x4 = dct_const_round_shift(s0 - s4);
- x5 = dct_const_round_shift(s1 - s5);
- x6 = dct_const_round_shift(s2 - s6);
- x7 = dct_const_round_shift(s3 - s7);
-
- // 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 = s0 + s2;
- x1 = s1 + s3;
- x2 = s0 - s2;
- x3 = s1 - s3;
- x4 = dct_const_round_shift(s4 + s6);
- x5 = dct_const_round_shift(s5 + s7);
- x6 = dct_const_round_shift(s4 - s6);
- x7 = dct_const_round_shift(s5 - s7);
-
- // 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 = dct_const_round_shift(s2);
- x3 = dct_const_round_shift(s3);
- x6 = dct_const_round_shift(s6);
- x7 = dct_const_round_shift(s7);
-
- output[0] = x0;
- output[1] = -x4;
- output[2] = x6;
- output[3] = -x2;
- output[4] = x3;
- output[5] = -x7;
- output[6] = x5;
- output[7] = -x1;
-}
-
-static const transform_2d IHT_8[] = {
- { idct8, idct8 }, // DCT_DCT = 0
- { iadst8, idct8 }, // ADST_DCT = 1
- { idct8, iadst8 }, // DCT_ADST = 2
- { iadst8, iadst8 } // ADST_ADST = 3
-};
-
-void vp9_iht8x8_64_add_c(const int16_t *input, uint8_t *dest, int stride,
- int tx_type) {
- int i, j;
- int16_t out[8 * 8];
- int16_t *outptr = out;
- int16_t temp_in[8], temp_out[8];
- const transform_2d ht = IHT_8[tx_type];
-
- // inverse transform row vectors
- for (i = 0; i < 8; ++i) {
- ht.rows(input, outptr);
- input += 8;
- outptr += 8;
- }
-
- // inverse transform column vectors
- for (i = 0; i < 8; ++i) {
- for (j = 0; j < 8; ++j)
- temp_in[j] = out[j * 8 + i];
- ht.cols(temp_in, temp_out);
- for (j = 0; j < 8; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
- + dest[j * stride + i]);
- }
-}
-
-void vp9_idct8x8_10_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int16_t out[8 * 8] = { 0 };
- int16_t *outptr = out;
- int i, j;
- int16_t temp_in[8], temp_out[8];
-
- // First transform rows
- // only first 4 row has non-zero coefs
- for (i = 0; i < 4; ++i) {
- idct8(input, outptr);
- input += 8;
- outptr += 8;
- }
-
- // Then transform columns
- for (i = 0; i < 8; ++i) {
- for (j = 0; j < 8; ++j)
- temp_in[j] = out[j * 8 + i];
- idct8(temp_in, temp_out);
- for (j = 0; j < 8; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
- + dest[j * stride + i]);
- }
-}
-
-static void idct16(const int16_t *input, int16_t *output) {
- int16_t step1[16], step2[16];
- int temp1, temp2;
-
- // 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] = dct_const_round_shift(temp1);
- step2[15] = dct_const_round_shift(temp2);
-
- temp1 = step1[9] * cospi_14_64 - step1[14] * cospi_18_64;
- temp2 = step1[9] * cospi_18_64 + step1[14] * cospi_14_64;
- step2[9] = dct_const_round_shift(temp1);
- step2[14] = dct_const_round_shift(temp2);
-
- temp1 = step1[10] * cospi_22_64 - step1[13] * cospi_10_64;
- temp2 = step1[10] * cospi_10_64 + step1[13] * cospi_22_64;
- step2[10] = dct_const_round_shift(temp1);
- step2[13] = dct_const_round_shift(temp2);
-
- temp1 = step1[11] * cospi_6_64 - step1[12] * cospi_26_64;
- temp2 = step1[11] * cospi_26_64 + step1[12] * cospi_6_64;
- step2[11] = dct_const_round_shift(temp1);
- step2[12] = dct_const_round_shift(temp2);
-
- // 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] = dct_const_round_shift(temp1);
- step1[7] = dct_const_round_shift(temp2);
- temp1 = step2[5] * cospi_12_64 - step2[6] * cospi_20_64;
- temp2 = step2[5] * cospi_20_64 + step2[6] * cospi_12_64;
- step1[5] = dct_const_round_shift(temp1);
- step1[6] = dct_const_round_shift(temp2);
-
- step1[8] = step2[8] + step2[9];
- step1[9] = step2[8] - step2[9];
- step1[10] = -step2[10] + step2[11];
- step1[11] = step2[10] + step2[11];
- step1[12] = step2[12] + step2[13];
- step1[13] = step2[12] - step2[13];
- step1[14] = -step2[14] + step2[15];
- step1[15] = step2[14] + step2[15];
-
- // stage 4
- temp1 = (step1[0] + step1[1]) * cospi_16_64;
- temp2 = (step1[0] - step1[1]) * cospi_16_64;
- step2[0] = dct_const_round_shift(temp1);
- step2[1] = dct_const_round_shift(temp2);
- temp1 = step1[2] * cospi_24_64 - step1[3] * cospi_8_64;
- temp2 = step1[2] * cospi_8_64 + step1[3] * cospi_24_64;
- step2[2] = dct_const_round_shift(temp1);
- step2[3] = dct_const_round_shift(temp2);
- step2[4] = step1[4] + step1[5];
- step2[5] = step1[4] - step1[5];
- step2[6] = -step1[6] + step1[7];
- step2[7] = step1[6] + step1[7];
-
- 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] = dct_const_round_shift(temp1);
- step2[14] = dct_const_round_shift(temp2);
- temp1 = -step1[10] * cospi_24_64 - step1[13] * cospi_8_64;
- temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64;
- step2[10] = dct_const_round_shift(temp1);
- step2[13] = dct_const_round_shift(temp2);
- step2[11] = step1[11];
- step2[12] = step1[12];
-
- // stage 5
- step1[0] = step2[0] + step2[3];
- step1[1] = step2[1] + step2[2];
- step1[2] = step2[1] - step2[2];
- step1[3] = step2[0] - step2[3];
- step1[4] = step2[4];
- temp1 = (step2[6] - step2[5]) * cospi_16_64;
- temp2 = (step2[5] + step2[6]) * cospi_16_64;
- step1[5] = dct_const_round_shift(temp1);
- step1[6] = dct_const_round_shift(temp2);
- step1[7] = step2[7];
-
- step1[8] = step2[8] + step2[11];
- step1[9] = step2[9] + step2[10];
- step1[10] = step2[9] - step2[10];
- step1[11] = step2[8] - step2[11];
- step1[12] = -step2[12] + step2[15];
- step1[13] = -step2[13] + step2[14];
- step1[14] = step2[13] + step2[14];
- step1[15] = step2[12] + step2[15];
-
- // stage 6
- step2[0] = step1[0] + step1[7];
- step2[1] = step1[1] + step1[6];
- step2[2] = step1[2] + step1[5];
- step2[3] = step1[3] + step1[4];
- step2[4] = step1[3] - step1[4];
- step2[5] = step1[2] - step1[5];
- step2[6] = step1[1] - step1[6];
- step2[7] = step1[0] - step1[7];
- 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] = dct_const_round_shift(temp1);
- step2[13] = dct_const_round_shift(temp2);
- temp1 = (-step1[11] + step1[12]) * cospi_16_64;
- temp2 = (step1[11] + step1[12]) * cospi_16_64;
- step2[11] = dct_const_round_shift(temp1);
- step2[12] = dct_const_round_shift(temp2);
- step2[14] = step1[14];
- step2[15] = step1[15];
-
- // stage 7
- output[0] = step2[0] + step2[15];
- output[1] = step2[1] + step2[14];
- output[2] = step2[2] + step2[13];
- output[3] = step2[3] + step2[12];
- output[4] = step2[4] + step2[11];
- output[5] = step2[5] + step2[10];
- output[6] = step2[6] + step2[9];
- output[7] = step2[7] + step2[8];
- output[8] = step2[7] - step2[8];
- output[9] = step2[6] - step2[9];
- output[10] = step2[5] - step2[10];
- output[11] = step2[4] - step2[11];
- output[12] = step2[3] - step2[12];
- output[13] = step2[2] - step2[13];
- output[14] = step2[1] - step2[14];
- output[15] = step2[0] - step2[15];
-}
-
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int16_t out[16 * 16];
- int16_t *outptr = out;
- int i, j;
- int16_t temp_in[16], temp_out[16];
-
- // First transform rows
- for (i = 0; i < 16; ++i) {
- idct16(input, outptr);
- input += 16;
- outptr += 16;
- }
-
- // Then transform columns
- for (i = 0; i < 16; ++i) {
- for (j = 0; j < 16; ++j)
- temp_in[j] = out[j * 16 + i];
- idct16(temp_in, temp_out);
- for (j = 0; j < 16; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
- + dest[j * stride + i]);
- }
-}
-
-static void iadst16(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
-
- int x0 = input[15];
- int x1 = input[0];
- int x2 = input[13];
- int x3 = input[2];
- int x4 = input[11];
- int x5 = input[4];
- int x6 = input[9];
- int x7 = input[6];
- int x8 = input[7];
- int x9 = input[8];
- int x10 = input[5];
- int x11 = input[10];
- int x12 = input[3];
- int x13 = input[12];
- int x14 = input[1];
- int x15 = input[14];
-
- if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8
- | x9 | x10 | x11 | x12 | x13 | x14 | x15)) {
- output[0] = output[1] = output[2] = output[3] = output[4]
- = output[5] = output[6] = output[7] = output[8]
- = output[9] = output[10] = output[11] = output[12]
- = output[13] = output[14] = output[15] = 0;
- 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 = dct_const_round_shift(s0 + s8);
- x1 = dct_const_round_shift(s1 + s9);
- x2 = dct_const_round_shift(s2 + s10);
- x3 = dct_const_round_shift(s3 + s11);
- x4 = dct_const_round_shift(s4 + s12);
- x5 = dct_const_round_shift(s5 + s13);
- x6 = dct_const_round_shift(s6 + s14);
- x7 = dct_const_round_shift(s7 + s15);
- x8 = dct_const_round_shift(s0 - s8);
- x9 = dct_const_round_shift(s1 - s9);
- x10 = dct_const_round_shift(s2 - s10);
- x11 = dct_const_round_shift(s3 - s11);
- x12 = dct_const_round_shift(s4 - s12);
- x13 = dct_const_round_shift(s5 - s13);
- x14 = dct_const_round_shift(s6 - s14);
- x15 = dct_const_round_shift(s7 - s15);
-
- // 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 = s0 + s4;
- x1 = s1 + s5;
- x2 = s2 + s6;
- x3 = s3 + s7;
- x4 = s0 - s4;
- x5 = s1 - s5;
- x6 = s2 - s6;
- x7 = s3 - s7;
- x8 = dct_const_round_shift(s8 + s12);
- x9 = dct_const_round_shift(s9 + s13);
- x10 = dct_const_round_shift(s10 + s14);
- x11 = dct_const_round_shift(s11 + s15);
- x12 = dct_const_round_shift(s8 - s12);
- x13 = dct_const_round_shift(s9 - s13);
- x14 = dct_const_round_shift(s10 - s14);
- x15 = dct_const_round_shift(s11 - s15);
-
- // 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 = s0 + s2;
- x1 = s1 + s3;
- x2 = s0 - s2;
- x3 = s1 - s3;
- x4 = dct_const_round_shift(s4 + s6);
- x5 = dct_const_round_shift(s5 + s7);
- x6 = dct_const_round_shift(s4 - s6);
- x7 = dct_const_round_shift(s5 - s7);
- x8 = s8 + s10;
- x9 = s9 + s11;
- x10 = s8 - s10;
- x11 = s9 - s11;
- x12 = dct_const_round_shift(s12 + s14);
- x13 = dct_const_round_shift(s13 + s15);
- x14 = dct_const_round_shift(s12 - s14);
- x15 = dct_const_round_shift(s13 - s15);
-
- // 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 = dct_const_round_shift(s2);
- x3 = dct_const_round_shift(s3);
- x6 = dct_const_round_shift(s6);
- x7 = dct_const_round_shift(s7);
- x10 = dct_const_round_shift(s10);
- x11 = dct_const_round_shift(s11);
- x14 = dct_const_round_shift(s14);
- x15 = dct_const_round_shift(s15);
-
- output[0] = x0;
- output[1] = -x8;
- output[2] = x12;
- output[3] = -x4;
- output[4] = x6;
- output[5] = x14;
- output[6] = x10;
- output[7] = x2;
- output[8] = x3;
- output[9] = x11;
- output[10] = x15;
- output[11] = x7;
- output[12] = x5;
- output[13] = -x13;
- output[14] = x9;
- output[15] = -x1;
-}
-
-static const transform_2d IHT_16[] = {
- { idct16, idct16 }, // DCT_DCT = 0
- { iadst16, idct16 }, // ADST_DCT = 1
- { idct16, iadst16 }, // DCT_ADST = 2
- { iadst16, iadst16 } // ADST_ADST = 3
-};
-
-void vp9_iht16x16_256_add_c(const int16_t *input, uint8_t *dest, int stride,
- int tx_type) {
- int i, j;
- int16_t out[16 * 16];
- int16_t *outptr = out;
- int16_t temp_in[16], temp_out[16];
- const transform_2d ht = IHT_16[tx_type];
-
- // Rows
- for (i = 0; i < 16; ++i) {
- ht.rows(input, outptr);
- input += 16;
- outptr += 16;
- }
-
- // Columns
- for (i = 0; i < 16; ++i) {
- for (j = 0; j < 16; ++j)
- temp_in[j] = out[j * 16 + i];
- ht.cols(temp_in, temp_out);
- for (j = 0; j < 16; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
- + dest[j * stride + i]);
- }
-}
-
-void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int16_t out[16 * 16] = { 0 };
- int16_t *outptr = out;
- int i, j;
- int16_t temp_in[16], temp_out[16];
-
- // First transform rows. Since all non-zero dct coefficients are in
- // upper-left 4x4 area, we only need to calculate first 4 rows here.
- for (i = 0; i < 4; ++i) {
- idct16(input, outptr);
- input += 16;
- outptr += 16;
- }
-
- // Then transform columns
- for (i = 0; i < 16; ++i) {
- for (j = 0; j < 16; ++j)
- temp_in[j] = out[j*16 + i];
- idct16(temp_in, temp_out);
- for (j = 0; j < 16; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
- + dest[j * stride + i]);
- }
-}
-
-void vp9_idct16x16_1_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int i, j;
- int a1;
- int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
- out = dct_const_round_shift(out * cospi_16_64);
- a1 = ROUND_POWER_OF_TWO(out, 6);
- for (j = 0; j < 16; ++j) {
- for (i = 0; i < 16; ++i)
- dest[i] = clip_pixel(dest[i] + a1);
- dest += stride;
- }
-}
-
-static void idct32(const int16_t *input, int16_t *output) {
- int16_t step1[32], step2[32];
- int temp1, temp2;
-
- // 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] = dct_const_round_shift(temp1);
- step1[31] = dct_const_round_shift(temp2);
-
- temp1 = input[17] * cospi_15_64 - input[15] * cospi_17_64;
- temp2 = input[17] * cospi_17_64 + input[15] * cospi_15_64;
- step1[17] = dct_const_round_shift(temp1);
- step1[30] = dct_const_round_shift(temp2);
-
- temp1 = input[9] * cospi_23_64 - input[23] * cospi_9_64;
- temp2 = input[9] * cospi_9_64 + input[23] * cospi_23_64;
- step1[18] = dct_const_round_shift(temp1);
- step1[29] = dct_const_round_shift(temp2);
-
- temp1 = input[25] * cospi_7_64 - input[7] * cospi_25_64;
- temp2 = input[25] * cospi_25_64 + input[7] * cospi_7_64;
- step1[19] = dct_const_round_shift(temp1);
- step1[28] = dct_const_round_shift(temp2);
-
- temp1 = input[5] * cospi_27_64 - input[27] * cospi_5_64;
- temp2 = input[5] * cospi_5_64 + input[27] * cospi_27_64;
- step1[20] = dct_const_round_shift(temp1);
- step1[27] = dct_const_round_shift(temp2);
-
- temp1 = input[21] * cospi_11_64 - input[11] * cospi_21_64;
- temp2 = input[21] * cospi_21_64 + input[11] * cospi_11_64;
- step1[21] = dct_const_round_shift(temp1);
- step1[26] = dct_const_round_shift(temp2);
-
- temp1 = input[13] * cospi_19_64 - input[19] * cospi_13_64;
- temp2 = input[13] * cospi_13_64 + input[19] * cospi_19_64;
- step1[22] = dct_const_round_shift(temp1);
- step1[25] = dct_const_round_shift(temp2);
-
- temp1 = input[29] * cospi_3_64 - input[3] * cospi_29_64;
- temp2 = input[29] * cospi_29_64 + input[3] * cospi_3_64;
- step1[23] = dct_const_round_shift(temp1);
- step1[24] = dct_const_round_shift(temp2);
-
- // 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] = dct_const_round_shift(temp1);
- step2[15] = dct_const_round_shift(temp2);
-
- temp1 = step1[9] * cospi_14_64 - step1[14] * cospi_18_64;
- temp2 = step1[9] * cospi_18_64 + step1[14] * cospi_14_64;
- step2[9] = dct_const_round_shift(temp1);
- step2[14] = dct_const_round_shift(temp2);
-
- temp1 = step1[10] * cospi_22_64 - step1[13] * cospi_10_64;
- temp2 = step1[10] * cospi_10_64 + step1[13] * cospi_22_64;
- step2[10] = dct_const_round_shift(temp1);
- step2[13] = dct_const_round_shift(temp2);
-
- temp1 = step1[11] * cospi_6_64 - step1[12] * cospi_26_64;
- temp2 = step1[11] * cospi_26_64 + step1[12] * cospi_6_64;
- step2[11] = dct_const_round_shift(temp1);
- step2[12] = dct_const_round_shift(temp2);
-
- step2[16] = step1[16] + step1[17];
- step2[17] = step1[16] - step1[17];
- step2[18] = -step1[18] + step1[19];
- step2[19] = step1[18] + step1[19];
- step2[20] = step1[20] + step1[21];
- step2[21] = step1[20] - step1[21];
- step2[22] = -step1[22] + step1[23];
- step2[23] = step1[22] + step1[23];
- step2[24] = step1[24] + step1[25];
- step2[25] = step1[24] - step1[25];
- step2[26] = -step1[26] + step1[27];
- step2[27] = step1[26] + step1[27];
- step2[28] = step1[28] + step1[29];
- step2[29] = step1[28] - step1[29];
- step2[30] = -step1[30] + step1[31];
- step2[31] = step1[30] + step1[31];
-
- // 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] = dct_const_round_shift(temp1);
- step1[7] = dct_const_round_shift(temp2);
- temp1 = step2[5] * cospi_12_64 - step2[6] * cospi_20_64;
- temp2 = step2[5] * cospi_20_64 + step2[6] * cospi_12_64;
- step1[5] = dct_const_round_shift(temp1);
- step1[6] = dct_const_round_shift(temp2);
-
- step1[8] = step2[8] + step2[9];
- step1[9] = step2[8] - step2[9];
- step1[10] = -step2[10] + step2[11];
- step1[11] = step2[10] + step2[11];
- step1[12] = step2[12] + step2[13];
- step1[13] = step2[12] - step2[13];
- step1[14] = -step2[14] + step2[15];
- step1[15] = step2[14] + step2[15];
-
- 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] = dct_const_round_shift(temp1);
- step1[30] = dct_const_round_shift(temp2);
- temp1 = -step2[18] * cospi_28_64 - step2[29] * cospi_4_64;
- temp2 = -step2[18] * cospi_4_64 + step2[29] * cospi_28_64;
- step1[18] = dct_const_round_shift(temp1);
- step1[29] = dct_const_round_shift(temp2);
- 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] = dct_const_round_shift(temp1);
- step1[26] = dct_const_round_shift(temp2);
- temp1 = -step2[22] * cospi_12_64 - step2[25] * cospi_20_64;
- temp2 = -step2[22] * cospi_20_64 + step2[25] * cospi_12_64;
- step1[22] = dct_const_round_shift(temp1);
- step1[25] = dct_const_round_shift(temp2);
- 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] = dct_const_round_shift(temp1);
- step2[1] = dct_const_round_shift(temp2);
- temp1 = step1[2] * cospi_24_64 - step1[3] * cospi_8_64;
- temp2 = step1[2] * cospi_8_64 + step1[3] * cospi_24_64;
- step2[2] = dct_const_round_shift(temp1);
- step2[3] = dct_const_round_shift(temp2);
- step2[4] = step1[4] + step1[5];
- step2[5] = step1[4] - step1[5];
- step2[6] = -step1[6] + step1[7];
- step2[7] = step1[6] + step1[7];
-
- 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] = dct_const_round_shift(temp1);
- step2[14] = dct_const_round_shift(temp2);
- temp1 = -step1[10] * cospi_24_64 - step1[13] * cospi_8_64;
- temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64;
- step2[10] = dct_const_round_shift(temp1);
- step2[13] = dct_const_round_shift(temp2);
- step2[11] = step1[11];
- step2[12] = step1[12];
-
- step2[16] = step1[16] + step1[19];
- step2[17] = step1[17] + step1[18];
- step2[18] = step1[17] - step1[18];
- step2[19] = step1[16] - step1[19];
- step2[20] = -step1[20] + step1[23];
- step2[21] = -step1[21] + step1[22];
- step2[22] = step1[21] + step1[22];
- step2[23] = step1[20] + step1[23];
-
- step2[24] = step1[24] + step1[27];
- step2[25] = step1[25] + step1[26];
- step2[26] = step1[25] - step1[26];
- step2[27] = step1[24] - step1[27];
- step2[28] = -step1[28] + step1[31];
- step2[29] = -step1[29] + step1[30];
- step2[30] = step1[29] + step1[30];
- step2[31] = step1[28] + step1[31];
-
- // stage 5
- step1[0] = step2[0] + step2[3];
- step1[1] = step2[1] + step2[2];
- step1[2] = step2[1] - step2[2];
- step1[3] = step2[0] - step2[3];
- step1[4] = step2[4];
- temp1 = (step2[6] - step2[5]) * cospi_16_64;
- temp2 = (step2[5] + step2[6]) * cospi_16_64;
- step1[5] = dct_const_round_shift(temp1);
- step1[6] = dct_const_round_shift(temp2);
- step1[7] = step2[7];
-
- step1[8] = step2[8] + step2[11];
- step1[9] = step2[9] + step2[10];
- step1[10] = step2[9] - step2[10];
- step1[11] = step2[8] - step2[11];
- step1[12] = -step2[12] + step2[15];
- step1[13] = -step2[13] + step2[14];
- step1[14] = step2[13] + step2[14];
- step1[15] = step2[12] + step2[15];
-
- 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] = dct_const_round_shift(temp1);
- step1[29] = dct_const_round_shift(temp2);
- temp1 = -step2[19] * cospi_8_64 + step2[28] * cospi_24_64;
- temp2 = step2[19] * cospi_24_64 + step2[28] * cospi_8_64;
- step1[19] = dct_const_round_shift(temp1);
- step1[28] = dct_const_round_shift(temp2);
- temp1 = -step2[20] * cospi_24_64 - step2[27] * cospi_8_64;
- temp2 = -step2[20] * cospi_8_64 + step2[27] * cospi_24_64;
- step1[20] = dct_const_round_shift(temp1);
- step1[27] = dct_const_round_shift(temp2);
- temp1 = -step2[21] * cospi_24_64 - step2[26] * cospi_8_64;
- temp2 = -step2[21] * cospi_8_64 + step2[26] * cospi_24_64;
- step1[21] = dct_const_round_shift(temp1);
- step1[26] = dct_const_round_shift(temp2);
- 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] = step1[0] + step1[7];
- step2[1] = step1[1] + step1[6];
- step2[2] = step1[2] + step1[5];
- step2[3] = step1[3] + step1[4];
- step2[4] = step1[3] - step1[4];
- step2[5] = step1[2] - step1[5];
- step2[6] = step1[1] - step1[6];
- step2[7] = step1[0] - step1[7];
- 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] = dct_const_round_shift(temp1);
- step2[13] = dct_const_round_shift(temp2);
- temp1 = (-step1[11] + step1[12]) * cospi_16_64;
- temp2 = (step1[11] + step1[12]) * cospi_16_64;
- step2[11] = dct_const_round_shift(temp1);
- step2[12] = dct_const_round_shift(temp2);
- step2[14] = step1[14];
- step2[15] = step1[15];
-
- step2[16] = step1[16] + step1[23];
- step2[17] = step1[17] + step1[22];
- step2[18] = step1[18] + step1[21];
- step2[19] = step1[19] + step1[20];
- step2[20] = step1[19] - step1[20];
- step2[21] = step1[18] - step1[21];
- step2[22] = step1[17] - step1[22];
- step2[23] = step1[16] - step1[23];
-
- step2[24] = -step1[24] + step1[31];
- step2[25] = -step1[25] + step1[30];
- step2[26] = -step1[26] + step1[29];
- step2[27] = -step1[27] + step1[28];
- step2[28] = step1[27] + step1[28];
- step2[29] = step1[26] + step1[29];
- step2[30] = step1[25] + step1[30];
- step2[31] = step1[24] + step1[31];
-
- // stage 7
- step1[0] = step2[0] + step2[15];
- step1[1] = step2[1] + step2[14];
- step1[2] = step2[2] + step2[13];
- step1[3] = step2[3] + step2[12];
- step1[4] = step2[4] + step2[11];
- step1[5] = step2[5] + step2[10];
- step1[6] = step2[6] + step2[9];
- step1[7] = step2[7] + step2[8];
- step1[8] = step2[7] - step2[8];
- step1[9] = step2[6] - step2[9];
- step1[10] = step2[5] - step2[10];
- step1[11] = step2[4] - step2[11];
- step1[12] = step2[3] - step2[12];
- step1[13] = step2[2] - step2[13];
- step1[14] = step2[1] - step2[14];
- step1[15] = step2[0] - step2[15];
-
- 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] = dct_const_round_shift(temp1);
- step1[27] = dct_const_round_shift(temp2);
- temp1 = (-step2[21] + step2[26]) * cospi_16_64;
- temp2 = (step2[21] + step2[26]) * cospi_16_64;
- step1[21] = dct_const_round_shift(temp1);
- step1[26] = dct_const_round_shift(temp2);
- temp1 = (-step2[22] + step2[25]) * cospi_16_64;
- temp2 = (step2[22] + step2[25]) * cospi_16_64;
- step1[22] = dct_const_round_shift(temp1);
- step1[25] = dct_const_round_shift(temp2);
- temp1 = (-step2[23] + step2[24]) * cospi_16_64;
- temp2 = (step2[23] + step2[24]) * cospi_16_64;
- step1[23] = dct_const_round_shift(temp1);
- step1[24] = dct_const_round_shift(temp2);
- step1[28] = step2[28];
- step1[29] = step2[29];
- step1[30] = step2[30];
- step1[31] = step2[31];
-
- // final stage
- output[0] = step1[0] + step1[31];
- output[1] = step1[1] + step1[30];
- output[2] = step1[2] + step1[29];
- output[3] = step1[3] + step1[28];
- output[4] = step1[4] + step1[27];
- output[5] = step1[5] + step1[26];
- output[6] = step1[6] + step1[25];
- output[7] = step1[7] + step1[24];
- output[8] = step1[8] + step1[23];
- output[9] = step1[9] + step1[22];
- output[10] = step1[10] + step1[21];
- output[11] = step1[11] + step1[20];
- output[12] = step1[12] + step1[19];
- output[13] = step1[13] + step1[18];
- output[14] = step1[14] + step1[17];
- output[15] = step1[15] + step1[16];
- output[16] = step1[15] - step1[16];
- output[17] = step1[14] - step1[17];
- output[18] = step1[13] - step1[18];
- output[19] = step1[12] - step1[19];
- output[20] = step1[11] - step1[20];
- output[21] = step1[10] - step1[21];
- output[22] = step1[9] - step1[22];
- output[23] = step1[8] - step1[23];
- output[24] = step1[7] - step1[24];
- output[25] = step1[6] - step1[25];
- output[26] = step1[5] - step1[26];
- output[27] = step1[4] - step1[27];
- output[28] = step1[3] - step1[28];
- output[29] = step1[2] - step1[29];
- output[30] = step1[1] - step1[30];
- output[31] = step1[0] - step1[31];
-}
-
-void vp9_idct32x32_1024_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int16_t out[32 * 32];
- int16_t *outptr = out;
- int i, j;
- int16_t temp_in[32], temp_out[32];
-
- // Rows
- for (i = 0; i < 32; ++i) {
- int16_t zero_coeff[16];
- for (j = 0; j < 16; ++j)
- zero_coeff[j] = input[2 * j] | input[2 * j + 1];
- for (j = 0; j < 8; ++j)
- zero_coeff[j] = zero_coeff[2 * j] | zero_coeff[2 * j + 1];
- for (j = 0; j < 4; ++j)
- zero_coeff[j] = zero_coeff[2 * j] | zero_coeff[2 * j + 1];
- for (j = 0; j < 2; ++j)
- zero_coeff[j] = zero_coeff[2 * j] | zero_coeff[2 * j + 1];
-
- if (zero_coeff[0] | zero_coeff[1])
- idct32(input, outptr);
- else
- vpx_memset(outptr, 0, sizeof(int16_t) * 32);
- input += 32;
- outptr += 32;
- }
-
- // Columns
- for (i = 0; i < 32; ++i) {
- for (j = 0; j < 32; ++j)
- temp_in[j] = out[j * 32 + i];
- idct32(temp_in, temp_out);
- for (j = 0; j < 32; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
- + dest[j * stride + i]);
- }
-}
-
-void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int16_t out[32 * 32] = {0};
- int16_t *outptr = out;
- int i, j;
- int16_t temp_in[32], temp_out[32];
-
- // Rows
- // only upper-left 8x8 has non-zero coeff
- for (i = 0; i < 8; ++i) {
- idct32(input, outptr);
- input += 32;
- outptr += 32;
- }
-
- // Columns
- for (i = 0; i < 32; ++i) {
- for (j = 0; j < 32; ++j)
- temp_in[j] = out[j * 32 + i];
- idct32(temp_in, temp_out);
- for (j = 0; j < 32; ++j)
- dest[j * stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
- + dest[j * stride + i]);
- }
-}
-
-void vp9_idct32x32_1_add_c(const int16_t *input, uint8_t *dest, int stride) {
- int i, j;
- int a1;
-
- int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
- out = dct_const_round_shift(out * cospi_16_64);
- a1 = ROUND_POWER_OF_TWO(out, 6);
-
- for (j = 0; j < 32; ++j) {
- for (i = 0; i < 32; ++i)
- dest[i] = clip_pixel(dest[i] + a1);
- dest += stride;
- }
-}
-
-// idct
-void vp9_idct4x4_add(const int16_t *input, uint8_t *dest, int stride, int eob) {
- if (eob > 1)
- vp9_idct4x4_16_add(input, dest, stride);
- else
- vp9_idct4x4_1_add(input, dest, stride);
-}
-
-
-void vp9_iwht4x4_add(const int16_t *input, uint8_t *dest, int stride, int eob) {
- if (eob > 1)
- vp9_iwht4x4_16_add(input, dest, stride);
- else
- vp9_iwht4x4_1_add(input, dest, stride);
-}
-
-void vp9_idct8x8_add(const int16_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 vp9_short_idct8x8_c.
- // Combine that with code here.
- if (eob == 1)
- // DC only DCT coefficient
- vp9_idct8x8_1_add(input, dest, stride);
- else if (eob <= 10)
- vp9_idct8x8_10_add(input, dest, stride);
- else
- vp9_idct8x8_64_add(input, dest, stride);
-}
-
-void vp9_idct16x16_add(const int16_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. */
- if (eob == 1)
- /* DC only DCT coefficient. */
- vp9_idct16x16_1_add(input, dest, stride);
- else if (eob <= 10)
- vp9_idct16x16_10_add(input, dest, stride);
- else
- vp9_idct16x16_256_add(input, dest, stride);
-}
-
-void vp9_idct32x32_add(const int16_t *input, uint8_t *dest, int stride,
- int eob) {
- if (eob == 1)
- vp9_idct32x32_1_add(input, dest, stride);
- else if (eob <= 34)
- // non-zero coeff only in upper-left 8x8
- vp9_idct32x32_34_add(input, dest, stride);
- else
- vp9_idct32x32_1024_add(input, dest, stride);
-}
-
-// iht
-void vp9_iht4x4_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
- int stride, int eob) {
- if (tx_type == DCT_DCT)
- vp9_idct4x4_add(input, dest, stride, eob);
- else
- vp9_iht4x4_16_add(input, dest, stride, tx_type);
-}
-
-void vp9_iht8x8_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
- int stride, int eob) {
- if (tx_type == DCT_DCT) {
- vp9_idct8x8_add(input, dest, stride, eob);
- } else {
- vp9_iht8x8_64_add(input, dest, stride, tx_type);
- }
-}
-
-void vp9_iht16x16_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
- int stride, int eob) {
- if (tx_type == DCT_DCT) {
- vp9_idct16x16_add(input, dest, stride, eob);
- } else {
- vp9_iht16x16_256_add(input, dest, stride, tx_type);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.h
deleted file mode 100644
index ceca795..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_idct.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_IDCT_H_
-#define VP9_COMMON_VP9_IDCT_H_
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_enums.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-// Constants and Macros used by all idct/dct functions
-#define DCT_CONST_BITS 14
-#define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1))
-
-#define UNIT_QUANT_SHIFT 2
-#define UNIT_QUANT_FACTOR (1 << UNIT_QUANT_SHIFT)
-
-#define pair_set_epi16(a, b) \
- _mm_set_epi16(b, a, b, a, b, a, b, a)
-
-#define pair_set_epi32(a, b) \
- _mm_set_epi32(b, a, b, a)
-
-// Constants:
-// for (int i = 1; i< 32; ++i)
-// printf("static const int cospi_%d_64 = %.0f;\n", i,
-// round(16384 * cos(i*M_PI/64)));
-// Note: sin(k*Pi/64) = cos((32-k)*Pi/64)
-static const int cospi_1_64 = 16364;
-static const int cospi_2_64 = 16305;
-static const int cospi_3_64 = 16207;
-static const int cospi_4_64 = 16069;
-static const int cospi_5_64 = 15893;
-static const int cospi_6_64 = 15679;
-static const int cospi_7_64 = 15426;
-static const int cospi_8_64 = 15137;
-static const int cospi_9_64 = 14811;
-static const int cospi_10_64 = 14449;
-static const int cospi_11_64 = 14053;
-static const int cospi_12_64 = 13623;
-static const int cospi_13_64 = 13160;
-static const int cospi_14_64 = 12665;
-static const int cospi_15_64 = 12140;
-static const int cospi_16_64 = 11585;
-static const int cospi_17_64 = 11003;
-static const int cospi_18_64 = 10394;
-static const int cospi_19_64 = 9760;
-static const int cospi_20_64 = 9102;
-static const int cospi_21_64 = 8423;
-static const int cospi_22_64 = 7723;
-static const int cospi_23_64 = 7005;
-static const int cospi_24_64 = 6270;
-static const int cospi_25_64 = 5520;
-static const int cospi_26_64 = 4756;
-static const int cospi_27_64 = 3981;
-static const int cospi_28_64 = 3196;
-static const int cospi_29_64 = 2404;
-static const int cospi_30_64 = 1606;
-static const int cospi_31_64 = 804;
-
-// 16384 * sqrt(2) * sin(kPi/9) * 2 / 3
-static const int sinpi_1_9 = 5283;
-static const int sinpi_2_9 = 9929;
-static const int sinpi_3_9 = 13377;
-static const int sinpi_4_9 = 15212;
-
-static INLINE int dct_const_round_shift(int input) {
- int rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
- return (int16_t)rv;
-}
-
-typedef void (*transform_1d)(const int16_t*, int16_t*);
-
-typedef struct {
- transform_1d cols, rows; // vertical and horizontal
-} transform_2d;
-
-void vp9_iwht4x4_add(const int16_t *input, uint8_t *dest, int stride, int eob);
-
-void vp9_idct4x4_add(const int16_t *input, uint8_t *dest, int stride, int eob);
-void vp9_idct8x8_add(const int16_t *input, uint8_t *dest, int stride, int eob);
-void vp9_idct16x16_add(const int16_t *input, uint8_t *dest, int stride, int
- eob);
-void vp9_idct32x32_add(const int16_t *input, uint8_t *dest, int stride,
- int eob);
-
-void vp9_iht4x4_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
- int stride, int eob);
-void vp9_iht8x8_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
- int stride, int eob);
-void vp9_iht16x16_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
- int stride, int eob);
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_IDCT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.c
deleted file mode 100644
index 3ac5a05..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.c
+++ /dev/null
@@ -1,1252 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_seg_common.h"
-
-// 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
-// boundary.
-//
-// In the case of TX_16X16-> ( in low order byte first we end up with
-// a mask that looks like this
-//
-// 10101010
-// 10101010
-// 10101010
-// 10101010
-// 10101010
-// 10101010
-// 10101010
-// 10101010
-//
-// A loopfilter should be applied to every other 8x8 horizontally.
-static const uint64_t left_64x64_txform_mask[TX_SIZES]= {
- 0xffffffffffffffff, // TX_4X4
- 0xffffffffffffffff, // TX_8x8
- 0x5555555555555555, // TX_16x16
- 0x1111111111111111, // TX_32x32
-};
-
-// 64 bit masks for above transform size. Each 1 represents a position where
-// we should apply a loop filter across the top border of an 8x8 block
-// boundary.
-//
-// In the case of TX_32x32 -> ( in low order byte first we end up with
-// a mask that looks like this
-//
-// 11111111
-// 00000000
-// 00000000
-// 00000000
-// 11111111
-// 00000000
-// 00000000
-// 00000000
-//
-// A loopfilter should be applied to every other 4 the row vertically.
-static const uint64_t above_64x64_txform_mask[TX_SIZES]= {
- 0xffffffffffffffff, // TX_4X4
- 0xffffffffffffffff, // TX_8x8
- 0x00ff00ff00ff00ff, // TX_16x16
- 0x000000ff000000ff, // TX_32x32
-};
-
-// 64 bit masks for prediction sizes (left). Each 1 represents a position
-// where left border of an 8x8 block. These are aligned to the right most
-// appropriate bit, and then shifted into place.
-//
-// In the case of TX_16x32 -> ( low order byte first ) we end up with
-// a mask that looks like this :
-//
-// 10000000
-// 10000000
-// 10000000
-// 10000000
-// 00000000
-// 00000000
-// 00000000
-// 00000000
-static const uint64_t left_prediction_mask[BLOCK_SIZES] = {
- 0x0000000000000001, // BLOCK_4X4,
- 0x0000000000000001, // BLOCK_4X8,
- 0x0000000000000001, // BLOCK_8X4,
- 0x0000000000000001, // BLOCK_8X8,
- 0x0000000000000101, // BLOCK_8X16,
- 0x0000000000000001, // BLOCK_16X8,
- 0x0000000000000101, // BLOCK_16X16,
- 0x0000000001010101, // BLOCK_16X32,
- 0x0000000000000101, // BLOCK_32X16,
- 0x0000000001010101, // BLOCK_32X32,
- 0x0101010101010101, // BLOCK_32X64,
- 0x0000000001010101, // BLOCK_64X32,
- 0x0101010101010101, // BLOCK_64X64
-};
-
-// 64 bit mask to shift and set for each prediction size.
-static const uint64_t above_prediction_mask[BLOCK_SIZES] = {
- 0x0000000000000001, // BLOCK_4X4
- 0x0000000000000001, // BLOCK_4X8
- 0x0000000000000001, // BLOCK_8X4
- 0x0000000000000001, // BLOCK_8X8
- 0x0000000000000001, // BLOCK_8X16,
- 0x0000000000000003, // BLOCK_16X8
- 0x0000000000000003, // BLOCK_16X16
- 0x0000000000000003, // BLOCK_16X32,
- 0x000000000000000f, // BLOCK_32X16,
- 0x000000000000000f, // BLOCK_32X32,
- 0x000000000000000f, // BLOCK_32X64,
- 0x00000000000000ff, // BLOCK_64X32,
- 0x00000000000000ff, // BLOCK_64X64
-};
-// 64 bit mask to shift and set for each prediction size. A bit is set for
-// each 8x8 block that would be in the left most block of the given block
-// size in the 64x64 block.
-static const uint64_t size_mask[BLOCK_SIZES] = {
- 0x0000000000000001, // BLOCK_4X4
- 0x0000000000000001, // BLOCK_4X8
- 0x0000000000000001, // BLOCK_8X4
- 0x0000000000000001, // BLOCK_8X8
- 0x0000000000000101, // BLOCK_8X16,
- 0x0000000000000003, // BLOCK_16X8
- 0x0000000000000303, // BLOCK_16X16
- 0x0000000003030303, // BLOCK_16X32,
- 0x0000000000000f0f, // BLOCK_32X16,
- 0x000000000f0f0f0f, // BLOCK_32X32,
- 0x0f0f0f0f0f0f0f0f, // BLOCK_32X64,
- 0x00000000ffffffff, // BLOCK_64X32,
- 0xffffffffffffffff, // BLOCK_64X64
-};
-
-// These are used for masking the left and above borders.
-static const uint64_t left_border = 0x1111111111111111;
-static const uint64_t above_border = 0x000000ff000000ff;
-
-// 16 bit masks for uv transform sizes.
-static const uint16_t left_64x64_txform_mask_uv[TX_SIZES]= {
- 0xffff, // TX_4X4
- 0xffff, // TX_8x8
- 0x5555, // TX_16x16
- 0x1111, // TX_32x32
-};
-
-static const uint16_t above_64x64_txform_mask_uv[TX_SIZES]= {
- 0xffff, // TX_4X4
- 0xffff, // TX_8x8
- 0x0f0f, // TX_16x16
- 0x000f, // TX_32x32
-};
-
-// 16 bit left mask to shift and set for each uv prediction size.
-static const uint16_t left_prediction_mask_uv[BLOCK_SIZES] = {
- 0x0001, // BLOCK_4X4,
- 0x0001, // BLOCK_4X8,
- 0x0001, // BLOCK_8X4,
- 0x0001, // BLOCK_8X8,
- 0x0001, // BLOCK_8X16,
- 0x0001, // BLOCK_16X8,
- 0x0001, // BLOCK_16X16,
- 0x0011, // BLOCK_16X32,
- 0x0001, // BLOCK_32X16,
- 0x0011, // BLOCK_32X32,
- 0x1111, // BLOCK_32X64
- 0x0011, // BLOCK_64X32,
- 0x1111, // BLOCK_64X64
-};
-// 16 bit above mask to shift and set for uv each prediction size.
-static const uint16_t above_prediction_mask_uv[BLOCK_SIZES] = {
- 0x0001, // BLOCK_4X4
- 0x0001, // BLOCK_4X8
- 0x0001, // BLOCK_8X4
- 0x0001, // BLOCK_8X8
- 0x0001, // BLOCK_8X16,
- 0x0001, // BLOCK_16X8
- 0x0001, // BLOCK_16X16
- 0x0001, // BLOCK_16X32,
- 0x0003, // BLOCK_32X16,
- 0x0003, // BLOCK_32X32,
- 0x0003, // BLOCK_32X64,
- 0x000f, // BLOCK_64X32,
- 0x000f, // BLOCK_64X64
-};
-
-// 64 bit mask to shift and set for each uv prediction size
-static const uint16_t size_mask_uv[BLOCK_SIZES] = {
- 0x0001, // BLOCK_4X4
- 0x0001, // BLOCK_4X8
- 0x0001, // BLOCK_8X4
- 0x0001, // BLOCK_8X8
- 0x0001, // BLOCK_8X16,
- 0x0001, // BLOCK_16X8
- 0x0001, // BLOCK_16X16
- 0x0011, // BLOCK_16X32,
- 0x0003, // BLOCK_32X16,
- 0x0033, // BLOCK_32X32,
- 0x3333, // BLOCK_32X64,
- 0x00ff, // BLOCK_64X32,
- 0xffff, // BLOCK_64X64
-};
-static const uint16_t left_border_uv = 0x1111;
-static const uint16_t above_border_uv = 0x000f;
-
-static const int mode_lf_lut[MB_MODE_COUNT] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
- 1, 1, 0, 1 // INTER_MODES (ZEROMV == 0)
-};
-
-static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) {
- int lvl;
-
- // For each possible value for the loop filter fill out limits
- for (lvl = 0; lvl <= MAX_LOOP_FILTER; lvl++) {
- // Set loop filter paramaeters that control sharpness.
- int block_inside_limit = lvl >> ((sharpness_lvl > 0) + (sharpness_lvl > 4));
-
- if (sharpness_lvl > 0) {
- if (block_inside_limit > (9 - sharpness_lvl))
- block_inside_limit = (9 - sharpness_lvl);
- }
-
- if (block_inside_limit < 1)
- block_inside_limit = 1;
-
- vpx_memset(lfi->lfthr[lvl].lim, block_inside_limit, SIMD_WIDTH);
- vpx_memset(lfi->lfthr[lvl].mblim, (2 * (lvl + 2) + block_inside_limit),
- SIMD_WIDTH);
- }
-}
-
-static uint8_t get_filter_level(const loop_filter_info_n *lfi_n,
- const MB_MODE_INFO *mbmi) {
- return lfi_n->lvl[mbmi->segment_id][mbmi->ref_frame[0]]
- [mode_lf_lut[mbmi->mode]];
-}
-
-void vp9_loop_filter_init(VP9_COMMON *cm) {
- loop_filter_info_n *lfi = &cm->lf_info;
- struct loopfilter *lf = &cm->lf;
- int lvl;
-
- // init limits for given sharpness
- update_sharpness(lfi, lf->sharpness_level);
- lf->last_sharpness_level = lf->sharpness_level;
-
- // init hev threshold const vectors
- for (lvl = 0; lvl <= MAX_LOOP_FILTER; lvl++)
- vpx_memset(lfi->lfthr[lvl].hev_thr, (lvl >> 4), SIMD_WIDTH);
-}
-
-void vp9_loop_filter_frame_init(VP9_COMMON *cm, int default_filt_lvl) {
- int seg_id;
- // n_shift is the a multiplier for lf_deltas
- // the multiplier is 1 for when filter_lvl is between 0 and 31;
- // 2 when filter_lvl is between 32 and 63
- const int scale = 1 << (default_filt_lvl >> 5);
- loop_filter_info_n *const lfi = &cm->lf_info;
- struct loopfilter *const lf = &cm->lf;
- const struct segmentation *const seg = &cm->seg;
-
- // update limits if sharpness has changed
- if (lf->last_sharpness_level != lf->sharpness_level) {
- update_sharpness(lfi, lf->sharpness_level);
- lf->last_sharpness_level = lf->sharpness_level;
- }
-
- for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) {
- int lvl_seg = default_filt_lvl;
- if (vp9_segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) {
- const int data = vp9_get_segdata(seg, seg_id, SEG_LVL_ALT_LF);
- lvl_seg = clamp(seg->abs_delta == SEGMENT_ABSDATA ?
- data : default_filt_lvl + data,
- 0, MAX_LOOP_FILTER);
- }
-
- if (!lf->mode_ref_delta_enabled) {
- // we could get rid of this if we assume that deltas are set to
- // zero when not in use; encoder always uses deltas
- vpx_memset(lfi->lvl[seg_id], lvl_seg, sizeof(lfi->lvl[seg_id]));
- } else {
- int ref, mode;
- const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale;
- lfi->lvl[seg_id][INTRA_FRAME][0] = clamp(intra_lvl, 0, MAX_LOOP_FILTER);
-
- for (ref = LAST_FRAME; ref < MAX_REF_FRAMES; ++ref) {
- for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) {
- const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * scale
- + lf->mode_deltas[mode] * scale;
- lfi->lvl[seg_id][ref][mode] = clamp(inter_lvl, 0, MAX_LOOP_FILTER);
- }
- }
- }
- }
-}
-
-static void filter_selectively_vert_row2(PLANE_TYPE plane_type,
- uint8_t *s, int pitch,
- unsigned int mask_16x16_l,
- unsigned int mask_8x8_l,
- unsigned int mask_4x4_l,
- unsigned int mask_4x4_int_l,
- const loop_filter_info_n *lfi_n,
- const uint8_t *lfl) {
- const int mask_shift = plane_type ? 4 : 8;
- const int mask_cutoff = plane_type ? 0xf : 0xff;
- const int lfl_forward = plane_type ? 4 : 8;
-
- unsigned int mask_16x16_0 = mask_16x16_l & mask_cutoff;
- unsigned int mask_8x8_0 = mask_8x8_l & mask_cutoff;
- unsigned int mask_4x4_0 = mask_4x4_l & mask_cutoff;
- unsigned int mask_4x4_int_0 = mask_4x4_int_l & mask_cutoff;
- unsigned int mask_16x16_1 = (mask_16x16_l >> mask_shift) & mask_cutoff;
- unsigned int mask_8x8_1 = (mask_8x8_l >> mask_shift) & mask_cutoff;
- unsigned int mask_4x4_1 = (mask_4x4_l >> mask_shift) & mask_cutoff;
- unsigned int mask_4x4_int_1 = (mask_4x4_int_l >> mask_shift) & mask_cutoff;
- unsigned int mask;
-
- for (mask = mask_16x16_0 | mask_8x8_0 | mask_4x4_0 | mask_4x4_int_0 |
- mask_16x16_1 | mask_8x8_1 | mask_4x4_1 | mask_4x4_int_1;
- mask; mask >>= 1) {
- const loop_filter_thresh *lfi0 = lfi_n->lfthr + *lfl;
- const loop_filter_thresh *lfi1 = lfi_n->lfthr + *(lfl + lfl_forward);
-
- // TODO(yunqingwang): count in loopfilter functions should be removed.
- if (mask & 1) {
- if ((mask_16x16_0 | mask_16x16_1) & 1) {
- if ((mask_16x16_0 & mask_16x16_1) & 1) {
- vp9_lpf_vertical_16_dual(s, pitch, lfi0->mblim, lfi0->lim,
- lfi0->hev_thr);
- } else if (mask_16x16_0 & 1) {
- vp9_lpf_vertical_16(s, pitch, lfi0->mblim, lfi0->lim,
- lfi0->hev_thr);
- } else {
- vp9_lpf_vertical_16(s + 8 *pitch, pitch, lfi1->mblim,
- lfi1->lim, lfi1->hev_thr);
- }
- }
-
- if ((mask_8x8_0 | mask_8x8_1) & 1) {
- if ((mask_8x8_0 & mask_8x8_1) & 1) {
- vp9_lpf_vertical_8_dual(s, pitch, lfi0->mblim, lfi0->lim,
- lfi0->hev_thr, lfi1->mblim, lfi1->lim,
- lfi1->hev_thr);
- } else if (mask_8x8_0 & 1) {
- vp9_lpf_vertical_8(s, pitch, lfi0->mblim, lfi0->lim, lfi0->hev_thr,
- 1);
- } else {
- vp9_lpf_vertical_8(s + 8 * pitch, pitch, lfi1->mblim, lfi1->lim,
- lfi1->hev_thr, 1);
- }
- }
-
- if ((mask_4x4_0 | mask_4x4_1) & 1) {
- if ((mask_4x4_0 & mask_4x4_1) & 1) {
- vp9_lpf_vertical_4_dual(s, pitch, lfi0->mblim, lfi0->lim,
- lfi0->hev_thr, lfi1->mblim, lfi1->lim,
- lfi1->hev_thr);
- } else if (mask_4x4_0 & 1) {
- vp9_lpf_vertical_4(s, pitch, lfi0->mblim, lfi0->lim, lfi0->hev_thr,
- 1);
- } else {
- vp9_lpf_vertical_4(s + 8 * pitch, pitch, lfi1->mblim, lfi1->lim,
- lfi1->hev_thr, 1);
- }
- }
-
- if ((mask_4x4_int_0 | mask_4x4_int_1) & 1) {
- if ((mask_4x4_int_0 & mask_4x4_int_1) & 1) {
- vp9_lpf_vertical_4_dual(s + 4, pitch, lfi0->mblim, lfi0->lim,
- lfi0->hev_thr, lfi1->mblim, lfi1->lim,
- lfi1->hev_thr);
- } else if (mask_4x4_int_0 & 1) {
- vp9_lpf_vertical_4(s + 4, pitch, lfi0->mblim, lfi0->lim,
- lfi0->hev_thr, 1);
- } else {
- vp9_lpf_vertical_4(s + 8 * pitch + 4, pitch, lfi1->mblim, lfi1->lim,
- lfi1->hev_thr, 1);
- }
- }
- }
-
- s += 8;
- lfl += 1;
- mask_16x16_0 >>= 1;
- mask_8x8_0 >>= 1;
- mask_4x4_0 >>= 1;
- mask_4x4_int_0 >>= 1;
- mask_16x16_1 >>= 1;
- mask_8x8_1 >>= 1;
- mask_4x4_1 >>= 1;
- mask_4x4_int_1 >>= 1;
- }
-}
-
-static void filter_selectively_horiz(uint8_t *s, int pitch,
- unsigned int mask_16x16,
- unsigned int mask_8x8,
- unsigned int mask_4x4,
- unsigned int mask_4x4_int,
- const loop_filter_info_n *lfi_n,
- const uint8_t *lfl) {
- unsigned int mask;
- int count;
-
- for (mask = mask_16x16 | mask_8x8 | mask_4x4 | mask_4x4_int;
- mask; mask >>= count) {
- const loop_filter_thresh *lfi = lfi_n->lfthr + *lfl;
-
- count = 1;
- if (mask & 1) {
- if (mask_16x16 & 1) {
- if ((mask_16x16 & 3) == 3) {
- vp9_lpf_horizontal_16(s, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, 2);
- count = 2;
- } else {
- vp9_lpf_horizontal_16(s, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, 1);
- }
- } else if (mask_8x8 & 1) {
- if ((mask_8x8 & 3) == 3) {
- // Next block's thresholds
- const loop_filter_thresh *lfin = lfi_n->lfthr + *(lfl + 1);
-
- vp9_lpf_horizontal_8_dual(s, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, lfin->mblim, lfin->lim,
- lfin->hev_thr);
-
- if ((mask_4x4_int & 3) == 3) {
- vp9_lpf_horizontal_4_dual(s + 4 * pitch, pitch, lfi->mblim,
- lfi->lim, lfi->hev_thr, lfin->mblim,
- lfin->lim, lfin->hev_thr);
- } else {
- if (mask_4x4_int & 1)
- vp9_lpf_horizontal_4(s + 4 * pitch, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, 1);
- else if (mask_4x4_int & 2)
- vp9_lpf_horizontal_4(s + 8 + 4 * pitch, pitch, lfin->mblim,
- lfin->lim, lfin->hev_thr, 1);
- }
- count = 2;
- } else {
- vp9_lpf_horizontal_8(s, pitch, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (mask_4x4_int & 1)
- vp9_lpf_horizontal_4(s + 4 * pitch, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, 1);
- }
- } else if (mask_4x4 & 1) {
- if ((mask_4x4 & 3) == 3) {
- // Next block's thresholds
- const loop_filter_thresh *lfin = lfi_n->lfthr + *(lfl + 1);
-
- vp9_lpf_horizontal_4_dual(s, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, lfin->mblim, lfin->lim,
- lfin->hev_thr);
- if ((mask_4x4_int & 3) == 3) {
- vp9_lpf_horizontal_4_dual(s + 4 * pitch, pitch, lfi->mblim,
- lfi->lim, lfi->hev_thr, lfin->mblim,
- lfin->lim, lfin->hev_thr);
- } else {
- if (mask_4x4_int & 1)
- vp9_lpf_horizontal_4(s + 4 * pitch, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, 1);
- else if (mask_4x4_int & 2)
- vp9_lpf_horizontal_4(s + 8 + 4 * pitch, pitch, lfin->mblim,
- lfin->lim, lfin->hev_thr, 1);
- }
- count = 2;
- } else {
- vp9_lpf_horizontal_4(s, pitch, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (mask_4x4_int & 1)
- vp9_lpf_horizontal_4(s + 4 * pitch, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, 1);
- }
- } else if (mask_4x4_int & 1) {
- vp9_lpf_horizontal_4(s + 4 * pitch, pitch, lfi->mblim, lfi->lim,
- lfi->hev_thr, 1);
- }
- }
- s += 8 * count;
- lfl += count;
- mask_16x16 >>= count;
- mask_8x8 >>= count;
- mask_4x4 >>= count;
- mask_4x4_int >>= count;
- }
-}
-
-// This function ors into the current lfm structure, where to do loop
-// filters for the specific mi we are looking at. It uses information
-// including the block_size_type (32x16, 32x32, etc), the transform size,
-// whether there were any coefficients encoded, and the loop filter strength
-// block we are currently looking at. Shift is used to position the
-// 1's we produce.
-// TODO(JBB) Need another function for different resolution color..
-static void build_masks(const loop_filter_info_n *const lfi_n,
- const MODE_INFO *mi, const int shift_y,
- const int shift_uv,
- LOOP_FILTER_MASK *lfm) {
- const MB_MODE_INFO *mbmi = &mi->mbmi;
- const BLOCK_SIZE block_size = mbmi->sb_type;
- const TX_SIZE tx_size_y = mbmi->tx_size;
- const TX_SIZE tx_size_uv = get_uv_tx_size(mbmi);
- const int filter_level = get_filter_level(lfi_n, mbmi);
- uint64_t *const left_y = &lfm->left_y[tx_size_y];
- uint64_t *const above_y = &lfm->above_y[tx_size_y];
- uint64_t *const int_4x4_y = &lfm->int_4x4_y;
- uint16_t *const left_uv = &lfm->left_uv[tx_size_uv];
- uint16_t *const above_uv = &lfm->above_uv[tx_size_uv];
- uint16_t *const int_4x4_uv = &lfm->int_4x4_uv;
- int i;
-
- // If filter level is 0 we don't loop filter.
- if (!filter_level) {
- return;
- } else {
- const int w = num_8x8_blocks_wide_lookup[block_size];
- const int h = num_8x8_blocks_high_lookup[block_size];
- int index = shift_y;
- for (i = 0; i < h; i++) {
- vpx_memset(&lfm->lfl_y[index], filter_level, w);
- index += 8;
- }
- }
-
- // These set 1 in the current block size for the block size edges.
- // For instance if the block size is 32x16, we'll set :
- // above = 1111
- // 0000
- // and
- // left = 1000
- // = 1000
- // NOTE : In this example the low bit is left most ( 1000 ) is stored as
- // 1, not 8...
- //
- // U and v set things on a 16 bit scale.
- //
- *above_y |= above_prediction_mask[block_size] << shift_y;
- *above_uv |= above_prediction_mask_uv[block_size] << shift_uv;
- *left_y |= left_prediction_mask[block_size] << shift_y;
- *left_uv |= left_prediction_mask_uv[block_size] << shift_uv;
-
- // If the block has no coefficients and is not intra we skip applying
- // the loop filter on block edges.
- if (mbmi->skip && is_inter_block(mbmi))
- return;
-
- // Here we are adding a mask for the transform size. The transform
- // size mask is set to be correct for a 64x64 prediction block size. We
- // mask to match the size of the block we are working on and then shift it
- // into place..
- *above_y |= (size_mask[block_size] &
- above_64x64_txform_mask[tx_size_y]) << shift_y;
- *above_uv |= (size_mask_uv[block_size] &
- above_64x64_txform_mask_uv[tx_size_uv]) << shift_uv;
-
- *left_y |= (size_mask[block_size] &
- left_64x64_txform_mask[tx_size_y]) << shift_y;
- *left_uv |= (size_mask_uv[block_size] &
- left_64x64_txform_mask_uv[tx_size_uv]) << shift_uv;
-
- // Here we are trying to determine what to do with the internal 4x4 block
- // boundaries. These differ from the 4x4 boundaries on the outside edge of
- // an 8x8 in that the internal ones can be skipped and don't depend on
- // the prediction block size.
- if (tx_size_y == TX_4X4)
- *int_4x4_y |= (size_mask[block_size] & 0xffffffffffffffff) << shift_y;
-
- if (tx_size_uv == TX_4X4)
- *int_4x4_uv |= (size_mask_uv[block_size] & 0xffff) << shift_uv;
-}
-
-// This function does the same thing as the one above with the exception that
-// it only affects the y masks. It exists because for blocks < 16x16 in size,
-// we only update u and v masks on the first block.
-static void build_y_mask(const loop_filter_info_n *const lfi_n,
- const MODE_INFO *mi, const int shift_y,
- LOOP_FILTER_MASK *lfm) {
- const MB_MODE_INFO *mbmi = &mi->mbmi;
- const BLOCK_SIZE block_size = mbmi->sb_type;
- const TX_SIZE tx_size_y = mbmi->tx_size;
- const int filter_level = get_filter_level(lfi_n, mbmi);
- uint64_t *const left_y = &lfm->left_y[tx_size_y];
- uint64_t *const above_y = &lfm->above_y[tx_size_y];
- uint64_t *const int_4x4_y = &lfm->int_4x4_y;
- int i;
-
- if (!filter_level) {
- return;
- } else {
- const int w = num_8x8_blocks_wide_lookup[block_size];
- const int h = num_8x8_blocks_high_lookup[block_size];
- int index = shift_y;
- for (i = 0; i < h; i++) {
- vpx_memset(&lfm->lfl_y[index], filter_level, w);
- index += 8;
- }
- }
-
- *above_y |= above_prediction_mask[block_size] << shift_y;
- *left_y |= left_prediction_mask[block_size] << shift_y;
-
- if (mbmi->skip && is_inter_block(mbmi))
- return;
-
- *above_y |= (size_mask[block_size] &
- above_64x64_txform_mask[tx_size_y]) << shift_y;
-
- *left_y |= (size_mask[block_size] &
- left_64x64_txform_mask[tx_size_y]) << shift_y;
-
- if (tx_size_y == TX_4X4)
- *int_4x4_y |= (size_mask[block_size] & 0xffffffffffffffff) << shift_y;
-}
-
-// This function sets up the bit masks for the entire 64x64 region represented
-// by mi_row, mi_col.
-// TODO(JBB): This function only works for yv12.
-void vp9_setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
- MODE_INFO **mi_8x8, const int mode_info_stride,
- LOOP_FILTER_MASK *lfm) {
- int idx_32, idx_16, idx_8;
- const loop_filter_info_n *const lfi_n = &cm->lf_info;
- MODE_INFO **mip = mi_8x8;
- MODE_INFO **mip2 = mi_8x8;
-
- // These are offsets to the next mi in the 64x64 block. It is what gets
- // added to the mi ptr as we go through each loop. It helps us to avoids
- // setting up special row and column counters for each index. The last step
- // brings us out back to the starting position.
- const int offset_32[] = {4, (mode_info_stride << 2) - 4, 4,
- -(mode_info_stride << 2) - 4};
- const int offset_16[] = {2, (mode_info_stride << 1) - 2, 2,
- -(mode_info_stride << 1) - 2};
- const int offset[] = {1, mode_info_stride - 1, 1, -mode_info_stride - 1};
-
- // Following variables represent shifts to position the current block
- // mask over the appropriate block. A shift of 36 to the left will move
- // the bits for the final 32 by 32 block in the 64x64 up 4 rows and left
- // 4 rows to the appropriate spot.
- const int shift_32_y[] = {0, 4, 32, 36};
- const int shift_16_y[] = {0, 2, 16, 18};
- const int shift_8_y[] = {0, 1, 8, 9};
- const int shift_32_uv[] = {0, 2, 8, 10};
- const int shift_16_uv[] = {0, 1, 4, 5};
- int i;
- const int max_rows = (mi_row + MI_BLOCK_SIZE > cm->mi_rows ?
- cm->mi_rows - mi_row : MI_BLOCK_SIZE);
- const int max_cols = (mi_col + MI_BLOCK_SIZE > cm->mi_cols ?
- cm->mi_cols - mi_col : MI_BLOCK_SIZE);
-
- vp9_zero(*lfm);
-
- // TODO(jimbankoski): Try moving most of the following code into decode
- // loop and storing lfm in the mbmi structure so that we don't have to go
- // through the recursive loop structure multiple times.
- switch (mip[0]->mbmi.sb_type) {
- case BLOCK_64X64:
- build_masks(lfi_n, mip[0] , 0, 0, lfm);
- break;
- case BLOCK_64X32:
- build_masks(lfi_n, mip[0], 0, 0, lfm);
- mip2 = mip + mode_info_stride * 4;
- if (4 >= max_rows)
- break;
- build_masks(lfi_n, mip2[0], 32, 8, lfm);
- break;
- case BLOCK_32X64:
- build_masks(lfi_n, mip[0], 0, 0, lfm);
- mip2 = mip + 4;
- if (4 >= max_cols)
- break;
- build_masks(lfi_n, mip2[0], 4, 2, lfm);
- break;
- default:
- for (idx_32 = 0; idx_32 < 4; mip += offset_32[idx_32], ++idx_32) {
- const int shift_y = shift_32_y[idx_32];
- const int shift_uv = shift_32_uv[idx_32];
- const int mi_32_col_offset = ((idx_32 & 1) << 2);
- const int mi_32_row_offset = ((idx_32 >> 1) << 2);
- if (mi_32_col_offset >= max_cols || mi_32_row_offset >= max_rows)
- continue;
- switch (mip[0]->mbmi.sb_type) {
- case BLOCK_32X32:
- build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
- break;
- case BLOCK_32X16:
- build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
- if (mi_32_row_offset + 2 >= max_rows)
- continue;
- mip2 = mip + mode_info_stride * 2;
- build_masks(lfi_n, mip2[0], shift_y + 16, shift_uv + 4, lfm);
- break;
- case BLOCK_16X32:
- build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
- if (mi_32_col_offset + 2 >= max_cols)
- continue;
- mip2 = mip + 2;
- build_masks(lfi_n, mip2[0], shift_y + 2, shift_uv + 1, lfm);
- break;
- default:
- for (idx_16 = 0; idx_16 < 4; mip += offset_16[idx_16], ++idx_16) {
- const int shift_y = shift_32_y[idx_32] + shift_16_y[idx_16];
- const int shift_uv = shift_32_uv[idx_32] + shift_16_uv[idx_16];
- const int mi_16_col_offset = mi_32_col_offset +
- ((idx_16 & 1) << 1);
- const int mi_16_row_offset = mi_32_row_offset +
- ((idx_16 >> 1) << 1);
-
- if (mi_16_col_offset >= max_cols || mi_16_row_offset >= max_rows)
- continue;
-
- switch (mip[0]->mbmi.sb_type) {
- case BLOCK_16X16:
- build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
- break;
- case BLOCK_16X8:
- build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
- if (mi_16_row_offset + 1 >= max_rows)
- continue;
- mip2 = mip + mode_info_stride;
- build_y_mask(lfi_n, mip2[0], shift_y+8, lfm);
- break;
- case BLOCK_8X16:
- build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
- if (mi_16_col_offset +1 >= max_cols)
- continue;
- mip2 = mip + 1;
- build_y_mask(lfi_n, mip2[0], shift_y+1, lfm);
- break;
- default: {
- const int shift_y = shift_32_y[idx_32] +
- shift_16_y[idx_16] +
- shift_8_y[0];
- build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
- mip += offset[0];
- for (idx_8 = 1; idx_8 < 4; mip += offset[idx_8], ++idx_8) {
- const int shift_y = shift_32_y[idx_32] +
- shift_16_y[idx_16] +
- shift_8_y[idx_8];
- const int mi_8_col_offset = mi_16_col_offset +
- ((idx_8 & 1));
- const int mi_8_row_offset = mi_16_row_offset +
- ((idx_8 >> 1));
-
- if (mi_8_col_offset >= max_cols ||
- mi_8_row_offset >= max_rows)
- continue;
- build_y_mask(lfi_n, mip[0], shift_y, lfm);
- }
- break;
- }
- }
- }
- break;
- }
- }
- break;
- }
- // The largest loopfilter we have is 16x16 so we use the 16x16 mask
- // for 32x32 transforms also also.
- lfm->left_y[TX_16X16] |= lfm->left_y[TX_32X32];
- lfm->above_y[TX_16X16] |= lfm->above_y[TX_32X32];
- lfm->left_uv[TX_16X16] |= lfm->left_uv[TX_32X32];
- lfm->above_uv[TX_16X16] |= lfm->above_uv[TX_32X32];
-
- // We do at least 8 tap filter on every 32x32 even if the transform size
- // is 4x4. So if the 4x4 is set on a border pixel add it to the 8x8 and
- // remove it from the 4x4.
- lfm->left_y[TX_8X8] |= lfm->left_y[TX_4X4] & left_border;
- lfm->left_y[TX_4X4] &= ~left_border;
- lfm->above_y[TX_8X8] |= lfm->above_y[TX_4X4] & above_border;
- lfm->above_y[TX_4X4] &= ~above_border;
- lfm->left_uv[TX_8X8] |= lfm->left_uv[TX_4X4] & left_border_uv;
- lfm->left_uv[TX_4X4] &= ~left_border_uv;
- lfm->above_uv[TX_8X8] |= lfm->above_uv[TX_4X4] & above_border_uv;
- lfm->above_uv[TX_4X4] &= ~above_border_uv;
-
- // We do some special edge handling.
- if (mi_row + MI_BLOCK_SIZE > cm->mi_rows) {
- const uint64_t rows = cm->mi_rows - mi_row;
-
- // Each pixel inside the border gets a 1,
- const uint64_t mask_y = (((uint64_t) 1 << (rows << 3)) - 1);
- const uint16_t mask_uv = (((uint16_t) 1 << (((rows + 1) >> 1) << 2)) - 1);
-
- // Remove values completely outside our border.
- for (i = 0; i < TX_32X32; i++) {
- lfm->left_y[i] &= mask_y;
- lfm->above_y[i] &= mask_y;
- lfm->left_uv[i] &= mask_uv;
- lfm->above_uv[i] &= mask_uv;
- }
- lfm->int_4x4_y &= mask_y;
- lfm->int_4x4_uv &= mask_uv;
-
- // We don't apply a wide loop filter on the last uv block row. If set
- // apply the shorter one instead.
- if (rows == 1) {
- lfm->above_uv[TX_8X8] |= lfm->above_uv[TX_16X16];
- lfm->above_uv[TX_16X16] = 0;
- }
- if (rows == 5) {
- lfm->above_uv[TX_8X8] |= lfm->above_uv[TX_16X16] & 0xff00;
- lfm->above_uv[TX_16X16] &= ~(lfm->above_uv[TX_16X16] & 0xff00);
- }
- }
-
- if (mi_col + MI_BLOCK_SIZE > cm->mi_cols) {
- const uint64_t columns = cm->mi_cols - mi_col;
-
- // Each pixel inside the border gets a 1, the multiply copies the border
- // to where we need it.
- const uint64_t mask_y = (((1 << columns) - 1)) * 0x0101010101010101;
- const uint16_t mask_uv = ((1 << ((columns + 1) >> 1)) - 1) * 0x1111;
-
- // Internal edges are not applied on the last column of the image so
- // we mask 1 more for the internal edges
- const uint16_t mask_uv_int = ((1 << (columns >> 1)) - 1) * 0x1111;
-
- // Remove the bits outside the image edge.
- for (i = 0; i < TX_32X32; i++) {
- lfm->left_y[i] &= mask_y;
- lfm->above_y[i] &= mask_y;
- lfm->left_uv[i] &= mask_uv;
- lfm->above_uv[i] &= mask_uv;
- }
- lfm->int_4x4_y &= mask_y;
- lfm->int_4x4_uv &= mask_uv_int;
-
- // We don't apply a wide loop filter on the last uv column. If set
- // apply the shorter one instead.
- if (columns == 1) {
- lfm->left_uv[TX_8X8] |= lfm->left_uv[TX_16X16];
- lfm->left_uv[TX_16X16] = 0;
- }
- if (columns == 5) {
- lfm->left_uv[TX_8X8] |= (lfm->left_uv[TX_16X16] & 0xcccc);
- lfm->left_uv[TX_16X16] &= ~(lfm->left_uv[TX_16X16] & 0xcccc);
- }
- }
- // We don't a loop filter on the first column in the image. Mask that out.
- if (mi_col == 0) {
- for (i = 0; i < TX_32X32; i++) {
- lfm->left_y[i] &= 0xfefefefefefefefe;
- lfm->left_uv[i] &= 0xeeee;
- }
- }
-
- // Assert if we try to apply 2 different loop filters at the same position.
- assert(!(lfm->left_y[TX_16X16] & lfm->left_y[TX_8X8]));
- assert(!(lfm->left_y[TX_16X16] & lfm->left_y[TX_4X4]));
- assert(!(lfm->left_y[TX_8X8] & lfm->left_y[TX_4X4]));
- assert(!(lfm->int_4x4_y & lfm->left_y[TX_16X16]));
- assert(!(lfm->left_uv[TX_16X16]&lfm->left_uv[TX_8X8]));
- assert(!(lfm->left_uv[TX_16X16] & lfm->left_uv[TX_4X4]));
- assert(!(lfm->left_uv[TX_8X8] & lfm->left_uv[TX_4X4]));
- assert(!(lfm->int_4x4_uv & lfm->left_uv[TX_16X16]));
- assert(!(lfm->above_y[TX_16X16] & lfm->above_y[TX_8X8]));
- assert(!(lfm->above_y[TX_16X16] & lfm->above_y[TX_4X4]));
- assert(!(lfm->above_y[TX_8X8] & lfm->above_y[TX_4X4]));
- assert(!(lfm->int_4x4_y & lfm->above_y[TX_16X16]));
- assert(!(lfm->above_uv[TX_16X16] & lfm->above_uv[TX_8X8]));
- assert(!(lfm->above_uv[TX_16X16] & lfm->above_uv[TX_4X4]));
- assert(!(lfm->above_uv[TX_8X8] & lfm->above_uv[TX_4X4]));
- assert(!(lfm->int_4x4_uv & lfm->above_uv[TX_16X16]));
-}
-
-static void filter_selectively_vert(uint8_t *s, int pitch,
- unsigned int mask_16x16,
- unsigned int mask_8x8,
- unsigned int mask_4x4,
- unsigned int mask_4x4_int,
- const loop_filter_info_n *lfi_n,
- const uint8_t *lfl) {
- unsigned int mask;
-
- for (mask = mask_16x16 | mask_8x8 | mask_4x4 | mask_4x4_int;
- mask; mask >>= 1) {
- const loop_filter_thresh *lfi = lfi_n->lfthr + *lfl;
-
- if (mask & 1) {
- if (mask_16x16 & 1) {
- vp9_lpf_vertical_16(s, pitch, lfi->mblim, lfi->lim, lfi->hev_thr);
- } else if (mask_8x8 & 1) {
- vp9_lpf_vertical_8(s, pitch, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
- } else if (mask_4x4 & 1) {
- vp9_lpf_vertical_4(s, pitch, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
- }
- }
- if (mask_4x4_int & 1)
- vp9_lpf_vertical_4(s + 4, pitch, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
- s += 8;
- lfl += 1;
- mask_16x16 >>= 1;
- mask_8x8 >>= 1;
- mask_4x4 >>= 1;
- mask_4x4_int >>= 1;
- }
-}
-
-static void filter_block_plane_non420(VP9_COMMON *cm,
- struct macroblockd_plane *plane,
- MODE_INFO **mi_8x8,
- int mi_row, int mi_col) {
- const int ss_x = plane->subsampling_x;
- const int ss_y = plane->subsampling_y;
- const int row_step = 1 << ss_x;
- const int col_step = 1 << ss_y;
- const int row_step_stride = cm->mi_stride * row_step;
- struct buf_2d *const dst = &plane->dst;
- uint8_t* const dst0 = dst->buf;
- unsigned int mask_16x16[MI_BLOCK_SIZE] = {0};
- unsigned int mask_8x8[MI_BLOCK_SIZE] = {0};
- unsigned int mask_4x4[MI_BLOCK_SIZE] = {0};
- unsigned int mask_4x4_int[MI_BLOCK_SIZE] = {0};
- uint8_t lfl[MI_BLOCK_SIZE * MI_BLOCK_SIZE];
- int r, c;
-
- for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
- unsigned int mask_16x16_c = 0;
- unsigned int mask_8x8_c = 0;
- unsigned int mask_4x4_c = 0;
- unsigned int border_mask;
-
- // Determine the vertical edges that need filtering
- for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
- const MODE_INFO *mi = mi_8x8[c];
- const BLOCK_SIZE sb_type = mi[0].mbmi.sb_type;
- const int skip_this = mi[0].mbmi.skip && is_inter_block(&mi[0].mbmi);
- // left edge of current unit is block/partition edge -> no skip
- const int block_edge_left = (num_4x4_blocks_wide_lookup[sb_type] > 1) ?
- !(c & (num_8x8_blocks_wide_lookup[sb_type] - 1)) : 1;
- const int skip_this_c = skip_this && !block_edge_left;
- // top edge of current unit is block/partition edge -> no skip
- const int block_edge_above = (num_4x4_blocks_high_lookup[sb_type] > 1) ?
- !(r & (num_8x8_blocks_high_lookup[sb_type] - 1)) : 1;
- const int skip_this_r = skip_this && !block_edge_above;
- const TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV)
- ? get_uv_tx_size(&mi[0].mbmi)
- : mi[0].mbmi.tx_size;
- const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1;
- const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
-
- // Filter level can vary per MI
- if (!(lfl[(r << 3) + (c >> ss_x)] =
- get_filter_level(&cm->lf_info, &mi[0].mbmi)))
- continue;
-
- // Build masks based on the transform size of each block
- if (tx_size == TX_32X32) {
- if (!skip_this_c && ((c >> ss_x) & 3) == 0) {
- if (!skip_border_4x4_c)
- mask_16x16_c |= 1 << (c >> ss_x);
- else
- mask_8x8_c |= 1 << (c >> ss_x);
- }
- if (!skip_this_r && ((r >> ss_y) & 3) == 0) {
- if (!skip_border_4x4_r)
- mask_16x16[r] |= 1 << (c >> ss_x);
- else
- mask_8x8[r] |= 1 << (c >> ss_x);
- }
- } else if (tx_size == TX_16X16) {
- if (!skip_this_c && ((c >> ss_x) & 1) == 0) {
- if (!skip_border_4x4_c)
- mask_16x16_c |= 1 << (c >> ss_x);
- else
- mask_8x8_c |= 1 << (c >> ss_x);
- }
- if (!skip_this_r && ((r >> ss_y) & 1) == 0) {
- if (!skip_border_4x4_r)
- mask_16x16[r] |= 1 << (c >> ss_x);
- else
- mask_8x8[r] |= 1 << (c >> ss_x);
- }
- } else {
- // force 8x8 filtering on 32x32 boundaries
- if (!skip_this_c) {
- if (tx_size == TX_8X8 || ((c >> ss_x) & 3) == 0)
- mask_8x8_c |= 1 << (c >> ss_x);
- else
- mask_4x4_c |= 1 << (c >> ss_x);
- }
-
- if (!skip_this_r) {
- if (tx_size == TX_8X8 || ((r >> ss_y) & 3) == 0)
- mask_8x8[r] |= 1 << (c >> ss_x);
- else
- mask_4x4[r] |= 1 << (c >> ss_x);
- }
-
- if (!skip_this && tx_size < TX_8X8 && !skip_border_4x4_c)
- mask_4x4_int[r] |= 1 << (c >> ss_x);
- }
- }
-
- // Disable filtering on the leftmost column
- border_mask = ~(mi_col == 0);
- filter_selectively_vert(dst->buf, dst->stride,
- mask_16x16_c & border_mask,
- mask_8x8_c & border_mask,
- mask_4x4_c & border_mask,
- mask_4x4_int[r],
- &cm->lf_info, &lfl[r << 3]);
- dst->buf += 8 * dst->stride;
- mi_8x8 += row_step_stride;
- }
-
- // Now do horizontal pass
- dst->buf = dst0;
- for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
- const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
- const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
-
- unsigned int mask_16x16_r;
- unsigned int mask_8x8_r;
- unsigned int mask_4x4_r;
-
- if (mi_row + r == 0) {
- mask_16x16_r = 0;
- mask_8x8_r = 0;
- mask_4x4_r = 0;
- } else {
- mask_16x16_r = mask_16x16[r];
- mask_8x8_r = mask_8x8[r];
- mask_4x4_r = mask_4x4[r];
- }
-
- filter_selectively_horiz(dst->buf, dst->stride,
- mask_16x16_r,
- mask_8x8_r,
- mask_4x4_r,
- mask_4x4_int_r,
- &cm->lf_info, &lfl[r << 3]);
- dst->buf += 8 * dst->stride;
- }
-}
-
-void vp9_filter_block_plane(VP9_COMMON *const cm,
- struct macroblockd_plane *const plane,
- int mi_row,
- LOOP_FILTER_MASK *lfm) {
- struct buf_2d *const dst = &plane->dst;
- uint8_t* const dst0 = dst->buf;
- int r, c;
-
- if (!plane->plane_type) {
- uint64_t mask_16x16 = lfm->left_y[TX_16X16];
- uint64_t mask_8x8 = lfm->left_y[TX_8X8];
- uint64_t mask_4x4 = lfm->left_y[TX_4X4];
- uint64_t mask_4x4_int = lfm->int_4x4_y;
-
- // Vertical pass: do 2 rows at one time
- for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
- unsigned int mask_16x16_l = mask_16x16 & 0xffff;
- unsigned int mask_8x8_l = mask_8x8 & 0xffff;
- unsigned int mask_4x4_l = mask_4x4 & 0xffff;
- unsigned int mask_4x4_int_l = mask_4x4_int & 0xffff;
-
- // Disable filtering on the leftmost column
- filter_selectively_vert_row2(plane->plane_type,
- dst->buf, dst->stride,
- mask_16x16_l,
- mask_8x8_l,
- mask_4x4_l,
- mask_4x4_int_l,
- &cm->lf_info, &lfm->lfl_y[r << 3]);
-
- dst->buf += 16 * dst->stride;
- mask_16x16 >>= 16;
- mask_8x8 >>= 16;
- mask_4x4 >>= 16;
- mask_4x4_int >>= 16;
- }
-
- // Horizontal pass
- dst->buf = dst0;
- mask_16x16 = lfm->above_y[TX_16X16];
- mask_8x8 = lfm->above_y[TX_8X8];
- mask_4x4 = lfm->above_y[TX_4X4];
- mask_4x4_int = lfm->int_4x4_y;
-
- for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r++) {
- unsigned int mask_16x16_r;
- unsigned int mask_8x8_r;
- unsigned int mask_4x4_r;
-
- if (mi_row + r == 0) {
- mask_16x16_r = 0;
- mask_8x8_r = 0;
- mask_4x4_r = 0;
- } else {
- mask_16x16_r = mask_16x16 & 0xff;
- mask_8x8_r = mask_8x8 & 0xff;
- mask_4x4_r = mask_4x4 & 0xff;
- }
-
- filter_selectively_horiz(dst->buf, dst->stride,
- mask_16x16_r,
- mask_8x8_r,
- mask_4x4_r,
- mask_4x4_int & 0xff,
- &cm->lf_info, &lfm->lfl_y[r << 3]);
-
- dst->buf += 8 * dst->stride;
- mask_16x16 >>= 8;
- mask_8x8 >>= 8;
- mask_4x4 >>= 8;
- mask_4x4_int >>= 8;
- }
- } else {
- uint16_t mask_16x16 = lfm->left_uv[TX_16X16];
- uint16_t mask_8x8 = lfm->left_uv[TX_8X8];
- uint16_t mask_4x4 = lfm->left_uv[TX_4X4];
- uint16_t mask_4x4_int = lfm->int_4x4_uv;
-
- // Vertical pass: do 2 rows at one time
- for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 4) {
- if (plane->plane_type == 1) {
- for (c = 0; c < (MI_BLOCK_SIZE >> 1); c++) {
- lfm->lfl_uv[(r << 1) + c] = lfm->lfl_y[(r << 3) + (c << 1)];
- lfm->lfl_uv[((r + 2) << 1) + c] = lfm->lfl_y[((r + 2) << 3) +
- (c << 1)];
- }
- }
-
- {
- unsigned int mask_16x16_l = mask_16x16 & 0xff;
- unsigned int mask_8x8_l = mask_8x8 & 0xff;
- unsigned int mask_4x4_l = mask_4x4 & 0xff;
- unsigned int mask_4x4_int_l = mask_4x4_int & 0xff;
-
- // Disable filtering on the leftmost column
- filter_selectively_vert_row2(plane->plane_type,
- dst->buf, dst->stride,
- mask_16x16_l,
- mask_8x8_l,
- mask_4x4_l,
- mask_4x4_int_l,
- &cm->lf_info, &lfm->lfl_uv[r << 1]);
-
- dst->buf += 16 * dst->stride;
- mask_16x16 >>= 8;
- mask_8x8 >>= 8;
- mask_4x4 >>= 8;
- mask_4x4_int >>= 8;
- }
- }
-
- // Horizontal pass
- dst->buf = dst0;
- mask_16x16 = lfm->above_uv[TX_16X16];
- mask_8x8 = lfm->above_uv[TX_8X8];
- mask_4x4 = lfm->above_uv[TX_4X4];
- mask_4x4_int = lfm->int_4x4_uv;
-
- for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
- const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
- const unsigned int mask_4x4_int_r = skip_border_4x4_r ?
- 0 : (mask_4x4_int & 0xf);
- unsigned int mask_16x16_r;
- unsigned int mask_8x8_r;
- unsigned int mask_4x4_r;
-
- if (mi_row + r == 0) {
- mask_16x16_r = 0;
- mask_8x8_r = 0;
- mask_4x4_r = 0;
- } else {
- mask_16x16_r = mask_16x16 & 0xf;
- mask_8x8_r = mask_8x8 & 0xf;
- mask_4x4_r = mask_4x4 & 0xf;
- }
-
- filter_selectively_horiz(dst->buf, dst->stride,
- mask_16x16_r,
- mask_8x8_r,
- mask_4x4_r,
- mask_4x4_int_r,
- &cm->lf_info, &lfm->lfl_uv[r << 1]);
-
- dst->buf += 8 * dst->stride;
- mask_16x16 >>= 4;
- mask_8x8 >>= 4;
- mask_4x4 >>= 4;
- mask_4x4_int >>= 4;
- }
- }
-}
-
-void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer,
- VP9_COMMON *cm, MACROBLOCKD *xd,
- int start, int stop, int y_only) {
- const int num_planes = y_only ? 1 : MAX_MB_PLANE;
- int mi_row, mi_col;
- LOOP_FILTER_MASK lfm;
- int use_420 = y_only || (xd->plane[1].subsampling_y == 1 &&
- xd->plane[1].subsampling_x == 1);
-
- for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) {
- MODE_INFO **mi_8x8 = cm->mi_grid_visible + mi_row * cm->mi_stride;
-
- for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
- int plane;
-
- vp9_setup_dst_planes(xd, frame_buffer, mi_row, mi_col);
-
- // TODO(JBB): Make setup_mask work for non 420.
- if (use_420)
- vp9_setup_mask(cm, mi_row, mi_col, mi_8x8 + mi_col, cm->mi_stride,
- &lfm);
-
- for (plane = 0; plane < num_planes; ++plane) {
- if (use_420)
- vp9_filter_block_plane(cm, &xd->plane[plane], mi_row, &lfm);
- else
- filter_block_plane_non420(cm, &xd->plane[plane], mi_8x8 + mi_col,
- mi_row, mi_col);
- }
- }
- }
-}
-
-void vp9_loop_filter_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
- int frame_filter_level,
- int y_only, int partial_frame) {
- int start_mi_row, end_mi_row, mi_rows_to_filter;
- if (!frame_filter_level) return;
- start_mi_row = 0;
- mi_rows_to_filter = cm->mi_rows;
- if (partial_frame && cm->mi_rows > 8) {
- start_mi_row = cm->mi_rows >> 1;
- start_mi_row &= 0xfffffff8;
- mi_rows_to_filter = MAX(cm->mi_rows / 8, 8);
- }
- end_mi_row = start_mi_row + mi_rows_to_filter;
- vp9_loop_filter_frame_init(cm, frame_filter_level);
- vp9_loop_filter_rows(cm->frame_to_show, cm, xd,
- start_mi_row, end_mi_row,
- y_only);
-}
-
-int vp9_loop_filter_worker(void *arg1, void *arg2) {
- LFWorkerData *const lf_data = (LFWorkerData*)arg1;
- (void)arg2;
- vp9_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, &lf_data->xd,
- lf_data->start, lf_data->stop, lf_data->y_only);
- return 1;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.h
deleted file mode 100644
index 97ae9d2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_LOOPFILTER_H_
-#define VP9_COMMON_VP9_LOOPFILTER_H_
-
-#include "vpx_ports/mem.h"
-#include "./vpx_config.h"
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_seg_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_LOOP_FILTER 63
-#define MAX_SHARPNESS 7
-
-#define SIMD_WIDTH 16
-
-#define MAX_REF_LF_DELTAS 4
-#define MAX_MODE_LF_DELTAS 2
-
-struct loopfilter {
- int filter_level;
-
- int sharpness_level;
- int last_sharpness_level;
-
- uint8_t mode_ref_delta_enabled;
- uint8_t mode_ref_delta_update;
-
- // 0 = Intra, Last, GF, ARF
- signed char ref_deltas[MAX_REF_LF_DELTAS];
- signed char last_ref_deltas[MAX_REF_LF_DELTAS];
-
- // 0 = ZERO_MV, MV
- signed char mode_deltas[MAX_MODE_LF_DELTAS];
- signed char last_mode_deltas[MAX_MODE_LF_DELTAS];
-};
-
-// Need to align this structure so when it is declared and
-// passed it can be loaded into vector registers.
-typedef struct {
- DECLARE_ALIGNED(SIMD_WIDTH, uint8_t, mblim[SIMD_WIDTH]);
- DECLARE_ALIGNED(SIMD_WIDTH, uint8_t, lim[SIMD_WIDTH]);
- DECLARE_ALIGNED(SIMD_WIDTH, uint8_t, hev_thr[SIMD_WIDTH]);
-} loop_filter_thresh;
-
-typedef struct {
- loop_filter_thresh lfthr[MAX_LOOP_FILTER + 1];
- uint8_t lvl[MAX_SEGMENTS][MAX_REF_FRAMES][MAX_MODE_LF_DELTAS];
-} loop_filter_info_n;
-
-// This structure holds bit masks for all 8x8 blocks in a 64x64 region.
-// Each 1 bit represents a position in which we want to apply the loop filter.
-// Left_ entries refer to whether we apply a filter on the border to the
-// left of the block. Above_ entries refer to whether or not to apply a
-// filter on the above border. Int_ entries refer to whether or not to
-// apply borders on the 4x4 edges within the 8x8 block that each bit
-// represents.
-// Since each transform is accompanied by a potentially different type of
-// loop filter there is a different entry in the array for each transform size.
-typedef struct {
- uint64_t left_y[TX_SIZES];
- uint64_t above_y[TX_SIZES];
- uint64_t int_4x4_y;
- uint16_t left_uv[TX_SIZES];
- uint16_t above_uv[TX_SIZES];
- uint16_t int_4x4_uv;
- uint8_t lfl_y[64];
- uint8_t lfl_uv[16];
-} LOOP_FILTER_MASK;
-
-/* assorted loopfilter functions which get used elsewhere */
-struct VP9Common;
-struct macroblockd;
-struct VP9LfSyncData;
-
-// This function sets up the bit masks for the entire 64x64 region represented
-// by mi_row, mi_col.
-void vp9_setup_mask(struct VP9Common *const cm,
- const int mi_row, const int mi_col,
- MODE_INFO **mi_8x8, const int mode_info_stride,
- LOOP_FILTER_MASK *lfm);
-
-void vp9_filter_block_plane(struct VP9Common *const cm,
- struct macroblockd_plane *const plane,
- int mi_row,
- LOOP_FILTER_MASK *lfm);
-
-void vp9_loop_filter_init(struct VP9Common *cm);
-
-// Update the loop filter for the current frame.
-// This should be called before vp9_loop_filter_rows(), vp9_loop_filter_frame()
-// calls this function directly.
-void vp9_loop_filter_frame_init(struct VP9Common *cm, int default_filt_lvl);
-
-void vp9_loop_filter_frame(struct VP9Common *cm,
- struct macroblockd *mbd,
- int filter_level,
- int y_only, int partial_frame);
-
-// Apply the loop filter to [start, stop) macro block rows in frame_buffer.
-void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer,
- struct VP9Common *cm, struct macroblockd *xd,
- int start, int stop, int y_only);
-
-typedef struct LoopFilterWorkerData {
- const YV12_BUFFER_CONFIG *frame_buffer;
- struct VP9Common *cm;
- struct macroblockd xd; // TODO(jzern): most of this is unnecessary to the
- // loopfilter. the planes are necessary as their state
- // is changed during decode.
- int start;
- int stop;
- int y_only;
-
- struct VP9LfSyncData *lf_sync;
- int num_lf_workers;
-} LFWorkerData;
-
-// Operates on the rows described by LFWorkerData passed as 'arg1'.
-int vp9_loop_filter_worker(void *arg1, void *arg2);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_LOOPFILTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter_filters.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter_filters.c
deleted file mode 100644
index 25d3311..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_loopfilter_filters.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-static INLINE int8_t signed_char_clamp(int t) {
- return (int8_t)clamp(t, -128, 127);
-}
-
-// should we apply any filter at all: 11111111 yes, 00000000 no
-static INLINE int8_t filter_mask(uint8_t limit, uint8_t blimit,
- uint8_t p3, uint8_t p2,
- uint8_t p1, uint8_t p0,
- uint8_t q0, uint8_t q1,
- uint8_t q2, uint8_t q3) {
- int8_t mask = 0;
- mask |= (abs(p3 - p2) > limit) * -1;
- mask |= (abs(p2 - p1) > limit) * -1;
- mask |= (abs(p1 - p0) > limit) * -1;
- mask |= (abs(q1 - q0) > limit) * -1;
- mask |= (abs(q2 - q1) > limit) * -1;
- mask |= (abs(q3 - q2) > limit) * -1;
- mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- return ~mask;
-}
-
-static INLINE int8_t flat_mask4(uint8_t thresh,
- uint8_t p3, uint8_t p2,
- uint8_t p1, uint8_t p0,
- uint8_t q0, uint8_t q1,
- uint8_t q2, uint8_t q3) {
- int8_t mask = 0;
- mask |= (abs(p1 - p0) > thresh) * -1;
- mask |= (abs(q1 - q0) > thresh) * -1;
- mask |= (abs(p2 - p0) > thresh) * -1;
- mask |= (abs(q2 - q0) > thresh) * -1;
- mask |= (abs(p3 - p0) > thresh) * -1;
- mask |= (abs(q3 - q0) > thresh) * -1;
- return ~mask;
-}
-
-static INLINE int8_t flat_mask5(uint8_t thresh,
- uint8_t p4, uint8_t p3,
- uint8_t p2, uint8_t p1,
- uint8_t p0, uint8_t q0,
- uint8_t q1, uint8_t q2,
- uint8_t q3, uint8_t q4) {
- int8_t mask = ~flat_mask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3);
- mask |= (abs(p4 - p0) > thresh) * -1;
- mask |= (abs(q4 - q0) > thresh) * -1;
- return ~mask;
-}
-
-// is there high edge variance internal edge: 11111111 yes, 00000000 no
-static INLINE int8_t hev_mask(uint8_t thresh, uint8_t p1, uint8_t p0,
- uint8_t q0, uint8_t q1) {
- int8_t hev = 0;
- hev |= (abs(p1 - p0) > thresh) * -1;
- hev |= (abs(q1 - q0) > thresh) * -1;
- return hev;
-}
-
-static INLINE void filter4(int8_t mask, uint8_t thresh, uint8_t *op1,
- uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
- int8_t filter1, filter2;
-
- const int8_t ps1 = (int8_t) *op1 ^ 0x80;
- const int8_t ps0 = (int8_t) *op0 ^ 0x80;
- const int8_t qs0 = (int8_t) *oq0 ^ 0x80;
- const int8_t qs1 = (int8_t) *oq1 ^ 0x80;
- const uint8_t hev = hev_mask(thresh, *op1, *op0, *oq0, *oq1);
-
- // add outer taps if we have high edge variance
- int8_t filter = signed_char_clamp(ps1 - qs1) & hev;
-
- // inner taps
- filter = signed_char_clamp(filter + 3 * (qs0 - ps0)) & mask;
-
- // save bottom 3 bits so that we round one side +4 and the other +3
- // if it equals 4 we'll set to adjust by -1 to account for the fact
- // we'd round 3 the other way
- filter1 = signed_char_clamp(filter + 4) >> 3;
- filter2 = signed_char_clamp(filter + 3) >> 3;
-
- *oq0 = signed_char_clamp(qs0 - filter1) ^ 0x80;
- *op0 = signed_char_clamp(ps0 + filter2) ^ 0x80;
-
- // outer tap adjustments
- filter = ROUND_POWER_OF_TWO(filter1, 1) & ~hev;
-
- *oq1 = signed_char_clamp(qs1 - filter) ^ 0x80;
- *op1 = signed_char_clamp(ps1 + filter) ^ 0x80;
-}
-
-void vp9_lpf_horizontal_4_c(uint8_t *s, int p /* pitch */,
- const uint8_t *blimit, const uint8_t *limit,
- const uint8_t *thresh, int count) {
- int i;
-
- // 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) {
- 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];
- const int8_t mask = filter_mask(*limit, *blimit,
- p3, p2, p1, p0, q0, q1, q2, q3);
- filter4(mask, *thresh, s - 2 * p, s - 1 * p, s, s + 1 * p);
- ++s;
- }
-}
-
-void vp9_lpf_horizontal_4_dual_c(uint8_t *s, int p, const uint8_t *blimit0,
- const uint8_t *limit0, const uint8_t *thresh0,
- const uint8_t *blimit1, const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_horizontal_4_c(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_horizontal_4_c(s + 8, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_vertical_4_c(uint8_t *s, int pitch, const uint8_t *blimit,
- const uint8_t *limit, const uint8_t *thresh,
- int count) {
- int i;
-
- // 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) {
- 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 = filter_mask(*limit, *blimit,
- p3, p2, p1, p0, q0, q1, q2, q3);
- filter4(mask, *thresh, s - 2, s - 1, s, s + 1);
- s += pitch;
- }
-}
-
-void vp9_lpf_vertical_4_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0,
- const uint8_t *limit0, const uint8_t *thresh0,
- const uint8_t *blimit1, const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_vertical_4_c(s, pitch, blimit0, limit0, thresh0, 1);
- vp9_lpf_vertical_4_c(s + 8 * pitch, pitch, blimit1, limit1,
- thresh1, 1);
-}
-
-static INLINE void filter8(int8_t mask, uint8_t thresh, uint8_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) {
- if (flat && mask) {
- const uint8_t p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
- const uint8_t q0 = *oq0, q1 = *oq1, q2 = *oq2, q3 = *oq3;
-
- // 7-tap filter [1, 1, 1, 2, 1, 1, 1]
- *op2 = ROUND_POWER_OF_TWO(p3 + p3 + p3 + 2 * p2 + p1 + p0 + q0, 3);
- *op1 = ROUND_POWER_OF_TWO(p3 + p3 + p2 + 2 * p1 + p0 + q0 + q1, 3);
- *op0 = ROUND_POWER_OF_TWO(p3 + p2 + p1 + 2 * p0 + q0 + q1 + q2, 3);
- *oq0 = ROUND_POWER_OF_TWO(p2 + p1 + p0 + 2 * q0 + q1 + q2 + q3, 3);
- *oq1 = ROUND_POWER_OF_TWO(p1 + p0 + q0 + 2 * q1 + q2 + q3 + q3, 3);
- *oq2 = ROUND_POWER_OF_TWO(p0 + q0 + q1 + 2 * q2 + q3 + q3 + q3, 3);
- } else {
- filter4(mask, thresh, op1, op0, oq0, oq1);
- }
-}
-
-void vp9_lpf_horizontal_8_c(uint8_t *s, int p, const uint8_t *blimit,
- const uint8_t *limit, const uint8_t *thresh,
- int count) {
- int i;
-
- // 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) {
- 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];
-
- const int8_t mask = filter_mask(*limit, *blimit,
- p3, p2, p1, p0, q0, q1, q2, q3);
- const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
- filter8(mask, *thresh, flat, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
- s, s + 1 * p, s + 2 * p, s + 3 * p);
- ++s;
- }
-}
-
-void vp9_lpf_horizontal_8_dual_c(uint8_t *s, int p, const uint8_t *blimit0,
- const uint8_t *limit0, const uint8_t *thresh0,
- const uint8_t *blimit1, const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_horizontal_8_c(s, p, blimit0, limit0, thresh0, 1);
- vp9_lpf_horizontal_8_c(s + 8, p, blimit1, limit1, thresh1, 1);
-}
-
-void vp9_lpf_vertical_8_c(uint8_t *s, int pitch, const uint8_t *blimit,
- const uint8_t *limit, const uint8_t *thresh,
- int count) {
- int i;
-
- for (i = 0; i < 8 * 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 = filter_mask(*limit, *blimit,
- p3, p2, p1, p0, q0, q1, q2, q3);
- const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
- filter8(mask, *thresh, flat, s - 4, s - 3, s - 2, s - 1,
- s, s + 1, s + 2, s + 3);
- s += pitch;
- }
-}
-
-void vp9_lpf_vertical_8_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0,
- const uint8_t *limit0, const uint8_t *thresh0,
- const uint8_t *blimit1, const uint8_t *limit1,
- const uint8_t *thresh1) {
- vp9_lpf_vertical_8_c(s, pitch, blimit0, limit0, thresh0, 1);
- vp9_lpf_vertical_8_c(s + 8 * pitch, pitch, blimit1, limit1,
- thresh1, 1);
-}
-
-static INLINE void filter16(int8_t mask, uint8_t thresh,
- uint8_t flat, uint8_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, uint8_t *oq3,
- uint8_t *oq4, uint8_t *oq5,
- uint8_t *oq6, uint8_t *oq7) {
- if (flat2 && flat && mask) {
- const uint8_t p7 = *op7, p6 = *op6, p5 = *op5, p4 = *op4,
- p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
-
- const uint8_t q0 = *oq0, q1 = *oq1, q2 = *oq2, q3 = *oq3,
- q4 = *oq4, q5 = *oq5, q6 = *oq6, q7 = *oq7;
-
- // 15-tap filter [1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1]
- *op6 = ROUND_POWER_OF_TWO(p7 * 7 + p6 * 2 + p5 + p4 + p3 + p2 + p1 + p0 +
- q0, 4);
- *op5 = ROUND_POWER_OF_TWO(p7 * 6 + p6 + p5 * 2 + p4 + p3 + p2 + p1 + p0 +
- q0 + q1, 4);
- *op4 = ROUND_POWER_OF_TWO(p7 * 5 + p6 + p5 + p4 * 2 + p3 + p2 + p1 + p0 +
- q0 + q1 + q2, 4);
- *op3 = ROUND_POWER_OF_TWO(p7 * 4 + p6 + p5 + p4 + p3 * 2 + p2 + p1 + p0 +
- q0 + q1 + q2 + q3, 4);
- *op2 = ROUND_POWER_OF_TWO(p7 * 3 + p6 + p5 + p4 + p3 + p2 * 2 + p1 + p0 +
- q0 + q1 + q2 + q3 + q4, 4);
- *op1 = ROUND_POWER_OF_TWO(p7 * 2 + p6 + p5 + p4 + p3 + p2 + p1 * 2 + p0 +
- q0 + q1 + q2 + q3 + q4 + q5, 4);
- *op0 = ROUND_POWER_OF_TWO(p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0 * 2 +
- q0 + q1 + q2 + q3 + q4 + q5 + q6, 4);
- *oq0 = ROUND_POWER_OF_TWO(p6 + p5 + p4 + p3 + p2 + p1 + p0 +
- q0 * 2 + q1 + q2 + q3 + q4 + q5 + q6 + q7, 4);
- *oq1 = ROUND_POWER_OF_TWO(p5 + p4 + p3 + p2 + p1 + p0 +
- q0 + q1 * 2 + q2 + q3 + q4 + q5 + q6 + q7 * 2, 4);
- *oq2 = ROUND_POWER_OF_TWO(p4 + p3 + p2 + p1 + p0 +
- q0 + q1 + q2 * 2 + q3 + q4 + q5 + q6 + q7 * 3, 4);
- *oq3 = ROUND_POWER_OF_TWO(p3 + p2 + p1 + p0 +
- q0 + q1 + q2 + q3 * 2 + q4 + q5 + q6 + q7 * 4, 4);
- *oq4 = ROUND_POWER_OF_TWO(p2 + p1 + p0 +
- q0 + q1 + q2 + q3 + q4 * 2 + q5 + q6 + q7 * 5, 4);
- *oq5 = ROUND_POWER_OF_TWO(p1 + p0 +
- q0 + q1 + q2 + q3 + q4 + q5 * 2 + q6 + q7 * 6, 4);
- *oq6 = ROUND_POWER_OF_TWO(p0 +
- q0 + q1 + q2 + q3 + q4 + q5 + q6 * 2 + q7 * 7, 4);
- } else {
- filter8(mask, thresh, flat, op3, op2, op1, op0, oq0, oq1, oq2, oq3);
- }
-}
-
-void vp9_lpf_horizontal_16_c(uint8_t *s, int p, const uint8_t *blimit,
- const uint8_t *limit, const uint8_t *thresh,
- int count) {
- int i;
-
- // 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) {
- 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];
- const int8_t mask = filter_mask(*limit, *blimit,
- p3, p2, p1, p0, q0, q1, q2, q3);
- const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
- const int8_t flat2 = flat_mask5(1,
- s[-8 * p], s[-7 * p], s[-6 * p], s[-5 * p], p0,
- q0, s[4 * p], s[5 * p], s[6 * p], s[7 * p]);
-
- filter16(mask, *thresh, flat, flat2,
- s - 8 * p, s - 7 * p, s - 6 * p, s - 5 * p,
- s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
- s, s + 1 * p, s + 2 * p, s + 3 * p,
- s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
- ++s;
- }
-}
-
-static void mb_lpf_vertical_edge_w(uint8_t *s, int p,
- const uint8_t *blimit,
- const uint8_t *limit,
- const uint8_t *thresh,
- int count) {
- int 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 = filter_mask(*limit, *blimit,
- p3, p2, p1, p0, q0, q1, q2, q3);
- const int8_t flat = flat_mask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
- const int8_t flat2 = flat_mask5(1, s[-8], s[-7], s[-6], s[-5], p0,
- q0, s[4], s[5], s[6], s[7]);
-
- filter16(mask, *thresh, flat, flat2,
- s - 8, s - 7, s - 6, s - 5, s - 4, s - 3, s - 2, s - 1,
- s, s + 1, s + 2, s + 3, s + 4, s + 5, s + 6, s + 7);
- s += p;
- }
-}
-
-void vp9_lpf_vertical_16_c(uint8_t *s, int p, const uint8_t *blimit,
- const uint8_t *limit, const uint8_t *thresh) {
- mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 8);
-}
-
-void vp9_lpf_vertical_16_dual_c(uint8_t *s, int p, const uint8_t *blimit,
- const uint8_t *limit, const uint8_t *thresh) {
- mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 16);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mv.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mv.h
deleted file mode 100644
index 3eb7f9d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mv.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_MV_H_
-#define VP9_COMMON_VP9_MV_H_
-
-#include "vpx/vpx_integer.h"
-
-#include "vp9/common/vp9_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct mv {
- int16_t row;
- int16_t col;
-} MV;
-
-typedef union int_mv {
- uint32_t as_int;
- MV as_mv;
-} int_mv; /* facilitates faster equality tests and copies */
-
-typedef struct mv32 {
- int32_t row;
- int32_t col;
-} MV32;
-
-static INLINE void clamp_mv(MV *mv, int min_col, int max_col,
- int min_row, int max_row) {
- mv->col = clamp(mv->col, min_col, max_col);
- mv->row = clamp(mv->row, min_row, max_row);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_MV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.c
deleted file mode 100644
index 61682c4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.c
+++ /dev/null
@@ -1,365 +0,0 @@
-
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_mvref_common.h"
-
-#define MVREF_NEIGHBOURS 8
-
-typedef struct position {
- int row;
- int col;
-} POSITION;
-
-typedef enum {
- BOTH_ZERO = 0,
- ZERO_PLUS_PREDICTED = 1,
- BOTH_PREDICTED = 2,
- NEW_PLUS_NON_INTRA = 3,
- BOTH_NEW = 4,
- INTRA_PLUS_NON_INTRA = 5,
- BOTH_INTRA = 6,
- INVALID_CASE = 9
-} motion_vector_context;
-
-// This is used to figure out a context for the ref blocks. The code flattens
-// an array that would have 3 possible counts (0, 1 & 2) for 3 choices by
-// adding 9 for each intra block, 3 for each zero mv and 1 for each new
-// motion vector. This single number is then converted into a context
-// with a single lookup ( counter_to_context ).
-static const int mode_2_counter[MB_MODE_COUNT] = {
- 9, // DC_PRED
- 9, // V_PRED
- 9, // H_PRED
- 9, // D45_PRED
- 9, // D135_PRED
- 9, // D117_PRED
- 9, // D153_PRED
- 9, // D207_PRED
- 9, // D63_PRED
- 9, // TM_PRED
- 0, // NEARESTMV
- 0, // NEARMV
- 3, // ZEROMV
- 1, // NEWMV
-};
-
-// There are 3^3 different combinations of 3 counts that can be either 0,1 or
-// 2. However the actual count can never be greater than 2 so the highest
-// counter we need is 18. 9 is an invalid counter that's never used.
-static const int counter_to_context[19] = {
- BOTH_PREDICTED, // 0
- NEW_PLUS_NON_INTRA, // 1
- BOTH_NEW, // 2
- ZERO_PLUS_PREDICTED, // 3
- NEW_PLUS_NON_INTRA, // 4
- INVALID_CASE, // 5
- BOTH_ZERO, // 6
- INVALID_CASE, // 7
- INVALID_CASE, // 8
- INTRA_PLUS_NON_INTRA, // 9
- INTRA_PLUS_NON_INTRA, // 10
- INVALID_CASE, // 11
- INTRA_PLUS_NON_INTRA, // 12
- INVALID_CASE, // 13
- INVALID_CASE, // 14
- INVALID_CASE, // 15
- INVALID_CASE, // 16
- INVALID_CASE, // 17
- BOTH_INTRA // 18
-};
-
-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}}
-};
-
-static const int idx_n_column_to_subblock[4][2] = {
- {1, 2},
- {1, 3},
- {3, 2},
- {3, 3}
-};
-
-// clamp_mv_ref
-#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
-
-static void clamp_mv_ref(MV *mv, const MACROBLOCKD *xd) {
- clamp_mv(mv, xd->mb_to_left_edge - MV_BORDER,
- xd->mb_to_right_edge + MV_BORDER,
- xd->mb_to_top_edge - MV_BORDER,
- xd->mb_to_bottom_edge + MV_BORDER);
-}
-
-// This function returns either the appropriate sub block or block's mv
-// on whether the block_size < 8x8 and we have check_sub_blocks set.
-static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate, int which_mv,
- int search_col, int block_idx) {
- 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];
-}
-
-
-// Performs mv sign inversion if indicated by the reference frame combination.
-static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
- const MV_REFERENCE_FRAME this_ref_frame,
- const int *ref_sign_bias) {
- int_mv mv = mbmi->mv[ref];
- if (ref_sign_bias[mbmi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) {
- mv.as_mv.row *= -1;
- mv.as_mv.col *= -1;
- }
- return mv;
-}
-
-// This macro is used to add a motion vector mv_ref list if it isn't
-// already in the list. If it's the second motion vector it will also
-// skip all additional processing and jump to done!
-#define ADD_MV_REF_LIST(mv) \
- do { \
- if (refmv_count) { \
- if ((mv).as_int != mv_ref_list[0].as_int) { \
- mv_ref_list[refmv_count] = (mv); \
- goto Done; \
- } \
- } else { \
- mv_ref_list[refmv_count++] = (mv); \
- } \
- } while (0)
-
-// If either reference frame is different, not INTRA, and they
-// are different from each other scale and add the mv to our list.
-#define IF_DIFF_REF_FRAME_ADD_MV(mbmi) \
- do { \
- if (is_inter_block(mbmi)) { \
- if ((mbmi)->ref_frame[0] != ref_frame) \
- ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias)); \
- if (has_second_ref(mbmi) && \
- (mbmi)->ref_frame[1] != ref_frame && \
- (mbmi)->mv[1].as_int != (mbmi)->mv[0].as_int) \
- ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias)); \
- } \
- } while (0)
-
-
-// Checks that the given mi_row, mi_col and search point
-// are inside the borders of the tile.
-static INLINE int is_inside(const TileInfo *const tile,
- int mi_col, int mi_row, int mi_rows,
- const POSITION *mi_pos) {
- return !(mi_row + mi_pos->row < 0 ||
- mi_col + mi_pos->col < tile->mi_col_start ||
- mi_row + mi_pos->row >= mi_rows ||
- mi_col + mi_pos->col >= tile->mi_col_end);
-}
-
-// This function searches the neighbourhood of a given MB/SB
-// to try and find candidate reference vectors.
-static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
- const TileInfo *const tile,
- MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
- int_mv *mv_ref_list,
- int block, int mi_row, int mi_col) {
- const int *ref_sign_bias = cm->ref_frame_sign_bias;
- int i, refmv_count = 0;
- const MODE_INFO *prev_mi = cm->coding_use_prev_mi && cm->prev_mi
- ? cm->prev_mi_grid_visible[mi_row * xd->mi_stride + mi_col]
- : NULL;
- const MB_MODE_INFO *const prev_mbmi = prev_mi ? &prev_mi->mbmi : NULL;
-
-
- const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type];
-
- int different_ref_found = 0;
- int context_counter = 0;
-
- // Blank the reference vector list
- vpx_memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES);
-
- // The nearest 2 blocks are treated differently
- // if the size < 8x8 we get the mv from the bmi substructure,
- // and we also need to keep a mode count.
- for (i = 0; i < 2; ++i) {
- const POSITION *const mv_ref = &mv_ref_search[i];
- if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
- const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row *
- xd->mi_stride];
- const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
- // Keep counts for entropy encoding.
- context_counter += mode_2_counter[candidate->mode];
- different_ref_found = 1;
-
- if (candidate->ref_frame[0] == ref_frame)
- ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, block));
- else if (candidate->ref_frame[1] == ref_frame)
- ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 1, mv_ref->col, block));
- }
- }
-
- // Check the rest of the neighbors in much the same way
- // as before except we don't need to keep track of sub blocks or
- // mode counts.
- for (; i < MVREF_NEIGHBOURS; ++i) {
- const POSITION *const mv_ref = &mv_ref_search[i];
- if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
- const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row *
- xd->mi_stride]->mbmi;
- different_ref_found = 1;
-
- if (candidate->ref_frame[0] == ref_frame)
- ADD_MV_REF_LIST(candidate->mv[0]);
- else if (candidate->ref_frame[1] == ref_frame)
- ADD_MV_REF_LIST(candidate->mv[1]);
- }
- }
-
- // Check the last frame's mode and mv info.
- if (prev_mbmi) {
- if (prev_mbmi->ref_frame[0] == ref_frame)
- ADD_MV_REF_LIST(prev_mbmi->mv[0]);
- else if (prev_mbmi->ref_frame[1] == ref_frame)
- ADD_MV_REF_LIST(prev_mbmi->mv[1]);
- }
-
- // Since we couldn't find 2 mvs from the same reference frame
- // go back through the neighbors and find motion vectors from
- // different reference frames.
- if (different_ref_found) {
- for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
- const POSITION *mv_ref = &mv_ref_search[i];
- if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
- const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row
- * xd->mi_stride]->mbmi;
-
- // If the candidate is INTRA we don't want to consider its mv.
- IF_DIFF_REF_FRAME_ADD_MV(candidate);
- }
- }
- }
-
- // Since we still don't have a candidate we'll try the last frame.
- if (prev_mbmi)
- IF_DIFF_REF_FRAME_ADD_MV(prev_mbmi);
-
- Done:
-
- mi->mbmi.mode_context[ref_frame] = counter_to_context[context_counter];
-
- // Clamp vectors
- for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i)
- clamp_mv_ref(&mv_ref_list[i].as_mv, xd);
-}
-
-void vp9_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
- const TileInfo *const tile,
- MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
- int_mv *mv_ref_list,
- int mi_row, int mi_col) {
- find_mv_refs_idx(cm, xd, tile, mi, ref_frame, mv_ref_list, -1,
- mi_row, mi_col);
-}
-
-static void lower_mv_precision(MV *mv, int allow_hp) {
- const int use_hp = allow_hp && vp9_use_mv_hp(mv);
- if (!use_hp) {
- if (mv->row & 1)
- mv->row += (mv->row > 0 ? -1 : 1);
- if (mv->col & 1)
- mv->col += (mv->col > 0 ? -1 : 1);
- }
-}
-
-
-void vp9_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
- int_mv *mvlist, int_mv *nearest, int_mv *near) {
- int i;
- // Make sure all the candidates are properly clamped etc
- for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- lower_mv_precision(&mvlist[i].as_mv, allow_hp);
- clamp_mv2(&mvlist[i].as_mv, xd);
- }
- *nearest = mvlist[0];
- *near = mvlist[1];
-}
-
-void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
- const TileInfo *const tile,
- int block, int ref, int mi_row, int mi_col,
- int_mv *nearest, int_mv *near) {
- int_mv mv_list[MAX_MV_REF_CANDIDATES];
- MODE_INFO *const mi = xd->mi[0];
- b_mode_info *bmi = mi->bmi;
- int n;
-
- assert(MAX_MV_REF_CANDIDATES == 2);
-
- find_mv_refs_idx(cm, xd, tile, mi, mi->mbmi.ref_frame[ref], mv_list, block,
- mi_row, mi_col);
-
- near->as_int = 0;
- switch (block) {
- case 0:
- nearest->as_int = mv_list[0].as_int;
- near->as_int = mv_list[1].as_int;
- break;
- case 1:
- case 2:
- nearest->as_int = bmi[0].as_mv[ref].as_int;
- for (n = 0; n < MAX_MV_REF_CANDIDATES; ++n)
- if (nearest->as_int != mv_list[n].as_int) {
- near->as_int = mv_list[n].as_int;
- break;
- }
- break;
- case 3: {
- int_mv candidates[2 + MAX_MV_REF_CANDIDATES];
- candidates[0] = bmi[1].as_mv[ref];
- candidates[1] = bmi[0].as_mv[ref];
- candidates[2] = mv_list[0];
- candidates[3] = mv_list[1];
-
- nearest->as_int = bmi[2].as_mv[ref].as_int;
- for (n = 0; n < 2 + MAX_MV_REF_CANDIDATES; ++n)
- if (nearest->as_int != candidates[n].as_int) {
- near->as_int = candidates[n].as_int;
- break;
- }
- break;
- }
- default:
- assert("Invalid block index.");
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.h
deleted file mode 100644
index 903ac02..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_mvref_common.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
-#define VP9_COMMON_VP9_MVREF_COMMON_H_
-
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LEFT_TOP_MARGIN ((VP9_ENC_BORDER_IN_PIXELS - VP9_INTERP_EXTEND) << 3)
-#define RIGHT_BOTTOM_MARGIN ((VP9_ENC_BORDER_IN_PIXELS -\
- VP9_INTERP_EXTEND) << 3)
-
-// TODO(jingning): this mv clamping function should be block size dependent.
-static INLINE void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
- clamp_mv(mv, xd->mb_to_left_edge - LEFT_TOP_MARGIN,
- xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
- xd->mb_to_top_edge - LEFT_TOP_MARGIN,
- xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
-}
-
-void vp9_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
- const TileInfo *const tile,
- MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
- int_mv *mv_ref_list, int mi_row, int mi_col);
-
-// check a list of motion vectors by sad score using a number rows of pixels
-// above and a number cols of pixels in the left to select the one with best
-// score to use as ref motion vector
-void vp9_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
- int_mv *mvlist, int_mv *nearest, int_mv *near);
-
-void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
- const TileInfo *const tile,
- int block, int ref, int mi_row, int mi_col,
- int_mv *nearest, int_mv *near);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_MVREF_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_onyxc_int.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_onyxc_int.h
deleted file mode 100644
index ea1b885..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_onyxc_int.h
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_ONYXC_INT_H_
-#define VP9_COMMON_VP9_ONYXC_INT_H_
-
-#include "./vpx_config.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_entropymv.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_frame_buffers.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_tile_common.h"
-
-#if CONFIG_VP9_POSTPROC
-#include "vp9/common/vp9_postproc.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define REFS_PER_FRAME 3
-
-#define REF_FRAMES_LOG2 3
-#define REF_FRAMES (1 << REF_FRAMES_LOG2)
-
-// 1 scratch frame for the new frame, 3 for scaled references on the encoder
-// TODO(jkoleszar): These 3 extra references could probably come from the
-// normal reference pool.
-#define FRAME_BUFFERS (REF_FRAMES + 4)
-
-#define FRAME_CONTEXTS_LOG2 2
-#define FRAME_CONTEXTS (1 << FRAME_CONTEXTS_LOG2)
-
-extern const struct {
- PARTITION_CONTEXT above;
- PARTITION_CONTEXT left;
-} partition_context_lookup[BLOCK_SIZES];
-
-
-typedef enum {
- SINGLE_REFERENCE = 0,
- COMPOUND_REFERENCE = 1,
- REFERENCE_MODE_SELECT = 2,
- REFERENCE_MODES = 3,
-} REFERENCE_MODE;
-
-
-typedef struct {
- int ref_count;
- vpx_codec_frame_buffer_t raw_frame_buffer;
- YV12_BUFFER_CONFIG buf;
-} RefCntBuffer;
-
-typedef struct VP9Common {
- struct vpx_internal_error_info error;
-
- DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]);
-#if CONFIG_ALPHA
- DECLARE_ALIGNED(16, int16_t, a_dequant[QINDEX_RANGE][8]);
-#endif
-
- COLOR_SPACE color_space;
-
- int width;
- int height;
- int display_width;
- int display_height;
- int last_width;
- int last_height;
-
- // 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.
- int subsampling_x;
- int subsampling_y;
-
- YV12_BUFFER_CONFIG *frame_to_show;
-
- RefCntBuffer frame_bufs[FRAME_BUFFERS];
-
- int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */
-
- // TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and
- // roll new_fb_idx into it.
-
- // Each frame can reference REFS_PER_FRAME buffers
- RefBuffer frame_refs[REFS_PER_FRAME];
-
- int new_fb_idx;
-
- YV12_BUFFER_CONFIG post_proc_buffer;
-
- FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/
- FRAME_TYPE frame_type;
-
- int show_frame;
- int last_show_frame;
- int show_existing_frame;
-
- // Flag signaling that the frame is encoded using only INTRA modes.
- int intra_only;
-
- int allow_high_precision_mv;
-
- // Flag signaling that the frame context should be reset to default values.
- // 0 or 1 implies don't reset, 2 reset just the context specified in the
- // frame header, 3 reset all contexts.
- int reset_frame_context;
-
- int frame_flags;
- // MBs, mb_rows/cols is in 16-pixel units; mi_rows/cols is in
- // MODE_INFO (8-pixel) units.
- int MBs;
- int mb_rows, mi_rows;
- int mb_cols, mi_cols;
- int mi_stride;
-
- /* profile settings */
- TX_MODE tx_mode;
-
- int base_qindex;
- int y_dc_delta_q;
- int uv_dc_delta_q;
- int uv_ac_delta_q;
-#if CONFIG_ALPHA
- int a_dc_delta_q;
- int a_ac_delta_q;
-#endif
-
- /* We allocate a MODE_INFO struct for each macroblock, together with
- an extra row on top and column on the left to simplify prediction. */
-
- MODE_INFO *mip; /* Base of allocated array */
- MODE_INFO *mi; /* Corresponds to upper left visible macroblock */
- MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */
- MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
-
- MODE_INFO **mi_grid_base;
- MODE_INFO **mi_grid_visible;
- MODE_INFO **prev_mi_grid_base;
- MODE_INFO **prev_mi_grid_visible;
-
- // Persistent mb segment id map used in prediction.
- unsigned char *last_frame_seg_map;
-
- INTERP_FILTER interp_filter;
-
- loop_filter_info_n lf_info;
-
- int refresh_frame_context; /* Two state 0 = NO, 1 = YES */
-
- int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */
-
- struct loopfilter lf;
- struct segmentation seg;
-
- // Context probabilities for reference frame prediction
- int allow_comp_inter_inter;
- MV_REFERENCE_FRAME comp_fixed_ref;
- MV_REFERENCE_FRAME comp_var_ref[2];
- REFERENCE_MODE reference_mode;
-
- FRAME_CONTEXT fc; /* this frame entropy */
- FRAME_CONTEXT frame_contexts[FRAME_CONTEXTS];
- unsigned int frame_context_idx; /* Context to use/update */
- FRAME_COUNTS counts;
-
- unsigned int current_video_frame;
- int version;
-
-#if CONFIG_VP9_POSTPROC
- struct postproc_state postproc_state;
-#endif
-
- int error_resilient_mode;
- int frame_parallel_decoding_mode;
-
- // Flag indicates if prev_mi can be used in coding:
- // 0: encoder assumes decoder does not have prev_mi
- // 1: encoder assumes decoder has and uses prev_mi
- unsigned int coding_use_prev_mi;
-
- int log2_tile_cols, log2_tile_rows;
-
- // Private data associated with the frame buffer callbacks.
- void *cb_priv;
- vpx_get_frame_buffer_cb_fn_t get_fb_cb;
- vpx_release_frame_buffer_cb_fn_t release_fb_cb;
-
- // Handles memory for the codec.
- InternalFrameBufferList int_frame_buffers;
-
- PARTITION_CONTEXT *above_seg_context;
- ENTROPY_CONTEXT *above_context;
-} VP9_COMMON;
-
-static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) {
- return &cm->frame_bufs[cm->new_fb_idx].buf;
-}
-
-static INLINE int get_free_fb(VP9_COMMON *cm) {
- int i;
- for (i = 0; i < FRAME_BUFFERS; i++)
- if (cm->frame_bufs[i].ref_count == 0)
- break;
-
- assert(i < FRAME_BUFFERS);
- cm->frame_bufs[i].ref_count = 1;
- return i;
-}
-
-static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) {
- const int ref_index = *idx;
-
- if (ref_index >= 0 && bufs[ref_index].ref_count > 0)
- bufs[ref_index].ref_count--;
-
- *idx = new_idx;
-
- bufs[new_idx].ref_count++;
-}
-
-static INLINE int mi_cols_aligned_to_sb(int n_mis) {
- return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2);
-}
-
-static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) {
- int i;
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- xd->plane[i].dqcoeff = xd->dqcoeff[i];
- xd->above_context[i] = cm->above_context +
- i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols);
- }
-
- xd->above_seg_context = cm->above_seg_context;
- xd->mi_stride = cm->mi_stride;
-}
-
-static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm,
- int ctx) {
- return cm->frame_type == KEY_FRAME ? vp9_kf_partition_probs[ctx]
- : cm->fc.partition_prob[ctx];
-}
-
-static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
- const int above_idx = mi_col * 2;
- const int left_idx = (mi_row * 2) & 15;
- int i;
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- struct macroblockd_plane *const pd = &xd->plane[i];
- pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x];
- pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y];
- }
-}
-
-static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
- int mi_row, int bh,
- int mi_col, int bw,
- int mi_rows, int mi_cols) {
- xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
- xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8;
- xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8);
- xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8;
-
- // Are edges available for intra prediction?
- xd->up_available = (mi_row != 0);
- xd->left_available = (mi_col > tile->mi_col_start);
-}
-
-static INLINE void set_prev_mi(VP9_COMMON *cm) {
- const int use_prev_in_find_mv_refs = cm->width == cm->last_width &&
- cm->height == cm->last_height &&
- !cm->intra_only &&
- cm->last_show_frame;
- // Special case: set prev_mi to NULL when the previous mode info
- // context cannot be used.
- cm->prev_mi = use_prev_in_find_mv_refs ?
- cm->prev_mip + cm->mi_stride + 1 : NULL;
-}
-
-static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) {
- return cm->frame_type == KEY_FRAME || cm->intra_only;
-}
-
-static INLINE void update_partition_context(MACROBLOCKD *xd,
- int mi_row, int mi_col,
- BLOCK_SIZE subsize,
- BLOCK_SIZE bsize) {
- PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col;
- PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
-
- // num_4x4_blocks_wide_lookup[bsize] / 2
- const int bs = num_8x8_blocks_wide_lookup[bsize];
-
- // update the partition context at the end notes. set partition bits
- // of block sizes larger than the current one to be one, and partition
- // bits of smaller block sizes to be zero.
- vpx_memset(above_ctx, partition_context_lookup[subsize].above, bs);
- vpx_memset(left_ctx, partition_context_lookup[subsize].left, bs);
-}
-
-static INLINE int partition_plane_context(const MACROBLOCKD *xd,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col;
- const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
-
- const int bsl = mi_width_log2(bsize);
- const int bs = 1 << bsl;
- int above = 0, left = 0, i;
-
- assert(b_width_log2(bsize) == b_height_log2(bsize));
- assert(bsl >= 0);
-
- for (i = 0; i < bs; i++) {
- above |= above_ctx[i];
- left |= left_ctx[i];
- }
- above = (above & bs) > 0;
- left = (left & bs) > 0;
-
- return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_ONYXC_INT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.c
deleted file mode 100644
index 7baa9ee..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "./vpx_scale_rtcd.h"
-#include "./vp9_rtcd.h"
-
-#include "vpx_scale/vpx_scale.h"
-#include "vpx_scale/yv12config.h"
-
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_postproc.h"
-#include "vp9/common/vp9_systemdependent.h"
-#include "vp9/common/vp9_textblit.h"
-
-#define RGB_TO_YUV(t) \
- ( (0.257*(float)(t >> 16)) + (0.504*(float)(t >> 8 & 0xff)) + \
- (0.098*(float)(t & 0xff)) + 16), \
- (-(0.148*(float)(t >> 16)) - (0.291*(float)(t >> 8 & 0xff)) + \
- (0.439*(float)(t & 0xff)) + 128), \
- ( (0.439*(float)(t >> 16)) - (0.368*(float)(t >> 8 & 0xff)) - \
- (0.071*(float)(t & 0xff)) + 128)
-
-/* global constants */
-#if 0 && CONFIG_POSTPROC_VISUALIZER
-static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] = {
- { RGB_TO_YUV(0x98FB98) }, /* PaleGreen */
- { RGB_TO_YUV(0x00FF00) }, /* Green */
- { RGB_TO_YUV(0xADFF2F) }, /* GreenYellow */
- { RGB_TO_YUV(0x8F0000) }, /* Dark Red */
- { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */
- { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */
- { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */
- { RGB_TO_YUV(0x8F0000) }, /* Dark Red */
- { RGB_TO_YUV(0x8F0000) }, /* Dark Red */
- { RGB_TO_YUV(0x228B22) }, /* ForestGreen */
- { RGB_TO_YUV(0x006400) }, /* DarkGreen */
- { RGB_TO_YUV(0x98F5FF) }, /* Cadet Blue */
- { RGB_TO_YUV(0x6CA6CD) }, /* Sky Blue */
- { RGB_TO_YUV(0x00008B) }, /* Dark blue */
- { RGB_TO_YUV(0x551A8B) }, /* Purple */
- { RGB_TO_YUV(0xFF0000) } /* Red */
- { RGB_TO_YUV(0xCC33FF) }, /* Magenta */
-};
-
-static const unsigned char B_PREDICTION_MODE_colors[INTRA_MODES][3] = {
- { RGB_TO_YUV(0x6633ff) }, /* Purple */
- { RGB_TO_YUV(0xcc33ff) }, /* Magenta */
- { RGB_TO_YUV(0xff33cc) }, /* Pink */
- { RGB_TO_YUV(0xff3366) }, /* Coral */
- { RGB_TO_YUV(0x3366ff) }, /* Blue */
- { RGB_TO_YUV(0xed00f5) }, /* Dark Blue */
- { RGB_TO_YUV(0x2e00b8) }, /* Dark Purple */
- { RGB_TO_YUV(0xff6633) }, /* Orange */
- { RGB_TO_YUV(0x33ccff) }, /* Light Blue */
- { RGB_TO_YUV(0x8ab800) }, /* Green */
- { RGB_TO_YUV(0xffcc33) }, /* Light Orange */
- { RGB_TO_YUV(0x33ffcc) }, /* Aqua */
- { RGB_TO_YUV(0x66ff33) }, /* Light Green */
- { RGB_TO_YUV(0xccff33) }, /* Yellow */
-};
-
-static const unsigned char MV_REFERENCE_FRAME_colors[MAX_REF_FRAMES][3] = {
- { RGB_TO_YUV(0x00ff00) }, /* Blue */
- { RGB_TO_YUV(0x0000ff) }, /* Green */
- { RGB_TO_YUV(0xffff00) }, /* Yellow */
- { RGB_TO_YUV(0xff0000) }, /* Red */
-};
-#endif
-
-static const short kernel5[] = {
- 1, 1, 4, 1, 1
-};
-
-const short vp9_rv[] = {
- 8, 5, 2, 2, 8, 12, 4, 9, 8, 3,
- 0, 3, 9, 0, 0, 0, 8, 3, 14, 4,
- 10, 1, 11, 14, 1, 14, 9, 6, 12, 11,
- 8, 6, 10, 0, 0, 8, 9, 0, 3, 14,
- 8, 11, 13, 4, 2, 9, 0, 3, 9, 6,
- 1, 2, 3, 14, 13, 1, 8, 2, 9, 7,
- 3, 3, 1, 13, 13, 6, 6, 5, 2, 7,
- 11, 9, 11, 8, 7, 3, 2, 0, 13, 13,
- 14, 4, 12, 5, 12, 10, 8, 10, 13, 10,
- 4, 14, 4, 10, 0, 8, 11, 1, 13, 7,
- 7, 14, 6, 14, 13, 2, 13, 5, 4, 4,
- 0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
- 8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
- 3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
- 3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
- 13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
- 5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
- 9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
- 4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
- 3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
- 11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
- 5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
- 0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
- 10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
- 4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
- 0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
- 8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
- 3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
- 3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
- 13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
- 5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
- 9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
- 4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
- 3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
- 11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
- 5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
- 0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
- 10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
- 4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
- 3, 8, 3, 7, 8, 5, 11, 4, 12, 3,
- 11, 9, 14, 8, 14, 13, 4, 3, 1, 2,
- 14, 6, 5, 4, 4, 11, 4, 6, 2, 1,
- 5, 8, 8, 12, 13, 5, 14, 10, 12, 13,
- 0, 9, 5, 5, 11, 10, 13, 9, 10, 13,
-};
-
-void vp9_post_proc_down_and_across_c(const uint8_t *src_ptr,
- uint8_t *dst_ptr,
- int src_pixels_per_line,
- int dst_pixels_per_line,
- int rows,
- int cols,
- int flimit) {
- uint8_t const *p_src;
- uint8_t *p_dst;
- int row;
- int col;
- int i;
- int v;
- int pitch = src_pixels_per_line;
- uint8_t d[8];
- (void)dst_pixels_per_line;
-
- for (row = 0; row < rows; row++) {
- /* post_proc_down for one row */
- p_src = src_ptr;
- p_dst = dst_ptr;
-
- for (col = 0; col < cols; col++) {
- int kernel = 4;
- int v = p_src[col];
-
- for (i = -2; i <= 2; i++) {
- if (abs(v - p_src[col + i * pitch]) > flimit)
- goto down_skip_convolve;
-
- kernel += kernel5[2 + i] * p_src[col + i * pitch];
- }
-
- v = (kernel >> 3);
- down_skip_convolve:
- p_dst[col] = v;
- }
-
- /* now post_proc_across */
- p_src = dst_ptr;
- p_dst = dst_ptr;
-
- for (i = 0; i < 8; i++)
- d[i] = p_src[i];
-
- for (col = 0; col < cols; col++) {
- int kernel = 4;
- v = p_src[col];
-
- d[col & 7] = v;
-
- for (i = -2; i <= 2; i++) {
- if (abs(v - p_src[col + i]) > flimit)
- goto across_skip_convolve;
-
- kernel += kernel5[2 + i] * p_src[col + i];
- }
-
- d[col & 7] = (kernel >> 3);
- across_skip_convolve:
-
- if (col >= 2)
- p_dst[col - 2] = d[(col - 2) & 7];
- }
-
- /* handle the last two pixels */
- p_dst[col - 2] = d[(col - 2) & 7];
- p_dst[col - 1] = d[(col - 1) & 7];
-
-
- /* next row */
- src_ptr += pitch;
- dst_ptr += pitch;
- }
-}
-
-static int q2mbl(int x) {
- if (x < 20) x = 20;
-
- x = 50 + (x - 50) * 10 / 8;
- return x * x / 3;
-}
-
-void vp9_mbpost_proc_across_ip_c(uint8_t *src, int pitch,
- int rows, int cols, int flimit) {
- int r, c, i;
-
- uint8_t *s = src;
- uint8_t d[16];
-
-
- for (r = 0; r < rows; r++) {
- int sumsq = 0;
- int sum = 0;
-
- for (i = -8; i <= 6; i++) {
- sumsq += s[i] * s[i];
- sum += s[i];
- d[i + 8] = 0;
- }
-
- for (c = 0; c < cols + 8; c++) {
- int x = s[c + 7] - s[c - 8];
- int y = s[c + 7] + s[c - 8];
-
- sum += x;
- sumsq += x * y;
-
- d[c & 15] = s[c];
-
- if (sumsq * 15 - sum * sum < flimit) {
- d[c & 15] = (8 + sum + s[c]) >> 4;
- }
-
- s[c - 8] = d[(c - 8) & 15];
- }
-
- s += pitch;
- }
-}
-
-void vp9_mbpost_proc_down_c(uint8_t *dst, int pitch,
- int rows, int cols, int flimit) {
- int r, c, i;
- const short *rv3 = &vp9_rv[63 & rand()]; // NOLINT
-
- for (c = 0; c < cols; c++) {
- uint8_t *s = &dst[c];
- int sumsq = 0;
- int sum = 0;
- uint8_t d[16];
- const short *rv2 = rv3 + ((c * 17) & 127);
-
- for (i = -8; i <= 6; i++) {
- sumsq += s[i * pitch] * s[i * pitch];
- sum += s[i * pitch];
- }
-
- for (r = 0; r < rows + 8; r++) {
- sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch];
- sum += s[7 * pitch] - s[-8 * pitch];
- d[r & 15] = s[0];
-
- if (sumsq * 15 - sum * sum < flimit) {
- d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4;
- }
-
- s[-8 * pitch] = d[(r - 8) & 15];
- s += pitch;
- }
- }
-}
-
-static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
- int flag) {
- double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
- int ppl = (int)(level + .5);
- (void) low_var_thresh;
- (void) flag;
-
- vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer,
- source->y_stride, post->y_stride,
- source->y_height, source->y_width, ppl);
-
- vp9_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
- post->y_width, q2mbl(q));
-
- vp9_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
- post->y_width, q2mbl(q));
-
- vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer,
- source->uv_stride, post->uv_stride,
- source->uv_height, source->uv_width, ppl);
- vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer,
- source->uv_stride, post->uv_stride,
- source->uv_height, source->uv_width, ppl);
-}
-
-void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
- int q) {
- const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
- + 0.0065 + 0.5);
- int i;
-
- const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
- src->alpha_buffer};
- const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
- src->alpha_stride};
- const int src_widths[4] = {src->y_width, src->uv_width, src->uv_width,
- src->alpha_width};
- const int src_heights[4] = {src->y_height, src->uv_height, src->uv_height,
- src->alpha_height};
-
- uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer,
- dst->alpha_buffer};
- const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride,
- dst->alpha_stride};
-
- for (i = 0; i < MAX_MB_PLANE; ++i)
- vp9_post_proc_down_and_across(srcs[i], dsts[i],
- src_strides[i], dst_strides[i],
- src_heights[i], src_widths[i], ppl);
-}
-
-void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
- int q) {
- const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
- + 0.0065 + 0.5);
- int i;
-
- const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
- src->alpha_buffer};
- const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
- src->alpha_stride};
- const int src_widths[4] = {src->y_width, src->uv_width, src->uv_width,
- src->alpha_width};
- const int src_heights[4] = {src->y_height, src->uv_height, src->uv_height,
- src->alpha_height};
-
- uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer,
- dst->alpha_buffer};
- const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride,
- dst->alpha_stride};
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- const int src_stride = src_strides[i];
- const uint8_t *const src = srcs[i] + 2 * src_stride + 2;
- const int src_width = src_widths[i] - 4;
- const int src_height = src_heights[i] - 4;
-
- const int dst_stride = dst_strides[i];
- uint8_t *const dst = dsts[i] + 2 * dst_stride + 2;
-
- vp9_post_proc_down_and_across(src, dst, src_stride, dst_stride,
- src_height, src_width, ppl);
- }
-}
-
-static double gaussian(double sigma, double mu, double x) {
- return 1 / (sigma * sqrt(2.0 * 3.14159265)) *
- (exp(-(x - mu) * (x - mu) / (2 * sigma * sigma)));
-}
-
-static void fillrd(struct postproc_state *state, int q, int a) {
- char char_dist[300];
-
- double sigma;
- int ai = a, qi = q, i;
-
- vp9_clear_system_state();
-
- sigma = ai + .5 + .6 * (63 - qi) / 63.0;
-
- /* set up a lookup table of 256 entries that matches
- * a gaussian distribution with sigma determined by q.
- */
- {
- double i;
- int next, j;
-
- next = 0;
-
- for (i = -32; i < 32; i++) {
- int a = (int)(0.5 + 256 * gaussian(sigma, 0, i));
-
- if (a) {
- for (j = 0; j < a; j++) {
- char_dist[next + j] = (char) i;
- }
-
- next = next + j;
- }
- }
-
- for (; next < 256; next++)
- char_dist[next] = 0;
- }
-
- for (i = 0; i < 3072; i++) {
- state->noise[i] = char_dist[rand() & 0xff]; // NOLINT
- }
-
- for (i = 0; i < 16; i++) {
- state->blackclamp[i] = -char_dist[0];
- state->whiteclamp[i] = -char_dist[0];
- state->bothclamp[i] = -2 * char_dist[0];
- }
-
- state->last_q = q;
- state->last_noise = a;
-}
-
-void vp9_plane_add_noise_c(uint8_t *start, char *noise,
- char blackclamp[16],
- char whiteclamp[16],
- char bothclamp[16],
- unsigned int width, unsigned int height, int pitch) {
- unsigned int i, j;
-
- for (i = 0; i < height; i++) {
- uint8_t *pos = start + i * pitch;
- char *ref = (char *)(noise + (rand() & 0xff)); // NOLINT
-
- for (j = 0; j < width; j++) {
- if (pos[j] < blackclamp[0])
- pos[j] = blackclamp[0];
-
- if (pos[j] > 255 + whiteclamp[0])
- pos[j] = 255 + whiteclamp[0];
-
- pos[j] += ref[j];
- }
- }
-}
-
-/* Blend the macro block with a solid colored square. Leave the
- * edges unblended to give distinction to macro blocks in areas
- * filled with the same color block.
- */
-void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v,
- int y1, int u1, int v1, int alpha, int stride) {
- int i, j;
- int y1_const = y1 * ((1 << 16) - alpha);
- int u1_const = u1 * ((1 << 16) - alpha);
- int v1_const = v1 * ((1 << 16) - alpha);
-
- y += 2 * stride + 2;
- for (i = 0; i < 12; i++) {
- for (j = 0; j < 12; j++) {
- y[j] = (y[j] * alpha + y1_const) >> 16;
- }
- y += stride;
- }
-
- stride >>= 1;
-
- u += stride + 1;
- v += stride + 1;
-
- for (i = 0; i < 6; i++) {
- for (j = 0; j < 6; j++) {
- u[j] = (u[j] * alpha + u1_const) >> 16;
- v[j] = (v[j] * alpha + v1_const) >> 16;
- }
- u += stride;
- v += stride;
- }
-}
-
-/* Blend only the edge of the macro block. Leave center
- * unblended to allow for other visualizations to be layered.
- */
-void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v,
- int y1, int u1, int v1, int alpha, int stride) {
- int i, j;
- int y1_const = y1 * ((1 << 16) - alpha);
- int u1_const = u1 * ((1 << 16) - alpha);
- int v1_const = v1 * ((1 << 16) - alpha);
-
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 16; j++) {
- y[j] = (y[j] * alpha + y1_const) >> 16;
- }
- y += stride;
- }
-
- for (i = 0; i < 12; i++) {
- y[0] = (y[0] * alpha + y1_const) >> 16;
- y[1] = (y[1] * alpha + y1_const) >> 16;
- y[14] = (y[14] * alpha + y1_const) >> 16;
- y[15] = (y[15] * alpha + y1_const) >> 16;
- y += stride;
- }
-
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 16; j++) {
- y[j] = (y[j] * alpha + y1_const) >> 16;
- }
- y += stride;
- }
-
- stride >>= 1;
-
- for (j = 0; j < 8; j++) {
- u[j] = (u[j] * alpha + u1_const) >> 16;
- v[j] = (v[j] * alpha + v1_const) >> 16;
- }
- u += stride;
- v += stride;
-
- for (i = 0; i < 6; i++) {
- u[0] = (u[0] * alpha + u1_const) >> 16;
- v[0] = (v[0] * alpha + v1_const) >> 16;
-
- u[7] = (u[7] * alpha + u1_const) >> 16;
- v[7] = (v[7] * alpha + v1_const) >> 16;
-
- u += stride;
- v += stride;
- }
-
- for (j = 0; j < 8; j++) {
- u[j] = (u[j] * alpha + u1_const) >> 16;
- v[j] = (v[j] * alpha + v1_const) >> 16;
- }
-}
-
-void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v,
- int y1, int u1, int v1, int alpha, int stride) {
- int i, j;
- int y1_const = y1 * ((1 << 16) - alpha);
- int u1_const = u1 * ((1 << 16) - alpha);
- int v1_const = v1 * ((1 << 16) - alpha);
-
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- y[j] = (y[j] * alpha + y1_const) >> 16;
- }
- y += stride;
- }
-
- stride >>= 1;
-
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- u[j] = (u[j] * alpha + u1_const) >> 16;
- v[j] = (v[j] * alpha + v1_const) >> 16;
- }
- u += stride;
- v += stride;
- }
-}
-
-static void constrain_line(int x0, int *x1, int y0, int *y1,
- int width, int height) {
- int dx;
- int dy;
-
- if (*x1 > width) {
- dx = *x1 - x0;
- dy = *y1 - y0;
-
- *x1 = width;
- if (dx)
- *y1 = ((width - x0) * dy) / dx + y0;
- }
- if (*x1 < 0) {
- dx = *x1 - x0;
- dy = *y1 - y0;
-
- *x1 = 0;
- if (dx)
- *y1 = ((0 - x0) * dy) / dx + y0;
- }
- if (*y1 > height) {
- dx = *x1 - x0;
- dy = *y1 - y0;
-
- *y1 = height;
- if (dy)
- *x1 = ((height - y0) * dx) / dy + x0;
- }
- if (*y1 < 0) {
- dx = *x1 - x0;
- dy = *y1 - y0;
-
- *y1 = 0;
- if (dy)
- *x1 = ((0 - y0) * dx) / dy + x0;
- }
-}
-
-int vp9_post_proc_frame(struct VP9Common *cm,
- YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *ppflags) {
- const int q = MIN(63, cm->lf.filter_level * 10 / 6);
- const int flags = ppflags->post_proc_flag;
- YV12_BUFFER_CONFIG *const ppbuf = &cm->post_proc_buffer;
- struct postproc_state *const ppstate = &cm->postproc_state;
-
- if (!cm->frame_to_show)
- return -1;
-
- if (!flags) {
- *dest = *cm->frame_to_show;
- return 0;
- }
-
- vp9_clear_system_state();
-
- if (flags & VP9D_DEMACROBLOCK) {
- deblock_and_de_macro_block(cm->frame_to_show, ppbuf,
- q + (ppflags->deblocking_level - 5) * 10, 1, 0);
- } else if (flags & VP9D_DEBLOCK) {
- vp9_deblock(cm->frame_to_show, ppbuf, q);
- } else {
- vp8_yv12_copy_frame(cm->frame_to_show, ppbuf);
- }
-
- if (flags & VP9D_ADDNOISE) {
- const int noise_level = ppflags->noise_level;
- if (ppstate->last_q != q ||
- ppstate->last_noise != noise_level) {
- fillrd(ppstate, 63 - q, noise_level);
- }
-
- vp9_plane_add_noise(ppbuf->y_buffer, ppstate->noise, ppstate->blackclamp,
- ppstate->whiteclamp, ppstate->bothclamp,
- ppbuf->y_width, ppbuf->y_height, ppbuf->y_stride);
- }
-
-#if 0 && CONFIG_POSTPROC_VISUALIZER
- if (flags & VP9D_DEBUG_TXT_FRAME_INFO) {
- char message[512];
- snprintf(message, sizeof(message) -1,
- "F%1dG%1dQ%3dF%3dP%d_s%dx%d",
- (cm->frame_type == KEY_FRAME),
- cm->refresh_golden_frame,
- cm->base_qindex,
- cm->filter_level,
- flags,
- cm->mb_cols, cm->mb_rows);
- vp9_blit_text(message, ppbuf->y_buffer, ppbuf->y_stride);
- }
-
- if (flags & VP9D_DEBUG_TXT_MBLK_MODES) {
- int i, j;
- uint8_t *y_ptr;
- int mb_rows = ppbuf->y_height >> 4;
- int mb_cols = ppbuf->y_width >> 4;
- int mb_index = 0;
- MODE_INFO *mi = cm->mi;
-
- y_ptr = post->y_buffer + 4 * post->y_stride + 4;
-
- /* vp9_filter each macro block */
- for (i = 0; i < mb_rows; i++) {
- for (j = 0; j < mb_cols; j++) {
- char zz[4];
-
- snprintf(zz, sizeof(zz) - 1, "%c", mi[mb_index].mbmi.mode + 'a');
-
- vp9_blit_text(zz, y_ptr, post->y_stride);
- mb_index++;
- y_ptr += 16;
- }
-
- mb_index++; /* border */
- y_ptr += post->y_stride * 16 - post->y_width;
- }
- }
-
- if (flags & VP9D_DEBUG_TXT_DC_DIFF) {
- int i, j;
- uint8_t *y_ptr;
- int mb_rows = ppbuf->y_height >> 4;
- int mb_cols = ppbuf->y_width >> 4;
- int mb_index = 0;
- MODE_INFO *mi = cm->mi;
-
- y_ptr = post->y_buffer + 4 * post->y_stride + 4;
-
- /* vp9_filter each macro block */
- for (i = 0; i < mb_rows; i++) {
- for (j = 0; j < mb_cols; j++) {
- char zz[4];
- int dc_diff = !(mi[mb_index].mbmi.mode != I4X4_PRED &&
- mi[mb_index].mbmi.mode != SPLITMV &&
- mi[mb_index].mbmi.skip);
-
- if (cm->frame_type == KEY_FRAME)
- snprintf(zz, sizeof(zz) - 1, "a");
- else
- snprintf(zz, sizeof(zz) - 1, "%c", dc_diff + '0');
-
- vp9_blit_text(zz, y_ptr, post->y_stride);
- mb_index++;
- y_ptr += 16;
- }
-
- mb_index++; /* border */
- y_ptr += post->y_stride * 16 - post->y_width;
- }
- }
-
- if (flags & VP9D_DEBUG_TXT_RATE_INFO) {
- char message[512];
- snprintf(message, sizeof(message),
- "Bitrate: %10.2f framerate: %10.2f ",
- cm->bitrate, cm->framerate);
- vp9_blit_text(message, ppbuf->y_buffer, ppbuf->y_stride);
- }
-
- /* Draw motion vectors */
- if ((flags & VP9D_DEBUG_DRAW_MV) && ppflags->display_mv_flag) {
- int width = ppbuf->y_width;
- int height = ppbuf->y_height;
- uint8_t *y_buffer = ppbuf->y_buffer;
- int y_stride = ppbuf->y_stride;
- MODE_INFO *mi = cm->mi;
- int x0, y0;
-
- for (y0 = 0; y0 < height; y0 += 16) {
- for (x0 = 0; x0 < width; x0 += 16) {
- int x1, y1;
-
- if (!(ppflags->display_mv_flag & (1 << mi->mbmi.mode))) {
- mi++;
- continue;
- }
-
- if (mi->mbmi.mode == SPLITMV) {
- switch (mi->mbmi.partitioning) {
- case PARTITIONING_16X8 : { /* mv_top_bottom */
- union b_mode_info *bmi = &mi->bmi[0];
- MV *mv = &bmi->mv.as_mv;
-
- x1 = x0 + 8 + (mv->col >> 3);
- y1 = y0 + 4 + (mv->row >> 3);
-
- constrain_line(x0 + 8, &x1, y0 + 4, &y1, width, height);
- vp9_blit_line(x0 + 8, x1, y0 + 4, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[8];
-
- x1 = x0 + 8 + (mv->col >> 3);
- y1 = y0 + 12 + (mv->row >> 3);
-
- constrain_line(x0 + 8, &x1, y0 + 12, &y1, width, height);
- vp9_blit_line(x0 + 8, x1, y0 + 12, y1, y_buffer, y_stride);
-
- break;
- }
- case PARTITIONING_8X16 : { /* mv_left_right */
- union b_mode_info *bmi = &mi->bmi[0];
- MV *mv = &bmi->mv.as_mv;
-
- x1 = x0 + 4 + (mv->col >> 3);
- y1 = y0 + 8 + (mv->row >> 3);
-
- constrain_line(x0 + 4, &x1, y0 + 8, &y1, width, height);
- vp9_blit_line(x0 + 4, x1, y0 + 8, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[2];
-
- x1 = x0 + 12 + (mv->col >> 3);
- y1 = y0 + 8 + (mv->row >> 3);
-
- constrain_line(x0 + 12, &x1, y0 + 8, &y1, width, height);
- vp9_blit_line(x0 + 12, x1, y0 + 8, y1, y_buffer, y_stride);
-
- break;
- }
- case PARTITIONING_8X8 : { /* mv_quarters */
- union b_mode_info *bmi = &mi->bmi[0];
- MV *mv = &bmi->mv.as_mv;
-
- x1 = x0 + 4 + (mv->col >> 3);
- y1 = y0 + 4 + (mv->row >> 3);
-
- constrain_line(x0 + 4, &x1, y0 + 4, &y1, width, height);
- vp9_blit_line(x0 + 4, x1, y0 + 4, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[2];
-
- x1 = x0 + 12 + (mv->col >> 3);
- y1 = y0 + 4 + (mv->row >> 3);
-
- constrain_line(x0 + 12, &x1, y0 + 4, &y1, width, height);
- vp9_blit_line(x0 + 12, x1, y0 + 4, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[8];
-
- x1 = x0 + 4 + (mv->col >> 3);
- y1 = y0 + 12 + (mv->row >> 3);
-
- constrain_line(x0 + 4, &x1, y0 + 12, &y1, width, height);
- vp9_blit_line(x0 + 4, x1, y0 + 12, y1, y_buffer, y_stride);
-
- bmi = &mi->bmi[10];
-
- x1 = x0 + 12 + (mv->col >> 3);
- y1 = y0 + 12 + (mv->row >> 3);
-
- constrain_line(x0 + 12, &x1, y0 + 12, &y1, width, height);
- vp9_blit_line(x0 + 12, x1, y0 + 12, y1, y_buffer, y_stride);
- break;
- }
- case PARTITIONING_4X4:
- default : {
- union b_mode_info *bmi = mi->bmi;
- int bx0, by0;
-
- for (by0 = y0; by0 < (y0 + 16); by0 += 4) {
- for (bx0 = x0; bx0 < (x0 + 16); bx0 += 4) {
- MV *mv = &bmi->mv.as_mv;
-
- x1 = bx0 + 2 + (mv->col >> 3);
- y1 = by0 + 2 + (mv->row >> 3);
-
- constrain_line(bx0 + 2, &x1, by0 + 2, &y1, width, height);
- vp9_blit_line(bx0 + 2, x1, by0 + 2, y1, y_buffer, y_stride);
-
- bmi++;
- }
- }
- }
- }
- } else if (is_inter_mode(mi->mbmi.mode)) {
- MV *mv = &mi->mbmi.mv.as_mv;
- const int lx0 = x0 + 8;
- const int ly0 = y0 + 8;
-
- x1 = lx0 + (mv->col >> 3);
- y1 = ly0 + (mv->row >> 3);
-
- if (x1 != lx0 && y1 != ly0) {
- constrain_line(lx0, &x1, ly0 - 1, &y1, width, height);
- vp9_blit_line(lx0, x1, ly0 - 1, y1, y_buffer, y_stride);
-
- constrain_line(lx0, &x1, ly0 + 1, &y1, width, height);
- vp9_blit_line(lx0, x1, ly0 + 1, y1, y_buffer, y_stride);
- } else {
- vp9_blit_line(lx0, x1, ly0, y1, y_buffer, y_stride);
- }
- }
-
- mi++;
- }
- mi++;
- }
- }
-
- /* Color in block modes */
- if ((flags & VP9D_DEBUG_CLR_BLK_MODES)
- && (ppflags->display_mb_modes_flag || ppflags->display_b_modes_flag)) {
- int y, x;
- int width = ppbuf->y_width;
- int height = ppbuf->y_height;
- uint8_t *y_ptr = ppbuf->y_buffer;
- uint8_t *u_ptr = ppbuf->u_buffer;
- uint8_t *v_ptr = ppbuf->v_buffer;
- int y_stride = ppbuf->y_stride;
- MODE_INFO *mi = cm->mi;
-
- for (y = 0; y < height; y += 16) {
- for (x = 0; x < width; x += 16) {
- int Y = 0, U = 0, V = 0;
-
- if (mi->mbmi.mode == I4X4_PRED &&
- ((ppflags->display_mb_modes_flag & I4X4_PRED) ||
- ppflags->display_b_modes_flag)) {
- int by, bx;
- uint8_t *yl, *ul, *vl;
- union b_mode_info *bmi = mi->bmi;
-
- yl = y_ptr + x;
- ul = u_ptr + (x >> 1);
- vl = v_ptr + (x >> 1);
-
- for (by = 0; by < 16; by += 4) {
- for (bx = 0; bx < 16; bx += 4) {
- if ((ppflags->display_b_modes_flag & (1 << mi->mbmi.mode))
- || (ppflags->display_mb_modes_flag & I4X4_PRED)) {
- Y = B_PREDICTION_MODE_colors[bmi->as_mode][0];
- U = B_PREDICTION_MODE_colors[bmi->as_mode][1];
- V = B_PREDICTION_MODE_colors[bmi->as_mode][2];
-
- vp9_blend_b(yl + bx, ul + (bx >> 1), vl + (bx >> 1), Y, U, V,
- 0xc000, y_stride);
- }
- bmi++;
- }
-
- yl += y_stride * 4;
- ul += y_stride * 1;
- vl += y_stride * 1;
- }
- } else if (ppflags->display_mb_modes_flag & (1 << mi->mbmi.mode)) {
- Y = MB_PREDICTION_MODE_colors[mi->mbmi.mode][0];
- U = MB_PREDICTION_MODE_colors[mi->mbmi.mode][1];
- V = MB_PREDICTION_MODE_colors[mi->mbmi.mode][2];
-
- vp9_blend_mb_inner(y_ptr + x, u_ptr + (x >> 1), v_ptr + (x >> 1),
- Y, U, V, 0xc000, y_stride);
- }
-
- mi++;
- }
- y_ptr += y_stride * 16;
- u_ptr += y_stride * 4;
- v_ptr += y_stride * 4;
-
- mi++;
- }
- }
-
- /* Color in frame reference blocks */
- if ((flags & VP9D_DEBUG_CLR_FRM_REF_BLKS) &&
- ppflags->display_ref_frame_flag) {
- int y, x;
- int width = ppbuf->y_width;
- int height = ppbuf->y_height;
- uint8_t *y_ptr = ppbuf->y_buffer;
- uint8_t *u_ptr = ppbuf->u_buffer;
- uint8_t *v_ptr = ppbuf->v_buffer;
- int y_stride = ppbuf->y_stride;
- MODE_INFO *mi = cm->mi;
-
- for (y = 0; y < height; y += 16) {
- for (x = 0; x < width; x += 16) {
- int Y = 0, U = 0, V = 0;
-
- if (ppflags->display_ref_frame_flag & (1 << mi->mbmi.ref_frame)) {
- Y = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][0];
- U = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][1];
- V = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][2];
-
- vp9_blend_mb_outer(y_ptr + x, u_ptr + (x >> 1), v_ptr + (x >> 1),
- Y, U, V, 0xc000, y_stride);
- }
-
- mi++;
- }
- y_ptr += y_stride * 16;
- u_ptr += y_stride * 4;
- v_ptr += y_stride * 4;
-
- mi++;
- }
- }
-#endif
-
- *dest = *ppbuf;
-
- /* handle problem with extending borders */
- dest->y_width = cm->width;
- dest->y_height = cm->height;
- dest->uv_width = dest->y_width >> cm->subsampling_x;
- dest->uv_height = dest->y_height >> cm->subsampling_y;
-
- return 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.h
deleted file mode 100644
index ebebc1a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_postproc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_COMMON_VP9_POSTPROC_H_
-#define VP9_COMMON_VP9_POSTPROC_H_
-
-#include "vpx_ports/mem.h"
-#include "vpx_scale/yv12config.h"
-#include "vp9/common/vp9_ppflags.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct postproc_state {
- int last_q;
- int last_noise;
- char noise[3072];
- DECLARE_ALIGNED(16, char, blackclamp[16]);
- DECLARE_ALIGNED(16, char, whiteclamp[16]);
- DECLARE_ALIGNED(16, char, bothclamp[16]);
-};
-
-struct VP9Common;
-
-int vp9_post_proc_frame(struct VP9Common *cm,
- YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *flags);
-
-void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
-
-void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_POSTPROC_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_ppflags.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_ppflags.h
deleted file mode 100644
index 8168935..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_ppflags.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_PPFLAGS_H_
-#define VP9_COMMON_VP9_PPFLAGS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- VP9D_NOFILTERING = 0,
- VP9D_DEBLOCK = 1 << 0,
- VP9D_DEMACROBLOCK = 1 << 1,
- VP9D_ADDNOISE = 1 << 2,
- VP9D_DEBUG_TXT_FRAME_INFO = 1 << 3,
- VP9D_DEBUG_TXT_MBLK_MODES = 1 << 4,
- VP9D_DEBUG_TXT_DC_DIFF = 1 << 5,
- VP9D_DEBUG_TXT_RATE_INFO = 1 << 6,
- VP9D_DEBUG_DRAW_MV = 1 << 7,
- VP9D_DEBUG_CLR_BLK_MODES = 1 << 8,
- VP9D_DEBUG_CLR_FRM_REF_BLKS = 1 << 9
-};
-
-typedef struct {
- int post_proc_flag;
- int deblocking_level;
- int noise_level;
- int display_ref_frame_flag;
- int display_mb_modes_flag;
- int display_b_modes_flag;
- int display_mv_flag;
-} vp9_ppflags_t;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_PPFLAGS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pragmas.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pragmas.h
deleted file mode 100644
index 0efc713..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pragmas.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_PRAGMAS_H_
-#define VP9_COMMON_VP9_PRAGMAS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __INTEL_COMPILER
-#pragma warning(disable:997 1011 170)
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(disable:4799)
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_PRAGMAS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.c
deleted file mode 100644
index cdf5fb9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.c
+++ /dev/null
@@ -1,385 +0,0 @@
-
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_seg_common.h"
-
-static INLINE const MB_MODE_INFO *get_mbmi(const MODE_INFO *const mi) {
- return (mi != NULL) ? &mi->mbmi : NULL;
-}
-
-// Returns a context number for the given MB prediction signal
-int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
- // Note:
- // 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.
- const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
- const int left_type = left_mbmi != NULL && is_inter_block(left_mbmi) ?
- left_mbmi->interp_filter : SWITCHABLE_FILTERS;
- const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
- const int above_type = above_mbmi != NULL && is_inter_block(above_mbmi) ?
- above_mbmi->interp_filter : SWITCHABLE_FILTERS;
-
- if (left_type == above_type)
- return left_type;
- else if (left_type == SWITCHABLE_FILTERS && above_type != SWITCHABLE_FILTERS)
- return above_type;
- else if (left_type != SWITCHABLE_FILTERS && above_type == SWITCHABLE_FILTERS)
- return left_type;
- else
- return SWITCHABLE_FILTERS;
-}
-
-// 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.
-// 0 - inter/inter, inter/--, --/inter, --/--
-// 1 - intra/inter, inter/intra
-// 2 - intra/--, --/intra
-// 3 - intra/intra
-int vp9_get_intra_inter_context(const MACROBLOCKD *xd) {
- const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
- const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
- const int has_above = above_mbmi != NULL;
- const int has_left = left_mbmi != NULL;
-
- if (has_above && has_left) { // both edges available
- const int above_intra = !is_inter_block(above_mbmi);
- const int left_intra = !is_inter_block(left_mbmi);
- return left_intra && above_intra ? 3
- : left_intra || above_intra;
- } else if (has_above || has_left) { // one edge available
- return 2 * !is_inter_block(has_above ? above_mbmi : left_mbmi);
- } else {
- return 0;
- }
-}
-
-int vp9_get_reference_mode_context(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- int ctx;
- const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
- const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
- const int has_above = above_mbmi != NULL;
- const int has_left = left_mbmi != NULL;
- // Note:
- // 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 (has_above && has_left) { // both edges available
- if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi))
- // neither edge uses comp pred (0/1)
- ctx = (above_mbmi->ref_frame[0] == cm->comp_fixed_ref) ^
- (left_mbmi->ref_frame[0] == cm->comp_fixed_ref);
- else if (!has_second_ref(above_mbmi))
- // one of two edges uses comp pred (2/3)
- ctx = 2 + (above_mbmi->ref_frame[0] == cm->comp_fixed_ref ||
- !is_inter_block(above_mbmi));
- else if (!has_second_ref(left_mbmi))
- // one of two edges uses comp pred (2/3)
- ctx = 2 + (left_mbmi->ref_frame[0] == cm->comp_fixed_ref ||
- !is_inter_block(left_mbmi));
- else // both edges use comp pred (4)
- ctx = 4;
- } else if (has_above || has_left) { // one edge available
- const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
-
- if (!has_second_ref(edge_mbmi))
- // edge does not use comp pred (0/1)
- ctx = edge_mbmi->ref_frame[0] == cm->comp_fixed_ref;
- else
- // edge uses comp pred (3)
- ctx = 3;
- } else { // no edges available (1)
- ctx = 1;
- }
- assert(ctx >= 0 && ctx < COMP_INTER_CONTEXTS);
- return ctx;
-}
-
-// Returns a context number for the given MB prediction signal
-int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- int pred_context;
- const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
- const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
- const int above_in_image = above_mbmi != NULL;
- const int left_in_image = left_mbmi != NULL;
-
- // Note:
- // 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.
- const int fix_ref_idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
- const int var_ref_idx = !fix_ref_idx;
-
- if (above_in_image && left_in_image) { // both edges available
- const int above_intra = !is_inter_block(above_mbmi);
- const int left_intra = !is_inter_block(left_mbmi);
-
- if (above_intra && left_intra) { // intra/intra (2)
- pred_context = 2;
- } else if (above_intra || left_intra) { // intra/inter
- const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
-
- if (!has_second_ref(edge_mbmi)) // single pred (1/3)
- pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
- else // comp pred (1/3)
- pred_context = 1 + 2 * (edge_mbmi->ref_frame[var_ref_idx]
- != cm->comp_var_ref[1]);
- } else { // inter/inter
- const int l_sg = !has_second_ref(left_mbmi);
- const int a_sg = !has_second_ref(above_mbmi);
- const MV_REFERENCE_FRAME vrfa = a_sg ? above_mbmi->ref_frame[0]
- : above_mbmi->ref_frame[var_ref_idx];
- const MV_REFERENCE_FRAME vrfl = l_sg ? left_mbmi->ref_frame[0]
- : left_mbmi->ref_frame[var_ref_idx];
-
- if (vrfa == vrfl && cm->comp_var_ref[1] == vrfa) {
- pred_context = 0;
- } else if (l_sg && a_sg) { // single/single
- if ((vrfa == cm->comp_fixed_ref && vrfl == cm->comp_var_ref[0]) ||
- (vrfl == cm->comp_fixed_ref && vrfa == cm->comp_var_ref[0]))
- pred_context = 4;
- else if (vrfa == vrfl)
- pred_context = 3;
- else
- pred_context = 1;
- } else if (l_sg || a_sg) { // single/comp
- const MV_REFERENCE_FRAME vrfc = l_sg ? vrfa : vrfl;
- const MV_REFERENCE_FRAME rfs = a_sg ? vrfa : vrfl;
- if (vrfc == cm->comp_var_ref[1] && rfs != cm->comp_var_ref[1])
- pred_context = 1;
- else if (rfs == cm->comp_var_ref[1] && vrfc != cm->comp_var_ref[1])
- pred_context = 2;
- else
- pred_context = 4;
- } else if (vrfa == vrfl) { // comp/comp
- pred_context = 4;
- } else {
- pred_context = 2;
- }
- }
- } else if (above_in_image || left_in_image) { // one edge available
- const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
-
- if (!is_inter_block(edge_mbmi)) {
- pred_context = 2;
- } else {
- if (has_second_ref(edge_mbmi))
- pred_context = 4 * (edge_mbmi->ref_frame[var_ref_idx]
- != cm->comp_var_ref[1]);
- else
- pred_context = 3 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
- }
- } else { // no edges available (2)
- pred_context = 2;
- }
- assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
-
- return pred_context;
-}
-
-int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
- int pred_context;
- const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
- const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
- const int has_above = above_mbmi != NULL;
- const int has_left = left_mbmi != NULL;
- // Note:
- // 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 (has_above && has_left) { // both edges available
- const int above_intra = !is_inter_block(above_mbmi);
- const int left_intra = !is_inter_block(left_mbmi);
-
- if (above_intra && left_intra) { // intra/intra
- pred_context = 2;
- } else if (above_intra || left_intra) { // intra/inter or inter/intra
- const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
- if (!has_second_ref(edge_mbmi))
- pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
- else
- pred_context = 1 + (edge_mbmi->ref_frame[0] == LAST_FRAME ||
- edge_mbmi->ref_frame[1] == LAST_FRAME);
- } else { // inter/inter
- const int above_has_second = has_second_ref(above_mbmi);
- const int left_has_second = has_second_ref(left_mbmi);
- const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
- const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
- const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
- const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
-
- if (above_has_second && left_has_second) {
- pred_context = 1 + (above0 == LAST_FRAME || above1 == LAST_FRAME ||
- left0 == LAST_FRAME || left1 == LAST_FRAME);
- } else if (above_has_second || left_has_second) {
- const MV_REFERENCE_FRAME rfs = !above_has_second ? above0 : left0;
- const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0;
- const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1;
-
- if (rfs == LAST_FRAME)
- pred_context = 3 + (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
- else
- pred_context = (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
- } else {
- pred_context = 2 * (above0 == LAST_FRAME) + 2 * (left0 == LAST_FRAME);
- }
- }
- } else if (has_above || has_left) { // one edge available
- const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
- if (!is_inter_block(edge_mbmi)) { // intra
- pred_context = 2;
- } else { // inter
- if (!has_second_ref(edge_mbmi))
- pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
- else
- pred_context = 1 + (edge_mbmi->ref_frame[0] == LAST_FRAME ||
- edge_mbmi->ref_frame[1] == LAST_FRAME);
- }
- } else { // no edges available
- pred_context = 2;
- }
-
- assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
- return pred_context;
-}
-
-int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
- int pred_context;
- const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
- const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
- const int has_above = above_mbmi != NULL;
- const int has_left = left_mbmi != NULL;
-
- // Note:
- // 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 (has_above && has_left) { // both edges available
- const int above_intra = !is_inter_block(above_mbmi);
- const int left_intra = !is_inter_block(left_mbmi);
-
- if (above_intra && left_intra) { // intra/intra
- pred_context = 2;
- } else if (above_intra || left_intra) { // intra/inter or inter/intra
- const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
- if (!has_second_ref(edge_mbmi)) {
- if (edge_mbmi->ref_frame[0] == LAST_FRAME)
- pred_context = 3;
- else
- pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
- } else {
- pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME ||
- edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
- }
- } else { // inter/inter
- const int above_has_second = has_second_ref(above_mbmi);
- const int left_has_second = has_second_ref(left_mbmi);
- const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
- const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
- const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
- const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
-
- if (above_has_second && left_has_second) {
- if (above0 == left0 && above1 == left1)
- pred_context = 3 * (above0 == GOLDEN_FRAME ||
- above1 == GOLDEN_FRAME ||
- left0 == GOLDEN_FRAME ||
- left1 == GOLDEN_FRAME);
- else
- pred_context = 2;
- } else if (above_has_second || left_has_second) {
- const MV_REFERENCE_FRAME rfs = !above_has_second ? above0 : left0;
- const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0;
- const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1;
-
- if (rfs == GOLDEN_FRAME)
- pred_context = 3 + (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
- else if (rfs == ALTREF_FRAME)
- pred_context = crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME;
- else
- pred_context = 1 + 2 * (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
- } else {
- if (above0 == LAST_FRAME && left0 == LAST_FRAME) {
- pred_context = 3;
- } else if (above0 == LAST_FRAME || left0 == LAST_FRAME) {
- const MV_REFERENCE_FRAME edge0 = (above0 == LAST_FRAME) ? left0
- : above0;
- pred_context = 4 * (edge0 == GOLDEN_FRAME);
- } else {
- pred_context = 2 * (above0 == GOLDEN_FRAME) +
- 2 * (left0 == GOLDEN_FRAME);
- }
- }
- }
- } else if (has_above || has_left) { // one edge available
- const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
-
- if (!is_inter_block(edge_mbmi) ||
- (edge_mbmi->ref_frame[0] == LAST_FRAME && !has_second_ref(edge_mbmi)))
- pred_context = 2;
- else if (!has_second_ref(edge_mbmi))
- pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
- else
- pred_context = 3 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME ||
- edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
- } else { // no edges available (2)
- pred_context = 2;
- }
- assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
- return pred_context;
-}
-// Returns a context number for the given MB prediction signal
-// The mode info data structure has a one element border above and to the
-// left of the entries corresponding to real blocks.
-// The prediction flags in these dummy entries are initialized to 0.
-int vp9_get_tx_size_context(const MACROBLOCKD *xd) {
- const int max_tx_size = max_txsize_lookup[xd->mi[0]->mbmi.sb_type];
- const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
- const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
- const int has_above = above_mbmi != NULL;
- const int has_left = left_mbmi != NULL;
- int above_ctx = (has_above && !above_mbmi->skip) ? (int)above_mbmi->tx_size
- : max_tx_size;
- int left_ctx = (has_left && !left_mbmi->skip) ? (int)left_mbmi->tx_size
- : max_tx_size;
- if (!has_left)
- left_ctx = above_ctx;
-
- if (!has_above)
- above_ctx = left_ctx;
-
- return (above_ctx + left_ctx) > max_tx_size;
-}
-
-int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,
- BLOCK_SIZE bsize, int mi_row, int mi_col) {
- const int mi_offset = mi_row * cm->mi_cols + mi_col;
- const int bw = num_8x8_blocks_wide_lookup[bsize];
- const int bh = num_8x8_blocks_high_lookup[bsize];
- const int xmis = MIN(cm->mi_cols - mi_col, bw);
- const int ymis = MIN(cm->mi_rows - mi_row, bh);
- int x, y, segment_id = INT_MAX;
-
- for (y = 0; y < ymis; y++)
- for (x = 0; x < xmis; x++)
- segment_id = MIN(segment_id,
- segment_ids[mi_offset + y * cm->mi_cols + x]);
-
- assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
- return segment_id;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.h
deleted file mode 100644
index 1a7ba86..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_pred_common.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_PRED_COMMON_H_
-#define VP9_COMMON_VP9_PRED_COMMON_H_
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static INLINE const MODE_INFO *get_above_mi(const MACROBLOCKD *const xd) {
- return xd->up_available ? xd->mi[-xd->mi_stride] : NULL;
-}
-
-static INLINE const MODE_INFO *get_left_mi(const MACROBLOCKD *const xd) {
- return xd->left_available ? xd->mi[-1] : NULL;
-}
-
-int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,
- BLOCK_SIZE bsize, int mi_row, int mi_col);
-
-static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) {
- const MODE_INFO *const above_mi = get_above_mi(xd);
- const MODE_INFO *const left_mi = get_left_mi(xd);
- const int above_sip = (above_mi != NULL) ?
- above_mi->mbmi.seg_id_predicted : 0;
- const int left_sip = (left_mi != NULL) ? left_mi->mbmi.seg_id_predicted : 0;
-
- return above_sip + left_sip;
-}
-
-static INLINE vp9_prob vp9_get_pred_prob_seg_id(const struct segmentation *seg,
- const MACROBLOCKD *xd) {
- return seg->pred_probs[vp9_get_pred_context_seg_id(xd)];
-}
-
-static INLINE int vp9_get_skip_context(const MACROBLOCKD *xd) {
- const MODE_INFO *const above_mi = get_above_mi(xd);
- const MODE_INFO *const left_mi = get_left_mi(xd);
- const int above_skip = (above_mi != NULL) ? above_mi->mbmi.skip : 0;
- const int left_skip = (left_mi != NULL) ? left_mi->mbmi.skip : 0;
- return above_skip + left_skip;
-}
-
-static INLINE vp9_prob vp9_get_skip_prob(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- return cm->fc.skip_probs[vp9_get_skip_context(xd)];
-}
-
-int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
-
-int vp9_get_intra_inter_context(const MACROBLOCKD *xd);
-
-static INLINE vp9_prob vp9_get_intra_inter_prob(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- return cm->fc.intra_inter_prob[vp9_get_intra_inter_context(xd)];
-}
-
-int vp9_get_reference_mode_context(const VP9_COMMON *cm, const MACROBLOCKD *xd);
-
-static INLINE vp9_prob vp9_get_reference_mode_prob(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- return cm->fc.comp_inter_prob[vp9_get_reference_mode_context(cm, xd)];
-}
-
-int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
- const MACROBLOCKD *xd);
-
-static INLINE vp9_prob vp9_get_pred_prob_comp_ref_p(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- const int pred_context = vp9_get_pred_context_comp_ref_p(cm, xd);
- return cm->fc.comp_ref_prob[pred_context];
-}
-
-int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
-
-static INLINE vp9_prob vp9_get_pred_prob_single_ref_p1(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- return cm->fc.single_ref_prob[vp9_get_pred_context_single_ref_p1(xd)][0];
-}
-
-int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd);
-
-static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
- return cm->fc.single_ref_prob[vp9_get_pred_context_single_ref_p2(xd)][1];
-}
-
-int vp9_get_tx_size_context(const MACROBLOCKD *xd);
-
-static INLINE const vp9_prob *get_tx_probs(TX_SIZE max_tx_size, int ctx,
- const struct tx_probs *tx_probs) {
- switch (max_tx_size) {
- case TX_8X8:
- return tx_probs->p8x8[ctx];
- case TX_16X16:
- return tx_probs->p16x16[ctx];
- case TX_32X32:
- return tx_probs->p32x32[ctx];
- default:
- assert(0 && "Invalid max_tx_size.");
- return NULL;
- }
-}
-
-static INLINE const vp9_prob *get_tx_probs2(TX_SIZE max_tx_size,
- const MACROBLOCKD *xd,
- const struct tx_probs *tx_probs) {
- return get_tx_probs(max_tx_size, vp9_get_tx_size_context(xd), tx_probs);
-}
-
-static INLINE unsigned int *get_tx_counts(TX_SIZE max_tx_size, int ctx,
- struct tx_counts *tx_counts) {
- switch (max_tx_size) {
- case TX_8X8:
- return tx_counts->p8x8[ctx];
- case TX_16X16:
- return tx_counts->p16x16[ctx];
- case TX_32X32:
- return tx_counts->p32x32[ctx];
- default:
- assert(0 && "Invalid max_tx_size.");
- return NULL;
- }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_PRED_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.c
deleted file mode 100644
index a1befc6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_prob.h"
-
-const uint8_t vp9_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 vp9_tree_index *tree,
- const vp9_prob *pre_probs,
- const unsigned int *counts,
- unsigned int count_sat,
- unsigned int max_update,
- vp9_prob *probs) {
- const int l = tree[i];
- const unsigned int left_count = (l <= 0)
- ? counts[-l]
- : tree_merge_probs_impl(l, tree, pre_probs, counts,
- count_sat, max_update, probs);
- const int r = tree[i + 1];
- const unsigned int right_count = (r <= 0)
- ? counts[-r]
- : tree_merge_probs_impl(r, tree, pre_probs, counts,
- count_sat, max_update, probs);
- const unsigned int ct[2] = { left_count, right_count };
- probs[i >> 1] = merge_probs(pre_probs[i >> 1], ct,
- count_sat, max_update);
- return left_count + right_count;
-}
-
-void vp9_tree_merge_probs(const vp9_tree_index *tree, const vp9_prob *pre_probs,
- const unsigned int *counts, unsigned int count_sat,
- unsigned int max_update_factor, vp9_prob *probs) {
- tree_merge_probs_impl(0, tree, pre_probs, counts, count_sat,
- max_update_factor, probs);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.h
deleted file mode 100644
index 8df14fd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_prob.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_PROB_H_
-#define VP9_COMMON_VP9_PROB_H_
-
-#include "./vpx_config.h"
-
-#include "vpx_ports/mem.h"
-#include "vpx/vpx_integer.h"
-
-#include "vp9/common/vp9_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef uint8_t vp9_prob;
-
-#define MAX_PROB 255
-
-#define vp9_prob_half ((vp9_prob) 128)
-
-typedef int8_t vp9_tree_index;
-
-#define TREE_SIZE(leaf_count) (2 * (leaf_count) - 2)
-
-#define vp9_complement(x) (255 - x)
-
-/* We build coding trees compactly in arrays.
- Each node of the tree is a pair of vp9_tree_indices.
- Array index often references a corresponding probability table.
- Index <= 0 means done encoding/decoding and value = -Index,
- Index > 0 means need another bit, specification at index.
- Nonnegative indices are always even; processing begins at node 0. */
-
-typedef const vp9_tree_index vp9_tree[];
-
-static INLINE vp9_prob clip_prob(int p) {
- return (p > 255) ? 255 : (p < 1) ? 1 : p;
-}
-
-// int64 is not needed for normal frame level calculations.
-// However when outputting entropy stats accumulated over many frames
-// or even clips we can overflow int math.
-#ifdef ENTROPY_STATS
-static INLINE vp9_prob get_prob(int num, int den) {
- return (den == 0) ? 128u : clip_prob(((int64_t)num * 256 + (den >> 1)) / den);
-}
-#else
-static INLINE vp9_prob get_prob(int num, int den) {
- return (den == 0) ? 128u : clip_prob((num * 256 + (den >> 1)) / den);
-}
-#endif
-
-static INLINE vp9_prob get_binary_prob(int n0, int n1) {
- return get_prob(n0, n0 + n1);
-}
-
-/* This function assumes prob1 and prob2 are already within [1,255] range. */
-static INLINE vp9_prob weighted_prob(int prob1, int prob2, int factor) {
- return ROUND_POWER_OF_TWO(prob1 * (256 - factor) + prob2 * factor, 8);
-}
-
-static INLINE vp9_prob merge_probs(vp9_prob pre_prob,
- const unsigned int ct[2],
- unsigned int count_sat,
- unsigned int max_update_factor) {
- const vp9_prob prob = get_binary_prob(ct[0], ct[1]);
- const unsigned int count = MIN(ct[0] + ct[1], count_sat);
- const unsigned int factor = max_update_factor * count / count_sat;
- return weighted_prob(pre_prob, prob, factor);
-}
-
-void vp9_tree_merge_probs(const vp9_tree_index *tree, const vp9_prob *pre_probs,
- const unsigned int *counts, unsigned int count_sat,
- unsigned int max_update_factor, vp9_prob *probs);
-
-
-DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_PROB_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.c
deleted file mode 100644
index def1255..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_seg_common.h"
-
-#if 1
-static const int16_t dc_qlookup[QINDEX_RANGE] = {
- 4, 8, 8, 9, 10, 11, 12, 12,
- 13, 14, 15, 16, 17, 18, 19, 19,
- 20, 21, 22, 23, 24, 25, 26, 26,
- 27, 28, 29, 30, 31, 32, 32, 33,
- 34, 35, 36, 37, 38, 38, 39, 40,
- 41, 42, 43, 43, 44, 45, 46, 47,
- 48, 48, 49, 50, 51, 52, 53, 53,
- 54, 55, 56, 57, 57, 58, 59, 60,
- 61, 62, 62, 63, 64, 65, 66, 66,
- 67, 68, 69, 70, 70, 71, 72, 73,
- 74, 74, 75, 76, 77, 78, 78, 79,
- 80, 81, 81, 82, 83, 84, 85, 85,
- 87, 88, 90, 92, 93, 95, 96, 98,
- 99, 101, 102, 104, 105, 107, 108, 110,
- 111, 113, 114, 116, 117, 118, 120, 121,
- 123, 125, 127, 129, 131, 134, 136, 138,
- 140, 142, 144, 146, 148, 150, 152, 154,
- 156, 158, 161, 164, 166, 169, 172, 174,
- 177, 180, 182, 185, 187, 190, 192, 195,
- 199, 202, 205, 208, 211, 214, 217, 220,
- 223, 226, 230, 233, 237, 240, 243, 247,
- 250, 253, 257, 261, 265, 269, 272, 276,
- 280, 284, 288, 292, 296, 300, 304, 309,
- 313, 317, 322, 326, 330, 335, 340, 344,
- 349, 354, 359, 364, 369, 374, 379, 384,
- 389, 395, 400, 406, 411, 417, 423, 429,
- 435, 441, 447, 454, 461, 467, 475, 482,
- 489, 497, 505, 513, 522, 530, 539, 549,
- 559, 569, 579, 590, 602, 614, 626, 640,
- 654, 668, 684, 700, 717, 736, 755, 775,
- 796, 819, 843, 869, 896, 925, 955, 988,
- 1022, 1058, 1098, 1139, 1184, 1232, 1282, 1336,
-};
-
-static const int16_t ac_qlookup[QINDEX_RANGE] = {
- 4, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 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, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 78,
- 79, 80, 81, 82, 83, 84, 85, 86,
- 87, 88, 89, 90, 91, 92, 93, 94,
- 95, 96, 97, 98, 99, 100, 101, 102,
- 104, 106, 108, 110, 112, 114, 116, 118,
- 120, 122, 124, 126, 128, 130, 132, 134,
- 136, 138, 140, 142, 144, 146, 148, 150,
- 152, 155, 158, 161, 164, 167, 170, 173,
- 176, 179, 182, 185, 188, 191, 194, 197,
- 200, 203, 207, 211, 215, 219, 223, 227,
- 231, 235, 239, 243, 247, 251, 255, 260,
- 265, 270, 275, 280, 285, 290, 295, 300,
- 305, 311, 317, 323, 329, 335, 341, 347,
- 353, 359, 366, 373, 380, 387, 394, 401,
- 408, 416, 424, 432, 440, 448, 456, 465,
- 474, 483, 492, 501, 510, 520, 530, 540,
- 550, 560, 571, 582, 593, 604, 615, 627,
- 639, 651, 663, 676, 689, 702, 715, 729,
- 743, 757, 771, 786, 801, 816, 832, 848,
- 864, 881, 898, 915, 933, 951, 969, 988,
- 1007, 1026, 1046, 1066, 1087, 1108, 1129, 1151,
- 1173, 1196, 1219, 1243, 1267, 1292, 1317, 1343,
- 1369, 1396, 1423, 1451, 1479, 1508, 1537, 1567,
- 1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828,
-};
-
-void vp9_init_quant_tables(void) { }
-#else
-static int16_t dc_qlookup[QINDEX_RANGE];
-static int16_t ac_qlookup[QINDEX_RANGE];
-
-#define ACDC_MIN 8
-
-// TODO(dkovalev) move to common and reuse
-static double poly3(double a, double b, double c, double d, double x) {
- return a*x*x*x + b*x*x + c*x + d;
-}
-
-void vp9_init_quant_tables() {
- int i, val = 4;
-
- // A "real" q of 1.0 forces lossless mode.
- // In practice non lossless Q's between 1.0 and 2.0 (represented here by
- // integer values from 5-7 give poor rd results (lower psnr and often
- // larger size than the lossless encode. To block out those "not very useful"
- // values we increment the ac and dc q lookup values by 4 after position 0.
- ac_qlookup[0] = val;
- dc_qlookup[0] = val;
- val += 4;
-
- for (i = 1; i < QINDEX_RANGE; i++) {
- const int ac_val = val;
-
- val = (int)(val * 1.01975);
- if (val == ac_val)
- ++val;
-
- ac_qlookup[i] = (int16_t)ac_val;
- dc_qlookup[i] = (int16_t)MAX(ACDC_MIN, poly3(0.000000305, -0.00065, 0.9,
- 0.5, ac_val));
- }
-}
-#endif
-
-int16_t vp9_dc_quant(int qindex, int delta) {
- return dc_qlookup[clamp(qindex + delta, 0, MAXQ)];
-}
-
-int16_t vp9_ac_quant(int qindex, int delta) {
- return ac_qlookup[clamp(qindex + delta, 0, MAXQ)];
-}
-
-
-int vp9_get_qindex(const struct segmentation *seg, int segment_id,
- int base_qindex) {
- if (vp9_segfeature_active(seg, segment_id, SEG_LVL_ALT_Q)) {
- const int data = vp9_get_segdata(seg, segment_id, SEG_LVL_ALT_Q);
- const int seg_qindex = seg->abs_delta == SEGMENT_ABSDATA ?
- data : base_qindex + data;
- return clamp(seg_qindex, 0, MAXQ);
- } else {
- return base_qindex;
- }
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.h
deleted file mode 100644
index 5811040..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_quant_common.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_QUANT_COMMON_H_
-#define VP9_COMMON_VP9_QUANT_COMMON_H_
-
-#include "vp9/common/vp9_blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MINQ 0
-#define MAXQ 255
-#define QINDEX_RANGE (MAXQ - MINQ + 1)
-#define QINDEX_BITS 8
-
-void vp9_init_quant_tables();
-
-int16_t vp9_dc_quant(int qindex, int delta);
-int16_t vp9_ac_quant(int qindex, int delta);
-
-int vp9_get_qindex(const struct segmentation *seg, int segment_id,
- int base_qindex);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_QUANT_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.c
deleted file mode 100644
index e722d6a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "./vpx_scale_rtcd.h"
-#include "./vpx_config.h"
-
-#include "vpx/vpx_integer.h"
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_filter.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_reconintra.h"
-
-static void build_mc_border(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- int x, int y, int b_w, int b_h, int w, int h) {
- // Get a pointer to the start of the real data for this row.
- const uint8_t *ref_row = src - x - y * src_stride;
-
- if (y >= h)
- ref_row += (h - 1) * src_stride;
- else if (y > 0)
- ref_row += y * src_stride;
-
- do {
- int right = 0, copy;
- int left = x < 0 ? -x : 0;
-
- if (left > b_w)
- left = b_w;
-
- if (x + b_w > w)
- right = x + b_w - w;
-
- if (right > b_w)
- right = b_w;
-
- copy = b_w - left - right;
-
- if (left)
- memset(dst, ref_row[0], left);
-
- if (copy)
- memcpy(dst + left, ref_row + x + left, copy);
-
- if (right)
- memset(dst + left + copy, ref_row[w - 1], right);
-
- dst += dst_stride;
- ++y;
-
- if (y > 0 && y < h)
- ref_row += src_stride;
- } while (--b_h);
-}
-
-static 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, int ref,
- const InterpKernel *kernel,
- int xs, int ys) {
- sf->predict[subpel_x != 0][subpel_y != 0][ref](
- src, src_stride, dst, dst_stride,
- kernel[subpel_x], xs, kernel[subpel_y], ys, w, h);
-}
-
-void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const MV *src_mv,
- const struct scale_factors *sf,
- int w, int h, int ref,
- const InterpKernel *kernel,
- enum mv_precision precision,
- int x, int y) {
- const int is_q4 = precision == MV_PRECISION_Q4;
- const MV mv_q4 = { is_q4 ? src_mv->row : src_mv->row * 2,
- is_q4 ? src_mv->col : src_mv->col * 2 };
- MV32 mv = vp9_scale_mv(&mv_q4, x, y, sf);
- const int subpel_x = mv.col & SUBPEL_MASK;
- const int subpel_y = mv.row & SUBPEL_MASK;
-
- src += (mv.row >> SUBPEL_BITS) * src_stride + (mv.col >> SUBPEL_BITS);
-
- inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
- sf, w, h, ref, kernel, sf->x_step_q4, sf->y_step_q4);
-}
-
-static INLINE int round_mv_comp_q4(int value) {
- return (value < 0 ? value - 2 : value + 2) / 4;
-}
-
-static MV mi_mv_pred_q4(const MODE_INFO *mi, int idx) {
- MV res = { round_mv_comp_q4(mi->bmi[0].as_mv[idx].as_mv.row +
- mi->bmi[1].as_mv[idx].as_mv.row +
- mi->bmi[2].as_mv[idx].as_mv.row +
- mi->bmi[3].as_mv[idx].as_mv.row),
- round_mv_comp_q4(mi->bmi[0].as_mv[idx].as_mv.col +
- mi->bmi[1].as_mv[idx].as_mv.col +
- mi->bmi[2].as_mv[idx].as_mv.col +
- mi->bmi[3].as_mv[idx].as_mv.col) };
- return res;
-}
-
-// TODO(jkoleszar): yet another mv clamping function :-(
-MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, const MV *src_mv,
- int bw, int bh, int ss_x, int ss_y) {
- // If the MV points so far into the UMV border that no visible pixels
- // are used for reconstruction, the subpel part of the MV can be
- // discarded and the MV limited to 16 pixels with equivalent results.
- const int spel_left = (VP9_INTERP_EXTEND + bw) << SUBPEL_BITS;
- const int spel_right = spel_left - SUBPEL_SHIFTS;
- const int spel_top = (VP9_INTERP_EXTEND + bh) << SUBPEL_BITS;
- const int spel_bottom = spel_top - SUBPEL_SHIFTS;
- MV clamped_mv = {
- src_mv->row * (1 << (1 - ss_y)),
- src_mv->col * (1 << (1 - ss_x))
- };
- assert(ss_x <= 1);
- assert(ss_y <= 1);
-
- clamp_mv(&clamped_mv,
- xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left,
- xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right,
- xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top,
- xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom);
-
- return clamped_mv;
-}
-
-static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
- int bw, int bh,
- int x, int y, int w, int h,
- int mi_x, int mi_y) {
- struct macroblockd_plane *const pd = &xd->plane[plane];
- const MODE_INFO *mi = xd->mi[0];
- const int is_compound = has_second_ref(&mi->mbmi);
- const InterpKernel *kernel = vp9_get_interp_kernel(mi->mbmi.interp_filter);
- int ref;
-
- for (ref = 0; ref < 1 + is_compound; ++ref) {
- const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
- struct buf_2d *const pre_buf = &pd->pre[ref];
- struct buf_2d *const dst_buf = &pd->dst;
- uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x;
-
- // TODO(jkoleszar): All chroma MVs in SPLITMV mode are taken as the
- // same MV (the average of the 4 luma MVs) but we could do something
- // smarter for non-4:2:0. Just punt for now, pending the changes to get
- // rid of SPLITMV mode entirely.
- const MV mv = mi->mbmi.sb_type < BLOCK_8X8
- ? (plane == 0 ? mi->bmi[block].as_mv[ref].as_mv
- : mi_mv_pred_q4(mi, ref))
- : mi->mbmi.mv[ref].as_mv;
-
- // TODO(jkoleszar): This clamping is done in the incorrect place for the
- // scaling case. It needs to be done on the scaled MV, not the pre-scaling
- // MV. Note however that it performs the subsampling aware scaling so
- // that the result is always q4.
- // mv_precision precision is MV_PRECISION_Q4.
- const MV mv_q4 = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh,
- pd->subsampling_x,
- pd->subsampling_y);
-
- uint8_t *pre;
- MV32 scaled_mv;
- int xs, ys, subpel_x, subpel_y;
-
- if (vp9_is_scaled(sf)) {
- pre = pre_buf->buf + scaled_buffer_offset(x, y, pre_buf->stride, sf);
- scaled_mv = vp9_scale_mv(&mv_q4, mi_x + x, mi_y + y, sf);
- xs = sf->x_step_q4;
- ys = sf->y_step_q4;
- } else {
- pre = pre_buf->buf + (y * pre_buf->stride + x);
- scaled_mv.row = mv_q4.row;
- scaled_mv.col = mv_q4.col;
- xs = ys = 16;
- }
- subpel_x = scaled_mv.col & SUBPEL_MASK;
- subpel_y = scaled_mv.row & SUBPEL_MASK;
- pre += (scaled_mv.row >> SUBPEL_BITS) * pre_buf->stride
- + (scaled_mv.col >> SUBPEL_BITS);
-
- inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride,
- subpel_x, subpel_y, sf, w, h, ref, kernel, xs, ys);
- }
-}
-
-static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
- int mi_row, int mi_col,
- int plane_from, int plane_to) {
- int plane;
- const int mi_x = mi_col * MI_SIZE;
- const int mi_y = mi_row * MI_SIZE;
- 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 = 4 * num_4x4_w;
- const int bh = 4 * num_4x4_h;
-
- if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) {
- int i = 0, x, y;
- assert(bsize == BLOCK_8X8);
- for (y = 0; y < num_4x4_h; ++y)
- for (x = 0; x < num_4x4_w; ++x)
- build_inter_predictors(xd, plane, i++, bw, bh,
- 4 * x, 4 * y, 4, 4, mi_x, mi_y);
- } else {
- build_inter_predictors(xd, plane, 0, bw, bh,
- 0, 0, bw, bh, mi_x, mi_y);
- }
- }
-}
-
-void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 0, 0);
-}
-void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 1,
- MAX_MB_PLANE - 1);
-}
-void vp9_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- build_inter_predictors_for_planes(xd, bsize, mi_row, mi_col, 0,
- MAX_MB_PLANE - 1);
-}
-
-// TODO(jingning): This function serves as a placeholder for decoder prediction
-// using on demand border extension. It should be moved to /decoder/ directory.
-static void dec_build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
- int bw, int bh,
- int x, int y, int w, int h,
- int mi_x, int mi_y) {
- struct macroblockd_plane *const pd = &xd->plane[plane];
- const MODE_INFO *mi = xd->mi[0];
- const int is_compound = has_second_ref(&mi->mbmi);
- const InterpKernel *kernel = vp9_get_interp_kernel(mi->mbmi.interp_filter);
- int ref;
-
- for (ref = 0; ref < 1 + is_compound; ++ref) {
- const struct scale_factors *const sf = &xd->block_refs[ref]->sf;
- struct buf_2d *const pre_buf = &pd->pre[ref];
- struct buf_2d *const dst_buf = &pd->dst;
- uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x;
-
- // TODO(jkoleszar): All chroma MVs in SPLITMV mode are taken as the
- // same MV (the average of the 4 luma MVs) but we could do something
- // smarter for non-4:2:0. Just punt for now, pending the changes to get
- // rid of SPLITMV mode entirely.
- const MV mv = mi->mbmi.sb_type < BLOCK_8X8
- ? (plane == 0 ? mi->bmi[block].as_mv[ref].as_mv
- : mi_mv_pred_q4(mi, ref))
- : mi->mbmi.mv[ref].as_mv;
-
- // TODO(jkoleszar): This clamping is done in the incorrect place for the
- // scaling case. It needs to be done on the scaled MV, not the pre-scaling
- // MV. Note however that it performs the subsampling aware scaling so
- // that the result is always q4.
- // mv_precision precision is MV_PRECISION_Q4.
- const MV mv_q4 = clamp_mv_to_umv_border_sb(xd, &mv, bw, bh,
- pd->subsampling_x,
- pd->subsampling_y);
-
- MV32 scaled_mv;
- int xs, ys, x0, y0, x0_16, y0_16, frame_width, frame_height, buf_stride,
- subpel_x, subpel_y;
- uint8_t *ref_frame, *buf_ptr;
- const YV12_BUFFER_CONFIG *ref_buf = xd->block_refs[ref]->buf;
-
- // Get reference frame pointer, width and height.
- if (plane == 0) {
- frame_width = ref_buf->y_crop_width;
- frame_height = ref_buf->y_crop_height;
- ref_frame = ref_buf->y_buffer;
- } else {
- frame_width = ref_buf->uv_crop_width;
- frame_height = ref_buf->uv_crop_height;
- ref_frame = plane == 1 ? ref_buf->u_buffer : ref_buf->v_buffer;
- }
-
- if (vp9_is_scaled(sf)) {
- // Co-ordinate of containing block to pixel precision.
- int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x));
- int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y));
-
- // Co-ordinate of the block to 1/16th pixel precision.
- x0_16 = (x_start + x) << SUBPEL_BITS;
- y0_16 = (y_start + y) << SUBPEL_BITS;
-
- // Co-ordinate of current block in reference frame
- // to 1/16th pixel precision.
- x0_16 = sf->scale_value_x(x0_16, sf);
- y0_16 = sf->scale_value_y(y0_16, sf);
-
- // Map the top left corner of the block into the reference frame.
- x0 = sf->scale_value_x(x_start + x, sf);
- y0 = sf->scale_value_y(y_start + y, sf);
-
- // Scale the MV and incorporate the sub-pixel offset of the block
- // in the reference frame.
- scaled_mv = vp9_scale_mv(&mv_q4, mi_x + x, mi_y + y, sf);
- xs = sf->x_step_q4;
- ys = sf->y_step_q4;
- } else {
- // Co-ordinate of containing block to pixel precision.
- x0 = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x)) + x;
- y0 = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y)) + y;
-
- // Co-ordinate of the block to 1/16th pixel precision.
- x0_16 = x0 << SUBPEL_BITS;
- y0_16 = y0 << SUBPEL_BITS;
-
- scaled_mv.row = mv_q4.row;
- scaled_mv.col = mv_q4.col;
- xs = ys = 16;
- }
- subpel_x = scaled_mv.col & SUBPEL_MASK;
- subpel_y = scaled_mv.row & SUBPEL_MASK;
-
- // Calculate the top left corner of the best matching block in the reference frame.
- x0 += scaled_mv.col >> SUBPEL_BITS;
- y0 += scaled_mv.row >> SUBPEL_BITS;
- x0_16 += scaled_mv.col;
- y0_16 += scaled_mv.row;
-
- // Get reference block pointer.
- buf_ptr = ref_frame + y0 * pre_buf->stride + x0;
- buf_stride = pre_buf->stride;
-
- // Do border extension if there is motion or the
- // width/height is not a multiple of 8 pixels.
- if (scaled_mv.col || scaled_mv.row ||
- (frame_width & 0x7) || (frame_height & 0x7)) {
- // Get reference block bottom right coordinate.
- int x1 = ((x0_16 + (w - 1) * xs) >> SUBPEL_BITS) + 1;
- int y1 = ((y0_16 + (h - 1) * ys) >> SUBPEL_BITS) + 1;
- int x_pad = 0, y_pad = 0;
-
- if (subpel_x || (sf->x_step_q4 & SUBPEL_MASK)) {
- x0 -= VP9_INTERP_EXTEND - 1;
- x1 += VP9_INTERP_EXTEND;
- x_pad = 1;
- }
-
- if (subpel_y || (sf->y_step_q4 & SUBPEL_MASK)) {
- y0 -= VP9_INTERP_EXTEND - 1;
- y1 += VP9_INTERP_EXTEND;
- y_pad = 1;
- }
-
- // Skip border extension if block is inside the frame.
- if (x0 < 0 || x0 > frame_width - 1 || x1 < 0 || x1 > frame_width ||
- y0 < 0 || y0 > frame_height - 1 || y1 < 0 || y1 > frame_height - 1) {
- uint8_t *buf_ptr1 = ref_frame + y0 * pre_buf->stride + x0;
- // Extend the border.
- build_mc_border(buf_ptr1, pre_buf->stride, xd->mc_buf, x1 - x0 + 1,
- x0, y0, x1 - x0 + 1, y1 - y0 + 1, frame_width,
- frame_height);
- buf_stride = x1 - x0 + 1;
- buf_ptr = xd->mc_buf + y_pad * 3 * buf_stride + x_pad * 3;
- }
- }
-
- inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x,
- subpel_y, sf, w, h, ref, kernel, xs, ys);
- }
-}
-
-void vp9_dec_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- int plane;
- const int mi_x = mi_col * MI_SIZE;
- const int mi_y = mi_row * MI_SIZE;
- for (plane = 0; plane < MAX_MB_PLANE; ++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 = 4 * num_4x4_w;
- const int bh = 4 * num_4x4_h;
-
- if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) {
- int i = 0, x, y;
- assert(bsize == BLOCK_8X8);
- for (y = 0; y < num_4x4_h; ++y)
- for (x = 0; x < num_4x4_w; ++x)
- dec_build_inter_predictors(xd, plane, i++, bw, bh,
- 4 * x, 4 * y, 4, 4, mi_x, mi_y);
- } else {
- dec_build_inter_predictors(xd, plane, 0, bw, bh,
- 0, 0, bw, bh, mi_x, mi_y);
- }
- }
-}
-
-void vp9_setup_dst_planes(MACROBLOCKD *xd,
- const YV12_BUFFER_CONFIG *src,
- int mi_row, int mi_col) {
- uint8_t *const buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
- src->alpha_buffer};
- const int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
- src->alpha_stride};
- int i;
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- struct macroblockd_plane *const pd = &xd->plane[i];
- setup_pred_plane(&pd->dst, buffers[i], strides[i], mi_row, mi_col, NULL,
- pd->subsampling_x, pd->subsampling_y);
- }
-}
-
-void vp9_setup_pre_planes(MACROBLOCKD *xd, int idx,
- const YV12_BUFFER_CONFIG *src,
- int mi_row, int mi_col,
- const struct scale_factors *sf) {
- if (src != NULL) {
- int i;
- uint8_t *const buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
- src->alpha_buffer};
- const int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
- src->alpha_stride};
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- struct macroblockd_plane *const pd = &xd->plane[i];
- setup_pred_plane(&pd->pre[idx], buffers[i], strides[i], mi_row, mi_col,
- sf, pd->subsampling_x, pd->subsampling_y);
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.h
deleted file mode 100644
index 86f3158..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconinter.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_RECONINTER_H_
-#define VP9_COMMON_VP9_RECONINTER_H_
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize);
-
-void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize);
-
-void vp9_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize);
-
-void vp9_dec_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
- BLOCK_SIZE bsize);
-
-void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const MV *mv_q3,
- const struct scale_factors *sf,
- int w, int h, int do_avg,
- const InterpKernel *kernel,
- enum mv_precision precision,
- int x, int y);
-
-static INLINE int scaled_buffer_offset(int x_offset, int y_offset, int stride,
- const struct scale_factors *sf) {
- const int x = sf ? sf->scale_value_x(x_offset, sf) : x_offset;
- const int y = sf ? sf->scale_value_y(y_offset, sf) : y_offset;
- return y * stride + x;
-}
-
-static INLINE void setup_pred_plane(struct buf_2d *dst,
- uint8_t *src, int stride,
- int mi_row, int mi_col,
- const struct scale_factors *scale,
- int subsampling_x, int subsampling_y) {
- const int x = (MI_SIZE * mi_col) >> subsampling_x;
- const int y = (MI_SIZE * mi_row) >> subsampling_y;
- dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
- dst->stride = stride;
-}
-
-void vp9_setup_dst_planes(MACROBLOCKD *xd, const YV12_BUFFER_CONFIG *src,
- int mi_row, int mi_col);
-
-void vp9_setup_pre_planes(MACROBLOCKD *xd, int idx,
- const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col,
- const struct scale_factors *sf);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_RECONINTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.c
deleted file mode 100644
index 4f618b9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/vpx_once.h"
-
-#include "./vp9_rtcd.h"
-
-#include "vp9/common/vp9_reconintra.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
- DCT_DCT, // DC
- ADST_DCT, // V
- DCT_ADST, // H
- DCT_DCT, // D45
- ADST_ADST, // D135
- ADST_DCT, // D117
- DCT_ADST, // D153
- DCT_ADST, // D207
- ADST_DCT, // D63
- ADST_ADST, // TM
-};
-
-#define intra_pred_sized(type, size) \
- void vp9_##type##_predictor_##size##x##size##_c(uint8_t *dst, \
- ptrdiff_t stride, \
- const uint8_t *above, \
- const uint8_t *left) { \
- type##_predictor(dst, stride, size, above, left); \
- }
-
-#define intra_pred_allsizes(type) \
- intra_pred_sized(type, 4) \
- intra_pred_sized(type, 8) \
- intra_pred_sized(type, 16) \
- intra_pred_sized(type, 32)
-
-static INLINE void d207_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r, c;
- (void)above;
- // first column
- for (r = 0; r < bs - 1; ++r)
- dst[r * stride] = ROUND_POWER_OF_TWO(left[r] + left[r + 1], 1);
- dst[(bs - 1) * stride] = left[bs - 1];
- dst++;
-
- // second column
- for (r = 0; r < bs - 2; ++r)
- dst[r * stride] = ROUND_POWER_OF_TWO(left[r] + left[r + 1] * 2 +
- left[r + 2], 2);
- dst[(bs - 2) * stride] = ROUND_POWER_OF_TWO(left[bs - 2] +
- left[bs - 1] * 3, 2);
- dst[(bs - 1) * stride] = left[bs - 1];
- dst++;
-
- // rest of last row
- for (c = 0; c < bs - 2; ++c)
- dst[(bs - 1) * stride + c] = left[bs - 1];
-
- for (r = bs - 2; r >= 0; --r)
- for (c = 0; c < bs - 2; ++c)
- dst[r * stride + c] = dst[(r + 1) * stride + c - 2];
-}
-intra_pred_allsizes(d207)
-
-static INLINE void d63_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r, c;
- (void)left;
- for (r = 0; r < bs; ++r) {
- for (c = 0; c < bs; ++c)
- dst[c] = r & 1 ? ROUND_POWER_OF_TWO(above[r/2 + c] +
- above[r/2 + c + 1] * 2 +
- above[r/2 + c + 2], 2)
- : ROUND_POWER_OF_TWO(above[r/2 + c] +
- above[r/2 + c + 1], 1);
- dst += stride;
- }
-}
-intra_pred_allsizes(d63)
-
-static INLINE void d45_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r, c;
- (void)left;
- for (r = 0; r < bs; ++r) {
- for (c = 0; c < bs; ++c)
- dst[c] = r + c + 2 < bs * 2 ? ROUND_POWER_OF_TWO(above[r + c] +
- above[r + c + 1] * 2 +
- above[r + c + 2], 2)
- : above[bs * 2 - 1];
- dst += stride;
- }
-}
-intra_pred_allsizes(d45)
-
-static INLINE void d117_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r, c;
- // first row
- for (c = 0; c < bs; c++)
- dst[c] = ROUND_POWER_OF_TWO(above[c - 1] + above[c], 1);
- dst += stride;
-
- // second row
- dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2);
- for (c = 1; c < bs; c++)
- dst[c] = ROUND_POWER_OF_TWO(above[c - 2] + above[c - 1] * 2 + above[c], 2);
- dst += stride;
-
- // the rest of first col
- dst[0] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2);
- for (r = 3; r < bs; ++r)
- dst[(r - 2) * stride] = ROUND_POWER_OF_TWO(left[r - 3] + left[r - 2] * 2 +
- left[r - 1], 2);
-
- // the rest of the block
- for (r = 2; r < bs; ++r) {
- for (c = 1; c < bs; c++)
- dst[c] = dst[-2 * stride + c - 1];
- dst += stride;
- }
-}
-intra_pred_allsizes(d117)
-
-static INLINE void d135_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r, c;
- dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2);
- for (c = 1; c < bs; c++)
- dst[c] = ROUND_POWER_OF_TWO(above[c - 2] + above[c - 1] * 2 + above[c], 2);
-
- dst[stride] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2);
- for (r = 2; r < bs; ++r)
- dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 2] + left[r - 1] * 2 +
- left[r], 2);
-
- dst += stride;
- for (r = 1; r < bs; ++r) {
- for (c = 1; c < bs; c++)
- dst[c] = dst[-stride + c - 1];
- dst += stride;
- }
-}
-intra_pred_allsizes(d135)
-
-static INLINE void d153_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r, c;
- dst[0] = ROUND_POWER_OF_TWO(above[-1] + left[0], 1);
- for (r = 1; r < bs; r++)
- dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 1] + left[r], 1);
- dst++;
-
- dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2);
- dst[stride] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2);
- for (r = 2; r < bs; r++)
- dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 2] + left[r - 1] * 2 +
- left[r], 2);
- dst++;
-
- for (c = 0; c < bs - 2; c++)
- dst[c] = ROUND_POWER_OF_TWO(above[c - 1] + above[c] * 2 + above[c + 1], 2);
- dst += stride;
-
- for (r = 1; r < bs; ++r) {
- for (c = 0; c < bs - 2; c++)
- dst[c] = dst[-stride + c - 2];
- dst += stride;
- }
-}
-intra_pred_allsizes(d153)
-
-static INLINE void v_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r;
- (void)left;
- for (r = 0; r < bs; r++) {
- vpx_memcpy(dst, above, bs);
- dst += stride;
- }
-}
-intra_pred_allsizes(v)
-
-static INLINE void h_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r;
- (void)above;
- for (r = 0; r < bs; r++) {
- vpx_memset(dst, left[r], bs);
- dst += stride;
- }
-}
-intra_pred_allsizes(h)
-
-static INLINE void tm_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r, c;
- int ytop_left = above[-1];
-
- for (r = 0; r < bs; r++) {
- for (c = 0; c < bs; c++)
- dst[c] = clip_pixel(left[r] + above[c] - ytop_left);
- dst += stride;
- }
-}
-intra_pred_allsizes(tm)
-
-static INLINE void dc_128_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int r;
- (void)above;
- (void)left;
- for (r = 0; r < bs; r++) {
- vpx_memset(dst, 128, bs);
- dst += stride;
- }
-}
-intra_pred_allsizes(dc_128)
-
-static INLINE void dc_left_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above,
- const uint8_t *left) {
- int i, r, expected_dc, sum = 0;
- (void)above;
- for (i = 0; i < bs; i++)
- sum += left[i];
- expected_dc = (sum + (bs >> 1)) / bs;
-
- for (r = 0; r < bs; r++) {
- vpx_memset(dst, expected_dc, bs);
- dst += stride;
- }
-}
-intra_pred_allsizes(dc_left)
-
-static INLINE void dc_top_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int i, r, expected_dc, sum = 0;
- (void)left;
- for (i = 0; i < bs; i++)
- sum += above[i];
- expected_dc = (sum + (bs >> 1)) / bs;
-
- for (r = 0; r < bs; r++) {
- vpx_memset(dst, expected_dc, bs);
- dst += stride;
- }
-}
-intra_pred_allsizes(dc_top)
-
-static INLINE void dc_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
- const uint8_t *above, const uint8_t *left) {
- int i, r, expected_dc, sum = 0;
- const int count = 2 * bs;
-
- for (i = 0; i < bs; i++) {
- sum += above[i];
- sum += left[i];
- }
-
- expected_dc = (sum + (count >> 1)) / count;
-
- for (r = 0; r < bs; r++) {
- vpx_memset(dst, expected_dc, bs);
- dst += stride;
- }
-}
-intra_pred_allsizes(dc)
-#undef intra_pred_allsizes
-
-typedef void (*intra_pred_fn)(uint8_t *dst, ptrdiff_t stride,
- const uint8_t *above, const uint8_t *left);
-
-static intra_pred_fn pred[INTRA_MODES][4];
-static intra_pred_fn dc_pred[2][2][4];
-
-static void init_intra_pred_fn_ptrs(void) {
-#define intra_pred_allsizes(l, type) \
- l[0] = vp9_##type##_predictor_4x4; \
- l[1] = vp9_##type##_predictor_8x8; \
- l[2] = vp9_##type##_predictor_16x16; \
- l[3] = vp9_##type##_predictor_32x32
-
- intra_pred_allsizes(pred[V_PRED], v);
- intra_pred_allsizes(pred[H_PRED], h);
- intra_pred_allsizes(pred[D207_PRED], d207);
- intra_pred_allsizes(pred[D45_PRED], d45);
- intra_pred_allsizes(pred[D63_PRED], d63);
- intra_pred_allsizes(pred[D117_PRED], d117);
- intra_pred_allsizes(pred[D135_PRED], d135);
- intra_pred_allsizes(pred[D153_PRED], d153);
- intra_pred_allsizes(pred[TM_PRED], tm);
-
- intra_pred_allsizes(dc_pred[0][0], dc_128);
- intra_pred_allsizes(dc_pred[0][1], dc_top);
- intra_pred_allsizes(dc_pred[1][0], dc_left);
- intra_pred_allsizes(dc_pred[1][1], dc);
-
-#undef intra_pred_allsizes
-}
-
-static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
- int ref_stride, uint8_t *dst, int dst_stride,
- MB_PREDICTION_MODE mode, TX_SIZE tx_size,
- int up_available, int left_available,
- int right_available, int x, int y,
- int plane) {
- int i;
- DECLARE_ALIGNED_ARRAY(16, uint8_t, left_col, 64);
- DECLARE_ALIGNED_ARRAY(16, uint8_t, above_data, 128 + 16);
- uint8_t *above_row = above_data + 16;
- const uint8_t *const_above_row = above_row;
- const int bs = 4 << tx_size;
- int frame_width, frame_height;
- int x0, y0;
- const struct macroblockd_plane *const pd = &xd->plane[plane];
-
- // 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
- // ..
-
- once(init_intra_pred_fn_ptrs);
-
- // Get current frame pointer, width and height.
- if (plane == 0) {
- frame_width = xd->cur_buf->y_width;
- frame_height = xd->cur_buf->y_height;
- } else {
- frame_width = xd->cur_buf->uv_width;
- frame_height = xd->cur_buf->uv_height;
- }
-
- // Get block position in current frame.
- x0 = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x)) + x;
- y0 = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y)) + y;
-
- vpx_memset(left_col, 129, 64);
-
- // left
- if (left_available) {
- if (xd->mb_to_bottom_edge < 0) {
- /* slower path if the block needs border extension */
- if (y0 + bs <= frame_height) {
- for (i = 0; i < bs; ++i)
- left_col[i] = ref[i * ref_stride - 1];
- } else {
- const int extend_bottom = frame_height - y0;
- for (i = 0; i < extend_bottom; ++i)
- left_col[i] = ref[i * ref_stride - 1];
- for (; i < bs; ++i)
- left_col[i] = ref[(extend_bottom - 1) * ref_stride - 1];
- }
- } else {
- /* faster path if the block does not need extension */
- for (i = 0; i < bs; ++i)
- left_col[i] = ref[i * ref_stride - 1];
- }
- }
-
- // TODO(hkuang) do not extend 2*bs pixels for all modes.
- // above
- if (up_available) {
- const uint8_t *above_ref = ref - ref_stride;
- if (xd->mb_to_right_edge < 0) {
- /* slower path if the block needs border extension */
- if (x0 + 2 * bs <= frame_width) {
- if (right_available && bs == 4) {
- vpx_memcpy(above_row, above_ref, 2 * bs);
- } else {
- vpx_memcpy(above_row, above_ref, bs);
- vpx_memset(above_row + bs, above_row[bs - 1], bs);
- }
- } else if (x0 + bs <= frame_width) {
- const int r = frame_width - x0;
- if (right_available && bs == 4) {
- vpx_memcpy(above_row, above_ref, r);
- vpx_memset(above_row + r, above_row[r - 1],
- x0 + 2 * bs - frame_width);
- } else {
- vpx_memcpy(above_row, above_ref, bs);
- vpx_memset(above_row + bs, above_row[bs - 1], bs);
- }
- } else if (x0 <= frame_width) {
- const int r = frame_width - x0;
- if (right_available && bs == 4) {
- vpx_memcpy(above_row, above_ref, r);
- vpx_memset(above_row + r, above_row[r - 1],
- x0 + 2 * bs - frame_width);
- } else {
- vpx_memcpy(above_row, above_ref, r);
- vpx_memset(above_row + r, above_row[r - 1],
- x0 + 2 * bs - frame_width);
- }
- }
- above_row[-1] = left_available ? above_ref[-1] : 129;
- } else {
- /* faster path if the block does not need extension */
- if (bs == 4 && right_available && left_available) {
- const_above_row = above_ref;
- } else {
- vpx_memcpy(above_row, above_ref, bs);
- if (bs == 4 && right_available)
- vpx_memcpy(above_row + bs, above_ref + bs, bs);
- else
- vpx_memset(above_row + bs, above_row[bs - 1], bs);
- above_row[-1] = left_available ? above_ref[-1] : 129;
- }
- }
- } else {
- vpx_memset(above_row, 127, bs * 2);
- above_row[-1] = 127;
- }
-
- // predict
- if (mode == DC_PRED) {
- dc_pred[left_available][up_available][tx_size](dst, dst_stride,
- const_above_row, left_col);
- } else {
- pred[mode][tx_size](dst, dst_stride, const_above_row, left_col);
- }
-}
-
-void vp9_predict_intra_block(const MACROBLOCKD *xd, int block_idx, int bwl_in,
- TX_SIZE tx_size, MB_PREDICTION_MODE mode,
- const uint8_t *ref, int ref_stride,
- uint8_t *dst, int dst_stride,
- int aoff, int loff, int plane) {
- const int bwl = bwl_in - tx_size;
- const int wmask = (1 << bwl) - 1;
- const int have_top = (block_idx >> bwl) || xd->up_available;
- const int have_left = (block_idx & wmask) || xd->left_available;
- const int have_right = ((block_idx & wmask) != wmask);
- const int x = aoff * 4;
- const int y = loff * 4;
-
- assert(bwl >= 0);
- build_intra_predictors(xd, ref, ref_stride, dst, dst_stride, mode, tx_size,
- have_top, have_left, have_right, x, y, plane);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.h
deleted file mode 100644
index abc1767..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_reconintra.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_RECONINTRA_H_
-#define VP9_COMMON_VP9_RECONINTRA_H_
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_predict_intra_block(const MACROBLOCKD *xd, int block_idx, int bwl_in,
- TX_SIZE tx_size, MB_PREDICTION_MODE mode,
- const uint8_t *ref, int ref_stride,
- uint8_t *dst, int dst_stride,
- int aoff, int loff, int plane);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_RECONINTRA_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd.c
deleted file mode 100644
index dc15a84..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "./vpx_config.h"
-#define RTCD_C
-#include "./vp9_rtcd.h"
-#include "vpx_ports/vpx_once.h"
-
-void vpx_scale_rtcd(void);
-
-void vp9_rtcd() {
- vpx_scale_rtcd();
- once(setup_rtcd_internal);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd_defs.pl b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd_defs.pl
deleted file mode 100644
index b874ef3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_rtcd_defs.pl
+++ /dev/null
@@ -1,778 +0,0 @@
-sub vp9_common_forward_decls() {
-print <<EOF
-/*
- * VP9
- */
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_enums.h"
-
-struct macroblockd;
-
-/* Encoder forward decls */
-struct macroblock;
-struct vp9_variance_vtable;
-
-#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
-struct mv;
-union int_mv;
-struct yv12_buffer_config;
-EOF
-}
-forward_decls qw/vp9_common_forward_decls/;
-
-# x86inc.asm doesn't work if pic is enabled on 32 bit platforms so no assembly.
-if (vpx_config("CONFIG_USE_X86INC") eq "yes") {
- $mmx_x86inc = 'mmx';
- $sse_x86inc = 'sse';
- $sse2_x86inc = 'sse2';
- $ssse3_x86inc = 'ssse3';
- $avx_x86inc = 'avx';
- $avx2_x86inc = 'avx2';
-} else {
- $mmx_x86inc = $sse_x86inc = $sse2_x86inc = $ssse3_x86inc =
- $avx_x86inc = $avx2_x86inc = '';
-}
-
-# this variable is for functions that are 64 bit only.
-if ($opts{arch} eq "x86_64") {
- $mmx_x86_64 = 'mmx';
- $sse2_x86_64 = 'sse2';
- $ssse3_x86_64 = 'ssse3';
- $avx_x86_64 = 'avx';
- $avx2_x86_64 = 'avx2';
-} else {
- $mmx_x86_64 = $sse2_x86_64 = $ssse3_x86_64 =
- $avx_x86_64 = $avx2_x86_64 = '';
-}
-
-#
-# RECON
-#
-add_proto qw/void vp9_d207_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d207_predictor_4x4/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d45_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d45_predictor_4x4/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d63_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d63_predictor_4x4/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_h_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_h_predictor_4x4 neon dspr2/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d117_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d117_predictor_4x4/;
-
-add_proto qw/void vp9_d135_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d135_predictor_4x4/;
-
-add_proto qw/void vp9_d153_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d153_predictor_4x4/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_v_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_v_predictor_4x4 neon/, "$sse_x86inc";
-
-add_proto qw/void vp9_tm_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_tm_predictor_4x4 neon dspr2/, "$sse_x86inc";
-
-add_proto qw/void vp9_dc_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_predictor_4x4 dspr2/, "$sse_x86inc";
-
-add_proto qw/void vp9_dc_top_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_top_predictor_4x4/;
-
-add_proto qw/void vp9_dc_left_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_left_predictor_4x4/;
-
-add_proto qw/void vp9_dc_128_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_128_predictor_4x4/;
-
-add_proto qw/void vp9_d207_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d207_predictor_8x8/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d45_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d45_predictor_8x8/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d63_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d63_predictor_8x8/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_h_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_h_predictor_8x8 neon dspr2/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d117_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d117_predictor_8x8/;
-
-add_proto qw/void vp9_d135_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d135_predictor_8x8/;
-
-add_proto qw/void vp9_d153_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d153_predictor_8x8/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_v_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_v_predictor_8x8 neon/, "$sse_x86inc";
-
-add_proto qw/void vp9_tm_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_tm_predictor_8x8 neon dspr2/, "$sse2_x86inc";
-
-add_proto qw/void vp9_dc_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_predictor_8x8 dspr2/, "$sse_x86inc";
-
-add_proto qw/void vp9_dc_top_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_top_predictor_8x8/;
-
-add_proto qw/void vp9_dc_left_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_left_predictor_8x8/;
-
-add_proto qw/void vp9_dc_128_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_128_predictor_8x8/;
-
-add_proto qw/void vp9_d207_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d207_predictor_16x16/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d45_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d45_predictor_16x16/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d63_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d63_predictor_16x16/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_h_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_h_predictor_16x16 neon dspr2/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d117_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d117_predictor_16x16/;
-
-add_proto qw/void vp9_d135_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d135_predictor_16x16/;
-
-add_proto qw/void vp9_d153_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d153_predictor_16x16/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_v_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_v_predictor_16x16 neon/, "$sse2_x86inc";
-
-add_proto qw/void vp9_tm_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_tm_predictor_16x16 neon/, "$sse2_x86inc";
-
-add_proto qw/void vp9_dc_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_predictor_16x16 dspr2/, "$sse2_x86inc";
-
-add_proto qw/void vp9_dc_top_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_top_predictor_16x16/;
-
-add_proto qw/void vp9_dc_left_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_left_predictor_16x16/;
-
-add_proto qw/void vp9_dc_128_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_128_predictor_16x16/;
-
-add_proto qw/void vp9_d207_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d207_predictor_32x32/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d45_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d45_predictor_32x32/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d63_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d63_predictor_32x32/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_h_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_h_predictor_32x32 neon/, "$ssse3_x86inc";
-
-add_proto qw/void vp9_d117_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d117_predictor_32x32/;
-
-add_proto qw/void vp9_d135_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d135_predictor_32x32/;
-
-add_proto qw/void vp9_d153_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_d153_predictor_32x32/;
-
-add_proto qw/void vp9_v_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_v_predictor_32x32 neon/, "$sse2_x86inc";
-
-add_proto qw/void vp9_tm_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_tm_predictor_32x32 neon/, "$sse2_x86_64";
-
-add_proto qw/void vp9_dc_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_predictor_32x32/, "$sse2_x86inc";
-
-add_proto qw/void vp9_dc_top_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_top_predictor_32x32/;
-
-add_proto qw/void vp9_dc_left_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_left_predictor_32x32/;
-
-add_proto qw/void vp9_dc_128_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vp9_dc_128_predictor_32x32/;
-
-#
-# Loopfilter
-#
-add_proto qw/void vp9_lpf_vertical_16/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
-specialize qw/vp9_lpf_vertical_16 sse2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_vertical_16_dual/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
-specialize qw/vp9_lpf_vertical_16_dual sse2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_vertical_8/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count";
-specialize qw/vp9_lpf_vertical_8 sse2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_vertical_8_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
-specialize qw/vp9_lpf_vertical_8_dual sse2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_vertical_4/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count";
-specialize qw/vp9_lpf_vertical_4 mmx neon dspr2/;
-
-add_proto qw/void vp9_lpf_vertical_4_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
-specialize qw/vp9_lpf_vertical_4_dual sse2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_horizontal_16/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count";
-specialize qw/vp9_lpf_horizontal_16 sse2 avx2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_horizontal_8/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count";
-specialize qw/vp9_lpf_horizontal_8 sse2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_horizontal_8_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
-specialize qw/vp9_lpf_horizontal_8_dual sse2 neon dspr2/;
-
-add_proto qw/void vp9_lpf_horizontal_4/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count";
-specialize qw/vp9_lpf_horizontal_4 mmx neon dspr2/;
-
-add_proto qw/void vp9_lpf_horizontal_4_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
-specialize qw/vp9_lpf_horizontal_4_dual sse2 neon dspr2/;
-
-#
-# post proc
-#
-if (vpx_config("CONFIG_VP9_POSTPROC") eq "yes") {
-add_proto qw/void vp9_mbpost_proc_down/, "uint8_t *dst, int pitch, int rows, int cols, int flimit";
-specialize qw/vp9_mbpost_proc_down mmx sse2/;
-$vp9_mbpost_proc_down_sse2=vp9_mbpost_proc_down_xmm;
-
-add_proto qw/void vp9_mbpost_proc_across_ip/, "uint8_t *src, int pitch, int rows, int cols, int flimit";
-specialize qw/vp9_mbpost_proc_across_ip sse2/;
-$vp9_mbpost_proc_across_ip_sse2=vp9_mbpost_proc_across_ip_xmm;
-
-add_proto qw/void vp9_post_proc_down_and_across/, "const uint8_t *src_ptr, uint8_t *dst_ptr, int src_pixels_per_line, int dst_pixels_per_line, int rows, int cols, int flimit";
-specialize qw/vp9_post_proc_down_and_across mmx sse2/;
-$vp9_post_proc_down_and_across_sse2=vp9_post_proc_down_and_across_xmm;
-
-add_proto qw/void vp9_plane_add_noise/, "uint8_t *Start, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int Width, unsigned int Height, int Pitch";
-specialize qw/vp9_plane_add_noise mmx sse2/;
-$vp9_plane_add_noise_sse2=vp9_plane_add_noise_wmt;
-}
-
-add_proto qw/void vp9_blend_mb_inner/, "uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride";
-specialize qw/vp9_blend_mb_inner/;
-
-add_proto qw/void vp9_blend_mb_outer/, "uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride";
-specialize qw/vp9_blend_mb_outer/;
-
-add_proto qw/void vp9_blend_b/, "uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride";
-specialize qw/vp9_blend_b/;
-
-#
-# Sub Pixel Filters
-#
-add_proto qw/void vp9_convolve_copy/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve_copy neon dspr2/, "$sse2_x86inc";
-
-add_proto qw/void vp9_convolve_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve_avg neon dspr2/, "$sse2_x86inc";
-
-add_proto qw/void vp9_convolve8/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve8 sse2 ssse3 avx2 neon dspr2/;
-
-add_proto qw/void vp9_convolve8_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve8_horiz sse2 ssse3 avx2 neon dspr2/;
-
-add_proto qw/void vp9_convolve8_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve8_vert sse2 ssse3 avx2 neon dspr2/;
-
-add_proto qw/void vp9_convolve8_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve8_avg sse2 ssse3 neon dspr2/;
-
-add_proto qw/void vp9_convolve8_avg_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve8_avg_horiz sse2 ssse3 neon dspr2/;
-
-add_proto qw/void vp9_convolve8_avg_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
-specialize qw/vp9_convolve8_avg_vert sse2 ssse3 neon dspr2/;
-
-#
-# dct
-#
-add_proto qw/void vp9_idct4x4_1_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct4x4_1_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct4x4_16_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct4x4_16_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct8x8_1_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct8x8_1_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct8x8_64_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct8x8_64_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct8x8_10_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct8x8_10_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct16x16_1_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct16x16_1_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct16x16_256_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct16x16_256_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct16x16_10_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct16x16_10_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct32x32_1024_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct32x32_1024_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_idct32x32_34_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct32x32_34_add sse2 neon dspr2/;
-$vp9_idct32x32_34_add_neon=vp9_idct32x32_1024_add_neon;
-
-add_proto qw/void vp9_idct32x32_1_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_idct32x32_1_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_iht4x4_16_add/, "const int16_t *input, uint8_t *dest, int dest_stride, int tx_type";
-specialize qw/vp9_iht4x4_16_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_iht8x8_64_add/, "const int16_t *input, uint8_t *dest, int dest_stride, int tx_type";
-specialize qw/vp9_iht8x8_64_add sse2 neon dspr2/;
-
-add_proto qw/void vp9_iht16x16_256_add/, "const int16_t *input, uint8_t *output, int pitch, int tx_type";
-specialize qw/vp9_iht16x16_256_add sse2 dspr2/;
-
-# dct and add
-
-add_proto qw/void vp9_iwht4x4_1_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_iwht4x4_1_add/;
-
-add_proto qw/void vp9_iwht4x4_16_add/, "const int16_t *input, uint8_t *dest, int dest_stride";
-specialize qw/vp9_iwht4x4_16_add/;
-
-#
-# Encoder functions below this point.
-#
-if (vpx_config("CONFIG_VP9_ENCODER") eq "yes") {
-
-
-# variance
-add_proto qw/unsigned int vp9_variance32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance32x16/, "$sse2_x86inc", "$avx2_x86inc";
-
-add_proto qw/unsigned int vp9_variance16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance16x32/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance64x32/, "$sse2_x86inc", "$avx2_x86inc";
-
-add_proto qw/unsigned int vp9_variance32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance32x64/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance32x32/, "$sse2_x86inc", "$avx2_x86inc";
-
-add_proto qw/unsigned int vp9_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance64x64/, "$sse2_x86inc", "$avx2_x86inc";
-
-add_proto qw/unsigned int vp9_variance16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance16x16 mmx/, "$sse2_x86inc", "$avx2_x86inc";
-
-add_proto qw/unsigned int vp9_variance16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance16x8 mmx/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance8x16 mmx/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance8x8 mmx/, "$sse2_x86inc";
-
-add_proto qw/void vp9_get_sse_sum_8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
-specialize qw/vp9_get_sse_sum_8x8 sse2/;
-$vp9_get_sse_sum_8x8_sse2=vp9_get8x8var_sse2;
-
-add_proto qw/unsigned int vp9_variance8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance8x4/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance4x8/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance4x4 mmx/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance64x64 avx2/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance64x64 avx2/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance32x64/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance32x64/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance64x32/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance64x32/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance32x16/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance32x16/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance16x32/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance16x32/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance32x32 avx2/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance32x32 avx2/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance16x16/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance16x16/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance8x16/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance8x16/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance16x8/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance16x8/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance8x8/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance8x8/, "$sse2_x86inc", "$ssse3_x86inc";
-
-# TODO(jingning): need to convert 8x4/4x8 functions into mmx/sse form
-add_proto qw/unsigned int vp9_sub_pixel_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance8x4/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance8x4/, "$sse2_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance4x8/, "$sse_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance4x8/, "$sse_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sub_pixel_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_variance4x4/, "$sse_x86inc", "$ssse3_x86inc";
-#vp9_sub_pixel_variance4x4_sse2=vp9_sub_pixel_variance4x4_wmt
-
-add_proto qw/unsigned int vp9_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, const uint8_t *second_pred";
-specialize qw/vp9_sub_pixel_avg_variance4x4/, "$sse_x86inc", "$ssse3_x86inc";
-
-add_proto qw/unsigned int vp9_sad64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad64x64/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad32x64/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad64x32/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad32x16/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad16x32/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad32x32/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad16x16 mmx/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad16x8 mmx/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad8x16 mmx/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad8x8 mmx/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad8x4/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad4x8/, "$sse_x86inc";
-
-add_proto qw/unsigned int vp9_sad4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad";
-specialize qw/vp9_sad4x4 mmx/, "$sse_x86inc";
-
-add_proto qw/unsigned int vp9_sad64x64_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad64x64_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad32x64_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad32x64_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad64x32_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad64x32_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad32x16_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad32x16_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad16x32_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad16x32_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad32x32_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad32x32_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad16x16_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad16x16_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad16x8_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad16x8_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad8x16_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad8x16_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad8x8_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad8x8_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad8x4_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad8x4_avg/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_sad4x8_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad4x8_avg/, "$sse_x86inc";
-
-add_proto qw/unsigned int vp9_sad4x4_avg/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred, unsigned int max_sad";
-specialize qw/vp9_sad4x4_avg/, "$sse_x86inc";
-
-add_proto qw/unsigned int vp9_variance_halfpixvar16x16_h/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar16x16_h/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance_halfpixvar16x16_v/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar16x16_v/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance_halfpixvar16x16_hv/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar16x16_hv/, "$sse2_x86inc";
-
-add_proto qw/unsigned int vp9_variance_halfpixvar64x64_h/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar64x64_h/;
-
-add_proto qw/unsigned int vp9_variance_halfpixvar64x64_v/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar64x64_v/;
-
-add_proto qw/unsigned int vp9_variance_halfpixvar64x64_hv/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar64x64_hv/;
-
-add_proto qw/unsigned int vp9_variance_halfpixvar32x32_h/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar32x32_h/;
-
-add_proto qw/unsigned int vp9_variance_halfpixvar32x32_v/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar32x32_v/;
-
-add_proto qw/unsigned int vp9_variance_halfpixvar32x32_hv/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_variance_halfpixvar32x32_hv/;
-
-add_proto qw/void vp9_sad64x64x3/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad64x64x3/;
-
-add_proto qw/void vp9_sad32x32x3/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad32x32x3/;
-
-add_proto qw/void vp9_sad16x16x3/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad16x16x3 sse3 ssse3/;
-
-add_proto qw/void vp9_sad16x8x3/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad16x8x3 sse3 ssse3/;
-
-add_proto qw/void vp9_sad8x16x3/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad8x16x3 sse3/;
-
-add_proto qw/void vp9_sad8x8x3/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad8x8x3 sse3/;
-
-add_proto qw/void vp9_sad4x4x3/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad4x4x3 sse3/;
-
-add_proto qw/void vp9_sad64x64x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad64x64x8/;
-
-add_proto qw/void vp9_sad32x32x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad32x32x8/;
-
-add_proto qw/void vp9_sad16x16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad16x16x8 sse4/;
-
-add_proto qw/void vp9_sad16x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad16x8x8 sse4/;
-
-add_proto qw/void vp9_sad8x16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad8x16x8 sse4/;
-
-add_proto qw/void vp9_sad8x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad8x8x8 sse4/;
-
-add_proto qw/void vp9_sad8x4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad8x4x8/;
-
-add_proto qw/void vp9_sad4x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad4x8x8/;
-
-add_proto qw/void vp9_sad4x4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
-specialize qw/vp9_sad4x4x8 sse4/;
-
-add_proto qw/void vp9_sad64x64x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad64x64x4d sse2 avx2/;
-
-add_proto qw/void vp9_sad32x64x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad32x64x4d sse2/;
-
-add_proto qw/void vp9_sad64x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad64x32x4d sse2/;
-
-add_proto qw/void vp9_sad32x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad32x16x4d sse2/;
-
-add_proto qw/void vp9_sad16x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad16x32x4d sse2/;
-
-add_proto qw/void vp9_sad32x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad32x32x4d sse2 avx2/;
-
-add_proto qw/void vp9_sad16x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad16x16x4d sse2/;
-
-add_proto qw/void vp9_sad16x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad16x8x4d sse2/;
-
-add_proto qw/void vp9_sad8x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad8x16x4d sse2/;
-
-add_proto qw/void vp9_sad8x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad8x8x4d sse2/;
-
-# TODO(jingning): need to convert these 4x8/8x4 functions into sse2 form
-add_proto qw/void vp9_sad8x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad8x4x4d sse2/;
-
-add_proto qw/void vp9_sad4x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad4x8x4d sse/;
-
-add_proto qw/void vp9_sad4x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array";
-specialize qw/vp9_sad4x4x4d sse/;
-
-#add_proto qw/unsigned int vp9_sub_pixel_mse16x16/, "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";
-#specialize qw/vp9_sub_pixel_mse16x16 sse2 mmx/;
-
-add_proto qw/unsigned int vp9_mse16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
-specialize qw/vp9_mse16x16 mmx/, "$sse2_x86inc", "$avx2_x86inc";
-
-add_proto qw/unsigned int vp9_mse8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
-specialize qw/vp9_mse8x16/;
-
-add_proto qw/unsigned int vp9_mse16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
-specialize qw/vp9_mse16x8/;
-
-add_proto qw/unsigned int vp9_mse8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
-specialize qw/vp9_mse8x8/;
-
-add_proto qw/unsigned int vp9_sub_pixel_mse64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_mse64x64/;
-
-add_proto qw/unsigned int vp9_sub_pixel_mse32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
-specialize qw/vp9_sub_pixel_mse32x32/;
-
-add_proto qw/unsigned int vp9_get_mb_ss/, "const int16_t *";
-specialize qw/vp9_get_mb_ss mmx sse2/;
-# ENCODEMB INVOKE
-
-add_proto qw/int64_t vp9_block_error/, "const int16_t *coeff, const int16_t *dqcoeff, intptr_t block_size, int64_t *ssz";
-specialize qw/vp9_block_error/, "$sse2_x86inc";
-
-add_proto qw/void vp9_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";
-specialize qw/vp9_subtract_block/, "$sse2_x86inc";
-
-add_proto qw/void vp9_quantize_b/, "const int16_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, int zbin_oq_value, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
-specialize qw/vp9_quantize_b/, "$ssse3_x86_64";
-
-add_proto qw/void vp9_quantize_b_32x32/, "const int16_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, int zbin_oq_value, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
-specialize qw/vp9_quantize_b_32x32/, "$ssse3_x86_64";
-
-#
-# Structured Similarity (SSIM)
-#
-if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") {
- add_proto qw/void vp9_ssim_parms_8x8/, "uint8_t *s, int sp, uint8_t *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr";
- specialize qw/vp9_ssim_parms_8x8/, "$sse2_x86_64";
-
- add_proto qw/void vp9_ssim_parms_16x16/, "uint8_t *s, int sp, uint8_t *r, int rp, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr";
- specialize qw/vp9_ssim_parms_16x16/, "$sse2_x86_64";
-}
-
-# fdct functions
-add_proto qw/void vp9_fht4x4/, "const int16_t *input, int16_t *output, int stride, int tx_type";
-specialize qw/vp9_fht4x4 sse2 avx2/;
-
-add_proto qw/void vp9_fht8x8/, "const int16_t *input, int16_t *output, int stride, int tx_type";
-specialize qw/vp9_fht8x8 sse2 avx2/;
-
-add_proto qw/void vp9_fht16x16/, "const int16_t *input, int16_t *output, int stride, int tx_type";
-specialize qw/vp9_fht16x16 sse2 avx2/;
-
-add_proto qw/void vp9_fwht4x4/, "const int16_t *input, int16_t *output, int stride";
-specialize qw/vp9_fwht4x4/;
-
-add_proto qw/void vp9_fdct4x4/, "const int16_t *input, int16_t *output, int stride";
-specialize qw/vp9_fdct4x4 sse2 avx2/;
-
-add_proto qw/void vp9_fdct8x8/, "const int16_t *input, int16_t *output, int stride";
-specialize qw/vp9_fdct8x8 sse2 avx2/;
-
-add_proto qw/void vp9_fdct16x16/, "const int16_t *input, int16_t *output, int stride";
-specialize qw/vp9_fdct16x16 sse2 avx2/;
-
-add_proto qw/void vp9_fdct32x32/, "const int16_t *input, int16_t *output, int stride";
-specialize qw/vp9_fdct32x32 sse2 avx2/;
-
-add_proto qw/void vp9_fdct32x32_rd/, "const int16_t *input, int16_t *output, int stride";
-specialize qw/vp9_fdct32x32_rd sse2 avx2/;
-
-#
-# Motion search
-#
-add_proto qw/int vp9_full_search_sad/, "const struct macroblock *x, const struct mv *ref_mv, int sad_per_bit, int distance, const struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv, struct mv *best_mv";
-specialize qw/vp9_full_search_sad sse3 sse4_1/;
-$vp9_full_search_sad_sse3=vp9_full_search_sadx3;
-$vp9_full_search_sad_sse4_1=vp9_full_search_sadx8;
-
-add_proto qw/int vp9_refining_search_sad/, "const struct macroblock *x, struct mv *ref_mv, int sad_per_bit, int distance, const struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv";
-specialize qw/vp9_refining_search_sad sse3/;
-$vp9_refining_search_sad_sse3=vp9_refining_search_sadx4;
-
-add_proto qw/int vp9_diamond_search_sad/, "const struct macroblock *x, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv";
-specialize qw/vp9_diamond_search_sad sse3/;
-$vp9_diamond_search_sad_sse3=vp9_diamond_search_sadx4;
-
-add_proto qw/int vp9_full_range_search/, "const struct macroblock *x, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv";
-specialize qw/vp9_full_range_search/;
-
-add_proto qw/void vp9_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
-specialize qw/vp9_temporal_filter_apply sse2/;
-
-}
-# end encoder functions
-1;
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.c
deleted file mode 100644
index d3405fc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vp9_rtcd.h"
-#include "vp9/common/vp9_filter.h"
-#include "vp9/common/vp9_scale.h"
-
-static INLINE int scaled_x(int val, const struct scale_factors *sf) {
- return (int)((int64_t)val * sf->x_scale_fp >> REF_SCALE_SHIFT);
-}
-
-static INLINE int scaled_y(int val, const struct scale_factors *sf) {
- return (int)((int64_t)val * sf->y_scale_fp >> REF_SCALE_SHIFT);
-}
-
-static int unscaled_value(int val, const struct scale_factors *sf) {
- (void) sf;
- return val;
-}
-
-static int get_fixed_point_scale_factor(int other_size, int this_size) {
- // Calculate scaling factor once for each reference frame
- // and use fixed point scaling factors in decoding and encoding routines.
- // Hardware implementations can calculate scale factor in device driver
- // and use multiplication and shifting on hardware instead of division.
- return (other_size << REF_SCALE_SHIFT) / this_size;
-}
-
-static int check_scale_factors(int other_w, int other_h,
- int this_w, int this_h) {
- return 2 * this_w >= other_w &&
- 2 * this_h >= other_h &&
- this_w <= 16 * other_w &&
- this_h <= 16 * other_h;
-}
-
-MV32 vp9_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf) {
- const int x_off_q4 = scaled_x(x << SUBPEL_BITS, sf) & SUBPEL_MASK;
- const int y_off_q4 = scaled_y(y << SUBPEL_BITS, sf) & SUBPEL_MASK;
- const MV32 res = {
- scaled_y(mv->row, sf) + y_off_q4,
- scaled_x(mv->col, sf) + x_off_q4
- };
- return res;
-}
-
-void vp9_setup_scale_factors_for_frame(struct scale_factors *sf,
- int other_w, int other_h,
- int this_w, int this_h) {
- if (!check_scale_factors(other_w, other_h, this_w, this_h)) {
- sf->x_scale_fp = REF_INVALID_SCALE;
- sf->y_scale_fp = REF_INVALID_SCALE;
- return;
- }
-
- sf->x_scale_fp = get_fixed_point_scale_factor(other_w, this_w);
- sf->y_scale_fp = get_fixed_point_scale_factor(other_h, this_h);
- sf->x_step_q4 = scaled_x(16, sf);
- sf->y_step_q4 = scaled_y(16, sf);
-
- if (vp9_is_scaled(sf)) {
- sf->scale_value_x = scaled_x;
- sf->scale_value_y = scaled_y;
- } else {
- sf->scale_value_x = unscaled_value;
- sf->scale_value_y = unscaled_value;
- }
-
- // TODO(agrange): Investigate the best choice of functions to use here
- // for EIGHTTAP_SMOOTH. Since it is not interpolating, need to choose what
- // to do at full-pel offsets. The current selection, where the filter is
- // applied in one direction only, and not at all for 0,0, seems to give the
- // best quality, but it may be worth trying an additional mode that does
- // do the filtering on full-pel.
- if (sf->x_step_q4 == 16) {
- if (sf->y_step_q4 == 16) {
- // No scaling in either direction.
- sf->predict[0][0][0] = vp9_convolve_copy;
- sf->predict[0][0][1] = vp9_convolve_avg;
- sf->predict[0][1][0] = vp9_convolve8_vert;
- sf->predict[0][1][1] = vp9_convolve8_avg_vert;
- sf->predict[1][0][0] = vp9_convolve8_horiz;
- sf->predict[1][0][1] = vp9_convolve8_avg_horiz;
- } else {
- // No scaling in x direction. Must always scale in the y direction.
- sf->predict[0][0][0] = vp9_convolve8_vert;
- sf->predict[0][0][1] = vp9_convolve8_avg_vert;
- sf->predict[0][1][0] = vp9_convolve8_vert;
- sf->predict[0][1][1] = vp9_convolve8_avg_vert;
- sf->predict[1][0][0] = vp9_convolve8;
- sf->predict[1][0][1] = vp9_convolve8_avg;
- }
- } else {
- if (sf->y_step_q4 == 16) {
- // No scaling in the y direction. Must always scale in the x direction.
- sf->predict[0][0][0] = vp9_convolve8_horiz;
- sf->predict[0][0][1] = vp9_convolve8_avg_horiz;
- sf->predict[0][1][0] = vp9_convolve8;
- sf->predict[0][1][1] = vp9_convolve8_avg;
- sf->predict[1][0][0] = vp9_convolve8_horiz;
- sf->predict[1][0][1] = vp9_convolve8_avg_horiz;
- } else {
- // Must always scale in both directions.
- sf->predict[0][0][0] = vp9_convolve8;
- sf->predict[0][0][1] = vp9_convolve8_avg;
- sf->predict[0][1][0] = vp9_convolve8;
- sf->predict[0][1][1] = vp9_convolve8_avg;
- sf->predict[1][0][0] = vp9_convolve8;
- sf->predict[1][0][1] = vp9_convolve8_avg;
- }
- }
- // 2D subpel motion always gets filtered in both directions
- sf->predict[1][1][0] = vp9_convolve8;
- sf->predict[1][1][1] = vp9_convolve8_avg;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.h
deleted file mode 100644
index a9dda18..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scale.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_SCALE_H_
-#define VP9_COMMON_VP9_SCALE_H_
-
-#include "vp9/common/vp9_mv.h"
-#include "vp9/common/vp9_convolve.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define REF_SCALE_SHIFT 14
-#define REF_NO_SCALE (1 << REF_SCALE_SHIFT)
-#define REF_INVALID_SCALE -1
-
-struct scale_factors {
- int x_scale_fp; // horizontal fixed point scale factor
- int y_scale_fp; // vertical fixed point scale factor
- int x_step_q4;
- int y_step_q4;
-
- int (*scale_value_x)(int val, const struct scale_factors *sf);
- int (*scale_value_y)(int val, const struct scale_factors *sf);
-
- convolve_fn_t predict[2][2][2]; // horiz, vert, avg
-};
-
-MV32 vp9_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf);
-
-void vp9_setup_scale_factors_for_frame(struct scale_factors *sf,
- int other_w, int other_h,
- int this_w, int this_h);
-
-static INLINE int vp9_is_valid_scale(const struct scale_factors *sf) {
- return sf->x_scale_fp != REF_INVALID_SCALE &&
- sf->y_scale_fp != REF_INVALID_SCALE;
-}
-
-static INLINE int vp9_is_scaled(const struct scale_factors *sf) {
- return sf->x_scale_fp != REF_NO_SCALE ||
- sf->y_scale_fp != REF_NO_SCALE;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_SCALE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.c
deleted file mode 100644
index 1ec5a0c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "vp9/common/vp9_scan.h"
-
-DECLARE_ALIGNED(16, static const int16_t, default_scan_4x4[16]) = {
- 0, 4, 1, 5,
- 8, 2, 12, 9,
- 3, 6, 13, 10,
- 7, 14, 11, 15,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, col_scan_4x4[16]) = {
- 0, 4, 8, 1,
- 12, 5, 9, 2,
- 13, 6, 10, 3,
- 7, 14, 11, 15,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, row_scan_4x4[16]) = {
- 0, 1, 4, 2,
- 5, 3, 6, 8,
- 9, 7, 12, 10,
- 13, 11, 14, 15,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, default_scan_8x8[64]) = {
- 0, 8, 1, 16, 9, 2, 17, 24,
- 10, 3, 18, 25, 32, 11, 4, 26,
- 33, 19, 40, 12, 34, 27, 5, 41,
- 20, 48, 13, 35, 42, 28, 21, 6,
- 49, 56, 36, 43, 29, 7, 14, 50,
- 57, 44, 22, 37, 15, 51, 58, 30,
- 45, 23, 52, 59, 38, 31, 60, 53,
- 46, 39, 61, 54, 47, 62, 55, 63,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, col_scan_8x8[64]) = {
- 0, 8, 16, 1, 24, 9, 32, 17,
- 2, 40, 25, 10, 33, 18, 48, 3,
- 26, 41, 11, 56, 19, 34, 4, 49,
- 27, 42, 12, 35, 20, 57, 50, 28,
- 5, 43, 13, 36, 58, 51, 21, 44,
- 6, 29, 59, 37, 14, 52, 22, 7,
- 45, 60, 30, 15, 38, 53, 23, 46,
- 31, 61, 39, 54, 47, 62, 55, 63,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, row_scan_8x8[64]) = {
- 0, 1, 2, 8, 9, 3, 16, 10,
- 4, 17, 11, 24, 5, 18, 25, 12,
- 19, 26, 32, 6, 13, 20, 33, 27,
- 7, 34, 40, 21, 28, 41, 14, 35,
- 48, 42, 29, 36, 49, 22, 43, 15,
- 56, 37, 50, 44, 30, 57, 23, 51,
- 58, 45, 38, 52, 31, 59, 53, 46,
- 60, 39, 61, 47, 54, 55, 62, 63,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, default_scan_16x16[256]) = {
- 0, 16, 1, 32, 17, 2, 48, 33, 18, 3, 64, 34, 49, 19, 65, 80,
- 50, 4, 35, 66, 20, 81, 96, 51, 5, 36, 82, 97, 67, 112, 21, 52,
- 98, 37, 83, 113, 6, 68, 128, 53, 22, 99, 114, 84, 7, 129, 38, 69,
- 100, 115, 144, 130, 85, 54, 23, 8, 145, 39, 70, 116, 101, 131, 160, 146,
- 55, 86, 24, 71, 132, 117, 161, 40, 9, 102, 147, 176, 162, 87, 56, 25,
- 133, 118, 177, 148, 72, 103, 41, 163, 10, 192, 178, 88, 57, 134, 149, 119,
- 26, 164, 73, 104, 193, 42, 179, 208, 11, 135, 89, 165, 120, 150, 58, 194,
- 180, 27, 74, 209, 105, 151, 136, 43, 90, 224, 166, 195, 181, 121, 210, 59,
- 12, 152, 106, 167, 196, 75, 137, 225, 211, 240, 182, 122, 91, 28, 197, 13,
- 226, 168, 183, 153, 44, 212, 138, 107, 241, 60, 29, 123, 198, 184, 227, 169,
- 242, 76, 213, 154, 45, 92, 14, 199, 139, 61, 228, 214, 170, 185, 243, 108,
- 77, 155, 30, 15, 200, 229, 124, 215, 244, 93, 46, 186, 171, 201, 109, 140,
- 230, 62, 216, 245, 31, 125, 78, 156, 231, 47, 187, 202, 217, 94, 246, 141,
- 63, 232, 172, 110, 247, 157, 79, 218, 203, 126, 233, 188, 248, 95, 173, 142,
- 219, 111, 249, 234, 158, 127, 189, 204, 250, 235, 143, 174, 220, 205, 159,
- 251,
- 190, 221, 175, 236, 237, 191, 206, 252, 222, 253, 207, 238, 223, 254, 239,
- 255,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, col_scan_16x16[256]) = {
- 0, 16, 32, 48, 1, 64, 17, 80, 33, 96, 49, 2, 65, 112, 18, 81,
- 34, 128, 50, 97, 3, 66, 144, 19, 113, 35, 82, 160, 98, 51, 129, 4,
- 67, 176, 20, 114, 145, 83, 36, 99, 130, 52, 192, 5, 161, 68, 115, 21,
- 146, 84, 208, 177, 37, 131, 100, 53, 162, 224, 69, 6, 116, 193, 147, 85,
- 22, 240, 132, 38, 178, 101, 163, 54, 209, 117, 70, 7, 148, 194, 86, 179,
- 225, 23, 133, 39, 164, 8, 102, 210, 241, 55, 195, 118, 149, 71, 180, 24,
- 87, 226, 134, 165, 211, 40, 103, 56, 72, 150, 196, 242, 119, 9, 181, 227,
- 88, 166, 25, 135, 41, 104, 212, 57, 151, 197, 120, 73, 243, 182, 136, 167,
- 213, 89, 10, 228, 105, 152, 198, 26, 42, 121, 183, 244, 168, 58, 137, 229,
- 74, 214, 90, 153, 199, 184, 11, 106, 245, 27, 122, 230, 169, 43, 215, 59,
- 200, 138, 185, 246, 75, 12, 91, 154, 216, 231, 107, 28, 44, 201, 123, 170,
- 60, 247, 232, 76, 139, 13, 92, 217, 186, 248, 155, 108, 29, 124, 45, 202,
- 233, 171, 61, 14, 77, 140, 15, 249, 93, 30, 187, 156, 218, 46, 109, 125,
- 62, 172, 78, 203, 31, 141, 234, 94, 47, 188, 63, 157, 110, 250, 219, 79,
- 126, 204, 173, 142, 95, 189, 111, 235, 158, 220, 251, 127, 174, 143, 205,
- 236,
- 159, 190, 221, 252, 175, 206, 237, 191, 253, 222, 238, 207, 254, 223, 239,
- 255,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, row_scan_16x16[256]) = {
- 0, 1, 2, 16, 3, 17, 4, 18, 32, 5, 33, 19, 6, 34, 48, 20,
- 49, 7, 35, 21, 50, 64, 8, 36, 65, 22, 51, 37, 80, 9, 66, 52,
- 23, 38, 81, 67, 10, 53, 24, 82, 68, 96, 39, 11, 54, 83, 97, 69,
- 25, 98, 84, 40, 112, 55, 12, 70, 99, 113, 85, 26, 41, 56, 114, 100,
- 13, 71, 128, 86, 27, 115, 101, 129, 42, 57, 72, 116, 14, 87, 130, 102,
- 144, 73, 131, 117, 28, 58, 15, 88, 43, 145, 103, 132, 146, 118, 74, 160,
- 89, 133, 104, 29, 59, 147, 119, 44, 161, 148, 90, 105, 134, 162, 120, 176,
- 75, 135, 149, 30, 60, 163, 177, 45, 121, 91, 106, 164, 178, 150, 192, 136,
- 165, 179, 31, 151, 193, 76, 122, 61, 137, 194, 107, 152, 180, 208, 46, 166,
- 167, 195, 92, 181, 138, 209, 123, 153, 224, 196, 77, 168, 210, 182, 240, 108,
- 197, 62, 154, 225, 183, 169, 211, 47, 139, 93, 184, 226, 212, 241, 198, 170,
- 124, 155, 199, 78, 213, 185, 109, 227, 200, 63, 228, 242, 140, 214, 171, 186,
- 156, 229, 243, 125, 94, 201, 244, 215, 216, 230, 141, 187, 202, 79, 172, 110,
- 157, 245, 217, 231, 95, 246, 232, 126, 203, 247, 233, 173, 218, 142, 111,
- 158,
- 188, 248, 127, 234, 219, 249, 189, 204, 143, 174, 159, 250, 235, 205, 220,
- 175,
- 190, 251, 221, 191, 206, 236, 207, 237, 252, 222, 253, 223, 238, 239, 254,
- 255,
-};
-
-DECLARE_ALIGNED(16, static const int16_t, default_scan_32x32[1024]) = {
- 0, 32, 1, 64, 33, 2, 96, 65, 34, 128, 3, 97, 66, 160,
- 129, 35, 98, 4, 67, 130, 161, 192, 36, 99, 224, 5, 162, 193,
- 68, 131, 37, 100,
- 225, 194, 256, 163, 69, 132, 6, 226, 257, 288, 195, 101, 164, 38,
- 258, 7, 227, 289, 133, 320, 70, 196, 165, 290, 259, 228, 39, 321,
- 102, 352, 8, 197,
- 71, 134, 322, 291, 260, 353, 384, 229, 166, 103, 40, 354, 323, 292,
- 135, 385, 198, 261, 72, 9, 416, 167, 386, 355, 230, 324, 104, 293,
- 41, 417, 199, 136,
- 262, 387, 448, 325, 356, 10, 73, 418, 231, 168, 449, 294, 388, 105,
- 419, 263, 42, 200, 357, 450, 137, 480, 74, 326, 232, 11, 389, 169,
- 295, 420, 106, 451,
- 481, 358, 264, 327, 201, 43, 138, 512, 482, 390, 296, 233, 170, 421,
- 75, 452, 359, 12, 513, 265, 483, 328, 107, 202, 514, 544, 422, 391,
- 453, 139, 44, 234,
- 484, 297, 360, 171, 76, 515, 545, 266, 329, 454, 13, 423, 203, 108,
- 546, 485, 576, 298, 235, 140, 361, 330, 172, 547, 45, 455, 267, 577,
- 486, 77, 204, 362,
- 608, 14, 299, 578, 109, 236, 487, 609, 331, 141, 579, 46, 15, 173,
- 610, 363, 78, 205, 16, 110, 237, 611, 142, 47, 174, 79, 206, 17,
- 111, 238, 48, 143,
- 80, 175, 112, 207, 49, 18, 239, 81, 113, 19, 50, 82, 114, 51,
- 83, 115, 640, 516, 392, 268, 144, 20, 672, 641, 548, 517, 424,
- 393, 300, 269, 176, 145,
- 52, 21, 704, 673, 642, 580, 549, 518, 456, 425, 394, 332, 301,
- 270, 208, 177, 146, 84, 53, 22, 736, 705, 674, 643, 612, 581,
- 550, 519, 488, 457, 426, 395,
- 364, 333, 302, 271, 240, 209, 178, 147, 116, 85, 54, 23, 737,
- 706, 675, 613, 582, 551, 489, 458, 427, 365, 334, 303, 241,
- 210, 179, 117, 86, 55, 738, 707,
- 614, 583, 490, 459, 366, 335, 242, 211, 118, 87, 739, 615, 491,
- 367, 243, 119, 768, 644, 520, 396, 272, 148, 24, 800, 769, 676,
- 645, 552, 521, 428, 397, 304,
- 273, 180, 149, 56, 25, 832, 801, 770, 708, 677, 646, 584, 553,
- 522, 460, 429, 398, 336, 305, 274, 212, 181, 150, 88, 57, 26,
- 864, 833, 802, 771, 740, 709,
- 678, 647, 616, 585, 554, 523, 492, 461, 430, 399, 368, 337, 306,
- 275, 244, 213, 182, 151, 120, 89, 58, 27, 865, 834, 803, 741,
- 710, 679, 617, 586, 555, 493,
- 462, 431, 369, 338, 307, 245, 214, 183, 121, 90, 59, 866, 835,
- 742, 711, 618, 587, 494, 463, 370, 339, 246, 215, 122, 91, 867,
- 743, 619, 495, 371, 247, 123,
- 896, 772, 648, 524, 400, 276, 152, 28, 928, 897, 804, 773, 680,
- 649, 556, 525, 432, 401, 308, 277, 184, 153, 60, 29, 960, 929,
- 898, 836, 805, 774, 712, 681,
- 650, 588, 557, 526, 464, 433, 402, 340, 309, 278, 216, 185, 154,
- 92, 61, 30, 992, 961, 930, 899, 868, 837, 806, 775, 744, 713, 682,
- 651, 620, 589, 558, 527,
- 496, 465, 434, 403, 372, 341, 310, 279, 248, 217, 186, 155, 124,
- 93, 62, 31, 993, 962, 931, 869, 838, 807, 745, 714, 683, 621, 590,
- 559, 497, 466, 435, 373,
- 342, 311, 249, 218, 187, 125, 94, 63, 994, 963, 870, 839, 746, 715,
- 622, 591, 498, 467, 374, 343, 250, 219, 126, 95, 995, 871, 747, 623,
- 499, 375, 251, 127,
- 900, 776, 652, 528, 404, 280, 156, 932, 901, 808, 777, 684, 653, 560,
- 529, 436, 405, 312, 281, 188, 157, 964, 933, 902, 840, 809, 778, 716,
- 685, 654, 592, 561,
- 530, 468, 437, 406, 344, 313, 282, 220, 189, 158, 996, 965, 934, 903,
- 872, 841, 810, 779, 748, 717, 686, 655, 624, 593, 562, 531, 500, 469,
- 438, 407, 376, 345,
- 314, 283, 252, 221, 190, 159, 997, 966, 935, 873, 842, 811, 749, 718,
- 687, 625, 594, 563, 501, 470, 439, 377, 346, 315, 253, 222, 191, 998,
- 967, 874, 843, 750,
- 719, 626, 595, 502, 471, 378, 347, 254, 223, 999, 875, 751, 627, 503,
- 379, 255, 904, 780, 656, 532, 408, 284, 936, 905, 812, 781, 688, 657,
- 564, 533, 440, 409,
- 316, 285, 968, 937, 906, 844, 813, 782, 720, 689, 658, 596, 565, 534,
- 472, 441, 410, 348, 317, 286, 1000, 969, 938, 907, 876, 845, 814, 783,
- 752, 721, 690, 659,
- 628, 597, 566, 535, 504, 473, 442, 411, 380, 349, 318, 287, 1001, 970,
- 939, 877, 846, 815, 753, 722, 691, 629, 598, 567, 505, 474, 443, 381,
- 350, 319, 1002, 971,
- 878, 847, 754, 723, 630, 599, 506, 475, 382, 351, 1003, 879, 755, 631,
- 507, 383, 908, 784, 660, 536, 412, 940, 909, 816, 785, 692, 661, 568,
- 537, 444, 413, 972,
- 941, 910, 848, 817, 786, 724, 693, 662, 600, 569, 538, 476, 445, 414,
- 1004, 973, 942, 911, 880, 849, 818, 787, 756, 725, 694, 663, 632, 601,
- 570, 539, 508, 477,
- 446, 415, 1005, 974, 943, 881, 850, 819, 757, 726, 695, 633, 602, 571,
- 509, 478, 447, 1006, 975, 882, 851, 758, 727, 634, 603, 510, 479,
- 1007, 883, 759, 635, 511,
- 912, 788, 664, 540, 944, 913, 820, 789, 696, 665, 572, 541, 976, 945,
- 914, 852, 821, 790, 728, 697, 666, 604, 573, 542, 1008, 977, 946, 915,
- 884, 853, 822, 791,
- 760, 729, 698, 667, 636, 605, 574, 543, 1009, 978, 947, 885, 854, 823,
- 761, 730, 699, 637, 606, 575, 1010, 979, 886, 855, 762, 731, 638, 607,
- 1011, 887, 763, 639,
- 916, 792, 668, 948, 917, 824, 793, 700, 669, 980, 949, 918, 856, 825,
- 794, 732, 701, 670, 1012, 981, 950, 919, 888, 857, 826, 795, 764, 733,
- 702, 671, 1013, 982,
- 951, 889, 858, 827, 765, 734, 703, 1014, 983, 890, 859, 766, 735, 1015,
- 891, 767, 920, 796, 952, 921, 828, 797, 984, 953, 922, 860, 829, 798,
- 1016, 985, 954, 923,
- 892, 861, 830, 799, 1017, 986, 955, 893, 862, 831, 1018, 987, 894, 863,
- 1019, 895, 924, 956, 925, 988, 957, 926, 1020, 989, 958, 927, 1021,
- 990, 959, 1022, 991, 1023,
-};
-
-// Neighborhood 5-tuples for various scans and blocksizes,
-// in {top, left, topleft, topright, bottomleft} order
-// for each position in raster scan order.
-// -1 indicates the neighbor does not exist.
-DECLARE_ALIGNED(16, static int16_t,
- default_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- col_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- row_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- col_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- row_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- default_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- col_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- row_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- default_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
-DECLARE_ALIGNED(16, static int16_t,
- default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]);
-
-DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_4x4[16]);
-DECLARE_ALIGNED(16, static int16_t, vp9_col_iscan_4x4[16]);
-DECLARE_ALIGNED(16, static int16_t, vp9_row_iscan_4x4[16]);
-DECLARE_ALIGNED(16, static int16_t, vp9_col_iscan_8x8[64]);
-DECLARE_ALIGNED(16, static int16_t, vp9_row_iscan_8x8[64]);
-DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_8x8[64]);
-DECLARE_ALIGNED(16, static int16_t, vp9_col_iscan_16x16[256]);
-DECLARE_ALIGNED(16, static int16_t, vp9_row_iscan_16x16[256]);
-DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_16x16[256]);
-DECLARE_ALIGNED(16, static int16_t, vp9_default_iscan_32x32[1024]);
-
-const scan_order vp9_default_scan_orders[TX_SIZES] = {
- {default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
- {default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
- {default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
- {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
-};
-
-const scan_order vp9_scan_orders[TX_SIZES][TX_TYPES] = {
- { // TX_4X4
- {default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors},
- {row_scan_4x4, vp9_row_iscan_4x4, row_scan_4x4_neighbors},
- {col_scan_4x4, vp9_col_iscan_4x4, col_scan_4x4_neighbors},
- {default_scan_4x4, vp9_default_iscan_4x4, default_scan_4x4_neighbors}
- }, { // TX_8X8
- {default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors},
- {row_scan_8x8, vp9_row_iscan_8x8, row_scan_8x8_neighbors},
- {col_scan_8x8, vp9_col_iscan_8x8, col_scan_8x8_neighbors},
- {default_scan_8x8, vp9_default_iscan_8x8, default_scan_8x8_neighbors}
- }, { // TX_16X16
- {default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors},
- {row_scan_16x16, vp9_row_iscan_16x16, row_scan_16x16_neighbors},
- {col_scan_16x16, vp9_col_iscan_16x16, col_scan_16x16_neighbors},
- {default_scan_16x16, vp9_default_iscan_16x16, default_scan_16x16_neighbors}
- }, { // TX_32X32
- {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
- {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
- {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
- {default_scan_32x32, vp9_default_iscan_32x32, default_scan_32x32_neighbors},
- }
-};
-
-static int find_in_scan(const int16_t *scan, int l, int idx) {
- int n, l2 = l * l;
- for (n = 0; n < l2; n++) {
- int rc = scan[n];
- if (rc == idx)
- return n;
- }
- assert(0);
- return -1;
-}
-
-static void init_scan_neighbors(const int16_t *scan, int16_t *iscan, int l,
- int16_t *neighbors) {
- int l2 = l * l;
- int n, i, j;
-
- // dc doesn't use this type of prediction
- neighbors[MAX_NEIGHBORS * 0 + 0] = 0;
- neighbors[MAX_NEIGHBORS * 0 + 1] = 0;
- iscan[0] = find_in_scan(scan, l, 0);
- for (n = 1; n < l2; n++) {
- int rc = scan[n];
- iscan[n] = find_in_scan(scan, l, n);
- i = rc / l;
- j = rc % l;
- if (i > 0 && j > 0) {
- // col/row scan is used for adst/dct, and generally means that
- // energy decreases to zero much faster in the dimension in
- // which ADST is used compared to the direction in which DCT
- // is used. Likewise, we find much higher correlation between
- // coefficients within the direction in which DCT is used.
- // Therefore, if we use ADST/DCT, prefer the DCT neighbor coeff
- // as a context. If ADST or DCT is used in both directions, we
- // use the combination of the two as a context.
- int a = (i - 1) * l + j;
- int b = i * l + j - 1;
- if (scan == col_scan_4x4 || scan == col_scan_8x8 ||
- scan == col_scan_16x16) {
- // in the col/row scan cases (as well as left/top edge cases), we set
- // both contexts to the same value, so we can branchlessly do a+b+1>>1
- // which automatically becomes a if a == b
- neighbors[MAX_NEIGHBORS * n + 0] =
- neighbors[MAX_NEIGHBORS * n + 1] = a;
- } else if (scan == row_scan_4x4 || scan == row_scan_8x8 ||
- scan == row_scan_16x16) {
- neighbors[MAX_NEIGHBORS * n + 0] =
- neighbors[MAX_NEIGHBORS * n + 1] = b;
- } else {
- neighbors[MAX_NEIGHBORS * n + 0] = a;
- neighbors[MAX_NEIGHBORS * n + 1] = b;
- }
- } else if (i > 0) {
- neighbors[MAX_NEIGHBORS * n + 0] =
- neighbors[MAX_NEIGHBORS * n + 1] = (i - 1) * l + j;
- } else {
- assert(j > 0);
- neighbors[MAX_NEIGHBORS * n + 0] =
- neighbors[MAX_NEIGHBORS * n + 1] = i * l + j - 1;
- }
- assert(iscan[neighbors[MAX_NEIGHBORS * n + 0]] < n);
- }
- // one padding item so we don't have to add branches in code to handle
- // calls to get_coef_context() for the token after the final dc token
- neighbors[MAX_NEIGHBORS * l2 + 0] = 0;
- neighbors[MAX_NEIGHBORS * l2 + 1] = 0;
-}
-
-void vp9_init_neighbors() {
- init_scan_neighbors(default_scan_4x4, vp9_default_iscan_4x4, 4,
- default_scan_4x4_neighbors);
- init_scan_neighbors(row_scan_4x4, vp9_row_iscan_4x4, 4,
- row_scan_4x4_neighbors);
- init_scan_neighbors(col_scan_4x4, vp9_col_iscan_4x4, 4,
- col_scan_4x4_neighbors);
- init_scan_neighbors(default_scan_8x8, vp9_default_iscan_8x8, 8,
- default_scan_8x8_neighbors);
- init_scan_neighbors(row_scan_8x8, vp9_row_iscan_8x8, 8,
- row_scan_8x8_neighbors);
- init_scan_neighbors(col_scan_8x8, vp9_col_iscan_8x8, 8,
- col_scan_8x8_neighbors);
- init_scan_neighbors(default_scan_16x16, vp9_default_iscan_16x16, 16,
- default_scan_16x16_neighbors);
- init_scan_neighbors(row_scan_16x16, vp9_row_iscan_16x16, 16,
- row_scan_16x16_neighbors);
- init_scan_neighbors(col_scan_16x16, vp9_col_iscan_16x16, 16,
- col_scan_16x16_neighbors);
- init_scan_neighbors(default_scan_32x32, vp9_default_iscan_32x32, 32,
- default_scan_32x32_neighbors);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.h
deleted file mode 100644
index 9613b67..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_scan.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_SCAN_H_
-#define VP9_COMMON_VP9_SCAN_H_
-
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem.h"
-
-#include "vp9/common/vp9_enums.h"
-#include "vp9/common/vp9_blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_NEIGHBORS 2
-
-void vp9_init_neighbors();
-
-typedef struct {
- const int16_t *scan;
- const int16_t *iscan;
- const int16_t *neighbors;
-} scan_order;
-
-extern const scan_order vp9_default_scan_orders[TX_SIZES];
-extern const scan_order vp9_scan_orders[TX_SIZES][TX_TYPES];
-
-static INLINE int get_coef_context(const int16_t *neighbors,
- const uint8_t *token_cache, int c) {
- return (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
- token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_SCAN_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.c
deleted file mode 100644
index 910200e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_seg_common.h"
-#include "vp9/common/vp9_quant_common.h"
-
-static const int seg_feature_data_signed[SEG_LVL_MAX] = { 1, 1, 0, 0 };
-
-static const int seg_feature_data_max[SEG_LVL_MAX] = {
- MAXQ, MAX_LOOP_FILTER, 3, 0 };
-
-// These functions provide access to new segment level features.
-// Eventually these function may be "optimized out" but for the moment,
-// the coding mechanism is still subject to change so these provide a
-// convenient single point of change.
-
-int vp9_segfeature_active(const struct segmentation *seg, int segment_id,
- SEG_LVL_FEATURES feature_id) {
- return seg->enabled &&
- (seg->feature_mask[segment_id] & (1 << feature_id));
-}
-
-void vp9_clearall_segfeatures(struct segmentation *seg) {
- vp9_zero(seg->feature_data);
- vp9_zero(seg->feature_mask);
-}
-
-void vp9_enable_segfeature(struct segmentation *seg, int segment_id,
- SEG_LVL_FEATURES feature_id) {
- seg->feature_mask[segment_id] |= 1 << feature_id;
-}
-
-int vp9_seg_feature_data_max(SEG_LVL_FEATURES feature_id) {
- return seg_feature_data_max[feature_id];
-}
-
-int vp9_is_segfeature_signed(SEG_LVL_FEATURES feature_id) {
- return seg_feature_data_signed[feature_id];
-}
-
-void vp9_set_segdata(struct segmentation *seg, int segment_id,
- SEG_LVL_FEATURES feature_id, int seg_data) {
- assert(seg_data <= seg_feature_data_max[feature_id]);
- if (seg_data < 0) {
- assert(seg_feature_data_signed[feature_id]);
- assert(-seg_data <= seg_feature_data_max[feature_id]);
- }
-
- seg->feature_data[segment_id][feature_id] = seg_data;
-}
-
-int vp9_get_segdata(const struct segmentation *seg, int segment_id,
- SEG_LVL_FEATURES feature_id) {
- return seg->feature_data[segment_id][feature_id];
-}
-
-
-const vp9_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)] = {
- 2, 4, 6, 8, 10, 12,
- 0, -1, -2, -3, -4, -5, -6, -7
-};
-
-
-// TBD? Functions to read and write segment data with range / validity checking
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.h
deleted file mode 100644
index ff2d66a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_seg_common.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_SEG_COMMON_H_
-#define VP9_COMMON_VP9_SEG_COMMON_H_
-
-#include "vp9/common/vp9_prob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SEGMENT_DELTADATA 0
-#define SEGMENT_ABSDATA 1
-
-#define MAX_SEGMENTS 8
-#define SEG_TREE_PROBS (MAX_SEGMENTS-1)
-
-#define PREDICTION_PROBS 3
-
-// Segment level features.
-typedef enum {
- SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
- SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
- SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
- SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode
- SEG_LVL_MAX = 4 // Number of features supported
-} SEG_LVL_FEATURES;
-
-
-struct segmentation {
- uint8_t enabled;
- uint8_t update_map;
- uint8_t update_data;
- uint8_t abs_delta;
- uint8_t temporal_update;
-
- vp9_prob tree_probs[SEG_TREE_PROBS];
- vp9_prob pred_probs[PREDICTION_PROBS];
-
- int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX];
- unsigned int feature_mask[MAX_SEGMENTS];
-};
-
-int vp9_segfeature_active(const struct segmentation *seg,
- int segment_id,
- SEG_LVL_FEATURES feature_id);
-
-void vp9_clearall_segfeatures(struct segmentation *seg);
-
-void vp9_enable_segfeature(struct segmentation *seg,
- int segment_id,
- SEG_LVL_FEATURES feature_id);
-
-int vp9_seg_feature_data_max(SEG_LVL_FEATURES feature_id);
-
-int vp9_is_segfeature_signed(SEG_LVL_FEATURES feature_id);
-
-void vp9_set_segdata(struct segmentation *seg,
- int segment_id,
- SEG_LVL_FEATURES feature_id,
- int seg_data);
-
-int vp9_get_segdata(const struct segmentation *seg,
- int segment_id,
- SEG_LVL_FEATURES feature_id);
-
-extern const vp9_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)];
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_SEG_COMMON_H_
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_systemdependent.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_systemdependent.h
deleted file mode 100644
index 49518f1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_systemdependent.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
-#define VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
-
-#ifdef _MSC_VER
-# include <math.h> // the ceil() definition must precede intrin.h
-# if _MSC_VER > 1310 && (defined(_M_X64) || defined(_M_IX86))
-# include <intrin.h>
-# define USE_MSC_INTRIN
-# endif
-# define snprintf _snprintf
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "./vpx_config.h"
-#if ARCH_X86_32 || ARCH_X86_64
-void vpx_reset_mmx_state(void);
-#define vp9_clear_system_state() vpx_reset_mmx_state()
-#else
-#define vp9_clear_system_state()
-#endif
-
-#if defined(_MSC_VER) && _MSC_VER < 1800
-// round is not defined in MSVC before VS2013.
-static INLINE int round(double x) {
- if (x < 0)
- return (int)ceil(x - 0.5);
- else
- return (int)floor(x + 0.5);
-}
-#endif
-
-// use GNU builtins where available.
-#if defined(__GNUC__) && \
- ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
-static INLINE int get_msb(unsigned int n) {
- return 31 ^ __builtin_clz(n);
-}
-#elif defined(USE_MSC_INTRIN)
-#pragma intrinsic(_BitScanReverse)
-
-static INLINE int get_msb(unsigned int n) {
- unsigned long first_set_bit;
- _BitScanReverse(&first_set_bit, n);
- return first_set_bit;
-}
-#undef USE_MSC_INTRIN
-#else
-// Returns (int)floor(log2(n)). n must be > 0.
-static INLINE int get_msb(unsigned int n) {
- int log = 0;
- unsigned int value = n;
- int i;
-
- for (i = 4; i >= 0; --i) {
- const int shift = (1 << i);
- const unsigned int x = value >> shift;
- if (x != 0) {
- value = x;
- log += shift;
- }
- }
- return log;
-}
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tapify.py b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tapify.py
deleted file mode 100644
index 99529cf..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tapify.py
+++ /dev/null
@@ -1,106 +0,0 @@
-"""
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
-"""
-#!/usr/bin/env python
-import sys,string,os,re,math,numpy
-scale = 2**16
-def dist(p1,p2):
- x1,y1 = p1
- x2,y2 = p2
- if x1==x2 and y1==y2 :
- return 1.0
- return 1/ math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
-
-def gettaps(p):
- def l(b):
- return int(math.floor(b))
- def h(b):
- return int(math.ceil(b))
- def t(b,p,s):
- return int((scale*dist(b,p)+s/2)/s)
- r,c = p
- ul=[l(r),l(c)]
- ur=[l(r),h(c)]
- ll=[h(r),l(c)]
- lr=[h(r),h(c)]
- sum = dist(ul,p)+dist(ur,p)+dist(ll,p)+dist(lr,p)
- t4 = scale - t(ul,p,sum) - t(ur,p,sum) - t(ll,p,sum);
- return [[ul,t(ul,p,sum)],[ur,t(ur,p,sum)],
- [ll,t(ll,p,sum)],[lr,t4]]
-
-def print_mb_taps(angle,blocksize):
- theta = angle / 57.2957795;
- affine = [[math.cos(theta),-math.sin(theta)],
- [math.sin(theta),math.cos(theta)]]
- radius = (float(blocksize)-1)/2
- print " // angle of",angle,"degrees"
- for y in range(blocksize) :
- for x in range(blocksize) :
- r,c = numpy.dot(affine,[y-radius, x-radius])
- tps = gettaps([r+radius,c+radius])
- for t in tps :
- p,t = t
- tr,tc = p
- print " %2d, %2d, %5d, " % (tr,tc,t,),
- print " // %2d,%2d " % (y,x)
-
-i=float(sys.argv[1])
-while i <= float(sys.argv[2]) :
- print_mb_taps(i,float(sys.argv[4]))
- i=i+float(sys.argv[3])
-"""
-
-taps = []
-pt=dict()
-ptr=dict()
-for y in range(16) :
- for x in range(16) :
- r,c = numpy.dot(affine,[y-7.5, x-7.5])
- tps = gettaps([r+7.5,c+7.5])
- j=0
- for tp in tps :
- p,i = tp
- r,c = p
- pt[y,x,j]= [p,i]
- try:
- ptr[r,j,c].append([y,x])
- except:
- ptr[r,j,c]=[[y,x]]
- j = j+1
-
-for key in sorted(pt.keys()) :
- print key,pt[key]
-
-lr = -99
-lj = -99
-lc = 0
-
-shuf=""
-mask=""
-for r,j,c in sorted(ptr.keys()) :
- for y,x in ptr[r,j,c] :
- if lr != r or lj != j :
- print "shuf_"+str(lr)+"_"+str(lj)+"_"+shuf.ljust(16,"0"), lc
- shuf=""
- lc = 0
- for i in range(lc,c-1) :
- shuf = shuf +"0"
- shuf = shuf + hex(x)[2]
- lc =c
- break
- lr = r
- lj = j
-# print r,j,c,ptr[r,j,c]
-# print
-
-for r,j,c in sorted(ptr.keys()) :
- for y,x in ptr[r,j,c] :
- print r,j,c,y,x
- break
-"""
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.c
deleted file mode 100644
index 60e95e0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "vp9/common/vp9_textblit.h"
-
-static const int font[] = {
- 0x0, 0x5C00, 0x8020, 0xAFABEA, 0xD7EC0, 0x1111111, 0x1855740, 0x18000,
- 0x45C0, 0x74400, 0x51140, 0x23880, 0xC4000, 0x21080, 0x80000, 0x111110,
- 0xE9D72E, 0x87E40, 0x12AD732, 0xAAD62A, 0x4F94C4, 0x4D6B7, 0x456AA,
- 0x3E8423, 0xAAD6AA, 0xAAD6A2, 0x2800, 0x2A00, 0x8A880, 0x52940, 0x22A20,
- 0x15422, 0x6AD62E, 0x1E4A53E, 0xAAD6BF, 0x8C62E, 0xE8C63F, 0x118D6BF,
- 0x1094BF, 0xCAC62E, 0x1F2109F, 0x118FE31, 0xF8C628, 0x8A89F, 0x108421F,
- 0x1F1105F, 0x1F4105F, 0xE8C62E, 0x2294BF, 0x164C62E, 0x12694BF, 0x8AD6A2,
- 0x10FC21, 0x1F8421F, 0x744107, 0xF8220F, 0x1151151, 0x117041, 0x119D731,
- 0x47E0, 0x1041041, 0xFC400, 0x10440, 0x1084210, 0x820
-};
-
-static void plot(int x, int y, unsigned char *image, int pitch) {
- image[x + y * pitch] ^= 255;
-}
-
-void vp9_blit_text(const char *msg, unsigned char *address, const int pitch) {
- int letter_bitmap;
- unsigned char *output_pos = address;
- int colpos = 0;
-
- while (msg[colpos] != 0) {
- char letter = msg[colpos];
- int fontcol, fontrow;
-
- if (letter <= 'Z' && letter >= ' ')
- letter_bitmap = font[letter - ' '];
- else if (letter <= 'z' && letter >= 'a')
- letter_bitmap = font[letter - 'a' + 'A' - ' '];
- else
- letter_bitmap = font[0];
-
- for (fontcol = 6; fontcol >= 0; fontcol--)
- for (fontrow = 0; fontrow < 5; fontrow++)
- output_pos[fontrow * pitch + fontcol] =
- ((letter_bitmap >> (fontcol * 5)) & (1 << fontrow) ? 255 : 0);
-
- output_pos += 7;
- colpos++;
- }
-}
-
-
-
-/* Bresenham line algorithm */
-void vp9_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
- int pitch) {
- int steep = abs(y1 - y0) > abs(x1 - x0);
- int deltax, deltay;
- int error, ystep, y, x;
-
- if (steep) {
- int t;
- t = x0;
- x0 = y0;
- y0 = t;
-
- t = x1;
- x1 = y1;
- y1 = t;
- }
-
- if (x0 > x1) {
- int t;
- t = x0;
- x0 = x1;
- x1 = t;
-
- t = y0;
- y0 = y1;
- y1 = t;
- }
-
- deltax = x1 - x0;
- deltay = abs(y1 - y0);
- error = deltax / 2;
-
- y = y0;
-
- if (y0 < y1)
- ystep = 1;
- else
- ystep = -1;
-
- if (steep) {
- for (x = x0; x <= x1; x++) {
- plot(y, x, image, pitch);
-
- error = error - deltay;
- if (error < 0) {
- y = y + ystep;
- error = error + deltax;
- }
- }
- } else {
- for (x = x0; x <= x1; x++) {
- plot(x, y, image, pitch);
-
- error = error - deltay;
- if (error < 0) {
- y = y + ystep;
- error = error + deltax;
- }
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.h
deleted file mode 100644
index 158ec1b..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_textblit.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_TEXTBLIT_H_
-#define VP9_COMMON_VP9_TEXTBLIT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_blit_text(const char *msg, unsigned char *address, int pitch);
-
-void vp9_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
- int pitch);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_TEXTBLIT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.c b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.c
deleted file mode 100644
index 78909dd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_tile_common.h"
-
-#include "vp9/common/vp9_onyxc_int.h"
-
-#define MIN_TILE_WIDTH_B64 4
-#define MAX_TILE_WIDTH_B64 64
-
-static int get_tile_offset(int idx, int mis, int log2) {
- const int sb_cols = mi_cols_aligned_to_sb(mis) >> MI_BLOCK_SIZE_LOG2;
- const int offset = ((idx * sb_cols) >> log2) << MI_BLOCK_SIZE_LOG2;
- return MIN(offset, mis);
-}
-
-void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm, int row, int col) {
- tile->mi_row_start = get_tile_offset(row, cm->mi_rows, cm->log2_tile_rows);
- tile->mi_row_end = get_tile_offset(row + 1, cm->mi_rows, cm->log2_tile_rows);
- tile->mi_col_start = get_tile_offset(col, cm->mi_cols, cm->log2_tile_cols);
- tile->mi_col_end = get_tile_offset(col + 1, cm->mi_cols, cm->log2_tile_cols);
-}
-
-void vp9_get_tile_n_bits(int mi_cols,
- int *min_log2_tile_cols, int *max_log2_tile_cols) {
- const int sb_cols = mi_cols_aligned_to_sb(mi_cols) >> MI_BLOCK_SIZE_LOG2;
- int min_log2 = 0, max_log2 = 0;
-
- // max
- while ((sb_cols >> max_log2) >= MIN_TILE_WIDTH_B64)
- ++max_log2;
- --max_log2;
- if (max_log2 < 0)
- max_log2 = 0;
-
- // min
- while ((MAX_TILE_WIDTH_B64 << min_log2) < sb_cols)
- ++min_log2;
-
- assert(min_log2 <= max_log2);
-
- *min_log2_tile_cols = min_log2;
- *max_log2_tile_cols = max_log2;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.h b/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.h
deleted file mode 100644
index a97719e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/vp9_tile_common.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_TILE_COMMON_H_
-#define VP9_COMMON_VP9_TILE_COMMON_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP9Common;
-
-typedef struct TileInfo {
- int mi_row_start, mi_row_end;
- int mi_col_start, mi_col_end;
-} TileInfo;
-
-// initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on
-// 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)'
-void vp9_tile_init(TileInfo *tile, const struct VP9Common *cm,
- int row, int col);
-
-void vp9_get_tile_n_bits(int mi_cols,
- int *min_log2_tile_cols, int *max_log2_tile_cols);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_VP9_TILE_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_asm_stubs.c b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_asm_stubs.c
deleted file mode 100644
index 1b4904c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_asm_stubs.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-#include "vpx_ports/mem.h"
-
-typedef void filter8_1dfunction (
- const unsigned char *src_ptr,
- const ptrdiff_t src_pitch,
- unsigned char *output_ptr,
- ptrdiff_t out_pitch,
- unsigned int output_height,
- const short *filter
-);
-
-#define FUN_CONV_1D(name, step_q4, filter, dir, src_start, avg, opt) \
- void vp9_convolve8_##name##_##opt(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) { \
- if (step_q4 == 16 && filter[3] != 128) { \
- if (filter[0] || filter[1] || filter[2]) { \
- while (w >= 16) { \
- vp9_filter_block1d16_##dir##8_##avg##opt(src_start, \
- src_stride, \
- dst, \
- dst_stride, \
- h, \
- filter); \
- src += 16; \
- dst += 16; \
- w -= 16; \
- } \
- while (w >= 8) { \
- vp9_filter_block1d8_##dir##8_##avg##opt(src_start, \
- src_stride, \
- dst, \
- dst_stride, \
- h, \
- filter); \
- src += 8; \
- dst += 8; \
- w -= 8; \
- } \
- while (w >= 4) { \
- vp9_filter_block1d4_##dir##8_##avg##opt(src_start, \
- src_stride, \
- dst, \
- dst_stride, \
- h, \
- filter); \
- src += 4; \
- dst += 4; \
- w -= 4; \
- } \
- } else { \
- while (w >= 16) { \
- vp9_filter_block1d16_##dir##2_##avg##opt(src, \
- src_stride, \
- dst, \
- dst_stride, \
- h, \
- filter); \
- src += 16; \
- dst += 16; \
- w -= 16; \
- } \
- while (w >= 8) { \
- vp9_filter_block1d8_##dir##2_##avg##opt(src, \
- src_stride, \
- dst, \
- dst_stride, \
- h, \
- filter); \
- src += 8; \
- dst += 8; \
- w -= 8; \
- } \
- while (w >= 4) { \
- vp9_filter_block1d4_##dir##2_##avg##opt(src, \
- src_stride, \
- dst, \
- dst_stride, \
- h, \
- filter); \
- src += 4; \
- dst += 4; \
- w -= 4; \
- } \
- } \
- } \
- if (w) { \
- vp9_convolve8_##name##_c(src, src_stride, dst, dst_stride, \
- filter_x, x_step_q4, filter_y, y_step_q4, \
- w, h); \
- } \
-}
-
-#define FUN_CONV_2D(avg, opt) \
-void vp9_convolve8_##avg##opt(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) { \
- assert(w <= 64); \
- assert(h <= 64); \
- if (x_step_q4 == 16 && y_step_q4 == 16) { \
- if (filter_x[0] || filter_x[1] || filter_x[2] || filter_x[3] == 128 || \
- filter_y[0] || filter_y[1] || filter_y[2] || filter_y[3] == 128) { \
- DECLARE_ALIGNED_ARRAY(16, unsigned char, fdata2, 64 * 71); \
- vp9_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64, \
- filter_x, x_step_q4, filter_y, y_step_q4, \
- w, h + 7); \
- vp9_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride, \
- filter_x, x_step_q4, filter_y, \
- y_step_q4, w, h); \
- } else { \
- DECLARE_ALIGNED_ARRAY(16, unsigned char, fdata2, 64 * 65); \
- vp9_convolve8_horiz_##opt(src, src_stride, fdata2, 64, \
- filter_x, x_step_q4, filter_y, y_step_q4, \
- w, h + 1); \
- vp9_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, \
- filter_x, x_step_q4, filter_y, \
- y_step_q4, w, h); \
- } \
- } else { \
- vp9_convolve8_##avg##c(src, src_stride, dst, dst_stride, \
- filter_x, x_step_q4, filter_y, y_step_q4, w, h); \
- } \
-}
-#if HAVE_AVX2
-filter8_1dfunction vp9_filter_block1d16_v8_avx2;
-filter8_1dfunction vp9_filter_block1d16_h8_avx2;
-filter8_1dfunction vp9_filter_block1d4_v8_ssse3;
-#if (ARCH_X86_64)
-filter8_1dfunction vp9_filter_block1d8_v8_intrin_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h8_intrin_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h8_intrin_ssse3;
-#define vp9_filter_block1d8_v8_avx2 vp9_filter_block1d8_v8_intrin_ssse3
-#define vp9_filter_block1d8_h8_avx2 vp9_filter_block1d8_h8_intrin_ssse3
-#define vp9_filter_block1d4_h8_avx2 vp9_filter_block1d4_h8_intrin_ssse3
-#else
-filter8_1dfunction vp9_filter_block1d8_v8_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h8_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h8_ssse3;
-#define vp9_filter_block1d8_v8_avx2 vp9_filter_block1d8_v8_ssse3
-#define vp9_filter_block1d8_h8_avx2 vp9_filter_block1d8_h8_ssse3
-#define vp9_filter_block1d4_h8_avx2 vp9_filter_block1d4_h8_ssse3
-#endif
-filter8_1dfunction vp9_filter_block1d16_v2_ssse3;
-filter8_1dfunction vp9_filter_block1d16_h2_ssse3;
-filter8_1dfunction vp9_filter_block1d8_v2_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h2_ssse3;
-filter8_1dfunction vp9_filter_block1d4_v2_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h2_ssse3;
-#define vp9_filter_block1d4_v8_avx2 vp9_filter_block1d4_v8_ssse3
-#define vp9_filter_block1d16_v2_avx2 vp9_filter_block1d16_v2_ssse3
-#define vp9_filter_block1d16_h2_avx2 vp9_filter_block1d16_h2_ssse3
-#define vp9_filter_block1d8_v2_avx2 vp9_filter_block1d8_v2_ssse3
-#define vp9_filter_block1d8_h2_avx2 vp9_filter_block1d8_h2_ssse3
-#define vp9_filter_block1d4_v2_avx2 vp9_filter_block1d4_v2_ssse3
-#define vp9_filter_block1d4_h2_avx2 vp9_filter_block1d4_h2_ssse3
-// void vp9_convolve8_horiz_avx2(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);
-// void vp9_convolve8_vert_avx2(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);
-FUN_CONV_1D(horiz, x_step_q4, filter_x, h, src, , avx2);
-FUN_CONV_1D(vert, y_step_q4, filter_y, v, src - src_stride * 3, , avx2);
-
-// void vp9_convolve8_avx2(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);
-FUN_CONV_2D(, avx2);
-#endif
-#if HAVE_SSSE3
-#if (ARCH_X86_64)
-filter8_1dfunction vp9_filter_block1d16_v8_intrin_ssse3;
-filter8_1dfunction vp9_filter_block1d16_h8_intrin_ssse3;
-filter8_1dfunction vp9_filter_block1d8_v8_intrin_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h8_intrin_ssse3;
-filter8_1dfunction vp9_filter_block1d4_v8_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h8_intrin_ssse3;
-#define vp9_filter_block1d16_v8_ssse3 vp9_filter_block1d16_v8_intrin_ssse3
-#define vp9_filter_block1d16_h8_ssse3 vp9_filter_block1d16_h8_intrin_ssse3
-#define vp9_filter_block1d8_v8_ssse3 vp9_filter_block1d8_v8_intrin_ssse3
-#define vp9_filter_block1d8_h8_ssse3 vp9_filter_block1d8_h8_intrin_ssse3
-#define vp9_filter_block1d4_h8_ssse3 vp9_filter_block1d4_h8_intrin_ssse3
-#else
-filter8_1dfunction vp9_filter_block1d16_v8_ssse3;
-filter8_1dfunction vp9_filter_block1d16_h8_ssse3;
-filter8_1dfunction vp9_filter_block1d8_v8_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h8_ssse3;
-filter8_1dfunction vp9_filter_block1d4_v8_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h8_ssse3;
-#endif
-filter8_1dfunction vp9_filter_block1d16_v8_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d16_h8_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d8_v8_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h8_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d4_v8_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h8_avg_ssse3;
-
-filter8_1dfunction vp9_filter_block1d16_v2_ssse3;
-filter8_1dfunction vp9_filter_block1d16_h2_ssse3;
-filter8_1dfunction vp9_filter_block1d8_v2_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h2_ssse3;
-filter8_1dfunction vp9_filter_block1d4_v2_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h2_ssse3;
-filter8_1dfunction vp9_filter_block1d16_v2_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d16_h2_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d8_v2_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d8_h2_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d4_v2_avg_ssse3;
-filter8_1dfunction vp9_filter_block1d4_h2_avg_ssse3;
-
-// void vp9_convolve8_horiz_ssse3(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);
-// void vp9_convolve8_vert_ssse3(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);
-// void vp9_convolve8_avg_horiz_ssse3(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);
-// void vp9_convolve8_avg_vert_ssse3(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);
-FUN_CONV_1D(horiz, x_step_q4, filter_x, h, src, , ssse3);
-FUN_CONV_1D(vert, y_step_q4, filter_y, v, src - src_stride * 3, , ssse3);
-FUN_CONV_1D(avg_horiz, x_step_q4, filter_x, h, src, avg_, ssse3);
-FUN_CONV_1D(avg_vert, y_step_q4, filter_y, v, src - src_stride * 3, avg_,
- ssse3);
-
-// void vp9_convolve8_ssse3(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);
-// void vp9_convolve8_avg_ssse3(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);
-FUN_CONV_2D(, ssse3);
-FUN_CONV_2D(avg_ , ssse3);
-#endif
-
-#if HAVE_SSE2
-filter8_1dfunction vp9_filter_block1d16_v8_sse2;
-filter8_1dfunction vp9_filter_block1d16_h8_sse2;
-filter8_1dfunction vp9_filter_block1d8_v8_sse2;
-filter8_1dfunction vp9_filter_block1d8_h8_sse2;
-filter8_1dfunction vp9_filter_block1d4_v8_sse2;
-filter8_1dfunction vp9_filter_block1d4_h8_sse2;
-filter8_1dfunction vp9_filter_block1d16_v8_avg_sse2;
-filter8_1dfunction vp9_filter_block1d16_h8_avg_sse2;
-filter8_1dfunction vp9_filter_block1d8_v8_avg_sse2;
-filter8_1dfunction vp9_filter_block1d8_h8_avg_sse2;
-filter8_1dfunction vp9_filter_block1d4_v8_avg_sse2;
-filter8_1dfunction vp9_filter_block1d4_h8_avg_sse2;
-
-filter8_1dfunction vp9_filter_block1d16_v2_sse2;
-filter8_1dfunction vp9_filter_block1d16_h2_sse2;
-filter8_1dfunction vp9_filter_block1d8_v2_sse2;
-filter8_1dfunction vp9_filter_block1d8_h2_sse2;
-filter8_1dfunction vp9_filter_block1d4_v2_sse2;
-filter8_1dfunction vp9_filter_block1d4_h2_sse2;
-filter8_1dfunction vp9_filter_block1d16_v2_avg_sse2;
-filter8_1dfunction vp9_filter_block1d16_h2_avg_sse2;
-filter8_1dfunction vp9_filter_block1d8_v2_avg_sse2;
-filter8_1dfunction vp9_filter_block1d8_h2_avg_sse2;
-filter8_1dfunction vp9_filter_block1d4_v2_avg_sse2;
-filter8_1dfunction vp9_filter_block1d4_h2_avg_sse2;
-
-// void vp9_convolve8_horiz_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);
-// void vp9_convolve8_vert_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);
-// void vp9_convolve8_avg_horiz_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);
-// void vp9_convolve8_avg_vert_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);
-FUN_CONV_1D(horiz, x_step_q4, filter_x, h, src, , sse2);
-FUN_CONV_1D(vert, y_step_q4, filter_y, v, src - src_stride * 3, , sse2);
-FUN_CONV_1D(avg_horiz, x_step_q4, filter_x, h, src, avg_, sse2);
-FUN_CONV_1D(avg_vert, y_step_q4, filter_y, v, src - src_stride * 3, avg_, sse2);
-
-// void vp9_convolve8_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);
-// void vp9_convolve8_avg_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);
-FUN_CONV_2D(, sse2);
-FUN_CONV_2D(avg_ , sse2);
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_copy_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_copy_sse2.asm
deleted file mode 100644
index dd522c6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_copy_sse2.asm
+++ /dev/null
@@ -1,152 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION .text
-
-%macro convolve_fn 1
-INIT_XMM sse2
-cglobal convolve_%1, 4, 7, 4, src, src_stride, dst, dst_stride, \
- fx, fxs, fy, fys, w, h
- mov r4d, dword wm
- cmp r4d, 4
- je .w4
- cmp r4d, 8
- je .w8
- cmp r4d, 16
- je .w16
- cmp r4d, 32
- je .w32
-
- mov r4d, dword hm
-.loop64:
- movu m0, [srcq]
- movu m1, [srcq+16]
- movu m2, [srcq+32]
- movu m3, [srcq+48]
- add srcq, src_strideq
-%ifidn %1, avg
- pavgb m0, [dstq]
- pavgb m1, [dstq+16]
- pavgb m2, [dstq+32]
- pavgb m3, [dstq+48]
-%endif
- mova [dstq ], m0
- mova [dstq+16], m1
- mova [dstq+32], m2
- mova [dstq+48], m3
- add dstq, dst_strideq
- dec r4d
- jnz .loop64
- RET
-
-.w32:
- mov r4d, dword hm
-.loop32:
- movu m0, [srcq]
- movu m1, [srcq+16]
- movu m2, [srcq+src_strideq]
- movu m3, [srcq+src_strideq+16]
- lea srcq, [srcq+src_strideq*2]
-%ifidn %1, avg
- pavgb m0, [dstq]
- pavgb m1, [dstq +16]
- pavgb m2, [dstq+dst_strideq]
- pavgb m3, [dstq+dst_strideq+16]
-%endif
- mova [dstq ], m0
- mova [dstq +16], m1
- mova [dstq+dst_strideq ], m2
- mova [dstq+dst_strideq+16], m3
- lea dstq, [dstq+dst_strideq*2]
- sub r4d, 2
- jnz .loop32
- RET
-
-.w16:
- mov r4d, dword hm
- lea r5q, [src_strideq*3]
- lea r6q, [dst_strideq*3]
-.loop16:
- movu m0, [srcq]
- movu m1, [srcq+src_strideq]
- movu m2, [srcq+src_strideq*2]
- movu m3, [srcq+r5q]
- lea srcq, [srcq+src_strideq*4]
-%ifidn %1, avg
- pavgb m0, [dstq]
- pavgb m1, [dstq+dst_strideq]
- pavgb m2, [dstq+dst_strideq*2]
- pavgb m3, [dstq+r6q]
-%endif
- mova [dstq ], m0
- mova [dstq+dst_strideq ], m1
- mova [dstq+dst_strideq*2], m2
- mova [dstq+r6q ], m3
- lea dstq, [dstq+dst_strideq*4]
- sub r4d, 4
- jnz .loop16
- RET
-
-INIT_MMX sse
-.w8:
- mov r4d, dword hm
- lea r5q, [src_strideq*3]
- lea r6q, [dst_strideq*3]
-.loop8:
- movu m0, [srcq]
- movu m1, [srcq+src_strideq]
- movu m2, [srcq+src_strideq*2]
- movu m3, [srcq+r5q]
- lea srcq, [srcq+src_strideq*4]
-%ifidn %1, avg
- pavgb m0, [dstq]
- pavgb m1, [dstq+dst_strideq]
- pavgb m2, [dstq+dst_strideq*2]
- pavgb m3, [dstq+r6q]
-%endif
- mova [dstq ], m0
- mova [dstq+dst_strideq ], m1
- mova [dstq+dst_strideq*2], m2
- mova [dstq+r6q ], m3
- lea dstq, [dstq+dst_strideq*4]
- sub r4d, 4
- jnz .loop8
- RET
-
-.w4:
- mov r4d, dword hm
- lea r5q, [src_strideq*3]
- lea r6q, [dst_strideq*3]
-.loop4:
- movh m0, [srcq]
- movh m1, [srcq+src_strideq]
- movh m2, [srcq+src_strideq*2]
- movh m3, [srcq+r5q]
- lea srcq, [srcq+src_strideq*4]
-%ifidn %1, avg
- pavgb m0, [dstq]
- pavgb m1, [dstq+dst_strideq]
- pavgb m2, [dstq+dst_strideq*2]
- pavgb m3, [dstq+r6q]
-%endif
- movh [dstq ], m0
- movh [dstq+dst_strideq ], m1
- movh [dstq+dst_strideq*2], m2
- movh [dstq+r6q ], m3
- lea dstq, [dstq+dst_strideq*4]
- sub r4d, 4
- jnz .loop4
- RET
-%endmacro
-
-convolve_fn copy
-convolve_fn avg
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_idct_intrin_sse2.c b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_idct_intrin_sse2.c
deleted file mode 100644
index 13a5b5a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_idct_intrin_sse2.c
+++ /dev/null
@@ -1,4158 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <emmintrin.h> // SSE2
-#include "./vpx_config.h"
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_idct.h"
-
-#define RECON_AND_STORE4X4(dest, in_x) \
-{ \
- __m128i d0 = _mm_cvtsi32_si128(*(const int *)(dest)); \
- d0 = _mm_unpacklo_epi8(d0, zero); \
- d0 = _mm_add_epi16(in_x, d0); \
- d0 = _mm_packus_epi16(d0, d0); \
- *(int *)dest = _mm_cvtsi128_si32(d0); \
- dest += stride; \
-}
-
-void vp9_idct4x4_16_add_sse2(const int16_t *input, uint8_t *dest, int stride) {
- const __m128i zero = _mm_setzero_si128();
- const __m128i eight = _mm_set1_epi16(8);
- const __m128i cst = _mm_setr_epi16((int16_t)cospi_16_64, (int16_t)cospi_16_64,
- (int16_t)cospi_16_64, (int16_t)-cospi_16_64,
- (int16_t)cospi_24_64, (int16_t)-cospi_8_64,
- (int16_t)cospi_8_64, (int16_t)cospi_24_64);
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i input0, input1, input2, input3;
-
- // Rows
- input0 = _mm_load_si128((const __m128i *)input);
- input2 = _mm_load_si128((const __m128i *)(input + 8));
-
- // Construct i3, i1, i3, i1, i2, i0, i2, i0
- input0 = _mm_shufflelo_epi16(input0, 0xd8);
- input0 = _mm_shufflehi_epi16(input0, 0xd8);
- input2 = _mm_shufflelo_epi16(input2, 0xd8);
- input2 = _mm_shufflehi_epi16(input2, 0xd8);
-
- input1 = _mm_unpackhi_epi32(input0, input0);
- input0 = _mm_unpacklo_epi32(input0, input0);
- input3 = _mm_unpackhi_epi32(input2, input2);
- input2 = _mm_unpacklo_epi32(input2, input2);
-
- // Stage 1
- input0 = _mm_madd_epi16(input0, cst);
- input1 = _mm_madd_epi16(input1, cst);
- input2 = _mm_madd_epi16(input2, cst);
- input3 = _mm_madd_epi16(input3, cst);
-
- input0 = _mm_add_epi32(input0, rounding);
- input1 = _mm_add_epi32(input1, rounding);
- input2 = _mm_add_epi32(input2, rounding);
- input3 = _mm_add_epi32(input3, rounding);
-
- input0 = _mm_srai_epi32(input0, DCT_CONST_BITS);
- input1 = _mm_srai_epi32(input1, DCT_CONST_BITS);
- input2 = _mm_srai_epi32(input2, DCT_CONST_BITS);
- input3 = _mm_srai_epi32(input3, DCT_CONST_BITS);
-
- // Stage 2
- input0 = _mm_packs_epi32(input0, input1);
- input1 = _mm_packs_epi32(input2, input3);
-
- // Transpose
- input2 = _mm_unpacklo_epi16(input0, input1);
- input3 = _mm_unpackhi_epi16(input0, input1);
- input0 = _mm_unpacklo_epi32(input2, input3);
- input1 = _mm_unpackhi_epi32(input2, input3);
-
- // Switch column2, column 3, and then, we got:
- // input2: column1, column 0; input3: column2, column 3.
- input1 = _mm_shuffle_epi32(input1, 0x4e);
- input2 = _mm_add_epi16(input0, input1);
- input3 = _mm_sub_epi16(input0, input1);
-
- // Columns
- // Construct i3, i1, i3, i1, i2, i0, i2, i0
- input0 = _mm_unpacklo_epi32(input2, input2);
- input1 = _mm_unpackhi_epi32(input2, input2);
- input2 = _mm_unpackhi_epi32(input3, input3);
- input3 = _mm_unpacklo_epi32(input3, input3);
-
- // Stage 1
- input0 = _mm_madd_epi16(input0, cst);
- input1 = _mm_madd_epi16(input1, cst);
- input2 = _mm_madd_epi16(input2, cst);
- input3 = _mm_madd_epi16(input3, cst);
-
- input0 = _mm_add_epi32(input0, rounding);
- input1 = _mm_add_epi32(input1, rounding);
- input2 = _mm_add_epi32(input2, rounding);
- input3 = _mm_add_epi32(input3, rounding);
-
- input0 = _mm_srai_epi32(input0, DCT_CONST_BITS);
- input1 = _mm_srai_epi32(input1, DCT_CONST_BITS);
- input2 = _mm_srai_epi32(input2, DCT_CONST_BITS);
- input3 = _mm_srai_epi32(input3, DCT_CONST_BITS);
-
- // Stage 2
- input0 = _mm_packs_epi32(input0, input2);
- input1 = _mm_packs_epi32(input1, input3);
-
- // Transpose
- input2 = _mm_unpacklo_epi16(input0, input1);
- input3 = _mm_unpackhi_epi16(input0, input1);
- input0 = _mm_unpacklo_epi32(input2, input3);
- input1 = _mm_unpackhi_epi32(input2, input3);
-
- // Switch column2, column 3, and then, we got:
- // input2: column1, column 0; input3: column2, column 3.
- input1 = _mm_shuffle_epi32(input1, 0x4e);
- input2 = _mm_add_epi16(input0, input1);
- input3 = _mm_sub_epi16(input0, input1);
-
- // Final round and shift
- input2 = _mm_add_epi16(input2, eight);
- input3 = _mm_add_epi16(input3, eight);
-
- input2 = _mm_srai_epi16(input2, 4);
- input3 = _mm_srai_epi16(input3, 4);
-
- // Reconstruction and Store
- {
- __m128i d0 = _mm_cvtsi32_si128(*(const int *)(dest));
- __m128i d2 = _mm_cvtsi32_si128(*(const int *)(dest + stride * 2));
- d0 = _mm_unpacklo_epi32(d0,
- _mm_cvtsi32_si128(*(const int *) (dest + stride)));
- d2 = _mm_unpacklo_epi32(_mm_cvtsi32_si128(
- *(const int *) (dest + stride * 3)), d2);
- d0 = _mm_unpacklo_epi8(d0, zero);
- d2 = _mm_unpacklo_epi8(d2, zero);
- d0 = _mm_add_epi16(d0, input2);
- d2 = _mm_add_epi16(d2, input3);
- d0 = _mm_packus_epi16(d0, d2);
- // store input0
- *(int *)dest = _mm_cvtsi128_si32(d0);
- // store input1
- d0 = _mm_srli_si128(d0, 4);
- *(int *)(dest + stride) = _mm_cvtsi128_si32(d0);
- // store input2
- d0 = _mm_srli_si128(d0, 4);
- *(int *)(dest + stride * 3) = _mm_cvtsi128_si32(d0);
- // store input3
- d0 = _mm_srli_si128(d0, 4);
- *(int *)(dest + stride * 2) = _mm_cvtsi128_si32(d0);
- }
-}
-
-void vp9_idct4x4_1_add_sse2(const int16_t *input, uint8_t *dest, int stride) {
- __m128i dc_value;
- const __m128i zero = _mm_setzero_si128();
- int a;
-
- a = dct_const_round_shift(input[0] * cospi_16_64);
- a = dct_const_round_shift(a * cospi_16_64);
- a = ROUND_POWER_OF_TWO(a, 4);
-
- dc_value = _mm_set1_epi16(a);
-
- RECON_AND_STORE4X4(dest, dc_value);
- RECON_AND_STORE4X4(dest, dc_value);
- RECON_AND_STORE4X4(dest, dc_value);
- RECON_AND_STORE4X4(dest, dc_value);
-}
-
-static INLINE void transpose_4x4(__m128i *res) {
- const __m128i tr0_0 = _mm_unpacklo_epi16(res[0], res[1]);
- const __m128i tr0_1 = _mm_unpackhi_epi16(res[0], res[1]);
-
- res[0] = _mm_unpacklo_epi16(tr0_0, tr0_1);
- res[1] = _mm_unpackhi_epi16(tr0_0, tr0_1);
-}
-
-static void idct4_sse2(__m128i *in) {
- const __m128i k__cospi_p16_p16 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i u[8], v[8];
-
- transpose_4x4(in);
- // stage 1
- u[0] = _mm_unpacklo_epi16(in[0], in[1]);
- u[1] = _mm_unpackhi_epi16(in[0], in[1]);
- v[0] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[1] = _mm_madd_epi16(u[0], k__cospi_p16_m16);
- v[2] = _mm_madd_epi16(u[1], k__cospi_p24_m08);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p08_p24);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
-
- u[0] = _mm_packs_epi32(v[0], v[1]);
- u[1] = _mm_packs_epi32(v[3], v[2]);
-
- // stage 2
- in[0] = _mm_add_epi16(u[0], u[1]);
- in[1] = _mm_sub_epi16(u[0], u[1]);
- in[1] = _mm_shuffle_epi32(in[1], 0x4E);
-}
-
-static void iadst4_sse2(__m128i *in) {
- const __m128i k__sinpi_p01_p04 = pair_set_epi16(sinpi_1_9, sinpi_4_9);
- const __m128i k__sinpi_p03_p02 = pair_set_epi16(sinpi_3_9, sinpi_2_9);
- const __m128i k__sinpi_p02_m01 = pair_set_epi16(sinpi_2_9, -sinpi_1_9);
- const __m128i k__sinpi_p03_m04 = pair_set_epi16(sinpi_3_9, -sinpi_4_9);
- const __m128i k__sinpi_p03_p03 = _mm_set1_epi16(sinpi_3_9);
- const __m128i kZero = _mm_set1_epi16(0);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i u[8], v[8], in7;
-
- transpose_4x4(in);
- in7 = _mm_srli_si128(in[1], 8);
- in7 = _mm_add_epi16(in7, in[0]);
- in7 = _mm_sub_epi16(in7, in[1]);
-
- u[0] = _mm_unpacklo_epi16(in[0], in[1]);
- u[1] = _mm_unpackhi_epi16(in[0], in[1]);
- u[2] = _mm_unpacklo_epi16(in7, kZero);
- u[3] = _mm_unpackhi_epi16(in[0], kZero);
-
- v[0] = _mm_madd_epi16(u[0], k__sinpi_p01_p04); // s0 + s3
- v[1] = _mm_madd_epi16(u[1], k__sinpi_p03_p02); // s2 + s5
- v[2] = _mm_madd_epi16(u[2], k__sinpi_p03_p03); // x2
- v[3] = _mm_madd_epi16(u[0], k__sinpi_p02_m01); // s1 - s4
- v[4] = _mm_madd_epi16(u[1], k__sinpi_p03_m04); // s2 - s6
- v[5] = _mm_madd_epi16(u[3], k__sinpi_p03_p03); // s2
-
- u[0] = _mm_add_epi32(v[0], v[1]);
- u[1] = _mm_add_epi32(v[3], v[4]);
- u[2] = v[2];
- u[3] = _mm_add_epi32(u[0], u[1]);
- u[4] = _mm_slli_epi32(v[5], 2);
- u[5] = _mm_add_epi32(u[3], v[5]);
- u[6] = _mm_sub_epi32(u[5], u[4]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u[0], u[1]);
- in[1] = _mm_packs_epi32(u[2], u[3]);
-}
-
-void vp9_iht4x4_16_add_sse2(const int16_t *input, uint8_t *dest, int stride,
- int tx_type) {
- __m128i in[2];
- const __m128i zero = _mm_setzero_si128();
- const __m128i eight = _mm_set1_epi16(8);
-
- in[0]= _mm_loadu_si128((const __m128i *)(input));
- in[1]= _mm_loadu_si128((const __m128i *)(input + 8));
-
- switch (tx_type) {
- case 0: // DCT_DCT
- idct4_sse2(in);
- idct4_sse2(in);
- break;
- case 1: // ADST_DCT
- idct4_sse2(in);
- iadst4_sse2(in);
- break;
- case 2: // DCT_ADST
- iadst4_sse2(in);
- idct4_sse2(in);
- break;
- case 3: // ADST_ADST
- iadst4_sse2(in);
- iadst4_sse2(in);
- break;
- default:
- assert(0);
- break;
- }
-
- // Final round and shift
- in[0] = _mm_add_epi16(in[0], eight);
- in[1] = _mm_add_epi16(in[1], eight);
-
- in[0] = _mm_srai_epi16(in[0], 4);
- in[1] = _mm_srai_epi16(in[1], 4);
-
- // Reconstruction and Store
- {
- __m128i d0 = _mm_cvtsi32_si128(*(const int *)(dest));
- __m128i d2 = _mm_cvtsi32_si128(*(const int *)(dest + stride * 2));
- d0 = _mm_unpacklo_epi32(d0,
- _mm_cvtsi32_si128(*(const int *) (dest + stride)));
- d2 = _mm_unpacklo_epi32(d2, _mm_cvtsi32_si128(
- *(const int *) (dest + stride * 3)));
- d0 = _mm_unpacklo_epi8(d0, zero);
- d2 = _mm_unpacklo_epi8(d2, zero);
- d0 = _mm_add_epi16(d0, in[0]);
- d2 = _mm_add_epi16(d2, in[1]);
- d0 = _mm_packus_epi16(d0, d2);
- // store result[0]
- *(int *)dest = _mm_cvtsi128_si32(d0);
- // store result[1]
- d0 = _mm_srli_si128(d0, 4);
- *(int *)(dest + stride) = _mm_cvtsi128_si32(d0);
- // store result[2]
- d0 = _mm_srli_si128(d0, 4);
- *(int *)(dest + stride * 2) = _mm_cvtsi128_si32(d0);
- // store result[3]
- d0 = _mm_srli_si128(d0, 4);
- *(int *)(dest + stride * 3) = _mm_cvtsi128_si32(d0);
- }
-}
-
-#define TRANSPOSE_8X8(in0, in1, in2, in3, in4, in5, in6, in7, \
- out0, out1, out2, out3, out4, out5, out6, out7) \
- { \
- const __m128i tr0_0 = _mm_unpacklo_epi16(in0, in1); \
- const __m128i tr0_1 = _mm_unpacklo_epi16(in2, in3); \
- const __m128i tr0_2 = _mm_unpackhi_epi16(in0, in1); \
- const __m128i tr0_3 = _mm_unpackhi_epi16(in2, in3); \
- const __m128i tr0_4 = _mm_unpacklo_epi16(in4, in5); \
- const __m128i tr0_5 = _mm_unpacklo_epi16(in6, in7); \
- const __m128i tr0_6 = _mm_unpackhi_epi16(in4, in5); \
- const __m128i tr0_7 = _mm_unpackhi_epi16(in6, in7); \
- \
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1); \
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3); \
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1); \
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3); \
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5); \
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7); \
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5); \
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7); \
- \
- out0 = _mm_unpacklo_epi64(tr1_0, tr1_4); \
- out1 = _mm_unpackhi_epi64(tr1_0, tr1_4); \
- out2 = _mm_unpacklo_epi64(tr1_2, tr1_6); \
- out3 = _mm_unpackhi_epi64(tr1_2, tr1_6); \
- out4 = _mm_unpacklo_epi64(tr1_1, tr1_5); \
- out5 = _mm_unpackhi_epi64(tr1_1, tr1_5); \
- out6 = _mm_unpacklo_epi64(tr1_3, tr1_7); \
- out7 = _mm_unpackhi_epi64(tr1_3, tr1_7); \
- }
-
-#define TRANSPOSE_4X8_10(tmp0, tmp1, tmp2, tmp3, \
- out0, out1, out2, out3) \
- { \
- const __m128i tr0_0 = _mm_unpackhi_epi16(tmp0, tmp1); \
- const __m128i tr0_1 = _mm_unpacklo_epi16(tmp1, tmp0); \
- const __m128i tr0_4 = _mm_unpacklo_epi16(tmp2, tmp3); \
- const __m128i tr0_5 = _mm_unpackhi_epi16(tmp3, tmp2); \
- \
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1); \
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1); \
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5); \
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5); \
- \
- out0 = _mm_unpacklo_epi64(tr1_0, tr1_4); \
- out1 = _mm_unpackhi_epi64(tr1_0, tr1_4); \
- out2 = _mm_unpacklo_epi64(tr1_2, tr1_6); \
- out3 = _mm_unpackhi_epi64(tr1_2, tr1_6); \
- }
-
-#define TRANSPOSE_8X4(in0, in1, in2, in3, out0, out1) \
- { \
- const __m128i tr0_0 = _mm_unpacklo_epi16(in0, in1); \
- const __m128i tr0_1 = _mm_unpacklo_epi16(in2, in3); \
- \
- in0 = _mm_unpacklo_epi32(tr0_0, tr0_1); /* i1 i0 */ \
- in1 = _mm_unpackhi_epi32(tr0_0, tr0_1); /* i3 i2 */ \
- }
-
-#define TRANSPOSE_8X8_10(in0, in1, in2, in3, out0, out1) \
- { \
- const __m128i tr0_0 = _mm_unpacklo_epi16(in0, in1); \
- const __m128i tr0_1 = _mm_unpacklo_epi16(in2, in3); \
- out0 = _mm_unpacklo_epi32(tr0_0, tr0_1); \
- out1 = _mm_unpackhi_epi32(tr0_0, tr0_1); \
- }
-
-// Define Macro for multiplying elements by constants and adding them together.
-#define MULTIPLICATION_AND_ADD(lo_0, hi_0, lo_1, hi_1, \
- cst0, cst1, cst2, cst3, res0, res1, res2, res3) \
- { \
- tmp0 = _mm_madd_epi16(lo_0, cst0); \
- tmp1 = _mm_madd_epi16(hi_0, cst0); \
- tmp2 = _mm_madd_epi16(lo_0, cst1); \
- tmp3 = _mm_madd_epi16(hi_0, cst1); \
- tmp4 = _mm_madd_epi16(lo_1, cst2); \
- tmp5 = _mm_madd_epi16(hi_1, cst2); \
- tmp6 = _mm_madd_epi16(lo_1, cst3); \
- tmp7 = _mm_madd_epi16(hi_1, cst3); \
- \
- tmp0 = _mm_add_epi32(tmp0, rounding); \
- tmp1 = _mm_add_epi32(tmp1, rounding); \
- tmp2 = _mm_add_epi32(tmp2, rounding); \
- tmp3 = _mm_add_epi32(tmp3, rounding); \
- tmp4 = _mm_add_epi32(tmp4, rounding); \
- tmp5 = _mm_add_epi32(tmp5, rounding); \
- tmp6 = _mm_add_epi32(tmp6, rounding); \
- tmp7 = _mm_add_epi32(tmp7, rounding); \
- \
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS); \
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS); \
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS); \
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS); \
- tmp4 = _mm_srai_epi32(tmp4, DCT_CONST_BITS); \
- tmp5 = _mm_srai_epi32(tmp5, DCT_CONST_BITS); \
- tmp6 = _mm_srai_epi32(tmp6, DCT_CONST_BITS); \
- tmp7 = _mm_srai_epi32(tmp7, DCT_CONST_BITS); \
- \
- res0 = _mm_packs_epi32(tmp0, tmp1); \
- res1 = _mm_packs_epi32(tmp2, tmp3); \
- res2 = _mm_packs_epi32(tmp4, tmp5); \
- res3 = _mm_packs_epi32(tmp6, tmp7); \
- }
-
-#define MULTIPLICATION_AND_ADD_2(lo_0, hi_0, cst0, cst1, res0, res1) \
- { \
- tmp0 = _mm_madd_epi16(lo_0, cst0); \
- tmp1 = _mm_madd_epi16(hi_0, cst0); \
- tmp2 = _mm_madd_epi16(lo_0, cst1); \
- tmp3 = _mm_madd_epi16(hi_0, cst1); \
- \
- tmp0 = _mm_add_epi32(tmp0, rounding); \
- tmp1 = _mm_add_epi32(tmp1, rounding); \
- tmp2 = _mm_add_epi32(tmp2, rounding); \
- tmp3 = _mm_add_epi32(tmp3, rounding); \
- \
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS); \
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS); \
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS); \
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS); \
- \
- res0 = _mm_packs_epi32(tmp0, tmp1); \
- res1 = _mm_packs_epi32(tmp2, tmp3); \
- }
-
-#define IDCT8(in0, in1, in2, in3, in4, in5, in6, in7, \
- out0, out1, out2, out3, out4, out5, out6, out7) \
- { \
- /* Stage1 */ \
- { \
- const __m128i lo_17 = _mm_unpacklo_epi16(in1, in7); \
- const __m128i hi_17 = _mm_unpackhi_epi16(in1, in7); \
- const __m128i lo_35 = _mm_unpacklo_epi16(in3, in5); \
- const __m128i hi_35 = _mm_unpackhi_epi16(in3, in5); \
- \
- MULTIPLICATION_AND_ADD(lo_17, hi_17, lo_35, hi_35, stg1_0, \
- stg1_1, stg1_2, stg1_3, stp1_4, \
- stp1_7, stp1_5, stp1_6) \
- } \
- \
- /* Stage2 */ \
- { \
- const __m128i lo_04 = _mm_unpacklo_epi16(in0, in4); \
- const __m128i hi_04 = _mm_unpackhi_epi16(in0, in4); \
- const __m128i lo_26 = _mm_unpacklo_epi16(in2, in6); \
- const __m128i hi_26 = _mm_unpackhi_epi16(in2, in6); \
- \
- MULTIPLICATION_AND_ADD(lo_04, hi_04, lo_26, hi_26, stg2_0, \
- stg2_1, stg2_2, stg2_3, stp2_0, \
- stp2_1, stp2_2, stp2_3) \
- \
- stp2_4 = _mm_adds_epi16(stp1_4, stp1_5); \
- stp2_5 = _mm_subs_epi16(stp1_4, stp1_5); \
- stp2_6 = _mm_subs_epi16(stp1_7, stp1_6); \
- stp2_7 = _mm_adds_epi16(stp1_7, stp1_6); \
- } \
- \
- /* Stage3 */ \
- { \
- const __m128i lo_56 = _mm_unpacklo_epi16(stp2_6, stp2_5); \
- const __m128i hi_56 = _mm_unpackhi_epi16(stp2_6, stp2_5); \
- \
- stp1_0 = _mm_adds_epi16(stp2_0, stp2_3); \
- stp1_1 = _mm_adds_epi16(stp2_1, stp2_2); \
- stp1_2 = _mm_subs_epi16(stp2_1, stp2_2); \
- stp1_3 = _mm_subs_epi16(stp2_0, stp2_3); \
- \
- tmp0 = _mm_madd_epi16(lo_56, stg2_1); \
- tmp1 = _mm_madd_epi16(hi_56, stg2_1); \
- tmp2 = _mm_madd_epi16(lo_56, stg2_0); \
- tmp3 = _mm_madd_epi16(hi_56, stg2_0); \
- \
- tmp0 = _mm_add_epi32(tmp0, rounding); \
- tmp1 = _mm_add_epi32(tmp1, rounding); \
- tmp2 = _mm_add_epi32(tmp2, rounding); \
- tmp3 = _mm_add_epi32(tmp3, rounding); \
- \
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS); \
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS); \
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS); \
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS); \
- \
- stp1_5 = _mm_packs_epi32(tmp0, tmp1); \
- stp1_6 = _mm_packs_epi32(tmp2, tmp3); \
- } \
- \
- /* Stage4 */ \
- out0 = _mm_adds_epi16(stp1_0, stp2_7); \
- out1 = _mm_adds_epi16(stp1_1, stp1_6); \
- out2 = _mm_adds_epi16(stp1_2, stp1_5); \
- out3 = _mm_adds_epi16(stp1_3, stp2_4); \
- out4 = _mm_subs_epi16(stp1_3, stp2_4); \
- out5 = _mm_subs_epi16(stp1_2, stp1_5); \
- out6 = _mm_subs_epi16(stp1_1, stp1_6); \
- out7 = _mm_subs_epi16(stp1_0, stp2_7); \
- }
-
-#define RECON_AND_STORE(dest, in_x) \
- { \
- __m128i d0 = _mm_loadl_epi64((__m128i *)(dest)); \
- d0 = _mm_unpacklo_epi8(d0, zero); \
- d0 = _mm_add_epi16(in_x, d0); \
- d0 = _mm_packus_epi16(d0, d0); \
- _mm_storel_epi64((__m128i *)(dest), d0); \
- dest += stride; \
- }
-
-void vp9_idct8x8_64_add_sse2(const int16_t *input, uint8_t *dest, int stride) {
- const __m128i zero = _mm_setzero_si128();
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i final_rounding = _mm_set1_epi16(1<<4);
- const __m128i stg1_0 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i stg1_1 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i stg1_2 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i stg1_3 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i stg2_0 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i stg2_1 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i stg2_2 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i stg2_3 = pair_set_epi16(cospi_8_64, cospi_24_64);
-
- __m128i in0, in1, in2, in3, in4, in5, in6, in7;
- __m128i stp1_0, stp1_1, stp1_2, stp1_3, stp1_4, stp1_5, stp1_6, stp1_7;
- __m128i stp2_0, stp2_1, stp2_2, stp2_3, stp2_4, stp2_5, stp2_6, stp2_7;
- __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int i;
-
- // Load input data.
- in0 = _mm_load_si128((const __m128i *)input);
- in1 = _mm_load_si128((const __m128i *)(input + 8 * 1));
- in2 = _mm_load_si128((const __m128i *)(input + 8 * 2));
- in3 = _mm_load_si128((const __m128i *)(input + 8 * 3));
- in4 = _mm_load_si128((const __m128i *)(input + 8 * 4));
- in5 = _mm_load_si128((const __m128i *)(input + 8 * 5));
- in6 = _mm_load_si128((const __m128i *)(input + 8 * 6));
- in7 = _mm_load_si128((const __m128i *)(input + 8 * 7));
-
- // 2-D
- for (i = 0; i < 2; i++) {
- // 8x8 Transpose is copied from vp9_fdct8x8_sse2()
- TRANSPOSE_8X8(in0, in1, in2, in3, in4, in5, in6, in7,
- in0, in1, in2, in3, in4, in5, in6, in7);
-
- // 4-stage 1D idct8x8
- IDCT8(in0, in1, in2, in3, in4, in5, in6, in7,
- in0, in1, in2, in3, in4, in5, in6, in7);
- }
-
- // Final rounding and shift
- in0 = _mm_adds_epi16(in0, final_rounding);
- in1 = _mm_adds_epi16(in1, final_rounding);
- in2 = _mm_adds_epi16(in2, final_rounding);
- in3 = _mm_adds_epi16(in3, final_rounding);
- in4 = _mm_adds_epi16(in4, final_rounding);
- in5 = _mm_adds_epi16(in5, final_rounding);
- in6 = _mm_adds_epi16(in6, final_rounding);
- in7 = _mm_adds_epi16(in7, final_rounding);
-
- in0 = _mm_srai_epi16(in0, 5);
- in1 = _mm_srai_epi16(in1, 5);
- in2 = _mm_srai_epi16(in2, 5);
- in3 = _mm_srai_epi16(in3, 5);
- in4 = _mm_srai_epi16(in4, 5);
- in5 = _mm_srai_epi16(in5, 5);
- in6 = _mm_srai_epi16(in6, 5);
- in7 = _mm_srai_epi16(in7, 5);
-
- RECON_AND_STORE(dest, in0);
- RECON_AND_STORE(dest, in1);
- RECON_AND_STORE(dest, in2);
- RECON_AND_STORE(dest, in3);
- RECON_AND_STORE(dest, in4);
- RECON_AND_STORE(dest, in5);
- RECON_AND_STORE(dest, in6);
- RECON_AND_STORE(dest, in7);
-}
-
-void vp9_idct8x8_1_add_sse2(const int16_t *input, uint8_t *dest, int stride) {
- __m128i dc_value;
- const __m128i zero = _mm_setzero_si128();
- int a;
-
- a = dct_const_round_shift(input[0] * cospi_16_64);
- a = dct_const_round_shift(a * cospi_16_64);
- a = ROUND_POWER_OF_TWO(a, 5);
-
- dc_value = _mm_set1_epi16(a);
-
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
-}
-
-// perform 8x8 transpose
-static INLINE void array_transpose_8x8(__m128i *in, __m128i *res) {
- const __m128i tr0_0 = _mm_unpacklo_epi16(in[0], in[1]);
- const __m128i tr0_1 = _mm_unpacklo_epi16(in[2], in[3]);
- const __m128i tr0_2 = _mm_unpackhi_epi16(in[0], in[1]);
- const __m128i tr0_3 = _mm_unpackhi_epi16(in[2], in[3]);
- const __m128i tr0_4 = _mm_unpacklo_epi16(in[4], in[5]);
- const __m128i tr0_5 = _mm_unpacklo_epi16(in[6], in[7]);
- const __m128i tr0_6 = _mm_unpackhi_epi16(in[4], in[5]);
- const __m128i tr0_7 = _mm_unpackhi_epi16(in[6], in[7]);
-
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
-
- res[0] = _mm_unpacklo_epi64(tr1_0, tr1_1);
- res[1] = _mm_unpackhi_epi64(tr1_0, tr1_1);
- res[2] = _mm_unpacklo_epi64(tr1_2, tr1_3);
- res[3] = _mm_unpackhi_epi64(tr1_2, tr1_3);
- res[4] = _mm_unpacklo_epi64(tr1_4, tr1_5);
- res[5] = _mm_unpackhi_epi64(tr1_4, tr1_5);
- res[6] = _mm_unpacklo_epi64(tr1_6, tr1_7);
- res[7] = _mm_unpackhi_epi64(tr1_6, tr1_7);
-}
-
-static INLINE void array_transpose_4X8(__m128i *in, __m128i * out) {
- const __m128i tr0_0 = _mm_unpacklo_epi16(in[0], in[1]);
- const __m128i tr0_1 = _mm_unpacklo_epi16(in[2], in[3]);
- const __m128i tr0_4 = _mm_unpacklo_epi16(in[4], in[5]);
- const __m128i tr0_5 = _mm_unpacklo_epi16(in[6], in[7]);
-
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
-
- out[0] = _mm_unpacklo_epi64(tr1_0, tr1_4);
- out[1] = _mm_unpackhi_epi64(tr1_0, tr1_4);
- out[2] = _mm_unpacklo_epi64(tr1_2, tr1_6);
- out[3] = _mm_unpackhi_epi64(tr1_2, tr1_6);
-}
-
-static void idct8_sse2(__m128i *in) {
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i stg1_0 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i stg1_1 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i stg1_2 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i stg1_3 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i stg2_0 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i stg2_1 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i stg2_2 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i stg2_3 = pair_set_epi16(cospi_8_64, cospi_24_64);
-
- __m128i in0, in1, in2, in3, in4, in5, in6, in7;
- __m128i stp1_0, stp1_1, stp1_2, stp1_3, stp1_4, stp1_5, stp1_6, stp1_7;
- __m128i stp2_0, stp2_1, stp2_2, stp2_3, stp2_4, stp2_5, stp2_6, stp2_7;
- __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-
- // 8x8 Transpose is copied from vp9_fdct8x8_sse2()
- TRANSPOSE_8X8(in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7],
- in0, in1, in2, in3, in4, in5, in6, in7);
-
- // 4-stage 1D idct8x8
- IDCT8(in0, in1, in2, in3, in4, in5, in6, in7,
- in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7]);
-}
-
-static void iadst8_sse2(__m128i *in) {
- const __m128i k__cospi_p02_p30 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i k__cospi_p30_m02 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i k__cospi_p10_p22 = pair_set_epi16(cospi_10_64, cospi_22_64);
- const __m128i k__cospi_p22_m10 = pair_set_epi16(cospi_22_64, -cospi_10_64);
- const __m128i k__cospi_p18_p14 = pair_set_epi16(cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p14_m18 = pair_set_epi16(cospi_14_64, -cospi_18_64);
- const __m128i k__cospi_p26_p06 = pair_set_epi16(cospi_26_64, cospi_6_64);
- const __m128i k__cospi_p06_m26 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m24_p08 = pair_set_epi16(-cospi_24_64, cospi_8_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__const_0 = _mm_set1_epi16(0);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
-
- __m128i u0, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11, u12, u13, u14, u15;
- __m128i v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15;
- __m128i w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15;
- __m128i s0, s1, s2, s3, s4, s5, s6, s7;
- __m128i in0, in1, in2, in3, in4, in5, in6, in7;
-
- // transpose
- array_transpose_8x8(in, in);
-
- // properly aligned for butterfly input
- in0 = in[7];
- in1 = in[0];
- in2 = in[5];
- in3 = in[2];
- in4 = in[3];
- in5 = in[4];
- in6 = in[1];
- in7 = in[6];
-
- // column transformation
- // stage 1
- // interleave and multiply/add into 32-bit integer
- s0 = _mm_unpacklo_epi16(in0, in1);
- s1 = _mm_unpackhi_epi16(in0, in1);
- s2 = _mm_unpacklo_epi16(in2, in3);
- s3 = _mm_unpackhi_epi16(in2, in3);
- s4 = _mm_unpacklo_epi16(in4, in5);
- s5 = _mm_unpackhi_epi16(in4, in5);
- s6 = _mm_unpacklo_epi16(in6, in7);
- s7 = _mm_unpackhi_epi16(in6, in7);
-
- u0 = _mm_madd_epi16(s0, k__cospi_p02_p30);
- u1 = _mm_madd_epi16(s1, k__cospi_p02_p30);
- u2 = _mm_madd_epi16(s0, k__cospi_p30_m02);
- u3 = _mm_madd_epi16(s1, k__cospi_p30_m02);
- u4 = _mm_madd_epi16(s2, k__cospi_p10_p22);
- u5 = _mm_madd_epi16(s3, k__cospi_p10_p22);
- u6 = _mm_madd_epi16(s2, k__cospi_p22_m10);
- u7 = _mm_madd_epi16(s3, k__cospi_p22_m10);
- u8 = _mm_madd_epi16(s4, k__cospi_p18_p14);
- u9 = _mm_madd_epi16(s5, k__cospi_p18_p14);
- u10 = _mm_madd_epi16(s4, k__cospi_p14_m18);
- u11 = _mm_madd_epi16(s5, k__cospi_p14_m18);
- u12 = _mm_madd_epi16(s6, k__cospi_p26_p06);
- u13 = _mm_madd_epi16(s7, k__cospi_p26_p06);
- u14 = _mm_madd_epi16(s6, k__cospi_p06_m26);
- u15 = _mm_madd_epi16(s7, k__cospi_p06_m26);
-
- // addition
- w0 = _mm_add_epi32(u0, u8);
- w1 = _mm_add_epi32(u1, u9);
- w2 = _mm_add_epi32(u2, u10);
- w3 = _mm_add_epi32(u3, u11);
- w4 = _mm_add_epi32(u4, u12);
- w5 = _mm_add_epi32(u5, u13);
- w6 = _mm_add_epi32(u6, u14);
- w7 = _mm_add_epi32(u7, u15);
- w8 = _mm_sub_epi32(u0, u8);
- w9 = _mm_sub_epi32(u1, u9);
- w10 = _mm_sub_epi32(u2, u10);
- w11 = _mm_sub_epi32(u3, u11);
- w12 = _mm_sub_epi32(u4, u12);
- w13 = _mm_sub_epi32(u5, u13);
- w14 = _mm_sub_epi32(u6, u14);
- w15 = _mm_sub_epi32(u7, u15);
-
- // shift and rounding
- v0 = _mm_add_epi32(w0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(w1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(w2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(w3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(w4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(w5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(w6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(w7, k__DCT_CONST_ROUNDING);
- v8 = _mm_add_epi32(w8, k__DCT_CONST_ROUNDING);
- v9 = _mm_add_epi32(w9, k__DCT_CONST_ROUNDING);
- v10 = _mm_add_epi32(w10, k__DCT_CONST_ROUNDING);
- v11 = _mm_add_epi32(w11, k__DCT_CONST_ROUNDING);
- v12 = _mm_add_epi32(w12, k__DCT_CONST_ROUNDING);
- v13 = _mm_add_epi32(w13, k__DCT_CONST_ROUNDING);
- v14 = _mm_add_epi32(w14, k__DCT_CONST_ROUNDING);
- v15 = _mm_add_epi32(w15, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- u8 = _mm_srai_epi32(v8, DCT_CONST_BITS);
- u9 = _mm_srai_epi32(v9, DCT_CONST_BITS);
- u10 = _mm_srai_epi32(v10, DCT_CONST_BITS);
- u11 = _mm_srai_epi32(v11, DCT_CONST_BITS);
- u12 = _mm_srai_epi32(v12, DCT_CONST_BITS);
- u13 = _mm_srai_epi32(v13, DCT_CONST_BITS);
- u14 = _mm_srai_epi32(v14, DCT_CONST_BITS);
- u15 = _mm_srai_epi32(v15, DCT_CONST_BITS);
-
- // back to 16-bit and pack 8 integers into __m128i
- in[0] = _mm_packs_epi32(u0, u1);
- in[1] = _mm_packs_epi32(u2, u3);
- in[2] = _mm_packs_epi32(u4, u5);
- in[3] = _mm_packs_epi32(u6, u7);
- in[4] = _mm_packs_epi32(u8, u9);
- in[5] = _mm_packs_epi32(u10, u11);
- in[6] = _mm_packs_epi32(u12, u13);
- in[7] = _mm_packs_epi32(u14, u15);
-
- // stage 2
- s0 = _mm_add_epi16(in[0], in[2]);
- s1 = _mm_add_epi16(in[1], in[3]);
- s2 = _mm_sub_epi16(in[0], in[2]);
- s3 = _mm_sub_epi16(in[1], in[3]);
- u0 = _mm_unpacklo_epi16(in[4], in[5]);
- u1 = _mm_unpackhi_epi16(in[4], in[5]);
- u2 = _mm_unpacklo_epi16(in[6], in[7]);
- u3 = _mm_unpackhi_epi16(in[6], in[7]);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p08_p24);
- v1 = _mm_madd_epi16(u1, k__cospi_p08_p24);
- v2 = _mm_madd_epi16(u0, k__cospi_p24_m08);
- v3 = _mm_madd_epi16(u1, k__cospi_p24_m08);
- v4 = _mm_madd_epi16(u2, k__cospi_m24_p08);
- v5 = _mm_madd_epi16(u3, k__cospi_m24_p08);
- v6 = _mm_madd_epi16(u2, k__cospi_p08_p24);
- v7 = _mm_madd_epi16(u3, k__cospi_p08_p24);
-
- w0 = _mm_add_epi32(v0, v4);
- w1 = _mm_add_epi32(v1, v5);
- w2 = _mm_add_epi32(v2, v6);
- w3 = _mm_add_epi32(v3, v7);
- w4 = _mm_sub_epi32(v0, v4);
- w5 = _mm_sub_epi32(v1, v5);
- w6 = _mm_sub_epi32(v2, v6);
- w7 = _mm_sub_epi32(v3, v7);
-
- v0 = _mm_add_epi32(w0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(w1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(w2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(w3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(w4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(w5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(w6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(w7, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
-
- // back to 16-bit intergers
- s4 = _mm_packs_epi32(u0, u1);
- s5 = _mm_packs_epi32(u2, u3);
- s6 = _mm_packs_epi32(u4, u5);
- s7 = _mm_packs_epi32(u6, u7);
-
- // stage 3
- u0 = _mm_unpacklo_epi16(s2, s3);
- u1 = _mm_unpackhi_epi16(s2, s3);
- u2 = _mm_unpacklo_epi16(s6, s7);
- u3 = _mm_unpackhi_epi16(s6, s7);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p16_p16);
- v1 = _mm_madd_epi16(u1, k__cospi_p16_p16);
- v2 = _mm_madd_epi16(u0, k__cospi_p16_m16);
- v3 = _mm_madd_epi16(u1, k__cospi_p16_m16);
- v4 = _mm_madd_epi16(u2, k__cospi_p16_p16);
- v5 = _mm_madd_epi16(u3, k__cospi_p16_p16);
- v6 = _mm_madd_epi16(u2, k__cospi_p16_m16);
- v7 = _mm_madd_epi16(u3, k__cospi_p16_m16);
-
- u0 = _mm_add_epi32(v0, k__DCT_CONST_ROUNDING);
- u1 = _mm_add_epi32(v1, k__DCT_CONST_ROUNDING);
- u2 = _mm_add_epi32(v2, k__DCT_CONST_ROUNDING);
- u3 = _mm_add_epi32(v3, k__DCT_CONST_ROUNDING);
- u4 = _mm_add_epi32(v4, k__DCT_CONST_ROUNDING);
- u5 = _mm_add_epi32(v5, k__DCT_CONST_ROUNDING);
- u6 = _mm_add_epi32(v6, k__DCT_CONST_ROUNDING);
- u7 = _mm_add_epi32(v7, k__DCT_CONST_ROUNDING);
-
- v0 = _mm_srai_epi32(u0, DCT_CONST_BITS);
- v1 = _mm_srai_epi32(u1, DCT_CONST_BITS);
- v2 = _mm_srai_epi32(u2, DCT_CONST_BITS);
- v3 = _mm_srai_epi32(u3, DCT_CONST_BITS);
- v4 = _mm_srai_epi32(u4, DCT_CONST_BITS);
- v5 = _mm_srai_epi32(u5, DCT_CONST_BITS);
- v6 = _mm_srai_epi32(u6, DCT_CONST_BITS);
- v7 = _mm_srai_epi32(u7, DCT_CONST_BITS);
-
- s2 = _mm_packs_epi32(v0, v1);
- s3 = _mm_packs_epi32(v2, v3);
- s6 = _mm_packs_epi32(v4, v5);
- s7 = _mm_packs_epi32(v6, v7);
-
- in[0] = s0;
- in[1] = _mm_sub_epi16(k__const_0, s4);
- in[2] = s6;
- in[3] = _mm_sub_epi16(k__const_0, s2);
- in[4] = s3;
- in[5] = _mm_sub_epi16(k__const_0, s7);
- in[6] = s5;
- in[7] = _mm_sub_epi16(k__const_0, s1);
-}
-
-
-void vp9_iht8x8_64_add_sse2(const int16_t *input, uint8_t *dest, int stride,
- int tx_type) {
- __m128i in[8];
- const __m128i zero = _mm_setzero_si128();
- const __m128i final_rounding = _mm_set1_epi16(1<<4);
-
- // load input data
- in[0] = _mm_load_si128((const __m128i *)input);
- in[1] = _mm_load_si128((const __m128i *)(input + 8 * 1));
- in[2] = _mm_load_si128((const __m128i *)(input + 8 * 2));
- in[3] = _mm_load_si128((const __m128i *)(input + 8 * 3));
- in[4] = _mm_load_si128((const __m128i *)(input + 8 * 4));
- in[5] = _mm_load_si128((const __m128i *)(input + 8 * 5));
- in[6] = _mm_load_si128((const __m128i *)(input + 8 * 6));
- in[7] = _mm_load_si128((const __m128i *)(input + 8 * 7));
-
- switch (tx_type) {
- case 0: // DCT_DCT
- idct8_sse2(in);
- idct8_sse2(in);
- break;
- case 1: // ADST_DCT
- idct8_sse2(in);
- iadst8_sse2(in);
- break;
- case 2: // DCT_ADST
- iadst8_sse2(in);
- idct8_sse2(in);
- break;
- case 3: // ADST_ADST
- iadst8_sse2(in);
- iadst8_sse2(in);
- break;
- default:
- assert(0);
- break;
- }
-
- // Final rounding and shift
- in[0] = _mm_adds_epi16(in[0], final_rounding);
- in[1] = _mm_adds_epi16(in[1], final_rounding);
- in[2] = _mm_adds_epi16(in[2], final_rounding);
- in[3] = _mm_adds_epi16(in[3], final_rounding);
- in[4] = _mm_adds_epi16(in[4], final_rounding);
- in[5] = _mm_adds_epi16(in[5], final_rounding);
- in[6] = _mm_adds_epi16(in[6], final_rounding);
- in[7] = _mm_adds_epi16(in[7], final_rounding);
-
- in[0] = _mm_srai_epi16(in[0], 5);
- in[1] = _mm_srai_epi16(in[1], 5);
- in[2] = _mm_srai_epi16(in[2], 5);
- in[3] = _mm_srai_epi16(in[3], 5);
- in[4] = _mm_srai_epi16(in[4], 5);
- in[5] = _mm_srai_epi16(in[5], 5);
- in[6] = _mm_srai_epi16(in[6], 5);
- in[7] = _mm_srai_epi16(in[7], 5);
-
- RECON_AND_STORE(dest, in[0]);
- RECON_AND_STORE(dest, in[1]);
- RECON_AND_STORE(dest, in[2]);
- RECON_AND_STORE(dest, in[3]);
- RECON_AND_STORE(dest, in[4]);
- RECON_AND_STORE(dest, in[5]);
- RECON_AND_STORE(dest, in[6]);
- RECON_AND_STORE(dest, in[7]);
-}
-
-void vp9_idct8x8_10_add_sse2(const int16_t *input, uint8_t *dest, int stride) {
- const __m128i zero = _mm_setzero_si128();
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i final_rounding = _mm_set1_epi16(1<<4);
- const __m128i stg1_0 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i stg1_1 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i stg1_2 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i stg1_3 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i stg2_0 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i stg2_1 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i stg2_2 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i stg2_3 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i stg3_0 = pair_set_epi16(-cospi_16_64, cospi_16_64);
-
- __m128i in0, in1, in2, in3, in4, in5, in6, in7;
- __m128i stp1_0, stp1_1, stp1_2, stp1_3, stp1_4, stp1_5, stp1_6, stp1_7;
- __m128i stp2_0, stp2_1, stp2_2, stp2_3, stp2_4, stp2_5, stp2_6, stp2_7;
- __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-
- // Rows. Load 4-row input data.
- in0 = _mm_load_si128((const __m128i *)input);
- in1 = _mm_load_si128((const __m128i *)(input + 8 * 1));
- in2 = _mm_load_si128((const __m128i *)(input + 8 * 2));
- in3 = _mm_load_si128((const __m128i *)(input + 8 * 3));
-
- // 8x4 Transpose
- TRANSPOSE_8X8_10(in0, in1, in2, in3, in0, in1);
- // Stage1
- { //NOLINT
- const __m128i lo_17 = _mm_unpackhi_epi16(in0, zero);
- const __m128i lo_35 = _mm_unpackhi_epi16(in1, zero);
-
- tmp0 = _mm_madd_epi16(lo_17, stg1_0);
- tmp2 = _mm_madd_epi16(lo_17, stg1_1);
- tmp4 = _mm_madd_epi16(lo_35, stg1_2);
- tmp6 = _mm_madd_epi16(lo_35, stg1_3);
-
- tmp0 = _mm_add_epi32(tmp0, rounding);
- tmp2 = _mm_add_epi32(tmp2, rounding);
- tmp4 = _mm_add_epi32(tmp4, rounding);
- tmp6 = _mm_add_epi32(tmp6, rounding);
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS);
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS);
- tmp4 = _mm_srai_epi32(tmp4, DCT_CONST_BITS);
- tmp6 = _mm_srai_epi32(tmp6, DCT_CONST_BITS);
-
- stp1_4 = _mm_packs_epi32(tmp0, tmp2);
- stp1_5 = _mm_packs_epi32(tmp4, tmp6);
- }
-
- // Stage2
- { //NOLINT
- const __m128i lo_04 = _mm_unpacklo_epi16(in0, zero);
- const __m128i lo_26 = _mm_unpacklo_epi16(in1, zero);
-
- tmp0 = _mm_madd_epi16(lo_04, stg2_0);
- tmp2 = _mm_madd_epi16(lo_04, stg2_1);
- tmp4 = _mm_madd_epi16(lo_26, stg2_2);
- tmp6 = _mm_madd_epi16(lo_26, stg2_3);
-
- tmp0 = _mm_add_epi32(tmp0, rounding);
- tmp2 = _mm_add_epi32(tmp2, rounding);
- tmp4 = _mm_add_epi32(tmp4, rounding);
- tmp6 = _mm_add_epi32(tmp6, rounding);
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS);
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS);
- tmp4 = _mm_srai_epi32(tmp4, DCT_CONST_BITS);
- tmp6 = _mm_srai_epi32(tmp6, DCT_CONST_BITS);
-
- stp2_0 = _mm_packs_epi32(tmp0, tmp2);
- stp2_2 = _mm_packs_epi32(tmp6, tmp4);
-
- tmp0 = _mm_adds_epi16(stp1_4, stp1_5);
- tmp1 = _mm_subs_epi16(stp1_4, stp1_5);
-
- stp2_4 = tmp0;
- stp2_5 = _mm_unpacklo_epi64(tmp1, zero);
- stp2_6 = _mm_unpackhi_epi64(tmp1, zero);
- }
-
- // Stage3
- { //NOLINT
- const __m128i lo_56 = _mm_unpacklo_epi16(stp2_5, stp2_6);
-
- tmp4 = _mm_adds_epi16(stp2_0, stp2_2);
- tmp6 = _mm_subs_epi16(stp2_0, stp2_2);
-
- stp1_2 = _mm_unpackhi_epi64(tmp6, tmp4);
- stp1_3 = _mm_unpacklo_epi64(tmp6, tmp4);
-
- tmp0 = _mm_madd_epi16(lo_56, stg3_0);
- tmp2 = _mm_madd_epi16(lo_56, stg2_0); // stg3_1 = stg2_0
-
- tmp0 = _mm_add_epi32(tmp0, rounding);
- tmp2 = _mm_add_epi32(tmp2, rounding);
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS);
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS);
-
- stp1_5 = _mm_packs_epi32(tmp0, tmp2);
- }
-
- // Stage4
- tmp0 = _mm_adds_epi16(stp1_3, stp2_4);
- tmp1 = _mm_adds_epi16(stp1_2, stp1_5);
- tmp2 = _mm_subs_epi16(stp1_3, stp2_4);
- tmp3 = _mm_subs_epi16(stp1_2, stp1_5);
-
- TRANSPOSE_4X8_10(tmp0, tmp1, tmp2, tmp3, in0, in1, in2, in3)
-
- IDCT8(in0, in1, in2, in3, zero, zero, zero, zero,
- in0, in1, in2, in3, in4, in5, in6, in7);
- // Final rounding and shift
- in0 = _mm_adds_epi16(in0, final_rounding);
- in1 = _mm_adds_epi16(in1, final_rounding);
- in2 = _mm_adds_epi16(in2, final_rounding);
- in3 = _mm_adds_epi16(in3, final_rounding);
- in4 = _mm_adds_epi16(in4, final_rounding);
- in5 = _mm_adds_epi16(in5, final_rounding);
- in6 = _mm_adds_epi16(in6, final_rounding);
- in7 = _mm_adds_epi16(in7, final_rounding);
-
- in0 = _mm_srai_epi16(in0, 5);
- in1 = _mm_srai_epi16(in1, 5);
- in2 = _mm_srai_epi16(in2, 5);
- in3 = _mm_srai_epi16(in3, 5);
- in4 = _mm_srai_epi16(in4, 5);
- in5 = _mm_srai_epi16(in5, 5);
- in6 = _mm_srai_epi16(in6, 5);
- in7 = _mm_srai_epi16(in7, 5);
-
- RECON_AND_STORE(dest, in0);
- RECON_AND_STORE(dest, in1);
- RECON_AND_STORE(dest, in2);
- RECON_AND_STORE(dest, in3);
- RECON_AND_STORE(dest, in4);
- RECON_AND_STORE(dest, in5);
- RECON_AND_STORE(dest, in6);
- RECON_AND_STORE(dest, in7);
-}
-
-#define IDCT16 \
- /* Stage2 */ \
- { \
- const __m128i lo_1_15 = _mm_unpacklo_epi16(in[1], in[15]); \
- const __m128i hi_1_15 = _mm_unpackhi_epi16(in[1], in[15]); \
- const __m128i lo_9_7 = _mm_unpacklo_epi16(in[9], in[7]); \
- const __m128i hi_9_7 = _mm_unpackhi_epi16(in[9], in[7]); \
- const __m128i lo_5_11 = _mm_unpacklo_epi16(in[5], in[11]); \
- const __m128i hi_5_11 = _mm_unpackhi_epi16(in[5], in[11]); \
- const __m128i lo_13_3 = _mm_unpacklo_epi16(in[13], in[3]); \
- const __m128i hi_13_3 = _mm_unpackhi_epi16(in[13], in[3]); \
- \
- MULTIPLICATION_AND_ADD(lo_1_15, hi_1_15, lo_9_7, hi_9_7, \
- stg2_0, stg2_1, stg2_2, stg2_3, \
- stp2_8, stp2_15, stp2_9, stp2_14) \
- \
- MULTIPLICATION_AND_ADD(lo_5_11, hi_5_11, lo_13_3, hi_13_3, \
- stg2_4, stg2_5, stg2_6, stg2_7, \
- stp2_10, stp2_13, stp2_11, stp2_12) \
- } \
- \
- /* Stage3 */ \
- { \
- const __m128i lo_2_14 = _mm_unpacklo_epi16(in[2], in[14]); \
- const __m128i hi_2_14 = _mm_unpackhi_epi16(in[2], in[14]); \
- const __m128i lo_10_6 = _mm_unpacklo_epi16(in[10], in[6]); \
- const __m128i hi_10_6 = _mm_unpackhi_epi16(in[10], in[6]); \
- \
- MULTIPLICATION_AND_ADD(lo_2_14, hi_2_14, lo_10_6, hi_10_6, \
- stg3_0, stg3_1, stg3_2, stg3_3, \
- stp1_4, stp1_7, stp1_5, stp1_6) \
- \
- stp1_8_0 = _mm_add_epi16(stp2_8, stp2_9); \
- stp1_9 = _mm_sub_epi16(stp2_8, stp2_9); \
- stp1_10 = _mm_sub_epi16(stp2_11, stp2_10); \
- stp1_11 = _mm_add_epi16(stp2_11, stp2_10); \
- \
- stp1_12_0 = _mm_add_epi16(stp2_12, stp2_13); \
- stp1_13 = _mm_sub_epi16(stp2_12, stp2_13); \
- stp1_14 = _mm_sub_epi16(stp2_15, stp2_14); \
- stp1_15 = _mm_add_epi16(stp2_15, stp2_14); \
- } \
- \
- /* Stage4 */ \
- { \
- const __m128i lo_0_8 = _mm_unpacklo_epi16(in[0], in[8]); \
- const __m128i hi_0_8 = _mm_unpackhi_epi16(in[0], in[8]); \
- const __m128i lo_4_12 = _mm_unpacklo_epi16(in[4], in[12]); \
- const __m128i hi_4_12 = _mm_unpackhi_epi16(in[4], in[12]); \
- \
- const __m128i lo_9_14 = _mm_unpacklo_epi16(stp1_9, stp1_14); \
- const __m128i hi_9_14 = _mm_unpackhi_epi16(stp1_9, stp1_14); \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp1_10, stp1_13); \
- \
- MULTIPLICATION_AND_ADD(lo_0_8, hi_0_8, lo_4_12, hi_4_12, \
- stg4_0, stg4_1, stg4_2, stg4_3, \
- stp2_0, stp2_1, stp2_2, stp2_3) \
- \
- stp2_4 = _mm_add_epi16(stp1_4, stp1_5); \
- stp2_5 = _mm_sub_epi16(stp1_4, stp1_5); \
- stp2_6 = _mm_sub_epi16(stp1_7, stp1_6); \
- stp2_7 = _mm_add_epi16(stp1_7, stp1_6); \
- \
- MULTIPLICATION_AND_ADD(lo_9_14, hi_9_14, lo_10_13, hi_10_13, \
- stg4_4, stg4_5, stg4_6, stg4_7, \
- stp2_9, stp2_14, stp2_10, stp2_13) \
- } \
- \
- /* Stage5 */ \
- { \
- const __m128i lo_6_5 = _mm_unpacklo_epi16(stp2_6, stp2_5); \
- const __m128i hi_6_5 = _mm_unpackhi_epi16(stp2_6, stp2_5); \
- \
- stp1_0 = _mm_add_epi16(stp2_0, stp2_3); \
- stp1_1 = _mm_add_epi16(stp2_1, stp2_2); \
- stp1_2 = _mm_sub_epi16(stp2_1, stp2_2); \
- stp1_3 = _mm_sub_epi16(stp2_0, stp2_3); \
- \
- tmp0 = _mm_madd_epi16(lo_6_5, stg4_1); \
- tmp1 = _mm_madd_epi16(hi_6_5, stg4_1); \
- tmp2 = _mm_madd_epi16(lo_6_5, stg4_0); \
- tmp3 = _mm_madd_epi16(hi_6_5, stg4_0); \
- \
- tmp0 = _mm_add_epi32(tmp0, rounding); \
- tmp1 = _mm_add_epi32(tmp1, rounding); \
- tmp2 = _mm_add_epi32(tmp2, rounding); \
- tmp3 = _mm_add_epi32(tmp3, rounding); \
- \
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS); \
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS); \
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS); \
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS); \
- \
- stp1_5 = _mm_packs_epi32(tmp0, tmp1); \
- stp1_6 = _mm_packs_epi32(tmp2, tmp3); \
- \
- stp1_8 = _mm_add_epi16(stp1_8_0, stp1_11); \
- stp1_9 = _mm_add_epi16(stp2_9, stp2_10); \
- stp1_10 = _mm_sub_epi16(stp2_9, stp2_10); \
- stp1_11 = _mm_sub_epi16(stp1_8_0, stp1_11); \
- \
- stp1_12 = _mm_sub_epi16(stp1_15, stp1_12_0); \
- stp1_13 = _mm_sub_epi16(stp2_14, stp2_13); \
- stp1_14 = _mm_add_epi16(stp2_14, stp2_13); \
- stp1_15 = _mm_add_epi16(stp1_15, stp1_12_0); \
- } \
- \
- /* Stage6 */ \
- { \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp1_10, stp1_13); \
- const __m128i lo_11_12 = _mm_unpacklo_epi16(stp1_11, stp1_12); \
- const __m128i hi_11_12 = _mm_unpackhi_epi16(stp1_11, stp1_12); \
- \
- stp2_0 = _mm_add_epi16(stp1_0, stp2_7); \
- stp2_1 = _mm_add_epi16(stp1_1, stp1_6); \
- stp2_2 = _mm_add_epi16(stp1_2, stp1_5); \
- stp2_3 = _mm_add_epi16(stp1_3, stp2_4); \
- stp2_4 = _mm_sub_epi16(stp1_3, stp2_4); \
- stp2_5 = _mm_sub_epi16(stp1_2, stp1_5); \
- stp2_6 = _mm_sub_epi16(stp1_1, stp1_6); \
- stp2_7 = _mm_sub_epi16(stp1_0, stp2_7); \
- \
- MULTIPLICATION_AND_ADD(lo_10_13, hi_10_13, lo_11_12, hi_11_12, \
- stg6_0, stg4_0, stg6_0, stg4_0, \
- stp2_10, stp2_13, stp2_11, stp2_12) \
- }
-
-#define IDCT16_10 \
- /* Stage2 */ \
- { \
- const __m128i lo_1_15 = _mm_unpacklo_epi16(in[1], zero); \
- const __m128i hi_1_15 = _mm_unpackhi_epi16(in[1], zero); \
- const __m128i lo_13_3 = _mm_unpacklo_epi16(zero, in[3]); \
- const __m128i hi_13_3 = _mm_unpackhi_epi16(zero, in[3]); \
- \
- MULTIPLICATION_AND_ADD(lo_1_15, hi_1_15, lo_13_3, hi_13_3, \
- stg2_0, stg2_1, stg2_6, stg2_7, \
- stp1_8_0, stp1_15, stp1_11, stp1_12_0) \
- } \
- \
- /* Stage3 */ \
- { \
- const __m128i lo_2_14 = _mm_unpacklo_epi16(in[2], zero); \
- const __m128i hi_2_14 = _mm_unpackhi_epi16(in[2], zero); \
- \
- MULTIPLICATION_AND_ADD_2(lo_2_14, hi_2_14, \
- stg3_0, stg3_1, \
- stp2_4, stp2_7) \
- \
- stp1_9 = stp1_8_0; \
- stp1_10 = stp1_11; \
- \
- stp1_13 = stp1_12_0; \
- stp1_14 = stp1_15; \
- } \
- \
- /* Stage4 */ \
- { \
- const __m128i lo_0_8 = _mm_unpacklo_epi16(in[0], zero); \
- const __m128i hi_0_8 = _mm_unpackhi_epi16(in[0], zero); \
- \
- const __m128i lo_9_14 = _mm_unpacklo_epi16(stp1_9, stp1_14); \
- const __m128i hi_9_14 = _mm_unpackhi_epi16(stp1_9, stp1_14); \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp1_10, stp1_13); \
- \
- MULTIPLICATION_AND_ADD_2(lo_0_8, hi_0_8, \
- stg4_0, stg4_1, \
- stp1_0, stp1_1) \
- stp2_5 = stp2_4; \
- stp2_6 = stp2_7; \
- \
- MULTIPLICATION_AND_ADD(lo_9_14, hi_9_14, lo_10_13, hi_10_13, \
- stg4_4, stg4_5, stg4_6, stg4_7, \
- stp2_9, stp2_14, stp2_10, stp2_13) \
- } \
- \
- /* Stage5 */ \
- { \
- const __m128i lo_6_5 = _mm_unpacklo_epi16(stp2_6, stp2_5); \
- const __m128i hi_6_5 = _mm_unpackhi_epi16(stp2_6, stp2_5); \
- \
- stp1_2 = stp1_1; \
- stp1_3 = stp1_0; \
- \
- tmp0 = _mm_madd_epi16(lo_6_5, stg4_1); \
- tmp1 = _mm_madd_epi16(hi_6_5, stg4_1); \
- tmp2 = _mm_madd_epi16(lo_6_5, stg4_0); \
- tmp3 = _mm_madd_epi16(hi_6_5, stg4_0); \
- \
- tmp0 = _mm_add_epi32(tmp0, rounding); \
- tmp1 = _mm_add_epi32(tmp1, rounding); \
- tmp2 = _mm_add_epi32(tmp2, rounding); \
- tmp3 = _mm_add_epi32(tmp3, rounding); \
- \
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS); \
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS); \
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS); \
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS); \
- \
- stp1_5 = _mm_packs_epi32(tmp0, tmp1); \
- stp1_6 = _mm_packs_epi32(tmp2, tmp3); \
- \
- stp1_8 = _mm_add_epi16(stp1_8_0, stp1_11); \
- stp1_9 = _mm_add_epi16(stp2_9, stp2_10); \
- stp1_10 = _mm_sub_epi16(stp2_9, stp2_10); \
- stp1_11 = _mm_sub_epi16(stp1_8_0, stp1_11); \
- \
- stp1_12 = _mm_sub_epi16(stp1_15, stp1_12_0); \
- stp1_13 = _mm_sub_epi16(stp2_14, stp2_13); \
- stp1_14 = _mm_add_epi16(stp2_14, stp2_13); \
- stp1_15 = _mm_add_epi16(stp1_15, stp1_12_0); \
- } \
- \
- /* Stage6 */ \
- { \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp1_10, stp1_13); \
- const __m128i lo_11_12 = _mm_unpacklo_epi16(stp1_11, stp1_12); \
- const __m128i hi_11_12 = _mm_unpackhi_epi16(stp1_11, stp1_12); \
- \
- stp2_0 = _mm_add_epi16(stp1_0, stp2_7); \
- stp2_1 = _mm_add_epi16(stp1_1, stp1_6); \
- stp2_2 = _mm_add_epi16(stp1_2, stp1_5); \
- stp2_3 = _mm_add_epi16(stp1_3, stp2_4); \
- stp2_4 = _mm_sub_epi16(stp1_3, stp2_4); \
- stp2_5 = _mm_sub_epi16(stp1_2, stp1_5); \
- stp2_6 = _mm_sub_epi16(stp1_1, stp1_6); \
- stp2_7 = _mm_sub_epi16(stp1_0, stp2_7); \
- \
- MULTIPLICATION_AND_ADD(lo_10_13, hi_10_13, lo_11_12, hi_11_12, \
- stg6_0, stg4_0, stg6_0, stg4_0, \
- stp2_10, stp2_13, stp2_11, stp2_12) \
- }
-
-void vp9_idct16x16_256_add_sse2(const int16_t *input, uint8_t *dest,
- int stride) {
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i final_rounding = _mm_set1_epi16(1<<5);
- const __m128i zero = _mm_setzero_si128();
-
- const __m128i stg2_0 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i stg2_1 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i stg2_2 = pair_set_epi16(cospi_14_64, -cospi_18_64);
- const __m128i stg2_3 = pair_set_epi16(cospi_18_64, cospi_14_64);
- const __m128i stg2_4 = pair_set_epi16(cospi_22_64, -cospi_10_64);
- const __m128i stg2_5 = pair_set_epi16(cospi_10_64, cospi_22_64);
- const __m128i stg2_6 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i stg2_7 = pair_set_epi16(cospi_26_64, cospi_6_64);
-
- const __m128i stg3_0 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i stg3_1 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i stg3_2 = pair_set_epi16(cospi_12_64, -cospi_20_64);
- const __m128i stg3_3 = pair_set_epi16(cospi_20_64, cospi_12_64);
-
- const __m128i stg4_0 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i stg4_1 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i stg4_2 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i stg4_3 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i stg4_4 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i stg4_5 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i stg4_6 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i stg4_7 = pair_set_epi16(-cospi_8_64, cospi_24_64);
-
- const __m128i stg6_0 = pair_set_epi16(-cospi_16_64, cospi_16_64);
-
- __m128i in[16], l[16], r[16], *curr1;
- __m128i stp1_0, stp1_1, stp1_2, stp1_3, stp1_4, stp1_5, stp1_6, stp1_7,
- stp1_8, stp1_9, stp1_10, stp1_11, stp1_12, stp1_13, stp1_14, stp1_15,
- stp1_8_0, stp1_12_0;
- __m128i stp2_0, stp2_1, stp2_2, stp2_3, stp2_4, stp2_5, stp2_6, stp2_7,
- stp2_8, stp2_9, stp2_10, stp2_11, stp2_12, stp2_13, stp2_14, stp2_15;
- __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int i;
-
- curr1 = l;
- for (i = 0; i < 2; i++) {
- // 1-D idct
-
- // Load input data.
- in[0] = _mm_load_si128((const __m128i *)input);
- in[8] = _mm_load_si128((const __m128i *)(input + 8 * 1));
- in[1] = _mm_load_si128((const __m128i *)(input + 8 * 2));
- in[9] = _mm_load_si128((const __m128i *)(input + 8 * 3));
- in[2] = _mm_load_si128((const __m128i *)(input + 8 * 4));
- in[10] = _mm_load_si128((const __m128i *)(input + 8 * 5));
- in[3] = _mm_load_si128((const __m128i *)(input + 8 * 6));
- in[11] = _mm_load_si128((const __m128i *)(input + 8 * 7));
- in[4] = _mm_load_si128((const __m128i *)(input + 8 * 8));
- in[12] = _mm_load_si128((const __m128i *)(input + 8 * 9));
- in[5] = _mm_load_si128((const __m128i *)(input + 8 * 10));
- in[13] = _mm_load_si128((const __m128i *)(input + 8 * 11));
- in[6] = _mm_load_si128((const __m128i *)(input + 8 * 12));
- in[14] = _mm_load_si128((const __m128i *)(input + 8 * 13));
- in[7] = _mm_load_si128((const __m128i *)(input + 8 * 14));
- in[15] = _mm_load_si128((const __m128i *)(input + 8 * 15));
-
- array_transpose_8x8(in, in);
- array_transpose_8x8(in+8, in+8);
-
- IDCT16
-
- // Stage7
- curr1[0] = _mm_add_epi16(stp2_0, stp1_15);
- curr1[1] = _mm_add_epi16(stp2_1, stp1_14);
- curr1[2] = _mm_add_epi16(stp2_2, stp2_13);
- curr1[3] = _mm_add_epi16(stp2_3, stp2_12);
- curr1[4] = _mm_add_epi16(stp2_4, stp2_11);
- curr1[5] = _mm_add_epi16(stp2_5, stp2_10);
- curr1[6] = _mm_add_epi16(stp2_6, stp1_9);
- curr1[7] = _mm_add_epi16(stp2_7, stp1_8);
- curr1[8] = _mm_sub_epi16(stp2_7, stp1_8);
- curr1[9] = _mm_sub_epi16(stp2_6, stp1_9);
- curr1[10] = _mm_sub_epi16(stp2_5, stp2_10);
- curr1[11] = _mm_sub_epi16(stp2_4, stp2_11);
- curr1[12] = _mm_sub_epi16(stp2_3, stp2_12);
- curr1[13] = _mm_sub_epi16(stp2_2, stp2_13);
- curr1[14] = _mm_sub_epi16(stp2_1, stp1_14);
- curr1[15] = _mm_sub_epi16(stp2_0, stp1_15);
-
- curr1 = r;
- input += 128;
- }
- for (i = 0; i < 2; i++) {
- // 1-D idct
- array_transpose_8x8(l+i*8, in);
- array_transpose_8x8(r+i*8, in+8);
-
- IDCT16
-
- // 2-D
- in[0] = _mm_add_epi16(stp2_0, stp1_15);
- in[1] = _mm_add_epi16(stp2_1, stp1_14);
- in[2] = _mm_add_epi16(stp2_2, stp2_13);
- in[3] = _mm_add_epi16(stp2_3, stp2_12);
- in[4] = _mm_add_epi16(stp2_4, stp2_11);
- in[5] = _mm_add_epi16(stp2_5, stp2_10);
- in[6] = _mm_add_epi16(stp2_6, stp1_9);
- in[7] = _mm_add_epi16(stp2_7, stp1_8);
- in[8] = _mm_sub_epi16(stp2_7, stp1_8);
- in[9] = _mm_sub_epi16(stp2_6, stp1_9);
- in[10] = _mm_sub_epi16(stp2_5, stp2_10);
- in[11] = _mm_sub_epi16(stp2_4, stp2_11);
- in[12] = _mm_sub_epi16(stp2_3, stp2_12);
- in[13] = _mm_sub_epi16(stp2_2, stp2_13);
- in[14] = _mm_sub_epi16(stp2_1, stp1_14);
- in[15] = _mm_sub_epi16(stp2_0, stp1_15);
-
- // Final rounding and shift
- in[0] = _mm_adds_epi16(in[0], final_rounding);
- in[1] = _mm_adds_epi16(in[1], final_rounding);
- in[2] = _mm_adds_epi16(in[2], final_rounding);
- in[3] = _mm_adds_epi16(in[3], final_rounding);
- in[4] = _mm_adds_epi16(in[4], final_rounding);
- in[5] = _mm_adds_epi16(in[5], final_rounding);
- in[6] = _mm_adds_epi16(in[6], final_rounding);
- in[7] = _mm_adds_epi16(in[7], final_rounding);
- in[8] = _mm_adds_epi16(in[8], final_rounding);
- in[9] = _mm_adds_epi16(in[9], final_rounding);
- in[10] = _mm_adds_epi16(in[10], final_rounding);
- in[11] = _mm_adds_epi16(in[11], final_rounding);
- in[12] = _mm_adds_epi16(in[12], final_rounding);
- in[13] = _mm_adds_epi16(in[13], final_rounding);
- in[14] = _mm_adds_epi16(in[14], final_rounding);
- in[15] = _mm_adds_epi16(in[15], final_rounding);
-
- in[0] = _mm_srai_epi16(in[0], 6);
- in[1] = _mm_srai_epi16(in[1], 6);
- in[2] = _mm_srai_epi16(in[2], 6);
- in[3] = _mm_srai_epi16(in[3], 6);
- in[4] = _mm_srai_epi16(in[4], 6);
- in[5] = _mm_srai_epi16(in[5], 6);
- in[6] = _mm_srai_epi16(in[6], 6);
- in[7] = _mm_srai_epi16(in[7], 6);
- in[8] = _mm_srai_epi16(in[8], 6);
- in[9] = _mm_srai_epi16(in[9], 6);
- in[10] = _mm_srai_epi16(in[10], 6);
- in[11] = _mm_srai_epi16(in[11], 6);
- in[12] = _mm_srai_epi16(in[12], 6);
- in[13] = _mm_srai_epi16(in[13], 6);
- in[14] = _mm_srai_epi16(in[14], 6);
- in[15] = _mm_srai_epi16(in[15], 6);
-
- RECON_AND_STORE(dest, in[0]);
- RECON_AND_STORE(dest, in[1]);
- RECON_AND_STORE(dest, in[2]);
- RECON_AND_STORE(dest, in[3]);
- RECON_AND_STORE(dest, in[4]);
- RECON_AND_STORE(dest, in[5]);
- RECON_AND_STORE(dest, in[6]);
- RECON_AND_STORE(dest, in[7]);
- RECON_AND_STORE(dest, in[8]);
- RECON_AND_STORE(dest, in[9]);
- RECON_AND_STORE(dest, in[10]);
- RECON_AND_STORE(dest, in[11]);
- RECON_AND_STORE(dest, in[12]);
- RECON_AND_STORE(dest, in[13]);
- RECON_AND_STORE(dest, in[14]);
- RECON_AND_STORE(dest, in[15]);
-
- dest += 8 - (stride * 16);
- }
-}
-
-void vp9_idct16x16_1_add_sse2(const int16_t *input, uint8_t *dest, int stride) {
- __m128i dc_value;
- const __m128i zero = _mm_setzero_si128();
- int a, i;
-
- a = dct_const_round_shift(input[0] * cospi_16_64);
- a = dct_const_round_shift(a * cospi_16_64);
- a = ROUND_POWER_OF_TWO(a, 6);
-
- dc_value = _mm_set1_epi16(a);
-
- for (i = 0; i < 2; ++i) {
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- dest += 8 - (stride * 16);
- }
-}
-
-static INLINE void array_transpose_16x16(__m128i *res0, __m128i *res1) {
- __m128i tbuf[8];
- array_transpose_8x8(res0, res0);
- array_transpose_8x8(res1, tbuf);
- array_transpose_8x8(res0 + 8, res1);
- array_transpose_8x8(res1 + 8, res1 + 8);
-
- res0[8] = tbuf[0];
- res0[9] = tbuf[1];
- res0[10] = tbuf[2];
- res0[11] = tbuf[3];
- res0[12] = tbuf[4];
- res0[13] = tbuf[5];
- res0[14] = tbuf[6];
- res0[15] = tbuf[7];
-}
-
-static void iadst16_8col(__m128i *in) {
- // perform 16x16 1-D ADST for 8 columns
- __m128i s[16], x[16], u[32], v[32];
- const __m128i k__cospi_p01_p31 = pair_set_epi16(cospi_1_64, cospi_31_64);
- const __m128i k__cospi_p31_m01 = pair_set_epi16(cospi_31_64, -cospi_1_64);
- const __m128i k__cospi_p05_p27 = pair_set_epi16(cospi_5_64, cospi_27_64);
- const __m128i k__cospi_p27_m05 = pair_set_epi16(cospi_27_64, -cospi_5_64);
- const __m128i k__cospi_p09_p23 = pair_set_epi16(cospi_9_64, cospi_23_64);
- const __m128i k__cospi_p23_m09 = pair_set_epi16(cospi_23_64, -cospi_9_64);
- const __m128i k__cospi_p13_p19 = pair_set_epi16(cospi_13_64, cospi_19_64);
- const __m128i k__cospi_p19_m13 = pair_set_epi16(cospi_19_64, -cospi_13_64);
- const __m128i k__cospi_p17_p15 = pair_set_epi16(cospi_17_64, cospi_15_64);
- const __m128i k__cospi_p15_m17 = pair_set_epi16(cospi_15_64, -cospi_17_64);
- const __m128i k__cospi_p21_p11 = pair_set_epi16(cospi_21_64, cospi_11_64);
- const __m128i k__cospi_p11_m21 = pair_set_epi16(cospi_11_64, -cospi_21_64);
- const __m128i k__cospi_p25_p07 = pair_set_epi16(cospi_25_64, cospi_7_64);
- const __m128i k__cospi_p07_m25 = pair_set_epi16(cospi_7_64, -cospi_25_64);
- const __m128i k__cospi_p29_p03 = pair_set_epi16(cospi_29_64, cospi_3_64);
- const __m128i k__cospi_p03_m29 = pair_set_epi16(cospi_3_64, -cospi_29_64);
- const __m128i k__cospi_p04_p28 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p28_m04 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i k__cospi_p20_p12 = pair_set_epi16(cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p12_m20 = pair_set_epi16(cospi_12_64, -cospi_20_64);
- const __m128i k__cospi_m28_p04 = pair_set_epi16(-cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m12_p20 = pair_set_epi16(-cospi_12_64, cospi_20_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m24_p08 = pair_set_epi16(-cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m16_m16 = _mm_set1_epi16(-cospi_16_64);
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_m16_p16 = pair_set_epi16(-cospi_16_64, cospi_16_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i kZero = _mm_set1_epi16(0);
-
- u[0] = _mm_unpacklo_epi16(in[15], in[0]);
- u[1] = _mm_unpackhi_epi16(in[15], in[0]);
- u[2] = _mm_unpacklo_epi16(in[13], in[2]);
- u[3] = _mm_unpackhi_epi16(in[13], in[2]);
- u[4] = _mm_unpacklo_epi16(in[11], in[4]);
- u[5] = _mm_unpackhi_epi16(in[11], in[4]);
- u[6] = _mm_unpacklo_epi16(in[9], in[6]);
- u[7] = _mm_unpackhi_epi16(in[9], in[6]);
- u[8] = _mm_unpacklo_epi16(in[7], in[8]);
- u[9] = _mm_unpackhi_epi16(in[7], in[8]);
- u[10] = _mm_unpacklo_epi16(in[5], in[10]);
- u[11] = _mm_unpackhi_epi16(in[5], in[10]);
- u[12] = _mm_unpacklo_epi16(in[3], in[12]);
- u[13] = _mm_unpackhi_epi16(in[3], in[12]);
- u[14] = _mm_unpacklo_epi16(in[1], in[14]);
- u[15] = _mm_unpackhi_epi16(in[1], in[14]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p01_p31);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p01_p31);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p31_m01);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p31_m01);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p05_p27);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p05_p27);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p27_m05);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p27_m05);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p09_p23);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p09_p23);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p23_m09);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p23_m09);
- v[12] = _mm_madd_epi16(u[6], k__cospi_p13_p19);
- v[13] = _mm_madd_epi16(u[7], k__cospi_p13_p19);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p19_m13);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p19_m13);
- v[16] = _mm_madd_epi16(u[8], k__cospi_p17_p15);
- v[17] = _mm_madd_epi16(u[9], k__cospi_p17_p15);
- v[18] = _mm_madd_epi16(u[8], k__cospi_p15_m17);
- v[19] = _mm_madd_epi16(u[9], k__cospi_p15_m17);
- v[20] = _mm_madd_epi16(u[10], k__cospi_p21_p11);
- v[21] = _mm_madd_epi16(u[11], k__cospi_p21_p11);
- v[22] = _mm_madd_epi16(u[10], k__cospi_p11_m21);
- v[23] = _mm_madd_epi16(u[11], k__cospi_p11_m21);
- v[24] = _mm_madd_epi16(u[12], k__cospi_p25_p07);
- v[25] = _mm_madd_epi16(u[13], k__cospi_p25_p07);
- v[26] = _mm_madd_epi16(u[12], k__cospi_p07_m25);
- v[27] = _mm_madd_epi16(u[13], k__cospi_p07_m25);
- v[28] = _mm_madd_epi16(u[14], k__cospi_p29_p03);
- v[29] = _mm_madd_epi16(u[15], k__cospi_p29_p03);
- v[30] = _mm_madd_epi16(u[14], k__cospi_p03_m29);
- v[31] = _mm_madd_epi16(u[15], k__cospi_p03_m29);
-
- u[0] = _mm_add_epi32(v[0], v[16]);
- u[1] = _mm_add_epi32(v[1], v[17]);
- u[2] = _mm_add_epi32(v[2], v[18]);
- u[3] = _mm_add_epi32(v[3], v[19]);
- u[4] = _mm_add_epi32(v[4], v[20]);
- u[5] = _mm_add_epi32(v[5], v[21]);
- u[6] = _mm_add_epi32(v[6], v[22]);
- u[7] = _mm_add_epi32(v[7], v[23]);
- u[8] = _mm_add_epi32(v[8], v[24]);
- u[9] = _mm_add_epi32(v[9], v[25]);
- u[10] = _mm_add_epi32(v[10], v[26]);
- u[11] = _mm_add_epi32(v[11], v[27]);
- u[12] = _mm_add_epi32(v[12], v[28]);
- u[13] = _mm_add_epi32(v[13], v[29]);
- u[14] = _mm_add_epi32(v[14], v[30]);
- u[15] = _mm_add_epi32(v[15], v[31]);
- u[16] = _mm_sub_epi32(v[0], v[16]);
- u[17] = _mm_sub_epi32(v[1], v[17]);
- u[18] = _mm_sub_epi32(v[2], v[18]);
- u[19] = _mm_sub_epi32(v[3], v[19]);
- u[20] = _mm_sub_epi32(v[4], v[20]);
- u[21] = _mm_sub_epi32(v[5], v[21]);
- u[22] = _mm_sub_epi32(v[6], v[22]);
- u[23] = _mm_sub_epi32(v[7], v[23]);
- u[24] = _mm_sub_epi32(v[8], v[24]);
- u[25] = _mm_sub_epi32(v[9], v[25]);
- u[26] = _mm_sub_epi32(v[10], v[26]);
- u[27] = _mm_sub_epi32(v[11], v[27]);
- u[28] = _mm_sub_epi32(v[12], v[28]);
- u[29] = _mm_sub_epi32(v[13], v[29]);
- u[30] = _mm_sub_epi32(v[14], v[30]);
- u[31] = _mm_sub_epi32(v[15], v[31]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- v[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- v[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
- v[16] = _mm_add_epi32(u[16], k__DCT_CONST_ROUNDING);
- v[17] = _mm_add_epi32(u[17], k__DCT_CONST_ROUNDING);
- v[18] = _mm_add_epi32(u[18], k__DCT_CONST_ROUNDING);
- v[19] = _mm_add_epi32(u[19], k__DCT_CONST_ROUNDING);
- v[20] = _mm_add_epi32(u[20], k__DCT_CONST_ROUNDING);
- v[21] = _mm_add_epi32(u[21], k__DCT_CONST_ROUNDING);
- v[22] = _mm_add_epi32(u[22], k__DCT_CONST_ROUNDING);
- v[23] = _mm_add_epi32(u[23], k__DCT_CONST_ROUNDING);
- v[24] = _mm_add_epi32(u[24], k__DCT_CONST_ROUNDING);
- v[25] = _mm_add_epi32(u[25], k__DCT_CONST_ROUNDING);
- v[26] = _mm_add_epi32(u[26], k__DCT_CONST_ROUNDING);
- v[27] = _mm_add_epi32(u[27], k__DCT_CONST_ROUNDING);
- v[28] = _mm_add_epi32(u[28], k__DCT_CONST_ROUNDING);
- v[29] = _mm_add_epi32(u[29], k__DCT_CONST_ROUNDING);
- v[30] = _mm_add_epi32(u[30], k__DCT_CONST_ROUNDING);
- v[31] = _mm_add_epi32(u[31], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(v[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(v[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
- u[16] = _mm_srai_epi32(v[16], DCT_CONST_BITS);
- u[17] = _mm_srai_epi32(v[17], DCT_CONST_BITS);
- u[18] = _mm_srai_epi32(v[18], DCT_CONST_BITS);
- u[19] = _mm_srai_epi32(v[19], DCT_CONST_BITS);
- u[20] = _mm_srai_epi32(v[20], DCT_CONST_BITS);
- u[21] = _mm_srai_epi32(v[21], DCT_CONST_BITS);
- u[22] = _mm_srai_epi32(v[22], DCT_CONST_BITS);
- u[23] = _mm_srai_epi32(v[23], DCT_CONST_BITS);
- u[24] = _mm_srai_epi32(v[24], DCT_CONST_BITS);
- u[25] = _mm_srai_epi32(v[25], DCT_CONST_BITS);
- u[26] = _mm_srai_epi32(v[26], DCT_CONST_BITS);
- u[27] = _mm_srai_epi32(v[27], DCT_CONST_BITS);
- u[28] = _mm_srai_epi32(v[28], DCT_CONST_BITS);
- u[29] = _mm_srai_epi32(v[29], DCT_CONST_BITS);
- u[30] = _mm_srai_epi32(v[30], DCT_CONST_BITS);
- u[31] = _mm_srai_epi32(v[31], DCT_CONST_BITS);
-
- s[0] = _mm_packs_epi32(u[0], u[1]);
- s[1] = _mm_packs_epi32(u[2], u[3]);
- s[2] = _mm_packs_epi32(u[4], u[5]);
- s[3] = _mm_packs_epi32(u[6], u[7]);
- s[4] = _mm_packs_epi32(u[8], u[9]);
- s[5] = _mm_packs_epi32(u[10], u[11]);
- s[6] = _mm_packs_epi32(u[12], u[13]);
- s[7] = _mm_packs_epi32(u[14], u[15]);
- s[8] = _mm_packs_epi32(u[16], u[17]);
- s[9] = _mm_packs_epi32(u[18], u[19]);
- s[10] = _mm_packs_epi32(u[20], u[21]);
- s[11] = _mm_packs_epi32(u[22], u[23]);
- s[12] = _mm_packs_epi32(u[24], u[25]);
- s[13] = _mm_packs_epi32(u[26], u[27]);
- s[14] = _mm_packs_epi32(u[28], u[29]);
- s[15] = _mm_packs_epi32(u[30], u[31]);
-
- // stage 2
- u[0] = _mm_unpacklo_epi16(s[8], s[9]);
- u[1] = _mm_unpackhi_epi16(s[8], s[9]);
- u[2] = _mm_unpacklo_epi16(s[10], s[11]);
- u[3] = _mm_unpackhi_epi16(s[10], s[11]);
- u[4] = _mm_unpacklo_epi16(s[12], s[13]);
- u[5] = _mm_unpackhi_epi16(s[12], s[13]);
- u[6] = _mm_unpacklo_epi16(s[14], s[15]);
- u[7] = _mm_unpackhi_epi16(s[14], s[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p04_p28);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p04_p28);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p28_m04);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p28_m04);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p20_p12);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p20_p12);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p12_m20);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p12_m20);
- v[8] = _mm_madd_epi16(u[4], k__cospi_m28_p04);
- v[9] = _mm_madd_epi16(u[5], k__cospi_m28_p04);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p04_p28);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p04_p28);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m12_p20);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m12_p20);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p20_p12);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p20_p12);
-
- u[0] = _mm_add_epi32(v[0], v[8]);
- u[1] = _mm_add_epi32(v[1], v[9]);
- u[2] = _mm_add_epi32(v[2], v[10]);
- u[3] = _mm_add_epi32(v[3], v[11]);
- u[4] = _mm_add_epi32(v[4], v[12]);
- u[5] = _mm_add_epi32(v[5], v[13]);
- u[6] = _mm_add_epi32(v[6], v[14]);
- u[7] = _mm_add_epi32(v[7], v[15]);
- u[8] = _mm_sub_epi32(v[0], v[8]);
- u[9] = _mm_sub_epi32(v[1], v[9]);
- u[10] = _mm_sub_epi32(v[2], v[10]);
- u[11] = _mm_sub_epi32(v[3], v[11]);
- u[12] = _mm_sub_epi32(v[4], v[12]);
- u[13] = _mm_sub_epi32(v[5], v[13]);
- u[14] = _mm_sub_epi32(v[6], v[14]);
- u[15] = _mm_sub_epi32(v[7], v[15]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- v[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- v[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(v[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(v[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
-
- x[0] = _mm_add_epi16(s[0], s[4]);
- x[1] = _mm_add_epi16(s[1], s[5]);
- x[2] = _mm_add_epi16(s[2], s[6]);
- x[3] = _mm_add_epi16(s[3], s[7]);
- x[4] = _mm_sub_epi16(s[0], s[4]);
- x[5] = _mm_sub_epi16(s[1], s[5]);
- x[6] = _mm_sub_epi16(s[2], s[6]);
- x[7] = _mm_sub_epi16(s[3], s[7]);
- x[8] = _mm_packs_epi32(u[0], u[1]);
- x[9] = _mm_packs_epi32(u[2], u[3]);
- x[10] = _mm_packs_epi32(u[4], u[5]);
- x[11] = _mm_packs_epi32(u[6], u[7]);
- x[12] = _mm_packs_epi32(u[8], u[9]);
- x[13] = _mm_packs_epi32(u[10], u[11]);
- x[14] = _mm_packs_epi32(u[12], u[13]);
- x[15] = _mm_packs_epi32(u[14], u[15]);
-
- // stage 3
- u[0] = _mm_unpacklo_epi16(x[4], x[5]);
- u[1] = _mm_unpackhi_epi16(x[4], x[5]);
- u[2] = _mm_unpacklo_epi16(x[6], x[7]);
- u[3] = _mm_unpackhi_epi16(x[6], x[7]);
- u[4] = _mm_unpacklo_epi16(x[12], x[13]);
- u[5] = _mm_unpackhi_epi16(x[12], x[13]);
- u[6] = _mm_unpacklo_epi16(x[14], x[15]);
- u[7] = _mm_unpackhi_epi16(x[14], x[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p08_p24);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p08_p24);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p24_m08);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p24_m08);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m24_p08);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m24_p08);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p08_p24);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p08_p24);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p08_p24);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p08_p24);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p24_m08);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p24_m08);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m24_p08);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m24_p08);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p08_p24);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p08_p24);
-
- u[0] = _mm_add_epi32(v[0], v[4]);
- u[1] = _mm_add_epi32(v[1], v[5]);
- u[2] = _mm_add_epi32(v[2], v[6]);
- u[3] = _mm_add_epi32(v[3], v[7]);
- u[4] = _mm_sub_epi32(v[0], v[4]);
- u[5] = _mm_sub_epi32(v[1], v[5]);
- u[6] = _mm_sub_epi32(v[2], v[6]);
- u[7] = _mm_sub_epi32(v[3], v[7]);
- u[8] = _mm_add_epi32(v[8], v[12]);
- u[9] = _mm_add_epi32(v[9], v[13]);
- u[10] = _mm_add_epi32(v[10], v[14]);
- u[11] = _mm_add_epi32(v[11], v[15]);
- u[12] = _mm_sub_epi32(v[8], v[12]);
- u[13] = _mm_sub_epi32(v[9], v[13]);
- u[14] = _mm_sub_epi32(v[10], v[14]);
- u[15] = _mm_sub_epi32(v[11], v[15]);
-
- u[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- s[0] = _mm_add_epi16(x[0], x[2]);
- s[1] = _mm_add_epi16(x[1], x[3]);
- s[2] = _mm_sub_epi16(x[0], x[2]);
- s[3] = _mm_sub_epi16(x[1], x[3]);
- s[4] = _mm_packs_epi32(v[0], v[1]);
- s[5] = _mm_packs_epi32(v[2], v[3]);
- s[6] = _mm_packs_epi32(v[4], v[5]);
- s[7] = _mm_packs_epi32(v[6], v[7]);
- s[8] = _mm_add_epi16(x[8], x[10]);
- s[9] = _mm_add_epi16(x[9], x[11]);
- s[10] = _mm_sub_epi16(x[8], x[10]);
- s[11] = _mm_sub_epi16(x[9], x[11]);
- s[12] = _mm_packs_epi32(v[8], v[9]);
- s[13] = _mm_packs_epi32(v[10], v[11]);
- s[14] = _mm_packs_epi32(v[12], v[13]);
- s[15] = _mm_packs_epi32(v[14], v[15]);
-
- // stage 4
- u[0] = _mm_unpacklo_epi16(s[2], s[3]);
- u[1] = _mm_unpackhi_epi16(s[2], s[3]);
- u[2] = _mm_unpacklo_epi16(s[6], s[7]);
- u[3] = _mm_unpackhi_epi16(s[6], s[7]);
- u[4] = _mm_unpacklo_epi16(s[10], s[11]);
- u[5] = _mm_unpackhi_epi16(s[10], s[11]);
- u[6] = _mm_unpacklo_epi16(s[14], s[15]);
- u[7] = _mm_unpackhi_epi16(s[14], s[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_m16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_m16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_m16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_m16);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p16_p16);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p16_p16);
- v[6] = _mm_madd_epi16(u[2], k__cospi_m16_p16);
- v[7] = _mm_madd_epi16(u[3], k__cospi_m16_p16);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p16_p16);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p16_p16);
- v[10] = _mm_madd_epi16(u[4], k__cospi_m16_p16);
- v[11] = _mm_madd_epi16(u[5], k__cospi_m16_p16);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m16_m16);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m16_m16);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p16_m16);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p16_m16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(v[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(v[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(v[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(v[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(v[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(v[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(v[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(v[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- in[0] = s[0];
- in[1] = _mm_sub_epi16(kZero, s[8]);
- in[2] = s[12];
- in[3] = _mm_sub_epi16(kZero, s[4]);
- in[4] = _mm_packs_epi32(v[4], v[5]);
- in[5] = _mm_packs_epi32(v[12], v[13]);
- in[6] = _mm_packs_epi32(v[8], v[9]);
- in[7] = _mm_packs_epi32(v[0], v[1]);
- in[8] = _mm_packs_epi32(v[2], v[3]);
- in[9] = _mm_packs_epi32(v[10], v[11]);
- in[10] = _mm_packs_epi32(v[14], v[15]);
- in[11] = _mm_packs_epi32(v[6], v[7]);
- in[12] = s[5];
- in[13] = _mm_sub_epi16(kZero, s[13]);
- in[14] = s[9];
- in[15] = _mm_sub_epi16(kZero, s[1]);
-}
-
-static void idct16_8col(__m128i *in) {
- const __m128i k__cospi_p30_m02 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i k__cospi_p02_p30 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i k__cospi_p14_m18 = pair_set_epi16(cospi_14_64, -cospi_18_64);
- const __m128i k__cospi_p18_p14 = pair_set_epi16(cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p22_m10 = pair_set_epi16(cospi_22_64, -cospi_10_64);
- const __m128i k__cospi_p10_p22 = pair_set_epi16(cospi_10_64, cospi_22_64);
- const __m128i k__cospi_p06_m26 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i k__cospi_p26_p06 = pair_set_epi16(cospi_26_64, cospi_6_64);
- const __m128i k__cospi_p28_m04 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i k__cospi_p04_p28 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_m20 = pair_set_epi16(cospi_12_64, -cospi_20_64);
- const __m128i k__cospi_p20_p12 = pair_set_epi16(cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m24_m08 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m16_p16 = pair_set_epi16(-cospi_16_64, cospi_16_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i v[16], u[16], s[16], t[16];
-
- // stage 1
- s[0] = in[0];
- s[1] = in[8];
- s[2] = in[4];
- s[3] = in[12];
- s[4] = in[2];
- s[5] = in[10];
- s[6] = in[6];
- s[7] = in[14];
- s[8] = in[1];
- s[9] = in[9];
- s[10] = in[5];
- s[11] = in[13];
- s[12] = in[3];
- s[13] = in[11];
- s[14] = in[7];
- s[15] = in[15];
-
- // stage 2
- u[0] = _mm_unpacklo_epi16(s[8], s[15]);
- u[1] = _mm_unpackhi_epi16(s[8], s[15]);
- u[2] = _mm_unpacklo_epi16(s[9], s[14]);
- u[3] = _mm_unpackhi_epi16(s[9], s[14]);
- u[4] = _mm_unpacklo_epi16(s[10], s[13]);
- u[5] = _mm_unpackhi_epi16(s[10], s[13]);
- u[6] = _mm_unpacklo_epi16(s[11], s[12]);
- u[7] = _mm_unpackhi_epi16(s[11], s[12]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p30_m02);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p30_m02);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p02_p30);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p02_p30);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p14_m18);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p14_m18);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p18_p14);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p18_p14);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p22_m10);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p22_m10);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p10_p22);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p10_p22);
- v[12] = _mm_madd_epi16(u[6], k__cospi_p06_m26);
- v[13] = _mm_madd_epi16(u[7], k__cospi_p06_m26);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p26_p06);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p26_p06);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(v[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(v[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(v[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(v[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(v[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(v[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(v[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(v[15], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- s[8] = _mm_packs_epi32(u[0], u[1]);
- s[15] = _mm_packs_epi32(u[2], u[3]);
- s[9] = _mm_packs_epi32(u[4], u[5]);
- s[14] = _mm_packs_epi32(u[6], u[7]);
- s[10] = _mm_packs_epi32(u[8], u[9]);
- s[13] = _mm_packs_epi32(u[10], u[11]);
- s[11] = _mm_packs_epi32(u[12], u[13]);
- s[12] = _mm_packs_epi32(u[14], u[15]);
-
- // stage 3
- t[0] = s[0];
- t[1] = s[1];
- t[2] = s[2];
- t[3] = s[3];
- u[0] = _mm_unpacklo_epi16(s[4], s[7]);
- u[1] = _mm_unpackhi_epi16(s[4], s[7]);
- u[2] = _mm_unpacklo_epi16(s[5], s[6]);
- u[3] = _mm_unpackhi_epi16(s[5], s[6]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p28_m04);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p28_m04);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p04_p28);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p04_p28);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p12_m20);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p12_m20);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p20_p12);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p20_p12);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- t[4] = _mm_packs_epi32(u[0], u[1]);
- t[7] = _mm_packs_epi32(u[2], u[3]);
- t[5] = _mm_packs_epi32(u[4], u[5]);
- t[6] = _mm_packs_epi32(u[6], u[7]);
- t[8] = _mm_add_epi16(s[8], s[9]);
- t[9] = _mm_sub_epi16(s[8], s[9]);
- t[10] = _mm_sub_epi16(s[11], s[10]);
- t[11] = _mm_add_epi16(s[10], s[11]);
- t[12] = _mm_add_epi16(s[12], s[13]);
- t[13] = _mm_sub_epi16(s[12], s[13]);
- t[14] = _mm_sub_epi16(s[15], s[14]);
- t[15] = _mm_add_epi16(s[14], s[15]);
-
- // stage 4
- u[0] = _mm_unpacklo_epi16(t[0], t[1]);
- u[1] = _mm_unpackhi_epi16(t[0], t[1]);
- u[2] = _mm_unpacklo_epi16(t[2], t[3]);
- u[3] = _mm_unpackhi_epi16(t[2], t[3]);
- u[4] = _mm_unpacklo_epi16(t[9], t[14]);
- u[5] = _mm_unpackhi_epi16(t[9], t[14]);
- u[6] = _mm_unpacklo_epi16(t[10], t[13]);
- u[7] = _mm_unpackhi_epi16(t[10], t[13]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p16_p16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_m16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_m16);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p24_m08);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p24_m08);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p08_p24);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p08_p24);
- v[8] = _mm_madd_epi16(u[4], k__cospi_m08_p24);
- v[9] = _mm_madd_epi16(u[5], k__cospi_m08_p24);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p24_p08);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p24_p08);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m24_m08);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m24_m08);
- v[14] = _mm_madd_epi16(u[6], k__cospi_m08_p24);
- v[15] = _mm_madd_epi16(u[7], k__cospi_m08_p24);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(v[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(v[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(v[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(v[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(v[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(v[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(v[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(v[15], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- s[0] = _mm_packs_epi32(u[0], u[1]);
- s[1] = _mm_packs_epi32(u[2], u[3]);
- s[2] = _mm_packs_epi32(u[4], u[5]);
- s[3] = _mm_packs_epi32(u[6], u[7]);
- s[4] = _mm_add_epi16(t[4], t[5]);
- s[5] = _mm_sub_epi16(t[4], t[5]);
- s[6] = _mm_sub_epi16(t[7], t[6]);
- s[7] = _mm_add_epi16(t[6], t[7]);
- s[8] = t[8];
- s[15] = t[15];
- s[9] = _mm_packs_epi32(u[8], u[9]);
- s[14] = _mm_packs_epi32(u[10], u[11]);
- s[10] = _mm_packs_epi32(u[12], u[13]);
- s[13] = _mm_packs_epi32(u[14], u[15]);
- s[11] = t[11];
- s[12] = t[12];
-
- // stage 5
- t[0] = _mm_add_epi16(s[0], s[3]);
- t[1] = _mm_add_epi16(s[1], s[2]);
- t[2] = _mm_sub_epi16(s[1], s[2]);
- t[3] = _mm_sub_epi16(s[0], s[3]);
- t[4] = s[4];
- t[7] = s[7];
-
- u[0] = _mm_unpacklo_epi16(s[5], s[6]);
- u[1] = _mm_unpackhi_epi16(s[5], s[6]);
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_p16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_p16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_p16);
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- t[5] = _mm_packs_epi32(u[0], u[1]);
- t[6] = _mm_packs_epi32(u[2], u[3]);
-
- t[8] = _mm_add_epi16(s[8], s[11]);
- t[9] = _mm_add_epi16(s[9], s[10]);
- t[10] = _mm_sub_epi16(s[9], s[10]);
- t[11] = _mm_sub_epi16(s[8], s[11]);
- t[12] = _mm_sub_epi16(s[15], s[12]);
- t[13] = _mm_sub_epi16(s[14], s[13]);
- t[14] = _mm_add_epi16(s[13], s[14]);
- t[15] = _mm_add_epi16(s[12], s[15]);
-
- // stage 6
- s[0] = _mm_add_epi16(t[0], t[7]);
- s[1] = _mm_add_epi16(t[1], t[6]);
- s[2] = _mm_add_epi16(t[2], t[5]);
- s[3] = _mm_add_epi16(t[3], t[4]);
- s[4] = _mm_sub_epi16(t[3], t[4]);
- s[5] = _mm_sub_epi16(t[2], t[5]);
- s[6] = _mm_sub_epi16(t[1], t[6]);
- s[7] = _mm_sub_epi16(t[0], t[7]);
- s[8] = t[8];
- s[9] = t[9];
-
- u[0] = _mm_unpacklo_epi16(t[10], t[13]);
- u[1] = _mm_unpackhi_epi16(t[10], t[13]);
- u[2] = _mm_unpacklo_epi16(t[11], t[12]);
- u[3] = _mm_unpackhi_epi16(t[11], t[12]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_p16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_p16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_p16);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m16_p16);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m16_p16);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p16_p16);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p16_p16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- s[10] = _mm_packs_epi32(u[0], u[1]);
- s[13] = _mm_packs_epi32(u[2], u[3]);
- s[11] = _mm_packs_epi32(u[4], u[5]);
- s[12] = _mm_packs_epi32(u[6], u[7]);
- s[14] = t[14];
- s[15] = t[15];
-
- // stage 7
- in[0] = _mm_add_epi16(s[0], s[15]);
- in[1] = _mm_add_epi16(s[1], s[14]);
- in[2] = _mm_add_epi16(s[2], s[13]);
- in[3] = _mm_add_epi16(s[3], s[12]);
- in[4] = _mm_add_epi16(s[4], s[11]);
- in[5] = _mm_add_epi16(s[5], s[10]);
- in[6] = _mm_add_epi16(s[6], s[9]);
- in[7] = _mm_add_epi16(s[7], s[8]);
- in[8] = _mm_sub_epi16(s[7], s[8]);
- in[9] = _mm_sub_epi16(s[6], s[9]);
- in[10] = _mm_sub_epi16(s[5], s[10]);
- in[11] = _mm_sub_epi16(s[4], s[11]);
- in[12] = _mm_sub_epi16(s[3], s[12]);
- in[13] = _mm_sub_epi16(s[2], s[13]);
- in[14] = _mm_sub_epi16(s[1], s[14]);
- in[15] = _mm_sub_epi16(s[0], s[15]);
-}
-
-static void idct16_sse2(__m128i *in0, __m128i *in1) {
- array_transpose_16x16(in0, in1);
- idct16_8col(in0);
- idct16_8col(in1);
-}
-
-static void iadst16_sse2(__m128i *in0, __m128i *in1) {
- array_transpose_16x16(in0, in1);
- iadst16_8col(in0);
- iadst16_8col(in1);
-}
-
-static INLINE void load_buffer_8x16(const int16_t *input, __m128i *in) {
- in[0] = _mm_load_si128((const __m128i *)(input + 0 * 16));
- in[1] = _mm_load_si128((const __m128i *)(input + 1 * 16));
- in[2] = _mm_load_si128((const __m128i *)(input + 2 * 16));
- in[3] = _mm_load_si128((const __m128i *)(input + 3 * 16));
- in[4] = _mm_load_si128((const __m128i *)(input + 4 * 16));
- in[5] = _mm_load_si128((const __m128i *)(input + 5 * 16));
- in[6] = _mm_load_si128((const __m128i *)(input + 6 * 16));
- in[7] = _mm_load_si128((const __m128i *)(input + 7 * 16));
-
- in[8] = _mm_load_si128((const __m128i *)(input + 8 * 16));
- in[9] = _mm_load_si128((const __m128i *)(input + 9 * 16));
- in[10] = _mm_load_si128((const __m128i *)(input + 10 * 16));
- in[11] = _mm_load_si128((const __m128i *)(input + 11 * 16));
- in[12] = _mm_load_si128((const __m128i *)(input + 12 * 16));
- in[13] = _mm_load_si128((const __m128i *)(input + 13 * 16));
- in[14] = _mm_load_si128((const __m128i *)(input + 14 * 16));
- in[15] = _mm_load_si128((const __m128i *)(input + 15 * 16));
-}
-
-static INLINE void write_buffer_8x16(uint8_t *dest, __m128i *in, int stride) {
- const __m128i final_rounding = _mm_set1_epi16(1<<5);
- const __m128i zero = _mm_setzero_si128();
- // Final rounding and shift
- in[0] = _mm_adds_epi16(in[0], final_rounding);
- in[1] = _mm_adds_epi16(in[1], final_rounding);
- in[2] = _mm_adds_epi16(in[2], final_rounding);
- in[3] = _mm_adds_epi16(in[3], final_rounding);
- in[4] = _mm_adds_epi16(in[4], final_rounding);
- in[5] = _mm_adds_epi16(in[5], final_rounding);
- in[6] = _mm_adds_epi16(in[6], final_rounding);
- in[7] = _mm_adds_epi16(in[7], final_rounding);
- in[8] = _mm_adds_epi16(in[8], final_rounding);
- in[9] = _mm_adds_epi16(in[9], final_rounding);
- in[10] = _mm_adds_epi16(in[10], final_rounding);
- in[11] = _mm_adds_epi16(in[11], final_rounding);
- in[12] = _mm_adds_epi16(in[12], final_rounding);
- in[13] = _mm_adds_epi16(in[13], final_rounding);
- in[14] = _mm_adds_epi16(in[14], final_rounding);
- in[15] = _mm_adds_epi16(in[15], final_rounding);
-
- in[0] = _mm_srai_epi16(in[0], 6);
- in[1] = _mm_srai_epi16(in[1], 6);
- in[2] = _mm_srai_epi16(in[2], 6);
- in[3] = _mm_srai_epi16(in[3], 6);
- in[4] = _mm_srai_epi16(in[4], 6);
- in[5] = _mm_srai_epi16(in[5], 6);
- in[6] = _mm_srai_epi16(in[6], 6);
- in[7] = _mm_srai_epi16(in[7], 6);
- in[8] = _mm_srai_epi16(in[8], 6);
- in[9] = _mm_srai_epi16(in[9], 6);
- in[10] = _mm_srai_epi16(in[10], 6);
- in[11] = _mm_srai_epi16(in[11], 6);
- in[12] = _mm_srai_epi16(in[12], 6);
- in[13] = _mm_srai_epi16(in[13], 6);
- in[14] = _mm_srai_epi16(in[14], 6);
- in[15] = _mm_srai_epi16(in[15], 6);
-
- RECON_AND_STORE(dest, in[0]);
- RECON_AND_STORE(dest, in[1]);
- RECON_AND_STORE(dest, in[2]);
- RECON_AND_STORE(dest, in[3]);
- RECON_AND_STORE(dest, in[4]);
- RECON_AND_STORE(dest, in[5]);
- RECON_AND_STORE(dest, in[6]);
- RECON_AND_STORE(dest, in[7]);
- RECON_AND_STORE(dest, in[8]);
- RECON_AND_STORE(dest, in[9]);
- RECON_AND_STORE(dest, in[10]);
- RECON_AND_STORE(dest, in[11]);
- RECON_AND_STORE(dest, in[12]);
- RECON_AND_STORE(dest, in[13]);
- RECON_AND_STORE(dest, in[14]);
- RECON_AND_STORE(dest, in[15]);
-}
-
-void vp9_iht16x16_256_add_sse2(const int16_t *input, uint8_t *dest, int stride,
- int tx_type) {
- __m128i in0[16], in1[16];
-
- load_buffer_8x16(input, in0);
- input += 8;
- load_buffer_8x16(input, in1);
-
- switch (tx_type) {
- case 0: // DCT_DCT
- idct16_sse2(in0, in1);
- idct16_sse2(in0, in1);
- break;
- case 1: // ADST_DCT
- idct16_sse2(in0, in1);
- iadst16_sse2(in0, in1);
- break;
- case 2: // DCT_ADST
- iadst16_sse2(in0, in1);
- idct16_sse2(in0, in1);
- break;
- case 3: // ADST_ADST
- iadst16_sse2(in0, in1);
- iadst16_sse2(in0, in1);
- break;
- default:
- assert(0);
- break;
- }
-
- write_buffer_8x16(dest, in0, stride);
- dest += 8;
- write_buffer_8x16(dest, in1, stride);
-}
-
-void vp9_idct16x16_10_add_sse2(const int16_t *input, uint8_t *dest,
- int stride) {
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i final_rounding = _mm_set1_epi16(1<<5);
- const __m128i zero = _mm_setzero_si128();
-
- const __m128i stg2_0 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i stg2_1 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i stg2_6 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i stg2_7 = pair_set_epi16(cospi_26_64, cospi_6_64);
-
- const __m128i stg3_0 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i stg3_1 = pair_set_epi16(cospi_4_64, cospi_28_64);
-
- const __m128i stg4_0 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i stg4_1 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i stg4_4 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i stg4_5 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i stg4_6 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i stg4_7 = pair_set_epi16(-cospi_8_64, cospi_24_64);
-
- const __m128i stg6_0 = pair_set_epi16(-cospi_16_64, cospi_16_64);
- __m128i in[16], l[16];
- __m128i stp1_0, stp1_1, stp1_2, stp1_3, stp1_4, stp1_5, stp1_6,
- stp1_8, stp1_9, stp1_10, stp1_11, stp1_12, stp1_13, stp1_14, stp1_15,
- stp1_8_0, stp1_12_0;
- __m128i stp2_0, stp2_1, stp2_2, stp2_3, stp2_4, stp2_5, stp2_6, stp2_7,
- stp2_8, stp2_9, stp2_10, stp2_11, stp2_12, stp2_13, stp2_14;
- __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int i;
- // First 1-D inverse DCT
- // Load input data.
- in[0] = _mm_load_si128((const __m128i *)input);
- in[1] = _mm_load_si128((const __m128i *)(input + 8 * 2));
- in[2] = _mm_load_si128((const __m128i *)(input + 8 * 4));
- in[3] = _mm_load_si128((const __m128i *)(input + 8 * 6));
-
- TRANSPOSE_8X4(in[0], in[1], in[2], in[3], in[0], in[1]);
-
- // Stage2
- {
- const __m128i lo_1_15 = _mm_unpackhi_epi16(in[0], zero);
- const __m128i lo_13_3 = _mm_unpackhi_epi16(zero, in[1]);
-
- tmp0 = _mm_madd_epi16(lo_1_15, stg2_0);
- tmp2 = _mm_madd_epi16(lo_1_15, stg2_1);
- tmp5 = _mm_madd_epi16(lo_13_3, stg2_6);
- tmp7 = _mm_madd_epi16(lo_13_3, stg2_7);
-
- tmp0 = _mm_add_epi32(tmp0, rounding);
- tmp2 = _mm_add_epi32(tmp2, rounding);
- tmp5 = _mm_add_epi32(tmp5, rounding);
- tmp7 = _mm_add_epi32(tmp7, rounding);
-
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS);
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS);
- tmp5 = _mm_srai_epi32(tmp5, DCT_CONST_BITS);
- tmp7 = _mm_srai_epi32(tmp7, DCT_CONST_BITS);
-
- stp2_8 = _mm_packs_epi32(tmp0, tmp2);
- stp2_11 = _mm_packs_epi32(tmp5, tmp7);
- }
-
- // Stage3
- {
- const __m128i lo_2_14 = _mm_unpacklo_epi16(in[1], zero);
-
- tmp0 = _mm_madd_epi16(lo_2_14, stg3_0);
- tmp2 = _mm_madd_epi16(lo_2_14, stg3_1);
-
- tmp0 = _mm_add_epi32(tmp0, rounding);
- tmp2 = _mm_add_epi32(tmp2, rounding);
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS);
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS);
-
- stp1_13 = _mm_unpackhi_epi64(stp2_11, zero);
- stp1_14 = _mm_unpackhi_epi64(stp2_8, zero);
-
- stp1_4 = _mm_packs_epi32(tmp0, tmp2);
- }
-
- // Stage4
- {
- const __m128i lo_0_8 = _mm_unpacklo_epi16(in[0], zero);
- const __m128i lo_9_14 = _mm_unpacklo_epi16(stp2_8, stp1_14);
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp2_11, stp1_13);
-
- tmp0 = _mm_madd_epi16(lo_0_8, stg4_0);
- tmp2 = _mm_madd_epi16(lo_0_8, stg4_1);
- tmp1 = _mm_madd_epi16(lo_9_14, stg4_4);
- tmp3 = _mm_madd_epi16(lo_9_14, stg4_5);
- tmp5 = _mm_madd_epi16(lo_10_13, stg4_6);
- tmp7 = _mm_madd_epi16(lo_10_13, stg4_7);
-
- tmp0 = _mm_add_epi32(tmp0, rounding);
- tmp2 = _mm_add_epi32(tmp2, rounding);
- tmp1 = _mm_add_epi32(tmp1, rounding);
- tmp3 = _mm_add_epi32(tmp3, rounding);
- tmp5 = _mm_add_epi32(tmp5, rounding);
- tmp7 = _mm_add_epi32(tmp7, rounding);
-
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS);
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS);
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS);
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS);
- tmp5 = _mm_srai_epi32(tmp5, DCT_CONST_BITS);
- tmp7 = _mm_srai_epi32(tmp7, DCT_CONST_BITS);
-
- stp1_0 = _mm_packs_epi32(tmp0, tmp0);
- stp1_1 = _mm_packs_epi32(tmp2, tmp2);
- stp2_9 = _mm_packs_epi32(tmp1, tmp3);
- stp2_10 = _mm_packs_epi32(tmp5, tmp7);
-
- stp2_6 = _mm_unpackhi_epi64(stp1_4, zero);
- }
-
- // Stage5 and Stage6
- {
- tmp0 = _mm_add_epi16(stp2_8, stp2_11);
- tmp1 = _mm_sub_epi16(stp2_8, stp2_11);
- tmp2 = _mm_add_epi16(stp2_9, stp2_10);
- tmp3 = _mm_sub_epi16(stp2_9, stp2_10);
-
- stp1_9 = _mm_unpacklo_epi64(tmp2, zero);
- stp1_10 = _mm_unpacklo_epi64(tmp3, zero);
- stp1_8 = _mm_unpacklo_epi64(tmp0, zero);
- stp1_11 = _mm_unpacklo_epi64(tmp1, zero);
-
- stp1_13 = _mm_unpackhi_epi64(tmp3, zero);
- stp1_14 = _mm_unpackhi_epi64(tmp2, zero);
- stp1_12 = _mm_unpackhi_epi64(tmp1, zero);
- stp1_15 = _mm_unpackhi_epi64(tmp0, zero);
- }
-
- // Stage6
- {
- const __m128i lo_6_5 = _mm_unpacklo_epi16(stp2_6, stp1_4);
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13);
- const __m128i lo_11_12 = _mm_unpacklo_epi16(stp1_11, stp1_12);
-
- tmp1 = _mm_madd_epi16(lo_6_5, stg4_1);
- tmp3 = _mm_madd_epi16(lo_6_5, stg4_0);
- tmp0 = _mm_madd_epi16(lo_10_13, stg6_0);
- tmp2 = _mm_madd_epi16(lo_10_13, stg4_0);
- tmp4 = _mm_madd_epi16(lo_11_12, stg6_0);
- tmp6 = _mm_madd_epi16(lo_11_12, stg4_0);
-
- tmp1 = _mm_add_epi32(tmp1, rounding);
- tmp3 = _mm_add_epi32(tmp3, rounding);
- tmp0 = _mm_add_epi32(tmp0, rounding);
- tmp2 = _mm_add_epi32(tmp2, rounding);
- tmp4 = _mm_add_epi32(tmp4, rounding);
- tmp6 = _mm_add_epi32(tmp6, rounding);
-
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS);
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS);
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS);
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS);
- tmp4 = _mm_srai_epi32(tmp4, DCT_CONST_BITS);
- tmp6 = _mm_srai_epi32(tmp6, DCT_CONST_BITS);
-
- stp1_6 = _mm_packs_epi32(tmp3, tmp1);
-
- stp2_10 = _mm_packs_epi32(tmp0, zero);
- stp2_13 = _mm_packs_epi32(tmp2, zero);
- stp2_11 = _mm_packs_epi32(tmp4, zero);
- stp2_12 = _mm_packs_epi32(tmp6, zero);
-
- tmp0 = _mm_add_epi16(stp1_0, stp1_4);
- tmp1 = _mm_sub_epi16(stp1_0, stp1_4);
- tmp2 = _mm_add_epi16(stp1_1, stp1_6);
- tmp3 = _mm_sub_epi16(stp1_1, stp1_6);
-
- stp2_0 = _mm_unpackhi_epi64(tmp0, zero);
- stp2_1 = _mm_unpacklo_epi64(tmp2, zero);
- stp2_2 = _mm_unpackhi_epi64(tmp2, zero);
- stp2_3 = _mm_unpacklo_epi64(tmp0, zero);
- stp2_4 = _mm_unpacklo_epi64(tmp1, zero);
- stp2_5 = _mm_unpackhi_epi64(tmp3, zero);
- stp2_6 = _mm_unpacklo_epi64(tmp3, zero);
- stp2_7 = _mm_unpackhi_epi64(tmp1, zero);
- }
-
- // Stage7. Left 8x16 only.
- l[0] = _mm_add_epi16(stp2_0, stp1_15);
- l[1] = _mm_add_epi16(stp2_1, stp1_14);
- l[2] = _mm_add_epi16(stp2_2, stp2_13);
- l[3] = _mm_add_epi16(stp2_3, stp2_12);
- l[4] = _mm_add_epi16(stp2_4, stp2_11);
- l[5] = _mm_add_epi16(stp2_5, stp2_10);
- l[6] = _mm_add_epi16(stp2_6, stp1_9);
- l[7] = _mm_add_epi16(stp2_7, stp1_8);
- l[8] = _mm_sub_epi16(stp2_7, stp1_8);
- l[9] = _mm_sub_epi16(stp2_6, stp1_9);
- l[10] = _mm_sub_epi16(stp2_5, stp2_10);
- l[11] = _mm_sub_epi16(stp2_4, stp2_11);
- l[12] = _mm_sub_epi16(stp2_3, stp2_12);
- l[13] = _mm_sub_epi16(stp2_2, stp2_13);
- l[14] = _mm_sub_epi16(stp2_1, stp1_14);
- l[15] = _mm_sub_epi16(stp2_0, stp1_15);
-
- // Second 1-D inverse transform, performed per 8x16 block
- for (i = 0; i < 2; i++) {
- array_transpose_4X8(l + 8*i, in);
-
- IDCT16_10
-
- // Stage7
- in[0] = _mm_add_epi16(stp2_0, stp1_15);
- in[1] = _mm_add_epi16(stp2_1, stp1_14);
- in[2] = _mm_add_epi16(stp2_2, stp2_13);
- in[3] = _mm_add_epi16(stp2_3, stp2_12);
- in[4] = _mm_add_epi16(stp2_4, stp2_11);
- in[5] = _mm_add_epi16(stp2_5, stp2_10);
- in[6] = _mm_add_epi16(stp2_6, stp1_9);
- in[7] = _mm_add_epi16(stp2_7, stp1_8);
- in[8] = _mm_sub_epi16(stp2_7, stp1_8);
- in[9] = _mm_sub_epi16(stp2_6, stp1_9);
- in[10] = _mm_sub_epi16(stp2_5, stp2_10);
- in[11] = _mm_sub_epi16(stp2_4, stp2_11);
- in[12] = _mm_sub_epi16(stp2_3, stp2_12);
- in[13] = _mm_sub_epi16(stp2_2, stp2_13);
- in[14] = _mm_sub_epi16(stp2_1, stp1_14);
- in[15] = _mm_sub_epi16(stp2_0, stp1_15);
-
- // Final rounding and shift
- in[0] = _mm_adds_epi16(in[0], final_rounding);
- in[1] = _mm_adds_epi16(in[1], final_rounding);
- in[2] = _mm_adds_epi16(in[2], final_rounding);
- in[3] = _mm_adds_epi16(in[3], final_rounding);
- in[4] = _mm_adds_epi16(in[4], final_rounding);
- in[5] = _mm_adds_epi16(in[5], final_rounding);
- in[6] = _mm_adds_epi16(in[6], final_rounding);
- in[7] = _mm_adds_epi16(in[7], final_rounding);
- in[8] = _mm_adds_epi16(in[8], final_rounding);
- in[9] = _mm_adds_epi16(in[9], final_rounding);
- in[10] = _mm_adds_epi16(in[10], final_rounding);
- in[11] = _mm_adds_epi16(in[11], final_rounding);
- in[12] = _mm_adds_epi16(in[12], final_rounding);
- in[13] = _mm_adds_epi16(in[13], final_rounding);
- in[14] = _mm_adds_epi16(in[14], final_rounding);
- in[15] = _mm_adds_epi16(in[15], final_rounding);
-
- in[0] = _mm_srai_epi16(in[0], 6);
- in[1] = _mm_srai_epi16(in[1], 6);
- in[2] = _mm_srai_epi16(in[2], 6);
- in[3] = _mm_srai_epi16(in[3], 6);
- in[4] = _mm_srai_epi16(in[4], 6);
- in[5] = _mm_srai_epi16(in[5], 6);
- in[6] = _mm_srai_epi16(in[6], 6);
- in[7] = _mm_srai_epi16(in[7], 6);
- in[8] = _mm_srai_epi16(in[8], 6);
- in[9] = _mm_srai_epi16(in[9], 6);
- in[10] = _mm_srai_epi16(in[10], 6);
- in[11] = _mm_srai_epi16(in[11], 6);
- in[12] = _mm_srai_epi16(in[12], 6);
- in[13] = _mm_srai_epi16(in[13], 6);
- in[14] = _mm_srai_epi16(in[14], 6);
- in[15] = _mm_srai_epi16(in[15], 6);
-
- RECON_AND_STORE(dest, in[0]);
- RECON_AND_STORE(dest, in[1]);
- RECON_AND_STORE(dest, in[2]);
- RECON_AND_STORE(dest, in[3]);
- RECON_AND_STORE(dest, in[4]);
- RECON_AND_STORE(dest, in[5]);
- RECON_AND_STORE(dest, in[6]);
- RECON_AND_STORE(dest, in[7]);
- RECON_AND_STORE(dest, in[8]);
- RECON_AND_STORE(dest, in[9]);
- RECON_AND_STORE(dest, in[10]);
- RECON_AND_STORE(dest, in[11]);
- RECON_AND_STORE(dest, in[12]);
- RECON_AND_STORE(dest, in[13]);
- RECON_AND_STORE(dest, in[14]);
- RECON_AND_STORE(dest, in[15]);
-
- dest += 8 - (stride * 16);
- }
-}
-
-#define LOAD_DQCOEFF(reg, input) \
- { \
- reg = _mm_load_si128((const __m128i *) input); \
- input += 8; \
- } \
-
-#define IDCT32_34 \
-/* Stage1 */ \
-{ \
- const __m128i zero = _mm_setzero_si128();\
- const __m128i lo_1_31 = _mm_unpacklo_epi16(in[1], zero); \
- const __m128i hi_1_31 = _mm_unpackhi_epi16(in[1], zero); \
- \
- const __m128i lo_25_7= _mm_unpacklo_epi16(zero, in[7]); \
- const __m128i hi_25_7 = _mm_unpackhi_epi16(zero, in[7]); \
- \
- const __m128i lo_5_27 = _mm_unpacklo_epi16(in[5], zero); \
- const __m128i hi_5_27 = _mm_unpackhi_epi16(in[5], zero); \
- \
- const __m128i lo_29_3 = _mm_unpacklo_epi16(zero, in[3]); \
- const __m128i hi_29_3 = _mm_unpackhi_epi16(zero, in[3]); \
- \
- MULTIPLICATION_AND_ADD_2(lo_1_31, hi_1_31, stg1_0, \
- stg1_1, stp1_16, stp1_31); \
- MULTIPLICATION_AND_ADD_2(lo_25_7, hi_25_7, stg1_6, \
- stg1_7, stp1_19, stp1_28); \
- MULTIPLICATION_AND_ADD_2(lo_5_27, hi_5_27, stg1_8, \
- stg1_9, stp1_20, stp1_27); \
- MULTIPLICATION_AND_ADD_2(lo_29_3, hi_29_3, stg1_14, \
- stg1_15, stp1_23, stp1_24); \
-} \
-\
-/* Stage2 */ \
-{ \
- const __m128i zero = _mm_setzero_si128();\
- const __m128i lo_2_30 = _mm_unpacklo_epi16(in[2], zero); \
- const __m128i hi_2_30 = _mm_unpackhi_epi16(in[2], zero); \
- \
- const __m128i lo_26_6 = _mm_unpacklo_epi16(zero, in[6]); \
- const __m128i hi_26_6 = _mm_unpackhi_epi16(zero, in[6]); \
- \
- MULTIPLICATION_AND_ADD_2(lo_2_30, hi_2_30, stg2_0, \
- stg2_1, stp2_8, stp2_15); \
- MULTIPLICATION_AND_ADD_2(lo_26_6, hi_26_6, stg2_6, \
- stg2_7, stp2_11, stp2_12); \
- \
- stp2_16 = stp1_16; \
- stp2_19 = stp1_19; \
- \
- stp2_20 = stp1_20; \
- stp2_23 = stp1_23; \
- \
- stp2_24 = stp1_24; \
- stp2_27 = stp1_27; \
- \
- stp2_28 = stp1_28; \
- stp2_31 = stp1_31; \
-} \
-\
-/* Stage3 */ \
-{ \
- const __m128i zero = _mm_setzero_si128();\
- const __m128i lo_4_28 = _mm_unpacklo_epi16(in[4], zero); \
- const __m128i hi_4_28 = _mm_unpackhi_epi16(in[4], zero); \
- \
- const __m128i lo_17_30 = _mm_unpacklo_epi16(stp1_16, stp1_31); \
- const __m128i hi_17_30 = _mm_unpackhi_epi16(stp1_16, stp1_31); \
- const __m128i lo_18_29 = _mm_unpacklo_epi16(stp1_19, stp1_28); \
- const __m128i hi_18_29 = _mm_unpackhi_epi16(stp1_19, stp1_28); \
- \
- const __m128i lo_21_26 = _mm_unpacklo_epi16(stp1_20, stp1_27); \
- const __m128i hi_21_26 = _mm_unpackhi_epi16(stp1_20, stp1_27); \
- const __m128i lo_22_25 = _mm_unpacklo_epi16(stp1_23, stp1_24); \
- const __m128i hi_22_25 = _mm_unpackhi_epi16(stp1_23, stp2_24); \
- \
- MULTIPLICATION_AND_ADD_2(lo_4_28, hi_4_28, stg3_0, \
- stg3_1, stp1_4, stp1_7); \
- \
- stp1_8 = stp2_8; \
- stp1_11 = stp2_11; \
- stp1_12 = stp2_12; \
- stp1_15 = stp2_15; \
- \
- MULTIPLICATION_AND_ADD(lo_17_30, hi_17_30, lo_18_29, hi_18_29, stg3_4, \
- stg3_5, stg3_6, stg3_4, stp1_17, stp1_30, \
- stp1_18, stp1_29) \
- MULTIPLICATION_AND_ADD(lo_21_26, hi_21_26, lo_22_25, hi_22_25, stg3_8, \
- stg3_9, stg3_10, stg3_8, stp1_21, stp1_26, \
- stp1_22, stp1_25) \
- \
- stp1_16 = stp2_16; \
- stp1_31 = stp2_31; \
- stp1_19 = stp2_19; \
- stp1_20 = stp2_20; \
- stp1_23 = stp2_23; \
- stp1_24 = stp2_24; \
- stp1_27 = stp2_27; \
- stp1_28 = stp2_28; \
-} \
-\
-/* Stage4 */ \
-{ \
- const __m128i zero = _mm_setzero_si128();\
- const __m128i lo_0_16 = _mm_unpacklo_epi16(in[0], zero); \
- const __m128i hi_0_16 = _mm_unpackhi_epi16(in[0], zero); \
- \
- const __m128i lo_9_14 = _mm_unpacklo_epi16(stp2_8, stp2_15); \
- const __m128i hi_9_14 = _mm_unpackhi_epi16(stp2_8, stp2_15); \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp2_11, stp2_12); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp2_11, stp2_12); \
- \
- MULTIPLICATION_AND_ADD_2(lo_0_16, hi_0_16, stg4_0, \
- stg4_1, stp2_0, stp2_1); \
- \
- stp2_4 = stp1_4; \
- stp2_5 = stp1_4; \
- stp2_6 = stp1_7; \
- stp2_7 = stp1_7; \
- \
- MULTIPLICATION_AND_ADD(lo_9_14, hi_9_14, lo_10_13, hi_10_13, stg4_4, \
- stg4_5, stg4_6, stg4_4, stp2_9, stp2_14, \
- stp2_10, stp2_13) \
- \
- stp2_8 = stp1_8; \
- stp2_15 = stp1_15; \
- stp2_11 = stp1_11; \
- stp2_12 = stp1_12; \
- \
- stp2_16 = _mm_add_epi16(stp1_16, stp1_19); \
- stp2_17 = _mm_add_epi16(stp1_17, stp1_18); \
- stp2_18 = _mm_sub_epi16(stp1_17, stp1_18); \
- stp2_19 = _mm_sub_epi16(stp1_16, stp1_19); \
- stp2_20 = _mm_sub_epi16(stp1_23, stp1_20); \
- stp2_21 = _mm_sub_epi16(stp1_22, stp1_21); \
- stp2_22 = _mm_add_epi16(stp1_22, stp1_21); \
- stp2_23 = _mm_add_epi16(stp1_23, stp1_20); \
- \
- stp2_24 = _mm_add_epi16(stp1_24, stp1_27); \
- stp2_25 = _mm_add_epi16(stp1_25, stp1_26); \
- stp2_26 = _mm_sub_epi16(stp1_25, stp1_26); \
- stp2_27 = _mm_sub_epi16(stp1_24, stp1_27); \
- stp2_28 = _mm_sub_epi16(stp1_31, stp1_28); \
- stp2_29 = _mm_sub_epi16(stp1_30, stp1_29); \
- stp2_30 = _mm_add_epi16(stp1_29, stp1_30); \
- stp2_31 = _mm_add_epi16(stp1_28, stp1_31); \
-} \
-\
-/* Stage5 */ \
-{ \
- const __m128i lo_6_5 = _mm_unpacklo_epi16(stp2_6, stp2_5); \
- const __m128i hi_6_5 = _mm_unpackhi_epi16(stp2_6, stp2_5); \
- const __m128i lo_18_29 = _mm_unpacklo_epi16(stp2_18, stp2_29); \
- const __m128i hi_18_29 = _mm_unpackhi_epi16(stp2_18, stp2_29); \
- \
- const __m128i lo_19_28 = _mm_unpacklo_epi16(stp2_19, stp2_28); \
- const __m128i hi_19_28 = _mm_unpackhi_epi16(stp2_19, stp2_28); \
- const __m128i lo_20_27 = _mm_unpacklo_epi16(stp2_20, stp2_27); \
- const __m128i hi_20_27 = _mm_unpackhi_epi16(stp2_20, stp2_27); \
- \
- const __m128i lo_21_26 = _mm_unpacklo_epi16(stp2_21, stp2_26); \
- const __m128i hi_21_26 = _mm_unpackhi_epi16(stp2_21, stp2_26); \
- \
- stp1_0 = stp2_0; \
- stp1_1 = stp2_1; \
- stp1_2 = stp2_1; \
- stp1_3 = stp2_0; \
- \
- tmp0 = _mm_madd_epi16(lo_6_5, stg4_1); \
- tmp1 = _mm_madd_epi16(hi_6_5, stg4_1); \
- tmp2 = _mm_madd_epi16(lo_6_5, stg4_0); \
- tmp3 = _mm_madd_epi16(hi_6_5, stg4_0); \
- \
- tmp0 = _mm_add_epi32(tmp0, rounding); \
- tmp1 = _mm_add_epi32(tmp1, rounding); \
- tmp2 = _mm_add_epi32(tmp2, rounding); \
- tmp3 = _mm_add_epi32(tmp3, rounding); \
- \
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS); \
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS); \
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS); \
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS); \
- \
- stp1_5 = _mm_packs_epi32(tmp0, tmp1); \
- stp1_6 = _mm_packs_epi32(tmp2, tmp3); \
- \
- stp1_4 = stp2_4; \
- stp1_7 = stp2_7; \
- \
- stp1_8 = _mm_add_epi16(stp2_8, stp2_11); \
- stp1_9 = _mm_add_epi16(stp2_9, stp2_10); \
- stp1_10 = _mm_sub_epi16(stp2_9, stp2_10); \
- stp1_11 = _mm_sub_epi16(stp2_8, stp2_11); \
- stp1_12 = _mm_sub_epi16(stp2_15, stp2_12); \
- stp1_13 = _mm_sub_epi16(stp2_14, stp2_13); \
- stp1_14 = _mm_add_epi16(stp2_14, stp2_13); \
- stp1_15 = _mm_add_epi16(stp2_15, stp2_12); \
- \
- stp1_16 = stp2_16; \
- stp1_17 = stp2_17; \
- \
- MULTIPLICATION_AND_ADD(lo_18_29, hi_18_29, lo_19_28, hi_19_28, stg4_4, \
- stg4_5, stg4_4, stg4_5, stp1_18, stp1_29, \
- stp1_19, stp1_28) \
- MULTIPLICATION_AND_ADD(lo_20_27, hi_20_27, lo_21_26, hi_21_26, stg4_6, \
- stg4_4, stg4_6, stg4_4, stp1_20, stp1_27, \
- stp1_21, stp1_26) \
- \
- stp1_22 = stp2_22; \
- stp1_23 = stp2_23; \
- stp1_24 = stp2_24; \
- stp1_25 = stp2_25; \
- stp1_30 = stp2_30; \
- stp1_31 = stp2_31; \
-} \
-\
-/* Stage6 */ \
-{ \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp1_10, stp1_13); \
- const __m128i lo_11_12 = _mm_unpacklo_epi16(stp1_11, stp1_12); \
- const __m128i hi_11_12 = _mm_unpackhi_epi16(stp1_11, stp1_12); \
- \
- stp2_0 = _mm_add_epi16(stp1_0, stp1_7); \
- stp2_1 = _mm_add_epi16(stp1_1, stp1_6); \
- stp2_2 = _mm_add_epi16(stp1_2, stp1_5); \
- stp2_3 = _mm_add_epi16(stp1_3, stp1_4); \
- stp2_4 = _mm_sub_epi16(stp1_3, stp1_4); \
- stp2_5 = _mm_sub_epi16(stp1_2, stp1_5); \
- stp2_6 = _mm_sub_epi16(stp1_1, stp1_6); \
- stp2_7 = _mm_sub_epi16(stp1_0, stp1_7); \
- \
- stp2_8 = stp1_8; \
- stp2_9 = stp1_9; \
- stp2_14 = stp1_14; \
- stp2_15 = stp1_15; \
- \
- MULTIPLICATION_AND_ADD(lo_10_13, hi_10_13, lo_11_12, hi_11_12, \
- stg6_0, stg4_0, stg6_0, stg4_0, stp2_10, \
- stp2_13, stp2_11, stp2_12) \
- \
- stp2_16 = _mm_add_epi16(stp1_16, stp1_23); \
- stp2_17 = _mm_add_epi16(stp1_17, stp1_22); \
- stp2_18 = _mm_add_epi16(stp1_18, stp1_21); \
- stp2_19 = _mm_add_epi16(stp1_19, stp1_20); \
- stp2_20 = _mm_sub_epi16(stp1_19, stp1_20); \
- stp2_21 = _mm_sub_epi16(stp1_18, stp1_21); \
- stp2_22 = _mm_sub_epi16(stp1_17, stp1_22); \
- stp2_23 = _mm_sub_epi16(stp1_16, stp1_23); \
- \
- stp2_24 = _mm_sub_epi16(stp1_31, stp1_24); \
- stp2_25 = _mm_sub_epi16(stp1_30, stp1_25); \
- stp2_26 = _mm_sub_epi16(stp1_29, stp1_26); \
- stp2_27 = _mm_sub_epi16(stp1_28, stp1_27); \
- stp2_28 = _mm_add_epi16(stp1_27, stp1_28); \
- stp2_29 = _mm_add_epi16(stp1_26, stp1_29); \
- stp2_30 = _mm_add_epi16(stp1_25, stp1_30); \
- stp2_31 = _mm_add_epi16(stp1_24, stp1_31); \
-} \
-\
-/* Stage7 */ \
-{ \
- const __m128i lo_20_27 = _mm_unpacklo_epi16(stp2_20, stp2_27); \
- const __m128i hi_20_27 = _mm_unpackhi_epi16(stp2_20, stp2_27); \
- const __m128i lo_21_26 = _mm_unpacklo_epi16(stp2_21, stp2_26); \
- const __m128i hi_21_26 = _mm_unpackhi_epi16(stp2_21, stp2_26); \
- \
- const __m128i lo_22_25 = _mm_unpacklo_epi16(stp2_22, stp2_25); \
- const __m128i hi_22_25 = _mm_unpackhi_epi16(stp2_22, stp2_25); \
- const __m128i lo_23_24 = _mm_unpacklo_epi16(stp2_23, stp2_24); \
- const __m128i hi_23_24 = _mm_unpackhi_epi16(stp2_23, stp2_24); \
- \
- stp1_0 = _mm_add_epi16(stp2_0, stp2_15); \
- stp1_1 = _mm_add_epi16(stp2_1, stp2_14); \
- stp1_2 = _mm_add_epi16(stp2_2, stp2_13); \
- stp1_3 = _mm_add_epi16(stp2_3, stp2_12); \
- stp1_4 = _mm_add_epi16(stp2_4, stp2_11); \
- stp1_5 = _mm_add_epi16(stp2_5, stp2_10); \
- stp1_6 = _mm_add_epi16(stp2_6, stp2_9); \
- stp1_7 = _mm_add_epi16(stp2_7, stp2_8); \
- stp1_8 = _mm_sub_epi16(stp2_7, stp2_8); \
- stp1_9 = _mm_sub_epi16(stp2_6, stp2_9); \
- stp1_10 = _mm_sub_epi16(stp2_5, stp2_10); \
- stp1_11 = _mm_sub_epi16(stp2_4, stp2_11); \
- stp1_12 = _mm_sub_epi16(stp2_3, stp2_12); \
- stp1_13 = _mm_sub_epi16(stp2_2, stp2_13); \
- stp1_14 = _mm_sub_epi16(stp2_1, stp2_14); \
- stp1_15 = _mm_sub_epi16(stp2_0, stp2_15); \
- \
- stp1_16 = stp2_16; \
- stp1_17 = stp2_17; \
- stp1_18 = stp2_18; \
- stp1_19 = stp2_19; \
- \
- MULTIPLICATION_AND_ADD(lo_20_27, hi_20_27, lo_21_26, hi_21_26, stg6_0, \
- stg4_0, stg6_0, stg4_0, stp1_20, stp1_27, \
- stp1_21, stp1_26) \
- MULTIPLICATION_AND_ADD(lo_22_25, hi_22_25, lo_23_24, hi_23_24, stg6_0, \
- stg4_0, stg6_0, stg4_0, stp1_22, stp1_25, \
- stp1_23, stp1_24) \
- \
- stp1_28 = stp2_28; \
- stp1_29 = stp2_29; \
- stp1_30 = stp2_30; \
- stp1_31 = stp2_31; \
-}
-
-
-#define IDCT32 \
-/* Stage1 */ \
-{ \
- const __m128i lo_1_31 = _mm_unpacklo_epi16(in[1], in[31]); \
- const __m128i hi_1_31 = _mm_unpackhi_epi16(in[1], in[31]); \
- const __m128i lo_17_15 = _mm_unpacklo_epi16(in[17], in[15]); \
- const __m128i hi_17_15 = _mm_unpackhi_epi16(in[17], in[15]); \
- \
- const __m128i lo_9_23 = _mm_unpacklo_epi16(in[9], in[23]); \
- const __m128i hi_9_23 = _mm_unpackhi_epi16(in[9], in[23]); \
- const __m128i lo_25_7= _mm_unpacklo_epi16(in[25], in[7]); \
- const __m128i hi_25_7 = _mm_unpackhi_epi16(in[25], in[7]); \
- \
- const __m128i lo_5_27 = _mm_unpacklo_epi16(in[5], in[27]); \
- const __m128i hi_5_27 = _mm_unpackhi_epi16(in[5], in[27]); \
- const __m128i lo_21_11 = _mm_unpacklo_epi16(in[21], in[11]); \
- const __m128i hi_21_11 = _mm_unpackhi_epi16(in[21], in[11]); \
- \
- const __m128i lo_13_19 = _mm_unpacklo_epi16(in[13], in[19]); \
- const __m128i hi_13_19 = _mm_unpackhi_epi16(in[13], in[19]); \
- const __m128i lo_29_3 = _mm_unpacklo_epi16(in[29], in[3]); \
- const __m128i hi_29_3 = _mm_unpackhi_epi16(in[29], in[3]); \
- \
- MULTIPLICATION_AND_ADD(lo_1_31, hi_1_31, lo_17_15, hi_17_15, stg1_0, \
- stg1_1, stg1_2, stg1_3, stp1_16, stp1_31, \
- stp1_17, stp1_30) \
- MULTIPLICATION_AND_ADD(lo_9_23, hi_9_23, lo_25_7, hi_25_7, stg1_4, \
- stg1_5, stg1_6, stg1_7, stp1_18, stp1_29, \
- stp1_19, stp1_28) \
- MULTIPLICATION_AND_ADD(lo_5_27, hi_5_27, lo_21_11, hi_21_11, stg1_8, \
- stg1_9, stg1_10, stg1_11, stp1_20, stp1_27, \
- stp1_21, stp1_26) \
- MULTIPLICATION_AND_ADD(lo_13_19, hi_13_19, lo_29_3, hi_29_3, stg1_12, \
- stg1_13, stg1_14, stg1_15, stp1_22, stp1_25, \
- stp1_23, stp1_24) \
-} \
-\
-/* Stage2 */ \
-{ \
- const __m128i lo_2_30 = _mm_unpacklo_epi16(in[2], in[30]); \
- const __m128i hi_2_30 = _mm_unpackhi_epi16(in[2], in[30]); \
- const __m128i lo_18_14 = _mm_unpacklo_epi16(in[18], in[14]); \
- const __m128i hi_18_14 = _mm_unpackhi_epi16(in[18], in[14]); \
- \
- const __m128i lo_10_22 = _mm_unpacklo_epi16(in[10], in[22]); \
- const __m128i hi_10_22 = _mm_unpackhi_epi16(in[10], in[22]); \
- const __m128i lo_26_6 = _mm_unpacklo_epi16(in[26], in[6]); \
- const __m128i hi_26_6 = _mm_unpackhi_epi16(in[26], in[6]); \
- \
- MULTIPLICATION_AND_ADD(lo_2_30, hi_2_30, lo_18_14, hi_18_14, stg2_0, \
- stg2_1, stg2_2, stg2_3, stp2_8, stp2_15, stp2_9, \
- stp2_14) \
- MULTIPLICATION_AND_ADD(lo_10_22, hi_10_22, lo_26_6, hi_26_6, stg2_4, \
- stg2_5, stg2_6, stg2_7, stp2_10, stp2_13, \
- stp2_11, stp2_12) \
- \
- stp2_16 = _mm_add_epi16(stp1_16, stp1_17); \
- stp2_17 = _mm_sub_epi16(stp1_16, stp1_17); \
- stp2_18 = _mm_sub_epi16(stp1_19, stp1_18); \
- stp2_19 = _mm_add_epi16(stp1_19, stp1_18); \
- \
- stp2_20 = _mm_add_epi16(stp1_20, stp1_21); \
- stp2_21 = _mm_sub_epi16(stp1_20, stp1_21); \
- stp2_22 = _mm_sub_epi16(stp1_23, stp1_22); \
- stp2_23 = _mm_add_epi16(stp1_23, stp1_22); \
- \
- stp2_24 = _mm_add_epi16(stp1_24, stp1_25); \
- stp2_25 = _mm_sub_epi16(stp1_24, stp1_25); \
- stp2_26 = _mm_sub_epi16(stp1_27, stp1_26); \
- stp2_27 = _mm_add_epi16(stp1_27, stp1_26); \
- \
- stp2_28 = _mm_add_epi16(stp1_28, stp1_29); \
- stp2_29 = _mm_sub_epi16(stp1_28, stp1_29); \
- stp2_30 = _mm_sub_epi16(stp1_31, stp1_30); \
- stp2_31 = _mm_add_epi16(stp1_31, stp1_30); \
-} \
-\
-/* Stage3 */ \
-{ \
- const __m128i lo_4_28 = _mm_unpacklo_epi16(in[4], in[28]); \
- const __m128i hi_4_28 = _mm_unpackhi_epi16(in[4], in[28]); \
- const __m128i lo_20_12 = _mm_unpacklo_epi16(in[20], in[12]); \
- const __m128i hi_20_12 = _mm_unpackhi_epi16(in[20], in[12]); \
- \
- const __m128i lo_17_30 = _mm_unpacklo_epi16(stp2_17, stp2_30); \
- const __m128i hi_17_30 = _mm_unpackhi_epi16(stp2_17, stp2_30); \
- const __m128i lo_18_29 = _mm_unpacklo_epi16(stp2_18, stp2_29); \
- const __m128i hi_18_29 = _mm_unpackhi_epi16(stp2_18, stp2_29); \
- \
- const __m128i lo_21_26 = _mm_unpacklo_epi16(stp2_21, stp2_26); \
- const __m128i hi_21_26 = _mm_unpackhi_epi16(stp2_21, stp2_26); \
- const __m128i lo_22_25 = _mm_unpacklo_epi16(stp2_22, stp2_25); \
- const __m128i hi_22_25 = _mm_unpackhi_epi16(stp2_22, stp2_25); \
- \
- MULTIPLICATION_AND_ADD(lo_4_28, hi_4_28, lo_20_12, hi_20_12, stg3_0, \
- stg3_1, stg3_2, stg3_3, stp1_4, stp1_7, stp1_5, \
- stp1_6) \
- \
- stp1_8 = _mm_add_epi16(stp2_8, stp2_9); \
- stp1_9 = _mm_sub_epi16(stp2_8, stp2_9); \
- stp1_10 = _mm_sub_epi16(stp2_11, stp2_10); \
- stp1_11 = _mm_add_epi16(stp2_11, stp2_10); \
- stp1_12 = _mm_add_epi16(stp2_12, stp2_13); \
- stp1_13 = _mm_sub_epi16(stp2_12, stp2_13); \
- stp1_14 = _mm_sub_epi16(stp2_15, stp2_14); \
- stp1_15 = _mm_add_epi16(stp2_15, stp2_14); \
- \
- MULTIPLICATION_AND_ADD(lo_17_30, hi_17_30, lo_18_29, hi_18_29, stg3_4, \
- stg3_5, stg3_6, stg3_4, stp1_17, stp1_30, \
- stp1_18, stp1_29) \
- MULTIPLICATION_AND_ADD(lo_21_26, hi_21_26, lo_22_25, hi_22_25, stg3_8, \
- stg3_9, stg3_10, stg3_8, stp1_21, stp1_26, \
- stp1_22, stp1_25) \
- \
- stp1_16 = stp2_16; \
- stp1_31 = stp2_31; \
- stp1_19 = stp2_19; \
- stp1_20 = stp2_20; \
- stp1_23 = stp2_23; \
- stp1_24 = stp2_24; \
- stp1_27 = stp2_27; \
- stp1_28 = stp2_28; \
-} \
-\
-/* Stage4 */ \
-{ \
- const __m128i lo_0_16 = _mm_unpacklo_epi16(in[0], in[16]); \
- const __m128i hi_0_16 = _mm_unpackhi_epi16(in[0], in[16]); \
- const __m128i lo_8_24 = _mm_unpacklo_epi16(in[8], in[24]); \
- const __m128i hi_8_24 = _mm_unpackhi_epi16(in[8], in[24]); \
- \
- const __m128i lo_9_14 = _mm_unpacklo_epi16(stp1_9, stp1_14); \
- const __m128i hi_9_14 = _mm_unpackhi_epi16(stp1_9, stp1_14); \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp1_10, stp1_13); \
- \
- MULTIPLICATION_AND_ADD(lo_0_16, hi_0_16, lo_8_24, hi_8_24, stg4_0, \
- stg4_1, stg4_2, stg4_3, stp2_0, stp2_1, \
- stp2_2, stp2_3) \
- \
- stp2_4 = _mm_add_epi16(stp1_4, stp1_5); \
- stp2_5 = _mm_sub_epi16(stp1_4, stp1_5); \
- stp2_6 = _mm_sub_epi16(stp1_7, stp1_6); \
- stp2_7 = _mm_add_epi16(stp1_7, stp1_6); \
- \
- MULTIPLICATION_AND_ADD(lo_9_14, hi_9_14, lo_10_13, hi_10_13, stg4_4, \
- stg4_5, stg4_6, stg4_4, stp2_9, stp2_14, \
- stp2_10, stp2_13) \
- \
- stp2_8 = stp1_8; \
- stp2_15 = stp1_15; \
- stp2_11 = stp1_11; \
- stp2_12 = stp1_12; \
- \
- stp2_16 = _mm_add_epi16(stp1_16, stp1_19); \
- stp2_17 = _mm_add_epi16(stp1_17, stp1_18); \
- stp2_18 = _mm_sub_epi16(stp1_17, stp1_18); \
- stp2_19 = _mm_sub_epi16(stp1_16, stp1_19); \
- stp2_20 = _mm_sub_epi16(stp1_23, stp1_20); \
- stp2_21 = _mm_sub_epi16(stp1_22, stp1_21); \
- stp2_22 = _mm_add_epi16(stp1_22, stp1_21); \
- stp2_23 = _mm_add_epi16(stp1_23, stp1_20); \
- \
- stp2_24 = _mm_add_epi16(stp1_24, stp1_27); \
- stp2_25 = _mm_add_epi16(stp1_25, stp1_26); \
- stp2_26 = _mm_sub_epi16(stp1_25, stp1_26); \
- stp2_27 = _mm_sub_epi16(stp1_24, stp1_27); \
- stp2_28 = _mm_sub_epi16(stp1_31, stp1_28); \
- stp2_29 = _mm_sub_epi16(stp1_30, stp1_29); \
- stp2_30 = _mm_add_epi16(stp1_29, stp1_30); \
- stp2_31 = _mm_add_epi16(stp1_28, stp1_31); \
-} \
-\
-/* Stage5 */ \
-{ \
- const __m128i lo_6_5 = _mm_unpacklo_epi16(stp2_6, stp2_5); \
- const __m128i hi_6_5 = _mm_unpackhi_epi16(stp2_6, stp2_5); \
- const __m128i lo_18_29 = _mm_unpacklo_epi16(stp2_18, stp2_29); \
- const __m128i hi_18_29 = _mm_unpackhi_epi16(stp2_18, stp2_29); \
- \
- const __m128i lo_19_28 = _mm_unpacklo_epi16(stp2_19, stp2_28); \
- const __m128i hi_19_28 = _mm_unpackhi_epi16(stp2_19, stp2_28); \
- const __m128i lo_20_27 = _mm_unpacklo_epi16(stp2_20, stp2_27); \
- const __m128i hi_20_27 = _mm_unpackhi_epi16(stp2_20, stp2_27); \
- \
- const __m128i lo_21_26 = _mm_unpacklo_epi16(stp2_21, stp2_26); \
- const __m128i hi_21_26 = _mm_unpackhi_epi16(stp2_21, stp2_26); \
- \
- stp1_0 = _mm_add_epi16(stp2_0, stp2_3); \
- stp1_1 = _mm_add_epi16(stp2_1, stp2_2); \
- stp1_2 = _mm_sub_epi16(stp2_1, stp2_2); \
- stp1_3 = _mm_sub_epi16(stp2_0, stp2_3); \
- \
- tmp0 = _mm_madd_epi16(lo_6_5, stg4_1); \
- tmp1 = _mm_madd_epi16(hi_6_5, stg4_1); \
- tmp2 = _mm_madd_epi16(lo_6_5, stg4_0); \
- tmp3 = _mm_madd_epi16(hi_6_5, stg4_0); \
- \
- tmp0 = _mm_add_epi32(tmp0, rounding); \
- tmp1 = _mm_add_epi32(tmp1, rounding); \
- tmp2 = _mm_add_epi32(tmp2, rounding); \
- tmp3 = _mm_add_epi32(tmp3, rounding); \
- \
- tmp0 = _mm_srai_epi32(tmp0, DCT_CONST_BITS); \
- tmp1 = _mm_srai_epi32(tmp1, DCT_CONST_BITS); \
- tmp2 = _mm_srai_epi32(tmp2, DCT_CONST_BITS); \
- tmp3 = _mm_srai_epi32(tmp3, DCT_CONST_BITS); \
- \
- stp1_5 = _mm_packs_epi32(tmp0, tmp1); \
- stp1_6 = _mm_packs_epi32(tmp2, tmp3); \
- \
- stp1_4 = stp2_4; \
- stp1_7 = stp2_7; \
- \
- stp1_8 = _mm_add_epi16(stp2_8, stp2_11); \
- stp1_9 = _mm_add_epi16(stp2_9, stp2_10); \
- stp1_10 = _mm_sub_epi16(stp2_9, stp2_10); \
- stp1_11 = _mm_sub_epi16(stp2_8, stp2_11); \
- stp1_12 = _mm_sub_epi16(stp2_15, stp2_12); \
- stp1_13 = _mm_sub_epi16(stp2_14, stp2_13); \
- stp1_14 = _mm_add_epi16(stp2_14, stp2_13); \
- stp1_15 = _mm_add_epi16(stp2_15, stp2_12); \
- \
- stp1_16 = stp2_16; \
- stp1_17 = stp2_17; \
- \
- MULTIPLICATION_AND_ADD(lo_18_29, hi_18_29, lo_19_28, hi_19_28, stg4_4, \
- stg4_5, stg4_4, stg4_5, stp1_18, stp1_29, \
- stp1_19, stp1_28) \
- MULTIPLICATION_AND_ADD(lo_20_27, hi_20_27, lo_21_26, hi_21_26, stg4_6, \
- stg4_4, stg4_6, stg4_4, stp1_20, stp1_27, \
- stp1_21, stp1_26) \
- \
- stp1_22 = stp2_22; \
- stp1_23 = stp2_23; \
- stp1_24 = stp2_24; \
- stp1_25 = stp2_25; \
- stp1_30 = stp2_30; \
- stp1_31 = stp2_31; \
-} \
-\
-/* Stage6 */ \
-{ \
- const __m128i lo_10_13 = _mm_unpacklo_epi16(stp1_10, stp1_13); \
- const __m128i hi_10_13 = _mm_unpackhi_epi16(stp1_10, stp1_13); \
- const __m128i lo_11_12 = _mm_unpacklo_epi16(stp1_11, stp1_12); \
- const __m128i hi_11_12 = _mm_unpackhi_epi16(stp1_11, stp1_12); \
- \
- stp2_0 = _mm_add_epi16(stp1_0, stp1_7); \
- stp2_1 = _mm_add_epi16(stp1_1, stp1_6); \
- stp2_2 = _mm_add_epi16(stp1_2, stp1_5); \
- stp2_3 = _mm_add_epi16(stp1_3, stp1_4); \
- stp2_4 = _mm_sub_epi16(stp1_3, stp1_4); \
- stp2_5 = _mm_sub_epi16(stp1_2, stp1_5); \
- stp2_6 = _mm_sub_epi16(stp1_1, stp1_6); \
- stp2_7 = _mm_sub_epi16(stp1_0, stp1_7); \
- \
- stp2_8 = stp1_8; \
- stp2_9 = stp1_9; \
- stp2_14 = stp1_14; \
- stp2_15 = stp1_15; \
- \
- MULTIPLICATION_AND_ADD(lo_10_13, hi_10_13, lo_11_12, hi_11_12, \
- stg6_0, stg4_0, stg6_0, stg4_0, stp2_10, \
- stp2_13, stp2_11, stp2_12) \
- \
- stp2_16 = _mm_add_epi16(stp1_16, stp1_23); \
- stp2_17 = _mm_add_epi16(stp1_17, stp1_22); \
- stp2_18 = _mm_add_epi16(stp1_18, stp1_21); \
- stp2_19 = _mm_add_epi16(stp1_19, stp1_20); \
- stp2_20 = _mm_sub_epi16(stp1_19, stp1_20); \
- stp2_21 = _mm_sub_epi16(stp1_18, stp1_21); \
- stp2_22 = _mm_sub_epi16(stp1_17, stp1_22); \
- stp2_23 = _mm_sub_epi16(stp1_16, stp1_23); \
- \
- stp2_24 = _mm_sub_epi16(stp1_31, stp1_24); \
- stp2_25 = _mm_sub_epi16(stp1_30, stp1_25); \
- stp2_26 = _mm_sub_epi16(stp1_29, stp1_26); \
- stp2_27 = _mm_sub_epi16(stp1_28, stp1_27); \
- stp2_28 = _mm_add_epi16(stp1_27, stp1_28); \
- stp2_29 = _mm_add_epi16(stp1_26, stp1_29); \
- stp2_30 = _mm_add_epi16(stp1_25, stp1_30); \
- stp2_31 = _mm_add_epi16(stp1_24, stp1_31); \
-} \
-\
-/* Stage7 */ \
-{ \
- const __m128i lo_20_27 = _mm_unpacklo_epi16(stp2_20, stp2_27); \
- const __m128i hi_20_27 = _mm_unpackhi_epi16(stp2_20, stp2_27); \
- const __m128i lo_21_26 = _mm_unpacklo_epi16(stp2_21, stp2_26); \
- const __m128i hi_21_26 = _mm_unpackhi_epi16(stp2_21, stp2_26); \
- \
- const __m128i lo_22_25 = _mm_unpacklo_epi16(stp2_22, stp2_25); \
- const __m128i hi_22_25 = _mm_unpackhi_epi16(stp2_22, stp2_25); \
- const __m128i lo_23_24 = _mm_unpacklo_epi16(stp2_23, stp2_24); \
- const __m128i hi_23_24 = _mm_unpackhi_epi16(stp2_23, stp2_24); \
- \
- stp1_0 = _mm_add_epi16(stp2_0, stp2_15); \
- stp1_1 = _mm_add_epi16(stp2_1, stp2_14); \
- stp1_2 = _mm_add_epi16(stp2_2, stp2_13); \
- stp1_3 = _mm_add_epi16(stp2_3, stp2_12); \
- stp1_4 = _mm_add_epi16(stp2_4, stp2_11); \
- stp1_5 = _mm_add_epi16(stp2_5, stp2_10); \
- stp1_6 = _mm_add_epi16(stp2_6, stp2_9); \
- stp1_7 = _mm_add_epi16(stp2_7, stp2_8); \
- stp1_8 = _mm_sub_epi16(stp2_7, stp2_8); \
- stp1_9 = _mm_sub_epi16(stp2_6, stp2_9); \
- stp1_10 = _mm_sub_epi16(stp2_5, stp2_10); \
- stp1_11 = _mm_sub_epi16(stp2_4, stp2_11); \
- stp1_12 = _mm_sub_epi16(stp2_3, stp2_12); \
- stp1_13 = _mm_sub_epi16(stp2_2, stp2_13); \
- stp1_14 = _mm_sub_epi16(stp2_1, stp2_14); \
- stp1_15 = _mm_sub_epi16(stp2_0, stp2_15); \
- \
- stp1_16 = stp2_16; \
- stp1_17 = stp2_17; \
- stp1_18 = stp2_18; \
- stp1_19 = stp2_19; \
- \
- MULTIPLICATION_AND_ADD(lo_20_27, hi_20_27, lo_21_26, hi_21_26, stg6_0, \
- stg4_0, stg6_0, stg4_0, stp1_20, stp1_27, \
- stp1_21, stp1_26) \
- MULTIPLICATION_AND_ADD(lo_22_25, hi_22_25, lo_23_24, hi_23_24, stg6_0, \
- stg4_0, stg6_0, stg4_0, stp1_22, stp1_25, \
- stp1_23, stp1_24) \
- \
- stp1_28 = stp2_28; \
- stp1_29 = stp2_29; \
- stp1_30 = stp2_30; \
- stp1_31 = stp2_31; \
-}
-
-// Only upper-left 8x8 has non-zero coeff
-void vp9_idct32x32_34_add_sse2(const int16_t *input, uint8_t *dest,
- int stride) {
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i final_rounding = _mm_set1_epi16(1<<5);
-
- // idct constants for each stage
- const __m128i stg1_0 = pair_set_epi16(cospi_31_64, -cospi_1_64);
- const __m128i stg1_1 = pair_set_epi16(cospi_1_64, cospi_31_64);
- const __m128i stg1_2 = pair_set_epi16(cospi_15_64, -cospi_17_64);
- const __m128i stg1_3 = pair_set_epi16(cospi_17_64, cospi_15_64);
- const __m128i stg1_4 = pair_set_epi16(cospi_23_64, -cospi_9_64);
- const __m128i stg1_5 = pair_set_epi16(cospi_9_64, cospi_23_64);
- const __m128i stg1_6 = pair_set_epi16(cospi_7_64, -cospi_25_64);
- const __m128i stg1_7 = pair_set_epi16(cospi_25_64, cospi_7_64);
- const __m128i stg1_8 = pair_set_epi16(cospi_27_64, -cospi_5_64);
- const __m128i stg1_9 = pair_set_epi16(cospi_5_64, cospi_27_64);
- const __m128i stg1_10 = pair_set_epi16(cospi_11_64, -cospi_21_64);
- const __m128i stg1_11 = pair_set_epi16(cospi_21_64, cospi_11_64);
- const __m128i stg1_12 = pair_set_epi16(cospi_19_64, -cospi_13_64);
- const __m128i stg1_13 = pair_set_epi16(cospi_13_64, cospi_19_64);
- const __m128i stg1_14 = pair_set_epi16(cospi_3_64, -cospi_29_64);
- const __m128i stg1_15 = pair_set_epi16(cospi_29_64, cospi_3_64);
-
- const __m128i stg2_0 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i stg2_1 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i stg2_2 = pair_set_epi16(cospi_14_64, -cospi_18_64);
- const __m128i stg2_3 = pair_set_epi16(cospi_18_64, cospi_14_64);
- const __m128i stg2_4 = pair_set_epi16(cospi_22_64, -cospi_10_64);
- const __m128i stg2_5 = pair_set_epi16(cospi_10_64, cospi_22_64);
- const __m128i stg2_6 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i stg2_7 = pair_set_epi16(cospi_26_64, cospi_6_64);
-
- const __m128i stg3_0 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i stg3_1 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i stg3_2 = pair_set_epi16(cospi_12_64, -cospi_20_64);
- const __m128i stg3_3 = pair_set_epi16(cospi_20_64, cospi_12_64);
- const __m128i stg3_4 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i stg3_5 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i stg3_6 = pair_set_epi16(-cospi_28_64, -cospi_4_64);
- const __m128i stg3_8 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i stg3_9 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i stg3_10 = pair_set_epi16(-cospi_12_64, -cospi_20_64);
-
- const __m128i stg4_0 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i stg4_1 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i stg4_2 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i stg4_3 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i stg4_4 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i stg4_5 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i stg4_6 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
-
- const __m128i stg6_0 = pair_set_epi16(-cospi_16_64, cospi_16_64);
-
- __m128i in[32], col[32];
- __m128i stp1_0, stp1_1, stp1_2, stp1_3, stp1_4, stp1_5, stp1_6, stp1_7,
- stp1_8, stp1_9, stp1_10, stp1_11, stp1_12, stp1_13, stp1_14, stp1_15,
- stp1_16, stp1_17, stp1_18, stp1_19, stp1_20, stp1_21, stp1_22,
- stp1_23, stp1_24, stp1_25, stp1_26, stp1_27, stp1_28, stp1_29,
- stp1_30, stp1_31;
- __m128i stp2_0, stp2_1, stp2_2, stp2_3, stp2_4, stp2_5, stp2_6, stp2_7,
- stp2_8, stp2_9, stp2_10, stp2_11, stp2_12, stp2_13, stp2_14, stp2_15,
- stp2_16, stp2_17, stp2_18, stp2_19, stp2_20, stp2_21, stp2_22,
- stp2_23, stp2_24, stp2_25, stp2_26, stp2_27, stp2_28, stp2_29,
- stp2_30, stp2_31;
- __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int i;
- // Load input data.
- LOAD_DQCOEFF(in[0], input);
- LOAD_DQCOEFF(in[8], input);
- LOAD_DQCOEFF(in[16], input);
- LOAD_DQCOEFF(in[24], input);
- LOAD_DQCOEFF(in[1], input);
- LOAD_DQCOEFF(in[9], input);
- LOAD_DQCOEFF(in[17], input);
- LOAD_DQCOEFF(in[25], input);
- LOAD_DQCOEFF(in[2], input);
- LOAD_DQCOEFF(in[10], input);
- LOAD_DQCOEFF(in[18], input);
- LOAD_DQCOEFF(in[26], input);
- LOAD_DQCOEFF(in[3], input);
- LOAD_DQCOEFF(in[11], input);
- LOAD_DQCOEFF(in[19], input);
- LOAD_DQCOEFF(in[27], input);
-
- LOAD_DQCOEFF(in[4], input);
- LOAD_DQCOEFF(in[12], input);
- LOAD_DQCOEFF(in[20], input);
- LOAD_DQCOEFF(in[28], input);
- LOAD_DQCOEFF(in[5], input);
- LOAD_DQCOEFF(in[13], input);
- LOAD_DQCOEFF(in[21], input);
- LOAD_DQCOEFF(in[29], input);
- LOAD_DQCOEFF(in[6], input);
- LOAD_DQCOEFF(in[14], input);
- LOAD_DQCOEFF(in[22], input);
- LOAD_DQCOEFF(in[30], input);
- LOAD_DQCOEFF(in[7], input);
- LOAD_DQCOEFF(in[15], input);
- LOAD_DQCOEFF(in[23], input);
- LOAD_DQCOEFF(in[31], input);
-
- array_transpose_8x8(in, in);
- array_transpose_8x8(in+8, in+8);
- array_transpose_8x8(in+16, in+16);
- array_transpose_8x8(in+24, in+24);
-
- IDCT32
-
- // 1_D: Store 32 intermediate results for each 8x32 block.
- col[0] = _mm_add_epi16(stp1_0, stp1_31);
- col[1] = _mm_add_epi16(stp1_1, stp1_30);
- col[2] = _mm_add_epi16(stp1_2, stp1_29);
- col[3] = _mm_add_epi16(stp1_3, stp1_28);
- col[4] = _mm_add_epi16(stp1_4, stp1_27);
- col[5] = _mm_add_epi16(stp1_5, stp1_26);
- col[6] = _mm_add_epi16(stp1_6, stp1_25);
- col[7] = _mm_add_epi16(stp1_7, stp1_24);
- col[8] = _mm_add_epi16(stp1_8, stp1_23);
- col[9] = _mm_add_epi16(stp1_9, stp1_22);
- col[10] = _mm_add_epi16(stp1_10, stp1_21);
- col[11] = _mm_add_epi16(stp1_11, stp1_20);
- col[12] = _mm_add_epi16(stp1_12, stp1_19);
- col[13] = _mm_add_epi16(stp1_13, stp1_18);
- col[14] = _mm_add_epi16(stp1_14, stp1_17);
- col[15] = _mm_add_epi16(stp1_15, stp1_16);
- col[16] = _mm_sub_epi16(stp1_15, stp1_16);
- col[17] = _mm_sub_epi16(stp1_14, stp1_17);
- col[18] = _mm_sub_epi16(stp1_13, stp1_18);
- col[19] = _mm_sub_epi16(stp1_12, stp1_19);
- col[20] = _mm_sub_epi16(stp1_11, stp1_20);
- col[21] = _mm_sub_epi16(stp1_10, stp1_21);
- col[22] = _mm_sub_epi16(stp1_9, stp1_22);
- col[23] = _mm_sub_epi16(stp1_8, stp1_23);
- col[24] = _mm_sub_epi16(stp1_7, stp1_24);
- col[25] = _mm_sub_epi16(stp1_6, stp1_25);
- col[26] = _mm_sub_epi16(stp1_5, stp1_26);
- col[27] = _mm_sub_epi16(stp1_4, stp1_27);
- col[28] = _mm_sub_epi16(stp1_3, stp1_28);
- col[29] = _mm_sub_epi16(stp1_2, stp1_29);
- col[30] = _mm_sub_epi16(stp1_1, stp1_30);
- col[31] = _mm_sub_epi16(stp1_0, stp1_31);
- for (i = 0; i < 4; i++) {
- const __m128i zero = _mm_setzero_si128();
- // Transpose 32x8 block to 8x32 block
- array_transpose_8x8(col+i*8, in);
- IDCT32_34
-
- // 2_D: Calculate the results and store them to destination.
- in[0] = _mm_add_epi16(stp1_0, stp1_31);
- in[1] = _mm_add_epi16(stp1_1, stp1_30);
- in[2] = _mm_add_epi16(stp1_2, stp1_29);
- in[3] = _mm_add_epi16(stp1_3, stp1_28);
- in[4] = _mm_add_epi16(stp1_4, stp1_27);
- in[5] = _mm_add_epi16(stp1_5, stp1_26);
- in[6] = _mm_add_epi16(stp1_6, stp1_25);
- in[7] = _mm_add_epi16(stp1_7, stp1_24);
- in[8] = _mm_add_epi16(stp1_8, stp1_23);
- in[9] = _mm_add_epi16(stp1_9, stp1_22);
- in[10] = _mm_add_epi16(stp1_10, stp1_21);
- in[11] = _mm_add_epi16(stp1_11, stp1_20);
- in[12] = _mm_add_epi16(stp1_12, stp1_19);
- in[13] = _mm_add_epi16(stp1_13, stp1_18);
- in[14] = _mm_add_epi16(stp1_14, stp1_17);
- in[15] = _mm_add_epi16(stp1_15, stp1_16);
- in[16] = _mm_sub_epi16(stp1_15, stp1_16);
- in[17] = _mm_sub_epi16(stp1_14, stp1_17);
- in[18] = _mm_sub_epi16(stp1_13, stp1_18);
- in[19] = _mm_sub_epi16(stp1_12, stp1_19);
- in[20] = _mm_sub_epi16(stp1_11, stp1_20);
- in[21] = _mm_sub_epi16(stp1_10, stp1_21);
- in[22] = _mm_sub_epi16(stp1_9, stp1_22);
- in[23] = _mm_sub_epi16(stp1_8, stp1_23);
- in[24] = _mm_sub_epi16(stp1_7, stp1_24);
- in[25] = _mm_sub_epi16(stp1_6, stp1_25);
- in[26] = _mm_sub_epi16(stp1_5, stp1_26);
- in[27] = _mm_sub_epi16(stp1_4, stp1_27);
- in[28] = _mm_sub_epi16(stp1_3, stp1_28);
- in[29] = _mm_sub_epi16(stp1_2, stp1_29);
- in[30] = _mm_sub_epi16(stp1_1, stp1_30);
- in[31] = _mm_sub_epi16(stp1_0, stp1_31);
-
- // Final rounding and shift
- in[0] = _mm_adds_epi16(in[0], final_rounding);
- in[1] = _mm_adds_epi16(in[1], final_rounding);
- in[2] = _mm_adds_epi16(in[2], final_rounding);
- in[3] = _mm_adds_epi16(in[3], final_rounding);
- in[4] = _mm_adds_epi16(in[4], final_rounding);
- in[5] = _mm_adds_epi16(in[5], final_rounding);
- in[6] = _mm_adds_epi16(in[6], final_rounding);
- in[7] = _mm_adds_epi16(in[7], final_rounding);
- in[8] = _mm_adds_epi16(in[8], final_rounding);
- in[9] = _mm_adds_epi16(in[9], final_rounding);
- in[10] = _mm_adds_epi16(in[10], final_rounding);
- in[11] = _mm_adds_epi16(in[11], final_rounding);
- in[12] = _mm_adds_epi16(in[12], final_rounding);
- in[13] = _mm_adds_epi16(in[13], final_rounding);
- in[14] = _mm_adds_epi16(in[14], final_rounding);
- in[15] = _mm_adds_epi16(in[15], final_rounding);
- in[16] = _mm_adds_epi16(in[16], final_rounding);
- in[17] = _mm_adds_epi16(in[17], final_rounding);
- in[18] = _mm_adds_epi16(in[18], final_rounding);
- in[19] = _mm_adds_epi16(in[19], final_rounding);
- in[20] = _mm_adds_epi16(in[20], final_rounding);
- in[21] = _mm_adds_epi16(in[21], final_rounding);
- in[22] = _mm_adds_epi16(in[22], final_rounding);
- in[23] = _mm_adds_epi16(in[23], final_rounding);
- in[24] = _mm_adds_epi16(in[24], final_rounding);
- in[25] = _mm_adds_epi16(in[25], final_rounding);
- in[26] = _mm_adds_epi16(in[26], final_rounding);
- in[27] = _mm_adds_epi16(in[27], final_rounding);
- in[28] = _mm_adds_epi16(in[28], final_rounding);
- in[29] = _mm_adds_epi16(in[29], final_rounding);
- in[30] = _mm_adds_epi16(in[30], final_rounding);
- in[31] = _mm_adds_epi16(in[31], final_rounding);
-
- in[0] = _mm_srai_epi16(in[0], 6);
- in[1] = _mm_srai_epi16(in[1], 6);
- in[2] = _mm_srai_epi16(in[2], 6);
- in[3] = _mm_srai_epi16(in[3], 6);
- in[4] = _mm_srai_epi16(in[4], 6);
- in[5] = _mm_srai_epi16(in[5], 6);
- in[6] = _mm_srai_epi16(in[6], 6);
- in[7] = _mm_srai_epi16(in[7], 6);
- in[8] = _mm_srai_epi16(in[8], 6);
- in[9] = _mm_srai_epi16(in[9], 6);
- in[10] = _mm_srai_epi16(in[10], 6);
- in[11] = _mm_srai_epi16(in[11], 6);
- in[12] = _mm_srai_epi16(in[12], 6);
- in[13] = _mm_srai_epi16(in[13], 6);
- in[14] = _mm_srai_epi16(in[14], 6);
- in[15] = _mm_srai_epi16(in[15], 6);
- in[16] = _mm_srai_epi16(in[16], 6);
- in[17] = _mm_srai_epi16(in[17], 6);
- in[18] = _mm_srai_epi16(in[18], 6);
- in[19] = _mm_srai_epi16(in[19], 6);
- in[20] = _mm_srai_epi16(in[20], 6);
- in[21] = _mm_srai_epi16(in[21], 6);
- in[22] = _mm_srai_epi16(in[22], 6);
- in[23] = _mm_srai_epi16(in[23], 6);
- in[24] = _mm_srai_epi16(in[24], 6);
- in[25] = _mm_srai_epi16(in[25], 6);
- in[26] = _mm_srai_epi16(in[26], 6);
- in[27] = _mm_srai_epi16(in[27], 6);
- in[28] = _mm_srai_epi16(in[28], 6);
- in[29] = _mm_srai_epi16(in[29], 6);
- in[30] = _mm_srai_epi16(in[30], 6);
- in[31] = _mm_srai_epi16(in[31], 6);
-
- RECON_AND_STORE(dest, in[0]);
- RECON_AND_STORE(dest, in[1]);
- RECON_AND_STORE(dest, in[2]);
- RECON_AND_STORE(dest, in[3]);
- RECON_AND_STORE(dest, in[4]);
- RECON_AND_STORE(dest, in[5]);
- RECON_AND_STORE(dest, in[6]);
- RECON_AND_STORE(dest, in[7]);
- RECON_AND_STORE(dest, in[8]);
- RECON_AND_STORE(dest, in[9]);
- RECON_AND_STORE(dest, in[10]);
- RECON_AND_STORE(dest, in[11]);
- RECON_AND_STORE(dest, in[12]);
- RECON_AND_STORE(dest, in[13]);
- RECON_AND_STORE(dest, in[14]);
- RECON_AND_STORE(dest, in[15]);
- RECON_AND_STORE(dest, in[16]);
- RECON_AND_STORE(dest, in[17]);
- RECON_AND_STORE(dest, in[18]);
- RECON_AND_STORE(dest, in[19]);
- RECON_AND_STORE(dest, in[20]);
- RECON_AND_STORE(dest, in[21]);
- RECON_AND_STORE(dest, in[22]);
- RECON_AND_STORE(dest, in[23]);
- RECON_AND_STORE(dest, in[24]);
- RECON_AND_STORE(dest, in[25]);
- RECON_AND_STORE(dest, in[26]);
- RECON_AND_STORE(dest, in[27]);
- RECON_AND_STORE(dest, in[28]);
- RECON_AND_STORE(dest, in[29]);
- RECON_AND_STORE(dest, in[30]);
- RECON_AND_STORE(dest, in[31]);
-
- dest += 8 - (stride * 32);
- }
- }
-
-void vp9_idct32x32_1024_add_sse2(const int16_t *input, uint8_t *dest,
- int stride) {
- const __m128i rounding = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i final_rounding = _mm_set1_epi16(1<<5);
-
- // idct constants for each stage
- const __m128i stg1_0 = pair_set_epi16(cospi_31_64, -cospi_1_64);
- const __m128i stg1_1 = pair_set_epi16(cospi_1_64, cospi_31_64);
- const __m128i stg1_2 = pair_set_epi16(cospi_15_64, -cospi_17_64);
- const __m128i stg1_3 = pair_set_epi16(cospi_17_64, cospi_15_64);
- const __m128i stg1_4 = pair_set_epi16(cospi_23_64, -cospi_9_64);
- const __m128i stg1_5 = pair_set_epi16(cospi_9_64, cospi_23_64);
- const __m128i stg1_6 = pair_set_epi16(cospi_7_64, -cospi_25_64);
- const __m128i stg1_7 = pair_set_epi16(cospi_25_64, cospi_7_64);
- const __m128i stg1_8 = pair_set_epi16(cospi_27_64, -cospi_5_64);
- const __m128i stg1_9 = pair_set_epi16(cospi_5_64, cospi_27_64);
- const __m128i stg1_10 = pair_set_epi16(cospi_11_64, -cospi_21_64);
- const __m128i stg1_11 = pair_set_epi16(cospi_21_64, cospi_11_64);
- const __m128i stg1_12 = pair_set_epi16(cospi_19_64, -cospi_13_64);
- const __m128i stg1_13 = pair_set_epi16(cospi_13_64, cospi_19_64);
- const __m128i stg1_14 = pair_set_epi16(cospi_3_64, -cospi_29_64);
- const __m128i stg1_15 = pair_set_epi16(cospi_29_64, cospi_3_64);
-
- const __m128i stg2_0 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i stg2_1 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i stg2_2 = pair_set_epi16(cospi_14_64, -cospi_18_64);
- const __m128i stg2_3 = pair_set_epi16(cospi_18_64, cospi_14_64);
- const __m128i stg2_4 = pair_set_epi16(cospi_22_64, -cospi_10_64);
- const __m128i stg2_5 = pair_set_epi16(cospi_10_64, cospi_22_64);
- const __m128i stg2_6 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i stg2_7 = pair_set_epi16(cospi_26_64, cospi_6_64);
-
- const __m128i stg3_0 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i stg3_1 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i stg3_2 = pair_set_epi16(cospi_12_64, -cospi_20_64);
- const __m128i stg3_3 = pair_set_epi16(cospi_20_64, cospi_12_64);
- const __m128i stg3_4 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i stg3_5 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i stg3_6 = pair_set_epi16(-cospi_28_64, -cospi_4_64);
- const __m128i stg3_8 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i stg3_9 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i stg3_10 = pair_set_epi16(-cospi_12_64, -cospi_20_64);
-
- const __m128i stg4_0 = pair_set_epi16(cospi_16_64, cospi_16_64);
- const __m128i stg4_1 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i stg4_2 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i stg4_3 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i stg4_4 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i stg4_5 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i stg4_6 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
-
- const __m128i stg6_0 = pair_set_epi16(-cospi_16_64, cospi_16_64);
-
- __m128i in[32], col[128], zero_idx[16];
- __m128i stp1_0, stp1_1, stp1_2, stp1_3, stp1_4, stp1_5, stp1_6, stp1_7,
- stp1_8, stp1_9, stp1_10, stp1_11, stp1_12, stp1_13, stp1_14, stp1_15,
- stp1_16, stp1_17, stp1_18, stp1_19, stp1_20, stp1_21, stp1_22,
- stp1_23, stp1_24, stp1_25, stp1_26, stp1_27, stp1_28, stp1_29,
- stp1_30, stp1_31;
- __m128i stp2_0, stp2_1, stp2_2, stp2_3, stp2_4, stp2_5, stp2_6, stp2_7,
- stp2_8, stp2_9, stp2_10, stp2_11, stp2_12, stp2_13, stp2_14, stp2_15,
- stp2_16, stp2_17, stp2_18, stp2_19, stp2_20, stp2_21, stp2_22,
- stp2_23, stp2_24, stp2_25, stp2_26, stp2_27, stp2_28, stp2_29,
- stp2_30, stp2_31;
- __m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int i, j, i32;
- int zero_flag[2];
-
- for (i = 0; i < 4; i++) {
- i32 = (i << 5);
- // First 1-D idct
- // Load input data.
- LOAD_DQCOEFF(in[0], input);
- LOAD_DQCOEFF(in[8], input);
- LOAD_DQCOEFF(in[16], input);
- LOAD_DQCOEFF(in[24], input);
- LOAD_DQCOEFF(in[1], input);
- LOAD_DQCOEFF(in[9], input);
- LOAD_DQCOEFF(in[17], input);
- LOAD_DQCOEFF(in[25], input);
- LOAD_DQCOEFF(in[2], input);
- LOAD_DQCOEFF(in[10], input);
- LOAD_DQCOEFF(in[18], input);
- LOAD_DQCOEFF(in[26], input);
- LOAD_DQCOEFF(in[3], input);
- LOAD_DQCOEFF(in[11], input);
- LOAD_DQCOEFF(in[19], input);
- LOAD_DQCOEFF(in[27], input);
-
- LOAD_DQCOEFF(in[4], input);
- LOAD_DQCOEFF(in[12], input);
- LOAD_DQCOEFF(in[20], input);
- LOAD_DQCOEFF(in[28], input);
- LOAD_DQCOEFF(in[5], input);
- LOAD_DQCOEFF(in[13], input);
- LOAD_DQCOEFF(in[21], input);
- LOAD_DQCOEFF(in[29], input);
- LOAD_DQCOEFF(in[6], input);
- LOAD_DQCOEFF(in[14], input);
- LOAD_DQCOEFF(in[22], input);
- LOAD_DQCOEFF(in[30], input);
- LOAD_DQCOEFF(in[7], input);
- LOAD_DQCOEFF(in[15], input);
- LOAD_DQCOEFF(in[23], input);
- LOAD_DQCOEFF(in[31], input);
-
- // checking if all entries are zero
- zero_idx[0] = _mm_or_si128(in[0], in[1]);
- zero_idx[1] = _mm_or_si128(in[2], in[3]);
- zero_idx[2] = _mm_or_si128(in[4], in[5]);
- zero_idx[3] = _mm_or_si128(in[6], in[7]);
- zero_idx[4] = _mm_or_si128(in[8], in[9]);
- zero_idx[5] = _mm_or_si128(in[10], in[11]);
- zero_idx[6] = _mm_or_si128(in[12], in[13]);
- zero_idx[7] = _mm_or_si128(in[14], in[15]);
- zero_idx[8] = _mm_or_si128(in[16], in[17]);
- zero_idx[9] = _mm_or_si128(in[18], in[19]);
- zero_idx[10] = _mm_or_si128(in[20], in[21]);
- zero_idx[11] = _mm_or_si128(in[22], in[23]);
- zero_idx[12] = _mm_or_si128(in[24], in[25]);
- zero_idx[13] = _mm_or_si128(in[26], in[27]);
- zero_idx[14] = _mm_or_si128(in[28], in[29]);
- zero_idx[15] = _mm_or_si128(in[30], in[31]);
-
- zero_idx[0] = _mm_or_si128(zero_idx[0], zero_idx[1]);
- zero_idx[1] = _mm_or_si128(zero_idx[2], zero_idx[3]);
- zero_idx[2] = _mm_or_si128(zero_idx[4], zero_idx[5]);
- zero_idx[3] = _mm_or_si128(zero_idx[6], zero_idx[7]);
- zero_idx[4] = _mm_or_si128(zero_idx[8], zero_idx[9]);
- zero_idx[5] = _mm_or_si128(zero_idx[10], zero_idx[11]);
- zero_idx[6] = _mm_or_si128(zero_idx[12], zero_idx[13]);
- zero_idx[7] = _mm_or_si128(zero_idx[14], zero_idx[15]);
-
- zero_idx[8] = _mm_or_si128(zero_idx[0], zero_idx[1]);
- zero_idx[9] = _mm_or_si128(zero_idx[2], zero_idx[3]);
- zero_idx[10] = _mm_or_si128(zero_idx[4], zero_idx[5]);
- zero_idx[11] = _mm_or_si128(zero_idx[6], zero_idx[7]);
- zero_idx[12] = _mm_or_si128(zero_idx[8], zero_idx[9]);
- zero_idx[13] = _mm_or_si128(zero_idx[10], zero_idx[11]);
- zero_idx[14] = _mm_or_si128(zero_idx[12], zero_idx[13]);
-
- zero_idx[0] = _mm_unpackhi_epi64(zero_idx[14], zero_idx[14]);
- zero_idx[1] = _mm_or_si128(zero_idx[0], zero_idx[14]);
- zero_idx[2] = _mm_srli_epi64(zero_idx[1], 32);
- zero_flag[0] = _mm_cvtsi128_si32(zero_idx[1]);
- zero_flag[1] = _mm_cvtsi128_si32(zero_idx[2]);
-
- if (!zero_flag[0] && !zero_flag[1]) {
- col[i32 + 0] = _mm_setzero_si128();
- col[i32 + 1] = _mm_setzero_si128();
- col[i32 + 2] = _mm_setzero_si128();
- col[i32 + 3] = _mm_setzero_si128();
- col[i32 + 4] = _mm_setzero_si128();
- col[i32 + 5] = _mm_setzero_si128();
- col[i32 + 6] = _mm_setzero_si128();
- col[i32 + 7] = _mm_setzero_si128();
- col[i32 + 8] = _mm_setzero_si128();
- col[i32 + 9] = _mm_setzero_si128();
- col[i32 + 10] = _mm_setzero_si128();
- col[i32 + 11] = _mm_setzero_si128();
- col[i32 + 12] = _mm_setzero_si128();
- col[i32 + 13] = _mm_setzero_si128();
- col[i32 + 14] = _mm_setzero_si128();
- col[i32 + 15] = _mm_setzero_si128();
- col[i32 + 16] = _mm_setzero_si128();
- col[i32 + 17] = _mm_setzero_si128();
- col[i32 + 18] = _mm_setzero_si128();
- col[i32 + 19] = _mm_setzero_si128();
- col[i32 + 20] = _mm_setzero_si128();
- col[i32 + 21] = _mm_setzero_si128();
- col[i32 + 22] = _mm_setzero_si128();
- col[i32 + 23] = _mm_setzero_si128();
- col[i32 + 24] = _mm_setzero_si128();
- col[i32 + 25] = _mm_setzero_si128();
- col[i32 + 26] = _mm_setzero_si128();
- col[i32 + 27] = _mm_setzero_si128();
- col[i32 + 28] = _mm_setzero_si128();
- col[i32 + 29] = _mm_setzero_si128();
- col[i32 + 30] = _mm_setzero_si128();
- col[i32 + 31] = _mm_setzero_si128();
- continue;
- }
-
- // Transpose 32x8 block to 8x32 block
- array_transpose_8x8(in, in);
- array_transpose_8x8(in+8, in+8);
- array_transpose_8x8(in+16, in+16);
- array_transpose_8x8(in+24, in+24);
-
- IDCT32
-
- // 1_D: Store 32 intermediate results for each 8x32 block.
- col[i32 + 0] = _mm_add_epi16(stp1_0, stp1_31);
- col[i32 + 1] = _mm_add_epi16(stp1_1, stp1_30);
- col[i32 + 2] = _mm_add_epi16(stp1_2, stp1_29);
- col[i32 + 3] = _mm_add_epi16(stp1_3, stp1_28);
- col[i32 + 4] = _mm_add_epi16(stp1_4, stp1_27);
- col[i32 + 5] = _mm_add_epi16(stp1_5, stp1_26);
- col[i32 + 6] = _mm_add_epi16(stp1_6, stp1_25);
- col[i32 + 7] = _mm_add_epi16(stp1_7, stp1_24);
- col[i32 + 8] = _mm_add_epi16(stp1_8, stp1_23);
- col[i32 + 9] = _mm_add_epi16(stp1_9, stp1_22);
- col[i32 + 10] = _mm_add_epi16(stp1_10, stp1_21);
- col[i32 + 11] = _mm_add_epi16(stp1_11, stp1_20);
- col[i32 + 12] = _mm_add_epi16(stp1_12, stp1_19);
- col[i32 + 13] = _mm_add_epi16(stp1_13, stp1_18);
- col[i32 + 14] = _mm_add_epi16(stp1_14, stp1_17);
- col[i32 + 15] = _mm_add_epi16(stp1_15, stp1_16);
- col[i32 + 16] = _mm_sub_epi16(stp1_15, stp1_16);
- col[i32 + 17] = _mm_sub_epi16(stp1_14, stp1_17);
- col[i32 + 18] = _mm_sub_epi16(stp1_13, stp1_18);
- col[i32 + 19] = _mm_sub_epi16(stp1_12, stp1_19);
- col[i32 + 20] = _mm_sub_epi16(stp1_11, stp1_20);
- col[i32 + 21] = _mm_sub_epi16(stp1_10, stp1_21);
- col[i32 + 22] = _mm_sub_epi16(stp1_9, stp1_22);
- col[i32 + 23] = _mm_sub_epi16(stp1_8, stp1_23);
- col[i32 + 24] = _mm_sub_epi16(stp1_7, stp1_24);
- col[i32 + 25] = _mm_sub_epi16(stp1_6, stp1_25);
- col[i32 + 26] = _mm_sub_epi16(stp1_5, stp1_26);
- col[i32 + 27] = _mm_sub_epi16(stp1_4, stp1_27);
- col[i32 + 28] = _mm_sub_epi16(stp1_3, stp1_28);
- col[i32 + 29] = _mm_sub_epi16(stp1_2, stp1_29);
- col[i32 + 30] = _mm_sub_epi16(stp1_1, stp1_30);
- col[i32 + 31] = _mm_sub_epi16(stp1_0, stp1_31);
- }
- for (i = 0; i < 4; i++) {
- const __m128i zero = _mm_setzero_si128();
- // Second 1-D idct
- j = i << 3;
-
- // Transpose 32x8 block to 8x32 block
- array_transpose_8x8(col+j, in);
- array_transpose_8x8(col+j+32, in+8);
- array_transpose_8x8(col+j+64, in+16);
- array_transpose_8x8(col+j+96, in+24);
-
- IDCT32
-
- // 2_D: Calculate the results and store them to destination.
- in[0] = _mm_add_epi16(stp1_0, stp1_31);
- in[1] = _mm_add_epi16(stp1_1, stp1_30);
- in[2] = _mm_add_epi16(stp1_2, stp1_29);
- in[3] = _mm_add_epi16(stp1_3, stp1_28);
- in[4] = _mm_add_epi16(stp1_4, stp1_27);
- in[5] = _mm_add_epi16(stp1_5, stp1_26);
- in[6] = _mm_add_epi16(stp1_6, stp1_25);
- in[7] = _mm_add_epi16(stp1_7, stp1_24);
- in[8] = _mm_add_epi16(stp1_8, stp1_23);
- in[9] = _mm_add_epi16(stp1_9, stp1_22);
- in[10] = _mm_add_epi16(stp1_10, stp1_21);
- in[11] = _mm_add_epi16(stp1_11, stp1_20);
- in[12] = _mm_add_epi16(stp1_12, stp1_19);
- in[13] = _mm_add_epi16(stp1_13, stp1_18);
- in[14] = _mm_add_epi16(stp1_14, stp1_17);
- in[15] = _mm_add_epi16(stp1_15, stp1_16);
- in[16] = _mm_sub_epi16(stp1_15, stp1_16);
- in[17] = _mm_sub_epi16(stp1_14, stp1_17);
- in[18] = _mm_sub_epi16(stp1_13, stp1_18);
- in[19] = _mm_sub_epi16(stp1_12, stp1_19);
- in[20] = _mm_sub_epi16(stp1_11, stp1_20);
- in[21] = _mm_sub_epi16(stp1_10, stp1_21);
- in[22] = _mm_sub_epi16(stp1_9, stp1_22);
- in[23] = _mm_sub_epi16(stp1_8, stp1_23);
- in[24] = _mm_sub_epi16(stp1_7, stp1_24);
- in[25] = _mm_sub_epi16(stp1_6, stp1_25);
- in[26] = _mm_sub_epi16(stp1_5, stp1_26);
- in[27] = _mm_sub_epi16(stp1_4, stp1_27);
- in[28] = _mm_sub_epi16(stp1_3, stp1_28);
- in[29] = _mm_sub_epi16(stp1_2, stp1_29);
- in[30] = _mm_sub_epi16(stp1_1, stp1_30);
- in[31] = _mm_sub_epi16(stp1_0, stp1_31);
-
- // Final rounding and shift
- in[0] = _mm_adds_epi16(in[0], final_rounding);
- in[1] = _mm_adds_epi16(in[1], final_rounding);
- in[2] = _mm_adds_epi16(in[2], final_rounding);
- in[3] = _mm_adds_epi16(in[3], final_rounding);
- in[4] = _mm_adds_epi16(in[4], final_rounding);
- in[5] = _mm_adds_epi16(in[5], final_rounding);
- in[6] = _mm_adds_epi16(in[6], final_rounding);
- in[7] = _mm_adds_epi16(in[7], final_rounding);
- in[8] = _mm_adds_epi16(in[8], final_rounding);
- in[9] = _mm_adds_epi16(in[9], final_rounding);
- in[10] = _mm_adds_epi16(in[10], final_rounding);
- in[11] = _mm_adds_epi16(in[11], final_rounding);
- in[12] = _mm_adds_epi16(in[12], final_rounding);
- in[13] = _mm_adds_epi16(in[13], final_rounding);
- in[14] = _mm_adds_epi16(in[14], final_rounding);
- in[15] = _mm_adds_epi16(in[15], final_rounding);
- in[16] = _mm_adds_epi16(in[16], final_rounding);
- in[17] = _mm_adds_epi16(in[17], final_rounding);
- in[18] = _mm_adds_epi16(in[18], final_rounding);
- in[19] = _mm_adds_epi16(in[19], final_rounding);
- in[20] = _mm_adds_epi16(in[20], final_rounding);
- in[21] = _mm_adds_epi16(in[21], final_rounding);
- in[22] = _mm_adds_epi16(in[22], final_rounding);
- in[23] = _mm_adds_epi16(in[23], final_rounding);
- in[24] = _mm_adds_epi16(in[24], final_rounding);
- in[25] = _mm_adds_epi16(in[25], final_rounding);
- in[26] = _mm_adds_epi16(in[26], final_rounding);
- in[27] = _mm_adds_epi16(in[27], final_rounding);
- in[28] = _mm_adds_epi16(in[28], final_rounding);
- in[29] = _mm_adds_epi16(in[29], final_rounding);
- in[30] = _mm_adds_epi16(in[30], final_rounding);
- in[31] = _mm_adds_epi16(in[31], final_rounding);
-
- in[0] = _mm_srai_epi16(in[0], 6);
- in[1] = _mm_srai_epi16(in[1], 6);
- in[2] = _mm_srai_epi16(in[2], 6);
- in[3] = _mm_srai_epi16(in[3], 6);
- in[4] = _mm_srai_epi16(in[4], 6);
- in[5] = _mm_srai_epi16(in[5], 6);
- in[6] = _mm_srai_epi16(in[6], 6);
- in[7] = _mm_srai_epi16(in[7], 6);
- in[8] = _mm_srai_epi16(in[8], 6);
- in[9] = _mm_srai_epi16(in[9], 6);
- in[10] = _mm_srai_epi16(in[10], 6);
- in[11] = _mm_srai_epi16(in[11], 6);
- in[12] = _mm_srai_epi16(in[12], 6);
- in[13] = _mm_srai_epi16(in[13], 6);
- in[14] = _mm_srai_epi16(in[14], 6);
- in[15] = _mm_srai_epi16(in[15], 6);
- in[16] = _mm_srai_epi16(in[16], 6);
- in[17] = _mm_srai_epi16(in[17], 6);
- in[18] = _mm_srai_epi16(in[18], 6);
- in[19] = _mm_srai_epi16(in[19], 6);
- in[20] = _mm_srai_epi16(in[20], 6);
- in[21] = _mm_srai_epi16(in[21], 6);
- in[22] = _mm_srai_epi16(in[22], 6);
- in[23] = _mm_srai_epi16(in[23], 6);
- in[24] = _mm_srai_epi16(in[24], 6);
- in[25] = _mm_srai_epi16(in[25], 6);
- in[26] = _mm_srai_epi16(in[26], 6);
- in[27] = _mm_srai_epi16(in[27], 6);
- in[28] = _mm_srai_epi16(in[28], 6);
- in[29] = _mm_srai_epi16(in[29], 6);
- in[30] = _mm_srai_epi16(in[30], 6);
- in[31] = _mm_srai_epi16(in[31], 6);
-
- RECON_AND_STORE(dest, in[0]);
- RECON_AND_STORE(dest, in[1]);
- RECON_AND_STORE(dest, in[2]);
- RECON_AND_STORE(dest, in[3]);
- RECON_AND_STORE(dest, in[4]);
- RECON_AND_STORE(dest, in[5]);
- RECON_AND_STORE(dest, in[6]);
- RECON_AND_STORE(dest, in[7]);
- RECON_AND_STORE(dest, in[8]);
- RECON_AND_STORE(dest, in[9]);
- RECON_AND_STORE(dest, in[10]);
- RECON_AND_STORE(dest, in[11]);
- RECON_AND_STORE(dest, in[12]);
- RECON_AND_STORE(dest, in[13]);
- RECON_AND_STORE(dest, in[14]);
- RECON_AND_STORE(dest, in[15]);
- RECON_AND_STORE(dest, in[16]);
- RECON_AND_STORE(dest, in[17]);
- RECON_AND_STORE(dest, in[18]);
- RECON_AND_STORE(dest, in[19]);
- RECON_AND_STORE(dest, in[20]);
- RECON_AND_STORE(dest, in[21]);
- RECON_AND_STORE(dest, in[22]);
- RECON_AND_STORE(dest, in[23]);
- RECON_AND_STORE(dest, in[24]);
- RECON_AND_STORE(dest, in[25]);
- RECON_AND_STORE(dest, in[26]);
- RECON_AND_STORE(dest, in[27]);
- RECON_AND_STORE(dest, in[28]);
- RECON_AND_STORE(dest, in[29]);
- RECON_AND_STORE(dest, in[30]);
- RECON_AND_STORE(dest, in[31]);
-
- dest += 8 - (stride * 32);
- }
-} //NOLINT
-
-void vp9_idct32x32_1_add_sse2(const int16_t *input, uint8_t *dest, int stride) {
- __m128i dc_value;
- const __m128i zero = _mm_setzero_si128();
- int a, i;
-
- a = dct_const_round_shift(input[0] * cospi_16_64);
- a = dct_const_round_shift(a * cospi_16_64);
- a = ROUND_POWER_OF_TWO(a, 6);
-
- dc_value = _mm_set1_epi16(a);
-
- for (i = 0; i < 4; ++i) {
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- RECON_AND_STORE(dest, dc_value);
- dest += 8 - (stride * 32);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_sse2.asm
deleted file mode 100644
index 69b07f6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_sse2.asm
+++ /dev/null
@@ -1,357 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION_RODATA
-pw_4: times 8 dw 4
-pw_8: times 8 dw 8
-pw_16: times 8 dw 16
-pw_32: times 8 dw 32
-
-SECTION .text
-
-INIT_MMX sse
-cglobal dc_predictor_4x4, 4, 5, 2, dst, stride, above, left, goffset
- GET_GOT goffsetq
-
- pxor m1, m1
- movd m0, [aboveq]
- punpckldq m0, [leftq]
- psadbw m0, m1
- paddw m0, [GLOBAL(pw_4)]
- psraw m0, 3
- pshufw m0, m0, 0x0
- packuswb m0, m0
- movd [dstq ], m0
- movd [dstq+strideq], m0
- lea dstq, [dstq+strideq*2]
- movd [dstq ], m0
- movd [dstq+strideq], m0
-
- RESTORE_GOT
- RET
-
-INIT_MMX sse
-cglobal dc_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset
- GET_GOT goffsetq
-
- pxor m1, m1
- movq m0, [aboveq]
- movq m2, [leftq]
- DEFINE_ARGS dst, stride, stride3
- lea stride3q, [strideq*3]
- psadbw m0, m1
- psadbw m2, m1
- paddw m0, m2
- paddw m0, [GLOBAL(pw_8)]
- psraw m0, 4
- pshufw m0, m0, 0x0
- packuswb m0, m0
- movq [dstq ], m0
- movq [dstq+strideq ], m0
- movq [dstq+strideq*2], m0
- movq [dstq+stride3q ], m0
- lea dstq, [dstq+strideq*4]
- movq [dstq ], m0
- movq [dstq+strideq ], m0
- movq [dstq+strideq*2], m0
- movq [dstq+stride3q ], m0
-
- RESTORE_GOT
- RET
-
-INIT_XMM sse2
-cglobal dc_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset
- GET_GOT goffsetq
-
- pxor m1, m1
- mova m0, [aboveq]
- mova m2, [leftq]
- DEFINE_ARGS dst, stride, stride3, lines4
- lea stride3q, [strideq*3]
- mov lines4d, 4
- psadbw m0, m1
- psadbw m2, m1
- paddw m0, m2
- movhlps m2, m0
- paddw m0, m2
- paddw m0, [GLOBAL(pw_16)]
- psraw m0, 5
- pshuflw m0, m0, 0x0
- punpcklqdq m0, m0
- packuswb m0, m0
-.loop:
- mova [dstq ], m0
- mova [dstq+strideq ], m0
- mova [dstq+strideq*2], m0
- mova [dstq+stride3q ], m0
- lea dstq, [dstq+strideq*4]
- dec lines4d
- jnz .loop
-
- RESTORE_GOT
- REP_RET
-
-INIT_XMM sse2
-cglobal dc_predictor_32x32, 4, 5, 5, dst, stride, above, left, goffset
- GET_GOT goffsetq
-
- pxor m1, m1
- mova m0, [aboveq]
- mova m2, [aboveq+16]
- mova m3, [leftq]
- mova m4, [leftq+16]
- DEFINE_ARGS dst, stride, stride3, lines4
- lea stride3q, [strideq*3]
- mov lines4d, 8
- psadbw m0, m1
- psadbw m2, m1
- psadbw m3, m1
- psadbw m4, m1
- paddw m0, m2
- paddw m0, m3
- paddw m0, m4
- movhlps m2, m0
- paddw m0, m2
- paddw m0, [GLOBAL(pw_32)]
- psraw m0, 6
- pshuflw m0, m0, 0x0
- punpcklqdq m0, m0
- packuswb m0, m0
-.loop:
- mova [dstq ], m0
- mova [dstq +16], m0
- mova [dstq+strideq ], m0
- mova [dstq+strideq +16], m0
- mova [dstq+strideq*2 ], m0
- mova [dstq+strideq*2+16], m0
- mova [dstq+stride3q ], m0
- mova [dstq+stride3q +16], m0
- lea dstq, [dstq+strideq*4]
- dec lines4d
- jnz .loop
-
- RESTORE_GOT
- REP_RET
-
-INIT_MMX sse
-cglobal v_predictor_4x4, 3, 3, 1, dst, stride, above
- movd m0, [aboveq]
- movd [dstq ], m0
- movd [dstq+strideq], m0
- lea dstq, [dstq+strideq*2]
- movd [dstq ], m0
- movd [dstq+strideq], m0
- RET
-
-INIT_MMX sse
-cglobal v_predictor_8x8, 3, 3, 1, dst, stride, above
- movq m0, [aboveq]
- DEFINE_ARGS dst, stride, stride3
- lea stride3q, [strideq*3]
- movq [dstq ], m0
- movq [dstq+strideq ], m0
- movq [dstq+strideq*2], m0
- movq [dstq+stride3q ], m0
- lea dstq, [dstq+strideq*4]
- movq [dstq ], m0
- movq [dstq+strideq ], m0
- movq [dstq+strideq*2], m0
- movq [dstq+stride3q ], m0
- RET
-
-INIT_XMM sse2
-cglobal v_predictor_16x16, 3, 4, 1, dst, stride, above
- mova m0, [aboveq]
- DEFINE_ARGS dst, stride, stride3, nlines4
- lea stride3q, [strideq*3]
- mov nlines4d, 4
-.loop:
- mova [dstq ], m0
- mova [dstq+strideq ], m0
- mova [dstq+strideq*2], m0
- mova [dstq+stride3q ], m0
- lea dstq, [dstq+strideq*4]
- dec nlines4d
- jnz .loop
- REP_RET
-
-INIT_XMM sse2
-cglobal v_predictor_32x32, 3, 4, 2, dst, stride, above
- mova m0, [aboveq]
- mova m1, [aboveq+16]
- DEFINE_ARGS dst, stride, stride3, nlines4
- lea stride3q, [strideq*3]
- mov nlines4d, 8
-.loop:
- mova [dstq ], m0
- mova [dstq +16], m1
- mova [dstq+strideq ], m0
- mova [dstq+strideq +16], m1
- mova [dstq+strideq*2 ], m0
- mova [dstq+strideq*2+16], m1
- mova [dstq+stride3q ], m0
- mova [dstq+stride3q +16], m1
- lea dstq, [dstq+strideq*4]
- dec nlines4d
- jnz .loop
- REP_RET
-
-INIT_MMX sse
-cglobal tm_predictor_4x4, 4, 4, 4, dst, stride, above, left
- pxor m1, m1
- movd m2, [aboveq-1]
- movd m0, [aboveq]
- punpcklbw m2, m1
- punpcklbw m0, m1
- pshufw m2, m2, 0x0
- DEFINE_ARGS dst, stride, line, left
- mov lineq, -2
- add leftq, 4
- psubw m0, m2
-.loop:
- movd m2, [leftq+lineq*2]
- movd m3, [leftq+lineq*2+1]
- punpcklbw m2, m1
- punpcklbw m3, m1
- pshufw m2, m2, 0x0
- pshufw m3, m3, 0x0
- paddw m2, m0
- paddw m3, m0
- packuswb m2, m2
- packuswb m3, m3
- movd [dstq ], m2
- movd [dstq+strideq], m3
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-
-INIT_XMM sse2
-cglobal tm_predictor_8x8, 4, 4, 4, dst, stride, above, left
- pxor m1, m1
- movd m2, [aboveq-1]
- movq m0, [aboveq]
- punpcklbw m2, m1
- punpcklbw m0, m1
- pshuflw m2, m2, 0x0
- DEFINE_ARGS dst, stride, line, left
- mov lineq, -4
- punpcklqdq m2, m2
- add leftq, 8
- psubw m0, m2
-.loop:
- movd m2, [leftq+lineq*2]
- movd m3, [leftq+lineq*2+1]
- punpcklbw m2, m1
- punpcklbw m3, m1
- pshuflw m2, m2, 0x0
- pshuflw m3, m3, 0x0
- punpcklqdq m2, m2
- punpcklqdq m3, m3
- paddw m2, m0
- paddw m3, m0
- packuswb m2, m3
- movq [dstq ], m2
- movhps [dstq+strideq], m2
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-
-INIT_XMM sse2
-cglobal tm_predictor_16x16, 4, 4, 7, dst, stride, above, left
- pxor m1, m1
- movd m2, [aboveq-1]
- mova m0, [aboveq]
- punpcklbw m2, m1
- punpckhbw m4, m0, m1
- punpcklbw m0, m1
- pshuflw m2, m2, 0x0
- DEFINE_ARGS dst, stride, line, left
- mov lineq, -8
- punpcklqdq m2, m2
- add leftq, 16
- psubw m0, m2
- psubw m4, m2
-.loop:
- movd m2, [leftq+lineq*2]
- movd m3, [leftq+lineq*2+1]
- punpcklbw m2, m1
- punpcklbw m3, m1
- pshuflw m2, m2, 0x0
- pshuflw m3, m3, 0x0
- punpcklqdq m2, m2
- punpcklqdq m3, m3
- paddw m5, m2, m0
- paddw m6, m3, m0
- paddw m2, m4
- paddw m3, m4
- packuswb m5, m2
- packuswb m6, m3
- mova [dstq ], m5
- mova [dstq+strideq], m6
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-
-%if ARCH_X86_64
-INIT_XMM sse2
-cglobal tm_predictor_32x32, 4, 4, 10, dst, stride, above, left
- pxor m1, m1
- movd m2, [aboveq-1]
- mova m0, [aboveq]
- mova m4, [aboveq+16]
- punpcklbw m2, m1
- punpckhbw m3, m0, m1
- punpckhbw m5, m4, m1
- punpcklbw m0, m1
- punpcklbw m4, m1
- pshuflw m2, m2, 0x0
- DEFINE_ARGS dst, stride, line, left
- mov lineq, -16
- punpcklqdq m2, m2
- add leftq, 32
- psubw m0, m2
- psubw m3, m2
- psubw m4, m2
- psubw m5, m2
-.loop:
- movd m2, [leftq+lineq*2]
- movd m6, [leftq+lineq*2+1]
- punpcklbw m2, m1
- punpcklbw m6, m1
- pshuflw m2, m2, 0x0
- pshuflw m6, m6, 0x0
- punpcklqdq m2, m2
- punpcklqdq m6, m6
- paddw m7, m2, m0
- paddw m8, m2, m3
- paddw m9, m2, m4
- paddw m2, m5
- packuswb m7, m8
- packuswb m9, m2
- paddw m2, m6, m0
- paddw m8, m6, m3
- mova [dstq ], m7
- paddw m7, m6, m4
- paddw m6, m5
- mova [dstq +16], m9
- packuswb m2, m8
- packuswb m7, m6
- mova [dstq+strideq ], m2
- mova [dstq+strideq+16], m7
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-%endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_ssse3.asm
deleted file mode 100644
index 88df9b2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_intrapred_ssse3.asm
+++ /dev/null
@@ -1,1036 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION_RODATA
-
-pb_1: times 16 db 1
-sh_b01234577: db 0, 1, 2, 3, 4, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b12345677: db 1, 2, 3, 4, 5, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b23456777: db 2, 3, 4, 5, 6, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b0123456777777777: db 0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7
-sh_b1234567777777777: db 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-sh_b2345677777777777: db 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-sh_b123456789abcdeff: db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15
-sh_b23456789abcdefff: db 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15
-sh_b32104567: db 3, 2, 1, 0, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b8091a2b345: db 8, 0, 9, 1, 10, 2, 11, 3, 4, 5, 0, 0, 0, 0, 0, 0
-sh_b76543210: db 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b65432108: db 6, 5, 4, 3, 2, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b54321089: db 5, 4, 3, 2, 1, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b89abcdef: db 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0
-sh_bfedcba9876543210: db 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
-sh_b1233: db 1, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-sh_b2333: db 2, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-
-SECTION .text
-
-INIT_MMX ssse3
-cglobal h_predictor_4x4, 2, 4, 3, dst, stride, line, left
- movifnidn leftq, leftmp
- add leftq, 4
- mov lineq, -2
- pxor m0, m0
-.loop:
- movd m1, [leftq+lineq*2 ]
- movd m2, [leftq+lineq*2+1]
- pshufb m1, m0
- pshufb m2, m0
- movd [dstq ], m1
- movd [dstq+strideq], m2
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-
-INIT_MMX ssse3
-cglobal h_predictor_8x8, 2, 4, 3, dst, stride, line, left
- movifnidn leftq, leftmp
- add leftq, 8
- mov lineq, -4
- pxor m0, m0
-.loop:
- movd m1, [leftq+lineq*2 ]
- movd m2, [leftq+lineq*2+1]
- pshufb m1, m0
- pshufb m2, m0
- movq [dstq ], m1
- movq [dstq+strideq], m2
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-
-INIT_XMM ssse3
-cglobal h_predictor_16x16, 2, 4, 3, dst, stride, line, left
- movifnidn leftq, leftmp
- add leftq, 16
- mov lineq, -8
- pxor m0, m0
-.loop:
- movd m1, [leftq+lineq*2 ]
- movd m2, [leftq+lineq*2+1]
- pshufb m1, m0
- pshufb m2, m0
- mova [dstq ], m1
- mova [dstq+strideq], m2
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-
-INIT_XMM ssse3
-cglobal h_predictor_32x32, 2, 4, 3, dst, stride, line, left
- movifnidn leftq, leftmp
- add leftq, 32
- mov lineq, -16
- pxor m0, m0
-.loop:
- movd m1, [leftq+lineq*2 ]
- movd m2, [leftq+lineq*2+1]
- pshufb m1, m0
- pshufb m2, m0
- mova [dstq ], m1
- mova [dstq +16], m1
- mova [dstq+strideq ], m2
- mova [dstq+strideq+16], m2
- lea dstq, [dstq+strideq*2]
- inc lineq
- jnz .loop
- REP_RET
-
-INIT_MMX ssse3
-cglobal d45_predictor_4x4, 3, 4, 4, dst, stride, above, goffset
- GET_GOT goffsetq
-
- movq m0, [aboveq]
- pshufb m2, m0, [GLOBAL(sh_b23456777)]
- pshufb m1, m0, [GLOBAL(sh_b01234577)]
- pshufb m0, [GLOBAL(sh_b12345677)]
- pavgb m3, m2, m1
- pxor m2, m1
- pand m2, [GLOBAL(pb_1)]
- psubb m3, m2
- pavgb m0, m3
-
- ; store 4 lines
- movd [dstq ], m0
- psrlq m0, 8
- movd [dstq+strideq], m0
- lea dstq, [dstq+strideq*2]
- psrlq m0, 8
- movd [dstq ], m0
- psrlq m0, 8
- movd [dstq+strideq], m0
-
- RESTORE_GOT
- RET
-
-INIT_MMX ssse3
-cglobal d45_predictor_8x8, 3, 4, 4, dst, stride, above, goffset
- GET_GOT goffsetq
-
- movq m0, [aboveq]
- mova m1, [GLOBAL(sh_b12345677)]
- DEFINE_ARGS dst, stride, stride3
- lea stride3q, [strideq*3]
- pshufb m2, m0, [GLOBAL(sh_b23456777)]
- pavgb m3, m2, m0
- pxor m2, m0
- pshufb m0, m1
- pand m2, [GLOBAL(pb_1)]
- psubb m3, m2
- pavgb m0, m3
-
- ; store 4 lines
- movq [dstq ], m0
- pshufb m0, m1
- movq [dstq+strideq ], m0
- pshufb m0, m1
- movq [dstq+strideq*2], m0
- pshufb m0, m1
- movq [dstq+stride3q ], m0
- pshufb m0, m1
- lea dstq, [dstq+strideq*4]
-
- ; store next 4 lines
- movq [dstq ], m0
- pshufb m0, m1
- movq [dstq+strideq ], m0
- pshufb m0, m1
- movq [dstq+strideq*2], m0
- pshufb m0, m1
- movq [dstq+stride3q ], m0
-
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d45_predictor_16x16, 3, 6, 4, dst, stride, above, dst8, line, goffset
- GET_GOT goffsetq
-
- mova m0, [aboveq]
- DEFINE_ARGS dst, stride, stride3, dst8, line
- lea stride3q, [strideq*3]
- lea dst8q, [dstq+strideq*8]
- mova m1, [GLOBAL(sh_b123456789abcdeff)]
- pshufb m2, m0, [GLOBAL(sh_b23456789abcdefff)]
- pavgb m3, m2, m0
- pxor m2, m0
- pshufb m0, m1
- pand m2, [GLOBAL(pb_1)]
- psubb m3, m2
- pavgb m0, m3
-
- ; first 4 lines and first half of 3rd 4 lines
- mov lined, 2
-.loop:
- mova [dstq ], m0
- movhps [dst8q ], m0
- pshufb m0, m1
- mova [dstq +strideq ], m0
- movhps [dst8q+strideq ], m0
- pshufb m0, m1
- mova [dstq +strideq*2 ], m0
- movhps [dst8q+strideq*2 ], m0
- pshufb m0, m1
- mova [dstq +stride3q ], m0
- movhps [dst8q+stride3q ], m0
- pshufb m0, m1
- lea dstq, [dstq +strideq*4]
- lea dst8q, [dst8q+strideq*4]
- dec lined
- jnz .loop
-
- ; bottom-right 8x8 block
- movhps [dstq +8], m0
- movhps [dstq+strideq +8], m0
- movhps [dstq+strideq*2+8], m0
- movhps [dstq+stride3q +8], m0
- lea dstq, [dstq+strideq*4]
- movhps [dstq +8], m0
- movhps [dstq+strideq +8], m0
- movhps [dstq+strideq*2+8], m0
- movhps [dstq+stride3q +8], m0
-
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d45_predictor_32x32, 3, 6, 7, dst, stride, above, dst16, line, goffset
- GET_GOT goffsetq
-
- mova m0, [aboveq]
- mova m4, [aboveq+16]
- DEFINE_ARGS dst, stride, stride3, dst16, line
- lea stride3q, [strideq*3]
- lea dst16q, [dstq +strideq*8]
- lea dst16q, [dst16q+strideq*8]
- mova m1, [GLOBAL(sh_b123456789abcdeff)]
- pshufb m2, m4, [GLOBAL(sh_b23456789abcdefff)]
- pavgb m3, m2, m4
- pxor m2, m4
- palignr m5, m4, m0, 1
- palignr m6, m4, m0, 2
- pshufb m4, m1
- pand m2, [GLOBAL(pb_1)]
- psubb m3, m2
- pavgb m4, m3
- pavgb m3, m0, m6
- pxor m0, m6
- pand m0, [GLOBAL(pb_1)]
- psubb m3, m0
- pavgb m5, m3
-
- ; write 4x4 lines (and the first half of the second 4x4 lines)
- mov lined, 4
-.loop:
- mova [dstq ], m5
- mova [dstq +16], m4
- mova [dst16q ], m4
- palignr m3, m4, m5, 1
- pshufb m4, m1
- mova [dstq +strideq ], m3
- mova [dstq +strideq +16], m4
- mova [dst16q+strideq ], m4
- palignr m5, m4, m3, 1
- pshufb m4, m1
- mova [dstq +strideq*2 ], m5
- mova [dstq +strideq*2+16], m4
- mova [dst16q+strideq*2 ], m4
- palignr m3, m4, m5, 1
- pshufb m4, m1
- mova [dstq +stride3q ], m3
- mova [dstq +stride3q +16], m4
- mova [dst16q+stride3q ], m4
- palignr m5, m4, m3, 1
- pshufb m4, m1
- lea dstq, [dstq +strideq*4]
- lea dst16q, [dst16q+strideq*4]
- dec lined
- jnz .loop
-
- ; write second half of second 4x4 lines
- mova [dstq +16], m4
- mova [dstq +strideq +16], m4
- mova [dstq +strideq*2+16], m4
- mova [dstq +stride3q +16], m4
- lea dstq, [dstq +strideq*4]
- mova [dstq +16], m4
- mova [dstq +strideq +16], m4
- mova [dstq +strideq*2+16], m4
- mova [dstq +stride3q +16], m4
- lea dstq, [dstq +strideq*4]
- mova [dstq +16], m4
- mova [dstq +strideq +16], m4
- mova [dstq +strideq*2+16], m4
- mova [dstq +stride3q +16], m4
- lea dstq, [dstq +strideq*4]
- mova [dstq +16], m4
- mova [dstq +strideq +16], m4
- mova [dstq +strideq*2+16], m4
- mova [dstq +stride3q +16], m4
-
- RESTORE_GOT
- RET
-
-; ------------------------------------------
-; input: x, y, z, result
-;
-; trick from pascal
-; (x+2y+z+2)>>2 can be calculated as:
-; result = avg(x,z)
-; result -= xor(x,z) & 1
-; result = avg(result,y)
-; ------------------------------------------
-%macro X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 4
- pavgb %4, %1, %3
- pxor %3, %1
- pand %3, [GLOBAL(pb_1)]
- psubb %4, %3
- pavgb %4, %2
-%endmacro
-
-INIT_XMM ssse3
-cglobal d63_predictor_4x4, 3, 4, 5, dst, stride, above, goffset
- GET_GOT goffsetq
-
- movq m3, [aboveq]
- pshufb m1, m3, [GLOBAL(sh_b23456777)]
- pshufb m2, m3, [GLOBAL(sh_b12345677)]
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m3, m2, m1, m4
- pavgb m3, m2
-
- ; store 4 lines
- movd [dstq ], m3
- movd [dstq+strideq], m4
- lea dstq, [dstq+strideq*2]
- psrldq m3, 1
- psrldq m4, 1
- movd [dstq ], m3
- movd [dstq+strideq], m4
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d63_predictor_8x8, 3, 4, 5, dst, stride, above, goffset
- GET_GOT goffsetq
-
- movq m3, [aboveq]
- DEFINE_ARGS dst, stride, stride3
- lea stride3q, [strideq*3]
- pshufb m1, m3, [GLOBAL(sh_b2345677777777777)]
- pshufb m0, m3, [GLOBAL(sh_b0123456777777777)]
- pshufb m2, m3, [GLOBAL(sh_b1234567777777777)]
- pshufb m3, [GLOBAL(sh_b0123456777777777)]
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m2, m1, m4
- pavgb m3, m2
-
- ; store 4 lines
- movq [dstq ], m3
- movq [dstq+strideq], m4
- psrldq m3, 1
- psrldq m4, 1
- movq [dstq+strideq*2], m3
- movq [dstq+stride3q ], m4
- lea dstq, [dstq+strideq*4]
- psrldq m3, 1
- psrldq m4, 1
-
- ; store 4 lines
- movq [dstq ], m3
- movq [dstq+strideq], m4
- psrldq m3, 1
- psrldq m4, 1
- movq [dstq+strideq*2], m3
- movq [dstq+stride3q ], m4
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d63_predictor_16x16, 3, 5, 5, dst, stride, above, line, goffset
- GET_GOT goffsetq
-
- mova m0, [aboveq]
- DEFINE_ARGS dst, stride, stride3, line
- lea stride3q, [strideq*3]
- mova m1, [GLOBAL(sh_b123456789abcdeff)]
- pshufb m2, m0, [GLOBAL(sh_b23456789abcdefff)]
- pshufb m3, m0, m1
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m3, m2, m4
- pavgb m0, m3
-
- mov lined, 4
-.loop:
- mova [dstq ], m0
- mova [dstq+strideq ], m4
- pshufb m0, m1
- pshufb m4, m1
- mova [dstq+strideq*2], m0
- mova [dstq+stride3q ], m4
- pshufb m0, m1
- pshufb m4, m1
- lea dstq, [dstq+strideq*4]
- dec lined
- jnz .loop
- RESTORE_GOT
- REP_RET
-
-INIT_XMM ssse3
-cglobal d63_predictor_32x32, 3, 5, 8, dst, stride, above, line, goffset
- GET_GOT goffsetq
-
- mova m0, [aboveq]
- mova m7, [aboveq+16]
- DEFINE_ARGS dst, stride, stride3, line
- mova m1, [GLOBAL(sh_b123456789abcdeff)]
- lea stride3q, [strideq*3]
- pshufb m2, m7, [GLOBAL(sh_b23456789abcdefff)]
- pshufb m3, m7, m1
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m7, m3, m2, m4
- palignr m6, m7, m0, 1
- palignr m5, m7, m0, 2
- pavgb m7, m3
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m6, m5, m2
- pavgb m0, m6
-
- mov lined, 8
-.loop:
- mova [dstq ], m0
- mova [dstq +16], m7
- mova [dstq+strideq ], m2
- mova [dstq+strideq +16], m4
- palignr m3, m7, m0, 1
- palignr m5, m4, m2, 1
- pshufb m7, m1
- pshufb m4, m1
-
- mova [dstq+strideq*2 ], m3
- mova [dstq+strideq*2+16], m7
- mova [dstq+stride3q ], m5
- mova [dstq+stride3q +16], m4
- palignr m0, m7, m3, 1
- palignr m2, m4, m5, 1
- pshufb m7, m1
- pshufb m4, m1
- lea dstq, [dstq+strideq*4]
- dec lined
- jnz .loop
- RESTORE_GOT
- REP_RET
-
-INIT_XMM ssse3
-cglobal d153_predictor_4x4, 4, 5, 4, dst, stride, above, left, goffset
- GET_GOT goffsetq
- movd m0, [leftq] ; l1, l2, l3, l4
- movd m1, [aboveq-1] ; tl, t1, t2, t3
- punpckldq m0, m1 ; l1, l2, l3, l4, tl, t1, t2, t3
- pshufb m0, [GLOBAL(sh_b32104567)]; l4, l3, l2, l1, tl, t1, t2, t3
- psrldq m1, m0, 1 ; l3, l2, l1, tl, t1, t2, t3
- psrldq m2, m0, 2 ; l2, l1, tl, t1, t2, t3
- ; comments below are for a predictor like this
- ; A1 B1 C1 D1
- ; A2 B2 A1 B1
- ; A3 B3 A2 B2
- ; A4 B4 A3 B3
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m1, m2, m3 ; 3-tap avg B4 B3 B2 B1 C1 D1
- pavgb m1, m0 ; 2-tap avg A4 A3 A2 A1
-
- punpcklqdq m3, m1 ; B4 B3 B2 B1 C1 D1 x x A4 A3 A2 A1 ..
-
- DEFINE_ARGS dst, stride, stride3
- lea stride3q, [strideq*3]
- pshufb m3, [GLOBAL(sh_b8091a2b345)] ; A4 B4 A3 B3 A2 B2 A1 B1 C1 D1 ..
- movd [dstq+stride3q ], m3
- psrldq m3, 2 ; A3 B3 A2 B2 A1 B1 C1 D1 ..
- movd [dstq+strideq*2], m3
- psrldq m3, 2 ; A2 B2 A1 B1 C1 D1 ..
- movd [dstq+strideq ], m3
- psrldq m3, 2 ; A1 B1 C1 D1 ..
- movd [dstq ], m3
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d153_predictor_8x8, 4, 5, 8, dst, stride, above, left, goffset
- GET_GOT goffsetq
- movq m0, [leftq] ; [0- 7] l1-8 [byte]
- movhps m0, [aboveq-1] ; [8-15] tl, t1-7 [byte]
- pshufb m1, m0, [GLOBAL(sh_b76543210)] ; l8-1 [word]
- pshufb m2, m0, [GLOBAL(sh_b65432108)] ; l7-1,tl [word]
- pshufb m3, m0, [GLOBAL(sh_b54321089)] ; l6-1,tl,t1 [word]
- pshufb m0, [GLOBAL(sh_b89abcdef)] ; tl,t1-7 [word]
- psrldq m4, m0, 1 ; t1-7 [word]
- psrldq m5, m0, 2 ; t2-7 [word]
- ; comments below are for a predictor like this
- ; A1 B1 C1 D1 E1 F1 G1 H1
- ; A2 B2 A1 B1 C1 D1 E1 F1
- ; A3 B3 A2 B2 A1 B1 C1 D1
- ; A4 B4 A3 B3 A2 B2 A1 B1
- ; A5 B5 A4 B4 A3 B3 A2 B2
- ; A6 B6 A5 B5 A4 B4 A3 B3
- ; A7 B7 A6 B6 A5 B5 A4 B4
- ; A8 B8 A7 B7 A6 B6 A5 B5
- pavgb m6, m1, m2 ; 2-tap avg A8-A1
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m4, m5, m7 ; 3-tap avg C-H1
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m1, m2, m3, m0 ; 3-tap avg B8-1
-
- punpcklbw m6, m0 ; A-B8, A-B7 ... A-B2, A-B1
-
- DEFINE_ARGS dst, stride, stride3
- lea stride3q, [strideq*3]
-
- movhps [dstq+stride3q], m6 ; A-B4, A-B3, A-B2, A-B1
- palignr m0, m7, m6, 10 ; A-B3, A-B2, A-B1, C-H1
- movq [dstq+strideq*2], m0
- psrldq m0, 2 ; A-B2, A-B1, C-H1
- movq [dstq+strideq ], m0
- psrldq m0, 2 ; A-H1
- movq [dstq ], m0
- lea dstq, [dstq+strideq*4]
- movq [dstq+stride3q ], m6 ; A-B8, A-B7, A-B6, A-B5
- psrldq m6, 2 ; A-B7, A-B6, A-B5, A-B4
- movq [dstq+strideq*2], m6
- psrldq m6, 2 ; A-B6, A-B5, A-B4, A-B3
- movq [dstq+strideq ], m6
- psrldq m6, 2 ; A-B5, A-B4, A-B3, A-B2
- movq [dstq ], m6
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d153_predictor_16x16, 4, 5, 8, dst, stride, above, left, goffset
- GET_GOT goffsetq
- mova m0, [leftq]
- movu m7, [aboveq-1]
- ; comments below are for a predictor like this
- ; A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 M1 N1 O1 P1
- ; A2 B2 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 M1 N1
- ; A3 B3 A2 B2 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1
- ; A4 B4 A3 B3 A2 B2 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1
- ; A5 B5 A4 B4 A3 B3 A2 B2 A1 B1 C1 D1 E1 F1 G1 H1
- ; A6 B6 A5 B5 A4 B4 A3 B3 A2 B2 A1 B1 C1 D1 E1 F1
- ; A7 B7 A6 B6 A5 B5 A4 B4 A3 B3 A2 B2 A1 B1 C1 D1
- ; A8 B8 A7 B7 A6 B6 A5 B5 A4 B4 A3 B3 A2 B2 A1 B1
- ; A9 B9 A8 B8 A7 B7 A6 B6 A5 B5 A4 B4 A3 B3 A2 B2
- ; Aa Ba A9 B9 A8 B8 A7 B7 A6 B6 A5 B5 A4 B4 A3 B3
- ; Ab Bb Aa Ba A9 B9 A8 B8 A7 B7 A6 B6 A5 B5 A4 B4
- ; Ac Bc Ab Bb Aa Ba A9 B9 A8 B8 A7 B7 A6 B6 A5 B5
- ; Ad Bd Ac Bc Ab Bb Aa Ba A9 B9 A8 B8 A7 B7 A6 B6
- ; Ae Be Ad Bd Ac Bc Ab Bb Aa Ba A9 B9 A8 B8 A7 B7
- ; Af Bf Ae Be Ad Bd Ac Bc Ab Bb Aa Ba A9 B9 A8 B8
- ; Ag Bg Af Bf Ae Be Ad Bd Ac Bc Ab Bb Aa Ba A9 B9
- pshufb m6, m7, [GLOBAL(sh_bfedcba9876543210)]
- palignr m5, m0, m6, 15
- palignr m3, m0, m6, 14
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m5, m3, m4 ; 3-tap avg B3-Bg
- pshufb m1, m0, [GLOBAL(sh_b123456789abcdeff)]
- pavgb m5, m0 ; A1 - Ag
-
- punpcklbw m0, m4, m5 ; A-B8 ... A-B1
- punpckhbw m4, m5 ; A-B9 ... A-Bg
-
- pshufb m3, m7, [GLOBAL(sh_b123456789abcdeff)]
- pshufb m5, m7, [GLOBAL(sh_b23456789abcdefff)]
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m7, m3, m5, m1 ; 3-tap avg C1-P1
-
- pshufb m6, m0, [GLOBAL(sh_bfedcba9876543210)]
- DEFINE_ARGS dst, stride, stride3
- lea stride3q, [strideq*3]
- palignr m2, m1, m6, 14
- mova [dstq ], m2
- palignr m2, m1, m6, 12
- mova [dstq+strideq ], m2
- palignr m2, m1, m6, 10
- mova [dstq+strideq*2], m2
- palignr m2, m1, m6, 8
- mova [dstq+stride3q ], m2
- lea dstq, [dstq+strideq*4]
- palignr m2, m1, m6, 6
- mova [dstq ], m2
- palignr m2, m1, m6, 4
- mova [dstq+strideq ], m2
- palignr m2, m1, m6, 2
- mova [dstq+strideq*2], m2
- pshufb m4, [GLOBAL(sh_bfedcba9876543210)]
- mova [dstq+stride3q ], m6
- lea dstq, [dstq+strideq*4]
-
- palignr m2, m6, m4, 14
- mova [dstq ], m2
- palignr m2, m6, m4, 12
- mova [dstq+strideq ], m2
- palignr m2, m6, m4, 10
- mova [dstq+strideq*2], m2
- palignr m2, m6, m4, 8
- mova [dstq+stride3q ], m2
- lea dstq, [dstq+strideq*4]
- palignr m2, m6, m4, 6
- mova [dstq ], m2
- palignr m2, m6, m4, 4
- mova [dstq+strideq ], m2
- palignr m2, m6, m4, 2
- mova [dstq+strideq*2], m2
- mova [dstq+stride3q ], m4
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d153_predictor_32x32, 4, 5, 8, dst, stride, above, left, goffset
- GET_GOT goffsetq
- mova m0, [leftq]
- movu m7, [aboveq-1]
- movu m1, [aboveq+15]
-
- pshufb m4, m1, [GLOBAL(sh_b123456789abcdeff)]
- pshufb m6, m1, [GLOBAL(sh_b23456789abcdefff)]
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m1, m4, m6, m2 ; 3-tap avg above [high]
-
- palignr m3, m1, m7, 1
- palignr m5, m1, m7, 2
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m7, m3, m5, m1 ; 3-tap avg above [low]
-
- pshufb m7, [GLOBAL(sh_bfedcba9876543210)]
- palignr m5, m0, m7, 15
- palignr m3, m0, m7, 14
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m5, m3, m4 ; 3-tap avg B3-Bg
- pavgb m5, m0 ; A1 - Ag
- punpcklbw m6, m4, m5 ; A-B8 ... A-B1
- punpckhbw m4, m5 ; A-B9 ... A-Bg
- pshufb m6, [GLOBAL(sh_bfedcba9876543210)]
- pshufb m4, [GLOBAL(sh_bfedcba9876543210)]
-
- DEFINE_ARGS dst, stride, stride3, left, line
- lea stride3q, [strideq*3]
-
- palignr m5, m2, m1, 14
- palignr m7, m1, m6, 14
- mova [dstq ], m7
- mova [dstq+16 ], m5
- palignr m5, m2, m1, 12
- palignr m7, m1, m6, 12
- mova [dstq+strideq ], m7
- mova [dstq+strideq+16 ], m5
- palignr m5, m2, m1, 10
- palignr m7, m1, m6, 10
- mova [dstq+strideq*2 ], m7
- mova [dstq+strideq*2+16], m5
- palignr m5, m2, m1, 8
- palignr m7, m1, m6, 8
- mova [dstq+stride3q ], m7
- mova [dstq+stride3q+16 ], m5
- lea dstq, [dstq+strideq*4]
- palignr m5, m2, m1, 6
- palignr m7, m1, m6, 6
- mova [dstq ], m7
- mova [dstq+16 ], m5
- palignr m5, m2, m1, 4
- palignr m7, m1, m6, 4
- mova [dstq+strideq ], m7
- mova [dstq+strideq+16 ], m5
- palignr m5, m2, m1, 2
- palignr m7, m1, m6, 2
- mova [dstq+strideq*2 ], m7
- mova [dstq+strideq*2+16], m5
- mova [dstq+stride3q ], m6
- mova [dstq+stride3q+16 ], m1
- lea dstq, [dstq+strideq*4]
-
- palignr m5, m1, m6, 14
- palignr m3, m6, m4, 14
- mova [dstq ], m3
- mova [dstq+16 ], m5
- palignr m5, m1, m6, 12
- palignr m3, m6, m4, 12
- mova [dstq+strideq ], m3
- mova [dstq+strideq+16 ], m5
- palignr m5, m1, m6, 10
- palignr m3, m6, m4, 10
- mova [dstq+strideq*2 ], m3
- mova [dstq+strideq*2+16], m5
- palignr m5, m1, m6, 8
- palignr m3, m6, m4, 8
- mova [dstq+stride3q ], m3
- mova [dstq+stride3q+16 ], m5
- lea dstq, [dstq+strideq*4]
- palignr m5, m1, m6, 6
- palignr m3, m6, m4, 6
- mova [dstq ], m3
- mova [dstq+16 ], m5
- palignr m5, m1, m6, 4
- palignr m3, m6, m4, 4
- mova [dstq+strideq ], m3
- mova [dstq+strideq+16 ], m5
- palignr m5, m1, m6, 2
- palignr m3, m6, m4, 2
- mova [dstq+strideq*2 ], m3
- mova [dstq+strideq*2+16], m5
- mova [dstq+stride3q ], m4
- mova [dstq+stride3q+16 ], m6
- lea dstq, [dstq+strideq*4]
-
- mova m7, [leftq]
- mova m3, [leftq+16]
- palignr m5, m3, m7, 15
- palignr m0, m3, m7, 14
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m3, m5, m0, m2 ; 3-tap avg Bh -
- pavgb m5, m3 ; Ah -
- punpcklbw m3, m2, m5 ; A-B8 ... A-B1
- punpckhbw m2, m5 ; A-B9 ... A-Bg
- pshufb m3, [GLOBAL(sh_bfedcba9876543210)]
- pshufb m2, [GLOBAL(sh_bfedcba9876543210)]
-
- palignr m7, m6, m4, 14
- palignr m0, m4, m3, 14
- mova [dstq ], m0
- mova [dstq+16 ], m7
- palignr m7, m6, m4, 12
- palignr m0, m4, m3, 12
- mova [dstq+strideq ], m0
- mova [dstq+strideq+16 ], m7
- palignr m7, m6, m4, 10
- palignr m0, m4, m3, 10
- mova [dstq+strideq*2 ], m0
- mova [dstq+strideq*2+16], m7
- palignr m7, m6, m4, 8
- palignr m0, m4, m3, 8
- mova [dstq+stride3q ], m0
- mova [dstq+stride3q+16 ], m7
- lea dstq, [dstq+strideq*4]
- palignr m7, m6, m4, 6
- palignr m0, m4, m3, 6
- mova [dstq ], m0
- mova [dstq+16 ], m7
- palignr m7, m6, m4, 4
- palignr m0, m4, m3, 4
- mova [dstq+strideq ], m0
- mova [dstq+strideq+16 ], m7
- palignr m7, m6, m4, 2
- palignr m0, m4, m3, 2
- mova [dstq+strideq*2 ], m0
- mova [dstq+strideq*2+16], m7
- mova [dstq+stride3q ], m3
- mova [dstq+stride3q+16 ], m4
- lea dstq, [dstq+strideq*4]
-
- palignr m7, m4, m3, 14
- palignr m0, m3, m2, 14
- mova [dstq ], m0
- mova [dstq+16 ], m7
- palignr m7, m4, m3, 12
- palignr m0, m3, m2, 12
- mova [dstq+strideq ], m0
- mova [dstq+strideq+16 ], m7
- palignr m7, m4, m3, 10
- palignr m0, m3, m2, 10
- mova [dstq+strideq*2 ], m0
- mova [dstq+strideq*2+16], m7
- palignr m7, m4, m3, 8
- palignr m0, m3, m2, 8
- mova [dstq+stride3q ], m0
- mova [dstq+stride3q+16 ], m7
- lea dstq, [dstq+strideq*4]
- palignr m7, m4, m3, 6
- palignr m0, m3, m2, 6
- mova [dstq ], m0
- mova [dstq+16 ], m7
- palignr m7, m4, m3, 4
- palignr m0, m3, m2, 4
- mova [dstq+strideq ], m0
- mova [dstq+strideq+16 ], m7
- palignr m7, m4, m3, 2
- palignr m0, m3, m2, 2
- mova [dstq+strideq*2 ], m0
- mova [dstq+strideq*2+16], m7
- mova [dstq+stride3q ], m2
- mova [dstq+stride3q+16 ], m3
-
- RESTORE_GOT
- RET
-
-INIT_MMX ssse3
-cglobal d207_predictor_4x4, 4, 5, 4, dst, stride, unused, left, goffset
- GET_GOT goffsetq
- movd m0, [leftq] ; abcd [byte]
- pshufb m1, m0, [GLOBAL(sh_b1233)] ; bcdd [byte]
- pshufb m3, m0, [GLOBAL(sh_b2333)] ; cddd
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m1, m3, m2
- pavgb m1, m0 ; ab, bc, cd, d [byte]
-
- punpcklbw m1, m2 ; ab, a2bc, bc, b2cd, cd, c3d, d, d
- movd [dstq ], m1
- psrlq m1, 16 ; bc, b2cd, cd, c3d, d, d
- movd [dstq+strideq], m1
- lea dstq, [dstq+strideq*2]
- psrlq m1, 16 ; cd, c3d, d, d
- movd [dstq ], m1
- pshufw m1, m1, q1111 ; d, d, d, d
- movd [dstq+strideq], m1
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d207_predictor_8x8, 4, 5, 4, dst, stride, stride3, left, goffset
- GET_GOT goffsetq
- movq m3, [leftq] ; abcdefgh [byte]
- lea stride3q, [strideq*3]
-
- pshufb m1, m3, [GLOBAL(sh_b2345677777777777)]
- pshufb m0, m3, [GLOBAL(sh_b0123456777777777)]
- pshufb m2, m3, [GLOBAL(sh_b1234567777777777)]
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m2, m1, m3
- pavgb m0, m2
- punpcklbw m0, m3 ; interleaved output
-
- movq [dstq ], m0
- psrldq m0, 2
- movq [dstq+strideq ], m0
- psrldq m0, 2
- movq [dstq+strideq*2], m0
- psrldq m0, 2
- movq [dstq+stride3q ], m0
- lea dstq, [dstq+strideq*4]
- pshufhw m0, m0, q0000 ; de, d2ef, ef, e2fg, fg, f2gh, gh, g3h, 8xh
- psrldq m0, 2
- movq [dstq ], m0
- psrldq m0, 2
- movq [dstq+strideq ], m0
- psrldq m0, 2
- movq [dstq+strideq*2], m0
- psrldq m0, 2
- movq [dstq+stride3q ], m0
- RESTORE_GOT
- RET
-
-INIT_XMM ssse3
-cglobal d207_predictor_16x16, 4, 5, 5, dst, stride, stride3, left, goffset
- GET_GOT goffsetq
- lea stride3q, [strideq*3]
- mova m0, [leftq] ; abcdefghijklmnop [byte]
- pshufb m1, m0, [GLOBAL(sh_b123456789abcdeff)] ; bcdefghijklmnopp
- pshufb m2, m0, [GLOBAL(sh_b23456789abcdefff)]
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m0, m1, m2, m3
- pavgb m1, m0 ; ab, bc, cd .. no, op, pp [byte]
-
- punpckhbw m4, m1, m3 ; interleaved input
- punpcklbw m1, m3 ; interleaved output
- mova [dstq ], m1
- palignr m3, m4, m1, 2
- mova [dstq+strideq ], m3
- palignr m3, m4, m1, 4
- mova [dstq+strideq*2], m3
- palignr m3, m4, m1, 6
- mova [dstq+stride3q ], m3
- lea dstq, [dstq+strideq*4]
- palignr m3, m4, m1, 8
- mova [dstq ], m3
- palignr m3, m4, m1, 10
- mova [dstq+strideq ], m3
- palignr m3, m4, m1, 12
- mova [dstq+strideq*2], m3
- palignr m3, m4, m1, 14
- mova [dstq+stride3q ], m3
- DEFINE_ARGS dst, stride, stride3, line
- mov lined, 2
- mova m0, [GLOBAL(sh_b23456789abcdefff)]
-.loop:
- lea dstq, [dstq+strideq*4]
- mova [dstq ], m4
- pshufb m4, m0
- mova [dstq+strideq ], m4
- pshufb m4, m0
- mova [dstq+strideq*2], m4
- pshufb m4, m0
- mova [dstq+stride3q ], m4
- pshufb m4, m0
- dec lined
- jnz .loop
- RESTORE_GOT
- REP_RET
-
-INIT_XMM ssse3
-cglobal d207_predictor_32x32, 4, 5, 8, dst, stride, stride3, left, goffset
- GET_GOT goffsetq
- lea stride3q, [strideq*3]
- mova m1, [leftq] ; 0-15 [byte]
- mova m2, [leftq+16] ; 16-31 [byte]
- pshufb m0, m2, [GLOBAL(sh_b23456789abcdefff)]
- pshufb m4, m2, [GLOBAL(sh_b123456789abcdeff)]
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m2, m4, m0, m3
- palignr m6, m2, m1, 1
- palignr m5, m2, m1, 2
- pavgb m2, m4 ; high 16px even lines
-
- X_PLUS_2Y_PLUS_Z_PLUS_2_RSH_2 m1, m6, m5, m0
- pavgb m1, m6 ; low 16px even lines
-
- punpckhbw m6, m1, m0 ; interleaved output 2
- punpcklbw m1, m0 ; interleaved output 1
-
- punpckhbw m7, m2, m3 ; interleaved output 4
- punpcklbw m2, m3 ; interleaved output 3
-
- ; output 1st 8 lines (and half of 2nd 8 lines)
- DEFINE_ARGS dst, stride, stride3, dst8
- lea dst8q, [dstq+strideq*8]
- mova [dstq ], m1
- mova [dstq +16], m6
- mova [dst8q ], m6
- palignr m0, m6, m1, 2
- palignr m4, m2, m6, 2
- mova [dstq +strideq ], m0
- mova [dstq +strideq +16], m4
- mova [dst8q+strideq ], m4
- palignr m0, m6, m1, 4
- palignr m4, m2, m6, 4
- mova [dstq +strideq*2 ], m0
- mova [dstq +strideq*2+16], m4
- mova [dst8q+strideq*2 ], m4
- palignr m0, m6, m1, 6
- palignr m4, m2, m6, 6
- mova [dstq +stride3q ], m0
- mova [dstq +stride3q +16], m4
- mova [dst8q+stride3q ], m4
- lea dstq, [dstq +strideq*4]
- lea dst8q, [dst8q+strideq*4]
- palignr m0, m6, m1, 8
- palignr m4, m2, m6, 8
- mova [dstq ], m0
- mova [dstq +16], m4
- mova [dst8q ], m4
- palignr m0, m6, m1, 10
- palignr m4, m2, m6, 10
- mova [dstq +strideq ], m0
- mova [dstq +strideq +16], m4
- mova [dst8q+strideq ], m4
- palignr m0, m6, m1, 12
- palignr m4, m2, m6, 12
- mova [dstq +strideq*2 ], m0
- mova [dstq +strideq*2+16], m4
- mova [dst8q+strideq*2 ], m4
- palignr m0, m6, m1, 14
- palignr m4, m2, m6, 14
- mova [dstq +stride3q ], m0
- mova [dstq +stride3q +16], m4
- mova [dst8q+stride3q ], m4
- lea dstq, [dstq+strideq*4]
- lea dst8q, [dst8q+strideq*4]
-
- ; output 2nd half of 2nd 8 lines and half of 3rd 8 lines
- mova [dstq +16], m2
- mova [dst8q ], m2
- palignr m4, m7, m2, 2
- mova [dstq +strideq +16], m4
- mova [dst8q+strideq ], m4
- palignr m4, m7, m2, 4
- mova [dstq +strideq*2+16], m4
- mova [dst8q+strideq*2 ], m4
- palignr m4, m7, m2, 6
- mova [dstq +stride3q +16], m4
- mova [dst8q+stride3q ], m4
- lea dstq, [dstq+strideq*4]
- lea dst8q, [dst8q+strideq*4]
- palignr m4, m7, m2, 8
- mova [dstq +16], m4
- mova [dst8q ], m4
- palignr m4, m7, m2, 10
- mova [dstq +strideq +16], m4
- mova [dst8q+strideq ], m4
- palignr m4, m7, m2, 12
- mova [dstq +strideq*2+16], m4
- mova [dst8q+strideq*2 ], m4
- palignr m4, m7, m2, 14
- mova [dstq +stride3q +16], m4
- mova [dst8q+stride3q ], m4
- lea dstq, [dstq+strideq*4]
- lea dst8q, [dst8q+strideq*4]
-
- ; output 2nd half of 3rd 8 lines and half of 4th 8 lines
- mova m0, [GLOBAL(sh_b23456789abcdefff)]
- mova [dstq +16], m7
- mova [dst8q ], m7
- pshufb m7, m0
- mova [dstq +strideq +16], m7
- mova [dst8q+strideq ], m7
- pshufb m7, m0
- mova [dstq +strideq*2+16], m7
- mova [dst8q+strideq*2 ], m7
- pshufb m7, m0
- mova [dstq +stride3q +16], m7
- mova [dst8q+stride3q ], m7
- pshufb m7, m0
- lea dstq, [dstq+strideq*4]
- lea dst8q, [dst8q+strideq*4]
- mova [dstq +16], m7
- mova [dst8q ], m7
- pshufb m7, m0
- mova [dstq +strideq +16], m7
- mova [dst8q+strideq ], m7
- pshufb m7, m0
- mova [dstq +strideq*2+16], m7
- mova [dst8q+strideq*2 ], m7
- pshufb m7, m0
- mova [dstq +stride3q +16], m7
- mova [dst8q+stride3q ], m7
- pshufb m7, m0
- lea dstq, [dstq+strideq*4]
-
- ; output last half of 4th 8 lines
- mova [dstq +16], m7
- mova [dstq +strideq +16], m7
- mova [dstq +strideq*2+16], m7
- mova [dstq +stride3q +16], m7
- lea dstq, [dstq+strideq*4]
- mova [dstq +16], m7
- mova [dstq +strideq +16], m7
- mova [dstq +strideq*2+16], m7
- mova [dstq +stride3q +16], m7
-
- ; done!
- RESTORE_GOT
- RET
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_avx2.c
deleted file mode 100644
index 439c028..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_avx2.c
+++ /dev/null
@@ -1,943 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <immintrin.h> /* AVX2 */
-
-static void mb_lpf_horizontal_edge_w_avx2_8(unsigned char *s, int p,
- const unsigned char *_blimit, const unsigned char *_limit,
- const unsigned char *_thresh) {
- __m128i mask, hev, flat, flat2;
- const __m128i zero = _mm_set1_epi16(0);
- const __m128i one = _mm_set1_epi8(1);
- __m128i q7p7, q6p6, q5p5, q4p4, q3p3, q2p2, q1p1, q0p0, p0q0, p1q1;
- __m128i abs_p1p0;
-
- const __m128i thresh = _mm_broadcastb_epi8(
- _mm_cvtsi32_si128((int) _thresh[0]));
- const __m128i limit = _mm_broadcastb_epi8(
- _mm_cvtsi32_si128((int) _limit[0]));
- const __m128i blimit = _mm_broadcastb_epi8(
- _mm_cvtsi32_si128((int) _blimit[0]));
-
- q4p4 = _mm_loadl_epi64((__m128i *) (s - 5 * p));
- q4p4 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q4p4), (__m64 *) (s + 4 * p)));
- q3p3 = _mm_loadl_epi64((__m128i *) (s - 4 * p));
- q3p3 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q3p3), (__m64 *) (s + 3 * p)));
- q2p2 = _mm_loadl_epi64((__m128i *) (s - 3 * p));
- q2p2 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q2p2), (__m64 *) (s + 2 * p)));
- q1p1 = _mm_loadl_epi64((__m128i *) (s - 2 * p));
- q1p1 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q1p1), (__m64 *) (s + 1 * p)));
- p1q1 = _mm_shuffle_epi32(q1p1, 78);
- q0p0 = _mm_loadl_epi64((__m128i *) (s - 1 * p));
- q0p0 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q0p0), (__m64 *) (s - 0 * p)));
- p0q0 = _mm_shuffle_epi32(q0p0, 78);
-
- {
- __m128i abs_p1q1, abs_p0q0, abs_q1q0, fe, ff, work;
- abs_p1p0 = _mm_or_si128(_mm_subs_epu8(q1p1, q0p0),
- _mm_subs_epu8(q0p0, q1p1));
- abs_q1q0 = _mm_srli_si128(abs_p1p0, 8);
- fe = _mm_set1_epi8(0xfe);
- ff = _mm_cmpeq_epi8(abs_p1p0, abs_p1p0);
- abs_p0q0 = _mm_or_si128(_mm_subs_epu8(q0p0, p0q0),
- _mm_subs_epu8(p0q0, q0p0));
- abs_p1q1 = _mm_or_si128(_mm_subs_epu8(q1p1, p1q1),
- _mm_subs_epu8(p1q1, q1p1));
- flat = _mm_max_epu8(abs_p1p0, abs_q1q0);
- hev = _mm_subs_epu8(flat, thresh);
- hev = _mm_xor_si128(_mm_cmpeq_epi8(hev, zero), ff);
-
- abs_p0q0 = _mm_adds_epu8(abs_p0q0, abs_p0q0);
- abs_p1q1 = _mm_srli_epi16(_mm_and_si128(abs_p1q1, fe), 1);
- mask = _mm_subs_epu8(_mm_adds_epu8(abs_p0q0, abs_p1q1), blimit);
- mask = _mm_xor_si128(_mm_cmpeq_epi8(mask, zero), ff);
- // mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = _mm_max_epu8(abs_p1p0, mask);
- // mask |= (abs(p1 - p0) > limit) * -1;
- // mask |= (abs(q1 - q0) > limit) * -1;
-
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(q2p2, q1p1),
- _mm_subs_epu8(q1p1, q2p2)),
- _mm_or_si128(_mm_subs_epu8(q3p3, q2p2),
- _mm_subs_epu8(q2p2, q3p3)));
- mask = _mm_max_epu8(work, mask);
- mask = _mm_max_epu8(mask, _mm_srli_si128(mask, 8));
- mask = _mm_subs_epu8(mask, limit);
- mask = _mm_cmpeq_epi8(mask, zero);
- }
-
- // lp filter
- {
- const __m128i t4 = _mm_set1_epi8(4);
- const __m128i t3 = _mm_set1_epi8(3);
- const __m128i t80 = _mm_set1_epi8(0x80);
- const __m128i t1 = _mm_set1_epi16(0x1);
- __m128i qs1ps1 = _mm_xor_si128(q1p1, t80);
- __m128i qs0ps0 = _mm_xor_si128(q0p0, t80);
- __m128i qs0 = _mm_xor_si128(p0q0, t80);
- __m128i qs1 = _mm_xor_si128(p1q1, t80);
- __m128i filt;
- __m128i work_a;
- __m128i filter1, filter2;
- __m128i flat2_q6p6, flat2_q5p5, flat2_q4p4, flat2_q3p3, flat2_q2p2;
- __m128i flat2_q1p1, flat2_q0p0, flat_q2p2, flat_q1p1, flat_q0p0;
-
- filt = _mm_and_si128(_mm_subs_epi8(qs1ps1, qs1), hev);
- work_a = _mm_subs_epi8(qs0, qs0ps0);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- /* (vp9_filter + 3 * (qs0 - ps0)) & mask */
- filt = _mm_and_si128(filt, mask);
-
- filter1 = _mm_adds_epi8(filt, t4);
- filter2 = _mm_adds_epi8(filt, t3);
-
- filter1 = _mm_unpacklo_epi8(zero, filter1);
- filter1 = _mm_srai_epi16(filter1, 0xB);
- filter2 = _mm_unpacklo_epi8(zero, filter2);
- filter2 = _mm_srai_epi16(filter2, 0xB);
-
- /* Filter1 >> 3 */
- filt = _mm_packs_epi16(filter2, _mm_subs_epi16(zero, filter1));
- qs0ps0 = _mm_xor_si128(_mm_adds_epi8(qs0ps0, filt), t80);
-
- /* filt >> 1 */
- filt = _mm_adds_epi16(filter1, t1);
- filt = _mm_srai_epi16(filt, 1);
- filt = _mm_andnot_si128(
- _mm_srai_epi16(_mm_unpacklo_epi8(zero, hev), 0x8), filt);
- filt = _mm_packs_epi16(filt, _mm_subs_epi16(zero, filt));
- qs1ps1 = _mm_xor_si128(_mm_adds_epi8(qs1ps1, filt), t80);
- // loopfilter done
-
- {
- __m128i work;
- flat = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(q2p2, q0p0),
- _mm_subs_epu8(q0p0, q2p2)),
- _mm_or_si128(_mm_subs_epu8(q3p3, q0p0),
- _mm_subs_epu8(q0p0, q3p3)));
- flat = _mm_max_epu8(abs_p1p0, flat);
- flat = _mm_max_epu8(flat, _mm_srli_si128(flat, 8));
- flat = _mm_subs_epu8(flat, one);
- flat = _mm_cmpeq_epi8(flat, zero);
- flat = _mm_and_si128(flat, mask);
-
- q5p5 = _mm_loadl_epi64((__m128i *) (s - 6 * p));
- q5p5 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q5p5),
- (__m64 *) (s + 5 * p)));
-
- q6p6 = _mm_loadl_epi64((__m128i *) (s - 7 * p));
- q6p6 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q6p6),
- (__m64 *) (s + 6 * p)));
-
- flat2 = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(q4p4, q0p0),
- _mm_subs_epu8(q0p0, q4p4)),
- _mm_or_si128(_mm_subs_epu8(q5p5, q0p0),
- _mm_subs_epu8(q0p0, q5p5)));
-
- q7p7 = _mm_loadl_epi64((__m128i *) (s - 8 * p));
- q7p7 = _mm_castps_si128(
- _mm_loadh_pi(_mm_castsi128_ps(q7p7),
- (__m64 *) (s + 7 * p)));
-
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(q6p6, q0p0),
- _mm_subs_epu8(q0p0, q6p6)),
- _mm_or_si128(_mm_subs_epu8(q7p7, q0p0),
- _mm_subs_epu8(q0p0, q7p7)));
-
- flat2 = _mm_max_epu8(work, flat2);
- flat2 = _mm_max_epu8(flat2, _mm_srli_si128(flat2, 8));
- flat2 = _mm_subs_epu8(flat2, one);
- flat2 = _mm_cmpeq_epi8(flat2, zero);
- flat2 = _mm_and_si128(flat2, flat); // flat2 & flat & mask
- }
-
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // flat and wide flat calculations
- {
- const __m128i eight = _mm_set1_epi16(8);
- const __m128i four = _mm_set1_epi16(4);
- __m128i p7_16, p6_16, p5_16, p4_16, p3_16, p2_16, p1_16, p0_16;
- __m128i q7_16, q6_16, q5_16, q4_16, q3_16, q2_16, q1_16, q0_16;
- __m128i pixelFilter_p, pixelFilter_q;
- __m128i pixetFilter_p2p1p0, pixetFilter_q2q1q0;
- __m128i sum_p7, sum_q7, sum_p3, sum_q3, res_p, res_q;
-
- p7_16 = _mm_unpacklo_epi8(q7p7, zero);
- p6_16 = _mm_unpacklo_epi8(q6p6, zero);
- p5_16 = _mm_unpacklo_epi8(q5p5, zero);
- p4_16 = _mm_unpacklo_epi8(q4p4, zero);
- p3_16 = _mm_unpacklo_epi8(q3p3, zero);
- p2_16 = _mm_unpacklo_epi8(q2p2, zero);
- p1_16 = _mm_unpacklo_epi8(q1p1, zero);
- p0_16 = _mm_unpacklo_epi8(q0p0, zero);
- q0_16 = _mm_unpackhi_epi8(q0p0, zero);
- q1_16 = _mm_unpackhi_epi8(q1p1, zero);
- q2_16 = _mm_unpackhi_epi8(q2p2, zero);
- q3_16 = _mm_unpackhi_epi8(q3p3, zero);
- q4_16 = _mm_unpackhi_epi8(q4p4, zero);
- q5_16 = _mm_unpackhi_epi8(q5p5, zero);
- q6_16 = _mm_unpackhi_epi8(q6p6, zero);
- q7_16 = _mm_unpackhi_epi8(q7p7, zero);
-
- pixelFilter_p = _mm_add_epi16(_mm_add_epi16(p6_16, p5_16),
- _mm_add_epi16(p4_16, p3_16));
- pixelFilter_q = _mm_add_epi16(_mm_add_epi16(q6_16, q5_16),
- _mm_add_epi16(q4_16, q3_16));
-
- pixetFilter_p2p1p0 = _mm_add_epi16(p0_16,
- _mm_add_epi16(p2_16, p1_16));
- pixelFilter_p = _mm_add_epi16(pixelFilter_p, pixetFilter_p2p1p0);
-
- pixetFilter_q2q1q0 = _mm_add_epi16(q0_16,
- _mm_add_epi16(q2_16, q1_16));
- pixelFilter_q = _mm_add_epi16(pixelFilter_q, pixetFilter_q2q1q0);
- pixelFilter_p = _mm_add_epi16(eight,
- _mm_add_epi16(pixelFilter_p, pixelFilter_q));
- pixetFilter_p2p1p0 = _mm_add_epi16(four,
- _mm_add_epi16(pixetFilter_p2p1p0, pixetFilter_q2q1q0));
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(p7_16, p0_16)),
- 4);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(q7_16, q0_16)),
- 4);
- flat2_q0p0 = _mm_packus_epi16(res_p, res_q);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(p3_16, p0_16)), 3);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(q3_16, q0_16)), 3);
-
- flat_q0p0 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(p7_16, p7_16);
- sum_q7 = _mm_add_epi16(q7_16, q7_16);
- sum_p3 = _mm_add_epi16(p3_16, p3_16);
- sum_q3 = _mm_add_epi16(q3_16, q3_16);
-
- pixelFilter_q = _mm_sub_epi16(pixelFilter_p, p6_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q6_16);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(sum_p7, p1_16)),
- 4);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_q, _mm_add_epi16(sum_q7, q1_16)),
- 4);
- flat2_q1p1 = _mm_packus_epi16(res_p, res_q);
-
- pixetFilter_q2q1q0 = _mm_sub_epi16(pixetFilter_p2p1p0, p2_16);
- pixetFilter_p2p1p0 = _mm_sub_epi16(pixetFilter_p2p1p0, q2_16);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(sum_p3, p1_16)), 3);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixetFilter_q2q1q0,
- _mm_add_epi16(sum_q3, q1_16)), 3);
- flat_q1p1 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- sum_p3 = _mm_add_epi16(sum_p3, p3_16);
- sum_q3 = _mm_add_epi16(sum_q3, q3_16);
-
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q5_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p5_16);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(sum_p7, p2_16)),
- 4);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_q, _mm_add_epi16(sum_q7, q2_16)),
- 4);
- flat2_q2p2 = _mm_packus_epi16(res_p, res_q);
-
- pixetFilter_p2p1p0 = _mm_sub_epi16(pixetFilter_p2p1p0, q1_16);
- pixetFilter_q2q1q0 = _mm_sub_epi16(pixetFilter_q2q1q0, p1_16);
-
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(sum_p3, p2_16)), 3);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixetFilter_q2q1q0,
- _mm_add_epi16(sum_q3, q2_16)), 3);
- flat_q2p2 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q4_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p4_16);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(sum_p7, p3_16)),
- 4);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_q, _mm_add_epi16(sum_q7, q3_16)),
- 4);
- flat2_q3p3 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q3_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p3_16);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(sum_p7, p4_16)),
- 4);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_q, _mm_add_epi16(sum_q7, q4_16)),
- 4);
- flat2_q4p4 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q2_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p2_16);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(sum_p7, p5_16)),
- 4);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_q, _mm_add_epi16(sum_q7, q5_16)),
- 4);
- flat2_q5p5 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q1_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p1_16);
- res_p = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_p, _mm_add_epi16(sum_p7, p6_16)),
- 4);
- res_q = _mm_srli_epi16(
- _mm_add_epi16(pixelFilter_q, _mm_add_epi16(sum_q7, q6_16)),
- 4);
- flat2_q6p6 = _mm_packus_epi16(res_p, res_q);
- }
- // wide flat
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- flat = _mm_shuffle_epi32(flat, 68);
- flat2 = _mm_shuffle_epi32(flat2, 68);
-
- q2p2 = _mm_andnot_si128(flat, q2p2);
- flat_q2p2 = _mm_and_si128(flat, flat_q2p2);
- q2p2 = _mm_or_si128(q2p2, flat_q2p2);
-
- qs1ps1 = _mm_andnot_si128(flat, qs1ps1);
- flat_q1p1 = _mm_and_si128(flat, flat_q1p1);
- q1p1 = _mm_or_si128(qs1ps1, flat_q1p1);
-
- qs0ps0 = _mm_andnot_si128(flat, qs0ps0);
- flat_q0p0 = _mm_and_si128(flat, flat_q0p0);
- q0p0 = _mm_or_si128(qs0ps0, flat_q0p0);
-
- q6p6 = _mm_andnot_si128(flat2, q6p6);
- flat2_q6p6 = _mm_and_si128(flat2, flat2_q6p6);
- q6p6 = _mm_or_si128(q6p6, flat2_q6p6);
- _mm_storel_epi64((__m128i *) (s - 7 * p), q6p6);
- _mm_storeh_pi((__m64 *) (s + 6 * p), _mm_castsi128_ps(q6p6));
-
- q5p5 = _mm_andnot_si128(flat2, q5p5);
- flat2_q5p5 = _mm_and_si128(flat2, flat2_q5p5);
- q5p5 = _mm_or_si128(q5p5, flat2_q5p5);
- _mm_storel_epi64((__m128i *) (s - 6 * p), q5p5);
- _mm_storeh_pi((__m64 *) (s + 5 * p), _mm_castsi128_ps(q5p5));
-
- q4p4 = _mm_andnot_si128(flat2, q4p4);
- flat2_q4p4 = _mm_and_si128(flat2, flat2_q4p4);
- q4p4 = _mm_or_si128(q4p4, flat2_q4p4);
- _mm_storel_epi64((__m128i *) (s - 5 * p), q4p4);
- _mm_storeh_pi((__m64 *) (s + 4 * p), _mm_castsi128_ps(q4p4));
-
- q3p3 = _mm_andnot_si128(flat2, q3p3);
- flat2_q3p3 = _mm_and_si128(flat2, flat2_q3p3);
- q3p3 = _mm_or_si128(q3p3, flat2_q3p3);
- _mm_storel_epi64((__m128i *) (s - 4 * p), q3p3);
- _mm_storeh_pi((__m64 *) (s + 3 * p), _mm_castsi128_ps(q3p3));
-
- q2p2 = _mm_andnot_si128(flat2, q2p2);
- flat2_q2p2 = _mm_and_si128(flat2, flat2_q2p2);
- q2p2 = _mm_or_si128(q2p2, flat2_q2p2);
- _mm_storel_epi64((__m128i *) (s - 3 * p), q2p2);
- _mm_storeh_pi((__m64 *) (s + 2 * p), _mm_castsi128_ps(q2p2));
-
- q1p1 = _mm_andnot_si128(flat2, q1p1);
- flat2_q1p1 = _mm_and_si128(flat2, flat2_q1p1);
- q1p1 = _mm_or_si128(q1p1, flat2_q1p1);
- _mm_storel_epi64((__m128i *) (s - 2 * p), q1p1);
- _mm_storeh_pi((__m64 *) (s + 1 * p), _mm_castsi128_ps(q1p1));
-
- q0p0 = _mm_andnot_si128(flat2, q0p0);
- flat2_q0p0 = _mm_and_si128(flat2, flat2_q0p0);
- q0p0 = _mm_or_si128(q0p0, flat2_q0p0);
- _mm_storel_epi64((__m128i *) (s - 1 * p), q0p0);
- _mm_storeh_pi((__m64 *) (s - 0 * p), _mm_castsi128_ps(q0p0));
- }
-}
-
-static void mb_lpf_horizontal_edge_w_avx2_16(unsigned char *s, int p,
- const unsigned char *_blimit, const unsigned char *_limit,
- const unsigned char *_thresh) {
- __m128i mask, hev, flat, flat2;
- const __m128i zero = _mm_set1_epi16(0);
- const __m128i one = _mm_set1_epi8(1);
- __m128i p7, p6, p5;
- __m128i p4, p3, p2, p1, p0, q0, q1, q2, q3, q4;
- __m128i q5, q6, q7;
-
- const __m128i thresh = _mm_broadcastb_epi8(
- _mm_cvtsi32_si128((int) _thresh[0]));
- const __m128i limit = _mm_broadcastb_epi8(
- _mm_cvtsi32_si128((int) _limit[0]));
- const __m128i blimit = _mm_broadcastb_epi8(
- _mm_cvtsi32_si128((int) _blimit[0]));
-
- p4 = _mm_loadu_si128((__m128i *) (s - 5 * p));
- p3 = _mm_loadu_si128((__m128i *) (s - 4 * p));
- p2 = _mm_loadu_si128((__m128i *) (s - 3 * p));
- p1 = _mm_loadu_si128((__m128i *) (s - 2 * p));
- p0 = _mm_loadu_si128((__m128i *) (s - 1 * p));
- q0 = _mm_loadu_si128((__m128i *) (s - 0 * p));
- q1 = _mm_loadu_si128((__m128i *) (s + 1 * p));
- q2 = _mm_loadu_si128((__m128i *) (s + 2 * p));
- q3 = _mm_loadu_si128((__m128i *) (s + 3 * p));
- q4 = _mm_loadu_si128((__m128i *) (s + 4 * p));
-
- {
- const __m128i abs_p1p0 = _mm_or_si128(_mm_subs_epu8(p1, p0),
- _mm_subs_epu8(p0, p1));
- const __m128i abs_q1q0 = _mm_or_si128(_mm_subs_epu8(q1, q0),
- _mm_subs_epu8(q0, q1));
- const __m128i fe = _mm_set1_epi8(0xfe);
- const __m128i ff = _mm_cmpeq_epi8(abs_p1p0, abs_p1p0);
- __m128i abs_p0q0 = _mm_or_si128(_mm_subs_epu8(p0, q0),
- _mm_subs_epu8(q0, p0));
- __m128i abs_p1q1 = _mm_or_si128(_mm_subs_epu8(p1, q1),
- _mm_subs_epu8(q1, p1));
- __m128i work;
- flat = _mm_max_epu8(abs_p1p0, abs_q1q0);
- hev = _mm_subs_epu8(flat, thresh);
- hev = _mm_xor_si128(_mm_cmpeq_epi8(hev, zero), ff);
-
- abs_p0q0 = _mm_adds_epu8(abs_p0q0, abs_p0q0);
- abs_p1q1 = _mm_srli_epi16(_mm_and_si128(abs_p1q1, fe), 1);
- mask = _mm_subs_epu8(_mm_adds_epu8(abs_p0q0, abs_p1q1), blimit);
- mask = _mm_xor_si128(_mm_cmpeq_epi8(mask, zero), ff);
- // mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = _mm_max_epu8(flat, mask);
- // mask |= (abs(p1 - p0) > limit) * -1;
- // mask |= (abs(q1 - q0) > limit) * -1;
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(p2, p1), _mm_subs_epu8(p1, p2)),
- _mm_or_si128(_mm_subs_epu8(p3, p2), _mm_subs_epu8(p2, p3)));
- mask = _mm_max_epu8(work, mask);
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(q2, q1), _mm_subs_epu8(q1, q2)),
- _mm_or_si128(_mm_subs_epu8(q3, q2), _mm_subs_epu8(q2, q3)));
- mask = _mm_max_epu8(work, mask);
- mask = _mm_subs_epu8(mask, limit);
- mask = _mm_cmpeq_epi8(mask, zero);
- }
-
- // lp filter
- {
- const __m128i t4 = _mm_set1_epi8(4);
- const __m128i t3 = _mm_set1_epi8(3);
- const __m128i t80 = _mm_set1_epi8(0x80);
- const __m128i te0 = _mm_set1_epi8(0xe0);
- const __m128i t1f = _mm_set1_epi8(0x1f);
- const __m128i t1 = _mm_set1_epi8(0x1);
- const __m128i t7f = _mm_set1_epi8(0x7f);
-
- __m128i ps1 = _mm_xor_si128(p1, t80);
- __m128i ps0 = _mm_xor_si128(p0, t80);
- __m128i qs0 = _mm_xor_si128(q0, t80);
- __m128i qs1 = _mm_xor_si128(q1, t80);
- __m128i filt;
- __m128i work_a;
- __m128i filter1, filter2;
- __m128i flat2_p6, flat2_p5, flat2_p4, flat2_p3, flat2_p2, flat2_p1,
- flat2_p0, flat2_q0, flat2_q1, flat2_q2, flat2_q3, flat2_q4,
- flat2_q5, flat2_q6, flat_p2, flat_p1, flat_p0, flat_q0, flat_q1,
- flat_q2;
-
- filt = _mm_and_si128(_mm_subs_epi8(ps1, qs1), hev);
- work_a = _mm_subs_epi8(qs0, ps0);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- /* (vp9_filter + 3 * (qs0 - ps0)) & mask */
- filt = _mm_and_si128(filt, mask);
-
- filter1 = _mm_adds_epi8(filt, t4);
- filter2 = _mm_adds_epi8(filt, t3);
-
- /* Filter1 >> 3 */
- work_a = _mm_cmpgt_epi8(zero, filter1);
- filter1 = _mm_srli_epi16(filter1, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter1 = _mm_and_si128(filter1, t1f);
- filter1 = _mm_or_si128(filter1, work_a);
- qs0 = _mm_xor_si128(_mm_subs_epi8(qs0, filter1), t80);
-
- /* Filter2 >> 3 */
- work_a = _mm_cmpgt_epi8(zero, filter2);
- filter2 = _mm_srli_epi16(filter2, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter2 = _mm_and_si128(filter2, t1f);
- filter2 = _mm_or_si128(filter2, work_a);
- ps0 = _mm_xor_si128(_mm_adds_epi8(ps0, filter2), t80);
-
- /* filt >> 1 */
- filt = _mm_adds_epi8(filter1, t1);
- work_a = _mm_cmpgt_epi8(zero, filt);
- filt = _mm_srli_epi16(filt, 1);
- work_a = _mm_and_si128(work_a, t80);
- filt = _mm_and_si128(filt, t7f);
- filt = _mm_or_si128(filt, work_a);
- filt = _mm_andnot_si128(hev, filt);
- ps1 = _mm_xor_si128(_mm_adds_epi8(ps1, filt), t80);
- qs1 = _mm_xor_si128(_mm_subs_epi8(qs1, filt), t80);
- // loopfilter done
-
- {
- __m128i work;
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(p2, p0), _mm_subs_epu8(p0, p2)),
- _mm_or_si128(_mm_subs_epu8(q2, q0), _mm_subs_epu8(q0, q2)));
- flat = _mm_max_epu8(work, flat);
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(p3, p0), _mm_subs_epu8(p0, p3)),
- _mm_or_si128(_mm_subs_epu8(q3, q0), _mm_subs_epu8(q0, q3)));
- flat = _mm_max_epu8(work, flat);
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(p4, p0), _mm_subs_epu8(p0, p4)),
- _mm_or_si128(_mm_subs_epu8(q4, q0), _mm_subs_epu8(q0, q4)));
- flat = _mm_subs_epu8(flat, one);
- flat = _mm_cmpeq_epi8(flat, zero);
- flat = _mm_and_si128(flat, mask);
-
- p5 = _mm_loadu_si128((__m128i *) (s - 6 * p));
- q5 = _mm_loadu_si128((__m128i *) (s + 5 * p));
- flat2 = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(p5, p0), _mm_subs_epu8(p0, p5)),
- _mm_or_si128(_mm_subs_epu8(q5, q0), _mm_subs_epu8(q0, q5)));
-
- flat2 = _mm_max_epu8(work, flat2);
- p6 = _mm_loadu_si128((__m128i *) (s - 7 * p));
- q6 = _mm_loadu_si128((__m128i *) (s + 6 * p));
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(p6, p0), _mm_subs_epu8(p0, p6)),
- _mm_or_si128(_mm_subs_epu8(q6, q0), _mm_subs_epu8(q0, q6)));
-
- flat2 = _mm_max_epu8(work, flat2);
-
- p7 = _mm_loadu_si128((__m128i *) (s - 8 * p));
- q7 = _mm_loadu_si128((__m128i *) (s + 7 * p));
- work = _mm_max_epu8(
- _mm_or_si128(_mm_subs_epu8(p7, p0), _mm_subs_epu8(p0, p7)),
- _mm_or_si128(_mm_subs_epu8(q7, q0), _mm_subs_epu8(q0, q7)));
-
- flat2 = _mm_max_epu8(work, flat2);
- flat2 = _mm_subs_epu8(flat2, one);
- flat2 = _mm_cmpeq_epi8(flat2, zero);
- flat2 = _mm_and_si128(flat2, flat); // flat2 & flat & mask
- }
-
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // flat and wide flat calculations
- {
- const __m256i eight = _mm256_set1_epi16(8);
- const __m256i four = _mm256_set1_epi16(4);
- __m256i p256_7, q256_7, p256_6, q256_6, p256_5, q256_5, p256_4,
- q256_4, p256_3, q256_3, p256_2, q256_2, p256_1, q256_1,
- p256_0, q256_0;
- __m256i pixelFilter_p, pixelFilter_q, pixetFilter_p2p1p0,
- pixetFilter_q2q1q0, sum_p7, sum_q7, sum_p3, sum_q3, res_p,
- res_q;
-
- p256_7 = _mm256_cvtepu8_epi16(p7);
- p256_6 = _mm256_cvtepu8_epi16(p6);
- p256_5 = _mm256_cvtepu8_epi16(p5);
- p256_4 = _mm256_cvtepu8_epi16(p4);
- p256_3 = _mm256_cvtepu8_epi16(p3);
- p256_2 = _mm256_cvtepu8_epi16(p2);
- p256_1 = _mm256_cvtepu8_epi16(p1);
- p256_0 = _mm256_cvtepu8_epi16(p0);
- q256_0 = _mm256_cvtepu8_epi16(q0);
- q256_1 = _mm256_cvtepu8_epi16(q1);
- q256_2 = _mm256_cvtepu8_epi16(q2);
- q256_3 = _mm256_cvtepu8_epi16(q3);
- q256_4 = _mm256_cvtepu8_epi16(q4);
- q256_5 = _mm256_cvtepu8_epi16(q5);
- q256_6 = _mm256_cvtepu8_epi16(q6);
- q256_7 = _mm256_cvtepu8_epi16(q7);
-
- pixelFilter_p = _mm256_add_epi16(_mm256_add_epi16(p256_6, p256_5),
- _mm256_add_epi16(p256_4, p256_3));
- pixelFilter_q = _mm256_add_epi16(_mm256_add_epi16(q256_6, q256_5),
- _mm256_add_epi16(q256_4, q256_3));
-
- pixetFilter_p2p1p0 = _mm256_add_epi16(p256_0,
- _mm256_add_epi16(p256_2, p256_1));
- pixelFilter_p = _mm256_add_epi16(pixelFilter_p, pixetFilter_p2p1p0);
-
- pixetFilter_q2q1q0 = _mm256_add_epi16(q256_0,
- _mm256_add_epi16(q256_2, q256_1));
- pixelFilter_q = _mm256_add_epi16(pixelFilter_q, pixetFilter_q2q1q0);
-
- pixelFilter_p = _mm256_add_epi16(eight,
- _mm256_add_epi16(pixelFilter_p, pixelFilter_q));
-
- pixetFilter_p2p1p0 = _mm256_add_epi16(four,
- _mm256_add_epi16(pixetFilter_p2p1p0, pixetFilter_q2q1q0));
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(p256_7, p256_0)), 4);
-
- flat2_p0 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(q256_7, q256_0)), 4);
-
- flat2_q0 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixetFilter_p2p1p0,
- _mm256_add_epi16(p256_3, p256_0)), 3);
-
- flat_p0 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixetFilter_p2p1p0,
- _mm256_add_epi16(q256_3, q256_0)), 3);
-
- flat_q0 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- sum_p7 = _mm256_add_epi16(p256_7, p256_7);
-
- sum_q7 = _mm256_add_epi16(q256_7, q256_7);
-
- sum_p3 = _mm256_add_epi16(p256_3, p256_3);
-
- sum_q3 = _mm256_add_epi16(q256_3, q256_3);
-
- pixelFilter_q = _mm256_sub_epi16(pixelFilter_p, p256_6);
-
- pixelFilter_p = _mm256_sub_epi16(pixelFilter_p, q256_6);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(sum_p7, p256_1)), 4);
-
- flat2_p1 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_q,
- _mm256_add_epi16(sum_q7, q256_1)), 4);
-
- flat2_q1 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- pixetFilter_q2q1q0 = _mm256_sub_epi16(pixetFilter_p2p1p0, p256_2);
-
- pixetFilter_p2p1p0 = _mm256_sub_epi16(pixetFilter_p2p1p0, q256_2);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixetFilter_p2p1p0,
- _mm256_add_epi16(sum_p3, p256_1)), 3);
-
- flat_p1 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixetFilter_q2q1q0,
- _mm256_add_epi16(sum_q3, q256_1)), 3);
-
- flat_q1 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- sum_p7 = _mm256_add_epi16(sum_p7, p256_7);
-
- sum_q7 = _mm256_add_epi16(sum_q7, q256_7);
-
- sum_p3 = _mm256_add_epi16(sum_p3, p256_3);
-
- sum_q3 = _mm256_add_epi16(sum_q3, q256_3);
-
- pixelFilter_p = _mm256_sub_epi16(pixelFilter_p, q256_5);
-
- pixelFilter_q = _mm256_sub_epi16(pixelFilter_q, p256_5);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(sum_p7, p256_2)), 4);
-
- flat2_p2 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_q,
- _mm256_add_epi16(sum_q7, q256_2)), 4);
-
- flat2_q2 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- pixetFilter_p2p1p0 = _mm256_sub_epi16(pixetFilter_p2p1p0, q256_1);
-
- pixetFilter_q2q1q0 = _mm256_sub_epi16(pixetFilter_q2q1q0, p256_1);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixetFilter_p2p1p0,
- _mm256_add_epi16(sum_p3, p256_2)), 3);
-
- flat_p2 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixetFilter_q2q1q0,
- _mm256_add_epi16(sum_q3, q256_2)), 3);
-
- flat_q2 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- sum_p7 = _mm256_add_epi16(sum_p7, p256_7);
-
- sum_q7 = _mm256_add_epi16(sum_q7, q256_7);
-
- pixelFilter_p = _mm256_sub_epi16(pixelFilter_p, q256_4);
-
- pixelFilter_q = _mm256_sub_epi16(pixelFilter_q, p256_4);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(sum_p7, p256_3)), 4);
-
- flat2_p3 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_q,
- _mm256_add_epi16(sum_q7, q256_3)), 4);
-
- flat2_q3 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- sum_p7 = _mm256_add_epi16(sum_p7, p256_7);
-
- sum_q7 = _mm256_add_epi16(sum_q7, q256_7);
-
- pixelFilter_p = _mm256_sub_epi16(pixelFilter_p, q256_3);
-
- pixelFilter_q = _mm256_sub_epi16(pixelFilter_q, p256_3);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(sum_p7, p256_4)), 4);
-
- flat2_p4 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_q,
- _mm256_add_epi16(sum_q7, q256_4)), 4);
-
- flat2_q4 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- sum_p7 = _mm256_add_epi16(sum_p7, p256_7);
-
- sum_q7 = _mm256_add_epi16(sum_q7, q256_7);
-
- pixelFilter_p = _mm256_sub_epi16(pixelFilter_p, q256_2);
-
- pixelFilter_q = _mm256_sub_epi16(pixelFilter_q, p256_2);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(sum_p7, p256_5)), 4);
-
- flat2_p5 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_q,
- _mm256_add_epi16(sum_q7, q256_5)), 4);
-
- flat2_q5 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
-
- sum_p7 = _mm256_add_epi16(sum_p7, p256_7);
-
- sum_q7 = _mm256_add_epi16(sum_q7, q256_7);
-
- pixelFilter_p = _mm256_sub_epi16(pixelFilter_p, q256_1);
-
- pixelFilter_q = _mm256_sub_epi16(pixelFilter_q, p256_1);
-
- res_p = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_p,
- _mm256_add_epi16(sum_p7, p256_6)), 4);
-
- flat2_p6 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_p, res_p),
- 168));
-
- res_q = _mm256_srli_epi16(
- _mm256_add_epi16(pixelFilter_q,
- _mm256_add_epi16(sum_q7, q256_6)), 4);
-
- flat2_q6 = _mm256_castsi256_si128(
- _mm256_permute4x64_epi64(_mm256_packus_epi16(res_q, res_q),
- 168));
- }
-
- // wide flat
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- p2 = _mm_andnot_si128(flat, p2);
- flat_p2 = _mm_and_si128(flat, flat_p2);
- p2 = _mm_or_si128(flat_p2, p2);
-
- p1 = _mm_andnot_si128(flat, ps1);
- flat_p1 = _mm_and_si128(flat, flat_p1);
- p1 = _mm_or_si128(flat_p1, p1);
-
- p0 = _mm_andnot_si128(flat, ps0);
- flat_p0 = _mm_and_si128(flat, flat_p0);
- p0 = _mm_or_si128(flat_p0, p0);
-
- q0 = _mm_andnot_si128(flat, qs0);
- flat_q0 = _mm_and_si128(flat, flat_q0);
- q0 = _mm_or_si128(flat_q0, q0);
-
- q1 = _mm_andnot_si128(flat, qs1);
- flat_q1 = _mm_and_si128(flat, flat_q1);
- q1 = _mm_or_si128(flat_q1, q1);
-
- q2 = _mm_andnot_si128(flat, q2);
- flat_q2 = _mm_and_si128(flat, flat_q2);
- q2 = _mm_or_si128(flat_q2, q2);
-
- p6 = _mm_andnot_si128(flat2, p6);
- flat2_p6 = _mm_and_si128(flat2, flat2_p6);
- p6 = _mm_or_si128(flat2_p6, p6);
- _mm_storeu_si128((__m128i *) (s - 7 * p), p6);
-
- p5 = _mm_andnot_si128(flat2, p5);
- flat2_p5 = _mm_and_si128(flat2, flat2_p5);
- p5 = _mm_or_si128(flat2_p5, p5);
- _mm_storeu_si128((__m128i *) (s - 6 * p), p5);
-
- p4 = _mm_andnot_si128(flat2, p4);
- flat2_p4 = _mm_and_si128(flat2, flat2_p4);
- p4 = _mm_or_si128(flat2_p4, p4);
- _mm_storeu_si128((__m128i *) (s - 5 * p), p4);
-
- p3 = _mm_andnot_si128(flat2, p3);
- flat2_p3 = _mm_and_si128(flat2, flat2_p3);
- p3 = _mm_or_si128(flat2_p3, p3);
- _mm_storeu_si128((__m128i *) (s - 4 * p), p3);
-
- p2 = _mm_andnot_si128(flat2, p2);
- flat2_p2 = _mm_and_si128(flat2, flat2_p2);
- p2 = _mm_or_si128(flat2_p2, p2);
- _mm_storeu_si128((__m128i *) (s - 3 * p), p2);
-
- p1 = _mm_andnot_si128(flat2, p1);
- flat2_p1 = _mm_and_si128(flat2, flat2_p1);
- p1 = _mm_or_si128(flat2_p1, p1);
- _mm_storeu_si128((__m128i *) (s - 2 * p), p1);
-
- p0 = _mm_andnot_si128(flat2, p0);
- flat2_p0 = _mm_and_si128(flat2, flat2_p0);
- p0 = _mm_or_si128(flat2_p0, p0);
- _mm_storeu_si128((__m128i *) (s - 1 * p), p0);
-
- q0 = _mm_andnot_si128(flat2, q0);
- flat2_q0 = _mm_and_si128(flat2, flat2_q0);
- q0 = _mm_or_si128(flat2_q0, q0);
- _mm_storeu_si128((__m128i *) (s - 0 * p), q0);
-
- q1 = _mm_andnot_si128(flat2, q1);
- flat2_q1 = _mm_and_si128(flat2, flat2_q1);
- q1 = _mm_or_si128(flat2_q1, q1);
- _mm_storeu_si128((__m128i *) (s + 1 * p), q1);
-
- q2 = _mm_andnot_si128(flat2, q2);
- flat2_q2 = _mm_and_si128(flat2, flat2_q2);
- q2 = _mm_or_si128(flat2_q2, q2);
- _mm_storeu_si128((__m128i *) (s + 2 * p), q2);
-
- q3 = _mm_andnot_si128(flat2, q3);
- flat2_q3 = _mm_and_si128(flat2, flat2_q3);
- q3 = _mm_or_si128(flat2_q3, q3);
- _mm_storeu_si128((__m128i *) (s + 3 * p), q3);
-
- q4 = _mm_andnot_si128(flat2, q4);
- flat2_q4 = _mm_and_si128(flat2, flat2_q4);
- q4 = _mm_or_si128(flat2_q4, q4);
- _mm_storeu_si128((__m128i *) (s + 4 * p), q4);
-
- q5 = _mm_andnot_si128(flat2, q5);
- flat2_q5 = _mm_and_si128(flat2, flat2_q5);
- q5 = _mm_or_si128(flat2_q5, q5);
- _mm_storeu_si128((__m128i *) (s + 5 * p), q5);
-
- q6 = _mm_andnot_si128(flat2, q6);
- flat2_q6 = _mm_and_si128(flat2, flat2_q6);
- q6 = _mm_or_si128(flat2_q6, q6);
- _mm_storeu_si128((__m128i *) (s + 6 * p), q6);
- }
-}
-
-void vp9_lpf_horizontal_16_avx2(unsigned char *s, int p,
- const unsigned char *_blimit, const unsigned char *_limit,
- const unsigned char *_thresh, int count) {
- if (count == 1)
- mb_lpf_horizontal_edge_w_avx2_8(s, p, _blimit, _limit, _thresh);
- else
- mb_lpf_horizontal_edge_w_avx2_16(s, p, _blimit, _limit, _thresh);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_sse2.c b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_sse2.c
deleted file mode 100644
index 448ad5a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_intrin_sse2.c
+++ /dev/null
@@ -1,1716 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <emmintrin.h> // SSE2
-#include "vp9/common/vp9_loopfilter.h"
-#include "vpx_ports/emmintrin_compat.h"
-
-static void mb_lpf_horizontal_edge_w_sse2_8(unsigned char *s,
- int p,
- const unsigned char *_blimit,
- const unsigned char *_limit,
- const unsigned char *_thresh) {
- const __m128i zero = _mm_set1_epi16(0);
- const __m128i one = _mm_set1_epi8(1);
- const __m128i blimit = _mm_load_si128((const __m128i *)_blimit);
- const __m128i limit = _mm_load_si128((const __m128i *)_limit);
- const __m128i thresh = _mm_load_si128((const __m128i *)_thresh);
- __m128i mask, hev, flat, flat2;
- __m128i q7p7, q6p6, q5p5, q4p4, q3p3, q2p2, q1p1, q0p0, p0q0, p1q1;
- __m128i abs_p1p0;
-
- q4p4 = _mm_loadl_epi64((__m128i *)(s - 5 * p));
- q4p4 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q4p4),
- (__m64 *)(s + 4 * p)));
- q3p3 = _mm_loadl_epi64((__m128i *)(s - 4 * p));
- q3p3 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q3p3),
- (__m64 *)(s + 3 * p)));
- q2p2 = _mm_loadl_epi64((__m128i *)(s - 3 * p));
- q2p2 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q2p2),
- (__m64 *)(s + 2 * p)));
- q1p1 = _mm_loadl_epi64((__m128i *)(s - 2 * p));
- q1p1 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q1p1),
- (__m64 *)(s + 1 * p)));
- p1q1 = _mm_shuffle_epi32(q1p1, 78);
- q0p0 = _mm_loadl_epi64((__m128i *)(s - 1 * p));
- q0p0 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q0p0),
- (__m64 *)(s - 0 * p)));
- p0q0 = _mm_shuffle_epi32(q0p0, 78);
-
- {
- __m128i abs_p1q1, abs_p0q0, abs_q1q0, fe, ff, work;
- abs_p1p0 = _mm_or_si128(_mm_subs_epu8(q1p1, q0p0),
- _mm_subs_epu8(q0p0, q1p1));
- abs_q1q0 = _mm_srli_si128(abs_p1p0, 8);
- fe = _mm_set1_epi8(0xfe);
- ff = _mm_cmpeq_epi8(abs_p1p0, abs_p1p0);
- abs_p0q0 = _mm_or_si128(_mm_subs_epu8(q0p0, p0q0),
- _mm_subs_epu8(p0q0, q0p0));
- abs_p1q1 = _mm_or_si128(_mm_subs_epu8(q1p1, p1q1),
- _mm_subs_epu8(p1q1, q1p1));
- flat = _mm_max_epu8(abs_p1p0, abs_q1q0);
- hev = _mm_subs_epu8(flat, thresh);
- hev = _mm_xor_si128(_mm_cmpeq_epi8(hev, zero), ff);
-
- abs_p0q0 =_mm_adds_epu8(abs_p0q0, abs_p0q0);
- abs_p1q1 = _mm_srli_epi16(_mm_and_si128(abs_p1q1, fe), 1);
- mask = _mm_subs_epu8(_mm_adds_epu8(abs_p0q0, abs_p1q1), blimit);
- mask = _mm_xor_si128(_mm_cmpeq_epi8(mask, zero), ff);
- // mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = _mm_max_epu8(abs_p1p0, mask);
- // mask |= (abs(p1 - p0) > limit) * -1;
- // mask |= (abs(q1 - q0) > limit) * -1;
-
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q2p2, q1p1),
- _mm_subs_epu8(q1p1, q2p2)),
- _mm_or_si128(_mm_subs_epu8(q3p3, q2p2),
- _mm_subs_epu8(q2p2, q3p3)));
- mask = _mm_max_epu8(work, mask);
- mask = _mm_max_epu8(mask, _mm_srli_si128(mask, 8));
- mask = _mm_subs_epu8(mask, limit);
- mask = _mm_cmpeq_epi8(mask, zero);
- }
-
- // lp filter
- {
- const __m128i t4 = _mm_set1_epi8(4);
- const __m128i t3 = _mm_set1_epi8(3);
- const __m128i t80 = _mm_set1_epi8(0x80);
- const __m128i t1 = _mm_set1_epi16(0x1);
- __m128i qs1ps1 = _mm_xor_si128(q1p1, t80);
- __m128i qs0ps0 = _mm_xor_si128(q0p0, t80);
- __m128i qs0 = _mm_xor_si128(p0q0, t80);
- __m128i qs1 = _mm_xor_si128(p1q1, t80);
- __m128i filt;
- __m128i work_a;
- __m128i filter1, filter2;
- __m128i flat2_q6p6, flat2_q5p5, flat2_q4p4, flat2_q3p3, flat2_q2p2;
- __m128i flat2_q1p1, flat2_q0p0, flat_q2p2, flat_q1p1, flat_q0p0;
-
- filt = _mm_and_si128(_mm_subs_epi8(qs1ps1, qs1), hev);
- work_a = _mm_subs_epi8(qs0, qs0ps0);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- // (vp9_filter + 3 * (qs0 - ps0)) & mask
- filt = _mm_and_si128(filt, mask);
-
- filter1 = _mm_adds_epi8(filt, t4);
- filter2 = _mm_adds_epi8(filt, t3);
-
- filter1 = _mm_unpacklo_epi8(zero, filter1);
- filter1 = _mm_srai_epi16(filter1, 0xB);
- filter2 = _mm_unpacklo_epi8(zero, filter2);
- filter2 = _mm_srai_epi16(filter2, 0xB);
-
- // Filter1 >> 3
- filt = _mm_packs_epi16(filter2, _mm_subs_epi16(zero, filter1));
- qs0ps0 = _mm_xor_si128(_mm_adds_epi8(qs0ps0, filt), t80);
-
- // filt >> 1
- filt = _mm_adds_epi16(filter1, t1);
- filt = _mm_srai_epi16(filt, 1);
- filt = _mm_andnot_si128(_mm_srai_epi16(_mm_unpacklo_epi8(zero, hev), 0x8),
- filt);
- filt = _mm_packs_epi16(filt, _mm_subs_epi16(zero, filt));
- qs1ps1 = _mm_xor_si128(_mm_adds_epi8(qs1ps1, filt), t80);
- // loopfilter done
-
- {
- __m128i work;
- flat = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q2p2, q0p0),
- _mm_subs_epu8(q0p0, q2p2)),
- _mm_or_si128(_mm_subs_epu8(q3p3, q0p0),
- _mm_subs_epu8(q0p0, q3p3)));
- flat = _mm_max_epu8(abs_p1p0, flat);
- flat = _mm_max_epu8(flat, _mm_srli_si128(flat, 8));
- flat = _mm_subs_epu8(flat, one);
- flat = _mm_cmpeq_epi8(flat, zero);
- flat = _mm_and_si128(flat, mask);
-
- q5p5 = _mm_loadl_epi64((__m128i *)(s - 6 * p));
- q5p5 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q5p5),
- (__m64 *)(s + 5 * p)));
-
- q6p6 = _mm_loadl_epi64((__m128i *)(s - 7 * p));
- q6p6 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q6p6),
- (__m64 *)(s + 6 * p)));
-
- flat2 = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q4p4, q0p0),
- _mm_subs_epu8(q0p0, q4p4)),
- _mm_or_si128(_mm_subs_epu8(q5p5, q0p0),
- _mm_subs_epu8(q0p0, q5p5)));
-
- q7p7 = _mm_loadl_epi64((__m128i *)(s - 8 * p));
- q7p7 = _mm_castps_si128(_mm_loadh_pi(_mm_castsi128_ps(q7p7),
- (__m64 *)(s + 7 * p)));
-
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q6p6, q0p0),
- _mm_subs_epu8(q0p0, q6p6)),
- _mm_or_si128(_mm_subs_epu8(q7p7, q0p0),
- _mm_subs_epu8(q0p0, q7p7)));
-
- flat2 = _mm_max_epu8(work, flat2);
- flat2 = _mm_max_epu8(flat2, _mm_srli_si128(flat2, 8));
- flat2 = _mm_subs_epu8(flat2, one);
- flat2 = _mm_cmpeq_epi8(flat2, zero);
- flat2 = _mm_and_si128(flat2, flat); // flat2 & flat & mask
- }
-
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // flat and wide flat calculations
- {
- const __m128i eight = _mm_set1_epi16(8);
- const __m128i four = _mm_set1_epi16(4);
- __m128i p7_16, p6_16, p5_16, p4_16, p3_16, p2_16, p1_16, p0_16;
- __m128i q7_16, q6_16, q5_16, q4_16, q3_16, q2_16, q1_16, q0_16;
- __m128i pixelFilter_p, pixelFilter_q;
- __m128i pixetFilter_p2p1p0, pixetFilter_q2q1q0;
- __m128i sum_p7, sum_q7, sum_p3, sum_q3, res_p, res_q;
-
- p7_16 = _mm_unpacklo_epi8(q7p7, zero);;
- p6_16 = _mm_unpacklo_epi8(q6p6, zero);
- p5_16 = _mm_unpacklo_epi8(q5p5, zero);
- p4_16 = _mm_unpacklo_epi8(q4p4, zero);
- p3_16 = _mm_unpacklo_epi8(q3p3, zero);
- p2_16 = _mm_unpacklo_epi8(q2p2, zero);
- p1_16 = _mm_unpacklo_epi8(q1p1, zero);
- p0_16 = _mm_unpacklo_epi8(q0p0, zero);
- q0_16 = _mm_unpackhi_epi8(q0p0, zero);
- q1_16 = _mm_unpackhi_epi8(q1p1, zero);
- q2_16 = _mm_unpackhi_epi8(q2p2, zero);
- q3_16 = _mm_unpackhi_epi8(q3p3, zero);
- q4_16 = _mm_unpackhi_epi8(q4p4, zero);
- q5_16 = _mm_unpackhi_epi8(q5p5, zero);
- q6_16 = _mm_unpackhi_epi8(q6p6, zero);
- q7_16 = _mm_unpackhi_epi8(q7p7, zero);
-
- pixelFilter_p = _mm_add_epi16(_mm_add_epi16(p6_16, p5_16),
- _mm_add_epi16(p4_16, p3_16));
- pixelFilter_q = _mm_add_epi16(_mm_add_epi16(q6_16, q5_16),
- _mm_add_epi16(q4_16, q3_16));
-
- pixetFilter_p2p1p0 = _mm_add_epi16(p0_16, _mm_add_epi16(p2_16, p1_16));
- pixelFilter_p = _mm_add_epi16(pixelFilter_p, pixetFilter_p2p1p0);
-
- pixetFilter_q2q1q0 = _mm_add_epi16(q0_16, _mm_add_epi16(q2_16, q1_16));
- pixelFilter_q = _mm_add_epi16(pixelFilter_q, pixetFilter_q2q1q0);
- pixelFilter_p = _mm_add_epi16(eight, _mm_add_epi16(pixelFilter_p,
- pixelFilter_q));
- pixetFilter_p2p1p0 = _mm_add_epi16(four,
- _mm_add_epi16(pixetFilter_p2p1p0,
- pixetFilter_q2q1q0));
- res_p = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(p7_16, p0_16)), 4);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(q7_16, q0_16)), 4);
- flat2_q0p0 = _mm_packus_epi16(res_p, res_q);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(p3_16, p0_16)), 3);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(q3_16, q0_16)), 3);
-
- flat_q0p0 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(p7_16, p7_16);
- sum_q7 = _mm_add_epi16(q7_16, q7_16);
- sum_p3 = _mm_add_epi16(p3_16, p3_16);
- sum_q3 = _mm_add_epi16(q3_16, q3_16);
-
- pixelFilter_q = _mm_sub_epi16(pixelFilter_p, p6_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q6_16);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(sum_p7, p1_16)), 4);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixelFilter_q,
- _mm_add_epi16(sum_q7, q1_16)), 4);
- flat2_q1p1 = _mm_packus_epi16(res_p, res_q);
-
- pixetFilter_q2q1q0 = _mm_sub_epi16(pixetFilter_p2p1p0, p2_16);
- pixetFilter_p2p1p0 = _mm_sub_epi16(pixetFilter_p2p1p0, q2_16);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(sum_p3, p1_16)), 3);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixetFilter_q2q1q0,
- _mm_add_epi16(sum_q3, q1_16)), 3);
- flat_q1p1 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- sum_p3 = _mm_add_epi16(sum_p3, p3_16);
- sum_q3 = _mm_add_epi16(sum_q3, q3_16);
-
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q5_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p5_16);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(sum_p7, p2_16)), 4);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixelFilter_q,
- _mm_add_epi16(sum_q7, q2_16)), 4);
- flat2_q2p2 = _mm_packus_epi16(res_p, res_q);
-
- pixetFilter_p2p1p0 = _mm_sub_epi16(pixetFilter_p2p1p0, q1_16);
- pixetFilter_q2q1q0 = _mm_sub_epi16(pixetFilter_q2q1q0, p1_16);
-
- res_p = _mm_srli_epi16(_mm_add_epi16(pixetFilter_p2p1p0,
- _mm_add_epi16(sum_p3, p2_16)), 3);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixetFilter_q2q1q0,
- _mm_add_epi16(sum_q3, q2_16)), 3);
- flat_q2p2 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q4_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p4_16);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(sum_p7, p3_16)), 4);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixelFilter_q,
- _mm_add_epi16(sum_q7, q3_16)), 4);
- flat2_q3p3 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q3_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p3_16);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(sum_p7, p4_16)), 4);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixelFilter_q,
- _mm_add_epi16(sum_q7, q4_16)), 4);
- flat2_q4p4 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q2_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p2_16);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(sum_p7, p5_16)), 4);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixelFilter_q,
- _mm_add_epi16(sum_q7, q5_16)), 4);
- flat2_q5p5 = _mm_packus_epi16(res_p, res_q);
-
- sum_p7 = _mm_add_epi16(sum_p7, p7_16);
- sum_q7 = _mm_add_epi16(sum_q7, q7_16);
- pixelFilter_p = _mm_sub_epi16(pixelFilter_p, q1_16);
- pixelFilter_q = _mm_sub_epi16(pixelFilter_q, p1_16);
- res_p = _mm_srli_epi16(_mm_add_epi16(pixelFilter_p,
- _mm_add_epi16(sum_p7, p6_16)), 4);
- res_q = _mm_srli_epi16(_mm_add_epi16(pixelFilter_q,
- _mm_add_epi16(sum_q7, q6_16)), 4);
- flat2_q6p6 = _mm_packus_epi16(res_p, res_q);
- }
- // wide flat
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- flat = _mm_shuffle_epi32(flat, 68);
- flat2 = _mm_shuffle_epi32(flat2, 68);
-
- q2p2 = _mm_andnot_si128(flat, q2p2);
- flat_q2p2 = _mm_and_si128(flat, flat_q2p2);
- q2p2 = _mm_or_si128(q2p2, flat_q2p2);
-
- qs1ps1 = _mm_andnot_si128(flat, qs1ps1);
- flat_q1p1 = _mm_and_si128(flat, flat_q1p1);
- q1p1 = _mm_or_si128(qs1ps1, flat_q1p1);
-
- qs0ps0 = _mm_andnot_si128(flat, qs0ps0);
- flat_q0p0 = _mm_and_si128(flat, flat_q0p0);
- q0p0 = _mm_or_si128(qs0ps0, flat_q0p0);
-
- q6p6 = _mm_andnot_si128(flat2, q6p6);
- flat2_q6p6 = _mm_and_si128(flat2, flat2_q6p6);
- q6p6 = _mm_or_si128(q6p6, flat2_q6p6);
- _mm_storel_epi64((__m128i *)(s - 7 * p), q6p6);
- _mm_storeh_pi((__m64 *)(s + 6 * p), _mm_castsi128_ps(q6p6));
-
- q5p5 = _mm_andnot_si128(flat2, q5p5);
- flat2_q5p5 = _mm_and_si128(flat2, flat2_q5p5);
- q5p5 = _mm_or_si128(q5p5, flat2_q5p5);
- _mm_storel_epi64((__m128i *)(s - 6 * p), q5p5);
- _mm_storeh_pi((__m64 *)(s + 5 * p), _mm_castsi128_ps(q5p5));
-
- q4p4 = _mm_andnot_si128(flat2, q4p4);
- flat2_q4p4 = _mm_and_si128(flat2, flat2_q4p4);
- q4p4 = _mm_or_si128(q4p4, flat2_q4p4);
- _mm_storel_epi64((__m128i *)(s - 5 * p), q4p4);
- _mm_storeh_pi((__m64 *)(s + 4 * p), _mm_castsi128_ps(q4p4));
-
- q3p3 = _mm_andnot_si128(flat2, q3p3);
- flat2_q3p3 = _mm_and_si128(flat2, flat2_q3p3);
- q3p3 = _mm_or_si128(q3p3, flat2_q3p3);
- _mm_storel_epi64((__m128i *)(s - 4 * p), q3p3);
- _mm_storeh_pi((__m64 *)(s + 3 * p), _mm_castsi128_ps(q3p3));
-
- q2p2 = _mm_andnot_si128(flat2, q2p2);
- flat2_q2p2 = _mm_and_si128(flat2, flat2_q2p2);
- q2p2 = _mm_or_si128(q2p2, flat2_q2p2);
- _mm_storel_epi64((__m128i *)(s - 3 * p), q2p2);
- _mm_storeh_pi((__m64 *)(s + 2 * p), _mm_castsi128_ps(q2p2));
-
- q1p1 = _mm_andnot_si128(flat2, q1p1);
- flat2_q1p1 = _mm_and_si128(flat2, flat2_q1p1);
- q1p1 = _mm_or_si128(q1p1, flat2_q1p1);
- _mm_storel_epi64((__m128i *)(s - 2 * p), q1p1);
- _mm_storeh_pi((__m64 *)(s + 1 * p), _mm_castsi128_ps(q1p1));
-
- q0p0 = _mm_andnot_si128(flat2, q0p0);
- flat2_q0p0 = _mm_and_si128(flat2, flat2_q0p0);
- q0p0 = _mm_or_si128(q0p0, flat2_q0p0);
- _mm_storel_epi64((__m128i *)(s - 1 * p), q0p0);
- _mm_storeh_pi((__m64 *)(s - 0 * p), _mm_castsi128_ps(q0p0));
- }
-}
-
-static void mb_lpf_horizontal_edge_w_sse2_16(unsigned char *s,
- int p,
- const unsigned char *_blimit,
- const unsigned char *_limit,
- const unsigned char *_thresh) {
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat2_op, 7 * 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat2_oq, 7 * 16);
-
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_op, 3 * 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_oq, 3 * 16);
-
- DECLARE_ALIGNED_ARRAY(16, unsigned char, ap, 8 * 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, aq, 8 * 16);
-
- const __m128i zero = _mm_set1_epi16(0);
- const __m128i one = _mm_set1_epi8(1);
- const __m128i blimit = _mm_load_si128((const __m128i *)_blimit);
- const __m128i limit = _mm_load_si128((const __m128i *)_limit);
- const __m128i thresh = _mm_load_si128((const __m128i *)_thresh);
- __m128i mask, hev, flat, flat2;
- __m128i p7, p6, p5;
- __m128i p4, p3, p2, p1, p0, q0, q1, q2, q3, q4;
- __m128i q5, q6, q7;
- int i = 0;
-
- p4 = _mm_loadu_si128((__m128i *)(s - 5 * p));
- p3 = _mm_loadu_si128((__m128i *)(s - 4 * p));
- p2 = _mm_loadu_si128((__m128i *)(s - 3 * p));
- p1 = _mm_loadu_si128((__m128i *)(s - 2 * p));
- p0 = _mm_loadu_si128((__m128i *)(s - 1 * p));
- q0 = _mm_loadu_si128((__m128i *)(s - 0 * p));
- q1 = _mm_loadu_si128((__m128i *)(s + 1 * p));
- q2 = _mm_loadu_si128((__m128i *)(s + 2 * p));
- q3 = _mm_loadu_si128((__m128i *)(s + 3 * p));
- q4 = _mm_loadu_si128((__m128i *)(s + 4 * p));
-
- _mm_store_si128((__m128i *)&ap[4 * 16], p4);
- _mm_store_si128((__m128i *)&ap[3 * 16], p3);
- _mm_store_si128((__m128i *)&ap[2 * 16], p2);
- _mm_store_si128((__m128i *)&ap[1 * 16], p1);
- _mm_store_si128((__m128i *)&ap[0 * 16], p0);
- _mm_store_si128((__m128i *)&aq[4 * 16], q4);
- _mm_store_si128((__m128i *)&aq[3 * 16], q3);
- _mm_store_si128((__m128i *)&aq[2 * 16], q2);
- _mm_store_si128((__m128i *)&aq[1 * 16], q1);
- _mm_store_si128((__m128i *)&aq[0 * 16], q0);
-
-
- {
- const __m128i abs_p1p0 = _mm_or_si128(_mm_subs_epu8(p1, p0),
- _mm_subs_epu8(p0, p1));
- const __m128i abs_q1q0 = _mm_or_si128(_mm_subs_epu8(q1, q0),
- _mm_subs_epu8(q0, q1));
- const __m128i fe = _mm_set1_epi8(0xfe);
- const __m128i ff = _mm_cmpeq_epi8(abs_p1p0, abs_p1p0);
- __m128i abs_p0q0 = _mm_or_si128(_mm_subs_epu8(p0, q0),
- _mm_subs_epu8(q0, p0));
- __m128i abs_p1q1 = _mm_or_si128(_mm_subs_epu8(p1, q1),
- _mm_subs_epu8(q1, p1));
- __m128i work;
- flat = _mm_max_epu8(abs_p1p0, abs_q1q0);
- hev = _mm_subs_epu8(flat, thresh);
- hev = _mm_xor_si128(_mm_cmpeq_epi8(hev, zero), ff);
-
- abs_p0q0 =_mm_adds_epu8(abs_p0q0, abs_p0q0);
- abs_p1q1 = _mm_srli_epi16(_mm_and_si128(abs_p1q1, fe), 1);
- mask = _mm_subs_epu8(_mm_adds_epu8(abs_p0q0, abs_p1q1), blimit);
- mask = _mm_xor_si128(_mm_cmpeq_epi8(mask, zero), ff);
- // mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = _mm_max_epu8(flat, mask);
- // mask |= (abs(p1 - p0) > limit) * -1;
- // mask |= (abs(q1 - q0) > limit) * -1;
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p2, p1),
- _mm_subs_epu8(p1, p2)),
- _mm_or_si128(_mm_subs_epu8(p3, p2),
- _mm_subs_epu8(p2, p3)));
- mask = _mm_max_epu8(work, mask);
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q2, q1),
- _mm_subs_epu8(q1, q2)),
- _mm_or_si128(_mm_subs_epu8(q3, q2),
- _mm_subs_epu8(q2, q3)));
- mask = _mm_max_epu8(work, mask);
- mask = _mm_subs_epu8(mask, limit);
- mask = _mm_cmpeq_epi8(mask, zero);
- }
-
- // lp filter
- {
- const __m128i t4 = _mm_set1_epi8(4);
- const __m128i t3 = _mm_set1_epi8(3);
- const __m128i t80 = _mm_set1_epi8(0x80);
- const __m128i te0 = _mm_set1_epi8(0xe0);
- const __m128i t1f = _mm_set1_epi8(0x1f);
- const __m128i t1 = _mm_set1_epi8(0x1);
- const __m128i t7f = _mm_set1_epi8(0x7f);
-
- __m128i ps1 = _mm_xor_si128(p1, t80);
- __m128i ps0 = _mm_xor_si128(p0, t80);
- __m128i qs0 = _mm_xor_si128(q0, t80);
- __m128i qs1 = _mm_xor_si128(q1, t80);
- __m128i filt;
- __m128i work_a;
- __m128i filter1, filter2;
-
- filt = _mm_and_si128(_mm_subs_epi8(ps1, qs1), hev);
- work_a = _mm_subs_epi8(qs0, ps0);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- // (vp9_filter + 3 * (qs0 - ps0)) & mask
- filt = _mm_and_si128(filt, mask);
-
- filter1 = _mm_adds_epi8(filt, t4);
- filter2 = _mm_adds_epi8(filt, t3);
-
- // Filter1 >> 3
- work_a = _mm_cmpgt_epi8(zero, filter1);
- filter1 = _mm_srli_epi16(filter1, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter1 = _mm_and_si128(filter1, t1f);
- filter1 = _mm_or_si128(filter1, work_a);
- qs0 = _mm_xor_si128(_mm_subs_epi8(qs0, filter1), t80);
-
- // Filter2 >> 3
- work_a = _mm_cmpgt_epi8(zero, filter2);
- filter2 = _mm_srli_epi16(filter2, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter2 = _mm_and_si128(filter2, t1f);
- filter2 = _mm_or_si128(filter2, work_a);
- ps0 = _mm_xor_si128(_mm_adds_epi8(ps0, filter2), t80);
-
- // filt >> 1
- filt = _mm_adds_epi8(filter1, t1);
- work_a = _mm_cmpgt_epi8(zero, filt);
- filt = _mm_srli_epi16(filt, 1);
- work_a = _mm_and_si128(work_a, t80);
- filt = _mm_and_si128(filt, t7f);
- filt = _mm_or_si128(filt, work_a);
- filt = _mm_andnot_si128(hev, filt);
- ps1 = _mm_xor_si128(_mm_adds_epi8(ps1, filt), t80);
- qs1 = _mm_xor_si128(_mm_subs_epi8(qs1, filt), t80);
- // loopfilter done
-
- {
- __m128i work;
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p2, p0),
- _mm_subs_epu8(p0, p2)),
- _mm_or_si128(_mm_subs_epu8(q2, q0),
- _mm_subs_epu8(q0, q2)));
- flat = _mm_max_epu8(work, flat);
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p3, p0),
- _mm_subs_epu8(p0, p3)),
- _mm_or_si128(_mm_subs_epu8(q3, q0),
- _mm_subs_epu8(q0, q3)));
- flat = _mm_max_epu8(work, flat);
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p4, p0),
- _mm_subs_epu8(p0, p4)),
- _mm_or_si128(_mm_subs_epu8(q4, q0),
- _mm_subs_epu8(q0, q4)));
- flat = _mm_subs_epu8(flat, one);
- flat = _mm_cmpeq_epi8(flat, zero);
- flat = _mm_and_si128(flat, mask);
-
- p5 = _mm_loadu_si128((__m128i *)(s - 6 * p));
- q5 = _mm_loadu_si128((__m128i *)(s + 5 * p));
- flat2 = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p5, p0),
- _mm_subs_epu8(p0, p5)),
- _mm_or_si128(_mm_subs_epu8(q5, q0),
- _mm_subs_epu8(q0, q5)));
- _mm_store_si128((__m128i *)&ap[5 * 16], p5);
- _mm_store_si128((__m128i *)&aq[5 * 16], q5);
- flat2 = _mm_max_epu8(work, flat2);
- p6 = _mm_loadu_si128((__m128i *)(s - 7 * p));
- q6 = _mm_loadu_si128((__m128i *)(s + 6 * p));
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p6, p0),
- _mm_subs_epu8(p0, p6)),
- _mm_or_si128(_mm_subs_epu8(q6, q0),
- _mm_subs_epu8(q0, q6)));
- _mm_store_si128((__m128i *)&ap[6 * 16], p6);
- _mm_store_si128((__m128i *)&aq[6 * 16], q6);
- flat2 = _mm_max_epu8(work, flat2);
-
- p7 = _mm_loadu_si128((__m128i *)(s - 8 * p));
- q7 = _mm_loadu_si128((__m128i *)(s + 7 * p));
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p7, p0),
- _mm_subs_epu8(p0, p7)),
- _mm_or_si128(_mm_subs_epu8(q7, q0),
- _mm_subs_epu8(q0, q7)));
- _mm_store_si128((__m128i *)&ap[7 * 16], p7);
- _mm_store_si128((__m128i *)&aq[7 * 16], q7);
- flat2 = _mm_max_epu8(work, flat2);
- flat2 = _mm_subs_epu8(flat2, one);
- flat2 = _mm_cmpeq_epi8(flat2, zero);
- flat2 = _mm_and_si128(flat2, flat); // flat2 & flat & mask
- }
-
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // flat and wide flat calculations
- {
- const __m128i eight = _mm_set1_epi16(8);
- const __m128i four = _mm_set1_epi16(4);
- __m128i temp_flat2 = flat2;
- unsigned char *src = s;
- int i = 0;
- do {
- __m128i workp_shft;
- __m128i a, b, c;
-
- unsigned int off = i * 8;
- p7 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[7 * 16] + off)),
- zero);
- p6 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[6 * 16] + off)),
- zero);
- p5 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[5 * 16] + off)),
- zero);
- p4 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[4 * 16] + off)),
- zero);
- p3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[3 * 16] + off)),
- zero);
- p2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[2 * 16] + off)),
- zero);
- p1 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[1 * 16] + off)),
- zero);
- p0 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&ap[0 * 16] + off)),
- zero);
- q0 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[0 * 16] + off)),
- zero);
- q1 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[1 * 16] + off)),
- zero);
- q2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[2 * 16] + off)),
- zero);
- q3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[3 * 16] + off)),
- zero);
- q4 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[4 * 16] + off)),
- zero);
- q5 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[5 * 16] + off)),
- zero);
- q6 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[6 * 16] + off)),
- zero);
- q7 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(&aq[7 * 16] + off)),
- zero);
-
- c = _mm_sub_epi16(_mm_slli_epi16(p7, 3), p7); // p7 * 7
- c = _mm_add_epi16(_mm_slli_epi16(p6, 1), _mm_add_epi16(p4, c));
-
- b = _mm_add_epi16(_mm_add_epi16(p3, four), _mm_add_epi16(p3, p2));
- a = _mm_add_epi16(p3, _mm_add_epi16(p2, p1));
- a = _mm_add_epi16(_mm_add_epi16(p0, q0), a);
-
- _mm_storel_epi64((__m128i *)&flat_op[2 * 16 + i * 8],
- _mm_packus_epi16(_mm_srli_epi16(_mm_add_epi16(a, b), 3)
- , b));
-
- c = _mm_add_epi16(_mm_add_epi16(p5, eight), c);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_op[6 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q1, a);
- b = _mm_add_epi16(_mm_sub_epi16(b, _mm_add_epi16(p3, p2)), p1);
- _mm_storel_epi64((__m128i *)&flat_op[1 * 16 + i * 8],
- _mm_packus_epi16(_mm_srli_epi16(_mm_add_epi16(a, b), 3)
- , b));
-
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p7, p6)), p5);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_op[5 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q2, a);
- b = _mm_add_epi16(_mm_sub_epi16(b, _mm_add_epi16(p3, p1)), p0);
- _mm_storel_epi64((__m128i *)&flat_op[i * 8],
- _mm_packus_epi16(_mm_srli_epi16(_mm_add_epi16(a, b), 3)
- , b));
-
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p7, p5)), p4);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_op[4 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q3, a);
- b = _mm_add_epi16(_mm_sub_epi16(b, _mm_add_epi16(p3, p0)), q0);
- _mm_storel_epi64((__m128i *)&flat_oq[i * 8],
- _mm_packus_epi16(_mm_srli_epi16(_mm_add_epi16(a, b), 3)
- , b));
-
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p7, p4)), p3);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_op[3 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- b = _mm_add_epi16(q3, b);
- b = _mm_add_epi16(_mm_sub_epi16(b, _mm_add_epi16(p2, q0)), q1);
- _mm_storel_epi64((__m128i *)&flat_oq[16 + i * 8],
- _mm_packus_epi16(_mm_srli_epi16(_mm_add_epi16(a, b), 3)
- , b));
-
- c = _mm_add_epi16(q4, c);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p7, p3)), p2);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_op[2 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- b = _mm_add_epi16(q3, b);
- b = _mm_add_epi16(_mm_sub_epi16(b, _mm_add_epi16(p1, q1)), q2);
- _mm_storel_epi64((__m128i *)&flat_oq[2 * 16 + i * 8],
- _mm_packus_epi16(_mm_srli_epi16(_mm_add_epi16(a, b), 3)
- , b));
- a = _mm_add_epi16(q5, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p7, p2)), p1);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_op[16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q6, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p7, p1)), p0);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_op[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q7, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p7, p0)), q0);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_oq[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q7, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p6, q0)), q1);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_oq[16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q7, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p5, q1)), q2);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_oq[2 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q7, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p4, q2)), q3);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_oq[3 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q7, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p3, q3)), q4);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_oq[4 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q7, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p2, q4)), q5);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_oq[5 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- a = _mm_add_epi16(q7, a);
- c = _mm_add_epi16(_mm_sub_epi16(c, _mm_add_epi16(p1, q5)), q6);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(a, c), 4);
- _mm_storel_epi64((__m128i *)&flat2_oq[6 * 16 + i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- temp_flat2 = _mm_srli_si128(temp_flat2, 8);
- src += 8;
- } while (++i < 2);
- }
- // wide flat
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- work_a = _mm_load_si128((__m128i *)&ap[2 * 16]);
- p2 = _mm_load_si128((__m128i *)&flat_op[2 * 16]);
- work_a = _mm_andnot_si128(flat, work_a);
- p2 = _mm_and_si128(flat, p2);
- p2 = _mm_or_si128(work_a, p2);
- _mm_store_si128((__m128i *)&flat_op[2 * 16], p2);
-
- p1 = _mm_load_si128((__m128i *)&flat_op[1 * 16]);
- work_a = _mm_andnot_si128(flat, ps1);
- p1 = _mm_and_si128(flat, p1);
- p1 = _mm_or_si128(work_a, p1);
- _mm_store_si128((__m128i *)&flat_op[1 * 16], p1);
-
- p0 = _mm_load_si128((__m128i *)&flat_op[0]);
- work_a = _mm_andnot_si128(flat, ps0);
- p0 = _mm_and_si128(flat, p0);
- p0 = _mm_or_si128(work_a, p0);
- _mm_store_si128((__m128i *)&flat_op[0], p0);
-
- q0 = _mm_load_si128((__m128i *)&flat_oq[0]);
- work_a = _mm_andnot_si128(flat, qs0);
- q0 = _mm_and_si128(flat, q0);
- q0 = _mm_or_si128(work_a, q0);
- _mm_store_si128((__m128i *)&flat_oq[0], q0);
-
- q1 = _mm_load_si128((__m128i *)&flat_oq[1 * 16]);
- work_a = _mm_andnot_si128(flat, qs1);
- q1 = _mm_and_si128(flat, q1);
- q1 = _mm_or_si128(work_a, q1);
- _mm_store_si128((__m128i *)&flat_oq[1 * 16], q1);
-
- work_a = _mm_load_si128((__m128i *)&aq[2 * 16]);
- q2 = _mm_load_si128((__m128i *)&flat_oq[2 * 16]);
- work_a = _mm_andnot_si128(flat, work_a);
- q2 = _mm_and_si128(flat, q2);
- q2 = _mm_or_si128(work_a, q2);
- _mm_store_si128((__m128i *)&flat_oq[2 * 16], q2);
-
- // write out op6 - op3
- {
- unsigned char *dst = (s - 7 * p);
- for (i = 6; i > 2; i--) {
- __m128i flat2_output;
- work_a = _mm_load_si128((__m128i *)&ap[i * 16]);
- flat2_output = _mm_load_si128((__m128i *)&flat2_op[i * 16]);
- work_a = _mm_andnot_si128(flat2, work_a);
- flat2_output = _mm_and_si128(flat2, flat2_output);
- work_a = _mm_or_si128(work_a, flat2_output);
- _mm_storeu_si128((__m128i *)dst, work_a);
- dst += p;
- }
- }
-
- work_a = _mm_load_si128((__m128i *)&flat_op[2 * 16]);
- p2 = _mm_load_si128((__m128i *)&flat2_op[2 * 16]);
- work_a = _mm_andnot_si128(flat2, work_a);
- p2 = _mm_and_si128(flat2, p2);
- p2 = _mm_or_si128(work_a, p2);
- _mm_storeu_si128((__m128i *)(s - 3 * p), p2);
-
- work_a = _mm_load_si128((__m128i *)&flat_op[1 * 16]);
- p1 = _mm_load_si128((__m128i *)&flat2_op[1 * 16]);
- work_a = _mm_andnot_si128(flat2, work_a);
- p1 = _mm_and_si128(flat2, p1);
- p1 = _mm_or_si128(work_a, p1);
- _mm_storeu_si128((__m128i *)(s - 2 * p), p1);
-
- work_a = _mm_load_si128((__m128i *)&flat_op[0]);
- p0 = _mm_load_si128((__m128i *)&flat2_op[0]);
- work_a = _mm_andnot_si128(flat2, work_a);
- p0 = _mm_and_si128(flat2, p0);
- p0 = _mm_or_si128(work_a, p0);
- _mm_storeu_si128((__m128i *)(s - 1 * p), p0);
-
- work_a = _mm_load_si128((__m128i *)&flat_oq[0]);
- q0 = _mm_load_si128((__m128i *)&flat2_oq[0]);
- work_a = _mm_andnot_si128(flat2, work_a);
- q0 = _mm_and_si128(flat2, q0);
- q0 = _mm_or_si128(work_a, q0);
- _mm_storeu_si128((__m128i *)(s - 0 * p), q0);
-
- work_a = _mm_load_si128((__m128i *)&flat_oq[1 * 16]);
- q1 = _mm_load_si128((__m128i *)&flat2_oq[16]);
- work_a = _mm_andnot_si128(flat2, work_a);
- q1 = _mm_and_si128(flat2, q1);
- q1 = _mm_or_si128(work_a, q1);
- _mm_storeu_si128((__m128i *)(s + 1 * p), q1);
-
- work_a = _mm_load_si128((__m128i *)&flat_oq[2 * 16]);
- q2 = _mm_load_si128((__m128i *)&flat2_oq[2 * 16]);
- work_a = _mm_andnot_si128(flat2, work_a);
- q2 = _mm_and_si128(flat2, q2);
- q2 = _mm_or_si128(work_a, q2);
- _mm_storeu_si128((__m128i *)(s + 2 * p), q2);
-
- // write out oq3 - oq7
- {
- unsigned char *dst = (s + 3 * p);
- for (i = 3; i < 7; i++) {
- __m128i flat2_output;
- work_a = _mm_load_si128((__m128i *)&aq[i * 16]);
- flat2_output = _mm_load_si128((__m128i *)&flat2_oq[i * 16]);
- work_a = _mm_andnot_si128(flat2, work_a);
- flat2_output = _mm_and_si128(flat2, flat2_output);
- work_a = _mm_or_si128(work_a, flat2_output);
- _mm_storeu_si128((__m128i *)dst, work_a);
- dst += p;
- }
- }
- }
-}
-
-// TODO(yunqingwang): remove count and call these 2 functions(8 or 16) directly.
-void vp9_lpf_horizontal_16_sse2(unsigned char *s, int p,
- const unsigned char *_blimit,
- const unsigned char *_limit,
- const unsigned char *_thresh, int count) {
- if (count == 1)
- mb_lpf_horizontal_edge_w_sse2_8(s, p, _blimit, _limit, _thresh);
- else
- mb_lpf_horizontal_edge_w_sse2_16(s, p, _blimit, _limit, _thresh);
-}
-
-void vp9_lpf_horizontal_8_sse2(unsigned char *s, int p,
- const unsigned char *_blimit,
- const unsigned char *_limit,
- const unsigned char *_thresh, int count) {
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_op2, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_op1, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_op0, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_oq2, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_oq1, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_oq0, 16);
- const __m128i zero = _mm_set1_epi16(0);
- const __m128i blimit = _mm_load_si128((const __m128i *)_blimit);
- const __m128i limit = _mm_load_si128((const __m128i *)_limit);
- const __m128i thresh = _mm_load_si128((const __m128i *)_thresh);
- __m128i mask, hev, flat;
- __m128i p3, p2, p1, p0, q0, q1, q2, q3;
- __m128i q3p3, q2p2, q1p1, q0p0, p1q1, p0q0;
-
- (void)count;
-
- q3p3 = _mm_unpacklo_epi64(_mm_loadl_epi64((__m128i *)(s - 4 * p)),
- _mm_loadl_epi64((__m128i *)(s + 3 * p)));
- q2p2 = _mm_unpacklo_epi64(_mm_loadl_epi64((__m128i *)(s - 3 * p)),
- _mm_loadl_epi64((__m128i *)(s + 2 * p)));
- q1p1 = _mm_unpacklo_epi64(_mm_loadl_epi64((__m128i *)(s - 2 * p)),
- _mm_loadl_epi64((__m128i *)(s + 1 * p)));
- q0p0 = _mm_unpacklo_epi64(_mm_loadl_epi64((__m128i *)(s - 1 * p)),
- _mm_loadl_epi64((__m128i *)(s - 0 * p)));
- p1q1 = _mm_shuffle_epi32(q1p1, 78);
- p0q0 = _mm_shuffle_epi32(q0p0, 78);
-
- {
- // filter_mask and hev_mask
- const __m128i one = _mm_set1_epi8(1);
- const __m128i fe = _mm_set1_epi8(0xfe);
- const __m128i ff = _mm_cmpeq_epi8(fe, fe);
- __m128i abs_p1q1, abs_p0q0, abs_q1q0, abs_p1p0, work;
- abs_p1p0 = _mm_or_si128(_mm_subs_epu8(q1p1, q0p0),
- _mm_subs_epu8(q0p0, q1p1));
- abs_q1q0 = _mm_srli_si128(abs_p1p0, 8);
-
- abs_p0q0 = _mm_or_si128(_mm_subs_epu8(q0p0, p0q0),
- _mm_subs_epu8(p0q0, q0p0));
- abs_p1q1 = _mm_or_si128(_mm_subs_epu8(q1p1, p1q1),
- _mm_subs_epu8(p1q1, q1p1));
- flat = _mm_max_epu8(abs_p1p0, abs_q1q0);
- hev = _mm_subs_epu8(flat, thresh);
- hev = _mm_xor_si128(_mm_cmpeq_epi8(hev, zero), ff);
-
- abs_p0q0 =_mm_adds_epu8(abs_p0q0, abs_p0q0);
- abs_p1q1 = _mm_srli_epi16(_mm_and_si128(abs_p1q1, fe), 1);
- mask = _mm_subs_epu8(_mm_adds_epu8(abs_p0q0, abs_p1q1), blimit);
- mask = _mm_xor_si128(_mm_cmpeq_epi8(mask, zero), ff);
- // mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = _mm_max_epu8(abs_p1p0, mask);
- // mask |= (abs(p1 - p0) > limit) * -1;
- // mask |= (abs(q1 - q0) > limit) * -1;
-
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q2p2, q1p1),
- _mm_subs_epu8(q1p1, q2p2)),
- _mm_or_si128(_mm_subs_epu8(q3p3, q2p2),
- _mm_subs_epu8(q2p2, q3p3)));
- mask = _mm_max_epu8(work, mask);
- mask = _mm_max_epu8(mask, _mm_srli_si128(mask, 8));
- mask = _mm_subs_epu8(mask, limit);
- mask = _mm_cmpeq_epi8(mask, zero);
-
- // flat_mask4
-
- flat = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q2p2, q0p0),
- _mm_subs_epu8(q0p0, q2p2)),
- _mm_or_si128(_mm_subs_epu8(q3p3, q0p0),
- _mm_subs_epu8(q0p0, q3p3)));
- flat = _mm_max_epu8(abs_p1p0, flat);
- flat = _mm_max_epu8(flat, _mm_srli_si128(flat, 8));
- flat = _mm_subs_epu8(flat, one);
- flat = _mm_cmpeq_epi8(flat, zero);
- flat = _mm_and_si128(flat, mask);
- }
-
- {
- const __m128i four = _mm_set1_epi16(4);
- unsigned char *src = s;
- {
- __m128i workp_a, workp_b, workp_shft;
- p3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 4 * p)), zero);
- p2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 3 * p)), zero);
- p1 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 2 * p)), zero);
- p0 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 1 * p)), zero);
- q0 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 0 * p)), zero);
- q1 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src + 1 * p)), zero);
- q2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src + 2 * p)), zero);
- q3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src + 3 * p)), zero);
-
- workp_a = _mm_add_epi16(_mm_add_epi16(p3, p3), _mm_add_epi16(p2, p1));
- workp_a = _mm_add_epi16(_mm_add_epi16(workp_a, four), p0);
- workp_b = _mm_add_epi16(_mm_add_epi16(q0, p2), p3);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_op2[0],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_b = _mm_add_epi16(_mm_add_epi16(q0, q1), p1);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_op1[0],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p3), q2);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, p1), p0);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_op0[0],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p3), q3);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, p0), q0);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_oq0[0],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p2), q3);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, q0), q1);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_oq1[0],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p1), q3);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, q1), q2);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_oq2[0],
- _mm_packus_epi16(workp_shft, workp_shft));
- }
- }
- // lp filter
- {
- const __m128i t4 = _mm_set1_epi8(4);
- const __m128i t3 = _mm_set1_epi8(3);
- const __m128i t80 = _mm_set1_epi8(0x80);
- const __m128i t1 = _mm_set1_epi8(0x1);
- const __m128i ps1 = _mm_xor_si128(_mm_loadl_epi64((__m128i *)(s - 2 * p)),
- t80);
- const __m128i ps0 = _mm_xor_si128(_mm_loadl_epi64((__m128i *)(s - 1 * p)),
- t80);
- const __m128i qs0 = _mm_xor_si128(_mm_loadl_epi64((__m128i *)(s + 0 * p)),
- t80);
- const __m128i qs1 = _mm_xor_si128(_mm_loadl_epi64((__m128i *)(s + 1 * p)),
- t80);
- __m128i filt;
- __m128i work_a;
- __m128i filter1, filter2;
-
- filt = _mm_and_si128(_mm_subs_epi8(ps1, qs1), hev);
- work_a = _mm_subs_epi8(qs0, ps0);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- // (vp9_filter + 3 * (qs0 - ps0)) & mask
- filt = _mm_and_si128(filt, mask);
-
- filter1 = _mm_adds_epi8(filt, t4);
- filter2 = _mm_adds_epi8(filt, t3);
-
- // Filter1 >> 3
- filter1 = _mm_unpacklo_epi8(zero, filter1);
- filter1 = _mm_srai_epi16(filter1, 11);
- filter1 = _mm_packs_epi16(filter1, filter1);
-
- // Filter2 >> 3
- filter2 = _mm_unpacklo_epi8(zero, filter2);
- filter2 = _mm_srai_epi16(filter2, 11);
- filter2 = _mm_packs_epi16(filter2, zero);
-
- // filt >> 1
- filt = _mm_adds_epi8(filter1, t1);
- filt = _mm_unpacklo_epi8(zero, filt);
- filt = _mm_srai_epi16(filt, 9);
- filt = _mm_packs_epi16(filt, zero);
-
- filt = _mm_andnot_si128(hev, filt);
-
- work_a = _mm_xor_si128(_mm_subs_epi8(qs0, filter1), t80);
- q0 = _mm_loadl_epi64((__m128i *)flat_oq0);
- work_a = _mm_andnot_si128(flat, work_a);
- q0 = _mm_and_si128(flat, q0);
- q0 = _mm_or_si128(work_a, q0);
-
- work_a = _mm_xor_si128(_mm_subs_epi8(qs1, filt), t80);
- q1 = _mm_loadl_epi64((__m128i *)flat_oq1);
- work_a = _mm_andnot_si128(flat, work_a);
- q1 = _mm_and_si128(flat, q1);
- q1 = _mm_or_si128(work_a, q1);
-
- work_a = _mm_loadu_si128((__m128i *)(s + 2 * p));
- q2 = _mm_loadl_epi64((__m128i *)flat_oq2);
- work_a = _mm_andnot_si128(flat, work_a);
- q2 = _mm_and_si128(flat, q2);
- q2 = _mm_or_si128(work_a, q2);
-
- work_a = _mm_xor_si128(_mm_adds_epi8(ps0, filter2), t80);
- p0 = _mm_loadl_epi64((__m128i *)flat_op0);
- work_a = _mm_andnot_si128(flat, work_a);
- p0 = _mm_and_si128(flat, p0);
- p0 = _mm_or_si128(work_a, p0);
-
- work_a = _mm_xor_si128(_mm_adds_epi8(ps1, filt), t80);
- p1 = _mm_loadl_epi64((__m128i *)flat_op1);
- work_a = _mm_andnot_si128(flat, work_a);
- p1 = _mm_and_si128(flat, p1);
- p1 = _mm_or_si128(work_a, p1);
-
- work_a = _mm_loadu_si128((__m128i *)(s - 3 * p));
- p2 = _mm_loadl_epi64((__m128i *)flat_op2);
- work_a = _mm_andnot_si128(flat, work_a);
- p2 = _mm_and_si128(flat, p2);
- p2 = _mm_or_si128(work_a, p2);
-
- _mm_storel_epi64((__m128i *)(s - 3 * p), p2);
- _mm_storel_epi64((__m128i *)(s - 2 * p), p1);
- _mm_storel_epi64((__m128i *)(s - 1 * p), p0);
- _mm_storel_epi64((__m128i *)(s + 0 * p), q0);
- _mm_storel_epi64((__m128i *)(s + 1 * p), q1);
- _mm_storel_epi64((__m128i *)(s + 2 * p), q2);
- }
-}
-
-void vp9_lpf_horizontal_8_dual_sse2(uint8_t *s, int p,
- const uint8_t *_blimit0,
- const uint8_t *_limit0,
- const uint8_t *_thresh0,
- const uint8_t *_blimit1,
- const uint8_t *_limit1,
- const uint8_t *_thresh1) {
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_op2, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_op1, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_op0, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_oq2, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_oq1, 16);
- DECLARE_ALIGNED_ARRAY(16, unsigned char, flat_oq0, 16);
- const __m128i zero = _mm_set1_epi16(0);
- const __m128i blimit =
- _mm_unpacklo_epi64(_mm_load_si128((const __m128i *)_blimit0),
- _mm_load_si128((const __m128i *)_blimit1));
- const __m128i limit =
- _mm_unpacklo_epi64(_mm_load_si128((const __m128i *)_limit0),
- _mm_load_si128((const __m128i *)_limit1));
- const __m128i thresh =
- _mm_unpacklo_epi64(_mm_load_si128((const __m128i *)_thresh0),
- _mm_load_si128((const __m128i *)_thresh1));
-
- __m128i mask, hev, flat;
- __m128i p3, p2, p1, p0, q0, q1, q2, q3;
-
- p3 = _mm_loadu_si128((__m128i *)(s - 4 * p));
- p2 = _mm_loadu_si128((__m128i *)(s - 3 * p));
- p1 = _mm_loadu_si128((__m128i *)(s - 2 * p));
- p0 = _mm_loadu_si128((__m128i *)(s - 1 * p));
- q0 = _mm_loadu_si128((__m128i *)(s - 0 * p));
- q1 = _mm_loadu_si128((__m128i *)(s + 1 * p));
- q2 = _mm_loadu_si128((__m128i *)(s + 2 * p));
- q3 = _mm_loadu_si128((__m128i *)(s + 3 * p));
- {
- const __m128i abs_p1p0 = _mm_or_si128(_mm_subs_epu8(p1, p0),
- _mm_subs_epu8(p0, p1));
- const __m128i abs_q1q0 = _mm_or_si128(_mm_subs_epu8(q1, q0),
- _mm_subs_epu8(q0, q1));
- const __m128i one = _mm_set1_epi8(1);
- const __m128i fe = _mm_set1_epi8(0xfe);
- const __m128i ff = _mm_cmpeq_epi8(abs_p1p0, abs_p1p0);
- __m128i abs_p0q0 = _mm_or_si128(_mm_subs_epu8(p0, q0),
- _mm_subs_epu8(q0, p0));
- __m128i abs_p1q1 = _mm_or_si128(_mm_subs_epu8(p1, q1),
- _mm_subs_epu8(q1, p1));
- __m128i work;
-
- // filter_mask and hev_mask
- flat = _mm_max_epu8(abs_p1p0, abs_q1q0);
- hev = _mm_subs_epu8(flat, thresh);
- hev = _mm_xor_si128(_mm_cmpeq_epi8(hev, zero), ff);
-
- abs_p0q0 =_mm_adds_epu8(abs_p0q0, abs_p0q0);
- abs_p1q1 = _mm_srli_epi16(_mm_and_si128(abs_p1q1, fe), 1);
- mask = _mm_subs_epu8(_mm_adds_epu8(abs_p0q0, abs_p1q1), blimit);
- mask = _mm_xor_si128(_mm_cmpeq_epi8(mask, zero), ff);
- // mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = _mm_max_epu8(flat, mask);
- // mask |= (abs(p1 - p0) > limit) * -1;
- // mask |= (abs(q1 - q0) > limit) * -1;
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p2, p1),
- _mm_subs_epu8(p1, p2)),
- _mm_or_si128(_mm_subs_epu8(p3, p2),
- _mm_subs_epu8(p2, p3)));
- mask = _mm_max_epu8(work, mask);
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q2, q1),
- _mm_subs_epu8(q1, q2)),
- _mm_or_si128(_mm_subs_epu8(q3, q2),
- _mm_subs_epu8(q2, q3)));
- mask = _mm_max_epu8(work, mask);
- mask = _mm_subs_epu8(mask, limit);
- mask = _mm_cmpeq_epi8(mask, zero);
-
- // flat_mask4
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p2, p0),
- _mm_subs_epu8(p0, p2)),
- _mm_or_si128(_mm_subs_epu8(q2, q0),
- _mm_subs_epu8(q0, q2)));
- flat = _mm_max_epu8(work, flat);
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p3, p0),
- _mm_subs_epu8(p0, p3)),
- _mm_or_si128(_mm_subs_epu8(q3, q0),
- _mm_subs_epu8(q0, q3)));
- flat = _mm_max_epu8(work, flat);
- flat = _mm_subs_epu8(flat, one);
- flat = _mm_cmpeq_epi8(flat, zero);
- flat = _mm_and_si128(flat, mask);
- }
- {
- const __m128i four = _mm_set1_epi16(4);
- unsigned char *src = s;
- int i = 0;
-
- do {
- __m128i workp_a, workp_b, workp_shft;
- p3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 4 * p)), zero);
- p2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 3 * p)), zero);
- p1 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 2 * p)), zero);
- p0 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 1 * p)), zero);
- q0 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src - 0 * p)), zero);
- q1 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src + 1 * p)), zero);
- q2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src + 2 * p)), zero);
- q3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i *)(src + 3 * p)), zero);
-
- workp_a = _mm_add_epi16(_mm_add_epi16(p3, p3), _mm_add_epi16(p2, p1));
- workp_a = _mm_add_epi16(_mm_add_epi16(workp_a, four), p0);
- workp_b = _mm_add_epi16(_mm_add_epi16(q0, p2), p3);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_op2[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_b = _mm_add_epi16(_mm_add_epi16(q0, q1), p1);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_op1[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p3), q2);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, p1), p0);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_op0[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p3), q3);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, p0), q0);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_oq0[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p2), q3);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, q0), q1);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_oq1[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- workp_a = _mm_add_epi16(_mm_sub_epi16(workp_a, p1), q3);
- workp_b = _mm_add_epi16(_mm_sub_epi16(workp_b, q1), q2);
- workp_shft = _mm_srli_epi16(_mm_add_epi16(workp_a, workp_b), 3);
- _mm_storel_epi64((__m128i *)&flat_oq2[i * 8],
- _mm_packus_epi16(workp_shft, workp_shft));
-
- src += 8;
- } while (++i < 2);
- }
- // lp filter
- {
- const __m128i t4 = _mm_set1_epi8(4);
- const __m128i t3 = _mm_set1_epi8(3);
- const __m128i t80 = _mm_set1_epi8(0x80);
- const __m128i te0 = _mm_set1_epi8(0xe0);
- const __m128i t1f = _mm_set1_epi8(0x1f);
- const __m128i t1 = _mm_set1_epi8(0x1);
- const __m128i t7f = _mm_set1_epi8(0x7f);
-
- const __m128i ps1 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s - 2 * p)),
- t80);
- const __m128i ps0 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s - 1 * p)),
- t80);
- const __m128i qs0 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s + 0 * p)),
- t80);
- const __m128i qs1 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s + 1 * p)),
- t80);
- __m128i filt;
- __m128i work_a;
- __m128i filter1, filter2;
-
- filt = _mm_and_si128(_mm_subs_epi8(ps1, qs1), hev);
- work_a = _mm_subs_epi8(qs0, ps0);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- // (vp9_filter + 3 * (qs0 - ps0)) & mask
- filt = _mm_and_si128(filt, mask);
-
- filter1 = _mm_adds_epi8(filt, t4);
- filter2 = _mm_adds_epi8(filt, t3);
-
- // Filter1 >> 3
- work_a = _mm_cmpgt_epi8(zero, filter1);
- filter1 = _mm_srli_epi16(filter1, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter1 = _mm_and_si128(filter1, t1f);
- filter1 = _mm_or_si128(filter1, work_a);
-
- // Filter2 >> 3
- work_a = _mm_cmpgt_epi8(zero, filter2);
- filter2 = _mm_srli_epi16(filter2, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter2 = _mm_and_si128(filter2, t1f);
- filter2 = _mm_or_si128(filter2, work_a);
-
- // filt >> 1
- filt = _mm_adds_epi8(filter1, t1);
- work_a = _mm_cmpgt_epi8(zero, filt);
- filt = _mm_srli_epi16(filt, 1);
- work_a = _mm_and_si128(work_a, t80);
- filt = _mm_and_si128(filt, t7f);
- filt = _mm_or_si128(filt, work_a);
-
- filt = _mm_andnot_si128(hev, filt);
-
- work_a = _mm_xor_si128(_mm_subs_epi8(qs0, filter1), t80);
- q0 = _mm_load_si128((__m128i *)flat_oq0);
- work_a = _mm_andnot_si128(flat, work_a);
- q0 = _mm_and_si128(flat, q0);
- q0 = _mm_or_si128(work_a, q0);
-
- work_a = _mm_xor_si128(_mm_subs_epi8(qs1, filt), t80);
- q1 = _mm_load_si128((__m128i *)flat_oq1);
- work_a = _mm_andnot_si128(flat, work_a);
- q1 = _mm_and_si128(flat, q1);
- q1 = _mm_or_si128(work_a, q1);
-
- work_a = _mm_loadu_si128((__m128i *)(s + 2 * p));
- q2 = _mm_load_si128((__m128i *)flat_oq2);
- work_a = _mm_andnot_si128(flat, work_a);
- q2 = _mm_and_si128(flat, q2);
- q2 = _mm_or_si128(work_a, q2);
-
- work_a = _mm_xor_si128(_mm_adds_epi8(ps0, filter2), t80);
- p0 = _mm_load_si128((__m128i *)flat_op0);
- work_a = _mm_andnot_si128(flat, work_a);
- p0 = _mm_and_si128(flat, p0);
- p0 = _mm_or_si128(work_a, p0);
-
- work_a = _mm_xor_si128(_mm_adds_epi8(ps1, filt), t80);
- p1 = _mm_load_si128((__m128i *)flat_op1);
- work_a = _mm_andnot_si128(flat, work_a);
- p1 = _mm_and_si128(flat, p1);
- p1 = _mm_or_si128(work_a, p1);
-
- work_a = _mm_loadu_si128((__m128i *)(s - 3 * p));
- p2 = _mm_load_si128((__m128i *)flat_op2);
- work_a = _mm_andnot_si128(flat, work_a);
- p2 = _mm_and_si128(flat, p2);
- p2 = _mm_or_si128(work_a, p2);
-
- _mm_storeu_si128((__m128i *)(s - 3 * p), p2);
- _mm_storeu_si128((__m128i *)(s - 2 * p), p1);
- _mm_storeu_si128((__m128i *)(s - 1 * p), p0);
- _mm_storeu_si128((__m128i *)(s + 0 * p), q0);
- _mm_storeu_si128((__m128i *)(s + 1 * p), q1);
- _mm_storeu_si128((__m128i *)(s + 2 * p), q2);
- }
-}
-
-void vp9_lpf_horizontal_4_dual_sse2(unsigned char *s, int p,
- const unsigned char *_blimit0,
- const unsigned char *_limit0,
- const unsigned char *_thresh0,
- const unsigned char *_blimit1,
- const unsigned char *_limit1,
- const unsigned char *_thresh1) {
- const __m128i blimit =
- _mm_unpacklo_epi64(_mm_load_si128((const __m128i *)_blimit0),
- _mm_load_si128((const __m128i *)_blimit1));
- const __m128i limit =
- _mm_unpacklo_epi64(_mm_load_si128((const __m128i *)_limit0),
- _mm_load_si128((const __m128i *)_limit1));
- const __m128i thresh =
- _mm_unpacklo_epi64(_mm_load_si128((const __m128i *)_thresh0),
- _mm_load_si128((const __m128i *)_thresh1));
- const __m128i zero = _mm_set1_epi16(0);
- __m128i p3, p2, p1, p0, q0, q1, q2, q3;
- __m128i mask, hev, flat;
-
- p3 = _mm_loadu_si128((__m128i *)(s - 4 * p));
- p2 = _mm_loadu_si128((__m128i *)(s - 3 * p));
- p1 = _mm_loadu_si128((__m128i *)(s - 2 * p));
- p0 = _mm_loadu_si128((__m128i *)(s - 1 * p));
- q0 = _mm_loadu_si128((__m128i *)(s - 0 * p));
- q1 = _mm_loadu_si128((__m128i *)(s + 1 * p));
- q2 = _mm_loadu_si128((__m128i *)(s + 2 * p));
- q3 = _mm_loadu_si128((__m128i *)(s + 3 * p));
-
- // filter_mask and hev_mask
- {
- const __m128i abs_p1p0 = _mm_or_si128(_mm_subs_epu8(p1, p0),
- _mm_subs_epu8(p0, p1));
- const __m128i abs_q1q0 = _mm_or_si128(_mm_subs_epu8(q1, q0),
- _mm_subs_epu8(q0, q1));
- const __m128i fe = _mm_set1_epi8(0xfe);
- const __m128i ff = _mm_cmpeq_epi8(abs_p1p0, abs_p1p0);
- __m128i abs_p0q0 = _mm_or_si128(_mm_subs_epu8(p0, q0),
- _mm_subs_epu8(q0, p0));
- __m128i abs_p1q1 = _mm_or_si128(_mm_subs_epu8(p1, q1),
- _mm_subs_epu8(q1, p1));
- __m128i work;
-
- flat = _mm_max_epu8(abs_p1p0, abs_q1q0);
- hev = _mm_subs_epu8(flat, thresh);
- hev = _mm_xor_si128(_mm_cmpeq_epi8(hev, zero), ff);
-
- abs_p0q0 =_mm_adds_epu8(abs_p0q0, abs_p0q0);
- abs_p1q1 = _mm_srli_epi16(_mm_and_si128(abs_p1q1, fe), 1);
- mask = _mm_subs_epu8(_mm_adds_epu8(abs_p0q0, abs_p1q1), blimit);
- mask = _mm_xor_si128(_mm_cmpeq_epi8(mask, zero), ff);
- // mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = _mm_max_epu8(flat, mask);
- // mask |= (abs(p1 - p0) > limit) * -1;
- // mask |= (abs(q1 - q0) > limit) * -1;
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(p2, p1),
- _mm_subs_epu8(p1, p2)),
- _mm_or_si128(_mm_subs_epu8(p3, p2),
- _mm_subs_epu8(p2, p3)));
- mask = _mm_max_epu8(work, mask);
- work = _mm_max_epu8(_mm_or_si128(_mm_subs_epu8(q2, q1),
- _mm_subs_epu8(q1, q2)),
- _mm_or_si128(_mm_subs_epu8(q3, q2),
- _mm_subs_epu8(q2, q3)));
- mask = _mm_max_epu8(work, mask);
- mask = _mm_subs_epu8(mask, limit);
- mask = _mm_cmpeq_epi8(mask, zero);
- }
-
- // filter4
- {
- const __m128i t4 = _mm_set1_epi8(4);
- const __m128i t3 = _mm_set1_epi8(3);
- const __m128i t80 = _mm_set1_epi8(0x80);
- const __m128i te0 = _mm_set1_epi8(0xe0);
- const __m128i t1f = _mm_set1_epi8(0x1f);
- const __m128i t1 = _mm_set1_epi8(0x1);
- const __m128i t7f = _mm_set1_epi8(0x7f);
-
- const __m128i ps1 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s - 2 * p)),
- t80);
- const __m128i ps0 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s - 1 * p)),
- t80);
- const __m128i qs0 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s + 0 * p)),
- t80);
- const __m128i qs1 = _mm_xor_si128(_mm_loadu_si128((__m128i *)(s + 1 * p)),
- t80);
- __m128i filt;
- __m128i work_a;
- __m128i filter1, filter2;
-
- filt = _mm_and_si128(_mm_subs_epi8(ps1, qs1), hev);
- work_a = _mm_subs_epi8(qs0, ps0);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- filt = _mm_adds_epi8(filt, work_a);
- // (vp9_filter + 3 * (qs0 - ps0)) & mask
- filt = _mm_and_si128(filt, mask);
-
- filter1 = _mm_adds_epi8(filt, t4);
- filter2 = _mm_adds_epi8(filt, t3);
-
- // Filter1 >> 3
- work_a = _mm_cmpgt_epi8(zero, filter1);
- filter1 = _mm_srli_epi16(filter1, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter1 = _mm_and_si128(filter1, t1f);
- filter1 = _mm_or_si128(filter1, work_a);
-
- // Filter2 >> 3
- work_a = _mm_cmpgt_epi8(zero, filter2);
- filter2 = _mm_srli_epi16(filter2, 3);
- work_a = _mm_and_si128(work_a, te0);
- filter2 = _mm_and_si128(filter2, t1f);
- filter2 = _mm_or_si128(filter2, work_a);
-
- // filt >> 1
- filt = _mm_adds_epi8(filter1, t1);
- work_a = _mm_cmpgt_epi8(zero, filt);
- filt = _mm_srli_epi16(filt, 1);
- work_a = _mm_and_si128(work_a, t80);
- filt = _mm_and_si128(filt, t7f);
- filt = _mm_or_si128(filt, work_a);
-
- filt = _mm_andnot_si128(hev, filt);
-
- q0 = _mm_xor_si128(_mm_subs_epi8(qs0, filter1), t80);
- q1 = _mm_xor_si128(_mm_subs_epi8(qs1, filt), t80);
- p0 = _mm_xor_si128(_mm_adds_epi8(ps0, filter2), t80);
- p1 = _mm_xor_si128(_mm_adds_epi8(ps1, filt), t80);
-
- _mm_storeu_si128((__m128i *)(s - 2 * p), p1);
- _mm_storeu_si128((__m128i *)(s - 1 * p), p0);
- _mm_storeu_si128((__m128i *)(s + 0 * p), q0);
- _mm_storeu_si128((__m128i *)(s + 1 * p), q1);
- }
-}
-
-static INLINE void transpose8x16(unsigned char *in0, unsigned char *in1,
- int in_p, unsigned char *out, int out_p) {
- __m128i x0, x1, x2, x3, x4, x5, x6, x7;
- __m128i x8, x9, x10, x11, x12, x13, x14, x15;
-
- // Read in 16 lines
- x0 = _mm_loadl_epi64((__m128i *)in0);
- x8 = _mm_loadl_epi64((__m128i *)in1);
- x1 = _mm_loadl_epi64((__m128i *)(in0 + in_p));
- x9 = _mm_loadl_epi64((__m128i *)(in1 + in_p));
- x2 = _mm_loadl_epi64((__m128i *)(in0 + 2 * in_p));
- x10 = _mm_loadl_epi64((__m128i *)(in1 + 2 * in_p));
- x3 = _mm_loadl_epi64((__m128i *)(in0 + 3*in_p));
- x11 = _mm_loadl_epi64((__m128i *)(in1 + 3*in_p));
- x4 = _mm_loadl_epi64((__m128i *)(in0 + 4*in_p));
- x12 = _mm_loadl_epi64((__m128i *)(in1 + 4*in_p));
- x5 = _mm_loadl_epi64((__m128i *)(in0 + 5*in_p));
- x13 = _mm_loadl_epi64((__m128i *)(in1 + 5*in_p));
- x6 = _mm_loadl_epi64((__m128i *)(in0 + 6*in_p));
- x14 = _mm_loadl_epi64((__m128i *)(in1 + 6*in_p));
- x7 = _mm_loadl_epi64((__m128i *)(in0 + 7*in_p));
- x15 = _mm_loadl_epi64((__m128i *)(in1 + 7*in_p));
-
- x0 = _mm_unpacklo_epi8(x0, x1);
- x1 = _mm_unpacklo_epi8(x2, x3);
- x2 = _mm_unpacklo_epi8(x4, x5);
- x3 = _mm_unpacklo_epi8(x6, x7);
-
- x8 = _mm_unpacklo_epi8(x8, x9);
- x9 = _mm_unpacklo_epi8(x10, x11);
- x10 = _mm_unpacklo_epi8(x12, x13);
- x11 = _mm_unpacklo_epi8(x14, x15);
-
- x4 = _mm_unpacklo_epi16(x0, x1);
- x5 = _mm_unpacklo_epi16(x2, x3);
- x12 = _mm_unpacklo_epi16(x8, x9);
- x13 = _mm_unpacklo_epi16(x10, x11);
-
- x6 = _mm_unpacklo_epi32(x4, x5);
- x7 = _mm_unpackhi_epi32(x4, x5);
- x14 = _mm_unpacklo_epi32(x12, x13);
- x15 = _mm_unpackhi_epi32(x12, x13);
-
- // Store first 4-line result
- _mm_storeu_si128((__m128i *)out, _mm_unpacklo_epi64(x6, x14));
- _mm_storeu_si128((__m128i *)(out + out_p), _mm_unpackhi_epi64(x6, x14));
- _mm_storeu_si128((__m128i *)(out + 2 * out_p), _mm_unpacklo_epi64(x7, x15));
- _mm_storeu_si128((__m128i *)(out + 3 * out_p), _mm_unpackhi_epi64(x7, x15));
-
- x4 = _mm_unpackhi_epi16(x0, x1);
- x5 = _mm_unpackhi_epi16(x2, x3);
- x12 = _mm_unpackhi_epi16(x8, x9);
- x13 = _mm_unpackhi_epi16(x10, x11);
-
- x6 = _mm_unpacklo_epi32(x4, x5);
- x7 = _mm_unpackhi_epi32(x4, x5);
- x14 = _mm_unpacklo_epi32(x12, x13);
- x15 = _mm_unpackhi_epi32(x12, x13);
-
- // Store second 4-line result
- _mm_storeu_si128((__m128i *)(out + 4 * out_p), _mm_unpacklo_epi64(x6, x14));
- _mm_storeu_si128((__m128i *)(out + 5 * out_p), _mm_unpackhi_epi64(x6, x14));
- _mm_storeu_si128((__m128i *)(out + 6 * out_p), _mm_unpacklo_epi64(x7, x15));
- _mm_storeu_si128((__m128i *)(out + 7 * out_p), _mm_unpackhi_epi64(x7, x15));
-}
-
-static INLINE void transpose(unsigned char *src[], int in_p,
- unsigned char *dst[], int out_p,
- int num_8x8_to_transpose) {
- int idx8x8 = 0;
- __m128i x0, x1, x2, x3, x4, x5, x6, x7;
- do {
- unsigned char *in = src[idx8x8];
- unsigned char *out = dst[idx8x8];
-
- x0 = _mm_loadl_epi64((__m128i *)(in + 0*in_p)); // 00 01 02 03 04 05 06 07
- x1 = _mm_loadl_epi64((__m128i *)(in + 1*in_p)); // 10 11 12 13 14 15 16 17
- x2 = _mm_loadl_epi64((__m128i *)(in + 2*in_p)); // 20 21 22 23 24 25 26 27
- x3 = _mm_loadl_epi64((__m128i *)(in + 3*in_p)); // 30 31 32 33 34 35 36 37
- x4 = _mm_loadl_epi64((__m128i *)(in + 4*in_p)); // 40 41 42 43 44 45 46 47
- x5 = _mm_loadl_epi64((__m128i *)(in + 5*in_p)); // 50 51 52 53 54 55 56 57
- x6 = _mm_loadl_epi64((__m128i *)(in + 6*in_p)); // 60 61 62 63 64 65 66 67
- x7 = _mm_loadl_epi64((__m128i *)(in + 7*in_p)); // 70 71 72 73 74 75 76 77
- // 00 10 01 11 02 12 03 13 04 14 05 15 06 16 07 17
- x0 = _mm_unpacklo_epi8(x0, x1);
- // 20 30 21 31 22 32 23 33 24 34 25 35 26 36 27 37
- x1 = _mm_unpacklo_epi8(x2, x3);
- // 40 50 41 51 42 52 43 53 44 54 45 55 46 56 47 57
- x2 = _mm_unpacklo_epi8(x4, x5);
- // 60 70 61 71 62 72 63 73 64 74 65 75 66 76 67 77
- x3 = _mm_unpacklo_epi8(x6, x7);
- // 00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33
- x4 = _mm_unpacklo_epi16(x0, x1);
- // 40 50 60 70 41 51 61 71 42 52 62 72 43 53 63 73
- x5 = _mm_unpacklo_epi16(x2, x3);
- // 00 10 20 30 40 50 60 70 01 11 21 31 41 51 61 71
- x6 = _mm_unpacklo_epi32(x4, x5);
- // 02 12 22 32 42 52 62 72 03 13 23 33 43 53 63 73
- x7 = _mm_unpackhi_epi32(x4, x5);
-
- _mm_storel_pd((double *)(out + 0*out_p),
- _mm_castsi128_pd(x6)); // 00 10 20 30 40 50 60 70
- _mm_storeh_pd((double *)(out + 1*out_p),
- _mm_castsi128_pd(x6)); // 01 11 21 31 41 51 61 71
- _mm_storel_pd((double *)(out + 2*out_p),
- _mm_castsi128_pd(x7)); // 02 12 22 32 42 52 62 72
- _mm_storeh_pd((double *)(out + 3*out_p),
- _mm_castsi128_pd(x7)); // 03 13 23 33 43 53 63 73
-
- // 04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37
- x4 = _mm_unpackhi_epi16(x0, x1);
- // 44 54 64 74 45 55 65 75 46 56 66 76 47 57 67 77
- x5 = _mm_unpackhi_epi16(x2, x3);
- // 04 14 24 34 44 54 64 74 05 15 25 35 45 55 65 75
- x6 = _mm_unpacklo_epi32(x4, x5);
- // 06 16 26 36 46 56 66 76 07 17 27 37 47 57 67 77
- x7 = _mm_unpackhi_epi32(x4, x5);
-
- _mm_storel_pd((double *)(out + 4*out_p),
- _mm_castsi128_pd(x6)); // 04 14 24 34 44 54 64 74
- _mm_storeh_pd((double *)(out + 5*out_p),
- _mm_castsi128_pd(x6)); // 05 15 25 35 45 55 65 75
- _mm_storel_pd((double *)(out + 6*out_p),
- _mm_castsi128_pd(x7)); // 06 16 26 36 46 56 66 76
- _mm_storeh_pd((double *)(out + 7*out_p),
- _mm_castsi128_pd(x7)); // 07 17 27 37 47 57 67 77
- } while (++idx8x8 < num_8x8_to_transpose);
-}
-
-void vp9_lpf_vertical_4_dual_sse2(uint8_t *s, int p, const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- DECLARE_ALIGNED_ARRAY(16, unsigned char, t_dst, 16 * 8);
- unsigned char *src[2];
- unsigned char *dst[2];
-
- // Transpose 8x16
- transpose8x16(s - 4, s - 4 + p * 8, p, t_dst, 16);
-
- // Loop filtering
- vp9_lpf_horizontal_4_dual_sse2(t_dst + 4 * 16, 16, blimit0, limit0, thresh0,
- blimit1, limit1, thresh1);
- src[0] = t_dst;
- src[1] = t_dst + 8;
- dst[0] = s - 4;
- dst[1] = s - 4 + p * 8;
-
- // Transpose back
- transpose(src, 16, dst, p, 2);
-}
-
-void vp9_lpf_vertical_8_sse2(unsigned char *s, int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh, int count) {
- DECLARE_ALIGNED_ARRAY(8, unsigned char, t_dst, 8 * 8);
- unsigned char *src[1];
- unsigned char *dst[1];
- (void)count;
-
- // Transpose 8x8
- src[0] = s - 4;
- dst[0] = t_dst;
-
- transpose(src, p, dst, 8, 1);
-
- // Loop filtering
- vp9_lpf_horizontal_8_sse2(t_dst + 4 * 8, 8, blimit, limit, thresh, 1);
-
- src[0] = t_dst;
- dst[0] = s - 4;
-
- // Transpose back
- transpose(src, 8, dst, p, 1);
-}
-
-void vp9_lpf_vertical_8_dual_sse2(uint8_t *s, int p, const uint8_t *blimit0,
- const uint8_t *limit0,
- const uint8_t *thresh0,
- const uint8_t *blimit1,
- const uint8_t *limit1,
- const uint8_t *thresh1) {
- DECLARE_ALIGNED_ARRAY(16, unsigned char, t_dst, 16 * 8);
- unsigned char *src[2];
- unsigned char *dst[2];
-
- // Transpose 8x16
- transpose8x16(s - 4, s - 4 + p * 8, p, t_dst, 16);
-
- // Loop filtering
- vp9_lpf_horizontal_8_dual_sse2(t_dst + 4 * 16, 16, blimit0, limit0, thresh0,
- blimit1, limit1, thresh1);
- src[0] = t_dst;
- src[1] = t_dst + 8;
-
- dst[0] = s - 4;
- dst[1] = s - 4 + p * 8;
-
- // Transpose back
- transpose(src, 16, dst, p, 2);
-}
-
-void vp9_lpf_vertical_16_sse2(unsigned char *s, int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh) {
- DECLARE_ALIGNED_ARRAY(8, unsigned char, t_dst, 8 * 16);
- unsigned char *src[2];
- unsigned char *dst[2];
-
- src[0] = s - 8;
- src[1] = s;
- dst[0] = t_dst;
- dst[1] = t_dst + 8 * 8;
-
- // Transpose 16x8
- transpose(src, p, dst, 8, 2);
-
- // Loop filtering
- mb_lpf_horizontal_edge_w_sse2_8(t_dst + 8 * 8, 8, blimit, limit, thresh);
-
- src[0] = t_dst;
- src[1] = t_dst + 8 * 8;
- dst[0] = s - 8;
- dst[1] = s;
-
- // Transpose back
- transpose(src, 8, dst, p, 2);
-}
-
-void vp9_lpf_vertical_16_dual_sse2(unsigned char *s, int p,
- const uint8_t *blimit, const uint8_t *limit,
- const uint8_t *thresh) {
- DECLARE_ALIGNED_ARRAY(16, unsigned char, t_dst, 256);
-
- // Transpose 16x16
- transpose8x16(s - 8, s - 8 + 8 * p, p, t_dst, 16);
- transpose8x16(s, s + 8 * p, p, t_dst + 8 * 16, 16);
-
- // Loop filtering
- mb_lpf_horizontal_edge_w_sse2_16(t_dst + 8 * 16, 16, blimit, limit,
- thresh);
-
- // Transpose back
- transpose8x16(t_dst, t_dst + 8 * 16, 16, s - 8, p);
- transpose8x16(t_dst + 8, t_dst + 8 + 8 * 16, 16, s - 8 + 8 * p, p);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_mmx.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_mmx.asm
deleted file mode 100644
index 91055b9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_loopfilter_mmx.asm
+++ /dev/null
@@ -1,626 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-
-;void vp9_lpf_horizontal_4_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; int count
-;)
-global sym(vp9_lpf_horizontal_4_mmx) PRIVATE
-sym(vp9_lpf_horizontal_4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 32 ; reserve 32 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- movsxd rcx, dword ptr arg(5) ;count
-.next8_h:
- mov rdx, arg(3) ;limit
- movq mm7, [rdx]
- mov rdi, rsi ; rdi points to row +1 for indirect addressing
- add rdi, rax
-
- ; calculate breakout conditions
- movq mm2, [rdi+2*rax] ; q3
- movq mm1, [rsi+2*rax] ; q2
- movq mm6, mm1 ; q2
- psubusb mm1, mm2 ; q2-=q3
- psubusb mm2, mm6 ; q3-=q2
- por mm1, mm2 ; abs(q3-q2)
- psubusb mm1, mm7 ;
-
-
- movq mm4, [rsi+rax] ; q1
- movq mm3, mm4 ; q1
- psubusb mm4, mm6 ; q1-=q2
- psubusb mm6, mm3 ; q2-=q1
- por mm4, mm6 ; abs(q2-q1)
-
- psubusb mm4, mm7
- por mm1, mm4
-
- movq mm4, [rsi] ; q0
- movq mm0, mm4 ; q0
- psubusb mm4, mm3 ; q0-=q1
- psubusb mm3, mm0 ; q1-=q0
- por mm4, mm3 ; abs(q0-q1)
- movq t0, mm4 ; save to t0
- psubusb mm4, mm7
- por mm1, mm4
-
-
- neg rax ; negate pitch to deal with above border
-
- movq mm2, [rsi+4*rax] ; p3
- movq mm4, [rdi+4*rax] ; p2
- movq mm5, mm4 ; p2
- psubusb mm4, mm2 ; p2-=p3
- psubusb mm2, mm5 ; p3-=p2
- por mm4, mm2 ; abs(p3 - p2)
- psubusb mm4, mm7
- por mm1, mm4
-
-
- movq mm4, [rsi+2*rax] ; p1
- movq mm3, mm4 ; p1
- psubusb mm4, mm5 ; p1-=p2
- psubusb mm5, mm3 ; p2-=p1
- por mm4, mm5 ; abs(p2 - p1)
- psubusb mm4, mm7
- por mm1, mm4
-
- movq mm2, mm3 ; p1
-
- movq mm4, [rsi+rax] ; p0
- movq mm5, mm4 ; p0
- psubusb mm4, mm3 ; p0-=p1
- psubusb mm3, mm5 ; p1-=p0
- por mm4, mm3 ; abs(p1 - p0)
- movq t1, mm4 ; save to t1
- psubusb mm4, mm7
- por mm1, mm4
-
- movq mm3, [rdi] ; q1
- movq mm4, mm3 ; q1
- psubusb mm3, mm2 ; q1-=p1
- psubusb mm2, mm4 ; p1-=q1
- por mm2, mm3 ; abs(p1-q1)
- pand mm2, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm2, 1 ; abs(p1-q1)/2
-
- movq mm6, mm5 ; p0
- movq mm3, [rsi] ; q0
- psubusb mm5, mm3 ; p0-=q0
- psubusb mm3, mm6 ; q0-=p0
- por mm5, mm3 ; abs(p0 - q0)
- paddusb mm5, mm5 ; abs(p0-q0)*2
- paddusb mm5, mm2 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- mov rdx, arg(2) ;blimit ; get blimit
- movq mm7, [rdx] ; blimit
-
- psubusb mm5, mm7 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- por mm1, mm5
- pxor mm5, mm5
- pcmpeqb mm1, mm5 ; mask mm1
-
- ; calculate high edge variance
- mov rdx, arg(4) ;thresh ; get thresh
- movq mm7, [rdx] ;
- movq mm4, t0 ; get abs (q1 - q0)
- psubusb mm4, mm7
- movq mm3, t1 ; get abs (p1 - p0)
- psubusb mm3, mm7
- paddb mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
-
- pcmpeqb mm4, mm5
-
- pcmpeqb mm5, mm5
- pxor mm4, mm5
-
-
- ; start work on filters
- movq mm2, [rsi+2*rax] ; p1
- movq mm7, [rdi] ; q1
- pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values
- psubsb mm2, mm7 ; p1 - q1
- pand mm2, mm4 ; high var mask (hvm)(p1 - q1)
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
- pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values
- movq mm3, mm0 ; q0
- psubsb mm0, mm6 ; q0 - p0
- paddsb mm2, mm0 ; 1 * (q0 - p0) + hvm(p1 - q1)
- paddsb mm2, mm0 ; 2 * (q0 - p0) + hvm(p1 - q1)
- paddsb mm2, mm0 ; 3 * (q0 - p0) + hvm(p1 - q1)
- pand mm1, mm2 ; mask filter values we don't care about
- movq mm2, mm1
- paddsb mm1, [GLOBAL(t4)] ; 3* (q0 - p0) + hvm(p1 - q1) + 4
- paddsb mm2, [GLOBAL(t3)] ; 3* (q0 - p0) + hvm(p1 - q1) + 3
-
- pxor mm0, mm0 ;
- pxor mm5, mm5
- punpcklbw mm0, mm2 ;
- punpckhbw mm5, mm2 ;
- psraw mm0, 11 ;
- psraw mm5, 11
- packsswb mm0, mm5
- movq mm2, mm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
-
- pxor mm0, mm0 ; 0
- movq mm5, mm1 ; abcdefgh
- punpcklbw mm0, mm1 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
- pxor mm1, mm1 ; 0
- punpckhbw mm1, mm5 ; a0b0c0d0
- psraw mm1, 11 ; sign extended shift right by 3
- movq mm5, mm0 ; save results
-
- packsswb mm0, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3
- paddsw mm5, [GLOBAL(ones)]
- paddsw mm1, [GLOBAL(ones)]
- psraw mm5, 1 ; partial shifted one more time for 2nd tap
- psraw mm1, 1 ; partial shifted one more time for 2nd tap
- packsswb mm5, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4
- pandn mm4, mm5 ; high edge variance additive
-
- paddsb mm6, mm2 ; p0+= p0 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
- movq [rsi+rax], mm6 ; write back
-
- movq mm6, [rsi+2*rax] ; p1
- pxor mm6, [GLOBAL(t80)] ; reoffset
- paddsb mm6, mm4 ; p1+= p1 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
- movq [rsi+2*rax], mm6 ; write back
-
- psubsb mm3, mm0 ; q0-= q0 add
- pxor mm3, [GLOBAL(t80)] ; unoffset
- movq [rsi], mm3 ; write back
-
- psubsb mm7, mm4 ; q1-= q1 add
- pxor mm7, [GLOBAL(t80)] ; unoffset
- movq [rdi], mm7 ; write back
-
- add rsi,8
- neg rax
- dec rcx
- jnz .next8_h
-
- add rsp, 32
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp9_lpf_vertical_4_mmx
-;(
-; unsigned char *src_ptr,
-; int src_pixel_step,
-; const char *blimit,
-; const char *limit,
-; const char *thresh,
-; int count
-;)
-global sym(vp9_lpf_vertical_4_mmx) PRIVATE
-sym(vp9_lpf_vertical_4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 64 ; reserve 64 bytes
- %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8];
- %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8];
- %define srct [rsp + 32] ;__declspec(align(16)) char srct[32];
-
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch?
-
- lea rsi, [rsi + rax*4 - 4]
-
- movsxd rcx, dword ptr arg(5) ;count
-.next8_v:
- mov rdi, rsi ; rdi points to row +1 for indirect addressing
- add rdi, rax
-
-
- ;transpose
- movq mm6, [rsi+2*rax] ; 67 66 65 64 63 62 61 60
- movq mm7, mm6 ; 77 76 75 74 73 72 71 70
-
- punpckhbw mm7, [rdi+2*rax] ; 77 67 76 66 75 65 74 64
- punpcklbw mm6, [rdi+2*rax] ; 73 63 72 62 71 61 70 60
-
- movq mm4, [rsi] ; 47 46 45 44 43 42 41 40
- movq mm5, mm4 ; 47 46 45 44 43 42 41 40
-
- punpckhbw mm5, [rsi+rax] ; 57 47 56 46 55 45 54 44
- punpcklbw mm4, [rsi+rax] ; 53 43 52 42 51 41 50 40
-
- movq mm3, mm5 ; 57 47 56 46 55 45 54 44
- punpckhwd mm5, mm7 ; 77 67 57 47 76 66 56 46
-
- punpcklwd mm3, mm7 ; 75 65 55 45 74 64 54 44
- movq mm2, mm4 ; 53 43 52 42 51 41 50 40
-
- punpckhwd mm4, mm6 ; 73 63 53 43 72 62 52 42
- punpcklwd mm2, mm6 ; 71 61 51 41 70 60 50 40
-
- neg rax
- movq mm6, [rsi+rax*2] ; 27 26 25 24 23 22 21 20
-
- movq mm1, mm6 ; 27 26 25 24 23 22 21 20
- punpckhbw mm6, [rsi+rax] ; 37 27 36 36 35 25 34 24
-
- punpcklbw mm1, [rsi+rax] ; 33 23 32 22 31 21 30 20
- movq mm7, [rsi+rax*4]; ; 07 06 05 04 03 02 01 00
-
- punpckhbw mm7, [rdi+rax*4] ; 17 07 16 06 15 05 14 04
- movq mm0, mm7 ; 17 07 16 06 15 05 14 04
-
- punpckhwd mm7, mm6 ; 37 27 17 07 36 26 16 06
- punpcklwd mm0, mm6 ; 35 25 15 05 34 24 14 04
-
- movq mm6, mm7 ; 37 27 17 07 36 26 16 06
- punpckhdq mm7, mm5 ; 77 67 57 47 37 27 17 07 = q3
-
- punpckldq mm6, mm5 ; 76 66 56 46 36 26 16 06 = q2
-
- movq mm5, mm6 ; 76 66 56 46 36 26 16 06
- psubusb mm5, mm7 ; q2-q3
-
- psubusb mm7, mm6 ; q3-q2
- por mm7, mm5; ; mm7=abs (q3-q2)
-
- movq mm5, mm0 ; 35 25 15 05 34 24 14 04
- punpckhdq mm5, mm3 ; 75 65 55 45 35 25 15 05 = q1
-
- punpckldq mm0, mm3 ; 74 64 54 44 34 24 15 04 = q0
- movq mm3, mm5 ; 75 65 55 45 35 25 15 05 = q1
-
- psubusb mm3, mm6 ; q1-q2
- psubusb mm6, mm5 ; q2-q1
-
- por mm6, mm3 ; mm6=abs(q2-q1)
- lea rdx, srct
-
- movq [rdx+24], mm5 ; save q1
- movq [rdx+16], mm0 ; save q0
-
- movq mm3, [rsi+rax*4] ; 07 06 05 04 03 02 01 00
- punpcklbw mm3, [rdi+rax*4] ; 13 03 12 02 11 01 10 00
-
- movq mm0, mm3 ; 13 03 12 02 11 01 10 00
- punpcklwd mm0, mm1 ; 31 21 11 01 30 20 10 00
-
- punpckhwd mm3, mm1 ; 33 23 13 03 32 22 12 02
- movq mm1, mm0 ; 31 21 11 01 30 20 10 00
-
- punpckldq mm0, mm2 ; 70 60 50 40 30 20 10 00 =p3
- punpckhdq mm1, mm2 ; 71 61 51 41 31 21 11 01 =p2
-
- movq mm2, mm1 ; 71 61 51 41 31 21 11 01 =p2
- psubusb mm2, mm0 ; p2-p3
-
- psubusb mm0, mm1 ; p3-p2
- por mm0, mm2 ; mm0=abs(p3-p2)
-
- movq mm2, mm3 ; 33 23 13 03 32 22 12 02
- punpckldq mm2, mm4 ; 72 62 52 42 32 22 12 02 = p1
-
- punpckhdq mm3, mm4 ; 73 63 53 43 33 23 13 03 = p0
- movq [rdx+8], mm3 ; save p0
-
- movq [rdx], mm2 ; save p1
- movq mm5, mm2 ; mm5 = p1
-
- psubusb mm2, mm1 ; p1-p2
- psubusb mm1, mm5 ; p2-p1
-
- por mm1, mm2 ; mm1=abs(p2-p1)
- mov rdx, arg(3) ;limit
-
- movq mm4, [rdx] ; mm4 = limit
- psubusb mm7, mm4
-
- psubusb mm0, mm4
- psubusb mm1, mm4
-
- psubusb mm6, mm4
- por mm7, mm6
-
- por mm0, mm1
- por mm0, mm7 ; abs(q3-q2) > limit || abs(p3-p2) > limit ||abs(p2-p1) > limit || abs(q2-q1) > limit
-
- movq mm1, mm5 ; p1
-
- movq mm7, mm3 ; mm3=mm7=p0
- psubusb mm7, mm5 ; p0 - p1
-
- psubusb mm5, mm3 ; p1 - p0
- por mm5, mm7 ; abs(p1-p0)
-
- movq t0, mm5 ; save abs(p1-p0)
- lea rdx, srct
-
- psubusb mm5, mm4
- por mm0, mm5 ; mm0=mask
-
- movq mm5, [rdx+16] ; mm5=q0
- movq mm7, [rdx+24] ; mm7=q1
-
- movq mm6, mm5 ; mm6=q0
- movq mm2, mm7 ; q1
- psubusb mm5, mm7 ; q0-q1
-
- psubusb mm7, mm6 ; q1-q0
- por mm7, mm5 ; abs(q1-q0)
-
- movq t1, mm7 ; save abs(q1-q0)
- psubusb mm7, mm4
-
- por mm0, mm7 ; mask
-
- movq mm5, mm2 ; q1
- psubusb mm5, mm1 ; q1-=p1
- psubusb mm1, mm2 ; p1-=q1
- por mm5, mm1 ; abs(p1-q1)
- pand mm5, [GLOBAL(tfe)] ; set lsb of each byte to zero
- psrlw mm5, 1 ; abs(p1-q1)/2
-
- mov rdx, arg(2) ;blimit ;
-
- movq mm4, [rdx] ;blimit
- movq mm1, mm3 ; mm1=mm3=p0
-
- movq mm7, mm6 ; mm7=mm6=q0
- psubusb mm1, mm7 ; p0-q0
-
- psubusb mm7, mm3 ; q0-p0
- por mm1, mm7 ; abs(q0-p0)
- paddusb mm1, mm1 ; abs(q0-p0)*2
- paddusb mm1, mm5 ; abs (p0 - q0) *2 + abs(p1-q1)/2
-
- psubusb mm1, mm4 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > blimit
- por mm1, mm0; ; mask
-
- pxor mm0, mm0
- pcmpeqb mm1, mm0
-
- ; calculate high edge variance
- mov rdx, arg(4) ;thresh ; get thresh
- movq mm7, [rdx]
- ;
- movq mm4, t0 ; get abs (q1 - q0)
- psubusb mm4, mm7
-
- movq mm3, t1 ; get abs (p1 - p0)
- psubusb mm3, mm7
-
- por mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh
- pcmpeqb mm4, mm0
-
- pcmpeqb mm0, mm0
- pxor mm4, mm0
-
-
-
- ; start work on filters
- lea rdx, srct
-
- movq mm2, [rdx] ; p1
- movq mm7, [rdx+24] ; q1
-
- movq mm6, [rdx+8] ; p0
- movq mm0, [rdx+16] ; q0
-
- pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values
- pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values
-
- psubsb mm2, mm7 ; p1 - q1
- pand mm2, mm4 ; high var mask (hvm)(p1 - q1)
-
- pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values
- pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values
-
- movq mm3, mm0 ; q0
- psubsb mm0, mm6 ; q0 - p0
-
- paddsb mm2, mm0 ; 1 * (q0 - p0) + hvm(p1 - q1)
- paddsb mm2, mm0 ; 2 * (q0 - p0) + hvm(p1 - q1)
-
- paddsb mm2, mm0 ; 3 * (q0 - p0) + hvm(p1 - q1)
- pand mm1, mm2 ; mask filter values we don't care about
-
- movq mm2, mm1
- paddsb mm1, [GLOBAL(t4)] ; 3* (q0 - p0) + hvm(p1 - q1) + 4
-
- paddsb mm2, [GLOBAL(t3)] ; 3* (q0 - p0) + hvm(p1 - q1) + 3
- pxor mm0, mm0 ;
-
- pxor mm5, mm5
- punpcklbw mm0, mm2 ;
-
- punpckhbw mm5, mm2 ;
- psraw mm0, 11 ;
-
- psraw mm5, 11
- packsswb mm0, mm5
-
- movq mm2, mm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
-
- pxor mm0, mm0 ; 0
- movq mm5, mm1 ; abcdefgh
-
- punpcklbw mm0, mm1 ; e0f0g0h0
- psraw mm0, 11 ; sign extended shift right by 3
-
- pxor mm1, mm1 ; 0
- punpckhbw mm1, mm5 ; a0b0c0d0
-
- psraw mm1, 11 ; sign extended shift right by 3
- movq mm5, mm0 ; save results
-
- packsswb mm0, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3
- paddsw mm5, [GLOBAL(ones)]
-
- paddsw mm1, [GLOBAL(ones)]
- psraw mm5, 1 ; partial shifted one more time for 2nd tap
-
- psraw mm1, 1 ; partial shifted one more time for 2nd tap
- packsswb mm5, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4
-
- pandn mm4, mm5 ; high edge variance additive
-
- paddsb mm6, mm2 ; p0+= p0 add
- pxor mm6, [GLOBAL(t80)] ; unoffset
-
- ; mm6=p0 ;
- movq mm1, [rdx] ; p1
- pxor mm1, [GLOBAL(t80)] ; reoffset
-
- paddsb mm1, mm4 ; p1+= p1 add
- pxor mm1, [GLOBAL(t80)] ; unoffset
- ; mm6 = p0 mm1 = p1
-
- psubsb mm3, mm0 ; q0-= q0 add
- pxor mm3, [GLOBAL(t80)] ; unoffset
-
- ; mm3 = q0
- psubsb mm7, mm4 ; q1-= q1 add
- pxor mm7, [GLOBAL(t80)] ; unoffset
- ; mm7 = q1
-
- ; transpose and write back
- ; mm1 = 72 62 52 42 32 22 12 02
- ; mm6 = 73 63 53 43 33 23 13 03
- ; mm3 = 74 64 54 44 34 24 14 04
- ; mm7 = 75 65 55 45 35 25 15 05
-
- movq mm2, mm1 ; 72 62 52 42 32 22 12 02
- punpcklbw mm2, mm6 ; 33 32 23 22 13 12 03 02
-
- movq mm4, mm3 ; 74 64 54 44 34 24 14 04
- punpckhbw mm1, mm6 ; 73 72 63 62 53 52 43 42
-
- punpcklbw mm4, mm7 ; 35 34 25 24 15 14 05 04
- punpckhbw mm3, mm7 ; 75 74 65 64 55 54 45 44
-
- movq mm6, mm2 ; 33 32 23 22 13 12 03 02
- punpcklwd mm2, mm4 ; 15 14 13 12 05 04 03 02
-
- punpckhwd mm6, mm4 ; 35 34 33 32 25 24 23 22
- movq mm5, mm1 ; 73 72 63 62 53 52 43 42
-
- punpcklwd mm1, mm3 ; 55 54 53 52 45 44 43 42
- punpckhwd mm5, mm3 ; 75 74 73 72 65 64 63 62
-
-
- ; mm2 = 15 14 13 12 05 04 03 02
- ; mm6 = 35 34 33 32 25 24 23 22
- ; mm5 = 55 54 53 52 45 44 43 42
- ; mm1 = 75 74 73 72 65 64 63 62
-
-
-
- movd [rsi+rax*4+2], mm2
- psrlq mm2, 32
-
- movd [rdi+rax*4+2], mm2
- movd [rsi+rax*2+2], mm6
-
- psrlq mm6, 32
- movd [rsi+rax+2],mm6
-
- movd [rsi+2], mm1
- psrlq mm1, 32
-
- movd [rdi+2], mm1
- neg rax
-
- movd [rdi+rax+2],mm5
- psrlq mm5, 32
-
- movd [rdi+rax*2+2], mm5
-
- lea rsi, [rsi+rax*8]
- dec rcx
- jnz .next8_v
-
- add rsp, 64
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-tfe:
- times 8 db 0xfe
-align 16
-t80:
- times 8 db 0x80
-align 16
-t1s:
- times 8 db 0x01
-align 16
-t3:
- times 8 db 0x03
-align 16
-t4:
- times 8 db 0x04
-align 16
-ones:
- times 4 dw 0x0001
-align 16
-s27:
- times 4 dw 0x1b00
-align 16
-s18:
- times 4 dw 0x1200
-align 16
-s9:
- times 4 dw 0x0900
-align 16
-s63:
- times 4 dw 0x003f
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_mmx.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_mmx.asm
deleted file mode 100644
index c2118db..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_mmx.asm
+++ /dev/null
@@ -1,534 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%define VP9_FILTER_WEIGHT 128
-%define VP9_FILTER_SHIFT 7
-
-;void vp9_post_proc_down_and_across_mmx
-;(
-; unsigned char *src_ptr,
-; unsigned char *dst_ptr,
-; int src_pixels_per_line,
-; int dst_pixels_per_line,
-; int rows,
-; int cols,
-; int flimit
-;)
-global sym(vp9_post_proc_down_and_across_mmx) PRIVATE
-sym(vp9_post_proc_down_and_across_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=1 && CONFIG_PIC=1
- ; move the global rd onto the stack, since we don't have enough registers
- ; to do PIC addressing
- movq mm0, [GLOBAL(rd)]
- sub rsp, 8
- movq [rsp], mm0
-%define RD [rsp]
-%else
-%define RD [GLOBAL(rd)]
-%endif
-
- push rbx
- lea rbx, [GLOBAL(Blur)]
- movd mm2, dword ptr arg(6) ;flimit
- punpcklwd mm2, mm2
- punpckldq mm2, mm2
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;dst_ptr
-
- movsxd rcx, DWORD PTR arg(4) ;rows
- movsxd rax, DWORD PTR arg(2) ;src_pixels_per_line ; destination pitch?
- pxor mm0, mm0 ; mm0 = 00000000
-
-.nextrow:
-
- xor rdx, rdx ; clear out rdx for use as loop counter
-.nextcol:
-
- pxor mm7, mm7 ; mm7 = 00000000
- movq mm6, [rbx + 32 ] ; mm6 = kernel 2 taps
- movq mm3, [rsi] ; mm4 = r0 p0..p7
- punpcklbw mm3, mm0 ; mm3 = p0..p3
- movq mm1, mm3 ; mm1 = p0..p3
- pmullw mm3, mm6 ; mm3 *= kernel 2 modifiers
-
- movq mm6, [rbx + 48] ; mm6 = kernel 3 taps
- movq mm5, [rsi + rax] ; mm4 = r1 p0..p7
- punpcklbw mm5, mm0 ; mm5 = r1 p0..p3
- pmullw mm6, mm5 ; mm6 *= p0..p3 * kernel 3 modifiers
- paddusw mm3, mm6 ; mm3 += mm6
-
- ; thresholding
- movq mm7, mm1 ; mm7 = r0 p0..p3
- psubusw mm7, mm5 ; mm7 = r0 p0..p3 - r1 p0..p3
- psubusw mm5, mm1 ; mm5 = r1 p0..p3 - r0 p0..p3
- paddusw mm7, mm5 ; mm7 = abs(r0 p0..p3 - r1 p0..p3)
- pcmpgtw mm7, mm2
-
- movq mm6, [rbx + 64 ] ; mm6 = kernel 4 modifiers
- movq mm5, [rsi + 2*rax] ; mm4 = r2 p0..p7
- punpcklbw mm5, mm0 ; mm5 = r2 p0..p3
- pmullw mm6, mm5 ; mm5 *= kernel 4 modifiers
- paddusw mm3, mm6 ; mm3 += mm5
-
- ; thresholding
- movq mm6, mm1 ; mm6 = r0 p0..p3
- psubusw mm6, mm5 ; mm6 = r0 p0..p3 - r2 p0..p3
- psubusw mm5, mm1 ; mm5 = r2 p0..p3 - r2 p0..p3
- paddusw mm6, mm5 ; mm6 = abs(r0 p0..p3 - r2 p0..p3)
- pcmpgtw mm6, mm2
- por mm7, mm6 ; accumulate thresholds
-
-
- neg rax
- movq mm6, [rbx ] ; kernel 0 taps
- movq mm5, [rsi+2*rax] ; mm4 = r-2 p0..p7
- punpcklbw mm5, mm0 ; mm5 = r-2 p0..p3
- pmullw mm6, mm5 ; mm5 *= kernel 0 modifiers
- paddusw mm3, mm6 ; mm3 += mm5
-
- ; thresholding
- movq mm6, mm1 ; mm6 = r0 p0..p3
- psubusw mm6, mm5 ; mm6 = p0..p3 - r-2 p0..p3
- psubusw mm5, mm1 ; mm5 = r-2 p0..p3 - p0..p3
- paddusw mm6, mm5 ; mm6 = abs(r0 p0..p3 - r-2 p0..p3)
- pcmpgtw mm6, mm2
- por mm7, mm6 ; accumulate thresholds
-
- movq mm6, [rbx + 16] ; kernel 1 taps
- movq mm4, [rsi+rax] ; mm4 = r-1 p0..p7
- punpcklbw mm4, mm0 ; mm4 = r-1 p0..p3
- pmullw mm6, mm4 ; mm4 *= kernel 1 modifiers.
- paddusw mm3, mm6 ; mm3 += mm5
-
- ; thresholding
- movq mm6, mm1 ; mm6 = r0 p0..p3
- psubusw mm6, mm4 ; mm6 = p0..p3 - r-2 p0..p3
- psubusw mm4, mm1 ; mm5 = r-1 p0..p3 - p0..p3
- paddusw mm6, mm4 ; mm6 = abs(r0 p0..p3 - r-1 p0..p3)
- pcmpgtw mm6, mm2
- por mm7, mm6 ; accumulate thresholds
-
-
- paddusw mm3, RD ; mm3 += round value
- psraw mm3, VP9_FILTER_SHIFT ; mm3 /= 128
-
- pand mm1, mm7 ; mm1 select vals > thresh from source
- pandn mm7, mm3 ; mm7 select vals < thresh from blurred result
- paddusw mm1, mm7 ; combination
-
- packuswb mm1, mm0 ; pack to bytes
-
- movd [rdi], mm1 ;
- neg rax ; pitch is positive
-
-
- add rsi, 4
- add rdi, 4
- add rdx, 4
-
- cmp edx, dword ptr arg(5) ;cols
- jl .nextcol
- ; done with the all cols, start the across filtering in place
- sub rsi, rdx
- sub rdi, rdx
-
-
- push rax
- xor rdx, rdx
- mov rax, [rdi-4];
-
-.acrossnextcol:
- pxor mm7, mm7 ; mm7 = 00000000
- movq mm6, [rbx + 32 ] ;
- movq mm4, [rdi+rdx] ; mm4 = p0..p7
- movq mm3, mm4 ; mm3 = p0..p7
- punpcklbw mm3, mm0 ; mm3 = p0..p3
- movq mm1, mm3 ; mm1 = p0..p3
- pmullw mm3, mm6 ; mm3 *= kernel 2 modifiers
-
- movq mm6, [rbx + 48]
- psrlq mm4, 8 ; mm4 = p1..p7
- movq mm5, mm4 ; mm5 = p1..p7
- punpcklbw mm5, mm0 ; mm5 = p1..p4
- pmullw mm6, mm5 ; mm6 *= p1..p4 * kernel 3 modifiers
- paddusw mm3, mm6 ; mm3 += mm6
-
- ; thresholding
- movq mm7, mm1 ; mm7 = p0..p3
- psubusw mm7, mm5 ; mm7 = p0..p3 - p1..p4
- psubusw mm5, mm1 ; mm5 = p1..p4 - p0..p3
- paddusw mm7, mm5 ; mm7 = abs(p0..p3 - p1..p4)
- pcmpgtw mm7, mm2
-
- movq mm6, [rbx + 64 ]
- psrlq mm4, 8 ; mm4 = p2..p7
- movq mm5, mm4 ; mm5 = p2..p7
- punpcklbw mm5, mm0 ; mm5 = p2..p5
- pmullw mm6, mm5 ; mm5 *= kernel 4 modifiers
- paddusw mm3, mm6 ; mm3 += mm5
-
- ; thresholding
- movq mm6, mm1 ; mm6 = p0..p3
- psubusw mm6, mm5 ; mm6 = p0..p3 - p1..p4
- psubusw mm5, mm1 ; mm5 = p1..p4 - p0..p3
- paddusw mm6, mm5 ; mm6 = abs(p0..p3 - p1..p4)
- pcmpgtw mm6, mm2
- por mm7, mm6 ; accumulate thresholds
-
-
- movq mm6, [rbx ]
- movq mm4, [rdi+rdx-2] ; mm4 = p-2..p5
- movq mm5, mm4 ; mm5 = p-2..p5
- punpcklbw mm5, mm0 ; mm5 = p-2..p1
- pmullw mm6, mm5 ; mm5 *= kernel 0 modifiers
- paddusw mm3, mm6 ; mm3 += mm5
-
- ; thresholding
- movq mm6, mm1 ; mm6 = p0..p3
- psubusw mm6, mm5 ; mm6 = p0..p3 - p1..p4
- psubusw mm5, mm1 ; mm5 = p1..p4 - p0..p3
- paddusw mm6, mm5 ; mm6 = abs(p0..p3 - p1..p4)
- pcmpgtw mm6, mm2
- por mm7, mm6 ; accumulate thresholds
-
- movq mm6, [rbx + 16]
- psrlq mm4, 8 ; mm4 = p-1..p5
- punpcklbw mm4, mm0 ; mm4 = p-1..p2
- pmullw mm6, mm4 ; mm4 *= kernel 1 modifiers.
- paddusw mm3, mm6 ; mm3 += mm5
-
- ; thresholding
- movq mm6, mm1 ; mm6 = p0..p3
- psubusw mm6, mm4 ; mm6 = p0..p3 - p1..p4
- psubusw mm4, mm1 ; mm5 = p1..p4 - p0..p3
- paddusw mm6, mm4 ; mm6 = abs(p0..p3 - p1..p4)
- pcmpgtw mm6, mm2
- por mm7, mm6 ; accumulate thresholds
-
- paddusw mm3, RD ; mm3 += round value
- psraw mm3, VP9_FILTER_SHIFT ; mm3 /= 128
-
- pand mm1, mm7 ; mm1 select vals > thresh from source
- pandn mm7, mm3 ; mm7 select vals < thresh from blurred result
- paddusw mm1, mm7 ; combination
-
- packuswb mm1, mm0 ; pack to bytes
- mov DWORD PTR [rdi+rdx-4], eax ; store previous four bytes
- movd eax, mm1
-
- add rdx, 4
- cmp edx, dword ptr arg(5) ;cols
- jl .acrossnextcol;
-
- mov DWORD PTR [rdi+rdx-4], eax
- pop rax
-
- ; done with this rwo
- add rsi,rax ; next line
- movsxd rax, dword ptr arg(3) ;dst_pixels_per_line ; destination pitch?
- add rdi,rax ; next destination
- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; destination pitch?
-
- dec rcx ; decrement count
- jnz .nextrow ; next row
- pop rbx
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef RD
-
-
-;void vp9_mbpost_proc_down_mmx(unsigned char *dst,
-; int pitch, int rows, int cols,int flimit)
-extern sym(vp9_rv)
-global sym(vp9_mbpost_proc_down_mmx) PRIVATE
-sym(vp9_mbpost_proc_down_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 136
-
- ; unsigned char d[16][8] at [rsp]
- ; create flimit2 at [rsp+128]
- mov eax, dword ptr arg(4) ;flimit
- mov [rsp+128], eax
- mov [rsp+128+4], eax
-%define flimit2 [rsp+128]
-
-%if ABI_IS_32BIT=0
- lea r8, [GLOBAL(sym(vp9_rv))]
-%endif
-
- ;rows +=8;
- add dword ptr arg(2), 8
-
- ;for(c=0; c<cols; c+=4)
-.loop_col:
- mov rsi, arg(0) ;s
- pxor mm0, mm0 ;
-
- movsxd rax, dword ptr arg(1) ;pitch ;
- neg rax ; rax = -pitch
-
- lea rsi, [rsi + rax*8]; ; rdi = s[-pitch*8]
- neg rax
-
-
- pxor mm5, mm5
- pxor mm6, mm6 ;
-
- pxor mm7, mm7 ;
- mov rdi, rsi
-
- mov rcx, 15 ;
-
-.loop_initvar:
- movd mm1, DWORD PTR [rdi];
- punpcklbw mm1, mm0 ;
-
- paddw mm5, mm1 ;
- pmullw mm1, mm1 ;
-
- movq mm2, mm1 ;
- punpcklwd mm1, mm0 ;
-
- punpckhwd mm2, mm0 ;
- paddd mm6, mm1 ;
-
- paddd mm7, mm2 ;
- lea rdi, [rdi+rax] ;
-
- dec rcx
- jne .loop_initvar
- ;save the var and sum
- xor rdx, rdx
-.loop_row:
- movd mm1, DWORD PTR [rsi] ; [s-pitch*8]
- movd mm2, DWORD PTR [rdi] ; [s+pitch*7]
-
- punpcklbw mm1, mm0
- punpcklbw mm2, mm0
-
- paddw mm5, mm2
- psubw mm5, mm1
-
- pmullw mm2, mm2
- movq mm4, mm2
-
- punpcklwd mm2, mm0
- punpckhwd mm4, mm0
-
- paddd mm6, mm2
- paddd mm7, mm4
-
- pmullw mm1, mm1
- movq mm2, mm1
-
- punpcklwd mm1, mm0
- psubd mm6, mm1
-
- punpckhwd mm2, mm0
- psubd mm7, mm2
-
-
- movq mm3, mm6
- pslld mm3, 4
-
- psubd mm3, mm6
- movq mm1, mm5
-
- movq mm4, mm5
- pmullw mm1, mm1
-
- pmulhw mm4, mm4
- movq mm2, mm1
-
- punpcklwd mm1, mm4
- punpckhwd mm2, mm4
-
- movq mm4, mm7
- pslld mm4, 4
-
- psubd mm4, mm7
-
- psubd mm3, mm1
- psubd mm4, mm2
-
- psubd mm3, flimit2
- psubd mm4, flimit2
-
- psrad mm3, 31
- psrad mm4, 31
-
- packssdw mm3, mm4
- packsswb mm3, mm0
-
- movd mm1, DWORD PTR [rsi+rax*8]
-
- movq mm2, mm1
- punpcklbw mm1, mm0
-
- paddw mm1, mm5
- mov rcx, rdx
-
- and rcx, 127
-%if ABI_IS_32BIT=1 && CONFIG_PIC=1
- push rax
- lea rax, [GLOBAL(sym(vp9_rv))]
- movq mm4, [rax + rcx*2] ;vp9_rv[rcx*2]
- pop rax
-%elif ABI_IS_32BIT=0
- movq mm4, [r8 + rcx*2] ;vp9_rv[rcx*2]
-%else
- movq mm4, [sym(vp9_rv) + rcx*2]
-%endif
- paddw mm1, mm4
- ;paddw xmm1, eight8s
- psraw mm1, 4
-
- packuswb mm1, mm0
- pand mm1, mm3
-
- pandn mm3, mm2
- por mm1, mm3
-
- and rcx, 15
- movd DWORD PTR [rsp+rcx*4], mm1 ;d[rcx*4]
-
- mov rcx, rdx
- sub rcx, 8
-
- and rcx, 15
- movd mm1, DWORD PTR [rsp+rcx*4] ;d[rcx*4]
-
- movd [rsi], mm1
- lea rsi, [rsi+rax]
-
- lea rdi, [rdi+rax]
- add rdx, 1
-
- cmp edx, dword arg(2) ;rows
- jl .loop_row
-
-
- add dword arg(0), 4 ; s += 4
- sub dword arg(3), 4 ; cols -= 4
- cmp dword arg(3), 0
- jg .loop_col
-
- add rsp, 136
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef flimit2
-
-
-;void vp9_plane_add_noise_mmx (unsigned char *start, unsigned char *noise,
-; unsigned char blackclamp[16],
-; unsigned char whiteclamp[16],
-; unsigned char bothclamp[16],
-; unsigned int width, unsigned int height, int pitch)
-extern sym(rand)
-global sym(vp9_plane_add_noise_mmx) PRIVATE
-sym(vp9_plane_add_noise_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-.addnoise_loop:
- call sym(rand) WRT_PLT
- mov rcx, arg(1) ;noise
- and rax, 0xff
- add rcx, rax
-
- ; we rely on the fact that the clamping vectors are stored contiguously
- ; in black/white/both order. Note that we have to reload this here because
- ; rdx could be trashed by rand()
- mov rdx, arg(2) ; blackclamp
-
-
- mov rdi, rcx
- movsxd rcx, dword arg(5) ;[Width]
- mov rsi, arg(0) ;Pos
- xor rax,rax
-
-.addnoise_nextset:
- movq mm1,[rsi+rax] ; get the source
-
- psubusb mm1, [rdx] ;blackclamp ; clamp both sides so we don't outrange adding noise
- paddusb mm1, [rdx+32] ;bothclamp
- psubusb mm1, [rdx+16] ;whiteclamp
-
- movq mm2,[rdi+rax] ; get the noise for this line
- paddb mm1,mm2 ; add it in
- movq [rsi+rax],mm1 ; store the result
-
- add rax,8 ; move to the next line
-
- cmp rax, rcx
- jl .addnoise_nextset
-
- movsxd rax, dword arg(7) ; Pitch
- add arg(0), rax ; Start += Pitch
- sub dword arg(6), 1 ; Height -= 1
- jg .addnoise_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-SECTION_RODATA
-align 16
-Blur:
- times 16 dw 16
- times 8 dw 64
- times 16 dw 16
- times 8 dw 0
-
-rd:
- times 4 dw 0x40
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_sse2.asm
deleted file mode 100644
index 858fc99..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_sse2.asm
+++ /dev/null
@@ -1,695 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp9_post_proc_down_and_across_xmm
-;(
-; unsigned char *src_ptr,
-; unsigned char *dst_ptr,
-; int src_pixels_per_line,
-; int dst_pixels_per_line,
-; int rows,
-; int cols,
-; int flimit
-;)
-global sym(vp9_post_proc_down_and_across_xmm) PRIVATE
-sym(vp9_post_proc_down_and_across_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=1 && CONFIG_PIC=1
- ALIGN_STACK 16, rax
- ; move the global rd onto the stack, since we don't have enough registers
- ; to do PIC addressing
- movdqa xmm0, [GLOBAL(rd42)]
- sub rsp, 16
- movdqa [rsp], xmm0
-%define RD42 [rsp]
-%else
-%define RD42 [GLOBAL(rd42)]
-%endif
-
-
- movd xmm2, dword ptr arg(6) ;flimit
- punpcklwd xmm2, xmm2
- punpckldq xmm2, xmm2
- punpcklqdq xmm2, xmm2
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;dst_ptr
-
- movsxd rcx, DWORD PTR arg(4) ;rows
- movsxd rax, DWORD PTR arg(2) ;src_pixels_per_line ; destination pitch?
- pxor xmm0, xmm0 ; mm0 = 00000000
-
-.nextrow:
-
- xor rdx, rdx ; clear out rdx for use as loop counter
-.nextcol:
- movq xmm3, QWORD PTR [rsi] ; mm4 = r0 p0..p7
- punpcklbw xmm3, xmm0 ; mm3 = p0..p3
- movdqa xmm1, xmm3 ; mm1 = p0..p3
- psllw xmm3, 2 ;
-
- movq xmm5, QWORD PTR [rsi + rax] ; mm4 = r1 p0..p7
- punpcklbw xmm5, xmm0 ; mm5 = r1 p0..p3
- paddusw xmm3, xmm5 ; mm3 += mm6
-
- ; thresholding
- movdqa xmm7, xmm1 ; mm7 = r0 p0..p3
- psubusw xmm7, xmm5 ; mm7 = r0 p0..p3 - r1 p0..p3
- psubusw xmm5, xmm1 ; mm5 = r1 p0..p3 - r0 p0..p3
- paddusw xmm7, xmm5 ; mm7 = abs(r0 p0..p3 - r1 p0..p3)
- pcmpgtw xmm7, xmm2
-
- movq xmm5, QWORD PTR [rsi + 2*rax] ; mm4 = r2 p0..p7
- punpcklbw xmm5, xmm0 ; mm5 = r2 p0..p3
- paddusw xmm3, xmm5 ; mm3 += mm5
-
- ; thresholding
- movdqa xmm6, xmm1 ; mm6 = r0 p0..p3
- psubusw xmm6, xmm5 ; mm6 = r0 p0..p3 - r2 p0..p3
- psubusw xmm5, xmm1 ; mm5 = r2 p0..p3 - r2 p0..p3
- paddusw xmm6, xmm5 ; mm6 = abs(r0 p0..p3 - r2 p0..p3)
- pcmpgtw xmm6, xmm2
- por xmm7, xmm6 ; accumulate thresholds
-
-
- neg rax
- movq xmm5, QWORD PTR [rsi+2*rax] ; mm4 = r-2 p0..p7
- punpcklbw xmm5, xmm0 ; mm5 = r-2 p0..p3
- paddusw xmm3, xmm5 ; mm3 += mm5
-
- ; thresholding
- movdqa xmm6, xmm1 ; mm6 = r0 p0..p3
- psubusw xmm6, xmm5 ; mm6 = p0..p3 - r-2 p0..p3
- psubusw xmm5, xmm1 ; mm5 = r-2 p0..p3 - p0..p3
- paddusw xmm6, xmm5 ; mm6 = abs(r0 p0..p3 - r-2 p0..p3)
- pcmpgtw xmm6, xmm2
- por xmm7, xmm6 ; accumulate thresholds
-
- movq xmm4, QWORD PTR [rsi+rax] ; mm4 = r-1 p0..p7
- punpcklbw xmm4, xmm0 ; mm4 = r-1 p0..p3
- paddusw xmm3, xmm4 ; mm3 += mm5
-
- ; thresholding
- movdqa xmm6, xmm1 ; mm6 = r0 p0..p3
- psubusw xmm6, xmm4 ; mm6 = p0..p3 - r-2 p0..p3
- psubusw xmm4, xmm1 ; mm5 = r-1 p0..p3 - p0..p3
- paddusw xmm6, xmm4 ; mm6 = abs(r0 p0..p3 - r-1 p0..p3)
- pcmpgtw xmm6, xmm2
- por xmm7, xmm6 ; accumulate thresholds
-
-
- paddusw xmm3, RD42 ; mm3 += round value
- psraw xmm3, 3 ; mm3 /= 8
-
- pand xmm1, xmm7 ; mm1 select vals > thresh from source
- pandn xmm7, xmm3 ; mm7 select vals < thresh from blurred result
- paddusw xmm1, xmm7 ; combination
-
- packuswb xmm1, xmm0 ; pack to bytes
- movq QWORD PTR [rdi], xmm1 ;
-
- neg rax ; pitch is positive
- add rsi, 8
- add rdi, 8
-
- add rdx, 8
- cmp edx, dword arg(5) ;cols
-
- jl .nextcol
-
- ; done with the all cols, start the across filtering in place
- sub rsi, rdx
- sub rdi, rdx
-
- xor rdx, rdx
- movq mm0, QWORD PTR [rdi-8];
-
-.acrossnextcol:
- movq xmm7, QWORD PTR [rdi +rdx -2]
- movd xmm4, DWORD PTR [rdi +rdx +6]
-
- pslldq xmm4, 8
- por xmm4, xmm7
-
- movdqa xmm3, xmm4
- psrldq xmm3, 2
- punpcklbw xmm3, xmm0 ; mm3 = p0..p3
- movdqa xmm1, xmm3 ; mm1 = p0..p3
- psllw xmm3, 2
-
-
- movdqa xmm5, xmm4
- psrldq xmm5, 3
- punpcklbw xmm5, xmm0 ; mm5 = p1..p4
- paddusw xmm3, xmm5 ; mm3 += mm6
-
- ; thresholding
- movdqa xmm7, xmm1 ; mm7 = p0..p3
- psubusw xmm7, xmm5 ; mm7 = p0..p3 - p1..p4
- psubusw xmm5, xmm1 ; mm5 = p1..p4 - p0..p3
- paddusw xmm7, xmm5 ; mm7 = abs(p0..p3 - p1..p4)
- pcmpgtw xmm7, xmm2
-
- movdqa xmm5, xmm4
- psrldq xmm5, 4
- punpcklbw xmm5, xmm0 ; mm5 = p2..p5
- paddusw xmm3, xmm5 ; mm3 += mm5
-
- ; thresholding
- movdqa xmm6, xmm1 ; mm6 = p0..p3
- psubusw xmm6, xmm5 ; mm6 = p0..p3 - p1..p4
- psubusw xmm5, xmm1 ; mm5 = p1..p4 - p0..p3
- paddusw xmm6, xmm5 ; mm6 = abs(p0..p3 - p1..p4)
- pcmpgtw xmm6, xmm2
- por xmm7, xmm6 ; accumulate thresholds
-
-
- movdqa xmm5, xmm4 ; mm5 = p-2..p5
- punpcklbw xmm5, xmm0 ; mm5 = p-2..p1
- paddusw xmm3, xmm5 ; mm3 += mm5
-
- ; thresholding
- movdqa xmm6, xmm1 ; mm6 = p0..p3
- psubusw xmm6, xmm5 ; mm6 = p0..p3 - p1..p4
- psubusw xmm5, xmm1 ; mm5 = p1..p4 - p0..p3
- paddusw xmm6, xmm5 ; mm6 = abs(p0..p3 - p1..p4)
- pcmpgtw xmm6, xmm2
- por xmm7, xmm6 ; accumulate thresholds
-
- psrldq xmm4, 1 ; mm4 = p-1..p5
- punpcklbw xmm4, xmm0 ; mm4 = p-1..p2
- paddusw xmm3, xmm4 ; mm3 += mm5
-
- ; thresholding
- movdqa xmm6, xmm1 ; mm6 = p0..p3
- psubusw xmm6, xmm4 ; mm6 = p0..p3 - p1..p4
- psubusw xmm4, xmm1 ; mm5 = p1..p4 - p0..p3
- paddusw xmm6, xmm4 ; mm6 = abs(p0..p3 - p1..p4)
- pcmpgtw xmm6, xmm2
- por xmm7, xmm6 ; accumulate thresholds
-
- paddusw xmm3, RD42 ; mm3 += round value
- psraw xmm3, 3 ; mm3 /= 8
-
- pand xmm1, xmm7 ; mm1 select vals > thresh from source
- pandn xmm7, xmm3 ; mm7 select vals < thresh from blurred result
- paddusw xmm1, xmm7 ; combination
-
- packuswb xmm1, xmm0 ; pack to bytes
- movq QWORD PTR [rdi+rdx-8], mm0 ; store previous four bytes
- movdq2q mm0, xmm1
-
- add rdx, 8
- cmp edx, dword arg(5) ;cols
- jl .acrossnextcol;
-
- ; last 8 pixels
- movq QWORD PTR [rdi+rdx-8], mm0
-
- ; done with this rwo
- add rsi,rax ; next line
- mov eax, dword arg(3) ;dst_pixels_per_line ; destination pitch?
- add rdi,rax ; next destination
- mov eax, dword arg(2) ;src_pixels_per_line ; destination pitch?
-
- dec rcx ; decrement count
- jnz .nextrow ; next row
-
-%if ABI_IS_32BIT=1 && CONFIG_PIC=1
- add rsp,16
- pop rsp
-%endif
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef RD42
-
-
-;void vp9_mbpost_proc_down_xmm(unsigned char *dst,
-; int pitch, int rows, int cols,int flimit)
-extern sym(vp9_rv)
-global sym(vp9_mbpost_proc_down_xmm) PRIVATE
-sym(vp9_mbpost_proc_down_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 128+16
-
- ; unsigned char d[16][8] at [rsp]
- ; create flimit2 at [rsp+128]
- mov eax, dword ptr arg(4) ;flimit
- mov [rsp+128], eax
- mov [rsp+128+4], eax
- mov [rsp+128+8], eax
- mov [rsp+128+12], eax
-%define flimit4 [rsp+128]
-
-%if ABI_IS_32BIT=0
- lea r8, [GLOBAL(sym(vp9_rv))]
-%endif
-
- ;rows +=8;
- add dword arg(2), 8
-
- ;for(c=0; c<cols; c+=8)
-.loop_col:
- mov rsi, arg(0) ; s
- pxor xmm0, xmm0 ;
-
- movsxd rax, dword ptr arg(1) ;pitch ;
- neg rax ; rax = -pitch
-
- lea rsi, [rsi + rax*8]; ; rdi = s[-pitch*8]
- neg rax
-
-
- pxor xmm5, xmm5
- pxor xmm6, xmm6 ;
-
- pxor xmm7, xmm7 ;
- mov rdi, rsi
-
- mov rcx, 15 ;
-
-.loop_initvar:
- movq xmm1, QWORD PTR [rdi];
- punpcklbw xmm1, xmm0 ;
-
- paddw xmm5, xmm1 ;
- pmullw xmm1, xmm1 ;
-
- movdqa xmm2, xmm1 ;
- punpcklwd xmm1, xmm0 ;
-
- punpckhwd xmm2, xmm0 ;
- paddd xmm6, xmm1 ;
-
- paddd xmm7, xmm2 ;
- lea rdi, [rdi+rax] ;
-
- dec rcx
- jne .loop_initvar
- ;save the var and sum
- xor rdx, rdx
-.loop_row:
- movq xmm1, QWORD PTR [rsi] ; [s-pitch*8]
- movq xmm2, QWORD PTR [rdi] ; [s+pitch*7]
-
- punpcklbw xmm1, xmm0
- punpcklbw xmm2, xmm0
-
- paddw xmm5, xmm2
- psubw xmm5, xmm1
-
- pmullw xmm2, xmm2
- movdqa xmm4, xmm2
-
- punpcklwd xmm2, xmm0
- punpckhwd xmm4, xmm0
-
- paddd xmm6, xmm2
- paddd xmm7, xmm4
-
- pmullw xmm1, xmm1
- movdqa xmm2, xmm1
-
- punpcklwd xmm1, xmm0
- psubd xmm6, xmm1
-
- punpckhwd xmm2, xmm0
- psubd xmm7, xmm2
-
-
- movdqa xmm3, xmm6
- pslld xmm3, 4
-
- psubd xmm3, xmm6
- movdqa xmm1, xmm5
-
- movdqa xmm4, xmm5
- pmullw xmm1, xmm1
-
- pmulhw xmm4, xmm4
- movdqa xmm2, xmm1
-
- punpcklwd xmm1, xmm4
- punpckhwd xmm2, xmm4
-
- movdqa xmm4, xmm7
- pslld xmm4, 4
-
- psubd xmm4, xmm7
-
- psubd xmm3, xmm1
- psubd xmm4, xmm2
-
- psubd xmm3, flimit4
- psubd xmm4, flimit4
-
- psrad xmm3, 31
- psrad xmm4, 31
-
- packssdw xmm3, xmm4
- packsswb xmm3, xmm0
-
- movq xmm1, QWORD PTR [rsi+rax*8]
-
- movq xmm2, xmm1
- punpcklbw xmm1, xmm0
-
- paddw xmm1, xmm5
- mov rcx, rdx
-
- and rcx, 127
-%if ABI_IS_32BIT=1 && CONFIG_PIC=1
- push rax
- lea rax, [GLOBAL(sym(vp9_rv))]
- movdqu xmm4, [rax + rcx*2] ;vp9_rv[rcx*2]
- pop rax
-%elif ABI_IS_32BIT=0
- movdqu xmm4, [r8 + rcx*2] ;vp9_rv[rcx*2]
-%else
- movdqu xmm4, [sym(vp9_rv) + rcx*2]
-%endif
-
- paddw xmm1, xmm4
- ;paddw xmm1, eight8s
- psraw xmm1, 4
-
- packuswb xmm1, xmm0
- pand xmm1, xmm3
-
- pandn xmm3, xmm2
- por xmm1, xmm3
-
- and rcx, 15
- movq QWORD PTR [rsp + rcx*8], xmm1 ;d[rcx*8]
-
- mov rcx, rdx
- sub rcx, 8
-
- and rcx, 15
- movq mm0, [rsp + rcx*8] ;d[rcx*8]
-
- movq [rsi], mm0
- lea rsi, [rsi+rax]
-
- lea rdi, [rdi+rax]
- add rdx, 1
-
- cmp edx, dword arg(2) ;rows
- jl .loop_row
-
- add dword arg(0), 8 ; s += 8
- sub dword arg(3), 8 ; cols -= 8
- cmp dword arg(3), 0
- jg .loop_col
-
- add rsp, 128+16
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef flimit4
-
-
-;void vp9_mbpost_proc_across_ip_xmm(unsigned char *src,
-; int pitch, int rows, int cols,int flimit)
-global sym(vp9_mbpost_proc_across_ip_xmm) PRIVATE
-sym(vp9_mbpost_proc_across_ip_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16
-
- ; create flimit4 at [rsp]
- mov eax, dword ptr arg(4) ;flimit
- mov [rsp], eax
- mov [rsp+4], eax
- mov [rsp+8], eax
- mov [rsp+12], eax
-%define flimit4 [rsp]
-
-
- ;for(r=0;r<rows;r++)
-.ip_row_loop:
-
- xor rdx, rdx ;sumsq=0;
- xor rcx, rcx ;sum=0;
- mov rsi, arg(0); s
- mov rdi, -8
-.ip_var_loop:
- ;for(i=-8;i<=6;i++)
- ;{
- ; sumsq += s[i]*s[i];
- ; sum += s[i];
- ;}
- movzx eax, byte [rsi+rdi]
- add ecx, eax
- mul al
- add edx, eax
- add rdi, 1
- cmp rdi, 6
- jle .ip_var_loop
-
-
- ;mov rax, sumsq
- ;movd xmm7, rax
- movd xmm7, edx
-
- ;mov rax, sum
- ;movd xmm6, rax
- movd xmm6, ecx
-
- mov rsi, arg(0) ;s
- xor rcx, rcx
-
- movsxd rdx, dword arg(3) ;cols
- add rdx, 8
- pxor mm0, mm0
- pxor mm1, mm1
-
- pxor xmm0, xmm0
-.nextcol4:
-
- movd xmm1, DWORD PTR [rsi+rcx-8] ; -8 -7 -6 -5
- movd xmm2, DWORD PTR [rsi+rcx+7] ; +7 +8 +9 +10
-
- punpcklbw xmm1, xmm0 ; expanding
- punpcklbw xmm2, xmm0 ; expanding
-
- punpcklwd xmm1, xmm0 ; expanding to dwords
- punpcklwd xmm2, xmm0 ; expanding to dwords
-
- psubd xmm2, xmm1 ; 7--8 8--7 9--6 10--5
- paddd xmm1, xmm1 ; -8*2 -7*2 -6*2 -5*2
-
- paddd xmm1, xmm2 ; 7+-8 8+-7 9+-6 10+-5
- pmaddwd xmm1, xmm2 ; squared of 7+-8 8+-7 9+-6 10+-5
-
- paddd xmm6, xmm2
- paddd xmm7, xmm1
-
- pshufd xmm6, xmm6, 0 ; duplicate the last ones
- pshufd xmm7, xmm7, 0 ; duplicate the last ones
-
- psrldq xmm1, 4 ; 8--7 9--6 10--5 0000
- psrldq xmm2, 4 ; 8--7 9--6 10--5 0000
-
- pshufd xmm3, xmm1, 3 ; 0000 8--7 8--7 8--7 squared
- pshufd xmm4, xmm2, 3 ; 0000 8--7 8--7 8--7 squared
-
- paddd xmm6, xmm4
- paddd xmm7, xmm3
-
- pshufd xmm3, xmm1, 01011111b ; 0000 0000 9--6 9--6 squared
- pshufd xmm4, xmm2, 01011111b ; 0000 0000 9--6 9--6 squared
-
- paddd xmm7, xmm3
- paddd xmm6, xmm4
-
- pshufd xmm3, xmm1, 10111111b ; 0000 0000 8--7 8--7 squared
- pshufd xmm4, xmm2, 10111111b ; 0000 0000 8--7 8--7 squared
-
- paddd xmm7, xmm3
- paddd xmm6, xmm4
-
- movdqa xmm3, xmm6
- pmaddwd xmm3, xmm3
-
- movdqa xmm5, xmm7
- pslld xmm5, 4
-
- psubd xmm5, xmm7
- psubd xmm5, xmm3
-
- psubd xmm5, flimit4
- psrad xmm5, 31
-
- packssdw xmm5, xmm0
- packsswb xmm5, xmm0
-
- movd xmm1, DWORD PTR [rsi+rcx]
- movq xmm2, xmm1
-
- punpcklbw xmm1, xmm0
- punpcklwd xmm1, xmm0
-
- paddd xmm1, xmm6
- paddd xmm1, [GLOBAL(four8s)]
-
- psrad xmm1, 4
- packssdw xmm1, xmm0
-
- packuswb xmm1, xmm0
- pand xmm1, xmm5
-
- pandn xmm5, xmm2
- por xmm5, xmm1
-
- movd [rsi+rcx-8], mm0
- movq mm0, mm1
-
- movdq2q mm1, xmm5
- psrldq xmm7, 12
-
- psrldq xmm6, 12
- add rcx, 4
-
- cmp rcx, rdx
- jl .nextcol4
-
- ;s+=pitch;
- movsxd rax, dword arg(1)
- add arg(0), rax
-
- sub dword arg(2), 1 ;rows-=1
- cmp dword arg(2), 0
- jg .ip_row_loop
-
- add rsp, 16
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-%undef flimit4
-
-
-;void vp9_plane_add_noise_wmt (unsigned char *start, unsigned char *noise,
-; unsigned char blackclamp[16],
-; unsigned char whiteclamp[16],
-; unsigned char bothclamp[16],
-; unsigned int width, unsigned int height, int pitch)
-extern sym(rand)
-global sym(vp9_plane_add_noise_wmt) PRIVATE
-sym(vp9_plane_add_noise_wmt):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-.addnoise_loop:
- call sym(rand) WRT_PLT
- mov rcx, arg(1) ;noise
- and rax, 0xff
- add rcx, rax
-
- ; we rely on the fact that the clamping vectors are stored contiguously
- ; in black/white/both order. Note that we have to reload this here because
- ; rdx could be trashed by rand()
- mov rdx, arg(2) ; blackclamp
-
-
- mov rdi, rcx
- movsxd rcx, dword arg(5) ;[Width]
- mov rsi, arg(0) ;Pos
- xor rax,rax
-
-.addnoise_nextset:
- movdqu xmm1,[rsi+rax] ; get the source
-
- psubusb xmm1, [rdx] ;blackclamp ; clamp both sides so we don't outrange adding noise
- paddusb xmm1, [rdx+32] ;bothclamp
- psubusb xmm1, [rdx+16] ;whiteclamp
-
- movdqu xmm2,[rdi+rax] ; get the noise for this line
- paddb xmm1,xmm2 ; add it in
- movdqu [rsi+rax],xmm1 ; store the result
-
- add rax,16 ; move to the next line
-
- cmp rax, rcx
- jl .addnoise_nextset
-
- movsxd rax, dword arg(7) ; Pitch
- add arg(0), rax ; Start += Pitch
- sub dword arg(6), 1 ; Height -= 1
- jg .addnoise_loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-SECTION_RODATA
-align 16
-rd42:
- times 8 dw 0x04
-four8s:
- times 4 dd 8
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_x86.h b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_x86.h
deleted file mode 100644
index cab9d34..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_postproc_x86.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_COMMON_X86_VP9_POSTPROC_X86_H_
-#define VP9_COMMON_X86_VP9_POSTPROC_X86_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Note:
- *
- * This platform is commonly built for runtime CPU detection. If you modify
- * any of the function mappings present in this file, be sure to also update
- * them in the function pointer initialization code
- */
-
-#if HAVE_MMX
-extern prototype_postproc_inplace(vp9_mbpost_proc_down_mmx);
-extern prototype_postproc(vp9_post_proc_down_and_across_mmx);
-extern prototype_postproc_addnoise(vp9_plane_add_noise_mmx);
-
-#if !CONFIG_RUNTIME_CPU_DETECT
-#undef vp9_postproc_down
-#define vp9_postproc_down vp9_mbpost_proc_down_mmx
-
-#undef vp9_postproc_downacross
-#define vp9_postproc_downacross vp9_post_proc_down_and_across_mmx
-
-#undef vp9_postproc_addnoise
-#define vp9_postproc_addnoise vp9_plane_add_noise_mmx
-
-#endif
-#endif
-
-
-#if HAVE_SSE2
-extern prototype_postproc_inplace(vp9_mbpost_proc_down_xmm);
-extern prototype_postproc_inplace(vp9_mbpost_proc_across_ip_xmm);
-extern prototype_postproc(vp9_post_proc_down_and_across_xmm);
-extern prototype_postproc_addnoise(vp9_plane_add_noise_wmt);
-
-#if !CONFIG_RUNTIME_CPU_DETECT
-#undef vp9_postproc_down
-#define vp9_postproc_down vp9_mbpost_proc_down_xmm
-
-#undef vp9_postproc_across
-#define vp9_postproc_across vp9_mbpost_proc_across_ip_xmm
-
-#undef vp9_postproc_downacross
-#define vp9_postproc_downacross vp9_post_proc_down_and_across_xmm
-
-#undef vp9_postproc_addnoise
-#define vp9_postproc_addnoise vp9_plane_add_noise_wmt
-
-
-#endif
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_COMMON_X86_VP9_POSTPROC_X86_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
deleted file mode 100644
index 7e9cc84..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <immintrin.h>
-#include "vpx_ports/mem.h"
-
-// filters for 16_h8 and 16_v8
-DECLARE_ALIGNED(32, static const uint8_t, filt1_global_avx2[32]) = {
- 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
- 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
-};
-
-DECLARE_ALIGNED(32, static const uint8_t, filt2_global_avx2[32]) = {
- 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10,
- 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10
-};
-
-DECLARE_ALIGNED(32, static const uint8_t, filt3_global_avx2[32]) = {
- 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12,
- 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12
-};
-
-DECLARE_ALIGNED(32, static const uint8_t, filt4_global_avx2[32]) = {
- 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14,
- 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14
-};
-
-#if defined(__clang__)
-# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 3)
-# define MM256_BROADCASTSI128_SI256(x) \
- _mm_broadcastsi128_si256((__m128i const *)&(x))
-# else // clang > 3.3
-# define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
-# endif // clang <= 3.3
-#elif defined(__GNUC__)
-# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 6)
-# define MM256_BROADCASTSI128_SI256(x) \
- _mm_broadcastsi128_si256((__m128i const *)&(x))
-# elif __GNUC__ == 4 && __GNUC_MINOR__ == 7
-# define MM256_BROADCASTSI128_SI256(x) _mm_broadcastsi128_si256(x)
-# else // gcc > 4.7
-# define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
-# endif // gcc <= 4.6
-#else // !(gcc || clang)
-# define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
-#endif // __clang__
-
-void vp9_filter_block1d16_h8_avx2(unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int output_height,
- int16_t *filter) {
- __m128i filtersReg;
- __m256i addFilterReg64, filt1Reg, filt2Reg, filt3Reg, filt4Reg;
- __m256i firstFilters, secondFilters, thirdFilters, forthFilters;
- __m256i srcRegFilt32b1_1, srcRegFilt32b2_1, srcRegFilt32b2, srcRegFilt32b3;
- __m256i srcReg32b1, srcReg32b2, filtersReg32;
- unsigned int i;
- unsigned int src_stride, dst_stride;
-
- // create a register with 0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64
- addFilterReg64 = _mm256_set1_epi32((int)0x0400040u);
- filtersReg = _mm_loadu_si128((__m128i *)filter);
- // converting the 16 bit (short) to 8 bit (byte) and have the same data
- // in both lanes of 128 bit register.
- filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
- // have the same data in both lanes of a 256 bit register
- filtersReg32 = MM256_BROADCASTSI128_SI256(filtersReg);
-
- // duplicate only the first 16 bits (first and second byte)
- // across 256 bit register
- firstFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x100u));
- // duplicate only the second 16 bits (third and forth byte)
- // across 256 bit register
- secondFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x302u));
- // duplicate only the third 16 bits (fifth and sixth byte)
- // across 256 bit register
- thirdFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x504u));
- // duplicate only the forth 16 bits (seventh and eighth byte)
- // across 256 bit register
- forthFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x706u));
-
- filt1Reg = _mm256_load_si256((__m256i const *)filt1_global_avx2);
- filt2Reg = _mm256_load_si256((__m256i const *)filt2_global_avx2);
- filt3Reg = _mm256_load_si256((__m256i const *)filt3_global_avx2);
- filt4Reg = _mm256_load_si256((__m256i const *)filt4_global_avx2);
-
- // multiple the size of the source and destination stride by two
- src_stride = src_pixels_per_line << 1;
- dst_stride = output_pitch << 1;
- for (i = output_height; i > 1; i-=2) {
- // load the 2 strides of source
- srcReg32b1 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr-3)));
- srcReg32b1 = _mm256_inserti128_si256(srcReg32b1,
- _mm_loadu_si128((__m128i *)
- (src_ptr+src_pixels_per_line-3)), 1);
-
- // filter the source buffer
- srcRegFilt32b1_1= _mm256_shuffle_epi8(srcReg32b1, filt1Reg);
- srcRegFilt32b2= _mm256_shuffle_epi8(srcReg32b1, filt2Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt32b1_1 = _mm256_maddubs_epi16(srcRegFilt32b1_1, firstFilters);
- srcRegFilt32b2 = _mm256_maddubs_epi16(srcRegFilt32b2, secondFilters);
-
- // add and saturate the results together
- srcRegFilt32b1_1 = _mm256_adds_epi16(srcRegFilt32b1_1, srcRegFilt32b2);
-
- // filter the source buffer
- srcRegFilt32b3= _mm256_shuffle_epi8(srcReg32b1, filt4Reg);
- srcRegFilt32b2= _mm256_shuffle_epi8(srcReg32b1, filt3Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt32b3 = _mm256_maddubs_epi16(srcRegFilt32b3, forthFilters);
- srcRegFilt32b2 = _mm256_maddubs_epi16(srcRegFilt32b2, thirdFilters);
-
- // add and saturate the results together
- srcRegFilt32b1_1 = _mm256_adds_epi16(srcRegFilt32b1_1,
- _mm256_min_epi16(srcRegFilt32b3, srcRegFilt32b2));
-
- // reading 2 strides of the next 16 bytes
- // (part of it was being read by earlier read)
- srcReg32b2 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+5)));
- srcReg32b2 = _mm256_inserti128_si256(srcReg32b2,
- _mm_loadu_si128((__m128i *)
- (src_ptr+src_pixels_per_line+5)), 1);
-
- // add and saturate the results together
- srcRegFilt32b1_1 = _mm256_adds_epi16(srcRegFilt32b1_1,
- _mm256_max_epi16(srcRegFilt32b3, srcRegFilt32b2));
-
- // filter the source buffer
- srcRegFilt32b2_1 = _mm256_shuffle_epi8(srcReg32b2, filt1Reg);
- srcRegFilt32b2 = _mm256_shuffle_epi8(srcReg32b2, filt2Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt32b2_1 = _mm256_maddubs_epi16(srcRegFilt32b2_1, firstFilters);
- srcRegFilt32b2 = _mm256_maddubs_epi16(srcRegFilt32b2, secondFilters);
-
- // add and saturate the results together
- srcRegFilt32b2_1 = _mm256_adds_epi16(srcRegFilt32b2_1, srcRegFilt32b2);
-
- // filter the source buffer
- srcRegFilt32b3= _mm256_shuffle_epi8(srcReg32b2, filt4Reg);
- srcRegFilt32b2= _mm256_shuffle_epi8(srcReg32b2, filt3Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt32b3 = _mm256_maddubs_epi16(srcRegFilt32b3, forthFilters);
- srcRegFilt32b2 = _mm256_maddubs_epi16(srcRegFilt32b2, thirdFilters);
-
- // add and saturate the results together
- srcRegFilt32b2_1 = _mm256_adds_epi16(srcRegFilt32b2_1,
- _mm256_min_epi16(srcRegFilt32b3, srcRegFilt32b2));
- srcRegFilt32b2_1 = _mm256_adds_epi16(srcRegFilt32b2_1,
- _mm256_max_epi16(srcRegFilt32b3, srcRegFilt32b2));
-
-
- srcRegFilt32b1_1 = _mm256_adds_epi16(srcRegFilt32b1_1, addFilterReg64);
-
- srcRegFilt32b2_1 = _mm256_adds_epi16(srcRegFilt32b2_1, addFilterReg64);
-
- // shift by 7 bit each 16 bit
- srcRegFilt32b1_1 = _mm256_srai_epi16(srcRegFilt32b1_1, 7);
- srcRegFilt32b2_1 = _mm256_srai_epi16(srcRegFilt32b2_1, 7);
-
- // shrink to 8 bit each 16 bits, the first lane contain the first
- // convolve result and the second lane contain the second convolve
- // result
- srcRegFilt32b1_1 = _mm256_packus_epi16(srcRegFilt32b1_1,
- srcRegFilt32b2_1);
-
- src_ptr+=src_stride;
-
- // save 16 bytes
- _mm_store_si128((__m128i*)output_ptr,
- _mm256_castsi256_si128(srcRegFilt32b1_1));
-
- // save the next 16 bits
- _mm_store_si128((__m128i*)(output_ptr+output_pitch),
- _mm256_extractf128_si256(srcRegFilt32b1_1, 1));
- output_ptr+=dst_stride;
- }
-
- // if the number of strides is odd.
- // process only 16 bytes
- if (i > 0) {
- __m128i srcReg1, srcReg2, srcRegFilt1_1, srcRegFilt2_1;
- __m128i srcRegFilt2, srcRegFilt3;
-
- srcReg1 = _mm_loadu_si128((__m128i *)(src_ptr-3));
-
- // filter the source buffer
- srcRegFilt1_1 = _mm_shuffle_epi8(srcReg1,
- _mm256_castsi256_si128(filt1Reg));
- srcRegFilt2 = _mm_shuffle_epi8(srcReg1,
- _mm256_castsi256_si128(filt2Reg));
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt1_1 = _mm_maddubs_epi16(srcRegFilt1_1,
- _mm256_castsi256_si128(firstFilters));
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2,
- _mm256_castsi256_si128(secondFilters));
-
- // add and saturate the results together
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1, srcRegFilt2);
-
- // filter the source buffer
- srcRegFilt3= _mm_shuffle_epi8(srcReg1,
- _mm256_castsi256_si128(filt4Reg));
- srcRegFilt2= _mm_shuffle_epi8(srcReg1,
- _mm256_castsi256_si128(filt3Reg));
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt3 = _mm_maddubs_epi16(srcRegFilt3,
- _mm256_castsi256_si128(forthFilters));
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2,
- _mm256_castsi256_si128(thirdFilters));
-
- // add and saturate the results together
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1,
- _mm_min_epi16(srcRegFilt3, srcRegFilt2));
-
- // reading the next 16 bytes
- // (part of it was being read by earlier read)
- srcReg2 = _mm_loadu_si128((__m128i *)(src_ptr+5));
-
- // add and saturate the results together
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1,
- _mm_max_epi16(srcRegFilt3, srcRegFilt2));
-
- // filter the source buffer
- srcRegFilt2_1 = _mm_shuffle_epi8(srcReg2,
- _mm256_castsi256_si128(filt1Reg));
- srcRegFilt2 = _mm_shuffle_epi8(srcReg2,
- _mm256_castsi256_si128(filt2Reg));
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt2_1 = _mm_maddubs_epi16(srcRegFilt2_1,
- _mm256_castsi256_si128(firstFilters));
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2,
- _mm256_castsi256_si128(secondFilters));
-
- // add and saturate the results together
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1, srcRegFilt2);
-
- // filter the source buffer
- srcRegFilt3 = _mm_shuffle_epi8(srcReg2,
- _mm256_castsi256_si128(filt4Reg));
- srcRegFilt2 = _mm_shuffle_epi8(srcReg2,
- _mm256_castsi256_si128(filt3Reg));
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt3 = _mm_maddubs_epi16(srcRegFilt3,
- _mm256_castsi256_si128(forthFilters));
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2,
- _mm256_castsi256_si128(thirdFilters));
-
- // add and saturate the results together
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1,
- _mm_min_epi16(srcRegFilt3, srcRegFilt2));
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1,
- _mm_max_epi16(srcRegFilt3, srcRegFilt2));
-
-
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1,
- _mm256_castsi256_si128(addFilterReg64));
-
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1,
- _mm256_castsi256_si128(addFilterReg64));
-
- // shift by 7 bit each 16 bit
- srcRegFilt1_1 = _mm_srai_epi16(srcRegFilt1_1, 7);
- srcRegFilt2_1 = _mm_srai_epi16(srcRegFilt2_1, 7);
-
- // shrink to 8 bit each 16 bits, the first lane contain the first
- // convolve result and the second lane contain the second convolve
- // result
- srcRegFilt1_1 = _mm_packus_epi16(srcRegFilt1_1, srcRegFilt2_1);
-
- // save 16 bytes
- _mm_store_si128((__m128i*)output_ptr, srcRegFilt1_1);
- }
-}
-
-void vp9_filter_block1d16_v8_avx2(unsigned char *src_ptr,
- unsigned int src_pitch,
- unsigned char *output_ptr,
- unsigned int out_pitch,
- unsigned int output_height,
- int16_t *filter) {
- __m128i filtersReg;
- __m256i addFilterReg64;
- __m256i srcReg32b1, srcReg32b2, srcReg32b3, srcReg32b4, srcReg32b5;
- __m256i srcReg32b6, srcReg32b7, srcReg32b8, srcReg32b9, srcReg32b10;
- __m256i srcReg32b11, srcReg32b12, srcReg32b13, filtersReg32;
- __m256i firstFilters, secondFilters, thirdFilters, forthFilters;
- unsigned int i;
- unsigned int src_stride, dst_stride;
-
- // create a register with 0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64
- addFilterReg64 = _mm256_set1_epi32((int)0x0400040u);
- filtersReg = _mm_loadu_si128((__m128i *)filter);
- // converting the 16 bit (short) to 8 bit (byte) and have the
- // same data in both lanes of 128 bit register.
- filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
- // have the same data in both lanes of a 256 bit register
- filtersReg32 = MM256_BROADCASTSI128_SI256(filtersReg);
-
- // duplicate only the first 16 bits (first and second byte)
- // across 256 bit register
- firstFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x100u));
- // duplicate only the second 16 bits (third and forth byte)
- // across 256 bit register
- secondFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x302u));
- // duplicate only the third 16 bits (fifth and sixth byte)
- // across 256 bit register
- thirdFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x504u));
- // duplicate only the forth 16 bits (seventh and eighth byte)
- // across 256 bit register
- forthFilters = _mm256_shuffle_epi8(filtersReg32,
- _mm256_set1_epi16(0x706u));
-
- // multiple the size of the source and destination stride by two
- src_stride = src_pitch << 1;
- dst_stride = out_pitch << 1;
-
- // load 16 bytes 7 times in stride of src_pitch
- srcReg32b1 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr)));
- srcReg32b2 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch)));
- srcReg32b3 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*2)));
- srcReg32b4 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*3)));
- srcReg32b5 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*4)));
- srcReg32b6 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*5)));
- srcReg32b7 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*6)));
-
- // have each consecutive loads on the same 256 register
- srcReg32b1 = _mm256_inserti128_si256(srcReg32b1,
- _mm256_castsi256_si128(srcReg32b2), 1);
- srcReg32b2 = _mm256_inserti128_si256(srcReg32b2,
- _mm256_castsi256_si128(srcReg32b3), 1);
- srcReg32b3 = _mm256_inserti128_si256(srcReg32b3,
- _mm256_castsi256_si128(srcReg32b4), 1);
- srcReg32b4 = _mm256_inserti128_si256(srcReg32b4,
- _mm256_castsi256_si128(srcReg32b5), 1);
- srcReg32b5 = _mm256_inserti128_si256(srcReg32b5,
- _mm256_castsi256_si128(srcReg32b6), 1);
- srcReg32b6 = _mm256_inserti128_si256(srcReg32b6,
- _mm256_castsi256_si128(srcReg32b7), 1);
-
- // merge every two consecutive registers except the last one
- srcReg32b10 = _mm256_unpacklo_epi8(srcReg32b1, srcReg32b2);
- srcReg32b1 = _mm256_unpackhi_epi8(srcReg32b1, srcReg32b2);
-
- // save
- srcReg32b11 = _mm256_unpacklo_epi8(srcReg32b3, srcReg32b4);
-
- // save
- srcReg32b3 = _mm256_unpackhi_epi8(srcReg32b3, srcReg32b4);
-
- // save
- srcReg32b2 = _mm256_unpacklo_epi8(srcReg32b5, srcReg32b6);
-
- // save
- srcReg32b5 = _mm256_unpackhi_epi8(srcReg32b5, srcReg32b6);
-
-
- for (i = output_height; i > 1; i-=2) {
- // load the last 2 loads of 16 bytes and have every two
- // consecutive loads in the same 256 bit register
- srcReg32b8 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*7)));
- srcReg32b7 = _mm256_inserti128_si256(srcReg32b7,
- _mm256_castsi256_si128(srcReg32b8), 1);
- srcReg32b9 = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*8)));
- srcReg32b8 = _mm256_inserti128_si256(srcReg32b8,
- _mm256_castsi256_si128(srcReg32b9), 1);
-
- // merge every two consecutive registers
- // save
- srcReg32b4 = _mm256_unpacklo_epi8(srcReg32b7, srcReg32b8);
- srcReg32b7 = _mm256_unpackhi_epi8(srcReg32b7, srcReg32b8);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcReg32b10 = _mm256_maddubs_epi16(srcReg32b10, firstFilters);
- srcReg32b6 = _mm256_maddubs_epi16(srcReg32b4, forthFilters);
- srcReg32b1 = _mm256_maddubs_epi16(srcReg32b1, firstFilters);
- srcReg32b8 = _mm256_maddubs_epi16(srcReg32b7, forthFilters);
-
- // add and saturate the results together
- srcReg32b10 = _mm256_adds_epi16(srcReg32b10, srcReg32b6);
- srcReg32b1 = _mm256_adds_epi16(srcReg32b1, srcReg32b8);
-
-
- // multiply 2 adjacent elements with the filter and add the result
- srcReg32b8 = _mm256_maddubs_epi16(srcReg32b11, secondFilters);
- srcReg32b6 = _mm256_maddubs_epi16(srcReg32b3, secondFilters);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcReg32b12 = _mm256_maddubs_epi16(srcReg32b2, thirdFilters);
- srcReg32b13 = _mm256_maddubs_epi16(srcReg32b5, thirdFilters);
-
-
- // add and saturate the results together
- srcReg32b10 = _mm256_adds_epi16(srcReg32b10,
- _mm256_min_epi16(srcReg32b8, srcReg32b12));
- srcReg32b1 = _mm256_adds_epi16(srcReg32b1,
- _mm256_min_epi16(srcReg32b6, srcReg32b13));
-
- // add and saturate the results together
- srcReg32b10 = _mm256_adds_epi16(srcReg32b10,
- _mm256_max_epi16(srcReg32b8, srcReg32b12));
- srcReg32b1 = _mm256_adds_epi16(srcReg32b1,
- _mm256_max_epi16(srcReg32b6, srcReg32b13));
-
-
- srcReg32b10 = _mm256_adds_epi16(srcReg32b10, addFilterReg64);
- srcReg32b1 = _mm256_adds_epi16(srcReg32b1, addFilterReg64);
-
- // shift by 7 bit each 16 bit
- srcReg32b10 = _mm256_srai_epi16(srcReg32b10, 7);
- srcReg32b1 = _mm256_srai_epi16(srcReg32b1, 7);
-
- // shrink to 8 bit each 16 bits, the first lane contain the first
- // convolve result and the second lane contain the second convolve
- // result
- srcReg32b1 = _mm256_packus_epi16(srcReg32b10, srcReg32b1);
-
- src_ptr+=src_stride;
-
- // save 16 bytes
- _mm_store_si128((__m128i*)output_ptr,
- _mm256_castsi256_si128(srcReg32b1));
-
- // save the next 16 bits
- _mm_store_si128((__m128i*)(output_ptr+out_pitch),
- _mm256_extractf128_si256(srcReg32b1, 1));
-
- output_ptr+=dst_stride;
-
- // save part of the registers for next strides
- srcReg32b10 = srcReg32b11;
- srcReg32b1 = srcReg32b3;
- srcReg32b11 = srcReg32b2;
- srcReg32b3 = srcReg32b5;
- srcReg32b2 = srcReg32b4;
- srcReg32b5 = srcReg32b7;
- srcReg32b7 = srcReg32b9;
- }
- if (i > 0) {
- __m128i srcRegFilt1, srcRegFilt3, srcRegFilt4, srcRegFilt5;
- __m128i srcRegFilt6, srcRegFilt7, srcRegFilt8;
- // load the last 16 bytes
- srcRegFilt8 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*7));
-
- // merge the last 2 results together
- srcRegFilt4 = _mm_unpacklo_epi8(
- _mm256_castsi256_si128(srcReg32b7), srcRegFilt8);
- srcRegFilt7 = _mm_unpackhi_epi8(
- _mm256_castsi256_si128(srcReg32b7), srcRegFilt8);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt1 = _mm_maddubs_epi16(_mm256_castsi256_si128(srcReg32b10),
- _mm256_castsi256_si128(firstFilters));
- srcRegFilt4 = _mm_maddubs_epi16(srcRegFilt4,
- _mm256_castsi256_si128(forthFilters));
- srcRegFilt3 = _mm_maddubs_epi16(_mm256_castsi256_si128(srcReg32b1),
- _mm256_castsi256_si128(firstFilters));
- srcRegFilt7 = _mm_maddubs_epi16(srcRegFilt7,
- _mm256_castsi256_si128(forthFilters));
-
- // add and saturate the results together
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt4);
- srcRegFilt3 = _mm_adds_epi16(srcRegFilt3, srcRegFilt7);
-
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt4 = _mm_maddubs_epi16(_mm256_castsi256_si128(srcReg32b11),
- _mm256_castsi256_si128(secondFilters));
- srcRegFilt5 = _mm_maddubs_epi16(_mm256_castsi256_si128(srcReg32b3),
- _mm256_castsi256_si128(secondFilters));
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt6 = _mm_maddubs_epi16(_mm256_castsi256_si128(srcReg32b2),
- _mm256_castsi256_si128(thirdFilters));
- srcRegFilt7 = _mm_maddubs_epi16(_mm256_castsi256_si128(srcReg32b5),
- _mm256_castsi256_si128(thirdFilters));
-
- // add and saturate the results together
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1,
- _mm_min_epi16(srcRegFilt4, srcRegFilt6));
- srcRegFilt3 = _mm_adds_epi16(srcRegFilt3,
- _mm_min_epi16(srcRegFilt5, srcRegFilt7));
-
- // add and saturate the results together
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1,
- _mm_max_epi16(srcRegFilt4, srcRegFilt6));
- srcRegFilt3 = _mm_adds_epi16(srcRegFilt3,
- _mm_max_epi16(srcRegFilt5, srcRegFilt7));
-
-
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1,
- _mm256_castsi256_si128(addFilterReg64));
- srcRegFilt3 = _mm_adds_epi16(srcRegFilt3,
- _mm256_castsi256_si128(addFilterReg64));
-
- // shift by 7 bit each 16 bit
- srcRegFilt1 = _mm_srai_epi16(srcRegFilt1, 7);
- srcRegFilt3 = _mm_srai_epi16(srcRegFilt3, 7);
-
- // shrink to 8 bit each 16 bits, the first lane contain the first
- // convolve result and the second lane contain the second convolve
- // result
- srcRegFilt1 = _mm_packus_epi16(srcRegFilt1, srcRegFilt3);
-
- // save 16 bytes
- _mm_store_si128((__m128i*)output_ptr, srcRegFilt1);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c
deleted file mode 100644
index cf28d8d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <tmmintrin.h>
-#include "vpx_ports/mem.h"
-#include "vpx_ports/emmintrin_compat.h"
-
-// filters only for the 4_h8 convolution
-DECLARE_ALIGNED(16, static const uint8_t, filt1_4_h8[16]) = {
- 0, 1, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 5, 6
-};
-
-DECLARE_ALIGNED(16, static const uint8_t, filt2_4_h8[16]) = {
- 4, 5, 5, 6, 6, 7, 7, 8, 6, 7, 7, 8, 8, 9, 9, 10
-};
-
-// filters for 8_h8 and 16_h8
-DECLARE_ALIGNED(16, static const uint8_t, filt1_global[16]) = {
- 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
-};
-
-DECLARE_ALIGNED(16, static const uint8_t, filt2_global[16]) = {
- 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10
-};
-
-DECLARE_ALIGNED(16, static const uint8_t, filt3_global[16]) = {
- 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12
-};
-
-DECLARE_ALIGNED(16, static const uint8_t, filt4_global[16]) = {
- 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14
-};
-
-void vp9_filter_block1d4_h8_intrin_ssse3(unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int output_height,
- int16_t *filter) {
- __m128i firstFilters, secondFilters, thirdFilters, forthFilters;
- __m128i srcRegFilt1, srcRegFilt2, srcRegFilt3, srcRegFilt4;
- __m128i addFilterReg64, filtersReg, srcReg, minReg;
- unsigned int i;
-
- // create a register with 0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64
- addFilterReg64 =_mm_set1_epi32((int)0x0400040u);
- filtersReg = _mm_loadu_si128((__m128i *)filter);
- // converting the 16 bit (short) to 8 bit (byte) and have the same data
- // in both lanes of 128 bit register.
- filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
-
- // duplicate only the first 16 bits in the filter into the first lane
- firstFilters = _mm_shufflelo_epi16(filtersReg, 0);
- // duplicate only the third 16 bit in the filter into the first lane
- secondFilters = _mm_shufflelo_epi16(filtersReg, 0xAAu);
- // duplicate only the seconds 16 bits in the filter into the second lane
- firstFilters = _mm_shufflehi_epi16(firstFilters, 0x55u);
- // duplicate only the forth 16 bits in the filter into the second lane
- secondFilters = _mm_shufflehi_epi16(secondFilters, 0xFFu);
-
- // loading the local filters
- thirdFilters =_mm_load_si128((__m128i const *)filt1_4_h8);
- forthFilters = _mm_load_si128((__m128i const *)filt2_4_h8);
-
- for (i = 0; i < output_height; i++) {
- srcReg = _mm_loadu_si128((__m128i *)(src_ptr-3));
-
- // filter the source buffer
- srcRegFilt1= _mm_shuffle_epi8(srcReg, thirdFilters);
- srcRegFilt2= _mm_shuffle_epi8(srcReg, forthFilters);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt1 = _mm_maddubs_epi16(srcRegFilt1, firstFilters);
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2, secondFilters);
-
- // extract the higher half of the lane
- srcRegFilt3 = _mm_srli_si128(srcRegFilt1, 8);
- srcRegFilt4 = _mm_srli_si128(srcRegFilt2, 8);
-
- minReg = _mm_min_epi16(srcRegFilt3, srcRegFilt2);
-
- // add and saturate all the results together
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt4);
- srcRegFilt3 = _mm_max_epi16(srcRegFilt3, srcRegFilt2);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, minReg);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt3);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, addFilterReg64);
-
- // shift by 7 bit each 16 bits
- srcRegFilt1 = _mm_srai_epi16(srcRegFilt1, 7);
-
- // shrink to 8 bit each 16 bits
- srcRegFilt1 = _mm_packus_epi16(srcRegFilt1, srcRegFilt1);
- src_ptr+=src_pixels_per_line;
-
- // save only 4 bytes
- *((int*)&output_ptr[0])= _mm_cvtsi128_si32(srcRegFilt1);
-
- output_ptr+=output_pitch;
- }
-}
-
-void vp9_filter_block1d8_h8_intrin_ssse3(unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int output_height,
- int16_t *filter) {
- __m128i firstFilters, secondFilters, thirdFilters, forthFilters, srcReg;
- __m128i filt1Reg, filt2Reg, filt3Reg, filt4Reg;
- __m128i srcRegFilt1, srcRegFilt2, srcRegFilt3, srcRegFilt4;
- __m128i addFilterReg64, filtersReg, minReg;
- unsigned int i;
-
- // create a register with 0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64
- addFilterReg64 = _mm_set1_epi32((int)0x0400040u);
- filtersReg = _mm_loadu_si128((__m128i *)filter);
- // converting the 16 bit (short) to 8 bit (byte) and have the same data
- // in both lanes of 128 bit register.
- filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
-
- // duplicate only the first 16 bits (first and second byte)
- // across 128 bit register
- firstFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x100u));
- // duplicate only the second 16 bits (third and forth byte)
- // across 128 bit register
- secondFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x302u));
- // duplicate only the third 16 bits (fifth and sixth byte)
- // across 128 bit register
- thirdFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x504u));
- // duplicate only the forth 16 bits (seventh and eighth byte)
- // across 128 bit register
- forthFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x706u));
-
- filt1Reg = _mm_load_si128((__m128i const *)filt1_global);
- filt2Reg = _mm_load_si128((__m128i const *)filt2_global);
- filt3Reg = _mm_load_si128((__m128i const *)filt3_global);
- filt4Reg = _mm_load_si128((__m128i const *)filt4_global);
-
- for (i = 0; i < output_height; i++) {
- srcReg = _mm_loadu_si128((__m128i *)(src_ptr-3));
-
- // filter the source buffer
- srcRegFilt1= _mm_shuffle_epi8(srcReg, filt1Reg);
- srcRegFilt2= _mm_shuffle_epi8(srcReg, filt2Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt1 = _mm_maddubs_epi16(srcRegFilt1, firstFilters);
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2, secondFilters);
-
- // filter the source buffer
- srcRegFilt3= _mm_shuffle_epi8(srcReg, filt3Reg);
- srcRegFilt4= _mm_shuffle_epi8(srcReg, filt4Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt3 = _mm_maddubs_epi16(srcRegFilt3, thirdFilters);
- srcRegFilt4 = _mm_maddubs_epi16(srcRegFilt4, forthFilters);
-
- // add and saturate all the results together
- minReg = _mm_min_epi16(srcRegFilt4, srcRegFilt3);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt2);
-
- srcRegFilt4= _mm_max_epi16(srcRegFilt4, srcRegFilt3);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, minReg);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt4);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, addFilterReg64);
-
- // shift by 7 bit each 16 bits
- srcRegFilt1 = _mm_srai_epi16(srcRegFilt1, 7);
-
- // shrink to 8 bit each 16 bits
- srcRegFilt1 = _mm_packus_epi16(srcRegFilt1, srcRegFilt1);
-
- src_ptr+=src_pixels_per_line;
-
- // save only 8 bytes
- _mm_storel_epi64((__m128i*)&output_ptr[0], srcRegFilt1);
-
- output_ptr+=output_pitch;
- }
-}
-
-void vp9_filter_block1d16_h8_intrin_ssse3(unsigned char *src_ptr,
- unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- unsigned int output_pitch,
- unsigned int output_height,
- int16_t *filter) {
- __m128i addFilterReg64, filtersReg, srcReg1, srcReg2;
- __m128i filt1Reg, filt2Reg, filt3Reg, filt4Reg;
- __m128i firstFilters, secondFilters, thirdFilters, forthFilters;
- __m128i srcRegFilt1_1, srcRegFilt2_1, srcRegFilt2, srcRegFilt3;
- unsigned int i;
-
- // create a register with 0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64
- addFilterReg64 = _mm_set1_epi32((int)0x0400040u);
- filtersReg = _mm_loadu_si128((__m128i *)filter);
- // converting the 16 bit (short) to 8 bit (byte) and have the same data
- // in both lanes of 128 bit register.
- filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
-
- // duplicate only the first 16 bits (first and second byte)
- // across 128 bit register
- firstFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x100u));
- // duplicate only the second 16 bits (third and forth byte)
- // across 128 bit register
- secondFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x302u));
- // duplicate only the third 16 bits (fifth and sixth byte)
- // across 128 bit register
- thirdFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x504u));
- // duplicate only the forth 16 bits (seventh and eighth byte)
- // across 128 bit register
- forthFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x706u));
-
- filt1Reg = _mm_load_si128((__m128i const *)filt1_global);
- filt2Reg = _mm_load_si128((__m128i const *)filt2_global);
- filt3Reg = _mm_load_si128((__m128i const *)filt3_global);
- filt4Reg = _mm_load_si128((__m128i const *)filt4_global);
-
- for (i = 0; i < output_height; i++) {
- srcReg1 = _mm_loadu_si128((__m128i *)(src_ptr-3));
-
- // filter the source buffer
- srcRegFilt1_1= _mm_shuffle_epi8(srcReg1, filt1Reg);
- srcRegFilt2= _mm_shuffle_epi8(srcReg1, filt2Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt1_1 = _mm_maddubs_epi16(srcRegFilt1_1, firstFilters);
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2, secondFilters);
-
- // add and saturate the results together
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1, srcRegFilt2);
-
- // filter the source buffer
- srcRegFilt3= _mm_shuffle_epi8(srcReg1, filt4Reg);
- srcRegFilt2= _mm_shuffle_epi8(srcReg1, filt3Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt3 = _mm_maddubs_epi16(srcRegFilt3, forthFilters);
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2, thirdFilters);
-
- // add and saturate the results together
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1,
- _mm_min_epi16(srcRegFilt3, srcRegFilt2));
-
- // reading the next 16 bytes.
- // (part of it was being read by earlier read)
- srcReg2 = _mm_loadu_si128((__m128i *)(src_ptr+5));
-
- // add and saturate the results together
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1,
- _mm_max_epi16(srcRegFilt3, srcRegFilt2));
-
- // filter the source buffer
- srcRegFilt2_1= _mm_shuffle_epi8(srcReg2, filt1Reg);
- srcRegFilt2= _mm_shuffle_epi8(srcReg2, filt2Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt2_1 = _mm_maddubs_epi16(srcRegFilt2_1, firstFilters);
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2, secondFilters);
-
- // add and saturate the results together
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1, srcRegFilt2);
-
- // filter the source buffer
- srcRegFilt3= _mm_shuffle_epi8(srcReg2, filt4Reg);
- srcRegFilt2= _mm_shuffle_epi8(srcReg2, filt3Reg);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt3 = _mm_maddubs_epi16(srcRegFilt3, forthFilters);
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2, thirdFilters);
-
- // add and saturate the results together
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1,
- _mm_min_epi16(srcRegFilt3, srcRegFilt2));
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1,
- _mm_max_epi16(srcRegFilt3, srcRegFilt2));
-
- srcRegFilt1_1 = _mm_adds_epi16(srcRegFilt1_1, addFilterReg64);
- srcRegFilt2_1 = _mm_adds_epi16(srcRegFilt2_1, addFilterReg64);
-
- // shift by 7 bit each 16 bit
- srcRegFilt1_1 = _mm_srai_epi16(srcRegFilt1_1, 7);
- srcRegFilt2_1 = _mm_srai_epi16(srcRegFilt2_1, 7);
-
- // shrink to 8 bit each 16 bits, the first lane contain the first
- // convolve result and the second lane contain the second convolve
- // result
- srcRegFilt1_1 = _mm_packus_epi16(srcRegFilt1_1, srcRegFilt2_1);
-
- src_ptr+=src_pixels_per_line;
-
- // save 16 bytes
- _mm_store_si128((__m128i*)output_ptr, srcRegFilt1_1);
-
- output_ptr+=output_pitch;
- }
-}
-
-void vp9_filter_block1d8_v8_intrin_ssse3(unsigned char *src_ptr,
- unsigned int src_pitch,
- unsigned char *output_ptr,
- unsigned int out_pitch,
- unsigned int output_height,
- int16_t *filter) {
- __m128i addFilterReg64, filtersReg, minReg, srcRegFilt6;
- __m128i firstFilters, secondFilters, thirdFilters, forthFilters;
- __m128i srcRegFilt1, srcRegFilt2, srcRegFilt3, srcRegFilt4, srcRegFilt5;
- unsigned int i;
-
- // create a register with 0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64
- addFilterReg64 = _mm_set1_epi32((int)0x0400040u);
- filtersReg = _mm_loadu_si128((__m128i *)filter);
- // converting the 16 bit (short) to 8 bit (byte) and have the same data
- // in both lanes of 128 bit register.
- filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
-
- // duplicate only the first 16 bits in the filter
- firstFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x100u));
- // duplicate only the second 16 bits in the filter
- secondFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x302u));
- // duplicate only the third 16 bits in the filter
- thirdFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x504u));
- // duplicate only the forth 16 bits in the filter
- forthFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x706u));
-
- for (i = 0; i < output_height; i++) {
- // load the first 8 bytes
- srcRegFilt1 = _mm_loadl_epi64((__m128i *)&src_ptr[0]);
- // load the next 8 bytes in stride of src_pitch
- srcRegFilt2 = _mm_loadl_epi64((__m128i *)&(src_ptr+src_pitch)[0]);
- srcRegFilt3 = _mm_loadl_epi64((__m128i *)&(src_ptr+src_pitch*2)[0]);
- srcRegFilt4 = _mm_loadl_epi64((__m128i *)&(src_ptr+src_pitch*3)[0]);
-
- // merge the result together
- srcRegFilt1 = _mm_unpacklo_epi8(srcRegFilt1, srcRegFilt2);
- srcRegFilt3 = _mm_unpacklo_epi8(srcRegFilt3, srcRegFilt4);
-
- // load the next 8 bytes in stride of src_pitch
- srcRegFilt2 = _mm_loadl_epi64((__m128i *)&(src_ptr+src_pitch*4)[0]);
- srcRegFilt4 = _mm_loadl_epi64((__m128i *)&(src_ptr+src_pitch*5)[0]);
- srcRegFilt5 = _mm_loadl_epi64((__m128i *)&(src_ptr+src_pitch*6)[0]);
- srcRegFilt6 = _mm_loadl_epi64((__m128i *)&(src_ptr+src_pitch*7)[0]);
-
- // merge the result together
- srcRegFilt2 = _mm_unpacklo_epi8(srcRegFilt2, srcRegFilt4);
- srcRegFilt5 = _mm_unpacklo_epi8(srcRegFilt5, srcRegFilt6);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt1 = _mm_maddubs_epi16(srcRegFilt1, firstFilters);
- srcRegFilt3 = _mm_maddubs_epi16(srcRegFilt3, secondFilters);
- srcRegFilt2 = _mm_maddubs_epi16(srcRegFilt2, thirdFilters);
- srcRegFilt5 = _mm_maddubs_epi16(srcRegFilt5, forthFilters);
-
- // add and saturate the results together
- minReg = _mm_min_epi16(srcRegFilt2, srcRegFilt3);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt5);
- srcRegFilt2 = _mm_max_epi16(srcRegFilt2, srcRegFilt3);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, minReg);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt2);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, addFilterReg64);
-
- // shift by 7 bit each 16 bit
- srcRegFilt1 = _mm_srai_epi16(srcRegFilt1, 7);
-
- // shrink to 8 bit each 16 bits
- srcRegFilt1 = _mm_packus_epi16(srcRegFilt1, srcRegFilt1);
-
- src_ptr+=src_pitch;
-
- // save only 8 bytes convolve result
- _mm_storel_epi64((__m128i*)&output_ptr[0], srcRegFilt1);
-
- output_ptr+=out_pitch;
- }
-}
-
-void vp9_filter_block1d16_v8_intrin_ssse3(unsigned char *src_ptr,
- unsigned int src_pitch,
- unsigned char *output_ptr,
- unsigned int out_pitch,
- unsigned int output_height,
- int16_t *filter) {
- __m128i addFilterReg64, filtersReg, srcRegFilt1, srcRegFilt2, srcRegFilt3;
- __m128i firstFilters, secondFilters, thirdFilters, forthFilters;
- __m128i srcRegFilt4, srcRegFilt5, srcRegFilt6, srcRegFilt7, srcRegFilt8;
- unsigned int i;
-
- // create a register with 0,64,0,64,0,64,0,64,0,64,0,64,0,64,0,64
- addFilterReg64 = _mm_set1_epi32((int)0x0400040u);
- filtersReg = _mm_loadu_si128((__m128i *)filter);
- // converting the 16 bit (short) to 8 bit (byte) and have the same data
- // in both lanes of 128 bit register.
- filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
-
- // duplicate only the first 16 bits in the filter
- firstFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x100u));
- // duplicate only the second 16 bits in the filter
- secondFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x302u));
- // duplicate only the third 16 bits in the filter
- thirdFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x504u));
- // duplicate only the forth 16 bits in the filter
- forthFilters = _mm_shuffle_epi8(filtersReg, _mm_set1_epi16(0x706u));
-
- for (i = 0; i < output_height; i++) {
- // load the first 16 bytes
- srcRegFilt1 = _mm_loadu_si128((__m128i *)(src_ptr));
- // load the next 16 bytes in stride of src_pitch
- srcRegFilt2 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch));
- srcRegFilt3 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*6));
- srcRegFilt4 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*7));
-
- // merge the result together
- srcRegFilt5 = _mm_unpacklo_epi8(srcRegFilt1, srcRegFilt2);
- srcRegFilt6 = _mm_unpacklo_epi8(srcRegFilt3, srcRegFilt4);
- srcRegFilt1 = _mm_unpackhi_epi8(srcRegFilt1, srcRegFilt2);
- srcRegFilt3 = _mm_unpackhi_epi8(srcRegFilt3, srcRegFilt4);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt5 = _mm_maddubs_epi16(srcRegFilt5, firstFilters);
- srcRegFilt6 = _mm_maddubs_epi16(srcRegFilt6, forthFilters);
- srcRegFilt1 = _mm_maddubs_epi16(srcRegFilt1, firstFilters);
- srcRegFilt3 = _mm_maddubs_epi16(srcRegFilt3, forthFilters);
-
- // add and saturate the results together
- srcRegFilt5 = _mm_adds_epi16(srcRegFilt5, srcRegFilt6);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, srcRegFilt3);
-
- // load the next 16 bytes in stride of two/three src_pitch
- srcRegFilt2 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*2));
- srcRegFilt3 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*3));
-
- // merge the result together
- srcRegFilt4 = _mm_unpacklo_epi8(srcRegFilt2, srcRegFilt3);
- srcRegFilt6 = _mm_unpackhi_epi8(srcRegFilt2, srcRegFilt3);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt4 = _mm_maddubs_epi16(srcRegFilt4, secondFilters);
- srcRegFilt6 = _mm_maddubs_epi16(srcRegFilt6, secondFilters);
-
- // load the next 16 bytes in stride of four/five src_pitch
- srcRegFilt2 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*4));
- srcRegFilt3 = _mm_loadu_si128((__m128i *)(src_ptr+src_pitch*5));
-
- // merge the result together
- srcRegFilt7 = _mm_unpacklo_epi8(srcRegFilt2, srcRegFilt3);
- srcRegFilt8 = _mm_unpackhi_epi8(srcRegFilt2, srcRegFilt3);
-
- // multiply 2 adjacent elements with the filter and add the result
- srcRegFilt7 = _mm_maddubs_epi16(srcRegFilt7, thirdFilters);
- srcRegFilt8 = _mm_maddubs_epi16(srcRegFilt8, thirdFilters);
-
- // add and saturate the results together
- srcRegFilt5 = _mm_adds_epi16(srcRegFilt5,
- _mm_min_epi16(srcRegFilt4, srcRegFilt7));
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1,
- _mm_min_epi16(srcRegFilt6, srcRegFilt8));
-
- // add and saturate the results together
- srcRegFilt5 = _mm_adds_epi16(srcRegFilt5,
- _mm_max_epi16(srcRegFilt4, srcRegFilt7));
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1,
- _mm_max_epi16(srcRegFilt6, srcRegFilt8));
- srcRegFilt5 = _mm_adds_epi16(srcRegFilt5, addFilterReg64);
- srcRegFilt1 = _mm_adds_epi16(srcRegFilt1, addFilterReg64);
-
- // shift by 7 bit each 16 bit
- srcRegFilt5 = _mm_srai_epi16(srcRegFilt5, 7);
- srcRegFilt1 = _mm_srai_epi16(srcRegFilt1, 7);
-
- // shrink to 8 bit each 16 bits, the first lane contain the first
- // convolve result and the second lane contain the second convolve
- // result
- srcRegFilt1 = _mm_packus_epi16(srcRegFilt5, srcRegFilt1);
-
- src_ptr+=src_pitch;
-
- // save 16 bytes convolve result
- _mm_store_si128((__m128i*)output_ptr, srcRegFilt1);
-
- output_ptr+=out_pitch;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_sse2.asm
deleted file mode 100644
index 9dc8d0a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_sse2.asm
+++ /dev/null
@@ -1,987 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;Note: tap3 and tap4 have to be applied and added after other taps to avoid
-;overflow.
-
-%macro GET_FILTERS_4 0
- mov rdx, arg(5) ;filter ptr
- mov rcx, 0x0400040
-
- movdqa xmm7, [rdx] ;load filters
- pshuflw xmm0, xmm7, 0b ;k0
- pshuflw xmm1, xmm7, 01010101b ;k1
- pshuflw xmm2, xmm7, 10101010b ;k2
- pshuflw xmm3, xmm7, 11111111b ;k3
- psrldq xmm7, 8
- pshuflw xmm4, xmm7, 0b ;k4
- pshuflw xmm5, xmm7, 01010101b ;k5
- pshuflw xmm6, xmm7, 10101010b ;k6
- pshuflw xmm7, xmm7, 11111111b ;k7
-
- punpcklqdq xmm0, xmm1
- punpcklqdq xmm2, xmm3
- punpcklqdq xmm5, xmm4
- punpcklqdq xmm6, xmm7
-
- movdqa k0k1, xmm0
- movdqa k2k3, xmm2
- movdqa k5k4, xmm5
- movdqa k6k7, xmm6
-
- movq xmm6, rcx
- pshufd xmm6, xmm6, 0
- movdqa krd, xmm6
-
- pxor xmm7, xmm7
- movdqa zero, xmm7
-%endm
-
-%macro APPLY_FILTER_4 1
- punpckldq xmm0, xmm1 ;two row in one register
- punpckldq xmm6, xmm7
- punpckldq xmm2, xmm3
- punpckldq xmm5, xmm4
-
- punpcklbw xmm0, zero ;unpack to word
- punpcklbw xmm6, zero
- punpcklbw xmm2, zero
- punpcklbw xmm5, zero
-
- pmullw xmm0, k0k1 ;multiply the filter factors
- pmullw xmm6, k6k7
- pmullw xmm2, k2k3
- pmullw xmm5, k5k4
-
- paddsw xmm0, xmm6 ;sum
- movdqa xmm1, xmm0
- psrldq xmm1, 8
- paddsw xmm0, xmm1
- paddsw xmm0, xmm2
- psrldq xmm2, 8
- paddsw xmm0, xmm5
- psrldq xmm5, 8
- paddsw xmm0, xmm2
- paddsw xmm0, xmm5
-
- paddsw xmm0, krd ;rounding
- psraw xmm0, 7 ;shift
- packuswb xmm0, xmm0 ;pack to byte
-
-%if %1
- movd xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movd [rdi], xmm0
-%endm
-
-%macro GET_FILTERS 0
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm7, [rdx] ;load filters
- pshuflw xmm0, xmm7, 0b ;k0
- pshuflw xmm1, xmm7, 01010101b ;k1
- pshuflw xmm2, xmm7, 10101010b ;k2
- pshuflw xmm3, xmm7, 11111111b ;k3
- pshufhw xmm4, xmm7, 0b ;k4
- pshufhw xmm5, xmm7, 01010101b ;k5
- pshufhw xmm6, xmm7, 10101010b ;k6
- pshufhw xmm7, xmm7, 11111111b ;k7
-
- punpcklwd xmm0, xmm0
- punpcklwd xmm1, xmm1
- punpcklwd xmm2, xmm2
- punpcklwd xmm3, xmm3
- punpckhwd xmm4, xmm4
- punpckhwd xmm5, xmm5
- punpckhwd xmm6, xmm6
- punpckhwd xmm7, xmm7
-
- movdqa k0, xmm0 ;store filter factors on stack
- movdqa k1, xmm1
- movdqa k2, xmm2
- movdqa k3, xmm3
- movdqa k4, xmm4
- movdqa k5, xmm5
- movdqa k6, xmm6
- movdqa k7, xmm7
-
- movq xmm6, rcx
- pshufd xmm6, xmm6, 0
- movdqa krd, xmm6 ;rounding
-
- pxor xmm7, xmm7
- movdqa zero, xmm7
-%endm
-
-%macro LOAD_VERT_8 1
- movq xmm0, [rsi + %1] ;0
- movq xmm1, [rsi + rax + %1] ;1
- movq xmm6, [rsi + rdx * 2 + %1] ;6
- lea rsi, [rsi + rax]
- movq xmm7, [rsi + rdx * 2 + %1] ;7
- movq xmm2, [rsi + rax + %1] ;2
- movq xmm3, [rsi + rax * 2 + %1] ;3
- movq xmm4, [rsi + rdx + %1] ;4
- movq xmm5, [rsi + rax * 4 + %1] ;5
-%endm
-
-%macro APPLY_FILTER_8 2
- punpcklbw xmm0, zero
- punpcklbw xmm1, zero
- punpcklbw xmm6, zero
- punpcklbw xmm7, zero
- punpcklbw xmm2, zero
- punpcklbw xmm5, zero
- punpcklbw xmm3, zero
- punpcklbw xmm4, zero
-
- pmullw xmm0, k0
- pmullw xmm1, k1
- pmullw xmm6, k6
- pmullw xmm7, k7
- pmullw xmm2, k2
- pmullw xmm5, k5
- pmullw xmm3, k3
- pmullw xmm4, k4
-
- paddsw xmm0, xmm1
- paddsw xmm0, xmm6
- paddsw xmm0, xmm7
- paddsw xmm0, xmm2
- paddsw xmm0, xmm5
- paddsw xmm0, xmm3
- paddsw xmm0, xmm4
-
- paddsw xmm0, krd ;rounding
- psraw xmm0, 7 ;shift
- packuswb xmm0, xmm0 ;pack back to byte
-%if %1
- movq xmm1, [rdi + %2]
- pavgb xmm0, xmm1
-%endif
- movq [rdi + %2], xmm0
-%endm
-
-;void vp9_filter_block1d4_v8_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d4_v8_sse2) PRIVATE
-sym(vp9_filter_block1d4_v8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 6
- %define k0k1 [rsp + 16 * 0]
- %define k2k3 [rsp + 16 * 1]
- %define k5k4 [rsp + 16 * 2]
- %define k6k7 [rsp + 16 * 3]
- %define krd [rsp + 16 * 4]
- %define zero [rsp + 16 * 5]
-
- GET_FILTERS_4
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rbx, DWORD PTR arg(3) ;out_pitch
- lea rdx, [rax + rax * 2]
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movd xmm0, [rsi] ;load src: row 0
- movd xmm1, [rsi + rax] ;1
- movd xmm6, [rsi + rdx * 2] ;6
- lea rsi, [rsi + rax]
- movd xmm7, [rsi + rdx * 2] ;7
- movd xmm2, [rsi + rax] ;2
- movd xmm3, [rsi + rax * 2] ;3
- movd xmm4, [rsi + rdx] ;4
- movd xmm5, [rsi + rax * 4] ;5
-
- APPLY_FILTER_4 0
-
- lea rdi, [rdi + rbx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 6
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d8_v8_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d8_v8_sse2) PRIVATE
-sym(vp9_filter_block1d8_v8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rbx, DWORD PTR arg(3) ;out_pitch
- lea rdx, [rax + rax * 2]
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- LOAD_VERT_8 0
- APPLY_FILTER_8 0, 0
-
- lea rdi, [rdi + rbx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d16_v8_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d16_v8_sse2) PRIVATE
-sym(vp9_filter_block1d16_v8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rbx, DWORD PTR arg(3) ;out_pitch
- lea rdx, [rax + rax * 2]
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- LOAD_VERT_8 0
- APPLY_FILTER_8 0, 0
- sub rsi, rax
-
- LOAD_VERT_8 8
- APPLY_FILTER_8 0, 8
- add rdi, rbx
-
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_v8_avg_sse2) PRIVATE
-sym(vp9_filter_block1d4_v8_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 6
- %define k0k1 [rsp + 16 * 0]
- %define k2k3 [rsp + 16 * 1]
- %define k5k4 [rsp + 16 * 2]
- %define k6k7 [rsp + 16 * 3]
- %define krd [rsp + 16 * 4]
- %define zero [rsp + 16 * 5]
-
- GET_FILTERS_4
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rbx, DWORD PTR arg(3) ;out_pitch
- lea rdx, [rax + rax * 2]
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movd xmm0, [rsi] ;load src: row 0
- movd xmm1, [rsi + rax] ;1
- movd xmm6, [rsi + rdx * 2] ;6
- lea rsi, [rsi + rax]
- movd xmm7, [rsi + rdx * 2] ;7
- movd xmm2, [rsi + rax] ;2
- movd xmm3, [rsi + rax * 2] ;3
- movd xmm4, [rsi + rdx] ;4
- movd xmm5, [rsi + rax * 4] ;5
-
- APPLY_FILTER_4 1
-
- lea rdi, [rdi + rbx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 6
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_v8_avg_sse2) PRIVATE
-sym(vp9_filter_block1d8_v8_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rbx, DWORD PTR arg(3) ;out_pitch
- lea rdx, [rax + rax * 2]
- movsxd rcx, DWORD PTR arg(4) ;output_height
-.loop:
- LOAD_VERT_8 0
- APPLY_FILTER_8 1, 0
-
- lea rdi, [rdi + rbx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_v8_avg_sse2) PRIVATE
-sym(vp9_filter_block1d16_v8_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rbx, DWORD PTR arg(3) ;out_pitch
- lea rdx, [rax + rax * 2]
- movsxd rcx, DWORD PTR arg(4) ;output_height
-.loop:
- LOAD_VERT_8 0
- APPLY_FILTER_8 1, 0
- sub rsi, rax
-
- LOAD_VERT_8 8
- APPLY_FILTER_8 1, 8
- add rdi, rbx
-
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d4_h8_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d4_h8_sse2) PRIVATE
-sym(vp9_filter_block1d4_h8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 6
- %define k0k1 [rsp + 16 * 0]
- %define k2k3 [rsp + 16 * 1]
- %define k5k4 [rsp + 16 * 2]
- %define k6k7 [rsp + 16 * 3]
- %define krd [rsp + 16 * 4]
- %define zero [rsp + 16 * 5]
-
- GET_FILTERS_4
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movdqu xmm0, [rsi - 3] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm3, xmm0
- movdqa xmm5, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm3, 3
- psrldq xmm5, 5
- psrldq xmm4, 4
-
- APPLY_FILTER_4 0
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 6
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d8_h8_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d8_h8_sse2) PRIVATE
-sym(vp9_filter_block1d8_h8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movdqu xmm0, [rsi - 3] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm5, xmm0
- movdqa xmm3, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm5, 5
- psrldq xmm3, 3
- psrldq xmm4, 4
-
- APPLY_FILTER_8 0, 0
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d16_h8_sse2
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d16_h8_sse2) PRIVATE
-sym(vp9_filter_block1d16_h8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movdqu xmm0, [rsi - 3] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm5, xmm0
- movdqa xmm3, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm5, 5
- psrldq xmm3, 3
- psrldq xmm4, 4
-
- APPLY_FILTER_8 0, 0
-
- movdqu xmm0, [rsi + 5] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm5, xmm0
- movdqa xmm3, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm5, 5
- psrldq xmm3, 3
- psrldq xmm4, 4
-
- APPLY_FILTER_8 0, 8
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_h8_avg_sse2) PRIVATE
-sym(vp9_filter_block1d4_h8_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 6
- %define k0k1 [rsp + 16 * 0]
- %define k2k3 [rsp + 16 * 1]
- %define k5k4 [rsp + 16 * 2]
- %define k6k7 [rsp + 16 * 3]
- %define krd [rsp + 16 * 4]
- %define zero [rsp + 16 * 5]
-
- GET_FILTERS_4
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movdqu xmm0, [rsi - 3] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm3, xmm0
- movdqa xmm5, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm3, 3
- psrldq xmm5, 5
- psrldq xmm4, 4
-
- APPLY_FILTER_4 1
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 6
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_h8_avg_sse2) PRIVATE
-sym(vp9_filter_block1d8_h8_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movdqu xmm0, [rsi - 3] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm5, xmm0
- movdqa xmm3, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm5, 5
- psrldq xmm3, 3
- psrldq xmm4, 4
-
- APPLY_FILTER_8 1, 0
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_h8_avg_sse2) PRIVATE
-sym(vp9_filter_block1d16_h8_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 10
- %define k0 [rsp + 16 * 0]
- %define k1 [rsp + 16 * 1]
- %define k2 [rsp + 16 * 2]
- %define k3 [rsp + 16 * 3]
- %define k4 [rsp + 16 * 4]
- %define k5 [rsp + 16 * 5]
- %define k6 [rsp + 16 * 6]
- %define k7 [rsp + 16 * 7]
- %define krd [rsp + 16 * 8]
- %define zero [rsp + 16 * 9]
-
- GET_FILTERS
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-
-.loop:
- movdqu xmm0, [rsi - 3] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm5, xmm0
- movdqa xmm3, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm5, 5
- psrldq xmm3, 3
- psrldq xmm4, 4
-
- APPLY_FILTER_8 1, 0
-
- movdqu xmm0, [rsi + 5] ;load src
-
- movdqa xmm1, xmm0
- movdqa xmm6, xmm0
- movdqa xmm7, xmm0
- movdqa xmm2, xmm0
- movdqa xmm5, xmm0
- movdqa xmm3, xmm0
- movdqa xmm4, xmm0
-
- psrldq xmm1, 1
- psrldq xmm6, 6
- psrldq xmm7, 7
- psrldq xmm2, 2
- psrldq xmm5, 5
- psrldq xmm3, 3
- psrldq xmm4, 4
-
- APPLY_FILTER_8 1, 8
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .loop
-
- add rsp, 16 * 10
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_ssse3.asm
deleted file mode 100644
index 634fa77..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_8t_ssse3.asm
+++ /dev/null
@@ -1,1060 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro VERTx4 1
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm4, [rdx] ;load filters
- movd xmm5, rcx
- packsswb xmm4, xmm4
- pshuflw xmm0, xmm4, 0b ;k0_k1
- pshuflw xmm1, xmm4, 01010101b ;k2_k3
- pshuflw xmm2, xmm4, 10101010b ;k4_k5
- pshuflw xmm3, xmm4, 11111111b ;k6_k7
-
- punpcklqdq xmm0, xmm0
- punpcklqdq xmm1, xmm1
- punpcklqdq xmm2, xmm2
- punpcklqdq xmm3, xmm3
-
- movdqa k0k1, xmm0
- movdqa k2k3, xmm1
- pshufd xmm5, xmm5, 0
- movdqa k4k5, xmm2
- movdqa k6k7, xmm3
- movdqa krd, xmm5
-
- movsxd rdx, DWORD PTR arg(1) ;pixels_per_line
-
-%if ABI_IS_32BIT=0
- movsxd r8, DWORD PTR arg(3) ;out_pitch
-%endif
- mov rax, rsi
- movsxd rcx, DWORD PTR arg(4) ;output_height
- add rax, rdx
-
- lea rbx, [rdx + rdx*4]
- add rbx, rdx ;pitch * 6
-
-.loop:
- movd xmm0, [rsi] ;A
- movd xmm1, [rsi + rdx] ;B
- movd xmm2, [rsi + rdx * 2] ;C
- movd xmm3, [rax + rdx * 2] ;D
- movd xmm4, [rsi + rdx * 4] ;E
- movd xmm5, [rax + rdx * 4] ;F
-
- punpcklbw xmm0, xmm1 ;A B
- punpcklbw xmm2, xmm3 ;C D
- punpcklbw xmm4, xmm5 ;E F
-
- movd xmm6, [rsi + rbx] ;G
- movd xmm7, [rax + rbx] ;H
-
- pmaddubsw xmm0, k0k1
- pmaddubsw xmm2, k2k3
- punpcklbw xmm6, xmm7 ;G H
- pmaddubsw xmm4, k4k5
- pmaddubsw xmm6, k6k7
-
- movdqa xmm1, xmm2
- paddsw xmm0, xmm6
- pmaxsw xmm2, xmm4
- pminsw xmm4, xmm1
- paddsw xmm0, xmm4
- paddsw xmm0, xmm2
-
- paddsw xmm0, krd
- psraw xmm0, 7
- packuswb xmm0, xmm0
-
- add rsi, rdx
- add rax, rdx
-%if %1
- movd xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movd [rdi], xmm0
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;out_pitch
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .loop
-%endm
-
-%macro VERTx8 1
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm4, [rdx] ;load filters
- movq xmm5, rcx
- packsswb xmm4, xmm4
- pshuflw xmm0, xmm4, 0b ;k0_k1
- pshuflw xmm1, xmm4, 01010101b ;k2_k3
- pshuflw xmm2, xmm4, 10101010b ;k4_k5
- pshuflw xmm3, xmm4, 11111111b ;k6_k7
-
- punpcklqdq xmm0, xmm0
- punpcklqdq xmm1, xmm1
- punpcklqdq xmm2, xmm2
- punpcklqdq xmm3, xmm3
-
- movdqa k0k1, xmm0
- movdqa k2k3, xmm1
- pshufd xmm5, xmm5, 0
- movdqa k4k5, xmm2
- movdqa k6k7, xmm3
- movdqa krd, xmm5
-
- movsxd rdx, DWORD PTR arg(1) ;pixels_per_line
-
-%if ABI_IS_32BIT=0
- movsxd r8, DWORD PTR arg(3) ;out_pitch
-%endif
- mov rax, rsi
- movsxd rcx, DWORD PTR arg(4) ;output_height
- add rax, rdx
-
- lea rbx, [rdx + rdx*4]
- add rbx, rdx ;pitch * 6
-
-.loop:
- movq xmm0, [rsi] ;A
- movq xmm1, [rsi + rdx] ;B
- movq xmm2, [rsi + rdx * 2] ;C
- movq xmm3, [rax + rdx * 2] ;D
- movq xmm4, [rsi + rdx * 4] ;E
- movq xmm5, [rax + rdx * 4] ;F
-
- punpcklbw xmm0, xmm1 ;A B
- punpcklbw xmm2, xmm3 ;C D
- punpcklbw xmm4, xmm5 ;E F
-
- movq xmm6, [rsi + rbx] ;G
- movq xmm7, [rax + rbx] ;H
-
- pmaddubsw xmm0, k0k1
- pmaddubsw xmm2, k2k3
- punpcklbw xmm6, xmm7 ;G H
- pmaddubsw xmm4, k4k5
- pmaddubsw xmm6, k6k7
-
- paddsw xmm0, xmm6
- movdqa xmm1, xmm2
- pmaxsw xmm2, xmm4
- pminsw xmm4, xmm1
- paddsw xmm0, xmm4
- paddsw xmm0, xmm2
-
- paddsw xmm0, krd
- psraw xmm0, 7
- packuswb xmm0, xmm0
-
- add rsi, rdx
- add rax, rdx
-%if %1
- movq xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movq [rdi], xmm0
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;out_pitch
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .loop
-%endm
-
-
-%macro VERTx16 1
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm4, [rdx] ;load filters
- movq xmm5, rcx
- packsswb xmm4, xmm4
- pshuflw xmm0, xmm4, 0b ;k0_k1
- pshuflw xmm1, xmm4, 01010101b ;k2_k3
- pshuflw xmm2, xmm4, 10101010b ;k4_k5
- pshuflw xmm3, xmm4, 11111111b ;k6_k7
-
- punpcklqdq xmm0, xmm0
- punpcklqdq xmm1, xmm1
- punpcklqdq xmm2, xmm2
- punpcklqdq xmm3, xmm3
-
- movdqa k0k1, xmm0
- movdqa k2k3, xmm1
- pshufd xmm5, xmm5, 0
- movdqa k4k5, xmm2
- movdqa k6k7, xmm3
- movdqa krd, xmm5
-
- movsxd rdx, DWORD PTR arg(1) ;pixels_per_line
-
-%if ABI_IS_32BIT=0
- movsxd r8, DWORD PTR arg(3) ;out_pitch
-%endif
- mov rax, rsi
- movsxd rcx, DWORD PTR arg(4) ;output_height
- add rax, rdx
-
- lea rbx, [rdx + rdx*4]
- add rbx, rdx ;pitch * 6
-
-.loop:
- movq xmm0, [rsi] ;A
- movq xmm1, [rsi + rdx] ;B
- movq xmm2, [rsi + rdx * 2] ;C
- movq xmm3, [rax + rdx * 2] ;D
- movq xmm4, [rsi + rdx * 4] ;E
- movq xmm5, [rax + rdx * 4] ;F
-
- punpcklbw xmm0, xmm1 ;A B
- punpcklbw xmm2, xmm3 ;C D
- punpcklbw xmm4, xmm5 ;E F
-
- movq xmm6, [rsi + rbx] ;G
- movq xmm7, [rax + rbx] ;H
-
- pmaddubsw xmm0, k0k1
- pmaddubsw xmm2, k2k3
- punpcklbw xmm6, xmm7 ;G H
- pmaddubsw xmm4, k4k5
- pmaddubsw xmm6, k6k7
-
- paddsw xmm0, xmm6
- movdqa xmm1, xmm2
- pmaxsw xmm2, xmm4
- pminsw xmm4, xmm1
- paddsw xmm0, xmm4
- paddsw xmm0, xmm2
-
- paddsw xmm0, krd
- psraw xmm0, 7
- packuswb xmm0, xmm0
-%if %1
- movq xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movq [rdi], xmm0
-
- movq xmm0, [rsi + 8] ;A
- movq xmm1, [rsi + rdx + 8] ;B
- movq xmm2, [rsi + rdx * 2 + 8] ;C
- movq xmm3, [rax + rdx * 2 + 8] ;D
- movq xmm4, [rsi + rdx * 4 + 8] ;E
- movq xmm5, [rax + rdx * 4 + 8] ;F
-
- punpcklbw xmm0, xmm1 ;A B
- punpcklbw xmm2, xmm3 ;C D
- punpcklbw xmm4, xmm5 ;E F
-
-
- movq xmm6, [rsi + rbx + 8] ;G
- movq xmm7, [rax + rbx + 8] ;H
- punpcklbw xmm6, xmm7 ;G H
-
-
- pmaddubsw xmm0, k0k1
- pmaddubsw xmm2, k2k3
- pmaddubsw xmm4, k4k5
- pmaddubsw xmm6, k6k7
-
- paddsw xmm0, xmm6
- paddsw xmm0, xmm2
- paddsw xmm0, xmm4
- paddsw xmm0, krd
-
- psraw xmm0, 7
- packuswb xmm0, xmm0
-
- add rsi, rdx
- add rax, rdx
-%if %1
- movq xmm1, [rdi+8]
- pavgb xmm0, xmm1
-%endif
-
- movq [rdi+8], xmm0
-
-%if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;out_pitch
-%else
- add rdi, r8
-%endif
- dec rcx
- jnz .loop
-%endm
-
-;void vp9_filter_block1d8_v8_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d4_v8_ssse3) PRIVATE
-sym(vp9_filter_block1d4_v8_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- VERTx4 0
-
- add rsp, 16*5
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d8_v8_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d8_v8_ssse3) PRIVATE
-sym(vp9_filter_block1d8_v8_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- VERTx8 0
-
- add rsp, 16*5
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d16_v8_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pitch,
-; unsigned char *output_ptr,
-; unsigned int out_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d16_v8_ssse3) PRIVATE
-sym(vp9_filter_block1d16_v8_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- VERTx16 0
-
- add rsp, 16*5
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-
-global sym(vp9_filter_block1d4_v8_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d4_v8_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- VERTx4 1
-
- add rsp, 16*5
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_v8_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d8_v8_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- VERTx8 1
-
- add rsp, 16*5
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_v8_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d16_v8_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- push rbx
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- VERTx16 1
-
- add rsp, 16*5
- pop rsp
- pop rbx
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-%macro HORIZx4_ROW 2
- movdqa %2, %1
- pshufb %1, [GLOBAL(shuf_t0t1)]
- pshufb %2, [GLOBAL(shuf_t2t3)]
- pmaddubsw %1, k0k1k4k5
- pmaddubsw %2, k2k3k6k7
-
- movdqa xmm4, %1
- movdqa xmm5, %2
- psrldq %1, 8
- psrldq %2, 8
- movdqa xmm6, xmm5
-
- paddsw xmm4, %2
- pmaxsw xmm5, %1
- pminsw %1, xmm6
- paddsw %1, xmm4
- paddsw %1, xmm5
-
- paddsw %1, krd
- psraw %1, 7
- packuswb %1, %1
-%endm
-
-%macro HORIZx4 1
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm4, [rdx] ;load filters
- movq xmm5, rcx
- packsswb xmm4, xmm4
- pshuflw xmm6, xmm4, 0b ;k0_k1
- pshufhw xmm6, xmm6, 10101010b ;k0_k1_k4_k5
- pshuflw xmm7, xmm4, 01010101b ;k2_k3
- pshufhw xmm7, xmm7, 11111111b ;k2_k3_k6_k7
- pshufd xmm5, xmm5, 0 ;rounding
-
- movdqa k0k1k4k5, xmm6
- movdqa k2k3k6k7, xmm7
- movdqa krd, xmm5
-
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;output_pitch
- movsxd rcx, dword ptr arg(4) ;output_height
- shr rcx, 1
-.loop:
- ;Do two rows once
- movq xmm0, [rsi - 3] ;load src
- movq xmm1, [rsi + 5]
- movq xmm2, [rsi + rax - 3]
- movq xmm3, [rsi + rax + 5]
- punpcklqdq xmm0, xmm1
- punpcklqdq xmm2, xmm3
-
- HORIZx4_ROW xmm0, xmm1
- HORIZx4_ROW xmm2, xmm3
-%if %1
- movd xmm1, [rdi]
- pavgb xmm0, xmm1
- movd xmm3, [rdi + rdx]
- pavgb xmm2, xmm3
-%endif
- movd [rdi], xmm0
- movd [rdi +rdx], xmm2
-
- lea rsi, [rsi + rax]
- prefetcht0 [rsi + 4 * rax - 3]
- lea rsi, [rsi + rax]
- lea rdi, [rdi + 2 * rdx]
- prefetcht0 [rsi + 2 * rax - 3]
-
- dec rcx
- jnz .loop
-
- ; Do last row if output_height is odd
- movsxd rcx, dword ptr arg(4) ;output_height
- and rcx, 1
- je .done
-
- movq xmm0, [rsi - 3] ; load src
- movq xmm1, [rsi + 5]
- punpcklqdq xmm0, xmm1
-
- HORIZx4_ROW xmm0, xmm1
-%if %1
- movd xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movd [rdi], xmm0
-.done
-%endm
-
-%macro HORIZx8_ROW 4
- movdqa %2, %1
- movdqa %3, %1
- movdqa %4, %1
-
- pshufb %1, [GLOBAL(shuf_t0t1)]
- pshufb %2, [GLOBAL(shuf_t2t3)]
- pshufb %3, [GLOBAL(shuf_t4t5)]
- pshufb %4, [GLOBAL(shuf_t6t7)]
-
- pmaddubsw %1, k0k1
- pmaddubsw %2, k2k3
- pmaddubsw %3, k4k5
- pmaddubsw %4, k6k7
-
- paddsw %1, %4
- movdqa %4, %2
- pmaxsw %2, %3
- pminsw %3, %4
- paddsw %1, %3
- paddsw %1, %2
-
- paddsw %1, krd
- psraw %1, 7
- packuswb %1, %1
-%endm
-
-%macro HORIZx8 1
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm4, [rdx] ;load filters
- movd xmm5, rcx
- packsswb xmm4, xmm4
- pshuflw xmm0, xmm4, 0b ;k0_k1
- pshuflw xmm1, xmm4, 01010101b ;k2_k3
- pshuflw xmm2, xmm4, 10101010b ;k4_k5
- pshuflw xmm3, xmm4, 11111111b ;k6_k7
-
- punpcklqdq xmm0, xmm0
- punpcklqdq xmm1, xmm1
- punpcklqdq xmm2, xmm2
- punpcklqdq xmm3, xmm3
-
- movdqa k0k1, xmm0
- movdqa k2k3, xmm1
- pshufd xmm5, xmm5, 0
- movdqa k4k5, xmm2
- movdqa k6k7, xmm3
- movdqa krd, xmm5
-
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;output_pitch
- movsxd rcx, dword ptr arg(4) ;output_height
- shr rcx, 1
-
-.loop:
- movq xmm0, [rsi - 3] ;load src
- movq xmm3, [rsi + 5]
- movq xmm4, [rsi + rax - 3]
- movq xmm7, [rsi + rax + 5]
- punpcklqdq xmm0, xmm3
- punpcklqdq xmm4, xmm7
-
- HORIZx8_ROW xmm0, xmm1, xmm2, xmm3
- HORIZx8_ROW xmm4, xmm5, xmm6, xmm7
-%if %1
- movq xmm1, [rdi]
- movq xmm2, [rdi + rdx]
- pavgb xmm0, xmm1
- pavgb xmm4, xmm2
-%endif
- movq [rdi], xmm0
- movq [rdi + rdx], xmm4
-
- lea rsi, [rsi + rax]
- prefetcht0 [rsi + 4 * rax - 3]
- lea rsi, [rsi + rax]
- lea rdi, [rdi + 2 * rdx]
- prefetcht0 [rsi + 2 * rax - 3]
- dec rcx
- jnz .loop
-
- ;Do last row if output_height is odd
- movsxd rcx, dword ptr arg(4) ;output_height
- and rcx, 1
- je .done
-
- movq xmm0, [rsi - 3]
- movq xmm3, [rsi + 5]
- punpcklqdq xmm0, xmm3
-
- HORIZx8_ROW xmm0, xmm1, xmm2, xmm3
-%if %1
- movq xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movq [rdi], xmm0
-.done
-%endm
-
-%macro HORIZx16 1
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm4, [rdx] ;load filters
- movq xmm5, rcx
- packsswb xmm4, xmm4
- pshuflw xmm0, xmm4, 0b ;k0_k1
- pshuflw xmm1, xmm4, 01010101b ;k2_k3
- pshuflw xmm2, xmm4, 10101010b ;k4_k5
- pshuflw xmm3, xmm4, 11111111b ;k6_k7
-
- punpcklqdq xmm0, xmm0
- punpcklqdq xmm1, xmm1
- punpcklqdq xmm2, xmm2
- punpcklqdq xmm3, xmm3
-
- movdqa k0k1, xmm0
- movdqa k2k3, xmm1
- pshufd xmm5, xmm5, 0
- movdqa k4k5, xmm2
- movdqa k6k7, xmm3
- movdqa krd, xmm5
-
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;output_pitch
- movsxd rcx, dword ptr arg(4) ;output_height
-
-.loop:
- prefetcht0 [rsi + 2 * rax -3]
-
- movq xmm0, [rsi - 3] ;load src data
- movq xmm4, [rsi + 5]
- movq xmm7, [rsi + 13]
- punpcklqdq xmm0, xmm4
- punpcklqdq xmm4, xmm7
-
- movdqa xmm1, xmm0
- movdqa xmm2, xmm0
- movdqa xmm3, xmm0
- movdqa xmm5, xmm4
- movdqa xmm6, xmm4
- movdqa xmm7, xmm4
-
- pshufb xmm0, [GLOBAL(shuf_t0t1)]
- pshufb xmm1, [GLOBAL(shuf_t2t3)]
- pshufb xmm2, [GLOBAL(shuf_t4t5)]
- pshufb xmm3, [GLOBAL(shuf_t6t7)]
- pshufb xmm4, [GLOBAL(shuf_t0t1)]
- pshufb xmm5, [GLOBAL(shuf_t2t3)]
- pshufb xmm6, [GLOBAL(shuf_t4t5)]
- pshufb xmm7, [GLOBAL(shuf_t6t7)]
-
- pmaddubsw xmm0, k0k1
- pmaddubsw xmm1, k2k3
- pmaddubsw xmm2, k4k5
- pmaddubsw xmm3, k6k7
- pmaddubsw xmm4, k0k1
- pmaddubsw xmm5, k2k3
- pmaddubsw xmm6, k4k5
- pmaddubsw xmm7, k6k7
-
- paddsw xmm0, xmm3
- movdqa xmm3, xmm1
- pmaxsw xmm1, xmm2
- pminsw xmm2, xmm3
- paddsw xmm0, xmm2
- paddsw xmm0, xmm1
-
- paddsw xmm4, xmm7
- movdqa xmm7, xmm5
- pmaxsw xmm5, xmm6
- pminsw xmm6, xmm7
- paddsw xmm4, xmm6
- paddsw xmm4, xmm5
-
- paddsw xmm0, krd
- paddsw xmm4, krd
- psraw xmm0, 7
- psraw xmm4, 7
- packuswb xmm0, xmm0
- packuswb xmm4, xmm4
- punpcklqdq xmm0, xmm4
-%if %1
- movdqa xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
-
- lea rsi, [rsi + rax]
- movdqa [rdi], xmm0
-
- lea rdi, [rdi + rdx]
- dec rcx
- jnz .loop
-%endm
-
-;void vp9_filter_block1d4_h8_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d4_h8_ssse3) PRIVATE
-sym(vp9_filter_block1d4_h8_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 3
- %define k0k1k4k5 [rsp + 16 * 0]
- %define k2k3k6k7 [rsp + 16 * 1]
- %define krd [rsp + 16 * 2]
-
- HORIZx4 0
-
- add rsp, 16 * 3
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d8_h8_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d8_h8_ssse3) PRIVATE
-sym(vp9_filter_block1d8_h8_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- HORIZx8 0
-
- add rsp, 16*5
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_filter_block1d16_h8_ssse3
-;(
-; unsigned char *src_ptr,
-; unsigned int src_pixels_per_line,
-; unsigned char *output_ptr,
-; unsigned int output_pitch,
-; unsigned int output_height,
-; short *filter
-;)
-global sym(vp9_filter_block1d16_h8_ssse3) PRIVATE
-sym(vp9_filter_block1d16_h8_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- HORIZx16 0
-
- add rsp, 16*5
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_h8_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d4_h8_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16 * 3
- %define k0k1k4k5 [rsp + 16 * 0]
- %define k2k3k6k7 [rsp + 16 * 1]
- %define krd [rsp + 16 * 2]
-
- HORIZx4 1
-
- add rsp, 16 * 3
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_h8_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d8_h8_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- HORIZx8 1
-
- add rsp, 16*5
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_h8_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d16_h8_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- ALIGN_STACK 16, rax
- sub rsp, 16*5
- %define k0k1 [rsp + 16*0]
- %define k2k3 [rsp + 16*1]
- %define k4k5 [rsp + 16*2]
- %define k6k7 [rsp + 16*3]
- %define krd [rsp + 16*4]
-
- HORIZx16 1
-
- add rsp, 16*5
- pop rsp
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-SECTION_RODATA
-align 16
-shuf_t0t1:
- db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
-align 16
-shuf_t2t3:
- db 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10
-align 16
-shuf_t4t5:
- db 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12
-align 16
-shuf_t6t7:
- db 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_sse2.asm
deleted file mode 100644
index d94ccf2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_sse2.asm
+++ /dev/null
@@ -1,448 +0,0 @@
-;
-; Copyright (c) 2014 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro GET_PARAM_4 0
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm3, [rdx] ;load filters
- pshuflw xmm4, xmm3, 11111111b ;k3
- psrldq xmm3, 8
- pshuflw xmm3, xmm3, 0b ;k4
- punpcklqdq xmm4, xmm3 ;k3k4
-
- movq xmm3, rcx ;rounding
- pshufd xmm3, xmm3, 0
-
- pxor xmm2, xmm2
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-%endm
-
-%macro APPLY_FILTER_4 1
-
- punpckldq xmm0, xmm1 ;two row in one register
- punpcklbw xmm0, xmm2 ;unpack to word
- pmullw xmm0, xmm4 ;multiply the filter factors
-
- movdqa xmm1, xmm0
- psrldq xmm1, 8
- paddsw xmm0, xmm1
-
- paddsw xmm0, xmm3 ;rounding
- psraw xmm0, 7 ;shift
- packuswb xmm0, xmm0 ;pack to byte
-
-%if %1
- movd xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
-
- movd [rdi], xmm0
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
-%endm
-
-%macro GET_PARAM 0
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm7, [rdx] ;load filters
-
- pshuflw xmm6, xmm7, 11111111b ;k3
- pshufhw xmm7, xmm7, 0b ;k4
- punpcklwd xmm6, xmm6
- punpckhwd xmm7, xmm7
-
- movq xmm4, rcx ;rounding
- pshufd xmm4, xmm4, 0
-
- pxor xmm5, xmm5
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-%endm
-
-%macro APPLY_FILTER_8 1
- punpcklbw xmm0, xmm5
- punpcklbw xmm1, xmm5
-
- pmullw xmm0, xmm6
- pmullw xmm1, xmm7
- paddsw xmm0, xmm1
- paddsw xmm0, xmm4 ;rounding
- psraw xmm0, 7 ;shift
- packuswb xmm0, xmm0 ;pack back to byte
-%if %1
- movq xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movq [rdi], xmm0 ;store the result
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
-%endm
-
-%macro APPLY_FILTER_16 1
- punpcklbw xmm0, xmm5
- punpcklbw xmm1, xmm5
- punpckhbw xmm2, xmm5
- punpckhbw xmm3, xmm5
-
- pmullw xmm0, xmm6
- pmullw xmm1, xmm7
- pmullw xmm2, xmm6
- pmullw xmm3, xmm7
-
- paddsw xmm0, xmm1
- paddsw xmm2, xmm3
-
- paddsw xmm0, xmm4 ;rounding
- paddsw xmm2, xmm4
- psraw xmm0, 7 ;shift
- psraw xmm2, 7
- packuswb xmm0, xmm2 ;pack back to byte
-%if %1
- movdqu xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movdqu [rdi], xmm0 ;store the result
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
-%endm
-
-global sym(vp9_filter_block1d4_v2_sse2) PRIVATE
-sym(vp9_filter_block1d4_v2_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movd xmm0, [rsi] ;load src
- movd xmm1, [rsi + rax]
-
- APPLY_FILTER_4 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_v2_sse2) PRIVATE
-sym(vp9_filter_block1d8_v2_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movq xmm0, [rsi] ;0
- movq xmm1, [rsi + rax] ;1
-
- APPLY_FILTER_8 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_v2_sse2) PRIVATE
-sym(vp9_filter_block1d16_v2_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;0
- movdqu xmm1, [rsi + rax] ;1
- movdqa xmm2, xmm0
- movdqa xmm3, xmm1
-
- APPLY_FILTER_16 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_v2_avg_sse2) PRIVATE
-sym(vp9_filter_block1d4_v2_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movd xmm0, [rsi] ;load src
- movd xmm1, [rsi + rax]
-
- APPLY_FILTER_4 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_v2_avg_sse2) PRIVATE
-sym(vp9_filter_block1d8_v2_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movq xmm0, [rsi] ;0
- movq xmm1, [rsi + rax] ;1
-
- APPLY_FILTER_8 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_v2_avg_sse2) PRIVATE
-sym(vp9_filter_block1d16_v2_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;0
- movdqu xmm1, [rsi + rax] ;1
- movdqa xmm2, xmm0
- movdqa xmm3, xmm1
-
- APPLY_FILTER_16 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_h2_sse2) PRIVATE
-sym(vp9_filter_block1d4_h2_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_4 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_h2_sse2) PRIVATE
-sym(vp9_filter_block1d8_h2_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_8 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_h2_sse2) PRIVATE
-sym(vp9_filter_block1d16_h2_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqu xmm1, [rsi + 1]
- movdqa xmm2, xmm0
- movdqa xmm3, xmm1
-
- APPLY_FILTER_16 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_h2_avg_sse2) PRIVATE
-sym(vp9_filter_block1d4_h2_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_4 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_h2_avg_sse2) PRIVATE
-sym(vp9_filter_block1d8_h2_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_8 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_h2_avg_sse2) PRIVATE
-sym(vp9_filter_block1d16_h2_avg_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqu xmm1, [rsi + 1]
- movdqa xmm2, xmm0
- movdqa xmm3, xmm1
-
- APPLY_FILTER_16 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_ssse3.asm
deleted file mode 100644
index b5e18fe..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/common/x86/vp9_subpixel_bilinear_ssse3.asm
+++ /dev/null
@@ -1,422 +0,0 @@
-;
-; Copyright (c) 2014 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro GET_PARAM_4 0
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm3, [rdx] ;load filters
- psrldq xmm3, 6
- packsswb xmm3, xmm3
- pshuflw xmm3, xmm3, 0b ;k3_k4
-
- movq xmm2, rcx ;rounding
- pshufd xmm2, xmm2, 0
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-%endm
-
-%macro APPLY_FILTER_4 1
- punpcklbw xmm0, xmm1
- pmaddubsw xmm0, xmm3
-
- paddsw xmm0, xmm2 ;rounding
- psraw xmm0, 7 ;shift
- packuswb xmm0, xmm0 ;pack to byte
-
-%if %1
- movd xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movd [rdi], xmm0
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
-%endm
-
-%macro GET_PARAM 0
- mov rdx, arg(5) ;filter ptr
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- mov rcx, 0x0400040
-
- movdqa xmm7, [rdx] ;load filters
- psrldq xmm7, 6
- packsswb xmm7, xmm7
- pshuflw xmm7, xmm7, 0b ;k3_k4
- punpcklwd xmm7, xmm7
-
- movq xmm6, rcx ;rounding
- pshufd xmm6, xmm6, 0
-
- movsxd rax, DWORD PTR arg(1) ;pixels_per_line
- movsxd rdx, DWORD PTR arg(3) ;out_pitch
- movsxd rcx, DWORD PTR arg(4) ;output_height
-%endm
-
-%macro APPLY_FILTER_8 1
- punpcklbw xmm0, xmm1
- pmaddubsw xmm0, xmm7
-
- paddsw xmm0, xmm6 ;rounding
- psraw xmm0, 7 ;shift
- packuswb xmm0, xmm0 ;pack back to byte
-
-%if %1
- movq xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movq [rdi], xmm0 ;store the result
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
-%endm
-
-%macro APPLY_FILTER_16 1
- punpcklbw xmm0, xmm1
- punpckhbw xmm2, xmm1
- pmaddubsw xmm0, xmm7
- pmaddubsw xmm2, xmm7
-
- paddsw xmm0, xmm6 ;rounding
- paddsw xmm2, xmm6
- psraw xmm0, 7 ;shift
- psraw xmm2, 7
- packuswb xmm0, xmm2 ;pack back to byte
-
-%if %1
- movdqu xmm1, [rdi]
- pavgb xmm0, xmm1
-%endif
- movdqu [rdi], xmm0 ;store the result
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
- dec rcx
-%endm
-
-global sym(vp9_filter_block1d4_v2_ssse3) PRIVATE
-sym(vp9_filter_block1d4_v2_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movd xmm0, [rsi] ;load src
- movd xmm1, [rsi + rax]
-
- APPLY_FILTER_4 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_v2_ssse3) PRIVATE
-sym(vp9_filter_block1d8_v2_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movq xmm0, [rsi] ;0
- movq xmm1, [rsi + rax] ;1
-
- APPLY_FILTER_8 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_v2_ssse3) PRIVATE
-sym(vp9_filter_block1d16_v2_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;0
- movdqu xmm1, [rsi + rax] ;1
- movdqa xmm2, xmm0
-
- APPLY_FILTER_16 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_v2_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d4_v2_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movd xmm0, [rsi] ;load src
- movd xmm1, [rsi + rax]
-
- APPLY_FILTER_4 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_v2_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d8_v2_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movq xmm0, [rsi] ;0
- movq xmm1, [rsi + rax] ;1
-
- APPLY_FILTER_8 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_v2_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d16_v2_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;0
- movdqu xmm1, [rsi + rax] ;1
- movdqa xmm2, xmm0
-
- APPLY_FILTER_16 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_h2_ssse3) PRIVATE
-sym(vp9_filter_block1d4_h2_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_4 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_h2_ssse3) PRIVATE
-sym(vp9_filter_block1d8_h2_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_8 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_h2_ssse3) PRIVATE
-sym(vp9_filter_block1d16_h2_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqu xmm1, [rsi + 1]
- movdqa xmm2, xmm0
-
- APPLY_FILTER_16 0
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d4_h2_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d4_h2_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM_4
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_4 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d8_h2_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d8_h2_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqa xmm1, xmm0
- psrldq xmm1, 1
-
- APPLY_FILTER_8 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-global sym(vp9_filter_block1d16_h2_avg_ssse3) PRIVATE
-sym(vp9_filter_block1d16_h2_avg_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rsi
- push rdi
- ; end prolog
-
- GET_PARAM
-.loop:
- movdqu xmm0, [rsi] ;load src
- movdqu xmm1, [rsi + 1]
- movdqa xmm2, xmm0
-
- APPLY_FILTER_16 1
- jnz .loop
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.c
deleted file mode 100644
index 2939d4a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.c
+++ /dev/null
@@ -1,1343 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdlib.h> // qsort()
-
-#include "./vp9_rtcd.h"
-#include "./vpx_scale_rtcd.h"
-
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/mem_ops.h"
-#include "vpx_scale/vpx_scale.h"
-
-#include "vp9/common/vp9_alloccommon.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_reconintra.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_seg_common.h"
-#include "vp9/common/vp9_tile_common.h"
-
-#include "vp9/decoder/vp9_decodeframe.h"
-#include "vp9/decoder/vp9_detokenize.h"
-#include "vp9/decoder/vp9_decodemv.h"
-#include "vp9/decoder/vp9_decoder.h"
-#include "vp9/decoder/vp9_dsubexp.h"
-#include "vp9/decoder/vp9_dthread.h"
-#include "vp9/decoder/vp9_read_bit_buffer.h"
-#include "vp9/decoder/vp9_reader.h"
-#include "vp9/decoder/vp9_thread.h"
-
-#include "trace_conf.h"
-
-static int is_compound_reference_allowed(const VP9_COMMON *cm) {
- int i;
- for (i = 1; i < REFS_PER_FRAME; ++i)
- if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1])
- return 1;
-
- return 0;
-}
-
-static void setup_compound_reference_mode(VP9_COMMON *cm) {
- if (cm->ref_frame_sign_bias[LAST_FRAME] ==
- cm->ref_frame_sign_bias[GOLDEN_FRAME]) {
- cm->comp_fixed_ref = ALTREF_FRAME;
- cm->comp_var_ref[0] = LAST_FRAME;
- cm->comp_var_ref[1] = GOLDEN_FRAME;
- } else if (cm->ref_frame_sign_bias[LAST_FRAME] ==
- cm->ref_frame_sign_bias[ALTREF_FRAME]) {
- cm->comp_fixed_ref = GOLDEN_FRAME;
- cm->comp_var_ref[0] = LAST_FRAME;
- cm->comp_var_ref[1] = ALTREF_FRAME;
- } else {
- cm->comp_fixed_ref = LAST_FRAME;
- cm->comp_var_ref[0] = GOLDEN_FRAME;
- cm->comp_var_ref[1] = ALTREF_FRAME;
- }
-}
-
-static int read_is_valid(const uint8_t *start, size_t len, const uint8_t *end) {
- return len != 0 && len <= (size_t)(end - start);
-}
-
-static int decode_unsigned_max(struct vp9_read_bit_buffer *rb, int max) {
- const int data = vp9_rb_read_literal(rb, get_unsigned_bits(max));
- return data > max ? max : data;
-}
-
-static TX_MODE read_tx_mode(vp9_reader *r) {
- TX_MODE tx_mode = vp9_read_literal(r, 2);
- if (tx_mode == ALLOW_32X32)
- tx_mode += vp9_read_bit(r);
- return tx_mode;
-}
-
-static void read_tx_mode_probs(struct tx_probs *tx_probs, vp9_reader *r) {
- int i, j;
-
- for (i = 0; i < TX_SIZE_CONTEXTS; ++i)
- for (j = 0; j < TX_SIZES - 3; ++j)
- vp9_diff_update_prob(r, &tx_probs->p8x8[i][j]);
-
- for (i = 0; i < TX_SIZE_CONTEXTS; ++i)
- for (j = 0; j < TX_SIZES - 2; ++j)
- vp9_diff_update_prob(r, &tx_probs->p16x16[i][j]);
-
- for (i = 0; i < TX_SIZE_CONTEXTS; ++i)
- for (j = 0; j < TX_SIZES - 1; ++j)
- vp9_diff_update_prob(r, &tx_probs->p32x32[i][j]);
-}
-
-static void read_switchable_interp_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
- int i, j;
- for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
- for (i = 0; i < SWITCHABLE_FILTERS - 1; ++i)
- vp9_diff_update_prob(r, &fc->switchable_interp_prob[j][i]);
-}
-
-static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
- int i, j;
- for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
- for (j = 0; j < INTER_MODES - 1; ++j)
- vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
-}
-
-static REFERENCE_MODE read_frame_reference_mode(const VP9_COMMON *cm,
- vp9_reader *r) {
- if (is_compound_reference_allowed(cm)) {
- return vp9_read_bit(r) ? (vp9_read_bit(r) ? REFERENCE_MODE_SELECT
- : COMPOUND_REFERENCE)
- : SINGLE_REFERENCE;
- } else {
- return SINGLE_REFERENCE;
- }
-}
-
-static void read_frame_reference_mode_probs(VP9_COMMON *cm, vp9_reader *r) {
- FRAME_CONTEXT *const fc = &cm->fc;
- int i;
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT)
- for (i = 0; i < COMP_INTER_CONTEXTS; ++i)
- vp9_diff_update_prob(r, &fc->comp_inter_prob[i]);
-
- if (cm->reference_mode != COMPOUND_REFERENCE)
- for (i = 0; i < REF_CONTEXTS; ++i) {
- vp9_diff_update_prob(r, &fc->single_ref_prob[i][0]);
- vp9_diff_update_prob(r, &fc->single_ref_prob[i][1]);
- }
-
- if (cm->reference_mode != SINGLE_REFERENCE)
- for (i = 0; i < REF_CONTEXTS; ++i)
- vp9_diff_update_prob(r, &fc->comp_ref_prob[i]);
-}
-
-static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) {
- int i;
- for (i = 0; i < n; ++i)
- if (vp9_read(r, MV_UPDATE_PROB))
- p[i] = (vp9_read_literal(r, 7) << 1) | 1;
-}
-
-static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) {
- int i, j;
-
- update_mv_probs(ctx->joints, MV_JOINTS - 1, r);
-
- for (i = 0; i < 2; ++i) {
- nmv_component *const comp_ctx = &ctx->comps[i];
- update_mv_probs(&comp_ctx->sign, 1, r);
- update_mv_probs(comp_ctx->classes, MV_CLASSES - 1, r);
- update_mv_probs(comp_ctx->class0, CLASS0_SIZE - 1, r);
- update_mv_probs(comp_ctx->bits, MV_OFFSET_BITS, r);
- }
-
- for (i = 0; i < 2; ++i) {
- nmv_component *const comp_ctx = &ctx->comps[i];
- for (j = 0; j < CLASS0_SIZE; ++j)
- update_mv_probs(comp_ctx->class0_fp[j], MV_FP_SIZE - 1, r);
- update_mv_probs(comp_ctx->fp, 3, r);
- }
-
- if (allow_hp) {
- for (i = 0; i < 2; ++i) {
- nmv_component *const comp_ctx = &ctx->comps[i];
- update_mv_probs(&comp_ctx->class0_hp, 1, r);
- update_mv_probs(&comp_ctx->hp, 1, r);
- }
- }
-}
-
-static void setup_plane_dequants(VP9_COMMON *cm, MACROBLOCKD *xd, int q_index) {
- int i;
- xd->plane[0].dequant = cm->y_dequant[q_index];
-
- for (i = 1; i < MAX_MB_PLANE; i++)
- xd->plane[i].dequant = cm->uv_dequant[q_index];
-}
-
-static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
- TX_SIZE tx_size, uint8_t *dst, int stride,
- int eob) {
- struct macroblockd_plane *const pd = &xd->plane[plane];
- if (eob > 0) {
- TX_TYPE tx_type = DCT_DCT;
- const PLANE_TYPE plane_type = pd->plane_type;
- int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- switch (tx_size) {
- case TX_4X4:
- tx_type = get_tx_type_4x4(plane_type, xd, block);
- if (tx_type == DCT_DCT)
- xd->itxm_add(dqcoeff, dst, stride, eob);
- else
- vp9_iht4x4_16_add(dqcoeff, dst, stride, tx_type);
- break;
- case TX_8X8:
- tx_type = get_tx_type(plane_type, xd);
- vp9_iht8x8_add(tx_type, dqcoeff, dst, stride, eob);
- break;
- case TX_16X16:
- tx_type = get_tx_type(plane_type, xd);
- vp9_iht16x16_add(tx_type, dqcoeff, dst, stride, eob);
- break;
- case TX_32X32:
- tx_type = DCT_DCT;
- vp9_idct32x32_add(dqcoeff, dst, stride, eob);
- break;
- default:
- assert(0 && "Invalid transform size");
- }
-
- if (eob == 1) {
- vpx_memset(dqcoeff, 0, 2 * sizeof(dqcoeff[0]));
- } else {
- if (tx_type == DCT_DCT && tx_size <= TX_16X16 && eob <= 10)
- vpx_memset(dqcoeff, 0, 4 * (4 << tx_size) * sizeof(dqcoeff[0]));
- else if (tx_size == TX_32X32 && eob <= 34)
- vpx_memset(dqcoeff, 0, 256 * sizeof(dqcoeff[0]));
- else
- vpx_memset(dqcoeff, 0, (16 << (tx_size << 1)) * sizeof(dqcoeff[0]));
- }
- }
-}
-
-struct intra_args {
- VP9_COMMON *cm;
- MACROBLOCKD *xd;
- vp9_reader *r;
-};
-
-static void predict_and_reconstruct_intra_block(int plane, int block,
- BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- struct intra_args *const args = (struct intra_args *)arg;
- VP9_COMMON *const cm = args->cm;
- MACROBLOCKD *const xd = args->xd;
- struct macroblockd_plane *const pd = &xd->plane[plane];
- MODE_INFO *const mi = xd->mi[0];
- const MB_PREDICTION_MODE mode = (plane == 0) ? get_y_mode(mi, block)
- : mi->mbmi.uv_mode;
- int x, y;
- uint8_t *dst;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
- dst = &pd->dst.buf[4 * y * pd->dst.stride + 4 * x];
-
- vp9_predict_intra_block(xd, block >> (tx_size << 1),
- b_width_log2(plane_bsize), tx_size, mode,
- dst, pd->dst.stride, dst, pd->dst.stride,
- x, y, plane);
-
- if (!mi->mbmi.skip) {
- const int eob = vp9_decode_block_tokens(cm, xd, plane, block,
- plane_bsize, x, y, tx_size,
- args->r);
- inverse_transform_block(xd, plane, block, tx_size, dst, pd->dst.stride,
- eob);
- }
-}
-
-struct inter_args {
- VP9_COMMON *cm;
- MACROBLOCKD *xd;
- vp9_reader *r;
- int *eobtotal;
-};
-
-static void reconstruct_inter_block(int plane, int block,
- BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- struct inter_args *args = (struct inter_args *)arg;
- VP9_COMMON *const cm = args->cm;
- MACROBLOCKD *const xd = args->xd;
- struct macroblockd_plane *const pd = &xd->plane[plane];
- int x, y, eob;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
- eob = vp9_decode_block_tokens(cm, xd, plane, block, plane_bsize, x, y,
- tx_size, args->r);
- inverse_transform_block(xd, plane, block, tx_size,
- &pd->dst.buf[4 * y * pd->dst.stride + 4 * x],
- pd->dst.stride, eob);
- *args->eobtotal += eob;
-}
-
-static MB_MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- const TileInfo *const tile,
- BLOCK_SIZE bsize, int mi_row, int mi_col) {
- const int bw = num_8x8_blocks_wide_lookup[bsize];
- const int bh = num_8x8_blocks_high_lookup[bsize];
- const int x_mis = MIN(bw, cm->mi_cols - mi_col);
- const int y_mis = MIN(bh, cm->mi_rows - mi_row);
- const int offset = mi_row * cm->mi_stride + mi_col;
- int x, y;
-
- xd->mi = cm->mi_grid_visible + offset;
- xd->mi[0] = &cm->mi[offset];
- xd->mi[0]->mbmi.sb_type = bsize;
- for (y = 0; y < y_mis; ++y)
- for (x = !y; x < x_mis; ++x)
- xd->mi[y * cm->mi_stride + x] = xd->mi[0];
-
- set_skip_context(xd, mi_row, mi_col);
-
- // Distance of Mb to the various image edges. These are specified to 8th pel
- // as they are always compared to values that are in 1/8th pel units
- set_mi_row_col(xd, tile, mi_row, bh, mi_col, bw, cm->mi_rows, cm->mi_cols);
-
- vp9_setup_dst_planes(xd, get_frame_new_buffer(cm), mi_row, mi_col);
- return &xd->mi[0]->mbmi;
-}
-
-static void set_ref(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- int idx, int mi_row, int mi_col) {
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- RefBuffer *ref_buffer = &cm->frame_refs[mbmi->ref_frame[idx] - LAST_FRAME];
- xd->block_refs[idx] = ref_buffer;
- if (!vp9_is_valid_scale(&ref_buffer->sf))
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
- "Invalid scale factors");
- vp9_setup_pre_planes(xd, idx, ref_buffer->buf, mi_row, mi_col,
- &ref_buffer->sf);
- xd->corrupted |= ref_buffer->buf->corrupted;
-}
-
-static void decode_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- const TileInfo *const tile,
- int mi_row, int mi_col,
- vp9_reader *r, BLOCK_SIZE bsize) {
- const int less8x8 = bsize < BLOCK_8X8;
- MB_MODE_INFO *mbmi = set_offsets(cm, xd, tile, bsize, mi_row, mi_col);
- vp9_read_mode_info(cm, xd, tile, mi_row, mi_col, r);
-
- if (less8x8)
- bsize = BLOCK_8X8;
-
- if (mbmi->skip) {
- reset_skip_context(xd, bsize);
- } else {
- if (cm->seg.enabled)
- setup_plane_dequants(cm, xd, vp9_get_qindex(&cm->seg, mbmi->segment_id,
- cm->base_qindex));
- }
-
- if (!is_inter_block(mbmi)) {
- struct intra_args arg = { cm, xd, r };
- vp9_foreach_transformed_block(xd, bsize,
- predict_and_reconstruct_intra_block, &arg);
- } else {
- // Setup
- set_ref(cm, xd, 0, mi_row, mi_col);
- if (has_second_ref(mbmi))
- set_ref(cm, xd, 1, mi_row, mi_col);
-
- // Prediction
- vp9_dec_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
-
- // Reconstruction
- if (!mbmi->skip) {
- int eobtotal = 0;
- struct inter_args arg = { cm, xd, r, &eobtotal };
- vp9_foreach_transformed_block(xd, bsize, reconstruct_inter_block, &arg);
- if (!less8x8 && eobtotal == 0)
- mbmi->skip = 1; // skip loopfilter
- }
- }
-
- xd->corrupted |= vp9_reader_has_error(r);
-}
-
-static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *xd, int hbs,
- int mi_row, int mi_col, BLOCK_SIZE bsize,
- vp9_reader *r) {
- const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
- const vp9_prob *const probs = get_partition_probs(cm, ctx);
- const int has_rows = (mi_row + hbs) < cm->mi_rows;
- const int has_cols = (mi_col + hbs) < cm->mi_cols;
- PARTITION_TYPE p;
-
- if (has_rows && has_cols)
- p = (PARTITION_TYPE)vp9_read_tree(r, vp9_partition_tree, probs);
- else if (!has_rows && has_cols)
- p = vp9_read(r, probs[1]) ? PARTITION_SPLIT : PARTITION_HORZ;
- else if (has_rows && !has_cols)
- p = vp9_read(r, probs[2]) ? PARTITION_SPLIT : PARTITION_VERT;
- else
- p = PARTITION_SPLIT;
-
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.partition[ctx][p];
-
- return p;
-}
-
-static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- const TileInfo *const tile,
- int mi_row, int mi_col,
- vp9_reader* r, BLOCK_SIZE bsize) {
- const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
- PARTITION_TYPE partition;
- BLOCK_SIZE subsize;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- partition = read_partition(cm, xd, hbs, mi_row, mi_col, bsize, r);
- subsize = get_subsize(bsize, partition);
- if (subsize < BLOCK_8X8) {
- decode_block(cm, xd, tile, mi_row, mi_col, r, subsize);
- } else {
- switch (partition) {
- case PARTITION_NONE:
- decode_block(cm, xd, tile, mi_row, mi_col, r, subsize);
- break;
- case PARTITION_HORZ:
- decode_block(cm, xd, tile, mi_row, mi_col, r, subsize);
- if (mi_row + hbs < cm->mi_rows)
- decode_block(cm, xd, tile, mi_row + hbs, mi_col, r, subsize);
- break;
- case PARTITION_VERT:
- decode_block(cm, xd, tile, mi_row, mi_col, r, subsize);
- if (mi_col + hbs < cm->mi_cols)
- decode_block(cm, xd, tile, mi_row, mi_col + hbs, r, subsize);
- break;
- case PARTITION_SPLIT:
- decode_partition(cm, xd, tile, mi_row, mi_col, r, subsize);
- decode_partition(cm, xd, tile, mi_row, mi_col + hbs, r, subsize);
- decode_partition(cm, xd, tile, mi_row + hbs, mi_col, r, subsize);
- decode_partition(cm, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize);
- break;
- default:
- assert(0 && "Invalid partition type");
- }
- }
-
- // update partition context
- if (bsize >= BLOCK_8X8 &&
- (bsize == BLOCK_8X8 || partition != PARTITION_SPLIT))
- update_partition_context(xd, mi_row, mi_col, subsize, bsize);
-}
-
-static void setup_token_decoder(const uint8_t *data,
- const uint8_t *data_end,
- size_t read_size,
- struct vpx_internal_error_info *error_info,
- vp9_reader *r) {
- // Validate the calculated partition length. If the buffer
- // described by the partition can't be fully read, then restrict
- // it to the portion that can be (for EC mode) or throw an error.
- if (!read_is_valid(data, read_size, data_end))
- vpx_internal_error(error_info, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt tile length");
-
- if (vp9_reader_init(r, data, read_size))
- vpx_internal_error(error_info, VPX_CODEC_MEM_ERROR,
- "Failed to allocate bool decoder %d", 1);
-}
-
-static void read_coef_probs_common(vp9_coeff_probs_model *coef_probs,
- vp9_reader *r) {
- int i, j, k, l, m;
-
- if (vp9_read_bit(r))
- 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 (m = 0; m < UNCONSTRAINED_NODES; ++m)
- vp9_diff_update_prob(r, &coef_probs[i][j][k][l][m]);
-}
-
-static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode,
- vp9_reader *r) {
- const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
- TX_SIZE tx_size;
- for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
- read_coef_probs_common(fc->coef_probs[tx_size], r);
-}
-
-static void setup_segmentation(struct segmentation *seg,
- struct vp9_read_bit_buffer *rb) {
- int i, j;
-
- seg->update_map = 0;
- seg->update_data = 0;
-
- seg->enabled = vp9_rb_read_bit(rb);
- if (!seg->enabled)
- return;
-
- // Segmentation map update
- seg->update_map = vp9_rb_read_bit(rb);
- if (seg->update_map) {
- for (i = 0; i < SEG_TREE_PROBS; i++)
- seg->tree_probs[i] = vp9_rb_read_bit(rb) ? vp9_rb_read_literal(rb, 8)
- : MAX_PROB;
-
- seg->temporal_update = vp9_rb_read_bit(rb);
- if (seg->temporal_update) {
- for (i = 0; i < PREDICTION_PROBS; i++)
- seg->pred_probs[i] = vp9_rb_read_bit(rb) ? vp9_rb_read_literal(rb, 8)
- : MAX_PROB;
- } else {
- for (i = 0; i < PREDICTION_PROBS; i++)
- seg->pred_probs[i] = MAX_PROB;
- }
- }
-
- // Segmentation data update
- seg->update_data = vp9_rb_read_bit(rb);
- if (seg->update_data) {
- seg->abs_delta = vp9_rb_read_bit(rb);
-
- vp9_clearall_segfeatures(seg);
-
- for (i = 0; i < MAX_SEGMENTS; i++) {
- for (j = 0; j < SEG_LVL_MAX; j++) {
- int data = 0;
- const int feature_enabled = vp9_rb_read_bit(rb);
- if (feature_enabled) {
- vp9_enable_segfeature(seg, i, j);
- data = decode_unsigned_max(rb, vp9_seg_feature_data_max(j));
- if (vp9_is_segfeature_signed(j))
- data = vp9_rb_read_bit(rb) ? -data : data;
- }
- vp9_set_segdata(seg, i, j, data);
- }
- }
- }
-}
-
-static void setup_loopfilter(struct loopfilter *lf,
- struct vp9_read_bit_buffer *rb) {
- lf->filter_level = vp9_rb_read_literal(rb, 6);
- lf->sharpness_level = vp9_rb_read_literal(rb, 3);
-
- // Read in loop filter deltas applied at the MB level based on mode or ref
- // frame.
- lf->mode_ref_delta_update = 0;
-
- lf->mode_ref_delta_enabled = vp9_rb_read_bit(rb);
- if (lf->mode_ref_delta_enabled) {
- lf->mode_ref_delta_update = vp9_rb_read_bit(rb);
- if (lf->mode_ref_delta_update) {
- int i;
-
- for (i = 0; i < MAX_REF_LF_DELTAS; i++)
- if (vp9_rb_read_bit(rb))
- lf->ref_deltas[i] = vp9_rb_read_signed_literal(rb, 6);
-
- for (i = 0; i < MAX_MODE_LF_DELTAS; i++)
- if (vp9_rb_read_bit(rb))
- lf->mode_deltas[i] = vp9_rb_read_signed_literal(rb, 6);
- }
- }
-}
-
-static int read_delta_q(struct vp9_read_bit_buffer *rb, int *delta_q) {
- const int old = *delta_q;
- *delta_q = vp9_rb_read_bit(rb) ? vp9_rb_read_signed_literal(rb, 4) : 0;
- return old != *delta_q;
-}
-
-static void setup_quantization(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- struct vp9_read_bit_buffer *rb) {
- int update = 0;
-
- cm->base_qindex = vp9_rb_read_literal(rb, QINDEX_BITS);
- update |= read_delta_q(rb, &cm->y_dc_delta_q);
- update |= read_delta_q(rb, &cm->uv_dc_delta_q);
- update |= read_delta_q(rb, &cm->uv_ac_delta_q);
- if (update)
- vp9_init_dequantizer(cm);
-
- xd->lossless = cm->base_qindex == 0 &&
- cm->y_dc_delta_q == 0 &&
- cm->uv_dc_delta_q == 0 &&
- cm->uv_ac_delta_q == 0;
-
- xd->itxm_add = xd->lossless ? vp9_iwht4x4_add : vp9_idct4x4_add;
-}
-
-static INTERP_FILTER read_interp_filter(struct vp9_read_bit_buffer *rb) {
- const INTERP_FILTER literal_to_filter[] = { EIGHTTAP_SMOOTH,
- EIGHTTAP,
- EIGHTTAP_SHARP,
- BILINEAR };
- return vp9_rb_read_bit(rb) ? SWITCHABLE
- : literal_to_filter[vp9_rb_read_literal(rb, 2)];
-}
-
-static void read_frame_size(struct vp9_read_bit_buffer *rb,
- int *width, int *height) {
- const int w = vp9_rb_read_literal(rb, 16) + 1;
- const int h = vp9_rb_read_literal(rb, 16) + 1;
- *width = w;
- *height = h;
-}
-
-static void setup_display_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
- cm->display_width = cm->width;
- cm->display_height = cm->height;
- if (vp9_rb_read_bit(rb))
- read_frame_size(rb, &cm->display_width, &cm->display_height);
-}
-
-static void apply_frame_size(VP9_COMMON *cm, int width, int height) {
- if (cm->width != width || cm->height != height) {
- // Change in frame size.
- // TODO(agrange) Don't test width/height, check overall size.
- if (width > cm->width || height > cm->height) {
- // Rescale frame buffers only if they're not big enough already.
- if (vp9_resize_frame_buffers(cm, width, height))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate frame buffers");
- }
-
- cm->width = width;
- cm->height = height;
-
- vp9_update_frame_size(cm);
- }
-
- if (vp9_realloc_frame_buffer(
- get_frame_new_buffer(cm), cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y, VP9_DEC_BORDER_IN_PIXELS,
- &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer, cm->get_fb_cb,
- cm->cb_priv)) {
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate frame buffer");
- }
-}
-
-static void setup_frame_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
- int width, height;
- read_frame_size(rb, &width, &height);
- apply_frame_size(cm, width, height);
- setup_display_size(cm, rb);
-}
-
-static void setup_frame_size_with_refs(VP9_COMMON *cm,
- struct vp9_read_bit_buffer *rb) {
- int width, height;
- int found = 0, i;
- for (i = 0; i < REFS_PER_FRAME; ++i) {
- if (vp9_rb_read_bit(rb)) {
- YV12_BUFFER_CONFIG *const buf = cm->frame_refs[i].buf;
- width = buf->y_crop_width;
- height = buf->y_crop_height;
- found = 1;
- break;
- }
- }
-
- if (!found)
- read_frame_size(rb, &width, &height);
-
- if (width <= 0 || height <= 0)
- vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
- "Referenced frame with invalid size");
-
- apply_frame_size(cm, width, height);
- setup_display_size(cm, rb);
-}
-
-static void decode_tile(VP9D_COMP *pbi, const TileInfo *const tile,
- vp9_reader *r) {
- const int num_threads = pbi->oxcf.max_threads;
- VP9_COMMON *const cm = &pbi->common;
- int mi_row, mi_col;
- MACROBLOCKD *xd = &pbi->mb;
-
- if (pbi->do_loopfilter_inline) {
- LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
- lf_data->frame_buffer = get_frame_new_buffer(cm);
- lf_data->cm = cm;
- lf_data->xd = pbi->mb;
- lf_data->stop = 0;
- lf_data->y_only = 0;
- vp9_loop_filter_frame_init(cm, cm->lf.filter_level);
- }
-
- for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end;
- mi_row += MI_BLOCK_SIZE) {
- // For a SB there are 2 left contexts, each pertaining to a MB row within
- vp9_zero(xd->left_context);
- vp9_zero(xd->left_seg_context);
- for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
- mi_col += MI_BLOCK_SIZE) {
- decode_partition(cm, xd, tile, mi_row, mi_col, r, BLOCK_64X64);
- }
-
- if (pbi->do_loopfilter_inline) {
- const int lf_start = mi_row - MI_BLOCK_SIZE;
- LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
-
- // delay the loopfilter by 1 macroblock row.
- if (lf_start < 0) continue;
-
- // decoding has completed: finish up the loop filter in this thread.
- if (mi_row + MI_BLOCK_SIZE >= tile->mi_row_end) continue;
-
- vp9_worker_sync(&pbi->lf_worker);
- lf_data->start = lf_start;
- lf_data->stop = mi_row;
- if (num_threads > 1) {
- vp9_worker_launch(&pbi->lf_worker);
- } else {
- vp9_worker_execute(&pbi->lf_worker);
- }
- }
- }
-
- if (pbi->do_loopfilter_inline) {
- LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
-
- vp9_worker_sync(&pbi->lf_worker);
- lf_data->start = lf_data->stop;
- lf_data->stop = cm->mi_rows;
- vp9_worker_execute(&pbi->lf_worker);
- }
-}
-
-static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
- int min_log2_tile_cols, max_log2_tile_cols, max_ones;
- vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
-
- // columns
- max_ones = max_log2_tile_cols - min_log2_tile_cols;
- cm->log2_tile_cols = min_log2_tile_cols;
- while (max_ones-- && vp9_rb_read_bit(rb))
- cm->log2_tile_cols++;
-
- // rows
- cm->log2_tile_rows = vp9_rb_read_bit(rb);
- if (cm->log2_tile_rows)
- cm->log2_tile_rows += vp9_rb_read_bit(rb);
-}
-
-// Reads the next tile returning its size and adjusting '*data' accordingly
-// based on 'is_last'.
-static size_t get_tile(const uint8_t *const data_end,
- int is_last,
- struct vpx_internal_error_info *error_info,
- const uint8_t **data) {
- size_t size;
-
- if (!is_last) {
- if (!read_is_valid(*data, 4, data_end))
- vpx_internal_error(error_info, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt tile length");
-
- size = mem_get_be32(*data);
- *data += 4;
-
- if (size > (size_t)(data_end - *data))
- vpx_internal_error(error_info, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt tile size");
- } else {
- size = data_end - *data;
- }
- return size;
-}
-
-typedef struct TileBuffer {
- const uint8_t *data;
- size_t size;
- int col; // only used with multi-threaded decoding
-} TileBuffer;
-
-static const uint8_t *decode_tiles(VP9D_COMP *pbi,
- const uint8_t *data,
- const uint8_t *data_end) {
- VP9_COMMON *const cm = &pbi->common;
- const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols);
- const int tile_cols = 1 << cm->log2_tile_cols;
- const int tile_rows = 1 << cm->log2_tile_rows;
- TileBuffer tile_buffers[4][1 << 6];
- int tile_row, tile_col;
- const uint8_t *end = NULL;
- vp9_reader r;
-
- assert(tile_rows <= 4);
- assert(tile_cols <= (1 << 6));
-
- // Note: this memset assumes above_context[0], [1] and [2]
- // are allocated as part of the same buffer.
- vpx_memset(cm->above_context, 0,
- sizeof(*cm->above_context) * MAX_MB_PLANE * 2 * aligned_cols);
-
- vpx_memset(cm->above_seg_context, 0,
- sizeof(*cm->above_seg_context) * aligned_cols);
-
- // Load tile data into tile_buffers
- for (tile_row = 0; tile_row < tile_rows; ++tile_row) {
- for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
- const int last_tile = tile_row == tile_rows - 1 &&
- tile_col == tile_cols - 1;
- const size_t size = get_tile(data_end, last_tile, &cm->error, &data);
- TileBuffer *const buf = &tile_buffers[tile_row][tile_col];
- buf->data = data;
- buf->size = size;
- data += size;
- }
- }
-
- // Decode tiles using data from tile_buffers
- for (tile_row = 0; tile_row < tile_rows; ++tile_row) {
- for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
- const int col = pbi->oxcf.inv_tile_order ? tile_cols - tile_col - 1
- : tile_col;
- const int last_tile = tile_row == tile_rows - 1 &&
- col == tile_cols - 1;
- const TileBuffer *const buf = &tile_buffers[tile_row][col];
- TileInfo tile;
-
- vp9_tile_init(&tile, cm, tile_row, col);
- setup_token_decoder(buf->data, data_end, buf->size, &cm->error, &r);
- decode_tile(pbi, &tile, &r);
-
- if (last_tile)
- end = vp9_reader_find_end(&r);
- }
- }
-
- return end;
-}
-
-static int tile_worker_hook(void *arg1, void *arg2) {
- TileWorkerData *const tile_data = (TileWorkerData*)arg1;
- const TileInfo *const tile = (TileInfo*)arg2;
- int mi_row, mi_col;
-
- for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end;
- mi_row += MI_BLOCK_SIZE) {
- vp9_zero(tile_data->xd.left_context);
- vp9_zero(tile_data->xd.left_seg_context);
- for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
- mi_col += MI_BLOCK_SIZE) {
- decode_partition(tile_data->cm, &tile_data->xd, tile,
- mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64);
- }
- }
- return !tile_data->xd.corrupted;
-}
-
-// sorts in descending order
-static int compare_tile_buffers(const void *a, const void *b) {
- const TileBuffer *const buf1 = (const TileBuffer*)a;
- const TileBuffer *const buf2 = (const TileBuffer*)b;
- if (buf1->size < buf2->size) {
- return 1;
- } else if (buf1->size == buf2->size) {
- return 0;
- } else {
- return -1;
- }
-}
-
-static const uint8_t *decode_tiles_mt(VP9D_COMP *pbi,
- const uint8_t *data,
- const uint8_t *data_end) {
- VP9_COMMON *const cm = &pbi->common;
- const uint8_t *bit_reader_end = NULL;
- const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
- const int tile_cols = 1 << cm->log2_tile_cols;
- const int tile_rows = 1 << cm->log2_tile_rows;
- const int num_workers = MIN(pbi->oxcf.max_threads & ~1, tile_cols);
- TileBuffer tile_buffers[1 << 6];
- int n;
- int final_worker = -1;
-
- assert(tile_cols <= (1 << 6));
- assert(tile_rows == 1);
- (void)tile_rows;
-
- if (num_workers > pbi->num_tile_workers) {
- int i;
- CHECK_MEM_ERROR(cm, pbi->tile_workers,
- vpx_realloc(pbi->tile_workers,
- num_workers * sizeof(*pbi->tile_workers)));
- for (i = pbi->num_tile_workers; i < num_workers; ++i) {
- VP9Worker *const worker = &pbi->tile_workers[i];
- ++pbi->num_tile_workers;
-
- vp9_worker_init(worker);
- CHECK_MEM_ERROR(cm, worker->data1,
- vpx_memalign(32, sizeof(TileWorkerData)));
- CHECK_MEM_ERROR(cm, worker->data2, vpx_malloc(sizeof(TileInfo)));
- if (i < num_workers - 1 && !vp9_worker_reset(worker)) {
- vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
- "Tile decoder thread creation failed");
- }
- }
- }
-
- // Reset tile decoding hook
- for (n = 0; n < pbi->num_tile_workers; ++n) {
- pbi->tile_workers[n].hook = (VP9WorkerHook)tile_worker_hook;
- }
-
- // Note: this memset assumes above_context[0], [1] and [2]
- // are allocated as part of the same buffer.
- vpx_memset(cm->above_context, 0,
- sizeof(*cm->above_context) * MAX_MB_PLANE * 2 * aligned_mi_cols);
- vpx_memset(cm->above_seg_context, 0,
- sizeof(*cm->above_seg_context) * aligned_mi_cols);
-
- // Load tile data into tile_buffers
- for (n = 0; n < tile_cols; ++n) {
- const size_t size =
- get_tile(data_end, n == tile_cols - 1, &cm->error, &data);
- TileBuffer *const buf = &tile_buffers[n];
- buf->data = data;
- buf->size = size;
- buf->col = n;
- data += size;
- }
-
- // Sort the buffers based on size in descending order.
- qsort(tile_buffers, tile_cols, sizeof(tile_buffers[0]), compare_tile_buffers);
-
- // Rearrange the tile buffers such that per-tile group the largest, and
- // presumably the most difficult, tile will be decoded in the main thread.
- // This should help minimize the number of instances where the main thread is
- // waiting for a worker to complete.
- {
- int group_start = 0;
- while (group_start < tile_cols) {
- const TileBuffer largest = tile_buffers[group_start];
- const int group_end = MIN(group_start + num_workers, tile_cols) - 1;
- memmove(tile_buffers + group_start, tile_buffers + group_start + 1,
- (group_end - group_start) * sizeof(tile_buffers[0]));
- tile_buffers[group_end] = largest;
- group_start = group_end + 1;
- }
- }
-
- n = 0;
- while (n < tile_cols) {
- int i;
- for (i = 0; i < num_workers && n < tile_cols; ++i) {
- VP9Worker *const worker = &pbi->tile_workers[i];
- TileWorkerData *const tile_data = (TileWorkerData*)worker->data1;
- TileInfo *const tile = (TileInfo*)worker->data2;
- TileBuffer *const buf = &tile_buffers[n];
-
- tile_data->cm = cm;
- tile_data->xd = pbi->mb;
- tile_data->xd.corrupted = 0;
- vp9_tile_init(tile, tile_data->cm, 0, buf->col);
- setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
- &tile_data->bit_reader);
- init_macroblockd(cm, &tile_data->xd);
- vp9_zero(tile_data->xd.dqcoeff);
-
- worker->had_error = 0;
- if (i == num_workers - 1 || n == tile_cols - 1) {
- vp9_worker_execute(worker);
- } else {
- vp9_worker_launch(worker);
- }
-
- if (buf->col == tile_cols - 1) {
- final_worker = i;
- }
-
- ++n;
- }
-
- for (; i > 0; --i) {
- VP9Worker *const worker = &pbi->tile_workers[i - 1];
- pbi->mb.corrupted |= !vp9_worker_sync(worker);
- }
- if (final_worker > -1) {
- TileWorkerData *const tile_data =
- (TileWorkerData*)pbi->tile_workers[final_worker].data1;
- bit_reader_end = vp9_reader_find_end(&tile_data->bit_reader);
- final_worker = -1;
- }
- }
-
- return bit_reader_end;
-}
-
-static void check_sync_code(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
- if (vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_0 ||
- vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_1 ||
- vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_2) {
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
- "Invalid frame sync code");
- }
-}
-
-static void error_handler(void *data) {
- VP9_COMMON *const cm = (VP9_COMMON *)data;
- vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, "Truncated packet");
-}
-
-#define RESERVED \
- if (vp9_rb_read_bit(rb)) \
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, \
- "Reserved bit must be unset")
-
-static size_t read_uncompressed_header(VP9D_COMP *pbi,
- struct vp9_read_bit_buffer *rb) {
- VP9_COMMON *const cm = &pbi->common;
- size_t sz;
- int i;
-
- cm->last_frame_type = cm->frame_type;
-
- if (vp9_rb_read_literal(rb, 2) != VP9_FRAME_MARKER)
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
- "Invalid frame marker");
-
- cm->version = vp9_rb_read_bit(rb);
- RESERVED;
-
- cm->show_existing_frame = vp9_rb_read_bit(rb);
- if (cm->show_existing_frame) {
- // Show an existing frame directly.
- const int frame_to_show = cm->ref_frame_map[vp9_rb_read_literal(rb, 3)];
-
- if (cm->frame_bufs[frame_to_show].ref_count < 1)
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
- "Buffer %d does not contain a decoded frame",
- frame_to_show);
-
- ref_cnt_fb(cm->frame_bufs, &cm->new_fb_idx, frame_to_show);
- pbi->refresh_frame_flags = 0;
- cm->lf.filter_level = 0;
- cm->show_frame = 1;
- return 0;
- }
-
- cm->frame_type = (FRAME_TYPE) vp9_rb_read_bit(rb);
- cm->show_frame = vp9_rb_read_bit(rb);
- cm->error_resilient_mode = vp9_rb_read_bit(rb);
-
- if (cm->frame_type == KEY_FRAME) {
- check_sync_code(cm, rb);
-
- cm->color_space = (COLOR_SPACE)vp9_rb_read_literal(rb, 3);
- if (cm->color_space != SRGB) {
- vp9_rb_read_bit(rb); // [16,235] (including xvycc) vs [0,255] range
- if (cm->version == 1) {
- cm->subsampling_x = vp9_rb_read_bit(rb);
- cm->subsampling_y = vp9_rb_read_bit(rb);
- vp9_rb_read_bit(rb); // has extra plane
- } else {
- cm->subsampling_y = cm->subsampling_x = 1;
- }
- } else {
- if (cm->version == 1) {
- cm->subsampling_y = cm->subsampling_x = 0;
- vp9_rb_read_bit(rb); // has extra plane
- } else {
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
- "RGB not supported in profile 0");
- }
- }
-
- pbi->refresh_frame_flags = (1 << REF_FRAMES) - 1;
-
- for (i = 0; i < REFS_PER_FRAME; ++i) {
- cm->frame_refs[i].idx = cm->new_fb_idx;
- cm->frame_refs[i].buf = get_frame_new_buffer(cm);
- }
-
- setup_frame_size(cm, rb);
- } else {
- cm->intra_only = cm->show_frame ? 0 : vp9_rb_read_bit(rb);
-
- cm->reset_frame_context = cm->error_resilient_mode ?
- 0 : vp9_rb_read_literal(rb, 2);
-
- if (cm->intra_only) {
- check_sync_code(cm, rb);
-
- pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES);
- setup_frame_size(cm, rb);
- } else {
- pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES);
-
- for (i = 0; i < REFS_PER_FRAME; ++i) {
- const int ref = vp9_rb_read_literal(rb, REF_FRAMES_LOG2);
- const int idx = cm->ref_frame_map[ref];
- cm->frame_refs[i].idx = idx;
- cm->frame_refs[i].buf = &cm->frame_bufs[idx].buf;
- cm->ref_frame_sign_bias[LAST_FRAME + i] = vp9_rb_read_bit(rb);
- }
-
- setup_frame_size_with_refs(cm, rb);
-
- cm->allow_high_precision_mv = vp9_rb_read_bit(rb);
- cm->interp_filter = read_interp_filter(rb);
-
- for (i = 0; i < REFS_PER_FRAME; ++i) {
- RefBuffer *const ref_buf = &cm->frame_refs[i];
- vp9_setup_scale_factors_for_frame(&ref_buf->sf,
- ref_buf->buf->y_crop_width,
- ref_buf->buf->y_crop_height,
- cm->width, cm->height);
- if (vp9_is_scaled(&ref_buf->sf))
- vp9_extend_frame_borders(ref_buf->buf);
- }
- }
- }
-
- if (!cm->error_resilient_mode) {
- cm->coding_use_prev_mi = 1;
- cm->refresh_frame_context = vp9_rb_read_bit(rb);
- cm->frame_parallel_decoding_mode = vp9_rb_read_bit(rb);
- } else {
- cm->coding_use_prev_mi = 0;
- cm->refresh_frame_context = 0;
- cm->frame_parallel_decoding_mode = 1;
- }
-
- // This flag will be overridden by the call to vp9_setup_past_independence
- // below, forcing the use of context 0 for those frame types.
- cm->frame_context_idx = vp9_rb_read_literal(rb, FRAME_CONTEXTS_LOG2);
-
- if (frame_is_intra_only(cm) || cm->error_resilient_mode)
- vp9_setup_past_independence(cm);
-
- setup_loopfilter(&cm->lf, rb);
- setup_quantization(cm, &pbi->mb, rb);
- setup_segmentation(&cm->seg, rb);
-
- setup_tile_info(cm, rb);
- sz = vp9_rb_read_literal(rb, 16);
-
- if (sz == 0)
- vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
- "Invalid header size");
-
- return sz;
-}
-
-static int read_compressed_header(VP9D_COMP *pbi, const uint8_t *data,
- size_t partition_size) {
- VP9_COMMON *const cm = &pbi->common;
- MACROBLOCKD *const xd = &pbi->mb;
- FRAME_CONTEXT *const fc = &cm->fc;
- vp9_reader r;
- int k;
-
- if (vp9_reader_init(&r, data, partition_size))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate bool decoder 0");
-
- cm->tx_mode = xd->lossless ? ONLY_4X4 : read_tx_mode(&r);
- if (cm->tx_mode == TX_MODE_SELECT)
- read_tx_mode_probs(&fc->tx_probs, &r);
- read_coef_probs(fc, cm->tx_mode, &r);
-
- for (k = 0; k < SKIP_CONTEXTS; ++k)
- vp9_diff_update_prob(&r, &fc->skip_probs[k]);
-
- if (!frame_is_intra_only(cm)) {
- nmv_context *const nmvc = &fc->nmvc;
- int i, j;
-
- read_inter_mode_probs(fc, &r);
-
- if (cm->interp_filter == SWITCHABLE)
- read_switchable_interp_probs(fc, &r);
-
- for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
- vp9_diff_update_prob(&r, &fc->intra_inter_prob[i]);
-
- cm->reference_mode = read_frame_reference_mode(cm, &r);
- if (cm->reference_mode != SINGLE_REFERENCE)
- setup_compound_reference_mode(cm);
- read_frame_reference_mode_probs(cm, &r);
-
- for (j = 0; j < BLOCK_SIZE_GROUPS; j++)
- for (i = 0; i < INTRA_MODES - 1; ++i)
- vp9_diff_update_prob(&r, &fc->y_mode_prob[j][i]);
-
- for (j = 0; j < PARTITION_CONTEXTS; ++j)
- for (i = 0; i < PARTITION_TYPES - 1; ++i)
- vp9_diff_update_prob(&r, &fc->partition_prob[j][i]);
-
- read_mv_probs(nmvc, cm->allow_high_precision_mv, &r);
- }
-
- return vp9_reader_has_error(&r);
-}
-
-void vp9_init_dequantizer(VP9_COMMON *cm) {
- int q;
-
- for (q = 0; q < QINDEX_RANGE; q++) {
- cm->y_dequant[q][0] = vp9_dc_quant(q, cm->y_dc_delta_q);
- cm->y_dequant[q][1] = vp9_ac_quant(q, 0);
-
- cm->uv_dequant[q][0] = vp9_dc_quant(q, cm->uv_dc_delta_q);
- cm->uv_dequant[q][1] = vp9_ac_quant(q, cm->uv_ac_delta_q);
- }
-}
-
-#ifdef NDEBUG
-#define debug_check_frame_counts(cm) (void)0
-#else // !NDEBUG
-// Counts should only be incremented when frame_parallel_decoding_mode and
-// error_resilient_mode are disabled.
-static void debug_check_frame_counts(const VP9_COMMON *const cm) {
- FRAME_COUNTS zero_counts;
- vp9_zero(zero_counts);
- assert(cm->frame_parallel_decoding_mode || cm->error_resilient_mode);
- assert(!memcmp(cm->counts.y_mode, zero_counts.y_mode,
- sizeof(cm->counts.y_mode)));
- assert(!memcmp(cm->counts.uv_mode, zero_counts.uv_mode,
- sizeof(cm->counts.uv_mode)));
- assert(!memcmp(cm->counts.partition, zero_counts.partition,
- sizeof(cm->counts.partition)));
- 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)));
- 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,
- sizeof(cm->counts.inter_mode)));
- assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter,
- sizeof(cm->counts.intra_inter)));
- assert(!memcmp(cm->counts.comp_inter, zero_counts.comp_inter,
- sizeof(cm->counts.comp_inter)));
- assert(!memcmp(cm->counts.single_ref, zero_counts.single_ref,
- sizeof(cm->counts.single_ref)));
- assert(!memcmp(cm->counts.comp_ref, zero_counts.comp_ref,
- sizeof(cm->counts.comp_ref)));
- assert(!memcmp(&cm->counts.tx, &zero_counts.tx, sizeof(cm->counts.tx)));
- assert(!memcmp(cm->counts.skip, zero_counts.skip, sizeof(cm->counts.skip)));
- assert(!memcmp(&cm->counts.mv, &zero_counts.mv, sizeof(cm->counts.mv)));
-}
-#endif // NDEBUG
-
-int vp9_decode_frame(VP9D_COMP *pbi,
- const uint8_t *data, const uint8_t *data_end,
- const uint8_t **p_data_end) {
- VP9_COMMON *const cm = &pbi->common;
- MACROBLOCKD *const xd = &pbi->mb;
-
- struct vp9_read_bit_buffer rb = { data, data_end, 0, cm, error_handler };
- const size_t first_partition_size = read_uncompressed_header(pbi, &rb);
- const int keyframe = cm->frame_type == KEY_FRAME;
- const int tile_rows = 1 << cm->log2_tile_rows;
- const int tile_cols = 1 << cm->log2_tile_cols;
- YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm);
- xd->cur_buf = new_fb;
-
- if (!first_partition_size) {
- // showing a frame directly
- *p_data_end = data + 1;
- return 0;
- }
-
- if (!pbi->decoded_key_frame && !keyframe)
- return -1;
-
- data += vp9_rb_bytes_read(&rb);
- if (!read_is_valid(data, first_partition_size, data_end))
- vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt header length");
-
- pbi->do_loopfilter_inline =
- (cm->log2_tile_rows | cm->log2_tile_cols) == 0 && cm->lf.filter_level;
- if (pbi->do_loopfilter_inline && pbi->lf_worker.data1 == NULL) {
- CHECK_MEM_ERROR(cm, pbi->lf_worker.data1,
- vpx_memalign(32, sizeof(LFWorkerData)));
- pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker;
- if (pbi->oxcf.max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) {
- vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
- "Loop filter thread creation failed");
- }
- }
-
- init_macroblockd(cm, &pbi->mb);
-
- if (cm->coding_use_prev_mi)
- set_prev_mi(cm);
- else
- cm->prev_mi = NULL;
-
- setup_plane_dequants(cm, xd, cm->base_qindex);
- vp9_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
-
- cm->fc = cm->frame_contexts[cm->frame_context_idx];
- vp9_zero(cm->counts);
- vp9_zero(xd->dqcoeff);
-
- xd->corrupted = 0;
- new_fb->corrupted = read_compressed_header(pbi, data, first_partition_size);
-
- // TODO(jzern): remove frame_parallel_decoding_mode restriction for
- // single-frame tile decoding.
- if (pbi->oxcf.max_threads > 1 && tile_rows == 1 && tile_cols > 1 &&
- cm->frame_parallel_decoding_mode) {
- *p_data_end = decode_tiles_mt(pbi, data + first_partition_size, data_end);
- } else {
- *p_data_end = decode_tiles(pbi, data + first_partition_size, data_end);
- }
-
- new_fb->corrupted |= xd->corrupted;
-
- if (!pbi->decoded_key_frame) {
- if (keyframe && !new_fb->corrupted)
- pbi->decoded_key_frame = 1;
- else
- vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
- "A stream must start with a complete key frame");
- }
-
- if (!cm->error_resilient_mode && !cm->frame_parallel_decoding_mode) {
- vp9_adapt_coef_probs(cm);
-
- if (!frame_is_intra_only(cm)) {
- vp9_adapt_mode_probs(cm);
- vp9_adapt_mv_probs(cm, cm->allow_high_precision_mv);
- }
- } else {
- debug_check_frame_counts(cm);
- }
-
- if (cm->refresh_frame_context)
- cm->frame_contexts[cm->frame_context_idx] = cm->fc;
-
- return 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.h
deleted file mode 100644
index e474db4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodeframe.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_DECODER_VP9_DECODEFRAME_H_
-#define VP9_DECODER_VP9_DECODEFRAME_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP9Common;
-struct VP9Decompressor;
-
-void vp9_init_dequantizer(struct VP9Common *cm);
-
-int vp9_decode_frame(struct VP9Decompressor *pbi,
- const uint8_t *data, const uint8_t *data_end,
- const uint8_t **p_data_end);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_DECODEFRAME_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.c
deleted file mode 100644
index 3618f12..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_entropymv.h"
-#include "vp9/common/vp9_mvref_common.h"
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_seg_common.h"
-
-#include "vp9/decoder/vp9_decodemv.h"
-#include "vp9/decoder/vp9_decodeframe.h"
-#include "vp9/decoder/vp9_reader.h"
-
-static MB_PREDICTION_MODE read_intra_mode(vp9_reader *r, const vp9_prob *p) {
- return (MB_PREDICTION_MODE)vp9_read_tree(r, vp9_intra_mode_tree, p);
-}
-
-static MB_PREDICTION_MODE read_intra_mode_y(VP9_COMMON *cm, vp9_reader *r,
- int size_group) {
- const MB_PREDICTION_MODE y_mode = read_intra_mode(r,
- cm->fc.y_mode_prob[size_group]);
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.y_mode[size_group][y_mode];
- return y_mode;
-}
-
-static MB_PREDICTION_MODE read_intra_mode_uv(VP9_COMMON *cm, vp9_reader *r,
- MB_PREDICTION_MODE y_mode) {
- const MB_PREDICTION_MODE uv_mode = read_intra_mode(r,
- cm->fc.uv_mode_prob[y_mode]);
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.uv_mode[y_mode][uv_mode];
- return uv_mode;
-}
-
-static MB_PREDICTION_MODE read_inter_mode(VP9_COMMON *cm, vp9_reader *r,
- int ctx) {
- const int mode = vp9_read_tree(r, vp9_inter_mode_tree,
- cm->fc.inter_mode_probs[ctx]);
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.inter_mode[ctx][mode];
-
- return NEARESTMV + mode;
-}
-
-static int read_segment_id(vp9_reader *r, const struct segmentation *seg) {
- return vp9_read_tree(r, vp9_segment_tree, seg->tree_probs);
-}
-
-static TX_SIZE read_selected_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
- TX_SIZE max_tx_size, vp9_reader *r) {
- const int ctx = vp9_get_tx_size_context(xd);
- const vp9_prob *tx_probs = get_tx_probs(max_tx_size, ctx, &cm->fc.tx_probs);
- int tx_size = vp9_read(r, tx_probs[0]);
- if (tx_size != TX_4X4 && max_tx_size >= TX_16X16) {
- tx_size += vp9_read(r, tx_probs[1]);
- if (tx_size != TX_8X8 && max_tx_size >= TX_32X32)
- tx_size += vp9_read(r, tx_probs[2]);
- }
-
- if (!cm->frame_parallel_decoding_mode)
- ++get_tx_counts(max_tx_size, ctx, &cm->counts.tx)[tx_size];
- return (TX_SIZE)tx_size;
-}
-
-static TX_SIZE read_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd, TX_MODE tx_mode,
- BLOCK_SIZE bsize, int allow_select, vp9_reader *r) {
- const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
- if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8)
- return read_selected_tx_size(cm, xd, max_tx_size, r);
- else
- return MIN(max_tx_size, tx_mode_to_biggest_tx_size[tx_mode]);
-}
-
-static void set_segment_id(VP9_COMMON *cm, BLOCK_SIZE bsize,
- int mi_row, int mi_col, int segment_id) {
- const int mi_offset = mi_row * cm->mi_cols + mi_col;
- const int bw = num_8x8_blocks_wide_lookup[bsize];
- const int bh = num_8x8_blocks_high_lookup[bsize];
- const int xmis = MIN(cm->mi_cols - mi_col, bw);
- const int ymis = MIN(cm->mi_rows - mi_row, bh);
- int x, y;
-
- assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
-
- for (y = 0; y < ymis; y++)
- for (x = 0; x < xmis; x++)
- cm->last_frame_seg_map[mi_offset + y * cm->mi_cols + x] = segment_id;
-}
-
-static int read_intra_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- int mi_row, int mi_col,
- vp9_reader *r) {
- struct segmentation *const seg = &cm->seg;
- const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
- int segment_id;
-
- if (!seg->enabled)
- return 0; // Default for disabled segmentation
-
- if (!seg->update_map)
- return 0;
-
- segment_id = read_segment_id(r, seg);
- set_segment_id(cm, bsize, mi_row, mi_col, segment_id);
- return segment_id;
-}
-
-static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- int mi_row, int mi_col, vp9_reader *r) {
- struct segmentation *const seg = &cm->seg;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- const BLOCK_SIZE bsize = mbmi->sb_type;
- int predicted_segment_id, segment_id;
-
- if (!seg->enabled)
- return 0; // Default for disabled segmentation
-
- predicted_segment_id = vp9_get_segment_id(cm, cm->last_frame_seg_map,
- bsize, mi_row, mi_col);
- if (!seg->update_map)
- return predicted_segment_id;
-
- if (seg->temporal_update) {
- const vp9_prob pred_prob = vp9_get_pred_prob_seg_id(seg, xd);
- mbmi->seg_id_predicted = vp9_read(r, pred_prob);
- segment_id = mbmi->seg_id_predicted ? predicted_segment_id
- : read_segment_id(r, seg);
- } else {
- segment_id = read_segment_id(r, seg);
- }
- set_segment_id(cm, bsize, mi_row, mi_col, segment_id);
- return segment_id;
-}
-
-static int read_skip(VP9_COMMON *cm, const MACROBLOCKD *xd,
- int segment_id, vp9_reader *r) {
- if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
- return 1;
- } else {
- const int ctx = vp9_get_skip_context(xd);
- const int skip = vp9_read(r, cm->fc.skip_probs[ctx]);
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.skip[ctx][skip];
- return skip;
- }
-}
-
-static void read_intra_frame_mode_info(VP9_COMMON *const cm,
- MACROBLOCKD *const xd,
- int mi_row, int mi_col, vp9_reader *r) {
- MODE_INFO *const mi = xd->mi[0];
- MB_MODE_INFO *const mbmi = &mi->mbmi;
- const MODE_INFO *above_mi = xd->mi[-cm->mi_stride];
- const MODE_INFO *left_mi = xd->left_available ? xd->mi[-1] : NULL;
- const BLOCK_SIZE bsize = mbmi->sb_type;
- int i;
-
- mbmi->segment_id = read_intra_segment_id(cm, xd, mi_row, mi_col, r);
- mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
- mbmi->tx_size = read_tx_size(cm, xd, cm->tx_mode, bsize, 1, r);
- mbmi->ref_frame[0] = INTRA_FRAME;
- mbmi->ref_frame[1] = NONE;
-
- switch (bsize) {
- case BLOCK_4X4:
- for (i = 0; i < 4; ++i)
- mi->bmi[i].as_mode =
- read_intra_mode(r, get_y_mode_probs(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 =
- read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 0));
- mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
- read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 1));
- break;
- case BLOCK_8X4:
- mi->bmi[0].as_mode = mi->bmi[1].as_mode =
- read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 0));
- mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
- read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 2));
- break;
- default:
- mbmi->mode = read_intra_mode(r,
- get_y_mode_probs(mi, above_mi, left_mi, 0));
- }
-
- mbmi->uv_mode = read_intra_mode(r, vp9_kf_uv_mode_prob[mbmi->mode]);
-}
-
-static int read_mv_component(vp9_reader *r,
- const nmv_component *mvcomp, int usehp) {
- int mag, d, fr, hp;
- const int sign = vp9_read(r, mvcomp->sign);
- const int mv_class = vp9_read_tree(r, vp9_mv_class_tree, mvcomp->classes);
- const int class0 = mv_class == MV_CLASS_0;
-
- // Integer part
- if (class0) {
- d = vp9_read_tree(r, vp9_mv_class0_tree, mvcomp->class0);
- } else {
- int i;
- const int n = mv_class + CLASS0_BITS - 1; // number of bits
-
- d = 0;
- for (i = 0; i < n; ++i)
- d |= vp9_read(r, mvcomp->bits[i]) << i;
- }
-
- // Fractional part
- fr = vp9_read_tree(r, vp9_mv_fp_tree, class0 ? mvcomp->class0_fp[d]
- : mvcomp->fp);
-
-
- // High precision part (if hp is not used, the default value of the hp is 1)
- hp = usehp ? vp9_read(r, class0 ? mvcomp->class0_hp : mvcomp->hp)
- : 1;
-
- // Result
- mag = vp9_get_mv_mag(mv_class, (d << 3) | (fr << 1) | hp) + 1;
- return sign ? -mag : mag;
-}
-
-static INLINE void read_mv(vp9_reader *r, MV *mv, const MV *ref,
- const nmv_context *ctx,
- nmv_context_counts *counts, int allow_hp) {
- const MV_JOINT_TYPE joint_type =
- (MV_JOINT_TYPE)vp9_read_tree(r, vp9_mv_joint_tree, ctx->joints);
- const int use_hp = allow_hp && vp9_use_mv_hp(ref);
- MV diff = {0, 0};
-
- if (mv_joint_vertical(joint_type))
- diff.row = read_mv_component(r, &ctx->comps[0], use_hp);
-
- if (mv_joint_horizontal(joint_type))
- diff.col = read_mv_component(r, &ctx->comps[1], use_hp);
-
- vp9_inc_mv(&diff, counts);
-
- mv->row = ref->row + diff.row;
- mv->col = ref->col + diff.col;
-}
-
-static REFERENCE_MODE read_block_reference_mode(VP9_COMMON *cm,
- const MACROBLOCKD *xd,
- vp9_reader *r) {
- if (cm->reference_mode == REFERENCE_MODE_SELECT) {
- const int ctx = vp9_get_reference_mode_context(cm, xd);
- const REFERENCE_MODE mode =
- (REFERENCE_MODE)vp9_read(r, cm->fc.comp_inter_prob[ctx]);
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.comp_inter[ctx][mode];
- return mode; // SINGLE_REFERENCE or COMPOUND_REFERENCE
- } else {
- return cm->reference_mode;
- }
-}
-
-// Read the referncence frame
-static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- vp9_reader *r,
- int segment_id, MV_REFERENCE_FRAME ref_frame[2]) {
- FRAME_CONTEXT *const fc = &cm->fc;
- FRAME_COUNTS *const counts = &cm->counts;
-
- if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
- ref_frame[0] = (MV_REFERENCE_FRAME)vp9_get_segdata(&cm->seg, segment_id,
- SEG_LVL_REF_FRAME);
- ref_frame[1] = NONE;
- } else {
- 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) {
- const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
- const int ctx = vp9_get_pred_context_comp_ref_p(cm, xd);
- const int bit = vp9_read(r, fc->comp_ref_prob[ctx]);
- if (!cm->frame_parallel_decoding_mode)
- ++counts->comp_ref[ctx][bit];
- ref_frame[idx] = cm->comp_fixed_ref;
- ref_frame[!idx] = cm->comp_var_ref[bit];
- } else if (mode == SINGLE_REFERENCE) {
- const int ctx0 = vp9_get_pred_context_single_ref_p1(xd);
- const int bit0 = vp9_read(r, fc->single_ref_prob[ctx0][0]);
- if (!cm->frame_parallel_decoding_mode)
- ++counts->single_ref[ctx0][0][bit0];
- if (bit0) {
- const int ctx1 = vp9_get_pred_context_single_ref_p2(xd);
- const int bit1 = vp9_read(r, fc->single_ref_prob[ctx1][1]);
- if (!cm->frame_parallel_decoding_mode)
- ++counts->single_ref[ctx1][1][bit1];
- ref_frame[0] = bit1 ? ALTREF_FRAME : GOLDEN_FRAME;
- } else {
- ref_frame[0] = LAST_FRAME;
- }
-
- ref_frame[1] = NONE;
- } else {
- assert(0 && "Invalid prediction mode.");
- }
- }
-}
-
-
-static INLINE INTERP_FILTER read_switchable_interp_filter(
- VP9_COMMON *const cm, MACROBLOCKD *const xd, vp9_reader *r) {
- const int ctx = vp9_get_pred_context_switchable_interp(xd);
- const INTERP_FILTER type =
- (INTERP_FILTER)vp9_read_tree(r, vp9_switchable_interp_tree,
- cm->fc.switchable_interp_prob[ctx]);
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.switchable_interp[ctx][type];
- return type;
-}
-
-static void read_intra_block_mode_info(VP9_COMMON *const cm, MODE_INFO *mi,
- vp9_reader *r) {
- MB_MODE_INFO *const mbmi = &mi->mbmi;
- const BLOCK_SIZE bsize = mi->mbmi.sb_type;
- int i;
-
- mbmi->ref_frame[0] = INTRA_FRAME;
- mbmi->ref_frame[1] = NONE;
-
- switch (bsize) {
- case BLOCK_4X4:
- for (i = 0; i < 4; ++i)
- mi->bmi[i].as_mode = read_intra_mode_y(cm, 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, r, 0);
- mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
- read_intra_mode_y(cm, r, 0);
- break;
- case BLOCK_8X4:
- mi->bmi[0].as_mode = mi->bmi[1].as_mode = read_intra_mode_y(cm, r, 0);
- mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
- read_intra_mode_y(cm, r, 0);
- break;
- default:
- mbmi->mode = read_intra_mode_y(cm, r, size_group_lookup[bsize]);
- }
-
- mbmi->uv_mode = read_intra_mode_uv(cm, r, mbmi->mode);
-}
-
-static INLINE int is_mv_valid(const MV *mv) {
- return mv->row > MV_LOW && mv->row < MV_UPP &&
- mv->col > MV_LOW && mv->col < MV_UPP;
-}
-
-static INLINE int assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode,
- int_mv mv[2], int_mv ref_mv[2],
- int_mv nearest_mv[2], int_mv near_mv[2],
- int is_compound, int allow_hp, vp9_reader *r) {
- int i;
- int ret = 1;
-
- switch (mode) {
- case NEWMV: {
- nmv_context_counts *const mv_counts = cm->frame_parallel_decoding_mode ?
- NULL : &cm->counts.mv;
- for (i = 0; i < 1 + is_compound; ++i) {
- read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc.nmvc, mv_counts,
- allow_hp);
- ret = ret && is_mv_valid(&mv[i].as_mv);
- }
- break;
- }
- case NEARESTMV: {
- mv[0].as_int = nearest_mv[0].as_int;
- if (is_compound)
- mv[1].as_int = nearest_mv[1].as_int;
- break;
- }
- case NEARMV: {
- mv[0].as_int = near_mv[0].as_int;
- if (is_compound)
- mv[1].as_int = near_mv[1].as_int;
- break;
- }
- case ZEROMV: {
- mv[0].as_int = 0;
- if (is_compound)
- mv[1].as_int = 0;
- break;
- }
- default: {
- return 0;
- }
- }
- return ret;
-}
-
-static int read_is_inter_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
- int segment_id, vp9_reader *r) {
- if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
- return vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) !=
- INTRA_FRAME;
- } else {
- const int ctx = vp9_get_intra_inter_context(xd);
- const int is_inter = vp9_read(r, cm->fc.intra_inter_prob[ctx]);
- if (!cm->frame_parallel_decoding_mode)
- ++cm->counts.intra_inter[ctx][is_inter];
- return is_inter;
- }
-}
-
-static void read_inter_block_mode_info(VP9_COMMON *const cm,
- MACROBLOCKD *const xd,
- const TileInfo *const tile,
- MODE_INFO *const mi,
- int mi_row, int mi_col, vp9_reader *r) {
- MB_MODE_INFO *const mbmi = &mi->mbmi;
- const BLOCK_SIZE bsize = mbmi->sb_type;
- const int allow_hp = cm->allow_high_precision_mv;
-
- int_mv nearestmv[2], nearmv[2];
- int inter_mode_ctx, ref, is_compound;
-
- read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
- is_compound = has_second_ref(mbmi);
-
- for (ref = 0; ref < 1 + is_compound; ++ref) {
- const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
- vp9_find_mv_refs(cm, xd, tile, mi, frame, mbmi->ref_mvs[frame],
- mi_row, mi_col);
- }
-
- inter_mode_ctx = mbmi->mode_context[mbmi->ref_frame[0]];
-
- if (vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
- mbmi->mode = ZEROMV;
- if (bsize < BLOCK_8X8) {
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
- "Invalid usage of segement feature on small blocks");
- return;
- }
- } else {
- if (bsize >= BLOCK_8X8)
- mbmi->mode = read_inter_mode(cm, r, inter_mode_ctx);
- }
-
- if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
- for (ref = 0; ref < 1 + is_compound; ++ref) {
- vp9_find_best_ref_mvs(xd, allow_hp, mbmi->ref_mvs[mbmi->ref_frame[ref]],
- &nearestmv[ref], &nearmv[ref]);
- }
- }
-
- mbmi->interp_filter = (cm->interp_filter == SWITCHABLE)
- ? read_switchable_interp_filter(cm, xd, r)
- : cm->interp_filter;
-
- if (bsize < BLOCK_8X8) {
- const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; // 1 or 2
- const int num_4x4_h = num_4x4_blocks_high_lookup[bsize]; // 1 or 2
- int idx, idy;
- MB_PREDICTION_MODE b_mode;
- int_mv nearest_sub8x8[2], near_sub8x8[2];
- for (idy = 0; idy < 2; idy += num_4x4_h) {
- for (idx = 0; idx < 2; idx += num_4x4_w) {
- int_mv block[2];
- const int j = idy * 2 + idx;
- b_mode = read_inter_mode(cm, r, inter_mode_ctx);
-
- if (b_mode == NEARESTMV || b_mode == NEARMV)
- for (ref = 0; ref < 1 + is_compound; ++ref)
- vp9_append_sub8x8_mvs_for_idx(cm, xd, tile, j, ref, mi_row, mi_col,
- &nearest_sub8x8[ref],
- &near_sub8x8[ref]);
-
- if (!assign_mv(cm, b_mode, block, nearestmv,
- nearest_sub8x8, near_sub8x8,
- is_compound, allow_hp, r)) {
- xd->corrupted |= 1;
- break;
- };
-
- mi->bmi[j].as_mv[0].as_int = block[0].as_int;
- if (is_compound)
- mi->bmi[j].as_mv[1].as_int = block[1].as_int;
-
- if (num_4x4_h == 2)
- mi->bmi[j + 2] = mi->bmi[j];
- if (num_4x4_w == 2)
- mi->bmi[j + 1] = mi->bmi[j];
- }
- }
-
- mi->mbmi.mode = b_mode;
-
- mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
- mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
- } else {
- xd->corrupted |= !assign_mv(cm, mbmi->mode, mbmi->mv, nearestmv,
- nearestmv, nearmv, is_compound, allow_hp, r);
- }
-}
-
-static void read_inter_frame_mode_info(VP9_COMMON *const cm,
- MACROBLOCKD *const xd,
- const TileInfo *const tile,
- int mi_row, int mi_col, vp9_reader *r) {
- MODE_INFO *const mi = xd->mi[0];
- MB_MODE_INFO *const mbmi = &mi->mbmi;
- int inter_block;
-
- mbmi->mv[0].as_int = 0;
- mbmi->mv[1].as_int = 0;
- mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
- mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
- inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
- mbmi->tx_size = read_tx_size(cm, xd, cm->tx_mode, mbmi->sb_type,
- !mbmi->skip || !inter_block, r);
-
- if (inter_block)
- read_inter_block_mode_info(cm, xd, tile, mi, mi_row, mi_col, r);
- else
- read_intra_block_mode_info(cm, mi, r);
-}
-
-void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd,
- const TileInfo *const tile,
- int mi_row, int mi_col, vp9_reader *r) {
- if (frame_is_intra_only(cm))
- read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r);
- else
- read_inter_frame_mode_info(cm, xd, tile, mi_row, mi_col, r);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.h
deleted file mode 100644
index 7394b62..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decodemv.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_DECODER_VP9_DECODEMV_H_
-#define VP9_DECODER_VP9_DECODEMV_H_
-
-#include "vp9/decoder/vp9_reader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct TileInfo;
-
-void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd,
- const struct TileInfo *const tile,
- int mi_row, int mi_col, vp9_reader *r);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_DECODEMV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.c
deleted file mode 100644
index e628f7a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-
-#include "./vpx_scale_rtcd.h"
-
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/vpx_timer.h"
-#include "vpx_scale/vpx_scale.h"
-
-#include "vp9/common/vp9_alloccommon.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#if CONFIG_VP9_POSTPROC
-#include "vp9/common/vp9_postproc.h"
-#endif
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-#include "vp9/decoder/vp9_decodeframe.h"
-#include "vp9/decoder/vp9_decoder.h"
-#include "vp9/decoder/vp9_detokenize.h"
-#include "vp9/decoder/vp9_dthread.h"
-
-#define WRITE_RECON_BUFFER 0
-#if WRITE_RECON_BUFFER == 1
-static void recon_write_yuv_frame(const char *name,
- const YV12_BUFFER_CONFIG *s,
- int w, int _h) {
- FILE *yuv_file = fopen(name, "ab");
- const uint8_t *src = s->y_buffer;
- int h = _h;
-
- do {
- fwrite(src, w, 1, yuv_file);
- src += s->y_stride;
- } while (--h);
-
- src = s->u_buffer;
- h = (_h + 1) >> 1;
- w = (w + 1) >> 1;
-
- do {
- fwrite(src, w, 1, yuv_file);
- src += s->uv_stride;
- } while (--h);
-
- src = s->v_buffer;
- h = (_h + 1) >> 1;
-
- do {
- fwrite(src, w, 1, yuv_file);
- src += s->uv_stride;
- } while (--h);
-
- fclose(yuv_file);
-}
-#endif
-#if WRITE_RECON_BUFFER == 2
-void write_dx_frame_to_file(YV12_BUFFER_CONFIG *frame, int this_frame) {
- // write the frame
- FILE *yframe;
- int i;
- char filename[255];
-
- snprintf(filename, sizeof(filename)-1, "dx\\y%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->y_height; i++)
- fwrite(frame->y_buffer + i * frame->y_stride,
- frame->y_width, 1, yframe);
-
- fclose(yframe);
- snprintf(filename, sizeof(filename)-1, "dx\\u%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->uv_height; i++)
- fwrite(frame->u_buffer + i * frame->uv_stride,
- frame->uv_width, 1, yframe);
-
- fclose(yframe);
- snprintf(filename, sizeof(filename)-1, "dx\\v%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->uv_height; i++)
- fwrite(frame->v_buffer + i * frame->uv_stride,
- frame->uv_width, 1, yframe);
-
- fclose(yframe);
-}
-#endif
-
-void vp9_initialize_dec() {
- static int init_done = 0;
-
- if (!init_done) {
- vp9_init_neighbors();
- vp9_init_quant_tables();
- init_done = 1;
- }
-}
-
-VP9D_COMP *vp9_create_decompressor(const VP9D_CONFIG *oxcf) {
- VP9D_COMP *const pbi = vpx_memalign(32, sizeof(VP9D_COMP));
- VP9_COMMON *const cm = pbi ? &pbi->common : NULL;
-
- if (!cm)
- return NULL;
-
- vp9_zero(*pbi);
-
- // Initialize the references to not point to any frame buffers.
- memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
-
- if (setjmp(cm->error.jmp)) {
- cm->error.setjmp = 0;
- vp9_remove_decompressor(pbi);
- return NULL;
- }
-
- cm->error.setjmp = 1;
- vp9_initialize_dec();
-
- vp9_rtcd();
-
- pbi->oxcf = *oxcf;
- pbi->ready_for_new_data = 1;
- cm->current_video_frame = 0;
-
- // vp9_init_dequantizer() is first called here. Add check in
- // frame_init_dequantizer() to avoid unnecessary calling of
- // vp9_init_dequantizer() for every frame.
- vp9_init_dequantizer(cm);
-
- vp9_loop_filter_init(cm);
-
- cm->error.setjmp = 0;
- pbi->decoded_key_frame = 0;
-
- vp9_worker_init(&pbi->lf_worker);
-
- return pbi;
-}
-
-void vp9_remove_decompressor(VP9D_COMP *pbi) {
- VP9_COMMON *const cm = &pbi->common;
- int i;
-
- vp9_remove_common(cm);
- vp9_worker_end(&pbi->lf_worker);
- vpx_free(pbi->lf_worker.data1);
- for (i = 0; i < pbi->num_tile_workers; ++i) {
- VP9Worker *const worker = &pbi->tile_workers[i];
- vp9_worker_end(worker);
- vpx_free(worker->data1);
- vpx_free(worker->data2);
- }
- vpx_free(pbi->tile_workers);
-
- if (pbi->num_tile_workers) {
- const int sb_rows =
- mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
- vp9_loop_filter_dealloc(&pbi->lf_row_sync, sb_rows);
- }
-
- vpx_free(pbi);
-}
-
-static int equal_dimensions(const YV12_BUFFER_CONFIG *a,
- const YV12_BUFFER_CONFIG *b) {
- return a->y_height == b->y_height && a->y_width == b->y_width &&
- a->uv_height == b->uv_height && a->uv_width == b->uv_width;
-}
-
-vpx_codec_err_t vp9_copy_reference_dec(VP9D_COMP *pbi,
- VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd) {
- VP9_COMMON *cm = &pbi->common;
-
- /* TODO(jkoleszar): The decoder doesn't have any real knowledge of what the
- * encoder is using the frame buffers for. This is just a stub to keep the
- * vpxenc --test-decode functionality working, and will be replaced in a
- * later commit that adds VP9-specific controls for this functionality.
- */
- if (ref_frame_flag == VP9_LAST_FLAG) {
- const YV12_BUFFER_CONFIG *const cfg =
- &cm->frame_bufs[cm->ref_frame_map[0]].buf;
- if (!equal_dimensions(cfg, sd))
- vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
- "Incorrect buffer dimensions");
- else
- vp8_yv12_copy_frame(cfg, sd);
- } else {
- vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
- "Invalid reference frame");
- }
-
- return cm->error.error_code;
-}
-
-
-vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
- VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd) {
- RefBuffer *ref_buf = NULL;
-
- // TODO(jkoleszar): The decoder doesn't have any real knowledge of what the
- // encoder is using the frame buffers for. This is just a stub to keep the
- // vpxenc --test-decode functionality working, and will be replaced in a
- // later commit that adds VP9-specific controls for this functionality.
- if (ref_frame_flag == VP9_LAST_FLAG) {
- ref_buf = &cm->frame_refs[0];
- } else if (ref_frame_flag == VP9_GOLD_FLAG) {
- ref_buf = &cm->frame_refs[1];
- } else if (ref_frame_flag == VP9_ALT_FLAG) {
- ref_buf = &cm->frame_refs[2];
- } else {
- vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
- "Invalid reference frame");
- return cm->error.error_code;
- }
-
- if (!equal_dimensions(ref_buf->buf, sd)) {
- vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
- "Incorrect buffer dimensions");
- } else {
- int *ref_fb_ptr = &ref_buf->idx;
-
- // Find an empty frame buffer.
- const int free_fb = get_free_fb(cm);
- // Decrease ref_count since it will be increased again in
- // ref_cnt_fb() below.
- cm->frame_bufs[free_fb].ref_count--;
-
- // Manage the reference counters and copy image.
- ref_cnt_fb(cm->frame_bufs, ref_fb_ptr, free_fb);
- ref_buf->buf = &cm->frame_bufs[*ref_fb_ptr].buf;
- vp8_yv12_copy_frame(sd, ref_buf->buf);
- }
-
- return cm->error.error_code;
-}
-
-
-int vp9_get_reference_dec(VP9D_COMP *pbi, int index, YV12_BUFFER_CONFIG **fb) {
- VP9_COMMON *cm = &pbi->common;
-
- if (index < 0 || index >= REF_FRAMES)
- return -1;
-
- *fb = &cm->frame_bufs[cm->ref_frame_map[index]].buf;
- return 0;
-}
-
-/* If any buffer updating is signaled it should be done here. */
-static void swap_frame_buffers(VP9D_COMP *pbi) {
- int ref_index = 0, mask;
- VP9_COMMON *const cm = &pbi->common;
-
- for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) {
- if (mask & 1) {
- const int old_idx = cm->ref_frame_map[ref_index];
- ref_cnt_fb(cm->frame_bufs, &cm->ref_frame_map[ref_index],
- cm->new_fb_idx);
- if (old_idx >= 0 && cm->frame_bufs[old_idx].ref_count == 0)
- cm->release_fb_cb(cm->cb_priv,
- &cm->frame_bufs[old_idx].raw_frame_buffer);
- }
- ++ref_index;
- }
-
- cm->frame_to_show = get_frame_new_buffer(cm);
- cm->frame_bufs[cm->new_fb_idx].ref_count--;
-
- // Invalidate these references until the next frame starts.
- for (ref_index = 0; ref_index < 3; ref_index++)
- cm->frame_refs[ref_index].idx = INT_MAX;
-}
-
-int vp9_receive_compressed_data(VP9D_COMP *pbi,
- size_t size, const uint8_t **psource,
- int64_t time_stamp) {
- VP9_COMMON *const cm = &pbi->common;
- const uint8_t *source = *psource;
- int retcode = 0;
-
- cm->error.error_code = VPX_CODEC_OK;
-
- if (size == 0) {
- // This is used to signal that we are missing frames.
- // We do not know if the missing frame(s) was supposed to update
- // any of the reference buffers, but we act conservative and
- // mark only the last buffer as corrupted.
- //
- // TODO(jkoleszar): Error concealment is undefined and non-normative
- // at this point, but if it becomes so, [0] may not always be the correct
- // thing to do here.
- if (cm->frame_refs[0].idx != INT_MAX)
- cm->frame_refs[0].buf->corrupted = 1;
- }
-
- // Check if the previous frame was a frame without any references to it.
- if (cm->new_fb_idx >= 0 && cm->frame_bufs[cm->new_fb_idx].ref_count == 0)
- cm->release_fb_cb(cm->cb_priv,
- &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer);
- cm->new_fb_idx = get_free_fb(cm);
-
- if (setjmp(cm->error.jmp)) {
- cm->error.setjmp = 0;
-
- // We do not know if the missing frame(s) was supposed to update
- // any of the reference buffers, but we act conservative and
- // mark only the last buffer as corrupted.
- //
- // TODO(jkoleszar): Error concealment is undefined and non-normative
- // at this point, but if it becomes so, [0] may not always be the correct
- // thing to do here.
- if (cm->frame_refs[0].idx != INT_MAX)
- cm->frame_refs[0].buf->corrupted = 1;
-
- if (cm->frame_bufs[cm->new_fb_idx].ref_count > 0)
- cm->frame_bufs[cm->new_fb_idx].ref_count--;
-
- return -1;
- }
-
- cm->error.setjmp = 1;
-
- retcode = vp9_decode_frame(pbi, source, source + size, psource);
-
- if (retcode < 0) {
- cm->error.error_code = VPX_CODEC_ERROR;
- cm->error.setjmp = 0;
- if (cm->frame_bufs[cm->new_fb_idx].ref_count > 0)
- cm->frame_bufs[cm->new_fb_idx].ref_count--;
- return retcode;
- }
-
- swap_frame_buffers(pbi);
-
-#if WRITE_RECON_BUFFER == 2
- if (cm->show_frame)
- write_dx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame);
- else
- write_dx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame + 1000);
-#endif
-
- if (!pbi->do_loopfilter_inline) {
- // If multiple threads are used to decode tiles, then we use those threads
- // to do parallel loopfiltering.
- if (pbi->num_tile_workers) {
- vp9_loop_filter_frame_mt(pbi, cm, &pbi->mb, cm->lf.filter_level, 0, 0);
- } else {
- vp9_loop_filter_frame(cm, &pbi->mb, cm->lf.filter_level, 0, 0);
- }
- }
-
-#if WRITE_RECON_BUFFER == 2
- if (cm->show_frame)
- write_dx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame + 2000);
- else
- write_dx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame + 3000);
-#endif
-
-#if WRITE_RECON_BUFFER == 1
- if (cm->show_frame)
- recon_write_yuv_frame("recon.yuv", cm->frame_to_show,
- cm->width, cm->height);
-#endif
-
- vp9_clear_system_state();
-
- cm->last_width = cm->width;
- cm->last_height = cm->height;
-
- if (!cm->show_existing_frame)
- cm->last_show_frame = cm->show_frame;
- if (cm->show_frame) {
- if (!cm->show_existing_frame)
- vp9_swap_mi_and_prev_mi(cm);
-
- cm->current_video_frame++;
- }
-
- pbi->ready_for_new_data = 0;
- pbi->last_time_stamp = time_stamp;
-
- cm->error.setjmp = 0;
- return retcode;
-}
-
-int vp9_get_raw_frame(VP9D_COMP *pbi, YV12_BUFFER_CONFIG *sd,
- int64_t *time_stamp, int64_t *time_end_stamp,
- vp9_ppflags_t *flags) {
- int ret = -1;
- (void)flags;
-
- if (pbi->ready_for_new_data == 1)
- return ret;
-
- /* ie no raw frame to show!!! */
- if (pbi->common.show_frame == 0)
- return ret;
-
- pbi->ready_for_new_data = 1;
- *time_stamp = pbi->last_time_stamp;
- *time_end_stamp = 0;
-
-#if CONFIG_VP9_POSTPROC
- ret = vp9_post_proc_frame(&pbi->common, sd, flags);
-#else
-
- if (pbi->common.frame_to_show) {
- *sd = *pbi->common.frame_to_show;
- sd->y_width = pbi->common.width;
- sd->y_height = pbi->common.height;
- sd->uv_width = sd->y_width >> pbi->common.subsampling_x;
- sd->uv_height = sd->y_height >> pbi->common.subsampling_y;
-
- ret = 0;
- } else {
- ret = -1;
- }
-
-#endif /*!CONFIG_POSTPROC*/
- vp9_clear_system_state();
- return ret;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.h
deleted file mode 100644
index f220ccd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_decoder.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_DECODER_VP9_DECODER_H_
-#define VP9_DECODER_VP9_DECODER_H_
-
-#include "./vpx_config.h"
-
-#include "vpx/vpx_codec.h"
-#include "vpx_scale/yv12config.h"
-
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_ppflags.h"
-
-#include "vp9/decoder/vp9_decoder.h"
-#include "vp9/decoder/vp9_dthread.h"
-#include "vp9/decoder/vp9_thread.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- int width;
- int height;
- int version;
- int max_threads;
- int inv_tile_order;
-} VP9D_CONFIG;
-
-typedef struct VP9Decompressor {
- DECLARE_ALIGNED(16, MACROBLOCKD, mb);
-
- DECLARE_ALIGNED(16, VP9_COMMON, common);
-
- VP9D_CONFIG oxcf;
-
- int64_t last_time_stamp;
- int ready_for_new_data;
-
- int refresh_frame_flags;
-
- int decoded_key_frame;
-
- int initial_width;
- int initial_height;
-
- int do_loopfilter_inline; // apply loopfilter to available rows immediately
- VP9Worker lf_worker;
-
- VP9Worker *tile_workers;
- int num_tile_workers;
-
- VP9LfSync lf_row_sync;
-} VP9D_COMP;
-
-void vp9_initialize_dec();
-
-int vp9_receive_compressed_data(struct VP9Decompressor *pbi,
- size_t size, const uint8_t **dest,
- int64_t time_stamp);
-
-int vp9_get_raw_frame(struct VP9Decompressor *pbi,
- YV12_BUFFER_CONFIG *sd,
- int64_t *time_stamp, int64_t *time_end_stamp,
- vp9_ppflags_t *flags);
-
-vpx_codec_err_t vp9_copy_reference_dec(struct VP9Decompressor *pbi,
- VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd);
-
-vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
- VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd);
-
-int vp9_get_reference_dec(struct VP9Decompressor *pbi,
- int index, YV12_BUFFER_CONFIG **fb);
-
-
-struct VP9Decompressor *vp9_create_decompressor(const VP9D_CONFIG *oxcf);
-
-void vp9_remove_decompressor(struct VP9Decompressor *pbi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_DECODER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.c
deleted file mode 100644
index 860da53..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/mem.h"
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_common.h"
-
-#include "vp9/decoder/vp9_detokenize.h"
-
-#define EOB_CONTEXT_NODE 0
-#define ZERO_CONTEXT_NODE 1
-#define ONE_CONTEXT_NODE 2
-#define LOW_VAL_CONTEXT_NODE 0
-#define TWO_CONTEXT_NODE 1
-#define THREE_CONTEXT_NODE 2
-#define HIGH_LOW_CONTEXT_NODE 3
-#define CAT_ONE_CONTEXT_NODE 4
-#define CAT_THREEFOUR_CONTEXT_NODE 5
-#define CAT_THREE_CONTEXT_NODE 6
-#define CAT_FIVE_CONTEXT_NODE 7
-
-#define CAT1_MIN_VAL 5
-#define CAT2_MIN_VAL 7
-#define CAT3_MIN_VAL 11
-#define CAT4_MIN_VAL 19
-#define CAT5_MIN_VAL 35
-#define CAT6_MIN_VAL 67
-#define CAT1_PROB0 159
-#define CAT2_PROB0 145
-#define CAT2_PROB1 165
-
-#define CAT3_PROB0 140
-#define CAT3_PROB1 148
-#define CAT3_PROB2 173
-
-#define CAT4_PROB0 135
-#define CAT4_PROB1 140
-#define CAT4_PROB2 155
-#define CAT4_PROB3 176
-
-#define CAT5_PROB0 130
-#define CAT5_PROB1 134
-#define CAT5_PROB2 141
-#define CAT5_PROB3 157
-#define CAT5_PROB4 180
-
-static const vp9_prob cat6_prob[15] = {
- 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0
-};
-
-#define INCREMENT_COUNT(token) \
- do { \
- if (!cm->frame_parallel_decoding_mode) \
- ++coef_counts[band][ctx][token]; \
- } while (0)
-
-#define WRITE_COEF_CONTINUE(val, token) \
- { \
- v = (val * dqv) >> dq_shift; \
- dqcoeff[scan[c]] = vp9_read_bit(r) ? -v : v; \
- token_cache[scan[c]] = vp9_pt_energy_class[token]; \
- ++c; \
- ctx = get_coef_context(nb, token_cache, c); \
- dqv = dq[1]; \
- continue; \
- }
-
-#define ADJUST_COEF(prob, bits_count) \
- do { \
- val += (vp9_read(r, prob) << bits_count); \
- } while (0)
-
-static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, PLANE_TYPE type,
- int16_t *dqcoeff, TX_SIZE tx_size, const int16_t *dq,
- int ctx, const int16_t *scan, const int16_t *nb,
- vp9_reader *r) {
- const int max_eob = 16 << (tx_size << 1);
- const FRAME_CONTEXT *const fc = &cm->fc;
- FRAME_COUNTS *const counts = &cm->counts;
- const int ref = is_inter_block(&xd->mi[0]->mbmi);
- int band, c = 0;
- const vp9_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
- fc->coef_probs[tx_size][type][ref];
- const vp9_prob *prob;
- unsigned int (*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] =
- counts->coef[tx_size][type][ref];
- unsigned int (*eob_branch_count)[COEFF_CONTEXTS] =
- counts->eob_branch[tx_size][type][ref];
- uint8_t token_cache[32 * 32];
- const uint8_t *cat6;
- const uint8_t *band_translate = get_band_translate(tx_size);
- const int dq_shift = (tx_size == TX_32X32);
- int v;
- int16_t dqv = dq[0];
-
- while (c < max_eob) {
- int val;
- band = *band_translate++;
- prob = coef_probs[band][ctx];
- if (!cm->frame_parallel_decoding_mode)
- ++eob_branch_count[band][ctx];
- if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
- INCREMENT_COUNT(EOB_MODEL_TOKEN);
- break;
- }
-
- while (!vp9_read(r, prob[ZERO_CONTEXT_NODE])) {
- 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];
- }
-
- // ONE_CONTEXT_NODE_0_
- if (!vp9_read(r, prob[ONE_CONTEXT_NODE])) {
- INCREMENT_COUNT(ONE_TOKEN);
- WRITE_COEF_CONTINUE(1, ONE_TOKEN);
- }
-
- INCREMENT_COUNT(TWO_TOKEN);
-
- prob = vp9_pareto8_full[prob[PIVOT_NODE] - 1];
-
- if (!vp9_read(r, prob[LOW_VAL_CONTEXT_NODE])) {
- if (!vp9_read(r, prob[TWO_CONTEXT_NODE])) {
- WRITE_COEF_CONTINUE(2, TWO_TOKEN);
- }
- if (!vp9_read(r, prob[THREE_CONTEXT_NODE])) {
- WRITE_COEF_CONTINUE(3, THREE_TOKEN);
- }
- WRITE_COEF_CONTINUE(4, FOUR_TOKEN);
- }
-
- if (!vp9_read(r, prob[HIGH_LOW_CONTEXT_NODE])) {
- if (!vp9_read(r, prob[CAT_ONE_CONTEXT_NODE])) {
- val = CAT1_MIN_VAL;
- ADJUST_COEF(CAT1_PROB0, 0);
- WRITE_COEF_CONTINUE(val, CATEGORY1_TOKEN);
- }
- val = CAT2_MIN_VAL;
- ADJUST_COEF(CAT2_PROB1, 1);
- ADJUST_COEF(CAT2_PROB0, 0);
- WRITE_COEF_CONTINUE(val, CATEGORY2_TOKEN);
- }
-
- if (!vp9_read(r, prob[CAT_THREEFOUR_CONTEXT_NODE])) {
- if (!vp9_read(r, prob[CAT_THREE_CONTEXT_NODE])) {
- val = CAT3_MIN_VAL;
- ADJUST_COEF(CAT3_PROB2, 2);
- ADJUST_COEF(CAT3_PROB1, 1);
- ADJUST_COEF(CAT3_PROB0, 0);
- WRITE_COEF_CONTINUE(val, CATEGORY3_TOKEN);
- }
- val = CAT4_MIN_VAL;
- ADJUST_COEF(CAT4_PROB3, 3);
- ADJUST_COEF(CAT4_PROB2, 2);
- ADJUST_COEF(CAT4_PROB1, 1);
- ADJUST_COEF(CAT4_PROB0, 0);
- WRITE_COEF_CONTINUE(val, CATEGORY4_TOKEN);
- }
-
- if (!vp9_read(r, prob[CAT_FIVE_CONTEXT_NODE])) {
- val = CAT5_MIN_VAL;
- ADJUST_COEF(CAT5_PROB4, 4);
- ADJUST_COEF(CAT5_PROB3, 3);
- ADJUST_COEF(CAT5_PROB2, 2);
- ADJUST_COEF(CAT5_PROB1, 1);
- ADJUST_COEF(CAT5_PROB0, 0);
- WRITE_COEF_CONTINUE(val, CATEGORY5_TOKEN);
- }
- val = 0;
- cat6 = cat6_prob;
- while (*cat6)
- val = (val << 1) | vp9_read(r, *cat6++);
- val += CAT6_MIN_VAL;
-
- WRITE_COEF_CONTINUE(val, CATEGORY6_TOKEN);
- }
-
- return c;
-}
-
-int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
- int plane, int block, BLOCK_SIZE plane_bsize,
- int x, int y, TX_SIZE tx_size, vp9_reader *r) {
- struct macroblockd_plane *const pd = &xd->plane[plane];
- const int ctx = get_entropy_context(tx_size, pd->above_context + x,
- pd->left_context + y);
- const scan_order *so = get_scan(xd, tx_size, pd->plane_type, block);
- const int eob = decode_coefs(cm, xd, pd->plane_type,
- BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
- pd->dequant, ctx, so->scan, so->neighbors, r);
- vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
- return eob;
-}
-
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.h
deleted file mode 100644
index 5278e97..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_detokenize.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_DECODER_VP9_DETOKENIZE_H_
-#define VP9_DECODER_VP9_DETOKENIZE_H_
-
-#include "vp9/decoder/vp9_decoder.h"
-#include "vp9/decoder/vp9_reader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
- int plane, int block, BLOCK_SIZE plane_bsize,
- int x, int y, TX_SIZE tx_size, vp9_reader *r);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_DETOKENIZE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.c
deleted file mode 100644
index e67b372..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_entropy.h"
-
-#include "vp9/decoder/vp9_dsubexp.h"
-
-static int inv_recenter_nonneg(int v, int m) {
- if (v > 2 * m)
- return v;
-
- return v % 2 ? m - (v + 1) / 2 : m + v / 2;
-}
-
-static int decode_uniform(vp9_reader *r) {
- const int l = 8;
- const int m = (1 << l) - 191;
- const int v = vp9_read_literal(r, l - 1);
- return v < m ? v : (v << 1) - m + vp9_read_bit(r);
-}
-
-
-static int merge_index(int v, int n, int modulus) {
- int max1 = (n - 1 - modulus / 2) / modulus + 1;
- if (v < max1) {
- v = v * modulus + modulus / 2;
- } else {
- int w;
- v -= max1;
- w = v;
- v += (v + modulus - modulus / 2) / modulus;
- while (v % modulus == modulus / 2 ||
- w != v - (v + modulus - modulus / 2) / modulus) v++;
- }
- return v;
-}
-
-static int inv_remap_prob(int v, int m) {
- static int inv_map_table[MAX_PROB - 1] = {
- 6, 19, 32, 45, 58, 71, 84, 97, 110, 123, 136, 149, 162, 175, 188,
- 201, 214, 227, 240, 253, 0, 1, 2, 3, 4, 5, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75,
- 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91,
- 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
- 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 124,
- 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 137, 138, 139, 140,
- 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156,
- 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
- 173, 174, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189,
- 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 202, 203, 204, 205,
- 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, 221,
- 222, 223, 224, 225, 226, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
- 238, 239, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252
- };
- // The clamp is not necessary for conforming VP9 stream, it is added to
- // prevent out of bound access for bad input data
- v = clamp(v, 0, 253);
- v = inv_map_table[v];
- m--;
- if ((m << 1) <= MAX_PROB) {
- return 1 + inv_recenter_nonneg(v + 1, m);
- } else {
- return MAX_PROB - inv_recenter_nonneg(v + 1, MAX_PROB - 1 - m);
- }
-}
-
-static int decode_term_subexp(vp9_reader *r) {
- if (!vp9_read_bit(r))
- return vp9_read_literal(r, 4);
- if (!vp9_read_bit(r))
- return vp9_read_literal(r, 4) + 16;
- if (!vp9_read_bit(r))
- return vp9_read_literal(r, 5) + 32;
- return decode_uniform(r) + 64;
-}
-
-void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p) {
- if (vp9_read(r, DIFF_UPDATE_PROB)) {
- const int delp = decode_term_subexp(r);
- *p = (vp9_prob)inv_remap_prob(delp, *p);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.h
deleted file mode 100644
index 436f434..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dsubexp.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_DECODER_VP9_DSUBEXP_H_
-#define VP9_DECODER_VP9_DSUBEXP_H_
-
-#include "vp9/decoder/vp9_reader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_DSUBEXP_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.c
deleted file mode 100644
index 75c9da5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_reconinter.h"
-
-#include "vp9/decoder/vp9_dthread.h"
-#include "vp9/decoder/vp9_decoder.h"
-
-#if CONFIG_MULTITHREAD
-static INLINE void mutex_lock(pthread_mutex_t *const mutex) {
- const int kMaxTryLocks = 4000;
- int locked = 0;
- int i;
-
- for (i = 0; i < kMaxTryLocks; ++i) {
- if (!pthread_mutex_trylock(mutex)) {
- locked = 1;
- break;
- }
- }
-
- if (!locked)
- pthread_mutex_lock(mutex);
-}
-#endif // CONFIG_MULTITHREAD
-
-static INLINE void sync_read(VP9LfSync *const lf_sync, int r, int c) {
-#if CONFIG_MULTITHREAD
- const int nsync = lf_sync->sync_range;
-
- if (r && !(c & (nsync - 1))) {
- mutex_lock(&lf_sync->mutex_[r - 1]);
-
- while (c > lf_sync->cur_sb_col[r - 1] - nsync) {
- pthread_cond_wait(&lf_sync->cond_[r - 1],
- &lf_sync->mutex_[r - 1]);
- }
- pthread_mutex_unlock(&lf_sync->mutex_[r - 1]);
- }
-#else
- (void)lf_sync;
- (void)r;
- (void)c;
-#endif // CONFIG_MULTITHREAD
-}
-
-static INLINE void sync_write(VP9LfSync *const lf_sync, int r, int c,
- const int sb_cols) {
-#if CONFIG_MULTITHREAD
- const int nsync = lf_sync->sync_range;
- int cur;
- // Only signal when there are enough filtered SB for next row to run.
- int sig = 1;
-
- if (c < sb_cols - 1) {
- cur = c;
- if (c % nsync)
- sig = 0;
- } else {
- cur = sb_cols + nsync;
- }
-
- if (sig) {
- mutex_lock(&lf_sync->mutex_[r]);
-
- lf_sync->cur_sb_col[r] = cur;
-
- pthread_cond_signal(&lf_sync->cond_[r]);
- pthread_mutex_unlock(&lf_sync->mutex_[r]);
- }
-#else
- (void)lf_sync;
- (void)r;
- (void)c;
- (void)sb_cols;
-#endif // CONFIG_MULTITHREAD
-}
-
-// Implement row loopfiltering for each thread.
-static void loop_filter_rows_mt(const YV12_BUFFER_CONFIG *const frame_buffer,
- VP9_COMMON *const cm, MACROBLOCKD *const xd,
- int start, int stop, int y_only,
- VP9LfSync *const lf_sync, int num_lf_workers) {
- const int num_planes = y_only ? 1 : MAX_MB_PLANE;
- int r, c; // SB row and col
- LOOP_FILTER_MASK lfm;
- const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
-
- for (r = start; r < stop; r += num_lf_workers) {
- const int mi_row = r << MI_BLOCK_SIZE_LOG2;
- MODE_INFO **mi_8x8 = cm->mi_grid_visible + mi_row * cm->mi_stride;
-
- for (c = 0; c < sb_cols; ++c) {
- const int mi_col = c << MI_BLOCK_SIZE_LOG2;
- int plane;
-
- sync_read(lf_sync, r, c);
-
- vp9_setup_dst_planes(xd, frame_buffer, mi_row, mi_col);
- vp9_setup_mask(cm, mi_row, mi_col, mi_8x8 + mi_col, cm->mi_stride, &lfm);
-
- for (plane = 0; plane < num_planes; ++plane) {
- vp9_filter_block_plane(cm, &xd->plane[plane], mi_row, &lfm);
- }
-
- sync_write(lf_sync, r, c, sb_cols);
- }
- }
-}
-
-// Row-based multi-threaded loopfilter hook
-static int loop_filter_row_worker(void *arg1, void *arg2) {
- (void)arg2;
- TileWorkerData *const tile_data = (TileWorkerData*)arg1;
- LFWorkerData *const lf_data = &tile_data->lfdata;
-
- loop_filter_rows_mt(lf_data->frame_buffer, lf_data->cm, &lf_data->xd,
- lf_data->start, lf_data->stop, lf_data->y_only,
- lf_data->lf_sync, lf_data->num_lf_workers);
- return 1;
-}
-
-// VP9 decoder: Implement multi-threaded loopfilter that uses the tile
-// threads.
-void vp9_loop_filter_frame_mt(VP9D_COMP *pbi,
- VP9_COMMON *cm,
- MACROBLOCKD *xd,
- int frame_filter_level,
- int y_only, int partial_frame) {
- // Number of superblock rows and cols
- const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
- int i;
- (void)xd;
- (void)partial_frame;
-
- // Allocate memory used in thread synchronization.
- // This always needs to be done even if frame_filter_level is 0.
- if (!cm->current_video_frame || cm->last_height != cm->height) {
- VP9LfSync *const lf_sync = &pbi->lf_row_sync;
-
- if (cm->last_height != cm->height) {
- const int aligned_last_height =
- ALIGN_POWER_OF_TWO(cm->last_height, MI_SIZE_LOG2);
- const int last_sb_rows =
- mi_cols_aligned_to_sb(aligned_last_height >> MI_SIZE_LOG2) >>
- MI_BLOCK_SIZE_LOG2;
-
- vp9_loop_filter_dealloc(lf_sync, last_sb_rows);
- }
-
- vp9_loop_filter_alloc(cm, lf_sync, sb_rows, cm->width);
- }
-
- if (!frame_filter_level) return;
-
- vp9_loop_filter_frame_init(cm, frame_filter_level);
-
- // Initialize cur_sb_col to -1 for all SB rows.
- vpx_memset(pbi->lf_row_sync.cur_sb_col, -1,
- sizeof(*pbi->lf_row_sync.cur_sb_col) * sb_rows);
-
- // Set up loopfilter thread data.
- for (i = 0; i < pbi->num_tile_workers; ++i) {
- VP9Worker *const worker = &pbi->tile_workers[i];
- TileWorkerData *const tile_data = (TileWorkerData*)worker->data1;
- LFWorkerData *const lf_data = &tile_data->lfdata;
-
- worker->hook = (VP9WorkerHook)loop_filter_row_worker;
-
- // Loopfilter data
- lf_data->frame_buffer = get_frame_new_buffer(cm);
- lf_data->cm = cm;
- lf_data->xd = pbi->mb;
- lf_data->start = i;
- lf_data->stop = sb_rows;
- lf_data->y_only = y_only; // always do all planes in decoder
-
- lf_data->lf_sync = &pbi->lf_row_sync;
- lf_data->num_lf_workers = pbi->num_tile_workers;
-
- // Start loopfiltering
- if (i == pbi->num_tile_workers - 1) {
- vp9_worker_execute(worker);
- } else {
- vp9_worker_launch(worker);
- }
- }
-
- // Wait till all rows are finished
- for (i = 0; i < pbi->num_tile_workers; ++i) {
- vp9_worker_sync(&pbi->tile_workers[i]);
- }
-}
-
-// Set up nsync by width.
-static int get_sync_range(int width) {
- // nsync numbers are picked by testing. For example, for 4k
- // video, using 4 gives best performance.
- if (width < 640)
- return 1;
- else if (width <= 1280)
- return 2;
- else if (width <= 4096)
- return 4;
- else
- return 8;
-}
-
-// Allocate memory for lf row synchronization
-void vp9_loop_filter_alloc(VP9_COMMON *cm, VP9LfSync *lf_sync, int rows,
- int width) {
-#if CONFIG_MULTITHREAD
- int i;
-
- CHECK_MEM_ERROR(cm, lf_sync->mutex_,
- vpx_malloc(sizeof(*lf_sync->mutex_) * rows));
- for (i = 0; i < rows; ++i) {
- pthread_mutex_init(&lf_sync->mutex_[i], NULL);
- }
-
- CHECK_MEM_ERROR(cm, lf_sync->cond_,
- vpx_malloc(sizeof(*lf_sync->cond_) * rows));
- for (i = 0; i < rows; ++i) {
- pthread_cond_init(&lf_sync->cond_[i], NULL);
- }
-#endif // CONFIG_MULTITHREAD
-
- CHECK_MEM_ERROR(cm, lf_sync->cur_sb_col,
- vpx_malloc(sizeof(*lf_sync->cur_sb_col) * rows));
-
- // Set up nsync.
- lf_sync->sync_range = get_sync_range(width);
-}
-
-// Deallocate lf synchronization related mutex and data
-void vp9_loop_filter_dealloc(VP9LfSync *lf_sync, int rows) {
-#if CONFIG_MULTITHREAD
- if (lf_sync != NULL) {
- int i;
-
- if (lf_sync->mutex_ != NULL) {
- for (i = 0; i < rows; ++i) {
- pthread_mutex_destroy(&lf_sync->mutex_[i]);
- }
- vpx_free(lf_sync->mutex_);
- }
- if (lf_sync->cond_ != NULL) {
- for (i = 0; i < rows; ++i) {
- pthread_cond_destroy(&lf_sync->cond_[i]);
- }
- vpx_free(lf_sync->cond_);
- }
-
- vpx_free(lf_sync->cur_sb_col);
- // clear the structure as the source of this call may be a resize in which
- // case this call will be followed by an _alloc() which may fail.
- vpx_memset(lf_sync, 0, sizeof(*lf_sync));
- }
-#else
- (void)rows;
- if (lf_sync != NULL) {
- vpx_free(lf_sync->cur_sb_col);
- vpx_memset(lf_sync, 0, sizeof(*lf_sync));
- }
-#endif // CONFIG_MULTITHREAD
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.h
deleted file mode 100644
index 2f65e1e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_dthread.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_DECODER_VP9_DTHREAD_H_
-#define VP9_DECODER_VP9_DTHREAD_H_
-
-#include "./vpx_config.h"
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/decoder/vp9_reader.h"
-#include "vp9/decoder/vp9_thread.h"
-
-struct macroblockd;
-struct VP9Common;
-struct VP9Decompressor;
-
-typedef struct TileWorkerData {
- struct VP9Common *cm;
- vp9_reader bit_reader;
- DECLARE_ALIGNED(16, struct macroblockd, xd);
-
- // Row-based parallel loopfilter data
- LFWorkerData lfdata;
-} TileWorkerData;
-
-// Loopfilter row synchronization
-typedef struct VP9LfSyncData {
-#if CONFIG_MULTITHREAD
- pthread_mutex_t *mutex_;
- pthread_cond_t *cond_;
-#endif
- // Allocate memory to store the loop-filtered superblock index in each row.
- int *cur_sb_col;
- // The optimal sync_range for different resolution and platform should be
- // determined by testing. Currently, it is chosen to be a power-of-2 number.
- int sync_range;
-} VP9LfSync;
-
-// Allocate memory for loopfilter row synchronization.
-void vp9_loop_filter_alloc(struct VP9Common *cm, struct VP9LfSyncData *lf_sync,
- int rows, int width);
-
-// Deallocate loopfilter synchronization related mutex and data.
-void vp9_loop_filter_dealloc(struct VP9LfSyncData *lf_sync, int rows);
-
-// Multi-threaded loopfilter that uses the tile threads.
-void vp9_loop_filter_frame_mt(struct VP9Decompressor *pbi,
- struct VP9Common *cm,
- struct macroblockd *xd,
- int frame_filter_level,
- int y_only, int partial_frame);
-
-#endif // VP9_DECODER_VP9_DTHREAD_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.c
deleted file mode 100644
index 778a635..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "vp9/decoder/vp9_read_bit_buffer.h"
-
-size_t vp9_rb_bytes_read(struct vp9_read_bit_buffer *rb) {
- return rb->bit_offset / CHAR_BIT + (rb->bit_offset % CHAR_BIT > 0);
-}
-
-int vp9_rb_read_bit(struct vp9_read_bit_buffer *rb) {
- const size_t off = rb->bit_offset;
- const size_t p = off / CHAR_BIT;
- const int q = CHAR_BIT - 1 - (int)off % CHAR_BIT;
- if (rb->bit_buffer + p >= rb->bit_buffer_end) {
- rb->error_handler(rb->error_handler_data);
- return 0;
- } else {
- const int bit = (rb->bit_buffer[p] & (1 << q)) >> q;
- rb->bit_offset = off + 1;
- return bit;
- }
-}
-
-int vp9_rb_read_literal(struct vp9_read_bit_buffer *rb, int bits) {
- int value = 0, bit;
- for (bit = bits - 1; bit >= 0; bit--)
- value |= vp9_rb_read_bit(rb) << bit;
- return value;
-}
-
-int vp9_rb_read_signed_literal(struct vp9_read_bit_buffer *rb,
- int bits) {
- const int value = vp9_rb_read_literal(rb, bits);
- return vp9_rb_read_bit(rb) ? -value : value;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.h
deleted file mode 100644
index fc88bd7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_read_bit_buffer.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_DECODER_VP9_READ_BIT_BUFFER_H_
-#define VP9_DECODER_VP9_READ_BIT_BUFFER_H_
-
-#include <limits.h>
-
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*vp9_rb_error_handler)(void *data);
-
-struct vp9_read_bit_buffer {
- const uint8_t *bit_buffer;
- const uint8_t *bit_buffer_end;
- size_t bit_offset;
-
- void *error_handler_data;
- vp9_rb_error_handler error_handler;
-};
-
-size_t vp9_rb_bytes_read(struct vp9_read_bit_buffer *rb);
-
-int vp9_rb_read_bit(struct vp9_read_bit_buffer *rb);
-
-int vp9_rb_read_literal(struct vp9_read_bit_buffer *rb, int bits);
-
-int vp9_rb_read_signed_literal(struct vp9_read_bit_buffer *rb, int bits);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_READ_BIT_BUFFER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.c
deleted file mode 100644
index fb44c88..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_ports/mem.h"
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/decoder/vp9_reader.h"
-
-// 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
-
-int vp9_reader_init(vp9_reader *r, const uint8_t *buffer, size_t size) {
- if (size && !buffer) {
- return 1;
- } else {
- r->buffer_end = buffer + size;
- r->buffer = buffer;
- r->value = 0;
- r->count = -8;
- r->range = 255;
- vp9_reader_fill(r);
- return vp9_read_bit(r) != 0; // marker bit
- }
-}
-
-void vp9_reader_fill(vp9_reader *r) {
- const uint8_t *const buffer_end = r->buffer_end;
- const uint8_t *buffer = r->buffer;
- BD_VALUE value = r->value;
- int count = r->count;
- int shift = BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT);
- int loop_end = 0;
- const int bits_left = (int)((buffer_end - buffer) * CHAR_BIT);
- const int x = shift + CHAR_BIT - bits_left;
-
- if (x >= 0) {
- count += LOTS_OF_BITS;
- loop_end = x;
- }
-
- if (x < 0 || bits_left) {
- while (shift >= loop_end) {
- count += CHAR_BIT;
- value |= (BD_VALUE)*buffer++ << shift;
- shift -= CHAR_BIT;
- }
- }
-
- r->buffer = buffer;
- r->value = value;
- r->count = count;
-}
-
-const uint8_t *vp9_reader_find_end(vp9_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;
-}
-
-int vp9_reader_has_error(vp9_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;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.h
deleted file mode 100644
index 8fe6acb..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_reader.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_DECODER_VP9_READER_H_
-#define VP9_DECODER_VP9_READER_H_
-
-#include <stddef.h>
-#include <limits.h>
-
-#include "./vpx_config.h"
-#include "vpx_ports/mem.h"
-#include "vpx/vpx_integer.h"
-
-#include "vp9/common/vp9_prob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef size_t BD_VALUE;
-
-#define BD_VALUE_SIZE ((int)sizeof(BD_VALUE) * CHAR_BIT)
-
-typedef struct {
- const uint8_t *buffer_end;
- const uint8_t *buffer;
- BD_VALUE value;
- int count;
- unsigned int range;
-} vp9_reader;
-
-int vp9_reader_init(vp9_reader *r, const uint8_t *buffer, size_t size);
-
-void vp9_reader_fill(vp9_reader *r);
-
-int vp9_reader_has_error(vp9_reader *r);
-
-const uint8_t *vp9_reader_find_end(vp9_reader *r);
-
-static int vp9_read(vp9_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)
- vp9_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 unsigned int shift = vp9_norm[range];
- range <<= shift;
- value <<= shift;
- count -= shift;
- }
- r->value = value;
- r->count = count;
- r->range = range;
-
- return bit;
-}
-
-static int vp9_read_bit(vp9_reader *r) {
- return vp9_read(r, 128); // vp9_prob_half
-}
-
-static int vp9_read_literal(vp9_reader *r, int bits) {
- int literal = 0, bit;
-
- for (bit = bits - 1; bit >= 0; bit--)
- literal |= vp9_read_bit(r) << bit;
-
- return literal;
-}
-
-static int vp9_read_tree(vp9_reader *r, const vp9_tree_index *tree,
- const vp9_prob *probs) {
- vp9_tree_index i = 0;
-
- while ((i = tree[i + vp9_read(r, probs[i >> 1])]) > 0)
- continue;
-
- return -i;
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_READER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.c b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.c
deleted file mode 100644
index 5d31d3d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.c
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the COPYING file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-// -----------------------------------------------------------------------------
-//
-// Multi-threaded worker
-//
-// Original source:
-// http://git.chromium.org/webm/libwebp.git
-// 100644 blob eff8f2a8c20095aade3c292b0e9292dac6cb3587 src/utils/thread.c
-
-
-#include <assert.h>
-#include <string.h> // for memset()
-#include "./vp9_thread.h"
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-#if CONFIG_MULTITHREAD
-
-//------------------------------------------------------------------------------
-
-static THREADFN thread_loop(void *ptr) { // thread loop
- VP9Worker* const worker = (VP9Worker*)ptr;
- int done = 0;
- while (!done) {
- pthread_mutex_lock(&worker->mutex_);
- while (worker->status_ == OK) { // wait in idling mode
- pthread_cond_wait(&worker->condition_, &worker->mutex_);
- }
- if (worker->status_ == WORK) {
- vp9_worker_execute(worker);
- worker->status_ = OK;
- } else if (worker->status_ == NOT_OK) { // finish the worker
- done = 1;
- }
- // signal to the main thread that we're done (for Sync())
- pthread_cond_signal(&worker->condition_);
- pthread_mutex_unlock(&worker->mutex_);
- }
- return THREAD_RETURN(NULL); // Thread is finished
-}
-
-// main thread state control
-static void change_state(VP9Worker* const worker,
- VP9WorkerStatus new_status) {
- // no-op when attempting to change state on a thread that didn't come up
- if (worker->status_ < OK) return;
-
- pthread_mutex_lock(&worker->mutex_);
- // wait for the worker to finish
- while (worker->status_ != OK) {
- pthread_cond_wait(&worker->condition_, &worker->mutex_);
- }
- // assign new status and release the working thread if needed
- if (new_status != OK) {
- worker->status_ = new_status;
- pthread_cond_signal(&worker->condition_);
- }
- pthread_mutex_unlock(&worker->mutex_);
-}
-
-#endif // CONFIG_MULTITHREAD
-
-//------------------------------------------------------------------------------
-
-void vp9_worker_init(VP9Worker* const worker) {
- memset(worker, 0, sizeof(*worker));
- worker->status_ = NOT_OK;
-}
-
-int vp9_worker_sync(VP9Worker* const worker) {
-#if CONFIG_MULTITHREAD
- change_state(worker, OK);
-#endif
- assert(worker->status_ <= OK);
- return !worker->had_error;
-}
-
-int vp9_worker_reset(VP9Worker* const worker) {
- int ok = 1;
- worker->had_error = 0;
- if (worker->status_ < OK) {
-#if CONFIG_MULTITHREAD
- if (pthread_mutex_init(&worker->mutex_, NULL) ||
- pthread_cond_init(&worker->condition_, NULL)) {
- return 0;
- }
- pthread_mutex_lock(&worker->mutex_);
- ok = !pthread_create(&worker->thread_, NULL, thread_loop, worker);
- if (ok) worker->status_ = OK;
- pthread_mutex_unlock(&worker->mutex_);
-#else
- worker->status_ = OK;
-#endif
- } else if (worker->status_ > OK) {
- ok = vp9_worker_sync(worker);
- }
- assert(!ok || (worker->status_ == OK));
- return ok;
-}
-
-void vp9_worker_execute(VP9Worker* const worker) {
- if (worker->hook != NULL) {
- worker->had_error |= !worker->hook(worker->data1, worker->data2);
- }
-}
-
-void vp9_worker_launch(VP9Worker* const worker) {
-#if CONFIG_MULTITHREAD
- change_state(worker, WORK);
-#else
- vp9_worker_execute(worker);
-#endif
-}
-
-void vp9_worker_end(VP9Worker* const worker) {
- if (worker->status_ >= OK) {
-#if CONFIG_MULTITHREAD
- change_state(worker, NOT_OK);
- pthread_join(worker->thread_, NULL);
- pthread_mutex_destroy(&worker->mutex_);
- pthread_cond_destroy(&worker->condition_);
-#else
- worker->status_ = NOT_OK;
-#endif
- }
- assert(worker->status_ == NOT_OK);
-}
-
-//------------------------------------------------------------------------------
-
-#if defined(__cplusplus) || defined(c_plusplus)
-} // extern "C"
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.h b/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.h
deleted file mode 100644
index 2f8728d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/decoder/vp9_thread.h
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the COPYING file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-// -----------------------------------------------------------------------------
-//
-// Multi-threaded worker
-//
-// Original source:
-// http://git.chromium.org/webm/libwebp.git
-// 100644 blob 13a61a4c84194c3374080cbf03d881d3cd6af40d src/utils/thread.h
-
-
-#ifndef VP9_DECODER_VP9_THREAD_H_
-#define VP9_DECODER_VP9_THREAD_H_
-
-#include "./vpx_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if CONFIG_MULTITHREAD
-
-#if defined(_WIN32)
-#include <errno.h> // NOLINT
-#include <process.h> // NOLINT
-#include <windows.h> // NOLINT
-typedef HANDLE pthread_t;
-typedef CRITICAL_SECTION pthread_mutex_t;
-typedef struct {
- HANDLE waiting_sem_;
- HANDLE received_sem_;
- HANDLE signal_event_;
-} pthread_cond_t;
-
-//------------------------------------------------------------------------------
-// simplistic pthread emulation layer
-
-// _beginthreadex requires __stdcall
-#define THREADFN unsigned int __stdcall
-#define THREAD_RETURN(val) (unsigned int)((DWORD_PTR)val)
-
-static INLINE int pthread_create(pthread_t* const thread, const void* attr,
- unsigned int (__stdcall *start)(void*),
- void* arg) {
- (void)attr;
- *thread = (pthread_t)_beginthreadex(NULL, /* void *security */
- 0, /* unsigned stack_size */
- start,
- arg,
- 0, /* unsigned initflag */
- NULL); /* unsigned *thrdaddr */
- if (*thread == NULL) return 1;
- SetThreadPriority(*thread, THREAD_PRIORITY_ABOVE_NORMAL);
- return 0;
-}
-
-static INLINE int pthread_join(pthread_t thread, void** value_ptr) {
- (void)value_ptr;
- return (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0 ||
- CloseHandle(thread) == 0);
-}
-
-// Mutex
-static INLINE int pthread_mutex_init(pthread_mutex_t *const mutex,
- void* mutexattr) {
- (void)mutexattr;
- InitializeCriticalSection(mutex);
- return 0;
-}
-
-static INLINE int pthread_mutex_trylock(pthread_mutex_t *const mutex) {
- return TryEnterCriticalSection(mutex) ? 0 : EBUSY;
-}
-
-static INLINE int pthread_mutex_lock(pthread_mutex_t *const mutex) {
- EnterCriticalSection(mutex);
- return 0;
-}
-
-static INLINE int pthread_mutex_unlock(pthread_mutex_t *const mutex) {
- LeaveCriticalSection(mutex);
- return 0;
-}
-
-static INLINE int pthread_mutex_destroy(pthread_mutex_t *const mutex) {
- DeleteCriticalSection(mutex);
- return 0;
-}
-
-// Condition
-static INLINE int pthread_cond_destroy(pthread_cond_t *const condition) {
- int ok = 1;
- ok &= (CloseHandle(condition->waiting_sem_) != 0);
- ok &= (CloseHandle(condition->received_sem_) != 0);
- ok &= (CloseHandle(condition->signal_event_) != 0);
- return !ok;
-}
-
-static INLINE int pthread_cond_init(pthread_cond_t *const condition,
- void* cond_attr) {
- (void)cond_attr;
- condition->waiting_sem_ = CreateSemaphore(NULL, 0, 1, NULL);
- condition->received_sem_ = CreateSemaphore(NULL, 0, 1, NULL);
- condition->signal_event_ = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (condition->waiting_sem_ == NULL ||
- condition->received_sem_ == NULL ||
- condition->signal_event_ == NULL) {
- pthread_cond_destroy(condition);
- return 1;
- }
- return 0;
-}
-
-static INLINE int pthread_cond_signal(pthread_cond_t *const condition) {
- int ok = 1;
- if (WaitForSingleObject(condition->waiting_sem_, 0) == WAIT_OBJECT_0) {
- // a thread is waiting in pthread_cond_wait: allow it to be notified
- ok = SetEvent(condition->signal_event_);
- // wait until the event is consumed so the signaler cannot consume
- // the event via its own pthread_cond_wait.
- ok &= (WaitForSingleObject(condition->received_sem_, INFINITE) !=
- WAIT_OBJECT_0);
- }
- return !ok;
-}
-
-static INLINE int pthread_cond_wait(pthread_cond_t *const condition,
- pthread_mutex_t *const mutex) {
- int ok;
- // note that there is a consumer available so the signal isn't dropped in
- // pthread_cond_signal
- if (!ReleaseSemaphore(condition->waiting_sem_, 1, NULL))
- return 1;
- // now unlock the mutex so pthread_cond_signal may be issued
- pthread_mutex_unlock(mutex);
- ok = (WaitForSingleObject(condition->signal_event_, INFINITE) ==
- WAIT_OBJECT_0);
- ok &= ReleaseSemaphore(condition->received_sem_, 1, NULL);
- pthread_mutex_lock(mutex);
- return !ok;
-}
-#else // _WIN32
-#include <pthread.h> // NOLINT
-# define THREADFN void*
-# define THREAD_RETURN(val) val
-#endif
-
-#endif // CONFIG_MULTITHREAD
-
-// State of the worker thread object
-typedef enum {
- NOT_OK = 0, // object is unusable
- OK, // ready to work
- WORK // busy finishing the current task
-} VP9WorkerStatus;
-
-// Function to be called by the worker thread. Takes two opaque pointers as
-// arguments (data1 and data2), and should return false in case of error.
-typedef int (*VP9WorkerHook)(void*, void*);
-
-// Synchronize object used to launch job in the worker thread
-typedef struct {
-#if CONFIG_MULTITHREAD
- pthread_mutex_t mutex_;
- pthread_cond_t condition_;
- pthread_t thread_;
-#endif
- VP9WorkerStatus status_;
- VP9WorkerHook hook; // hook to call
- void* data1; // first argument passed to 'hook'
- void* data2; // second argument passed to 'hook'
- int had_error; // return value of the last call to 'hook'
-} VP9Worker;
-
-// Must be called first, before any other method.
-void vp9_worker_init(VP9Worker* const worker);
-// Must be called to initialize the object and spawn the thread. Re-entrant.
-// Will potentially launch the thread. Returns false in case of error.
-int vp9_worker_reset(VP9Worker* const worker);
-// Makes sure the previous work is finished. Returns true if worker->had_error
-// was not set and no error condition was triggered by the working thread.
-int vp9_worker_sync(VP9Worker* const worker);
-// Triggers the thread to call hook() with data1 and data2 argument. These
-// hook/data1/data2 can be changed at any time before calling this function,
-// but not be changed afterward until the next call to vp9_worker_sync().
-void vp9_worker_launch(VP9Worker* const worker);
-// This function is similar to vp9_worker_launch() except that it calls the
-// hook directly instead of using a thread. Convenient to bypass the thread
-// mechanism while still using the VP9Worker structs. vp9_worker_sync() must
-// still be called afterward (for error reporting).
-void vp9_worker_execute(VP9Worker* const worker);
-// Kill the thread and terminate the object. To use the object again, one
-// must call vp9_worker_reset() again.
-void vp9_worker_end(VP9Worker* const worker);
-
-//------------------------------------------------------------------------------
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_DECODER_VP9_THREAD_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.c
deleted file mode 100644
index 83892e8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-#include <math.h>
-
-#include "vp9/common/vp9_seg_common.h"
-
-#include "vp9/encoder/vp9_segmentation.h"
-
-static const double in_frame_q_adj_ratio[MAX_SEGMENTS] =
- {1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
-
-void vp9_setup_in_frame_q_adj(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- struct segmentation *const seg = &cm->seg;
-
- // Make SURE use of floating point in this function is safe.
- vp9_clear_system_state();
-
- if (cm->frame_type == KEY_FRAME ||
- cpi->refresh_alt_ref_frame ||
- (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
- int segment;
-
- // Clear down the segment map.
- vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
-
- // Clear down the complexity map used for rd.
- vpx_memset(cpi->complexity_map, 0, cm->mi_rows * cm->mi_cols);
-
- vp9_enable_segmentation(seg);
- vp9_clearall_segfeatures(seg);
-
- // Select delta coding method.
- seg->abs_delta = SEGMENT_DELTADATA;
-
- // Segment 0 "Q" feature is disabled so it defaults to the baseline Q.
- vp9_disable_segfeature(seg, 0, SEG_LVL_ALT_Q);
-
- // Use some of the segments for in frame Q adjustment.
- for (segment = 1; segment < 2; segment++) {
- const int qindex_delta =
- vp9_compute_qdelta_by_rate(cpi,
- cm->base_qindex,
- in_frame_q_adj_ratio[segment]);
- vp9_enable_segfeature(seg, segment, SEG_LVL_ALT_Q);
- vp9_set_segdata(seg, segment, SEG_LVL_ALT_Q, qindex_delta);
- }
- }
-}
-
-// Select a segment for the current SB64
-void vp9_select_in_frame_q_segment(VP9_COMP *cpi,
- int mi_row, int mi_col,
- int output_enabled, int projected_rate) {
- VP9_COMMON *const cm = &cpi->common;
-
- const int mi_offset = mi_row * cm->mi_cols + mi_col;
- const int bw = num_8x8_blocks_wide_lookup[BLOCK_64X64];
- const int bh = num_8x8_blocks_high_lookup[BLOCK_64X64];
- const int xmis = MIN(cm->mi_cols - mi_col, bw);
- const int ymis = MIN(cm->mi_rows - mi_row, bh);
- int complexity_metric = 64;
- int x, y;
-
- unsigned char segment;
-
- if (!output_enabled) {
- segment = 0;
- } else {
- // Rate depends on fraction of a SB64 in frame (xmis * ymis / bw * bh).
- // It is converted to bits * 256 units.
- const int target_rate = (cpi->rc.sb64_target_rate * xmis * ymis * 256) /
- (bw * bh);
-
- if (projected_rate < (target_rate / 4)) {
- segment = 1;
- } else {
- segment = 0;
- }
-
- if (target_rate > 0) {
- complexity_metric =
- clamp((int)((projected_rate * 64) / target_rate), 16, 255);
- }
- }
-
- // Fill in the entires in the segment map corresponding to this SB64.
- for (y = 0; y < ymis; y++) {
- for (x = 0; x < xmis; x++) {
- cpi->segmentation_map[mi_offset + y * cm->mi_cols + x] = segment;
- cpi->complexity_map[mi_offset + y * cm->mi_cols + x] =
- (unsigned char)complexity_metric;
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.h
deleted file mode 100644
index af031a4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_complexity.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_AQ_COMPLEXITY_H_
-#define VP9_ENCODER_VP9_AQ_COMPLEXITY_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP9_COMP;
-
-// Select a segment for the current SB64.
-void vp9_select_in_frame_q_segment(struct VP9_COMP *cpi, int mi_row, int mi_col,
- int output_enabled, int projected_rate);
-
-
-// This function sets up a set of segments with delta Q values around
-// the baseline frame quantizer.
-void vp9_setup_in_frame_q_adj(struct VP9_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_AQ_COMPLEXITY_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c
deleted file mode 100644
index 2e1b4ef..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-#include <math.h>
-
-#include "vp9/encoder/vp9_aq_cyclicrefresh.h"
-
-#include "vp9/common/vp9_seg_common.h"
-
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_segmentation.h"
-
-struct CYCLIC_REFRESH {
- // Percentage of super-blocks per frame that are targeted as candidates
- // for cyclic refresh.
- int max_sbs_perframe;
- // Maximum q-delta as percentage of base q.
- int max_qdelta_perc;
- // Block size below which we don't apply cyclic refresh.
- BLOCK_SIZE min_block_size;
- // Superblock starting index for cycling through the frame.
- int sb_index;
- // Controls how long a block will need to wait to be refreshed again.
- int time_for_refresh;
- // Actual number of (8x8) blocks that were applied delta-q (segment 1).
- int num_seg_blocks;
- // Actual encoding bits for segment 1.
- int actual_seg_bits;
- // RD mult. parameters for segment 1.
- int rdmult;
- // Cyclic refresh map.
- signed char *map;
- // Projected rate and distortion for the current superblock.
- int64_t projected_rate_sb;
- int64_t projected_dist_sb;
- // Thresholds applied to projected rate/distortion of the superblock.
- int64_t thresh_rate_sb;
- int64_t thresh_dist_sb;
-};
-
-CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols) {
- CYCLIC_REFRESH *const cr = vpx_calloc(1, sizeof(*cr));
- if (cr == NULL)
- return NULL;
-
- cr->map = vpx_calloc(mi_rows * mi_cols, sizeof(*cr->map));
- if (cr->map == NULL) {
- vpx_free(cr);
- return NULL;
- }
-
- return cr;
-}
-
-void vp9_cyclic_refresh_free(CYCLIC_REFRESH *cr) {
- vpx_free(cr->map);
- vpx_free(cr);
-}
-
-// Check if we should turn off cyclic refresh based on bitrate condition.
-static int apply_cyclic_refresh_bitrate(const VP9_COMMON *cm,
- const RATE_CONTROL *rc) {
- // Turn off cyclic refresh if bits available per frame is not sufficiently
- // larger than bit cost of segmentation. Segment map bit cost should scale
- // with number of seg blocks, so compare available bits to number of blocks.
- // Average bits available per frame = av_per_frame_bandwidth
- // Number of (8x8) blocks in frame = mi_rows * mi_cols;
- const float factor = 0.5;
- const int number_blocks = cm->mi_rows * cm->mi_cols;
- // The condition below corresponds to turning off at target bitrates:
- // ~24kbps for CIF, 72kbps for VGA (at 30fps).
- // Also turn off at very small frame sizes, to avoid too large fraction of
- // superblocks to be refreshed per frame. Threshold below is less than QCIF.
- if (rc->av_per_frame_bandwidth < factor * number_blocks ||
- number_blocks / 64 < 5)
- return 0;
- else
- return 1;
-}
-
-// Check if this coding block, of size bsize, should be considered for refresh
-// (lower-qp coding). Decision can be based on various factors, such as
-// size of the coding block (i.e., below min_block size rejected), coding
-// mode, and rate/distortion.
-static int candidate_refresh_aq(const CYCLIC_REFRESH *cr,
- const MB_MODE_INFO *mbmi,
- BLOCK_SIZE bsize, int use_rd) {
- if (use_rd) {
- // If projected rate is below the thresh_rate (well below target,
- // so undershoot expected), accept it for lower-qp coding.
- if (cr->projected_rate_sb < cr->thresh_rate_sb)
- return 1;
- // Otherwise, reject the block for lower-qp coding if any of the following:
- // 1) prediction block size is below min_block_size
- // 2) mode is non-zero mv and projected distortion is above thresh_dist
- // 3) mode is an intra-mode (we may want to allow some of this under
- // another thresh_dist)
- else if (bsize < cr->min_block_size ||
- (mbmi->mv[0].as_int != 0 &&
- cr->projected_dist_sb > cr->thresh_dist_sb) ||
- !is_inter_block(mbmi))
- return 0;
- else
- return 1;
- } else {
- // Rate/distortion not used for update.
- if (bsize < cr->min_block_size ||
- mbmi->mv[0].as_int != 0 ||
- !is_inter_block(mbmi))
- return 0;
- else
- return 1;
- }
-}
-
-// Prior to coding a given prediction block, of size bsize at (mi_row, mi_col),
-// check if we should reset the segment_id, and update the cyclic_refresh map
-// and segmentation map.
-void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi,
- MB_MODE_INFO *const mbmi,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize, int use_rd) {
- const VP9_COMMON *const cm = &cpi->common;
- CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
- const int bw = num_8x8_blocks_wide_lookup[bsize];
- const int bh = num_8x8_blocks_high_lookup[bsize];
- const int xmis = MIN(cm->mi_cols - mi_col, bw);
- const int ymis = MIN(cm->mi_rows - mi_row, bh);
- const int block_index = mi_row * cm->mi_cols + mi_col;
- const int refresh_this_block = candidate_refresh_aq(cr, mbmi, bsize, use_rd);
- // Default is to not update the refresh map.
- int new_map_value = cr->map[block_index];
- int x = 0; int y = 0;
-
- // Check if we should reset the segment_id for this block.
- if (mbmi->segment_id > 0 && !refresh_this_block)
- mbmi->segment_id = 0;
-
- // Update the cyclic refresh map, to be used for setting segmentation map
- // for the next frame. If the block will be refreshed this frame, mark it
- // as clean. The magnitude of the -ve influences how long before we consider
- // it for refresh again.
- if (mbmi->segment_id == 1) {
- new_map_value = -cr->time_for_refresh;
- } else if (refresh_this_block) {
- // Else if it is accepted as candidate for refresh, and has not already
- // been refreshed (marked as 1) then mark it as a candidate for cleanup
- // for future time (marked as 0), otherwise don't update it.
- if (cr->map[block_index] == 1)
- new_map_value = 0;
- } else {
- // Leave it marked as block that is not candidate for refresh.
- new_map_value = 1;
- }
- // Update entries in the cyclic refresh map with new_map_value, and
- // copy mbmi->segment_id into global segmentation map.
- for (y = 0; y < ymis; y++)
- for (x = 0; x < xmis; x++) {
- cr->map[block_index + y * cm->mi_cols + x] = new_map_value;
- cpi->segmentation_map[block_index + y * cm->mi_cols + x] =
- mbmi->segment_id;
- }
- // Keep track of actual number (in units of 8x8) of blocks in segment 1 used
- // for encoding this frame.
- if (mbmi->segment_id)
- cr->num_seg_blocks += xmis * ymis;
-}
-
-// Setup cyclic background refresh: set delta q and segmentation map.
-void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) {
- VP9_COMMON *const cm = &cpi->common;
- const RATE_CONTROL *const rc = &cpi->rc;
- CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
- struct segmentation *const seg = &cm->seg;
- unsigned char *const seg_map = cpi->segmentation_map;
- const int apply_cyclic_refresh = apply_cyclic_refresh_bitrate(cm, rc);
- // Don't apply refresh on key frame or enhancement layer frames.
- if (!apply_cyclic_refresh ||
- (cm->frame_type == KEY_FRAME) ||
- (cpi->svc.temporal_layer_id > 0)) {
- // Set segmentation map to 0 and disable.
- vpx_memset(seg_map, 0, cm->mi_rows * cm->mi_cols);
- vp9_disable_segmentation(&cm->seg);
- if (cm->frame_type == KEY_FRAME)
- cr->sb_index = 0;
- return;
- } else {
- int qindex_delta = 0;
- int i, block_count, bl_index, sb_rows, sb_cols, sbs_in_frame;
- int xmis, ymis, x, y, qindex2;
-
- // Rate target ratio to set q delta.
- const float rate_ratio_qdelta = 2.0;
- vp9_clear_system_state();
- // Some of these parameters may be set via codec-control function later.
- cr->max_sbs_perframe = 10;
- cr->max_qdelta_perc = 50;
- cr->min_block_size = BLOCK_8X8;
- cr->time_for_refresh = 1;
- // Set rate threshold to some fraction of target (and scaled by 256).
- cr->thresh_rate_sb = (rc->sb64_target_rate * 256) >> 2;
- // Distortion threshold, quadratic in Q, scale factor to be adjusted.
- cr->thresh_dist_sb = 8 * (int)(vp9_convert_qindex_to_q(cm->base_qindex) *
- vp9_convert_qindex_to_q(cm->base_qindex));
- if (cpi->sf.use_nonrd_pick_mode) {
- // May want to be more conservative with thresholds in non-rd mode for now
- // as rate/distortion are derived from model based on prediction residual.
- cr->thresh_rate_sb = (rc->sb64_target_rate * 256) >> 3;
- cr->thresh_dist_sb = 4 * (int)(vp9_convert_qindex_to_q(cm->base_qindex) *
- vp9_convert_qindex_to_q(cm->base_qindex));
- }
-
- cr->num_seg_blocks = 0;
- // Set up segmentation.
- // Clear down the segment map.
- vpx_memset(seg_map, 0, cm->mi_rows * cm->mi_cols);
- vp9_enable_segmentation(&cm->seg);
- vp9_clearall_segfeatures(seg);
- // Select delta coding method.
- seg->abs_delta = SEGMENT_DELTADATA;
-
- // Note: setting temporal_update has no effect, as the seg-map coding method
- // (temporal or spatial) is determined in vp9_choose_segmap_coding_method(),
- // based on the coding cost of each method. For error_resilient mode on the
- // last_frame_seg_map is set to 0, so if temporal coding is used, it is
- // relative to 0 previous map.
- // seg->temporal_update = 0;
-
- // Segment 0 "Q" feature is disabled so it defaults to the baseline Q.
- vp9_disable_segfeature(seg, 0, SEG_LVL_ALT_Q);
- // Use segment 1 for in-frame Q adjustment.
- vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_Q);
-
- // Set the q delta for segment 1.
- qindex_delta = vp9_compute_qdelta_by_rate(cpi,
- cm->base_qindex,
- rate_ratio_qdelta);
- // TODO(marpan): Incorporate the actual-vs-target rate over/undershoot from
- // previous encoded frame.
- if (-qindex_delta > cr->max_qdelta_perc * cm->base_qindex / 100)
- qindex_delta = -cr->max_qdelta_perc * cm->base_qindex / 100;
-
- // Compute rd-mult for segment 1.
- qindex2 = clamp(cm->base_qindex + cm->y_dc_delta_q + qindex_delta, 0, MAXQ);
- cr->rdmult = vp9_compute_rd_mult(cpi, qindex2);
-
- vp9_set_segdata(seg, 1, SEG_LVL_ALT_Q, qindex_delta);
-
- sb_cols = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
- sb_rows = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
- sbs_in_frame = sb_cols * sb_rows;
- // Number of target superblocks to get the q delta (segment 1).
- block_count = cr->max_sbs_perframe * sbs_in_frame / 100;
- // Set the segmentation map: cycle through the superblocks, starting at
- // cr->mb_index, and stopping when either block_count blocks have been found
- // to be refreshed, or we have passed through whole frame.
- assert(cr->sb_index < sbs_in_frame);
- i = cr->sb_index;
- do {
- int sum_map = 0;
- // Get the mi_row/mi_col corresponding to superblock index i.
- int sb_row_index = (i / sb_cols);
- int sb_col_index = i - sb_row_index * sb_cols;
- int mi_row = sb_row_index * MI_BLOCK_SIZE;
- int mi_col = sb_col_index * MI_BLOCK_SIZE;
- assert(mi_row >= 0 && mi_row < cm->mi_rows);
- assert(mi_col >= 0 && mi_col < cm->mi_cols);
- bl_index = mi_row * cm->mi_cols + mi_col;
- // Loop through all 8x8 blocks in superblock and update map.
- xmis = MIN(cm->mi_cols - mi_col,
- num_8x8_blocks_wide_lookup[BLOCK_64X64]);
- ymis = MIN(cm->mi_rows - mi_row,
- num_8x8_blocks_high_lookup[BLOCK_64X64]);
- for (y = 0; y < ymis; y++) {
- for (x = 0; x < xmis; x++) {
- const int bl_index2 = bl_index + y * cm->mi_cols + x;
- // If the block is as a candidate for clean up then mark it
- // for possible boost/refresh (segment 1). The segment id may get
- // reset to 0 later if block gets coded anything other than ZEROMV.
- if (cr->map[bl_index2] == 0) {
- seg_map[bl_index2] = 1;
- sum_map++;
- } else if (cr->map[bl_index2] < 0) {
- cr->map[bl_index2]++;
- }
- }
- }
- // Enforce constant segment over superblock.
- // If segment is partial over superblock, reset to either all 1 or 0.
- if (sum_map > 0 && sum_map < xmis * ymis) {
- const int new_value = (sum_map >= xmis * ymis / 2);
- for (y = 0; y < ymis; y++)
- for (x = 0; x < xmis; x++)
- seg_map[bl_index + y * cm->mi_cols + x] = new_value;
- }
- i++;
- if (i == sbs_in_frame) {
- i = 0;
- }
- if (sum_map >= xmis * ymis /2)
- block_count--;
- } while (block_count && i != cr->sb_index);
- cr->sb_index = i;
- }
-}
-
-void vp9_cyclic_refresh_set_rate_and_dist_sb(CYCLIC_REFRESH *cr,
- int64_t rate_sb, int64_t dist_sb) {
- cr->projected_rate_sb = rate_sb;
- cr->projected_dist_sb = dist_sb;
-}
-
-int vp9_cyclic_refresh_get_rdmult(const CYCLIC_REFRESH *cr) {
- return cr->rdmult;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.h
deleted file mode 100644
index f556d65..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_
-#define VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_
-
-#include "vp9/common/vp9_blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP9_COMP;
-
-struct CYCLIC_REFRESH;
-typedef struct CYCLIC_REFRESH CYCLIC_REFRESH;
-
-CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols);
-
-void vp9_cyclic_refresh_free(CYCLIC_REFRESH *cr);
-
-// Prior to coding a given prediction block, of size bsize at (mi_row, mi_col),
-// check if we should reset the segment_id, and update the cyclic_refresh map
-// and segmentation map.
-void vp9_cyclic_refresh_update_segment(struct VP9_COMP *const cpi,
- MB_MODE_INFO *const mbmi,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize, int use_rd);
-
-// Setup cyclic background refresh: set delta q and segmentation map.
-void vp9_cyclic_refresh_setup(struct VP9_COMP *const cpi);
-
-void vp9_cyclic_refresh_set_rate_and_dist_sb(CYCLIC_REFRESH *cr,
- int64_t rate_sb, int64_t dist_sb);
-
-int vp9_cyclic_refresh_get_rdmult(const CYCLIC_REFRESH *cr);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.c
deleted file mode 100644
index c25eb95..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-
-#include "vp9/encoder/vp9_aq_variance.h"
-
-#include "vp9/common/vp9_seg_common.h"
-
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_segmentation.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-#define ENERGY_MIN (-1)
-#define ENERGY_MAX (1)
-#define ENERGY_SPAN (ENERGY_MAX - ENERGY_MIN + 1)
-#define ENERGY_IN_BOUNDS(energy)\
- assert((energy) >= ENERGY_MIN && (energy) <= ENERGY_MAX)
-
-static double q_ratio[MAX_SEGMENTS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
-static double rdmult_ratio[MAX_SEGMENTS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
-static int segment_id[MAX_SEGMENTS] = { 5, 3, 1, 0, 2, 4, 6, 7 };
-
-#define Q_RATIO(i) q_ratio[(i) - ENERGY_MIN]
-#define RDMULT_RATIO(i) rdmult_ratio[(i) - ENERGY_MIN]
-#define SEGMENT_ID(i) segment_id[(i) - ENERGY_MIN]
-
-DECLARE_ALIGNED(16, static const uint8_t, vp9_64_zeros[64]) = {0};
-
-unsigned int vp9_vaq_segment_id(int energy) {
- ENERGY_IN_BOUNDS(energy);
-
- return SEGMENT_ID(energy);
-}
-
-double vp9_vaq_rdmult_ratio(int energy) {
- ENERGY_IN_BOUNDS(energy);
-
- vp9_clear_system_state();
-
- return RDMULT_RATIO(energy);
-}
-
-double vp9_vaq_inv_q_ratio(int energy) {
- ENERGY_IN_BOUNDS(energy);
-
- vp9_clear_system_state();
-
- return Q_RATIO(-energy);
-}
-
-void vp9_vaq_init() {
- int i;
- double base_ratio;
-
- assert(ENERGY_SPAN <= MAX_SEGMENTS);
-
- vp9_clear_system_state();
-
- base_ratio = 1.5;
-
- for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
- Q_RATIO(i) = pow(base_ratio, i/3.0);
- }
-}
-
-void vp9_vaq_frame_setup(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
- struct segmentation *seg = &cm->seg;
- const double base_q = vp9_convert_qindex_to_q(cm->base_qindex);
- const int base_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex +
- cm->y_dc_delta_q);
- int i;
-
- if (cm->frame_type == KEY_FRAME ||
- cpi->refresh_alt_ref_frame ||
- (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
- vp9_enable_segmentation(seg);
- vp9_clearall_segfeatures(seg);
-
- seg->abs_delta = SEGMENT_DELTADATA;
-
- vp9_clear_system_state();
-
- for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
- int qindex_delta, segment_rdmult;
-
- if (Q_RATIO(i) == 1) {
- // No need to enable SEG_LVL_ALT_Q for this segment
- RDMULT_RATIO(i) = 1;
- continue;
- }
-
- qindex_delta = vp9_compute_qdelta(cpi, base_q, base_q * Q_RATIO(i));
- vp9_set_segdata(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q, qindex_delta);
- vp9_enable_segfeature(seg, SEGMENT_ID(i), SEG_LVL_ALT_Q);
-
- segment_rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex + qindex_delta +
- cm->y_dc_delta_q);
-
- RDMULT_RATIO(i) = (double) segment_rdmult / base_rdmult;
- }
- }
-}
-
-
-static unsigned int block_variance(VP9_COMP *cpi, MACROBLOCK *x,
- BLOCK_SIZE bs) {
- MACROBLOCKD *xd = &x->e_mbd;
- unsigned int var, sse;
- int right_overflow = (xd->mb_to_right_edge < 0) ?
- ((-xd->mb_to_right_edge) >> 3) : 0;
- int bottom_overflow = (xd->mb_to_bottom_edge < 0) ?
- ((-xd->mb_to_bottom_edge) >> 3) : 0;
-
- if (right_overflow || bottom_overflow) {
- const int bw = 8 * num_8x8_blocks_wide_lookup[bs] - right_overflow;
- const int bh = 8 * num_8x8_blocks_high_lookup[bs] - bottom_overflow;
- int avg;
- variance(x->plane[0].src.buf, x->plane[0].src.stride,
- vp9_64_zeros, 0, bw, bh, &sse, &avg);
- var = sse - (((int64_t)avg * avg) / (bw * bh));
- return (256 * var) / (bw * bh);
- } else {
- var = cpi->fn_ptr[bs].vf(x->plane[0].src.buf,
- x->plane[0].src.stride,
- vp9_64_zeros, 0, &sse);
- return (256 * var) >> num_pels_log2_lookup[bs];
- }
-}
-
-int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
- double energy;
- unsigned int var = block_variance(cpi, x, bs);
-
- vp9_clear_system_state();
-
- energy = 0.9 * (log(var + 1.0) - 10.0);
- return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.h
deleted file mode 100644
index 381fe50..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_aq_variance.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_AQ_VARIANCE_H_
-#define VP9_ENCODER_VP9_AQ_VARIANCE_H_
-
-#include "vp9/encoder/vp9_onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-unsigned int vp9_vaq_segment_id(int energy);
-double vp9_vaq_rdmult_ratio(int energy);
-double vp9_vaq_inv_q_ratio(int energy);
-
-void vp9_vaq_init();
-void vp9_vaq_frame_setup(VP9_COMP *cpi);
-
-int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_AQ_VARIANCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.c
deleted file mode 100644
index dbefe1e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.c
+++ /dev/null
@@ -1,1215 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <limits.h>
-
-#include "vpx/vpx_encoder.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/mem_ops.h"
-
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_entropymv.h"
-#include "vp9/common/vp9_mvref_common.h"
-#include "vp9/common/vp9_pragmas.h"
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_seg_common.h"
-#include "vp9/common/vp9_systemdependent.h"
-#include "vp9/common/vp9_tile_common.h"
-
-#include "vp9/encoder/vp9_cost.h"
-#include "vp9/encoder/vp9_bitstream.h"
-#include "vp9/encoder/vp9_encodemv.h"
-#include "vp9/encoder/vp9_mcomp.h"
-#include "vp9/encoder/vp9_segmentation.h"
-#include "vp9/encoder/vp9_subexp.h"
-#include "vp9/encoder/vp9_tokenize.h"
-#include "vp9/encoder/vp9_write_bit_buffer.h"
-
-static struct vp9_token intra_mode_encodings[INTRA_MODES];
-static struct vp9_token switchable_interp_encodings[SWITCHABLE_FILTERS];
-static struct vp9_token partition_encodings[PARTITION_TYPES];
-static struct vp9_token inter_mode_encodings[INTER_MODES];
-
-void vp9_entropy_mode_init() {
- vp9_tokens_from_tree(intra_mode_encodings, vp9_intra_mode_tree);
- vp9_tokens_from_tree(switchable_interp_encodings, vp9_switchable_interp_tree);
- vp9_tokens_from_tree(partition_encodings, vp9_partition_tree);
- vp9_tokens_from_tree(inter_mode_encodings, vp9_inter_mode_tree);
-}
-
-static void write_intra_mode(vp9_writer *w, MB_PREDICTION_MODE mode,
- const vp9_prob *probs) {
- vp9_write_token(w, vp9_intra_mode_tree, probs, &intra_mode_encodings[mode]);
-}
-
-static void write_inter_mode(vp9_writer *w, MB_PREDICTION_MODE mode,
- const vp9_prob *probs) {
- assert(is_inter_mode(mode));
- vp9_write_token(w, vp9_inter_mode_tree, probs,
- &inter_mode_encodings[INTER_OFFSET(mode)]);
-}
-
-static void encode_unsigned_max(struct vp9_write_bit_buffer *wb,
- int data, int max) {
- vp9_wb_write_literal(wb, data, get_unsigned_bits(max));
-}
-
-static void prob_diff_update(const vp9_tree_index *tree,
- vp9_prob probs[/*n - 1*/],
- const unsigned int counts[/*n - 1*/],
- int n, vp9_writer *w) {
- int i;
- unsigned int branch_ct[32][2];
-
- // Assuming max number of probabilities <= 32
- assert(n <= 32);
-
- vp9_tree_probs_from_distribution(tree, branch_ct, counts);
- for (i = 0; i < n - 1; ++i)
- vp9_cond_prob_diff_update(w, &probs[i], branch_ct[i]);
-}
-
-static void write_selected_tx_size(const VP9_COMP *cpi,
- TX_SIZE tx_size, BLOCK_SIZE bsize,
- vp9_writer *w) {
- const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
- const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- const vp9_prob *const tx_probs = get_tx_probs2(max_tx_size, xd,
- &cpi->common.fc.tx_probs);
- vp9_write(w, tx_size != TX_4X4, tx_probs[0]);
- if (tx_size != TX_4X4 && max_tx_size >= TX_16X16) {
- vp9_write(w, tx_size != TX_8X8, tx_probs[1]);
- if (tx_size != TX_8X8 && max_tx_size >= TX_32X32)
- vp9_write(w, tx_size != TX_16X16, tx_probs[2]);
- }
-}
-
-static int write_skip(const VP9_COMP *cpi, int segment_id, const MODE_INFO *mi,
- vp9_writer *w) {
- const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- if (vp9_segfeature_active(&cpi->common.seg, segment_id, SEG_LVL_SKIP)) {
- return 1;
- } else {
- const int skip = mi->mbmi.skip;
- vp9_write(w, skip, vp9_get_skip_prob(&cpi->common, xd));
- return skip;
- }
-}
-
-static void update_skip_probs(VP9_COMMON *cm, vp9_writer *w) {
- int k;
-
- for (k = 0; k < SKIP_CONTEXTS; ++k)
- vp9_cond_prob_diff_update(w, &cm->fc.skip_probs[k], cm->counts.skip[k]);
-}
-
-static void update_switchable_interp_probs(VP9_COMMON *cm, vp9_writer *w) {
- int j;
- for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
- prob_diff_update(vp9_switchable_interp_tree,
- cm->fc.switchable_interp_prob[j],
- cm->counts.switchable_interp[j], SWITCHABLE_FILTERS, w);
-}
-
-static void pack_mb_tokens(vp9_writer *w,
- TOKENEXTRA **tp, const TOKENEXTRA *stop) {
- TOKENEXTRA *p = *tp;
-
- while (p < stop && p->token != EOSB_TOKEN) {
- const int t = p->token;
- const struct vp9_token *const a = &vp9_coef_encodings[t];
- const vp9_extra_bit *const b = &vp9_extra_bits[t];
- int i = 0;
- int v = a->value;
- int n = a->len;
-
- /* skip one or two nodes */
- if (p->skip_eob_node) {
- n -= p->skip_eob_node;
- i = 2 * p->skip_eob_node;
- }
-
- // TODO(jbb): expanding this can lead to big gains. It allows
- // much better branch prediction and would enable us to avoid numerous
- // lookups and compares.
-
- // If we have a token that's in the constrained set, the coefficient tree
- // is split into two treed writes. The first treed write takes care of the
- // unconstrained nodes. The second treed write takes care of the
- // constrained nodes.
- if (t >= TWO_TOKEN && t < EOB_TOKEN) {
- int len = UNCONSTRAINED_NODES - p->skip_eob_node;
- int bits = v >> (n - len);
- vp9_write_tree(w, vp9_coef_tree, p->context_tree, bits, len, i);
- vp9_write_tree(w, vp9_coef_con_tree,
- vp9_pareto8_full[p->context_tree[PIVOT_NODE] - 1],
- v, n - len, 0);
- } else {
- vp9_write_tree(w, vp9_coef_tree, p->context_tree, v, n, i);
- }
-
- if (b->base_val) {
- const int e = p->extra, l = b->len;
-
- if (l) {
- const unsigned char *pb = b->prob;
- int v = e >> 1;
- int n = l; /* number of bits in v, assumed nonzero */
- int i = 0;
-
- do {
- const int bb = (v >> --n) & 1;
- vp9_write(w, bb, pb[i >> 1]);
- i = b->tree[i + bb];
- } while (n);
- }
-
- vp9_write_bit(w, e & 1);
- }
- ++p;
- }
-
- *tp = p + (p->token == EOSB_TOKEN);
-}
-
-static void write_segment_id(vp9_writer *w, const struct segmentation *seg,
- int segment_id) {
- if (seg->enabled && seg->update_map)
- vp9_write_tree(w, vp9_segment_tree, seg->tree_probs, segment_id, 3, 0);
-}
-
-// This function encodes the reference frame
-static void write_ref_frames(const VP9_COMP *cpi, vp9_writer *w) {
- const VP9_COMMON *const cm = &cpi->common;
- const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- const int is_compound = has_second_ref(mbmi);
- const int segment_id = mbmi->segment_id;
-
- // If segment level coding of this signal is disabled...
- // or the segment allows multiple reference frame options
- if (vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
- assert(!is_compound);
- assert(mbmi->ref_frame[0] ==
- vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME));
- } else {
- // does the feature use compound prediction or not
- // (if not specified at the frame/segment level)
- if (cm->reference_mode == REFERENCE_MODE_SELECT) {
- vp9_write(w, is_compound, vp9_get_reference_mode_prob(cm, xd));
- } else {
- assert(!is_compound == (cm->reference_mode == SINGLE_REFERENCE));
- }
-
- if (is_compound) {
- vp9_write(w, mbmi->ref_frame[0] == GOLDEN_FRAME,
- vp9_get_pred_prob_comp_ref_p(cm, xd));
- } else {
- const int bit0 = mbmi->ref_frame[0] != LAST_FRAME;
- vp9_write(w, bit0, vp9_get_pred_prob_single_ref_p1(cm, xd));
- if (bit0) {
- const int bit1 = mbmi->ref_frame[0] != GOLDEN_FRAME;
- vp9_write(w, bit1, vp9_get_pred_prob_single_ref_p2(cm, xd));
- }
- }
- }
-}
-
-static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
- vp9_writer *w) {
- VP9_COMMON *const cm = &cpi->common;
- const nmv_context *nmvc = &cm->fc.nmvc;
- const MACROBLOCK *const x = &cpi->mb;
- const MACROBLOCKD *const xd = &x->e_mbd;
- const struct segmentation *const seg = &cm->seg;
- const MB_MODE_INFO *const mbmi = &mi->mbmi;
- const MB_PREDICTION_MODE mode = mbmi->mode;
- const int segment_id = mbmi->segment_id;
- const BLOCK_SIZE bsize = mbmi->sb_type;
- const int allow_hp = cm->allow_high_precision_mv;
- const int is_inter = is_inter_block(mbmi);
- const int is_compound = has_second_ref(mbmi);
- int skip, ref;
-
- if (seg->update_map) {
- if (seg->temporal_update) {
- const int pred_flag = mbmi->seg_id_predicted;
- vp9_prob pred_prob = vp9_get_pred_prob_seg_id(seg, xd);
- vp9_write(w, pred_flag, pred_prob);
- if (!pred_flag)
- write_segment_id(w, seg, segment_id);
- } else {
- write_segment_id(w, seg, segment_id);
- }
- }
-
- skip = write_skip(cpi, segment_id, mi, w);
-
- if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
- vp9_write(w, is_inter, vp9_get_intra_inter_prob(cm, xd));
-
- if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
- !(is_inter &&
- (skip || vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)))) {
- write_selected_tx_size(cpi, mbmi->tx_size, bsize, w);
- }
-
- if (!is_inter) {
- if (bsize >= BLOCK_8X8) {
- write_intra_mode(w, mode, cm->fc.y_mode_prob[size_group_lookup[bsize]]);
- } else {
- int idx, idy;
- const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
- for (idy = 0; idy < 2; idy += num_4x4_h) {
- for (idx = 0; idx < 2; idx += num_4x4_w) {
- const MB_PREDICTION_MODE b_mode = mi->bmi[idy * 2 + idx].as_mode;
- write_intra_mode(w, b_mode, cm->fc.y_mode_prob[0]);
- }
- }
- }
- write_intra_mode(w, mbmi->uv_mode, cm->fc.uv_mode_prob[mode]);
- } else {
- const int mode_ctx = mbmi->mode_context[mbmi->ref_frame[0]];
- const vp9_prob *const inter_probs = cm->fc.inter_mode_probs[mode_ctx];
- write_ref_frames(cpi, w);
-
- // If segment skip is not enabled code the mode.
- if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)) {
- if (bsize >= BLOCK_8X8) {
- write_inter_mode(w, mode, inter_probs);
- ++cm->counts.inter_mode[mode_ctx][INTER_OFFSET(mode)];
- }
- }
-
- if (cm->interp_filter == SWITCHABLE) {
- const int ctx = vp9_get_pred_context_switchable_interp(xd);
- vp9_write_token(w, vp9_switchable_interp_tree,
- cm->fc.switchable_interp_prob[ctx],
- &switchable_interp_encodings[mbmi->interp_filter]);
- } else {
- assert(mbmi->interp_filter == cm->interp_filter);
- }
-
- if (bsize < BLOCK_8X8) {
- 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 MB_PREDICTION_MODE b_mode = mi->bmi[j].as_mode;
- write_inter_mode(w, b_mode, inter_probs);
- ++cm->counts.inter_mode[mode_ctx][INTER_OFFSET(b_mode)];
- if (b_mode == NEWMV) {
- for (ref = 0; ref < 1 + is_compound; ++ref)
- vp9_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv,
- &mbmi->ref_mvs[mbmi->ref_frame[ref]][0].as_mv,
- nmvc, allow_hp);
- }
- }
- }
- } else {
- if (mode == NEWMV) {
- for (ref = 0; ref < 1 + is_compound; ++ref)
- vp9_encode_mv(cpi, w, &mbmi->mv[ref].as_mv,
- &mbmi->ref_mvs[mbmi->ref_frame[ref]][0].as_mv, nmvc,
- allow_hp);
- }
- }
- }
-}
-
-static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO **mi_8x8,
- vp9_writer *w) {
- const VP9_COMMON *const cm = &cpi->common;
- const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- const struct segmentation *const seg = &cm->seg;
- const MODE_INFO *const mi = mi_8x8[0];
- const MODE_INFO *const above_mi = mi_8x8[-xd->mi_stride];
- const MODE_INFO *const left_mi = xd->left_available ? mi_8x8[-1] : NULL;
- const MB_MODE_INFO *const mbmi = &mi->mbmi;
- const BLOCK_SIZE bsize = mbmi->sb_type;
-
- if (seg->update_map)
- write_segment_id(w, seg, mbmi->segment_id);
-
- write_skip(cpi, mbmi->segment_id, mi, w);
-
- if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT)
- write_selected_tx_size(cpi, mbmi->tx_size, bsize, w);
-
- if (bsize >= BLOCK_8X8) {
- write_intra_mode(w, mbmi->mode, get_y_mode_probs(mi, above_mi, left_mi, 0));
- } 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 block = idy * 2 + idx;
- write_intra_mode(w, mi->bmi[block].as_mode,
- get_y_mode_probs(mi, above_mi, left_mi, block));
- }
- }
- }
-
- write_intra_mode(w, mbmi->uv_mode, vp9_kf_uv_mode_prob[mbmi->mode]);
-}
-
-static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile,
- vp9_writer *w, TOKENEXTRA **tok, TOKENEXTRA *tok_end,
- int mi_row, int mi_col) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- MODE_INFO *m;
-
- xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
- m = xd->mi[0];
-
- set_mi_row_col(xd, tile,
- mi_row, num_8x8_blocks_high_lookup[m->mbmi.sb_type],
- mi_col, num_8x8_blocks_wide_lookup[m->mbmi.sb_type],
- cm->mi_rows, cm->mi_cols);
- if (frame_is_intra_only(cm)) {
- write_mb_modes_kf(cpi, xd->mi, w);
- } else {
- pack_inter_mode_mvs(cpi, m, w);
- }
-
- assert(*tok < tok_end);
- pack_mb_tokens(w, tok, tok_end);
-}
-
-static void write_partition(VP9_COMMON *cm, MACROBLOCKD *xd,
- int hbs, int mi_row, int mi_col,
- PARTITION_TYPE p, BLOCK_SIZE bsize, vp9_writer *w) {
- const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
- const vp9_prob *const probs = get_partition_probs(cm, ctx);
- const int has_rows = (mi_row + hbs) < cm->mi_rows;
- const int has_cols = (mi_col + hbs) < cm->mi_cols;
-
- if (has_rows && has_cols) {
- vp9_write_token(w, vp9_partition_tree, probs, &partition_encodings[p]);
- } else if (!has_rows && has_cols) {
- assert(p == PARTITION_SPLIT || p == PARTITION_HORZ);
- vp9_write(w, p == PARTITION_SPLIT, probs[1]);
- } else if (has_rows && !has_cols) {
- assert(p == PARTITION_SPLIT || p == PARTITION_VERT);
- vp9_write(w, p == PARTITION_SPLIT, probs[2]);
- } else {
- assert(p == PARTITION_SPLIT);
- }
-}
-
-static void write_modes_sb(VP9_COMP *cpi,
- const TileInfo *const tile,
- vp9_writer *w, TOKENEXTRA **tok, TOKENEXTRA *tok_end,
- int mi_row, int mi_col, BLOCK_SIZE bsize) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
-
- const int bsl = b_width_log2(bsize);
- const int bs = (1 << bsl) / 4;
- PARTITION_TYPE partition;
- BLOCK_SIZE subsize;
- MODE_INFO *m = cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col];
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- partition = partition_lookup[bsl][m->mbmi.sb_type];
- write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w);
- subsize = get_subsize(bsize, partition);
- if (subsize < BLOCK_8X8) {
- write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
- } else {
- switch (partition) {
- case PARTITION_NONE:
- write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
- break;
- case PARTITION_HORZ:
- write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
- if (mi_row + bs < cm->mi_rows)
- write_modes_b(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col);
- break;
- case PARTITION_VERT:
- write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
- if (mi_col + bs < cm->mi_cols)
- write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col + bs);
- break;
- case PARTITION_SPLIT:
- write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, subsize);
- write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col + bs,
- subsize);
- write_modes_sb(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col,
- subsize);
- write_modes_sb(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col + bs,
- subsize);
- break;
- default:
- assert(0);
- }
- }
-
- // update partition context
- if (bsize >= BLOCK_8X8 &&
- (bsize == BLOCK_8X8 || partition != PARTITION_SPLIT))
- update_partition_context(xd, mi_row, mi_col, subsize, bsize);
-}
-
-static void write_modes(VP9_COMP *cpi,
- const TileInfo *const tile,
- vp9_writer *w, TOKENEXTRA **tok, TOKENEXTRA *tok_end) {
- int mi_row, mi_col;
-
- for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end;
- mi_row += MI_BLOCK_SIZE) {
- vp9_zero(cpi->mb.e_mbd.left_seg_context);
- for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
- mi_col += MI_BLOCK_SIZE)
- write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col,
- BLOCK_64X64);
- }
-}
-
-static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE tx_size,
- vp9_coeff_stats *coef_branch_ct) {
- vp9_coeff_probs_model *coef_probs = cpi->frame_coef_probs[tx_size];
- vp9_coeff_count *coef_counts = cpi->coef_counts[tx_size];
- unsigned int (*eob_branch_ct)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
- cpi->common.counts.eob_branch[tx_size];
- int i, j, k, l, m;
-
- 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) {
- vp9_tree_probs_from_distribution(vp9_coef_tree,
- coef_branch_ct[i][j][k][l],
- coef_counts[i][j][k][l]);
- coef_branch_ct[i][j][k][l][0][1] = eob_branch_ct[i][j][k][l] -
- coef_branch_ct[i][j][k][l][0][0];
- for (m = 0; m < UNCONSTRAINED_NODES; ++m)
- coef_probs[i][j][k][l][m] = get_binary_prob(
- coef_branch_ct[i][j][k][l][m][0],
- coef_branch_ct[i][j][k][l][m][1]);
- }
- }
- }
- }
-}
-
-static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
- TX_SIZE tx_size,
- vp9_coeff_stats *frame_branch_ct) {
- vp9_coeff_probs_model *new_frame_coef_probs = cpi->frame_coef_probs[tx_size];
- vp9_coeff_probs_model *old_frame_coef_probs =
- cpi->common.fc.coef_probs[tx_size];
- const vp9_prob upd = DIFF_UPDATE_PROB;
- const int entropy_nodes_update = UNCONSTRAINED_NODES;
- int i, j, k, l, t;
- switch (cpi->sf.use_fast_coef_updates) {
- case 0: {
- /* dry run to see if there is any udpate 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_update; ++t) {
- vp9_prob newp = new_frame_coef_probs[i][j][k][l][t];
- const vp9_prob oldp = old_frame_coef_probs[i][j][k][l][t];
- int s;
- int u = 0;
- if (t == PIVOT_NODE)
- s = vp9_prob_diff_update_savings_search_model(
- frame_branch_ct[i][j][k][l][0],
- old_frame_coef_probs[i][j][k][l], &newp, upd);
- else
- s = vp9_prob_diff_update_savings_search(
- frame_branch_ct[i][j][k][l][t], oldp, &newp, upd);
- if (s > 0 && newp != oldp)
- u = 1;
- if (u)
- savings += s - (int)(vp9_cost_zero(upd));
- else
- savings -= (int)(vp9_cost_zero(upd));
- update[u]++;
- }
- }
- }
- }
- }
-
- // printf("Update %d %d, savings %d\n", update[0], update[1], savings);
- /* Is coef updated at all */
- if (update[1] == 0 || savings < 0) {
- vp9_write_bit(bc, 0);
- return;
- }
- vp9_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) {
- // calc probs and branch cts for this frame only
- for (t = 0; t < entropy_nodes_update; ++t) {
- vp9_prob newp = new_frame_coef_probs[i][j][k][l][t];
- vp9_prob *oldp = old_frame_coef_probs[i][j][k][l] + t;
- const vp9_prob upd = DIFF_UPDATE_PROB;
- int s;
- int u = 0;
- if (t == PIVOT_NODE)
- s = vp9_prob_diff_update_savings_search_model(
- frame_branch_ct[i][j][k][l][0],
- old_frame_coef_probs[i][j][k][l], &newp, upd);
- else
- s = vp9_prob_diff_update_savings_search(
- frame_branch_ct[i][j][k][l][t],
- *oldp, &newp, upd);
- if (s > 0 && newp != *oldp)
- u = 1;
- vp9_write(bc, u, upd);
- if (u) {
- /* send/use new probability */
- vp9_write_prob_diff_update(bc, newp, *oldp);
- *oldp = newp;
- }
- }
- }
- }
- }
- }
- return;
- }
-
- case 1:
- case 2: {
- const int prev_coef_contexts_to_update =
- cpi->sf.use_fast_coef_updates == 2 ? COEFF_CONTEXTS >> 1
- : COEFF_CONTEXTS;
- const int coef_band_to_update =
- cpi->sf.use_fast_coef_updates == 2 ? COEF_BANDS >> 1
- : COEF_BANDS;
- 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) {
- // calc probs and branch cts for this frame only
- for (t = 0; t < entropy_nodes_update; ++t) {
- vp9_prob newp = new_frame_coef_probs[i][j][k][l][t];
- vp9_prob *oldp = old_frame_coef_probs[i][j][k][l] + t;
- int s;
- int u = 0;
- if (l >= prev_coef_contexts_to_update ||
- k >= coef_band_to_update) {
- u = 0;
- } else {
- if (t == PIVOT_NODE)
- s = vp9_prob_diff_update_savings_search_model(
- frame_branch_ct[i][j][k][l][0],
- old_frame_coef_probs[i][j][k][l], &newp, upd);
- else
- s = vp9_prob_diff_update_savings_search(
- frame_branch_ct[i][j][k][l][t],
- *oldp, &newp, upd);
- 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
- vp9_write_bit(bc, 1);
- for (v = 0; v < noupdates_before_first; ++v)
- vp9_write(bc, 0, upd);
- }
- vp9_write(bc, u, upd);
- if (u) {
- /* send/use new probability */
- vp9_write_prob_diff_update(bc, newp, *oldp);
- *oldp = newp;
- }
- }
- }
- }
- }
- }
- if (updates == 0) {
- vp9_write_bit(bc, 0); // no updates
- }
- return;
- }
-
- default:
- assert(0);
- }
-}
-
-static void update_coef_probs(VP9_COMP *cpi, vp9_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;
- vp9_coeff_stats frame_branch_ct[TX_SIZES][PLANE_TYPES];
-
- vp9_clear_system_state();
-
- for (tx_size = TX_4X4; tx_size <= TX_32X32; ++tx_size)
- build_tree_distribution(cpi, tx_size, frame_branch_ct[tx_size]);
-
- for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
- update_coef_probs_common(w, cpi, tx_size, frame_branch_ct[tx_size]);
-}
-
-static void encode_loopfilter(struct loopfilter *lf,
- struct vp9_write_bit_buffer *wb) {
- int i;
-
- // Encode the loop filter level and type
- vp9_wb_write_literal(wb, lf->filter_level, 6);
- vp9_wb_write_literal(wb, lf->sharpness_level, 3);
-
- // Write out loop filter deltas applied at the MB level based on mode or
- // ref frame (if they are enabled).
- vp9_wb_write_bit(wb, lf->mode_ref_delta_enabled);
-
- if (lf->mode_ref_delta_enabled) {
- vp9_wb_write_bit(wb, lf->mode_ref_delta_update);
- if (lf->mode_ref_delta_update) {
- for (i = 0; i < MAX_REF_LF_DELTAS; i++) {
- const int delta = lf->ref_deltas[i];
- const int changed = delta != lf->last_ref_deltas[i];
- vp9_wb_write_bit(wb, changed);
- if (changed) {
- lf->last_ref_deltas[i] = delta;
- vp9_wb_write_literal(wb, abs(delta) & 0x3F, 6);
- vp9_wb_write_bit(wb, delta < 0);
- }
- }
-
- for (i = 0; i < MAX_MODE_LF_DELTAS; i++) {
- const int delta = lf->mode_deltas[i];
- const int changed = delta != lf->last_mode_deltas[i];
- vp9_wb_write_bit(wb, changed);
- if (changed) {
- lf->last_mode_deltas[i] = delta;
- vp9_wb_write_literal(wb, abs(delta) & 0x3F, 6);
- vp9_wb_write_bit(wb, delta < 0);
- }
- }
- }
- }
-}
-
-static void write_delta_q(struct vp9_write_bit_buffer *wb, int delta_q) {
- if (delta_q != 0) {
- vp9_wb_write_bit(wb, 1);
- vp9_wb_write_literal(wb, abs(delta_q), 4);
- vp9_wb_write_bit(wb, delta_q < 0);
- } else {
- vp9_wb_write_bit(wb, 0);
- }
-}
-
-static void encode_quantization(VP9_COMMON *cm,
- struct vp9_write_bit_buffer *wb) {
- vp9_wb_write_literal(wb, cm->base_qindex, QINDEX_BITS);
- write_delta_q(wb, cm->y_dc_delta_q);
- write_delta_q(wb, cm->uv_dc_delta_q);
- write_delta_q(wb, cm->uv_ac_delta_q);
-}
-
-
-static void encode_segmentation(VP9_COMP *cpi,
- struct vp9_write_bit_buffer *wb) {
- int i, j;
-
- struct segmentation *seg = &cpi->common.seg;
-
- vp9_wb_write_bit(wb, seg->enabled);
- if (!seg->enabled)
- return;
-
- // Segmentation map
- vp9_wb_write_bit(wb, seg->update_map);
- if (seg->update_map) {
- // Select the coding strategy (temporal or spatial)
- vp9_choose_segmap_coding_method(cpi);
- // Write out probabilities used to decode unpredicted macro-block segments
- for (i = 0; i < SEG_TREE_PROBS; i++) {
- const int prob = seg->tree_probs[i];
- const int update = prob != MAX_PROB;
- vp9_wb_write_bit(wb, update);
- if (update)
- vp9_wb_write_literal(wb, prob, 8);
- }
-
- // Write out the chosen coding method.
- vp9_wb_write_bit(wb, seg->temporal_update);
- if (seg->temporal_update) {
- for (i = 0; i < PREDICTION_PROBS; i++) {
- const int prob = seg->pred_probs[i];
- const int update = prob != MAX_PROB;
- vp9_wb_write_bit(wb, update);
- if (update)
- vp9_wb_write_literal(wb, prob, 8);
- }
- }
- }
-
- // Segmentation data
- vp9_wb_write_bit(wb, seg->update_data);
- if (seg->update_data) {
- vp9_wb_write_bit(wb, seg->abs_delta);
-
- for (i = 0; i < MAX_SEGMENTS; i++) {
- for (j = 0; j < SEG_LVL_MAX; j++) {
- const int active = vp9_segfeature_active(seg, i, j);
- vp9_wb_write_bit(wb, active);
- if (active) {
- const int data = vp9_get_segdata(seg, i, j);
- const int data_max = vp9_seg_feature_data_max(j);
-
- if (vp9_is_segfeature_signed(j)) {
- encode_unsigned_max(wb, abs(data), data_max);
- vp9_wb_write_bit(wb, data < 0);
- } else {
- encode_unsigned_max(wb, data, data_max);
- }
- }
- }
- }
- }
-}
-
-
-static void encode_txfm_probs(VP9_COMMON *cm, vp9_writer *w) {
- // Mode
- vp9_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2);
- if (cm->tx_mode >= ALLOW_32X32)
- vp9_write_bit(w, cm->tx_mode == TX_MODE_SELECT);
-
- // Probabilities
- if (cm->tx_mode == TX_MODE_SELECT) {
- int i, j;
- unsigned int ct_8x8p[TX_SIZES - 3][2];
- unsigned int ct_16x16p[TX_SIZES - 2][2];
- unsigned int ct_32x32p[TX_SIZES - 1][2];
-
-
- for (i = 0; i < TX_SIZE_CONTEXTS; i++) {
- tx_counts_to_branch_counts_8x8(cm->counts.tx.p8x8[i], ct_8x8p);
- for (j = 0; j < TX_SIZES - 3; j++)
- vp9_cond_prob_diff_update(w, &cm->fc.tx_probs.p8x8[i][j], ct_8x8p[j]);
- }
-
- for (i = 0; i < TX_SIZE_CONTEXTS; i++) {
- tx_counts_to_branch_counts_16x16(cm->counts.tx.p16x16[i], ct_16x16p);
- for (j = 0; j < TX_SIZES - 2; j++)
- vp9_cond_prob_diff_update(w, &cm->fc.tx_probs.p16x16[i][j],
- ct_16x16p[j]);
- }
-
- for (i = 0; i < TX_SIZE_CONTEXTS; i++) {
- tx_counts_to_branch_counts_32x32(cm->counts.tx.p32x32[i], ct_32x32p);
- for (j = 0; j < TX_SIZES - 1; j++)
- vp9_cond_prob_diff_update(w, &cm->fc.tx_probs.p32x32[i][j],
- ct_32x32p[j]);
- }
- }
-}
-
-static void write_interp_filter(INTERP_FILTER filter,
- struct vp9_write_bit_buffer *wb) {
- const int filter_to_literal[] = { 1, 0, 2, 3 };
-
- vp9_wb_write_bit(wb, filter == SWITCHABLE);
- if (filter != SWITCHABLE)
- vp9_wb_write_literal(wb, filter_to_literal[filter], 2);
-}
-
-static void fix_interp_filter(VP9_COMMON *cm) {
- if (cm->interp_filter == SWITCHABLE) {
- // Check to see if only one of the filters is actually used
- int count[SWITCHABLE_FILTERS];
- int i, j, c = 0;
- for (i = 0; i < SWITCHABLE_FILTERS; ++i) {
- count[i] = 0;
- for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
- count[i] += cm->counts.switchable_interp[j][i];
- c += (count[i] > 0);
- }
- if (c == 1) {
- // Only one filter is used. So set the filter at frame level
- for (i = 0; i < SWITCHABLE_FILTERS; ++i) {
- if (count[i]) {
- cm->interp_filter = i;
- break;
- }
- }
- }
- }
-}
-
-static void write_tile_info(VP9_COMMON *cm, struct vp9_write_bit_buffer *wb) {
- int min_log2_tile_cols, max_log2_tile_cols, ones;
- vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
-
- // columns
- ones = cm->log2_tile_cols - min_log2_tile_cols;
- while (ones--)
- vp9_wb_write_bit(wb, 1);
-
- if (cm->log2_tile_cols < max_log2_tile_cols)
- vp9_wb_write_bit(wb, 0);
-
- // rows
- vp9_wb_write_bit(wb, cm->log2_tile_rows != 0);
- if (cm->log2_tile_rows != 0)
- vp9_wb_write_bit(wb, cm->log2_tile_rows != 1);
-}
-
-static int get_refresh_mask(VP9_COMP *cpi) {
- // Should the GF or ARF be updated using the transmitted frame or buffer
-#if CONFIG_MULTIPLE_ARF
- if (!cpi->multi_arf_enabled && cpi->refresh_golden_frame &&
- !cpi->refresh_alt_ref_frame) {
-#else
- if (cpi->refresh_golden_frame && !cpi->refresh_alt_ref_frame &&
- !cpi->use_svc) {
-#endif
- // Preserve the previously existing golden frame and update the frame in
- // the alt ref slot instead. This is highly specific to the use of
- // alt-ref as a forward reference, and this needs to be generalized as
- // other uses are implemented (like RTC/temporal scaling)
- //
- // gld_fb_idx and alt_fb_idx need to be swapped for future frames, but
- // that happens in vp9_onyx_if.c:update_reference_frames() so that it can
- // be done outside of the recode loop.
- return (cpi->refresh_last_frame << cpi->lst_fb_idx) |
- (cpi->refresh_golden_frame << cpi->alt_fb_idx);
- } else {
- int arf_idx = cpi->alt_fb_idx;
-#if CONFIG_MULTIPLE_ARF
- // Determine which ARF buffer to use to encode this ARF frame.
- if (cpi->multi_arf_enabled) {
- int sn = cpi->sequence_number;
- arf_idx = (cpi->frame_coding_order[sn] < 0) ?
- cpi->arf_buffer_idx[sn + 1] :
- cpi->arf_buffer_idx[sn];
- }
-#endif
- return (cpi->refresh_last_frame << cpi->lst_fb_idx) |
- (cpi->refresh_golden_frame << cpi->gld_fb_idx) |
- (cpi->refresh_alt_ref_frame << arf_idx);
- }
-}
-
-static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) {
- VP9_COMMON *const cm = &cpi->common;
- vp9_writer residual_bc;
-
- int tile_row, tile_col;
- TOKENEXTRA *tok[4][1 << 6], *tok_end;
- size_t total_size = 0;
- const int tile_cols = 1 << cm->log2_tile_cols;
- const int tile_rows = 1 << cm->log2_tile_rows;
-
- vpx_memset(cm->above_seg_context, 0, sizeof(*cm->above_seg_context) *
- mi_cols_aligned_to_sb(cm->mi_cols));
-
- tok[0][0] = cpi->tok;
- for (tile_row = 0; tile_row < tile_rows; tile_row++) {
- if (tile_row)
- tok[tile_row][0] = tok[tile_row - 1][tile_cols - 1] +
- cpi->tok_count[tile_row - 1][tile_cols - 1];
-
- for (tile_col = 1; tile_col < tile_cols; tile_col++)
- tok[tile_row][tile_col] = tok[tile_row][tile_col - 1] +
- cpi->tok_count[tile_row][tile_col - 1];
- }
-
- for (tile_row = 0; tile_row < tile_rows; tile_row++) {
- for (tile_col = 0; tile_col < tile_cols; tile_col++) {
- TileInfo tile;
-
- vp9_tile_init(&tile, cm, tile_row, tile_col);
- tok_end = tok[tile_row][tile_col] + cpi->tok_count[tile_row][tile_col];
-
- if (tile_col < tile_cols - 1 || tile_row < tile_rows - 1)
- vp9_start_encode(&residual_bc, data_ptr + total_size + 4);
- else
- vp9_start_encode(&residual_bc, data_ptr + total_size);
-
- write_modes(cpi, &tile, &residual_bc, &tok[tile_row][tile_col], tok_end);
- assert(tok[tile_row][tile_col] == tok_end);
- vp9_stop_encode(&residual_bc);
- if (tile_col < tile_cols - 1 || tile_row < tile_rows - 1) {
- // size of this tile
- mem_put_be32(data_ptr + total_size, residual_bc.pos);
- total_size += 4;
- }
-
- total_size += residual_bc.pos;
- }
- }
-
- return total_size;
-}
-
-static void write_display_size(const VP9_COMMON *cm,
- struct vp9_write_bit_buffer *wb) {
- const int scaling_active = cm->width != cm->display_width ||
- cm->height != cm->display_height;
- vp9_wb_write_bit(wb, scaling_active);
- if (scaling_active) {
- vp9_wb_write_literal(wb, cm->display_width - 1, 16);
- vp9_wb_write_literal(wb, cm->display_height - 1, 16);
- }
-}
-
-static void write_frame_size(const VP9_COMMON *cm,
- struct vp9_write_bit_buffer *wb) {
- vp9_wb_write_literal(wb, cm->width - 1, 16);
- vp9_wb_write_literal(wb, cm->height - 1, 16);
-
- write_display_size(cm, wb);
-}
-
-static void write_frame_size_with_refs(VP9_COMP *cpi,
- struct vp9_write_bit_buffer *wb) {
- VP9_COMMON *const cm = &cpi->common;
- int found = 0;
-
- MV_REFERENCE_FRAME ref_frame;
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
- YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, ref_frame);
- found = cm->width == cfg->y_crop_width &&
- cm->height == cfg->y_crop_height;
-
- // TODO(ivan): This prevents a bug while more than 3 buffers are used. Do it
- // in a better way.
- if (cpi->use_svc) {
- found = 0;
- }
- vp9_wb_write_bit(wb, found);
- if (found) {
- break;
- }
- }
-
- if (!found) {
- vp9_wb_write_literal(wb, cm->width - 1, 16);
- vp9_wb_write_literal(wb, cm->height - 1, 16);
- }
-
- write_display_size(cm, wb);
-}
-
-static void write_sync_code(struct vp9_write_bit_buffer *wb) {
- vp9_wb_write_literal(wb, VP9_SYNC_CODE_0, 8);
- vp9_wb_write_literal(wb, VP9_SYNC_CODE_1, 8);
- vp9_wb_write_literal(wb, VP9_SYNC_CODE_2, 8);
-}
-
-static void write_uncompressed_header(VP9_COMP *cpi,
- struct vp9_write_bit_buffer *wb) {
- VP9_COMMON *const cm = &cpi->common;
-
- vp9_wb_write_literal(wb, VP9_FRAME_MARKER, 2);
-
- // bitstream version.
- // 00 - profile 0. 4:2:0 only
- // 10 - profile 1. adds 4:4:4, 4:2:2, alpha
- vp9_wb_write_bit(wb, cm->version);
- vp9_wb_write_bit(wb, 0);
-
- vp9_wb_write_bit(wb, 0);
- vp9_wb_write_bit(wb, cm->frame_type);
- vp9_wb_write_bit(wb, cm->show_frame);
- vp9_wb_write_bit(wb, cm->error_resilient_mode);
-
- if (cm->frame_type == KEY_FRAME) {
- const COLOR_SPACE cs = UNKNOWN;
- write_sync_code(wb);
- vp9_wb_write_literal(wb, cs, 3);
- if (cs != SRGB) {
- vp9_wb_write_bit(wb, 0); // 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
- if (cm->version == 1) {
- vp9_wb_write_bit(wb, cm->subsampling_x);
- vp9_wb_write_bit(wb, cm->subsampling_y);
- vp9_wb_write_bit(wb, 0); // has extra plane
- }
- } else {
- assert(cm->version == 1);
- vp9_wb_write_bit(wb, 0); // has extra plane
- }
-
- write_frame_size(cm, wb);
- } else {
- if (!cm->show_frame)
- vp9_wb_write_bit(wb, cm->intra_only);
-
- if (!cm->error_resilient_mode)
- vp9_wb_write_literal(wb, cm->reset_frame_context, 2);
-
- if (cm->intra_only) {
- write_sync_code(wb);
-
- vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
- write_frame_size(cm, wb);
- } else {
- MV_REFERENCE_FRAME ref_frame;
- vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
- vp9_wb_write_literal(wb, get_ref_frame_idx(cpi, ref_frame),
- REF_FRAMES_LOG2);
- vp9_wb_write_bit(wb, cm->ref_frame_sign_bias[ref_frame]);
- }
-
- write_frame_size_with_refs(cpi, wb);
-
- vp9_wb_write_bit(wb, cm->allow_high_precision_mv);
-
- fix_interp_filter(cm);
- write_interp_filter(cm->interp_filter, wb);
- }
- }
-
- if (!cm->error_resilient_mode) {
- vp9_wb_write_bit(wb, cm->refresh_frame_context);
- vp9_wb_write_bit(wb, cm->frame_parallel_decoding_mode);
- }
-
- vp9_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
-
- encode_loopfilter(&cm->lf, wb);
- encode_quantization(cm, wb);
- encode_segmentation(cpi, wb);
-
- write_tile_info(cm, wb);
-}
-
-static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- FRAME_CONTEXT *const fc = &cm->fc;
- vp9_writer header_bc;
-
- vp9_start_encode(&header_bc, data);
-
- if (xd->lossless)
- cm->tx_mode = ONLY_4X4;
- else
- encode_txfm_probs(cm, &header_bc);
-
- update_coef_probs(cpi, &header_bc);
- update_skip_probs(cm, &header_bc);
-
- if (!frame_is_intra_only(cm)) {
- int i;
-
- for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
- prob_diff_update(vp9_inter_mode_tree, cm->fc.inter_mode_probs[i],
- cm->counts.inter_mode[i], INTER_MODES, &header_bc);
-
- vp9_zero(cm->counts.inter_mode);
-
- if (cm->interp_filter == SWITCHABLE)
- update_switchable_interp_probs(cm, &header_bc);
-
- for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
- vp9_cond_prob_diff_update(&header_bc, &fc->intra_inter_prob[i],
- cm->counts.intra_inter[i]);
-
- if (cm->allow_comp_inter_inter) {
- const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
- const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
-
- vp9_write_bit(&header_bc, use_compound_pred);
- if (use_compound_pred) {
- vp9_write_bit(&header_bc, use_hybrid_pred);
- if (use_hybrid_pred)
- for (i = 0; i < COMP_INTER_CONTEXTS; i++)
- vp9_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
- cm->counts.comp_inter[i]);
- }
- }
-
- if (cm->reference_mode != COMPOUND_REFERENCE) {
- for (i = 0; i < REF_CONTEXTS; i++) {
- vp9_cond_prob_diff_update(&header_bc, &fc->single_ref_prob[i][0],
- cm->counts.single_ref[i][0]);
- vp9_cond_prob_diff_update(&header_bc, &fc->single_ref_prob[i][1],
- cm->counts.single_ref[i][1]);
- }
- }
-
- if (cm->reference_mode != SINGLE_REFERENCE)
- for (i = 0; i < REF_CONTEXTS; i++)
- vp9_cond_prob_diff_update(&header_bc, &fc->comp_ref_prob[i],
- cm->counts.comp_ref[i]);
-
- for (i = 0; i < BLOCK_SIZE_GROUPS; ++i)
- prob_diff_update(vp9_intra_mode_tree, cm->fc.y_mode_prob[i],
- cm->counts.y_mode[i], INTRA_MODES, &header_bc);
-
- for (i = 0; i < PARTITION_CONTEXTS; ++i)
- prob_diff_update(vp9_partition_tree, fc->partition_prob[i],
- cm->counts.partition[i], PARTITION_TYPES, &header_bc);
-
- vp9_write_nmv_probs(cm, cm->allow_high_precision_mv, &header_bc);
- }
-
- vp9_stop_encode(&header_bc);
- assert(header_bc.pos <= 0xffff);
-
- return header_bc.pos;
-}
-
-void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size) {
- uint8_t *data = dest;
- size_t first_part_size, uncompressed_hdr_size;
- struct vp9_write_bit_buffer wb = {data, 0};
- struct vp9_write_bit_buffer saved_wb;
-
- write_uncompressed_header(cpi, &wb);
- saved_wb = wb;
- vp9_wb_write_literal(&wb, 0, 16); // don't know in advance first part. size
-
- uncompressed_hdr_size = vp9_rb_bytes_written(&wb);
- data += uncompressed_hdr_size;
-
- vp9_compute_update_table();
-
- vp9_clear_system_state();
-
- first_part_size = write_compressed_header(cpi, data);
- data += first_part_size;
- // TODO(jbb): Figure out what to do if first_part_size > 16 bits.
- vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16);
-
- data += encode_tiles(cpi, data);
-
- *size = data - dest;
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.h
deleted file mode 100644
index ddfd0ed..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_bitstream.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_BITSTREAM_H_
-#define VP9_ENCODER_VP9_BITSTREAM_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct VP9_COMP;
-
-void vp9_entropy_mode_init();
-
-void vp9_pack_bitstream(struct VP9_COMP *cpi, uint8_t *dest, size_t *size);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_BITSTREAM_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_block.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_block.h
deleted file mode 100644
index 7729d84..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_block.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_BLOCK_H_
-#define VP9_ENCODER_VP9_BLOCK_H_
-
-#include "vp9/common/vp9_entropymv.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// motion search site
-typedef struct {
- MV mv;
- int offset;
-} search_site;
-
-// Structure to hold snapshot of coding context during the mode picking process
-typedef struct {
- MODE_INFO mic;
- uint8_t *zcoeff_blk;
- int16_t *coeff[MAX_MB_PLANE][3];
- int16_t *qcoeff[MAX_MB_PLANE][3];
- int16_t *dqcoeff[MAX_MB_PLANE][3];
- uint16_t *eobs[MAX_MB_PLANE][3];
-
- // dual buffer pointers, 0: in use, 1: best in store
- int16_t *coeff_pbuf[MAX_MB_PLANE][3];
- int16_t *qcoeff_pbuf[MAX_MB_PLANE][3];
- int16_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
- uint16_t *eobs_pbuf[MAX_MB_PLANE][3];
-
- int is_coded;
- int num_4x4_blk;
- int skip;
- int_mv best_ref_mv[2];
- int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
- int rate;
- int distortion;
- int best_mode_index;
- int rddiv;
- int rdmult;
- int hybrid_pred_diff;
- int comp_pred_diff;
- int single_pred_diff;
- int64_t tx_rd_diff[TX_MODES];
- int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
-
- // motion vector cache for adaptive motion search control in partition
- // search loop
- int_mv pred_mv[MAX_REF_FRAMES];
- INTERP_FILTER pred_interp_filter;
-} PICK_MODE_CONTEXT;
-
-struct macroblock_plane {
- DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]);
- int16_t *qcoeff;
- int16_t *coeff;
- uint16_t *eobs;
- struct buf_2d src;
-
- // Quantizer setings
- int16_t *quant;
- int16_t *quant_shift;
- int16_t *zbin;
- int16_t *round;
-
- // Zbin Over Quant value
- int16_t zbin_extra;
-};
-
-/* The [2] dimension is for whether we skip the EOB node (i.e. if previous
- * coefficient in this block was zero) or not. */
-typedef unsigned int vp9_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][2]
- [COEFF_CONTEXTS][ENTROPY_TOKENS];
-
-typedef struct macroblock MACROBLOCK;
-struct macroblock {
- struct macroblock_plane plane[MAX_MB_PLANE];
-
- MACROBLOCKD e_mbd;
- int skip_block;
- int select_txfm_size;
- int skip_recode;
- int skip_optimize;
- int q_index;
-
- search_site *ss;
- int ss_count;
- int searches_per_step;
-
- int errorperbit;
- int sadperbit16;
- int sadperbit4;
- int rddiv;
- int rdmult;
- unsigned int mb_energy;
- unsigned int *mb_activity_ptr;
- int *mb_norm_activity_ptr;
- signed int act_zbin_adj;
-
- int mv_best_ref_index[MAX_REF_FRAMES];
- unsigned int max_mv_context[MAX_REF_FRAMES];
- unsigned int source_variance;
- unsigned int pred_sse[MAX_REF_FRAMES];
- int pred_mv_sad[MAX_REF_FRAMES];
-
- int nmvjointcost[MV_JOINTS];
- int nmvcosts[2][MV_VALS];
- int *nmvcost[2];
- int nmvcosts_hp[2][MV_VALS];
- int *nmvcost_hp[2];
- int **mvcost;
-
- int nmvjointsadcost[MV_JOINTS];
- int nmvsadcosts[2][MV_VALS];
- int *nmvsadcost[2];
- int nmvsadcosts_hp[2][MV_VALS];
- int *nmvsadcost_hp[2];
- int **mvsadcost;
-
- int mbmode_cost[INTRA_MODES];
- unsigned inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES];
- int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES];
- int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
- int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
-
- unsigned char sb_index; // index of 32x32 block inside the 64x64 block
- unsigned char mb_index; // index of 16x16 block inside the 32x32 block
- unsigned char b_index; // index of 8x8 block inside the 16x16 block
- unsigned char ab_index; // index of 4x4 block inside the 8x8 block
-
- // These define limits to motion vector components to prevent them
- // from extending outside the UMV borders
- int mv_col_min;
- int mv_col_max;
- int mv_row_min;
- int mv_row_max;
-
- uint8_t zcoeff_blk[TX_SIZES][256];
- int skip;
-
- int encode_breakout;
-
- int in_active_map;
-
- // note that token_costs is the cost when eob node is skipped
- vp9_coeff_cost token_costs[TX_SIZES];
-
- int optimize;
-
- // indicate if it is in the rd search loop or encoding process
- int use_lp32x32fdct;
- int skip_encode;
-
- // Used to store sub partition's choices.
- int_mv pred_mv[MAX_REF_FRAMES];
-
- // TODO(jingning): Need to refactor the structure arrays that buffers the
- // coding mode decisions of each partition type.
- PICK_MODE_CONTEXT ab4x4_context[4][4][4];
- PICK_MODE_CONTEXT sb8x4_context[4][4][4];
- PICK_MODE_CONTEXT sb4x8_context[4][4][4];
- PICK_MODE_CONTEXT sb8x8_context[4][4][4];
- PICK_MODE_CONTEXT sb8x16_context[4][4][2];
- PICK_MODE_CONTEXT sb16x8_context[4][4][2];
- PICK_MODE_CONTEXT mb_context[4][4];
- PICK_MODE_CONTEXT sb32x16_context[4][2];
- PICK_MODE_CONTEXT sb16x32_context[4][2];
- // when 4 MBs share coding parameters:
- PICK_MODE_CONTEXT sb32_context[4];
- PICK_MODE_CONTEXT sb32x64_context[2];
- PICK_MODE_CONTEXT sb64x32_context[2];
- PICK_MODE_CONTEXT sb64_context;
- int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
-
- BLOCK_SIZE b_partitioning[4][4][4];
- BLOCK_SIZE mb_partitioning[4][4];
- BLOCK_SIZE sb_partitioning[4];
- BLOCK_SIZE sb64_partitioning;
-
- void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride);
-};
-
-// TODO(jingning): the variables used here are little complicated. need further
-// refactoring on organizing the temporary buffers, when recursive
-// partition down to 4x4 block size is enabled.
-static INLINE PICK_MODE_CONTEXT *get_block_context(MACROBLOCK *x,
- BLOCK_SIZE bsize) {
- switch (bsize) {
- case BLOCK_64X64:
- return &x->sb64_context;
- case BLOCK_64X32:
- return &x->sb64x32_context[x->sb_index];
- case BLOCK_32X64:
- return &x->sb32x64_context[x->sb_index];
- case BLOCK_32X32:
- return &x->sb32_context[x->sb_index];
- case BLOCK_32X16:
- return &x->sb32x16_context[x->sb_index][x->mb_index];
- case BLOCK_16X32:
- return &x->sb16x32_context[x->sb_index][x->mb_index];
- case BLOCK_16X16:
- return &x->mb_context[x->sb_index][x->mb_index];
- case BLOCK_16X8:
- return &x->sb16x8_context[x->sb_index][x->mb_index][x->b_index];
- case BLOCK_8X16:
- return &x->sb8x16_context[x->sb_index][x->mb_index][x->b_index];
- case BLOCK_8X8:
- return &x->sb8x8_context[x->sb_index][x->mb_index][x->b_index];
- case BLOCK_8X4:
- return &x->sb8x4_context[x->sb_index][x->mb_index][x->b_index];
- case BLOCK_4X8:
- return &x->sb4x8_context[x->sb_index][x->mb_index][x->b_index];
- case BLOCK_4X4:
- return &x->ab4x4_context[x->sb_index][x->mb_index][x->b_index];
- default:
- assert(0);
- return NULL;
- }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_BLOCK_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.c
deleted file mode 100644
index 1c3c3d2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/encoder/vp9_cost.h"
-
-const unsigned int vp9_prob_cost[256] = {
- 2047, 2047, 1791, 1641, 1535, 1452, 1385, 1328, 1279, 1235, 1196, 1161,
- 1129, 1099, 1072, 1046, 1023, 1000, 979, 959, 940, 922, 905, 889,
- 873, 858, 843, 829, 816, 803, 790, 778, 767, 755, 744, 733,
- 723, 713, 703, 693, 684, 675, 666, 657, 649, 641, 633, 625,
- 617, 609, 602, 594, 587, 580, 573, 567, 560, 553, 547, 541,
- 534, 528, 522, 516, 511, 505, 499, 494, 488, 483, 477, 472,
- 467, 462, 457, 452, 447, 442, 437, 433, 428, 424, 419, 415,
- 410, 406, 401, 397, 393, 389, 385, 381, 377, 373, 369, 365,
- 361, 357, 353, 349, 346, 342, 338, 335, 331, 328, 324, 321,
- 317, 314, 311, 307, 304, 301, 297, 294, 291, 288, 285, 281,
- 278, 275, 272, 269, 266, 263, 260, 257, 255, 252, 249, 246,
- 243, 240, 238, 235, 232, 229, 227, 224, 221, 219, 216, 214,
- 211, 208, 206, 203, 201, 198, 196, 194, 191, 189, 186, 184,
- 181, 179, 177, 174, 172, 170, 168, 165, 163, 161, 159, 156,
- 154, 152, 150, 148, 145, 143, 141, 139, 137, 135, 133, 131,
- 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107,
- 105, 103, 101, 99, 97, 95, 93, 92, 90, 88, 86, 84,
- 82, 81, 79, 77, 75, 73, 72, 70, 68, 66, 65, 63,
- 61, 60, 58, 56, 55, 53, 51, 50, 48, 46, 45, 43,
- 41, 40, 38, 37, 35, 33, 32, 30, 29, 27, 25, 24,
- 22, 21, 19, 18, 16, 15, 13, 12, 10, 9, 7, 6,
- 4, 3, 1, 1};
-
-static void cost(int *costs, vp9_tree tree, const vp9_prob *probs,
- int i, int c) {
- const vp9_prob prob = probs[i / 2];
- int b;
-
- for (b = 0; b <= 1; ++b) {
- const int cc = c + vp9_cost_bit(prob, b);
- const vp9_tree_index ii = tree[i + b];
-
- if (ii <= 0)
- costs[-ii] = cc;
- else
- cost(costs, tree, probs, ii, cc);
- }
-}
-
-void vp9_cost_tokens(int *costs, const vp9_prob *probs, vp9_tree tree) {
- cost(costs, tree, probs, 0, 0);
-}
-
-void vp9_cost_tokens_skip(int *costs, const vp9_prob *probs, vp9_tree tree) {
- assert(tree[0] <= 0 && tree[1] > 0);
-
- costs[-tree[0]] = vp9_cost_bit(probs[0], 0);
- cost(costs, tree, probs, 2, 0);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.h
deleted file mode 100644
index 6d2b940..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_cost.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_COST_H_
-#define VP9_ENCODER_VP9_COST_H_
-
-#include "vp9/common/vp9_prob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const unsigned int vp9_prob_cost[256];
-
-#define vp9_cost_zero(prob) (vp9_prob_cost[prob])
-
-#define vp9_cost_one(prob) vp9_cost_zero(vp9_complement(prob))
-
-#define vp9_cost_bit(prob, bit) vp9_cost_zero((bit) ? vp9_complement(prob) \
- : (prob))
-
-static INLINE unsigned int cost_branch256(const unsigned int ct[2],
- vp9_prob p) {
- return ct[0] * vp9_cost_zero(p) + ct[1] * vp9_cost_one(p);
-}
-
-static INLINE int treed_cost(vp9_tree tree, const vp9_prob *probs,
- int bits, int len) {
- int cost = 0;
- vp9_tree_index i = 0;
-
- do {
- const int bit = (bits >> --len) & 1;
- cost += vp9_cost_bit(probs[i >> 1], bit);
- i = tree[i + bit];
- } while (len);
-
- return cost;
-}
-
-void vp9_cost_tokens(int *costs, const vp9_prob *probs, vp9_tree tree);
-void vp9_cost_tokens_skip(int *costs, const vp9_prob *probs, vp9_tree tree);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_COST_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_dct.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_dct.c
deleted file mode 100644
index d523239..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_dct.c
+++ /dev/null
@@ -1,1386 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <math.h>
-
-#include "./vpx_config.h"
-#include "./vp9_rtcd.h"
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-static INLINE int fdct_round_shift(int input) {
- int rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
- assert(INT16_MIN <= rv && rv <= INT16_MAX);
- return rv;
-}
-
-static void fdct4(const int16_t *input, int16_t *output) {
- int16_t step[4];
- int temp1, temp2;
-
- step[0] = input[0] + input[3];
- step[1] = input[1] + input[2];
- step[2] = input[1] - input[2];
- step[3] = input[0] - input[3];
-
- temp1 = (step[0] + step[1]) * cospi_16_64;
- temp2 = (step[0] - step[1]) * cospi_16_64;
- output[0] = fdct_round_shift(temp1);
- output[2] = fdct_round_shift(temp2);
- temp1 = step[2] * cospi_24_64 + step[3] * cospi_8_64;
- temp2 = -step[2] * cospi_8_64 + step[3] * cospi_24_64;
- output[1] = fdct_round_shift(temp1);
- output[3] = fdct_round_shift(temp2);
-}
-
-void vp9_fdct4x4_c(const int16_t *input, int16_t *output, int stride) {
- // The 2D transform is done with two passes which are actually pretty
- // similar. In the first one, we transform the columns and transpose
- // the results. In the second one, we transform the rows. To achieve that,
- // as the first pass results are transposed, we transpose the columns (that
- // is the transposed rows) and transpose the results (so that it goes back
- // in normal/row positions).
- int pass;
- // We need an intermediate buffer between passes.
- int16_t intermediate[4 * 4];
- const int16_t *in = input;
- int16_t *out = intermediate;
- // Do the two transform/transpose passes
- for (pass = 0; pass < 2; ++pass) {
- /*canbe16*/ int input[4];
- /*canbe16*/ int step[4];
- /*needs32*/ int temp1, temp2;
- int i;
- for (i = 0; i < 4; ++i) {
- // Load inputs.
- if (0 == pass) {
- input[0] = in[0 * stride] * 16;
- input[1] = in[1 * stride] * 16;
- input[2] = in[2 * stride] * 16;
- input[3] = in[3 * stride] * 16;
- if (i == 0 && input[0]) {
- input[0] += 1;
- }
- } else {
- input[0] = in[0 * 4];
- input[1] = in[1 * 4];
- input[2] = in[2 * 4];
- input[3] = in[3 * 4];
- }
- // Transform.
- step[0] = input[0] + input[3];
- step[1] = input[1] + input[2];
- step[2] = input[1] - input[2];
- step[3] = input[0] - input[3];
- temp1 = (step[0] + step[1]) * cospi_16_64;
- temp2 = (step[0] - step[1]) * cospi_16_64;
- out[0] = fdct_round_shift(temp1);
- out[2] = fdct_round_shift(temp2);
- temp1 = step[2] * cospi_24_64 + step[3] * cospi_8_64;
- temp2 = -step[2] * cospi_8_64 + step[3] * cospi_24_64;
- out[1] = fdct_round_shift(temp1);
- out[3] = fdct_round_shift(temp2);
- // Do next column (which is a transposed row in second/horizontal pass)
- in++;
- out += 4;
- }
- // Setup in/out for next pass.
- in = intermediate;
- out = output;
- }
-
- {
- int i, j;
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- output[j + i * 4] = (output[j + i * 4] + 1) >> 2;
- }
- }
-}
-
-static void fadst4(const int16_t *input, int16_t *output) {
- int x0, x1, x2, x3;
- int s0, s1, s2, s3, s4, s5, s6, s7;
-
- x0 = input[0];
- x1 = input[1];
- x2 = input[2];
- x3 = input[3];
-
- if (!(x0 | x1 | x2 | x3)) {
- output[0] = output[1] = output[2] = output[3] = 0;
- return;
- }
-
- s0 = sinpi_1_9 * x0;
- s1 = sinpi_4_9 * x0;
- s2 = sinpi_2_9 * x1;
- s3 = sinpi_1_9 * x1;
- s4 = sinpi_3_9 * x2;
- s5 = sinpi_4_9 * x3;
- s6 = sinpi_2_9 * x3;
- s7 = x0 + x1 - x3;
-
- x0 = s0 + s2 + s5;
- x1 = sinpi_3_9 * s7;
- x2 = s1 - s3 + s6;
- x3 = s4;
-
- s0 = x0 + x3;
- s1 = x1;
- s2 = x2 - x3;
- s3 = x2 - x0 + x3;
-
- // 1-D transform scaling factor is sqrt(2).
- output[0] = fdct_round_shift(s0);
- output[1] = fdct_round_shift(s1);
- output[2] = fdct_round_shift(s2);
- output[3] = fdct_round_shift(s3);
-}
-
-static const transform_2d FHT_4[] = {
- { fdct4, fdct4 }, // DCT_DCT = 0
- { fadst4, fdct4 }, // ADST_DCT = 1
- { fdct4, fadst4 }, // DCT_ADST = 2
- { fadst4, fadst4 } // ADST_ADST = 3
-};
-
-void vp9_fht4x4_c(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- if (tx_type == DCT_DCT) {
- vp9_fdct4x4_c(input, output, stride);
- } else {
- int16_t out[4 * 4];
- int16_t *outptr = &out[0];
- int i, j;
- int16_t temp_in[4], temp_out[4];
- const transform_2d ht = FHT_4[tx_type];
-
- // Columns
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- temp_in[j] = input[j * stride + i] * 16;
- if (i == 0 && temp_in[0])
- temp_in[0] += 1;
- ht.cols(temp_in, temp_out);
- for (j = 0; j < 4; ++j)
- outptr[j * 4 + i] = temp_out[j];
- }
-
- // Rows
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- temp_in[j] = out[j + i * 4];
- ht.rows(temp_in, temp_out);
- for (j = 0; j < 4; ++j)
- output[j + i * 4] = (temp_out[j] + 1) >> 2;
- }
- }
-}
-
-static void fdct8(const int16_t *input, int16_t *output) {
- /*canbe16*/ int s0, s1, s2, s3, s4, s5, s6, s7;
- /*needs32*/ int t0, t1, t2, t3;
- /*canbe16*/ int x0, x1, x2, x3;
-
- // stage 1
- s0 = input[0] + input[7];
- s1 = input[1] + input[6];
- s2 = input[2] + input[5];
- s3 = input[3] + input[4];
- s4 = input[3] - input[4];
- s5 = input[2] - input[5];
- s6 = input[1] - input[6];
- s7 = input[0] - input[7];
-
- // fdct4(step, step);
- x0 = s0 + s3;
- x1 = s1 + s2;
- x2 = s1 - s2;
- x3 = s0 - s3;
- t0 = (x0 + x1) * cospi_16_64;
- t1 = (x0 - x1) * cospi_16_64;
- t2 = x2 * cospi_24_64 + x3 * cospi_8_64;
- t3 = -x2 * cospi_8_64 + x3 * cospi_24_64;
- output[0] = fdct_round_shift(t0);
- output[2] = fdct_round_shift(t2);
- output[4] = fdct_round_shift(t1);
- output[6] = fdct_round_shift(t3);
-
- // Stage 2
- t0 = (s6 - s5) * cospi_16_64;
- t1 = (s6 + s5) * cospi_16_64;
- t2 = fdct_round_shift(t0);
- t3 = fdct_round_shift(t1);
-
- // Stage 3
- x0 = s4 + t2;
- x1 = s4 - t2;
- x2 = s7 - t3;
- x3 = s7 + t3;
-
- // Stage 4
- t0 = x0 * cospi_28_64 + x3 * cospi_4_64;
- t1 = x1 * cospi_12_64 + x2 * cospi_20_64;
- t2 = x2 * cospi_12_64 + x1 * -cospi_20_64;
- t3 = x3 * cospi_28_64 + x0 * -cospi_4_64;
- output[1] = fdct_round_shift(t0);
- output[3] = fdct_round_shift(t2);
- output[5] = fdct_round_shift(t1);
- output[7] = fdct_round_shift(t3);
-}
-
-void vp9_fdct8x8_c(const int16_t *input, int16_t *final_output, int stride) {
- int i, j;
- int16_t intermediate[64];
-
- // Transform columns
- {
- int16_t *output = intermediate;
- /*canbe16*/ int s0, s1, s2, s3, s4, s5, s6, s7;
- /*needs32*/ int t0, t1, t2, t3;
- /*canbe16*/ int x0, x1, x2, x3;
-
- int i;
- for (i = 0; i < 8; i++) {
- // stage 1
- s0 = (input[0 * stride] + input[7 * stride]) * 4;
- s1 = (input[1 * stride] + input[6 * stride]) * 4;
- s2 = (input[2 * stride] + input[5 * stride]) * 4;
- s3 = (input[3 * stride] + input[4 * stride]) * 4;
- s4 = (input[3 * stride] - input[4 * stride]) * 4;
- s5 = (input[2 * stride] - input[5 * stride]) * 4;
- s6 = (input[1 * stride] - input[6 * stride]) * 4;
- s7 = (input[0 * stride] - input[7 * stride]) * 4;
-
- // fdct4(step, step);
- x0 = s0 + s3;
- x1 = s1 + s2;
- x2 = s1 - s2;
- x3 = s0 - s3;
- t0 = (x0 + x1) * cospi_16_64;
- t1 = (x0 - x1) * cospi_16_64;
- t2 = x2 * cospi_24_64 + x3 * cospi_8_64;
- t3 = -x2 * cospi_8_64 + x3 * cospi_24_64;
- output[0 * 8] = fdct_round_shift(t0);
- output[2 * 8] = fdct_round_shift(t2);
- output[4 * 8] = fdct_round_shift(t1);
- output[6 * 8] = fdct_round_shift(t3);
-
- // Stage 2
- t0 = (s6 - s5) * cospi_16_64;
- t1 = (s6 + s5) * cospi_16_64;
- t2 = fdct_round_shift(t0);
- t3 = fdct_round_shift(t1);
-
- // Stage 3
- x0 = s4 + t2;
- x1 = s4 - t2;
- x2 = s7 - t3;
- x3 = s7 + t3;
-
- // Stage 4
- t0 = x0 * cospi_28_64 + x3 * cospi_4_64;
- t1 = x1 * cospi_12_64 + x2 * cospi_20_64;
- t2 = x2 * cospi_12_64 + x1 * -cospi_20_64;
- t3 = x3 * cospi_28_64 + x0 * -cospi_4_64;
- output[1 * 8] = fdct_round_shift(t0);
- output[3 * 8] = fdct_round_shift(t2);
- output[5 * 8] = fdct_round_shift(t1);
- output[7 * 8] = fdct_round_shift(t3);
- input++;
- output++;
- }
- }
-
- // Rows
- for (i = 0; i < 8; ++i) {
- fdct8(&intermediate[i * 8], &final_output[i * 8]);
- for (j = 0; j < 8; ++j)
- final_output[j + i * 8] /= 2;
- }
-}
-
-void vp9_fdct16x16_c(const int16_t *input, int16_t *output, int stride) {
- // The 2D transform is done with two passes which are actually pretty
- // similar. In the first one, we transform the columns and transpose
- // the results. In the second one, we transform the rows. To achieve that,
- // as the first pass results are transposed, we transpose the columns (that
- // is the transposed rows) and transpose the results (so that it goes back
- // in normal/row positions).
- int pass;
- // We need an intermediate buffer between passes.
- int16_t intermediate[256];
- const int16_t *in = input;
- int16_t *out = intermediate;
- // Do the two transform/transpose passes
- for (pass = 0; pass < 2; ++pass) {
- /*canbe16*/ int step1[8];
- /*canbe16*/ int step2[8];
- /*canbe16*/ int step3[8];
- /*canbe16*/ int input[8];
- /*needs32*/ int temp1, temp2;
- int i;
- for (i = 0; i < 16; i++) {
- if (0 == pass) {
- // Calculate input for the first 8 results.
- input[0] = (in[0 * stride] + in[15 * stride]) * 4;
- input[1] = (in[1 * stride] + in[14 * stride]) * 4;
- input[2] = (in[2 * stride] + in[13 * stride]) * 4;
- input[3] = (in[3 * stride] + in[12 * stride]) * 4;
- input[4] = (in[4 * stride] + in[11 * stride]) * 4;
- input[5] = (in[5 * stride] + in[10 * stride]) * 4;
- input[6] = (in[6 * stride] + in[ 9 * stride]) * 4;
- input[7] = (in[7 * stride] + in[ 8 * stride]) * 4;
- // Calculate input for the next 8 results.
- step1[0] = (in[7 * stride] - in[ 8 * stride]) * 4;
- step1[1] = (in[6 * stride] - in[ 9 * stride]) * 4;
- step1[2] = (in[5 * stride] - in[10 * stride]) * 4;
- step1[3] = (in[4 * stride] - in[11 * stride]) * 4;
- step1[4] = (in[3 * stride] - in[12 * stride]) * 4;
- step1[5] = (in[2 * stride] - in[13 * stride]) * 4;
- step1[6] = (in[1 * stride] - in[14 * stride]) * 4;
- step1[7] = (in[0 * stride] - in[15 * stride]) * 4;
- } else {
- // Calculate input for the first 8 results.
- input[0] = ((in[0 * 16] + 1) >> 2) + ((in[15 * 16] + 1) >> 2);
- input[1] = ((in[1 * 16] + 1) >> 2) + ((in[14 * 16] + 1) >> 2);
- input[2] = ((in[2 * 16] + 1) >> 2) + ((in[13 * 16] + 1) >> 2);
- input[3] = ((in[3 * 16] + 1) >> 2) + ((in[12 * 16] + 1) >> 2);
- input[4] = ((in[4 * 16] + 1) >> 2) + ((in[11 * 16] + 1) >> 2);
- input[5] = ((in[5 * 16] + 1) >> 2) + ((in[10 * 16] + 1) >> 2);
- input[6] = ((in[6 * 16] + 1) >> 2) + ((in[ 9 * 16] + 1) >> 2);
- input[7] = ((in[7 * 16] + 1) >> 2) + ((in[ 8 * 16] + 1) >> 2);
- // Calculate input for the next 8 results.
- step1[0] = ((in[7 * 16] + 1) >> 2) - ((in[ 8 * 16] + 1) >> 2);
- step1[1] = ((in[6 * 16] + 1) >> 2) - ((in[ 9 * 16] + 1) >> 2);
- step1[2] = ((in[5 * 16] + 1) >> 2) - ((in[10 * 16] + 1) >> 2);
- step1[3] = ((in[4 * 16] + 1) >> 2) - ((in[11 * 16] + 1) >> 2);
- step1[4] = ((in[3 * 16] + 1) >> 2) - ((in[12 * 16] + 1) >> 2);
- step1[5] = ((in[2 * 16] + 1) >> 2) - ((in[13 * 16] + 1) >> 2);
- step1[6] = ((in[1 * 16] + 1) >> 2) - ((in[14 * 16] + 1) >> 2);
- step1[7] = ((in[0 * 16] + 1) >> 2) - ((in[15 * 16] + 1) >> 2);
- }
- // Work on the first eight values; fdct8(input, even_results);
- {
- /*canbe16*/ int s0, s1, s2, s3, s4, s5, s6, s7;
- /*needs32*/ int t0, t1, t2, t3;
- /*canbe16*/ int x0, x1, x2, x3;
-
- // stage 1
- s0 = input[0] + input[7];
- s1 = input[1] + input[6];
- s2 = input[2] + input[5];
- s3 = input[3] + input[4];
- s4 = input[3] - input[4];
- s5 = input[2] - input[5];
- s6 = input[1] - input[6];
- s7 = input[0] - input[7];
-
- // fdct4(step, step);
- x0 = s0 + s3;
- x1 = s1 + s2;
- x2 = s1 - s2;
- x3 = s0 - s3;
- t0 = (x0 + x1) * cospi_16_64;
- t1 = (x0 - x1) * cospi_16_64;
- t2 = x3 * cospi_8_64 + x2 * cospi_24_64;
- t3 = x3 * cospi_24_64 - x2 * cospi_8_64;
- out[0] = fdct_round_shift(t0);
- out[4] = fdct_round_shift(t2);
- out[8] = fdct_round_shift(t1);
- out[12] = fdct_round_shift(t3);
-
- // Stage 2
- t0 = (s6 - s5) * cospi_16_64;
- t1 = (s6 + s5) * cospi_16_64;
- t2 = fdct_round_shift(t0);
- t3 = fdct_round_shift(t1);
-
- // Stage 3
- x0 = s4 + t2;
- x1 = s4 - t2;
- x2 = s7 - t3;
- x3 = s7 + t3;
-
- // Stage 4
- t0 = x0 * cospi_28_64 + x3 * cospi_4_64;
- t1 = x1 * cospi_12_64 + x2 * cospi_20_64;
- t2 = x2 * cospi_12_64 + x1 * -cospi_20_64;
- t3 = x3 * cospi_28_64 + x0 * -cospi_4_64;
- out[2] = fdct_round_shift(t0);
- out[6] = fdct_round_shift(t2);
- out[10] = fdct_round_shift(t1);
- out[14] = fdct_round_shift(t3);
- }
- // Work on the next eight values; step1 -> odd_results
- {
- // step 2
- temp1 = (step1[5] - step1[2]) * cospi_16_64;
- temp2 = (step1[4] - step1[3]) * cospi_16_64;
- step2[2] = fdct_round_shift(temp1);
- step2[3] = fdct_round_shift(temp2);
- temp1 = (step1[4] + step1[3]) * cospi_16_64;
- temp2 = (step1[5] + step1[2]) * cospi_16_64;
- step2[4] = fdct_round_shift(temp1);
- step2[5] = fdct_round_shift(temp2);
- // step 3
- step3[0] = step1[0] + step2[3];
- step3[1] = step1[1] + step2[2];
- step3[2] = step1[1] - step2[2];
- step3[3] = step1[0] - step2[3];
- step3[4] = step1[7] - step2[4];
- step3[5] = step1[6] - step2[5];
- step3[6] = step1[6] + step2[5];
- step3[7] = step1[7] + step2[4];
- // step 4
- temp1 = step3[1] * -cospi_8_64 + step3[6] * cospi_24_64;
- temp2 = step3[2] * -cospi_24_64 - step3[5] * cospi_8_64;
- step2[1] = fdct_round_shift(temp1);
- step2[2] = fdct_round_shift(temp2);
- temp1 = step3[2] * -cospi_8_64 + step3[5] * cospi_24_64;
- temp2 = step3[1] * cospi_24_64 + step3[6] * cospi_8_64;
- step2[5] = fdct_round_shift(temp1);
- step2[6] = fdct_round_shift(temp2);
- // step 5
- step1[0] = step3[0] + step2[1];
- step1[1] = step3[0] - step2[1];
- step1[2] = step3[3] - step2[2];
- step1[3] = step3[3] + step2[2];
- step1[4] = step3[4] + step2[5];
- step1[5] = step3[4] - step2[5];
- step1[6] = step3[7] - step2[6];
- step1[7] = step3[7] + step2[6];
- // step 6
- temp1 = step1[0] * cospi_30_64 + step1[7] * cospi_2_64;
- temp2 = step1[1] * cospi_14_64 + step1[6] * cospi_18_64;
- out[1] = fdct_round_shift(temp1);
- out[9] = fdct_round_shift(temp2);
- temp1 = step1[2] * cospi_22_64 + step1[5] * cospi_10_64;
- temp2 = step1[3] * cospi_6_64 + step1[4] * cospi_26_64;
- out[5] = fdct_round_shift(temp1);
- out[13] = fdct_round_shift(temp2);
- temp1 = step1[3] * -cospi_26_64 + step1[4] * cospi_6_64;
- temp2 = step1[2] * -cospi_10_64 + step1[5] * cospi_22_64;
- out[3] = fdct_round_shift(temp1);
- out[11] = fdct_round_shift(temp2);
- temp1 = step1[1] * -cospi_18_64 + step1[6] * cospi_14_64;
- temp2 = step1[0] * -cospi_2_64 + step1[7] * cospi_30_64;
- out[7] = fdct_round_shift(temp1);
- out[15] = fdct_round_shift(temp2);
- }
- // Do next column (which is a transposed row in second/horizontal pass)
- in++;
- out += 16;
- }
- // Setup in/out for next pass.
- in = intermediate;
- out = output;
- }
-}
-
-static void fadst8(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7;
-
- int x0 = input[7];
- int x1 = input[0];
- int x2 = input[5];
- int x3 = input[2];
- int x4 = input[3];
- int x5 = input[4];
- int x6 = input[1];
- int x7 = input[6];
-
- // 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 = fdct_round_shift(s0 + s4);
- x1 = fdct_round_shift(s1 + s5);
- x2 = fdct_round_shift(s2 + s6);
- x3 = fdct_round_shift(s3 + s7);
- x4 = fdct_round_shift(s0 - s4);
- x5 = fdct_round_shift(s1 - s5);
- x6 = fdct_round_shift(s2 - s6);
- x7 = fdct_round_shift(s3 - s7);
-
- // 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 = s0 + s2;
- x1 = s1 + s3;
- x2 = s0 - s2;
- x3 = s1 - s3;
- x4 = fdct_round_shift(s4 + s6);
- x5 = fdct_round_shift(s5 + s7);
- x6 = fdct_round_shift(s4 - s6);
- x7 = fdct_round_shift(s5 - s7);
-
- // 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 = fdct_round_shift(s2);
- x3 = fdct_round_shift(s3);
- x6 = fdct_round_shift(s6);
- x7 = fdct_round_shift(s7);
-
- output[0] = x0;
- output[1] = - x4;
- output[2] = x6;
- output[3] = - x2;
- output[4] = x3;
- output[5] = - x7;
- output[6] = x5;
- output[7] = - x1;
-}
-
-static const transform_2d FHT_8[] = {
- { fdct8, fdct8 }, // DCT_DCT = 0
- { fadst8, fdct8 }, // ADST_DCT = 1
- { fdct8, fadst8 }, // DCT_ADST = 2
- { fadst8, fadst8 } // ADST_ADST = 3
-};
-
-void vp9_fht8x8_c(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- if (tx_type == DCT_DCT) {
- vp9_fdct8x8_c(input, output, stride);
- } else {
- int16_t out[64];
- int16_t *outptr = &out[0];
- int i, j;
- int16_t temp_in[8], temp_out[8];
- const transform_2d ht = FHT_8[tx_type];
-
- // Columns
- for (i = 0; i < 8; ++i) {
- for (j = 0; j < 8; ++j)
- temp_in[j] = input[j * stride + i] * 4;
- ht.cols(temp_in, temp_out);
- for (j = 0; j < 8; ++j)
- outptr[j * 8 + i] = temp_out[j];
- }
-
- // Rows
- for (i = 0; i < 8; ++i) {
- for (j = 0; j < 8; ++j)
- temp_in[j] = out[j + i * 8];
- ht.rows(temp_in, temp_out);
- for (j = 0; j < 8; ++j)
- output[j + i * 8] = (temp_out[j] + (temp_out[j] < 0)) >> 1;
- }
- }
-}
-
-/* 4-point reversible, orthonormal Walsh-Hadamard in 3.5 adds, 0.5 shifts per
- pixel. */
-void vp9_fwht4x4_c(const int16_t *input, int16_t *output, int stride) {
- int i;
- int a1, b1, c1, d1, e1;
- const int16_t *ip = input;
- int16_t *op = output;
-
- for (i = 0; i < 4; i++) {
- a1 = ip[0 * stride];
- b1 = ip[1 * stride];
- c1 = ip[2 * stride];
- d1 = ip[3 * stride];
-
- a1 += b1;
- d1 = d1 - c1;
- e1 = (a1 - d1) >> 1;
- b1 = e1 - b1;
- c1 = e1 - c1;
- a1 -= c1;
- d1 += b1;
- op[0] = a1;
- op[4] = c1;
- op[8] = d1;
- op[12] = b1;
-
- ip++;
- op++;
- }
- ip = output;
- op = output;
-
- for (i = 0; i < 4; i++) {
- a1 = ip[0];
- b1 = ip[1];
- c1 = ip[2];
- d1 = ip[3];
-
- a1 += b1;
- d1 -= c1;
- e1 = (a1 - d1) >> 1;
- b1 = e1 - b1;
- c1 = e1 - c1;
- a1 -= c1;
- d1 += b1;
- op[0] = a1 * UNIT_QUANT_FACTOR;
- op[1] = c1 * UNIT_QUANT_FACTOR;
- op[2] = d1 * UNIT_QUANT_FACTOR;
- op[3] = b1 * UNIT_QUANT_FACTOR;
-
- ip += 4;
- op += 4;
- }
-}
-
-// Rewrote to use same algorithm as others.
-static void fdct16(const int16_t in[16], int16_t out[16]) {
- /*canbe16*/ int step1[8];
- /*canbe16*/ int step2[8];
- /*canbe16*/ int step3[8];
- /*canbe16*/ int input[8];
- /*needs32*/ int temp1, temp2;
-
- // step 1
- input[0] = in[0] + in[15];
- input[1] = in[1] + in[14];
- input[2] = in[2] + in[13];
- input[3] = in[3] + in[12];
- input[4] = in[4] + in[11];
- input[5] = in[5] + in[10];
- input[6] = in[6] + in[ 9];
- input[7] = in[7] + in[ 8];
-
- step1[0] = in[7] - in[ 8];
- step1[1] = in[6] - in[ 9];
- step1[2] = in[5] - in[10];
- step1[3] = in[4] - in[11];
- step1[4] = in[3] - in[12];
- step1[5] = in[2] - in[13];
- step1[6] = in[1] - in[14];
- step1[7] = in[0] - in[15];
-
- // fdct8(step, step);
- {
- /*canbe16*/ int s0, s1, s2, s3, s4, s5, s6, s7;
- /*needs32*/ int t0, t1, t2, t3;
- /*canbe16*/ int x0, x1, x2, x3;
-
- // stage 1
- s0 = input[0] + input[7];
- s1 = input[1] + input[6];
- s2 = input[2] + input[5];
- s3 = input[3] + input[4];
- s4 = input[3] - input[4];
- s5 = input[2] - input[5];
- s6 = input[1] - input[6];
- s7 = input[0] - input[7];
-
- // fdct4(step, step);
- x0 = s0 + s3;
- x1 = s1 + s2;
- x2 = s1 - s2;
- x3 = s0 - s3;
- t0 = (x0 + x1) * cospi_16_64;
- t1 = (x0 - x1) * cospi_16_64;
- t2 = x3 * cospi_8_64 + x2 * cospi_24_64;
- t3 = x3 * cospi_24_64 - x2 * cospi_8_64;
- out[0] = fdct_round_shift(t0);
- out[4] = fdct_round_shift(t2);
- out[8] = fdct_round_shift(t1);
- out[12] = fdct_round_shift(t3);
-
- // Stage 2
- t0 = (s6 - s5) * cospi_16_64;
- t1 = (s6 + s5) * cospi_16_64;
- t2 = fdct_round_shift(t0);
- t3 = fdct_round_shift(t1);
-
- // Stage 3
- x0 = s4 + t2;
- x1 = s4 - t2;
- x2 = s7 - t3;
- x3 = s7 + t3;
-
- // Stage 4
- t0 = x0 * cospi_28_64 + x3 * cospi_4_64;
- t1 = x1 * cospi_12_64 + x2 * cospi_20_64;
- t2 = x2 * cospi_12_64 + x1 * -cospi_20_64;
- t3 = x3 * cospi_28_64 + x0 * -cospi_4_64;
- out[2] = fdct_round_shift(t0);
- out[6] = fdct_round_shift(t2);
- out[10] = fdct_round_shift(t1);
- out[14] = fdct_round_shift(t3);
- }
-
- // step 2
- temp1 = (step1[5] - step1[2]) * cospi_16_64;
- temp2 = (step1[4] - step1[3]) * cospi_16_64;
- step2[2] = fdct_round_shift(temp1);
- step2[3] = fdct_round_shift(temp2);
- temp1 = (step1[4] + step1[3]) * cospi_16_64;
- temp2 = (step1[5] + step1[2]) * cospi_16_64;
- step2[4] = fdct_round_shift(temp1);
- step2[5] = fdct_round_shift(temp2);
-
- // step 3
- step3[0] = step1[0] + step2[3];
- step3[1] = step1[1] + step2[2];
- step3[2] = step1[1] - step2[2];
- step3[3] = step1[0] - step2[3];
- step3[4] = step1[7] - step2[4];
- step3[5] = step1[6] - step2[5];
- step3[6] = step1[6] + step2[5];
- step3[7] = step1[7] + step2[4];
-
- // step 4
- temp1 = step3[1] * -cospi_8_64 + step3[6] * cospi_24_64;
- temp2 = step3[2] * -cospi_24_64 - step3[5] * cospi_8_64;
- step2[1] = fdct_round_shift(temp1);
- step2[2] = fdct_round_shift(temp2);
- temp1 = step3[2] * -cospi_8_64 + step3[5] * cospi_24_64;
- temp2 = step3[1] * cospi_24_64 + step3[6] * cospi_8_64;
- step2[5] = fdct_round_shift(temp1);
- step2[6] = fdct_round_shift(temp2);
-
- // step 5
- step1[0] = step3[0] + step2[1];
- step1[1] = step3[0] - step2[1];
- step1[2] = step3[3] - step2[2];
- step1[3] = step3[3] + step2[2];
- step1[4] = step3[4] + step2[5];
- step1[5] = step3[4] - step2[5];
- step1[6] = step3[7] - step2[6];
- step1[7] = step3[7] + step2[6];
-
- // step 6
- temp1 = step1[0] * cospi_30_64 + step1[7] * cospi_2_64;
- temp2 = step1[1] * cospi_14_64 + step1[6] * cospi_18_64;
- out[1] = fdct_round_shift(temp1);
- out[9] = fdct_round_shift(temp2);
-
- temp1 = step1[2] * cospi_22_64 + step1[5] * cospi_10_64;
- temp2 = step1[3] * cospi_6_64 + step1[4] * cospi_26_64;
- out[5] = fdct_round_shift(temp1);
- out[13] = fdct_round_shift(temp2);
-
- temp1 = step1[3] * -cospi_26_64 + step1[4] * cospi_6_64;
- temp2 = step1[2] * -cospi_10_64 + step1[5] * cospi_22_64;
- out[3] = fdct_round_shift(temp1);
- out[11] = fdct_round_shift(temp2);
-
- temp1 = step1[1] * -cospi_18_64 + step1[6] * cospi_14_64;
- temp2 = step1[0] * -cospi_2_64 + step1[7] * cospi_30_64;
- out[7] = fdct_round_shift(temp1);
- out[15] = fdct_round_shift(temp2);
-}
-
-static void fadst16(const int16_t *input, int16_t *output) {
- int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
-
- int x0 = input[15];
- int x1 = input[0];
- int x2 = input[13];
- int x3 = input[2];
- int x4 = input[11];
- int x5 = input[4];
- int x6 = input[9];
- int x7 = input[6];
- int x8 = input[7];
- int x9 = input[8];
- int x10 = input[5];
- int x11 = input[10];
- int x12 = input[3];
- int x13 = input[12];
- int x14 = input[1];
- int x15 = input[14];
-
- // 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 = fdct_round_shift(s0 + s8);
- x1 = fdct_round_shift(s1 + s9);
- x2 = fdct_round_shift(s2 + s10);
- x3 = fdct_round_shift(s3 + s11);
- x4 = fdct_round_shift(s4 + s12);
- x5 = fdct_round_shift(s5 + s13);
- x6 = fdct_round_shift(s6 + s14);
- x7 = fdct_round_shift(s7 + s15);
- x8 = fdct_round_shift(s0 - s8);
- x9 = fdct_round_shift(s1 - s9);
- x10 = fdct_round_shift(s2 - s10);
- x11 = fdct_round_shift(s3 - s11);
- x12 = fdct_round_shift(s4 - s12);
- x13 = fdct_round_shift(s5 - s13);
- x14 = fdct_round_shift(s6 - s14);
- x15 = fdct_round_shift(s7 - s15);
-
- // 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 = s0 + s4;
- x1 = s1 + s5;
- x2 = s2 + s6;
- x3 = s3 + s7;
- x4 = s0 - s4;
- x5 = s1 - s5;
- x6 = s2 - s6;
- x7 = s3 - s7;
- x8 = fdct_round_shift(s8 + s12);
- x9 = fdct_round_shift(s9 + s13);
- x10 = fdct_round_shift(s10 + s14);
- x11 = fdct_round_shift(s11 + s15);
- x12 = fdct_round_shift(s8 - s12);
- x13 = fdct_round_shift(s9 - s13);
- x14 = fdct_round_shift(s10 - s14);
- x15 = fdct_round_shift(s11 - s15);
-
- // 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 = s0 + s2;
- x1 = s1 + s3;
- x2 = s0 - s2;
- x3 = s1 - s3;
- x4 = fdct_round_shift(s4 + s6);
- x5 = fdct_round_shift(s5 + s7);
- x6 = fdct_round_shift(s4 - s6);
- x7 = fdct_round_shift(s5 - s7);
- x8 = s8 + s10;
- x9 = s9 + s11;
- x10 = s8 - s10;
- x11 = s9 - s11;
- x12 = fdct_round_shift(s12 + s14);
- x13 = fdct_round_shift(s13 + s15);
- x14 = fdct_round_shift(s12 - s14);
- x15 = fdct_round_shift(s13 - s15);
-
- // 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 = fdct_round_shift(s2);
- x3 = fdct_round_shift(s3);
- x6 = fdct_round_shift(s6);
- x7 = fdct_round_shift(s7);
- x10 = fdct_round_shift(s10);
- x11 = fdct_round_shift(s11);
- x14 = fdct_round_shift(s14);
- x15 = fdct_round_shift(s15);
-
- output[0] = x0;
- output[1] = - x8;
- output[2] = x12;
- output[3] = - x4;
- output[4] = x6;
- output[5] = x14;
- output[6] = x10;
- output[7] = x2;
- output[8] = x3;
- output[9] = x11;
- output[10] = x15;
- output[11] = x7;
- output[12] = x5;
- output[13] = - x13;
- output[14] = x9;
- output[15] = - x1;
-}
-
-static const transform_2d FHT_16[] = {
- { fdct16, fdct16 }, // DCT_DCT = 0
- { fadst16, fdct16 }, // ADST_DCT = 1
- { fdct16, fadst16 }, // DCT_ADST = 2
- { fadst16, fadst16 } // ADST_ADST = 3
-};
-
-void vp9_fht16x16_c(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- if (tx_type == DCT_DCT) {
- vp9_fdct16x16_c(input, output, stride);
- } else {
- int16_t out[256];
- int16_t *outptr = &out[0];
- int i, j;
- int16_t temp_in[16], temp_out[16];
- const transform_2d ht = FHT_16[tx_type];
-
- // Columns
- for (i = 0; i < 16; ++i) {
- for (j = 0; j < 16; ++j)
- temp_in[j] = input[j * stride + i] * 4;
- ht.cols(temp_in, temp_out);
- for (j = 0; j < 16; ++j)
- outptr[j * 16 + i] = (temp_out[j] + 1 + (temp_out[j] < 0)) >> 2;
- }
-
- // Rows
- for (i = 0; i < 16; ++i) {
- for (j = 0; j < 16; ++j)
- temp_in[j] = out[j + i * 16];
- ht.rows(temp_in, temp_out);
- for (j = 0; j < 16; ++j)
- output[j + i * 16] = temp_out[j];
- }
- }
-}
-
-static INLINE int dct_32_round(int input) {
- int rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
- assert(-131072 <= rv && rv <= 131071);
- return rv;
-}
-
-static INLINE int half_round_shift(int input) {
- int rv = (input + 1 + (input < 0)) >> 2;
- return rv;
-}
-
-static void fdct32(const int *input, int *output, int round) {
- int step[32];
- // Stage 1
- step[0] = input[0] + input[(32 - 1)];
- step[1] = input[1] + input[(32 - 2)];
- step[2] = input[2] + input[(32 - 3)];
- step[3] = input[3] + input[(32 - 4)];
- step[4] = input[4] + input[(32 - 5)];
- step[5] = input[5] + input[(32 - 6)];
- step[6] = input[6] + input[(32 - 7)];
- step[7] = input[7] + input[(32 - 8)];
- step[8] = input[8] + input[(32 - 9)];
- step[9] = input[9] + input[(32 - 10)];
- step[10] = input[10] + input[(32 - 11)];
- step[11] = input[11] + input[(32 - 12)];
- step[12] = input[12] + input[(32 - 13)];
- step[13] = input[13] + input[(32 - 14)];
- step[14] = input[14] + input[(32 - 15)];
- step[15] = input[15] + input[(32 - 16)];
- step[16] = -input[16] + input[(32 - 17)];
- step[17] = -input[17] + input[(32 - 18)];
- step[18] = -input[18] + input[(32 - 19)];
- step[19] = -input[19] + input[(32 - 20)];
- step[20] = -input[20] + input[(32 - 21)];
- step[21] = -input[21] + input[(32 - 22)];
- step[22] = -input[22] + input[(32 - 23)];
- step[23] = -input[23] + input[(32 - 24)];
- step[24] = -input[24] + input[(32 - 25)];
- step[25] = -input[25] + input[(32 - 26)];
- step[26] = -input[26] + input[(32 - 27)];
- step[27] = -input[27] + input[(32 - 28)];
- step[28] = -input[28] + input[(32 - 29)];
- step[29] = -input[29] + input[(32 - 30)];
- step[30] = -input[30] + input[(32 - 31)];
- step[31] = -input[31] + input[(32 - 32)];
-
- // Stage 2
- output[0] = step[0] + step[16 - 1];
- output[1] = step[1] + step[16 - 2];
- output[2] = step[2] + step[16 - 3];
- output[3] = step[3] + step[16 - 4];
- output[4] = step[4] + step[16 - 5];
- output[5] = step[5] + step[16 - 6];
- output[6] = step[6] + step[16 - 7];
- output[7] = step[7] + step[16 - 8];
- output[8] = -step[8] + step[16 - 9];
- output[9] = -step[9] + step[16 - 10];
- output[10] = -step[10] + step[16 - 11];
- output[11] = -step[11] + step[16 - 12];
- output[12] = -step[12] + step[16 - 13];
- output[13] = -step[13] + step[16 - 14];
- output[14] = -step[14] + step[16 - 15];
- output[15] = -step[15] + step[16 - 16];
-
- output[16] = step[16];
- output[17] = step[17];
- output[18] = step[18];
- output[19] = step[19];
-
- output[20] = dct_32_round((-step[20] + step[27]) * cospi_16_64);
- output[21] = dct_32_round((-step[21] + step[26]) * cospi_16_64);
- output[22] = dct_32_round((-step[22] + step[25]) * cospi_16_64);
- output[23] = dct_32_round((-step[23] + step[24]) * cospi_16_64);
-
- output[24] = dct_32_round((step[24] + step[23]) * cospi_16_64);
- output[25] = dct_32_round((step[25] + step[22]) * cospi_16_64);
- output[26] = dct_32_round((step[26] + step[21]) * cospi_16_64);
- output[27] = dct_32_round((step[27] + step[20]) * cospi_16_64);
-
- output[28] = step[28];
- output[29] = step[29];
- output[30] = step[30];
- output[31] = step[31];
-
- // dump the magnitude by 4, hence the intermediate values are within
- // the range of 16 bits.
- if (round) {
- output[0] = half_round_shift(output[0]);
- output[1] = half_round_shift(output[1]);
- output[2] = half_round_shift(output[2]);
- output[3] = half_round_shift(output[3]);
- output[4] = half_round_shift(output[4]);
- output[5] = half_round_shift(output[5]);
- output[6] = half_round_shift(output[6]);
- output[7] = half_round_shift(output[7]);
- output[8] = half_round_shift(output[8]);
- output[9] = half_round_shift(output[9]);
- output[10] = half_round_shift(output[10]);
- output[11] = half_round_shift(output[11]);
- output[12] = half_round_shift(output[12]);
- output[13] = half_round_shift(output[13]);
- output[14] = half_round_shift(output[14]);
- output[15] = half_round_shift(output[15]);
-
- output[16] = half_round_shift(output[16]);
- output[17] = half_round_shift(output[17]);
- output[18] = half_round_shift(output[18]);
- output[19] = half_round_shift(output[19]);
- output[20] = half_round_shift(output[20]);
- output[21] = half_round_shift(output[21]);
- output[22] = half_round_shift(output[22]);
- output[23] = half_round_shift(output[23]);
- output[24] = half_round_shift(output[24]);
- output[25] = half_round_shift(output[25]);
- output[26] = half_round_shift(output[26]);
- output[27] = half_round_shift(output[27]);
- output[28] = half_round_shift(output[28]);
- output[29] = half_round_shift(output[29]);
- output[30] = half_round_shift(output[30]);
- output[31] = half_round_shift(output[31]);
- }
-
- // Stage 3
- step[0] = output[0] + output[(8 - 1)];
- step[1] = output[1] + output[(8 - 2)];
- step[2] = output[2] + output[(8 - 3)];
- step[3] = output[3] + output[(8 - 4)];
- step[4] = -output[4] + output[(8 - 5)];
- step[5] = -output[5] + output[(8 - 6)];
- step[6] = -output[6] + output[(8 - 7)];
- step[7] = -output[7] + output[(8 - 8)];
- step[8] = output[8];
- step[9] = output[9];
- step[10] = dct_32_round((-output[10] + output[13]) * cospi_16_64);
- step[11] = dct_32_round((-output[11] + output[12]) * cospi_16_64);
- step[12] = dct_32_round((output[12] + output[11]) * cospi_16_64);
- step[13] = dct_32_round((output[13] + output[10]) * cospi_16_64);
- step[14] = output[14];
- step[15] = output[15];
-
- step[16] = output[16] + output[23];
- step[17] = output[17] + output[22];
- step[18] = output[18] + output[21];
- step[19] = output[19] + output[20];
- step[20] = -output[20] + output[19];
- step[21] = -output[21] + output[18];
- step[22] = -output[22] + output[17];
- step[23] = -output[23] + output[16];
- step[24] = -output[24] + output[31];
- step[25] = -output[25] + output[30];
- step[26] = -output[26] + output[29];
- step[27] = -output[27] + output[28];
- step[28] = output[28] + output[27];
- step[29] = output[29] + output[26];
- step[30] = output[30] + output[25];
- step[31] = output[31] + output[24];
-
- // Stage 4
- output[0] = step[0] + step[3];
- output[1] = step[1] + step[2];
- output[2] = -step[2] + step[1];
- output[3] = -step[3] + step[0];
- output[4] = step[4];
- output[5] = dct_32_round((-step[5] + step[6]) * cospi_16_64);
- output[6] = dct_32_round((step[6] + step[5]) * cospi_16_64);
- output[7] = step[7];
- output[8] = step[8] + step[11];
- output[9] = step[9] + step[10];
- output[10] = -step[10] + step[9];
- output[11] = -step[11] + step[8];
- output[12] = -step[12] + step[15];
- output[13] = -step[13] + step[14];
- output[14] = step[14] + step[13];
- output[15] = step[15] + step[12];
-
- output[16] = step[16];
- output[17] = step[17];
- output[18] = dct_32_round(step[18] * -cospi_8_64 + step[29] * cospi_24_64);
- output[19] = dct_32_round(step[19] * -cospi_8_64 + step[28] * cospi_24_64);
- output[20] = dct_32_round(step[20] * -cospi_24_64 + step[27] * -cospi_8_64);
- output[21] = dct_32_round(step[21] * -cospi_24_64 + step[26] * -cospi_8_64);
- output[22] = step[22];
- output[23] = step[23];
- output[24] = step[24];
- output[25] = step[25];
- output[26] = dct_32_round(step[26] * cospi_24_64 + step[21] * -cospi_8_64);
- output[27] = dct_32_round(step[27] * cospi_24_64 + step[20] * -cospi_8_64);
- output[28] = dct_32_round(step[28] * cospi_8_64 + step[19] * cospi_24_64);
- output[29] = dct_32_round(step[29] * cospi_8_64 + step[18] * cospi_24_64);
- output[30] = step[30];
- output[31] = step[31];
-
- // Stage 5
- step[0] = dct_32_round((output[0] + output[1]) * cospi_16_64);
- step[1] = dct_32_round((-output[1] + output[0]) * cospi_16_64);
- step[2] = dct_32_round(output[2] * cospi_24_64 + output[3] * cospi_8_64);
- step[3] = dct_32_round(output[3] * cospi_24_64 - output[2] * cospi_8_64);
- step[4] = output[4] + output[5];
- step[5] = -output[5] + output[4];
- step[6] = -output[6] + output[7];
- step[7] = output[7] + output[6];
- step[8] = output[8];
- step[9] = dct_32_round(output[9] * -cospi_8_64 + output[14] * cospi_24_64);
- step[10] = dct_32_round(output[10] * -cospi_24_64 + output[13] * -cospi_8_64);
- step[11] = output[11];
- step[12] = output[12];
- step[13] = dct_32_round(output[13] * cospi_24_64 + output[10] * -cospi_8_64);
- step[14] = dct_32_round(output[14] * cospi_8_64 + output[9] * cospi_24_64);
- step[15] = output[15];
-
- step[16] = output[16] + output[19];
- step[17] = output[17] + output[18];
- step[18] = -output[18] + output[17];
- step[19] = -output[19] + output[16];
- step[20] = -output[20] + output[23];
- step[21] = -output[21] + output[22];
- step[22] = output[22] + output[21];
- step[23] = output[23] + output[20];
- step[24] = output[24] + output[27];
- step[25] = output[25] + output[26];
- step[26] = -output[26] + output[25];
- step[27] = -output[27] + output[24];
- step[28] = -output[28] + output[31];
- step[29] = -output[29] + output[30];
- step[30] = output[30] + output[29];
- step[31] = output[31] + output[28];
-
- // Stage 6
- output[0] = step[0];
- output[1] = step[1];
- output[2] = step[2];
- output[3] = step[3];
- output[4] = dct_32_round(step[4] * cospi_28_64 + step[7] * cospi_4_64);
- output[5] = dct_32_round(step[5] * cospi_12_64 + step[6] * cospi_20_64);
- output[6] = dct_32_round(step[6] * cospi_12_64 + step[5] * -cospi_20_64);
- output[7] = dct_32_round(step[7] * cospi_28_64 + step[4] * -cospi_4_64);
- output[8] = step[8] + step[9];
- output[9] = -step[9] + step[8];
- output[10] = -step[10] + step[11];
- output[11] = step[11] + step[10];
- output[12] = step[12] + step[13];
- output[13] = -step[13] + step[12];
- output[14] = -step[14] + step[15];
- output[15] = step[15] + step[14];
-
- output[16] = step[16];
- output[17] = dct_32_round(step[17] * -cospi_4_64 + step[30] * cospi_28_64);
- output[18] = dct_32_round(step[18] * -cospi_28_64 + step[29] * -cospi_4_64);
- output[19] = step[19];
- output[20] = step[20];
- output[21] = dct_32_round(step[21] * -cospi_20_64 + step[26] * cospi_12_64);
- output[22] = dct_32_round(step[22] * -cospi_12_64 + step[25] * -cospi_20_64);
- output[23] = step[23];
- output[24] = step[24];
- output[25] = dct_32_round(step[25] * cospi_12_64 + step[22] * -cospi_20_64);
- output[26] = dct_32_round(step[26] * cospi_20_64 + step[21] * cospi_12_64);
- output[27] = step[27];
- output[28] = step[28];
- output[29] = dct_32_round(step[29] * cospi_28_64 + step[18] * -cospi_4_64);
- output[30] = dct_32_round(step[30] * cospi_4_64 + step[17] * cospi_28_64);
- output[31] = step[31];
-
- // Stage 7
- step[0] = output[0];
- step[1] = output[1];
- step[2] = output[2];
- step[3] = output[3];
- step[4] = output[4];
- step[5] = output[5];
- step[6] = output[6];
- step[7] = output[7];
- step[8] = dct_32_round(output[8] * cospi_30_64 + output[15] * cospi_2_64);
- step[9] = dct_32_round(output[9] * cospi_14_64 + output[14] * cospi_18_64);
- step[10] = dct_32_round(output[10] * cospi_22_64 + output[13] * cospi_10_64);
- step[11] = dct_32_round(output[11] * cospi_6_64 + output[12] * cospi_26_64);
- step[12] = dct_32_round(output[12] * cospi_6_64 + output[11] * -cospi_26_64);
- step[13] = dct_32_round(output[13] * cospi_22_64 + output[10] * -cospi_10_64);
- step[14] = dct_32_round(output[14] * cospi_14_64 + output[9] * -cospi_18_64);
- step[15] = dct_32_round(output[15] * cospi_30_64 + output[8] * -cospi_2_64);
-
- step[16] = output[16] + output[17];
- step[17] = -output[17] + output[16];
- step[18] = -output[18] + output[19];
- step[19] = output[19] + output[18];
- step[20] = output[20] + output[21];
- step[21] = -output[21] + output[20];
- step[22] = -output[22] + output[23];
- step[23] = output[23] + output[22];
- step[24] = output[24] + output[25];
- step[25] = -output[25] + output[24];
- step[26] = -output[26] + output[27];
- step[27] = output[27] + output[26];
- step[28] = output[28] + output[29];
- step[29] = -output[29] + output[28];
- step[30] = -output[30] + output[31];
- step[31] = output[31] + output[30];
-
- // Final stage --- outputs indices are bit-reversed.
- output[0] = step[0];
- output[16] = step[1];
- output[8] = step[2];
- output[24] = step[3];
- output[4] = step[4];
- output[20] = step[5];
- output[12] = step[6];
- output[28] = step[7];
- output[2] = step[8];
- output[18] = step[9];
- output[10] = step[10];
- output[26] = step[11];
- output[6] = step[12];
- output[22] = step[13];
- output[14] = step[14];
- output[30] = step[15];
-
- output[1] = dct_32_round(step[16] * cospi_31_64 + step[31] * cospi_1_64);
- output[17] = dct_32_round(step[17] * cospi_15_64 + step[30] * cospi_17_64);
- output[9] = dct_32_round(step[18] * cospi_23_64 + step[29] * cospi_9_64);
- output[25] = dct_32_round(step[19] * cospi_7_64 + step[28] * cospi_25_64);
- output[5] = dct_32_round(step[20] * cospi_27_64 + step[27] * cospi_5_64);
- output[21] = dct_32_round(step[21] * cospi_11_64 + step[26] * cospi_21_64);
- output[13] = dct_32_round(step[22] * cospi_19_64 + step[25] * cospi_13_64);
- output[29] = dct_32_round(step[23] * cospi_3_64 + step[24] * cospi_29_64);
- output[3] = dct_32_round(step[24] * cospi_3_64 + step[23] * -cospi_29_64);
- output[19] = dct_32_round(step[25] * cospi_19_64 + step[22] * -cospi_13_64);
- output[11] = dct_32_round(step[26] * cospi_11_64 + step[21] * -cospi_21_64);
- output[27] = dct_32_round(step[27] * cospi_27_64 + step[20] * -cospi_5_64);
- output[7] = dct_32_round(step[28] * cospi_7_64 + step[19] * -cospi_25_64);
- output[23] = dct_32_round(step[29] * cospi_23_64 + step[18] * -cospi_9_64);
- output[15] = dct_32_round(step[30] * cospi_15_64 + step[17] * -cospi_17_64);
- output[31] = dct_32_round(step[31] * cospi_31_64 + step[16] * -cospi_1_64);
-}
-
-void vp9_fdct32x32_c(const int16_t *input, int16_t *out, int stride) {
- int i, j;
- int output[32 * 32];
-
- // Columns
- for (i = 0; i < 32; ++i) {
- int temp_in[32], temp_out[32];
- for (j = 0; j < 32; ++j)
- temp_in[j] = input[j * stride + i] * 4;
- fdct32(temp_in, temp_out, 0);
- for (j = 0; j < 32; ++j)
- output[j * 32 + i] = (temp_out[j] + 1 + (temp_out[j] > 0)) >> 2;
- }
-
- // Rows
- for (i = 0; i < 32; ++i) {
- int temp_in[32], temp_out[32];
- for (j = 0; j < 32; ++j)
- temp_in[j] = output[j + i * 32];
- fdct32(temp_in, temp_out, 0);
- for (j = 0; j < 32; ++j)
- out[j + i * 32] = (temp_out[j] + 1 + (temp_out[j] < 0)) >> 2;
- }
-}
-
-// Note that although we use dct_32_round in dct32 computation flow,
-// this 2d fdct32x32 for rate-distortion optimization loop is operating
-// within 16 bits precision.
-void vp9_fdct32x32_rd_c(const int16_t *input, int16_t *out, int stride) {
- int i, j;
- int output[32 * 32];
-
- // Columns
- for (i = 0; i < 32; ++i) {
- int temp_in[32], temp_out[32];
- for (j = 0; j < 32; ++j)
- temp_in[j] = input[j * stride + i] * 4;
- fdct32(temp_in, temp_out, 0);
- for (j = 0; j < 32; ++j)
- // TODO(cd): see quality impact of only doing
- // output[j * 32 + i] = (temp_out[j] + 1) >> 2;
- // PS: also change code in vp9/encoder/x86/vp9_dct_sse2.c
- output[j * 32 + i] = (temp_out[j] + 1 + (temp_out[j] > 0)) >> 2;
- }
-
- // Rows
- for (i = 0; i < 32; ++i) {
- int temp_in[32], temp_out[32];
- for (j = 0; j < 32; ++j)
- temp_in[j] = output[j + i * 32];
- fdct32(temp_in, temp_out, 1);
- for (j = 0; j < 32; ++j)
- out[j + i * 32] = temp_out[j];
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.c
deleted file mode 100644
index 67b8b02..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.c
+++ /dev/null
@@ -1,3511 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-
-#include "./vp9_rtcd.h"
-#include "./vpx_config.h"
-
-#include "vpx_ports/vpx_timer.h"
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/vp9_mvref_common.h"
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_reconintra.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_seg_common.h"
-#include "vp9/common/vp9_systemdependent.h"
-#include "vp9/common/vp9_tile_common.h"
-
-#include "vp9/encoder/vp9_aq_complexity.h"
-#include "vp9/encoder/vp9_aq_cyclicrefresh.h"
-#include "vp9/encoder/vp9_aq_variance.h"
-#include "vp9/encoder/vp9_encodeframe.h"
-#include "vp9/encoder/vp9_encodemb.h"
-#include "vp9/encoder/vp9_encodemv.h"
-#include "vp9/encoder/vp9_extend.h"
-#include "vp9/encoder/vp9_pickmode.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_segmentation.h"
-#include "vp9/encoder/vp9_tokenize.h"
-
-#define GF_ZEROMV_ZBIN_BOOST 0
-#define LF_ZEROMV_ZBIN_BOOST 0
-#define MV_ZBIN_BOOST 0
-#define SPLIT_MV_ZBIN_BOOST 0
-#define INTRA_ZBIN_BOOST 0
-
-static INLINE uint8_t *get_sb_index(MACROBLOCK *x, BLOCK_SIZE subsize) {
- switch (subsize) {
- case BLOCK_64X64:
- case BLOCK_64X32:
- case BLOCK_32X64:
- case BLOCK_32X32:
- return &x->sb_index;
- case BLOCK_32X16:
- case BLOCK_16X32:
- case BLOCK_16X16:
- return &x->mb_index;
- case BLOCK_16X8:
- case BLOCK_8X16:
- case BLOCK_8X8:
- return &x->b_index;
- case BLOCK_8X4:
- case BLOCK_4X8:
- case BLOCK_4X4:
- return &x->ab_index;
- default:
- assert(0);
- return NULL;
- }
-}
-
-static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
- int mi_row, int mi_col, BLOCK_SIZE bsize);
-
-static void adjust_act_zbin(VP9_COMP *cpi, MACROBLOCK *x);
-
-// activity_avg must be positive, or flat regions could get a zero weight
-// (infinite lambda), which confounds analysis.
-// This also avoids the need for divide by zero checks in
-// vp9_activity_masking().
-#define ACTIVITY_AVG_MIN 64
-
-// Motion vector component magnitude threshold for defining fast motion.
-#define FAST_MOTION_MV_THRESH 24
-
-// This is used as a reference when computing the source variance for the
-// purposes of activity masking.
-// Eventually this should be replaced by custom no-reference routines,
-// which will be faster.
-static const uint8_t VP9_VAR_OFFS[64] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128
-};
-
-static unsigned int get_sby_perpixel_variance(VP9_COMP *cpi,
- MACROBLOCK *x,
- BLOCK_SIZE bs) {
- unsigned int var, sse;
- var = cpi->fn_ptr[bs].vf(x->plane[0].src.buf, x->plane[0].src.stride,
- VP9_VAR_OFFS, 0, &sse);
- return ROUND_POWER_OF_TWO(var, num_pels_log2_lookup[bs]);
-}
-
-static unsigned int get_sby_perpixel_diff_variance(VP9_COMP *cpi,
- MACROBLOCK *x,
- int mi_row,
- int mi_col,
- BLOCK_SIZE bs) {
- const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
- int offset = (mi_row * MI_SIZE) * yv12->y_stride + (mi_col * MI_SIZE);
- unsigned int var, sse;
- var = cpi->fn_ptr[bs].vf(x->plane[0].src.buf,
- x->plane[0].src.stride,
- yv12->y_buffer + offset,
- yv12->y_stride,
- &sse);
- return ROUND_POWER_OF_TWO(var, num_pels_log2_lookup[bs]);
-}
-
-static BLOCK_SIZE get_rd_var_based_fixed_partition(VP9_COMP *cpi,
- int mi_row,
- int mi_col) {
- unsigned int var = get_sby_perpixel_diff_variance(cpi, &cpi->mb,
- mi_row, mi_col,
- BLOCK_64X64);
- if (var < 8)
- return BLOCK_64X64;
- else if (var < 128)
- return BLOCK_32X32;
- else if (var < 2048)
- return BLOCK_16X16;
- else
- return BLOCK_8X8;
-}
-
-static BLOCK_SIZE get_nonrd_var_based_fixed_partition(VP9_COMP *cpi,
- int mi_row,
- int mi_col) {
- unsigned int var = get_sby_perpixel_diff_variance(cpi, &cpi->mb,
- mi_row, mi_col,
- BLOCK_64X64);
- if (var < 4)
- return BLOCK_64X64;
- else if (var < 10)
- return BLOCK_32X32;
- else
- return BLOCK_16X16;
-}
-
-// Lighter version of set_offsets that only sets the mode info
-// pointers.
-static INLINE void set_modeinfo_offsets(VP9_COMMON *const cm,
- MACROBLOCKD *const xd,
- int mi_row,
- int mi_col) {
- const int idx_str = xd->mi_stride * mi_row + mi_col;
- xd->mi = cm->mi_grid_visible + idx_str;
- xd->mi[0] = cm->mi + idx_str;
-}
-
-static int is_block_in_mb_map(const VP9_COMP *cpi, int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- const VP9_COMMON *const cm = &cpi->common;
- const int mb_rows = cm->mb_rows;
- const int mb_cols = cm->mb_cols;
- const int mb_row = mi_row >> 1;
- const int mb_col = mi_col >> 1;
- const int mb_width = num_8x8_blocks_wide_lookup[bsize] >> 1;
- const int mb_height = num_8x8_blocks_high_lookup[bsize] >> 1;
- int r, c;
- if (bsize <= BLOCK_16X16) {
- return cpi->active_map[mb_row * mb_cols + mb_col];
- }
- for (r = 0; r < mb_height; ++r) {
- for (c = 0; c < mb_width; ++c) {
- int row = mb_row + r;
- int col = mb_col + c;
- if (row >= mb_rows || col >= mb_cols)
- continue;
- if (cpi->active_map[row * mb_cols + col])
- return 1;
- }
- }
- return 0;
-}
-
-static int check_active_map(const VP9_COMP *cpi, const MACROBLOCK *x,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- if (cpi->active_map_enabled && !x->e_mbd.lossless) {
- return is_block_in_mb_map(cpi, mi_row, mi_col, bsize);
- } else {
- return 1;
- }
-}
-
-static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile,
- int mi_row, int mi_col, BLOCK_SIZE bsize) {
- MACROBLOCK *const x = &cpi->mb;
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *mbmi;
- const int mi_width = num_8x8_blocks_wide_lookup[bsize];
- const int mi_height = num_8x8_blocks_high_lookup[bsize];
- const int mb_row = mi_row >> 1;
- const int mb_col = mi_col >> 1;
- const int idx_map = mb_row * cm->mb_cols + mb_col;
- const struct segmentation *const seg = &cm->seg;
-
- set_skip_context(xd, mi_row, mi_col);
-
- // Activity map pointer
- x->mb_activity_ptr = &cpi->mb_activity_map[idx_map];
- x->in_active_map = check_active_map(cpi, x, mi_row, mi_col, bsize);
-
- set_modeinfo_offsets(cm, xd, mi_row, mi_col);
-
- mbmi = &xd->mi[0]->mbmi;
-
- // Set up destination pointers.
- vp9_setup_dst_planes(xd, get_frame_new_buffer(cm), mi_row, mi_col);
-
- // Set up limit values for MV components.
- // Mv beyond the range do not produce new/different prediction block.
- x->mv_row_min = -(((mi_row + mi_height) * MI_SIZE) + VP9_INTERP_EXTEND);
- x->mv_col_min = -(((mi_col + mi_width) * MI_SIZE) + VP9_INTERP_EXTEND);
- x->mv_row_max = (cm->mi_rows - mi_row) * MI_SIZE + VP9_INTERP_EXTEND;
- x->mv_col_max = (cm->mi_cols - mi_col) * MI_SIZE + VP9_INTERP_EXTEND;
-
- // Set up distance of MB to edge of frame in 1/8th pel units.
- assert(!(mi_col & (mi_width - 1)) && !(mi_row & (mi_height - 1)));
- set_mi_row_col(xd, tile, mi_row, mi_height, mi_col, mi_width,
- cm->mi_rows, cm->mi_cols);
-
- // Set up source buffers.
- vp9_setup_src_planes(x, cpi->Source, mi_row, mi_col);
-
- // R/D setup.
- x->rddiv = cpi->RDDIV;
- x->rdmult = cpi->RDMULT;
-
- // Setup segment ID.
- if (seg->enabled) {
- if (cpi->oxcf.aq_mode != VARIANCE_AQ) {
- const uint8_t *const map = seg->update_map ? cpi->segmentation_map
- : cm->last_frame_seg_map;
- mbmi->segment_id = vp9_get_segment_id(cm, map, bsize, mi_row, mi_col);
- }
- vp9_init_plane_quantizers(cpi, x);
-
- if (seg->enabled && cpi->seg0_cnt > 0 &&
- !vp9_segfeature_active(seg, 0, SEG_LVL_REF_FRAME) &&
- vp9_segfeature_active(seg, 1, SEG_LVL_REF_FRAME)) {
- cpi->seg0_progress = (cpi->seg0_idx << 16) / cpi->seg0_cnt;
- } else {
- const int y = mb_row & ~3;
- const int x = mb_col & ~3;
- const int p16 = ((mb_row & 1) << 1) + (mb_col & 1);
- const int p32 = ((mb_row & 2) << 2) + ((mb_col & 2) << 1);
- const int tile_progress = tile->mi_col_start * cm->mb_rows >> 1;
- const int mb_cols = (tile->mi_col_end - tile->mi_col_start) >> 1;
-
- cpi->seg0_progress = ((y * mb_cols + x * 4 + p32 + p16 + tile_progress)
- << 16) / cm->MBs;
- }
-
- x->encode_breakout = cpi->segment_encode_breakout[mbmi->segment_id];
- } else {
- mbmi->segment_id = 0;
- x->encode_breakout = cpi->encode_breakout;
- }
-}
-
-static void duplicate_mode_info_in_sb(VP9_COMMON * const cm,
- MACROBLOCKD *const xd,
- int mi_row,
- int mi_col,
- BLOCK_SIZE bsize) {
- const int block_width = num_8x8_blocks_wide_lookup[bsize];
- const int block_height = num_8x8_blocks_high_lookup[bsize];
- int i, j;
- for (j = 0; j < block_height; ++j)
- for (i = 0; i < block_width; ++i) {
- if (mi_row + j < cm->mi_rows && mi_col + i < cm->mi_cols)
- xd->mi[j * xd->mi_stride + i] = xd->mi[0];
- }
-}
-
-static void set_block_size(VP9_COMP * const cpi,
- const TileInfo *const tile,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- if (cpi->common.mi_cols > mi_col && cpi->common.mi_rows > mi_row) {
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- set_modeinfo_offsets(&cpi->common, xd, mi_row, mi_col);
- xd->mi[0]->mbmi.sb_type = bsize;
- duplicate_mode_info_in_sb(&cpi->common, xd, mi_row, mi_col, bsize);
- }
-}
-
-typedef struct {
- int64_t sum_square_error;
- int64_t sum_error;
- int count;
- int variance;
-} var;
-
-typedef struct {
- var none;
- var horz[2];
- var vert[2];
-} partition_variance;
-
-typedef struct {
- partition_variance part_variances;
- var split[4];
-} v8x8;
-
-typedef struct {
- partition_variance part_variances;
- v8x8 split[4];
-} v16x16;
-
-typedef struct {
- partition_variance part_variances;
- v16x16 split[4];
-} v32x32;
-
-typedef struct {
- partition_variance part_variances;
- v32x32 split[4];
-} v64x64;
-
-typedef struct {
- partition_variance *part_variances;
- var *split[4];
-} variance_node;
-
-typedef enum {
- V16X16,
- V32X32,
- V64X64,
-} TREE_LEVEL;
-
-static void tree_to_node(void *data, BLOCK_SIZE bsize, variance_node *node) {
- int i;
- switch (bsize) {
- case BLOCK_64X64: {
- v64x64 *vt = (v64x64 *) data;
- node->part_variances = &vt->part_variances;
- for (i = 0; i < 4; i++)
- node->split[i] = &vt->split[i].part_variances.none;
- break;
- }
- case BLOCK_32X32: {
- v32x32 *vt = (v32x32 *) data;
- node->part_variances = &vt->part_variances;
- for (i = 0; i < 4; i++)
- node->split[i] = &vt->split[i].part_variances.none;
- break;
- }
- case BLOCK_16X16: {
- v16x16 *vt = (v16x16 *) data;
- node->part_variances = &vt->part_variances;
- for (i = 0; i < 4; i++)
- node->split[i] = &vt->split[i].part_variances.none;
- break;
- }
- case BLOCK_8X8: {
- v8x8 *vt = (v8x8 *) data;
- node->part_variances = &vt->part_variances;
- for (i = 0; i < 4; i++)
- node->split[i] = &vt->split[i];
- break;
- }
- default: {
- assert(0);
- }
- }
-}
-
-// Set variance values given sum square error, sum error, count.
-static void fill_variance(int64_t s2, int64_t s, int c, var *v) {
- v->sum_square_error = s2;
- v->sum_error = s;
- v->count = c;
- if (c > 0)
- v->variance = (int)(256 *
- (v->sum_square_error - v->sum_error * v->sum_error /
- v->count) / v->count);
- else
- v->variance = 0;
-}
-
-void sum_2_variances(const var *a, const var *b, var *r) {
- fill_variance(a->sum_square_error + b->sum_square_error,
- a->sum_error + b->sum_error, a->count + b->count, r);
-}
-
-static void fill_variance_tree(void *data, BLOCK_SIZE bsize) {
- variance_node node;
- tree_to_node(data, bsize, &node);
- sum_2_variances(node.split[0], node.split[1], &node.part_variances->horz[0]);
- sum_2_variances(node.split[2], node.split[3], &node.part_variances->horz[1]);
- sum_2_variances(node.split[0], node.split[2], &node.part_variances->vert[0]);
- sum_2_variances(node.split[1], node.split[3], &node.part_variances->vert[1]);
- sum_2_variances(&node.part_variances->vert[0], &node.part_variances->vert[1],
- &node.part_variances->none);
-}
-
-static int set_vt_partitioning(VP9_COMP *cpi,
- void *data,
- const TileInfo *const tile,
- BLOCK_SIZE bsize,
- int mi_row,
- int mi_col,
- int mi_size) {
- VP9_COMMON * const cm = &cpi->common;
- variance_node vt;
- const int block_width = num_8x8_blocks_wide_lookup[bsize];
- const int block_height = num_8x8_blocks_high_lookup[bsize];
- // TODO(debargha): Choose this more intelligently.
- const int64_t threshold_multiplier = 25;
- int64_t threshold = threshold_multiplier * cpi->common.base_qindex;
- assert(block_height == block_width);
-
- tree_to_node(data, bsize, &vt);
-
- // Split none is available only if we have more than half a block size
- // in width and height inside the visible image.
- if (mi_col + block_width / 2 < cm->mi_cols &&
- mi_row + block_height / 2 < cm->mi_rows &&
- vt.part_variances->none.variance < threshold) {
- set_block_size(cpi, tile, mi_row, mi_col, bsize);
- return 1;
- }
-
- // Vertical split is available on all but the bottom border.
- if (mi_row + block_height / 2 < cm->mi_rows &&
- vt.part_variances->vert[0].variance < threshold &&
- vt.part_variances->vert[1].variance < threshold) {
- BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_VERT);
- set_block_size(cpi, tile, mi_row, mi_col, subsize);
- set_block_size(cpi, tile, mi_row, mi_col + block_width / 2, subsize);
- return 1;
- }
-
- // Horizontal split is available on all but the right border.
- if (mi_col + block_width / 2 < cm->mi_cols &&
- vt.part_variances->horz[0].variance < threshold &&
- vt.part_variances->horz[1].variance < threshold) {
- BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_HORZ);
- set_block_size(cpi, tile, mi_row, mi_col, subsize);
- set_block_size(cpi, tile, mi_row + block_height / 2, mi_col, subsize);
- return 1;
- }
- return 0;
-}
-
-// TODO(debargha): Fix this function and make it work as expected.
-static void choose_partitioning(VP9_COMP *cpi,
- const TileInfo *const tile,
- int mi_row, int mi_col) {
- VP9_COMMON * const cm = &cpi->common;
- MACROBLOCK *x = &cpi->mb;
- MACROBLOCKD *xd = &cpi->mb.e_mbd;
-
- int i, j, k;
- v64x64 vt;
- uint8_t *s;
- const uint8_t *d;
- int sp;
- int dp;
- int pixels_wide = 64, pixels_high = 64;
- int_mv nearest_mv, near_mv;
- const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
- const struct scale_factors *const sf = &cm->frame_refs[LAST_FRAME - 1].sf;
-
- vp9_zero(vt);
- set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
-
- 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);
-
- s = x->plane[0].src.buf;
- sp = x->plane[0].src.stride;
-
- if (cm->frame_type != KEY_FRAME) {
- vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col, sf);
-
- xd->mi[0]->mbmi.ref_frame[0] = LAST_FRAME;
- xd->mi[0]->mbmi.sb_type = BLOCK_64X64;
- vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv,
- xd->mi[0]->mbmi.ref_mvs[LAST_FRAME],
- &nearest_mv, &near_mv);
-
- xd->mi[0]->mbmi.mv[0] = nearest_mv;
- vp9_build_inter_predictors_sby(xd, mi_row, mi_col, BLOCK_64X64);
-
- d = xd->plane[0].dst.buf;
- dp = xd->plane[0].dst.stride;
- } else {
- d = VP9_VAR_OFFS;
- dp = 0;
- }
-
- // Fill in the entire tree of 8x8 variances for splits.
- for (i = 0; i < 4; i++) {
- const int x32_idx = ((i & 1) << 5);
- const int y32_idx = ((i >> 1) << 5);
- for (j = 0; j < 4; j++) {
- const int x16_idx = x32_idx + ((j & 1) << 4);
- const int y16_idx = y32_idx + ((j >> 1) << 4);
- v16x16 *vst = &vt.split[i].split[j];
- for (k = 0; k < 4; k++) {
- int x_idx = x16_idx + ((k & 1) << 3);
- int y_idx = y16_idx + ((k >> 1) << 3);
- unsigned int sse = 0;
- int sum = 0;
- if (x_idx < pixels_wide && y_idx < pixels_high)
- vp9_get_sse_sum_8x8(s + y_idx * sp + x_idx, sp,
- d + y_idx * dp + x_idx, dp, &sse, &sum);
- fill_variance(sse, sum, 64, &vst->split[k].part_variances.none);
- }
- }
- }
- // Fill the rest of the variance tree by summing split partition values.
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- fill_variance_tree(&vt.split[i].split[j], BLOCK_16X16);
- }
- fill_variance_tree(&vt.split[i], BLOCK_32X32);
- }
- fill_variance_tree(&vt, BLOCK_64X64);
-
- // Now go through the entire structure, splitting every block size until
- // we get to one that's got a variance lower than our threshold, or we
- // hit 8x8.
- if (!set_vt_partitioning(cpi, &vt, tile, BLOCK_64X64,
- mi_row, mi_col, 8)) {
- for (i = 0; i < 4; ++i) {
- const int x32_idx = ((i & 1) << 2);
- const int y32_idx = ((i >> 1) << 2);
- if (!set_vt_partitioning(cpi, &vt.split[i], tile, BLOCK_32X32,
- (mi_row + y32_idx), (mi_col + x32_idx), 4)) {
- for (j = 0; j < 4; ++j) {
- const int x16_idx = ((j & 1) << 1);
- const int y16_idx = ((j >> 1) << 1);
- // NOTE: This is a temporary hack to disable 8x8 partitions,
- // since it works really bad - possibly due to a bug
-#define DISABLE_8X8_VAR_BASED_PARTITION
-#ifdef DISABLE_8X8_VAR_BASED_PARTITION
- if (mi_row + y32_idx + y16_idx + 1 < cm->mi_rows &&
- mi_row + x32_idx + x16_idx + 1 < cm->mi_cols) {
- set_block_size(cpi, tile,
- (mi_row + y32_idx + y16_idx),
- (mi_col + x32_idx + x16_idx),
- BLOCK_16X16);
- } else {
- for (k = 0; k < 4; ++k) {
- const int x8_idx = (k & 1);
- const int y8_idx = (k >> 1);
- set_block_size(cpi, tile,
- (mi_row + y32_idx + y16_idx + y8_idx),
- (mi_col + x32_idx + x16_idx + x8_idx),
- BLOCK_8X8);
- }
- }
-#else
- if (!set_vt_partitioning(cpi, &vt.split[i].split[j], tile,
- BLOCK_16X16,
- (mi_row + y32_idx + y16_idx),
- (mi_col + x32_idx + x16_idx), 2)) {
- for (k = 0; k < 4; ++k) {
- const int x8_idx = (k & 1);
- const int y8_idx = (k >> 1);
- set_block_size(cpi, tile,
- (mi_row + y32_idx + y16_idx + y8_idx),
- (mi_col + x32_idx + x16_idx + x8_idx),
- BLOCK_8X8);
- }
- }
-#endif
- }
- }
- }
- }
-}
-
-// Original activity measure from Tim T's code.
-static unsigned int tt_activity_measure(MACROBLOCK *x) {
- unsigned int sse;
- // TODO: This could also be done over smaller areas (8x8), but that would
- // require extensive changes elsewhere, as lambda is assumed to be fixed
- // over an entire MB in most of the code.
- // Another option is to compute four 8x8 variances, and pick a single
- // lambda using a non-linear combination (e.g., the smallest, or second
- // smallest, etc.).
- const unsigned int act = vp9_variance16x16(x->plane[0].src.buf,
- x->plane[0].src.stride,
- VP9_VAR_OFFS, 0, &sse) << 4;
- // If the region is flat, lower the activity some more.
- return act < (8 << 12) ? MIN(act, 5 << 12) : act;
-}
-
-// Stub for alternative experimental activity measures.
-static unsigned int alt_activity_measure(MACROBLOCK *x, int use_dc_pred) {
- return vp9_encode_intra(x, use_dc_pred);
-}
-
-// Measure the activity of the current macroblock
-// What we measure here is TBD so abstracted to this function
-#define ALT_ACT_MEASURE 1
-static unsigned int mb_activity_measure(MACROBLOCK *x, int mb_row, int mb_col) {
- unsigned int mb_activity;
-
- if (ALT_ACT_MEASURE) {
- const int use_dc_pred = (mb_col || mb_row) && (!mb_col || !mb_row);
-
- // Or use and alternative.
- mb_activity = alt_activity_measure(x, use_dc_pred);
- } else {
- // Original activity measure from Tim T's code.
- mb_activity = tt_activity_measure(x);
- }
-
- return MAX(mb_activity, ACTIVITY_AVG_MIN);
-}
-
-// Calculate an "average" mb activity value for the frame
-#define ACT_MEDIAN 0
-static void calc_av_activity(VP9_COMP *cpi, int64_t activity_sum) {
-#if ACT_MEDIAN
- // Find median: Simple n^2 algorithm for experimentation
- {
- unsigned int median;
- unsigned int i, j;
- unsigned int *sortlist;
- unsigned int tmp;
-
- // Create a list to sort to
- CHECK_MEM_ERROR(&cpi->common, sortlist, vpx_calloc(sizeof(unsigned int),
- cpi->common.MBs));
-
- // Copy map to sort list
- vpx_memcpy(sortlist, cpi->mb_activity_map,
- sizeof(unsigned int) * cpi->common.MBs);
-
- // Ripple each value down to its correct position
- for (i = 1; i < cpi->common.MBs; i ++) {
- for (j = i; j > 0; j --) {
- if (sortlist[j] < sortlist[j - 1]) {
- // Swap values
- tmp = sortlist[j - 1];
- sortlist[j - 1] = sortlist[j];
- sortlist[j] = tmp;
- } else {
- break;
- }
- }
- }
-
- // Even number MBs so estimate median as mean of two either side.
- median = (1 + sortlist[cpi->common.MBs >> 1] +
- sortlist[(cpi->common.MBs >> 1) + 1]) >> 1;
-
- cpi->activity_avg = median;
-
- vpx_free(sortlist);
- }
-#else
- // Simple mean for now
- cpi->activity_avg = (unsigned int) (activity_sum / cpi->common.MBs);
-#endif // ACT_MEDIAN
-
- if (cpi->activity_avg < ACTIVITY_AVG_MIN)
- cpi->activity_avg = ACTIVITY_AVG_MIN;
-
- // Experimental code: return fixed value normalized for several clips
- if (ALT_ACT_MEASURE)
- cpi->activity_avg = 100000;
-}
-
-#define USE_ACT_INDEX 0
-#define OUTPUT_NORM_ACT_STATS 0
-
-#if USE_ACT_INDEX
-// Calculate an activity index for each mb
-static void calc_activity_index(VP9_COMP *cpi, MACROBLOCK *x) {
- VP9_COMMON *const cm = &cpi->common;
- int mb_row, mb_col;
-
- int64_t act;
- int64_t a;
- int64_t b;
-
-#if OUTPUT_NORM_ACT_STATS
- FILE *f = fopen("norm_act.stt", "a");
- fprintf(f, "\n%12d\n", cpi->activity_avg);
-#endif
-
- // Reset pointers to start of activity map
- x->mb_activity_ptr = cpi->mb_activity_map;
-
- // Calculate normalized mb activity number.
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
- // for each macroblock col in image
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
- // Read activity from the map
- act = *(x->mb_activity_ptr);
-
- // Calculate a normalized activity number
- a = act + 4 * cpi->activity_avg;
- b = 4 * act + cpi->activity_avg;
-
- if (b >= a)
- *(x->activity_ptr) = (int)((b + (a >> 1)) / a) - 1;
- else
- *(x->activity_ptr) = 1 - (int)((a + (b >> 1)) / b);
-
-#if OUTPUT_NORM_ACT_STATS
- fprintf(f, " %6d", *(x->mb_activity_ptr));
-#endif
- // Increment activity map pointers
- x->mb_activity_ptr++;
- }
-
-#if OUTPUT_NORM_ACT_STATS
- fprintf(f, "\n");
-#endif
- }
-
-#if OUTPUT_NORM_ACT_STATS
- fclose(f);
-#endif
-}
-#endif // USE_ACT_INDEX
-
-// Loop through all MBs. Note activity of each, average activity and
-// calculate a normalized activity for each
-static void build_activity_map(VP9_COMP *cpi) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *xd = &x->e_mbd;
- VP9_COMMON *const cm = &cpi->common;
-
-#if ALT_ACT_MEASURE
- YV12_BUFFER_CONFIG *new_yv12 = get_frame_new_buffer(cm);
- int recon_yoffset;
- int recon_y_stride = new_yv12->y_stride;
-#endif
-
- int mb_row, mb_col;
- unsigned int mb_activity;
- int64_t activity_sum = 0;
-
- x->mb_activity_ptr = cpi->mb_activity_map;
-
- // for each macroblock row in image
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
-#if ALT_ACT_MEASURE
- // reset above block coeffs
- xd->up_available = (mb_row != 0);
- recon_yoffset = (mb_row * recon_y_stride * 16);
-#endif
- // for each macroblock col in image
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
-#if ALT_ACT_MEASURE
- xd->plane[0].dst.buf = new_yv12->y_buffer + recon_yoffset;
- xd->left_available = (mb_col != 0);
- recon_yoffset += 16;
-#endif
-
- // measure activity
- mb_activity = mb_activity_measure(x, mb_row, mb_col);
-
- // Keep frame sum
- activity_sum += mb_activity;
-
- // Store MB level activity details.
- *x->mb_activity_ptr = mb_activity;
-
- // Increment activity map pointer
- x->mb_activity_ptr++;
-
- // adjust to the next column of source macroblocks
- x->plane[0].src.buf += 16;
- }
-
- // adjust to the next row of mbs
- x->plane[0].src.buf += 16 * x->plane[0].src.stride - 16 * cm->mb_cols;
- }
-
- // Calculate an "average" MB activity
- calc_av_activity(cpi, activity_sum);
-
-#if USE_ACT_INDEX
- // Calculate an activity index number of each mb
- calc_activity_index(cpi, x);
-#endif
-}
-
-// Macroblock activity masking
-static void activity_masking(VP9_COMP *cpi, MACROBLOCK *x) {
-#if USE_ACT_INDEX
- x->rdmult += *(x->mb_activity_ptr) * (x->rdmult >> 2);
- x->errorperbit = x->rdmult * 100 / (110 * x->rddiv);
- x->errorperbit += (x->errorperbit == 0);
-#else
- const int64_t act = *(x->mb_activity_ptr);
-
- // Apply the masking to the RD multiplier.
- const int64_t a = act + (2 * cpi->activity_avg);
- const int64_t b = (2 * act) + cpi->activity_avg;
-
- x->rdmult = (unsigned int) (((int64_t) x->rdmult * b + (a >> 1)) / a);
- x->errorperbit = x->rdmult * 100 / (110 * x->rddiv);
- x->errorperbit += (x->errorperbit == 0);
-#endif
-
- // Activity based Zbin adjustment
- adjust_act_zbin(cpi, x);
-}
-
-static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
- int mi_row, int mi_col, BLOCK_SIZE bsize,
- int output_enabled) {
- int i, x_idx, y;
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- struct macroblock_plane *const p = x->plane;
- struct macroblockd_plane *const pd = xd->plane;
- MODE_INFO *mi = &ctx->mic;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- MODE_INFO *mi_addr = xd->mi[0];
- const struct segmentation *const seg = &cm->seg;
-
- const int mis = cm->mi_stride;
- const int mi_width = num_8x8_blocks_wide_lookup[bsize];
- const int mi_height = num_8x8_blocks_high_lookup[bsize];
- int max_plane;
-
- assert(mi->mbmi.sb_type == bsize);
-
- *mi_addr = *mi;
-
- // If segmentation in use
- if (seg->enabled && output_enabled) {
- // For in frame complexity AQ copy the segment id from the segment map.
- if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
- const uint8_t *const map = seg->update_map ? cpi->segmentation_map
- : cm->last_frame_seg_map;
- mi_addr->mbmi.segment_id =
- vp9_get_segment_id(cm, map, bsize, mi_row, mi_col);
- }
- // Else for cyclic refresh mode update the segment map, set the segment id
- // and then update the quantizer.
- else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
- vp9_cyclic_refresh_update_segment(cpi, &xd->mi[0]->mbmi,
- mi_row, mi_col, bsize, 1);
- vp9_init_plane_quantizers(cpi, x);
- }
- }
-
- max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1;
- for (i = 0; i < max_plane; ++i) {
- p[i].coeff = ctx->coeff_pbuf[i][1];
- p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
- pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
- p[i].eobs = ctx->eobs_pbuf[i][1];
- }
-
- for (i = max_plane; i < MAX_MB_PLANE; ++i) {
- p[i].coeff = ctx->coeff_pbuf[i][2];
- p[i].qcoeff = ctx->qcoeff_pbuf[i][2];
- pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2];
- p[i].eobs = ctx->eobs_pbuf[i][2];
- }
-
- // Restore the coding context of the MB to that that was in place
- // when the mode was picked for it
- for (y = 0; y < mi_height; y++)
- for (x_idx = 0; x_idx < mi_width; x_idx++)
- if ((xd->mb_to_right_edge >> (3 + MI_SIZE_LOG2)) + mi_width > x_idx
- && (xd->mb_to_bottom_edge >> (3 + MI_SIZE_LOG2)) + mi_height > y) {
- xd->mi[x_idx + y * mis] = mi_addr;
- }
-
- if (cpi->oxcf.aq_mode)
- vp9_init_plane_quantizers(cpi, x);
-
- // FIXME(rbultje) I'm pretty sure this should go to the end of this block
- // (i.e. after the output_enabled)
- if (bsize < BLOCK_32X32) {
- if (bsize < BLOCK_16X16)
- ctx->tx_rd_diff[ALLOW_16X16] = ctx->tx_rd_diff[ALLOW_8X8];
- ctx->tx_rd_diff[ALLOW_32X32] = ctx->tx_rd_diff[ALLOW_16X16];
- }
-
- if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_8X8) {
- mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
- mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
- }
-
- x->skip = ctx->skip;
- vpx_memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk,
- sizeof(uint8_t) * ctx->num_4x4_blk);
-
- if (!output_enabled)
- return;
-
- if (!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
- for (i = 0; i < TX_MODES; i++)
- cpi->rd_tx_select_diff[i] += ctx->tx_rd_diff[i];
- }
-
-#if CONFIG_INTERNAL_STATS
- if (frame_is_intra_only(cm)) {
- static const int kf_mode_index[] = {
- THR_DC /*DC_PRED*/,
- THR_V_PRED /*V_PRED*/,
- THR_H_PRED /*H_PRED*/,
- THR_D45_PRED /*D45_PRED*/,
- THR_D135_PRED /*D135_PRED*/,
- THR_D117_PRED /*D117_PRED*/,
- THR_D153_PRED /*D153_PRED*/,
- THR_D207_PRED /*D207_PRED*/,
- THR_D63_PRED /*D63_PRED*/,
- THR_TM /*TM_PRED*/,
- };
- ++cpi->mode_chosen_counts[kf_mode_index[mbmi->mode]];
- } else {
- // Note how often each mode chosen as best
- ++cpi->mode_chosen_counts[ctx->best_mode_index];
- }
-#endif
- if (!frame_is_intra_only(cm)) {
- if (is_inter_block(mbmi)) {
- vp9_update_mv_count(cm, xd);
-
- if (cm->interp_filter == SWITCHABLE) {
- const int ctx = vp9_get_pred_context_switchable_interp(xd);
- ++cm->counts.switchable_interp[ctx][mbmi->interp_filter];
- }
- }
-
- cpi->rd_comp_pred_diff[SINGLE_REFERENCE] += ctx->single_pred_diff;
- cpi->rd_comp_pred_diff[COMPOUND_REFERENCE] += ctx->comp_pred_diff;
- cpi->rd_comp_pred_diff[REFERENCE_MODE_SELECT] += ctx->hybrid_pred_diff;
-
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
- cpi->rd_filter_diff[i] += ctx->best_filter_diff[i];
- }
-}
-
-void vp9_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src,
- int mi_row, int mi_col) {
- uint8_t *const buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
- src->alpha_buffer};
- const int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
- src->alpha_stride};
- int i;
-
- // Set current frame pointer.
- x->e_mbd.cur_buf = src;
-
- for (i = 0; i < MAX_MB_PLANE; i++)
- setup_pred_plane(&x->plane[i].src, buffers[i], strides[i], mi_row, mi_col,
- NULL, x->e_mbd.plane[i].subsampling_x,
- x->e_mbd.plane[i].subsampling_y);
-}
-
-static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
- int mi_row, int mi_col,
- int *totalrate, int64_t *totaldist,
- BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
- int64_t best_rd) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *mbmi;
- struct macroblock_plane *const p = x->plane;
- struct macroblockd_plane *const pd = xd->plane;
- const AQ_MODE aq_mode = cpi->oxcf.aq_mode;
- int i, orig_rdmult;
- double rdmult_ratio;
-
- vp9_clear_system_state();
- rdmult_ratio = 1.0; // avoid uninitialized warnings
-
- // Use the lower precision, but faster, 32x32 fdct for mode selection.
- x->use_lp32x32fdct = 1;
-
- if (bsize < BLOCK_8X8) {
- // When ab_index = 0 all sub-blocks are handled, so for ab_index != 0
- // there is nothing to be done.
- if (x->ab_index != 0) {
- *totalrate = 0;
- *totaldist = 0;
- return;
- }
- }
-
- set_offsets(cpi, tile, mi_row, mi_col, bsize);
- mbmi = &xd->mi[0]->mbmi;
- mbmi->sb_type = bsize;
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- p[i].coeff = ctx->coeff_pbuf[i][0];
- p[i].qcoeff = ctx->qcoeff_pbuf[i][0];
- pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][0];
- p[i].eobs = ctx->eobs_pbuf[i][0];
- }
- ctx->is_coded = 0;
- x->skip_recode = 0;
-
- // Set to zero to make sure we do not use the previous encoded frame stats
- mbmi->skip = 0;
-
- x->source_variance = get_sby_perpixel_variance(cpi, x, bsize);
-
- if (aq_mode == VARIANCE_AQ) {
- const int energy = bsize <= BLOCK_16X16 ? x->mb_energy
- : vp9_block_energy(cpi, x, bsize);
-
- if (cm->frame_type == KEY_FRAME ||
- cpi->refresh_alt_ref_frame ||
- (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
- mbmi->segment_id = vp9_vaq_segment_id(energy);
- } else {
- const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map
- : cm->last_frame_seg_map;
- mbmi->segment_id = vp9_get_segment_id(cm, map, bsize, mi_row, mi_col);
- }
-
- rdmult_ratio = vp9_vaq_rdmult_ratio(energy);
- vp9_init_plane_quantizers(cpi, x);
- }
-
- // Save rdmult before it might be changed, so it can be restored later.
- orig_rdmult = x->rdmult;
- if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
- activity_masking(cpi, x);
-
- if (aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state();
- x->rdmult = (int)round(x->rdmult * rdmult_ratio);
- } else if (aq_mode == COMPLEXITY_AQ) {
- const int mi_offset = mi_row * cm->mi_cols + mi_col;
- unsigned char complexity = cpi->complexity_map[mi_offset];
- const int is_edge = (mi_row <= 1) || (mi_row >= (cm->mi_rows - 2)) ||
- (mi_col <= 1) || (mi_col >= (cm->mi_cols - 2));
- if (!is_edge && (complexity > 128))
- x->rdmult += ((x->rdmult * (complexity - 128)) / 256);
- } else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
- const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map
- : cm->last_frame_seg_map;
- // If segment 1, use rdmult for that segment.
- if (vp9_get_segment_id(cm, map, bsize, mi_row, mi_col))
- x->rdmult = vp9_cyclic_refresh_get_rdmult(cpi->cyclic_refresh);
- }
-
- // Find best coding mode & reconstruct the MB so it is available
- // as a predictor for MBs that follow in the SB
- if (frame_is_intra_only(cm)) {
- vp9_rd_pick_intra_mode_sb(cpi, x, totalrate, totaldist, bsize, ctx,
- best_rd);
- } else {
- if (bsize >= BLOCK_8X8)
- vp9_rd_pick_inter_mode_sb(cpi, x, tile, mi_row, mi_col,
- totalrate, totaldist, bsize, ctx, best_rd);
- else
- vp9_rd_pick_inter_mode_sub8x8(cpi, x, tile, mi_row, mi_col, totalrate,
- totaldist, bsize, ctx, best_rd);
- }
-
- if (aq_mode == VARIANCE_AQ) {
- x->rdmult = orig_rdmult;
- if (*totalrate != INT_MAX) {
- vp9_clear_system_state();
- *totalrate = (int)round(*totalrate * rdmult_ratio);
- }
- } else if ((cpi->oxcf.aq_mode == COMPLEXITY_AQ) ||
- (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)) {
- x->rdmult = orig_rdmult;
- }
-}
-
-static void update_stats(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- const MACROBLOCK *const x = &cpi->mb;
- const MACROBLOCKD *const xd = &x->e_mbd;
- const MODE_INFO *const mi = xd->mi[0];
- const MB_MODE_INFO *const mbmi = &mi->mbmi;
-
- if (!frame_is_intra_only(cm)) {
- const int seg_ref_active = vp9_segfeature_active(&cm->seg, mbmi->segment_id,
- SEG_LVL_REF_FRAME);
- if (!seg_ref_active) {
- FRAME_COUNTS *const counts = &cm->counts;
- const int inter_block = is_inter_block(mbmi);
-
- counts->intra_inter[vp9_get_intra_inter_context(xd)][inter_block]++;
-
- // If the segment reference feature is enabled we have only a single
- // reference frame allowed for the segment so exclude it from
- // the reference frame counts used to work out probabilities.
- if (inter_block) {
- const MV_REFERENCE_FRAME ref0 = mbmi->ref_frame[0];
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT)
- counts->comp_inter[vp9_get_reference_mode_context(cm, xd)]
- [has_second_ref(mbmi)]++;
-
- if (has_second_ref(mbmi)) {
- counts->comp_ref[vp9_get_pred_context_comp_ref_p(cm, xd)]
- [ref0 == GOLDEN_FRAME]++;
- } else {
- counts->single_ref[vp9_get_pred_context_single_ref_p1(xd)][0]
- [ref0 != LAST_FRAME]++;
- if (ref0 != LAST_FRAME)
- counts->single_ref[vp9_get_pred_context_single_ref_p2(xd)][1]
- [ref0 != GOLDEN_FRAME]++;
- }
- }
- }
- }
-}
-
-static BLOCK_SIZE *get_sb_partitioning(MACROBLOCK *x, BLOCK_SIZE bsize) {
- switch (bsize) {
- case BLOCK_64X64:
- return &x->sb64_partitioning;
- case BLOCK_32X32:
- return &x->sb_partitioning[x->sb_index];
- case BLOCK_16X16:
- return &x->mb_partitioning[x->sb_index][x->mb_index];
- case BLOCK_8X8:
- return &x->b_partitioning[x->sb_index][x->mb_index][x->b_index];
- default:
- assert(0);
- return NULL;
- }
-}
-
-static void restore_context(VP9_COMP *cpi, int mi_row, int mi_col,
- ENTROPY_CONTEXT a[16 * MAX_MB_PLANE],
- ENTROPY_CONTEXT l[16 * MAX_MB_PLANE],
- PARTITION_CONTEXT sa[8], PARTITION_CONTEXT sl[8],
- BLOCK_SIZE bsize) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- int p;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
- int mi_width = num_8x8_blocks_wide_lookup[bsize];
- int mi_height = num_8x8_blocks_high_lookup[bsize];
- for (p = 0; p < MAX_MB_PLANE; p++) {
- vpx_memcpy(
- xd->above_context[p] + ((mi_col * 2) >> xd->plane[p].subsampling_x),
- a + num_4x4_blocks_wide * p,
- (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >>
- xd->plane[p].subsampling_x);
- vpx_memcpy(
- xd->left_context[p]
- + ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y),
- l + num_4x4_blocks_high * p,
- (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
- xd->plane[p].subsampling_y);
- }
- vpx_memcpy(xd->above_seg_context + mi_col, sa,
- sizeof(*xd->above_seg_context) * mi_width);
- vpx_memcpy(xd->left_seg_context + (mi_row & MI_MASK), sl,
- sizeof(xd->left_seg_context[0]) * mi_height);
-}
-static void save_context(VP9_COMP *cpi, int mi_row, int mi_col,
- ENTROPY_CONTEXT a[16 * MAX_MB_PLANE],
- ENTROPY_CONTEXT l[16 * MAX_MB_PLANE],
- PARTITION_CONTEXT sa[8], PARTITION_CONTEXT sl[8],
- BLOCK_SIZE bsize) {
- const MACROBLOCK *const x = &cpi->mb;
- const MACROBLOCKD *const xd = &x->e_mbd;
- int p;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
- int mi_width = num_8x8_blocks_wide_lookup[bsize];
- int mi_height = num_8x8_blocks_high_lookup[bsize];
-
- // buffer the above/left context information of the block in search.
- for (p = 0; p < MAX_MB_PLANE; ++p) {
- vpx_memcpy(
- a + num_4x4_blocks_wide * p,
- xd->above_context[p] + (mi_col * 2 >> xd->plane[p].subsampling_x),
- (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >>
- xd->plane[p].subsampling_x);
- vpx_memcpy(
- l + num_4x4_blocks_high * p,
- xd->left_context[p]
- + ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y),
- (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
- xd->plane[p].subsampling_y);
- }
- vpx_memcpy(sa, xd->above_seg_context + mi_col,
- sizeof(*xd->above_seg_context) * mi_width);
- vpx_memcpy(sl, xd->left_seg_context + (mi_row & MI_MASK),
- sizeof(xd->left_seg_context[0]) * mi_height);
-}
-
-static void encode_b(VP9_COMP *cpi, const TileInfo *const tile,
- TOKENEXTRA **tp, int mi_row, int mi_col,
- int output_enabled, BLOCK_SIZE bsize) {
- MACROBLOCK *const x = &cpi->mb;
-
- if (bsize < BLOCK_8X8) {
- // When ab_index = 0 all sub-blocks are handled, so for ab_index != 0
- // there is nothing to be done.
- if (x->ab_index > 0)
- return;
- }
- set_offsets(cpi, tile, mi_row, mi_col, bsize);
- update_state(cpi, get_block_context(x, bsize), mi_row, mi_col, bsize,
- output_enabled);
- encode_superblock(cpi, tp, output_enabled, mi_row, mi_col, bsize);
-
- if (output_enabled) {
- update_stats(cpi);
-
- (*tp)->token = EOSB_TOKEN;
- (*tp)++;
- }
-}
-
-static void encode_sb(VP9_COMP *cpi, const TileInfo *const tile,
- TOKENEXTRA **tp, int mi_row, int mi_col,
- int output_enabled, BLOCK_SIZE bsize) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
-
- const int bsl = b_width_log2(bsize), hbs = (1 << bsl) / 4;
- int ctx;
- PARTITION_TYPE partition;
- BLOCK_SIZE subsize;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- if (bsize >= BLOCK_8X8) {
- ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
- subsize = *get_sb_partitioning(x, bsize);
- } else {
- ctx = 0;
- subsize = BLOCK_4X4;
- }
-
- partition = partition_lookup[bsl][subsize];
-
- switch (partition) {
- case PARTITION_NONE:
- if (output_enabled && bsize >= BLOCK_8X8)
- cm->counts.partition[ctx][PARTITION_NONE]++;
- encode_b(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- break;
- case PARTITION_VERT:
- if (output_enabled)
- cm->counts.partition[ctx][PARTITION_VERT]++;
- *get_sb_index(x, subsize) = 0;
- encode_b(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- if (mi_col + hbs < cm->mi_cols) {
- *get_sb_index(x, subsize) = 1;
- encode_b(cpi, tile, tp, mi_row, mi_col + hbs, output_enabled, subsize);
- }
- break;
- case PARTITION_HORZ:
- if (output_enabled)
- cm->counts.partition[ctx][PARTITION_HORZ]++;
- *get_sb_index(x, subsize) = 0;
- encode_b(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- if (mi_row + hbs < cm->mi_rows) {
- *get_sb_index(x, subsize) = 1;
- encode_b(cpi, tile, tp, mi_row + hbs, mi_col, output_enabled, subsize);
- }
- break;
- case PARTITION_SPLIT:
- subsize = get_subsize(bsize, PARTITION_SPLIT);
- if (output_enabled)
- cm->counts.partition[ctx][PARTITION_SPLIT]++;
-
- *get_sb_index(x, subsize) = 0;
- encode_sb(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- *get_sb_index(x, subsize) = 1;
- encode_sb(cpi, tile, tp, mi_row, mi_col + hbs, output_enabled, subsize);
- *get_sb_index(x, subsize) = 2;
- encode_sb(cpi, tile, tp, mi_row + hbs, mi_col, output_enabled, subsize);
- *get_sb_index(x, subsize) = 3;
- encode_sb(cpi, tile, tp, mi_row + hbs, mi_col + hbs, output_enabled,
- subsize);
- break;
- default:
- assert("Invalid partition type.");
- }
-
- if (partition != PARTITION_SPLIT || bsize == BLOCK_8X8)
- update_partition_context(xd, mi_row, mi_col, subsize, bsize);
-}
-
-// Check to see if the given partition size is allowed for a specified number
-// of 8x8 block rows and columns remaining in the image.
-// If not then return the largest allowed partition size
-static BLOCK_SIZE find_partition_size(BLOCK_SIZE bsize,
- int rows_left, int cols_left,
- int *bh, int *bw) {
- if (rows_left <= 0 || cols_left <= 0) {
- return MIN(bsize, BLOCK_8X8);
- } else {
- for (; bsize > 0; bsize -= 3) {
- *bh = num_8x8_blocks_high_lookup[bsize];
- *bw = num_8x8_blocks_wide_lookup[bsize];
- if ((*bh <= rows_left) && (*bw <= cols_left)) {
- break;
- }
- }
- }
- return bsize;
-}
-
-// This function attempts to set all mode info entries in a given SB64
-// to the same block partition size.
-// However, at the bottom and right borders of the image the requested size
-// may not be allowed in which case this code attempts to choose the largest
-// allowable partition.
-static void set_fixed_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
- MODE_INFO **mi_8x8, int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- VP9_COMMON *const cm = &cpi->common;
- const int mis = cm->mi_stride;
- int row8x8_remaining = tile->mi_row_end - mi_row;
- int col8x8_remaining = tile->mi_col_end - mi_col;
- int block_row, block_col;
- MODE_INFO *mi_upper_left = cm->mi + mi_row * mis + mi_col;
- int bh = num_8x8_blocks_high_lookup[bsize];
- int bw = num_8x8_blocks_wide_lookup[bsize];
-
- assert((row8x8_remaining > 0) && (col8x8_remaining > 0));
-
- // Apply the requested partition size to the SB64 if it is all "in image"
- if ((col8x8_remaining >= MI_BLOCK_SIZE) &&
- (row8x8_remaining >= MI_BLOCK_SIZE)) {
- for (block_row = 0; block_row < MI_BLOCK_SIZE; block_row += bh) {
- for (block_col = 0; block_col < MI_BLOCK_SIZE; block_col += bw) {
- int index = block_row * mis + block_col;
- mi_8x8[index] = mi_upper_left + index;
- mi_8x8[index]->mbmi.sb_type = bsize;
- }
- }
- } else {
- // Else this is a partial SB64.
- for (block_row = 0; block_row < MI_BLOCK_SIZE; block_row += bh) {
- for (block_col = 0; block_col < MI_BLOCK_SIZE; block_col += bw) {
- int index = block_row * mis + block_col;
- // Find a partition size that fits
- bsize = find_partition_size(bsize,
- (row8x8_remaining - block_row),
- (col8x8_remaining - block_col), &bh, &bw);
- mi_8x8[index] = mi_upper_left + index;
- mi_8x8[index]->mbmi.sb_type = bsize;
- }
- }
- }
-}
-
-static void copy_partitioning(VP9_COMMON *cm, MODE_INFO **mi_8x8,
- MODE_INFO **prev_mi_8x8) {
- const int mis = cm->mi_stride;
- int block_row, block_col;
-
- for (block_row = 0; block_row < 8; ++block_row) {
- for (block_col = 0; block_col < 8; ++block_col) {
- MODE_INFO *const prev_mi = prev_mi_8x8[block_row * mis + block_col];
- const BLOCK_SIZE sb_type = prev_mi ? prev_mi->mbmi.sb_type : 0;
-
- if (prev_mi) {
- const ptrdiff_t offset = prev_mi - cm->prev_mi;
- mi_8x8[block_row * mis + block_col] = cm->mi + offset;
- mi_8x8[block_row * mis + block_col]->mbmi.sb_type = sb_type;
- }
- }
- }
-}
-
-static int sb_has_motion(const VP9_COMMON *cm, MODE_INFO **prev_mi_8x8) {
- const int mis = cm->mi_stride;
- int block_row, block_col;
-
- if (cm->prev_mi) {
- for (block_row = 0; block_row < 8; ++block_row) {
- for (block_col = 0; block_col < 8; ++block_col) {
- const MODE_INFO *prev_mi = prev_mi_8x8[block_row * mis + block_col];
- if (prev_mi) {
- if (abs(prev_mi->mbmi.mv[0].as_mv.row) >= 8 ||
- abs(prev_mi->mbmi.mv[0].as_mv.col) >= 8)
- return 1;
- }
- }
- }
- }
- return 0;
-}
-
-static void update_state_rt(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
- int mi_row, int mi_col, int bsize) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- const struct segmentation *const seg = &cm->seg;
-
- *(xd->mi[0]) = ctx->mic;
-
- // For in frame adaptive Q, check for reseting the segment_id and updating
- // the cyclic refresh map.
- if ((cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) && seg->enabled) {
- vp9_cyclic_refresh_update_segment(cpi, &xd->mi[0]->mbmi,
- mi_row, mi_col, bsize, 1);
- vp9_init_plane_quantizers(cpi, x);
- }
-
- if (is_inter_block(mbmi)) {
- vp9_update_mv_count(cm, xd);
-
- if (cm->interp_filter == SWITCHABLE) {
- const int pred_ctx = vp9_get_pred_context_switchable_interp(xd);
- ++cm->counts.switchable_interp[pred_ctx][mbmi->interp_filter];
- }
- }
-
- x->skip = ctx->skip;
-}
-
-static void encode_b_rt(VP9_COMP *cpi, const TileInfo *const tile,
- TOKENEXTRA **tp, int mi_row, int mi_col,
- int output_enabled, BLOCK_SIZE bsize) {
- MACROBLOCK *const x = &cpi->mb;
-
- if (bsize < BLOCK_8X8) {
- // When ab_index = 0 all sub-blocks are handled, so for ab_index != 0
- // there is nothing to be done.
- if (x->ab_index > 0)
- return;
- }
-
- set_offsets(cpi, tile, mi_row, mi_col, bsize);
- update_state_rt(cpi, get_block_context(x, bsize), mi_row, mi_col, bsize);
-
- encode_superblock(cpi, tp, output_enabled, mi_row, mi_col, bsize);
- update_stats(cpi);
-
- (*tp)->token = EOSB_TOKEN;
- (*tp)++;
-}
-
-static void encode_sb_rt(VP9_COMP *cpi, const TileInfo *const tile,
- TOKENEXTRA **tp, int mi_row, int mi_col,
- int output_enabled, BLOCK_SIZE bsize) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
-
- const int bsl = b_width_log2(bsize), hbs = (1 << bsl) / 4;
- int ctx;
- PARTITION_TYPE partition;
- BLOCK_SIZE subsize;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- if (bsize >= BLOCK_8X8) {
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- const int idx_str = xd->mi_stride * mi_row + mi_col;
- MODE_INFO ** mi_8x8 = cm->mi_grid_visible + idx_str;
- ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
- subsize = mi_8x8[0]->mbmi.sb_type;
- } else {
- ctx = 0;
- subsize = BLOCK_4X4;
- }
-
- partition = partition_lookup[bsl][subsize];
-
- switch (partition) {
- case PARTITION_NONE:
- if (output_enabled && bsize >= BLOCK_8X8)
- cm->counts.partition[ctx][PARTITION_NONE]++;
- encode_b_rt(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- break;
- case PARTITION_VERT:
- if (output_enabled)
- cm->counts.partition[ctx][PARTITION_VERT]++;
- *get_sb_index(x, subsize) = 0;
- encode_b_rt(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- if (mi_col + hbs < cm->mi_cols) {
- *get_sb_index(x, subsize) = 1;
- encode_b_rt(cpi, tile, tp, mi_row, mi_col + hbs, output_enabled,
- subsize);
- }
- break;
- case PARTITION_HORZ:
- if (output_enabled)
- cm->counts.partition[ctx][PARTITION_HORZ]++;
- *get_sb_index(x, subsize) = 0;
- encode_b_rt(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- if (mi_row + hbs < cm->mi_rows) {
- *get_sb_index(x, subsize) = 1;
- encode_b_rt(cpi, tile, tp, mi_row + hbs, mi_col, output_enabled,
- subsize);
- }
- break;
- case PARTITION_SPLIT:
- subsize = get_subsize(bsize, PARTITION_SPLIT);
- if (output_enabled)
- cm->counts.partition[ctx][PARTITION_SPLIT]++;
-
- *get_sb_index(x, subsize) = 0;
- encode_sb_rt(cpi, tile, tp, mi_row, mi_col, output_enabled, subsize);
- *get_sb_index(x, subsize) = 1;
- encode_sb_rt(cpi, tile, tp, mi_row, mi_col + hbs, output_enabled,
- subsize);
- *get_sb_index(x, subsize) = 2;
- encode_sb_rt(cpi, tile, tp, mi_row + hbs, mi_col, output_enabled,
- subsize);
- *get_sb_index(x, subsize) = 3;
- encode_sb_rt(cpi, tile, tp, mi_row + hbs, mi_col + hbs, output_enabled,
- subsize);
- break;
- default:
- assert("Invalid partition type.");
- }
-
- if (partition != PARTITION_SPLIT || bsize == BLOCK_8X8)
- update_partition_context(xd, mi_row, mi_col, subsize, bsize);
-}
-
-static void rd_use_partition(VP9_COMP *cpi,
- const TileInfo *const tile,
- MODE_INFO **mi_8x8,
- TOKENEXTRA **tp, int mi_row, int mi_col,
- BLOCK_SIZE bsize, int *rate, int64_t *dist,
- int do_recon) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- const int mis = cm->mi_stride;
- const int bsl = b_width_log2(bsize);
- const int mi_step = num_4x4_blocks_wide_lookup[bsize] / 2;
- const int bss = (1 << bsl) / 4;
- int i, pl;
- PARTITION_TYPE partition = PARTITION_NONE;
- BLOCK_SIZE subsize;
- ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], a[16 * MAX_MB_PLANE];
- PARTITION_CONTEXT sl[8], sa[8];
- int last_part_rate = INT_MAX;
- int64_t last_part_dist = INT64_MAX;
- int64_t last_part_rd = INT64_MAX;
- int none_rate = INT_MAX;
- int64_t none_dist = INT64_MAX;
- int64_t none_rd = INT64_MAX;
- int chosen_rate = INT_MAX;
- int64_t chosen_dist = INT64_MAX;
- int64_t chosen_rd = INT64_MAX;
- BLOCK_SIZE sub_subsize = BLOCK_4X4;
- int splits_below = 0;
- BLOCK_SIZE bs_type = mi_8x8[0]->mbmi.sb_type;
- int do_partition_search = 1;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- assert(num_4x4_blocks_wide_lookup[bsize] ==
- num_4x4_blocks_high_lookup[bsize]);
-
- partition = partition_lookup[bsl][bs_type];
- subsize = get_subsize(bsize, partition);
-
- if (bsize < BLOCK_8X8) {
- // When ab_index = 0 all sub-blocks are handled, so for ab_index != 0
- // there is nothing to be done.
- if (x->ab_index != 0) {
- *rate = 0;
- *dist = 0;
- return;
- }
- } else {
- *(get_sb_partitioning(x, bsize)) = subsize;
- }
- save_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
-
- if (bsize == BLOCK_16X16) {
- set_offsets(cpi, tile, mi_row, mi_col, bsize);
- x->mb_energy = vp9_block_energy(cpi, x, bsize);
- } else {
- x->in_active_map = check_active_map(cpi, x, mi_row, mi_col, bsize);
- }
-
- if (!x->in_active_map) {
- do_partition_search = 0;
- if (mi_row + (mi_step >> 1) < cm->mi_rows &&
- mi_col + (mi_step >> 1) < cm->mi_cols) {
- *(get_sb_partitioning(x, bsize)) = bsize;
- bs_type = mi_8x8[0]->mbmi.sb_type = bsize;
- subsize = bsize;
- partition = PARTITION_NONE;
- }
- }
- if (do_partition_search &&
- cpi->sf.partition_search_type == SEARCH_PARTITION &&
- cpi->sf.adjust_partitioning_from_last_frame) {
- // Check if any of the sub blocks are further split.
- if (partition == PARTITION_SPLIT && subsize > BLOCK_8X8) {
- sub_subsize = get_subsize(subsize, PARTITION_SPLIT);
- splits_below = 1;
- for (i = 0; i < 4; i++) {
- int jj = i >> 1, ii = i & 0x01;
- MODE_INFO * this_mi = mi_8x8[jj * bss * mis + ii * bss];
- if (this_mi && this_mi->mbmi.sb_type >= sub_subsize) {
- splits_below = 0;
- }
- }
- }
-
- // If partition is not none try none unless each of the 4 splits are split
- // even further..
- if (partition != PARTITION_NONE && !splits_below &&
- mi_row + (mi_step >> 1) < cm->mi_rows &&
- mi_col + (mi_step >> 1) < cm->mi_cols) {
- *(get_sb_partitioning(x, bsize)) = bsize;
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &none_rate, &none_dist, bsize,
- get_block_context(x, bsize), INT64_MAX);
-
- pl = partition_plane_context(xd, mi_row, mi_col, bsize);
-
- if (none_rate < INT_MAX) {
- none_rate += x->partition_cost[pl][PARTITION_NONE];
- none_rd = RDCOST(x->rdmult, x->rddiv, none_rate, none_dist);
- }
-
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
- mi_8x8[0]->mbmi.sb_type = bs_type;
- *(get_sb_partitioning(x, bsize)) = subsize;
- }
- }
-
- switch (partition) {
- case PARTITION_NONE:
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &last_part_rate,
- &last_part_dist, bsize,
- get_block_context(x, bsize), INT64_MAX);
- break;
- case PARTITION_HORZ:
- *get_sb_index(x, subsize) = 0;
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &last_part_rate,
- &last_part_dist, subsize,
- get_block_context(x, subsize), INT64_MAX);
- if (last_part_rate != INT_MAX &&
- bsize >= BLOCK_8X8 && mi_row + (mi_step >> 1) < cm->mi_rows) {
- int rt = 0;
- int64_t dt = 0;
- update_state(cpi, get_block_context(x, subsize), mi_row, mi_col,
- subsize, 0);
- encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize);
- *get_sb_index(x, subsize) = 1;
- rd_pick_sb_modes(cpi, tile, mi_row + (mi_step >> 1), mi_col, &rt, &dt,
- subsize, get_block_context(x, subsize), INT64_MAX);
- if (rt == INT_MAX || dt == INT64_MAX) {
- last_part_rate = INT_MAX;
- last_part_dist = INT64_MAX;
- break;
- }
-
- last_part_rate += rt;
- last_part_dist += dt;
- }
- break;
- case PARTITION_VERT:
- *get_sb_index(x, subsize) = 0;
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &last_part_rate,
- &last_part_dist, subsize,
- get_block_context(x, subsize), INT64_MAX);
- if (last_part_rate != INT_MAX &&
- bsize >= BLOCK_8X8 && mi_col + (mi_step >> 1) < cm->mi_cols) {
- int rt = 0;
- int64_t dt = 0;
- update_state(cpi, get_block_context(x, subsize), mi_row, mi_col,
- subsize, 0);
- encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize);
- *get_sb_index(x, subsize) = 1;
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col + (mi_step >> 1), &rt, &dt,
- subsize, get_block_context(x, subsize), INT64_MAX);
- if (rt == INT_MAX || dt == INT64_MAX) {
- last_part_rate = INT_MAX;
- last_part_dist = INT64_MAX;
- break;
- }
- last_part_rate += rt;
- last_part_dist += dt;
- }
- break;
- case PARTITION_SPLIT:
- // Split partition.
- last_part_rate = 0;
- last_part_dist = 0;
- for (i = 0; i < 4; i++) {
- int x_idx = (i & 1) * (mi_step >> 1);
- int y_idx = (i >> 1) * (mi_step >> 1);
- int jj = i >> 1, ii = i & 0x01;
- int rt;
- int64_t dt;
-
- if ((mi_row + y_idx >= cm->mi_rows) || (mi_col + x_idx >= cm->mi_cols))
- continue;
-
- *get_sb_index(x, subsize) = i;
-
- rd_use_partition(cpi, tile, mi_8x8 + jj * bss * mis + ii * bss, tp,
- mi_row + y_idx, mi_col + x_idx, subsize, &rt, &dt,
- i != 3);
- if (rt == INT_MAX || dt == INT64_MAX) {
- last_part_rate = INT_MAX;
- last_part_dist = INT64_MAX;
- break;
- }
- last_part_rate += rt;
- last_part_dist += dt;
- }
- break;
- default:
- assert(0);
- }
-
- pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- if (last_part_rate < INT_MAX) {
- last_part_rate += x->partition_cost[pl][partition];
- last_part_rd = RDCOST(x->rdmult, x->rddiv, last_part_rate, last_part_dist);
- }
-
- if (do_partition_search
- && cpi->sf.adjust_partitioning_from_last_frame
- && cpi->sf.partition_search_type == SEARCH_PARTITION
- && partition != PARTITION_SPLIT && bsize > BLOCK_8X8
- && (mi_row + mi_step < cm->mi_rows ||
- mi_row + (mi_step >> 1) == cm->mi_rows)
- && (mi_col + mi_step < cm->mi_cols ||
- mi_col + (mi_step >> 1) == cm->mi_cols)) {
- BLOCK_SIZE split_subsize = get_subsize(bsize, PARTITION_SPLIT);
- chosen_rate = 0;
- chosen_dist = 0;
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
-
- // Split partition.
- for (i = 0; i < 4; i++) {
- int x_idx = (i & 1) * (mi_step >> 1);
- int y_idx = (i >> 1) * (mi_step >> 1);
- int rt = 0;
- int64_t dt = 0;
- ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], a[16 * MAX_MB_PLANE];
- PARTITION_CONTEXT sl[8], sa[8];
-
- if ((mi_row + y_idx >= cm->mi_rows) || (mi_col + x_idx >= cm->mi_cols))
- continue;
-
- *get_sb_index(x, split_subsize) = i;
- *get_sb_partitioning(x, bsize) = split_subsize;
- *get_sb_partitioning(x, split_subsize) = split_subsize;
-
- save_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
-
- rd_pick_sb_modes(cpi, tile, mi_row + y_idx, mi_col + x_idx, &rt, &dt,
- split_subsize, get_block_context(x, split_subsize),
- INT64_MAX);
-
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
-
- if (rt == INT_MAX || dt == INT64_MAX) {
- chosen_rate = INT_MAX;
- chosen_dist = INT64_MAX;
- break;
- }
-
- chosen_rate += rt;
- chosen_dist += dt;
-
- if (i != 3)
- encode_sb(cpi, tile, tp, mi_row + y_idx, mi_col + x_idx, 0,
- split_subsize);
-
- pl = partition_plane_context(xd, mi_row + y_idx, mi_col + x_idx,
- split_subsize);
- chosen_rate += x->partition_cost[pl][PARTITION_NONE];
- }
- pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- if (chosen_rate < INT_MAX) {
- chosen_rate += x->partition_cost[pl][PARTITION_SPLIT];
- chosen_rd = RDCOST(x->rdmult, x->rddiv, chosen_rate, chosen_dist);
- }
- }
-
- // If last_part is better set the partitioning to that...
- if (last_part_rd < chosen_rd) {
- mi_8x8[0]->mbmi.sb_type = bsize;
- if (bsize >= BLOCK_8X8)
- *(get_sb_partitioning(x, bsize)) = subsize;
- chosen_rate = last_part_rate;
- chosen_dist = last_part_dist;
- chosen_rd = last_part_rd;
- }
- // If none was better set the partitioning to that...
- if (none_rd < chosen_rd) {
- if (bsize >= BLOCK_8X8)
- *(get_sb_partitioning(x, bsize)) = bsize;
- chosen_rate = none_rate;
- chosen_dist = none_dist;
- }
-
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
-
- // We must have chosen a partitioning and encoding or we'll fail later on.
- // No other opportunities for success.
- if ( bsize == BLOCK_64X64)
- assert(chosen_rate < INT_MAX && chosen_dist < INT64_MAX);
-
- if (do_recon) {
- int output_enabled = (bsize == BLOCK_64X64);
-
- // Check the projected output rate for this SB against it's target
- // and and if necessary apply a Q delta using segmentation to get
- // closer to the target.
- if ((cpi->oxcf.aq_mode == COMPLEXITY_AQ) && cm->seg.update_map) {
- vp9_select_in_frame_q_segment(cpi, mi_row, mi_col,
- output_enabled, chosen_rate);
- }
-
- if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
- vp9_cyclic_refresh_set_rate_and_dist_sb(cpi->cyclic_refresh,
- chosen_rate, chosen_dist);
-
- encode_sb(cpi, tile, tp, mi_row, mi_col, output_enabled, bsize);
- }
-
- *rate = chosen_rate;
- *dist = chosen_dist;
-}
-
-static const BLOCK_SIZE min_partition_size[BLOCK_SIZES] = {
- BLOCK_4X4, BLOCK_4X4, BLOCK_4X4,
- BLOCK_4X4, BLOCK_4X4, BLOCK_4X4,
- BLOCK_8X8, BLOCK_8X8, BLOCK_8X8,
- BLOCK_16X16, BLOCK_16X16, BLOCK_16X16,
- BLOCK_16X16
-};
-
-static const BLOCK_SIZE max_partition_size[BLOCK_SIZES] = {
- BLOCK_8X8, BLOCK_16X16, BLOCK_16X16,
- BLOCK_16X16, BLOCK_32X32, BLOCK_32X32,
- BLOCK_32X32, BLOCK_64X64, BLOCK_64X64,
- BLOCK_64X64, BLOCK_64X64, BLOCK_64X64,
- BLOCK_64X64
-};
-
-// Look at all the mode_info entries for blocks that are part of this
-// partition and find the min and max values for sb_type.
-// At the moment this is designed to work on a 64x64 SB but could be
-// adjusted to use a size parameter.
-//
-// The min and max are assumed to have been initialized prior to calling this
-// function so repeat calls can accumulate a min and max of more than one sb64.
-static void get_sb_partition_size_range(VP9_COMP *cpi, MODE_INFO ** mi_8x8,
- BLOCK_SIZE * min_block_size,
- BLOCK_SIZE * max_block_size ) {
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- int sb_width_in_blocks = MI_BLOCK_SIZE;
- int sb_height_in_blocks = MI_BLOCK_SIZE;
- int i, j;
- int index = 0;
-
- // Check the sb_type for each block that belongs to this region.
- for (i = 0; i < sb_height_in_blocks; ++i) {
- for (j = 0; j < sb_width_in_blocks; ++j) {
- MODE_INFO * mi = mi_8x8[index+j];
- BLOCK_SIZE sb_type = mi ? mi->mbmi.sb_type : 0;
- *min_block_size = MIN(*min_block_size, sb_type);
- *max_block_size = MAX(*max_block_size, sb_type);
- }
- index += xd->mi_stride;
- }
-}
-
-// Next square block size less or equal than current block size.
-static const BLOCK_SIZE next_square_size[BLOCK_SIZES] = {
- BLOCK_4X4, BLOCK_4X4, BLOCK_4X4,
- BLOCK_8X8, BLOCK_8X8, BLOCK_8X8,
- BLOCK_16X16, BLOCK_16X16, BLOCK_16X16,
- BLOCK_32X32, BLOCK_32X32, BLOCK_32X32,
- BLOCK_64X64
-};
-
-// Look at neighboring blocks and set a min and max partition size based on
-// what they chose.
-static void rd_auto_partition_range(VP9_COMP *cpi, const TileInfo *const tile,
- int mi_row, int mi_col,
- BLOCK_SIZE *min_block_size,
- BLOCK_SIZE *max_block_size) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- MODE_INFO **mi_8x8 = xd->mi;
- const int left_in_image = xd->left_available && mi_8x8[-1];
- const int above_in_image = xd->up_available &&
- mi_8x8[-xd->mi_stride];
- MODE_INFO **above_sb64_mi_8x8;
- MODE_INFO **left_sb64_mi_8x8;
-
- int row8x8_remaining = tile->mi_row_end - mi_row;
- int col8x8_remaining = tile->mi_col_end - mi_col;
- int bh, bw;
- BLOCK_SIZE min_size = BLOCK_4X4;
- BLOCK_SIZE max_size = BLOCK_64X64;
- // Trap case where we do not have a prediction.
- if (left_in_image || above_in_image || cm->frame_type != KEY_FRAME) {
- // Default "min to max" and "max to min"
- min_size = BLOCK_64X64;
- max_size = BLOCK_4X4;
-
- // NOTE: each call to get_sb_partition_size_range() uses the previous
- // passed in values for min and max as a starting point.
- // Find the min and max partition used in previous frame at this location
- if (cm->frame_type != KEY_FRAME) {
- MODE_INFO **const prev_mi =
- &cm->prev_mi_grid_visible[mi_row * xd->mi_stride + mi_col];
- get_sb_partition_size_range(cpi, prev_mi, &min_size, &max_size);
- }
- // Find the min and max partition sizes used in the left SB64
- if (left_in_image) {
- left_sb64_mi_8x8 = &mi_8x8[-MI_BLOCK_SIZE];
- get_sb_partition_size_range(cpi, left_sb64_mi_8x8,
- &min_size, &max_size);
- }
- // Find the min and max partition sizes used in the above SB64.
- if (above_in_image) {
- above_sb64_mi_8x8 = &mi_8x8[-xd->mi_stride * MI_BLOCK_SIZE];
- get_sb_partition_size_range(cpi, above_sb64_mi_8x8,
- &min_size, &max_size);
- }
- // adjust observed min and max
- if (cpi->sf.auto_min_max_partition_size == RELAXED_NEIGHBORING_MIN_MAX) {
- min_size = min_partition_size[min_size];
- max_size = max_partition_size[max_size];
- }
- }
-
- // Check border cases where max and min from neighbors may not be legal.
- max_size = find_partition_size(max_size,
- row8x8_remaining, col8x8_remaining,
- &bh, &bw);
- min_size = MIN(min_size, max_size);
-
- // When use_square_partition_only is true, make sure at least one square
- // partition is allowed by selecting the next smaller square size as
- // *min_block_size.
- if (cpi->sf.use_square_partition_only &&
- next_square_size[max_size] < min_size) {
- min_size = next_square_size[max_size];
- }
- *min_block_size = min_size;
- *max_block_size = max_size;
-}
-
-static INLINE void store_pred_mv(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx) {
- vpx_memcpy(ctx->pred_mv, x->pred_mv, sizeof(x->pred_mv));
-}
-
-static INLINE void load_pred_mv(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx) {
- vpx_memcpy(x->pred_mv, ctx->pred_mv, sizeof(x->pred_mv));
-}
-
-// TODO(jingning,jimbankoski,rbultje): properly skip partition types that are
-// unlikely to be selected depending on previous rate-distortion optimization
-// results, for encoding speed-up.
-static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
- TOKENEXTRA **tp, int mi_row,
- int mi_col, BLOCK_SIZE bsize, int *rate,
- int64_t *dist, int do_recon, int64_t best_rd) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- const int mi_step = num_8x8_blocks_wide_lookup[bsize] / 2;
- ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], a[16 * MAX_MB_PLANE];
- PARTITION_CONTEXT sl[8], sa[8];
- TOKENEXTRA *tp_orig = *tp;
- PICK_MODE_CONTEXT *ctx = get_block_context(x, bsize);
- int i, pl;
- BLOCK_SIZE subsize;
- int this_rate, sum_rate = 0, best_rate = INT_MAX;
- int64_t this_dist, sum_dist = 0, best_dist = INT64_MAX;
- int64_t sum_rd = 0;
- int do_split = bsize >= BLOCK_8X8;
- int do_rect = 1;
- // Override skipping rectangular partition operations for edge blocks
- const int force_horz_split = (mi_row + mi_step >= cm->mi_rows);
- const int force_vert_split = (mi_col + mi_step >= cm->mi_cols);
- const int xss = x->e_mbd.plane[1].subsampling_x;
- const int yss = x->e_mbd.plane[1].subsampling_y;
-
- int partition_none_allowed = !force_horz_split && !force_vert_split;
- int partition_horz_allowed = !force_vert_split && yss <= xss &&
- bsize >= BLOCK_8X8;
- int partition_vert_allowed = !force_horz_split && xss <= yss &&
- bsize >= BLOCK_8X8;
- (void) *tp_orig;
-
- if (bsize < BLOCK_8X8) {
- // When ab_index = 0 all sub-blocks are handled, so for ab_index != 0
- // there is nothing to be done.
- if (x->ab_index != 0) {
- *rate = 0;
- *dist = 0;
- return;
- }
- }
- assert(num_8x8_blocks_wide_lookup[bsize] ==
- num_8x8_blocks_high_lookup[bsize]);
-
- if (bsize == BLOCK_16X16) {
- set_offsets(cpi, tile, mi_row, mi_col, bsize);
- x->mb_energy = vp9_block_energy(cpi, x, bsize);
- } else {
- x->in_active_map = check_active_map(cpi, x, mi_row, mi_col, bsize);
- }
-
- // Determine partition types in search according to the speed features.
- // The threshold set here has to be of square block size.
- if (cpi->sf.auto_min_max_partition_size) {
- partition_none_allowed &= (bsize <= cpi->sf.max_partition_size &&
- bsize >= cpi->sf.min_partition_size);
- partition_horz_allowed &= ((bsize <= cpi->sf.max_partition_size &&
- bsize > cpi->sf.min_partition_size) ||
- force_horz_split);
- partition_vert_allowed &= ((bsize <= cpi->sf.max_partition_size &&
- bsize > cpi->sf.min_partition_size) ||
- force_vert_split);
- do_split &= bsize > cpi->sf.min_partition_size;
- }
- if (cpi->sf.use_square_partition_only) {
- partition_horz_allowed &= force_horz_split;
- partition_vert_allowed &= force_vert_split;
- }
-
- save_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
-
- if (cpi->sf.disable_split_var_thresh && partition_none_allowed) {
- unsigned int source_variancey;
- vp9_setup_src_planes(x, cpi->Source, mi_row, mi_col);
- source_variancey = get_sby_perpixel_variance(cpi, x, bsize);
- if (source_variancey < cpi->sf.disable_split_var_thresh) {
- do_split = 0;
- if (source_variancey < cpi->sf.disable_split_var_thresh / 2)
- do_rect = 0;
- }
- }
-
- if (!x->in_active_map && (partition_horz_allowed || partition_vert_allowed))
- do_split = 0;
- // PARTITION_NONE
- if (partition_none_allowed) {
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &this_rate, &this_dist, bsize,
- ctx, best_rd);
- if (this_rate != INT_MAX) {
- if (bsize >= BLOCK_8X8) {
- pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- this_rate += x->partition_cost[pl][PARTITION_NONE];
- }
- sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist);
- if (sum_rd < best_rd) {
- int64_t stop_thresh = 4096;
- int64_t stop_thresh_rd;
-
- best_rate = this_rate;
- best_dist = this_dist;
- best_rd = sum_rd;
- if (bsize >= BLOCK_8X8)
- *(get_sb_partitioning(x, bsize)) = bsize;
-
- // Adjust threshold according to partition size.
- stop_thresh >>= 8 - (b_width_log2_lookup[bsize] +
- b_height_log2_lookup[bsize]);
-
- stop_thresh_rd = RDCOST(x->rdmult, x->rddiv, 0, stop_thresh);
- // If obtained distortion is very small, choose current partition
- // and stop splitting.
- if (!x->e_mbd.lossless && best_rd < stop_thresh_rd) {
- do_split = 0;
- do_rect = 0;
- }
- }
- }
- if (!x->in_active_map) {
- do_split = 0;
- do_rect = 0;
- }
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
- }
-
- // store estimated motion vector
- if (cpi->sf.adaptive_motion_search)
- store_pred_mv(x, ctx);
-
- // PARTITION_SPLIT
- sum_rd = 0;
- // TODO(jingning): use the motion vectors given by the above search as
- // the starting point of motion search in the following partition type check.
- if (do_split) {
- subsize = get_subsize(bsize, PARTITION_SPLIT);
- for (i = 0; i < 4 && sum_rd < best_rd; ++i) {
- const int x_idx = (i & 1) * mi_step;
- const int y_idx = (i >> 1) * mi_step;
-
- if (mi_row + y_idx >= cm->mi_rows || mi_col + x_idx >= cm->mi_cols)
- continue;
-
- *get_sb_index(x, subsize) = i;
- if (cpi->sf.adaptive_motion_search)
- load_pred_mv(x, ctx);
- if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
- partition_none_allowed)
- get_block_context(x, subsize)->pred_interp_filter =
- ctx->mic.mbmi.interp_filter;
- rd_pick_partition(cpi, tile, tp, mi_row + y_idx, mi_col + x_idx, subsize,
- &this_rate, &this_dist, i != 3, best_rd - sum_rd);
-
- if (this_rate == INT_MAX) {
- sum_rd = INT64_MAX;
- } else {
- sum_rate += this_rate;
- sum_dist += this_dist;
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- }
- }
- if (sum_rd < best_rd && i == 4) {
- pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- sum_rate += x->partition_cost[pl][PARTITION_SPLIT];
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- if (sum_rd < best_rd) {
- best_rate = sum_rate;
- best_dist = sum_dist;
- best_rd = sum_rd;
- *(get_sb_partitioning(x, bsize)) = subsize;
- }
- } else {
- // skip rectangular partition test when larger block size
- // gives better rd cost
- if (cpi->sf.less_rectangular_check)
- do_rect &= !partition_none_allowed;
- }
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
- }
-
- // PARTITION_HORZ
- if (partition_horz_allowed && do_rect) {
- subsize = get_subsize(bsize, PARTITION_HORZ);
- *get_sb_index(x, subsize) = 0;
- if (cpi->sf.adaptive_motion_search)
- load_pred_mv(x, ctx);
- if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
- partition_none_allowed)
- get_block_context(x, subsize)->pred_interp_filter =
- ctx->mic.mbmi.interp_filter;
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &sum_rate, &sum_dist, subsize,
- get_block_context(x, subsize), best_rd);
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
-
- if (sum_rd < best_rd && mi_row + mi_step < cm->mi_rows) {
- update_state(cpi, get_block_context(x, subsize), mi_row, mi_col,
- subsize, 0);
- encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize);
-
- *get_sb_index(x, subsize) = 1;
- if (cpi->sf.adaptive_motion_search)
- load_pred_mv(x, ctx);
- if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
- partition_none_allowed)
- get_block_context(x, subsize)->pred_interp_filter =
- ctx->mic.mbmi.interp_filter;
- rd_pick_sb_modes(cpi, tile, mi_row + mi_step, mi_col, &this_rate,
- &this_dist, subsize, get_block_context(x, subsize),
- best_rd - sum_rd);
- if (this_rate == INT_MAX) {
- sum_rd = INT64_MAX;
- } else {
- sum_rate += this_rate;
- sum_dist += this_dist;
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- }
- }
- if (sum_rd < best_rd) {
- pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- sum_rate += x->partition_cost[pl][PARTITION_HORZ];
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- if (sum_rd < best_rd) {
- best_rd = sum_rd;
- best_rate = sum_rate;
- best_dist = sum_dist;
- *(get_sb_partitioning(x, bsize)) = subsize;
- }
- }
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
- }
-
- // PARTITION_VERT
- if (partition_vert_allowed && do_rect) {
- subsize = get_subsize(bsize, PARTITION_VERT);
-
- *get_sb_index(x, subsize) = 0;
- if (cpi->sf.adaptive_motion_search)
- load_pred_mv(x, ctx);
- if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
- partition_none_allowed)
- get_block_context(x, subsize)->pred_interp_filter =
- ctx->mic.mbmi.interp_filter;
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &sum_rate, &sum_dist, subsize,
- get_block_context(x, subsize), best_rd);
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- if (sum_rd < best_rd && mi_col + mi_step < cm->mi_cols) {
- update_state(cpi, get_block_context(x, subsize), mi_row, mi_col,
- subsize, 0);
- encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize);
-
- *get_sb_index(x, subsize) = 1;
- if (cpi->sf.adaptive_motion_search)
- load_pred_mv(x, ctx);
- if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
- partition_none_allowed)
- get_block_context(x, subsize)->pred_interp_filter =
- ctx->mic.mbmi.interp_filter;
- rd_pick_sb_modes(cpi, tile, mi_row, mi_col + mi_step, &this_rate,
- &this_dist, subsize, get_block_context(x, subsize),
- best_rd - sum_rd);
- if (this_rate == INT_MAX) {
- sum_rd = INT64_MAX;
- } else {
- sum_rate += this_rate;
- sum_dist += this_dist;
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- }
- }
- if (sum_rd < best_rd) {
- pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- sum_rate += x->partition_cost[pl][PARTITION_VERT];
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- if (sum_rd < best_rd) {
- best_rate = sum_rate;
- best_dist = sum_dist;
- best_rd = sum_rd;
- *(get_sb_partitioning(x, bsize)) = subsize;
- }
- }
- restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
- }
-
- // TODO(jbb): This code added so that we avoid static analysis
- // warning related to the fact that best_rd isn't used after this
- // point. This code should be refactored so that the duplicate
- // checks occur in some sub function and thus are used...
- (void) best_rd;
- *rate = best_rate;
- *dist = best_dist;
-
- if (best_rate < INT_MAX && best_dist < INT64_MAX && do_recon) {
- int output_enabled = (bsize == BLOCK_64X64);
-
- // Check the projected output rate for this SB against it's target
- // and and if necessary apply a Q delta using segmentation to get
- // closer to the target.
- if ((cpi->oxcf.aq_mode == COMPLEXITY_AQ) && cm->seg.update_map) {
- vp9_select_in_frame_q_segment(cpi, mi_row, mi_col, output_enabled,
- best_rate);
- }
-
- if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
- vp9_cyclic_refresh_set_rate_and_dist_sb(cpi->cyclic_refresh,
- best_rate, best_dist);
-
- encode_sb(cpi, tile, tp, mi_row, mi_col, output_enabled, bsize);
- }
- if (bsize == BLOCK_64X64) {
- assert(tp_orig < *tp);
- assert(best_rate < INT_MAX);
- assert(best_dist < INT64_MAX);
- } else {
- assert(tp_orig == *tp);
- }
-}
-
-static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
- int mi_row, TOKENEXTRA **tp) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- int mi_col;
-
- // Initialize the left context for the new SB row
- vpx_memset(&xd->left_context, 0, sizeof(xd->left_context));
- vpx_memset(xd->left_seg_context, 0, sizeof(xd->left_seg_context));
-
- // Code each SB in the row
- for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
- mi_col += MI_BLOCK_SIZE) {
- int dummy_rate;
- int64_t dummy_dist;
-
- BLOCK_SIZE i;
- MACROBLOCK *x = &cpi->mb;
-
- if (cpi->sf.adaptive_pred_interp_filter) {
- for (i = BLOCK_4X4; i < BLOCK_8X8; ++i) {
- const int num_4x4_w = num_4x4_blocks_wide_lookup[i];
- const int num_4x4_h = num_4x4_blocks_high_lookup[i];
- const int num_4x4_blk = MAX(4, num_4x4_w * num_4x4_h);
- for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index)
- for (x->mb_index = 0; x->mb_index < 4; ++x->mb_index)
- for (x->b_index = 0; x->b_index < 16 / num_4x4_blk; ++x->b_index)
- get_block_context(x, i)->pred_interp_filter = SWITCHABLE;
- }
- }
-
- vp9_zero(cpi->mb.pred_mv);
-
- if ((cpi->sf.partition_search_type == SEARCH_PARTITION &&
- cpi->sf.use_lastframe_partitioning) ||
- cpi->sf.partition_search_type == FIXED_PARTITION ||
- cpi->sf.partition_search_type == VAR_BASED_PARTITION ||
- cpi->sf.partition_search_type == VAR_BASED_FIXED_PARTITION) {
- const int idx_str = cm->mi_stride * mi_row + mi_col;
- MODE_INFO **mi_8x8 = cm->mi_grid_visible + idx_str;
- MODE_INFO **prev_mi_8x8 = cm->prev_mi_grid_visible + idx_str;
- cpi->mb.source_variance = UINT_MAX;
- if (cpi->sf.partition_search_type == FIXED_PARTITION) {
- set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
- set_fixed_partitioning(cpi, tile, mi_8x8, mi_row, mi_col,
- cpi->sf.always_this_block_size);
- rd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
- &dummy_rate, &dummy_dist, 1);
- } else if (cpi->sf.partition_search_type == VAR_BASED_FIXED_PARTITION) {
- BLOCK_SIZE bsize;
- set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
- bsize = get_rd_var_based_fixed_partition(cpi, mi_row, mi_col);
- set_fixed_partitioning(cpi, tile, mi_8x8, mi_row, mi_col, bsize);
- rd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
- &dummy_rate, &dummy_dist, 1);
- } else if (cpi->sf.partition_search_type == VAR_BASED_PARTITION) {
- choose_partitioning(cpi, tile, mi_row, mi_col);
- rd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
- &dummy_rate, &dummy_dist, 1);
- } else {
- if ((cm->current_video_frame
- % cpi->sf.last_partitioning_redo_frequency) == 0
- || cm->prev_mi == 0
- || cm->show_frame == 0
- || cm->frame_type == KEY_FRAME
- || cpi->rc.is_src_frame_alt_ref
- || ((cpi->sf.use_lastframe_partitioning ==
- LAST_FRAME_PARTITION_LOW_MOTION) &&
- sb_has_motion(cm, prev_mi_8x8))) {
- // If required set upper and lower partition size limits
- if (cpi->sf.auto_min_max_partition_size) {
- set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
- rd_auto_partition_range(cpi, tile, mi_row, mi_col,
- &cpi->sf.min_partition_size,
- &cpi->sf.max_partition_size);
- }
- rd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64,
- &dummy_rate, &dummy_dist, 1, INT64_MAX);
- } else {
- copy_partitioning(cm, mi_8x8, prev_mi_8x8);
- rd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
- &dummy_rate, &dummy_dist, 1);
- }
- }
- } else {
- // If required set upper and lower partition size limits
- if (cpi->sf.auto_min_max_partition_size) {
- set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
- rd_auto_partition_range(cpi, tile, mi_row, mi_col,
- &cpi->sf.min_partition_size,
- &cpi->sf.max_partition_size);
- }
- rd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64,
- &dummy_rate, &dummy_dist, 1, INT64_MAX);
- }
- }
-}
-
-static void init_encode_frame_mb_context(VP9_COMP *cpi) {
- MACROBLOCK *const x = &cpi->mb;
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
-
- x->act_zbin_adj = 0;
- cpi->seg0_idx = 0;
-
- // Copy data over into macro block data structures.
- vp9_setup_src_planes(x, cpi->Source, 0, 0);
-
- // TODO(jkoleszar): are these initializations required?
- vp9_setup_pre_planes(xd, 0, get_ref_frame_buffer(cpi, LAST_FRAME), 0, 0,
- NULL);
- vp9_setup_dst_planes(xd, get_frame_new_buffer(cm), 0, 0);
-
- vp9_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
-
- xd->mi[0]->mbmi.mode = DC_PRED;
- xd->mi[0]->mbmi.uv_mode = DC_PRED;
-
- // Note: this memset assumes above_context[0], [1] and [2]
- // are allocated as part of the same buffer.
- vpx_memset(xd->above_context[0], 0,
- sizeof(*xd->above_context[0]) *
- 2 * aligned_mi_cols * MAX_MB_PLANE);
- vpx_memset(xd->above_seg_context, 0,
- sizeof(*xd->above_seg_context) * aligned_mi_cols);
-}
-
-static void switch_lossless_mode(VP9_COMP *cpi, int lossless) {
- if (lossless) {
- // printf("Switching to lossless\n");
- cpi->mb.fwd_txm4x4 = vp9_fwht4x4;
- cpi->mb.e_mbd.itxm_add = vp9_iwht4x4_add;
- cpi->mb.optimize = 0;
- cpi->common.lf.filter_level = 0;
- cpi->zbin_mode_boost_enabled = 0;
- cpi->common.tx_mode = ONLY_4X4;
- } else {
- // printf("Not lossless\n");
- cpi->mb.fwd_txm4x4 = vp9_fdct4x4;
- cpi->mb.e_mbd.itxm_add = vp9_idct4x4_add;
- }
-}
-
-static int check_dual_ref_flags(VP9_COMP *cpi) {
- const int ref_flags = cpi->ref_frame_flags;
-
- if (vp9_segfeature_active(&cpi->common.seg, 1, SEG_LVL_REF_FRAME)) {
- return 0;
- } else {
- return (!!(ref_flags & VP9_GOLD_FLAG) + !!(ref_flags & VP9_LAST_FLAG)
- + !!(ref_flags & VP9_ALT_FLAG)) >= 2;
- }
-}
-
-static int get_skip_flag(MODE_INFO **mi_8x8, int mis, int ymbs, int xmbs) {
- int x, y;
-
- for (y = 0; y < ymbs; y++) {
- for (x = 0; x < xmbs; x++) {
- if (!mi_8x8[y * mis + x]->mbmi.skip)
- return 0;
- }
- }
-
- return 1;
-}
-
-static void reset_skip_txfm_size(VP9_COMMON *cm, TX_SIZE txfm_max) {
- int mi_row, mi_col;
- const int mis = cm->mi_stride;
- MODE_INFO **mi_ptr = cm->mi_grid_visible;
-
- for (mi_row = 0; mi_row < cm->mi_rows; ++mi_row, mi_ptr += mis) {
- for (mi_col = 0; mi_col < cm->mi_cols; ++mi_col) {
- if (mi_ptr[mi_col]->mbmi.tx_size > txfm_max)
- mi_ptr[mi_col]->mbmi.tx_size = txfm_max;
- }
- }
-}
-
-static MV_REFERENCE_FRAME get_frame_type(const VP9_COMP *cpi) {
- if (frame_is_intra_only(&cpi->common))
- return INTRA_FRAME;
- else if (cpi->rc.is_src_frame_alt_ref && cpi->refresh_golden_frame)
- return ALTREF_FRAME;
- else if (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)
- return LAST_FRAME;
- else
- return GOLDEN_FRAME;
-}
-
-static TX_MODE select_tx_mode(const VP9_COMP *cpi) {
- if (cpi->oxcf.lossless) {
- return ONLY_4X4;
- } else if (cpi->common.current_video_frame == 0) {
- return TX_MODE_SELECT;
- } else {
- if (cpi->sf.tx_size_search_method == USE_LARGESTALL) {
- return ALLOW_32X32;
- } else if (cpi->sf.tx_size_search_method == USE_FULL_RD) {
- const MV_REFERENCE_FRAME frame_type = get_frame_type(cpi);
- return cpi->rd_tx_select_threshes[frame_type][ALLOW_32X32] >
- cpi->rd_tx_select_threshes[frame_type][TX_MODE_SELECT] ?
- ALLOW_32X32 : TX_MODE_SELECT;
- } else {
- unsigned int total = 0;
- int i;
- for (i = 0; i < TX_SIZES; ++i)
- total += cpi->tx_stepdown_count[i];
-
- if (total) {
- const double fraction = (double)cpi->tx_stepdown_count[0] / total;
- return fraction > 0.90 ? ALLOW_32X32 : TX_MODE_SELECT;
- } else {
- return cpi->common.tx_mode;
- }
- }
- }
-}
-
-// Start RTC Exploration
-typedef enum {
- BOTH_ZERO = 0,
- ZERO_PLUS_PREDICTED = 1,
- BOTH_PREDICTED = 2,
- NEW_PLUS_NON_INTRA = 3,
- BOTH_NEW = 4,
- INTRA_PLUS_NON_INTRA = 5,
- BOTH_INTRA = 6,
- INVALID_CASE = 9
-} motion_vector_context;
-
-static void set_mode_info(MB_MODE_INFO *mbmi, BLOCK_SIZE bsize,
- MB_PREDICTION_MODE mode) {
- mbmi->mode = mode;
- mbmi->uv_mode = mode;
- mbmi->mv[0].as_int = 0;
- mbmi->mv[1].as_int = 0;
- mbmi->ref_frame[0] = INTRA_FRAME;
- mbmi->ref_frame[1] = NONE;
- mbmi->tx_size = max_txsize_lookup[bsize];
- mbmi->skip = 0;
- mbmi->sb_type = bsize;
- mbmi->segment_id = 0;
-}
-
-static void nonrd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
- int mi_row, int mi_col,
- int *rate, int64_t *dist,
- BLOCK_SIZE bsize) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- set_offsets(cpi, tile, mi_row, mi_col, bsize);
- xd->mi[0]->mbmi.sb_type = bsize;
-
- if (!frame_is_intra_only(cm)) {
- vp9_pick_inter_mode(cpi, x, tile, mi_row, mi_col,
- rate, dist, bsize);
- } else {
- MB_PREDICTION_MODE intramode = DC_PRED;
- set_mode_info(&xd->mi[0]->mbmi, bsize, intramode);
- }
- duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize);
-}
-
-static void fill_mode_info_sb(VP9_COMMON *cm, MACROBLOCK *x,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize, BLOCK_SIZE subsize) {
- MACROBLOCKD *xd = &x->e_mbd;
- int bsl = b_width_log2(bsize), hbs = (1 << bsl) / 4;
- PARTITION_TYPE partition = partition_lookup[bsl][subsize];
-
- assert(bsize >= BLOCK_8X8);
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- switch (partition) {
- case PARTITION_NONE:
- set_modeinfo_offsets(cm, xd, mi_row, mi_col);
- *(xd->mi[0]) = get_block_context(x, subsize)->mic;
- duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize);
- break;
- case PARTITION_VERT:
- *get_sb_index(x, subsize) = 0;
- set_modeinfo_offsets(cm, xd, mi_row, mi_col);
- *(xd->mi[0]) = get_block_context(x, subsize)->mic;
- duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize);
-
- if (mi_col + hbs < cm->mi_cols) {
- *get_sb_index(x, subsize) = 1;
- set_modeinfo_offsets(cm, xd, mi_row, mi_col + hbs);
- *(xd->mi[0]) = get_block_context(x, subsize)->mic;
- duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col + hbs, bsize);
- }
- break;
- case PARTITION_HORZ:
- *get_sb_index(x, subsize) = 0;
- set_modeinfo_offsets(cm, xd, mi_row, mi_col);
- *(xd->mi[0]) = get_block_context(x, subsize)->mic;
- duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize);
- if (mi_row + hbs < cm->mi_rows) {
- *get_sb_index(x, subsize) = 1;
- set_modeinfo_offsets(cm, xd, mi_row + hbs, mi_col);
- *(xd->mi[0]) = get_block_context(x, subsize)->mic;
- duplicate_mode_info_in_sb(cm, xd, mi_row + hbs, mi_col, bsize);
- }
- break;
- case PARTITION_SPLIT:
- *get_sb_index(x, subsize) = 0;
- fill_mode_info_sb(cm, x, mi_row, mi_col, subsize,
- *(get_sb_partitioning(x, subsize)));
- *get_sb_index(x, subsize) = 1;
- fill_mode_info_sb(cm, x, mi_row, mi_col + hbs, subsize,
- *(get_sb_partitioning(x, subsize)));
- *get_sb_index(x, subsize) = 2;
- fill_mode_info_sb(cm, x, mi_row + hbs, mi_col, subsize,
- *(get_sb_partitioning(x, subsize)));
- *get_sb_index(x, subsize) = 3;
- fill_mode_info_sb(cm, x, mi_row + hbs, mi_col + hbs, subsize,
- *(get_sb_partitioning(x, subsize)));
- break;
- default:
- break;
- }
-}
-
-static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
- TOKENEXTRA **tp, int mi_row,
- int mi_col, BLOCK_SIZE bsize, int *rate,
- int64_t *dist, int do_recon, int64_t best_rd) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- const int ms = num_8x8_blocks_wide_lookup[bsize] / 2;
- TOKENEXTRA *tp_orig = *tp;
- PICK_MODE_CONTEXT *ctx = get_block_context(x, bsize);
- int i;
- BLOCK_SIZE subsize;
- int this_rate, sum_rate = 0, best_rate = INT_MAX;
- int64_t this_dist, sum_dist = 0, best_dist = INT64_MAX;
- int64_t sum_rd = 0;
- int do_split = bsize >= BLOCK_8X8;
- int do_rect = 1;
- // Override skipping rectangular partition operations for edge blocks
- const int force_horz_split = (mi_row + ms >= cm->mi_rows);
- const int force_vert_split = (mi_col + ms >= cm->mi_cols);
- const int xss = x->e_mbd.plane[1].subsampling_x;
- const int yss = x->e_mbd.plane[1].subsampling_y;
-
- int partition_none_allowed = !force_horz_split && !force_vert_split;
- int partition_horz_allowed = !force_vert_split && yss <= xss &&
- bsize >= BLOCK_8X8;
- int partition_vert_allowed = !force_horz_split && xss <= yss &&
- bsize >= BLOCK_8X8;
- (void) *tp_orig;
-
- if (bsize < BLOCK_8X8) {
- // When ab_index = 0 all sub-blocks are handled, so for ab_index != 0
- // there is nothing to be done.
- if (x->ab_index != 0) {
- *rate = 0;
- *dist = 0;
- return;
- }
- }
-
- assert(num_8x8_blocks_wide_lookup[bsize] ==
- num_8x8_blocks_high_lookup[bsize]);
-
- x->in_active_map = check_active_map(cpi, x, mi_row, mi_col, bsize);
-
- // Determine partition types in search according to the speed features.
- // The threshold set here has to be of square block size.
- if (cpi->sf.auto_min_max_partition_size) {
- partition_none_allowed &= (bsize <= cpi->sf.max_partition_size &&
- bsize >= cpi->sf.min_partition_size);
- partition_horz_allowed &= ((bsize <= cpi->sf.max_partition_size &&
- bsize > cpi->sf.min_partition_size) ||
- force_horz_split);
- partition_vert_allowed &= ((bsize <= cpi->sf.max_partition_size &&
- bsize > cpi->sf.min_partition_size) ||
- force_vert_split);
- do_split &= bsize > cpi->sf.min_partition_size;
- }
- if (cpi->sf.use_square_partition_only) {
- partition_horz_allowed &= force_horz_split;
- partition_vert_allowed &= force_vert_split;
- }
-
- if (!x->in_active_map && (partition_horz_allowed || partition_vert_allowed))
- do_split = 0;
-
- // PARTITION_NONE
- if (partition_none_allowed) {
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col,
- &this_rate, &this_dist, bsize);
- ctx->mic.mbmi = xd->mi[0]->mbmi;
-
- if (this_rate != INT_MAX) {
- int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- this_rate += x->partition_cost[pl][PARTITION_NONE];
- sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist);
- if (sum_rd < best_rd) {
- int64_t stop_thresh = 4096;
- int64_t stop_thresh_rd;
-
- best_rate = this_rate;
- best_dist = this_dist;
- best_rd = sum_rd;
- if (bsize >= BLOCK_8X8)
- *(get_sb_partitioning(x, bsize)) = bsize;
-
- // Adjust threshold according to partition size.
- stop_thresh >>= 8 - (b_width_log2_lookup[bsize] +
- b_height_log2_lookup[bsize]);
-
- stop_thresh_rd = RDCOST(x->rdmult, x->rddiv, 0, stop_thresh);
- // If obtained distortion is very small, choose current partition
- // and stop splitting.
- if (!x->e_mbd.lossless && best_rd < stop_thresh_rd) {
- do_split = 0;
- do_rect = 0;
- }
- }
- }
- if (!x->in_active_map) {
- do_split = 0;
- do_rect = 0;
- }
- }
-
- // store estimated motion vector
- store_pred_mv(x, ctx);
-
- // PARTITION_SPLIT
- sum_rd = 0;
- if (do_split) {
- int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- sum_rate += x->partition_cost[pl][PARTITION_SPLIT];
- subsize = get_subsize(bsize, PARTITION_SPLIT);
- for (i = 0; i < 4 && sum_rd < best_rd; ++i) {
- const int x_idx = (i & 1) * ms;
- const int y_idx = (i >> 1) * ms;
-
- if (mi_row + y_idx >= cm->mi_rows || mi_col + x_idx >= cm->mi_cols)
- continue;
-
- *get_sb_index(x, subsize) = i;
- load_pred_mv(x, ctx);
-
- nonrd_pick_partition(cpi, tile, tp, mi_row + y_idx, mi_col + x_idx,
- subsize, &this_rate, &this_dist, 0,
- best_rd - sum_rd);
-
- if (this_rate == INT_MAX) {
- sum_rd = INT64_MAX;
- } else {
- sum_rate += this_rate;
- sum_dist += this_dist;
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- }
- }
-
- if (sum_rd < best_rd) {
- best_rate = sum_rate;
- best_dist = sum_dist;
- best_rd = sum_rd;
- *(get_sb_partitioning(x, bsize)) = subsize;
- } else {
- // skip rectangular partition test when larger block size
- // gives better rd cost
- if (cpi->sf.less_rectangular_check)
- do_rect &= !partition_none_allowed;
- }
- }
-
- // PARTITION_HORZ
- if (partition_horz_allowed && do_rect) {
- subsize = get_subsize(bsize, PARTITION_HORZ);
- *get_sb_index(x, subsize) = 0;
- if (cpi->sf.adaptive_motion_search)
- load_pred_mv(x, ctx);
-
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col,
- &this_rate, &this_dist, subsize);
-
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
-
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
-
- if (sum_rd < best_rd && mi_row + ms < cm->mi_rows) {
- *get_sb_index(x, subsize) = 1;
-
- load_pred_mv(x, ctx);
-
- nonrd_pick_sb_modes(cpi, tile, mi_row + ms, mi_col,
- &this_rate, &this_dist, subsize);
-
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
-
- if (this_rate == INT_MAX) {
- sum_rd = INT64_MAX;
- } else {
- int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- this_rate += x->partition_cost[pl][PARTITION_HORZ];
- sum_rate += this_rate;
- sum_dist += this_dist;
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- }
- }
- if (sum_rd < best_rd) {
- best_rd = sum_rd;
- best_rate = sum_rate;
- best_dist = sum_dist;
- *(get_sb_partitioning(x, bsize)) = subsize;
- }
- }
-
- // PARTITION_VERT
- if (partition_vert_allowed && do_rect) {
- subsize = get_subsize(bsize, PARTITION_VERT);
-
- *get_sb_index(x, subsize) = 0;
- if (cpi->sf.adaptive_motion_search)
- load_pred_mv(x, ctx);
-
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col,
- &this_rate, &this_dist, subsize);
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- if (sum_rd < best_rd && mi_col + ms < cm->mi_cols) {
- *get_sb_index(x, subsize) = 1;
-
- load_pred_mv(x, ctx);
-
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col + ms,
- &this_rate, &this_dist, subsize);
-
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
-
- if (this_rate == INT_MAX) {
- sum_rd = INT64_MAX;
- } else {
- int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
- this_rate += x->partition_cost[pl][PARTITION_VERT];
- sum_rate += this_rate;
- sum_dist += this_dist;
- sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- }
- }
- if (sum_rd < best_rd) {
- best_rate = sum_rate;
- best_dist = sum_dist;
- best_rd = sum_rd;
- *(get_sb_partitioning(x, bsize)) = subsize;
- }
- }
-
- *rate = best_rate;
- *dist = best_dist;
-
- if (best_rate == INT_MAX)
- return;
-
- // update mode info array
- fill_mode_info_sb(cm, x, mi_row, mi_col, bsize,
- *(get_sb_partitioning(x, bsize)));
-
- if (best_rate < INT_MAX && best_dist < INT64_MAX && do_recon) {
- int output_enabled = (bsize == BLOCK_64X64);
-
- // Check the projected output rate for this SB against it's target
- // and and if necessary apply a Q delta using segmentation to get
- // closer to the target.
- if ((cpi->oxcf.aq_mode == COMPLEXITY_AQ) && cm->seg.update_map) {
- vp9_select_in_frame_q_segment(cpi, mi_row, mi_col, output_enabled,
- best_rate);
- }
-
- if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
- vp9_cyclic_refresh_set_rate_and_dist_sb(cpi->cyclic_refresh,
- best_rate, best_dist);
-
- encode_sb_rt(cpi, tile, tp, mi_row, mi_col, output_enabled, bsize);
- }
-
- if (bsize == BLOCK_64X64) {
- assert(tp_orig < *tp);
- assert(best_rate < INT_MAX);
- assert(best_dist < INT64_MAX);
- } else {
- assert(tp_orig == *tp);
- }
-}
-
-static void nonrd_use_partition(VP9_COMP *cpi,
- const TileInfo *const tile,
- MODE_INFO **mi_8x8,
- TOKENEXTRA **tp,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize, int output_enabled,
- int *totrate, int64_t *totdist) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- const int bsl = b_width_log2(bsize), hbs = (1 << bsl) / 4;
- const int mis = cm->mi_stride;
- PARTITION_TYPE partition;
- BLOCK_SIZE subsize;
- int rate = INT_MAX;
- int64_t dist = INT64_MAX;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- if (bsize >= BLOCK_8X8) {
- subsize = mi_8x8[0]->mbmi.sb_type;
- } else {
- subsize = BLOCK_4X4;
- }
-
- partition = partition_lookup[bsl][subsize];
-
- switch (partition) {
- case PARTITION_NONE:
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col, totrate, totdist, subsize);
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
- break;
- case PARTITION_VERT:
- *get_sb_index(x, subsize) = 0;
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col, totrate, totdist, subsize);
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
- if (mi_col + hbs < cm->mi_cols) {
- *get_sb_index(x, subsize) = 1;
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col + hbs,
- &rate, &dist, subsize);
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
- if (rate != INT_MAX && dist != INT64_MAX &&
- *totrate != INT_MAX && *totdist != INT64_MAX) {
- *totrate += rate;
- *totdist += dist;
- }
- }
- break;
- case PARTITION_HORZ:
- *get_sb_index(x, subsize) = 0;
- nonrd_pick_sb_modes(cpi, tile, mi_row, mi_col, totrate, totdist, subsize);
- get_block_context(x, subsize)->mic.mbmi = xd->mi[0]->mbmi;
- if (mi_row + hbs < cm->mi_rows) {
- *get_sb_index(x, subsize) = 1;
- nonrd_pick_sb_modes(cpi, tile, mi_row + hbs, mi_col,
- &rate, &dist, subsize);
- get_block_context(x, subsize)->mic.mbmi = mi_8x8[0]->mbmi;
- if (rate != INT_MAX && dist != INT64_MAX &&
- *totrate != INT_MAX && *totdist != INT64_MAX) {
- *totrate += rate;
- *totdist += dist;
- }
- }
- break;
- case PARTITION_SPLIT:
- subsize = get_subsize(bsize, PARTITION_SPLIT);
- *get_sb_index(x, subsize) = 0;
- nonrd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col,
- subsize, output_enabled, totrate, totdist);
- *get_sb_index(x, subsize) = 1;
- nonrd_use_partition(cpi, tile, mi_8x8 + hbs, tp,
- mi_row, mi_col + hbs, subsize, output_enabled,
- &rate, &dist);
- if (rate != INT_MAX && dist != INT64_MAX &&
- *totrate != INT_MAX && *totdist != INT64_MAX) {
- *totrate += rate;
- *totdist += dist;
- }
- *get_sb_index(x, subsize) = 2;
- nonrd_use_partition(cpi, tile, mi_8x8 + hbs * mis, tp,
- mi_row + hbs, mi_col, subsize, output_enabled,
- &rate, &dist);
- if (rate != INT_MAX && dist != INT64_MAX &&
- *totrate != INT_MAX && *totdist != INT64_MAX) {
- *totrate += rate;
- *totdist += dist;
- }
- *get_sb_index(x, subsize) = 3;
- nonrd_use_partition(cpi, tile, mi_8x8 + hbs * mis + hbs, tp,
- mi_row + hbs, mi_col + hbs, subsize, output_enabled,
- &rate, &dist);
- if (rate != INT_MAX && dist != INT64_MAX &&
- *totrate != INT_MAX && *totdist != INT64_MAX) {
- *totrate += rate;
- *totdist += dist;
- }
- break;
- default:
- assert("Invalid partition type.");
- }
-
- if (bsize == BLOCK_64X64 && output_enabled) {
- if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
- vp9_cyclic_refresh_set_rate_and_dist_sb(cpi->cyclic_refresh,
- *totrate, *totdist);
- encode_sb_rt(cpi, tile, tp, mi_row, mi_col, 1, bsize);
- }
-}
-
-static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
- int mi_row, TOKENEXTRA **tp) {
- VP9_COMMON *cm = &cpi->common;
- MACROBLOCKD *xd = &cpi->mb.e_mbd;
- int mi_col;
-
- // Initialize the left context for the new SB row
- vpx_memset(&xd->left_context, 0, sizeof(xd->left_context));
- vpx_memset(xd->left_seg_context, 0, sizeof(xd->left_seg_context));
-
- // Code each SB in the row
- for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
- mi_col += MI_BLOCK_SIZE) {
- int dummy_rate = 0;
- int64_t dummy_dist = 0;
- const int idx_str = cm->mi_stride * mi_row + mi_col;
- MODE_INFO **mi_8x8 = cm->mi_grid_visible + idx_str;
- MODE_INFO **prev_mi_8x8 = cm->prev_mi_grid_visible + idx_str;
-
- BLOCK_SIZE bsize = cpi->sf.partition_search_type == FIXED_PARTITION ?
- cpi->sf.always_this_block_size :
- get_nonrd_var_based_fixed_partition(cpi, mi_row, mi_col);
-
- cpi->mb.source_variance = UINT_MAX;
- vp9_zero(cpi->mb.pred_mv);
-
- // Set the partition type of the 64X64 block
- switch (cpi->sf.partition_search_type) {
- case VAR_BASED_PARTITION:
- choose_partitioning(cpi, tile, mi_row, mi_col);
- nonrd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
- 1, &dummy_rate, &dummy_dist);
- break;
- case VAR_BASED_FIXED_PARTITION:
- case FIXED_PARTITION:
- set_fixed_partitioning(cpi, tile, mi_8x8, mi_row, mi_col, bsize);
- nonrd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
- 1, &dummy_rate, &dummy_dist);
- break;
- case REFERENCE_PARTITION:
- if (cpi->sf.partition_check || sb_has_motion(cm, prev_mi_8x8)) {
- nonrd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64,
- &dummy_rate, &dummy_dist, 1, INT64_MAX);
- } else {
- copy_partitioning(cm, mi_8x8, prev_mi_8x8);
- nonrd_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col,
- BLOCK_64X64, 1, &dummy_rate, &dummy_dist);
- }
- break;
- default:
- assert(0);
- }
- }
-}
-// end RTC play code
-
-static void encode_frame_internal(VP9_COMP *cpi) {
- int mi_row;
- MACROBLOCK *const x = &cpi->mb;
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
-
-// fprintf(stderr, "encode_frame_internal frame %d (%d) type %d\n",
-// cpi->common.current_video_frame, cpi->common.show_frame,
-// cm->frame_type);
-
- xd->mi = cm->mi_grid_visible;
- xd->mi[0] = cm->mi;
-
- vp9_zero(cm->counts);
- vp9_zero(cpi->coef_counts);
- vp9_zero(cpi->tx_stepdown_count);
-
- // Set frame level transform size use case
- cm->tx_mode = select_tx_mode(cpi);
-
- cpi->mb.e_mbd.lossless = cm->base_qindex == 0 && cm->y_dc_delta_q == 0
- && cm->uv_dc_delta_q == 0 && cm->uv_ac_delta_q == 0;
- switch_lossless_mode(cpi, cpi->mb.e_mbd.lossless);
-
- vp9_frame_init_quantizer(cpi);
-
- vp9_initialize_rd_consts(cpi);
- vp9_initialize_me_consts(cpi, cm->base_qindex);
-
- if (cpi->oxcf.tuning == VP8_TUNE_SSIM) {
- // Initialize encode frame context.
- init_encode_frame_mb_context(cpi);
-
- // Build a frame level activity map
- build_activity_map(cpi);
- }
-
- // Re-initialize encode frame context.
- init_encode_frame_mb_context(cpi);
-
- vp9_zero(cpi->rd_comp_pred_diff);
- vp9_zero(cpi->rd_filter_diff);
- vp9_zero(cpi->rd_tx_select_diff);
- vp9_zero(cpi->rd_tx_select_threshes);
-
- set_prev_mi(cm);
-
- if (cpi->sf.use_nonrd_pick_mode) {
- // Initialize internal buffer pointers for rtc coding, where non-RD
- // mode decision is used and hence no buffer pointer swap needed.
- int i;
- struct macroblock_plane *const p = x->plane;
- struct macroblockd_plane *const pd = xd->plane;
- PICK_MODE_CONTEXT *ctx = &cpi->mb.sb64_context;
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- p[i].coeff = ctx->coeff_pbuf[i][0];
- p[i].qcoeff = ctx->qcoeff_pbuf[i][0];
- pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][0];
- p[i].eobs = ctx->eobs_pbuf[i][0];
- }
- vp9_zero(x->zcoeff_blk);
- }
-
- {
- struct vpx_usec_timer emr_timer;
- vpx_usec_timer_start(&emr_timer);
-
- {
- // Take tiles into account and give start/end MB
- int tile_col, tile_row;
- TOKENEXTRA *tp = cpi->tok;
- const int tile_cols = 1 << cm->log2_tile_cols;
- const int tile_rows = 1 << cm->log2_tile_rows;
-
- for (tile_row = 0; tile_row < tile_rows; tile_row++) {
- for (tile_col = 0; tile_col < tile_cols; tile_col++) {
- TileInfo tile;
- TOKENEXTRA *tp_old = tp;
-
- // For each row of SBs in the frame
- vp9_tile_init(&tile, cm, tile_row, tile_col);
- for (mi_row = tile.mi_row_start;
- mi_row < tile.mi_row_end; mi_row += MI_BLOCK_SIZE) {
- if (cpi->sf.use_nonrd_pick_mode && cm->frame_type != KEY_FRAME)
- encode_nonrd_sb_row(cpi, &tile, mi_row, &tp);
- else
- encode_rd_sb_row(cpi, &tile, mi_row, &tp);
- }
- cpi->tok_count[tile_row][tile_col] = (unsigned int)(tp - tp_old);
- assert(tp - cpi->tok <= get_token_alloc(cm->mb_rows, cm->mb_cols));
- }
- }
- }
-
- vpx_usec_timer_mark(&emr_timer);
- cpi->time_encode_sb_row += vpx_usec_timer_elapsed(&emr_timer);
- }
-
- if (cpi->sf.skip_encode_sb) {
- int j;
- unsigned int intra_count = 0, inter_count = 0;
- for (j = 0; j < INTRA_INTER_CONTEXTS; ++j) {
- intra_count += cm->counts.intra_inter[j][0];
- inter_count += cm->counts.intra_inter[j][1];
- }
- cpi->sf.skip_encode_frame = (intra_count << 2) < inter_count &&
- cm->frame_type != KEY_FRAME &&
- cm->show_frame;
- } else {
- cpi->sf.skip_encode_frame = 0;
- }
-
-#if 0
- // Keep record of the total distortion this time around for future use
- cpi->last_frame_distortion = cpi->frame_distortion;
-#endif
-}
-
-void vp9_encode_frame(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
-
- // In the longer term the encoder should be generalized to match the
- // decoder such that we allow compound where one of the 3 buffers has a
- // different sign bias and that buffer is then the fixed ref. However, this
- // requires further work in the rd loop. For now the only supported encoder
- // side behavior is where the ALT ref buffer has opposite sign bias to
- // the other two.
- if (!frame_is_intra_only(cm)) {
- 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])) {
- cm->allow_comp_inter_inter = 0;
- } else {
- cm->allow_comp_inter_inter = 1;
- cm->comp_fixed_ref = ALTREF_FRAME;
- cm->comp_var_ref[0] = LAST_FRAME;
- cm->comp_var_ref[1] = GOLDEN_FRAME;
- }
- }
-
- if (cpi->sf.frame_parameter_update) {
- int i;
- REFERENCE_MODE reference_mode;
- /*
- * This code does a single RD pass over the whole frame assuming
- * either compound, single or hybrid prediction as per whatever has
- * worked best for that type of frame in the past.
- * It also predicts whether another coding mode would have worked
- * better that this coding mode. If that is the case, it remembers
- * that for subsequent frames.
- * It does the same analysis for transform size selection also.
- */
- const MV_REFERENCE_FRAME frame_type = get_frame_type(cpi);
- const int64_t *mode_thresh = cpi->rd_prediction_type_threshes[frame_type];
- const int64_t *filter_thresh = cpi->rd_filter_threshes[frame_type];
-
- /* prediction (compound, single or hybrid) mode selection */
- if (frame_type == 3 || !cm->allow_comp_inter_inter)
- reference_mode = SINGLE_REFERENCE;
- else if (mode_thresh[COMPOUND_REFERENCE] > mode_thresh[SINGLE_REFERENCE] &&
- mode_thresh[COMPOUND_REFERENCE] >
- mode_thresh[REFERENCE_MODE_SELECT] &&
- check_dual_ref_flags(cpi) &&
- cpi->static_mb_pct == 100)
- reference_mode = COMPOUND_REFERENCE;
- else if (mode_thresh[SINGLE_REFERENCE] > mode_thresh[REFERENCE_MODE_SELECT])
- reference_mode = SINGLE_REFERENCE;
- else
- reference_mode = REFERENCE_MODE_SELECT;
-
- if (cm->interp_filter == SWITCHABLE) {
- if (frame_type != ALTREF_FRAME &&
- filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[EIGHTTAP] &&
- filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[EIGHTTAP_SHARP] &&
- filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[SWITCHABLE - 1]) {
- cm->interp_filter = EIGHTTAP_SMOOTH;
- } else if (filter_thresh[EIGHTTAP_SHARP] > filter_thresh[EIGHTTAP] &&
- filter_thresh[EIGHTTAP_SHARP] > filter_thresh[SWITCHABLE - 1]) {
- cm->interp_filter = EIGHTTAP_SHARP;
- } else if (filter_thresh[EIGHTTAP] > filter_thresh[SWITCHABLE - 1]) {
- cm->interp_filter = EIGHTTAP;
- }
- }
-
- cpi->mb.e_mbd.lossless = cpi->oxcf.lossless;
- cm->reference_mode = reference_mode;
-
- encode_frame_internal(cpi);
-
- for (i = 0; i < REFERENCE_MODES; ++i) {
- const int diff = (int) (cpi->rd_comp_pred_diff[i] / cm->MBs);
- cpi->rd_prediction_type_threshes[frame_type][i] += diff;
- cpi->rd_prediction_type_threshes[frame_type][i] >>= 1;
- }
-
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) {
- const int64_t diff = cpi->rd_filter_diff[i] / cm->MBs;
- cpi->rd_filter_threshes[frame_type][i] =
- (cpi->rd_filter_threshes[frame_type][i] + diff) / 2;
- }
-
- for (i = 0; i < TX_MODES; ++i) {
- int64_t pd = cpi->rd_tx_select_diff[i];
- int diff;
- if (i == TX_MODE_SELECT)
- pd -= RDCOST(cpi->mb.rdmult, cpi->mb.rddiv, 2048 * (TX_SIZES - 1), 0);
- diff = (int) (pd / cm->MBs);
- cpi->rd_tx_select_threshes[frame_type][i] += diff;
- cpi->rd_tx_select_threshes[frame_type][i] /= 2;
- }
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT) {
- int single_count_zero = 0;
- int comp_count_zero = 0;
-
- for (i = 0; i < COMP_INTER_CONTEXTS; i++) {
- single_count_zero += cm->counts.comp_inter[i][0];
- comp_count_zero += cm->counts.comp_inter[i][1];
- }
-
- if (comp_count_zero == 0) {
- cm->reference_mode = SINGLE_REFERENCE;
- vp9_zero(cm->counts.comp_inter);
- } else if (single_count_zero == 0) {
- cm->reference_mode = COMPOUND_REFERENCE;
- vp9_zero(cm->counts.comp_inter);
- }
- }
-
- if (cm->tx_mode == TX_MODE_SELECT) {
- int count4x4 = 0;
- int count8x8_lp = 0, count8x8_8x8p = 0;
- int count16x16_16x16p = 0, count16x16_lp = 0;
- int count32x32 = 0;
-
- for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
- count4x4 += cm->counts.tx.p32x32[i][TX_4X4];
- count4x4 += cm->counts.tx.p16x16[i][TX_4X4];
- count4x4 += cm->counts.tx.p8x8[i][TX_4X4];
-
- count8x8_lp += cm->counts.tx.p32x32[i][TX_8X8];
- count8x8_lp += cm->counts.tx.p16x16[i][TX_8X8];
- count8x8_8x8p += cm->counts.tx.p8x8[i][TX_8X8];
-
- count16x16_16x16p += cm->counts.tx.p16x16[i][TX_16X16];
- count16x16_lp += cm->counts.tx.p32x32[i][TX_16X16];
- count32x32 += cm->counts.tx.p32x32[i][TX_32X32];
- }
-
- if (count4x4 == 0 && count16x16_lp == 0 && count16x16_16x16p == 0 &&
- count32x32 == 0) {
- cm->tx_mode = ALLOW_8X8;
- reset_skip_txfm_size(cm, TX_8X8);
- } else if (count8x8_8x8p == 0 && count16x16_16x16p == 0 &&
- count8x8_lp == 0 && count16x16_lp == 0 && count32x32 == 0) {
- cm->tx_mode = ONLY_4X4;
- reset_skip_txfm_size(cm, TX_4X4);
- } else if (count8x8_lp == 0 && count16x16_lp == 0 && count4x4 == 0) {
- cm->tx_mode = ALLOW_32X32;
- } else if (count32x32 == 0 && count8x8_lp == 0 && count4x4 == 0) {
- cm->tx_mode = ALLOW_16X16;
- reset_skip_txfm_size(cm, TX_16X16);
- }
- }
- } else {
- cpi->mb.e_mbd.lossless = cpi->oxcf.lossless;
- cm->reference_mode = SINGLE_REFERENCE;
- // Force the usage of the BILINEAR interp_filter.
- cm->interp_filter = BILINEAR;
- encode_frame_internal(cpi);
- }
-}
-
-static void sum_intra_stats(FRAME_COUNTS *counts, const MODE_INFO *mi) {
- const MB_PREDICTION_MODE y_mode = mi->mbmi.mode;
- const MB_PREDICTION_MODE uv_mode = mi->mbmi.uv_mode;
- const BLOCK_SIZE bsize = mi->mbmi.sb_type;
-
- if (bsize < BLOCK_8X8) {
- int idx, idy;
- const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
- for (idy = 0; idy < 2; idy += num_4x4_h)
- for (idx = 0; idx < 2; idx += num_4x4_w)
- ++counts->y_mode[0][mi->bmi[idy * 2 + idx].as_mode];
- } else {
- ++counts->y_mode[size_group_lookup[bsize]][y_mode];
- }
-
- ++counts->uv_mode[y_mode][uv_mode];
-}
-
-// Experimental stub function to create a per MB zbin adjustment based on
-// some previously calculated measure of MB activity.
-static void adjust_act_zbin(VP9_COMP *cpi, MACROBLOCK *x) {
-#if USE_ACT_INDEX
- x->act_zbin_adj = *(x->mb_activity_ptr);
-#else
- // Apply the masking to the RD multiplier.
- const int64_t act = *(x->mb_activity_ptr);
- const int64_t a = act + 4 * cpi->activity_avg;
- const int64_t b = 4 * act + cpi->activity_avg;
-
- if (act > cpi->activity_avg)
- x->act_zbin_adj = (int) (((int64_t) b + (a >> 1)) / a) - 1;
- else
- x->act_zbin_adj = 1 - (int) (((int64_t) a + (b >> 1)) / b);
-#endif
-}
-
-static int get_zbin_mode_boost(const MB_MODE_INFO *mbmi, int enabled) {
- if (enabled) {
- if (is_inter_block(mbmi)) {
- if (mbmi->mode == ZEROMV) {
- return mbmi->ref_frame[0] != LAST_FRAME ? GF_ZEROMV_ZBIN_BOOST
- : LF_ZEROMV_ZBIN_BOOST;
- } else {
- return mbmi->sb_type < BLOCK_8X8 ? SPLIT_MV_ZBIN_BOOST
- : MV_ZBIN_BOOST;
- }
- } else {
- return INTRA_ZBIN_BOOST;
- }
- } else {
- return 0;
- }
-}
-
-static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
- int mi_row, int mi_col, BLOCK_SIZE bsize) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- MODE_INFO **mi_8x8 = xd->mi;
- MODE_INFO *mi = mi_8x8[0];
- MB_MODE_INFO *mbmi = &mi->mbmi;
- PICK_MODE_CONTEXT *ctx = get_block_context(x, bsize);
- unsigned int segment_id = mbmi->segment_id;
- const int mis = cm->mi_stride;
- const int mi_width = num_8x8_blocks_wide_lookup[bsize];
- const int mi_height = num_8x8_blocks_high_lookup[bsize];
-
- x->skip_recode = !x->select_txfm_size && mbmi->sb_type >= BLOCK_8X8 &&
- cpi->oxcf.aq_mode != COMPLEXITY_AQ &&
- cpi->oxcf.aq_mode != CYCLIC_REFRESH_AQ &&
- cpi->sf.allow_skip_recode;
-
- x->skip_optimize = ctx->is_coded;
- ctx->is_coded = 1;
- x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct;
- x->skip_encode = (!output_enabled && cpi->sf.skip_encode_frame &&
- x->q_index < QIDX_SKIP_THRESH);
-
- if (x->skip_encode)
- return;
-
- if (cm->frame_type == KEY_FRAME) {
- if (cpi->oxcf.tuning == VP8_TUNE_SSIM) {
- adjust_act_zbin(cpi, x);
- vp9_update_zbin_extra(cpi, x);
- }
- } else {
- set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
-
- if (cpi->oxcf.tuning == VP8_TUNE_SSIM) {
- // Adjust the zbin based on this MB rate.
- adjust_act_zbin(cpi, x);
- }
-
- // Experimental code. Special case for gf and arf zeromv modes.
- // Increase zbin size to suppress noise
- cpi->zbin_mode_boost = get_zbin_mode_boost(mbmi,
- cpi->zbin_mode_boost_enabled);
- vp9_update_zbin_extra(cpi, x);
- }
-
- if (!is_inter_block(mbmi)) {
- int plane;
- mbmi->skip = 1;
- for (plane = 0; plane < MAX_MB_PLANE; ++plane)
- vp9_encode_intra_block_plane(x, MAX(bsize, BLOCK_8X8), plane);
- if (output_enabled)
- sum_intra_stats(&cm->counts, mi);
- vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
- } else {
- int ref;
- const int is_compound = has_second_ref(mbmi);
- for (ref = 0; ref < 1 + is_compound; ++ref) {
- YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi,
- mbmi->ref_frame[ref]);
- vp9_setup_pre_planes(xd, ref, cfg, mi_row, mi_col,
- &xd->block_refs[ref]->sf);
- }
- vp9_build_inter_predictors_sb(xd, mi_row, mi_col, MAX(bsize, BLOCK_8X8));
-
- if (!x->skip) {
- mbmi->skip = 1;
- vp9_encode_sb(x, MAX(bsize, BLOCK_8X8));
- vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
- } else {
- mbmi->skip = 1;
- if (output_enabled)
- cm->counts.skip[vp9_get_skip_context(xd)][1]++;
- reset_skip_context(xd, MAX(bsize, BLOCK_8X8));
- }
- }
-
- if (output_enabled) {
- if (cm->tx_mode == TX_MODE_SELECT &&
- mbmi->sb_type >= BLOCK_8X8 &&
- !(is_inter_block(mbmi) &&
- (mbmi->skip ||
- vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)))) {
- ++get_tx_counts(max_txsize_lookup[bsize], vp9_get_tx_size_context(xd),
- &cm->counts.tx)[mbmi->tx_size];
- } else {
- int x, y;
- TX_SIZE tx_size;
- // The new intra coding scheme requires no change of transform size
- if (is_inter_block(&mi->mbmi)) {
- tx_size = MIN(tx_mode_to_biggest_tx_size[cm->tx_mode],
- max_txsize_lookup[bsize]);
- } else {
- tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4;
- }
-
- for (y = 0; y < mi_height; y++)
- for (x = 0; x < mi_width; x++)
- if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows)
- mi_8x8[mis * y + x]->mbmi.tx_size = tx_size;
- }
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.h
deleted file mode 100644
index 72343cd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodeframe.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_ENCODEFRAME_H_
-#define VP9_ENCODER_VP9_ENCODEFRAME_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct macroblock;
-struct yv12_buffer_config;
-struct VP9_COMP;
-
-void vp9_setup_src_planes(struct macroblock *x,
- const struct yv12_buffer_config *src,
- int mi_row, int mi_col);
-
-void vp9_encode_frame(struct VP9_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_ENCODEFRAME_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.c
deleted file mode 100644
index 5e98e4e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "./vp9_rtcd.h"
-#include "./vpx_config.h"
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_reconintra.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-#include "vp9/encoder/vp9_encodemb.h"
-#include "vp9/encoder/vp9_quantize.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_tokenize.h"
-
-struct optimize_ctx {
- ENTROPY_CONTEXT ta[MAX_MB_PLANE][16];
- ENTROPY_CONTEXT tl[MAX_MB_PLANE][16];
-};
-
-struct encode_b_args {
- MACROBLOCK *x;
- struct optimize_ctx *ctx;
- unsigned char *skip;
-};
-
-void vp9_subtract_block_c(int rows, int cols,
- int16_t *diff, ptrdiff_t diff_stride,
- const uint8_t *src, ptrdiff_t src_stride,
- const uint8_t *pred, ptrdiff_t pred_stride) {
- int r, c;
-
- for (r = 0; r < rows; r++) {
- for (c = 0; c < cols; c++)
- diff[c] = src[c] - pred[c];
-
- diff += diff_stride;
- pred += pred_stride;
- src += src_stride;
- }
-}
-
-void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
- struct macroblock_plane *const p = &x->plane[plane];
- const struct macroblockd_plane *const pd = &x->e_mbd.plane[plane];
- const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
- const int bw = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
- const int bh = 4 * num_4x4_blocks_high_lookup[plane_bsize];
-
- vp9_subtract_block(bh, bw, p->src_diff, bw, p->src.buf, p->src.stride,
- pd->dst.buf, pd->dst.stride);
-}
-
-#define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF)
-typedef struct vp9_token_state vp9_token_state;
-
-struct vp9_token_state {
- int rate;
- int error;
- int next;
- signed char token;
- short qc;
-};
-
-// TODO(jimbankoski): experiment to find optimal RD numbers.
-#define Y1_RD_MULT 4
-#define UV_RD_MULT 2
-
-static const int plane_rd_mult[4] = {
- Y1_RD_MULT,
- UV_RD_MULT,
-};
-
-#define UPDATE_RD_COST()\
-{\
- rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);\
- rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);\
- if (rd_cost0 == rd_cost1) {\
- rd_cost0 = RDTRUNC(rdmult, rddiv, rate0, error0);\
- rd_cost1 = RDTRUNC(rdmult, rddiv, rate1, error1);\
- }\
-}
-
-// This function is a place holder for now but may ultimately need
-// to scan previous tokens to work out the correct context.
-static int trellis_get_coeff_context(const int16_t *scan,
- const int16_t *nb,
- int idx, int token,
- uint8_t *token_cache) {
- int bak = token_cache[scan[idx]], pt;
- token_cache[scan[idx]] = vp9_pt_energy_class[token];
- pt = get_coef_context(nb, token_cache, idx + 1);
- token_cache[scan[idx]] = bak;
- return pt;
-}
-
-static void optimize_b(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, MACROBLOCK *mb,
- ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) {
- MACROBLOCKD *const xd = &mb->e_mbd;
- struct macroblock_plane *p = &mb->plane[plane];
- struct macroblockd_plane *pd = &xd->plane[plane];
- const int ref = is_inter_block(&xd->mi[0]->mbmi);
- vp9_token_state tokens[1025][2];
- unsigned best_index[1025][2];
- const int16_t *coeff = BLOCK_OFFSET(mb->plane[plane].coeff, block);
- int16_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
- int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- int eob = p->eobs[block], final_eob, sz = 0;
- const int i0 = 0;
- int rc, x, next, i;
- int64_t rdmult, rddiv, rd_cost0, rd_cost1;
- int rate0, rate1, error0, error1, t0, t1;
- int best, band, pt;
- PLANE_TYPE type = pd->plane_type;
- int err_mult = plane_rd_mult[type];
- const int default_eob = 16 << (tx_size << 1);
- const int mul = 1 + (tx_size == TX_32X32);
- uint8_t token_cache[1024];
- const int16_t *dequant_ptr = pd->dequant;
- const uint8_t *const band_translate = get_band_translate(tx_size);
- const scan_order *so = get_scan(xd, tx_size, type, block);
- const int16_t *scan = so->scan;
- const int16_t *nb = so->neighbors;
-
- assert((!type && !plane) || (type && plane));
- assert(eob <= default_eob);
-
- /* Now set up a Viterbi trellis to evaluate alternative roundings. */
- rdmult = mb->rdmult * err_mult;
- if (!is_inter_block(&mb->e_mbd.mi[0]->mbmi))
- rdmult = (rdmult * 9) >> 4;
- rddiv = mb->rddiv;
- /* Initialize the sentinel node of the trellis. */
- tokens[eob][0].rate = 0;
- tokens[eob][0].error = 0;
- tokens[eob][0].next = default_eob;
- tokens[eob][0].token = EOB_TOKEN;
- tokens[eob][0].qc = 0;
- *(tokens[eob] + 1) = *(tokens[eob] + 0);
- next = eob;
- for (i = 0; i < eob; i++)
- token_cache[scan[i]] = vp9_pt_energy_class[vp9_dct_value_tokens_ptr[
- qcoeff[scan[i]]].token];
-
- for (i = eob; i-- > i0;) {
- int base_bits, d2, dx;
-
- rc = scan[i];
- x = qcoeff[rc];
- /* Only add a trellis state for non-zero coefficients. */
- if (x) {
- int shortcut = 0;
- error0 = tokens[next][0].error;
- error1 = tokens[next][1].error;
- /* Evaluate the first possibility for this state. */
- rate0 = tokens[next][0].rate;
- rate1 = tokens[next][1].rate;
- t0 = (vp9_dct_value_tokens_ptr + x)->token;
- /* Consider both possible successor states. */
- if (next < default_eob) {
- band = band_translate[i + 1];
- pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache);
- rate0 +=
- mb->token_costs[tx_size][type][ref][band][0][pt]
- [tokens[next][0].token];
- rate1 +=
- mb->token_costs[tx_size][type][ref][band][0][pt]
- [tokens[next][1].token];
- }
- UPDATE_RD_COST();
- /* And pick the best. */
- best = rd_cost1 < rd_cost0;
- base_bits = *(vp9_dct_value_cost_ptr + x);
- dx = mul * (dqcoeff[rc] - coeff[rc]);
- d2 = dx * dx;
- tokens[i][0].rate = base_bits + (best ? rate1 : rate0);
- tokens[i][0].error = d2 + (best ? error1 : error0);
- tokens[i][0].next = next;
- tokens[i][0].token = t0;
- tokens[i][0].qc = x;
- best_index[i][0] = best;
-
- /* Evaluate the second possibility for this state. */
- rate0 = tokens[next][0].rate;
- rate1 = tokens[next][1].rate;
-
- if ((abs(x)*dequant_ptr[rc != 0] > abs(coeff[rc]) * mul) &&
- (abs(x)*dequant_ptr[rc != 0] < abs(coeff[rc]) * mul +
- dequant_ptr[rc != 0]))
- shortcut = 1;
- else
- shortcut = 0;
-
- if (shortcut) {
- sz = -(x < 0);
- x -= 2 * sz + 1;
- }
-
- /* Consider both possible successor states. */
- if (!x) {
- /* If we reduced this coefficient to zero, check to see if
- * we need to move the EOB back here.
- */
- t0 = tokens[next][0].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN;
- t1 = tokens[next][1].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN;
- } else {
- t0 = t1 = (vp9_dct_value_tokens_ptr + x)->token;
- }
- if (next < default_eob) {
- band = band_translate[i + 1];
- if (t0 != EOB_TOKEN) {
- pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache);
- rate0 += mb->token_costs[tx_size][type][ref][band][!x][pt]
- [tokens[next][0].token];
- }
- if (t1 != EOB_TOKEN) {
- pt = trellis_get_coeff_context(scan, nb, i, t1, token_cache);
- rate1 += mb->token_costs[tx_size][type][ref][band][!x][pt]
- [tokens[next][1].token];
- }
- }
-
- UPDATE_RD_COST();
- /* And pick the best. */
- best = rd_cost1 < rd_cost0;
- base_bits = *(vp9_dct_value_cost_ptr + x);
-
- if (shortcut) {
- dx -= (dequant_ptr[rc != 0] + sz) ^ sz;
- d2 = dx * dx;
- }
- tokens[i][1].rate = base_bits + (best ? rate1 : rate0);
- tokens[i][1].error = d2 + (best ? error1 : error0);
- tokens[i][1].next = next;
- tokens[i][1].token = best ? t1 : t0;
- tokens[i][1].qc = x;
- best_index[i][1] = best;
- /* Finally, make this the new head of the trellis. */
- next = i;
- } else {
- /* There's no choice to make for a zero coefficient, so we don't
- * add a new trellis node, but we do need to update the costs.
- */
- band = band_translate[i + 1];
- t0 = tokens[next][0].token;
- t1 = tokens[next][1].token;
- /* Update the cost of each path if we're past the EOB token. */
- if (t0 != EOB_TOKEN) {
- tokens[next][0].rate +=
- mb->token_costs[tx_size][type][ref][band][1][0][t0];
- tokens[next][0].token = ZERO_TOKEN;
- }
- if (t1 != EOB_TOKEN) {
- tokens[next][1].rate +=
- mb->token_costs[tx_size][type][ref][band][1][0][t1];
- tokens[next][1].token = ZERO_TOKEN;
- }
- best_index[i][0] = best_index[i][1] = 0;
- /* Don't update next, because we didn't add a new node. */
- }
- }
-
- /* Now pick the best path through the whole trellis. */
- band = band_translate[i + 1];
- pt = combine_entropy_contexts(*a, *l);
- rate0 = tokens[next][0].rate;
- rate1 = tokens[next][1].rate;
- error0 = tokens[next][0].error;
- error1 = tokens[next][1].error;
- t0 = tokens[next][0].token;
- t1 = tokens[next][1].token;
- rate0 += mb->token_costs[tx_size][type][ref][band][0][pt][t0];
- rate1 += mb->token_costs[tx_size][type][ref][band][0][pt][t1];
- UPDATE_RD_COST();
- best = rd_cost1 < rd_cost0;
- final_eob = i0 - 1;
- vpx_memset(qcoeff, 0, sizeof(*qcoeff) * (16 << (tx_size * 2)));
- vpx_memset(dqcoeff, 0, sizeof(*dqcoeff) * (16 << (tx_size * 2)));
- for (i = next; i < eob; i = next) {
- x = tokens[i][best].qc;
- if (x) {
- final_eob = i;
- }
- rc = scan[i];
- qcoeff[rc] = x;
- dqcoeff[rc] = (x * dequant_ptr[rc != 0]) / mul;
-
- next = tokens[i][best].next;
- best = best_index[i][best];
- }
- final_eob++;
-
- mb->plane[plane].eobs[block] = final_eob;
- *a = *l = (final_eob > 0);
-}
-
-static INLINE void fdct32x32(int rd_transform,
- const int16_t *src, int16_t *dst, int src_stride) {
- if (rd_transform)
- vp9_fdct32x32_rd(src, dst, src_stride);
- else
- vp9_fdct32x32(src, dst, src_stride);
-}
-
-void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
- MACROBLOCKD *const xd = &x->e_mbd;
- const struct macroblock_plane *const p = &x->plane[plane];
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
- int16_t *const coeff = BLOCK_OFFSET(p->coeff, block);
- int16_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
- int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- uint16_t *const eob = &p->eobs[block];
- const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
- int i, j;
- const int16_t *src_diff;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- src_diff = &p->src_diff[4 * (j * diff_stride + i)];
-
- switch (tx_size) {
- case TX_32X32:
- fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
- vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
- p->quant, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob, scan_order->scan,
- scan_order->iscan);
- break;
- case TX_16X16:
- vp9_fdct16x16(src_diff, coeff, diff_stride);
- vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
- p->quant, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob,
- scan_order->scan, scan_order->iscan);
- break;
- case TX_8X8:
- vp9_fdct8x8(src_diff, coeff, diff_stride);
- vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
- p->quant, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob,
- scan_order->scan, scan_order->iscan);
- break;
- case TX_4X4:
- x->fwd_txm4x4(src_diff, coeff, diff_stride);
- vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
- p->quant, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob,
- scan_order->scan, scan_order->iscan);
- break;
- default:
- assert(0);
- }
-}
-
-static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- struct encode_b_args *const args = arg;
- MACROBLOCK *const x = args->x;
- MACROBLOCKD *const xd = &x->e_mbd;
- struct optimize_ctx *const ctx = args->ctx;
- struct macroblock_plane *const p = &x->plane[plane];
- struct macroblockd_plane *const pd = &xd->plane[plane];
- int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- int i, j;
- uint8_t *dst;
- ENTROPY_CONTEXT *a, *l;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
- a = &ctx->ta[plane][i];
- l = &ctx->tl[plane][j];
-
- // TODO(jingning): per transformed block zero forcing only enabled for
- // luma component. will integrate chroma components as well.
- if (x->zcoeff_blk[tx_size][block] && plane == 0) {
- p->eobs[block] = 0;
- *a = *l = 0;
- return;
- }
-
- if (!x->skip_recode)
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
-
- if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
- optimize_b(plane, block, plane_bsize, tx_size, x, a, l);
- } else {
- *a = *l = p->eobs[block] > 0;
- }
-
- if (p->eobs[block])
- *(args->skip) = 0;
-
- if (x->skip_encode || p->eobs[block] == 0)
- return;
-
- switch (tx_size) {
- case TX_32X32:
- vp9_idct32x32_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
- break;
- case TX_16X16:
- vp9_idct16x16_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
- break;
- case TX_8X8:
- vp9_idct8x8_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
- break;
- case TX_4X4:
- // this is like vp9_short_idct4x4 but has a special case around eob<=1
- // which is significant (not just an optimization) for the lossless
- // case.
- xd->itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
- break;
- default:
- assert(0 && "Invalid transform size");
- }
-}
-
-static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- MACROBLOCK *const x = (MACROBLOCK *)arg;
- MACROBLOCKD *const xd = &x->e_mbd;
- struct macroblock_plane *const p = &x->plane[plane];
- struct macroblockd_plane *const pd = &xd->plane[plane];
- int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- int i, j;
- uint8_t *dst;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
-
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
-
- if (p->eobs[block] > 0)
- xd->itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
-}
-
-void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize) {
- vp9_subtract_plane(x, bsize, 0);
- vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, 0,
- encode_block_pass1, x);
-}
-
-void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
- MACROBLOCKD *const xd = &x->e_mbd;
- struct optimize_ctx ctx;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- struct encode_b_args arg = {x, &ctx, &mbmi->skip};
- int plane;
-
- for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
- if (!x->skip_recode)
- vp9_subtract_plane(x, bsize, plane);
-
- if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
- const struct macroblockd_plane* const pd = &xd->plane[plane];
- const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi) : mbmi->tx_size;
- vp9_get_entropy_contexts(bsize, tx_size, pd,
- ctx.ta[plane], ctx.tl[plane]);
- }
-
- vp9_foreach_transformed_block_in_plane(xd, bsize, plane, encode_block,
- &arg);
- }
-}
-
-static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- struct encode_b_args* const args = arg;
- MACROBLOCK *const x = args->x;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- struct macroblock_plane *const p = &x->plane[plane];
- struct macroblockd_plane *const pd = &xd->plane[plane];
- int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
- int16_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
- int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- const scan_order *scan_order;
- TX_TYPE tx_type;
- MB_PREDICTION_MODE mode;
- const int bwl = b_width_log2(plane_bsize);
- const int diff_stride = 4 * (1 << bwl);
- uint8_t *src, *dst;
- int16_t *src_diff;
- uint16_t *eob = &p->eobs[block];
- const int src_stride = p->src.stride;
- const int dst_stride = pd->dst.stride;
- int i, j;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- dst = &pd->dst.buf[4 * (j * dst_stride + i)];
- src = &p->src.buf[4 * (j * src_stride + i)];
- src_diff = &p->src_diff[4 * (j * diff_stride + i)];
-
- switch (tx_size) {
- case TX_32X32:
- scan_order = &vp9_default_scan_orders[TX_32X32];
- mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
- vp9_predict_intra_block(xd, block >> 6, bwl, TX_32X32, mode,
- x->skip_encode ? src : dst,
- x->skip_encode ? src_stride : dst_stride,
- dst, dst_stride, i, j, plane);
- if (!x->skip_recode) {
- vp9_subtract_block(32, 32, src_diff, diff_stride,
- src, src_stride, dst, dst_stride);
- fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
- vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
- p->quant, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob, scan_order->scan,
- scan_order->iscan);
- }
- if (!x->skip_encode && *eob)
- vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob);
- break;
- case TX_16X16:
- tx_type = get_tx_type(pd->plane_type, xd);
- scan_order = &vp9_scan_orders[TX_16X16][tx_type];
- mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
- vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode,
- x->skip_encode ? src : dst,
- x->skip_encode ? src_stride : dst_stride,
- dst, dst_stride, i, j, plane);
- if (!x->skip_recode) {
- vp9_subtract_block(16, 16, src_diff, diff_stride,
- src, src_stride, dst, dst_stride);
- vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
- vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
- p->quant, p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob, scan_order->scan,
- scan_order->iscan);
- }
- if (!x->skip_encode && *eob)
- vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob);
- break;
- case TX_8X8:
- tx_type = get_tx_type(pd->plane_type, xd);
- scan_order = &vp9_scan_orders[TX_8X8][tx_type];
- mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
- vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode,
- x->skip_encode ? src : dst,
- x->skip_encode ? src_stride : dst_stride,
- dst, dst_stride, i, j, plane);
- if (!x->skip_recode) {
- vp9_subtract_block(8, 8, src_diff, diff_stride,
- src, src_stride, dst, dst_stride);
- vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
- vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
- p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob, scan_order->scan,
- scan_order->iscan);
- }
- if (!x->skip_encode && *eob)
- vp9_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob);
- break;
- case TX_4X4:
- tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
- scan_order = &vp9_scan_orders[TX_4X4][tx_type];
- mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mbmi->uv_mode;
- vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
- x->skip_encode ? src : dst,
- x->skip_encode ? src_stride : dst_stride,
- dst, dst_stride, i, j, plane);
-
- if (!x->skip_recode) {
- vp9_subtract_block(4, 4, src_diff, diff_stride,
- src, src_stride, dst, dst_stride);
- if (tx_type != DCT_DCT)
- vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
- else
- x->fwd_txm4x4(src_diff, coeff, diff_stride);
- vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
- p->quant_shift, qcoeff, dqcoeff,
- pd->dequant, p->zbin_extra, eob, scan_order->scan,
- scan_order->iscan);
- }
-
- if (!x->skip_encode && *eob) {
- if (tx_type == DCT_DCT)
- // this is like vp9_short_idct4x4 but has a special case around eob<=1
- // which is significant (not just an optimization) for the lossless
- // case.
- xd->itxm_add(dqcoeff, dst, dst_stride, *eob);
- else
- vp9_iht4x4_16_add(dqcoeff, dst, dst_stride, tx_type);
- }
- break;
- default:
- assert(0);
- }
- if (*eob)
- *(args->skip) = 0;
-}
-
-void vp9_encode_block_intra(MACROBLOCK *x, int plane, int block,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
- unsigned char *skip) {
- struct encode_b_args arg = {x, NULL, skip};
- encode_block_intra(plane, block, plane_bsize, tx_size, &arg);
-}
-
-
-void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip};
-
- vp9_foreach_transformed_block_in_plane(xd, bsize, plane, encode_block_intra,
- &arg);
-}
-
-int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred) {
- MB_MODE_INFO * mbmi = &x->e_mbd.mi[0]->mbmi;
- x->skip_encode = 0;
- mbmi->mode = DC_PRED;
- mbmi->ref_frame[0] = INTRA_FRAME;
- mbmi->tx_size = use_16x16_pred ? (mbmi->sb_type >= BLOCK_16X16 ? TX_16X16
- : TX_8X8)
- : TX_4X4;
- vp9_encode_intra_block_plane(x, mbmi->sb_type, 0);
- return vp9_get_mb_ss(x->plane[0].src_diff);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.h
deleted file mode 100644
index dcf6e87..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemb.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_ENCODEMB_H_
-#define VP9_ENCODER_VP9_ENCODEMB_H_
-
-#include "./vpx_config.h"
-#include "vp9/encoder/vp9_block.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
-void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize);
-
-void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
-
-void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
-
-void vp9_encode_block_intra(MACROBLOCK *x, int plane, int block,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
- unsigned char *skip);
-
-void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
-
-int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_ENCODEMB_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.c
deleted file mode 100644
index 9d44865..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-#include "vp9/encoder/vp9_cost.h"
-#include "vp9/encoder/vp9_encodemv.h"
-
-static struct vp9_token mv_joint_encodings[MV_JOINTS];
-static struct vp9_token mv_class_encodings[MV_CLASSES];
-static struct vp9_token mv_fp_encodings[MV_FP_SIZE];
-static struct vp9_token mv_class0_encodings[CLASS0_SIZE];
-
-void vp9_entropy_mv_init() {
- vp9_tokens_from_tree(mv_joint_encodings, vp9_mv_joint_tree);
- vp9_tokens_from_tree(mv_class_encodings, vp9_mv_class_tree);
- vp9_tokens_from_tree(mv_class0_encodings, vp9_mv_class0_tree);
- vp9_tokens_from_tree(mv_fp_encodings, vp9_mv_fp_tree);
-}
-
-static void encode_mv_component(vp9_writer* w, int comp,
- const nmv_component* mvcomp, int usehp) {
- int offset;
- const int sign = comp < 0;
- const int mag = sign ? -comp : comp;
- const int mv_class = vp9_get_mv_class(mag - 1, &offset);
- const int d = offset >> 3; // int mv data
- const int fr = (offset >> 1) & 3; // fractional mv data
- const int hp = offset & 1; // high precision mv data
-
- assert(comp != 0);
-
- // Sign
- vp9_write(w, sign, mvcomp->sign);
-
- // Class
- vp9_write_token(w, vp9_mv_class_tree, mvcomp->classes,
- &mv_class_encodings[mv_class]);
-
- // Integer bits
- if (mv_class == MV_CLASS_0) {
- vp9_write_token(w, vp9_mv_class0_tree, mvcomp->class0,
- &mv_class0_encodings[d]);
- } else {
- int i;
- const int n = mv_class + CLASS0_BITS - 1; // number of bits
- for (i = 0; i < n; ++i)
- vp9_write(w, (d >> i) & 1, mvcomp->bits[i]);
- }
-
- // Fractional bits
- vp9_write_token(w, vp9_mv_fp_tree,
- mv_class == MV_CLASS_0 ? mvcomp->class0_fp[d] : mvcomp->fp,
- &mv_fp_encodings[fr]);
-
- // High precision bit
- if (usehp)
- vp9_write(w, hp,
- mv_class == MV_CLASS_0 ? mvcomp->class0_hp : mvcomp->hp);
-}
-
-
-static void build_nmv_component_cost_table(int *mvcost,
- const nmv_component* const mvcomp,
- int usehp) {
- int i, v;
- int sign_cost[2], class_cost[MV_CLASSES], class0_cost[CLASS0_SIZE];
- int bits_cost[MV_OFFSET_BITS][2];
- int class0_fp_cost[CLASS0_SIZE][MV_FP_SIZE], fp_cost[MV_FP_SIZE];
- int class0_hp_cost[2], hp_cost[2];
-
- sign_cost[0] = vp9_cost_zero(mvcomp->sign);
- sign_cost[1] = vp9_cost_one(mvcomp->sign);
- vp9_cost_tokens(class_cost, mvcomp->classes, vp9_mv_class_tree);
- vp9_cost_tokens(class0_cost, mvcomp->class0, vp9_mv_class0_tree);
- for (i = 0; i < MV_OFFSET_BITS; ++i) {
- bits_cost[i][0] = vp9_cost_zero(mvcomp->bits[i]);
- bits_cost[i][1] = vp9_cost_one(mvcomp->bits[i]);
- }
-
- for (i = 0; i < CLASS0_SIZE; ++i)
- vp9_cost_tokens(class0_fp_cost[i], mvcomp->class0_fp[i], vp9_mv_fp_tree);
- vp9_cost_tokens(fp_cost, mvcomp->fp, vp9_mv_fp_tree);
-
- if (usehp) {
- class0_hp_cost[0] = vp9_cost_zero(mvcomp->class0_hp);
- class0_hp_cost[1] = vp9_cost_one(mvcomp->class0_hp);
- hp_cost[0] = vp9_cost_zero(mvcomp->hp);
- hp_cost[1] = vp9_cost_one(mvcomp->hp);
- }
- mvcost[0] = 0;
- for (v = 1; v <= MV_MAX; ++v) {
- int z, c, o, d, e, f, cost = 0;
- z = v - 1;
- c = vp9_get_mv_class(z, &o);
- cost += class_cost[c];
- d = (o >> 3); /* int mv data */
- f = (o >> 1) & 3; /* fractional pel mv data */
- e = (o & 1); /* high precision mv data */
- if (c == MV_CLASS_0) {
- cost += class0_cost[d];
- } else {
- int i, b;
- b = c + CLASS0_BITS - 1; /* number of bits */
- for (i = 0; i < b; ++i)
- cost += bits_cost[i][((d >> i) & 1)];
- }
- if (c == MV_CLASS_0) {
- cost += class0_fp_cost[d][f];
- } else {
- cost += fp_cost[f];
- }
- if (usehp) {
- if (c == MV_CLASS_0) {
- cost += class0_hp_cost[e];
- } else {
- cost += hp_cost[e];
- }
- }
- mvcost[v] = cost + sign_cost[0];
- mvcost[-v] = cost + sign_cost[1];
- }
-}
-
-static int update_mv(vp9_writer *w, const unsigned int ct[2], vp9_prob *cur_p,
- vp9_prob upd_p) {
- const vp9_prob new_p = get_binary_prob(ct[0], ct[1]) | 1;
- const int update = cost_branch256(ct, *cur_p) + vp9_cost_zero(upd_p) >
- cost_branch256(ct, new_p) + vp9_cost_one(upd_p) + 7 * 256;
- vp9_write(w, update, upd_p);
- if (update) {
- *cur_p = new_p;
- vp9_write_literal(w, new_p >> 1, 7);
- }
- return update;
-}
-
-static void write_mv_update(const vp9_tree_index *tree,
- vp9_prob probs[/*n - 1*/],
- const unsigned int counts[/*n - 1*/],
- int n, vp9_writer *w) {
- int i;
- unsigned int branch_ct[32][2];
-
- // Assuming max number of probabilities <= 32
- assert(n <= 32);
-
- vp9_tree_probs_from_distribution(tree, branch_ct, counts);
- for (i = 0; i < n - 1; ++i)
- update_mv(w, branch_ct[i], &probs[i], MV_UPDATE_PROB);
-}
-
-void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer *w) {
- int i, j;
- nmv_context *const mvc = &cm->fc.nmvc;
- nmv_context_counts *const counts = &cm->counts.mv;
-
- write_mv_update(vp9_mv_joint_tree, mvc->joints, counts->joints, MV_JOINTS, w);
-
- for (i = 0; i < 2; ++i) {
- 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(vp9_mv_class_tree, comp->classes, comp_counts->classes,
- MV_CLASSES, w);
- write_mv_update(vp9_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) {
- for (j = 0; j < CLASS0_SIZE; ++j)
- write_mv_update(vp9_mv_fp_tree, mvc->comps[i].class0_fp[j],
- counts->comps[i].class0_fp[j], MV_FP_SIZE, w);
-
- write_mv_update(vp9_mv_fp_tree, mvc->comps[i].fp, counts->comps[i].fp,
- MV_FP_SIZE, w);
- }
-
- 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);
- }
- }
-}
-
-void vp9_encode_mv(VP9_COMP* cpi, vp9_writer* w,
- const MV* mv, const MV* ref,
- const nmv_context* mvctx, int usehp) {
- const MV diff = {mv->row - ref->row,
- mv->col - ref->col};
- const MV_JOINT_TYPE j = vp9_get_mv_joint(&diff);
- usehp = usehp && vp9_use_mv_hp(ref);
-
- vp9_write_token(w, vp9_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]);
- if (mv_joint_vertical(j))
- encode_mv_component(w, diff.row, &mvctx->comps[0], usehp);
-
- if (mv_joint_horizontal(j))
- encode_mv_component(w, diff.col, &mvctx->comps[1], usehp);
-
- // If auto_mv_step_size is enabled then keep track of the largest
- // motion vector component used.
- if (!cpi->dummy_packing && cpi->sf.auto_mv_step_size) {
- unsigned int maxv = MAX(abs(mv->row), abs(mv->col)) >> 3;
- cpi->max_mv_magnitude = MAX(maxv, cpi->max_mv_magnitude);
- }
-}
-
-void vp9_build_nmv_cost_table(int *mvjoint, int *mvcost[2],
- const nmv_context* ctx, int usehp) {
- vp9_cost_tokens(mvjoint, ctx->joints, vp9_mv_joint_tree);
- build_nmv_component_cost_table(mvcost[0], &ctx->comps[0], usehp);
- build_nmv_component_cost_table(mvcost[1], &ctx->comps[1], usehp);
-}
-
-static void inc_mvs(const MB_MODE_INFO *mbmi, const int_mv mvs[2],
- nmv_context_counts *counts) {
- int i;
-
- for (i = 0; i < 1 + has_second_ref(mbmi); ++i) {
- const MV *ref = &mbmi->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};
- vp9_inc_mv(&diff, counts);
- }
-}
-
-void vp9_update_mv_count(VP9_COMMON *cm, const MACROBLOCKD *xd) {
- const MODE_INFO *mi = xd->mi[0];
- const MB_MODE_INFO *const mbmi = &mi->mbmi;
-
- if (mbmi->sb_type < BLOCK_8X8) {
- const int num_4x4_w = num_4x4_blocks_wide_lookup[mbmi->sb_type];
- const int num_4x4_h = num_4x4_blocks_high_lookup[mbmi->sb_type];
- int idx, idy;
-
- for (idy = 0; idy < 2; idy += num_4x4_h) {
- for (idx = 0; idx < 2; idx += num_4x4_w) {
- const int i = idy * 2 + idx;
- if (mi->bmi[i].as_mode == NEWMV)
- inc_mvs(mbmi, mi->bmi[i].as_mv, &cm->counts.mv);
- }
- }
- } else {
- if (mbmi->mode == NEWMV)
- inc_mvs(mbmi, mbmi->mv, &cm->counts.mv);
- }
-}
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.h
deleted file mode 100644
index 50cb961..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_encodemv.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_ENCODEMV_H_
-#define VP9_ENCODER_VP9_ENCODEMV_H_
-
-#include "vp9/encoder/vp9_onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_entropy_mv_init();
-
-void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer *w);
-
-void vp9_encode_mv(VP9_COMP *cpi, vp9_writer* w, const MV* mv, const MV* ref,
- const nmv_context* mvctx, int usehp);
-
-void vp9_build_nmv_cost_table(int *mvjoint, int *mvcost[2],
- const nmv_context* mvctx, int usehp);
-
-void vp9_update_mv_count(VP9_COMMON *cm, const MACROBLOCKD *xd);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_ENCODEMV_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.c
deleted file mode 100644
index dcbb5ac..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/encoder/vp9_extend.h"
-
-static void copy_and_extend_plane(const uint8_t *src, int src_pitch,
- uint8_t *dst, int dst_pitch,
- int w, int h,
- int extend_top, int extend_left,
- int extend_bottom, int extend_right) {
- int i, linesize;
-
- // copy the left and right most columns out
- const uint8_t *src_ptr1 = src;
- const uint8_t *src_ptr2 = src + w - 1;
- uint8_t *dst_ptr1 = dst - extend_left;
- uint8_t *dst_ptr2 = dst + w;
-
- for (i = 0; i < h; i++) {
- vpx_memset(dst_ptr1, src_ptr1[0], extend_left);
- vpx_memcpy(dst_ptr1 + extend_left, src_ptr1, w);
- vpx_memset(dst_ptr2, src_ptr2[0], extend_right);
- src_ptr1 += src_pitch;
- src_ptr2 += src_pitch;
- dst_ptr1 += dst_pitch;
- dst_ptr2 += dst_pitch;
- }
-
- // Now copy the top and bottom lines into each line of the respective
- // borders
- src_ptr1 = dst - extend_left;
- src_ptr2 = dst + dst_pitch * (h - 1) - extend_left;
- dst_ptr1 = dst + dst_pitch * (-extend_top) - extend_left;
- dst_ptr2 = dst + dst_pitch * (h) - extend_left;
- linesize = extend_left + extend_right + w;
-
- for (i = 0; i < extend_top; i++) {
- vpx_memcpy(dst_ptr1, src_ptr1, linesize);
- dst_ptr1 += dst_pitch;
- }
-
- for (i = 0; i < extend_bottom; i++) {
- vpx_memcpy(dst_ptr2, src_ptr2, linesize);
- dst_ptr2 += dst_pitch;
- }
-}
-
-void vp9_copy_and_extend_frame(const YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst) {
- // Extend src frame in buffer
- // Altref filtering assumes 16 pixel extension
- const int et_y = 16;
- const int el_y = 16;
- // Motion estimation may use src block variance with the block size up
- // to 64x64, so the right and bottom need to be extended to 64 multiple
- // or up to 16, whichever is greater.
- const int eb_y = MAX(ALIGN_POWER_OF_TWO(src->y_width, 6) - src->y_width,
- 16);
- const int er_y = MAX(ALIGN_POWER_OF_TWO(src->y_height, 6) - src->y_height,
- 16);
- const int uv_width_subsampling = (src->uv_width != src->y_width);
- const int uv_height_subsampling = (src->uv_height != src->y_height);
- const int et_uv = et_y >> uv_height_subsampling;
- const int el_uv = el_y >> uv_width_subsampling;
- const int eb_uv = eb_y >> uv_height_subsampling;
- const int er_uv = er_y >> uv_width_subsampling;
-
-#if CONFIG_ALPHA
- const int et_a = dst->border >> (dst->alpha_height != dst->y_height);
- const int el_a = dst->border >> (dst->alpha_width != dst->y_width);
- const int eb_a = et_a + dst->alpha_height - src->alpha_height;
- const int er_a = el_a + dst->alpha_width - src->alpha_width;
-
- copy_and_extend_plane(src->alpha_buffer, src->alpha_stride,
- dst->alpha_buffer, dst->alpha_stride,
- src->alpha_width, src->alpha_height,
- et_a, el_a, eb_a, er_a);
-#endif
-
- copy_and_extend_plane(src->y_buffer, src->y_stride,
- dst->y_buffer, dst->y_stride,
- src->y_width, src->y_height,
- et_y, el_y, eb_y, er_y);
-
- copy_and_extend_plane(src->u_buffer, src->uv_stride,
- dst->u_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
- et_uv, el_uv, eb_uv, er_uv);
-
- copy_and_extend_plane(src->v_buffer, src->uv_stride,
- dst->v_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
- et_uv, el_uv, eb_uv, er_uv);
-}
-
-void vp9_copy_and_extend_frame_with_rect(const YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst,
- int srcy, int srcx,
- int srch, int srcw) {
- // If the side is not touching the bounder then don't extend.
- const int et_y = srcy ? 0 : dst->border;
- const int el_y = srcx ? 0 : dst->border;
- const int eb_y = srcy + srch != src->y_height ? 0 :
- dst->border + dst->y_height - src->y_height;
- const int er_y = srcx + srcw != src->y_width ? 0 :
- dst->border + dst->y_width - src->y_width;
- const int src_y_offset = srcy * src->y_stride + srcx;
- const int dst_y_offset = srcy * dst->y_stride + srcx;
-
- const int et_uv = ROUND_POWER_OF_TWO(et_y, 1);
- const int el_uv = ROUND_POWER_OF_TWO(el_y, 1);
- const int eb_uv = ROUND_POWER_OF_TWO(eb_y, 1);
- const int er_uv = ROUND_POWER_OF_TWO(er_y, 1);
- const int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1);
- const int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1);
- const int srch_uv = ROUND_POWER_OF_TWO(srch, 1);
- const int srcw_uv = ROUND_POWER_OF_TWO(srcw, 1);
-
- copy_and_extend_plane(src->y_buffer + src_y_offset, src->y_stride,
- dst->y_buffer + dst_y_offset, dst->y_stride,
- srcw, srch,
- et_y, el_y, eb_y, er_y);
-
- copy_and_extend_plane(src->u_buffer + src_uv_offset, src->uv_stride,
- dst->u_buffer + dst_uv_offset, dst->uv_stride,
- srcw_uv, srch_uv,
- et_uv, el_uv, eb_uv, er_uv);
-
- copy_and_extend_plane(src->v_buffer + src_uv_offset, src->uv_stride,
- dst->v_buffer + dst_uv_offset, dst->uv_stride,
- srcw_uv, srch_uv,
- et_uv, el_uv, eb_uv, er_uv);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.h
deleted file mode 100644
index 058fe09..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_extend.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_EXTEND_H_
-#define VP9_ENCODER_VP9_EXTEND_H_
-
-#include "vpx_scale/yv12config.h"
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-void vp9_copy_and_extend_frame(const YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst);
-
-void vp9_copy_and_extend_frame_with_rect(const YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst,
- int srcy, int srcx,
- int srch, int srcw);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_EXTEND_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.c
deleted file mode 100644
index 7ec5255..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.c
+++ /dev/null
@@ -1,2348 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-
-#include "./vpx_scale_rtcd.h"
-
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_scale/vpx_scale.h"
-#include "vpx_scale/yv12config.h"
-
-#include "vp9/common/vp9_entropymv.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_reconinter.h" // vp9_setup_dst_planes()
-#include "vp9/common/vp9_systemdependent.h"
-
-#include "vp9/encoder/vp9_aq_variance.h"
-#include "vp9/encoder/vp9_block.h"
-#include "vp9/encoder/vp9_encodeframe.h"
-#include "vp9/encoder/vp9_encodemb.h"
-#include "vp9/encoder/vp9_encodemv.h"
-#include "vp9/encoder/vp9_extend.h"
-#include "vp9/encoder/vp9_firstpass.h"
-#include "vp9/encoder/vp9_mcomp.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_quantize.h"
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_variance.h"
-
-#define OUTPUT_FPF 0
-
-#define IIFACTOR 12.5
-#define IIKFACTOR1 12.5
-#define IIKFACTOR2 15.0
-#define RMAX 512.0
-#define GF_RMAX 96.0
-#define ERR_DIVISOR 150.0
-#define MIN_DECAY_FACTOR 0.1
-
-#define KF_MB_INTRA_MIN 150
-#define GF_MB_INTRA_MIN 100
-
-#define DOUBLE_DIVIDE_CHECK(x) ((x) < 0 ? (x) - 0.000001 : (x) + 0.000001)
-
-#define MIN_KF_BOOST 300
-
-#if CONFIG_MULTIPLE_ARF
-// Set MIN_GF_INTERVAL to 1 for the full decomposition.
-#define MIN_GF_INTERVAL 2
-#else
-#define MIN_GF_INTERVAL 4
-#endif
-
-static void swap_yv12(YV12_BUFFER_CONFIG *a, YV12_BUFFER_CONFIG *b) {
- YV12_BUFFER_CONFIG temp = *a;
- *a = *b;
- *b = temp;
-}
-
-static int gfboost_qadjust(int qindex) {
- const double q = vp9_convert_qindex_to_q(qindex);
- return (int)((0.00000828 * q * q * q) +
- (-0.0055 * q * q) +
- (1.32 * q) + 79.3);
-}
-
-// Resets the first pass file to the given position using a relative seek from
-// the current position.
-static void reset_fpf_position(struct twopass_rc *p,
- const FIRSTPASS_STATS *position) {
- p->stats_in = position;
-}
-
-static int lookup_next_frame_stats(const struct twopass_rc *p,
- FIRSTPASS_STATS *next_frame) {
- if (p->stats_in >= p->stats_in_end)
- return EOF;
-
- *next_frame = *p->stats_in;
- return 1;
-}
-
-
-// Read frame stats at an offset from the current position.
-static int read_frame_stats(const struct twopass_rc *p,
- FIRSTPASS_STATS *frame_stats, int offset) {
- const FIRSTPASS_STATS *fps_ptr = p->stats_in;
-
- // Check legality of offset.
- if (offset >= 0) {
- if (&fps_ptr[offset] >= p->stats_in_end)
- return EOF;
- } else if (offset < 0) {
- if (&fps_ptr[offset] < p->stats_in_start)
- return EOF;
- }
-
- *frame_stats = fps_ptr[offset];
- return 1;
-}
-
-static int input_stats(struct twopass_rc *p, FIRSTPASS_STATS *fps) {
- if (p->stats_in >= p->stats_in_end)
- return EOF;
-
- *fps = *p->stats_in;
- ++p->stats_in;
- return 1;
-}
-
-static void output_stats(FIRSTPASS_STATS *stats,
- struct vpx_codec_pkt_list *pktlist) {
- struct vpx_codec_cx_pkt pkt;
- pkt.kind = VPX_CODEC_STATS_PKT;
- pkt.data.twopass_stats.buf = stats;
- pkt.data.twopass_stats.sz = sizeof(FIRSTPASS_STATS);
- vpx_codec_pkt_list_add(pktlist, &pkt);
-
-// TEMP debug code
-#if OUTPUT_FPF
- {
- FILE *fpfile;
- fpfile = fopen("firstpass.stt", "a");
-
- fprintf(fpfile, "%12.0f %12.0f %12.0f %12.0f %12.0f %12.4f %12.4f"
- "%12.4f %12.4f %12.4f %12.4f %12.4f %12.4f %12.4f"
- "%12.0f %12.0f %12.4f %12.0f %12.0f %12.4f\n",
- stats->frame,
- stats->intra_error,
- stats->coded_error,
- stats->sr_coded_error,
- stats->ssim_weighted_pred_err,
- stats->pcnt_inter,
- stats->pcnt_motion,
- stats->pcnt_second_ref,
- stats->pcnt_neutral,
- stats->MVr,
- stats->mvr_abs,
- stats->MVc,
- stats->mvc_abs,
- stats->MVrv,
- stats->MVcv,
- stats->mv_in_out_count,
- stats->new_mv_count,
- stats->count,
- stats->duration);
- fclose(fpfile);
- }
-#endif
-}
-
-static void zero_stats(FIRSTPASS_STATS *section) {
- section->frame = 0.0;
- section->intra_error = 0.0;
- section->coded_error = 0.0;
- section->sr_coded_error = 0.0;
- section->ssim_weighted_pred_err = 0.0;
- section->pcnt_inter = 0.0;
- section->pcnt_motion = 0.0;
- section->pcnt_second_ref = 0.0;
- section->pcnt_neutral = 0.0;
- section->MVr = 0.0;
- section->mvr_abs = 0.0;
- section->MVc = 0.0;
- section->mvc_abs = 0.0;
- section->MVrv = 0.0;
- section->MVcv = 0.0;
- section->mv_in_out_count = 0.0;
- section->new_mv_count = 0.0;
- section->count = 0.0;
- section->duration = 1.0;
- section->spatial_layer_id = 0;
-}
-
-static void accumulate_stats(FIRSTPASS_STATS *section,
- const FIRSTPASS_STATS *frame) {
- section->frame += frame->frame;
- section->spatial_layer_id = frame->spatial_layer_id;
- section->intra_error += frame->intra_error;
- section->coded_error += frame->coded_error;
- section->sr_coded_error += frame->sr_coded_error;
- section->ssim_weighted_pred_err += frame->ssim_weighted_pred_err;
- section->pcnt_inter += frame->pcnt_inter;
- section->pcnt_motion += frame->pcnt_motion;
- section->pcnt_second_ref += frame->pcnt_second_ref;
- section->pcnt_neutral += frame->pcnt_neutral;
- section->MVr += frame->MVr;
- section->mvr_abs += frame->mvr_abs;
- section->MVc += frame->MVc;
- section->mvc_abs += frame->mvc_abs;
- section->MVrv += frame->MVrv;
- section->MVcv += frame->MVcv;
- section->mv_in_out_count += frame->mv_in_out_count;
- section->new_mv_count += frame->new_mv_count;
- section->count += frame->count;
- section->duration += frame->duration;
-}
-
-static void subtract_stats(FIRSTPASS_STATS *section,
- const FIRSTPASS_STATS *frame) {
- section->frame -= frame->frame;
- section->intra_error -= frame->intra_error;
- section->coded_error -= frame->coded_error;
- section->sr_coded_error -= frame->sr_coded_error;
- section->ssim_weighted_pred_err -= frame->ssim_weighted_pred_err;
- section->pcnt_inter -= frame->pcnt_inter;
- section->pcnt_motion -= frame->pcnt_motion;
- section->pcnt_second_ref -= frame->pcnt_second_ref;
- section->pcnt_neutral -= frame->pcnt_neutral;
- section->MVr -= frame->MVr;
- section->mvr_abs -= frame->mvr_abs;
- section->MVc -= frame->MVc;
- section->mvc_abs -= frame->mvc_abs;
- section->MVrv -= frame->MVrv;
- section->MVcv -= frame->MVcv;
- section->mv_in_out_count -= frame->mv_in_out_count;
- section->new_mv_count -= frame->new_mv_count;
- section->count -= frame->count;
- section->duration -= frame->duration;
-}
-
-static void avg_stats(FIRSTPASS_STATS *section) {
- if (section->count < 1.0)
- return;
-
- section->intra_error /= section->count;
- section->coded_error /= section->count;
- section->sr_coded_error /= section->count;
- section->ssim_weighted_pred_err /= section->count;
- section->pcnt_inter /= section->count;
- section->pcnt_second_ref /= section->count;
- section->pcnt_neutral /= section->count;
- section->pcnt_motion /= section->count;
- section->MVr /= section->count;
- section->mvr_abs /= section->count;
- section->MVc /= section->count;
- section->mvc_abs /= section->count;
- section->MVrv /= section->count;
- section->MVcv /= section->count;
- section->mv_in_out_count /= section->count;
- section->duration /= section->count;
-}
-
-// Calculate a modified Error used in distributing bits between easier and
-// harder frames.
-static double calculate_modified_err(const VP9_COMP *cpi,
- const FIRSTPASS_STATS *this_frame) {
- const struct twopass_rc *twopass = &cpi->twopass;
- const FIRSTPASS_STATS *stats;
- double av_err;
- double modified_error;
-
- if (cpi->svc.number_spatial_layers > 1 &&
- cpi->svc.number_temporal_layers == 1) {
- twopass = &cpi->svc.layer_context[cpi->svc.spatial_layer_id].twopass;
- }
-
- stats = &twopass->total_stats;
- av_err = stats->ssim_weighted_pred_err / stats->count;
- modified_error = av_err * pow(this_frame->ssim_weighted_pred_err /
- DOUBLE_DIVIDE_CHECK(av_err),
- cpi->oxcf.two_pass_vbrbias / 100.0);
-
- return fclamp(modified_error,
- twopass->modified_error_min, twopass->modified_error_max);
-}
-
-static const double weight_table[256] = {
- 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
- 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
- 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
- 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.020000,
- 0.020000, 0.020000, 0.020000, 0.020000, 0.020000, 0.031250, 0.062500,
- 0.093750, 0.125000, 0.156250, 0.187500, 0.218750, 0.250000, 0.281250,
- 0.312500, 0.343750, 0.375000, 0.406250, 0.437500, 0.468750, 0.500000,
- 0.531250, 0.562500, 0.593750, 0.625000, 0.656250, 0.687500, 0.718750,
- 0.750000, 0.781250, 0.812500, 0.843750, 0.875000, 0.906250, 0.937500,
- 0.968750, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
- 1.000000, 1.000000, 1.000000, 1.000000
-};
-
-static double simple_weight(const YV12_BUFFER_CONFIG *buf) {
- int i, j;
- double sum = 0.0;
- const int w = buf->y_crop_width;
- const int h = buf->y_crop_height;
- const uint8_t *row = buf->y_buffer;
-
- for (i = 0; i < h; ++i) {
- const uint8_t *pixel = row;
- for (j = 0; j < w; ++j)
- sum += weight_table[*pixel++];
- row += buf->y_stride;
- }
-
- return MAX(0.1, sum / (w * h));
-}
-
-// This function returns the maximum target rate per frame.
-static int frame_max_bits(const VP9_COMP *cpi) {
- int64_t max_bits =
- ((int64_t)cpi->rc.av_per_frame_bandwidth *
- (int64_t)cpi->oxcf.two_pass_vbrmax_section) / 100;
-
- if (max_bits < 0)
- max_bits = 0;
- else if (max_bits > cpi->rc.max_frame_bandwidth)
- max_bits = cpi->rc.max_frame_bandwidth;
-
- return (int)max_bits;
-}
-
-void vp9_init_first_pass(VP9_COMP *cpi) {
- zero_stats(&cpi->twopass.total_stats);
-}
-
-void vp9_end_first_pass(VP9_COMP *cpi) {
- if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
- int i;
- for (i = 0; i < cpi->svc.number_spatial_layers; ++i) {
- output_stats(&cpi->svc.layer_context[i].twopass.total_stats,
- cpi->output_pkt_list);
- }
- } else {
- output_stats(&cpi->twopass.total_stats, cpi->output_pkt_list);
- }
-}
-
-static vp9_variance_fn_t get_block_variance_fn(BLOCK_SIZE bsize) {
- switch (bsize) {
- case BLOCK_8X8:
- return vp9_mse8x8;
- case BLOCK_16X8:
- return vp9_mse16x8;
- case BLOCK_8X16:
- return vp9_mse8x16;
- default:
- return vp9_mse16x16;
- }
-}
-
-static unsigned int zz_motion_search(const MACROBLOCK *x) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- const uint8_t *const src = x->plane[0].src.buf;
- const int src_stride = x->plane[0].src.stride;
- const uint8_t *const ref = xd->plane[0].pre[0].buf;
- const int ref_stride = xd->plane[0].pre[0].stride;
- unsigned int sse;
- vp9_variance_fn_t fn = get_block_variance_fn(xd->mi[0]->mbmi.sb_type);
- fn(src, src_stride, ref, ref_stride, &sse);
- return sse;
-}
-
-static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
- const MV *ref_mv, MV *best_mv,
- int *best_motion_err) {
- MACROBLOCKD *const xd = &x->e_mbd;
- MV tmp_mv = {0, 0};
- MV ref_mv_full = {ref_mv->row >> 3, ref_mv->col >> 3};
- int num00, tmp_err, n, sr = 0;
- int step_param = 3;
- int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
- const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
- vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[bsize];
- int new_mv_mode_penalty = 256;
- const int quart_frm = MIN(cpi->common.width, cpi->common.height);
-
- // Refine the motion search range according to the frame dimension
- // for first pass test.
- while ((quart_frm << sr) < MAX_FULL_PEL_VAL)
- ++sr;
-
- step_param += sr;
- further_steps -= sr;
-
- // Override the default variance function to use MSE.
- v_fn_ptr.vf = get_block_variance_fn(bsize);
-
- // Center the initial step/diamond search on best mv.
- tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
- step_param,
- x->sadperbit16, &num00, &v_fn_ptr,
- x->nmvjointcost,
- x->mvcost, ref_mv);
- if (tmp_err < INT_MAX)
- tmp_err = vp9_get_mvpred_var(x, &tmp_mv, ref_mv, &v_fn_ptr, 1);
- if (tmp_err < INT_MAX - new_mv_mode_penalty)
- tmp_err += new_mv_mode_penalty;
-
- if (tmp_err < *best_motion_err) {
- *best_motion_err = tmp_err;
- best_mv->row = tmp_mv.row;
- best_mv->col = tmp_mv.col;
- }
-
- // Carry out further step/diamond searches as necessary.
- n = num00;
- num00 = 0;
-
- while (n < further_steps) {
- ++n;
-
- if (num00) {
- --num00;
- } else {
- tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
- step_param + n, x->sadperbit16,
- &num00, &v_fn_ptr,
- x->nmvjointcost,
- x->mvcost, ref_mv);
- if (tmp_err < INT_MAX)
- tmp_err = vp9_get_mvpred_var(x, &tmp_mv, ref_mv, &v_fn_ptr, 1);
- if (tmp_err < INT_MAX - new_mv_mode_penalty)
- tmp_err += new_mv_mode_penalty;
-
- if (tmp_err < *best_motion_err) {
- *best_motion_err = tmp_err;
- best_mv->row = tmp_mv.row;
- best_mv->col = tmp_mv.col;
- }
- }
- }
-}
-
-static BLOCK_SIZE get_bsize(const VP9_COMMON *cm, int mb_row, int mb_col) {
- if (2 * mb_col + 1 < cm->mi_cols) {
- return 2 * mb_row + 1 < cm->mi_rows ? BLOCK_16X16
- : BLOCK_16X8;
- } else {
- return 2 * mb_row + 1 < cm->mi_rows ? BLOCK_8X16
- : BLOCK_8X8;
- }
-}
-
-void vp9_first_pass(VP9_COMP *cpi) {
- int mb_row, mb_col;
- MACROBLOCK *const x = &cpi->mb;
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- TileInfo tile;
- struct macroblock_plane *const p = x->plane;
- struct macroblockd_plane *const pd = xd->plane;
- const PICK_MODE_CONTEXT *ctx = &x->sb64_context;
- int i;
-
- int recon_yoffset, recon_uvoffset;
- YV12_BUFFER_CONFIG *const lst_yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
- YV12_BUFFER_CONFIG *gld_yv12 = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
- YV12_BUFFER_CONFIG *const new_yv12 = get_frame_new_buffer(cm);
- int recon_y_stride = lst_yv12->y_stride;
- int recon_uv_stride = lst_yv12->uv_stride;
- int uv_mb_height = 16 >> (lst_yv12->y_height > lst_yv12->uv_height);
- int64_t intra_error = 0;
- int64_t coded_error = 0;
- int64_t sr_coded_error = 0;
-
- int sum_mvr = 0, sum_mvc = 0;
- int sum_mvr_abs = 0, sum_mvc_abs = 0;
- int64_t sum_mvrs = 0, sum_mvcs = 0;
- int mvcount = 0;
- int intercount = 0;
- int second_ref_count = 0;
- int intrapenalty = 256;
- int neutral_count = 0;
- int new_mv_count = 0;
- int sum_in_vectors = 0;
- uint32_t lastmv_as_int = 0;
- struct twopass_rc *twopass = &cpi->twopass;
- const MV zero_mv = {0, 0};
- const YV12_BUFFER_CONFIG *first_ref_buf = lst_yv12;
-
- vp9_clear_system_state();
-
- if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
- MV_REFERENCE_FRAME ref_frame = LAST_FRAME;
- const YV12_BUFFER_CONFIG *scaled_ref_buf = NULL;
- twopass = &cpi->svc.layer_context[cpi->svc.spatial_layer_id].twopass;
-
- vp9_scale_references(cpi);
-
- // Use either last frame or alt frame for motion search.
- if (cpi->ref_frame_flags & VP9_LAST_FLAG) {
- scaled_ref_buf = vp9_get_scaled_ref_frame(cpi, LAST_FRAME);
- ref_frame = LAST_FRAME;
- } else if (cpi->ref_frame_flags & VP9_ALT_FLAG) {
- scaled_ref_buf = vp9_get_scaled_ref_frame(cpi, ALTREF_FRAME);
- ref_frame = ALTREF_FRAME;
- }
-
- if (scaled_ref_buf != NULL) {
- // Update the stride since we are using scaled reference buffer
- first_ref_buf = scaled_ref_buf;
- recon_y_stride = first_ref_buf->y_stride;
- recon_uv_stride = first_ref_buf->uv_stride;
- uv_mb_height = 16 >> (first_ref_buf->y_height > first_ref_buf->uv_height);
- }
-
- // Disable golden frame for svc first pass for now.
- gld_yv12 = NULL;
- set_ref_ptrs(cm, xd, ref_frame, NONE);
- }
-
- vp9_setup_src_planes(x, cpi->Source, 0, 0);
- vp9_setup_pre_planes(xd, 0, first_ref_buf, 0, 0, NULL);
- vp9_setup_dst_planes(xd, new_yv12, 0, 0);
-
- xd->mi = cm->mi_grid_visible;
- xd->mi[0] = cm->mi;
-
- vp9_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
-
- vp9_frame_init_quantizer(cpi);
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- p[i].coeff = ctx->coeff_pbuf[i][1];
- p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
- pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
- p[i].eobs = ctx->eobs_pbuf[i][1];
- }
- x->skip_recode = 0;
-
- vp9_init_mv_probs(cm);
- vp9_initialize_rd_consts(cpi);
-
- // Tiling is ignored in the first pass.
- vp9_tile_init(&tile, cm, 0, 0);
-
- for (mb_row = 0; mb_row < cm->mb_rows; ++mb_row) {
- int_mv best_ref_mv;
-
- best_ref_mv.as_int = 0;
-
- // Reset above block coeffs.
- xd->up_available = (mb_row != 0);
- recon_yoffset = (mb_row * recon_y_stride * 16);
- recon_uvoffset = (mb_row * recon_uv_stride * uv_mb_height);
-
- // Set up limit values for motion vectors to prevent them extending
- // outside the UMV borders.
- x->mv_row_min = -((mb_row * 16) + BORDER_MV_PIXELS_B16);
- x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16)
- + BORDER_MV_PIXELS_B16;
-
- for (mb_col = 0; mb_col < cm->mb_cols; ++mb_col) {
- int this_error;
- const int use_dc_pred = (mb_col || mb_row) && (!mb_col || !mb_row);
- double error_weight = 1.0;
- const BLOCK_SIZE bsize = get_bsize(cm, mb_row, mb_col);
-
- vp9_clear_system_state();
-
- xd->plane[0].dst.buf = new_yv12->y_buffer + recon_yoffset;
- xd->plane[1].dst.buf = new_yv12->u_buffer + recon_uvoffset;
- xd->plane[2].dst.buf = new_yv12->v_buffer + recon_uvoffset;
- xd->left_available = (mb_col != 0);
- xd->mi[0]->mbmi.sb_type = bsize;
- xd->mi[0]->mbmi.ref_frame[0] = INTRA_FRAME;
- set_mi_row_col(xd, &tile,
- mb_row << 1, num_8x8_blocks_high_lookup[bsize],
- mb_col << 1, num_8x8_blocks_wide_lookup[bsize],
- cm->mi_rows, cm->mi_cols);
-
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- const int energy = vp9_block_energy(cpi, x, bsize);
- error_weight = vp9_vaq_inv_q_ratio(energy);
- }
-
- // Do intra 16x16 prediction.
- this_error = vp9_encode_intra(x, use_dc_pred);
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state();
- this_error = (int)(this_error * error_weight);
- }
-
- // Intrapenalty below deals with situations where the intra and inter
- // error scores are very low (e.g. a plain black frame).
- // We do not have special cases in first pass for 0,0 and nearest etc so
- // all inter modes carry an overhead cost estimate for the mv.
- // When the error score is very low this causes us to pick all or lots of
- // INTRA modes and throw lots of key frames.
- // This penalty adds a cost matching that of a 0,0 mv to the intra case.
- this_error += intrapenalty;
-
- // Accumulate the intra error.
- intra_error += (int64_t)this_error;
-
- // Set up limit values for motion vectors to prevent them extending
- // outside the UMV borders.
- x->mv_col_min = -((mb_col * 16) + BORDER_MV_PIXELS_B16);
- x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + BORDER_MV_PIXELS_B16;
-
- // Other than for the first frame do a motion search.
- if (cm->current_video_frame > 0) {
- int tmp_err, motion_error;
- int_mv mv, tmp_mv;
-
- xd->plane[0].pre[0].buf = first_ref_buf->y_buffer + recon_yoffset;
- motion_error = zz_motion_search(x);
- // Assume 0,0 motion with no mv overhead.
- mv.as_int = tmp_mv.as_int = 0;
-
- // Test last reference frame using the previous best mv as the
- // starting point (best reference) for the search.
- first_pass_motion_search(cpi, x, &best_ref_mv.as_mv, &mv.as_mv,
- &motion_error);
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state();
- motion_error = (int)(motion_error * error_weight);
- }
-
- // If the current best reference mv is not centered on 0,0 then do a 0,0
- // based search as well.
- if (best_ref_mv.as_int) {
- tmp_err = INT_MAX;
- first_pass_motion_search(cpi, x, &zero_mv, &tmp_mv.as_mv,
- &tmp_err);
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state();
- tmp_err = (int)(tmp_err * error_weight);
- }
-
- if (tmp_err < motion_error) {
- motion_error = tmp_err;
- mv.as_int = tmp_mv.as_int;
- }
- }
-
- // Search in an older reference frame.
- if (cm->current_video_frame > 1 && gld_yv12 != NULL) {
- // Assume 0,0 motion with no mv overhead.
- int gf_motion_error;
-
- xd->plane[0].pre[0].buf = gld_yv12->y_buffer + recon_yoffset;
- gf_motion_error = zz_motion_search(x);
-
- first_pass_motion_search(cpi, x, &zero_mv, &tmp_mv.as_mv,
- &gf_motion_error);
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state();
- gf_motion_error = (int)(gf_motion_error * error_weight);
- }
-
- if (gf_motion_error < motion_error && gf_motion_error < this_error)
- ++second_ref_count;
-
- // Reset to last frame as reference buffer.
- xd->plane[0].pre[0].buf = first_ref_buf->y_buffer + recon_yoffset;
- xd->plane[1].pre[0].buf = first_ref_buf->u_buffer + recon_uvoffset;
- xd->plane[2].pre[0].buf = first_ref_buf->v_buffer + recon_uvoffset;
-
- // In accumulating a score for the older reference frame take the
- // best of the motion predicted score and the intra coded error
- // (just as will be done for) accumulation of "coded_error" for
- // the last frame.
- if (gf_motion_error < this_error)
- sr_coded_error += gf_motion_error;
- else
- sr_coded_error += this_error;
- } else {
- sr_coded_error += motion_error;
- }
- // Start by assuming that intra mode is best.
- best_ref_mv.as_int = 0;
-
- if (motion_error <= this_error) {
- // Keep a count of cases where the inter and intra were very close
- // and very low. This helps with scene cut detection for example in
- // cropped clips with black bars at the sides or top and bottom.
- if (((this_error - intrapenalty) * 9 <= motion_error * 10) &&
- this_error < 2 * intrapenalty)
- ++neutral_count;
-
- mv.as_mv.row *= 8;
- mv.as_mv.col *= 8;
- this_error = motion_error;
- xd->mi[0]->mbmi.mode = NEWMV;
- xd->mi[0]->mbmi.mv[0] = mv;
- 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;
- vp9_build_inter_predictors_sby(xd, mb_row << 1, mb_col << 1, bsize);
- vp9_encode_sby_pass1(x, bsize);
- sum_mvr += mv.as_mv.row;
- sum_mvr_abs += abs(mv.as_mv.row);
- sum_mvc += mv.as_mv.col;
- sum_mvc_abs += abs(mv.as_mv.col);
- sum_mvrs += mv.as_mv.row * mv.as_mv.row;
- sum_mvcs += mv.as_mv.col * mv.as_mv.col;
- ++intercount;
-
- best_ref_mv.as_int = mv.as_int;
-
- if (mv.as_int) {
- ++mvcount;
-
- // Non-zero vector, was it different from the last non zero vector?
- if (mv.as_int != lastmv_as_int)
- ++new_mv_count;
- lastmv_as_int = mv.as_int;
-
- // Does the row vector point inwards or outwards?
- if (mb_row < cm->mb_rows / 2) {
- if (mv.as_mv.row > 0)
- --sum_in_vectors;
- else if (mv.as_mv.row < 0)
- ++sum_in_vectors;
- } else if (mb_row > cm->mb_rows / 2) {
- if (mv.as_mv.row > 0)
- ++sum_in_vectors;
- else if (mv.as_mv.row < 0)
- --sum_in_vectors;
- }
-
- // Does the col vector point inwards or outwards?
- if (mb_col < cm->mb_cols / 2) {
- if (mv.as_mv.col > 0)
- --sum_in_vectors;
- else if (mv.as_mv.col < 0)
- ++sum_in_vectors;
- } else if (mb_col > cm->mb_cols / 2) {
- if (mv.as_mv.col > 0)
- ++sum_in_vectors;
- else if (mv.as_mv.col < 0)
- --sum_in_vectors;
- }
- }
- }
- } else {
- sr_coded_error += (int64_t)this_error;
- }
- coded_error += (int64_t)this_error;
-
- // Adjust to the next column of MBs.
- x->plane[0].src.buf += 16;
- x->plane[1].src.buf += uv_mb_height;
- x->plane[2].src.buf += uv_mb_height;
-
- recon_yoffset += 16;
- recon_uvoffset += uv_mb_height;
- }
-
- // Adjust to the next row of MBs.
- x->plane[0].src.buf += 16 * x->plane[0].src.stride - 16 * cm->mb_cols;
- x->plane[1].src.buf += uv_mb_height * x->plane[1].src.stride -
- uv_mb_height * cm->mb_cols;
- x->plane[2].src.buf += uv_mb_height * x->plane[1].src.stride -
- uv_mb_height * cm->mb_cols;
-
- vp9_clear_system_state();
- }
-
- vp9_clear_system_state();
- {
- FIRSTPASS_STATS fps;
-
- fps.frame = cm->current_video_frame;
- fps.spatial_layer_id = cpi->svc.spatial_layer_id;
- fps.intra_error = (double)(intra_error >> 8);
- fps.coded_error = (double)(coded_error >> 8);
- fps.sr_coded_error = (double)(sr_coded_error >> 8);
- fps.ssim_weighted_pred_err = fps.coded_error * simple_weight(cpi->Source);
- fps.count = 1.0;
- fps.pcnt_inter = (double)intercount / cm->MBs;
- fps.pcnt_second_ref = (double)second_ref_count / cm->MBs;
- fps.pcnt_neutral = (double)neutral_count / cm->MBs;
-
- if (mvcount > 0) {
- fps.MVr = (double)sum_mvr / mvcount;
- fps.mvr_abs = (double)sum_mvr_abs / mvcount;
- fps.MVc = (double)sum_mvc / mvcount;
- fps.mvc_abs = (double)sum_mvc_abs / mvcount;
- fps.MVrv = ((double)sum_mvrs - (fps.MVr * fps.MVr / mvcount)) / mvcount;
- fps.MVcv = ((double)sum_mvcs - (fps.MVc * fps.MVc / mvcount)) / mvcount;
- fps.mv_in_out_count = (double)sum_in_vectors / (mvcount * 2);
- fps.new_mv_count = new_mv_count;
- fps.pcnt_motion = (double)mvcount / cm->MBs;
- } else {
- fps.MVr = 0.0;
- fps.mvr_abs = 0.0;
- fps.MVc = 0.0;
- fps.mvc_abs = 0.0;
- fps.MVrv = 0.0;
- fps.MVcv = 0.0;
- fps.mv_in_out_count = 0.0;
- fps.new_mv_count = 0.0;
- fps.pcnt_motion = 0.0;
- }
-
- // TODO(paulwilkins): Handle the case when duration is set to 0, or
- // something less than the full time between subsequent values of
- // cpi->source_time_stamp.
- fps.duration = (double)(cpi->source->ts_end - cpi->source->ts_start);
-
- // Don't want to do output stats with a stack variable!
- twopass->this_frame_stats = fps;
- output_stats(&twopass->this_frame_stats, cpi->output_pkt_list);
- accumulate_stats(&twopass->total_stats, &fps);
- }
-
- // Copy the previous Last Frame back into gf and and arf buffers if
- // the prediction is good enough... but also don't allow it to lag too far.
- if ((twopass->sr_update_lag > 3) ||
- ((cm->current_video_frame > 0) &&
- (twopass->this_frame_stats.pcnt_inter > 0.20) &&
- ((twopass->this_frame_stats.intra_error /
- DOUBLE_DIVIDE_CHECK(twopass->this_frame_stats.coded_error)) > 2.0))) {
- if (gld_yv12 != NULL) {
- vp8_yv12_copy_frame(lst_yv12, gld_yv12);
- }
- twopass->sr_update_lag = 1;
- } else {
- ++twopass->sr_update_lag;
- }
-
- if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
- vp9_update_reference_frames(cpi);
- } else {
- // Swap frame pointers so last frame refers to the frame we just compressed.
- swap_yv12(lst_yv12, new_yv12);
- }
-
- vp9_extend_frame_borders(lst_yv12);
-
- // Special case for the first frame. Copy into the GF buffer as a second
- // reference.
- if (cm->current_video_frame == 0 && gld_yv12 != NULL) {
- vp8_yv12_copy_frame(lst_yv12, gld_yv12);
- }
-
- // Use this to see what the first pass reconstruction looks like.
- if (0) {
- char filename[512];
- FILE *recon_file;
- snprintf(filename, sizeof(filename), "enc%04d.yuv",
- (int)cm->current_video_frame);
-
- if (cm->current_video_frame == 0)
- recon_file = fopen(filename, "wb");
- else
- recon_file = fopen(filename, "ab");
-
- (void)fwrite(lst_yv12->buffer_alloc, lst_yv12->frame_size, 1, recon_file);
- fclose(recon_file);
- }
-
- ++cm->current_video_frame;
-}
-
-static double calc_correction_factor(double err_per_mb,
- double err_divisor,
- double pt_low,
- double pt_high,
- int q) {
- const double error_term = err_per_mb / err_divisor;
-
- // Adjustment based on actual quantizer to power term.
- const double power_term = MIN(vp9_convert_qindex_to_q(q) * 0.0125 + pt_low,
- pt_high);
-
- // Calculate correction factor.
- if (power_term < 1.0)
- assert(error_term >= 0.0);
-
- return fclamp(pow(error_term, power_term), 0.05, 5.0);
-}
-
-int vp9_twopass_worst_quality(VP9_COMP *cpi, FIRSTPASS_STATS *fpstats,
- int section_target_bandwitdh) {
- int q;
- const int num_mbs = cpi->common.MBs;
- int target_norm_bits_per_mb;
- const RATE_CONTROL *const rc = &cpi->rc;
-
- const double section_err = fpstats->coded_error / fpstats->count;
- const double err_per_mb = section_err / num_mbs;
- const double speed_term = 1.0 + ((double)cpi->speed * 0.04);
-
- if (section_target_bandwitdh <= 0)
- return rc->worst_quality; // Highest value allowed
-
- target_norm_bits_per_mb = section_target_bandwitdh < (1 << 20)
- ? (512 * section_target_bandwitdh) / num_mbs
- : 512 * (section_target_bandwitdh / num_mbs);
-
- // Try and pick a max Q that will be high enough to encode the
- // content at the given rate.
- for (q = rc->best_quality; q < rc->worst_quality; ++q) {
- const double err_correction_factor = calc_correction_factor(err_per_mb,
- ERR_DIVISOR, 0.5, 0.90, q);
- const int bits_per_mb_at_this_q =
- vp9_rc_bits_per_mb(INTER_FRAME, q, (err_correction_factor * speed_term));
- if (bits_per_mb_at_this_q <= target_norm_bits_per_mb)
- break;
- }
-
- // Restriction on active max q for constrained quality mode.
- if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
- q = MAX(q, cpi->cq_target_quality);
-
- return q;
-}
-
-extern void vp9_new_framerate(VP9_COMP *cpi, double framerate);
-
-void vp9_init_second_pass(VP9_COMP *cpi) {
- FIRSTPASS_STATS this_frame;
- const FIRSTPASS_STATS *start_pos;
- struct twopass_rc *twopass = &cpi->twopass;
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- const int is_spatial_svc = (cpi->svc.number_spatial_layers > 1) &&
- (cpi->svc.number_temporal_layers == 1);
- double frame_rate;
-
- if (is_spatial_svc) {
- twopass = &cpi->svc.layer_context[cpi->svc.spatial_layer_id].twopass;
- }
-
- zero_stats(&twopass->total_stats);
- zero_stats(&twopass->total_left_stats);
-
- if (!twopass->stats_in_end)
- return;
-
- twopass->total_stats = *twopass->stats_in_end;
- twopass->total_left_stats = twopass->total_stats;
-
- frame_rate = 10000000.0 * twopass->total_stats.count /
- twopass->total_stats.duration;
- // Each frame can have a different duration, as the frame rate in the source
- // isn't guaranteed to be constant. The frame rate prior to the first frame
- // encoded in the second pass is a guess. However, the sum duration is not.
- // It is calculated based on the actual durations of all frames from the
- // first pass.
-
- if (is_spatial_svc) {
- vp9_update_spatial_layer_framerate(cpi, frame_rate);
- twopass->bits_left =
- (int64_t)(twopass->total_stats.duration *
- cpi->svc.layer_context[cpi->svc.spatial_layer_id].target_bandwidth /
- 10000000.0);
- } else {
- vp9_new_framerate(cpi, frame_rate);
- twopass->bits_left = (int64_t)(twopass->total_stats.duration *
- oxcf->target_bandwidth / 10000000.0);
- }
-
- cpi->output_framerate = oxcf->framerate;
-
- // Calculate a minimum intra value to be used in determining the IIratio
- // scores used in the second pass. We have this minimum to make sure
- // that clips that are static but "low complexity" in the intra domain
- // are still boosted appropriately for KF/GF/ARF.
- if (!is_spatial_svc) {
- // We don't know the number of MBs for each layer at this point.
- // So we will do it later.
- twopass->kf_intra_err_min = KF_MB_INTRA_MIN * cpi->common.MBs;
- twopass->gf_intra_err_min = GF_MB_INTRA_MIN * cpi->common.MBs;
- }
-
- // This variable monitors how far behind the second ref update is lagging.
- twopass->sr_update_lag = 1;
-
- // Scan the first pass file and calculate an average Intra / Inter error
- // score ratio for the sequence.
- {
- double sum_iiratio = 0.0;
- start_pos = twopass->stats_in;
-
- while (input_stats(twopass, &this_frame) != EOF) {
- const double iiratio = this_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame.coded_error);
- sum_iiratio += fclamp(iiratio, 1.0, 20.0);
- }
-
- twopass->avg_iiratio = sum_iiratio /
- DOUBLE_DIVIDE_CHECK((double)twopass->total_stats.count);
-
- reset_fpf_position(twopass, start_pos);
- }
-
- // Scan the first pass file and calculate a modified total error based upon
- // the bias/power function used to allocate bits.
- {
- double av_error = twopass->total_stats.ssim_weighted_pred_err /
- DOUBLE_DIVIDE_CHECK(twopass->total_stats.count);
-
- start_pos = twopass->stats_in;
-
- twopass->modified_error_total = 0.0;
- twopass->modified_error_min =
- (av_error * oxcf->two_pass_vbrmin_section) / 100;
- twopass->modified_error_max =
- (av_error * oxcf->two_pass_vbrmax_section) / 100;
-
- while (input_stats(twopass, &this_frame) != EOF) {
- twopass->modified_error_total +=
- calculate_modified_err(cpi, &this_frame);
- }
- twopass->modified_error_left = twopass->modified_error_total;
-
- reset_fpf_position(twopass, start_pos);
- }
-}
-
-// This function gives an estimate of how badly we believe the prediction
-// quality is decaying from frame to frame.
-static double get_prediction_decay_rate(const VP9_COMMON *cm,
- const FIRSTPASS_STATS *next_frame) {
- // Look at the observed drop in prediction quality between the last frame
- // and the GF buffer (which contains an older frame).
- const double mb_sr_err_diff = (next_frame->sr_coded_error -
- next_frame->coded_error) / cm->MBs;
- const double second_ref_decay = mb_sr_err_diff <= 512.0
- ? fclamp(pow(1.0 - (mb_sr_err_diff / 512.0), 0.5), 0.85, 1.0)
- : 0.85;
-
- return MIN(second_ref_decay, next_frame->pcnt_inter);
-}
-
-// Function to test for a condition where a complex transition is followed
-// by a static section. For example in slide shows where there is a fade
-// between slides. This is to help with more optimal kf and gf positioning.
-static int detect_transition_to_still(VP9_COMP *cpi, int frame_interval,
- int still_interval,
- double loop_decay_rate,
- double last_decay_rate) {
- int trans_to_still = 0;
-
- // Break clause to detect very still sections after motion
- // For example a static image after a fade or other transition
- // instead of a clean scene cut.
- if (frame_interval > MIN_GF_INTERVAL &&
- loop_decay_rate >= 0.999 &&
- last_decay_rate < 0.9) {
- int j;
- const FIRSTPASS_STATS *position = cpi->twopass.stats_in;
- FIRSTPASS_STATS tmp_next_frame;
-
- // Look ahead a few frames to see if static condition persists...
- for (j = 0; j < still_interval; ++j) {
- if (EOF == input_stats(&cpi->twopass, &tmp_next_frame))
- break;
-
- if (tmp_next_frame.pcnt_inter - tmp_next_frame.pcnt_motion < 0.999)
- break;
- }
-
- reset_fpf_position(&cpi->twopass, position);
-
- // Only if it does do we signal a transition to still.
- if (j == still_interval)
- trans_to_still = 1;
- }
-
- return trans_to_still;
-}
-
-// This function detects a flash through the high relative pcnt_second_ref
-// score in the frame following a flash frame. The offset passed in should
-// reflect this.
-static int detect_flash(const struct twopass_rc *twopass, int offset) {
- FIRSTPASS_STATS next_frame;
-
- int flash_detected = 0;
-
- // Read the frame data.
- // The return is FALSE (no flash detected) if not a valid frame
- if (read_frame_stats(twopass, &next_frame, offset) != EOF) {
- // What we are looking for here is a situation where there is a
- // brief break in prediction (such as a flash) but subsequent frames
- // are reasonably well predicted by an earlier (pre flash) frame.
- // The recovery after a flash is indicated by a high pcnt_second_ref
- // compared to pcnt_inter.
- if (next_frame.pcnt_second_ref > next_frame.pcnt_inter &&
- next_frame.pcnt_second_ref >= 0.5)
- flash_detected = 1;
- }
-
- return flash_detected;
-}
-
-// Update the motion related elements to the GF arf boost calculation.
-static void accumulate_frame_motion_stats(
- FIRSTPASS_STATS *this_frame,
- double *this_frame_mv_in_out,
- double *mv_in_out_accumulator,
- double *abs_mv_in_out_accumulator,
- double *mv_ratio_accumulator) {
- double motion_pct;
-
- // Accumulate motion stats.
- motion_pct = this_frame->pcnt_motion;
-
- // Accumulate Motion In/Out of frame stats.
- *this_frame_mv_in_out = this_frame->mv_in_out_count * motion_pct;
- *mv_in_out_accumulator += this_frame->mv_in_out_count * motion_pct;
- *abs_mv_in_out_accumulator += fabs(this_frame->mv_in_out_count * motion_pct);
-
- // Accumulate a measure of how uniform (or conversely how random)
- // the motion field is (a ratio of absmv / mv).
- if (motion_pct > 0.05) {
- const double this_frame_mvr_ratio = fabs(this_frame->mvr_abs) /
- DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVr));
-
- const double this_frame_mvc_ratio = fabs(this_frame->mvc_abs) /
- DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVc));
-
- *mv_ratio_accumulator += (this_frame_mvr_ratio < this_frame->mvr_abs)
- ? (this_frame_mvr_ratio * motion_pct)
- : this_frame->mvr_abs * motion_pct;
-
- *mv_ratio_accumulator += (this_frame_mvc_ratio < this_frame->mvc_abs)
- ? (this_frame_mvc_ratio * motion_pct)
- : this_frame->mvc_abs * motion_pct;
- }
-}
-
-// Calculate a baseline boost number for the current frame.
-static double calc_frame_boost(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame,
- double this_frame_mv_in_out) {
- double frame_boost;
-
- // Underlying boost factor is based on inter intra error ratio.
- if (this_frame->intra_error > cpi->twopass.gf_intra_err_min)
- frame_boost = (IIFACTOR * this_frame->intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame->coded_error));
- else
- frame_boost = (IIFACTOR * cpi->twopass.gf_intra_err_min /
- DOUBLE_DIVIDE_CHECK(this_frame->coded_error));
-
- // Increase boost for frames where new data coming into frame (e.g. zoom out).
- // Slightly reduce boost if there is a net balance of motion out of the frame
- // (zoom in). The range for this_frame_mv_in_out is -1.0 to +1.0.
- if (this_frame_mv_in_out > 0.0)
- frame_boost += frame_boost * (this_frame_mv_in_out * 2.0);
- // In the extreme case the boost is halved.
- else
- frame_boost += frame_boost * (this_frame_mv_in_out / 2.0);
-
- return MIN(frame_boost, GF_RMAX);
-}
-
-static int calc_arf_boost(VP9_COMP *cpi, int offset,
- int f_frames, int b_frames,
- int *f_boost, int *b_boost) {
- FIRSTPASS_STATS this_frame;
- struct twopass_rc *const twopass = &cpi->twopass;
- int i;
- double boost_score = 0.0;
- double mv_ratio_accumulator = 0.0;
- double decay_accumulator = 1.0;
- double this_frame_mv_in_out = 0.0;
- double mv_in_out_accumulator = 0.0;
- double abs_mv_in_out_accumulator = 0.0;
- int arf_boost;
- int flash_detected = 0;
-
- // Search forward from the proposed arf/next gf position.
- for (i = 0; i < f_frames; ++i) {
- if (read_frame_stats(twopass, &this_frame, (i + offset)) == EOF)
- break;
-
- // Update the motion related elements to the boost calculation.
- accumulate_frame_motion_stats(&this_frame,
- &this_frame_mv_in_out, &mv_in_out_accumulator,
- &abs_mv_in_out_accumulator,
- &mv_ratio_accumulator);
-
- // We want to discount the flash frame itself and the recovery
- // frame that follows as both will have poor scores.
- flash_detected = detect_flash(twopass, i + offset) ||
- detect_flash(twopass, i + offset + 1);
-
- // Accumulate the effect of prediction quality decay.
- if (!flash_detected) {
- decay_accumulator *= get_prediction_decay_rate(&cpi->common, &this_frame);
- decay_accumulator = decay_accumulator < MIN_DECAY_FACTOR
- ? MIN_DECAY_FACTOR : decay_accumulator;
- }
-
- boost_score += (decay_accumulator *
- calc_frame_boost(cpi, &this_frame, this_frame_mv_in_out));
- }
-
- *f_boost = (int)boost_score;
-
- // Reset for backward looking loop.
- boost_score = 0.0;
- mv_ratio_accumulator = 0.0;
- decay_accumulator = 1.0;
- this_frame_mv_in_out = 0.0;
- mv_in_out_accumulator = 0.0;
- abs_mv_in_out_accumulator = 0.0;
-
- // Search backward towards last gf position.
- for (i = -1; i >= -b_frames; --i) {
- if (read_frame_stats(twopass, &this_frame, (i + offset)) == EOF)
- break;
-
- // Update the motion related elements to the boost calculation.
- accumulate_frame_motion_stats(&this_frame,
- &this_frame_mv_in_out, &mv_in_out_accumulator,
- &abs_mv_in_out_accumulator,
- &mv_ratio_accumulator);
-
- // We want to discount the the flash frame itself and the recovery
- // frame that follows as both will have poor scores.
- flash_detected = detect_flash(twopass, i + offset) ||
- detect_flash(twopass, i + offset + 1);
-
- // Cumulative effect of prediction quality decay.
- if (!flash_detected) {
- decay_accumulator *= get_prediction_decay_rate(&cpi->common, &this_frame);
- decay_accumulator = decay_accumulator < MIN_DECAY_FACTOR
- ? MIN_DECAY_FACTOR : decay_accumulator;
- }
-
- boost_score += (decay_accumulator *
- calc_frame_boost(cpi, &this_frame, this_frame_mv_in_out));
- }
- *b_boost = (int)boost_score;
-
- arf_boost = (*f_boost + *b_boost);
- if (arf_boost < ((b_frames + f_frames) * 20))
- arf_boost = ((b_frames + f_frames) * 20);
-
- return arf_boost;
-}
-
-#if CONFIG_MULTIPLE_ARF
-// Work out the frame coding order for a GF or an ARF group.
-// The current implementation codes frames in their natural order for a
-// GF group, and inserts additional ARFs into an ARF group using a
-// binary split approach.
-// NOTE: this function is currently implemented recursively.
-static void schedule_frames(VP9_COMP *cpi, const int start, const int end,
- const int arf_idx, const int gf_or_arf_group,
- const int level) {
- int i, abs_end, half_range;
- int *cfo = cpi->frame_coding_order;
- int idx = cpi->new_frame_coding_order_period;
-
- // If (end < 0) an ARF should be coded at position (-end).
- assert(start >= 0);
-
- // printf("start:%d end:%d\n", start, end);
-
- // GF Group: code frames in logical order.
- if (gf_or_arf_group == 0) {
- assert(end >= start);
- for (i = start; i <= end; ++i) {
- cfo[idx] = i;
- cpi->arf_buffer_idx[idx] = arf_idx;
- cpi->arf_weight[idx] = -1;
- ++idx;
- }
- cpi->new_frame_coding_order_period = idx;
- return;
- }
-
- // ARF Group: Work out the ARF schedule and mark ARF frames as negative.
- if (end < 0) {
- // printf("start:%d end:%d\n", -end, -end);
- // ARF frame is at the end of the range.
- cfo[idx] = end;
- // What ARF buffer does this ARF use as predictor.
- cpi->arf_buffer_idx[idx] = (arf_idx > 2) ? (arf_idx - 1) : 2;
- cpi->arf_weight[idx] = level;
- ++idx;
- abs_end = -end;
- } else {
- abs_end = end;
- }
-
- half_range = (abs_end - start) >> 1;
-
- // ARFs may not be adjacent, they must be separated by at least
- // MIN_GF_INTERVAL non-ARF frames.
- if ((start + MIN_GF_INTERVAL) >= (abs_end - MIN_GF_INTERVAL)) {
- // printf("start:%d end:%d\n", start, abs_end);
- // Update the coding order and active ARF.
- for (i = start; i <= abs_end; ++i) {
- cfo[idx] = i;
- cpi->arf_buffer_idx[idx] = arf_idx;
- cpi->arf_weight[idx] = -1;
- ++idx;
- }
- cpi->new_frame_coding_order_period = idx;
- } else {
- // Place a new ARF at the mid-point of the range.
- cpi->new_frame_coding_order_period = idx;
- schedule_frames(cpi, start, -(start + half_range), arf_idx + 1,
- gf_or_arf_group, level + 1);
- schedule_frames(cpi, start + half_range + 1, abs_end, arf_idx,
- gf_or_arf_group, level + 1);
- }
-}
-
-#define FIXED_ARF_GROUP_SIZE 16
-
-void define_fixed_arf_period(VP9_COMP *cpi) {
- int i;
- int max_level = INT_MIN;
-
- assert(cpi->multi_arf_enabled);
- assert(cpi->oxcf.lag_in_frames >= FIXED_ARF_GROUP_SIZE);
-
- // Save the weight of the last frame in the sequence before next
- // sequence pattern overwrites it.
- cpi->this_frame_weight = cpi->arf_weight[cpi->sequence_number];
- assert(cpi->this_frame_weight >= 0);
-
- cpi->twopass.gf_zeromotion_pct = 0;
-
- // Initialize frame coding order variables.
- cpi->new_frame_coding_order_period = 0;
- cpi->next_frame_in_order = 0;
- cpi->arf_buffered = 0;
- vp9_zero(cpi->frame_coding_order);
- vp9_zero(cpi->arf_buffer_idx);
- vpx_memset(cpi->arf_weight, -1, sizeof(cpi->arf_weight));
-
- if (cpi->rc.frames_to_key <= (FIXED_ARF_GROUP_SIZE + 8)) {
- // Setup a GF group close to the keyframe.
- cpi->rc.source_alt_ref_pending = 0;
- cpi->rc.baseline_gf_interval = cpi->rc.frames_to_key;
- schedule_frames(cpi, 0, (cpi->rc.baseline_gf_interval - 1), 2, 0, 0);
- } else {
- // Setup a fixed period ARF group.
- cpi->rc.source_alt_ref_pending = 1;
- cpi->rc.baseline_gf_interval = FIXED_ARF_GROUP_SIZE;
- schedule_frames(cpi, 0, -(cpi->rc.baseline_gf_interval - 1), 2, 1, 0);
- }
-
- // Replace level indicator of -1 with correct level.
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- if (cpi->arf_weight[i] > max_level) {
- max_level = cpi->arf_weight[i];
- }
- }
- ++max_level;
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- if (cpi->arf_weight[i] == -1) {
- cpi->arf_weight[i] = max_level;
- }
- }
- cpi->max_arf_level = max_level;
-#if 0
- printf("\nSchedule: ");
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- printf("%4d ", cpi->frame_coding_order[i]);
- }
- printf("\n");
- printf("ARFref: ");
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- printf("%4d ", cpi->arf_buffer_idx[i]);
- }
- printf("\n");
- printf("Weight: ");
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- printf("%4d ", cpi->arf_weight[i]);
- }
- printf("\n");
-#endif
-}
-#endif
-
-// Analyse and define a gf/arf group.
-static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
- FIRSTPASS_STATS next_frame = { 0 };
- const FIRSTPASS_STATS *start_pos;
- struct twopass_rc *const twopass = &cpi->twopass;
- int i;
- double boost_score = 0.0;
- double old_boost_score = 0.0;
- double gf_group_err = 0.0;
- double gf_first_frame_err = 0.0;
- double mod_frame_err = 0.0;
-
- double mv_ratio_accumulator = 0.0;
- double decay_accumulator = 1.0;
- double zero_motion_accumulator = 1.0;
-
- double loop_decay_rate = 1.00;
- double last_loop_decay_rate = 1.00;
-
- double this_frame_mv_in_out = 0.0;
- double mv_in_out_accumulator = 0.0;
- double abs_mv_in_out_accumulator = 0.0;
- double mv_ratio_accumulator_thresh;
- const int max_bits = frame_max_bits(cpi); // Max bits for a single frame.
-
- unsigned int allow_alt_ref = cpi->oxcf.play_alternate &&
- cpi->oxcf.lag_in_frames;
-
- int f_boost = 0;
- int b_boost = 0;
- int flash_detected;
- int active_max_gf_interval;
- RATE_CONTROL *const rc = &cpi->rc;
-
- twopass->gf_group_bits = 0;
-
- vp9_clear_system_state();
-
- start_pos = twopass->stats_in;
-
- // Load stats for the current frame.
- mod_frame_err = calculate_modified_err(cpi, this_frame);
-
- // Note the error of the frame at the start of the group. This will be
- // the GF frame error if we code a normal gf.
- gf_first_frame_err = mod_frame_err;
-
- // If this is a key frame or the overlay from a previous arf then
- // the error score / cost of this frame has already been accounted for.
- if (cpi->common.frame_type == KEY_FRAME || rc->source_alt_ref_active)
- gf_group_err -= gf_first_frame_err;
-
- // Motion breakout threshold for loop below depends on image size.
- mv_ratio_accumulator_thresh = (cpi->common.width + cpi->common.height) / 10.0;
-
- // Work out a maximum interval for the GF.
- // If the image appears completely static we can extend beyond this.
- // The value chosen depends on the active Q range. At low Q we have
- // bits to spare and are better with a smaller interval and smaller boost.
- // At high Q when there are few bits to spare we are better with a longer
- // interval to spread the cost of the GF.
- //
- active_max_gf_interval =
- 12 + ((int)vp9_convert_qindex_to_q(rc->last_q[INTER_FRAME]) >> 5);
-
- if (active_max_gf_interval > rc->max_gf_interval)
- active_max_gf_interval = rc->max_gf_interval;
-
- i = 0;
- while (i < rc->static_scene_max_gf_interval && i < rc->frames_to_key) {
- ++i;
-
- // Accumulate error score of frames in this gf group.
- mod_frame_err = calculate_modified_err(cpi, this_frame);
- gf_group_err += mod_frame_err;
-
- if (EOF == input_stats(twopass, &next_frame))
- break;
-
- // Test for the case where there is a brief flash but the prediction
- // quality back to an earlier frame is then restored.
- flash_detected = detect_flash(twopass, 0);
-
- // Update the motion related elements to the boost calculation.
- accumulate_frame_motion_stats(&next_frame,
- &this_frame_mv_in_out, &mv_in_out_accumulator,
- &abs_mv_in_out_accumulator,
- &mv_ratio_accumulator);
-
- // Accumulate the effect of prediction quality decay.
- if (!flash_detected) {
- last_loop_decay_rate = loop_decay_rate;
- loop_decay_rate = get_prediction_decay_rate(&cpi->common, &next_frame);
- decay_accumulator = decay_accumulator * loop_decay_rate;
-
- // Monitor for static sections.
- if ((next_frame.pcnt_inter - next_frame.pcnt_motion) <
- zero_motion_accumulator) {
- zero_motion_accumulator = next_frame.pcnt_inter -
- next_frame.pcnt_motion;
- }
-
- // Break clause to detect very still sections after motion. For example,
- // a static image after a fade or other transition.
- if (detect_transition_to_still(cpi, i, 5, loop_decay_rate,
- last_loop_decay_rate)) {
- allow_alt_ref = 0;
- break;
- }
- }
-
- // Calculate a boost number for this frame.
- boost_score += (decay_accumulator *
- calc_frame_boost(cpi, &next_frame, this_frame_mv_in_out));
-
- // Break out conditions.
- if (
- // Break at cpi->max_gf_interval unless almost totally static.
- (i >= active_max_gf_interval && (zero_motion_accumulator < 0.995)) ||
- (
- // Don't break out with a very short interval.
- (i > MIN_GF_INTERVAL) &&
- ((boost_score > 125.0) || (next_frame.pcnt_inter < 0.75)) &&
- (!flash_detected) &&
- ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) ||
- (abs_mv_in_out_accumulator > 3.0) ||
- (mv_in_out_accumulator < -2.0) ||
- ((boost_score - old_boost_score) < IIFACTOR)))) {
- boost_score = old_boost_score;
- break;
- }
-
- *this_frame = next_frame;
-
- old_boost_score = boost_score;
- }
-
- twopass->gf_zeromotion_pct = (int)(zero_motion_accumulator * 1000.0);
-
- // Don't allow a gf too near the next kf.
- if ((rc->frames_to_key - i) < MIN_GF_INTERVAL) {
- while (i < (rc->frames_to_key + !rc->next_key_frame_forced)) {
- ++i;
-
- if (EOF == input_stats(twopass, this_frame))
- break;
-
- if (i < rc->frames_to_key) {
- mod_frame_err = calculate_modified_err(cpi, this_frame);
- gf_group_err += mod_frame_err;
- }
- }
- }
-
-#if CONFIG_MULTIPLE_ARF
- if (cpi->multi_arf_enabled) {
- // Initialize frame coding order variables.
- cpi->new_frame_coding_order_period = 0;
- cpi->next_frame_in_order = 0;
- cpi->arf_buffered = 0;
- vp9_zero(cpi->frame_coding_order);
- vp9_zero(cpi->arf_buffer_idx);
- vpx_memset(cpi->arf_weight, -1, sizeof(cpi->arf_weight));
- }
-#endif
-
- // Set the interval until the next gf.
- if (cpi->common.frame_type == KEY_FRAME || rc->source_alt_ref_active)
- rc->baseline_gf_interval = i - 1;
- else
- rc->baseline_gf_interval = i;
-
- // Should we use the alternate reference frame.
- if (allow_alt_ref &&
- (i < cpi->oxcf.lag_in_frames) &&
- (i >= MIN_GF_INTERVAL) &&
- // For real scene cuts (not forced kfs) don't allow arf very near kf.
- (rc->next_key_frame_forced ||
- (i <= (rc->frames_to_key - MIN_GF_INTERVAL)))) {
- // Calculate the boost for alt ref.
- rc->gfu_boost = calc_arf_boost(cpi, 0, (i - 1), (i - 1), &f_boost,
- &b_boost);
- rc->source_alt_ref_pending = 1;
-
-#if CONFIG_MULTIPLE_ARF
- // Set the ARF schedule.
- if (cpi->multi_arf_enabled) {
- schedule_frames(cpi, 0, -(rc->baseline_gf_interval - 1), 2, 1, 0);
- }
-#endif
- } else {
- rc->gfu_boost = (int)boost_score;
- rc->source_alt_ref_pending = 0;
-#if CONFIG_MULTIPLE_ARF
- // Set the GF schedule.
- if (cpi->multi_arf_enabled) {
- schedule_frames(cpi, 0, rc->baseline_gf_interval - 1, 2, 0, 0);
- assert(cpi->new_frame_coding_order_period ==
- rc->baseline_gf_interval);
- }
-#endif
- }
-
-#if CONFIG_MULTIPLE_ARF
- if (cpi->multi_arf_enabled && (cpi->common.frame_type != KEY_FRAME)) {
- int max_level = INT_MIN;
- // Replace level indicator of -1 with correct level.
- for (i = 0; i < cpi->frame_coding_order_period; ++i) {
- if (cpi->arf_weight[i] > max_level) {
- max_level = cpi->arf_weight[i];
- }
- }
- ++max_level;
- for (i = 0; i < cpi->frame_coding_order_period; ++i) {
- if (cpi->arf_weight[i] == -1) {
- cpi->arf_weight[i] = max_level;
- }
- }
- cpi->max_arf_level = max_level;
- }
-#if 0
- if (cpi->multi_arf_enabled) {
- printf("\nSchedule: ");
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- printf("%4d ", cpi->frame_coding_order[i]);
- }
- printf("\n");
- printf("ARFref: ");
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- printf("%4d ", cpi->arf_buffer_idx[i]);
- }
- printf("\n");
- printf("Weight: ");
- for (i = 0; i < cpi->new_frame_coding_order_period; ++i) {
- printf("%4d ", cpi->arf_weight[i]);
- }
- printf("\n");
- }
-#endif
-#endif
-
- // Calculate the bits to be allocated to the group as a whole.
- if (twopass->kf_group_bits > 0 && twopass->kf_group_error_left > 0) {
- twopass->gf_group_bits = (int64_t)(twopass->kf_group_bits *
- (gf_group_err / twopass->kf_group_error_left));
- } else {
- twopass->gf_group_bits = 0;
- }
- twopass->gf_group_bits = (twopass->gf_group_bits < 0) ?
- 0 : (twopass->gf_group_bits > twopass->kf_group_bits) ?
- twopass->kf_group_bits : twopass->gf_group_bits;
-
- // Clip cpi->twopass.gf_group_bits based on user supplied data rate
- // variability limit, cpi->oxcf.two_pass_vbrmax_section.
- if (twopass->gf_group_bits > (int64_t)max_bits * rc->baseline_gf_interval)
- twopass->gf_group_bits = (int64_t)max_bits * rc->baseline_gf_interval;
-
- // Reset the file position.
- reset_fpf_position(twopass, start_pos);
-
- // Assign bits to the arf or gf.
- for (i = 0; i <= (rc->source_alt_ref_pending &&
- cpi->common.frame_type != KEY_FRAME); ++i) {
- int allocation_chunks;
- int q = rc->last_q[INTER_FRAME];
- int gf_bits;
-
- int boost = (rc->gfu_boost * gfboost_qadjust(q)) / 100;
-
- // Set max and minimum boost and hence minimum allocation.
- boost = clamp(boost, 125, (rc->baseline_gf_interval + 1) * 200);
-
- if (rc->source_alt_ref_pending && i == 0)
- allocation_chunks = ((rc->baseline_gf_interval + 1) * 100) + boost;
- else
- allocation_chunks = (rc->baseline_gf_interval * 100) + (boost - 100);
-
- // Prevent overflow.
- if (boost > 1023) {
- int divisor = boost >> 10;
- boost /= divisor;
- allocation_chunks /= divisor;
- }
-
- // Calculate the number of bits to be spent on the gf or arf based on
- // the boost number.
- gf_bits = (int)((double)boost * (twopass->gf_group_bits /
- (double)allocation_chunks));
-
- // If the frame that is to be boosted is simpler than the average for
- // the gf/arf group then use an alternative calculation
- // based on the error score of the frame itself.
- if (rc->baseline_gf_interval < 1 ||
- mod_frame_err < gf_group_err / (double)rc->baseline_gf_interval) {
- double alt_gf_grp_bits = (double)twopass->kf_group_bits *
- (mod_frame_err * (double)rc->baseline_gf_interval) /
- DOUBLE_DIVIDE_CHECK(twopass->kf_group_error_left);
-
- int alt_gf_bits = (int)((double)boost * (alt_gf_grp_bits /
- (double)allocation_chunks));
-
- if (gf_bits > alt_gf_bits)
- gf_bits = alt_gf_bits;
- } else {
- // If it is harder than other frames in the group make sure it at
- // least receives an allocation in keeping with its relative error
- // score, otherwise it may be worse off than an "un-boosted" frame.
- int alt_gf_bits = (int)((double)twopass->kf_group_bits *
- mod_frame_err /
- DOUBLE_DIVIDE_CHECK(twopass->kf_group_error_left));
-
- if (alt_gf_bits > gf_bits)
- gf_bits = alt_gf_bits;
- }
-
- // Don't allow a negative value for gf_bits.
- if (gf_bits < 0)
- gf_bits = 0;
-
- if (i == 0) {
- twopass->gf_bits = gf_bits;
- }
- if (i == 1 ||
- (!rc->source_alt_ref_pending &&
- cpi->common.frame_type != KEY_FRAME)) {
- // Calculate the per frame bit target for this frame.
- vp9_rc_set_frame_target(cpi, gf_bits);
- }
- }
-
- {
- // Adjust KF group bits and error remaining.
- twopass->kf_group_error_left -= (int64_t)gf_group_err;
-
- // If this is an arf update we want to remove the score for the overlay
- // frame at the end which will usually be very cheap to code.
- // The overlay frame has already, in effect, been coded so we want to spread
- // the remaining bits among the other frames.
- // For normal GFs remove the score for the GF itself unless this is
- // also a key frame in which case it has already been accounted for.
- if (rc->source_alt_ref_pending) {
- twopass->gf_group_error_left = (int64_t)(gf_group_err - mod_frame_err);
- } else if (cpi->common.frame_type != KEY_FRAME) {
- twopass->gf_group_error_left = (int64_t)(gf_group_err
- - gf_first_frame_err);
- } else {
- twopass->gf_group_error_left = (int64_t)gf_group_err;
- }
-
- // This condition could fail if there are two kfs very close together
- // despite MIN_GF_INTERVAL and would cause a divide by 0 in the
- // calculation of alt_extra_bits.
- if (rc->baseline_gf_interval >= 3) {
- const int boost = rc->source_alt_ref_pending ? b_boost : rc->gfu_boost;
-
- if (boost >= 150) {
- const int pct_extra = MIN(20, (boost - 100) / 50);
- const int alt_extra_bits = (int)((
- MAX(twopass->gf_group_bits - twopass->gf_bits, 0) *
- pct_extra) / 100);
- twopass->gf_group_bits -= alt_extra_bits;
- }
- }
- }
-
- if (cpi->common.frame_type != KEY_FRAME) {
- FIRSTPASS_STATS sectionstats;
-
- zero_stats(&sectionstats);
- reset_fpf_position(twopass, start_pos);
-
- for (i = 0; i < rc->baseline_gf_interval; ++i) {
- input_stats(twopass, &next_frame);
- accumulate_stats(&sectionstats, &next_frame);
- }
-
- avg_stats(&sectionstats);
-
- twopass->section_intra_rating = (int)
- (sectionstats.intra_error /
- DOUBLE_DIVIDE_CHECK(sectionstats.coded_error));
-
- reset_fpf_position(twopass, start_pos);
- }
-}
-
-// Allocate bits to a normal frame that is neither a gf an arf or a key frame.
-static void assign_std_frame_bits(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
- int target_frame_size;
- double modified_err;
- double err_fraction;
- const int max_bits = frame_max_bits(cpi); // Max for a single frame.
-
- // Calculate modified prediction error used in bit allocation.
- modified_err = calculate_modified_err(cpi, this_frame);
-
- if (cpi->twopass.gf_group_error_left > 0)
- // What portion of the remaining GF group error is used by this frame.
- err_fraction = modified_err / cpi->twopass.gf_group_error_left;
- else
- err_fraction = 0.0;
-
- // How many of those bits available for allocation should we give it?
- target_frame_size = (int)((double)cpi->twopass.gf_group_bits * err_fraction);
-
- // Clip target size to 0 - max_bits (or cpi->twopass.gf_group_bits) at
- // the top end.
- target_frame_size = clamp(target_frame_size, 0,
- MIN(max_bits, (int)cpi->twopass.gf_group_bits));
-
- // Adjust error and bits remaining.
- cpi->twopass.gf_group_error_left -= (int64_t)modified_err;
-
- // Per frame bit target for this frame.
- vp9_rc_set_frame_target(cpi, target_frame_size);
-}
-
-static int test_candidate_kf(VP9_COMP *cpi,
- const FIRSTPASS_STATS *last_frame,
- const FIRSTPASS_STATS *this_frame,
- const FIRSTPASS_STATS *next_frame) {
- int is_viable_kf = 0;
-
- // Does the frame satisfy the primary criteria of a key frame?
- // If so, then examine how well it predicts subsequent frames.
- if ((this_frame->pcnt_second_ref < 0.10) &&
- (next_frame->pcnt_second_ref < 0.10) &&
- ((this_frame->pcnt_inter < 0.05) ||
- (((this_frame->pcnt_inter - this_frame->pcnt_neutral) < 0.35) &&
- ((this_frame->intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame->coded_error)) < 2.5) &&
- ((fabs(last_frame->coded_error - this_frame->coded_error) /
- DOUBLE_DIVIDE_CHECK(this_frame->coded_error) > 0.40) ||
- (fabs(last_frame->intra_error - this_frame->intra_error) /
- DOUBLE_DIVIDE_CHECK(this_frame->intra_error) > 0.40) ||
- ((next_frame->intra_error /
- DOUBLE_DIVIDE_CHECK(next_frame->coded_error)) > 3.5))))) {
- int i;
- const FIRSTPASS_STATS *start_pos = cpi->twopass.stats_in;
- FIRSTPASS_STATS local_next_frame = *next_frame;
- double boost_score = 0.0;
- double old_boost_score = 0.0;
- double decay_accumulator = 1.0;
-
- // Examine how well the key frame predicts subsequent frames.
- for (i = 0; i < 16; ++i) {
- double next_iiratio = (IIKFACTOR1 * local_next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(local_next_frame.coded_error));
-
- if (next_iiratio > RMAX)
- next_iiratio = RMAX;
-
- // Cumulative effect of decay in prediction quality.
- if (local_next_frame.pcnt_inter > 0.85)
- decay_accumulator *= local_next_frame.pcnt_inter;
- else
- decay_accumulator *= (0.85 + local_next_frame.pcnt_inter) / 2.0;
-
- // Keep a running total.
- boost_score += (decay_accumulator * next_iiratio);
-
- // Test various breakout clauses.
- if ((local_next_frame.pcnt_inter < 0.05) ||
- (next_iiratio < 1.5) ||
- (((local_next_frame.pcnt_inter -
- local_next_frame.pcnt_neutral) < 0.20) &&
- (next_iiratio < 3.0)) ||
- ((boost_score - old_boost_score) < 3.0) ||
- (local_next_frame.intra_error < 200)) {
- break;
- }
-
- old_boost_score = boost_score;
-
- // Get the next frame details
- if (EOF == input_stats(&cpi->twopass, &local_next_frame))
- break;
- }
-
- // If there is tolerable prediction for at least the next 3 frames then
- // break out else discard this potential key frame and move on
- if (boost_score > 30.0 && (i > 3)) {
- is_viable_kf = 1;
- } else {
- // Reset the file position
- reset_fpf_position(&cpi->twopass, start_pos);
-
- is_viable_kf = 0;
- }
- }
-
- return is_viable_kf;
-}
-
-static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
- int i, j;
- RATE_CONTROL *const rc = &cpi->rc;
- struct twopass_rc *const twopass = &cpi->twopass;
- FIRSTPASS_STATS last_frame;
- const FIRSTPASS_STATS first_frame = *this_frame;
- FIRSTPASS_STATS next_frame;
- const FIRSTPASS_STATS *start_position = twopass->stats_in;
-
- double decay_accumulator = 1.0;
- double zero_motion_accumulator = 1.0;
- double boost_score = 0;
- double loop_decay_rate;
-
- double kf_mod_err = 0.0;
- double kf_group_err = 0.0;
- double recent_loop_decay[8] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
-
- vp9_zero(next_frame);
-
- cpi->common.frame_type = KEY_FRAME;
-
- // Is this a forced key frame by interval.
- rc->this_key_frame_forced = rc->next_key_frame_forced;
-
- // Clear the alt ref active flag as this can never be active on a key frame.
- rc->source_alt_ref_active = 0;
-
- // KF is always a GF so clear frames till next gf counter.
- rc->frames_till_gf_update_due = 0;
-
- rc->frames_to_key = 1;
-
- twopass->kf_group_bits = 0; // Total bits available to kf group
- twopass->kf_group_error_left = 0; // Group modified error score.
-
- kf_mod_err = calculate_modified_err(cpi, this_frame);
-
- // Find the next keyframe.
- i = 0;
- while (twopass->stats_in < twopass->stats_in_end) {
- // Accumulate kf group error.
- kf_group_err += calculate_modified_err(cpi, this_frame);
-
- // Load the next frame's stats.
- last_frame = *this_frame;
- input_stats(twopass, this_frame);
-
- // Provided that we are not at the end of the file...
- if (cpi->oxcf.auto_key &&
- lookup_next_frame_stats(twopass, &next_frame) != EOF) {
- // Check for a scene cut.
- if (test_candidate_kf(cpi, &last_frame, this_frame, &next_frame))
- break;
-
- // How fast is the prediction quality decaying?
- loop_decay_rate = get_prediction_decay_rate(&cpi->common, &next_frame);
-
- // We want to know something about the recent past... rather than
- // as used elsewhere where we are concerned with decay in prediction
- // quality since the last GF or KF.
- recent_loop_decay[i % 8] = loop_decay_rate;
- decay_accumulator = 1.0;
- for (j = 0; j < 8; ++j)
- decay_accumulator *= recent_loop_decay[j];
-
- // Special check for transition or high motion followed by a
- // static scene.
- if (detect_transition_to_still(cpi, i, cpi->key_frame_frequency - i,
- loop_decay_rate, decay_accumulator))
- break;
-
- // Step on to the next frame.
- ++rc->frames_to_key;
-
- // If we don't have a real key frame within the next two
- // key_frame_frequency intervals then break out of the loop.
- if (rc->frames_to_key >= 2 * (int)cpi->key_frame_frequency)
- break;
- } else {
- ++rc->frames_to_key;
- }
- ++i;
- }
-
- // If there is a max kf interval set by the user we must obey it.
- // We already breakout of the loop above at 2x max.
- // This code centers the extra kf if the actual natural interval
- // is between 1x and 2x.
- if (cpi->oxcf.auto_key &&
- rc->frames_to_key > (int)cpi->key_frame_frequency) {
- FIRSTPASS_STATS tmp_frame = first_frame;
-
- rc->frames_to_key /= 2;
-
- // Reset to the start of the group.
- reset_fpf_position(twopass, start_position);
-
- kf_group_err = 0;
-
- // Rescan to get the correct error data for the forced kf group.
- for (i = 0; i < rc->frames_to_key; ++i) {
- kf_group_err += calculate_modified_err(cpi, &tmp_frame);
- input_stats(twopass, &tmp_frame);
- }
- rc->next_key_frame_forced = 1;
- } else if (twopass->stats_in == twopass->stats_in_end) {
- rc->next_key_frame_forced = 1;
- } else {
- rc->next_key_frame_forced = 0;
- }
-
- // Special case for the last key frame of the file.
- if (twopass->stats_in >= twopass->stats_in_end) {
- // Accumulate kf group error.
- kf_group_err += calculate_modified_err(cpi, this_frame);
- }
-
- // Calculate the number of bits that should be assigned to the kf group.
- if (twopass->bits_left > 0 && twopass->modified_error_left > 0.0) {
- // Maximum number of bits for a single normal frame (not key frame).
- const int max_bits = frame_max_bits(cpi);
-
- // Maximum number of bits allocated to the key frame group.
- int64_t max_grp_bits;
-
- // Default allocation based on bits left and relative
- // complexity of the section.
- twopass->kf_group_bits = (int64_t)(twopass->bits_left *
- (kf_group_err / twopass->modified_error_left));
-
- // Clip based on maximum per frame rate defined by the user.
- max_grp_bits = (int64_t)max_bits * (int64_t)rc->frames_to_key;
- if (twopass->kf_group_bits > max_grp_bits)
- twopass->kf_group_bits = max_grp_bits;
- } else {
- twopass->kf_group_bits = 0;
- }
- // Reset the first pass file position.
- reset_fpf_position(twopass, start_position);
-
- // Determine how big to make this keyframe based on how well the subsequent
- // frames use inter blocks.
- decay_accumulator = 1.0;
- boost_score = 0.0;
-
- // Scan through the kf group collating various stats.
- for (i = 0; i < rc->frames_to_key; ++i) {
- if (EOF == input_stats(twopass, &next_frame))
- break;
-
- // Monitor for static sections.
- if ((next_frame.pcnt_inter - next_frame.pcnt_motion) <
- zero_motion_accumulator) {
- zero_motion_accumulator = (next_frame.pcnt_inter -
- next_frame.pcnt_motion);
- }
-
- // For the first few frames collect data to decide kf boost.
- if (i <= (rc->max_gf_interval * 2)) {
- double r;
- if (next_frame.intra_error > twopass->kf_intra_err_min)
- r = (IIKFACTOR2 * next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
- else
- r = (IIKFACTOR2 * twopass->kf_intra_err_min /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
-
- if (r > RMAX)
- r = RMAX;
-
- // How fast is prediction quality decaying.
- if (!detect_flash(twopass, 0)) {
- loop_decay_rate = get_prediction_decay_rate(&cpi->common, &next_frame);
- decay_accumulator *= loop_decay_rate;
- decay_accumulator = decay_accumulator < MIN_DECAY_FACTOR
- ? MIN_DECAY_FACTOR : decay_accumulator;
- }
-
- boost_score += (decay_accumulator * r);
- }
- }
-
- {
- FIRSTPASS_STATS sectionstats;
-
- zero_stats(&sectionstats);
- reset_fpf_position(twopass, start_position);
-
- for (i = 0; i < rc->frames_to_key; ++i) {
- input_stats(twopass, &next_frame);
- accumulate_stats(&sectionstats, &next_frame);
- }
-
- avg_stats(&sectionstats);
-
- twopass->section_intra_rating = (int) (sectionstats.intra_error /
- DOUBLE_DIVIDE_CHECK(sectionstats.coded_error));
- }
-
- // Reset the first pass file position.
- reset_fpf_position(twopass, start_position);
-
- // Work out how many bits to allocate for the key frame itself.
- if (1) {
- int kf_boost = (int)boost_score;
- int allocation_chunks;
- int alt_kf_bits;
-
- if (kf_boost < (rc->frames_to_key * 3))
- kf_boost = (rc->frames_to_key * 3);
-
- if (kf_boost < MIN_KF_BOOST)
- kf_boost = MIN_KF_BOOST;
-
- // Make a note of baseline boost and the zero motion
- // accumulator value for use elsewhere.
- rc->kf_boost = kf_boost;
- twopass->kf_zeromotion_pct = (int)(zero_motion_accumulator * 100.0);
-
- // Key frame size depends on:
- // (1) the error score for the whole key frame group,
- // (2) the key frames' own error if this is smaller than the
- // average for the group (optional),
- // (3) insuring that the frame receives at least the allocation it would
- // have received based on its own error score vs the error score
- // remaining.
- // Special case:
- // If the sequence appears almost totally static we want to spend almost
- // all of the bits on the key frame.
- //
- // We use (cpi->rc.frames_to_key - 1) below because the key frame itself is
- // taken care of by kf_boost.
- if (zero_motion_accumulator >= 0.99) {
- allocation_chunks = ((rc->frames_to_key - 1) * 10) + kf_boost;
- } else {
- allocation_chunks = ((rc->frames_to_key - 1) * 100) + kf_boost;
- }
-
- // Prevent overflow.
- if (kf_boost > 1028) {
- int divisor = kf_boost >> 10;
- kf_boost /= divisor;
- allocation_chunks /= divisor;
- }
-
- twopass->kf_group_bits = (twopass->kf_group_bits < 0) ? 0
- : twopass->kf_group_bits;
-
- // Calculate the number of bits to be spent on the key frame.
- twopass->kf_bits = (int)((double)kf_boost *
- ((double)twopass->kf_group_bits / allocation_chunks));
-
- // If the key frame is actually easier than the average for the
- // kf group (which does sometimes happen, e.g. a blank intro frame)
- // then use an alternate calculation based on the kf error score
- // which should give a smaller key frame.
- if (kf_mod_err < kf_group_err / rc->frames_to_key) {
- double alt_kf_grp_bits = ((double)twopass->bits_left *
- (kf_mod_err * (double)rc->frames_to_key) /
- DOUBLE_DIVIDE_CHECK(twopass->modified_error_left));
-
- alt_kf_bits = (int)((double)kf_boost *
- (alt_kf_grp_bits / (double)allocation_chunks));
-
- if (twopass->kf_bits > alt_kf_bits)
- twopass->kf_bits = alt_kf_bits;
- } else {
- // Else if it is much harder than other frames in the group make sure
- // it at least receives an allocation in keeping with its relative
- // error score.
- alt_kf_bits = (int)((double)twopass->bits_left * (kf_mod_err /
- DOUBLE_DIVIDE_CHECK(twopass->modified_error_left)));
-
- if (alt_kf_bits > twopass->kf_bits) {
- twopass->kf_bits = alt_kf_bits;
- }
- }
- twopass->kf_group_bits -= twopass->kf_bits;
- // Per frame bit target for this frame.
- vp9_rc_set_frame_target(cpi, twopass->kf_bits);
- }
-
- // Note the total error score of the kf group minus the key frame itself.
- twopass->kf_group_error_left = (int)(kf_group_err - kf_mod_err);
-
- // Adjust the count of total modified error left.
- // The count of bits left is adjusted elsewhere based on real coded frame
- // sizes.
- twopass->modified_error_left -= kf_group_err;
-}
-
-void vp9_rc_get_first_pass_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- if (!cpi->refresh_alt_ref_frame &&
- (cm->current_video_frame == 0 ||
- (cm->frame_flags & FRAMEFLAGS_KEY))) {
- cm->frame_type = KEY_FRAME;
- } else {
- cm->frame_type = INTER_FRAME;
- }
- // Do not use periodic key frames.
- cpi->rc.frames_to_key = INT_MAX;
-}
-
-void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- struct twopass_rc *const twopass = &cpi->twopass;
- int frames_left;
- FIRSTPASS_STATS this_frame;
- FIRSTPASS_STATS this_frame_copy;
-
- double this_frame_intra_error;
- double this_frame_coded_error;
- int target;
- LAYER_CONTEXT *lc = NULL;
- int is_spatial_svc = (cpi->use_svc && cpi->svc.number_temporal_layers == 1);
-
- if (is_spatial_svc) {
- lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
- frames_left = (int)(twopass->total_stats.count -
- lc->current_video_frame_in_layer);
- } else {
- frames_left = (int)(twopass->total_stats.count -
- cm->current_video_frame);
- }
-
- if (!twopass->stats_in)
- return;
-
- if (cpi->refresh_alt_ref_frame) {
- cm->frame_type = INTER_FRAME;
- vp9_rc_set_frame_target(cpi, twopass->gf_bits);
- return;
- }
-
- vp9_clear_system_state();
-
- if (is_spatial_svc && twopass->kf_intra_err_min == 0) {
- twopass->kf_intra_err_min = KF_MB_INTRA_MIN * cpi->common.MBs;
- twopass->gf_intra_err_min = GF_MB_INTRA_MIN * cpi->common.MBs;
- }
-
- if (cpi->oxcf.end_usage == USAGE_CONSTANT_QUALITY) {
- twopass->active_worst_quality = cpi->oxcf.cq_level;
- } else if (cm->current_video_frame == 0 ||
- (is_spatial_svc && lc->current_video_frame_in_layer == 0)) {
- // Special case code for first frame.
- const int section_target_bandwidth = (int)(twopass->bits_left /
- frames_left);
- const int tmp_q = vp9_twopass_worst_quality(cpi, &twopass->total_left_stats,
- section_target_bandwidth);
- twopass->active_worst_quality = tmp_q;
- rc->ni_av_qi = tmp_q;
- rc->avg_q = vp9_convert_qindex_to_q(tmp_q);
- }
- vp9_zero(this_frame);
- if (EOF == input_stats(twopass, &this_frame))
- return;
-
- this_frame_intra_error = this_frame.intra_error;
- this_frame_coded_error = this_frame.coded_error;
-
- // Keyframe and section processing.
- if (rc->frames_to_key == 0 ||
- (cm->frame_flags & FRAMEFLAGS_KEY)) {
- // Define next KF group and assign bits to it.
- this_frame_copy = this_frame;
- find_next_key_frame(cpi, &this_frame_copy);
- // Don't place key frame in any enhancement layers in spatial svc
- if (cpi->use_svc && cpi->svc.number_temporal_layers == 1 &&
- cpi->svc.spatial_layer_id > 0) {
- cm->frame_type = INTER_FRAME;
- }
- } else {
- cm->frame_type = INTER_FRAME;
- }
-
- // Is this frame a GF / ARF? (Note: a key frame is always also a GF).
- if (rc->frames_till_gf_update_due == 0) {
- // Define next gf group and assign bits to it.
- this_frame_copy = this_frame;
-
-#if CONFIG_MULTIPLE_ARF
- if (cpi->multi_arf_enabled) {
- define_fixed_arf_period(cpi);
- } else {
-#endif
- define_gf_group(cpi, &this_frame_copy);
-#if CONFIG_MULTIPLE_ARF
- }
-#endif
-
- if (twopass->gf_zeromotion_pct > 995) {
- // As long as max_thresh for encode breakout is small enough, it is ok
- // to enable it for show frame, i.e. set allow_encode_breakout to
- // ENCODE_BREAKOUT_LIMITED.
- if (!cm->show_frame)
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_DISABLED;
- else
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_LIMITED;
- }
-
- rc->frames_till_gf_update_due = rc->baseline_gf_interval;
- cpi->refresh_golden_frame = 1;
- } else {
- // Otherwise this is an ordinary frame.
- // Assign bits from those allocated to the GF group.
- this_frame_copy = this_frame;
- assign_std_frame_bits(cpi, &this_frame_copy);
- }
-
- // Keep a globally available copy of this and the next frame's iiratio.
- twopass->this_iiratio = (int)(this_frame_intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame_coded_error));
- {
- FIRSTPASS_STATS next_frame;
- if (lookup_next_frame_stats(twopass, &next_frame) != EOF) {
- twopass->next_iiratio = (int)(next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
- }
- }
-
- if (cpi->common.frame_type == KEY_FRAME)
- target = vp9_rc_clamp_iframe_target_size(cpi, rc->this_frame_target);
- else
- target = vp9_rc_clamp_pframe_target_size(cpi, rc->this_frame_target);
- vp9_rc_set_frame_target(cpi, target);
-
- // Update the total stats remaining structure.
- subtract_stats(&twopass->total_left_stats, &this_frame);
-}
-
-void vp9_twopass_postencode_update(VP9_COMP *cpi) {
- const uint64_t bits_used = cpi->rc.projected_frame_size;
- cpi->twopass.bits_left -= bits_used;
- cpi->twopass.bits_left = MAX(cpi->twopass.bits_left, 0);
- // Update bits left to the kf and gf groups to account for overshoot or
- // undershoot on these frames.
- if (cpi->common.frame_type == KEY_FRAME) {
- // For key frames kf_group_bits already had the target bits subtracted out.
- // So now update to the correct value based on the actual bits used.
- cpi->twopass.kf_group_bits += cpi->rc.this_frame_target - bits_used;
- } else {
- cpi->twopass.kf_group_bits -= bits_used;
- cpi->twopass.gf_group_bits -= bits_used;
- cpi->twopass.gf_group_bits = MAX(cpi->twopass.gf_group_bits, 0);
- }
- cpi->twopass.kf_group_bits = MAX(cpi->twopass.kf_group_bits, 0);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.h
deleted file mode 100644
index 7a16c8f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_firstpass.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_FIRSTPASS_H_
-#define VP9_ENCODER_VP9_FIRSTPASS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- double frame;
- double intra_error;
- double coded_error;
- double sr_coded_error;
- double ssim_weighted_pred_err;
- double pcnt_inter;
- double pcnt_motion;
- double pcnt_second_ref;
- double pcnt_neutral;
- double MVr;
- double mvr_abs;
- double MVc;
- double mvc_abs;
- double MVrv;
- double MVcv;
- double mv_in_out_count;
- double new_mv_count;
- double duration;
- double count;
- int64_t spatial_layer_id;
-} FIRSTPASS_STATS;
-
-struct twopass_rc {
- unsigned int section_intra_rating;
- unsigned int next_iiratio;
- unsigned int this_iiratio;
- FIRSTPASS_STATS total_stats;
- FIRSTPASS_STATS this_frame_stats;
- const FIRSTPASS_STATS *stats_in;
- const FIRSTPASS_STATS *stats_in_start;
- const FIRSTPASS_STATS *stats_in_end;
- FIRSTPASS_STATS total_left_stats;
- int first_pass_done;
- int64_t bits_left;
- int64_t clip_bits_total;
- double avg_iiratio;
- double modified_error_min;
- double modified_error_max;
- double modified_error_total;
- double modified_error_left;
- double kf_intra_err_min;
- double gf_intra_err_min;
- int kf_bits;
- // Remaining error from uncoded frames in a gf group. Two pass use only
- int64_t gf_group_error_left;
-
- // Projected total bits available for a key frame group of frames
- int64_t kf_group_bits;
-
- // Error score of frames still to be coded in kf group
- int64_t kf_group_error_left;
-
- // Projected Bits available for a group of frames including 1 GF or ARF
- int64_t gf_group_bits;
- // Bits for the golden frame or ARF - 2 pass only
- int gf_bits;
- int alt_extra_bits;
-
- int sr_update_lag;
-
- int kf_zeromotion_pct;
- int gf_zeromotion_pct;
-
- int active_worst_quality;
-};
-
-struct VP9_COMP;
-
-void vp9_init_first_pass(struct VP9_COMP *cpi);
-void vp9_rc_get_first_pass_params(struct VP9_COMP *cpi);
-void vp9_first_pass(struct VP9_COMP *cpi);
-void vp9_end_first_pass(struct VP9_COMP *cpi);
-
-void vp9_init_second_pass(struct VP9_COMP *cpi);
-void vp9_rc_get_second_pass_params(struct VP9_COMP *cpi);
-int vp9_twopass_worst_quality(struct VP9_COMP *cpi, FIRSTPASS_STATS *fpstats,
- int section_target_bandwitdh);
-
-// Post encode update of the rate control parameters for 2-pass
-void vp9_twopass_postencode_update(struct VP9_COMP *cpi);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_FIRSTPASS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.c
deleted file mode 100644
index cf03e01..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <assert.h>
-#include <stdlib.h>
-
-#include "./vpx_config.h"
-
-#include "vp9/common/vp9_common.h"
-
-#include "vp9/encoder/vp9_extend.h"
-#include "vp9/encoder/vp9_lookahead.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-
-struct lookahead_ctx {
- unsigned int max_sz; /* Absolute size of the queue */
- unsigned int sz; /* Number of buffers currently in the queue */
- unsigned int read_idx; /* Read index */
- unsigned int write_idx; /* Write index */
- struct lookahead_entry *buf; /* Buffer list */
-};
-
-
-/* Return the buffer at the given absolute index and increment the index */
-static struct lookahead_entry *pop(struct lookahead_ctx *ctx,
- unsigned int *idx) {
- unsigned int index = *idx;
- struct lookahead_entry *buf = ctx->buf + index;
-
- assert(index < ctx->max_sz);
- if (++index >= ctx->max_sz)
- index -= ctx->max_sz;
- *idx = index;
- return buf;
-}
-
-
-void vp9_lookahead_destroy(struct lookahead_ctx *ctx) {
- if (ctx) {
- if (ctx->buf) {
- unsigned int i;
-
- for (i = 0; i < ctx->max_sz; i++)
- vp9_free_frame_buffer(&ctx->buf[i].img);
- free(ctx->buf);
- }
- free(ctx);
- }
-}
-
-
-struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
- unsigned int height,
- unsigned int subsampling_x,
- unsigned int subsampling_y,
- unsigned int depth) {
- struct lookahead_ctx *ctx = NULL;
-
- // Clamp the lookahead queue depth
- depth = clamp(depth, 1, MAX_LAG_BUFFERS);
-
- // Allocate memory to keep previous source frames available.
- depth += MAX_PRE_FRAMES;
-
- // Allocate the lookahead structures
- ctx = calloc(1, sizeof(*ctx));
- if (ctx) {
- unsigned int i;
- ctx->max_sz = depth;
- ctx->buf = calloc(depth, sizeof(*ctx->buf));
- if (!ctx->buf)
- goto bail;
- for (i = 0; i < depth; i++)
- if (vp9_alloc_frame_buffer(&ctx->buf[i].img,
- width, height, subsampling_x, subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS))
- goto bail;
- }
- return ctx;
- bail:
- vp9_lookahead_destroy(ctx);
- return NULL;
-}
-
-#define USE_PARTIAL_COPY 0
-
-int vp9_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src,
- int64_t ts_start, int64_t ts_end, unsigned int flags) {
- struct lookahead_entry *buf;
-#if USE_PARTIAL_COPY
- int row, col, active_end;
- int mb_rows = (src->y_height + 15) >> 4;
- int mb_cols = (src->y_width + 15) >> 4;
-#endif
-
- if (ctx->sz + 1 + MAX_PRE_FRAMES > ctx->max_sz)
- return 1;
- ctx->sz++;
- buf = pop(ctx, &ctx->write_idx);
-
-#if USE_PARTIAL_COPY
- // TODO(jkoleszar): This is disabled for now, as
- // vp9_copy_and_extend_frame_with_rect is not subsampling/alpha aware.
-
- // Only do this partial copy if the following conditions are all met:
- // 1. Lookahead queue has has size of 1.
- // 2. Active map is provided.
- // 3. This is not a key frame, golden nor altref frame.
- if (ctx->max_sz == 1 && active_map && !flags) {
- for (row = 0; row < mb_rows; ++row) {
- col = 0;
-
- while (1) {
- // Find the first active macroblock in this row.
- for (; col < mb_cols; ++col) {
- if (active_map[col])
- break;
- }
-
- // No more active macroblock in this row.
- if (col == mb_cols)
- break;
-
- // Find the end of active region in this row.
- active_end = col;
-
- for (; active_end < mb_cols; ++active_end) {
- if (!active_map[active_end])
- break;
- }
-
- // Only copy this active region.
- vp9_copy_and_extend_frame_with_rect(src, &buf->img,
- row << 4,
- col << 4, 16,
- (active_end - col) << 4);
-
- // Start again from the end of this active region.
- col = active_end;
- }
-
- active_map += mb_cols;
- }
- } else {
- vp9_copy_and_extend_frame(src, &buf->img);
- }
-#else
- // Partial copy not implemented yet
- vp9_copy_and_extend_frame(src, &buf->img);
-#endif
-
- buf->ts_start = ts_start;
- buf->ts_end = ts_end;
- buf->flags = flags;
- return 0;
-}
-
-
-struct lookahead_entry *vp9_lookahead_pop(struct lookahead_ctx *ctx,
- int drain) {
- struct lookahead_entry *buf = NULL;
-
- if (ctx->sz && (drain || ctx->sz == ctx->max_sz - MAX_PRE_FRAMES)) {
- buf = pop(ctx, &ctx->read_idx);
- ctx->sz--;
- }
- return buf;
-}
-
-
-struct lookahead_entry *vp9_lookahead_peek(struct lookahead_ctx *ctx,
- int index) {
- struct lookahead_entry *buf = NULL;
-
- if (index >= 0) {
- // Forward peek
- if (index < (int)ctx->sz) {
- index += ctx->read_idx;
- if (index >= (int)ctx->max_sz)
- index -= ctx->max_sz;
- buf = ctx->buf + index;
- }
- } else if (index < 0) {
- // Backward peek
- if (-index <= MAX_PRE_FRAMES) {
- index += ctx->read_idx;
- if (index < 0)
- index += ctx->max_sz;
- buf = ctx->buf + index;
- }
- }
-
- return buf;
-}
-
-unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx) {
- return ctx->sz;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.h
deleted file mode 100644
index 046c533..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_lookahead.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_LOOKAHEAD_H_
-#define VP9_ENCODER_VP9_LOOKAHEAD_H_
-
-#include "vpx_scale/yv12config.h"
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_LAG_BUFFERS 25
-
-// The max of past frames we want to keep in the queue.
-#define MAX_PRE_FRAMES 1
-
-struct lookahead_entry {
- YV12_BUFFER_CONFIG img;
- int64_t ts_start;
- int64_t ts_end;
- unsigned int flags;
-};
-
-
-struct lookahead_ctx;
-
-/**\brief Initializes the lookahead stage
- *
- * The lookahead stage is a queue of frame buffers on which some analysis
- * may be done when buffers are enqueued.
- */
-struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
- unsigned int height,
- unsigned int subsampling_x,
- unsigned int subsampling_y,
- unsigned int depth);
-
-
-/**\brief Destroys the lookahead stage
- */
-void vp9_lookahead_destroy(struct lookahead_ctx *ctx);
-
-
-/**\brief Enqueue a source buffer
- *
- * This function will copy the source image into a new framebuffer with
- * the expected stride/border.
- *
- * If active_map is non-NULL and there is only one frame in the queue, then copy
- * only active macroblocks.
- *
- * \param[in] ctx Pointer to the lookahead context
- * \param[in] src Pointer to the image to enqueue
- * \param[in] ts_start Timestamp for the start of this frame
- * \param[in] ts_end Timestamp for the end of this frame
- * \param[in] flags Flags set on this frame
- * \param[in] active_map Map that specifies which macroblock is active
- */
-int vp9_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src,
- int64_t ts_start, int64_t ts_end, unsigned int flags);
-
-
-/**\brief Get the next source buffer to encode
- *
- *
- * \param[in] ctx Pointer to the lookahead context
- * \param[in] drain Flag indicating the buffer should be drained
- * (return a buffer regardless of the current queue depth)
- *
- * \retval NULL, if drain set and queue is empty
- * \retval NULL, if drain not set and queue not of the configured depth
- */
-struct lookahead_entry *vp9_lookahead_pop(struct lookahead_ctx *ctx,
- int drain);
-
-
-/**\brief Get a future source buffer to encode
- *
- * \param[in] ctx Pointer to the lookahead context
- * \param[in] index Index of the frame to be returned, 0 == next frame
- *
- * \retval NULL, if no buffer exists at the specified index
- */
-struct lookahead_entry *vp9_lookahead_peek(struct lookahead_ctx *ctx,
- int index);
-
-
-/**\brief Get the number of frames currently in the lookahead queue
- *
- * \param[in] ctx Pointer to the lookahead context
- */
-unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_LOOKAHEAD_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.c
deleted file mode 100644
index 650b06e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-
-#include "vpx_mem/vpx_mem.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_segmentation.h"
-#include "vp9/encoder/vp9_mcomp.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_reconintra.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-
-
-static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
- const MV *ref_mv,
- MV *dst_mv,
- int mb_row,
- int mb_col) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
-
- const int tmp_col_min = x->mv_col_min;
- const int tmp_col_max = x->mv_col_max;
- const int tmp_row_min = x->mv_row_min;
- const int tmp_row_max = x->mv_row_max;
- MV ref_full;
-
- // Further step/diamond searches as necessary
- int step_param = cpi->sf.reduce_first_step_size +
- (cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
- step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
-
- vp9_set_mv_search_range(x, ref_mv);
-
- ref_full.col = ref_mv->col >> 3;
- ref_full.row = ref_mv->row >> 3;
-
- /*cpi->sf.search_method == HEX*/
- vp9_hex_search(x, &ref_full, step_param, x->errorperbit, 0, &v_fn_ptr, 0,
- ref_mv, dst_mv);
-
- // Try sub-pixel MC
- // if (bestsme > error_thresh && bestsme < INT_MAX)
- {
- int distortion;
- unsigned int sse;
- cpi->find_fractional_mv_step(
- x, dst_mv, ref_mv, cpi->common.allow_high_precision_mv, x->errorperbit,
- &v_fn_ptr, 0, cpi->sf.subpel_iters_per_step, NULL, NULL, &distortion,
- &sse);
- }
-
- xd->mi[0]->mbmi.mode = NEWMV;
- xd->mi[0]->mbmi.mv[0].as_mv = *dst_mv;
-
- vp9_build_inter_predictors_sby(xd, mb_row, mb_col, BLOCK_16X16);
-
- /* restore UMV window */
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
-
- return vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].dst.buf, xd->plane[0].dst.stride,
- INT_MAX);
-}
-
-static int do_16x16_motion_search(VP9_COMP *cpi, const int_mv *ref_mv,
- int_mv *dst_mv, int mb_row, int mb_col) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- unsigned int err, tmp_err;
- int_mv tmp_mv;
-
- // Try zero MV first
- // FIXME should really use something like near/nearest MV and/or MV prediction
- err = vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride,
- INT_MAX);
- dst_mv->as_int = 0;
-
- // Test last reference frame using the previous best mv as the
- // starting point (best reference) for the search
- tmp_err = do_16x16_motion_iteration(cpi, &ref_mv->as_mv, &tmp_mv.as_mv,
- mb_row, mb_col);
- if (tmp_err < err) {
- err = tmp_err;
- dst_mv->as_int = tmp_mv.as_int;
- }
-
- // If the current best reference mv is not centered on 0,0 then do a 0,0
- // based search as well.
- if (ref_mv->as_int) {
- unsigned int tmp_err;
- int_mv zero_ref_mv, tmp_mv;
-
- zero_ref_mv.as_int = 0;
- tmp_err = do_16x16_motion_iteration(cpi, &zero_ref_mv.as_mv, &tmp_mv.as_mv,
- mb_row, mb_col);
- if (tmp_err < err) {
- dst_mv->as_int = tmp_mv.as_int;
- err = tmp_err;
- }
- }
-
- return err;
-}
-
-static int do_16x16_zerozero_search(VP9_COMP *cpi, int_mv *dst_mv) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- unsigned int err;
-
- // Try zero MV first
- // FIXME should really use something like near/nearest MV and/or MV prediction
- err = vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride,
- INT_MAX);
-
- dst_mv->as_int = 0;
-
- return err;
-}
-static int find_best_16x16_intra(VP9_COMP *cpi,
- MB_PREDICTION_MODE *pbest_mode) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_PREDICTION_MODE best_mode = -1, mode;
- unsigned int best_err = INT_MAX;
-
- // calculate SATD for each intra prediction mode;
- // we're intentionally not doing 4x4, we just want a rough estimate
- for (mode = DC_PRED; mode <= TM_PRED; mode++) {
- unsigned int err;
-
- xd->mi[0]->mbmi.mode = mode;
- vp9_predict_intra_block(xd, 0, 2, TX_16X16, mode,
- x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].dst.buf, xd->plane[0].dst.stride,
- 0, 0, 0);
- err = vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].dst.buf, xd->plane[0].dst.stride, best_err);
-
- // find best
- if (err < best_err) {
- best_err = err;
- best_mode = mode;
- }
- }
-
- if (pbest_mode)
- *pbest_mode = best_mode;
-
- return best_err;
-}
-
-static void update_mbgraph_mb_stats
-(
- VP9_COMP *cpi,
- MBGRAPH_MB_STATS *stats,
- YV12_BUFFER_CONFIG *buf,
- int mb_y_offset,
- YV12_BUFFER_CONFIG *golden_ref,
- int_mv *prev_golden_ref_mv,
- YV12_BUFFER_CONFIG *alt_ref,
- int mb_row,
- int mb_col
-) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- int intra_error;
- VP9_COMMON *cm = &cpi->common;
-
- // FIXME in practice we're completely ignoring chroma here
- x->plane[0].src.buf = buf->y_buffer + mb_y_offset;
- x->plane[0].src.stride = buf->y_stride;
-
- xd->plane[0].dst.buf = get_frame_new_buffer(cm)->y_buffer + mb_y_offset;
- xd->plane[0].dst.stride = get_frame_new_buffer(cm)->y_stride;
-
- // do intra 16x16 prediction
- intra_error = find_best_16x16_intra(cpi,
- &stats->ref[INTRA_FRAME].m.mode);
- if (intra_error <= 0)
- intra_error = 1;
- stats->ref[INTRA_FRAME].err = intra_error;
-
- // Golden frame MV search, if it exists and is different than last frame
- if (golden_ref) {
- int g_motion_error;
- xd->plane[0].pre[0].buf = golden_ref->y_buffer + mb_y_offset;
- xd->plane[0].pre[0].stride = golden_ref->y_stride;
- g_motion_error = do_16x16_motion_search(cpi,
- prev_golden_ref_mv,
- &stats->ref[GOLDEN_FRAME].m.mv,
- mb_row, mb_col);
- stats->ref[GOLDEN_FRAME].err = g_motion_error;
- } else {
- stats->ref[GOLDEN_FRAME].err = INT_MAX;
- stats->ref[GOLDEN_FRAME].m.mv.as_int = 0;
- }
-
- // Do an Alt-ref frame MV search, if it exists and is different than
- // last/golden frame.
- if (alt_ref) {
- int a_motion_error;
- xd->plane[0].pre[0].buf = alt_ref->y_buffer + mb_y_offset;
- xd->plane[0].pre[0].stride = alt_ref->y_stride;
- a_motion_error = do_16x16_zerozero_search(cpi,
- &stats->ref[ALTREF_FRAME].m.mv);
-
- stats->ref[ALTREF_FRAME].err = a_motion_error;
- } else {
- stats->ref[ALTREF_FRAME].err = INT_MAX;
- stats->ref[ALTREF_FRAME].m.mv.as_int = 0;
- }
-}
-
-static void update_mbgraph_frame_stats(VP9_COMP *cpi,
- MBGRAPH_FRAME_STATS *stats,
- YV12_BUFFER_CONFIG *buf,
- YV12_BUFFER_CONFIG *golden_ref,
- YV12_BUFFER_CONFIG *alt_ref) {
- MACROBLOCK *const x = &cpi->mb;
- MACROBLOCKD *const xd = &x->e_mbd;
- VP9_COMMON *const cm = &cpi->common;
-
- int mb_col, mb_row, offset = 0;
- int mb_y_offset = 0, arf_y_offset = 0, gld_y_offset = 0;
- int_mv arf_top_mv, gld_top_mv;
- MODE_INFO mi_local = { { 0 } };
-
- // Set up limit values for motion vectors to prevent them extending outside
- // the UMV borders.
- arf_top_mv.as_int = 0;
- gld_top_mv.as_int = 0;
- x->mv_row_min = -BORDER_MV_PIXELS_B16;
- x->mv_row_max = (cm->mb_rows - 1) * 8 + BORDER_MV_PIXELS_B16;
- xd->up_available = 0;
- xd->plane[0].dst.stride = buf->y_stride;
- xd->plane[0].pre[0].stride = buf->y_stride;
- xd->plane[1].dst.stride = buf->uv_stride;
- xd->mi[0] = &mi_local;
- mi_local.mbmi.sb_type = BLOCK_16X16;
- mi_local.mbmi.ref_frame[0] = LAST_FRAME;
- mi_local.mbmi.ref_frame[1] = NONE;
-
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
- int_mv arf_left_mv, gld_left_mv;
- int mb_y_in_offset = mb_y_offset;
- int arf_y_in_offset = arf_y_offset;
- int gld_y_in_offset = gld_y_offset;
-
- // Set up limit values for motion vectors to prevent them extending outside
- // the UMV borders.
- arf_left_mv.as_int = arf_top_mv.as_int;
- gld_left_mv.as_int = gld_top_mv.as_int;
- x->mv_col_min = -BORDER_MV_PIXELS_B16;
- x->mv_col_max = (cm->mb_cols - 1) * 8 + BORDER_MV_PIXELS_B16;
- xd->left_available = 0;
-
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
- MBGRAPH_MB_STATS *mb_stats = &stats->mb_stats[offset + mb_col];
-
- update_mbgraph_mb_stats(cpi, mb_stats, buf, mb_y_in_offset,
- golden_ref, &gld_left_mv, alt_ref,
- mb_row, mb_col);
- arf_left_mv.as_int = mb_stats->ref[ALTREF_FRAME].m.mv.as_int;
- gld_left_mv.as_int = mb_stats->ref[GOLDEN_FRAME].m.mv.as_int;
- if (mb_col == 0) {
- arf_top_mv.as_int = arf_left_mv.as_int;
- gld_top_mv.as_int = gld_left_mv.as_int;
- }
- xd->left_available = 1;
- mb_y_in_offset += 16;
- gld_y_in_offset += 16;
- arf_y_in_offset += 16;
- x->mv_col_min -= 16;
- x->mv_col_max -= 16;
- }
- xd->up_available = 1;
- mb_y_offset += buf->y_stride * 16;
- gld_y_offset += golden_ref->y_stride * 16;
- if (alt_ref)
- arf_y_offset += alt_ref->y_stride * 16;
- x->mv_row_min -= 16;
- x->mv_row_max -= 16;
- offset += cm->mb_cols;
- }
-}
-
-// void separate_arf_mbs_byzz
-static void separate_arf_mbs(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- int mb_col, mb_row, offset, i;
- int mi_row, mi_col;
- int ncnt[4] = { 0 };
- int n_frames = cpi->mbgraph_n_frames;
-
- int *arf_not_zz;
-
- CHECK_MEM_ERROR(cm, arf_not_zz,
- vpx_calloc(cm->mb_rows * cm->mb_cols * sizeof(*arf_not_zz),
- 1));
-
- // We are not interested in results beyond the alt ref itself.
- if (n_frames > cpi->rc.frames_till_gf_update_due)
- n_frames = cpi->rc.frames_till_gf_update_due;
-
- // defer cost to reference frames
- for (i = n_frames - 1; i >= 0; i--) {
- MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i];
-
- for (offset = 0, mb_row = 0; mb_row < cm->mb_rows;
- offset += cm->mb_cols, mb_row++) {
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
- MBGRAPH_MB_STATS *mb_stats = &frame_stats->mb_stats[offset + mb_col];
-
- int altref_err = mb_stats->ref[ALTREF_FRAME].err;
- int intra_err = mb_stats->ref[INTRA_FRAME ].err;
- int golden_err = mb_stats->ref[GOLDEN_FRAME].err;
-
- // Test for altref vs intra and gf and that its mv was 0,0.
- if (altref_err > 1000 ||
- altref_err > intra_err ||
- altref_err > golden_err) {
- arf_not_zz[offset + mb_col]++;
- }
- }
- }
- }
-
- // arf_not_zz is indexed by MB, but this loop is indexed by MI to avoid out
- // of bound access in segmentation_map
- for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) {
- for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) {
- // If any of the blocks in the sequence failed then the MB
- // goes in segment 0
- if (arf_not_zz[mi_row / 2 * cm->mb_cols + mi_col / 2]) {
- ncnt[0]++;
- cpi->segmentation_map[mi_row * cm->mi_cols + mi_col] = 0;
- } else {
- cpi->segmentation_map[mi_row * cm->mi_cols + mi_col] = 1;
- ncnt[1]++;
- }
- }
- }
-
- // Only bother with segmentation if over 10% of the MBs in static segment
- // if ( ncnt[1] && (ncnt[0] / ncnt[1] < 10) )
- if (1) {
- // Note % of blocks that are marked as static
- if (cm->MBs)
- cpi->static_mb_pct = (ncnt[1] * 100) / (cm->mi_rows * cm->mi_cols);
-
- // This error case should not be reachable as this function should
- // never be called with the common data structure uninitialized.
- else
- cpi->static_mb_pct = 0;
-
- cpi->seg0_cnt = ncnt[0];
- vp9_enable_segmentation(&cm->seg);
- } else {
- cpi->static_mb_pct = 0;
- vp9_disable_segmentation(&cm->seg);
- }
-
- // Free localy allocated storage
- vpx_free(arf_not_zz);
-}
-
-void vp9_update_mbgraph_stats(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- int i, n_frames = vp9_lookahead_depth(cpi->lookahead);
- YV12_BUFFER_CONFIG *golden_ref = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
-
- // we need to look ahead beyond where the ARF transitions into
- // being a GF - so exit if we don't look ahead beyond that
- if (n_frames <= cpi->rc.frames_till_gf_update_due)
- return;
-
- if (n_frames > MAX_LAG_BUFFERS)
- n_frames = MAX_LAG_BUFFERS;
-
- cpi->mbgraph_n_frames = n_frames;
- for (i = 0; i < n_frames; i++) {
- MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i];
- vpx_memset(frame_stats->mb_stats, 0,
- cm->mb_rows * cm->mb_cols *
- sizeof(*cpi->mbgraph_stats[i].mb_stats));
- }
-
- // do motion search to find contribution of each reference to data
- // later on in this GF group
- // FIXME really, the GF/last MC search should be done forward, and
- // the ARF MC search backwards, to get optimal results for MV caching
- for (i = 0; i < n_frames; i++) {
- MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i];
- struct lookahead_entry *q_cur = vp9_lookahead_peek(cpi->lookahead, i);
-
- assert(q_cur != NULL);
-
- update_mbgraph_frame_stats(cpi, frame_stats, &q_cur->img,
- golden_ref, cpi->Source);
- }
-
- vp9_clear_system_state();
-
- separate_arf_mbs(cpi);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.h
deleted file mode 100644
index bc2a704..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mbgraph.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_MBGRAPH_H_
-#define VP9_ENCODER_VP9_MBGRAPH_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- struct {
- int err;
- union {
- int_mv mv;
- MB_PREDICTION_MODE mode;
- } m;
- } ref[MAX_REF_FRAMES];
-} MBGRAPH_MB_STATS;
-
-typedef struct {
- MBGRAPH_MB_STATS *mb_stats;
-} MBGRAPH_FRAME_STATS;
-
-struct VP9_COMP;
-
-void vp9_update_mbgraph_stats(struct VP9_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_MBGRAPH_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.c
deleted file mode 100644
index d407010..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.c
+++ /dev/null
@@ -1,1751 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-
-#include "./vpx_config.h"
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_common.h"
-
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_mcomp.h"
-
-// #define NEW_DIAMOND_SEARCH
-
-static INLINE const uint8_t *get_buf_from_mv(const struct buf_2d *buf,
- const MV *mv) {
- return &buf->buf[mv->row * buf->stride + mv->col];
-}
-
-void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv) {
- int col_min = (mv->col >> 3) - MAX_FULL_PEL_VAL + (mv->col & 7 ? 1 : 0);
- int row_min = (mv->row >> 3) - MAX_FULL_PEL_VAL + (mv->row & 7 ? 1 : 0);
- int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL;
- int row_max = (mv->row >> 3) + MAX_FULL_PEL_VAL;
-
- col_min = MAX(col_min, (MV_LOW >> 3) + 1);
- row_min = MAX(row_min, (MV_LOW >> 3) + 1);
- col_max = MIN(col_max, (MV_UPP >> 3) - 1);
- row_max = MIN(row_max, (MV_UPP >> 3) - 1);
-
- // Get intersection of UMV window and valid MV window to reduce # of checks
- // in diamond search.
- if (x->mv_col_min < col_min)
- x->mv_col_min = col_min;
- if (x->mv_col_max > col_max)
- x->mv_col_max = col_max;
- if (x->mv_row_min < row_min)
- x->mv_row_min = row_min;
- if (x->mv_row_max > row_max)
- x->mv_row_max = row_max;
-}
-
-int vp9_init_search_range(VP9_COMP *cpi, int size) {
- int sr = 0;
-
- // Minimum search size no matter what the passed in value.
- size = MAX(16, size);
-
- while ((size << sr) < MAX_FULL_PEL_VAL)
- sr++;
-
- sr += cpi->sf.reduce_first_step_size;
- sr = MIN(sr, (cpi->sf.max_step_search_steps - 2));
- return sr;
-}
-
-static INLINE int mv_cost(const MV *mv,
- const int *joint_cost, int *comp_cost[2]) {
- return joint_cost[vp9_get_mv_joint(mv)] +
- comp_cost[0][mv->row] + comp_cost[1][mv->col];
-}
-
-int vp9_mv_bit_cost(const MV *mv, const MV *ref,
- const int *mvjcost, int *mvcost[2], int weight) {
- const MV diff = { mv->row - ref->row,
- mv->col - ref->col };
- return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) * weight, 7);
-}
-
-static int mv_err_cost(const MV *mv, const MV *ref,
- const int *mvjcost, int *mvcost[2],
- int error_per_bit) {
- if (mvcost) {
- const MV diff = { mv->row - ref->row,
- mv->col - ref->col };
- return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) *
- error_per_bit, 13);
- }
- return 0;
-}
-
-static int mvsad_err_cost(const MV *mv, const MV *ref,
- const int *mvjsadcost, int *mvsadcost[2],
- int error_per_bit) {
- if (mvsadcost) {
- const MV diff = { mv->row - ref->row,
- mv->col - ref->col };
- return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjsadcost, mvsadcost) *
- error_per_bit, 8);
- }
- return 0;
-}
-
-void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride) {
- int len, ss_count = 1;
-
- x->ss[0].mv.col = x->ss[0].mv.row = 0;
- x->ss[0].offset = 0;
-
- for (len = MAX_FIRST_STEP; len > 0; len /= 2) {
- // Generate offsets for 4 search sites per step.
- const MV ss_mvs[] = {{-len, 0}, {len, 0}, {0, -len}, {0, len}};
- int i;
- for (i = 0; i < 4; ++i) {
- search_site *const ss = &x->ss[ss_count++];
- ss->mv = ss_mvs[i];
- ss->offset = ss->mv.row * stride + ss->mv.col;
- }
- }
-
- x->ss_count = ss_count;
- x->searches_per_step = 4;
-}
-
-void vp9_init3smotion_compensation(MACROBLOCK *x, int stride) {
- int len, ss_count = 1;
-
- x->ss[0].mv.col = x->ss[0].mv.row = 0;
- x->ss[0].offset = 0;
-
- for (len = MAX_FIRST_STEP; len > 0; len /= 2) {
- // Generate offsets for 8 search sites per step.
- const MV ss_mvs[8] = {
- {-len, 0 }, {len, 0 }, { 0, -len}, {0, len},
- {-len, -len}, {-len, len}, {len, -len}, {len, len}
- };
- int i;
- for (i = 0; i < 8; ++i) {
- search_site *const ss = &x->ss[ss_count++];
- ss->mv = ss_mvs[i];
- ss->offset = ss->mv.row * stride + ss->mv.col;
- }
- }
-
- x->ss_count = ss_count;
- x->searches_per_step = 8;
-}
-
-/*
- * To avoid the penalty for crossing cache-line read, preload the reference
- * area in a small buffer, which is aligned to make sure there won't be crossing
- * cache-line read while reading from this buffer. This reduced the cpu
- * cycles spent on reading ref data in sub-pixel filter functions.
- * TODO: Currently, since sub-pixel search range here is -3 ~ 3, copy 22 rows x
- * 32 cols area that is enough for 16x16 macroblock. Later, for SPLITMV, we
- * could reduce the area.
- */
-
-/* estimated cost of a motion vector (r,c) */
-#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)
-
-
-// convert motion vector component to offset for svf calc
-static INLINE int sp(int x) {
- return (x & 7) << 1;
-}
-
-static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c,
- int offset) {
- return &buf[(r >> 3) * stride + (c >> 3) - offset];
-}
-
-/* returns subpixel variance error function */
-#define DIST(r, c) \
- vfp->svf(pre(y, y_stride, r, c, offset), y_stride, sp(c), sp(r), z, \
- src_stride, &sse)
-
-/* checks if (r, c) has better score than previous best */
-#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; \
- }
-
-#define FIRST_LEVEL_CHECKS \
- { \
- unsigned int left, right, up, down, diag; \
- CHECK_BETTER(left, tr, tc - hstep); \
- CHECK_BETTER(right, tr, tc + hstep); \
- CHECK_BETTER(up, tr - hstep, tc); \
- CHECK_BETTER(down, tr + hstep, tc); \
- whichdir = (left < right ? 0 : 1) + \
- (up < down ? 0 : 2); \
- switch (whichdir) { \
- case 0: \
- CHECK_BETTER(diag, tr - hstep, tc - hstep); \
- break; \
- case 1: \
- CHECK_BETTER(diag, tr - hstep, tc + hstep); \
- break; \
- case 2: \
- CHECK_BETTER(diag, tr + hstep, tc - hstep); \
- break; \
- case 3: \
- CHECK_BETTER(diag, tr + hstep, tc + hstep); \
- break; \
- } \
- }
-
-#define SECOND_LEVEL_CHECKS \
- { \
- int kr, kc; \
- unsigned int second; \
- if (tr != br && tc != bc) { \
- kr = br - tr; \
- kc = bc - tc; \
- CHECK_BETTER(second, tr + kr, tc + 2 * kc); \
- CHECK_BETTER(second, tr + 2 * kr, tc + kc); \
- } else if (tr == br && tc != bc) { \
- kc = bc - tc; \
- CHECK_BETTER(second, tr + hstep, tc + 2 * kc); \
- CHECK_BETTER(second, tr - hstep, tc + 2 * kc); \
- switch (whichdir) { \
- case 0: \
- case 1: \
- CHECK_BETTER(second, tr + hstep, tc + kc); \
- break; \
- case 2: \
- case 3: \
- CHECK_BETTER(second, tr - hstep, tc + kc); \
- break; \
- } \
- } else if (tr != br && tc == bc) { \
- kr = br - tr; \
- CHECK_BETTER(second, tr + 2 * kr, tc + hstep); \
- CHECK_BETTER(second, tr + 2 * kr, tc - hstep); \
- switch (whichdir) { \
- case 0: \
- case 2: \
- CHECK_BETTER(second, tr + kr, tc + hstep); \
- break; \
- case 1: \
- case 3: \
- CHECK_BETTER(second, tr + kr, tc - hstep); \
- break; \
- } \
- } \
- }
-
-int vp9_find_best_sub_pixel_tree(const MACROBLOCK *x,
- MV *bestmv, const MV *ref_mv,
- int allow_hp,
- int error_per_bit,
- const vp9_variance_fn_ptr_t *vfp,
- int forced_stop,
- int iters_per_step,
- int *mvjcost, int *mvcost[2],
- int *distortion,
- unsigned int *sse1) {
- const uint8_t *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;
- unsigned int whichdir;
- int thismse;
- 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[0].stride;
- const int offset = bestmv->row * y_stride + bestmv->col;
- const uint8_t *y = xd->plane[0].pre[0].buf + offset;
-
- int rr = ref_mv->row;
- int rc = ref_mv->col;
- int br = bestmv->row * 8;
- int bc = bestmv->col * 8;
- int hstep = 4;
- const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX);
- const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX);
- const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX);
- const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX);
-
- int tr = br;
- int tc = bc;
-
- // central mv
- bestmv->row *= 8;
- bestmv->col *= 8;
-
- // calculate central point error
- besterr = vfp->vf(y, y_stride, z, src_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 && vp9_use_mv_hp(ref_mv) && 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;
-
- if ((abs(bestmv->col - ref_mv->col) > (MAX_FULL_PEL_VAL << 3)) ||
- (abs(bestmv->row - ref_mv->row) > (MAX_FULL_PEL_VAL << 3)))
- return INT_MAX;
-
- return besterr;
-}
-
-#undef DIST
-/* returns subpixel variance error function */
-#define DIST(r, c) \
- vfp->svaf(pre(y, y_stride, r, c, offset), y_stride, sp(c), sp(r), \
- z, src_stride, &sse, second_pred)
-
-int vp9_find_best_sub_pixel_comp_tree(const MACROBLOCK *x,
- MV *bestmv, const MV *ref_mv,
- int allow_hp,
- int error_per_bit,
- const vp9_variance_fn_ptr_t *vfp,
- int forced_stop,
- int iters_per_step,
- int *mvjcost, int *mvcost[2],
- int *distortion,
- unsigned int *sse1,
- const uint8_t *second_pred,
- int w, int h) {
- const uint8_t *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;
- unsigned int whichdir;
- int thismse;
- const unsigned int halfiters = iters_per_step;
- const unsigned int quarteriters = iters_per_step;
- const unsigned int eighthiters = iters_per_step;
-
- DECLARE_ALIGNED_ARRAY(16, uint8_t, comp_pred, 64 * 64);
- const int y_stride = xd->plane[0].pre[0].stride;
- const int offset = bestmv->row * y_stride + bestmv->col;
- const uint8_t *y = xd->plane[0].pre[0].buf + offset;
-
- int rr = ref_mv->row;
- int rc = ref_mv->col;
- int br = bestmv->row * 8;
- int bc = bestmv->col * 8;
- int hstep = 4;
- const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX);
- const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX);
- const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX);
- const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX);
-
- int tr = br;
- int tc = bc;
-
- // central mv
- bestmv->row *= 8;
- bestmv->col *= 8;
-
- // calculate central point error
- // TODO(yunqingwang): central pointer error was already calculated in full-
- // pixel search, and can be passed in this function.
- vp9_comp_avg_pred(comp_pred, second_pred, w, h, y, y_stride);
- besterr = vfp->vf(comp_pred, w, z, src_stride, sse1);
- *distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
-
- // Each subsequent iteration checks at least one point in
- // common with the last iteration could be 2 ( if diag selected)
- // 1/2 pel
- FIRST_LEVEL_CHECKS;
- if (halfiters > 1) {
- SECOND_LEVEL_CHECKS;
- }
- tr = br;
- tc = bc;
-
- // Each subsequent iteration checks at least one point in common with
- // the last iteration could be 2 ( if diag selected) 1/4 pel
-
- // 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 && vp9_use_mv_hp(ref_mv) && 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;
-
- if ((abs(bestmv->col - ref_mv->col) > (MAX_FULL_PEL_VAL << 3)) ||
- (abs(bestmv->row - ref_mv->row) > (MAX_FULL_PEL_VAL << 3)))
- return INT_MAX;
-
- return besterr;
-}
-
-#undef MVC
-#undef PRE
-#undef DIST
-#undef CHECK_BETTER
-
-static INLINE int check_bounds(const MACROBLOCK *x, int row, int col,
- int range) {
- return ((row - range) >= x->mv_row_min) &
- ((row + range) <= x->mv_row_max) &
- ((col - range) >= x->mv_col_min) &
- ((col + range) <= x->mv_col_max);
-}
-
-static INLINE int is_mv_in(const MACROBLOCK *x, const MV *mv) {
- return (mv->col >= x->mv_col_min) && (mv->col <= x->mv_col_max) &&
- (mv->row >= x->mv_row_min) && (mv->row <= x->mv_row_max);
-}
-
-#define CHECK_BETTER \
- {\
- if (thissad < bestsad) {\
- if (use_mvcost) \
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv, \
- mvjsadcost, mvsadcost, sad_per_bit);\
- if (thissad < bestsad) {\
- bestsad = thissad;\
- best_site = i;\
- }\
- }\
- }
-
-#define MAX_PATTERN_SCALES 11
-#define MAX_PATTERN_CANDIDATES 8 // max number of canddiates per scale
-#define PATTERN_CANDIDATES_REF 3 // number of refinement candidates
-
-// Generic pattern search function that searches over multiple scales.
-// Each scale can have a different number of candidates and shape of
-// candidates as indicated in the num_candidates and candidates arrays
-// passed into this function
-static int vp9_pattern_search(const MACROBLOCK *x,
- MV *ref_mv,
- int search_param,
- int sad_per_bit,
- int do_init_search, int do_refine,
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost,
- const MV *center_mv, MV *best_mv,
- const int num_candidates[MAX_PATTERN_SCALES],
- const MV candidates[MAX_PATTERN_SCALES]
- [MAX_PATTERN_CANDIDATES]) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- static const int search_param_to_steps[MAX_MVSEARCH_STEPS] = {
- 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
- };
- int i, j, s, t;
- const struct buf_2d *const what = &x->plane[0].src;
- const struct buf_2d *const in_what = &xd->plane[0].pre[0];
- int br, bc;
- int bestsad = INT_MAX;
- int thissad;
- int k = -1;
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
- int best_init_s = search_param_to_steps[search_param];
- const int *const mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- // adjust ref_mv to make sure it is within MV range
- clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- br = ref_mv->row;
- bc = ref_mv->col;
-
- // Work out the start point for the search
- bestsad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride,
- 0x7fffffff) + mvsad_err_cost(ref_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- // Search all possible scales upto the search param around the center point
- // pick the scale of the point that is best as the starting scale of
- // further steps around it.
- if (do_init_search) {
- s = best_init_s;
- best_init_s = -1;
- for (t = 0; t <= s; ++t) {
- int best_site = -1;
- if (check_bounds(x, br, bc, 1 << t)) {
- for (i = 0; i < num_candidates[t]; i++) {
- const MV this_mv = {br + candidates[t][i].row,
- bc + candidates[t][i].col};
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- } else {
- for (i = 0; i < num_candidates[t]; i++) {
- const MV this_mv = {br + candidates[t][i].row,
- bc + candidates[t][i].col};
- if (!is_mv_in(x, &this_mv))
- continue;
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- }
- if (best_site == -1) {
- continue;
- } else {
- best_init_s = t;
- k = best_site;
- }
- }
- if (best_init_s != -1) {
- br += candidates[best_init_s][k].row;
- bc += candidates[best_init_s][k].col;
- }
- }
-
- // If the center point is still the best, just skip this and move to
- // the refinement step.
- if (best_init_s != -1) {
- int best_site = -1;
- s = best_init_s;
-
- do {
- // No need to search all 6 points the 1st time if initial search was used
- if (!do_init_search || s != best_init_s) {
- if (check_bounds(x, br, bc, 1 << s)) {
- for (i = 0; i < num_candidates[s]; i++) {
- const MV this_mv = {br + candidates[s][i].row,
- bc + candidates[s][i].col};
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- } else {
- for (i = 0; i < num_candidates[s]; i++) {
- const MV this_mv = {br + candidates[s][i].row,
- bc + candidates[s][i].col};
- if (!is_mv_in(x, &this_mv))
- continue;
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- }
-
- if (best_site == -1) {
- continue;
- } else {
- br += candidates[s][best_site].row;
- bc += candidates[s][best_site].col;
- k = best_site;
- }
- }
-
- do {
- int next_chkpts_indices[PATTERN_CANDIDATES_REF];
- best_site = -1;
- next_chkpts_indices[0] = (k == 0) ? num_candidates[s] - 1 : k - 1;
- next_chkpts_indices[1] = k;
- next_chkpts_indices[2] = (k == num_candidates[s] - 1) ? 0 : k + 1;
-
- if (check_bounds(x, br, bc, 1 << s)) {
- for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
- const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row,
- bc + candidates[s][next_chkpts_indices[i]].col};
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- } else {
- for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
- const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row,
- bc + candidates[s][next_chkpts_indices[i]].col};
- if (!is_mv_in(x, &this_mv))
- continue;
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- }
-
- if (best_site != -1) {
- k = next_chkpts_indices[best_site];
- br += candidates[s][k].row;
- bc += candidates[s][k].col;
- }
- } while (best_site != -1);
- } while (s--);
- }
-
- // Check 4 1-away neighbors if do_refine is true.
- // For most well-designed schemes do_refine will not be necessary.
- if (do_refine) {
- static const MV neighbors[4] = {{0, -1}, { -1, 0}, {1, 0}, {0, 1}};
-
- for (j = 0; j < 16; j++) {
- int best_site = -1;
- if (check_bounds(x, br, bc, 1)) {
- for (i = 0; i < 4; i++) {
- const MV this_mv = {br + neighbors[i].row,
- bc + neighbors[i].col};
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- } else {
- for (i = 0; i < 4; i++) {
- const MV this_mv = {br + neighbors[i].row,
- bc + neighbors[i].col};
- if (!is_mv_in(x, &this_mv))
- continue;
- thissad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
- CHECK_BETTER
- }
- }
-
- if (best_site == -1) {
- break;
- } else {
- br += neighbors[best_site].row;
- bc += neighbors[best_site].col;
- }
- }
- }
-
- best_mv->row = br;
- best_mv->col = bc;
-
- return bestsad;
-}
-
-int vp9_get_mvpred_var(const MACROBLOCK *x,
- const MV *best_mv, const MV *center_mv,
- const vp9_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->vf(what->buf, what->stride,
- get_buf_from_mv(in_what, best_mv), in_what->stride, &unused) +
- (use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost,
- x->mvcost, x->errorperbit) : 0);
-}
-
-int vp9_get_mvpred_av_var(const MACROBLOCK *x,
- const MV *best_mv, const MV *center_mv,
- const uint8_t *second_pred,
- const vp9_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->svaf(get_buf_from_mv(in_what, best_mv), in_what->stride, 0, 0,
- what->buf, what->stride, &unused, second_pred) +
- (use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost,
- x->mvcost, x->errorperbit) : 0);
-}
-
-int vp9_hex_search(const MACROBLOCK *x,
- MV *ref_mv,
- int search_param,
- int sad_per_bit,
- int do_init_search,
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost,
- const MV *center_mv, MV *best_mv) {
- // First scale has 8-closest points, the rest have 6 points in hex shape
- // at increasing scales
- static const int hex_num_candidates[MAX_PATTERN_SCALES] = {
- 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
- };
- // Note that the largest candidate step at each scale is 2^scale
- static const MV hex_candidates[MAX_PATTERN_SCALES][MAX_PATTERN_CANDIDATES] = {
- {{-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, { 0, 1}, { -1, 1}, {-1, 0}},
- {{-1, -2}, {1, -2}, {2, 0}, {1, 2}, { -1, 2}, { -2, 0}},
- {{-2, -4}, {2, -4}, {4, 0}, {2, 4}, { -2, 4}, { -4, 0}},
- {{-4, -8}, {4, -8}, {8, 0}, {4, 8}, { -4, 8}, { -8, 0}},
- {{-8, -16}, {8, -16}, {16, 0}, {8, 16}, { -8, 16}, { -16, 0}},
- {{-16, -32}, {16, -32}, {32, 0}, {16, 32}, { -16, 32}, { -32, 0}},
- {{-32, -64}, {32, -64}, {64, 0}, {32, 64}, { -32, 64}, { -64, 0}},
- {{-64, -128}, {64, -128}, {128, 0}, {64, 128}, { -64, 128}, { -128, 0}},
- {{-128, -256}, {128, -256}, {256, 0}, {128, 256}, { -128, 256}, { -256, 0}},
- {{-256, -512}, {256, -512}, {512, 0}, {256, 512}, { -256, 512}, { -512, 0}},
- {{-512, -1024}, {512, -1024}, {1024, 0}, {512, 1024}, { -512, 1024},
- { -1024, 0}},
- };
- return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit,
- do_init_search, 0, vfp, use_mvcost,
- center_mv, best_mv,
- hex_num_candidates, hex_candidates);
-}
-
-int vp9_bigdia_search(const MACROBLOCK *x,
- MV *ref_mv,
- int search_param,
- int sad_per_bit,
- int do_init_search,
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost,
- const MV *center_mv,
- MV *best_mv) {
- // First scale has 4-closest points, the rest have 8 points in diamond
- // shape at increasing scales
- static const int bigdia_num_candidates[MAX_PATTERN_SCALES] = {
- 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- };
- // Note that the largest candidate step at each scale is 2^scale
- static const MV bigdia_candidates[MAX_PATTERN_SCALES]
- [MAX_PATTERN_CANDIDATES] = {
- {{0, -1}, {1, 0}, { 0, 1}, {-1, 0}},
- {{-1, -1}, {0, -2}, {1, -1}, {2, 0}, {1, 1}, {0, 2}, {-1, 1}, {-2, 0}},
- {{-2, -2}, {0, -4}, {2, -2}, {4, 0}, {2, 2}, {0, 4}, {-2, 2}, {-4, 0}},
- {{-4, -4}, {0, -8}, {4, -4}, {8, 0}, {4, 4}, {0, 8}, {-4, 4}, {-8, 0}},
- {{-8, -8}, {0, -16}, {8, -8}, {16, 0}, {8, 8}, {0, 16}, {-8, 8}, {-16, 0}},
- {{-16, -16}, {0, -32}, {16, -16}, {32, 0}, {16, 16}, {0, 32},
- {-16, 16}, {-32, 0}},
- {{-32, -32}, {0, -64}, {32, -32}, {64, 0}, {32, 32}, {0, 64},
- {-32, 32}, {-64, 0}},
- {{-64, -64}, {0, -128}, {64, -64}, {128, 0}, {64, 64}, {0, 128},
- {-64, 64}, {-128, 0}},
- {{-128, -128}, {0, -256}, {128, -128}, {256, 0}, {128, 128}, {0, 256},
- {-128, 128}, {-256, 0}},
- {{-256, -256}, {0, -512}, {256, -256}, {512, 0}, {256, 256}, {0, 512},
- {-256, 256}, {-512, 0}},
- {{-512, -512}, {0, -1024}, {512, -512}, {1024, 0}, {512, 512}, {0, 1024},
- {-512, 512}, {-1024, 0}},
- };
- return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit,
- do_init_search, 0, vfp, use_mvcost,
- center_mv, best_mv,
- bigdia_num_candidates, bigdia_candidates);
-}
-
-int vp9_square_search(const MACROBLOCK *x,
- MV *ref_mv,
- int search_param,
- int sad_per_bit,
- int do_init_search,
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost,
- const MV *center_mv,
- MV *best_mv) {
- // All scales have 8 closest points in square shape
- static const int square_num_candidates[MAX_PATTERN_SCALES] = {
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- };
- // Note that the largest candidate step at each scale is 2^scale
- static const MV square_candidates[MAX_PATTERN_SCALES]
- [MAX_PATTERN_CANDIDATES] = {
- {{-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}},
- {{-2, -2}, {0, -2}, {2, -2}, {2, 0}, {2, 2}, {0, 2}, {-2, 2}, {-2, 0}},
- {{-4, -4}, {0, -4}, {4, -4}, {4, 0}, {4, 4}, {0, 4}, {-4, 4}, {-4, 0}},
- {{-8, -8}, {0, -8}, {8, -8}, {8, 0}, {8, 8}, {0, 8}, {-8, 8}, {-8, 0}},
- {{-16, -16}, {0, -16}, {16, -16}, {16, 0}, {16, 16}, {0, 16},
- {-16, 16}, {-16, 0}},
- {{-32, -32}, {0, -32}, {32, -32}, {32, 0}, {32, 32}, {0, 32},
- {-32, 32}, {-32, 0}},
- {{-64, -64}, {0, -64}, {64, -64}, {64, 0}, {64, 64}, {0, 64},
- {-64, 64}, {-64, 0}},
- {{-128, -128}, {0, -128}, {128, -128}, {128, 0}, {128, 128}, {0, 128},
- {-128, 128}, {-128, 0}},
- {{-256, -256}, {0, -256}, {256, -256}, {256, 0}, {256, 256}, {0, 256},
- {-256, 256}, {-256, 0}},
- {{-512, -512}, {0, -512}, {512, -512}, {512, 0}, {512, 512}, {0, 512},
- {-512, 512}, {-512, 0}},
- {{-1024, -1024}, {0, -1024}, {1024, -1024}, {1024, 0}, {1024, 1024},
- {0, 1024}, {-1024, 1024}, {-1024, 0}},
- };
- return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit,
- do_init_search, 0, vfp, use_mvcost,
- center_mv, best_mv,
- square_num_candidates, square_candidates);
-}
-
-int vp9_fast_hex_search(const MACROBLOCK *x,
- MV *ref_mv,
- int search_param,
- int sad_per_bit,
- int do_init_search, // must be zero for fast_hex
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost,
- const MV *center_mv,
- MV *best_mv) {
- return vp9_hex_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param),
- sad_per_bit, do_init_search, vfp, use_mvcost,
- center_mv, best_mv);
-}
-
-int vp9_fast_dia_search(const MACROBLOCK *x,
- MV *ref_mv,
- int search_param,
- int sad_per_bit,
- int do_init_search,
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost,
- const MV *center_mv,
- MV *best_mv) {
- return vp9_bigdia_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param),
- sad_per_bit, do_init_search, vfp, use_mvcost,
- center_mv, best_mv);
-}
-
-#undef CHECK_BETTER
-
-int vp9_full_range_search_c(const MACROBLOCK *x, MV *ref_mv, MV *best_mv,
- int search_param, int sad_per_bit, int *num00,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- const uint8_t *what = x->plane[0].src.buf;
- const int what_stride = x->plane[0].src.stride;
- const uint8_t *in_what;
- const int in_what_stride = xd->plane[0].pre[0].stride;
-
- unsigned int bestsad = INT_MAX;
- int ref_row, ref_col;
-
- unsigned int thissad;
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
-
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- int tr, tc;
- int best_tr = 0;
- int best_tc = 0;
- int range = 64;
-
- int start_col, end_col;
- int start_row, end_row;
- int i;
-
- clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->row;
- ref_col = ref_mv->col;
- *num00 = 11;
- best_mv->row = ref_row;
- best_mv->col = ref_col;
-
- // Work out the start point for the search
- in_what = xd->plane[0].pre[0].buf + ref_row * in_what_stride + ref_col;
-
- // Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- start_row = MAX(-range, x->mv_row_min - ref_row);
- start_col = MAX(-range, x->mv_col_min - ref_col);
- end_row = MIN(range, x->mv_row_max - ref_row);
- end_col = MIN(range, x->mv_col_max - ref_col);
-
- for (tr = start_row; tr <= end_row; ++tr) {
- for (tc = start_col; tc <= end_col; tc += 4) {
- if ((tc + 3) <= end_col) {
- unsigned int sad_array[4];
- unsigned char const *addr_ref[4];
- for (i = 0; i < 4; ++i)
- addr_ref[i] = in_what + tr * in_what_stride + tc + i;
-
- fn_ptr->sdx4df(what, what_stride, addr_ref, in_what_stride, sad_array);
-
- for (i = 0; i < 4; ++i) {
- if (sad_array[i] < bestsad) {
- const MV this_mv = {ref_row + tr, ref_col + tc + i};
- thissad = sad_array[i] +
- mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
- if (thissad < bestsad) {
- bestsad = thissad;
- best_tr = tr;
- best_tc = tc + i;
- }
- }
- }
- } else {
- for (i = 0; i < end_col - tc; ++i) {
- const uint8_t *check_here = in_what + tr * in_what_stride + tc + i;
- thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride,
- bestsad);
-
- if (thissad < bestsad) {
- const MV this_mv = {ref_row + tr, ref_col + tc + i};
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- best_tr = tr;
- best_tc = tc + i;
- }
- }
- }
- }
- }
- }
- best_mv->row += best_tr;
- best_mv->col += best_tc;
- return bestsad;
-}
-
-int vp9_diamond_search_sad_c(const MACROBLOCK *x,
- MV *ref_mv, MV *best_mv,
- int search_param, int sad_per_bit, int *num00,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv) {
- int i, j, step;
-
- const MACROBLOCKD *const xd = &x->e_mbd;
- const uint8_t *what = x->plane[0].src.buf;
- const int what_stride = x->plane[0].src.stride;
- const uint8_t *in_what;
- const int in_what_stride = xd->plane[0].pre[0].stride;
- const uint8_t *best_address;
-
- int bestsad = INT_MAX;
- int best_site = 0;
- int last_site = 0;
-
- int ref_row, ref_col;
-
- // 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 = &x->ss[search_param * x->searches_per_step];
- const int tot_steps = (x->ss_count / x->searches_per_step) - search_param;
-
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
-
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->row;
- ref_col = ref_mv->col;
- *num00 = 0;
- best_mv->row = ref_row;
- best_mv->col = ref_col;
-
- // Work out the start point for the search
- in_what = xd->plane[0].pre[0].buf + ref_row * in_what_stride + ref_col;
- best_address = in_what;
-
- // Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- i = 1;
-
- for (step = 0; step < tot_steps; step++) {
- for (j = 0; j < x->searches_per_step; j++) {
- const MV this_mv = {best_mv->row + ss[i].mv.row,
- best_mv->col + ss[i].mv.col};
- if (is_mv_in(x, &this_mv)) {
- const uint8_t *const check_here = ss[i].offset + best_address;
- int thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride,
- bestsad);
-
- if (thissad < bestsad) {
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- 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, &this_mv)) {
- const uint8_t *const check_here = ss[best_site].offset + best_address;
- int thissad = fn_ptr->sdf(what, what_stride, check_here,
- in_what_stride, bestsad);
- if (thissad < bestsad) {
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
- if (thissad < bestsad) {
- bestsad = thissad;
- 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) {
- (*num00)++;
- }
- }
- return bestsad;
-}
-
-int vp9_diamond_search_sadx4(const MACROBLOCK *x,
- MV *ref_mv, MV *best_mv, int search_param,
- int sad_per_bit, int *num00,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv) {
- int i, j, step;
-
- const MACROBLOCKD *const xd = &x->e_mbd;
- uint8_t *what = x->plane[0].src.buf;
- const int what_stride = x->plane[0].src.stride;
- const uint8_t *in_what;
- const int in_what_stride = xd->plane[0].pre[0].stride;
- const uint8_t *best_address;
-
- unsigned int bestsad = INT_MAX;
- int best_site = 0;
- int last_site = 0;
-
- int ref_row;
- int ref_col;
-
- // 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...
- const search_site *ss = &x->ss[search_param * x->searches_per_step];
- const int tot_steps = (x->ss_count / x->searches_per_step) - search_param;
-
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
-
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->row;
- ref_col = ref_mv->col;
- *num00 = 0;
- best_mv->row = ref_row;
- best_mv->col = ref_col;
-
- // Work out the start point for the search
- in_what = xd->plane[0].pre[0].buf + ref_row * in_what_stride + ref_col;
- best_address = in_what;
-
- // Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- i = 1;
-
- for (step = 0; step < tot_steps; step++) {
- int all_in = 1, t;
-
- // All_in is true if every one of the points we are checking are within
- // the bounds of the image.
- all_in &= ((best_mv->row + ss[i].mv.row) > x->mv_row_min);
- all_in &= ((best_mv->row + ss[i + 1].mv.row) < x->mv_row_max);
- all_in &= ((best_mv->col + ss[i + 2].mv.col) > x->mv_col_min);
- all_in &= ((best_mv->col + ss[i + 3].mv.col) < x->mv_col_max);
-
- // If all the pixels are within the bounds we don't check whether the
- // search point is valid in this loop, otherwise we check each point
- // for validity..
- if (all_in) {
- unsigned int sad_array[4];
-
- for (j = 0; j < x->searches_per_step; j += 4) {
- unsigned char const *block_offset[4];
-
- for (t = 0; t < 4; t++)
- block_offset[t] = ss[i + t].offset + best_address;
-
- fn_ptr->sdx4df(what, what_stride, block_offset, in_what_stride,
- sad_array);
-
- for (t = 0; t < 4; t++, i++) {
- if (sad_array[t] < bestsad) {
- const MV this_mv = {best_mv->row + ss[i].mv.row,
- best_mv->col + ss[i].mv.col};
- sad_array[t] += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (sad_array[t] < bestsad) {
- bestsad = sad_array[t];
- best_site = i;
- }
- }
- }
- }
- } else {
- for (j = 0; j < x->searches_per_step; j++) {
- // Trap illegal vectors
- const MV this_mv = {best_mv->row + ss[i].mv.row,
- best_mv->col + ss[i].mv.col};
-
- if (is_mv_in(x, &this_mv)) {
- const uint8_t *const check_here = ss[i].offset + best_address;
- unsigned int thissad = fn_ptr->sdf(what, what_stride, check_here,
- in_what_stride, bestsad);
-
- if (thissad < bestsad) {
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- 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, &this_mv)) {
- const uint8_t *const check_here = ss[best_site].offset + best_address;
- unsigned int thissad = fn_ptr->sdf(what, what_stride, check_here,
- in_what_stride, bestsad);
- if (thissad < bestsad) {
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
- if (thissad < bestsad) {
- bestsad = thissad;
- 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) {
- (*num00)++;
- }
- }
- return bestsad;
-}
-
-/* do_refine: If last step (1-away) of n-step search doesn't pick the center
- point as the best match, we will do a final 1-away diamond
- refining search */
-
-int vp9_full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x,
- MV *mvp_full, int step_param,
- int sadpb, int further_steps, int do_refine,
- const vp9_variance_fn_ptr_t *fn_ptr,
- const MV *ref_mv, MV *dst_mv) {
- MV temp_mv;
- int thissme, n, num00 = 0;
- int bestsme = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
- step_param, sadpb, &n,
- fn_ptr, x->nmvjointcost,
- x->mvcost, ref_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &temp_mv, ref_mv, fn_ptr, 1);
- *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 = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
- step_param + n, sadpb, &num00,
- fn_ptr, x->nmvjointcost, x->mvcost,
- ref_mv);
- if (thissme < INT_MAX)
- thissme = vp9_get_mvpred_var(x, &temp_mv, ref_mv, fn_ptr, 1);
-
- // 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 = cpi->refining_search_sad(x, &best_mv, sadpb, search_range,
- fn_ptr, x->nmvjointcost, x->mvcost,
- ref_mv);
- if (thissme < INT_MAX)
- thissme = vp9_get_mvpred_var(x, &best_mv, ref_mv, fn_ptr, 1);
- if (thissme < bestsme) {
- bestsme = thissme;
- *dst_mv = best_mv;
- }
- }
- return bestsme;
-}
-
-int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv,
- int sad_per_bit, int distance,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv, MV *best_mv) {
- int r, c;
- 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 int row_min = MAX(ref_mv->row - distance, x->mv_row_min);
- const int row_max = MIN(ref_mv->row + distance, x->mv_row_max);
- const int col_min = MAX(ref_mv->col - distance, x->mv_col_min);
- const int col_max = MIN(ref_mv->col + distance, x->mv_col_max);
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
- int best_sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride, 0x7fffffff) +
- mvsad_err_cost(ref_mv, &fcenter_mv, mvjsadcost, mvsadcost, sad_per_bit);
- *best_mv = *ref_mv;
-
- for (r = row_min; r < row_max; ++r) {
- for (c = col_min; c < col_max; ++c) {
- const MV mv = {r, c};
- const int sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &mv), in_what->stride, best_sad) +
- mvsad_err_cost(&mv, &fcenter_mv, mvjsadcost, mvsadcost,
- sad_per_bit);
-
- if (sad < best_sad) {
- best_sad = sad;
- *best_mv = mv;
- }
- }
- }
- return best_sad;
-}
-
-int vp9_full_search_sadx3(const MACROBLOCK *x, const MV *ref_mv,
- int sad_per_bit, int distance,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv, MV *best_mv) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- const uint8_t *const what = x->plane[0].src.buf;
- const int what_stride = x->plane[0].src.stride;
- const uint8_t *const in_what = xd->plane[0].pre[0].buf;
- const int in_what_stride = xd->plane[0].pre[0].stride;
- MV this_mv;
- unsigned int bestsad = INT_MAX;
- int r, c;
- unsigned int thissad;
- int ref_row = ref_mv->row;
- int ref_col = ref_mv->col;
-
- // Apply further limits to prevent us looking using vectors that stretch
- // beyond the UMV border
- const int row_min = MAX(ref_row - distance, x->mv_row_min);
- const int row_max = MIN(ref_row + distance, x->mv_row_max);
- const int col_min = MAX(ref_col - distance, x->mv_col_min);
- const int col_max = MIN(ref_col + distance, x->mv_col_max);
- unsigned int sad_array[3];
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- // Work out the mid point for the search
- const uint8_t *bestaddress = &in_what[ref_row * in_what_stride + ref_col];
-
- best_mv->row = ref_row;
- best_mv->col = ref_col;
-
- // Baseline value at the centre
- bestsad = fn_ptr->sdf(what, what_stride,
- bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- for (r = row_min; r < row_max; r++) {
- const uint8_t *check_here = &in_what[r * in_what_stride + col_min];
- this_mv.row = r;
- c = col_min;
-
- while ((c + 2) < col_max && fn_ptr->sdx3f != NULL) {
- int i;
-
- fn_ptr->sdx3f(what, what_stride, check_here, in_what_stride, sad_array);
-
- for (i = 0; i < 3; i++) {
- thissad = sad_array[i];
-
- if (thissad < bestsad) {
- this_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- best_mv->row = r;
- best_mv->col = c;
- }
- }
- check_here++;
- c++;
- }
- }
-
- while (c < col_max) {
- thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride,
- bestsad);
-
- if (thissad < bestsad) {
- this_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- best_mv->row = r;
- best_mv->col = c;
- }
- }
-
- check_here++;
- c++;
- }
- }
- return bestsad;
-}
-
-int vp9_full_search_sadx8(const MACROBLOCK *x, const MV *ref_mv,
- int sad_per_bit, int distance,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv, MV *best_mv) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- const uint8_t *const what = x->plane[0].src.buf;
- const int what_stride = x->plane[0].src.stride;
- const uint8_t *const in_what = xd->plane[0].pre[0].buf;
- const int in_what_stride = xd->plane[0].pre[0].stride;
- MV this_mv;
- unsigned int bestsad = INT_MAX;
- int r, c;
- int ref_row = ref_mv->row;
- int ref_col = ref_mv->col;
-
- // Apply further limits to prevent us looking using vectors that stretch
- // beyond the UMV border
- const int row_min = MAX(ref_row - distance, x->mv_row_min);
- const int row_max = MIN(ref_row + distance, x->mv_row_max);
- const int col_min = MAX(ref_col - distance, x->mv_col_min);
- const int col_max = MIN(ref_col + distance, x->mv_col_max);
- DECLARE_ALIGNED_ARRAY(16, uint32_t, sad_array8, 8);
- unsigned int sad_array[3];
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
-
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- // Work out the mid point for the search
- const uint8_t *bestaddress = &in_what[ref_row * in_what_stride + ref_col];
-
- best_mv->row = ref_row;
- best_mv->col = ref_col;
-
- // Baseline value at the center
- bestsad = fn_ptr->sdf(what, what_stride,
- bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- for (r = row_min; r < row_max; r++) {
- const uint8_t *check_here = &in_what[r * in_what_stride + col_min];
- this_mv.row = r;
- c = col_min;
-
- while ((c + 7) < col_max) {
- int i;
-
- fn_ptr->sdx8f(what, what_stride, check_here, in_what_stride, sad_array8);
-
- for (i = 0; i < 8; i++) {
- unsigned int thissad = (unsigned int)sad_array8[i];
-
- if (thissad < bestsad) {
- this_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- best_mv->row = r;
- best_mv->col = c;
- }
- }
-
- check_here++;
- c++;
- }
- }
-
- while ((c + 2) < col_max && fn_ptr->sdx3f != NULL) {
- int i;
-
- fn_ptr->sdx3f(what, what_stride, check_here, in_what_stride, sad_array);
-
- for (i = 0; i < 3; i++) {
- unsigned int thissad = sad_array[i];
-
- if (thissad < bestsad) {
- this_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- best_mv->row = r;
- best_mv->col = c;
- }
- }
-
- check_here++;
- c++;
- }
- }
-
- while (c < col_max) {
- unsigned int thissad = fn_ptr->sdf(what, what_stride,
- check_here, in_what_stride, bestsad);
-
- if (thissad < bestsad) {
- this_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- best_mv->row = r;
- best_mv->col = c;
- }
- }
-
- check_here++;
- c++;
- }
- }
- return bestsad;
-}
-
-int vp9_refining_search_sad_c(const MACROBLOCK *x,
- MV *ref_mv, int error_per_bit,
- int search_range,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv) {
- 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[0];
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- unsigned int best_sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv),
- in_what->stride, 0x7fffffff) +
- mvsad_err_cost(ref_mv, &fcenter_mv, mvjsadcost, mvsadcost, 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)) {
- unsigned int sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &mv), in_what->stride, best_sad);
- if (sad < best_sad) {
- sad += mvsad_err_cost(&mv, &fcenter_mv, mvjsadcost, mvsadcost,
- 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 vp9_refining_search_sadx4(const MACROBLOCK *x,
- MV *ref_mv, int error_per_bit,
- int search_range,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
- int i, j;
-
- const int what_stride = x->plane[0].src.stride;
- const int in_what_stride = xd->plane[0].pre[0].stride;
- const uint8_t *what = x->plane[0].src.buf;
- const uint8_t *best_address = xd->plane[0].pre[0].buf +
- (ref_mv->row * xd->plane[0].pre[0].stride) +
- ref_mv->col;
-
- const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
-
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
-
- unsigned int bestsad = fn_ptr->sdf(what, what_stride, best_address,
- in_what_stride, 0x7fffffff) +
- mvsad_err_cost(ref_mv, &fcenter_mv, mvjsadcost, mvsadcost, error_per_bit);
-
- for (i = 0; i < search_range; i++) {
- int best_site = -1;
- int all_in = ((ref_mv->row - 1) > x->mv_row_min) &
- ((ref_mv->row + 1) < x->mv_row_max) &
- ((ref_mv->col - 1) > x->mv_col_min) &
- ((ref_mv->col + 1) < x->mv_col_max);
-
- if (all_in) {
- unsigned int sad_array[4];
- uint8_t const *block_offset[4] = {
- best_address - in_what_stride,
- best_address - 1,
- best_address + 1,
- best_address + in_what_stride
- };
-
- fn_ptr->sdx4df(what, what_stride, block_offset, in_what_stride,
- sad_array);
-
- for (j = 0; j < 4; j++) {
- if (sad_array[j] < bestsad) {
- const MV this_mv = {ref_mv->row + neighbors[j].row,
- ref_mv->col + neighbors[j].col};
- sad_array[j] += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, error_per_bit);
-
- if (sad_array[j] < bestsad) {
- bestsad = sad_array[j];
- best_site = j;
- }
- }
- }
- } else {
- for (j = 0; j < 4; j++) {
- const MV this_mv = {ref_mv->row + neighbors[j].row,
- ref_mv->col + neighbors[j].col};
-
- if (is_mv_in(x, &this_mv)) {
- const uint8_t *check_here = neighbors[j].row * in_what_stride +
- neighbors[j].col + best_address;
- unsigned int thissad = fn_ptr->sdf(what, what_stride,
- check_here, in_what_stride,
- bestsad);
-
- if (thissad < bestsad) {
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, error_per_bit);
-
- if (thissad < bestsad) {
- bestsad = thissad;
- best_site = j;
- }
- }
- }
- }
- }
-
- if (best_site == -1) {
- break;
- } else {
- ref_mv->row += neighbors[best_site].row;
- ref_mv->col += neighbors[best_site].col;
- best_address += (neighbors[best_site].row) * in_what_stride +
- neighbors[best_site].col;
- }
- }
-
- return bestsad;
-}
-
-// This function is called when we do joint motion search in comp_inter_inter
-// mode.
-int vp9_refining_search_8p_c(const MACROBLOCK *x,
- MV *ref_mv, int error_per_bit,
- int search_range,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv,
- const uint8_t *second_pred, int w, int h) {
- const MV neighbors[8] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0},
- {-1, -1}, {1, -1}, {-1, 1}, {1, 1}};
- 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 fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
- const int *mvjsadcost = x->nmvjointsadcost;
- int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- unsigned int best_sad = fn_ptr->sdaf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride,
- second_pred, 0x7fffffff) +
- mvsad_err_cost(ref_mv, &fcenter_mv, mvjsadcost, mvsadcost, error_per_bit);
- int i, j;
-
- for (i = 0; i < search_range; ++i) {
- int best_site = -1;
-
- for (j = 0; j < 8; ++j) {
- const MV mv = {ref_mv->row + neighbors[j].row,
- ref_mv->col + neighbors[j].col};
-
- if (is_mv_in(x, &mv)) {
- unsigned int sad = fn_ptr->sdaf(what->buf, what->stride,
- get_buf_from_mv(in_what, &mv), in_what->stride,
- second_pred, best_sad);
- if (sad < best_sad) {
- sad += mvsad_err_cost(&mv, &fcenter_mv,
- mvjsadcost, mvsadcost, 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;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.h
deleted file mode 100644
index f7b7c5e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_mcomp.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_MCOMP_H_
-#define VP9_ENCODER_VP9_MCOMP_H_
-
-#include "vp9/encoder/vp9_block.h"
-#include "vp9/encoder/vp9_variance.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// The maximum number of steps in a step search given the largest
-// allowed initial step
-#define MAX_MVSEARCH_STEPS 11
-// Max full pel mv specified in the unit of full pixel
-// Enable the use of motion vector in range [-1023, 1023].
-#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS - 1)) - 1)
-// Maximum size of the first step in full pel units
-#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1))
-// Allowed motion vector pixel distance outside image border
-// for Block_16x16
-#define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND)
-
-
-void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv);
-int vp9_mv_bit_cost(const MV *mv, const MV *ref,
- const int *mvjcost, int *mvcost[2], int weight);
-
-// Utility to compute variance + MV rate cost for a given MV
-int vp9_get_mvpred_var(const MACROBLOCK *x,
- const MV *best_mv, const MV *center_mv,
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost);
-int vp9_get_mvpred_av_var(const MACROBLOCK *x,
- const MV *best_mv, const MV *center_mv,
- const uint8_t *second_pred,
- const vp9_variance_fn_ptr_t *vfp,
- int use_mvcost);
-void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride);
-void vp9_init3smotion_compensation(MACROBLOCK *x, int stride);
-
-struct VP9_COMP;
-int vp9_init_search_range(struct VP9_COMP *cpi, int size);
-
-// Runs sequence of diamond searches in smaller steps for RD
-int vp9_full_pixel_diamond(const struct VP9_COMP *cpi, MACROBLOCK *x,
- MV *mvp_full, int step_param,
- int sadpb, int further_steps, int do_refine,
- const vp9_variance_fn_ptr_t *fn_ptr,
- const MV *ref_mv, MV *dst_mv);
-
-typedef int (integer_mv_pattern_search_fn) (
- const MACROBLOCK *x,
- MV *ref_mv,
- int search_param,
- int error_per_bit,
- int do_init_search,
- const vp9_variance_fn_ptr_t *vf,
- int use_mvcost,
- const MV *center_mv,
- MV *best_mv);
-
-integer_mv_pattern_search_fn vp9_hex_search;
-integer_mv_pattern_search_fn vp9_bigdia_search;
-integer_mv_pattern_search_fn vp9_square_search;
-integer_mv_pattern_search_fn vp9_fast_hex_search;
-integer_mv_pattern_search_fn vp9_fast_dia_search;
-
-typedef int (fractional_mv_step_fp) (
- const MACROBLOCK *x,
- MV *bestmv, const MV *ref_mv,
- int allow_hp,
- int error_per_bit,
- const vp9_variance_fn_ptr_t *vfp,
- int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
- int iters_per_step,
- int *mvjcost,
- int *mvcost[2],
- int *distortion,
- unsigned int *sse);
-
-extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree;
-
-typedef int (fractional_mv_step_comp_fp) (
- const MACROBLOCK *x,
- MV *bestmv, const MV *ref_mv,
- int allow_hp,
- int error_per_bit,
- const vp9_variance_fn_ptr_t *vfp,
- int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
- int iters_per_step,
- int *mvjcost, int *mvcost[2],
- int *distortion, unsigned int *sse1,
- const uint8_t *second_pred,
- int w, int h);
-
-extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_tree;
-
-typedef int (*vp9_full_search_fn_t)(const MACROBLOCK *x,
- const MV *ref_mv, int sad_per_bit,
- int distance,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv, MV *best_mv);
-
-typedef int (*vp9_refining_search_fn_t)(const MACROBLOCK *x,
- MV *ref_mv, int sad_per_bit,
- int distance,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv);
-
-typedef int (*vp9_diamond_search_fn_t)(const MACROBLOCK *x,
- MV *ref_mv, MV *best_mv,
- int search_param, int sad_per_bit,
- int *num00,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv);
-
-int vp9_refining_search_8p_c(const MACROBLOCK *x,
- MV *ref_mv, int error_per_bit,
- int search_range,
- const vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2],
- const MV *center_mv, const uint8_t *second_pred,
- int w, int h);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_MCOMP_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_if.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_if.c
deleted file mode 100644
index 9ecab57..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_if.c
+++ /dev/null
@@ -1,3504 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <limits.h>
-
-#include "./vpx_config.h"
-#include "./vpx_scale_rtcd.h"
-#include "vpx/internal/vpx_psnr.h"
-#include "vpx_ports/vpx_timer.h"
-
-#include "vp9/common/vp9_alloccommon.h"
-#include "vp9/common/vp9_filter.h"
-#include "vp9/common/vp9_idct.h"
-#if CONFIG_VP9_POSTPROC
-#include "vp9/common/vp9_postproc.h"
-#endif
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_systemdependent.h"
-#include "vp9/common/vp9_tile_common.h"
-
-#include "vp9/encoder/vp9_aq_complexity.h"
-#include "vp9/encoder/vp9_aq_cyclicrefresh.h"
-#include "vp9/encoder/vp9_aq_variance.h"
-#include "vp9/encoder/vp9_bitstream.h"
-#include "vp9/encoder/vp9_encodeframe.h"
-#include "vp9/encoder/vp9_encodemv.h"
-#include "vp9/encoder/vp9_firstpass.h"
-#include "vp9/encoder/vp9_mbgraph.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_picklpf.h"
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_segmentation.h"
-#include "vp9/encoder/vp9_speed_features.h"
-#include "vp9/encoder/vp9_temporal_filter.h"
-#include "vp9/encoder/vp9_resize.h"
-#include "vp9/encoder/vp9_svc_layercontext.h"
-
-void vp9_coef_tree_initialize();
-
-#define DEFAULT_INTERP_FILTER SWITCHABLE
-
-#define SHARP_FILTER_QTHRESH 0 /* Q threshold for 8-tap sharp filter */
-
-#define ALTREF_HIGH_PRECISION_MV 1 // Whether to use high precision mv
- // for altref computation.
-#define HIGH_PRECISION_MV_QTHRESH 200 // Q threshold for high precision
- // mv. Choose a very high value for
- // now so that HIGH_PRECISION is always
- // chosen.
-
-// Max rate target for 1080P and below encodes under normal circumstances
-// (1920 * 1080 / (16 * 16)) * MAX_MB_RATE bits per MB
-#define MAX_MB_RATE 250
-#define MAXRATE_1080P 2025000
-
-#if CONFIG_INTERNAL_STATS
-extern double vp9_calc_ssim(YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *dest, int lumamask,
- double *weight);
-
-
-extern double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *dest, double *ssim_y,
- double *ssim_u, double *ssim_v);
-
-
-#endif
-
-// #define OUTPUT_YUV_REC
-
-#ifdef OUTPUT_YUV_SRC
-FILE *yuv_file;
-#endif
-#ifdef OUTPUT_YUV_REC
-FILE *yuv_rec_file;
-#endif
-
-#if 0
-FILE *framepsnr;
-FILE *kf_list;
-FILE *keyfile;
-#endif
-
-void vp9_init_quantizer(VP9_COMP *cpi);
-
-static INLINE void Scale2Ratio(VPX_SCALING mode, int *hr, int *hs) {
- switch (mode) {
- case NORMAL:
- *hr = 1;
- *hs = 1;
- break;
- case FOURFIVE:
- *hr = 4;
- *hs = 5;
- break;
- case THREEFIVE:
- *hr = 3;
- *hs = 5;
- break;
- case ONETWO:
- *hr = 1;
- *hs = 2;
- break;
- default:
- *hr = 1;
- *hs = 1;
- assert(0);
- break;
- }
-}
-
-static void set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv) {
- MACROBLOCK *const mb = &cpi->mb;
- cpi->common.allow_high_precision_mv = allow_high_precision_mv;
- if (cpi->common.allow_high_precision_mv) {
- mb->mvcost = mb->nmvcost_hp;
- mb->mvsadcost = mb->nmvsadcost_hp;
- } else {
- mb->mvcost = mb->nmvcost;
- mb->mvsadcost = mb->nmvsadcost;
- }
-}
-
-static void setup_key_frame(VP9_COMP *cpi) {
- vp9_setup_past_independence(&cpi->common);
-
- // All buffers are implicitly updated on key frames.
- cpi->refresh_golden_frame = 1;
- cpi->refresh_alt_ref_frame = 1;
-}
-
-static void setup_inter_frame(VP9_COMMON *cm) {
- if (cm->error_resilient_mode || cm->intra_only)
- vp9_setup_past_independence(cm);
-
- assert(cm->frame_context_idx < FRAME_CONTEXTS);
- cm->fc = cm->frame_contexts[cm->frame_context_idx];
-}
-
-void vp9_initialize_enc() {
- static int init_done = 0;
-
- if (!init_done) {
- vp9_init_neighbors();
- vp9_init_quant_tables();
-
- vp9_coef_tree_initialize();
- vp9_tokenize_initialize();
- vp9_init_me_luts();
- vp9_rc_init_minq_luts();
- vp9_entropy_mv_init();
- vp9_entropy_mode_init();
- init_done = 1;
- }
-}
-
-static void dealloc_compressor_data(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- int i;
-
- // Delete sementation map
- vpx_free(cpi->segmentation_map);
- cpi->segmentation_map = NULL;
- vpx_free(cm->last_frame_seg_map);
- cm->last_frame_seg_map = NULL;
- vpx_free(cpi->coding_context.last_frame_seg_map_copy);
- cpi->coding_context.last_frame_seg_map_copy = NULL;
-
- vpx_free(cpi->complexity_map);
- cpi->complexity_map = NULL;
-
- vp9_cyclic_refresh_free(cpi->cyclic_refresh);
- cpi->cyclic_refresh = NULL;
-
- vpx_free(cpi->active_map);
- cpi->active_map = NULL;
-
- vp9_free_frame_buffers(cm);
-
- vp9_free_frame_buffer(&cpi->last_frame_uf);
- vp9_free_frame_buffer(&cpi->scaled_source);
- vp9_free_frame_buffer(&cpi->scaled_last_source);
- vp9_free_frame_buffer(&cpi->alt_ref_buffer);
- vp9_lookahead_destroy(cpi->lookahead);
-
- vpx_free(cpi->tok);
- cpi->tok = 0;
-
- // Activity mask based per mb zbin adjustments
- vpx_free(cpi->mb_activity_map);
- cpi->mb_activity_map = 0;
- vpx_free(cpi->mb_norm_activity_map);
- cpi->mb_norm_activity_map = 0;
-
- for (i = 0; i < cpi->svc.number_spatial_layers; ++i) {
- LAYER_CONTEXT *const lc = &cpi->svc.layer_context[i];
- vpx_free(lc->rc_twopass_stats_in.buf);
- lc->rc_twopass_stats_in.buf = NULL;
- lc->rc_twopass_stats_in.sz = 0;
- }
-}
-
-// Computes a q delta (in "q index" terms) to get from a starting q value
-// to a target q value
-int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget) {
- const RATE_CONTROL *const rc = &cpi->rc;
- int start_index = rc->worst_quality;
- int target_index = rc->worst_quality;
- int i;
-
- // Convert the average q value to an index.
- for (i = rc->best_quality; i < rc->worst_quality; ++i) {
- start_index = i;
- if (vp9_convert_qindex_to_q(i) >= qstart)
- break;
- }
-
- // Convert the q target to an index
- for (i = rc->best_quality; i < rc->worst_quality; ++i) {
- target_index = i;
- if (vp9_convert_qindex_to_q(i) >= qtarget)
- break;
- }
-
- return target_index - start_index;
-}
-
-// Computes a q delta (in "q index" terms) to get from a starting q value
-// to a value that should equate to the given rate ratio.
-int vp9_compute_qdelta_by_rate(VP9_COMP *cpi, int qindex,
- double rate_target_ratio) {
- const FRAME_TYPE frame_type = cpi->common.frame_type;
- const RATE_CONTROL *const rc = &cpi->rc;
- int target_index = rc->worst_quality;
- int i;
-
- // Look up the current projected bits per block for the base index
- const int base_bits_per_mb = vp9_rc_bits_per_mb(frame_type, qindex, 1.0);
-
- // Find the target bits per mb based on the base value and given ratio.
- const int target_bits_per_mb = (int)(rate_target_ratio * base_bits_per_mb);
-
- // Convert the q target to an index
- for (i = rc->best_quality; i < rc->worst_quality; ++i) {
- target_index = i;
- if (vp9_rc_bits_per_mb(frame_type, i, 1.0) <= target_bits_per_mb )
- break;
- }
-
- return target_index - qindex;
-}
-
-static void configure_static_seg_features(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- const RATE_CONTROL *const rc = &cpi->rc;
- struct segmentation *const seg = &cm->seg;
-
- int high_q = (int)(rc->avg_q > 48.0);
- int qi_delta;
-
- // Disable and clear down for KF
- if (cm->frame_type == KEY_FRAME) {
- // Clear down the global segmentation map
- vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
- seg->update_map = 0;
- seg->update_data = 0;
- cpi->static_mb_pct = 0;
-
- // Disable segmentation
- vp9_disable_segmentation(seg);
-
- // Clear down the segment features.
- vp9_clearall_segfeatures(seg);
- } else if (cpi->refresh_alt_ref_frame) {
- // If this is an alt ref frame
- // Clear down the global segmentation map
- vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
- seg->update_map = 0;
- seg->update_data = 0;
- cpi->static_mb_pct = 0;
-
- // Disable segmentation and individual segment features by default
- vp9_disable_segmentation(seg);
- vp9_clearall_segfeatures(seg);
-
- // Scan frames from current to arf frame.
- // This function re-enables segmentation if appropriate.
- vp9_update_mbgraph_stats(cpi);
-
- // If segmentation was enabled set those features needed for the
- // arf itself.
- if (seg->enabled) {
- seg->update_map = 1;
- seg->update_data = 1;
-
- qi_delta = vp9_compute_qdelta(cpi, rc->avg_q, rc->avg_q * 0.875);
- vp9_set_segdata(seg, 1, SEG_LVL_ALT_Q, qi_delta - 2);
- vp9_set_segdata(seg, 1, SEG_LVL_ALT_LF, -2);
-
- vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_Q);
- vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_LF);
-
- // Where relevant assume segment data is delta data
- seg->abs_delta = SEGMENT_DELTADATA;
- }
- } else if (seg->enabled) {
- // All other frames if segmentation has been enabled
-
- // First normal frame in a valid gf or alt ref group
- if (rc->frames_since_golden == 0) {
- // Set up segment features for normal frames in an arf group
- if (rc->source_alt_ref_active) {
- seg->update_map = 0;
- seg->update_data = 1;
- seg->abs_delta = SEGMENT_DELTADATA;
-
- qi_delta = vp9_compute_qdelta(cpi, rc->avg_q, rc->avg_q * 1.125);
- vp9_set_segdata(seg, 1, SEG_LVL_ALT_Q, qi_delta + 2);
- vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_Q);
-
- vp9_set_segdata(seg, 1, SEG_LVL_ALT_LF, -2);
- vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_LF);
-
- // Segment coding disabled for compred testing
- if (high_q || (cpi->static_mb_pct == 100)) {
- vp9_set_segdata(seg, 1, SEG_LVL_REF_FRAME, ALTREF_FRAME);
- vp9_enable_segfeature(seg, 1, SEG_LVL_REF_FRAME);
- vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
- }
- } else {
- // Disable segmentation and clear down features if alt ref
- // is not active for this group
-
- vp9_disable_segmentation(seg);
-
- vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
-
- seg->update_map = 0;
- seg->update_data = 0;
-
- vp9_clearall_segfeatures(seg);
- }
- } else if (rc->is_src_frame_alt_ref) {
- // Special case where we are coding over the top of a previous
- // alt ref frame.
- // Segment coding disabled for compred testing
-
- // Enable ref frame features for segment 0 as well
- vp9_enable_segfeature(seg, 0, SEG_LVL_REF_FRAME);
- vp9_enable_segfeature(seg, 1, SEG_LVL_REF_FRAME);
-
- // All mbs should use ALTREF_FRAME
- vp9_clear_segdata(seg, 0, SEG_LVL_REF_FRAME);
- vp9_set_segdata(seg, 0, SEG_LVL_REF_FRAME, ALTREF_FRAME);
- vp9_clear_segdata(seg, 1, SEG_LVL_REF_FRAME);
- vp9_set_segdata(seg, 1, SEG_LVL_REF_FRAME, ALTREF_FRAME);
-
- // Skip all MBs if high Q (0,0 mv and skip coeffs)
- if (high_q) {
- vp9_enable_segfeature(seg, 0, SEG_LVL_SKIP);
- vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
- }
- // Enable data update
- seg->update_data = 1;
- } else {
- // All other frames.
-
- // No updates.. leave things as they are.
- seg->update_map = 0;
- seg->update_data = 0;
- }
- }
-}
-
-// DEBUG: Print out the segment id of each MB in the current frame.
-static void print_seg_map(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
- int row, col;
- int map_index = 0;
- FILE *statsfile = fopen("segmap.stt", "a");
-
- fprintf(statsfile, "%10d\n", cm->current_video_frame);
-
- for (row = 0; row < cpi->common.mi_rows; row++) {
- for (col = 0; col < cpi->common.mi_cols; col++) {
- fprintf(statsfile, "%10d", cpi->segmentation_map[map_index]);
- map_index++;
- }
- fprintf(statsfile, "\n");
- }
- fprintf(statsfile, "\n");
-
- fclose(statsfile);
-}
-
-static void update_reference_segmentation_map(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- MODE_INFO **mi_8x8_ptr = cm->mi_grid_visible;
- uint8_t *cache_ptr = cm->last_frame_seg_map;
- int row, col;
-
- for (row = 0; row < cm->mi_rows; row++) {
- MODE_INFO **mi_8x8 = mi_8x8_ptr;
- uint8_t *cache = cache_ptr;
- for (col = 0; col < cm->mi_cols; col++, mi_8x8++, cache++)
- cache[0] = mi_8x8[0]->mbmi.segment_id;
- mi_8x8_ptr += cm->mi_stride;
- cache_ptr += cm->mi_cols;
- }
-}
-static int is_slowest_mode(int mode) {
- return (mode == MODE_SECONDPASS_BEST || mode == MODE_BESTQUALITY);
-}
-
-static void set_rd_speed_thresholds(VP9_COMP *cpi) {
- int i;
-
- // Set baseline threshold values
- for (i = 0; i < MAX_MODES; ++i)
- cpi->rd_thresh_mult[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
-
- cpi->rd_thresh_mult[THR_NEARESTMV] = 0;
- cpi->rd_thresh_mult[THR_NEARESTG] = 0;
- cpi->rd_thresh_mult[THR_NEARESTA] = 0;
-
- cpi->rd_thresh_mult[THR_DC] += 1000;
-
- cpi->rd_thresh_mult[THR_NEWMV] += 1000;
- cpi->rd_thresh_mult[THR_NEWA] += 1000;
- cpi->rd_thresh_mult[THR_NEWG] += 1000;
-
- cpi->rd_thresh_mult[THR_NEARMV] += 1000;
- cpi->rd_thresh_mult[THR_NEARA] += 1000;
- cpi->rd_thresh_mult[THR_COMP_NEARESTLA] += 1000;
- cpi->rd_thresh_mult[THR_COMP_NEARESTGA] += 1000;
-
- cpi->rd_thresh_mult[THR_TM] += 1000;
-
- cpi->rd_thresh_mult[THR_COMP_NEARLA] += 1500;
- cpi->rd_thresh_mult[THR_COMP_NEWLA] += 2000;
- cpi->rd_thresh_mult[THR_NEARG] += 1000;
- cpi->rd_thresh_mult[THR_COMP_NEARGA] += 1500;
- cpi->rd_thresh_mult[THR_COMP_NEWGA] += 2000;
-
- cpi->rd_thresh_mult[THR_ZEROMV] += 2000;
- cpi->rd_thresh_mult[THR_ZEROG] += 2000;
- cpi->rd_thresh_mult[THR_ZEROA] += 2000;
- cpi->rd_thresh_mult[THR_COMP_ZEROLA] += 2500;
- cpi->rd_thresh_mult[THR_COMP_ZEROGA] += 2500;
-
- cpi->rd_thresh_mult[THR_H_PRED] += 2000;
- cpi->rd_thresh_mult[THR_V_PRED] += 2000;
- cpi->rd_thresh_mult[THR_D45_PRED ] += 2500;
- cpi->rd_thresh_mult[THR_D135_PRED] += 2500;
- cpi->rd_thresh_mult[THR_D117_PRED] += 2500;
- cpi->rd_thresh_mult[THR_D153_PRED] += 2500;
- cpi->rd_thresh_mult[THR_D207_PRED] += 2500;
- cpi->rd_thresh_mult[THR_D63_PRED] += 2500;
-
- /* disable frame modes if flags not set */
- if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) {
- cpi->rd_thresh_mult[THR_NEWMV ] = INT_MAX;
- cpi->rd_thresh_mult[THR_NEARESTMV] = INT_MAX;
- cpi->rd_thresh_mult[THR_ZEROMV ] = INT_MAX;
- cpi->rd_thresh_mult[THR_NEARMV ] = INT_MAX;
- }
- if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG)) {
- cpi->rd_thresh_mult[THR_NEARESTG ] = INT_MAX;
- cpi->rd_thresh_mult[THR_ZEROG ] = INT_MAX;
- cpi->rd_thresh_mult[THR_NEARG ] = INT_MAX;
- cpi->rd_thresh_mult[THR_NEWG ] = INT_MAX;
- }
- if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) {
- cpi->rd_thresh_mult[THR_NEARESTA ] = INT_MAX;
- cpi->rd_thresh_mult[THR_ZEROA ] = INT_MAX;
- cpi->rd_thresh_mult[THR_NEARA ] = INT_MAX;
- cpi->rd_thresh_mult[THR_NEWA ] = INT_MAX;
- }
-
- if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) !=
- (VP9_LAST_FLAG | VP9_ALT_FLAG)) {
- cpi->rd_thresh_mult[THR_COMP_ZEROLA ] = INT_MAX;
- cpi->rd_thresh_mult[THR_COMP_NEARESTLA] = INT_MAX;
- cpi->rd_thresh_mult[THR_COMP_NEARLA ] = INT_MAX;
- cpi->rd_thresh_mult[THR_COMP_NEWLA ] = INT_MAX;
- }
- if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) !=
- (VP9_GOLD_FLAG | VP9_ALT_FLAG)) {
- cpi->rd_thresh_mult[THR_COMP_ZEROGA ] = INT_MAX;
- cpi->rd_thresh_mult[THR_COMP_NEARESTGA] = INT_MAX;
- cpi->rd_thresh_mult[THR_COMP_NEARGA ] = INT_MAX;
- cpi->rd_thresh_mult[THR_COMP_NEWGA ] = INT_MAX;
- }
-}
-
-static void set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) {
- const SPEED_FEATURES *const sf = &cpi->sf;
- int i;
-
- for (i = 0; i < MAX_REFS; ++i)
- cpi->rd_thresh_mult_sub8x8[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
-
- cpi->rd_thresh_mult_sub8x8[THR_LAST] += 2500;
- cpi->rd_thresh_mult_sub8x8[THR_GOLD] += 2500;
- cpi->rd_thresh_mult_sub8x8[THR_ALTR] += 2500;
- cpi->rd_thresh_mult_sub8x8[THR_INTRA] += 2500;
- cpi->rd_thresh_mult_sub8x8[THR_COMP_LA] += 4500;
- cpi->rd_thresh_mult_sub8x8[THR_COMP_GA] += 4500;
-
- // Check for masked out split cases.
- for (i = 0; i < MAX_REFS; i++)
- if (sf->disable_split_mask & (1 << i))
- cpi->rd_thresh_mult_sub8x8[i] = INT_MAX;
-
- // disable mode test if frame flag is not set
- if (!(cpi->ref_frame_flags & VP9_LAST_FLAG))
- cpi->rd_thresh_mult_sub8x8[THR_LAST] = INT_MAX;
- if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG))
- cpi->rd_thresh_mult_sub8x8[THR_GOLD] = INT_MAX;
- if (!(cpi->ref_frame_flags & VP9_ALT_FLAG))
- cpi->rd_thresh_mult_sub8x8[THR_ALTR] = INT_MAX;
- if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) !=
- (VP9_LAST_FLAG | VP9_ALT_FLAG))
- cpi->rd_thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX;
- if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) !=
- (VP9_GOLD_FLAG | VP9_ALT_FLAG))
- cpi->rd_thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX;
-}
-
-static void set_speed_features(VP9_COMP *cpi) {
-#if CONFIG_INTERNAL_STATS
- int i;
- for (i = 0; i < MAX_MODES; ++i)
- cpi->mode_chosen_counts[i] = 0;
-#endif
-
- vp9_set_speed_features(cpi);
-
- // Set rd thresholds based on mode and speed setting
- set_rd_speed_thresholds(cpi);
- set_rd_speed_thresholds_sub8x8(cpi);
-
- cpi->mb.fwd_txm4x4 = vp9_fdct4x4;
- if (cpi->oxcf.lossless || cpi->mb.e_mbd.lossless) {
- cpi->mb.fwd_txm4x4 = vp9_fwht4x4;
- }
-}
-
-static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
- const VP9_CONFIG *oxcf = &cpi->oxcf;
-
- cpi->lookahead = vp9_lookahead_init(oxcf->width, oxcf->height,
- cm->subsampling_x, cm->subsampling_y,
- oxcf->lag_in_frames);
- if (!cpi->lookahead)
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate lag buffers");
-
- if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer,
- oxcf->width, oxcf->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate altref buffer");
-}
-
-void vp9_alloc_compressor_data(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
-
- if (vp9_alloc_frame_buffers(cm, cm->width, cm->height))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate frame buffers");
-
- if (vp9_alloc_frame_buffer(&cpi->last_frame_uf,
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate last frame buffer");
-
- if (vp9_alloc_frame_buffer(&cpi->scaled_source,
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate scaled source buffer");
-
- if (vp9_alloc_frame_buffer(&cpi->scaled_last_source,
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate scaled last source buffer");
-
- vpx_free(cpi->tok);
-
- {
- unsigned int tokens = get_token_alloc(cm->mb_rows, cm->mb_cols);
-
- CHECK_MEM_ERROR(cm, cpi->tok, vpx_calloc(tokens, sizeof(*cpi->tok)));
- }
-
- vpx_free(cpi->mb_activity_map);
- CHECK_MEM_ERROR(cm, cpi->mb_activity_map,
- vpx_calloc(sizeof(unsigned int),
- cm->mb_rows * cm->mb_cols));
-
- vpx_free(cpi->mb_norm_activity_map);
- CHECK_MEM_ERROR(cm, cpi->mb_norm_activity_map,
- vpx_calloc(sizeof(unsigned int),
- cm->mb_rows * cm->mb_cols));
-}
-
-
-static void update_frame_size(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
-
- vp9_update_frame_size(cm);
-
- // Update size of buffers local to this frame
- if (vp9_realloc_frame_buffer(&cpi->last_frame_uf,
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to reallocate last frame buffer");
-
- if (vp9_realloc_frame_buffer(&cpi->scaled_source,
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to reallocate scaled source buffer");
-
- if (vp9_realloc_frame_buffer(&cpi->scaled_last_source,
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to reallocate scaled last source buffer");
-
- {
- int y_stride = cpi->scaled_source.y_stride;
-
- if (cpi->sf.search_method == NSTEP) {
- vp9_init3smotion_compensation(&cpi->mb, y_stride);
- } else if (cpi->sf.search_method == DIAMOND) {
- vp9_init_dsmotion_compensation(&cpi->mb, y_stride);
- }
- }
-
- init_macroblockd(cm, xd);
-}
-
-// Table that converts 0-63 Q range values passed in outside to the Qindex
-// range used internally.
-const int q_trans[] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 44, 48, 52, 56, 60,
- 64, 68, 72, 76, 80, 84, 88, 92,
- 96, 100, 104, 108, 112, 116, 120, 124,
- 128, 132, 136, 140, 144, 148, 152, 156,
- 160, 164, 168, 172, 176, 180, 184, 188,
- 192, 196, 200, 204, 208, 212, 216, 220,
- 224, 228, 232, 236, 240, 244, 249, 255,
-};
-
-int vp9_reverse_trans(int x) {
- int i;
-
- for (i = 0; i < 64; i++)
- if (q_trans[i] >= x)
- return i;
-
- return 63;
-};
-
-void vp9_new_framerate(VP9_COMP *cpi, double framerate) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- VP9_CONFIG *const oxcf = &cpi->oxcf;
- int vbr_max_bits;
-
- oxcf->framerate = framerate < 0.1 ? 30 : framerate;
- cpi->output_framerate = cpi->oxcf.framerate;
- rc->av_per_frame_bandwidth = (int)(oxcf->target_bandwidth /
- cpi->output_framerate);
- rc->min_frame_bandwidth = (int)(rc->av_per_frame_bandwidth *
- oxcf->two_pass_vbrmin_section / 100);
-
- rc->min_frame_bandwidth = MAX(rc->min_frame_bandwidth, FRAME_OVERHEAD_BITS);
-
- // A maximum bitrate for a frame is defined.
- // The baseline for this aligns with HW implementations that
- // can support decode of 1080P content up to a bitrate of MAX_MB_RATE bits
- // per 16x16 MB (averaged over a frame). However this limit is extended if
- // a very high rate is given on the command line or the the rate cannnot
- // be acheived because of a user specificed max q (e.g. when the user
- // specifies lossless encode.
- //
- vbr_max_bits = (int)(((int64_t)rc->av_per_frame_bandwidth *
- oxcf->two_pass_vbrmax_section) / 100);
- rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P),
- vbr_max_bits);
-
- // Set Maximum gf/arf interval
- rc->max_gf_interval = 16;
-
- // Extended interval for genuinely static scenes
- rc->static_scene_max_gf_interval = cpi->key_frame_frequency >> 1;
-
- // Special conditions when alt ref frame enabled in lagged compress mode
- if (oxcf->play_alternate && oxcf->lag_in_frames) {
- if (rc->max_gf_interval > oxcf->lag_in_frames - 1)
- rc->max_gf_interval = oxcf->lag_in_frames - 1;
-
- if (rc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
- rc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
- }
-
- if (rc->max_gf_interval > rc->static_scene_max_gf_interval)
- rc->max_gf_interval = rc->static_scene_max_gf_interval;
-}
-
-int64_t vp9_rescale(int64_t val, int64_t num, int denom) {
- int64_t llnum = num;
- int64_t llden = denom;
- int64_t llval = val;
-
- return (llval * llnum / llden);
-}
-
-static void set_tile_limits(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
-
- int min_log2_tile_cols, max_log2_tile_cols;
- vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
-
- cm->log2_tile_cols = clamp(cpi->oxcf.tile_columns,
- min_log2_tile_cols, max_log2_tile_cols);
- cm->log2_tile_rows = cpi->oxcf.tile_rows;
-}
-
-static void init_rate_control(const VP9_CONFIG *oxcf, int pass,
- RATE_CONTROL *rc) {
- if (pass == 0 && oxcf->end_usage == USAGE_STREAM_FROM_SERVER) {
- rc->avg_frame_qindex[0] = oxcf->worst_allowed_q;
- rc->avg_frame_qindex[1] = oxcf->worst_allowed_q;
- rc->avg_frame_qindex[2] = oxcf->worst_allowed_q;
- } else {
- rc->avg_frame_qindex[0] = (oxcf->worst_allowed_q +
- oxcf->best_allowed_q) / 2;
- rc->avg_frame_qindex[1] = (oxcf->worst_allowed_q +
- oxcf->best_allowed_q) / 2;
- rc->avg_frame_qindex[2] = (oxcf->worst_allowed_q +
- oxcf->best_allowed_q) / 2;
- }
-
- rc->last_q[0] = oxcf->best_allowed_q;
- rc->last_q[1] = oxcf->best_allowed_q;
- rc->last_q[2] = oxcf->best_allowed_q;
-
- rc->buffer_level = oxcf->starting_buffer_level;
- rc->bits_off_target = oxcf->starting_buffer_level;
-
- rc->rolling_target_bits = rc->av_per_frame_bandwidth;
- rc->rolling_actual_bits = rc->av_per_frame_bandwidth;
- rc->long_rolling_target_bits = rc->av_per_frame_bandwidth;
- rc->long_rolling_actual_bits = rc->av_per_frame_bandwidth;
-
- rc->total_actual_bits = 0;
- rc->total_target_vs_actual = 0;
-}
-
-static void init_config(struct VP9_COMP *cpi, VP9_CONFIG *oxcf) {
- VP9_COMMON *const cm = &cpi->common;
- int i;
-
- cpi->oxcf = *oxcf;
-
- cm->version = oxcf->version;
-
- cm->width = oxcf->width;
- cm->height = oxcf->height;
- cm->subsampling_x = 0;
- cm->subsampling_y = 0;
- vp9_alloc_compressor_data(cpi);
-
- // Spatial scalability.
- cpi->svc.number_spatial_layers = oxcf->ss_number_layers;
- // Temporal scalability.
- cpi->svc.number_temporal_layers = oxcf->ts_number_layers;
-
- if ((cpi->svc.number_temporal_layers > 1 &&
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ||
- (cpi->svc.number_spatial_layers > 1 &&
- cpi->oxcf.mode == MODE_SECONDPASS_BEST)) {
- vp9_init_layer_context(cpi);
- }
-
- // change includes all joint functionality
- vp9_change_config(cpi, oxcf);
-
- cpi->static_mb_pct = 0;
-
- cpi->lst_fb_idx = 0;
- cpi->gld_fb_idx = 1;
- cpi->alt_fb_idx = 2;
-
- set_tile_limits(cpi);
-
- cpi->fixed_divide[0] = 0;
- for (i = 1; i < 512; i++)
- cpi->fixed_divide[i] = 0x80000 / i;
-}
-
-void vp9_change_config(struct VP9_COMP *cpi, const VP9_CONFIG *oxcf) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
-
- if (cm->version != oxcf->version)
- cm->version = oxcf->version;
-
- cpi->oxcf = *oxcf;
-
- if (cpi->oxcf.cpu_used == -6)
- cpi->oxcf.play_alternate = 0;
-
- switch (cpi->oxcf.mode) {
- // Real time and one pass deprecated in test code base
- case MODE_GOODQUALITY:
- cpi->pass = 0;
- cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
- break;
-
- case MODE_BESTQUALITY:
- cpi->pass = 0;
- break;
-
- case MODE_FIRSTPASS:
- cpi->pass = 1;
- break;
-
- case MODE_SECONDPASS:
- cpi->pass = 2;
- cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
- break;
-
- case MODE_SECONDPASS_BEST:
- cpi->pass = 2;
- break;
-
- case MODE_REALTIME:
- cpi->pass = 0;
- break;
- }
-
- cpi->oxcf.worst_allowed_q = q_trans[oxcf->worst_allowed_q];
- cpi->oxcf.best_allowed_q = q_trans[oxcf->best_allowed_q];
- cpi->oxcf.cq_level = q_trans[cpi->oxcf.cq_level];
-
- cpi->oxcf.lossless = oxcf->lossless;
- if (cpi->oxcf.lossless) {
- // In lossless mode, make sure right quantizer range and correct transform
- // is set.
- cpi->oxcf.worst_allowed_q = 0;
- cpi->oxcf.best_allowed_q = 0;
- cpi->mb.e_mbd.itxm_add = vp9_iwht4x4_add;
- } else {
- cpi->mb.e_mbd.itxm_add = vp9_idct4x4_add;
- }
- rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
- cpi->ref_frame_flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
-
- cpi->refresh_golden_frame = 0;
- cpi->refresh_last_frame = 1;
- cm->refresh_frame_context = 1;
- cm->reset_frame_context = 0;
-
- vp9_reset_segment_features(&cm->seg);
- set_high_precision_mv(cpi, 0);
-
- {
- int i;
-
- for (i = 0; i < MAX_SEGMENTS; i++)
- cpi->segment_encode_breakout[i] = cpi->oxcf.encode_breakout;
- }
- cpi->encode_breakout = cpi->oxcf.encode_breakout;
-
- // local file playback mode == really big buffer
- if (cpi->oxcf.end_usage == USAGE_LOCAL_FILE_PLAYBACK) {
- cpi->oxcf.starting_buffer_level = 60000;
- cpi->oxcf.optimal_buffer_level = 60000;
- cpi->oxcf.maximum_buffer_size = 240000;
- }
-
- // Convert target bandwidth from Kbit/s to Bit/s
- cpi->oxcf.target_bandwidth *= 1000;
-
- cpi->oxcf.starting_buffer_level =
- vp9_rescale(cpi->oxcf.starting_buffer_level,
- cpi->oxcf.target_bandwidth, 1000);
-
- // Set or reset optimal and maximum buffer levels.
- if (cpi->oxcf.optimal_buffer_level == 0)
- cpi->oxcf.optimal_buffer_level = cpi->oxcf.target_bandwidth / 8;
- else
- cpi->oxcf.optimal_buffer_level =
- vp9_rescale(cpi->oxcf.optimal_buffer_level,
- cpi->oxcf.target_bandwidth, 1000);
-
- if (cpi->oxcf.maximum_buffer_size == 0)
- cpi->oxcf.maximum_buffer_size = cpi->oxcf.target_bandwidth / 8;
- else
- cpi->oxcf.maximum_buffer_size =
- vp9_rescale(cpi->oxcf.maximum_buffer_size,
- cpi->oxcf.target_bandwidth, 1000);
- // Under a configuration change, where maximum_buffer_size may change,
- // keep buffer level clipped to the maximum allowed buffer size.
- rc->bits_off_target = MIN(rc->bits_off_target, cpi->oxcf.maximum_buffer_size);
- rc->buffer_level = MIN(rc->buffer_level, cpi->oxcf.maximum_buffer_size);
-
- // Set up frame rate and related parameters rate control values.
- vp9_new_framerate(cpi, cpi->oxcf.framerate);
-
- // Set absolute upper and lower quality limits
- rc->worst_quality = cpi->oxcf.worst_allowed_q;
- rc->best_quality = cpi->oxcf.best_allowed_q;
-
- // active values should only be modified if out of new range
-
- cpi->cq_target_quality = cpi->oxcf.cq_level;
-
- cm->interp_filter = DEFAULT_INTERP_FILTER;
-
- cm->display_width = cpi->oxcf.width;
- cm->display_height = cpi->oxcf.height;
-
- // VP8 sharpness level mapping 0-7 (vs 0-10 in general VPx dialogs)
- cpi->oxcf.sharpness = MIN(7, cpi->oxcf.sharpness);
-
- cpi->common.lf.sharpness_level = cpi->oxcf.sharpness;
-
- if (cpi->initial_width) {
- // Increasing the size of the frame beyond the first seen frame, or some
- // otherwise signaled maximum size, is not supported.
- // TODO(jkoleszar): exit gracefully.
- assert(cm->width <= cpi->initial_width);
- assert(cm->height <= cpi->initial_height);
- }
- update_frame_size(cpi);
-
- if ((cpi->svc.number_temporal_layers > 1 &&
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ||
- (cpi->svc.number_spatial_layers > 1 && cpi->pass == 2)) {
- vp9_update_layer_context_change_config(cpi,
- (int)cpi->oxcf.target_bandwidth);
- }
-
- cpi->speed = abs(cpi->oxcf.cpu_used);
-
- // Limit on lag buffers as these are not currently dynamically allocated.
- if (cpi->oxcf.lag_in_frames > MAX_LAG_BUFFERS)
- cpi->oxcf.lag_in_frames = MAX_LAG_BUFFERS;
-
-#if CONFIG_MULTIPLE_ARF
- vp9_zero(cpi->alt_ref_source);
-#else
- cpi->alt_ref_source = NULL;
-#endif
- rc->is_src_frame_alt_ref = 0;
-
-#if 0
- // Experimental RD Code
- cpi->frame_distortion = 0;
- cpi->last_frame_distortion = 0;
-#endif
-
- set_tile_limits(cpi);
-
- cpi->ext_refresh_frame_flags_pending = 0;
- cpi->ext_refresh_frame_context_pending = 0;
-}
-
-#define M_LOG2_E 0.693147180559945309417
-#define log2f(x) (log (x) / (float) M_LOG2_E)
-
-static void cal_nmvjointsadcost(int *mvjointsadcost) {
- mvjointsadcost[0] = 600;
- mvjointsadcost[1] = 300;
- mvjointsadcost[2] = 300;
- mvjointsadcost[3] = 300;
-}
-
-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 void alloc_mode_context(VP9_COMMON *cm, int num_4x4_blk,
- PICK_MODE_CONTEXT *ctx) {
- int num_pix = num_4x4_blk << 4;
- int i, k;
- ctx->num_4x4_blk = num_4x4_blk;
-
- CHECK_MEM_ERROR(cm, ctx->zcoeff_blk,
- vpx_calloc(num_4x4_blk, sizeof(uint8_t)));
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- for (k = 0; k < 3; ++k) {
- CHECK_MEM_ERROR(cm, ctx->coeff[i][k],
- vpx_memalign(16, num_pix * sizeof(int16_t)));
- CHECK_MEM_ERROR(cm, ctx->qcoeff[i][k],
- vpx_memalign(16, num_pix * sizeof(int16_t)));
- CHECK_MEM_ERROR(cm, ctx->dqcoeff[i][k],
- vpx_memalign(16, num_pix * sizeof(int16_t)));
- CHECK_MEM_ERROR(cm, ctx->eobs[i][k],
- vpx_memalign(16, num_pix * sizeof(uint16_t)));
- ctx->coeff_pbuf[i][k] = ctx->coeff[i][k];
- ctx->qcoeff_pbuf[i][k] = ctx->qcoeff[i][k];
- ctx->dqcoeff_pbuf[i][k] = ctx->dqcoeff[i][k];
- ctx->eobs_pbuf[i][k] = ctx->eobs[i][k];
- }
- }
-}
-
-static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
- int i, k;
- vpx_free(ctx->zcoeff_blk);
- ctx->zcoeff_blk = 0;
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- for (k = 0; k < 3; ++k) {
- vpx_free(ctx->coeff[i][k]);
- ctx->coeff[i][k] = 0;
- vpx_free(ctx->qcoeff[i][k]);
- ctx->qcoeff[i][k] = 0;
- vpx_free(ctx->dqcoeff[i][k]);
- ctx->dqcoeff[i][k] = 0;
- vpx_free(ctx->eobs[i][k]);
- ctx->eobs[i][k] = 0;
- }
- }
-}
-
-static void init_pick_mode_context(VP9_COMP *cpi) {
- int i;
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
-
- for (i = 0; i < BLOCK_SIZES; ++i) {
- const int num_4x4_w = num_4x4_blocks_wide_lookup[i];
- const int num_4x4_h = num_4x4_blocks_high_lookup[i];
- const int num_4x4_blk = MAX(4, num_4x4_w * num_4x4_h);
- if (i < BLOCK_16X16) {
- for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) {
- for (x->mb_index = 0; x->mb_index < 4; ++x->mb_index) {
- for (x->b_index = 0; x->b_index < 16 / num_4x4_blk; ++x->b_index) {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- alloc_mode_context(cm, num_4x4_blk, ctx);
- }
- }
- }
- } else if (i < BLOCK_32X32) {
- for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) {
- for (x->mb_index = 0; x->mb_index < 64 / num_4x4_blk; ++x->mb_index) {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- ctx->num_4x4_blk = num_4x4_blk;
- alloc_mode_context(cm, num_4x4_blk, ctx);
- }
- }
- } else if (i < BLOCK_64X64) {
- for (x->sb_index = 0; x->sb_index < 256 / num_4x4_blk; ++x->sb_index) {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- ctx->num_4x4_blk = num_4x4_blk;
- alloc_mode_context(cm, num_4x4_blk, ctx);
- }
- } else {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- ctx->num_4x4_blk = num_4x4_blk;
- alloc_mode_context(cm, num_4x4_blk, ctx);
- }
- }
-}
-
-static void free_pick_mode_context(MACROBLOCK *x) {
- int i;
-
- for (i = 0; i < BLOCK_SIZES; ++i) {
- const int num_4x4_w = num_4x4_blocks_wide_lookup[i];
- const int num_4x4_h = num_4x4_blocks_high_lookup[i];
- const int num_4x4_blk = MAX(4, num_4x4_w * num_4x4_h);
- if (i < BLOCK_16X16) {
- for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) {
- for (x->mb_index = 0; x->mb_index < 4; ++x->mb_index) {
- for (x->b_index = 0; x->b_index < 16 / num_4x4_blk; ++x->b_index) {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- free_mode_context(ctx);
- }
- }
- }
- } else if (i < BLOCK_32X32) {
- for (x->sb_index = 0; x->sb_index < 4; ++x->sb_index) {
- for (x->mb_index = 0; x->mb_index < 64 / num_4x4_blk; ++x->mb_index) {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- free_mode_context(ctx);
- }
- }
- } else if (i < BLOCK_64X64) {
- for (x->sb_index = 0; x->sb_index < 256 / num_4x4_blk; ++x->sb_index) {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- free_mode_context(ctx);
- }
- } else {
- PICK_MODE_CONTEXT *ctx = get_block_context(x, i);
- free_mode_context(ctx);
- }
- }
-}
-
-VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf) {
- int i, j;
- VP9_COMP *const cpi = vpx_memalign(32, sizeof(VP9_COMP));
- VP9_COMMON *const cm = cpi != NULL ? &cpi->common : NULL;
- RATE_CONTROL *const rc = cpi != NULL ? &cpi->rc : NULL;
-
- if (!cm)
- return NULL;
-
- vp9_zero(*cpi);
-
- if (setjmp(cm->error.jmp)) {
- cm->error.setjmp = 0;
- vp9_remove_compressor(cpi);
- return 0;
- }
-
- cm->error.setjmp = 1;
-
- CHECK_MEM_ERROR(cm, cpi->mb.ss, vpx_calloc(sizeof(search_site),
- (MAX_MVSEARCH_STEPS * 8) + 1));
-
- vp9_rtcd();
-
- cpi->use_svc = 0;
-
- init_config(cpi, oxcf);
- init_rate_control(&cpi->oxcf, cpi->pass, &cpi->rc);
- init_pick_mode_context(cpi);
-
- cm->current_video_frame = 0;
-
- // Set reference frame sign bias for ALTREF frame to 1 (for now)
- cm->ref_frame_sign_bias[ALTREF_FRAME] = 1;
-
- rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
-
- cpi->gold_is_last = 0;
- cpi->alt_is_last = 0;
- cpi->gold_is_alt = 0;
-
- // Create the encoder segmentation map and set all entries to 0
- CHECK_MEM_ERROR(cm, cpi->segmentation_map,
- vpx_calloc(cm->mi_rows * cm->mi_cols, 1));
-
- // Create a complexity map used for rd adjustment
- CHECK_MEM_ERROR(cm, cpi->complexity_map,
- vpx_calloc(cm->mi_rows * cm->mi_cols, 1));
-
- // Create a map used for cyclic background refresh.
- CHECK_MEM_ERROR(cm, cpi->cyclic_refresh,
- vp9_cyclic_refresh_alloc(cm->mi_rows, cm->mi_cols));
-
- // And a place holder structure is the coding context
- // for use if we want to save and restore it
- CHECK_MEM_ERROR(cm, cpi->coding_context.last_frame_seg_map_copy,
- vpx_calloc(cm->mi_rows * cm->mi_cols, 1));
-
- CHECK_MEM_ERROR(cm, cpi->active_map, vpx_calloc(cm->MBs, 1));
- vpx_memset(cpi->active_map, 1, cm->MBs);
- cpi->active_map_enabled = 0;
-
- for (i = 0; i < (sizeof(cpi->mbgraph_stats) /
- sizeof(cpi->mbgraph_stats[0])); i++) {
- CHECK_MEM_ERROR(cm, cpi->mbgraph_stats[i].mb_stats,
- vpx_calloc(cm->MBs *
- sizeof(*cpi->mbgraph_stats[i].mb_stats), 1));
- }
-
- /*Initialize the feed-forward activity masking.*/
- cpi->activity_avg = 90 << 12;
- cpi->key_frame_frequency = cpi->oxcf.key_freq;
-
- rc->frames_since_key = 8; // Sensible default for first frame.
- rc->this_key_frame_forced = 0;
- rc->next_key_frame_forced = 0;
-
- rc->source_alt_ref_pending = 0;
- rc->source_alt_ref_active = 0;
- cpi->refresh_alt_ref_frame = 0;
-
-#if CONFIG_MULTIPLE_ARF
- // Turn multiple ARF usage on/off. This is a quick hack for the initial test
- // version. It should eventually be set via the codec API.
- cpi->multi_arf_enabled = 1;
-
- if (cpi->multi_arf_enabled) {
- cpi->sequence_number = 0;
- cpi->frame_coding_order_period = 0;
- vp9_zero(cpi->frame_coding_order);
- vp9_zero(cpi->arf_buffer_idx);
- }
-#endif
-
- cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
-#if CONFIG_INTERNAL_STATS
- cpi->b_calculate_ssimg = 0;
-
- cpi->count = 0;
- cpi->bytes = 0;
-
- if (cpi->b_calculate_psnr) {
- cpi->total_y = 0.0;
- cpi->total_u = 0.0;
- cpi->total_v = 0.0;
- cpi->total = 0.0;
- cpi->total_sq_error = 0;
- cpi->total_samples = 0;
-
- cpi->totalp_y = 0.0;
- cpi->totalp_u = 0.0;
- cpi->totalp_v = 0.0;
- cpi->totalp = 0.0;
- cpi->totalp_sq_error = 0;
- cpi->totalp_samples = 0;
-
- cpi->tot_recode_hits = 0;
- cpi->summed_quality = 0;
- cpi->summed_weights = 0;
- cpi->summedp_quality = 0;
- cpi->summedp_weights = 0;
- }
-
- if (cpi->b_calculate_ssimg) {
- cpi->total_ssimg_y = 0;
- cpi->total_ssimg_u = 0;
- cpi->total_ssimg_v = 0;
- cpi->total_ssimg_all = 0;
- }
-
-#endif
-
- cpi->first_time_stamp_ever = INT64_MAX;
-
- rc->frames_till_gf_update_due = 0;
-
- rc->ni_av_qi = cpi->oxcf.worst_allowed_q;
- rc->ni_tot_qi = 0;
- rc->ni_frames = 0;
- rc->tot_q = 0.0;
- rc->avg_q = vp9_convert_qindex_to_q(cpi->oxcf.worst_allowed_q);
-
- rc->rate_correction_factor = 1.0;
- rc->key_frame_rate_correction_factor = 1.0;
- rc->gf_rate_correction_factor = 1.0;
-
- cal_nmvjointsadcost(cpi->mb.nmvjointsadcost);
- cpi->mb.nmvcost[0] = &cpi->mb.nmvcosts[0][MV_MAX];
- cpi->mb.nmvcost[1] = &cpi->mb.nmvcosts[1][MV_MAX];
- cpi->mb.nmvsadcost[0] = &cpi->mb.nmvsadcosts[0][MV_MAX];
- cpi->mb.nmvsadcost[1] = &cpi->mb.nmvsadcosts[1][MV_MAX];
- cal_nmvsadcosts(cpi->mb.nmvsadcost);
-
- cpi->mb.nmvcost_hp[0] = &cpi->mb.nmvcosts_hp[0][MV_MAX];
- cpi->mb.nmvcost_hp[1] = &cpi->mb.nmvcosts_hp[1][MV_MAX];
- cpi->mb.nmvsadcost_hp[0] = &cpi->mb.nmvsadcosts_hp[0][MV_MAX];
- cpi->mb.nmvsadcost_hp[1] = &cpi->mb.nmvsadcosts_hp[1][MV_MAX];
- cal_nmvsadcosts_hp(cpi->mb.nmvsadcost_hp);
-
-#ifdef OUTPUT_YUV_SRC
- yuv_file = fopen("bd.yuv", "ab");
-#endif
-#ifdef OUTPUT_YUV_REC
- yuv_rec_file = fopen("rec.yuv", "wb");
-#endif
-
-#if 0
- framepsnr = fopen("framepsnr.stt", "a");
- kf_list = fopen("kf_list.stt", "w");
-#endif
-
- cpi->output_pkt_list = oxcf->output_pkt_list;
-
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
-
- if (cpi->pass == 1) {
- vp9_init_first_pass(cpi);
- } else if (cpi->pass == 2) {
- const size_t packet_sz = sizeof(FIRSTPASS_STATS);
- const int packets = (int)(oxcf->two_pass_stats_in.sz / packet_sz);
-
- if (cpi->svc.number_spatial_layers > 1
- && cpi->svc.number_temporal_layers == 1) {
- FIRSTPASS_STATS *const stats = oxcf->two_pass_stats_in.buf;
- FIRSTPASS_STATS *stats_copy[VPX_SS_MAX_LAYERS] = {0};
- int i;
-
- for (i = 0; i < oxcf->ss_number_layers; ++i) {
- FIRSTPASS_STATS *const last_packet_for_layer =
- &stats[packets - oxcf->ss_number_layers + i];
- const int layer_id = (int)last_packet_for_layer->spatial_layer_id;
- const int packets_in_layer = (int)last_packet_for_layer->count + 1;
- if (layer_id >= 0 && layer_id < oxcf->ss_number_layers) {
- LAYER_CONTEXT *const lc = &cpi->svc.layer_context[layer_id];
-
- vpx_free(lc->rc_twopass_stats_in.buf);
-
- lc->rc_twopass_stats_in.sz = packets_in_layer * packet_sz;
- CHECK_MEM_ERROR(cm, lc->rc_twopass_stats_in.buf,
- vpx_malloc(lc->rc_twopass_stats_in.sz));
- lc->twopass.stats_in_start = lc->rc_twopass_stats_in.buf;
- lc->twopass.stats_in = lc->twopass.stats_in_start;
- lc->twopass.stats_in_end = lc->twopass.stats_in_start
- + packets_in_layer - 1;
- stats_copy[layer_id] = lc->rc_twopass_stats_in.buf;
- }
- }
-
- for (i = 0; i < packets; ++i) {
- const int layer_id = (int)stats[i].spatial_layer_id;
- if (layer_id >= 0 && layer_id < oxcf->ss_number_layers
- && stats_copy[layer_id] != NULL) {
- *stats_copy[layer_id] = stats[i];
- ++stats_copy[layer_id];
- }
- }
-
- vp9_init_second_pass_spatial_svc(cpi);
- } else {
- cpi->twopass.stats_in_start = oxcf->two_pass_stats_in.buf;
- cpi->twopass.stats_in = cpi->twopass.stats_in_start;
- cpi->twopass.stats_in_end = &cpi->twopass.stats_in[packets - 1];
-
- vp9_init_second_pass(cpi);
- }
- }
-
- set_speed_features(cpi);
-
- // Default rd threshold factors for mode selection
- for (i = 0; i < BLOCK_SIZES; ++i) {
- for (j = 0; j < MAX_MODES; ++j)
- cpi->rd_thresh_freq_fact[i][j] = 32;
- for (j = 0; j < MAX_REFS; ++j)
- cpi->rd_thresh_freq_sub8x8[i][j] = 32;
- }
-
-#define BFP(BT, SDF, SDAF, VF, SVF, SVAF, SVFHH, SVFHV, SVFHHV, \
- SDX3F, SDX8F, SDX4DF)\
- cpi->fn_ptr[BT].sdf = SDF; \
- cpi->fn_ptr[BT].sdaf = SDAF; \
- cpi->fn_ptr[BT].vf = VF; \
- cpi->fn_ptr[BT].svf = SVF; \
- cpi->fn_ptr[BT].svaf = SVAF; \
- cpi->fn_ptr[BT].svf_halfpix_h = SVFHH; \
- cpi->fn_ptr[BT].svf_halfpix_v = SVFHV; \
- cpi->fn_ptr[BT].svf_halfpix_hv = SVFHHV; \
- cpi->fn_ptr[BT].sdx3f = SDX3F; \
- cpi->fn_ptr[BT].sdx8f = SDX8F; \
- cpi->fn_ptr[BT].sdx4df = SDX4DF;
-
- BFP(BLOCK_32X16, vp9_sad32x16, vp9_sad32x16_avg,
- vp9_variance32x16, vp9_sub_pixel_variance32x16,
- vp9_sub_pixel_avg_variance32x16, NULL, NULL,
- NULL, NULL, NULL,
- vp9_sad32x16x4d)
-
- BFP(BLOCK_16X32, vp9_sad16x32, vp9_sad16x32_avg,
- vp9_variance16x32, vp9_sub_pixel_variance16x32,
- vp9_sub_pixel_avg_variance16x32, NULL, NULL,
- NULL, NULL, NULL,
- vp9_sad16x32x4d)
-
- BFP(BLOCK_64X32, vp9_sad64x32, vp9_sad64x32_avg,
- vp9_variance64x32, vp9_sub_pixel_variance64x32,
- vp9_sub_pixel_avg_variance64x32, NULL, NULL,
- NULL, NULL, NULL,
- vp9_sad64x32x4d)
-
- BFP(BLOCK_32X64, vp9_sad32x64, vp9_sad32x64_avg,
- vp9_variance32x64, vp9_sub_pixel_variance32x64,
- vp9_sub_pixel_avg_variance32x64, NULL, NULL,
- NULL, NULL, NULL,
- vp9_sad32x64x4d)
-
- BFP(BLOCK_32X32, vp9_sad32x32, vp9_sad32x32_avg,
- vp9_variance32x32, vp9_sub_pixel_variance32x32,
- vp9_sub_pixel_avg_variance32x32, vp9_variance_halfpixvar32x32_h,
- vp9_variance_halfpixvar32x32_v,
- vp9_variance_halfpixvar32x32_hv, vp9_sad32x32x3, vp9_sad32x32x8,
- vp9_sad32x32x4d)
-
- BFP(BLOCK_64X64, vp9_sad64x64, vp9_sad64x64_avg,
- vp9_variance64x64, vp9_sub_pixel_variance64x64,
- vp9_sub_pixel_avg_variance64x64, vp9_variance_halfpixvar64x64_h,
- vp9_variance_halfpixvar64x64_v,
- vp9_variance_halfpixvar64x64_hv, vp9_sad64x64x3, vp9_sad64x64x8,
- vp9_sad64x64x4d)
-
- BFP(BLOCK_16X16, vp9_sad16x16, vp9_sad16x16_avg,
- vp9_variance16x16, vp9_sub_pixel_variance16x16,
- vp9_sub_pixel_avg_variance16x16, vp9_variance_halfpixvar16x16_h,
- vp9_variance_halfpixvar16x16_v,
- vp9_variance_halfpixvar16x16_hv, vp9_sad16x16x3, vp9_sad16x16x8,
- vp9_sad16x16x4d)
-
- BFP(BLOCK_16X8, vp9_sad16x8, vp9_sad16x8_avg,
- vp9_variance16x8, vp9_sub_pixel_variance16x8,
- vp9_sub_pixel_avg_variance16x8, NULL, NULL, NULL,
- vp9_sad16x8x3, vp9_sad16x8x8, vp9_sad16x8x4d)
-
- BFP(BLOCK_8X16, vp9_sad8x16, vp9_sad8x16_avg,
- vp9_variance8x16, vp9_sub_pixel_variance8x16,
- vp9_sub_pixel_avg_variance8x16, NULL, NULL, NULL,
- vp9_sad8x16x3, vp9_sad8x16x8, vp9_sad8x16x4d)
-
- BFP(BLOCK_8X8, vp9_sad8x8, vp9_sad8x8_avg,
- vp9_variance8x8, vp9_sub_pixel_variance8x8,
- vp9_sub_pixel_avg_variance8x8, NULL, NULL, NULL,
- vp9_sad8x8x3, vp9_sad8x8x8, vp9_sad8x8x4d)
-
- BFP(BLOCK_8X4, vp9_sad8x4, vp9_sad8x4_avg,
- vp9_variance8x4, vp9_sub_pixel_variance8x4,
- vp9_sub_pixel_avg_variance8x4, NULL, NULL,
- NULL, NULL, vp9_sad8x4x8,
- vp9_sad8x4x4d)
-
- BFP(BLOCK_4X8, vp9_sad4x8, vp9_sad4x8_avg,
- vp9_variance4x8, vp9_sub_pixel_variance4x8,
- vp9_sub_pixel_avg_variance4x8, NULL, NULL,
- NULL, NULL, vp9_sad4x8x8,
- vp9_sad4x8x4d)
-
- BFP(BLOCK_4X4, vp9_sad4x4, vp9_sad4x4_avg,
- vp9_variance4x4, vp9_sub_pixel_variance4x4,
- vp9_sub_pixel_avg_variance4x4, NULL, NULL, NULL,
- vp9_sad4x4x3, vp9_sad4x4x8, vp9_sad4x4x4d)
-
- cpi->full_search_sad = vp9_full_search_sad;
- cpi->diamond_search_sad = vp9_diamond_search_sad;
- cpi->refining_search_sad = vp9_refining_search_sad;
-
- /* vp9_init_quantizer() is first called here. Add check in
- * vp9_frame_init_quantizer() so that vp9_init_quantizer is only
- * called later when needed. This will avoid unnecessary calls of
- * vp9_init_quantizer() for every frame.
- */
- vp9_init_quantizer(cpi);
-
- vp9_loop_filter_init(cm);
-
- cm->error.setjmp = 0;
-
- vp9_zero(cpi->common.counts.uv_mode);
-
-#ifdef MODE_TEST_HIT_STATS
- vp9_zero(cpi->mode_test_hits);
-#endif
-
- return cpi;
-}
-
-void vp9_remove_compressor(VP9_COMP *cpi) {
- int i;
-
- if (!cpi)
- return;
-
- if (cpi && (cpi->common.current_video_frame > 0)) {
-#if CONFIG_INTERNAL_STATS
-
- vp9_clear_system_state();
-
- // printf("\n8x8-4x4:%d-%d\n", cpi->t8x8_count, cpi->t4x4_count);
- if (cpi->pass != 1) {
- FILE *f = fopen("opsnr.stt", "a");
- double time_encoded = (cpi->last_end_time_stamp_seen
- - cpi->first_time_stamp_ever) / 10000000.000;
- double total_encode_time = (cpi->time_receive_data +
- cpi->time_compress_data) / 1000.000;
- double dr = (double)cpi->bytes * (double) 8 / (double)1000
- / time_encoded;
-
- if (cpi->b_calculate_psnr) {
- const double total_psnr =
- vpx_sse_to_psnr((double)cpi->total_samples, 255.0,
- (double)cpi->total_sq_error);
- const double totalp_psnr =
- vpx_sse_to_psnr((double)cpi->totalp_samples, 255.0,
- (double)cpi->totalp_sq_error);
- const double total_ssim = 100 * pow(cpi->summed_quality /
- cpi->summed_weights, 8.0);
- const double totalp_ssim = 100 * pow(cpi->summedp_quality /
- cpi->summedp_weights, 8.0);
-
- fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\t"
- "VPXSSIM\tVPSSIMP\t Time(ms)\n");
- fprintf(f, "%7.2f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%8.0f\n",
- dr, cpi->total / cpi->count, total_psnr,
- cpi->totalp / cpi->count, totalp_psnr, total_ssim, totalp_ssim,
- total_encode_time);
- }
-
- if (cpi->b_calculate_ssimg) {
- fprintf(f, "BitRate\tSSIM_Y\tSSIM_U\tSSIM_V\tSSIM_A\t Time(ms)\n");
- fprintf(f, "%7.2f\t%6.4f\t%6.4f\t%6.4f\t%6.4f\t%8.0f\n", dr,
- cpi->total_ssimg_y / cpi->count,
- cpi->total_ssimg_u / cpi->count,
- cpi->total_ssimg_v / cpi->count,
- cpi->total_ssimg_all / cpi->count, total_encode_time);
- }
-
- fclose(f);
- }
-
-#endif
-
-#ifdef MODE_TEST_HIT_STATS
- if (cpi->pass != 1) {
- double norm_per_pixel_mode_tests = 0;
- double norm_counts[BLOCK_SIZES];
- int i;
- int sb64_per_frame;
- int norm_factors[BLOCK_SIZES] =
- {256, 128, 128, 64, 32, 32, 16, 8, 8, 4, 2, 2, 1};
- FILE *f = fopen("mode_hit_stats.stt", "a");
-
- // On average, how many mode tests do we do
- for (i = 0; i < BLOCK_SIZES; ++i) {
- norm_counts[i] = (double)cpi->mode_test_hits[i] /
- (double)norm_factors[i];
- norm_per_pixel_mode_tests += norm_counts[i];
- }
- // Convert to a number per 64x64 and per frame
- sb64_per_frame = ((cpi->common.height + 63) / 64) *
- ((cpi->common.width + 63) / 64);
- norm_per_pixel_mode_tests =
- norm_per_pixel_mode_tests /
- (double)(cpi->common.current_video_frame * sb64_per_frame);
-
- fprintf(f, "%6.4f\n", norm_per_pixel_mode_tests);
- fclose(f);
- }
-#endif
-
-#if 0
- {
- printf("\n_pick_loop_filter_level:%d\n", cpi->time_pick_lpf / 1000);
- printf("\n_frames recive_data encod_mb_row compress_frame Total\n");
- printf("%6d %10ld %10ld %10ld %10ld\n", cpi->common.current_video_frame,
- cpi->time_receive_data / 1000, cpi->time_encode_sb_row / 1000,
- cpi->time_compress_data / 1000,
- (cpi->time_receive_data + cpi->time_compress_data) / 1000);
- }
-#endif
- }
-
- free_pick_mode_context(&cpi->mb);
- dealloc_compressor_data(cpi);
- vpx_free(cpi->mb.ss);
- vpx_free(cpi->tok);
-
- for (i = 0; i < sizeof(cpi->mbgraph_stats) /
- sizeof(cpi->mbgraph_stats[0]); ++i) {
- vpx_free(cpi->mbgraph_stats[i].mb_stats);
- }
-
- vp9_remove_common(&cpi->common);
- vpx_free(cpi);
-
-#ifdef OUTPUT_YUV_SRC
- fclose(yuv_file);
-#endif
-#ifdef OUTPUT_YUV_REC
- fclose(yuv_rec_file);
-#endif
-
-#if 0
-
- if (keyfile)
- fclose(keyfile);
-
- if (framepsnr)
- fclose(framepsnr);
-
- if (kf_list)
- fclose(kf_list);
-
-#endif
-}
-
-
-static uint64_t calc_plane_error(const uint8_t *orig, int orig_stride,
- const uint8_t *recon, int recon_stride,
- unsigned int cols, unsigned int rows) {
- unsigned int row, col;
- uint64_t total_sse = 0;
- int diff;
-
- for (row = 0; row + 16 <= rows; row += 16) {
- for (col = 0; col + 16 <= cols; col += 16) {
- unsigned int sse;
-
- vp9_mse16x16(orig + col, orig_stride, recon + col, recon_stride, &sse);
- total_sse += sse;
- }
-
- /* Handle odd-sized width */
- if (col < cols) {
- unsigned int border_row, border_col;
- const uint8_t *border_orig = orig;
- const uint8_t *border_recon = recon;
-
- for (border_row = 0; border_row < 16; border_row++) {
- for (border_col = col; border_col < cols; border_col++) {
- diff = border_orig[border_col] - border_recon[border_col];
- total_sse += diff * diff;
- }
-
- border_orig += orig_stride;
- border_recon += recon_stride;
- }
- }
-
- orig += orig_stride * 16;
- recon += recon_stride * 16;
- }
-
- /* Handle odd-sized height */
- for (; row < rows; row++) {
- for (col = 0; col < cols; col++) {
- diff = orig[col] - recon[col];
- total_sse += diff * diff;
- }
-
- orig += orig_stride;
- recon += recon_stride;
- }
-
- return total_sse;
-}
-
-typedef struct {
- double psnr[4]; // total/y/u/v
- uint64_t sse[4]; // total/y/u/v
- uint32_t samples[4]; // total/y/u/v
-} PSNR_STATS;
-
-static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
- PSNR_STATS *psnr) {
- const int widths[3] = {a->y_width, a->uv_width, a->uv_width };
- const int heights[3] = {a->y_height, a->uv_height, a->uv_height};
- const uint8_t *a_planes[3] = {a->y_buffer, a->u_buffer, a->v_buffer };
- const int a_strides[3] = {a->y_stride, a->uv_stride, a->uv_stride};
- const uint8_t *b_planes[3] = {b->y_buffer, b->u_buffer, b->v_buffer };
- const int b_strides[3] = {b->y_stride, b->uv_stride, b->uv_stride};
- int i;
- uint64_t total_sse = 0;
- uint32_t total_samples = 0;
-
- for (i = 0; i < 3; ++i) {
- const int w = widths[i];
- const int h = heights[i];
- const uint32_t samples = w * h;
- const uint64_t sse = calc_plane_error(a_planes[i], a_strides[i],
- b_planes[i], b_strides[i],
- w, h);
- psnr->sse[1 + i] = sse;
- psnr->samples[1 + i] = samples;
- psnr->psnr[1 + i] = vpx_sse_to_psnr(samples, 255.0, (double)sse);
-
- total_sse += sse;
- total_samples += samples;
- }
-
- psnr->sse[0] = total_sse;
- psnr->samples[0] = total_samples;
- psnr->psnr[0] = vpx_sse_to_psnr((double)total_samples, 255.0,
- (double)total_sse);
-}
-
-static void generate_psnr_packet(VP9_COMP *cpi) {
- struct vpx_codec_cx_pkt pkt;
- int i;
- PSNR_STATS psnr;
- calc_psnr(cpi->Source, cpi->common.frame_to_show, &psnr);
- for (i = 0; i < 4; ++i) {
- pkt.data.psnr.samples[i] = psnr.samples[i];
- pkt.data.psnr.sse[i] = psnr.sse[i];
- pkt.data.psnr.psnr[i] = psnr.psnr[i];
- }
- pkt.kind = VPX_CODEC_PSNR_PKT;
- vpx_codec_pkt_list_add(cpi->output_pkt_list, &pkt);
-}
-
-int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags) {
- if (ref_frame_flags > 7)
- return -1;
-
- cpi->ref_frame_flags = ref_frame_flags;
- return 0;
-}
-
-void vp9_update_reference(VP9_COMP *cpi, int ref_frame_flags) {
- cpi->ext_refresh_golden_frame = (ref_frame_flags & VP9_GOLD_FLAG) != 0;
- cpi->ext_refresh_alt_ref_frame = (ref_frame_flags & VP9_ALT_FLAG) != 0;
- cpi->ext_refresh_last_frame = (ref_frame_flags & VP9_LAST_FLAG) != 0;
- cpi->ext_refresh_frame_flags_pending = 1;
-}
-
-static YV12_BUFFER_CONFIG *get_vp9_ref_frame_buffer(VP9_COMP *cpi,
- VP9_REFFRAME ref_frame_flag) {
- MV_REFERENCE_FRAME ref_frame = NONE;
- if (ref_frame_flag == VP9_LAST_FLAG)
- ref_frame = LAST_FRAME;
- else if (ref_frame_flag == VP9_GOLD_FLAG)
- ref_frame = GOLDEN_FRAME;
- else if (ref_frame_flag == VP9_ALT_FLAG)
- ref_frame = ALTREF_FRAME;
-
- return ref_frame == NONE ? NULL : get_ref_frame_buffer(cpi, ref_frame);
-}
-
-int vp9_copy_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd) {
- YV12_BUFFER_CONFIG *cfg = get_vp9_ref_frame_buffer(cpi, ref_frame_flag);
- if (cfg) {
- vp8_yv12_copy_frame(cfg, sd);
- return 0;
- } else {
- return -1;
- }
-}
-
-int vp9_get_reference_enc(VP9_COMP *cpi, int index, YV12_BUFFER_CONFIG **fb) {
- VP9_COMMON *cm = &cpi->common;
-
- if (index < 0 || index >= REF_FRAMES)
- return -1;
-
- *fb = &cm->frame_bufs[cm->ref_frame_map[index]].buf;
- return 0;
-}
-
-int vp9_set_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd) {
- YV12_BUFFER_CONFIG *cfg = get_vp9_ref_frame_buffer(cpi, ref_frame_flag);
- if (cfg) {
- vp8_yv12_copy_frame(sd, cfg);
- return 0;
- } else {
- return -1;
- }
-}
-
-int vp9_update_entropy(VP9_COMP * cpi, int update) {
- cpi->ext_refresh_frame_context = update;
- cpi->ext_refresh_frame_context_pending = 1;
- return 0;
-}
-
-
-#ifdef OUTPUT_YUV_SRC
-void vp9_write_yuv_frame(YV12_BUFFER_CONFIG *s) {
- uint8_t *src = s->y_buffer;
- int h = s->y_height;
-
- do {
- fwrite(src, s->y_width, 1, yuv_file);
- src += s->y_stride;
- } while (--h);
-
- src = s->u_buffer;
- h = s->uv_height;
-
- do {
- fwrite(src, s->uv_width, 1, yuv_file);
- src += s->uv_stride;
- } while (--h);
-
- src = s->v_buffer;
- h = s->uv_height;
-
- do {
- fwrite(src, s->uv_width, 1, yuv_file);
- src += s->uv_stride;
- } while (--h);
-}
-#endif
-
-#ifdef OUTPUT_YUV_REC
-void vp9_write_yuv_rec_frame(VP9_COMMON *cm) {
- YV12_BUFFER_CONFIG *s = cm->frame_to_show;
- uint8_t *src = s->y_buffer;
- int h = cm->height;
-
- do {
- fwrite(src, s->y_width, 1, yuv_rec_file);
- src += s->y_stride;
- } while (--h);
-
- src = s->u_buffer;
- h = s->uv_height;
-
- do {
- fwrite(src, s->uv_width, 1, yuv_rec_file);
- src += s->uv_stride;
- } while (--h);
-
- src = s->v_buffer;
- h = s->uv_height;
-
- do {
- fwrite(src, s->uv_width, 1, yuv_rec_file);
- src += s->uv_stride;
- } while (--h);
-
-#if CONFIG_ALPHA
- if (s->alpha_buffer) {
- src = s->alpha_buffer;
- h = s->alpha_height;
- do {
- fwrite(src, s->alpha_width, 1, yuv_rec_file);
- src += s->alpha_stride;
- } while (--h);
- }
-#endif
-
- fflush(yuv_rec_file);
-}
-#endif
-
-static void scale_and_extend_frame_nonnormative(YV12_BUFFER_CONFIG *src_fb,
- YV12_BUFFER_CONFIG *dst_fb) {
- const int in_w = src_fb->y_crop_width;
- const int in_h = src_fb->y_crop_height;
- const int out_w = dst_fb->y_crop_width;
- const int out_h = dst_fb->y_crop_height;
- const int in_w_uv = src_fb->uv_crop_width;
- const int in_h_uv = src_fb->uv_crop_height;
- const int out_w_uv = dst_fb->uv_crop_width;
- const int out_h_uv = dst_fb->uv_crop_height;
- int i;
-
- uint8_t *srcs[4] = {src_fb->y_buffer, src_fb->u_buffer, src_fb->v_buffer,
- src_fb->alpha_buffer};
- int src_strides[4] = {src_fb->y_stride, src_fb->uv_stride, src_fb->uv_stride,
- src_fb->alpha_stride};
-
- uint8_t *dsts[4] = {dst_fb->y_buffer, dst_fb->u_buffer, dst_fb->v_buffer,
- dst_fb->alpha_buffer};
- int dst_strides[4] = {dst_fb->y_stride, dst_fb->uv_stride, dst_fb->uv_stride,
- dst_fb->alpha_stride};
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- if (i == 0 || i == 3) {
- // Y and alpha planes
- vp9_resize_plane(srcs[i], in_h, in_w, src_strides[i],
- dsts[i], out_h, out_w, dst_strides[i]);
- } else {
- // Chroma planes
- vp9_resize_plane(srcs[i], in_h_uv, in_w_uv, src_strides[i],
- dsts[i], out_h_uv, out_w_uv, dst_strides[i]);
- }
- }
- vp8_yv12_extend_frame_borders(dst_fb);
-}
-
-static void scale_and_extend_frame(YV12_BUFFER_CONFIG *src_fb,
- YV12_BUFFER_CONFIG *dst_fb) {
- const int in_w = src_fb->y_crop_width;
- const int in_h = src_fb->y_crop_height;
- const int out_w = dst_fb->y_crop_width;
- const int out_h = dst_fb->y_crop_height;
- int x, y, i;
-
- uint8_t *srcs[4] = {src_fb->y_buffer, src_fb->u_buffer, src_fb->v_buffer,
- src_fb->alpha_buffer};
- int src_strides[4] = {src_fb->y_stride, src_fb->uv_stride, src_fb->uv_stride,
- src_fb->alpha_stride};
-
- uint8_t *dsts[4] = {dst_fb->y_buffer, dst_fb->u_buffer, dst_fb->v_buffer,
- dst_fb->alpha_buffer};
- int dst_strides[4] = {dst_fb->y_stride, dst_fb->uv_stride, dst_fb->uv_stride,
- dst_fb->alpha_stride};
-
- for (y = 0; y < out_h; y += 16) {
- for (x = 0; x < out_w; x += 16) {
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- const int factor = (i == 0 || i == 3 ? 1 : 2);
- const int x_q4 = x * (16 / factor) * in_w / out_w;
- const int y_q4 = y * (16 / factor) * in_h / out_h;
- const int src_stride = src_strides[i];
- const int dst_stride = dst_strides[i];
- uint8_t *src = srcs[i] + y / factor * in_h / out_h * src_stride +
- x / factor * in_w / out_w;
- uint8_t *dst = dsts[i] + y / factor * dst_stride + x / factor;
-
- vp9_convolve8(src, src_stride, dst, dst_stride,
- vp9_sub_pel_filters_8[x_q4 & 0xf], 16 * in_w / out_w,
- vp9_sub_pel_filters_8[y_q4 & 0xf], 16 * in_h / out_h,
- 16 / factor, 16 / factor);
- }
- }
- }
-
- vp8_yv12_extend_frame_borders(dst_fb);
-}
-
-static int find_fp_qindex() {
- int i;
-
- for (i = 0; i < QINDEX_RANGE; i++) {
- if (vp9_convert_qindex_to_q(i) >= 30.0) {
- break;
- }
- }
-
- if (i == QINDEX_RANGE)
- i--;
-
- return i;
-}
-
-#define WRITE_RECON_BUFFER 0
-#if WRITE_RECON_BUFFER
-void write_cx_frame_to_file(YV12_BUFFER_CONFIG *frame, int this_frame) {
- FILE *yframe;
- int i;
- char filename[255];
-
- snprintf(filename, sizeof(filename), "cx\\y%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->y_height; i++)
- fwrite(frame->y_buffer + i * frame->y_stride,
- frame->y_width, 1, yframe);
-
- fclose(yframe);
- snprintf(filename, sizeof(filename), "cx\\u%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->uv_height; i++)
- fwrite(frame->u_buffer + i * frame->uv_stride,
- frame->uv_width, 1, yframe);
-
- fclose(yframe);
- snprintf(filename, sizeof(filename), "cx\\v%04d.raw", this_frame);
- yframe = fopen(filename, "wb");
-
- for (i = 0; i < frame->uv_height; i++)
- fwrite(frame->v_buffer + i * frame->uv_stride,
- frame->uv_width, 1, yframe);
-
- fclose(yframe);
-}
-#endif
-
-// Function to test for conditions that indicate we should loop
-// back and recode a frame.
-static int recode_loop_test(const VP9_COMP *cpi,
- int high_limit, int low_limit,
- int q, int maxq, int minq) {
- const VP9_COMMON *const cm = &cpi->common;
- const RATE_CONTROL *const rc = &cpi->rc;
- int force_recode = 0;
-
- // Special case trap if maximum allowed frame size exceeded.
- if (rc->projected_frame_size > rc->max_frame_bandwidth) {
- force_recode = 1;
-
- // Is frame recode allowed.
- // Yes if either recode mode 1 is selected or mode 2 is selected
- // and the frame is a key frame, golden frame or alt_ref_frame
- } else if ((cpi->sf.recode_loop == ALLOW_RECODE) ||
- ((cpi->sf.recode_loop == ALLOW_RECODE_KFARFGF) &&
- (cm->frame_type == KEY_FRAME ||
- cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame))) {
- // General over and under shoot tests
- if ((rc->projected_frame_size > high_limit && q < maxq) ||
- (rc->projected_frame_size < low_limit && q > minq)) {
- force_recode = 1;
- } else if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) {
- // Deal with frame undershoot and whether or not we are
- // below the automatically set cq level.
- if (q > cpi->cq_target_quality &&
- rc->projected_frame_size < ((rc->this_frame_target * 7) >> 3)) {
- force_recode = 1;
- }
- }
- }
- return force_recode;
-}
-
-void vp9_update_reference_frames(VP9_COMP *cpi) {
- VP9_COMMON * const cm = &cpi->common;
-
- // At this point the new frame has been encoded.
- // If any buffer copy / swapping is signaled it should be done here.
- if (cm->frame_type == KEY_FRAME) {
- ref_cnt_fb(cm->frame_bufs,
- &cm->ref_frame_map[cpi->gld_fb_idx], cm->new_fb_idx);
- ref_cnt_fb(cm->frame_bufs,
- &cm->ref_frame_map[cpi->alt_fb_idx], cm->new_fb_idx);
- }
-#if CONFIG_MULTIPLE_ARF
- else if (!cpi->multi_arf_enabled && cpi->refresh_golden_frame &&
- !cpi->refresh_alt_ref_frame) {
-#else
- else if (cpi->refresh_golden_frame && !cpi->refresh_alt_ref_frame &&
- !cpi->use_svc) {
-#endif
- /* Preserve the previously existing golden frame and update the frame in
- * the alt ref slot instead. This is highly specific to the current use of
- * alt-ref as a forward reference, and this needs to be generalized as
- * other uses are implemented (like RTC/temporal scaling)
- *
- * The update to the buffer in the alt ref slot was signaled in
- * vp9_pack_bitstream(), now swap the buffer pointers so that it's treated
- * as the golden frame next time.
- */
- int tmp;
-
- ref_cnt_fb(cm->frame_bufs,
- &cm->ref_frame_map[cpi->alt_fb_idx], cm->new_fb_idx);
-
- tmp = cpi->alt_fb_idx;
- cpi->alt_fb_idx = cpi->gld_fb_idx;
- cpi->gld_fb_idx = tmp;
- } else { /* For non key/golden frames */
- if (cpi->refresh_alt_ref_frame) {
- int arf_idx = cpi->alt_fb_idx;
-#if CONFIG_MULTIPLE_ARF
- if (cpi->multi_arf_enabled) {
- arf_idx = cpi->arf_buffer_idx[cpi->sequence_number + 1];
- }
-#endif
- ref_cnt_fb(cm->frame_bufs,
- &cm->ref_frame_map[arf_idx], cm->new_fb_idx);
- }
-
- if (cpi->refresh_golden_frame) {
- ref_cnt_fb(cm->frame_bufs,
- &cm->ref_frame_map[cpi->gld_fb_idx], cm->new_fb_idx);
- }
- }
-
- if (cpi->refresh_last_frame) {
- ref_cnt_fb(cm->frame_bufs,
- &cm->ref_frame_map[cpi->lst_fb_idx], cm->new_fb_idx);
- }
-}
-
-static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
- MACROBLOCKD *xd = &cpi->mb.e_mbd;
- struct loopfilter *lf = &cm->lf;
- if (xd->lossless) {
- lf->filter_level = 0;
- } else {
- struct vpx_usec_timer timer;
-
- vp9_clear_system_state();
-
- vpx_usec_timer_start(&timer);
-
- vp9_pick_filter_level(cpi->Source, cpi, cpi->sf.lpf_pick);
-
- vpx_usec_timer_mark(&timer);
- cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
- }
-
- if (lf->filter_level > 0) {
- vp9_loop_filter_frame(cm, xd, lf->filter_level, 0, 0);
- }
-
- vp9_extend_frame_inner_borders(cm->frame_to_show);
-}
-
-void vp9_scale_references(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
- MV_REFERENCE_FRAME ref_frame;
-
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
- const int idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)];
- YV12_BUFFER_CONFIG *const ref = &cm->frame_bufs[idx].buf;
-
- if (ref->y_crop_width != cm->width ||
- ref->y_crop_height != cm->height) {
- const int new_fb = get_free_fb(cm);
- vp9_realloc_frame_buffer(&cm->frame_bufs[new_fb].buf,
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL);
- scale_and_extend_frame(ref, &cm->frame_bufs[new_fb].buf);
- cpi->scaled_ref_idx[ref_frame - 1] = new_fb;
- } else {
- cpi->scaled_ref_idx[ref_frame - 1] = idx;
- cm->frame_bufs[idx].ref_count++;
- }
- }
-}
-
-static void release_scaled_references(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
- int i;
-
- for (i = 0; i < 3; i++)
- cm->frame_bufs[cpi->scaled_ref_idx[i]].ref_count--;
-}
-
-static void full_to_model_count(unsigned int *model_count,
- unsigned int *full_count) {
- int n;
- model_count[ZERO_TOKEN] = full_count[ZERO_TOKEN];
- model_count[ONE_TOKEN] = full_count[ONE_TOKEN];
- model_count[TWO_TOKEN] = full_count[TWO_TOKEN];
- for (n = THREE_TOKEN; n < EOB_TOKEN; ++n)
- model_count[TWO_TOKEN] += full_count[n];
- model_count[EOB_MODEL_TOKEN] = full_count[EOB_TOKEN];
-}
-
-static void full_to_model_counts(vp9_coeff_count_model *model_count,
- vp9_coeff_count *full_count) {
- int i, j, k, l;
-
- 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)
- full_to_model_count(model_count[i][j][k][l], full_count[i][j][k][l]);
-}
-
-#if 0 && CONFIG_INTERNAL_STATS
-static void output_frame_level_debug_stats(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- FILE *const f = fopen("tmp.stt", cm->current_video_frame ? "a" : "w");
- int recon_err;
-
- vp9_clear_system_state();
-
- recon_err = vp9_calc_ss_err(cpi->Source, get_frame_new_buffer(cm));
-
- if (cpi->twopass.total_left_stats.coded_error != 0.0)
- fprintf(f, "%10u %10d %10d %10d %10d %10d "
- "%10"PRId64" %10"PRId64" %10d "
- "%7.2lf %7.2lf %7.2lf %7.2lf %7.2lf"
- "%6d %6d %5d %5d %5d "
- "%10"PRId64" %10.3lf"
- "%10lf %8u %10d %10d %10d\n",
- cpi->common.current_video_frame, cpi->rc.this_frame_target,
- cpi->rc.projected_frame_size,
- cpi->rc.projected_frame_size / cpi->common.MBs,
- (cpi->rc.projected_frame_size - cpi->rc.this_frame_target),
- cpi->rc.total_target_vs_actual,
- (cpi->oxcf.starting_buffer_level - cpi->rc.bits_off_target),
- cpi->rc.total_actual_bits, cm->base_qindex,
- vp9_convert_qindex_to_q(cm->base_qindex),
- (double)vp9_dc_quant(cm->base_qindex, 0) / 4.0,
- cpi->rc.avg_q,
- vp9_convert_qindex_to_q(cpi->rc.ni_av_qi),
- vp9_convert_qindex_to_q(cpi->cq_target_quality),
- cpi->refresh_last_frame, cpi->refresh_golden_frame,
- cpi->refresh_alt_ref_frame, cm->frame_type, cpi->rc.gfu_boost,
- cpi->twopass.bits_left,
- cpi->twopass.total_left_stats.coded_error,
- cpi->twopass.bits_left /
- (1 + cpi->twopass.total_left_stats.coded_error),
- cpi->tot_recode_hits, recon_err, cpi->rc.kf_boost,
- cpi->twopass.kf_zeromotion_pct);
-
- fclose(f);
-
- if (0) {
- FILE *const fmodes = fopen("Modes.stt", "a");
- int i;
-
- fprintf(fmodes, "%6d:%1d:%1d:%1d ", cpi->common.current_video_frame,
- cm->frame_type, cpi->refresh_golden_frame,
- cpi->refresh_alt_ref_frame);
-
- for (i = 0; i < MAX_MODES; ++i)
- fprintf(fmodes, "%5d ", cpi->mode_chosen_counts[i]);
-
- fprintf(fmodes, "\n");
-
- fclose(fmodes);
- }
-}
-#endif
-
-static void encode_without_recode_loop(VP9_COMP *cpi,
- size_t *size,
- uint8_t *dest,
- int q) {
- VP9_COMMON *const cm = &cpi->common;
- vp9_clear_system_state();
- vp9_set_quantizer(cm, q);
-
- // Set up entropy context depending on frame type. The decoder mandates
- // the use of the default context, index 0, for keyframes and inter
- // frames where the error_resilient_mode or intra_only flag is set. For
- // other inter-frames the encoder currently uses only two contexts;
- // context 1 for ALTREF frames and context 0 for the others.
- if (cm->frame_type == KEY_FRAME) {
- setup_key_frame(cpi);
- } else {
- if (!cm->intra_only && !cm->error_resilient_mode && !cpi->use_svc)
- cm->frame_context_idx = cpi->refresh_alt_ref_frame;
-
- setup_inter_frame(cm);
- }
- // Variance adaptive and in frame q adjustment experiments are mutually
- // exclusive.
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_vaq_frame_setup(cpi);
- } else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
- vp9_setup_in_frame_q_adj(cpi);
- } else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
- vp9_cyclic_refresh_setup(cpi);
- }
- // transform / motion compensation build reconstruction frame
- vp9_encode_frame(cpi);
-
- // Update the skip mb flag probabilities based on the distribution
- // seen in the last encoder iteration.
- // update_base_skip_probs(cpi);
- vp9_clear_system_state();
-}
-
-static void encode_with_recode_loop(VP9_COMP *cpi,
- size_t *size,
- uint8_t *dest,
- int q,
- int bottom_index,
- int top_index) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- int loop_count = 0;
- int loop = 0;
- int overshoot_seen = 0;
- int undershoot_seen = 0;
- int q_low = bottom_index, q_high = top_index;
- int frame_over_shoot_limit;
- int frame_under_shoot_limit;
-
- // Decide frame size bounds
- vp9_rc_compute_frame_size_bounds(cpi, rc->this_frame_target,
- &frame_under_shoot_limit,
- &frame_over_shoot_limit);
-
- do {
- vp9_clear_system_state();
-
- vp9_set_quantizer(cm, q);
-
- if (loop_count == 0) {
- // Set up entropy context depending on frame type. The decoder mandates
- // the use of the default context, index 0, for keyframes and inter
- // frames where the error_resilient_mode or intra_only flag is set. For
- // other inter-frames the encoder currently uses only two contexts;
- // context 1 for ALTREF frames and context 0 for the others.
- if (cm->frame_type == KEY_FRAME) {
- setup_key_frame(cpi);
- } else {
- if (!cm->intra_only && !cm->error_resilient_mode && !cpi->use_svc)
- cpi->common.frame_context_idx = cpi->refresh_alt_ref_frame;
-
- setup_inter_frame(cm);
- }
- }
-
- // Variance adaptive and in frame q adjustment experiments are mutually
- // exclusive.
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_vaq_frame_setup(cpi);
- } else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
- vp9_setup_in_frame_q_adj(cpi);
- }
-
- // transform / motion compensation build reconstruction frame
- vp9_encode_frame(cpi);
-
- // Update the skip mb flag probabilities based on the distribution
- // seen in the last encoder iteration.
- // update_base_skip_probs(cpi);
-
- vp9_clear_system_state();
-
- // Dummy pack of the bitstream using up to date stats to get an
- // accurate estimate of output frame size to determine if we need
- // to recode.
- if (cpi->sf.recode_loop >= ALLOW_RECODE_KFARFGF) {
- vp9_save_coding_context(cpi);
- cpi->dummy_packing = 1;
- if (!cpi->sf.use_nonrd_pick_mode)
- vp9_pack_bitstream(cpi, dest, size);
-
- rc->projected_frame_size = (int)(*size) << 3;
- vp9_restore_coding_context(cpi);
-
- if (frame_over_shoot_limit == 0)
- frame_over_shoot_limit = 1;
- }
-
- if (cpi->oxcf.end_usage == USAGE_CONSTANT_QUALITY) {
- loop = 0;
- } else {
- if ((cm->frame_type == KEY_FRAME) &&
- rc->this_key_frame_forced &&
- (rc->projected_frame_size < rc->max_frame_bandwidth)) {
- int last_q = q;
- int kf_err = vp9_calc_ss_err(cpi->Source, get_frame_new_buffer(cm));
-
- int high_err_target = cpi->ambient_err;
- int low_err_target = cpi->ambient_err >> 1;
-
- // Prevent possible divide by zero error below for perfect KF
- kf_err += !kf_err;
-
- // The key frame is not good enough or we can afford
- // to make it better without undue risk of popping.
- if ((kf_err > high_err_target &&
- rc->projected_frame_size <= frame_over_shoot_limit) ||
- (kf_err > low_err_target &&
- rc->projected_frame_size <= frame_under_shoot_limit)) {
- // Lower q_high
- q_high = q > q_low ? q - 1 : q_low;
-
- // Adjust Q
- q = (q * high_err_target) / kf_err;
- q = MIN(q, (q_high + q_low) >> 1);
- } else if (kf_err < low_err_target &&
- rc->projected_frame_size >= frame_under_shoot_limit) {
- // The key frame is much better than the previous frame
- // Raise q_low
- q_low = q < q_high ? q + 1 : q_high;
-
- // Adjust Q
- q = (q * low_err_target) / kf_err;
- q = MIN(q, (q_high + q_low + 1) >> 1);
- }
-
- // Clamp Q to upper and lower limits:
- q = clamp(q, q_low, q_high);
-
- loop = q != last_q;
- } else if (recode_loop_test(
- cpi, frame_over_shoot_limit, frame_under_shoot_limit,
- q, MAX(q_high, top_index), bottom_index)) {
- // Is the projected frame size out of range and are we allowed
- // to attempt to recode.
- int last_q = q;
- int retries = 0;
-
- // Frame size out of permitted range:
- // Update correction factor & compute new Q to try...
-
- // Frame is too large
- if (rc->projected_frame_size > rc->this_frame_target) {
- // Special case if the projected size is > the max allowed.
- if (rc->projected_frame_size >= rc->max_frame_bandwidth)
- q_high = rc->worst_quality;
-
- // Raise Qlow as to at least the current value
- q_low = q < q_high ? q + 1 : q_high;
-
- if (undershoot_seen || loop_count > 1) {
- // Update rate_correction_factor unless
- vp9_rc_update_rate_correction_factors(cpi, 1);
-
- q = (q_high + q_low + 1) / 2;
- } else {
- // Update rate_correction_factor unless
- vp9_rc_update_rate_correction_factors(cpi, 0);
-
- q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
- bottom_index, MAX(q_high, top_index));
-
- while (q < q_low && retries < 10) {
- vp9_rc_update_rate_correction_factors(cpi, 0);
- q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
- bottom_index, MAX(q_high, top_index));
- retries++;
- }
- }
-
- overshoot_seen = 1;
- } else {
- // Frame is too small
- q_high = q > q_low ? q - 1 : q_low;
-
- if (overshoot_seen || loop_count > 1) {
- vp9_rc_update_rate_correction_factors(cpi, 1);
- q = (q_high + q_low) / 2;
- } else {
- vp9_rc_update_rate_correction_factors(cpi, 0);
- q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
- bottom_index, top_index);
- // Special case reset for qlow for constrained quality.
- // This should only trigger where there is very substantial
- // undershoot on a frame and the auto cq level is above
- // the user passsed in value.
- if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY &&
- q < q_low) {
- q_low = q;
- }
-
- while (q > q_high && retries < 10) {
- vp9_rc_update_rate_correction_factors(cpi, 0);
- q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
- bottom_index, top_index);
- retries++;
- }
- }
-
- undershoot_seen = 1;
- }
-
- // Clamp Q to upper and lower limits:
- q = clamp(q, q_low, q_high);
-
- loop = q != last_q;
- } else {
- loop = 0;
- }
- }
-
- // Special case for overlay frame.
- if (rc->is_src_frame_alt_ref &&
- rc->projected_frame_size < rc->max_frame_bandwidth)
- loop = 0;
-
- if (loop) {
- loop_count++;
-
-#if CONFIG_INTERNAL_STATS
- cpi->tot_recode_hits++;
-#endif
- }
- } while (loop);
-}
-
-static void get_ref_frame_flags(VP9_COMP *cpi) {
- if (cpi->refresh_last_frame & cpi->refresh_golden_frame)
- cpi->gold_is_last = 1;
- else if (cpi->refresh_last_frame ^ cpi->refresh_golden_frame)
- cpi->gold_is_last = 0;
-
- if (cpi->refresh_last_frame & cpi->refresh_alt_ref_frame)
- cpi->alt_is_last = 1;
- else if (cpi->refresh_last_frame ^ cpi->refresh_alt_ref_frame)
- cpi->alt_is_last = 0;
-
- if (cpi->refresh_alt_ref_frame & cpi->refresh_golden_frame)
- cpi->gold_is_alt = 1;
- else if (cpi->refresh_alt_ref_frame ^ cpi->refresh_golden_frame)
- cpi->gold_is_alt = 0;
-
- cpi->ref_frame_flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
-
- if (cpi->gold_is_last)
- cpi->ref_frame_flags &= ~VP9_GOLD_FLAG;
-
- if (cpi->rc.frames_till_gf_update_due == INT_MAX)
- cpi->ref_frame_flags &= ~VP9_GOLD_FLAG;
-
- if (cpi->alt_is_last)
- cpi->ref_frame_flags &= ~VP9_ALT_FLAG;
-
- if (cpi->gold_is_alt)
- cpi->ref_frame_flags &= ~VP9_ALT_FLAG;
-}
-
-static void set_ext_overrides(VP9_COMP *cpi) {
- // Overrides the defaults with the externally supplied values with
- // vp9_update_reference() and vp9_update_entropy() calls
- // Note: The overrides are valid only for the next frame passed
- // to encode_frame_to_data_rate() function
- if (cpi->ext_refresh_frame_context_pending) {
- cpi->common.refresh_frame_context = cpi->ext_refresh_frame_context;
- cpi->ext_refresh_frame_context_pending = 0;
- }
- if (cpi->ext_refresh_frame_flags_pending) {
- cpi->refresh_last_frame = cpi->ext_refresh_last_frame;
- cpi->refresh_golden_frame = cpi->ext_refresh_golden_frame;
- cpi->refresh_alt_ref_frame = cpi->ext_refresh_alt_ref_frame;
- cpi->ext_refresh_frame_flags_pending = 0;
- }
-}
-
-static void encode_frame_to_data_rate(VP9_COMP *cpi,
- size_t *size,
- uint8_t *dest,
- unsigned int *frame_flags) {
- VP9_COMMON *const cm = &cpi->common;
- TX_SIZE t;
- int q;
- int top_index;
- int bottom_index;
-
- const SPEED_FEATURES *const sf = &cpi->sf;
- const unsigned int max_mv_def = MIN(cm->width, cm->height);
- struct segmentation *const seg = &cm->seg;
-
- set_ext_overrides(cpi);
-
- /* Scale the source buffer, if required. */
- if (cm->mi_cols * MI_SIZE != cpi->un_scaled_source->y_width ||
- cm->mi_rows * MI_SIZE != cpi->un_scaled_source->y_height) {
- scale_and_extend_frame_nonnormative(cpi->un_scaled_source,
- &cpi->scaled_source);
- cpi->Source = &cpi->scaled_source;
- } else {
- cpi->Source = cpi->un_scaled_source;
- }
-
- // Scale the last source buffer, if required.
- if (cpi->unscaled_last_source != NULL) {
- if (cm->mi_cols * MI_SIZE != cpi->unscaled_last_source->y_width ||
- cm->mi_rows * MI_SIZE != cpi->unscaled_last_source->y_height) {
- scale_and_extend_frame_nonnormative(cpi->unscaled_last_source,
- &cpi->scaled_last_source);
- cpi->Last_Source = &cpi->scaled_last_source;
- } else {
- cpi->Last_Source = cpi->unscaled_last_source;
- }
- }
-
- vp9_scale_references(cpi);
-
- vp9_clear_system_state();
-
- // Enable or disable mode based tweaking of the zbin.
- // For 2 pass only used where GF/ARF prediction quality
- // is above a threshold.
- cpi->zbin_mode_boost = 0;
- cpi->zbin_mode_boost_enabled = 0;
-
- // Current default encoder behavior for the altref sign bias.
- cm->ref_frame_sign_bias[ALTREF_FRAME] = cpi->rc.source_alt_ref_active;
-
- // Set default state for segment based loop filter update flags.
- cm->lf.mode_ref_delta_update = 0;
-
- // Initialize cpi->mv_step_param to default based on max resolution.
- cpi->mv_step_param = vp9_init_search_range(cpi, max_mv_def);
- // Initialize cpi->max_mv_magnitude and cpi->mv_step_param if appropriate.
- if (sf->auto_mv_step_size) {
- if (frame_is_intra_only(cm)) {
- // Initialize max_mv_magnitude for use in the first INTER frame
- // after a key/intra-only frame.
- cpi->max_mv_magnitude = max_mv_def;
- } else {
- if (cm->show_frame)
- // Allow mv_steps to correspond to twice the max mv magnitude found
- // in the previous frame, capped by the default max_mv_magnitude based
- // on resolution.
- cpi->mv_step_param = vp9_init_search_range(cpi, MIN(max_mv_def, 2 *
- cpi->max_mv_magnitude));
- cpi->max_mv_magnitude = 0;
- }
- }
-
- // Set various flags etc to special state if it is a key frame.
- if (frame_is_intra_only(cm)) {
- setup_key_frame(cpi);
- // Reset the loop filter deltas and segmentation map.
- vp9_reset_segment_features(&cm->seg);
-
- // If segmentation is enabled force a map update for key frames.
- if (seg->enabled) {
- seg->update_map = 1;
- seg->update_data = 1;
- }
-
- // The alternate reference frame cannot be active for a key frame.
- cpi->rc.source_alt_ref_active = 0;
-
- cm->error_resilient_mode = (cpi->oxcf.error_resilient_mode != 0);
- cm->frame_parallel_decoding_mode =
- (cpi->oxcf.frame_parallel_decoding_mode != 0);
-
- // By default, encoder assumes decoder can use prev_mi.
- cm->coding_use_prev_mi = 1;
- if (cm->error_resilient_mode) {
- cm->coding_use_prev_mi = 0;
- cm->frame_parallel_decoding_mode = 1;
- cm->reset_frame_context = 0;
- cm->refresh_frame_context = 0;
- } else if (cm->intra_only) {
- // Only reset the current context.
- cm->reset_frame_context = 2;
- }
- }
-
- // Configure experimental use of segmentation for enhanced coding of
- // static regions if indicated.
- // Only allowed in second pass of two pass (as requires lagged coding)
- // and if the relevant speed feature flag is set.
- if (cpi->pass == 2 && cpi->sf.static_segmentation)
- configure_static_seg_features(cpi);
-
- // For 1 pass CBR, check if we are dropping this frame.
- // Never drop on key frame.
- if (cpi->pass == 0 &&
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER &&
- cm->frame_type != KEY_FRAME) {
- if (vp9_rc_drop_frame(cpi)) {
- vp9_rc_postencode_update_drop_frame(cpi);
- ++cm->current_video_frame;
- return;
- }
- }
-
- vp9_clear_system_state();
-
- vp9_zero(cpi->rd_tx_select_threshes);
-
-#if CONFIG_VP9_POSTPROC
- if (cpi->oxcf.noise_sensitivity > 0) {
- int l = 0;
- switch (cpi->oxcf.noise_sensitivity) {
- case 1:
- l = 20;
- break;
- case 2:
- l = 40;
- break;
- case 3:
- l = 60;
- break;
- case 4:
- case 5:
- l = 100;
- break;
- case 6:
- l = 150;
- break;
- }
- vp9_denoise(cpi->Source, cpi->Source, l);
- }
-#endif
-
-#ifdef OUTPUT_YUV_SRC
- vp9_write_yuv_frame(cpi->Source);
-#endif
-
- set_speed_features(cpi);
-
- // Decide q and q bounds.
- q = vp9_rc_pick_q_and_bounds(cpi, &bottom_index, &top_index);
-
- if (!frame_is_intra_only(cm)) {
- cm->interp_filter = DEFAULT_INTERP_FILTER;
- /* TODO: Decide this more intelligently */
- set_high_precision_mv(cpi, q < HIGH_PRECISION_MV_QTHRESH);
- }
-
- if (cpi->sf.recode_loop == DISALLOW_RECODE) {
- encode_without_recode_loop(cpi, size, dest, q);
- } else {
- encode_with_recode_loop(cpi, size, dest, q, bottom_index, top_index);
- }
-
- // Special case code to reduce pulsing when key frames are forced at a
- // fixed interval. Note the reconstruction error if it is the frame before
- // the force key frame
- if (cpi->rc.next_key_frame_forced && cpi->rc.frames_to_key == 1) {
- cpi->ambient_err = vp9_calc_ss_err(cpi->Source, get_frame_new_buffer(cm));
- }
-
- // If the encoder forced a KEY_FRAME decision
- if (cm->frame_type == KEY_FRAME)
- cpi->refresh_last_frame = 1;
-
- cm->frame_to_show = get_frame_new_buffer(cm);
-
-#if WRITE_RECON_BUFFER
- if (cm->show_frame)
- write_cx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame);
- else
- write_cx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame + 1000);
-#endif
-
- // Pick the loop filter level for the frame.
- loopfilter_frame(cpi, cm);
-
-#if WRITE_RECON_BUFFER
- if (cm->show_frame)
- write_cx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame + 2000);
- else
- write_cx_frame_to_file(cm->frame_to_show,
- cm->current_video_frame + 3000);
-#endif
-
- // build the bitstream
- cpi->dummy_packing = 0;
- vp9_pack_bitstream(cpi, dest, size);
-
- if (cm->seg.update_map)
- update_reference_segmentation_map(cpi);
-
- release_scaled_references(cpi);
- vp9_update_reference_frames(cpi);
-
- for (t = TX_4X4; t <= TX_32X32; t++)
- full_to_model_counts(cm->counts.coef[t], cpi->coef_counts[t]);
-
- if (!cm->error_resilient_mode && !cm->frame_parallel_decoding_mode)
- vp9_adapt_coef_probs(cm);
-
- if (!frame_is_intra_only(cm)) {
- if (!cm->error_resilient_mode && !cm->frame_parallel_decoding_mode) {
- vp9_adapt_mode_probs(cm);
- vp9_adapt_mv_probs(cm, cm->allow_high_precision_mv);
- }
- }
-
-#if 0
- output_frame_level_debug_stats(cpi);
-#endif
- if (cpi->refresh_golden_frame == 1)
- cm->frame_flags |= FRAMEFLAGS_GOLDEN;
- else
- cm->frame_flags &= ~FRAMEFLAGS_GOLDEN;
-
- if (cpi->refresh_alt_ref_frame == 1)
- cm->frame_flags |= FRAMEFLAGS_ALTREF;
- else
- cm->frame_flags &= ~FRAMEFLAGS_ALTREF;
-
- get_ref_frame_flags(cpi);
-
- vp9_rc_postencode_update(cpi, *size);
-
- if (cm->frame_type == KEY_FRAME) {
- // Tell the caller that the frame was coded as a key frame
- *frame_flags = cm->frame_flags | FRAMEFLAGS_KEY;
-
-#if CONFIG_MULTIPLE_ARF
- // Reset the sequence number.
- if (cpi->multi_arf_enabled) {
- cpi->sequence_number = 0;
- cpi->frame_coding_order_period = cpi->new_frame_coding_order_period;
- cpi->new_frame_coding_order_period = -1;
- }
-#endif
- } else {
- *frame_flags = cm->frame_flags&~FRAMEFLAGS_KEY;
-
-#if CONFIG_MULTIPLE_ARF
- /* Increment position in the coded frame sequence. */
- if (cpi->multi_arf_enabled) {
- ++cpi->sequence_number;
- if (cpi->sequence_number >= cpi->frame_coding_order_period) {
- cpi->sequence_number = 0;
- cpi->frame_coding_order_period = cpi->new_frame_coding_order_period;
- cpi->new_frame_coding_order_period = -1;
- }
- cpi->this_frame_weight = cpi->arf_weight[cpi->sequence_number];
- assert(cpi->this_frame_weight >= 0);
- }
-#endif
- }
-
- // Clear the one shot update flags for segmentation map and mode/ref loop
- // filter deltas.
- cm->seg.update_map = 0;
- cm->seg.update_data = 0;
- cm->lf.mode_ref_delta_update = 0;
-
- // keep track of the last coded dimensions
- cm->last_width = cm->width;
- cm->last_height = cm->height;
-
- // reset to normal state now that we are done.
- if (!cm->show_existing_frame)
- cm->last_show_frame = cm->show_frame;
-
- if (cm->show_frame) {
- vp9_swap_mi_and_prev_mi(cm);
-
- // Don't increment frame counters if this was an altref buffer
- // update not a real frame
- ++cm->current_video_frame;
- if (cpi->use_svc) {
- LAYER_CONTEXT *lc;
- if (cpi->svc.number_temporal_layers > 1) {
- lc = &cpi->svc.layer_context[cpi->svc.temporal_layer_id];
- } else {
- lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
- }
- ++lc->current_video_frame_in_layer;
- }
- }
-
- // restore prev_mi
- cm->prev_mi = cm->prev_mip + cm->mi_stride + 1;
- cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mi_stride + 1;
-}
-
-static void SvcEncode(VP9_COMP *cpi, size_t *size, uint8_t *dest,
- unsigned int *frame_flags) {
- vp9_rc_get_svc_params(cpi);
- encode_frame_to_data_rate(cpi, size, dest, frame_flags);
-}
-
-static void Pass0Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest,
- unsigned int *frame_flags) {
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
- vp9_rc_get_one_pass_cbr_params(cpi);
- } else {
- vp9_rc_get_one_pass_vbr_params(cpi);
- }
- encode_frame_to_data_rate(cpi, size, dest, frame_flags);
-}
-
-static void Pass1Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest,
- unsigned int *frame_flags) {
- (void) size;
- (void) dest;
- (void) frame_flags;
-
- vp9_rc_get_first_pass_params(cpi);
- vp9_set_quantizer(&cpi->common, find_fp_qindex());
- vp9_first_pass(cpi);
-}
-
-static void Pass2Encode(VP9_COMP *cpi, size_t *size,
- uint8_t *dest, unsigned int *frame_flags) {
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
-
- vp9_rc_get_second_pass_params(cpi);
- encode_frame_to_data_rate(cpi, size, dest, frame_flags);
-
- vp9_twopass_postencode_update(cpi);
-}
-
-static void check_initial_width(VP9_COMP *cpi, int subsampling_x,
- int subsampling_y) {
- VP9_COMMON *const cm = &cpi->common;
-
- if (!cpi->initial_width) {
- cm->subsampling_x = subsampling_x;
- cm->subsampling_y = subsampling_y;
- alloc_raw_frame_buffers(cpi);
- cpi->initial_width = cm->width;
- cpi->initial_height = cm->height;
- }
-}
-
-
-int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags,
- YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
- int64_t end_time) {
- VP9_COMMON *cm = &cpi->common;
- struct vpx_usec_timer timer;
- int res = 0;
- const int subsampling_x = sd->uv_width < sd->y_width;
- const int subsampling_y = sd->uv_height < sd->y_height;
-
- check_initial_width(cpi, subsampling_x, subsampling_y);
- vpx_usec_timer_start(&timer);
- if (vp9_lookahead_push(cpi->lookahead,
- sd, time_stamp, end_time, frame_flags))
- res = -1;
- vpx_usec_timer_mark(&timer);
- cpi->time_receive_data += vpx_usec_timer_elapsed(&timer);
-
- if (cm->version == 0 && (subsampling_x != 1 || subsampling_y != 1)) {
- vpx_internal_error(&cm->error, VPX_CODEC_INVALID_PARAM,
- "Non-4:2:0 color space requires profile >= 1");
- res = -1;
- }
-
- return res;
-}
-
-
-static int frame_is_reference(const VP9_COMP *cpi) {
- const VP9_COMMON *cm = &cpi->common;
-
- return cm->frame_type == KEY_FRAME ||
- cpi->refresh_last_frame ||
- cpi->refresh_golden_frame ||
- cpi->refresh_alt_ref_frame ||
- cm->refresh_frame_context ||
- cm->lf.mode_ref_delta_update ||
- cm->seg.update_map ||
- cm->seg.update_data;
-}
-
-#if CONFIG_MULTIPLE_ARF
-int is_next_frame_arf(VP9_COMP *cpi) {
- // Negative entry in frame_coding_order indicates an ARF at this position.
- return cpi->frame_coding_order[cpi->sequence_number + 1] < 0 ? 1 : 0;
-}
-#endif
-
-void adjust_frame_rate(VP9_COMP *cpi) {
- int64_t this_duration;
- int step = 0;
-
- if (cpi->source->ts_start == cpi->first_time_stamp_ever) {
- this_duration = cpi->source->ts_end - cpi->source->ts_start;
- step = 1;
- } else {
- int64_t last_duration = cpi->last_end_time_stamp_seen
- - cpi->last_time_stamp_seen;
-
- this_duration = cpi->source->ts_end - cpi->last_end_time_stamp_seen;
-
- // do a step update if the duration changes by 10%
- if (last_duration)
- step = (int)((this_duration - last_duration) * 10 / last_duration);
- }
-
- if (this_duration) {
- if (step) {
- vp9_new_framerate(cpi, 10000000.0 / this_duration);
- } else {
- // Average this frame's rate into the last second's average
- // frame rate. If we haven't seen 1 second yet, then average
- // over the whole interval seen.
- const double interval = MIN((double)(cpi->source->ts_end
- - cpi->first_time_stamp_ever), 10000000.0);
- double avg_duration = 10000000.0 / cpi->oxcf.framerate;
- avg_duration *= (interval - avg_duration + this_duration);
- avg_duration /= interval;
-
- vp9_new_framerate(cpi, 10000000.0 / avg_duration);
- }
- }
- cpi->last_time_stamp_seen = cpi->source->ts_start;
- cpi->last_end_time_stamp_seen = cpi->source->ts_end;
-}
-
-int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
- size_t *size, uint8_t *dest,
- int64_t *time_stamp, int64_t *time_end, int flush) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- RATE_CONTROL *const rc = &cpi->rc;
- struct vpx_usec_timer cmptimer;
- YV12_BUFFER_CONFIG *force_src_buffer = NULL;
- MV_REFERENCE_FRAME ref_frame;
-
- if (!cpi)
- return -1;
-
- if (cpi->svc.number_spatial_layers > 1 && cpi->pass == 2) {
- vp9_restore_layer_context(cpi);
- }
-
- vpx_usec_timer_start(&cmptimer);
-
- cpi->source = NULL;
- cpi->last_source = NULL;
-
- set_high_precision_mv(cpi, ALTREF_HIGH_PRECISION_MV);
-
- // Normal defaults
- cm->reset_frame_context = 0;
- cm->refresh_frame_context = 1;
- cpi->refresh_last_frame = 1;
- cpi->refresh_golden_frame = 0;
- cpi->refresh_alt_ref_frame = 0;
-
- // Should we code an alternate reference frame.
- if (cpi->oxcf.play_alternate && rc->source_alt_ref_pending) {
- int frames_to_arf;
-
-#if CONFIG_MULTIPLE_ARF
- assert(!cpi->multi_arf_enabled ||
- cpi->frame_coding_order[cpi->sequence_number] < 0);
-
- if (cpi->multi_arf_enabled && (cpi->pass == 2))
- frames_to_arf = (-cpi->frame_coding_order[cpi->sequence_number])
- - cpi->next_frame_in_order;
- else
-#endif
- frames_to_arf = rc->frames_till_gf_update_due;
-
- assert(frames_to_arf <= rc->frames_to_key);
-
- if ((cpi->source = vp9_lookahead_peek(cpi->lookahead, frames_to_arf))) {
-#if CONFIG_MULTIPLE_ARF
- cpi->alt_ref_source[cpi->arf_buffered] = cpi->source;
-#else
- cpi->alt_ref_source = cpi->source;
-#endif
-
- if (cpi->oxcf.arnr_max_frames > 0) {
- // Produce the filtered ARF frame.
- // TODO(agrange) merge these two functions.
- vp9_configure_arnr_filter(cpi, frames_to_arf, rc->gfu_boost);
- vp9_temporal_filter_prepare(cpi, frames_to_arf);
- vp9_extend_frame_borders(&cpi->alt_ref_buffer);
- force_src_buffer = &cpi->alt_ref_buffer;
- }
-
- cm->show_frame = 0;
- cpi->refresh_alt_ref_frame = 1;
- cpi->refresh_golden_frame = 0;
- cpi->refresh_last_frame = 0;
- rc->is_src_frame_alt_ref = 0;
-
-#if CONFIG_MULTIPLE_ARF
- if (!cpi->multi_arf_enabled)
-#endif
- rc->source_alt_ref_pending = 0;
- } else {
- rc->source_alt_ref_pending = 0;
- }
- }
-
- if (!cpi->source) {
-#if CONFIG_MULTIPLE_ARF
- int i;
-#endif
-
- // Get last frame source.
- if (cm->current_video_frame > 0) {
- if ((cpi->last_source = vp9_lookahead_peek(cpi->lookahead, -1)) == NULL)
- return -1;
- }
-
- if ((cpi->source = vp9_lookahead_pop(cpi->lookahead, flush))) {
- cm->show_frame = 1;
- cm->intra_only = 0;
-
-#if CONFIG_MULTIPLE_ARF
- // Is this frame the ARF overlay.
- rc->is_src_frame_alt_ref = 0;
- for (i = 0; i < cpi->arf_buffered; ++i) {
- if (cpi->source == cpi->alt_ref_source[i]) {
- rc->is_src_frame_alt_ref = 1;
- cpi->refresh_golden_frame = 1;
- break;
- }
- }
-#else
- rc->is_src_frame_alt_ref = cpi->alt_ref_source &&
- (cpi->source == cpi->alt_ref_source);
-#endif
- if (rc->is_src_frame_alt_ref) {
- // Current frame is an ARF overlay frame.
-#if CONFIG_MULTIPLE_ARF
- cpi->alt_ref_source[i] = NULL;
-#else
- cpi->alt_ref_source = NULL;
-#endif
- // Don't refresh the last buffer for an ARF overlay frame. It will
- // become the GF so preserve last as an alternative prediction option.
- cpi->refresh_last_frame = 0;
- }
-#if CONFIG_MULTIPLE_ARF
- ++cpi->next_frame_in_order;
-#endif
- }
- }
-
- if (cpi->source) {
- cpi->un_scaled_source = cpi->Source = force_src_buffer ? force_src_buffer
- : &cpi->source->img;
-
- if (cpi->last_source != NULL) {
- cpi->unscaled_last_source = &cpi->last_source->img;
- } else {
- cpi->unscaled_last_source = NULL;
- }
-
- *time_stamp = cpi->source->ts_start;
- *time_end = cpi->source->ts_end;
- *frame_flags = cpi->source->flags;
-
-#if CONFIG_MULTIPLE_ARF
- if (cm->frame_type != KEY_FRAME && cpi->pass == 2)
- rc->source_alt_ref_pending = is_next_frame_arf(cpi);
-#endif
- } else {
- *size = 0;
- if (flush && cpi->pass == 1 && !cpi->twopass.first_pass_done) {
- vp9_end_first_pass(cpi); /* get last stats packet */
- cpi->twopass.first_pass_done = 1;
- }
- return -1;
- }
-
- if (cpi->source->ts_start < cpi->first_time_stamp_ever) {
- cpi->first_time_stamp_ever = cpi->source->ts_start;
- cpi->last_end_time_stamp_seen = cpi->source->ts_start;
- }
-
- // adjust frame rates based on timestamps given
- if (cm->show_frame) {
- adjust_frame_rate(cpi);
- }
-
- if (cpi->svc.number_temporal_layers > 1 &&
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
- vp9_update_temporal_layer_framerate(cpi);
- vp9_restore_layer_context(cpi);
- }
-
- // start with a 0 size frame
- *size = 0;
-
- // Clear down mmx registers
- vp9_clear_system_state();
-
- /* find a free buffer for the new frame, releasing the reference previously
- * held.
- */
- cm->frame_bufs[cm->new_fb_idx].ref_count--;
- cm->new_fb_idx = get_free_fb(cm);
-
-#if CONFIG_MULTIPLE_ARF
- /* Set up the correct ARF frame. */
- if (cpi->refresh_alt_ref_frame) {
- ++cpi->arf_buffered;
- }
- if (cpi->multi_arf_enabled && (cm->frame_type != KEY_FRAME) &&
- (cpi->pass == 2)) {
- cpi->alt_fb_idx = cpi->arf_buffer_idx[cpi->sequence_number];
- }
-#endif
-
- cm->frame_flags = *frame_flags;
-
- // Reset the frame pointers to the current frame size
- vp9_realloc_frame_buffer(get_frame_new_buffer(cm),
- cm->width, cm->height,
- cm->subsampling_x, cm->subsampling_y,
- VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL);
-
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
- const int idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)];
- YV12_BUFFER_CONFIG *const buf = &cm->frame_bufs[idx].buf;
- RefBuffer *const ref_buf = &cm->frame_refs[ref_frame - 1];
- ref_buf->buf = buf;
- ref_buf->idx = idx;
- vp9_setup_scale_factors_for_frame(&ref_buf->sf,
- buf->y_crop_width, buf->y_crop_height,
- cm->width, cm->height);
-
- if (vp9_is_scaled(&ref_buf->sf))
- vp9_extend_frame_borders(buf);
- }
-
- set_ref_ptrs(cm, xd, LAST_FRAME, LAST_FRAME);
-
- if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_vaq_init();
- }
-
- if (cpi->pass == 1 &&
- (!cpi->use_svc || cpi->svc.number_temporal_layers == 1)) {
- Pass1Encode(cpi, size, dest, frame_flags);
- } else if (cpi->pass == 2 &&
- (!cpi->use_svc || cpi->svc.number_temporal_layers == 1)) {
- Pass2Encode(cpi, size, dest, frame_flags);
- } else if (cpi->use_svc) {
- SvcEncode(cpi, size, dest, frame_flags);
- } else {
- // One pass encode
- Pass0Encode(cpi, size, dest, frame_flags);
- }
-
- if (cm->refresh_frame_context)
- cm->frame_contexts[cm->frame_context_idx] = cm->fc;
-
- // Frame was dropped, release scaled references.
- if (*size == 0) {
- release_scaled_references(cpi);
- }
-
- if (*size > 0) {
- cpi->droppable = !frame_is_reference(cpi);
- }
-
- // Save layer specific state.
- if ((cpi->svc.number_temporal_layers > 1 &&
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ||
- (cpi->svc.number_spatial_layers > 1 && cpi->pass == 2)) {
- vp9_save_layer_context(cpi);
- }
-
- vpx_usec_timer_mark(&cmptimer);
- cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer);
-
- if (cpi->b_calculate_psnr && cpi->pass != 1 && cm->show_frame)
- generate_psnr_packet(cpi);
-
-#if CONFIG_INTERNAL_STATS
-
- if (cpi->pass != 1) {
- cpi->bytes += (int)(*size);
-
- if (cm->show_frame) {
- cpi->count++;
-
- if (cpi->b_calculate_psnr) {
- YV12_BUFFER_CONFIG *orig = cpi->Source;
- YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show;
- YV12_BUFFER_CONFIG *pp = &cm->post_proc_buffer;
- PSNR_STATS psnr;
- calc_psnr(orig, recon, &psnr);
-
- cpi->total += psnr.psnr[0];
- cpi->total_y += psnr.psnr[1];
- cpi->total_u += psnr.psnr[2];
- cpi->total_v += psnr.psnr[3];
- cpi->total_sq_error += psnr.sse[0];
- cpi->total_samples += psnr.samples[0];
-
- {
- PSNR_STATS psnr2;
- double frame_ssim2 = 0, weight = 0;
-#if CONFIG_VP9_POSTPROC
- vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer,
- cm->lf.filter_level * 10 / 6);
-#endif
- vp9_clear_system_state();
-
- calc_psnr(orig, pp, &psnr2);
-
- cpi->totalp += psnr2.psnr[0];
- cpi->totalp_y += psnr2.psnr[1];
- cpi->totalp_u += psnr2.psnr[2];
- cpi->totalp_v += psnr2.psnr[3];
- cpi->totalp_sq_error += psnr2.sse[0];
- cpi->totalp_samples += psnr2.samples[0];
-
- frame_ssim2 = vp9_calc_ssim(orig, recon, 1, &weight);
-
- cpi->summed_quality += frame_ssim2 * weight;
- cpi->summed_weights += weight;
-
- frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, 1, &weight);
-
- cpi->summedp_quality += frame_ssim2 * weight;
- cpi->summedp_weights += weight;
-#if 0
- {
- FILE *f = fopen("q_used.stt", "a");
- fprintf(f, "%5d : Y%f7.3:U%f7.3:V%f7.3:F%f7.3:S%7.3f\n",
- cpi->common.current_video_frame, y2, u2, v2,
- frame_psnr2, frame_ssim2);
- fclose(f);
- }
-#endif
- }
- }
-
- if (cpi->b_calculate_ssimg) {
- double y, u, v, frame_all;
- frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
- cpi->total_ssimg_y += y;
- cpi->total_ssimg_u += u;
- cpi->total_ssimg_v += v;
- cpi->total_ssimg_all += frame_all;
- }
- }
- }
-
-#endif
- return 0;
-}
-
-int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest,
- vp9_ppflags_t *flags) {
- VP9_COMMON *cm = &cpi->common;
-
- if (!cm->show_frame) {
- return -1;
- } else {
- int ret;
-#if CONFIG_VP9_POSTPROC
- ret = vp9_post_proc_frame(cm, dest, flags);
-#else
-
- if (cm->frame_to_show) {
- *dest = *cm->frame_to_show;
- dest->y_width = cm->width;
- dest->y_height = cm->height;
- dest->uv_width = cm->width >> cm->subsampling_x;
- dest->uv_height = cm->height >> cm->subsampling_y;
- ret = 0;
- } else {
- ret = -1;
- }
-
-#endif // !CONFIG_VP9_POSTPROC
- vp9_clear_system_state();
- return ret;
- }
-}
-
-int vp9_set_roimap(VP9_COMP *cpi, unsigned char *map, unsigned int rows,
- unsigned int cols, int delta_q[MAX_SEGMENTS],
- int delta_lf[MAX_SEGMENTS],
- unsigned int threshold[MAX_SEGMENTS]) {
- signed char feature_data[SEG_LVL_MAX][MAX_SEGMENTS];
- struct segmentation *seg = &cpi->common.seg;
- int i;
-
- if (cpi->common.mb_rows != rows || cpi->common.mb_cols != cols)
- return -1;
-
- if (!map) {
- vp9_disable_segmentation(seg);
- return 0;
- }
-
- // Set the segmentation Map
- vp9_set_segmentation_map(cpi, map);
-
- // Activate segmentation.
- vp9_enable_segmentation(seg);
-
- // Set up the quant, LF and breakout threshold segment data
- for (i = 0; i < MAX_SEGMENTS; i++) {
- feature_data[SEG_LVL_ALT_Q][i] = delta_q[i];
- feature_data[SEG_LVL_ALT_LF][i] = delta_lf[i];
- cpi->segment_encode_breakout[i] = threshold[i];
- }
-
- // Enable the loop and quant changes in the feature mask
- for (i = 0; i < MAX_SEGMENTS; i++) {
- if (delta_q[i])
- vp9_enable_segfeature(seg, i, SEG_LVL_ALT_Q);
- else
- vp9_disable_segfeature(seg, i, SEG_LVL_ALT_Q);
-
- if (delta_lf[i])
- vp9_enable_segfeature(seg, i, SEG_LVL_ALT_LF);
- else
- vp9_disable_segfeature(seg, i, SEG_LVL_ALT_LF);
- }
-
- // Initialize the feature data structure
- // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
- vp9_set_segment_data(seg, &feature_data[0][0], SEGMENT_DELTADATA);
-
- return 0;
-}
-
-int vp9_set_active_map(VP9_COMP *cpi, unsigned char *map,
- unsigned int rows, unsigned int cols) {
- if (rows == cpi->common.mb_rows && cols == cpi->common.mb_cols) {
- if (map) {
- vpx_memcpy(cpi->active_map, map, rows * cols);
- cpi->active_map_enabled = 1;
- } else {
- cpi->active_map_enabled = 0;
- }
-
- return 0;
- } else {
- // cpi->active_map_enabled = 0;
- return -1;
- }
-}
-
-int vp9_set_internal_size(VP9_COMP *cpi,
- VPX_SCALING horiz_mode, VPX_SCALING vert_mode) {
- VP9_COMMON *cm = &cpi->common;
- int hr = 0, hs = 0, vr = 0, vs = 0;
-
- if (horiz_mode > ONETWO || vert_mode > ONETWO)
- return -1;
-
- Scale2Ratio(horiz_mode, &hr, &hs);
- Scale2Ratio(vert_mode, &vr, &vs);
-
- // always go to the next whole number
- cm->width = (hs - 1 + cpi->oxcf.width * hr) / hs;
- cm->height = (vs - 1 + cpi->oxcf.height * vr) / vs;
-
- assert(cm->width <= cpi->initial_width);
- assert(cm->height <= cpi->initial_height);
- update_frame_size(cpi);
- return 0;
-}
-
-int vp9_set_size_literal(VP9_COMP *cpi, unsigned int width,
- unsigned int height) {
- VP9_COMMON *cm = &cpi->common;
-
- check_initial_width(cpi, 1, 1);
-
- if (width) {
- cm->width = width;
- if (cm->width * 5 < cpi->initial_width) {
- cm->width = cpi->initial_width / 5 + 1;
- printf("Warning: Desired width too small, changed to %d\n", cm->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 * 5 < cpi->initial_height) {
- cm->height = cpi->initial_height / 5 + 1;
- printf("Warning: Desired height too small, changed to %d\n", cm->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);
- update_frame_size(cpi);
- return 0;
-}
-
-void vp9_set_svc(VP9_COMP *cpi, int use_svc) {
- cpi->use_svc = use_svc;
- return;
-}
-
-int vp9_calc_ss_err(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *reference) {
- int i, j;
- int total = 0;
-
- const uint8_t *src = source->y_buffer;
- const uint8_t *ref = reference->y_buffer;
-
- // Loop through the Y plane raw and reconstruction data summing
- // (square differences)
- for (i = 0; i < source->y_height; i += 16) {
- for (j = 0; j < source->y_width; j += 16) {
- unsigned int sse;
- total += vp9_mse16x16(src + j, source->y_stride,
- ref + j, reference->y_stride, &sse);
- }
-
- src += 16 * source->y_stride;
- ref += 16 * reference->y_stride;
- }
-
- return total;
-}
-
-
-int vp9_get_quantizer(VP9_COMP *cpi) {
- return cpi->common.base_qindex;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_int.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_int.h
deleted file mode 100644
index d9dbd53..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_onyx_int.h
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_ONYX_INT_H_
-#define VP9_ENCODER_VP9_ONYX_INT_H_
-
-#include <stdio.h>
-
-#include "./vpx_config.h"
-#include "vpx_ports/mem.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "vpx/vp8cx.h"
-
-#include "vp9/common/vp9_ppflags.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-#include "vp9/encoder/vp9_aq_cyclicrefresh.h"
-#include "vp9/encoder/vp9_encodemb.h"
-#include "vp9/encoder/vp9_firstpass.h"
-#include "vp9/encoder/vp9_lookahead.h"
-#include "vp9/encoder/vp9_mbgraph.h"
-#include "vp9/encoder/vp9_mcomp.h"
-#include "vp9/encoder/vp9_quantize.h"
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_speed_features.h"
-#include "vp9/encoder/vp9_svc_layercontext.h"
-#include "vp9/encoder/vp9_tokenize.h"
-#include "vp9/encoder/vp9_variance.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// #define MODE_TEST_HIT_STATS
-
-#define DEFAULT_GF_INTERVAL 10
-
-#define MAX_MODES 30
-#define MAX_REFS 6
-
-typedef struct {
- int nmvjointcost[MV_JOINTS];
- int nmvcosts[2][MV_VALS];
- int nmvcosts_hp[2][MV_VALS];
-
- vp9_prob segment_pred_probs[PREDICTION_PROBS];
-
- unsigned char *last_frame_seg_map_copy;
-
- // 0 = Intra, Last, GF, ARF
- signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS];
- // 0 = ZERO_MV, MV
- signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS];
-
- FRAME_CONTEXT fc;
-} CODING_CONTEXT;
-
-// This enumerator type needs to be kept aligned with the mode order in
-// const MODE_DEFINITION vp9_mode_order[MAX_MODES] used in the rd code.
-typedef enum {
- THR_NEARESTMV,
- THR_NEARESTA,
- THR_NEARESTG,
-
- THR_DC,
-
- THR_NEWMV,
- THR_NEWA,
- THR_NEWG,
-
- THR_NEARMV,
- THR_NEARA,
- THR_COMP_NEARESTLA,
- THR_COMP_NEARESTGA,
-
- THR_TM,
-
- THR_COMP_NEARLA,
- THR_COMP_NEWLA,
- THR_NEARG,
- THR_COMP_NEARGA,
- THR_COMP_NEWGA,
-
- THR_ZEROMV,
- THR_ZEROG,
- THR_ZEROA,
- THR_COMP_ZEROLA,
- THR_COMP_ZEROGA,
-
- THR_H_PRED,
- THR_V_PRED,
- THR_D135_PRED,
- THR_D207_PRED,
- THR_D153_PRED,
- THR_D63_PRED,
- THR_D117_PRED,
- THR_D45_PRED,
-} THR_MODES;
-
-typedef enum {
- THR_LAST,
- THR_GOLD,
- THR_ALTR,
- THR_COMP_LA,
- THR_COMP_GA,
- THR_INTRA,
-} THR_MODES_SUB8X8;
-
-typedef enum {
- // encode_breakout is disabled.
- ENCODE_BREAKOUT_DISABLED = 0,
- // encode_breakout is enabled.
- ENCODE_BREAKOUT_ENABLED = 1,
- // encode_breakout is enabled with small max_thresh limit.
- ENCODE_BREAKOUT_LIMITED = 2
-} ENCODE_BREAKOUT_TYPE;
-
-typedef enum {
- NORMAL = 0,
- FOURFIVE = 1,
- THREEFIVE = 2,
- ONETWO = 3
-} VPX_SCALING;
-
-typedef enum {
- USAGE_LOCAL_FILE_PLAYBACK = 0,
- USAGE_STREAM_FROM_SERVER = 1,
- USAGE_CONSTRAINED_QUALITY = 2,
- USAGE_CONSTANT_QUALITY = 3,
-} END_USAGE;
-
-typedef enum {
- // Good Quality Fast Encoding. The encoder balances quality with the
- // amount of time it takes to encode the output. (speed setting
- // controls how fast)
- MODE_GOODQUALITY = 1,
-
- // One Pass - Best Quality. The encoder places priority on the
- // quality of the output over encoding speed. The output is compressed
- // at the highest possible quality. This option takes the longest
- // amount of time to encode. (speed setting ignored)
- MODE_BESTQUALITY = 2,
-
- // Two Pass - First Pass. The encoder generates a file of statistics
- // for use in the second encoding pass. (speed setting controls how fast)
- MODE_FIRSTPASS = 3,
-
- // Two Pass - Second Pass. The encoder uses the statistics that were
- // generated in the first encoding pass to create the compressed
- // output. (speed setting controls how fast)
- MODE_SECONDPASS = 4,
-
- // Two Pass - Second Pass Best. The encoder uses the statistics that
- // were generated in the first encoding pass to create the compressed
- // output using the highest possible quality, and taking a
- // longer amount of time to encode. (speed setting ignored)
- MODE_SECONDPASS_BEST = 5,
-
- // Realtime/Live Encoding. This mode is optimized for realtime
- // encoding (for example, capturing a television signal or feed from
- // a live camera). (speed setting controls how fast)
- MODE_REALTIME = 6,
-} MODE;
-
-typedef enum {
- FRAMEFLAGS_KEY = 1 << 0,
- FRAMEFLAGS_GOLDEN = 1 << 1,
- FRAMEFLAGS_ALTREF = 1 << 2,
-} FRAMETYPE_FLAGS;
-
-typedef enum {
- NO_AQ = 0,
- VARIANCE_AQ = 1,
- COMPLEXITY_AQ = 2,
- CYCLIC_REFRESH_AQ = 3,
- AQ_MODE_COUNT // This should always be the last member of the enum
-} AQ_MODE;
-
-typedef struct {
- int version; // 4 versions of bitstream defined:
- // 0 - best quality/slowest decode,
- // 3 - lowest quality/fastest decode
- int width; // width of data passed to the compressor
- int height; // height of data passed to the compressor
- double framerate; // set to passed in framerate
- int64_t target_bandwidth; // bandwidth to be used in kilobits per second
-
- int noise_sensitivity; // pre processing blur: recommendation 0
- int sharpness; // sharpening output: recommendation 0:
- int cpu_used;
- unsigned int rc_max_intra_bitrate_pct;
-
- MODE mode;
-
- // Key Framing Operations
- int auto_key; // autodetect cut scenes and set the keyframes
- int key_freq; // maximum distance to key frame.
-
- int lag_in_frames; // how many frames lag before we start encoding
-
- // ----------------------------------------------------------------
- // DATARATE CONTROL OPTIONS
-
- END_USAGE end_usage; // vbr or cbr
-
- // buffer targeting aggressiveness
- int under_shoot_pct;
- int over_shoot_pct;
-
- // buffering parameters
- int64_t starting_buffer_level; // in seconds
- int64_t optimal_buffer_level;
- int64_t maximum_buffer_size;
-
- // Frame drop threshold.
- int drop_frames_water_mark;
-
- // controlling quality
- int fixed_q;
- int worst_allowed_q;
- int best_allowed_q;
- int cq_level;
- int lossless;
- AQ_MODE aq_mode; // Adaptive Quantization mode
-
- // Enable feature to reduce the frame quantization every x frames.
- int frame_periodic_boost;
-
- // two pass datarate control
- int two_pass_vbrbias; // two pass datarate control tweaks
- int two_pass_vbrmin_section;
- int two_pass_vbrmax_section;
- // END DATARATE CONTROL OPTIONS
- // ----------------------------------------------------------------
-
- // Spatial and temporal scalability.
- int ss_number_layers; // Number of spatial layers.
- int ts_number_layers; // Number of temporal layers.
- // Bitrate allocation for spatial layers.
- int ss_target_bitrate[VPX_SS_MAX_LAYERS];
- // Bitrate allocation (CBR mode) and framerate factor, for temporal layers.
- int ts_target_bitrate[VPX_TS_MAX_LAYERS];
- int ts_rate_decimator[VPX_TS_MAX_LAYERS];
-
- // these parameters aren't to be used in final build don't use!!!
- int play_alternate;
- int alt_freq;
-
- int encode_breakout; // early breakout : for video conf recommend 800
-
- /* Bitfield defining the error resiliency features to enable.
- * Can provide decodable frames after losses in previous
- * frames and decodable partitions after losses in the same frame.
- */
- unsigned int error_resilient_mode;
-
- /* Bitfield defining the parallel decoding mode where the
- * decoding in successive frames may be conducted in parallel
- * just by decoding the frame headers.
- */
- unsigned int frame_parallel_decoding_mode;
-
- int arnr_max_frames;
- int arnr_strength;
- int arnr_type;
-
- int tile_columns;
- int tile_rows;
-
- struct vpx_fixed_buf two_pass_stats_in;
- struct vpx_codec_pkt_list *output_pkt_list;
-
- vp8e_tuning tuning;
-} VP9_CONFIG;
-
-typedef struct VP9_COMP {
- QUANTS quants;
- MACROBLOCK mb;
- VP9_COMMON common;
- VP9_CONFIG oxcf;
- struct lookahead_ctx *lookahead;
- struct lookahead_entry *source;
-#if CONFIG_MULTIPLE_ARF
- struct lookahead_entry *alt_ref_source[REF_FRAMES];
-#else
- struct lookahead_entry *alt_ref_source;
-#endif
- struct lookahead_entry *last_source;
-
- YV12_BUFFER_CONFIG *Source;
- YV12_BUFFER_CONFIG *Last_Source; // NULL for first frame and alt_ref frames
- YV12_BUFFER_CONFIG *un_scaled_source;
- YV12_BUFFER_CONFIG scaled_source;
- YV12_BUFFER_CONFIG *unscaled_last_source;
- YV12_BUFFER_CONFIG scaled_last_source;
-
- int key_frame_frequency;
-
- int gold_is_last; // gold same as last frame ( short circuit gold searches)
- int alt_is_last; // Alt same as last ( short circuit altref search)
- int gold_is_alt; // don't do both alt and gold search ( just do gold).
-
- int scaled_ref_idx[3];
- int lst_fb_idx;
- int gld_fb_idx;
- int alt_fb_idx;
-
-#if CONFIG_MULTIPLE_ARF
- int alt_ref_fb_idx[REF_FRAMES - 3];
-#endif
- int refresh_last_frame;
- int refresh_golden_frame;
- int refresh_alt_ref_frame;
-
- int ext_refresh_frame_flags_pending;
- int ext_refresh_last_frame;
- int ext_refresh_golden_frame;
- int ext_refresh_alt_ref_frame;
-
- int ext_refresh_frame_context_pending;
- int ext_refresh_frame_context;
-
- YV12_BUFFER_CONFIG last_frame_uf;
-
- TOKENEXTRA *tok;
- unsigned int tok_count[4][1 << 6];
-
-#if CONFIG_MULTIPLE_ARF
- // Position within a frame coding order (including any additional ARF frames).
- unsigned int sequence_number;
- // Next frame in naturally occurring order that has not yet been coded.
- int next_frame_in_order;
-#endif
-
- // Ambient reconstruction err target for force key frames
- int ambient_err;
-
- // Thresh_mult is used to set a threshold for the rd score. A higher value
- // means that we will accept the best mode so far more often. This number
- // is used in combination with the current block size, and thresh_freq_fact
- // to pick a threshold.
- int rd_thresh_mult[MAX_MODES];
- int rd_thresh_mult_sub8x8[MAX_REFS];
-
- int rd_threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES];
- int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES];
- int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS];
- int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS];
-
- int64_t rd_comp_pred_diff[REFERENCE_MODES];
- int64_t rd_prediction_type_threshes[MAX_REF_FRAMES][REFERENCE_MODES];
- int64_t rd_tx_select_diff[TX_MODES];
- // FIXME(rbultje) can this overflow?
- int rd_tx_select_threshes[MAX_REF_FRAMES][TX_MODES];
-
- int64_t rd_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
- int64_t rd_filter_threshes[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS];
- int64_t rd_filter_cache[SWITCHABLE_FILTER_CONTEXTS];
- int64_t mask_filter_rd;
-
- int RDMULT;
- int RDDIV;
-
- CODING_CONTEXT coding_context;
-
- int zbin_mode_boost;
- int zbin_mode_boost_enabled;
- int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames
- int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength
-
- double output_framerate;
- int64_t last_time_stamp_seen;
- int64_t last_end_time_stamp_seen;
- int64_t first_time_stamp_ever;
-
- RATE_CONTROL rc;
-
- int cq_target_quality;
-
- vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES];
- vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES];
-
- struct vpx_codec_pkt_list *output_pkt_list;
-
- MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS];
- int mbgraph_n_frames; // number of frames filled in the above
- int static_mb_pct; // % forced skip mbs by segmentation
- int seg0_progress, seg0_idx, seg0_cnt;
-
- // for real time encoding
- int speed;
-
- int cpu_used;
- int pass;
-
- int ref_frame_flags;
-
- SPEED_FEATURES sf;
-
- unsigned int max_mv_magnitude;
- int mv_step_param;
-
- // Default value is 1. From first pass stats, encode_breakout may be disabled.
- ENCODE_BREAKOUT_TYPE allow_encode_breakout;
-
- // Get threshold from external input. In real time mode, it can be
- // overwritten according to encoding speed.
- int encode_breakout;
-
- unsigned char *segmentation_map;
-
- // segment threashold for encode breakout
- int segment_encode_breakout[MAX_SEGMENTS];
-
- unsigned char *complexity_map;
-
- unsigned char *active_map;
- unsigned int active_map_enabled;
-
- CYCLIC_REFRESH *cyclic_refresh;
-
- fractional_mv_step_fp *find_fractional_mv_step;
- fractional_mv_step_comp_fp *find_fractional_mv_step_comp;
- vp9_full_search_fn_t full_search_sad;
- vp9_refining_search_fn_t refining_search_sad;
- vp9_diamond_search_fn_t diamond_search_sad;
- vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES];
- uint64_t time_receive_data;
- uint64_t time_compress_data;
- uint64_t time_pick_lpf;
- uint64_t time_encode_sb_row;
-
- struct twopass_rc twopass;
-
- YV12_BUFFER_CONFIG alt_ref_buffer;
- YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
- int fixed_divide[512];
-
-#if CONFIG_INTERNAL_STATS
- unsigned int mode_chosen_counts[MAX_MODES];
-
- int count;
- double total_y;
- double total_u;
- double total_v;
- double total;
- uint64_t total_sq_error;
- uint64_t total_samples;
-
- double totalp_y;
- double totalp_u;
- double totalp_v;
- double totalp;
- uint64_t totalp_sq_error;
- uint64_t totalp_samples;
-
- int bytes;
- double summed_quality;
- double summed_weights;
- double summedp_quality;
- double summedp_weights;
- unsigned int tot_recode_hits;
-
-
- double total_ssimg_y;
- double total_ssimg_u;
- double total_ssimg_v;
- double total_ssimg_all;
-
- int b_calculate_ssimg;
-#endif
- int b_calculate_psnr;
-
- // Per MB activity measurement
- unsigned int activity_avg;
- unsigned int *mb_activity_map;
- int *mb_norm_activity_map;
-
- int droppable;
-
- int dummy_packing; /* flag to indicate if packing is dummy */
-
- unsigned int tx_stepdown_count[TX_SIZES];
-
- int initial_width;
- int initial_height;
-
- int use_svc;
-
- SVC svc;
-
-#if CONFIG_MULTIPLE_ARF
- // ARF tracking variables.
- int multi_arf_enabled;
- unsigned int frame_coding_order_period;
- unsigned int new_frame_coding_order_period;
- int frame_coding_order[MAX_LAG_BUFFERS * 2];
- int arf_buffer_idx[MAX_LAG_BUFFERS * 3 / 2];
- int arf_weight[MAX_LAG_BUFFERS];
- int arf_buffered;
- int this_frame_weight;
- int max_arf_level;
-#endif
-
-#ifdef MODE_TEST_HIT_STATS
- // Debug / test stats
- int64_t mode_test_hits[BLOCK_SIZES];
-#endif
-} VP9_COMP;
-
-void vp9_initialize_enc();
-
-struct VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf);
-void vp9_remove_compressor(VP9_COMP *cpi);
-
-void vp9_change_config(VP9_COMP *cpi, const VP9_CONFIG *oxcf);
-
- // receive a frames worth of data. caller can assume that a copy of this
- // frame is made and not just a copy of the pointer..
-int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags,
- YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
- int64_t end_time_stamp);
-
-int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
- size_t *size, uint8_t *dest,
- int64_t *time_stamp, int64_t *time_end, int flush);
-
-int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest,
- vp9_ppflags_t *flags);
-
-int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags);
-
-void vp9_update_reference(VP9_COMP *cpi, int ref_frame_flags);
-
-int vp9_copy_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd);
-
-int vp9_get_reference_enc(VP9_COMP *cpi, int index,
- YV12_BUFFER_CONFIG **fb);
-
-int vp9_set_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
- YV12_BUFFER_CONFIG *sd);
-
-int vp9_update_entropy(VP9_COMP *cpi, int update);
-
-int vp9_set_roimap(VP9_COMP *cpi, unsigned char *map,
- unsigned int rows, unsigned int cols,
- int delta_q[MAX_SEGMENTS],
- int delta_lf[MAX_SEGMENTS],
- unsigned int threshold[MAX_SEGMENTS]);
-
-int vp9_set_active_map(VP9_COMP *cpi, unsigned char *map,
- unsigned int rows, unsigned int cols);
-
-int vp9_set_internal_size(VP9_COMP *cpi,
- VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
-
-int vp9_set_size_literal(VP9_COMP *cpi, unsigned int width,
- unsigned int height);
-
-void vp9_set_svc(VP9_COMP *cpi, int use_svc);
-
-int vp9_get_quantizer(struct VP9_COMP *cpi);
-
-static INLINE int get_ref_frame_idx(const VP9_COMP *cpi,
- MV_REFERENCE_FRAME ref_frame) {
- if (ref_frame == LAST_FRAME) {
- return cpi->lst_fb_idx;
- } else if (ref_frame == GOLDEN_FRAME) {
- return cpi->gld_fb_idx;
- } else {
- return cpi->alt_fb_idx;
- }
-}
-
-static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer(
- VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
- VP9_COMMON * const cm = &cpi->common;
- return &cm->frame_bufs[cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]]
- .buf;
-}
-
-// Intra only frames, golden frames (except alt ref overlays) and
-// alt ref frames tend to be coded at a higher than ambient quality
-static INLINE int vp9_frame_is_boosted(const VP9_COMP *cpi) {
- return frame_is_intra_only(&cpi->common) || cpi->refresh_alt_ref_frame ||
- (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref);
-}
-
-static INLINE int get_token_alloc(int mb_rows, int mb_cols) {
- // TODO(JBB): make this work for alpha channel and double check we can't
- // exceed this token count if we have a 32x32 transform crossing a boundary
- // at a multiple of 16.
- // mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full
- // resolution. We assume up to 1 token per pixel, and then allow
- // a head room of 4.
- return mb_rows * mb_cols * (16 * 16 * 3 + 4);
-}
-
-int vp9_calc_ss_err(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *reference);
-
-void vp9_alloc_compressor_data(VP9_COMP *cpi);
-
-int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget);
-
-int vp9_compute_qdelta_by_rate(VP9_COMP *cpi, int base_q_index,
- double rate_target_ratio);
-
-void vp9_scale_references(VP9_COMP *cpi);
-
-void vp9_update_reference_frames(VP9_COMP *cpi);
-
-extern const int q_trans[];
-
-int64_t vp9_rescale(int64_t val, int64_t num, int denom);
-
-static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd,
- MV_REFERENCE_FRAME ref0,
- MV_REFERENCE_FRAME ref1) {
- xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME
- : 0];
- xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME
- : 0];
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_ONYX_INT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.c
deleted file mode 100644
index 92ad1e7..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <limits.h>
-
-#include "./vpx_scale_rtcd.h"
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_quant_common.h"
-
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_picklpf.h"
-#include "vp9/encoder/vp9_quantize.h"
-
-static int get_max_filter_level(VP9_COMP *cpi) {
- return cpi->twopass.section_intra_rating > 8 ? MAX_LOOP_FILTER * 3 / 4
- : MAX_LOOP_FILTER;
-}
-
-
-static int try_filter_frame(const YV12_BUFFER_CONFIG *sd, VP9_COMP *const cpi,
- int filt_level, int partial_frame) {
- VP9_COMMON *const cm = &cpi->common;
- int filt_err;
-
- vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, filt_level, 1, partial_frame);
- filt_err = vp9_calc_ss_err(sd, cm->frame_to_show);
-
- // Re-instate the unfiltered frame
- vpx_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
-
- return filt_err;
-}
-
-static void search_filter_level(const YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi,
- int partial_frame) {
- VP9_COMMON *const cm = &cpi->common;
- struct loopfilter *const lf = &cm->lf;
- const int min_filter_level = 0;
- const int max_filter_level = get_max_filter_level(cpi);
- int best_err;
- int filt_best;
- int filt_direction = 0;
- // Start the search at the previous frame filter level unless it is now out of
- // range.
- int filt_mid = clamp(lf->filter_level, min_filter_level, max_filter_level);
- int filter_step = filt_mid < 16 ? 4 : filt_mid / 4;
- // Sum squared error at each filter level
- int ss_err[MAX_LOOP_FILTER + 1];
-
- // Set each entry to -1
- vpx_memset(ss_err, 0xFF, sizeof(ss_err));
-
- // Make a copy of the unfiltered / processed recon buffer
- vpx_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf);
-
- best_err = try_filter_frame(sd, cpi, filt_mid, partial_frame);
- filt_best = filt_mid;
- ss_err[filt_mid] = best_err;
-
- while (filter_step > 0) {
- const int filt_high = MIN(filt_mid + filter_step, max_filter_level);
- const int filt_low = MAX(filt_mid - filter_step, min_filter_level);
- int filt_err;
-
- // Bias against raising loop filter in favor of lowering it.
- int bias = (best_err >> (15 - (filt_mid / 8))) * filter_step;
-
- if (cpi->twopass.section_intra_rating < 20)
- bias = bias * cpi->twopass.section_intra_rating / 20;
-
- // yx, bias less for large block size
- if (cm->tx_mode != ONLY_4X4)
- bias >>= 1;
-
- if (filt_direction <= 0 && filt_low != filt_mid) {
- // Get Low filter error score
- if (ss_err[filt_low] < 0) {
- filt_err = try_filter_frame(sd, cpi, filt_low, partial_frame);
- ss_err[filt_low] = filt_err;
- } else {
- filt_err = ss_err[filt_low];
- }
- // If value is close to the best so far then bias towards a lower loop
- // filter value.
- if ((filt_err - bias) < best_err) {
- // Was it actually better than the previous best?
- if (filt_err < best_err)
- best_err = filt_err;
-
- filt_best = filt_low;
- }
- }
-
- // Now look at filt_high
- if (filt_direction >= 0 && filt_high != filt_mid) {
- if (ss_err[filt_high] < 0) {
- filt_err = try_filter_frame(sd, cpi, filt_high, partial_frame);
- ss_err[filt_high] = filt_err;
- } else {
- filt_err = ss_err[filt_high];
- }
- // Was it better than the previous best?
- if (filt_err < (best_err - bias)) {
- best_err = filt_err;
- filt_best = filt_high;
- }
- }
-
- // Half the step distance if the best filter value was the same as last time
- if (filt_best == filt_mid) {
- filter_step /= 2;
- filt_direction = 0;
- } else {
- filt_direction = (filt_best < filt_mid) ? -1 : 1;
- filt_mid = filt_best;
- }
- }
-
- lf->filter_level = filt_best;
-}
-
-void vp9_pick_filter_level(const YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi,
- LPF_PICK_METHOD method) {
- VP9_COMMON *const cm = &cpi->common;
- struct loopfilter *const lf = &cm->lf;
-
- lf->sharpness_level = cm->frame_type == KEY_FRAME ? 0
- : cpi->oxcf.sharpness;
-
- if (method == LPF_PICK_FROM_Q) {
- const int min_filter_level = 0;
- const int max_filter_level = get_max_filter_level(cpi);
- const int q = vp9_ac_quant(cm->base_qindex, 0);
- // These values were determined by linear fitting the result of the
- // searched level, filt_guess = q * 0.316206 + 3.87252
- int filt_guess = ROUND_POWER_OF_TWO(q * 20723 + 1015158, 18);
- if (cm->frame_type == KEY_FRAME)
- filt_guess -= 4;
- lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level);
- } else {
- search_filter_level(sd, cpi, method == LPF_PICK_FROM_SUBIMAGE);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.h
deleted file mode 100644
index 7d08ddb..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_picklpf.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_PICKLPF_H_
-#define VP9_ENCODER_VP9_PICKLPF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "vp9/encoder/vp9_onyx_int.h"
-
-struct yv12_buffer_config;
-struct VP9_COMP;
-
-void vp9_pick_filter_level(const struct yv12_buffer_config *sd,
- struct VP9_COMP *cpi, LPF_PICK_METHOD method);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_PICKLPF_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.c
deleted file mode 100644
index f987de5..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-
-#include "./vp9_rtcd.h"
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_mvref_common.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_reconintra.h"
-
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_rdopt.h"
-
-static void full_pixel_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- BLOCK_SIZE bsize, int mi_row, int mi_col,
- int_mv *tmp_mv) {
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}};
- int step_param;
- int sadpb = x->sadperbit16;
- MV mvp_full;
- int ref = mbmi->ref_frame[0];
- const MV ref_mv = mbmi->ref_mvs[ref][0].as_mv;
- int i;
-
- int tmp_col_min = x->mv_col_min;
- int tmp_col_max = x->mv_col_max;
- int tmp_row_min = x->mv_row_min;
- int tmp_row_max = x->mv_row_max;
-
- const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
- 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[0];
-
- vp9_setup_pre_planes(xd, 0, scaled_ref_frame, mi_row, mi_col, NULL);
- }
-
- vp9_set_mv_search_range(x, &ref_mv);
-
- // TODO(jingning) exploiting adaptive motion search control in non-RD
- // mode decision too.
- step_param = 6;
-
- for (i = LAST_FRAME; i <= LAST_FRAME && cpi->common.show_frame; ++i) {
- if ((x->pred_mv_sad[ref] >> 3) > x->pred_mv_sad[i]) {
- tmp_mv->as_int = INVALID_MV;
-
- if (scaled_ref_frame) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++)
- xd->plane[i].pre[0] = backup_yv12[i];
- }
- return;
- }
- }
- assert(x->mv_best_ref_index[ref] <= 2);
- if (x->mv_best_ref_index[ref] < 2)
- mvp_full = mbmi->ref_mvs[ref][x->mv_best_ref_index[ref]].as_mv;
- else
- mvp_full = x->pred_mv[ref].as_mv;
-
- mvp_full.col >>= 3;
- mvp_full.row >>= 3;
-
- if (cpi->sf.search_method == FAST_DIAMOND) {
- // NOTE: this returns SAD
- vp9_fast_dia_search(x, &mvp_full, step_param, sadpb, 0,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- } else if (cpi->sf.search_method == FAST_HEX) {
- // NOTE: this returns SAD
- vp9_fast_hex_search(x, &mvp_full, step_param, sadpb, 0,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- } else if (cpi->sf.search_method == HEX) {
- // NOTE: this returns SAD
- vp9_hex_search(x, &mvp_full, step_param, sadpb, 1,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- } else if (cpi->sf.search_method == SQUARE) {
- // NOTE: this returns SAD
- vp9_square_search(x, &mvp_full, step_param, sadpb, 1,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- } else if (cpi->sf.search_method == BIGDIA) {
- // NOTE: this returns SAD
- vp9_bigdia_search(x, &mvp_full, step_param, sadpb, 1,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- } else {
- int further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
- // NOTE: this returns variance
- vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
- sadpb, further_steps, 1,
- &cpi->fn_ptr[bsize],
- &ref_mv, &tmp_mv->as_mv);
- }
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
-
- if (scaled_ref_frame) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++)
- xd->plane[i].pre[0] = backup_yv12[i];
- }
-}
-
-static void sub_pixel_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- BLOCK_SIZE bsize, int mi_row, int mi_col,
- MV *tmp_mv, int *rate_mv) {
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}};
- int ref = mbmi->ref_frame[0];
- MV ref_mv = mbmi->ref_mvs[ref][0].as_mv;
- int dis;
-
- const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
- 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[0];
-
- vp9_setup_pre_planes(xd, 0, scaled_ref_frame, mi_row, mi_col, NULL);
- }
-
- cpi->find_fractional_mv_step(x, tmp_mv, &ref_mv,
- cpi->common.allow_high_precision_mv,
- x->errorperbit,
- &cpi->fn_ptr[bsize],
- cpi->sf.subpel_force_stop,
- cpi->sf.subpel_iters_per_step,
- x->nmvjointcost, x->mvcost,
- &dis, &x->pred_sse[ref]);
-
- // calculate the bit cost on motion vector
- *rate_mv = vp9_mv_bit_cost(tmp_mv, &ref_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
-
- if (scaled_ref_frame) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++)
- xd->plane[i].pre[0] = backup_yv12[i];
- }
-
- x->pred_mv[ref].as_mv = *tmp_mv;
-}
-
-static void model_rd_for_sb_y(VP9_COMP *cpi, BLOCK_SIZE bsize,
- MACROBLOCK *x, MACROBLOCKD *xd,
- int *out_rate_sum, int64_t *out_dist_sum) {
- // Note our transform coeffs are 8 times an orthogonal transform.
- // Hence quantizer step is also 8 times. To get effective quantizer
- // we need to divide by 8 before sending to modeling function.
- unsigned int sse;
- int rate;
- int64_t dist;
-
- struct macroblock_plane *const p = &x->plane[0];
- struct macroblockd_plane *const pd = &xd->plane[0];
-
- int var = cpi->fn_ptr[bsize].vf(p->src.buf, p->src.stride,
- pd->dst.buf, pd->dst.stride, &sse);
-
- vp9_model_rd_from_var_lapndz(sse + var, 1 << num_pels_log2_lookup[bsize],
- pd->dequant[1] >> 3, &rate, &dist);
- *out_rate_sum = rate;
- *out_dist_sum = dist << 3;
-}
-
-// TODO(jingning) placeholder for inter-frame non-RD mode decision.
-// this needs various further optimizations. to be continued..
-int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- int mi_row, int mi_col,
- int *returnrate,
- int64_t *returndistortion,
- BLOCK_SIZE bsize) {
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- struct macroblock_plane *const p = &x->plane[0];
- struct macroblockd_plane *const pd = &xd->plane[0];
- MB_PREDICTION_MODE this_mode, best_mode = ZEROMV;
- MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME;
- int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
- struct buf_2d yv12_mb[4][MAX_MB_PLANE];
- static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
- VP9_ALT_FLAG };
- int64_t best_rd = INT64_MAX;
- int64_t this_rd = INT64_MAX;
-
- int rate = INT_MAX;
- int64_t dist = INT64_MAX;
-
- VP9_COMMON *cm = &cpi->common;
- int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q);
-
- const int64_t inter_mode_thresh = RDCOST(x->rdmult, x->rddiv,
- intra_cost_penalty, 0);
- const int64_t intra_mode_cost = 50;
-
- unsigned char segment_id = mbmi->segment_id;
- const int *const rd_threshes = cpi->rd_threshes[segment_id][bsize];
- const int *const rd_thresh_freq_fact = cpi->rd_thresh_freq_fact[bsize];
- // Mode index conversion form THR_MODES to MB_PREDICTION_MODE for a ref frame.
- int mode_idx[MB_MODE_COUNT] = {0};
-
- x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH;
-
- x->skip = 0;
- if (!x->in_active_map)
- x->skip = 1;
- // initialize mode decisions
- *returnrate = INT_MAX;
- *returndistortion = INT64_MAX;
- vpx_memset(mbmi, 0, sizeof(MB_MODE_INFO));
- mbmi->sb_type = bsize;
- mbmi->ref_frame[0] = NONE;
- mbmi->ref_frame[1] = NONE;
- mbmi->tx_size = MIN(max_txsize_lookup[bsize],
- tx_mode_to_biggest_tx_size[cpi->common.tx_mode]);
- mbmi->interp_filter = cpi->common.interp_filter == SWITCHABLE ?
- EIGHTTAP : cpi->common.interp_filter;
- mbmi->skip = 0;
- mbmi->segment_id = segment_id;
-
- for (ref_frame = LAST_FRAME; ref_frame <= LAST_FRAME ; ++ref_frame) {
- x->pred_mv_sad[ref_frame] = INT_MAX;
- if (cpi->ref_frame_flags & flag_list[ref_frame]) {
- vp9_setup_buffer_inter(cpi, x, tile,
- ref_frame, bsize, mi_row, mi_col,
- frame_mv[NEARESTMV], frame_mv[NEARMV], yv12_mb);
- }
- frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
- frame_mv[ZEROMV][ref_frame].as_int = 0;
- }
-
- for (ref_frame = LAST_FRAME; ref_frame <= LAST_FRAME ; ++ref_frame) {
- if (!(cpi->ref_frame_flags & flag_list[ref_frame]))
- continue;
-
- // Select prediction reference frames.
- xd->plane[0].pre[0] = yv12_mb[ref_frame][0];
-
- clamp_mv2(&frame_mv[NEARESTMV][ref_frame].as_mv, xd);
- clamp_mv2(&frame_mv[NEARMV][ref_frame].as_mv, xd);
-
- mbmi->ref_frame[0] = ref_frame;
-
- // Set conversion index for LAST_FRAME.
- if (ref_frame == LAST_FRAME) {
- mode_idx[NEARESTMV] = THR_NEARESTMV; // LAST_FRAME, NEARESTMV
- mode_idx[NEARMV] = THR_NEARMV; // LAST_FRAME, NEARMV
- mode_idx[ZEROMV] = THR_ZEROMV; // LAST_FRAME, ZEROMV
- mode_idx[NEWMV] = THR_NEWMV; // LAST_FRAME, NEWMV
- }
-
- for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {
- int rate_mv = 0;
-
- if (cpi->sf.disable_inter_mode_mask[bsize] &
- (1 << INTER_OFFSET(this_mode)))
- continue;
-
- if (best_rd < ((int64_t)rd_threshes[mode_idx[this_mode]] *
- rd_thresh_freq_fact[this_mode] >> 5) ||
- rd_threshes[mode_idx[this_mode]] == INT_MAX)
- continue;
-
- if (this_mode == NEWMV) {
- if (this_rd < (int64_t)(1 << num_pels_log2_lookup[bsize]))
- continue;
-
- full_pixel_motion_search(cpi, x, tile, bsize, mi_row, mi_col,
- &frame_mv[NEWMV][ref_frame]);
-
- if (frame_mv[NEWMV][ref_frame].as_int == INVALID_MV)
- continue;
-
- sub_pixel_motion_search(cpi, x, tile, bsize, mi_row, mi_col,
- &frame_mv[NEWMV][ref_frame].as_mv, &rate_mv);
- }
-
- if (this_mode != NEARESTMV)
- if (frame_mv[this_mode][ref_frame].as_int ==
- frame_mv[NEARESTMV][ref_frame].as_int)
- continue;
-
- mbmi->mode = this_mode;
- mbmi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int;
- vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
-
- model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist);
- rate += rate_mv;
- rate += x->inter_mode_cost[mbmi->mode_context[ref_frame]]
- [INTER_OFFSET(this_mode)];
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist);
-
- if (this_rd < best_rd) {
- best_rd = this_rd;
- *returnrate = rate;
- *returndistortion = dist;
- best_mode = this_mode;
- best_ref_frame = ref_frame;
- }
- }
- }
-
- mbmi->mode = best_mode;
- mbmi->ref_frame[0] = best_ref_frame;
- mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int;
- xd->mi[0]->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int;
-
- // Perform intra prediction search, if the best SAD is above a certain
- // threshold.
- if (best_rd > inter_mode_thresh) {
- for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) {
- vp9_predict_intra_block(xd, 0, b_width_log2(bsize),
- mbmi->tx_size, this_mode,
- &p->src.buf[0], p->src.stride,
- &pd->dst.buf[0], pd->dst.stride, 0, 0, 0);
-
- model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist);
- rate += x->mbmode_cost[this_mode];
- rate += intra_cost_penalty;
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, dist);
-
- if (this_rd + intra_mode_cost < best_rd) {
- best_rd = this_rd;
- *returnrate = rate;
- *returndistortion = dist;
- mbmi->mode = this_mode;
- mbmi->ref_frame[0] = INTRA_FRAME;
- mbmi->uv_mode = this_mode;
- mbmi->mv[0].as_int = INVALID_MV;
- }
- }
- }
-
- return INT64_MAX;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.h
deleted file mode 100644
index 05ff187..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_pickmode.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_PICKMODE_H_
-#define VP9_ENCODER_VP9_PICKMODE_H_
-
-#include "vp9/encoder/vp9_onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
- const struct TileInfo *const tile,
- int mi_row, int mi_col,
- int *returnrate,
- int64_t *returndistortion,
- BLOCK_SIZE bsize);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_PICKMODE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.c
deleted file mode 100644
index c092ee4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_seg_common.h"
-
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_quantize.h"
-#include "vp9/encoder/vp9_rdopt.h"
-
-void vp9_quantize_b_c(const int16_t *coeff_ptr, intptr_t count,
- 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,
- int zbin_oq_value, uint16_t *eob_ptr,
- const int16_t *scan, const int16_t *iscan) {
- int i, non_zero_count = (int)count, eob = -1;
- const int zbins[2] = { zbin_ptr[0] + zbin_oq_value,
- zbin_ptr[1] + zbin_oq_value };
- const int nzbins[2] = { zbins[0] * -1,
- zbins[1] * -1 };
-
- vpx_memset(qcoeff_ptr, 0, count * sizeof(int16_t));
- vpx_memset(dqcoeff_ptr, 0, count * sizeof(int16_t));
-
- if (!skip_block) {
- // Pre-scan pass
- for (i = (int)count - 1; i >= 0; i--) {
- const int rc = scan[i];
- const int coeff = coeff_ptr[rc];
-
- if (coeff < zbins[rc != 0] && coeff > nzbins[rc != 0])
- non_zero_count--;
- else
- break;
- }
-
- // Quantization pass: All coefficients with index >= zero_flag are
- // skippable. Note: zero_flag can be zero.
- for (i = 0; i < non_zero_count; i++) {
- const int rc = scan[i];
- const int coeff = coeff_ptr[rc];
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
-
- if (abs_coeff >= zbins[rc != 0]) {
- int tmp = clamp(abs_coeff + round_ptr[rc != 0], INT16_MIN, INT16_MAX);
- tmp = ((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) *
- quant_shift_ptr[rc != 0]) >> 16; // quantization
- qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
- dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0];
-
- if (tmp)
- eob = i;
- }
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void vp9_quantize_b_32x32_c(const int16_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,
- int zbin_oq_value, uint16_t *eob_ptr,
- const int16_t *scan, const int16_t *iscan) {
- const int zbins[2] = { ROUND_POWER_OF_TWO(zbin_ptr[0] + zbin_oq_value, 1),
- ROUND_POWER_OF_TWO(zbin_ptr[1] + zbin_oq_value, 1) };
- const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1};
-
- int idx = 0;
- int idx_arr[1024];
- int i, eob = -1;
-
- vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(int16_t));
- vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(int16_t));
-
- if (!skip_block) {
- // Pre-scan pass
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const int coeff = coeff_ptr[rc];
-
- // If the coefficient is out of the base ZBIN range, keep it for
- // quantization.
- if (coeff >= zbins[rc != 0] || coeff <= nzbins[rc != 0])
- idx_arr[idx++] = i;
- }
-
- // Quantization pass: only process the coefficients selected in
- // pre-scan pass. Note: idx can be zero.
- for (i = 0; i < idx; i++) {
- const int rc = scan[idx_arr[i]];
- const int coeff = coeff_ptr[rc];
- const int coeff_sign = (coeff >> 31);
- int tmp;
- int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- abs_coeff += ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1);
- abs_coeff = clamp(abs_coeff, INT16_MIN, INT16_MAX);
- tmp = ((((abs_coeff * quant_ptr[rc != 0]) >> 16) + abs_coeff) *
- quant_shift_ptr[rc != 0]) >> 15;
-
- qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
- dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2;
-
- if (tmp)
- eob = idx_arr[i];
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
- const int16_t *scan, const int16_t *iscan) {
- MACROBLOCKD *const xd = &x->e_mbd;
- struct macroblock_plane *p = &x->plane[plane];
- struct macroblockd_plane *pd = &xd->plane[plane];
-
- vp9_quantize_b(BLOCK_OFFSET(p->coeff, block),
- 16, x->skip_block,
- p->zbin, p->round, p->quant, p->quant_shift,
- BLOCK_OFFSET(p->qcoeff, block),
- BLOCK_OFFSET(pd->dqcoeff, block),
- pd->dequant, p->zbin_extra, &p->eobs[block], scan, iscan);
-}
-
-static void invert_quant(int16_t *quant, int16_t *shift, int d) {
- unsigned t;
- int l;
- t = d;
- for (l = 0; t > 1; l++)
- t >>= 1;
- t = 1 + (1 << (16 + l)) / d;
- *quant = (int16_t)(t - (1 << 16));
- *shift = 1 << (16 - l);
-}
-
-void vp9_init_quantizer(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- QUANTS *const quants = &cpi->quants;
- int i, q, quant;
-
- for (q = 0; q < QINDEX_RANGE; q++) {
- const int qzbin_factor = q == 0 ? 64 : (vp9_dc_quant(q, 0) < 148 ? 84 : 80);
- const int qrounding_factor = q == 0 ? 64 : 48;
-
- for (i = 0; i < 2; ++i) {
- // y
- quant = i == 0 ? vp9_dc_quant(q, cm->y_dc_delta_q)
- : vp9_ac_quant(q, 0);
- invert_quant(&quants->y_quant[q][i], &quants->y_quant_shift[q][i], quant);
- quants->y_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
- quants->y_round[q][i] = (qrounding_factor * quant) >> 7;
- cm->y_dequant[q][i] = quant;
-
- // uv
- quant = i == 0 ? vp9_dc_quant(q, cm->uv_dc_delta_q)
- : vp9_ac_quant(q, cm->uv_ac_delta_q);
- invert_quant(&quants->uv_quant[q][i],
- &quants->uv_quant_shift[q][i], quant);
- quants->uv_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
- quants->uv_round[q][i] = (qrounding_factor * quant) >> 7;
- cm->uv_dequant[q][i] = quant;
-
-#if CONFIG_ALPHA
- // alpha
- quant = i == 0 ? vp9_dc_quant(q, cm->a_dc_delta_q)
- : vp9_ac_quant(q, cm->a_ac_delta_q);
- invert_quant(&quants->a_quant[q][i], &quants->a_quant_shift[q][i], quant);
- quants->a_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
- quants->a_round[q][i] = (qrounding_factor * quant) >> 7;
- cm->a_dequant[q][i] = quant;
-#endif
- }
-
- for (i = 2; i < 8; i++) {
- quants->y_quant[q][i] = quants->y_quant[q][1];
- 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];
- cm->y_dequant[q][i] = cm->y_dequant[q][1];
-
- quants->uv_quant[q][i] = quants->uv_quant[q][1];
- 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];
- cm->uv_dequant[q][i] = cm->uv_dequant[q][1];
-
-#if CONFIG_ALPHA
- quants->a_quant[q][i] = quants->a_quant[q][1];
- quants->a_quant_shift[q][i] = quants->a_quant_shift[q][1];
- quants->a_zbin[q][i] = quants->a_zbin[q][1];
- quants->a_round[q][i] = quants->a_round[q][1];
- cm->a_dequant[q][i] = cm->a_dequant[q][1];
-#endif
- }
- }
-}
-
-void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) {
- const VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- QUANTS *const quants = &cpi->quants;
- const int segment_id = xd->mi[0]->mbmi.segment_id;
- const int qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex);
- const int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
- const int zbin = cpi->zbin_mode_boost + x->act_zbin_adj;
- int i;
-
- // Y
- x->plane[0].quant = quants->y_quant[qindex];
- x->plane[0].quant_shift = quants->y_quant_shift[qindex];
- x->plane[0].zbin = quants->y_zbin[qindex];
- x->plane[0].round = quants->y_round[qindex];
- x->plane[0].zbin_extra = (int16_t)((cm->y_dequant[qindex][1] * zbin) >> 7);
- xd->plane[0].dequant = cm->y_dequant[qindex];
-
- // UV
- for (i = 1; i < 3; i++) {
- x->plane[i].quant = quants->uv_quant[qindex];
- x->plane[i].quant_shift = quants->uv_quant_shift[qindex];
- x->plane[i].zbin = quants->uv_zbin[qindex];
- x->plane[i].round = quants->uv_round[qindex];
- x->plane[i].zbin_extra = (int16_t)((cm->uv_dequant[qindex][1] * zbin) >> 7);
- xd->plane[i].dequant = cm->uv_dequant[qindex];
- }
-
-#if CONFIG_ALPHA
- x->plane[3].quant = cpi->a_quant[qindex];
- x->plane[3].quant_shift = cpi->a_quant_shift[qindex];
- x->plane[3].zbin = cpi->a_zbin[qindex];
- x->plane[3].round = cpi->a_round[qindex];
- x->plane[3].zbin_extra = (int16_t)((cm->a_dequant[qindex][1] * zbin) >> 7);
- xd->plane[3].dequant = cm->a_dequant[qindex];
-#endif
-
- x->skip_block = vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP);
- x->q_index = qindex;
-
- x->errorperbit = rdmult >> 6;
- x->errorperbit += (x->errorperbit == 0);
-
- vp9_initialize_me_consts(cpi, x->q_index);
-}
-
-void vp9_update_zbin_extra(VP9_COMP *cpi, MACROBLOCK *x) {
- const int qindex = x->q_index;
- const int y_zbin_extra = (cpi->common.y_dequant[qindex][1] *
- (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
- const int uv_zbin_extra = (cpi->common.uv_dequant[qindex][1] *
- (cpi->zbin_mode_boost + x->act_zbin_adj)) >> 7;
-
- x->plane[0].zbin_extra = (int16_t)y_zbin_extra;
- x->plane[1].zbin_extra = (int16_t)uv_zbin_extra;
- x->plane[2].zbin_extra = (int16_t)uv_zbin_extra;
-}
-
-void vp9_frame_init_quantizer(VP9_COMP *cpi) {
- cpi->zbin_mode_boost = 0;
- vp9_init_plane_quantizers(cpi, &cpi->mb);
-}
-
-void vp9_set_quantizer(VP9_COMMON *cm, int q) {
- // quantizer has to be reinitialized with vp9_init_quantizer() if any
- // delta_q changes.
- cm->base_qindex = q;
- cm->y_dc_delta_q = 0;
- cm->uv_dc_delta_q = 0;
- cm->uv_ac_delta_q = 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.h
deleted file mode 100644
index 7d231df..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_quantize.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_QUANTIZE_H_
-#define VP9_ENCODER_VP9_QUANTIZE_H_
-
-#include "vp9/encoder/vp9_block.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, y_zbin[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, y_round[QINDEX_RANGE][8]);
-
- DECLARE_ALIGNED(16, int16_t, uv_quant[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]);
-
-#if CONFIG_ALPHA
- DECLARE_ALIGNED(16, int16_t, a_quant[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, a_quant_shift[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, a_zbin[QINDEX_RANGE][8]);
- DECLARE_ALIGNED(16, int16_t, a_round[QINDEX_RANGE][8]);
-#endif
-} QUANTS;
-
-void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
- const int16_t *scan, const int16_t *iscan);
-
-struct VP9_COMP;
-struct VP9Common;
-
-void vp9_frame_init_quantizer(struct VP9_COMP *cpi);
-
-void vp9_update_zbin_extra(struct VP9_COMP *cpi, MACROBLOCK *x);
-
-void vp9_init_plane_quantizers(struct VP9_COMP *cpi, MACROBLOCK *x);
-
-void vp9_init_quantizer(struct VP9_COMP *cpi);
-
-void vp9_set_quantizer(struct VP9Common *cm, int q);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_QUANTIZE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.c
deleted file mode 100644
index eb4db1a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.c
+++ /dev/null
@@ -1,1329 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_alloccommon.h"
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_seg_common.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-#include "vp9/encoder/vp9_encodemv.h"
-#include "vp9/encoder/vp9_ratectrl.h"
-
-#define DEFAULT_KF_BOOST 2000
-#define DEFAULT_GF_BOOST 2000
-
-#define LIMIT_QRANGE_FOR_ALTREF_AND_KEY 1
-
-#define MIN_BPB_FACTOR 0.005
-#define MAX_BPB_FACTOR 50
-
-// Bits Per MB at different Q (Multiplied by 512)
-#define BPER_MB_NORMBITS 9
-
-// Tables relating active max Q to active min Q
-static int kf_low_motion_minq[QINDEX_RANGE];
-static int kf_high_motion_minq[QINDEX_RANGE];
-static int gf_low_motion_minq[QINDEX_RANGE];
-static int gf_high_motion_minq[QINDEX_RANGE];
-static int inter_minq[QINDEX_RANGE];
-static int afq_low_motion_minq[QINDEX_RANGE];
-static int afq_high_motion_minq[QINDEX_RANGE];
-static int gf_high = 2000;
-static int gf_low = 400;
-static int kf_high = 5000;
-static int kf_low = 400;
-
-// 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
-// fit to the original data (after plotting real maxq vs minq (not q index))
-static int get_minq_index(double maxq, double x3, double x2, double x1) {
- int i;
- const double minqtarget = MIN(((x3 * maxq + x2) * maxq + x1) * maxq,
- maxq);
-
- // Special case handling to deal with the step from q2.0
- // down to lossless mode represented by q 1.0.
- if (minqtarget <= 2.0)
- return 0;
-
- for (i = 0; i < QINDEX_RANGE; i++)
- if (minqtarget <= vp9_convert_qindex_to_q(i))
- return i;
-
- return QINDEX_RANGE - 1;
-}
-
-void vp9_rc_init_minq_luts() {
- int i;
-
- for (i = 0; i < QINDEX_RANGE; i++) {
- const double maxq = vp9_convert_qindex_to_q(i);
-
- kf_low_motion_minq[i] = get_minq_index(maxq, 0.000001, -0.0004, 0.15);
- kf_high_motion_minq[i] = get_minq_index(maxq, 0.000002, -0.0012, 0.50);
- gf_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.32);
- gf_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.50);
- afq_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.33);
- afq_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.55);
- inter_minq[i] = get_minq_index(maxq, 0.00000271, -0.00113, 0.75);
- }
-}
-
-// These functions use formulaic calculations to make playing with the
-// quantizer tables easier. If necessary they can be replaced by lookup
-// tables if and when things settle down in the experimental bitstream
-double vp9_convert_qindex_to_q(int qindex) {
- // Convert the index to a real Q value (scaled down to match old Q values)
- return vp9_ac_quant(qindex, 0) / 4.0;
-}
-
-int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
- double correction_factor) {
- const double q = vp9_convert_qindex_to_q(qindex);
- int enumerator = frame_type == KEY_FRAME ? 3300000 : 2250000;
-
- // q based adjustment to baseline enumerator
- enumerator += (int)(enumerator * q) >> 12;
- return (int)(0.5 + (enumerator * correction_factor / q));
-}
-
-void vp9_save_coding_context(VP9_COMP *cpi) {
- CODING_CONTEXT *const cc = &cpi->coding_context;
- VP9_COMMON *cm = &cpi->common;
-
- // Stores a snapshot of key state variables which can subsequently be
- // restored with a call to vp9_restore_coding_context. These functions are
- // intended for use in a re-code loop in vp9_compress_frame where the
- // quantizer value is adjusted between loop iterations.
- vp9_copy(cc->nmvjointcost, cpi->mb.nmvjointcost);
- vp9_copy(cc->nmvcosts, cpi->mb.nmvcosts);
- vp9_copy(cc->nmvcosts_hp, cpi->mb.nmvcosts_hp);
-
- vp9_copy(cc->segment_pred_probs, cm->seg.pred_probs);
-
- vpx_memcpy(cpi->coding_context.last_frame_seg_map_copy,
- cm->last_frame_seg_map, (cm->mi_rows * cm->mi_cols));
-
- vp9_copy(cc->last_ref_lf_deltas, cm->lf.last_ref_deltas);
- vp9_copy(cc->last_mode_lf_deltas, cm->lf.last_mode_deltas);
-
- cc->fc = cm->fc;
-}
-
-void vp9_restore_coding_context(VP9_COMP *cpi) {
- CODING_CONTEXT *const cc = &cpi->coding_context;
- VP9_COMMON *cm = &cpi->common;
-
- // Restore key state variables to the snapshot state stored in the
- // previous call to vp9_save_coding_context.
- vp9_copy(cpi->mb.nmvjointcost, cc->nmvjointcost);
- vp9_copy(cpi->mb.nmvcosts, cc->nmvcosts);
- vp9_copy(cpi->mb.nmvcosts_hp, cc->nmvcosts_hp);
-
- vp9_copy(cm->seg.pred_probs, cc->segment_pred_probs);
-
- vpx_memcpy(cm->last_frame_seg_map,
- cpi->coding_context.last_frame_seg_map_copy,
- (cm->mi_rows * cm->mi_cols));
-
- vp9_copy(cm->lf.last_ref_deltas, cc->last_ref_lf_deltas);
- vp9_copy(cm->lf.last_mode_deltas, cc->last_mode_lf_deltas);
-
- cm->fc = cc->fc;
-}
-
-static int estimate_bits_at_q(int frame_kind, int q, int mbs,
- double correction_factor) {
- const int bpm = (int)(vp9_rc_bits_per_mb(frame_kind, q, correction_factor));
-
- // Attempt to retain reasonable accuracy without overflow. The cutoff is
- // chosen such that the maximum product of Bpm and MBs fits 31 bits. The
- // largest Bpm takes 20 bits.
- return (mbs > (1 << 11)) ? (bpm >> BPER_MB_NORMBITS) * mbs
- : (bpm * mbs) >> BPER_MB_NORMBITS;
-}
-
-int vp9_rc_clamp_pframe_target_size(const VP9_COMP *const cpi, int target) {
- const RATE_CONTROL *rc = &cpi->rc;
- const int min_frame_target = MAX(rc->min_frame_bandwidth,
- rc->av_per_frame_bandwidth >> 5);
- if (target < min_frame_target)
- target = min_frame_target;
- if (cpi->refresh_golden_frame && rc->is_src_frame_alt_ref) {
- // If there is an active ARF at this location use the minimum
- // bits on this frame even if it is a constructed arf.
- // The active maximum quantizer insures that an appropriate
- // number of bits will be spent if needed for constructed ARFs.
- target = min_frame_target;
- }
- // Clip the frame target to the maximum allowed value.
- if (target > rc->max_frame_bandwidth)
- target = rc->max_frame_bandwidth;
- return target;
-}
-
-int vp9_rc_clamp_iframe_target_size(const VP9_COMP *const cpi, int target) {
- const RATE_CONTROL *rc = &cpi->rc;
- const VP9_CONFIG *oxcf = &cpi->oxcf;
- if (oxcf->rc_max_intra_bitrate_pct) {
- const int max_rate = rc->av_per_frame_bandwidth *
- oxcf->rc_max_intra_bitrate_pct / 100;
- target = MIN(target, max_rate);
- }
- if (target > rc->max_frame_bandwidth)
- target = rc->max_frame_bandwidth;
- return target;
-}
-
-
-// Update the buffer level for higher layers, given the encoded current layer.
-static void update_layer_buffer_level(VP9_COMP *const cpi,
- int encoded_frame_size) {
- int temporal_layer = 0;
- int current_temporal_layer = cpi->svc.temporal_layer_id;
- for (temporal_layer = current_temporal_layer + 1;
- temporal_layer < cpi->svc.number_temporal_layers; ++temporal_layer) {
- LAYER_CONTEXT *lc = &cpi->svc.layer_context[temporal_layer];
- RATE_CONTROL *lrc = &lc->rc;
- int bits_off_for_this_layer = (int)(lc->target_bandwidth / lc->framerate -
- encoded_frame_size);
- lrc->bits_off_target += bits_off_for_this_layer;
-
- // Clip buffer level to maximum buffer size for the layer.
- lrc->bits_off_target = MIN(lrc->bits_off_target, lc->maximum_buffer_size);
- lrc->buffer_level = lrc->bits_off_target;
- }
-}
-
-// Update the buffer level: leaky bucket model.
-static void update_buffer_level(VP9_COMP *cpi, int encoded_frame_size) {
- const VP9_COMMON *const cm = &cpi->common;
- const VP9_CONFIG *oxcf = &cpi->oxcf;
- RATE_CONTROL *const rc = &cpi->rc;
-
- // Non-viewable frames are a special case and are treated as pure overhead.
- if (!cm->show_frame) {
- rc->bits_off_target -= encoded_frame_size;
- } else {
- rc->bits_off_target += rc->av_per_frame_bandwidth - encoded_frame_size;
- }
-
- // Clip the buffer level to the maximum specified buffer size.
- rc->bits_off_target = MIN(rc->bits_off_target, oxcf->maximum_buffer_size);
- rc->buffer_level = rc->bits_off_target;
-
- if (cpi->use_svc && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
- update_layer_buffer_level(cpi, encoded_frame_size);
- }
-}
-
-int vp9_rc_drop_frame(VP9_COMP *cpi) {
- const VP9_CONFIG *oxcf = &cpi->oxcf;
- RATE_CONTROL *const rc = &cpi->rc;
-
- if (!oxcf->drop_frames_water_mark) {
- return 0;
- } else {
- if (rc->buffer_level < 0) {
- // Always drop if buffer is below 0.
- return 1;
- } else {
- // If buffer is below drop_mark, for now just drop every other frame
- // (starting with the next frame) until it increases back over drop_mark.
- int drop_mark = (int)(oxcf->drop_frames_water_mark *
- oxcf->optimal_buffer_level / 100);
- if ((rc->buffer_level > drop_mark) &&
- (rc->decimation_factor > 0)) {
- --rc->decimation_factor;
- } else if (rc->buffer_level <= drop_mark &&
- rc->decimation_factor == 0) {
- rc->decimation_factor = 1;
- }
- if (rc->decimation_factor > 0) {
- if (rc->decimation_count > 0) {
- --rc->decimation_count;
- return 1;
- } else {
- rc->decimation_count = rc->decimation_factor;
- return 0;
- }
- } else {
- rc->decimation_count = 0;
- return 0;
- }
- }
- }
-}
-
-static double get_rate_correction_factor(const VP9_COMP *cpi) {
- if (cpi->common.frame_type == KEY_FRAME) {
- return cpi->rc.key_frame_rate_correction_factor;
- } else {
- if ((cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame) &&
- !(cpi->use_svc && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER))
- return cpi->rc.gf_rate_correction_factor;
- else
- return cpi->rc.rate_correction_factor;
- }
-}
-
-static void set_rate_correction_factor(VP9_COMP *cpi, double factor) {
- if (cpi->common.frame_type == KEY_FRAME) {
- cpi->rc.key_frame_rate_correction_factor = factor;
- } else {
- if ((cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame) &&
- !(cpi->use_svc && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER))
- cpi->rc.gf_rate_correction_factor = factor;
- else
- cpi->rc.rate_correction_factor = factor;
- }
-}
-
-void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
- const int q = cpi->common.base_qindex;
- int correction_factor = 100;
- double rate_correction_factor = get_rate_correction_factor(cpi);
- double adjustment_limit;
-
- int projected_size_based_on_q = 0;
-
- // Clear down mmx registers to allow floating point in what follows
- vp9_clear_system_state();
-
- // Work out how big we would have expected the frame to be at this Q given
- // the current correction factor.
- // Stay in double to avoid int overflow when values are large
- projected_size_based_on_q = estimate_bits_at_q(cpi->common.frame_type, q,
- cpi->common.MBs,
- rate_correction_factor);
- // Work out a size correction factor.
- if (projected_size_based_on_q > 0)
- correction_factor = (100 * cpi->rc.projected_frame_size) /
- projected_size_based_on_q;
-
- // More heavily damped adjustment used if we have been oscillating either side
- // of target.
- switch (damp_var) {
- case 0:
- adjustment_limit = 0.75;
- break;
- case 1:
- adjustment_limit = 0.375;
- break;
- case 2:
- default:
- adjustment_limit = 0.25;
- break;
- }
-
- if (correction_factor > 102) {
- // We are not already at the worst allowable quality
- correction_factor =
- (int)(100 + ((correction_factor - 100) * adjustment_limit));
- rate_correction_factor =
- ((rate_correction_factor * correction_factor) / 100);
-
- // Keep rate_correction_factor within limits
- if (rate_correction_factor > MAX_BPB_FACTOR)
- rate_correction_factor = MAX_BPB_FACTOR;
- } else if (correction_factor < 99) {
- // We are not already at the best allowable quality
- correction_factor =
- (int)(100 - ((100 - correction_factor) * adjustment_limit));
- rate_correction_factor =
- ((rate_correction_factor * correction_factor) / 100);
-
- // Keep rate_correction_factor within limits
- if (rate_correction_factor < MIN_BPB_FACTOR)
- rate_correction_factor = MIN_BPB_FACTOR;
- }
-
- set_rate_correction_factor(cpi, rate_correction_factor);
-}
-
-
-int vp9_rc_regulate_q(const VP9_COMP *cpi, int target_bits_per_frame,
- int active_best_quality, int active_worst_quality) {
- const VP9_COMMON *const cm = &cpi->common;
- int q = active_worst_quality;
- int last_error = INT_MAX;
- int i, target_bits_per_mb;
- const double correction_factor = get_rate_correction_factor(cpi);
-
- // Calculate required scaling factor based on target frame size and size of
- // frame produced using previous Q.
- if (target_bits_per_frame >= (INT_MAX >> BPER_MB_NORMBITS))
- // Case where we would overflow int
- target_bits_per_mb = (target_bits_per_frame / cm->MBs) << BPER_MB_NORMBITS;
- else
- target_bits_per_mb = (target_bits_per_frame << BPER_MB_NORMBITS) / cm->MBs;
-
- i = active_best_quality;
-
- do {
- const int bits_per_mb_at_this_q = (int)vp9_rc_bits_per_mb(cm->frame_type, i,
- correction_factor);
-
- if (bits_per_mb_at_this_q <= target_bits_per_mb) {
- if ((target_bits_per_mb - bits_per_mb_at_this_q) <= last_error)
- q = i;
- else
- q = i - 1;
-
- break;
- } else {
- last_error = bits_per_mb_at_this_q - target_bits_per_mb;
- }
- } while (++i <= active_worst_quality);
-
- return q;
-}
-
-static int get_active_quality(int q, int gfu_boost, int low, int high,
- int *low_motion_minq, int *high_motion_minq) {
- if (gfu_boost > high) {
- return low_motion_minq[q];
- } else if (gfu_boost < low) {
- return high_motion_minq[q];
- } else {
- const int gap = high - low;
- const int offset = high - gfu_boost;
- const int qdiff = high_motion_minq[q] - low_motion_minq[q];
- const int adjustment = ((offset * qdiff) + (gap >> 1)) / gap;
- return low_motion_minq[q] + adjustment;
- }
-}
-
-static int calc_active_worst_quality_one_pass_vbr(const VP9_COMP *cpi) {
- const RATE_CONTROL *const rc = &cpi->rc;
- const unsigned int curr_frame = cpi->common.current_video_frame;
- int active_worst_quality;
-
- if (cpi->common.frame_type == KEY_FRAME) {
- active_worst_quality = curr_frame == 0 ? rc->worst_quality
- : rc->last_q[KEY_FRAME] * 2;
- } else {
- if (!rc->is_src_frame_alt_ref &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- active_worst_quality = curr_frame == 1 ? rc->last_q[KEY_FRAME] * 5 / 4
- : rc->last_q[INTER_FRAME];
- } else {
- active_worst_quality = curr_frame == 1 ? rc->last_q[KEY_FRAME] * 2
- : rc->last_q[INTER_FRAME] * 2;
- }
- }
-
- return MIN(active_worst_quality, rc->worst_quality);
-}
-
-// Adjust active_worst_quality level based on buffer level.
-static int calc_active_worst_quality_one_pass_cbr(const VP9_COMP *cpi) {
- // Adjust active_worst_quality: If buffer is above the optimal/target level,
- // bring active_worst_quality down depending on fullness of buffer.
- // If buffer is below the optimal level, let the active_worst_quality go from
- // ambient Q (at buffer = optimal level) to worst_quality level
- // (at buffer = critical level).
- const VP9_CONFIG *oxcf = &cpi->oxcf;
- const RATE_CONTROL *rc = &cpi->rc;
- // Buffer level below which we push active_worst to worst_quality.
- int64_t critical_level = oxcf->optimal_buffer_level >> 2;
- int64_t buff_lvl_step = 0;
- int adjustment = 0;
- int active_worst_quality;
- if (cpi->common.frame_type == KEY_FRAME)
- return rc->worst_quality;
- if (cpi->common.current_video_frame > 1)
- active_worst_quality = MIN(rc->worst_quality,
- rc->avg_frame_qindex[INTER_FRAME] * 5 / 4);
- else
- active_worst_quality = MIN(rc->worst_quality,
- rc->avg_frame_qindex[KEY_FRAME] * 3 / 2);
- if (rc->buffer_level > oxcf->optimal_buffer_level) {
- // Adjust down.
- // Maximum limit for down adjustment, ~30%.
- int max_adjustment_down = active_worst_quality / 3;
- if (max_adjustment_down) {
- buff_lvl_step = ((oxcf->maximum_buffer_size -
- oxcf->optimal_buffer_level) / max_adjustment_down);
- if (buff_lvl_step)
- adjustment = (int)((rc->buffer_level - oxcf->optimal_buffer_level) /
- buff_lvl_step);
- active_worst_quality -= adjustment;
- }
- } else if (rc->buffer_level > critical_level) {
- // Adjust up from ambient Q.
- if (critical_level) {
- buff_lvl_step = (oxcf->optimal_buffer_level - critical_level);
- if (buff_lvl_step) {
- adjustment =
- (int)((rc->worst_quality - rc->avg_frame_qindex[INTER_FRAME]) *
- (oxcf->optimal_buffer_level - rc->buffer_level) /
- buff_lvl_step);
- }
- active_worst_quality = rc->avg_frame_qindex[INTER_FRAME] + adjustment;
- }
- } else {
- // Set to worst_quality if buffer is below critical level.
- active_worst_quality = rc->worst_quality;
- }
- return active_worst_quality;
-}
-
-static int rc_pick_q_and_bounds_one_pass_cbr(const VP9_COMP *cpi,
- int *bottom_index,
- int *top_index) {
- const VP9_COMMON *const cm = &cpi->common;
- const RATE_CONTROL *const rc = &cpi->rc;
- int active_best_quality;
- int active_worst_quality = calc_active_worst_quality_one_pass_cbr(cpi);
- int q;
-
- if (frame_is_intra_only(cm)) {
- active_best_quality = rc->best_quality;
- // Handle the special case for key frames forced when we have75 reached
- // the maximum key frame interval. Here force the Q to a range
- // based on the ambient Q to reduce the risk of popping.
- if (rc->this_key_frame_forced) {
- int qindex = rc->last_boosted_qindex;
- double last_boosted_q = vp9_convert_qindex_to_q(qindex);
- int delta_qindex = vp9_compute_qdelta(cpi, last_boosted_q,
- (last_boosted_q * 0.75));
- active_best_quality = MAX(qindex + delta_qindex, rc->best_quality);
- } else if (cm->current_video_frame > 0) {
- // not first frame of one pass and kf_boost is set
- double q_adj_factor = 1.0;
- double q_val;
-
- active_best_quality = get_active_quality(rc->avg_frame_qindex[KEY_FRAME],
- rc->kf_boost,
- kf_low, kf_high,
- kf_low_motion_minq,
- kf_high_motion_minq);
-
- // Allow somewhat lower kf minq with small image formats.
- if ((cm->width * cm->height) <= (352 * 288)) {
- q_adj_factor -= 0.25;
- }
-
- // Convert the adjustment factor to a qindex delta
- // on active_best_quality.
- q_val = vp9_convert_qindex_to_q(active_best_quality);
- active_best_quality += vp9_compute_qdelta(cpi, q_val, q_val *
- q_adj_factor);
- }
- } else if (!rc->is_src_frame_alt_ref &&
- !cpi->use_svc &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- // Use the lower of active_worst_quality and recent
- // average Q as basis for GF/ARF best Q limit unless last frame was
- // a key frame.
- if (rc->frames_since_key > 1 &&
- rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) {
- q = rc->avg_frame_qindex[INTER_FRAME];
- } else {
- q = active_worst_quality;
- }
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- gf_low_motion_minq, gf_high_motion_minq);
- } else {
- // Use the lower of active_worst_quality and recent/average Q.
- if (cm->current_video_frame > 1) {
- if (rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality)
- active_best_quality = inter_minq[rc->avg_frame_qindex[INTER_FRAME]];
- else
- active_best_quality = inter_minq[active_worst_quality];
- } else {
- if (rc->avg_frame_qindex[KEY_FRAME] < active_worst_quality)
- active_best_quality = inter_minq[rc->avg_frame_qindex[KEY_FRAME]];
- else
- active_best_quality = inter_minq[active_worst_quality];
- }
- }
-
- // Clip the active best and worst quality values to limits
- active_best_quality = clamp(active_best_quality,
- rc->best_quality, rc->worst_quality);
- active_worst_quality = clamp(active_worst_quality,
- active_best_quality, rc->worst_quality);
-
- *top_index = active_worst_quality;
- *bottom_index = active_best_quality;
-
-#if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
- // Limit Q range for the adaptive loop.
- if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced) {
- if (!(cm->current_video_frame == 0))
- *top_index = (active_worst_quality + active_best_quality * 3) / 4;
- }
-#endif
- // Special case code to try and match quality with forced key frames
- if (cm->frame_type == KEY_FRAME && rc->this_key_frame_forced) {
- q = rc->last_boosted_qindex;
- } else {
- q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
- active_best_quality, active_worst_quality);
- if (q > *top_index) {
- // Special case when we are targeting the max allowed rate
- if (cpi->rc.this_frame_target >= cpi->rc.max_frame_bandwidth)
- *top_index = q;
- else
- q = *top_index;
- }
- }
- assert(*top_index <= rc->worst_quality &&
- *top_index >= rc->best_quality);
- assert(*bottom_index <= rc->worst_quality &&
- *bottom_index >= rc->best_quality);
- assert(q <= rc->worst_quality && q >= rc->best_quality);
- return q;
-}
-
-static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
- int *bottom_index,
- int *top_index) {
- const VP9_COMMON *const cm = &cpi->common;
- const RATE_CONTROL *const rc = &cpi->rc;
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- int active_best_quality;
- int active_worst_quality = calc_active_worst_quality_one_pass_vbr(cpi);
- int q;
-
- if (frame_is_intra_only(cm)) {
- active_best_quality = rc->best_quality;
-#if !CONFIG_MULTIPLE_ARF
- // Handle the special case for key frames forced when we have75 reached
- // the maximum key frame interval. Here force the Q to a range
- // based on the ambient Q to reduce the risk of popping.
- if (rc->this_key_frame_forced) {
- int qindex = rc->last_boosted_qindex;
- double last_boosted_q = vp9_convert_qindex_to_q(qindex);
- int delta_qindex = vp9_compute_qdelta(cpi, last_boosted_q,
- (last_boosted_q * 0.75));
- active_best_quality = MAX(qindex + delta_qindex, rc->best_quality);
- } else if (cm->current_video_frame > 0) {
- // not first frame of one pass and kf_boost is set
- double q_adj_factor = 1.0;
- double q_val;
-
- active_best_quality = get_active_quality(rc->avg_frame_qindex[KEY_FRAME],
- rc->kf_boost,
- kf_low, kf_high,
- kf_low_motion_minq,
- kf_high_motion_minq);
-
- // Allow somewhat lower kf minq with small image formats.
- if ((cm->width * cm->height) <= (352 * 288)) {
- q_adj_factor -= 0.25;
- }
-
- // Convert the adjustment factor to a qindex delta
- // on active_best_quality.
- q_val = vp9_convert_qindex_to_q(active_best_quality);
- active_best_quality += vp9_compute_qdelta(cpi, q_val, q_val *
- q_adj_factor);
- }
-#else
- double current_q;
- // Force the KF quantizer to be 30% of the active_worst_quality.
- current_q = vp9_convert_qindex_to_q(active_worst_quality);
- active_best_quality = active_worst_quality
- + vp9_compute_qdelta(cpi, current_q, current_q * 0.3);
-#endif
- } else if (!rc->is_src_frame_alt_ref &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- // Use the lower of active_worst_quality and recent
- // average Q as basis for GF/ARF best Q limit unless last frame was
- // a key frame.
- if (rc->frames_since_key > 1 &&
- rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) {
- q = rc->avg_frame_qindex[INTER_FRAME];
- } else {
- q = rc->avg_frame_qindex[KEY_FRAME];
- }
- // For constrained quality dont allow Q less than the cq level
- if (oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) {
- if (q < cpi->cq_target_quality)
- q = cpi->cq_target_quality;
- if (rc->frames_since_key > 1) {
- active_best_quality = get_active_quality(q, rc->gfu_boost,
- gf_low, gf_high,
- afq_low_motion_minq,
- afq_high_motion_minq);
- } else {
- active_best_quality = get_active_quality(q, rc->gfu_boost,
- gf_low, gf_high,
- gf_low_motion_minq,
- gf_high_motion_minq);
- }
- // Constrained quality use slightly lower active best.
- active_best_quality = active_best_quality * 15 / 16;
-
- } else if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
- if (!cpi->refresh_alt_ref_frame) {
- active_best_quality = cpi->cq_target_quality;
- } else {
- if (rc->frames_since_key > 1) {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- afq_low_motion_minq, afq_high_motion_minq);
- } else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- gf_low_motion_minq, gf_high_motion_minq);
- }
- }
- } else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- gf_low_motion_minq, gf_high_motion_minq);
- }
- } else {
- if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
- active_best_quality = cpi->cq_target_quality;
- } else {
- // Use the lower of active_worst_quality and recent/average Q.
- if (cm->current_video_frame > 1)
- active_best_quality = inter_minq[rc->avg_frame_qindex[INTER_FRAME]];
- else
- active_best_quality = inter_minq[rc->avg_frame_qindex[KEY_FRAME]];
- // For the constrained quality mode we don't want
- // q to fall below the cq level.
- if ((oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (active_best_quality < cpi->cq_target_quality)) {
- // If we are strongly undershooting the target rate in the last
- // frames then use the user passed in cq value not the auto
- // cq value.
- if (rc->rolling_actual_bits < rc->min_frame_bandwidth)
- active_best_quality = oxcf->cq_level;
- else
- active_best_quality = cpi->cq_target_quality;
- }
- }
- }
-
- // Clip the active best and worst quality values to limits
- active_best_quality = clamp(active_best_quality,
- rc->best_quality, rc->worst_quality);
- active_worst_quality = clamp(active_worst_quality,
- active_best_quality, rc->worst_quality);
-
- *top_index = active_worst_quality;
- *bottom_index = active_best_quality;
-
-#if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
- // Limit Q range for the adaptive loop.
- if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced) {
- if (!(cm->current_video_frame == 0))
- *top_index = (active_worst_quality + active_best_quality * 3) / 4;
- } else if (!rc->is_src_frame_alt_ref &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- *top_index = (active_worst_quality + active_best_quality) / 2;
- }
-#endif
- if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
- q = active_best_quality;
- // Special case code to try and match quality with forced key frames
- } else if ((cm->frame_type == KEY_FRAME) && rc->this_key_frame_forced) {
- q = rc->last_boosted_qindex;
- } else {
- q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
- active_best_quality, active_worst_quality);
- if (q > *top_index) {
- // Special case when we are targeting the max allowed rate
- if (cpi->rc.this_frame_target >= cpi->rc.max_frame_bandwidth)
- *top_index = q;
- else
- q = *top_index;
- }
- }
-#if CONFIG_MULTIPLE_ARF
- // Force the quantizer determined by the coding order pattern.
- if (cpi->multi_arf_enabled && (cm->frame_type != KEY_FRAME) &&
- cpi->oxcf.end_usage != USAGE_CONSTANT_QUALITY) {
- double new_q;
- double current_q = vp9_convert_qindex_to_q(active_worst_quality);
- int level = cpi->this_frame_weight;
- assert(level >= 0);
- new_q = current_q * (1.0 - (0.2 * (cpi->max_arf_level - level)));
- q = active_worst_quality +
- vp9_compute_qdelta(cpi, current_q, new_q);
-
- *bottom_index = q;
- *top_index = q;
- printf("frame:%d q:%d\n", cm->current_video_frame, q);
- }
-#endif
- assert(*top_index <= rc->worst_quality &&
- *top_index >= rc->best_quality);
- assert(*bottom_index <= rc->worst_quality &&
- *bottom_index >= rc->best_quality);
- assert(q <= rc->worst_quality && q >= rc->best_quality);
- return q;
-}
-
-static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
- int *bottom_index,
- int *top_index) {
- const VP9_COMMON *const cm = &cpi->common;
- const RATE_CONTROL *const rc = &cpi->rc;
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- int active_best_quality;
- int active_worst_quality = cpi->twopass.active_worst_quality;
- int q;
-
- if (frame_is_intra_only(cm)) {
-#if !CONFIG_MULTIPLE_ARF
- // Handle the special case for key frames forced when we have75 reached
- // the maximum key frame interval. Here force the Q to a range
- // based on the ambient Q to reduce the risk of popping.
- if (rc->this_key_frame_forced) {
- int qindex = rc->last_boosted_qindex;
- double last_boosted_q = vp9_convert_qindex_to_q(qindex);
- int delta_qindex = vp9_compute_qdelta(cpi, last_boosted_q,
- (last_boosted_q * 0.75));
- active_best_quality = MAX(qindex + delta_qindex, rc->best_quality);
- } else {
- // Not forced keyframe.
- double q_adj_factor = 1.0;
- double q_val;
- // Baseline value derived from cpi->active_worst_quality and kf boost.
- active_best_quality = get_active_quality(active_worst_quality,
- rc->kf_boost,
- kf_low, kf_high,
- kf_low_motion_minq,
- kf_high_motion_minq);
-
- // Allow somewhat lower kf minq with small image formats.
- if ((cm->width * cm->height) <= (352 * 288)) {
- q_adj_factor -= 0.25;
- }
-
- // Make a further adjustment based on the kf zero motion measure.
- q_adj_factor += 0.05 - (0.001 * (double)cpi->twopass.kf_zeromotion_pct);
-
- // Convert the adjustment factor to a qindex delta
- // on active_best_quality.
- q_val = vp9_convert_qindex_to_q(active_best_quality);
- active_best_quality += vp9_compute_qdelta(cpi, q_val, q_val *
- q_adj_factor);
- }
-#else
- double current_q;
- // Force the KF quantizer to be 30% of the active_worst_quality.
- current_q = vp9_convert_qindex_to_q(active_worst_quality);
- active_best_quality = active_worst_quality
- + vp9_compute_qdelta(cpi, current_q, current_q * 0.3);
-#endif
- } else if (!rc->is_src_frame_alt_ref &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- // Use the lower of active_worst_quality and recent
- // average Q as basis for GF/ARF best Q limit unless last frame was
- // a key frame.
- if (rc->frames_since_key > 1 &&
- rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) {
- q = rc->avg_frame_qindex[INTER_FRAME];
- } else {
- q = active_worst_quality;
- }
- // For constrained quality dont allow Q less than the cq level
- if (oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) {
- if (q < cpi->cq_target_quality)
- q = cpi->cq_target_quality;
- if (rc->frames_since_key > 1) {
- active_best_quality = get_active_quality(q, rc->gfu_boost,
- gf_low, gf_high,
- afq_low_motion_minq,
- afq_high_motion_minq);
- } else {
- active_best_quality = get_active_quality(q, rc->gfu_boost,
- gf_low, gf_high,
- gf_low_motion_minq,
- gf_high_motion_minq);
- }
- // Constrained quality use slightly lower active best.
- active_best_quality = active_best_quality * 15 / 16;
-
- } else if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
- if (!cpi->refresh_alt_ref_frame) {
- active_best_quality = cpi->cq_target_quality;
- } else {
- if (rc->frames_since_key > 1) {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- afq_low_motion_minq, afq_high_motion_minq);
- } else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- gf_low_motion_minq, gf_high_motion_minq);
- }
- }
- } else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- gf_low_motion_minq, gf_high_motion_minq);
- }
- } else {
- if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
- active_best_quality = cpi->cq_target_quality;
- } else {
- active_best_quality = inter_minq[active_worst_quality];
-
- // For the constrained quality mode we don't want
- // q to fall below the cq level.
- if ((oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (active_best_quality < cpi->cq_target_quality)) {
- // If we are strongly undershooting the target rate in the last
- // frames then use the user passed in cq value not the auto
- // cq value.
- if (rc->rolling_actual_bits < rc->min_frame_bandwidth)
- active_best_quality = oxcf->cq_level;
- else
- active_best_quality = cpi->cq_target_quality;
- }
- }
- }
-
- // Clip the active best and worst quality values to limits.
- active_best_quality = clamp(active_best_quality,
- rc->best_quality, rc->worst_quality);
- active_worst_quality = clamp(active_worst_quality,
- active_best_quality, rc->worst_quality);
-
- *top_index = active_worst_quality;
- *bottom_index = active_best_quality;
-
-#if LIMIT_QRANGE_FOR_ALTREF_AND_KEY
- // Limit Q range for the adaptive loop.
- if (cm->frame_type == KEY_FRAME && !rc->this_key_frame_forced) {
- *top_index = (active_worst_quality + active_best_quality * 3) / 4;
- } else if (!rc->is_src_frame_alt_ref &&
- (oxcf->end_usage != USAGE_STREAM_FROM_SERVER) &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
- *top_index = (active_worst_quality + active_best_quality) / 2;
- }
-#endif
-
- if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
- q = active_best_quality;
- // Special case code to try and match quality with forced key frames.
- } else if ((cm->frame_type == KEY_FRAME) && rc->this_key_frame_forced) {
- q = rc->last_boosted_qindex;
- } else {
- q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
- active_best_quality, active_worst_quality);
- if (q > *top_index) {
- // Special case when we are targeting the max allowed rate.
- if (rc->this_frame_target >= rc->max_frame_bandwidth)
- *top_index = q;
- else
- q = *top_index;
- }
- }
-#if CONFIG_MULTIPLE_ARF
- // Force the quantizer determined by the coding order pattern.
- if (cpi->multi_arf_enabled && (cm->frame_type != KEY_FRAME) &&
- cpi->oxcf.end_usage != USAGE_CONSTANT_QUALITY) {
- double new_q;
- double current_q = vp9_convert_qindex_to_q(active_worst_quality);
- int level = cpi->this_frame_weight;
- assert(level >= 0);
- new_q = current_q * (1.0 - (0.2 * (cpi->max_arf_level - level)));
- q = active_worst_quality +
- vp9_compute_qdelta(cpi, current_q, new_q);
-
- *bottom_index = q;
- *top_index = q;
- printf("frame:%d q:%d\n", cm->current_video_frame, q);
- }
-#endif
- assert(*top_index <= rc->worst_quality &&
- *top_index >= rc->best_quality);
- assert(*bottom_index <= rc->worst_quality &&
- *bottom_index >= rc->best_quality);
- assert(q <= rc->worst_quality && q >= rc->best_quality);
- return q;
-}
-
-int vp9_rc_pick_q_and_bounds(const VP9_COMP *cpi,
- int *bottom_index,
- int *top_index) {
- int q;
- if (cpi->pass == 0) {
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- q = rc_pick_q_and_bounds_one_pass_cbr(cpi, bottom_index, top_index);
- else
- q = rc_pick_q_and_bounds_one_pass_vbr(cpi, bottom_index, top_index);
- } else {
- q = rc_pick_q_and_bounds_two_pass(cpi, bottom_index, top_index);
- }
-
- // Q of 0 is disabled because we force tx size to be
- // 16x16...
- if (cpi->sf.use_nonrd_pick_mode) {
- if (q == 0)
- q++;
- if (cpi->sf.force_frame_boost == 1)
- q -= cpi->sf.max_delta_qindex;
-
- if (q < *bottom_index)
- *bottom_index = q;
- else if (q > *top_index)
- *top_index = q;
- }
- return q;
-}
-
-void vp9_rc_compute_frame_size_bounds(const VP9_COMP *cpi,
- int this_frame_target,
- int *frame_under_shoot_limit,
- int *frame_over_shoot_limit) {
- // Set-up bounds on acceptable frame size:
- if (cpi->oxcf.end_usage == USAGE_CONSTANT_QUALITY) {
- *frame_under_shoot_limit = 0;
- *frame_over_shoot_limit = INT_MAX;
- } else {
- int recode_tolerance =
- (cpi->sf.recode_tolerance * this_frame_target) / 100;
-
- *frame_over_shoot_limit = this_frame_target + recode_tolerance;
- *frame_under_shoot_limit = this_frame_target - recode_tolerance;
-
- // For very small rate targets where the fractional adjustment
- // may be tiny make sure there is at least a minimum range.
- *frame_over_shoot_limit += 200;
- *frame_under_shoot_limit -= 200;
- if (*frame_under_shoot_limit < 0)
- *frame_under_shoot_limit = 0;
-
- // Clip to maximum allowed rate for a frame.
- if (*frame_over_shoot_limit > cpi->rc.max_frame_bandwidth) {
- *frame_over_shoot_limit = cpi->rc.max_frame_bandwidth;
- }
- }
-}
-
-void vp9_rc_set_frame_target(VP9_COMP *cpi, int target) {
- const VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
-
- rc->this_frame_target = target;
- // Target rate per SB64 (including partial SB64s.
- rc->sb64_target_rate = ((int64_t)rc->this_frame_target * 64 * 64) /
- (cm->width * cm->height);
-}
-
-static void update_alt_ref_frame_stats(VP9_COMP *cpi) {
- // this frame refreshes means next frames don't unless specified by user
- cpi->rc.frames_since_golden = 0;
-
-#if CONFIG_MULTIPLE_ARF
- if (!cpi->multi_arf_enabled)
-#endif
- // Clear the alternate reference update pending flag.
- cpi->rc.source_alt_ref_pending = 0;
-
- // Set the alternate reference frame active flag
- cpi->rc.source_alt_ref_active = 1;
-}
-
-static void update_golden_frame_stats(VP9_COMP *cpi) {
- RATE_CONTROL *const rc = &cpi->rc;
-
- // Update the Golden frame usage counts.
- if (cpi->refresh_golden_frame) {
- // this frame refreshes means next frames don't unless specified by user
- rc->frames_since_golden = 0;
-
- if (!rc->source_alt_ref_pending)
- rc->source_alt_ref_active = 0;
-
- // Decrement count down till next gf
- if (rc->frames_till_gf_update_due > 0)
- rc->frames_till_gf_update_due--;
-
- } else if (!cpi->refresh_alt_ref_frame) {
- // Decrement count down till next gf
- if (rc->frames_till_gf_update_due > 0)
- rc->frames_till_gf_update_due--;
-
- rc->frames_since_golden++;
- }
-}
-
-void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
-
- cm->last_frame_type = cm->frame_type;
- // Update rate control heuristics
- rc->projected_frame_size = (int)(bytes_used << 3);
-
- // Post encode loop adjustment of Q prediction.
- vp9_rc_update_rate_correction_factors(
- cpi, (cpi->sf.recode_loop >= ALLOW_RECODE_KFARFGF ||
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ? 2 : 0);
-
- // Keep a record of last Q and ambient average Q.
- if (cm->frame_type == KEY_FRAME) {
- rc->last_q[KEY_FRAME] = cm->base_qindex;
- rc->avg_frame_qindex[KEY_FRAME] = ROUND_POWER_OF_TWO(
- 3 * rc->avg_frame_qindex[KEY_FRAME] + cm->base_qindex, 2);
- } else if (!rc->is_src_frame_alt_ref &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame) &&
- !(cpi->use_svc && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)) {
- rc->last_q[2] = cm->base_qindex;
- rc->avg_frame_qindex[2] = ROUND_POWER_OF_TWO(
- 3 * rc->avg_frame_qindex[2] + cm->base_qindex, 2);
- } else {
- rc->last_q[INTER_FRAME] = cm->base_qindex;
- rc->avg_frame_qindex[INTER_FRAME] = ROUND_POWER_OF_TWO(
- 3 * rc->avg_frame_qindex[INTER_FRAME] + cm->base_qindex, 2);
- rc->ni_frames++;
- rc->tot_q += vp9_convert_qindex_to_q(cm->base_qindex);
- rc->avg_q = rc->tot_q / (double)rc->ni_frames;
-
- // Calculate the average Q for normal inter frames (not key or GFU frames).
- rc->ni_tot_qi += cm->base_qindex;
- rc->ni_av_qi = rc->ni_tot_qi / rc->ni_frames;
- }
-
- // Keep record of last boosted (KF/KF/ARF) Q value.
- // If the current frame is coded at a lower Q then we also update it.
- // If all mbs in this group are skipped only update if the Q value is
- // better than that already stored.
- // This is used to help set quality in forced key frames to reduce popping
- if ((cm->base_qindex < rc->last_boosted_qindex) ||
- ((cpi->static_mb_pct < 100) &&
- ((cm->frame_type == KEY_FRAME) || cpi->refresh_alt_ref_frame ||
- (cpi->refresh_golden_frame && !rc->is_src_frame_alt_ref)))) {
- rc->last_boosted_qindex = cm->base_qindex;
- }
-
- update_buffer_level(cpi, rc->projected_frame_size);
-
- // Rolling monitors of whether we are over or underspending used to help
- // regulate min and Max Q in two pass.
- if (cm->frame_type != KEY_FRAME) {
- rc->rolling_target_bits = ROUND_POWER_OF_TWO(
- rc->rolling_target_bits * 3 + rc->this_frame_target, 2);
- rc->rolling_actual_bits = ROUND_POWER_OF_TWO(
- rc->rolling_actual_bits * 3 + rc->projected_frame_size, 2);
- rc->long_rolling_target_bits = ROUND_POWER_OF_TWO(
- rc->long_rolling_target_bits * 31 + rc->this_frame_target, 5);
- rc->long_rolling_actual_bits = ROUND_POWER_OF_TWO(
- rc->long_rolling_actual_bits * 31 + rc->projected_frame_size, 5);
- }
-
- // Actual bits spent
- rc->total_actual_bits += rc->projected_frame_size;
- rc->total_target_bits += (cm->show_frame ? rc->av_per_frame_bandwidth : 0);
-
- rc->total_target_vs_actual = rc->total_actual_bits - rc->total_target_bits;
-
- if (cpi->oxcf.play_alternate && cpi->refresh_alt_ref_frame &&
- (cm->frame_type != KEY_FRAME))
- // Update the alternate reference frame stats as appropriate.
- update_alt_ref_frame_stats(cpi);
- else
- // Update the Golden frame stats as appropriate.
- update_golden_frame_stats(cpi);
-
- if (cm->frame_type == KEY_FRAME)
- rc->frames_since_key = 0;
- if (cm->show_frame) {
- rc->frames_since_key++;
- rc->frames_to_key--;
- }
-}
-
-void vp9_rc_postencode_update_drop_frame(VP9_COMP *cpi) {
- // Update buffer level with zero size, update frame counters, and return.
- update_buffer_level(cpi, 0);
- cpi->common.last_frame_type = cpi->common.frame_type;
- cpi->rc.frames_since_key++;
- cpi->rc.frames_to_key--;
-}
-
-static int test_for_kf_one_pass(VP9_COMP *cpi) {
- // Placeholder function for auto key frame
- return 0;
-}
-// Use this macro to turn on/off use of alt-refs in one-pass mode.
-#define USE_ALTREF_FOR_ONE_PASS 1
-
-static int calc_pframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {
- static const int af_ratio = 10;
- const RATE_CONTROL *const rc = &cpi->rc;
- int target;
-#if USE_ALTREF_FOR_ONE_PASS
- target = (!rc->is_src_frame_alt_ref &&
- (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) ?
- (rc->av_per_frame_bandwidth * rc->baseline_gf_interval * af_ratio) /
- (rc->baseline_gf_interval + af_ratio - 1) :
- (rc->av_per_frame_bandwidth * rc->baseline_gf_interval) /
- (rc->baseline_gf_interval + af_ratio - 1);
-#else
- target = rc->av_per_frame_bandwidth;
-#endif
- return vp9_rc_clamp_pframe_target_size(cpi, target);
-}
-
-static int calc_iframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {
- static const int kf_ratio = 25;
- const RATE_CONTROL *rc = &cpi->rc;
- int target = rc->av_per_frame_bandwidth * kf_ratio;
- return vp9_rc_clamp_iframe_target_size(cpi, target);
-}
-
-void vp9_rc_get_one_pass_vbr_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- int target;
- if (!cpi->refresh_alt_ref_frame &&
- (cm->current_video_frame == 0 ||
- (cm->frame_flags & FRAMEFLAGS_KEY) ||
- rc->frames_to_key == 0 ||
- (cpi->oxcf.auto_key && test_for_kf_one_pass(cpi)))) {
- cm->frame_type = KEY_FRAME;
- rc->this_key_frame_forced = cm->current_video_frame != 0 &&
- rc->frames_to_key == 0;
- rc->frames_to_key = cpi->key_frame_frequency;
- rc->kf_boost = DEFAULT_KF_BOOST;
- rc->source_alt_ref_active = 0;
- } else {
- cm->frame_type = INTER_FRAME;
- }
- if (rc->frames_till_gf_update_due == 0) {
- rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
- rc->frames_till_gf_update_due = rc->baseline_gf_interval;
- // NOTE: frames_till_gf_update_due must be <= frames_to_key.
- if (rc->frames_till_gf_update_due > rc->frames_to_key)
- rc->frames_till_gf_update_due = rc->frames_to_key;
- cpi->refresh_golden_frame = 1;
- rc->source_alt_ref_pending = USE_ALTREF_FOR_ONE_PASS;
- rc->gfu_boost = DEFAULT_GF_BOOST;
- }
- if (cm->frame_type == KEY_FRAME)
- target = calc_iframe_target_size_one_pass_vbr(cpi);
- else
- target = calc_pframe_target_size_one_pass_vbr(cpi);
- vp9_rc_set_frame_target(cpi, target);
-}
-
-static int calc_pframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
- const VP9_CONFIG *oxcf = &cpi->oxcf;
- const RATE_CONTROL *rc = &cpi->rc;
- const int64_t diff = oxcf->optimal_buffer_level - rc->buffer_level;
- const int64_t one_pct_bits = 1 + oxcf->optimal_buffer_level / 100;
- int min_frame_target = MAX(rc->av_per_frame_bandwidth >> 4,
- FRAME_OVERHEAD_BITS);
- int target = rc->av_per_frame_bandwidth;
- if (cpi->svc.number_temporal_layers > 1 &&
- cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
- // Note that for layers, av_per_frame_bandwidth is the cumulative
- // per-frame-bandwidth. For the target size of this frame, use the
- // layer average frame size (i.e., non-cumulative per-frame-bw).
- int current_temporal_layer = cpi->svc.temporal_layer_id;
- const LAYER_CONTEXT *lc = &cpi->svc.layer_context[current_temporal_layer];
- target = lc->avg_frame_size;
- min_frame_target = MAX(lc->avg_frame_size >> 4, FRAME_OVERHEAD_BITS);
- }
- if (diff > 0) {
- // Lower the target bandwidth for this frame.
- const int pct_low = (int)MIN(diff / one_pct_bits, oxcf->under_shoot_pct);
- target -= (target * pct_low) / 200;
- } else if (diff < 0) {
- // Increase the target bandwidth for this frame.
- const int pct_high = (int)MIN(-diff / one_pct_bits, oxcf->over_shoot_pct);
- target += (target * pct_high) / 200;
- }
- return MAX(min_frame_target, target);
-}
-
-static int calc_iframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
- const RATE_CONTROL *rc = &cpi->rc;
- int target;
-
- if (cpi->common.current_video_frame == 0) {
- target = ((cpi->oxcf.starting_buffer_level / 2) > INT_MAX)
- ? INT_MAX : (int)(cpi->oxcf.starting_buffer_level / 2);
- } else {
- const int initial_boost = 32;
- int kf_boost = MAX(initial_boost, (int)(2 * cpi->output_framerate - 16));
- if (rc->frames_since_key < cpi->output_framerate / 2) {
- kf_boost = (int)(kf_boost * rc->frames_since_key /
- (cpi->output_framerate / 2));
- }
- target = ((16 + kf_boost) * rc->av_per_frame_bandwidth) >> 4;
- }
- return vp9_rc_clamp_iframe_target_size(cpi, target);
-}
-
-void vp9_rc_get_svc_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- int target = rc->av_per_frame_bandwidth;
- if ((cm->current_video_frame == 0) ||
- (cm->frame_flags & FRAMEFLAGS_KEY) ||
- (cpi->oxcf.auto_key && (rc->frames_since_key %
- cpi->key_frame_frequency == 0))) {
- cm->frame_type = KEY_FRAME;
- rc->source_alt_ref_active = 0;
- if (cpi->pass == 0 && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
- target = calc_iframe_target_size_one_pass_cbr(cpi);
- }
- } else {
- cm->frame_type = INTER_FRAME;
- if (cpi->pass == 0 && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
- target = calc_pframe_target_size_one_pass_cbr(cpi);
- }
- }
- vp9_rc_set_frame_target(cpi, target);
- rc->frames_till_gf_update_due = INT_MAX;
- rc->baseline_gf_interval = INT_MAX;
-}
-
-void vp9_rc_get_one_pass_cbr_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- RATE_CONTROL *const rc = &cpi->rc;
- int target;
- if ((cm->current_video_frame == 0 ||
- (cm->frame_flags & FRAMEFLAGS_KEY) ||
- rc->frames_to_key == 0 ||
- (cpi->oxcf.auto_key && test_for_kf_one_pass(cpi)))) {
- cm->frame_type = KEY_FRAME;
- rc->this_key_frame_forced = cm->current_video_frame != 0 &&
- rc->frames_to_key == 0;
- rc->frames_to_key = cpi->key_frame_frequency;
- rc->kf_boost = DEFAULT_KF_BOOST;
- rc->source_alt_ref_active = 0;
- target = calc_iframe_target_size_one_pass_cbr(cpi);
- } else {
- cm->frame_type = INTER_FRAME;
- target = calc_pframe_target_size_one_pass_cbr(cpi);
- }
- vp9_rc_set_frame_target(cpi, target);
- // Don't use gf_update by default in CBR mode.
- rc->frames_till_gf_update_due = INT_MAX;
- rc->baseline_gf_interval = INT_MAX;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.h
deleted file mode 100644
index f2d128c..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ratectrl.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_RATECTRL_H_
-#define VP9_ENCODER_VP9_RATECTRL_H_
-
-#include "vpx/vpx_integer.h"
-
-#include "vp9/common/vp9_blockd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FRAME_OVERHEAD_BITS 200
-
-typedef struct {
- // Rate targetting variables
- int this_frame_target;
- int projected_frame_size;
- int sb64_target_rate;
- int last_q[3]; // Separate values for Intra/Inter/ARF-GF
- int last_boosted_qindex; // Last boosted GF/KF/ARF q
-
- int gfu_boost;
- int last_boost;
- int kf_boost;
-
- double rate_correction_factor;
- double key_frame_rate_correction_factor;
- double gf_rate_correction_factor;
-
- int frames_since_golden;
- int frames_till_gf_update_due;
- int max_gf_interval;
- int static_scene_max_gf_interval;
- int baseline_gf_interval;
- int frames_to_key;
- int frames_since_key;
- int this_key_frame_forced;
- int next_key_frame_forced;
- int source_alt_ref_pending;
- int source_alt_ref_active;
- int is_src_frame_alt_ref;
-
- int av_per_frame_bandwidth; // Average frame size target for clip
- int min_frame_bandwidth; // Minimum allocation used for any frame
- int max_frame_bandwidth; // Maximum burst rate allowed for a frame.
-
- int ni_av_qi;
- int ni_tot_qi;
- int ni_frames;
- int avg_frame_qindex[3]; // 0 - KEY, 1 - INTER, 2 - ARF/GF
- double tot_q;
- double avg_q;
-
- int64_t buffer_level;
- int64_t bits_off_target;
-
- int decimation_factor;
- int decimation_count;
-
- int rolling_target_bits;
- int rolling_actual_bits;
-
- int long_rolling_target_bits;
- int long_rolling_actual_bits;
-
- int64_t total_actual_bits;
- int64_t total_target_bits;
- int64_t total_target_vs_actual;
-
- int worst_quality;
- int best_quality;
- // int active_best_quality;
-} RATE_CONTROL;
-
-struct VP9_COMP;
-
-void vp9_save_coding_context(struct VP9_COMP *cpi);
-void vp9_restore_coding_context(struct VP9_COMP *cpi);
-
-double vp9_convert_qindex_to_q(int qindex);
-
-void vp9_rc_init_minq_luts();
-
-// Generally at the high level, the following flow is expected
-// to be enforced for rate control:
-// First call per frame, one of:
-// vp9_rc_get_one_pass_vbr_params()
-// vp9_rc_get_one_pass_cbr_params()
-// vp9_rc_get_svc_params()
-// vp9_rc_get_first_pass_params()
-// vp9_rc_get_second_pass_params()
-// depending on the usage to set the rate control encode parameters desired.
-//
-// Then, call encode_frame_to_data_rate() to perform the
-// actual encode. This function will in turn call encode_frame()
-// one or more times, followed by one of:
-// vp9_rc_postencode_update()
-// vp9_rc_postencode_update_drop_frame()
-//
-// The majority of rate control parameters are only expected
-// to be set in the vp9_rc_get_..._params() functions and
-// updated during the vp9_rc_postencode_update...() functions.
-// The only exceptions are vp9_rc_drop_frame() and
-// vp9_rc_update_rate_correction_factors() functions.
-
-// Functions to set parameters for encoding before the actual
-// encode_frame_to_data_rate() function.
-void vp9_rc_get_one_pass_vbr_params(struct VP9_COMP *cpi);
-void vp9_rc_get_one_pass_cbr_params(struct VP9_COMP *cpi);
-void vp9_rc_get_svc_params(struct VP9_COMP *cpi);
-
-// Post encode update of the rate control parameters based
-// on bytes used
-void vp9_rc_postencode_update(struct VP9_COMP *cpi,
- uint64_t bytes_used);
-// Post encode update of the rate control parameters for dropped frames
-void vp9_rc_postencode_update_drop_frame(struct VP9_COMP *cpi);
-
-// Updates rate correction factors
-// Changes only the rate correction factors in the rate control structure.
-void vp9_rc_update_rate_correction_factors(struct VP9_COMP *cpi, int damp_var);
-
-// Decide if we should drop this frame: For 1-pass CBR.
-// Changes only the decimation count in the rate control structure
-int vp9_rc_drop_frame(struct VP9_COMP *cpi);
-
-// Computes frame size bounds.
-void vp9_rc_compute_frame_size_bounds(const struct VP9_COMP *cpi,
- int this_frame_target,
- int *frame_under_shoot_limit,
- int *frame_over_shoot_limit);
-
-// Picks q and q bounds given the target for bits
-int vp9_rc_pick_q_and_bounds(const struct VP9_COMP *cpi,
- int *bottom_index,
- int *top_index);
-
-// Estimates q to achieve a target bits per frame
-int vp9_rc_regulate_q(const struct VP9_COMP *cpi, int target_bits_per_frame,
- int active_best_quality, int active_worst_quality);
-
-// Estimates bits per mb for a given qindex and correction factor.
-int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
- double correction_factor);
-
-// Clamping utilities for bitrate targets for iframes and pframes.
-int vp9_rc_clamp_iframe_target_size(const struct VP9_COMP *const cpi,
- int target);
-int vp9_rc_clamp_pframe_target_size(const struct VP9_COMP *const cpi,
- int target);
-// Utility to set frame_target into the RATE_CONTROL structure
-// This function is called only from the vp9_rc_get_..._params() functions.
-void vp9_rc_set_frame_target(struct VP9_COMP *cpi, int target);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_RATECTRL_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.c
deleted file mode 100644
index a3e5132..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.c
+++ /dev/null
@@ -1,4471 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-
-#include "./vp9_rtcd.h"
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_entropymode.h"
-#include "vp9/common/vp9_idct.h"
-#include "vp9/common/vp9_mvref_common.h"
-#include "vp9/common/vp9_pragmas.h"
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_reconintra.h"
-#include "vp9/common/vp9_seg_common.h"
-#include "vp9/common/vp9_systemdependent.h"
-
-#include "vp9/encoder/vp9_cost.h"
-#include "vp9/encoder/vp9_encodemb.h"
-#include "vp9/encoder/vp9_encodemv.h"
-#include "vp9/encoder/vp9_mcomp.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_quantize.h"
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_rdopt.h"
-#include "vp9/encoder/vp9_tokenize.h"
-#include "vp9/encoder/vp9_variance.h"
-
-#define RD_THRESH_MAX_FACT 64
-#define RD_THRESH_INC 1
-#define RD_THRESH_POW 1.25
-#define RD_MULT_EPB_RATIO 64
-
-/* Factor to weigh the rate for switchable interp filters */
-#define SWITCHABLE_INTERP_RATE_FACTOR 1
-
-#define LAST_FRAME_MODE_MASK 0xFFEDCD60
-#define GOLDEN_FRAME_MODE_MASK 0xFFDA3BB0
-#define ALT_REF_MODE_MASK 0xFFC648D0
-
-#define MIN_EARLY_TERM_INDEX 3
-
-typedef struct {
- MB_PREDICTION_MODE mode;
- MV_REFERENCE_FRAME ref_frame[2];
-} MODE_DEFINITION;
-
-typedef struct {
- MV_REFERENCE_FRAME ref_frame[2];
-} REF_DEFINITION;
-
-struct rdcost_block_args {
- MACROBLOCK *x;
- ENTROPY_CONTEXT t_above[16];
- ENTROPY_CONTEXT t_left[16];
- int rate;
- int64_t dist;
- int64_t sse;
- int this_rate;
- int64_t this_dist;
- int64_t this_sse;
- int64_t this_rd;
- int64_t best_rd;
- int skip;
- int use_fast_coef_costing;
- const scan_order *so;
-};
-
-const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
- {NEARESTMV, {LAST_FRAME, NONE}},
- {NEARESTMV, {ALTREF_FRAME, NONE}},
- {NEARESTMV, {GOLDEN_FRAME, NONE}},
-
- {DC_PRED, {INTRA_FRAME, NONE}},
-
- {NEWMV, {LAST_FRAME, NONE}},
- {NEWMV, {ALTREF_FRAME, NONE}},
- {NEWMV, {GOLDEN_FRAME, NONE}},
-
- {NEARMV, {LAST_FRAME, NONE}},
- {NEARMV, {ALTREF_FRAME, NONE}},
- {NEARESTMV, {LAST_FRAME, ALTREF_FRAME}},
- {NEARESTMV, {GOLDEN_FRAME, ALTREF_FRAME}},
-
- {TM_PRED, {INTRA_FRAME, NONE}},
-
- {NEARMV, {LAST_FRAME, ALTREF_FRAME}},
- {NEWMV, {LAST_FRAME, ALTREF_FRAME}},
- {NEARMV, {GOLDEN_FRAME, NONE}},
- {NEARMV, {GOLDEN_FRAME, ALTREF_FRAME}},
- {NEWMV, {GOLDEN_FRAME, ALTREF_FRAME}},
-
- {ZEROMV, {LAST_FRAME, NONE}},
- {ZEROMV, {GOLDEN_FRAME, NONE}},
- {ZEROMV, {ALTREF_FRAME, NONE}},
- {ZEROMV, {LAST_FRAME, ALTREF_FRAME}},
- {ZEROMV, {GOLDEN_FRAME, ALTREF_FRAME}},
-
- {H_PRED, {INTRA_FRAME, NONE}},
- {V_PRED, {INTRA_FRAME, NONE}},
- {D135_PRED, {INTRA_FRAME, NONE}},
- {D207_PRED, {INTRA_FRAME, NONE}},
- {D153_PRED, {INTRA_FRAME, NONE}},
- {D63_PRED, {INTRA_FRAME, NONE}},
- {D117_PRED, {INTRA_FRAME, NONE}},
- {D45_PRED, {INTRA_FRAME, NONE}},
-};
-
-const REF_DEFINITION vp9_ref_order[MAX_REFS] = {
- {{LAST_FRAME, NONE}},
- {{GOLDEN_FRAME, NONE}},
- {{ALTREF_FRAME, NONE}},
- {{LAST_FRAME, ALTREF_FRAME}},
- {{GOLDEN_FRAME, ALTREF_FRAME}},
- {{INTRA_FRAME, NONE}},
-};
-
-// The baseline rd thresholds for breaking out of the rd loop for
-// certain modes are assumed to be based on 8x8 blocks.
-// This table is used to correct for blocks size.
-// The factors here are << 2 (2 = x0.5, 32 = x8 etc).
-static int rd_thresh_block_size_factor[BLOCK_SIZES] =
- {2, 3, 3, 4, 6, 6, 8, 12, 12, 16, 24, 24, 32};
-
-static int raster_block_offset(BLOCK_SIZE plane_bsize,
- int raster_block, int stride) {
- const int bw = b_width_log2(plane_bsize);
- const int y = 4 * (raster_block >> bw);
- const int x = 4 * (raster_block & ((1 << bw) - 1));
- return y * stride + x;
-}
-static int16_t* raster_block_offset_int16(BLOCK_SIZE plane_bsize,
- int raster_block, int16_t *base) {
- const int stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
- return base + raster_block_offset(plane_bsize, raster_block, stride);
-}
-
-static void fill_mode_costs(VP9_COMP *cpi) {
- MACROBLOCK *const x = &cpi->mb;
- const FRAME_CONTEXT *const fc = &cpi->common.fc;
- int i, j;
-
- for (i = 0; i < INTRA_MODES; i++)
- for (j = 0; j < INTRA_MODES; j++)
- vp9_cost_tokens((int *)x->y_mode_costs[i][j], vp9_kf_y_mode_prob[i][j],
- vp9_intra_mode_tree);
-
- // TODO(rbultje) separate tables for superblock costing?
- vp9_cost_tokens(x->mbmode_cost, fc->y_mode_prob[1], vp9_intra_mode_tree);
- vp9_cost_tokens(x->intra_uv_mode_cost[KEY_FRAME],
- vp9_kf_uv_mode_prob[TM_PRED], vp9_intra_mode_tree);
- vp9_cost_tokens(x->intra_uv_mode_cost[INTER_FRAME],
- fc->uv_mode_prob[TM_PRED], vp9_intra_mode_tree);
-
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
- vp9_cost_tokens((int *)x->switchable_interp_costs[i],
- fc->switchable_interp_prob[i], vp9_switchable_interp_tree);
-}
-
-static void fill_token_costs(vp9_coeff_cost *c,
- vp9_coeff_probs_model (*p)[PLANE_TYPES]) {
- int i, j, k, l;
- TX_SIZE t;
- for (t = TX_4X4; t <= TX_32X32; ++t)
- 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) {
- vp9_prob probs[ENTROPY_NODES];
- vp9_model_to_full_probs(p[t][i][j][k][l], probs);
- vp9_cost_tokens((int *)c[t][i][j][k][0][l], probs,
- vp9_coef_tree);
- vp9_cost_tokens_skip((int *)c[t][i][j][k][1][l], probs,
- vp9_coef_tree);
- assert(c[t][i][j][k][0][l][EOB_TOKEN] ==
- c[t][i][j][k][1][l][EOB_TOKEN]);
- }
-}
-
-static const int rd_iifactor[32] = {
- 4, 4, 3, 2, 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,
-};
-
-// 3* dc_qlookup[Q]*dc_qlookup[Q];
-
-/* values are now correlated to quantizer */
-static int sad_per_bit16lut[QINDEX_RANGE];
-static int sad_per_bit4lut[QINDEX_RANGE];
-
-void vp9_init_me_luts() {
- int i;
-
- // Initialize the sad lut tables using a formulaic calculation for now
- // This is to make it easier to resolve the impact of experimental changes
- // to the quantizer tables.
- for (i = 0; i < QINDEX_RANGE; i++) {
- const double q = vp9_convert_qindex_to_q(i);
- sad_per_bit16lut[i] = (int)(0.0418 * q + 2.4107);
- sad_per_bit4lut[i] = (int)(0.063 * q + 2.742);
- }
-}
-
-int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
- const int q = vp9_dc_quant(qindex, 0);
- // TODO(debargha): Adjust the function below
- int rdmult = 88 * q * q / 25;
- if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
- if (cpi->twopass.next_iiratio > 31)
- rdmult += (rdmult * rd_iifactor[31]) >> 4;
- else
- rdmult += (rdmult * rd_iifactor[cpi->twopass.next_iiratio]) >> 4;
- }
- return rdmult;
-}
-
-static int compute_rd_thresh_factor(int qindex) {
- // TODO(debargha): Adjust the function below
- const int q = (int)(pow(vp9_dc_quant(qindex, 0) / 4.0, RD_THRESH_POW) * 5.12);
- return MAX(q, 8);
-}
-
-void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) {
- cpi->mb.sadperbit16 = sad_per_bit16lut[qindex];
- cpi->mb.sadperbit4 = sad_per_bit4lut[qindex];
-}
-
-static void set_block_thresholds(VP9_COMP *cpi) {
- const VP9_COMMON *const cm = &cpi->common;
- int i, bsize, segment_id;
-
- for (segment_id = 0; segment_id < MAX_SEGMENTS; ++segment_id) {
- const int qindex = clamp(vp9_get_qindex(&cm->seg, segment_id,
- cm->base_qindex) + cm->y_dc_delta_q,
- 0, MAXQ);
- const int q = compute_rd_thresh_factor(qindex);
-
- for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) {
- // Threshold here seems unnecessarily harsh but fine given actual
- // range of values used for cpi->sf.thresh_mult[].
- const int t = q * rd_thresh_block_size_factor[bsize];
- const int thresh_max = INT_MAX / t;
-
- for (i = 0; i < MAX_MODES; ++i)
- cpi->rd_threshes[segment_id][bsize][i] =
- cpi->rd_thresh_mult[i] < thresh_max ? cpi->rd_thresh_mult[i] * t / 4
- : INT_MAX;
-
- for (i = 0; i < MAX_REFS; ++i) {
- cpi->rd_thresh_sub8x8[segment_id][bsize][i] =
- cpi->rd_thresh_mult_sub8x8[i] < thresh_max
- ? cpi->rd_thresh_mult_sub8x8[i] * t / 4
- : INT_MAX;
- }
- }
- }
-}
-
-void vp9_initialize_rd_consts(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
- int i;
-
- vp9_clear_system_state();
-
- cpi->RDDIV = RDDIV_BITS; // in bits (to multiply D by 128)
- cpi->RDMULT = vp9_compute_rd_mult(cpi, cm->base_qindex + cm->y_dc_delta_q);
-
- x->errorperbit = cpi->RDMULT / RD_MULT_EPB_RATIO;
- x->errorperbit += (x->errorperbit == 0);
-
- x->select_txfm_size = (cpi->sf.tx_size_search_method == USE_LARGESTALL &&
- cm->frame_type != KEY_FRAME) ? 0 : 1;
-
- set_block_thresholds(cpi);
-
- if (!cpi->sf.use_nonrd_pick_mode || cm->frame_type == KEY_FRAME) {
- fill_token_costs(x->token_costs, cm->fc.coef_probs);
-
- for (i = 0; i < PARTITION_CONTEXTS; i++)
- vp9_cost_tokens(x->partition_cost[i], get_partition_probs(cm, i),
- vp9_partition_tree);
- }
-
- if (!cpi->sf.use_nonrd_pick_mode || (cm->current_video_frame & 0x07) == 1 ||
- cm->frame_type == KEY_FRAME) {
- fill_mode_costs(cpi);
-
- if (!frame_is_intra_only(cm)) {
- vp9_build_nmv_cost_table(x->nmvjointcost,
- cm->allow_high_precision_mv ? x->nmvcost_hp
- : x->nmvcost,
- &cm->fc.nmvc, cm->allow_high_precision_mv);
-
- for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
- vp9_cost_tokens((int *)x->inter_mode_cost[i],
- cm->fc.inter_mode_probs[i], vp9_inter_mode_tree);
- }
- }
-}
-
-static const int MAX_XSQ_Q10 = 245727;
-
-static void model_rd_norm(int xsq_q10, int *r_q10, int *d_q10) {
- // NOTE: The tables below must be of the same size
-
- // The functions described below are sampled at the four most significant
- // bits of x^2 + 8 / 256
-
- // Normalized rate
- // This table models the rate for a Laplacian source
- // source with given variance when quantized with a uniform quantizer
- // with given stepsize. The closed form expression is:
- // Rn(x) = H(sqrt(r)) + sqrt(r)*[1 + H(r)/(1 - r)],
- // where r = exp(-sqrt(2) * x) and x = qpstep / sqrt(variance),
- // and H(x) is the binary entropy function.
- static const int rate_tab_q10[] = {
- 65536, 6086, 5574, 5275, 5063, 4899, 4764, 4651,
- 4553, 4389, 4255, 4142, 4044, 3958, 3881, 3811,
- 3748, 3635, 3538, 3453, 3376, 3307, 3244, 3186,
- 3133, 3037, 2952, 2877, 2809, 2747, 2690, 2638,
- 2589, 2501, 2423, 2353, 2290, 2232, 2179, 2130,
- 2084, 2001, 1928, 1862, 1802, 1748, 1698, 1651,
- 1608, 1530, 1460, 1398, 1342, 1290, 1243, 1199,
- 1159, 1086, 1021, 963, 911, 864, 821, 781,
- 745, 680, 623, 574, 530, 490, 455, 424,
- 395, 345, 304, 269, 239, 213, 190, 171,
- 154, 126, 104, 87, 73, 61, 52, 44,
- 38, 28, 21, 16, 12, 10, 8, 6,
- 5, 3, 2, 1, 1, 1, 0, 0,
- };
- // Normalized distortion
- // This table models the normalized distortion for a Laplacian source
- // source with given variance when quantized with a uniform quantizer
- // with given stepsize. The closed form expression is:
- // Dn(x) = 1 - 1/sqrt(2) * x / sinh(x/sqrt(2))
- // where x = qpstep / sqrt(variance)
- // Note the actual distortion is Dn * variance.
- static const int dist_tab_q10[] = {
- 0, 0, 1, 1, 1, 2, 2, 2,
- 3, 3, 4, 5, 5, 6, 7, 7,
- 8, 9, 11, 12, 13, 15, 16, 17,
- 18, 21, 24, 26, 29, 31, 34, 36,
- 39, 44, 49, 54, 59, 64, 69, 73,
- 78, 88, 97, 106, 115, 124, 133, 142,
- 151, 167, 184, 200, 215, 231, 245, 260,
- 274, 301, 327, 351, 375, 397, 418, 439,
- 458, 495, 528, 559, 587, 613, 637, 659,
- 680, 717, 749, 777, 801, 823, 842, 859,
- 874, 899, 919, 936, 949, 960, 969, 977,
- 983, 994, 1001, 1006, 1010, 1013, 1015, 1017,
- 1018, 1020, 1022, 1022, 1023, 1023, 1023, 1024,
- };
- static const int xsq_iq_q10[] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 40, 48, 56, 64, 72, 80, 88,
- 96, 112, 128, 144, 160, 176, 192, 208,
- 224, 256, 288, 320, 352, 384, 416, 448,
- 480, 544, 608, 672, 736, 800, 864, 928,
- 992, 1120, 1248, 1376, 1504, 1632, 1760, 1888,
- 2016, 2272, 2528, 2784, 3040, 3296, 3552, 3808,
- 4064, 4576, 5088, 5600, 6112, 6624, 7136, 7648,
- 8160, 9184, 10208, 11232, 12256, 13280, 14304, 15328,
- 16352, 18400, 20448, 22496, 24544, 26592, 28640, 30688,
- 32736, 36832, 40928, 45024, 49120, 53216, 57312, 61408,
- 65504, 73696, 81888, 90080, 98272, 106464, 114656, 122848,
- 131040, 147424, 163808, 180192, 196576, 212960, 229344, 245728,
- };
- /*
- static const int tab_size = sizeof(rate_tab_q10) / sizeof(rate_tab_q10[0]);
- assert(sizeof(dist_tab_q10) / sizeof(dist_tab_q10[0]) == tab_size);
- assert(sizeof(xsq_iq_q10) / sizeof(xsq_iq_q10[0]) == tab_size);
- assert(MAX_XSQ_Q10 + 1 == xsq_iq_q10[tab_size - 1]);
- */
- int tmp = (xsq_q10 >> 2) + 8;
- int k = get_msb(tmp) - 3;
- int xq = (k << 3) + ((tmp >> k) & 0x7);
- const int one_q10 = 1 << 10;
- const int a_q10 = ((xsq_q10 - xsq_iq_q10[xq]) << 10) >> (2 + k);
- const int b_q10 = one_q10 - a_q10;
- *r_q10 = (rate_tab_q10[xq] * b_q10 + rate_tab_q10[xq + 1] * a_q10) >> 10;
- *d_q10 = (dist_tab_q10[xq] * b_q10 + dist_tab_q10[xq + 1] * a_q10) >> 10;
-}
-
-void vp9_model_rd_from_var_lapndz(unsigned int var, unsigned int n,
- unsigned int qstep, int *rate,
- int64_t *dist) {
- // This function models the rate and distortion for a Laplacian
- // source with given variance when quantized with a uniform quantizer
- // with given stepsize. The closed form expressions are in:
- // Hang and Chen, "Source Model for transform video coder and its
- // application - Part I: Fundamental Theory", IEEE Trans. Circ.
- // Sys. for Video Tech., April 1997.
- if (var == 0) {
- *rate = 0;
- *dist = 0;
- } else {
- int d_q10, r_q10;
- const uint64_t xsq_q10_64 =
- ((((uint64_t)qstep * qstep * n) << 10) + (var >> 1)) / var;
- const int xsq_q10 = xsq_q10_64 > MAX_XSQ_Q10 ?
- MAX_XSQ_Q10 : (int)xsq_q10_64;
- model_rd_norm(xsq_q10, &r_q10, &d_q10);
- *rate = (n * r_q10 + 2) >> 2;
- *dist = (var * (int64_t)d_q10 + 512) >> 10;
- }
-}
-
-static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
- MACROBLOCK *x, MACROBLOCKD *xd,
- int *out_rate_sum, int64_t *out_dist_sum) {
- // Note our transform coeffs are 8 times an orthogonal transform.
- // Hence quantizer step is also 8 times. To get effective quantizer
- // we need to divide by 8 before sending to modeling function.
- int i;
- int64_t rate_sum = 0;
- int64_t dist_sum = 0;
- const int ref = xd->mi[0]->mbmi.ref_frame[0];
- unsigned int sse;
-
- for (i = 0; i < MAX_MB_PLANE; ++i) {
- struct macroblock_plane *const p = &x->plane[i];
- struct macroblockd_plane *const pd = &xd->plane[i];
- const BLOCK_SIZE bs = get_plane_block_size(bsize, pd);
-
- (void) cpi->fn_ptr[bs].vf(p->src.buf, p->src.stride,
- pd->dst.buf, pd->dst.stride, &sse);
-
- if (i == 0)
- x->pred_sse[ref] = sse;
-
- // Fast approximate the modelling function.
- if (cpi->speed > 4) {
- int64_t rate;
- int64_t dist;
- int64_t square_error = sse;
- int quantizer = (pd->dequant[1] >> 3);
-
- if (quantizer < 120)
- rate = (square_error * (280 - quantizer)) >> 8;
- else
- rate = 0;
- dist = (square_error * quantizer) >> 8;
- rate_sum += rate;
- dist_sum += dist;
- } else {
- int rate;
- int64_t dist;
- vp9_model_rd_from_var_lapndz(sse, 1 << num_pels_log2_lookup[bs],
- pd->dequant[1] >> 3, &rate, &dist);
- rate_sum += rate;
- dist_sum += dist;
- }
- }
-
- *out_rate_sum = (int)rate_sum;
- *out_dist_sum = dist_sum << 4;
-}
-
-static void model_rd_for_sb_y_tx(VP9_COMP *cpi, BLOCK_SIZE bsize,
- TX_SIZE tx_size,
- MACROBLOCK *x, MACROBLOCKD *xd,
- int *out_rate_sum, int64_t *out_dist_sum,
- int *out_skip) {
- int j, k;
- BLOCK_SIZE bs;
- const struct macroblock_plane *const p = &x->plane[0];
- const struct macroblockd_plane *const pd = &xd->plane[0];
- const int width = 4 * num_4x4_blocks_wide_lookup[bsize];
- const int height = 4 * num_4x4_blocks_high_lookup[bsize];
- int rate_sum = 0;
- int64_t dist_sum = 0;
- const int t = 4 << tx_size;
-
- if (tx_size == TX_4X4) {
- bs = BLOCK_4X4;
- } else if (tx_size == TX_8X8) {
- bs = BLOCK_8X8;
- } else if (tx_size == TX_16X16) {
- bs = BLOCK_16X16;
- } else if (tx_size == TX_32X32) {
- bs = BLOCK_32X32;
- } else {
- assert(0);
- }
-
- *out_skip = 1;
- for (j = 0; j < height; j += t) {
- for (k = 0; k < width; k += t) {
- int rate;
- int64_t dist;
- unsigned int sse;
- cpi->fn_ptr[bs].vf(&p->src.buf[j * p->src.stride + k], p->src.stride,
- &pd->dst.buf[j * pd->dst.stride + k], pd->dst.stride,
- &sse);
- // sse works better than var, since there is no dc prediction used
- vp9_model_rd_from_var_lapndz(sse, t * t, pd->dequant[1] >> 3,
- &rate, &dist);
- rate_sum += rate;
- dist_sum += dist;
- *out_skip &= (rate < 1024);
- }
- }
-
- *out_rate_sum = rate_sum;
- *out_dist_sum = dist_sum << 4;
-}
-
-int64_t vp9_block_error_c(const int16_t *coeff, const int16_t *dqcoeff,
- intptr_t block_size, int64_t *ssz) {
- int i;
- int64_t error = 0, sqcoeff = 0;
-
- for (i = 0; i < block_size; i++) {
- const int diff = coeff[i] - dqcoeff[i];
- error += diff * diff;
- sqcoeff += coeff[i] * coeff[i];
- }
-
- *ssz = sqcoeff;
- return error;
-}
-
-/* The trailing '0' is a terminator which is used inside cost_coeffs() to
- * decide whether to include cost of a trailing EOB node or not (i.e. we
- * can skip this if the last coefficient in this transform block, e.g. the
- * 16th coefficient in a 4x4 block or the 64th coefficient in a 8x8 block,
- * were non-zero). */
-static const int16_t band_counts[TX_SIZES][8] = {
- { 1, 2, 3, 4, 3, 16 - 13, 0 },
- { 1, 2, 3, 4, 11, 64 - 21, 0 },
- { 1, 2, 3, 4, 11, 256 - 21, 0 },
- { 1, 2, 3, 4, 11, 1024 - 21, 0 },
-};
-static INLINE int cost_coeffs(MACROBLOCK *x,
- int plane, int block,
- ENTROPY_CONTEXT *A, ENTROPY_CONTEXT *L,
- TX_SIZE tx_size,
- const int16_t *scan, const int16_t *nb,
- int use_fast_coef_costing) {
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- const struct macroblock_plane *p = &x->plane[plane];
- const struct macroblockd_plane *pd = &xd->plane[plane];
- const PLANE_TYPE type = pd->plane_type;
- const int16_t *band_count = &band_counts[tx_size][1];
- const int eob = p->eobs[block];
- const int16_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
- unsigned int (*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
- x->token_costs[tx_size][type][is_inter_block(mbmi)];
- uint8_t token_cache[32 * 32];
- int pt = combine_entropy_contexts(*A, *L);
- int c, cost;
- // Check for consistency of tx_size with mode info
- assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size
- : get_uv_tx_size(mbmi) == tx_size);
-
- if (eob == 0) {
- // single eob token
- cost = token_costs[0][0][pt][EOB_TOKEN];
- c = 0;
- } else {
- int band_left = *band_count++;
-
- // dc token
- int v = qcoeff[0];
- int prev_t = vp9_dct_value_tokens_ptr[v].token;
- cost = (*token_costs)[0][pt][prev_t] + vp9_dct_value_cost_ptr[v];
- token_cache[0] = vp9_pt_energy_class[prev_t];
- ++token_costs;
-
- // ac tokens
- for (c = 1; c < eob; c++) {
- const int rc = scan[c];
- int t;
-
- v = qcoeff[rc];
- t = vp9_dct_value_tokens_ptr[v].token;
- if (use_fast_coef_costing) {
- cost += (*token_costs)[!prev_t][!prev_t][t] + vp9_dct_value_cost_ptr[v];
- } else {
- pt = get_coef_context(nb, token_cache, c);
- cost += (*token_costs)[!prev_t][pt][t] + vp9_dct_value_cost_ptr[v];
- token_cache[rc] = vp9_pt_energy_class[t];
- }
- prev_t = t;
- if (!--band_left) {
- band_left = *band_count++;
- ++token_costs;
- }
- }
-
- // eob token
- if (band_left) {
- if (use_fast_coef_costing) {
- cost += (*token_costs)[0][!prev_t][EOB_TOKEN];
- } else {
- pt = get_coef_context(nb, token_cache, c);
- cost += (*token_costs)[0][pt][EOB_TOKEN];
- }
- }
- }
-
- // is eob first coefficient;
- *A = *L = (c > 0);
-
- return cost;
-}
-static void dist_block(int plane, int block, TX_SIZE tx_size,
- struct rdcost_block_args* args) {
- const int ss_txfrm_size = tx_size << 1;
- MACROBLOCK* const x = args->x;
- MACROBLOCKD* const xd = &x->e_mbd;
- const struct macroblock_plane *const p = &x->plane[plane];
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- int64_t this_sse;
- int shift = tx_size == TX_32X32 ? 0 : 2;
- int16_t *const coeff = BLOCK_OFFSET(p->coeff, block);
- int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- args->dist = vp9_block_error(coeff, dqcoeff, 16 << ss_txfrm_size,
- &this_sse) >> shift;
- args->sse = this_sse >> shift;
-
- if (x->skip_encode && !is_inter_block(&xd->mi[0]->mbmi)) {
- // TODO(jingning): tune the model to better capture the distortion.
- int64_t p = (pd->dequant[1] * pd->dequant[1] *
- (1 << ss_txfrm_size)) >> (shift + 2);
- args->dist += (p >> 4);
- args->sse += p;
- }
-}
-
-static void rate_block(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, struct rdcost_block_args* args) {
- int x_idx, y_idx;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x_idx, &y_idx);
-
- args->rate = cost_coeffs(args->x, plane, block, args->t_above + x_idx,
- args->t_left + y_idx, tx_size,
- args->so->scan, args->so->neighbors,
- args->use_fast_coef_costing);
-}
-
-static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- struct rdcost_block_args *args = arg;
- MACROBLOCK *const x = args->x;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- int64_t rd1, rd2, rd;
-
- if (args->skip)
- return;
-
- if (!is_inter_block(mbmi))
- vp9_encode_block_intra(x, plane, block, plane_bsize, tx_size, &mbmi->skip);
- else
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
-
- dist_block(plane, block, tx_size, args);
- rate_block(plane, block, plane_bsize, tx_size, args);
- rd1 = RDCOST(x->rdmult, x->rddiv, args->rate, args->dist);
- rd2 = RDCOST(x->rdmult, x->rddiv, 0, args->sse);
-
- // TODO(jingning): temporarily enabled only for luma component
- rd = MIN(rd1, rd2);
- if (plane == 0)
- x->zcoeff_blk[tx_size][block] = !x->plane[plane].eobs[block] ||
- (rd1 > rd2 && !xd->lossless);
-
- args->this_rate += args->rate;
- args->this_dist += args->dist;
- args->this_sse += args->sse;
- args->this_rd += rd;
-
- if (args->this_rd > args->best_rd) {
- args->skip = 1;
- return;
- }
-}
-
-void vp9_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
- const struct macroblockd_plane *pd,
- ENTROPY_CONTEXT t_above[16],
- ENTROPY_CONTEXT t_left[16]) {
- const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
- 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 ENTROPY_CONTEXT *const above = pd->above_context;
- const ENTROPY_CONTEXT *const left = pd->left_context;
-
- int i;
- switch (tx_size) {
- case TX_4X4:
- vpx_memcpy(t_above, above, sizeof(ENTROPY_CONTEXT) * num_4x4_w);
- vpx_memcpy(t_left, left, sizeof(ENTROPY_CONTEXT) * num_4x4_h);
- break;
- case TX_8X8:
- 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 += 2)
- t_left[i] = !!*(const uint16_t *)&left[i];
- break;
- case TX_16X16:
- 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 += 4)
- t_left[i] = !!*(const uint32_t *)&left[i];
- break;
- case TX_32X32:
- 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 += 8)
- t_left[i] = !!*(const uint64_t *)&left[i];
- break;
- default:
- assert(0 && "Invalid transform size.");
- }
-}
-
-static void txfm_rd_in_plane(MACROBLOCK *x,
- int *rate, int64_t *distortion,
- int *skippable, int64_t *sse,
- int64_t ref_best_rd, int plane,
- BLOCK_SIZE bsize, TX_SIZE tx_size,
- int use_fast_coef_casting) {
- MACROBLOCKD *const xd = &x->e_mbd;
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- struct rdcost_block_args args = { 0 };
- args.x = x;
- args.best_rd = ref_best_rd;
- args.use_fast_coef_costing = use_fast_coef_casting;
-
- if (plane == 0)
- xd->mi[0]->mbmi.tx_size = tx_size;
-
- vp9_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left);
-
- args.so = get_scan(xd, tx_size, pd->plane_type, 0);
-
- vp9_foreach_transformed_block_in_plane(xd, bsize, plane,
- block_rd_txfm, &args);
- if (args.skip) {
- *rate = INT_MAX;
- *distortion = INT64_MAX;
- *sse = INT64_MAX;
- *skippable = 0;
- } else {
- *distortion = args.this_dist;
- *rate = args.this_rate;
- *sse = args.this_sse;
- *skippable = vp9_is_skippable_in_plane(x, bsize, plane);
- }
-}
-
-static void choose_largest_txfm_size(VP9_COMP *cpi, MACROBLOCK *x,
- int *rate, int64_t *distortion,
- int *skip, int64_t *sse,
- int64_t ref_best_rd,
- BLOCK_SIZE bs) {
- const TX_SIZE max_tx_size = max_txsize_lookup[bs];
- VP9_COMMON *const cm = &cpi->common;
- const TX_SIZE largest_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode];
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
-
- mbmi->tx_size = MIN(max_tx_size, largest_tx_size);
-
- txfm_rd_in_plane(x, rate, distortion, skip,
- &sse[mbmi->tx_size], ref_best_rd, 0, bs,
- mbmi->tx_size, cpi->sf.use_fast_coef_costing);
- cpi->tx_stepdown_count[0]++;
-}
-
-static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
- int (*r)[2], int *rate,
- int64_t *d, int64_t *distortion,
- int *s, int *skip,
- int64_t tx_cache[TX_MODES],
- BLOCK_SIZE bs) {
- const TX_SIZE max_tx_size = max_txsize_lookup[bs];
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- vp9_prob skip_prob = vp9_get_skip_prob(cm, xd);
- int64_t rd[TX_SIZES][2] = {{INT64_MAX, INT64_MAX},
- {INT64_MAX, INT64_MAX},
- {INT64_MAX, INT64_MAX},
- {INT64_MAX, INT64_MAX}};
- int n, m;
- int s0, s1;
- const TX_SIZE max_mode_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode];
- int64_t best_rd = INT64_MAX;
- TX_SIZE best_tx = TX_4X4;
-
- const vp9_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc.tx_probs);
- assert(skip_prob > 0);
- s0 = vp9_cost_bit(skip_prob, 0);
- s1 = vp9_cost_bit(skip_prob, 1);
-
- for (n = TX_4X4; n <= max_tx_size; n++) {
- r[n][1] = r[n][0];
- if (r[n][0] < INT_MAX) {
- for (m = 0; m <= n - (n == max_tx_size); m++) {
- if (m == n)
- r[n][1] += vp9_cost_zero(tx_probs[m]);
- else
- r[n][1] += vp9_cost_one(tx_probs[m]);
- }
- }
- if (d[n] == INT64_MAX) {
- rd[n][0] = rd[n][1] = INT64_MAX;
- } else if (s[n]) {
- rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, d[n]);
- } else {
- rd[n][0] = RDCOST(x->rdmult, x->rddiv, r[n][0] + s0, d[n]);
- rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]);
- }
-
- if (rd[n][1] < best_rd) {
- best_tx = n;
- best_rd = rd[n][1];
- }
- }
- mbmi->tx_size = cm->tx_mode == TX_MODE_SELECT ?
- best_tx : MIN(max_tx_size, max_mode_tx_size);
-
-
- *distortion = d[mbmi->tx_size];
- *rate = r[mbmi->tx_size][cm->tx_mode == TX_MODE_SELECT];
- *skip = s[mbmi->tx_size];
-
- tx_cache[ONLY_4X4] = rd[TX_4X4][0];
- tx_cache[ALLOW_8X8] = rd[TX_8X8][0];
- tx_cache[ALLOW_16X16] = rd[MIN(max_tx_size, TX_16X16)][0];
- tx_cache[ALLOW_32X32] = rd[MIN(max_tx_size, TX_32X32)][0];
-
- if (max_tx_size == TX_32X32 && best_tx == TX_32X32) {
- tx_cache[TX_MODE_SELECT] = rd[TX_32X32][1];
- cpi->tx_stepdown_count[0]++;
- } else if (max_tx_size >= TX_16X16 && best_tx == TX_16X16) {
- tx_cache[TX_MODE_SELECT] = rd[TX_16X16][1];
- cpi->tx_stepdown_count[max_tx_size - TX_16X16]++;
- } else if (rd[TX_8X8][1] < rd[TX_4X4][1]) {
- tx_cache[TX_MODE_SELECT] = rd[TX_8X8][1];
- cpi->tx_stepdown_count[max_tx_size - TX_8X8]++;
- } else {
- tx_cache[TX_MODE_SELECT] = rd[TX_4X4][1];
- cpi->tx_stepdown_count[max_tx_size - TX_4X4]++;
- }
-}
-
-static int64_t scaled_rd_cost(int rdmult, int rddiv,
- int rate, int64_t dist, double scale) {
- return (int64_t) (RDCOST(rdmult, rddiv, rate, dist) * scale);
-}
-
-static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
- int (*r)[2], int *rate,
- int64_t *d, int64_t *distortion,
- int *s, int *skip, int64_t *sse,
- int64_t ref_best_rd,
- BLOCK_SIZE bs) {
- const TX_SIZE max_tx_size = max_txsize_lookup[bs];
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- vp9_prob skip_prob = vp9_get_skip_prob(cm, xd);
- int64_t rd[TX_SIZES][2] = {{INT64_MAX, INT64_MAX},
- {INT64_MAX, INT64_MAX},
- {INT64_MAX, INT64_MAX},
- {INT64_MAX, INT64_MAX}};
- int n, m;
- int s0, s1;
- double scale_rd[TX_SIZES] = {1.73, 1.44, 1.20, 1.00};
- const TX_SIZE max_mode_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode];
- int64_t best_rd = INT64_MAX;
- TX_SIZE best_tx = TX_4X4;
-
- const vp9_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc.tx_probs);
- assert(skip_prob > 0);
- s0 = vp9_cost_bit(skip_prob, 0);
- s1 = vp9_cost_bit(skip_prob, 1);
-
- for (n = TX_4X4; n <= max_tx_size; n++) {
- double scale = scale_rd[n];
- r[n][1] = r[n][0];
- for (m = 0; m <= n - (n == max_tx_size); m++) {
- if (m == n)
- r[n][1] += vp9_cost_zero(tx_probs[m]);
- else
- r[n][1] += vp9_cost_one(tx_probs[m]);
- }
- if (s[n]) {
- rd[n][0] = rd[n][1] = scaled_rd_cost(x->rdmult, x->rddiv, s1, d[n],
- scale);
- } else {
- rd[n][0] = scaled_rd_cost(x->rdmult, x->rddiv, r[n][0] + s0, d[n],
- scale);
- rd[n][1] = scaled_rd_cost(x->rdmult, x->rddiv, r[n][1] + s0, d[n],
- scale);
- }
- if (rd[n][1] < best_rd) {
- best_rd = rd[n][1];
- best_tx = n;
- }
- }
-
- mbmi->tx_size = cm->tx_mode == TX_MODE_SELECT ?
- best_tx : MIN(max_tx_size, max_mode_tx_size);
-
- // Actually encode using the chosen mode if a model was used, but do not
- // update the r, d costs
- txfm_rd_in_plane(x, rate, distortion, skip,
- &sse[mbmi->tx_size], ref_best_rd, 0, bs, mbmi->tx_size,
- cpi->sf.use_fast_coef_costing);
-
- if (max_tx_size == TX_32X32 && best_tx == TX_32X32) {
- cpi->tx_stepdown_count[0]++;
- } else if (max_tx_size >= TX_16X16 && best_tx == TX_16X16) {
- cpi->tx_stepdown_count[max_tx_size - TX_16X16]++;
- } else if (rd[TX_8X8][1] <= rd[TX_4X4][1]) {
- cpi->tx_stepdown_count[max_tx_size - TX_8X8]++;
- } else {
- cpi->tx_stepdown_count[max_tx_size - TX_4X4]++;
- }
-}
-
-static void inter_super_block_yrd(VP9_COMP *cpi, MACROBLOCK *x, int *rate,
- int64_t *distortion, int *skip,
- int64_t *psse, BLOCK_SIZE bs,
- int64_t txfm_cache[TX_MODES],
- int64_t ref_best_rd) {
- int r[TX_SIZES][2], s[TX_SIZES];
- int64_t d[TX_SIZES], sse[TX_SIZES];
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- const TX_SIZE max_tx_size = max_txsize_lookup[bs];
- TX_SIZE tx_size;
-
- assert(bs == mbmi->sb_type);
-
- vp9_subtract_plane(x, bs, 0);
-
- if (cpi->sf.tx_size_search_method == USE_LARGESTALL) {
- vpx_memset(txfm_cache, 0, TX_MODES * sizeof(int64_t));
- choose_largest_txfm_size(cpi, x, rate, distortion, skip, sse,
- ref_best_rd, bs);
- if (psse)
- *psse = sse[mbmi->tx_size];
- return;
- }
-
- if (cpi->sf.tx_size_search_method == USE_LARGESTINTRA_MODELINTER) {
- for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
- model_rd_for_sb_y_tx(cpi, bs, tx_size, x, xd,
- &r[tx_size][0], &d[tx_size], &s[tx_size]);
- choose_txfm_size_from_modelrd(cpi, x, r, rate, d, distortion, s,
- skip, sse, ref_best_rd, bs);
- } else {
- for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
- txfm_rd_in_plane(x, &r[tx_size][0], &d[tx_size],
- &s[tx_size], &sse[tx_size],
- ref_best_rd, 0, bs, tx_size,
- cpi->sf.use_fast_coef_costing);
- choose_txfm_size_from_rd(cpi, x, r, rate, d, distortion, s,
- skip, txfm_cache, bs);
- }
- if (psse)
- *psse = sse[mbmi->tx_size];
-}
-
-static void intra_super_block_yrd(VP9_COMP *cpi, MACROBLOCK *x, int *rate,
- int64_t *distortion, int *skip,
- int64_t *psse, BLOCK_SIZE bs,
- int64_t txfm_cache[TX_MODES],
- int64_t ref_best_rd) {
- int64_t sse[TX_SIZES];
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
-
- assert(bs == mbmi->sb_type);
- if (cpi->sf.tx_size_search_method != USE_FULL_RD) {
- vpx_memset(txfm_cache, 0, TX_MODES * sizeof(int64_t));
- choose_largest_txfm_size(cpi, x, rate, distortion, skip, sse,
- ref_best_rd, bs);
- } else {
- int r[TX_SIZES][2], s[TX_SIZES];
- int64_t d[TX_SIZES];
- TX_SIZE tx_size;
- for (tx_size = TX_4X4; tx_size <= max_txsize_lookup[bs]; ++tx_size)
- txfm_rd_in_plane(x, &r[tx_size][0], &d[tx_size],
- &s[tx_size], &sse[tx_size],
- ref_best_rd, 0, bs, tx_size,
- cpi->sf.use_fast_coef_costing);
- choose_txfm_size_from_rd(cpi, x, r, rate, d, distortion, s,
- skip, txfm_cache, bs);
- }
- if (psse)
- *psse = sse[mbmi->tx_size];
-}
-
-
-static int conditional_skipintra(MB_PREDICTION_MODE mode,
- MB_PREDICTION_MODE best_intra_mode) {
- if (mode == D117_PRED &&
- best_intra_mode != V_PRED &&
- best_intra_mode != D135_PRED)
- return 1;
- if (mode == D63_PRED &&
- best_intra_mode != V_PRED &&
- best_intra_mode != D45_PRED)
- return 1;
- if (mode == D207_PRED &&
- best_intra_mode != H_PRED &&
- best_intra_mode != D45_PRED)
- return 1;
- if (mode == D153_PRED &&
- best_intra_mode != H_PRED &&
- best_intra_mode != D135_PRED)
- return 1;
- return 0;
-}
-
-static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
- MB_PREDICTION_MODE *best_mode,
- const int *bmode_costs,
- ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
- int *bestrate, int *bestratey,
- int64_t *bestdistortion,
- BLOCK_SIZE bsize, int64_t rd_thresh) {
- MB_PREDICTION_MODE mode;
- MACROBLOCKD *const xd = &x->e_mbd;
- int64_t best_rd = rd_thresh;
-
- struct macroblock_plane *p = &x->plane[0];
- struct macroblockd_plane *pd = &xd->plane[0];
- const int src_stride = p->src.stride;
- const int dst_stride = pd->dst.stride;
- const uint8_t *src_init = &p->src.buf[raster_block_offset(BLOCK_8X8, ib,
- src_stride)];
- uint8_t *dst_init = &pd->dst.buf[raster_block_offset(BLOCK_8X8, ib,
- dst_stride)];
- ENTROPY_CONTEXT ta[2], tempa[2];
- ENTROPY_CONTEXT tl[2], templ[2];
-
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
- int idx, idy;
- uint8_t best_dst[8 * 8];
-
- assert(ib < 4);
-
- vpx_memcpy(ta, a, sizeof(ta));
- vpx_memcpy(tl, l, sizeof(tl));
- xd->mi[0]->mbmi.tx_size = TX_4X4;
-
- for (mode = DC_PRED; mode <= TM_PRED; ++mode) {
- int64_t this_rd;
- int ratey = 0;
- int64_t distortion = 0;
- int rate = bmode_costs[mode];
-
- if (!(cpi->sf.intra_y_mode_mask[TX_4X4] & (1 << mode)))
- continue;
-
- // Only do the oblique modes if the best so far is
- // one of the neighboring directional modes
- if (cpi->sf.mode_search_skip_flags & FLAG_SKIP_INTRA_DIRMISMATCH) {
- if (conditional_skipintra(mode, *best_mode))
- continue;
- }
-
- vpx_memcpy(tempa, ta, sizeof(ta));
- vpx_memcpy(templ, tl, sizeof(tl));
-
- for (idy = 0; idy < num_4x4_blocks_high; ++idy) {
- for (idx = 0; idx < num_4x4_blocks_wide; ++idx) {
- const int block = ib + idy * 2 + idx;
- const uint8_t *const src = &src_init[idx * 4 + idy * 4 * src_stride];
- uint8_t *const dst = &dst_init[idx * 4 + idy * 4 * dst_stride];
- int16_t *const src_diff = raster_block_offset_int16(BLOCK_8X8, block,
- p->src_diff);
- int16_t *const coeff = BLOCK_OFFSET(x->plane[0].coeff, block);
- xd->mi[0]->bmi[block].as_mode = mode;
- vp9_predict_intra_block(xd, block, 1,
- TX_4X4, mode,
- x->skip_encode ? src : dst,
- x->skip_encode ? src_stride : dst_stride,
- dst, dst_stride, idx, idy, 0);
- vp9_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride);
-
- if (xd->lossless) {
- const scan_order *so = &vp9_default_scan_orders[TX_4X4];
- vp9_fwht4x4(src_diff, coeff, 8);
- vp9_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
- ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
- so->scan, so->neighbors,
- cpi->sf.use_fast_coef_costing);
- if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
- goto next;
- vp9_iwht4x4_add(BLOCK_OFFSET(pd->dqcoeff, block), dst, dst_stride,
- p->eobs[block]);
- } else {
- int64_t unused;
- const TX_TYPE tx_type = get_tx_type_4x4(PLANE_TYPE_Y, xd, block);
- const scan_order *so = &vp9_scan_orders[TX_4X4][tx_type];
- vp9_fht4x4(src_diff, coeff, 8, tx_type);
- vp9_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
- ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
- so->scan, so->neighbors,
- cpi->sf.use_fast_coef_costing);
- distortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, block),
- 16, &unused) >> 2;
- if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
- goto next;
- vp9_iht4x4_add(tx_type, BLOCK_OFFSET(pd->dqcoeff, block),
- dst, dst_stride, p->eobs[block]);
- }
- }
- }
-
- rate += ratey;
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (this_rd < best_rd) {
- *bestrate = rate;
- *bestratey = ratey;
- *bestdistortion = distortion;
- best_rd = this_rd;
- *best_mode = mode;
- vpx_memcpy(a, tempa, sizeof(tempa));
- vpx_memcpy(l, templ, sizeof(templ));
- for (idy = 0; idy < num_4x4_blocks_high * 4; ++idy)
- vpx_memcpy(best_dst + idy * 8, dst_init + idy * dst_stride,
- num_4x4_blocks_wide * 4);
- }
- next:
- {}
- }
-
- if (best_rd >= rd_thresh || x->skip_encode)
- return best_rd;
-
- for (idy = 0; idy < num_4x4_blocks_high * 4; ++idy)
- vpx_memcpy(dst_init + idy * dst_stride, best_dst + idy * 8,
- num_4x4_blocks_wide * 4);
-
- return best_rd;
-}
-
-static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP *cpi, MACROBLOCK *mb,
- int *rate, int *rate_y,
- int64_t *distortion,
- int64_t best_rd) {
- int i, j;
- const MACROBLOCKD *const xd = &mb->e_mbd;
- MODE_INFO *const mic = xd->mi[0];
- const MODE_INFO *above_mi = xd->mi[-xd->mi_stride];
- const MODE_INFO *left_mi = xd->left_available ? xd->mi[-1] : NULL;
- const BLOCK_SIZE bsize = xd->mi[0]->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];
- int idx, idy;
- int cost = 0;
- int64_t total_distortion = 0;
- int tot_rate_y = 0;
- int64_t total_rd = 0;
- ENTROPY_CONTEXT t_above[4], t_left[4];
- const int *bmode_costs = mb->mbmode_cost;
-
- vpx_memcpy(t_above, xd->plane[0].above_context, sizeof(t_above));
- vpx_memcpy(t_left, xd->plane[0].left_context, sizeof(t_left));
-
- // Pick modes for each sub-block (of size 4x4, 4x8, or 8x4) in an 8x8 block.
- for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
- for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
- MB_PREDICTION_MODE best_mode = DC_PRED;
- int r = INT_MAX, ry = INT_MAX;
- int64_t d = INT64_MAX, this_rd = INT64_MAX;
- i = idy * 2 + idx;
- if (cpi->common.frame_type == KEY_FRAME) {
- const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, i);
- const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, i);
-
- bmode_costs = mb->y_mode_costs[A][L];
- }
-
- this_rd = rd_pick_intra4x4block(cpi, mb, i, &best_mode, bmode_costs,
- t_above + idx, t_left + idy, &r, &ry, &d,
- bsize, best_rd - total_rd);
- if (this_rd >= best_rd - total_rd)
- return INT64_MAX;
-
- total_rd += this_rd;
- cost += r;
- total_distortion += d;
- tot_rate_y += ry;
-
- mic->bmi[i].as_mode = best_mode;
- for (j = 1; j < num_4x4_blocks_high; ++j)
- mic->bmi[i + j * 2].as_mode = best_mode;
- for (j = 1; j < num_4x4_blocks_wide; ++j)
- mic->bmi[i + j].as_mode = best_mode;
-
- if (total_rd >= best_rd)
- return INT64_MAX;
- }
- }
-
- *rate = cost;
- *rate_y = tot_rate_y;
- *distortion = total_distortion;
- mic->mbmi.mode = mic->bmi[3].as_mode;
-
- return RDCOST(mb->rdmult, mb->rddiv, cost, total_distortion);
-}
-
-static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
- int *rate, int *rate_tokenonly,
- int64_t *distortion, int *skippable,
- BLOCK_SIZE bsize,
- int64_t tx_cache[TX_MODES],
- int64_t best_rd) {
- MB_PREDICTION_MODE mode;
- MB_PREDICTION_MODE mode_selected = DC_PRED;
- MACROBLOCKD *const xd = &x->e_mbd;
- MODE_INFO *const mic = xd->mi[0];
- int this_rate, this_rate_tokenonly, s;
- int64_t this_distortion, this_rd;
- TX_SIZE best_tx = TX_4X4;
- int i;
- int *bmode_costs = x->mbmode_cost;
-
- if (cpi->sf.tx_size_search_method == USE_FULL_RD)
- for (i = 0; i < TX_MODES; i++)
- tx_cache[i] = INT64_MAX;
-
- /* Y Search for intra prediction mode */
- for (mode = DC_PRED; mode <= TM_PRED; mode++) {
- int64_t local_tx_cache[TX_MODES];
- MODE_INFO *above_mi = xd->mi[-xd->mi_stride];
- MODE_INFO *left_mi = xd->left_available ? xd->mi[-1] : NULL;
-
- if (!(cpi->sf.intra_y_mode_mask[max_txsize_lookup[bsize]] & (1 << mode)))
- continue;
-
- if (cpi->common.frame_type == KEY_FRAME) {
- const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, 0);
- const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, 0);
-
- bmode_costs = x->y_mode_costs[A][L];
- }
- mic->mbmi.mode = mode;
-
- intra_super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
- &s, NULL, bsize, local_tx_cache, best_rd);
-
- if (this_rate_tokenonly == INT_MAX)
- continue;
-
- this_rate = this_rate_tokenonly + bmode_costs[mode];
- this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
-
- if (this_rd < best_rd) {
- mode_selected = mode;
- best_rd = this_rd;
- best_tx = mic->mbmi.tx_size;
- *rate = this_rate;
- *rate_tokenonly = this_rate_tokenonly;
- *distortion = this_distortion;
- *skippable = s;
- }
-
- if (cpi->sf.tx_size_search_method == USE_FULL_RD && this_rd < INT64_MAX) {
- for (i = 0; i < TX_MODES && local_tx_cache[i] < INT64_MAX; i++) {
- const int64_t adj_rd = this_rd + local_tx_cache[i] -
- local_tx_cache[cpi->common.tx_mode];
- if (adj_rd < tx_cache[i]) {
- tx_cache[i] = adj_rd;
- }
- }
- }
- }
-
- mic->mbmi.mode = mode_selected;
- mic->mbmi.tx_size = best_tx;
-
- return best_rd;
-}
-
-static void super_block_uvrd(const VP9_COMP *cpi, MACROBLOCK *x,
- int *rate, int64_t *distortion, int *skippable,
- int64_t *sse, BLOCK_SIZE bsize,
- int64_t ref_best_rd) {
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- TX_SIZE uv_txfm_size = get_uv_tx_size(mbmi);
- int plane;
- int pnrate = 0, pnskip = 1;
- int64_t pndist = 0, pnsse = 0;
-
- if (ref_best_rd < 0)
- goto term;
-
- if (is_inter_block(mbmi)) {
- int plane;
- for (plane = 1; plane < MAX_MB_PLANE; ++plane)
- vp9_subtract_plane(x, bsize, plane);
- }
-
- *rate = 0;
- *distortion = 0;
- *sse = 0;
- *skippable = 1;
-
- for (plane = 1; plane < MAX_MB_PLANE; ++plane) {
- txfm_rd_in_plane(x, &pnrate, &pndist, &pnskip, &pnsse,
- ref_best_rd, plane, bsize, uv_txfm_size,
- cpi->sf.use_fast_coef_costing);
- if (pnrate == INT_MAX)
- goto term;
- *rate += pnrate;
- *distortion += pndist;
- *sse += pnsse;
- *skippable &= pnskip;
- }
- return;
-
- term:
- *rate = INT_MAX;
- *distortion = INT64_MAX;
- *sse = INT64_MAX;
- *skippable = 0;
- return;
-}
-
-static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
- PICK_MODE_CONTEXT *ctx,
- int *rate, int *rate_tokenonly,
- int64_t *distortion, int *skippable,
- BLOCK_SIZE bsize, TX_SIZE max_tx_size) {
- MACROBLOCKD *xd = &x->e_mbd;
- MB_PREDICTION_MODE mode;
- MB_PREDICTION_MODE mode_selected = DC_PRED;
- int64_t best_rd = INT64_MAX, this_rd;
- int this_rate_tokenonly, this_rate, s;
- int64_t this_distortion, this_sse;
-
- for (mode = DC_PRED; mode <= TM_PRED; ++mode) {
- if (!(cpi->sf.intra_uv_mode_mask[max_tx_size] & (1 << mode)))
- continue;
-
- xd->mi[0]->mbmi.uv_mode = mode;
-
- super_block_uvrd(cpi, x, &this_rate_tokenonly,
- &this_distortion, &s, &this_sse, bsize, best_rd);
- if (this_rate_tokenonly == INT_MAX)
- continue;
- this_rate = this_rate_tokenonly +
- x->intra_uv_mode_cost[cpi->common.frame_type][mode];
- this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
-
- if (this_rd < best_rd) {
- mode_selected = mode;
- best_rd = this_rd;
- *rate = this_rate;
- *rate_tokenonly = this_rate_tokenonly;
- *distortion = this_distortion;
- *skippable = s;
- if (!x->select_txfm_size) {
- int i;
- struct macroblock_plane *const p = x->plane;
- struct macroblockd_plane *const pd = xd->plane;
- for (i = 1; i < MAX_MB_PLANE; ++i) {
- p[i].coeff = ctx->coeff_pbuf[i][2];
- p[i].qcoeff = ctx->qcoeff_pbuf[i][2];
- pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2];
- p[i].eobs = ctx->eobs_pbuf[i][2];
-
- ctx->coeff_pbuf[i][2] = ctx->coeff_pbuf[i][0];
- ctx->qcoeff_pbuf[i][2] = ctx->qcoeff_pbuf[i][0];
- ctx->dqcoeff_pbuf[i][2] = ctx->dqcoeff_pbuf[i][0];
- ctx->eobs_pbuf[i][2] = ctx->eobs_pbuf[i][0];
-
- ctx->coeff_pbuf[i][0] = p[i].coeff;
- ctx->qcoeff_pbuf[i][0] = p[i].qcoeff;
- ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff;
- ctx->eobs_pbuf[i][0] = p[i].eobs;
- }
- }
- }
- }
-
- xd->mi[0]->mbmi.uv_mode = mode_selected;
- return best_rd;
-}
-
-static int64_t rd_sbuv_dcpred(const VP9_COMP *cpi, MACROBLOCK *x,
- int *rate, int *rate_tokenonly,
- int64_t *distortion, int *skippable,
- BLOCK_SIZE bsize) {
- const VP9_COMMON *cm = &cpi->common;
- int64_t unused;
-
- x->e_mbd.mi[0]->mbmi.uv_mode = DC_PRED;
- super_block_uvrd(cpi, x, rate_tokenonly, distortion,
- skippable, &unused, bsize, INT64_MAX);
- *rate = *rate_tokenonly + x->intra_uv_mode_cost[cm->frame_type][DC_PRED];
- return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
-}
-
-static void choose_intra_uv_mode(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
- BLOCK_SIZE bsize, TX_SIZE max_tx_size,
- int *rate_uv, int *rate_uv_tokenonly,
- int64_t *dist_uv, int *skip_uv,
- MB_PREDICTION_MODE *mode_uv) {
- MACROBLOCK *const x = &cpi->mb;
-
- // Use an estimated rd for uv_intra based on DC_PRED if the
- // appropriate speed flag is set.
- if (cpi->sf.use_uv_intra_rd_estimate) {
- rd_sbuv_dcpred(cpi, x, rate_uv, rate_uv_tokenonly, dist_uv,
- skip_uv, bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize);
- // Else do a proper rd search for each possible transform size that may
- // be considered in the main rd loop.
- } else {
- rd_pick_intra_sbuv_mode(cpi, x, ctx,
- rate_uv, rate_uv_tokenonly, dist_uv, skip_uv,
- bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize, max_tx_size);
- }
- *mode_uv = x->e_mbd.mi[0]->mbmi.uv_mode;
-}
-
-static int cost_mv_ref(const VP9_COMP *cpi, MB_PREDICTION_MODE mode,
- int mode_context) {
- const MACROBLOCK *const x = &cpi->mb;
- const int segment_id = x->e_mbd.mi[0]->mbmi.segment_id;
-
- // Don't account for mode here if segment skip is enabled.
- if (!vp9_segfeature_active(&cpi->common.seg, segment_id, SEG_LVL_SKIP)) {
- assert(is_inter_mode(mode));
- return x->inter_mode_cost[mode_context][INTER_OFFSET(mode)];
- } else {
- return 0;
- }
-}
-
-static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
- BLOCK_SIZE bsize,
- int_mv *frame_mv,
- int mi_row, int mi_col,
- int_mv single_newmv[MAX_REF_FRAMES],
- int *rate_mv);
-
-static int labels2mode(VP9_COMP *cpi, MACROBLOCKD *xd, int i,
- MB_PREDICTION_MODE mode,
- int_mv this_mv[2],
- int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES],
- int_mv seg_mvs[MAX_REF_FRAMES],
- int_mv *best_ref_mv[2],
- const int *mvjcost, int *mvcost[2]) {
- MODE_INFO *const mic = xd->mi[0];
- const MB_MODE_INFO *const mbmi = &mic->mbmi;
- 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);
-
- // the only time we should do costing for new motion vector or mode
- // is when we are on a new label (jbb May 08, 2007)
- switch (mode) {
- case NEWMV:
- this_mv[0].as_int = seg_mvs[mbmi->ref_frame[0]].as_int;
- thismvcost += vp9_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
- if (is_compound) {
- this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int;
- thismvcost += vp9_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv,
- mvjcost, mvcost, MV_COST_WEIGHT_SUB);
- }
- break;
- case NEARESTMV:
- this_mv[0].as_int = frame_mv[NEARESTMV][mbmi->ref_frame[0]].as_int;
- if (is_compound)
- this_mv[1].as_int = frame_mv[NEARESTMV][mbmi->ref_frame[1]].as_int;
- break;
- case NEARMV:
- this_mv[0].as_int = frame_mv[NEARMV][mbmi->ref_frame[0]].as_int;
- if (is_compound)
- this_mv[1].as_int = frame_mv[NEARMV][mbmi->ref_frame[1]].as_int;
- break;
- case ZEROMV:
- this_mv[0].as_int = 0;
- if (is_compound)
- this_mv[1].as_int = 0;
- break;
- 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;
-
- for (idy = 0; idy < num_4x4_blocks_high; ++idy)
- for (idx = 0; idx < num_4x4_blocks_wide; ++idx)
- vpx_memcpy(&mic->bmi[i + idy * 2 + idx],
- &mic->bmi[i], sizeof(mic->bmi[i]));
-
- return cost_mv_ref(cpi, mode, mbmi->mode_context[mbmi->ref_frame[0]]) +
- thismvcost;
-}
-
-static int64_t encode_inter_mb_segment(VP9_COMP *cpi,
- MACROBLOCK *x,
- int64_t best_yrd,
- int i,
- int *labelyrate,
- int64_t *distortion, int64_t *sse,
- ENTROPY_CONTEXT *ta,
- ENTROPY_CONTEXT *tl,
- int mi_row, int mi_col) {
- int k;
- 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 width = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
- const int height = 4 * num_4x4_blocks_high_lookup[plane_bsize];
- int idx, idy;
-
- const uint8_t *const src = &p->src.buf[raster_block_offset(BLOCK_8X8, i,
- p->src.stride)];
- uint8_t *const dst = &pd->dst.buf[raster_block_offset(BLOCK_8X8, i,
- pd->dst.stride)];
- int64_t thisdistortion = 0, thissse = 0;
- int thisrate = 0, ref;
- const scan_order *so = &vp9_default_scan_orders[TX_4X4];
- const int is_compound = has_second_ref(&mi->mbmi);
- const InterpKernel *kernel = vp9_get_interp_kernel(mi->mbmi.interp_filter);
-
- for (ref = 0; ref < 1 + is_compound; ++ref) {
- const uint8_t *pre = &pd->pre[ref].buf[raster_block_offset(BLOCK_8X8, i,
- pd->pre[ref].stride)];
- vp9_build_inter_predictor(pre, pd->pre[ref].stride,
- dst, pd->dst.stride,
- &mi->bmi[i].as_mv[ref].as_mv,
- &xd->block_refs[ref]->sf, width, height, ref,
- kernel, MV_PRECISION_Q3,
- mi_col * MI_SIZE + 4 * (i % 2),
- mi_row * MI_SIZE + 4 * (i / 2));
- }
-
- vp9_subtract_block(height, width,
- raster_block_offset_int16(BLOCK_8X8, i, p->src_diff), 8,
- src, p->src.stride,
- dst, pd->dst.stride);
-
- k = i;
- for (idy = 0; idy < height / 4; ++idy) {
- for (idx = 0; idx < width / 4; ++idx) {
- int64_t ssz, rd, rd1, rd2;
- int16_t* coeff;
-
- k += (idy * 2 + idx);
- coeff = BLOCK_OFFSET(p->coeff, k);
- x->fwd_txm4x4(raster_block_offset_int16(BLOCK_8X8, k, p->src_diff),
- coeff, 8);
- vp9_regular_quantize_b_4x4(x, 0, k, so->scan, so->iscan);
- thisdistortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, k),
- 16, &ssz);
- thissse += ssz;
- thisrate += cost_coeffs(x, 0, k, ta + (k & 1), tl + (k >> 1), TX_4X4,
- so->scan, so->neighbors,
- cpi->sf.use_fast_coef_costing);
- rd1 = RDCOST(x->rdmult, x->rddiv, thisrate, thisdistortion >> 2);
- rd2 = RDCOST(x->rdmult, x->rddiv, 0, thissse >> 2);
- rd = MIN(rd1, rd2);
- if (rd >= best_yrd)
- return INT64_MAX;
- }
- }
-
- *distortion = thisdistortion >> 2;
- *labelyrate = thisrate;
- *sse = thissse >> 2;
-
- return RDCOST(x->rdmult, x->rddiv, *labelyrate, *distortion);
-}
-
-typedef struct {
- int eobs;
- int brate;
- int byrate;
- int64_t bdist;
- int64_t bsse;
- int64_t brdcost;
- int_mv mvs[2];
- ENTROPY_CONTEXT ta[2];
- ENTROPY_CONTEXT tl[2];
-} SEG_RDSTAT;
-
-typedef struct {
- int_mv *ref_mv[2];
- int_mv mvp;
-
- int64_t segment_rd;
- int r;
- int64_t d;
- int64_t sse;
- int segment_yrate;
- MB_PREDICTION_MODE modes[4];
- SEG_RDSTAT rdstat[4][INTER_MODES];
- int mvthresh;
-} BEST_SEG_INFO;
-
-static INLINE int mv_check_bounds(const MACROBLOCK *x, const MV *mv) {
- return (mv->row >> 3) < x->mv_row_min ||
- (mv->row >> 3) > x->mv_row_max ||
- (mv->col >> 3) < x->mv_col_min ||
- (mv->col >> 3) > x->mv_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[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[raster_block_offset(BLOCK_8X8, i,
- pd->pre[0].stride)];
- if (has_second_ref(mbmi))
- pd->pre[1].buf = &pd->pre[1].buf[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];
-}
-
-static INLINE int mv_has_subpel(const MV *mv) {
- return (mv->row & 0x0F) || (mv->col & 0x0F);
-}
-
-// 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 VP9_COMP *cpi, const uint8_t mode_context[MAX_REF_FRAMES],
- int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES],
- int disable_inter_mode_mask, int this_mode, int ref_frame,
- int second_ref_frame) {
- if (!(disable_inter_mode_mask & (1 << INTER_OFFSET(ZEROMV))) &&
- (this_mode == NEARMV || this_mode == NEARESTMV || this_mode == ZEROMV) &&
- frame_mv[this_mode][ref_frame].as_int == 0 &&
- (second_ref_frame == NONE ||
- frame_mv[this_mode][second_ref_frame].as_int == 0)) {
- int rfc = mode_context[ref_frame];
- 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 (this_mode == NEARMV) {
- if (c1 > c3) return 0;
- } else if (this_mode == NEARESTMV) {
- if (c2 > c3) return 0;
- } else {
- assert(this_mode == ZEROMV);
- if (second_ref_frame == NONE) {
- if ((c3 >= c2 && frame_mv[NEARESTMV][ref_frame].as_int == 0) ||
- (c3 >= c1 && frame_mv[NEARMV][ref_frame].as_int == 0))
- return 0;
- } else {
- if ((c3 >= c2 && frame_mv[NEARESTMV][ref_frame].as_int == 0 &&
- frame_mv[NEARESTMV][second_ref_frame].as_int == 0) ||
- (c3 >= c1 && frame_mv[NEARMV][ref_frame].as_int == 0 &&
- frame_mv[NEARMV][second_ref_frame].as_int == 0))
- return 0;
- }
- }
- }
- return 1;
-}
-
-static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- BEST_SEG_INFO *bsi_buf, int filter_idx,
- int_mv seg_mvs[4][MAX_REF_FRAMES],
- int mi_row, int mi_col) {
- int k, br = 0, idx, idy;
- int64_t bd = 0, block_sse = 0;
- MB_PREDICTION_MODE this_mode;
- MACROBLOCKD *xd = &x->e_mbd;
- VP9_COMMON *cm = &cpi->common;
- MODE_INFO *mi = xd->mi[0];
- MB_MODE_INFO *const mbmi = &mi->mbmi;
- 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];
- vp9_variance_fn_ptr_t *v_fn_ptr = &cpi->fn_ptr[bsize];
- ENTROPY_CONTEXT t_above[2], t_left[2];
- BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
- int mode_idx;
- int subpelmv = 1, have_ref = 0;
- const int has_second_rf = has_second_ref(mbmi);
- const int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize];
-
- vpx_memcpy(t_above, pd->above_context, sizeof(t_above));
- vpx_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][MAX_REF_FRAMES];
- MB_PREDICTION_MODE mode_selected = ZEROMV;
- int64_t best_rd = INT64_MAX;
- const int i = idy * 2 + idx;
- int ref;
-
- for (ref = 0; ref < 1 + has_second_rf; ++ref) {
- const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
- frame_mv[ZEROMV][frame].as_int = 0;
- vp9_append_sub8x8_mvs_for_idx(cm, xd, tile, i, ref, mi_row, mi_col,
- &frame_mv[NEARESTMV][frame],
- &frame_mv[NEARMV][frame]);
- }
-
- // search for the best motion vector on this segment
- for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {
- const struct buf_2d orig_src = x->plane[0].src;
- struct buf_2d orig_pre[2];
-
- mode_idx = INTER_OFFSET(this_mode);
- bsi->rdstat[i][mode_idx].brdcost = INT64_MAX;
- if (disable_inter_mode_mask & (1 << mode_idx))
- continue;
-
- if (!check_best_zero_mv(cpi, mbmi->mode_context, frame_mv,
- disable_inter_mode_mask,
- this_mode, mbmi->ref_frame[0],
- mbmi->ref_frame[1]))
- continue;
-
- vpx_memcpy(orig_pre, pd->pre, sizeof(orig_pre));
- vpx_memcpy(bsi->rdstat[i][mode_idx].ta, t_above,
- sizeof(bsi->rdstat[i][mode_idx].ta));
- vpx_memcpy(bsi->rdstat[i][mode_idx].tl, t_left,
- sizeof(bsi->rdstat[i][mode_idx].tl));
-
- // motion search for newmv (single predictor case only)
- if (!has_second_rf && this_mode == NEWMV &&
- seg_mvs[i][mbmi->ref_frame[0]].as_int == INVALID_MV) {
- int_mv *const new_mv = &mode_mv[NEWMV][0];
- int step_param = 0;
- int further_steps;
- int thissme, bestsme = INT_MAX;
- int sadpb = x->sadperbit4;
- MV mvp_full;
- int max_mv;
-
- /* Is the best so far sufficiently good that we cant justify doing
- * and new motion search. */
- if (best_rd < label_mv_thresh)
- break;
-
- if (cpi->oxcf.mode != MODE_SECONDPASS_BEST &&
- cpi->oxcf.mode != MODE_BESTQUALITY) {
- // use previous block's result as next block's MV predictor.
- if (i > 0) {
- bsi->mvp.as_int = mi->bmi[i - 1].as_mv[0].as_int;
- if (i == 2)
- bsi->mvp.as_int = mi->bmi[i - 2].as_mv[0].as_int;
- }
- }
- if (i == 0)
- max_mv = x->max_mv_context[mbmi->ref_frame[0]];
- else
- max_mv = MAX(abs(bsi->mvp.as_mv.row), abs(bsi->mvp.as_mv.col)) >> 3;
-
- if (cpi->sf.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 = (vp9_init_search_range(cpi, max_mv) +
- cpi->mv_step_param) >> 1;
- } else {
- step_param = cpi->mv_step_param;
- }
-
- mvp_full.row = bsi->mvp.as_mv.row >> 3;
- mvp_full.col = bsi->mvp.as_mv.col >> 3;
-
- if (cpi->sf.adaptive_motion_search && cm->show_frame) {
- mvp_full.row = x->pred_mv[mbmi->ref_frame[0]].as_mv.row >> 3;
- mvp_full.col = x->pred_mv[mbmi->ref_frame[0]].as_mv.col >> 3;
- step_param = MAX(step_param, 8);
- }
-
- further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
- // adjust src pointer for this block
- mi_buf_shift(x, i);
-
- vp9_set_mv_search_range(x, &bsi->ref_mv[0]->as_mv);
-
- if (cpi->sf.search_method == HEX) {
- bestsme = vp9_hex_search(x, &mvp_full,
- step_param,
- sadpb, 1, v_fn_ptr, 1,
- &bsi->ref_mv[0]->as_mv,
- &new_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &new_mv->as_mv,
- &bsi->ref_mv[0]->as_mv,
- v_fn_ptr, 1);
- } else if (cpi->sf.search_method == SQUARE) {
- bestsme = vp9_square_search(x, &mvp_full,
- step_param,
- sadpb, 1, v_fn_ptr, 1,
- &bsi->ref_mv[0]->as_mv,
- &new_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &new_mv->as_mv,
- &bsi->ref_mv[0]->as_mv,
- v_fn_ptr, 1);
- } else if (cpi->sf.search_method == BIGDIA) {
- bestsme = vp9_bigdia_search(x, &mvp_full,
- step_param,
- sadpb, 1, v_fn_ptr, 1,
- &bsi->ref_mv[0]->as_mv,
- &new_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &new_mv->as_mv,
- &bsi->ref_mv[0]->as_mv,
- v_fn_ptr, 1);
- } else {
- bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
- sadpb, further_steps, 0, v_fn_ptr,
- &bsi->ref_mv[0]->as_mv,
- &new_mv->as_mv);
- }
-
- // Should we do a full search (best quality only)
- if (cpi->oxcf.mode == MODE_BESTQUALITY ||
- cpi->oxcf.mode == MODE_SECONDPASS_BEST) {
- int_mv *const best_mv = &mi->bmi[i].as_mv[0];
- /* Check if mvp_full is within the range. */
- clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max,
- x->mv_row_min, x->mv_row_max);
- thissme = cpi->full_search_sad(x, &mvp_full,
- sadpb, 16, v_fn_ptr,
- x->nmvjointcost, x->mvcost,
- &bsi->ref_mv[0]->as_mv,
- &best_mv->as_mv);
- if (thissme < bestsme) {
- bestsme = thissme;
- new_mv->as_int = best_mv->as_int;
- } else {
- // The full search result is actually worse so re-instate the
- // previous best vector
- best_mv->as_int = new_mv->as_int;
- }
- }
-
- if (bestsme < INT_MAX) {
- int distortion;
- cpi->find_fractional_mv_step(x,
- &new_mv->as_mv,
- &bsi->ref_mv[0]->as_mv,
- cm->allow_high_precision_mv,
- x->errorperbit, v_fn_ptr,
- cpi->sf.subpel_force_stop,
- cpi->sf.subpel_iters_per_step,
- x->nmvjointcost, x->mvcost,
- &distortion,
- &x->pred_sse[mbmi->ref_frame[0]]);
-
- // save motion search result for use in compound prediction
- seg_mvs[i][mbmi->ref_frame[0]].as_int = new_mv->as_int;
- }
-
- if (cpi->sf.adaptive_motion_search)
- x->pred_mv[mbmi->ref_frame[0]].as_int = new_mv->as_int;
-
- // restore src pointers
- mi_buf_restore(x, orig_src, orig_pre);
- }
-
- if (has_second_rf) {
- if (seg_mvs[i][mbmi->ref_frame[1]].as_int == INVALID_MV ||
- seg_mvs[i][mbmi->ref_frame[0]].as_int == INVALID_MV)
- continue;
- }
-
- if (has_second_rf && this_mode == NEWMV &&
- mbmi->interp_filter == EIGHTTAP) {
- // adjust src pointers
- mi_buf_shift(x, i);
- if (cpi->sf.comp_inter_joint_search_thresh <= bsize) {
- int rate_mv;
- joint_motion_search(cpi, x, bsize, frame_mv[this_mode],
- mi_row, mi_col, seg_mvs[i],
- &rate_mv);
- seg_mvs[i][mbmi->ref_frame[0]].as_int =
- frame_mv[this_mode][mbmi->ref_frame[0]].as_int;
- seg_mvs[i][mbmi->ref_frame[1]].as_int =
- frame_mv[this_mode][mbmi->ref_frame[1]].as_int;
- }
- // restore src pointers
- mi_buf_restore(x, orig_src, orig_pre);
- }
-
- bsi->rdstat[i][mode_idx].brate =
- labels2mode(cpi, xd, i, this_mode, mode_mv[this_mode], frame_mv,
- seg_mvs[i], bsi->ref_mv, x->nmvjointcost, x->mvcost);
-
- for (ref = 0; ref < 1 + has_second_rf; ++ref) {
- bsi->rdstat[i][mode_idx].mvs[ref].as_int =
- mode_mv[this_mode][ref].as_int;
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[i + 1][mode_idx].mvs[ref].as_int =
- mode_mv[this_mode][ref].as_int;
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[i + 2][mode_idx].mvs[ref].as_int =
- mode_mv[this_mode][ref].as_int;
- }
-
- // Trap vectors that reach beyond the UMV borders
- if (mv_check_bounds(x, &mode_mv[this_mode][0].as_mv) ||
- (has_second_rf &&
- mv_check_bounds(x, &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);
- have_ref &= mode_mv[this_mode][ref].as_int ==
- ref_bsi->rdstat[i][mode_idx].mvs[ref].as_int;
- }
-
- if (filter_idx > 1 && !subpelmv && !have_ref) {
- ref_bsi = bsi_buf + 1;
- have_ref = 1;
- for (ref = 0; ref < 1 + has_second_rf; ++ref)
- have_ref &= mode_mv[this_mode][ref].as_int ==
- ref_bsi->rdstat[i][mode_idx].mvs[ref].as_int;
- }
-
- if (!subpelmv && have_ref &&
- ref_bsi->rdstat[i][mode_idx].brdcost < INT64_MAX) {
- vpx_memcpy(&bsi->rdstat[i][mode_idx], &ref_bsi->rdstat[i][mode_idx],
- sizeof(SEG_RDSTAT));
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[i + 1][mode_idx].eobs =
- ref_bsi->rdstat[i + 1][mode_idx].eobs;
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[i + 2][mode_idx].eobs =
- ref_bsi->rdstat[i + 2][mode_idx].eobs;
-
- if (bsi->rdstat[i][mode_idx].brdcost < best_rd) {
- mode_selected = this_mode;
- best_rd = bsi->rdstat[i][mode_idx].brdcost;
- }
- continue;
- }
- }
-
- bsi->rdstat[i][mode_idx].brdcost =
- encode_inter_mb_segment(cpi, x,
- bsi->segment_rd - this_segment_rd, i,
- &bsi->rdstat[i][mode_idx].byrate,
- &bsi->rdstat[i][mode_idx].bdist,
- &bsi->rdstat[i][mode_idx].bsse,
- bsi->rdstat[i][mode_idx].ta,
- bsi->rdstat[i][mode_idx].tl,
- mi_row, mi_col);
- if (bsi->rdstat[i][mode_idx].brdcost < INT64_MAX) {
- bsi->rdstat[i][mode_idx].brdcost += RDCOST(x->rdmult, x->rddiv,
- bsi->rdstat[i][mode_idx].brate, 0);
- bsi->rdstat[i][mode_idx].brate += bsi->rdstat[i][mode_idx].byrate;
- bsi->rdstat[i][mode_idx].eobs = p->eobs[i];
- if (num_4x4_blocks_wide > 1)
- bsi->rdstat[i + 1][mode_idx].eobs = p->eobs[i + 1];
- if (num_4x4_blocks_high > 1)
- bsi->rdstat[i + 2][mode_idx].eobs = p->eobs[i + 2];
- }
-
- if (bsi->rdstat[i][mode_idx].brdcost < best_rd) {
- mode_selected = this_mode;
- best_rd = bsi->rdstat[i][mode_idx].brdcost;
- }
- } /*for each 4x4 mode*/
-
- if (best_rd == INT64_MAX) {
- int iy, midx;
- for (iy = i + 1; iy < 4; ++iy)
- for (midx = 0; midx < INTER_MODES; ++midx)
- bsi->rdstat[iy][midx].brdcost = INT64_MAX;
- bsi->segment_rd = INT64_MAX;
- return;
- }
-
- mode_idx = INTER_OFFSET(mode_selected);
- vpx_memcpy(t_above, bsi->rdstat[i][mode_idx].ta, sizeof(t_above));
- vpx_memcpy(t_left, bsi->rdstat[i][mode_idx].tl, sizeof(t_left));
-
- labels2mode(cpi, xd, i, mode_selected, mode_mv[mode_selected],
- frame_mv, seg_mvs[i], bsi->ref_mv, x->nmvjointcost,
- x->mvcost);
-
- br += bsi->rdstat[i][mode_idx].brate;
- bd += bsi->rdstat[i][mode_idx].bdist;
- block_sse += bsi->rdstat[i][mode_idx].bsse;
- segmentyrate += bsi->rdstat[i][mode_idx].byrate;
- this_segment_rd += bsi->rdstat[i][mode_idx].brdcost;
-
- if (this_segment_rd > bsi->segment_rd) {
- int iy, midx;
- for (iy = i + 1; iy < 4; ++iy)
- for (midx = 0; midx < INTER_MODES; ++midx)
- bsi->rdstat[iy][midx].brdcost = INT64_MAX;
- bsi->segment_rd = INT64_MAX;
- return;
- }
- }
- } /* for each label */
-
- 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;
-}
-
-static int64_t rd_pick_best_mbsegmentation(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- 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][MAX_REF_FRAMES],
- BEST_SEG_INFO *bsi_buf,
- int filter_idx,
- int mi_row, int mi_col) {
- int i;
- BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
- MACROBLOCKD *xd = &x->e_mbd;
- MODE_INFO *mi = xd->mi[0];
- MB_MODE_INFO *mbmi = &mi->mbmi;
- int mode_idx;
-
- vp9_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 (i = 0; i < 4; i++)
- bsi->modes[i] = ZEROMV;
-
- rd_check_segment_txsize(cpi, x, tile, bsi_buf, filter_idx, seg_mvs,
- mi_row, mi_col);
-
- if (bsi->segment_rd > best_rd)
- return INT64_MAX;
- /* set it to the best */
- for (i = 0; i < 4; i++) {
- mode_idx = INTER_OFFSET(bsi->modes[i]);
- mi->bmi[i].as_mv[0].as_int = bsi->rdstat[i][mode_idx].mvs[0].as_int;
- if (has_second_ref(mbmi))
- mi->bmi[i].as_mv[1].as_int = bsi->rdstat[i][mode_idx].mvs[1].as_int;
- x->plane[0].eobs[i] = bsi->rdstat[i][mode_idx].eobs;
- mi->bmi[i].as_mode = bsi->modes[i];
- }
-
- /*
- * used to set mbmi->mv.as_int
- */
- *returntotrate = bsi->r;
- *returndistortion = bsi->d;
- *returnyrate = bsi->segment_yrate;
- *skippable = vp9_is_skippable_in_plane(x, BLOCK_8X8, 0);
- *psse = bsi->sse;
- mbmi->mode = bsi->modes[3];
-
- return bsi->segment_rd;
-}
-
-static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x,
- uint8_t *ref_y_buffer, int ref_y_stride,
- int ref_frame, BLOCK_SIZE block_size ) {
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- int_mv this_mv;
- int i;
- int zero_seen = 0;
- int best_index = 0;
- int best_sad = INT_MAX;
- int this_sad = INT_MAX;
- int max_mv = 0;
-
- uint8_t *src_y_ptr = x->plane[0].src.buf;
- uint8_t *ref_y_ptr;
- int row_offset, col_offset;
- int num_mv_refs = MAX_MV_REF_CANDIDATES +
- (cpi->sf.adaptive_motion_search &&
- cpi->common.show_frame &&
- block_size < cpi->sf.max_partition_size);
-
- int_mv pred_mv[3];
- pred_mv[0] = mbmi->ref_mvs[ref_frame][0];
- pred_mv[1] = mbmi->ref_mvs[ref_frame][1];
- pred_mv[2] = x->pred_mv[ref_frame];
-
- // Get the sad for each candidate reference mv
- for (i = 0; i < num_mv_refs; i++) {
- this_mv.as_int = pred_mv[i].as_int;
-
- max_mv = MAX(max_mv,
- MAX(abs(this_mv.as_mv.row), abs(this_mv.as_mv.col)) >> 3);
- // only need to check zero mv once
- if (!this_mv.as_int && zero_seen)
- continue;
-
- zero_seen = zero_seen || !this_mv.as_int;
-
- row_offset = this_mv.as_mv.row >> 3;
- col_offset = this_mv.as_mv.col >> 3;
- ref_y_ptr = ref_y_buffer + (ref_y_stride * row_offset) + col_offset;
-
- // Find sad for current vector.
- this_sad = cpi->fn_ptr[block_size].sdf(src_y_ptr, x->plane[0].src.stride,
- ref_y_ptr, ref_y_stride,
- 0x7fffffff);
-
- // Note if it is the best so far.
- if (this_sad < best_sad) {
- best_sad = this_sad;
- best_index = i;
- }
- }
-
- // Note the index of the mv that worked best in the reference list.
- x->mv_best_ref_index[ref_frame] = best_index;
- x->max_mv_context[ref_frame] = max_mv;
- x->pred_mv_sad[ref_frame] = best_sad;
-}
-
-static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
- unsigned int *ref_costs_single,
- unsigned int *ref_costs_comp,
- vp9_prob *comp_mode_p) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- int seg_ref_active = vp9_segfeature_active(&cm->seg, segment_id,
- SEG_LVL_REF_FRAME);
- if (seg_ref_active) {
- vpx_memset(ref_costs_single, 0, MAX_REF_FRAMES * sizeof(*ref_costs_single));
- vpx_memset(ref_costs_comp, 0, MAX_REF_FRAMES * sizeof(*ref_costs_comp));
- *comp_mode_p = 128;
- } else {
- vp9_prob intra_inter_p = vp9_get_intra_inter_prob(cm, xd);
- vp9_prob comp_inter_p = 128;
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT) {
- comp_inter_p = vp9_get_reference_mode_prob(cm, xd);
- *comp_mode_p = comp_inter_p;
- } else {
- *comp_mode_p = 128;
- }
-
- ref_costs_single[INTRA_FRAME] = vp9_cost_bit(intra_inter_p, 0);
-
- if (cm->reference_mode != COMPOUND_REFERENCE) {
- vp9_prob ref_single_p1 = vp9_get_pred_prob_single_ref_p1(cm, xd);
- vp9_prob ref_single_p2 = vp9_get_pred_prob_single_ref_p2(cm, xd);
- unsigned int base_cost = vp9_cost_bit(intra_inter_p, 1);
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT)
- base_cost += vp9_cost_bit(comp_inter_p, 0);
-
- ref_costs_single[LAST_FRAME] = ref_costs_single[GOLDEN_FRAME] =
- ref_costs_single[ALTREF_FRAME] = base_cost;
- ref_costs_single[LAST_FRAME] += vp9_cost_bit(ref_single_p1, 0);
- ref_costs_single[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p1, 1);
- ref_costs_single[ALTREF_FRAME] += vp9_cost_bit(ref_single_p1, 1);
- ref_costs_single[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p2, 0);
- ref_costs_single[ALTREF_FRAME] += vp9_cost_bit(ref_single_p2, 1);
- } else {
- ref_costs_single[LAST_FRAME] = 512;
- ref_costs_single[GOLDEN_FRAME] = 512;
- ref_costs_single[ALTREF_FRAME] = 512;
- }
- if (cm->reference_mode != SINGLE_REFERENCE) {
- vp9_prob ref_comp_p = vp9_get_pred_prob_comp_ref_p(cm, xd);
- unsigned int base_cost = vp9_cost_bit(intra_inter_p, 1);
-
- if (cm->reference_mode == REFERENCE_MODE_SELECT)
- base_cost += vp9_cost_bit(comp_inter_p, 1);
-
- ref_costs_comp[LAST_FRAME] = base_cost + vp9_cost_bit(ref_comp_p, 0);
- ref_costs_comp[GOLDEN_FRAME] = base_cost + vp9_cost_bit(ref_comp_p, 1);
- } else {
- ref_costs_comp[LAST_FRAME] = 512;
- ref_costs_comp[GOLDEN_FRAME] = 512;
- }
- }
-}
-
-static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
- int mode_index,
- int_mv *ref_mv,
- int_mv *second_ref_mv,
- int64_t comp_pred_diff[REFERENCE_MODES],
- int64_t tx_size_diff[TX_MODES],
- int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]) {
- MACROBLOCKD *const xd = &x->e_mbd;
-
- // Take a snapshot of the coding context so it can be
- // restored if we decide to encode this way
- ctx->skip = x->skip;
- ctx->best_mode_index = mode_index;
- ctx->mic = *xd->mi[0];
-
- ctx->best_ref_mv[0].as_int = ref_mv->as_int;
- ctx->best_ref_mv[1].as_int = second_ref_mv->as_int;
-
- ctx->single_pred_diff = (int)comp_pred_diff[SINGLE_REFERENCE];
- ctx->comp_pred_diff = (int)comp_pred_diff[COMPOUND_REFERENCE];
- ctx->hybrid_pred_diff = (int)comp_pred_diff[REFERENCE_MODE_SELECT];
-
- vpx_memcpy(ctx->tx_rd_diff, tx_size_diff, sizeof(ctx->tx_rd_diff));
- vpx_memcpy(ctx->best_filter_diff, best_filter_diff,
- sizeof(*best_filter_diff) * SWITCHABLE_FILTER_CONTEXTS);
-}
-
-static void setup_pred_block(const MACROBLOCKD *xd,
- struct buf_2d dst[MAX_MB_PLANE],
- const YV12_BUFFER_CONFIG *src,
- int mi_row, int mi_col,
- const struct scale_factors *scale,
- const struct scale_factors *scale_uv) {
- int i;
-
- dst[0].buf = src->y_buffer;
- dst[0].stride = src->y_stride;
- dst[1].buf = src->u_buffer;
- dst[2].buf = src->v_buffer;
- dst[1].stride = dst[2].stride = src->uv_stride;
-#if CONFIG_ALPHA
- dst[3].buf = src->alpha_buffer;
- dst[3].stride = src->alpha_stride;
-#endif
-
- // TODO(jkoleszar): Make scale factors per-plane data
- for (i = 0; i < MAX_MB_PLANE; i++) {
- setup_pred_plane(dst + i, dst[i].buf, dst[i].stride, mi_row, mi_col,
- i ? scale_uv : scale,
- xd->plane[i].subsampling_x, xd->plane[i].subsampling_y);
- }
-}
-
-void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- MV_REFERENCE_FRAME ref_frame,
- BLOCK_SIZE block_size,
- int mi_row, int mi_col,
- int_mv frame_nearest_mv[MAX_REF_FRAMES],
- int_mv frame_near_mv[MAX_REF_FRAMES],
- struct buf_2d yv12_mb[4][MAX_MB_PLANE]) {
- const VP9_COMMON *cm = &cpi->common;
- const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame);
- MACROBLOCKD *const xd = &x->e_mbd;
- MODE_INFO *const mi = xd->mi[0];
- int_mv *const candidates = mi->mbmi.ref_mvs[ref_frame];
- const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf;
-
- // TODO(jkoleszar): Is the UV buffer ever used here? If so, need to make this
- // use the UV scaling factors.
- 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
- vp9_find_mv_refs(cm, xd, tile, mi, ref_frame, candidates, mi_row, mi_col);
-
- // Candidate refinement carried out at encoder and decoder
- vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates,
- &frame_nearest_mv[ref_frame],
- &frame_near_mv[ref_frame]);
-
- // Further refinement that is encode side only to test the top few candidates
- // in full and choose the best as the centre point for subsequent searches.
- // The current implementation doesn't support scaling.
- if (!vp9_is_scaled(sf) && block_size >= BLOCK_8X8)
- mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12->y_stride,
- ref_frame, block_size);
-}
-
-const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
- int ref_frame) {
- const VP9_COMMON *const cm = &cpi->common;
- const int ref_idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)];
- const int scaled_idx = cpi->scaled_ref_idx[ref_frame - 1];
- return (scaled_idx != ref_idx) ? &cm->frame_bufs[scaled_idx].buf : NULL;
-}
-
-static INLINE int get_switchable_rate(const MACROBLOCK *x) {
- const MACROBLOCKD *const xd = &x->e_mbd;
- const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- const int ctx = vp9_get_pred_context_switchable_interp(xd);
- return SWITCHABLE_INTERP_RATE_FACTOR *
- x->switchable_interp_costs[ctx][mbmi->interp_filter];
-}
-
-static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- BLOCK_SIZE bsize,
- int mi_row, int mi_col,
- int_mv *tmp_mv, int *rate_mv) {
- MACROBLOCKD *xd = &x->e_mbd;
- VP9_COMMON *cm = &cpi->common;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}};
- int bestsme = INT_MAX;
- int further_steps, step_param;
- int sadpb = x->sadperbit16;
- MV mvp_full;
- int ref = mbmi->ref_frame[0];
- MV ref_mv = mbmi->ref_mvs[ref][0].as_mv;
-
- int tmp_col_min = x->mv_col_min;
- int tmp_col_max = x->mv_col_max;
- int tmp_row_min = x->mv_row_min;
- int tmp_row_max = x->mv_row_max;
-
- const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
- ref);
-
- MV pred_mv[3];
- pred_mv[0] = mbmi->ref_mvs[ref][0].as_mv;
- pred_mv[1] = mbmi->ref_mvs[ref][1].as_mv;
- pred_mv[2] = x->pred_mv[ref].as_mv;
-
- 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[0];
-
- vp9_setup_pre_planes(xd, 0, scaled_ref_frame, mi_row, mi_col, NULL);
- }
-
- vp9_set_mv_search_range(x, &ref_mv);
-
- // 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.auto_mv_step_size && cpi->common.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 = (vp9_init_search_range(cpi, x->max_mv_context[ref]) +
- cpi->mv_step_param) >> 1;
- } else {
- step_param = cpi->mv_step_param;
- }
-
- if (cpi->sf.adaptive_motion_search && bsize < BLOCK_64X64 &&
- cpi->common.show_frame) {
- int boffset = 2 * (b_width_log2(BLOCK_64X64) - MIN(b_height_log2(bsize),
- b_width_log2(bsize)));
- step_param = MAX(step_param, boffset);
- }
-
- if (cpi->sf.adaptive_motion_search) {
- int bwl = b_width_log2_lookup[bsize];
- int bhl = b_height_log2_lookup[bsize];
- int i;
- int tlevel = x->pred_mv_sad[ref] >> (bwl + bhl + 4);
-
- if (tlevel < 5)
- step_param += 2;
-
- for (i = LAST_FRAME; i <= ALTREF_FRAME && cpi->common.show_frame; ++i) {
- if ((x->pred_mv_sad[ref] >> 3) > x->pred_mv_sad[i]) {
- x->pred_mv[ref].as_int = 0;
- tmp_mv->as_int = INVALID_MV;
-
- if (scaled_ref_frame) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++)
- xd->plane[i].pre[0] = backup_yv12[i];
- }
- return;
- }
- }
- }
-
- mvp_full = pred_mv[x->mv_best_ref_index[ref]];
-
- mvp_full.col >>= 3;
- mvp_full.row >>= 3;
-
- // Further step/diamond searches as necessary
- further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
-
- if (cpi->sf.search_method == FAST_DIAMOND) {
- bestsme = vp9_fast_dia_search(x, &mvp_full, step_param, sadpb, 0,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &tmp_mv->as_mv, &ref_mv,
- &cpi->fn_ptr[bsize], 1);
- } else if (cpi->sf.search_method == FAST_HEX) {
- bestsme = vp9_fast_hex_search(x, &mvp_full, step_param, sadpb, 0,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &tmp_mv->as_mv, &ref_mv,
- &cpi->fn_ptr[bsize], 1);
- } else if (cpi->sf.search_method == HEX) {
- bestsme = vp9_hex_search(x, &mvp_full, step_param, sadpb, 1,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &tmp_mv->as_mv, &ref_mv,
- &cpi->fn_ptr[bsize], 1);
- } else if (cpi->sf.search_method == SQUARE) {
- bestsme = vp9_square_search(x, &mvp_full, step_param, sadpb, 1,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &tmp_mv->as_mv, &ref_mv,
- &cpi->fn_ptr[bsize], 1);
- } else if (cpi->sf.search_method == BIGDIA) {
- bestsme = vp9_bigdia_search(x, &mvp_full, step_param, sadpb, 1,
- &cpi->fn_ptr[bsize], 1,
- &ref_mv, &tmp_mv->as_mv);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_var(x, &tmp_mv->as_mv, &ref_mv,
- &cpi->fn_ptr[bsize], 1);
- } else {
- bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
- sadpb, further_steps, 1,
- &cpi->fn_ptr[bsize],
- &ref_mv, &tmp_mv->as_mv);
- }
-
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
-
- if (bestsme < INT_MAX) {
- int dis; /* TODO: use dis in distortion calculation later. */
- cpi->find_fractional_mv_step(x, &tmp_mv->as_mv, &ref_mv,
- cm->allow_high_precision_mv,
- x->errorperbit,
- &cpi->fn_ptr[bsize],
- cpi->sf.subpel_force_stop,
- cpi->sf.subpel_iters_per_step,
- x->nmvjointcost, x->mvcost,
- &dis, &x->pred_sse[ref]);
- }
- *rate_mv = vp9_mv_bit_cost(&tmp_mv->as_mv, &ref_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
-
- if (cpi->sf.adaptive_motion_search && cpi->common.show_frame)
- x->pred_mv[ref].as_int = tmp_mv->as_int;
-
- if (scaled_ref_frame) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++)
- xd->plane[i].pre[0] = backup_yv12[i];
- }
-}
-
-static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
- BLOCK_SIZE bsize,
- int_mv *frame_mv,
- int mi_row, int mi_col,
- int_mv single_newmv[MAX_REF_FRAMES],
- int *rate_mv) {
- const int pw = 4 * num_4x4_blocks_wide_lookup[bsize];
- const int ph = 4 * num_4x4_blocks_high_lookup[bsize];
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- const int refs[2] = { mbmi->ref_frame[0],
- mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1] };
- int_mv ref_mv[2];
- int ite, ref;
- // Prediction buffer from second frame.
- uint8_t *second_pred = vpx_memalign(16, pw * ph * sizeof(uint8_t));
- const InterpKernel *kernel = vp9_get_interp_kernel(mbmi->interp_filter);
-
- // Do joint motion search in compound mode to get more accurate mv.
- struct buf_2d backup_yv12[2][MAX_MB_PLANE];
- struct buf_2d scaled_first_yv12 = xd->plane[0].pre[0];
- int last_besterr[2] = {INT_MAX, INT_MAX};
- const YV12_BUFFER_CONFIG *const scaled_ref_frame[2] = {
- vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]),
- vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[1])
- };
-
- for (ref = 0; ref < 2; ++ref) {
- ref_mv[ref] = mbmi->ref_mvs[refs[ref]][0];
-
- if (scaled_ref_frame[ref]) {
- 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[ref][i] = xd->plane[i].pre[ref];
- vp9_setup_pre_planes(xd, ref, scaled_ref_frame[ref], mi_row, mi_col,
- NULL);
- }
-
- frame_mv[refs[ref]].as_int = single_newmv[refs[ref]].as_int;
- }
-
- // Allow joint search multiple times iteratively for each ref frame
- // and break out the search loop if it couldn't find better mv.
- for (ite = 0; ite < 4; ite++) {
- struct buf_2d ref_yv12[2];
- int bestsme = INT_MAX;
- int sadpb = x->sadperbit16;
- int_mv tmp_mv;
- int search_range = 3;
-
- int tmp_col_min = x->mv_col_min;
- int tmp_col_max = x->mv_col_max;
- int tmp_row_min = x->mv_row_min;
- int tmp_row_max = x->mv_row_max;
- int id = ite % 2;
-
- // Initialized here because of compiler problem in Visual Studio.
- ref_yv12[0] = xd->plane[0].pre[0];
- ref_yv12[1] = xd->plane[0].pre[1];
-
- // Get pred block from second frame.
- vp9_build_inter_predictor(ref_yv12[!id].buf,
- ref_yv12[!id].stride,
- second_pred, pw,
- &frame_mv[refs[!id]].as_mv,
- &xd->block_refs[!id]->sf,
- pw, ph, 0,
- kernel, MV_PRECISION_Q3,
- mi_col * MI_SIZE, mi_row * MI_SIZE);
-
- // Compound motion search on first ref frame.
- if (id)
- xd->plane[0].pre[0] = ref_yv12[id];
- vp9_set_mv_search_range(x, &ref_mv[id].as_mv);
-
- // Use mv result from single mode as mvp.
- tmp_mv.as_int = frame_mv[refs[id]].as_int;
-
- tmp_mv.as_mv.col >>= 3;
- tmp_mv.as_mv.row >>= 3;
-
- // Small-range full-pixel motion search
- bestsme = vp9_refining_search_8p_c(x, &tmp_mv.as_mv, sadpb,
- search_range,
- &cpi->fn_ptr[bsize],
- x->nmvjointcost, x->mvcost,
- &ref_mv[id].as_mv, second_pred,
- pw, ph);
- if (bestsme < INT_MAX)
- bestsme = vp9_get_mvpred_av_var(x, &tmp_mv.as_mv, &ref_mv[id].as_mv,
- second_pred, &cpi->fn_ptr[bsize], 1);
-
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
-
- if (bestsme < INT_MAX) {
- int dis; /* TODO: use dis in distortion calculation later. */
- unsigned int sse;
- bestsme = cpi->find_fractional_mv_step_comp(
- x, &tmp_mv.as_mv,
- &ref_mv[id].as_mv,
- cpi->common.allow_high_precision_mv,
- x->errorperbit,
- &cpi->fn_ptr[bsize],
- 0, cpi->sf.subpel_iters_per_step,
- x->nmvjointcost, x->mvcost,
- &dis, &sse, second_pred,
- pw, ph);
- }
-
- if (id)
- xd->plane[0].pre[0] = scaled_first_yv12;
-
- if (bestsme < last_besterr[id]) {
- frame_mv[refs[id]].as_int = tmp_mv.as_int;
- last_besterr[id] = bestsme;
- } else {
- break;
- }
- }
-
- *rate_mv = 0;
-
- for (ref = 0; ref < 2; ++ref) {
- if (scaled_ref_frame[ref]) {
- // restore the predictor
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++)
- xd->plane[i].pre[ref] = backup_yv12[ref][i];
- }
-
- *rate_mv += vp9_mv_bit_cost(&frame_mv[refs[ref]].as_mv,
- &mbmi->ref_mvs[refs[ref]][0].as_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
- }
-
- vpx_free(second_pred);
-}
-
-static INLINE void restore_dst_buf(MACROBLOCKD *xd,
- uint8_t *orig_dst[MAX_MB_PLANE],
- int orig_dst_stride[MAX_MB_PLANE]) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; i++) {
- xd->plane[i].dst.buf = orig_dst[i];
- xd->plane[i].dst.stride = orig_dst_stride[i];
- }
-}
-
-static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- BLOCK_SIZE bsize,
- int64_t txfm_cache[],
- int *rate2, int64_t *distortion,
- int *skippable,
- int *rate_y, int64_t *distortion_y,
- int *rate_uv, int64_t *distortion_uv,
- int *mode_excluded, int *disable_skip,
- INTERP_FILTER *best_filter,
- int_mv (*mode_mv)[MAX_REF_FRAMES],
- int mi_row, int mi_col,
- int_mv single_newmv[MAX_REF_FRAMES],
- int64_t *psse,
- const int64_t ref_best_rd) {
- VP9_COMMON *cm = &cpi->common;
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- const int is_comp_pred = has_second_ref(mbmi);
- const int num_refs = is_comp_pred ? 2 : 1;
- const int this_mode = mbmi->mode;
- int_mv *frame_mv = mode_mv[this_mode];
- int i;
- int refs[2] = { mbmi->ref_frame[0],
- (mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]) };
- int_mv cur_mv[2];
- int64_t this_rd = 0;
- DECLARE_ALIGNED_ARRAY(16, uint8_t, tmp_buf, MAX_MB_PLANE * 64 * 64);
- int pred_exists = 0;
- int intpel_mv;
- int64_t rd, best_rd = INT64_MAX;
- int best_needs_copy = 0;
- uint8_t *orig_dst[MAX_MB_PLANE];
- int orig_dst_stride[MAX_MB_PLANE];
- int rs = 0;
-
- if (is_comp_pred) {
- if (frame_mv[refs[0]].as_int == INVALID_MV ||
- frame_mv[refs[1]].as_int == INVALID_MV)
- return INT64_MAX;
- }
-
- if (this_mode == NEWMV) {
- int rate_mv;
- if (is_comp_pred) {
- // Initialize mv using single prediction mode result.
- frame_mv[refs[0]].as_int = single_newmv[refs[0]].as_int;
- 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, single_newmv, &rate_mv);
- } else {
- rate_mv = vp9_mv_bit_cost(&frame_mv[refs[0]].as_mv,
- &mbmi->ref_mvs[refs[0]][0].as_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
- rate_mv += vp9_mv_bit_cost(&frame_mv[refs[1]].as_mv,
- &mbmi->ref_mvs[refs[1]][0].as_mv,
- x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
- }
- *rate2 += rate_mv;
- } else {
- int_mv tmp_mv;
- single_motion_search(cpi, x, tile, bsize, mi_row, mi_col,
- &tmp_mv, &rate_mv);
- if (tmp_mv.as_int == INVALID_MV)
- return INT64_MAX;
- *rate2 += rate_mv;
- frame_mv[refs[0]].as_int =
- xd->mi[0]->bmi[0].as_mv[0].as_int = tmp_mv.as_int;
- single_newmv[refs[0]].as_int = tmp_mv.as_int;
- }
- }
-
- for (i = 0; i < num_refs; ++i) {
- cur_mv[i] = frame_mv[refs[i]];
- // Clip "next_nearest" so that it does not extend to far out of image
- if (this_mode != NEWMV)
- clamp_mv2(&cur_mv[i].as_mv, xd);
-
- if (mv_check_bounds(x, &cur_mv[i].as_mv))
- return INT64_MAX;
- mbmi->mv[i].as_int = cur_mv[i].as_int;
- }
-
- // do first prediction into the destination buffer. Do the next
- // prediction into a temporary buffer. Then keep track of which one
- // of these currently holds the best predictor, and use the other
- // one for future predictions. In the end, copy from tmp_buf to
- // dst if necessary.
- for (i = 0; i < MAX_MB_PLANE; i++) {
- orig_dst[i] = xd->plane[i].dst.buf;
- orig_dst_stride[i] = xd->plane[i].dst.stride;
- }
-
- /* We don't include the cost of the second reference here, because there
- * are only three options: Last/Golden, ARF/Last or Golden/ARF, or in other
- * words if you present them in that order, the second one is always known
- * if the first is known */
- *rate2 += cost_mv_ref(cpi, this_mode, mbmi->mode_context[refs[0]]);
-
- if (!(*mode_excluded))
- *mode_excluded = is_comp_pred ? cm->reference_mode == SINGLE_REFERENCE
- : cm->reference_mode == COMPOUND_REFERENCE;
-
- pred_exists = 0;
- // Are all MVs integer pel for Y and UV
- intpel_mv = !mv_has_subpel(&mbmi->mv[0].as_mv);
- if (is_comp_pred)
- intpel_mv &= !mv_has_subpel(&mbmi->mv[1].as_mv);
-
- // Search for best switchable filter by checking the variance of
- // pred error irrespective of whether the filter will be used
- cpi->mask_filter_rd = 0;
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
- cpi->rd_filter_cache[i] = INT64_MAX;
-
- if (cm->interp_filter != BILINEAR) {
- *best_filter = EIGHTTAP;
- if (x->source_variance <
- cpi->sf.disable_filter_search_var_thresh) {
- *best_filter = EIGHTTAP;
- } else {
- int newbest;
- int tmp_rate_sum = 0;
- int64_t tmp_dist_sum = 0;
-
- for (i = 0; i < SWITCHABLE_FILTERS; ++i) {
- int j;
- int64_t rs_rd;
- mbmi->interp_filter = i;
- rs = get_switchable_rate(x);
- rs_rd = RDCOST(x->rdmult, x->rddiv, rs, 0);
-
- if (i > 0 && intpel_mv) {
- rd = RDCOST(x->rdmult, x->rddiv, tmp_rate_sum, tmp_dist_sum);
- cpi->rd_filter_cache[i] = rd;
- cpi->rd_filter_cache[SWITCHABLE_FILTERS] =
- MIN(cpi->rd_filter_cache[SWITCHABLE_FILTERS], rd + rs_rd);
- if (cm->interp_filter == SWITCHABLE)
- rd += rs_rd;
- cpi->mask_filter_rd = MAX(cpi->mask_filter_rd, rd);
- } else {
- int rate_sum = 0;
- int64_t dist_sum = 0;
- if ((cm->interp_filter == SWITCHABLE &&
- (!i || best_needs_copy)) ||
- (cm->interp_filter != SWITCHABLE &&
- (cm->interp_filter == mbmi->interp_filter ||
- (i == 0 && intpel_mv)))) {
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- } else {
- for (j = 0; j < MAX_MB_PLANE; j++) {
- xd->plane[j].dst.buf = tmp_buf + j * 64 * 64;
- xd->plane[j].dst.stride = 64;
- }
- }
- vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
- model_rd_for_sb(cpi, bsize, x, xd, &rate_sum, &dist_sum);
-
- rd = RDCOST(x->rdmult, x->rddiv, rate_sum, dist_sum);
- cpi->rd_filter_cache[i] = rd;
- cpi->rd_filter_cache[SWITCHABLE_FILTERS] =
- MIN(cpi->rd_filter_cache[SWITCHABLE_FILTERS], rd + rs_rd);
- if (cm->interp_filter == SWITCHABLE)
- rd += rs_rd;
- cpi->mask_filter_rd = MAX(cpi->mask_filter_rd, rd);
-
- if (i == 0 && intpel_mv) {
- tmp_rate_sum = rate_sum;
- tmp_dist_sum = dist_sum;
- }
- }
-
- if (i == 0 && cpi->sf.use_rd_breakout && ref_best_rd < INT64_MAX) {
- if (rd / 2 > ref_best_rd) {
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- return INT64_MAX;
- }
- }
- newbest = i == 0 || rd < best_rd;
-
- if (newbest) {
- best_rd = rd;
- *best_filter = mbmi->interp_filter;
- if (cm->interp_filter == SWITCHABLE && i && !intpel_mv)
- best_needs_copy = !best_needs_copy;
- }
-
- if ((cm->interp_filter == SWITCHABLE && newbest) ||
- (cm->interp_filter != SWITCHABLE &&
- cm->interp_filter == mbmi->interp_filter)) {
- pred_exists = 1;
- }
- }
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- }
- }
- // Set the appropriate filter
- mbmi->interp_filter = cm->interp_filter != SWITCHABLE ?
- cm->interp_filter : *best_filter;
- rs = cm->interp_filter == SWITCHABLE ? get_switchable_rate(x) : 0;
-
- if (pred_exists) {
- if (best_needs_copy) {
- // again temporarily set the buffers to local memory to prevent a memcpy
- for (i = 0; i < MAX_MB_PLANE; i++) {
- xd->plane[i].dst.buf = tmp_buf + i * 64 * 64;
- xd->plane[i].dst.stride = 64;
- }
- }
- } else {
- // Handles the special case when a filter that is not in the
- // switchable list (ex. bilinear, 6-tap) is indicated at the frame level
- vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
- }
-
- if (cpi->sf.use_rd_breakout && ref_best_rd < INT64_MAX) {
- int tmp_rate;
- int64_t tmp_dist;
- model_rd_for_sb(cpi, bsize, x, xd, &tmp_rate, &tmp_dist);
- rd = RDCOST(x->rdmult, x->rddiv, rs + tmp_rate, tmp_dist);
- // if current pred_error modeled rd is substantially more than the best
- // so far, do not bother doing full rd
- if (rd / 2 > ref_best_rd) {
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- return INT64_MAX;
- }
- }
-
- if (cm->interp_filter == SWITCHABLE)
- *rate2 += get_switchable_rate(x);
-
- if (!is_comp_pred) {
- if (!x->in_active_map) {
- if (psse)
- *psse = 0;
- *distortion = 0;
- x->skip = 1;
- } else if (cpi->allow_encode_breakout && x->encode_breakout) {
- const BLOCK_SIZE y_size = get_plane_block_size(bsize, &xd->plane[0]);
- const BLOCK_SIZE uv_size = get_plane_block_size(bsize, &xd->plane[1]);
- unsigned int var, sse;
- // Skipping threshold for ac.
- unsigned int thresh_ac;
- // Set a maximum for threshold to avoid big PSNR loss in low bitrate case.
- // Use extreme low threshold for static frames to limit skipping.
- const unsigned int max_thresh = (cpi->allow_encode_breakout ==
- ENCODE_BREAKOUT_LIMITED) ? 128 : 36000;
- // The encode_breakout input
- const unsigned int min_thresh =
- MIN(((unsigned int)x->encode_breakout << 4), max_thresh);
-
- // Calculate threshold according to dequant value.
- thresh_ac = (xd->plane[0].dequant[1] * xd->plane[0].dequant[1]) / 9;
- thresh_ac = clamp(thresh_ac, min_thresh, max_thresh);
-
- var = cpi->fn_ptr[y_size].vf(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].dst.buf,
- xd->plane[0].dst.stride, &sse);
-
- // Adjust threshold according to partition size.
- thresh_ac >>= 8 - (b_width_log2_lookup[bsize] +
- b_height_log2_lookup[bsize]);
-
- // Y skipping condition checking
- if (sse < thresh_ac || sse == 0) {
- // Skipping threshold for dc
- unsigned int thresh_dc;
-
- thresh_dc = (xd->plane[0].dequant[0] * xd->plane[0].dequant[0] >> 6);
-
- // dc skipping checking
- if ((sse - var) < thresh_dc || sse == var) {
- unsigned int sse_u, sse_v;
- unsigned int var_u, var_v;
-
- var_u = cpi->fn_ptr[uv_size].vf(x->plane[1].src.buf,
- x->plane[1].src.stride,
- xd->plane[1].dst.buf,
- xd->plane[1].dst.stride, &sse_u);
-
- // U skipping condition checking
- if ((sse_u * 4 < thresh_ac || sse_u == 0) &&
- (sse_u - var_u < thresh_dc || sse_u == var_u)) {
- var_v = cpi->fn_ptr[uv_size].vf(x->plane[2].src.buf,
- x->plane[2].src.stride,
- xd->plane[2].dst.buf,
- xd->plane[2].dst.stride, &sse_v);
-
- // V skipping condition checking
- if ((sse_v * 4 < thresh_ac || sse_v == 0) &&
- (sse_v - var_v < thresh_dc || sse_v == var_v)) {
- x->skip = 1;
-
- // The cost of skip bit needs to be added.
- *rate2 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
-
- // Scaling factor for SSE from spatial domain to frequency domain
- // is 16. Adjust distortion accordingly.
- *distortion_uv = (sse_u + sse_v) << 4;
- *distortion = (sse << 4) + *distortion_uv;
-
- *disable_skip = 1;
- this_rd = RDCOST(x->rdmult, x->rddiv, *rate2, *distortion);
- }
- }
- }
- }
- }
- }
-
- if (!x->skip) {
- int skippable_y, skippable_uv;
- int64_t sseuv = INT64_MAX;
- int64_t rdcosty = INT64_MAX;
-
- // Y cost and distortion
- inter_super_block_yrd(cpi, x, rate_y, distortion_y, &skippable_y, psse,
- bsize, txfm_cache, ref_best_rd);
-
- if (*rate_y == INT_MAX) {
- *rate2 = INT_MAX;
- *distortion = INT64_MAX;
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- return INT64_MAX;
- }
-
- *rate2 += *rate_y;
- *distortion += *distortion_y;
-
- rdcosty = RDCOST(x->rdmult, x->rddiv, *rate2, *distortion);
- rdcosty = MIN(rdcosty, RDCOST(x->rdmult, x->rddiv, 0, *psse));
-
- super_block_uvrd(cpi, x, rate_uv, distortion_uv, &skippable_uv, &sseuv,
- bsize, ref_best_rd - rdcosty);
- if (*rate_uv == INT_MAX) {
- *rate2 = INT_MAX;
- *distortion = INT64_MAX;
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- return INT64_MAX;
- }
-
- *psse += sseuv;
- *rate2 += *rate_uv;
- *distortion += *distortion_uv;
- *skippable = skippable_y && skippable_uv;
- }
-
- restore_dst_buf(xd, orig_dst, orig_dst_stride);
- return this_rd; // if 0, this will be re-calculated by caller
-}
-
-static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
- int max_plane) {
- struct macroblock_plane *const p = x->plane;
- struct macroblockd_plane *const pd = x->e_mbd.plane;
- int i;
-
- for (i = 0; i < max_plane; ++i) {
- p[i].coeff = ctx->coeff_pbuf[i][1];
- p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
- pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
- p[i].eobs = ctx->eobs_pbuf[i][1];
-
- ctx->coeff_pbuf[i][1] = ctx->coeff_pbuf[i][0];
- ctx->qcoeff_pbuf[i][1] = ctx->qcoeff_pbuf[i][0];
- ctx->dqcoeff_pbuf[i][1] = ctx->dqcoeff_pbuf[i][0];
- ctx->eobs_pbuf[i][1] = ctx->eobs_pbuf[i][0];
-
- ctx->coeff_pbuf[i][0] = p[i].coeff;
- ctx->qcoeff_pbuf[i][0] = p[i].qcoeff;
- ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff;
- ctx->eobs_pbuf[i][0] = p[i].eobs;
- }
-}
-
-void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
- int *returnrate, int64_t *returndist,
- BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx, int64_t best_rd) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- int rate_y = 0, rate_uv = 0, rate_y_tokenonly = 0, rate_uv_tokenonly = 0;
- int y_skip = 0, uv_skip = 0;
- int64_t dist_y = 0, dist_uv = 0, tx_cache[TX_MODES] = { 0 };
- TX_SIZE max_uv_tx_size;
- x->skip_encode = 0;
- ctx->skip = 0;
- xd->mi[0]->mbmi.ref_frame[0] = INTRA_FRAME;
-
- if (bsize >= BLOCK_8X8) {
- if (rd_pick_intra_sby_mode(cpi, x, &rate_y, &rate_y_tokenonly,
- &dist_y, &y_skip, bsize, tx_cache,
- best_rd) >= best_rd) {
- *returnrate = INT_MAX;
- return;
- }
- max_uv_tx_size = get_uv_tx_size_impl(xd->mi[0]->mbmi.tx_size, bsize);
- rd_pick_intra_sbuv_mode(cpi, x, ctx, &rate_uv, &rate_uv_tokenonly,
- &dist_uv, &uv_skip, bsize, max_uv_tx_size);
- } else {
- y_skip = 0;
- if (rd_pick_intra_sub_8x8_y_mode(cpi, x, &rate_y, &rate_y_tokenonly,
- &dist_y, best_rd) >= best_rd) {
- *returnrate = INT_MAX;
- return;
- }
- max_uv_tx_size = get_uv_tx_size_impl(xd->mi[0]->mbmi.tx_size, bsize);
- rd_pick_intra_sbuv_mode(cpi, x, ctx, &rate_uv, &rate_uv_tokenonly,
- &dist_uv, &uv_skip, BLOCK_8X8, max_uv_tx_size);
- }
-
- if (y_skip && uv_skip) {
- *returnrate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly +
- vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
- *returndist = dist_y + dist_uv;
- vp9_zero(ctx->tx_rd_diff);
- } else {
- int i;
- *returnrate = rate_y + rate_uv + vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
- *returndist = dist_y + dist_uv;
- if (cpi->sf.tx_size_search_method == USE_FULL_RD)
- for (i = 0; i < TX_MODES; i++) {
- if (tx_cache[i] < INT64_MAX && tx_cache[cm->tx_mode] < INT64_MAX)
- ctx->tx_rd_diff[i] = tx_cache[i] - tx_cache[cm->tx_mode];
- else
- ctx->tx_rd_diff[i] = 0;
- }
- }
-
- ctx->mic = *xd->mi[0];
-}
-
-int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- int mi_row, int mi_col,
- int *returnrate,
- int64_t *returndistortion,
- BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx,
- int64_t best_rd_so_far) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &x->e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- const struct segmentation *const seg = &cm->seg;
- MB_PREDICTION_MODE this_mode;
- 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][MAX_REF_FRAMES];
- struct buf_2d yv12_mb[4][MAX_MB_PLANE];
- int_mv single_newmv[MAX_REF_FRAMES] = { { 0 } };
- static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
- VP9_ALT_FLAG };
- int64_t best_rd = best_rd_so_far;
- int64_t best_tx_rd[TX_MODES];
- int64_t best_tx_diff[TX_MODES];
- int64_t best_pred_diff[REFERENCE_MODES];
- int64_t best_pred_rd[REFERENCE_MODES];
- int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS];
- int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
- MB_MODE_INFO best_mbmode = { 0 };
- int mode_index, best_mode_index = 0;
- unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES];
- vp9_prob comp_mode_p;
- int64_t best_intra_rd = INT64_MAX;
- int64_t best_inter_rd = INT64_MAX;
- MB_PREDICTION_MODE best_intra_mode = DC_PRED;
- MV_REFERENCE_FRAME best_inter_ref_frame = LAST_FRAME;
- INTERP_FILTER tmp_best_filter = SWITCHABLE;
- int rate_uv_intra[TX_SIZES], rate_uv_tokenonly[TX_SIZES];
- int64_t dist_uv[TX_SIZES];
- int skip_uv[TX_SIZES];
- MB_PREDICTION_MODE mode_uv[TX_SIZES];
- int64_t mode_distortions[MB_MODE_COUNT] = {-1};
- int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q);
- const int bws = num_8x8_blocks_wide_lookup[bsize] / 2;
- const int bhs = num_8x8_blocks_high_lookup[bsize] / 2;
- int best_skip2 = 0;
- int mode_skip_mask = 0;
- int mode_skip_start = cpi->sf.mode_skip_start + 1;
- const int *const rd_threshes = cpi->rd_threshes[segment_id][bsize];
- const int *const rd_thresh_freq_fact = cpi->rd_thresh_freq_fact[bsize];
- const int mode_search_skip_flags = cpi->sf.mode_search_skip_flags;
- const int intra_y_mode_mask =
- cpi->sf.intra_y_mode_mask[max_txsize_lookup[bsize]];
- int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize];
-
- x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH;
-
- estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
- &comp_mode_p);
-
- for (i = 0; i < REFERENCE_MODES; ++i)
- best_pred_rd[i] = INT64_MAX;
- for (i = 0; i < TX_MODES; i++)
- best_tx_rd[i] = INT64_MAX;
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
- best_filter_rd[i] = INT64_MAX;
- for (i = 0; i < TX_SIZES; i++)
- rate_uv_intra[i] = INT_MAX;
- for (i = 0; i < MAX_REF_FRAMES; ++i)
- x->pred_sse[i] = INT_MAX;
-
- *returnrate = INT_MAX;
-
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
- x->pred_mv_sad[ref_frame] = INT_MAX;
- if (cpi->ref_frame_flags & flag_list[ref_frame]) {
- vp9_setup_buffer_inter(cpi, x, tile,
- ref_frame, bsize, mi_row, mi_col,
- frame_mv[NEARESTMV], frame_mv[NEARMV], yv12_mb);
- }
- frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
- frame_mv[ZEROMV][ref_frame].as_int = 0;
- }
-
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
- // All modes from vp9_mode_order that use this frame as any ref
- static const int ref_frame_mask_all[] = {
- 0x0, 0x123291, 0x25c444, 0x39b722
- };
- // Fixed mv modes (NEARESTMV, NEARMV, ZEROMV) from vp9_mode_order that use
- // this frame as their primary ref
- static const int ref_frame_mask_fixedmv[] = {
- 0x0, 0x121281, 0x24c404, 0x080102
- };
- if (!(cpi->ref_frame_flags & flag_list[ref_frame])) {
- // Skip modes for missing references
- mode_skip_mask |= ref_frame_mask_all[ref_frame];
- } else if (cpi->sf.reference_masking) {
- for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
- // Skip fixed mv modes for poor references
- if ((x->pred_mv_sad[ref_frame] >> 2) > x->pred_mv_sad[i]) {
- mode_skip_mask |= ref_frame_mask_fixedmv[ref_frame];
- break;
- }
- }
- }
- // If the segment reference frame feature is enabled....
- // then do nothing if the current ref frame is not allowed..
- if (vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME) &&
- vp9_get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) != (int)ref_frame) {
- mode_skip_mask |= ref_frame_mask_all[ref_frame];
- }
- }
-
- // If the segment skip feature is enabled....
- // then do nothing if the current mode is not allowed..
- if (vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)) {
- const int inter_non_zero_mode_mask = 0x1F7F7;
- mode_skip_mask |= inter_non_zero_mode_mask;
- }
-
- // 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.
- if (!vp9_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)) {
- const int altref_zero_mask =
- ~((1 << THR_NEARESTA) | (1 << THR_NEARA) | (1 << THR_ZEROA));
- mode_skip_mask |= altref_zero_mask;
- if (frame_mv[NEARMV][ALTREF_FRAME].as_int != 0)
- mode_skip_mask |= (1 << THR_NEARA);
- if (frame_mv[NEARESTMV][ALTREF_FRAME].as_int != 0)
- mode_skip_mask |= (1 << THR_NEARESTA);
- }
- }
-
- // TODO(JBB): This is to make up for the fact that we don't have sad
- // functions that work when the block size reads outside the umv. We
- // should fix this either by making the motion search just work on
- // a representative block in the boundary ( first ) and then implement a
- // function that does sads when inside the border..
- if ((mi_row + bhs) > cm->mi_rows || (mi_col + bws) > cm->mi_cols) {
- const int new_modes_mask =
- (1 << THR_NEWMV) | (1 << THR_NEWG) | (1 << THR_NEWA) |
- (1 << THR_COMP_NEWLA) | (1 << THR_COMP_NEWGA);
- mode_skip_mask |= new_modes_mask;
- }
-
- if (bsize > cpi->sf.max_intra_bsize) {
- mode_skip_mask |= 0xFF30808;
- }
-
- if (!x->in_active_map) {
- int mode_index;
- assert(cpi->ref_frame_flags & VP9_LAST_FLAG);
- if (frame_mv[NEARESTMV][LAST_FRAME].as_int == 0)
- mode_index = THR_NEARESTMV;
- else if (frame_mv[NEARMV][LAST_FRAME].as_int == 0)
- mode_index = THR_NEARMV;
- else
- mode_index = THR_ZEROMV;
- mode_skip_mask = ~(1 << mode_index);
- mode_skip_start = MAX_MODES;
- disable_inter_mode_mask = 0;
- }
-
- for (mode_index = 0; mode_index < MAX_MODES; ++mode_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;
- int64_t tx_cache[TX_MODES];
- int i;
- int this_skip2 = 0;
- int64_t total_sse = INT64_MAX;
- int early_term = 0;
-
- // 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 (mode_index == mode_skip_start) {
- switch (vp9_mode_order[best_mode_index].ref_frame[0]) {
- case INTRA_FRAME:
- break;
- case LAST_FRAME:
- mode_skip_mask |= LAST_FRAME_MODE_MASK;
- break;
- case GOLDEN_FRAME:
- mode_skip_mask |= GOLDEN_FRAME_MODE_MASK;
- break;
- case ALTREF_FRAME:
- mode_skip_mask |= ALT_REF_MODE_MASK;
- break;
- case NONE:
- case MAX_REF_FRAMES:
- assert(0 && "Invalid Reference frame");
- }
- }
- if (mode_skip_mask & (1 << mode_index))
- continue;
-
- // Test best rd so far against threshold for trying this mode.
- if (best_rd < ((int64_t)rd_threshes[mode_index] *
- rd_thresh_freq_fact[mode_index] >> 5) ||
- rd_threshes[mode_index] == INT_MAX)
- continue;
-
- this_mode = vp9_mode_order[mode_index].mode;
- ref_frame = vp9_mode_order[mode_index].ref_frame[0];
- if (ref_frame != INTRA_FRAME &&
- disable_inter_mode_mask & (1 << INTER_OFFSET(this_mode)))
- continue;
- second_ref_frame = vp9_mode_order[mode_index].ref_frame[1];
-
- comp_pred = second_ref_frame > INTRA_FRAME;
- if (comp_pred) {
- if ((mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA) &&
- vp9_mode_order[best_mode_index].ref_frame[0] == INTRA_FRAME)
- continue;
- if ((mode_search_skip_flags & FLAG_SKIP_COMP_REFMISMATCH) &&
- ref_frame != best_inter_ref_frame &&
- second_ref_frame != best_inter_ref_frame)
- continue;
- mode_excluded = cm->reference_mode == SINGLE_REFERENCE;
- } else {
- if (ref_frame != INTRA_FRAME)
- mode_excluded = cm->reference_mode == COMPOUND_REFERENCE;
- }
-
- if (ref_frame == INTRA_FRAME) {
- if (!(intra_y_mode_mask & (1 << this_mode)))
- continue;
- if (this_mode != DC_PRED) {
- // Disable intra modes other than DC_PRED for blocks with low variance
- // Threshold for intra skipping based on source variance
- // TODO(debargha): Specialize the threshold for super block sizes
- const unsigned int skip_intra_var_thresh = 64;
- if ((mode_search_skip_flags & FLAG_SKIP_INTRA_LOWVAR) &&
- x->source_variance < skip_intra_var_thresh)
- continue;
- // Only search the oblique modes if the best so far is
- // one of the neighboring directional modes
- if ((mode_search_skip_flags & FLAG_SKIP_INTRA_BESTINTER) &&
- (this_mode >= D45_PRED && this_mode <= TM_PRED)) {
- if (vp9_mode_order[best_mode_index].ref_frame[0] > INTRA_FRAME)
- continue;
- }
- if (mode_search_skip_flags & FLAG_SKIP_INTRA_DIRMISMATCH) {
- if (conditional_skipintra(this_mode, best_intra_mode))
- continue;
- }
- }
- } else {
- if (x->in_active_map &&
- !vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP))
- if (!check_best_zero_mv(cpi, mbmi->mode_context, frame_mv,
- disable_inter_mode_mask, this_mode, ref_frame,
- second_ref_frame))
- continue;
- }
-
- mbmi->mode = this_mode;
- mbmi->uv_mode = x->in_active_map ? DC_PRED : this_mode;
- 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.
- mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP
- : cm->interp_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];
- }
-
- for (i = 0; i < TX_MODES; ++i)
- tx_cache[i] = INT64_MAX;
-
-#ifdef MODE_TEST_HIT_STATS
- // TEST/DEBUG CODE
- // Keep a rcord of the number of test hits at each size
- cpi->mode_test_hits[bsize]++;
-#endif
-
- if (ref_frame == INTRA_FRAME) {
- TX_SIZE uv_tx;
- intra_super_block_yrd(cpi, x, &rate_y, &distortion_y, &skippable, NULL,
- bsize, tx_cache, best_rd);
-
- if (rate_y == INT_MAX)
- continue;
-
- uv_tx = get_uv_tx_size_impl(mbmi->tx_size, bsize);
- if (rate_uv_intra[uv_tx] == INT_MAX) {
- choose_intra_uv_mode(cpi, ctx, bsize, uv_tx,
- &rate_uv_intra[uv_tx], &rate_uv_tokenonly[uv_tx],
- &dist_uv[uv_tx], &skip_uv[uv_tx], &mode_uv[uv_tx]);
- }
-
- rate_uv = rate_uv_tokenonly[uv_tx];
- distortion_uv = dist_uv[uv_tx];
- skippable = skippable && skip_uv[uv_tx];
- mbmi->uv_mode = mode_uv[uv_tx];
-
- rate2 = rate_y + x->mbmode_cost[mbmi->mode] + rate_uv_intra[uv_tx];
- if (this_mode != DC_PRED && this_mode != TM_PRED)
- rate2 += intra_cost_penalty;
- distortion2 = distortion_y + distortion_uv;
- } else {
- this_rd = handle_inter_mode(cpi, x, tile, bsize,
- tx_cache,
- &rate2, &distortion2, &skippable,
- &rate_y, &distortion_y,
- &rate_uv, &distortion_uv,
- &mode_excluded, &disable_skip,
- &tmp_best_filter, frame_mv,
- mi_row, mi_col,
- single_newmv, &total_sse, best_rd);
- if (this_rd == INT64_MAX)
- continue;
-
- compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred);
-
- 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 (comp_pred) {
- rate2 += ref_costs_comp[ref_frame];
- } else {
- rate2 += ref_costs_single[ref_frame];
- }
-
- if (!disable_skip) {
- // Test for the condition where skip block will be activated
- // because there are no non zero coefficients and make any
- // necessary adjustment for rate. Ignore if skip is coded at
- // segment level as the cost wont have been added in.
- // Is Mb level skip allowed (i.e. not coded at segment level).
- const int mb_skip_allowed = !vp9_segfeature_active(seg, segment_id,
- SEG_LVL_SKIP);
-
- if (skippable) {
- // Back out the coefficient coding costs
- rate2 -= (rate_y + rate_uv);
- // for best yrd calculation
- rate_uv = 0;
-
- if (mb_skip_allowed) {
- int prob_skip_cost;
-
- // Cost the skip mb case
- vp9_prob skip_prob = vp9_get_skip_prob(cm, xd);
- if (skip_prob) {
- prob_skip_cost = vp9_cost_bit(skip_prob, 1);
- rate2 += prob_skip_cost;
- }
- }
- } else if (mb_skip_allowed && ref_frame != INTRA_FRAME && !xd->lossless) {
- 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 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
- } else {
- // FIXME(rbultje) make this work for splitmv also
- rate2 += vp9_cost_bit(vp9_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 if (mb_skip_allowed) {
- // Add in the cost of the no skip flag.
- rate2 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
- }
-
- // Calculate the final RD estimate for this mode.
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- }
-
- if (ref_frame == INTRA_FRAME) {
- // Keep record of best intra rd
- if (this_rd < best_intra_rd) {
- best_intra_rd = this_rd;
- best_intra_mode = mbmi->mode;
- }
- } else {
- // Keep record of best inter rd with single reference
- if (!comp_pred && !mode_excluded && this_rd < best_inter_rd) {
- best_inter_rd = this_rd;
- best_inter_ref_frame = ref_frame;
- }
- }
-
- if (!disable_skip && ref_frame == INTRA_FRAME) {
- for (i = 0; i < REFERENCE_MODES; ++i)
- best_pred_rd[i] = MIN(best_pred_rd[i], this_rd);
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
- best_filter_rd[i] = MIN(best_filter_rd[i], this_rd);
- }
-
- // Store the respective mode distortions for later use.
- if (mode_distortions[this_mode] == -1
- || distortion2 < mode_distortions[this_mode]) {
- mode_distortions[this_mode] = distortion2;
- }
-
- // Did this mode help.. i.e. is it the new best mode
- if (this_rd < best_rd || x->skip) {
- int max_plane = MAX_MB_PLANE;
- if (!mode_excluded) {
- // Note index of best mode so far
- best_mode_index = mode_index;
-
- if (ref_frame == INTRA_FRAME) {
- /* required for left and above block mv */
- mbmi->mv[0].as_int = 0;
- max_plane = 1;
- }
-
- *returnrate = rate2;
- *returndistortion = distortion2;
- best_rd = this_rd;
- best_mbmode = *mbmi;
- best_skip2 = this_skip2;
- if (!x->select_txfm_size)
- swap_block_ptr(x, ctx, max_plane);
- vpx_memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
- sizeof(uint8_t) * ctx->num_4x4_blk);
-
- // TODO(debargha): enhance this test with a better distortion prediction
- // based on qp, activity mask and history
- if ((mode_search_skip_flags & FLAG_EARLY_TERMINATE) &&
- (mode_index > MIN_EARLY_TERM_INDEX)) {
- const int qstep = xd->plane[0].dequant[1];
- // TODO(debargha): Enhance this by specializing for each mode_index
- int scale = 4;
- if (x->source_variance < UINT_MAX) {
- const int var_adjust = (x->source_variance < 16);
- scale -= var_adjust;
- }
- if (ref_frame > INTRA_FRAME &&
- distortion2 * scale < qstep * qstep) {
- early_term = 1;
- }
- }
- }
- }
-
- /* 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) {
- if (single_rd < best_pred_rd[SINGLE_REFERENCE]) {
- best_pred_rd[SINGLE_REFERENCE] = single_rd;
- }
- } else {
- if (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;
-
- /* keep record of best filter type */
- if (!mode_excluded && cm->interp_filter != BILINEAR) {
- int64_t ref = cpi->rd_filter_cache[cm->interp_filter == SWITCHABLE ?
- SWITCHABLE_FILTERS : cm->interp_filter];
-
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) {
- int64_t adj_rd;
- if (ref == INT64_MAX)
- adj_rd = 0;
- else if (cpi->rd_filter_cache[i] == INT64_MAX)
- // when early termination is triggered, the encoder does not have
- // access to the rate-distortion cost. it only knows that the cost
- // should be above the maximum valid value. hence it takes the known
- // maximum plus an arbitrary constant as the rate-distortion cost.
- adj_rd = cpi->mask_filter_rd - ref + 10;
- else
- adj_rd = cpi->rd_filter_cache[i] - ref;
-
- adj_rd += this_rd;
- best_filter_rd[i] = MIN(best_filter_rd[i], adj_rd);
- }
- }
- }
-
- /* keep record of best txfm size */
- if (bsize < BLOCK_32X32) {
- if (bsize < BLOCK_16X16)
- tx_cache[ALLOW_16X16] = tx_cache[ALLOW_8X8];
-
- tx_cache[ALLOW_32X32] = tx_cache[ALLOW_16X16];
- }
- if (!mode_excluded && this_rd != INT64_MAX) {
- for (i = 0; i < TX_MODES && tx_cache[i] < INT64_MAX; i++) {
- int64_t adj_rd = INT64_MAX;
- adj_rd = this_rd + tx_cache[i] - tx_cache[cm->tx_mode];
-
- if (adj_rd < best_tx_rd[i])
- best_tx_rd[i] = adj_rd;
- }
- }
-
- if (early_term)
- break;
-
- if (x->skip && !comp_pred)
- break;
- }
-
- if (best_rd >= best_rd_so_far)
- return INT64_MAX;
-
- // If we used an estimate for the uv intra rd in the loop above...
- if (cpi->sf.use_uv_intra_rd_estimate) {
- // Do Intra UV best rd mode selection if best mode choice above was intra.
- if (vp9_mode_order[best_mode_index].ref_frame[0] == INTRA_FRAME) {
- TX_SIZE uv_tx_size;
- *mbmi = best_mbmode;
- uv_tx_size = get_uv_tx_size(mbmi);
- rd_pick_intra_sbuv_mode(cpi, x, ctx, &rate_uv_intra[uv_tx_size],
- &rate_uv_tokenonly[uv_tx_size],
- &dist_uv[uv_tx_size],
- &skip_uv[uv_tx_size],
- bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize,
- uv_tx_size);
- }
- }
-
- assert((cm->interp_filter == SWITCHABLE) ||
- (cm->interp_filter == best_mbmode.interp_filter) ||
- !is_inter_block(&best_mbmode));
-
- // Updating rd_thresh_freq_fact[] here means that the different
- // partition/block sizes are handled independently based on the best
- // choice for the current partition. It may well be better to keep a scaled
- // best rd so far value and update rd_thresh_freq_fact based on the mode/size
- // combination that wins out.
- if (cpi->sf.adaptive_rd_thresh) {
- for (mode_index = 0; mode_index < MAX_MODES; ++mode_index) {
- int *const fact = &cpi->rd_thresh_freq_fact[bsize][mode_index];
-
- if (mode_index == best_mode_index) {
- *fact -= (*fact >> 3);
- } else {
- *fact = MIN(*fact + RD_THRESH_INC,
- cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
- }
- }
- }
-
- // macroblock modes
- *mbmi = best_mbmode;
- x->skip |= best_skip2;
-
- 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];
- }
-
- if (!x->skip) {
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) {
- if (best_filter_rd[i] == INT64_MAX)
- best_filter_diff[i] = 0;
- else
- best_filter_diff[i] = best_rd - best_filter_rd[i];
- }
- if (cm->interp_filter == SWITCHABLE)
- assert(best_filter_diff[SWITCHABLE_FILTERS] == 0);
- for (i = 0; i < TX_MODES; i++) {
- if (best_tx_rd[i] == INT64_MAX)
- best_tx_diff[i] = 0;
- else
- best_tx_diff[i] = best_rd - best_tx_rd[i];
- }
- } else {
- vp9_zero(best_filter_diff);
- vp9_zero(best_tx_diff);
- }
-
- if (!x->in_active_map) {
- assert(mbmi->ref_frame[0] == LAST_FRAME);
- assert(mbmi->ref_frame[1] == NONE);
- assert(mbmi->mode == NEARESTMV ||
- mbmi->mode == NEARMV ||
- mbmi->mode == ZEROMV);
- assert(frame_mv[mbmi->mode][LAST_FRAME].as_int == 0);
- assert(mbmi->mode == mbmi->uv_mode);
- }
-
- set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
- store_coding_context(x, ctx, best_mode_index,
- &mbmi->ref_mvs[mbmi->ref_frame[0]][0],
- &mbmi->ref_mvs[mbmi->ref_frame[1] < 0 ? 0 :
- mbmi->ref_frame[1]][0],
- best_pred_diff, best_tx_diff, best_filter_diff);
-
- return best_rd;
-}
-
-
-int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- int mi_row, int mi_col,
- int *returnrate,
- int64_t *returndistortion,
- BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx,
- int64_t best_rd_so_far) {
- VP9_COMMON *cm = &cpi->common;
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- const struct segmentation *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][MAX_REF_FRAMES];
- struct buf_2d yv12_mb[4][MAX_MB_PLANE];
- static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
- VP9_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_tx_rd[TX_MODES];
- int64_t best_tx_diff[TX_MODES];
- int64_t best_pred_diff[REFERENCE_MODES];
- int64_t best_pred_rd[REFERENCE_MODES];
- int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS];
- int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
- MB_MODE_INFO best_mbmode = { 0 };
- int mode_index, best_mode_index = 0;
- unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES];
- vp9_prob comp_mode_p;
- int64_t best_inter_rd = INT64_MAX;
- MV_REFERENCE_FRAME best_inter_ref_frame = LAST_FRAME;
- INTERP_FILTER tmp_best_filter = SWITCHABLE;
- int rate_uv_intra[TX_SIZES], rate_uv_tokenonly[TX_SIZES];
- int64_t dist_uv[TX_SIZES];
- int skip_uv[TX_SIZES];
- MB_PREDICTION_MODE mode_uv[TX_SIZES] = { 0 };
- int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q);
- int_mv seg_mvs[4][MAX_REF_FRAMES];
- b_mode_info best_bmodes[4];
- int best_skip2 = 0;
- int ref_frame_mask = 0;
- int mode_skip_mask = 0;
-
- x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH;
- vpx_memset(x->zcoeff_blk[TX_4X4], 0, 4);
-
- for (i = 0; i < 4; i++) {
- int j;
- for (j = 0; j < MAX_REF_FRAMES; j++)
- seg_mvs[i][j].as_int = INVALID_MV;
- }
-
- estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
- &comp_mode_p);
-
- for (i = 0; i < REFERENCE_MODES; ++i)
- best_pred_rd[i] = INT64_MAX;
- for (i = 0; i < TX_MODES; i++)
- best_tx_rd[i] = INT64_MAX;
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
- best_filter_rd[i] = INT64_MAX;
- for (i = 0; i < TX_SIZES; i++)
- rate_uv_intra[i] = INT_MAX;
-
- *returnrate = INT_MAX;
-
- for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
- if (cpi->ref_frame_flags & flag_list[ref_frame]) {
- vp9_setup_buffer_inter(cpi, x, tile,
- ref_frame, bsize, mi_row, mi_col,
- frame_mv[NEARESTMV], frame_mv[NEARMV],
- yv12_mb);
- }
- frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
- frame_mv[ZEROMV][ref_frame].as_int = 0;
- }
-
- for (ref_frame = LAST_FRAME;
- ref_frame <= ALTREF_FRAME && cpi->sf.reference_masking; ++ref_frame) {
- int i;
- for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
- if ((x->pred_mv_sad[ref_frame] >> 1) > x->pred_mv_sad[i]) {
- ref_frame_mask |= (1 << ref_frame);
- break;
- }
- }
- }
-
- for (mode_index = 0; mode_index < MAX_REFS; ++mode_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;
- int64_t tx_cache[TX_MODES];
- int i;
- int this_skip2 = 0;
- int64_t total_sse = INT_MAX;
- int early_term = 0;
-
- for (i = 0; i < TX_MODES; ++i)
- tx_cache[i] = INT64_MAX;
-
- x->skip = 0;
- ref_frame = vp9_ref_order[mode_index].ref_frame[0];
- second_ref_frame = vp9_ref_order[mode_index].ref_frame[1];
-
- // 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 (mode_index > 2 && cpi->sf.mode_skip_start < MAX_MODES) {
- if (mode_index == 3) {
- switch (vp9_ref_order[best_mode_index].ref_frame[0]) {
- case INTRA_FRAME:
- mode_skip_mask = 0;
- break;
- case LAST_FRAME:
- mode_skip_mask = 0x0010;
- break;
- case GOLDEN_FRAME:
- mode_skip_mask = 0x0008;
- break;
- case ALTREF_FRAME:
- mode_skip_mask = 0x0000;
- break;
- case NONE:
- case MAX_REF_FRAMES:
- assert(0 && "Invalid Reference frame");
- }
- }
- if (mode_skip_mask & (1 << mode_index))
- continue;
- }
-
- // Test best rd so far against threshold for trying this mode.
- if ((best_rd <
- ((int64_t)cpi->rd_thresh_sub8x8[segment_id][bsize][mode_index] *
- cpi->rd_thresh_freq_sub8x8[bsize][mode_index] >> 5)) ||
- cpi->rd_thresh_sub8x8[segment_id][bsize][mode_index] == INT_MAX)
- 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 ((second_ref_frame > INTRA_FRAME) &&
- vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
- continue;
-
- mbmi->ref_frame[0] = ref_frame;
- mbmi->ref_frame[1] = second_ref_frame;
-
- if (!(ref_frame == INTRA_FRAME
- || (cpi->ref_frame_flags & flag_list[ref_frame]))) {
- continue;
- }
- if (!(second_ref_frame == NONE
- || (cpi->ref_frame_flags & flag_list[second_ref_frame]))) {
- continue;
- }
-
- comp_pred = second_ref_frame > INTRA_FRAME;
- if (comp_pred) {
- if (cpi->sf.mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA)
- if (vp9_ref_order[best_mode_index].ref_frame[0] == INTRA_FRAME)
- continue;
- if (cpi->sf.mode_search_skip_flags & FLAG_SKIP_COMP_REFMISMATCH)
- if (ref_frame != best_inter_ref_frame &&
- second_ref_frame != best_inter_ref_frame)
- continue;
- }
-
- // TODO(jingning, jkoleszar): scaling reference frame not supported for
- // sub8x8 blocks.
- if (ref_frame > 0 && vp9_is_scaled(&cm->frame_refs[ref_frame - 1].sf))
- continue;
-
- if (second_ref_frame > 0 &&
- vp9_is_scaled(&cm->frame_refs[second_ref_frame - 1].sf))
- continue;
-
- set_ref_ptrs(cm, xd, ref_frame, second_ref_frame);
- mbmi->uv_mode = DC_PRED;
-
- // Evaluate all sub-pel filters irrespective of whether we can use
- // them for this frame.
- mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP
- : cm->interp_filter;
-
- if (comp_pred) {
- if (!(cpi->ref_frame_flags & flag_list[second_ref_frame]))
- continue;
-
- mode_excluded = mode_excluded ? mode_excluded
- : cm->reference_mode == SINGLE_REFERENCE;
- } else {
- if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) {
- mode_excluded = mode_excluded ?
- mode_excluded : cm->reference_mode == COMPOUND_REFERENCE;
- }
- }
-
- // 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 the segment reference frame feature is enabled....
- // then do nothing if the current ref frame is not allowed..
- if (vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME) &&
- vp9_get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) !=
- (int)ref_frame) {
- continue;
- // If the segment skip feature is enabled....
- // then do nothing if the current mode is not allowed..
- } else if (vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) &&
- ref_frame != INTRA_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 (!vp9_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;
- }
-
-#ifdef MODE_TEST_HIT_STATS
- // TEST/DEBUG CODE
- // Keep a rcord of the number of test hits at each size
- cpi->mode_test_hits[bsize]++;
-#endif
-
- if (ref_frame == INTRA_FRAME) {
- int rate;
- mbmi->tx_size = TX_4X4;
- if (rd_pick_intra_sub_8x8_y_mode(cpi, x, &rate, &rate_y,
- &distortion_y, best_rd) >= best_rd)
- continue;
- rate2 += rate;
- rate2 += intra_cost_penalty;
- distortion2 += distortion_y;
-
- if (rate_uv_intra[TX_4X4] == INT_MAX) {
- choose_intra_uv_mode(cpi, ctx, bsize, TX_4X4,
- &rate_uv_intra[TX_4X4],
- &rate_uv_tokenonly[TX_4X4],
- &dist_uv[TX_4X4], &skip_uv[TX_4X4],
- &mode_uv[TX_4X4]);
- }
- rate2 += rate_uv_intra[TX_4X4];
- rate_uv = rate_uv_tokenonly[TX_4X4];
- distortion2 += dist_uv[TX_4X4];
- distortion_uv = dist_uv[TX_4X4];
- mbmi->uv_mode = mode_uv[TX_4X4];
- tx_cache[ONLY_4X4] = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- for (i = 0; i < TX_MODES; ++i)
- tx_cache[i] = tx_cache[ONLY_4X4];
- } 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 ?
- &mbmi->ref_mvs[second_ref_frame][0] : NULL;
- b_mode_info tmp_best_bmodes[16];
- MB_MODE_INFO tmp_best_mbmode;
- BEST_SEG_INFO bsi[SWITCHABLE_FILTERS];
- int pred_exists = 0;
- int uv_skippable;
-
- this_rd_thresh = (ref_frame == LAST_FRAME) ?
- cpi->rd_thresh_sub8x8[segment_id][bsize][THR_LAST] :
- cpi->rd_thresh_sub8x8[segment_id][bsize][THR_ALTR];
- this_rd_thresh = (ref_frame == GOLDEN_FRAME) ?
- cpi->rd_thresh_sub8x8[segment_id][bsize][THR_GOLD] : this_rd_thresh;
- xd->mi[0]->mbmi.tx_size = TX_4X4;
-
- cpi->mask_filter_rd = 0;
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
- cpi->rd_filter_cache[i] = INT64_MAX;
-
- if (cm->interp_filter != BILINEAR) {
- tmp_best_filter = EIGHTTAP;
- if (x->source_variance <
- cpi->sf.disable_filter_search_var_thresh) {
- tmp_best_filter = EIGHTTAP;
- } else if (cpi->sf.adaptive_pred_interp_filter == 1 &&
- ctx->pred_interp_filter < SWITCHABLE) {
- tmp_best_filter = ctx->pred_interp_filter;
- } else if (cpi->sf.adaptive_pred_interp_filter == 2) {
- tmp_best_filter = ctx->pred_interp_filter < SWITCHABLE ?
- ctx->pred_interp_filter : 0;
- } else {
- for (switchable_filter_index = 0;
- switchable_filter_index < SWITCHABLE_FILTERS;
- ++switchable_filter_index) {
- int newbest, rs;
- int64_t rs_rd;
- mbmi->interp_filter = switchable_filter_index;
- tmp_rd = rd_pick_best_mbsegmentation(cpi, x, tile,
- &mbmi->ref_mvs[ref_frame][0],
- second_ref,
- best_yrd,
- &rate, &rate_y, &distortion,
- &skippable, &total_sse,
- (int)this_rd_thresh, seg_mvs,
- bsi, switchable_filter_index,
- mi_row, mi_col);
-
- if (tmp_rd == INT64_MAX)
- continue;
- rs = get_switchable_rate(x);
- rs_rd = RDCOST(x->rdmult, x->rddiv, rs, 0);
- cpi->rd_filter_cache[switchable_filter_index] = tmp_rd;
- cpi->rd_filter_cache[SWITCHABLE_FILTERS] =
- MIN(cpi->rd_filter_cache[SWITCHABLE_FILTERS],
- tmp_rd + rs_rd);
- if (cm->interp_filter == SWITCHABLE)
- tmp_rd += rs_rd;
-
- cpi->mask_filter_rd = MAX(cpi->mask_filter_rd, tmp_rd);
-
- newbest = (tmp_rd < tmp_best_rd);
- if (newbest) {
- tmp_best_filter = mbmi->interp_filter;
- tmp_best_rd = tmp_rd;
- }
- if ((newbest && cm->interp_filter == SWITCHABLE) ||
- (mbmi->interp_filter == cm->interp_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];
- x->zcoeff_blk[TX_4X4][i] = !x->plane[0].eobs[i];
- }
- pred_exists = 1;
- if (switchable_filter_index == 0 &&
- cpi->sf.use_rd_breakout &&
- best_rd < INT64_MAX) {
- if (tmp_best_rdu / 2 > best_rd) {
- // skip searching the other filters if the first is
- // already substantially larger than the best so far
- tmp_best_filter = mbmi->interp_filter;
- tmp_best_rdu = INT64_MAX;
- break;
- }
- }
- }
- } // switchable_filter_index loop
- }
- }
-
- if (tmp_best_rdu == INT64_MAX && pred_exists)
- continue;
-
- mbmi->interp_filter = (cm->interp_filter == SWITCHABLE ?
- tmp_best_filter : cm->interp_filter);
- if (!pred_exists) {
- // Handles the special case when a filter that is not in the
- // switchable list (bilinear, 6-tap) is indicated at the frame level
- tmp_rd = rd_pick_best_mbsegmentation(cpi, x, tile,
- &mbmi->ref_mvs[ref_frame][0],
- second_ref,
- best_yrd,
- &rate, &rate_y, &distortion,
- &skippable, &total_sse,
- (int)this_rd_thresh, seg_mvs,
- 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];
- }
-
- rate2 += rate;
- distortion2 += distortion;
-
- if (cm->interp_filter == SWITCHABLE)
- rate2 += get_switchable_rate(x);
-
- if (!mode_excluded)
- mode_excluded = comp_pred ? cm->reference_mode == SINGLE_REFERENCE
- : cm->reference_mode == COMPOUND_REFERENCE;
-
- compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred);
-
- tmp_best_rdu = best_rd -
- MIN(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
- vp9_build_inter_predictors_sbuv(&x->e_mbd, mi_row, mi_col,
- BLOCK_8X8);
- super_block_uvrd(cpi, x, &rate_uv, &distortion_uv, &uv_skippable,
- &uv_sse, BLOCK_8X8, tmp_best_rdu);
- if (rate_uv == INT_MAX)
- continue;
- rate2 += rate_uv;
- distortion2 += distortion_uv;
- skippable = skippable && uv_skippable;
- total_sse += uv_sse;
-
- tx_cache[ONLY_4X4] = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- for (i = 0; i < TX_MODES; ++i)
- tx_cache[i] = tx_cache[ONLY_4X4];
- }
- }
-
- 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];
- } else {
- rate2 += ref_costs_single[ref_frame];
- }
-
- if (!disable_skip) {
- // Test for the condition where skip block will be activated
- // because there are no non zero coefficients and make any
- // necessary adjustment for rate. Ignore if skip is coded at
- // segment level as the cost wont have been added in.
- // Is Mb level skip allowed (i.e. not coded at segment level).
- const int mb_skip_allowed = !vp9_segfeature_active(seg, segment_id,
- SEG_LVL_SKIP);
-
- if (mb_skip_allowed && ref_frame != INTRA_FRAME && !xd->lossless) {
- 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 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
- } else {
- // FIXME(rbultje) make this work for splitmv also
- rate2 += vp9_cost_bit(vp9_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 if (mb_skip_allowed) {
- // Add in the cost of the no skip flag.
- rate2 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
- }
-
- // Calculate the final RD estimate for this mode.
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
- }
-
- // Keep record of best inter rd with single reference
- if (is_inter_block(&xd->mi[0]->mbmi) &&
- !has_second_ref(&xd->mi[0]->mbmi) &&
- !mode_excluded &&
- this_rd < best_inter_rd) {
- best_inter_rd = this_rd;
- best_inter_ref_frame = ref_frame;
- }
-
- if (!disable_skip && ref_frame == INTRA_FRAME) {
- for (i = 0; i < REFERENCE_MODES; ++i)
- best_pred_rd[i] = MIN(best_pred_rd[i], this_rd);
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
- best_filter_rd[i] = MIN(best_filter_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) {
- int max_plane = MAX_MB_PLANE;
- // Note index of best mode so far
- best_mode_index = mode_index;
-
- if (ref_frame == INTRA_FRAME) {
- /* required for left and above block mv */
- mbmi->mv[0].as_int = 0;
- max_plane = 1;
- }
-
- *returnrate = rate2;
- *returndistortion = distortion2;
- 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 (!x->select_txfm_size)
- swap_block_ptr(x, ctx, max_plane);
- vpx_memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
- sizeof(uint8_t) * ctx->num_4x4_blk);
-
- for (i = 0; i < 4; i++)
- best_bmodes[i] = xd->mi[0]->bmi[i];
-
- // TODO(debargha): enhance this test with a better distortion prediction
- // based on qp, activity mask and history
- if ((cpi->sf.mode_search_skip_flags & FLAG_EARLY_TERMINATE) &&
- (mode_index > MIN_EARLY_TERM_INDEX)) {
- const int qstep = xd->plane[0].dequant[1];
- // TODO(debargha): Enhance this by specializing for each mode_index
- int scale = 4;
- if (x->source_variance < UINT_MAX) {
- const int var_adjust = (x->source_variance < 16);
- scale -= var_adjust;
- }
- if (ref_frame > INTRA_FRAME &&
- distortion2 * scale < qstep * qstep) {
- early_term = 1;
- }
- }
- }
- }
-
- /* 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 (second_ref_frame <= INTRA_FRAME &&
- single_rd < best_pred_rd[SINGLE_REFERENCE]) {
- best_pred_rd[SINGLE_REFERENCE] = single_rd;
- } else if (second_ref_frame > INTRA_FRAME &&
- 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;
- }
-
- /* keep record of best filter type */
- if (!mode_excluded && !disable_skip && ref_frame != INTRA_FRAME &&
- cm->interp_filter != BILINEAR) {
- int64_t ref = cpi->rd_filter_cache[cm->interp_filter == SWITCHABLE ?
- SWITCHABLE_FILTERS : cm->interp_filter];
- int64_t adj_rd;
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) {
- if (ref == INT64_MAX)
- adj_rd = 0;
- else if (cpi->rd_filter_cache[i] == INT64_MAX)
- // when early termination is triggered, the encoder does not have
- // access to the rate-distortion cost. it only knows that the cost
- // should be above the maximum valid value. hence it takes the known
- // maximum plus an arbitrary constant as the rate-distortion cost.
- adj_rd = cpi->mask_filter_rd - ref + 10;
- else
- adj_rd = cpi->rd_filter_cache[i] - ref;
-
- adj_rd += this_rd;
- best_filter_rd[i] = MIN(best_filter_rd[i], adj_rd);
- }
- }
-
- /* keep record of best txfm size */
- if (bsize < BLOCK_32X32) {
- if (bsize < BLOCK_16X16) {
- tx_cache[ALLOW_8X8] = tx_cache[ONLY_4X4];
- tx_cache[ALLOW_16X16] = tx_cache[ALLOW_8X8];
- }
- tx_cache[ALLOW_32X32] = tx_cache[ALLOW_16X16];
- }
- if (!mode_excluded && this_rd != INT64_MAX) {
- for (i = 0; i < TX_MODES && tx_cache[i] < INT64_MAX; i++) {
- int64_t adj_rd = INT64_MAX;
- if (ref_frame > INTRA_FRAME)
- adj_rd = this_rd + tx_cache[i] - tx_cache[cm->tx_mode];
- else
- adj_rd = this_rd;
-
- if (adj_rd < best_tx_rd[i])
- best_tx_rd[i] = adj_rd;
- }
- }
-
- if (early_term)
- break;
-
- if (x->skip && !comp_pred)
- break;
- }
-
- if (best_rd >= best_rd_so_far)
- return INT64_MAX;
-
- // If we used an estimate for the uv intra rd in the loop above...
- if (cpi->sf.use_uv_intra_rd_estimate) {
- // Do Intra UV best rd mode selection if best mode choice above was intra.
- if (vp9_ref_order[best_mode_index].ref_frame[0] == INTRA_FRAME) {
- TX_SIZE uv_tx_size;
- *mbmi = best_mbmode;
- uv_tx_size = get_uv_tx_size(mbmi);
- rd_pick_intra_sbuv_mode(cpi, x, ctx, &rate_uv_intra[uv_tx_size],
- &rate_uv_tokenonly[uv_tx_size],
- &dist_uv[uv_tx_size],
- &skip_uv[uv_tx_size],
- BLOCK_8X8, uv_tx_size);
- }
- }
-
- if (best_rd == INT64_MAX && bsize < BLOCK_8X8) {
- *returnrate = INT_MAX;
- *returndistortion = INT64_MAX;
- return best_rd;
- }
-
- assert((cm->interp_filter == SWITCHABLE) ||
- (cm->interp_filter == best_mbmode.interp_filter) ||
- !is_inter_block(&best_mbmode));
-
- // Updating rd_thresh_freq_fact[] here means that the different
- // partition/block sizes are handled independently based on the best
- // choice for the current partition. It may well be better to keep a scaled
- // best rd so far value and update rd_thresh_freq_fact based on the mode/size
- // combination that wins out.
- if (cpi->sf.adaptive_rd_thresh) {
- for (mode_index = 0; mode_index < MAX_REFS; ++mode_index) {
- int *const fact = &cpi->rd_thresh_freq_sub8x8[bsize][mode_index];
-
- if (mode_index == best_mode_index) {
- *fact -= (*fact >> 3);
- } else {
- *fact = MIN(*fact + RD_THRESH_INC,
- cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
- }
- }
- }
-
- // macroblock modes
- *mbmi = best_mbmode;
- 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)
- vpx_memcpy(&xd->mi[0]->bmi[i], &best_bmodes[i], sizeof(b_mode_info));
-
- 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;
- }
-
- 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];
- }
-
- if (!x->skip) {
- for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) {
- if (best_filter_rd[i] == INT64_MAX)
- best_filter_diff[i] = 0;
- else
- best_filter_diff[i] = best_rd - best_filter_rd[i];
- }
- if (cm->interp_filter == SWITCHABLE)
- assert(best_filter_diff[SWITCHABLE_FILTERS] == 0);
- } else {
- vp9_zero(best_filter_diff);
- }
-
- if (!x->skip) {
- for (i = 0; i < TX_MODES; i++) {
- if (best_tx_rd[i] == INT64_MAX)
- best_tx_diff[i] = 0;
- else
- best_tx_diff[i] = best_rd - best_tx_rd[i];
- }
- } else {
- vp9_zero(best_tx_diff);
- }
-
- set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
- store_coding_context(x, ctx, best_mode_index,
- &mbmi->ref_mvs[mbmi->ref_frame[0]][0],
- &mbmi->ref_mvs[mbmi->ref_frame[1] < 0 ? 0 :
- mbmi->ref_frame[1]][0],
- best_pred_diff, best_tx_diff, best_filter_diff);
-
- return best_rd;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.h
deleted file mode 100644
index 6968fa6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_rdopt.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_RDOPT_H_
-#define VP9_ENCODER_VP9_RDOPT_H_
-
-#include "vp9/encoder/vp9_onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RDDIV_BITS 7
-
-#define RDCOST(RM, DM, R, D) \
- (((128 + ((int64_t)R) * (RM)) >> 8) + (D << DM))
-#define QIDX_SKIP_THRESH 115
-
-#define MV_COST_WEIGHT 108
-#define MV_COST_WEIGHT_SUB 120
-
-#define INVALID_MV 0x80008000
-
-struct TileInfo;
-
-int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex);
-
-void vp9_initialize_rd_consts(VP9_COMP *cpi);
-
-void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex);
-
-void vp9_model_rd_from_var_lapndz(unsigned int var, unsigned int n,
- unsigned int qstep, int *rate,
- int64_t *dist);
-
-void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
- const TileInfo *const tile,
- MV_REFERENCE_FRAME ref_frame,
- BLOCK_SIZE block_size,
- int mi_row, int mi_col,
- int_mv frame_nearest_mv[MAX_REF_FRAMES],
- int_mv frame_near_mv[MAX_REF_FRAMES],
- struct buf_2d yv12_mb[4][MAX_MB_PLANE]);
-
-const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
- int ref_frame);
-
-void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
- int *r, int64_t *d, BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx, int64_t best_rd);
-
-int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
- const struct TileInfo *const tile,
- int mi_row, int mi_col,
- int *returnrate,
- int64_t *returndistortion,
- BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx,
- int64_t best_rd_so_far);
-
-int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
- const struct TileInfo *const tile,
- int mi_row, int mi_col,
- int *returnrate,
- int64_t *returndistortion,
- BLOCK_SIZE bsize,
- PICK_MODE_CONTEXT *ctx,
- int64_t best_rd_so_far);
-
-void vp9_init_me_luts();
-
-void vp9_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
- const struct macroblockd_plane *pd,
- ENTROPY_CONTEXT t_above[16],
- ENTROPY_CONTEXT t_left[16]);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_RDOPT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.c
deleted file mode 100644
index 4e6efae..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/encoder/vp9_resize.h"
-
-#define FILTER_BITS 7
-
-#define INTERP_TAPS 8
-#define SUBPEL_BITS 5
-#define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1)
-#define INTERP_PRECISION_BITS 32
-
-typedef int16_t interp_kernel[INTERP_TAPS];
-
-// Filters for interpolation (0.5-band) - note this also filters integer pels.
-const interp_kernel vp9_filteredinterp_filters500[(1 << SUBPEL_BITS)] = {
- {-3, 0, 35, 64, 35, 0, -3, 0},
- {-3, -1, 34, 64, 36, 1, -3, 0},
- {-3, -1, 32, 64, 38, 1, -3, 0},
- {-2, -2, 31, 63, 39, 2, -3, 0},
- {-2, -2, 29, 63, 41, 2, -3, 0},
- {-2, -2, 28, 63, 42, 3, -4, 0},
- {-2, -3, 27, 63, 43, 4, -4, 0},
- {-2, -3, 25, 62, 45, 5, -4, 0},
- {-2, -3, 24, 62, 46, 5, -4, 0},
- {-2, -3, 23, 61, 47, 6, -4, 0},
- {-2, -3, 21, 60, 49, 7, -4, 0},
- {-1, -4, 20, 60, 50, 8, -4, -1},
- {-1, -4, 19, 59, 51, 9, -4, -1},
- {-1, -4, 17, 58, 52, 10, -4, 0},
- {-1, -4, 16, 57, 53, 12, -4, -1},
- {-1, -4, 15, 56, 54, 13, -4, -1},
- {-1, -4, 14, 55, 55, 14, -4, -1},
- {-1, -4, 13, 54, 56, 15, -4, -1},
- {-1, -4, 12, 53, 57, 16, -4, -1},
- {0, -4, 10, 52, 58, 17, -4, -1},
- {-1, -4, 9, 51, 59, 19, -4, -1},
- {-1, -4, 8, 50, 60, 20, -4, -1},
- {0, -4, 7, 49, 60, 21, -3, -2},
- {0, -4, 6, 47, 61, 23, -3, -2},
- {0, -4, 5, 46, 62, 24, -3, -2},
- {0, -4, 5, 45, 62, 25, -3, -2},
- {0, -4, 4, 43, 63, 27, -3, -2},
- {0, -4, 3, 42, 63, 28, -2, -2},
- {0, -3, 2, 41, 63, 29, -2, -2},
- {0, -3, 2, 39, 63, 31, -2, -2},
- {0, -3, 1, 38, 64, 32, -1, -3},
- {0, -3, 1, 36, 64, 34, -1, -3}
-};
-
-// Filters for interpolation (0.625-band) - note this also filters integer pels.
-const interp_kernel vp9_filteredinterp_filters625[(1 << SUBPEL_BITS)] = {
- {-1, -8, 33, 80, 33, -8, -1, 0},
- {-1, -8, 30, 80, 35, -8, -1, 1},
- {-1, -8, 28, 80, 37, -7, -2, 1},
- {0, -8, 26, 79, 39, -7, -2, 1},
- {0, -8, 24, 79, 41, -7, -2, 1},
- {0, -8, 22, 78, 43, -6, -2, 1},
- {0, -8, 20, 78, 45, -5, -3, 1},
- {0, -8, 18, 77, 48, -5, -3, 1},
- {0, -8, 16, 76, 50, -4, -3, 1},
- {0, -8, 15, 75, 52, -3, -4, 1},
- {0, -7, 13, 74, 54, -3, -4, 1},
- {0, -7, 11, 73, 56, -2, -4, 1},
- {0, -7, 10, 71, 58, -1, -4, 1},
- {1, -7, 8, 70, 60, 0, -5, 1},
- {1, -6, 6, 68, 62, 1, -5, 1},
- {1, -6, 5, 67, 63, 2, -5, 1},
- {1, -6, 4, 65, 65, 4, -6, 1},
- {1, -5, 2, 63, 67, 5, -6, 1},
- {1, -5, 1, 62, 68, 6, -6, 1},
- {1, -5, 0, 60, 70, 8, -7, 1},
- {1, -4, -1, 58, 71, 10, -7, 0},
- {1, -4, -2, 56, 73, 11, -7, 0},
- {1, -4, -3, 54, 74, 13, -7, 0},
- {1, -4, -3, 52, 75, 15, -8, 0},
- {1, -3, -4, 50, 76, 16, -8, 0},
- {1, -3, -5, 48, 77, 18, -8, 0},
- {1, -3, -5, 45, 78, 20, -8, 0},
- {1, -2, -6, 43, 78, 22, -8, 0},
- {1, -2, -7, 41, 79, 24, -8, 0},
- {1, -2, -7, 39, 79, 26, -8, 0},
- {1, -2, -7, 37, 80, 28, -8, -1},
- {1, -1, -8, 35, 80, 30, -8, -1},
-};
-
-// Filters for interpolation (0.75-band) - note this also filters integer pels.
-const interp_kernel vp9_filteredinterp_filters750[(1 << SUBPEL_BITS)] = {
- {2, -11, 25, 96, 25, -11, 2, 0},
- {2, -11, 22, 96, 28, -11, 2, 0},
- {2, -10, 19, 95, 31, -11, 2, 0},
- {2, -10, 17, 95, 34, -12, 2, 0},
- {2, -9, 14, 94, 37, -12, 2, 0},
- {2, -8, 12, 93, 40, -12, 1, 0},
- {2, -8, 9, 92, 43, -12, 1, 1},
- {2, -7, 7, 91, 46, -12, 1, 0},
- {2, -7, 5, 90, 49, -12, 1, 0},
- {2, -6, 3, 88, 52, -12, 0, 1},
- {2, -5, 1, 86, 55, -12, 0, 1},
- {2, -5, -1, 84, 58, -11, 0, 1},
- {2, -4, -2, 82, 61, -11, -1, 1},
- {2, -4, -4, 80, 64, -10, -1, 1},
- {1, -3, -5, 77, 67, -9, -1, 1},
- {1, -3, -6, 75, 70, -8, -2, 1},
- {1, -2, -7, 72, 72, -7, -2, 1},
- {1, -2, -8, 70, 75, -6, -3, 1},
- {1, -1, -9, 67, 77, -5, -3, 1},
- {1, -1, -10, 64, 80, -4, -4, 2},
- {1, -1, -11, 61, 82, -2, -4, 2},
- {1, 0, -11, 58, 84, -1, -5, 2},
- {1, 0, -12, 55, 86, 1, -5, 2},
- {1, 0, -12, 52, 88, 3, -6, 2},
- {0, 1, -12, 49, 90, 5, -7, 2},
- {0, 1, -12, 46, 91, 7, -7, 2},
- {1, 1, -12, 43, 92, 9, -8, 2},
- {0, 1, -12, 40, 93, 12, -8, 2},
- {0, 2, -12, 37, 94, 14, -9, 2},
- {0, 2, -12, 34, 95, 17, -10, 2},
- {0, 2, -11, 31, 95, 19, -10, 2},
- {0, 2, -11, 28, 96, 22, -11, 2}
-};
-
-// Filters for interpolation (0.875-band) - note this also filters integer pels.
-const interp_kernel vp9_filteredinterp_filters875[(1 << SUBPEL_BITS)] = {
- {3, -8, 13, 112, 13, -8, 3, 0},
- {3, -7, 10, 112, 17, -9, 3, -1},
- {2, -6, 7, 111, 21, -9, 3, -1},
- {2, -5, 4, 111, 24, -10, 3, -1},
- {2, -4, 1, 110, 28, -11, 3, -1},
- {1, -3, -1, 108, 32, -12, 4, -1},
- {1, -2, -3, 106, 36, -13, 4, -1},
- {1, -1, -6, 105, 40, -14, 4, -1},
- {1, -1, -7, 102, 44, -14, 4, -1},
- {1, 0, -9, 100, 48, -15, 4, -1},
- {1, 1, -11, 97, 53, -16, 4, -1},
- {0, 1, -12, 95, 57, -16, 4, -1},
- {0, 2, -13, 91, 61, -16, 4, -1},
- {0, 2, -14, 88, 65, -16, 4, -1},
- {0, 3, -15, 84, 69, -17, 4, 0},
- {0, 3, -16, 81, 73, -16, 3, 0},
- {0, 3, -16, 77, 77, -16, 3, 0},
- {0, 3, -16, 73, 81, -16, 3, 0},
- {0, 4, -17, 69, 84, -15, 3, 0},
- {-1, 4, -16, 65, 88, -14, 2, 0},
- {-1, 4, -16, 61, 91, -13, 2, 0},
- {-1, 4, -16, 57, 95, -12, 1, 0},
- {-1, 4, -16, 53, 97, -11, 1, 1},
- {-1, 4, -15, 48, 100, -9, 0, 1},
- {-1, 4, -14, 44, 102, -7, -1, 1},
- {-1, 4, -14, 40, 105, -6, -1, 1},
- {-1, 4, -13, 36, 106, -3, -2, 1},
- {-1, 4, -12, 32, 108, -1, -3, 1},
- {-1, 3, -11, 28, 110, 1, -4, 2},
- {-1, 3, -10, 24, 111, 4, -5, 2},
- {-1, 3, -9, 21, 111, 7, -6, 2},
- {-1, 3, -9, 17, 112, 10, -7, 3}
-};
-
-// Filters for interpolation (full-band) - no filtering for integer pixels
-const interp_kernel vp9_filteredinterp_filters1000[(1 << SUBPEL_BITS)] = {
- {0, 0, 0, 128, 0, 0, 0, 0},
- {0, 1, -3, 128, 3, -1, 0, 0},
- {-1, 2, -6, 127, 7, -2, 1, 0},
- {-1, 3, -9, 126, 12, -4, 1, 0},
- {-1, 4, -12, 125, 16, -5, 1, 0},
- {-1, 4, -14, 123, 20, -6, 2, 0},
- {-1, 5, -15, 120, 25, -8, 2, 0},
- {-1, 5, -17, 118, 30, -9, 3, -1},
- {-1, 6, -18, 114, 35, -10, 3, -1},
- {-1, 6, -19, 111, 41, -12, 3, -1},
- {-1, 6, -20, 107, 46, -13, 4, -1},
- {-1, 6, -21, 103, 52, -14, 4, -1},
- {-1, 6, -21, 99, 57, -16, 5, -1},
- {-1, 6, -21, 94, 63, -17, 5, -1},
- {-1, 6, -20, 89, 68, -18, 5, -1},
- {-1, 6, -20, 84, 73, -19, 6, -1},
- {-1, 6, -20, 79, 79, -20, 6, -1},
- {-1, 6, -19, 73, 84, -20, 6, -1},
- {-1, 5, -18, 68, 89, -20, 6, -1},
- {-1, 5, -17, 63, 94, -21, 6, -1},
- {-1, 5, -16, 57, 99, -21, 6, -1},
- {-1, 4, -14, 52, 103, -21, 6, -1},
- {-1, 4, -13, 46, 107, -20, 6, -1},
- {-1, 3, -12, 41, 111, -19, 6, -1},
- {-1, 3, -10, 35, 114, -18, 6, -1},
- {-1, 3, -9, 30, 118, -17, 5, -1},
- {0, 2, -8, 25, 120, -15, 5, -1},
- {0, 2, -6, 20, 123, -14, 4, -1},
- {0, 1, -5, 16, 125, -12, 4, -1},
- {0, 1, -4, 12, 126, -9, 3, -1},
- {0, 1, -2, 7, 127, -6, 2, -1},
- {0, 0, -1, 3, 128, -3, 1, 0}
-};
-
-// Filters for factor of 2 downsampling.
-static const int16_t vp9_down2_symeven_half_filter[] = {56, 12, -3, -1};
-static const int16_t vp9_down2_symodd_half_filter[] = {64, 35, 0, -3};
-
-static const interp_kernel *choose_interp_filter(int inlength, int outlength) {
- int outlength16 = outlength * 16;
- if (outlength16 >= inlength * 16)
- return vp9_filteredinterp_filters1000;
- else if (outlength16 >= inlength * 13)
- return vp9_filteredinterp_filters875;
- else if (outlength16 >= inlength * 11)
- return vp9_filteredinterp_filters750;
- else if (outlength16 >= inlength * 9)
- return vp9_filteredinterp_filters625;
- else
- return vp9_filteredinterp_filters500;
-}
-
-static void interpolate(const uint8_t *const input, int inlength,
- uint8_t *output, int outlength) {
- const int64_t delta = (((uint64_t)inlength << 32) + outlength / 2) /
- outlength;
- const int64_t offset = inlength > outlength ?
- (((int64_t)(inlength - outlength) << 31) + outlength / 2) / outlength :
- -(((int64_t)(outlength - inlength) << 31) + outlength / 2) / outlength;
- uint8_t *optr = output;
- int x, x1, x2, sum, k, int_pel, sub_pel;
- int64_t y;
-
- const interp_kernel *interp_filters =
- choose_interp_filter(inlength, outlength);
-
- x = 0;
- y = offset;
- while ((y >> INTERP_PRECISION_BITS) < (INTERP_TAPS / 2 - 1)) {
- x++;
- y += delta;
- }
- x1 = x;
- x = outlength - 1;
- y = delta * x + offset;
- while ((y >> INTERP_PRECISION_BITS) +
- (int64_t)(INTERP_TAPS / 2) >= inlength) {
- x--;
- y -= delta;
- }
- x2 = x;
- if (x1 > x2) {
- for (x = 0, y = offset; x < outlength; ++x, y += delta) {
- const int16_t *filter;
- int_pel = y >> INTERP_PRECISION_BITS;
- sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
- filter = interp_filters[sub_pel];
- sum = 0;
- for (k = 0; k < INTERP_TAPS; ++k) {
- const int pk = int_pel - INTERP_TAPS / 2 + 1 + k;
- sum += filter[k] * input[(pk < 0 ? 0 :
- (pk >= inlength ? inlength - 1 : pk))];
- }
- *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
- }
- } else {
- // Initial part.
- for (x = 0, y = offset; x < x1; ++x, y += delta) {
- const int16_t *filter;
- int_pel = y >> INTERP_PRECISION_BITS;
- sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
- filter = interp_filters[sub_pel];
- sum = 0;
- for (k = 0; k < INTERP_TAPS; ++k)
- sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k < 0 ?
- 0 :
- int_pel - INTERP_TAPS / 2 + 1 + k)];
- *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
- }
- // Middle part.
- for (; x <= x2; ++x, y += delta) {
- const int16_t *filter;
- int_pel = y >> INTERP_PRECISION_BITS;
- sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
- filter = interp_filters[sub_pel];
- sum = 0;
- for (k = 0; k < INTERP_TAPS; ++k)
- sum += filter[k] * input[int_pel - INTERP_TAPS / 2 + 1 + k];
- *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
- }
- // End part.
- for (; x < outlength; ++x, y += delta) {
- const int16_t *filter;
- int_pel = y >> INTERP_PRECISION_BITS;
- sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
- filter = interp_filters[sub_pel];
- sum = 0;
- for (k = 0; k < INTERP_TAPS; ++k)
- sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k >=
- inlength ? inlength - 1 :
- int_pel - INTERP_TAPS / 2 + 1 + k)];
- *optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
- }
- }
-}
-
-static void down2_symeven(const uint8_t *const input, int length,
- uint8_t *output) {
- // Actual filter len = 2 * filter_len_half.
- static const int16_t *filter = vp9_down2_symeven_half_filter;
- const int filter_len_half = sizeof(vp9_down2_symeven_half_filter) / 2;
- int i, j;
- uint8_t *optr = output;
- int l1 = filter_len_half;
- int l2 = (length - filter_len_half);
- l1 += (l1 & 1);
- l2 += (l2 & 1);
- if (l1 > l2) {
- // Short input length.
- for (i = 0; i < length; i += 2) {
- int sum = (1 << (FILTER_BITS - 1));
- for (j = 0; j < filter_len_half; ++j) {
- sum += (input[(i - j < 0 ? 0 : i - j)] +
- input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
- filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- } else {
- // Initial part.
- for (i = 0; i < l1; i += 2) {
- int sum = (1 << (FILTER_BITS - 1));
- for (j = 0; j < filter_len_half; ++j) {
- sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + 1 + j]) * filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- // Middle part.
- for (; i < l2; i += 2) {
- int sum = (1 << (FILTER_BITS - 1));
- for (j = 0; j < filter_len_half; ++j) {
- sum += (input[i - j] + input[i + 1 + j]) * filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- // End part.
- for (; i < length; i += 2) {
- int sum = (1 << (FILTER_BITS - 1));
- for (j = 0; j < filter_len_half; ++j) {
- sum += (input[i - j] +
- input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
- filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- }
-}
-
-static void down2_symodd(const uint8_t *const input, int length,
- uint8_t *output) {
- // Actual filter len = 2 * filter_len_half - 1.
- static const int16_t *filter = vp9_down2_symodd_half_filter;
- const int filter_len_half = sizeof(vp9_down2_symodd_half_filter) / 2;
- int i, j;
- uint8_t *optr = output;
- int l1 = filter_len_half - 1;
- int l2 = (length - filter_len_half + 1);
- l1 += (l1 & 1);
- l2 += (l2 & 1);
- if (l1 > l2) {
- // Short input length.
- for (i = 0; i < length; i += 2) {
- int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
- for (j = 1; j < filter_len_half; ++j) {
- sum += (input[(i - j < 0 ? 0 : i - j)] +
- input[(i + j >= length ? length - 1 : i + j)]) *
- filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- } else {
- // Initial part.
- for (i = 0; i < l1; i += 2) {
- int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
- for (j = 1; j < filter_len_half; ++j) {
- sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + j]) * filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- // Middle part.
- for (; i < l2; i += 2) {
- int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
- for (j = 1; j < filter_len_half; ++j) {
- sum += (input[i - j] + input[i + j]) * filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- // End part.
- for (; i < length; i += 2) {
- int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
- for (j = 1; j < filter_len_half; ++j) {
- sum += (input[i - j] + input[(i + j >= length ? length - 1 : i + j)]) *
- filter[j];
- }
- sum >>= FILTER_BITS;
- *optr++ = clip_pixel(sum);
- }
- }
-}
-
-static int get_down2_length(int length, int steps) {
- int s;
- for (s = 0; s < steps; ++s)
- length = (length + 1) >> 1;
- return length;
-}
-
-int get_down2_steps(int in_length, int out_length) {
- int steps = 0;
- int proj_in_length;
- while ((proj_in_length = get_down2_length(in_length, 1)) >= out_length) {
- ++steps;
- in_length = proj_in_length;
- }
- return steps;
-}
-
-static void resize_multistep(const uint8_t *const input,
- int length,
- uint8_t *output,
- int olength,
- uint8_t *buf) {
- int steps;
- if (length == olength) {
- memcpy(output, input, sizeof(uint8_t) * length);
- return;
- }
- steps = get_down2_steps(length, olength);
-
- if (steps > 0) {
- int s;
- uint8_t *out = NULL;
- uint8_t *tmpbuf = NULL;
- uint8_t *otmp, *otmp2;
- int filteredlength = length;
- if (!tmpbuf) {
- tmpbuf = (uint8_t *)malloc(sizeof(uint8_t) * length);
- otmp = tmpbuf;
- } else {
- otmp = buf;
- }
- otmp2 = otmp + get_down2_length(length, 1);
- for (s = 0; s < steps; ++s) {
- const int proj_filteredlength = get_down2_length(filteredlength, 1);
- const uint8_t *const in = (s == 0 ? input : out);
- if (s == steps - 1 && proj_filteredlength == olength)
- out = output;
- else
- out = (s & 1 ? otmp2 : otmp);
- if (filteredlength & 1)
- down2_symodd(in, filteredlength, out);
- else
- down2_symeven(in, filteredlength, out);
- filteredlength = proj_filteredlength;
- }
- if (filteredlength != olength) {
- interpolate(out, filteredlength, output, olength);
- }
- if (tmpbuf)
- free(tmpbuf);
- } else {
- interpolate(input, length, output, olength);
- }
-}
-
-static void fill_col_to_arr(uint8_t *img, int stride, int len, uint8_t *arr) {
- int i;
- uint8_t *iptr = img;
- uint8_t *aptr = arr;
- for (i = 0; i < len; ++i, iptr += stride) {
- *aptr++ = *iptr;
- }
-}
-
-static void fill_arr_to_col(uint8_t *img, int stride, int len, uint8_t *arr) {
- int i;
- uint8_t *iptr = img;
- uint8_t *aptr = arr;
- for (i = 0; i < len; ++i, iptr += stride) {
- *iptr = *aptr++;
- }
-}
-
-void vp9_resize_plane(const uint8_t *const input,
- int height,
- int width,
- int in_stride,
- uint8_t *output,
- int height2,
- int width2,
- int out_stride) {
- int i;
- uint8_t *intbuf = (uint8_t *)malloc(sizeof(uint8_t) * width2 * height);
- uint8_t *tmpbuf = (uint8_t *)malloc(sizeof(uint8_t) *
- (width < height ? height : width));
- uint8_t *arrbuf = (uint8_t *)malloc(sizeof(uint8_t) * (height + height2));
- for (i = 0; i < height; ++i)
- resize_multistep(input + in_stride * i, width,
- intbuf + width2 * i, width2, tmpbuf);
- for (i = 0; i < width2; ++i) {
- fill_col_to_arr(intbuf + i, width2, height, arrbuf);
- resize_multistep(arrbuf, height, arrbuf + height, height2, tmpbuf);
- fill_arr_to_col(output + i, out_stride, height2, arrbuf + height);
- }
- free(intbuf);
- free(tmpbuf);
- free(arrbuf);
-}
-
-void vp9_resize_frame420(const uint8_t *const y,
- int y_stride,
- const uint8_t *const u, const uint8_t *const v,
- int uv_stride,
- int height, int width,
- uint8_t *oy, int oy_stride,
- uint8_t *ou, uint8_t *ov, int ouv_stride,
- int oheight, int owidth) {
- vp9_resize_plane(y, height, width, y_stride,
- oy, oheight, owidth, oy_stride);
- vp9_resize_plane(u, height / 2, width / 2, uv_stride,
- ou, oheight / 2, owidth / 2, ouv_stride);
- vp9_resize_plane(v, height / 2, width / 2, uv_stride,
- ov, oheight / 2, owidth / 2, ouv_stride);
-}
-
-void vp9_resize_frame422(const uint8_t *const y, int y_stride,
- const uint8_t *const u, const uint8_t *const v,
- int uv_stride,
- int height, int width,
- uint8_t *oy, int oy_stride,
- uint8_t *ou, uint8_t *ov, int ouv_stride,
- int oheight, int owidth) {
- vp9_resize_plane(y, height, width, y_stride,
- oy, oheight, owidth, oy_stride);
- vp9_resize_plane(u, height, width / 2, uv_stride,
- ou, oheight, owidth / 2, ouv_stride);
- vp9_resize_plane(v, height, width / 2, uv_stride,
- ov, oheight, owidth / 2, ouv_stride);
-}
-
-void vp9_resize_frame444(const uint8_t *const y, int y_stride,
- const uint8_t *const u, const uint8_t *const v,
- int uv_stride,
- int height, int width,
- uint8_t *oy, int oy_stride,
- uint8_t *ou, uint8_t *ov, int ouv_stride,
- int oheight, int owidth) {
- vp9_resize_plane(y, height, width, y_stride,
- oy, oheight, owidth, oy_stride);
- vp9_resize_plane(u, height, width, uv_stride,
- ou, oheight, owidth, ouv_stride);
- vp9_resize_plane(v, height, width, uv_stride,
- ov, oheight, owidth, ouv_stride);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.h
deleted file mode 100644
index 1818cd4..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_resize.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_RESIZE_H_
-#define VP9_ENCODER_VP9_RESIZE_H_
-
-#include <stdio.h>
-#include "vpx/vpx_integer.h"
-
-void vp9_resize_plane(const uint8_t *const input,
- int height,
- int width,
- int in_stride,
- uint8_t *output,
- int height2,
- int width2,
- int out_stride);
-void vp9_resize_frame420(const uint8_t *const y,
- int y_stride,
- const uint8_t *const u,
- const uint8_t *const v,
- int uv_stride,
- int height,
- int width,
- uint8_t *oy,
- int oy_stride,
- uint8_t *ou,
- uint8_t *ov,
- int ouv_stride,
- int oheight,
- int owidth);
-void vp9_resize_frame422(const uint8_t *const y,
- int y_stride,
- const uint8_t *const u,
- const uint8_t *const v,
- int uv_stride,
- int height,
- int width,
- uint8_t *oy,
- int oy_stride,
- uint8_t *ou,
- uint8_t *ov,
- int ouv_stride,
- int oheight,
- int owidth);
-void vp9_resize_frame444(const uint8_t *const y,
- int y_stride,
- const uint8_t *const u,
- const uint8_t *const v,
- int uv_stride,
- int height,
- int width,
- uint8_t *oy,
- int oy_stride,
- uint8_t *ou,
- uint8_t *ov,
- int ouv_stride,
- int oheight,
- int owidth);
-
-#endif // VP9_ENCODER_VP9_RESIZE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_sad.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_sad.c
deleted file mode 100644
index 9d8da0d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_sad.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "./vp9_rtcd.h"
-#include "./vpx_config.h"
-
-#include "vpx/vpx_integer.h"
-#include "vp9/encoder/vp9_variance.h"
-
-static INLINE unsigned int sad(const uint8_t *a, int a_stride,
- const uint8_t *b, int b_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 += abs(a[x] - b[x]);
-
- a += a_stride;
- b += b_stride;
- }
-
- return sad;
-}
-
-#define sad_mxn_func(m, n) \
-unsigned int vp9_sad##m##x##n##_c(const uint8_t *src_ptr, int src_stride, \
- const uint8_t *ref_ptr, int ref_stride, \
- unsigned int max_sad) { \
- return sad(src_ptr, src_stride, ref_ptr, ref_stride, m, n); \
-} \
-unsigned int vp9_sad##m##x##n##_avg_c(const uint8_t *src_ptr, int src_stride, \
- const uint8_t *ref_ptr, int ref_stride, \
- const uint8_t *second_pred, \
- unsigned int max_sad) { \
- uint8_t comp_pred[m * n]; \
- vp9_comp_avg_pred(comp_pred, second_pred, m, n, ref_ptr, ref_stride); \
- return sad(src_ptr, src_stride, comp_pred, m, m, n); \
-}
-
-sad_mxn_func(64, 64)
-sad_mxn_func(64, 32)
-sad_mxn_func(32, 64)
-sad_mxn_func(32, 32)
-sad_mxn_func(32, 16)
-sad_mxn_func(16, 32)
-sad_mxn_func(16, 16)
-sad_mxn_func(16, 8)
-sad_mxn_func(8, 16)
-sad_mxn_func(8, 8)
-sad_mxn_func(8, 4)
-sad_mxn_func(4, 8)
-sad_mxn_func(4, 4)
-
-void vp9_sad64x32x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad64x32(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad32x64x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad32x64(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad32x16x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad32x16(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad16x32x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad16x32(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad64x64x3_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 3; ++i)
- sad_array[i] = vp9_sad64x64(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad32x32x3_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 3; ++i)
- sad_array[i] = vp9_sad32x32(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad64x64x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad64x64(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad32x32x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad32x32(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad16x16x3_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 3; ++i)
- sad_array[i] = vp9_sad16x16(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad16x16x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- uint32_t *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad16x16(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad16x8x3_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 3; ++i)
- sad_array[i] = vp9_sad16x8(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad16x8x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- uint32_t *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad16x8(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x8x3_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 3; ++i)
- sad_array[i] = vp9_sad8x8(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x8x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- uint32_t *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad8x8(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x16x3_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 3; ++i)
- sad_array[i] = vp9_sad8x16(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x16x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- uint32_t *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad8x16(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad4x4x3_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 3; ++i)
- sad_array[i] = vp9_sad4x4(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad4x4x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- uint32_t *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad4x4(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad64x64x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad64x64(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad32x32x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad32x32(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad16x16x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad16x16(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad16x8x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad16x8(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x8x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad8x8(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x16x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad8x16(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x4x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad8x4(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad8x4x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- uint32_t *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad8x4(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad4x8x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad4x8(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad4x8x8_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t *ref_ptr, int ref_stride,
- uint32_t *sad_array) {
- int i;
- for (i = 0; i < 8; ++i)
- sad_array[i] = vp9_sad4x8(src_ptr, src_stride, ref_ptr + i, ref_stride,
- 0x7fffffff);
-}
-
-void vp9_sad4x4x4d_c(const uint8_t *src_ptr, int src_stride,
- const uint8_t* const ref_ptr[], int ref_stride,
- unsigned int *sad_array) {
- int i;
- for (i = 0; i < 4; ++i)
- sad_array[i] = vp9_sad4x4(src_ptr, src_stride, ref_ptr[i], ref_stride,
- 0x7fffffff);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.c
deleted file mode 100644
index 9d3e6dc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <limits.h>
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_tile_common.h"
-
-#include "vp9/encoder/vp9_cost.h"
-#include "vp9/encoder/vp9_segmentation.h"
-
-void vp9_enable_segmentation(struct segmentation *seg) {
- seg->enabled = 1;
- seg->update_map = 1;
- seg->update_data = 1;
-}
-
-void vp9_disable_segmentation(struct segmentation *seg) {
- seg->enabled = 0;
-}
-
-void vp9_set_segmentation_map(VP9_COMP *cpi, unsigned char *segmentation_map) {
- struct segmentation *const seg = &cpi->common.seg;
-
- // Copy in the new segmentation map
- vpx_memcpy(cpi->segmentation_map, segmentation_map,
- (cpi->common.mi_rows * cpi->common.mi_cols));
-
- // Signal that the map should be updated.
- seg->update_map = 1;
- seg->update_data = 1;
-}
-
-void vp9_set_segment_data(struct segmentation *seg,
- signed char *feature_data,
- unsigned char abs_delta) {
- seg->abs_delta = abs_delta;
-
- vpx_memcpy(seg->feature_data, feature_data, sizeof(seg->feature_data));
-
- // TBD ?? Set the feature mask
- // vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0,
- // sizeof(cpi->mb.e_mbd.segment_feature_mask));
-}
-void vp9_disable_segfeature(struct segmentation *seg, int segment_id,
- SEG_LVL_FEATURES feature_id) {
- seg->feature_mask[segment_id] &= ~(1 << feature_id);
-}
-
-void vp9_clear_segdata(struct segmentation *seg, int segment_id,
- SEG_LVL_FEATURES feature_id) {
- seg->feature_data[segment_id][feature_id] = 0;
-}
-
-// Based on set of segment counts calculate a probability tree
-static void calc_segtree_probs(int *segcounts, vp9_prob *segment_tree_probs) {
- // Work out probabilities of each segment
- const int c01 = segcounts[0] + segcounts[1];
- const int c23 = segcounts[2] + segcounts[3];
- const int c45 = segcounts[4] + segcounts[5];
- const int c67 = segcounts[6] + segcounts[7];
-
- segment_tree_probs[0] = get_binary_prob(c01 + c23, c45 + c67);
- segment_tree_probs[1] = get_binary_prob(c01, c23);
- segment_tree_probs[2] = get_binary_prob(c45, c67);
- segment_tree_probs[3] = get_binary_prob(segcounts[0], segcounts[1]);
- segment_tree_probs[4] = get_binary_prob(segcounts[2], segcounts[3]);
- segment_tree_probs[5] = get_binary_prob(segcounts[4], segcounts[5]);
- segment_tree_probs[6] = get_binary_prob(segcounts[6], segcounts[7]);
-}
-
-// Based on set of segment counts and probabilities calculate a cost estimate
-static int cost_segmap(int *segcounts, vp9_prob *probs) {
- const int c01 = segcounts[0] + segcounts[1];
- const int c23 = segcounts[2] + segcounts[3];
- const int c45 = segcounts[4] + segcounts[5];
- const int c67 = segcounts[6] + segcounts[7];
- const int c0123 = c01 + c23;
- const int c4567 = c45 + c67;
-
- // Cost the top node of the tree
- int cost = c0123 * vp9_cost_zero(probs[0]) +
- c4567 * vp9_cost_one(probs[0]);
-
- // Cost subsequent levels
- if (c0123 > 0) {
- cost += c01 * vp9_cost_zero(probs[1]) +
- c23 * vp9_cost_one(probs[1]);
-
- if (c01 > 0)
- cost += segcounts[0] * vp9_cost_zero(probs[3]) +
- segcounts[1] * vp9_cost_one(probs[3]);
- if (c23 > 0)
- cost += segcounts[2] * vp9_cost_zero(probs[4]) +
- segcounts[3] * vp9_cost_one(probs[4]);
- }
-
- if (c4567 > 0) {
- cost += c45 * vp9_cost_zero(probs[2]) +
- c67 * vp9_cost_one(probs[2]);
-
- if (c45 > 0)
- cost += segcounts[4] * vp9_cost_zero(probs[5]) +
- segcounts[5] * vp9_cost_one(probs[5]);
- if (c67 > 0)
- cost += segcounts[6] * vp9_cost_zero(probs[6]) +
- segcounts[7] * vp9_cost_one(probs[6]);
- }
-
- return cost;
-}
-
-static void count_segs(VP9_COMP *cpi, const TileInfo *const tile,
- MODE_INFO **mi_8x8,
- int *no_pred_segcounts,
- int (*temporal_predictor_count)[2],
- int *t_unpred_seg_counts,
- int bw, int bh, int mi_row, int mi_col) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- int segment_id;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- xd->mi = mi_8x8;
- segment_id = xd->mi[0]->mbmi.segment_id;
-
- set_mi_row_col(xd, tile, mi_row, bh, mi_col, bw, cm->mi_rows, cm->mi_cols);
-
- // Count the number of hits on each segment with no prediction
- no_pred_segcounts[segment_id]++;
-
- // Temporal prediction not allowed on key frames
- if (cm->frame_type != KEY_FRAME) {
- const BLOCK_SIZE bsize = mi_8x8[0]->mbmi.sb_type;
- // Test to see if the segment id matches the predicted value.
- const int pred_segment_id = vp9_get_segment_id(cm, cm->last_frame_seg_map,
- bsize, mi_row, mi_col);
- const int pred_flag = pred_segment_id == segment_id;
- const int pred_context = vp9_get_pred_context_seg_id(xd);
-
- // Store the prediction status for this mb and update counts
- // as appropriate
- xd->mi[0]->mbmi.seg_id_predicted = pred_flag;
- temporal_predictor_count[pred_context][pred_flag]++;
-
- if (!pred_flag)
- // Update the "unpredicted" segment count
- t_unpred_seg_counts[segment_id]++;
- }
-}
-
-static void count_segs_sb(VP9_COMP *cpi, const TileInfo *const tile,
- MODE_INFO **mi_8x8,
- int *no_pred_segcounts,
- int (*temporal_predictor_count)[2],
- int *t_unpred_seg_counts,
- int mi_row, int mi_col,
- BLOCK_SIZE bsize) {
- const VP9_COMMON *const cm = &cpi->common;
- const int mis = cm->mi_stride;
- int bw, bh;
- const int bs = num_8x8_blocks_wide_lookup[bsize], hbs = bs / 2;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- bw = num_8x8_blocks_wide_lookup[mi_8x8[0]->mbmi.sb_type];
- bh = num_8x8_blocks_high_lookup[mi_8x8[0]->mbmi.sb_type];
-
- if (bw == bs && bh == bs) {
- count_segs(cpi, tile, mi_8x8, no_pred_segcounts, temporal_predictor_count,
- t_unpred_seg_counts, bs, bs, mi_row, mi_col);
- } else if (bw == bs && bh < bs) {
- count_segs(cpi, tile, mi_8x8, no_pred_segcounts, temporal_predictor_count,
- t_unpred_seg_counts, bs, hbs, mi_row, mi_col);
- count_segs(cpi, tile, mi_8x8 + hbs * mis, no_pred_segcounts,
- temporal_predictor_count, t_unpred_seg_counts, bs, hbs,
- mi_row + hbs, mi_col);
- } else if (bw < bs && bh == bs) {
- count_segs(cpi, tile, mi_8x8, no_pred_segcounts, temporal_predictor_count,
- t_unpred_seg_counts, hbs, bs, mi_row, mi_col);
- count_segs(cpi, tile, mi_8x8 + hbs,
- no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts,
- hbs, bs, mi_row, mi_col + hbs);
- } else {
- const BLOCK_SIZE subsize = subsize_lookup[PARTITION_SPLIT][bsize];
- int n;
-
- assert(bw < bs && bh < bs);
-
- for (n = 0; n < 4; n++) {
- const int mi_dc = hbs * (n & 1);
- const int mi_dr = hbs * (n >> 1);
-
- count_segs_sb(cpi, tile, &mi_8x8[mi_dr * mis + mi_dc],
- no_pred_segcounts, temporal_predictor_count,
- t_unpred_seg_counts,
- mi_row + mi_dr, mi_col + mi_dc, subsize);
- }
- }
-}
-
-void vp9_choose_segmap_coding_method(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- struct segmentation *seg = &cm->seg;
-
- int no_pred_cost;
- int t_pred_cost = INT_MAX;
-
- int i, tile_col, mi_row, mi_col;
-
- int temporal_predictor_count[PREDICTION_PROBS][2] = { { 0 } };
- int no_pred_segcounts[MAX_SEGMENTS] = { 0 };
- int t_unpred_seg_counts[MAX_SEGMENTS] = { 0 };
-
- vp9_prob no_pred_tree[SEG_TREE_PROBS];
- vp9_prob t_pred_tree[SEG_TREE_PROBS];
- vp9_prob t_nopred_prob[PREDICTION_PROBS];
-
- const int mis = cm->mi_stride;
- MODE_INFO **mi_ptr, **mi;
-
- // Set default state for the segment tree probabilities and the
- // temporal coding probabilities
- vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs));
- vpx_memset(seg->pred_probs, 255, sizeof(seg->pred_probs));
-
- // First of all generate stats regarding how well the last segment map
- // predicts this one
- for (tile_col = 0; tile_col < 1 << cm->log2_tile_cols; tile_col++) {
- TileInfo tile;
-
- vp9_tile_init(&tile, cm, 0, tile_col);
- mi_ptr = cm->mi_grid_visible + tile.mi_col_start;
- for (mi_row = 0; mi_row < cm->mi_rows;
- mi_row += 8, mi_ptr += 8 * mis) {
- mi = mi_ptr;
- for (mi_col = tile.mi_col_start; mi_col < tile.mi_col_end;
- mi_col += 8, mi += 8)
- count_segs_sb(cpi, &tile, mi, no_pred_segcounts,
- temporal_predictor_count, t_unpred_seg_counts,
- mi_row, mi_col, BLOCK_64X64);
- }
- }
-
- // Work out probability tree for coding segments without prediction
- // and the cost.
- calc_segtree_probs(no_pred_segcounts, no_pred_tree);
- no_pred_cost = cost_segmap(no_pred_segcounts, no_pred_tree);
-
- // Key frames cannot use temporal prediction
- if (!frame_is_intra_only(cm)) {
- // Work out probability tree for coding those segments not
- // predicted using the temporal method and the cost.
- calc_segtree_probs(t_unpred_seg_counts, t_pred_tree);
- t_pred_cost = cost_segmap(t_unpred_seg_counts, t_pred_tree);
-
- // Add in the cost of the signaling for each prediction context.
- for (i = 0; i < PREDICTION_PROBS; i++) {
- const int count0 = temporal_predictor_count[i][0];
- const int count1 = temporal_predictor_count[i][1];
-
- t_nopred_prob[i] = get_binary_prob(count0, count1);
-
- // Add in the predictor signaling cost
- t_pred_cost += count0 * vp9_cost_zero(t_nopred_prob[i]) +
- count1 * vp9_cost_one(t_nopred_prob[i]);
- }
- }
-
- // Now choose which coding method to use.
- if (t_pred_cost < no_pred_cost) {
- seg->temporal_update = 1;
- vpx_memcpy(seg->tree_probs, t_pred_tree, sizeof(t_pred_tree));
- vpx_memcpy(seg->pred_probs, t_nopred_prob, sizeof(t_nopred_prob));
- } else {
- seg->temporal_update = 0;
- vpx_memcpy(seg->tree_probs, no_pred_tree, sizeof(no_pred_tree));
- }
-}
-
-void vp9_reset_segment_features(struct segmentation *seg) {
- // Set up default state for MB feature flags
- seg->enabled = 0;
- seg->update_map = 0;
- seg->update_data = 0;
- vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs));
- vp9_clearall_segfeatures(seg);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.h
deleted file mode 100644
index 66c51a2..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_segmentation.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_SEGMENTATION_H_
-#define VP9_ENCODER_VP9_SEGMENTATION_H_
-
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_enable_segmentation(struct segmentation *seg);
-void vp9_disable_segmentation(struct segmentation *seg);
-
-void vp9_disable_segfeature(struct segmentation *seg,
- int segment_id,
- SEG_LVL_FEATURES feature_id);
-void vp9_clear_segdata(struct segmentation *seg,
- int segment_id,
- SEG_LVL_FEATURES feature_id);
-// Valid values for a segment are 0 to 3
-// Segmentation map is arrange as [Rows][Columns]
-void vp9_set_segmentation_map(VP9_COMP *cpi, unsigned char *segmentation_map);
-
-// The values given for each segment can be either deltas (from the default
-// value chosen for the frame) or absolute values.
-//
-// Valid range for abs values is (0-127 for MB_LVL_ALT_Q), (0-63 for
-// SEGMENT_ALT_LF)
-// Valid range for delta values are (+/-127 for MB_LVL_ALT_Q), (+/-63 for
-// SEGMENT_ALT_LF)
-//
-// abs_delta = SEGMENT_DELTADATA (deltas) abs_delta = SEGMENT_ABSDATA (use
-// the absolute values given).
-void vp9_set_segment_data(struct segmentation *seg, signed char *feature_data,
- unsigned char abs_delta);
-
-void vp9_choose_segmap_coding_method(VP9_COMP *cpi);
-
-void vp9_reset_segment_features(struct segmentation *seg);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_SEGMENTATION_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.c
deleted file mode 100644
index 7b983f9..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <limits.h>
-
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_speed_features.h"
-
-#define ALL_INTRA_MODES ((1 << DC_PRED) | \
- (1 << V_PRED) | (1 << H_PRED) | \
- (1 << D45_PRED) | (1 << D135_PRED) | \
- (1 << D117_PRED) | (1 << D153_PRED) | \
- (1 << D207_PRED) | (1 << D63_PRED) | \
- (1 << TM_PRED))
-#define INTRA_DC_ONLY (1 << DC_PRED)
-#define INTRA_DC_TM ((1 << TM_PRED) | (1 << DC_PRED))
-#define INTRA_DC_H_V ((1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED))
-#define INTRA_DC_TM_H_V (INTRA_DC_TM | (1 << V_PRED) | (1 << H_PRED))
-
-// Masks for partially or completely disabling split mode
-#define DISABLE_ALL_INTER_SPLIT ((1 << THR_COMP_GA) | \
- (1 << THR_COMP_LA) | \
- (1 << THR_ALTR) | \
- (1 << THR_GOLD) | \
- (1 << THR_LAST))
-
-#define DISABLE_ALL_SPLIT ((1 << THR_INTRA) | DISABLE_ALL_INTER_SPLIT)
-
-#define DISABLE_COMPOUND_SPLIT ((1 << THR_COMP_GA) | (1 << THR_COMP_LA))
-
-#define LAST_AND_INTRA_SPLIT_ONLY ((1 << THR_COMP_GA) | \
- (1 << THR_COMP_LA) | \
- (1 << THR_ALTR) | \
- (1 << THR_GOLD))
-
-static void set_good_speed_feature(VP9_COMP *cpi,
- VP9_COMMON *cm,
- SPEED_FEATURES *sf,
- int speed) {
- int i;
- sf->adaptive_rd_thresh = 1;
- sf->recode_loop = ((speed < 1) ? ALLOW_RECODE : ALLOW_RECODE_KFMAXBW);
- sf->allow_skip_recode = 1;
-
- if (speed >= 1) {
- sf->use_square_partition_only = !frame_is_intra_only(cm);
- sf->less_rectangular_check = 1;
- sf->tx_size_search_method = vp9_frame_is_boosted(cpi)
- ? USE_FULL_RD : USE_LARGESTALL;
-
- if (MIN(cm->width, cm->height) >= 720)
- sf->disable_split_mask = cm->show_frame ?
- DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT;
- else
- sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
- sf->use_rd_breakout = 1;
- sf->adaptive_motion_search = 1;
- sf->auto_mv_step_size = 1;
- sf->adaptive_rd_thresh = 2;
- sf->subpel_iters_per_step = 1;
- sf->mode_skip_start = 10;
- sf->adaptive_pred_interp_filter = 1;
-
- sf->recode_loop = ALLOW_RECODE_KFARFGF;
- sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
- sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
- sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
- sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
- }
- // Additions or changes from speed 1 for speed >= 2.
- if (speed >= 2) {
- sf->tx_size_search_method = vp9_frame_is_boosted(cpi)
- ? USE_FULL_RD : USE_LARGESTALL;
-
- if (MIN(cm->width, cm->height) >= 720)
- sf->disable_split_mask = cm->show_frame ?
- DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT;
- else
- sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
-
- sf->adaptive_pred_interp_filter = 2;
-
- sf->reference_masking = 1;
- sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
- FLAG_SKIP_INTRA_BESTINTER |
- FLAG_SKIP_COMP_BESTINTRA |
- FLAG_SKIP_INTRA_LOWVAR;
- sf->disable_filter_search_var_thresh = 100;
- sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
-
- sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
- sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
- sf->adjust_partitioning_from_last_frame = 1;
- sf->last_partitioning_redo_frequency = 3;
- }
- // Additions or changes for speed 3 and above
- if (speed >= 3) {
- if (MIN(cm->width, cm->height) >= 720)
- sf->disable_split_mask = DISABLE_ALL_SPLIT;
- else
- sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT;
-
- sf->recode_loop = ALLOW_RECODE_KFMAXBW;
-
- sf->adaptive_rd_thresh = 3;
- sf->mode_skip_start = 6;
- sf->use_fast_coef_updates = 2;
- sf->use_fast_coef_costing = 1;
- }
- // Additions or changes for speed 3 and above
- if (speed >= 4) {
- sf->use_square_partition_only = 1;
- sf->tx_size_search_method = USE_LARGESTALL;
- sf->disable_split_mask = DISABLE_ALL_SPLIT;
-
- sf->adaptive_rd_thresh = 4;
-
- // Add a couple more skip flags
- sf->mode_search_skip_flags |= FLAG_SKIP_COMP_REFMISMATCH |
- FLAG_EARLY_TERMINATE;
-
- sf->disable_filter_search_var_thresh = 200;
-
- sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL;
- sf->use_lp32x32fdct = 1;
- }
- if (speed >= 5) {
- sf->partition_search_type = FIXED_PARTITION;
- sf->optimize_coefficients = 0;
- sf->search_method = HEX;
- sf->disable_filter_search_var_thresh = 500;
- for (i = 0; i < TX_SIZES; i++) {
- sf->intra_y_mode_mask[i] = INTRA_DC_ONLY;
- sf->intra_uv_mode_mask[i] = INTRA_DC_ONLY;
- }
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
- }
-}
-
-static void set_rt_speed_feature(VP9_COMMON *cm,
- SPEED_FEATURES *sf,
- int speed) {
- sf->static_segmentation = 0;
- sf->adaptive_rd_thresh = 1;
- sf->encode_breakout_thresh = 1;
- sf->use_fast_coef_costing = 1;
-
- if (speed == 1) {
- sf->use_square_partition_only = !frame_is_intra_only(cm);
- sf->less_rectangular_check = 1;
- sf->tx_size_search_method =
- frame_is_intra_only(cm) ? USE_FULL_RD : USE_LARGESTALL;
-
- if (MIN(cm->width, cm->height) >= 720)
- sf->disable_split_mask = cm->show_frame ?
- DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT;
- else
- sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
-
- sf->use_rd_breakout = 1;
- sf->adaptive_motion_search = 1;
- sf->adaptive_pred_interp_filter = 1;
- sf->auto_mv_step_size = 1;
- sf->adaptive_rd_thresh = 2;
- sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
- sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
- sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
- sf->encode_breakout_thresh = 8;
- }
- if (speed >= 2) {
- sf->use_square_partition_only = !frame_is_intra_only(cm);
- sf->less_rectangular_check = 1;
- sf->tx_size_search_method =
- frame_is_intra_only(cm) ? USE_FULL_RD : USE_LARGESTALL;
-
- if (MIN(cm->width, cm->height) >= 720)
- sf->disable_split_mask = cm->show_frame ?
- DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT;
- else
- sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
-
- sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH
- | FLAG_SKIP_INTRA_BESTINTER | FLAG_SKIP_COMP_BESTINTRA
- | FLAG_SKIP_INTRA_LOWVAR;
-
- sf->use_rd_breakout = 1;
- sf->adaptive_motion_search = 1;
- sf->adaptive_pred_interp_filter = 2;
- sf->auto_mv_step_size = 1;
- sf->reference_masking = 1;
-
- sf->disable_filter_search_var_thresh = 50;
- sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
-
- sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
- sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
- sf->adjust_partitioning_from_last_frame = 1;
- sf->last_partitioning_redo_frequency = 3;
-
- sf->adaptive_rd_thresh = 2;
- sf->use_lp32x32fdct = 1;
- sf->mode_skip_start = 11;
- sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
- sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
- sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
- sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
- sf->encode_breakout_thresh = 200;
- }
- if (speed >= 3) {
- sf->use_square_partition_only = 1;
- sf->disable_filter_search_var_thresh = 100;
- sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL;
- sf->use_uv_intra_rd_estimate = 1;
- sf->skip_encode_sb = 1;
- sf->subpel_iters_per_step = 1;
- sf->use_fast_coef_updates = 2;
- sf->adaptive_rd_thresh = 4;
- sf->mode_skip_start = 6;
- sf->allow_skip_recode = 0;
- sf->optimize_coefficients = 0;
- sf->disable_split_mask = DISABLE_ALL_SPLIT;
- sf->lpf_pick = LPF_PICK_FROM_Q;
- sf->encode_breakout_thresh = 700;
- }
- if (speed >= 4) {
- int i;
- sf->last_partitioning_redo_frequency = 4;
- sf->adaptive_rd_thresh = 5;
- sf->use_fast_coef_costing = 0;
- sf->auto_min_max_partition_size = STRICT_NEIGHBORING_MIN_MAX;
- sf->adjust_partitioning_from_last_frame =
- cm->last_frame_type != cm->frame_type || (0 ==
- (cm->current_video_frame + 1) % sf->last_partitioning_redo_frequency);
- sf->subpel_force_stop = 1;
- for (i = 0; i < TX_SIZES; i++) {
- sf->intra_y_mode_mask[i] = INTRA_DC_H_V;
- sf->intra_uv_mode_mask[i] = INTRA_DC_ONLY;
- }
- sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_ONLY;
- sf->frame_parameter_update = 0;
- sf->encode_breakout_thresh = 1000;
- sf->search_method = FAST_HEX;
- sf->disable_inter_mode_mask[BLOCK_32X32] = 1 << INTER_OFFSET(ZEROMV);
- sf->disable_inter_mode_mask[BLOCK_32X64] = ~(1 << INTER_OFFSET(NEARESTMV));
- sf->disable_inter_mode_mask[BLOCK_64X32] = ~(1 << INTER_OFFSET(NEARESTMV));
- sf->disable_inter_mode_mask[BLOCK_64X64] = ~(1 << INTER_OFFSET(NEARESTMV));
- sf->max_intra_bsize = BLOCK_32X32;
- sf->allow_skip_recode = 1;
- }
- if (speed >= 5) {
- sf->max_partition_size = BLOCK_32X32;
- sf->min_partition_size = BLOCK_8X8;
- sf->partition_check =
- (cm->current_video_frame % sf->last_partitioning_redo_frequency == 1);
- sf->force_frame_boost = cm->frame_type == KEY_FRAME ||
- (cm->current_video_frame %
- (sf->last_partitioning_redo_frequency << 1) == 1);
- sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15;
- sf->partition_search_type = REFERENCE_PARTITION;
- sf->use_nonrd_pick_mode = 1;
- sf->search_method = FAST_DIAMOND;
- sf->allow_skip_recode = 0;
- }
- if (speed >= 6) {
- sf->partition_search_type = VAR_BASED_FIXED_PARTITION;
- sf->use_nonrd_pick_mode = 1;
- sf->search_method = FAST_DIAMOND;
- }
- if (speed >= 7) {
- int i;
- for (i = 0; i < BLOCK_SIZES; ++i)
- sf->disable_inter_mode_mask[i] = 14; // only search NEARESTMV (0)
- }
-}
-
-void vp9_set_speed_features(VP9_COMP *cpi) {
- SPEED_FEATURES *const sf = &cpi->sf;
- VP9_COMMON *const cm = &cpi->common;
- const int speed = cpi->speed < 0 ? -cpi->speed : cpi->speed;
- int i;
-
- // best quality defaults
- sf->frame_parameter_update = 1;
- sf->search_method = NSTEP;
- sf->recode_loop = ALLOW_RECODE;
- sf->subpel_search_method = SUBPEL_TREE;
- sf->subpel_iters_per_step = 2;
- sf->subpel_force_stop = 0;
- sf->optimize_coefficients = !cpi->oxcf.lossless;
- sf->reduce_first_step_size = 0;
- sf->auto_mv_step_size = 0;
- sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
- sf->comp_inter_joint_search_thresh = BLOCK_4X4;
- sf->adaptive_rd_thresh = 0;
- sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF;
- sf->tx_size_search_method = USE_FULL_RD;
- sf->use_lp32x32fdct = 0;
- sf->adaptive_motion_search = 0;
- sf->adaptive_pred_interp_filter = 0;
- sf->reference_masking = 0;
- sf->partition_search_type = SEARCH_PARTITION;
- sf->less_rectangular_check = 0;
- sf->use_square_partition_only = 0;
- sf->auto_min_max_partition_size = NOT_IN_USE;
- sf->max_partition_size = BLOCK_64X64;
- sf->min_partition_size = BLOCK_4X4;
- sf->adjust_partitioning_from_last_frame = 0;
- sf->last_partitioning_redo_frequency = 4;
- sf->disable_split_mask = 0;
- sf->mode_search_skip_flags = 0;
- sf->force_frame_boost = 0;
- sf->max_delta_qindex = 0;
- sf->disable_split_var_thresh = 0;
- sf->disable_filter_search_var_thresh = 0;
- for (i = 0; i < TX_SIZES; i++) {
- sf->intra_y_mode_mask[i] = ALL_INTRA_MODES;
- sf->intra_uv_mode_mask[i] = ALL_INTRA_MODES;
- }
- sf->use_rd_breakout = 0;
- sf->skip_encode_sb = 0;
- sf->use_uv_intra_rd_estimate = 0;
- sf->allow_skip_recode = 0;
- sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE;
- sf->use_fast_coef_updates = 0;
- sf->use_fast_coef_costing = 0;
- sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set
- sf->use_nonrd_pick_mode = 0;
- sf->encode_breakout_thresh = 0;
- for (i = 0; i < BLOCK_SIZES; ++i)
- sf->disable_inter_mode_mask[i] = 0;
- sf->max_intra_bsize = BLOCK_64X64;
- // This setting only takes effect when partition_search_type is set
- // to FIXED_PARTITION.
- sf->always_this_block_size = BLOCK_16X16;
-
- // Recode loop tolerence %.
- sf->recode_tolerance = 25;
-
- switch (cpi->oxcf.mode) {
- case MODE_BESTQUALITY:
- case MODE_SECONDPASS_BEST: // This is the best quality mode.
- cpi->diamond_search_sad = vp9_full_range_search;
- break;
- case MODE_FIRSTPASS:
- case MODE_GOODQUALITY:
- case MODE_SECONDPASS:
- set_good_speed_feature(cpi, cm, sf, speed);
- break;
- case MODE_REALTIME:
- set_rt_speed_feature(cm, sf, speed);
- break;
- }
-
- // Slow quant, dct and trellis not worthwhile for first pass
- // so make sure they are always turned off.
- if (cpi->pass == 1) {
- sf->optimize_coefficients = 0;
- }
-
- // No recode for 1 pass.
- if (cpi->pass == 0) {
- sf->recode_loop = DISALLOW_RECODE;
- sf->optimize_coefficients = 0;
- }
-
- if (cpi->sf.subpel_search_method == SUBPEL_TREE) {
- cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree;
- cpi->find_fractional_mv_step_comp = vp9_find_best_sub_pixel_comp_tree;
- }
-
- cpi->mb.optimize = cpi->sf.optimize_coefficients == 1 && cpi->pass != 1;
-
- if (cpi->encode_breakout && cpi->oxcf.mode == MODE_REALTIME &&
- sf->encode_breakout_thresh > cpi->encode_breakout)
- cpi->encode_breakout = sf->encode_breakout_thresh;
-
- if (sf->disable_split_mask == DISABLE_ALL_SPLIT)
- sf->adaptive_pred_interp_filter = 0;
-
- if (!cpi->oxcf.frame_periodic_boost) {
- sf->max_delta_qindex = 0;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.h
deleted file mode 100644
index 8260439..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_speed_features.h
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_SPEED_FEATURES_H_
-#define VP9_ENCODER_VP9_SPEED_FEATURES_H_
-
-#include "vp9/common/vp9_enums.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- DIAMOND = 0,
- NSTEP = 1,
- HEX = 2,
- BIGDIA = 3,
- SQUARE = 4,
- FAST_HEX = 5,
- FAST_DIAMOND = 6
-} SEARCH_METHODS;
-
-typedef enum {
- // No recode.
- DISALLOW_RECODE = 0,
- // Allow recode for KF and exceeding maximum frame bandwidth.
- ALLOW_RECODE_KFMAXBW = 1,
- // Allow recode only for KF/ARF/GF frames.
- ALLOW_RECODE_KFARFGF = 2,
- // Allow recode for all frames based on bitrate constraints.
- ALLOW_RECODE = 3,
-} RECODE_LOOP_TYPE;
-
-typedef enum {
- SUBPEL_TREE = 0,
- // Other methods to come
-} SUBPEL_SEARCH_METHODS;
-
-typedef enum {
- LAST_FRAME_PARTITION_OFF = 0,
- LAST_FRAME_PARTITION_LOW_MOTION = 1,
- LAST_FRAME_PARTITION_ALL = 2
-} LAST_FRAME_PARTITION_METHOD;
-
-typedef enum {
- USE_FULL_RD = 0,
- USE_LARGESTINTRA,
- USE_LARGESTINTRA_MODELINTER,
- USE_LARGESTALL
-} TX_SIZE_SEARCH_METHOD;
-
-typedef enum {
- NOT_IN_USE = 0,
- RELAXED_NEIGHBORING_MIN_MAX = 1,
- STRICT_NEIGHBORING_MIN_MAX = 2
-} AUTO_MIN_MAX_MODE;
-
-typedef enum {
- // Try the full image with different values.
- LPF_PICK_FROM_FULL_IMAGE,
- // Try a small portion of the image with different values.
- LPF_PICK_FROM_SUBIMAGE,
- // Estimate the level based on quantizer and frame type
- LPF_PICK_FROM_Q,
-} LPF_PICK_METHOD;
-
-typedef enum {
- // Terminate search early based on distortion so far compared to
- // qp step, distortion in the neighborhood of the frame, etc.
- FLAG_EARLY_TERMINATE = 1 << 0,
-
- // Skips comp inter modes if the best so far is an intra mode.
- FLAG_SKIP_COMP_BESTINTRA = 1 << 1,
-
- // Skips comp inter modes if the best single intermode so far does
- // not have the same reference as one of the two references being
- // tested.
- FLAG_SKIP_COMP_REFMISMATCH = 1 << 2,
-
- // Skips oblique intra modes if the best so far is an inter mode.
- FLAG_SKIP_INTRA_BESTINTER = 1 << 3,
-
- // Skips oblique intra modes at angles 27, 63, 117, 153 if the best
- // intra so far is not one of the neighboring directions.
- FLAG_SKIP_INTRA_DIRMISMATCH = 1 << 4,
-
- // Skips intra modes other than DC_PRED if the source variance is small
- FLAG_SKIP_INTRA_LOWVAR = 1 << 5,
-} MODE_SEARCH_SKIP_LOGIC;
-
-typedef enum {
- // Search partitions using RD/NONRD criterion
- SEARCH_PARTITION = 0,
-
- // Always use a fixed size partition
- FIXED_PARTITION = 1,
-
- // Use a fixed size partition in every 64X64 SB, where the size is
- // determined based on source variance
- VAR_BASED_FIXED_PARTITION = 2,
-
- REFERENCE_PARTITION = 3,
-
- // Use an arbitrary partitioning scheme based on source variance within
- // a 64X64 SB
- VAR_BASED_PARTITION
-} PARTITION_SEARCH_TYPE;
-
-typedef struct {
- // Frame level coding parameter update
- int frame_parameter_update;
-
- // Motion search method (Diamond, NSTEP, Hex, Big Diamond, Square, etc).
- SEARCH_METHODS search_method;
-
- RECODE_LOOP_TYPE recode_loop;
-
- // Subpel_search_method can only be subpel_tree which does a subpixel
- // logarithmic search that keeps stepping at 1/2 pixel units until
- // you stop getting a gain, and then goes on to 1/4 and repeats
- // the same process. Along the way it skips many diagonals.
- SUBPEL_SEARCH_METHODS subpel_search_method;
-
- // Maximum number of steps in logarithmic subpel search before giving up.
- int subpel_iters_per_step;
-
- // Control when to stop subpel search
- int subpel_force_stop;
-
- // This parameter controls the number of steps we'll do in a diamond
- // search.
- int max_step_search_steps;
-
- // This parameter controls which step in the n-step process we start at.
- // It's changed adaptively based on circumstances.
- int reduce_first_step_size;
-
- // If this is set to 1, we limit the motion search range to 2 times the
- // largest motion vector found in the last frame.
- int auto_mv_step_size;
-
- // Trellis (dynamic programming) optimization of quantized values (+1, 0).
- int optimize_coefficients;
-
- // Always set to 0. If on it enables 0 cost background transmission
- // (except for the initial transmission of the segmentation). The feature is
- // disabled because the addition of very large block sizes make the
- // backgrounds very to cheap to encode, and the segmentation we have
- // adds overhead.
- int static_segmentation;
-
- // If 1 we iterate finding a best reference for 2 ref frames together - via
- // a log search that iterates 4 times (check around mv for last for best
- // error of combined predictor then check around mv for alt). If 0 we
- // we just use the best motion vector found for each frame by itself.
- int comp_inter_joint_search_thresh;
-
- // This variable is used to cap the maximum number of times we skip testing a
- // mode to be evaluated. A high value means we will be faster.
- int adaptive_rd_thresh;
-
- // Enables skipping the reconstruction step (idct, recon) in the
- // intermediate steps assuming the last frame didn't have too many intra
- // blocks and the q is less than a threshold.
- int skip_encode_sb;
- int skip_encode_frame;
- // Speed feature to allow or disallow skipping of recode at block
- // level within a frame.
- int allow_skip_recode;
-
- // This variable allows us to reuse the last frames partition choices
- // (64x64 v 32x32 etc) for this frame. It can be set to only use the last
- // frame as a starting point in low motion scenes or always use it. If set
- // we use last partitioning_redo frequency to determine how often to redo
- // the partitioning from scratch. Adjust_partitioning_from_last_frame
- // enables us to adjust up or down one partitioning from the last frames
- // partitioning.
- LAST_FRAME_PARTITION_METHOD use_lastframe_partitioning;
-
- // Determine which method we use to determine transform size. We can choose
- // between options like full rd, largest for prediction size, largest
- // for intra and model coefs for the rest.
- TX_SIZE_SEARCH_METHOD tx_size_search_method;
-
- // Low precision 32x32 fdct keeps everything in 16 bits and thus is less
- // precise but significantly faster than the non lp version.
- int use_lp32x32fdct;
-
- // TODO(JBB): remove this as its no longer used.
-
- // After looking at the first set of modes (set by index here), skip
- // checking modes for reference frames that don't match the reference frame
- // of the best so far.
- int mode_skip_start;
-
- // TODO(JBB): Remove this.
- int reference_masking;
-
- PARTITION_SEARCH_TYPE partition_search_type;
-
- // Used if partition_search_type = FIXED_SIZE_PARTITION
- BLOCK_SIZE always_this_block_size;
-
- // Skip rectangular partition test when partition type none gives better
- // rd than partition type split.
- int less_rectangular_check;
-
- // Disable testing non square partitions. (eg 16x32)
- int use_square_partition_only;
-
- // Sets min and max partition sizes for this 64x64 region based on the
- // same 64x64 in last encoded frame, and the left and above neighbor.
- AUTO_MIN_MAX_MODE auto_min_max_partition_size;
-
- // Min and max partition size we enable (block_size) as per auto
- // min max, but also used by adjust partitioning, and pick_partitioning.
- BLOCK_SIZE min_partition_size;
- BLOCK_SIZE max_partition_size;
-
- // Whether or not we allow partitions one smaller or one greater than the last
- // frame's partitioning. Only used if use_lastframe_partitioning is set.
- int adjust_partitioning_from_last_frame;
-
- // How frequently we re do the partitioning from scratch. Only used if
- // use_lastframe_partitioning is set.
- int last_partitioning_redo_frequency;
-
- // Disables sub 8x8 blocksizes in different scenarios: Choices are to disable
- // it always, to allow it for only Last frame and Intra, disable it for all
- // inter modes or to enable it always.
- int disable_split_mask;
-
- // TODO(jingning): combine the related motion search speed features
- // This allows us to use motion search at other sizes as a starting
- // point for this motion search and limits the search range around it.
- int adaptive_motion_search;
-
- // Allows sub 8x8 modes to use the prediction filter that was determined
- // best for 8x8 mode. If set to 0 we always re check all the filters for
- // sizes less than 8x8, 1 means we check all filter modes if no 8x8 filter
- // was selected, and 2 means we use 8 tap if no 8x8 filter mode was selected.
- int adaptive_pred_interp_filter;
-
- // Search through variable block partition types in non-RD mode decision
- // encoding process for RTC.
- int partition_check;
-
- // Use finer quantizer in every other few frames that run variable block
- // partition type search.
- int force_frame_boost;
-
- // Maximally allowed base quantization index fluctuation.
- int max_delta_qindex;
-
- // Implements various heuristics to skip searching modes
- // The heuristics selected are based on flags
- // defined in the MODE_SEARCH_SKIP_HEURISTICS enum
- unsigned int mode_search_skip_flags;
-
- // A source variance threshold below which the split mode is disabled
- unsigned int disable_split_var_thresh;
-
- // A source variance threshold below which filter search is disabled
- // Choose a very large value (UINT_MAX) to use 8-tap always
- unsigned int disable_filter_search_var_thresh;
-
- // These bit masks allow you to enable or disable intra modes for each
- // transform size separately.
- int intra_y_mode_mask[TX_SIZES];
- int intra_uv_mode_mask[TX_SIZES];
-
- // This variable enables an early break out of mode testing if the model for
- // rd built from the prediction signal indicates a value that's much
- // higher than the best rd we've seen so far.
- int use_rd_breakout;
-
- // This enables us to use an estimate for intra rd based on dc mode rather
- // than choosing an actual uv mode in the stage of encoding before the actual
- // final encode.
- int use_uv_intra_rd_estimate;
-
- // This feature controls how the loop filter level is determined.
- LPF_PICK_METHOD lpf_pick;
-
- // This feature limits the number of coefficients updates we actually do
- // by only looking at counts from 1/2 the bands.
- int use_fast_coef_updates; // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced
-
- // This flag controls the use of non-RD mode decision.
- int use_nonrd_pick_mode;
-
- // This variable sets the encode_breakout threshold. Currently, it is only
- // enabled in real time mode.
- int encode_breakout_thresh;
-
- // A binary mask indicating if NEARESTMV, NEARMV, ZEROMV, NEWMV
- // modes are disabled in order from LSB to MSB for each BLOCK_SIZE.
- int disable_inter_mode_mask[BLOCK_SIZES];
-
- // This feature controls whether we do the expensive context update and
- // calculation in the rd coefficient costing loop.
- int use_fast_coef_costing;
-
- // This feature controls the tolerence vs target used in deciding whether to
- // recode a frame. It has no meaning if recode is disabled.
- int recode_tolerance;
-
- // This variable controls the maximum block size where intra blocks can be
- // used in inter frames.
- // TODO(aconverse): Fold this into one of the other many mode skips
- BLOCK_SIZE max_intra_bsize;
-} SPEED_FEATURES;
-
-struct VP9_COMP;
-
-void vp9_set_speed_features(struct VP9_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_SPEED_FEATURES_H_
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ssim.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ssim.c
deleted file mode 100644
index 1435191..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_ssim.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vp9/encoder/vp9_onyx_int.h"
-
-void vp9_ssim_parms_16x16_c(uint8_t *s, int sp, uint8_t *r,
- int rp, unsigned long *sum_s, unsigned long *sum_r,
- unsigned long *sum_sq_s, unsigned long *sum_sq_r,
- unsigned long *sum_sxr) {
- int i, j;
- for (i = 0; i < 16; i++, s += sp, r += rp) {
- for (j = 0; j < 16; j++) {
- *sum_s += s[j];
- *sum_r += r[j];
- *sum_sq_s += s[j] * s[j];
- *sum_sq_r += r[j] * r[j];
- *sum_sxr += s[j] * r[j];
- }
- }
-}
-void vp9_ssim_parms_8x8_c(uint8_t *s, int sp, uint8_t *r, int rp,
- unsigned long *sum_s, unsigned long *sum_r,
- unsigned long *sum_sq_s, unsigned long *sum_sq_r,
- unsigned long *sum_sxr) {
- int i, j;
- for (i = 0; i < 8; i++, s += sp, r += rp) {
- for (j = 0; j < 8; j++) {
- *sum_s += s[j];
- *sum_r += r[j];
- *sum_sq_s += s[j] * s[j];
- *sum_sq_r += r[j] * r[j];
- *sum_sxr += s[j] * r[j];
- }
- }
-}
-
-static const int64_t cc1 = 26634; // (64^2*(.01*255)^2
-static const int64_t cc2 = 239708; // (64^2*(.03*255)^2
-
-static double similarity(unsigned long sum_s, unsigned long sum_r,
- unsigned long sum_sq_s, unsigned long sum_sq_r,
- unsigned long sum_sxr, int count) {
- int64_t ssim_n, ssim_d;
- int64_t c1, c2;
-
- // scale the constants by number of pixels
- c1 = (cc1 * count * count) >> 12;
- c2 = (cc2 * count * count) >> 12;
-
- ssim_n = (2 * sum_s * sum_r + c1) * ((int64_t) 2 * count * sum_sxr -
- (int64_t) 2 * sum_s * sum_r + c2);
-
- ssim_d = (sum_s * sum_s + sum_r * sum_r + c1) *
- ((int64_t)count * sum_sq_s - (int64_t)sum_s * sum_s +
- (int64_t)count * sum_sq_r - (int64_t) sum_r * sum_r + c2);
-
- return ssim_n * 1.0 / ssim_d;
-}
-
-static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) {
- unsigned long sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
- vp9_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
- &sum_sxr);
- return similarity(sum_s, sum_r, sum_sq_s, sum_sq_r, sum_sxr, 64);
-}
-
-// We are using a 8x8 moving window with starting location of each 8x8 window
-// on the 4x4 pixel grid. Such arrangement allows the windows to overlap
-// block boundaries to penalize blocking artifacts.
-double vp9_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
- int stride_img2, int width, int height) {
- int i, j;
- int samples = 0;
- double ssim_total = 0;
-
- // sample point start with each 4x4 location
- for (i = 0; i <= height - 8;
- i += 4, img1 += stride_img1 * 4, img2 += stride_img2 * 4) {
- for (j = 0; j <= width - 8; j += 4) {
- double v = ssim_8x8(img1 + j, stride_img1, img2 + j, stride_img2);
- ssim_total += v;
- samples++;
- }
- }
- ssim_total /= samples;
- return ssim_total;
-}
-double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
- int lumamask, double *weight) {
- double a, b, c;
- double ssimv;
-
- a = vp9_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride,
- source->y_crop_width, source->y_crop_height);
-
- b = vp9_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height);
-
- c = vp9_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height);
-
- ssimv = a * .8 + .1 * (b + c);
-
- *weight = 1;
-
- return ssimv;
-}
-
-double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
- double *ssim_y, double *ssim_u, double *ssim_v) {
- double ssim_all = 0;
- double a, b, c;
-
- a = vp9_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride,
- source->y_crop_width, source->y_crop_height);
-
- b = vp9_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height);
-
- c = vp9_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height);
- *ssim_y = a;
- *ssim_u = b;
- *ssim_v = c;
- ssim_all = (a * 4 + b + c) / 6;
-
- return ssim_all;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.c
deleted file mode 100644
index 9796d64..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_entropy.h"
-
-#include "vp9/encoder/vp9_cost.h"
-#include "vp9/encoder/vp9_writer.h"
-
-#define vp9_cost_upd256 ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)))
-
-static int update_bits[255];
-
-static int recenter_nonneg(int v, int m) {
- if (v > (m << 1))
- return v;
- else if (v >= m)
- return ((v - m) << 1);
- else
- return ((m - v) << 1) - 1;
-}
-
-static int remap_prob(int v, int m) {
- int i;
- static const int map_table[MAX_PROB - 1] = {
- // generated by:
- // map_table[j] = split_index(j, MAX_PROB - 1, MODULUS_PARAM);
- 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 2, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 3, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 4, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 5, 86, 87, 88,
- 89, 90, 91, 92, 93, 94, 95, 96, 97, 6, 98, 99, 100, 101, 102,
- 103, 104, 105, 106, 107, 108, 109, 7, 110, 111, 112, 113, 114, 115, 116,
- 117, 118, 119, 120, 121, 8, 122, 123, 124, 125, 126, 127, 128, 129, 130,
- 131, 132, 133, 9, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
- 145, 10, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 11,
- 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 12, 170, 171,
- 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 13, 182, 183, 184, 185,
- 186, 187, 188, 189, 190, 191, 192, 193, 14, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 15, 206, 207, 208, 209, 210, 211, 212, 213,
- 214, 215, 216, 217, 16, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
- 228, 229, 17, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
- 18, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 19,
- };
- v--;
- m--;
- if ((m << 1) <= MAX_PROB)
- i = recenter_nonneg(v, m) - 1;
- else
- i = recenter_nonneg(MAX_PROB - 1 - v, MAX_PROB - 1 - m) - 1;
-
- i = map_table[i];
- return i;
-}
-
-static int count_term_subexp(int word) {
- if (word < 16)
- return 5;
- if (word < 32)
- return 6;
- if (word < 64)
- return 8;
- if (word < 129)
- return 10;
- return 11;
-}
-
-static int prob_diff_update_cost(vp9_prob newp, vp9_prob oldp) {
- int delp = remap_prob(newp, oldp);
- return update_bits[delp] * 256;
-}
-
-static void encode_uniform(vp9_writer *w, int v) {
- const int l = 8;
- const int m = (1 << l) - 191;
- if (v < m) {
- vp9_write_literal(w, v, l - 1);
- } else {
- vp9_write_literal(w, m + ((v - m) >> 1), l - 1);
- vp9_write_literal(w, (v - m) & 1, 1);
- }
-}
-
-static INLINE int write_bit_gte(vp9_writer *w, int word, int test) {
- vp9_write_literal(w, word >= test, 1);
- return word >= test;
-}
-
-static void encode_term_subexp(vp9_writer *w, int word) {
- if (!write_bit_gte(w, word, 16)) {
- vp9_write_literal(w, word, 4);
- } else if (!write_bit_gte(w, word, 32)) {
- vp9_write_literal(w, word - 16, 4);
- } else if (!write_bit_gte(w, word, 64)) {
- vp9_write_literal(w, word - 32, 5);
- } else {
- encode_uniform(w, word - 64);
- }
-}
-
-void vp9_write_prob_diff_update(vp9_writer *w, vp9_prob newp, vp9_prob oldp) {
- const int delp = remap_prob(newp, oldp);
- encode_term_subexp(w, delp);
-}
-
-void vp9_compute_update_table() {
- int i;
- for (i = 0; i < 254; i++)
- update_bits[i] = count_term_subexp(i);
-}
-
-int vp9_prob_diff_update_savings_search(const unsigned int *ct,
- vp9_prob oldp, vp9_prob *bestp,
- vp9_prob upd) {
- const int old_b = cost_branch256(ct, oldp);
- int bestsavings = 0;
- vp9_prob newp, bestnewp = oldp;
- const int step = *bestp > oldp ? -1 : 1;
-
- for (newp = *bestp; newp != oldp; newp += step) {
- const int new_b = cost_branch256(ct, newp);
- const int update_b = prob_diff_update_cost(newp, oldp) + vp9_cost_upd256;
- const int savings = old_b - new_b - update_b;
- if (savings > bestsavings) {
- bestsavings = savings;
- bestnewp = newp;
- }
- }
- *bestp = bestnewp;
- return bestsavings;
-}
-
-int vp9_prob_diff_update_savings_search_model(const unsigned int *ct,
- const vp9_prob *oldp,
- vp9_prob *bestp,
- vp9_prob upd) {
- int i, old_b, new_b, update_b, savings, bestsavings, step;
- int newp;
- vp9_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES];
- vp9_model_to_full_probs(oldp, oldplist);
- vpx_memcpy(newplist, oldp, sizeof(vp9_prob) * UNCONSTRAINED_NODES);
- for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i)
- old_b += cost_branch256(ct + 2 * i, oldplist[i]);
- old_b += cost_branch256(ct + 2 * PIVOT_NODE, oldplist[PIVOT_NODE]);
-
- bestsavings = 0;
- bestnewp = oldp[PIVOT_NODE];
-
- step = (*bestp > oldp[PIVOT_NODE] ? -1 : 1);
-
- for (newp = *bestp; newp != oldp[PIVOT_NODE]; newp += step) {
- if (newp < 1 || newp > 255)
- continue;
- newplist[PIVOT_NODE] = newp;
- vp9_model_to_full_probs(newplist, newplist);
- for (i = UNCONSTRAINED_NODES, new_b = 0; i < ENTROPY_NODES; ++i)
- new_b += cost_branch256(ct + 2 * i, newplist[i]);
- new_b += cost_branch256(ct + 2 * PIVOT_NODE, newplist[PIVOT_NODE]);
- update_b = prob_diff_update_cost(newp, oldp[PIVOT_NODE]) +
- vp9_cost_upd256;
- savings = old_b - new_b - update_b;
- if (savings > bestsavings) {
- bestsavings = savings;
- bestnewp = newp;
- }
- }
- *bestp = bestnewp;
- return bestsavings;
-}
-
-void vp9_cond_prob_diff_update(vp9_writer *w, vp9_prob *oldp,
- const unsigned int ct[2]) {
- const vp9_prob upd = DIFF_UPDATE_PROB;
- vp9_prob newp = get_binary_prob(ct[0], ct[1]);
- const int savings = vp9_prob_diff_update_savings_search(ct, *oldp, &newp,
- upd);
- assert(newp >= 1);
- if (savings > 0) {
- vp9_write(w, 1, upd);
- vp9_write_prob_diff_update(w, newp, *oldp);
- *oldp = newp;
- } else {
- vp9_write(w, 0, upd);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.h
deleted file mode 100644
index 8e9c0c6..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_subexp.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_VP9_SUBEXP_H_
-#define VP9_ENCODER_VP9_SUBEXP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_compute_update_table();
-
-
-void vp9_write_prob_diff_update(vp9_writer *w,
- vp9_prob newp, vp9_prob oldp);
-
-void vp9_cond_prob_diff_update(vp9_writer *w, vp9_prob *oldp,
- unsigned int *ct);
-
-int vp9_prob_diff_update_savings_search(const unsigned int *ct,
- vp9_prob oldp, vp9_prob *bestp,
- vp9_prob upd);
-
-
-int vp9_prob_diff_update_savings_search_model(const unsigned int *ct,
- const vp9_prob *oldp,
- vp9_prob *bestp,
- vp9_prob upd);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_SUBEXP_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.c
deleted file mode 100644
index 2b5639d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_svc_layercontext.h"
-
-void vp9_init_layer_context(VP9_COMP *const cpi) {
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- int layer;
- int layer_end;
-
- cpi->svc.spatial_layer_id = 0;
- cpi->svc.temporal_layer_id = 0;
-
- if (cpi->svc.number_temporal_layers > 1) {
- layer_end = cpi->svc.number_temporal_layers;
- } else {
- layer_end = cpi->svc.number_spatial_layers;
- }
-
- for (layer = 0; layer < layer_end; ++layer) {
- LAYER_CONTEXT *const lc = &cpi->svc.layer_context[layer];
- RATE_CONTROL *const lrc = &lc->rc;
- lc->current_video_frame_in_layer = 0;
- lrc->avg_frame_qindex[INTER_FRAME] = q_trans[oxcf->worst_allowed_q];
- lrc->ni_av_qi = q_trans[oxcf->worst_allowed_q];
- lrc->total_actual_bits = 0;
- lrc->total_target_vs_actual = 0;
- lrc->ni_tot_qi = 0;
- lrc->tot_q = 0.0;
- lrc->avg_q = 0.0;
- lrc->ni_frames = 0;
- lrc->decimation_count = 0;
- lrc->decimation_factor = 0;
- lrc->rate_correction_factor = 1.0;
- lrc->key_frame_rate_correction_factor = 1.0;
-
- if (cpi->svc.number_temporal_layers > 1) {
- lc->target_bandwidth = oxcf->ts_target_bitrate[layer] * 1000;
- lrc->last_q[INTER_FRAME] = q_trans[oxcf->worst_allowed_q];
- } else {
- lc->target_bandwidth = oxcf->ss_target_bitrate[layer] * 1000;
- lrc->last_q[0] = q_trans[oxcf->best_allowed_q];
- lrc->last_q[1] = q_trans[oxcf->best_allowed_q];
- lrc->last_q[2] = q_trans[oxcf->best_allowed_q];
- }
-
- lrc->buffer_level = vp9_rescale((int)(oxcf->starting_buffer_level),
- lc->target_bandwidth, 1000);
- lrc->bits_off_target = lrc->buffer_level;
- }
-}
-
-// Update the layer context from a change_config() call.
-void vp9_update_layer_context_change_config(VP9_COMP *const cpi,
- const int target_bandwidth) {
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- const RATE_CONTROL *const rc = &cpi->rc;
- int layer;
- int layer_end;
- float bitrate_alloc = 1.0;
-
- if (cpi->svc.number_temporal_layers > 1) {
- layer_end = cpi->svc.number_temporal_layers;
- } else {
- layer_end = cpi->svc.number_spatial_layers;
- }
-
- for (layer = 0; layer < layer_end; ++layer) {
- LAYER_CONTEXT *const lc = &cpi->svc.layer_context[layer];
- RATE_CONTROL *const lrc = &lc->rc;
-
- if (cpi->svc.number_temporal_layers > 1) {
- lc->target_bandwidth = oxcf->ts_target_bitrate[layer] * 1000;
- } else {
- lc->target_bandwidth = oxcf->ss_target_bitrate[layer] * 1000;
- }
- bitrate_alloc = (float)lc->target_bandwidth / target_bandwidth;
- // Update buffer-related quantities.
- lc->starting_buffer_level =
- (int64_t)(oxcf->starting_buffer_level * bitrate_alloc);
- lc->optimal_buffer_level =
- (int64_t)(oxcf->optimal_buffer_level * bitrate_alloc);
- lc->maximum_buffer_size =
- (int64_t)(oxcf->maximum_buffer_size * bitrate_alloc);
- lrc->bits_off_target = MIN(lrc->bits_off_target, lc->maximum_buffer_size);
- lrc->buffer_level = MIN(lrc->buffer_level, lc->maximum_buffer_size);
- // Update framerate-related quantities.
- if (cpi->svc.number_temporal_layers > 1) {
- lc->framerate = oxcf->framerate / oxcf->ts_rate_decimator[layer];
- } else {
- lc->framerate = oxcf->framerate;
- }
- lrc->av_per_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
- lrc->max_frame_bandwidth = rc->max_frame_bandwidth;
- // Update qp-related quantities.
- lrc->worst_quality = rc->worst_quality;
- lrc->best_quality = rc->best_quality;
- }
-}
-
-static LAYER_CONTEXT *get_layer_context(SVC *svc) {
- return svc->number_temporal_layers > 1 ?
- &svc->layer_context[svc->temporal_layer_id] :
- &svc->layer_context[svc->spatial_layer_id];
-}
-
-void vp9_update_temporal_layer_framerate(VP9_COMP *const cpi) {
- const int layer = cpi->svc.temporal_layer_id;
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- LAYER_CONTEXT *const lc = get_layer_context(&cpi->svc);
- RATE_CONTROL *const lrc = &lc->rc;
-
- lc->framerate = oxcf->framerate / oxcf->ts_rate_decimator[layer];
- lrc->av_per_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
- lrc->max_frame_bandwidth = cpi->rc.max_frame_bandwidth;
- // Update the average layer frame size (non-cumulative per-frame-bw).
- if (layer == 0) {
- lc->avg_frame_size = lrc->av_per_frame_bandwidth;
- } else {
- const double prev_layer_framerate =
- oxcf->framerate / oxcf->ts_rate_decimator[layer - 1];
- const int prev_layer_target_bandwidth =
- oxcf->ts_target_bitrate[layer - 1] * 1000;
- lc->avg_frame_size =
- (int)((lc->target_bandwidth - prev_layer_target_bandwidth) /
- (lc->framerate - prev_layer_framerate));
- }
-}
-
-void vp9_update_spatial_layer_framerate(VP9_COMP *const cpi, double framerate) {
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- LAYER_CONTEXT *const lc = get_layer_context(&cpi->svc);
- RATE_CONTROL *const lrc = &lc->rc;
-
- lc->framerate = framerate;
- lrc->av_per_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
- lrc->min_frame_bandwidth = (int)(lrc->av_per_frame_bandwidth *
- oxcf->two_pass_vbrmin_section / 100);
- lrc->max_frame_bandwidth = (int)(((int64_t)lrc->av_per_frame_bandwidth *
- oxcf->two_pass_vbrmax_section) / 100);
- lrc->max_gf_interval = 16;
-
- lrc->static_scene_max_gf_interval = cpi->key_frame_frequency >> 1;
-
- if (oxcf->play_alternate && oxcf->lag_in_frames) {
- if (lrc->max_gf_interval > oxcf->lag_in_frames - 1)
- lrc->max_gf_interval = oxcf->lag_in_frames - 1;
-
- if (lrc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
- lrc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
- }
-
- if (lrc->max_gf_interval > lrc->static_scene_max_gf_interval)
- lrc->max_gf_interval = lrc->static_scene_max_gf_interval;
-}
-
-void vp9_restore_layer_context(VP9_COMP *const cpi) {
- LAYER_CONTEXT *const lc = get_layer_context(&cpi->svc);
- const int old_frame_since_key = cpi->rc.frames_since_key;
- const int old_frame_to_key = cpi->rc.frames_to_key;
-
- cpi->rc = lc->rc;
- cpi->twopass = lc->twopass;
- cpi->oxcf.target_bandwidth = lc->target_bandwidth;
- cpi->oxcf.starting_buffer_level = lc->starting_buffer_level;
- cpi->oxcf.optimal_buffer_level = lc->optimal_buffer_level;
- cpi->oxcf.maximum_buffer_size = lc->maximum_buffer_size;
- cpi->output_framerate = lc->framerate;
- // Reset the frames_since_key and frames_to_key counters to their values
- // before the layer restore. Keep these defined for the stream (not layer).
- if (cpi->svc.number_temporal_layers > 1) {
- cpi->rc.frames_since_key = old_frame_since_key;
- cpi->rc.frames_to_key = old_frame_to_key;
- }
-}
-
-void vp9_save_layer_context(VP9_COMP *const cpi) {
- const VP9_CONFIG *const oxcf = &cpi->oxcf;
- LAYER_CONTEXT *const lc = get_layer_context(&cpi->svc);
-
- lc->rc = cpi->rc;
- lc->twopass = cpi->twopass;
- lc->target_bandwidth = (int)oxcf->target_bandwidth;
- lc->starting_buffer_level = oxcf->starting_buffer_level;
- lc->optimal_buffer_level = oxcf->optimal_buffer_level;
- lc->maximum_buffer_size = oxcf->maximum_buffer_size;
- lc->framerate = cpi->output_framerate;
-}
-
-void vp9_init_second_pass_spatial_svc(VP9_COMP *cpi) {
- int i;
- for (i = 0; i < cpi->svc.number_spatial_layers; ++i) {
- struct twopass_rc *const twopass = &cpi->svc.layer_context[i].twopass;
-
- cpi->svc.spatial_layer_id = i;
- vp9_init_second_pass(cpi);
-
- twopass->total_stats.spatial_layer_id = i;
- twopass->total_left_stats.spatial_layer_id = i;
- }
- cpi->svc.spatial_layer_id = 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.h
deleted file mode 100644
index e859a2f..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_svc_layercontext.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_SVC_LAYERCONTEXT_H_
-#define VP9_ENCODER_VP9_SVC_LAYERCONTEXT_H_
-
-#include "vpx/vpx_encoder.h"
-
-#include "vp9/encoder/vp9_ratectrl.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- RATE_CONTROL rc;
- int target_bandwidth;
- int64_t starting_buffer_level;
- int64_t optimal_buffer_level;
- int64_t maximum_buffer_size;
- double framerate;
- int avg_frame_size;
- struct twopass_rc twopass;
- struct vpx_fixed_buf rc_twopass_stats_in;
- unsigned int current_video_frame_in_layer;
-} LAYER_CONTEXT;
-
-typedef struct {
- int spatial_layer_id;
- int temporal_layer_id;
- int number_spatial_layers;
- int number_temporal_layers;
- // Layer context used for rate control in one pass temporal CBR mode or
- // two pass spatial mode. Defined for temporal or spatial layers for now.
- // Does not support temporal combined with spatial RC.
- LAYER_CONTEXT layer_context[MAX(VPX_TS_MAX_LAYERS, VPX_SS_MAX_LAYERS)];
-} SVC;
-
-struct VP9_COMP;
-
-// Initialize layer context data from init_config().
-void vp9_init_layer_context(struct VP9_COMP *const cpi);
-
-// Update the layer context from a change_config() call.
-void vp9_update_layer_context_change_config(struct VP9_COMP *const cpi,
- const int target_bandwidth);
-
-// Prior to encoding the frame, update framerate-related quantities
-// for the current temporal layer.
-void vp9_update_temporal_layer_framerate(struct VP9_COMP *const cpi);
-
-// Update framerate-related quantities for the current spatial layer.
-void vp9_update_spatial_layer_framerate(struct VP9_COMP *const cpi,
- double framerate);
-
-// Prior to encoding the frame, set the layer context, for the current layer
-// to be encoded, to the cpi struct.
-void vp9_restore_layer_context(struct VP9_COMP *const cpi);
-
-// Save the layer context after encoding the frame.
-void vp9_save_layer_context(struct VP9_COMP *const cpi);
-
-// Initialize second pass rc for spatial svc.
-void vp9_init_second_pass_spatial_svc(struct VP9_COMP *cpi);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_SVC_LAYERCONTEXT_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.c
deleted file mode 100644
index 0410273..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.c
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <limits.h>
-
-#include "vp9/common/vp9_alloccommon.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_quant_common.h"
-#include "vp9/common/vp9_reconinter.h"
-#include "vp9/common/vp9_systemdependent.h"
-#include "vp9/encoder/vp9_extend.h"
-#include "vp9/encoder/vp9_firstpass.h"
-#include "vp9/encoder/vp9_mcomp.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_quantize.h"
-#include "vp9/encoder/vp9_ratectrl.h"
-#include "vp9/encoder/vp9_segmentation.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_ports/vpx_timer.h"
-#include "vpx_scale/vpx_scale.h"
-
-#define ALT_REF_MC_ENABLED 1 // dis/enable MC in AltRef filtering
-
-static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd,
- uint8_t *y_mb_ptr,
- uint8_t *u_mb_ptr,
- uint8_t *v_mb_ptr,
- int stride,
- int uv_block_size,
- int mv_row,
- int mv_col,
- uint8_t *pred,
- struct scale_factors *scale,
- int x, int y) {
- const int which_mv = 0;
- const MV mv = { mv_row, mv_col };
- const InterpKernel *const kernel =
- vp9_get_interp_kernel(xd->mi[0]->mbmi.interp_filter);
-
- enum mv_precision mv_precision_uv;
- int uv_stride;
- if (uv_block_size == 8) {
- uv_stride = (stride + 1) >> 1;
- mv_precision_uv = MV_PRECISION_Q4;
- } else {
- uv_stride = stride;
- mv_precision_uv = MV_PRECISION_Q3;
- }
-
- vp9_build_inter_predictor(y_mb_ptr, stride,
- &pred[0], 16,
- &mv,
- scale,
- 16, 16,
- which_mv,
- kernel, MV_PRECISION_Q3, x, y);
-
- vp9_build_inter_predictor(u_mb_ptr, uv_stride,
- &pred[256], uv_block_size,
- &mv,
- scale,
- uv_block_size, uv_block_size,
- which_mv,
- kernel, mv_precision_uv, x, y);
-
- vp9_build_inter_predictor(v_mb_ptr, uv_stride,
- &pred[512], uv_block_size,
- &mv,
- scale,
- uv_block_size, uv_block_size,
- which_mv,
- kernel, mv_precision_uv, x, y);
-}
-
-void vp9_temporal_filter_apply_c(uint8_t *frame1,
- unsigned int stride,
- uint8_t *frame2,
- unsigned int block_size,
- int strength,
- int filter_weight,
- unsigned int *accumulator,
- uint16_t *count) {
- unsigned int i, j, k;
- int modifier;
- int byte = 0;
-
- for (i = 0, k = 0; i < block_size; i++) {
- for (j = 0; j < block_size; j++, k++) {
- int src_byte = frame1[byte];
- int pixel_value = *frame2++;
-
- modifier = src_byte - pixel_value;
- // This is an integer approximation of:
- // float coeff = (3.0 * modifer * modifier) / pow(2, strength);
- // modifier = (int)roundf(coeff > 16 ? 0 : 16-coeff);
- modifier *= modifier;
- modifier *= 3;
- modifier += 1 << (strength - 1);
- modifier >>= strength;
-
- if (modifier > 16)
- modifier = 16;
-
- modifier = 16 - modifier;
- modifier *= filter_weight;
-
- count[k] += modifier;
- accumulator[k] += modifier * pixel_value;
-
- byte++;
- }
-
- byte += stride - block_size;
- }
-}
-
-#if ALT_REF_MC_ENABLED
-
-static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
- uint8_t *arf_frame_buf,
- uint8_t *frame_ptr_buf,
- int stride) {
- MACROBLOCK *x = &cpi->mb;
- MACROBLOCKD* const xd = &x->e_mbd;
- int step_param;
- int sadpb = x->sadperbit16;
- int bestsme = INT_MAX;
-
- MV best_ref_mv1 = {0, 0};
- MV best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
- MV *ref_mv = &x->e_mbd.mi[0]->bmi[0].as_mv[0].as_mv;
-
- // Save input state
- struct buf_2d src = x->plane[0].src;
- struct buf_2d pre = xd->plane[0].pre[0];
-
- best_ref_mv1_full.col = best_ref_mv1.col >> 3;
- best_ref_mv1_full.row = best_ref_mv1.row >> 3;
-
- // Setup frame pointers
- x->plane[0].src.buf = arf_frame_buf;
- x->plane[0].src.stride = stride;
- xd->plane[0].pre[0].buf = frame_ptr_buf;
- xd->plane[0].pre[0].stride = stride;
-
- // Further step/diamond searches as necessary
- if (cpi->speed < 8)
- step_param = cpi->sf.reduce_first_step_size + ((cpi->speed > 5) ? 1 : 0);
- else
- step_param = cpi->sf.reduce_first_step_size + 2;
- step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
-
- /*cpi->sf.search_method == HEX*/
- // Ignore mv costing by sending NULL pointer instead of cost arrays
- vp9_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,
- &cpi->fn_ptr[BLOCK_16X16], 0, &best_ref_mv1, ref_mv);
-
- // Try sub-pixel MC?
- // if (bestsme > error_thresh && bestsme < INT_MAX)
- {
- int distortion;
- unsigned int sse;
- // Ignore mv costing by sending NULL pointer instead of cost array
- bestsme = cpi->find_fractional_mv_step(x, ref_mv,
- &best_ref_mv1,
- cpi->common.allow_high_precision_mv,
- x->errorperbit,
- &cpi->fn_ptr[BLOCK_16X16],
- 0, cpi->sf.subpel_iters_per_step,
- NULL, NULL,
- &distortion, &sse);
- }
-
- // Restore input state
- x->plane[0].src = src;
- xd->plane[0].pre[0] = pre;
-
- return bestsme;
-}
-#endif
-
-static void temporal_filter_iterate_c(VP9_COMP *cpi,
- int frame_count,
- int alt_ref_index,
- int strength,
- struct scale_factors *scale) {
- int byte;
- int frame;
- int mb_col, mb_row;
- unsigned int filter_weight;
- int mb_cols = cpi->common.mb_cols;
- int mb_rows = cpi->common.mb_rows;
- int mb_y_offset = 0;
- int mb_uv_offset = 0;
- DECLARE_ALIGNED_ARRAY(16, unsigned int, accumulator, 16 * 16 * 3);
- DECLARE_ALIGNED_ARRAY(16, uint16_t, count, 16 * 16 * 3);
- MACROBLOCKD *mbd = &cpi->mb.e_mbd;
- YV12_BUFFER_CONFIG *f = cpi->frames[alt_ref_index];
- uint8_t *dst1, *dst2;
- DECLARE_ALIGNED_ARRAY(16, uint8_t, predictor, 16 * 16 * 3);
- const int mb_uv_height = 16 >> mbd->plane[1].subsampling_y;
-
- // Save input state
- uint8_t* input_buffer[MAX_MB_PLANE];
- int i;
-
- // TODO(aconverse): Add 4:2:2 support
- assert(mbd->plane[1].subsampling_x == mbd->plane[1].subsampling_y);
-
- for (i = 0; i < MAX_MB_PLANE; i++)
- input_buffer[i] = mbd->plane[i].pre[0].buf;
-
- for (mb_row = 0; mb_row < mb_rows; mb_row++) {
-#if ALT_REF_MC_ENABLED
- // Source frames are extended to 16 pixels. This is different than
- // L/A/G reference frames that have a border of 32 (VP9ENCBORDERINPIXELS)
- // A 6/8 tap filter is used for motion search. This requires 2 pixels
- // before and 3 pixels after. So the largest Y mv on a border would
- // then be 16 - VP9_INTERP_EXTEND. The UV blocks are half the size of the
- // Y and therefore only extended by 8. The largest mv that a UV block
- // can support is 8 - VP9_INTERP_EXTEND. A UV mv is half of a Y mv.
- // (16 - VP9_INTERP_EXTEND) >> 1 which is greater than
- // 8 - VP9_INTERP_EXTEND.
- // To keep the mv in play for both Y and UV planes the max that it
- // can be on a border is therefore 16 - (2*VP9_INTERP_EXTEND+1).
- cpi->mb.mv_row_min = -((mb_row * 16) + (17 - 2 * VP9_INTERP_EXTEND));
- cpi->mb.mv_row_max = ((cpi->common.mb_rows - 1 - mb_row) * 16)
- + (17 - 2 * VP9_INTERP_EXTEND);
-#endif
-
- for (mb_col = 0; mb_col < mb_cols; mb_col++) {
- int i, j, k;
- int stride;
-
- vpx_memset(accumulator, 0, 16 * 16 * 3 * sizeof(accumulator[0]));
- vpx_memset(count, 0, 16 * 16 * 3 * sizeof(count[0]));
-
-#if ALT_REF_MC_ENABLED
- cpi->mb.mv_col_min = -((mb_col * 16) + (17 - 2 * VP9_INTERP_EXTEND));
- cpi->mb.mv_col_max = ((cpi->common.mb_cols - 1 - mb_col) * 16)
- + (17 - 2 * VP9_INTERP_EXTEND);
-#endif
-
- for (frame = 0; frame < frame_count; frame++) {
- if (cpi->frames[frame] == NULL)
- continue;
-
- mbd->mi[0]->bmi[0].as_mv[0].as_mv.row = 0;
- mbd->mi[0]->bmi[0].as_mv[0].as_mv.col = 0;
-
- if (frame == alt_ref_index) {
- filter_weight = 2;
- } else {
- int err = 0;
-#if ALT_REF_MC_ENABLED
-#define THRESH_LOW 10000
-#define THRESH_HIGH 20000
-
- // Find best match in this frame by MC
- err = temporal_filter_find_matching_mb_c
- (cpi,
- cpi->frames[alt_ref_index]->y_buffer + mb_y_offset,
- cpi->frames[frame]->y_buffer + mb_y_offset,
- cpi->frames[frame]->y_stride);
-#endif
- // Assign higher weight to matching MB if it's error
- // score is lower. If not applying MC default behavior
- // is to weight all MBs equal.
- filter_weight = err < THRESH_LOW
- ? 2 : err < THRESH_HIGH ? 1 : 0;
- }
-
- if (filter_weight != 0) {
- // Construct the predictors
- temporal_filter_predictors_mb_c
- (mbd,
- cpi->frames[frame]->y_buffer + mb_y_offset,
- cpi->frames[frame]->u_buffer + mb_uv_offset,
- cpi->frames[frame]->v_buffer + mb_uv_offset,
- cpi->frames[frame]->y_stride,
- mb_uv_height,
- mbd->mi[0]->bmi[0].as_mv[0].as_mv.row,
- mbd->mi[0]->bmi[0].as_mv[0].as_mv.col,
- predictor, scale,
- mb_col * 16, mb_row * 16);
-
- // Apply the filter (YUV)
- vp9_temporal_filter_apply(f->y_buffer + mb_y_offset, f->y_stride,
- predictor, 16, strength, filter_weight,
- accumulator, count);
-
- vp9_temporal_filter_apply(f->u_buffer + mb_uv_offset, f->uv_stride,
- predictor + 256, mb_uv_height, strength,
- filter_weight, accumulator + 256,
- count + 256);
-
- vp9_temporal_filter_apply(f->v_buffer + mb_uv_offset, f->uv_stride,
- predictor + 512, mb_uv_height, strength,
- filter_weight, accumulator + 512,
- count + 512);
- }
- }
-
- // Normalize filter output to produce AltRef frame
- dst1 = cpi->alt_ref_buffer.y_buffer;
- stride = cpi->alt_ref_buffer.y_stride;
- byte = mb_y_offset;
- for (i = 0, k = 0; i < 16; i++) {
- for (j = 0; j < 16; j++, k++) {
- unsigned int pval = accumulator[k] + (count[k] >> 1);
- pval *= cpi->fixed_divide[count[k]];
- pval >>= 19;
-
- dst1[byte] = (uint8_t)pval;
-
- // move to next pixel
- byte++;
- }
-
- byte += stride - 16;
- }
-
- dst1 = cpi->alt_ref_buffer.u_buffer;
- dst2 = cpi->alt_ref_buffer.v_buffer;
- stride = cpi->alt_ref_buffer.uv_stride;
- byte = mb_uv_offset;
- for (i = 0, k = 256; i < mb_uv_height; i++) {
- for (j = 0; j < mb_uv_height; j++, k++) {
- int m = k + 256;
-
- // U
- unsigned int pval = accumulator[k] + (count[k] >> 1);
- pval *= cpi->fixed_divide[count[k]];
- pval >>= 19;
- dst1[byte] = (uint8_t)pval;
-
- // V
- pval = accumulator[m] + (count[m] >> 1);
- pval *= cpi->fixed_divide[count[m]];
- pval >>= 19;
- dst2[byte] = (uint8_t)pval;
-
- // move to next pixel
- byte++;
- }
-
- byte += stride - mb_uv_height;
- }
-
- mb_y_offset += 16;
- mb_uv_offset += mb_uv_height;
- }
-
- mb_y_offset += 16 * (f->y_stride - mb_cols);
- mb_uv_offset += mb_uv_height * (f->uv_stride - mb_cols);
- }
-
- // Restore input state
- for (i = 0; i < MAX_MB_PLANE; i++)
- mbd->plane[i].pre[0].buf = input_buffer[i];
-}
-
-void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
- VP9_COMMON *const cm = &cpi->common;
-
- int frame = 0;
-
- int frames_to_blur_backward = 0;
- int frames_to_blur_forward = 0;
- int frames_to_blur = 0;
- int start_frame = 0;
-
- int strength = cpi->active_arnr_strength;
- int blur_type = cpi->oxcf.arnr_type;
- int max_frames = cpi->active_arnr_frames;
-
- const int num_frames_backward = distance;
- const int num_frames_forward = vp9_lookahead_depth(cpi->lookahead)
- - (num_frames_backward + 1);
- struct scale_factors sf;
-
- switch (blur_type) {
- case 1:
- // Backward Blur
- frames_to_blur_backward = num_frames_backward;
-
- if (frames_to_blur_backward >= max_frames)
- frames_to_blur_backward = max_frames - 1;
-
- frames_to_blur = frames_to_blur_backward + 1;
- break;
-
- case 2:
- // Forward Blur
- frames_to_blur_forward = num_frames_forward;
-
- if (frames_to_blur_forward >= max_frames)
- frames_to_blur_forward = max_frames - 1;
-
- frames_to_blur = frames_to_blur_forward + 1;
- break;
-
- case 3:
- default:
- // Center Blur
- frames_to_blur_forward = num_frames_forward;
- frames_to_blur_backward = num_frames_backward;
-
- if (frames_to_blur_forward > frames_to_blur_backward)
- frames_to_blur_forward = frames_to_blur_backward;
-
- if (frames_to_blur_backward > frames_to_blur_forward)
- frames_to_blur_backward = frames_to_blur_forward;
-
- // When max_frames is even we have 1 more frame backward than forward
- if (frames_to_blur_forward > (max_frames - 1) / 2)
- frames_to_blur_forward = ((max_frames - 1) / 2);
-
- if (frames_to_blur_backward > (max_frames / 2))
- frames_to_blur_backward = (max_frames / 2);
-
- frames_to_blur = frames_to_blur_backward + frames_to_blur_forward + 1;
- break;
- }
-
- start_frame = distance + frames_to_blur_forward;
-
-#ifdef DEBUGFWG
- // DEBUG FWG
- printf(
- "max:%d FBCK:%d FFWD:%d ftb:%d ftbbck:%d ftbfwd:%d sei:%d lasei:%d "
- "start:%d",
- max_frames, num_frames_backward, num_frames_forward, frames_to_blur,
- frames_to_blur_backward, frames_to_blur_forward, cpi->source_encode_index,
- cpi->last_alt_ref_sei, start_frame);
-#endif
-
- // Setup scaling factors. Scaling on each of the arnr frames is not supported
- vp9_setup_scale_factors_for_frame(&sf,
- get_frame_new_buffer(cm)->y_crop_width,
- get_frame_new_buffer(cm)->y_crop_height,
- cm->width, cm->height);
-
- // Setup frame pointers, NULL indicates frame not included in filter
- vp9_zero(cpi->frames);
- for (frame = 0; frame < frames_to_blur; frame++) {
- int which_buffer = start_frame - frame;
- struct lookahead_entry *buf = vp9_lookahead_peek(cpi->lookahead,
- which_buffer);
- cpi->frames[frames_to_blur - 1 - frame] = &buf->img;
- }
-
- temporal_filter_iterate_c(cpi, frames_to_blur, frames_to_blur_backward,
- strength, &sf);
-}
-
-void vp9_configure_arnr_filter(VP9_COMP *cpi,
- const unsigned int frames_to_arnr,
- const int group_boost) {
- int half_gf_int;
- int frames_after_arf;
- int frames_bwd = cpi->oxcf.arnr_max_frames - 1;
- int frames_fwd = cpi->oxcf.arnr_max_frames - 1;
- int q;
-
- // Define the arnr filter width for this group of frames. We only
- // filter frames that lie within a distance of half the GF interval
- // from the ARF frame. We also have to trap cases where the filter
- // extends beyond the end of the lookahead buffer.
- // Note: frames_to_arnr parameter is the offset of the arnr
- // frame from the current frame.
- half_gf_int = cpi->rc.baseline_gf_interval >> 1;
- frames_after_arf = vp9_lookahead_depth(cpi->lookahead)
- - frames_to_arnr - 1;
-
- switch (cpi->oxcf.arnr_type) {
- case 1: // Backward filter
- frames_fwd = 0;
- if (frames_bwd > half_gf_int)
- frames_bwd = half_gf_int;
- break;
-
- case 2: // Forward filter
- if (frames_fwd > half_gf_int)
- frames_fwd = half_gf_int;
- if (frames_fwd > frames_after_arf)
- frames_fwd = frames_after_arf;
- frames_bwd = 0;
- break;
-
- case 3: // Centered filter
- default:
- frames_fwd >>= 1;
- if (frames_fwd > frames_after_arf)
- frames_fwd = frames_after_arf;
- if (frames_fwd > half_gf_int)
- frames_fwd = half_gf_int;
-
- frames_bwd = frames_fwd;
-
- // For even length filter there is one more frame backward
- // than forward: e.g. len=6 ==> bbbAff, len=7 ==> bbbAfff.
- if (frames_bwd < half_gf_int)
- frames_bwd += (cpi->oxcf.arnr_max_frames + 1) & 0x1;
- break;
- }
-
- cpi->active_arnr_frames = frames_bwd + 1 + frames_fwd;
-
- // Adjust the strength based on active max q
- if (cpi->common.current_video_frame > 1)
- q = ((int)vp9_convert_qindex_to_q(
- cpi->rc.avg_frame_qindex[INTER_FRAME]));
- else
- q = ((int)vp9_convert_qindex_to_q(
- cpi->rc.avg_frame_qindex[KEY_FRAME]));
- if (q > 16) {
- cpi->active_arnr_strength = cpi->oxcf.arnr_strength;
- } else {
- cpi->active_arnr_strength = cpi->oxcf.arnr_strength - ((16 - q) / 2);
- if (cpi->active_arnr_strength < 0)
- cpi->active_arnr_strength = 0;
- }
-
- // Adjust number of frames in filter and strength based on gf boost level.
- if (cpi->active_arnr_frames > (group_boost / 150)) {
- cpi->active_arnr_frames = (group_boost / 150);
- cpi->active_arnr_frames += !(cpi->active_arnr_frames & 1);
- }
- if (cpi->active_arnr_strength > (group_boost / 300)) {
- cpi->active_arnr_strength = (group_boost / 300);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.h
deleted file mode 100644
index 3028d78..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_temporal_filter.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_TEMPORAL_FILTER_H_
-#define VP9_ENCODER_VP9_TEMPORAL_FILTER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance);
-void vp9_configure_arnr_filter(VP9_COMP *cpi,
- const unsigned int frames_to_arnr,
- const int group_boost);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_TEMPORAL_FILTER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.c
deleted file mode 100644
index 291ccb3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp9/common/vp9_entropy.h"
-#include "vp9/common/vp9_pred_common.h"
-#include "vp9/common/vp9_seg_common.h"
-
-#include "vp9/encoder/vp9_cost.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vp9/encoder/vp9_tokenize.h"
-
-static TOKENVALUE dct_value_tokens[DCT_MAX_VALUE * 2];
-const TOKENVALUE *vp9_dct_value_tokens_ptr;
-static int16_t dct_value_cost[DCT_MAX_VALUE * 2];
-const int16_t *vp9_dct_value_cost_ptr;
-
-// Array indices are identical to previously-existing CONTEXT_NODE indices
-const vp9_tree_index vp9_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
- -EOB_TOKEN, 2, // 0 = EOB
- -ZERO_TOKEN, 4, // 1 = ZERO
- -ONE_TOKEN, 6, // 2 = ONE
- 8, 12, // 3 = LOW_VAL
- -TWO_TOKEN, 10, // 4 = TWO
- -THREE_TOKEN, -FOUR_TOKEN, // 5 = THREE
- 14, 16, // 6 = HIGH_LOW
- -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 7 = CAT_ONE
- 18, 20, // 8 = CAT_THREEFOUR
- -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 9 = CAT_THREE
- -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 10 = CAT_FIVE
-};
-
-// Unconstrained Node Tree
-const vp9_tree_index vp9_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
- 2, 6, // 0 = LOW_VAL
- -TWO_TOKEN, 4, // 1 = TWO
- -THREE_TOKEN, -FOUR_TOKEN, // 2 = THREE
- 8, 10, // 3 = HIGH_LOW
- -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 4 = CAT_ONE
- 12, 14, // 5 = CAT_THREEFOUR
- -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 6 = CAT_THREE
- -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 7 = CAT_FIVE
-};
-
-static const vp9_prob Pcat1[] = { 159};
-static const vp9_prob Pcat2[] = { 165, 145};
-static const vp9_prob Pcat3[] = { 173, 148, 140};
-static const vp9_prob Pcat4[] = { 176, 155, 140, 135};
-static const vp9_prob Pcat5[] = { 180, 157, 141, 134, 130};
-static const vp9_prob Pcat6[] = {
- 254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
-};
-
-static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28];
-
-static void init_bit_tree(vp9_tree_index *p, int n) {
- int i = 0;
-
- while (++i < n) {
- p[0] = p[1] = i << 1;
- p += 2;
- }
-
- p[0] = p[1] = 0;
-}
-
-static void init_bit_trees() {
- init_bit_tree(cat1, 1);
- init_bit_tree(cat2, 2);
- init_bit_tree(cat3, 3);
- init_bit_tree(cat4, 4);
- init_bit_tree(cat5, 5);
- init_bit_tree(cat6, 14);
-}
-
-const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS] = {
- {0, 0, 0, 0}, // ZERO_TOKEN
- {0, 0, 0, 1}, // ONE_TOKEN
- {0, 0, 0, 2}, // TWO_TOKEN
- {0, 0, 0, 3}, // THREE_TOKEN
- {0, 0, 0, 4}, // FOUR_TOKEN
- {cat1, Pcat1, 1, 5}, // CATEGORY1_TOKEN
- {cat2, Pcat2, 2, 7}, // CATEGORY2_TOKEN
- {cat3, Pcat3, 3, 11}, // CATEGORY3_TOKEN
- {cat4, Pcat4, 4, 19}, // CATEGORY4_TOKEN
- {cat5, Pcat5, 5, 35}, // CATEGORY5_TOKEN
- {cat6, Pcat6, 14, 67}, // CATEGORY6_TOKEN
- {0, 0, 0, 0} // EOB_TOKEN
-};
-
-struct vp9_token vp9_coef_encodings[ENTROPY_TOKENS];
-
-void vp9_coef_tree_initialize() {
- init_bit_trees();
- vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree);
-}
-
-void vp9_tokenize_initialize() {
- TOKENVALUE *const t = dct_value_tokens + DCT_MAX_VALUE;
- const vp9_extra_bit *const e = vp9_extra_bits;
-
- int i = -DCT_MAX_VALUE;
- int sign = 1;
-
- do {
- if (!i)
- sign = 0;
-
- {
- const int a = sign ? -i : i;
- int eb = sign;
-
- if (a > 4) {
- int j = 4;
-
- while (++j < 11 && e[j].base_val <= a) {}
-
- t[i].token = --j;
- eb |= (a - e[j].base_val) << 1;
- } else {
- t[i].token = a;
- }
- t[i].extra = eb;
- }
-
- // initialize the cost for extra bits for all possible coefficient value.
- {
- int cost = 0;
- const vp9_extra_bit *p = &vp9_extra_bits[t[i].token];
-
- if (p->base_val) {
- const int extra = t[i].extra;
- const int length = p->len;
-
- if (length)
- cost += treed_cost(p->tree, p->prob, extra >> 1, length);
-
- cost += vp9_cost_bit(vp9_prob_half, extra & 1); /* sign */
- dct_value_cost[i + DCT_MAX_VALUE] = cost;
- }
- }
- } while (++i < DCT_MAX_VALUE);
-
- vp9_dct_value_tokens_ptr = dct_value_tokens + DCT_MAX_VALUE;
- vp9_dct_value_cost_ptr = dct_value_cost + DCT_MAX_VALUE;
-}
-
-struct tokenize_b_args {
- VP9_COMP *cpi;
- MACROBLOCKD *xd;
- TOKENEXTRA **tp;
-};
-
-static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- struct tokenize_b_args* const args = arg;
- MACROBLOCKD *const xd = args->xd;
- struct macroblock_plane *p = &args->cpi->mb.plane[plane];
- struct macroblockd_plane *pd = &xd->plane[plane];
- int aoff, loff;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
- vp9_set_contexts(xd, pd, plane_bsize, tx_size, p->eobs[block] > 0,
- aoff, loff);
-}
-
-static INLINE void add_token(TOKENEXTRA **t, const vp9_prob *context_tree,
- int16_t extra, uint8_t token,
- uint8_t skip_eob_node,
- unsigned int *counts) {
- (*t)->token = token;
- (*t)->extra = extra;
- (*t)->context_tree = context_tree;
- (*t)->skip_eob_node = skip_eob_node;
- (*t)++;
- ++counts[token];
-}
-
-static INLINE void add_token_no_extra(TOKENEXTRA **t,
- const vp9_prob *context_tree,
- uint8_t token,
- uint8_t skip_eob_node,
- unsigned int *counts) {
- (*t)->token = token;
- (*t)->context_tree = context_tree;
- (*t)->skip_eob_node = skip_eob_node;
- (*t)++;
- ++counts[token];
-}
-
-static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
- TX_SIZE tx_size) {
- const int eob_max = 16 << (tx_size << 1);
- return vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
-}
-
-static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
- TX_SIZE tx_size, void *arg) {
- struct tokenize_b_args* const args = arg;
- VP9_COMP *cpi = args->cpi;
- MACROBLOCKD *xd = args->xd;
- TOKENEXTRA **tp = args->tp;
- uint8_t token_cache[32 * 32];
- struct macroblock_plane *p = &cpi->mb.plane[plane];
- struct macroblockd_plane *pd = &xd->plane[plane];
- MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
- int pt; /* near block/prev token context index */
- int c;
- TOKENEXTRA *t = *tp; /* store tokens starting here */
- int eob = p->eobs[block];
- const PLANE_TYPE type = pd->plane_type;
- const int16_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
- const int segment_id = mbmi->segment_id;
- const int16_t *scan, *nb;
- const scan_order *so;
- const int ref = is_inter_block(mbmi);
- unsigned int (*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
- cpi->coef_counts[tx_size][type][ref];
- vp9_prob (*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
- cpi->common.fc.coef_probs[tx_size][type][ref];
- unsigned int (*const eob_branch)[COEFF_CONTEXTS] =
- cpi->common.counts.eob_branch[tx_size][type][ref];
-
- const uint8_t *const band = get_band_translate(tx_size);
- const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size);
-
- int aoff, loff;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
-
- pt = get_entropy_context(tx_size, pd->above_context + aoff,
- pd->left_context + loff);
- so = get_scan(xd, tx_size, type, block);
- scan = so->scan;
- nb = so->neighbors;
- c = 0;
- while (c < eob) {
- int v = 0;
- int skip_eob = 0;
- v = qcoeff[scan[c]];
-
- while (!v) {
- add_token_no_extra(&t, coef_probs[band[c]][pt], ZERO_TOKEN, skip_eob,
- counts[band[c]][pt]);
- eob_branch[band[c]][pt] += !skip_eob;
-
- skip_eob = 1;
- token_cache[scan[c]] = 0;
- ++c;
- pt = get_coef_context(nb, token_cache, c);
- v = qcoeff[scan[c]];
- }
-
- add_token(&t, coef_probs[band[c]][pt],
- vp9_dct_value_tokens_ptr[v].extra,
- (uint8_t)vp9_dct_value_tokens_ptr[v].token,
- (uint8_t)skip_eob,
- counts[band[c]][pt]);
- eob_branch[band[c]][pt] += !skip_eob;
-
- token_cache[scan[c]] =
- vp9_pt_energy_class[vp9_dct_value_tokens_ptr[v].token];
- ++c;
- pt = get_coef_context(nb, token_cache, c);
- }
- if (c < seg_eob) {
- add_token_no_extra(&t, coef_probs[band[c]][pt], EOB_TOKEN, 0,
- counts[band[c]][pt]);
- ++eob_branch[band[c]][pt];
- }
-
- *tp = t;
-
- vp9_set_contexts(xd, pd, plane_bsize, tx_size, c > 0, aoff, loff);
-}
-
-struct is_skippable_args {
- MACROBLOCK *x;
- int *skippable;
-};
-
-static void is_skippable(int plane, int block,
- BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
- void *argv) {
- struct is_skippable_args *args = argv;
- args->skippable[0] &= (!args->x->plane[plane].eobs[block]);
-}
-
-int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
- int result = 1;
- struct is_skippable_args args = {x, &result};
- vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane, is_skippable,
- &args);
- return result;
-}
-
-void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
- BLOCK_SIZE bsize) {
- VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
- MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
- TOKENEXTRA *t_backup = *t;
- const int ctx = vp9_get_skip_context(xd);
- const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id,
- SEG_LVL_SKIP);
- struct tokenize_b_args arg = {cpi, xd, t};
- if (mbmi->skip) {
- if (!dry_run)
- cm->counts.skip[ctx][1] += skip_inc;
- reset_skip_context(xd, bsize);
- if (dry_run)
- *t = t_backup;
- return;
- }
-
- if (!dry_run) {
- cm->counts.skip[ctx][0] += skip_inc;
- vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg);
- } else {
- vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
- *t = t_backup;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.h
deleted file mode 100644
index 063c0ba..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_tokenize.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_TOKENIZE_H_
-#define VP9_ENCODER_VP9_TOKENIZE_H_
-
-#include "vp9/common/vp9_entropy.h"
-
-#include "vp9/encoder/vp9_block.h"
-#include "vp9/encoder/vp9_treewriter.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_tokenize_initialize();
-
-#define EOSB_TOKEN 127 // Not signalled, encoder only
-
-typedef struct {
- int16_t token;
- int16_t extra;
-} TOKENVALUE;
-
-typedef struct {
- const vp9_prob *context_tree;
- int16_t extra;
- uint8_t token;
- uint8_t skip_eob_node;
-} TOKENEXTRA;
-
-extern const vp9_tree_index vp9_coef_tree[];
-extern const vp9_tree_index vp9_coef_con_tree[];
-extern struct vp9_token vp9_coef_encodings[];
-
-int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
-
-struct VP9_COMP;
-
-void vp9_tokenize_sb(struct VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
- BLOCK_SIZE bsize);
-
-extern const int16_t *vp9_dct_value_cost_ptr;
-/* TODO: The Token field should be broken out into a separate char array to
- * improve cache locality, since it's needed for costing when the rest of the
- * fields are not.
- */
-extern const TOKENVALUE *vp9_dct_value_tokens_ptr;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_TOKENIZE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.c
deleted file mode 100644
index bb04b40..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/encoder/vp9_treewriter.h"
-
-static void tree2tok(struct vp9_token *tokens, const vp9_tree_index *tree,
- int i, int v, int l) {
- v += v;
- ++l;
-
- do {
- const vp9_tree_index j = tree[i++];
- if (j <= 0) {
- tokens[-j].value = v;
- tokens[-j].len = l;
- } else {
- tree2tok(tokens, tree, j, v, l);
- }
- } while (++v & 1);
-}
-
-void vp9_tokens_from_tree(struct vp9_token *tokens,
- const vp9_tree_index *tree) {
- tree2tok(tokens, tree, 0, 0, 0);
-}
-
-static unsigned int convert_distribution(unsigned int i, vp9_tree tree,
- unsigned int branch_ct[][2],
- const unsigned int num_events[]) {
- unsigned int left, right;
-
- if (tree[i] <= 0)
- left = num_events[-tree[i]];
- else
- left = convert_distribution(tree[i], tree, branch_ct, num_events);
-
- if (tree[i + 1] <= 0)
- right = num_events[-tree[i + 1]];
- else
- right = convert_distribution(tree[i + 1], tree, branch_ct, num_events);
-
- branch_ct[i >> 1][0] = left;
- branch_ct[i >> 1][1] = right;
- return left + right;
-}
-
-void vp9_tree_probs_from_distribution(vp9_tree tree,
- unsigned int branch_ct[/* n-1 */][2],
- const unsigned int num_events[/* n */]) {
- convert_distribution(0, tree, branch_ct, num_events);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.h
deleted file mode 100644
index 4a76d87..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_treewriter.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_TREEWRITER_H_
-#define VP9_ENCODER_VP9_TREEWRITER_H_
-
-#include "vp9/encoder/vp9_writer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_tree_probs_from_distribution(vp9_tree tree,
- unsigned int branch_ct[ /* n - 1 */ ][2],
- const unsigned int num_events[ /* n */ ]);
-
-struct vp9_token {
- int value;
- int len;
-};
-
-void vp9_tokens_from_tree(struct vp9_token*, const vp9_tree_index *);
-
-static INLINE void vp9_write_tree(vp9_writer *w, const vp9_tree_index *tree,
- const vp9_prob *probs, int bits, int len,
- vp9_tree_index i) {
- do {
- const int bit = (bits >> --len) & 1;
- vp9_write(w, bit, probs[i >> 1]);
- i = tree[i + bit];
- } while (len);
-}
-
-static INLINE void vp9_write_token(vp9_writer *w, const vp9_tree_index *tree,
- const vp9_prob *probs,
- const struct vp9_token *token) {
- vp9_write_tree(w, tree, probs, token->value, token->len, 0);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_TREEWRITER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.c
deleted file mode 100644
index 996f730..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.c
+++ /dev/null
@@ -1,1111 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vp9_rtcd.h"
-
-#include "vpx_ports/mem.h"
-#include "vpx/vpx_integer.h"
-
-#include "vp9/common/vp9_common.h"
-#include "vp9/common/vp9_filter.h"
-
-#include "vp9/encoder/vp9_variance.h"
-
-void variance(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- int w,
- int h,
- unsigned int *sse,
- int *sum) {
- int i, j;
- int diff;
-
- *sum = 0;
- *sse = 0;
-
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j++) {
- diff = src_ptr[j] - ref_ptr[j];
- *sum += diff;
- *sse += diff * diff;
- }
-
- src_ptr += source_stride;
- ref_ptr += recon_stride;
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_first_pass
- *
- * INPUTS : uint8_t *src_ptr : Pointer to source block.
- * uint32_t src_pixels_per_line : Stride of input block.
- * uint32_t pixel_step : Offset between filter input
- * samples (see notes).
- * uint32_t output_height : Input block height.
- * uint32_t output_width : Input block width.
- * int32_t *vp9_filter : Array of 2 bi-linear filter
- * taps.
- *
- * OUTPUTS : int32_t *output_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
- * either horizontal or vertical direction to produce the
- * filtered output block. Used to implement first-pass
- * of 2-D separable filter.
- *
- * SPECIAL NOTES : Produces int32_t output to retain precision for next pass.
- * Two filter taps should sum to VP9_FILTER_WEIGHT.
- * pixel_step defines whether the filter is applied
- * horizontally (pixel_step=1) or vertically (pixel_step=
- * stride).
- * It defines the offset required to move from one input
- * to the next.
- *
- ****************************************************************************/
-static void var_filter_block2d_bil_first_pass(const uint8_t *src_ptr,
- uint16_t *output_ptr,
- unsigned int src_pixels_per_line,
- int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const int16_t *vp9_filter) {
- unsigned int i, j;
-
- for (i = 0; i < output_height; i++) {
- for (j = 0; j < output_width; j++) {
- output_ptr[j] = ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] +
- (int)src_ptr[pixel_step] * vp9_filter[1],
- FILTER_BITS);
-
- src_ptr++;
- }
-
- // Next row...
- src_ptr += src_pixels_per_line - output_width;
- output_ptr += output_width;
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_second_pass
- *
- * INPUTS : int32_t *src_ptr : Pointer to source block.
- * uint32_t src_pixels_per_line : Stride of input block.
- * uint32_t pixel_step : Offset between filter input
- * samples (see notes).
- * uint32_t output_height : Input block height.
- * uint32_t output_width : Input block width.
- * int32_t *vp9_filter : Array of 2 bi-linear filter
- * taps.
- *
- * OUTPUTS : uint16_t *output_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
- * either horizontal or vertical direction to produce the
- * filtered output block. Used to implement second-pass
- * of 2-D separable filter.
- *
- * SPECIAL NOTES : Requires 32-bit input as produced by
- * filter_block2d_bil_first_pass.
- * Two filter taps should sum to VP9_FILTER_WEIGHT.
- * pixel_step defines whether the filter is applied
- * horizontally (pixel_step=1) or vertically (pixel_step=
- * stride).
- * It defines the offset required to move from one input
- * to the next.
- *
- ****************************************************************************/
-static void var_filter_block2d_bil_second_pass(const uint16_t *src_ptr,
- uint8_t *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const int16_t *vp9_filter) {
- unsigned int i, j;
-
- for (i = 0; i < output_height; i++) {
- for (j = 0; j < output_width; j++) {
- output_ptr[j] = ROUND_POWER_OF_TWO((int)src_ptr[0] * vp9_filter[0] +
- (int)src_ptr[pixel_step] * vp9_filter[1],
- FILTER_BITS);
- src_ptr++;
- }
-
- src_ptr += src_pixels_per_line - output_width;
- output_ptr += output_width;
- }
-}
-
-unsigned int vp9_get_mb_ss_c(const int16_t *src_ptr) {
- unsigned int i, sum = 0;
-
- for (i = 0; i < 256; i++) {
- sum += (src_ptr[i] * src_ptr[i]);
- }
-
- return sum;
-}
-
-unsigned int vp9_variance64x32_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 64, 32, &var, &avg);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 11));
-}
-
-unsigned int vp9_sub_pixel_variance64x32_c(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 fdata3[65 * 64]; // Temp data buffer used in filtering
- uint8_t temp2[68 * 64];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 33, 64, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 32, 64, vfilter);
-
- return vp9_variance64x32(temp2, 64, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance64x32_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering
- uint8_t temp2[68 * 64];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 64 * 64); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 33, 64, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 32, 64, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 64, 32, temp2, 64);
- return vp9_variance64x32(temp3, 64, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_variance32x64_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 64, &var, &avg);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 11));
-}
-
-unsigned int vp9_sub_pixel_variance32x64_c(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 fdata3[65 * 64]; // Temp data buffer used in filtering
- uint8_t temp2[68 * 64];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 65, 32, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 64, 32, vfilter);
-
- return vp9_variance32x64(temp2, 32, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance32x64_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering
- uint8_t temp2[68 * 64];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 64); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 65, 32, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 64, 32, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 32, 64, temp2, 32);
- return vp9_variance32x64(temp3, 32, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_variance32x16_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 16, &var, &avg);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 9));
-}
-
-unsigned int vp9_sub_pixel_variance32x16_c(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 fdata3[33 * 32]; // Temp data buffer used in filtering
- uint8_t temp2[36 * 32];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 17, 32, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 16, 32, vfilter);
-
- return vp9_variance32x16(temp2, 32, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance32x16_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering
- uint8_t temp2[36 * 32];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 16); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 17, 32, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 16, 32, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 32, 16, temp2, 32);
- return vp9_variance32x16(temp3, 32, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_variance16x32_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 32, &var, &avg);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 9));
-}
-
-unsigned int vp9_sub_pixel_variance16x32_c(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 fdata3[33 * 32]; // Temp data buffer used in filtering
- uint8_t temp2[36 * 32];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 33, 16, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 32, 16, vfilter);
-
- return vp9_variance16x32(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance16x32_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering
- uint8_t temp2[36 * 32];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 32); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 33, 16, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 32, 16, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 16, 32, temp2, 16);
- return vp9_variance16x32(temp3, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_variance64x64_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 64, 64, &var, &avg);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 12));
-}
-
-unsigned int vp9_variance32x32_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 32, 32, &var, &avg);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 10));
-}
-
-unsigned int vp9_variance16x16_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 8));
-}
-
-unsigned int vp9_variance8x16_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-}
-
-unsigned int vp9_variance16x8_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-}
-
-void vp9_get_sse_sum_8x8_c(const uint8_t *src_ptr, int source_stride,
- const uint8_t *ref_ptr, int ref_stride,
- unsigned int *sse, int *sum) {
- variance(src_ptr, source_stride, ref_ptr, ref_stride, 8, 8, sse, sum);
-}
-
-unsigned int vp9_variance8x8_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 6));
-}
-
-unsigned int vp9_variance8x4_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 4, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 5));
-}
-
-unsigned int vp9_variance4x8_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 8, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 5));
-}
-
-unsigned int vp9_variance4x4_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 4, 4, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 4));
-}
-
-
-unsigned int vp9_mse16x16_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16, &var, &avg);
- *sse = var;
- return var;
-}
-
-unsigned int vp9_mse16x8_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var, &avg);
- *sse = var;
- return var;
-}
-
-unsigned int vp9_mse8x16_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16, &var, &avg);
- *sse = var;
- return var;
-}
-
-unsigned int vp9_mse8x8_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8, &var, &avg);
- *sse = var;
- return var;
-}
-
-
-unsigned int vp9_sub_pixel_variance4x4_c(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) {
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
- uint16_t fdata3[5 * 4]; // Temp data buffer used in filtering
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- // First filter 1d Horizontal
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 5, 4, hfilter);
-
- // Now filter Verticaly
- var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 4, 4, vfilter);
-
- return vp9_variance4x4(temp2, 4, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance4x4_c(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,
- const uint8_t *second_pred) {
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 4 * 4); // compound pred buffer
- uint16_t fdata3[5 * 4]; // Temp data buffer used in filtering
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- // First filter 1d Horizontal
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 5, 4, hfilter);
-
- // Now filter Verticaly
- var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 4, 4, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 4, 4, temp2, 4);
- return vp9_variance4x4(temp3, 4, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_variance8x8_c(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 fdata3[9 * 8]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 9, 8, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 8, 8, vfilter);
-
- return vp9_variance8x8(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance8x8_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[9 * 8]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 8); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 9, 8, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 8, 8, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 8, 8, temp2, 8);
- return vp9_variance8x8(temp3, 8, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_variance16x16_c(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 fdata3[17 * 16]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 17, 16, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 16, 16, vfilter);
-
- return vp9_variance16x16(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance16x16_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[17 * 16];
- uint8_t temp2[20 * 16];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 16); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 17, 16, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 16, 16, vfilter);
-
- vp9_comp_avg_pred(temp3, second_pred, 16, 16, temp2, 16);
- return vp9_variance16x16(temp3, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_variance64x64_c(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 fdata3[65 * 64]; // Temp data buffer used in filtering
- uint8_t temp2[68 * 64];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 65, 64, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 64, 64, vfilter);
-
- return vp9_variance64x64(temp2, 64, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance64x64_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering
- uint8_t temp2[68 * 64];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 64 * 64); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 65, 64, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 64, 64, 64, 64, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 64, 64, temp2, 64);
- return vp9_variance64x64(temp3, 64, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_variance32x32_c(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 fdata3[33 * 32]; // Temp data buffer used in filtering
- uint8_t temp2[36 * 32];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 33, 32, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 32, 32, vfilter);
-
- return vp9_variance32x32(temp2, 32, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance32x32_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering
- uint8_t temp2[36 * 32];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 32); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 33, 32, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 32, 32, 32, 32, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 32, 32, temp2, 32);
- return vp9_variance32x32(temp3, 32, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_variance_halfpixvar16x16_h_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 0,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar32x32_h_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 8, 0,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar64x64_h_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance64x64_c(src_ptr, source_stride, 8, 0,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar16x16_v_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 0, 8,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar32x32_v_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 0, 8,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar64x64_v_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance64x64_c(src_ptr, source_stride, 0, 8,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar16x16_hv_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance16x16_c(src_ptr, source_stride, 8, 8,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar32x32_hv_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance32x32_c(src_ptr, source_stride, 8, 8,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_variance_halfpixvar64x64_hv_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- return vp9_sub_pixel_variance64x64_c(src_ptr, source_stride, 8, 8,
- ref_ptr, recon_stride, sse);
-}
-
-unsigned int vp9_sub_pixel_mse16x16_c(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) {
- vp9_sub_pixel_variance16x16_c(src_ptr, src_pixels_per_line,
- xoffset, yoffset, dst_ptr,
- dst_pixels_per_line, sse);
- return *sse;
-}
-
-unsigned int vp9_sub_pixel_mse32x32_c(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) {
- vp9_sub_pixel_variance32x32_c(src_ptr, src_pixels_per_line,
- xoffset, yoffset, dst_ptr,
- dst_pixels_per_line, sse);
- return *sse;
-}
-
-unsigned int vp9_sub_pixel_mse64x64_c(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) {
- vp9_sub_pixel_variance64x64_c(src_ptr, src_pixels_per_line,
- xoffset, yoffset, dst_ptr,
- dst_pixels_per_line, sse);
- return *sse;
-}
-
-unsigned int vp9_sub_pixel_variance16x8_c(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 fdata3[16 * 9]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 9, 16, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 8, 16, vfilter);
-
- return vp9_variance16x8(temp2, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance16x8_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[16 * 9]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 8); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 9, 16, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 16, 16, 8, 16, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 16, 8, temp2, 16);
- return vp9_variance16x8(temp3, 16, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_variance8x16_c(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 fdata3[9 * 16]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 17, 8, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 16, 8, vfilter);
-
- return vp9_variance8x16(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance8x16_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[9 * 16]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 16); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 17, 8, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 16, 8, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 8, 16, temp2, 8);
- return vp9_variance8x16(temp3, 8, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_variance8x4_c(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 fdata3[8 * 5]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 5, 8, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 4, 8, vfilter);
-
- return vp9_variance8x4(temp2, 8, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance8x4_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[8 * 5]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 4); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 5, 8, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 8, 8, 4, 8, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 8, 4, temp2, 8);
- return vp9_variance8x4(temp3, 8, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_variance4x8_c(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 fdata3[5 * 8]; // Temp data buffer used in filtering
- // FIXME(jingning,rbultje): this temp2 buffer probably doesn't need to be
- // of this big? same issue appears in all other block size settings.
- uint8_t temp2[20 * 16];
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 9, 4, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 8, 4, vfilter);
-
- return vp9_variance4x8(temp2, 4, dst_ptr, dst_pixels_per_line, sse);
-}
-
-unsigned int vp9_sub_pixel_avg_variance4x8_c(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,
- const uint8_t *second_pred) {
- uint16_t fdata3[5 * 8]; // Temp data buffer used in filtering
- uint8_t temp2[20 * 16];
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 4 * 8); // compound pred buffer
- const int16_t *hfilter, *vfilter;
-
- hfilter = BILINEAR_FILTERS_2TAP(xoffset);
- vfilter = BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, fdata3, src_pixels_per_line,
- 1, 9, 4, hfilter);
- var_filter_block2d_bil_second_pass(fdata3, temp2, 4, 4, 8, 4, vfilter);
- vp9_comp_avg_pred(temp3, second_pred, 4, 8, temp2, 4);
- return vp9_variance4x8(temp3, 4, dst_ptr, dst_pixels_per_line, sse);
-}
-
-
-void vp9_comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width,
- int height, const uint8_t *ref, int ref_stride) {
- int i, j;
-
- for (i = 0; i < height; i++) {
- for (j = 0; j < width; j++) {
- int tmp;
- tmp = pred[j] + ref[j];
- comp_pred[j] = (tmp + 1) >> 1;
- }
- comp_pred += width;
- pred += width;
- ref += ref_stride;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.h
deleted file mode 100644
index 62e20dc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_variance.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_VARIANCE_H_
-#define VP9_ENCODER_VP9_VARIANCE_H_
-
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void variance(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- int w,
- int h,
- unsigned int *sse,
- int *sum);
-
-typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int ref_stride,
- unsigned int max_sad);
-
-typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int ref_stride,
- const uint8_t *second_pred,
- unsigned int max_sad);
-
-typedef void (*vp9_sad_multi_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int ref_stride,
- unsigned int *sad_array);
-
-typedef void (*vp9_sad_multi1_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int ref_stride,
- unsigned int *sad_array);
-
-typedef void (*vp9_sad_multi_d_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t* const ref_ptr[],
- int ref_stride, unsigned int *sad_array);
-
-typedef unsigned int (*vp9_variance_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int ref_stride,
- unsigned int *sse);
-
-typedef unsigned int (*vp9_subpixvariance_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- int xoffset,
- int yoffset,
- const uint8_t *ref_ptr,
- int Refstride,
- unsigned int *sse);
-
-typedef unsigned int (*vp9_subp_avg_variance_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- int xoffset,
- int yoffset,
- const uint8_t *ref_ptr,
- int Refstride,
- unsigned int *sse,
- const uint8_t *second_pred);
-
-typedef unsigned int (*vp9_getmbss_fn_t)(const short *);
-
-typedef unsigned int (*vp9_get16x16prederror_fn_t)(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int ref_stride);
-
-typedef struct vp9_variance_vtable {
- vp9_sad_fn_t sdf;
- vp9_sad_avg_fn_t sdaf;
- vp9_variance_fn_t vf;
- vp9_subpixvariance_fn_t svf;
- vp9_subp_avg_variance_fn_t svaf;
- vp9_variance_fn_t svf_halfpix_h;
- vp9_variance_fn_t svf_halfpix_v;
- vp9_variance_fn_t svf_halfpix_hv;
- vp9_sad_multi_fn_t sdx3f;
- vp9_sad_multi1_fn_t sdx8f;
- vp9_sad_multi_d_fn_t sdx4df;
-} vp9_variance_fn_ptr_t;
-
-void vp9_comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width,
- int height, const uint8_t *ref, int ref_stride);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_VARIANCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.c
deleted file mode 100644
index 962d0ca..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "vp9/encoder/vp9_write_bit_buffer.h"
-
-size_t vp9_rb_bytes_written(struct vp9_write_bit_buffer *wb) {
- return wb->bit_offset / CHAR_BIT + (wb->bit_offset % CHAR_BIT > 0);
-}
-
-void vp9_wb_write_bit(struct vp9_write_bit_buffer *wb, int bit) {
- const int off = (int)wb->bit_offset;
- const int p = off / CHAR_BIT;
- const int q = CHAR_BIT - 1 - off % CHAR_BIT;
- if (q == CHAR_BIT -1) {
- wb->bit_buffer[p] = bit << q;
- } else {
- wb->bit_buffer[p] &= ~(1 << q);
- wb->bit_buffer[p] |= bit << q;
- }
- wb->bit_offset = off + 1;
-}
-
-void vp9_wb_write_literal(struct vp9_write_bit_buffer *wb, int data, int bits) {
- int bit;
- for (bit = bits - 1; bit >= 0; bit--)
- vp9_wb_write_bit(wb, (data >> bit) & 1);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.h
deleted file mode 100644
index 073608d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_write_bit_buffer.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_WRITE_BIT_BUFFER_H_
-#define VP9_ENCODER_VP9_WRITE_BIT_BUFFER_H_
-
-#include <limits.h>
-
-#include "vpx/vpx_integer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct vp9_write_bit_buffer {
- uint8_t *bit_buffer;
- size_t bit_offset;
-};
-
-size_t vp9_rb_bytes_written(struct vp9_write_bit_buffer *wb);
-
-void vp9_wb_write_bit(struct vp9_write_bit_buffer *wb, int bit);
-
-void vp9_wb_write_literal(struct vp9_write_bit_buffer *wb, int data, int bits);
-
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_WRITE_BIT_BUFFER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.c
deleted file mode 100644
index 8398fc0..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include "vp9/encoder/vp9_writer.h"
-#include "vp9/common/vp9_entropy.h"
-
-void vp9_start_encode(vp9_writer *br, uint8_t *source) {
- br->lowvalue = 0;
- br->range = 255;
- br->value = 0;
- br->count = -24;
- br->buffer = source;
- br->pos = 0;
- vp9_write_bit(br, 0);
-}
-
-void vp9_stop_encode(vp9_writer *br) {
- int i;
-
- for (i = 0; i < 32; i++)
- vp9_write_bit(br, 0);
-
- // 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/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.h
deleted file mode 100644
index 7f4fa1e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/vp9_writer.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_ENCODER_VP9_WRITER_H_
-#define VP9_ENCODER_VP9_WRITER_H_
-
-#include "vpx_ports/mem.h"
-
-#include "vp9/common/vp9_prob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- unsigned int lowvalue;
- unsigned int range;
- unsigned int value;
- int count;
- unsigned int pos;
- uint8_t *buffer;
-
- // Variables used to track bit costs without outputing to the bitstream
- unsigned int measure_cost;
- uint64_t bit_counter;
-} vp9_writer;
-
-void vp9_start_encode(vp9_writer *bc, uint8_t *buffer);
-void vp9_stop_encode(vp9_writer *bc);
-
-static void vp9_write(vp9_writer *br, int bit, int probability) {
- unsigned int split;
- int count = br->count;
- unsigned int range = br->range;
- unsigned int lowvalue = br->lowvalue;
- register unsigned int shift;
-
- split = 1 + (((range - 1) * probability) >> 8);
-
- range = split;
-
- if (bit) {
- lowvalue += split;
- range = br->range - split;
- }
-
- shift = vp9_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;
-}
-
-static void vp9_write_bit(vp9_writer *w, int bit) {
- vp9_write(w, bit, 128); // vp9_prob_half
-}
-
-static void vp9_write_literal(vp9_writer *w, int data, int bits) {
- int bit;
-
- for (bit = bits - 1; bit >= 0; bit--)
- vp9_write_bit(w, 1 & (data >> bit));
-}
-
-#define vp9_write_prob(w, v) vp9_write_literal((w), (v), 8)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_VP9_WRITER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_avx2.c
deleted file mode 100644
index 9ea22fe..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_avx2.c
+++ /dev/null
@@ -1,2710 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <immintrin.h> // AVX2
-#include "vp9/common/vp9_idct.h" // for cospi constants
-#include "vpx_ports/mem.h"
-
-#define pair256_set_epi16(a, b) \
- _mm256_set_epi16(b, a, b, a, b, a, b, a, b, a, b, a, b, a, b, a)
-
-#define pair256_set_epi32(a, b) \
- _mm256_set_epi32(b, a, b, a, b, a, b, a)
-
-
-
-
-#if FDCT32x32_HIGH_PRECISION
-static INLINE __m256i k_madd_epi32_avx2(__m256i a, __m256i b) {
- __m256i buf0, buf1;
- buf0 = _mm256_mul_epu32(a, b);
- a = _mm256_srli_epi64(a, 32);
- b = _mm256_srli_epi64(b, 32);
- buf1 = _mm256_mul_epu32(a, b);
- return _mm256_add_epi64(buf0, buf1);
-}
-
-static INLINE __m256i k_packs_epi64_avx2(__m256i a, __m256i b) {
- __m256i buf0 = _mm256_shuffle_epi32(a, _MM_SHUFFLE(0, 0, 2, 0));
- __m256i buf1 = _mm256_shuffle_epi32(b, _MM_SHUFFLE(0, 0, 2, 0));
- return _mm256_unpacklo_epi64(buf0, buf1);
-}
-#endif
-
-void FDCT32x32_2D_AVX2(const int16_t *input,
- int16_t *output_org, int stride) {
- // Calculate pre-multiplied strides
- const int str1 = stride;
- const int str2 = 2 * stride;
- const int str3 = 2 * stride + str1;
- // We need an intermediate buffer between passes.
- DECLARE_ALIGNED(32, int16_t, intermediate[32 * 32]);
- // Constants
- // When we use them, in one case, they are all the same. In all others
- // it's a pair of them that we need to repeat four times. This is done
- // by constructing the 32 bit constant corresponding to that pair.
- const __m256i k__cospi_p16_p16 = _mm256_set1_epi16(+cospi_16_64);
- const __m256i k__cospi_p16_m16 = pair256_set_epi16(+cospi_16_64, -cospi_16_64);
- const __m256i k__cospi_m08_p24 = pair256_set_epi16(-cospi_8_64, cospi_24_64);
- const __m256i k__cospi_m24_m08 = pair256_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m256i k__cospi_p24_p08 = pair256_set_epi16(+cospi_24_64, cospi_8_64);
- const __m256i k__cospi_p12_p20 = pair256_set_epi16(+cospi_12_64, cospi_20_64);
- const __m256i k__cospi_m20_p12 = pair256_set_epi16(-cospi_20_64, cospi_12_64);
- const __m256i k__cospi_m04_p28 = pair256_set_epi16(-cospi_4_64, cospi_28_64);
- const __m256i k__cospi_p28_p04 = pair256_set_epi16(+cospi_28_64, cospi_4_64);
- const __m256i k__cospi_m28_m04 = pair256_set_epi16(-cospi_28_64, -cospi_4_64);
- const __m256i k__cospi_m12_m20 = pair256_set_epi16(-cospi_12_64, -cospi_20_64);
- const __m256i k__cospi_p30_p02 = pair256_set_epi16(+cospi_30_64, cospi_2_64);
- const __m256i k__cospi_p14_p18 = pair256_set_epi16(+cospi_14_64, cospi_18_64);
- const __m256i k__cospi_p22_p10 = pair256_set_epi16(+cospi_22_64, cospi_10_64);
- const __m256i k__cospi_p06_p26 = pair256_set_epi16(+cospi_6_64, cospi_26_64);
- const __m256i k__cospi_m26_p06 = pair256_set_epi16(-cospi_26_64, cospi_6_64);
- const __m256i k__cospi_m10_p22 = pair256_set_epi16(-cospi_10_64, cospi_22_64);
- const __m256i k__cospi_m18_p14 = pair256_set_epi16(-cospi_18_64, cospi_14_64);
- const __m256i k__cospi_m02_p30 = pair256_set_epi16(-cospi_2_64, cospi_30_64);
- const __m256i k__cospi_p31_p01 = pair256_set_epi16(+cospi_31_64, cospi_1_64);
- const __m256i k__cospi_p15_p17 = pair256_set_epi16(+cospi_15_64, cospi_17_64);
- const __m256i k__cospi_p23_p09 = pair256_set_epi16(+cospi_23_64, cospi_9_64);
- const __m256i k__cospi_p07_p25 = pair256_set_epi16(+cospi_7_64, cospi_25_64);
- const __m256i k__cospi_m25_p07 = pair256_set_epi16(-cospi_25_64, cospi_7_64);
- const __m256i k__cospi_m09_p23 = pair256_set_epi16(-cospi_9_64, cospi_23_64);
- const __m256i k__cospi_m17_p15 = pair256_set_epi16(-cospi_17_64, cospi_15_64);
- const __m256i k__cospi_m01_p31 = pair256_set_epi16(-cospi_1_64, cospi_31_64);
- const __m256i k__cospi_p27_p05 = pair256_set_epi16(+cospi_27_64, cospi_5_64);
- const __m256i k__cospi_p11_p21 = pair256_set_epi16(+cospi_11_64, cospi_21_64);
- const __m256i k__cospi_p19_p13 = pair256_set_epi16(+cospi_19_64, cospi_13_64);
- const __m256i k__cospi_p03_p29 = pair256_set_epi16(+cospi_3_64, cospi_29_64);
- const __m256i k__cospi_m29_p03 = pair256_set_epi16(-cospi_29_64, cospi_3_64);
- const __m256i k__cospi_m13_p19 = pair256_set_epi16(-cospi_13_64, cospi_19_64);
- const __m256i k__cospi_m21_p11 = pair256_set_epi16(-cospi_21_64, cospi_11_64);
- const __m256i k__cospi_m05_p27 = pair256_set_epi16(-cospi_5_64, cospi_27_64);
- const __m256i k__DCT_CONST_ROUNDING = _mm256_set1_epi32(DCT_CONST_ROUNDING);
- const __m256i kZero = _mm256_set1_epi16(0);
- const __m256i kOne = _mm256_set1_epi16(1);
- // Do the two transform/transpose passes
- int pass;
- for (pass = 0; pass < 2; ++pass) {
- // We process sixteen columns (transposed rows in second pass) at a time.
- int column_start;
- for (column_start = 0; column_start < 32; column_start += 16) {
- __m256i step1[32];
- __m256i step2[32];
- __m256i step3[32];
- __m256i out[32];
- // Stage 1
- // Note: even though all the loads below are aligned, using the aligned
- // intrinsic make the code slightly slower.
- if (0 == pass) {
- const int16_t *in = &input[column_start];
- // step1[i] = (in[ 0 * stride] + in[(32 - 1) * stride]) << 2;
- // Note: the next four blocks could be in a loop. That would help the
- // instruction cache but is actually slower.
- {
- const int16_t *ina = in + 0 * str1;
- const int16_t *inb = in + 31 * str1;
- __m256i *step1a = &step1[ 0];
- __m256i *step1b = &step1[31];
- const __m256i ina0 = _mm256_loadu_si256((const __m256i *)(ina));
- const __m256i ina1 = _mm256_loadu_si256((const __m256i *)(ina + str1));
- const __m256i ina2 = _mm256_loadu_si256((const __m256i *)(ina + str2));
- const __m256i ina3 = _mm256_loadu_si256((const __m256i *)(ina + str3));
- const __m256i inb3 = _mm256_loadu_si256((const __m256i *)(inb - str3));
- const __m256i inb2 = _mm256_loadu_si256((const __m256i *)(inb - str2));
- const __m256i inb1 = _mm256_loadu_si256((const __m256i *)(inb - str1));
- const __m256i inb0 = _mm256_loadu_si256((const __m256i *)(inb));
- step1a[ 0] = _mm256_add_epi16(ina0, inb0);
- step1a[ 1] = _mm256_add_epi16(ina1, inb1);
- step1a[ 2] = _mm256_add_epi16(ina2, inb2);
- step1a[ 3] = _mm256_add_epi16(ina3, inb3);
- step1b[-3] = _mm256_sub_epi16(ina3, inb3);
- step1b[-2] = _mm256_sub_epi16(ina2, inb2);
- step1b[-1] = _mm256_sub_epi16(ina1, inb1);
- step1b[-0] = _mm256_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm256_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm256_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm256_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm256_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm256_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm256_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm256_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm256_slli_epi16(step1b[-0], 2);
- }
- {
- const int16_t *ina = in + 4 * str1;
- const int16_t *inb = in + 27 * str1;
- __m256i *step1a = &step1[ 4];
- __m256i *step1b = &step1[27];
- const __m256i ina0 = _mm256_loadu_si256((const __m256i *)(ina));
- const __m256i ina1 = _mm256_loadu_si256((const __m256i *)(ina + str1));
- const __m256i ina2 = _mm256_loadu_si256((const __m256i *)(ina + str2));
- const __m256i ina3 = _mm256_loadu_si256((const __m256i *)(ina + str3));
- const __m256i inb3 = _mm256_loadu_si256((const __m256i *)(inb - str3));
- const __m256i inb2 = _mm256_loadu_si256((const __m256i *)(inb - str2));
- const __m256i inb1 = _mm256_loadu_si256((const __m256i *)(inb - str1));
- const __m256i inb0 = _mm256_loadu_si256((const __m256i *)(inb));
- step1a[ 0] = _mm256_add_epi16(ina0, inb0);
- step1a[ 1] = _mm256_add_epi16(ina1, inb1);
- step1a[ 2] = _mm256_add_epi16(ina2, inb2);
- step1a[ 3] = _mm256_add_epi16(ina3, inb3);
- step1b[-3] = _mm256_sub_epi16(ina3, inb3);
- step1b[-2] = _mm256_sub_epi16(ina2, inb2);
- step1b[-1] = _mm256_sub_epi16(ina1, inb1);
- step1b[-0] = _mm256_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm256_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm256_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm256_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm256_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm256_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm256_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm256_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm256_slli_epi16(step1b[-0], 2);
- }
- {
- const int16_t *ina = in + 8 * str1;
- const int16_t *inb = in + 23 * str1;
- __m256i *step1a = &step1[ 8];
- __m256i *step1b = &step1[23];
- const __m256i ina0 = _mm256_loadu_si256((const __m256i *)(ina));
- const __m256i ina1 = _mm256_loadu_si256((const __m256i *)(ina + str1));
- const __m256i ina2 = _mm256_loadu_si256((const __m256i *)(ina + str2));
- const __m256i ina3 = _mm256_loadu_si256((const __m256i *)(ina + str3));
- const __m256i inb3 = _mm256_loadu_si256((const __m256i *)(inb - str3));
- const __m256i inb2 = _mm256_loadu_si256((const __m256i *)(inb - str2));
- const __m256i inb1 = _mm256_loadu_si256((const __m256i *)(inb - str1));
- const __m256i inb0 = _mm256_loadu_si256((const __m256i *)(inb));
- step1a[ 0] = _mm256_add_epi16(ina0, inb0);
- step1a[ 1] = _mm256_add_epi16(ina1, inb1);
- step1a[ 2] = _mm256_add_epi16(ina2, inb2);
- step1a[ 3] = _mm256_add_epi16(ina3, inb3);
- step1b[-3] = _mm256_sub_epi16(ina3, inb3);
- step1b[-2] = _mm256_sub_epi16(ina2, inb2);
- step1b[-1] = _mm256_sub_epi16(ina1, inb1);
- step1b[-0] = _mm256_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm256_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm256_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm256_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm256_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm256_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm256_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm256_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm256_slli_epi16(step1b[-0], 2);
- }
- {
- const int16_t *ina = in + 12 * str1;
- const int16_t *inb = in + 19 * str1;
- __m256i *step1a = &step1[12];
- __m256i *step1b = &step1[19];
- const __m256i ina0 = _mm256_loadu_si256((const __m256i *)(ina));
- const __m256i ina1 = _mm256_loadu_si256((const __m256i *)(ina + str1));
- const __m256i ina2 = _mm256_loadu_si256((const __m256i *)(ina + str2));
- const __m256i ina3 = _mm256_loadu_si256((const __m256i *)(ina + str3));
- const __m256i inb3 = _mm256_loadu_si256((const __m256i *)(inb - str3));
- const __m256i inb2 = _mm256_loadu_si256((const __m256i *)(inb - str2));
- const __m256i inb1 = _mm256_loadu_si256((const __m256i *)(inb - str1));
- const __m256i inb0 = _mm256_loadu_si256((const __m256i *)(inb));
- step1a[ 0] = _mm256_add_epi16(ina0, inb0);
- step1a[ 1] = _mm256_add_epi16(ina1, inb1);
- step1a[ 2] = _mm256_add_epi16(ina2, inb2);
- step1a[ 3] = _mm256_add_epi16(ina3, inb3);
- step1b[-3] = _mm256_sub_epi16(ina3, inb3);
- step1b[-2] = _mm256_sub_epi16(ina2, inb2);
- step1b[-1] = _mm256_sub_epi16(ina1, inb1);
- step1b[-0] = _mm256_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm256_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm256_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm256_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm256_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm256_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm256_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm256_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm256_slli_epi16(step1b[-0], 2);
- }
- } else {
- int16_t *in = &intermediate[column_start];
- // step1[i] = in[ 0 * 32] + in[(32 - 1) * 32];
- // Note: using the same approach as above to have common offset is
- // counter-productive as all offsets can be calculated at compile
- // time.
- // Note: the next four blocks could be in a loop. That would help the
- // instruction cache but is actually slower.
- {
- __m256i in00 = _mm256_loadu_si256((const __m256i *)(in + 0 * 32));
- __m256i in01 = _mm256_loadu_si256((const __m256i *)(in + 1 * 32));
- __m256i in02 = _mm256_loadu_si256((const __m256i *)(in + 2 * 32));
- __m256i in03 = _mm256_loadu_si256((const __m256i *)(in + 3 * 32));
- __m256i in28 = _mm256_loadu_si256((const __m256i *)(in + 28 * 32));
- __m256i in29 = _mm256_loadu_si256((const __m256i *)(in + 29 * 32));
- __m256i in30 = _mm256_loadu_si256((const __m256i *)(in + 30 * 32));
- __m256i in31 = _mm256_loadu_si256((const __m256i *)(in + 31 * 32));
- step1[ 0] = _mm256_add_epi16(in00, in31);
- step1[ 1] = _mm256_add_epi16(in01, in30);
- step1[ 2] = _mm256_add_epi16(in02, in29);
- step1[ 3] = _mm256_add_epi16(in03, in28);
- step1[28] = _mm256_sub_epi16(in03, in28);
- step1[29] = _mm256_sub_epi16(in02, in29);
- step1[30] = _mm256_sub_epi16(in01, in30);
- step1[31] = _mm256_sub_epi16(in00, in31);
- }
- {
- __m256i in04 = _mm256_loadu_si256((const __m256i *)(in + 4 * 32));
- __m256i in05 = _mm256_loadu_si256((const __m256i *)(in + 5 * 32));
- __m256i in06 = _mm256_loadu_si256((const __m256i *)(in + 6 * 32));
- __m256i in07 = _mm256_loadu_si256((const __m256i *)(in + 7 * 32));
- __m256i in24 = _mm256_loadu_si256((const __m256i *)(in + 24 * 32));
- __m256i in25 = _mm256_loadu_si256((const __m256i *)(in + 25 * 32));
- __m256i in26 = _mm256_loadu_si256((const __m256i *)(in + 26 * 32));
- __m256i in27 = _mm256_loadu_si256((const __m256i *)(in + 27 * 32));
- step1[ 4] = _mm256_add_epi16(in04, in27);
- step1[ 5] = _mm256_add_epi16(in05, in26);
- step1[ 6] = _mm256_add_epi16(in06, in25);
- step1[ 7] = _mm256_add_epi16(in07, in24);
- step1[24] = _mm256_sub_epi16(in07, in24);
- step1[25] = _mm256_sub_epi16(in06, in25);
- step1[26] = _mm256_sub_epi16(in05, in26);
- step1[27] = _mm256_sub_epi16(in04, in27);
- }
- {
- __m256i in08 = _mm256_loadu_si256((const __m256i *)(in + 8 * 32));
- __m256i in09 = _mm256_loadu_si256((const __m256i *)(in + 9 * 32));
- __m256i in10 = _mm256_loadu_si256((const __m256i *)(in + 10 * 32));
- __m256i in11 = _mm256_loadu_si256((const __m256i *)(in + 11 * 32));
- __m256i in20 = _mm256_loadu_si256((const __m256i *)(in + 20 * 32));
- __m256i in21 = _mm256_loadu_si256((const __m256i *)(in + 21 * 32));
- __m256i in22 = _mm256_loadu_si256((const __m256i *)(in + 22 * 32));
- __m256i in23 = _mm256_loadu_si256((const __m256i *)(in + 23 * 32));
- step1[ 8] = _mm256_add_epi16(in08, in23);
- step1[ 9] = _mm256_add_epi16(in09, in22);
- step1[10] = _mm256_add_epi16(in10, in21);
- step1[11] = _mm256_add_epi16(in11, in20);
- step1[20] = _mm256_sub_epi16(in11, in20);
- step1[21] = _mm256_sub_epi16(in10, in21);
- step1[22] = _mm256_sub_epi16(in09, in22);
- step1[23] = _mm256_sub_epi16(in08, in23);
- }
- {
- __m256i in12 = _mm256_loadu_si256((const __m256i *)(in + 12 * 32));
- __m256i in13 = _mm256_loadu_si256((const __m256i *)(in + 13 * 32));
- __m256i in14 = _mm256_loadu_si256((const __m256i *)(in + 14 * 32));
- __m256i in15 = _mm256_loadu_si256((const __m256i *)(in + 15 * 32));
- __m256i in16 = _mm256_loadu_si256((const __m256i *)(in + 16 * 32));
- __m256i in17 = _mm256_loadu_si256((const __m256i *)(in + 17 * 32));
- __m256i in18 = _mm256_loadu_si256((const __m256i *)(in + 18 * 32));
- __m256i in19 = _mm256_loadu_si256((const __m256i *)(in + 19 * 32));
- step1[12] = _mm256_add_epi16(in12, in19);
- step1[13] = _mm256_add_epi16(in13, in18);
- step1[14] = _mm256_add_epi16(in14, in17);
- step1[15] = _mm256_add_epi16(in15, in16);
- step1[16] = _mm256_sub_epi16(in15, in16);
- step1[17] = _mm256_sub_epi16(in14, in17);
- step1[18] = _mm256_sub_epi16(in13, in18);
- step1[19] = _mm256_sub_epi16(in12, in19);
- }
- }
- // Stage 2
- {
- step2[ 0] = _mm256_add_epi16(step1[0], step1[15]);
- step2[ 1] = _mm256_add_epi16(step1[1], step1[14]);
- step2[ 2] = _mm256_add_epi16(step1[2], step1[13]);
- step2[ 3] = _mm256_add_epi16(step1[3], step1[12]);
- step2[ 4] = _mm256_add_epi16(step1[4], step1[11]);
- step2[ 5] = _mm256_add_epi16(step1[5], step1[10]);
- step2[ 6] = _mm256_add_epi16(step1[6], step1[ 9]);
- step2[ 7] = _mm256_add_epi16(step1[7], step1[ 8]);
- step2[ 8] = _mm256_sub_epi16(step1[7], step1[ 8]);
- step2[ 9] = _mm256_sub_epi16(step1[6], step1[ 9]);
- step2[10] = _mm256_sub_epi16(step1[5], step1[10]);
- step2[11] = _mm256_sub_epi16(step1[4], step1[11]);
- step2[12] = _mm256_sub_epi16(step1[3], step1[12]);
- step2[13] = _mm256_sub_epi16(step1[2], step1[13]);
- step2[14] = _mm256_sub_epi16(step1[1], step1[14]);
- step2[15] = _mm256_sub_epi16(step1[0], step1[15]);
- }
- {
- const __m256i s2_20_0 = _mm256_unpacklo_epi16(step1[27], step1[20]);
- const __m256i s2_20_1 = _mm256_unpackhi_epi16(step1[27], step1[20]);
- const __m256i s2_21_0 = _mm256_unpacklo_epi16(step1[26], step1[21]);
- const __m256i s2_21_1 = _mm256_unpackhi_epi16(step1[26], step1[21]);
- const __m256i s2_22_0 = _mm256_unpacklo_epi16(step1[25], step1[22]);
- const __m256i s2_22_1 = _mm256_unpackhi_epi16(step1[25], step1[22]);
- const __m256i s2_23_0 = _mm256_unpacklo_epi16(step1[24], step1[23]);
- const __m256i s2_23_1 = _mm256_unpackhi_epi16(step1[24], step1[23]);
- const __m256i s2_20_2 = _mm256_madd_epi16(s2_20_0, k__cospi_p16_m16);
- const __m256i s2_20_3 = _mm256_madd_epi16(s2_20_1, k__cospi_p16_m16);
- const __m256i s2_21_2 = _mm256_madd_epi16(s2_21_0, k__cospi_p16_m16);
- const __m256i s2_21_3 = _mm256_madd_epi16(s2_21_1, k__cospi_p16_m16);
- const __m256i s2_22_2 = _mm256_madd_epi16(s2_22_0, k__cospi_p16_m16);
- const __m256i s2_22_3 = _mm256_madd_epi16(s2_22_1, k__cospi_p16_m16);
- const __m256i s2_23_2 = _mm256_madd_epi16(s2_23_0, k__cospi_p16_m16);
- const __m256i s2_23_3 = _mm256_madd_epi16(s2_23_1, k__cospi_p16_m16);
- const __m256i s2_24_2 = _mm256_madd_epi16(s2_23_0, k__cospi_p16_p16);
- const __m256i s2_24_3 = _mm256_madd_epi16(s2_23_1, k__cospi_p16_p16);
- const __m256i s2_25_2 = _mm256_madd_epi16(s2_22_0, k__cospi_p16_p16);
- const __m256i s2_25_3 = _mm256_madd_epi16(s2_22_1, k__cospi_p16_p16);
- const __m256i s2_26_2 = _mm256_madd_epi16(s2_21_0, k__cospi_p16_p16);
- const __m256i s2_26_3 = _mm256_madd_epi16(s2_21_1, k__cospi_p16_p16);
- const __m256i s2_27_2 = _mm256_madd_epi16(s2_20_0, k__cospi_p16_p16);
- const __m256i s2_27_3 = _mm256_madd_epi16(s2_20_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m256i s2_20_4 = _mm256_add_epi32(s2_20_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_20_5 = _mm256_add_epi32(s2_20_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_21_4 = _mm256_add_epi32(s2_21_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_21_5 = _mm256_add_epi32(s2_21_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_22_4 = _mm256_add_epi32(s2_22_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_22_5 = _mm256_add_epi32(s2_22_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_23_4 = _mm256_add_epi32(s2_23_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_23_5 = _mm256_add_epi32(s2_23_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_24_4 = _mm256_add_epi32(s2_24_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_24_5 = _mm256_add_epi32(s2_24_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_25_4 = _mm256_add_epi32(s2_25_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_25_5 = _mm256_add_epi32(s2_25_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_26_4 = _mm256_add_epi32(s2_26_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_26_5 = _mm256_add_epi32(s2_26_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_27_4 = _mm256_add_epi32(s2_27_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_27_5 = _mm256_add_epi32(s2_27_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_20_6 = _mm256_srai_epi32(s2_20_4, DCT_CONST_BITS);
- const __m256i s2_20_7 = _mm256_srai_epi32(s2_20_5, DCT_CONST_BITS);
- const __m256i s2_21_6 = _mm256_srai_epi32(s2_21_4, DCT_CONST_BITS);
- const __m256i s2_21_7 = _mm256_srai_epi32(s2_21_5, DCT_CONST_BITS);
- const __m256i s2_22_6 = _mm256_srai_epi32(s2_22_4, DCT_CONST_BITS);
- const __m256i s2_22_7 = _mm256_srai_epi32(s2_22_5, DCT_CONST_BITS);
- const __m256i s2_23_6 = _mm256_srai_epi32(s2_23_4, DCT_CONST_BITS);
- const __m256i s2_23_7 = _mm256_srai_epi32(s2_23_5, DCT_CONST_BITS);
- const __m256i s2_24_6 = _mm256_srai_epi32(s2_24_4, DCT_CONST_BITS);
- const __m256i s2_24_7 = _mm256_srai_epi32(s2_24_5, DCT_CONST_BITS);
- const __m256i s2_25_6 = _mm256_srai_epi32(s2_25_4, DCT_CONST_BITS);
- const __m256i s2_25_7 = _mm256_srai_epi32(s2_25_5, DCT_CONST_BITS);
- const __m256i s2_26_6 = _mm256_srai_epi32(s2_26_4, DCT_CONST_BITS);
- const __m256i s2_26_7 = _mm256_srai_epi32(s2_26_5, DCT_CONST_BITS);
- const __m256i s2_27_6 = _mm256_srai_epi32(s2_27_4, DCT_CONST_BITS);
- const __m256i s2_27_7 = _mm256_srai_epi32(s2_27_5, DCT_CONST_BITS);
- // Combine
- step2[20] = _mm256_packs_epi32(s2_20_6, s2_20_7);
- step2[21] = _mm256_packs_epi32(s2_21_6, s2_21_7);
- step2[22] = _mm256_packs_epi32(s2_22_6, s2_22_7);
- step2[23] = _mm256_packs_epi32(s2_23_6, s2_23_7);
- step2[24] = _mm256_packs_epi32(s2_24_6, s2_24_7);
- step2[25] = _mm256_packs_epi32(s2_25_6, s2_25_7);
- step2[26] = _mm256_packs_epi32(s2_26_6, s2_26_7);
- step2[27] = _mm256_packs_epi32(s2_27_6, s2_27_7);
- }
-
-#if !FDCT32x32_HIGH_PRECISION
- // dump the magnitude by half, hence the intermediate values are within
- // the range of 16 bits.
- if (1 == pass) {
- __m256i s3_00_0 = _mm256_cmpgt_epi16(kZero,step2[ 0]);
- __m256i s3_01_0 = _mm256_cmpgt_epi16(kZero,step2[ 1]);
- __m256i s3_02_0 = _mm256_cmpgt_epi16(kZero,step2[ 2]);
- __m256i s3_03_0 = _mm256_cmpgt_epi16(kZero,step2[ 3]);
- __m256i s3_04_0 = _mm256_cmpgt_epi16(kZero,step2[ 4]);
- __m256i s3_05_0 = _mm256_cmpgt_epi16(kZero,step2[ 5]);
- __m256i s3_06_0 = _mm256_cmpgt_epi16(kZero,step2[ 6]);
- __m256i s3_07_0 = _mm256_cmpgt_epi16(kZero,step2[ 7]);
- __m256i s2_08_0 = _mm256_cmpgt_epi16(kZero,step2[ 8]);
- __m256i s2_09_0 = _mm256_cmpgt_epi16(kZero,step2[ 9]);
- __m256i s3_10_0 = _mm256_cmpgt_epi16(kZero,step2[10]);
- __m256i s3_11_0 = _mm256_cmpgt_epi16(kZero,step2[11]);
- __m256i s3_12_0 = _mm256_cmpgt_epi16(kZero,step2[12]);
- __m256i s3_13_0 = _mm256_cmpgt_epi16(kZero,step2[13]);
- __m256i s2_14_0 = _mm256_cmpgt_epi16(kZero,step2[14]);
- __m256i s2_15_0 = _mm256_cmpgt_epi16(kZero,step2[15]);
- __m256i s3_16_0 = _mm256_cmpgt_epi16(kZero,step1[16]);
- __m256i s3_17_0 = _mm256_cmpgt_epi16(kZero,step1[17]);
- __m256i s3_18_0 = _mm256_cmpgt_epi16(kZero,step1[18]);
- __m256i s3_19_0 = _mm256_cmpgt_epi16(kZero,step1[19]);
- __m256i s3_20_0 = _mm256_cmpgt_epi16(kZero,step2[20]);
- __m256i s3_21_0 = _mm256_cmpgt_epi16(kZero,step2[21]);
- __m256i s3_22_0 = _mm256_cmpgt_epi16(kZero,step2[22]);
- __m256i s3_23_0 = _mm256_cmpgt_epi16(kZero,step2[23]);
- __m256i s3_24_0 = _mm256_cmpgt_epi16(kZero,step2[24]);
- __m256i s3_25_0 = _mm256_cmpgt_epi16(kZero,step2[25]);
- __m256i s3_26_0 = _mm256_cmpgt_epi16(kZero,step2[26]);
- __m256i s3_27_0 = _mm256_cmpgt_epi16(kZero,step2[27]);
- __m256i s3_28_0 = _mm256_cmpgt_epi16(kZero,step1[28]);
- __m256i s3_29_0 = _mm256_cmpgt_epi16(kZero,step1[29]);
- __m256i s3_30_0 = _mm256_cmpgt_epi16(kZero,step1[30]);
- __m256i s3_31_0 = _mm256_cmpgt_epi16(kZero,step1[31]);
-
- step2[ 0] = _mm256_sub_epi16(step2[ 0], s3_00_0);
- step2[ 1] = _mm256_sub_epi16(step2[ 1], s3_01_0);
- step2[ 2] = _mm256_sub_epi16(step2[ 2], s3_02_0);
- step2[ 3] = _mm256_sub_epi16(step2[ 3], s3_03_0);
- step2[ 4] = _mm256_sub_epi16(step2[ 4], s3_04_0);
- step2[ 5] = _mm256_sub_epi16(step2[ 5], s3_05_0);
- step2[ 6] = _mm256_sub_epi16(step2[ 6], s3_06_0);
- step2[ 7] = _mm256_sub_epi16(step2[ 7], s3_07_0);
- step2[ 8] = _mm256_sub_epi16(step2[ 8], s2_08_0);
- step2[ 9] = _mm256_sub_epi16(step2[ 9], s2_09_0);
- step2[10] = _mm256_sub_epi16(step2[10], s3_10_0);
- step2[11] = _mm256_sub_epi16(step2[11], s3_11_0);
- step2[12] = _mm256_sub_epi16(step2[12], s3_12_0);
- step2[13] = _mm256_sub_epi16(step2[13], s3_13_0);
- step2[14] = _mm256_sub_epi16(step2[14], s2_14_0);
- step2[15] = _mm256_sub_epi16(step2[15], s2_15_0);
- step1[16] = _mm256_sub_epi16(step1[16], s3_16_0);
- step1[17] = _mm256_sub_epi16(step1[17], s3_17_0);
- step1[18] = _mm256_sub_epi16(step1[18], s3_18_0);
- step1[19] = _mm256_sub_epi16(step1[19], s3_19_0);
- step2[20] = _mm256_sub_epi16(step2[20], s3_20_0);
- step2[21] = _mm256_sub_epi16(step2[21], s3_21_0);
- step2[22] = _mm256_sub_epi16(step2[22], s3_22_0);
- step2[23] = _mm256_sub_epi16(step2[23], s3_23_0);
- step2[24] = _mm256_sub_epi16(step2[24], s3_24_0);
- step2[25] = _mm256_sub_epi16(step2[25], s3_25_0);
- step2[26] = _mm256_sub_epi16(step2[26], s3_26_0);
- step2[27] = _mm256_sub_epi16(step2[27], s3_27_0);
- step1[28] = _mm256_sub_epi16(step1[28], s3_28_0);
- step1[29] = _mm256_sub_epi16(step1[29], s3_29_0);
- step1[30] = _mm256_sub_epi16(step1[30], s3_30_0);
- step1[31] = _mm256_sub_epi16(step1[31], s3_31_0);
-
- step2[ 0] = _mm256_add_epi16(step2[ 0], kOne);
- step2[ 1] = _mm256_add_epi16(step2[ 1], kOne);
- step2[ 2] = _mm256_add_epi16(step2[ 2], kOne);
- step2[ 3] = _mm256_add_epi16(step2[ 3], kOne);
- step2[ 4] = _mm256_add_epi16(step2[ 4], kOne);
- step2[ 5] = _mm256_add_epi16(step2[ 5], kOne);
- step2[ 6] = _mm256_add_epi16(step2[ 6], kOne);
- step2[ 7] = _mm256_add_epi16(step2[ 7], kOne);
- step2[ 8] = _mm256_add_epi16(step2[ 8], kOne);
- step2[ 9] = _mm256_add_epi16(step2[ 9], kOne);
- step2[10] = _mm256_add_epi16(step2[10], kOne);
- step2[11] = _mm256_add_epi16(step2[11], kOne);
- step2[12] = _mm256_add_epi16(step2[12], kOne);
- step2[13] = _mm256_add_epi16(step2[13], kOne);
- step2[14] = _mm256_add_epi16(step2[14], kOne);
- step2[15] = _mm256_add_epi16(step2[15], kOne);
- step1[16] = _mm256_add_epi16(step1[16], kOne);
- step1[17] = _mm256_add_epi16(step1[17], kOne);
- step1[18] = _mm256_add_epi16(step1[18], kOne);
- step1[19] = _mm256_add_epi16(step1[19], kOne);
- step2[20] = _mm256_add_epi16(step2[20], kOne);
- step2[21] = _mm256_add_epi16(step2[21], kOne);
- step2[22] = _mm256_add_epi16(step2[22], kOne);
- step2[23] = _mm256_add_epi16(step2[23], kOne);
- step2[24] = _mm256_add_epi16(step2[24], kOne);
- step2[25] = _mm256_add_epi16(step2[25], kOne);
- step2[26] = _mm256_add_epi16(step2[26], kOne);
- step2[27] = _mm256_add_epi16(step2[27], kOne);
- step1[28] = _mm256_add_epi16(step1[28], kOne);
- step1[29] = _mm256_add_epi16(step1[29], kOne);
- step1[30] = _mm256_add_epi16(step1[30], kOne);
- step1[31] = _mm256_add_epi16(step1[31], kOne);
-
- step2[ 0] = _mm256_srai_epi16(step2[ 0], 2);
- step2[ 1] = _mm256_srai_epi16(step2[ 1], 2);
- step2[ 2] = _mm256_srai_epi16(step2[ 2], 2);
- step2[ 3] = _mm256_srai_epi16(step2[ 3], 2);
- step2[ 4] = _mm256_srai_epi16(step2[ 4], 2);
- step2[ 5] = _mm256_srai_epi16(step2[ 5], 2);
- step2[ 6] = _mm256_srai_epi16(step2[ 6], 2);
- step2[ 7] = _mm256_srai_epi16(step2[ 7], 2);
- step2[ 8] = _mm256_srai_epi16(step2[ 8], 2);
- step2[ 9] = _mm256_srai_epi16(step2[ 9], 2);
- step2[10] = _mm256_srai_epi16(step2[10], 2);
- step2[11] = _mm256_srai_epi16(step2[11], 2);
- step2[12] = _mm256_srai_epi16(step2[12], 2);
- step2[13] = _mm256_srai_epi16(step2[13], 2);
- step2[14] = _mm256_srai_epi16(step2[14], 2);
- step2[15] = _mm256_srai_epi16(step2[15], 2);
- step1[16] = _mm256_srai_epi16(step1[16], 2);
- step1[17] = _mm256_srai_epi16(step1[17], 2);
- step1[18] = _mm256_srai_epi16(step1[18], 2);
- step1[19] = _mm256_srai_epi16(step1[19], 2);
- step2[20] = _mm256_srai_epi16(step2[20], 2);
- step2[21] = _mm256_srai_epi16(step2[21], 2);
- step2[22] = _mm256_srai_epi16(step2[22], 2);
- step2[23] = _mm256_srai_epi16(step2[23], 2);
- step2[24] = _mm256_srai_epi16(step2[24], 2);
- step2[25] = _mm256_srai_epi16(step2[25], 2);
- step2[26] = _mm256_srai_epi16(step2[26], 2);
- step2[27] = _mm256_srai_epi16(step2[27], 2);
- step1[28] = _mm256_srai_epi16(step1[28], 2);
- step1[29] = _mm256_srai_epi16(step1[29], 2);
- step1[30] = _mm256_srai_epi16(step1[30], 2);
- step1[31] = _mm256_srai_epi16(step1[31], 2);
- }
-#endif
-
-#if FDCT32x32_HIGH_PRECISION
- if (pass == 0) {
-#endif
- // Stage 3
- {
- step3[0] = _mm256_add_epi16(step2[(8 - 1)], step2[0]);
- step3[1] = _mm256_add_epi16(step2[(8 - 2)], step2[1]);
- step3[2] = _mm256_add_epi16(step2[(8 - 3)], step2[2]);
- step3[3] = _mm256_add_epi16(step2[(8 - 4)], step2[3]);
- step3[4] = _mm256_sub_epi16(step2[(8 - 5)], step2[4]);
- step3[5] = _mm256_sub_epi16(step2[(8 - 6)], step2[5]);
- step3[6] = _mm256_sub_epi16(step2[(8 - 7)], step2[6]);
- step3[7] = _mm256_sub_epi16(step2[(8 - 8)], step2[7]);
- }
- {
- const __m256i s3_10_0 = _mm256_unpacklo_epi16(step2[13], step2[10]);
- const __m256i s3_10_1 = _mm256_unpackhi_epi16(step2[13], step2[10]);
- const __m256i s3_11_0 = _mm256_unpacklo_epi16(step2[12], step2[11]);
- const __m256i s3_11_1 = _mm256_unpackhi_epi16(step2[12], step2[11]);
- const __m256i s3_10_2 = _mm256_madd_epi16(s3_10_0, k__cospi_p16_m16);
- const __m256i s3_10_3 = _mm256_madd_epi16(s3_10_1, k__cospi_p16_m16);
- const __m256i s3_11_2 = _mm256_madd_epi16(s3_11_0, k__cospi_p16_m16);
- const __m256i s3_11_3 = _mm256_madd_epi16(s3_11_1, k__cospi_p16_m16);
- const __m256i s3_12_2 = _mm256_madd_epi16(s3_11_0, k__cospi_p16_p16);
- const __m256i s3_12_3 = _mm256_madd_epi16(s3_11_1, k__cospi_p16_p16);
- const __m256i s3_13_2 = _mm256_madd_epi16(s3_10_0, k__cospi_p16_p16);
- const __m256i s3_13_3 = _mm256_madd_epi16(s3_10_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m256i s3_10_4 = _mm256_add_epi32(s3_10_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_10_5 = _mm256_add_epi32(s3_10_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_11_4 = _mm256_add_epi32(s3_11_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_11_5 = _mm256_add_epi32(s3_11_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_12_4 = _mm256_add_epi32(s3_12_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_12_5 = _mm256_add_epi32(s3_12_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_13_4 = _mm256_add_epi32(s3_13_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_13_5 = _mm256_add_epi32(s3_13_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_10_6 = _mm256_srai_epi32(s3_10_4, DCT_CONST_BITS);
- const __m256i s3_10_7 = _mm256_srai_epi32(s3_10_5, DCT_CONST_BITS);
- const __m256i s3_11_6 = _mm256_srai_epi32(s3_11_4, DCT_CONST_BITS);
- const __m256i s3_11_7 = _mm256_srai_epi32(s3_11_5, DCT_CONST_BITS);
- const __m256i s3_12_6 = _mm256_srai_epi32(s3_12_4, DCT_CONST_BITS);
- const __m256i s3_12_7 = _mm256_srai_epi32(s3_12_5, DCT_CONST_BITS);
- const __m256i s3_13_6 = _mm256_srai_epi32(s3_13_4, DCT_CONST_BITS);
- const __m256i s3_13_7 = _mm256_srai_epi32(s3_13_5, DCT_CONST_BITS);
- // Combine
- step3[10] = _mm256_packs_epi32(s3_10_6, s3_10_7);
- step3[11] = _mm256_packs_epi32(s3_11_6, s3_11_7);
- step3[12] = _mm256_packs_epi32(s3_12_6, s3_12_7);
- step3[13] = _mm256_packs_epi32(s3_13_6, s3_13_7);
- }
- {
- step3[16] = _mm256_add_epi16(step2[23], step1[16]);
- step3[17] = _mm256_add_epi16(step2[22], step1[17]);
- step3[18] = _mm256_add_epi16(step2[21], step1[18]);
- step3[19] = _mm256_add_epi16(step2[20], step1[19]);
- step3[20] = _mm256_sub_epi16(step1[19], step2[20]);
- step3[21] = _mm256_sub_epi16(step1[18], step2[21]);
- step3[22] = _mm256_sub_epi16(step1[17], step2[22]);
- step3[23] = _mm256_sub_epi16(step1[16], step2[23]);
- step3[24] = _mm256_sub_epi16(step1[31], step2[24]);
- step3[25] = _mm256_sub_epi16(step1[30], step2[25]);
- step3[26] = _mm256_sub_epi16(step1[29], step2[26]);
- step3[27] = _mm256_sub_epi16(step1[28], step2[27]);
- step3[28] = _mm256_add_epi16(step2[27], step1[28]);
- step3[29] = _mm256_add_epi16(step2[26], step1[29]);
- step3[30] = _mm256_add_epi16(step2[25], step1[30]);
- step3[31] = _mm256_add_epi16(step2[24], step1[31]);
- }
-
- // Stage 4
- {
- step1[ 0] = _mm256_add_epi16(step3[ 3], step3[ 0]);
- step1[ 1] = _mm256_add_epi16(step3[ 2], step3[ 1]);
- step1[ 2] = _mm256_sub_epi16(step3[ 1], step3[ 2]);
- step1[ 3] = _mm256_sub_epi16(step3[ 0], step3[ 3]);
- step1[ 8] = _mm256_add_epi16(step3[11], step2[ 8]);
- step1[ 9] = _mm256_add_epi16(step3[10], step2[ 9]);
- step1[10] = _mm256_sub_epi16(step2[ 9], step3[10]);
- step1[11] = _mm256_sub_epi16(step2[ 8], step3[11]);
- step1[12] = _mm256_sub_epi16(step2[15], step3[12]);
- step1[13] = _mm256_sub_epi16(step2[14], step3[13]);
- step1[14] = _mm256_add_epi16(step3[13], step2[14]);
- step1[15] = _mm256_add_epi16(step3[12], step2[15]);
- }
- {
- const __m256i s1_05_0 = _mm256_unpacklo_epi16(step3[6], step3[5]);
- const __m256i s1_05_1 = _mm256_unpackhi_epi16(step3[6], step3[5]);
- const __m256i s1_05_2 = _mm256_madd_epi16(s1_05_0, k__cospi_p16_m16);
- const __m256i s1_05_3 = _mm256_madd_epi16(s1_05_1, k__cospi_p16_m16);
- const __m256i s1_06_2 = _mm256_madd_epi16(s1_05_0, k__cospi_p16_p16);
- const __m256i s1_06_3 = _mm256_madd_epi16(s1_05_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m256i s1_05_4 = _mm256_add_epi32(s1_05_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_05_5 = _mm256_add_epi32(s1_05_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_06_4 = _mm256_add_epi32(s1_06_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_06_5 = _mm256_add_epi32(s1_06_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_05_6 = _mm256_srai_epi32(s1_05_4, DCT_CONST_BITS);
- const __m256i s1_05_7 = _mm256_srai_epi32(s1_05_5, DCT_CONST_BITS);
- const __m256i s1_06_6 = _mm256_srai_epi32(s1_06_4, DCT_CONST_BITS);
- const __m256i s1_06_7 = _mm256_srai_epi32(s1_06_5, DCT_CONST_BITS);
- // Combine
- step1[5] = _mm256_packs_epi32(s1_05_6, s1_05_7);
- step1[6] = _mm256_packs_epi32(s1_06_6, s1_06_7);
- }
- {
- const __m256i s1_18_0 = _mm256_unpacklo_epi16(step3[18], step3[29]);
- const __m256i s1_18_1 = _mm256_unpackhi_epi16(step3[18], step3[29]);
- const __m256i s1_19_0 = _mm256_unpacklo_epi16(step3[19], step3[28]);
- const __m256i s1_19_1 = _mm256_unpackhi_epi16(step3[19], step3[28]);
- const __m256i s1_20_0 = _mm256_unpacklo_epi16(step3[20], step3[27]);
- const __m256i s1_20_1 = _mm256_unpackhi_epi16(step3[20], step3[27]);
- const __m256i s1_21_0 = _mm256_unpacklo_epi16(step3[21], step3[26]);
- const __m256i s1_21_1 = _mm256_unpackhi_epi16(step3[21], step3[26]);
- const __m256i s1_18_2 = _mm256_madd_epi16(s1_18_0, k__cospi_m08_p24);
- const __m256i s1_18_3 = _mm256_madd_epi16(s1_18_1, k__cospi_m08_p24);
- const __m256i s1_19_2 = _mm256_madd_epi16(s1_19_0, k__cospi_m08_p24);
- const __m256i s1_19_3 = _mm256_madd_epi16(s1_19_1, k__cospi_m08_p24);
- const __m256i s1_20_2 = _mm256_madd_epi16(s1_20_0, k__cospi_m24_m08);
- const __m256i s1_20_3 = _mm256_madd_epi16(s1_20_1, k__cospi_m24_m08);
- const __m256i s1_21_2 = _mm256_madd_epi16(s1_21_0, k__cospi_m24_m08);
- const __m256i s1_21_3 = _mm256_madd_epi16(s1_21_1, k__cospi_m24_m08);
- const __m256i s1_26_2 = _mm256_madd_epi16(s1_21_0, k__cospi_m08_p24);
- const __m256i s1_26_3 = _mm256_madd_epi16(s1_21_1, k__cospi_m08_p24);
- const __m256i s1_27_2 = _mm256_madd_epi16(s1_20_0, k__cospi_m08_p24);
- const __m256i s1_27_3 = _mm256_madd_epi16(s1_20_1, k__cospi_m08_p24);
- const __m256i s1_28_2 = _mm256_madd_epi16(s1_19_0, k__cospi_p24_p08);
- const __m256i s1_28_3 = _mm256_madd_epi16(s1_19_1, k__cospi_p24_p08);
- const __m256i s1_29_2 = _mm256_madd_epi16(s1_18_0, k__cospi_p24_p08);
- const __m256i s1_29_3 = _mm256_madd_epi16(s1_18_1, k__cospi_p24_p08);
- // dct_const_round_shift
- const __m256i s1_18_4 = _mm256_add_epi32(s1_18_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_18_5 = _mm256_add_epi32(s1_18_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_19_4 = _mm256_add_epi32(s1_19_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_19_5 = _mm256_add_epi32(s1_19_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_20_4 = _mm256_add_epi32(s1_20_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_20_5 = _mm256_add_epi32(s1_20_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_21_4 = _mm256_add_epi32(s1_21_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_21_5 = _mm256_add_epi32(s1_21_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_26_4 = _mm256_add_epi32(s1_26_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_26_5 = _mm256_add_epi32(s1_26_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_27_4 = _mm256_add_epi32(s1_27_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_27_5 = _mm256_add_epi32(s1_27_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_28_4 = _mm256_add_epi32(s1_28_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_28_5 = _mm256_add_epi32(s1_28_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_29_4 = _mm256_add_epi32(s1_29_2, k__DCT_CONST_ROUNDING);
- const __m256i s1_29_5 = _mm256_add_epi32(s1_29_3, k__DCT_CONST_ROUNDING);
- const __m256i s1_18_6 = _mm256_srai_epi32(s1_18_4, DCT_CONST_BITS);
- const __m256i s1_18_7 = _mm256_srai_epi32(s1_18_5, DCT_CONST_BITS);
- const __m256i s1_19_6 = _mm256_srai_epi32(s1_19_4, DCT_CONST_BITS);
- const __m256i s1_19_7 = _mm256_srai_epi32(s1_19_5, DCT_CONST_BITS);
- const __m256i s1_20_6 = _mm256_srai_epi32(s1_20_4, DCT_CONST_BITS);
- const __m256i s1_20_7 = _mm256_srai_epi32(s1_20_5, DCT_CONST_BITS);
- const __m256i s1_21_6 = _mm256_srai_epi32(s1_21_4, DCT_CONST_BITS);
- const __m256i s1_21_7 = _mm256_srai_epi32(s1_21_5, DCT_CONST_BITS);
- const __m256i s1_26_6 = _mm256_srai_epi32(s1_26_4, DCT_CONST_BITS);
- const __m256i s1_26_7 = _mm256_srai_epi32(s1_26_5, DCT_CONST_BITS);
- const __m256i s1_27_6 = _mm256_srai_epi32(s1_27_4, DCT_CONST_BITS);
- const __m256i s1_27_7 = _mm256_srai_epi32(s1_27_5, DCT_CONST_BITS);
- const __m256i s1_28_6 = _mm256_srai_epi32(s1_28_4, DCT_CONST_BITS);
- const __m256i s1_28_7 = _mm256_srai_epi32(s1_28_5, DCT_CONST_BITS);
- const __m256i s1_29_6 = _mm256_srai_epi32(s1_29_4, DCT_CONST_BITS);
- const __m256i s1_29_7 = _mm256_srai_epi32(s1_29_5, DCT_CONST_BITS);
- // Combine
- step1[18] = _mm256_packs_epi32(s1_18_6, s1_18_7);
- step1[19] = _mm256_packs_epi32(s1_19_6, s1_19_7);
- step1[20] = _mm256_packs_epi32(s1_20_6, s1_20_7);
- step1[21] = _mm256_packs_epi32(s1_21_6, s1_21_7);
- step1[26] = _mm256_packs_epi32(s1_26_6, s1_26_7);
- step1[27] = _mm256_packs_epi32(s1_27_6, s1_27_7);
- step1[28] = _mm256_packs_epi32(s1_28_6, s1_28_7);
- step1[29] = _mm256_packs_epi32(s1_29_6, s1_29_7);
- }
- // Stage 5
- {
- step2[4] = _mm256_add_epi16(step1[5], step3[4]);
- step2[5] = _mm256_sub_epi16(step3[4], step1[5]);
- step2[6] = _mm256_sub_epi16(step3[7], step1[6]);
- step2[7] = _mm256_add_epi16(step1[6], step3[7]);
- }
- {
- const __m256i out_00_0 = _mm256_unpacklo_epi16(step1[0], step1[1]);
- const __m256i out_00_1 = _mm256_unpackhi_epi16(step1[0], step1[1]);
- const __m256i out_08_0 = _mm256_unpacklo_epi16(step1[2], step1[3]);
- const __m256i out_08_1 = _mm256_unpackhi_epi16(step1[2], step1[3]);
- const __m256i out_00_2 = _mm256_madd_epi16(out_00_0, k__cospi_p16_p16);
- const __m256i out_00_3 = _mm256_madd_epi16(out_00_1, k__cospi_p16_p16);
- const __m256i out_16_2 = _mm256_madd_epi16(out_00_0, k__cospi_p16_m16);
- const __m256i out_16_3 = _mm256_madd_epi16(out_00_1, k__cospi_p16_m16);
- const __m256i out_08_2 = _mm256_madd_epi16(out_08_0, k__cospi_p24_p08);
- const __m256i out_08_3 = _mm256_madd_epi16(out_08_1, k__cospi_p24_p08);
- const __m256i out_24_2 = _mm256_madd_epi16(out_08_0, k__cospi_m08_p24);
- const __m256i out_24_3 = _mm256_madd_epi16(out_08_1, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m256i out_00_4 = _mm256_add_epi32(out_00_2, k__DCT_CONST_ROUNDING);
- const __m256i out_00_5 = _mm256_add_epi32(out_00_3, k__DCT_CONST_ROUNDING);
- const __m256i out_16_4 = _mm256_add_epi32(out_16_2, k__DCT_CONST_ROUNDING);
- const __m256i out_16_5 = _mm256_add_epi32(out_16_3, k__DCT_CONST_ROUNDING);
- const __m256i out_08_4 = _mm256_add_epi32(out_08_2, k__DCT_CONST_ROUNDING);
- const __m256i out_08_5 = _mm256_add_epi32(out_08_3, k__DCT_CONST_ROUNDING);
- const __m256i out_24_4 = _mm256_add_epi32(out_24_2, k__DCT_CONST_ROUNDING);
- const __m256i out_24_5 = _mm256_add_epi32(out_24_3, k__DCT_CONST_ROUNDING);
- const __m256i out_00_6 = _mm256_srai_epi32(out_00_4, DCT_CONST_BITS);
- const __m256i out_00_7 = _mm256_srai_epi32(out_00_5, DCT_CONST_BITS);
- const __m256i out_16_6 = _mm256_srai_epi32(out_16_4, DCT_CONST_BITS);
- const __m256i out_16_7 = _mm256_srai_epi32(out_16_5, DCT_CONST_BITS);
- const __m256i out_08_6 = _mm256_srai_epi32(out_08_4, DCT_CONST_BITS);
- const __m256i out_08_7 = _mm256_srai_epi32(out_08_5, DCT_CONST_BITS);
- const __m256i out_24_6 = _mm256_srai_epi32(out_24_4, DCT_CONST_BITS);
- const __m256i out_24_7 = _mm256_srai_epi32(out_24_5, DCT_CONST_BITS);
- // Combine
- out[ 0] = _mm256_packs_epi32(out_00_6, out_00_7);
- out[16] = _mm256_packs_epi32(out_16_6, out_16_7);
- out[ 8] = _mm256_packs_epi32(out_08_6, out_08_7);
- out[24] = _mm256_packs_epi32(out_24_6, out_24_7);
- }
- {
- const __m256i s2_09_0 = _mm256_unpacklo_epi16(step1[ 9], step1[14]);
- const __m256i s2_09_1 = _mm256_unpackhi_epi16(step1[ 9], step1[14]);
- const __m256i s2_10_0 = _mm256_unpacklo_epi16(step1[10], step1[13]);
- const __m256i s2_10_1 = _mm256_unpackhi_epi16(step1[10], step1[13]);
- const __m256i s2_09_2 = _mm256_madd_epi16(s2_09_0, k__cospi_m08_p24);
- const __m256i s2_09_3 = _mm256_madd_epi16(s2_09_1, k__cospi_m08_p24);
- const __m256i s2_10_2 = _mm256_madd_epi16(s2_10_0, k__cospi_m24_m08);
- const __m256i s2_10_3 = _mm256_madd_epi16(s2_10_1, k__cospi_m24_m08);
- const __m256i s2_13_2 = _mm256_madd_epi16(s2_10_0, k__cospi_m08_p24);
- const __m256i s2_13_3 = _mm256_madd_epi16(s2_10_1, k__cospi_m08_p24);
- const __m256i s2_14_2 = _mm256_madd_epi16(s2_09_0, k__cospi_p24_p08);
- const __m256i s2_14_3 = _mm256_madd_epi16(s2_09_1, k__cospi_p24_p08);
- // dct_const_round_shift
- const __m256i s2_09_4 = _mm256_add_epi32(s2_09_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_09_5 = _mm256_add_epi32(s2_09_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_10_4 = _mm256_add_epi32(s2_10_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_10_5 = _mm256_add_epi32(s2_10_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_13_4 = _mm256_add_epi32(s2_13_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_13_5 = _mm256_add_epi32(s2_13_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_14_4 = _mm256_add_epi32(s2_14_2, k__DCT_CONST_ROUNDING);
- const __m256i s2_14_5 = _mm256_add_epi32(s2_14_3, k__DCT_CONST_ROUNDING);
- const __m256i s2_09_6 = _mm256_srai_epi32(s2_09_4, DCT_CONST_BITS);
- const __m256i s2_09_7 = _mm256_srai_epi32(s2_09_5, DCT_CONST_BITS);
- const __m256i s2_10_6 = _mm256_srai_epi32(s2_10_4, DCT_CONST_BITS);
- const __m256i s2_10_7 = _mm256_srai_epi32(s2_10_5, DCT_CONST_BITS);
- const __m256i s2_13_6 = _mm256_srai_epi32(s2_13_4, DCT_CONST_BITS);
- const __m256i s2_13_7 = _mm256_srai_epi32(s2_13_5, DCT_CONST_BITS);
- const __m256i s2_14_6 = _mm256_srai_epi32(s2_14_4, DCT_CONST_BITS);
- const __m256i s2_14_7 = _mm256_srai_epi32(s2_14_5, DCT_CONST_BITS);
- // Combine
- step2[ 9] = _mm256_packs_epi32(s2_09_6, s2_09_7);
- step2[10] = _mm256_packs_epi32(s2_10_6, s2_10_7);
- step2[13] = _mm256_packs_epi32(s2_13_6, s2_13_7);
- step2[14] = _mm256_packs_epi32(s2_14_6, s2_14_7);
- }
- {
- step2[16] = _mm256_add_epi16(step1[19], step3[16]);
- step2[17] = _mm256_add_epi16(step1[18], step3[17]);
- step2[18] = _mm256_sub_epi16(step3[17], step1[18]);
- step2[19] = _mm256_sub_epi16(step3[16], step1[19]);
- step2[20] = _mm256_sub_epi16(step3[23], step1[20]);
- step2[21] = _mm256_sub_epi16(step3[22], step1[21]);
- step2[22] = _mm256_add_epi16(step1[21], step3[22]);
- step2[23] = _mm256_add_epi16(step1[20], step3[23]);
- step2[24] = _mm256_add_epi16(step1[27], step3[24]);
- step2[25] = _mm256_add_epi16(step1[26], step3[25]);
- step2[26] = _mm256_sub_epi16(step3[25], step1[26]);
- step2[27] = _mm256_sub_epi16(step3[24], step1[27]);
- step2[28] = _mm256_sub_epi16(step3[31], step1[28]);
- step2[29] = _mm256_sub_epi16(step3[30], step1[29]);
- step2[30] = _mm256_add_epi16(step1[29], step3[30]);
- step2[31] = _mm256_add_epi16(step1[28], step3[31]);
- }
- // Stage 6
- {
- const __m256i out_04_0 = _mm256_unpacklo_epi16(step2[4], step2[7]);
- const __m256i out_04_1 = _mm256_unpackhi_epi16(step2[4], step2[7]);
- const __m256i out_20_0 = _mm256_unpacklo_epi16(step2[5], step2[6]);
- const __m256i out_20_1 = _mm256_unpackhi_epi16(step2[5], step2[6]);
- const __m256i out_12_0 = _mm256_unpacklo_epi16(step2[5], step2[6]);
- const __m256i out_12_1 = _mm256_unpackhi_epi16(step2[5], step2[6]);
- const __m256i out_28_0 = _mm256_unpacklo_epi16(step2[4], step2[7]);
- const __m256i out_28_1 = _mm256_unpackhi_epi16(step2[4], step2[7]);
- const __m256i out_04_2 = _mm256_madd_epi16(out_04_0, k__cospi_p28_p04);
- const __m256i out_04_3 = _mm256_madd_epi16(out_04_1, k__cospi_p28_p04);
- const __m256i out_20_2 = _mm256_madd_epi16(out_20_0, k__cospi_p12_p20);
- const __m256i out_20_3 = _mm256_madd_epi16(out_20_1, k__cospi_p12_p20);
- const __m256i out_12_2 = _mm256_madd_epi16(out_12_0, k__cospi_m20_p12);
- const __m256i out_12_3 = _mm256_madd_epi16(out_12_1, k__cospi_m20_p12);
- const __m256i out_28_2 = _mm256_madd_epi16(out_28_0, k__cospi_m04_p28);
- const __m256i out_28_3 = _mm256_madd_epi16(out_28_1, k__cospi_m04_p28);
- // dct_const_round_shift
- const __m256i out_04_4 = _mm256_add_epi32(out_04_2, k__DCT_CONST_ROUNDING);
- const __m256i out_04_5 = _mm256_add_epi32(out_04_3, k__DCT_CONST_ROUNDING);
- const __m256i out_20_4 = _mm256_add_epi32(out_20_2, k__DCT_CONST_ROUNDING);
- const __m256i out_20_5 = _mm256_add_epi32(out_20_3, k__DCT_CONST_ROUNDING);
- const __m256i out_12_4 = _mm256_add_epi32(out_12_2, k__DCT_CONST_ROUNDING);
- const __m256i out_12_5 = _mm256_add_epi32(out_12_3, k__DCT_CONST_ROUNDING);
- const __m256i out_28_4 = _mm256_add_epi32(out_28_2, k__DCT_CONST_ROUNDING);
- const __m256i out_28_5 = _mm256_add_epi32(out_28_3, k__DCT_CONST_ROUNDING);
- const __m256i out_04_6 = _mm256_srai_epi32(out_04_4, DCT_CONST_BITS);
- const __m256i out_04_7 = _mm256_srai_epi32(out_04_5, DCT_CONST_BITS);
- const __m256i out_20_6 = _mm256_srai_epi32(out_20_4, DCT_CONST_BITS);
- const __m256i out_20_7 = _mm256_srai_epi32(out_20_5, DCT_CONST_BITS);
- const __m256i out_12_6 = _mm256_srai_epi32(out_12_4, DCT_CONST_BITS);
- const __m256i out_12_7 = _mm256_srai_epi32(out_12_5, DCT_CONST_BITS);
- const __m256i out_28_6 = _mm256_srai_epi32(out_28_4, DCT_CONST_BITS);
- const __m256i out_28_7 = _mm256_srai_epi32(out_28_5, DCT_CONST_BITS);
- // Combine
- out[ 4] = _mm256_packs_epi32(out_04_6, out_04_7);
- out[20] = _mm256_packs_epi32(out_20_6, out_20_7);
- out[12] = _mm256_packs_epi32(out_12_6, out_12_7);
- out[28] = _mm256_packs_epi32(out_28_6, out_28_7);
- }
- {
- step3[ 8] = _mm256_add_epi16(step2[ 9], step1[ 8]);
- step3[ 9] = _mm256_sub_epi16(step1[ 8], step2[ 9]);
- step3[10] = _mm256_sub_epi16(step1[11], step2[10]);
- step3[11] = _mm256_add_epi16(step2[10], step1[11]);
- step3[12] = _mm256_add_epi16(step2[13], step1[12]);
- step3[13] = _mm256_sub_epi16(step1[12], step2[13]);
- step3[14] = _mm256_sub_epi16(step1[15], step2[14]);
- step3[15] = _mm256_add_epi16(step2[14], step1[15]);
- }
- {
- const __m256i s3_17_0 = _mm256_unpacklo_epi16(step2[17], step2[30]);
- const __m256i s3_17_1 = _mm256_unpackhi_epi16(step2[17], step2[30]);
- const __m256i s3_18_0 = _mm256_unpacklo_epi16(step2[18], step2[29]);
- const __m256i s3_18_1 = _mm256_unpackhi_epi16(step2[18], step2[29]);
- const __m256i s3_21_0 = _mm256_unpacklo_epi16(step2[21], step2[26]);
- const __m256i s3_21_1 = _mm256_unpackhi_epi16(step2[21], step2[26]);
- const __m256i s3_22_0 = _mm256_unpacklo_epi16(step2[22], step2[25]);
- const __m256i s3_22_1 = _mm256_unpackhi_epi16(step2[22], step2[25]);
- const __m256i s3_17_2 = _mm256_madd_epi16(s3_17_0, k__cospi_m04_p28);
- const __m256i s3_17_3 = _mm256_madd_epi16(s3_17_1, k__cospi_m04_p28);
- const __m256i s3_18_2 = _mm256_madd_epi16(s3_18_0, k__cospi_m28_m04);
- const __m256i s3_18_3 = _mm256_madd_epi16(s3_18_1, k__cospi_m28_m04);
- const __m256i s3_21_2 = _mm256_madd_epi16(s3_21_0, k__cospi_m20_p12);
- const __m256i s3_21_3 = _mm256_madd_epi16(s3_21_1, k__cospi_m20_p12);
- const __m256i s3_22_2 = _mm256_madd_epi16(s3_22_0, k__cospi_m12_m20);
- const __m256i s3_22_3 = _mm256_madd_epi16(s3_22_1, k__cospi_m12_m20);
- const __m256i s3_25_2 = _mm256_madd_epi16(s3_22_0, k__cospi_m20_p12);
- const __m256i s3_25_3 = _mm256_madd_epi16(s3_22_1, k__cospi_m20_p12);
- const __m256i s3_26_2 = _mm256_madd_epi16(s3_21_0, k__cospi_p12_p20);
- const __m256i s3_26_3 = _mm256_madd_epi16(s3_21_1, k__cospi_p12_p20);
- const __m256i s3_29_2 = _mm256_madd_epi16(s3_18_0, k__cospi_m04_p28);
- const __m256i s3_29_3 = _mm256_madd_epi16(s3_18_1, k__cospi_m04_p28);
- const __m256i s3_30_2 = _mm256_madd_epi16(s3_17_0, k__cospi_p28_p04);
- const __m256i s3_30_3 = _mm256_madd_epi16(s3_17_1, k__cospi_p28_p04);
- // dct_const_round_shift
- const __m256i s3_17_4 = _mm256_add_epi32(s3_17_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_17_5 = _mm256_add_epi32(s3_17_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_18_4 = _mm256_add_epi32(s3_18_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_18_5 = _mm256_add_epi32(s3_18_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_21_4 = _mm256_add_epi32(s3_21_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_21_5 = _mm256_add_epi32(s3_21_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_22_4 = _mm256_add_epi32(s3_22_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_22_5 = _mm256_add_epi32(s3_22_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_17_6 = _mm256_srai_epi32(s3_17_4, DCT_CONST_BITS);
- const __m256i s3_17_7 = _mm256_srai_epi32(s3_17_5, DCT_CONST_BITS);
- const __m256i s3_18_6 = _mm256_srai_epi32(s3_18_4, DCT_CONST_BITS);
- const __m256i s3_18_7 = _mm256_srai_epi32(s3_18_5, DCT_CONST_BITS);
- const __m256i s3_21_6 = _mm256_srai_epi32(s3_21_4, DCT_CONST_BITS);
- const __m256i s3_21_7 = _mm256_srai_epi32(s3_21_5, DCT_CONST_BITS);
- const __m256i s3_22_6 = _mm256_srai_epi32(s3_22_4, DCT_CONST_BITS);
- const __m256i s3_22_7 = _mm256_srai_epi32(s3_22_5, DCT_CONST_BITS);
- const __m256i s3_25_4 = _mm256_add_epi32(s3_25_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_25_5 = _mm256_add_epi32(s3_25_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_26_4 = _mm256_add_epi32(s3_26_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_26_5 = _mm256_add_epi32(s3_26_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_29_4 = _mm256_add_epi32(s3_29_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_29_5 = _mm256_add_epi32(s3_29_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_30_4 = _mm256_add_epi32(s3_30_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_30_5 = _mm256_add_epi32(s3_30_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_25_6 = _mm256_srai_epi32(s3_25_4, DCT_CONST_BITS);
- const __m256i s3_25_7 = _mm256_srai_epi32(s3_25_5, DCT_CONST_BITS);
- const __m256i s3_26_6 = _mm256_srai_epi32(s3_26_4, DCT_CONST_BITS);
- const __m256i s3_26_7 = _mm256_srai_epi32(s3_26_5, DCT_CONST_BITS);
- const __m256i s3_29_6 = _mm256_srai_epi32(s3_29_4, DCT_CONST_BITS);
- const __m256i s3_29_7 = _mm256_srai_epi32(s3_29_5, DCT_CONST_BITS);
- const __m256i s3_30_6 = _mm256_srai_epi32(s3_30_4, DCT_CONST_BITS);
- const __m256i s3_30_7 = _mm256_srai_epi32(s3_30_5, DCT_CONST_BITS);
- // Combine
- step3[17] = _mm256_packs_epi32(s3_17_6, s3_17_7);
- step3[18] = _mm256_packs_epi32(s3_18_6, s3_18_7);
- step3[21] = _mm256_packs_epi32(s3_21_6, s3_21_7);
- step3[22] = _mm256_packs_epi32(s3_22_6, s3_22_7);
- // Combine
- step3[25] = _mm256_packs_epi32(s3_25_6, s3_25_7);
- step3[26] = _mm256_packs_epi32(s3_26_6, s3_26_7);
- step3[29] = _mm256_packs_epi32(s3_29_6, s3_29_7);
- step3[30] = _mm256_packs_epi32(s3_30_6, s3_30_7);
- }
- // Stage 7
- {
- const __m256i out_02_0 = _mm256_unpacklo_epi16(step3[ 8], step3[15]);
- const __m256i out_02_1 = _mm256_unpackhi_epi16(step3[ 8], step3[15]);
- const __m256i out_18_0 = _mm256_unpacklo_epi16(step3[ 9], step3[14]);
- const __m256i out_18_1 = _mm256_unpackhi_epi16(step3[ 9], step3[14]);
- const __m256i out_10_0 = _mm256_unpacklo_epi16(step3[10], step3[13]);
- const __m256i out_10_1 = _mm256_unpackhi_epi16(step3[10], step3[13]);
- const __m256i out_26_0 = _mm256_unpacklo_epi16(step3[11], step3[12]);
- const __m256i out_26_1 = _mm256_unpackhi_epi16(step3[11], step3[12]);
- const __m256i out_02_2 = _mm256_madd_epi16(out_02_0, k__cospi_p30_p02);
- const __m256i out_02_3 = _mm256_madd_epi16(out_02_1, k__cospi_p30_p02);
- const __m256i out_18_2 = _mm256_madd_epi16(out_18_0, k__cospi_p14_p18);
- const __m256i out_18_3 = _mm256_madd_epi16(out_18_1, k__cospi_p14_p18);
- const __m256i out_10_2 = _mm256_madd_epi16(out_10_0, k__cospi_p22_p10);
- const __m256i out_10_3 = _mm256_madd_epi16(out_10_1, k__cospi_p22_p10);
- const __m256i out_26_2 = _mm256_madd_epi16(out_26_0, k__cospi_p06_p26);
- const __m256i out_26_3 = _mm256_madd_epi16(out_26_1, k__cospi_p06_p26);
- const __m256i out_06_2 = _mm256_madd_epi16(out_26_0, k__cospi_m26_p06);
- const __m256i out_06_3 = _mm256_madd_epi16(out_26_1, k__cospi_m26_p06);
- const __m256i out_22_2 = _mm256_madd_epi16(out_10_0, k__cospi_m10_p22);
- const __m256i out_22_3 = _mm256_madd_epi16(out_10_1, k__cospi_m10_p22);
- const __m256i out_14_2 = _mm256_madd_epi16(out_18_0, k__cospi_m18_p14);
- const __m256i out_14_3 = _mm256_madd_epi16(out_18_1, k__cospi_m18_p14);
- const __m256i out_30_2 = _mm256_madd_epi16(out_02_0, k__cospi_m02_p30);
- const __m256i out_30_3 = _mm256_madd_epi16(out_02_1, k__cospi_m02_p30);
- // dct_const_round_shift
- const __m256i out_02_4 = _mm256_add_epi32(out_02_2, k__DCT_CONST_ROUNDING);
- const __m256i out_02_5 = _mm256_add_epi32(out_02_3, k__DCT_CONST_ROUNDING);
- const __m256i out_18_4 = _mm256_add_epi32(out_18_2, k__DCT_CONST_ROUNDING);
- const __m256i out_18_5 = _mm256_add_epi32(out_18_3, k__DCT_CONST_ROUNDING);
- const __m256i out_10_4 = _mm256_add_epi32(out_10_2, k__DCT_CONST_ROUNDING);
- const __m256i out_10_5 = _mm256_add_epi32(out_10_3, k__DCT_CONST_ROUNDING);
- const __m256i out_26_4 = _mm256_add_epi32(out_26_2, k__DCT_CONST_ROUNDING);
- const __m256i out_26_5 = _mm256_add_epi32(out_26_3, k__DCT_CONST_ROUNDING);
- const __m256i out_06_4 = _mm256_add_epi32(out_06_2, k__DCT_CONST_ROUNDING);
- const __m256i out_06_5 = _mm256_add_epi32(out_06_3, k__DCT_CONST_ROUNDING);
- const __m256i out_22_4 = _mm256_add_epi32(out_22_2, k__DCT_CONST_ROUNDING);
- const __m256i out_22_5 = _mm256_add_epi32(out_22_3, k__DCT_CONST_ROUNDING);
- const __m256i out_14_4 = _mm256_add_epi32(out_14_2, k__DCT_CONST_ROUNDING);
- const __m256i out_14_5 = _mm256_add_epi32(out_14_3, k__DCT_CONST_ROUNDING);
- const __m256i out_30_4 = _mm256_add_epi32(out_30_2, k__DCT_CONST_ROUNDING);
- const __m256i out_30_5 = _mm256_add_epi32(out_30_3, k__DCT_CONST_ROUNDING);
- const __m256i out_02_6 = _mm256_srai_epi32(out_02_4, DCT_CONST_BITS);
- const __m256i out_02_7 = _mm256_srai_epi32(out_02_5, DCT_CONST_BITS);
- const __m256i out_18_6 = _mm256_srai_epi32(out_18_4, DCT_CONST_BITS);
- const __m256i out_18_7 = _mm256_srai_epi32(out_18_5, DCT_CONST_BITS);
- const __m256i out_10_6 = _mm256_srai_epi32(out_10_4, DCT_CONST_BITS);
- const __m256i out_10_7 = _mm256_srai_epi32(out_10_5, DCT_CONST_BITS);
- const __m256i out_26_6 = _mm256_srai_epi32(out_26_4, DCT_CONST_BITS);
- const __m256i out_26_7 = _mm256_srai_epi32(out_26_5, DCT_CONST_BITS);
- const __m256i out_06_6 = _mm256_srai_epi32(out_06_4, DCT_CONST_BITS);
- const __m256i out_06_7 = _mm256_srai_epi32(out_06_5, DCT_CONST_BITS);
- const __m256i out_22_6 = _mm256_srai_epi32(out_22_4, DCT_CONST_BITS);
- const __m256i out_22_7 = _mm256_srai_epi32(out_22_5, DCT_CONST_BITS);
- const __m256i out_14_6 = _mm256_srai_epi32(out_14_4, DCT_CONST_BITS);
- const __m256i out_14_7 = _mm256_srai_epi32(out_14_5, DCT_CONST_BITS);
- const __m256i out_30_6 = _mm256_srai_epi32(out_30_4, DCT_CONST_BITS);
- const __m256i out_30_7 = _mm256_srai_epi32(out_30_5, DCT_CONST_BITS);
- // Combine
- out[ 2] = _mm256_packs_epi32(out_02_6, out_02_7);
- out[18] = _mm256_packs_epi32(out_18_6, out_18_7);
- out[10] = _mm256_packs_epi32(out_10_6, out_10_7);
- out[26] = _mm256_packs_epi32(out_26_6, out_26_7);
- out[ 6] = _mm256_packs_epi32(out_06_6, out_06_7);
- out[22] = _mm256_packs_epi32(out_22_6, out_22_7);
- out[14] = _mm256_packs_epi32(out_14_6, out_14_7);
- out[30] = _mm256_packs_epi32(out_30_6, out_30_7);
- }
- {
- step1[16] = _mm256_add_epi16(step3[17], step2[16]);
- step1[17] = _mm256_sub_epi16(step2[16], step3[17]);
- step1[18] = _mm256_sub_epi16(step2[19], step3[18]);
- step1[19] = _mm256_add_epi16(step3[18], step2[19]);
- step1[20] = _mm256_add_epi16(step3[21], step2[20]);
- step1[21] = _mm256_sub_epi16(step2[20], step3[21]);
- step1[22] = _mm256_sub_epi16(step2[23], step3[22]);
- step1[23] = _mm256_add_epi16(step3[22], step2[23]);
- step1[24] = _mm256_add_epi16(step3[25], step2[24]);
- step1[25] = _mm256_sub_epi16(step2[24], step3[25]);
- step1[26] = _mm256_sub_epi16(step2[27], step3[26]);
- step1[27] = _mm256_add_epi16(step3[26], step2[27]);
- step1[28] = _mm256_add_epi16(step3[29], step2[28]);
- step1[29] = _mm256_sub_epi16(step2[28], step3[29]);
- step1[30] = _mm256_sub_epi16(step2[31], step3[30]);
- step1[31] = _mm256_add_epi16(step3[30], step2[31]);
- }
- // Final stage --- outputs indices are bit-reversed.
- {
- const __m256i out_01_0 = _mm256_unpacklo_epi16(step1[16], step1[31]);
- const __m256i out_01_1 = _mm256_unpackhi_epi16(step1[16], step1[31]);
- const __m256i out_17_0 = _mm256_unpacklo_epi16(step1[17], step1[30]);
- const __m256i out_17_1 = _mm256_unpackhi_epi16(step1[17], step1[30]);
- const __m256i out_09_0 = _mm256_unpacklo_epi16(step1[18], step1[29]);
- const __m256i out_09_1 = _mm256_unpackhi_epi16(step1[18], step1[29]);
- const __m256i out_25_0 = _mm256_unpacklo_epi16(step1[19], step1[28]);
- const __m256i out_25_1 = _mm256_unpackhi_epi16(step1[19], step1[28]);
- const __m256i out_01_2 = _mm256_madd_epi16(out_01_0, k__cospi_p31_p01);
- const __m256i out_01_3 = _mm256_madd_epi16(out_01_1, k__cospi_p31_p01);
- const __m256i out_17_2 = _mm256_madd_epi16(out_17_0, k__cospi_p15_p17);
- const __m256i out_17_3 = _mm256_madd_epi16(out_17_1, k__cospi_p15_p17);
- const __m256i out_09_2 = _mm256_madd_epi16(out_09_0, k__cospi_p23_p09);
- const __m256i out_09_3 = _mm256_madd_epi16(out_09_1, k__cospi_p23_p09);
- const __m256i out_25_2 = _mm256_madd_epi16(out_25_0, k__cospi_p07_p25);
- const __m256i out_25_3 = _mm256_madd_epi16(out_25_1, k__cospi_p07_p25);
- const __m256i out_07_2 = _mm256_madd_epi16(out_25_0, k__cospi_m25_p07);
- const __m256i out_07_3 = _mm256_madd_epi16(out_25_1, k__cospi_m25_p07);
- const __m256i out_23_2 = _mm256_madd_epi16(out_09_0, k__cospi_m09_p23);
- const __m256i out_23_3 = _mm256_madd_epi16(out_09_1, k__cospi_m09_p23);
- const __m256i out_15_2 = _mm256_madd_epi16(out_17_0, k__cospi_m17_p15);
- const __m256i out_15_3 = _mm256_madd_epi16(out_17_1, k__cospi_m17_p15);
- const __m256i out_31_2 = _mm256_madd_epi16(out_01_0, k__cospi_m01_p31);
- const __m256i out_31_3 = _mm256_madd_epi16(out_01_1, k__cospi_m01_p31);
- // dct_const_round_shift
- const __m256i out_01_4 = _mm256_add_epi32(out_01_2, k__DCT_CONST_ROUNDING);
- const __m256i out_01_5 = _mm256_add_epi32(out_01_3, k__DCT_CONST_ROUNDING);
- const __m256i out_17_4 = _mm256_add_epi32(out_17_2, k__DCT_CONST_ROUNDING);
- const __m256i out_17_5 = _mm256_add_epi32(out_17_3, k__DCT_CONST_ROUNDING);
- const __m256i out_09_4 = _mm256_add_epi32(out_09_2, k__DCT_CONST_ROUNDING);
- const __m256i out_09_5 = _mm256_add_epi32(out_09_3, k__DCT_CONST_ROUNDING);
- const __m256i out_25_4 = _mm256_add_epi32(out_25_2, k__DCT_CONST_ROUNDING);
- const __m256i out_25_5 = _mm256_add_epi32(out_25_3, k__DCT_CONST_ROUNDING);
- const __m256i out_07_4 = _mm256_add_epi32(out_07_2, k__DCT_CONST_ROUNDING);
- const __m256i out_07_5 = _mm256_add_epi32(out_07_3, k__DCT_CONST_ROUNDING);
- const __m256i out_23_4 = _mm256_add_epi32(out_23_2, k__DCT_CONST_ROUNDING);
- const __m256i out_23_5 = _mm256_add_epi32(out_23_3, k__DCT_CONST_ROUNDING);
- const __m256i out_15_4 = _mm256_add_epi32(out_15_2, k__DCT_CONST_ROUNDING);
- const __m256i out_15_5 = _mm256_add_epi32(out_15_3, k__DCT_CONST_ROUNDING);
- const __m256i out_31_4 = _mm256_add_epi32(out_31_2, k__DCT_CONST_ROUNDING);
- const __m256i out_31_5 = _mm256_add_epi32(out_31_3, k__DCT_CONST_ROUNDING);
- const __m256i out_01_6 = _mm256_srai_epi32(out_01_4, DCT_CONST_BITS);
- const __m256i out_01_7 = _mm256_srai_epi32(out_01_5, DCT_CONST_BITS);
- const __m256i out_17_6 = _mm256_srai_epi32(out_17_4, DCT_CONST_BITS);
- const __m256i out_17_7 = _mm256_srai_epi32(out_17_5, DCT_CONST_BITS);
- const __m256i out_09_6 = _mm256_srai_epi32(out_09_4, DCT_CONST_BITS);
- const __m256i out_09_7 = _mm256_srai_epi32(out_09_5, DCT_CONST_BITS);
- const __m256i out_25_6 = _mm256_srai_epi32(out_25_4, DCT_CONST_BITS);
- const __m256i out_25_7 = _mm256_srai_epi32(out_25_5, DCT_CONST_BITS);
- const __m256i out_07_6 = _mm256_srai_epi32(out_07_4, DCT_CONST_BITS);
- const __m256i out_07_7 = _mm256_srai_epi32(out_07_5, DCT_CONST_BITS);
- const __m256i out_23_6 = _mm256_srai_epi32(out_23_4, DCT_CONST_BITS);
- const __m256i out_23_7 = _mm256_srai_epi32(out_23_5, DCT_CONST_BITS);
- const __m256i out_15_6 = _mm256_srai_epi32(out_15_4, DCT_CONST_BITS);
- const __m256i out_15_7 = _mm256_srai_epi32(out_15_5, DCT_CONST_BITS);
- const __m256i out_31_6 = _mm256_srai_epi32(out_31_4, DCT_CONST_BITS);
- const __m256i out_31_7 = _mm256_srai_epi32(out_31_5, DCT_CONST_BITS);
- // Combine
- out[ 1] = _mm256_packs_epi32(out_01_6, out_01_7);
- out[17] = _mm256_packs_epi32(out_17_6, out_17_7);
- out[ 9] = _mm256_packs_epi32(out_09_6, out_09_7);
- out[25] = _mm256_packs_epi32(out_25_6, out_25_7);
- out[ 7] = _mm256_packs_epi32(out_07_6, out_07_7);
- out[23] = _mm256_packs_epi32(out_23_6, out_23_7);
- out[15] = _mm256_packs_epi32(out_15_6, out_15_7);
- out[31] = _mm256_packs_epi32(out_31_6, out_31_7);
- }
- {
- const __m256i out_05_0 = _mm256_unpacklo_epi16(step1[20], step1[27]);
- const __m256i out_05_1 = _mm256_unpackhi_epi16(step1[20], step1[27]);
- const __m256i out_21_0 = _mm256_unpacklo_epi16(step1[21], step1[26]);
- const __m256i out_21_1 = _mm256_unpackhi_epi16(step1[21], step1[26]);
- const __m256i out_13_0 = _mm256_unpacklo_epi16(step1[22], step1[25]);
- const __m256i out_13_1 = _mm256_unpackhi_epi16(step1[22], step1[25]);
- const __m256i out_29_0 = _mm256_unpacklo_epi16(step1[23], step1[24]);
- const __m256i out_29_1 = _mm256_unpackhi_epi16(step1[23], step1[24]);
- const __m256i out_05_2 = _mm256_madd_epi16(out_05_0, k__cospi_p27_p05);
- const __m256i out_05_3 = _mm256_madd_epi16(out_05_1, k__cospi_p27_p05);
- const __m256i out_21_2 = _mm256_madd_epi16(out_21_0, k__cospi_p11_p21);
- const __m256i out_21_3 = _mm256_madd_epi16(out_21_1, k__cospi_p11_p21);
- const __m256i out_13_2 = _mm256_madd_epi16(out_13_0, k__cospi_p19_p13);
- const __m256i out_13_3 = _mm256_madd_epi16(out_13_1, k__cospi_p19_p13);
- const __m256i out_29_2 = _mm256_madd_epi16(out_29_0, k__cospi_p03_p29);
- const __m256i out_29_3 = _mm256_madd_epi16(out_29_1, k__cospi_p03_p29);
- const __m256i out_03_2 = _mm256_madd_epi16(out_29_0, k__cospi_m29_p03);
- const __m256i out_03_3 = _mm256_madd_epi16(out_29_1, k__cospi_m29_p03);
- const __m256i out_19_2 = _mm256_madd_epi16(out_13_0, k__cospi_m13_p19);
- const __m256i out_19_3 = _mm256_madd_epi16(out_13_1, k__cospi_m13_p19);
- const __m256i out_11_2 = _mm256_madd_epi16(out_21_0, k__cospi_m21_p11);
- const __m256i out_11_3 = _mm256_madd_epi16(out_21_1, k__cospi_m21_p11);
- const __m256i out_27_2 = _mm256_madd_epi16(out_05_0, k__cospi_m05_p27);
- const __m256i out_27_3 = _mm256_madd_epi16(out_05_1, k__cospi_m05_p27);
- // dct_const_round_shift
- const __m256i out_05_4 = _mm256_add_epi32(out_05_2, k__DCT_CONST_ROUNDING);
- const __m256i out_05_5 = _mm256_add_epi32(out_05_3, k__DCT_CONST_ROUNDING);
- const __m256i out_21_4 = _mm256_add_epi32(out_21_2, k__DCT_CONST_ROUNDING);
- const __m256i out_21_5 = _mm256_add_epi32(out_21_3, k__DCT_CONST_ROUNDING);
- const __m256i out_13_4 = _mm256_add_epi32(out_13_2, k__DCT_CONST_ROUNDING);
- const __m256i out_13_5 = _mm256_add_epi32(out_13_3, k__DCT_CONST_ROUNDING);
- const __m256i out_29_4 = _mm256_add_epi32(out_29_2, k__DCT_CONST_ROUNDING);
- const __m256i out_29_5 = _mm256_add_epi32(out_29_3, k__DCT_CONST_ROUNDING);
- const __m256i out_03_4 = _mm256_add_epi32(out_03_2, k__DCT_CONST_ROUNDING);
- const __m256i out_03_5 = _mm256_add_epi32(out_03_3, k__DCT_CONST_ROUNDING);
- const __m256i out_19_4 = _mm256_add_epi32(out_19_2, k__DCT_CONST_ROUNDING);
- const __m256i out_19_5 = _mm256_add_epi32(out_19_3, k__DCT_CONST_ROUNDING);
- const __m256i out_11_4 = _mm256_add_epi32(out_11_2, k__DCT_CONST_ROUNDING);
- const __m256i out_11_5 = _mm256_add_epi32(out_11_3, k__DCT_CONST_ROUNDING);
- const __m256i out_27_4 = _mm256_add_epi32(out_27_2, k__DCT_CONST_ROUNDING);
- const __m256i out_27_5 = _mm256_add_epi32(out_27_3, k__DCT_CONST_ROUNDING);
- const __m256i out_05_6 = _mm256_srai_epi32(out_05_4, DCT_CONST_BITS);
- const __m256i out_05_7 = _mm256_srai_epi32(out_05_5, DCT_CONST_BITS);
- const __m256i out_21_6 = _mm256_srai_epi32(out_21_4, DCT_CONST_BITS);
- const __m256i out_21_7 = _mm256_srai_epi32(out_21_5, DCT_CONST_BITS);
- const __m256i out_13_6 = _mm256_srai_epi32(out_13_4, DCT_CONST_BITS);
- const __m256i out_13_7 = _mm256_srai_epi32(out_13_5, DCT_CONST_BITS);
- const __m256i out_29_6 = _mm256_srai_epi32(out_29_4, DCT_CONST_BITS);
- const __m256i out_29_7 = _mm256_srai_epi32(out_29_5, DCT_CONST_BITS);
- const __m256i out_03_6 = _mm256_srai_epi32(out_03_4, DCT_CONST_BITS);
- const __m256i out_03_7 = _mm256_srai_epi32(out_03_5, DCT_CONST_BITS);
- const __m256i out_19_6 = _mm256_srai_epi32(out_19_4, DCT_CONST_BITS);
- const __m256i out_19_7 = _mm256_srai_epi32(out_19_5, DCT_CONST_BITS);
- const __m256i out_11_6 = _mm256_srai_epi32(out_11_4, DCT_CONST_BITS);
- const __m256i out_11_7 = _mm256_srai_epi32(out_11_5, DCT_CONST_BITS);
- const __m256i out_27_6 = _mm256_srai_epi32(out_27_4, DCT_CONST_BITS);
- const __m256i out_27_7 = _mm256_srai_epi32(out_27_5, DCT_CONST_BITS);
- // Combine
- out[ 5] = _mm256_packs_epi32(out_05_6, out_05_7);
- out[21] = _mm256_packs_epi32(out_21_6, out_21_7);
- out[13] = _mm256_packs_epi32(out_13_6, out_13_7);
- out[29] = _mm256_packs_epi32(out_29_6, out_29_7);
- out[ 3] = _mm256_packs_epi32(out_03_6, out_03_7);
- out[19] = _mm256_packs_epi32(out_19_6, out_19_7);
- out[11] = _mm256_packs_epi32(out_11_6, out_11_7);
- out[27] = _mm256_packs_epi32(out_27_6, out_27_7);
- }
-#if FDCT32x32_HIGH_PRECISION
- } else {
- __m256i lstep1[64], lstep2[64], lstep3[64];
- __m256i u[32], v[32], sign[16];
- const __m256i K32One = _mm256_set_epi32(1, 1, 1, 1, 1, 1, 1, 1);
- // start using 32-bit operations
- // stage 3
- {
- // expanding to 32-bit length priori to addition operations
- lstep2[ 0] = _mm256_unpacklo_epi16(step2[ 0], kZero);
- lstep2[ 1] = _mm256_unpackhi_epi16(step2[ 0], kZero);
- lstep2[ 2] = _mm256_unpacklo_epi16(step2[ 1], kZero);
- lstep2[ 3] = _mm256_unpackhi_epi16(step2[ 1], kZero);
- lstep2[ 4] = _mm256_unpacklo_epi16(step2[ 2], kZero);
- lstep2[ 5] = _mm256_unpackhi_epi16(step2[ 2], kZero);
- lstep2[ 6] = _mm256_unpacklo_epi16(step2[ 3], kZero);
- lstep2[ 7] = _mm256_unpackhi_epi16(step2[ 3], kZero);
- lstep2[ 8] = _mm256_unpacklo_epi16(step2[ 4], kZero);
- lstep2[ 9] = _mm256_unpackhi_epi16(step2[ 4], kZero);
- lstep2[10] = _mm256_unpacklo_epi16(step2[ 5], kZero);
- lstep2[11] = _mm256_unpackhi_epi16(step2[ 5], kZero);
- lstep2[12] = _mm256_unpacklo_epi16(step2[ 6], kZero);
- lstep2[13] = _mm256_unpackhi_epi16(step2[ 6], kZero);
- lstep2[14] = _mm256_unpacklo_epi16(step2[ 7], kZero);
- lstep2[15] = _mm256_unpackhi_epi16(step2[ 7], kZero);
- lstep2[ 0] = _mm256_madd_epi16(lstep2[ 0], kOne);
- lstep2[ 1] = _mm256_madd_epi16(lstep2[ 1], kOne);
- lstep2[ 2] = _mm256_madd_epi16(lstep2[ 2], kOne);
- lstep2[ 3] = _mm256_madd_epi16(lstep2[ 3], kOne);
- lstep2[ 4] = _mm256_madd_epi16(lstep2[ 4], kOne);
- lstep2[ 5] = _mm256_madd_epi16(lstep2[ 5], kOne);
- lstep2[ 6] = _mm256_madd_epi16(lstep2[ 6], kOne);
- lstep2[ 7] = _mm256_madd_epi16(lstep2[ 7], kOne);
- lstep2[ 8] = _mm256_madd_epi16(lstep2[ 8], kOne);
- lstep2[ 9] = _mm256_madd_epi16(lstep2[ 9], kOne);
- lstep2[10] = _mm256_madd_epi16(lstep2[10], kOne);
- lstep2[11] = _mm256_madd_epi16(lstep2[11], kOne);
- lstep2[12] = _mm256_madd_epi16(lstep2[12], kOne);
- lstep2[13] = _mm256_madd_epi16(lstep2[13], kOne);
- lstep2[14] = _mm256_madd_epi16(lstep2[14], kOne);
- lstep2[15] = _mm256_madd_epi16(lstep2[15], kOne);
-
- lstep3[ 0] = _mm256_add_epi32(lstep2[14], lstep2[ 0]);
- lstep3[ 1] = _mm256_add_epi32(lstep2[15], lstep2[ 1]);
- lstep3[ 2] = _mm256_add_epi32(lstep2[12], lstep2[ 2]);
- lstep3[ 3] = _mm256_add_epi32(lstep2[13], lstep2[ 3]);
- lstep3[ 4] = _mm256_add_epi32(lstep2[10], lstep2[ 4]);
- lstep3[ 5] = _mm256_add_epi32(lstep2[11], lstep2[ 5]);
- lstep3[ 6] = _mm256_add_epi32(lstep2[ 8], lstep2[ 6]);
- lstep3[ 7] = _mm256_add_epi32(lstep2[ 9], lstep2[ 7]);
- lstep3[ 8] = _mm256_sub_epi32(lstep2[ 6], lstep2[ 8]);
- lstep3[ 9] = _mm256_sub_epi32(lstep2[ 7], lstep2[ 9]);
- lstep3[10] = _mm256_sub_epi32(lstep2[ 4], lstep2[10]);
- lstep3[11] = _mm256_sub_epi32(lstep2[ 5], lstep2[11]);
- lstep3[12] = _mm256_sub_epi32(lstep2[ 2], lstep2[12]);
- lstep3[13] = _mm256_sub_epi32(lstep2[ 3], lstep2[13]);
- lstep3[14] = _mm256_sub_epi32(lstep2[ 0], lstep2[14]);
- lstep3[15] = _mm256_sub_epi32(lstep2[ 1], lstep2[15]);
- }
- {
- const __m256i s3_10_0 = _mm256_unpacklo_epi16(step2[13], step2[10]);
- const __m256i s3_10_1 = _mm256_unpackhi_epi16(step2[13], step2[10]);
- const __m256i s3_11_0 = _mm256_unpacklo_epi16(step2[12], step2[11]);
- const __m256i s3_11_1 = _mm256_unpackhi_epi16(step2[12], step2[11]);
- const __m256i s3_10_2 = _mm256_madd_epi16(s3_10_0, k__cospi_p16_m16);
- const __m256i s3_10_3 = _mm256_madd_epi16(s3_10_1, k__cospi_p16_m16);
- const __m256i s3_11_2 = _mm256_madd_epi16(s3_11_0, k__cospi_p16_m16);
- const __m256i s3_11_3 = _mm256_madd_epi16(s3_11_1, k__cospi_p16_m16);
- const __m256i s3_12_2 = _mm256_madd_epi16(s3_11_0, k__cospi_p16_p16);
- const __m256i s3_12_3 = _mm256_madd_epi16(s3_11_1, k__cospi_p16_p16);
- const __m256i s3_13_2 = _mm256_madd_epi16(s3_10_0, k__cospi_p16_p16);
- const __m256i s3_13_3 = _mm256_madd_epi16(s3_10_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m256i s3_10_4 = _mm256_add_epi32(s3_10_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_10_5 = _mm256_add_epi32(s3_10_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_11_4 = _mm256_add_epi32(s3_11_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_11_5 = _mm256_add_epi32(s3_11_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_12_4 = _mm256_add_epi32(s3_12_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_12_5 = _mm256_add_epi32(s3_12_3, k__DCT_CONST_ROUNDING);
- const __m256i s3_13_4 = _mm256_add_epi32(s3_13_2, k__DCT_CONST_ROUNDING);
- const __m256i s3_13_5 = _mm256_add_epi32(s3_13_3, k__DCT_CONST_ROUNDING);
- lstep3[20] = _mm256_srai_epi32(s3_10_4, DCT_CONST_BITS);
- lstep3[21] = _mm256_srai_epi32(s3_10_5, DCT_CONST_BITS);
- lstep3[22] = _mm256_srai_epi32(s3_11_4, DCT_CONST_BITS);
- lstep3[23] = _mm256_srai_epi32(s3_11_5, DCT_CONST_BITS);
- lstep3[24] = _mm256_srai_epi32(s3_12_4, DCT_CONST_BITS);
- lstep3[25] = _mm256_srai_epi32(s3_12_5, DCT_CONST_BITS);
- lstep3[26] = _mm256_srai_epi32(s3_13_4, DCT_CONST_BITS);
- lstep3[27] = _mm256_srai_epi32(s3_13_5, DCT_CONST_BITS);
- }
- {
- lstep2[40] = _mm256_unpacklo_epi16(step2[20], kZero);
- lstep2[41] = _mm256_unpackhi_epi16(step2[20], kZero);
- lstep2[42] = _mm256_unpacklo_epi16(step2[21], kZero);
- lstep2[43] = _mm256_unpackhi_epi16(step2[21], kZero);
- lstep2[44] = _mm256_unpacklo_epi16(step2[22], kZero);
- lstep2[45] = _mm256_unpackhi_epi16(step2[22], kZero);
- lstep2[46] = _mm256_unpacklo_epi16(step2[23], kZero);
- lstep2[47] = _mm256_unpackhi_epi16(step2[23], kZero);
- lstep2[48] = _mm256_unpacklo_epi16(step2[24], kZero);
- lstep2[49] = _mm256_unpackhi_epi16(step2[24], kZero);
- lstep2[50] = _mm256_unpacklo_epi16(step2[25], kZero);
- lstep2[51] = _mm256_unpackhi_epi16(step2[25], kZero);
- lstep2[52] = _mm256_unpacklo_epi16(step2[26], kZero);
- lstep2[53] = _mm256_unpackhi_epi16(step2[26], kZero);
- lstep2[54] = _mm256_unpacklo_epi16(step2[27], kZero);
- lstep2[55] = _mm256_unpackhi_epi16(step2[27], kZero);
- lstep2[40] = _mm256_madd_epi16(lstep2[40], kOne);
- lstep2[41] = _mm256_madd_epi16(lstep2[41], kOne);
- lstep2[42] = _mm256_madd_epi16(lstep2[42], kOne);
- lstep2[43] = _mm256_madd_epi16(lstep2[43], kOne);
- lstep2[44] = _mm256_madd_epi16(lstep2[44], kOne);
- lstep2[45] = _mm256_madd_epi16(lstep2[45], kOne);
- lstep2[46] = _mm256_madd_epi16(lstep2[46], kOne);
- lstep2[47] = _mm256_madd_epi16(lstep2[47], kOne);
- lstep2[48] = _mm256_madd_epi16(lstep2[48], kOne);
- lstep2[49] = _mm256_madd_epi16(lstep2[49], kOne);
- lstep2[50] = _mm256_madd_epi16(lstep2[50], kOne);
- lstep2[51] = _mm256_madd_epi16(lstep2[51], kOne);
- lstep2[52] = _mm256_madd_epi16(lstep2[52], kOne);
- lstep2[53] = _mm256_madd_epi16(lstep2[53], kOne);
- lstep2[54] = _mm256_madd_epi16(lstep2[54], kOne);
- lstep2[55] = _mm256_madd_epi16(lstep2[55], kOne);
-
- lstep1[32] = _mm256_unpacklo_epi16(step1[16], kZero);
- lstep1[33] = _mm256_unpackhi_epi16(step1[16], kZero);
- lstep1[34] = _mm256_unpacklo_epi16(step1[17], kZero);
- lstep1[35] = _mm256_unpackhi_epi16(step1[17], kZero);
- lstep1[36] = _mm256_unpacklo_epi16(step1[18], kZero);
- lstep1[37] = _mm256_unpackhi_epi16(step1[18], kZero);
- lstep1[38] = _mm256_unpacklo_epi16(step1[19], kZero);
- lstep1[39] = _mm256_unpackhi_epi16(step1[19], kZero);
- lstep1[56] = _mm256_unpacklo_epi16(step1[28], kZero);
- lstep1[57] = _mm256_unpackhi_epi16(step1[28], kZero);
- lstep1[58] = _mm256_unpacklo_epi16(step1[29], kZero);
- lstep1[59] = _mm256_unpackhi_epi16(step1[29], kZero);
- lstep1[60] = _mm256_unpacklo_epi16(step1[30], kZero);
- lstep1[61] = _mm256_unpackhi_epi16(step1[30], kZero);
- lstep1[62] = _mm256_unpacklo_epi16(step1[31], kZero);
- lstep1[63] = _mm256_unpackhi_epi16(step1[31], kZero);
- lstep1[32] = _mm256_madd_epi16(lstep1[32], kOne);
- lstep1[33] = _mm256_madd_epi16(lstep1[33], kOne);
- lstep1[34] = _mm256_madd_epi16(lstep1[34], kOne);
- lstep1[35] = _mm256_madd_epi16(lstep1[35], kOne);
- lstep1[36] = _mm256_madd_epi16(lstep1[36], kOne);
- lstep1[37] = _mm256_madd_epi16(lstep1[37], kOne);
- lstep1[38] = _mm256_madd_epi16(lstep1[38], kOne);
- lstep1[39] = _mm256_madd_epi16(lstep1[39], kOne);
- lstep1[56] = _mm256_madd_epi16(lstep1[56], kOne);
- lstep1[57] = _mm256_madd_epi16(lstep1[57], kOne);
- lstep1[58] = _mm256_madd_epi16(lstep1[58], kOne);
- lstep1[59] = _mm256_madd_epi16(lstep1[59], kOne);
- lstep1[60] = _mm256_madd_epi16(lstep1[60], kOne);
- lstep1[61] = _mm256_madd_epi16(lstep1[61], kOne);
- lstep1[62] = _mm256_madd_epi16(lstep1[62], kOne);
- lstep1[63] = _mm256_madd_epi16(lstep1[63], kOne);
-
- lstep3[32] = _mm256_add_epi32(lstep2[46], lstep1[32]);
- lstep3[33] = _mm256_add_epi32(lstep2[47], lstep1[33]);
-
- lstep3[34] = _mm256_add_epi32(lstep2[44], lstep1[34]);
- lstep3[35] = _mm256_add_epi32(lstep2[45], lstep1[35]);
- lstep3[36] = _mm256_add_epi32(lstep2[42], lstep1[36]);
- lstep3[37] = _mm256_add_epi32(lstep2[43], lstep1[37]);
- lstep3[38] = _mm256_add_epi32(lstep2[40], lstep1[38]);
- lstep3[39] = _mm256_add_epi32(lstep2[41], lstep1[39]);
- lstep3[40] = _mm256_sub_epi32(lstep1[38], lstep2[40]);
- lstep3[41] = _mm256_sub_epi32(lstep1[39], lstep2[41]);
- lstep3[42] = _mm256_sub_epi32(lstep1[36], lstep2[42]);
- lstep3[43] = _mm256_sub_epi32(lstep1[37], lstep2[43]);
- lstep3[44] = _mm256_sub_epi32(lstep1[34], lstep2[44]);
- lstep3[45] = _mm256_sub_epi32(lstep1[35], lstep2[45]);
- lstep3[46] = _mm256_sub_epi32(lstep1[32], lstep2[46]);
- lstep3[47] = _mm256_sub_epi32(lstep1[33], lstep2[47]);
- lstep3[48] = _mm256_sub_epi32(lstep1[62], lstep2[48]);
- lstep3[49] = _mm256_sub_epi32(lstep1[63], lstep2[49]);
- lstep3[50] = _mm256_sub_epi32(lstep1[60], lstep2[50]);
- lstep3[51] = _mm256_sub_epi32(lstep1[61], lstep2[51]);
- lstep3[52] = _mm256_sub_epi32(lstep1[58], lstep2[52]);
- lstep3[53] = _mm256_sub_epi32(lstep1[59], lstep2[53]);
- lstep3[54] = _mm256_sub_epi32(lstep1[56], lstep2[54]);
- lstep3[55] = _mm256_sub_epi32(lstep1[57], lstep2[55]);
- lstep3[56] = _mm256_add_epi32(lstep2[54], lstep1[56]);
- lstep3[57] = _mm256_add_epi32(lstep2[55], lstep1[57]);
- lstep3[58] = _mm256_add_epi32(lstep2[52], lstep1[58]);
- lstep3[59] = _mm256_add_epi32(lstep2[53], lstep1[59]);
- lstep3[60] = _mm256_add_epi32(lstep2[50], lstep1[60]);
- lstep3[61] = _mm256_add_epi32(lstep2[51], lstep1[61]);
- lstep3[62] = _mm256_add_epi32(lstep2[48], lstep1[62]);
- lstep3[63] = _mm256_add_epi32(lstep2[49], lstep1[63]);
- }
-
- // stage 4
- {
- // expanding to 32-bit length priori to addition operations
- lstep2[16] = _mm256_unpacklo_epi16(step2[ 8], kZero);
- lstep2[17] = _mm256_unpackhi_epi16(step2[ 8], kZero);
- lstep2[18] = _mm256_unpacklo_epi16(step2[ 9], kZero);
- lstep2[19] = _mm256_unpackhi_epi16(step2[ 9], kZero);
- lstep2[28] = _mm256_unpacklo_epi16(step2[14], kZero);
- lstep2[29] = _mm256_unpackhi_epi16(step2[14], kZero);
- lstep2[30] = _mm256_unpacklo_epi16(step2[15], kZero);
- lstep2[31] = _mm256_unpackhi_epi16(step2[15], kZero);
- lstep2[16] = _mm256_madd_epi16(lstep2[16], kOne);
- lstep2[17] = _mm256_madd_epi16(lstep2[17], kOne);
- lstep2[18] = _mm256_madd_epi16(lstep2[18], kOne);
- lstep2[19] = _mm256_madd_epi16(lstep2[19], kOne);
- lstep2[28] = _mm256_madd_epi16(lstep2[28], kOne);
- lstep2[29] = _mm256_madd_epi16(lstep2[29], kOne);
- lstep2[30] = _mm256_madd_epi16(lstep2[30], kOne);
- lstep2[31] = _mm256_madd_epi16(lstep2[31], kOne);
-
- lstep1[ 0] = _mm256_add_epi32(lstep3[ 6], lstep3[ 0]);
- lstep1[ 1] = _mm256_add_epi32(lstep3[ 7], lstep3[ 1]);
- lstep1[ 2] = _mm256_add_epi32(lstep3[ 4], lstep3[ 2]);
- lstep1[ 3] = _mm256_add_epi32(lstep3[ 5], lstep3[ 3]);
- lstep1[ 4] = _mm256_sub_epi32(lstep3[ 2], lstep3[ 4]);
- lstep1[ 5] = _mm256_sub_epi32(lstep3[ 3], lstep3[ 5]);
- lstep1[ 6] = _mm256_sub_epi32(lstep3[ 0], lstep3[ 6]);
- lstep1[ 7] = _mm256_sub_epi32(lstep3[ 1], lstep3[ 7]);
- lstep1[16] = _mm256_add_epi32(lstep3[22], lstep2[16]);
- lstep1[17] = _mm256_add_epi32(lstep3[23], lstep2[17]);
- lstep1[18] = _mm256_add_epi32(lstep3[20], lstep2[18]);
- lstep1[19] = _mm256_add_epi32(lstep3[21], lstep2[19]);
- lstep1[20] = _mm256_sub_epi32(lstep2[18], lstep3[20]);
- lstep1[21] = _mm256_sub_epi32(lstep2[19], lstep3[21]);
- lstep1[22] = _mm256_sub_epi32(lstep2[16], lstep3[22]);
- lstep1[23] = _mm256_sub_epi32(lstep2[17], lstep3[23]);
- lstep1[24] = _mm256_sub_epi32(lstep2[30], lstep3[24]);
- lstep1[25] = _mm256_sub_epi32(lstep2[31], lstep3[25]);
- lstep1[26] = _mm256_sub_epi32(lstep2[28], lstep3[26]);
- lstep1[27] = _mm256_sub_epi32(lstep2[29], lstep3[27]);
- lstep1[28] = _mm256_add_epi32(lstep3[26], lstep2[28]);
- lstep1[29] = _mm256_add_epi32(lstep3[27], lstep2[29]);
- lstep1[30] = _mm256_add_epi32(lstep3[24], lstep2[30]);
- lstep1[31] = _mm256_add_epi32(lstep3[25], lstep2[31]);
- }
- {
- // to be continued...
- //
- const __m256i k32_p16_p16 = pair256_set_epi32(cospi_16_64, cospi_16_64);
- const __m256i k32_p16_m16 = pair256_set_epi32(cospi_16_64, -cospi_16_64);
-
- u[0] = _mm256_unpacklo_epi32(lstep3[12], lstep3[10]);
- u[1] = _mm256_unpackhi_epi32(lstep3[12], lstep3[10]);
- u[2] = _mm256_unpacklo_epi32(lstep3[13], lstep3[11]);
- u[3] = _mm256_unpackhi_epi32(lstep3[13], lstep3[11]);
-
- // TODO(jingning): manually inline k_madd_epi32_avx2_ to further hide
- // instruction latency.
- v[ 0] = k_madd_epi32_avx2(u[0], k32_p16_m16);
- v[ 1] = k_madd_epi32_avx2(u[1], k32_p16_m16);
- v[ 2] = k_madd_epi32_avx2(u[2], k32_p16_m16);
- v[ 3] = k_madd_epi32_avx2(u[3], k32_p16_m16);
- v[ 4] = k_madd_epi32_avx2(u[0], k32_p16_p16);
- v[ 5] = k_madd_epi32_avx2(u[1], k32_p16_p16);
- v[ 6] = k_madd_epi32_avx2(u[2], k32_p16_p16);
- v[ 7] = k_madd_epi32_avx2(u[3], k32_p16_p16);
-
- u[0] = k_packs_epi64_avx2(v[0], v[1]);
- u[1] = k_packs_epi64_avx2(v[2], v[3]);
- u[2] = k_packs_epi64_avx2(v[4], v[5]);
- u[3] = k_packs_epi64_avx2(v[6], v[7]);
-
- v[0] = _mm256_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm256_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm256_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm256_add_epi32(u[3], k__DCT_CONST_ROUNDING);
-
- lstep1[10] = _mm256_srai_epi32(v[0], DCT_CONST_BITS);
- lstep1[11] = _mm256_srai_epi32(v[1], DCT_CONST_BITS);
- lstep1[12] = _mm256_srai_epi32(v[2], DCT_CONST_BITS);
- lstep1[13] = _mm256_srai_epi32(v[3], DCT_CONST_BITS);
- }
- {
- const __m256i k32_m08_p24 = pair256_set_epi32(-cospi_8_64, cospi_24_64);
- const __m256i k32_m24_m08 = pair256_set_epi32(-cospi_24_64, -cospi_8_64);
- const __m256i k32_p24_p08 = pair256_set_epi32(cospi_24_64, cospi_8_64);
-
- u[ 0] = _mm256_unpacklo_epi32(lstep3[36], lstep3[58]);
- u[ 1] = _mm256_unpackhi_epi32(lstep3[36], lstep3[58]);
- u[ 2] = _mm256_unpacklo_epi32(lstep3[37], lstep3[59]);
- u[ 3] = _mm256_unpackhi_epi32(lstep3[37], lstep3[59]);
- u[ 4] = _mm256_unpacklo_epi32(lstep3[38], lstep3[56]);
- u[ 5] = _mm256_unpackhi_epi32(lstep3[38], lstep3[56]);
- u[ 6] = _mm256_unpacklo_epi32(lstep3[39], lstep3[57]);
- u[ 7] = _mm256_unpackhi_epi32(lstep3[39], lstep3[57]);
- u[ 8] = _mm256_unpacklo_epi32(lstep3[40], lstep3[54]);
- u[ 9] = _mm256_unpackhi_epi32(lstep3[40], lstep3[54]);
- u[10] = _mm256_unpacklo_epi32(lstep3[41], lstep3[55]);
- u[11] = _mm256_unpackhi_epi32(lstep3[41], lstep3[55]);
- u[12] = _mm256_unpacklo_epi32(lstep3[42], lstep3[52]);
- u[13] = _mm256_unpackhi_epi32(lstep3[42], lstep3[52]);
- u[14] = _mm256_unpacklo_epi32(lstep3[43], lstep3[53]);
- u[15] = _mm256_unpackhi_epi32(lstep3[43], lstep3[53]);
-
- v[ 0] = k_madd_epi32_avx2(u[ 0], k32_m08_p24);
- v[ 1] = k_madd_epi32_avx2(u[ 1], k32_m08_p24);
- v[ 2] = k_madd_epi32_avx2(u[ 2], k32_m08_p24);
- v[ 3] = k_madd_epi32_avx2(u[ 3], k32_m08_p24);
- v[ 4] = k_madd_epi32_avx2(u[ 4], k32_m08_p24);
- v[ 5] = k_madd_epi32_avx2(u[ 5], k32_m08_p24);
- v[ 6] = k_madd_epi32_avx2(u[ 6], k32_m08_p24);
- v[ 7] = k_madd_epi32_avx2(u[ 7], k32_m08_p24);
- v[ 8] = k_madd_epi32_avx2(u[ 8], k32_m24_m08);
- v[ 9] = k_madd_epi32_avx2(u[ 9], k32_m24_m08);
- v[10] = k_madd_epi32_avx2(u[10], k32_m24_m08);
- v[11] = k_madd_epi32_avx2(u[11], k32_m24_m08);
- v[12] = k_madd_epi32_avx2(u[12], k32_m24_m08);
- v[13] = k_madd_epi32_avx2(u[13], k32_m24_m08);
- v[14] = k_madd_epi32_avx2(u[14], k32_m24_m08);
- v[15] = k_madd_epi32_avx2(u[15], k32_m24_m08);
- v[16] = k_madd_epi32_avx2(u[12], k32_m08_p24);
- v[17] = k_madd_epi32_avx2(u[13], k32_m08_p24);
- v[18] = k_madd_epi32_avx2(u[14], k32_m08_p24);
- v[19] = k_madd_epi32_avx2(u[15], k32_m08_p24);
- v[20] = k_madd_epi32_avx2(u[ 8], k32_m08_p24);
- v[21] = k_madd_epi32_avx2(u[ 9], k32_m08_p24);
- v[22] = k_madd_epi32_avx2(u[10], k32_m08_p24);
- v[23] = k_madd_epi32_avx2(u[11], k32_m08_p24);
- v[24] = k_madd_epi32_avx2(u[ 4], k32_p24_p08);
- v[25] = k_madd_epi32_avx2(u[ 5], k32_p24_p08);
- v[26] = k_madd_epi32_avx2(u[ 6], k32_p24_p08);
- v[27] = k_madd_epi32_avx2(u[ 7], k32_p24_p08);
- v[28] = k_madd_epi32_avx2(u[ 0], k32_p24_p08);
- v[29] = k_madd_epi32_avx2(u[ 1], k32_p24_p08);
- v[30] = k_madd_epi32_avx2(u[ 2], k32_p24_p08);
- v[31] = k_madd_epi32_avx2(u[ 3], k32_p24_p08);
-
- u[ 0] = k_packs_epi64_avx2(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64_avx2(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64_avx2(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64_avx2(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64_avx2(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64_avx2(v[10], v[11]);
- u[ 6] = k_packs_epi64_avx2(v[12], v[13]);
- u[ 7] = k_packs_epi64_avx2(v[14], v[15]);
- u[ 8] = k_packs_epi64_avx2(v[16], v[17]);
- u[ 9] = k_packs_epi64_avx2(v[18], v[19]);
- u[10] = k_packs_epi64_avx2(v[20], v[21]);
- u[11] = k_packs_epi64_avx2(v[22], v[23]);
- u[12] = k_packs_epi64_avx2(v[24], v[25]);
- u[13] = k_packs_epi64_avx2(v[26], v[27]);
- u[14] = k_packs_epi64_avx2(v[28], v[29]);
- u[15] = k_packs_epi64_avx2(v[30], v[31]);
-
- v[ 0] = _mm256_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm256_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm256_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm256_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm256_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm256_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm256_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm256_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm256_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm256_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm256_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm256_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm256_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm256_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm256_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm256_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- lstep1[36] = _mm256_srai_epi32(v[ 0], DCT_CONST_BITS);
- lstep1[37] = _mm256_srai_epi32(v[ 1], DCT_CONST_BITS);
- lstep1[38] = _mm256_srai_epi32(v[ 2], DCT_CONST_BITS);
- lstep1[39] = _mm256_srai_epi32(v[ 3], DCT_CONST_BITS);
- lstep1[40] = _mm256_srai_epi32(v[ 4], DCT_CONST_BITS);
- lstep1[41] = _mm256_srai_epi32(v[ 5], DCT_CONST_BITS);
- lstep1[42] = _mm256_srai_epi32(v[ 6], DCT_CONST_BITS);
- lstep1[43] = _mm256_srai_epi32(v[ 7], DCT_CONST_BITS);
- lstep1[52] = _mm256_srai_epi32(v[ 8], DCT_CONST_BITS);
- lstep1[53] = _mm256_srai_epi32(v[ 9], DCT_CONST_BITS);
- lstep1[54] = _mm256_srai_epi32(v[10], DCT_CONST_BITS);
- lstep1[55] = _mm256_srai_epi32(v[11], DCT_CONST_BITS);
- lstep1[56] = _mm256_srai_epi32(v[12], DCT_CONST_BITS);
- lstep1[57] = _mm256_srai_epi32(v[13], DCT_CONST_BITS);
- lstep1[58] = _mm256_srai_epi32(v[14], DCT_CONST_BITS);
- lstep1[59] = _mm256_srai_epi32(v[15], DCT_CONST_BITS);
- }
- // stage 5
- {
- lstep2[ 8] = _mm256_add_epi32(lstep1[10], lstep3[ 8]);
- lstep2[ 9] = _mm256_add_epi32(lstep1[11], lstep3[ 9]);
- lstep2[10] = _mm256_sub_epi32(lstep3[ 8], lstep1[10]);
- lstep2[11] = _mm256_sub_epi32(lstep3[ 9], lstep1[11]);
- lstep2[12] = _mm256_sub_epi32(lstep3[14], lstep1[12]);
- lstep2[13] = _mm256_sub_epi32(lstep3[15], lstep1[13]);
- lstep2[14] = _mm256_add_epi32(lstep1[12], lstep3[14]);
- lstep2[15] = _mm256_add_epi32(lstep1[13], lstep3[15]);
- }
- {
- const __m256i k32_p16_p16 = pair256_set_epi32(cospi_16_64, cospi_16_64);
- const __m256i k32_p16_m16 = pair256_set_epi32(cospi_16_64, -cospi_16_64);
- const __m256i k32_p24_p08 = pair256_set_epi32(cospi_24_64, cospi_8_64);
- const __m256i k32_m08_p24 = pair256_set_epi32(-cospi_8_64, cospi_24_64);
-
- u[0] = _mm256_unpacklo_epi32(lstep1[0], lstep1[2]);
- u[1] = _mm256_unpackhi_epi32(lstep1[0], lstep1[2]);
- u[2] = _mm256_unpacklo_epi32(lstep1[1], lstep1[3]);
- u[3] = _mm256_unpackhi_epi32(lstep1[1], lstep1[3]);
- u[4] = _mm256_unpacklo_epi32(lstep1[4], lstep1[6]);
- u[5] = _mm256_unpackhi_epi32(lstep1[4], lstep1[6]);
- u[6] = _mm256_unpacklo_epi32(lstep1[5], lstep1[7]);
- u[7] = _mm256_unpackhi_epi32(lstep1[5], lstep1[7]);
-
- // TODO(jingning): manually inline k_madd_epi32_avx2_ to further hide
- // instruction latency.
- v[ 0] = k_madd_epi32_avx2(u[0], k32_p16_p16);
- v[ 1] = k_madd_epi32_avx2(u[1], k32_p16_p16);
- v[ 2] = k_madd_epi32_avx2(u[2], k32_p16_p16);
- v[ 3] = k_madd_epi32_avx2(u[3], k32_p16_p16);
- v[ 4] = k_madd_epi32_avx2(u[0], k32_p16_m16);
- v[ 5] = k_madd_epi32_avx2(u[1], k32_p16_m16);
- v[ 6] = k_madd_epi32_avx2(u[2], k32_p16_m16);
- v[ 7] = k_madd_epi32_avx2(u[3], k32_p16_m16);
- v[ 8] = k_madd_epi32_avx2(u[4], k32_p24_p08);
- v[ 9] = k_madd_epi32_avx2(u[5], k32_p24_p08);
- v[10] = k_madd_epi32_avx2(u[6], k32_p24_p08);
- v[11] = k_madd_epi32_avx2(u[7], k32_p24_p08);
- v[12] = k_madd_epi32_avx2(u[4], k32_m08_p24);
- v[13] = k_madd_epi32_avx2(u[5], k32_m08_p24);
- v[14] = k_madd_epi32_avx2(u[6], k32_m08_p24);
- v[15] = k_madd_epi32_avx2(u[7], k32_m08_p24);
-
- u[0] = k_packs_epi64_avx2(v[0], v[1]);
- u[1] = k_packs_epi64_avx2(v[2], v[3]);
- u[2] = k_packs_epi64_avx2(v[4], v[5]);
- u[3] = k_packs_epi64_avx2(v[6], v[7]);
- u[4] = k_packs_epi64_avx2(v[8], v[9]);
- u[5] = k_packs_epi64_avx2(v[10], v[11]);
- u[6] = k_packs_epi64_avx2(v[12], v[13]);
- u[7] = k_packs_epi64_avx2(v[14], v[15]);
-
- v[0] = _mm256_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm256_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm256_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm256_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm256_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm256_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm256_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm256_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm256_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm256_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm256_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm256_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm256_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm256_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm256_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm256_srai_epi32(v[7], DCT_CONST_BITS);
-
- sign[0] = _mm256_cmpgt_epi32(kZero,u[0]);
- sign[1] = _mm256_cmpgt_epi32(kZero,u[1]);
- sign[2] = _mm256_cmpgt_epi32(kZero,u[2]);
- sign[3] = _mm256_cmpgt_epi32(kZero,u[3]);
- sign[4] = _mm256_cmpgt_epi32(kZero,u[4]);
- sign[5] = _mm256_cmpgt_epi32(kZero,u[5]);
- sign[6] = _mm256_cmpgt_epi32(kZero,u[6]);
- sign[7] = _mm256_cmpgt_epi32(kZero,u[7]);
-
- u[0] = _mm256_sub_epi32(u[0], sign[0]);
- u[1] = _mm256_sub_epi32(u[1], sign[1]);
- u[2] = _mm256_sub_epi32(u[2], sign[2]);
- u[3] = _mm256_sub_epi32(u[3], sign[3]);
- u[4] = _mm256_sub_epi32(u[4], sign[4]);
- u[5] = _mm256_sub_epi32(u[5], sign[5]);
- u[6] = _mm256_sub_epi32(u[6], sign[6]);
- u[7] = _mm256_sub_epi32(u[7], sign[7]);
-
- u[0] = _mm256_add_epi32(u[0], K32One);
- u[1] = _mm256_add_epi32(u[1], K32One);
- u[2] = _mm256_add_epi32(u[2], K32One);
- u[3] = _mm256_add_epi32(u[3], K32One);
- u[4] = _mm256_add_epi32(u[4], K32One);
- u[5] = _mm256_add_epi32(u[5], K32One);
- u[6] = _mm256_add_epi32(u[6], K32One);
- u[7] = _mm256_add_epi32(u[7], K32One);
-
- u[0] = _mm256_srai_epi32(u[0], 2);
- u[1] = _mm256_srai_epi32(u[1], 2);
- u[2] = _mm256_srai_epi32(u[2], 2);
- u[3] = _mm256_srai_epi32(u[3], 2);
- u[4] = _mm256_srai_epi32(u[4], 2);
- u[5] = _mm256_srai_epi32(u[5], 2);
- u[6] = _mm256_srai_epi32(u[6], 2);
- u[7] = _mm256_srai_epi32(u[7], 2);
-
- // Combine
- out[ 0] = _mm256_packs_epi32(u[0], u[1]);
- out[16] = _mm256_packs_epi32(u[2], u[3]);
- out[ 8] = _mm256_packs_epi32(u[4], u[5]);
- out[24] = _mm256_packs_epi32(u[6], u[7]);
- }
- {
- const __m256i k32_m08_p24 = pair256_set_epi32(-cospi_8_64, cospi_24_64);
- const __m256i k32_m24_m08 = pair256_set_epi32(-cospi_24_64, -cospi_8_64);
- const __m256i k32_p24_p08 = pair256_set_epi32(cospi_24_64, cospi_8_64);
-
- u[0] = _mm256_unpacklo_epi32(lstep1[18], lstep1[28]);
- u[1] = _mm256_unpackhi_epi32(lstep1[18], lstep1[28]);
- u[2] = _mm256_unpacklo_epi32(lstep1[19], lstep1[29]);
- u[3] = _mm256_unpackhi_epi32(lstep1[19], lstep1[29]);
- u[4] = _mm256_unpacklo_epi32(lstep1[20], lstep1[26]);
- u[5] = _mm256_unpackhi_epi32(lstep1[20], lstep1[26]);
- u[6] = _mm256_unpacklo_epi32(lstep1[21], lstep1[27]);
- u[7] = _mm256_unpackhi_epi32(lstep1[21], lstep1[27]);
-
- v[0] = k_madd_epi32_avx2(u[0], k32_m08_p24);
- v[1] = k_madd_epi32_avx2(u[1], k32_m08_p24);
- v[2] = k_madd_epi32_avx2(u[2], k32_m08_p24);
- v[3] = k_madd_epi32_avx2(u[3], k32_m08_p24);
- v[4] = k_madd_epi32_avx2(u[4], k32_m24_m08);
- v[5] = k_madd_epi32_avx2(u[5], k32_m24_m08);
- v[6] = k_madd_epi32_avx2(u[6], k32_m24_m08);
- v[7] = k_madd_epi32_avx2(u[7], k32_m24_m08);
- v[ 8] = k_madd_epi32_avx2(u[4], k32_m08_p24);
- v[ 9] = k_madd_epi32_avx2(u[5], k32_m08_p24);
- v[10] = k_madd_epi32_avx2(u[6], k32_m08_p24);
- v[11] = k_madd_epi32_avx2(u[7], k32_m08_p24);
- v[12] = k_madd_epi32_avx2(u[0], k32_p24_p08);
- v[13] = k_madd_epi32_avx2(u[1], k32_p24_p08);
- v[14] = k_madd_epi32_avx2(u[2], k32_p24_p08);
- v[15] = k_madd_epi32_avx2(u[3], k32_p24_p08);
-
- u[0] = k_packs_epi64_avx2(v[0], v[1]);
- u[1] = k_packs_epi64_avx2(v[2], v[3]);
- u[2] = k_packs_epi64_avx2(v[4], v[5]);
- u[3] = k_packs_epi64_avx2(v[6], v[7]);
- u[4] = k_packs_epi64_avx2(v[8], v[9]);
- u[5] = k_packs_epi64_avx2(v[10], v[11]);
- u[6] = k_packs_epi64_avx2(v[12], v[13]);
- u[7] = k_packs_epi64_avx2(v[14], v[15]);
-
- u[0] = _mm256_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm256_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm256_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm256_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm256_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm256_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm256_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm256_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- lstep2[18] = _mm256_srai_epi32(u[0], DCT_CONST_BITS);
- lstep2[19] = _mm256_srai_epi32(u[1], DCT_CONST_BITS);
- lstep2[20] = _mm256_srai_epi32(u[2], DCT_CONST_BITS);
- lstep2[21] = _mm256_srai_epi32(u[3], DCT_CONST_BITS);
- lstep2[26] = _mm256_srai_epi32(u[4], DCT_CONST_BITS);
- lstep2[27] = _mm256_srai_epi32(u[5], DCT_CONST_BITS);
- lstep2[28] = _mm256_srai_epi32(u[6], DCT_CONST_BITS);
- lstep2[29] = _mm256_srai_epi32(u[7], DCT_CONST_BITS);
- }
- {
- lstep2[32] = _mm256_add_epi32(lstep1[38], lstep3[32]);
- lstep2[33] = _mm256_add_epi32(lstep1[39], lstep3[33]);
- lstep2[34] = _mm256_add_epi32(lstep1[36], lstep3[34]);
- lstep2[35] = _mm256_add_epi32(lstep1[37], lstep3[35]);
- lstep2[36] = _mm256_sub_epi32(lstep3[34], lstep1[36]);
- lstep2[37] = _mm256_sub_epi32(lstep3[35], lstep1[37]);
- lstep2[38] = _mm256_sub_epi32(lstep3[32], lstep1[38]);
- lstep2[39] = _mm256_sub_epi32(lstep3[33], lstep1[39]);
- lstep2[40] = _mm256_sub_epi32(lstep3[46], lstep1[40]);
- lstep2[41] = _mm256_sub_epi32(lstep3[47], lstep1[41]);
- lstep2[42] = _mm256_sub_epi32(lstep3[44], lstep1[42]);
- lstep2[43] = _mm256_sub_epi32(lstep3[45], lstep1[43]);
- lstep2[44] = _mm256_add_epi32(lstep1[42], lstep3[44]);
- lstep2[45] = _mm256_add_epi32(lstep1[43], lstep3[45]);
- lstep2[46] = _mm256_add_epi32(lstep1[40], lstep3[46]);
- lstep2[47] = _mm256_add_epi32(lstep1[41], lstep3[47]);
- lstep2[48] = _mm256_add_epi32(lstep1[54], lstep3[48]);
- lstep2[49] = _mm256_add_epi32(lstep1[55], lstep3[49]);
- lstep2[50] = _mm256_add_epi32(lstep1[52], lstep3[50]);
- lstep2[51] = _mm256_add_epi32(lstep1[53], lstep3[51]);
- lstep2[52] = _mm256_sub_epi32(lstep3[50], lstep1[52]);
- lstep2[53] = _mm256_sub_epi32(lstep3[51], lstep1[53]);
- lstep2[54] = _mm256_sub_epi32(lstep3[48], lstep1[54]);
- lstep2[55] = _mm256_sub_epi32(lstep3[49], lstep1[55]);
- lstep2[56] = _mm256_sub_epi32(lstep3[62], lstep1[56]);
- lstep2[57] = _mm256_sub_epi32(lstep3[63], lstep1[57]);
- lstep2[58] = _mm256_sub_epi32(lstep3[60], lstep1[58]);
- lstep2[59] = _mm256_sub_epi32(lstep3[61], lstep1[59]);
- lstep2[60] = _mm256_add_epi32(lstep1[58], lstep3[60]);
- lstep2[61] = _mm256_add_epi32(lstep1[59], lstep3[61]);
- lstep2[62] = _mm256_add_epi32(lstep1[56], lstep3[62]);
- lstep2[63] = _mm256_add_epi32(lstep1[57], lstep3[63]);
- }
- // stage 6
- {
- const __m256i k32_p28_p04 = pair256_set_epi32(cospi_28_64, cospi_4_64);
- const __m256i k32_p12_p20 = pair256_set_epi32(cospi_12_64, cospi_20_64);
- const __m256i k32_m20_p12 = pair256_set_epi32(-cospi_20_64, cospi_12_64);
- const __m256i k32_m04_p28 = pair256_set_epi32(-cospi_4_64, cospi_28_64);
-
- u[0] = _mm256_unpacklo_epi32(lstep2[ 8], lstep2[14]);
- u[1] = _mm256_unpackhi_epi32(lstep2[ 8], lstep2[14]);
- u[2] = _mm256_unpacklo_epi32(lstep2[ 9], lstep2[15]);
- u[3] = _mm256_unpackhi_epi32(lstep2[ 9], lstep2[15]);
- u[4] = _mm256_unpacklo_epi32(lstep2[10], lstep2[12]);
- u[5] = _mm256_unpackhi_epi32(lstep2[10], lstep2[12]);
- u[6] = _mm256_unpacklo_epi32(lstep2[11], lstep2[13]);
- u[7] = _mm256_unpackhi_epi32(lstep2[11], lstep2[13]);
- u[8] = _mm256_unpacklo_epi32(lstep2[10], lstep2[12]);
- u[9] = _mm256_unpackhi_epi32(lstep2[10], lstep2[12]);
- u[10] = _mm256_unpacklo_epi32(lstep2[11], lstep2[13]);
- u[11] = _mm256_unpackhi_epi32(lstep2[11], lstep2[13]);
- u[12] = _mm256_unpacklo_epi32(lstep2[ 8], lstep2[14]);
- u[13] = _mm256_unpackhi_epi32(lstep2[ 8], lstep2[14]);
- u[14] = _mm256_unpacklo_epi32(lstep2[ 9], lstep2[15]);
- u[15] = _mm256_unpackhi_epi32(lstep2[ 9], lstep2[15]);
-
- v[0] = k_madd_epi32_avx2(u[0], k32_p28_p04);
- v[1] = k_madd_epi32_avx2(u[1], k32_p28_p04);
- v[2] = k_madd_epi32_avx2(u[2], k32_p28_p04);
- v[3] = k_madd_epi32_avx2(u[3], k32_p28_p04);
- v[4] = k_madd_epi32_avx2(u[4], k32_p12_p20);
- v[5] = k_madd_epi32_avx2(u[5], k32_p12_p20);
- v[6] = k_madd_epi32_avx2(u[6], k32_p12_p20);
- v[7] = k_madd_epi32_avx2(u[7], k32_p12_p20);
- v[ 8] = k_madd_epi32_avx2(u[ 8], k32_m20_p12);
- v[ 9] = k_madd_epi32_avx2(u[ 9], k32_m20_p12);
- v[10] = k_madd_epi32_avx2(u[10], k32_m20_p12);
- v[11] = k_madd_epi32_avx2(u[11], k32_m20_p12);
- v[12] = k_madd_epi32_avx2(u[12], k32_m04_p28);
- v[13] = k_madd_epi32_avx2(u[13], k32_m04_p28);
- v[14] = k_madd_epi32_avx2(u[14], k32_m04_p28);
- v[15] = k_madd_epi32_avx2(u[15], k32_m04_p28);
-
- u[0] = k_packs_epi64_avx2(v[0], v[1]);
- u[1] = k_packs_epi64_avx2(v[2], v[3]);
- u[2] = k_packs_epi64_avx2(v[4], v[5]);
- u[3] = k_packs_epi64_avx2(v[6], v[7]);
- u[4] = k_packs_epi64_avx2(v[8], v[9]);
- u[5] = k_packs_epi64_avx2(v[10], v[11]);
- u[6] = k_packs_epi64_avx2(v[12], v[13]);
- u[7] = k_packs_epi64_avx2(v[14], v[15]);
-
- v[0] = _mm256_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm256_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm256_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm256_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm256_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm256_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm256_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm256_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm256_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm256_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm256_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm256_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm256_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm256_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm256_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm256_srai_epi32(v[7], DCT_CONST_BITS);
-
- sign[0] = _mm256_cmpgt_epi32(kZero,u[0]);
- sign[1] = _mm256_cmpgt_epi32(kZero,u[1]);
- sign[2] = _mm256_cmpgt_epi32(kZero,u[2]);
- sign[3] = _mm256_cmpgt_epi32(kZero,u[3]);
- sign[4] = _mm256_cmpgt_epi32(kZero,u[4]);
- sign[5] = _mm256_cmpgt_epi32(kZero,u[5]);
- sign[6] = _mm256_cmpgt_epi32(kZero,u[6]);
- sign[7] = _mm256_cmpgt_epi32(kZero,u[7]);
-
- u[0] = _mm256_sub_epi32(u[0], sign[0]);
- u[1] = _mm256_sub_epi32(u[1], sign[1]);
- u[2] = _mm256_sub_epi32(u[2], sign[2]);
- u[3] = _mm256_sub_epi32(u[3], sign[3]);
- u[4] = _mm256_sub_epi32(u[4], sign[4]);
- u[5] = _mm256_sub_epi32(u[5], sign[5]);
- u[6] = _mm256_sub_epi32(u[6], sign[6]);
- u[7] = _mm256_sub_epi32(u[7], sign[7]);
-
- u[0] = _mm256_add_epi32(u[0], K32One);
- u[1] = _mm256_add_epi32(u[1], K32One);
- u[2] = _mm256_add_epi32(u[2], K32One);
- u[3] = _mm256_add_epi32(u[3], K32One);
- u[4] = _mm256_add_epi32(u[4], K32One);
- u[5] = _mm256_add_epi32(u[5], K32One);
- u[6] = _mm256_add_epi32(u[6], K32One);
- u[7] = _mm256_add_epi32(u[7], K32One);
-
- u[0] = _mm256_srai_epi32(u[0], 2);
- u[1] = _mm256_srai_epi32(u[1], 2);
- u[2] = _mm256_srai_epi32(u[2], 2);
- u[3] = _mm256_srai_epi32(u[3], 2);
- u[4] = _mm256_srai_epi32(u[4], 2);
- u[5] = _mm256_srai_epi32(u[5], 2);
- u[6] = _mm256_srai_epi32(u[6], 2);
- u[7] = _mm256_srai_epi32(u[7], 2);
-
- out[ 4] = _mm256_packs_epi32(u[0], u[1]);
- out[20] = _mm256_packs_epi32(u[2], u[3]);
- out[12] = _mm256_packs_epi32(u[4], u[5]);
- out[28] = _mm256_packs_epi32(u[6], u[7]);
- }
- {
- lstep3[16] = _mm256_add_epi32(lstep2[18], lstep1[16]);
- lstep3[17] = _mm256_add_epi32(lstep2[19], lstep1[17]);
- lstep3[18] = _mm256_sub_epi32(lstep1[16], lstep2[18]);
- lstep3[19] = _mm256_sub_epi32(lstep1[17], lstep2[19]);
- lstep3[20] = _mm256_sub_epi32(lstep1[22], lstep2[20]);
- lstep3[21] = _mm256_sub_epi32(lstep1[23], lstep2[21]);
- lstep3[22] = _mm256_add_epi32(lstep2[20], lstep1[22]);
- lstep3[23] = _mm256_add_epi32(lstep2[21], lstep1[23]);
- lstep3[24] = _mm256_add_epi32(lstep2[26], lstep1[24]);
- lstep3[25] = _mm256_add_epi32(lstep2[27], lstep1[25]);
- lstep3[26] = _mm256_sub_epi32(lstep1[24], lstep2[26]);
- lstep3[27] = _mm256_sub_epi32(lstep1[25], lstep2[27]);
- lstep3[28] = _mm256_sub_epi32(lstep1[30], lstep2[28]);
- lstep3[29] = _mm256_sub_epi32(lstep1[31], lstep2[29]);
- lstep3[30] = _mm256_add_epi32(lstep2[28], lstep1[30]);
- lstep3[31] = _mm256_add_epi32(lstep2[29], lstep1[31]);
- }
- {
- const __m256i k32_m04_p28 = pair256_set_epi32(-cospi_4_64, cospi_28_64);
- const __m256i k32_m28_m04 = pair256_set_epi32(-cospi_28_64, -cospi_4_64);
- const __m256i k32_m20_p12 = pair256_set_epi32(-cospi_20_64, cospi_12_64);
- const __m256i k32_m12_m20 = pair256_set_epi32(-cospi_12_64,
- -cospi_20_64);
- const __m256i k32_p12_p20 = pair256_set_epi32(cospi_12_64, cospi_20_64);
- const __m256i k32_p28_p04 = pair256_set_epi32(cospi_28_64, cospi_4_64);
-
- u[ 0] = _mm256_unpacklo_epi32(lstep2[34], lstep2[60]);
- u[ 1] = _mm256_unpackhi_epi32(lstep2[34], lstep2[60]);
- u[ 2] = _mm256_unpacklo_epi32(lstep2[35], lstep2[61]);
- u[ 3] = _mm256_unpackhi_epi32(lstep2[35], lstep2[61]);
- u[ 4] = _mm256_unpacklo_epi32(lstep2[36], lstep2[58]);
- u[ 5] = _mm256_unpackhi_epi32(lstep2[36], lstep2[58]);
- u[ 6] = _mm256_unpacklo_epi32(lstep2[37], lstep2[59]);
- u[ 7] = _mm256_unpackhi_epi32(lstep2[37], lstep2[59]);
- u[ 8] = _mm256_unpacklo_epi32(lstep2[42], lstep2[52]);
- u[ 9] = _mm256_unpackhi_epi32(lstep2[42], lstep2[52]);
- u[10] = _mm256_unpacklo_epi32(lstep2[43], lstep2[53]);
- u[11] = _mm256_unpackhi_epi32(lstep2[43], lstep2[53]);
- u[12] = _mm256_unpacklo_epi32(lstep2[44], lstep2[50]);
- u[13] = _mm256_unpackhi_epi32(lstep2[44], lstep2[50]);
- u[14] = _mm256_unpacklo_epi32(lstep2[45], lstep2[51]);
- u[15] = _mm256_unpackhi_epi32(lstep2[45], lstep2[51]);
-
- v[ 0] = k_madd_epi32_avx2(u[ 0], k32_m04_p28);
- v[ 1] = k_madd_epi32_avx2(u[ 1], k32_m04_p28);
- v[ 2] = k_madd_epi32_avx2(u[ 2], k32_m04_p28);
- v[ 3] = k_madd_epi32_avx2(u[ 3], k32_m04_p28);
- v[ 4] = k_madd_epi32_avx2(u[ 4], k32_m28_m04);
- v[ 5] = k_madd_epi32_avx2(u[ 5], k32_m28_m04);
- v[ 6] = k_madd_epi32_avx2(u[ 6], k32_m28_m04);
- v[ 7] = k_madd_epi32_avx2(u[ 7], k32_m28_m04);
- v[ 8] = k_madd_epi32_avx2(u[ 8], k32_m20_p12);
- v[ 9] = k_madd_epi32_avx2(u[ 9], k32_m20_p12);
- v[10] = k_madd_epi32_avx2(u[10], k32_m20_p12);
- v[11] = k_madd_epi32_avx2(u[11], k32_m20_p12);
- v[12] = k_madd_epi32_avx2(u[12], k32_m12_m20);
- v[13] = k_madd_epi32_avx2(u[13], k32_m12_m20);
- v[14] = k_madd_epi32_avx2(u[14], k32_m12_m20);
- v[15] = k_madd_epi32_avx2(u[15], k32_m12_m20);
- v[16] = k_madd_epi32_avx2(u[12], k32_m20_p12);
- v[17] = k_madd_epi32_avx2(u[13], k32_m20_p12);
- v[18] = k_madd_epi32_avx2(u[14], k32_m20_p12);
- v[19] = k_madd_epi32_avx2(u[15], k32_m20_p12);
- v[20] = k_madd_epi32_avx2(u[ 8], k32_p12_p20);
- v[21] = k_madd_epi32_avx2(u[ 9], k32_p12_p20);
- v[22] = k_madd_epi32_avx2(u[10], k32_p12_p20);
- v[23] = k_madd_epi32_avx2(u[11], k32_p12_p20);
- v[24] = k_madd_epi32_avx2(u[ 4], k32_m04_p28);
- v[25] = k_madd_epi32_avx2(u[ 5], k32_m04_p28);
- v[26] = k_madd_epi32_avx2(u[ 6], k32_m04_p28);
- v[27] = k_madd_epi32_avx2(u[ 7], k32_m04_p28);
- v[28] = k_madd_epi32_avx2(u[ 0], k32_p28_p04);
- v[29] = k_madd_epi32_avx2(u[ 1], k32_p28_p04);
- v[30] = k_madd_epi32_avx2(u[ 2], k32_p28_p04);
- v[31] = k_madd_epi32_avx2(u[ 3], k32_p28_p04);
-
- u[ 0] = k_packs_epi64_avx2(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64_avx2(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64_avx2(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64_avx2(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64_avx2(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64_avx2(v[10], v[11]);
- u[ 6] = k_packs_epi64_avx2(v[12], v[13]);
- u[ 7] = k_packs_epi64_avx2(v[14], v[15]);
- u[ 8] = k_packs_epi64_avx2(v[16], v[17]);
- u[ 9] = k_packs_epi64_avx2(v[18], v[19]);
- u[10] = k_packs_epi64_avx2(v[20], v[21]);
- u[11] = k_packs_epi64_avx2(v[22], v[23]);
- u[12] = k_packs_epi64_avx2(v[24], v[25]);
- u[13] = k_packs_epi64_avx2(v[26], v[27]);
- u[14] = k_packs_epi64_avx2(v[28], v[29]);
- u[15] = k_packs_epi64_avx2(v[30], v[31]);
-
- v[ 0] = _mm256_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm256_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm256_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm256_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm256_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm256_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm256_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm256_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm256_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm256_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm256_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm256_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm256_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm256_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm256_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm256_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- lstep3[34] = _mm256_srai_epi32(v[ 0], DCT_CONST_BITS);
- lstep3[35] = _mm256_srai_epi32(v[ 1], DCT_CONST_BITS);
- lstep3[36] = _mm256_srai_epi32(v[ 2], DCT_CONST_BITS);
- lstep3[37] = _mm256_srai_epi32(v[ 3], DCT_CONST_BITS);
- lstep3[42] = _mm256_srai_epi32(v[ 4], DCT_CONST_BITS);
- lstep3[43] = _mm256_srai_epi32(v[ 5], DCT_CONST_BITS);
- lstep3[44] = _mm256_srai_epi32(v[ 6], DCT_CONST_BITS);
- lstep3[45] = _mm256_srai_epi32(v[ 7], DCT_CONST_BITS);
- lstep3[50] = _mm256_srai_epi32(v[ 8], DCT_CONST_BITS);
- lstep3[51] = _mm256_srai_epi32(v[ 9], DCT_CONST_BITS);
- lstep3[52] = _mm256_srai_epi32(v[10], DCT_CONST_BITS);
- lstep3[53] = _mm256_srai_epi32(v[11], DCT_CONST_BITS);
- lstep3[58] = _mm256_srai_epi32(v[12], DCT_CONST_BITS);
- lstep3[59] = _mm256_srai_epi32(v[13], DCT_CONST_BITS);
- lstep3[60] = _mm256_srai_epi32(v[14], DCT_CONST_BITS);
- lstep3[61] = _mm256_srai_epi32(v[15], DCT_CONST_BITS);
- }
- // stage 7
- {
- const __m256i k32_p30_p02 = pair256_set_epi32(cospi_30_64, cospi_2_64);
- const __m256i k32_p14_p18 = pair256_set_epi32(cospi_14_64, cospi_18_64);
- const __m256i k32_p22_p10 = pair256_set_epi32(cospi_22_64, cospi_10_64);
- const __m256i k32_p06_p26 = pair256_set_epi32(cospi_6_64, cospi_26_64);
- const __m256i k32_m26_p06 = pair256_set_epi32(-cospi_26_64, cospi_6_64);
- const __m256i k32_m10_p22 = pair256_set_epi32(-cospi_10_64, cospi_22_64);
- const __m256i k32_m18_p14 = pair256_set_epi32(-cospi_18_64, cospi_14_64);
- const __m256i k32_m02_p30 = pair256_set_epi32(-cospi_2_64, cospi_30_64);
-
- u[ 0] = _mm256_unpacklo_epi32(lstep3[16], lstep3[30]);
- u[ 1] = _mm256_unpackhi_epi32(lstep3[16], lstep3[30]);
- u[ 2] = _mm256_unpacklo_epi32(lstep3[17], lstep3[31]);
- u[ 3] = _mm256_unpackhi_epi32(lstep3[17], lstep3[31]);
- u[ 4] = _mm256_unpacklo_epi32(lstep3[18], lstep3[28]);
- u[ 5] = _mm256_unpackhi_epi32(lstep3[18], lstep3[28]);
- u[ 6] = _mm256_unpacklo_epi32(lstep3[19], lstep3[29]);
- u[ 7] = _mm256_unpackhi_epi32(lstep3[19], lstep3[29]);
- u[ 8] = _mm256_unpacklo_epi32(lstep3[20], lstep3[26]);
- u[ 9] = _mm256_unpackhi_epi32(lstep3[20], lstep3[26]);
- u[10] = _mm256_unpacklo_epi32(lstep3[21], lstep3[27]);
- u[11] = _mm256_unpackhi_epi32(lstep3[21], lstep3[27]);
- u[12] = _mm256_unpacklo_epi32(lstep3[22], lstep3[24]);
- u[13] = _mm256_unpackhi_epi32(lstep3[22], lstep3[24]);
- u[14] = _mm256_unpacklo_epi32(lstep3[23], lstep3[25]);
- u[15] = _mm256_unpackhi_epi32(lstep3[23], lstep3[25]);
-
- v[ 0] = k_madd_epi32_avx2(u[ 0], k32_p30_p02);
- v[ 1] = k_madd_epi32_avx2(u[ 1], k32_p30_p02);
- v[ 2] = k_madd_epi32_avx2(u[ 2], k32_p30_p02);
- v[ 3] = k_madd_epi32_avx2(u[ 3], k32_p30_p02);
- v[ 4] = k_madd_epi32_avx2(u[ 4], k32_p14_p18);
- v[ 5] = k_madd_epi32_avx2(u[ 5], k32_p14_p18);
- v[ 6] = k_madd_epi32_avx2(u[ 6], k32_p14_p18);
- v[ 7] = k_madd_epi32_avx2(u[ 7], k32_p14_p18);
- v[ 8] = k_madd_epi32_avx2(u[ 8], k32_p22_p10);
- v[ 9] = k_madd_epi32_avx2(u[ 9], k32_p22_p10);
- v[10] = k_madd_epi32_avx2(u[10], k32_p22_p10);
- v[11] = k_madd_epi32_avx2(u[11], k32_p22_p10);
- v[12] = k_madd_epi32_avx2(u[12], k32_p06_p26);
- v[13] = k_madd_epi32_avx2(u[13], k32_p06_p26);
- v[14] = k_madd_epi32_avx2(u[14], k32_p06_p26);
- v[15] = k_madd_epi32_avx2(u[15], k32_p06_p26);
- v[16] = k_madd_epi32_avx2(u[12], k32_m26_p06);
- v[17] = k_madd_epi32_avx2(u[13], k32_m26_p06);
- v[18] = k_madd_epi32_avx2(u[14], k32_m26_p06);
- v[19] = k_madd_epi32_avx2(u[15], k32_m26_p06);
- v[20] = k_madd_epi32_avx2(u[ 8], k32_m10_p22);
- v[21] = k_madd_epi32_avx2(u[ 9], k32_m10_p22);
- v[22] = k_madd_epi32_avx2(u[10], k32_m10_p22);
- v[23] = k_madd_epi32_avx2(u[11], k32_m10_p22);
- v[24] = k_madd_epi32_avx2(u[ 4], k32_m18_p14);
- v[25] = k_madd_epi32_avx2(u[ 5], k32_m18_p14);
- v[26] = k_madd_epi32_avx2(u[ 6], k32_m18_p14);
- v[27] = k_madd_epi32_avx2(u[ 7], k32_m18_p14);
- v[28] = k_madd_epi32_avx2(u[ 0], k32_m02_p30);
- v[29] = k_madd_epi32_avx2(u[ 1], k32_m02_p30);
- v[30] = k_madd_epi32_avx2(u[ 2], k32_m02_p30);
- v[31] = k_madd_epi32_avx2(u[ 3], k32_m02_p30);
-
- u[ 0] = k_packs_epi64_avx2(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64_avx2(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64_avx2(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64_avx2(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64_avx2(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64_avx2(v[10], v[11]);
- u[ 6] = k_packs_epi64_avx2(v[12], v[13]);
- u[ 7] = k_packs_epi64_avx2(v[14], v[15]);
- u[ 8] = k_packs_epi64_avx2(v[16], v[17]);
- u[ 9] = k_packs_epi64_avx2(v[18], v[19]);
- u[10] = k_packs_epi64_avx2(v[20], v[21]);
- u[11] = k_packs_epi64_avx2(v[22], v[23]);
- u[12] = k_packs_epi64_avx2(v[24], v[25]);
- u[13] = k_packs_epi64_avx2(v[26], v[27]);
- u[14] = k_packs_epi64_avx2(v[28], v[29]);
- u[15] = k_packs_epi64_avx2(v[30], v[31]);
-
- v[ 0] = _mm256_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm256_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm256_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm256_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm256_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm256_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm256_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm256_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm256_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm256_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm256_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm256_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm256_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm256_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm256_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm256_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[ 0] = _mm256_srai_epi32(v[ 0], DCT_CONST_BITS);
- u[ 1] = _mm256_srai_epi32(v[ 1], DCT_CONST_BITS);
- u[ 2] = _mm256_srai_epi32(v[ 2], DCT_CONST_BITS);
- u[ 3] = _mm256_srai_epi32(v[ 3], DCT_CONST_BITS);
- u[ 4] = _mm256_srai_epi32(v[ 4], DCT_CONST_BITS);
- u[ 5] = _mm256_srai_epi32(v[ 5], DCT_CONST_BITS);
- u[ 6] = _mm256_srai_epi32(v[ 6], DCT_CONST_BITS);
- u[ 7] = _mm256_srai_epi32(v[ 7], DCT_CONST_BITS);
- u[ 8] = _mm256_srai_epi32(v[ 8], DCT_CONST_BITS);
- u[ 9] = _mm256_srai_epi32(v[ 9], DCT_CONST_BITS);
- u[10] = _mm256_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm256_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm256_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm256_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm256_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm256_srai_epi32(v[15], DCT_CONST_BITS);
-
- v[ 0] = _mm256_cmpgt_epi32(kZero,u[ 0]);
- v[ 1] = _mm256_cmpgt_epi32(kZero,u[ 1]);
- v[ 2] = _mm256_cmpgt_epi32(kZero,u[ 2]);
- v[ 3] = _mm256_cmpgt_epi32(kZero,u[ 3]);
- v[ 4] = _mm256_cmpgt_epi32(kZero,u[ 4]);
- v[ 5] = _mm256_cmpgt_epi32(kZero,u[ 5]);
- v[ 6] = _mm256_cmpgt_epi32(kZero,u[ 6]);
- v[ 7] = _mm256_cmpgt_epi32(kZero,u[ 7]);
- v[ 8] = _mm256_cmpgt_epi32(kZero,u[ 8]);
- v[ 9] = _mm256_cmpgt_epi32(kZero,u[ 9]);
- v[10] = _mm256_cmpgt_epi32(kZero,u[10]);
- v[11] = _mm256_cmpgt_epi32(kZero,u[11]);
- v[12] = _mm256_cmpgt_epi32(kZero,u[12]);
- v[13] = _mm256_cmpgt_epi32(kZero,u[13]);
- v[14] = _mm256_cmpgt_epi32(kZero,u[14]);
- v[15] = _mm256_cmpgt_epi32(kZero,u[15]);
-
- u[ 0] = _mm256_sub_epi32(u[ 0], v[ 0]);
- u[ 1] = _mm256_sub_epi32(u[ 1], v[ 1]);
- u[ 2] = _mm256_sub_epi32(u[ 2], v[ 2]);
- u[ 3] = _mm256_sub_epi32(u[ 3], v[ 3]);
- u[ 4] = _mm256_sub_epi32(u[ 4], v[ 4]);
- u[ 5] = _mm256_sub_epi32(u[ 5], v[ 5]);
- u[ 6] = _mm256_sub_epi32(u[ 6], v[ 6]);
- u[ 7] = _mm256_sub_epi32(u[ 7], v[ 7]);
- u[ 8] = _mm256_sub_epi32(u[ 8], v[ 8]);
- u[ 9] = _mm256_sub_epi32(u[ 9], v[ 9]);
- u[10] = _mm256_sub_epi32(u[10], v[10]);
- u[11] = _mm256_sub_epi32(u[11], v[11]);
- u[12] = _mm256_sub_epi32(u[12], v[12]);
- u[13] = _mm256_sub_epi32(u[13], v[13]);
- u[14] = _mm256_sub_epi32(u[14], v[14]);
- u[15] = _mm256_sub_epi32(u[15], v[15]);
-
- v[ 0] = _mm256_add_epi32(u[ 0], K32One);
- v[ 1] = _mm256_add_epi32(u[ 1], K32One);
- v[ 2] = _mm256_add_epi32(u[ 2], K32One);
- v[ 3] = _mm256_add_epi32(u[ 3], K32One);
- v[ 4] = _mm256_add_epi32(u[ 4], K32One);
- v[ 5] = _mm256_add_epi32(u[ 5], K32One);
- v[ 6] = _mm256_add_epi32(u[ 6], K32One);
- v[ 7] = _mm256_add_epi32(u[ 7], K32One);
- v[ 8] = _mm256_add_epi32(u[ 8], K32One);
- v[ 9] = _mm256_add_epi32(u[ 9], K32One);
- v[10] = _mm256_add_epi32(u[10], K32One);
- v[11] = _mm256_add_epi32(u[11], K32One);
- v[12] = _mm256_add_epi32(u[12], K32One);
- v[13] = _mm256_add_epi32(u[13], K32One);
- v[14] = _mm256_add_epi32(u[14], K32One);
- v[15] = _mm256_add_epi32(u[15], K32One);
-
- u[ 0] = _mm256_srai_epi32(v[ 0], 2);
- u[ 1] = _mm256_srai_epi32(v[ 1], 2);
- u[ 2] = _mm256_srai_epi32(v[ 2], 2);
- u[ 3] = _mm256_srai_epi32(v[ 3], 2);
- u[ 4] = _mm256_srai_epi32(v[ 4], 2);
- u[ 5] = _mm256_srai_epi32(v[ 5], 2);
- u[ 6] = _mm256_srai_epi32(v[ 6], 2);
- u[ 7] = _mm256_srai_epi32(v[ 7], 2);
- u[ 8] = _mm256_srai_epi32(v[ 8], 2);
- u[ 9] = _mm256_srai_epi32(v[ 9], 2);
- u[10] = _mm256_srai_epi32(v[10], 2);
- u[11] = _mm256_srai_epi32(v[11], 2);
- u[12] = _mm256_srai_epi32(v[12], 2);
- u[13] = _mm256_srai_epi32(v[13], 2);
- u[14] = _mm256_srai_epi32(v[14], 2);
- u[15] = _mm256_srai_epi32(v[15], 2);
-
- out[ 2] = _mm256_packs_epi32(u[0], u[1]);
- out[18] = _mm256_packs_epi32(u[2], u[3]);
- out[10] = _mm256_packs_epi32(u[4], u[5]);
- out[26] = _mm256_packs_epi32(u[6], u[7]);
- out[ 6] = _mm256_packs_epi32(u[8], u[9]);
- out[22] = _mm256_packs_epi32(u[10], u[11]);
- out[14] = _mm256_packs_epi32(u[12], u[13]);
- out[30] = _mm256_packs_epi32(u[14], u[15]);
- }
- {
- lstep1[32] = _mm256_add_epi32(lstep3[34], lstep2[32]);
- lstep1[33] = _mm256_add_epi32(lstep3[35], lstep2[33]);
- lstep1[34] = _mm256_sub_epi32(lstep2[32], lstep3[34]);
- lstep1[35] = _mm256_sub_epi32(lstep2[33], lstep3[35]);
- lstep1[36] = _mm256_sub_epi32(lstep2[38], lstep3[36]);
- lstep1[37] = _mm256_sub_epi32(lstep2[39], lstep3[37]);
- lstep1[38] = _mm256_add_epi32(lstep3[36], lstep2[38]);
- lstep1[39] = _mm256_add_epi32(lstep3[37], lstep2[39]);
- lstep1[40] = _mm256_add_epi32(lstep3[42], lstep2[40]);
- lstep1[41] = _mm256_add_epi32(lstep3[43], lstep2[41]);
- lstep1[42] = _mm256_sub_epi32(lstep2[40], lstep3[42]);
- lstep1[43] = _mm256_sub_epi32(lstep2[41], lstep3[43]);
- lstep1[44] = _mm256_sub_epi32(lstep2[46], lstep3[44]);
- lstep1[45] = _mm256_sub_epi32(lstep2[47], lstep3[45]);
- lstep1[46] = _mm256_add_epi32(lstep3[44], lstep2[46]);
- lstep1[47] = _mm256_add_epi32(lstep3[45], lstep2[47]);
- lstep1[48] = _mm256_add_epi32(lstep3[50], lstep2[48]);
- lstep1[49] = _mm256_add_epi32(lstep3[51], lstep2[49]);
- lstep1[50] = _mm256_sub_epi32(lstep2[48], lstep3[50]);
- lstep1[51] = _mm256_sub_epi32(lstep2[49], lstep3[51]);
- lstep1[52] = _mm256_sub_epi32(lstep2[54], lstep3[52]);
- lstep1[53] = _mm256_sub_epi32(lstep2[55], lstep3[53]);
- lstep1[54] = _mm256_add_epi32(lstep3[52], lstep2[54]);
- lstep1[55] = _mm256_add_epi32(lstep3[53], lstep2[55]);
- lstep1[56] = _mm256_add_epi32(lstep3[58], lstep2[56]);
- lstep1[57] = _mm256_add_epi32(lstep3[59], lstep2[57]);
- lstep1[58] = _mm256_sub_epi32(lstep2[56], lstep3[58]);
- lstep1[59] = _mm256_sub_epi32(lstep2[57], lstep3[59]);
- lstep1[60] = _mm256_sub_epi32(lstep2[62], lstep3[60]);
- lstep1[61] = _mm256_sub_epi32(lstep2[63], lstep3[61]);
- lstep1[62] = _mm256_add_epi32(lstep3[60], lstep2[62]);
- lstep1[63] = _mm256_add_epi32(lstep3[61], lstep2[63]);
- }
- // stage 8
- {
- const __m256i k32_p31_p01 = pair256_set_epi32(cospi_31_64, cospi_1_64);
- const __m256i k32_p15_p17 = pair256_set_epi32(cospi_15_64, cospi_17_64);
- const __m256i k32_p23_p09 = pair256_set_epi32(cospi_23_64, cospi_9_64);
- const __m256i k32_p07_p25 = pair256_set_epi32(cospi_7_64, cospi_25_64);
- const __m256i k32_m25_p07 = pair256_set_epi32(-cospi_25_64, cospi_7_64);
- const __m256i k32_m09_p23 = pair256_set_epi32(-cospi_9_64, cospi_23_64);
- const __m256i k32_m17_p15 = pair256_set_epi32(-cospi_17_64, cospi_15_64);
- const __m256i k32_m01_p31 = pair256_set_epi32(-cospi_1_64, cospi_31_64);
-
- u[ 0] = _mm256_unpacklo_epi32(lstep1[32], lstep1[62]);
- u[ 1] = _mm256_unpackhi_epi32(lstep1[32], lstep1[62]);
- u[ 2] = _mm256_unpacklo_epi32(lstep1[33], lstep1[63]);
- u[ 3] = _mm256_unpackhi_epi32(lstep1[33], lstep1[63]);
- u[ 4] = _mm256_unpacklo_epi32(lstep1[34], lstep1[60]);
- u[ 5] = _mm256_unpackhi_epi32(lstep1[34], lstep1[60]);
- u[ 6] = _mm256_unpacklo_epi32(lstep1[35], lstep1[61]);
- u[ 7] = _mm256_unpackhi_epi32(lstep1[35], lstep1[61]);
- u[ 8] = _mm256_unpacklo_epi32(lstep1[36], lstep1[58]);
- u[ 9] = _mm256_unpackhi_epi32(lstep1[36], lstep1[58]);
- u[10] = _mm256_unpacklo_epi32(lstep1[37], lstep1[59]);
- u[11] = _mm256_unpackhi_epi32(lstep1[37], lstep1[59]);
- u[12] = _mm256_unpacklo_epi32(lstep1[38], lstep1[56]);
- u[13] = _mm256_unpackhi_epi32(lstep1[38], lstep1[56]);
- u[14] = _mm256_unpacklo_epi32(lstep1[39], lstep1[57]);
- u[15] = _mm256_unpackhi_epi32(lstep1[39], lstep1[57]);
-
- v[ 0] = k_madd_epi32_avx2(u[ 0], k32_p31_p01);
- v[ 1] = k_madd_epi32_avx2(u[ 1], k32_p31_p01);
- v[ 2] = k_madd_epi32_avx2(u[ 2], k32_p31_p01);
- v[ 3] = k_madd_epi32_avx2(u[ 3], k32_p31_p01);
- v[ 4] = k_madd_epi32_avx2(u[ 4], k32_p15_p17);
- v[ 5] = k_madd_epi32_avx2(u[ 5], k32_p15_p17);
- v[ 6] = k_madd_epi32_avx2(u[ 6], k32_p15_p17);
- v[ 7] = k_madd_epi32_avx2(u[ 7], k32_p15_p17);
- v[ 8] = k_madd_epi32_avx2(u[ 8], k32_p23_p09);
- v[ 9] = k_madd_epi32_avx2(u[ 9], k32_p23_p09);
- v[10] = k_madd_epi32_avx2(u[10], k32_p23_p09);
- v[11] = k_madd_epi32_avx2(u[11], k32_p23_p09);
- v[12] = k_madd_epi32_avx2(u[12], k32_p07_p25);
- v[13] = k_madd_epi32_avx2(u[13], k32_p07_p25);
- v[14] = k_madd_epi32_avx2(u[14], k32_p07_p25);
- v[15] = k_madd_epi32_avx2(u[15], k32_p07_p25);
- v[16] = k_madd_epi32_avx2(u[12], k32_m25_p07);
- v[17] = k_madd_epi32_avx2(u[13], k32_m25_p07);
- v[18] = k_madd_epi32_avx2(u[14], k32_m25_p07);
- v[19] = k_madd_epi32_avx2(u[15], k32_m25_p07);
- v[20] = k_madd_epi32_avx2(u[ 8], k32_m09_p23);
- v[21] = k_madd_epi32_avx2(u[ 9], k32_m09_p23);
- v[22] = k_madd_epi32_avx2(u[10], k32_m09_p23);
- v[23] = k_madd_epi32_avx2(u[11], k32_m09_p23);
- v[24] = k_madd_epi32_avx2(u[ 4], k32_m17_p15);
- v[25] = k_madd_epi32_avx2(u[ 5], k32_m17_p15);
- v[26] = k_madd_epi32_avx2(u[ 6], k32_m17_p15);
- v[27] = k_madd_epi32_avx2(u[ 7], k32_m17_p15);
- v[28] = k_madd_epi32_avx2(u[ 0], k32_m01_p31);
- v[29] = k_madd_epi32_avx2(u[ 1], k32_m01_p31);
- v[30] = k_madd_epi32_avx2(u[ 2], k32_m01_p31);
- v[31] = k_madd_epi32_avx2(u[ 3], k32_m01_p31);
-
- u[ 0] = k_packs_epi64_avx2(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64_avx2(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64_avx2(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64_avx2(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64_avx2(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64_avx2(v[10], v[11]);
- u[ 6] = k_packs_epi64_avx2(v[12], v[13]);
- u[ 7] = k_packs_epi64_avx2(v[14], v[15]);
- u[ 8] = k_packs_epi64_avx2(v[16], v[17]);
- u[ 9] = k_packs_epi64_avx2(v[18], v[19]);
- u[10] = k_packs_epi64_avx2(v[20], v[21]);
- u[11] = k_packs_epi64_avx2(v[22], v[23]);
- u[12] = k_packs_epi64_avx2(v[24], v[25]);
- u[13] = k_packs_epi64_avx2(v[26], v[27]);
- u[14] = k_packs_epi64_avx2(v[28], v[29]);
- u[15] = k_packs_epi64_avx2(v[30], v[31]);
-
- v[ 0] = _mm256_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm256_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm256_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm256_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm256_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm256_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm256_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm256_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm256_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm256_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm256_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm256_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm256_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm256_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm256_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm256_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[ 0] = _mm256_srai_epi32(v[ 0], DCT_CONST_BITS);
- u[ 1] = _mm256_srai_epi32(v[ 1], DCT_CONST_BITS);
- u[ 2] = _mm256_srai_epi32(v[ 2], DCT_CONST_BITS);
- u[ 3] = _mm256_srai_epi32(v[ 3], DCT_CONST_BITS);
- u[ 4] = _mm256_srai_epi32(v[ 4], DCT_CONST_BITS);
- u[ 5] = _mm256_srai_epi32(v[ 5], DCT_CONST_BITS);
- u[ 6] = _mm256_srai_epi32(v[ 6], DCT_CONST_BITS);
- u[ 7] = _mm256_srai_epi32(v[ 7], DCT_CONST_BITS);
- u[ 8] = _mm256_srai_epi32(v[ 8], DCT_CONST_BITS);
- u[ 9] = _mm256_srai_epi32(v[ 9], DCT_CONST_BITS);
- u[10] = _mm256_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm256_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm256_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm256_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm256_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm256_srai_epi32(v[15], DCT_CONST_BITS);
-
- v[ 0] = _mm256_cmpgt_epi32(kZero,u[ 0]);
- v[ 1] = _mm256_cmpgt_epi32(kZero,u[ 1]);
- v[ 2] = _mm256_cmpgt_epi32(kZero,u[ 2]);
- v[ 3] = _mm256_cmpgt_epi32(kZero,u[ 3]);
- v[ 4] = _mm256_cmpgt_epi32(kZero,u[ 4]);
- v[ 5] = _mm256_cmpgt_epi32(kZero,u[ 5]);
- v[ 6] = _mm256_cmpgt_epi32(kZero,u[ 6]);
- v[ 7] = _mm256_cmpgt_epi32(kZero,u[ 7]);
- v[ 8] = _mm256_cmpgt_epi32(kZero,u[ 8]);
- v[ 9] = _mm256_cmpgt_epi32(kZero,u[ 9]);
- v[10] = _mm256_cmpgt_epi32(kZero,u[10]);
- v[11] = _mm256_cmpgt_epi32(kZero,u[11]);
- v[12] = _mm256_cmpgt_epi32(kZero,u[12]);
- v[13] = _mm256_cmpgt_epi32(kZero,u[13]);
- v[14] = _mm256_cmpgt_epi32(kZero,u[14]);
- v[15] = _mm256_cmpgt_epi32(kZero,u[15]);
-
- u[ 0] = _mm256_sub_epi32(u[ 0], v[ 0]);
- u[ 1] = _mm256_sub_epi32(u[ 1], v[ 1]);
- u[ 2] = _mm256_sub_epi32(u[ 2], v[ 2]);
- u[ 3] = _mm256_sub_epi32(u[ 3], v[ 3]);
- u[ 4] = _mm256_sub_epi32(u[ 4], v[ 4]);
- u[ 5] = _mm256_sub_epi32(u[ 5], v[ 5]);
- u[ 6] = _mm256_sub_epi32(u[ 6], v[ 6]);
- u[ 7] = _mm256_sub_epi32(u[ 7], v[ 7]);
- u[ 8] = _mm256_sub_epi32(u[ 8], v[ 8]);
- u[ 9] = _mm256_sub_epi32(u[ 9], v[ 9]);
- u[10] = _mm256_sub_epi32(u[10], v[10]);
- u[11] = _mm256_sub_epi32(u[11], v[11]);
- u[12] = _mm256_sub_epi32(u[12], v[12]);
- u[13] = _mm256_sub_epi32(u[13], v[13]);
- u[14] = _mm256_sub_epi32(u[14], v[14]);
- u[15] = _mm256_sub_epi32(u[15], v[15]);
-
- v[0] = _mm256_add_epi32(u[0], K32One);
- v[1] = _mm256_add_epi32(u[1], K32One);
- v[2] = _mm256_add_epi32(u[2], K32One);
- v[3] = _mm256_add_epi32(u[3], K32One);
- v[4] = _mm256_add_epi32(u[4], K32One);
- v[5] = _mm256_add_epi32(u[5], K32One);
- v[6] = _mm256_add_epi32(u[6], K32One);
- v[7] = _mm256_add_epi32(u[7], K32One);
- v[8] = _mm256_add_epi32(u[8], K32One);
- v[9] = _mm256_add_epi32(u[9], K32One);
- v[10] = _mm256_add_epi32(u[10], K32One);
- v[11] = _mm256_add_epi32(u[11], K32One);
- v[12] = _mm256_add_epi32(u[12], K32One);
- v[13] = _mm256_add_epi32(u[13], K32One);
- v[14] = _mm256_add_epi32(u[14], K32One);
- v[15] = _mm256_add_epi32(u[15], K32One);
-
- u[0] = _mm256_srai_epi32(v[0], 2);
- u[1] = _mm256_srai_epi32(v[1], 2);
- u[2] = _mm256_srai_epi32(v[2], 2);
- u[3] = _mm256_srai_epi32(v[3], 2);
- u[4] = _mm256_srai_epi32(v[4], 2);
- u[5] = _mm256_srai_epi32(v[5], 2);
- u[6] = _mm256_srai_epi32(v[6], 2);
- u[7] = _mm256_srai_epi32(v[7], 2);
- u[8] = _mm256_srai_epi32(v[8], 2);
- u[9] = _mm256_srai_epi32(v[9], 2);
- u[10] = _mm256_srai_epi32(v[10], 2);
- u[11] = _mm256_srai_epi32(v[11], 2);
- u[12] = _mm256_srai_epi32(v[12], 2);
- u[13] = _mm256_srai_epi32(v[13], 2);
- u[14] = _mm256_srai_epi32(v[14], 2);
- u[15] = _mm256_srai_epi32(v[15], 2);
-
- out[ 1] = _mm256_packs_epi32(u[0], u[1]);
- out[17] = _mm256_packs_epi32(u[2], u[3]);
- out[ 9] = _mm256_packs_epi32(u[4], u[5]);
- out[25] = _mm256_packs_epi32(u[6], u[7]);
- out[ 7] = _mm256_packs_epi32(u[8], u[9]);
- out[23] = _mm256_packs_epi32(u[10], u[11]);
- out[15] = _mm256_packs_epi32(u[12], u[13]);
- out[31] = _mm256_packs_epi32(u[14], u[15]);
- }
- {
- const __m256i k32_p27_p05 = pair256_set_epi32(cospi_27_64, cospi_5_64);
- const __m256i k32_p11_p21 = pair256_set_epi32(cospi_11_64, cospi_21_64);
- const __m256i k32_p19_p13 = pair256_set_epi32(cospi_19_64, cospi_13_64);
- const __m256i k32_p03_p29 = pair256_set_epi32(cospi_3_64, cospi_29_64);
- const __m256i k32_m29_p03 = pair256_set_epi32(-cospi_29_64, cospi_3_64);
- const __m256i k32_m13_p19 = pair256_set_epi32(-cospi_13_64, cospi_19_64);
- const __m256i k32_m21_p11 = pair256_set_epi32(-cospi_21_64, cospi_11_64);
- const __m256i k32_m05_p27 = pair256_set_epi32(-cospi_5_64, cospi_27_64);
-
- u[ 0] = _mm256_unpacklo_epi32(lstep1[40], lstep1[54]);
- u[ 1] = _mm256_unpackhi_epi32(lstep1[40], lstep1[54]);
- u[ 2] = _mm256_unpacklo_epi32(lstep1[41], lstep1[55]);
- u[ 3] = _mm256_unpackhi_epi32(lstep1[41], lstep1[55]);
- u[ 4] = _mm256_unpacklo_epi32(lstep1[42], lstep1[52]);
- u[ 5] = _mm256_unpackhi_epi32(lstep1[42], lstep1[52]);
- u[ 6] = _mm256_unpacklo_epi32(lstep1[43], lstep1[53]);
- u[ 7] = _mm256_unpackhi_epi32(lstep1[43], lstep1[53]);
- u[ 8] = _mm256_unpacklo_epi32(lstep1[44], lstep1[50]);
- u[ 9] = _mm256_unpackhi_epi32(lstep1[44], lstep1[50]);
- u[10] = _mm256_unpacklo_epi32(lstep1[45], lstep1[51]);
- u[11] = _mm256_unpackhi_epi32(lstep1[45], lstep1[51]);
- u[12] = _mm256_unpacklo_epi32(lstep1[46], lstep1[48]);
- u[13] = _mm256_unpackhi_epi32(lstep1[46], lstep1[48]);
- u[14] = _mm256_unpacklo_epi32(lstep1[47], lstep1[49]);
- u[15] = _mm256_unpackhi_epi32(lstep1[47], lstep1[49]);
-
- v[ 0] = k_madd_epi32_avx2(u[ 0], k32_p27_p05);
- v[ 1] = k_madd_epi32_avx2(u[ 1], k32_p27_p05);
- v[ 2] = k_madd_epi32_avx2(u[ 2], k32_p27_p05);
- v[ 3] = k_madd_epi32_avx2(u[ 3], k32_p27_p05);
- v[ 4] = k_madd_epi32_avx2(u[ 4], k32_p11_p21);
- v[ 5] = k_madd_epi32_avx2(u[ 5], k32_p11_p21);
- v[ 6] = k_madd_epi32_avx2(u[ 6], k32_p11_p21);
- v[ 7] = k_madd_epi32_avx2(u[ 7], k32_p11_p21);
- v[ 8] = k_madd_epi32_avx2(u[ 8], k32_p19_p13);
- v[ 9] = k_madd_epi32_avx2(u[ 9], k32_p19_p13);
- v[10] = k_madd_epi32_avx2(u[10], k32_p19_p13);
- v[11] = k_madd_epi32_avx2(u[11], k32_p19_p13);
- v[12] = k_madd_epi32_avx2(u[12], k32_p03_p29);
- v[13] = k_madd_epi32_avx2(u[13], k32_p03_p29);
- v[14] = k_madd_epi32_avx2(u[14], k32_p03_p29);
- v[15] = k_madd_epi32_avx2(u[15], k32_p03_p29);
- v[16] = k_madd_epi32_avx2(u[12], k32_m29_p03);
- v[17] = k_madd_epi32_avx2(u[13], k32_m29_p03);
- v[18] = k_madd_epi32_avx2(u[14], k32_m29_p03);
- v[19] = k_madd_epi32_avx2(u[15], k32_m29_p03);
- v[20] = k_madd_epi32_avx2(u[ 8], k32_m13_p19);
- v[21] = k_madd_epi32_avx2(u[ 9], k32_m13_p19);
- v[22] = k_madd_epi32_avx2(u[10], k32_m13_p19);
- v[23] = k_madd_epi32_avx2(u[11], k32_m13_p19);
- v[24] = k_madd_epi32_avx2(u[ 4], k32_m21_p11);
- v[25] = k_madd_epi32_avx2(u[ 5], k32_m21_p11);
- v[26] = k_madd_epi32_avx2(u[ 6], k32_m21_p11);
- v[27] = k_madd_epi32_avx2(u[ 7], k32_m21_p11);
- v[28] = k_madd_epi32_avx2(u[ 0], k32_m05_p27);
- v[29] = k_madd_epi32_avx2(u[ 1], k32_m05_p27);
- v[30] = k_madd_epi32_avx2(u[ 2], k32_m05_p27);
- v[31] = k_madd_epi32_avx2(u[ 3], k32_m05_p27);
-
- u[ 0] = k_packs_epi64_avx2(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64_avx2(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64_avx2(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64_avx2(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64_avx2(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64_avx2(v[10], v[11]);
- u[ 6] = k_packs_epi64_avx2(v[12], v[13]);
- u[ 7] = k_packs_epi64_avx2(v[14], v[15]);
- u[ 8] = k_packs_epi64_avx2(v[16], v[17]);
- u[ 9] = k_packs_epi64_avx2(v[18], v[19]);
- u[10] = k_packs_epi64_avx2(v[20], v[21]);
- u[11] = k_packs_epi64_avx2(v[22], v[23]);
- u[12] = k_packs_epi64_avx2(v[24], v[25]);
- u[13] = k_packs_epi64_avx2(v[26], v[27]);
- u[14] = k_packs_epi64_avx2(v[28], v[29]);
- u[15] = k_packs_epi64_avx2(v[30], v[31]);
-
- v[ 0] = _mm256_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm256_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm256_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm256_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm256_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm256_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm256_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm256_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm256_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm256_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm256_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm256_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm256_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm256_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm256_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm256_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[ 0] = _mm256_srai_epi32(v[ 0], DCT_CONST_BITS);
- u[ 1] = _mm256_srai_epi32(v[ 1], DCT_CONST_BITS);
- u[ 2] = _mm256_srai_epi32(v[ 2], DCT_CONST_BITS);
- u[ 3] = _mm256_srai_epi32(v[ 3], DCT_CONST_BITS);
- u[ 4] = _mm256_srai_epi32(v[ 4], DCT_CONST_BITS);
- u[ 5] = _mm256_srai_epi32(v[ 5], DCT_CONST_BITS);
- u[ 6] = _mm256_srai_epi32(v[ 6], DCT_CONST_BITS);
- u[ 7] = _mm256_srai_epi32(v[ 7], DCT_CONST_BITS);
- u[ 8] = _mm256_srai_epi32(v[ 8], DCT_CONST_BITS);
- u[ 9] = _mm256_srai_epi32(v[ 9], DCT_CONST_BITS);
- u[10] = _mm256_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm256_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm256_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm256_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm256_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm256_srai_epi32(v[15], DCT_CONST_BITS);
-
- v[ 0] = _mm256_cmpgt_epi32(kZero,u[ 0]);
- v[ 1] = _mm256_cmpgt_epi32(kZero,u[ 1]);
- v[ 2] = _mm256_cmpgt_epi32(kZero,u[ 2]);
- v[ 3] = _mm256_cmpgt_epi32(kZero,u[ 3]);
- v[ 4] = _mm256_cmpgt_epi32(kZero,u[ 4]);
- v[ 5] = _mm256_cmpgt_epi32(kZero,u[ 5]);
- v[ 6] = _mm256_cmpgt_epi32(kZero,u[ 6]);
- v[ 7] = _mm256_cmpgt_epi32(kZero,u[ 7]);
- v[ 8] = _mm256_cmpgt_epi32(kZero,u[ 8]);
- v[ 9] = _mm256_cmpgt_epi32(kZero,u[ 9]);
- v[10] = _mm256_cmpgt_epi32(kZero,u[10]);
- v[11] = _mm256_cmpgt_epi32(kZero,u[11]);
- v[12] = _mm256_cmpgt_epi32(kZero,u[12]);
- v[13] = _mm256_cmpgt_epi32(kZero,u[13]);
- v[14] = _mm256_cmpgt_epi32(kZero,u[14]);
- v[15] = _mm256_cmpgt_epi32(kZero,u[15]);
-
- u[ 0] = _mm256_sub_epi32(u[ 0], v[ 0]);
- u[ 1] = _mm256_sub_epi32(u[ 1], v[ 1]);
- u[ 2] = _mm256_sub_epi32(u[ 2], v[ 2]);
- u[ 3] = _mm256_sub_epi32(u[ 3], v[ 3]);
- u[ 4] = _mm256_sub_epi32(u[ 4], v[ 4]);
- u[ 5] = _mm256_sub_epi32(u[ 5], v[ 5]);
- u[ 6] = _mm256_sub_epi32(u[ 6], v[ 6]);
- u[ 7] = _mm256_sub_epi32(u[ 7], v[ 7]);
- u[ 8] = _mm256_sub_epi32(u[ 8], v[ 8]);
- u[ 9] = _mm256_sub_epi32(u[ 9], v[ 9]);
- u[10] = _mm256_sub_epi32(u[10], v[10]);
- u[11] = _mm256_sub_epi32(u[11], v[11]);
- u[12] = _mm256_sub_epi32(u[12], v[12]);
- u[13] = _mm256_sub_epi32(u[13], v[13]);
- u[14] = _mm256_sub_epi32(u[14], v[14]);
- u[15] = _mm256_sub_epi32(u[15], v[15]);
-
- v[0] = _mm256_add_epi32(u[0], K32One);
- v[1] = _mm256_add_epi32(u[1], K32One);
- v[2] = _mm256_add_epi32(u[2], K32One);
- v[3] = _mm256_add_epi32(u[3], K32One);
- v[4] = _mm256_add_epi32(u[4], K32One);
- v[5] = _mm256_add_epi32(u[5], K32One);
- v[6] = _mm256_add_epi32(u[6], K32One);
- v[7] = _mm256_add_epi32(u[7], K32One);
- v[8] = _mm256_add_epi32(u[8], K32One);
- v[9] = _mm256_add_epi32(u[9], K32One);
- v[10] = _mm256_add_epi32(u[10], K32One);
- v[11] = _mm256_add_epi32(u[11], K32One);
- v[12] = _mm256_add_epi32(u[12], K32One);
- v[13] = _mm256_add_epi32(u[13], K32One);
- v[14] = _mm256_add_epi32(u[14], K32One);
- v[15] = _mm256_add_epi32(u[15], K32One);
-
- u[0] = _mm256_srai_epi32(v[0], 2);
- u[1] = _mm256_srai_epi32(v[1], 2);
- u[2] = _mm256_srai_epi32(v[2], 2);
- u[3] = _mm256_srai_epi32(v[3], 2);
- u[4] = _mm256_srai_epi32(v[4], 2);
- u[5] = _mm256_srai_epi32(v[5], 2);
- u[6] = _mm256_srai_epi32(v[6], 2);
- u[7] = _mm256_srai_epi32(v[7], 2);
- u[8] = _mm256_srai_epi32(v[8], 2);
- u[9] = _mm256_srai_epi32(v[9], 2);
- u[10] = _mm256_srai_epi32(v[10], 2);
- u[11] = _mm256_srai_epi32(v[11], 2);
- u[12] = _mm256_srai_epi32(v[12], 2);
- u[13] = _mm256_srai_epi32(v[13], 2);
- u[14] = _mm256_srai_epi32(v[14], 2);
- u[15] = _mm256_srai_epi32(v[15], 2);
-
- out[ 5] = _mm256_packs_epi32(u[0], u[1]);
- out[21] = _mm256_packs_epi32(u[2], u[3]);
- out[13] = _mm256_packs_epi32(u[4], u[5]);
- out[29] = _mm256_packs_epi32(u[6], u[7]);
- out[ 3] = _mm256_packs_epi32(u[8], u[9]);
- out[19] = _mm256_packs_epi32(u[10], u[11]);
- out[11] = _mm256_packs_epi32(u[12], u[13]);
- out[27] = _mm256_packs_epi32(u[14], u[15]);
- }
- }
-#endif
- // Transpose the results, do it as four 8x8 transposes.
- {
- int transpose_block;
- int16_t *output_currStep,*output_nextStep;
- if (0 == pass){
- output_currStep = &intermediate[column_start * 32];
- output_nextStep = &intermediate[(column_start + 8) * 32];
- } else{
- output_currStep = &output_org[column_start * 32];
- output_nextStep = &output_org[(column_start + 8) * 32];
- }
- for (transpose_block = 0; transpose_block < 4; ++transpose_block) {
- __m256i *this_out = &out[8 * transpose_block];
- // 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
- // 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
- // 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
- // 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
- // 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
- // 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
- // 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
- // 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
- const __m256i tr0_0 = _mm256_unpacklo_epi16(this_out[0], this_out[1]);
- const __m256i tr0_1 = _mm256_unpacklo_epi16(this_out[2], this_out[3]);
- const __m256i tr0_2 = _mm256_unpackhi_epi16(this_out[0], this_out[1]);
- const __m256i tr0_3 = _mm256_unpackhi_epi16(this_out[2], this_out[3]);
- const __m256i tr0_4 = _mm256_unpacklo_epi16(this_out[4], this_out[5]);
- const __m256i tr0_5 = _mm256_unpacklo_epi16(this_out[6], this_out[7]);
- const __m256i tr0_6 = _mm256_unpackhi_epi16(this_out[4], this_out[5]);
- const __m256i tr0_7 = _mm256_unpackhi_epi16(this_out[6], this_out[7]);
- // 00 20 01 21 02 22 03 23 08 28 09 29 10 30 11 31
- // 40 60 41 61 42 62 43 63 48 68 49 69 50 70 51 71
- // 04 24 05 25 06 26 07 27 12 32 13 33 14 34 15 35
- // 44 64 45 65 46 66 47 67 52 72 53 73 54 74 55 75
- // 80 100 81 101 82 102 83 103 88 108 89 109 90 110 91 101
- // 120 140 121 141 122 142 123 143 128 148 129 149 130 150 131 151
- // 84 104 85 105 86 106 87 107 92 112 93 113 94 114 95 115
- // 124 144 125 145 126 146 127 147 132 152 133 153 134 154 135 155
-
- const __m256i tr1_0 = _mm256_unpacklo_epi32(tr0_0, tr0_1);
- const __m256i tr1_1 = _mm256_unpacklo_epi32(tr0_2, tr0_3);
- const __m256i tr1_2 = _mm256_unpackhi_epi32(tr0_0, tr0_1);
- const __m256i tr1_3 = _mm256_unpackhi_epi32(tr0_2, tr0_3);
- const __m256i tr1_4 = _mm256_unpacklo_epi32(tr0_4, tr0_5);
- const __m256i tr1_5 = _mm256_unpacklo_epi32(tr0_6, tr0_7);
- const __m256i tr1_6 = _mm256_unpackhi_epi32(tr0_4, tr0_5);
- const __m256i tr1_7 = _mm256_unpackhi_epi32(tr0_6, tr0_7);
- // 00 20 40 60 01 21 41 61 08 28 48 68 09 29 49 69
- // 04 24 44 64 05 25 45 65 12 32 52 72 13 33 53 73
- // 02 22 42 62 03 23 43 63 10 30 50 70 11 31 51 71
- // 06 26 46 66 07 27 47 67 14 34 54 74 15 35 55 75
- // 80 100 120 140 81 101 121 141 88 108 128 148 89 109 129 149
- // 84 104 124 144 85 105 125 145 92 112 132 152 93 113 133 153
- // 82 102 122 142 83 103 123 143 90 110 130 150 91 101 131 151
- // 86 106 126 146 87 107 127 147 94 114 134 154 95 115 135 155
- __m256i tr2_0 = _mm256_unpacklo_epi64(tr1_0, tr1_4);
- __m256i tr2_1 = _mm256_unpackhi_epi64(tr1_0, tr1_4);
- __m256i tr2_2 = _mm256_unpacklo_epi64(tr1_2, tr1_6);
- __m256i tr2_3 = _mm256_unpackhi_epi64(tr1_2, tr1_6);
- __m256i tr2_4 = _mm256_unpacklo_epi64(tr1_1, tr1_5);
- __m256i tr2_5 = _mm256_unpackhi_epi64(tr1_1, tr1_5);
- __m256i tr2_6 = _mm256_unpacklo_epi64(tr1_3, tr1_7);
- __m256i tr2_7 = _mm256_unpackhi_epi64(tr1_3, tr1_7);
- // 00 20 40 60 80 100 120 140 08 28 48 68 88 108 128 148
- // 01 21 41 61 81 101 121 141 09 29 49 69 89 109 129 149
- // 02 22 42 62 82 102 122 142 10 30 50 70 90 110 130 150
- // 03 23 43 63 83 103 123 143 11 31 51 71 91 101 131 151
- // 04 24 44 64 84 104 124 144 12 32 52 72 92 112 132 152
- // 05 25 45 65 85 105 125 145 13 33 53 73 93 113 133 153
- // 06 26 46 66 86 106 126 146 14 34 54 74 94 114 134 154
- // 07 27 47 67 87 107 127 147 15 35 55 75 95 115 135 155
- if (0 == pass) {
- // output[j] = (output[j] + 1 + (output[j] > 0)) >> 2;
- // TODO(cd): see quality impact of only doing
- // output[j] = (output[j] + 1) >> 2;
- // which would remove the code between here ...
- __m256i tr2_0_0 = _mm256_cmpgt_epi16(tr2_0, kZero);
- __m256i tr2_1_0 = _mm256_cmpgt_epi16(tr2_1, kZero);
- __m256i tr2_2_0 = _mm256_cmpgt_epi16(tr2_2, kZero);
- __m256i tr2_3_0 = _mm256_cmpgt_epi16(tr2_3, kZero);
- __m256i tr2_4_0 = _mm256_cmpgt_epi16(tr2_4, kZero);
- __m256i tr2_5_0 = _mm256_cmpgt_epi16(tr2_5, kZero);
- __m256i tr2_6_0 = _mm256_cmpgt_epi16(tr2_6, kZero);
- __m256i tr2_7_0 = _mm256_cmpgt_epi16(tr2_7, kZero);
- tr2_0 = _mm256_sub_epi16(tr2_0, tr2_0_0);
- tr2_1 = _mm256_sub_epi16(tr2_1, tr2_1_0);
- tr2_2 = _mm256_sub_epi16(tr2_2, tr2_2_0);
- tr2_3 = _mm256_sub_epi16(tr2_3, tr2_3_0);
- tr2_4 = _mm256_sub_epi16(tr2_4, tr2_4_0);
- tr2_5 = _mm256_sub_epi16(tr2_5, tr2_5_0);
- tr2_6 = _mm256_sub_epi16(tr2_6, tr2_6_0);
- tr2_7 = _mm256_sub_epi16(tr2_7, tr2_7_0);
- // ... and here.
- // PS: also change code in vp9/encoder/vp9_dct.c
- tr2_0 = _mm256_add_epi16(tr2_0, kOne);
- tr2_1 = _mm256_add_epi16(tr2_1, kOne);
- tr2_2 = _mm256_add_epi16(tr2_2, kOne);
- tr2_3 = _mm256_add_epi16(tr2_3, kOne);
- tr2_4 = _mm256_add_epi16(tr2_4, kOne);
- tr2_5 = _mm256_add_epi16(tr2_5, kOne);
- tr2_6 = _mm256_add_epi16(tr2_6, kOne);
- tr2_7 = _mm256_add_epi16(tr2_7, kOne);
- tr2_0 = _mm256_srai_epi16(tr2_0, 2);
- tr2_1 = _mm256_srai_epi16(tr2_1, 2);
- tr2_2 = _mm256_srai_epi16(tr2_2, 2);
- tr2_3 = _mm256_srai_epi16(tr2_3, 2);
- tr2_4 = _mm256_srai_epi16(tr2_4, 2);
- tr2_5 = _mm256_srai_epi16(tr2_5, 2);
- tr2_6 = _mm256_srai_epi16(tr2_6, 2);
- tr2_7 = _mm256_srai_epi16(tr2_7, 2);
- }
- // Note: even though all these stores are aligned, using the aligned
- // intrinsic make the code slightly slower.
- _mm_storeu_si128((__m128i *)(output_currStep + 0 * 32), _mm256_castsi256_si128(tr2_0));
- _mm_storeu_si128((__m128i *)(output_currStep + 1 * 32), _mm256_castsi256_si128(tr2_1));
- _mm_storeu_si128((__m128i *)(output_currStep + 2 * 32), _mm256_castsi256_si128(tr2_2));
- _mm_storeu_si128((__m128i *)(output_currStep + 3 * 32), _mm256_castsi256_si128(tr2_3));
- _mm_storeu_si128((__m128i *)(output_currStep + 4 * 32), _mm256_castsi256_si128(tr2_4));
- _mm_storeu_si128((__m128i *)(output_currStep + 5 * 32), _mm256_castsi256_si128(tr2_5));
- _mm_storeu_si128((__m128i *)(output_currStep + 6 * 32), _mm256_castsi256_si128(tr2_6));
- _mm_storeu_si128((__m128i *)(output_currStep + 7 * 32), _mm256_castsi256_si128(tr2_7));
-
- _mm_storeu_si128((__m128i *)(output_nextStep + 0 * 32), _mm256_extractf128_si256(tr2_0,1));
- _mm_storeu_si128((__m128i *)(output_nextStep + 1 * 32), _mm256_extractf128_si256(tr2_1,1));
- _mm_storeu_si128((__m128i *)(output_nextStep + 2 * 32), _mm256_extractf128_si256(tr2_2,1));
- _mm_storeu_si128((__m128i *)(output_nextStep + 3 * 32), _mm256_extractf128_si256(tr2_3,1));
- _mm_storeu_si128((__m128i *)(output_nextStep + 4 * 32), _mm256_extractf128_si256(tr2_4,1));
- _mm_storeu_si128((__m128i *)(output_nextStep + 5 * 32), _mm256_extractf128_si256(tr2_5,1));
- _mm_storeu_si128((__m128i *)(output_nextStep + 6 * 32), _mm256_extractf128_si256(tr2_6,1));
- _mm_storeu_si128((__m128i *)(output_nextStep + 7 * 32), _mm256_extractf128_si256(tr2_7,1));
- // Process next 8x8
- output_currStep += 8;
- output_nextStep += 8;
- }
- }
- }
- }
-} // NOLINT
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_sse2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_sse2.c
deleted file mode 100644
index 2d59775..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct32x32_sse2.c
+++ /dev/null
@@ -1,2688 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <emmintrin.h> // SSE2
-#include "vp9/common/vp9_idct.h" // for cospi constants
-#include "vpx_ports/mem.h"
-
-#if FDCT32x32_HIGH_PRECISION
-static INLINE __m128i k_madd_epi32(__m128i a, __m128i b) {
- __m128i buf0, buf1;
- buf0 = _mm_mul_epu32(a, b);
- a = _mm_srli_epi64(a, 32);
- b = _mm_srli_epi64(b, 32);
- buf1 = _mm_mul_epu32(a, b);
- return _mm_add_epi64(buf0, buf1);
-}
-
-static INLINE __m128i k_packs_epi64(__m128i a, __m128i b) {
- __m128i buf0 = _mm_shuffle_epi32(a, _MM_SHUFFLE(0, 0, 2, 0));
- __m128i buf1 = _mm_shuffle_epi32(b, _MM_SHUFFLE(0, 0, 2, 0));
- return _mm_unpacklo_epi64(buf0, buf1);
-}
-#endif
-
-void FDCT32x32_2D(const int16_t *input,
- int16_t *output_org, int stride) {
- // Calculate pre-multiplied strides
- const int str1 = stride;
- const int str2 = 2 * stride;
- const int str3 = 2 * stride + str1;
- // We need an intermediate buffer between passes.
- DECLARE_ALIGNED(16, int16_t, intermediate[32 * 32]);
- // Constants
- // When we use them, in one case, they are all the same. In all others
- // it's a pair of them that we need to repeat four times. This is done
- // by constructing the 32 bit constant corresponding to that pair.
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(+cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(+cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_m24_m08 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(+cospi_24_64, cospi_8_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(+cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(+cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m28_m04 = pair_set_epi16(-cospi_28_64, -cospi_4_64);
- const __m128i k__cospi_m12_m20 = pair_set_epi16(-cospi_12_64, -cospi_20_64);
- const __m128i k__cospi_p30_p02 = pair_set_epi16(+cospi_30_64, cospi_2_64);
- const __m128i k__cospi_p14_p18 = pair_set_epi16(+cospi_14_64, cospi_18_64);
- const __m128i k__cospi_p22_p10 = pair_set_epi16(+cospi_22_64, cospi_10_64);
- const __m128i k__cospi_p06_p26 = pair_set_epi16(+cospi_6_64, cospi_26_64);
- const __m128i k__cospi_m26_p06 = pair_set_epi16(-cospi_26_64, cospi_6_64);
- const __m128i k__cospi_m10_p22 = pair_set_epi16(-cospi_10_64, cospi_22_64);
- const __m128i k__cospi_m18_p14 = pair_set_epi16(-cospi_18_64, cospi_14_64);
- const __m128i k__cospi_m02_p30 = pair_set_epi16(-cospi_2_64, cospi_30_64);
- const __m128i k__cospi_p31_p01 = pair_set_epi16(+cospi_31_64, cospi_1_64);
- const __m128i k__cospi_p15_p17 = pair_set_epi16(+cospi_15_64, cospi_17_64);
- const __m128i k__cospi_p23_p09 = pair_set_epi16(+cospi_23_64, cospi_9_64);
- const __m128i k__cospi_p07_p25 = pair_set_epi16(+cospi_7_64, cospi_25_64);
- const __m128i k__cospi_m25_p07 = pair_set_epi16(-cospi_25_64, cospi_7_64);
- const __m128i k__cospi_m09_p23 = pair_set_epi16(-cospi_9_64, cospi_23_64);
- const __m128i k__cospi_m17_p15 = pair_set_epi16(-cospi_17_64, cospi_15_64);
- const __m128i k__cospi_m01_p31 = pair_set_epi16(-cospi_1_64, cospi_31_64);
- const __m128i k__cospi_p27_p05 = pair_set_epi16(+cospi_27_64, cospi_5_64);
- const __m128i k__cospi_p11_p21 = pair_set_epi16(+cospi_11_64, cospi_21_64);
- const __m128i k__cospi_p19_p13 = pair_set_epi16(+cospi_19_64, cospi_13_64);
- const __m128i k__cospi_p03_p29 = pair_set_epi16(+cospi_3_64, cospi_29_64);
- const __m128i k__cospi_m29_p03 = pair_set_epi16(-cospi_29_64, cospi_3_64);
- const __m128i k__cospi_m13_p19 = pair_set_epi16(-cospi_13_64, cospi_19_64);
- const __m128i k__cospi_m21_p11 = pair_set_epi16(-cospi_21_64, cospi_11_64);
- const __m128i k__cospi_m05_p27 = pair_set_epi16(-cospi_5_64, cospi_27_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i kZero = _mm_set1_epi16(0);
- const __m128i kOne = _mm_set1_epi16(1);
- // Do the two transform/transpose passes
- int pass;
- for (pass = 0; pass < 2; ++pass) {
- // We process eight columns (transposed rows in second pass) at a time.
- int column_start;
- for (column_start = 0; column_start < 32; column_start += 8) {
- __m128i step1[32];
- __m128i step2[32];
- __m128i step3[32];
- __m128i out[32];
- // Stage 1
- // Note: even though all the loads below are aligned, using the aligned
- // intrinsic make the code slightly slower.
- if (0 == pass) {
- const int16_t *in = &input[column_start];
- // step1[i] = (in[ 0 * stride] + in[(32 - 1) * stride]) << 2;
- // Note: the next four blocks could be in a loop. That would help the
- // instruction cache but is actually slower.
- {
- const int16_t *ina = in + 0 * str1;
- const int16_t *inb = in + 31 * str1;
- __m128i *step1a = &step1[ 0];
- __m128i *step1b = &step1[31];
- const __m128i ina0 = _mm_loadu_si128((const __m128i *)(ina));
- const __m128i ina1 = _mm_loadu_si128((const __m128i *)(ina + str1));
- const __m128i ina2 = _mm_loadu_si128((const __m128i *)(ina + str2));
- const __m128i ina3 = _mm_loadu_si128((const __m128i *)(ina + str3));
- const __m128i inb3 = _mm_loadu_si128((const __m128i *)(inb - str3));
- const __m128i inb2 = _mm_loadu_si128((const __m128i *)(inb - str2));
- const __m128i inb1 = _mm_loadu_si128((const __m128i *)(inb - str1));
- const __m128i inb0 = _mm_loadu_si128((const __m128i *)(inb));
- step1a[ 0] = _mm_add_epi16(ina0, inb0);
- step1a[ 1] = _mm_add_epi16(ina1, inb1);
- step1a[ 2] = _mm_add_epi16(ina2, inb2);
- step1a[ 3] = _mm_add_epi16(ina3, inb3);
- step1b[-3] = _mm_sub_epi16(ina3, inb3);
- step1b[-2] = _mm_sub_epi16(ina2, inb2);
- step1b[-1] = _mm_sub_epi16(ina1, inb1);
- step1b[-0] = _mm_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm_slli_epi16(step1b[-0], 2);
- }
- {
- const int16_t *ina = in + 4 * str1;
- const int16_t *inb = in + 27 * str1;
- __m128i *step1a = &step1[ 4];
- __m128i *step1b = &step1[27];
- const __m128i ina0 = _mm_loadu_si128((const __m128i *)(ina));
- const __m128i ina1 = _mm_loadu_si128((const __m128i *)(ina + str1));
- const __m128i ina2 = _mm_loadu_si128((const __m128i *)(ina + str2));
- const __m128i ina3 = _mm_loadu_si128((const __m128i *)(ina + str3));
- const __m128i inb3 = _mm_loadu_si128((const __m128i *)(inb - str3));
- const __m128i inb2 = _mm_loadu_si128((const __m128i *)(inb - str2));
- const __m128i inb1 = _mm_loadu_si128((const __m128i *)(inb - str1));
- const __m128i inb0 = _mm_loadu_si128((const __m128i *)(inb));
- step1a[ 0] = _mm_add_epi16(ina0, inb0);
- step1a[ 1] = _mm_add_epi16(ina1, inb1);
- step1a[ 2] = _mm_add_epi16(ina2, inb2);
- step1a[ 3] = _mm_add_epi16(ina3, inb3);
- step1b[-3] = _mm_sub_epi16(ina3, inb3);
- step1b[-2] = _mm_sub_epi16(ina2, inb2);
- step1b[-1] = _mm_sub_epi16(ina1, inb1);
- step1b[-0] = _mm_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm_slli_epi16(step1b[-0], 2);
- }
- {
- const int16_t *ina = in + 8 * str1;
- const int16_t *inb = in + 23 * str1;
- __m128i *step1a = &step1[ 8];
- __m128i *step1b = &step1[23];
- const __m128i ina0 = _mm_loadu_si128((const __m128i *)(ina));
- const __m128i ina1 = _mm_loadu_si128((const __m128i *)(ina + str1));
- const __m128i ina2 = _mm_loadu_si128((const __m128i *)(ina + str2));
- const __m128i ina3 = _mm_loadu_si128((const __m128i *)(ina + str3));
- const __m128i inb3 = _mm_loadu_si128((const __m128i *)(inb - str3));
- const __m128i inb2 = _mm_loadu_si128((const __m128i *)(inb - str2));
- const __m128i inb1 = _mm_loadu_si128((const __m128i *)(inb - str1));
- const __m128i inb0 = _mm_loadu_si128((const __m128i *)(inb));
- step1a[ 0] = _mm_add_epi16(ina0, inb0);
- step1a[ 1] = _mm_add_epi16(ina1, inb1);
- step1a[ 2] = _mm_add_epi16(ina2, inb2);
- step1a[ 3] = _mm_add_epi16(ina3, inb3);
- step1b[-3] = _mm_sub_epi16(ina3, inb3);
- step1b[-2] = _mm_sub_epi16(ina2, inb2);
- step1b[-1] = _mm_sub_epi16(ina1, inb1);
- step1b[-0] = _mm_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm_slli_epi16(step1b[-0], 2);
- }
- {
- const int16_t *ina = in + 12 * str1;
- const int16_t *inb = in + 19 * str1;
- __m128i *step1a = &step1[12];
- __m128i *step1b = &step1[19];
- const __m128i ina0 = _mm_loadu_si128((const __m128i *)(ina));
- const __m128i ina1 = _mm_loadu_si128((const __m128i *)(ina + str1));
- const __m128i ina2 = _mm_loadu_si128((const __m128i *)(ina + str2));
- const __m128i ina3 = _mm_loadu_si128((const __m128i *)(ina + str3));
- const __m128i inb3 = _mm_loadu_si128((const __m128i *)(inb - str3));
- const __m128i inb2 = _mm_loadu_si128((const __m128i *)(inb - str2));
- const __m128i inb1 = _mm_loadu_si128((const __m128i *)(inb - str1));
- const __m128i inb0 = _mm_loadu_si128((const __m128i *)(inb));
- step1a[ 0] = _mm_add_epi16(ina0, inb0);
- step1a[ 1] = _mm_add_epi16(ina1, inb1);
- step1a[ 2] = _mm_add_epi16(ina2, inb2);
- step1a[ 3] = _mm_add_epi16(ina3, inb3);
- step1b[-3] = _mm_sub_epi16(ina3, inb3);
- step1b[-2] = _mm_sub_epi16(ina2, inb2);
- step1b[-1] = _mm_sub_epi16(ina1, inb1);
- step1b[-0] = _mm_sub_epi16(ina0, inb0);
- step1a[ 0] = _mm_slli_epi16(step1a[ 0], 2);
- step1a[ 1] = _mm_slli_epi16(step1a[ 1], 2);
- step1a[ 2] = _mm_slli_epi16(step1a[ 2], 2);
- step1a[ 3] = _mm_slli_epi16(step1a[ 3], 2);
- step1b[-3] = _mm_slli_epi16(step1b[-3], 2);
- step1b[-2] = _mm_slli_epi16(step1b[-2], 2);
- step1b[-1] = _mm_slli_epi16(step1b[-1], 2);
- step1b[-0] = _mm_slli_epi16(step1b[-0], 2);
- }
- } else {
- int16_t *in = &intermediate[column_start];
- // step1[i] = in[ 0 * 32] + in[(32 - 1) * 32];
- // Note: using the same approach as above to have common offset is
- // counter-productive as all offsets can be calculated at compile
- // time.
- // Note: the next four blocks could be in a loop. That would help the
- // instruction cache but is actually slower.
- {
- __m128i in00 = _mm_loadu_si128((const __m128i *)(in + 0 * 32));
- __m128i in01 = _mm_loadu_si128((const __m128i *)(in + 1 * 32));
- __m128i in02 = _mm_loadu_si128((const __m128i *)(in + 2 * 32));
- __m128i in03 = _mm_loadu_si128((const __m128i *)(in + 3 * 32));
- __m128i in28 = _mm_loadu_si128((const __m128i *)(in + 28 * 32));
- __m128i in29 = _mm_loadu_si128((const __m128i *)(in + 29 * 32));
- __m128i in30 = _mm_loadu_si128((const __m128i *)(in + 30 * 32));
- __m128i in31 = _mm_loadu_si128((const __m128i *)(in + 31 * 32));
- step1[ 0] = _mm_add_epi16(in00, in31);
- step1[ 1] = _mm_add_epi16(in01, in30);
- step1[ 2] = _mm_add_epi16(in02, in29);
- step1[ 3] = _mm_add_epi16(in03, in28);
- step1[28] = _mm_sub_epi16(in03, in28);
- step1[29] = _mm_sub_epi16(in02, in29);
- step1[30] = _mm_sub_epi16(in01, in30);
- step1[31] = _mm_sub_epi16(in00, in31);
- }
- {
- __m128i in04 = _mm_loadu_si128((const __m128i *)(in + 4 * 32));
- __m128i in05 = _mm_loadu_si128((const __m128i *)(in + 5 * 32));
- __m128i in06 = _mm_loadu_si128((const __m128i *)(in + 6 * 32));
- __m128i in07 = _mm_loadu_si128((const __m128i *)(in + 7 * 32));
- __m128i in24 = _mm_loadu_si128((const __m128i *)(in + 24 * 32));
- __m128i in25 = _mm_loadu_si128((const __m128i *)(in + 25 * 32));
- __m128i in26 = _mm_loadu_si128((const __m128i *)(in + 26 * 32));
- __m128i in27 = _mm_loadu_si128((const __m128i *)(in + 27 * 32));
- step1[ 4] = _mm_add_epi16(in04, in27);
- step1[ 5] = _mm_add_epi16(in05, in26);
- step1[ 6] = _mm_add_epi16(in06, in25);
- step1[ 7] = _mm_add_epi16(in07, in24);
- step1[24] = _mm_sub_epi16(in07, in24);
- step1[25] = _mm_sub_epi16(in06, in25);
- step1[26] = _mm_sub_epi16(in05, in26);
- step1[27] = _mm_sub_epi16(in04, in27);
- }
- {
- __m128i in08 = _mm_loadu_si128((const __m128i *)(in + 8 * 32));
- __m128i in09 = _mm_loadu_si128((const __m128i *)(in + 9 * 32));
- __m128i in10 = _mm_loadu_si128((const __m128i *)(in + 10 * 32));
- __m128i in11 = _mm_loadu_si128((const __m128i *)(in + 11 * 32));
- __m128i in20 = _mm_loadu_si128((const __m128i *)(in + 20 * 32));
- __m128i in21 = _mm_loadu_si128((const __m128i *)(in + 21 * 32));
- __m128i in22 = _mm_loadu_si128((const __m128i *)(in + 22 * 32));
- __m128i in23 = _mm_loadu_si128((const __m128i *)(in + 23 * 32));
- step1[ 8] = _mm_add_epi16(in08, in23);
- step1[ 9] = _mm_add_epi16(in09, in22);
- step1[10] = _mm_add_epi16(in10, in21);
- step1[11] = _mm_add_epi16(in11, in20);
- step1[20] = _mm_sub_epi16(in11, in20);
- step1[21] = _mm_sub_epi16(in10, in21);
- step1[22] = _mm_sub_epi16(in09, in22);
- step1[23] = _mm_sub_epi16(in08, in23);
- }
- {
- __m128i in12 = _mm_loadu_si128((const __m128i *)(in + 12 * 32));
- __m128i in13 = _mm_loadu_si128((const __m128i *)(in + 13 * 32));
- __m128i in14 = _mm_loadu_si128((const __m128i *)(in + 14 * 32));
- __m128i in15 = _mm_loadu_si128((const __m128i *)(in + 15 * 32));
- __m128i in16 = _mm_loadu_si128((const __m128i *)(in + 16 * 32));
- __m128i in17 = _mm_loadu_si128((const __m128i *)(in + 17 * 32));
- __m128i in18 = _mm_loadu_si128((const __m128i *)(in + 18 * 32));
- __m128i in19 = _mm_loadu_si128((const __m128i *)(in + 19 * 32));
- step1[12] = _mm_add_epi16(in12, in19);
- step1[13] = _mm_add_epi16(in13, in18);
- step1[14] = _mm_add_epi16(in14, in17);
- step1[15] = _mm_add_epi16(in15, in16);
- step1[16] = _mm_sub_epi16(in15, in16);
- step1[17] = _mm_sub_epi16(in14, in17);
- step1[18] = _mm_sub_epi16(in13, in18);
- step1[19] = _mm_sub_epi16(in12, in19);
- }
- }
- // Stage 2
- {
- step2[ 0] = _mm_add_epi16(step1[0], step1[15]);
- step2[ 1] = _mm_add_epi16(step1[1], step1[14]);
- step2[ 2] = _mm_add_epi16(step1[2], step1[13]);
- step2[ 3] = _mm_add_epi16(step1[3], step1[12]);
- step2[ 4] = _mm_add_epi16(step1[4], step1[11]);
- step2[ 5] = _mm_add_epi16(step1[5], step1[10]);
- step2[ 6] = _mm_add_epi16(step1[6], step1[ 9]);
- step2[ 7] = _mm_add_epi16(step1[7], step1[ 8]);
- step2[ 8] = _mm_sub_epi16(step1[7], step1[ 8]);
- step2[ 9] = _mm_sub_epi16(step1[6], step1[ 9]);
- step2[10] = _mm_sub_epi16(step1[5], step1[10]);
- step2[11] = _mm_sub_epi16(step1[4], step1[11]);
- step2[12] = _mm_sub_epi16(step1[3], step1[12]);
- step2[13] = _mm_sub_epi16(step1[2], step1[13]);
- step2[14] = _mm_sub_epi16(step1[1], step1[14]);
- step2[15] = _mm_sub_epi16(step1[0], step1[15]);
- }
- {
- const __m128i s2_20_0 = _mm_unpacklo_epi16(step1[27], step1[20]);
- const __m128i s2_20_1 = _mm_unpackhi_epi16(step1[27], step1[20]);
- const __m128i s2_21_0 = _mm_unpacklo_epi16(step1[26], step1[21]);
- const __m128i s2_21_1 = _mm_unpackhi_epi16(step1[26], step1[21]);
- const __m128i s2_22_0 = _mm_unpacklo_epi16(step1[25], step1[22]);
- const __m128i s2_22_1 = _mm_unpackhi_epi16(step1[25], step1[22]);
- const __m128i s2_23_0 = _mm_unpacklo_epi16(step1[24], step1[23]);
- const __m128i s2_23_1 = _mm_unpackhi_epi16(step1[24], step1[23]);
- const __m128i s2_20_2 = _mm_madd_epi16(s2_20_0, k__cospi_p16_m16);
- const __m128i s2_20_3 = _mm_madd_epi16(s2_20_1, k__cospi_p16_m16);
- const __m128i s2_21_2 = _mm_madd_epi16(s2_21_0, k__cospi_p16_m16);
- const __m128i s2_21_3 = _mm_madd_epi16(s2_21_1, k__cospi_p16_m16);
- const __m128i s2_22_2 = _mm_madd_epi16(s2_22_0, k__cospi_p16_m16);
- const __m128i s2_22_3 = _mm_madd_epi16(s2_22_1, k__cospi_p16_m16);
- const __m128i s2_23_2 = _mm_madd_epi16(s2_23_0, k__cospi_p16_m16);
- const __m128i s2_23_3 = _mm_madd_epi16(s2_23_1, k__cospi_p16_m16);
- const __m128i s2_24_2 = _mm_madd_epi16(s2_23_0, k__cospi_p16_p16);
- const __m128i s2_24_3 = _mm_madd_epi16(s2_23_1, k__cospi_p16_p16);
- const __m128i s2_25_2 = _mm_madd_epi16(s2_22_0, k__cospi_p16_p16);
- const __m128i s2_25_3 = _mm_madd_epi16(s2_22_1, k__cospi_p16_p16);
- const __m128i s2_26_2 = _mm_madd_epi16(s2_21_0, k__cospi_p16_p16);
- const __m128i s2_26_3 = _mm_madd_epi16(s2_21_1, k__cospi_p16_p16);
- const __m128i s2_27_2 = _mm_madd_epi16(s2_20_0, k__cospi_p16_p16);
- const __m128i s2_27_3 = _mm_madd_epi16(s2_20_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i s2_20_4 = _mm_add_epi32(s2_20_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_20_5 = _mm_add_epi32(s2_20_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_21_4 = _mm_add_epi32(s2_21_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_21_5 = _mm_add_epi32(s2_21_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_22_4 = _mm_add_epi32(s2_22_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_22_5 = _mm_add_epi32(s2_22_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_23_4 = _mm_add_epi32(s2_23_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_23_5 = _mm_add_epi32(s2_23_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_24_4 = _mm_add_epi32(s2_24_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_24_5 = _mm_add_epi32(s2_24_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_25_4 = _mm_add_epi32(s2_25_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_25_5 = _mm_add_epi32(s2_25_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_26_4 = _mm_add_epi32(s2_26_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_26_5 = _mm_add_epi32(s2_26_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_27_4 = _mm_add_epi32(s2_27_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_27_5 = _mm_add_epi32(s2_27_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_20_6 = _mm_srai_epi32(s2_20_4, DCT_CONST_BITS);
- const __m128i s2_20_7 = _mm_srai_epi32(s2_20_5, DCT_CONST_BITS);
- const __m128i s2_21_6 = _mm_srai_epi32(s2_21_4, DCT_CONST_BITS);
- const __m128i s2_21_7 = _mm_srai_epi32(s2_21_5, DCT_CONST_BITS);
- const __m128i s2_22_6 = _mm_srai_epi32(s2_22_4, DCT_CONST_BITS);
- const __m128i s2_22_7 = _mm_srai_epi32(s2_22_5, DCT_CONST_BITS);
- const __m128i s2_23_6 = _mm_srai_epi32(s2_23_4, DCT_CONST_BITS);
- const __m128i s2_23_7 = _mm_srai_epi32(s2_23_5, DCT_CONST_BITS);
- const __m128i s2_24_6 = _mm_srai_epi32(s2_24_4, DCT_CONST_BITS);
- const __m128i s2_24_7 = _mm_srai_epi32(s2_24_5, DCT_CONST_BITS);
- const __m128i s2_25_6 = _mm_srai_epi32(s2_25_4, DCT_CONST_BITS);
- const __m128i s2_25_7 = _mm_srai_epi32(s2_25_5, DCT_CONST_BITS);
- const __m128i s2_26_6 = _mm_srai_epi32(s2_26_4, DCT_CONST_BITS);
- const __m128i s2_26_7 = _mm_srai_epi32(s2_26_5, DCT_CONST_BITS);
- const __m128i s2_27_6 = _mm_srai_epi32(s2_27_4, DCT_CONST_BITS);
- const __m128i s2_27_7 = _mm_srai_epi32(s2_27_5, DCT_CONST_BITS);
- // Combine
- step2[20] = _mm_packs_epi32(s2_20_6, s2_20_7);
- step2[21] = _mm_packs_epi32(s2_21_6, s2_21_7);
- step2[22] = _mm_packs_epi32(s2_22_6, s2_22_7);
- step2[23] = _mm_packs_epi32(s2_23_6, s2_23_7);
- step2[24] = _mm_packs_epi32(s2_24_6, s2_24_7);
- step2[25] = _mm_packs_epi32(s2_25_6, s2_25_7);
- step2[26] = _mm_packs_epi32(s2_26_6, s2_26_7);
- step2[27] = _mm_packs_epi32(s2_27_6, s2_27_7);
- }
-
-#if !FDCT32x32_HIGH_PRECISION
- // dump the magnitude by half, hence the intermediate values are within
- // the range of 16 bits.
- if (1 == pass) {
- __m128i s3_00_0 = _mm_cmplt_epi16(step2[ 0], kZero);
- __m128i s3_01_0 = _mm_cmplt_epi16(step2[ 1], kZero);
- __m128i s3_02_0 = _mm_cmplt_epi16(step2[ 2], kZero);
- __m128i s3_03_0 = _mm_cmplt_epi16(step2[ 3], kZero);
- __m128i s3_04_0 = _mm_cmplt_epi16(step2[ 4], kZero);
- __m128i s3_05_0 = _mm_cmplt_epi16(step2[ 5], kZero);
- __m128i s3_06_0 = _mm_cmplt_epi16(step2[ 6], kZero);
- __m128i s3_07_0 = _mm_cmplt_epi16(step2[ 7], kZero);
- __m128i s2_08_0 = _mm_cmplt_epi16(step2[ 8], kZero);
- __m128i s2_09_0 = _mm_cmplt_epi16(step2[ 9], kZero);
- __m128i s3_10_0 = _mm_cmplt_epi16(step2[10], kZero);
- __m128i s3_11_0 = _mm_cmplt_epi16(step2[11], kZero);
- __m128i s3_12_0 = _mm_cmplt_epi16(step2[12], kZero);
- __m128i s3_13_0 = _mm_cmplt_epi16(step2[13], kZero);
- __m128i s2_14_0 = _mm_cmplt_epi16(step2[14], kZero);
- __m128i s2_15_0 = _mm_cmplt_epi16(step2[15], kZero);
- __m128i s3_16_0 = _mm_cmplt_epi16(step1[16], kZero);
- __m128i s3_17_0 = _mm_cmplt_epi16(step1[17], kZero);
- __m128i s3_18_0 = _mm_cmplt_epi16(step1[18], kZero);
- __m128i s3_19_0 = _mm_cmplt_epi16(step1[19], kZero);
- __m128i s3_20_0 = _mm_cmplt_epi16(step2[20], kZero);
- __m128i s3_21_0 = _mm_cmplt_epi16(step2[21], kZero);
- __m128i s3_22_0 = _mm_cmplt_epi16(step2[22], kZero);
- __m128i s3_23_0 = _mm_cmplt_epi16(step2[23], kZero);
- __m128i s3_24_0 = _mm_cmplt_epi16(step2[24], kZero);
- __m128i s3_25_0 = _mm_cmplt_epi16(step2[25], kZero);
- __m128i s3_26_0 = _mm_cmplt_epi16(step2[26], kZero);
- __m128i s3_27_0 = _mm_cmplt_epi16(step2[27], kZero);
- __m128i s3_28_0 = _mm_cmplt_epi16(step1[28], kZero);
- __m128i s3_29_0 = _mm_cmplt_epi16(step1[29], kZero);
- __m128i s3_30_0 = _mm_cmplt_epi16(step1[30], kZero);
- __m128i s3_31_0 = _mm_cmplt_epi16(step1[31], kZero);
-
- step2[ 0] = _mm_sub_epi16(step2[ 0], s3_00_0);
- step2[ 1] = _mm_sub_epi16(step2[ 1], s3_01_0);
- step2[ 2] = _mm_sub_epi16(step2[ 2], s3_02_0);
- step2[ 3] = _mm_sub_epi16(step2[ 3], s3_03_0);
- step2[ 4] = _mm_sub_epi16(step2[ 4], s3_04_0);
- step2[ 5] = _mm_sub_epi16(step2[ 5], s3_05_0);
- step2[ 6] = _mm_sub_epi16(step2[ 6], s3_06_0);
- step2[ 7] = _mm_sub_epi16(step2[ 7], s3_07_0);
- step2[ 8] = _mm_sub_epi16(step2[ 8], s2_08_0);
- step2[ 9] = _mm_sub_epi16(step2[ 9], s2_09_0);
- step2[10] = _mm_sub_epi16(step2[10], s3_10_0);
- step2[11] = _mm_sub_epi16(step2[11], s3_11_0);
- step2[12] = _mm_sub_epi16(step2[12], s3_12_0);
- step2[13] = _mm_sub_epi16(step2[13], s3_13_0);
- step2[14] = _mm_sub_epi16(step2[14], s2_14_0);
- step2[15] = _mm_sub_epi16(step2[15], s2_15_0);
- step1[16] = _mm_sub_epi16(step1[16], s3_16_0);
- step1[17] = _mm_sub_epi16(step1[17], s3_17_0);
- step1[18] = _mm_sub_epi16(step1[18], s3_18_0);
- step1[19] = _mm_sub_epi16(step1[19], s3_19_0);
- step2[20] = _mm_sub_epi16(step2[20], s3_20_0);
- step2[21] = _mm_sub_epi16(step2[21], s3_21_0);
- step2[22] = _mm_sub_epi16(step2[22], s3_22_0);
- step2[23] = _mm_sub_epi16(step2[23], s3_23_0);
- step2[24] = _mm_sub_epi16(step2[24], s3_24_0);
- step2[25] = _mm_sub_epi16(step2[25], s3_25_0);
- step2[26] = _mm_sub_epi16(step2[26], s3_26_0);
- step2[27] = _mm_sub_epi16(step2[27], s3_27_0);
- step1[28] = _mm_sub_epi16(step1[28], s3_28_0);
- step1[29] = _mm_sub_epi16(step1[29], s3_29_0);
- step1[30] = _mm_sub_epi16(step1[30], s3_30_0);
- step1[31] = _mm_sub_epi16(step1[31], s3_31_0);
-
- step2[ 0] = _mm_add_epi16(step2[ 0], kOne);
- step2[ 1] = _mm_add_epi16(step2[ 1], kOne);
- step2[ 2] = _mm_add_epi16(step2[ 2], kOne);
- step2[ 3] = _mm_add_epi16(step2[ 3], kOne);
- step2[ 4] = _mm_add_epi16(step2[ 4], kOne);
- step2[ 5] = _mm_add_epi16(step2[ 5], kOne);
- step2[ 6] = _mm_add_epi16(step2[ 6], kOne);
- step2[ 7] = _mm_add_epi16(step2[ 7], kOne);
- step2[ 8] = _mm_add_epi16(step2[ 8], kOne);
- step2[ 9] = _mm_add_epi16(step2[ 9], kOne);
- step2[10] = _mm_add_epi16(step2[10], kOne);
- step2[11] = _mm_add_epi16(step2[11], kOne);
- step2[12] = _mm_add_epi16(step2[12], kOne);
- step2[13] = _mm_add_epi16(step2[13], kOne);
- step2[14] = _mm_add_epi16(step2[14], kOne);
- step2[15] = _mm_add_epi16(step2[15], kOne);
- step1[16] = _mm_add_epi16(step1[16], kOne);
- step1[17] = _mm_add_epi16(step1[17], kOne);
- step1[18] = _mm_add_epi16(step1[18], kOne);
- step1[19] = _mm_add_epi16(step1[19], kOne);
- step2[20] = _mm_add_epi16(step2[20], kOne);
- step2[21] = _mm_add_epi16(step2[21], kOne);
- step2[22] = _mm_add_epi16(step2[22], kOne);
- step2[23] = _mm_add_epi16(step2[23], kOne);
- step2[24] = _mm_add_epi16(step2[24], kOne);
- step2[25] = _mm_add_epi16(step2[25], kOne);
- step2[26] = _mm_add_epi16(step2[26], kOne);
- step2[27] = _mm_add_epi16(step2[27], kOne);
- step1[28] = _mm_add_epi16(step1[28], kOne);
- step1[29] = _mm_add_epi16(step1[29], kOne);
- step1[30] = _mm_add_epi16(step1[30], kOne);
- step1[31] = _mm_add_epi16(step1[31], kOne);
-
- step2[ 0] = _mm_srai_epi16(step2[ 0], 2);
- step2[ 1] = _mm_srai_epi16(step2[ 1], 2);
- step2[ 2] = _mm_srai_epi16(step2[ 2], 2);
- step2[ 3] = _mm_srai_epi16(step2[ 3], 2);
- step2[ 4] = _mm_srai_epi16(step2[ 4], 2);
- step2[ 5] = _mm_srai_epi16(step2[ 5], 2);
- step2[ 6] = _mm_srai_epi16(step2[ 6], 2);
- step2[ 7] = _mm_srai_epi16(step2[ 7], 2);
- step2[ 8] = _mm_srai_epi16(step2[ 8], 2);
- step2[ 9] = _mm_srai_epi16(step2[ 9], 2);
- step2[10] = _mm_srai_epi16(step2[10], 2);
- step2[11] = _mm_srai_epi16(step2[11], 2);
- step2[12] = _mm_srai_epi16(step2[12], 2);
- step2[13] = _mm_srai_epi16(step2[13], 2);
- step2[14] = _mm_srai_epi16(step2[14], 2);
- step2[15] = _mm_srai_epi16(step2[15], 2);
- step1[16] = _mm_srai_epi16(step1[16], 2);
- step1[17] = _mm_srai_epi16(step1[17], 2);
- step1[18] = _mm_srai_epi16(step1[18], 2);
- step1[19] = _mm_srai_epi16(step1[19], 2);
- step2[20] = _mm_srai_epi16(step2[20], 2);
- step2[21] = _mm_srai_epi16(step2[21], 2);
- step2[22] = _mm_srai_epi16(step2[22], 2);
- step2[23] = _mm_srai_epi16(step2[23], 2);
- step2[24] = _mm_srai_epi16(step2[24], 2);
- step2[25] = _mm_srai_epi16(step2[25], 2);
- step2[26] = _mm_srai_epi16(step2[26], 2);
- step2[27] = _mm_srai_epi16(step2[27], 2);
- step1[28] = _mm_srai_epi16(step1[28], 2);
- step1[29] = _mm_srai_epi16(step1[29], 2);
- step1[30] = _mm_srai_epi16(step1[30], 2);
- step1[31] = _mm_srai_epi16(step1[31], 2);
- }
-#endif
-
-#if FDCT32x32_HIGH_PRECISION
- if (pass == 0) {
-#endif
- // Stage 3
- {
- step3[0] = _mm_add_epi16(step2[(8 - 1)], step2[0]);
- step3[1] = _mm_add_epi16(step2[(8 - 2)], step2[1]);
- step3[2] = _mm_add_epi16(step2[(8 - 3)], step2[2]);
- step3[3] = _mm_add_epi16(step2[(8 - 4)], step2[3]);
- step3[4] = _mm_sub_epi16(step2[(8 - 5)], step2[4]);
- step3[5] = _mm_sub_epi16(step2[(8 - 6)], step2[5]);
- step3[6] = _mm_sub_epi16(step2[(8 - 7)], step2[6]);
- step3[7] = _mm_sub_epi16(step2[(8 - 8)], step2[7]);
- }
- {
- const __m128i s3_10_0 = _mm_unpacklo_epi16(step2[13], step2[10]);
- const __m128i s3_10_1 = _mm_unpackhi_epi16(step2[13], step2[10]);
- const __m128i s3_11_0 = _mm_unpacklo_epi16(step2[12], step2[11]);
- const __m128i s3_11_1 = _mm_unpackhi_epi16(step2[12], step2[11]);
- const __m128i s3_10_2 = _mm_madd_epi16(s3_10_0, k__cospi_p16_m16);
- const __m128i s3_10_3 = _mm_madd_epi16(s3_10_1, k__cospi_p16_m16);
- const __m128i s3_11_2 = _mm_madd_epi16(s3_11_0, k__cospi_p16_m16);
- const __m128i s3_11_3 = _mm_madd_epi16(s3_11_1, k__cospi_p16_m16);
- const __m128i s3_12_2 = _mm_madd_epi16(s3_11_0, k__cospi_p16_p16);
- const __m128i s3_12_3 = _mm_madd_epi16(s3_11_1, k__cospi_p16_p16);
- const __m128i s3_13_2 = _mm_madd_epi16(s3_10_0, k__cospi_p16_p16);
- const __m128i s3_13_3 = _mm_madd_epi16(s3_10_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i s3_10_4 = _mm_add_epi32(s3_10_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_10_5 = _mm_add_epi32(s3_10_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_11_4 = _mm_add_epi32(s3_11_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_11_5 = _mm_add_epi32(s3_11_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_12_4 = _mm_add_epi32(s3_12_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_12_5 = _mm_add_epi32(s3_12_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_13_4 = _mm_add_epi32(s3_13_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_13_5 = _mm_add_epi32(s3_13_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_10_6 = _mm_srai_epi32(s3_10_4, DCT_CONST_BITS);
- const __m128i s3_10_7 = _mm_srai_epi32(s3_10_5, DCT_CONST_BITS);
- const __m128i s3_11_6 = _mm_srai_epi32(s3_11_4, DCT_CONST_BITS);
- const __m128i s3_11_7 = _mm_srai_epi32(s3_11_5, DCT_CONST_BITS);
- const __m128i s3_12_6 = _mm_srai_epi32(s3_12_4, DCT_CONST_BITS);
- const __m128i s3_12_7 = _mm_srai_epi32(s3_12_5, DCT_CONST_BITS);
- const __m128i s3_13_6 = _mm_srai_epi32(s3_13_4, DCT_CONST_BITS);
- const __m128i s3_13_7 = _mm_srai_epi32(s3_13_5, DCT_CONST_BITS);
- // Combine
- step3[10] = _mm_packs_epi32(s3_10_6, s3_10_7);
- step3[11] = _mm_packs_epi32(s3_11_6, s3_11_7);
- step3[12] = _mm_packs_epi32(s3_12_6, s3_12_7);
- step3[13] = _mm_packs_epi32(s3_13_6, s3_13_7);
- }
- {
- step3[16] = _mm_add_epi16(step2[23], step1[16]);
- step3[17] = _mm_add_epi16(step2[22], step1[17]);
- step3[18] = _mm_add_epi16(step2[21], step1[18]);
- step3[19] = _mm_add_epi16(step2[20], step1[19]);
- step3[20] = _mm_sub_epi16(step1[19], step2[20]);
- step3[21] = _mm_sub_epi16(step1[18], step2[21]);
- step3[22] = _mm_sub_epi16(step1[17], step2[22]);
- step3[23] = _mm_sub_epi16(step1[16], step2[23]);
- step3[24] = _mm_sub_epi16(step1[31], step2[24]);
- step3[25] = _mm_sub_epi16(step1[30], step2[25]);
- step3[26] = _mm_sub_epi16(step1[29], step2[26]);
- step3[27] = _mm_sub_epi16(step1[28], step2[27]);
- step3[28] = _mm_add_epi16(step2[27], step1[28]);
- step3[29] = _mm_add_epi16(step2[26], step1[29]);
- step3[30] = _mm_add_epi16(step2[25], step1[30]);
- step3[31] = _mm_add_epi16(step2[24], step1[31]);
- }
-
- // Stage 4
- {
- step1[ 0] = _mm_add_epi16(step3[ 3], step3[ 0]);
- step1[ 1] = _mm_add_epi16(step3[ 2], step3[ 1]);
- step1[ 2] = _mm_sub_epi16(step3[ 1], step3[ 2]);
- step1[ 3] = _mm_sub_epi16(step3[ 0], step3[ 3]);
- step1[ 8] = _mm_add_epi16(step3[11], step2[ 8]);
- step1[ 9] = _mm_add_epi16(step3[10], step2[ 9]);
- step1[10] = _mm_sub_epi16(step2[ 9], step3[10]);
- step1[11] = _mm_sub_epi16(step2[ 8], step3[11]);
- step1[12] = _mm_sub_epi16(step2[15], step3[12]);
- step1[13] = _mm_sub_epi16(step2[14], step3[13]);
- step1[14] = _mm_add_epi16(step3[13], step2[14]);
- step1[15] = _mm_add_epi16(step3[12], step2[15]);
- }
- {
- const __m128i s1_05_0 = _mm_unpacklo_epi16(step3[6], step3[5]);
- const __m128i s1_05_1 = _mm_unpackhi_epi16(step3[6], step3[5]);
- const __m128i s1_05_2 = _mm_madd_epi16(s1_05_0, k__cospi_p16_m16);
- const __m128i s1_05_3 = _mm_madd_epi16(s1_05_1, k__cospi_p16_m16);
- const __m128i s1_06_2 = _mm_madd_epi16(s1_05_0, k__cospi_p16_p16);
- const __m128i s1_06_3 = _mm_madd_epi16(s1_05_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i s1_05_4 = _mm_add_epi32(s1_05_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_05_5 = _mm_add_epi32(s1_05_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_06_4 = _mm_add_epi32(s1_06_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_06_5 = _mm_add_epi32(s1_06_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_05_6 = _mm_srai_epi32(s1_05_4, DCT_CONST_BITS);
- const __m128i s1_05_7 = _mm_srai_epi32(s1_05_5, DCT_CONST_BITS);
- const __m128i s1_06_6 = _mm_srai_epi32(s1_06_4, DCT_CONST_BITS);
- const __m128i s1_06_7 = _mm_srai_epi32(s1_06_5, DCT_CONST_BITS);
- // Combine
- step1[5] = _mm_packs_epi32(s1_05_6, s1_05_7);
- step1[6] = _mm_packs_epi32(s1_06_6, s1_06_7);
- }
- {
- const __m128i s1_18_0 = _mm_unpacklo_epi16(step3[18], step3[29]);
- const __m128i s1_18_1 = _mm_unpackhi_epi16(step3[18], step3[29]);
- const __m128i s1_19_0 = _mm_unpacklo_epi16(step3[19], step3[28]);
- const __m128i s1_19_1 = _mm_unpackhi_epi16(step3[19], step3[28]);
- const __m128i s1_20_0 = _mm_unpacklo_epi16(step3[20], step3[27]);
- const __m128i s1_20_1 = _mm_unpackhi_epi16(step3[20], step3[27]);
- const __m128i s1_21_0 = _mm_unpacklo_epi16(step3[21], step3[26]);
- const __m128i s1_21_1 = _mm_unpackhi_epi16(step3[21], step3[26]);
- const __m128i s1_18_2 = _mm_madd_epi16(s1_18_0, k__cospi_m08_p24);
- const __m128i s1_18_3 = _mm_madd_epi16(s1_18_1, k__cospi_m08_p24);
- const __m128i s1_19_2 = _mm_madd_epi16(s1_19_0, k__cospi_m08_p24);
- const __m128i s1_19_3 = _mm_madd_epi16(s1_19_1, k__cospi_m08_p24);
- const __m128i s1_20_2 = _mm_madd_epi16(s1_20_0, k__cospi_m24_m08);
- const __m128i s1_20_3 = _mm_madd_epi16(s1_20_1, k__cospi_m24_m08);
- const __m128i s1_21_2 = _mm_madd_epi16(s1_21_0, k__cospi_m24_m08);
- const __m128i s1_21_3 = _mm_madd_epi16(s1_21_1, k__cospi_m24_m08);
- const __m128i s1_26_2 = _mm_madd_epi16(s1_21_0, k__cospi_m08_p24);
- const __m128i s1_26_3 = _mm_madd_epi16(s1_21_1, k__cospi_m08_p24);
- const __m128i s1_27_2 = _mm_madd_epi16(s1_20_0, k__cospi_m08_p24);
- const __m128i s1_27_3 = _mm_madd_epi16(s1_20_1, k__cospi_m08_p24);
- const __m128i s1_28_2 = _mm_madd_epi16(s1_19_0, k__cospi_p24_p08);
- const __m128i s1_28_3 = _mm_madd_epi16(s1_19_1, k__cospi_p24_p08);
- const __m128i s1_29_2 = _mm_madd_epi16(s1_18_0, k__cospi_p24_p08);
- const __m128i s1_29_3 = _mm_madd_epi16(s1_18_1, k__cospi_p24_p08);
- // dct_const_round_shift
- const __m128i s1_18_4 = _mm_add_epi32(s1_18_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_18_5 = _mm_add_epi32(s1_18_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_19_4 = _mm_add_epi32(s1_19_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_19_5 = _mm_add_epi32(s1_19_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_20_4 = _mm_add_epi32(s1_20_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_20_5 = _mm_add_epi32(s1_20_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_21_4 = _mm_add_epi32(s1_21_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_21_5 = _mm_add_epi32(s1_21_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_26_4 = _mm_add_epi32(s1_26_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_26_5 = _mm_add_epi32(s1_26_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_27_4 = _mm_add_epi32(s1_27_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_27_5 = _mm_add_epi32(s1_27_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_28_4 = _mm_add_epi32(s1_28_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_28_5 = _mm_add_epi32(s1_28_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_29_4 = _mm_add_epi32(s1_29_2, k__DCT_CONST_ROUNDING);
- const __m128i s1_29_5 = _mm_add_epi32(s1_29_3, k__DCT_CONST_ROUNDING);
- const __m128i s1_18_6 = _mm_srai_epi32(s1_18_4, DCT_CONST_BITS);
- const __m128i s1_18_7 = _mm_srai_epi32(s1_18_5, DCT_CONST_BITS);
- const __m128i s1_19_6 = _mm_srai_epi32(s1_19_4, DCT_CONST_BITS);
- const __m128i s1_19_7 = _mm_srai_epi32(s1_19_5, DCT_CONST_BITS);
- const __m128i s1_20_6 = _mm_srai_epi32(s1_20_4, DCT_CONST_BITS);
- const __m128i s1_20_7 = _mm_srai_epi32(s1_20_5, DCT_CONST_BITS);
- const __m128i s1_21_6 = _mm_srai_epi32(s1_21_4, DCT_CONST_BITS);
- const __m128i s1_21_7 = _mm_srai_epi32(s1_21_5, DCT_CONST_BITS);
- const __m128i s1_26_6 = _mm_srai_epi32(s1_26_4, DCT_CONST_BITS);
- const __m128i s1_26_7 = _mm_srai_epi32(s1_26_5, DCT_CONST_BITS);
- const __m128i s1_27_6 = _mm_srai_epi32(s1_27_4, DCT_CONST_BITS);
- const __m128i s1_27_7 = _mm_srai_epi32(s1_27_5, DCT_CONST_BITS);
- const __m128i s1_28_6 = _mm_srai_epi32(s1_28_4, DCT_CONST_BITS);
- const __m128i s1_28_7 = _mm_srai_epi32(s1_28_5, DCT_CONST_BITS);
- const __m128i s1_29_6 = _mm_srai_epi32(s1_29_4, DCT_CONST_BITS);
- const __m128i s1_29_7 = _mm_srai_epi32(s1_29_5, DCT_CONST_BITS);
- // Combine
- step1[18] = _mm_packs_epi32(s1_18_6, s1_18_7);
- step1[19] = _mm_packs_epi32(s1_19_6, s1_19_7);
- step1[20] = _mm_packs_epi32(s1_20_6, s1_20_7);
- step1[21] = _mm_packs_epi32(s1_21_6, s1_21_7);
- step1[26] = _mm_packs_epi32(s1_26_6, s1_26_7);
- step1[27] = _mm_packs_epi32(s1_27_6, s1_27_7);
- step1[28] = _mm_packs_epi32(s1_28_6, s1_28_7);
- step1[29] = _mm_packs_epi32(s1_29_6, s1_29_7);
- }
- // Stage 5
- {
- step2[4] = _mm_add_epi16(step1[5], step3[4]);
- step2[5] = _mm_sub_epi16(step3[4], step1[5]);
- step2[6] = _mm_sub_epi16(step3[7], step1[6]);
- step2[7] = _mm_add_epi16(step1[6], step3[7]);
- }
- {
- const __m128i out_00_0 = _mm_unpacklo_epi16(step1[0], step1[1]);
- const __m128i out_00_1 = _mm_unpackhi_epi16(step1[0], step1[1]);
- const __m128i out_08_0 = _mm_unpacklo_epi16(step1[2], step1[3]);
- const __m128i out_08_1 = _mm_unpackhi_epi16(step1[2], step1[3]);
- const __m128i out_00_2 = _mm_madd_epi16(out_00_0, k__cospi_p16_p16);
- const __m128i out_00_3 = _mm_madd_epi16(out_00_1, k__cospi_p16_p16);
- const __m128i out_16_2 = _mm_madd_epi16(out_00_0, k__cospi_p16_m16);
- const __m128i out_16_3 = _mm_madd_epi16(out_00_1, k__cospi_p16_m16);
- const __m128i out_08_2 = _mm_madd_epi16(out_08_0, k__cospi_p24_p08);
- const __m128i out_08_3 = _mm_madd_epi16(out_08_1, k__cospi_p24_p08);
- const __m128i out_24_2 = _mm_madd_epi16(out_08_0, k__cospi_m08_p24);
- const __m128i out_24_3 = _mm_madd_epi16(out_08_1, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m128i out_00_4 = _mm_add_epi32(out_00_2, k__DCT_CONST_ROUNDING);
- const __m128i out_00_5 = _mm_add_epi32(out_00_3, k__DCT_CONST_ROUNDING);
- const __m128i out_16_4 = _mm_add_epi32(out_16_2, k__DCT_CONST_ROUNDING);
- const __m128i out_16_5 = _mm_add_epi32(out_16_3, k__DCT_CONST_ROUNDING);
- const __m128i out_08_4 = _mm_add_epi32(out_08_2, k__DCT_CONST_ROUNDING);
- const __m128i out_08_5 = _mm_add_epi32(out_08_3, k__DCT_CONST_ROUNDING);
- const __m128i out_24_4 = _mm_add_epi32(out_24_2, k__DCT_CONST_ROUNDING);
- const __m128i out_24_5 = _mm_add_epi32(out_24_3, k__DCT_CONST_ROUNDING);
- const __m128i out_00_6 = _mm_srai_epi32(out_00_4, DCT_CONST_BITS);
- const __m128i out_00_7 = _mm_srai_epi32(out_00_5, DCT_CONST_BITS);
- const __m128i out_16_6 = _mm_srai_epi32(out_16_4, DCT_CONST_BITS);
- const __m128i out_16_7 = _mm_srai_epi32(out_16_5, DCT_CONST_BITS);
- const __m128i out_08_6 = _mm_srai_epi32(out_08_4, DCT_CONST_BITS);
- const __m128i out_08_7 = _mm_srai_epi32(out_08_5, DCT_CONST_BITS);
- const __m128i out_24_6 = _mm_srai_epi32(out_24_4, DCT_CONST_BITS);
- const __m128i out_24_7 = _mm_srai_epi32(out_24_5, DCT_CONST_BITS);
- // Combine
- out[ 0] = _mm_packs_epi32(out_00_6, out_00_7);
- out[16] = _mm_packs_epi32(out_16_6, out_16_7);
- out[ 8] = _mm_packs_epi32(out_08_6, out_08_7);
- out[24] = _mm_packs_epi32(out_24_6, out_24_7);
- }
- {
- const __m128i s2_09_0 = _mm_unpacklo_epi16(step1[ 9], step1[14]);
- const __m128i s2_09_1 = _mm_unpackhi_epi16(step1[ 9], step1[14]);
- const __m128i s2_10_0 = _mm_unpacklo_epi16(step1[10], step1[13]);
- const __m128i s2_10_1 = _mm_unpackhi_epi16(step1[10], step1[13]);
- const __m128i s2_09_2 = _mm_madd_epi16(s2_09_0, k__cospi_m08_p24);
- const __m128i s2_09_3 = _mm_madd_epi16(s2_09_1, k__cospi_m08_p24);
- const __m128i s2_10_2 = _mm_madd_epi16(s2_10_0, k__cospi_m24_m08);
- const __m128i s2_10_3 = _mm_madd_epi16(s2_10_1, k__cospi_m24_m08);
- const __m128i s2_13_2 = _mm_madd_epi16(s2_10_0, k__cospi_m08_p24);
- const __m128i s2_13_3 = _mm_madd_epi16(s2_10_1, k__cospi_m08_p24);
- const __m128i s2_14_2 = _mm_madd_epi16(s2_09_0, k__cospi_p24_p08);
- const __m128i s2_14_3 = _mm_madd_epi16(s2_09_1, k__cospi_p24_p08);
- // dct_const_round_shift
- const __m128i s2_09_4 = _mm_add_epi32(s2_09_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_09_5 = _mm_add_epi32(s2_09_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_10_4 = _mm_add_epi32(s2_10_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_10_5 = _mm_add_epi32(s2_10_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_13_4 = _mm_add_epi32(s2_13_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_13_5 = _mm_add_epi32(s2_13_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_14_4 = _mm_add_epi32(s2_14_2, k__DCT_CONST_ROUNDING);
- const __m128i s2_14_5 = _mm_add_epi32(s2_14_3, k__DCT_CONST_ROUNDING);
- const __m128i s2_09_6 = _mm_srai_epi32(s2_09_4, DCT_CONST_BITS);
- const __m128i s2_09_7 = _mm_srai_epi32(s2_09_5, DCT_CONST_BITS);
- const __m128i s2_10_6 = _mm_srai_epi32(s2_10_4, DCT_CONST_BITS);
- const __m128i s2_10_7 = _mm_srai_epi32(s2_10_5, DCT_CONST_BITS);
- const __m128i s2_13_6 = _mm_srai_epi32(s2_13_4, DCT_CONST_BITS);
- const __m128i s2_13_7 = _mm_srai_epi32(s2_13_5, DCT_CONST_BITS);
- const __m128i s2_14_6 = _mm_srai_epi32(s2_14_4, DCT_CONST_BITS);
- const __m128i s2_14_7 = _mm_srai_epi32(s2_14_5, DCT_CONST_BITS);
- // Combine
- step2[ 9] = _mm_packs_epi32(s2_09_6, s2_09_7);
- step2[10] = _mm_packs_epi32(s2_10_6, s2_10_7);
- step2[13] = _mm_packs_epi32(s2_13_6, s2_13_7);
- step2[14] = _mm_packs_epi32(s2_14_6, s2_14_7);
- }
- {
- step2[16] = _mm_add_epi16(step1[19], step3[16]);
- step2[17] = _mm_add_epi16(step1[18], step3[17]);
- step2[18] = _mm_sub_epi16(step3[17], step1[18]);
- step2[19] = _mm_sub_epi16(step3[16], step1[19]);
- step2[20] = _mm_sub_epi16(step3[23], step1[20]);
- step2[21] = _mm_sub_epi16(step3[22], step1[21]);
- step2[22] = _mm_add_epi16(step1[21], step3[22]);
- step2[23] = _mm_add_epi16(step1[20], step3[23]);
- step2[24] = _mm_add_epi16(step1[27], step3[24]);
- step2[25] = _mm_add_epi16(step1[26], step3[25]);
- step2[26] = _mm_sub_epi16(step3[25], step1[26]);
- step2[27] = _mm_sub_epi16(step3[24], step1[27]);
- step2[28] = _mm_sub_epi16(step3[31], step1[28]);
- step2[29] = _mm_sub_epi16(step3[30], step1[29]);
- step2[30] = _mm_add_epi16(step1[29], step3[30]);
- step2[31] = _mm_add_epi16(step1[28], step3[31]);
- }
- // Stage 6
- {
- const __m128i out_04_0 = _mm_unpacklo_epi16(step2[4], step2[7]);
- const __m128i out_04_1 = _mm_unpackhi_epi16(step2[4], step2[7]);
- const __m128i out_20_0 = _mm_unpacklo_epi16(step2[5], step2[6]);
- const __m128i out_20_1 = _mm_unpackhi_epi16(step2[5], step2[6]);
- const __m128i out_12_0 = _mm_unpacklo_epi16(step2[5], step2[6]);
- const __m128i out_12_1 = _mm_unpackhi_epi16(step2[5], step2[6]);
- const __m128i out_28_0 = _mm_unpacklo_epi16(step2[4], step2[7]);
- const __m128i out_28_1 = _mm_unpackhi_epi16(step2[4], step2[7]);
- const __m128i out_04_2 = _mm_madd_epi16(out_04_0, k__cospi_p28_p04);
- const __m128i out_04_3 = _mm_madd_epi16(out_04_1, k__cospi_p28_p04);
- const __m128i out_20_2 = _mm_madd_epi16(out_20_0, k__cospi_p12_p20);
- const __m128i out_20_3 = _mm_madd_epi16(out_20_1, k__cospi_p12_p20);
- const __m128i out_12_2 = _mm_madd_epi16(out_12_0, k__cospi_m20_p12);
- const __m128i out_12_3 = _mm_madd_epi16(out_12_1, k__cospi_m20_p12);
- const __m128i out_28_2 = _mm_madd_epi16(out_28_0, k__cospi_m04_p28);
- const __m128i out_28_3 = _mm_madd_epi16(out_28_1, k__cospi_m04_p28);
- // dct_const_round_shift
- const __m128i out_04_4 = _mm_add_epi32(out_04_2, k__DCT_CONST_ROUNDING);
- const __m128i out_04_5 = _mm_add_epi32(out_04_3, k__DCT_CONST_ROUNDING);
- const __m128i out_20_4 = _mm_add_epi32(out_20_2, k__DCT_CONST_ROUNDING);
- const __m128i out_20_5 = _mm_add_epi32(out_20_3, k__DCT_CONST_ROUNDING);
- const __m128i out_12_4 = _mm_add_epi32(out_12_2, k__DCT_CONST_ROUNDING);
- const __m128i out_12_5 = _mm_add_epi32(out_12_3, k__DCT_CONST_ROUNDING);
- const __m128i out_28_4 = _mm_add_epi32(out_28_2, k__DCT_CONST_ROUNDING);
- const __m128i out_28_5 = _mm_add_epi32(out_28_3, k__DCT_CONST_ROUNDING);
- const __m128i out_04_6 = _mm_srai_epi32(out_04_4, DCT_CONST_BITS);
- const __m128i out_04_7 = _mm_srai_epi32(out_04_5, DCT_CONST_BITS);
- const __m128i out_20_6 = _mm_srai_epi32(out_20_4, DCT_CONST_BITS);
- const __m128i out_20_7 = _mm_srai_epi32(out_20_5, DCT_CONST_BITS);
- const __m128i out_12_6 = _mm_srai_epi32(out_12_4, DCT_CONST_BITS);
- const __m128i out_12_7 = _mm_srai_epi32(out_12_5, DCT_CONST_BITS);
- const __m128i out_28_6 = _mm_srai_epi32(out_28_4, DCT_CONST_BITS);
- const __m128i out_28_7 = _mm_srai_epi32(out_28_5, DCT_CONST_BITS);
- // Combine
- out[ 4] = _mm_packs_epi32(out_04_6, out_04_7);
- out[20] = _mm_packs_epi32(out_20_6, out_20_7);
- out[12] = _mm_packs_epi32(out_12_6, out_12_7);
- out[28] = _mm_packs_epi32(out_28_6, out_28_7);
- }
- {
- step3[ 8] = _mm_add_epi16(step2[ 9], step1[ 8]);
- step3[ 9] = _mm_sub_epi16(step1[ 8], step2[ 9]);
- step3[10] = _mm_sub_epi16(step1[11], step2[10]);
- step3[11] = _mm_add_epi16(step2[10], step1[11]);
- step3[12] = _mm_add_epi16(step2[13], step1[12]);
- step3[13] = _mm_sub_epi16(step1[12], step2[13]);
- step3[14] = _mm_sub_epi16(step1[15], step2[14]);
- step3[15] = _mm_add_epi16(step2[14], step1[15]);
- }
- {
- const __m128i s3_17_0 = _mm_unpacklo_epi16(step2[17], step2[30]);
- const __m128i s3_17_1 = _mm_unpackhi_epi16(step2[17], step2[30]);
- const __m128i s3_18_0 = _mm_unpacklo_epi16(step2[18], step2[29]);
- const __m128i s3_18_1 = _mm_unpackhi_epi16(step2[18], step2[29]);
- const __m128i s3_21_0 = _mm_unpacklo_epi16(step2[21], step2[26]);
- const __m128i s3_21_1 = _mm_unpackhi_epi16(step2[21], step2[26]);
- const __m128i s3_22_0 = _mm_unpacklo_epi16(step2[22], step2[25]);
- const __m128i s3_22_1 = _mm_unpackhi_epi16(step2[22], step2[25]);
- const __m128i s3_17_2 = _mm_madd_epi16(s3_17_0, k__cospi_m04_p28);
- const __m128i s3_17_3 = _mm_madd_epi16(s3_17_1, k__cospi_m04_p28);
- const __m128i s3_18_2 = _mm_madd_epi16(s3_18_0, k__cospi_m28_m04);
- const __m128i s3_18_3 = _mm_madd_epi16(s3_18_1, k__cospi_m28_m04);
- const __m128i s3_21_2 = _mm_madd_epi16(s3_21_0, k__cospi_m20_p12);
- const __m128i s3_21_3 = _mm_madd_epi16(s3_21_1, k__cospi_m20_p12);
- const __m128i s3_22_2 = _mm_madd_epi16(s3_22_0, k__cospi_m12_m20);
- const __m128i s3_22_3 = _mm_madd_epi16(s3_22_1, k__cospi_m12_m20);
- const __m128i s3_25_2 = _mm_madd_epi16(s3_22_0, k__cospi_m20_p12);
- const __m128i s3_25_3 = _mm_madd_epi16(s3_22_1, k__cospi_m20_p12);
- const __m128i s3_26_2 = _mm_madd_epi16(s3_21_0, k__cospi_p12_p20);
- const __m128i s3_26_3 = _mm_madd_epi16(s3_21_1, k__cospi_p12_p20);
- const __m128i s3_29_2 = _mm_madd_epi16(s3_18_0, k__cospi_m04_p28);
- const __m128i s3_29_3 = _mm_madd_epi16(s3_18_1, k__cospi_m04_p28);
- const __m128i s3_30_2 = _mm_madd_epi16(s3_17_0, k__cospi_p28_p04);
- const __m128i s3_30_3 = _mm_madd_epi16(s3_17_1, k__cospi_p28_p04);
- // dct_const_round_shift
- const __m128i s3_17_4 = _mm_add_epi32(s3_17_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_17_5 = _mm_add_epi32(s3_17_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_18_4 = _mm_add_epi32(s3_18_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_18_5 = _mm_add_epi32(s3_18_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_21_4 = _mm_add_epi32(s3_21_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_21_5 = _mm_add_epi32(s3_21_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_22_4 = _mm_add_epi32(s3_22_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_22_5 = _mm_add_epi32(s3_22_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_17_6 = _mm_srai_epi32(s3_17_4, DCT_CONST_BITS);
- const __m128i s3_17_7 = _mm_srai_epi32(s3_17_5, DCT_CONST_BITS);
- const __m128i s3_18_6 = _mm_srai_epi32(s3_18_4, DCT_CONST_BITS);
- const __m128i s3_18_7 = _mm_srai_epi32(s3_18_5, DCT_CONST_BITS);
- const __m128i s3_21_6 = _mm_srai_epi32(s3_21_4, DCT_CONST_BITS);
- const __m128i s3_21_7 = _mm_srai_epi32(s3_21_5, DCT_CONST_BITS);
- const __m128i s3_22_6 = _mm_srai_epi32(s3_22_4, DCT_CONST_BITS);
- const __m128i s3_22_7 = _mm_srai_epi32(s3_22_5, DCT_CONST_BITS);
- const __m128i s3_25_4 = _mm_add_epi32(s3_25_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_25_5 = _mm_add_epi32(s3_25_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_26_4 = _mm_add_epi32(s3_26_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_26_5 = _mm_add_epi32(s3_26_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_29_4 = _mm_add_epi32(s3_29_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_29_5 = _mm_add_epi32(s3_29_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_30_4 = _mm_add_epi32(s3_30_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_30_5 = _mm_add_epi32(s3_30_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_25_6 = _mm_srai_epi32(s3_25_4, DCT_CONST_BITS);
- const __m128i s3_25_7 = _mm_srai_epi32(s3_25_5, DCT_CONST_BITS);
- const __m128i s3_26_6 = _mm_srai_epi32(s3_26_4, DCT_CONST_BITS);
- const __m128i s3_26_7 = _mm_srai_epi32(s3_26_5, DCT_CONST_BITS);
- const __m128i s3_29_6 = _mm_srai_epi32(s3_29_4, DCT_CONST_BITS);
- const __m128i s3_29_7 = _mm_srai_epi32(s3_29_5, DCT_CONST_BITS);
- const __m128i s3_30_6 = _mm_srai_epi32(s3_30_4, DCT_CONST_BITS);
- const __m128i s3_30_7 = _mm_srai_epi32(s3_30_5, DCT_CONST_BITS);
- // Combine
- step3[17] = _mm_packs_epi32(s3_17_6, s3_17_7);
- step3[18] = _mm_packs_epi32(s3_18_6, s3_18_7);
- step3[21] = _mm_packs_epi32(s3_21_6, s3_21_7);
- step3[22] = _mm_packs_epi32(s3_22_6, s3_22_7);
- // Combine
- step3[25] = _mm_packs_epi32(s3_25_6, s3_25_7);
- step3[26] = _mm_packs_epi32(s3_26_6, s3_26_7);
- step3[29] = _mm_packs_epi32(s3_29_6, s3_29_7);
- step3[30] = _mm_packs_epi32(s3_30_6, s3_30_7);
- }
- // Stage 7
- {
- const __m128i out_02_0 = _mm_unpacklo_epi16(step3[ 8], step3[15]);
- const __m128i out_02_1 = _mm_unpackhi_epi16(step3[ 8], step3[15]);
- const __m128i out_18_0 = _mm_unpacklo_epi16(step3[ 9], step3[14]);
- const __m128i out_18_1 = _mm_unpackhi_epi16(step3[ 9], step3[14]);
- const __m128i out_10_0 = _mm_unpacklo_epi16(step3[10], step3[13]);
- const __m128i out_10_1 = _mm_unpackhi_epi16(step3[10], step3[13]);
- const __m128i out_26_0 = _mm_unpacklo_epi16(step3[11], step3[12]);
- const __m128i out_26_1 = _mm_unpackhi_epi16(step3[11], step3[12]);
- const __m128i out_02_2 = _mm_madd_epi16(out_02_0, k__cospi_p30_p02);
- const __m128i out_02_3 = _mm_madd_epi16(out_02_1, k__cospi_p30_p02);
- const __m128i out_18_2 = _mm_madd_epi16(out_18_0, k__cospi_p14_p18);
- const __m128i out_18_3 = _mm_madd_epi16(out_18_1, k__cospi_p14_p18);
- const __m128i out_10_2 = _mm_madd_epi16(out_10_0, k__cospi_p22_p10);
- const __m128i out_10_3 = _mm_madd_epi16(out_10_1, k__cospi_p22_p10);
- const __m128i out_26_2 = _mm_madd_epi16(out_26_0, k__cospi_p06_p26);
- const __m128i out_26_3 = _mm_madd_epi16(out_26_1, k__cospi_p06_p26);
- const __m128i out_06_2 = _mm_madd_epi16(out_26_0, k__cospi_m26_p06);
- const __m128i out_06_3 = _mm_madd_epi16(out_26_1, k__cospi_m26_p06);
- const __m128i out_22_2 = _mm_madd_epi16(out_10_0, k__cospi_m10_p22);
- const __m128i out_22_3 = _mm_madd_epi16(out_10_1, k__cospi_m10_p22);
- const __m128i out_14_2 = _mm_madd_epi16(out_18_0, k__cospi_m18_p14);
- const __m128i out_14_3 = _mm_madd_epi16(out_18_1, k__cospi_m18_p14);
- const __m128i out_30_2 = _mm_madd_epi16(out_02_0, k__cospi_m02_p30);
- const __m128i out_30_3 = _mm_madd_epi16(out_02_1, k__cospi_m02_p30);
- // dct_const_round_shift
- const __m128i out_02_4 = _mm_add_epi32(out_02_2, k__DCT_CONST_ROUNDING);
- const __m128i out_02_5 = _mm_add_epi32(out_02_3, k__DCT_CONST_ROUNDING);
- const __m128i out_18_4 = _mm_add_epi32(out_18_2, k__DCT_CONST_ROUNDING);
- const __m128i out_18_5 = _mm_add_epi32(out_18_3, k__DCT_CONST_ROUNDING);
- const __m128i out_10_4 = _mm_add_epi32(out_10_2, k__DCT_CONST_ROUNDING);
- const __m128i out_10_5 = _mm_add_epi32(out_10_3, k__DCT_CONST_ROUNDING);
- const __m128i out_26_4 = _mm_add_epi32(out_26_2, k__DCT_CONST_ROUNDING);
- const __m128i out_26_5 = _mm_add_epi32(out_26_3, k__DCT_CONST_ROUNDING);
- const __m128i out_06_4 = _mm_add_epi32(out_06_2, k__DCT_CONST_ROUNDING);
- const __m128i out_06_5 = _mm_add_epi32(out_06_3, k__DCT_CONST_ROUNDING);
- const __m128i out_22_4 = _mm_add_epi32(out_22_2, k__DCT_CONST_ROUNDING);
- const __m128i out_22_5 = _mm_add_epi32(out_22_3, k__DCT_CONST_ROUNDING);
- const __m128i out_14_4 = _mm_add_epi32(out_14_2, k__DCT_CONST_ROUNDING);
- const __m128i out_14_5 = _mm_add_epi32(out_14_3, k__DCT_CONST_ROUNDING);
- const __m128i out_30_4 = _mm_add_epi32(out_30_2, k__DCT_CONST_ROUNDING);
- const __m128i out_30_5 = _mm_add_epi32(out_30_3, k__DCT_CONST_ROUNDING);
- const __m128i out_02_6 = _mm_srai_epi32(out_02_4, DCT_CONST_BITS);
- const __m128i out_02_7 = _mm_srai_epi32(out_02_5, DCT_CONST_BITS);
- const __m128i out_18_6 = _mm_srai_epi32(out_18_4, DCT_CONST_BITS);
- const __m128i out_18_7 = _mm_srai_epi32(out_18_5, DCT_CONST_BITS);
- const __m128i out_10_6 = _mm_srai_epi32(out_10_4, DCT_CONST_BITS);
- const __m128i out_10_7 = _mm_srai_epi32(out_10_5, DCT_CONST_BITS);
- const __m128i out_26_6 = _mm_srai_epi32(out_26_4, DCT_CONST_BITS);
- const __m128i out_26_7 = _mm_srai_epi32(out_26_5, DCT_CONST_BITS);
- const __m128i out_06_6 = _mm_srai_epi32(out_06_4, DCT_CONST_BITS);
- const __m128i out_06_7 = _mm_srai_epi32(out_06_5, DCT_CONST_BITS);
- const __m128i out_22_6 = _mm_srai_epi32(out_22_4, DCT_CONST_BITS);
- const __m128i out_22_7 = _mm_srai_epi32(out_22_5, DCT_CONST_BITS);
- const __m128i out_14_6 = _mm_srai_epi32(out_14_4, DCT_CONST_BITS);
- const __m128i out_14_7 = _mm_srai_epi32(out_14_5, DCT_CONST_BITS);
- const __m128i out_30_6 = _mm_srai_epi32(out_30_4, DCT_CONST_BITS);
- const __m128i out_30_7 = _mm_srai_epi32(out_30_5, DCT_CONST_BITS);
- // Combine
- out[ 2] = _mm_packs_epi32(out_02_6, out_02_7);
- out[18] = _mm_packs_epi32(out_18_6, out_18_7);
- out[10] = _mm_packs_epi32(out_10_6, out_10_7);
- out[26] = _mm_packs_epi32(out_26_6, out_26_7);
- out[ 6] = _mm_packs_epi32(out_06_6, out_06_7);
- out[22] = _mm_packs_epi32(out_22_6, out_22_7);
- out[14] = _mm_packs_epi32(out_14_6, out_14_7);
- out[30] = _mm_packs_epi32(out_30_6, out_30_7);
- }
- {
- step1[16] = _mm_add_epi16(step3[17], step2[16]);
- step1[17] = _mm_sub_epi16(step2[16], step3[17]);
- step1[18] = _mm_sub_epi16(step2[19], step3[18]);
- step1[19] = _mm_add_epi16(step3[18], step2[19]);
- step1[20] = _mm_add_epi16(step3[21], step2[20]);
- step1[21] = _mm_sub_epi16(step2[20], step3[21]);
- step1[22] = _mm_sub_epi16(step2[23], step3[22]);
- step1[23] = _mm_add_epi16(step3[22], step2[23]);
- step1[24] = _mm_add_epi16(step3[25], step2[24]);
- step1[25] = _mm_sub_epi16(step2[24], step3[25]);
- step1[26] = _mm_sub_epi16(step2[27], step3[26]);
- step1[27] = _mm_add_epi16(step3[26], step2[27]);
- step1[28] = _mm_add_epi16(step3[29], step2[28]);
- step1[29] = _mm_sub_epi16(step2[28], step3[29]);
- step1[30] = _mm_sub_epi16(step2[31], step3[30]);
- step1[31] = _mm_add_epi16(step3[30], step2[31]);
- }
- // Final stage --- outputs indices are bit-reversed.
- {
- const __m128i out_01_0 = _mm_unpacklo_epi16(step1[16], step1[31]);
- const __m128i out_01_1 = _mm_unpackhi_epi16(step1[16], step1[31]);
- const __m128i out_17_0 = _mm_unpacklo_epi16(step1[17], step1[30]);
- const __m128i out_17_1 = _mm_unpackhi_epi16(step1[17], step1[30]);
- const __m128i out_09_0 = _mm_unpacklo_epi16(step1[18], step1[29]);
- const __m128i out_09_1 = _mm_unpackhi_epi16(step1[18], step1[29]);
- const __m128i out_25_0 = _mm_unpacklo_epi16(step1[19], step1[28]);
- const __m128i out_25_1 = _mm_unpackhi_epi16(step1[19], step1[28]);
- const __m128i out_01_2 = _mm_madd_epi16(out_01_0, k__cospi_p31_p01);
- const __m128i out_01_3 = _mm_madd_epi16(out_01_1, k__cospi_p31_p01);
- const __m128i out_17_2 = _mm_madd_epi16(out_17_0, k__cospi_p15_p17);
- const __m128i out_17_3 = _mm_madd_epi16(out_17_1, k__cospi_p15_p17);
- const __m128i out_09_2 = _mm_madd_epi16(out_09_0, k__cospi_p23_p09);
- const __m128i out_09_3 = _mm_madd_epi16(out_09_1, k__cospi_p23_p09);
- const __m128i out_25_2 = _mm_madd_epi16(out_25_0, k__cospi_p07_p25);
- const __m128i out_25_3 = _mm_madd_epi16(out_25_1, k__cospi_p07_p25);
- const __m128i out_07_2 = _mm_madd_epi16(out_25_0, k__cospi_m25_p07);
- const __m128i out_07_3 = _mm_madd_epi16(out_25_1, k__cospi_m25_p07);
- const __m128i out_23_2 = _mm_madd_epi16(out_09_0, k__cospi_m09_p23);
- const __m128i out_23_3 = _mm_madd_epi16(out_09_1, k__cospi_m09_p23);
- const __m128i out_15_2 = _mm_madd_epi16(out_17_0, k__cospi_m17_p15);
- const __m128i out_15_3 = _mm_madd_epi16(out_17_1, k__cospi_m17_p15);
- const __m128i out_31_2 = _mm_madd_epi16(out_01_0, k__cospi_m01_p31);
- const __m128i out_31_3 = _mm_madd_epi16(out_01_1, k__cospi_m01_p31);
- // dct_const_round_shift
- const __m128i out_01_4 = _mm_add_epi32(out_01_2, k__DCT_CONST_ROUNDING);
- const __m128i out_01_5 = _mm_add_epi32(out_01_3, k__DCT_CONST_ROUNDING);
- const __m128i out_17_4 = _mm_add_epi32(out_17_2, k__DCT_CONST_ROUNDING);
- const __m128i out_17_5 = _mm_add_epi32(out_17_3, k__DCT_CONST_ROUNDING);
- const __m128i out_09_4 = _mm_add_epi32(out_09_2, k__DCT_CONST_ROUNDING);
- const __m128i out_09_5 = _mm_add_epi32(out_09_3, k__DCT_CONST_ROUNDING);
- const __m128i out_25_4 = _mm_add_epi32(out_25_2, k__DCT_CONST_ROUNDING);
- const __m128i out_25_5 = _mm_add_epi32(out_25_3, k__DCT_CONST_ROUNDING);
- const __m128i out_07_4 = _mm_add_epi32(out_07_2, k__DCT_CONST_ROUNDING);
- const __m128i out_07_5 = _mm_add_epi32(out_07_3, k__DCT_CONST_ROUNDING);
- const __m128i out_23_4 = _mm_add_epi32(out_23_2, k__DCT_CONST_ROUNDING);
- const __m128i out_23_5 = _mm_add_epi32(out_23_3, k__DCT_CONST_ROUNDING);
- const __m128i out_15_4 = _mm_add_epi32(out_15_2, k__DCT_CONST_ROUNDING);
- const __m128i out_15_5 = _mm_add_epi32(out_15_3, k__DCT_CONST_ROUNDING);
- const __m128i out_31_4 = _mm_add_epi32(out_31_2, k__DCT_CONST_ROUNDING);
- const __m128i out_31_5 = _mm_add_epi32(out_31_3, k__DCT_CONST_ROUNDING);
- const __m128i out_01_6 = _mm_srai_epi32(out_01_4, DCT_CONST_BITS);
- const __m128i out_01_7 = _mm_srai_epi32(out_01_5, DCT_CONST_BITS);
- const __m128i out_17_6 = _mm_srai_epi32(out_17_4, DCT_CONST_BITS);
- const __m128i out_17_7 = _mm_srai_epi32(out_17_5, DCT_CONST_BITS);
- const __m128i out_09_6 = _mm_srai_epi32(out_09_4, DCT_CONST_BITS);
- const __m128i out_09_7 = _mm_srai_epi32(out_09_5, DCT_CONST_BITS);
- const __m128i out_25_6 = _mm_srai_epi32(out_25_4, DCT_CONST_BITS);
- const __m128i out_25_7 = _mm_srai_epi32(out_25_5, DCT_CONST_BITS);
- const __m128i out_07_6 = _mm_srai_epi32(out_07_4, DCT_CONST_BITS);
- const __m128i out_07_7 = _mm_srai_epi32(out_07_5, DCT_CONST_BITS);
- const __m128i out_23_6 = _mm_srai_epi32(out_23_4, DCT_CONST_BITS);
- const __m128i out_23_7 = _mm_srai_epi32(out_23_5, DCT_CONST_BITS);
- const __m128i out_15_6 = _mm_srai_epi32(out_15_4, DCT_CONST_BITS);
- const __m128i out_15_7 = _mm_srai_epi32(out_15_5, DCT_CONST_BITS);
- const __m128i out_31_6 = _mm_srai_epi32(out_31_4, DCT_CONST_BITS);
- const __m128i out_31_7 = _mm_srai_epi32(out_31_5, DCT_CONST_BITS);
- // Combine
- out[ 1] = _mm_packs_epi32(out_01_6, out_01_7);
- out[17] = _mm_packs_epi32(out_17_6, out_17_7);
- out[ 9] = _mm_packs_epi32(out_09_6, out_09_7);
- out[25] = _mm_packs_epi32(out_25_6, out_25_7);
- out[ 7] = _mm_packs_epi32(out_07_6, out_07_7);
- out[23] = _mm_packs_epi32(out_23_6, out_23_7);
- out[15] = _mm_packs_epi32(out_15_6, out_15_7);
- out[31] = _mm_packs_epi32(out_31_6, out_31_7);
- }
- {
- const __m128i out_05_0 = _mm_unpacklo_epi16(step1[20], step1[27]);
- const __m128i out_05_1 = _mm_unpackhi_epi16(step1[20], step1[27]);
- const __m128i out_21_0 = _mm_unpacklo_epi16(step1[21], step1[26]);
- const __m128i out_21_1 = _mm_unpackhi_epi16(step1[21], step1[26]);
- const __m128i out_13_0 = _mm_unpacklo_epi16(step1[22], step1[25]);
- const __m128i out_13_1 = _mm_unpackhi_epi16(step1[22], step1[25]);
- const __m128i out_29_0 = _mm_unpacklo_epi16(step1[23], step1[24]);
- const __m128i out_29_1 = _mm_unpackhi_epi16(step1[23], step1[24]);
- const __m128i out_05_2 = _mm_madd_epi16(out_05_0, k__cospi_p27_p05);
- const __m128i out_05_3 = _mm_madd_epi16(out_05_1, k__cospi_p27_p05);
- const __m128i out_21_2 = _mm_madd_epi16(out_21_0, k__cospi_p11_p21);
- const __m128i out_21_3 = _mm_madd_epi16(out_21_1, k__cospi_p11_p21);
- const __m128i out_13_2 = _mm_madd_epi16(out_13_0, k__cospi_p19_p13);
- const __m128i out_13_3 = _mm_madd_epi16(out_13_1, k__cospi_p19_p13);
- const __m128i out_29_2 = _mm_madd_epi16(out_29_0, k__cospi_p03_p29);
- const __m128i out_29_3 = _mm_madd_epi16(out_29_1, k__cospi_p03_p29);
- const __m128i out_03_2 = _mm_madd_epi16(out_29_0, k__cospi_m29_p03);
- const __m128i out_03_3 = _mm_madd_epi16(out_29_1, k__cospi_m29_p03);
- const __m128i out_19_2 = _mm_madd_epi16(out_13_0, k__cospi_m13_p19);
- const __m128i out_19_3 = _mm_madd_epi16(out_13_1, k__cospi_m13_p19);
- const __m128i out_11_2 = _mm_madd_epi16(out_21_0, k__cospi_m21_p11);
- const __m128i out_11_3 = _mm_madd_epi16(out_21_1, k__cospi_m21_p11);
- const __m128i out_27_2 = _mm_madd_epi16(out_05_0, k__cospi_m05_p27);
- const __m128i out_27_3 = _mm_madd_epi16(out_05_1, k__cospi_m05_p27);
- // dct_const_round_shift
- const __m128i out_05_4 = _mm_add_epi32(out_05_2, k__DCT_CONST_ROUNDING);
- const __m128i out_05_5 = _mm_add_epi32(out_05_3, k__DCT_CONST_ROUNDING);
- const __m128i out_21_4 = _mm_add_epi32(out_21_2, k__DCT_CONST_ROUNDING);
- const __m128i out_21_5 = _mm_add_epi32(out_21_3, k__DCT_CONST_ROUNDING);
- const __m128i out_13_4 = _mm_add_epi32(out_13_2, k__DCT_CONST_ROUNDING);
- const __m128i out_13_5 = _mm_add_epi32(out_13_3, k__DCT_CONST_ROUNDING);
- const __m128i out_29_4 = _mm_add_epi32(out_29_2, k__DCT_CONST_ROUNDING);
- const __m128i out_29_5 = _mm_add_epi32(out_29_3, k__DCT_CONST_ROUNDING);
- const __m128i out_03_4 = _mm_add_epi32(out_03_2, k__DCT_CONST_ROUNDING);
- const __m128i out_03_5 = _mm_add_epi32(out_03_3, k__DCT_CONST_ROUNDING);
- const __m128i out_19_4 = _mm_add_epi32(out_19_2, k__DCT_CONST_ROUNDING);
- const __m128i out_19_5 = _mm_add_epi32(out_19_3, k__DCT_CONST_ROUNDING);
- const __m128i out_11_4 = _mm_add_epi32(out_11_2, k__DCT_CONST_ROUNDING);
- const __m128i out_11_5 = _mm_add_epi32(out_11_3, k__DCT_CONST_ROUNDING);
- const __m128i out_27_4 = _mm_add_epi32(out_27_2, k__DCT_CONST_ROUNDING);
- const __m128i out_27_5 = _mm_add_epi32(out_27_3, k__DCT_CONST_ROUNDING);
- const __m128i out_05_6 = _mm_srai_epi32(out_05_4, DCT_CONST_BITS);
- const __m128i out_05_7 = _mm_srai_epi32(out_05_5, DCT_CONST_BITS);
- const __m128i out_21_6 = _mm_srai_epi32(out_21_4, DCT_CONST_BITS);
- const __m128i out_21_7 = _mm_srai_epi32(out_21_5, DCT_CONST_BITS);
- const __m128i out_13_6 = _mm_srai_epi32(out_13_4, DCT_CONST_BITS);
- const __m128i out_13_7 = _mm_srai_epi32(out_13_5, DCT_CONST_BITS);
- const __m128i out_29_6 = _mm_srai_epi32(out_29_4, DCT_CONST_BITS);
- const __m128i out_29_7 = _mm_srai_epi32(out_29_5, DCT_CONST_BITS);
- const __m128i out_03_6 = _mm_srai_epi32(out_03_4, DCT_CONST_BITS);
- const __m128i out_03_7 = _mm_srai_epi32(out_03_5, DCT_CONST_BITS);
- const __m128i out_19_6 = _mm_srai_epi32(out_19_4, DCT_CONST_BITS);
- const __m128i out_19_7 = _mm_srai_epi32(out_19_5, DCT_CONST_BITS);
- const __m128i out_11_6 = _mm_srai_epi32(out_11_4, DCT_CONST_BITS);
- const __m128i out_11_7 = _mm_srai_epi32(out_11_5, DCT_CONST_BITS);
- const __m128i out_27_6 = _mm_srai_epi32(out_27_4, DCT_CONST_BITS);
- const __m128i out_27_7 = _mm_srai_epi32(out_27_5, DCT_CONST_BITS);
- // Combine
- out[ 5] = _mm_packs_epi32(out_05_6, out_05_7);
- out[21] = _mm_packs_epi32(out_21_6, out_21_7);
- out[13] = _mm_packs_epi32(out_13_6, out_13_7);
- out[29] = _mm_packs_epi32(out_29_6, out_29_7);
- out[ 3] = _mm_packs_epi32(out_03_6, out_03_7);
- out[19] = _mm_packs_epi32(out_19_6, out_19_7);
- out[11] = _mm_packs_epi32(out_11_6, out_11_7);
- out[27] = _mm_packs_epi32(out_27_6, out_27_7);
- }
-#if FDCT32x32_HIGH_PRECISION
- } else {
- __m128i lstep1[64], lstep2[64], lstep3[64];
- __m128i u[32], v[32], sign[16];
- const __m128i K32One = _mm_set_epi32(1, 1, 1, 1);
- // start using 32-bit operations
- // stage 3
- {
- // expanding to 32-bit length priori to addition operations
- lstep2[ 0] = _mm_unpacklo_epi16(step2[ 0], kZero);
- lstep2[ 1] = _mm_unpackhi_epi16(step2[ 0], kZero);
- lstep2[ 2] = _mm_unpacklo_epi16(step2[ 1], kZero);
- lstep2[ 3] = _mm_unpackhi_epi16(step2[ 1], kZero);
- lstep2[ 4] = _mm_unpacklo_epi16(step2[ 2], kZero);
- lstep2[ 5] = _mm_unpackhi_epi16(step2[ 2], kZero);
- lstep2[ 6] = _mm_unpacklo_epi16(step2[ 3], kZero);
- lstep2[ 7] = _mm_unpackhi_epi16(step2[ 3], kZero);
- lstep2[ 8] = _mm_unpacklo_epi16(step2[ 4], kZero);
- lstep2[ 9] = _mm_unpackhi_epi16(step2[ 4], kZero);
- lstep2[10] = _mm_unpacklo_epi16(step2[ 5], kZero);
- lstep2[11] = _mm_unpackhi_epi16(step2[ 5], kZero);
- lstep2[12] = _mm_unpacklo_epi16(step2[ 6], kZero);
- lstep2[13] = _mm_unpackhi_epi16(step2[ 6], kZero);
- lstep2[14] = _mm_unpacklo_epi16(step2[ 7], kZero);
- lstep2[15] = _mm_unpackhi_epi16(step2[ 7], kZero);
- lstep2[ 0] = _mm_madd_epi16(lstep2[ 0], kOne);
- lstep2[ 1] = _mm_madd_epi16(lstep2[ 1], kOne);
- lstep2[ 2] = _mm_madd_epi16(lstep2[ 2], kOne);
- lstep2[ 3] = _mm_madd_epi16(lstep2[ 3], kOne);
- lstep2[ 4] = _mm_madd_epi16(lstep2[ 4], kOne);
- lstep2[ 5] = _mm_madd_epi16(lstep2[ 5], kOne);
- lstep2[ 6] = _mm_madd_epi16(lstep2[ 6], kOne);
- lstep2[ 7] = _mm_madd_epi16(lstep2[ 7], kOne);
- lstep2[ 8] = _mm_madd_epi16(lstep2[ 8], kOne);
- lstep2[ 9] = _mm_madd_epi16(lstep2[ 9], kOne);
- lstep2[10] = _mm_madd_epi16(lstep2[10], kOne);
- lstep2[11] = _mm_madd_epi16(lstep2[11], kOne);
- lstep2[12] = _mm_madd_epi16(lstep2[12], kOne);
- lstep2[13] = _mm_madd_epi16(lstep2[13], kOne);
- lstep2[14] = _mm_madd_epi16(lstep2[14], kOne);
- lstep2[15] = _mm_madd_epi16(lstep2[15], kOne);
-
- lstep3[ 0] = _mm_add_epi32(lstep2[14], lstep2[ 0]);
- lstep3[ 1] = _mm_add_epi32(lstep2[15], lstep2[ 1]);
- lstep3[ 2] = _mm_add_epi32(lstep2[12], lstep2[ 2]);
- lstep3[ 3] = _mm_add_epi32(lstep2[13], lstep2[ 3]);
- lstep3[ 4] = _mm_add_epi32(lstep2[10], lstep2[ 4]);
- lstep3[ 5] = _mm_add_epi32(lstep2[11], lstep2[ 5]);
- lstep3[ 6] = _mm_add_epi32(lstep2[ 8], lstep2[ 6]);
- lstep3[ 7] = _mm_add_epi32(lstep2[ 9], lstep2[ 7]);
- lstep3[ 8] = _mm_sub_epi32(lstep2[ 6], lstep2[ 8]);
- lstep3[ 9] = _mm_sub_epi32(lstep2[ 7], lstep2[ 9]);
- lstep3[10] = _mm_sub_epi32(lstep2[ 4], lstep2[10]);
- lstep3[11] = _mm_sub_epi32(lstep2[ 5], lstep2[11]);
- lstep3[12] = _mm_sub_epi32(lstep2[ 2], lstep2[12]);
- lstep3[13] = _mm_sub_epi32(lstep2[ 3], lstep2[13]);
- lstep3[14] = _mm_sub_epi32(lstep2[ 0], lstep2[14]);
- lstep3[15] = _mm_sub_epi32(lstep2[ 1], lstep2[15]);
- }
- {
- const __m128i s3_10_0 = _mm_unpacklo_epi16(step2[13], step2[10]);
- const __m128i s3_10_1 = _mm_unpackhi_epi16(step2[13], step2[10]);
- const __m128i s3_11_0 = _mm_unpacklo_epi16(step2[12], step2[11]);
- const __m128i s3_11_1 = _mm_unpackhi_epi16(step2[12], step2[11]);
- const __m128i s3_10_2 = _mm_madd_epi16(s3_10_0, k__cospi_p16_m16);
- const __m128i s3_10_3 = _mm_madd_epi16(s3_10_1, k__cospi_p16_m16);
- const __m128i s3_11_2 = _mm_madd_epi16(s3_11_0, k__cospi_p16_m16);
- const __m128i s3_11_3 = _mm_madd_epi16(s3_11_1, k__cospi_p16_m16);
- const __m128i s3_12_2 = _mm_madd_epi16(s3_11_0, k__cospi_p16_p16);
- const __m128i s3_12_3 = _mm_madd_epi16(s3_11_1, k__cospi_p16_p16);
- const __m128i s3_13_2 = _mm_madd_epi16(s3_10_0, k__cospi_p16_p16);
- const __m128i s3_13_3 = _mm_madd_epi16(s3_10_1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i s3_10_4 = _mm_add_epi32(s3_10_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_10_5 = _mm_add_epi32(s3_10_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_11_4 = _mm_add_epi32(s3_11_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_11_5 = _mm_add_epi32(s3_11_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_12_4 = _mm_add_epi32(s3_12_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_12_5 = _mm_add_epi32(s3_12_3, k__DCT_CONST_ROUNDING);
- const __m128i s3_13_4 = _mm_add_epi32(s3_13_2, k__DCT_CONST_ROUNDING);
- const __m128i s3_13_5 = _mm_add_epi32(s3_13_3, k__DCT_CONST_ROUNDING);
- lstep3[20] = _mm_srai_epi32(s3_10_4, DCT_CONST_BITS);
- lstep3[21] = _mm_srai_epi32(s3_10_5, DCT_CONST_BITS);
- lstep3[22] = _mm_srai_epi32(s3_11_4, DCT_CONST_BITS);
- lstep3[23] = _mm_srai_epi32(s3_11_5, DCT_CONST_BITS);
- lstep3[24] = _mm_srai_epi32(s3_12_4, DCT_CONST_BITS);
- lstep3[25] = _mm_srai_epi32(s3_12_5, DCT_CONST_BITS);
- lstep3[26] = _mm_srai_epi32(s3_13_4, DCT_CONST_BITS);
- lstep3[27] = _mm_srai_epi32(s3_13_5, DCT_CONST_BITS);
- }
- {
- lstep2[40] = _mm_unpacklo_epi16(step2[20], kZero);
- lstep2[41] = _mm_unpackhi_epi16(step2[20], kZero);
- lstep2[42] = _mm_unpacklo_epi16(step2[21], kZero);
- lstep2[43] = _mm_unpackhi_epi16(step2[21], kZero);
- lstep2[44] = _mm_unpacklo_epi16(step2[22], kZero);
- lstep2[45] = _mm_unpackhi_epi16(step2[22], kZero);
- lstep2[46] = _mm_unpacklo_epi16(step2[23], kZero);
- lstep2[47] = _mm_unpackhi_epi16(step2[23], kZero);
- lstep2[48] = _mm_unpacklo_epi16(step2[24], kZero);
- lstep2[49] = _mm_unpackhi_epi16(step2[24], kZero);
- lstep2[50] = _mm_unpacklo_epi16(step2[25], kZero);
- lstep2[51] = _mm_unpackhi_epi16(step2[25], kZero);
- lstep2[52] = _mm_unpacklo_epi16(step2[26], kZero);
- lstep2[53] = _mm_unpackhi_epi16(step2[26], kZero);
- lstep2[54] = _mm_unpacklo_epi16(step2[27], kZero);
- lstep2[55] = _mm_unpackhi_epi16(step2[27], kZero);
- lstep2[40] = _mm_madd_epi16(lstep2[40], kOne);
- lstep2[41] = _mm_madd_epi16(lstep2[41], kOne);
- lstep2[42] = _mm_madd_epi16(lstep2[42], kOne);
- lstep2[43] = _mm_madd_epi16(lstep2[43], kOne);
- lstep2[44] = _mm_madd_epi16(lstep2[44], kOne);
- lstep2[45] = _mm_madd_epi16(lstep2[45], kOne);
- lstep2[46] = _mm_madd_epi16(lstep2[46], kOne);
- lstep2[47] = _mm_madd_epi16(lstep2[47], kOne);
- lstep2[48] = _mm_madd_epi16(lstep2[48], kOne);
- lstep2[49] = _mm_madd_epi16(lstep2[49], kOne);
- lstep2[50] = _mm_madd_epi16(lstep2[50], kOne);
- lstep2[51] = _mm_madd_epi16(lstep2[51], kOne);
- lstep2[52] = _mm_madd_epi16(lstep2[52], kOne);
- lstep2[53] = _mm_madd_epi16(lstep2[53], kOne);
- lstep2[54] = _mm_madd_epi16(lstep2[54], kOne);
- lstep2[55] = _mm_madd_epi16(lstep2[55], kOne);
-
- lstep1[32] = _mm_unpacklo_epi16(step1[16], kZero);
- lstep1[33] = _mm_unpackhi_epi16(step1[16], kZero);
- lstep1[34] = _mm_unpacklo_epi16(step1[17], kZero);
- lstep1[35] = _mm_unpackhi_epi16(step1[17], kZero);
- lstep1[36] = _mm_unpacklo_epi16(step1[18], kZero);
- lstep1[37] = _mm_unpackhi_epi16(step1[18], kZero);
- lstep1[38] = _mm_unpacklo_epi16(step1[19], kZero);
- lstep1[39] = _mm_unpackhi_epi16(step1[19], kZero);
- lstep1[56] = _mm_unpacklo_epi16(step1[28], kZero);
- lstep1[57] = _mm_unpackhi_epi16(step1[28], kZero);
- lstep1[58] = _mm_unpacklo_epi16(step1[29], kZero);
- lstep1[59] = _mm_unpackhi_epi16(step1[29], kZero);
- lstep1[60] = _mm_unpacklo_epi16(step1[30], kZero);
- lstep1[61] = _mm_unpackhi_epi16(step1[30], kZero);
- lstep1[62] = _mm_unpacklo_epi16(step1[31], kZero);
- lstep1[63] = _mm_unpackhi_epi16(step1[31], kZero);
- lstep1[32] = _mm_madd_epi16(lstep1[32], kOne);
- lstep1[33] = _mm_madd_epi16(lstep1[33], kOne);
- lstep1[34] = _mm_madd_epi16(lstep1[34], kOne);
- lstep1[35] = _mm_madd_epi16(lstep1[35], kOne);
- lstep1[36] = _mm_madd_epi16(lstep1[36], kOne);
- lstep1[37] = _mm_madd_epi16(lstep1[37], kOne);
- lstep1[38] = _mm_madd_epi16(lstep1[38], kOne);
- lstep1[39] = _mm_madd_epi16(lstep1[39], kOne);
- lstep1[56] = _mm_madd_epi16(lstep1[56], kOne);
- lstep1[57] = _mm_madd_epi16(lstep1[57], kOne);
- lstep1[58] = _mm_madd_epi16(lstep1[58], kOne);
- lstep1[59] = _mm_madd_epi16(lstep1[59], kOne);
- lstep1[60] = _mm_madd_epi16(lstep1[60], kOne);
- lstep1[61] = _mm_madd_epi16(lstep1[61], kOne);
- lstep1[62] = _mm_madd_epi16(lstep1[62], kOne);
- lstep1[63] = _mm_madd_epi16(lstep1[63], kOne);
-
- lstep3[32] = _mm_add_epi32(lstep2[46], lstep1[32]);
- lstep3[33] = _mm_add_epi32(lstep2[47], lstep1[33]);
-
- lstep3[34] = _mm_add_epi32(lstep2[44], lstep1[34]);
- lstep3[35] = _mm_add_epi32(lstep2[45], lstep1[35]);
- lstep3[36] = _mm_add_epi32(lstep2[42], lstep1[36]);
- lstep3[37] = _mm_add_epi32(lstep2[43], lstep1[37]);
- lstep3[38] = _mm_add_epi32(lstep2[40], lstep1[38]);
- lstep3[39] = _mm_add_epi32(lstep2[41], lstep1[39]);
- lstep3[40] = _mm_sub_epi32(lstep1[38], lstep2[40]);
- lstep3[41] = _mm_sub_epi32(lstep1[39], lstep2[41]);
- lstep3[42] = _mm_sub_epi32(lstep1[36], lstep2[42]);
- lstep3[43] = _mm_sub_epi32(lstep1[37], lstep2[43]);
- lstep3[44] = _mm_sub_epi32(lstep1[34], lstep2[44]);
- lstep3[45] = _mm_sub_epi32(lstep1[35], lstep2[45]);
- lstep3[46] = _mm_sub_epi32(lstep1[32], lstep2[46]);
- lstep3[47] = _mm_sub_epi32(lstep1[33], lstep2[47]);
- lstep3[48] = _mm_sub_epi32(lstep1[62], lstep2[48]);
- lstep3[49] = _mm_sub_epi32(lstep1[63], lstep2[49]);
- lstep3[50] = _mm_sub_epi32(lstep1[60], lstep2[50]);
- lstep3[51] = _mm_sub_epi32(lstep1[61], lstep2[51]);
- lstep3[52] = _mm_sub_epi32(lstep1[58], lstep2[52]);
- lstep3[53] = _mm_sub_epi32(lstep1[59], lstep2[53]);
- lstep3[54] = _mm_sub_epi32(lstep1[56], lstep2[54]);
- lstep3[55] = _mm_sub_epi32(lstep1[57], lstep2[55]);
- lstep3[56] = _mm_add_epi32(lstep2[54], lstep1[56]);
- lstep3[57] = _mm_add_epi32(lstep2[55], lstep1[57]);
- lstep3[58] = _mm_add_epi32(lstep2[52], lstep1[58]);
- lstep3[59] = _mm_add_epi32(lstep2[53], lstep1[59]);
- lstep3[60] = _mm_add_epi32(lstep2[50], lstep1[60]);
- lstep3[61] = _mm_add_epi32(lstep2[51], lstep1[61]);
- lstep3[62] = _mm_add_epi32(lstep2[48], lstep1[62]);
- lstep3[63] = _mm_add_epi32(lstep2[49], lstep1[63]);
- }
-
- // stage 4
- {
- // expanding to 32-bit length priori to addition operations
- lstep2[16] = _mm_unpacklo_epi16(step2[ 8], kZero);
- lstep2[17] = _mm_unpackhi_epi16(step2[ 8], kZero);
- lstep2[18] = _mm_unpacklo_epi16(step2[ 9], kZero);
- lstep2[19] = _mm_unpackhi_epi16(step2[ 9], kZero);
- lstep2[28] = _mm_unpacklo_epi16(step2[14], kZero);
- lstep2[29] = _mm_unpackhi_epi16(step2[14], kZero);
- lstep2[30] = _mm_unpacklo_epi16(step2[15], kZero);
- lstep2[31] = _mm_unpackhi_epi16(step2[15], kZero);
- lstep2[16] = _mm_madd_epi16(lstep2[16], kOne);
- lstep2[17] = _mm_madd_epi16(lstep2[17], kOne);
- lstep2[18] = _mm_madd_epi16(lstep2[18], kOne);
- lstep2[19] = _mm_madd_epi16(lstep2[19], kOne);
- lstep2[28] = _mm_madd_epi16(lstep2[28], kOne);
- lstep2[29] = _mm_madd_epi16(lstep2[29], kOne);
- lstep2[30] = _mm_madd_epi16(lstep2[30], kOne);
- lstep2[31] = _mm_madd_epi16(lstep2[31], kOne);
-
- lstep1[ 0] = _mm_add_epi32(lstep3[ 6], lstep3[ 0]);
- lstep1[ 1] = _mm_add_epi32(lstep3[ 7], lstep3[ 1]);
- lstep1[ 2] = _mm_add_epi32(lstep3[ 4], lstep3[ 2]);
- lstep1[ 3] = _mm_add_epi32(lstep3[ 5], lstep3[ 3]);
- lstep1[ 4] = _mm_sub_epi32(lstep3[ 2], lstep3[ 4]);
- lstep1[ 5] = _mm_sub_epi32(lstep3[ 3], lstep3[ 5]);
- lstep1[ 6] = _mm_sub_epi32(lstep3[ 0], lstep3[ 6]);
- lstep1[ 7] = _mm_sub_epi32(lstep3[ 1], lstep3[ 7]);
- lstep1[16] = _mm_add_epi32(lstep3[22], lstep2[16]);
- lstep1[17] = _mm_add_epi32(lstep3[23], lstep2[17]);
- lstep1[18] = _mm_add_epi32(lstep3[20], lstep2[18]);
- lstep1[19] = _mm_add_epi32(lstep3[21], lstep2[19]);
- lstep1[20] = _mm_sub_epi32(lstep2[18], lstep3[20]);
- lstep1[21] = _mm_sub_epi32(lstep2[19], lstep3[21]);
- lstep1[22] = _mm_sub_epi32(lstep2[16], lstep3[22]);
- lstep1[23] = _mm_sub_epi32(lstep2[17], lstep3[23]);
- lstep1[24] = _mm_sub_epi32(lstep2[30], lstep3[24]);
- lstep1[25] = _mm_sub_epi32(lstep2[31], lstep3[25]);
- lstep1[26] = _mm_sub_epi32(lstep2[28], lstep3[26]);
- lstep1[27] = _mm_sub_epi32(lstep2[29], lstep3[27]);
- lstep1[28] = _mm_add_epi32(lstep3[26], lstep2[28]);
- lstep1[29] = _mm_add_epi32(lstep3[27], lstep2[29]);
- lstep1[30] = _mm_add_epi32(lstep3[24], lstep2[30]);
- lstep1[31] = _mm_add_epi32(lstep3[25], lstep2[31]);
- }
- {
- // to be continued...
- //
- const __m128i k32_p16_p16 = pair_set_epi32(cospi_16_64, cospi_16_64);
- const __m128i k32_p16_m16 = pair_set_epi32(cospi_16_64, -cospi_16_64);
-
- u[0] = _mm_unpacklo_epi32(lstep3[12], lstep3[10]);
- u[1] = _mm_unpackhi_epi32(lstep3[12], lstep3[10]);
- u[2] = _mm_unpacklo_epi32(lstep3[13], lstep3[11]);
- u[3] = _mm_unpackhi_epi32(lstep3[13], lstep3[11]);
-
- // TODO(jingning): manually inline k_madd_epi32_ to further hide
- // instruction latency.
- v[ 0] = k_madd_epi32(u[0], k32_p16_m16);
- v[ 1] = k_madd_epi32(u[1], k32_p16_m16);
- v[ 2] = k_madd_epi32(u[2], k32_p16_m16);
- v[ 3] = k_madd_epi32(u[3], k32_p16_m16);
- v[ 4] = k_madd_epi32(u[0], k32_p16_p16);
- v[ 5] = k_madd_epi32(u[1], k32_p16_p16);
- v[ 6] = k_madd_epi32(u[2], k32_p16_p16);
- v[ 7] = k_madd_epi32(u[3], k32_p16_p16);
-
- u[0] = k_packs_epi64(v[0], v[1]);
- u[1] = k_packs_epi64(v[2], v[3]);
- u[2] = k_packs_epi64(v[4], v[5]);
- u[3] = k_packs_epi64(v[6], v[7]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
-
- lstep1[10] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- lstep1[11] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- lstep1[12] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- lstep1[13] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- }
- {
- const __m128i k32_m08_p24 = pair_set_epi32(-cospi_8_64, cospi_24_64);
- const __m128i k32_m24_m08 = pair_set_epi32(-cospi_24_64, -cospi_8_64);
- const __m128i k32_p24_p08 = pair_set_epi32(cospi_24_64, cospi_8_64);
-
- u[ 0] = _mm_unpacklo_epi32(lstep3[36], lstep3[58]);
- u[ 1] = _mm_unpackhi_epi32(lstep3[36], lstep3[58]);
- u[ 2] = _mm_unpacklo_epi32(lstep3[37], lstep3[59]);
- u[ 3] = _mm_unpackhi_epi32(lstep3[37], lstep3[59]);
- u[ 4] = _mm_unpacklo_epi32(lstep3[38], lstep3[56]);
- u[ 5] = _mm_unpackhi_epi32(lstep3[38], lstep3[56]);
- u[ 6] = _mm_unpacklo_epi32(lstep3[39], lstep3[57]);
- u[ 7] = _mm_unpackhi_epi32(lstep3[39], lstep3[57]);
- u[ 8] = _mm_unpacklo_epi32(lstep3[40], lstep3[54]);
- u[ 9] = _mm_unpackhi_epi32(lstep3[40], lstep3[54]);
- u[10] = _mm_unpacklo_epi32(lstep3[41], lstep3[55]);
- u[11] = _mm_unpackhi_epi32(lstep3[41], lstep3[55]);
- u[12] = _mm_unpacklo_epi32(lstep3[42], lstep3[52]);
- u[13] = _mm_unpackhi_epi32(lstep3[42], lstep3[52]);
- u[14] = _mm_unpacklo_epi32(lstep3[43], lstep3[53]);
- u[15] = _mm_unpackhi_epi32(lstep3[43], lstep3[53]);
-
- v[ 0] = k_madd_epi32(u[ 0], k32_m08_p24);
- v[ 1] = k_madd_epi32(u[ 1], k32_m08_p24);
- v[ 2] = k_madd_epi32(u[ 2], k32_m08_p24);
- v[ 3] = k_madd_epi32(u[ 3], k32_m08_p24);
- v[ 4] = k_madd_epi32(u[ 4], k32_m08_p24);
- v[ 5] = k_madd_epi32(u[ 5], k32_m08_p24);
- v[ 6] = k_madd_epi32(u[ 6], k32_m08_p24);
- v[ 7] = k_madd_epi32(u[ 7], k32_m08_p24);
- v[ 8] = k_madd_epi32(u[ 8], k32_m24_m08);
- v[ 9] = k_madd_epi32(u[ 9], k32_m24_m08);
- v[10] = k_madd_epi32(u[10], k32_m24_m08);
- v[11] = k_madd_epi32(u[11], k32_m24_m08);
- v[12] = k_madd_epi32(u[12], k32_m24_m08);
- v[13] = k_madd_epi32(u[13], k32_m24_m08);
- v[14] = k_madd_epi32(u[14], k32_m24_m08);
- v[15] = k_madd_epi32(u[15], k32_m24_m08);
- v[16] = k_madd_epi32(u[12], k32_m08_p24);
- v[17] = k_madd_epi32(u[13], k32_m08_p24);
- v[18] = k_madd_epi32(u[14], k32_m08_p24);
- v[19] = k_madd_epi32(u[15], k32_m08_p24);
- v[20] = k_madd_epi32(u[ 8], k32_m08_p24);
- v[21] = k_madd_epi32(u[ 9], k32_m08_p24);
- v[22] = k_madd_epi32(u[10], k32_m08_p24);
- v[23] = k_madd_epi32(u[11], k32_m08_p24);
- v[24] = k_madd_epi32(u[ 4], k32_p24_p08);
- v[25] = k_madd_epi32(u[ 5], k32_p24_p08);
- v[26] = k_madd_epi32(u[ 6], k32_p24_p08);
- v[27] = k_madd_epi32(u[ 7], k32_p24_p08);
- v[28] = k_madd_epi32(u[ 0], k32_p24_p08);
- v[29] = k_madd_epi32(u[ 1], k32_p24_p08);
- v[30] = k_madd_epi32(u[ 2], k32_p24_p08);
- v[31] = k_madd_epi32(u[ 3], k32_p24_p08);
-
- u[ 0] = k_packs_epi64(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64(v[10], v[11]);
- u[ 6] = k_packs_epi64(v[12], v[13]);
- u[ 7] = k_packs_epi64(v[14], v[15]);
- u[ 8] = k_packs_epi64(v[16], v[17]);
- u[ 9] = k_packs_epi64(v[18], v[19]);
- u[10] = k_packs_epi64(v[20], v[21]);
- u[11] = k_packs_epi64(v[22], v[23]);
- u[12] = k_packs_epi64(v[24], v[25]);
- u[13] = k_packs_epi64(v[26], v[27]);
- u[14] = k_packs_epi64(v[28], v[29]);
- u[15] = k_packs_epi64(v[30], v[31]);
-
- v[ 0] = _mm_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- lstep1[36] = _mm_srai_epi32(v[ 0], DCT_CONST_BITS);
- lstep1[37] = _mm_srai_epi32(v[ 1], DCT_CONST_BITS);
- lstep1[38] = _mm_srai_epi32(v[ 2], DCT_CONST_BITS);
- lstep1[39] = _mm_srai_epi32(v[ 3], DCT_CONST_BITS);
- lstep1[40] = _mm_srai_epi32(v[ 4], DCT_CONST_BITS);
- lstep1[41] = _mm_srai_epi32(v[ 5], DCT_CONST_BITS);
- lstep1[42] = _mm_srai_epi32(v[ 6], DCT_CONST_BITS);
- lstep1[43] = _mm_srai_epi32(v[ 7], DCT_CONST_BITS);
- lstep1[52] = _mm_srai_epi32(v[ 8], DCT_CONST_BITS);
- lstep1[53] = _mm_srai_epi32(v[ 9], DCT_CONST_BITS);
- lstep1[54] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- lstep1[55] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- lstep1[56] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- lstep1[57] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- lstep1[58] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- lstep1[59] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
- }
- // stage 5
- {
- lstep2[ 8] = _mm_add_epi32(lstep1[10], lstep3[ 8]);
- lstep2[ 9] = _mm_add_epi32(lstep1[11], lstep3[ 9]);
- lstep2[10] = _mm_sub_epi32(lstep3[ 8], lstep1[10]);
- lstep2[11] = _mm_sub_epi32(lstep3[ 9], lstep1[11]);
- lstep2[12] = _mm_sub_epi32(lstep3[14], lstep1[12]);
- lstep2[13] = _mm_sub_epi32(lstep3[15], lstep1[13]);
- lstep2[14] = _mm_add_epi32(lstep1[12], lstep3[14]);
- lstep2[15] = _mm_add_epi32(lstep1[13], lstep3[15]);
- }
- {
- const __m128i k32_p16_p16 = pair_set_epi32(cospi_16_64, cospi_16_64);
- const __m128i k32_p16_m16 = pair_set_epi32(cospi_16_64, -cospi_16_64);
- const __m128i k32_p24_p08 = pair_set_epi32(cospi_24_64, cospi_8_64);
- const __m128i k32_m08_p24 = pair_set_epi32(-cospi_8_64, cospi_24_64);
-
- u[0] = _mm_unpacklo_epi32(lstep1[0], lstep1[2]);
- u[1] = _mm_unpackhi_epi32(lstep1[0], lstep1[2]);
- u[2] = _mm_unpacklo_epi32(lstep1[1], lstep1[3]);
- u[3] = _mm_unpackhi_epi32(lstep1[1], lstep1[3]);
- u[4] = _mm_unpacklo_epi32(lstep1[4], lstep1[6]);
- u[5] = _mm_unpackhi_epi32(lstep1[4], lstep1[6]);
- u[6] = _mm_unpacklo_epi32(lstep1[5], lstep1[7]);
- u[7] = _mm_unpackhi_epi32(lstep1[5], lstep1[7]);
-
- // TODO(jingning): manually inline k_madd_epi32_ to further hide
- // instruction latency.
- v[ 0] = k_madd_epi32(u[0], k32_p16_p16);
- v[ 1] = k_madd_epi32(u[1], k32_p16_p16);
- v[ 2] = k_madd_epi32(u[2], k32_p16_p16);
- v[ 3] = k_madd_epi32(u[3], k32_p16_p16);
- v[ 4] = k_madd_epi32(u[0], k32_p16_m16);
- v[ 5] = k_madd_epi32(u[1], k32_p16_m16);
- v[ 6] = k_madd_epi32(u[2], k32_p16_m16);
- v[ 7] = k_madd_epi32(u[3], k32_p16_m16);
- v[ 8] = k_madd_epi32(u[4], k32_p24_p08);
- v[ 9] = k_madd_epi32(u[5], k32_p24_p08);
- v[10] = k_madd_epi32(u[6], k32_p24_p08);
- v[11] = k_madd_epi32(u[7], k32_p24_p08);
- v[12] = k_madd_epi32(u[4], k32_m08_p24);
- v[13] = k_madd_epi32(u[5], k32_m08_p24);
- v[14] = k_madd_epi32(u[6], k32_m08_p24);
- v[15] = k_madd_epi32(u[7], k32_m08_p24);
-
- u[0] = k_packs_epi64(v[0], v[1]);
- u[1] = k_packs_epi64(v[2], v[3]);
- u[2] = k_packs_epi64(v[4], v[5]);
- u[3] = k_packs_epi64(v[6], v[7]);
- u[4] = k_packs_epi64(v[8], v[9]);
- u[5] = k_packs_epi64(v[10], v[11]);
- u[6] = k_packs_epi64(v[12], v[13]);
- u[7] = k_packs_epi64(v[14], v[15]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
-
- sign[0] = _mm_cmplt_epi32(u[0], kZero);
- sign[1] = _mm_cmplt_epi32(u[1], kZero);
- sign[2] = _mm_cmplt_epi32(u[2], kZero);
- sign[3] = _mm_cmplt_epi32(u[3], kZero);
- sign[4] = _mm_cmplt_epi32(u[4], kZero);
- sign[5] = _mm_cmplt_epi32(u[5], kZero);
- sign[6] = _mm_cmplt_epi32(u[6], kZero);
- sign[7] = _mm_cmplt_epi32(u[7], kZero);
-
- u[0] = _mm_sub_epi32(u[0], sign[0]);
- u[1] = _mm_sub_epi32(u[1], sign[1]);
- u[2] = _mm_sub_epi32(u[2], sign[2]);
- u[3] = _mm_sub_epi32(u[3], sign[3]);
- u[4] = _mm_sub_epi32(u[4], sign[4]);
- u[5] = _mm_sub_epi32(u[5], sign[5]);
- u[6] = _mm_sub_epi32(u[6], sign[6]);
- u[7] = _mm_sub_epi32(u[7], sign[7]);
-
- u[0] = _mm_add_epi32(u[0], K32One);
- u[1] = _mm_add_epi32(u[1], K32One);
- u[2] = _mm_add_epi32(u[2], K32One);
- u[3] = _mm_add_epi32(u[3], K32One);
- u[4] = _mm_add_epi32(u[4], K32One);
- u[5] = _mm_add_epi32(u[5], K32One);
- u[6] = _mm_add_epi32(u[6], K32One);
- u[7] = _mm_add_epi32(u[7], K32One);
-
- u[0] = _mm_srai_epi32(u[0], 2);
- u[1] = _mm_srai_epi32(u[1], 2);
- u[2] = _mm_srai_epi32(u[2], 2);
- u[3] = _mm_srai_epi32(u[3], 2);
- u[4] = _mm_srai_epi32(u[4], 2);
- u[5] = _mm_srai_epi32(u[5], 2);
- u[6] = _mm_srai_epi32(u[6], 2);
- u[7] = _mm_srai_epi32(u[7], 2);
-
- // Combine
- out[ 0] = _mm_packs_epi32(u[0], u[1]);
- out[16] = _mm_packs_epi32(u[2], u[3]);
- out[ 8] = _mm_packs_epi32(u[4], u[5]);
- out[24] = _mm_packs_epi32(u[6], u[7]);
- }
- {
- const __m128i k32_m08_p24 = pair_set_epi32(-cospi_8_64, cospi_24_64);
- const __m128i k32_m24_m08 = pair_set_epi32(-cospi_24_64, -cospi_8_64);
- const __m128i k32_p24_p08 = pair_set_epi32(cospi_24_64, cospi_8_64);
-
- u[0] = _mm_unpacklo_epi32(lstep1[18], lstep1[28]);
- u[1] = _mm_unpackhi_epi32(lstep1[18], lstep1[28]);
- u[2] = _mm_unpacklo_epi32(lstep1[19], lstep1[29]);
- u[3] = _mm_unpackhi_epi32(lstep1[19], lstep1[29]);
- u[4] = _mm_unpacklo_epi32(lstep1[20], lstep1[26]);
- u[5] = _mm_unpackhi_epi32(lstep1[20], lstep1[26]);
- u[6] = _mm_unpacklo_epi32(lstep1[21], lstep1[27]);
- u[7] = _mm_unpackhi_epi32(lstep1[21], lstep1[27]);
-
- v[0] = k_madd_epi32(u[0], k32_m08_p24);
- v[1] = k_madd_epi32(u[1], k32_m08_p24);
- v[2] = k_madd_epi32(u[2], k32_m08_p24);
- v[3] = k_madd_epi32(u[3], k32_m08_p24);
- v[4] = k_madd_epi32(u[4], k32_m24_m08);
- v[5] = k_madd_epi32(u[5], k32_m24_m08);
- v[6] = k_madd_epi32(u[6], k32_m24_m08);
- v[7] = k_madd_epi32(u[7], k32_m24_m08);
- v[ 8] = k_madd_epi32(u[4], k32_m08_p24);
- v[ 9] = k_madd_epi32(u[5], k32_m08_p24);
- v[10] = k_madd_epi32(u[6], k32_m08_p24);
- v[11] = k_madd_epi32(u[7], k32_m08_p24);
- v[12] = k_madd_epi32(u[0], k32_p24_p08);
- v[13] = k_madd_epi32(u[1], k32_p24_p08);
- v[14] = k_madd_epi32(u[2], k32_p24_p08);
- v[15] = k_madd_epi32(u[3], k32_p24_p08);
-
- u[0] = k_packs_epi64(v[0], v[1]);
- u[1] = k_packs_epi64(v[2], v[3]);
- u[2] = k_packs_epi64(v[4], v[5]);
- u[3] = k_packs_epi64(v[6], v[7]);
- u[4] = k_packs_epi64(v[8], v[9]);
- u[5] = k_packs_epi64(v[10], v[11]);
- u[6] = k_packs_epi64(v[12], v[13]);
- u[7] = k_packs_epi64(v[14], v[15]);
-
- u[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- lstep2[18] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- lstep2[19] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- lstep2[20] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- lstep2[21] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- lstep2[26] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- lstep2[27] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- lstep2[28] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- lstep2[29] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- }
- {
- lstep2[32] = _mm_add_epi32(lstep1[38], lstep3[32]);
- lstep2[33] = _mm_add_epi32(lstep1[39], lstep3[33]);
- lstep2[34] = _mm_add_epi32(lstep1[36], lstep3[34]);
- lstep2[35] = _mm_add_epi32(lstep1[37], lstep3[35]);
- lstep2[36] = _mm_sub_epi32(lstep3[34], lstep1[36]);
- lstep2[37] = _mm_sub_epi32(lstep3[35], lstep1[37]);
- lstep2[38] = _mm_sub_epi32(lstep3[32], lstep1[38]);
- lstep2[39] = _mm_sub_epi32(lstep3[33], lstep1[39]);
- lstep2[40] = _mm_sub_epi32(lstep3[46], lstep1[40]);
- lstep2[41] = _mm_sub_epi32(lstep3[47], lstep1[41]);
- lstep2[42] = _mm_sub_epi32(lstep3[44], lstep1[42]);
- lstep2[43] = _mm_sub_epi32(lstep3[45], lstep1[43]);
- lstep2[44] = _mm_add_epi32(lstep1[42], lstep3[44]);
- lstep2[45] = _mm_add_epi32(lstep1[43], lstep3[45]);
- lstep2[46] = _mm_add_epi32(lstep1[40], lstep3[46]);
- lstep2[47] = _mm_add_epi32(lstep1[41], lstep3[47]);
- lstep2[48] = _mm_add_epi32(lstep1[54], lstep3[48]);
- lstep2[49] = _mm_add_epi32(lstep1[55], lstep3[49]);
- lstep2[50] = _mm_add_epi32(lstep1[52], lstep3[50]);
- lstep2[51] = _mm_add_epi32(lstep1[53], lstep3[51]);
- lstep2[52] = _mm_sub_epi32(lstep3[50], lstep1[52]);
- lstep2[53] = _mm_sub_epi32(lstep3[51], lstep1[53]);
- lstep2[54] = _mm_sub_epi32(lstep3[48], lstep1[54]);
- lstep2[55] = _mm_sub_epi32(lstep3[49], lstep1[55]);
- lstep2[56] = _mm_sub_epi32(lstep3[62], lstep1[56]);
- lstep2[57] = _mm_sub_epi32(lstep3[63], lstep1[57]);
- lstep2[58] = _mm_sub_epi32(lstep3[60], lstep1[58]);
- lstep2[59] = _mm_sub_epi32(lstep3[61], lstep1[59]);
- lstep2[60] = _mm_add_epi32(lstep1[58], lstep3[60]);
- lstep2[61] = _mm_add_epi32(lstep1[59], lstep3[61]);
- lstep2[62] = _mm_add_epi32(lstep1[56], lstep3[62]);
- lstep2[63] = _mm_add_epi32(lstep1[57], lstep3[63]);
- }
- // stage 6
- {
- const __m128i k32_p28_p04 = pair_set_epi32(cospi_28_64, cospi_4_64);
- const __m128i k32_p12_p20 = pair_set_epi32(cospi_12_64, cospi_20_64);
- const __m128i k32_m20_p12 = pair_set_epi32(-cospi_20_64, cospi_12_64);
- const __m128i k32_m04_p28 = pair_set_epi32(-cospi_4_64, cospi_28_64);
-
- u[0] = _mm_unpacklo_epi32(lstep2[ 8], lstep2[14]);
- u[1] = _mm_unpackhi_epi32(lstep2[ 8], lstep2[14]);
- u[2] = _mm_unpacklo_epi32(lstep2[ 9], lstep2[15]);
- u[3] = _mm_unpackhi_epi32(lstep2[ 9], lstep2[15]);
- u[4] = _mm_unpacklo_epi32(lstep2[10], lstep2[12]);
- u[5] = _mm_unpackhi_epi32(lstep2[10], lstep2[12]);
- u[6] = _mm_unpacklo_epi32(lstep2[11], lstep2[13]);
- u[7] = _mm_unpackhi_epi32(lstep2[11], lstep2[13]);
- u[8] = _mm_unpacklo_epi32(lstep2[10], lstep2[12]);
- u[9] = _mm_unpackhi_epi32(lstep2[10], lstep2[12]);
- u[10] = _mm_unpacklo_epi32(lstep2[11], lstep2[13]);
- u[11] = _mm_unpackhi_epi32(lstep2[11], lstep2[13]);
- u[12] = _mm_unpacklo_epi32(lstep2[ 8], lstep2[14]);
- u[13] = _mm_unpackhi_epi32(lstep2[ 8], lstep2[14]);
- u[14] = _mm_unpacklo_epi32(lstep2[ 9], lstep2[15]);
- u[15] = _mm_unpackhi_epi32(lstep2[ 9], lstep2[15]);
-
- v[0] = k_madd_epi32(u[0], k32_p28_p04);
- v[1] = k_madd_epi32(u[1], k32_p28_p04);
- v[2] = k_madd_epi32(u[2], k32_p28_p04);
- v[3] = k_madd_epi32(u[3], k32_p28_p04);
- v[4] = k_madd_epi32(u[4], k32_p12_p20);
- v[5] = k_madd_epi32(u[5], k32_p12_p20);
- v[6] = k_madd_epi32(u[6], k32_p12_p20);
- v[7] = k_madd_epi32(u[7], k32_p12_p20);
- v[ 8] = k_madd_epi32(u[ 8], k32_m20_p12);
- v[ 9] = k_madd_epi32(u[ 9], k32_m20_p12);
- v[10] = k_madd_epi32(u[10], k32_m20_p12);
- v[11] = k_madd_epi32(u[11], k32_m20_p12);
- v[12] = k_madd_epi32(u[12], k32_m04_p28);
- v[13] = k_madd_epi32(u[13], k32_m04_p28);
- v[14] = k_madd_epi32(u[14], k32_m04_p28);
- v[15] = k_madd_epi32(u[15], k32_m04_p28);
-
- u[0] = k_packs_epi64(v[0], v[1]);
- u[1] = k_packs_epi64(v[2], v[3]);
- u[2] = k_packs_epi64(v[4], v[5]);
- u[3] = k_packs_epi64(v[6], v[7]);
- u[4] = k_packs_epi64(v[8], v[9]);
- u[5] = k_packs_epi64(v[10], v[11]);
- u[6] = k_packs_epi64(v[12], v[13]);
- u[7] = k_packs_epi64(v[14], v[15]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
-
- sign[0] = _mm_cmplt_epi32(u[0], kZero);
- sign[1] = _mm_cmplt_epi32(u[1], kZero);
- sign[2] = _mm_cmplt_epi32(u[2], kZero);
- sign[3] = _mm_cmplt_epi32(u[3], kZero);
- sign[4] = _mm_cmplt_epi32(u[4], kZero);
- sign[5] = _mm_cmplt_epi32(u[5], kZero);
- sign[6] = _mm_cmplt_epi32(u[6], kZero);
- sign[7] = _mm_cmplt_epi32(u[7], kZero);
-
- u[0] = _mm_sub_epi32(u[0], sign[0]);
- u[1] = _mm_sub_epi32(u[1], sign[1]);
- u[2] = _mm_sub_epi32(u[2], sign[2]);
- u[3] = _mm_sub_epi32(u[3], sign[3]);
- u[4] = _mm_sub_epi32(u[4], sign[4]);
- u[5] = _mm_sub_epi32(u[5], sign[5]);
- u[6] = _mm_sub_epi32(u[6], sign[6]);
- u[7] = _mm_sub_epi32(u[7], sign[7]);
-
- u[0] = _mm_add_epi32(u[0], K32One);
- u[1] = _mm_add_epi32(u[1], K32One);
- u[2] = _mm_add_epi32(u[2], K32One);
- u[3] = _mm_add_epi32(u[3], K32One);
- u[4] = _mm_add_epi32(u[4], K32One);
- u[5] = _mm_add_epi32(u[5], K32One);
- u[6] = _mm_add_epi32(u[6], K32One);
- u[7] = _mm_add_epi32(u[7], K32One);
-
- u[0] = _mm_srai_epi32(u[0], 2);
- u[1] = _mm_srai_epi32(u[1], 2);
- u[2] = _mm_srai_epi32(u[2], 2);
- u[3] = _mm_srai_epi32(u[3], 2);
- u[4] = _mm_srai_epi32(u[4], 2);
- u[5] = _mm_srai_epi32(u[5], 2);
- u[6] = _mm_srai_epi32(u[6], 2);
- u[7] = _mm_srai_epi32(u[7], 2);
-
- out[ 4] = _mm_packs_epi32(u[0], u[1]);
- out[20] = _mm_packs_epi32(u[2], u[3]);
- out[12] = _mm_packs_epi32(u[4], u[5]);
- out[28] = _mm_packs_epi32(u[6], u[7]);
- }
- {
- lstep3[16] = _mm_add_epi32(lstep2[18], lstep1[16]);
- lstep3[17] = _mm_add_epi32(lstep2[19], lstep1[17]);
- lstep3[18] = _mm_sub_epi32(lstep1[16], lstep2[18]);
- lstep3[19] = _mm_sub_epi32(lstep1[17], lstep2[19]);
- lstep3[20] = _mm_sub_epi32(lstep1[22], lstep2[20]);
- lstep3[21] = _mm_sub_epi32(lstep1[23], lstep2[21]);
- lstep3[22] = _mm_add_epi32(lstep2[20], lstep1[22]);
- lstep3[23] = _mm_add_epi32(lstep2[21], lstep1[23]);
- lstep3[24] = _mm_add_epi32(lstep2[26], lstep1[24]);
- lstep3[25] = _mm_add_epi32(lstep2[27], lstep1[25]);
- lstep3[26] = _mm_sub_epi32(lstep1[24], lstep2[26]);
- lstep3[27] = _mm_sub_epi32(lstep1[25], lstep2[27]);
- lstep3[28] = _mm_sub_epi32(lstep1[30], lstep2[28]);
- lstep3[29] = _mm_sub_epi32(lstep1[31], lstep2[29]);
- lstep3[30] = _mm_add_epi32(lstep2[28], lstep1[30]);
- lstep3[31] = _mm_add_epi32(lstep2[29], lstep1[31]);
- }
- {
- const __m128i k32_m04_p28 = pair_set_epi32(-cospi_4_64, cospi_28_64);
- const __m128i k32_m28_m04 = pair_set_epi32(-cospi_28_64, -cospi_4_64);
- const __m128i k32_m20_p12 = pair_set_epi32(-cospi_20_64, cospi_12_64);
- const __m128i k32_m12_m20 = pair_set_epi32(-cospi_12_64,
- -cospi_20_64);
- const __m128i k32_p12_p20 = pair_set_epi32(cospi_12_64, cospi_20_64);
- const __m128i k32_p28_p04 = pair_set_epi32(cospi_28_64, cospi_4_64);
-
- u[ 0] = _mm_unpacklo_epi32(lstep2[34], lstep2[60]);
- u[ 1] = _mm_unpackhi_epi32(lstep2[34], lstep2[60]);
- u[ 2] = _mm_unpacklo_epi32(lstep2[35], lstep2[61]);
- u[ 3] = _mm_unpackhi_epi32(lstep2[35], lstep2[61]);
- u[ 4] = _mm_unpacklo_epi32(lstep2[36], lstep2[58]);
- u[ 5] = _mm_unpackhi_epi32(lstep2[36], lstep2[58]);
- u[ 6] = _mm_unpacklo_epi32(lstep2[37], lstep2[59]);
- u[ 7] = _mm_unpackhi_epi32(lstep2[37], lstep2[59]);
- u[ 8] = _mm_unpacklo_epi32(lstep2[42], lstep2[52]);
- u[ 9] = _mm_unpackhi_epi32(lstep2[42], lstep2[52]);
- u[10] = _mm_unpacklo_epi32(lstep2[43], lstep2[53]);
- u[11] = _mm_unpackhi_epi32(lstep2[43], lstep2[53]);
- u[12] = _mm_unpacklo_epi32(lstep2[44], lstep2[50]);
- u[13] = _mm_unpackhi_epi32(lstep2[44], lstep2[50]);
- u[14] = _mm_unpacklo_epi32(lstep2[45], lstep2[51]);
- u[15] = _mm_unpackhi_epi32(lstep2[45], lstep2[51]);
-
- v[ 0] = k_madd_epi32(u[ 0], k32_m04_p28);
- v[ 1] = k_madd_epi32(u[ 1], k32_m04_p28);
- v[ 2] = k_madd_epi32(u[ 2], k32_m04_p28);
- v[ 3] = k_madd_epi32(u[ 3], k32_m04_p28);
- v[ 4] = k_madd_epi32(u[ 4], k32_m28_m04);
- v[ 5] = k_madd_epi32(u[ 5], k32_m28_m04);
- v[ 6] = k_madd_epi32(u[ 6], k32_m28_m04);
- v[ 7] = k_madd_epi32(u[ 7], k32_m28_m04);
- v[ 8] = k_madd_epi32(u[ 8], k32_m20_p12);
- v[ 9] = k_madd_epi32(u[ 9], k32_m20_p12);
- v[10] = k_madd_epi32(u[10], k32_m20_p12);
- v[11] = k_madd_epi32(u[11], k32_m20_p12);
- v[12] = k_madd_epi32(u[12], k32_m12_m20);
- v[13] = k_madd_epi32(u[13], k32_m12_m20);
- v[14] = k_madd_epi32(u[14], k32_m12_m20);
- v[15] = k_madd_epi32(u[15], k32_m12_m20);
- v[16] = k_madd_epi32(u[12], k32_m20_p12);
- v[17] = k_madd_epi32(u[13], k32_m20_p12);
- v[18] = k_madd_epi32(u[14], k32_m20_p12);
- v[19] = k_madd_epi32(u[15], k32_m20_p12);
- v[20] = k_madd_epi32(u[ 8], k32_p12_p20);
- v[21] = k_madd_epi32(u[ 9], k32_p12_p20);
- v[22] = k_madd_epi32(u[10], k32_p12_p20);
- v[23] = k_madd_epi32(u[11], k32_p12_p20);
- v[24] = k_madd_epi32(u[ 4], k32_m04_p28);
- v[25] = k_madd_epi32(u[ 5], k32_m04_p28);
- v[26] = k_madd_epi32(u[ 6], k32_m04_p28);
- v[27] = k_madd_epi32(u[ 7], k32_m04_p28);
- v[28] = k_madd_epi32(u[ 0], k32_p28_p04);
- v[29] = k_madd_epi32(u[ 1], k32_p28_p04);
- v[30] = k_madd_epi32(u[ 2], k32_p28_p04);
- v[31] = k_madd_epi32(u[ 3], k32_p28_p04);
-
- u[ 0] = k_packs_epi64(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64(v[10], v[11]);
- u[ 6] = k_packs_epi64(v[12], v[13]);
- u[ 7] = k_packs_epi64(v[14], v[15]);
- u[ 8] = k_packs_epi64(v[16], v[17]);
- u[ 9] = k_packs_epi64(v[18], v[19]);
- u[10] = k_packs_epi64(v[20], v[21]);
- u[11] = k_packs_epi64(v[22], v[23]);
- u[12] = k_packs_epi64(v[24], v[25]);
- u[13] = k_packs_epi64(v[26], v[27]);
- u[14] = k_packs_epi64(v[28], v[29]);
- u[15] = k_packs_epi64(v[30], v[31]);
-
- v[ 0] = _mm_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- lstep3[34] = _mm_srai_epi32(v[ 0], DCT_CONST_BITS);
- lstep3[35] = _mm_srai_epi32(v[ 1], DCT_CONST_BITS);
- lstep3[36] = _mm_srai_epi32(v[ 2], DCT_CONST_BITS);
- lstep3[37] = _mm_srai_epi32(v[ 3], DCT_CONST_BITS);
- lstep3[42] = _mm_srai_epi32(v[ 4], DCT_CONST_BITS);
- lstep3[43] = _mm_srai_epi32(v[ 5], DCT_CONST_BITS);
- lstep3[44] = _mm_srai_epi32(v[ 6], DCT_CONST_BITS);
- lstep3[45] = _mm_srai_epi32(v[ 7], DCT_CONST_BITS);
- lstep3[50] = _mm_srai_epi32(v[ 8], DCT_CONST_BITS);
- lstep3[51] = _mm_srai_epi32(v[ 9], DCT_CONST_BITS);
- lstep3[52] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- lstep3[53] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- lstep3[58] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- lstep3[59] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- lstep3[60] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- lstep3[61] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
- }
- // stage 7
- {
- const __m128i k32_p30_p02 = pair_set_epi32(cospi_30_64, cospi_2_64);
- const __m128i k32_p14_p18 = pair_set_epi32(cospi_14_64, cospi_18_64);
- const __m128i k32_p22_p10 = pair_set_epi32(cospi_22_64, cospi_10_64);
- const __m128i k32_p06_p26 = pair_set_epi32(cospi_6_64, cospi_26_64);
- const __m128i k32_m26_p06 = pair_set_epi32(-cospi_26_64, cospi_6_64);
- const __m128i k32_m10_p22 = pair_set_epi32(-cospi_10_64, cospi_22_64);
- const __m128i k32_m18_p14 = pair_set_epi32(-cospi_18_64, cospi_14_64);
- const __m128i k32_m02_p30 = pair_set_epi32(-cospi_2_64, cospi_30_64);
-
- u[ 0] = _mm_unpacklo_epi32(lstep3[16], lstep3[30]);
- u[ 1] = _mm_unpackhi_epi32(lstep3[16], lstep3[30]);
- u[ 2] = _mm_unpacklo_epi32(lstep3[17], lstep3[31]);
- u[ 3] = _mm_unpackhi_epi32(lstep3[17], lstep3[31]);
- u[ 4] = _mm_unpacklo_epi32(lstep3[18], lstep3[28]);
- u[ 5] = _mm_unpackhi_epi32(lstep3[18], lstep3[28]);
- u[ 6] = _mm_unpacklo_epi32(lstep3[19], lstep3[29]);
- u[ 7] = _mm_unpackhi_epi32(lstep3[19], lstep3[29]);
- u[ 8] = _mm_unpacklo_epi32(lstep3[20], lstep3[26]);
- u[ 9] = _mm_unpackhi_epi32(lstep3[20], lstep3[26]);
- u[10] = _mm_unpacklo_epi32(lstep3[21], lstep3[27]);
- u[11] = _mm_unpackhi_epi32(lstep3[21], lstep3[27]);
- u[12] = _mm_unpacklo_epi32(lstep3[22], lstep3[24]);
- u[13] = _mm_unpackhi_epi32(lstep3[22], lstep3[24]);
- u[14] = _mm_unpacklo_epi32(lstep3[23], lstep3[25]);
- u[15] = _mm_unpackhi_epi32(lstep3[23], lstep3[25]);
-
- v[ 0] = k_madd_epi32(u[ 0], k32_p30_p02);
- v[ 1] = k_madd_epi32(u[ 1], k32_p30_p02);
- v[ 2] = k_madd_epi32(u[ 2], k32_p30_p02);
- v[ 3] = k_madd_epi32(u[ 3], k32_p30_p02);
- v[ 4] = k_madd_epi32(u[ 4], k32_p14_p18);
- v[ 5] = k_madd_epi32(u[ 5], k32_p14_p18);
- v[ 6] = k_madd_epi32(u[ 6], k32_p14_p18);
- v[ 7] = k_madd_epi32(u[ 7], k32_p14_p18);
- v[ 8] = k_madd_epi32(u[ 8], k32_p22_p10);
- v[ 9] = k_madd_epi32(u[ 9], k32_p22_p10);
- v[10] = k_madd_epi32(u[10], k32_p22_p10);
- v[11] = k_madd_epi32(u[11], k32_p22_p10);
- v[12] = k_madd_epi32(u[12], k32_p06_p26);
- v[13] = k_madd_epi32(u[13], k32_p06_p26);
- v[14] = k_madd_epi32(u[14], k32_p06_p26);
- v[15] = k_madd_epi32(u[15], k32_p06_p26);
- v[16] = k_madd_epi32(u[12], k32_m26_p06);
- v[17] = k_madd_epi32(u[13], k32_m26_p06);
- v[18] = k_madd_epi32(u[14], k32_m26_p06);
- v[19] = k_madd_epi32(u[15], k32_m26_p06);
- v[20] = k_madd_epi32(u[ 8], k32_m10_p22);
- v[21] = k_madd_epi32(u[ 9], k32_m10_p22);
- v[22] = k_madd_epi32(u[10], k32_m10_p22);
- v[23] = k_madd_epi32(u[11], k32_m10_p22);
- v[24] = k_madd_epi32(u[ 4], k32_m18_p14);
- v[25] = k_madd_epi32(u[ 5], k32_m18_p14);
- v[26] = k_madd_epi32(u[ 6], k32_m18_p14);
- v[27] = k_madd_epi32(u[ 7], k32_m18_p14);
- v[28] = k_madd_epi32(u[ 0], k32_m02_p30);
- v[29] = k_madd_epi32(u[ 1], k32_m02_p30);
- v[30] = k_madd_epi32(u[ 2], k32_m02_p30);
- v[31] = k_madd_epi32(u[ 3], k32_m02_p30);
-
- u[ 0] = k_packs_epi64(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64(v[10], v[11]);
- u[ 6] = k_packs_epi64(v[12], v[13]);
- u[ 7] = k_packs_epi64(v[14], v[15]);
- u[ 8] = k_packs_epi64(v[16], v[17]);
- u[ 9] = k_packs_epi64(v[18], v[19]);
- u[10] = k_packs_epi64(v[20], v[21]);
- u[11] = k_packs_epi64(v[22], v[23]);
- u[12] = k_packs_epi64(v[24], v[25]);
- u[13] = k_packs_epi64(v[26], v[27]);
- u[14] = k_packs_epi64(v[28], v[29]);
- u[15] = k_packs_epi64(v[30], v[31]);
-
- v[ 0] = _mm_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[ 0] = _mm_srai_epi32(v[ 0], DCT_CONST_BITS);
- u[ 1] = _mm_srai_epi32(v[ 1], DCT_CONST_BITS);
- u[ 2] = _mm_srai_epi32(v[ 2], DCT_CONST_BITS);
- u[ 3] = _mm_srai_epi32(v[ 3], DCT_CONST_BITS);
- u[ 4] = _mm_srai_epi32(v[ 4], DCT_CONST_BITS);
- u[ 5] = _mm_srai_epi32(v[ 5], DCT_CONST_BITS);
- u[ 6] = _mm_srai_epi32(v[ 6], DCT_CONST_BITS);
- u[ 7] = _mm_srai_epi32(v[ 7], DCT_CONST_BITS);
- u[ 8] = _mm_srai_epi32(v[ 8], DCT_CONST_BITS);
- u[ 9] = _mm_srai_epi32(v[ 9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
-
- v[ 0] = _mm_cmplt_epi32(u[ 0], kZero);
- v[ 1] = _mm_cmplt_epi32(u[ 1], kZero);
- v[ 2] = _mm_cmplt_epi32(u[ 2], kZero);
- v[ 3] = _mm_cmplt_epi32(u[ 3], kZero);
- v[ 4] = _mm_cmplt_epi32(u[ 4], kZero);
- v[ 5] = _mm_cmplt_epi32(u[ 5], kZero);
- v[ 6] = _mm_cmplt_epi32(u[ 6], kZero);
- v[ 7] = _mm_cmplt_epi32(u[ 7], kZero);
- v[ 8] = _mm_cmplt_epi32(u[ 8], kZero);
- v[ 9] = _mm_cmplt_epi32(u[ 9], kZero);
- v[10] = _mm_cmplt_epi32(u[10], kZero);
- v[11] = _mm_cmplt_epi32(u[11], kZero);
- v[12] = _mm_cmplt_epi32(u[12], kZero);
- v[13] = _mm_cmplt_epi32(u[13], kZero);
- v[14] = _mm_cmplt_epi32(u[14], kZero);
- v[15] = _mm_cmplt_epi32(u[15], kZero);
-
- u[ 0] = _mm_sub_epi32(u[ 0], v[ 0]);
- u[ 1] = _mm_sub_epi32(u[ 1], v[ 1]);
- u[ 2] = _mm_sub_epi32(u[ 2], v[ 2]);
- u[ 3] = _mm_sub_epi32(u[ 3], v[ 3]);
- u[ 4] = _mm_sub_epi32(u[ 4], v[ 4]);
- u[ 5] = _mm_sub_epi32(u[ 5], v[ 5]);
- u[ 6] = _mm_sub_epi32(u[ 6], v[ 6]);
- u[ 7] = _mm_sub_epi32(u[ 7], v[ 7]);
- u[ 8] = _mm_sub_epi32(u[ 8], v[ 8]);
- u[ 9] = _mm_sub_epi32(u[ 9], v[ 9]);
- u[10] = _mm_sub_epi32(u[10], v[10]);
- u[11] = _mm_sub_epi32(u[11], v[11]);
- u[12] = _mm_sub_epi32(u[12], v[12]);
- u[13] = _mm_sub_epi32(u[13], v[13]);
- u[14] = _mm_sub_epi32(u[14], v[14]);
- u[15] = _mm_sub_epi32(u[15], v[15]);
-
- v[ 0] = _mm_add_epi32(u[ 0], K32One);
- v[ 1] = _mm_add_epi32(u[ 1], K32One);
- v[ 2] = _mm_add_epi32(u[ 2], K32One);
- v[ 3] = _mm_add_epi32(u[ 3], K32One);
- v[ 4] = _mm_add_epi32(u[ 4], K32One);
- v[ 5] = _mm_add_epi32(u[ 5], K32One);
- v[ 6] = _mm_add_epi32(u[ 6], K32One);
- v[ 7] = _mm_add_epi32(u[ 7], K32One);
- v[ 8] = _mm_add_epi32(u[ 8], K32One);
- v[ 9] = _mm_add_epi32(u[ 9], K32One);
- v[10] = _mm_add_epi32(u[10], K32One);
- v[11] = _mm_add_epi32(u[11], K32One);
- v[12] = _mm_add_epi32(u[12], K32One);
- v[13] = _mm_add_epi32(u[13], K32One);
- v[14] = _mm_add_epi32(u[14], K32One);
- v[15] = _mm_add_epi32(u[15], K32One);
-
- u[ 0] = _mm_srai_epi32(v[ 0], 2);
- u[ 1] = _mm_srai_epi32(v[ 1], 2);
- u[ 2] = _mm_srai_epi32(v[ 2], 2);
- u[ 3] = _mm_srai_epi32(v[ 3], 2);
- u[ 4] = _mm_srai_epi32(v[ 4], 2);
- u[ 5] = _mm_srai_epi32(v[ 5], 2);
- u[ 6] = _mm_srai_epi32(v[ 6], 2);
- u[ 7] = _mm_srai_epi32(v[ 7], 2);
- u[ 8] = _mm_srai_epi32(v[ 8], 2);
- u[ 9] = _mm_srai_epi32(v[ 9], 2);
- u[10] = _mm_srai_epi32(v[10], 2);
- u[11] = _mm_srai_epi32(v[11], 2);
- u[12] = _mm_srai_epi32(v[12], 2);
- u[13] = _mm_srai_epi32(v[13], 2);
- u[14] = _mm_srai_epi32(v[14], 2);
- u[15] = _mm_srai_epi32(v[15], 2);
-
- out[ 2] = _mm_packs_epi32(u[0], u[1]);
- out[18] = _mm_packs_epi32(u[2], u[3]);
- out[10] = _mm_packs_epi32(u[4], u[5]);
- out[26] = _mm_packs_epi32(u[6], u[7]);
- out[ 6] = _mm_packs_epi32(u[8], u[9]);
- out[22] = _mm_packs_epi32(u[10], u[11]);
- out[14] = _mm_packs_epi32(u[12], u[13]);
- out[30] = _mm_packs_epi32(u[14], u[15]);
- }
- {
- lstep1[32] = _mm_add_epi32(lstep3[34], lstep2[32]);
- lstep1[33] = _mm_add_epi32(lstep3[35], lstep2[33]);
- lstep1[34] = _mm_sub_epi32(lstep2[32], lstep3[34]);
- lstep1[35] = _mm_sub_epi32(lstep2[33], lstep3[35]);
- lstep1[36] = _mm_sub_epi32(lstep2[38], lstep3[36]);
- lstep1[37] = _mm_sub_epi32(lstep2[39], lstep3[37]);
- lstep1[38] = _mm_add_epi32(lstep3[36], lstep2[38]);
- lstep1[39] = _mm_add_epi32(lstep3[37], lstep2[39]);
- lstep1[40] = _mm_add_epi32(lstep3[42], lstep2[40]);
- lstep1[41] = _mm_add_epi32(lstep3[43], lstep2[41]);
- lstep1[42] = _mm_sub_epi32(lstep2[40], lstep3[42]);
- lstep1[43] = _mm_sub_epi32(lstep2[41], lstep3[43]);
- lstep1[44] = _mm_sub_epi32(lstep2[46], lstep3[44]);
- lstep1[45] = _mm_sub_epi32(lstep2[47], lstep3[45]);
- lstep1[46] = _mm_add_epi32(lstep3[44], lstep2[46]);
- lstep1[47] = _mm_add_epi32(lstep3[45], lstep2[47]);
- lstep1[48] = _mm_add_epi32(lstep3[50], lstep2[48]);
- lstep1[49] = _mm_add_epi32(lstep3[51], lstep2[49]);
- lstep1[50] = _mm_sub_epi32(lstep2[48], lstep3[50]);
- lstep1[51] = _mm_sub_epi32(lstep2[49], lstep3[51]);
- lstep1[52] = _mm_sub_epi32(lstep2[54], lstep3[52]);
- lstep1[53] = _mm_sub_epi32(lstep2[55], lstep3[53]);
- lstep1[54] = _mm_add_epi32(lstep3[52], lstep2[54]);
- lstep1[55] = _mm_add_epi32(lstep3[53], lstep2[55]);
- lstep1[56] = _mm_add_epi32(lstep3[58], lstep2[56]);
- lstep1[57] = _mm_add_epi32(lstep3[59], lstep2[57]);
- lstep1[58] = _mm_sub_epi32(lstep2[56], lstep3[58]);
- lstep1[59] = _mm_sub_epi32(lstep2[57], lstep3[59]);
- lstep1[60] = _mm_sub_epi32(lstep2[62], lstep3[60]);
- lstep1[61] = _mm_sub_epi32(lstep2[63], lstep3[61]);
- lstep1[62] = _mm_add_epi32(lstep3[60], lstep2[62]);
- lstep1[63] = _mm_add_epi32(lstep3[61], lstep2[63]);
- }
- // stage 8
- {
- const __m128i k32_p31_p01 = pair_set_epi32(cospi_31_64, cospi_1_64);
- const __m128i k32_p15_p17 = pair_set_epi32(cospi_15_64, cospi_17_64);
- const __m128i k32_p23_p09 = pair_set_epi32(cospi_23_64, cospi_9_64);
- const __m128i k32_p07_p25 = pair_set_epi32(cospi_7_64, cospi_25_64);
- const __m128i k32_m25_p07 = pair_set_epi32(-cospi_25_64, cospi_7_64);
- const __m128i k32_m09_p23 = pair_set_epi32(-cospi_9_64, cospi_23_64);
- const __m128i k32_m17_p15 = pair_set_epi32(-cospi_17_64, cospi_15_64);
- const __m128i k32_m01_p31 = pair_set_epi32(-cospi_1_64, cospi_31_64);
-
- u[ 0] = _mm_unpacklo_epi32(lstep1[32], lstep1[62]);
- u[ 1] = _mm_unpackhi_epi32(lstep1[32], lstep1[62]);
- u[ 2] = _mm_unpacklo_epi32(lstep1[33], lstep1[63]);
- u[ 3] = _mm_unpackhi_epi32(lstep1[33], lstep1[63]);
- u[ 4] = _mm_unpacklo_epi32(lstep1[34], lstep1[60]);
- u[ 5] = _mm_unpackhi_epi32(lstep1[34], lstep1[60]);
- u[ 6] = _mm_unpacklo_epi32(lstep1[35], lstep1[61]);
- u[ 7] = _mm_unpackhi_epi32(lstep1[35], lstep1[61]);
- u[ 8] = _mm_unpacklo_epi32(lstep1[36], lstep1[58]);
- u[ 9] = _mm_unpackhi_epi32(lstep1[36], lstep1[58]);
- u[10] = _mm_unpacklo_epi32(lstep1[37], lstep1[59]);
- u[11] = _mm_unpackhi_epi32(lstep1[37], lstep1[59]);
- u[12] = _mm_unpacklo_epi32(lstep1[38], lstep1[56]);
- u[13] = _mm_unpackhi_epi32(lstep1[38], lstep1[56]);
- u[14] = _mm_unpacklo_epi32(lstep1[39], lstep1[57]);
- u[15] = _mm_unpackhi_epi32(lstep1[39], lstep1[57]);
-
- v[ 0] = k_madd_epi32(u[ 0], k32_p31_p01);
- v[ 1] = k_madd_epi32(u[ 1], k32_p31_p01);
- v[ 2] = k_madd_epi32(u[ 2], k32_p31_p01);
- v[ 3] = k_madd_epi32(u[ 3], k32_p31_p01);
- v[ 4] = k_madd_epi32(u[ 4], k32_p15_p17);
- v[ 5] = k_madd_epi32(u[ 5], k32_p15_p17);
- v[ 6] = k_madd_epi32(u[ 6], k32_p15_p17);
- v[ 7] = k_madd_epi32(u[ 7], k32_p15_p17);
- v[ 8] = k_madd_epi32(u[ 8], k32_p23_p09);
- v[ 9] = k_madd_epi32(u[ 9], k32_p23_p09);
- v[10] = k_madd_epi32(u[10], k32_p23_p09);
- v[11] = k_madd_epi32(u[11], k32_p23_p09);
- v[12] = k_madd_epi32(u[12], k32_p07_p25);
- v[13] = k_madd_epi32(u[13], k32_p07_p25);
- v[14] = k_madd_epi32(u[14], k32_p07_p25);
- v[15] = k_madd_epi32(u[15], k32_p07_p25);
- v[16] = k_madd_epi32(u[12], k32_m25_p07);
- v[17] = k_madd_epi32(u[13], k32_m25_p07);
- v[18] = k_madd_epi32(u[14], k32_m25_p07);
- v[19] = k_madd_epi32(u[15], k32_m25_p07);
- v[20] = k_madd_epi32(u[ 8], k32_m09_p23);
- v[21] = k_madd_epi32(u[ 9], k32_m09_p23);
- v[22] = k_madd_epi32(u[10], k32_m09_p23);
- v[23] = k_madd_epi32(u[11], k32_m09_p23);
- v[24] = k_madd_epi32(u[ 4], k32_m17_p15);
- v[25] = k_madd_epi32(u[ 5], k32_m17_p15);
- v[26] = k_madd_epi32(u[ 6], k32_m17_p15);
- v[27] = k_madd_epi32(u[ 7], k32_m17_p15);
- v[28] = k_madd_epi32(u[ 0], k32_m01_p31);
- v[29] = k_madd_epi32(u[ 1], k32_m01_p31);
- v[30] = k_madd_epi32(u[ 2], k32_m01_p31);
- v[31] = k_madd_epi32(u[ 3], k32_m01_p31);
-
- u[ 0] = k_packs_epi64(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64(v[10], v[11]);
- u[ 6] = k_packs_epi64(v[12], v[13]);
- u[ 7] = k_packs_epi64(v[14], v[15]);
- u[ 8] = k_packs_epi64(v[16], v[17]);
- u[ 9] = k_packs_epi64(v[18], v[19]);
- u[10] = k_packs_epi64(v[20], v[21]);
- u[11] = k_packs_epi64(v[22], v[23]);
- u[12] = k_packs_epi64(v[24], v[25]);
- u[13] = k_packs_epi64(v[26], v[27]);
- u[14] = k_packs_epi64(v[28], v[29]);
- u[15] = k_packs_epi64(v[30], v[31]);
-
- v[ 0] = _mm_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[ 0] = _mm_srai_epi32(v[ 0], DCT_CONST_BITS);
- u[ 1] = _mm_srai_epi32(v[ 1], DCT_CONST_BITS);
- u[ 2] = _mm_srai_epi32(v[ 2], DCT_CONST_BITS);
- u[ 3] = _mm_srai_epi32(v[ 3], DCT_CONST_BITS);
- u[ 4] = _mm_srai_epi32(v[ 4], DCT_CONST_BITS);
- u[ 5] = _mm_srai_epi32(v[ 5], DCT_CONST_BITS);
- u[ 6] = _mm_srai_epi32(v[ 6], DCT_CONST_BITS);
- u[ 7] = _mm_srai_epi32(v[ 7], DCT_CONST_BITS);
- u[ 8] = _mm_srai_epi32(v[ 8], DCT_CONST_BITS);
- u[ 9] = _mm_srai_epi32(v[ 9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
-
- v[ 0] = _mm_cmplt_epi32(u[ 0], kZero);
- v[ 1] = _mm_cmplt_epi32(u[ 1], kZero);
- v[ 2] = _mm_cmplt_epi32(u[ 2], kZero);
- v[ 3] = _mm_cmplt_epi32(u[ 3], kZero);
- v[ 4] = _mm_cmplt_epi32(u[ 4], kZero);
- v[ 5] = _mm_cmplt_epi32(u[ 5], kZero);
- v[ 6] = _mm_cmplt_epi32(u[ 6], kZero);
- v[ 7] = _mm_cmplt_epi32(u[ 7], kZero);
- v[ 8] = _mm_cmplt_epi32(u[ 8], kZero);
- v[ 9] = _mm_cmplt_epi32(u[ 9], kZero);
- v[10] = _mm_cmplt_epi32(u[10], kZero);
- v[11] = _mm_cmplt_epi32(u[11], kZero);
- v[12] = _mm_cmplt_epi32(u[12], kZero);
- v[13] = _mm_cmplt_epi32(u[13], kZero);
- v[14] = _mm_cmplt_epi32(u[14], kZero);
- v[15] = _mm_cmplt_epi32(u[15], kZero);
-
- u[ 0] = _mm_sub_epi32(u[ 0], v[ 0]);
- u[ 1] = _mm_sub_epi32(u[ 1], v[ 1]);
- u[ 2] = _mm_sub_epi32(u[ 2], v[ 2]);
- u[ 3] = _mm_sub_epi32(u[ 3], v[ 3]);
- u[ 4] = _mm_sub_epi32(u[ 4], v[ 4]);
- u[ 5] = _mm_sub_epi32(u[ 5], v[ 5]);
- u[ 6] = _mm_sub_epi32(u[ 6], v[ 6]);
- u[ 7] = _mm_sub_epi32(u[ 7], v[ 7]);
- u[ 8] = _mm_sub_epi32(u[ 8], v[ 8]);
- u[ 9] = _mm_sub_epi32(u[ 9], v[ 9]);
- u[10] = _mm_sub_epi32(u[10], v[10]);
- u[11] = _mm_sub_epi32(u[11], v[11]);
- u[12] = _mm_sub_epi32(u[12], v[12]);
- u[13] = _mm_sub_epi32(u[13], v[13]);
- u[14] = _mm_sub_epi32(u[14], v[14]);
- u[15] = _mm_sub_epi32(u[15], v[15]);
-
- v[0] = _mm_add_epi32(u[0], K32One);
- v[1] = _mm_add_epi32(u[1], K32One);
- v[2] = _mm_add_epi32(u[2], K32One);
- v[3] = _mm_add_epi32(u[3], K32One);
- v[4] = _mm_add_epi32(u[4], K32One);
- v[5] = _mm_add_epi32(u[5], K32One);
- v[6] = _mm_add_epi32(u[6], K32One);
- v[7] = _mm_add_epi32(u[7], K32One);
- v[8] = _mm_add_epi32(u[8], K32One);
- v[9] = _mm_add_epi32(u[9], K32One);
- v[10] = _mm_add_epi32(u[10], K32One);
- v[11] = _mm_add_epi32(u[11], K32One);
- v[12] = _mm_add_epi32(u[12], K32One);
- v[13] = _mm_add_epi32(u[13], K32One);
- v[14] = _mm_add_epi32(u[14], K32One);
- v[15] = _mm_add_epi32(u[15], K32One);
-
- u[0] = _mm_srai_epi32(v[0], 2);
- u[1] = _mm_srai_epi32(v[1], 2);
- u[2] = _mm_srai_epi32(v[2], 2);
- u[3] = _mm_srai_epi32(v[3], 2);
- u[4] = _mm_srai_epi32(v[4], 2);
- u[5] = _mm_srai_epi32(v[5], 2);
- u[6] = _mm_srai_epi32(v[6], 2);
- u[7] = _mm_srai_epi32(v[7], 2);
- u[8] = _mm_srai_epi32(v[8], 2);
- u[9] = _mm_srai_epi32(v[9], 2);
- u[10] = _mm_srai_epi32(v[10], 2);
- u[11] = _mm_srai_epi32(v[11], 2);
- u[12] = _mm_srai_epi32(v[12], 2);
- u[13] = _mm_srai_epi32(v[13], 2);
- u[14] = _mm_srai_epi32(v[14], 2);
- u[15] = _mm_srai_epi32(v[15], 2);
-
- out[ 1] = _mm_packs_epi32(u[0], u[1]);
- out[17] = _mm_packs_epi32(u[2], u[3]);
- out[ 9] = _mm_packs_epi32(u[4], u[5]);
- out[25] = _mm_packs_epi32(u[6], u[7]);
- out[ 7] = _mm_packs_epi32(u[8], u[9]);
- out[23] = _mm_packs_epi32(u[10], u[11]);
- out[15] = _mm_packs_epi32(u[12], u[13]);
- out[31] = _mm_packs_epi32(u[14], u[15]);
- }
- {
- const __m128i k32_p27_p05 = pair_set_epi32(cospi_27_64, cospi_5_64);
- const __m128i k32_p11_p21 = pair_set_epi32(cospi_11_64, cospi_21_64);
- const __m128i k32_p19_p13 = pair_set_epi32(cospi_19_64, cospi_13_64);
- const __m128i k32_p03_p29 = pair_set_epi32(cospi_3_64, cospi_29_64);
- const __m128i k32_m29_p03 = pair_set_epi32(-cospi_29_64, cospi_3_64);
- const __m128i k32_m13_p19 = pair_set_epi32(-cospi_13_64, cospi_19_64);
- const __m128i k32_m21_p11 = pair_set_epi32(-cospi_21_64, cospi_11_64);
- const __m128i k32_m05_p27 = pair_set_epi32(-cospi_5_64, cospi_27_64);
-
- u[ 0] = _mm_unpacklo_epi32(lstep1[40], lstep1[54]);
- u[ 1] = _mm_unpackhi_epi32(lstep1[40], lstep1[54]);
- u[ 2] = _mm_unpacklo_epi32(lstep1[41], lstep1[55]);
- u[ 3] = _mm_unpackhi_epi32(lstep1[41], lstep1[55]);
- u[ 4] = _mm_unpacklo_epi32(lstep1[42], lstep1[52]);
- u[ 5] = _mm_unpackhi_epi32(lstep1[42], lstep1[52]);
- u[ 6] = _mm_unpacklo_epi32(lstep1[43], lstep1[53]);
- u[ 7] = _mm_unpackhi_epi32(lstep1[43], lstep1[53]);
- u[ 8] = _mm_unpacklo_epi32(lstep1[44], lstep1[50]);
- u[ 9] = _mm_unpackhi_epi32(lstep1[44], lstep1[50]);
- u[10] = _mm_unpacklo_epi32(lstep1[45], lstep1[51]);
- u[11] = _mm_unpackhi_epi32(lstep1[45], lstep1[51]);
- u[12] = _mm_unpacklo_epi32(lstep1[46], lstep1[48]);
- u[13] = _mm_unpackhi_epi32(lstep1[46], lstep1[48]);
- u[14] = _mm_unpacklo_epi32(lstep1[47], lstep1[49]);
- u[15] = _mm_unpackhi_epi32(lstep1[47], lstep1[49]);
-
- v[ 0] = k_madd_epi32(u[ 0], k32_p27_p05);
- v[ 1] = k_madd_epi32(u[ 1], k32_p27_p05);
- v[ 2] = k_madd_epi32(u[ 2], k32_p27_p05);
- v[ 3] = k_madd_epi32(u[ 3], k32_p27_p05);
- v[ 4] = k_madd_epi32(u[ 4], k32_p11_p21);
- v[ 5] = k_madd_epi32(u[ 5], k32_p11_p21);
- v[ 6] = k_madd_epi32(u[ 6], k32_p11_p21);
- v[ 7] = k_madd_epi32(u[ 7], k32_p11_p21);
- v[ 8] = k_madd_epi32(u[ 8], k32_p19_p13);
- v[ 9] = k_madd_epi32(u[ 9], k32_p19_p13);
- v[10] = k_madd_epi32(u[10], k32_p19_p13);
- v[11] = k_madd_epi32(u[11], k32_p19_p13);
- v[12] = k_madd_epi32(u[12], k32_p03_p29);
- v[13] = k_madd_epi32(u[13], k32_p03_p29);
- v[14] = k_madd_epi32(u[14], k32_p03_p29);
- v[15] = k_madd_epi32(u[15], k32_p03_p29);
- v[16] = k_madd_epi32(u[12], k32_m29_p03);
- v[17] = k_madd_epi32(u[13], k32_m29_p03);
- v[18] = k_madd_epi32(u[14], k32_m29_p03);
- v[19] = k_madd_epi32(u[15], k32_m29_p03);
- v[20] = k_madd_epi32(u[ 8], k32_m13_p19);
- v[21] = k_madd_epi32(u[ 9], k32_m13_p19);
- v[22] = k_madd_epi32(u[10], k32_m13_p19);
- v[23] = k_madd_epi32(u[11], k32_m13_p19);
- v[24] = k_madd_epi32(u[ 4], k32_m21_p11);
- v[25] = k_madd_epi32(u[ 5], k32_m21_p11);
- v[26] = k_madd_epi32(u[ 6], k32_m21_p11);
- v[27] = k_madd_epi32(u[ 7], k32_m21_p11);
- v[28] = k_madd_epi32(u[ 0], k32_m05_p27);
- v[29] = k_madd_epi32(u[ 1], k32_m05_p27);
- v[30] = k_madd_epi32(u[ 2], k32_m05_p27);
- v[31] = k_madd_epi32(u[ 3], k32_m05_p27);
-
- u[ 0] = k_packs_epi64(v[ 0], v[ 1]);
- u[ 1] = k_packs_epi64(v[ 2], v[ 3]);
- u[ 2] = k_packs_epi64(v[ 4], v[ 5]);
- u[ 3] = k_packs_epi64(v[ 6], v[ 7]);
- u[ 4] = k_packs_epi64(v[ 8], v[ 9]);
- u[ 5] = k_packs_epi64(v[10], v[11]);
- u[ 6] = k_packs_epi64(v[12], v[13]);
- u[ 7] = k_packs_epi64(v[14], v[15]);
- u[ 8] = k_packs_epi64(v[16], v[17]);
- u[ 9] = k_packs_epi64(v[18], v[19]);
- u[10] = k_packs_epi64(v[20], v[21]);
- u[11] = k_packs_epi64(v[22], v[23]);
- u[12] = k_packs_epi64(v[24], v[25]);
- u[13] = k_packs_epi64(v[26], v[27]);
- u[14] = k_packs_epi64(v[28], v[29]);
- u[15] = k_packs_epi64(v[30], v[31]);
-
- v[ 0] = _mm_add_epi32(u[ 0], k__DCT_CONST_ROUNDING);
- v[ 1] = _mm_add_epi32(u[ 1], k__DCT_CONST_ROUNDING);
- v[ 2] = _mm_add_epi32(u[ 2], k__DCT_CONST_ROUNDING);
- v[ 3] = _mm_add_epi32(u[ 3], k__DCT_CONST_ROUNDING);
- v[ 4] = _mm_add_epi32(u[ 4], k__DCT_CONST_ROUNDING);
- v[ 5] = _mm_add_epi32(u[ 5], k__DCT_CONST_ROUNDING);
- v[ 6] = _mm_add_epi32(u[ 6], k__DCT_CONST_ROUNDING);
- v[ 7] = _mm_add_epi32(u[ 7], k__DCT_CONST_ROUNDING);
- v[ 8] = _mm_add_epi32(u[ 8], k__DCT_CONST_ROUNDING);
- v[ 9] = _mm_add_epi32(u[ 9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[ 0] = _mm_srai_epi32(v[ 0], DCT_CONST_BITS);
- u[ 1] = _mm_srai_epi32(v[ 1], DCT_CONST_BITS);
- u[ 2] = _mm_srai_epi32(v[ 2], DCT_CONST_BITS);
- u[ 3] = _mm_srai_epi32(v[ 3], DCT_CONST_BITS);
- u[ 4] = _mm_srai_epi32(v[ 4], DCT_CONST_BITS);
- u[ 5] = _mm_srai_epi32(v[ 5], DCT_CONST_BITS);
- u[ 6] = _mm_srai_epi32(v[ 6], DCT_CONST_BITS);
- u[ 7] = _mm_srai_epi32(v[ 7], DCT_CONST_BITS);
- u[ 8] = _mm_srai_epi32(v[ 8], DCT_CONST_BITS);
- u[ 9] = _mm_srai_epi32(v[ 9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
-
- v[ 0] = _mm_cmplt_epi32(u[ 0], kZero);
- v[ 1] = _mm_cmplt_epi32(u[ 1], kZero);
- v[ 2] = _mm_cmplt_epi32(u[ 2], kZero);
- v[ 3] = _mm_cmplt_epi32(u[ 3], kZero);
- v[ 4] = _mm_cmplt_epi32(u[ 4], kZero);
- v[ 5] = _mm_cmplt_epi32(u[ 5], kZero);
- v[ 6] = _mm_cmplt_epi32(u[ 6], kZero);
- v[ 7] = _mm_cmplt_epi32(u[ 7], kZero);
- v[ 8] = _mm_cmplt_epi32(u[ 8], kZero);
- v[ 9] = _mm_cmplt_epi32(u[ 9], kZero);
- v[10] = _mm_cmplt_epi32(u[10], kZero);
- v[11] = _mm_cmplt_epi32(u[11], kZero);
- v[12] = _mm_cmplt_epi32(u[12], kZero);
- v[13] = _mm_cmplt_epi32(u[13], kZero);
- v[14] = _mm_cmplt_epi32(u[14], kZero);
- v[15] = _mm_cmplt_epi32(u[15], kZero);
-
- u[ 0] = _mm_sub_epi32(u[ 0], v[ 0]);
- u[ 1] = _mm_sub_epi32(u[ 1], v[ 1]);
- u[ 2] = _mm_sub_epi32(u[ 2], v[ 2]);
- u[ 3] = _mm_sub_epi32(u[ 3], v[ 3]);
- u[ 4] = _mm_sub_epi32(u[ 4], v[ 4]);
- u[ 5] = _mm_sub_epi32(u[ 5], v[ 5]);
- u[ 6] = _mm_sub_epi32(u[ 6], v[ 6]);
- u[ 7] = _mm_sub_epi32(u[ 7], v[ 7]);
- u[ 8] = _mm_sub_epi32(u[ 8], v[ 8]);
- u[ 9] = _mm_sub_epi32(u[ 9], v[ 9]);
- u[10] = _mm_sub_epi32(u[10], v[10]);
- u[11] = _mm_sub_epi32(u[11], v[11]);
- u[12] = _mm_sub_epi32(u[12], v[12]);
- u[13] = _mm_sub_epi32(u[13], v[13]);
- u[14] = _mm_sub_epi32(u[14], v[14]);
- u[15] = _mm_sub_epi32(u[15], v[15]);
-
- v[0] = _mm_add_epi32(u[0], K32One);
- v[1] = _mm_add_epi32(u[1], K32One);
- v[2] = _mm_add_epi32(u[2], K32One);
- v[3] = _mm_add_epi32(u[3], K32One);
- v[4] = _mm_add_epi32(u[4], K32One);
- v[5] = _mm_add_epi32(u[5], K32One);
- v[6] = _mm_add_epi32(u[6], K32One);
- v[7] = _mm_add_epi32(u[7], K32One);
- v[8] = _mm_add_epi32(u[8], K32One);
- v[9] = _mm_add_epi32(u[9], K32One);
- v[10] = _mm_add_epi32(u[10], K32One);
- v[11] = _mm_add_epi32(u[11], K32One);
- v[12] = _mm_add_epi32(u[12], K32One);
- v[13] = _mm_add_epi32(u[13], K32One);
- v[14] = _mm_add_epi32(u[14], K32One);
- v[15] = _mm_add_epi32(u[15], K32One);
-
- u[0] = _mm_srai_epi32(v[0], 2);
- u[1] = _mm_srai_epi32(v[1], 2);
- u[2] = _mm_srai_epi32(v[2], 2);
- u[3] = _mm_srai_epi32(v[3], 2);
- u[4] = _mm_srai_epi32(v[4], 2);
- u[5] = _mm_srai_epi32(v[5], 2);
- u[6] = _mm_srai_epi32(v[6], 2);
- u[7] = _mm_srai_epi32(v[7], 2);
- u[8] = _mm_srai_epi32(v[8], 2);
- u[9] = _mm_srai_epi32(v[9], 2);
- u[10] = _mm_srai_epi32(v[10], 2);
- u[11] = _mm_srai_epi32(v[11], 2);
- u[12] = _mm_srai_epi32(v[12], 2);
- u[13] = _mm_srai_epi32(v[13], 2);
- u[14] = _mm_srai_epi32(v[14], 2);
- u[15] = _mm_srai_epi32(v[15], 2);
-
- out[ 5] = _mm_packs_epi32(u[0], u[1]);
- out[21] = _mm_packs_epi32(u[2], u[3]);
- out[13] = _mm_packs_epi32(u[4], u[5]);
- out[29] = _mm_packs_epi32(u[6], u[7]);
- out[ 3] = _mm_packs_epi32(u[8], u[9]);
- out[19] = _mm_packs_epi32(u[10], u[11]);
- out[11] = _mm_packs_epi32(u[12], u[13]);
- out[27] = _mm_packs_epi32(u[14], u[15]);
- }
- }
-#endif
- // Transpose the results, do it as four 8x8 transposes.
- {
- int transpose_block;
- int16_t *output;
- if (0 == pass) {
- output = &intermediate[column_start * 32];
- } else {
- output = &output_org[column_start * 32];
- }
- for (transpose_block = 0; transpose_block < 4; ++transpose_block) {
- __m128i *this_out = &out[8 * transpose_block];
- // 00 01 02 03 04 05 06 07
- // 10 11 12 13 14 15 16 17
- // 20 21 22 23 24 25 26 27
- // 30 31 32 33 34 35 36 37
- // 40 41 42 43 44 45 46 47
- // 50 51 52 53 54 55 56 57
- // 60 61 62 63 64 65 66 67
- // 70 71 72 73 74 75 76 77
- const __m128i tr0_0 = _mm_unpacklo_epi16(this_out[0], this_out[1]);
- const __m128i tr0_1 = _mm_unpacklo_epi16(this_out[2], this_out[3]);
- const __m128i tr0_2 = _mm_unpackhi_epi16(this_out[0], this_out[1]);
- const __m128i tr0_3 = _mm_unpackhi_epi16(this_out[2], this_out[3]);
- const __m128i tr0_4 = _mm_unpacklo_epi16(this_out[4], this_out[5]);
- const __m128i tr0_5 = _mm_unpacklo_epi16(this_out[6], this_out[7]);
- const __m128i tr0_6 = _mm_unpackhi_epi16(this_out[4], this_out[5]);
- const __m128i tr0_7 = _mm_unpackhi_epi16(this_out[6], this_out[7]);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 54 54 55 55 56 56 57 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 21 36
- // 44 54 64 74 45 55 61 76
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- __m128i tr2_0 = _mm_unpacklo_epi64(tr1_0, tr1_4);
- __m128i tr2_1 = _mm_unpackhi_epi64(tr1_0, tr1_4);
- __m128i tr2_2 = _mm_unpacklo_epi64(tr1_2, tr1_6);
- __m128i tr2_3 = _mm_unpackhi_epi64(tr1_2, tr1_6);
- __m128i tr2_4 = _mm_unpacklo_epi64(tr1_1, tr1_5);
- __m128i tr2_5 = _mm_unpackhi_epi64(tr1_1, tr1_5);
- __m128i tr2_6 = _mm_unpacklo_epi64(tr1_3, tr1_7);
- __m128i tr2_7 = _mm_unpackhi_epi64(tr1_3, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
- if (0 == pass) {
- // output[j] = (output[j] + 1 + (output[j] > 0)) >> 2;
- // TODO(cd): see quality impact of only doing
- // output[j] = (output[j] + 1) >> 2;
- // which would remove the code between here ...
- __m128i tr2_0_0 = _mm_cmpgt_epi16(tr2_0, kZero);
- __m128i tr2_1_0 = _mm_cmpgt_epi16(tr2_1, kZero);
- __m128i tr2_2_0 = _mm_cmpgt_epi16(tr2_2, kZero);
- __m128i tr2_3_0 = _mm_cmpgt_epi16(tr2_3, kZero);
- __m128i tr2_4_0 = _mm_cmpgt_epi16(tr2_4, kZero);
- __m128i tr2_5_0 = _mm_cmpgt_epi16(tr2_5, kZero);
- __m128i tr2_6_0 = _mm_cmpgt_epi16(tr2_6, kZero);
- __m128i tr2_7_0 = _mm_cmpgt_epi16(tr2_7, kZero);
- tr2_0 = _mm_sub_epi16(tr2_0, tr2_0_0);
- tr2_1 = _mm_sub_epi16(tr2_1, tr2_1_0);
- tr2_2 = _mm_sub_epi16(tr2_2, tr2_2_0);
- tr2_3 = _mm_sub_epi16(tr2_3, tr2_3_0);
- tr2_4 = _mm_sub_epi16(tr2_4, tr2_4_0);
- tr2_5 = _mm_sub_epi16(tr2_5, tr2_5_0);
- tr2_6 = _mm_sub_epi16(tr2_6, tr2_6_0);
- tr2_7 = _mm_sub_epi16(tr2_7, tr2_7_0);
- // ... and here.
- // PS: also change code in vp9/encoder/vp9_dct.c
- tr2_0 = _mm_add_epi16(tr2_0, kOne);
- tr2_1 = _mm_add_epi16(tr2_1, kOne);
- tr2_2 = _mm_add_epi16(tr2_2, kOne);
- tr2_3 = _mm_add_epi16(tr2_3, kOne);
- tr2_4 = _mm_add_epi16(tr2_4, kOne);
- tr2_5 = _mm_add_epi16(tr2_5, kOne);
- tr2_6 = _mm_add_epi16(tr2_6, kOne);
- tr2_7 = _mm_add_epi16(tr2_7, kOne);
- tr2_0 = _mm_srai_epi16(tr2_0, 2);
- tr2_1 = _mm_srai_epi16(tr2_1, 2);
- tr2_2 = _mm_srai_epi16(tr2_2, 2);
- tr2_3 = _mm_srai_epi16(tr2_3, 2);
- tr2_4 = _mm_srai_epi16(tr2_4, 2);
- tr2_5 = _mm_srai_epi16(tr2_5, 2);
- tr2_6 = _mm_srai_epi16(tr2_6, 2);
- tr2_7 = _mm_srai_epi16(tr2_7, 2);
- }
- // Note: even though all these stores are aligned, using the aligned
- // intrinsic make the code slightly slower.
- _mm_storeu_si128((__m128i *)(output + 0 * 32), tr2_0);
- _mm_storeu_si128((__m128i *)(output + 1 * 32), tr2_1);
- _mm_storeu_si128((__m128i *)(output + 2 * 32), tr2_2);
- _mm_storeu_si128((__m128i *)(output + 3 * 32), tr2_3);
- _mm_storeu_si128((__m128i *)(output + 4 * 32), tr2_4);
- _mm_storeu_si128((__m128i *)(output + 5 * 32), tr2_5);
- _mm_storeu_si128((__m128i *)(output + 6 * 32), tr2_6);
- _mm_storeu_si128((__m128i *)(output + 7 * 32), tr2_7);
- // Process next 8x8
- output += 8;
- }
- }
- }
- }
-} // NOLINT
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_avx2.c
deleted file mode 100644
index b5269ed..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_avx2.c
+++ /dev/null
@@ -1,2592 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <immintrin.h> // AVX2
-#include "vp9/common/vp9_idct.h" // for cospi constants
-#include "vpx_ports/mem.h"
-
-void vp9_fdct4x4_avx2(const int16_t *input, int16_t *output, int stride) {
- // The 2D transform is done with two passes which are actually pretty
- // similar. In the first one, we transform the columns and transpose
- // the results. In the second one, we transform the rows. To achieve that,
- // as the first pass results are transposed, we transpose the columns (that
- // is the transposed rows) and transpose the results (so that it goes back
- // in normal/row positions).
- int pass;
- // Constants
- // When we use them, in one case, they are all the same. In all others
- // it's a pair of them that we need to repeat four times. This is done
- // by constructing the 32 bit constant corresponding to that pair.
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i k__nonzero_bias_a = _mm_setr_epi16(0, 1, 1, 1, 1, 1, 1, 1);
- const __m128i k__nonzero_bias_b = _mm_setr_epi16(1, 0, 0, 0, 0, 0, 0, 0);
- const __m128i kOne = _mm_set1_epi16(1);
- __m128i in0, in1, in2, in3;
- // Load inputs.
- {
- in0 = _mm_loadl_epi64((const __m128i *)(input + 0 * stride));
- in1 = _mm_loadl_epi64((const __m128i *)(input + 1 * stride));
- in2 = _mm_loadl_epi64((const __m128i *)(input + 2 * stride));
- in3 = _mm_loadl_epi64((const __m128i *)(input + 3 * stride));
- // x = x << 4
- in0 = _mm_slli_epi16(in0, 4);
- in1 = _mm_slli_epi16(in1, 4);
- in2 = _mm_slli_epi16(in2, 4);
- in3 = _mm_slli_epi16(in3, 4);
- // if (i == 0 && input[0]) input[0] += 1;
- {
- // The mask will only contain whether the first value is zero, all
- // other comparison will fail as something shifted by 4 (above << 4)
- // can never be equal to one. To increment in the non-zero case, we
- // add the mask and one for the first element:
- // - if zero, mask = -1, v = v - 1 + 1 = v
- // - if non-zero, mask = 0, v = v + 0 + 1 = v + 1
- __m128i mask = _mm_cmpeq_epi16(in0, k__nonzero_bias_a);
- in0 = _mm_add_epi16(in0, mask);
- in0 = _mm_add_epi16(in0, k__nonzero_bias_b);
- }
- }
- // Do the two transform/transpose passes
- for (pass = 0; pass < 2; ++pass) {
- // Transform 1/2: Add/subtract
- const __m128i r0 = _mm_add_epi16(in0, in3);
- const __m128i r1 = _mm_add_epi16(in1, in2);
- const __m128i r2 = _mm_sub_epi16(in1, in2);
- const __m128i r3 = _mm_sub_epi16(in0, in3);
- // Transform 1/2: Interleave to do the multiply by constants which gets us
- // into 32 bits.
- const __m128i t0 = _mm_unpacklo_epi16(r0, r1);
- const __m128i t2 = _mm_unpacklo_epi16(r2, r3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_p16);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_p16_m16);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p24_p08);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m08_p24);
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- // Combine and transpose
- const __m128i res0 = _mm_packs_epi32(w0, w2);
- const __m128i res1 = _mm_packs_epi32(w4, w6);
- // 00 01 02 03 20 21 22 23
- // 10 11 12 13 30 31 32 33
- const __m128i tr0_0 = _mm_unpacklo_epi16(res0, res1);
- const __m128i tr0_1 = _mm_unpackhi_epi16(res0, res1);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- in0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- in2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- // 00 10 20 30 01 11 21 31 in0 contains 0 followed by 1
- // 02 12 22 32 03 13 23 33 in2 contains 2 followed by 3
- if (0 == pass) {
- // Extract values in the high part for second pass as transform code
- // only uses the first four values.
- in1 = _mm_unpackhi_epi64(in0, in0);
- in3 = _mm_unpackhi_epi64(in2, in2);
- } else {
- // Post-condition output and store it (v + 1) >> 2, taking advantage
- // of the fact 1/3 are stored just after 0/2.
- __m128i out01 = _mm_add_epi16(in0, kOne);
- __m128i out23 = _mm_add_epi16(in2, kOne);
- out01 = _mm_srai_epi16(out01, 2);
- out23 = _mm_srai_epi16(out23, 2);
- _mm_storeu_si128((__m128i *)(output + 0 * 4), out01);
- _mm_storeu_si128((__m128i *)(output + 2 * 4), out23);
- }
- }
-}
-
-static INLINE void load_buffer_4x4_avx2(const int16_t *input, __m128i *in,
- int stride) {
- const __m128i k__nonzero_bias_a = _mm_setr_epi16(0, 1, 1, 1, 1, 1, 1, 1);
- const __m128i k__nonzero_bias_b = _mm_setr_epi16(1, 0, 0, 0, 0, 0, 0, 0);
- __m128i mask;
-
- in[0] = _mm_loadl_epi64((const __m128i *)(input + 0 * stride));
- in[1] = _mm_loadl_epi64((const __m128i *)(input + 1 * stride));
- in[2] = _mm_loadl_epi64((const __m128i *)(input + 2 * stride));
- in[3] = _mm_loadl_epi64((const __m128i *)(input + 3 * stride));
-
- in[0] = _mm_slli_epi16(in[0], 4);
- in[1] = _mm_slli_epi16(in[1], 4);
- in[2] = _mm_slli_epi16(in[2], 4);
- in[3] = _mm_slli_epi16(in[3], 4);
-
- mask = _mm_cmpeq_epi16(in[0], k__nonzero_bias_a);
- in[0] = _mm_add_epi16(in[0], mask);
- in[0] = _mm_add_epi16(in[0], k__nonzero_bias_b);
-}
-
-static INLINE void write_buffer_4x4_avx2(int16_t *output, __m128i *res) {
- const __m128i kOne = _mm_set1_epi16(1);
- __m128i in01 = _mm_unpacklo_epi64(res[0], res[1]);
- __m128i in23 = _mm_unpacklo_epi64(res[2], res[3]);
- __m128i out01 = _mm_add_epi16(in01, kOne);
- __m128i out23 = _mm_add_epi16(in23, kOne);
- out01 = _mm_srai_epi16(out01, 2);
- out23 = _mm_srai_epi16(out23, 2);
- _mm_store_si128((__m128i *)(output + 0 * 8), out01);
- _mm_store_si128((__m128i *)(output + 1 * 8), out23);
-}
-
-static INLINE void transpose_4x4_avx2(__m128i *res) {
- // Combine and transpose
- // 00 01 02 03 20 21 22 23
- // 10 11 12 13 30 31 32 33
- const __m128i tr0_0 = _mm_unpacklo_epi16(res[0], res[1]);
- const __m128i tr0_1 = _mm_unpackhi_epi16(res[0], res[1]);
-
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- res[0] = _mm_unpacklo_epi32(tr0_0, tr0_1);
- res[2] = _mm_unpackhi_epi32(tr0_0, tr0_1);
-
- // 00 10 20 30 01 11 21 31
- // 02 12 22 32 03 13 23 33
- // only use the first 4 16-bit integers
- res[1] = _mm_unpackhi_epi64(res[0], res[0]);
- res[3] = _mm_unpackhi_epi64(res[2], res[2]);
-}
-
-void fdct4_avx2(__m128i *in) {
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
-
- __m128i u[4], v[4];
- u[0]=_mm_unpacklo_epi16(in[0], in[1]);
- u[1]=_mm_unpacklo_epi16(in[3], in[2]);
-
- v[0] = _mm_add_epi16(u[0], u[1]);
- v[1] = _mm_sub_epi16(u[0], u[1]);
-
- u[0] = _mm_madd_epi16(v[0], k__cospi_p16_p16); // 0
- u[1] = _mm_madd_epi16(v[0], k__cospi_p16_m16); // 2
- u[2] = _mm_madd_epi16(v[1], k__cospi_p08_p24); // 1
- u[3] = _mm_madd_epi16(v[1], k__cospi_p24_m08); // 3
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u[0], u[1]);
- in[1] = _mm_packs_epi32(u[2], u[3]);
- transpose_4x4_avx2(in);
-}
-
-void fadst4_avx2(__m128i *in) {
- const __m128i k__sinpi_p01_p02 = pair_set_epi16(sinpi_1_9, sinpi_2_9);
- const __m128i k__sinpi_p04_m01 = pair_set_epi16(sinpi_4_9, -sinpi_1_9);
- const __m128i k__sinpi_p03_p04 = pair_set_epi16(sinpi_3_9, sinpi_4_9);
- const __m128i k__sinpi_m03_p02 = pair_set_epi16(-sinpi_3_9, sinpi_2_9);
- const __m128i k__sinpi_p03_p03 = _mm_set1_epi16(sinpi_3_9);
- const __m128i kZero = _mm_set1_epi16(0);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i u[8], v[8];
- __m128i in7 = _mm_add_epi16(in[0], in[1]);
-
- u[0] = _mm_unpacklo_epi16(in[0], in[1]);
- u[1] = _mm_unpacklo_epi16(in[2], in[3]);
- u[2] = _mm_unpacklo_epi16(in7, kZero);
- u[3] = _mm_unpacklo_epi16(in[2], kZero);
- u[4] = _mm_unpacklo_epi16(in[3], kZero);
-
- v[0] = _mm_madd_epi16(u[0], k__sinpi_p01_p02); // s0 + s2
- v[1] = _mm_madd_epi16(u[1], k__sinpi_p03_p04); // s4 + s5
- v[2] = _mm_madd_epi16(u[2], k__sinpi_p03_p03); // x1
- v[3] = _mm_madd_epi16(u[0], k__sinpi_p04_m01); // s1 - s3
- v[4] = _mm_madd_epi16(u[1], k__sinpi_m03_p02); // -s4 + s6
- v[5] = _mm_madd_epi16(u[3], k__sinpi_p03_p03); // s4
- v[6] = _mm_madd_epi16(u[4], k__sinpi_p03_p03);
-
- u[0] = _mm_add_epi32(v[0], v[1]);
- u[1] = _mm_sub_epi32(v[2], v[6]);
- u[2] = _mm_add_epi32(v[3], v[4]);
- u[3] = _mm_sub_epi32(u[2], u[0]);
- u[4] = _mm_slli_epi32(v[5], 2);
- u[5] = _mm_sub_epi32(u[4], v[5]);
- u[6] = _mm_add_epi32(u[3], u[5]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u[0], u[2]);
- in[1] = _mm_packs_epi32(u[1], u[3]);
- transpose_4x4_avx2(in);
-}
-
-void vp9_fht4x4_avx2(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- __m128i in[4];
-
- switch (tx_type) {
- case DCT_DCT:
- vp9_fdct4x4_avx2(input, output, stride);
- break;
- case ADST_DCT:
- load_buffer_4x4_avx2(input, in, stride);
- fadst4_avx2(in);
- fdct4_avx2(in);
- write_buffer_4x4_avx2(output, in);
- break;
- case DCT_ADST:
- load_buffer_4x4_avx2(input, in, stride);
- fdct4_avx2(in);
- fadst4_avx2(in);
- write_buffer_4x4_avx2(output, in);
- break;
- case ADST_ADST:
- load_buffer_4x4_avx2(input, in, stride);
- fadst4_avx2(in);
- fadst4_avx2(in);
- write_buffer_4x4_avx2(output, in);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-void vp9_fdct8x8_avx2(const int16_t *input, int16_t *output, int stride) {
- int pass;
- // Constants
- // When we use them, in one case, they are all the same. In all others
- // it's a pair of them that we need to repeat four times. This is done
- // by constructing the 32 bit constant corresponding to that pair.
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- // Load input
- __m128i in0 = _mm_load_si128((const __m128i *)(input + 0 * stride));
- __m128i in1 = _mm_load_si128((const __m128i *)(input + 1 * stride));
- __m128i in2 = _mm_load_si128((const __m128i *)(input + 2 * stride));
- __m128i in3 = _mm_load_si128((const __m128i *)(input + 3 * stride));
- __m128i in4 = _mm_load_si128((const __m128i *)(input + 4 * stride));
- __m128i in5 = _mm_load_si128((const __m128i *)(input + 5 * stride));
- __m128i in6 = _mm_load_si128((const __m128i *)(input + 6 * stride));
- __m128i in7 = _mm_load_si128((const __m128i *)(input + 7 * stride));
- // Pre-condition input (shift by two)
- in0 = _mm_slli_epi16(in0, 2);
- in1 = _mm_slli_epi16(in1, 2);
- in2 = _mm_slli_epi16(in2, 2);
- in3 = _mm_slli_epi16(in3, 2);
- in4 = _mm_slli_epi16(in4, 2);
- in5 = _mm_slli_epi16(in5, 2);
- in6 = _mm_slli_epi16(in6, 2);
- in7 = _mm_slli_epi16(in7, 2);
-
- // We do two passes, first the columns, then the rows. The results of the
- // first pass are transposed so that the same column code can be reused. The
- // results of the second pass are also transposed so that the rows (processed
- // as columns) are put back in row positions.
- for (pass = 0; pass < 2; pass++) {
- // To store results of each pass before the transpose.
- __m128i res0, res1, res2, res3, res4, res5, res6, res7;
- // Add/subtract
- const __m128i q0 = _mm_add_epi16(in0, in7);
- const __m128i q1 = _mm_add_epi16(in1, in6);
- const __m128i q2 = _mm_add_epi16(in2, in5);
- const __m128i q3 = _mm_add_epi16(in3, in4);
- const __m128i q4 = _mm_sub_epi16(in3, in4);
- const __m128i q5 = _mm_sub_epi16(in2, in5);
- const __m128i q6 = _mm_sub_epi16(in1, in6);
- const __m128i q7 = _mm_sub_epi16(in0, in7);
- // Work on first four results
- {
- // Add/subtract
- const __m128i r0 = _mm_add_epi16(q0, q3);
- const __m128i r1 = _mm_add_epi16(q1, q2);
- const __m128i r2 = _mm_sub_epi16(q1, q2);
- const __m128i r3 = _mm_sub_epi16(q0, q3);
- // Interleave to do the multiply by constants which gets us into 32bits
- const __m128i t0 = _mm_unpacklo_epi16(r0, r1);
- const __m128i t1 = _mm_unpackhi_epi16(r0, r1);
- const __m128i t2 = _mm_unpacklo_epi16(r2, r3);
- const __m128i t3 = _mm_unpackhi_epi16(r2, r3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_p16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_p16);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_p16_m16);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_p16_m16);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p24_p08);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p24_p08);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m08_p24);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res0 = _mm_packs_epi32(w0, w1);
- res4 = _mm_packs_epi32(w2, w3);
- res2 = _mm_packs_epi32(w4, w5);
- res6 = _mm_packs_epi32(w6, w7);
- }
- // Work on next four results
- {
- // Interleave to do the multiply by constants which gets us into 32bits
- const __m128i d0 = _mm_unpacklo_epi16(q6, q5);
- const __m128i d1 = _mm_unpackhi_epi16(q6, q5);
- const __m128i e0 = _mm_madd_epi16(d0, k__cospi_p16_m16);
- const __m128i e1 = _mm_madd_epi16(d1, k__cospi_p16_m16);
- const __m128i e2 = _mm_madd_epi16(d0, k__cospi_p16_p16);
- const __m128i e3 = _mm_madd_epi16(d1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i f0 = _mm_add_epi32(e0, k__DCT_CONST_ROUNDING);
- const __m128i f1 = _mm_add_epi32(e1, k__DCT_CONST_ROUNDING);
- const __m128i f2 = _mm_add_epi32(e2, k__DCT_CONST_ROUNDING);
- const __m128i f3 = _mm_add_epi32(e3, k__DCT_CONST_ROUNDING);
- const __m128i s0 = _mm_srai_epi32(f0, DCT_CONST_BITS);
- const __m128i s1 = _mm_srai_epi32(f1, DCT_CONST_BITS);
- const __m128i s2 = _mm_srai_epi32(f2, DCT_CONST_BITS);
- const __m128i s3 = _mm_srai_epi32(f3, DCT_CONST_BITS);
- // Combine
- const __m128i r0 = _mm_packs_epi32(s0, s1);
- const __m128i r1 = _mm_packs_epi32(s2, s3);
- // Add/subtract
- const __m128i x0 = _mm_add_epi16(q4, r0);
- const __m128i x1 = _mm_sub_epi16(q4, r0);
- const __m128i x2 = _mm_sub_epi16(q7, r1);
- const __m128i x3 = _mm_add_epi16(q7, r1);
- // Interleave to do the multiply by constants which gets us into 32bits
- const __m128i t0 = _mm_unpacklo_epi16(x0, x3);
- const __m128i t1 = _mm_unpackhi_epi16(x0, x3);
- const __m128i t2 = _mm_unpacklo_epi16(x1, x2);
- const __m128i t3 = _mm_unpackhi_epi16(x1, x2);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p28_p04);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p28_p04);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_m04_p28);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_m04_p28);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p12_p20);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p12_p20);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m20_p12);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m20_p12);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res1 = _mm_packs_epi32(w0, w1);
- res7 = _mm_packs_epi32(w2, w3);
- res5 = _mm_packs_epi32(w4, w5);
- res3 = _mm_packs_epi32(w6, w7);
- }
- // Transpose the 8x8.
- {
- // 00 01 02 03 04 05 06 07
- // 10 11 12 13 14 15 16 17
- // 20 21 22 23 24 25 26 27
- // 30 31 32 33 34 35 36 37
- // 40 41 42 43 44 45 46 47
- // 50 51 52 53 54 55 56 57
- // 60 61 62 63 64 65 66 67
- // 70 71 72 73 74 75 76 77
- const __m128i tr0_0 = _mm_unpacklo_epi16(res0, res1);
- const __m128i tr0_1 = _mm_unpacklo_epi16(res2, res3);
- const __m128i tr0_2 = _mm_unpackhi_epi16(res0, res1);
- const __m128i tr0_3 = _mm_unpackhi_epi16(res2, res3);
- const __m128i tr0_4 = _mm_unpacklo_epi16(res4, res5);
- const __m128i tr0_5 = _mm_unpacklo_epi16(res6, res7);
- const __m128i tr0_6 = _mm_unpackhi_epi16(res4, res5);
- const __m128i tr0_7 = _mm_unpackhi_epi16(res6, res7);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 54 54 55 55 56 56 57 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 21 36
- // 44 54 64 74 45 55 61 76
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- in0 = _mm_unpacklo_epi64(tr1_0, tr1_4);
- in1 = _mm_unpackhi_epi64(tr1_0, tr1_4);
- in2 = _mm_unpacklo_epi64(tr1_2, tr1_6);
- in3 = _mm_unpackhi_epi64(tr1_2, tr1_6);
- in4 = _mm_unpacklo_epi64(tr1_1, tr1_5);
- in5 = _mm_unpackhi_epi64(tr1_1, tr1_5);
- in6 = _mm_unpacklo_epi64(tr1_3, tr1_7);
- in7 = _mm_unpackhi_epi64(tr1_3, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
- }
- }
- // Post-condition output and store it
- {
- // Post-condition (division by two)
- // division of two 16 bits signed numbers using shifts
- // n / 2 = (n - (n >> 15)) >> 1
- const __m128i sign_in0 = _mm_srai_epi16(in0, 15);
- const __m128i sign_in1 = _mm_srai_epi16(in1, 15);
- const __m128i sign_in2 = _mm_srai_epi16(in2, 15);
- const __m128i sign_in3 = _mm_srai_epi16(in3, 15);
- const __m128i sign_in4 = _mm_srai_epi16(in4, 15);
- const __m128i sign_in5 = _mm_srai_epi16(in5, 15);
- const __m128i sign_in6 = _mm_srai_epi16(in6, 15);
- const __m128i sign_in7 = _mm_srai_epi16(in7, 15);
- in0 = _mm_sub_epi16(in0, sign_in0);
- in1 = _mm_sub_epi16(in1, sign_in1);
- in2 = _mm_sub_epi16(in2, sign_in2);
- in3 = _mm_sub_epi16(in3, sign_in3);
- in4 = _mm_sub_epi16(in4, sign_in4);
- in5 = _mm_sub_epi16(in5, sign_in5);
- in6 = _mm_sub_epi16(in6, sign_in6);
- in7 = _mm_sub_epi16(in7, sign_in7);
- in0 = _mm_srai_epi16(in0, 1);
- in1 = _mm_srai_epi16(in1, 1);
- in2 = _mm_srai_epi16(in2, 1);
- in3 = _mm_srai_epi16(in3, 1);
- in4 = _mm_srai_epi16(in4, 1);
- in5 = _mm_srai_epi16(in5, 1);
- in6 = _mm_srai_epi16(in6, 1);
- in7 = _mm_srai_epi16(in7, 1);
- // store results
- _mm_store_si128((__m128i *)(output + 0 * 8), in0);
- _mm_store_si128((__m128i *)(output + 1 * 8), in1);
- _mm_store_si128((__m128i *)(output + 2 * 8), in2);
- _mm_store_si128((__m128i *)(output + 3 * 8), in3);
- _mm_store_si128((__m128i *)(output + 4 * 8), in4);
- _mm_store_si128((__m128i *)(output + 5 * 8), in5);
- _mm_store_si128((__m128i *)(output + 6 * 8), in6);
- _mm_store_si128((__m128i *)(output + 7 * 8), in7);
- }
-}
-
-// load 8x8 array
-static INLINE void load_buffer_8x8_avx2(const int16_t *input, __m128i *in,
- int stride) {
- in[0] = _mm_load_si128((const __m128i *)(input + 0 * stride));
- in[1] = _mm_load_si128((const __m128i *)(input + 1 * stride));
- in[2] = _mm_load_si128((const __m128i *)(input + 2 * stride));
- in[3] = _mm_load_si128((const __m128i *)(input + 3 * stride));
- in[4] = _mm_load_si128((const __m128i *)(input + 4 * stride));
- in[5] = _mm_load_si128((const __m128i *)(input + 5 * stride));
- in[6] = _mm_load_si128((const __m128i *)(input + 6 * stride));
- in[7] = _mm_load_si128((const __m128i *)(input + 7 * stride));
-
- in[0] = _mm_slli_epi16(in[0], 2);
- in[1] = _mm_slli_epi16(in[1], 2);
- in[2] = _mm_slli_epi16(in[2], 2);
- in[3] = _mm_slli_epi16(in[3], 2);
- in[4] = _mm_slli_epi16(in[4], 2);
- in[5] = _mm_slli_epi16(in[5], 2);
- in[6] = _mm_slli_epi16(in[6], 2);
- in[7] = _mm_slli_epi16(in[7], 2);
-}
-
-// right shift and rounding
-static INLINE void right_shift_8x8_avx2(__m128i *res, int const bit) {
- const __m128i kOne = _mm_set1_epi16(1);
- const int bit_m02 = bit - 2;
- __m128i sign0 = _mm_srai_epi16(res[0], 15);
- __m128i sign1 = _mm_srai_epi16(res[1], 15);
- __m128i sign2 = _mm_srai_epi16(res[2], 15);
- __m128i sign3 = _mm_srai_epi16(res[3], 15);
- __m128i sign4 = _mm_srai_epi16(res[4], 15);
- __m128i sign5 = _mm_srai_epi16(res[5], 15);
- __m128i sign6 = _mm_srai_epi16(res[6], 15);
- __m128i sign7 = _mm_srai_epi16(res[7], 15);
-
- if (bit_m02 >= 0) {
- __m128i k_const_rounding = _mm_slli_epi16(kOne, bit_m02);
- res[0] = _mm_add_epi16(res[0], k_const_rounding);
- res[1] = _mm_add_epi16(res[1], k_const_rounding);
- res[2] = _mm_add_epi16(res[2], k_const_rounding);
- res[3] = _mm_add_epi16(res[3], k_const_rounding);
- res[4] = _mm_add_epi16(res[4], k_const_rounding);
- res[5] = _mm_add_epi16(res[5], k_const_rounding);
- res[6] = _mm_add_epi16(res[6], k_const_rounding);
- res[7] = _mm_add_epi16(res[7], k_const_rounding);
- }
-
- res[0] = _mm_sub_epi16(res[0], sign0);
- res[1] = _mm_sub_epi16(res[1], sign1);
- res[2] = _mm_sub_epi16(res[2], sign2);
- res[3] = _mm_sub_epi16(res[3], sign3);
- res[4] = _mm_sub_epi16(res[4], sign4);
- res[5] = _mm_sub_epi16(res[5], sign5);
- res[6] = _mm_sub_epi16(res[6], sign6);
- res[7] = _mm_sub_epi16(res[7], sign7);
-
- res[0] = _mm_srai_epi16(res[0], bit);
- res[1] = _mm_srai_epi16(res[1], bit);
- res[2] = _mm_srai_epi16(res[2], bit);
- res[3] = _mm_srai_epi16(res[3], bit);
- res[4] = _mm_srai_epi16(res[4], bit);
- res[5] = _mm_srai_epi16(res[5], bit);
- res[6] = _mm_srai_epi16(res[6], bit);
- res[7] = _mm_srai_epi16(res[7], bit);
-}
-
-// write 8x8 array
-static INLINE void write_buffer_8x8_avx2(int16_t *output, __m128i *res, int stride) {
- _mm_store_si128((__m128i *)(output + 0 * stride), res[0]);
- _mm_store_si128((__m128i *)(output + 1 * stride), res[1]);
- _mm_store_si128((__m128i *)(output + 2 * stride), res[2]);
- _mm_store_si128((__m128i *)(output + 3 * stride), res[3]);
- _mm_store_si128((__m128i *)(output + 4 * stride), res[4]);
- _mm_store_si128((__m128i *)(output + 5 * stride), res[5]);
- _mm_store_si128((__m128i *)(output + 6 * stride), res[6]);
- _mm_store_si128((__m128i *)(output + 7 * stride), res[7]);
-}
-
-// perform in-place transpose
-static INLINE void array_transpose_8x8_avx2(__m128i *in, __m128i *res) {
- const __m128i tr0_0 = _mm_unpacklo_epi16(in[0], in[1]);
- const __m128i tr0_1 = _mm_unpacklo_epi16(in[2], in[3]);
- const __m128i tr0_2 = _mm_unpackhi_epi16(in[0], in[1]);
- const __m128i tr0_3 = _mm_unpackhi_epi16(in[2], in[3]);
- const __m128i tr0_4 = _mm_unpacklo_epi16(in[4], in[5]);
- const __m128i tr0_5 = _mm_unpacklo_epi16(in[6], in[7]);
- const __m128i tr0_6 = _mm_unpackhi_epi16(in[4], in[5]);
- const __m128i tr0_7 = _mm_unpackhi_epi16(in[6], in[7]);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 44 54 45 55 46 56 47 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 25 35
- // 44 54 64 74 45 55 65 75
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- res[0] = _mm_unpacklo_epi64(tr1_0, tr1_1);
- res[1] = _mm_unpackhi_epi64(tr1_0, tr1_1);
- res[2] = _mm_unpacklo_epi64(tr1_2, tr1_3);
- res[3] = _mm_unpackhi_epi64(tr1_2, tr1_3);
- res[4] = _mm_unpacklo_epi64(tr1_4, tr1_5);
- res[5] = _mm_unpackhi_epi64(tr1_4, tr1_5);
- res[6] = _mm_unpacklo_epi64(tr1_6, tr1_7);
- res[7] = _mm_unpackhi_epi64(tr1_6, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
-}
-
-void fdct8_avx2(__m128i *in) {
- // constants
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i u0, u1, u2, u3, u4, u5, u6, u7;
- __m128i v0, v1, v2, v3, v4, v5, v6, v7;
- __m128i s0, s1, s2, s3, s4, s5, s6, s7;
-
- // stage 1
- s0 = _mm_add_epi16(in[0], in[7]);
- s1 = _mm_add_epi16(in[1], in[6]);
- s2 = _mm_add_epi16(in[2], in[5]);
- s3 = _mm_add_epi16(in[3], in[4]);
- s4 = _mm_sub_epi16(in[3], in[4]);
- s5 = _mm_sub_epi16(in[2], in[5]);
- s6 = _mm_sub_epi16(in[1], in[6]);
- s7 = _mm_sub_epi16(in[0], in[7]);
-
- u0 = _mm_add_epi16(s0, s3);
- u1 = _mm_add_epi16(s1, s2);
- u2 = _mm_sub_epi16(s1, s2);
- u3 = _mm_sub_epi16(s0, s3);
- // interleave and perform butterfly multiplication/addition
- v0 = _mm_unpacklo_epi16(u0, u1);
- v1 = _mm_unpackhi_epi16(u0, u1);
- v2 = _mm_unpacklo_epi16(u2, u3);
- v3 = _mm_unpackhi_epi16(u2, u3);
-
- u0 = _mm_madd_epi16(v0, k__cospi_p16_p16);
- u1 = _mm_madd_epi16(v1, k__cospi_p16_p16);
- u2 = _mm_madd_epi16(v0, k__cospi_p16_m16);
- u3 = _mm_madd_epi16(v1, k__cospi_p16_m16);
- u4 = _mm_madd_epi16(v2, k__cospi_p24_p08);
- u5 = _mm_madd_epi16(v3, k__cospi_p24_p08);
- u6 = _mm_madd_epi16(v2, k__cospi_m08_p24);
- u7 = _mm_madd_epi16(v3, k__cospi_m08_p24);
-
- // shift and rounding
- v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u0, u1);
- in[2] = _mm_packs_epi32(u4, u5);
- in[4] = _mm_packs_epi32(u2, u3);
- in[6] = _mm_packs_epi32(u6, u7);
-
- // stage 2
- // interleave and perform butterfly multiplication/addition
- u0 = _mm_unpacklo_epi16(s6, s5);
- u1 = _mm_unpackhi_epi16(s6, s5);
- v0 = _mm_madd_epi16(u0, k__cospi_p16_m16);
- v1 = _mm_madd_epi16(u1, k__cospi_p16_m16);
- v2 = _mm_madd_epi16(u0, k__cospi_p16_p16);
- v3 = _mm_madd_epi16(u1, k__cospi_p16_p16);
-
- // shift and rounding
- u0 = _mm_add_epi32(v0, k__DCT_CONST_ROUNDING);
- u1 = _mm_add_epi32(v1, k__DCT_CONST_ROUNDING);
- u2 = _mm_add_epi32(v2, k__DCT_CONST_ROUNDING);
- u3 = _mm_add_epi32(v3, k__DCT_CONST_ROUNDING);
-
- v0 = _mm_srai_epi32(u0, DCT_CONST_BITS);
- v1 = _mm_srai_epi32(u1, DCT_CONST_BITS);
- v2 = _mm_srai_epi32(u2, DCT_CONST_BITS);
- v3 = _mm_srai_epi32(u3, DCT_CONST_BITS);
-
- u0 = _mm_packs_epi32(v0, v1);
- u1 = _mm_packs_epi32(v2, v3);
-
- // stage 3
- s0 = _mm_add_epi16(s4, u0);
- s1 = _mm_sub_epi16(s4, u0);
- s2 = _mm_sub_epi16(s7, u1);
- s3 = _mm_add_epi16(s7, u1);
-
- // stage 4
- u0 = _mm_unpacklo_epi16(s0, s3);
- u1 = _mm_unpackhi_epi16(s0, s3);
- u2 = _mm_unpacklo_epi16(s1, s2);
- u3 = _mm_unpackhi_epi16(s1, s2);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p28_p04);
- v1 = _mm_madd_epi16(u1, k__cospi_p28_p04);
- v2 = _mm_madd_epi16(u2, k__cospi_p12_p20);
- v3 = _mm_madd_epi16(u3, k__cospi_p12_p20);
- v4 = _mm_madd_epi16(u2, k__cospi_m20_p12);
- v5 = _mm_madd_epi16(u3, k__cospi_m20_p12);
- v6 = _mm_madd_epi16(u0, k__cospi_m04_p28);
- v7 = _mm_madd_epi16(u1, k__cospi_m04_p28);
-
- // shift and rounding
- u0 = _mm_add_epi32(v0, k__DCT_CONST_ROUNDING);
- u1 = _mm_add_epi32(v1, k__DCT_CONST_ROUNDING);
- u2 = _mm_add_epi32(v2, k__DCT_CONST_ROUNDING);
- u3 = _mm_add_epi32(v3, k__DCT_CONST_ROUNDING);
- u4 = _mm_add_epi32(v4, k__DCT_CONST_ROUNDING);
- u5 = _mm_add_epi32(v5, k__DCT_CONST_ROUNDING);
- u6 = _mm_add_epi32(v6, k__DCT_CONST_ROUNDING);
- u7 = _mm_add_epi32(v7, k__DCT_CONST_ROUNDING);
-
- v0 = _mm_srai_epi32(u0, DCT_CONST_BITS);
- v1 = _mm_srai_epi32(u1, DCT_CONST_BITS);
- v2 = _mm_srai_epi32(u2, DCT_CONST_BITS);
- v3 = _mm_srai_epi32(u3, DCT_CONST_BITS);
- v4 = _mm_srai_epi32(u4, DCT_CONST_BITS);
- v5 = _mm_srai_epi32(u5, DCT_CONST_BITS);
- v6 = _mm_srai_epi32(u6, DCT_CONST_BITS);
- v7 = _mm_srai_epi32(u7, DCT_CONST_BITS);
-
- in[1] = _mm_packs_epi32(v0, v1);
- in[3] = _mm_packs_epi32(v4, v5);
- in[5] = _mm_packs_epi32(v2, v3);
- in[7] = _mm_packs_epi32(v6, v7);
-
- // transpose
- array_transpose_8x8_avx2(in, in);
-}
-
-void fadst8_avx2(__m128i *in) {
- // Constants
- const __m128i k__cospi_p02_p30 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i k__cospi_p30_m02 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i k__cospi_p10_p22 = pair_set_epi16(cospi_10_64, cospi_22_64);
- const __m128i k__cospi_p22_m10 = pair_set_epi16(cospi_22_64, -cospi_10_64);
- const __m128i k__cospi_p18_p14 = pair_set_epi16(cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p14_m18 = pair_set_epi16(cospi_14_64, -cospi_18_64);
- const __m128i k__cospi_p26_p06 = pair_set_epi16(cospi_26_64, cospi_6_64);
- const __m128i k__cospi_p06_m26 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m24_p08 = pair_set_epi16(-cospi_24_64, cospi_8_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__const_0 = _mm_set1_epi16(0);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
-
- __m128i u0, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11, u12, u13, u14, u15;
- __m128i v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15;
- __m128i w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15;
- __m128i s0, s1, s2, s3, s4, s5, s6, s7;
- __m128i in0, in1, in2, in3, in4, in5, in6, in7;
-
- // properly aligned for butterfly input
- in0 = in[7];
- in1 = in[0];
- in2 = in[5];
- in3 = in[2];
- in4 = in[3];
- in5 = in[4];
- in6 = in[1];
- in7 = in[6];
-
- // column transformation
- // stage 1
- // interleave and multiply/add into 32-bit integer
- s0 = _mm_unpacklo_epi16(in0, in1);
- s1 = _mm_unpackhi_epi16(in0, in1);
- s2 = _mm_unpacklo_epi16(in2, in3);
- s3 = _mm_unpackhi_epi16(in2, in3);
- s4 = _mm_unpacklo_epi16(in4, in5);
- s5 = _mm_unpackhi_epi16(in4, in5);
- s6 = _mm_unpacklo_epi16(in6, in7);
- s7 = _mm_unpackhi_epi16(in6, in7);
-
- u0 = _mm_madd_epi16(s0, k__cospi_p02_p30);
- u1 = _mm_madd_epi16(s1, k__cospi_p02_p30);
- u2 = _mm_madd_epi16(s0, k__cospi_p30_m02);
- u3 = _mm_madd_epi16(s1, k__cospi_p30_m02);
- u4 = _mm_madd_epi16(s2, k__cospi_p10_p22);
- u5 = _mm_madd_epi16(s3, k__cospi_p10_p22);
- u6 = _mm_madd_epi16(s2, k__cospi_p22_m10);
- u7 = _mm_madd_epi16(s3, k__cospi_p22_m10);
- u8 = _mm_madd_epi16(s4, k__cospi_p18_p14);
- u9 = _mm_madd_epi16(s5, k__cospi_p18_p14);
- u10 = _mm_madd_epi16(s4, k__cospi_p14_m18);
- u11 = _mm_madd_epi16(s5, k__cospi_p14_m18);
- u12 = _mm_madd_epi16(s6, k__cospi_p26_p06);
- u13 = _mm_madd_epi16(s7, k__cospi_p26_p06);
- u14 = _mm_madd_epi16(s6, k__cospi_p06_m26);
- u15 = _mm_madd_epi16(s7, k__cospi_p06_m26);
-
- // addition
- w0 = _mm_add_epi32(u0, u8);
- w1 = _mm_add_epi32(u1, u9);
- w2 = _mm_add_epi32(u2, u10);
- w3 = _mm_add_epi32(u3, u11);
- w4 = _mm_add_epi32(u4, u12);
- w5 = _mm_add_epi32(u5, u13);
- w6 = _mm_add_epi32(u6, u14);
- w7 = _mm_add_epi32(u7, u15);
- w8 = _mm_sub_epi32(u0, u8);
- w9 = _mm_sub_epi32(u1, u9);
- w10 = _mm_sub_epi32(u2, u10);
- w11 = _mm_sub_epi32(u3, u11);
- w12 = _mm_sub_epi32(u4, u12);
- w13 = _mm_sub_epi32(u5, u13);
- w14 = _mm_sub_epi32(u6, u14);
- w15 = _mm_sub_epi32(u7, u15);
-
- // shift and rounding
- v0 = _mm_add_epi32(w0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(w1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(w2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(w3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(w4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(w5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(w6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(w7, k__DCT_CONST_ROUNDING);
- v8 = _mm_add_epi32(w8, k__DCT_CONST_ROUNDING);
- v9 = _mm_add_epi32(w9, k__DCT_CONST_ROUNDING);
- v10 = _mm_add_epi32(w10, k__DCT_CONST_ROUNDING);
- v11 = _mm_add_epi32(w11, k__DCT_CONST_ROUNDING);
- v12 = _mm_add_epi32(w12, k__DCT_CONST_ROUNDING);
- v13 = _mm_add_epi32(w13, k__DCT_CONST_ROUNDING);
- v14 = _mm_add_epi32(w14, k__DCT_CONST_ROUNDING);
- v15 = _mm_add_epi32(w15, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- u8 = _mm_srai_epi32(v8, DCT_CONST_BITS);
- u9 = _mm_srai_epi32(v9, DCT_CONST_BITS);
- u10 = _mm_srai_epi32(v10, DCT_CONST_BITS);
- u11 = _mm_srai_epi32(v11, DCT_CONST_BITS);
- u12 = _mm_srai_epi32(v12, DCT_CONST_BITS);
- u13 = _mm_srai_epi32(v13, DCT_CONST_BITS);
- u14 = _mm_srai_epi32(v14, DCT_CONST_BITS);
- u15 = _mm_srai_epi32(v15, DCT_CONST_BITS);
-
- // back to 16-bit and pack 8 integers into __m128i
- in[0] = _mm_packs_epi32(u0, u1);
- in[1] = _mm_packs_epi32(u2, u3);
- in[2] = _mm_packs_epi32(u4, u5);
- in[3] = _mm_packs_epi32(u6, u7);
- in[4] = _mm_packs_epi32(u8, u9);
- in[5] = _mm_packs_epi32(u10, u11);
- in[6] = _mm_packs_epi32(u12, u13);
- in[7] = _mm_packs_epi32(u14, u15);
-
- // stage 2
- s0 = _mm_add_epi16(in[0], in[2]);
- s1 = _mm_add_epi16(in[1], in[3]);
- s2 = _mm_sub_epi16(in[0], in[2]);
- s3 = _mm_sub_epi16(in[1], in[3]);
- u0 = _mm_unpacklo_epi16(in[4], in[5]);
- u1 = _mm_unpackhi_epi16(in[4], in[5]);
- u2 = _mm_unpacklo_epi16(in[6], in[7]);
- u3 = _mm_unpackhi_epi16(in[6], in[7]);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p08_p24);
- v1 = _mm_madd_epi16(u1, k__cospi_p08_p24);
- v2 = _mm_madd_epi16(u0, k__cospi_p24_m08);
- v3 = _mm_madd_epi16(u1, k__cospi_p24_m08);
- v4 = _mm_madd_epi16(u2, k__cospi_m24_p08);
- v5 = _mm_madd_epi16(u3, k__cospi_m24_p08);
- v6 = _mm_madd_epi16(u2, k__cospi_p08_p24);
- v7 = _mm_madd_epi16(u3, k__cospi_p08_p24);
-
- w0 = _mm_add_epi32(v0, v4);
- w1 = _mm_add_epi32(v1, v5);
- w2 = _mm_add_epi32(v2, v6);
- w3 = _mm_add_epi32(v3, v7);
- w4 = _mm_sub_epi32(v0, v4);
- w5 = _mm_sub_epi32(v1, v5);
- w6 = _mm_sub_epi32(v2, v6);
- w7 = _mm_sub_epi32(v3, v7);
-
- v0 = _mm_add_epi32(w0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(w1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(w2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(w3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(w4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(w5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(w6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(w7, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
-
- // back to 16-bit intergers
- s4 = _mm_packs_epi32(u0, u1);
- s5 = _mm_packs_epi32(u2, u3);
- s6 = _mm_packs_epi32(u4, u5);
- s7 = _mm_packs_epi32(u6, u7);
-
- // stage 3
- u0 = _mm_unpacklo_epi16(s2, s3);
- u1 = _mm_unpackhi_epi16(s2, s3);
- u2 = _mm_unpacklo_epi16(s6, s7);
- u3 = _mm_unpackhi_epi16(s6, s7);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p16_p16);
- v1 = _mm_madd_epi16(u1, k__cospi_p16_p16);
- v2 = _mm_madd_epi16(u0, k__cospi_p16_m16);
- v3 = _mm_madd_epi16(u1, k__cospi_p16_m16);
- v4 = _mm_madd_epi16(u2, k__cospi_p16_p16);
- v5 = _mm_madd_epi16(u3, k__cospi_p16_p16);
- v6 = _mm_madd_epi16(u2, k__cospi_p16_m16);
- v7 = _mm_madd_epi16(u3, k__cospi_p16_m16);
-
- u0 = _mm_add_epi32(v0, k__DCT_CONST_ROUNDING);
- u1 = _mm_add_epi32(v1, k__DCT_CONST_ROUNDING);
- u2 = _mm_add_epi32(v2, k__DCT_CONST_ROUNDING);
- u3 = _mm_add_epi32(v3, k__DCT_CONST_ROUNDING);
- u4 = _mm_add_epi32(v4, k__DCT_CONST_ROUNDING);
- u5 = _mm_add_epi32(v5, k__DCT_CONST_ROUNDING);
- u6 = _mm_add_epi32(v6, k__DCT_CONST_ROUNDING);
- u7 = _mm_add_epi32(v7, k__DCT_CONST_ROUNDING);
-
- v0 = _mm_srai_epi32(u0, DCT_CONST_BITS);
- v1 = _mm_srai_epi32(u1, DCT_CONST_BITS);
- v2 = _mm_srai_epi32(u2, DCT_CONST_BITS);
- v3 = _mm_srai_epi32(u3, DCT_CONST_BITS);
- v4 = _mm_srai_epi32(u4, DCT_CONST_BITS);
- v5 = _mm_srai_epi32(u5, DCT_CONST_BITS);
- v6 = _mm_srai_epi32(u6, DCT_CONST_BITS);
- v7 = _mm_srai_epi32(u7, DCT_CONST_BITS);
-
- s2 = _mm_packs_epi32(v0, v1);
- s3 = _mm_packs_epi32(v2, v3);
- s6 = _mm_packs_epi32(v4, v5);
- s7 = _mm_packs_epi32(v6, v7);
-
- // FIXME(jingning): do subtract using bit inversion?
- in[0] = s0;
- in[1] = _mm_sub_epi16(k__const_0, s4);
- in[2] = s6;
- in[3] = _mm_sub_epi16(k__const_0, s2);
- in[4] = s3;
- in[5] = _mm_sub_epi16(k__const_0, s7);
- in[6] = s5;
- in[7] = _mm_sub_epi16(k__const_0, s1);
-
- // transpose
- array_transpose_8x8_avx2(in, in);
-}
-
-void vp9_fht8x8_avx2(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- __m128i in[8];
-
- switch (tx_type) {
- case DCT_DCT:
- vp9_fdct8x8_avx2(input, output, stride);
- break;
- case ADST_DCT:
- load_buffer_8x8_avx2(input, in, stride);
- fadst8_avx2(in);
- fdct8_avx2(in);
- right_shift_8x8_avx2(in, 1);
- write_buffer_8x8_avx2(output, in, 8);
- break;
- case DCT_ADST:
- load_buffer_8x8_avx2(input, in, stride);
- fdct8_avx2(in);
- fadst8_avx2(in);
- right_shift_8x8_avx2(in, 1);
- write_buffer_8x8_avx2(output, in, 8);
- break;
- case ADST_ADST:
- load_buffer_8x8_avx2(input, in, stride);
- fadst8_avx2(in);
- fadst8_avx2(in);
- right_shift_8x8_avx2(in, 1);
- write_buffer_8x8_avx2(output, in, 8);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-void vp9_fdct16x16_avx2(const int16_t *input, int16_t *output, int stride) {
- // The 2D transform is done with two passes which are actually pretty
- // similar. In the first one, we transform the columns and transpose
- // the results. In the second one, we transform the rows. To achieve that,
- // as the first pass results are transposed, we transpose the columns (that
- // is the transposed rows) and transpose the results (so that it goes back
- // in normal/row positions).
- int pass;
- // We need an intermediate buffer between passes.
- DECLARE_ALIGNED_ARRAY(16, int16_t, intermediate, 256);
- const int16_t *in = input;
- int16_t *out = intermediate;
- // Constants
- // When we use them, in one case, they are all the same. In all others
- // it's a pair of them that we need to repeat four times. This is done
- // by constructing the 32 bit constant corresponding to that pair.
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m24_m08 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p30_p02 = pair_set_epi16(cospi_30_64, cospi_2_64);
- const __m128i k__cospi_p14_p18 = pair_set_epi16(cospi_14_64, cospi_18_64);
- const __m128i k__cospi_m02_p30 = pair_set_epi16(-cospi_2_64, cospi_30_64);
- const __m128i k__cospi_m18_p14 = pair_set_epi16(-cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p22_p10 = pair_set_epi16(cospi_22_64, cospi_10_64);
- const __m128i k__cospi_p06_p26 = pair_set_epi16(cospi_6_64, cospi_26_64);
- const __m128i k__cospi_m10_p22 = pair_set_epi16(-cospi_10_64, cospi_22_64);
- const __m128i k__cospi_m26_p06 = pair_set_epi16(-cospi_26_64, cospi_6_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i kOne = _mm_set1_epi16(1);
- // Do the two transform/transpose passes
- for (pass = 0; pass < 2; ++pass) {
- // We process eight columns (transposed rows in second pass) at a time.
- int column_start;
- for (column_start = 0; column_start < 16; column_start += 8) {
- __m128i in00, in01, in02, in03, in04, in05, in06, in07;
- __m128i in08, in09, in10, in11, in12, in13, in14, in15;
- __m128i input0, input1, input2, input3, input4, input5, input6, input7;
- __m128i step1_0, step1_1, step1_2, step1_3;
- __m128i step1_4, step1_5, step1_6, step1_7;
- __m128i step2_1, step2_2, step2_3, step2_4, step2_5, step2_6;
- __m128i step3_0, step3_1, step3_2, step3_3;
- __m128i step3_4, step3_5, step3_6, step3_7;
- __m128i res00, res01, res02, res03, res04, res05, res06, res07;
- __m128i res08, res09, res10, res11, res12, res13, res14, res15;
- // Load and pre-condition input.
- if (0 == pass) {
- in00 = _mm_load_si128((const __m128i *)(in + 0 * stride));
- in01 = _mm_load_si128((const __m128i *)(in + 1 * stride));
- in02 = _mm_load_si128((const __m128i *)(in + 2 * stride));
- in03 = _mm_load_si128((const __m128i *)(in + 3 * stride));
- in04 = _mm_load_si128((const __m128i *)(in + 4 * stride));
- in05 = _mm_load_si128((const __m128i *)(in + 5 * stride));
- in06 = _mm_load_si128((const __m128i *)(in + 6 * stride));
- in07 = _mm_load_si128((const __m128i *)(in + 7 * stride));
- in08 = _mm_load_si128((const __m128i *)(in + 8 * stride));
- in09 = _mm_load_si128((const __m128i *)(in + 9 * stride));
- in10 = _mm_load_si128((const __m128i *)(in + 10 * stride));
- in11 = _mm_load_si128((const __m128i *)(in + 11 * stride));
- in12 = _mm_load_si128((const __m128i *)(in + 12 * stride));
- in13 = _mm_load_si128((const __m128i *)(in + 13 * stride));
- in14 = _mm_load_si128((const __m128i *)(in + 14 * stride));
- in15 = _mm_load_si128((const __m128i *)(in + 15 * stride));
- // x = x << 2
- in00 = _mm_slli_epi16(in00, 2);
- in01 = _mm_slli_epi16(in01, 2);
- in02 = _mm_slli_epi16(in02, 2);
- in03 = _mm_slli_epi16(in03, 2);
- in04 = _mm_slli_epi16(in04, 2);
- in05 = _mm_slli_epi16(in05, 2);
- in06 = _mm_slli_epi16(in06, 2);
- in07 = _mm_slli_epi16(in07, 2);
- in08 = _mm_slli_epi16(in08, 2);
- in09 = _mm_slli_epi16(in09, 2);
- in10 = _mm_slli_epi16(in10, 2);
- in11 = _mm_slli_epi16(in11, 2);
- in12 = _mm_slli_epi16(in12, 2);
- in13 = _mm_slli_epi16(in13, 2);
- in14 = _mm_slli_epi16(in14, 2);
- in15 = _mm_slli_epi16(in15, 2);
- } else {
- in00 = _mm_load_si128((const __m128i *)(in + 0 * 16));
- in01 = _mm_load_si128((const __m128i *)(in + 1 * 16));
- in02 = _mm_load_si128((const __m128i *)(in + 2 * 16));
- in03 = _mm_load_si128((const __m128i *)(in + 3 * 16));
- in04 = _mm_load_si128((const __m128i *)(in + 4 * 16));
- in05 = _mm_load_si128((const __m128i *)(in + 5 * 16));
- in06 = _mm_load_si128((const __m128i *)(in + 6 * 16));
- in07 = _mm_load_si128((const __m128i *)(in + 7 * 16));
- in08 = _mm_load_si128((const __m128i *)(in + 8 * 16));
- in09 = _mm_load_si128((const __m128i *)(in + 9 * 16));
- in10 = _mm_load_si128((const __m128i *)(in + 10 * 16));
- in11 = _mm_load_si128((const __m128i *)(in + 11 * 16));
- in12 = _mm_load_si128((const __m128i *)(in + 12 * 16));
- in13 = _mm_load_si128((const __m128i *)(in + 13 * 16));
- in14 = _mm_load_si128((const __m128i *)(in + 14 * 16));
- in15 = _mm_load_si128((const __m128i *)(in + 15 * 16));
- // x = (x + 1) >> 2
- in00 = _mm_add_epi16(in00, kOne);
- in01 = _mm_add_epi16(in01, kOne);
- in02 = _mm_add_epi16(in02, kOne);
- in03 = _mm_add_epi16(in03, kOne);
- in04 = _mm_add_epi16(in04, kOne);
- in05 = _mm_add_epi16(in05, kOne);
- in06 = _mm_add_epi16(in06, kOne);
- in07 = _mm_add_epi16(in07, kOne);
- in08 = _mm_add_epi16(in08, kOne);
- in09 = _mm_add_epi16(in09, kOne);
- in10 = _mm_add_epi16(in10, kOne);
- in11 = _mm_add_epi16(in11, kOne);
- in12 = _mm_add_epi16(in12, kOne);
- in13 = _mm_add_epi16(in13, kOne);
- in14 = _mm_add_epi16(in14, kOne);
- in15 = _mm_add_epi16(in15, kOne);
- in00 = _mm_srai_epi16(in00, 2);
- in01 = _mm_srai_epi16(in01, 2);
- in02 = _mm_srai_epi16(in02, 2);
- in03 = _mm_srai_epi16(in03, 2);
- in04 = _mm_srai_epi16(in04, 2);
- in05 = _mm_srai_epi16(in05, 2);
- in06 = _mm_srai_epi16(in06, 2);
- in07 = _mm_srai_epi16(in07, 2);
- in08 = _mm_srai_epi16(in08, 2);
- in09 = _mm_srai_epi16(in09, 2);
- in10 = _mm_srai_epi16(in10, 2);
- in11 = _mm_srai_epi16(in11, 2);
- in12 = _mm_srai_epi16(in12, 2);
- in13 = _mm_srai_epi16(in13, 2);
- in14 = _mm_srai_epi16(in14, 2);
- in15 = _mm_srai_epi16(in15, 2);
- }
- in += 8;
- // Calculate input for the first 8 results.
- {
- input0 = _mm_add_epi16(in00, in15);
- input1 = _mm_add_epi16(in01, in14);
- input2 = _mm_add_epi16(in02, in13);
- input3 = _mm_add_epi16(in03, in12);
- input4 = _mm_add_epi16(in04, in11);
- input5 = _mm_add_epi16(in05, in10);
- input6 = _mm_add_epi16(in06, in09);
- input7 = _mm_add_epi16(in07, in08);
- }
- // Calculate input for the next 8 results.
- {
- step1_0 = _mm_sub_epi16(in07, in08);
- step1_1 = _mm_sub_epi16(in06, in09);
- step1_2 = _mm_sub_epi16(in05, in10);
- step1_3 = _mm_sub_epi16(in04, in11);
- step1_4 = _mm_sub_epi16(in03, in12);
- step1_5 = _mm_sub_epi16(in02, in13);
- step1_6 = _mm_sub_epi16(in01, in14);
- step1_7 = _mm_sub_epi16(in00, in15);
- }
- // Work on the first eight values; fdct8(input, even_results);
- {
- // Add/subtract
- const __m128i q0 = _mm_add_epi16(input0, input7);
- const __m128i q1 = _mm_add_epi16(input1, input6);
- const __m128i q2 = _mm_add_epi16(input2, input5);
- const __m128i q3 = _mm_add_epi16(input3, input4);
- const __m128i q4 = _mm_sub_epi16(input3, input4);
- const __m128i q5 = _mm_sub_epi16(input2, input5);
- const __m128i q6 = _mm_sub_epi16(input1, input6);
- const __m128i q7 = _mm_sub_epi16(input0, input7);
- // Work on first four results
- {
- // Add/subtract
- const __m128i r0 = _mm_add_epi16(q0, q3);
- const __m128i r1 = _mm_add_epi16(q1, q2);
- const __m128i r2 = _mm_sub_epi16(q1, q2);
- const __m128i r3 = _mm_sub_epi16(q0, q3);
- // Interleave to do the multiply by constants which gets us
- // into 32 bits.
- const __m128i t0 = _mm_unpacklo_epi16(r0, r1);
- const __m128i t1 = _mm_unpackhi_epi16(r0, r1);
- const __m128i t2 = _mm_unpacklo_epi16(r2, r3);
- const __m128i t3 = _mm_unpackhi_epi16(r2, r3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_p16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_p16);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_p16_m16);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_p16_m16);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p24_p08);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p24_p08);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m08_p24);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res00 = _mm_packs_epi32(w0, w1);
- res08 = _mm_packs_epi32(w2, w3);
- res04 = _mm_packs_epi32(w4, w5);
- res12 = _mm_packs_epi32(w6, w7);
- }
- // Work on next four results
- {
- // Interleave to do the multiply by constants which gets us
- // into 32 bits.
- const __m128i d0 = _mm_unpacklo_epi16(q6, q5);
- const __m128i d1 = _mm_unpackhi_epi16(q6, q5);
- const __m128i e0 = _mm_madd_epi16(d0, k__cospi_p16_m16);
- const __m128i e1 = _mm_madd_epi16(d1, k__cospi_p16_m16);
- const __m128i e2 = _mm_madd_epi16(d0, k__cospi_p16_p16);
- const __m128i e3 = _mm_madd_epi16(d1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i f0 = _mm_add_epi32(e0, k__DCT_CONST_ROUNDING);
- const __m128i f1 = _mm_add_epi32(e1, k__DCT_CONST_ROUNDING);
- const __m128i f2 = _mm_add_epi32(e2, k__DCT_CONST_ROUNDING);
- const __m128i f3 = _mm_add_epi32(e3, k__DCT_CONST_ROUNDING);
- const __m128i s0 = _mm_srai_epi32(f0, DCT_CONST_BITS);
- const __m128i s1 = _mm_srai_epi32(f1, DCT_CONST_BITS);
- const __m128i s2 = _mm_srai_epi32(f2, DCT_CONST_BITS);
- const __m128i s3 = _mm_srai_epi32(f3, DCT_CONST_BITS);
- // Combine
- const __m128i r0 = _mm_packs_epi32(s0, s1);
- const __m128i r1 = _mm_packs_epi32(s2, s3);
- // Add/subtract
- const __m128i x0 = _mm_add_epi16(q4, r0);
- const __m128i x1 = _mm_sub_epi16(q4, r0);
- const __m128i x2 = _mm_sub_epi16(q7, r1);
- const __m128i x3 = _mm_add_epi16(q7, r1);
- // Interleave to do the multiply by constants which gets us
- // into 32 bits.
- const __m128i t0 = _mm_unpacklo_epi16(x0, x3);
- const __m128i t1 = _mm_unpackhi_epi16(x0, x3);
- const __m128i t2 = _mm_unpacklo_epi16(x1, x2);
- const __m128i t3 = _mm_unpackhi_epi16(x1, x2);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p28_p04);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p28_p04);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_m04_p28);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_m04_p28);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p12_p20);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p12_p20);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m20_p12);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m20_p12);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res02 = _mm_packs_epi32(w0, w1);
- res14 = _mm_packs_epi32(w2, w3);
- res10 = _mm_packs_epi32(w4, w5);
- res06 = _mm_packs_epi32(w6, w7);
- }
- }
- // Work on the next eight values; step1 -> odd_results
- {
- // step 2
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_5, step1_2);
- const __m128i t1 = _mm_unpackhi_epi16(step1_5, step1_2);
- const __m128i t2 = _mm_unpacklo_epi16(step1_4, step1_3);
- const __m128i t3 = _mm_unpackhi_epi16(step1_4, step1_3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_m16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_m16);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p16_m16);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p16_m16);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_2 = _mm_packs_epi32(w0, w1);
- step2_3 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_5, step1_2);
- const __m128i t1 = _mm_unpackhi_epi16(step1_5, step1_2);
- const __m128i t2 = _mm_unpacklo_epi16(step1_4, step1_3);
- const __m128i t3 = _mm_unpackhi_epi16(step1_4, step1_3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_p16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_p16);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p16_p16);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_5 = _mm_packs_epi32(w0, w1);
- step2_4 = _mm_packs_epi32(w2, w3);
- }
- // step 3
- {
- step3_0 = _mm_add_epi16(step1_0, step2_3);
- step3_1 = _mm_add_epi16(step1_1, step2_2);
- step3_2 = _mm_sub_epi16(step1_1, step2_2);
- step3_3 = _mm_sub_epi16(step1_0, step2_3);
- step3_4 = _mm_sub_epi16(step1_7, step2_4);
- step3_5 = _mm_sub_epi16(step1_6, step2_5);
- step3_6 = _mm_add_epi16(step1_6, step2_5);
- step3_7 = _mm_add_epi16(step1_7, step2_4);
- }
- // step 4
- {
- const __m128i t0 = _mm_unpacklo_epi16(step3_1, step3_6);
- const __m128i t1 = _mm_unpackhi_epi16(step3_1, step3_6);
- const __m128i t2 = _mm_unpacklo_epi16(step3_2, step3_5);
- const __m128i t3 = _mm_unpackhi_epi16(step3_2, step3_5);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_m08_p24);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_m08_p24);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m24_m08);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m24_m08);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_1 = _mm_packs_epi32(w0, w1);
- step2_2 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step3_1, step3_6);
- const __m128i t1 = _mm_unpackhi_epi16(step3_1, step3_6);
- const __m128i t2 = _mm_unpacklo_epi16(step3_2, step3_5);
- const __m128i t3 = _mm_unpackhi_epi16(step3_2, step3_5);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p24_p08);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p24_p08);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m08_p24);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_6 = _mm_packs_epi32(w0, w1);
- step2_5 = _mm_packs_epi32(w2, w3);
- }
- // step 5
- {
- step1_0 = _mm_add_epi16(step3_0, step2_1);
- step1_1 = _mm_sub_epi16(step3_0, step2_1);
- step1_2 = _mm_sub_epi16(step3_3, step2_2);
- step1_3 = _mm_add_epi16(step3_3, step2_2);
- step1_4 = _mm_add_epi16(step3_4, step2_5);
- step1_5 = _mm_sub_epi16(step3_4, step2_5);
- step1_6 = _mm_sub_epi16(step3_7, step2_6);
- step1_7 = _mm_add_epi16(step3_7, step2_6);
- }
- // step 6
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_0, step1_7);
- const __m128i t1 = _mm_unpackhi_epi16(step1_0, step1_7);
- const __m128i t2 = _mm_unpacklo_epi16(step1_1, step1_6);
- const __m128i t3 = _mm_unpackhi_epi16(step1_1, step1_6);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p30_p02);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p30_p02);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p14_p18);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p14_p18);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res01 = _mm_packs_epi32(w0, w1);
- res09 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_2, step1_5);
- const __m128i t1 = _mm_unpackhi_epi16(step1_2, step1_5);
- const __m128i t2 = _mm_unpacklo_epi16(step1_3, step1_4);
- const __m128i t3 = _mm_unpackhi_epi16(step1_3, step1_4);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p22_p10);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p22_p10);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p06_p26);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p06_p26);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res05 = _mm_packs_epi32(w0, w1);
- res13 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_2, step1_5);
- const __m128i t1 = _mm_unpackhi_epi16(step1_2, step1_5);
- const __m128i t2 = _mm_unpacklo_epi16(step1_3, step1_4);
- const __m128i t3 = _mm_unpackhi_epi16(step1_3, step1_4);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_m10_p22);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_m10_p22);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m26_p06);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m26_p06);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res11 = _mm_packs_epi32(w0, w1);
- res03 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_0, step1_7);
- const __m128i t1 = _mm_unpackhi_epi16(step1_0, step1_7);
- const __m128i t2 = _mm_unpacklo_epi16(step1_1, step1_6);
- const __m128i t3 = _mm_unpackhi_epi16(step1_1, step1_6);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_m02_p30);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_m02_p30);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m18_p14);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m18_p14);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res15 = _mm_packs_epi32(w0, w1);
- res07 = _mm_packs_epi32(w2, w3);
- }
- }
- // Transpose the results, do it as two 8x8 transposes.
- {
- // 00 01 02 03 04 05 06 07
- // 10 11 12 13 14 15 16 17
- // 20 21 22 23 24 25 26 27
- // 30 31 32 33 34 35 36 37
- // 40 41 42 43 44 45 46 47
- // 50 51 52 53 54 55 56 57
- // 60 61 62 63 64 65 66 67
- // 70 71 72 73 74 75 76 77
- const __m128i tr0_0 = _mm_unpacklo_epi16(res00, res01);
- const __m128i tr0_1 = _mm_unpacklo_epi16(res02, res03);
- const __m128i tr0_2 = _mm_unpackhi_epi16(res00, res01);
- const __m128i tr0_3 = _mm_unpackhi_epi16(res02, res03);
- const __m128i tr0_4 = _mm_unpacklo_epi16(res04, res05);
- const __m128i tr0_5 = _mm_unpacklo_epi16(res06, res07);
- const __m128i tr0_6 = _mm_unpackhi_epi16(res04, res05);
- const __m128i tr0_7 = _mm_unpackhi_epi16(res06, res07);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 54 54 55 55 56 56 57 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 21 36
- // 44 54 64 74 45 55 61 76
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- const __m128i tr2_0 = _mm_unpacklo_epi64(tr1_0, tr1_4);
- const __m128i tr2_1 = _mm_unpackhi_epi64(tr1_0, tr1_4);
- const __m128i tr2_2 = _mm_unpacklo_epi64(tr1_2, tr1_6);
- const __m128i tr2_3 = _mm_unpackhi_epi64(tr1_2, tr1_6);
- const __m128i tr2_4 = _mm_unpacklo_epi64(tr1_1, tr1_5);
- const __m128i tr2_5 = _mm_unpackhi_epi64(tr1_1, tr1_5);
- const __m128i tr2_6 = _mm_unpacklo_epi64(tr1_3, tr1_7);
- const __m128i tr2_7 = _mm_unpackhi_epi64(tr1_3, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
- _mm_storeu_si128((__m128i *)(out + 0 * 16), tr2_0);
- _mm_storeu_si128((__m128i *)(out + 1 * 16), tr2_1);
- _mm_storeu_si128((__m128i *)(out + 2 * 16), tr2_2);
- _mm_storeu_si128((__m128i *)(out + 3 * 16), tr2_3);
- _mm_storeu_si128((__m128i *)(out + 4 * 16), tr2_4);
- _mm_storeu_si128((__m128i *)(out + 5 * 16), tr2_5);
- _mm_storeu_si128((__m128i *)(out + 6 * 16), tr2_6);
- _mm_storeu_si128((__m128i *)(out + 7 * 16), tr2_7);
- }
- {
- // 00 01 02 03 04 05 06 07
- // 10 11 12 13 14 15 16 17
- // 20 21 22 23 24 25 26 27
- // 30 31 32 33 34 35 36 37
- // 40 41 42 43 44 45 46 47
- // 50 51 52 53 54 55 56 57
- // 60 61 62 63 64 65 66 67
- // 70 71 72 73 74 75 76 77
- const __m128i tr0_0 = _mm_unpacklo_epi16(res08, res09);
- const __m128i tr0_1 = _mm_unpacklo_epi16(res10, res11);
- const __m128i tr0_2 = _mm_unpackhi_epi16(res08, res09);
- const __m128i tr0_3 = _mm_unpackhi_epi16(res10, res11);
- const __m128i tr0_4 = _mm_unpacklo_epi16(res12, res13);
- const __m128i tr0_5 = _mm_unpacklo_epi16(res14, res15);
- const __m128i tr0_6 = _mm_unpackhi_epi16(res12, res13);
- const __m128i tr0_7 = _mm_unpackhi_epi16(res14, res15);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 54 54 55 55 56 56 57 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 21 36
- // 44 54 64 74 45 55 61 76
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- const __m128i tr2_0 = _mm_unpacklo_epi64(tr1_0, tr1_4);
- const __m128i tr2_1 = _mm_unpackhi_epi64(tr1_0, tr1_4);
- const __m128i tr2_2 = _mm_unpacklo_epi64(tr1_2, tr1_6);
- const __m128i tr2_3 = _mm_unpackhi_epi64(tr1_2, tr1_6);
- const __m128i tr2_4 = _mm_unpacklo_epi64(tr1_1, tr1_5);
- const __m128i tr2_5 = _mm_unpackhi_epi64(tr1_1, tr1_5);
- const __m128i tr2_6 = _mm_unpacklo_epi64(tr1_3, tr1_7);
- const __m128i tr2_7 = _mm_unpackhi_epi64(tr1_3, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
- // Store results
- _mm_store_si128((__m128i *)(out + 8 + 0 * 16), tr2_0);
- _mm_store_si128((__m128i *)(out + 8 + 1 * 16), tr2_1);
- _mm_store_si128((__m128i *)(out + 8 + 2 * 16), tr2_2);
- _mm_store_si128((__m128i *)(out + 8 + 3 * 16), tr2_3);
- _mm_store_si128((__m128i *)(out + 8 + 4 * 16), tr2_4);
- _mm_store_si128((__m128i *)(out + 8 + 5 * 16), tr2_5);
- _mm_store_si128((__m128i *)(out + 8 + 6 * 16), tr2_6);
- _mm_store_si128((__m128i *)(out + 8 + 7 * 16), tr2_7);
- }
- out += 8*16;
- }
- // Setup in/out for next pass.
- in = intermediate;
- out = output;
- }
-}
-
-static INLINE void load_buffer_16x16_avx2(const int16_t* input, __m128i *in0,
- __m128i *in1, int stride) {
- // load first 8 columns
- load_buffer_8x8_avx2(input, in0, stride);
- load_buffer_8x8_avx2(input + 8 * stride, in0 + 8, stride);
-
- input += 8;
- // load second 8 columns
- load_buffer_8x8_avx2(input, in1, stride);
- load_buffer_8x8_avx2(input + 8 * stride, in1 + 8, stride);
-}
-
-static INLINE void write_buffer_16x16_avx2(int16_t *output, __m128i *in0,
- __m128i *in1, int stride) {
- // write first 8 columns
- write_buffer_8x8_avx2(output, in0, stride);
- write_buffer_8x8_avx2(output + 8 * stride, in0 + 8, stride);
- // write second 8 columns
- output += 8;
- write_buffer_8x8_avx2(output, in1, stride);
- write_buffer_8x8_avx2(output + 8 * stride, in1 + 8, stride);
-}
-
-static INLINE void array_transpose_16x16_avx2(__m128i *res0, __m128i *res1) {
- __m128i tbuf[8];
- array_transpose_8x8_avx2(res0, res0);
- array_transpose_8x8_avx2(res1, tbuf);
- array_transpose_8x8_avx2(res0 + 8, res1);
- array_transpose_8x8_avx2(res1 + 8, res1 + 8);
-
- res0[8] = tbuf[0];
- res0[9] = tbuf[1];
- res0[10] = tbuf[2];
- res0[11] = tbuf[3];
- res0[12] = tbuf[4];
- res0[13] = tbuf[5];
- res0[14] = tbuf[6];
- res0[15] = tbuf[7];
-}
-
-static INLINE void right_shift_16x16_avx2(__m128i *res0, __m128i *res1) {
- // perform rounding operations
- right_shift_8x8_avx2(res0, 2);
- right_shift_8x8_avx2(res0 + 8, 2);
- right_shift_8x8_avx2(res1, 2);
- right_shift_8x8_avx2(res1 + 8, 2);
-}
-
-void fdct16_8col_avx2(__m128i *in) {
- // perform 16x16 1-D DCT for 8 columns
- __m128i i[8], s[8], p[8], t[8], u[16], v[16];
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_m16_p16 = pair_set_epi16(-cospi_16_64, cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m24_m08 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p30_p02 = pair_set_epi16(cospi_30_64, cospi_2_64);
- const __m128i k__cospi_p14_p18 = pair_set_epi16(cospi_14_64, cospi_18_64);
- const __m128i k__cospi_m02_p30 = pair_set_epi16(-cospi_2_64, cospi_30_64);
- const __m128i k__cospi_m18_p14 = pair_set_epi16(-cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p22_p10 = pair_set_epi16(cospi_22_64, cospi_10_64);
- const __m128i k__cospi_p06_p26 = pair_set_epi16(cospi_6_64, cospi_26_64);
- const __m128i k__cospi_m10_p22 = pair_set_epi16(-cospi_10_64, cospi_22_64);
- const __m128i k__cospi_m26_p06 = pair_set_epi16(-cospi_26_64, cospi_6_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
-
- // stage 1
- i[0] = _mm_add_epi16(in[0], in[15]);
- i[1] = _mm_add_epi16(in[1], in[14]);
- i[2] = _mm_add_epi16(in[2], in[13]);
- i[3] = _mm_add_epi16(in[3], in[12]);
- i[4] = _mm_add_epi16(in[4], in[11]);
- i[5] = _mm_add_epi16(in[5], in[10]);
- i[6] = _mm_add_epi16(in[6], in[9]);
- i[7] = _mm_add_epi16(in[7], in[8]);
-
- s[0] = _mm_sub_epi16(in[7], in[8]);
- s[1] = _mm_sub_epi16(in[6], in[9]);
- s[2] = _mm_sub_epi16(in[5], in[10]);
- s[3] = _mm_sub_epi16(in[4], in[11]);
- s[4] = _mm_sub_epi16(in[3], in[12]);
- s[5] = _mm_sub_epi16(in[2], in[13]);
- s[6] = _mm_sub_epi16(in[1], in[14]);
- s[7] = _mm_sub_epi16(in[0], in[15]);
-
- p[0] = _mm_add_epi16(i[0], i[7]);
- p[1] = _mm_add_epi16(i[1], i[6]);
- p[2] = _mm_add_epi16(i[2], i[5]);
- p[3] = _mm_add_epi16(i[3], i[4]);
- p[4] = _mm_sub_epi16(i[3], i[4]);
- p[5] = _mm_sub_epi16(i[2], i[5]);
- p[6] = _mm_sub_epi16(i[1], i[6]);
- p[7] = _mm_sub_epi16(i[0], i[7]);
-
- u[0] = _mm_add_epi16(p[0], p[3]);
- u[1] = _mm_add_epi16(p[1], p[2]);
- u[2] = _mm_sub_epi16(p[1], p[2]);
- u[3] = _mm_sub_epi16(p[0], p[3]);
-
- v[0] = _mm_unpacklo_epi16(u[0], u[1]);
- v[1] = _mm_unpackhi_epi16(u[0], u[1]);
- v[2] = _mm_unpacklo_epi16(u[2], u[3]);
- v[3] = _mm_unpackhi_epi16(u[2], u[3]);
-
- u[0] = _mm_madd_epi16(v[0], k__cospi_p16_p16);
- u[1] = _mm_madd_epi16(v[1], k__cospi_p16_p16);
- u[2] = _mm_madd_epi16(v[0], k__cospi_p16_m16);
- u[3] = _mm_madd_epi16(v[1], k__cospi_p16_m16);
- u[4] = _mm_madd_epi16(v[2], k__cospi_p24_p08);
- u[5] = _mm_madd_epi16(v[3], k__cospi_p24_p08);
- u[6] = _mm_madd_epi16(v[2], k__cospi_m08_p24);
- u[7] = _mm_madd_epi16(v[3], k__cospi_m08_p24);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u[0], u[1]);
- in[4] = _mm_packs_epi32(u[4], u[5]);
- in[8] = _mm_packs_epi32(u[2], u[3]);
- in[12] = _mm_packs_epi32(u[6], u[7]);
-
- u[0] = _mm_unpacklo_epi16(p[5], p[6]);
- u[1] = _mm_unpackhi_epi16(p[5], p[6]);
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_p16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_p16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_p16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
-
- u[0] = _mm_packs_epi32(v[0], v[1]);
- u[1] = _mm_packs_epi32(v[2], v[3]);
-
- t[0] = _mm_add_epi16(p[4], u[0]);
- t[1] = _mm_sub_epi16(p[4], u[0]);
- t[2] = _mm_sub_epi16(p[7], u[1]);
- t[3] = _mm_add_epi16(p[7], u[1]);
-
- u[0] = _mm_unpacklo_epi16(t[0], t[3]);
- u[1] = _mm_unpackhi_epi16(t[0], t[3]);
- u[2] = _mm_unpacklo_epi16(t[1], t[2]);
- u[3] = _mm_unpackhi_epi16(t[1], t[2]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p28_p04);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p28_p04);
- v[2] = _mm_madd_epi16(u[2], k__cospi_p12_p20);
- v[3] = _mm_madd_epi16(u[3], k__cospi_p12_p20);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m20_p12);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m20_p12);
- v[6] = _mm_madd_epi16(u[0], k__cospi_m04_p28);
- v[7] = _mm_madd_epi16(u[1], k__cospi_m04_p28);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- in[2] = _mm_packs_epi32(v[0], v[1]);
- in[6] = _mm_packs_epi32(v[4], v[5]);
- in[10] = _mm_packs_epi32(v[2], v[3]);
- in[14] = _mm_packs_epi32(v[6], v[7]);
-
- // stage 2
- u[0] = _mm_unpacklo_epi16(s[2], s[5]);
- u[1] = _mm_unpackhi_epi16(s[2], s[5]);
- u[2] = _mm_unpacklo_epi16(s[3], s[4]);
- u[3] = _mm_unpackhi_epi16(s[3], s[4]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_p16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_p16);
- v[2] = _mm_madd_epi16(u[2], k__cospi_m16_p16);
- v[3] = _mm_madd_epi16(u[3], k__cospi_m16_p16);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p16_p16);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p16_p16);
- v[6] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[7] = _mm_madd_epi16(u[1], k__cospi_p16_p16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- t[2] = _mm_packs_epi32(v[0], v[1]);
- t[3] = _mm_packs_epi32(v[2], v[3]);
- t[4] = _mm_packs_epi32(v[4], v[5]);
- t[5] = _mm_packs_epi32(v[6], v[7]);
-
- // stage 3
- p[0] = _mm_add_epi16(s[0], t[3]);
- p[1] = _mm_add_epi16(s[1], t[2]);
- p[2] = _mm_sub_epi16(s[1], t[2]);
- p[3] = _mm_sub_epi16(s[0], t[3]);
- p[4] = _mm_sub_epi16(s[7], t[4]);
- p[5] = _mm_sub_epi16(s[6], t[5]);
- p[6] = _mm_add_epi16(s[6], t[5]);
- p[7] = _mm_add_epi16(s[7], t[4]);
-
- // stage 4
- u[0] = _mm_unpacklo_epi16(p[1], p[6]);
- u[1] = _mm_unpackhi_epi16(p[1], p[6]);
- u[2] = _mm_unpacklo_epi16(p[2], p[5]);
- u[3] = _mm_unpackhi_epi16(p[2], p[5]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m08_p24);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m08_p24);
- v[2] = _mm_madd_epi16(u[2], k__cospi_m24_m08);
- v[3] = _mm_madd_epi16(u[3], k__cospi_m24_m08);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m08_p24);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m08_p24);
- v[6] = _mm_madd_epi16(u[0], k__cospi_p24_p08);
- v[7] = _mm_madd_epi16(u[1], k__cospi_p24_p08);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- t[1] = _mm_packs_epi32(v[0], v[1]);
- t[2] = _mm_packs_epi32(v[2], v[3]);
- t[5] = _mm_packs_epi32(v[4], v[5]);
- t[6] = _mm_packs_epi32(v[6], v[7]);
-
- // stage 5
- s[0] = _mm_add_epi16(p[0], t[1]);
- s[1] = _mm_sub_epi16(p[0], t[1]);
- s[2] = _mm_sub_epi16(p[3], t[2]);
- s[3] = _mm_add_epi16(p[3], t[2]);
- s[4] = _mm_add_epi16(p[4], t[5]);
- s[5] = _mm_sub_epi16(p[4], t[5]);
- s[6] = _mm_sub_epi16(p[7], t[6]);
- s[7] = _mm_add_epi16(p[7], t[6]);
-
- // stage 6
- u[0] = _mm_unpacklo_epi16(s[0], s[7]);
- u[1] = _mm_unpackhi_epi16(s[0], s[7]);
- u[2] = _mm_unpacklo_epi16(s[1], s[6]);
- u[3] = _mm_unpackhi_epi16(s[1], s[6]);
- u[4] = _mm_unpacklo_epi16(s[2], s[5]);
- u[5] = _mm_unpackhi_epi16(s[2], s[5]);
- u[6] = _mm_unpacklo_epi16(s[3], s[4]);
- u[7] = _mm_unpackhi_epi16(s[3], s[4]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p30_p02);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p30_p02);
- v[2] = _mm_madd_epi16(u[2], k__cospi_p14_p18);
- v[3] = _mm_madd_epi16(u[3], k__cospi_p14_p18);
- v[4] = _mm_madd_epi16(u[4], k__cospi_p22_p10);
- v[5] = _mm_madd_epi16(u[5], k__cospi_p22_p10);
- v[6] = _mm_madd_epi16(u[6], k__cospi_p06_p26);
- v[7] = _mm_madd_epi16(u[7], k__cospi_p06_p26);
- v[8] = _mm_madd_epi16(u[6], k__cospi_m26_p06);
- v[9] = _mm_madd_epi16(u[7], k__cospi_m26_p06);
- v[10] = _mm_madd_epi16(u[4], k__cospi_m10_p22);
- v[11] = _mm_madd_epi16(u[5], k__cospi_m10_p22);
- v[12] = _mm_madd_epi16(u[2], k__cospi_m18_p14);
- v[13] = _mm_madd_epi16(u[3], k__cospi_m18_p14);
- v[14] = _mm_madd_epi16(u[0], k__cospi_m02_p30);
- v[15] = _mm_madd_epi16(u[1], k__cospi_m02_p30);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(v[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(v[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(v[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(v[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(v[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(v[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(v[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(v[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- in[1] = _mm_packs_epi32(v[0], v[1]);
- in[9] = _mm_packs_epi32(v[2], v[3]);
- in[5] = _mm_packs_epi32(v[4], v[5]);
- in[13] = _mm_packs_epi32(v[6], v[7]);
- in[3] = _mm_packs_epi32(v[8], v[9]);
- in[11] = _mm_packs_epi32(v[10], v[11]);
- in[7] = _mm_packs_epi32(v[12], v[13]);
- in[15] = _mm_packs_epi32(v[14], v[15]);
-}
-
-void fadst16_8col_avx2(__m128i *in) {
- // perform 16x16 1-D ADST for 8 columns
- __m128i s[16], x[16], u[32], v[32];
- const __m128i k__cospi_p01_p31 = pair_set_epi16(cospi_1_64, cospi_31_64);
- const __m128i k__cospi_p31_m01 = pair_set_epi16(cospi_31_64, -cospi_1_64);
- const __m128i k__cospi_p05_p27 = pair_set_epi16(cospi_5_64, cospi_27_64);
- const __m128i k__cospi_p27_m05 = pair_set_epi16(cospi_27_64, -cospi_5_64);
- const __m128i k__cospi_p09_p23 = pair_set_epi16(cospi_9_64, cospi_23_64);
- const __m128i k__cospi_p23_m09 = pair_set_epi16(cospi_23_64, -cospi_9_64);
- const __m128i k__cospi_p13_p19 = pair_set_epi16(cospi_13_64, cospi_19_64);
- const __m128i k__cospi_p19_m13 = pair_set_epi16(cospi_19_64, -cospi_13_64);
- const __m128i k__cospi_p17_p15 = pair_set_epi16(cospi_17_64, cospi_15_64);
- const __m128i k__cospi_p15_m17 = pair_set_epi16(cospi_15_64, -cospi_17_64);
- const __m128i k__cospi_p21_p11 = pair_set_epi16(cospi_21_64, cospi_11_64);
- const __m128i k__cospi_p11_m21 = pair_set_epi16(cospi_11_64, -cospi_21_64);
- const __m128i k__cospi_p25_p07 = pair_set_epi16(cospi_25_64, cospi_7_64);
- const __m128i k__cospi_p07_m25 = pair_set_epi16(cospi_7_64, -cospi_25_64);
- const __m128i k__cospi_p29_p03 = pair_set_epi16(cospi_29_64, cospi_3_64);
- const __m128i k__cospi_p03_m29 = pair_set_epi16(cospi_3_64, -cospi_29_64);
- const __m128i k__cospi_p04_p28 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p28_m04 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i k__cospi_p20_p12 = pair_set_epi16(cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p12_m20 = pair_set_epi16(cospi_12_64, -cospi_20_64);
- const __m128i k__cospi_m28_p04 = pair_set_epi16(-cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m12_p20 = pair_set_epi16(-cospi_12_64, cospi_20_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m24_p08 = pair_set_epi16(-cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m16_m16 = _mm_set1_epi16(-cospi_16_64);
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_m16_p16 = pair_set_epi16(-cospi_16_64, cospi_16_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i kZero = _mm_set1_epi16(0);
-
- u[0] = _mm_unpacklo_epi16(in[15], in[0]);
- u[1] = _mm_unpackhi_epi16(in[15], in[0]);
- u[2] = _mm_unpacklo_epi16(in[13], in[2]);
- u[3] = _mm_unpackhi_epi16(in[13], in[2]);
- u[4] = _mm_unpacklo_epi16(in[11], in[4]);
- u[5] = _mm_unpackhi_epi16(in[11], in[4]);
- u[6] = _mm_unpacklo_epi16(in[9], in[6]);
- u[7] = _mm_unpackhi_epi16(in[9], in[6]);
- u[8] = _mm_unpacklo_epi16(in[7], in[8]);
- u[9] = _mm_unpackhi_epi16(in[7], in[8]);
- u[10] = _mm_unpacklo_epi16(in[5], in[10]);
- u[11] = _mm_unpackhi_epi16(in[5], in[10]);
- u[12] = _mm_unpacklo_epi16(in[3], in[12]);
- u[13] = _mm_unpackhi_epi16(in[3], in[12]);
- u[14] = _mm_unpacklo_epi16(in[1], in[14]);
- u[15] = _mm_unpackhi_epi16(in[1], in[14]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p01_p31);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p01_p31);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p31_m01);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p31_m01);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p05_p27);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p05_p27);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p27_m05);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p27_m05);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p09_p23);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p09_p23);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p23_m09);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p23_m09);
- v[12] = _mm_madd_epi16(u[6], k__cospi_p13_p19);
- v[13] = _mm_madd_epi16(u[7], k__cospi_p13_p19);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p19_m13);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p19_m13);
- v[16] = _mm_madd_epi16(u[8], k__cospi_p17_p15);
- v[17] = _mm_madd_epi16(u[9], k__cospi_p17_p15);
- v[18] = _mm_madd_epi16(u[8], k__cospi_p15_m17);
- v[19] = _mm_madd_epi16(u[9], k__cospi_p15_m17);
- v[20] = _mm_madd_epi16(u[10], k__cospi_p21_p11);
- v[21] = _mm_madd_epi16(u[11], k__cospi_p21_p11);
- v[22] = _mm_madd_epi16(u[10], k__cospi_p11_m21);
- v[23] = _mm_madd_epi16(u[11], k__cospi_p11_m21);
- v[24] = _mm_madd_epi16(u[12], k__cospi_p25_p07);
- v[25] = _mm_madd_epi16(u[13], k__cospi_p25_p07);
- v[26] = _mm_madd_epi16(u[12], k__cospi_p07_m25);
- v[27] = _mm_madd_epi16(u[13], k__cospi_p07_m25);
- v[28] = _mm_madd_epi16(u[14], k__cospi_p29_p03);
- v[29] = _mm_madd_epi16(u[15], k__cospi_p29_p03);
- v[30] = _mm_madd_epi16(u[14], k__cospi_p03_m29);
- v[31] = _mm_madd_epi16(u[15], k__cospi_p03_m29);
-
- u[0] = _mm_add_epi32(v[0], v[16]);
- u[1] = _mm_add_epi32(v[1], v[17]);
- u[2] = _mm_add_epi32(v[2], v[18]);
- u[3] = _mm_add_epi32(v[3], v[19]);
- u[4] = _mm_add_epi32(v[4], v[20]);
- u[5] = _mm_add_epi32(v[5], v[21]);
- u[6] = _mm_add_epi32(v[6], v[22]);
- u[7] = _mm_add_epi32(v[7], v[23]);
- u[8] = _mm_add_epi32(v[8], v[24]);
- u[9] = _mm_add_epi32(v[9], v[25]);
- u[10] = _mm_add_epi32(v[10], v[26]);
- u[11] = _mm_add_epi32(v[11], v[27]);
- u[12] = _mm_add_epi32(v[12], v[28]);
- u[13] = _mm_add_epi32(v[13], v[29]);
- u[14] = _mm_add_epi32(v[14], v[30]);
- u[15] = _mm_add_epi32(v[15], v[31]);
- u[16] = _mm_sub_epi32(v[0], v[16]);
- u[17] = _mm_sub_epi32(v[1], v[17]);
- u[18] = _mm_sub_epi32(v[2], v[18]);
- u[19] = _mm_sub_epi32(v[3], v[19]);
- u[20] = _mm_sub_epi32(v[4], v[20]);
- u[21] = _mm_sub_epi32(v[5], v[21]);
- u[22] = _mm_sub_epi32(v[6], v[22]);
- u[23] = _mm_sub_epi32(v[7], v[23]);
- u[24] = _mm_sub_epi32(v[8], v[24]);
- u[25] = _mm_sub_epi32(v[9], v[25]);
- u[26] = _mm_sub_epi32(v[10], v[26]);
- u[27] = _mm_sub_epi32(v[11], v[27]);
- u[28] = _mm_sub_epi32(v[12], v[28]);
- u[29] = _mm_sub_epi32(v[13], v[29]);
- u[30] = _mm_sub_epi32(v[14], v[30]);
- u[31] = _mm_sub_epi32(v[15], v[31]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- v[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- v[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
- v[16] = _mm_add_epi32(u[16], k__DCT_CONST_ROUNDING);
- v[17] = _mm_add_epi32(u[17], k__DCT_CONST_ROUNDING);
- v[18] = _mm_add_epi32(u[18], k__DCT_CONST_ROUNDING);
- v[19] = _mm_add_epi32(u[19], k__DCT_CONST_ROUNDING);
- v[20] = _mm_add_epi32(u[20], k__DCT_CONST_ROUNDING);
- v[21] = _mm_add_epi32(u[21], k__DCT_CONST_ROUNDING);
- v[22] = _mm_add_epi32(u[22], k__DCT_CONST_ROUNDING);
- v[23] = _mm_add_epi32(u[23], k__DCT_CONST_ROUNDING);
- v[24] = _mm_add_epi32(u[24], k__DCT_CONST_ROUNDING);
- v[25] = _mm_add_epi32(u[25], k__DCT_CONST_ROUNDING);
- v[26] = _mm_add_epi32(u[26], k__DCT_CONST_ROUNDING);
- v[27] = _mm_add_epi32(u[27], k__DCT_CONST_ROUNDING);
- v[28] = _mm_add_epi32(u[28], k__DCT_CONST_ROUNDING);
- v[29] = _mm_add_epi32(u[29], k__DCT_CONST_ROUNDING);
- v[30] = _mm_add_epi32(u[30], k__DCT_CONST_ROUNDING);
- v[31] = _mm_add_epi32(u[31], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(v[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(v[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
- u[16] = _mm_srai_epi32(v[16], DCT_CONST_BITS);
- u[17] = _mm_srai_epi32(v[17], DCT_CONST_BITS);
- u[18] = _mm_srai_epi32(v[18], DCT_CONST_BITS);
- u[19] = _mm_srai_epi32(v[19], DCT_CONST_BITS);
- u[20] = _mm_srai_epi32(v[20], DCT_CONST_BITS);
- u[21] = _mm_srai_epi32(v[21], DCT_CONST_BITS);
- u[22] = _mm_srai_epi32(v[22], DCT_CONST_BITS);
- u[23] = _mm_srai_epi32(v[23], DCT_CONST_BITS);
- u[24] = _mm_srai_epi32(v[24], DCT_CONST_BITS);
- u[25] = _mm_srai_epi32(v[25], DCT_CONST_BITS);
- u[26] = _mm_srai_epi32(v[26], DCT_CONST_BITS);
- u[27] = _mm_srai_epi32(v[27], DCT_CONST_BITS);
- u[28] = _mm_srai_epi32(v[28], DCT_CONST_BITS);
- u[29] = _mm_srai_epi32(v[29], DCT_CONST_BITS);
- u[30] = _mm_srai_epi32(v[30], DCT_CONST_BITS);
- u[31] = _mm_srai_epi32(v[31], DCT_CONST_BITS);
-
- s[0] = _mm_packs_epi32(u[0], u[1]);
- s[1] = _mm_packs_epi32(u[2], u[3]);
- s[2] = _mm_packs_epi32(u[4], u[5]);
- s[3] = _mm_packs_epi32(u[6], u[7]);
- s[4] = _mm_packs_epi32(u[8], u[9]);
- s[5] = _mm_packs_epi32(u[10], u[11]);
- s[6] = _mm_packs_epi32(u[12], u[13]);
- s[7] = _mm_packs_epi32(u[14], u[15]);
- s[8] = _mm_packs_epi32(u[16], u[17]);
- s[9] = _mm_packs_epi32(u[18], u[19]);
- s[10] = _mm_packs_epi32(u[20], u[21]);
- s[11] = _mm_packs_epi32(u[22], u[23]);
- s[12] = _mm_packs_epi32(u[24], u[25]);
- s[13] = _mm_packs_epi32(u[26], u[27]);
- s[14] = _mm_packs_epi32(u[28], u[29]);
- s[15] = _mm_packs_epi32(u[30], u[31]);
-
- // stage 2
- u[0] = _mm_unpacklo_epi16(s[8], s[9]);
- u[1] = _mm_unpackhi_epi16(s[8], s[9]);
- u[2] = _mm_unpacklo_epi16(s[10], s[11]);
- u[3] = _mm_unpackhi_epi16(s[10], s[11]);
- u[4] = _mm_unpacklo_epi16(s[12], s[13]);
- u[5] = _mm_unpackhi_epi16(s[12], s[13]);
- u[6] = _mm_unpacklo_epi16(s[14], s[15]);
- u[7] = _mm_unpackhi_epi16(s[14], s[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p04_p28);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p04_p28);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p28_m04);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p28_m04);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p20_p12);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p20_p12);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p12_m20);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p12_m20);
- v[8] = _mm_madd_epi16(u[4], k__cospi_m28_p04);
- v[9] = _mm_madd_epi16(u[5], k__cospi_m28_p04);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p04_p28);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p04_p28);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m12_p20);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m12_p20);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p20_p12);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p20_p12);
-
- u[0] = _mm_add_epi32(v[0], v[8]);
- u[1] = _mm_add_epi32(v[1], v[9]);
- u[2] = _mm_add_epi32(v[2], v[10]);
- u[3] = _mm_add_epi32(v[3], v[11]);
- u[4] = _mm_add_epi32(v[4], v[12]);
- u[5] = _mm_add_epi32(v[5], v[13]);
- u[6] = _mm_add_epi32(v[6], v[14]);
- u[7] = _mm_add_epi32(v[7], v[15]);
- u[8] = _mm_sub_epi32(v[0], v[8]);
- u[9] = _mm_sub_epi32(v[1], v[9]);
- u[10] = _mm_sub_epi32(v[2], v[10]);
- u[11] = _mm_sub_epi32(v[3], v[11]);
- u[12] = _mm_sub_epi32(v[4], v[12]);
- u[13] = _mm_sub_epi32(v[5], v[13]);
- u[14] = _mm_sub_epi32(v[6], v[14]);
- u[15] = _mm_sub_epi32(v[7], v[15]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- v[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- v[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(v[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(v[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
-
- x[0] = _mm_add_epi16(s[0], s[4]);
- x[1] = _mm_add_epi16(s[1], s[5]);
- x[2] = _mm_add_epi16(s[2], s[6]);
- x[3] = _mm_add_epi16(s[3], s[7]);
- x[4] = _mm_sub_epi16(s[0], s[4]);
- x[5] = _mm_sub_epi16(s[1], s[5]);
- x[6] = _mm_sub_epi16(s[2], s[6]);
- x[7] = _mm_sub_epi16(s[3], s[7]);
- x[8] = _mm_packs_epi32(u[0], u[1]);
- x[9] = _mm_packs_epi32(u[2], u[3]);
- x[10] = _mm_packs_epi32(u[4], u[5]);
- x[11] = _mm_packs_epi32(u[6], u[7]);
- x[12] = _mm_packs_epi32(u[8], u[9]);
- x[13] = _mm_packs_epi32(u[10], u[11]);
- x[14] = _mm_packs_epi32(u[12], u[13]);
- x[15] = _mm_packs_epi32(u[14], u[15]);
-
- // stage 3
- u[0] = _mm_unpacklo_epi16(x[4], x[5]);
- u[1] = _mm_unpackhi_epi16(x[4], x[5]);
- u[2] = _mm_unpacklo_epi16(x[6], x[7]);
- u[3] = _mm_unpackhi_epi16(x[6], x[7]);
- u[4] = _mm_unpacklo_epi16(x[12], x[13]);
- u[5] = _mm_unpackhi_epi16(x[12], x[13]);
- u[6] = _mm_unpacklo_epi16(x[14], x[15]);
- u[7] = _mm_unpackhi_epi16(x[14], x[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p08_p24);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p08_p24);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p24_m08);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p24_m08);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m24_p08);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m24_p08);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p08_p24);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p08_p24);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p08_p24);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p08_p24);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p24_m08);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p24_m08);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m24_p08);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m24_p08);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p08_p24);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p08_p24);
-
- u[0] = _mm_add_epi32(v[0], v[4]);
- u[1] = _mm_add_epi32(v[1], v[5]);
- u[2] = _mm_add_epi32(v[2], v[6]);
- u[3] = _mm_add_epi32(v[3], v[7]);
- u[4] = _mm_sub_epi32(v[0], v[4]);
- u[5] = _mm_sub_epi32(v[1], v[5]);
- u[6] = _mm_sub_epi32(v[2], v[6]);
- u[7] = _mm_sub_epi32(v[3], v[7]);
- u[8] = _mm_add_epi32(v[8], v[12]);
- u[9] = _mm_add_epi32(v[9], v[13]);
- u[10] = _mm_add_epi32(v[10], v[14]);
- u[11] = _mm_add_epi32(v[11], v[15]);
- u[12] = _mm_sub_epi32(v[8], v[12]);
- u[13] = _mm_sub_epi32(v[9], v[13]);
- u[14] = _mm_sub_epi32(v[10], v[14]);
- u[15] = _mm_sub_epi32(v[11], v[15]);
-
- u[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- s[0] = _mm_add_epi16(x[0], x[2]);
- s[1] = _mm_add_epi16(x[1], x[3]);
- s[2] = _mm_sub_epi16(x[0], x[2]);
- s[3] = _mm_sub_epi16(x[1], x[3]);
- s[4] = _mm_packs_epi32(v[0], v[1]);
- s[5] = _mm_packs_epi32(v[2], v[3]);
- s[6] = _mm_packs_epi32(v[4], v[5]);
- s[7] = _mm_packs_epi32(v[6], v[7]);
- s[8] = _mm_add_epi16(x[8], x[10]);
- s[9] = _mm_add_epi16(x[9], x[11]);
- s[10] = _mm_sub_epi16(x[8], x[10]);
- s[11] = _mm_sub_epi16(x[9], x[11]);
- s[12] = _mm_packs_epi32(v[8], v[9]);
- s[13] = _mm_packs_epi32(v[10], v[11]);
- s[14] = _mm_packs_epi32(v[12], v[13]);
- s[15] = _mm_packs_epi32(v[14], v[15]);
-
- // stage 4
- u[0] = _mm_unpacklo_epi16(s[2], s[3]);
- u[1] = _mm_unpackhi_epi16(s[2], s[3]);
- u[2] = _mm_unpacklo_epi16(s[6], s[7]);
- u[3] = _mm_unpackhi_epi16(s[6], s[7]);
- u[4] = _mm_unpacklo_epi16(s[10], s[11]);
- u[5] = _mm_unpackhi_epi16(s[10], s[11]);
- u[6] = _mm_unpacklo_epi16(s[14], s[15]);
- u[7] = _mm_unpackhi_epi16(s[14], s[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_m16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_m16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_m16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_m16);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p16_p16);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p16_p16);
- v[6] = _mm_madd_epi16(u[2], k__cospi_m16_p16);
- v[7] = _mm_madd_epi16(u[3], k__cospi_m16_p16);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p16_p16);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p16_p16);
- v[10] = _mm_madd_epi16(u[4], k__cospi_m16_p16);
- v[11] = _mm_madd_epi16(u[5], k__cospi_m16_p16);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m16_m16);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m16_m16);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p16_m16);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p16_m16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(v[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(v[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(v[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(v[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(v[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(v[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(v[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(v[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- in[0] = s[0];
- in[1] = _mm_sub_epi16(kZero, s[8]);
- in[2] = s[12];
- in[3] = _mm_sub_epi16(kZero, s[4]);
- in[4] = _mm_packs_epi32(v[4], v[5]);
- in[5] = _mm_packs_epi32(v[12], v[13]);
- in[6] = _mm_packs_epi32(v[8], v[9]);
- in[7] = _mm_packs_epi32(v[0], v[1]);
- in[8] = _mm_packs_epi32(v[2], v[3]);
- in[9] = _mm_packs_epi32(v[10], v[11]);
- in[10] = _mm_packs_epi32(v[14], v[15]);
- in[11] = _mm_packs_epi32(v[6], v[7]);
- in[12] = s[5];
- in[13] = _mm_sub_epi16(kZero, s[13]);
- in[14] = s[9];
- in[15] = _mm_sub_epi16(kZero, s[1]);
-}
-
-void fdct16_avx2(__m128i *in0, __m128i *in1) {
- fdct16_8col_avx2(in0);
- fdct16_8col_avx2(in1);
- array_transpose_16x16_avx2(in0, in1);
-}
-
-void fadst16_avx2(__m128i *in0, __m128i *in1) {
- fadst16_8col_avx2(in0);
- fadst16_8col_avx2(in1);
- array_transpose_16x16_avx2(in0, in1);
-}
-
-void vp9_fht16x16_avx2(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- __m128i in0[16], in1[16];
-
- switch (tx_type) {
- case DCT_DCT:
- vp9_fdct16x16_avx2(input, output, stride);
- break;
- case ADST_DCT:
- load_buffer_16x16_avx2(input, in0, in1, stride);
- fadst16_avx2(in0, in1);
- right_shift_16x16_avx2(in0, in1);
- fdct16_avx2(in0, in1);
- write_buffer_16x16_avx2(output, in0, in1, 16);
- break;
- case DCT_ADST:
- load_buffer_16x16_avx2(input, in0, in1, stride);
- fdct16_avx2(in0, in1);
- right_shift_16x16_avx2(in0, in1);
- fadst16_avx2(in0, in1);
- write_buffer_16x16_avx2(output, in0, in1, 16);
- break;
- case ADST_ADST:
- load_buffer_16x16_avx2(input, in0, in1, stride);
- fadst16_avx2(in0, in1);
- right_shift_16x16_avx2(in0, in1);
- fadst16_avx2(in0, in1);
- write_buffer_16x16_avx2(output, in0, in1, 16);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-#define FDCT32x32_2D_AVX2 vp9_fdct32x32_rd_avx2
-#define FDCT32x32_HIGH_PRECISION 0
-#include "vp9/encoder/x86/vp9_dct32x32_avx2.c"
-#undef FDCT32x32_2D_AVX2
-#undef FDCT32x32_HIGH_PRECISION
-
-#define FDCT32x32_2D_AVX2 vp9_fdct32x32_avx2
-#define FDCT32x32_HIGH_PRECISION 1
-#include "vp9/encoder/x86/vp9_dct32x32_avx2.c" // NOLINT
-#undef FDCT32x32_2D_AVX2
-#undef FDCT32x32_HIGH_PRECISION
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_sse2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_sse2.c
deleted file mode 100644
index 6865822..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_dct_sse2.c
+++ /dev/null
@@ -1,2693 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <emmintrin.h> // SSE2
-#include "vp9/common/vp9_idct.h" // for cospi constants
-#include "vpx_ports/mem.h"
-
-void vp9_fdct4x4_sse2(const int16_t *input, int16_t *output, int stride) {
- // This 2D transform implements 4 vertical 1D transforms followed
- // by 4 horizontal 1D transforms. The multiplies and adds are as given
- // by Chen, Smith and Fralick ('77). The commands for moving the data
- // around have been minimized by hand.
- // For the purposes of the comments, the 16 inputs are referred to at i0
- // through iF (in raster order), intermediate variables are a0, b0, c0
- // through f, and correspond to the in-place computations mapped to input
- // locations. The outputs, o0 through oF are labeled according to the
- // output locations.
-
- // Constants
- // These are the coefficients used for the multiplies.
- // In the comments, pN means cos(N pi /64) and mN is -cos(N pi /64),
- // where cospi_N_64 = cos(N pi /64)
- const __m128i k__cospi_A = _mm_setr_epi16(cospi_16_64, cospi_16_64,
- cospi_16_64, cospi_16_64,
- cospi_16_64, -cospi_16_64,
- cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_B = _mm_setr_epi16(cospi_16_64, -cospi_16_64,
- cospi_16_64, -cospi_16_64,
- cospi_16_64, cospi_16_64,
- cospi_16_64, cospi_16_64);
- const __m128i k__cospi_C = _mm_setr_epi16(cospi_8_64, cospi_24_64,
- cospi_8_64, cospi_24_64,
- cospi_24_64, -cospi_8_64,
- cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_D = _mm_setr_epi16(cospi_24_64, -cospi_8_64,
- cospi_24_64, -cospi_8_64,
- cospi_8_64, cospi_24_64,
- cospi_8_64, cospi_24_64);
- const __m128i k__cospi_E = _mm_setr_epi16(cospi_16_64, cospi_16_64,
- cospi_16_64, cospi_16_64,
- cospi_16_64, cospi_16_64,
- cospi_16_64, cospi_16_64);
- const __m128i k__cospi_F = _mm_setr_epi16(cospi_16_64, -cospi_16_64,
- cospi_16_64, -cospi_16_64,
- cospi_16_64, -cospi_16_64,
- cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_G = _mm_setr_epi16(cospi_8_64, cospi_24_64,
- cospi_8_64, cospi_24_64,
- -cospi_8_64, -cospi_24_64,
- -cospi_8_64, -cospi_24_64);
- const __m128i k__cospi_H = _mm_setr_epi16(cospi_24_64, -cospi_8_64,
- cospi_24_64, -cospi_8_64,
- -cospi_24_64, cospi_8_64,
- -cospi_24_64, cospi_8_64);
-
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- // This second rounding constant saves doing some extra adds at the end
- const __m128i k__DCT_CONST_ROUNDING2 = _mm_set1_epi32(DCT_CONST_ROUNDING
- +(DCT_CONST_ROUNDING << 1));
- const int DCT_CONST_BITS2 = DCT_CONST_BITS+2;
- const __m128i k__nonzero_bias_a = _mm_setr_epi16(0, 1, 1, 1, 1, 1, 1, 1);
- const __m128i k__nonzero_bias_b = _mm_setr_epi16(1, 0, 0, 0, 0, 0, 0, 0);
- __m128i in0, in1;
-
- // Load inputs.
- {
- in0 = _mm_loadl_epi64((const __m128i *)(input + 0 * stride));
- in1 = _mm_loadl_epi64((const __m128i *)(input + 1 * stride));
- in1 = _mm_unpacklo_epi64(in1, _mm_loadl_epi64((const __m128i *)
- (input + 2 * stride)));
- in0 = _mm_unpacklo_epi64(in0, _mm_loadl_epi64((const __m128i *)
- (input + 3 * stride)));
- // in0 = [i0 i1 i2 i3 iC iD iE iF]
- // in1 = [i4 i5 i6 i7 i8 i9 iA iB]
-
-
- // multiply by 16 to give some extra precision
- in0 = _mm_slli_epi16(in0, 4);
- in1 = _mm_slli_epi16(in1, 4);
- // if (i == 0 && input[0]) input[0] += 1;
- // add 1 to the upper left pixel if it is non-zero, which helps reduce
- // the round-trip error
- {
- // The mask will only contain whether the first value is zero, all
- // other comparison will fail as something shifted by 4 (above << 4)
- // can never be equal to one. To increment in the non-zero case, we
- // add the mask and one for the first element:
- // - if zero, mask = -1, v = v - 1 + 1 = v
- // - if non-zero, mask = 0, v = v + 0 + 1 = v + 1
- __m128i mask = _mm_cmpeq_epi16(in0, k__nonzero_bias_a);
- in0 = _mm_add_epi16(in0, mask);
- in0 = _mm_add_epi16(in0, k__nonzero_bias_b);
- }
- }
- // There are 4 total stages, alternating between an add/subtract stage
- // followed by an multiply-and-add stage.
- {
- // Stage 1: Add/subtract
-
- // in0 = [i0 i1 i2 i3 iC iD iE iF]
- // in1 = [i4 i5 i6 i7 i8 i9 iA iB]
- const __m128i r0 = _mm_unpacklo_epi16(in0, in1);
- const __m128i r1 = _mm_unpackhi_epi16(in0, in1);
- // r0 = [i0 i4 i1 i5 i2 i6 i3 i7]
- // r1 = [iC i8 iD i9 iE iA iF iB]
- const __m128i r2 = _mm_shuffle_epi32(r0, 0xB4);
- const __m128i r3 = _mm_shuffle_epi32(r1, 0xB4);
- // r2 = [i0 i4 i1 i5 i3 i7 i2 i6]
- // r3 = [iC i8 iD i9 iF iB iE iA]
-
- const __m128i t0 = _mm_add_epi16(r2, r3);
- const __m128i t1 = _mm_sub_epi16(r2, r3);
- // t0 = [a0 a4 a1 a5 a3 a7 a2 a6]
- // t1 = [aC a8 aD a9 aF aB aE aA]
-
- // Stage 2: multiply by constants (which gets us into 32 bits).
- // The constants needed here are:
- // k__cospi_A = [p16 p16 p16 p16 p16 m16 p16 m16]
- // k__cospi_B = [p16 m16 p16 m16 p16 p16 p16 p16]
- // k__cospi_C = [p08 p24 p08 p24 p24 m08 p24 m08]
- // k__cospi_D = [p24 m08 p24 m08 p08 p24 p08 p24]
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_A);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_B);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_C);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_D);
- // Then add and right-shift to get back to 16-bit range
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // w0 = [b0 b1 b7 b6]
- // w1 = [b8 b9 bF bE]
- // w2 = [b4 b5 b3 b2]
- // w3 = [bC bD bB bA]
- const __m128i x0 = _mm_packs_epi32(w0, w1);
- const __m128i x1 = _mm_packs_epi32(w2, w3);
- // x0 = [b0 b1 b7 b6 b8 b9 bF bE]
- // x1 = [b4 b5 b3 b2 bC bD bB bA]
- in0 = _mm_shuffle_epi32(x0, 0xD8);
- in1 = _mm_shuffle_epi32(x1, 0x8D);
- // in0 = [b0 b1 b8 b9 b7 b6 bF bE]
- // in1 = [b3 b2 bB bA b4 b5 bC bD]
- }
- {
- // vertical DCTs finished. Now we do the horizontal DCTs.
- // Stage 3: Add/subtract
-
- const __m128i t0 = _mm_add_epi16(in0, in1);
- const __m128i t1 = _mm_sub_epi16(in0, in1);
- // t0 = [c0 c1 c8 c9 c4 c5 cC cD]
- // t1 = [c3 c2 cB cA -c7 -c6 -cF -cE]
-
- // Stage 4: multiply by constants (which gets us into 32 bits).
- // The constants needed here are:
- // k__cospi_E = [p16 p16 p16 p16 p16 p16 p16 p16]
- // k__cospi_F = [p16 m16 p16 m16 p16 m16 p16 m16]
- // k__cospi_G = [p08 p24 p08 p24 m08 m24 m08 m24]
- // k__cospi_H = [p24 m08 p24 m08 m24 p08 m24 p08]
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_E);
- const __m128i u1 = _mm_madd_epi16(t0, k__cospi_F);
- const __m128i u2 = _mm_madd_epi16(t1, k__cospi_G);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_H);
- // Then add and right-shift to get back to 16-bit range
- // but this combines the final right-shift as well to save operations
- // This unusual rounding operations is to maintain bit-accurate
- // compatibility with the c version of this function which has two
- // rounding steps in a row.
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING2);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING2);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING2);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING2);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS2);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS2);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS2);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS2);
- // w0 = [o0 o4 o8 oC]
- // w1 = [o2 o6 oA oE]
- // w2 = [o1 o5 o9 oD]
- // w3 = [o3 o7 oB oF]
- // remember the o's are numbered according to the correct output location
- const __m128i x0 = _mm_packs_epi32(w0, w1);
- const __m128i x1 = _mm_packs_epi32(w2, w3);
- // x0 = [o0 o4 o8 oC o2 o6 oA oE]
- // x1 = [o1 o5 o9 oD o3 o7 oB oF]
- const __m128i y0 = _mm_unpacklo_epi16(x0, x1);
- const __m128i y1 = _mm_unpackhi_epi16(x0, x1);
- // y0 = [o0 o1 o4 o5 o8 o9 oC oD]
- // y1 = [o2 o3 o6 o7 oA oB oE oF]
- in0 = _mm_unpacklo_epi32(y0, y1);
- // in0 = [o0 o1 o2 o3 o4 o5 o6 o7]
- in1 = _mm_unpackhi_epi32(y0, y1);
- // in1 = [o8 o9 oA oB oC oD oE oF]
- }
- // Post-condition (v + 1) >> 2 is now incorporated into previous
- // add and right-shift commands. Only 2 store instructions needed
- // because we are using the fact that 1/3 are stored just after 0/2.
- {
- _mm_storeu_si128((__m128i *)(output + 0 * 4), in0);
- _mm_storeu_si128((__m128i *)(output + 2 * 4), in1);
- }
-}
-
-
-static INLINE void load_buffer_4x4(const int16_t *input, __m128i *in,
- int stride) {
- const __m128i k__nonzero_bias_a = _mm_setr_epi16(0, 1, 1, 1, 1, 1, 1, 1);
- const __m128i k__nonzero_bias_b = _mm_setr_epi16(1, 0, 0, 0, 0, 0, 0, 0);
- __m128i mask;
-
- in[0] = _mm_loadl_epi64((const __m128i *)(input + 0 * stride));
- in[1] = _mm_loadl_epi64((const __m128i *)(input + 1 * stride));
- in[2] = _mm_loadl_epi64((const __m128i *)(input + 2 * stride));
- in[3] = _mm_loadl_epi64((const __m128i *)(input + 3 * stride));
-
- in[0] = _mm_slli_epi16(in[0], 4);
- in[1] = _mm_slli_epi16(in[1], 4);
- in[2] = _mm_slli_epi16(in[2], 4);
- in[3] = _mm_slli_epi16(in[3], 4);
-
- mask = _mm_cmpeq_epi16(in[0], k__nonzero_bias_a);
- in[0] = _mm_add_epi16(in[0], mask);
- in[0] = _mm_add_epi16(in[0], k__nonzero_bias_b);
-}
-
-static INLINE void write_buffer_4x4(int16_t *output, __m128i *res) {
- const __m128i kOne = _mm_set1_epi16(1);
- __m128i in01 = _mm_unpacklo_epi64(res[0], res[1]);
- __m128i in23 = _mm_unpacklo_epi64(res[2], res[3]);
- __m128i out01 = _mm_add_epi16(in01, kOne);
- __m128i out23 = _mm_add_epi16(in23, kOne);
- out01 = _mm_srai_epi16(out01, 2);
- out23 = _mm_srai_epi16(out23, 2);
- _mm_store_si128((__m128i *)(output + 0 * 8), out01);
- _mm_store_si128((__m128i *)(output + 1 * 8), out23);
-}
-
-static INLINE void transpose_4x4(__m128i *res) {
- // Combine and transpose
- // 00 01 02 03 20 21 22 23
- // 10 11 12 13 30 31 32 33
- const __m128i tr0_0 = _mm_unpacklo_epi16(res[0], res[1]);
- const __m128i tr0_1 = _mm_unpackhi_epi16(res[0], res[1]);
-
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- res[0] = _mm_unpacklo_epi32(tr0_0, tr0_1);
- res[2] = _mm_unpackhi_epi32(tr0_0, tr0_1);
-
- // 00 10 20 30 01 11 21 31
- // 02 12 22 32 03 13 23 33
- // only use the first 4 16-bit integers
- res[1] = _mm_unpackhi_epi64(res[0], res[0]);
- res[3] = _mm_unpackhi_epi64(res[2], res[2]);
-}
-
-void fdct4_sse2(__m128i *in) {
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
-
- __m128i u[4], v[4];
- u[0]=_mm_unpacklo_epi16(in[0], in[1]);
- u[1]=_mm_unpacklo_epi16(in[3], in[2]);
-
- v[0] = _mm_add_epi16(u[0], u[1]);
- v[1] = _mm_sub_epi16(u[0], u[1]);
-
- u[0] = _mm_madd_epi16(v[0], k__cospi_p16_p16); // 0
- u[1] = _mm_madd_epi16(v[0], k__cospi_p16_m16); // 2
- u[2] = _mm_madd_epi16(v[1], k__cospi_p08_p24); // 1
- u[3] = _mm_madd_epi16(v[1], k__cospi_p24_m08); // 3
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u[0], u[1]);
- in[1] = _mm_packs_epi32(u[2], u[3]);
- transpose_4x4(in);
-}
-
-void fadst4_sse2(__m128i *in) {
- const __m128i k__sinpi_p01_p02 = pair_set_epi16(sinpi_1_9, sinpi_2_9);
- const __m128i k__sinpi_p04_m01 = pair_set_epi16(sinpi_4_9, -sinpi_1_9);
- const __m128i k__sinpi_p03_p04 = pair_set_epi16(sinpi_3_9, sinpi_4_9);
- const __m128i k__sinpi_m03_p02 = pair_set_epi16(-sinpi_3_9, sinpi_2_9);
- const __m128i k__sinpi_p03_p03 = _mm_set1_epi16(sinpi_3_9);
- const __m128i kZero = _mm_set1_epi16(0);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i u[8], v[8];
- __m128i in7 = _mm_add_epi16(in[0], in[1]);
-
- u[0] = _mm_unpacklo_epi16(in[0], in[1]);
- u[1] = _mm_unpacklo_epi16(in[2], in[3]);
- u[2] = _mm_unpacklo_epi16(in7, kZero);
- u[3] = _mm_unpacklo_epi16(in[2], kZero);
- u[4] = _mm_unpacklo_epi16(in[3], kZero);
-
- v[0] = _mm_madd_epi16(u[0], k__sinpi_p01_p02); // s0 + s2
- v[1] = _mm_madd_epi16(u[1], k__sinpi_p03_p04); // s4 + s5
- v[2] = _mm_madd_epi16(u[2], k__sinpi_p03_p03); // x1
- v[3] = _mm_madd_epi16(u[0], k__sinpi_p04_m01); // s1 - s3
- v[4] = _mm_madd_epi16(u[1], k__sinpi_m03_p02); // -s4 + s6
- v[5] = _mm_madd_epi16(u[3], k__sinpi_p03_p03); // s4
- v[6] = _mm_madd_epi16(u[4], k__sinpi_p03_p03);
-
- u[0] = _mm_add_epi32(v[0], v[1]);
- u[1] = _mm_sub_epi32(v[2], v[6]);
- u[2] = _mm_add_epi32(v[3], v[4]);
- u[3] = _mm_sub_epi32(u[2], u[0]);
- u[4] = _mm_slli_epi32(v[5], 2);
- u[5] = _mm_sub_epi32(u[4], v[5]);
- u[6] = _mm_add_epi32(u[3], u[5]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u[0], u[2]);
- in[1] = _mm_packs_epi32(u[1], u[3]);
- transpose_4x4(in);
-}
-
-void vp9_fht4x4_sse2(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- __m128i in[4];
-
- switch (tx_type) {
- case DCT_DCT:
- vp9_fdct4x4_sse2(input, output, stride);
- break;
- case ADST_DCT:
- load_buffer_4x4(input, in, stride);
- fadst4_sse2(in);
- fdct4_sse2(in);
- write_buffer_4x4(output, in);
- break;
- case DCT_ADST:
- load_buffer_4x4(input, in, stride);
- fdct4_sse2(in);
- fadst4_sse2(in);
- write_buffer_4x4(output, in);
- break;
- case ADST_ADST:
- load_buffer_4x4(input, in, stride);
- fadst4_sse2(in);
- fadst4_sse2(in);
- write_buffer_4x4(output, in);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-void vp9_fdct8x8_sse2(const int16_t *input, int16_t *output, int stride) {
- int pass;
- // Constants
- // When we use them, in one case, they are all the same. In all others
- // it's a pair of them that we need to repeat four times. This is done
- // by constructing the 32 bit constant corresponding to that pair.
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- // Load input
- __m128i in0 = _mm_load_si128((const __m128i *)(input + 0 * stride));
- __m128i in1 = _mm_load_si128((const __m128i *)(input + 1 * stride));
- __m128i in2 = _mm_load_si128((const __m128i *)(input + 2 * stride));
- __m128i in3 = _mm_load_si128((const __m128i *)(input + 3 * stride));
- __m128i in4 = _mm_load_si128((const __m128i *)(input + 4 * stride));
- __m128i in5 = _mm_load_si128((const __m128i *)(input + 5 * stride));
- __m128i in6 = _mm_load_si128((const __m128i *)(input + 6 * stride));
- __m128i in7 = _mm_load_si128((const __m128i *)(input + 7 * stride));
- // Pre-condition input (shift by two)
- in0 = _mm_slli_epi16(in0, 2);
- in1 = _mm_slli_epi16(in1, 2);
- in2 = _mm_slli_epi16(in2, 2);
- in3 = _mm_slli_epi16(in3, 2);
- in4 = _mm_slli_epi16(in4, 2);
- in5 = _mm_slli_epi16(in5, 2);
- in6 = _mm_slli_epi16(in6, 2);
- in7 = _mm_slli_epi16(in7, 2);
-
- // We do two passes, first the columns, then the rows. The results of the
- // first pass are transposed so that the same column code can be reused. The
- // results of the second pass are also transposed so that the rows (processed
- // as columns) are put back in row positions.
- for (pass = 0; pass < 2; pass++) {
- // To store results of each pass before the transpose.
- __m128i res0, res1, res2, res3, res4, res5, res6, res7;
- // Add/subtract
- const __m128i q0 = _mm_add_epi16(in0, in7);
- const __m128i q1 = _mm_add_epi16(in1, in6);
- const __m128i q2 = _mm_add_epi16(in2, in5);
- const __m128i q3 = _mm_add_epi16(in3, in4);
- const __m128i q4 = _mm_sub_epi16(in3, in4);
- const __m128i q5 = _mm_sub_epi16(in2, in5);
- const __m128i q6 = _mm_sub_epi16(in1, in6);
- const __m128i q7 = _mm_sub_epi16(in0, in7);
- // Work on first four results
- {
- // Add/subtract
- const __m128i r0 = _mm_add_epi16(q0, q3);
- const __m128i r1 = _mm_add_epi16(q1, q2);
- const __m128i r2 = _mm_sub_epi16(q1, q2);
- const __m128i r3 = _mm_sub_epi16(q0, q3);
- // Interleave to do the multiply by constants which gets us into 32bits
- const __m128i t0 = _mm_unpacklo_epi16(r0, r1);
- const __m128i t1 = _mm_unpackhi_epi16(r0, r1);
- const __m128i t2 = _mm_unpacklo_epi16(r2, r3);
- const __m128i t3 = _mm_unpackhi_epi16(r2, r3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_p16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_p16);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_p16_m16);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_p16_m16);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p24_p08);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p24_p08);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m08_p24);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res0 = _mm_packs_epi32(w0, w1);
- res4 = _mm_packs_epi32(w2, w3);
- res2 = _mm_packs_epi32(w4, w5);
- res6 = _mm_packs_epi32(w6, w7);
- }
- // Work on next four results
- {
- // Interleave to do the multiply by constants which gets us into 32bits
- const __m128i d0 = _mm_unpacklo_epi16(q6, q5);
- const __m128i d1 = _mm_unpackhi_epi16(q6, q5);
- const __m128i e0 = _mm_madd_epi16(d0, k__cospi_p16_m16);
- const __m128i e1 = _mm_madd_epi16(d1, k__cospi_p16_m16);
- const __m128i e2 = _mm_madd_epi16(d0, k__cospi_p16_p16);
- const __m128i e3 = _mm_madd_epi16(d1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i f0 = _mm_add_epi32(e0, k__DCT_CONST_ROUNDING);
- const __m128i f1 = _mm_add_epi32(e1, k__DCT_CONST_ROUNDING);
- const __m128i f2 = _mm_add_epi32(e2, k__DCT_CONST_ROUNDING);
- const __m128i f3 = _mm_add_epi32(e3, k__DCT_CONST_ROUNDING);
- const __m128i s0 = _mm_srai_epi32(f0, DCT_CONST_BITS);
- const __m128i s1 = _mm_srai_epi32(f1, DCT_CONST_BITS);
- const __m128i s2 = _mm_srai_epi32(f2, DCT_CONST_BITS);
- const __m128i s3 = _mm_srai_epi32(f3, DCT_CONST_BITS);
- // Combine
- const __m128i r0 = _mm_packs_epi32(s0, s1);
- const __m128i r1 = _mm_packs_epi32(s2, s3);
- // Add/subtract
- const __m128i x0 = _mm_add_epi16(q4, r0);
- const __m128i x1 = _mm_sub_epi16(q4, r0);
- const __m128i x2 = _mm_sub_epi16(q7, r1);
- const __m128i x3 = _mm_add_epi16(q7, r1);
- // Interleave to do the multiply by constants which gets us into 32bits
- const __m128i t0 = _mm_unpacklo_epi16(x0, x3);
- const __m128i t1 = _mm_unpackhi_epi16(x0, x3);
- const __m128i t2 = _mm_unpacklo_epi16(x1, x2);
- const __m128i t3 = _mm_unpackhi_epi16(x1, x2);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p28_p04);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p28_p04);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_m04_p28);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_m04_p28);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p12_p20);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p12_p20);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m20_p12);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m20_p12);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res1 = _mm_packs_epi32(w0, w1);
- res7 = _mm_packs_epi32(w2, w3);
- res5 = _mm_packs_epi32(w4, w5);
- res3 = _mm_packs_epi32(w6, w7);
- }
- // Transpose the 8x8.
- {
- // 00 01 02 03 04 05 06 07
- // 10 11 12 13 14 15 16 17
- // 20 21 22 23 24 25 26 27
- // 30 31 32 33 34 35 36 37
- // 40 41 42 43 44 45 46 47
- // 50 51 52 53 54 55 56 57
- // 60 61 62 63 64 65 66 67
- // 70 71 72 73 74 75 76 77
- const __m128i tr0_0 = _mm_unpacklo_epi16(res0, res1);
- const __m128i tr0_1 = _mm_unpacklo_epi16(res2, res3);
- const __m128i tr0_2 = _mm_unpackhi_epi16(res0, res1);
- const __m128i tr0_3 = _mm_unpackhi_epi16(res2, res3);
- const __m128i tr0_4 = _mm_unpacklo_epi16(res4, res5);
- const __m128i tr0_5 = _mm_unpacklo_epi16(res6, res7);
- const __m128i tr0_6 = _mm_unpackhi_epi16(res4, res5);
- const __m128i tr0_7 = _mm_unpackhi_epi16(res6, res7);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 54 54 55 55 56 56 57 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 21 36
- // 44 54 64 74 45 55 61 76
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- in0 = _mm_unpacklo_epi64(tr1_0, tr1_4);
- in1 = _mm_unpackhi_epi64(tr1_0, tr1_4);
- in2 = _mm_unpacklo_epi64(tr1_2, tr1_6);
- in3 = _mm_unpackhi_epi64(tr1_2, tr1_6);
- in4 = _mm_unpacklo_epi64(tr1_1, tr1_5);
- in5 = _mm_unpackhi_epi64(tr1_1, tr1_5);
- in6 = _mm_unpacklo_epi64(tr1_3, tr1_7);
- in7 = _mm_unpackhi_epi64(tr1_3, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
- }
- }
- // Post-condition output and store it
- {
- // Post-condition (division by two)
- // division of two 16 bits signed numbers using shifts
- // n / 2 = (n - (n >> 15)) >> 1
- const __m128i sign_in0 = _mm_srai_epi16(in0, 15);
- const __m128i sign_in1 = _mm_srai_epi16(in1, 15);
- const __m128i sign_in2 = _mm_srai_epi16(in2, 15);
- const __m128i sign_in3 = _mm_srai_epi16(in3, 15);
- const __m128i sign_in4 = _mm_srai_epi16(in4, 15);
- const __m128i sign_in5 = _mm_srai_epi16(in5, 15);
- const __m128i sign_in6 = _mm_srai_epi16(in6, 15);
- const __m128i sign_in7 = _mm_srai_epi16(in7, 15);
- in0 = _mm_sub_epi16(in0, sign_in0);
- in1 = _mm_sub_epi16(in1, sign_in1);
- in2 = _mm_sub_epi16(in2, sign_in2);
- in3 = _mm_sub_epi16(in3, sign_in3);
- in4 = _mm_sub_epi16(in4, sign_in4);
- in5 = _mm_sub_epi16(in5, sign_in5);
- in6 = _mm_sub_epi16(in6, sign_in6);
- in7 = _mm_sub_epi16(in7, sign_in7);
- in0 = _mm_srai_epi16(in0, 1);
- in1 = _mm_srai_epi16(in1, 1);
- in2 = _mm_srai_epi16(in2, 1);
- in3 = _mm_srai_epi16(in3, 1);
- in4 = _mm_srai_epi16(in4, 1);
- in5 = _mm_srai_epi16(in5, 1);
- in6 = _mm_srai_epi16(in6, 1);
- in7 = _mm_srai_epi16(in7, 1);
- // store results
- _mm_store_si128((__m128i *)(output + 0 * 8), in0);
- _mm_store_si128((__m128i *)(output + 1 * 8), in1);
- _mm_store_si128((__m128i *)(output + 2 * 8), in2);
- _mm_store_si128((__m128i *)(output + 3 * 8), in3);
- _mm_store_si128((__m128i *)(output + 4 * 8), in4);
- _mm_store_si128((__m128i *)(output + 5 * 8), in5);
- _mm_store_si128((__m128i *)(output + 6 * 8), in6);
- _mm_store_si128((__m128i *)(output + 7 * 8), in7);
- }
-}
-
-// load 8x8 array
-static INLINE void load_buffer_8x8(const int16_t *input, __m128i *in,
- int stride) {
- in[0] = _mm_load_si128((const __m128i *)(input + 0 * stride));
- in[1] = _mm_load_si128((const __m128i *)(input + 1 * stride));
- in[2] = _mm_load_si128((const __m128i *)(input + 2 * stride));
- in[3] = _mm_load_si128((const __m128i *)(input + 3 * stride));
- in[4] = _mm_load_si128((const __m128i *)(input + 4 * stride));
- in[5] = _mm_load_si128((const __m128i *)(input + 5 * stride));
- in[6] = _mm_load_si128((const __m128i *)(input + 6 * stride));
- in[7] = _mm_load_si128((const __m128i *)(input + 7 * stride));
-
- in[0] = _mm_slli_epi16(in[0], 2);
- in[1] = _mm_slli_epi16(in[1], 2);
- in[2] = _mm_slli_epi16(in[2], 2);
- in[3] = _mm_slli_epi16(in[3], 2);
- in[4] = _mm_slli_epi16(in[4], 2);
- in[5] = _mm_slli_epi16(in[5], 2);
- in[6] = _mm_slli_epi16(in[6], 2);
- in[7] = _mm_slli_epi16(in[7], 2);
-}
-
-// right shift and rounding
-static INLINE void right_shift_8x8(__m128i *res, int const bit) {
- const __m128i kOne = _mm_set1_epi16(1);
- const int bit_m02 = bit - 2;
- __m128i sign0 = _mm_srai_epi16(res[0], 15);
- __m128i sign1 = _mm_srai_epi16(res[1], 15);
- __m128i sign2 = _mm_srai_epi16(res[2], 15);
- __m128i sign3 = _mm_srai_epi16(res[3], 15);
- __m128i sign4 = _mm_srai_epi16(res[4], 15);
- __m128i sign5 = _mm_srai_epi16(res[5], 15);
- __m128i sign6 = _mm_srai_epi16(res[6], 15);
- __m128i sign7 = _mm_srai_epi16(res[7], 15);
-
- if (bit_m02 >= 0) {
- __m128i k_const_rounding = _mm_slli_epi16(kOne, bit_m02);
- res[0] = _mm_add_epi16(res[0], k_const_rounding);
- res[1] = _mm_add_epi16(res[1], k_const_rounding);
- res[2] = _mm_add_epi16(res[2], k_const_rounding);
- res[3] = _mm_add_epi16(res[3], k_const_rounding);
- res[4] = _mm_add_epi16(res[4], k_const_rounding);
- res[5] = _mm_add_epi16(res[5], k_const_rounding);
- res[6] = _mm_add_epi16(res[6], k_const_rounding);
- res[7] = _mm_add_epi16(res[7], k_const_rounding);
- }
-
- res[0] = _mm_sub_epi16(res[0], sign0);
- res[1] = _mm_sub_epi16(res[1], sign1);
- res[2] = _mm_sub_epi16(res[2], sign2);
- res[3] = _mm_sub_epi16(res[3], sign3);
- res[4] = _mm_sub_epi16(res[4], sign4);
- res[5] = _mm_sub_epi16(res[5], sign5);
- res[6] = _mm_sub_epi16(res[6], sign6);
- res[7] = _mm_sub_epi16(res[7], sign7);
-
- res[0] = _mm_srai_epi16(res[0], bit);
- res[1] = _mm_srai_epi16(res[1], bit);
- res[2] = _mm_srai_epi16(res[2], bit);
- res[3] = _mm_srai_epi16(res[3], bit);
- res[4] = _mm_srai_epi16(res[4], bit);
- res[5] = _mm_srai_epi16(res[5], bit);
- res[6] = _mm_srai_epi16(res[6], bit);
- res[7] = _mm_srai_epi16(res[7], bit);
-}
-
-// write 8x8 array
-static INLINE void write_buffer_8x8(int16_t *output, __m128i *res, int stride) {
- _mm_store_si128((__m128i *)(output + 0 * stride), res[0]);
- _mm_store_si128((__m128i *)(output + 1 * stride), res[1]);
- _mm_store_si128((__m128i *)(output + 2 * stride), res[2]);
- _mm_store_si128((__m128i *)(output + 3 * stride), res[3]);
- _mm_store_si128((__m128i *)(output + 4 * stride), res[4]);
- _mm_store_si128((__m128i *)(output + 5 * stride), res[5]);
- _mm_store_si128((__m128i *)(output + 6 * stride), res[6]);
- _mm_store_si128((__m128i *)(output + 7 * stride), res[7]);
-}
-
-// perform in-place transpose
-static INLINE void array_transpose_8x8(__m128i *in, __m128i *res) {
- const __m128i tr0_0 = _mm_unpacklo_epi16(in[0], in[1]);
- const __m128i tr0_1 = _mm_unpacklo_epi16(in[2], in[3]);
- const __m128i tr0_2 = _mm_unpackhi_epi16(in[0], in[1]);
- const __m128i tr0_3 = _mm_unpackhi_epi16(in[2], in[3]);
- const __m128i tr0_4 = _mm_unpacklo_epi16(in[4], in[5]);
- const __m128i tr0_5 = _mm_unpacklo_epi16(in[6], in[7]);
- const __m128i tr0_6 = _mm_unpackhi_epi16(in[4], in[5]);
- const __m128i tr0_7 = _mm_unpackhi_epi16(in[6], in[7]);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 44 54 45 55 46 56 47 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 25 35
- // 44 54 64 74 45 55 65 75
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- res[0] = _mm_unpacklo_epi64(tr1_0, tr1_1);
- res[1] = _mm_unpackhi_epi64(tr1_0, tr1_1);
- res[2] = _mm_unpacklo_epi64(tr1_2, tr1_3);
- res[3] = _mm_unpackhi_epi64(tr1_2, tr1_3);
- res[4] = _mm_unpacklo_epi64(tr1_4, tr1_5);
- res[5] = _mm_unpackhi_epi64(tr1_4, tr1_5);
- res[6] = _mm_unpacklo_epi64(tr1_6, tr1_7);
- res[7] = _mm_unpackhi_epi64(tr1_6, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
-}
-
-void fdct8_sse2(__m128i *in) {
- // constants
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- __m128i u0, u1, u2, u3, u4, u5, u6, u7;
- __m128i v0, v1, v2, v3, v4, v5, v6, v7;
- __m128i s0, s1, s2, s3, s4, s5, s6, s7;
-
- // stage 1
- s0 = _mm_add_epi16(in[0], in[7]);
- s1 = _mm_add_epi16(in[1], in[6]);
- s2 = _mm_add_epi16(in[2], in[5]);
- s3 = _mm_add_epi16(in[3], in[4]);
- s4 = _mm_sub_epi16(in[3], in[4]);
- s5 = _mm_sub_epi16(in[2], in[5]);
- s6 = _mm_sub_epi16(in[1], in[6]);
- s7 = _mm_sub_epi16(in[0], in[7]);
-
- u0 = _mm_add_epi16(s0, s3);
- u1 = _mm_add_epi16(s1, s2);
- u2 = _mm_sub_epi16(s1, s2);
- u3 = _mm_sub_epi16(s0, s3);
- // interleave and perform butterfly multiplication/addition
- v0 = _mm_unpacklo_epi16(u0, u1);
- v1 = _mm_unpackhi_epi16(u0, u1);
- v2 = _mm_unpacklo_epi16(u2, u3);
- v3 = _mm_unpackhi_epi16(u2, u3);
-
- u0 = _mm_madd_epi16(v0, k__cospi_p16_p16);
- u1 = _mm_madd_epi16(v1, k__cospi_p16_p16);
- u2 = _mm_madd_epi16(v0, k__cospi_p16_m16);
- u3 = _mm_madd_epi16(v1, k__cospi_p16_m16);
- u4 = _mm_madd_epi16(v2, k__cospi_p24_p08);
- u5 = _mm_madd_epi16(v3, k__cospi_p24_p08);
- u6 = _mm_madd_epi16(v2, k__cospi_m08_p24);
- u7 = _mm_madd_epi16(v3, k__cospi_m08_p24);
-
- // shift and rounding
- v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u0, u1);
- in[2] = _mm_packs_epi32(u4, u5);
- in[4] = _mm_packs_epi32(u2, u3);
- in[6] = _mm_packs_epi32(u6, u7);
-
- // stage 2
- // interleave and perform butterfly multiplication/addition
- u0 = _mm_unpacklo_epi16(s6, s5);
- u1 = _mm_unpackhi_epi16(s6, s5);
- v0 = _mm_madd_epi16(u0, k__cospi_p16_m16);
- v1 = _mm_madd_epi16(u1, k__cospi_p16_m16);
- v2 = _mm_madd_epi16(u0, k__cospi_p16_p16);
- v3 = _mm_madd_epi16(u1, k__cospi_p16_p16);
-
- // shift and rounding
- u0 = _mm_add_epi32(v0, k__DCT_CONST_ROUNDING);
- u1 = _mm_add_epi32(v1, k__DCT_CONST_ROUNDING);
- u2 = _mm_add_epi32(v2, k__DCT_CONST_ROUNDING);
- u3 = _mm_add_epi32(v3, k__DCT_CONST_ROUNDING);
-
- v0 = _mm_srai_epi32(u0, DCT_CONST_BITS);
- v1 = _mm_srai_epi32(u1, DCT_CONST_BITS);
- v2 = _mm_srai_epi32(u2, DCT_CONST_BITS);
- v3 = _mm_srai_epi32(u3, DCT_CONST_BITS);
-
- u0 = _mm_packs_epi32(v0, v1);
- u1 = _mm_packs_epi32(v2, v3);
-
- // stage 3
- s0 = _mm_add_epi16(s4, u0);
- s1 = _mm_sub_epi16(s4, u0);
- s2 = _mm_sub_epi16(s7, u1);
- s3 = _mm_add_epi16(s7, u1);
-
- // stage 4
- u0 = _mm_unpacklo_epi16(s0, s3);
- u1 = _mm_unpackhi_epi16(s0, s3);
- u2 = _mm_unpacklo_epi16(s1, s2);
- u3 = _mm_unpackhi_epi16(s1, s2);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p28_p04);
- v1 = _mm_madd_epi16(u1, k__cospi_p28_p04);
- v2 = _mm_madd_epi16(u2, k__cospi_p12_p20);
- v3 = _mm_madd_epi16(u3, k__cospi_p12_p20);
- v4 = _mm_madd_epi16(u2, k__cospi_m20_p12);
- v5 = _mm_madd_epi16(u3, k__cospi_m20_p12);
- v6 = _mm_madd_epi16(u0, k__cospi_m04_p28);
- v7 = _mm_madd_epi16(u1, k__cospi_m04_p28);
-
- // shift and rounding
- u0 = _mm_add_epi32(v0, k__DCT_CONST_ROUNDING);
- u1 = _mm_add_epi32(v1, k__DCT_CONST_ROUNDING);
- u2 = _mm_add_epi32(v2, k__DCT_CONST_ROUNDING);
- u3 = _mm_add_epi32(v3, k__DCT_CONST_ROUNDING);
- u4 = _mm_add_epi32(v4, k__DCT_CONST_ROUNDING);
- u5 = _mm_add_epi32(v5, k__DCT_CONST_ROUNDING);
- u6 = _mm_add_epi32(v6, k__DCT_CONST_ROUNDING);
- u7 = _mm_add_epi32(v7, k__DCT_CONST_ROUNDING);
-
- v0 = _mm_srai_epi32(u0, DCT_CONST_BITS);
- v1 = _mm_srai_epi32(u1, DCT_CONST_BITS);
- v2 = _mm_srai_epi32(u2, DCT_CONST_BITS);
- v3 = _mm_srai_epi32(u3, DCT_CONST_BITS);
- v4 = _mm_srai_epi32(u4, DCT_CONST_BITS);
- v5 = _mm_srai_epi32(u5, DCT_CONST_BITS);
- v6 = _mm_srai_epi32(u6, DCT_CONST_BITS);
- v7 = _mm_srai_epi32(u7, DCT_CONST_BITS);
-
- in[1] = _mm_packs_epi32(v0, v1);
- in[3] = _mm_packs_epi32(v4, v5);
- in[5] = _mm_packs_epi32(v2, v3);
- in[7] = _mm_packs_epi32(v6, v7);
-
- // transpose
- array_transpose_8x8(in, in);
-}
-
-void fadst8_sse2(__m128i *in) {
- // Constants
- const __m128i k__cospi_p02_p30 = pair_set_epi16(cospi_2_64, cospi_30_64);
- const __m128i k__cospi_p30_m02 = pair_set_epi16(cospi_30_64, -cospi_2_64);
- const __m128i k__cospi_p10_p22 = pair_set_epi16(cospi_10_64, cospi_22_64);
- const __m128i k__cospi_p22_m10 = pair_set_epi16(cospi_22_64, -cospi_10_64);
- const __m128i k__cospi_p18_p14 = pair_set_epi16(cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p14_m18 = pair_set_epi16(cospi_14_64, -cospi_18_64);
- const __m128i k__cospi_p26_p06 = pair_set_epi16(cospi_26_64, cospi_6_64);
- const __m128i k__cospi_p06_m26 = pair_set_epi16(cospi_6_64, -cospi_26_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m24_p08 = pair_set_epi16(-cospi_24_64, cospi_8_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__const_0 = _mm_set1_epi16(0);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
-
- __m128i u0, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11, u12, u13, u14, u15;
- __m128i v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15;
- __m128i w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15;
- __m128i s0, s1, s2, s3, s4, s5, s6, s7;
- __m128i in0, in1, in2, in3, in4, in5, in6, in7;
-
- // properly aligned for butterfly input
- in0 = in[7];
- in1 = in[0];
- in2 = in[5];
- in3 = in[2];
- in4 = in[3];
- in5 = in[4];
- in6 = in[1];
- in7 = in[6];
-
- // column transformation
- // stage 1
- // interleave and multiply/add into 32-bit integer
- s0 = _mm_unpacklo_epi16(in0, in1);
- s1 = _mm_unpackhi_epi16(in0, in1);
- s2 = _mm_unpacklo_epi16(in2, in3);
- s3 = _mm_unpackhi_epi16(in2, in3);
- s4 = _mm_unpacklo_epi16(in4, in5);
- s5 = _mm_unpackhi_epi16(in4, in5);
- s6 = _mm_unpacklo_epi16(in6, in7);
- s7 = _mm_unpackhi_epi16(in6, in7);
-
- u0 = _mm_madd_epi16(s0, k__cospi_p02_p30);
- u1 = _mm_madd_epi16(s1, k__cospi_p02_p30);
- u2 = _mm_madd_epi16(s0, k__cospi_p30_m02);
- u3 = _mm_madd_epi16(s1, k__cospi_p30_m02);
- u4 = _mm_madd_epi16(s2, k__cospi_p10_p22);
- u5 = _mm_madd_epi16(s3, k__cospi_p10_p22);
- u6 = _mm_madd_epi16(s2, k__cospi_p22_m10);
- u7 = _mm_madd_epi16(s3, k__cospi_p22_m10);
- u8 = _mm_madd_epi16(s4, k__cospi_p18_p14);
- u9 = _mm_madd_epi16(s5, k__cospi_p18_p14);
- u10 = _mm_madd_epi16(s4, k__cospi_p14_m18);
- u11 = _mm_madd_epi16(s5, k__cospi_p14_m18);
- u12 = _mm_madd_epi16(s6, k__cospi_p26_p06);
- u13 = _mm_madd_epi16(s7, k__cospi_p26_p06);
- u14 = _mm_madd_epi16(s6, k__cospi_p06_m26);
- u15 = _mm_madd_epi16(s7, k__cospi_p06_m26);
-
- // addition
- w0 = _mm_add_epi32(u0, u8);
- w1 = _mm_add_epi32(u1, u9);
- w2 = _mm_add_epi32(u2, u10);
- w3 = _mm_add_epi32(u3, u11);
- w4 = _mm_add_epi32(u4, u12);
- w5 = _mm_add_epi32(u5, u13);
- w6 = _mm_add_epi32(u6, u14);
- w7 = _mm_add_epi32(u7, u15);
- w8 = _mm_sub_epi32(u0, u8);
- w9 = _mm_sub_epi32(u1, u9);
- w10 = _mm_sub_epi32(u2, u10);
- w11 = _mm_sub_epi32(u3, u11);
- w12 = _mm_sub_epi32(u4, u12);
- w13 = _mm_sub_epi32(u5, u13);
- w14 = _mm_sub_epi32(u6, u14);
- w15 = _mm_sub_epi32(u7, u15);
-
- // shift and rounding
- v0 = _mm_add_epi32(w0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(w1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(w2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(w3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(w4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(w5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(w6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(w7, k__DCT_CONST_ROUNDING);
- v8 = _mm_add_epi32(w8, k__DCT_CONST_ROUNDING);
- v9 = _mm_add_epi32(w9, k__DCT_CONST_ROUNDING);
- v10 = _mm_add_epi32(w10, k__DCT_CONST_ROUNDING);
- v11 = _mm_add_epi32(w11, k__DCT_CONST_ROUNDING);
- v12 = _mm_add_epi32(w12, k__DCT_CONST_ROUNDING);
- v13 = _mm_add_epi32(w13, k__DCT_CONST_ROUNDING);
- v14 = _mm_add_epi32(w14, k__DCT_CONST_ROUNDING);
- v15 = _mm_add_epi32(w15, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- u8 = _mm_srai_epi32(v8, DCT_CONST_BITS);
- u9 = _mm_srai_epi32(v9, DCT_CONST_BITS);
- u10 = _mm_srai_epi32(v10, DCT_CONST_BITS);
- u11 = _mm_srai_epi32(v11, DCT_CONST_BITS);
- u12 = _mm_srai_epi32(v12, DCT_CONST_BITS);
- u13 = _mm_srai_epi32(v13, DCT_CONST_BITS);
- u14 = _mm_srai_epi32(v14, DCT_CONST_BITS);
- u15 = _mm_srai_epi32(v15, DCT_CONST_BITS);
-
- // back to 16-bit and pack 8 integers into __m128i
- in[0] = _mm_packs_epi32(u0, u1);
- in[1] = _mm_packs_epi32(u2, u3);
- in[2] = _mm_packs_epi32(u4, u5);
- in[3] = _mm_packs_epi32(u6, u7);
- in[4] = _mm_packs_epi32(u8, u9);
- in[5] = _mm_packs_epi32(u10, u11);
- in[6] = _mm_packs_epi32(u12, u13);
- in[7] = _mm_packs_epi32(u14, u15);
-
- // stage 2
- s0 = _mm_add_epi16(in[0], in[2]);
- s1 = _mm_add_epi16(in[1], in[3]);
- s2 = _mm_sub_epi16(in[0], in[2]);
- s3 = _mm_sub_epi16(in[1], in[3]);
- u0 = _mm_unpacklo_epi16(in[4], in[5]);
- u1 = _mm_unpackhi_epi16(in[4], in[5]);
- u2 = _mm_unpacklo_epi16(in[6], in[7]);
- u3 = _mm_unpackhi_epi16(in[6], in[7]);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p08_p24);
- v1 = _mm_madd_epi16(u1, k__cospi_p08_p24);
- v2 = _mm_madd_epi16(u0, k__cospi_p24_m08);
- v3 = _mm_madd_epi16(u1, k__cospi_p24_m08);
- v4 = _mm_madd_epi16(u2, k__cospi_m24_p08);
- v5 = _mm_madd_epi16(u3, k__cospi_m24_p08);
- v6 = _mm_madd_epi16(u2, k__cospi_p08_p24);
- v7 = _mm_madd_epi16(u3, k__cospi_p08_p24);
-
- w0 = _mm_add_epi32(v0, v4);
- w1 = _mm_add_epi32(v1, v5);
- w2 = _mm_add_epi32(v2, v6);
- w3 = _mm_add_epi32(v3, v7);
- w4 = _mm_sub_epi32(v0, v4);
- w5 = _mm_sub_epi32(v1, v5);
- w6 = _mm_sub_epi32(v2, v6);
- w7 = _mm_sub_epi32(v3, v7);
-
- v0 = _mm_add_epi32(w0, k__DCT_CONST_ROUNDING);
- v1 = _mm_add_epi32(w1, k__DCT_CONST_ROUNDING);
- v2 = _mm_add_epi32(w2, k__DCT_CONST_ROUNDING);
- v3 = _mm_add_epi32(w3, k__DCT_CONST_ROUNDING);
- v4 = _mm_add_epi32(w4, k__DCT_CONST_ROUNDING);
- v5 = _mm_add_epi32(w5, k__DCT_CONST_ROUNDING);
- v6 = _mm_add_epi32(w6, k__DCT_CONST_ROUNDING);
- v7 = _mm_add_epi32(w7, k__DCT_CONST_ROUNDING);
-
- u0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- u1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- u2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- u3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- u4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- u5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- u6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- u7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
-
- // back to 16-bit intergers
- s4 = _mm_packs_epi32(u0, u1);
- s5 = _mm_packs_epi32(u2, u3);
- s6 = _mm_packs_epi32(u4, u5);
- s7 = _mm_packs_epi32(u6, u7);
-
- // stage 3
- u0 = _mm_unpacklo_epi16(s2, s3);
- u1 = _mm_unpackhi_epi16(s2, s3);
- u2 = _mm_unpacklo_epi16(s6, s7);
- u3 = _mm_unpackhi_epi16(s6, s7);
-
- v0 = _mm_madd_epi16(u0, k__cospi_p16_p16);
- v1 = _mm_madd_epi16(u1, k__cospi_p16_p16);
- v2 = _mm_madd_epi16(u0, k__cospi_p16_m16);
- v3 = _mm_madd_epi16(u1, k__cospi_p16_m16);
- v4 = _mm_madd_epi16(u2, k__cospi_p16_p16);
- v5 = _mm_madd_epi16(u3, k__cospi_p16_p16);
- v6 = _mm_madd_epi16(u2, k__cospi_p16_m16);
- v7 = _mm_madd_epi16(u3, k__cospi_p16_m16);
-
- u0 = _mm_add_epi32(v0, k__DCT_CONST_ROUNDING);
- u1 = _mm_add_epi32(v1, k__DCT_CONST_ROUNDING);
- u2 = _mm_add_epi32(v2, k__DCT_CONST_ROUNDING);
- u3 = _mm_add_epi32(v3, k__DCT_CONST_ROUNDING);
- u4 = _mm_add_epi32(v4, k__DCT_CONST_ROUNDING);
- u5 = _mm_add_epi32(v5, k__DCT_CONST_ROUNDING);
- u6 = _mm_add_epi32(v6, k__DCT_CONST_ROUNDING);
- u7 = _mm_add_epi32(v7, k__DCT_CONST_ROUNDING);
-
- v0 = _mm_srai_epi32(u0, DCT_CONST_BITS);
- v1 = _mm_srai_epi32(u1, DCT_CONST_BITS);
- v2 = _mm_srai_epi32(u2, DCT_CONST_BITS);
- v3 = _mm_srai_epi32(u3, DCT_CONST_BITS);
- v4 = _mm_srai_epi32(u4, DCT_CONST_BITS);
- v5 = _mm_srai_epi32(u5, DCT_CONST_BITS);
- v6 = _mm_srai_epi32(u6, DCT_CONST_BITS);
- v7 = _mm_srai_epi32(u7, DCT_CONST_BITS);
-
- s2 = _mm_packs_epi32(v0, v1);
- s3 = _mm_packs_epi32(v2, v3);
- s6 = _mm_packs_epi32(v4, v5);
- s7 = _mm_packs_epi32(v6, v7);
-
- // FIXME(jingning): do subtract using bit inversion?
- in[0] = s0;
- in[1] = _mm_sub_epi16(k__const_0, s4);
- in[2] = s6;
- in[3] = _mm_sub_epi16(k__const_0, s2);
- in[4] = s3;
- in[5] = _mm_sub_epi16(k__const_0, s7);
- in[6] = s5;
- in[7] = _mm_sub_epi16(k__const_0, s1);
-
- // transpose
- array_transpose_8x8(in, in);
-}
-
-void vp9_fht8x8_sse2(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- __m128i in[8];
-
- switch (tx_type) {
- case DCT_DCT:
- vp9_fdct8x8_sse2(input, output, stride);
- break;
- case ADST_DCT:
- load_buffer_8x8(input, in, stride);
- fadst8_sse2(in);
- fdct8_sse2(in);
- right_shift_8x8(in, 1);
- write_buffer_8x8(output, in, 8);
- break;
- case DCT_ADST:
- load_buffer_8x8(input, in, stride);
- fdct8_sse2(in);
- fadst8_sse2(in);
- right_shift_8x8(in, 1);
- write_buffer_8x8(output, in, 8);
- break;
- case ADST_ADST:
- load_buffer_8x8(input, in, stride);
- fadst8_sse2(in);
- fadst8_sse2(in);
- right_shift_8x8(in, 1);
- write_buffer_8x8(output, in, 8);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-void vp9_fdct16x16_sse2(const int16_t *input, int16_t *output, int stride) {
- // The 2D transform is done with two passes which are actually pretty
- // similar. In the first one, we transform the columns and transpose
- // the results. In the second one, we transform the rows. To achieve that,
- // as the first pass results are transposed, we transpose the columns (that
- // is the transposed rows) and transpose the results (so that it goes back
- // in normal/row positions).
- int pass;
- // We need an intermediate buffer between passes.
- DECLARE_ALIGNED_ARRAY(16, int16_t, intermediate, 256);
- const int16_t *in = input;
- int16_t *out = intermediate;
- // Constants
- // When we use them, in one case, they are all the same. In all others
- // it's a pair of them that we need to repeat four times. This is done
- // by constructing the 32 bit constant corresponding to that pair.
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m24_m08 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p30_p02 = pair_set_epi16(cospi_30_64, cospi_2_64);
- const __m128i k__cospi_p14_p18 = pair_set_epi16(cospi_14_64, cospi_18_64);
- const __m128i k__cospi_m02_p30 = pair_set_epi16(-cospi_2_64, cospi_30_64);
- const __m128i k__cospi_m18_p14 = pair_set_epi16(-cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p22_p10 = pair_set_epi16(cospi_22_64, cospi_10_64);
- const __m128i k__cospi_p06_p26 = pair_set_epi16(cospi_6_64, cospi_26_64);
- const __m128i k__cospi_m10_p22 = pair_set_epi16(-cospi_10_64, cospi_22_64);
- const __m128i k__cospi_m26_p06 = pair_set_epi16(-cospi_26_64, cospi_6_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i kOne = _mm_set1_epi16(1);
- // Do the two transform/transpose passes
- for (pass = 0; pass < 2; ++pass) {
- // We process eight columns (transposed rows in second pass) at a time.
- int column_start;
- for (column_start = 0; column_start < 16; column_start += 8) {
- __m128i in00, in01, in02, in03, in04, in05, in06, in07;
- __m128i in08, in09, in10, in11, in12, in13, in14, in15;
- __m128i input0, input1, input2, input3, input4, input5, input6, input7;
- __m128i step1_0, step1_1, step1_2, step1_3;
- __m128i step1_4, step1_5, step1_6, step1_7;
- __m128i step2_1, step2_2, step2_3, step2_4, step2_5, step2_6;
- __m128i step3_0, step3_1, step3_2, step3_3;
- __m128i step3_4, step3_5, step3_6, step3_7;
- __m128i res00, res01, res02, res03, res04, res05, res06, res07;
- __m128i res08, res09, res10, res11, res12, res13, res14, res15;
- // Load and pre-condition input.
- if (0 == pass) {
- in00 = _mm_load_si128((const __m128i *)(in + 0 * stride));
- in01 = _mm_load_si128((const __m128i *)(in + 1 * stride));
- in02 = _mm_load_si128((const __m128i *)(in + 2 * stride));
- in03 = _mm_load_si128((const __m128i *)(in + 3 * stride));
- in04 = _mm_load_si128((const __m128i *)(in + 4 * stride));
- in05 = _mm_load_si128((const __m128i *)(in + 5 * stride));
- in06 = _mm_load_si128((const __m128i *)(in + 6 * stride));
- in07 = _mm_load_si128((const __m128i *)(in + 7 * stride));
- in08 = _mm_load_si128((const __m128i *)(in + 8 * stride));
- in09 = _mm_load_si128((const __m128i *)(in + 9 * stride));
- in10 = _mm_load_si128((const __m128i *)(in + 10 * stride));
- in11 = _mm_load_si128((const __m128i *)(in + 11 * stride));
- in12 = _mm_load_si128((const __m128i *)(in + 12 * stride));
- in13 = _mm_load_si128((const __m128i *)(in + 13 * stride));
- in14 = _mm_load_si128((const __m128i *)(in + 14 * stride));
- in15 = _mm_load_si128((const __m128i *)(in + 15 * stride));
- // x = x << 2
- in00 = _mm_slli_epi16(in00, 2);
- in01 = _mm_slli_epi16(in01, 2);
- in02 = _mm_slli_epi16(in02, 2);
- in03 = _mm_slli_epi16(in03, 2);
- in04 = _mm_slli_epi16(in04, 2);
- in05 = _mm_slli_epi16(in05, 2);
- in06 = _mm_slli_epi16(in06, 2);
- in07 = _mm_slli_epi16(in07, 2);
- in08 = _mm_slli_epi16(in08, 2);
- in09 = _mm_slli_epi16(in09, 2);
- in10 = _mm_slli_epi16(in10, 2);
- in11 = _mm_slli_epi16(in11, 2);
- in12 = _mm_slli_epi16(in12, 2);
- in13 = _mm_slli_epi16(in13, 2);
- in14 = _mm_slli_epi16(in14, 2);
- in15 = _mm_slli_epi16(in15, 2);
- } else {
- in00 = _mm_load_si128((const __m128i *)(in + 0 * 16));
- in01 = _mm_load_si128((const __m128i *)(in + 1 * 16));
- in02 = _mm_load_si128((const __m128i *)(in + 2 * 16));
- in03 = _mm_load_si128((const __m128i *)(in + 3 * 16));
- in04 = _mm_load_si128((const __m128i *)(in + 4 * 16));
- in05 = _mm_load_si128((const __m128i *)(in + 5 * 16));
- in06 = _mm_load_si128((const __m128i *)(in + 6 * 16));
- in07 = _mm_load_si128((const __m128i *)(in + 7 * 16));
- in08 = _mm_load_si128((const __m128i *)(in + 8 * 16));
- in09 = _mm_load_si128((const __m128i *)(in + 9 * 16));
- in10 = _mm_load_si128((const __m128i *)(in + 10 * 16));
- in11 = _mm_load_si128((const __m128i *)(in + 11 * 16));
- in12 = _mm_load_si128((const __m128i *)(in + 12 * 16));
- in13 = _mm_load_si128((const __m128i *)(in + 13 * 16));
- in14 = _mm_load_si128((const __m128i *)(in + 14 * 16));
- in15 = _mm_load_si128((const __m128i *)(in + 15 * 16));
- // x = (x + 1) >> 2
- in00 = _mm_add_epi16(in00, kOne);
- in01 = _mm_add_epi16(in01, kOne);
- in02 = _mm_add_epi16(in02, kOne);
- in03 = _mm_add_epi16(in03, kOne);
- in04 = _mm_add_epi16(in04, kOne);
- in05 = _mm_add_epi16(in05, kOne);
- in06 = _mm_add_epi16(in06, kOne);
- in07 = _mm_add_epi16(in07, kOne);
- in08 = _mm_add_epi16(in08, kOne);
- in09 = _mm_add_epi16(in09, kOne);
- in10 = _mm_add_epi16(in10, kOne);
- in11 = _mm_add_epi16(in11, kOne);
- in12 = _mm_add_epi16(in12, kOne);
- in13 = _mm_add_epi16(in13, kOne);
- in14 = _mm_add_epi16(in14, kOne);
- in15 = _mm_add_epi16(in15, kOne);
- in00 = _mm_srai_epi16(in00, 2);
- in01 = _mm_srai_epi16(in01, 2);
- in02 = _mm_srai_epi16(in02, 2);
- in03 = _mm_srai_epi16(in03, 2);
- in04 = _mm_srai_epi16(in04, 2);
- in05 = _mm_srai_epi16(in05, 2);
- in06 = _mm_srai_epi16(in06, 2);
- in07 = _mm_srai_epi16(in07, 2);
- in08 = _mm_srai_epi16(in08, 2);
- in09 = _mm_srai_epi16(in09, 2);
- in10 = _mm_srai_epi16(in10, 2);
- in11 = _mm_srai_epi16(in11, 2);
- in12 = _mm_srai_epi16(in12, 2);
- in13 = _mm_srai_epi16(in13, 2);
- in14 = _mm_srai_epi16(in14, 2);
- in15 = _mm_srai_epi16(in15, 2);
- }
- in += 8;
- // Calculate input for the first 8 results.
- {
- input0 = _mm_add_epi16(in00, in15);
- input1 = _mm_add_epi16(in01, in14);
- input2 = _mm_add_epi16(in02, in13);
- input3 = _mm_add_epi16(in03, in12);
- input4 = _mm_add_epi16(in04, in11);
- input5 = _mm_add_epi16(in05, in10);
- input6 = _mm_add_epi16(in06, in09);
- input7 = _mm_add_epi16(in07, in08);
- }
- // Calculate input for the next 8 results.
- {
- step1_0 = _mm_sub_epi16(in07, in08);
- step1_1 = _mm_sub_epi16(in06, in09);
- step1_2 = _mm_sub_epi16(in05, in10);
- step1_3 = _mm_sub_epi16(in04, in11);
- step1_4 = _mm_sub_epi16(in03, in12);
- step1_5 = _mm_sub_epi16(in02, in13);
- step1_6 = _mm_sub_epi16(in01, in14);
- step1_7 = _mm_sub_epi16(in00, in15);
- }
- // Work on the first eight values; fdct8(input, even_results);
- {
- // Add/subtract
- const __m128i q0 = _mm_add_epi16(input0, input7);
- const __m128i q1 = _mm_add_epi16(input1, input6);
- const __m128i q2 = _mm_add_epi16(input2, input5);
- const __m128i q3 = _mm_add_epi16(input3, input4);
- const __m128i q4 = _mm_sub_epi16(input3, input4);
- const __m128i q5 = _mm_sub_epi16(input2, input5);
- const __m128i q6 = _mm_sub_epi16(input1, input6);
- const __m128i q7 = _mm_sub_epi16(input0, input7);
- // Work on first four results
- {
- // Add/subtract
- const __m128i r0 = _mm_add_epi16(q0, q3);
- const __m128i r1 = _mm_add_epi16(q1, q2);
- const __m128i r2 = _mm_sub_epi16(q1, q2);
- const __m128i r3 = _mm_sub_epi16(q0, q3);
- // Interleave to do the multiply by constants which gets us
- // into 32 bits.
- const __m128i t0 = _mm_unpacklo_epi16(r0, r1);
- const __m128i t1 = _mm_unpackhi_epi16(r0, r1);
- const __m128i t2 = _mm_unpacklo_epi16(r2, r3);
- const __m128i t3 = _mm_unpackhi_epi16(r2, r3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_p16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_p16);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_p16_m16);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_p16_m16);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p24_p08);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p24_p08);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m08_p24);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res00 = _mm_packs_epi32(w0, w1);
- res08 = _mm_packs_epi32(w2, w3);
- res04 = _mm_packs_epi32(w4, w5);
- res12 = _mm_packs_epi32(w6, w7);
- }
- // Work on next four results
- {
- // Interleave to do the multiply by constants which gets us
- // into 32 bits.
- const __m128i d0 = _mm_unpacklo_epi16(q6, q5);
- const __m128i d1 = _mm_unpackhi_epi16(q6, q5);
- const __m128i e0 = _mm_madd_epi16(d0, k__cospi_p16_m16);
- const __m128i e1 = _mm_madd_epi16(d1, k__cospi_p16_m16);
- const __m128i e2 = _mm_madd_epi16(d0, k__cospi_p16_p16);
- const __m128i e3 = _mm_madd_epi16(d1, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i f0 = _mm_add_epi32(e0, k__DCT_CONST_ROUNDING);
- const __m128i f1 = _mm_add_epi32(e1, k__DCT_CONST_ROUNDING);
- const __m128i f2 = _mm_add_epi32(e2, k__DCT_CONST_ROUNDING);
- const __m128i f3 = _mm_add_epi32(e3, k__DCT_CONST_ROUNDING);
- const __m128i s0 = _mm_srai_epi32(f0, DCT_CONST_BITS);
- const __m128i s1 = _mm_srai_epi32(f1, DCT_CONST_BITS);
- const __m128i s2 = _mm_srai_epi32(f2, DCT_CONST_BITS);
- const __m128i s3 = _mm_srai_epi32(f3, DCT_CONST_BITS);
- // Combine
- const __m128i r0 = _mm_packs_epi32(s0, s1);
- const __m128i r1 = _mm_packs_epi32(s2, s3);
- // Add/subtract
- const __m128i x0 = _mm_add_epi16(q4, r0);
- const __m128i x1 = _mm_sub_epi16(q4, r0);
- const __m128i x2 = _mm_sub_epi16(q7, r1);
- const __m128i x3 = _mm_add_epi16(q7, r1);
- // Interleave to do the multiply by constants which gets us
- // into 32 bits.
- const __m128i t0 = _mm_unpacklo_epi16(x0, x3);
- const __m128i t1 = _mm_unpackhi_epi16(x0, x3);
- const __m128i t2 = _mm_unpacklo_epi16(x1, x2);
- const __m128i t3 = _mm_unpackhi_epi16(x1, x2);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p28_p04);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p28_p04);
- const __m128i u2 = _mm_madd_epi16(t0, k__cospi_m04_p28);
- const __m128i u3 = _mm_madd_epi16(t1, k__cospi_m04_p28);
- const __m128i u4 = _mm_madd_epi16(t2, k__cospi_p12_p20);
- const __m128i u5 = _mm_madd_epi16(t3, k__cospi_p12_p20);
- const __m128i u6 = _mm_madd_epi16(t2, k__cospi_m20_p12);
- const __m128i u7 = _mm_madd_epi16(t3, k__cospi_m20_p12);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i v4 = _mm_add_epi32(u4, k__DCT_CONST_ROUNDING);
- const __m128i v5 = _mm_add_epi32(u5, k__DCT_CONST_ROUNDING);
- const __m128i v6 = _mm_add_epi32(u6, k__DCT_CONST_ROUNDING);
- const __m128i v7 = _mm_add_epi32(u7, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- const __m128i w4 = _mm_srai_epi32(v4, DCT_CONST_BITS);
- const __m128i w5 = _mm_srai_epi32(v5, DCT_CONST_BITS);
- const __m128i w6 = _mm_srai_epi32(v6, DCT_CONST_BITS);
- const __m128i w7 = _mm_srai_epi32(v7, DCT_CONST_BITS);
- // Combine
- res02 = _mm_packs_epi32(w0, w1);
- res14 = _mm_packs_epi32(w2, w3);
- res10 = _mm_packs_epi32(w4, w5);
- res06 = _mm_packs_epi32(w6, w7);
- }
- }
- // Work on the next eight values; step1 -> odd_results
- {
- // step 2
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_5, step1_2);
- const __m128i t1 = _mm_unpackhi_epi16(step1_5, step1_2);
- const __m128i t2 = _mm_unpacklo_epi16(step1_4, step1_3);
- const __m128i t3 = _mm_unpackhi_epi16(step1_4, step1_3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_m16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_m16);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p16_m16);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p16_m16);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_2 = _mm_packs_epi32(w0, w1);
- step2_3 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_5, step1_2);
- const __m128i t1 = _mm_unpackhi_epi16(step1_5, step1_2);
- const __m128i t2 = _mm_unpacklo_epi16(step1_4, step1_3);
- const __m128i t3 = _mm_unpackhi_epi16(step1_4, step1_3);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p16_p16);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p16_p16);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p16_p16);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p16_p16);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_5 = _mm_packs_epi32(w0, w1);
- step2_4 = _mm_packs_epi32(w2, w3);
- }
- // step 3
- {
- step3_0 = _mm_add_epi16(step1_0, step2_3);
- step3_1 = _mm_add_epi16(step1_1, step2_2);
- step3_2 = _mm_sub_epi16(step1_1, step2_2);
- step3_3 = _mm_sub_epi16(step1_0, step2_3);
- step3_4 = _mm_sub_epi16(step1_7, step2_4);
- step3_5 = _mm_sub_epi16(step1_6, step2_5);
- step3_6 = _mm_add_epi16(step1_6, step2_5);
- step3_7 = _mm_add_epi16(step1_7, step2_4);
- }
- // step 4
- {
- const __m128i t0 = _mm_unpacklo_epi16(step3_1, step3_6);
- const __m128i t1 = _mm_unpackhi_epi16(step3_1, step3_6);
- const __m128i t2 = _mm_unpacklo_epi16(step3_2, step3_5);
- const __m128i t3 = _mm_unpackhi_epi16(step3_2, step3_5);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_m08_p24);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_m08_p24);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m24_m08);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m24_m08);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_1 = _mm_packs_epi32(w0, w1);
- step2_2 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step3_1, step3_6);
- const __m128i t1 = _mm_unpackhi_epi16(step3_1, step3_6);
- const __m128i t2 = _mm_unpacklo_epi16(step3_2, step3_5);
- const __m128i t3 = _mm_unpackhi_epi16(step3_2, step3_5);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p24_p08);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p24_p08);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m08_p24);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m08_p24);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- step2_6 = _mm_packs_epi32(w0, w1);
- step2_5 = _mm_packs_epi32(w2, w3);
- }
- // step 5
- {
- step1_0 = _mm_add_epi16(step3_0, step2_1);
- step1_1 = _mm_sub_epi16(step3_0, step2_1);
- step1_2 = _mm_sub_epi16(step3_3, step2_2);
- step1_3 = _mm_add_epi16(step3_3, step2_2);
- step1_4 = _mm_add_epi16(step3_4, step2_5);
- step1_5 = _mm_sub_epi16(step3_4, step2_5);
- step1_6 = _mm_sub_epi16(step3_7, step2_6);
- step1_7 = _mm_add_epi16(step3_7, step2_6);
- }
- // step 6
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_0, step1_7);
- const __m128i t1 = _mm_unpackhi_epi16(step1_0, step1_7);
- const __m128i t2 = _mm_unpacklo_epi16(step1_1, step1_6);
- const __m128i t3 = _mm_unpackhi_epi16(step1_1, step1_6);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p30_p02);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p30_p02);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p14_p18);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p14_p18);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res01 = _mm_packs_epi32(w0, w1);
- res09 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_2, step1_5);
- const __m128i t1 = _mm_unpackhi_epi16(step1_2, step1_5);
- const __m128i t2 = _mm_unpacklo_epi16(step1_3, step1_4);
- const __m128i t3 = _mm_unpackhi_epi16(step1_3, step1_4);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_p22_p10);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_p22_p10);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_p06_p26);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_p06_p26);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res05 = _mm_packs_epi32(w0, w1);
- res13 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_2, step1_5);
- const __m128i t1 = _mm_unpackhi_epi16(step1_2, step1_5);
- const __m128i t2 = _mm_unpacklo_epi16(step1_3, step1_4);
- const __m128i t3 = _mm_unpackhi_epi16(step1_3, step1_4);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_m10_p22);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_m10_p22);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m26_p06);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m26_p06);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res11 = _mm_packs_epi32(w0, w1);
- res03 = _mm_packs_epi32(w2, w3);
- }
- {
- const __m128i t0 = _mm_unpacklo_epi16(step1_0, step1_7);
- const __m128i t1 = _mm_unpackhi_epi16(step1_0, step1_7);
- const __m128i t2 = _mm_unpacklo_epi16(step1_1, step1_6);
- const __m128i t3 = _mm_unpackhi_epi16(step1_1, step1_6);
- const __m128i u0 = _mm_madd_epi16(t0, k__cospi_m02_p30);
- const __m128i u1 = _mm_madd_epi16(t1, k__cospi_m02_p30);
- const __m128i u2 = _mm_madd_epi16(t2, k__cospi_m18_p14);
- const __m128i u3 = _mm_madd_epi16(t3, k__cospi_m18_p14);
- // dct_const_round_shift
- const __m128i v0 = _mm_add_epi32(u0, k__DCT_CONST_ROUNDING);
- const __m128i v1 = _mm_add_epi32(u1, k__DCT_CONST_ROUNDING);
- const __m128i v2 = _mm_add_epi32(u2, k__DCT_CONST_ROUNDING);
- const __m128i v3 = _mm_add_epi32(u3, k__DCT_CONST_ROUNDING);
- const __m128i w0 = _mm_srai_epi32(v0, DCT_CONST_BITS);
- const __m128i w1 = _mm_srai_epi32(v1, DCT_CONST_BITS);
- const __m128i w2 = _mm_srai_epi32(v2, DCT_CONST_BITS);
- const __m128i w3 = _mm_srai_epi32(v3, DCT_CONST_BITS);
- // Combine
- res15 = _mm_packs_epi32(w0, w1);
- res07 = _mm_packs_epi32(w2, w3);
- }
- }
- // Transpose the results, do it as two 8x8 transposes.
- {
- // 00 01 02 03 04 05 06 07
- // 10 11 12 13 14 15 16 17
- // 20 21 22 23 24 25 26 27
- // 30 31 32 33 34 35 36 37
- // 40 41 42 43 44 45 46 47
- // 50 51 52 53 54 55 56 57
- // 60 61 62 63 64 65 66 67
- // 70 71 72 73 74 75 76 77
- const __m128i tr0_0 = _mm_unpacklo_epi16(res00, res01);
- const __m128i tr0_1 = _mm_unpacklo_epi16(res02, res03);
- const __m128i tr0_2 = _mm_unpackhi_epi16(res00, res01);
- const __m128i tr0_3 = _mm_unpackhi_epi16(res02, res03);
- const __m128i tr0_4 = _mm_unpacklo_epi16(res04, res05);
- const __m128i tr0_5 = _mm_unpacklo_epi16(res06, res07);
- const __m128i tr0_6 = _mm_unpackhi_epi16(res04, res05);
- const __m128i tr0_7 = _mm_unpackhi_epi16(res06, res07);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 54 54 55 55 56 56 57 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 21 36
- // 44 54 64 74 45 55 61 76
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- const __m128i tr2_0 = _mm_unpacklo_epi64(tr1_0, tr1_4);
- const __m128i tr2_1 = _mm_unpackhi_epi64(tr1_0, tr1_4);
- const __m128i tr2_2 = _mm_unpacklo_epi64(tr1_2, tr1_6);
- const __m128i tr2_3 = _mm_unpackhi_epi64(tr1_2, tr1_6);
- const __m128i tr2_4 = _mm_unpacklo_epi64(tr1_1, tr1_5);
- const __m128i tr2_5 = _mm_unpackhi_epi64(tr1_1, tr1_5);
- const __m128i tr2_6 = _mm_unpacklo_epi64(tr1_3, tr1_7);
- const __m128i tr2_7 = _mm_unpackhi_epi64(tr1_3, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
- _mm_storeu_si128((__m128i *)(out + 0 * 16), tr2_0);
- _mm_storeu_si128((__m128i *)(out + 1 * 16), tr2_1);
- _mm_storeu_si128((__m128i *)(out + 2 * 16), tr2_2);
- _mm_storeu_si128((__m128i *)(out + 3 * 16), tr2_3);
- _mm_storeu_si128((__m128i *)(out + 4 * 16), tr2_4);
- _mm_storeu_si128((__m128i *)(out + 5 * 16), tr2_5);
- _mm_storeu_si128((__m128i *)(out + 6 * 16), tr2_6);
- _mm_storeu_si128((__m128i *)(out + 7 * 16), tr2_7);
- }
- {
- // 00 01 02 03 04 05 06 07
- // 10 11 12 13 14 15 16 17
- // 20 21 22 23 24 25 26 27
- // 30 31 32 33 34 35 36 37
- // 40 41 42 43 44 45 46 47
- // 50 51 52 53 54 55 56 57
- // 60 61 62 63 64 65 66 67
- // 70 71 72 73 74 75 76 77
- const __m128i tr0_0 = _mm_unpacklo_epi16(res08, res09);
- const __m128i tr0_1 = _mm_unpacklo_epi16(res10, res11);
- const __m128i tr0_2 = _mm_unpackhi_epi16(res08, res09);
- const __m128i tr0_3 = _mm_unpackhi_epi16(res10, res11);
- const __m128i tr0_4 = _mm_unpacklo_epi16(res12, res13);
- const __m128i tr0_5 = _mm_unpacklo_epi16(res14, res15);
- const __m128i tr0_6 = _mm_unpackhi_epi16(res12, res13);
- const __m128i tr0_7 = _mm_unpackhi_epi16(res14, res15);
- // 00 10 01 11 02 12 03 13
- // 20 30 21 31 22 32 23 33
- // 04 14 05 15 06 16 07 17
- // 24 34 25 35 26 36 27 37
- // 40 50 41 51 42 52 43 53
- // 60 70 61 71 62 72 63 73
- // 54 54 55 55 56 56 57 57
- // 64 74 65 75 66 76 67 77
- const __m128i tr1_0 = _mm_unpacklo_epi32(tr0_0, tr0_1);
- const __m128i tr1_1 = _mm_unpacklo_epi32(tr0_2, tr0_3);
- const __m128i tr1_2 = _mm_unpackhi_epi32(tr0_0, tr0_1);
- const __m128i tr1_3 = _mm_unpackhi_epi32(tr0_2, tr0_3);
- const __m128i tr1_4 = _mm_unpacklo_epi32(tr0_4, tr0_5);
- const __m128i tr1_5 = _mm_unpacklo_epi32(tr0_6, tr0_7);
- const __m128i tr1_6 = _mm_unpackhi_epi32(tr0_4, tr0_5);
- const __m128i tr1_7 = _mm_unpackhi_epi32(tr0_6, tr0_7);
- // 00 10 20 30 01 11 21 31
- // 40 50 60 70 41 51 61 71
- // 02 12 22 32 03 13 23 33
- // 42 52 62 72 43 53 63 73
- // 04 14 24 34 05 15 21 36
- // 44 54 64 74 45 55 61 76
- // 06 16 26 36 07 17 27 37
- // 46 56 66 76 47 57 67 77
- const __m128i tr2_0 = _mm_unpacklo_epi64(tr1_0, tr1_4);
- const __m128i tr2_1 = _mm_unpackhi_epi64(tr1_0, tr1_4);
- const __m128i tr2_2 = _mm_unpacklo_epi64(tr1_2, tr1_6);
- const __m128i tr2_3 = _mm_unpackhi_epi64(tr1_2, tr1_6);
- const __m128i tr2_4 = _mm_unpacklo_epi64(tr1_1, tr1_5);
- const __m128i tr2_5 = _mm_unpackhi_epi64(tr1_1, tr1_5);
- const __m128i tr2_6 = _mm_unpacklo_epi64(tr1_3, tr1_7);
- const __m128i tr2_7 = _mm_unpackhi_epi64(tr1_3, tr1_7);
- // 00 10 20 30 40 50 60 70
- // 01 11 21 31 41 51 61 71
- // 02 12 22 32 42 52 62 72
- // 03 13 23 33 43 53 63 73
- // 04 14 24 34 44 54 64 74
- // 05 15 25 35 45 55 65 75
- // 06 16 26 36 46 56 66 76
- // 07 17 27 37 47 57 67 77
- // Store results
- _mm_store_si128((__m128i *)(out + 8 + 0 * 16), tr2_0);
- _mm_store_si128((__m128i *)(out + 8 + 1 * 16), tr2_1);
- _mm_store_si128((__m128i *)(out + 8 + 2 * 16), tr2_2);
- _mm_store_si128((__m128i *)(out + 8 + 3 * 16), tr2_3);
- _mm_store_si128((__m128i *)(out + 8 + 4 * 16), tr2_4);
- _mm_store_si128((__m128i *)(out + 8 + 5 * 16), tr2_5);
- _mm_store_si128((__m128i *)(out + 8 + 6 * 16), tr2_6);
- _mm_store_si128((__m128i *)(out + 8 + 7 * 16), tr2_7);
- }
- out += 8*16;
- }
- // Setup in/out for next pass.
- in = intermediate;
- out = output;
- }
-}
-
-static INLINE void load_buffer_16x16(const int16_t* input, __m128i *in0,
- __m128i *in1, int stride) {
- // load first 8 columns
- load_buffer_8x8(input, in0, stride);
- load_buffer_8x8(input + 8 * stride, in0 + 8, stride);
-
- input += 8;
- // load second 8 columns
- load_buffer_8x8(input, in1, stride);
- load_buffer_8x8(input + 8 * stride, in1 + 8, stride);
-}
-
-static INLINE void write_buffer_16x16(int16_t *output, __m128i *in0,
- __m128i *in1, int stride) {
- // write first 8 columns
- write_buffer_8x8(output, in0, stride);
- write_buffer_8x8(output + 8 * stride, in0 + 8, stride);
- // write second 8 columns
- output += 8;
- write_buffer_8x8(output, in1, stride);
- write_buffer_8x8(output + 8 * stride, in1 + 8, stride);
-}
-
-static INLINE void array_transpose_16x16(__m128i *res0, __m128i *res1) {
- __m128i tbuf[8];
- array_transpose_8x8(res0, res0);
- array_transpose_8x8(res1, tbuf);
- array_transpose_8x8(res0 + 8, res1);
- array_transpose_8x8(res1 + 8, res1 + 8);
-
- res0[8] = tbuf[0];
- res0[9] = tbuf[1];
- res0[10] = tbuf[2];
- res0[11] = tbuf[3];
- res0[12] = tbuf[4];
- res0[13] = tbuf[5];
- res0[14] = tbuf[6];
- res0[15] = tbuf[7];
-}
-
-static INLINE void right_shift_16x16(__m128i *res0, __m128i *res1) {
- // perform rounding operations
- right_shift_8x8(res0, 2);
- right_shift_8x8(res0 + 8, 2);
- right_shift_8x8(res1, 2);
- right_shift_8x8(res1 + 8, 2);
-}
-
-void fdct16_8col(__m128i *in) {
- // perform 16x16 1-D DCT for 8 columns
- __m128i i[8], s[8], p[8], t[8], u[16], v[16];
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_m16_p16 = pair_set_epi16(-cospi_16_64, cospi_16_64);
- const __m128i k__cospi_p24_p08 = pair_set_epi16(cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m24_m08 = pair_set_epi16(-cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m08_p24 = pair_set_epi16(-cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p28_p04 = pair_set_epi16(cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m04_p28 = pair_set_epi16(-cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p12_p20 = pair_set_epi16(cospi_12_64, cospi_20_64);
- const __m128i k__cospi_m20_p12 = pair_set_epi16(-cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p30_p02 = pair_set_epi16(cospi_30_64, cospi_2_64);
- const __m128i k__cospi_p14_p18 = pair_set_epi16(cospi_14_64, cospi_18_64);
- const __m128i k__cospi_m02_p30 = pair_set_epi16(-cospi_2_64, cospi_30_64);
- const __m128i k__cospi_m18_p14 = pair_set_epi16(-cospi_18_64, cospi_14_64);
- const __m128i k__cospi_p22_p10 = pair_set_epi16(cospi_22_64, cospi_10_64);
- const __m128i k__cospi_p06_p26 = pair_set_epi16(cospi_6_64, cospi_26_64);
- const __m128i k__cospi_m10_p22 = pair_set_epi16(-cospi_10_64, cospi_22_64);
- const __m128i k__cospi_m26_p06 = pair_set_epi16(-cospi_26_64, cospi_6_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
-
- // stage 1
- i[0] = _mm_add_epi16(in[0], in[15]);
- i[1] = _mm_add_epi16(in[1], in[14]);
- i[2] = _mm_add_epi16(in[2], in[13]);
- i[3] = _mm_add_epi16(in[3], in[12]);
- i[4] = _mm_add_epi16(in[4], in[11]);
- i[5] = _mm_add_epi16(in[5], in[10]);
- i[6] = _mm_add_epi16(in[6], in[9]);
- i[7] = _mm_add_epi16(in[7], in[8]);
-
- s[0] = _mm_sub_epi16(in[7], in[8]);
- s[1] = _mm_sub_epi16(in[6], in[9]);
- s[2] = _mm_sub_epi16(in[5], in[10]);
- s[3] = _mm_sub_epi16(in[4], in[11]);
- s[4] = _mm_sub_epi16(in[3], in[12]);
- s[5] = _mm_sub_epi16(in[2], in[13]);
- s[6] = _mm_sub_epi16(in[1], in[14]);
- s[7] = _mm_sub_epi16(in[0], in[15]);
-
- p[0] = _mm_add_epi16(i[0], i[7]);
- p[1] = _mm_add_epi16(i[1], i[6]);
- p[2] = _mm_add_epi16(i[2], i[5]);
- p[3] = _mm_add_epi16(i[3], i[4]);
- p[4] = _mm_sub_epi16(i[3], i[4]);
- p[5] = _mm_sub_epi16(i[2], i[5]);
- p[6] = _mm_sub_epi16(i[1], i[6]);
- p[7] = _mm_sub_epi16(i[0], i[7]);
-
- u[0] = _mm_add_epi16(p[0], p[3]);
- u[1] = _mm_add_epi16(p[1], p[2]);
- u[2] = _mm_sub_epi16(p[1], p[2]);
- u[3] = _mm_sub_epi16(p[0], p[3]);
-
- v[0] = _mm_unpacklo_epi16(u[0], u[1]);
- v[1] = _mm_unpackhi_epi16(u[0], u[1]);
- v[2] = _mm_unpacklo_epi16(u[2], u[3]);
- v[3] = _mm_unpackhi_epi16(u[2], u[3]);
-
- u[0] = _mm_madd_epi16(v[0], k__cospi_p16_p16);
- u[1] = _mm_madd_epi16(v[1], k__cospi_p16_p16);
- u[2] = _mm_madd_epi16(v[0], k__cospi_p16_m16);
- u[3] = _mm_madd_epi16(v[1], k__cospi_p16_m16);
- u[4] = _mm_madd_epi16(v[2], k__cospi_p24_p08);
- u[5] = _mm_madd_epi16(v[3], k__cospi_p24_p08);
- u[6] = _mm_madd_epi16(v[2], k__cospi_m08_p24);
- u[7] = _mm_madd_epi16(v[3], k__cospi_m08_p24);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
-
- in[0] = _mm_packs_epi32(u[0], u[1]);
- in[4] = _mm_packs_epi32(u[4], u[5]);
- in[8] = _mm_packs_epi32(u[2], u[3]);
- in[12] = _mm_packs_epi32(u[6], u[7]);
-
- u[0] = _mm_unpacklo_epi16(p[5], p[6]);
- u[1] = _mm_unpackhi_epi16(p[5], p[6]);
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_p16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_p16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_p16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
-
- u[0] = _mm_packs_epi32(v[0], v[1]);
- u[1] = _mm_packs_epi32(v[2], v[3]);
-
- t[0] = _mm_add_epi16(p[4], u[0]);
- t[1] = _mm_sub_epi16(p[4], u[0]);
- t[2] = _mm_sub_epi16(p[7], u[1]);
- t[3] = _mm_add_epi16(p[7], u[1]);
-
- u[0] = _mm_unpacklo_epi16(t[0], t[3]);
- u[1] = _mm_unpackhi_epi16(t[0], t[3]);
- u[2] = _mm_unpacklo_epi16(t[1], t[2]);
- u[3] = _mm_unpackhi_epi16(t[1], t[2]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p28_p04);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p28_p04);
- v[2] = _mm_madd_epi16(u[2], k__cospi_p12_p20);
- v[3] = _mm_madd_epi16(u[3], k__cospi_p12_p20);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m20_p12);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m20_p12);
- v[6] = _mm_madd_epi16(u[0], k__cospi_m04_p28);
- v[7] = _mm_madd_epi16(u[1], k__cospi_m04_p28);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- in[2] = _mm_packs_epi32(v[0], v[1]);
- in[6] = _mm_packs_epi32(v[4], v[5]);
- in[10] = _mm_packs_epi32(v[2], v[3]);
- in[14] = _mm_packs_epi32(v[6], v[7]);
-
- // stage 2
- u[0] = _mm_unpacklo_epi16(s[2], s[5]);
- u[1] = _mm_unpackhi_epi16(s[2], s[5]);
- u[2] = _mm_unpacklo_epi16(s[3], s[4]);
- u[3] = _mm_unpackhi_epi16(s[3], s[4]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_p16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_p16);
- v[2] = _mm_madd_epi16(u[2], k__cospi_m16_p16);
- v[3] = _mm_madd_epi16(u[3], k__cospi_m16_p16);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p16_p16);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p16_p16);
- v[6] = _mm_madd_epi16(u[0], k__cospi_p16_p16);
- v[7] = _mm_madd_epi16(u[1], k__cospi_p16_p16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- t[2] = _mm_packs_epi32(v[0], v[1]);
- t[3] = _mm_packs_epi32(v[2], v[3]);
- t[4] = _mm_packs_epi32(v[4], v[5]);
- t[5] = _mm_packs_epi32(v[6], v[7]);
-
- // stage 3
- p[0] = _mm_add_epi16(s[0], t[3]);
- p[1] = _mm_add_epi16(s[1], t[2]);
- p[2] = _mm_sub_epi16(s[1], t[2]);
- p[3] = _mm_sub_epi16(s[0], t[3]);
- p[4] = _mm_sub_epi16(s[7], t[4]);
- p[5] = _mm_sub_epi16(s[6], t[5]);
- p[6] = _mm_add_epi16(s[6], t[5]);
- p[7] = _mm_add_epi16(s[7], t[4]);
-
- // stage 4
- u[0] = _mm_unpacklo_epi16(p[1], p[6]);
- u[1] = _mm_unpackhi_epi16(p[1], p[6]);
- u[2] = _mm_unpacklo_epi16(p[2], p[5]);
- u[3] = _mm_unpackhi_epi16(p[2], p[5]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m08_p24);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m08_p24);
- v[2] = _mm_madd_epi16(u[2], k__cospi_m24_m08);
- v[3] = _mm_madd_epi16(u[3], k__cospi_m24_m08);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m08_p24);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m08_p24);
- v[6] = _mm_madd_epi16(u[0], k__cospi_p24_p08);
- v[7] = _mm_madd_epi16(u[1], k__cospi_p24_p08);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
-
- t[1] = _mm_packs_epi32(v[0], v[1]);
- t[2] = _mm_packs_epi32(v[2], v[3]);
- t[5] = _mm_packs_epi32(v[4], v[5]);
- t[6] = _mm_packs_epi32(v[6], v[7]);
-
- // stage 5
- s[0] = _mm_add_epi16(p[0], t[1]);
- s[1] = _mm_sub_epi16(p[0], t[1]);
- s[2] = _mm_sub_epi16(p[3], t[2]);
- s[3] = _mm_add_epi16(p[3], t[2]);
- s[4] = _mm_add_epi16(p[4], t[5]);
- s[5] = _mm_sub_epi16(p[4], t[5]);
- s[6] = _mm_sub_epi16(p[7], t[6]);
- s[7] = _mm_add_epi16(p[7], t[6]);
-
- // stage 6
- u[0] = _mm_unpacklo_epi16(s[0], s[7]);
- u[1] = _mm_unpackhi_epi16(s[0], s[7]);
- u[2] = _mm_unpacklo_epi16(s[1], s[6]);
- u[3] = _mm_unpackhi_epi16(s[1], s[6]);
- u[4] = _mm_unpacklo_epi16(s[2], s[5]);
- u[5] = _mm_unpackhi_epi16(s[2], s[5]);
- u[6] = _mm_unpacklo_epi16(s[3], s[4]);
- u[7] = _mm_unpackhi_epi16(s[3], s[4]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p30_p02);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p30_p02);
- v[2] = _mm_madd_epi16(u[2], k__cospi_p14_p18);
- v[3] = _mm_madd_epi16(u[3], k__cospi_p14_p18);
- v[4] = _mm_madd_epi16(u[4], k__cospi_p22_p10);
- v[5] = _mm_madd_epi16(u[5], k__cospi_p22_p10);
- v[6] = _mm_madd_epi16(u[6], k__cospi_p06_p26);
- v[7] = _mm_madd_epi16(u[7], k__cospi_p06_p26);
- v[8] = _mm_madd_epi16(u[6], k__cospi_m26_p06);
- v[9] = _mm_madd_epi16(u[7], k__cospi_m26_p06);
- v[10] = _mm_madd_epi16(u[4], k__cospi_m10_p22);
- v[11] = _mm_madd_epi16(u[5], k__cospi_m10_p22);
- v[12] = _mm_madd_epi16(u[2], k__cospi_m18_p14);
- v[13] = _mm_madd_epi16(u[3], k__cospi_m18_p14);
- v[14] = _mm_madd_epi16(u[0], k__cospi_m02_p30);
- v[15] = _mm_madd_epi16(u[1], k__cospi_m02_p30);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(v[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(v[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(v[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(v[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(v[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(v[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(v[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(v[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- in[1] = _mm_packs_epi32(v[0], v[1]);
- in[9] = _mm_packs_epi32(v[2], v[3]);
- in[5] = _mm_packs_epi32(v[4], v[5]);
- in[13] = _mm_packs_epi32(v[6], v[7]);
- in[3] = _mm_packs_epi32(v[8], v[9]);
- in[11] = _mm_packs_epi32(v[10], v[11]);
- in[7] = _mm_packs_epi32(v[12], v[13]);
- in[15] = _mm_packs_epi32(v[14], v[15]);
-}
-
-void fadst16_8col(__m128i *in) {
- // perform 16x16 1-D ADST for 8 columns
- __m128i s[16], x[16], u[32], v[32];
- const __m128i k__cospi_p01_p31 = pair_set_epi16(cospi_1_64, cospi_31_64);
- const __m128i k__cospi_p31_m01 = pair_set_epi16(cospi_31_64, -cospi_1_64);
- const __m128i k__cospi_p05_p27 = pair_set_epi16(cospi_5_64, cospi_27_64);
- const __m128i k__cospi_p27_m05 = pair_set_epi16(cospi_27_64, -cospi_5_64);
- const __m128i k__cospi_p09_p23 = pair_set_epi16(cospi_9_64, cospi_23_64);
- const __m128i k__cospi_p23_m09 = pair_set_epi16(cospi_23_64, -cospi_9_64);
- const __m128i k__cospi_p13_p19 = pair_set_epi16(cospi_13_64, cospi_19_64);
- const __m128i k__cospi_p19_m13 = pair_set_epi16(cospi_19_64, -cospi_13_64);
- const __m128i k__cospi_p17_p15 = pair_set_epi16(cospi_17_64, cospi_15_64);
- const __m128i k__cospi_p15_m17 = pair_set_epi16(cospi_15_64, -cospi_17_64);
- const __m128i k__cospi_p21_p11 = pair_set_epi16(cospi_21_64, cospi_11_64);
- const __m128i k__cospi_p11_m21 = pair_set_epi16(cospi_11_64, -cospi_21_64);
- const __m128i k__cospi_p25_p07 = pair_set_epi16(cospi_25_64, cospi_7_64);
- const __m128i k__cospi_p07_m25 = pair_set_epi16(cospi_7_64, -cospi_25_64);
- const __m128i k__cospi_p29_p03 = pair_set_epi16(cospi_29_64, cospi_3_64);
- const __m128i k__cospi_p03_m29 = pair_set_epi16(cospi_3_64, -cospi_29_64);
- const __m128i k__cospi_p04_p28 = pair_set_epi16(cospi_4_64, cospi_28_64);
- const __m128i k__cospi_p28_m04 = pair_set_epi16(cospi_28_64, -cospi_4_64);
- const __m128i k__cospi_p20_p12 = pair_set_epi16(cospi_20_64, cospi_12_64);
- const __m128i k__cospi_p12_m20 = pair_set_epi16(cospi_12_64, -cospi_20_64);
- const __m128i k__cospi_m28_p04 = pair_set_epi16(-cospi_28_64, cospi_4_64);
- const __m128i k__cospi_m12_p20 = pair_set_epi16(-cospi_12_64, cospi_20_64);
- const __m128i k__cospi_p08_p24 = pair_set_epi16(cospi_8_64, cospi_24_64);
- const __m128i k__cospi_p24_m08 = pair_set_epi16(cospi_24_64, -cospi_8_64);
- const __m128i k__cospi_m24_p08 = pair_set_epi16(-cospi_24_64, cospi_8_64);
- const __m128i k__cospi_m16_m16 = _mm_set1_epi16(-cospi_16_64);
- const __m128i k__cospi_p16_p16 = _mm_set1_epi16(cospi_16_64);
- const __m128i k__cospi_p16_m16 = pair_set_epi16(cospi_16_64, -cospi_16_64);
- const __m128i k__cospi_m16_p16 = pair_set_epi16(-cospi_16_64, cospi_16_64);
- const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32(DCT_CONST_ROUNDING);
- const __m128i kZero = _mm_set1_epi16(0);
-
- u[0] = _mm_unpacklo_epi16(in[15], in[0]);
- u[1] = _mm_unpackhi_epi16(in[15], in[0]);
- u[2] = _mm_unpacklo_epi16(in[13], in[2]);
- u[3] = _mm_unpackhi_epi16(in[13], in[2]);
- u[4] = _mm_unpacklo_epi16(in[11], in[4]);
- u[5] = _mm_unpackhi_epi16(in[11], in[4]);
- u[6] = _mm_unpacklo_epi16(in[9], in[6]);
- u[7] = _mm_unpackhi_epi16(in[9], in[6]);
- u[8] = _mm_unpacklo_epi16(in[7], in[8]);
- u[9] = _mm_unpackhi_epi16(in[7], in[8]);
- u[10] = _mm_unpacklo_epi16(in[5], in[10]);
- u[11] = _mm_unpackhi_epi16(in[5], in[10]);
- u[12] = _mm_unpacklo_epi16(in[3], in[12]);
- u[13] = _mm_unpackhi_epi16(in[3], in[12]);
- u[14] = _mm_unpacklo_epi16(in[1], in[14]);
- u[15] = _mm_unpackhi_epi16(in[1], in[14]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p01_p31);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p01_p31);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p31_m01);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p31_m01);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p05_p27);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p05_p27);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p27_m05);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p27_m05);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p09_p23);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p09_p23);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p23_m09);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p23_m09);
- v[12] = _mm_madd_epi16(u[6], k__cospi_p13_p19);
- v[13] = _mm_madd_epi16(u[7], k__cospi_p13_p19);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p19_m13);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p19_m13);
- v[16] = _mm_madd_epi16(u[8], k__cospi_p17_p15);
- v[17] = _mm_madd_epi16(u[9], k__cospi_p17_p15);
- v[18] = _mm_madd_epi16(u[8], k__cospi_p15_m17);
- v[19] = _mm_madd_epi16(u[9], k__cospi_p15_m17);
- v[20] = _mm_madd_epi16(u[10], k__cospi_p21_p11);
- v[21] = _mm_madd_epi16(u[11], k__cospi_p21_p11);
- v[22] = _mm_madd_epi16(u[10], k__cospi_p11_m21);
- v[23] = _mm_madd_epi16(u[11], k__cospi_p11_m21);
- v[24] = _mm_madd_epi16(u[12], k__cospi_p25_p07);
- v[25] = _mm_madd_epi16(u[13], k__cospi_p25_p07);
- v[26] = _mm_madd_epi16(u[12], k__cospi_p07_m25);
- v[27] = _mm_madd_epi16(u[13], k__cospi_p07_m25);
- v[28] = _mm_madd_epi16(u[14], k__cospi_p29_p03);
- v[29] = _mm_madd_epi16(u[15], k__cospi_p29_p03);
- v[30] = _mm_madd_epi16(u[14], k__cospi_p03_m29);
- v[31] = _mm_madd_epi16(u[15], k__cospi_p03_m29);
-
- u[0] = _mm_add_epi32(v[0], v[16]);
- u[1] = _mm_add_epi32(v[1], v[17]);
- u[2] = _mm_add_epi32(v[2], v[18]);
- u[3] = _mm_add_epi32(v[3], v[19]);
- u[4] = _mm_add_epi32(v[4], v[20]);
- u[5] = _mm_add_epi32(v[5], v[21]);
- u[6] = _mm_add_epi32(v[6], v[22]);
- u[7] = _mm_add_epi32(v[7], v[23]);
- u[8] = _mm_add_epi32(v[8], v[24]);
- u[9] = _mm_add_epi32(v[9], v[25]);
- u[10] = _mm_add_epi32(v[10], v[26]);
- u[11] = _mm_add_epi32(v[11], v[27]);
- u[12] = _mm_add_epi32(v[12], v[28]);
- u[13] = _mm_add_epi32(v[13], v[29]);
- u[14] = _mm_add_epi32(v[14], v[30]);
- u[15] = _mm_add_epi32(v[15], v[31]);
- u[16] = _mm_sub_epi32(v[0], v[16]);
- u[17] = _mm_sub_epi32(v[1], v[17]);
- u[18] = _mm_sub_epi32(v[2], v[18]);
- u[19] = _mm_sub_epi32(v[3], v[19]);
- u[20] = _mm_sub_epi32(v[4], v[20]);
- u[21] = _mm_sub_epi32(v[5], v[21]);
- u[22] = _mm_sub_epi32(v[6], v[22]);
- u[23] = _mm_sub_epi32(v[7], v[23]);
- u[24] = _mm_sub_epi32(v[8], v[24]);
- u[25] = _mm_sub_epi32(v[9], v[25]);
- u[26] = _mm_sub_epi32(v[10], v[26]);
- u[27] = _mm_sub_epi32(v[11], v[27]);
- u[28] = _mm_sub_epi32(v[12], v[28]);
- u[29] = _mm_sub_epi32(v[13], v[29]);
- u[30] = _mm_sub_epi32(v[14], v[30]);
- u[31] = _mm_sub_epi32(v[15], v[31]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- v[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- v[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
- v[16] = _mm_add_epi32(u[16], k__DCT_CONST_ROUNDING);
- v[17] = _mm_add_epi32(u[17], k__DCT_CONST_ROUNDING);
- v[18] = _mm_add_epi32(u[18], k__DCT_CONST_ROUNDING);
- v[19] = _mm_add_epi32(u[19], k__DCT_CONST_ROUNDING);
- v[20] = _mm_add_epi32(u[20], k__DCT_CONST_ROUNDING);
- v[21] = _mm_add_epi32(u[21], k__DCT_CONST_ROUNDING);
- v[22] = _mm_add_epi32(u[22], k__DCT_CONST_ROUNDING);
- v[23] = _mm_add_epi32(u[23], k__DCT_CONST_ROUNDING);
- v[24] = _mm_add_epi32(u[24], k__DCT_CONST_ROUNDING);
- v[25] = _mm_add_epi32(u[25], k__DCT_CONST_ROUNDING);
- v[26] = _mm_add_epi32(u[26], k__DCT_CONST_ROUNDING);
- v[27] = _mm_add_epi32(u[27], k__DCT_CONST_ROUNDING);
- v[28] = _mm_add_epi32(u[28], k__DCT_CONST_ROUNDING);
- v[29] = _mm_add_epi32(u[29], k__DCT_CONST_ROUNDING);
- v[30] = _mm_add_epi32(u[30], k__DCT_CONST_ROUNDING);
- v[31] = _mm_add_epi32(u[31], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(v[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(v[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
- u[16] = _mm_srai_epi32(v[16], DCT_CONST_BITS);
- u[17] = _mm_srai_epi32(v[17], DCT_CONST_BITS);
- u[18] = _mm_srai_epi32(v[18], DCT_CONST_BITS);
- u[19] = _mm_srai_epi32(v[19], DCT_CONST_BITS);
- u[20] = _mm_srai_epi32(v[20], DCT_CONST_BITS);
- u[21] = _mm_srai_epi32(v[21], DCT_CONST_BITS);
- u[22] = _mm_srai_epi32(v[22], DCT_CONST_BITS);
- u[23] = _mm_srai_epi32(v[23], DCT_CONST_BITS);
- u[24] = _mm_srai_epi32(v[24], DCT_CONST_BITS);
- u[25] = _mm_srai_epi32(v[25], DCT_CONST_BITS);
- u[26] = _mm_srai_epi32(v[26], DCT_CONST_BITS);
- u[27] = _mm_srai_epi32(v[27], DCT_CONST_BITS);
- u[28] = _mm_srai_epi32(v[28], DCT_CONST_BITS);
- u[29] = _mm_srai_epi32(v[29], DCT_CONST_BITS);
- u[30] = _mm_srai_epi32(v[30], DCT_CONST_BITS);
- u[31] = _mm_srai_epi32(v[31], DCT_CONST_BITS);
-
- s[0] = _mm_packs_epi32(u[0], u[1]);
- s[1] = _mm_packs_epi32(u[2], u[3]);
- s[2] = _mm_packs_epi32(u[4], u[5]);
- s[3] = _mm_packs_epi32(u[6], u[7]);
- s[4] = _mm_packs_epi32(u[8], u[9]);
- s[5] = _mm_packs_epi32(u[10], u[11]);
- s[6] = _mm_packs_epi32(u[12], u[13]);
- s[7] = _mm_packs_epi32(u[14], u[15]);
- s[8] = _mm_packs_epi32(u[16], u[17]);
- s[9] = _mm_packs_epi32(u[18], u[19]);
- s[10] = _mm_packs_epi32(u[20], u[21]);
- s[11] = _mm_packs_epi32(u[22], u[23]);
- s[12] = _mm_packs_epi32(u[24], u[25]);
- s[13] = _mm_packs_epi32(u[26], u[27]);
- s[14] = _mm_packs_epi32(u[28], u[29]);
- s[15] = _mm_packs_epi32(u[30], u[31]);
-
- // stage 2
- u[0] = _mm_unpacklo_epi16(s[8], s[9]);
- u[1] = _mm_unpackhi_epi16(s[8], s[9]);
- u[2] = _mm_unpacklo_epi16(s[10], s[11]);
- u[3] = _mm_unpackhi_epi16(s[10], s[11]);
- u[4] = _mm_unpacklo_epi16(s[12], s[13]);
- u[5] = _mm_unpackhi_epi16(s[12], s[13]);
- u[6] = _mm_unpacklo_epi16(s[14], s[15]);
- u[7] = _mm_unpackhi_epi16(s[14], s[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p04_p28);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p04_p28);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p28_m04);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p28_m04);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p20_p12);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p20_p12);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p12_m20);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p12_m20);
- v[8] = _mm_madd_epi16(u[4], k__cospi_m28_p04);
- v[9] = _mm_madd_epi16(u[5], k__cospi_m28_p04);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p04_p28);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p04_p28);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m12_p20);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m12_p20);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p20_p12);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p20_p12);
-
- u[0] = _mm_add_epi32(v[0], v[8]);
- u[1] = _mm_add_epi32(v[1], v[9]);
- u[2] = _mm_add_epi32(v[2], v[10]);
- u[3] = _mm_add_epi32(v[3], v[11]);
- u[4] = _mm_add_epi32(v[4], v[12]);
- u[5] = _mm_add_epi32(v[5], v[13]);
- u[6] = _mm_add_epi32(v[6], v[14]);
- u[7] = _mm_add_epi32(v[7], v[15]);
- u[8] = _mm_sub_epi32(v[0], v[8]);
- u[9] = _mm_sub_epi32(v[1], v[9]);
- u[10] = _mm_sub_epi32(v[2], v[10]);
- u[11] = _mm_sub_epi32(v[3], v[11]);
- u[12] = _mm_sub_epi32(v[4], v[12]);
- u[13] = _mm_sub_epi32(v[5], v[13]);
- u[14] = _mm_sub_epi32(v[6], v[14]);
- u[15] = _mm_sub_epi32(v[7], v[15]);
-
- v[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- v[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- v[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- v[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- v[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- v[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- v[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- v[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- v[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- v[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- v[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- v[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- v[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- v[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- v[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- v[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- u[0] = _mm_srai_epi32(v[0], DCT_CONST_BITS);
- u[1] = _mm_srai_epi32(v[1], DCT_CONST_BITS);
- u[2] = _mm_srai_epi32(v[2], DCT_CONST_BITS);
- u[3] = _mm_srai_epi32(v[3], DCT_CONST_BITS);
- u[4] = _mm_srai_epi32(v[4], DCT_CONST_BITS);
- u[5] = _mm_srai_epi32(v[5], DCT_CONST_BITS);
- u[6] = _mm_srai_epi32(v[6], DCT_CONST_BITS);
- u[7] = _mm_srai_epi32(v[7], DCT_CONST_BITS);
- u[8] = _mm_srai_epi32(v[8], DCT_CONST_BITS);
- u[9] = _mm_srai_epi32(v[9], DCT_CONST_BITS);
- u[10] = _mm_srai_epi32(v[10], DCT_CONST_BITS);
- u[11] = _mm_srai_epi32(v[11], DCT_CONST_BITS);
- u[12] = _mm_srai_epi32(v[12], DCT_CONST_BITS);
- u[13] = _mm_srai_epi32(v[13], DCT_CONST_BITS);
- u[14] = _mm_srai_epi32(v[14], DCT_CONST_BITS);
- u[15] = _mm_srai_epi32(v[15], DCT_CONST_BITS);
-
- x[0] = _mm_add_epi16(s[0], s[4]);
- x[1] = _mm_add_epi16(s[1], s[5]);
- x[2] = _mm_add_epi16(s[2], s[6]);
- x[3] = _mm_add_epi16(s[3], s[7]);
- x[4] = _mm_sub_epi16(s[0], s[4]);
- x[5] = _mm_sub_epi16(s[1], s[5]);
- x[6] = _mm_sub_epi16(s[2], s[6]);
- x[7] = _mm_sub_epi16(s[3], s[7]);
- x[8] = _mm_packs_epi32(u[0], u[1]);
- x[9] = _mm_packs_epi32(u[2], u[3]);
- x[10] = _mm_packs_epi32(u[4], u[5]);
- x[11] = _mm_packs_epi32(u[6], u[7]);
- x[12] = _mm_packs_epi32(u[8], u[9]);
- x[13] = _mm_packs_epi32(u[10], u[11]);
- x[14] = _mm_packs_epi32(u[12], u[13]);
- x[15] = _mm_packs_epi32(u[14], u[15]);
-
- // stage 3
- u[0] = _mm_unpacklo_epi16(x[4], x[5]);
- u[1] = _mm_unpackhi_epi16(x[4], x[5]);
- u[2] = _mm_unpacklo_epi16(x[6], x[7]);
- u[3] = _mm_unpackhi_epi16(x[6], x[7]);
- u[4] = _mm_unpacklo_epi16(x[12], x[13]);
- u[5] = _mm_unpackhi_epi16(x[12], x[13]);
- u[6] = _mm_unpacklo_epi16(x[14], x[15]);
- u[7] = _mm_unpackhi_epi16(x[14], x[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_p08_p24);
- v[1] = _mm_madd_epi16(u[1], k__cospi_p08_p24);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p24_m08);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p24_m08);
- v[4] = _mm_madd_epi16(u[2], k__cospi_m24_p08);
- v[5] = _mm_madd_epi16(u[3], k__cospi_m24_p08);
- v[6] = _mm_madd_epi16(u[2], k__cospi_p08_p24);
- v[7] = _mm_madd_epi16(u[3], k__cospi_p08_p24);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p08_p24);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p08_p24);
- v[10] = _mm_madd_epi16(u[4], k__cospi_p24_m08);
- v[11] = _mm_madd_epi16(u[5], k__cospi_p24_m08);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m24_p08);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m24_p08);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p08_p24);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p08_p24);
-
- u[0] = _mm_add_epi32(v[0], v[4]);
- u[1] = _mm_add_epi32(v[1], v[5]);
- u[2] = _mm_add_epi32(v[2], v[6]);
- u[3] = _mm_add_epi32(v[3], v[7]);
- u[4] = _mm_sub_epi32(v[0], v[4]);
- u[5] = _mm_sub_epi32(v[1], v[5]);
- u[6] = _mm_sub_epi32(v[2], v[6]);
- u[7] = _mm_sub_epi32(v[3], v[7]);
- u[8] = _mm_add_epi32(v[8], v[12]);
- u[9] = _mm_add_epi32(v[9], v[13]);
- u[10] = _mm_add_epi32(v[10], v[14]);
- u[11] = _mm_add_epi32(v[11], v[15]);
- u[12] = _mm_sub_epi32(v[8], v[12]);
- u[13] = _mm_sub_epi32(v[9], v[13]);
- u[14] = _mm_sub_epi32(v[10], v[14]);
- u[15] = _mm_sub_epi32(v[11], v[15]);
-
- u[0] = _mm_add_epi32(u[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(u[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(u[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(u[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(u[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(u[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(u[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(u[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(u[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(u[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(u[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(u[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(u[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(u[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(u[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(u[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- s[0] = _mm_add_epi16(x[0], x[2]);
- s[1] = _mm_add_epi16(x[1], x[3]);
- s[2] = _mm_sub_epi16(x[0], x[2]);
- s[3] = _mm_sub_epi16(x[1], x[3]);
- s[4] = _mm_packs_epi32(v[0], v[1]);
- s[5] = _mm_packs_epi32(v[2], v[3]);
- s[6] = _mm_packs_epi32(v[4], v[5]);
- s[7] = _mm_packs_epi32(v[6], v[7]);
- s[8] = _mm_add_epi16(x[8], x[10]);
- s[9] = _mm_add_epi16(x[9], x[11]);
- s[10] = _mm_sub_epi16(x[8], x[10]);
- s[11] = _mm_sub_epi16(x[9], x[11]);
- s[12] = _mm_packs_epi32(v[8], v[9]);
- s[13] = _mm_packs_epi32(v[10], v[11]);
- s[14] = _mm_packs_epi32(v[12], v[13]);
- s[15] = _mm_packs_epi32(v[14], v[15]);
-
- // stage 4
- u[0] = _mm_unpacklo_epi16(s[2], s[3]);
- u[1] = _mm_unpackhi_epi16(s[2], s[3]);
- u[2] = _mm_unpacklo_epi16(s[6], s[7]);
- u[3] = _mm_unpackhi_epi16(s[6], s[7]);
- u[4] = _mm_unpacklo_epi16(s[10], s[11]);
- u[5] = _mm_unpackhi_epi16(s[10], s[11]);
- u[6] = _mm_unpacklo_epi16(s[14], s[15]);
- u[7] = _mm_unpackhi_epi16(s[14], s[15]);
-
- v[0] = _mm_madd_epi16(u[0], k__cospi_m16_m16);
- v[1] = _mm_madd_epi16(u[1], k__cospi_m16_m16);
- v[2] = _mm_madd_epi16(u[0], k__cospi_p16_m16);
- v[3] = _mm_madd_epi16(u[1], k__cospi_p16_m16);
- v[4] = _mm_madd_epi16(u[2], k__cospi_p16_p16);
- v[5] = _mm_madd_epi16(u[3], k__cospi_p16_p16);
- v[6] = _mm_madd_epi16(u[2], k__cospi_m16_p16);
- v[7] = _mm_madd_epi16(u[3], k__cospi_m16_p16);
- v[8] = _mm_madd_epi16(u[4], k__cospi_p16_p16);
- v[9] = _mm_madd_epi16(u[5], k__cospi_p16_p16);
- v[10] = _mm_madd_epi16(u[4], k__cospi_m16_p16);
- v[11] = _mm_madd_epi16(u[5], k__cospi_m16_p16);
- v[12] = _mm_madd_epi16(u[6], k__cospi_m16_m16);
- v[13] = _mm_madd_epi16(u[7], k__cospi_m16_m16);
- v[14] = _mm_madd_epi16(u[6], k__cospi_p16_m16);
- v[15] = _mm_madd_epi16(u[7], k__cospi_p16_m16);
-
- u[0] = _mm_add_epi32(v[0], k__DCT_CONST_ROUNDING);
- u[1] = _mm_add_epi32(v[1], k__DCT_CONST_ROUNDING);
- u[2] = _mm_add_epi32(v[2], k__DCT_CONST_ROUNDING);
- u[3] = _mm_add_epi32(v[3], k__DCT_CONST_ROUNDING);
- u[4] = _mm_add_epi32(v[4], k__DCT_CONST_ROUNDING);
- u[5] = _mm_add_epi32(v[5], k__DCT_CONST_ROUNDING);
- u[6] = _mm_add_epi32(v[6], k__DCT_CONST_ROUNDING);
- u[7] = _mm_add_epi32(v[7], k__DCT_CONST_ROUNDING);
- u[8] = _mm_add_epi32(v[8], k__DCT_CONST_ROUNDING);
- u[9] = _mm_add_epi32(v[9], k__DCT_CONST_ROUNDING);
- u[10] = _mm_add_epi32(v[10], k__DCT_CONST_ROUNDING);
- u[11] = _mm_add_epi32(v[11], k__DCT_CONST_ROUNDING);
- u[12] = _mm_add_epi32(v[12], k__DCT_CONST_ROUNDING);
- u[13] = _mm_add_epi32(v[13], k__DCT_CONST_ROUNDING);
- u[14] = _mm_add_epi32(v[14], k__DCT_CONST_ROUNDING);
- u[15] = _mm_add_epi32(v[15], k__DCT_CONST_ROUNDING);
-
- v[0] = _mm_srai_epi32(u[0], DCT_CONST_BITS);
- v[1] = _mm_srai_epi32(u[1], DCT_CONST_BITS);
- v[2] = _mm_srai_epi32(u[2], DCT_CONST_BITS);
- v[3] = _mm_srai_epi32(u[3], DCT_CONST_BITS);
- v[4] = _mm_srai_epi32(u[4], DCT_CONST_BITS);
- v[5] = _mm_srai_epi32(u[5], DCT_CONST_BITS);
- v[6] = _mm_srai_epi32(u[6], DCT_CONST_BITS);
- v[7] = _mm_srai_epi32(u[7], DCT_CONST_BITS);
- v[8] = _mm_srai_epi32(u[8], DCT_CONST_BITS);
- v[9] = _mm_srai_epi32(u[9], DCT_CONST_BITS);
- v[10] = _mm_srai_epi32(u[10], DCT_CONST_BITS);
- v[11] = _mm_srai_epi32(u[11], DCT_CONST_BITS);
- v[12] = _mm_srai_epi32(u[12], DCT_CONST_BITS);
- v[13] = _mm_srai_epi32(u[13], DCT_CONST_BITS);
- v[14] = _mm_srai_epi32(u[14], DCT_CONST_BITS);
- v[15] = _mm_srai_epi32(u[15], DCT_CONST_BITS);
-
- in[0] = s[0];
- in[1] = _mm_sub_epi16(kZero, s[8]);
- in[2] = s[12];
- in[3] = _mm_sub_epi16(kZero, s[4]);
- in[4] = _mm_packs_epi32(v[4], v[5]);
- in[5] = _mm_packs_epi32(v[12], v[13]);
- in[6] = _mm_packs_epi32(v[8], v[9]);
- in[7] = _mm_packs_epi32(v[0], v[1]);
- in[8] = _mm_packs_epi32(v[2], v[3]);
- in[9] = _mm_packs_epi32(v[10], v[11]);
- in[10] = _mm_packs_epi32(v[14], v[15]);
- in[11] = _mm_packs_epi32(v[6], v[7]);
- in[12] = s[5];
- in[13] = _mm_sub_epi16(kZero, s[13]);
- in[14] = s[9];
- in[15] = _mm_sub_epi16(kZero, s[1]);
-}
-
-void fdct16_sse2(__m128i *in0, __m128i *in1) {
- fdct16_8col(in0);
- fdct16_8col(in1);
- array_transpose_16x16(in0, in1);
-}
-
-void fadst16_sse2(__m128i *in0, __m128i *in1) {
- fadst16_8col(in0);
- fadst16_8col(in1);
- array_transpose_16x16(in0, in1);
-}
-
-void vp9_fht16x16_sse2(const int16_t *input, int16_t *output,
- int stride, int tx_type) {
- __m128i in0[16], in1[16];
-
- switch (tx_type) {
- case DCT_DCT:
- vp9_fdct16x16_sse2(input, output, stride);
- break;
- case ADST_DCT:
- load_buffer_16x16(input, in0, in1, stride);
- fadst16_sse2(in0, in1);
- right_shift_16x16(in0, in1);
- fdct16_sse2(in0, in1);
- write_buffer_16x16(output, in0, in1, 16);
- break;
- case DCT_ADST:
- load_buffer_16x16(input, in0, in1, stride);
- fdct16_sse2(in0, in1);
- right_shift_16x16(in0, in1);
- fadst16_sse2(in0, in1);
- write_buffer_16x16(output, in0, in1, 16);
- break;
- case ADST_ADST:
- load_buffer_16x16(input, in0, in1, stride);
- fadst16_sse2(in0, in1);
- right_shift_16x16(in0, in1);
- fadst16_sse2(in0, in1);
- write_buffer_16x16(output, in0, in1, 16);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-#define FDCT32x32_2D vp9_fdct32x32_rd_sse2
-#define FDCT32x32_HIGH_PRECISION 0
-#include "vp9/encoder/x86/vp9_dct32x32_sse2.c"
-#undef FDCT32x32_2D
-#undef FDCT32x32_HIGH_PRECISION
-
-#define FDCT32x32_2D vp9_fdct32x32_sse2
-#define FDCT32x32_HIGH_PRECISION 1
-#include "vp9/encoder/x86/vp9_dct32x32_sse2.c" // NOLINT
-#undef FDCT32x32_2D
-#undef FDCT32x32_HIGH_PRECISION
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_error_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_error_sse2.asm
deleted file mode 100644
index 1126fdb..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_error_sse2.asm
+++ /dev/null
@@ -1,74 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION .text
-
-; int64_t vp9_block_error(int16_t *coeff, int16_t *dqcoeff, intptr_t block_size,
-; int64_t *ssz)
-
-INIT_XMM sse2
-cglobal block_error, 3, 3, 8, uqc, dqc, size, ssz
- pxor m4, m4 ; sse accumulator
- pxor m6, m6 ; ssz accumulator
- pxor m5, m5 ; dedicated zero register
- lea uqcq, [uqcq+sizeq*2]
- lea dqcq, [dqcq+sizeq*2]
- neg sizeq
-.loop:
- mova m2, [uqcq+sizeq*2]
- mova m0, [dqcq+sizeq*2]
- mova m3, [uqcq+sizeq*2+mmsize]
- mova m1, [dqcq+sizeq*2+mmsize]
- psubw m0, m2
- psubw m1, m3
- ; individual errors are max. 15bit+sign, so squares are 30bit, and
- ; thus the sum of 2 should fit in a 31bit integer (+ unused sign bit)
- pmaddwd m0, m0
- pmaddwd m1, m1
- pmaddwd m2, m2
- pmaddwd m3, m3
- ; accumulate in 64bit
- punpckldq m7, m0, m5
- punpckhdq m0, m5
- paddq m4, m7
- punpckldq m7, m1, m5
- paddq m4, m0
- punpckhdq m1, m5
- paddq m4, m7
- punpckldq m7, m2, m5
- paddq m4, m1
- punpckhdq m2, m5
- paddq m6, m7
- punpckldq m7, m3, m5
- paddq m6, m2
- punpckhdq m3, m5
- paddq m6, m7
- paddq m6, m3
- add sizeq, mmsize
- jl .loop
-
- ; accumulate horizontally and store in return value
- movhlps m5, m4
- movhlps m7, m6
- paddq m4, m5
- paddq m6, m7
-%if ARCH_X86_64
- movq rax, m4
- movq [sszq], m6
-%else
- mov eax, sszm
- pshufd m5, m4, 0x1
- movq [eax], m6
- movd eax, m4
- movd edx, m5
-%endif
- RET
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_mcomp_x86.h b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_mcomp_x86.h
deleted file mode 100644
index c15039a..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_mcomp_x86.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VP9_ENCODER_X86_VP9_MCOMP_X86_H_
-#define VP9_ENCODER_X86_VP9_MCOMP_X86_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if HAVE_SSE3
-#if !CONFIG_RUNTIME_CPU_DETECT
-
-#undef vp9_search_full_search
-#define vp9_search_full_search vp9_full_search_sadx3
-
-#undef vp9_search_refining_search
-#define vp9_search_refining_search vp9_refining_search_sadx4
-
-#undef vp9_search_diamond_search
-#define vp9_search_diamond_search vp9_diamond_search_sadx4
-
-#endif
-#endif
-
-#if HAVE_SSE4_1
-#if !CONFIG_RUNTIME_CPU_DETECT
-
-#undef vp9_search_full_search
-#define vp9_search_full_search vp9_full_search_sadx8
-
-#endif
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP9_ENCODER_X86_VP9_MCOMP_X86_H_
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_quantize_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_quantize_ssse3.asm
deleted file mode 100644
index 48ccef8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_quantize_ssse3.asm
+++ /dev/null
@@ -1,219 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION_RODATA
-pw_1: times 8 dw 1
-
-SECTION .text
-
-%macro QUANTIZE_FN 2
-cglobal quantize_%1, 0, %2, 15, coeff, ncoeff, skip, zbin, round, quant, \
- shift, qcoeff, dqcoeff, dequant, zbin_oq, \
- eob, scan, iscan
- cmp dword skipm, 0
- jne .blank
-
- ; actual quantize loop - setup pointers, rounders, etc.
- movifnidn coeffq, coeffmp
- movifnidn ncoeffq, ncoeffmp
- mov r2, dequantmp
- movifnidn zbinq, zbinmp
- movifnidn roundq, roundmp
- movifnidn quantq, quantmp
- movd m4, dword zbin_oqm ; m4 = zbin_oq
- mova m0, [zbinq] ; m0 = zbin
- punpcklwd m4, m4
- mova m1, [roundq] ; m1 = round
- pshufd m4, m4, 0
- mova m2, [quantq] ; m2 = quant
- paddw m0, m4 ; m0 = zbin + zbin_oq
-%ifidn %1, b_32x32
- pcmpeqw m5, m5
- psrlw m5, 15
- paddw m0, m5
- paddw m1, m5
- psrlw m0, 1 ; m0 = (m0 + 1) / 2
- psrlw m1, 1 ; m1 = (m1 + 1) / 2
-%endif
- mova m3, [r2q] ; m3 = dequant
- psubw m0, [pw_1]
- mov r2, shiftmp
- mov r3, qcoeffmp
- mova m4, [r2] ; m4 = shift
- mov r4, dqcoeffmp
- mov r5, iscanmp
-%ifidn %1, b_32x32
- psllw m4, 1
-%endif
- pxor m5, m5 ; m5 = dedicated zero
- DEFINE_ARGS coeff, ncoeff, d1, qcoeff, dqcoeff, iscan, d2, d3, d4, d5, d6, eob
- lea coeffq, [ coeffq+ncoeffq*2]
- lea iscanq, [ iscanq+ncoeffq*2]
- lea qcoeffq, [ qcoeffq+ncoeffq*2]
- lea dqcoeffq, [dqcoeffq+ncoeffq*2]
- neg ncoeffq
-
- ; get DC and first 15 AC coeffs
- mova m9, [ coeffq+ncoeffq*2+ 0] ; m9 = c[i]
- mova m10, [ coeffq+ncoeffq*2+16] ; m10 = c[i]
- pabsw m6, m9 ; m6 = abs(m9)
- pabsw m11, m10 ; m11 = abs(m10)
- pcmpgtw m7, m6, m0 ; m7 = c[i] >= zbin
- punpckhqdq m0, m0
- pcmpgtw m12, m11, m0 ; m12 = c[i] >= zbin
- paddsw m6, m1 ; m6 += round
- punpckhqdq m1, m1
- paddsw m11, m1 ; m11 += round
- pmulhw m8, m6, m2 ; m8 = m6*q>>16
- punpckhqdq m2, m2
- pmulhw m13, m11, m2 ; m13 = m11*q>>16
- paddw m8, m6 ; m8 += m6
- paddw m13, m11 ; m13 += m11
- pmulhw m8, m4 ; m8 = m8*qsh>>16
- punpckhqdq m4, m4
- pmulhw m13, m4 ; m13 = m13*qsh>>16
- psignw m8, m9 ; m8 = reinsert sign
- psignw m13, m10 ; m13 = reinsert sign
- pand m8, m7
- pand m13, m12
- mova [qcoeffq+ncoeffq*2+ 0], m8
- mova [qcoeffq+ncoeffq*2+16], m13
-%ifidn %1, b_32x32
- pabsw m8, m8
- pabsw m13, m13
-%endif
- pmullw m8, m3 ; dqc[i] = qc[i] * q
- punpckhqdq m3, m3
- pmullw m13, m3 ; dqc[i] = qc[i] * q
-%ifidn %1, b_32x32
- psrlw m8, 1
- psrlw m13, 1
- psignw m8, m9
- psignw m13, m10
-%endif
- mova [dqcoeffq+ncoeffq*2+ 0], m8
- mova [dqcoeffq+ncoeffq*2+16], m13
- pcmpeqw m8, m5 ; m8 = c[i] == 0
- pcmpeqw m13, m5 ; m13 = c[i] == 0
- mova m6, [ iscanq+ncoeffq*2+ 0] ; m6 = scan[i]
- mova m11, [ iscanq+ncoeffq*2+16] ; m11 = scan[i]
- psubw m6, m7 ; m6 = scan[i] + 1
- psubw m11, m12 ; m11 = scan[i] + 1
- pandn m8, m6 ; m8 = max(eob)
- pandn m13, m11 ; m13 = max(eob)
- pmaxsw m8, m13
- add ncoeffq, mmsize
- jz .accumulate_eob
-
-.ac_only_loop:
- mova m9, [ coeffq+ncoeffq*2+ 0] ; m9 = c[i]
- mova m10, [ coeffq+ncoeffq*2+16] ; m10 = c[i]
- pabsw m6, m9 ; m6 = abs(m9)
- pabsw m11, m10 ; m11 = abs(m10)
- pcmpgtw m7, m6, m0 ; m7 = c[i] >= zbin
- pcmpgtw m12, m11, m0 ; m12 = c[i] >= zbin
-%ifidn %1, b_32x32
- pmovmskb r6, m7
- pmovmskb r2, m12
- or r6, r2
- jz .skip_iter
-%endif
- paddsw m6, m1 ; m6 += round
- paddsw m11, m1 ; m11 += round
- pmulhw m14, m6, m2 ; m14 = m6*q>>16
- pmulhw m13, m11, m2 ; m13 = m11*q>>16
- paddw m14, m6 ; m14 += m6
- paddw m13, m11 ; m13 += m11
- pmulhw m14, m4 ; m14 = m14*qsh>>16
- pmulhw m13, m4 ; m13 = m13*qsh>>16
- psignw m14, m9 ; m14 = reinsert sign
- psignw m13, m10 ; m13 = reinsert sign
- pand m14, m7
- pand m13, m12
- mova [qcoeffq+ncoeffq*2+ 0], m14
- mova [qcoeffq+ncoeffq*2+16], m13
-%ifidn %1, b_32x32
- pabsw m14, m14
- pabsw m13, m13
-%endif
- pmullw m14, m3 ; dqc[i] = qc[i] * q
- pmullw m13, m3 ; dqc[i] = qc[i] * q
-%ifidn %1, b_32x32
- psrlw m14, 1
- psrlw m13, 1
- psignw m14, m9
- psignw m13, m10
-%endif
- mova [dqcoeffq+ncoeffq*2+ 0], m14
- mova [dqcoeffq+ncoeffq*2+16], m13
- pcmpeqw m14, m5 ; m14 = c[i] == 0
- pcmpeqw m13, m5 ; m13 = c[i] == 0
- mova m6, [ iscanq+ncoeffq*2+ 0] ; m6 = scan[i]
- mova m11, [ iscanq+ncoeffq*2+16] ; m11 = scan[i]
- psubw m6, m7 ; m6 = scan[i] + 1
- psubw m11, m12 ; m11 = scan[i] + 1
- pandn m14, m6 ; m14 = max(eob)
- pandn m13, m11 ; m13 = max(eob)
- pmaxsw m8, m14
- pmaxsw m8, m13
- add ncoeffq, mmsize
- jl .ac_only_loop
-
-%ifidn %1, b_32x32
- jmp .accumulate_eob
-.skip_iter:
- mova [qcoeffq+ncoeffq*2+ 0], m5
- mova [qcoeffq+ncoeffq*2+16], m5
- mova [dqcoeffq+ncoeffq*2+ 0], m5
- mova [dqcoeffq+ncoeffq*2+16], m5
- add ncoeffq, mmsize
- jl .ac_only_loop
-%endif
-
-.accumulate_eob:
- ; horizontally accumulate/max eobs and write into [eob] memory pointer
- mov r2, eobmp
- pshufd m7, m8, 0xe
- pmaxsw m8, m7
- pshuflw m7, m8, 0xe
- pmaxsw m8, m7
- pshuflw m7, m8, 0x1
- pmaxsw m8, m7
- pextrw r6, m8, 0
- mov [r2], r6
- RET
-
- ; skip-block, i.e. just write all zeroes
-.blank:
- mov r0, dqcoeffmp
- movifnidn ncoeffq, ncoeffmp
- mov r2, qcoeffmp
- mov r3, eobmp
- DEFINE_ARGS dqcoeff, ncoeff, qcoeff, eob
- lea dqcoeffq, [dqcoeffq+ncoeffq*2]
- lea qcoeffq, [ qcoeffq+ncoeffq*2]
- neg ncoeffq
- pxor m7, m7
-.blank_loop:
- mova [dqcoeffq+ncoeffq*2+ 0], m7
- mova [dqcoeffq+ncoeffq*2+16], m7
- mova [qcoeffq+ncoeffq*2+ 0], m7
- mova [qcoeffq+ncoeffq*2+16], m7
- add ncoeffq, mmsize
- jl .blank_loop
- mov word [eobq], 0
- RET
-%endmacro
-
-INIT_XMM ssse3
-QUANTIZE_FN b, 7
-QUANTIZE_FN b_32x32, 7
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_intrin_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_intrin_avx2.c
deleted file mode 100644
index f31b176..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_intrin_avx2.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include <immintrin.h> // AVX2
-#include "vpx/vpx_integer.h"
-
-void vp9_sad32x32x4d_avx2(uint8_t *src,
- int src_stride,
- uint8_t *ref[4],
- int ref_stride,
- unsigned int res[4]) {
- __m256i src_reg, ref0_reg, ref1_reg, ref2_reg, ref3_reg;
- __m256i sum_ref0, sum_ref1, sum_ref2, sum_ref3;
- __m256i sum_mlow, sum_mhigh;
- int i;
- uint8_t *ref0, *ref1, *ref2, *ref3;
-
- ref0 = ref[0];
- ref1 = ref[1];
- ref2 = ref[2];
- ref3 = ref[3];
- sum_ref0 = _mm256_set1_epi16(0);
- sum_ref1 = _mm256_set1_epi16(0);
- sum_ref2 = _mm256_set1_epi16(0);
- sum_ref3 = _mm256_set1_epi16(0);
- for (i = 0; i < 32 ; i++) {
- // load src and all refs
- src_reg = _mm256_load_si256((__m256i *)(src));
- ref0_reg = _mm256_loadu_si256((__m256i *) (ref0));
- ref1_reg = _mm256_loadu_si256((__m256i *) (ref1));
- ref2_reg = _mm256_loadu_si256((__m256i *) (ref2));
- ref3_reg = _mm256_loadu_si256((__m256i *) (ref3));
- // sum of the absolute differences between every ref-i to src
- ref0_reg = _mm256_sad_epu8(ref0_reg, src_reg);
- ref1_reg = _mm256_sad_epu8(ref1_reg, src_reg);
- ref2_reg = _mm256_sad_epu8(ref2_reg, src_reg);
- ref3_reg = _mm256_sad_epu8(ref3_reg, src_reg);
- // sum every ref-i
- sum_ref0 = _mm256_add_epi32(sum_ref0, ref0_reg);
- sum_ref1 = _mm256_add_epi32(sum_ref1, ref1_reg);
- sum_ref2 = _mm256_add_epi32(sum_ref2, ref2_reg);
- sum_ref3 = _mm256_add_epi32(sum_ref3, ref3_reg);
-
- src+= src_stride;
- ref0+= ref_stride;
- ref1+= ref_stride;
- ref2+= ref_stride;
- ref3+= ref_stride;
- }
- {
- __m128i sum;
- // in sum_ref-i the result is saved in the first 4 bytes
- // the other 4 bytes are zeroed.
- // sum_ref1 and sum_ref3 are shifted left by 4 bytes
- sum_ref1 = _mm256_slli_si256(sum_ref1, 4);
- sum_ref3 = _mm256_slli_si256(sum_ref3, 4);
-
- // merge sum_ref0 and sum_ref1 also sum_ref2 and sum_ref3
- sum_ref0 = _mm256_or_si256(sum_ref0, sum_ref1);
- sum_ref2 = _mm256_or_si256(sum_ref2, sum_ref3);
-
- // merge every 64 bit from each sum_ref-i
- sum_mlow = _mm256_unpacklo_epi64(sum_ref0, sum_ref2);
- sum_mhigh = _mm256_unpackhi_epi64(sum_ref0, sum_ref2);
-
- // add the low 64 bit to the high 64 bit
- sum_mlow = _mm256_add_epi32(sum_mlow, sum_mhigh);
-
- // add the low 128 bit to the high 128 bit
- sum = _mm_add_epi32(_mm256_castsi256_si128(sum_mlow),
- _mm256_extractf128_si256(sum_mlow, 1));
-
- _mm_storeu_si128((__m128i *)(res), sum);
- }
-}
-
-void vp9_sad64x64x4d_avx2(uint8_t *src,
- int src_stride,
- uint8_t *ref[4],
- int ref_stride,
- unsigned int res[4]) {
- __m256i src_reg, srcnext_reg, ref0_reg, ref0next_reg;
- __m256i ref1_reg, ref1next_reg, ref2_reg, ref2next_reg;
- __m256i ref3_reg, ref3next_reg;
- __m256i sum_ref0, sum_ref1, sum_ref2, sum_ref3;
- __m256i sum_mlow, sum_mhigh;
- int i;
- uint8_t *ref0, *ref1, *ref2, *ref3;
-
- ref0 = ref[0];
- ref1 = ref[1];
- ref2 = ref[2];
- ref3 = ref[3];
- sum_ref0 = _mm256_set1_epi16(0);
- sum_ref1 = _mm256_set1_epi16(0);
- sum_ref2 = _mm256_set1_epi16(0);
- sum_ref3 = _mm256_set1_epi16(0);
- for (i = 0; i < 64 ; i++) {
- // load 64 bytes from src and all refs
- src_reg = _mm256_load_si256((__m256i *)(src));
- srcnext_reg = _mm256_load_si256((__m256i *)(src + 32));
- ref0_reg = _mm256_loadu_si256((__m256i *) (ref0));
- ref0next_reg = _mm256_loadu_si256((__m256i *) (ref0 + 32));
- ref1_reg = _mm256_loadu_si256((__m256i *) (ref1));
- ref1next_reg = _mm256_loadu_si256((__m256i *) (ref1 + 32));
- ref2_reg = _mm256_loadu_si256((__m256i *) (ref2));
- ref2next_reg = _mm256_loadu_si256((__m256i *) (ref2 + 32));
- ref3_reg = _mm256_loadu_si256((__m256i *) (ref3));
- ref3next_reg = _mm256_loadu_si256((__m256i *) (ref3 + 32));
- // sum of the absolute differences between every ref-i to src
- ref0_reg = _mm256_sad_epu8(ref0_reg, src_reg);
- ref1_reg = _mm256_sad_epu8(ref1_reg, src_reg);
- ref2_reg = _mm256_sad_epu8(ref2_reg, src_reg);
- ref3_reg = _mm256_sad_epu8(ref3_reg, src_reg);
- ref0next_reg = _mm256_sad_epu8(ref0next_reg, srcnext_reg);
- ref1next_reg = _mm256_sad_epu8(ref1next_reg, srcnext_reg);
- ref2next_reg = _mm256_sad_epu8(ref2next_reg, srcnext_reg);
- ref3next_reg = _mm256_sad_epu8(ref3next_reg, srcnext_reg);
-
- // sum every ref-i
- sum_ref0 = _mm256_add_epi32(sum_ref0, ref0_reg);
- sum_ref1 = _mm256_add_epi32(sum_ref1, ref1_reg);
- sum_ref2 = _mm256_add_epi32(sum_ref2, ref2_reg);
- sum_ref3 = _mm256_add_epi32(sum_ref3, ref3_reg);
- sum_ref0 = _mm256_add_epi32(sum_ref0, ref0next_reg);
- sum_ref1 = _mm256_add_epi32(sum_ref1, ref1next_reg);
- sum_ref2 = _mm256_add_epi32(sum_ref2, ref2next_reg);
- sum_ref3 = _mm256_add_epi32(sum_ref3, ref3next_reg);
- src+= src_stride;
- ref0+= ref_stride;
- ref1+= ref_stride;
- ref2+= ref_stride;
- ref3+= ref_stride;
- }
- {
- __m128i sum;
-
- // in sum_ref-i the result is saved in the first 4 bytes
- // the other 4 bytes are zeroed.
- // sum_ref1 and sum_ref3 are shifted left by 4 bytes
- sum_ref1 = _mm256_slli_si256(sum_ref1, 4);
- sum_ref3 = _mm256_slli_si256(sum_ref3, 4);
-
- // merge sum_ref0 and sum_ref1 also sum_ref2 and sum_ref3
- sum_ref0 = _mm256_or_si256(sum_ref0, sum_ref1);
- sum_ref2 = _mm256_or_si256(sum_ref2, sum_ref3);
-
- // merge every 64 bit from each sum_ref-i
- sum_mlow = _mm256_unpacklo_epi64(sum_ref0, sum_ref2);
- sum_mhigh = _mm256_unpackhi_epi64(sum_ref0, sum_ref2);
-
- // add the low 64 bit to the high 64 bit
- sum_mlow = _mm256_add_epi32(sum_mlow, sum_mhigh);
-
- // add the low 128 bit to the high 128 bit
- sum = _mm_add_epi32(_mm256_castsi256_si128(sum_mlow),
- _mm256_extractf128_si256(sum_mlow, 1));
-
- _mm_storeu_si128((__m128i *)(res), sum);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_sse2.asm
deleted file mode 100644
index b493628..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad4d_sse2.asm
+++ /dev/null
@@ -1,231 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION .text
-
-; PROCESS_4x2x4 first, off_{first,second}_{src,ref}, advance_at_end
-%macro PROCESS_4x2x4 5-6 0
- movd m0, [srcq +%2]
-%if %1 == 1
- movd m6, [ref1q+%3]
- movd m4, [ref2q+%3]
- movd m7, [ref3q+%3]
- movd m5, [ref4q+%3]
- punpckldq m0, [srcq +%4]
- punpckldq m6, [ref1q+%5]
- punpckldq m4, [ref2q+%5]
- punpckldq m7, [ref3q+%5]
- punpckldq m5, [ref4q+%5]
- psadbw m6, m0
- psadbw m4, m0
- psadbw m7, m0
- psadbw m5, m0
- punpckldq m6, m4
- punpckldq m7, m5
-%else
- movd m1, [ref1q+%3]
- movd m2, [ref2q+%3]
- movd m3, [ref3q+%3]
- movd m4, [ref4q+%3]
- punpckldq m0, [srcq +%4]
- punpckldq m1, [ref1q+%5]
- punpckldq m2, [ref2q+%5]
- punpckldq m3, [ref3q+%5]
- punpckldq m4, [ref4q+%5]
- psadbw m1, m0
- psadbw m2, m0
- psadbw m3, m0
- psadbw m4, m0
- punpckldq m1, m2
- punpckldq m3, m4
- paddd m6, m1
- paddd m7, m3
-%endif
-%if %6 == 1
- lea srcq, [srcq +src_strideq*2]
- lea ref1q, [ref1q+ref_strideq*2]
- lea ref2q, [ref2q+ref_strideq*2]
- lea ref3q, [ref3q+ref_strideq*2]
- lea ref4q, [ref4q+ref_strideq*2]
-%endif
-%endmacro
-
-; PROCESS_8x2x4 first, off_{first,second}_{src,ref}, advance_at_end
-%macro PROCESS_8x2x4 5-6 0
- movh m0, [srcq +%2]
-%if %1 == 1
- movh m4, [ref1q+%3]
- movh m5, [ref2q+%3]
- movh m6, [ref3q+%3]
- movh m7, [ref4q+%3]
- movhps m0, [srcq +%4]
- movhps m4, [ref1q+%5]
- movhps m5, [ref2q+%5]
- movhps m6, [ref3q+%5]
- movhps m7, [ref4q+%5]
- psadbw m4, m0
- psadbw m5, m0
- psadbw m6, m0
- psadbw m7, m0
-%else
- movh m1, [ref1q+%3]
- movh m2, [ref2q+%3]
- movh m3, [ref3q+%3]
- movhps m0, [srcq +%4]
- movhps m1, [ref1q+%5]
- movhps m2, [ref2q+%5]
- movhps m3, [ref3q+%5]
- psadbw m1, m0
- psadbw m2, m0
- psadbw m3, m0
- paddd m4, m1
- movh m1, [ref4q+%3]
- movhps m1, [ref4q+%5]
- paddd m5, m2
- paddd m6, m3
- psadbw m1, m0
- paddd m7, m1
-%endif
-%if %6 == 1
- lea srcq, [srcq +src_strideq*2]
- lea ref1q, [ref1q+ref_strideq*2]
- lea ref2q, [ref2q+ref_strideq*2]
- lea ref3q, [ref3q+ref_strideq*2]
- lea ref4q, [ref4q+ref_strideq*2]
-%endif
-%endmacro
-
-; PROCESS_16x2x4 first, off_{first,second}_{src,ref}, advance_at_end
-%macro PROCESS_16x2x4 5-6 0
- ; 1st 16 px
- mova m0, [srcq +%2]
-%if %1 == 1
- movu m4, [ref1q+%3]
- movu m5, [ref2q+%3]
- movu m6, [ref3q+%3]
- movu m7, [ref4q+%3]
- psadbw m4, m0
- psadbw m5, m0
- psadbw m6, m0
- psadbw m7, m0
-%else
- movu m1, [ref1q+%3]
- movu m2, [ref2q+%3]
- movu m3, [ref3q+%3]
- psadbw m1, m0
- psadbw m2, m0
- psadbw m3, m0
- paddd m4, m1
- movu m1, [ref4q+%3]
- paddd m5, m2
- paddd m6, m3
- psadbw m1, m0
- paddd m7, m1
-%endif
-
- ; 2nd 16 px
- mova m0, [srcq +%4]
- movu m1, [ref1q+%5]
- movu m2, [ref2q+%5]
- movu m3, [ref3q+%5]
- psadbw m1, m0
- psadbw m2, m0
- psadbw m3, m0
- paddd m4, m1
- movu m1, [ref4q+%5]
- paddd m5, m2
- paddd m6, m3
-%if %6 == 1
- lea srcq, [srcq +src_strideq*2]
- lea ref1q, [ref1q+ref_strideq*2]
- lea ref2q, [ref2q+ref_strideq*2]
- lea ref3q, [ref3q+ref_strideq*2]
- lea ref4q, [ref4q+ref_strideq*2]
-%endif
- psadbw m1, m0
- paddd m7, m1
-%endmacro
-
-; PROCESS_32x2x4 first, off_{first,second}_{src,ref}, advance_at_end
-%macro PROCESS_32x2x4 5-6 0
- PROCESS_16x2x4 %1, %2, %3, %2 + 16, %3 + 16
- PROCESS_16x2x4 0, %4, %5, %4 + 16, %5 + 16, %6
-%endmacro
-
-; PROCESS_64x2x4 first, off_{first,second}_{src,ref}, advance_at_end
-%macro PROCESS_64x2x4 5-6 0
- PROCESS_32x2x4 %1, %2, %3, %2 + 32, %3 + 32
- PROCESS_32x2x4 0, %4, %5, %4 + 32, %5 + 32, %6
-%endmacro
-
-; void vp9_sadNxNx4d_sse2(uint8_t *src, int src_stride,
-; uint8_t *ref[4], int ref_stride,
-; unsigned int res[4]);
-; where NxN = 64x64, 32x32, 16x16, 16x8, 8x16 or 8x8
-%macro SADNXN4D 2
-%if UNIX64
-cglobal sad%1x%2x4d, 5, 8, 8, src, src_stride, ref1, ref_stride, \
- res, ref2, ref3, ref4
-%else
-cglobal sad%1x%2x4d, 4, 7, 8, src, src_stride, ref1, ref_stride, \
- ref2, ref3, ref4
-%endif
- movsxdifnidn src_strideq, src_strided
- movsxdifnidn ref_strideq, ref_strided
- mov ref2q, [ref1q+gprsize*1]
- mov ref3q, [ref1q+gprsize*2]
- mov ref4q, [ref1q+gprsize*3]
- mov ref1q, [ref1q+gprsize*0]
-
- PROCESS_%1x2x4 1, 0, 0, src_strideq, ref_strideq, 1
-%rep (%2-4)/2
- PROCESS_%1x2x4 0, 0, 0, src_strideq, ref_strideq, 1
-%endrep
- PROCESS_%1x2x4 0, 0, 0, src_strideq, ref_strideq, 0
-
-%if mmsize == 16
- pslldq m5, 4
- pslldq m7, 4
- por m4, m5
- por m6, m7
- mova m5, m4
- mova m7, m6
- punpcklqdq m4, m6
- punpckhqdq m5, m7
- movifnidn r4, r4mp
- paddd m4, m5
- movu [r4], m4
- RET
-%else
- movifnidn r4, r4mp
- movq [r4+0], m6
- movq [r4+8], m7
- RET
-%endif
-%endmacro
-
-INIT_XMM sse2
-SADNXN4D 64, 64
-SADNXN4D 64, 32
-SADNXN4D 32, 64
-SADNXN4D 32, 32
-SADNXN4D 32, 16
-SADNXN4D 16, 32
-SADNXN4D 16, 16
-SADNXN4D 16, 8
-SADNXN4D 8, 16
-SADNXN4D 8, 8
-SADNXN4D 8, 4
-
-INIT_MMX sse
-SADNXN4D 4, 8
-SADNXN4D 4, 4
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_mmx.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_mmx.asm
deleted file mode 100644
index 32fdd23..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_mmx.asm
+++ /dev/null
@@ -1,427 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-global sym(vp9_sad16x16_mmx) PRIVATE
-global sym(vp9_sad8x16_mmx) PRIVATE
-global sym(vp9_sad8x8_mmx) PRIVATE
-global sym(vp9_sad4x4_mmx) PRIVATE
-global sym(vp9_sad16x8_mmx) PRIVATE
-
-;unsigned int vp9_sad16x16_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp9_sad16x16_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
-
- lea rcx, [rcx+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x16x16sad_mmx_loop:
-
- movq mm0, QWORD PTR [rsi]
- movq mm2, QWORD PTR [rsi+8]
-
- movq mm1, QWORD PTR [rdi]
- movq mm3, QWORD PTR [rdi+8]
-
- movq mm4, mm0
- movq mm5, mm2
-
- psubusb mm0, mm1
- psubusb mm1, mm4
-
- psubusb mm2, mm3
- psubusb mm3, mm5
-
- por mm0, mm1
- por mm2, mm3
-
- movq mm1, mm0
- movq mm3, mm2
-
- punpcklbw mm0, mm6
- punpcklbw mm2, mm6
-
- punpckhbw mm1, mm6
- punpckhbw mm3, mm6
-
- paddw mm0, mm2
- paddw mm1, mm3
-
-
- lea rsi, [rsi+rax]
- add rdi, rdx
-
- paddw mm7, mm0
- paddw mm7, mm1
-
- cmp rsi, rcx
- jne .x16x16sad_mmx_loop
-
-
- movq mm0, mm7
-
- punpcklwd mm0, mm6
- punpckhwd mm7, mm6
-
- paddw mm0, mm7
- movq mm7, mm0
-
-
- psrlq mm0, 32
- paddw mm7, mm0
-
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp9_sad8x16_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp9_sad8x16_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
-
- lea rcx, [rcx+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x8x16sad_mmx_loop:
-
- movq mm0, QWORD PTR [rsi]
- movq mm1, QWORD PTR [rdi]
-
- movq mm2, mm0
- psubusb mm0, mm1
-
- psubusb mm1, mm2
- por mm0, mm1
-
- movq mm2, mm0
- punpcklbw mm0, mm6
-
- punpckhbw mm2, mm6
- lea rsi, [rsi+rax]
-
- add rdi, rdx
- paddw mm7, mm0
-
- paddw mm7, mm2
- cmp rsi, rcx
-
- jne .x8x16sad_mmx_loop
-
- movq mm0, mm7
- punpcklwd mm0, mm6
-
- punpckhwd mm7, mm6
- paddw mm0, mm7
-
- movq mm7, mm0
- psrlq mm0, 32
-
- paddw mm7, mm0
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp9_sad8x8_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp9_sad8x8_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x8x8sad_mmx_loop:
-
- movq mm0, QWORD PTR [rsi]
- movq mm1, QWORD PTR [rdi]
-
- movq mm2, mm0
- psubusb mm0, mm1
-
- psubusb mm1, mm2
- por mm0, mm1
-
- movq mm2, mm0
- punpcklbw mm0, mm6
-
- punpckhbw mm2, mm6
- paddw mm0, mm2
-
- lea rsi, [rsi+rax]
- add rdi, rdx
-
- paddw mm7, mm0
- cmp rsi, rcx
-
- jne .x8x8sad_mmx_loop
-
- movq mm0, mm7
- punpcklwd mm0, mm6
-
- punpckhwd mm7, mm6
- paddw mm0, mm7
-
- movq mm7, mm0
- psrlq mm0, 32
-
- paddw mm7, mm0
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp9_sad4x4_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp9_sad4x4_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- movd mm0, DWORD PTR [rsi]
- movd mm1, DWORD PTR [rdi]
-
- movd mm2, DWORD PTR [rsi+rax]
- movd mm3, DWORD PTR [rdi+rdx]
-
- punpcklbw mm0, mm2
- punpcklbw mm1, mm3
-
- movq mm2, mm0
- psubusb mm0, mm1
-
- psubusb mm1, mm2
- por mm0, mm1
-
- movq mm2, mm0
- pxor mm3, mm3
-
- punpcklbw mm0, mm3
- punpckhbw mm2, mm3
-
- paddw mm0, mm2
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- movd mm4, DWORD PTR [rsi]
- movd mm5, DWORD PTR [rdi]
-
- movd mm6, DWORD PTR [rsi+rax]
- movd mm7, DWORD PTR [rdi+rdx]
-
- punpcklbw mm4, mm6
- punpcklbw mm5, mm7
-
- movq mm6, mm4
- psubusb mm4, mm5
-
- psubusb mm5, mm6
- por mm4, mm5
-
- movq mm5, mm4
- punpcklbw mm4, mm3
-
- punpckhbw mm5, mm3
- paddw mm4, mm5
-
- paddw mm0, mm4
- movq mm1, mm0
-
- punpcklwd mm0, mm3
- punpckhwd mm1, mm3
-
- paddw mm0, mm1
- movq mm1, mm0
-
- psrlq mm0, 32
- paddw mm0, mm1
-
- movq rax, mm0
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp9_sad16x8_mmx(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride)
-sym(vp9_sad16x8_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- lea rcx, [rsi+rax*8]
- pxor mm7, mm7
-
- pxor mm6, mm6
-
-.x16x8sad_mmx_loop:
-
- movq mm0, [rsi]
- movq mm1, [rdi]
-
- movq mm2, [rsi+8]
- movq mm3, [rdi+8]
-
- movq mm4, mm0
- movq mm5, mm2
-
- psubusb mm0, mm1
- psubusb mm1, mm4
-
- psubusb mm2, mm3
- psubusb mm3, mm5
-
- por mm0, mm1
- por mm2, mm3
-
- movq mm1, mm0
- movq mm3, mm2
-
- punpcklbw mm0, mm6
- punpckhbw mm1, mm6
-
- punpcklbw mm2, mm6
- punpckhbw mm3, mm6
-
-
- paddw mm0, mm2
- paddw mm1, mm3
-
- paddw mm0, mm1
- lea rsi, [rsi+rax]
-
- add rdi, rdx
- paddw mm7, mm0
-
- cmp rsi, rcx
- jne .x16x8sad_mmx_loop
-
- movq mm0, mm7
- punpcklwd mm0, mm6
-
- punpckhwd mm7, mm6
- paddw mm0, mm7
-
- movq mm7, mm0
- psrlq mm0, 32
-
- paddw mm7, mm0
- movq rax, mm7
-
- pop rdi
- pop rsi
- mov rsp, rbp
- ; begin epilog
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse2.asm
deleted file mode 100644
index c4c5c54..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse2.asm
+++ /dev/null
@@ -1,267 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION .text
-
-%macro SAD_FN 4
-%if %4 == 0
-%if %3 == 5
-cglobal sad%1x%2, 4, %3, 5, src, src_stride, ref, ref_stride, n_rows
-%else ; %3 == 7
-cglobal sad%1x%2, 4, %3, 5, src, src_stride, ref, ref_stride, \
- src_stride3, ref_stride3, n_rows
-%endif ; %3 == 5/7
-%else ; avg
-%if %3 == 5
-cglobal sad%1x%2_avg, 5, 1 + %3, 5, src, src_stride, ref, ref_stride, \
- second_pred, n_rows
-%else ; %3 == 7
-cglobal sad%1x%2_avg, 5, ARCH_X86_64 + %3, 5, src, src_stride, \
- ref, ref_stride, \
- second_pred, \
- src_stride3, ref_stride3
-%if ARCH_X86_64
-%define n_rowsd r7d
-%else ; x86-32
-%define n_rowsd dword r0m
-%endif ; x86-32/64
-%endif ; %3 == 5/7
-%endif ; avg/sad
- movsxdifnidn src_strideq, src_strided
- movsxdifnidn ref_strideq, ref_strided
-%if %3 == 7
- lea src_stride3q, [src_strideq*3]
- lea ref_stride3q, [ref_strideq*3]
-%endif ; %3 == 7
-%endmacro
-
-; unsigned int vp9_sad64x64_sse2(uint8_t *src, int src_stride,
-; uint8_t *ref, int ref_stride);
-%macro SAD64XN 1-2 0
- SAD_FN 64, %1, 5, %2
- mov n_rowsd, %1
- pxor m0, m0
-.loop:
- movu m1, [refq]
- movu m2, [refq+16]
- movu m3, [refq+32]
- movu m4, [refq+48]
-%if %2 == 1
- pavgb m1, [second_predq+mmsize*0]
- pavgb m2, [second_predq+mmsize*1]
- pavgb m3, [second_predq+mmsize*2]
- pavgb m4, [second_predq+mmsize*3]
- lea second_predq, [second_predq+mmsize*4]
-%endif
- psadbw m1, [srcq]
- psadbw m2, [srcq+16]
- psadbw m3, [srcq+32]
- psadbw m4, [srcq+48]
- paddd m1, m2
- paddd m3, m4
- add refq, ref_strideq
- paddd m0, m1
- add srcq, src_strideq
- paddd m0, m3
- dec n_rowsd
- jg .loop
-
- movhlps m1, m0
- paddd m0, m1
- movd eax, m0
- RET
-%endmacro
-
-INIT_XMM sse2
-SAD64XN 64 ; sad64x64_sse2
-SAD64XN 32 ; sad64x32_sse2
-SAD64XN 64, 1 ; sad64x64_avg_sse2
-SAD64XN 32, 1 ; sad64x32_avg_sse2
-
-; unsigned int vp9_sad32x32_sse2(uint8_t *src, int src_stride,
-; uint8_t *ref, int ref_stride);
-%macro SAD32XN 1-2 0
- SAD_FN 32, %1, 5, %2
- mov n_rowsd, %1/2
- pxor m0, m0
-.loop:
- movu m1, [refq]
- movu m2, [refq+16]
- movu m3, [refq+ref_strideq]
- movu m4, [refq+ref_strideq+16]
-%if %2 == 1
- pavgb m1, [second_predq+mmsize*0]
- pavgb m2, [second_predq+mmsize*1]
- pavgb m3, [second_predq+mmsize*2]
- pavgb m4, [second_predq+mmsize*3]
- lea second_predq, [second_predq+mmsize*4]
-%endif
- psadbw m1, [srcq]
- psadbw m2, [srcq+16]
- psadbw m3, [srcq+src_strideq]
- psadbw m4, [srcq+src_strideq+16]
- paddd m1, m2
- paddd m3, m4
- lea refq, [refq+ref_strideq*2]
- paddd m0, m1
- lea srcq, [srcq+src_strideq*2]
- paddd m0, m3
- dec n_rowsd
- jg .loop
-
- movhlps m1, m0
- paddd m0, m1
- movd eax, m0
- RET
-%endmacro
-
-INIT_XMM sse2
-SAD32XN 64 ; sad32x64_sse2
-SAD32XN 32 ; sad32x32_sse2
-SAD32XN 16 ; sad32x16_sse2
-SAD32XN 64, 1 ; sad32x64_avg_sse2
-SAD32XN 32, 1 ; sad32x32_avg_sse2
-SAD32XN 16, 1 ; sad32x16_avg_sse2
-
-; unsigned int vp9_sad16x{8,16}_sse2(uint8_t *src, int src_stride,
-; uint8_t *ref, int ref_stride);
-%macro SAD16XN 1-2 0
- SAD_FN 16, %1, 7, %2
- mov n_rowsd, %1/4
- pxor m0, m0
-
-.loop:
- movu m1, [refq]
- movu m2, [refq+ref_strideq]
- movu m3, [refq+ref_strideq*2]
- movu m4, [refq+ref_stride3q]
-%if %2 == 1
- pavgb m1, [second_predq+mmsize*0]
- pavgb m2, [second_predq+mmsize*1]
- pavgb m3, [second_predq+mmsize*2]
- pavgb m4, [second_predq+mmsize*3]
- lea second_predq, [second_predq+mmsize*4]
-%endif
- psadbw m1, [srcq]
- psadbw m2, [srcq+src_strideq]
- psadbw m3, [srcq+src_strideq*2]
- psadbw m4, [srcq+src_stride3q]
- paddd m1, m2
- paddd m3, m4
- lea refq, [refq+ref_strideq*4]
- paddd m0, m1
- lea srcq, [srcq+src_strideq*4]
- paddd m0, m3
- dec n_rowsd
- jg .loop
-
- movhlps m1, m0
- paddd m0, m1
- movd eax, m0
- RET
-%endmacro
-
-INIT_XMM sse2
-SAD16XN 32 ; sad16x32_sse2
-SAD16XN 16 ; sad16x16_sse2
-SAD16XN 8 ; sad16x8_sse2
-SAD16XN 32, 1 ; sad16x32_avg_sse2
-SAD16XN 16, 1 ; sad16x16_avg_sse2
-SAD16XN 8, 1 ; sad16x8_avg_sse2
-
-; unsigned int vp9_sad8x{8,16}_sse2(uint8_t *src, int src_stride,
-; uint8_t *ref, int ref_stride);
-%macro SAD8XN 1-2 0
- SAD_FN 8, %1, 7, %2
- mov n_rowsd, %1/4
- pxor m0, m0
-
-.loop:
- movh m1, [refq]
- movhps m1, [refq+ref_strideq]
- movh m2, [refq+ref_strideq*2]
- movhps m2, [refq+ref_stride3q]
-%if %2 == 1
- pavgb m1, [second_predq+mmsize*0]
- pavgb m2, [second_predq+mmsize*1]
- lea second_predq, [second_predq+mmsize*2]
-%endif
- movh m3, [srcq]
- movhps m3, [srcq+src_strideq]
- movh m4, [srcq+src_strideq*2]
- movhps m4, [srcq+src_stride3q]
- psadbw m1, m3
- psadbw m2, m4
- lea refq, [refq+ref_strideq*4]
- paddd m0, m1
- lea srcq, [srcq+src_strideq*4]
- paddd m0, m2
- dec n_rowsd
- jg .loop
-
- movhlps m1, m0
- paddd m0, m1
- movd eax, m0
- RET
-%endmacro
-
-INIT_XMM sse2
-SAD8XN 16 ; sad8x16_sse2
-SAD8XN 8 ; sad8x8_sse2
-SAD8XN 4 ; sad8x4_sse2
-SAD8XN 16, 1 ; sad8x16_avg_sse2
-SAD8XN 8, 1 ; sad8x8_avg_sse2
-SAD8XN 4, 1 ; sad8x4_avg_sse2
-
-; unsigned int vp9_sad4x{4, 8}_sse(uint8_t *src, int src_stride,
-; uint8_t *ref, int ref_stride);
-%macro SAD4XN 1-2 0
- SAD_FN 4, %1, 7, %2
- mov n_rowsd, %1/4
- pxor m0, m0
-
-.loop:
- movd m1, [refq]
- movd m2, [refq+ref_strideq]
- movd m3, [refq+ref_strideq*2]
- movd m4, [refq+ref_stride3q]
- punpckldq m1, m2
- punpckldq m3, m4
-%if %2 == 1
- pavgb m1, [second_predq+mmsize*0]
- pavgb m3, [second_predq+mmsize*1]
- lea second_predq, [second_predq+mmsize*2]
-%endif
- movd m2, [srcq]
- movd m5, [srcq+src_strideq]
- movd m4, [srcq+src_strideq*2]
- movd m6, [srcq+src_stride3q]
- punpckldq m2, m5
- punpckldq m4, m6
- psadbw m1, m2
- psadbw m3, m4
- lea refq, [refq+ref_strideq*4]
- paddd m0, m1
- lea srcq, [srcq+src_strideq*4]
- paddd m0, m3
- dec n_rowsd
- jg .loop
-
- movd eax, m0
- RET
-%endmacro
-
-INIT_MMX sse
-SAD4XN 8 ; sad4x8_sse
-SAD4XN 4 ; sad4x4_sse
-SAD4XN 8, 1 ; sad4x8_avg_sse
-SAD4XN 4, 1 ; sad4x4_avg_sse
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse3.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse3.asm
deleted file mode 100644
index 2b90a5d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse3.asm
+++ /dev/null
@@ -1,378 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro STACK_FRAME_CREATE_X3 0
-%if ABI_IS_32BIT
- %define src_ptr rsi
- %define src_stride rax
- %define ref_ptr rdi
- %define ref_stride rdx
- %define end_ptr rcx
- %define ret_var rbx
- %define result_ptr arg(4)
- %define max_err arg(4)
- %define height dword ptr arg(4)
- push rbp
- mov rbp, rsp
- push rsi
- push rdi
- push rbx
-
- mov rsi, arg(0) ; src_ptr
- mov rdi, arg(2) ; ref_ptr
-
- movsxd rax, dword ptr arg(1) ; src_stride
- movsxd rdx, dword ptr arg(3) ; ref_stride
-%else
- %if LIBVPX_YASM_WIN64
- SAVE_XMM 7, u
- %define src_ptr rcx
- %define src_stride rdx
- %define ref_ptr r8
- %define ref_stride r9
- %define end_ptr r10
- %define ret_var r11
- %define result_ptr [rsp+xmm_stack_space+8+4*8]
- %define max_err [rsp+xmm_stack_space+8+4*8]
- %define height dword ptr [rsp+xmm_stack_space+8+4*8]
- %else
- %define src_ptr rdi
- %define src_stride rsi
- %define ref_ptr rdx
- %define ref_stride rcx
- %define end_ptr r9
- %define ret_var r10
- %define result_ptr r8
- %define max_err r8
- %define height r8
- %endif
-%endif
-
-%endmacro
-
-%macro STACK_FRAME_DESTROY_X3 0
- %define src_ptr
- %define src_stride
- %define ref_ptr
- %define ref_stride
- %define end_ptr
- %define ret_var
- %define result_ptr
- %define max_err
- %define height
-
-%if ABI_IS_32BIT
- pop rbx
- pop rdi
- pop rsi
- pop rbp
-%else
- %if LIBVPX_YASM_WIN64
- RESTORE_XMM
- %endif
-%endif
- ret
-%endmacro
-
-%macro PROCESS_16X2X3 5
-%if %1==0
- movdqa xmm0, XMMWORD PTR [%2]
- lddqu xmm5, XMMWORD PTR [%3]
- lddqu xmm6, XMMWORD PTR [%3+1]
- lddqu xmm7, XMMWORD PTR [%3+2]
-
- psadbw xmm5, xmm0
- psadbw xmm6, xmm0
- psadbw xmm7, xmm0
-%else
- movdqa xmm0, XMMWORD PTR [%2]
- lddqu xmm1, XMMWORD PTR [%3]
- lddqu xmm2, XMMWORD PTR [%3+1]
- lddqu xmm3, XMMWORD PTR [%3+2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endif
- movdqa xmm0, XMMWORD PTR [%2+%4]
- lddqu xmm1, XMMWORD PTR [%3+%5]
- lddqu xmm2, XMMWORD PTR [%3+%5+1]
- lddqu xmm3, XMMWORD PTR [%3+%5+2]
-
-%if %1==0 || %1==1
- lea %2, [%2+%4*2]
- lea %3, [%3+%5*2]
-%endif
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endmacro
-
-%macro PROCESS_8X2X3 5
-%if %1==0
- movq mm0, QWORD PTR [%2]
- movq mm5, QWORD PTR [%3]
- movq mm6, QWORD PTR [%3+1]
- movq mm7, QWORD PTR [%3+2]
-
- psadbw mm5, mm0
- psadbw mm6, mm0
- psadbw mm7, mm0
-%else
- movq mm0, QWORD PTR [%2]
- movq mm1, QWORD PTR [%3]
- movq mm2, QWORD PTR [%3+1]
- movq mm3, QWORD PTR [%3+2]
-
- psadbw mm1, mm0
- psadbw mm2, mm0
- psadbw mm3, mm0
-
- paddw mm5, mm1
- paddw mm6, mm2
- paddw mm7, mm3
-%endif
- movq mm0, QWORD PTR [%2+%4]
- movq mm1, QWORD PTR [%3+%5]
- movq mm2, QWORD PTR [%3+%5+1]
- movq mm3, QWORD PTR [%3+%5+2]
-
-%if %1==0 || %1==1
- lea %2, [%2+%4*2]
- lea %3, [%3+%5*2]
-%endif
-
- psadbw mm1, mm0
- psadbw mm2, mm0
- psadbw mm3, mm0
-
- paddw mm5, mm1
- paddw mm6, mm2
- paddw mm7, mm3
-%endmacro
-
-;void int vp9_sad16x16x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp9_sad16x16x3_sse3) PRIVATE
-sym(vp9_sad16x16x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_16X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rcx], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rcx+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rcx+8], xmm0
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp9_sad16x8x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp9_sad16x8x3_sse3) PRIVATE
-sym(vp9_sad16x8x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_16X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_16X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rcx], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rcx+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rcx+8], xmm0
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp9_sad8x16x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp9_sad8x16x3_sse3) PRIVATE
-sym(vp9_sad8x16x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_8X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- punpckldq mm5, mm6
-
- movq [rcx], mm5
- movd [rcx+8], mm7
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp9_sad8x8x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp9_sad8x8x3_sse3) PRIVATE
-sym(vp9_sad8x8x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- PROCESS_8X2X3 0, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 1, src_ptr, ref_ptr, src_stride, ref_stride
- PROCESS_8X2X3 2, src_ptr, ref_ptr, src_stride, ref_stride
-
- mov rcx, result_ptr
-
- punpckldq mm5, mm6
-
- movq [rcx], mm5
- movd [rcx+8], mm7
-
- STACK_FRAME_DESTROY_X3
-
-;void int vp9_sad4x4x3_sse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp9_sad4x4x3_sse3) PRIVATE
-sym(vp9_sad4x4x3_sse3):
-
- STACK_FRAME_CREATE_X3
-
- movd mm0, DWORD PTR [src_ptr]
- movd mm1, DWORD PTR [ref_ptr]
-
- movd mm2, DWORD PTR [src_ptr+src_stride]
- movd mm3, DWORD PTR [ref_ptr+ref_stride]
-
- punpcklbw mm0, mm2
- punpcklbw mm1, mm3
-
- movd mm4, DWORD PTR [ref_ptr+1]
- movd mm5, DWORD PTR [ref_ptr+2]
-
- movd mm2, DWORD PTR [ref_ptr+ref_stride+1]
- movd mm3, DWORD PTR [ref_ptr+ref_stride+2]
-
- psadbw mm1, mm0
-
- punpcklbw mm4, mm2
- punpcklbw mm5, mm3
-
- psadbw mm4, mm0
- psadbw mm5, mm0
-
- lea src_ptr, [src_ptr+src_stride*2]
- lea ref_ptr, [ref_ptr+ref_stride*2]
-
- movd mm0, DWORD PTR [src_ptr]
- movd mm2, DWORD PTR [ref_ptr]
-
- movd mm3, DWORD PTR [src_ptr+src_stride]
- movd mm6, DWORD PTR [ref_ptr+ref_stride]
-
- punpcklbw mm0, mm3
- punpcklbw mm2, mm6
-
- movd mm3, DWORD PTR [ref_ptr+1]
- movd mm7, DWORD PTR [ref_ptr+2]
-
- psadbw mm2, mm0
-
- paddw mm1, mm2
-
- movd mm2, DWORD PTR [ref_ptr+ref_stride+1]
- movd mm6, DWORD PTR [ref_ptr+ref_stride+2]
-
- punpcklbw mm3, mm2
- punpcklbw mm7, mm6
-
- psadbw mm3, mm0
- psadbw mm7, mm0
-
- paddw mm3, mm4
- paddw mm7, mm5
-
- mov rcx, result_ptr
-
- punpckldq mm1, mm3
-
- movq [rcx], mm1
- movd [rcx+8], mm7
-
- STACK_FRAME_DESTROY_X3
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse4.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse4.asm
deleted file mode 100644
index faf1768..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_sse4.asm
+++ /dev/null
@@ -1,359 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro PROCESS_16X2X8 1
-%if %1
- movdqa xmm0, XMMWORD PTR [rsi]
- movq xmm1, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- movq xmm2, MMWORD PTR [rdi+16]
- punpcklqdq xmm1, xmm3
- punpcklqdq xmm3, xmm2
-
- movdqa xmm2, xmm1
- mpsadbw xmm1, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
-
- psrldq xmm0, 8
-
- movdqa xmm4, xmm3
- mpsadbw xmm3, xmm0, 0x0
- mpsadbw xmm4, xmm0, 0x5
-
- paddw xmm1, xmm2
- paddw xmm1, xmm3
- paddw xmm1, xmm4
-%else
- movdqa xmm0, XMMWORD PTR [rsi]
- movq xmm5, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- movq xmm2, MMWORD PTR [rdi+16]
- punpcklqdq xmm5, xmm3
- punpcklqdq xmm3, xmm2
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
-
- psrldq xmm0, 8
-
- movdqa xmm4, xmm3
- mpsadbw xmm3, xmm0, 0x0
- mpsadbw xmm4, xmm0, 0x5
-
- paddw xmm5, xmm2
- paddw xmm5, xmm3
- paddw xmm5, xmm4
-
- paddw xmm1, xmm5
-%endif
- movdqa xmm0, XMMWORD PTR [rsi + rax]
- movq xmm5, MMWORD PTR [rdi+ rdx]
- movq xmm3, MMWORD PTR [rdi+ rdx+8]
- movq xmm2, MMWORD PTR [rdi+ rdx+16]
- punpcklqdq xmm5, xmm3
- punpcklqdq xmm3, xmm2
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
-
- psrldq xmm0, 8
- movdqa xmm4, xmm3
- mpsadbw xmm3, xmm0, 0x0
- mpsadbw xmm4, xmm0, 0x5
-
- paddw xmm5, xmm2
- paddw xmm5, xmm3
- paddw xmm5, xmm4
-
- paddw xmm1, xmm5
-%endmacro
-
-%macro PROCESS_8X2X8 1
-%if %1
- movq xmm0, MMWORD PTR [rsi]
- movq xmm1, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm1, xmm3
-
- movdqa xmm2, xmm1
- mpsadbw xmm1, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
- paddw xmm1, xmm2
-%else
- movq xmm0, MMWORD PTR [rsi]
- movq xmm5, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm5, xmm3
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
- paddw xmm5, xmm2
-
- paddw xmm1, xmm5
-%endif
- movq xmm0, MMWORD PTR [rsi + rax]
- movq xmm5, MMWORD PTR [rdi+ rdx]
- movq xmm3, MMWORD PTR [rdi+ rdx+8]
- punpcklqdq xmm5, xmm3
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- movdqa xmm2, xmm5
- mpsadbw xmm5, xmm0, 0x0
- mpsadbw xmm2, xmm0, 0x5
- paddw xmm5, xmm2
-
- paddw xmm1, xmm5
-%endmacro
-
-%macro PROCESS_4X2X8 1
-%if %1
- movd xmm0, [rsi]
- movq xmm1, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm1, xmm3
-
- mpsadbw xmm1, xmm0, 0x0
-%else
- movd xmm0, [rsi]
- movq xmm5, MMWORD PTR [rdi]
- movq xmm3, MMWORD PTR [rdi+8]
- punpcklqdq xmm5, xmm3
-
- mpsadbw xmm5, xmm0, 0x0
-
- paddw xmm1, xmm5
-%endif
- movd xmm0, [rsi + rax]
- movq xmm5, MMWORD PTR [rdi+ rdx]
- movq xmm3, MMWORD PTR [rdi+ rdx+8]
- punpcklqdq xmm5, xmm3
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- mpsadbw xmm5, xmm0, 0x0
-
- paddw xmm1, xmm5
-%endmacro
-
-%macro WRITE_AS_INTS 0
- mov rdi, arg(4) ;Results
- pxor xmm0, xmm0
- movdqa xmm2, xmm1
- punpcklwd xmm1, xmm0
- punpckhwd xmm2, xmm0
-
- movdqa [rdi], xmm1
- movdqa [rdi + 16], xmm2
-%endmacro
-
-;void vp9_sad16x16x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array);
-global sym(vp9_sad16x16x8_sse4) PRIVATE
-sym(vp9_sad16x16x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_16X2X8 1
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
-
- WRITE_AS_INTS
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp9_sad16x8x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp9_sad16x8x8_sse4) PRIVATE
-sym(vp9_sad16x8x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_16X2X8 1
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
- PROCESS_16X2X8 0
-
- WRITE_AS_INTS
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp9_sad8x8x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp9_sad8x8x8_sse4) PRIVATE
-sym(vp9_sad8x8x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_8X2X8 1
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
-
- WRITE_AS_INTS
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp9_sad8x16x8_sse4(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp9_sad8x16x8_sse4) PRIVATE
-sym(vp9_sad8x16x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_8X2X8 1
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
- PROCESS_8X2X8 0
-
- WRITE_AS_INTS
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp9_sad4x4x8_c(
-; const unsigned char *src_ptr,
-; int src_stride,
-; const unsigned char *ref_ptr,
-; int ref_stride,
-; unsigned short *sad_array
-;);
-global sym(vp9_sad4x4x8_sse4) PRIVATE
-sym(vp9_sad4x4x8_sse4):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- PROCESS_4X2X8 1
- PROCESS_4X2X8 0
-
- WRITE_AS_INTS
-
- ; begin epilog
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_ssse3.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_ssse3.asm
deleted file mode 100644
index 0cb3542..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_sad_ssse3.asm
+++ /dev/null
@@ -1,370 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-%macro PROCESS_16X2X3 1
-%if %1
- movdqa xmm0, XMMWORD PTR [rsi]
- lddqu xmm5, XMMWORD PTR [rdi]
- lddqu xmm6, XMMWORD PTR [rdi+1]
- lddqu xmm7, XMMWORD PTR [rdi+2]
-
- psadbw xmm5, xmm0
- psadbw xmm6, xmm0
- psadbw xmm7, xmm0
-%else
- movdqa xmm0, XMMWORD PTR [rsi]
- lddqu xmm1, XMMWORD PTR [rdi]
- lddqu xmm2, XMMWORD PTR [rdi+1]
- lddqu xmm3, XMMWORD PTR [rdi+2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endif
- movdqa xmm0, XMMWORD PTR [rsi+rax]
- lddqu xmm1, XMMWORD PTR [rdi+rdx]
- lddqu xmm2, XMMWORD PTR [rdi+rdx+1]
- lddqu xmm3, XMMWORD PTR [rdi+rdx+2]
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endmacro
-
-%macro PROCESS_16X2X3_OFFSET 2
-%if %1
- movdqa xmm0, XMMWORD PTR [rsi]
- movdqa xmm4, XMMWORD PTR [rdi]
- movdqa xmm7, XMMWORD PTR [rdi+16]
-
- movdqa xmm5, xmm7
- palignr xmm5, xmm4, %2
-
- movdqa xmm6, xmm7
- palignr xmm6, xmm4, (%2+1)
-
- palignr xmm7, xmm4, (%2+2)
-
- psadbw xmm5, xmm0
- psadbw xmm6, xmm0
- psadbw xmm7, xmm0
-%else
- movdqa xmm0, XMMWORD PTR [rsi]
- movdqa xmm4, XMMWORD PTR [rdi]
- movdqa xmm3, XMMWORD PTR [rdi+16]
-
- movdqa xmm1, xmm3
- palignr xmm1, xmm4, %2
-
- movdqa xmm2, xmm3
- palignr xmm2, xmm4, (%2+1)
-
- palignr xmm3, xmm4, (%2+2)
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endif
- movdqa xmm0, XMMWORD PTR [rsi+rax]
- movdqa xmm4, XMMWORD PTR [rdi+rdx]
- movdqa xmm3, XMMWORD PTR [rdi+rdx+16]
-
- movdqa xmm1, xmm3
- palignr xmm1, xmm4, %2
-
- movdqa xmm2, xmm3
- palignr xmm2, xmm4, (%2+1)
-
- palignr xmm3, xmm4, (%2+2)
-
- lea rsi, [rsi+rax*2]
- lea rdi, [rdi+rdx*2]
-
- psadbw xmm1, xmm0
- psadbw xmm2, xmm0
- psadbw xmm3, xmm0
-
- paddw xmm5, xmm1
- paddw xmm6, xmm2
- paddw xmm7, xmm3
-%endmacro
-
-%macro PROCESS_16X16X3_OFFSET 2
-%2_aligned_by_%1:
-
- sub rdi, %1
-
- PROCESS_16X2X3_OFFSET 1, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
-
- jmp %2_store_off
-
-%endmacro
-
-%macro PROCESS_16X8X3_OFFSET 2
-%2_aligned_by_%1:
-
- sub rdi, %1
-
- PROCESS_16X2X3_OFFSET 1, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
- PROCESS_16X2X3_OFFSET 0, %1
-
- jmp %2_store_off
-
-%endmacro
-
-;void int vp9_sad16x16x3_ssse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp9_sad16x16x3_ssse3) PRIVATE
-sym(vp9_sad16x16x3_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- push rsi
- push rdi
- push rcx
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- mov rdx, 0xf
- and rdx, rdi
-
- jmp .vp9_sad16x16x3_ssse3_skiptable
-.vp9_sad16x16x3_ssse3_jumptable:
- dd .vp9_sad16x16x3_ssse3_aligned_by_0 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_1 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_2 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_3 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_4 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_5 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_6 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_7 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_8 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_9 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_10 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_11 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_12 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_13 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_14 - .vp9_sad16x16x3_ssse3_do_jump
- dd .vp9_sad16x16x3_ssse3_aligned_by_15 - .vp9_sad16x16x3_ssse3_do_jump
-.vp9_sad16x16x3_ssse3_skiptable:
-
- call .vp9_sad16x16x3_ssse3_do_jump
-.vp9_sad16x16x3_ssse3_do_jump:
- pop rcx ; get the address of do_jump
- mov rax, .vp9_sad16x16x3_ssse3_jumptable - .vp9_sad16x16x3_ssse3_do_jump
- add rax, rcx ; get the absolute address of vp9_sad16x16x3_ssse3_jumptable
-
- movsxd rax, dword [rax + 4*rdx] ; get the 32 bit offset from the jumptable
- add rcx, rax
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- jmp rcx
-
- PROCESS_16X16X3_OFFSET 0, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 1, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 2, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 3, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 4, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 5, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 6, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 7, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 8, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 9, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 10, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 11, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 12, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 13, .vp9_sad16x16x3_ssse3
- PROCESS_16X16X3_OFFSET 14, .vp9_sad16x16x3_ssse3
-
-.vp9_sad16x16x3_ssse3_aligned_by_15:
- PROCESS_16X2X3 1
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
-
-.vp9_sad16x16x3_ssse3_store_off:
- mov rdi, arg(4) ;Results
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rdi], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rdi+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rdi+8], xmm0
-
- ; begin epilog
- pop rcx
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void int vp9_sad16x8x3_ssse3(
-; unsigned char *src_ptr,
-; int src_stride,
-; unsigned char *ref_ptr,
-; int ref_stride,
-; int *results)
-global sym(vp9_sad16x8x3_ssse3) PRIVATE
-sym(vp9_sad16x8x3_ssse3):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- SAVE_XMM 7
- push rsi
- push rdi
- push rcx
- ; end prolog
-
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;ref_ptr
-
- mov rdx, 0xf
- and rdx, rdi
-
- jmp .vp9_sad16x8x3_ssse3_skiptable
-.vp9_sad16x8x3_ssse3_jumptable:
- dd .vp9_sad16x8x3_ssse3_aligned_by_0 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_1 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_2 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_3 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_4 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_5 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_6 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_7 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_8 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_9 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_10 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_11 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_12 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_13 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_14 - .vp9_sad16x8x3_ssse3_do_jump
- dd .vp9_sad16x8x3_ssse3_aligned_by_15 - .vp9_sad16x8x3_ssse3_do_jump
-.vp9_sad16x8x3_ssse3_skiptable:
-
- call .vp9_sad16x8x3_ssse3_do_jump
-.vp9_sad16x8x3_ssse3_do_jump:
- pop rcx ; get the address of do_jump
- mov rax, .vp9_sad16x8x3_ssse3_jumptable - .vp9_sad16x8x3_ssse3_do_jump
- add rax, rcx ; get the absolute address of vp9_sad16x8x3_ssse3_jumptable
-
- movsxd rax, dword [rax + 4*rdx] ; get the 32 bit offset from the jumptable
- add rcx, rax
-
- movsxd rax, dword ptr arg(1) ;src_stride
- movsxd rdx, dword ptr arg(3) ;ref_stride
-
- jmp rcx
-
- PROCESS_16X8X3_OFFSET 0, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 1, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 2, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 3, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 4, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 5, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 6, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 7, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 8, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 9, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 10, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 11, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 12, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 13, .vp9_sad16x8x3_ssse3
- PROCESS_16X8X3_OFFSET 14, .vp9_sad16x8x3_ssse3
-
-.vp9_sad16x8x3_ssse3_aligned_by_15:
-
- PROCESS_16X2X3 1
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
- PROCESS_16X2X3 0
-
-.vp9_sad16x8x3_ssse3_store_off:
- mov rdi, arg(4) ;Results
-
- movq xmm0, xmm5
- psrldq xmm5, 8
-
- paddw xmm0, xmm5
- movd [rdi], xmm0
-;-
- movq xmm0, xmm6
- psrldq xmm6, 8
-
- paddw xmm0, xmm6
- movd [rdi+4], xmm0
-;-
- movq xmm0, xmm7
- psrldq xmm7, 8
-
- paddw xmm0, xmm7
- movd [rdi+8], xmm0
-
- ; begin epilog
- pop rcx
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_ssim_opt.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_ssim_opt.asm
deleted file mode 100644
index 455d10d..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_ssim_opt.asm
+++ /dev/null
@@ -1,216 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "vpx_ports/x86_abi_support.asm"
-
-; tabulate_ssim - sums sum_s,sum_r,sum_sq_s,sum_sq_r, sum_sxr
-%macro TABULATE_SSIM 0
- paddusw xmm15, xmm3 ; sum_s
- paddusw xmm14, xmm4 ; sum_r
- movdqa xmm1, xmm3
- pmaddwd xmm1, xmm1
- paddd xmm13, xmm1 ; sum_sq_s
- movdqa xmm2, xmm4
- pmaddwd xmm2, xmm2
- paddd xmm12, xmm2 ; sum_sq_r
- pmaddwd xmm3, xmm4
- paddd xmm11, xmm3 ; sum_sxr
-%endmacro
-
-; Sum across the register %1 starting with q words
-%macro SUM_ACROSS_Q 1
- movdqa xmm2,%1
- punpckldq %1,xmm0
- punpckhdq xmm2,xmm0
- paddq %1,xmm2
- movdqa xmm2,%1
- punpcklqdq %1,xmm0
- punpckhqdq xmm2,xmm0
- paddq %1,xmm2
-%endmacro
-
-; Sum across the register %1 starting with q words
-%macro SUM_ACROSS_W 1
- movdqa xmm1, %1
- punpcklwd %1,xmm0
- punpckhwd xmm1,xmm0
- paddd %1, xmm1
- SUM_ACROSS_Q %1
-%endmacro
-;void ssim_parms_sse2(
-; unsigned char *s,
-; int sp,
-; unsigned char *r,
-; int rp
-; unsigned long *sum_s,
-; unsigned long *sum_r,
-; unsigned long *sum_sq_s,
-; unsigned long *sum_sq_r,
-; unsigned long *sum_sxr);
-;
-; TODO: Use parm passing through structure, probably don't need the pxors
-; ( calling app will initialize to 0 ) could easily fit everything in sse2
-; without too much hastle, and can probably do better estimates with psadw
-; or pavgb At this point this is just meant to be first pass for calculating
-; all the parms needed for 16x16 ssim so we can play with dssim as distortion
-; in mode selection code.
-global sym(vp9_ssim_parms_16x16_sse2) PRIVATE
-sym(vp9_ssim_parms_16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 9
- SAVE_XMM 15
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;s
- mov rcx, arg(1) ;sp
- mov rdi, arg(2) ;r
- mov rax, arg(3) ;rp
-
- pxor xmm0, xmm0
- pxor xmm15,xmm15 ;sum_s
- pxor xmm14,xmm14 ;sum_r
- pxor xmm13,xmm13 ;sum_sq_s
- pxor xmm12,xmm12 ;sum_sq_r
- pxor xmm11,xmm11 ;sum_sxr
-
- mov rdx, 16 ;row counter
-.NextRow:
-
- ;grab source and reference pixels
- movdqu xmm5, [rsi]
- movdqu xmm6, [rdi]
- movdqa xmm3, xmm5
- movdqa xmm4, xmm6
- punpckhbw xmm3, xmm0 ; high_s
- punpckhbw xmm4, xmm0 ; high_r
-
- TABULATE_SSIM
-
- movdqa xmm3, xmm5
- movdqa xmm4, xmm6
- punpcklbw xmm3, xmm0 ; low_s
- punpcklbw xmm4, xmm0 ; low_r
-
- TABULATE_SSIM
-
- add rsi, rcx ; next s row
- add rdi, rax ; next r row
-
- dec rdx ; counter
- jnz .NextRow
-
- SUM_ACROSS_W xmm15
- SUM_ACROSS_W xmm14
- SUM_ACROSS_Q xmm13
- SUM_ACROSS_Q xmm12
- SUM_ACROSS_Q xmm11
-
- mov rdi,arg(4)
- movd [rdi], xmm15;
- mov rdi,arg(5)
- movd [rdi], xmm14;
- mov rdi,arg(6)
- movd [rdi], xmm13;
- mov rdi,arg(7)
- movd [rdi], xmm12;
- mov rdi,arg(8)
- movd [rdi], xmm11;
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void ssim_parms_sse2(
-; unsigned char *s,
-; int sp,
-; unsigned char *r,
-; int rp
-; unsigned long *sum_s,
-; unsigned long *sum_r,
-; unsigned long *sum_sq_s,
-; unsigned long *sum_sq_r,
-; unsigned long *sum_sxr);
-;
-; TODO: Use parm passing through structure, probably don't need the pxors
-; ( calling app will initialize to 0 ) could easily fit everything in sse2
-; without too much hastle, and can probably do better estimates with psadw
-; or pavgb At this point this is just meant to be first pass for calculating
-; all the parms needed for 16x16 ssim so we can play with dssim as distortion
-; in mode selection code.
-global sym(vp9_ssim_parms_8x8_sse2) PRIVATE
-sym(vp9_ssim_parms_8x8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 9
- SAVE_XMM 15
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;s
- mov rcx, arg(1) ;sp
- mov rdi, arg(2) ;r
- mov rax, arg(3) ;rp
-
- pxor xmm0, xmm0
- pxor xmm15,xmm15 ;sum_s
- pxor xmm14,xmm14 ;sum_r
- pxor xmm13,xmm13 ;sum_sq_s
- pxor xmm12,xmm12 ;sum_sq_r
- pxor xmm11,xmm11 ;sum_sxr
-
- mov rdx, 8 ;row counter
-.NextRow:
-
- ;grab source and reference pixels
- movq xmm3, [rsi]
- movq xmm4, [rdi]
- punpcklbw xmm3, xmm0 ; low_s
- punpcklbw xmm4, xmm0 ; low_r
-
- TABULATE_SSIM
-
- add rsi, rcx ; next s row
- add rdi, rax ; next r row
-
- dec rdx ; counter
- jnz .NextRow
-
- SUM_ACROSS_W xmm15
- SUM_ACROSS_W xmm14
- SUM_ACROSS_Q xmm13
- SUM_ACROSS_Q xmm12
- SUM_ACROSS_Q xmm11
-
- mov rdi,arg(4)
- movd [rdi], xmm15;
- mov rdi,arg(5)
- movd [rdi], xmm14;
- mov rdi,arg(6)
- movd [rdi], xmm13;
- mov rdi,arg(7)
- movd [rdi], xmm12;
- mov rdi,arg(8)
- movd [rdi], xmm11;
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance.asm
deleted file mode 100644
index 1a9e4e8..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance.asm
+++ /dev/null
@@ -1,1420 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION_RODATA
-pw_8: times 8 dw 8
-bilin_filter_m_sse2: times 8 dw 16
- times 8 dw 0
- times 8 dw 15
- times 8 dw 1
- times 8 dw 14
- times 8 dw 2
- times 8 dw 13
- times 8 dw 3
- times 8 dw 12
- times 8 dw 4
- times 8 dw 11
- times 8 dw 5
- times 8 dw 10
- times 8 dw 6
- times 8 dw 9
- times 8 dw 7
- times 16 dw 8
- times 8 dw 7
- times 8 dw 9
- times 8 dw 6
- times 8 dw 10
- times 8 dw 5
- times 8 dw 11
- times 8 dw 4
- times 8 dw 12
- times 8 dw 3
- times 8 dw 13
- times 8 dw 2
- times 8 dw 14
- times 8 dw 1
- times 8 dw 15
-
-bilin_filter_m_ssse3: times 8 db 16, 0
- times 8 db 15, 1
- times 8 db 14, 2
- times 8 db 13, 3
- times 8 db 12, 4
- times 8 db 11, 5
- times 8 db 10, 6
- times 8 db 9, 7
- times 16 db 8
- times 8 db 7, 9
- times 8 db 6, 10
- times 8 db 5, 11
- times 8 db 4, 12
- times 8 db 3, 13
- times 8 db 2, 14
- times 8 db 1, 15
-
-SECTION .text
-
-; int vp9_sub_pixel_varianceNxh(const uint8_t *src, ptrdiff_t src_stride,
-; int x_offset, int y_offset,
-; const uint8_t *dst, ptrdiff_t dst_stride,
-; int height, unsigned int *sse);
-;
-; This function returns the SE and stores SSE in the given pointer.
-
-%macro SUM_SSE 6 ; src1, dst1, src2, dst2, sum, sse
- psubw %3, %4
- psubw %1, %2
- paddw %5, %3
- pmaddwd %3, %3
- paddw %5, %1
- pmaddwd %1, %1
- paddd %6, %3
- paddd %6, %1
-%endmacro
-
-%macro STORE_AND_RET 0
-%if mmsize == 16
- ; if H=64 and W=16, we have 8 words of each 2(1bit)x64(6bit)x9bit=16bit
- ; in m6, i.e. it _exactly_ fits in a signed word per word in the xmm reg.
- ; We have to sign-extend it before adding the words within the register
- ; and outputing to a dword.
- pcmpgtw m5, m6 ; mask for 0 > x
- movhlps m3, m7
- punpcklwd m4, m6, m5
- punpckhwd m6, m5 ; sign-extend m6 word->dword
- paddd m7, m3
- paddd m6, m4
- pshufd m3, m7, 0x1
- movhlps m4, m6
- paddd m7, m3
- paddd m6, m4
- mov r1, ssem ; r1 = unsigned int *sse
- pshufd m4, m6, 0x1
- movd [r1], m7 ; store sse
- paddd m6, m4
- movd rax, m6 ; store sum as return value
-%else ; mmsize == 8
- pshufw m4, m6, 0xe
- pshufw m3, m7, 0xe
- paddw m6, m4
- paddd m7, m3
- pcmpgtw m5, m6 ; mask for 0 > x
- mov r1, ssem ; r1 = unsigned int *sse
- punpcklwd m6, m5 ; sign-extend m6 word->dword
- movd [r1], m7 ; store sse
- pshufw m4, m6, 0xe
- paddd m6, m4
- movd rax, m6 ; store sum as return value
-%endif
- RET
-%endmacro
-
-%macro INC_SRC_BY_SRC_STRIDE 0
-%if ARCH_X86=1 && CONFIG_PIC=1
- add srcq, src_stridemp
-%else
- add srcq, src_strideq
-%endif
-%endmacro
-
-%macro SUBPEL_VARIANCE 1-2 0 ; W
-%if cpuflag(ssse3)
-%define bilin_filter_m bilin_filter_m_ssse3
-%define filter_idx_shift 4
-%else
-%define bilin_filter_m bilin_filter_m_sse2
-%define filter_idx_shift 5
-%endif
-; FIXME(rbultje) only bilinear filters use >8 registers, and ssse3 only uses
-; 11, not 13, if the registers are ordered correctly. May make a minor speed
-; difference on Win64
-
-%ifdef PIC ; 64bit PIC
- %if %2 == 1 ; avg
- cglobal sub_pixel_avg_variance%1xh, 9, 10, 13, src, src_stride, \
- x_offset, y_offset, \
- dst, dst_stride, \
- sec, sec_stride, height, sse
- %define sec_str sec_strideq
- %else
- cglobal sub_pixel_variance%1xh, 7, 8, 13, src, src_stride, x_offset, \
- y_offset, dst, dst_stride, height, sse
- %endif
- %define h heightd
- %define bilin_filter sseq
-%else
- %if ARCH_X86=1 && CONFIG_PIC=1
- %if %2 == 1 ; avg
- cglobal sub_pixel_avg_variance%1xh, 7, 7, 13, src, src_stride, \
- x_offset, y_offset, \
- dst, dst_stride, \
- sec, sec_stride, \
- height, sse, g_bilin_filter, g_pw_8
- %define h dword heightm
- %define sec_str sec_stridemp
-
- ;Store bilin_filter and pw_8 location in stack
- GET_GOT eax
- add esp, 4 ; restore esp
-
- lea ecx, [GLOBAL(bilin_filter_m)]
- mov g_bilin_filterm, ecx
-
- lea ecx, [GLOBAL(pw_8)]
- mov g_pw_8m, ecx
-
- LOAD_IF_USED 0, 1 ; load eax, ecx back
- %else
- cglobal sub_pixel_variance%1xh, 7, 7, 13, src, src_stride, x_offset, \
- y_offset, dst, dst_stride, height, sse, \
- g_bilin_filter, g_pw_8
- %define h heightd
-
- ;Store bilin_filter and pw_8 location in stack
- GET_GOT eax
- add esp, 4 ; restore esp
-
- lea ecx, [GLOBAL(bilin_filter_m)]
- mov g_bilin_filterm, ecx
-
- lea ecx, [GLOBAL(pw_8)]
- mov g_pw_8m, ecx
-
- LOAD_IF_USED 0, 1 ; load eax, ecx back
- %endif
- %else
- %if %2 == 1 ; avg
- cglobal sub_pixel_avg_variance%1xh, 7 + 2 * ARCH_X86_64, \
- 7 + 2 * ARCH_X86_64, 13, src, src_stride, \
- x_offset, y_offset, \
- dst, dst_stride, \
- sec, sec_stride, \
- height, sse
- %if ARCH_X86_64
- %define h heightd
- %define sec_str sec_strideq
- %else
- %define h dword heightm
- %define sec_str sec_stridemp
- %endif
- %else
- cglobal sub_pixel_variance%1xh, 7, 7, 13, src, src_stride, x_offset, \
- y_offset, dst, dst_stride, height, sse
- %define h heightd
- %endif
-
- %define bilin_filter bilin_filter_m
- %endif
-%endif
-
- ASSERT %1 <= 16 ; m6 overflows if w > 16
- pxor m6, m6 ; sum
- pxor m7, m7 ; sse
- ; FIXME(rbultje) if both filters are bilinear, we don't actually use m5; we
- ; could perhaps use it for something more productive then
- pxor m5, m5 ; dedicated zero register
-%if %1 < 16
- sar h, 1
-%if %2 == 1 ; avg
- shl sec_str, 1
-%endif
-%endif
-
- ; FIXME(rbultje) replace by jumptable?
- test x_offsetd, x_offsetd
- jnz .x_nonzero
- ; x_offset == 0
- test y_offsetd, y_offsetd
- jnz .x_zero_y_nonzero
-
- ; x_offset == 0 && y_offset == 0
-.x_zero_y_zero_loop:
-%if %1 == 16
- movu m0, [srcq]
- mova m1, [dstq]
-%if %2 == 1 ; avg
- pavgb m0, [secq]
- punpckhbw m3, m1, m5
- punpcklbw m1, m5
-%endif
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%if %2 == 0 ; !avg
- punpckhbw m3, m1, m5
- punpcklbw m1, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
-%if %2 == 1 ; avg
-%if mmsize == 16
- movhps m0, [srcq+src_strideq]
-%else ; mmsize == 8
- punpckldq m0, [srcq+src_strideq]
-%endif
-%else ; !avg
- movh m2, [srcq+src_strideq]
-%endif
- movh m1, [dstq]
- movh m3, [dstq+dst_strideq]
-%if %2 == 1 ; avg
- pavgb m0, [secq]
- punpcklbw m3, m5
- punpcklbw m1, m5
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%else ; !avg
- punpcklbw m0, m5
- punpcklbw m2, m5
- punpcklbw m3, m5
- punpcklbw m1, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_zero_y_zero_loop
- STORE_AND_RET
-
-.x_zero_y_nonzero:
- cmp y_offsetd, 8
- jne .x_zero_y_nonhalf
-
- ; x_offset == 0 && y_offset == 0.5
-.x_zero_y_half_loop:
-%if %1 == 16
- movu m0, [srcq]
- movu m4, [srcq+src_strideq]
- mova m1, [dstq]
- pavgb m0, m4
- punpckhbw m3, m1, m5
-%if %2 == 1 ; avg
- pavgb m0, [secq]
-%endif
- punpcklbw m1, m5
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m2, [srcq+src_strideq]
-%if %2 == 1 ; avg
-%if mmsize == 16
- movhps m2, [srcq+src_strideq*2]
-%else ; mmsize == 8
-%if %1 == 4
- movh m1, [srcq+src_strideq*2]
- punpckldq m2, m1
-%else
- punpckldq m2, [srcq+src_strideq*2]
-%endif
-%endif
- movh m1, [dstq]
-%if mmsize == 16
- movlhps m0, m2
-%else ; mmsize == 8
- punpckldq m0, m2
-%endif
- movh m3, [dstq+dst_strideq]
- pavgb m0, m2
- punpcklbw m1, m5
- pavgb m0, [secq]
- punpcklbw m3, m5
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%else ; !avg
- movh m4, [srcq+src_strideq*2]
- movh m1, [dstq]
- pavgb m0, m2
- movh m3, [dstq+dst_strideq]
- pavgb m2, m4
- punpcklbw m0, m5
- punpcklbw m2, m5
- punpcklbw m3, m5
- punpcklbw m1, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_zero_y_half_loop
- STORE_AND_RET
-
-.x_zero_y_nonhalf:
- ; x_offset == 0 && y_offset == bilin interpolation
-%ifdef PIC
- lea bilin_filter, [bilin_filter_m]
-%endif
- shl y_offsetd, filter_idx_shift
-%if ARCH_X86_64 && mmsize == 16
- mova m8, [bilin_filter+y_offsetq]
-%if notcpuflag(ssse3) ; FIXME(rbultje) don't scatter registers on x86-64
- mova m9, [bilin_filter+y_offsetq+16]
-%endif
- mova m10, [pw_8]
-%define filter_y_a m8
-%define filter_y_b m9
-%define filter_rnd m10
-%else ; x86-32 or mmx
-%if ARCH_X86=1 && CONFIG_PIC=1
-; x_offset == 0, reuse x_offset reg
-%define tempq x_offsetq
- add y_offsetq, g_bilin_filterm
-%define filter_y_a [y_offsetq]
-%define filter_y_b [y_offsetq+16]
- mov tempq, g_pw_8m
-%define filter_rnd [tempq]
-%else
- add y_offsetq, bilin_filter
-%define filter_y_a [y_offsetq]
-%define filter_y_b [y_offsetq+16]
-%define filter_rnd [pw_8]
-%endif
-%endif
-
-.x_zero_y_other_loop:
-%if %1 == 16
- movu m0, [srcq]
- movu m4, [srcq+src_strideq]
- mova m1, [dstq]
-%if cpuflag(ssse3)
- punpckhbw m2, m0, m4
- punpcklbw m0, m4
- pmaddubsw m2, filter_y_a
- pmaddubsw m0, filter_y_a
- paddw m2, filter_rnd
- paddw m0, filter_rnd
-%else
- punpckhbw m2, m0, m5
- punpckhbw m3, m4, m5
- punpcklbw m0, m5
- punpcklbw m4, m5
- ; FIXME(rbultje) instead of out=((num-x)*in1+x*in2+rnd)>>log2(num), we can
- ; also do out=in1+(((num-x)*(in2-in1)+rnd)>>log2(num)). Total number of
- ; instructions is the same (5), but it is 1 mul instead of 2, so might be
- ; slightly faster because of pmullw latency. It would also cut our rodata
- ; tables in half for this function, and save 1-2 registers on x86-64.
- pmullw m2, filter_y_a
- pmullw m3, filter_y_b
- paddw m2, filter_rnd
- pmullw m0, filter_y_a
- pmullw m4, filter_y_b
- paddw m0, filter_rnd
- paddw m2, m3
- paddw m0, m4
-%endif
- psraw m2, 4
- psraw m0, 4
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- punpckhbw m3, m1, m5
- punpcklbw m1, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m2, [srcq+src_strideq]
- movh m4, [srcq+src_strideq*2]
- movh m3, [dstq+dst_strideq]
-%if cpuflag(ssse3)
- movh m1, [dstq]
- punpcklbw m0, m2
- punpcklbw m2, m4
- pmaddubsw m0, filter_y_a
- pmaddubsw m2, filter_y_a
- punpcklbw m3, m5
- paddw m2, filter_rnd
- paddw m0, filter_rnd
-%else
- punpcklbw m0, m5
- punpcklbw m2, m5
- punpcklbw m4, m5
- pmullw m0, filter_y_a
- pmullw m1, m2, filter_y_b
- punpcklbw m3, m5
- paddw m0, filter_rnd
- pmullw m2, filter_y_a
- pmullw m4, filter_y_b
- paddw m0, m1
- paddw m2, filter_rnd
- movh m1, [dstq]
- paddw m2, m4
-%endif
- psraw m0, 4
- psraw m2, 4
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- punpcklbw m1, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_zero_y_other_loop
-%undef filter_y_a
-%undef filter_y_b
-%undef filter_rnd
- STORE_AND_RET
-
-.x_nonzero:
- cmp x_offsetd, 8
- jne .x_nonhalf
- ; x_offset == 0.5
- test y_offsetd, y_offsetd
- jnz .x_half_y_nonzero
-
- ; x_offset == 0.5 && y_offset == 0
-.x_half_y_zero_loop:
-%if %1 == 16
- movu m0, [srcq]
- movu m4, [srcq+1]
- mova m1, [dstq]
- pavgb m0, m4
- punpckhbw m3, m1, m5
-%if %2 == 1 ; avg
- pavgb m0, [secq]
-%endif
- punpcklbw m1, m5
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m4, [srcq+1]
-%if %2 == 1 ; avg
-%if mmsize == 16
- movhps m0, [srcq+src_strideq]
- movhps m4, [srcq+src_strideq+1]
-%else ; mmsize == 8
- punpckldq m0, [srcq+src_strideq]
- punpckldq m4, [srcq+src_strideq+1]
-%endif
- movh m1, [dstq]
- movh m3, [dstq+dst_strideq]
- pavgb m0, m4
- punpcklbw m3, m5
- pavgb m0, [secq]
- punpcklbw m1, m5
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%else ; !avg
- movh m2, [srcq+src_strideq]
- movh m1, [dstq]
- pavgb m0, m4
- movh m4, [srcq+src_strideq+1]
- movh m3, [dstq+dst_strideq]
- pavgb m2, m4
- punpcklbw m0, m5
- punpcklbw m2, m5
- punpcklbw m3, m5
- punpcklbw m1, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_half_y_zero_loop
- STORE_AND_RET
-
-.x_half_y_nonzero:
- cmp y_offsetd, 8
- jne .x_half_y_nonhalf
-
- ; x_offset == 0.5 && y_offset == 0.5
-%if %1 == 16
- movu m0, [srcq]
- movu m3, [srcq+1]
- add srcq, src_strideq
- pavgb m0, m3
-.x_half_y_half_loop:
- movu m4, [srcq]
- movu m3, [srcq+1]
- mova m1, [dstq]
- pavgb m4, m3
- punpckhbw m3, m1, m5
- pavgb m0, m4
-%if %2 == 1 ; avg
- punpcklbw m1, m5
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%else
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
- punpcklbw m1, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m3, [srcq+1]
- add srcq, src_strideq
- pavgb m0, m3
-.x_half_y_half_loop:
- movh m2, [srcq]
- movh m3, [srcq+1]
-%if %2 == 1 ; avg
-%if mmsize == 16
- movhps m2, [srcq+src_strideq]
- movhps m3, [srcq+src_strideq+1]
-%else
-%if %1 == 4
- movh m1, [srcq+src_strideq]
- punpckldq m2, m1
- movh m1, [srcq+src_strideq+1]
- punpckldq m3, m1
-%else
- punpckldq m2, [srcq+src_strideq]
- punpckldq m3, [srcq+src_strideq+1]
-%endif
-%endif
- pavgb m2, m3
-%if mmsize == 16
- movlhps m0, m2
- movhlps m4, m2
-%else ; mmsize == 8
- punpckldq m0, m2
- pshufw m4, m2, 0xe
-%endif
- movh m1, [dstq]
- pavgb m0, m2
- movh m3, [dstq+dst_strideq]
- pavgb m0, [secq]
- punpcklbw m3, m5
- punpcklbw m1, m5
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%else ; !avg
- movh m4, [srcq+src_strideq]
- movh m1, [srcq+src_strideq+1]
- pavgb m2, m3
- pavgb m4, m1
- pavgb m0, m2
- pavgb m2, m4
- movh m1, [dstq]
- movh m3, [dstq+dst_strideq]
- punpcklbw m0, m5
- punpcklbw m2, m5
- punpcklbw m3, m5
- punpcklbw m1, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_half_y_half_loop
- STORE_AND_RET
-
-.x_half_y_nonhalf:
- ; x_offset == 0.5 && y_offset == bilin interpolation
-%ifdef PIC
- lea bilin_filter, [bilin_filter_m]
-%endif
- shl y_offsetd, filter_idx_shift
-%if ARCH_X86_64 && mmsize == 16
- mova m8, [bilin_filter+y_offsetq]
-%if notcpuflag(ssse3) ; FIXME(rbultje) don't scatter registers on x86-64
- mova m9, [bilin_filter+y_offsetq+16]
-%endif
- mova m10, [pw_8]
-%define filter_y_a m8
-%define filter_y_b m9
-%define filter_rnd m10
-%else ;x86_32
-%if ARCH_X86=1 && CONFIG_PIC=1
-; x_offset == 0.5. We can reuse x_offset reg
-%define tempq x_offsetq
- add y_offsetq, g_bilin_filterm
-%define filter_y_a [y_offsetq]
-%define filter_y_b [y_offsetq+16]
- mov tempq, g_pw_8m
-%define filter_rnd [tempq]
-%else
- add y_offsetq, bilin_filter
-%define filter_y_a [y_offsetq]
-%define filter_y_b [y_offsetq+16]
-%define filter_rnd [pw_8]
-%endif
-%endif
-
-%if %1 == 16
- movu m0, [srcq]
- movu m3, [srcq+1]
- add srcq, src_strideq
- pavgb m0, m3
-.x_half_y_other_loop:
- movu m4, [srcq]
- movu m2, [srcq+1]
- mova m1, [dstq]
- pavgb m4, m2
-%if cpuflag(ssse3)
- punpckhbw m2, m0, m4
- punpcklbw m0, m4
- pmaddubsw m2, filter_y_a
- pmaddubsw m0, filter_y_a
- paddw m2, filter_rnd
- paddw m0, filter_rnd
- psraw m2, 4
-%else
- punpckhbw m2, m0, m5
- punpckhbw m3, m4, m5
- pmullw m2, filter_y_a
- pmullw m3, filter_y_b
- paddw m2, filter_rnd
- punpcklbw m0, m5
- paddw m2, m3
- punpcklbw m3, m4, m5
- pmullw m0, filter_y_a
- pmullw m3, filter_y_b
- paddw m0, filter_rnd
- psraw m2, 4
- paddw m0, m3
-%endif
- punpckhbw m3, m1, m5
- psraw m0, 4
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- punpcklbw m1, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m3, [srcq+1]
- add srcq, src_strideq
- pavgb m0, m3
-%if notcpuflag(ssse3)
- punpcklbw m0, m5
-%endif
-.x_half_y_other_loop:
- movh m2, [srcq]
- movh m1, [srcq+1]
- movh m4, [srcq+src_strideq]
- movh m3, [srcq+src_strideq+1]
- pavgb m2, m1
- pavgb m4, m3
- movh m3, [dstq+dst_strideq]
-%if cpuflag(ssse3)
- movh m1, [dstq]
- punpcklbw m0, m2
- punpcklbw m2, m4
- pmaddubsw m0, filter_y_a
- pmaddubsw m2, filter_y_a
- punpcklbw m3, m5
- paddw m0, filter_rnd
- paddw m2, filter_rnd
-%else
- punpcklbw m2, m5
- punpcklbw m4, m5
- pmullw m0, filter_y_a
- pmullw m1, m2, filter_y_b
- punpcklbw m3, m5
- paddw m0, filter_rnd
- pmullw m2, filter_y_a
- paddw m0, m1
- pmullw m1, m4, filter_y_b
- paddw m2, filter_rnd
- paddw m2, m1
- movh m1, [dstq]
-%endif
- psraw m0, 4
- psraw m2, 4
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- punpcklbw m1, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_half_y_other_loop
-%undef filter_y_a
-%undef filter_y_b
-%undef filter_rnd
- STORE_AND_RET
-
-.x_nonhalf:
- test y_offsetd, y_offsetd
- jnz .x_nonhalf_y_nonzero
-
- ; x_offset == bilin interpolation && y_offset == 0
-%ifdef PIC
- lea bilin_filter, [bilin_filter_m]
-%endif
- shl x_offsetd, filter_idx_shift
-%if ARCH_X86_64 && mmsize == 16
- mova m8, [bilin_filter+x_offsetq]
-%if notcpuflag(ssse3) ; FIXME(rbultje) don't scatter registers on x86-64
- mova m9, [bilin_filter+x_offsetq+16]
-%endif
- mova m10, [pw_8]
-%define filter_x_a m8
-%define filter_x_b m9
-%define filter_rnd m10
-%else ; x86-32
-%if ARCH_X86=1 && CONFIG_PIC=1
-;y_offset == 0. We can reuse y_offset reg.
-%define tempq y_offsetq
- add x_offsetq, g_bilin_filterm
-%define filter_x_a [x_offsetq]
-%define filter_x_b [x_offsetq+16]
- mov tempq, g_pw_8m
-%define filter_rnd [tempq]
-%else
- add x_offsetq, bilin_filter
-%define filter_x_a [x_offsetq]
-%define filter_x_b [x_offsetq+16]
-%define filter_rnd [pw_8]
-%endif
-%endif
-
-.x_other_y_zero_loop:
-%if %1 == 16
- movu m0, [srcq]
- movu m4, [srcq+1]
- mova m1, [dstq]
-%if cpuflag(ssse3)
- punpckhbw m2, m0, m4
- punpcklbw m0, m4
- pmaddubsw m2, filter_x_a
- pmaddubsw m0, filter_x_a
- paddw m2, filter_rnd
- paddw m0, filter_rnd
-%else
- punpckhbw m2, m0, m5
- punpckhbw m3, m4, m5
- punpcklbw m0, m5
- punpcklbw m4, m5
- pmullw m2, filter_x_a
- pmullw m3, filter_x_b
- paddw m2, filter_rnd
- pmullw m0, filter_x_a
- pmullw m4, filter_x_b
- paddw m0, filter_rnd
- paddw m2, m3
- paddw m0, m4
-%endif
- psraw m2, 4
- psraw m0, 4
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- punpckhbw m3, m1, m5
- punpcklbw m1, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m1, [srcq+1]
- movh m2, [srcq+src_strideq]
- movh m4, [srcq+src_strideq+1]
- movh m3, [dstq+dst_strideq]
-%if cpuflag(ssse3)
- punpcklbw m0, m1
- movh m1, [dstq]
- punpcklbw m2, m4
- pmaddubsw m0, filter_x_a
- pmaddubsw m2, filter_x_a
- punpcklbw m3, m5
- paddw m0, filter_rnd
- paddw m2, filter_rnd
-%else
- punpcklbw m0, m5
- punpcklbw m1, m5
- punpcklbw m2, m5
- punpcklbw m4, m5
- pmullw m0, filter_x_a
- pmullw m1, filter_x_b
- punpcklbw m3, m5
- paddw m0, filter_rnd
- pmullw m2, filter_x_a
- pmullw m4, filter_x_b
- paddw m0, m1
- paddw m2, filter_rnd
- movh m1, [dstq]
- paddw m2, m4
-%endif
- psraw m0, 4
- psraw m2, 4
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- punpcklbw m1, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_other_y_zero_loop
-%undef filter_x_a
-%undef filter_x_b
-%undef filter_rnd
- STORE_AND_RET
-
-.x_nonhalf_y_nonzero:
- cmp y_offsetd, 8
- jne .x_nonhalf_y_nonhalf
-
- ; x_offset == bilin interpolation && y_offset == 0.5
-%ifdef PIC
- lea bilin_filter, [bilin_filter_m]
-%endif
- shl x_offsetd, filter_idx_shift
-%if ARCH_X86_64 && mmsize == 16
- mova m8, [bilin_filter+x_offsetq]
-%if notcpuflag(ssse3) ; FIXME(rbultje) don't scatter registers on x86-64
- mova m9, [bilin_filter+x_offsetq+16]
-%endif
- mova m10, [pw_8]
-%define filter_x_a m8
-%define filter_x_b m9
-%define filter_rnd m10
-%else ; x86-32
-%if ARCH_X86=1 && CONFIG_PIC=1
-; y_offset == 0.5. We can reuse y_offset reg.
-%define tempq y_offsetq
- add x_offsetq, g_bilin_filterm
-%define filter_x_a [x_offsetq]
-%define filter_x_b [x_offsetq+16]
- mov tempq, g_pw_8m
-%define filter_rnd [tempq]
-%else
- add x_offsetq, bilin_filter
-%define filter_x_a [x_offsetq]
-%define filter_x_b [x_offsetq+16]
-%define filter_rnd [pw_8]
-%endif
-%endif
-
-%if %1 == 16
- movu m0, [srcq]
- movu m1, [srcq+1]
-%if cpuflag(ssse3)
- punpckhbw m2, m0, m1
- punpcklbw m0, m1
- pmaddubsw m2, filter_x_a
- pmaddubsw m0, filter_x_a
- paddw m2, filter_rnd
- paddw m0, filter_rnd
-%else
- punpckhbw m2, m0, m5
- punpckhbw m3, m1, m5
- punpcklbw m0, m5
- punpcklbw m1, m5
- pmullw m0, filter_x_a
- pmullw m1, filter_x_b
- paddw m0, filter_rnd
- pmullw m2, filter_x_a
- pmullw m3, filter_x_b
- paddw m2, filter_rnd
- paddw m0, m1
- paddw m2, m3
-%endif
- psraw m0, 4
- psraw m2, 4
- add srcq, src_strideq
- packuswb m0, m2
-.x_other_y_half_loop:
- movu m4, [srcq]
- movu m3, [srcq+1]
-%if cpuflag(ssse3)
- mova m1, [dstq]
- punpckhbw m2, m4, m3
- punpcklbw m4, m3
- pmaddubsw m2, filter_x_a
- pmaddubsw m4, filter_x_a
- paddw m2, filter_rnd
- paddw m4, filter_rnd
- psraw m2, 4
- psraw m4, 4
- packuswb m4, m2
- pavgb m0, m4
- punpckhbw m3, m1, m5
- punpcklbw m1, m5
-%else
- punpckhbw m2, m4, m5
- punpckhbw m1, m3, m5
- punpcklbw m4, m5
- punpcklbw m3, m5
- pmullw m4, filter_x_a
- pmullw m3, filter_x_b
- paddw m4, filter_rnd
- pmullw m2, filter_x_a
- pmullw m1, filter_x_b
- paddw m2, filter_rnd
- paddw m4, m3
- paddw m2, m1
- mova m1, [dstq]
- psraw m4, 4
- psraw m2, 4
- punpckhbw m3, m1, m5
- ; FIXME(rbultje) the repeated pack/unpack here around m0/m2 is because we
- ; have a 1-register shortage to be able to store the backup of the bilin
- ; filtered second line as words as cache for the next line. Packing into
- ; a byte costs 1 pack and 2 unpacks, but saves a register.
- packuswb m4, m2
- punpcklbw m1, m5
- pavgb m0, m4
-%endif
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- pavgb m0, [secq]
-%endif
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- add srcq, src_strideq
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m1, [srcq+1]
-%if cpuflag(ssse3)
- punpcklbw m0, m1
- pmaddubsw m0, filter_x_a
- paddw m0, filter_rnd
-%else
- punpcklbw m0, m5
- punpcklbw m1, m5
- pmullw m0, filter_x_a
- pmullw m1, filter_x_b
- paddw m0, filter_rnd
- paddw m0, m1
-%endif
- add srcq, src_strideq
- psraw m0, 4
-.x_other_y_half_loop:
- movh m2, [srcq]
- movh m1, [srcq+1]
- movh m4, [srcq+src_strideq]
- movh m3, [srcq+src_strideq+1]
-%if cpuflag(ssse3)
- punpcklbw m2, m1
- punpcklbw m4, m3
- pmaddubsw m2, filter_x_a
- pmaddubsw m4, filter_x_a
- movh m1, [dstq]
- movh m3, [dstq+dst_strideq]
- paddw m2, filter_rnd
- paddw m4, filter_rnd
-%else
- punpcklbw m2, m5
- punpcklbw m1, m5
- punpcklbw m4, m5
- punpcklbw m3, m5
- pmullw m2, filter_x_a
- pmullw m1, filter_x_b
- paddw m2, filter_rnd
- pmullw m4, filter_x_a
- pmullw m3, filter_x_b
- paddw m4, filter_rnd
- paddw m2, m1
- movh m1, [dstq]
- paddw m4, m3
- movh m3, [dstq+dst_strideq]
-%endif
- psraw m2, 4
- psraw m4, 4
- pavgw m0, m2
- pavgw m2, m4
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline - also consider going to bytes here
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- punpcklbw m3, m5
- punpcklbw m1, m5
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- lea srcq, [srcq+src_strideq*2]
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_other_y_half_loop
-%undef filter_x_a
-%undef filter_x_b
-%undef filter_rnd
- STORE_AND_RET
-
-.x_nonhalf_y_nonhalf:
-%ifdef PIC
- lea bilin_filter, [bilin_filter_m]
-%endif
- shl x_offsetd, filter_idx_shift
- shl y_offsetd, filter_idx_shift
-%if ARCH_X86_64 && mmsize == 16
- mova m8, [bilin_filter+x_offsetq]
-%if notcpuflag(ssse3) ; FIXME(rbultje) don't scatter registers on x86-64
- mova m9, [bilin_filter+x_offsetq+16]
-%endif
- mova m10, [bilin_filter+y_offsetq]
-%if notcpuflag(ssse3) ; FIXME(rbultje) don't scatter registers on x86-64
- mova m11, [bilin_filter+y_offsetq+16]
-%endif
- mova m12, [pw_8]
-%define filter_x_a m8
-%define filter_x_b m9
-%define filter_y_a m10
-%define filter_y_b m11
-%define filter_rnd m12
-%else ; x86-32
-%if ARCH_X86=1 && CONFIG_PIC=1
-; In this case, there is NO unused register. Used src_stride register. Later,
-; src_stride has to be loaded from stack when it is needed.
-%define tempq src_strideq
- mov tempq, g_bilin_filterm
- add x_offsetq, tempq
- add y_offsetq, tempq
-%define filter_x_a [x_offsetq]
-%define filter_x_b [x_offsetq+16]
-%define filter_y_a [y_offsetq]
-%define filter_y_b [y_offsetq+16]
-
- mov tempq, g_pw_8m
-%define filter_rnd [tempq]
-%else
- add x_offsetq, bilin_filter
- add y_offsetq, bilin_filter
-%define filter_x_a [x_offsetq]
-%define filter_x_b [x_offsetq+16]
-%define filter_y_a [y_offsetq]
-%define filter_y_b [y_offsetq+16]
-%define filter_rnd [pw_8]
-%endif
-%endif
-
- ; x_offset == bilin interpolation && y_offset == bilin interpolation
-%if %1 == 16
- movu m0, [srcq]
- movu m1, [srcq+1]
-%if cpuflag(ssse3)
- punpckhbw m2, m0, m1
- punpcklbw m0, m1
- pmaddubsw m2, filter_x_a
- pmaddubsw m0, filter_x_a
- paddw m2, filter_rnd
- paddw m0, filter_rnd
-%else
- punpckhbw m2, m0, m5
- punpckhbw m3, m1, m5
- punpcklbw m0, m5
- punpcklbw m1, m5
- pmullw m0, filter_x_a
- pmullw m1, filter_x_b
- paddw m0, filter_rnd
- pmullw m2, filter_x_a
- pmullw m3, filter_x_b
- paddw m2, filter_rnd
- paddw m0, m1
- paddw m2, m3
-%endif
- psraw m0, 4
- psraw m2, 4
-
- INC_SRC_BY_SRC_STRIDE
-
- packuswb m0, m2
-.x_other_y_other_loop:
-%if cpuflag(ssse3)
- movu m4, [srcq]
- movu m3, [srcq+1]
- mova m1, [dstq]
- punpckhbw m2, m4, m3
- punpcklbw m4, m3
- pmaddubsw m2, filter_x_a
- pmaddubsw m4, filter_x_a
- punpckhbw m3, m1, m5
- paddw m2, filter_rnd
- paddw m4, filter_rnd
- psraw m2, 4
- psraw m4, 4
- packuswb m4, m2
- punpckhbw m2, m0, m4
- punpcklbw m0, m4
- pmaddubsw m2, filter_y_a
- pmaddubsw m0, filter_y_a
- punpcklbw m1, m5
- paddw m2, filter_rnd
- paddw m0, filter_rnd
- psraw m2, 4
- psraw m0, 4
-%else
- movu m3, [srcq]
- movu m4, [srcq+1]
- punpckhbw m1, m3, m5
- punpckhbw m2, m4, m5
- punpcklbw m3, m5
- punpcklbw m4, m5
- pmullw m3, filter_x_a
- pmullw m4, filter_x_b
- paddw m3, filter_rnd
- pmullw m1, filter_x_a
- pmullw m2, filter_x_b
- paddw m1, filter_rnd
- paddw m3, m4
- paddw m1, m2
- psraw m3, 4
- psraw m1, 4
- packuswb m4, m3, m1
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
- pmullw m2, filter_y_a
- pmullw m1, filter_y_b
- paddw m2, filter_rnd
- pmullw m0, filter_y_a
- pmullw m3, filter_y_b
- paddw m2, m1
- mova m1, [dstq]
- paddw m0, filter_rnd
- psraw m2, 4
- paddw m0, m3
- punpckhbw m3, m1, m5
- psraw m0, 4
- punpcklbw m1, m5
-%endif
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- INC_SRC_BY_SRC_STRIDE
- add dstq, dst_strideq
-%else ; %1 < 16
- movh m0, [srcq]
- movh m1, [srcq+1]
-%if cpuflag(ssse3)
- punpcklbw m0, m1
- pmaddubsw m0, filter_x_a
- paddw m0, filter_rnd
-%else
- punpcklbw m0, m5
- punpcklbw m1, m5
- pmullw m0, filter_x_a
- pmullw m1, filter_x_b
- paddw m0, filter_rnd
- paddw m0, m1
-%endif
- psraw m0, 4
-%if cpuflag(ssse3)
- packuswb m0, m0
-%endif
-
- INC_SRC_BY_SRC_STRIDE
-
-.x_other_y_other_loop:
- movh m2, [srcq]
- movh m1, [srcq+1]
-
- INC_SRC_BY_SRC_STRIDE
- movh m4, [srcq]
- movh m3, [srcq+1]
-
-%if cpuflag(ssse3)
- punpcklbw m2, m1
- punpcklbw m4, m3
- pmaddubsw m2, filter_x_a
- pmaddubsw m4, filter_x_a
- movh m3, [dstq+dst_strideq]
- movh m1, [dstq]
- paddw m2, filter_rnd
- paddw m4, filter_rnd
- psraw m2, 4
- psraw m4, 4
- packuswb m2, m2
- packuswb m4, m4
- punpcklbw m0, m2
- punpcklbw m2, m4
- pmaddubsw m0, filter_y_a
- pmaddubsw m2, filter_y_a
- punpcklbw m3, m5
- paddw m0, filter_rnd
- paddw m2, filter_rnd
- psraw m0, 4
- psraw m2, 4
- punpcklbw m1, m5
-%else
- punpcklbw m2, m5
- punpcklbw m1, m5
- punpcklbw m4, m5
- punpcklbw m3, m5
- pmullw m2, filter_x_a
- pmullw m1, filter_x_b
- paddw m2, filter_rnd
- pmullw m4, filter_x_a
- pmullw m3, filter_x_b
- paddw m4, filter_rnd
- paddw m2, m1
- paddw m4, m3
- psraw m2, 4
- psraw m4, 4
- pmullw m0, filter_y_a
- pmullw m3, m2, filter_y_b
- paddw m0, filter_rnd
- pmullw m2, filter_y_a
- pmullw m1, m4, filter_y_b
- paddw m2, filter_rnd
- paddw m0, m3
- movh m3, [dstq+dst_strideq]
- paddw m2, m1
- movh m1, [dstq]
- psraw m0, 4
- psraw m2, 4
- punpcklbw m3, m5
- punpcklbw m1, m5
-%endif
-%if %2 == 1 ; avg
- ; FIXME(rbultje) pipeline
- packuswb m0, m2
- pavgb m0, [secq]
- punpckhbw m2, m0, m5
- punpcklbw m0, m5
-%endif
- SUM_SSE m0, m1, m2, m3, m6, m7
- mova m0, m4
-
- INC_SRC_BY_SRC_STRIDE
- lea dstq, [dstq+dst_strideq*2]
-%endif
-%if %2 == 1 ; avg
- add secq, sec_str
-%endif
- dec h
- jg .x_other_y_other_loop
-%undef filter_x_a
-%undef filter_x_b
-%undef filter_y_a
-%undef filter_y_b
-%undef filter_rnd
- STORE_AND_RET
-%endmacro
-
-; FIXME(rbultje) the non-bilinear versions (i.e. x=0,8&&y=0,8) are identical
-; between the ssse3 and non-ssse3 version. It may make sense to merge their
-; code in the sense that the ssse3 version would jump to the appropriate
-; location in the sse/2 version, rather than duplicating that code in the
-; binary.
-
-INIT_MMX sse
-SUBPEL_VARIANCE 4
-INIT_XMM sse2
-SUBPEL_VARIANCE 8
-SUBPEL_VARIANCE 16
-
-INIT_MMX ssse3
-SUBPEL_VARIANCE 4
-INIT_XMM ssse3
-SUBPEL_VARIANCE 8
-SUBPEL_VARIANCE 16
-
-INIT_MMX sse
-SUBPEL_VARIANCE 4, 1
-INIT_XMM sse2
-SUBPEL_VARIANCE 8, 1
-SUBPEL_VARIANCE 16, 1
-
-INIT_MMX ssse3
-SUBPEL_VARIANCE 4, 1
-INIT_XMM ssse3
-SUBPEL_VARIANCE 8, 1
-SUBPEL_VARIANCE 16, 1
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_intrin_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_intrin_avx2.c
deleted file mode 100644
index 34ed186..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_intrin_avx2.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <immintrin.h> // AVX2
-#include "vpx_ports/mem.h"
-#include "vp9/encoder/vp9_variance.h"
-
-DECLARE_ALIGNED(32, static const uint8_t, bilinear_filters_avx2[512]) = {
- 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0,
- 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0,
- 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1,
- 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1,
- 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2,
- 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2,
- 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3,
- 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3,
- 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4,
- 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4,
- 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5,
- 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5,
- 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6,
- 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6,
- 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7,
- 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9,
- 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9,
- 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10,
- 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10, 6, 10,
- 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11,
- 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11,
- 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12,
- 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12, 4, 12,
- 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13,
- 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13,
- 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14,
- 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14,
- 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15,
- 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15
-};
-
-#define FILTER_SRC(filter) \
- /* filter the source */ \
- exp_src_lo = _mm256_maddubs_epi16(exp_src_lo, filter); \
- exp_src_hi = _mm256_maddubs_epi16(exp_src_hi, filter); \
- \
- /* add 8 to source */ \
- exp_src_lo = _mm256_add_epi16(exp_src_lo, pw8); \
- exp_src_hi = _mm256_add_epi16(exp_src_hi, pw8); \
- \
- /* divide source by 16 */ \
- exp_src_lo = _mm256_srai_epi16(exp_src_lo, 4); \
- exp_src_hi = _mm256_srai_epi16(exp_src_hi, 4);
-
-#define MERGE_WITH_SRC(src_reg, reg) \
- exp_src_lo = _mm256_unpacklo_epi8(src_reg, reg); \
- exp_src_hi = _mm256_unpackhi_epi8(src_reg, reg);
-
-#define LOAD_SRC_DST \
- /* load source and destination */ \
- src_reg = _mm256_loadu_si256((__m256i const *) (src)); \
- dst_reg = _mm256_load_si256((__m256i const *) (dst));
-
-#define AVG_NEXT_SRC(src_reg, size_stride) \
- src_next_reg = _mm256_loadu_si256((__m256i const *) \
- (src + size_stride)); \
- /* average between current and next stride source */ \
- src_reg = _mm256_avg_epu8(src_reg, src_next_reg);
-
-#define MERGE_NEXT_SRC(src_reg, size_stride) \
- src_next_reg = _mm256_loadu_si256((__m256i const *) \
- (src + size_stride)); \
- MERGE_WITH_SRC(src_reg, src_next_reg)
-
-#define CALC_SUM_SSE_INSIDE_LOOP \
- /* expand each byte to 2 bytes */ \
- exp_dst_lo = _mm256_unpacklo_epi8(dst_reg, zero_reg); \
- exp_dst_hi = _mm256_unpackhi_epi8(dst_reg, zero_reg); \
- /* source - dest */ \
- exp_src_lo = _mm256_sub_epi16(exp_src_lo, exp_dst_lo); \
- exp_src_hi = _mm256_sub_epi16(exp_src_hi, exp_dst_hi); \
- /* caculate sum */ \
- sum_reg = _mm256_add_epi16(sum_reg, exp_src_lo); \
- exp_src_lo = _mm256_madd_epi16(exp_src_lo, exp_src_lo); \
- sum_reg = _mm256_add_epi16(sum_reg, exp_src_hi); \
- exp_src_hi = _mm256_madd_epi16(exp_src_hi, exp_src_hi); \
- /* calculate sse */ \
- sse_reg = _mm256_add_epi32(sse_reg, exp_src_lo); \
- sse_reg = _mm256_add_epi32(sse_reg, exp_src_hi);
-
-// final calculation to sum and sse
-#define CALC_SUM_AND_SSE \
- res_cmp = _mm256_cmpgt_epi16(zero_reg, sum_reg); \
- sse_reg_hi = _mm256_srli_si256(sse_reg, 8); \
- sum_reg_lo = _mm256_unpacklo_epi16(sum_reg, res_cmp); \
- sum_reg_hi = _mm256_unpackhi_epi16(sum_reg, res_cmp); \
- sse_reg = _mm256_add_epi32(sse_reg, sse_reg_hi); \
- sum_reg = _mm256_add_epi32(sum_reg_lo, sum_reg_hi); \
- \
- sse_reg_hi = _mm256_srli_si256(sse_reg, 4); \
- sum_reg_hi = _mm256_srli_si256(sum_reg, 8); \
- \
- sse_reg = _mm256_add_epi32(sse_reg, sse_reg_hi); \
- sum_reg = _mm256_add_epi32(sum_reg, sum_reg_hi); \
- *((int*)sse)= _mm_cvtsi128_si32(_mm256_castsi256_si128(sse_reg)) + \
- _mm_cvtsi128_si32(_mm256_extractf128_si256(sse_reg, 1)); \
- sum_reg_hi = _mm256_srli_si256(sum_reg, 4); \
- sum_reg = _mm256_add_epi32(sum_reg, sum_reg_hi); \
- sum = _mm_cvtsi128_si32(_mm256_castsi256_si128(sum_reg)) + \
- _mm_cvtsi128_si32(_mm256_extractf128_si256(sum_reg, 1));
-
-
-unsigned int vp9_sub_pixel_variance32xh_avx2(const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- int height,
- unsigned int *sse) {
- __m256i src_reg, dst_reg, exp_src_lo, exp_src_hi, exp_dst_lo, exp_dst_hi;
- __m256i sse_reg, sum_reg, sse_reg_hi, res_cmp, sum_reg_lo, sum_reg_hi;
- __m256i zero_reg;
- int i, sum;
- sum_reg = _mm256_set1_epi16(0);
- sse_reg = _mm256_set1_epi16(0);
- zero_reg = _mm256_set1_epi16(0);
-
- // x_offset = 0 and y_offset = 0
- if (x_offset == 0) {
- if (y_offset == 0) {
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- // expend each byte to 2 bytes
- MERGE_WITH_SRC(src_reg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- // x_offset = 0 and y_offset = 8
- } else if (y_offset == 8) {
- __m256i src_next_reg;
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, src_stride)
- // expend each byte to 2 bytes
- MERGE_WITH_SRC(src_reg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- // x_offset = 0 and y_offset = bilin interpolation
- } else {
- __m256i filter, pw8, src_next_reg;
-
- y_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + y_offset));
- pw8 = _mm256_set1_epi16(8);
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, src_stride)
- FILTER_SRC(filter)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- }
- // x_offset = 8 and y_offset = 0
- } else if (x_offset == 8) {
- if (y_offset == 0) {
- __m256i src_next_reg;
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, 1)
- // expand each byte to 2 bytes
- MERGE_WITH_SRC(src_reg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- // x_offset = 8 and y_offset = 8
- } else if (y_offset == 8) {
- __m256i src_next_reg, src_avg;
- // load source and another source starting from the next
- // following byte
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- AVG_NEXT_SRC(src_reg, 1)
- for (i = 0; i < height ; i++) {
- src_avg = src_reg;
- src+= src_stride;
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, 1)
- // average between previous average to current average
- src_avg = _mm256_avg_epu8(src_avg, src_reg);
- // expand each byte to 2 bytes
- MERGE_WITH_SRC(src_avg, zero_reg)
- // save current source average
- CALC_SUM_SSE_INSIDE_LOOP
- dst+= dst_stride;
- }
- // x_offset = 8 and y_offset = bilin interpolation
- } else {
- __m256i filter, pw8, src_next_reg, src_avg;
- y_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + y_offset));
- pw8 = _mm256_set1_epi16(8);
- // load source and another source starting from the next
- // following byte
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- AVG_NEXT_SRC(src_reg, 1)
- for (i = 0; i < height ; i++) {
- // save current source average
- src_avg = src_reg;
- src+= src_stride;
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, 1)
- MERGE_WITH_SRC(src_avg, src_reg)
- FILTER_SRC(filter)
- CALC_SUM_SSE_INSIDE_LOOP
- dst+= dst_stride;
- }
- }
- // x_offset = bilin interpolation and y_offset = 0
- } else {
- if (y_offset == 0) {
- __m256i filter, pw8, src_next_reg;
- x_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + x_offset));
- pw8 = _mm256_set1_epi16(8);
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(filter)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- // x_offset = bilin interpolation and y_offset = 8
- } else if (y_offset == 8) {
- __m256i filter, pw8, src_next_reg, src_pack;
- x_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + x_offset));
- pw8 = _mm256_set1_epi16(8);
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(filter)
- // convert each 16 bit to 8 bit to each low and high lane source
- src_pack = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- for (i = 0; i < height ; i++) {
- src+= src_stride;
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(filter)
- src_reg = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- // average between previous pack to the current
- src_pack = _mm256_avg_epu8(src_pack, src_reg);
- MERGE_WITH_SRC(src_pack, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src_pack = src_reg;
- dst+= dst_stride;
- }
- // x_offset = bilin interpolation and y_offset = bilin interpolation
- } else {
- __m256i xfilter, yfilter, pw8, src_next_reg, src_pack;
- x_offset <<= 5;
- xfilter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + x_offset));
- y_offset <<= 5;
- yfilter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + y_offset));
- pw8 = _mm256_set1_epi16(8);
- // load source and another source starting from the next
- // following byte
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- MERGE_NEXT_SRC(src_reg, 1)
-
- FILTER_SRC(xfilter)
- // convert each 16 bit to 8 bit to each low and high lane source
- src_pack = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- for (i = 0; i < height ; i++) {
- src+= src_stride;
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(xfilter)
- src_reg = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- // merge previous pack to current pack source
- MERGE_WITH_SRC(src_pack, src_reg)
- // filter the source
- FILTER_SRC(yfilter)
- src_pack = src_reg;
- CALC_SUM_SSE_INSIDE_LOOP
- dst+= dst_stride;
- }
- }
- }
- CALC_SUM_AND_SSE
- return sum;
-}
-
-unsigned int vp9_sub_pixel_avg_variance32xh_avx2(const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- const uint8_t *sec,
- int sec_stride,
- int height,
- unsigned int *sse) {
- __m256i sec_reg;
- __m256i src_reg, dst_reg, exp_src_lo, exp_src_hi, exp_dst_lo, exp_dst_hi;
- __m256i sse_reg, sum_reg, sse_reg_hi, res_cmp, sum_reg_lo, sum_reg_hi;
- __m256i zero_reg;
- int i, sum;
- sum_reg = _mm256_set1_epi16(0);
- sse_reg = _mm256_set1_epi16(0);
- zero_reg = _mm256_set1_epi16(0);
-
- // x_offset = 0 and y_offset = 0
- if (x_offset == 0) {
- if (y_offset == 0) {
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_reg = _mm256_avg_epu8(src_reg, sec_reg);
- sec+= sec_stride;
- // expend each byte to 2 bytes
- MERGE_WITH_SRC(src_reg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- } else if (y_offset == 8) {
- __m256i src_next_reg;
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, src_stride)
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_reg = _mm256_avg_epu8(src_reg, sec_reg);
- sec+= sec_stride;
- // expend each byte to 2 bytes
- MERGE_WITH_SRC(src_reg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- // x_offset = 0 and y_offset = bilin interpolation
- } else {
- __m256i filter, pw8, src_next_reg;
-
- y_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + y_offset));
- pw8 = _mm256_set1_epi16(8);
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, src_stride)
- FILTER_SRC(filter)
- src_reg = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_reg = _mm256_avg_epu8(src_reg, sec_reg);
- sec+= sec_stride;
- MERGE_WITH_SRC(src_reg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- }
- // x_offset = 8 and y_offset = 0
- } else if (x_offset == 8) {
- if (y_offset == 0) {
- __m256i src_next_reg;
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, 1)
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_reg = _mm256_avg_epu8(src_reg, sec_reg);
- sec+= sec_stride;
- // expand each byte to 2 bytes
- MERGE_WITH_SRC(src_reg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- // x_offset = 8 and y_offset = 8
- } else if (y_offset == 8) {
- __m256i src_next_reg, src_avg;
- // load source and another source starting from the next
- // following byte
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- AVG_NEXT_SRC(src_reg, 1)
- for (i = 0; i < height ; i++) {
- // save current source average
- src_avg = src_reg;
- src+= src_stride;
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, 1)
- // average between previous average to current average
- src_avg = _mm256_avg_epu8(src_avg, src_reg);
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_avg = _mm256_avg_epu8(src_avg, sec_reg);
- sec+= sec_stride;
- // expand each byte to 2 bytes
- MERGE_WITH_SRC(src_avg, zero_reg)
- CALC_SUM_SSE_INSIDE_LOOP
- dst+= dst_stride;
- }
- // x_offset = 8 and y_offset = bilin interpolation
- } else {
- __m256i filter, pw8, src_next_reg, src_avg;
- y_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + y_offset));
- pw8 = _mm256_set1_epi16(8);
- // load source and another source starting from the next
- // following byte
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- AVG_NEXT_SRC(src_reg, 1)
- for (i = 0; i < height ; i++) {
- // save current source average
- src_avg = src_reg;
- src+= src_stride;
- LOAD_SRC_DST
- AVG_NEXT_SRC(src_reg, 1)
- MERGE_WITH_SRC(src_avg, src_reg)
- FILTER_SRC(filter)
- src_avg = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_avg = _mm256_avg_epu8(src_avg, sec_reg);
- // expand each byte to 2 bytes
- MERGE_WITH_SRC(src_avg, zero_reg)
- sec+= sec_stride;
- CALC_SUM_SSE_INSIDE_LOOP
- dst+= dst_stride;
- }
- }
- // x_offset = bilin interpolation and y_offset = 0
- } else {
- if (y_offset == 0) {
- __m256i filter, pw8, src_next_reg;
- x_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + x_offset));
- pw8 = _mm256_set1_epi16(8);
- for (i = 0; i < height ; i++) {
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(filter)
- src_reg = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_reg = _mm256_avg_epu8(src_reg, sec_reg);
- MERGE_WITH_SRC(src_reg, zero_reg)
- sec+= sec_stride;
- CALC_SUM_SSE_INSIDE_LOOP
- src+= src_stride;
- dst+= dst_stride;
- }
- // x_offset = bilin interpolation and y_offset = 8
- } else if (y_offset == 8) {
- __m256i filter, pw8, src_next_reg, src_pack;
- x_offset <<= 5;
- filter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + x_offset));
- pw8 = _mm256_set1_epi16(8);
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(filter)
- // convert each 16 bit to 8 bit to each low and high lane source
- src_pack = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- for (i = 0; i < height ; i++) {
- src+= src_stride;
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(filter)
- src_reg = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- // average between previous pack to the current
- src_pack = _mm256_avg_epu8(src_pack, src_reg);
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_pack = _mm256_avg_epu8(src_pack, sec_reg);
- sec+= sec_stride;
- MERGE_WITH_SRC(src_pack, zero_reg)
- src_pack = src_reg;
- CALC_SUM_SSE_INSIDE_LOOP
- dst+= dst_stride;
- }
- // x_offset = bilin interpolation and y_offset = bilin interpolation
- } else {
- __m256i xfilter, yfilter, pw8, src_next_reg, src_pack;
- x_offset <<= 5;
- xfilter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + x_offset));
- y_offset <<= 5;
- yfilter = _mm256_load_si256((__m256i const *)
- (bilinear_filters_avx2 + y_offset));
- pw8 = _mm256_set1_epi16(8);
- // load source and another source starting from the next
- // following byte
- src_reg = _mm256_loadu_si256((__m256i const *) (src));
- MERGE_NEXT_SRC(src_reg, 1)
-
- FILTER_SRC(xfilter)
- // convert each 16 bit to 8 bit to each low and high lane source
- src_pack = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- for (i = 0; i < height ; i++) {
- src+= src_stride;
- LOAD_SRC_DST
- MERGE_NEXT_SRC(src_reg, 1)
- FILTER_SRC(xfilter)
- src_reg = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- // merge previous pack to current pack source
- MERGE_WITH_SRC(src_pack, src_reg)
- // filter the source
- FILTER_SRC(yfilter)
- src_pack = _mm256_packus_epi16(exp_src_lo, exp_src_hi);
- sec_reg = _mm256_load_si256((__m256i const *) (sec));
- src_pack = _mm256_avg_epu8(src_pack, sec_reg);
- MERGE_WITH_SRC(src_pack, zero_reg)
- src_pack = src_reg;
- sec+= sec_stride;
- CALC_SUM_SSE_INSIDE_LOOP
- dst+= dst_stride;
- }
- }
- }
- CALC_SUM_AND_SSE
- return sum;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_sse2.asm
deleted file mode 100644
index 2ecc23e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subpel_variance_impl_sse2.asm
+++ /dev/null
@@ -1,337 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;void vp9_half_horiz_vert_variance16x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp9_half_horiz_vert_variance16x_h_sse2) PRIVATE
-sym(vp9_half_horiz_vert_variance16x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;src_pixels_per_line
-
- pxor xmm0, xmm0 ;
-
- movdqu xmm5, XMMWORD PTR [rsi]
- movdqu xmm3, XMMWORD PTR [rsi+1]
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3) horizontal line 1
-
- lea rsi, [rsi + rax]
-
-.half_horiz_vert_variance16x_h_1:
- movdqu xmm1, XMMWORD PTR [rsi] ;
- movdqu xmm2, XMMWORD PTR [rsi+1] ;
- pavgb xmm1, xmm2 ; xmm1 = avg(xmm1,xmm3) horizontal line i+1
-
- pavgb xmm5, xmm1 ; xmm = vertical average of the above
-
- movdqa xmm4, xmm5
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
- punpckhbw xmm4, xmm0
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d7
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
- psubw xmm5, xmm3 ; xmm5 -= xmm3
-
- movq xmm3, QWORD PTR [rdi+8]
- punpcklbw xmm3, xmm0
- psubw xmm4, xmm3
-
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- paddw xmm6, xmm4
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- pmaddwd xmm4, xmm4
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
- paddd xmm7, xmm4
-
- movdqa xmm5, xmm1 ; save xmm1 for use on the next row
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
-
- sub rcx, 1 ;
- jnz .half_horiz_vert_variance16x_h_1 ;
-
- pxor xmm1, xmm1
- pxor xmm5, xmm5
-
- punpcklwd xmm0, xmm6
- punpckhwd xmm1, xmm6
- psrad xmm0, 16
- psrad xmm1, 16
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- movdqa xmm6, xmm7
- punpckldq xmm6, xmm5
- punpckhdq xmm7, xmm5
- paddd xmm6, xmm7
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
- paddd xmm0, xmm1
-
- movdqa xmm7, xmm6
- movdqa xmm1, xmm0
-
- psrldq xmm7, 8
- psrldq xmm1, 8
-
- paddd xmm6, xmm7
- paddd xmm0, xmm1
-
- mov rsi, arg(5) ;[Sum]
- mov rdi, arg(6) ;[SSE]
-
- movd [rsi], xmm0
- movd [rdi], xmm6
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_half_vert_variance16x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp9_half_vert_variance16x_h_sse2) PRIVATE
-sym(vp9_half_vert_variance16x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr
-
- mov rdi, arg(2) ;src_ptr
- movsxd rcx, dword ptr arg(4) ;Height
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;src_pixels_per_line
-
- movdqu xmm5, XMMWORD PTR [rsi]
- lea rsi, [rsi + rax ]
- pxor xmm0, xmm0
-
-.half_vert_variance16x_h_1:
- movdqu xmm3, XMMWORD PTR [rsi]
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- movdqa xmm4, xmm5
- punpcklbw xmm5, xmm0
- punpckhbw xmm4, xmm0
-
- movq xmm2, QWORD PTR [rdi]
- punpcklbw xmm2, xmm0
- psubw xmm5, xmm2
- movq xmm2, QWORD PTR [rdi+8]
- punpcklbw xmm2, xmm0
- psubw xmm4, xmm2
-
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- paddw xmm6, xmm4
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- pmaddwd xmm4, xmm4
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
- paddd xmm7, xmm4
-
- movdqa xmm5, xmm3
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
-
- sub rcx, 1
- jnz .half_vert_variance16x_h_1
-
- pxor xmm1, xmm1
- pxor xmm5, xmm5
-
- punpcklwd xmm0, xmm6
- punpckhwd xmm1, xmm6
- psrad xmm0, 16
- psrad xmm1, 16
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- movdqa xmm6, xmm7
- punpckldq xmm6, xmm5
- punpckhdq xmm7, xmm5
- paddd xmm6, xmm7
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
- paddd xmm0, xmm1
-
- movdqa xmm7, xmm6
- movdqa xmm1, xmm0
-
- psrldq xmm7, 8
- psrldq xmm1, 8
-
- paddd xmm6, xmm7
- paddd xmm0, xmm1
-
- mov rsi, arg(5) ;[Sum]
- mov rdi, arg(6) ;[SSE]
-
- movd [rsi], xmm0
- movd [rdi], xmm6
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_half_horiz_variance16x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp9_half_horiz_variance16x_h_sse2) PRIVATE
-sym(vp9_half_horiz_variance16x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
- movsxd rdx, dword ptr arg(3) ;src_pixels_per_line
-
- pxor xmm0, xmm0 ;
-
-.half_horiz_variance16x_h_1:
- movdqu xmm5, XMMWORD PTR [rsi] ; xmm5 = s0,s1,s2..s15
- movdqu xmm3, XMMWORD PTR [rsi+1] ; xmm3 = s1,s2,s3..s16
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- movdqa xmm1, xmm5
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
- punpckhbw xmm1, xmm0
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d7
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
- movq xmm2, QWORD PTR [rdi+8]
- punpcklbw xmm2, xmm0
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- psubw xmm1, xmm2
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- paddw xmm6, xmm1
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- pmaddwd xmm1, xmm1
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
- paddd xmm7, xmm1
-
- lea rsi, [rsi + rax]
- lea rdi, [rdi + rdx]
-
- sub rcx, 1 ;
- jnz .half_horiz_variance16x_h_1 ;
-
- pxor xmm1, xmm1
- pxor xmm5, xmm5
-
- punpcklwd xmm0, xmm6
- punpckhwd xmm1, xmm6
- psrad xmm0, 16
- psrad xmm1, 16
- paddd xmm0, xmm1
- movdqa xmm1, xmm0
-
- movdqa xmm6, xmm7
- punpckldq xmm6, xmm5
- punpckhdq xmm7, xmm5
- paddd xmm6, xmm7
-
- punpckldq xmm0, xmm5
- punpckhdq xmm1, xmm5
- paddd xmm0, xmm1
-
- movdqa xmm7, xmm6
- movdqa xmm1, xmm0
-
- psrldq xmm7, 8
- psrldq xmm1, 8
-
- paddd xmm6, xmm7
- paddd xmm0, xmm1
-
- mov rsi, arg(5) ;[Sum]
- mov rdi, arg(6) ;[SSE]
-
- movd [rsi], xmm0
- movd [rdi], xmm6
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subtract_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subtract_sse2.asm
deleted file mode 100644
index 9824080..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_subtract_sse2.asm
+++ /dev/null
@@ -1,127 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-%include "third_party/x86inc/x86inc.asm"
-
-SECTION .text
-
-; void vp9_subtract_block(int rows, int cols,
-; int16_t *diff, ptrdiff_t diff_stride,
-; const uint8_t *src, ptrdiff_t src_stride,
-; const uint8_t *pred, ptrdiff_t pred_stride)
-
-INIT_XMM sse2
-cglobal subtract_block, 7, 7, 8, \
- rows, cols, diff, diff_stride, src, src_stride, \
- pred, pred_stride
-%define pred_str colsq
- pxor m7, m7 ; dedicated zero register
- cmp colsd, 4
- je .case_4
- cmp colsd, 8
- je .case_8
- cmp colsd, 16
- je .case_16
- cmp colsd, 32
- je .case_32
-
-%macro loop16 6
- mova m0, [srcq+%1]
- mova m4, [srcq+%2]
- mova m1, [predq+%3]
- mova m5, [predq+%4]
- punpckhbw m2, m0, m7
- punpckhbw m3, m1, m7
- punpcklbw m0, m7
- punpcklbw m1, m7
- psubw m2, m3
- psubw m0, m1
- punpckhbw m1, m4, m7
- punpckhbw m3, m5, m7
- punpcklbw m4, m7
- punpcklbw m5, m7
- psubw m1, m3
- psubw m4, m5
- mova [diffq+mmsize*0+%5], m0
- mova [diffq+mmsize*1+%5], m2
- mova [diffq+mmsize*0+%6], m4
- mova [diffq+mmsize*1+%6], m1
-%endmacro
-
- mov pred_str, pred_stridemp
-.loop_64:
- loop16 0*mmsize, 1*mmsize, 0*mmsize, 1*mmsize, 0*mmsize, 2*mmsize
- loop16 2*mmsize, 3*mmsize, 2*mmsize, 3*mmsize, 4*mmsize, 6*mmsize
- lea diffq, [diffq+diff_strideq*2]
- add predq, pred_str
- add srcq, src_strideq
- dec rowsd
- jg .loop_64
- RET
-
-.case_32:
- mov pred_str, pred_stridemp
-.loop_32:
- loop16 0, mmsize, 0, mmsize, 0, 2*mmsize
- lea diffq, [diffq+diff_strideq*2]
- add predq, pred_str
- add srcq, src_strideq
- dec rowsd
- jg .loop_32
- RET
-
-.case_16:
- mov pred_str, pred_stridemp
-.loop_16:
- loop16 0, src_strideq, 0, pred_str, 0, diff_strideq*2
- lea diffq, [diffq+diff_strideq*4]
- lea predq, [predq+pred_str*2]
- lea srcq, [srcq+src_strideq*2]
- sub rowsd, 2
- jg .loop_16
- RET
-
-%macro loop_h 0
- movh m0, [srcq]
- movh m2, [srcq+src_strideq]
- movh m1, [predq]
- movh m3, [predq+pred_str]
- punpcklbw m0, m7
- punpcklbw m1, m7
- punpcklbw m2, m7
- punpcklbw m3, m7
- psubw m0, m1
- psubw m2, m3
- mova [diffq], m0
- mova [diffq+diff_strideq*2], m2
-%endmacro
-
-.case_8:
- mov pred_str, pred_stridemp
-.loop_8:
- loop_h
- lea diffq, [diffq+diff_strideq*4]
- lea srcq, [srcq+src_strideq*2]
- lea predq, [predq+pred_str*2]
- sub rowsd, 2
- jg .loop_8
- RET
-
-INIT_MMX
-.case_4:
- mov pred_str, pred_stridemp
-.loop_4:
- loop_h
- lea diffq, [diffq+diff_strideq*4]
- lea srcq, [srcq+src_strideq*2]
- lea predq, [predq+pred_str*2]
- sub rowsd, 2
- jg .loop_4
- RET
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_temporal_filter_apply_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_temporal_filter_apply_sse2.asm
deleted file mode 100644
index d2d13b3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_temporal_filter_apply_sse2.asm
+++ /dev/null
@@ -1,207 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-; void vp9_temporal_filter_apply_sse2 | arg
-; (unsigned char *frame1, | 0
-; unsigned int stride, | 1
-; unsigned char *frame2, | 2
-; unsigned int block_size, | 3
-; int strength, | 4
-; int filter_weight, | 5
-; unsigned int *accumulator, | 6
-; unsigned short *count) | 7
-global sym(vp9_temporal_filter_apply_sse2) PRIVATE
-sym(vp9_temporal_filter_apply_sse2):
-
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ALIGN_STACK 16, rax
- %define block_size 0
- %define strength 16
- %define filter_weight 32
- %define rounding_bit 48
- %define rbp_backup 64
- %define stack_size 80
- sub rsp, stack_size
- mov [rsp + rbp_backup], rbp
- ; end prolog
-
- mov rdx, arg(3)
- mov [rsp + block_size], rdx
- movd xmm6, arg(4)
- movdqa [rsp + strength], xmm6 ; where strength is used, all 16 bytes are read
-
- ; calculate the rounding bit outside the loop
- ; 0x8000 >> (16 - strength)
- mov rdx, 16
- sub rdx, arg(4) ; 16 - strength
- movq xmm4, rdx ; can't use rdx w/ shift
- movdqa xmm5, [GLOBAL(_const_top_bit)]
- psrlw xmm5, xmm4
- movdqa [rsp + rounding_bit], xmm5
-
- mov rsi, arg(0) ; src/frame1
- mov rdx, arg(2) ; predictor frame
- mov rdi, arg(6) ; accumulator
- mov rax, arg(7) ; count
-
- ; dup the filter weight and store for later
- movd xmm0, arg(5) ; filter_weight
- pshuflw xmm0, xmm0, 0
- punpcklwd xmm0, xmm0
- movdqa [rsp + filter_weight], xmm0
-
- mov rbp, arg(1) ; stride
- pxor xmm7, xmm7 ; zero for extraction
-
- lea rcx, [rdx + 16*16*1]
- cmp dword ptr [rsp + block_size], 8
- jne .temporal_filter_apply_load_16
- lea rcx, [rdx + 8*8*1]
-
-.temporal_filter_apply_load_8:
- movq xmm0, [rsi] ; first row
- lea rsi, [rsi + rbp] ; += stride
- punpcklbw xmm0, xmm7 ; src[ 0- 7]
- movq xmm1, [rsi] ; second row
- lea rsi, [rsi + rbp] ; += stride
- punpcklbw xmm1, xmm7 ; src[ 8-15]
- jmp .temporal_filter_apply_load_finished
-
-.temporal_filter_apply_load_16:
- movdqa xmm0, [rsi] ; src (frame1)
- lea rsi, [rsi + rbp] ; += stride
- movdqa xmm1, xmm0
- punpcklbw xmm0, xmm7 ; src[ 0- 7]
- punpckhbw xmm1, xmm7 ; src[ 8-15]
-
-.temporal_filter_apply_load_finished:
- movdqa xmm2, [rdx] ; predictor (frame2)
- movdqa xmm3, xmm2
- punpcklbw xmm2, xmm7 ; pred[ 0- 7]
- punpckhbw xmm3, xmm7 ; pred[ 8-15]
-
- ; modifier = src_byte - pixel_value
- psubw xmm0, xmm2 ; src - pred[ 0- 7]
- psubw xmm1, xmm3 ; src - pred[ 8-15]
-
- ; modifier *= modifier
- pmullw xmm0, xmm0 ; modifer[ 0- 7]^2
- pmullw xmm1, xmm1 ; modifer[ 8-15]^2
-
- ; modifier *= 3
- pmullw xmm0, [GLOBAL(_const_3w)]
- pmullw xmm1, [GLOBAL(_const_3w)]
-
- ; modifer += 0x8000 >> (16 - strength)
- paddw xmm0, [rsp + rounding_bit]
- paddw xmm1, [rsp + rounding_bit]
-
- ; modifier >>= strength
- psrlw xmm0, [rsp + strength]
- psrlw xmm1, [rsp + strength]
-
- ; modifier = 16 - modifier
- ; saturation takes care of modifier > 16
- movdqa xmm3, [GLOBAL(_const_16w)]
- movdqa xmm2, [GLOBAL(_const_16w)]
- psubusw xmm3, xmm1
- psubusw xmm2, xmm0
-
- ; modifier *= filter_weight
- pmullw xmm2, [rsp + filter_weight]
- pmullw xmm3, [rsp + filter_weight]
-
- ; count
- movdqa xmm4, [rax]
- movdqa xmm5, [rax+16]
- ; += modifier
- paddw xmm4, xmm2
- paddw xmm5, xmm3
- ; write back
- movdqa [rax], xmm4
- movdqa [rax+16], xmm5
- lea rax, [rax + 16*2] ; count += 16*(sizeof(short))
-
- ; load and extract the predictor up to shorts
- pxor xmm7, xmm7
- movdqa xmm0, [rdx]
- lea rdx, [rdx + 16*1] ; pred += 16*(sizeof(char))
- movdqa xmm1, xmm0
- punpcklbw xmm0, xmm7 ; pred[ 0- 7]
- punpckhbw xmm1, xmm7 ; pred[ 8-15]
-
- ; modifier *= pixel_value
- pmullw xmm0, xmm2
- pmullw xmm1, xmm3
-
- ; expand to double words
- movdqa xmm2, xmm0
- punpcklwd xmm0, xmm7 ; [ 0- 3]
- punpckhwd xmm2, xmm7 ; [ 4- 7]
- movdqa xmm3, xmm1
- punpcklwd xmm1, xmm7 ; [ 8-11]
- punpckhwd xmm3, xmm7 ; [12-15]
-
- ; accumulator
- movdqa xmm4, [rdi]
- movdqa xmm5, [rdi+16]
- movdqa xmm6, [rdi+32]
- movdqa xmm7, [rdi+48]
- ; += modifier
- paddd xmm4, xmm0
- paddd xmm5, xmm2
- paddd xmm6, xmm1
- paddd xmm7, xmm3
- ; write back
- movdqa [rdi], xmm4
- movdqa [rdi+16], xmm5
- movdqa [rdi+32], xmm6
- movdqa [rdi+48], xmm7
- lea rdi, [rdi + 16*4] ; accumulator += 16*(sizeof(int))
-
- cmp rdx, rcx
- je .temporal_filter_apply_epilog
- pxor xmm7, xmm7 ; zero for extraction
- cmp dword ptr [rsp + block_size], 16
- je .temporal_filter_apply_load_16
- jmp .temporal_filter_apply_load_8
-
-.temporal_filter_apply_epilog:
- ; begin epilog
- mov rbp, [rsp + rbp_backup]
- add rsp, stack_size
- pop rsp
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-SECTION_RODATA
-align 16
-_const_3w:
- times 8 dw 3
-align 16
-_const_top_bit:
- times 8 dw 1<<15
-align 16
-_const_16w
- times 8 dw 16
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_avx2.c
deleted file mode 100644
index 835c519..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_avx2.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "./vpx_config.h"
-
-#include "vp9/encoder/vp9_variance.h"
-#include "vp9/common/vp9_pragmas.h"
-#include "vpx_ports/mem.h"
-
-typedef void (*get_var_avx2) (
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-
-void vp9_get16x16var_avx2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-
-void vp9_get32x32var_avx2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-
-unsigned int vp9_sub_pixel_variance32xh_avx2
-(
- const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- int height,
- unsigned int *sse
-);
-
-unsigned int vp9_sub_pixel_avg_variance32xh_avx2
-(
- const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- const uint8_t *sec,
- int sec_stride,
- int height,
- unsigned int *sseptr
-);
-
-static void variance_avx2(const unsigned char *src_ptr, int source_stride,
- const unsigned char *ref_ptr, int recon_stride,
- int w, int h, unsigned int *sse, int *sum,
- get_var_avx2 var_fn, int block_size) {
- unsigned int sse0;
- int sum0;
- int i, j;
-
- *sse = 0;
- *sum = 0;
-
- for (i = 0; i < h; i += 16) {
- for (j = 0; j < w; j += block_size) {
- // processing 16 rows horizontally each call
- var_fn(src_ptr + source_stride * i + j, source_stride,
- ref_ptr + recon_stride * i + j, recon_stride, &sse0, &sum0);
- *sse += sse0;
- *sum += sum0;
- }
- }
-}
-
-unsigned int vp9_variance16x16_avx2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_avx2(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16,
- &var, &avg, vp9_get16x16var_avx2, 16);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 8));
-}
-
-unsigned int vp9_mse16x16_avx2(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int sse0;
- int sum0;
- vp9_get16x16var_avx2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0,
- &sum0);
- *sse = sse0;
- return sse0;
-}
-
-unsigned int vp9_variance32x32_avx2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- // processing 32 elements vertically in parallel
- variance_avx2(src_ptr, source_stride, ref_ptr, recon_stride, 32, 32,
- &var, &avg, vp9_get32x32var_avx2, 32);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 10));
-}
-
-unsigned int vp9_variance32x16_avx2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- // processing 32 elements vertically in parallel
- variance_avx2(src_ptr, source_stride, ref_ptr, recon_stride, 32, 16,
- &var, &avg, vp9_get32x32var_avx2, 32);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 9));
-}
-
-
-unsigned int vp9_variance64x64_avx2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- // processing 32 elements vertically in parallel
- variance_avx2(src_ptr, source_stride, ref_ptr, recon_stride, 64, 64,
- &var, &avg, vp9_get32x32var_avx2, 32);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 12));
-}
-
-unsigned int vp9_variance64x32_avx2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- // processing 32 elements vertically in parallel
- variance_avx2(src_ptr, source_stride, ref_ptr, recon_stride, 64, 32,
- &var, &avg, vp9_get32x32var_avx2, 32);
-
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 11));
-}
-
-unsigned int vp9_sub_pixel_variance64x64_avx2(const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- unsigned int *sse_ptr) {
- // processing 32 elements in parallel
- unsigned int sse;
- int se = vp9_sub_pixel_variance32xh_avx2(src, src_stride, x_offset,
- y_offset, dst, dst_stride,
- 64, &sse);
- // processing the next 32 elements in parallel
- unsigned int sse2;
- int se2 = vp9_sub_pixel_variance32xh_avx2(src + 32, src_stride,
- x_offset, y_offset,
- dst + 32, dst_stride,
- 64, &sse2);
- se += se2;
- sse += sse2;
- *sse_ptr = sse;
- return sse - (((int64_t)se * se) >> 12);
-}
-
-unsigned int vp9_sub_pixel_variance32x32_avx2(const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- unsigned int *sse_ptr) {
- // processing 32 element in parallel
- unsigned int sse;
- int se = vp9_sub_pixel_variance32xh_avx2(src, src_stride, x_offset,
- y_offset, dst, dst_stride,
- 32, &sse);
- *sse_ptr = sse;
- return sse - (((int64_t)se * se) >> 10);
-}
-
-unsigned int vp9_sub_pixel_avg_variance64x64_avx2(const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- unsigned int *sseptr,
- const uint8_t *sec) {
- // processing 32 elements in parallel
- unsigned int sse;
-
- int se = vp9_sub_pixel_avg_variance32xh_avx2(src, src_stride, x_offset,
- y_offset, dst, dst_stride,
- sec, 64, 64, &sse);
- unsigned int sse2;
- // processing the next 32 elements in parallel
- int se2 = vp9_sub_pixel_avg_variance32xh_avx2(src + 32, src_stride, x_offset,
- y_offset, dst + 32, dst_stride,
- sec + 32, 64, 64, &sse2);
- se += se2;
- sse += sse2;
- *sseptr = sse;
-
- return sse - (((int64_t)se * se) >> 12);
-}
-
-unsigned int vp9_sub_pixel_avg_variance32x32_avx2(const uint8_t *src,
- int src_stride,
- int x_offset,
- int y_offset,
- const uint8_t *dst,
- int dst_stride,
- unsigned int *sseptr,
- const uint8_t *sec) {
- // processing 32 element in parallel
- unsigned int sse;
- int se = vp9_sub_pixel_avg_variance32xh_avx2(src, src_stride, x_offset,
- y_offset, dst, dst_stride,
- sec, 32, 32, &sse);
- *sseptr = sse;
- return sse - (((int64_t)se * se) >> 10);
-}
-
-
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_intrin_avx2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_intrin_avx2.c
deleted file mode 100644
index f992328..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_intrin_avx2.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <immintrin.h> // AVX2
-
-void vp9_get16x16var_avx2(const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum) {
- __m256i src, src_expand_low, src_expand_high, ref, ref_expand_low;
- __m256i ref_expand_high, madd_low, madd_high;
- unsigned int i, src_2strides, ref_2strides;
- __m256i zero_reg = _mm256_set1_epi16(0);
- __m256i sum_ref_src = _mm256_set1_epi16(0);
- __m256i madd_ref_src = _mm256_set1_epi16(0);
-
- // processing two strides in a 256 bit register reducing the number
- // of loop stride by half (comparing to the sse2 code)
- src_2strides = source_stride << 1;
- ref_2strides = recon_stride << 1;
- for (i = 0; i < 8; i++) {
- src = _mm256_castsi128_si256(
- _mm_loadu_si128((__m128i const *) (src_ptr)));
- src = _mm256_inserti128_si256(src,
- _mm_loadu_si128((__m128i const *)(src_ptr+source_stride)), 1);
-
- ref =_mm256_castsi128_si256(
- _mm_loadu_si128((__m128i const *) (ref_ptr)));
- ref = _mm256_inserti128_si256(ref,
- _mm_loadu_si128((__m128i const *)(ref_ptr+recon_stride)), 1);
-
- // expanding to 16 bit each lane
- src_expand_low = _mm256_unpacklo_epi8(src, zero_reg);
- src_expand_high = _mm256_unpackhi_epi8(src, zero_reg);
-
- ref_expand_low = _mm256_unpacklo_epi8(ref, zero_reg);
- ref_expand_high = _mm256_unpackhi_epi8(ref, zero_reg);
-
- // src-ref
- src_expand_low = _mm256_sub_epi16(src_expand_low, ref_expand_low);
- src_expand_high = _mm256_sub_epi16(src_expand_high, ref_expand_high);
-
- // madd low (src - ref)
- madd_low = _mm256_madd_epi16(src_expand_low, src_expand_low);
-
- // add high to low
- src_expand_low = _mm256_add_epi16(src_expand_low, src_expand_high);
-
- // madd high (src - ref)
- madd_high = _mm256_madd_epi16(src_expand_high, src_expand_high);
-
- sum_ref_src = _mm256_add_epi16(sum_ref_src, src_expand_low);
-
- // add high to low
- madd_ref_src = _mm256_add_epi32(madd_ref_src,
- _mm256_add_epi32(madd_low, madd_high));
-
- src_ptr+= src_2strides;
- ref_ptr+= ref_2strides;
- }
-
- {
- __m128i sum_res, madd_res;
- __m128i expand_sum_low, expand_sum_high, expand_sum;
- __m128i expand_madd_low, expand_madd_high, expand_madd;
- __m128i ex_expand_sum_low, ex_expand_sum_high, ex_expand_sum;
-
- // extract the low lane and add it to the high lane
- sum_res = _mm_add_epi16(_mm256_castsi256_si128(sum_ref_src),
- _mm256_extractf128_si256(sum_ref_src, 1));
-
- madd_res = _mm_add_epi32(_mm256_castsi256_si128(madd_ref_src),
- _mm256_extractf128_si256(madd_ref_src, 1));
-
- // padding each 2 bytes with another 2 zeroed bytes
- expand_sum_low = _mm_unpacklo_epi16(_mm256_castsi256_si128(zero_reg),
- sum_res);
- expand_sum_high = _mm_unpackhi_epi16(_mm256_castsi256_si128(zero_reg),
- sum_res);
-
- // shifting the sign 16 bits right
- expand_sum_low = _mm_srai_epi32(expand_sum_low, 16);
- expand_sum_high = _mm_srai_epi32(expand_sum_high, 16);
-
- expand_sum = _mm_add_epi32(expand_sum_low, expand_sum_high);
-
- // expand each 32 bits of the madd result to 64 bits
- expand_madd_low = _mm_unpacklo_epi32(madd_res,
- _mm256_castsi256_si128(zero_reg));
- expand_madd_high = _mm_unpackhi_epi32(madd_res,
- _mm256_castsi256_si128(zero_reg));
-
- expand_madd = _mm_add_epi32(expand_madd_low, expand_madd_high);
-
- ex_expand_sum_low = _mm_unpacklo_epi32(expand_sum,
- _mm256_castsi256_si128(zero_reg));
- ex_expand_sum_high = _mm_unpackhi_epi32(expand_sum,
- _mm256_castsi256_si128(zero_reg));
-
- ex_expand_sum = _mm_add_epi32(ex_expand_sum_low, ex_expand_sum_high);
-
- // shift 8 bytes eight
- madd_res = _mm_srli_si128(expand_madd, 8);
- sum_res = _mm_srli_si128(ex_expand_sum, 8);
-
- madd_res = _mm_add_epi32(madd_res, expand_madd);
- sum_res = _mm_add_epi32(sum_res, ex_expand_sum);
-
- *((int*)SSE)= _mm_cvtsi128_si32(madd_res);
-
- *((int*)Sum)= _mm_cvtsi128_si32(sum_res);
- }
-}
-
-void vp9_get32x32var_avx2(const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum) {
- __m256i src, src_expand_low, src_expand_high, ref, ref_expand_low;
- __m256i ref_expand_high, madd_low, madd_high;
- unsigned int i;
- __m256i zero_reg = _mm256_set1_epi16(0);
- __m256i sum_ref_src = _mm256_set1_epi16(0);
- __m256i madd_ref_src = _mm256_set1_epi16(0);
-
- // processing 32 elements in parallel
- for (i = 0; i < 16; i++) {
- src = _mm256_loadu_si256((__m256i const *) (src_ptr));
-
- ref = _mm256_loadu_si256((__m256i const *) (ref_ptr));
-
- // expanding to 16 bit each lane
- src_expand_low = _mm256_unpacklo_epi8(src, zero_reg);
- src_expand_high = _mm256_unpackhi_epi8(src, zero_reg);
-
- ref_expand_low = _mm256_unpacklo_epi8(ref, zero_reg);
- ref_expand_high = _mm256_unpackhi_epi8(ref, zero_reg);
-
- // src-ref
- src_expand_low = _mm256_sub_epi16(src_expand_low, ref_expand_low);
- src_expand_high = _mm256_sub_epi16(src_expand_high, ref_expand_high);
-
- // madd low (src - ref)
- madd_low = _mm256_madd_epi16(src_expand_low, src_expand_low);
-
- // add high to low
- src_expand_low = _mm256_add_epi16(src_expand_low, src_expand_high);
-
- // madd high (src - ref)
- madd_high = _mm256_madd_epi16(src_expand_high, src_expand_high);
-
- sum_ref_src = _mm256_add_epi16(sum_ref_src, src_expand_low);
-
- // add high to low
- madd_ref_src = _mm256_add_epi32(madd_ref_src,
- _mm256_add_epi32(madd_low, madd_high));
-
- src_ptr+= source_stride;
- ref_ptr+= recon_stride;
- }
-
- {
- __m256i expand_sum_low, expand_sum_high, expand_sum;
- __m256i expand_madd_low, expand_madd_high, expand_madd;
- __m256i ex_expand_sum_low, ex_expand_sum_high, ex_expand_sum;
-
- // padding each 2 bytes with another 2 zeroed bytes
- expand_sum_low = _mm256_unpacklo_epi16(zero_reg, sum_ref_src);
- expand_sum_high = _mm256_unpackhi_epi16(zero_reg, sum_ref_src);
-
- // shifting the sign 16 bits right
- expand_sum_low = _mm256_srai_epi32(expand_sum_low, 16);
- expand_sum_high = _mm256_srai_epi32(expand_sum_high, 16);
-
- expand_sum = _mm256_add_epi32(expand_sum_low, expand_sum_high);
-
- // expand each 32 bits of the madd result to 64 bits
- expand_madd_low = _mm256_unpacklo_epi32(madd_ref_src, zero_reg);
- expand_madd_high = _mm256_unpackhi_epi32(madd_ref_src, zero_reg);
-
- expand_madd = _mm256_add_epi32(expand_madd_low, expand_madd_high);
-
- ex_expand_sum_low = _mm256_unpacklo_epi32(expand_sum, zero_reg);
- ex_expand_sum_high = _mm256_unpackhi_epi32(expand_sum, zero_reg);
-
- ex_expand_sum = _mm256_add_epi32(ex_expand_sum_low, ex_expand_sum_high);
-
- // shift 8 bytes eight
- madd_ref_src = _mm256_srli_si256(expand_madd, 8);
- sum_ref_src = _mm256_srli_si256(ex_expand_sum, 8);
-
- madd_ref_src = _mm256_add_epi32(madd_ref_src, expand_madd);
- sum_ref_src = _mm256_add_epi32(sum_ref_src, ex_expand_sum);
-
- // extract the low lane and the high lane and add the results
- *((int*)SSE)= _mm_cvtsi128_si32(_mm256_castsi256_si128(madd_ref_src)) +
- _mm_cvtsi128_si32(_mm256_extractf128_si256(madd_ref_src, 1));
-
- *((int*)Sum)= _mm_cvtsi128_si32(_mm256_castsi256_si128(sum_ref_src)) +
- _mm_cvtsi128_si32(_mm256_extractf128_si256(sum_ref_src, 1));
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_mmx.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_mmx.asm
deleted file mode 100644
index 3501cf1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_mmx.asm
+++ /dev/null
@@ -1,510 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;unsigned int vp9_get_mb_ss_mmx( short *src_ptr )
-global sym(vp9_get_mb_ss_mmx) PRIVATE
-sym(vp9_get_mb_ss_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 8
- ; end prolog
-
- mov rax, arg(0) ;src_ptr
- mov rcx, 16
- pxor mm4, mm4
-
-.NEXTROW:
- movq mm0, [rax]
- movq mm1, [rax+8]
- movq mm2, [rax+16]
- movq mm3, [rax+24]
- pmaddwd mm0, mm0
- pmaddwd mm1, mm1
- pmaddwd mm2, mm2
- pmaddwd mm3, mm3
-
- paddd mm4, mm0
- paddd mm4, mm1
- paddd mm4, mm2
- paddd mm4, mm3
-
- add rax, 32
- dec rcx
- ja .NEXTROW
- movq QWORD PTR [rsp], mm4
-
- ;return sum[0]+sum[1];
- movsxd rax, dword ptr [rsp]
- movsxd rcx, dword ptr [rsp+4]
- add rax, rcx
-
-
- ; begin epilog
- add rsp, 8
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp9_get8x8var_mmx
-;(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride,
-; unsigned int *SSE,
-; int *Sum
-;)
-global sym(vp9_get8x8var_mmx) PRIVATE
-sym(vp9_get8x8var_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- push rbx
- sub rsp, 16
- ; end prolog
-
-
- pxor mm5, mm5 ; Blank mmx6
- pxor mm6, mm6 ; Blank mmx7
- pxor mm7, mm7 ; Blank mmx7
-
- mov rax, arg(0) ;[src_ptr] ; Load base addresses
- mov rbx, arg(2) ;[ref_ptr]
- movsxd rcx, dword ptr arg(1) ;[source_stride]
- movsxd rdx, dword ptr arg(3) ;[recon_stride]
-
- ; Row 1
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm1, [rbx] ; Copy eight bytes to mm1
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
-
- ; Row 2
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 3
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 4
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 5
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- ; movq mm4, [rbx + rdx]
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 6
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 7
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movq mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Row 8
- movq mm0, [rax] ; Copy eight bytes to mm0
- movq mm2, mm0 ; Take copies
- movq mm3, mm1 ; Take copies
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- punpckhbw mm2, mm6 ; unpack to higher prrcision
- punpckhbw mm3, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- psubsw mm2, mm3 ; A-B (high order) to MM2
-
- paddw mm5, mm0 ; accumulate differences in mm5
- paddw mm5, mm2 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- pmaddwd mm2, mm2 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- paddd mm7, mm0 ; accumulate in mm7
- paddd mm7, mm2 ; accumulate in mm7
-
- ; Now accumulate the final results.
- movq QWORD PTR [rsp+8], mm5 ; copy back accumulated results into normal memory
- movq QWORD PTR [rsp], mm7 ; copy back accumulated results into normal memory
- movsx rdx, WORD PTR [rsp+8]
- movsx rcx, WORD PTR [rsp+10]
- movsx rbx, WORD PTR [rsp+12]
- movsx rax, WORD PTR [rsp+14]
- add rdx, rcx
- add rbx, rax
- add rdx, rbx ;XSum
- movsxd rax, DWORD PTR [rsp]
- movsxd rcx, DWORD PTR [rsp+4]
- add rax, rcx ;XXSum
- mov rsi, arg(4) ;SSE
- mov rdi, arg(5) ;Sum
- mov dword ptr [rsi], eax
- mov dword ptr [rdi], edx
- xor rax, rax ; return 0
-
-
- ; begin epilog
- add rsp, 16
- pop rbx
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-;unsigned int
-;vp9_get4x4var_mmx
-;(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride,
-; unsigned int *SSE,
-; int *Sum
-;)
-global sym(vp9_get4x4var_mmx) PRIVATE
-sym(vp9_get4x4var_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- push rsi
- push rdi
- push rbx
- sub rsp, 16
- ; end prolog
-
-
- pxor mm5, mm5 ; Blank mmx6
- pxor mm6, mm6 ; Blank mmx7
- pxor mm7, mm7 ; Blank mmx7
-
- mov rax, arg(0) ;[src_ptr] ; Load base addresses
- mov rbx, arg(2) ;[ref_ptr]
- movsxd rcx, dword ptr arg(1) ;[source_stride]
- movsxd rdx, dword ptr arg(3) ;[recon_stride]
-
- ; Row 1
- movd mm0, [rax] ; Copy 4 bytes to mm0
- movd mm1, [rbx] ; Copy 4 bytes to mm1
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- paddw mm5, mm0 ; accumulate differences in mm5
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy 4 bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
-
- ; Row 2
- movd mm0, [rax] ; Copy 4 bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- paddw mm5, mm0 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy 4 bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 3
- movd mm0, [rax] ; Copy 4 bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- paddw mm5, mm0 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy 4 bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 4
- movd mm0, [rax] ; Copy 4 bytes to mm0
-
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
-
- paddw mm5, mm0 ; accumulate differences in mm5
-
- pmaddwd mm0, mm0 ; square and accumulate
- paddd mm7, mm0 ; accumulate in mm7
-
-
- ; Now accumulate the final results.
- movq QWORD PTR [rsp+8], mm5 ; copy back accumulated results into normal memory
- movq QWORD PTR [rsp], mm7 ; copy back accumulated results into normal memory
- movsx rdx, WORD PTR [rsp+8]
- movsx rcx, WORD PTR [rsp+10]
- movsx rbx, WORD PTR [rsp+12]
- movsx rax, WORD PTR [rsp+14]
- add rdx, rcx
- add rbx, rax
- add rdx, rbx ;XSum
- movsxd rax, DWORD PTR [rsp]
- movsxd rcx, DWORD PTR [rsp+4]
- add rax, rcx ;XXSum
- mov rsi, arg(4) ;SSE
- mov rdi, arg(5) ;Sum
- mov dword ptr [rsi], eax
- mov dword ptr [rdi], edx
- xor rax, rax ; return 0
-
-
- ; begin epilog
- add rsp, 16
- pop rbx
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-;unsigned int
-;vp9_get4x4sse_cs_mmx
-;(
-; unsigned char *src_ptr,
-; int source_stride,
-; unsigned char *ref_ptr,
-; int recon_stride
-;)
-global sym(vp9_get4x4sse_cs_mmx) PRIVATE
-sym(vp9_get4x4sse_cs_mmx):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
- push rsi
- push rdi
- push rbx
- ; end prolog
-
-
- pxor mm6, mm6 ; Blank mmx7
- pxor mm7, mm7 ; Blank mmx7
-
- mov rax, arg(0) ;[src_ptr] ; Load base addresses
- mov rbx, arg(2) ;[ref_ptr]
- movsxd rcx, dword ptr arg(1) ;[source_stride]
- movsxd rdx, dword ptr arg(3) ;[recon_stride]
- ; Row 1
- movd mm0, [rax] ; Copy eight bytes to mm0
- movd mm1, [rbx] ; Copy eight bytes to mm1
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 2
- movd mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 3
- movd mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm1, mm6
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- psubsw mm0, mm1 ; A-B (low order) to MM0
-
- pmaddwd mm0, mm0 ; square and accumulate
- add rbx,rdx ; Inc pointer into ref data
- add rax,rcx ; Inc pointer into the new data
- movd mm1, [rbx] ; Copy eight bytes to mm1
- paddd mm7, mm0 ; accumulate in mm7
-
- ; Row 4
- movd mm0, [rax] ; Copy eight bytes to mm0
- punpcklbw mm0, mm6 ; unpack to higher prrcision
- punpcklbw mm1, mm6
- psubsw mm0, mm1 ; A-B (low order) to MM0
- pmaddwd mm0, mm0 ; square and accumulate
- paddd mm7, mm0 ; accumulate in mm7
-
- movq mm0, mm7 ;
- psrlq mm7, 32
-
- paddd mm0, mm7
- movq rax, mm0
-
-
- ; begin epilog
- pop rbx
- pop rdi
- pop rsi
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_sse2.asm b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_sse2.asm
deleted file mode 100644
index 2c50881..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_impl_sse2.asm
+++ /dev/null
@@ -1,734 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-;unsigned int vp9_get_mb_ss_sse2
-;(
-; short *src_ptr
-;)
-global sym(vp9_get_mb_ss_sse2) PRIVATE
-sym(vp9_get_mb_ss_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 1
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 16
- ; end prolog
-
-
- mov rax, arg(0) ;[src_ptr]
- mov rcx, 8
- pxor xmm4, xmm4
-
-.NEXTROW:
- movdqa xmm0, [rax]
- movdqa xmm1, [rax+16]
- movdqa xmm2, [rax+32]
- movdqa xmm3, [rax+48]
- pmaddwd xmm0, xmm0
- pmaddwd xmm1, xmm1
- pmaddwd xmm2, xmm2
- pmaddwd xmm3, xmm3
-
- paddd xmm0, xmm1
- paddd xmm2, xmm3
- paddd xmm4, xmm0
- paddd xmm4, xmm2
-
- add rax, 0x40
- dec rcx
- ja .NEXTROW
-
- movdqa xmm3,xmm4
- psrldq xmm4,8
- paddd xmm4,xmm3
- movdqa xmm3,xmm4
- psrldq xmm4,4
- paddd xmm4,xmm3
- movq rax,xmm4
-
-
- ; begin epilog
- add rsp, 16
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;unsigned int vp9_get16x16var_sse2
-;(
-; unsigned char * src_ptr,
-; int source_stride,
-; unsigned char * ref_ptr,
-; int recon_stride,
-; unsigned int * SSE,
-; int * Sum
-;)
-global sym(vp9_get16x16var_sse2) PRIVATE
-sym(vp9_get16x16var_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- push rbx
- push rsi
- push rdi
- ; end prolog
-
- mov rsi, arg(0) ;[src_ptr]
- mov rdi, arg(2) ;[ref_ptr]
-
- movsxd rax, DWORD PTR arg(1) ;[source_stride]
- movsxd rdx, DWORD PTR arg(3) ;[recon_stride]
-
- ; Prefetch data
- lea rcx, [rax+rax*2]
- prefetcht0 [rsi]
- prefetcht0 [rsi+rax]
- prefetcht0 [rsi+rax*2]
- prefetcht0 [rsi+rcx]
- lea rbx, [rsi+rax*4]
- prefetcht0 [rbx]
- prefetcht0 [rbx+rax]
- prefetcht0 [rbx+rax*2]
- prefetcht0 [rbx+rcx]
-
- lea rcx, [rdx+rdx*2]
- prefetcht0 [rdi]
- prefetcht0 [rdi+rdx]
- prefetcht0 [rdi+rdx*2]
- prefetcht0 [rdi+rcx]
- lea rbx, [rdi+rdx*4]
- prefetcht0 [rbx]
- prefetcht0 [rbx+rdx]
- prefetcht0 [rbx+rdx*2]
- prefetcht0 [rbx+rcx]
-
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- pxor xmm7, xmm7 ; clear xmm7 for accumulating diffs
-
- pxor xmm6, xmm6 ; clear xmm6 for accumulating sse
- mov rcx, 16
-
-.var16loop:
- movdqu xmm1, XMMWORD PTR [rsi]
- movdqu xmm2, XMMWORD PTR [rdi]
-
- prefetcht0 [rsi+rax*8]
- prefetcht0 [rdi+rdx*8]
-
- movdqa xmm3, xmm1
- movdqa xmm4, xmm2
-
-
- punpcklbw xmm1, xmm0
- punpckhbw xmm3, xmm0
-
- punpcklbw xmm2, xmm0
- punpckhbw xmm4, xmm0
-
-
- psubw xmm1, xmm2
- psubw xmm3, xmm4
-
- paddw xmm7, xmm1
- pmaddwd xmm1, xmm1
-
- paddw xmm7, xmm3
- pmaddwd xmm3, xmm3
-
- paddd xmm6, xmm1
- paddd xmm6, xmm3
-
- add rsi, rax
- add rdi, rdx
-
- sub rcx, 1
- jnz .var16loop
-
-
- movdqa xmm1, xmm6
- pxor xmm6, xmm6
-
- pxor xmm5, xmm5
- punpcklwd xmm6, xmm7
-
- punpckhwd xmm5, xmm7
- psrad xmm5, 16
-
- psrad xmm6, 16
- paddd xmm6, xmm5
-
- movdqa xmm2, xmm1
- punpckldq xmm1, xmm0
-
- punpckhdq xmm2, xmm0
- movdqa xmm7, xmm6
-
- paddd xmm1, xmm2
- punpckldq xmm6, xmm0
-
- punpckhdq xmm7, xmm0
- paddd xmm6, xmm7
-
- movdqa xmm2, xmm1
- movdqa xmm7, xmm6
-
- psrldq xmm1, 8
- psrldq xmm6, 8
-
- paddd xmm7, xmm6
- paddd xmm1, xmm2
-
- mov rax, arg(5) ;[Sum]
- mov rdi, arg(4) ;[SSE]
-
- movd DWORD PTR [rax], xmm7
- movd DWORD PTR [rdi], xmm1
-
-
- ; begin epilog
- pop rdi
- pop rsi
- pop rbx
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-
-
-;unsigned int vp9_get8x8var_sse2
-;(
-; unsigned char * src_ptr,
-; int source_stride,
-; unsigned char * ref_ptr,
-; int recon_stride,
-; unsigned int * SSE,
-; int * Sum
-;)
-global sym(vp9_get8x8var_sse2) PRIVATE
-sym(vp9_get8x8var_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- sub rsp, 16
- ; end prolog
-
- mov rsi, arg(0) ;[src_ptr]
- mov rdi, arg(2) ;[ref_ptr]
-
- movsxd rax, DWORD PTR arg(1) ;[source_stride]
- movsxd rdx, DWORD PTR arg(3) ;[recon_stride]
-
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- pxor xmm7, xmm7 ; clear xmm7 for accumulating diffs
-
- movq xmm1, QWORD PTR [rsi]
- movq xmm2, QWORD PTR [rdi]
-
- punpcklbw xmm1, xmm0
- punpcklbw xmm2, xmm0
-
- psubsw xmm1, xmm2
- paddw xmm7, xmm1
-
- pmaddwd xmm1, xmm1
-
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- movq xmm2, QWORD PTR[rsi + rax * 2]
- movq xmm3, QWORD PTR[rdi + rdx * 2]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- lea rsi, [rsi + rax * 2]
- lea rdi, [rdi + rdx * 2]
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
- movq xmm2, QWORD PTR[rsi + rax *2]
- movq xmm3, QWORD PTR[rdi + rdx *2]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- lea rsi, [rsi + rax * 2]
- lea rdi, [rdi + rdx * 2]
-
-
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
- movq xmm2, QWORD PTR[rsi + rax *2]
- movq xmm3, QWORD PTR[rdi + rdx *2]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- lea rsi, [rsi + rax * 2]
- lea rdi, [rdi + rdx * 2]
-
- movq xmm2, QWORD PTR[rsi + rax]
- movq xmm3, QWORD PTR[rdi + rdx]
-
- punpcklbw xmm2, xmm0
- punpcklbw xmm3, xmm0
-
- psubsw xmm2, xmm3
- paddw xmm7, xmm2
-
- pmaddwd xmm2, xmm2
- paddd xmm1, xmm2
-
-
- movdqa xmm6, xmm7
- punpcklwd xmm6, xmm0
-
- punpckhwd xmm7, xmm0
- movdqa xmm2, xmm1
-
- paddw xmm6, xmm7
- punpckldq xmm1, xmm0
-
- punpckhdq xmm2, xmm0
- movdqa xmm7, xmm6
-
- paddd xmm1, xmm2
- punpckldq xmm6, xmm0
-
- punpckhdq xmm7, xmm0
- paddw xmm6, xmm7
-
- movdqa xmm2, xmm1
- movdqa xmm7, xmm6
-
- psrldq xmm1, 8
- psrldq xmm6, 8
-
- paddw xmm7, xmm6
- paddd xmm1, xmm2
-
- mov rax, arg(5) ;[Sum]
- mov rdi, arg(4) ;[SSE]
-
- movq rdx, xmm7
- movsx rcx, dx
-
- mov dword ptr [rax], ecx
- movd DWORD PTR [rdi], xmm1
-
- ; begin epilog
- add rsp, 16
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_half_horiz_vert_variance8x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp9_half_horiz_vert_variance8x_h_sse2) PRIVATE
-sym(vp9_half_horiz_vert_variance8x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
-
- pxor xmm0, xmm0 ;
-
- movq xmm5, QWORD PTR [rsi] ; xmm5 = s0,s1,s2..s8
- movq xmm3, QWORD PTR [rsi+1] ; xmm3 = s1,s2,s3..s9
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3) horizontal line 1
-
-%if ABI_IS_32BIT
- add rsi, dword ptr arg(1) ;ref_pixels_per_line ; next source
-%else
- add rsi, r8
-%endif
-
-.half_horiz_vert_variance8x_h_1:
-
- movq xmm1, QWORD PTR [rsi] ;
- movq xmm2, QWORD PTR [rsi+1] ;
- pavgb xmm1, xmm2 ; xmm1 = avg(xmm1,xmm3) horizontal line i+1
-
- pavgb xmm5, xmm1 ; xmm = vertical average of the above
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d8
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
-
- movdqa xmm5, xmm1 ; save xmm1 for use on the next row
-
-%if ABI_IS_32BIT
- add esi, dword ptr arg(1) ;ref_pixels_per_line ; next source
- add edi, dword ptr arg(3) ;src_pixels_per_line ; next destination
-%else
- add rsi, r8
- add rdi, r9
-%endif
-
- sub rcx, 1 ;
- jnz .half_horiz_vert_variance8x_h_1 ;
-
- movdq2q mm6, xmm6 ;
- movdq2q mm7, xmm7 ;
-
- psrldq xmm6, 8
- psrldq xmm7, 8
-
- movdq2q mm2, xmm6
- movdq2q mm3, xmm7
-
- paddw mm6, mm2
- paddd mm7, mm3
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rsi, arg(5) ; sum
- mov rdi, arg(6) ; sumsquared
-
- movd [rsi], mm2 ;
- movd [rdi], mm4 ;
-
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-;void vp9_half_vert_variance8x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp9_half_vert_variance8x_h_sse2) PRIVATE
-sym(vp9_half_vert_variance8x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
- movsxd rax, dword ptr arg(1) ;ref_pixels_per_line
-
- pxor xmm0, xmm0 ;
-.half_vert_variance8x_h_1:
- movq xmm5, QWORD PTR [rsi] ; xmm5 = s0,s1,s2..s8
- movq xmm3, QWORD PTR [rsi+rax] ; xmm3 = s1,s2,s3..s9
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d8
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
-
-%if ABI_IS_32BIT
- add esi, dword ptr arg(1) ;ref_pixels_per_line ; next source
- add edi, dword ptr arg(3) ;src_pixels_per_line ; next destination
-%else
- add rsi, r8
- add rdi, r9
-%endif
-
- sub rcx, 1 ;
- jnz .half_vert_variance8x_h_1 ;
-
- movdq2q mm6, xmm6 ;
- movdq2q mm7, xmm7 ;
-
- psrldq xmm6, 8
- psrldq xmm7, 8
-
- movdq2q mm2, xmm6
- movdq2q mm3, xmm7
-
- paddw mm6, mm2
- paddd mm7, mm3
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rsi, arg(5) ; sum
- mov rdi, arg(6) ; sumsquared
-
- movd [rsi], mm2 ;
- movd [rdi], mm4 ;
-
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
-;void vp9_half_horiz_variance8x_h_sse2
-;(
-; unsigned char *ref_ptr,
-; int ref_pixels_per_line,
-; unsigned char *src_ptr,
-; int src_pixels_per_line,
-; unsigned int Height,
-; int *sum,
-; unsigned int *sumsquared
-;)
-global sym(vp9_half_horiz_variance8x_h_sse2) PRIVATE
-sym(vp9_half_horiz_variance8x_h_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-%if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(1) ;ref_pixels_per_line
- movsxd r9, dword ptr arg(3) ;src_pixels_per_line
-%endif
-
- pxor xmm6, xmm6 ; error accumulator
- pxor xmm7, xmm7 ; sse eaccumulator
- mov rsi, arg(0) ;ref_ptr ;
-
- mov rdi, arg(2) ;src_ptr ;
- movsxd rcx, dword ptr arg(4) ;Height ;
-
- pxor xmm0, xmm0 ;
-.half_horiz_variance8x_h_1:
- movq xmm5, QWORD PTR [rsi] ; xmm5 = s0,s1,s2..s8
- movq xmm3, QWORD PTR [rsi+1] ; xmm3 = s1,s2,s3..s9
-
- pavgb xmm5, xmm3 ; xmm5 = avg(xmm1,xmm3)
- punpcklbw xmm5, xmm0 ; xmm5 = words of above
-
- movq xmm3, QWORD PTR [rdi] ; xmm3 = d0,d1,d2..d8
- punpcklbw xmm3, xmm0 ; xmm3 = words of above
-
- psubw xmm5, xmm3 ; xmm5 -= xmm3
- paddw xmm6, xmm5 ; xmm6 += accumulated column differences
- pmaddwd xmm5, xmm5 ; xmm5 *= xmm5
- paddd xmm7, xmm5 ; xmm7 += accumulated square column differences
-
-%if ABI_IS_32BIT
- add esi, dword ptr arg(1) ;ref_pixels_per_line ; next source
- add edi, dword ptr arg(3) ;src_pixels_per_line ; next destination
-%else
- add rsi, r8
- add rdi, r9
-%endif
- sub rcx, 1 ;
- jnz .half_horiz_variance8x_h_1 ;
-
- movdq2q mm6, xmm6 ;
- movdq2q mm7, xmm7 ;
-
- psrldq xmm6, 8
- psrldq xmm7, 8
-
- movdq2q mm2, xmm6
- movdq2q mm3, xmm7
-
- paddw mm6, mm2
- paddd mm7, mm3
-
- pxor mm3, mm3 ;
- pxor mm2, mm2 ;
-
- punpcklwd mm2, mm6 ;
- punpckhwd mm3, mm6 ;
-
- paddd mm2, mm3 ;
- movq mm6, mm2 ;
-
- psrlq mm6, 32 ;
- paddd mm2, mm6 ;
-
- psrad mm2, 16 ;
- movq mm4, mm7 ;
-
- psrlq mm4, 32 ;
- paddd mm4, mm7 ;
-
- mov rsi, arg(5) ; sum
- mov rdi, arg(6) ; sumsquared
-
- movd [rsi], mm2 ;
- movd [rdi], mm4 ;
-
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_mmx.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_mmx.c
deleted file mode 100644
index c4d17fc..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_mmx.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-#include "vp9/encoder/vp9_variance.h"
-#include "vp9/common/vp9_pragmas.h"
-#include "vpx_ports/mem.h"
-
-extern unsigned int vp9_get8x8var_mmx
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-extern unsigned int vp9_get4x4var_mmx
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-
-unsigned int vp9_variance4x4_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- vp9_get4x4var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 4));
-}
-
-unsigned int vp9_variance8x8_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg);
- *sse = var;
-
- return (var - (((unsigned int)avg * avg) >> 6));
-}
-
-unsigned int vp9_mse16x16_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int sse0, sse1, sse2, sse3, var;
- int sum0, sum1, sum2, sum3;
-
-
- vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0,
- &sum0);
- vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride,
- &sse1, &sum1);
- vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride,
- ref_ptr + 8 * recon_stride, recon_stride, &sse2, &sum2);
- vp9_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride,
- ref_ptr + 8 * recon_stride + 8, recon_stride, &sse3, &sum3);
-
- var = sse0 + sse1 + sse2 + sse3;
- *sse = var;
- return var;
-}
-
-
-unsigned int vp9_variance16x16_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int sse0, sse1, sse2, sse3, var;
- int sum0, sum1, sum2, sum3, avg;
-
- vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0,
- &sum0);
- vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride,
- &sse1, &sum1);
- vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride,
- ref_ptr + 8 * recon_stride, recon_stride, &sse2, &sum2);
- vp9_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride,
- ref_ptr + 8 * recon_stride + 8, recon_stride, &sse3, &sum3);
-
- var = sse0 + sse1 + sse2 + sse3;
- avg = sum0 + sum1 + sum2 + sum3;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 8));
-}
-
-unsigned int vp9_variance16x8_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int sse0, sse1, var;
- int sum0, sum1, avg;
-
- vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0,
- &sum0);
- vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride,
- &sse1, &sum1);
-
- var = sse0 + sse1;
- avg = sum0 + sum1;
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-}
-
-
-unsigned int vp9_variance8x16_mmx(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int sse0, sse1, var;
- int sum0, sum1, avg;
-
- vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0,
- &sum0);
- vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride,
- ref_ptr + 8 * recon_stride, recon_stride, &sse1, &sum1);
-
- var = sse0 + sse1;
- avg = sum0 + sum1;
- *sse = var;
-
- return (var - (((unsigned int)avg * avg) >> 7));
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_sse2.c b/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_sse2.c
deleted file mode 100644
index 9e65694..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/encoder/x86/vp9_variance_sse2.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_config.h"
-
-#include "vp9/encoder/vp9_variance.h"
-#include "vp9/common/vp9_pragmas.h"
-#include "vpx_ports/mem.h"
-
-extern unsigned int vp9_get4x4var_mmx
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-
-unsigned int vp9_get16x16var_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-unsigned int vp9_get8x8var_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-void vp9_half_horiz_vert_variance8x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp9_half_horiz_vert_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp9_half_horiz_variance8x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp9_half_horiz_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp9_half_vert_variance8x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-void vp9_half_vert_variance16x_h_sse2
-(
- const unsigned char *ref_ptr,
- int ref_pixels_per_line,
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- unsigned int Height,
- int *sum,
- unsigned int *sumsquared
-);
-
-typedef unsigned int (*get_var_sse2) (
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *SSE,
- int *Sum
-);
-
-static void variance_sse2(const unsigned char *src_ptr, int source_stride,
- const unsigned char *ref_ptr, int recon_stride,
- int w, int h, unsigned int *sse, int *sum,
- get_var_sse2 var_fn, int block_size) {
- unsigned int sse0;
- int sum0;
- int i, j;
-
- *sse = 0;
- *sum = 0;
-
- for (i = 0; i < h; i += block_size) {
- for (j = 0; j < w; j += block_size) {
- var_fn(src_ptr + source_stride * i + j, source_stride,
- ref_ptr + recon_stride * i + j, recon_stride, &sse0, &sum0);
- *sse += sse0;
- *sum += sum0;
- }
- }
-}
-
-unsigned int vp9_variance4x4_sse2(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 4, 4,
- &var, &avg, vp9_get4x4var_mmx, 4);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 4));
-}
-
-unsigned int vp9_variance8x4_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 8, 4,
- &var, &avg, vp9_get4x4var_mmx, 4);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 5));
-}
-
-unsigned int vp9_variance4x8_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 4, 8,
- &var, &avg, vp9_get4x4var_mmx, 4);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 5));
-}
-
-unsigned int vp9_variance8x8_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 8, 8,
- &var, &avg, vp9_get8x8var_sse2, 8);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 6));
-}
-
-unsigned int vp9_variance16x8_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8,
- &var, &avg, vp9_get8x8var_sse2, 8);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-}
-
-unsigned int vp9_variance8x16_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 8, 16,
- &var, &avg, vp9_get8x8var_sse2, 8);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 7));
-}
-
-unsigned int vp9_variance16x16_sse2
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 16, 16,
- &var, &avg, vp9_get16x16var_sse2, 16);
- *sse = var;
- return (var - (((unsigned int)avg * avg) >> 8));
-}
-
-unsigned int vp9_mse16x16_sse2(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int sse0;
- int sum0;
- vp9_get16x16var_sse2(src_ptr, source_stride, ref_ptr, recon_stride, &sse0,
- &sum0);
- *sse = sse0;
- return sse0;
-}
-
-unsigned int vp9_variance32x32_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 32, 32,
- &var, &avg, vp9_get16x16var_sse2, 16);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 10));
-}
-
-unsigned int vp9_variance32x16_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 32, 16,
- &var, &avg, vp9_get16x16var_sse2, 16);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 9));
-}
-
-unsigned int vp9_variance16x32_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 16, 32,
- &var, &avg, vp9_get16x16var_sse2, 16);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 9));
-}
-
-unsigned int vp9_variance64x64_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 64, 64,
- &var, &avg, vp9_get16x16var_sse2, 16);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 12));
-}
-
-unsigned int vp9_variance64x32_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 64, 32,
- &var, &avg, vp9_get16x16var_sse2, 16);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 11));
-}
-
-unsigned int vp9_variance32x64_sse2(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- unsigned int var;
- int avg;
-
- variance_sse2(src_ptr, source_stride, ref_ptr, recon_stride, 32, 64,
- &var, &avg, vp9_get16x16var_sse2, 16);
- *sse = var;
- return (var - (((int64_t)avg * avg) >> 11));
-}
-
-#define DECL(w, opt) \
-int vp9_sub_pixel_variance##w##xh_##opt(const uint8_t *src, \
- ptrdiff_t src_stride, \
- int x_offset, int y_offset, \
- const uint8_t *dst, \
- ptrdiff_t dst_stride, \
- int height, unsigned int *sse)
-#define DECLS(opt1, opt2) \
-DECL(4, opt2); \
-DECL(8, opt1); \
-DECL(16, opt1)
-
-DECLS(sse2, sse);
-DECLS(ssse3, ssse3);
-#undef DECLS
-#undef DECL
-
-#define FN(w, h, wf, wlog2, hlog2, opt, cast) \
-unsigned int vp9_sub_pixel_variance##w##x##h##_##opt(const uint8_t *src, \
- int src_stride, \
- int x_offset, \
- int y_offset, \
- const uint8_t *dst, \
- int dst_stride, \
- unsigned int *sse_ptr) { \
- unsigned int sse; \
- int se = vp9_sub_pixel_variance##wf##xh_##opt(src, src_stride, x_offset, \
- y_offset, dst, dst_stride, \
- h, &sse); \
- if (w > wf) { \
- unsigned int sse2; \
- int se2 = vp9_sub_pixel_variance##wf##xh_##opt(src + 16, src_stride, \
- x_offset, y_offset, \
- dst + 16, dst_stride, \
- h, &sse2); \
- se += se2; \
- sse += sse2; \
- if (w > wf * 2) { \
- se2 = vp9_sub_pixel_variance##wf##xh_##opt(src + 32, src_stride, \
- x_offset, y_offset, \
- dst + 32, dst_stride, \
- h, &sse2); \
- se += se2; \
- sse += sse2; \
- se2 = vp9_sub_pixel_variance##wf##xh_##opt(src + 48, src_stride, \
- x_offset, y_offset, \
- dst + 48, dst_stride, \
- h, &sse2); \
- se += se2; \
- sse += sse2; \
- } \
- } \
- *sse_ptr = sse; \
- return sse - ((cast se * se) >> (wlog2 + hlog2)); \
-}
-
-#define FNS(opt1, opt2) \
-FN(64, 64, 16, 6, 6, opt1, (int64_t)); \
-FN(64, 32, 16, 6, 5, opt1, (int64_t)); \
-FN(32, 64, 16, 5, 6, opt1, (int64_t)); \
-FN(32, 32, 16, 5, 5, opt1, (int64_t)); \
-FN(32, 16, 16, 5, 4, opt1, (int64_t)); \
-FN(16, 32, 16, 4, 5, opt1, (int64_t)); \
-FN(16, 16, 16, 4, 4, opt1, (unsigned int)); \
-FN(16, 8, 16, 4, 3, opt1, (unsigned int)); \
-FN(8, 16, 8, 3, 4, opt1, (unsigned int)); \
-FN(8, 8, 8, 3, 3, opt1, (unsigned int)); \
-FN(8, 4, 8, 3, 2, opt1, (unsigned int)); \
-FN(4, 8, 4, 2, 3, opt2, (unsigned int)); \
-FN(4, 4, 4, 2, 2, opt2, (unsigned int))
-
-FNS(sse2, sse);
-FNS(ssse3, ssse3);
-
-#undef FNS
-#undef FN
-
-#define DECL(w, opt) \
-int vp9_sub_pixel_avg_variance##w##xh_##opt(const uint8_t *src, \
- ptrdiff_t src_stride, \
- int x_offset, int y_offset, \
- const uint8_t *dst, \
- ptrdiff_t dst_stride, \
- const uint8_t *sec, \
- ptrdiff_t sec_stride, \
- int height, unsigned int *sse)
-#define DECLS(opt1, opt2) \
-DECL(4, opt2); \
-DECL(8, opt1); \
-DECL(16, opt1)
-
-DECLS(sse2, sse);
-DECLS(ssse3, ssse3);
-#undef DECL
-#undef DECLS
-
-#define FN(w, h, wf, wlog2, hlog2, opt, cast) \
-unsigned int vp9_sub_pixel_avg_variance##w##x##h##_##opt(const uint8_t *src, \
- int src_stride, \
- int x_offset, \
- int y_offset, \
- const uint8_t *dst, \
- int dst_stride, \
- unsigned int *sseptr, \
- const uint8_t *sec) { \
- unsigned int sse; \
- int se = vp9_sub_pixel_avg_variance##wf##xh_##opt(src, src_stride, x_offset, \
- y_offset, dst, dst_stride, \
- sec, w, h, &sse); \
- if (w > wf) { \
- unsigned int sse2; \
- int se2 = vp9_sub_pixel_avg_variance##wf##xh_##opt(src + 16, src_stride, \
- x_offset, y_offset, \
- dst + 16, dst_stride, \
- sec + 16, w, h, &sse2); \
- se += se2; \
- sse += sse2; \
- if (w > wf * 2) { \
- se2 = vp9_sub_pixel_avg_variance##wf##xh_##opt(src + 32, src_stride, \
- x_offset, y_offset, \
- dst + 32, dst_stride, \
- sec + 32, w, h, &sse2); \
- se += se2; \
- sse += sse2; \
- se2 = vp9_sub_pixel_avg_variance##wf##xh_##opt(src + 48, src_stride, \
- x_offset, y_offset, \
- dst + 48, dst_stride, \
- sec + 48, w, h, &sse2); \
- se += se2; \
- sse += sse2; \
- } \
- } \
- *sseptr = sse; \
- return sse - ((cast se * se) >> (wlog2 + hlog2)); \
-}
-
-#define FNS(opt1, opt2) \
-FN(64, 64, 16, 6, 6, opt1, (int64_t)); \
-FN(64, 32, 16, 6, 5, opt1, (int64_t)); \
-FN(32, 64, 16, 5, 6, opt1, (int64_t)); \
-FN(32, 32, 16, 5, 5, opt1, (int64_t)); \
-FN(32, 16, 16, 5, 4, opt1, (int64_t)); \
-FN(16, 32, 16, 4, 5, opt1, (int64_t)); \
-FN(16, 16, 16, 4, 4, opt1, (unsigned int)); \
-FN(16, 8, 16, 4, 3, opt1, (unsigned int)); \
-FN(8, 16, 8, 3, 4, opt1, (unsigned int)); \
-FN(8, 8, 8, 3, 3, opt1, (unsigned int)); \
-FN(8, 4, 8, 3, 2, opt1, (unsigned int)); \
-FN(4, 8, 4, 2, 3, opt2, (unsigned int)); \
-FN(4, 4, 4, 2, 2, opt2, (unsigned int))
-
-FNS(sse2, sse);
-FNS(ssse3, ssse3);
-
-#undef FNS
-#undef FN
-
-unsigned int vp9_variance_halfpixvar16x16_h_sse2(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse) {
- int xsum0;
- unsigned int xxsum0;
-
- vp9_half_horiz_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
-
-
-unsigned int vp9_variance_halfpixvar16x16_v_sse2(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse) {
- int xsum0;
- unsigned int xxsum0;
- vp9_half_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
-
-
-unsigned int vp9_variance_halfpixvar16x16_hv_sse2(
- const unsigned char *src_ptr,
- int src_pixels_per_line,
- const unsigned char *dst_ptr,
- int dst_pixels_per_line,
- unsigned int *sse) {
- int xsum0;
- unsigned int xxsum0;
-
- vp9_half_horiz_vert_variance16x_h_sse2(
- src_ptr, src_pixels_per_line,
- dst_ptr, dst_pixels_per_line, 16,
- &xsum0, &xxsum0);
-
- *sse = xxsum0;
- return (xxsum0 - (((unsigned int)xsum0 * xsum0) >> 8));
-}
diff --git a/videocodec/libvpx_internal/libvpx/vp9/exports_dec b/videocodec/libvpx_internal/libvpx/vp9/exports_dec
deleted file mode 100644
index 0a61fde..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/exports_dec
+++ /dev/null
@@ -1,2 +0,0 @@
-data vpx_codec_vp9_dx_algo
-text vpx_codec_vp9_dx
diff --git a/videocodec/libvpx_internal/libvpx/vp9/exports_enc b/videocodec/libvpx_internal/libvpx/vp9/exports_enc
deleted file mode 100644
index 2a0fef3..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/exports_enc
+++ /dev/null
@@ -1,2 +0,0 @@
-data vpx_codec_vp9_cx_algo
-text vpx_codec_vp9_cx
diff --git a/videocodec/libvpx_internal/libvpx/vp9/vp9_common.mk b/videocodec/libvpx_internal/libvpx/vp9/vp9_common.mk
deleted file mode 100644
index b1ba0b1..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/vp9_common.mk
+++ /dev/null
@@ -1,147 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-VP9_COMMON_SRCS-yes += vp9_common.mk
-VP9_COMMON_SRCS-yes += vp9_iface_common.h
-VP9_COMMON_SRCS-yes += common/vp9_pragmas.h
-VP9_COMMON_SRCS-yes += common/vp9_ppflags.h
-VP9_COMMON_SRCS-yes += common/vp9_alloccommon.c
-VP9_COMMON_SRCS-yes += common/vp9_blockd.c
-VP9_COMMON_SRCS-yes += common/vp9_convolve.c
-VP9_COMMON_SRCS-yes += common/vp9_convolve.h
-VP9_COMMON_SRCS-yes += common/vp9_debugmodes.c
-VP9_COMMON_SRCS-yes += common/vp9_entropy.c
-VP9_COMMON_SRCS-yes += common/vp9_entropymode.c
-VP9_COMMON_SRCS-yes += common/vp9_entropymv.c
-VP9_COMMON_SRCS-yes += common/vp9_filter.c
-VP9_COMMON_SRCS-yes += common/vp9_filter.h
-VP9_COMMON_SRCS-yes += common/vp9_frame_buffers.c
-VP9_COMMON_SRCS-yes += common/vp9_frame_buffers.h
-VP9_COMMON_SRCS-yes += common/vp9_idct.c
-VP9_COMMON_SRCS-yes += common/vp9_alloccommon.h
-VP9_COMMON_SRCS-yes += common/vp9_blockd.h
-VP9_COMMON_SRCS-yes += common/vp9_common.h
-VP9_COMMON_SRCS-yes += common/vp9_entropy.h
-VP9_COMMON_SRCS-yes += common/vp9_entropymode.h
-VP9_COMMON_SRCS-yes += common/vp9_entropymv.h
-VP9_COMMON_SRCS-yes += common/vp9_enums.h
-VP9_COMMON_SRCS-yes += common/vp9_idct.h
-VP9_COMMON_SRCS-yes += common/vp9_loopfilter.h
-VP9_COMMON_SRCS-yes += common/vp9_mv.h
-VP9_COMMON_SRCS-yes += common/vp9_onyxc_int.h
-VP9_COMMON_SRCS-yes += common/vp9_pred_common.h
-VP9_COMMON_SRCS-yes += common/vp9_pred_common.c
-VP9_COMMON_SRCS-yes += common/vp9_prob.h
-VP9_COMMON_SRCS-yes += common/vp9_prob.c
-VP9_COMMON_SRCS-yes += common/vp9_quant_common.h
-VP9_COMMON_SRCS-yes += common/vp9_reconinter.h
-VP9_COMMON_SRCS-yes += common/vp9_reconintra.h
-VP9_COMMON_SRCS-yes += common/vp9_rtcd.c
-VP9_COMMON_SRCS-yes += common/vp9_rtcd_defs.pl
-VP9_COMMON_SRCS-yes += common/vp9_scale.h
-VP9_COMMON_SRCS-yes += common/vp9_scale.c
-VP9_COMMON_SRCS-yes += common/vp9_seg_common.h
-VP9_COMMON_SRCS-yes += common/vp9_seg_common.c
-VP9_COMMON_SRCS-yes += common/vp9_systemdependent.h
-VP9_COMMON_SRCS-yes += common/vp9_textblit.h
-VP9_COMMON_SRCS-yes += common/vp9_tile_common.h
-VP9_COMMON_SRCS-yes += common/vp9_tile_common.c
-VP9_COMMON_SRCS-yes += common/vp9_loopfilter.c
-VP9_COMMON_SRCS-yes += common/vp9_loopfilter_filters.c
-VP9_COMMON_SRCS-yes += common/vp9_mvref_common.c
-VP9_COMMON_SRCS-yes += common/vp9_mvref_common.h
-VP9_COMMON_SRCS-yes += common/vp9_quant_common.c
-VP9_COMMON_SRCS-yes += common/vp9_reconinter.c
-VP9_COMMON_SRCS-yes += common/vp9_reconintra.c
-VP9_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER) += common/vp9_textblit.c
-VP9_COMMON_SRCS-yes += common/vp9_common_data.c
-VP9_COMMON_SRCS-yes += common/vp9_common_data.h
-VP9_COMMON_SRCS-yes += common/vp9_scan.c
-VP9_COMMON_SRCS-yes += common/vp9_scan.h
-
-VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_postproc_x86.h
-VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_asm_stubs.c
-VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/vp9_loopfilter_intrin_sse2.c
-VP9_COMMON_SRCS-$(HAVE_AVX2) += common/x86/vp9_loopfilter_intrin_avx2.c
-VP9_COMMON_SRCS-$(CONFIG_VP9_POSTPROC) += common/vp9_postproc.h
-VP9_COMMON_SRCS-$(CONFIG_VP9_POSTPROC) += common/vp9_postproc.c
-VP9_COMMON_SRCS-$(HAVE_MMX) += common/x86/vp9_loopfilter_mmx.asm
-VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_subpixel_8t_sse2.asm
-VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_subpixel_bilinear_sse2.asm
-VP9_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/vp9_subpixel_8t_ssse3.asm
-VP9_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/vp9_subpixel_bilinear_ssse3.asm
-VP9_COMMON_SRCS-$(HAVE_AVX2) += common/x86/vp9_subpixel_8t_intrin_avx2.c
-VP9_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/vp9_subpixel_8t_intrin_ssse3.c
-ifeq ($(CONFIG_VP9_POSTPROC),yes)
-VP9_COMMON_SRCS-$(HAVE_MMX) += common/x86/vp9_postproc_mmx.asm
-VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_postproc_sse2.asm
-endif
-
-ifeq ($(CONFIG_USE_X86INC),yes)
-VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_copy_sse2.asm
-VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_intrapred_sse2.asm
-VP9_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/vp9_intrapred_ssse3.asm
-endif
-
-# common (c)
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_common_dspr2.h
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve2_avg_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve2_avg_horiz_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve2_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve2_horiz_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve2_vert_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve8_avg_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve8_avg_horiz_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve8_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve8_horiz_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_convolve8_vert_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_intrapred4_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_intrapred8_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_intrapred16_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_itrans4_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_itrans8_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_itrans16_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_itrans32_cols_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_itrans32_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_loopfilter_filters_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_loopfilter_filters_dspr2.h
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_loopfilter_macros_dspr2.h
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_loopfilter_masks_dspr2.h
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_mbloop_loopfilter_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_mblpf_horiz_loopfilter_dspr2.c
-VP9_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/vp9_mblpf_vert_loopfilter_dspr2.c
-
-VP9_COMMON_SRCS-$(HAVE_SSE2) += common/x86/vp9_idct_intrin_sse2.c
-
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_convolve_neon.c
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct16x16_neon.c
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_loopfilter_16_neon.c
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_convolve8_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_convolve8_avg_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_loopfilter_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_loopfilter_16_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_dc_only_idct_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct4x4_1_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct4x4_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct8x8_1_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct8x8_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct16x16_1_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct16x16_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct32x32_1_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_idct32x32_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_iht4x4_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_iht8x8_add_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_mb_lpf_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_copy_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_avg_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_save_reg_neon$(ASM)
-VP9_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp9_reconintra_neon$(ASM)
-
-$(eval $(call rtcd_h_template,vp9_rtcd,vp9/common/vp9_rtcd_defs.pl))
diff --git a/videocodec/libvpx_internal/libvpx/vp9/vp9_cx_iface.c b/videocodec/libvpx_internal/libvpx/vp9/vp9_cx_iface.c
deleted file mode 100644
index 37a214e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/vp9_cx_iface.c
+++ /dev/null
@@ -1,1199 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "vpx/vpx_codec.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "./vpx_version.h"
-#include "vp9/encoder/vp9_onyx_int.h"
-#include "vpx/vp8cx.h"
-#include "vp9/encoder/vp9_firstpass.h"
-#include "vp9/vp9_iface_common.h"
-
-struct vp9_extracfg {
- struct vpx_codec_pkt_list *pkt_list;
- int cpu_used; // available cpu percentage in 1/16
- unsigned int enable_auto_alt_ref;
- unsigned int noise_sensitivity;
- unsigned int sharpness;
- unsigned int static_thresh;
- unsigned int tile_columns;
- unsigned int tile_rows;
- unsigned int arnr_max_frames;
- unsigned int arnr_strength;
- unsigned int arnr_type;
- vp8e_tuning tuning;
- unsigned int cq_level; // constrained quality level
- unsigned int rc_max_intra_bitrate_pct;
- unsigned int lossless;
- unsigned int frame_parallel_decoding_mode;
- AQ_MODE aq_mode;
- unsigned int frame_periodic_boost;
-};
-
-struct extraconfig_map {
- int usage;
- struct vp9_extracfg cfg;
-};
-
-static const struct extraconfig_map extracfg_map[] = {
- {
- 0,
- { // NOLINT
- NULL,
- 0, // cpu_used
- 1, // enable_auto_alt_ref
- 0, // noise_sensitivity
- 0, // sharpness
- 0, // static_thresh
- 0, // tile_columns
- 0, // tile_rows
- 7, // arnr_max_frames
- 5, // arnr_strength
- 3, // arnr_type
- VP8_TUNE_PSNR, // tuning
- 10, // cq_level
- 0, // rc_max_intra_bitrate_pct
- 0, // lossless
- 0, // frame_parallel_decoding_mode
- NO_AQ, // aq_mode
- 0, // frame_periodic_delta_q
- }
- }
-};
-
-struct vpx_codec_alg_priv {
- vpx_codec_priv_t base;
- vpx_codec_enc_cfg_t cfg;
- struct vp9_extracfg extra_cfg;
- VP9_CONFIG oxcf;
- VP9_COMP *cpi;
- unsigned char *cx_data;
- size_t cx_data_sz;
- unsigned char *pending_cx_data;
- size_t pending_cx_data_sz;
- int pending_frame_count;
- size_t pending_frame_sizes[8];
- size_t pending_frame_magnitude;
- vpx_image_t preview_img;
- vp8_postproc_cfg_t preview_ppcfg;
- vpx_codec_pkt_list_decl(64) pkt_list;
- unsigned int fixed_kf_cntr;
-};
-
-static VP9_REFFRAME ref_frame_to_vp9_reframe(vpx_ref_frame_type_t frame) {
- switch (frame) {
- case VP8_LAST_FRAME:
- return VP9_LAST_FLAG;
- case VP8_GOLD_FRAME:
- return VP9_GOLD_FLAG;
- case VP8_ALTR_FRAME:
- return VP9_ALT_FLAG;
- }
- assert(0 && "Invalid Reference Frame");
- return VP9_LAST_FLAG;
-}
-
-static vpx_codec_err_t update_error_state(vpx_codec_alg_priv_t *ctx,
- const struct vpx_internal_error_info *error) {
- const vpx_codec_err_t res = error->error_code;
-
- if (res != VPX_CODEC_OK)
- ctx->base.err_detail = error->has_detail ? error->detail : NULL;
-
- return res;
-}
-
-
-#undef ERROR
-#define ERROR(str) do {\
- ctx->base.err_detail = str;\
- return VPX_CODEC_INVALID_PARAM;\
- } while (0)
-
-#define RANGE_CHECK(p, memb, lo, hi) do {\
- if (!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \
- ERROR(#memb " out of range ["#lo".."#hi"]");\
- } while (0)
-
-#define RANGE_CHECK_HI(p, memb, hi) do {\
- if (!((p)->memb <= (hi))) \
- ERROR(#memb " out of range [.."#hi"]");\
- } while (0)
-
-#define RANGE_CHECK_LO(p, memb, lo) do {\
- if (!((p)->memb >= (lo))) \
- ERROR(#memb " out of range ["#lo"..]");\
- } while (0)
-
-#define RANGE_CHECK_BOOL(p, memb) do {\
- if (!!((p)->memb) != (p)->memb) ERROR(#memb " expected boolean");\
- } while (0)
-
-static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
- const vpx_codec_enc_cfg_t *cfg,
- const struct vp9_extracfg *extra_cfg) {
- RANGE_CHECK(cfg, g_w, 1, 65535); // 16 bits available
- RANGE_CHECK(cfg, g_h, 1, 65535); // 16 bits available
- RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000);
- RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den);
- RANGE_CHECK_HI(cfg, g_profile, 3);
-
- RANGE_CHECK_HI(cfg, rc_max_quantizer, 63);
- RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer);
- RANGE_CHECK_BOOL(extra_cfg, lossless);
- RANGE_CHECK(extra_cfg, aq_mode, 0, AQ_MODE_COUNT - 1);
- RANGE_CHECK(extra_cfg, frame_periodic_boost, 0, 1);
- RANGE_CHECK_HI(cfg, g_threads, 64);
- RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS);
- RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q);
- RANGE_CHECK_HI(cfg, rc_undershoot_pct, 1000);
- RANGE_CHECK_HI(cfg, rc_overshoot_pct, 1000);
- RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100);
- RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO);
- RANGE_CHECK_BOOL(cfg, rc_resize_allowed);
- RANGE_CHECK_HI(cfg, rc_dropframe_thresh, 100);
- RANGE_CHECK_HI(cfg, rc_resize_up_thresh, 100);
- RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100);
- RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS);
-
- RANGE_CHECK(cfg, ss_number_layers, 1, VPX_SS_MAX_LAYERS);
- RANGE_CHECK(cfg, ts_number_layers, 1, VPX_TS_MAX_LAYERS);
- if (cfg->ts_number_layers > 1) {
- unsigned int i;
- for (i = 1; i < cfg->ts_number_layers; ++i)
- if (cfg->ts_target_bitrate[i] < cfg->ts_target_bitrate[i - 1])
- ERROR("ts_target_bitrate entries are not increasing");
-
- RANGE_CHECK(cfg, ts_rate_decimator[cfg->ts_number_layers - 1], 1, 1);
- for (i = cfg->ts_number_layers - 2; i > 0; --i)
- if (cfg->ts_rate_decimator[i - 1] != 2 * cfg->ts_rate_decimator[i])
- ERROR("ts_rate_decimator factors are not powers of 2");
- }
-
- // VP8 does not support a lower bound on the keyframe interval in
- // automatic keyframe placement mode.
- if (cfg->kf_mode != VPX_KF_DISABLED &&
- cfg->kf_min_dist != cfg->kf_max_dist &&
- cfg->kf_min_dist > 0)
- ERROR("kf_min_dist not supported in auto mode, use 0 "
- "or kf_max_dist instead.");
-
- RANGE_CHECK_BOOL(extra_cfg, enable_auto_alt_ref);
- RANGE_CHECK(extra_cfg, cpu_used, -16, 16);
- RANGE_CHECK_HI(extra_cfg, noise_sensitivity, 6);
- RANGE_CHECK(extra_cfg, tile_columns, 0, 6);
- RANGE_CHECK(extra_cfg, tile_rows, 0, 2);
- RANGE_CHECK_HI(extra_cfg, sharpness, 7);
- RANGE_CHECK(extra_cfg, arnr_max_frames, 0, 15);
- RANGE_CHECK_HI(extra_cfg, arnr_strength, 6);
- RANGE_CHECK(extra_cfg, arnr_type, 1, 3);
- RANGE_CHECK(extra_cfg, cq_level, 0, 63);
-
- // TODO(yaowu): remove this when ssim tuning is implemented for vp9
- if (extra_cfg->tuning == VP8_TUNE_SSIM)
- ERROR("Option --tune=ssim is not currently supported in VP9.");
-
- if (cfg->g_pass == VPX_RC_LAST_PASS) {
- size_t packet_sz = sizeof(FIRSTPASS_STATS);
- int n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz);
- const FIRSTPASS_STATS *stats;
-
- if (cfg->rc_twopass_stats_in.buf == NULL)
- ERROR("rc_twopass_stats_in.buf not set.");
-
- if (cfg->rc_twopass_stats_in.sz % packet_sz)
- ERROR("rc_twopass_stats_in.sz indicates truncated packet.");
-
- if (cfg->ss_number_layers > 1) {
- int i;
- unsigned int n_packets_per_layer[VPX_SS_MAX_LAYERS] = {0};
-
- stats = cfg->rc_twopass_stats_in.buf;
- for (i = 0; i < n_packets; ++i) {
- const int layer_id = (int)stats[i].spatial_layer_id;
- if (layer_id >= 0 && layer_id < (int)cfg->ss_number_layers) {
- ++n_packets_per_layer[layer_id];
- }
- }
-
- for (i = 0; i < (int)cfg->ss_number_layers; ++i) {
- unsigned int layer_id;
- if (n_packets_per_layer[i] < 2) {
- ERROR("rc_twopass_stats_in requires at least two packets for each "
- "layer.");
- }
-
- stats = (const FIRSTPASS_STATS *)cfg->rc_twopass_stats_in.buf +
- n_packets - cfg->ss_number_layers + i;
- layer_id = (int)stats->spatial_layer_id;
-
- if (layer_id >= cfg->ss_number_layers
- ||(int)(stats->count + 0.5) != n_packets_per_layer[layer_id] - 1)
- ERROR("rc_twopass_stats_in missing EOS stats packet");
- }
- } else {
- if (cfg->rc_twopass_stats_in.sz < 2 * packet_sz)
- ERROR("rc_twopass_stats_in requires at least two packets.");
-
- stats =
- (const FIRSTPASS_STATS *)cfg->rc_twopass_stats_in.buf + n_packets - 1;
-
- if ((int)(stats->count + 0.5) != n_packets - 1)
- ERROR("rc_twopass_stats_in missing EOS stats packet");
- }
- }
-
- return VPX_CODEC_OK;
-}
-
-
-static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx,
- const vpx_image_t *img) {
- switch (img->fmt) {
- case VPX_IMG_FMT_YV12:
- case VPX_IMG_FMT_I420:
- case VPX_IMG_FMT_I422:
- case VPX_IMG_FMT_I444:
- break;
- default:
- ERROR("Invalid image format. Only YV12, I420, I422, I444 images are "
- "supported.");
- }
-
- if (img->d_w != ctx->cfg.g_w || img->d_h != ctx->cfg.g_h)
- ERROR("Image size must match encoder init configuration size");
-
- return VPX_CODEC_OK;
-}
-
-
-static vpx_codec_err_t set_vp9e_config(VP9_CONFIG *oxcf,
- const vpx_codec_enc_cfg_t *cfg,
- const struct vp9_extracfg *extra_cfg) {
- oxcf->version = cfg->g_profile;
- oxcf->width = cfg->g_w;
- oxcf->height = cfg->g_h;
- // guess a frame rate if out of whack, use 30
- oxcf->framerate = (double)cfg->g_timebase.den / cfg->g_timebase.num;
- if (oxcf->framerate > 180)
- oxcf->framerate = 30;
-
- switch (cfg->g_pass) {
- case VPX_RC_ONE_PASS:
- oxcf->mode = MODE_GOODQUALITY;
- break;
- case VPX_RC_FIRST_PASS:
- oxcf->mode = MODE_FIRSTPASS;
- break;
- case VPX_RC_LAST_PASS:
- oxcf->mode = MODE_SECONDPASS_BEST;
- break;
- }
-
- oxcf->lag_in_frames = cfg->g_pass == VPX_RC_FIRST_PASS ? 0
- : cfg->g_lag_in_frames;
-
- oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK;
- if (cfg->rc_end_usage == VPX_CQ)
- oxcf->end_usage = USAGE_CONSTRAINED_QUALITY;
- else if (cfg->rc_end_usage == VPX_Q)
- oxcf->end_usage = USAGE_CONSTANT_QUALITY;
- else if (cfg->rc_end_usage == VPX_CBR)
- oxcf->end_usage = USAGE_STREAM_FROM_SERVER;
-
- oxcf->target_bandwidth = cfg->rc_target_bitrate;
- oxcf->rc_max_intra_bitrate_pct = extra_cfg->rc_max_intra_bitrate_pct;
-
- oxcf->best_allowed_q = cfg->rc_min_quantizer;
- oxcf->worst_allowed_q = cfg->rc_max_quantizer;
- oxcf->cq_level = extra_cfg->cq_level;
- oxcf->fixed_q = -1;
-
- oxcf->under_shoot_pct = cfg->rc_undershoot_pct;
- oxcf->over_shoot_pct = cfg->rc_overshoot_pct;
-
- oxcf->maximum_buffer_size = cfg->rc_buf_sz;
- oxcf->starting_buffer_level = cfg->rc_buf_initial_sz;
- oxcf->optimal_buffer_level = cfg->rc_buf_optimal_sz;
-
- oxcf->drop_frames_water_mark = cfg->rc_dropframe_thresh;
-
- oxcf->two_pass_vbrbias = cfg->rc_2pass_vbr_bias_pct;
- oxcf->two_pass_vbrmin_section = cfg->rc_2pass_vbr_minsection_pct;
- oxcf->two_pass_vbrmax_section = cfg->rc_2pass_vbr_maxsection_pct;
-
- oxcf->auto_key = cfg->kf_mode == VPX_KF_AUTO &&
- cfg->kf_min_dist != cfg->kf_max_dist;
-
- oxcf->key_freq = cfg->kf_max_dist;
-
- oxcf->cpu_used = extra_cfg->cpu_used;
- oxcf->encode_breakout = extra_cfg->static_thresh;
- oxcf->play_alternate = extra_cfg->enable_auto_alt_ref;
- oxcf->noise_sensitivity = extra_cfg->noise_sensitivity;
- oxcf->sharpness = extra_cfg->sharpness;
-
- oxcf->two_pass_stats_in = cfg->rc_twopass_stats_in;
- oxcf->output_pkt_list = extra_cfg->pkt_list;
-
- oxcf->arnr_max_frames = extra_cfg->arnr_max_frames;
- oxcf->arnr_strength = extra_cfg->arnr_strength;
- oxcf->arnr_type = extra_cfg->arnr_type;
-
- oxcf->tuning = extra_cfg->tuning;
-
- oxcf->tile_columns = extra_cfg->tile_columns;
- oxcf->tile_rows = extra_cfg->tile_rows;
-
- oxcf->lossless = extra_cfg->lossless;
-
- oxcf->error_resilient_mode = cfg->g_error_resilient;
- oxcf->frame_parallel_decoding_mode = extra_cfg->frame_parallel_decoding_mode;
-
- oxcf->aq_mode = extra_cfg->aq_mode;
-
- oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost;
-
- oxcf->ss_number_layers = cfg->ss_number_layers;
-
- if (oxcf->ss_number_layers > 1) {
- vp9_copy(oxcf->ss_target_bitrate, cfg->ss_target_bitrate);
- } else if (oxcf->ss_number_layers == 1) {
- oxcf->ss_target_bitrate[0] = (int)oxcf->target_bandwidth;
- }
-
- oxcf->ts_number_layers = cfg->ts_number_layers;
-
- if (oxcf->ts_number_layers > 1) {
- vp9_copy(oxcf->ts_target_bitrate, cfg->ts_target_bitrate);
- vp9_copy(oxcf->ts_rate_decimator, cfg->ts_rate_decimator);
- } else if (oxcf->ts_number_layers == 1) {
- oxcf->ts_target_bitrate[0] = (int)oxcf->target_bandwidth;
- oxcf->ts_rate_decimator[0] = 1;
- }
-
- /*
- printf("Current VP9 Settings: \n");
- printf("target_bandwidth: %d\n", oxcf->target_bandwidth);
- printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity);
- printf("sharpness: %d\n", oxcf->sharpness);
- printf("cpu_used: %d\n", oxcf->cpu_used);
- printf("Mode: %d\n", oxcf->mode);
- printf("auto_key: %d\n", oxcf->auto_key);
- printf("key_freq: %d\n", oxcf->key_freq);
- printf("end_usage: %d\n", oxcf->end_usage);
- printf("under_shoot_pct: %d\n", oxcf->under_shoot_pct);
- printf("over_shoot_pct: %d\n", oxcf->over_shoot_pct);
- printf("starting_buffer_level: %d\n", oxcf->starting_buffer_level);
- printf("optimal_buffer_level: %d\n", oxcf->optimal_buffer_level);
- printf("maximum_buffer_size: %d\n", oxcf->maximum_buffer_size);
- printf("fixed_q: %d\n", oxcf->fixed_q);
- printf("worst_allowed_q: %d\n", oxcf->worst_allowed_q);
- printf("best_allowed_q: %d\n", oxcf->best_allowed_q);
- printf("two_pass_vbrbias: %d\n", oxcf->two_pass_vbrbias);
- printf("two_pass_vbrmin_section: %d\n", oxcf->two_pass_vbrmin_section);
- printf("two_pass_vbrmax_section: %d\n", oxcf->two_pass_vbrmax_section);
- printf("lag_in_frames: %d\n", oxcf->lag_in_frames);
- printf("play_alternate: %d\n", oxcf->play_alternate);
- printf("Version: %d\n", oxcf->Version);
- printf("encode_breakout: %d\n", oxcf->encode_breakout);
- printf("error resilient: %d\n", oxcf->error_resilient_mode);
- printf("frame parallel detokenization: %d\n",
- oxcf->frame_parallel_decoding_mode);
- */
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9e_set_config(vpx_codec_alg_priv_t *ctx,
- const vpx_codec_enc_cfg_t *cfg) {
- vpx_codec_err_t res;
-
- if (cfg->g_w != ctx->cfg.g_w || cfg->g_h != ctx->cfg.g_h)
- ERROR("Cannot change width or height after initialization");
-
- // Prevent increasing lag_in_frames. This check is stricter than it needs
- // to be -- the limit is not increasing past the first lag_in_frames
- // value, but we don't track the initial config, only the last successful
- // config.
- if (cfg->g_lag_in_frames > ctx->cfg.g_lag_in_frames)
- ERROR("Cannot increase lag_in_frames");
-
- res = validate_config(ctx, cfg, &ctx->extra_cfg);
-
- if (res == VPX_CODEC_OK) {
- ctx->cfg = *cfg;
- set_vp9e_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg);
- vp9_change_config(ctx->cpi, &ctx->oxcf);
- }
-
- return res;
-}
-
-
-int vp9_reverse_trans(int q);
-
-
-static vpx_codec_err_t get_param(vpx_codec_alg_priv_t *ctx, int ctrl_id,
- va_list args) {
- void *arg = va_arg(args, void *);
-
-#define MAP(id, var) case id: *(RECAST(id, arg)) = var; break
-
- if (arg == NULL)
- return VPX_CODEC_INVALID_PARAM;
-
- switch (ctrl_id) {
- MAP(VP8E_GET_LAST_QUANTIZER, vp9_get_quantizer(ctx->cpi));
- MAP(VP8E_GET_LAST_QUANTIZER_64,
- vp9_reverse_trans(vp9_get_quantizer(ctx->cpi)));
- }
-
- return VPX_CODEC_OK;
-#undef MAP
-}
-
-
-static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx, int ctrl_id,
- va_list args) {
- vpx_codec_err_t res = VPX_CODEC_OK;
- struct vp9_extracfg extra_cfg = ctx->extra_cfg;
-
-#define MAP(id, var) case id: var = CAST(id, args); break;
-
- switch (ctrl_id) {
- MAP(VP8E_SET_CPUUSED, extra_cfg.cpu_used);
- MAP(VP8E_SET_ENABLEAUTOALTREF, extra_cfg.enable_auto_alt_ref);
- MAP(VP8E_SET_NOISE_SENSITIVITY, extra_cfg.noise_sensitivity);
- MAP(VP8E_SET_SHARPNESS, extra_cfg.sharpness);
- MAP(VP8E_SET_STATIC_THRESHOLD, extra_cfg.static_thresh);
- MAP(VP9E_SET_TILE_COLUMNS, extra_cfg.tile_columns);
- MAP(VP9E_SET_TILE_ROWS, extra_cfg.tile_rows);
- MAP(VP8E_SET_ARNR_MAXFRAMES, extra_cfg.arnr_max_frames);
- MAP(VP8E_SET_ARNR_STRENGTH, extra_cfg.arnr_strength);
- MAP(VP8E_SET_ARNR_TYPE, extra_cfg.arnr_type);
- MAP(VP8E_SET_TUNING, extra_cfg.tuning);
- MAP(VP8E_SET_CQ_LEVEL, extra_cfg.cq_level);
- MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, extra_cfg.rc_max_intra_bitrate_pct);
- MAP(VP9E_SET_LOSSLESS, extra_cfg.lossless);
- MAP(VP9E_SET_FRAME_PARALLEL_DECODING,
- extra_cfg.frame_parallel_decoding_mode);
- MAP(VP9E_SET_AQ_MODE, extra_cfg.aq_mode);
- MAP(VP9E_SET_FRAME_PERIODIC_BOOST, extra_cfg.frame_periodic_boost);
- }
-
- res = validate_config(ctx, &ctx->cfg, &extra_cfg);
-
- if (res == VPX_CODEC_OK) {
- ctx->extra_cfg = extra_cfg;
- set_vp9e_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg);
- vp9_change_config(ctx->cpi, &ctx->oxcf);
- }
-
- return res;
-#undef MAP
-}
-
-
-static vpx_codec_err_t vp9e_common_init(vpx_codec_ctx_t *ctx) {
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if (ctx->priv == NULL) {
- int i;
- vpx_codec_enc_cfg_t *cfg;
- struct vpx_codec_alg_priv *priv = calloc(1, sizeof(*priv));
-
- if (priv == NULL) return VPX_CODEC_MEM_ERROR;
-
- ctx->priv = &priv->base;
- ctx->priv->sz = sizeof(*ctx->priv);
- ctx->priv->iface = ctx->iface;
- ctx->priv->alg_priv = priv;
- ctx->priv->init_flags = ctx->init_flags;
- ctx->priv->enc.total_encoders = 1;
-
- if (ctx->config.enc) {
- // Update the reference to the config structure to an
- // internal copy.
- ctx->priv->alg_priv->cfg = *ctx->config.enc;
- ctx->config.enc = &ctx->priv->alg_priv->cfg;
- }
-
- cfg = &ctx->priv->alg_priv->cfg;
-
- // Select the extra vp6 configuration table based on the current
- // usage value. If the current usage value isn't found, use the
- // values for usage case 0.
- for (i = 0;
- extracfg_map[i].usage && extracfg_map[i].usage != cfg->g_usage;
- ++i) {}
-
- priv->extra_cfg = extracfg_map[i].cfg;
- priv->extra_cfg.pkt_list = &priv->pkt_list.head;
-
- // Maximum buffer size approximated based on having multiple ARF.
- priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 8;
-
- if (priv->cx_data_sz < 4096) priv->cx_data_sz = 4096;
-
- priv->cx_data = (unsigned char *)malloc(priv->cx_data_sz);
- if (priv->cx_data == NULL)
- return VPX_CODEC_MEM_ERROR;
-
- vp9_initialize_enc();
-
- res = validate_config(priv, &priv->cfg, &priv->extra_cfg);
-
- if (res == VPX_CODEC_OK) {
- VP9_COMP *cpi;
- set_vp9e_config(&ctx->priv->alg_priv->oxcf,
- &ctx->priv->alg_priv->cfg,
- &ctx->priv->alg_priv->extra_cfg);
- cpi = vp9_create_compressor(&ctx->priv->alg_priv->oxcf);
- if (cpi == NULL)
- res = VPX_CODEC_MEM_ERROR;
- else
- ctx->priv->alg_priv->cpi = cpi;
- }
- }
-
- return res;
-}
-
-
-static vpx_codec_err_t vp9e_init(vpx_codec_ctx_t *ctx,
- vpx_codec_priv_enc_mr_cfg_t *data) {
- return vp9e_common_init(ctx);
-}
-
-static vpx_codec_err_t vp9e_destroy(vpx_codec_alg_priv_t *ctx) {
- free(ctx->cx_data);
- vp9_remove_compressor(ctx->cpi);
- free(ctx);
- return VPX_CODEC_OK;
-}
-
-static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
- unsigned long duration,
- unsigned long deadline) {
- // Use best quality mode if no deadline is given.
- MODE new_qc = MODE_BESTQUALITY;
-
- if (deadline) {
- // Convert duration parameter from stream timebase to microseconds
- const uint64_t duration_us = (uint64_t)duration * 1000000 *
- (uint64_t)ctx->cfg.g_timebase.num /
- (uint64_t)ctx->cfg.g_timebase.den;
-
- // If the deadline is more that the duration this frame is to be shown,
- // use good quality mode. Otherwise use realtime mode.
- new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
- }
-
- if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
- new_qc = MODE_FIRSTPASS;
- else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
- new_qc = (new_qc == MODE_BESTQUALITY) ? MODE_SECONDPASS_BEST
- : MODE_SECONDPASS;
-
- if (ctx->oxcf.mode != new_qc) {
- ctx->oxcf.mode = new_qc;
- vp9_change_config(ctx->cpi, &ctx->oxcf);
- }
-}
-
-
-static int write_superframe_index(vpx_codec_alg_priv_t *ctx) {
- uint8_t marker = 0xc0;
- unsigned int mask;
- int mag, index_sz;
-
- assert(ctx->pending_frame_count);
- assert(ctx->pending_frame_count <= 8);
-
- // Add the number of frames to the marker byte
- marker |= ctx->pending_frame_count - 1;
-
- // Choose the magnitude
- for (mag = 0, mask = 0xff; mag < 4; mag++) {
- if (ctx->pending_frame_magnitude < mask)
- break;
- mask <<= 8;
- mask |= 0xff;
- }
- marker |= mag << 3;
-
- // Write the index
- index_sz = 2 + (mag + 1) * ctx->pending_frame_count;
- if (ctx->pending_cx_data_sz + index_sz < ctx->cx_data_sz) {
- uint8_t *x = ctx->pending_cx_data + ctx->pending_cx_data_sz;
- int i, j;
-
- *x++ = marker;
- for (i = 0; i < ctx->pending_frame_count; i++) {
- unsigned int this_sz = (unsigned int)ctx->pending_frame_sizes[i];
-
- for (j = 0; j <= mag; j++) {
- *x++ = this_sz & 0xff;
- this_sz >>= 8;
- }
- }
- *x++ = marker;
- ctx->pending_cx_data_sz += index_sz;
- }
- return index_sz;
-}
-
-static vpx_codec_err_t vp9e_encode(vpx_codec_alg_priv_t *ctx,
- const vpx_image_t *img,
- vpx_codec_pts_t pts,
- unsigned long duration,
- vpx_enc_frame_flags_t flags,
- unsigned long deadline) {
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if (img)
- res = validate_img(ctx, img);
-
- pick_quickcompress_mode(ctx, duration, deadline);
- vpx_codec_pkt_list_init(&ctx->pkt_list);
-
- // Handle Flags
- if (((flags & VP8_EFLAG_NO_UPD_GF) && (flags & VP8_EFLAG_FORCE_GF)) ||
- ((flags & VP8_EFLAG_NO_UPD_ARF) && (flags & VP8_EFLAG_FORCE_ARF))) {
- ctx->base.err_detail = "Conflicting flags.";
- return VPX_CODEC_INVALID_PARAM;
- }
-
- if (flags & (VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF |
- VP8_EFLAG_NO_REF_ARF)) {
- int ref = 7;
-
- if (flags & VP8_EFLAG_NO_REF_LAST)
- ref ^= VP9_LAST_FLAG;
-
- if (flags & VP8_EFLAG_NO_REF_GF)
- ref ^= VP9_GOLD_FLAG;
-
- if (flags & VP8_EFLAG_NO_REF_ARF)
- ref ^= VP9_ALT_FLAG;
-
- vp9_use_as_reference(ctx->cpi, ref);
- }
-
- if (flags & (VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
- VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_FORCE_GF |
- VP8_EFLAG_FORCE_ARF)) {
- int upd = 7;
-
- if (flags & VP8_EFLAG_NO_UPD_LAST)
- upd ^= VP9_LAST_FLAG;
-
- if (flags & VP8_EFLAG_NO_UPD_GF)
- upd ^= VP9_GOLD_FLAG;
-
- if (flags & VP8_EFLAG_NO_UPD_ARF)
- upd ^= VP9_ALT_FLAG;
-
- vp9_update_reference(ctx->cpi, upd);
- }
-
- if (flags & VP8_EFLAG_NO_UPD_ENTROPY) {
- vp9_update_entropy(ctx->cpi, 0);
- }
-
- // Handle fixed keyframe intervals
- if (ctx->cfg.kf_mode == VPX_KF_AUTO &&
- ctx->cfg.kf_min_dist == ctx->cfg.kf_max_dist) {
- if (++ctx->fixed_kf_cntr > ctx->cfg.kf_min_dist) {
- flags |= VPX_EFLAG_FORCE_KF;
- ctx->fixed_kf_cntr = 1;
- }
- }
-
- // Initialize the encoder instance on the first frame.
- if (res == VPX_CODEC_OK && ctx->cpi != NULL) {
- unsigned int lib_flags;
- YV12_BUFFER_CONFIG sd;
- int64_t dst_time_stamp, dst_end_time_stamp;
- size_t size, cx_data_sz;
- unsigned char *cx_data;
-
- // Set up internal flags
- if (ctx->base.init_flags & VPX_CODEC_USE_PSNR)
- ((VP9_COMP *)ctx->cpi)->b_calculate_psnr = 1;
-
- // Convert API flags to internal codec lib flags
- lib_flags = (flags & VPX_EFLAG_FORCE_KF) ? FRAMEFLAGS_KEY : 0;
-
- /* vp9 use 10,000,000 ticks/second as time stamp */
- dst_time_stamp = (pts * 10000000 * ctx->cfg.g_timebase.num)
- / ctx->cfg.g_timebase.den;
- dst_end_time_stamp = (pts + duration) * 10000000 * ctx->cfg.g_timebase.num /
- ctx->cfg.g_timebase.den;
-
- if (img != NULL) {
- res = image2yuvconfig(img, &sd);
-
- if (vp9_receive_raw_frame(ctx->cpi, lib_flags,
- &sd, dst_time_stamp, dst_end_time_stamp)) {
- VP9_COMP *cpi = (VP9_COMP *)ctx->cpi;
- res = update_error_state(ctx, &cpi->common.error);
- }
- }
-
- cx_data = ctx->cx_data;
- cx_data_sz = ctx->cx_data_sz;
- lib_flags = 0;
-
- /* Any pending invisible frames? */
- if (ctx->pending_cx_data) {
- memmove(cx_data, ctx->pending_cx_data, ctx->pending_cx_data_sz);
- ctx->pending_cx_data = cx_data;
- cx_data += ctx->pending_cx_data_sz;
- cx_data_sz -= ctx->pending_cx_data_sz;
-
- /* TODO: this is a minimal check, the underlying codec doesn't respect
- * the buffer size anyway.
- */
- if (cx_data_sz < ctx->cx_data_sz / 2) {
- ctx->base.err_detail = "Compressed data buffer too small";
- return VPX_CODEC_ERROR;
- }
- }
-
- while (cx_data_sz >= ctx->cx_data_sz / 2 &&
- -1 != vp9_get_compressed_data(ctx->cpi, &lib_flags, &size,
- cx_data, &dst_time_stamp,
- &dst_end_time_stamp, !img)) {
- if (size) {
- vpx_codec_pts_t round, delta;
- vpx_codec_cx_pkt_t pkt;
- VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi;
-
- // Pack invisible frames with the next visible frame
- if (cpi->common.show_frame == 0) {
- if (ctx->pending_cx_data == 0)
- ctx->pending_cx_data = cx_data;
- ctx->pending_cx_data_sz += size;
- ctx->pending_frame_sizes[ctx->pending_frame_count++] = size;
- ctx->pending_frame_magnitude |= size;
- cx_data += size;
- cx_data_sz -= size;
- continue;
- }
-
- // Add the frame packet to the list of returned packets.
- round = (vpx_codec_pts_t)1000000 * ctx->cfg.g_timebase.num / 2 - 1;
- delta = (dst_end_time_stamp - dst_time_stamp);
- pkt.kind = VPX_CODEC_CX_FRAME_PKT;
- pkt.data.frame.pts =
- (dst_time_stamp * ctx->cfg.g_timebase.den + round)
- / ctx->cfg.g_timebase.num / 10000000;
- pkt.data.frame.duration = (unsigned long)
- ((delta * ctx->cfg.g_timebase.den + round)
- / ctx->cfg.g_timebase.num / 10000000);
- pkt.data.frame.flags = lib_flags << 16;
-
- if (lib_flags & FRAMEFLAGS_KEY)
- pkt.data.frame.flags |= VPX_FRAME_IS_KEY;
-
- if (cpi->common.show_frame == 0) {
- pkt.data.frame.flags |= VPX_FRAME_IS_INVISIBLE;
-
- // This timestamp should be as close as possible to the
- // prior PTS so that if a decoder uses pts to schedule when
- // to do this, we start right after last frame was decoded.
- // Invisible frames have no duration.
- pkt.data.frame.pts = ((cpi->last_time_stamp_seen
- * ctx->cfg.g_timebase.den + round)
- / ctx->cfg.g_timebase.num / 10000000) + 1;
- pkt.data.frame.duration = 0;
- }
-
- if (cpi->droppable)
- pkt.data.frame.flags |= VPX_FRAME_IS_DROPPABLE;
-
- if (ctx->pending_cx_data) {
- ctx->pending_frame_sizes[ctx->pending_frame_count++] = size;
- ctx->pending_frame_magnitude |= size;
- ctx->pending_cx_data_sz += size;
- size += write_superframe_index(ctx);
- pkt.data.frame.buf = ctx->pending_cx_data;
- pkt.data.frame.sz = ctx->pending_cx_data_sz;
- ctx->pending_cx_data = NULL;
- ctx->pending_cx_data_sz = 0;
- ctx->pending_frame_count = 0;
- ctx->pending_frame_magnitude = 0;
- } else {
- pkt.data.frame.buf = cx_data;
- pkt.data.frame.sz = size;
- }
- pkt.data.frame.partition_id = -1;
- vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
- cx_data += size;
- cx_data_sz -= size;
- }
- }
- }
-
- return res;
-}
-
-
-static const vpx_codec_cx_pkt_t *vp9e_get_cxdata(vpx_codec_alg_priv_t *ctx,
- vpx_codec_iter_t *iter) {
- return vpx_codec_pkt_list_get(&ctx->pkt_list.head, iter);
-}
-
-static vpx_codec_err_t vp9e_set_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- vpx_ref_frame_t *const frame = va_arg(args, vpx_ref_frame_t *);
-
- if (frame != NULL) {
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
- vp9_set_reference_enc(ctx->cpi, ref_frame_to_vp9_reframe(frame->frame_type),
- &sd);
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t vp9e_copy_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- vpx_ref_frame_t *const frame = va_arg(args, vpx_ref_frame_t *);
-
- if (frame != NULL) {
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
- vp9_copy_reference_enc(ctx->cpi,
- ref_frame_to_vp9_reframe(frame->frame_type), &sd);
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t get_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- vp9_ref_frame_t *frame = va_arg(args, vp9_ref_frame_t *);
-
- if (frame != NULL) {
- YV12_BUFFER_CONFIG* fb;
-
- vp9_get_reference_enc(ctx->cpi, frame->idx, &fb);
- yuvconfig2image(&frame->img, fb, NULL);
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t vp9e_set_previewpp(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
-#if CONFIG_VP9_POSTPROC
- vp8_postproc_cfg_t *config = va_arg(args, vp8_postproc_cfg_t *);
- (void)ctr_id;
-
- if (config != NULL) {
- ctx->preview_ppcfg = *config;
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-#else
- (void)ctx;
- (void)ctr_id;
- (void)args;
- return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-
-static vpx_image_t *vp9e_get_preview(vpx_codec_alg_priv_t *ctx) {
- YV12_BUFFER_CONFIG sd;
- vp9_ppflags_t flags = {0};
-
- if (ctx->preview_ppcfg.post_proc_flag) {
- flags.post_proc_flag = ctx->preview_ppcfg.post_proc_flag;
- flags.deblocking_level = ctx->preview_ppcfg.deblocking_level;
- flags.noise_level = ctx->preview_ppcfg.noise_level;
- }
-
- if (vp9_get_preview_raw_frame(ctx->cpi, &sd, &flags) == 0) {
- yuvconfig2image(&ctx->preview_img, &sd, NULL);
- return &ctx->preview_img;
- } else {
- return NULL;
- }
-}
-
-static vpx_codec_err_t vp9e_update_entropy(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- const int update = va_arg(args, int);
- vp9_update_entropy(ctx->cpi, update);
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9e_update_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- const int ref_frame_flags = va_arg(args, int);
- vp9_update_reference(ctx->cpi, ref_frame_flags);
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9e_use_reference(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- const int reference_flag = va_arg(args, int);
- vp9_use_as_reference(ctx->cpi, reference_flag);
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9e_set_roi_map(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- // TODO(yaowu): Need to re-implement and test for VP9.
- return VPX_CODEC_INVALID_PARAM;
-}
-
-
-static vpx_codec_err_t vp9e_set_activemap(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- vpx_active_map_t *const map = va_arg(args, vpx_active_map_t *);
-
- if (map) {
- if (!vp9_set_active_map(ctx->cpi, map->active_map, map->rows, map->cols))
- return VPX_CODEC_OK;
- else
- return VPX_CODEC_INVALID_PARAM;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t vp9e_set_scalemode(vpx_codec_alg_priv_t *ctx,
- int ctr_id, va_list args) {
- vpx_scaling_mode_t *const mode = va_arg(args, vpx_scaling_mode_t *);
-
- if (mode) {
- const int res = vp9_set_internal_size(ctx->cpi,
- (VPX_SCALING)mode->h_scaling_mode,
- (VPX_SCALING)mode->v_scaling_mode);
- return (res == 0) ? VPX_CODEC_OK : VPX_CODEC_INVALID_PARAM;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t vp9e_set_svc(vpx_codec_alg_priv_t *ctx, int ctr_id,
- va_list args) {
- int data = va_arg(args, int);
- const vpx_codec_enc_cfg_t *cfg = &ctx->cfg;
- vp9_set_svc(ctx->cpi, data);
- // CBR or two pass mode for SVC with both temporal and spatial layers
- // not yet supported.
- if (data == 1 &&
- (cfg->rc_end_usage == VPX_CBR ||
- cfg->g_pass == VPX_RC_FIRST_PASS ||
- cfg->g_pass == VPX_RC_LAST_PASS) &&
- cfg->ss_number_layers > 1 &&
- cfg->ts_number_layers > 1) {
- return VPX_CODEC_INVALID_PARAM;
- }
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9e_set_svc_layer_id(vpx_codec_alg_priv_t *ctx,
- int ctr_id,
- va_list args) {
- vpx_svc_layer_id_t *const data = va_arg(args, vpx_svc_layer_id_t *);
- VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi;
- SVC *const svc = &cpi->svc;
- svc->spatial_layer_id = data->spatial_layer_id;
- svc->temporal_layer_id = data->temporal_layer_id;
- // Checks on valid layer_id input.
- if (svc->temporal_layer_id < 0 ||
- svc->temporal_layer_id >= (int)ctx->cfg.ts_number_layers) {
- return VPX_CODEC_INVALID_PARAM;
- }
- if (svc->spatial_layer_id < 0 ||
- svc->spatial_layer_id >= (int)ctx->cfg.ss_number_layers) {
- return VPX_CODEC_INVALID_PARAM;
- }
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9e_set_svc_parameters(vpx_codec_alg_priv_t *ctx,
- int ctr_id, va_list args) {
- VP9_COMP *const cpi = ctx->cpi;
- vpx_svc_parameters_t *const params = va_arg(args, vpx_svc_parameters_t *);
-
- if (params == NULL)
- return VPX_CODEC_INVALID_PARAM;
-
- cpi->svc.spatial_layer_id = params->spatial_layer;
- cpi->svc.temporal_layer_id = params->temporal_layer;
-
- cpi->lst_fb_idx = params->lst_fb_idx;
- cpi->gld_fb_idx = params->gld_fb_idx;
- cpi->alt_fb_idx = params->alt_fb_idx;
-
- if (vp9_set_size_literal(ctx->cpi, params->width, params->height) != 0)
- return VPX_CODEC_INVALID_PARAM;
-
- ctx->cfg.rc_max_quantizer = params->max_quantizer;
- ctx->cfg.rc_min_quantizer = params->min_quantizer;
-
- set_vp9e_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg);
- vp9_change_config(ctx->cpi, &ctx->oxcf);
-
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_ctrl_fn_map_t vp9e_ctf_maps[] = {
- {VP8_SET_REFERENCE, vp9e_set_reference},
- {VP8_COPY_REFERENCE, vp9e_copy_reference},
- {VP8_SET_POSTPROC, vp9e_set_previewpp},
- {VP8E_UPD_ENTROPY, vp9e_update_entropy},
- {VP8E_UPD_REFERENCE, vp9e_update_reference},
- {VP8E_USE_REFERENCE, vp9e_use_reference},
- {VP8E_SET_ROI_MAP, vp9e_set_roi_map},
- {VP8E_SET_ACTIVEMAP, vp9e_set_activemap},
- {VP8E_SET_SCALEMODE, vp9e_set_scalemode},
- {VP8E_SET_CPUUSED, set_param},
- {VP8E_SET_NOISE_SENSITIVITY, set_param},
- {VP8E_SET_ENABLEAUTOALTREF, set_param},
- {VP8E_SET_SHARPNESS, set_param},
- {VP8E_SET_STATIC_THRESHOLD, set_param},
- {VP9E_SET_TILE_COLUMNS, set_param},
- {VP9E_SET_TILE_ROWS, set_param},
- {VP8E_GET_LAST_QUANTIZER, get_param},
- {VP8E_GET_LAST_QUANTIZER_64, get_param},
- {VP8E_SET_ARNR_MAXFRAMES, set_param},
- {VP8E_SET_ARNR_STRENGTH, set_param},
- {VP8E_SET_ARNR_TYPE, set_param},
- {VP8E_SET_TUNING, set_param},
- {VP8E_SET_CQ_LEVEL, set_param},
- {VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param},
- {VP9E_SET_LOSSLESS, set_param},
- {VP9E_SET_FRAME_PARALLEL_DECODING, set_param},
- {VP9E_SET_AQ_MODE, set_param},
- {VP9E_SET_FRAME_PERIODIC_BOOST, set_param},
- {VP9_GET_REFERENCE, get_reference},
- {VP9E_SET_SVC, vp9e_set_svc},
- {VP9E_SET_SVC_PARAMETERS, vp9e_set_svc_parameters},
- {VP9E_SET_SVC_LAYER_ID, vp9e_set_svc_layer_id},
- { -1, NULL},
-};
-
-static vpx_codec_enc_cfg_map_t vp9e_usage_cfg_map[] = {
- {
- 0,
- { // NOLINT
- 0, /* g_usage */
- 0, /* g_threads */
- 0, /* g_profile */
-
- 320, /* g_width */
- 240, /* g_height */
- {1, 30}, /* g_timebase */
-
- 0, /* g_error_resilient */
-
- VPX_RC_ONE_PASS, /* g_pass */
-
- 25, /* g_lag_in_frames */
-
- 0, /* rc_dropframe_thresh */
- 0, /* rc_resize_allowed */
- 60, /* rc_resize_down_thresold */
- 30, /* rc_resize_up_thresold */
-
- VPX_VBR, /* rc_end_usage */
-#if VPX_ENCODER_ABI_VERSION > (1 + VPX_CODEC_ABI_VERSION)
- {0}, /* rc_twopass_stats_in */
-#endif
- 256, /* rc_target_bandwidth */
- 0, /* rc_min_quantizer */
- 63, /* rc_max_quantizer */
- 100, /* rc_undershoot_pct */
- 100, /* rc_overshoot_pct */
-
- 6000, /* rc_max_buffer_size */
- 4000, /* rc_buffer_initial_size; */
- 5000, /* rc_buffer_optimal_size; */
-
- 50, /* rc_two_pass_vbrbias */
- 0, /* rc_two_pass_vbrmin_section */
- 2000, /* rc_two_pass_vbrmax_section */
-
- /* keyframing settings (kf) */
- VPX_KF_AUTO, /* g_kfmode*/
- 0, /* kf_min_dist */
- 9999, /* kf_max_dist */
-
- VPX_SS_DEFAULT_LAYERS, /* ss_number_layers */
- {0}, /* ss_target_bitrate */
- 1, /* ts_number_layers */
- {0}, /* ts_target_bitrate */
- {0}, /* ts_rate_decimator */
- 0, /* ts_periodicity */
- {0}, /* ts_layer_id */
-#if VPX_ENCODER_ABI_VERSION == (1 + VPX_CODEC_ABI_VERSION)
- "vp8.fpf" /* first pass filename */
-#endif
- }
- },
- { -1, {NOT_IMPLEMENTED}}
-};
-
-
-#ifndef VERSION_STRING
-#define VERSION_STRING
-#endif
-CODEC_INTERFACE(vpx_codec_vp9_cx) = {
- "WebM Project VP9 Encoder" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR,
- /* vpx_codec_caps_t caps; */
- vp9e_init, /* vpx_codec_init_fn_t init; */
- vp9e_destroy, /* vpx_codec_destroy_fn_t destroy; */
- vp9e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
- NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
- NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
- { // NOLINT
- NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */
- NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */
- NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */
- NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */
- },
- { // NOLINT
- vp9e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */
- vp9e_encode, /* vpx_codec_encode_fn_t encode; */
- vp9e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */
- vp9e_set_config,
- NOT_IMPLEMENTED,
- vp9e_get_preview,
- } /* encoder functions */
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp9/vp9_dx_iface.c b/videocodec/libvpx_internal/libvpx/vp9/vp9_dx_iface.c
deleted file mode 100644
index 16c992e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/vp9_dx_iface.c
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include "vpx/vpx_decoder.h"
-#include "vpx/vp8dx.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "./vpx_version.h"
-#include "vp9/common/vp9_frame_buffers.h"
-#include "vp9/decoder/vp9_decoder.h"
-#include "vp9/decoder/vp9_read_bit_buffer.h"
-#include "vp9/vp9_iface_common.h"
-
-#define VP9_CAP_POSTPROC (CONFIG_VP9_POSTPROC ? VPX_CODEC_CAP_POSTPROC : 0)
-typedef vpx_codec_stream_info_t vp9_stream_info_t;
-
-struct vpx_codec_alg_priv {
- vpx_codec_priv_t base;
- vpx_codec_dec_cfg_t cfg;
- vp9_stream_info_t si;
- int decoder_init;
- struct VP9Decompressor *pbi;
- int postproc_cfg_set;
- vp8_postproc_cfg_t postproc_cfg;
-#if CONFIG_POSTPROC_VISUALIZER
- unsigned int dbg_postproc_flag;
- int dbg_color_ref_frame_flag;
- int dbg_color_mb_modes_flag;
- int dbg_color_b_modes_flag;
- int dbg_display_mv_flag;
-#endif
- vpx_image_t img;
- int img_setup;
- int img_avail;
- int invert_tile_order;
-
- // External frame buffer info to save for VP9 common.
- void *ext_priv; // Private data associated with the external frame buffers.
- vpx_get_frame_buffer_cb_fn_t get_ext_fb_cb;
- vpx_release_frame_buffer_cb_fn_t release_ext_fb_cb;
-};
-
-static vpx_codec_err_t vp9_init(vpx_codec_ctx_t *ctx,
- vpx_codec_priv_enc_mr_cfg_t *data) {
- // This function only allocates space for the vpx_codec_alg_priv_t
- // structure. More memory may be required at the time the stream
- // information becomes known.
- (void)data;
- if (!ctx->priv) {
- void *base = vpx_memalign(32, sizeof(vpx_codec_alg_priv_t));
- if (base == NULL)
- return VPX_CODEC_MEM_ERROR;
-
- memset(base, 0, sizeof(vpx_codec_alg_priv_t));
- ctx->priv = (vpx_codec_priv_t *)base;
- ctx->priv->sz = sizeof(*ctx->priv);
- ctx->priv->iface = ctx->iface;
- ctx->priv->alg_priv = (vpx_codec_alg_priv_t *)base;
- ctx->priv->alg_priv->si.sz = sizeof(ctx->priv->alg_priv->si);
- ctx->priv->init_flags = ctx->init_flags;
-
- if (ctx->config.dec) {
- // Update the reference to the config structure to an internal copy.
- ctx->priv->alg_priv->cfg = *ctx->config.dec;
- ctx->config.dec = &ctx->priv->alg_priv->cfg;
- }
- }
-
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9_destroy(vpx_codec_alg_priv_t *ctx) {
- if (ctx->pbi)
- vp9_remove_decompressor(ctx->pbi);
-
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9_peek_si(const uint8_t *data, unsigned int data_sz,
- vpx_codec_stream_info_t *si) {
- if (data_sz <= 8) return VPX_CODEC_UNSUP_BITSTREAM;
- if (data + data_sz <= data) return VPX_CODEC_INVALID_PARAM;
-
- si->is_kf = 0;
- si->w = si->h = 0;
-
- {
- struct vp9_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL };
- const int frame_marker = vp9_rb_read_literal(&rb, 2);
- const int version = vp9_rb_read_bit(&rb);
- (void) vp9_rb_read_bit(&rb); // unused version bit
-
- if (frame_marker != VP9_FRAME_MARKER)
- return VPX_CODEC_UNSUP_BITSTREAM;
- if (version > 1) return VPX_CODEC_UNSUP_BITSTREAM;
-
- if (vp9_rb_read_bit(&rb)) { // show an existing frame
- return VPX_CODEC_OK;
- }
-
- si->is_kf = !vp9_rb_read_bit(&rb);
- if (si->is_kf) {
- const int sRGB = 7;
- int colorspace;
-
- rb.bit_offset += 1; // show frame
- rb.bit_offset += 1; // error resilient
-
- if (vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_0 ||
- vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_1 ||
- vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_2) {
- return VPX_CODEC_UNSUP_BITSTREAM;
- }
-
- colorspace = vp9_rb_read_literal(&rb, 3);
- if (colorspace != sRGB) {
- rb.bit_offset += 1; // [16,235] (including xvycc) vs [0,255] range
- if (version == 1) {
- rb.bit_offset += 2; // subsampling x/y
- rb.bit_offset += 1; // has extra plane
- }
- } else {
- if (version == 1) {
- rb.bit_offset += 1; // has extra plane
- } else {
- // RGB is only available in version 1
- return VPX_CODEC_UNSUP_BITSTREAM;
- }
- }
-
- // TODO(jzern): these are available on non-keyframes in intra only mode.
- si->w = vp9_rb_read_literal(&rb, 16) + 1;
- si->h = vp9_rb_read_literal(&rb, 16) + 1;
- }
- }
-
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t vp9_get_si(vpx_codec_alg_priv_t *ctx,
- vpx_codec_stream_info_t *si) {
- const size_t sz = (si->sz >= sizeof(vp9_stream_info_t))
- ? sizeof(vp9_stream_info_t)
- : sizeof(vpx_codec_stream_info_t);
- memcpy(si, &ctx->si, sz);
- si->sz = (unsigned int)sz;
-
- return VPX_CODEC_OK;
-}
-
-
-static vpx_codec_err_t update_error_state(vpx_codec_alg_priv_t *ctx,
- const struct vpx_internal_error_info *error) {
- if (error->error_code)
- ctx->base.err_detail = error->has_detail ? error->detail : NULL;
-
- return error->error_code;
-}
-
-static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx,
- const uint8_t **data, unsigned int data_sz,
- void *user_priv, int64_t deadline) {
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- ctx->img_avail = 0;
-
- // Determine the stream parameters. Note that we rely on peek_si to
- // validate that we have a buffer that does not wrap around the top
- // of the heap.
- if (!ctx->si.h)
- res = ctx->base.iface->dec.peek_si(*data, data_sz, &ctx->si);
-
- /* Initialize the decoder instance on the first frame*/
- if (!res && !ctx->decoder_init) {
- VP9D_CONFIG oxcf;
- struct VP9Decompressor *optr;
-
- vp9_initialize_dec();
-
- oxcf.width = ctx->si.w;
- oxcf.height = ctx->si.h;
- oxcf.version = 9;
- oxcf.max_threads = ctx->cfg.threads;
- oxcf.inv_tile_order = ctx->invert_tile_order;
- optr = vp9_create_decompressor(&oxcf);
-
- // If postprocessing was enabled by the application and a
- // configuration has not been provided, default it.
- if (!ctx->postproc_cfg_set &&
- (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC)) {
- ctx->postproc_cfg.post_proc_flag = VP8_DEBLOCK | VP8_DEMACROBLOCK;
- ctx->postproc_cfg.deblocking_level = 4;
- ctx->postproc_cfg.noise_level = 0;
- }
-
- if (!optr) {
- res = VPX_CODEC_ERROR;
- } else {
- VP9D_COMP *const pbi = (VP9D_COMP*)optr;
- VP9_COMMON *const cm = &pbi->common;
-
- // Set index to not initialized.
- cm->new_fb_idx = -1;
-
- if (ctx->get_ext_fb_cb != NULL && ctx->release_ext_fb_cb != NULL) {
- cm->get_fb_cb = ctx->get_ext_fb_cb;
- cm->release_fb_cb = ctx->release_ext_fb_cb;
- cm->cb_priv = ctx->ext_priv;
- } else {
- cm->get_fb_cb = vp9_get_frame_buffer;
- cm->release_fb_cb = vp9_release_frame_buffer;
-
- if (vp9_alloc_internal_frame_buffers(&cm->int_frame_buffers))
- vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
- "Failed to initialize internal frame buffers");
- cm->cb_priv = &cm->int_frame_buffers;
- }
-
- ctx->pbi = optr;
- }
-
- ctx->decoder_init = 1;
- }
-
- if (!res && ctx->pbi) {
- VP9D_COMP *const pbi = ctx->pbi;
- VP9_COMMON *const cm = &pbi->common;
- YV12_BUFFER_CONFIG sd;
- int64_t time_stamp = 0, time_end_stamp = 0;
- vp9_ppflags_t flags = {0};
-
- if (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC) {
- flags.post_proc_flag =
-#if CONFIG_POSTPROC_VISUALIZER
- (ctx->dbg_color_ref_frame_flag ? VP9D_DEBUG_CLR_FRM_REF_BLKS : 0) |
- (ctx->dbg_color_mb_modes_flag ? VP9D_DEBUG_CLR_BLK_MODES : 0) |
- (ctx->dbg_color_b_modes_flag ? VP9D_DEBUG_CLR_BLK_MODES : 0) |
- (ctx->dbg_display_mv_flag ? VP9D_DEBUG_DRAW_MV : 0) |
-#endif
- ctx->postproc_cfg.post_proc_flag;
-
- flags.deblocking_level = ctx->postproc_cfg.deblocking_level;
- flags.noise_level = ctx->postproc_cfg.noise_level;
-#if CONFIG_POSTPROC_VISUALIZER
- flags.display_ref_frame_flag = ctx->dbg_color_ref_frame_flag;
- flags.display_mb_modes_flag = ctx->dbg_color_mb_modes_flag;
- flags.display_b_modes_flag = ctx->dbg_color_b_modes_flag;
- flags.display_mv_flag = ctx->dbg_display_mv_flag;
-#endif
- }
-
- if (vp9_receive_compressed_data(pbi, data_sz, data, deadline))
- res = update_error_state(ctx, &cm->error);
-
- if (!res && 0 == vp9_get_raw_frame(pbi, &sd, &time_stamp,
- &time_end_stamp, &flags)) {
- yuvconfig2image(&ctx->img, &sd, user_priv);
-
- ctx->img.fb_priv = cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer.priv;
- ctx->img_avail = 1;
- }
- }
-
- return res;
-}
-
-static void parse_superframe_index(const uint8_t *data, size_t data_sz,
- uint32_t sizes[8], int *count) {
- uint8_t marker;
-
- assert(data_sz);
- marker = data[data_sz - 1];
- *count = 0;
-
- if ((marker & 0xe0) == 0xc0) {
- const uint32_t frames = (marker & 0x7) + 1;
- const uint32_t mag = ((marker >> 3) & 0x3) + 1;
- const size_t index_sz = 2 + mag * frames;
-
- if (data_sz >= index_sz && data[data_sz - index_sz] == marker) {
- // found a valid superframe index
- uint32_t i, j;
- const uint8_t *x = data + data_sz - index_sz + 1;
-
- for (i = 0; i < frames; i++) {
- uint32_t this_sz = 0;
-
- for (j = 0; j < mag; j++)
- this_sz |= (*x++) << (j * 8);
- sizes[i] = this_sz;
- }
-
- *count = frames;
- }
- }
-}
-
-static vpx_codec_err_t vp9_decode(vpx_codec_alg_priv_t *ctx,
- const uint8_t *data,
- unsigned int data_sz,
- void *user_priv,
- long deadline) {
- const uint8_t *data_start = data;
- const uint8_t *data_end = data + data_sz;
- vpx_codec_err_t res = VPX_CODEC_OK;
- uint32_t sizes[8];
- int frames_this_pts, frame_count = 0;
-
- if (data == NULL || data_sz == 0) return VPX_CODEC_INVALID_PARAM;
-
- parse_superframe_index(data, data_sz, sizes, &frames_this_pts);
-
- do {
- // Skip over the superframe index, if present
- if (data_sz && (*data_start & 0xe0) == 0xc0) {
- const uint8_t marker = *data_start;
- const uint32_t frames = (marker & 0x7) + 1;
- const uint32_t mag = ((marker >> 3) & 0x3) + 1;
- const uint32_t index_sz = 2 + mag * frames;
-
- if (data_sz >= index_sz && data_start[index_sz - 1] == marker) {
- data_start += index_sz;
- data_sz -= index_sz;
- if (data_start < data_end)
- continue;
- else
- break;
- }
- }
-
- // Use the correct size for this frame, if an index is present.
- if (frames_this_pts) {
- uint32_t this_sz = sizes[frame_count];
-
- if (data_sz < this_sz) {
- ctx->base.err_detail = "Invalid frame size in index";
- return VPX_CODEC_CORRUPT_FRAME;
- }
-
- data_sz = this_sz;
- frame_count++;
- }
-
- res = decode_one(ctx, &data_start, data_sz, user_priv, deadline);
- assert(data_start >= data);
- assert(data_start <= data_end);
-
- /* Early exit if there was a decode error */
- if (res)
- break;
-
- /* Account for suboptimal termination by the encoder. */
- while (data_start < data_end && *data_start == 0)
- data_start++;
-
- data_sz = (unsigned int)(data_end - data_start);
- } while (data_start < data_end);
- return res;
-}
-
-static vpx_image_t *vp9_get_frame(vpx_codec_alg_priv_t *ctx,
- vpx_codec_iter_t *iter) {
- vpx_image_t *img = NULL;
-
- if (ctx->img_avail) {
- /* iter acts as a flip flop, so an image is only returned on the first
- * call to get_frame.
- */
- if (!(*iter)) {
- img = &ctx->img;
- *iter = img;
- }
- }
- ctx->img_avail = 0;
-
- return img;
-}
-
-static vpx_codec_err_t vp9_set_fb_fn(
- vpx_codec_alg_priv_t *ctx,
- vpx_get_frame_buffer_cb_fn_t cb_get,
- vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv) {
- if (cb_get == NULL || cb_release == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- } else if (ctx->pbi == NULL) {
- // If the decoder has already been initialized, do not accept changes to
- // the frame buffer functions.
- ctx->get_ext_fb_cb = cb_get;
- ctx->release_ext_fb_cb = cb_release;
- ctx->ext_priv = cb_priv;
- return VPX_CODEC_OK;
- }
-
- return VPX_CODEC_ERROR;
-}
-
-static vpx_codec_err_t set_reference(vpx_codec_alg_priv_t *ctx, int ctr_id,
- va_list args) {
- vpx_ref_frame_t *const data = va_arg(args, vpx_ref_frame_t *);
- (void)ctr_id;
- if (data) {
- vpx_ref_frame_t *const frame = (vpx_ref_frame_t *)data;
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
- return vp9_set_reference_dec(&ctx->pbi->common,
- (VP9_REFFRAME)frame->frame_type, &sd);
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t copy_reference(vpx_codec_alg_priv_t *ctx, int ctr_id,
- va_list args) {
- vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
- (void)ctr_id;
- if (data) {
- vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data;
- YV12_BUFFER_CONFIG sd;
-
- image2yuvconfig(&frame->img, &sd);
-
- return vp9_copy_reference_dec(ctx->pbi,
- (VP9_REFFRAME)frame->frame_type, &sd);
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t get_reference(vpx_codec_alg_priv_t *ctx, int ctr_id,
- va_list args) {
- vp9_ref_frame_t *data = va_arg(args, vp9_ref_frame_t *);
- (void)ctr_id;
- if (data) {
- YV12_BUFFER_CONFIG* fb;
-
- vp9_get_reference_dec(ctx->pbi, data->idx, &fb);
- yuvconfig2image(&data->img, fb, NULL);
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t set_postproc(vpx_codec_alg_priv_t *ctx, int ctr_id,
- va_list args) {
-#if CONFIG_VP9_POSTPROC
- vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *);
-
- if (data) {
- ctx->postproc_cfg_set = 1;
- ctx->postproc_cfg = *((vp8_postproc_cfg_t *)data);
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-#else
- (void)ctr_id;
- (void)ctx;
- (void)args;
- return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-static vpx_codec_err_t set_dbg_options(vpx_codec_alg_priv_t *ctx, int ctrl_id,
- va_list args) {
-#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
- int data = va_arg(args, int);
-
-#define MAP(id, var) case id: var = data; break;
-
- switch (ctrl_id) {
- MAP(VP8_SET_DBG_COLOR_REF_FRAME, ctx->dbg_color_ref_frame_flag);
- MAP(VP8_SET_DBG_COLOR_MB_MODES, ctx->dbg_color_mb_modes_flag);
- MAP(VP8_SET_DBG_COLOR_B_MODES, ctx->dbg_color_b_modes_flag);
- MAP(VP8_SET_DBG_DISPLAY_MV, ctx->dbg_display_mv_flag);
- }
-
- return VPX_CODEC_OK;
-#else
- (void)ctrl_id;
- (void)ctx;
- (void)args;
- return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-static vpx_codec_err_t get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
- int ctrl_id, va_list args) {
- int *const update_info = va_arg(args, int *);
-
- (void)ctrl_id;
- if (update_info) {
- if (ctx->pbi)
- *update_info = ctx->pbi->refresh_frame_flags;
- else
- return VPX_CODEC_ERROR;
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-
-static vpx_codec_err_t get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
- int ctrl_id, va_list args) {
- int *corrupted = va_arg(args, int *);
- (void)ctrl_id;
-
- if (corrupted) {
- if (ctx->pbi)
- *corrupted = ctx->pbi->common.frame_to_show->corrupted;
- else
- return VPX_CODEC_ERROR;
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t get_display_size(vpx_codec_alg_priv_t *ctx,
- int ctrl_id, va_list args) {
- int *const display_size = va_arg(args, int *);
- (void)ctrl_id;
-
- if (display_size) {
- if (ctx->pbi) {
- const VP9_COMMON *const cm = &ctx->pbi->common;
- display_size[0] = cm->display_width;
- display_size[1] = cm->display_height;
- } else {
- return VPX_CODEC_ERROR;
- }
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
-}
-
-static vpx_codec_err_t set_invert_tile_order(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list args) {
- (void)ctrl_id;
- (void)ctx;
- ctx->invert_tile_order = va_arg(args, int);
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_ctrl_fn_map_t ctf_maps[] = {
- {VP8_SET_REFERENCE, set_reference},
- {VP8_COPY_REFERENCE, copy_reference},
- {VP8_SET_POSTPROC, set_postproc},
- {VP8_SET_DBG_COLOR_REF_FRAME, set_dbg_options},
- {VP8_SET_DBG_COLOR_MB_MODES, set_dbg_options},
- {VP8_SET_DBG_COLOR_B_MODES, set_dbg_options},
- {VP8_SET_DBG_DISPLAY_MV, set_dbg_options},
- {VP8D_GET_LAST_REF_UPDATES, get_last_ref_updates},
- {VP8D_GET_FRAME_CORRUPTED, get_frame_corrupted},
- {VP9_GET_REFERENCE, get_reference},
- {VP9D_GET_DISPLAY_SIZE, get_display_size},
- {VP9_INVERT_TILE_DECODE_ORDER, set_invert_tile_order},
- { -1, NULL},
-};
-
-
-#ifndef VERSION_STRING
-#define VERSION_STRING
-#endif
-CODEC_INTERFACE(vpx_codec_vp9_dx) = {
- "WebM Project VP9 Decoder" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_DECODER | VP9_CAP_POSTPROC |
- VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER,
- /* vpx_codec_caps_t caps; */
- vp9_init, /* vpx_codec_init_fn_t init; */
- vp9_destroy, /* vpx_codec_destroy_fn_t destroy; */
- ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
- NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
- NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
- { // NOLINT
- vp9_peek_si, /* vpx_codec_peek_si_fn_t peek_si; */
- vp9_get_si, /* vpx_codec_get_si_fn_t get_si; */
- vp9_decode, /* vpx_codec_decode_fn_t decode; */
- vp9_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */
- vp9_set_fb_fn, /* vpx_codec_set_fb_fn_t set_fb_fn; */
- },
- { // NOLINT
- /* encoder functions */
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED,
- NOT_IMPLEMENTED
- }
-};
diff --git a/videocodec/libvpx_internal/libvpx/vp9/vp9_iface_common.h b/videocodec/libvpx_internal/libvpx/vp9/vp9_iface_common.h
deleted file mode 100644
index e463c58..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/vp9_iface_common.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VP9_VP9_IFACE_COMMON_H_
-#define VP9_VP9_IFACE_COMMON_H_
-
-static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12,
- void *user_priv) {
- /** vpx_img_wrap() doesn't allow specifying independent strides for
- * the Y, U, and V planes, nor other alignment adjustments that
- * might be representable by a YV12_BUFFER_CONFIG, so we just
- * initialize all the fields.*/
- int bps = 12;
- if (yv12->uv_height == yv12->y_height) {
- if (yv12->uv_width == yv12->y_width) {
- img->fmt = VPX_IMG_FMT_I444;
- bps = 24;
- } else {
- img->fmt = VPX_IMG_FMT_I422;
- bps = 16;
- }
- } else {
- img->fmt = VPX_IMG_FMT_I420;
- }
- img->w = yv12->y_stride;
- img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3);
- img->d_w = yv12->y_crop_width;
- img->d_h = yv12->y_crop_height;
- img->x_chroma_shift = yv12->uv_width < yv12->y_width;
- img->y_chroma_shift = yv12->uv_height < yv12->y_height;
- img->planes[VPX_PLANE_Y] = yv12->y_buffer;
- img->planes[VPX_PLANE_U] = yv12->u_buffer;
- img->planes[VPX_PLANE_V] = yv12->v_buffer;
- img->planes[VPX_PLANE_ALPHA] = yv12->alpha_buffer;
- img->stride[VPX_PLANE_Y] = yv12->y_stride;
- img->stride[VPX_PLANE_U] = yv12->uv_stride;
- img->stride[VPX_PLANE_V] = yv12->uv_stride;
- img->stride[VPX_PLANE_ALPHA] = yv12->alpha_stride;
- img->bps = bps;
- img->user_priv = user_priv;
- img->img_data = yv12->buffer_alloc;
- img->img_data_owner = 0;
- img->self_allocd = 0;
- img->fb_index = yv12->fb_index;
-}
-
-static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
- YV12_BUFFER_CONFIG *yv12) {
- yv12->y_buffer = img->planes[VPX_PLANE_Y];
- yv12->u_buffer = img->planes[VPX_PLANE_U];
- yv12->v_buffer = img->planes[VPX_PLANE_V];
- yv12->alpha_buffer = img->planes[VPX_PLANE_ALPHA];
-
- yv12->y_crop_width = img->d_w;
- yv12->y_crop_height = img->d_h;
- yv12->y_width = img->d_w;
- yv12->y_height = img->d_h;
-
- yv12->uv_width = img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2
- : yv12->y_width;
- yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2
- : yv12->y_height;
-
- yv12->alpha_width = yv12->alpha_buffer ? img->d_w : 0;
- yv12->alpha_height = yv12->alpha_buffer ? img->d_h : 0;
-
- yv12->y_stride = img->stride[VPX_PLANE_Y];
- yv12->uv_stride = img->stride[VPX_PLANE_U];
- yv12->alpha_stride = yv12->alpha_buffer ? img->stride[VPX_PLANE_ALPHA] : 0;
-
- yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
-#if CONFIG_ALPHA
- // For development purposes, force alpha to hold the same data as Y for now.
- yv12->alpha_buffer = yv12->y_buffer;
- yv12->alpha_width = yv12->y_width;
- yv12->alpha_height = yv12->y_height;
- yv12->alpha_stride = yv12->y_stride;
-#endif
- return VPX_CODEC_OK;
-}
-
-#endif // VP9_VP9_IFACE_COMMON_H_
diff --git a/videocodec/libvpx_internal/libvpx/vp9/vp9cx.mk b/videocodec/libvpx_internal/libvpx/vp9/vp9cx.mk
deleted file mode 100644
index 21a388e..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/vp9cx.mk
+++ /dev/null
@@ -1,125 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-VP9_CX_EXPORTS += exports_enc
-
-VP9_CX_SRCS-yes += $(VP9_COMMON_SRCS-yes)
-VP9_CX_SRCS-no += $(VP9_COMMON_SRCS-no)
-VP9_CX_SRCS_REMOVE-yes += $(VP9_COMMON_SRCS_REMOVE-yes)
-VP9_CX_SRCS_REMOVE-no += $(VP9_COMMON_SRCS_REMOVE-no)
-
-VP9_CX_SRCS-yes += vp9_cx_iface.c
-
-VP9_CX_SRCS-yes += encoder/vp9_bitstream.c
-VP9_CX_SRCS-yes += encoder/vp9_cost.h
-VP9_CX_SRCS-yes += encoder/vp9_cost.c
-VP9_CX_SRCS-yes += encoder/vp9_dct.c
-VP9_CX_SRCS-yes += encoder/vp9_encodeframe.c
-VP9_CX_SRCS-yes += encoder/vp9_encodeframe.h
-VP9_CX_SRCS-yes += encoder/vp9_encodemb.c
-VP9_CX_SRCS-yes += encoder/vp9_encodemv.c
-VP9_CX_SRCS-yes += encoder/vp9_extend.c
-VP9_CX_SRCS-yes += encoder/vp9_firstpass.c
-VP9_CX_SRCS-yes += encoder/vp9_block.h
-VP9_CX_SRCS-yes += encoder/vp9_writer.h
-VP9_CX_SRCS-yes += encoder/vp9_writer.c
-VP9_CX_SRCS-yes += encoder/vp9_write_bit_buffer.c
-VP9_CX_SRCS-yes += encoder/vp9_write_bit_buffer.h
-VP9_CX_SRCS-yes += encoder/vp9_bitstream.h
-VP9_CX_SRCS-yes += encoder/vp9_encodemb.h
-VP9_CX_SRCS-yes += encoder/vp9_encodemv.h
-VP9_CX_SRCS-yes += encoder/vp9_extend.h
-VP9_CX_SRCS-yes += encoder/vp9_firstpass.h
-VP9_CX_SRCS-yes += encoder/vp9_lookahead.c
-VP9_CX_SRCS-yes += encoder/vp9_lookahead.h
-VP9_CX_SRCS-yes += encoder/vp9_mcomp.h
-VP9_CX_SRCS-yes += encoder/vp9_onyx_int.h
-VP9_CX_SRCS-yes += encoder/vp9_quantize.h
-VP9_CX_SRCS-yes += encoder/vp9_ratectrl.h
-VP9_CX_SRCS-yes += encoder/vp9_rdopt.h
-VP9_CX_SRCS-yes += encoder/vp9_pickmode.h
-VP9_CX_SRCS-yes += encoder/vp9_svc_layercontext.h
-VP9_CX_SRCS-yes += encoder/vp9_tokenize.h
-VP9_CX_SRCS-yes += encoder/vp9_treewriter.h
-VP9_CX_SRCS-yes += encoder/vp9_variance.h
-VP9_CX_SRCS-yes += encoder/vp9_mcomp.c
-VP9_CX_SRCS-yes += encoder/vp9_onyx_if.c
-VP9_CX_SRCS-yes += encoder/vp9_picklpf.c
-VP9_CX_SRCS-yes += encoder/vp9_picklpf.h
-VP9_CX_SRCS-yes += encoder/vp9_quantize.c
-VP9_CX_SRCS-yes += encoder/vp9_ratectrl.c
-VP9_CX_SRCS-yes += encoder/vp9_rdopt.c
-VP9_CX_SRCS-yes += encoder/vp9_pickmode.c
-VP9_CX_SRCS-yes += encoder/vp9_sad.c
-VP9_CX_SRCS-yes += encoder/vp9_segmentation.c
-VP9_CX_SRCS-yes += encoder/vp9_segmentation.h
-VP9_CX_SRCS-yes += encoder/vp9_speed_features.c
-VP9_CX_SRCS-yes += encoder/vp9_speed_features.h
-VP9_CX_SRCS-yes += encoder/vp9_subexp.c
-VP9_CX_SRCS-yes += encoder/vp9_subexp.h
-VP9_CX_SRCS-yes += encoder/vp9_svc_layercontext.c
-VP9_CX_SRCS-yes += encoder/vp9_resize.c
-VP9_CX_SRCS-yes += encoder/vp9_resize.h
-VP9_CX_SRCS-$(CONFIG_INTERNAL_STATS) += encoder/vp9_ssim.c
-VP9_CX_SRCS-yes += encoder/vp9_tokenize.c
-VP9_CX_SRCS-yes += encoder/vp9_treewriter.c
-VP9_CX_SRCS-yes += encoder/vp9_variance.c
-VP9_CX_SRCS-yes += encoder/vp9_aq_variance.c
-VP9_CX_SRCS-yes += encoder/vp9_aq_variance.h
-VP9_CX_SRCS-yes += encoder/vp9_aq_cyclicrefresh.c
-VP9_CX_SRCS-yes += encoder/vp9_aq_cyclicrefresh.h
-VP9_CX_SRCS-yes += encoder/vp9_aq_complexity.c
-VP9_CX_SRCS-yes += encoder/vp9_aq_complexity.h
-ifeq ($(CONFIG_VP9_POSTPROC),yes)
-VP9_CX_SRCS-$(CONFIG_INTERNAL_STATS) += common/vp9_postproc.h
-VP9_CX_SRCS-$(CONFIG_INTERNAL_STATS) += common/vp9_postproc.c
-endif
-VP9_CX_SRCS-yes += encoder/vp9_temporal_filter.c
-VP9_CX_SRCS-yes += encoder/vp9_temporal_filter.h
-VP9_CX_SRCS-yes += encoder/vp9_mbgraph.c
-VP9_CX_SRCS-yes += encoder/vp9_mbgraph.h
-
-
-VP9_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/vp9_mcomp_x86.h
-VP9_CX_SRCS-$(HAVE_MMX) += encoder/x86/vp9_variance_mmx.c
-VP9_CX_SRCS-$(HAVE_MMX) += encoder/x86/vp9_variance_impl_mmx.asm
-VP9_CX_SRCS-$(HAVE_MMX) += encoder/x86/vp9_sad_mmx.asm
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_variance_impl_sse2.asm
-VP9_CX_SRCS-$(HAVE_AVX2) += encoder/x86/vp9_variance_impl_intrin_avx2.c
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_sad4d_sse2.asm
-VP9_CX_SRCS-$(HAVE_AVX2) += encoder/x86/vp9_sad4d_intrin_avx2.c
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_subpel_variance_impl_sse2.asm
-VP9_CX_SRCS-$(HAVE_AVX2) += encoder/x86/vp9_subpel_variance_impl_intrin_avx2.c
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_temporal_filter_apply_sse2.asm
-VP9_CX_SRCS-$(HAVE_SSE3) += encoder/x86/vp9_sad_sse3.asm
-
-ifeq ($(CONFIG_USE_X86INC),yes)
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_error_sse2.asm
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_sad_sse2.asm
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_subtract_sse2.asm
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_variance_sse2.c
-VP9_CX_SRCS-$(HAVE_AVX2) += encoder/x86/vp9_variance_avx2.c
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_subpel_variance.asm
-endif
-
-ifeq ($(ARCH_X86_64),yes)
-VP9_CX_SRCS-$(HAVE_SSSE3) += encoder/x86/vp9_quantize_ssse3.asm
-endif
-VP9_CX_SRCS-$(HAVE_SSSE3) += encoder/x86/vp9_sad_ssse3.asm
-VP9_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/vp9_sad_sse4.asm
-VP9_CX_SRCS-$(ARCH_X86_64) += encoder/x86/vp9_ssim_opt.asm
-
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_dct_sse2.c
-VP9_CX_SRCS-$(HAVE_SSE2) += encoder/x86/vp9_dct32x32_sse2.c
-
-VP9_CX_SRCS-$(HAVE_AVX2) += encoder/x86/vp9_dct_avx2.c
-VP9_CX_SRCS-$(HAVE_AVX2) += encoder/x86/vp9_dct32x32_avx2.c
-
-VP9_CX_SRCS-yes := $(filter-out $(VP9_CX_SRCS_REMOVE-yes),$(VP9_CX_SRCS-yes))
diff --git a/videocodec/libvpx_internal/libvpx/vp9/vp9dx.mk b/videocodec/libvpx_internal/libvpx/vp9/vp9dx.mk
deleted file mode 100644
index 92ec6fd..0000000
--- a/videocodec/libvpx_internal/libvpx/vp9/vp9dx.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-VP9_DX_EXPORTS += exports_dec
-
-VP9_DX_SRCS-yes += $(VP9_COMMON_SRCS-yes)
-VP9_DX_SRCS-no += $(VP9_COMMON_SRCS-no)
-VP9_DX_SRCS_REMOVE-yes += $(VP9_COMMON_SRCS_REMOVE-yes)
-VP9_DX_SRCS_REMOVE-no += $(VP9_COMMON_SRCS_REMOVE-no)
-
-VP9_DX_SRCS-yes += vp9_dx_iface.c
-
-VP9_DX_SRCS-yes += decoder/vp9_decodemv.c
-VP9_DX_SRCS-yes += decoder/vp9_decodeframe.c
-VP9_DX_SRCS-yes += decoder/vp9_decodeframe.h
-VP9_DX_SRCS-yes += decoder/vp9_detokenize.c
-VP9_DX_SRCS-yes += decoder/vp9_dthread.c
-VP9_DX_SRCS-yes += decoder/vp9_dthread.h
-VP9_DX_SRCS-yes += decoder/vp9_reader.h
-VP9_DX_SRCS-yes += decoder/vp9_reader.c
-VP9_DX_SRCS-yes += decoder/vp9_read_bit_buffer.c
-VP9_DX_SRCS-yes += decoder/vp9_read_bit_buffer.h
-VP9_DX_SRCS-yes += decoder/vp9_decodemv.h
-VP9_DX_SRCS-yes += decoder/vp9_detokenize.h
-VP9_DX_SRCS-yes += decoder/vp9_decoder.c
-VP9_DX_SRCS-yes += decoder/vp9_decoder.h
-VP9_DX_SRCS-yes += decoder/vp9_thread.c
-VP9_DX_SRCS-yes += decoder/vp9_thread.h
-VP9_DX_SRCS-yes += decoder/vp9_dsubexp.c
-VP9_DX_SRCS-yes += decoder/vp9_dsubexp.h
-
-VP9_DX_SRCS-yes := $(filter-out $(VP9_DX_SRCS_REMOVE-yes),$(VP9_DX_SRCS-yes))
diff --git a/videocodec/libvpx_internal/libvpx/vpx/exports_com b/videocodec/libvpx_internal/libvpx/vpx/exports_com
deleted file mode 100644
index 2ab0509..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/exports_com
+++ /dev/null
@@ -1,16 +0,0 @@
-text vpx_codec_build_config
-text vpx_codec_control_
-text vpx_codec_destroy
-text vpx_codec_err_to_string
-text vpx_codec_error
-text vpx_codec_error_detail
-text vpx_codec_get_caps
-text vpx_codec_iface_name
-text vpx_codec_version
-text vpx_codec_version_extra_str
-text vpx_codec_version_str
-text vpx_img_alloc
-text vpx_img_flip
-text vpx_img_free
-text vpx_img_set_rect
-text vpx_img_wrap
diff --git a/videocodec/libvpx_internal/libvpx/vpx/exports_dec b/videocodec/libvpx_internal/libvpx/vpx/exports_dec
deleted file mode 100644
index 3ce1499..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/exports_dec
+++ /dev/null
@@ -1,10 +0,0 @@
-text vpx_codec_dec_init_ver
-text vpx_codec_decode
-text vpx_codec_get_frame
-text vpx_codec_get_mem_map
-text vpx_codec_get_stream_info
-text vpx_codec_peek_stream_info
-text vpx_codec_register_put_frame_cb
-text vpx_codec_register_put_slice_cb
-text vpx_codec_set_frame_buffer_functions
-text vpx_codec_set_mem_map
diff --git a/videocodec/libvpx_internal/libvpx/vpx/exports_enc b/videocodec/libvpx_internal/libvpx/vpx/exports_enc
deleted file mode 100644
index 155faf6..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/exports_enc
+++ /dev/null
@@ -1,25 +0,0 @@
-text vpx_codec_enc_config_default
-text vpx_codec_enc_config_set
-text vpx_codec_enc_init_ver
-text vpx_codec_encode
-text vpx_codec_get_cx_data
-text vpx_codec_get_global_headers
-text vpx_codec_get_preview_frame
-text vpx_codec_set_cx_data_buf
-text vpx_svc_dump_statistics
-text vpx_svc_encode
-text vpx_svc_free
-text vpx_svc_get_buffer
-text vpx_svc_get_encode_frame_count
-text vpx_svc_get_frame_size
-text vpx_svc_get_message
-text vpx_svc_init
-text vpx_svc_is_keyframe
-text vpx_svc_release
-text vpx_svc_set_keyframe
-text vpx_svc_set_options
-text vpx_svc_set_quantizers
-text vpx_svc_set_scale_factors
-text vpx_svc_get_layer_resolution
-text vpx_svc_get_rc_stats_buffer_size
-text vpx_svc_get_rc_stats_buffer \ No newline at end of file
diff --git a/videocodec/libvpx_internal/libvpx/vpx/internal/vpx_codec_internal.h b/videocodec/libvpx_internal/libvpx/vpx/internal/vpx_codec_internal.h
deleted file mode 100644
index 51ca65e..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/internal/vpx_codec_internal.h
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*!\file
- * \brief Describes the decoder algorithm interface for algorithm
- * implementations.
- *
- * This file defines the private structures and data types that are only
- * relevant to implementing an algorithm, as opposed to using it.
- *
- * To create a decoder algorithm class, an interface structure is put
- * into the global namespace:
- * <pre>
- * my_codec.c:
- * vpx_codec_iface_t my_codec = {
- * "My Codec v1.0",
- * VPX_CODEC_ALG_ABI_VERSION,
- * ...
- * };
- * </pre>
- *
- * An application instantiates a specific decoder instance by using
- * vpx_codec_init() and a pointer to the algorithm's interface structure:
- * <pre>
- * my_app.c:
- * extern vpx_codec_iface_t my_codec;
- * {
- * vpx_codec_ctx_t algo;
- * res = vpx_codec_init(&algo, &my_codec);
- * }
- * </pre>
- *
- * Once initialized, the instance is manged using other functions from
- * the vpx_codec_* family.
- */
-#ifndef VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
-#define VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
-#include "../vpx_decoder.h"
-#include "../vpx_encoder.h"
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*!\brief Current ABI version number
- *
- * \internal
- * If this file is altered in any way that changes the ABI, this value
- * must be bumped. Examples include, but are not limited to, changing
- * types, removing or reassigning enums, adding/removing/rearranging
- * fields to structures
- */
-#define VPX_CODEC_INTERNAL_ABI_VERSION (5) /**<\hideinitializer*/
-
-typedef struct vpx_codec_alg_priv vpx_codec_alg_priv_t;
-typedef struct vpx_codec_priv_enc_mr_cfg vpx_codec_priv_enc_mr_cfg_t;
-
-/*!\brief init function pointer prototype
- *
- * Performs algorithm-specific initialization of the decoder context. This
- * function is called by the generic vpx_codec_init() wrapper function, so
- * plugins implementing this interface may trust the input parameters to be
- * properly initialized.
- *
- * \param[in] ctx Pointer to this instance's context
- * \retval #VPX_CODEC_OK
- * The input stream was recognized and decoder initialized.
- * \retval #VPX_CODEC_MEM_ERROR
- * Memory operation failed.
- */
-typedef vpx_codec_err_t (*vpx_codec_init_fn_t)(vpx_codec_ctx_t *ctx,
- vpx_codec_priv_enc_mr_cfg_t *data);
-
-/*!\brief destroy function pointer prototype
- *
- * Performs algorithm-specific destruction of the decoder context. This
- * function is called by the generic vpx_codec_destroy() wrapper function,
- * so plugins implementing this interface may trust the input parameters
- * to be properly initialized.
- *
- * \param[in] ctx Pointer to this instance's context
- * \retval #VPX_CODEC_OK
- * The input stream was recognized and decoder initialized.
- * \retval #VPX_CODEC_MEM_ERROR
- * Memory operation failed.
- */
-typedef vpx_codec_err_t (*vpx_codec_destroy_fn_t)(vpx_codec_alg_priv_t *ctx);
-
-/*!\brief parse stream info function pointer prototype
- *
- * Performs high level parsing of the bitstream. This function is called by the
- * generic vpx_codec_peek_stream_info() wrapper function, so plugins
- * implementing this interface may trust the input parameters to be properly
- * initialized.
- *
- * \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.
- *
- * \retval #VPX_CODEC_OK
- * Bitstream is parsable and stream information updated
- */
-typedef vpx_codec_err_t (*vpx_codec_peek_si_fn_t)(const uint8_t *data,
- unsigned int data_sz,
- vpx_codec_stream_info_t *si);
-
-/*!\brief Return information about the current stream.
- *
- * 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.
- *
- * \retval #VPX_CODEC_OK
- * Bitstream is parsable and stream information updated
- */
-typedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t *ctx,
- vpx_codec_stream_info_t *si);
-
-/*!\brief control function pointer prototype
- *
- * This function is used to exchange algorithm specific data with the decoder
- * instance. This can be used to implement features specific to a particular
- * algorithm.
- *
- * This function is called by the generic vpx_codec_control() wrapper
- * function, so plugins implementing this interface may trust the input
- * parameters to be properly initialized. However, this interface does not
- * provide type safety for the exchanged data or assign meanings to the
- * control codes. Those details should be specified in the algorithm's
- * header file. In particular, the ctrl_id parameter is guaranteed to exist
- * in the algorithm's control mapping table, and the data parameter may be NULL.
- *
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] ctrl_id Algorithm specific control identifier
- * \param[in,out] data Data to exchange with algorithm instance.
- *
- * \retval #VPX_CODEC_OK
- * The internal state data was deserialized.
- */
-typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
- int ctrl_id,
- va_list ap);
-
-/*!\brief control function pointer mapping
- *
- * This structure stores the mapping between control identifiers and
- * implementing functions. Each algorithm provides a list of these
- * mappings. This list is searched by the vpx_codec_control() wrapper
- * function to determine which function to invoke. The special
- * value {0, NULL} is used to indicate end-of-list, and must be
- * present. The special value {0, <non-null>} can be used as a catch-all
- * mapping. This implies that ctrl_id values chosen by the algorithm
- * \ref MUST be non-zero.
- */
-typedef const struct vpx_codec_ctrl_fn_map {
- int ctrl_id;
- vpx_codec_control_fn_t fn;
-} vpx_codec_ctrl_fn_map_t;
-
-/*!\brief decode data function pointer prototype
- *
- * Processes a buffer of coded data. If the processing results in a new
- * decoded frame becoming available, #VPX_CODEC_CB_PUT_SLICE and
- * #VPX_CODEC_CB_PUT_FRAME events are generated as appropriate. This
- * function is called by the generic vpx_codec_decode() wrapper function,
- * so plugins implementing this interface may trust the input parameters
- * to be properly initialized.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] data Pointer to this block of new coded data. If
- * NULL, a #VPX_CODEC_CB_PUT_FRAME event is posted
- * for the previously decoded frame.
- * \param[in] data_sz Size of the coded data, in bytes.
- *
- * \return Returns #VPX_CODEC_OK if the coded data was processed completely
- * and future pictures can be decoded without error. Otherwise,
- * see the descriptions of the other error codes in ::vpx_codec_err_t
- * for recoverability capabilities.
- */
-typedef vpx_codec_err_t (*vpx_codec_decode_fn_t)(vpx_codec_alg_priv_t *ctx,
- const uint8_t *data,
- unsigned int data_sz,
- void *user_priv,
- long deadline);
-
-/*!\brief Decoded frames iterator
- *
- * Iterates over a list of the frames available for display. The iterator
- * storage should be initialized to NULL to start the iteration. Iteration is
- * complete when this function returns NULL.
- *
- * The list of available frames becomes valid upon completion of the
- * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in out] iter Iterator storage, initialized to NULL
- *
- * \return Returns a pointer to an image, if one is ready for display. Frames
- * produced will always be in PTS (presentation time stamp) order.
- */
-typedef vpx_image_t *(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
- vpx_codec_iter_t *iter);
-
-/*!\brief Pass in external frame buffers for the decoder to use.
- *
- * Registers functions to be called when libvpx needs a frame buffer
- * to decode the current frame and a function to be called when libvpx does
- * not internally reference the frame buffer. This set function must
- * be called before the first call to decode or libvpx will assume the
- * default behavior of allocating frame buffers internally.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] cb_get Pointer to the get callback function
- * \param[in] cb_release Pointer to the release callback function
- * \param[in] cb_priv Callback's private data
- *
- * \retval #VPX_CODEC_OK
- * External frame buffers will be used by libvpx.
- * \retval #VPX_CODEC_INVALID_PARAM
- * One or more of the callbacks were NULL.
- * \retval #VPX_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * using external frame buffers.
- *
- * \note
- * When decoding VP9, the application may be required to pass in at least
- * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame
- * buffers.
- */
-typedef vpx_codec_err_t (*vpx_codec_set_fb_fn_t)(
- vpx_codec_alg_priv_t *ctx,
- vpx_get_frame_buffer_cb_fn_t cb_get,
- vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
-
-/*\brief eXternal Memory Allocation memory map get iterator
- *
- * Iterates over a list of the memory maps requested by the decoder. The
- * iterator storage should be initialized to NULL to start the iteration.
- * Iteration is complete when this function returns NULL.
- *
- * \param[in out] iter Iterator storage, initialized to NULL
- *
- * \return Returns a pointer to an memory segment descriptor, or NULL to
- * indicate end-of-list.
- */
-typedef vpx_codec_err_t (*vpx_codec_get_mmap_fn_t)(const vpx_codec_ctx_t *ctx,
- vpx_codec_mmap_t *mmap,
- vpx_codec_iter_t *iter);
-
-
-/*\brief eXternal Memory Allocation memory map set iterator
- *
- * Sets a memory descriptor inside the decoder instance.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] mmap Memory map to store.
- *
- * \retval #VPX_CODEC_OK
- * The memory map was accepted and stored.
- * \retval #VPX_CODEC_MEM_ERROR
- * The memory map was rejected.
- */
-typedef vpx_codec_err_t (*vpx_codec_set_mmap_fn_t)(vpx_codec_ctx_t *ctx,
- const vpx_codec_mmap_t *mmap);
-
-
-typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
- const vpx_image_t *img,
- vpx_codec_pts_t pts,
- unsigned long duration,
- vpx_enc_frame_flags_t flags,
- unsigned long deadline);
-typedef const vpx_codec_cx_pkt_t *(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_priv_t *ctx,
- vpx_codec_iter_t *iter);
-
-typedef vpx_codec_err_t
-(*vpx_codec_enc_config_set_fn_t)(vpx_codec_alg_priv_t *ctx,
- const vpx_codec_enc_cfg_t *cfg);
-typedef vpx_fixed_buf_t *
-(*vpx_codec_get_global_headers_fn_t)(vpx_codec_alg_priv_t *ctx);
-
-typedef vpx_image_t *
-(*vpx_codec_get_preview_frame_fn_t)(vpx_codec_alg_priv_t *ctx);
-
-typedef vpx_codec_err_t
-(*vpx_codec_enc_mr_get_mem_loc_fn_t)(const vpx_codec_enc_cfg_t *cfg,
- void **mem_loc);
-
-/*!\brief usage configuration mapping
- *
- * This structure stores the mapping between usage identifiers and
- * configuration structures. Each algorithm provides a list of these
- * mappings. This list is searched by the vpx_codec_enc_config_default()
- * wrapper function to determine which config to return. The special value
- * {-1, {0}} is used to indicate end-of-list, and must be present. At least
- * one mapping must be present, in addition to the end-of-list.
- *
- */
-typedef const struct vpx_codec_enc_cfg_map {
- int usage;
- vpx_codec_enc_cfg_t cfg;
-} vpx_codec_enc_cfg_map_t;
-
-#define NOT_IMPLEMENTED 0
-
-/*!\brief Decoder algorithm interface interface
- *
- * All decoders \ref MUST expose a variable of this type.
- */
-struct vpx_codec_iface {
- const char *name; /**< Identification String */
- int abi_version; /**< Implemented ABI version */
- vpx_codec_caps_t caps; /**< Decoder capabilities */
- vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */
- vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */
- vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
- vpx_codec_get_mmap_fn_t get_mmap; /**< \copydoc ::vpx_codec_get_mmap_fn_t */
- vpx_codec_set_mmap_fn_t set_mmap; /**< \copydoc ::vpx_codec_set_mmap_fn_t */
- struct vpx_codec_dec_iface {
- vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
- vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_get_si_fn_t */
- vpx_codec_decode_fn_t decode; /**< \copydoc ::vpx_codec_decode_fn_t */
- vpx_codec_get_frame_fn_t get_frame; /**< \copydoc ::vpx_codec_get_frame_fn_t */
- vpx_codec_set_fb_fn_t set_fb_fn; /**< \copydoc ::vpx_codec_set_fb_fn_t */
- } dec;
- struct vpx_codec_enc_iface {
- vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_enc_cfg_map_t */
- vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_encode_fn_t */
- vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_get_cx_data_fn_t */
- vpx_codec_enc_config_set_fn_t cfg_set; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
- vpx_codec_get_global_headers_fn_t get_glob_hdrs; /**< \copydoc ::vpx_codec_get_global_headers_fn_t */
- vpx_codec_get_preview_frame_fn_t get_preview; /**< \copydoc ::vpx_codec_get_preview_frame_fn_t */
- vpx_codec_enc_mr_get_mem_loc_fn_t mr_get_mem_loc; /**< \copydoc ::vpx_codec_enc_mr_get_mem_loc_fn_t */
- } enc;
-};
-
-/*!\brief Callback function pointer / user data pair storage */
-typedef struct vpx_codec_priv_cb_pair {
- union {
- vpx_codec_put_frame_cb_fn_t put_frame;
- vpx_codec_put_slice_cb_fn_t put_slice;
- } u;
- void *user_priv;
-} vpx_codec_priv_cb_pair_t;
-
-
-/*!\brief Instance private storage
- *
- * This structure is allocated by the algorithm's init function. It can be
- * extended in one of two ways. First, a second, algorithm specific structure
- * can be allocated and the priv member pointed to it. Alternatively, this
- * structure can be made the first member of the algorithm specific structure,
- * and the pointer cast to the proper type.
- */
-struct vpx_codec_priv {
- unsigned int sz;
- vpx_codec_iface_t *iface;
- struct vpx_codec_alg_priv *alg_priv;
- const char *err_detail;
- vpx_codec_flags_t init_flags;
- struct {
- vpx_codec_priv_cb_pair_t put_frame_cb;
- vpx_codec_priv_cb_pair_t put_slice_cb;
- } dec;
- struct {
- int tbd;
- struct vpx_fixed_buf cx_data_dst_buf;
- unsigned int cx_data_pad_before;
- unsigned int cx_data_pad_after;
- vpx_codec_cx_pkt_t cx_data_pkt;
- unsigned int total_encoders;
- } enc;
-};
-
-/*
- * Multi-resolution encoding internal configuration
- */
-struct vpx_codec_priv_enc_mr_cfg
-{
- unsigned int mr_total_resolutions;
- unsigned int mr_encoder_id;
- struct vpx_rational mr_down_sampling_factor;
- void* mr_low_res_mode_info;
-};
-
-#undef VPX_CTRL_USE_TYPE
-#define VPX_CTRL_USE_TYPE(id, typ) \
- static typ id##__value(va_list args) {return va_arg(args, typ);} \
- static typ id##__convert(void *x)\
- {\
- union\
- {\
- void *x;\
- typ d;\
- } u;\
- u.x = x;\
- return u.d;\
- }
-
-
-#undef VPX_CTRL_USE_TYPE_DEPRECATED
-#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
- static typ id##__value(va_list args) {return va_arg(args, typ);} \
- static typ id##__convert(void *x)\
- {\
- union\
- {\
- void *x;\
- typ d;\
- } u;\
- u.x = x;\
- return u.d;\
- }
-
-#define CAST(id, arg) id##__value(arg)
-#define RECAST(id, x) id##__convert(x)
-
-
-/* CODEC_INTERFACE convenience macro
- *
- * By convention, each codec interface is a struct with extern linkage, where
- * the symbol is suffixed with _algo. A getter function is also defined to
- * return a pointer to the struct, since in some cases it's easier to work
- * with text symbols than data symbols (see issue #169). This function has
- * the same name as the struct, less the _algo suffix. The CODEC_INTERFACE
- * macro is provided to define this getter function automatically.
- */
-#define CODEC_INTERFACE(id)\
- vpx_codec_iface_t* id(void) { return &id##_algo; }\
- vpx_codec_iface_t id##_algo
-
-
-/* Internal Utility Functions
- *
- * The following functions are intended to be used inside algorithms as
- * utilities for manipulating vpx_codec_* data structures.
- */
-struct vpx_codec_pkt_list {
- unsigned int cnt;
- unsigned int max;
- struct vpx_codec_cx_pkt pkts[1];
-};
-
-#define vpx_codec_pkt_list_decl(n)\
- union {struct vpx_codec_pkt_list head;\
- struct {struct vpx_codec_pkt_list head;\
- struct vpx_codec_cx_pkt pkts[n];} alloc;}
-
-#define vpx_codec_pkt_list_init(m)\
- (m)->alloc.head.cnt = 0,\
- (m)->alloc.head.max = sizeof((m)->alloc.pkts) / sizeof((m)->alloc.pkts[0])
-
-int
-vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *,
- const struct vpx_codec_cx_pkt *);
-
-const vpx_codec_cx_pkt_t *
-vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
- vpx_codec_iter_t *iter);
-
-
-#include <stdio.h>
-#include <setjmp.h>
-
-struct vpx_internal_error_info {
- vpx_codec_err_t error_code;
- int has_detail;
- char detail[80];
- int setjmp;
- jmp_buf jmp;
-};
-
-static void vpx_internal_error(struct vpx_internal_error_info *info,
- vpx_codec_err_t error,
- const char *fmt,
- ...) {
- va_list ap;
-
- info->error_code = error;
- info->has_detail = 0;
-
- if (fmt) {
- size_t sz = sizeof(info->detail);
-
- info->has_detail = 1;
- va_start(ap, fmt);
- vsnprintf(info->detail, sz - 1, fmt, ap);
- va_end(ap);
- info->detail[sz - 1] = '\0';
- }
-
- if (info->setjmp)
- longjmp(info->jmp, info->error_code);
-}
-
-//------------------------------------------------------------------------------
-// mmap interface
-
-typedef struct {
- unsigned int id;
- unsigned long sz;
- unsigned int align;
- unsigned int flags;
- unsigned long (*calc_sz)(const vpx_codec_dec_cfg_t *, vpx_codec_flags_t);
-} mem_req_t;
-
-// Allocates mmap.priv and sets mmap.base based on mmap.sz/align/flags
-// requirements.
-// Returns #VPX_CODEC_OK on success, #VPX_CODEC_MEM_ERROR otherwise.
-vpx_codec_err_t vpx_mmap_alloc(vpx_codec_mmap_t *mmap);
-
-// Frees mmap.base allocated by a call to vpx_mmap_alloc().
-void vpx_mmap_dtor(vpx_codec_mmap_t *mmap);
-
-// Checks each mmap has the size requirement specificied by mem_reqs.
-// Returns #VPX_CODEC_OK on success, #VPX_CODEC_MEM_ERROR otherwise.
-vpx_codec_err_t vpx_validate_mmaps(const vpx_codec_stream_info_t *si,
- const vpx_codec_mmap_t *mmaps,
- const mem_req_t *mem_reqs, int nreqs,
- vpx_codec_flags_t init_flags);
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/internal/vpx_psnr.h b/videocodec/libvpx_internal/libvpx/vpx/internal/vpx_psnr.h
deleted file mode 100644
index 07d81bb..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/internal/vpx_psnr.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_INTERNAL_VPX_PSNR_H_
-#define VPX_INTERNAL_VPX_PSNR_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// TODO(dkovalev) change vpx_sse_to_psnr signature: double -> int64_t
-
-/*!\brief Converts SSE to PSNR
- *
- * Converts sum of squared errros (SSE) to peak signal-to-noise ratio (PNSR).
- *
- * \param[in] samples Number of samples
- * \param[in] peak Max sample value
- * \param[in] sse Sum of squared errors
- */
-double vpx_sse_to_psnr(double samples, double peak, double sse);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_INTERNAL_VPX_PSNR_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/src/svc_encodeframe.c b/videocodec/libvpx_internal/libvpx/vpx/src/svc_encodeframe.c
deleted file mode 100644
index 76aacd2..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/src/svc_encodeframe.c
+++ /dev/null
@@ -1,1144 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-/**
- * @file
- * VP9 SVC encoding support via libvpx
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define VPX_DISABLE_CTRL_TYPECHECKS 1
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "vpx/svc_context.h"
-#include "vpx/vp8cx.h"
-#include "vpx/vpx_encoder.h"
-
-#ifdef __MINGW32__
-#define strtok_r strtok_s
-#ifndef MINGW_HAS_SECURE_API
-// proto from /usr/x86_64-w64-mingw32/include/sec_api/string_s.h
-_CRTIMP char *__cdecl strtok_s(char *str, const char *delim, char **context);
-#endif /* MINGW_HAS_SECURE_API */
-#endif /* __MINGW32__ */
-
-#ifdef _MSC_VER
-#define strdup _strdup
-#define strtok_r strtok_s
-#endif
-
-#define SVC_REFERENCE_FRAMES 8
-#define SUPERFRAME_SLOTS (8)
-#define SUPERFRAME_BUFFER_SIZE (SUPERFRAME_SLOTS * sizeof(uint32_t) + 2)
-#define OPTION_BUFFER_SIZE 256
-#define COMPONENTS 4 // psnr & sse statistics maintained for total, y, u, v
-
-static const char *DEFAULT_QUANTIZER_VALUES = "60,53,39,33,27";
-static const char *DEFAULT_SCALE_FACTORS = "4/16,5/16,7/16,11/16,16/16";
-
-typedef struct SvcInternal {
- char options[OPTION_BUFFER_SIZE]; // set by vpx_svc_set_options
- char quantizers[OPTION_BUFFER_SIZE]; // set by vpx_svc_set_quantizers
- char quantizers_keyframe[OPTION_BUFFER_SIZE]; // set by
- // vpx_svc_set_quantizers
- char scale_factors[OPTION_BUFFER_SIZE]; // set by vpx_svc_set_scale_factors
-
- // values extracted from option, quantizers
- int scaling_factor_num[VPX_SS_MAX_LAYERS];
- int scaling_factor_den[VPX_SS_MAX_LAYERS];
- int quantizer_keyframe[VPX_SS_MAX_LAYERS];
- int quantizer[VPX_SS_MAX_LAYERS];
-
- // accumulated statistics
- double psnr_sum[VPX_SS_MAX_LAYERS][COMPONENTS]; // total/Y/U/V
- uint64_t sse_sum[VPX_SS_MAX_LAYERS][COMPONENTS];
- uint32_t bytes_sum[VPX_SS_MAX_LAYERS];
-
- // codec encoding values
- int width; // width of highest layer
- int height; // height of highest layer
- int kf_dist; // distance between keyframes
-
- // state variables
- int encode_frame_count;
- int frame_within_gop;
- vpx_enc_frame_flags_t enc_frame_flags;
- int layers;
- int layer;
- int is_keyframe;
-
- size_t frame_size;
- size_t buffer_size;
- void *buffer;
-
- char *rc_stats_buf;
- size_t rc_stats_buf_size;
- size_t rc_stats_buf_used;
-
- char message_buffer[2048];
- vpx_codec_ctx_t *codec_ctx;
-} SvcInternal;
-
-// Superframe is used to generate an index of individual frames (i.e., layers)
-struct Superframe {
- int count;
- uint32_t sizes[SUPERFRAME_SLOTS];
- uint32_t magnitude;
- uint8_t buffer[SUPERFRAME_BUFFER_SIZE];
- size_t index_size;
-};
-
-// One encoded frame layer
-struct LayerData {
- void *buf; // compressed data buffer
- size_t size; // length of compressed data
- struct LayerData *next;
-};
-
-// create LayerData from encoder output
-static struct LayerData *ld_create(void *buf, size_t size) {
- struct LayerData *const layer_data =
- (struct LayerData *)malloc(sizeof(*layer_data));
- if (layer_data == NULL) {
- return NULL;
- }
- layer_data->buf = malloc(size);
- if (layer_data->buf == NULL) {
- free(layer_data);
- return NULL;
- }
- memcpy(layer_data->buf, buf, size);
- layer_data->size = size;
- return layer_data;
-}
-
-// free LayerData
-static void ld_free(struct LayerData *layer_data) {
- if (layer_data) {
- if (layer_data->buf) {
- free(layer_data->buf);
- layer_data->buf = NULL;
- }
- free(layer_data);
- }
-}
-
-// add layer data to list
-static void ld_list_add(struct LayerData **list, struct LayerData *layer_data) {
- struct LayerData **p = list;
-
- while (*p != NULL) p = &(*p)->next;
- *p = layer_data;
- layer_data->next = NULL;
-}
-
-// get accumulated size of layer data
-static size_t ld_list_get_buffer_size(struct LayerData *list) {
- struct LayerData *p;
- size_t size = 0;
-
- for (p = list; p != NULL; p = p->next) {
- size += p->size;
- }
- return size;
-}
-
-// copy layer data to buffer
-static void ld_list_copy_to_buffer(struct LayerData *list, uint8_t *buffer) {
- struct LayerData *p;
-
- for (p = list; p != NULL; p = p->next) {
- buffer[0] = 1;
- memcpy(buffer, p->buf, p->size);
- buffer += p->size;
- }
-}
-
-// free layer data list
-static void ld_list_free(struct LayerData *list) {
- struct LayerData *p = list;
-
- while (p) {
- list = list->next;
- ld_free(p);
- p = list;
- }
-}
-
-static void sf_create_index(struct Superframe *sf) {
- uint8_t marker = 0xc0;
- int i;
- uint32_t mag, mask;
- uint8_t *bufp;
-
- if (sf->count == 0 || sf->count >= 8) return;
-
- // Add the number of frames to the marker byte
- marker |= sf->count - 1;
-
- // Choose the magnitude
- for (mag = 0, mask = 0xff; mag < 4; ++mag) {
- if (sf->magnitude < mask) break;
- mask <<= 8;
- mask |= 0xff;
- }
- marker |= mag << 3;
-
- // Write the index
- sf->index_size = 2 + (mag + 1) * sf->count;
- bufp = sf->buffer;
-
- *bufp++ = marker;
- for (i = 0; i < sf->count; ++i) {
- int this_sz = sf->sizes[i];
- uint32_t j;
-
- for (j = 0; j <= mag; ++j) {
- *bufp++ = this_sz & 0xff;
- this_sz >>= 8;
- }
- }
- *bufp++ = marker;
-}
-
-static SvcInternal *get_svc_internal(SvcContext *svc_ctx) {
- if (svc_ctx == NULL) return NULL;
- if (svc_ctx->internal == NULL) {
- SvcInternal *const si = (SvcInternal *)malloc(sizeof(*si));
- if (si != NULL) {
- memset(si, 0, sizeof(*si));
- }
- svc_ctx->internal = si;
- }
- return (SvcInternal *)svc_ctx->internal;
-}
-
-static const SvcInternal *get_const_svc_internal(const SvcContext *svc_ctx) {
- if (svc_ctx == NULL) return NULL;
- return (const SvcInternal *)svc_ctx->internal;
-}
-
-static void svc_log_reset(SvcContext *svc_ctx) {
- SvcInternal *const si = (SvcInternal *)svc_ctx->internal;
- si->message_buffer[0] = '\0';
-}
-
-static int svc_log(SvcContext *svc_ctx, int level, const char *fmt, ...) {
- char buf[512];
- int retval = 0;
- va_list ap;
- SvcInternal *const si = get_svc_internal(svc_ctx);
-
- if (level > svc_ctx->log_level) {
- return retval;
- }
-
- va_start(ap, fmt);
- retval = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
-
- if (svc_ctx->log_print) {
- printf("%s", buf);
- } else {
- strncat(si->message_buffer, buf,
- sizeof(si->message_buffer) - strlen(si->message_buffer) - 1);
- }
-
- if (level == SVC_LOG_ERROR) {
- si->codec_ctx->err_detail = si->message_buffer;
- }
- return retval;
-}
-
-static vpx_codec_err_t set_option_encoding_mode(SvcContext *svc_ctx,
- const char *value_str) {
- if (strcmp(value_str, "i") == 0) {
- svc_ctx->encoding_mode = INTER_LAYER_PREDICTION_I;
- } else if (strcmp(value_str, "alt-ip") == 0) {
- svc_ctx->encoding_mode = ALT_INTER_LAYER_PREDICTION_IP;
- } else if (strcmp(value_str, "ip") == 0) {
- svc_ctx->encoding_mode = INTER_LAYER_PREDICTION_IP;
- } else if (strcmp(value_str, "gf") == 0) {
- svc_ctx->encoding_mode = USE_GOLDEN_FRAME;
- } else {
- svc_log(svc_ctx, SVC_LOG_ERROR, "invalid encoding mode: %s", value_str);
- return VPX_CODEC_INVALID_PARAM;
- }
- return VPX_CODEC_OK;
-}
-
-static vpx_codec_err_t parse_quantizer_values(SvcContext *svc_ctx,
- const char *quantizer_values,
- const int is_keyframe) {
- char *input_string;
- char *token;
- const char *delim = ",";
- char *save_ptr;
- int found = 0;
- int i, q;
- vpx_codec_err_t res = VPX_CODEC_OK;
- SvcInternal *const si = get_svc_internal(svc_ctx);
-
- if (quantizer_values == NULL || strlen(quantizer_values) == 0) {
- if (is_keyframe) {
- // If there non settings for key frame, we will apply settings from
- // non key frame. So just simply return here.
- return VPX_CODEC_INVALID_PARAM;
- }
- input_string = strdup(DEFAULT_QUANTIZER_VALUES);
- } else {
- input_string = strdup(quantizer_values);
- }
-
- token = strtok_r(input_string, delim, &save_ptr);
- for (i = 0; i < svc_ctx->spatial_layers; ++i) {
- if (token != NULL) {
- q = atoi(token);
- if (q <= 0 || q > 100) {
- svc_log(svc_ctx, SVC_LOG_ERROR,
- "svc-quantizer-values: invalid value %s\n", token);
- res = VPX_CODEC_INVALID_PARAM;
- break;
- }
- token = strtok_r(NULL, delim, &save_ptr);
- found = i + 1;
- } else {
- q = 0;
- }
- if (is_keyframe) {
- si->quantizer_keyframe[i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers]
- = q;
- } else {
- si->quantizer[i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers] = q;
- }
- }
- if (res == VPX_CODEC_OK && found != svc_ctx->spatial_layers) {
- svc_log(svc_ctx, SVC_LOG_ERROR,
- "svc: quantizers: %d values required, but only %d specified\n",
- svc_ctx->spatial_layers, found);
- res = VPX_CODEC_INVALID_PARAM;
- }
- free(input_string);
- return res;
-}
-
-static void log_invalid_scale_factor(SvcContext *svc_ctx, const char *value) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "svc scale-factors: invalid value %s\n",
- value);
-}
-
-static vpx_codec_err_t parse_scale_factors(SvcContext *svc_ctx,
- const char *scale_factors) {
- char *input_string;
- char *token;
- const char *delim = ",";
- char *save_ptr;
- int found = 0;
- int i;
- int64_t num, den;
- vpx_codec_err_t res = VPX_CODEC_OK;
- SvcInternal *const si = get_svc_internal(svc_ctx);
-
- if (scale_factors == NULL || strlen(scale_factors) == 0) {
- input_string = strdup(DEFAULT_SCALE_FACTORS);
- } else {
- input_string = strdup(scale_factors);
- }
- token = strtok_r(input_string, delim, &save_ptr);
- for (i = 0; i < svc_ctx->spatial_layers; ++i) {
- num = den = 0;
- if (token != NULL) {
- num = strtol(token, &token, 10);
- if (num <= 0) {
- log_invalid_scale_factor(svc_ctx, token);
- res = VPX_CODEC_INVALID_PARAM;
- break;
- }
- if (*token++ != '/') {
- log_invalid_scale_factor(svc_ctx, token);
- res = VPX_CODEC_INVALID_PARAM;
- break;
- }
- den = strtol(token, &token, 10);
- if (den <= 0) {
- log_invalid_scale_factor(svc_ctx, token);
- res = VPX_CODEC_INVALID_PARAM;
- break;
- }
- token = strtok_r(NULL, delim, &save_ptr);
- found = i + 1;
- }
- si->scaling_factor_num[i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers] =
- (int)num;
- si->scaling_factor_den[i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers] =
- (int)den;
- }
- if (res == VPX_CODEC_OK && found != svc_ctx->spatial_layers) {
- svc_log(svc_ctx, SVC_LOG_ERROR,
- "svc: scale-factors: %d values required, but only %d specified\n",
- svc_ctx->spatial_layers, found);
- res = VPX_CODEC_INVALID_PARAM;
- }
- free(input_string);
- return res;
-}
-
-/**
- * Parse SVC encoding options
- * Format: encoding-mode=<svc_mode>,layers=<layer_count>
- * scale-factors=<n1>/<d1>,<n2>/<d2>,...
- * quantizers=<q1>,<q2>,...
- * svc_mode = [i|ip|alt_ip|gf]
- */
-static vpx_codec_err_t parse_options(SvcContext *svc_ctx, const char *options) {
- char *input_string;
- char *option_name;
- char *option_value;
- char *input_ptr;
- int is_keyframe_qaunt_set = 0;
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if (options == NULL) return VPX_CODEC_OK;
- input_string = strdup(options);
-
- // parse option name
- option_name = strtok_r(input_string, "=", &input_ptr);
- while (option_name != NULL) {
- // parse option value
- option_value = strtok_r(NULL, " ", &input_ptr);
- if (option_value == NULL) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "option missing value: %s\n",
- option_name);
- res = VPX_CODEC_INVALID_PARAM;
- break;
- }
- if (strcmp("encoding-mode", option_name) == 0) {
- res = set_option_encoding_mode(svc_ctx, option_value);
- if (res != VPX_CODEC_OK) break;
- } else if (strcmp("layers", option_name) == 0) {
- svc_ctx->spatial_layers = atoi(option_value);
- } else if (strcmp("scale-factors", option_name) == 0) {
- res = parse_scale_factors(svc_ctx, option_value);
- if (res != VPX_CODEC_OK) break;
- } else if (strcmp("quantizers", option_name) == 0) {
- res = parse_quantizer_values(svc_ctx, option_value, 0);
- if (res != VPX_CODEC_OK) break;
- if (!is_keyframe_qaunt_set) {
- SvcInternal *const si = get_svc_internal(svc_ctx);
- memcpy(get_svc_internal(svc_ctx)->quantizer_keyframe, si->quantizer,
- sizeof(si->quantizer));
- }
- } else if (strcmp("quantizers-keyframe", option_name) == 0) {
- res = parse_quantizer_values(svc_ctx, option_value, 1);
- if (res != VPX_CODEC_OK) break;
- is_keyframe_qaunt_set = 1;
- } else {
- svc_log(svc_ctx, SVC_LOG_ERROR, "invalid option: %s\n", option_name);
- res = VPX_CODEC_INVALID_PARAM;
- break;
- }
- option_name = strtok_r(NULL, "=", &input_ptr);
- }
- free(input_string);
- return res;
-}
-
-vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options) {
- SvcInternal *const si = get_svc_internal(svc_ctx);
- if (svc_ctx == NULL || options == NULL || si == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- }
- strncpy(si->options, options, sizeof(si->options));
- si->options[sizeof(si->options) - 1] = '\0';
- return VPX_CODEC_OK;
-}
-
-vpx_codec_err_t vpx_svc_set_quantizers(SvcContext *svc_ctx,
- const char *quantizers,
- const int is_for_keyframe) {
- SvcInternal *const si = get_svc_internal(svc_ctx);
- if (svc_ctx == NULL || quantizers == NULL || si == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- }
- if (is_for_keyframe) {
- strncpy(si->quantizers_keyframe, quantizers, sizeof(si->quantizers));
- si->quantizers_keyframe[sizeof(si->quantizers_keyframe) - 1] = '\0';
- } else {
- strncpy(si->quantizers, quantizers, sizeof(si->quantizers));
- si->quantizers[sizeof(si->quantizers) - 1] = '\0';
- }
- return VPX_CODEC_OK;
-}
-
-vpx_codec_err_t vpx_svc_set_scale_factors(SvcContext *svc_ctx,
- const char *scale_factors) {
- SvcInternal *const si = get_svc_internal(svc_ctx);
- if (svc_ctx == NULL || scale_factors == NULL || si == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- }
- strncpy(si->scale_factors, scale_factors, sizeof(si->scale_factors));
- si->scale_factors[sizeof(si->scale_factors) - 1] = '\0';
- return VPX_CODEC_OK;
-}
-
-vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *enc_cfg) {
- int max_intra_size_pct;
- vpx_codec_err_t res;
- SvcInternal *const si = get_svc_internal(svc_ctx);
- if (svc_ctx == NULL || codec_ctx == NULL || iface == NULL ||
- enc_cfg == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- }
- if (si == NULL) return VPX_CODEC_MEM_ERROR;
-
- si->codec_ctx = codec_ctx;
-
- si->width = enc_cfg->g_w;
- si->height = enc_cfg->g_h;
-
- if (enc_cfg->kf_max_dist < 2) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "key frame distance too small: %d\n",
- enc_cfg->kf_max_dist);
- return VPX_CODEC_INVALID_PARAM;
- }
- si->kf_dist = enc_cfg->kf_max_dist;
-
- if (svc_ctx->spatial_layers == 0)
- svc_ctx->spatial_layers = VPX_SS_DEFAULT_LAYERS;
- if (svc_ctx->spatial_layers < 1 ||
- svc_ctx->spatial_layers > VPX_SS_MAX_LAYERS) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "spatial layers: invalid value: %d\n",
- svc_ctx->spatial_layers);
- return VPX_CODEC_INVALID_PARAM;
- }
-
- res = parse_quantizer_values(svc_ctx, si->quantizers, 0);
- if (res != VPX_CODEC_OK) return res;
-
- res = parse_quantizer_values(svc_ctx, si->quantizers_keyframe, 1);
- if (res != VPX_CODEC_OK)
- memcpy(si->quantizer_keyframe, si->quantizer, sizeof(si->quantizer));
-
- res = parse_scale_factors(svc_ctx, si->scale_factors);
- if (res != VPX_CODEC_OK) return res;
-
- // Parse aggregate command line options. Options must start with
- // "layers=xx" then followed by other options
- res = parse_options(svc_ctx, si->options);
- if (res != VPX_CODEC_OK) return res;
-
- si->layers = svc_ctx->spatial_layers;
-
- // Assign target bitrate for each layer. We calculate the ratio
- // from the resolution for now.
- // TODO(Minghai): Optimize the mechanism of allocating bits after
- // implementing svc two pass rate control.
- if (si->layers > 1) {
- int i;
- float total = 0;
- float alloc_ratio[VPX_SS_MAX_LAYERS] = {0};
-
- assert(si->layers <= VPX_SS_MAX_LAYERS);
- for (i = 0; i < si->layers; ++i) {
- int pos = i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers;
- if (pos < VPX_SS_MAX_LAYERS && si->scaling_factor_den[pos] > 0) {
- alloc_ratio[i] = (float)(si->scaling_factor_num[pos] * 1.0 /
- si->scaling_factor_den[pos]);
-
- alloc_ratio[i] *= alloc_ratio[i];
- total += alloc_ratio[i];
- }
- }
-
- for (i = 0; i < si->layers; ++i) {
- if (total > 0) {
- enc_cfg->ss_target_bitrate[i] = (unsigned int)
- (enc_cfg->rc_target_bitrate * alloc_ratio[i] / total);
- }
- }
- }
-
- // modify encoder configuration
- enc_cfg->ss_number_layers = si->layers;
- enc_cfg->ts_number_layers = 1; // Temporal layers not used in this encoder.
- enc_cfg->kf_mode = VPX_KF_DISABLED;
- // Lag in frames not currently supported
- enc_cfg->g_lag_in_frames = 0;
-
- // TODO(ivanmaltz): determine if these values need to be set explicitly for
- // svc, or if the normal default/override mechanism can be used
- enc_cfg->rc_dropframe_thresh = 0;
- enc_cfg->rc_end_usage = VPX_CBR;
- enc_cfg->rc_resize_allowed = 0;
-
- if (enc_cfg->g_pass == VPX_RC_ONE_PASS) {
- enc_cfg->rc_min_quantizer = 33;
- enc_cfg->rc_max_quantizer = 33;
- }
-
- enc_cfg->rc_undershoot_pct = 100;
- enc_cfg->rc_overshoot_pct = 15;
- enc_cfg->rc_buf_initial_sz = 500;
- enc_cfg->rc_buf_optimal_sz = 600;
- enc_cfg->rc_buf_sz = 1000;
- enc_cfg->g_error_resilient = 1;
-
- // Initialize codec
- res = vpx_codec_enc_init(codec_ctx, iface, enc_cfg, VPX_CODEC_USE_PSNR);
- if (res != VPX_CODEC_OK) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "svc_enc_init error\n");
- return res;
- }
-
- vpx_codec_control(codec_ctx, VP9E_SET_SVC, 1);
- vpx_codec_control(codec_ctx, VP8E_SET_CPUUSED, 1);
- vpx_codec_control(codec_ctx, VP8E_SET_STATIC_THRESHOLD, 1);
- vpx_codec_control(codec_ctx, VP8E_SET_NOISE_SENSITIVITY, 1);
- vpx_codec_control(codec_ctx, VP8E_SET_TOKEN_PARTITIONS, 1);
-
- max_intra_size_pct =
- (int)(((double)enc_cfg->rc_buf_optimal_sz * 0.5) *
- ((double)enc_cfg->g_timebase.den / enc_cfg->g_timebase.num) / 10.0);
- vpx_codec_control(codec_ctx, VP8E_SET_MAX_INTRA_BITRATE_PCT,
- max_intra_size_pct);
- return VPX_CODEC_OK;
-}
-
-// SVC Algorithm flags - these get mapped to VP8_EFLAG_* defined in vp8cx.h
-
-// encoder should reference the last frame
-#define USE_LAST (1 << 0)
-
-// encoder should reference the alt ref frame
-#define USE_ARF (1 << 1)
-
-// encoder should reference the golden frame
-#define USE_GF (1 << 2)
-
-// encoder should copy current frame to the last frame buffer
-#define UPDATE_LAST (1 << 3)
-
-// encoder should copy current frame to the alt ref frame buffer
-#define UPDATE_ARF (1 << 4)
-
-// encoder should copy current frame to the golden frame
-#define UPDATE_GF (1 << 5)
-
-static int map_vp8_flags(int svc_flags) {
- int flags = 0;
-
- if (!(svc_flags & USE_LAST)) flags |= VP8_EFLAG_NO_REF_LAST;
- if (!(svc_flags & USE_ARF)) flags |= VP8_EFLAG_NO_REF_ARF;
- if (!(svc_flags & USE_GF)) flags |= VP8_EFLAG_NO_REF_GF;
-
- if (svc_flags & UPDATE_LAST) {
- // last is updated automatically
- } else {
- flags |= VP8_EFLAG_NO_UPD_LAST;
- }
- if (svc_flags & UPDATE_ARF) {
- flags |= VP8_EFLAG_FORCE_ARF;
- } else {
- flags |= VP8_EFLAG_NO_UPD_ARF;
- }
- if (svc_flags & UPDATE_GF) {
- flags |= VP8_EFLAG_FORCE_GF;
- } else {
- flags |= VP8_EFLAG_NO_UPD_GF;
- }
- return flags;
-}
-
-static void calculate_enc_frame_flags(SvcContext *svc_ctx) {
- vpx_enc_frame_flags_t flags = VPX_EFLAG_FORCE_KF;
- SvcInternal *const si = get_svc_internal(svc_ctx);
- const int is_keyframe = (si->frame_within_gop == 0);
-
- // keyframe layer zero is identical for all modes
- if (is_keyframe && si->layer == 0) {
- si->enc_frame_flags = VPX_EFLAG_FORCE_KF;
- return;
- }
-
- switch (svc_ctx->encoding_mode) {
- case ALT_INTER_LAYER_PREDICTION_IP:
- if (si->layer == 0) {
- flags = map_vp8_flags(USE_LAST | UPDATE_LAST);
- } else if (is_keyframe) {
- if (si->layer == si->layers - 1) {
- flags = map_vp8_flags(USE_ARF | UPDATE_LAST);
- } else {
- flags = map_vp8_flags(USE_ARF | UPDATE_LAST | UPDATE_GF);
- }
- } else {
- flags = map_vp8_flags(USE_LAST | USE_ARF | UPDATE_LAST);
- }
- break;
- case INTER_LAYER_PREDICTION_I:
- if (si->layer == 0) {
- flags = map_vp8_flags(USE_LAST | UPDATE_LAST);
- } else if (is_keyframe) {
- flags = map_vp8_flags(USE_ARF | UPDATE_LAST);
- } else {
- flags = map_vp8_flags(USE_LAST | UPDATE_LAST);
- }
- break;
- case INTER_LAYER_PREDICTION_IP:
- if (si->layer == 0) {
- flags = map_vp8_flags(USE_LAST | UPDATE_LAST);
- } else if (is_keyframe) {
- flags = map_vp8_flags(USE_ARF | UPDATE_LAST);
- } else {
- flags = map_vp8_flags(USE_LAST | USE_ARF | UPDATE_LAST);
- }
- break;
- case USE_GOLDEN_FRAME:
- if (2 * si->layers - SVC_REFERENCE_FRAMES <= si->layer) {
- if (si->layer == 0) {
- flags = map_vp8_flags(USE_LAST | USE_GF | UPDATE_LAST);
- } else if (is_keyframe) {
- flags = map_vp8_flags(USE_ARF | UPDATE_LAST | UPDATE_GF);
- } else {
- flags = map_vp8_flags(USE_LAST | USE_ARF | USE_GF | UPDATE_LAST);
- }
- } else {
- if (si->layer == 0) {
- flags = map_vp8_flags(USE_LAST | UPDATE_LAST);
- } else if (is_keyframe) {
- flags = map_vp8_flags(USE_ARF | UPDATE_LAST);
- } else {
- flags = map_vp8_flags(USE_LAST | UPDATE_LAST);
- }
- }
- break;
- default:
- svc_log(svc_ctx, SVC_LOG_ERROR, "unexpected encoding mode: %d\n",
- svc_ctx->encoding_mode);
- break;
- }
- si->enc_frame_flags = flags;
-}
-
-vpx_codec_err_t vpx_svc_get_layer_resolution(const SvcContext *svc_ctx,
- int layer,
- unsigned int *width,
- unsigned int *height) {
- int w, h, index, num, den;
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
-
- if (svc_ctx == NULL || si == NULL || width == NULL || height == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- }
- if (layer < 0 || layer >= si->layers) return VPX_CODEC_INVALID_PARAM;
-
- index = layer + VPX_SS_MAX_LAYERS - si->layers;
- num = si->scaling_factor_num[index];
- den = si->scaling_factor_den[index];
- if (num == 0 || den == 0) return VPX_CODEC_INVALID_PARAM;
-
- w = si->width * num / den;
- h = si->height * num / den;
-
- // make height and width even to make chrome player happy
- w += w % 2;
- h += h % 2;
-
- *width = w;
- *height = h;
-
- return VPX_CODEC_OK;
-}
-
-static void set_svc_parameters(SvcContext *svc_ctx,
- vpx_codec_ctx_t *codec_ctx) {
- int layer, layer_index;
- vpx_svc_parameters_t svc_params;
- SvcInternal *const si = get_svc_internal(svc_ctx);
-
- memset(&svc_params, 0, sizeof(svc_params));
- svc_params.temporal_layer = 0;
- svc_params.spatial_layer = si->layer;
- svc_params.flags = si->enc_frame_flags;
-
- layer = si->layer;
- if (svc_ctx->encoding_mode == ALT_INTER_LAYER_PREDICTION_IP &&
- si->frame_within_gop == 0) {
- // layers 1 & 3 don't exist in this mode, use the higher one
- if (layer == 0 || layer == 2) {
- layer += 1;
- }
- }
- if (VPX_CODEC_OK != vpx_svc_get_layer_resolution(svc_ctx, layer,
- &svc_params.width,
- &svc_params.height)) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "vpx_svc_get_layer_resolution failed\n");
- }
- layer_index = layer + VPX_SS_MAX_LAYERS - si->layers;
-
- if (codec_ctx->config.enc->g_pass == VPX_RC_ONE_PASS) {
- if (vpx_svc_is_keyframe(svc_ctx)) {
- svc_params.min_quantizer = si->quantizer_keyframe[layer_index];
- svc_params.max_quantizer = si->quantizer_keyframe[layer_index];
- } else {
- svc_params.min_quantizer = si->quantizer[layer_index];
- svc_params.max_quantizer = si->quantizer[layer_index];
- }
- } else {
- svc_params.min_quantizer = codec_ctx->config.enc->rc_min_quantizer;
- svc_params.max_quantizer = codec_ctx->config.enc->rc_max_quantizer;
- }
-
- svc_params.distance_from_i_frame = si->frame_within_gop;
-
- // Use buffer i for layer i LST
- svc_params.lst_fb_idx = si->layer;
-
- // Use buffer i-1 for layer i Alt (Inter-layer prediction)
- if (si->layer != 0) {
- const int use_higher_layer =
- svc_ctx->encoding_mode == ALT_INTER_LAYER_PREDICTION_IP &&
- si->frame_within_gop == 0;
- svc_params.alt_fb_idx = use_higher_layer ? si->layer - 2 : si->layer - 1;
- }
-
- if (svc_ctx->encoding_mode == ALT_INTER_LAYER_PREDICTION_IP) {
- svc_params.gld_fb_idx = si->layer + 1;
- } else {
- if (si->layer < 2 * si->layers - SVC_REFERENCE_FRAMES)
- svc_params.gld_fb_idx = svc_params.lst_fb_idx;
- else
- svc_params.gld_fb_idx = 2 * si->layers - 1 - si->layer;
- }
-
- svc_log(svc_ctx, SVC_LOG_DEBUG, "SVC frame: %d, layer: %d, %dx%d, q: %d\n",
- si->encode_frame_count, si->layer, svc_params.width,
- svc_params.height, svc_params.min_quantizer);
-
- if (svc_params.flags == VPX_EFLAG_FORCE_KF) {
- svc_log(svc_ctx, SVC_LOG_DEBUG, "flags == VPX_EFLAG_FORCE_KF\n");
- } else {
- svc_log(
- svc_ctx, SVC_LOG_DEBUG, "Using: LST/GLD/ALT [%2d|%2d|%2d]\n",
- svc_params.flags & VP8_EFLAG_NO_REF_LAST ? -1 : svc_params.lst_fb_idx,
- svc_params.flags & VP8_EFLAG_NO_REF_GF ? -1 : svc_params.gld_fb_idx,
- svc_params.flags & VP8_EFLAG_NO_REF_ARF ? -1 : svc_params.alt_fb_idx);
- svc_log(
- svc_ctx, SVC_LOG_DEBUG, "Updating: LST/GLD/ALT [%2d|%2d|%2d]\n",
- svc_params.flags & VP8_EFLAG_NO_UPD_LAST ? -1 : svc_params.lst_fb_idx,
- svc_params.flags & VP8_EFLAG_NO_UPD_GF ? -1 : svc_params.gld_fb_idx,
- svc_params.flags & VP8_EFLAG_NO_UPD_ARF ? -1 : svc_params.alt_fb_idx);
- }
-
- vpx_codec_control(codec_ctx, VP9E_SET_SVC_PARAMETERS, &svc_params);
-}
-
-/**
- * Encode a frame into multiple layers
- * Create a superframe containing the individual layers
- */
-vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
- struct vpx_image *rawimg, vpx_codec_pts_t pts,
- int64_t duration, int deadline) {
- vpx_codec_err_t res;
- vpx_codec_iter_t iter;
- const vpx_codec_cx_pkt_t *cx_pkt;
- struct LayerData *cx_layer_list = NULL;
- struct LayerData *layer_data;
- struct Superframe superframe;
- SvcInternal *const si = get_svc_internal(svc_ctx);
- if (svc_ctx == NULL || codec_ctx == NULL || si == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- }
-
- memset(&superframe, 0, sizeof(superframe));
- svc_log_reset(svc_ctx);
- si->rc_stats_buf_used = 0;
-
- si->layers = svc_ctx->spatial_layers;
- if (si->frame_within_gop >= si->kf_dist ||
- si->encode_frame_count == 0) {
- si->frame_within_gop = 0;
- }
- si->is_keyframe = (si->frame_within_gop == 0);
- si->frame_size = 0;
-
- if (rawimg != NULL) {
- svc_log(svc_ctx, SVC_LOG_DEBUG,
- "vpx_svc_encode layers: %d, frame_count: %d, "
- "frame_within_gop: %d\n", si->layers, si->encode_frame_count,
- si->frame_within_gop);
- }
-
- // encode each layer
- for (si->layer = 0; si->layer < si->layers; ++si->layer) {
- if (svc_ctx->encoding_mode == ALT_INTER_LAYER_PREDICTION_IP &&
- si->is_keyframe && (si->layer == 1 || si->layer == 3)) {
- svc_log(svc_ctx, SVC_LOG_DEBUG, "Skip encoding layer %d\n", si->layer);
- continue;
- }
-
- if (rawimg != NULL) {
- calculate_enc_frame_flags(svc_ctx);
- set_svc_parameters(svc_ctx, codec_ctx);
- }
-
- res = vpx_codec_encode(codec_ctx, rawimg, pts, (uint32_t)duration,
- si->enc_frame_flags, deadline);
- if (res != VPX_CODEC_OK) {
- return res;
- }
- // save compressed data
- iter = NULL;
- while ((cx_pkt = vpx_codec_get_cx_data(codec_ctx, &iter))) {
- switch (cx_pkt->kind) {
- case VPX_CODEC_CX_FRAME_PKT: {
- const uint32_t frame_pkt_size = (uint32_t)(cx_pkt->data.frame.sz);
- si->bytes_sum[si->layer] += frame_pkt_size;
- svc_log(svc_ctx, SVC_LOG_DEBUG,
- "SVC frame: %d, layer: %d, size: %u\n",
- si->encode_frame_count, si->layer, frame_pkt_size);
- layer_data =
- ld_create(cx_pkt->data.frame.buf, (size_t)frame_pkt_size);
- if (layer_data == NULL) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "Error allocating LayerData\n");
- return VPX_CODEC_OK;
- }
- ld_list_add(&cx_layer_list, layer_data);
-
- // save layer size in superframe index
- superframe.sizes[superframe.count++] = frame_pkt_size;
- superframe.magnitude |= frame_pkt_size;
- break;
- }
- case VPX_CODEC_PSNR_PKT: {
- int i;
- svc_log(svc_ctx, SVC_LOG_DEBUG,
- "SVC frame: %d, layer: %d, PSNR(Total/Y/U/V): "
- "%2.3f %2.3f %2.3f %2.3f \n",
- si->encode_frame_count, si->layer,
- cx_pkt->data.psnr.psnr[0], cx_pkt->data.psnr.psnr[1],
- cx_pkt->data.psnr.psnr[2], cx_pkt->data.psnr.psnr[3]);
- svc_log(svc_ctx, SVC_LOG_DEBUG,
- "SVC frame: %d, layer: %d, SSE(Total/Y/U/V): "
- "%2.3f %2.3f %2.3f %2.3f \n",
- si->encode_frame_count, si->layer,
- cx_pkt->data.psnr.sse[0], cx_pkt->data.psnr.sse[1],
- cx_pkt->data.psnr.sse[2], cx_pkt->data.psnr.sse[3]);
- for (i = 0; i < COMPONENTS; i++) {
- si->psnr_sum[si->layer][i] += cx_pkt->data.psnr.psnr[i];
- si->sse_sum[si->layer][i] += cx_pkt->data.psnr.sse[i];
- }
- break;
- }
- case VPX_CODEC_STATS_PKT: {
- size_t new_size = si->rc_stats_buf_used +
- cx_pkt->data.twopass_stats.sz;
-
- if (new_size > si->rc_stats_buf_size) {
- char *p = (char*)realloc(si->rc_stats_buf, new_size);
- if (p == NULL) {
- svc_log(svc_ctx, SVC_LOG_ERROR, "Error allocating stats buf\n");
- break;
- }
- si->rc_stats_buf = p;
- si->rc_stats_buf_size = new_size;
- }
-
- memcpy(si->rc_stats_buf + si->rc_stats_buf_used,
- cx_pkt->data.twopass_stats.buf, cx_pkt->data.twopass_stats.sz);
- si->rc_stats_buf_used += cx_pkt->data.twopass_stats.sz;
- break;
- }
- default: {
- break;
- }
- }
- }
- if (rawimg == NULL) {
- break;
- }
- }
- if (codec_ctx->config.enc->g_pass != VPX_RC_FIRST_PASS) {
- // add superframe index to layer data list
- sf_create_index(&superframe);
- layer_data = ld_create(superframe.buffer, superframe.index_size);
- ld_list_add(&cx_layer_list, layer_data);
-
- // get accumulated size of layer data
- si->frame_size = ld_list_get_buffer_size(cx_layer_list);
- if (si->frame_size > 0) {
- // all layers encoded, create single buffer with concatenated layers
- if (si->frame_size > si->buffer_size) {
- free(si->buffer);
- si->buffer = malloc(si->frame_size);
- if (si->buffer == NULL) {
- ld_list_free(cx_layer_list);
- return VPX_CODEC_MEM_ERROR;
- }
- si->buffer_size = si->frame_size;
- }
- // copy layer data into packet
- ld_list_copy_to_buffer(cx_layer_list, (uint8_t *)si->buffer);
-
- ld_list_free(cx_layer_list);
-
- svc_log(svc_ctx, SVC_LOG_DEBUG, "SVC frame: %d, kf: %d, size: %d, "
- "pts: %d\n", si->encode_frame_count, si->is_keyframe,
- (int)si->frame_size, (int)pts);
- }
- }
- ++si->frame_within_gop;
- ++si->encode_frame_count;
-
- return VPX_CODEC_OK;
-}
-
-const char *vpx_svc_get_message(const SvcContext *svc_ctx) {
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return NULL;
- return si->message_buffer;
-}
-
-void *vpx_svc_get_buffer(const SvcContext *svc_ctx) {
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return NULL;
- return si->buffer;
-}
-
-size_t vpx_svc_get_frame_size(const SvcContext *svc_ctx) {
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return 0;
- return si->frame_size;
-}
-
-int vpx_svc_get_encode_frame_count(const SvcContext *svc_ctx) {
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return 0;
- return si->encode_frame_count;
-}
-
-int vpx_svc_is_keyframe(const SvcContext *svc_ctx) {
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return 0;
- return si->is_keyframe;
-}
-
-void vpx_svc_set_keyframe(SvcContext *svc_ctx) {
- SvcInternal *const si = get_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return;
- si->frame_within_gop = 0;
-}
-
-static double calc_psnr(double d) {
- if (d == 0) return 100;
- return -10.0 * log(d) / log(10.0);
-}
-
-// dump accumulated statistics and reset accumulated values
-const char *vpx_svc_dump_statistics(SvcContext *svc_ctx) {
- int number_of_frames, number_of_keyframes, encode_frame_count;
- int i, j;
- uint32_t bytes_total = 0;
- double scale[COMPONENTS];
- double psnr[COMPONENTS];
- double mse[COMPONENTS];
- double y_scale;
-
- SvcInternal *const si = get_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return NULL;
-
- svc_log_reset(svc_ctx);
-
- encode_frame_count = si->encode_frame_count;
- if (si->encode_frame_count <= 0) return vpx_svc_get_message(svc_ctx);
-
- svc_log(svc_ctx, SVC_LOG_INFO, "\n");
- number_of_keyframes = encode_frame_count / si->kf_dist + 1;
- for (i = 0; i < si->layers; ++i) {
- number_of_frames = encode_frame_count;
-
- if (svc_ctx->encoding_mode == ALT_INTER_LAYER_PREDICTION_IP &&
- (i == 1 || i == 3)) {
- number_of_frames -= number_of_keyframes;
- }
- svc_log(svc_ctx, SVC_LOG_INFO,
- "Layer %d Average PSNR=[%2.3f, %2.3f, %2.3f, %2.3f], Bytes=[%u]\n",
- i, (double)si->psnr_sum[i][0] / number_of_frames,
- (double)si->psnr_sum[i][1] / number_of_frames,
- (double)si->psnr_sum[i][2] / number_of_frames,
- (double)si->psnr_sum[i][3] / number_of_frames, si->bytes_sum[i]);
- // the following psnr calculation is deduced from ffmpeg.c#print_report
- y_scale = si->width * si->height * 255.0 * 255.0 * number_of_frames;
- scale[1] = y_scale;
- scale[2] = scale[3] = y_scale / 4; // U or V
- scale[0] = y_scale * 1.5; // total
-
- for (j = 0; j < COMPONENTS; j++) {
- psnr[j] = calc_psnr(si->sse_sum[i][j] / scale[j]);
- mse[j] = si->sse_sum[i][j] * 255.0 * 255.0 / scale[j];
- }
- svc_log(svc_ctx, SVC_LOG_INFO,
- "Layer %d Overall PSNR=[%2.3f, %2.3f, %2.3f, %2.3f]\n", i, psnr[0],
- psnr[1], psnr[2], psnr[3]);
- svc_log(svc_ctx, SVC_LOG_INFO,
- "Layer %d Overall MSE=[%2.3f, %2.3f, %2.3f, %2.3f]\n", i, mse[0],
- mse[1], mse[2], mse[3]);
-
- bytes_total += si->bytes_sum[i];
- // clear sums for next time
- si->bytes_sum[i] = 0;
- for (j = 0; j < COMPONENTS; ++j) {
- si->psnr_sum[i][j] = 0;
- si->sse_sum[i][j] = 0;
- }
- }
-
- // only display statistics once
- si->encode_frame_count = 0;
-
- svc_log(svc_ctx, SVC_LOG_INFO, "Total Bytes=[%u]\n", bytes_total);
- return vpx_svc_get_message(svc_ctx);
-}
-
-void vpx_svc_release(SvcContext *svc_ctx) {
- SvcInternal *si;
- if (svc_ctx == NULL) return;
- // do not use get_svc_internal as it will unnecessarily allocate an
- // SvcInternal if it was not already allocated
- si = (SvcInternal *)svc_ctx->internal;
- if (si != NULL) {
- free(si->buffer);
- if (si->rc_stats_buf) {
- free(si->rc_stats_buf);
- }
- free(si);
- svc_ctx->internal = NULL;
- }
-}
-
-size_t vpx_svc_get_rc_stats_buffer_size(const SvcContext *svc_ctx) {
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return 0;
- return si->rc_stats_buf_used;
-}
-
-char *vpx_svc_get_rc_stats_buffer(const SvcContext *svc_ctx) {
- const SvcInternal *const si = get_const_svc_internal(svc_ctx);
- if (svc_ctx == NULL || si == NULL) return NULL;
- return si->rc_stats_buf;
-}
-
-
diff --git a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_codec.c b/videocodec/libvpx_internal/libvpx/vpx/src/vpx_codec.c
deleted file mode 100644
index 1f664ae..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_codec.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*!\file
- * \brief Provides the high level interface to wrap decoder algorithms.
- *
- */
-#include <stdarg.h>
-#include <stdlib.h>
-#include "vpx/vpx_integer.h"
-#include "vpx/internal/vpx_codec_internal.h"
-#include "vpx_version.h"
-
-#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
-
-int vpx_codec_version(void) {
- return VERSION_PACKED;
-}
-
-
-const char *vpx_codec_version_str(void) {
- return VERSION_STRING_NOSP;
-}
-
-
-const char *vpx_codec_version_extra_str(void) {
- return VERSION_EXTRA;
-}
-
-
-const char *vpx_codec_iface_name(vpx_codec_iface_t *iface) {
- return iface ? iface->name : "<invalid interface>";
-}
-
-const char *vpx_codec_err_to_string(vpx_codec_err_t err) {
- switch (err) {
- case VPX_CODEC_OK:
- return "Success";
- case VPX_CODEC_ERROR:
- return "Unspecified internal error";
- case VPX_CODEC_MEM_ERROR:
- return "Memory allocation error";
- case VPX_CODEC_ABI_MISMATCH:
- return "ABI version mismatch";
- case VPX_CODEC_INCAPABLE:
- return "Codec does not implement requested capability";
- case VPX_CODEC_UNSUP_BITSTREAM:
- return "Bitstream not supported by this decoder";
- case VPX_CODEC_UNSUP_FEATURE:
- return "Bitstream required feature not supported by this decoder";
- case VPX_CODEC_CORRUPT_FRAME:
- return "Corrupt frame detected";
- case VPX_CODEC_INVALID_PARAM:
- return "Invalid parameter";
- case VPX_CODEC_LIST_END:
- return "End of iterated list";
- }
-
- return "Unrecognized error code";
-}
-
-const char *vpx_codec_error(vpx_codec_ctx_t *ctx) {
- return (ctx) ? vpx_codec_err_to_string(ctx->err)
- : vpx_codec_err_to_string(VPX_CODEC_INVALID_PARAM);
-}
-
-const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx) {
- if (ctx && ctx->err)
- return ctx->priv ? ctx->priv->err_detail : ctx->err_detail;
-
- return NULL;
-}
-
-
-vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx) {
- vpx_codec_err_t res;
-
- if (!ctx)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv)
- res = VPX_CODEC_ERROR;
- else {
- if (ctx->priv->alg_priv)
- ctx->iface->destroy(ctx->priv->alg_priv);
-
- ctx->iface = NULL;
- ctx->name = NULL;
- ctx->priv = NULL;
- res = VPX_CODEC_OK;
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface) {
- return (iface) ? iface->caps : 0;
-}
-
-
-vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
- int ctrl_id,
- ...) {
- vpx_codec_err_t res;
-
- if (!ctx || !ctrl_id)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv || !ctx->iface->ctrl_maps)
- res = VPX_CODEC_ERROR;
- else {
- vpx_codec_ctrl_fn_map_t *entry;
-
- res = VPX_CODEC_ERROR;
-
- for (entry = ctx->iface->ctrl_maps; entry && entry->fn; entry++) {
- if (!entry->ctrl_id || entry->ctrl_id == ctrl_id) {
- va_list ap;
-
- va_start(ap, ctrl_id);
- res = entry->fn(ctx->priv->alg_priv, ctrl_id, ap);
- va_end(ap);
- break;
- }
- }
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-//------------------------------------------------------------------------------
-// mmap interface
-
-vpx_codec_err_t vpx_mmap_alloc(vpx_codec_mmap_t *mmap) {
- unsigned int align = mmap->align ? mmap->align - 1 : 0;
-
- if (mmap->flags & VPX_CODEC_MEM_ZERO)
- mmap->priv = calloc(1, mmap->sz + align);
- else
- mmap->priv = malloc(mmap->sz + align);
-
- if (mmap->priv == NULL) return VPX_CODEC_MEM_ERROR;
- mmap->base = (void *)((((uintptr_t)mmap->priv) + align) & ~(uintptr_t)align);
- mmap->dtor = vpx_mmap_dtor;
- return VPX_CODEC_OK;
-}
-
-void vpx_mmap_dtor(vpx_codec_mmap_t *mmap) {
- free(mmap->priv);
-}
-
-vpx_codec_err_t vpx_validate_mmaps(const vpx_codec_stream_info_t *si,
- const vpx_codec_mmap_t *mmaps,
- const mem_req_t *mem_reqs, int nreqs,
- vpx_codec_flags_t init_flags) {
- int i;
-
- for (i = 0; i < nreqs - 1; ++i) {
- /* Ensure the segment has been allocated */
- if (mmaps[i].base == NULL) {
- return VPX_CODEC_MEM_ERROR;
- }
-
- /* Verify variable size segment is big enough for the current si. */
- if (mem_reqs[i].calc_sz != NULL) {
- vpx_codec_dec_cfg_t cfg;
-
- cfg.w = si->w;
- cfg.h = si->h;
-
- if (mmaps[i].sz < mem_reqs[i].calc_sz(&cfg, init_flags)) {
- return VPX_CODEC_MEM_ERROR;
- }
- }
- }
- return VPX_CODEC_OK;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_decoder.c b/videocodec/libvpx_internal/libvpx/vpx/src/vpx_decoder.c
deleted file mode 100644
index b9906db..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_decoder.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*!\file
- * \brief Provides the high level interface to wrap decoder algorithms.
- *
- */
-#include <string.h>
-#include "vpx/internal/vpx_codec_internal.h"
-#include "trace_conf.h"
-
-#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
-
-vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_dec_cfg_t *cfg,
- vpx_codec_flags_t flags,
- int ver) {
- vpx_codec_err_t res;
- (void)ver;
-
- if (0) {//(ver != VPX_DECODER_ABI_VERSION) {
- res = VPX_CODEC_ABI_MISMATCH;
- }
- else if (!ctx || !iface)
- res = VPX_CODEC_INVALID_PARAM;
- else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION) {
- res = VPX_CODEC_ABI_MISMATCH;
- }
- else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_POSTPROC) && !(iface->caps & VPX_CODEC_CAP_POSTPROC))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_ERROR_CONCEALMENT) &&
- !(iface->caps & VPX_CODEC_CAP_ERROR_CONCEALMENT))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_INPUT_FRAGMENTS) &&
- !(iface->caps & VPX_CODEC_CAP_INPUT_FRAGMENTS))
- res = VPX_CODEC_INCAPABLE;
- else if (!(iface->caps & VPX_CODEC_CAP_DECODER))
- res = VPX_CODEC_INCAPABLE;
- else {
- memset(ctx, 0, sizeof(*ctx));
- ctx->iface = iface;
- ctx->name = iface->name;
- ctx->priv = NULL;
- ctx->init_flags = flags;
- ctx->config.dec = cfg;
- res = VPX_CODEC_OK;
-
- if (!(flags & VPX_CODEC_USE_XMA)) {
- res = ctx->iface->init(ctx, NULL);
-
- if (res) {
- ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
- vpx_codec_destroy(ctx);
- }
-
- if (ctx->priv)
- ctx->priv->iface = ctx->iface;
- }
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
- const uint8_t *data,
- unsigned int data_sz,
- vpx_codec_stream_info_t *si) {
- vpx_codec_err_t res;
-
- if (!iface || !data || !data_sz || !si
- || si->sz < sizeof(vpx_codec_stream_info_t))
- res = VPX_CODEC_INVALID_PARAM;
- else {
- /* Set default/unknown values */
- si->w = 0;
- si->h = 0;
-
- res = iface->dec.peek_si(data, data_sz, si);
- }
-
- return res;
-}
-
-
-vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
- vpx_codec_stream_info_t *si) {
- vpx_codec_err_t res;
-
- if (!ctx || !si || si->sz < sizeof(vpx_codec_stream_info_t))
- res = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv)
- res = VPX_CODEC_ERROR;
- else {
- /* Set default/unknown values */
- si->w = 0;
- si->h = 0;
-
- res = ctx->iface->dec.get_si(ctx->priv->alg_priv, si);
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
- const uint8_t *data,
- unsigned int data_sz,
- void *user_priv,
- long deadline) {
- vpx_codec_err_t res;
-
- /* Sanity checks */
- /* NULL data ptr allowed if data_sz is 0 too */
- if (!ctx || (!data && data_sz))
- res = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv)
- res = VPX_CODEC_ERROR;
- else {
- res = ctx->iface->dec.decode(ctx->priv->alg_priv, data, data_sz,
- user_priv, deadline);
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
- vpx_codec_iter_t *iter) {
- vpx_image_t *img;
-
- if (!ctx || !iter || !ctx->iface || !ctx->priv)
- img = NULL;
- else
- img = ctx->iface->dec.get_frame(ctx->priv->alg_priv, iter);
-
- return img;
-}
-
-
-vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
- vpx_codec_put_frame_cb_fn_t cb,
- void *user_priv) {
- vpx_codec_err_t res;
-
- if (!ctx || !cb)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv
- || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
- res = VPX_CODEC_ERROR;
- else {
- ctx->priv->dec.put_frame_cb.u.put_frame = cb;
- ctx->priv->dec.put_frame_cb.user_priv = user_priv;
- res = VPX_CODEC_OK;
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
- vpx_codec_put_slice_cb_fn_t cb,
- void *user_priv) {
- vpx_codec_err_t res;
-
- if (!ctx || !cb)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv
- || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_SLICE))
- res = VPX_CODEC_ERROR;
- else {
- ctx->priv->dec.put_slice_cb.u.put_slice = cb;
- ctx->priv->dec.put_slice_cb.user_priv = user_priv;
- res = VPX_CODEC_OK;
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
- vpx_codec_mmap_t *mmap,
- vpx_codec_iter_t *iter) {
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if (!ctx || !mmap || !iter || !ctx->iface)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
- res = VPX_CODEC_ERROR;
- else
- res = ctx->iface->get_mmap(ctx, mmap, iter);
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
- vpx_codec_mmap_t *mmap,
- unsigned int num_maps) {
- vpx_codec_err_t res = VPX_CODEC_MEM_ERROR;
-
- if (!ctx || !mmap || !ctx->iface)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
- res = VPX_CODEC_ERROR;
- else {
- unsigned int i;
-
- for (i = 0; i < num_maps; i++, mmap++) {
- if (!mmap->base)
- break;
-
- /* Everything look ok, set the mmap in the decoder */
- res = ctx->iface->set_mmap(ctx, mmap);
-
- if (res)
- break;
- }
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-vpx_codec_err_t vpx_codec_set_frame_buffer_functions(
- vpx_codec_ctx_t *ctx, vpx_get_frame_buffer_cb_fn_t cb_get,
- vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv) {
- vpx_codec_err_t res;
-
- if (!ctx || !cb_get || !cb_release) {
- res = VPX_CODEC_INVALID_PARAM;
- } else if (!ctx->iface || !ctx->priv ||
- !(ctx->iface->caps & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
- res = VPX_CODEC_ERROR;
- } else {
- res = ctx->iface->dec.set_fb_fn(ctx->priv->alg_priv, cb_get, cb_release,
- cb_priv);
- }
-
- return SAVE_STATUS(ctx, res);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_encoder.c b/videocodec/libvpx_internal/libvpx/vpx/src/vpx_encoder.c
deleted file mode 100644
index 12923fd..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_encoder.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*!\file
- * \brief Provides the high level interface to wrap encoder algorithms.
- *
- */
-#include <limits.h>
-#include <string.h>
-#include "vpx/internal/vpx_codec_internal.h"
-#include "vpx_config.h"
-
-#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
-
-vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *cfg,
- vpx_codec_flags_t flags,
- int ver) {
- vpx_codec_err_t res;
-
- if (ver != VPX_ENCODER_ABI_VERSION)
- res = VPX_CODEC_ABI_MISMATCH;
- else if (!ctx || !iface || !cfg)
- res = VPX_CODEC_INVALID_PARAM;
- else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
- res = VPX_CODEC_ABI_MISMATCH;
- else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_PSNR)
- && !(iface->caps & VPX_CODEC_CAP_PSNR))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_OUTPUT_PARTITION)
- && !(iface->caps & VPX_CODEC_CAP_OUTPUT_PARTITION))
- res = VPX_CODEC_INCAPABLE;
- else {
- ctx->iface = iface;
- ctx->name = iface->name;
- ctx->priv = NULL;
- ctx->init_flags = flags;
- ctx->config.enc = cfg;
- res = ctx->iface->init(ctx, NULL);
-
- if (res) {
- ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
- vpx_codec_destroy(ctx);
- }
-
- if (ctx->priv)
- ctx->priv->iface = ctx->iface;
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *cfg,
- int num_enc,
- vpx_codec_flags_t flags,
- vpx_rational_t *dsf,
- int ver) {
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if (ver != VPX_ENCODER_ABI_VERSION)
- res = VPX_CODEC_ABI_MISMATCH;
- else if (!ctx || !iface || !cfg || (num_enc > 16 || num_enc < 1))
- res = VPX_CODEC_INVALID_PARAM;
- else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
- res = VPX_CODEC_ABI_MISMATCH;
- else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_PSNR)
- && !(iface->caps & VPX_CODEC_CAP_PSNR))
- res = VPX_CODEC_INCAPABLE;
- else if ((flags & VPX_CODEC_USE_OUTPUT_PARTITION)
- && !(iface->caps & VPX_CODEC_CAP_OUTPUT_PARTITION))
- res = VPX_CODEC_INCAPABLE;
- else {
- int i;
- void *mem_loc = NULL;
-
- if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) {
- for (i = 0; i < num_enc; i++) {
- vpx_codec_priv_enc_mr_cfg_t mr_cfg;
-
- /* Validate down-sampling factor. */
- if (dsf->num < 1 || dsf->num > 4096 || dsf->den < 1 ||
- dsf->den > dsf->num) {
- res = VPX_CODEC_INVALID_PARAM;
- break;
- }
-
- mr_cfg.mr_low_res_mode_info = mem_loc;
- mr_cfg.mr_total_resolutions = num_enc;
- mr_cfg.mr_encoder_id = num_enc - 1 - i;
- mr_cfg.mr_down_sampling_factor.num = dsf->num;
- mr_cfg.mr_down_sampling_factor.den = dsf->den;
-
- /* Force Key-frame synchronization. Namely, encoder at higher
- * resolution always use the same frame_type chosen by the
- * lowest-resolution encoder.
- */
- if (mr_cfg.mr_encoder_id)
- cfg->kf_mode = VPX_KF_DISABLED;
-
- ctx->iface = iface;
- ctx->name = iface->name;
- ctx->priv = NULL;
- ctx->init_flags = flags;
- ctx->config.enc = cfg;
- res = ctx->iface->init(ctx, &mr_cfg);
-
- if (res) {
- const char *error_detail =
- ctx->priv ? ctx->priv->err_detail : NULL;
- /* Destroy current ctx */
- ctx->err_detail = error_detail;
- vpx_codec_destroy(ctx);
-
- /* Destroy already allocated high-level ctx */
- while (i) {
- ctx--;
- ctx->err_detail = error_detail;
- vpx_codec_destroy(ctx);
- i--;
- }
- }
-
- if (ctx->priv)
- ctx->priv->iface = ctx->iface;
-
- if (res)
- break;
-
- ctx++;
- cfg++;
- dsf++;
- }
- ctx--;
- }
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *cfg,
- unsigned int usage) {
- vpx_codec_err_t res;
- vpx_codec_enc_cfg_map_t *map;
-
- if (!iface || !cfg || usage > INT_MAX)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
- res = VPX_CODEC_INCAPABLE;
- else {
- res = VPX_CODEC_INVALID_PARAM;
-
- for (map = iface->enc.cfg_maps; map->usage >= 0; map++) {
- if (map->usage == (int)usage) {
- *cfg = map->cfg;
- cfg->g_usage = usage;
- res = VPX_CODEC_OK;
- break;
- }
- }
- }
-
- return res;
-}
-
-
-#if ARCH_X86_32 || ARCH_X86_64
-/* On X86, disable the x87 unit's internal 80 bit precision for better
- * consistency with the SSE unit's 64 bit precision.
- */
-#include "vpx_ports/x86.h"
-#define FLOATING_POINT_INIT() do {\
- unsigned short x87_orig_mode = x87_set_double_precision();
-#define FLOATING_POINT_RESTORE() \
- x87_set_control_word(x87_orig_mode); }while(0)
-
-
-#else
-static void FLOATING_POINT_INIT() {}
-static void FLOATING_POINT_RESTORE() {}
-#endif
-
-
-vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
- const vpx_image_t *img,
- vpx_codec_pts_t pts,
- unsigned long duration,
- vpx_enc_frame_flags_t flags,
- unsigned long deadline) {
- vpx_codec_err_t res = VPX_CODEC_OK;
-
- if (!ctx || (img && !duration))
- res = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv)
- res = VPX_CODEC_ERROR;
- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
- res = VPX_CODEC_INCAPABLE;
- else {
- unsigned int num_enc = ctx->priv->enc.total_encoders;
-
- /* Execute in a normalized floating point environment, if the platform
- * requires it.
- */
- FLOATING_POINT_INIT();
-
- if (num_enc == 1)
- res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
- duration, flags, deadline);
- else {
- /* Multi-resolution encoding:
- * Encode multi-levels in reverse order. For example,
- * if mr_total_resolutions = 3, first encode level 2,
- * then encode level 1, and finally encode level 0.
- */
- int i;
-
- ctx += num_enc - 1;
- if (img) img += num_enc - 1;
-
- for (i = num_enc - 1; i >= 0; i--) {
- if ((res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
- duration, flags, deadline)))
- break;
-
- ctx--;
- if (img) img--;
- }
- ctx++;
- }
-
- FLOATING_POINT_RESTORE();
- }
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
- vpx_codec_iter_t *iter) {
- const vpx_codec_cx_pkt_t *pkt = NULL;
-
- if (ctx) {
- if (!iter)
- ctx->err = VPX_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv)
- ctx->err = VPX_CODEC_ERROR;
- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
- ctx->err = VPX_CODEC_INCAPABLE;
- else
- pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter);
- }
-
- if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
- // If the application has specified a destination area for the
- // compressed data, and the codec has not placed the data there,
- // and it fits, copy it.
- vpx_codec_priv_t *const priv = ctx->priv;
- char *const dst_buf = (char *)priv->enc.cx_data_dst_buf.buf;
-
- if (dst_buf &&
- pkt->data.raw.buf != dst_buf &&
- pkt->data.raw.sz + priv->enc.cx_data_pad_before +
- priv->enc.cx_data_pad_after <= priv->enc.cx_data_dst_buf.sz) {
- vpx_codec_cx_pkt_t *modified_pkt = &priv->enc.cx_data_pkt;
-
- memcpy(dst_buf + priv->enc.cx_data_pad_before, pkt->data.raw.buf,
- pkt->data.raw.sz);
- *modified_pkt = *pkt;
- modified_pkt->data.raw.buf = dst_buf;
- modified_pkt->data.raw.sz += priv->enc.cx_data_pad_before +
- priv->enc.cx_data_pad_after;
- pkt = modified_pkt;
- }
-
- if (dst_buf == pkt->data.raw.buf) {
- priv->enc.cx_data_dst_buf.buf = dst_buf + pkt->data.raw.sz;
- priv->enc.cx_data_dst_buf.sz -= pkt->data.raw.sz;
- }
- }
-
- return pkt;
-}
-
-
-vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
- const vpx_fixed_buf_t *buf,
- unsigned int pad_before,
- unsigned int pad_after) {
- if (!ctx || !ctx->priv)
- return VPX_CODEC_INVALID_PARAM;
-
- if (buf) {
- ctx->priv->enc.cx_data_dst_buf = *buf;
- ctx->priv->enc.cx_data_pad_before = pad_before;
- ctx->priv->enc.cx_data_pad_after = pad_after;
- } else {
- ctx->priv->enc.cx_data_dst_buf.buf = NULL;
- ctx->priv->enc.cx_data_dst_buf.sz = 0;
- ctx->priv->enc.cx_data_pad_before = 0;
- ctx->priv->enc.cx_data_pad_after = 0;
- }
-
- return VPX_CODEC_OK;
-}
-
-
-const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx) {
- vpx_image_t *img = NULL;
-
- if (ctx) {
- if (!ctx->iface || !ctx->priv)
- ctx->err = VPX_CODEC_ERROR;
- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
- ctx->err = VPX_CODEC_INCAPABLE;
- else if (!ctx->iface->enc.get_preview)
- ctx->err = VPX_CODEC_INCAPABLE;
- else
- img = ctx->iface->enc.get_preview(ctx->priv->alg_priv);
- }
-
- return img;
-}
-
-
-vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx) {
- vpx_fixed_buf_t *buf = NULL;
-
- if (ctx) {
- if (!ctx->iface || !ctx->priv)
- ctx->err = VPX_CODEC_ERROR;
- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
- ctx->err = VPX_CODEC_INCAPABLE;
- else if (!ctx->iface->enc.get_glob_hdrs)
- ctx->err = VPX_CODEC_INCAPABLE;
- else
- buf = ctx->iface->enc.get_glob_hdrs(ctx->priv->alg_priv);
- }
-
- return buf;
-}
-
-
-vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
- const vpx_codec_enc_cfg_t *cfg) {
- vpx_codec_err_t res;
-
- if (!ctx || !ctx->iface || !ctx->priv || !cfg)
- res = VPX_CODEC_INVALID_PARAM;
- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
- res = VPX_CODEC_INCAPABLE;
- else
- res = ctx->iface->enc.cfg_set(ctx->priv->alg_priv, cfg);
-
- return SAVE_STATUS(ctx, res);
-}
-
-
-int vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *list,
- const struct vpx_codec_cx_pkt *pkt) {
- if (list->cnt < list->max) {
- list->pkts[list->cnt++] = *pkt;
- return 0;
- }
-
- return 1;
-}
-
-
-const vpx_codec_cx_pkt_t *vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
- vpx_codec_iter_t *iter) {
- const vpx_codec_cx_pkt_t *pkt;
-
- if (!(*iter)) {
- *iter = list->pkts;
- }
-
- pkt = (const vpx_codec_cx_pkt_t *)*iter;
-
- if ((size_t)(pkt - list->pkts) < list->cnt)
- *iter = pkt + 1;
- else
- pkt = NULL;
-
- return pkt;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_image.c b/videocodec/libvpx_internal/libvpx/vpx/src/vpx_image.c
deleted file mode 100644
index 36eda95..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_image.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include "vpx/vpx_image.h"
-
-#define ADDRESS_STORAGE_SIZE sizeof(size_t)
-/*returns an addr aligned to the byte boundary specified by align*/
-#define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
-
-/* Memalign code is copied from vpx_mem.c */
-static void *img_buf_memalign(size_t align, size_t size) {
- void *addr,
- * x = NULL;
-
- addr = malloc(size + align - 1 + ADDRESS_STORAGE_SIZE);
-
- if (addr) {
- x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, (int)align);
- /* save the actual malloc address */
- ((size_t *)x)[-1] = (size_t)addr;
- }
-
- return x;
-}
-
-static void img_buf_free(void *memblk) {
- if (memblk) {
- void *addr = (void *)(((size_t *)memblk)[-1]);
- free(addr);
- }
-}
-
-static vpx_image_t *img_alloc_helper(vpx_image_t *img,
- vpx_img_fmt_t fmt,
- unsigned int d_w,
- unsigned int d_h,
- unsigned int buf_align,
- unsigned int stride_align,
- unsigned char *img_data) {
-
- unsigned int h, w, s, xcs, ycs, bps;
- int align;
-
- /* Treat align==0 like align==1 */
- if (!buf_align)
- buf_align = 1;
-
- /* Validate alignment (must be power of 2) */
- if (buf_align & (buf_align - 1))
- goto fail;
-
- /* Treat align==0 like align==1 */
- if (!stride_align)
- stride_align = 1;
-
- /* Validate alignment (must be power of 2) */
- if (stride_align & (stride_align - 1))
- goto fail;
-
- /* Get sample size for this format */
- switch (fmt) {
- case VPX_IMG_FMT_RGB32:
- case VPX_IMG_FMT_RGB32_LE:
- case VPX_IMG_FMT_ARGB:
- case VPX_IMG_FMT_ARGB_LE:
- bps = 32;
- break;
- case VPX_IMG_FMT_RGB24:
- case VPX_IMG_FMT_BGR24:
- bps = 24;
- break;
- case VPX_IMG_FMT_RGB565:
- case VPX_IMG_FMT_RGB565_LE:
- case VPX_IMG_FMT_RGB555:
- case VPX_IMG_FMT_RGB555_LE:
- case VPX_IMG_FMT_UYVY:
- case VPX_IMG_FMT_YUY2:
- case VPX_IMG_FMT_YVYU:
- bps = 16;
- break;
- case VPX_IMG_FMT_I420:
- case VPX_IMG_FMT_YV12:
- case VPX_IMG_FMT_VPXI420:
- case VPX_IMG_FMT_VPXYV12:
- bps = 12;
- break;
- default:
- bps = 16;
- break;
- }
-
- /* Get chroma shift values for this format */
- switch (fmt) {
- case VPX_IMG_FMT_I420:
- case VPX_IMG_FMT_YV12:
- case VPX_IMG_FMT_VPXI420:
- case VPX_IMG_FMT_VPXYV12:
- xcs = 1;
- break;
- default:
- xcs = 0;
- break;
- }
-
- switch (fmt) {
- case VPX_IMG_FMT_I420:
- case VPX_IMG_FMT_YV12:
- case VPX_IMG_FMT_VPXI420:
- case VPX_IMG_FMT_VPXYV12:
- ycs = 1;
- break;
- default:
- ycs = 0;
- break;
- }
-
- /* Calculate storage sizes given the chroma subsampling */
- align = (1 << xcs) - 1;
- w = (d_w + align) & ~align;
- align = (1 << ycs) - 1;
- h = (d_h + align) & ~align;
- s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
- s = (s + stride_align - 1) & ~(stride_align - 1);
-
- /* Allocate the new image */
- if (!img) {
- img = (vpx_image_t *)calloc(1, sizeof(vpx_image_t));
-
- if (!img)
- goto fail;
-
- img->self_allocd = 1;
- } else {
- memset(img, 0, sizeof(vpx_image_t));
- }
-
- img->img_data = img_data;
-
- if (!img_data) {
- img->img_data = img_buf_memalign(buf_align, ((fmt & VPX_IMG_FMT_PLANAR) ?
- h * s * bps / 8 : h * s));
- img->img_data_owner = 1;
- }
-
- if (!img->img_data)
- goto fail;
-
- img->fmt = fmt;
- img->w = w;
- img->h = h;
- img->x_chroma_shift = xcs;
- img->y_chroma_shift = ycs;
- img->bps = bps;
-
- /* Calculate strides */
- img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = s;
- img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = s >> xcs;
-
- /* Default viewport to entire image */
- if (!vpx_img_set_rect(img, 0, 0, d_w, d_h))
- return img;
-
-fail:
- vpx_img_free(img);
- return NULL;
-}
-
-vpx_image_t *vpx_img_alloc(vpx_image_t *img,
- vpx_img_fmt_t fmt,
- unsigned int d_w,
- unsigned int d_h,
- unsigned int align) {
- return img_alloc_helper(img, fmt, d_w, d_h, align, align, NULL);
-}
-
-vpx_image_t *vpx_img_wrap(vpx_image_t *img,
- vpx_img_fmt_t fmt,
- unsigned int d_w,
- unsigned int d_h,
- unsigned int stride_align,
- unsigned char *img_data) {
- /* By setting buf_align = 1, we don't change buffer alignment in this
- * function. */
- return img_alloc_helper(img, fmt, d_w, d_h, 1, stride_align, img_data);
-}
-
-int vpx_img_set_rect(vpx_image_t *img,
- unsigned int x,
- unsigned int y,
- unsigned int w,
- unsigned int h) {
- unsigned char *data;
-
- if (x + w <= img->w && y + h <= img->h) {
- img->d_w = w;
- img->d_h = h;
-
- /* Calculate plane pointers */
- if (!(img->fmt & VPX_IMG_FMT_PLANAR)) {
- img->planes[VPX_PLANE_PACKED] =
- img->img_data + x * img->bps / 8 + y * img->stride[VPX_PLANE_PACKED];
- } else {
- data = img->img_data;
-
- if (img->fmt & VPX_IMG_FMT_HAS_ALPHA) {
- img->planes[VPX_PLANE_ALPHA] =
- data + x + y * img->stride[VPX_PLANE_ALPHA];
- data += img->h * img->stride[VPX_PLANE_ALPHA];
- }
-
- img->planes[VPX_PLANE_Y] = data + x + y * img->stride[VPX_PLANE_Y];
- data += img->h * img->stride[VPX_PLANE_Y];
-
- if (!(img->fmt & VPX_IMG_FMT_UV_FLIP)) {
- img->planes[VPX_PLANE_U] = data
- + (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
- data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
- img->planes[VPX_PLANE_V] = data
- + (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
- } else {
- img->planes[VPX_PLANE_V] = data
- + (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
- data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
- img->planes[VPX_PLANE_U] = data
- + (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
- }
- }
-
- return 0;
- }
-
- return -1;
-}
-
-void vpx_img_flip(vpx_image_t *img) {
- /* Note: In the calculation pointer adjustment calculation, we want the
- * rhs to be promoted to a signed type. Section 6.3.1.8 of the ISO C99
- * standard indicates that if the adjustment parameter is unsigned, the
- * stride parameter will be promoted to unsigned, causing errors when
- * the lhs is a larger type than the rhs.
- */
- img->planes[VPX_PLANE_Y] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_Y];
- img->stride[VPX_PLANE_Y] = -img->stride[VPX_PLANE_Y];
-
- img->planes[VPX_PLANE_U] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
- * img->stride[VPX_PLANE_U];
- img->stride[VPX_PLANE_U] = -img->stride[VPX_PLANE_U];
-
- img->planes[VPX_PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
- * img->stride[VPX_PLANE_V];
- img->stride[VPX_PLANE_V] = -img->stride[VPX_PLANE_V];
-
- img->planes[VPX_PLANE_ALPHA] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_ALPHA];
- img->stride[VPX_PLANE_ALPHA] = -img->stride[VPX_PLANE_ALPHA];
-}
-
-void vpx_img_free(vpx_image_t *img) {
- if (img) {
- if (img->img_data && img->img_data_owner)
- img_buf_free(img->img_data);
-
- if (img->self_allocd)
- free(img);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_psnr.c b/videocodec/libvpx_internal/libvpx/vpx/src/vpx_psnr.c
deleted file mode 100644
index 05843ac..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/src/vpx_psnr.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-
-#include "vpx/internal/vpx_psnr.h"
-
-#define MAX_PSNR 100.0
-
-double vpx_sse_to_psnr(double samples, double peak, double sse) {
- if (sse > 0.0) {
- const double psnr = 10.0 * log10(samples * peak * peak / sse);
- return psnr > MAX_PSNR ? MAX_PSNR : psnr;
- } else {
- return MAX_PSNR;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx/svc_context.h b/videocodec/libvpx_internal/libvpx/vpx/svc_context.h
deleted file mode 100644
index 5d0fbbd..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/svc_context.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-/**
- * SvcContext - input parameters and state to encode a multi-layered
- * spatial SVC frame
- */
-
-#ifndef VPX_SVC_CONTEXT_H_
-#define VPX_SVC_CONTEXT_H_
-
-#include "./vp8cx.h"
-#include "./vpx_encoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum SVC_ENCODING_MODE {
- INTER_LAYER_PREDICTION_I,
- ALT_INTER_LAYER_PREDICTION_IP,
- INTER_LAYER_PREDICTION_IP,
- USE_GOLDEN_FRAME
-} SVC_ENCODING_MODE;
-
-typedef enum SVC_LOG_LEVEL {
- SVC_LOG_ERROR,
- SVC_LOG_INFO,
- SVC_LOG_DEBUG
-} SVC_LOG_LEVEL;
-
-typedef struct {
- // public interface to svc_command options
- int spatial_layers; // number of layers
- SVC_ENCODING_MODE encoding_mode; // svc encoding strategy
- SVC_LOG_LEVEL log_level; // amount of information to display
- int log_print; // when set, printf log messages instead of returning the
- // message with svc_get_message
-
- // private storage for vpx_svc_encode
- void *internal;
-} SvcContext;
-
-/**
- * Set SVC options
- * options are supplied as a single string separated by spaces
- * Format: encoding-mode=<i|ip|alt-ip|gf>
- * layers=<layer_count>
- * scaling-factors=<n1>/<d1>,<n2>/<d2>,...
- * quantizers=<q1>,<q2>,...
- */
-vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options);
-
-/**
- * Set SVC quantizer values
- * values comma separated, ordered from lowest resolution to highest
- * e.g., "60,53,39,33,27"
- */
-vpx_codec_err_t vpx_svc_set_quantizers(SvcContext *svc_ctx,
- const char *quantizer_values,
- const int is_for_keyframe);
-
-/**
- * Set SVC scale factors
- * values comma separated, ordered from lowest resolution to highest
- * e.g., "4/16,5/16,7/16,11/16,16/16"
- */
-vpx_codec_err_t vpx_svc_set_scale_factors(SvcContext *svc_ctx,
- const char *scale_factors);
-
-/**
- * initialize SVC encoding
- */
-vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *cfg);
-/**
- * encode a frame of video with multiple layers
- */
-vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
- struct vpx_image *rawimg, vpx_codec_pts_t pts,
- int64_t duration, int deadline);
-
-/**
- * finished with svc encoding, release allocated resources
- */
-void vpx_svc_release(SvcContext *svc_ctx);
-
-/**
- * dump accumulated statistics and reset accumulated values
- */
-const char *vpx_svc_dump_statistics(SvcContext *svc_ctx);
-
-/**
- * get status message from previous encode
- */
-const char *vpx_svc_get_message(const SvcContext *svc_ctx);
-
-/**
- * return size of encoded data to be returned by vpx_svc_get_buffer
- */
-size_t vpx_svc_get_frame_size(const SvcContext *svc_ctx);
-
-/**
- * return buffer with encoded data
- */
-void *vpx_svc_get_buffer(const SvcContext *svc_ctx);
-
-/**
- * return size of two pass rate control stats data to be returned by
- * vpx_svc_get_rc_stats_buffer
- */
-size_t vpx_svc_get_rc_stats_buffer_size(const SvcContext *svc_ctx);
-
-/**
- * return buffer two pass of rate control stats data
- */
-char *vpx_svc_get_rc_stats_buffer(const SvcContext *svc_ctx);
-
-/**
- * return spatial resolution of the specified layer
- */
-vpx_codec_err_t vpx_svc_get_layer_resolution(const SvcContext *svc_ctx,
- int layer,
- unsigned int *width,
- unsigned int *height);
-/**
- * return number of frames that have been encoded
- */
-int vpx_svc_get_encode_frame_count(const SvcContext *svc_ctx);
-
-/**
- * return 1 if last encoded frame was a keyframe
- */
-int vpx_svc_is_keyframe(const SvcContext *svc_ctx);
-
-/**
- * force the next frame to be a keyframe
- */
-void vpx_svc_set_keyframe(SvcContext *svc_ctx);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_SVC_CONTEXT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vp8.h b/videocodec/libvpx_internal/libvpx/vpx/vp8.h
deleted file mode 100644
index 2a31af6..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vp8.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-/*!\defgroup vp8 VP8
- * \ingroup codecs
- * VP8 is vpx's newest video compression algorithm that uses motion
- * compensated prediction, Discrete Cosine Transform (DCT) coding of the
- * prediction error signal and context dependent entropy coding techniques
- * based on arithmetic principles. It features:
- * - YUV 4:2:0 image format
- * - Macro-block based coding (16x16 luma plus two 8x8 chroma)
- * - 1/4 (1/8) pixel accuracy motion compensated prediction
- * - 4x4 DCT transform
- * - 128 level linear quantizer
- * - In loop deblocking filter
- * - Context-based entropy coding
- *
- * @{
- */
-/*!\file
- * \brief Provides controls common to both the VP8 encoder and decoder.
- */
-#ifndef VPX_VP8_H_
-#define VPX_VP8_H_
-
-#include "./vpx_codec.h"
-#include "./vpx_image.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*!\brief Control functions
- *
- * The set of macros define the control functions of VP8 interface
- */
-enum vp8_com_control_id {
- VP8_SET_REFERENCE = 1, /**< pass in an external frame into decoder to be used as reference frame */
- VP8_COPY_REFERENCE = 2, /**< get a copy of reference frame from the decoder */
- VP8_SET_POSTPROC = 3, /**< set the decoder's post processing settings */
- VP8_SET_DBG_COLOR_REF_FRAME = 4, /**< set the reference frames to color for each macroblock */
- VP8_SET_DBG_COLOR_MB_MODES = 5, /**< set which macro block modes to color */
- VP8_SET_DBG_COLOR_B_MODES = 6, /**< set which blocks modes to color */
- VP8_SET_DBG_DISPLAY_MV = 7, /**< set which motion vector modes to draw */
-
- /* TODO(jkoleszar): The encoder incorrectly reuses some of these values (5+)
- * for its control ids. These should be migrated to something like the
- * VP8_DECODER_CTRL_ID_START range next time we're ready to break the ABI.
- */
- VP9_GET_REFERENCE = 128, /**< get a pointer to a reference frame */
- VP8_COMMON_CTRL_ID_MAX,
- VP8_DECODER_CTRL_ID_START = 256
-};
-
-/*!\brief post process flags
- *
- * The set of macros define VP8 decoder post processing flags
- */
-enum vp8_postproc_level {
- VP8_NOFILTERING = 0,
- VP8_DEBLOCK = 1 << 0,
- VP8_DEMACROBLOCK = 1 << 1,
- VP8_ADDNOISE = 1 << 2,
- VP8_DEBUG_TXT_FRAME_INFO = 1 << 3, /**< print frame information */
- VP8_DEBUG_TXT_MBLK_MODES = 1 << 4, /**< print macro block modes over each macro block */
- VP8_DEBUG_TXT_DC_DIFF = 1 << 5, /**< print dc diff for each macro block */
- VP8_DEBUG_TXT_RATE_INFO = 1 << 6, /**< print video rate info (encoder only) */
- VP8_MFQE = 1 << 10
-};
-
-/*!\brief post process flags
- *
- * This define a structure that describe the post processing settings. For
- * the best objective measure (using the PSNR metric) set post_proc_flag
- * to VP8_DEBLOCK and deblocking_level to 1.
- */
-
-typedef struct vp8_postproc_cfg {
- int post_proc_flag; /**< the types of post processing to be done, should be combination of "vp8_postproc_level" */
- int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
- int noise_level; /**< the strength of additive noise, valid range [0, 16] */
-} vp8_postproc_cfg_t;
-
-/*!\brief reference frame type
- *
- * The set of macros define the type of VP8 reference frames
- */
-typedef enum vpx_ref_frame_type {
- VP8_LAST_FRAME = 1,
- VP8_GOLD_FRAME = 2,
- VP8_ALTR_FRAME = 4
-} vpx_ref_frame_type_t;
-
-/*!\brief reference frame data struct
- *
- * Define the data struct to access vp8 reference frames.
- */
-typedef struct vpx_ref_frame {
- vpx_ref_frame_type_t frame_type; /**< which reference frame */
- vpx_image_t img; /**< reference frame data in image format */
-} vpx_ref_frame_t;
-
-/*!\brief VP9 specific reference frame data struct
- *
- * Define the data struct to access vp9 reference frames.
- */
-typedef struct vp9_ref_frame {
- int idx; /**< frame index to get (input) */
- vpx_image_t img; /**< img structure to populate (output) */
-} vp9_ref_frame_t;
-
-/*!\brief vp8 decoder control function parameter type
- *
- * defines the data type for each of VP8 decoder control function requires
- */
-VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE, vpx_ref_frame_t *)
-VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *)
-VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *)
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_REF_FRAME, int)
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_MB_MODES, int)
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_B_MODES, int)
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_DISPLAY_MV, int)
-VPX_CTRL_USE_TYPE(VP9_GET_REFERENCE, vp9_ref_frame_t *)
-
-/*! @} - end defgroup vp8 */
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_VP8_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vp8cx.h b/videocodec/libvpx_internal/libvpx/vpx/vp8cx.h
deleted file mode 100644
index 8944a26..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vp8cx.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VPX_VP8CX_H_
-#define VPX_VP8CX_H_
-
-/*!\defgroup vp8_encoder WebM VP8 Encoder
- * \ingroup vp8
- *
- * @{
- */
-#include "./vp8.h"
-
-/*!\file
- * \brief Provides definitions for using the VP8 encoder algorithm within the
- * vpx Codec Interface.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*!\name Algorithm interface for VP8
- *
- * This interface provides the capability to encode raw VP8 streams, as would
- * be found in AVI files.
- * @{
- */
-extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
-extern vpx_codec_iface_t *vpx_codec_vp8_cx(void);
-
-/* TODO(jkoleszar): These move to VP9 in a later patch set. */
-extern vpx_codec_iface_t vpx_codec_vp9_cx_algo;
-extern vpx_codec_iface_t *vpx_codec_vp9_cx(void);
-
-/*!@} - end algorithm interface member group*/
-
-
-/*
- * Algorithm Flags
- */
-
-/*!\brief Don't reference the last frame
- *
- * When this flag is set, the encoder will not use the last frame as a
- * predictor. When not set, the encoder will choose whether to use the
- * last frame or not automatically.
- */
-#define VP8_EFLAG_NO_REF_LAST (1<<16)
-
-
-/*!\brief Don't reference the golden frame
- *
- * When this flag is set, the encoder will not use the golden frame as a
- * predictor. When not set, the encoder will choose whether to use the
- * golden frame or not automatically.
- */
-#define VP8_EFLAG_NO_REF_GF (1<<17)
-
-
-/*!\brief Don't reference the alternate reference frame
- *
- * When this flag is set, the encoder will not use the alt ref frame as a
- * predictor. When not set, the encoder will choose whether to use the
- * alt ref frame or not automatically.
- */
-#define VP8_EFLAG_NO_REF_ARF (1<<21)
-
-
-/*!\brief Don't update the last frame
- *
- * When this flag is set, the encoder will not update the last frame with
- * the contents of the current frame.
- */
-#define VP8_EFLAG_NO_UPD_LAST (1<<18)
-
-
-/*!\brief Don't update the golden frame
- *
- * When this flag is set, the encoder will not update the golden frame with
- * the contents of the current frame.
- */
-#define VP8_EFLAG_NO_UPD_GF (1<<22)
-
-
-/*!\brief Don't update the alternate reference frame
- *
- * When this flag is set, the encoder will not update the alt ref frame with
- * the contents of the current frame.
- */
-#define VP8_EFLAG_NO_UPD_ARF (1<<23)
-
-
-/*!\brief Force golden frame update
- *
- * When this flag is set, the encoder copy the contents of the current frame
- * to the golden frame buffer.
- */
-#define VP8_EFLAG_FORCE_GF (1<<19)
-
-
-/*!\brief Force alternate reference frame update
- *
- * When this flag is set, the encoder copy the contents of the current frame
- * to the alternate reference frame buffer.
- */
-#define VP8_EFLAG_FORCE_ARF (1<<24)
-
-
-/*!\brief Disable entropy update
- *
- * When this flag is set, the encoder will not update its internal entropy
- * model based on the entropy of this frame.
- */
-#define VP8_EFLAG_NO_UPD_ENTROPY (1<<20)
-
-
-/*!\brief VP8 encoder control functions
- *
- * This set of macros define the control functions available for the VP8
- * encoder interface.
- *
- * \sa #vpx_codec_control
- */
-enum vp8e_enc_control_id {
- VP8E_UPD_ENTROPY = 5, /**< control function to set mode of entropy update in encoder */
- VP8E_UPD_REFERENCE, /**< control function to set reference update mode in encoder */
- VP8E_USE_REFERENCE, /**< control function to set which reference frame encoder can use */
- VP8E_SET_ROI_MAP, /**< control function to pass an ROI map to encoder */
- VP8E_SET_ACTIVEMAP, /**< control function to pass an Active map to encoder */
- VP8E_SET_SCALEMODE = 11, /**< control function to set encoder scaling mode */
- /*!\brief control function to set vp8 encoder cpuused
- *
- * Changes in this value influences, among others, the encoder's selection
- * of motion estimation methods. Values greater than 0 will increase encoder
- * speed at the expense of quality.
- * The full set of adjustments can be found in
- * onyx_if.c:vp8_set_speed_features().
- * \todo List highlights of the changes at various levels.
- *
- * \note Valid range: -16..16
- */
- VP8E_SET_CPUUSED = 13,
- VP8E_SET_ENABLEAUTOALTREF, /**< control function to enable vp8 to automatic set and use altref frame */
- VP8E_SET_NOISE_SENSITIVITY, /**< control function to set noise sensitivity */
- VP8E_SET_SHARPNESS, /**< control function to set sharpness */
- VP8E_SET_STATIC_THRESHOLD, /**< control function to set the threshold for macroblocks treated static */
- VP8E_SET_TOKEN_PARTITIONS, /**< control function to set the number of token partitions */
- VP8E_GET_LAST_QUANTIZER, /**< return the quantizer chosen by the
- encoder for the last frame using the internal
- scale */
- VP8E_GET_LAST_QUANTIZER_64, /**< return the quantizer chosen by the
- encoder for the last frame, using the 0..63
- scale as used by the rc_*_quantizer config
- parameters */
- VP8E_SET_ARNR_MAXFRAMES, /**< control function to set the max number of frames blurred creating arf*/
- VP8E_SET_ARNR_STRENGTH, /**< control function to set the filter strength for the arf */
- VP8E_SET_ARNR_TYPE, /**< control function to set the type of filter to use for the arf*/
- VP8E_SET_TUNING, /**< control function to set visual tuning */
- /*!\brief control function to set constrained quality level
- *
- * \attention For this value to be used vpx_codec_enc_cfg_t::g_usage must be
- * set to #VPX_CQ.
- * \note Valid range: 0..63
- */
- VP8E_SET_CQ_LEVEL,
-
- /*!\brief Max data rate for Intra frames
- *
- * This value controls additional clamping on the maximum size of a
- * keyframe. It is expressed as a percentage of the average
- * per-frame bitrate, with the special (and default) value 0 meaning
- * unlimited, or no additional clamping beyond the codec's built-in
- * algorithm.
- *
- * For example, to allocate no more than 4.5 frames worth of bitrate
- * to a keyframe, set this to 450.
- *
- */
- VP8E_SET_MAX_INTRA_BITRATE_PCT,
-
-
- /* TODO(jkoleszar): Move to vp9cx.h */
- VP9E_SET_LOSSLESS,
- VP9E_SET_TILE_COLUMNS,
- VP9E_SET_TILE_ROWS,
- VP9E_SET_FRAME_PARALLEL_DECODING,
- VP9E_SET_AQ_MODE,
- VP9E_SET_FRAME_PERIODIC_BOOST,
-
- VP9E_SET_SVC,
- VP9E_SET_SVC_PARAMETERS,
- /*!\brief control function to set svc layer for spatial and temporal.
- * \note Valid ranges: 0..#vpx_codec_enc_cfg::ss_number_layers for spatial
- * layer and 0..#vpx_codec_enc_cfg::ts_number_layers for
- * temporal layer.
- */
- VP9E_SET_SVC_LAYER_ID
-};
-
-/*!\brief vpx 1-D scaling mode
- *
- * This set of constants define 1-D vpx scaling modes
- */
-typedef enum vpx_scaling_mode_1d {
- VP8E_NORMAL = 0,
- VP8E_FOURFIVE = 1,
- VP8E_THREEFIVE = 2,
- VP8E_ONETWO = 3
-} VPX_SCALING_MODE;
-
-
-/*!\brief vpx region of interest map
- *
- * These defines the data structures for the region of interest map
- *
- */
-
-typedef struct vpx_roi_map {
- /*! An id between 0 and 3 for each 16x16 region within a frame. */
- unsigned char *roi_map;
- unsigned int rows; /**< Number of rows. */
- unsigned int cols; /**< Number of columns. */
- // TODO(paulwilkins): broken for VP9 which has 8 segments
- // q and loop filter deltas for each segment
- // (see MAX_MB_SEGMENTS)
- int delta_q[4]; /**< Quantizer deltas. */
- int delta_lf[4]; /**< Loop filter deltas. */
- /*! Static breakout threshold for each segment. */
- unsigned int static_threshold[4];
-} vpx_roi_map_t;
-
-/*!\brief vpx active region map
- *
- * These defines the data structures for active region map
- *
- */
-
-
-typedef struct vpx_active_map {
- unsigned char *active_map; /**< specify an on (1) or off (0) each 16x16 region within a frame */
- unsigned int rows; /**< number of rows */
- unsigned int cols; /**< number of cols */
-} vpx_active_map_t;
-
-/*!\brief vpx image scaling mode
- *
- * This defines the data structure for image scaling mode
- *
- */
-typedef struct vpx_scaling_mode {
- VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
- VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
-} vpx_scaling_mode_t;
-
-/*!\brief VP8 token partition mode
- *
- * This defines VP8 partitioning mode for compressed data, i.e., the number of
- * sub-streams in the bitstream. Used for parallelized decoding.
- *
- */
-
-typedef enum {
- VP8_ONE_TOKENPARTITION = 0,
- VP8_TWO_TOKENPARTITION = 1,
- VP8_FOUR_TOKENPARTITION = 2,
- VP8_EIGHT_TOKENPARTITION = 3
-} vp8e_token_partitions;
-
-
-/*!\brief VP8 model tuning parameters
- *
- * Changes the encoder to tune for certain types of input material.
- *
- */
-typedef enum {
- VP8_TUNE_PSNR,
- VP8_TUNE_SSIM
-} vp8e_tuning;
-
-/*!\brief vp9 svc parameters
- *
- * This defines parameters for svc encoding.
- *
- */
-typedef struct vpx_svc_parameters {
- unsigned int width; /**< width of current spatial layer */
- unsigned int height; /**< height of current spatial layer */
- int spatial_layer; /**< current spatial layer number - 0 = base */
- int temporal_layer; /**< current temporal layer number - 0 = base */
- int flags; /**< encode frame flags */
- int max_quantizer; /**< max quantizer for current layer */
- int min_quantizer; /**< min quantizer for current layer */
- int distance_from_i_frame; /**< frame number within current gop */
- int lst_fb_idx; /**< last frame frame buffer index */
- int gld_fb_idx; /**< golden frame frame buffer index */
- int alt_fb_idx; /**< alt reference frame frame buffer index */
-} vpx_svc_parameters_t;
-
-/*!\brief vp9 svc layer parameters
- *
- * This defines the spatial and temporal layer id numbers for svc encoding.
- * This is used with the #VP9E_SET_SVC_LAYER_ID control to set the spatial and
- * temporal layer id for the current frame.
- *
- */
-typedef struct vpx_svc_layer_id {
- int spatial_layer_id; /**< Spatial layer id number. */
- int temporal_layer_id; /**< Temporal layer id number. */
-} vpx_svc_layer_id_t;
-
-/*!\brief VP8 encoder control function parameter type
- *
- * Defines the data types that VP8E control functions take. Note that
- * additional common controls are defined in vp8.h
- *
- */
-
-
-/* These controls have been deprecated in favor of the flags parameter to
- * vpx_codec_encode(). See the definition of VP8_EFLAG_* above.
- */
-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int)
-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int)
-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int)
-
-VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
-VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
-VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
-
-VPX_CTRL_USE_TYPE(VP9E_SET_SVC, int)
-VPX_CTRL_USE_TYPE(VP9E_SET_SVC_PARAMETERS, vpx_svc_parameters_t *)
-VPX_CTRL_USE_TYPE(VP9E_SET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
-
-VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
-VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
-VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
-VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
-VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
-VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, int) /* vp8e_token_partitions */
-
-VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
-VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH, unsigned int)
-VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_TYPE, unsigned int)
-VPX_CTRL_USE_TYPE(VP8E_SET_TUNING, int) /* vp8e_tuning */
-VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL, unsigned int)
-
-VPX_CTRL_USE_TYPE(VP9E_SET_TILE_COLUMNS, int)
-VPX_CTRL_USE_TYPE(VP9E_SET_TILE_ROWS, int)
-
-VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
-VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
-
-VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
-
-VPX_CTRL_USE_TYPE(VP9E_SET_LOSSLESS, unsigned int)
-
-VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PARALLEL_DECODING, unsigned int)
-
-VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)
-
-VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PERIODIC_BOOST, unsigned int)
-
-/*! @} - end defgroup vp8_encoder */
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_VP8CX_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vp8dx.h b/videocodec/libvpx_internal/libvpx/vpx/vp8dx.h
deleted file mode 100644
index bde77c2..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vp8dx.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*!\defgroup vp8_decoder WebM VP8 Decoder
- * \ingroup vp8
- *
- * @{
- */
-/*!\file
- * \brief Provides definitions for using the VP8 algorithm within the vpx Decoder
- * interface.
- */
-#ifndef VPX_VP8DX_H_
-#define VPX_VP8DX_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Include controls common to both the encoder and decoder */
-#include "./vp8.h"
-
-/*!\name Algorithm interface for VP8
- *
- * This interface provides the capability to decode raw VP8 streams, as would
- * be found in AVI files and other non-Flash uses.
- * @{
- */
-extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
-extern vpx_codec_iface_t *vpx_codec_vp8_dx(void);
-
-/* TODO(jkoleszar): These move to VP9 in a later patch set. */
-extern vpx_codec_iface_t vpx_codec_vp9_dx_algo;
-extern vpx_codec_iface_t *vpx_codec_vp9_dx(void);
-/*!@} - end algorithm interface member group*/
-
-
-/*!\enum vp8_dec_control_id
- * \brief VP8 decoder control functions
- *
- * This set of macros define the control functions available for the VP8
- * decoder interface.
- *
- * \sa #vpx_codec_control
- */
-enum vp8_dec_control_id {
- /** control function to get info on which reference frames were updated
- * by the last decode
- */
- VP8D_GET_LAST_REF_UPDATES = VP8_DECODER_CTRL_ID_START,
-
- /** check if the indicated frame is corrupted */
- VP8D_GET_FRAME_CORRUPTED,
-
- /** control function to get info on which reference frames were used
- * by the last decode
- */
- VP8D_GET_LAST_REF_USED,
-
- /** decryption function to decrypt encoded buffer data immediately
- * before decoding. Takes a vp8_decrypt_init, which contains
- * a callback function and opaque context pointer.
- */
- VP8D_SET_DECRYPTOR,
-
- /** control function to get the display dimensions for the current frame. */
- VP9D_GET_DISPLAY_SIZE,
-
- /** For testing. */
- VP9_INVERT_TILE_DECODE_ORDER,
-
- VP8_DECODER_CTRL_ID_MAX
-};
-
-/*!\brief Structure to hold decryption state
- *
- * Defines a structure to hold the decryption state and access function.
- */
-typedef struct vp8_decrypt_init {
- /** Decrypt n bytes of data from input -> output, using the decrypt_state
- * passed in VP8D_SET_DECRYPTOR.
- */
- void (*decrypt_cb)(void *decrypt_state, const unsigned char *input,
- unsigned char *output, int count);
- /*! Decryption state. */
- void *decrypt_state;
-} vp8_decrypt_init;
-
-/*!\brief VP8 decoder control function parameter type
- *
- * Defines the data types that VP8D control functions take. Note that
- * additional common controls are defined in vp8.h
- *
- */
-
-
-VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *)
-VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
-VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
-VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vp8_decrypt_init *)
-VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
-VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
-
-/*! @} - end defgroup vp8_decoder */
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_VP8DX_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vpx_codec.h b/videocodec/libvpx_internal/libvpx/vpx/vpx_codec.h
deleted file mode 100644
index 03d2dec..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vpx_codec.h
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*!\defgroup codec Common Algorithm Interface
- * This abstraction allows applications to easily support multiple video
- * formats with minimal code duplication. This section describes the interface
- * common to all codecs (both encoders and decoders).
- * @{
- */
-
-/*!\file
- * \brief Describes the codec algorithm interface to applications.
- *
- * This file describes the interface between an application and a
- * video codec algorithm.
- *
- * An application instantiates a specific codec instance by using
- * vpx_codec_init() and a pointer to the algorithm's interface structure:
- * <pre>
- * my_app.c:
- * extern vpx_codec_iface_t my_codec;
- * {
- * vpx_codec_ctx_t algo;
- * res = vpx_codec_init(&algo, &my_codec);
- * }
- * </pre>
- *
- * Once initialized, the instance is manged using other functions from
- * the vpx_codec_* family.
- */
-#ifndef VPX_VPX_CODEC_H_
-#define VPX_VPX_CODEC_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "./vpx_integer.h"
-#include "./vpx_image.h"
-
- /*!\brief Decorator indicating a function is deprecated */
-#ifndef DEPRECATED
-#if defined(__GNUC__) && __GNUC__
-#define DEPRECATED __attribute__ ((deprecated))
-#elif defined(_MSC_VER)
-#define DEPRECATED
-#else
-#define DEPRECATED
-#endif
-#endif /* DEPRECATED */
-
-#ifndef DECLSPEC_DEPRECATED
-#if defined(__GNUC__) && __GNUC__
-#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
-#elif defined(_MSC_VER)
-#define DECLSPEC_DEPRECATED __declspec(deprecated) /**< \copydoc #DEPRECATED */
-#else
-#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
-#endif
-#endif /* DECLSPEC_DEPRECATED */
-
- /*!\brief Decorator indicating a function is potentially unused */
-#ifdef UNUSED
-#elif __GNUC__
-#define UNUSED __attribute__ ((unused))
-#else
-#define UNUSED
-#endif
-
- /*!\brief Current ABI version number
- *
- * \internal
- * If this file is altered in any way that changes the ABI, this value
- * must be bumped. Examples include, but are not limited to, changing
- * types, removing or reassigning enums, adding/removing/rearranging
- * fields to structures
- */
-#define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/
-
- /*!\brief Algorithm return codes */
- typedef enum {
- /*!\brief Operation completed without error */
- VPX_CODEC_OK,
-
- /*!\brief Unspecified error */
- VPX_CODEC_ERROR,
-
- /*!\brief Memory operation failed */
- VPX_CODEC_MEM_ERROR,
-
- /*!\brief ABI version mismatch */
- VPX_CODEC_ABI_MISMATCH,
-
- /*!\brief Algorithm does not have required capability */
- VPX_CODEC_INCAPABLE,
-
- /*!\brief The given bitstream is not supported.
- *
- * The bitstream was unable to be parsed at the highest level. The decoder
- * is unable to proceed. This error \ref SHOULD be treated as fatal to the
- * stream. */
- VPX_CODEC_UNSUP_BITSTREAM,
-
- /*!\brief Encoded bitstream uses an unsupported feature
- *
- * The decoder does not implement a feature required by the encoder. This
- * return code should only be used for features that prevent future
- * pictures from being properly decoded. This error \ref MAY be treated as
- * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
- */
- VPX_CODEC_UNSUP_FEATURE,
-
- /*!\brief The coded data for this stream is corrupt or incomplete
- *
- * There was a problem decoding the current frame. This return code
- * should only be used for failures that prevent future pictures from
- * being properly decoded. This error \ref MAY be treated as fatal to the
- * stream or \ref MAY be treated as fatal to the current GOP. If decoding
- * is continued for the current GOP, artifacts may be present.
- */
- VPX_CODEC_CORRUPT_FRAME,
-
- /*!\brief An application-supplied parameter is not valid.
- *
- */
- VPX_CODEC_INVALID_PARAM,
-
- /*!\brief An iterator reached the end of list.
- *
- */
- VPX_CODEC_LIST_END
-
- }
- vpx_codec_err_t;
-
-
- /*! \brief Codec capabilities bitfield
- *
- * Each codec advertises the capabilities it supports as part of its
- * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
- * or functionality, and are not required to be supported.
- *
- * The available flags are specified by VPX_CODEC_CAP_* defines.
- */
- typedef long vpx_codec_caps_t;
-#define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
-#define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
-#define VPX_CODEC_CAP_XMA 0x4 /**< Supports eXternal Memory Allocation */
-
-
- /*! \brief Initialization-time Feature Enabling
- *
- * Certain codec features must be known at initialization time, to allow for
- * proper memory allocation.
- *
- * The available flags are specified by VPX_CODEC_USE_* defines.
- */
- typedef long vpx_codec_flags_t;
-#define VPX_CODEC_USE_XMA 0x00000001 /**< Use eXternal Memory Allocation mode */
-
-
- /*!\brief Codec interface structure.
- *
- * Contains function pointers and other data private to the codec
- * implementation. This structure is opaque to the application.
- */
- typedef const struct vpx_codec_iface vpx_codec_iface_t;
-
-
- /*!\brief Codec private data structure.
- *
- * Contains data private to the codec implementation. This structure is opaque
- * to the application.
- */
- typedef struct vpx_codec_priv vpx_codec_priv_t;
-
-
- /*!\brief Iterator
- *
- * Opaque storage used for iterating over lists.
- */
- typedef const void *vpx_codec_iter_t;
-
-
- /*!\brief Codec context structure
- *
- * All codecs \ref MUST support this context structure fully. In general,
- * this data should be considered private to the codec algorithm, and
- * not be manipulated or examined by the calling application. Applications
- * may reference the 'name' member to get a printable description of the
- * algorithm.
- */
- typedef struct vpx_codec_ctx {
- const char *name; /**< Printable interface name */
- vpx_codec_iface_t *iface; /**< Interface pointers */
- vpx_codec_err_t err; /**< Last returned error */
- const char *err_detail; /**< Detailed info, if available */
- vpx_codec_flags_t init_flags; /**< Flags passed at init time */
- union {
- struct vpx_codec_dec_cfg *dec; /**< Decoder Configuration Pointer */
- struct vpx_codec_enc_cfg *enc; /**< Encoder Configuration Pointer */
- void *raw;
- } config; /**< Configuration pointer aliasing union */
- vpx_codec_priv_t *priv; /**< Algorithm private storage */
- } vpx_codec_ctx_t;
-
-
- /*
- * Library Version Number Interface
- *
- * For example, see the following sample return values:
- * vpx_codec_version() (1<<16 | 2<<8 | 3)
- * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
- * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
- */
-
- /*!\brief Return the version information (as an integer)
- *
- * Returns a packed encoding of the library version number. This will only include
- * the major.minor.patch component of the version number. Note that this encoded
- * value should be accessed through the macros provided, as the encoding may change
- * in the future.
- *
- */
- int vpx_codec_version(void);
-#define VPX_VERSION_MAJOR(v) ((v>>16)&0xff) /**< extract major from packed version */
-#define VPX_VERSION_MINOR(v) ((v>>8)&0xff) /**< extract minor from packed version */
-#define VPX_VERSION_PATCH(v) ((v>>0)&0xff) /**< extract patch from packed version */
-
- /*!\brief Return the version major number */
-#define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
-
- /*!\brief Return the version minor number */
-#define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
-
- /*!\brief Return the version patch number */
-#define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
-
-
- /*!\brief Return the version information (as a string)
- *
- * Returns a printable string containing the full library version number. This may
- * contain additional text following the three digit version number, as to indicate
- * release candidates, prerelease versions, etc.
- *
- */
- const char *vpx_codec_version_str(void);
-
-
- /*!\brief Return the version information (as a string)
- *
- * Returns a printable "extra string". This is the component of the string returned
- * by vpx_codec_version_str() following the three digit version number.
- *
- */
- const char *vpx_codec_version_extra_str(void);
-
-
- /*!\brief Return the build configuration
- *
- * Returns a printable string containing an encoded version of the build
- * configuration. This may be useful to vpx support.
- *
- */
- const char *vpx_codec_build_config(void);
-
-
- /*!\brief Return the name for a given interface
- *
- * Returns a human readable string for name of the given codec interface.
- *
- * \param[in] iface Interface pointer
- *
- */
- const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
-
-
- /*!\brief Convert error number to printable string
- *
- * Returns a human readable string for the last error returned by the
- * algorithm. The returned error will be one line and will not contain
- * any newline characters.
- *
- *
- * \param[in] err Error number.
- *
- */
- const char *vpx_codec_err_to_string(vpx_codec_err_t err);
-
-
- /*!\brief Retrieve error synopsis for codec context
- *
- * Returns a human readable string for the last error returned by the
- * algorithm. The returned error will be one line and will not contain
- * any newline characters.
- *
- *
- * \param[in] ctx Pointer to this instance's context.
- *
- */
- const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
-
-
- /*!\brief Retrieve detailed error information for codec context
- *
- * Returns a human readable string providing detailed information about
- * the last error.
- *
- * \param[in] ctx Pointer to this instance's context.
- *
- * \retval NULL
- * No detailed information is available.
- */
- const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
-
-
- /* REQUIRED FUNCTIONS
- *
- * The following functions are required to be implemented for all codecs.
- * They represent the base case functionality expected of all codecs.
- */
-
- /*!\brief Destroy a codec instance
- *
- * Destroys a codec context, freeing any associated memory buffers.
- *
- * \param[in] ctx Pointer to this instance's context
- *
- * \retval #VPX_CODEC_OK
- * The codec algorithm initialized.
- * \retval #VPX_CODEC_MEM_ERROR
- * Memory allocation failed.
- */
- vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
-
-
- /*!\brief Get the capabilities of an algorithm.
- *
- * Retrieves the capabilities bitfield from the algorithm's interface.
- *
- * \param[in] iface Pointer to the algorithm interface
- *
- */
- vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
-
-
- /*!\brief Control algorithm
- *
- * This function is used to exchange algorithm specific data with the codec
- * instance. This can be used to implement features specific to a particular
- * algorithm.
- *
- * This wrapper function dispatches the request to the helper function
- * associated with the given ctrl_id. It tries to call this function
- * transparently, but will return #VPX_CODEC_ERROR if the request could not
- * be dispatched.
- *
- * Note that this function should not be used directly. Call the
- * #vpx_codec_control wrapper macro instead.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] ctrl_id Algorithm specific control identifier
- *
- * \retval #VPX_CODEC_OK
- * The control request was processed.
- * \retval #VPX_CODEC_ERROR
- * The control request was not processed.
- * \retval #VPX_CODEC_INVALID_PARAM
- * The data was not valid.
- */
- vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
- int ctrl_id,
- ...);
-#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
-# define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
-# define VPX_CTRL_USE_TYPE(id, typ)
-# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
-# define VPX_CTRL_VOID(id, typ)
-
-#else
- /*!\brief vpx_codec_control wrapper macro
- *
- * This macro allows for type safe conversions across the variadic parameter
- * to vpx_codec_control_().
- *
- * \internal
- * It works by dispatching the call to the control function through a wrapper
- * function named with the id parameter.
- */
-# define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
- /**<\hideinitializer*/
-
-
- /*!\brief vpx_codec_control type definition macro
- *
- * This macro allows for type safe conversions across the variadic parameter
- * to vpx_codec_control_(). It defines the type of the argument for a given
- * control identifier.
- *
- * \internal
- * It defines a static function with
- * the correctly typed arguments as a wrapper to the type-unsafe internal
- * function.
- */
-# define VPX_CTRL_USE_TYPE(id, typ) \
- static vpx_codec_err_t \
- vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
- \
- static vpx_codec_err_t \
- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
- return vpx_codec_control_(ctx, ctrl_id, data);\
- } /**<\hideinitializer*/
-
-
- /*!\brief vpx_codec_control deprecated type definition macro
- *
- * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
- * deprecated and should not be used. Consult the documentation for your
- * codec for more information.
- *
- * \internal
- * It defines a static function with the correctly typed arguments as a
- * wrapper to the type-unsafe internal function.
- */
-# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
- DECLSPEC_DEPRECATED static vpx_codec_err_t \
- vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
- \
- DECLSPEC_DEPRECATED static vpx_codec_err_t \
- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
- return vpx_codec_control_(ctx, ctrl_id, data);\
- } /**<\hideinitializer*/
-
-
- /*!\brief vpx_codec_control void type definition macro
- *
- * This macro allows for type safe conversions across the variadic parameter
- * to vpx_codec_control_(). It indicates that a given control identifier takes
- * no argument.
- *
- * \internal
- * It defines a static function without a data argument as a wrapper to the
- * type-unsafe internal function.
- */
-# define VPX_CTRL_VOID(id) \
- static vpx_codec_err_t \
- vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
- \
- static vpx_codec_err_t \
- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
- return vpx_codec_control_(ctx, ctrl_id);\
- } /**<\hideinitializer*/
-
-
-#endif
-
-
- /*!\defgroup cap_xma External Memory Allocation Functions
- *
- * The following functions are required to be implemented for all codecs
- * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions
- * for codecs that don't advertise this capability will result in an error
- * code being returned, usually VPX_CODEC_INCAPABLE
- * @{
- */
-
-
- /*!\brief Memory Map Entry
- *
- * This structure is used to contain the properties of a memory segment. It
- * is populated by the codec in the request phase, and by the calling
- * application once the requested allocation has been performed.
- */
- typedef struct vpx_codec_mmap {
- /*
- * The following members are set by the codec when requesting a segment
- */
- unsigned int id; /**< identifier for the segment's contents */
- unsigned long sz; /**< size of the segment, in bytes */
- unsigned int align; /**< required alignment of the segment, in bytes */
- unsigned int flags; /**< bitfield containing segment properties */
-#define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
-#define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
-#define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
-
- /* The following members are to be filled in by the allocation function */
- void *base; /**< pointer to the allocated segment */
- void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */
- void *priv; /**< allocator private storage */
- } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */
-
-
- /*!\brief Iterate over the list of segments to allocate.
- *
- * Iterates over a list of the segments to allocate. The iterator storage
- * should be initialized to NULL to start the iteration. Iteration is complete
- * when this function returns VPX_CODEC_LIST_END. The amount of memory needed to
- * allocate is dependent upon the size of the encoded stream. In cases where the
- * stream is not available at allocation time, a fixed size must be requested.
- * The codec will not be able to operate on streams larger than the size used at
- * allocation time.
- *
- * \param[in] ctx Pointer to this instance's context.
- * \param[out] mmap Pointer to the memory map entry to populate.
- * \param[in,out] iter Iterator storage, initialized to NULL
- *
- * \retval #VPX_CODEC_OK
- * The memory map entry was populated.
- * \retval #VPX_CODEC_ERROR
- * Codec does not support XMA mode.
- * \retval #VPX_CODEC_MEM_ERROR
- * Unable to determine segment size from stream info.
- */
- vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
- vpx_codec_mmap_t *mmap,
- vpx_codec_iter_t *iter);
-
-
- /*!\brief Identify allocated segments to codec instance
- *
- * Stores a list of allocated segments in the codec. Segments \ref MUST be
- * passed in the order they are read from vpx_codec_get_mem_map(), but may be
- * passed in groups of any size. Segments \ref MUST be set only once. The
- * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member
- * is non-NULL. If the segment requires cleanup handling (e.g., calling free()
- * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated.
- *
- * \param[in] ctx Pointer to this instance's context.
- * \param[in] mmaps Pointer to the first memory map entry in the list.
- * \param[in] num_maps Number of entries being set at this time
- *
- * \retval #VPX_CODEC_OK
- * The segment was stored in the codec context.
- * \retval #VPX_CODEC_INCAPABLE
- * Codec does not support XMA mode.
- * \retval #VPX_CODEC_MEM_ERROR
- * Segment base address was not set, or segment was already stored.
-
- */
- vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
- vpx_codec_mmap_t *mmaps,
- unsigned int num_maps);
-
- /*!@} - end defgroup cap_xma*/
- /*!@} - end defgroup codec*/
-#ifdef __cplusplus
-}
-#endif
-#endif // VPX_VPX_CODEC_H_
-
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vpx_codec.mk b/videocodec/libvpx_internal/libvpx/vpx/vpx_codec.mk
deleted file mode 100644
index 98d1d56..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vpx_codec.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-##
-## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-API_EXPORTS += exports
-
-API_SRCS-$(CONFIG_VP8_ENCODER) += vp8.h
-API_SRCS-$(CONFIG_VP8_ENCODER) += vp8cx.h
-API_DOC_SRCS-$(CONFIG_VP8_ENCODER) += vp8.h
-API_DOC_SRCS-$(CONFIG_VP8_ENCODER) += vp8cx.h
-API_SRCS-$(CONFIG_VP9_ENCODER) += src/svc_encodeframe.c
-API_SRCS-$(CONFIG_VP9_ENCODER) += svc_context.h
-
-API_SRCS-$(CONFIG_VP8_DECODER) += vp8.h
-API_SRCS-$(CONFIG_VP8_DECODER) += vp8dx.h
-API_DOC_SRCS-$(CONFIG_VP8_DECODER) += vp8.h
-API_DOC_SRCS-$(CONFIG_VP8_DECODER) += vp8dx.h
-
-API_DOC_SRCS-yes += vpx_codec.h
-API_DOC_SRCS-yes += vpx_decoder.h
-API_DOC_SRCS-yes += vpx_encoder.h
-API_DOC_SRCS-yes += vpx_frame_buffer.h
-API_DOC_SRCS-yes += vpx_image.h
-
-API_SRCS-yes += src/vpx_decoder.c
-API_SRCS-yes += vpx_decoder.h
-API_SRCS-yes += src/vpx_encoder.c
-API_SRCS-yes += vpx_encoder.h
-API_SRCS-yes += internal/vpx_codec_internal.h
-API_SRCS-yes += internal/vpx_psnr.h
-API_SRCS-yes += src/vpx_codec.c
-API_SRCS-yes += src/vpx_image.c
-API_SRCS-yes += src/vpx_psnr.c
-API_SRCS-yes += vpx_codec.h
-API_SRCS-yes += vpx_codec.mk
-API_SRCS-yes += vpx_frame_buffer.h
-API_SRCS-yes += vpx_image.h
-API_SRCS-$(BUILD_LIBVPX) += vpx_integer.h
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vpx_decoder.h b/videocodec/libvpx_internal/libvpx/vpx/vpx_decoder.h
deleted file mode 100644
index ba18328..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vpx_decoder.h
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VPX_VPX_DECODER_H_
-#define VPX_VPX_DECODER_H_
-
-/*!\defgroup decoder Decoder Algorithm Interface
- * \ingroup codec
- * This abstraction allows applications using this decoder to easily support
- * multiple video formats with minimal code duplication. This section describes
- * the interface common to all decoders.
- * @{
- */
-
-/*!\file
- * \brief Describes the decoder algorithm interface to applications.
- *
- * This file describes the interface between an application and a
- * video decoder algorithm.
- *
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "./vpx_codec.h"
-#include "./vpx_frame_buffer.h"
-
- /*!\brief Current ABI version number
- *
- * \internal
- * If this file is altered in any way that changes the ABI, this value
- * must be bumped. Examples include, but are not limited to, changing
- * types, removing or reassigning enums, adding/removing/rearranging
- * fields to structures
- */
-#define VPX_DECODER_ABI_VERSION (3 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
-
- /*! \brief Decoder capabilities bitfield
- *
- * Each decoder advertises the capabilities it supports as part of its
- * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
- * or functionality, and are not required to be supported by a decoder.
- *
- * The available flags are specified by VPX_CODEC_CAP_* defines.
- */
-#define VPX_CODEC_CAP_PUT_SLICE 0x10000 /**< Will issue put_slice callbacks */
-#define VPX_CODEC_CAP_PUT_FRAME 0x20000 /**< Will issue put_frame callbacks */
-#define VPX_CODEC_CAP_POSTPROC 0x40000 /**< Can postprocess decoded frame */
-#define VPX_CODEC_CAP_ERROR_CONCEALMENT 0x80000 /**< Can conceal errors due to
- packet loss */
-#define VPX_CODEC_CAP_INPUT_FRAGMENTS 0x100000 /**< Can receive encoded frames
- one fragment at a time */
-
- /*! \brief Initialization-time Feature Enabling
- *
- * Certain codec features must be known at initialization time, to allow for
- * proper memory allocation.
- *
- * The available flags are specified by VPX_CODEC_USE_* defines.
- */
-#define VPX_CODEC_CAP_FRAME_THREADING 0x200000 /**< Can support frame-based
- multi-threading */
-#define VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x400000 /**< Can support external
- frame buffers */
-
-#define VPX_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */
-#define VPX_CODEC_USE_ERROR_CONCEALMENT 0x20000 /**< Conceal errors in decoded
- frames */
-#define VPX_CODEC_USE_INPUT_FRAGMENTS 0x40000 /**< The input frame should be
- passed to the decoder one
- fragment at a time */
-#define VPX_CODEC_USE_FRAME_THREADING 0x80000 /**< Enable frame-based
- multi-threading */
-
- /*!\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.
- */
- typedef struct vpx_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 */
- } vpx_codec_stream_info_t;
-
- /* REQUIRED FUNCTIONS
- *
- * The following functions are required to be implemented for all decoders.
- * They represent the base case functionality expected of all decoders.
- */
-
-
- /*!\brief Initialization Configurations
- *
- * This structure is used to pass init time configuration options to the
- * decoder.
- */
- typedef struct vpx_codec_dec_cfg {
- unsigned int threads; /**< Maximum number of threads to use, default 1 */
- unsigned int w; /**< Width */
- unsigned int h; /**< Height */
- } vpx_codec_dec_cfg_t; /**< alias for struct vpx_codec_dec_cfg */
-
-
- /*!\brief Initialize a decoder instance
- *
- * Initializes a decoder context using the given interface. Applications
- * should call the vpx_codec_dec_init convenience macro instead of this
- * function directly, to ensure that the ABI version number parameter
- * is properly initialized.
- *
- * If the library was configured with --disable-multithread, this call
- * is not thread safe and should be guarded with a lock if being used
- * in a multithreaded context.
- *
- * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
- * parameter), the storage pointed to by the cfg parameter must be
- * kept readable and stable until all memory maps have been set.
- *
- * \param[in] ctx Pointer to this instance's context.
- * \param[in] iface Pointer to the algorithm interface to use.
- * \param[in] cfg Configuration to use, if known. May be NULL.
- * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
- * \param[in] ver ABI version number. Must be set to
- * VPX_DECODER_ABI_VERSION
- * \retval #VPX_CODEC_OK
- * The decoder algorithm initialized.
- * \retval #VPX_CODEC_MEM_ERROR
- * Memory allocation failed.
- */
- vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_dec_cfg_t *cfg,
- vpx_codec_flags_t flags,
- int ver);
-
- /*!\brief Convenience macro for vpx_codec_dec_init_ver()
- *
- * Ensures the ABI version parameter is properly set.
- */
-#define vpx_codec_dec_init(ctx, iface, cfg, flags) \
- vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)
-
-
- /*!\brief Parse stream info from a buffer
- *
- * Performs high level parsing of the bitstream. Construction of a decoder
- * context is not necessary. Can be used to determine if the bitstream is
- * of the proper format, and to extract information from the stream.
- *
- * \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.
- *
- * \retval #VPX_CODEC_OK
- * Bitstream is parsable and stream information updated
- */
- vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
- const uint8_t *data,
- unsigned int data_sz,
- vpx_codec_stream_info_t *si);
-
-
- /*!\brief Return information about the current stream.
- *
- * 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.
- *
- * \retval #VPX_CODEC_OK
- * Bitstream is parsable and stream information updated
- */
- vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
- vpx_codec_stream_info_t *si);
-
-
- /*!\brief Decode data
- *
- * Processes a buffer of coded data. If the processing results in a new
- * decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
- * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
- * time stamp) order. Frames produced will always be in PTS (presentation
- * time stamp) order.
- * If the decoder is configured with VPX_CODEC_USE_INPUT_FRAGMENTS enabled,
- * data and data_sz can contain a fragment of the encoded frame. Fragment
- * \#n must contain at least partition \#n, but can also contain subsequent
- * partitions (\#n+1 - \#n+i), and if so, fragments \#n+1, .., \#n+i must
- * be empty. When no more data is available, this function should be called
- * with NULL as data and 0 as data_sz. The memory passed to this function
- * must be available until the frame has been decoded.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] data Pointer to this block of new coded data. If
- * NULL, a VPX_CODEC_CB_PUT_FRAME event is posted
- * for the previously decoded frame.
- * \param[in] data_sz Size of the coded data, in bytes.
- * \param[in] user_priv Application specific data to associate with
- * this frame.
- * \param[in] deadline Soft deadline the decoder should attempt to meet,
- * in us. Set to zero for unlimited.
- *
- * \return Returns #VPX_CODEC_OK if the coded data was processed completely
- * and future pictures can be decoded without error. Otherwise,
- * see the descriptions of the other error codes in ::vpx_codec_err_t
- * for recoverability capabilities.
- */
- vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
- const uint8_t *data,
- unsigned int data_sz,
- void *user_priv,
- long deadline);
-
-
- /*!\brief Decoded frames iterator
- *
- * Iterates over a list of the frames available for display. The iterator
- * storage should be initialized to NULL to start the iteration. Iteration is
- * complete when this function returns NULL.
- *
- * The list of available frames becomes valid upon completion of the
- * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in,out] iter Iterator storage, initialized to NULL
- *
- * \return Returns a pointer to an image, if one is ready for display. Frames
- * produced will always be in PTS (presentation time stamp) order.
- */
- vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
- vpx_codec_iter_t *iter);
-
-
- /*!\defgroup cap_put_frame Frame-Based Decoding Functions
- *
- * The following functions are required to be implemented for all decoders
- * that advertise the VPX_CODEC_CAP_PUT_FRAME capability. Calling these functions
- * for codecs that don't advertise this capability will result in an error
- * code being returned, usually VPX_CODEC_ERROR
- * @{
- */
-
- /*!\brief put frame callback prototype
- *
- * This callback is invoked by the decoder to notify the application of
- * the availability of decoded image data.
- */
- typedef void (*vpx_codec_put_frame_cb_fn_t)(void *user_priv,
- const vpx_image_t *img);
-
-
- /*!\brief Register for notification of frame completion.
- *
- * Registers a given function to be called when a decoded frame is
- * available.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] cb Pointer to the callback function
- * \param[in] user_priv User's private data
- *
- * \retval #VPX_CODEC_OK
- * Callback successfully registered.
- * \retval #VPX_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * posting slice completion.
- */
- vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
- vpx_codec_put_frame_cb_fn_t cb,
- void *user_priv);
-
-
- /*!@} - end defgroup cap_put_frame */
-
- /*!\defgroup cap_put_slice Slice-Based Decoding Functions
- *
- * The following functions are required to be implemented for all decoders
- * that advertise the VPX_CODEC_CAP_PUT_SLICE capability. Calling these functions
- * for codecs that don't advertise this capability will result in an error
- * code being returned, usually VPX_CODEC_ERROR
- * @{
- */
-
- /*!\brief put slice callback prototype
- *
- * This callback is invoked by the decoder to notify the application of
- * the availability of partially decoded image data. The
- */
- typedef void (*vpx_codec_put_slice_cb_fn_t)(void *user_priv,
- const vpx_image_t *img,
- const vpx_image_rect_t *valid,
- const vpx_image_rect_t *update);
-
-
- /*!\brief Register for notification of slice completion.
- *
- * Registers a given function to be called when a decoded slice is
- * available.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] cb Pointer to the callback function
- * \param[in] user_priv User's private data
- *
- * \retval #VPX_CODEC_OK
- * Callback successfully registered.
- * \retval #VPX_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * posting slice completion.
- */
- vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
- vpx_codec_put_slice_cb_fn_t cb,
- void *user_priv);
-
-
- /*!@} - end defgroup cap_put_slice*/
-
- /*!\defgroup cap_external_frame_buffer External Frame Buffer Functions
- *
- * The following section is required to be implemented for all decoders
- * that advertise the VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER capability.
- * Calling this function for codecs that don't advertise this capability
- * will result in an error code being returned, usually VPX_CODEC_ERROR.
- *
- * \note
- * Currently this only works with VP9.
- * @{
- */
-
- /*!\brief Pass in external frame buffers for the decoder to use.
- *
- * Registers functions to be called when libvpx needs a frame buffer
- * to decode the current frame and a function to be called when libvpx does
- * not internally reference the frame buffer. This set function must
- * be called before the first call to decode or libvpx will assume the
- * default behavior of allocating frame buffers internally.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] cb_get Pointer to the get callback function
- * \param[in] cb_release Pointer to the release callback function
- * \param[in] cb_priv Callback's private data
- *
- * \retval #VPX_CODEC_OK
- * External frame buffers will be used by libvpx.
- * \retval #VPX_CODEC_INVALID_PARAM
- * One or more of the callbacks were NULL.
- * \retval #VPX_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * using external frame buffers.
- *
- * \note
- * When decoding VP9, the application may be required to pass in at least
- * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame
- * buffers.
- */
- vpx_codec_err_t vpx_codec_set_frame_buffer_functions(
- vpx_codec_ctx_t *ctx,
- vpx_get_frame_buffer_cb_fn_t cb_get,
- vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
-
- /*!@} - end defgroup cap_external_frame_buffer */
-
- /*!@} - end defgroup decoder*/
-#ifdef __cplusplus
-}
-#endif
-#endif // VPX_VPX_DECODER_H_
-
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vpx_encoder.h b/videocodec/libvpx_internal/libvpx/vpx/vpx_encoder.h
deleted file mode 100644
index 2c882c1..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vpx_encoder.h
+++ /dev/null
@@ -1,944 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VPX_VPX_ENCODER_H_
-#define VPX_VPX_ENCODER_H_
-
-/*!\defgroup encoder Encoder Algorithm Interface
- * \ingroup codec
- * This abstraction allows applications using this encoder to easily support
- * multiple video formats with minimal code duplication. This section describes
- * the interface common to all encoders.
- * @{
- */
-
-/*!\file
- * \brief Describes the encoder algorithm interface to applications.
- *
- * This file describes the interface between an application and a
- * video encoder algorithm.
- *
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "./vpx_codec.h"
-
- /*! Temporal Scalability: Maximum length of the sequence defining frame
- * layer membership
- */
-#define VPX_TS_MAX_PERIODICITY 16
-
- /*! Temporal Scalability: Maximum number of coding layers */
-#define VPX_TS_MAX_LAYERS 5
-
- /*!\deprecated Use #VPX_TS_MAX_PERIODICITY instead. */
-#define MAX_PERIODICITY VPX_TS_MAX_PERIODICITY
-
- /*!\deprecated Use #VPX_TS_MAX_LAYERS instead. */
-#define MAX_LAYERS VPX_TS_MAX_LAYERS
-
-/*! Spatial Scalability: Maximum number of coding layers */
-#define VPX_SS_MAX_LAYERS 5
-
-/*! Spatial Scalability: Default number of coding layers */
-#define VPX_SS_DEFAULT_LAYERS 1
-
- /*!\brief Current ABI version number
- *
- * \internal
- * If this file is altered in any way that changes the ABI, this value
- * must be bumped. Examples include, but are not limited to, changing
- * types, removing or reassigning enums, adding/removing/rearranging
- * fields to structures
- */
-#define VPX_ENCODER_ABI_VERSION (3 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
-
-
- /*! \brief Encoder capabilities bitfield
- *
- * Each encoder advertises the capabilities it supports as part of its
- * ::vpx_codec_iface_t interface structure. Capabilities are extra
- * interfaces or functionality, and are not required to be supported
- * by an encoder.
- *
- * The available flags are specified by VPX_CODEC_CAP_* defines.
- */
-#define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */
-
- /*! Can output one partition at a time. Each partition is returned in its
- * own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for
- * every partition but the last. In this mode all frames are always
- * returned partition by partition.
- */
-#define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000
-
-
- /*! \brief Initialization-time Feature Enabling
- *
- * Certain codec features must be known at initialization time, to allow
- * for proper memory allocation.
- *
- * The available flags are specified by VPX_CODEC_USE_* defines.
- */
-#define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */
-#define VPX_CODEC_USE_OUTPUT_PARTITION 0x20000 /**< Make the encoder output one
- partition at a time. */
-
-
- /*!\brief Generic fixed size buffer structure
- *
- * This structure is able to hold a reference to any fixed size buffer.
- */
- typedef struct vpx_fixed_buf {
- void *buf; /**< Pointer to the data */
- size_t sz; /**< Length of the buffer, in chars */
- } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */
-
-
- /*!\brief Time Stamp Type
- *
- * An integer, which when multiplied by the stream's time base, provides
- * the absolute time of a sample.
- */
- typedef int64_t vpx_codec_pts_t;
-
-
- /*!\brief Compressed Frame Flags
- *
- * This type represents a bitfield containing information about a compressed
- * frame that may be useful to an application. The most significant 16 bits
- * can be used by an algorithm to provide additional detail, for example to
- * support frame types that are codec specific (MPEG-1 D-frames for example)
- */
- typedef uint32_t vpx_codec_frame_flags_t;
-#define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */
-#define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting
- the stream (no future frame depends on
- this one) */
-#define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not
- be shown */
-#define VPX_FRAME_IS_FRAGMENT 0x8 /**< this is a fragment of the encoded
- frame */
-
- /*!\brief Error Resilient flags
- *
- * These flags define which error resilient features to enable in the
- * encoder. The flags are specified through the
- * vpx_codec_enc_cfg::g_error_resilient variable.
- */
- typedef uint32_t vpx_codec_er_flags_t;
-#define VPX_ERROR_RESILIENT_DEFAULT 0x1 /**< Improve resiliency against
- losses of whole frames */
-#define VPX_ERROR_RESILIENT_PARTITIONS 0x2 /**< The frame partitions are
- independently decodable by the
- bool decoder, meaning that
- partitions can be decoded even
- though earlier partitions have
- been lost. Note that intra
- predicition is still done over
- the partition boundary. */
-
- /*!\brief Encoder output packet variants
- *
- * This enumeration lists the different kinds of data packets that can be
- * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY
- * extend this list to provide additional functionality.
- */
- enum vpx_codec_cx_pkt_kind {
- VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */
- VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */
- VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */
- VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */
- };
-
-
- /*!\brief Encoder output packet
- *
- * This structure contains the different kinds of output data the encoder
- * may produce while compressing a frame.
- */
- typedef struct vpx_codec_cx_pkt {
- enum vpx_codec_cx_pkt_kind kind; /**< packet variant */
- union {
- struct {
- void *buf; /**< compressed data buffer */
- size_t sz; /**< length of compressed data */
- vpx_codec_pts_t pts; /**< time stamp to show frame
- (in timebase units) */
- unsigned long duration; /**< duration to show frame
- (in timebase units) */
- vpx_codec_frame_flags_t flags; /**< flags for this frame */
- int partition_id; /**< the partition id
- defines the decoding order
- of the partitions. Only
- applicable when "output partition"
- mode is enabled. First partition
- has id 0.*/
-
- } frame; /**< data for compressed frame packet */
- struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet */
- struct vpx_psnr_pkt {
- unsigned int samples[4]; /**< Number of samples, total/y/u/v */
- uint64_t sse[4]; /**< sum squared error, total/y/u/v */
- double psnr[4]; /**< PSNR, total/y/u/v */
- } psnr; /**< data for PSNR packet */
- struct vpx_fixed_buf raw; /**< data for arbitrary packets */
-
- /* This packet size is fixed to allow codecs to extend this
- * interface without having to manage storage for raw packets,
- * i.e., if it's smaller than 128 bytes, you can store in the
- * packet list directly.
- */
- char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */
- } data; /**< packet data */
- } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */
-
-
- /*!\brief Rational Number
- *
- * This structure holds a fractional value.
- */
- typedef struct vpx_rational {
- int num; /**< fraction numerator */
- int den; /**< fraction denominator */
- } vpx_rational_t; /**< alias for struct vpx_rational */
-
-
- /*!\brief Multi-pass Encoding Pass */
- enum vpx_enc_pass {
- VPX_RC_ONE_PASS, /**< Single pass mode */
- VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */
- VPX_RC_LAST_PASS /**< Final pass of multi-pass mode */
- };
-
-
- /*!\brief Rate control mode */
- enum vpx_rc_mode {
- VPX_VBR, /**< Variable Bit Rate (VBR) mode */
- VPX_CBR, /**< Constant Bit Rate (CBR) mode */
- VPX_CQ, /**< Constrained Quality (CQ) mode */
- VPX_Q, /**< Constant Quality (Q) mode */
- };
-
-
- /*!\brief Keyframe placement mode.
- *
- * This enumeration determines whether keyframes are placed automatically by
- * the encoder or whether this behavior is disabled. Older releases of this
- * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled.
- * This name is confusing for this behavior, so the new symbols to be used
- * are VPX_KF_AUTO and VPX_KF_DISABLED.
- */
- enum vpx_kf_mode {
- VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */
- VPX_KF_AUTO, /**< Encoder determines optimal placement automatically */
- VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
- };
-
-
- /*!\brief Encoded Frame Flags
- *
- * This type indicates a bitfield to be passed to vpx_codec_encode(), defining
- * per-frame boolean values. By convention, bits common to all codecs will be
- * named VPX_EFLAG_*, and bits specific to an algorithm will be named
- * /algo/_eflag_*. The lower order 16 bits are reserved for common use.
- */
- typedef long vpx_enc_frame_flags_t;
-#define VPX_EFLAG_FORCE_KF (1<<0) /**< Force this frame to be a keyframe */
-
-
- /*!\brief Encoder configuration structure
- *
- * This structure contains the encoder settings that have common representations
- * across all codecs. This doesn't imply that all codecs support all features,
- * however.
- */
- typedef struct vpx_codec_enc_cfg {
- /*
- * generic settings (g)
- */
-
- /*!\brief Algorithm specific "usage" value
- *
- * Algorithms may define multiple values for usage, which may convey the
- * intent of how the application intends to use the stream. If this value
- * is non-zero, consult the documentation for the codec to determine its
- * meaning.
- */
- unsigned int g_usage;
-
-
- /*!\brief Maximum number of threads to use
- *
- * For multi-threaded implementations, use no more than this number of
- * threads. The codec may use fewer threads than allowed. The value
- * 0 is equivalent to the value 1.
- */
- unsigned int g_threads;
-
-
- /*!\brief Bitstream profile to use
- *
- * Some codecs support a notion of multiple bitstream profiles. Typically
- * this maps to a set of features that are turned on or off. Often the
- * profile to use is determined by the features of the intended decoder.
- * Consult the documentation for the codec to determine the valid values
- * for this parameter, or set to zero for a sane default.
- */
- unsigned int g_profile; /**< profile of bitstream to use */
-
-
-
- /*!\brief Width of the frame
- *
- * This value identifies the presentation resolution of the frame,
- * in pixels. Note that the frames passed as input to the encoder must
- * have this resolution. Frames will be presented by the decoder in this
- * resolution, independent of any spatial resampling the encoder may do.
- */
- unsigned int g_w;
-
-
- /*!\brief Height of the frame
- *
- * This value identifies the presentation resolution of the frame,
- * in pixels. Note that the frames passed as input to the encoder must
- * have this resolution. Frames will be presented by the decoder in this
- * resolution, independent of any spatial resampling the encoder may do.
- */
- unsigned int g_h;
-
-
- /*!\brief Stream timebase units
- *
- * Indicates the smallest interval of time, in seconds, used by the stream.
- * For fixed frame rate material, or variable frame rate material where
- * frames are timed at a multiple of a given clock (ex: video capture),
- * the \ref RECOMMENDED method is to set the timebase to the reciprocal
- * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the
- * pts to correspond to the frame number, which can be handy. For
- * re-encoding video from containers with absolute time timestamps, the
- * \ref RECOMMENDED method is to set the timebase to that of the parent
- * container or multimedia framework (ex: 1/1000 for ms, as in FLV).
- */
- struct vpx_rational g_timebase;
-
-
- /*!\brief Enable error resilient modes.
- *
- * The error resilient bitfield indicates to the encoder which features
- * it should enable to take measures for streaming over lossy or noisy
- * links.
- */
- vpx_codec_er_flags_t g_error_resilient;
-
-
- /*!\brief Multi-pass Encoding Mode
- *
- * This value should be set to the current phase for multi-pass encoding.
- * For single pass, set to #VPX_RC_ONE_PASS.
- */
- enum vpx_enc_pass g_pass;
-
-
- /*!\brief Allow lagged encoding
- *
- * If set, this value allows the encoder to consume a number of input
- * frames before producing output frames. This allows the encoder to
- * base decisions for the current frame on future frames. This does
- * increase the latency of the encoding pipeline, so it is not appropriate
- * in all situations (ex: realtime encoding).
- *
- * Note that this is a maximum value -- the encoder may produce frames
- * sooner than the given limit. Set this value to 0 to disable this
- * feature.
- */
- unsigned int g_lag_in_frames;
-
-
- /*
- * rate control settings (rc)
- */
-
- /*!\brief Temporal resampling configuration, if supported by the codec.
- *
- * Temporal resampling allows the codec to "drop" frames as a strategy to
- * meet its target data rate. This can cause temporal discontinuities in
- * the encoded video, which may appear as stuttering during playback. This
- * trade-off is often acceptable, but for many applications is not. It can
- * be disabled in these cases.
- *
- * Note that not all codecs support this feature. All vpx VPx codecs do.
- * For other codecs, consult the documentation for that algorithm.
- *
- * This threshold is described as a percentage of the target data buffer.
- * When the data buffer falls below this percentage of fullness, a
- * dropped frame is indicated. Set the threshold to zero (0) to disable
- * this feature.
- */
- unsigned int rc_dropframe_thresh;
-
-
- /*!\brief Enable/disable spatial resampling, if supported by the codec.
- *
- * Spatial resampling allows the codec to compress a lower resolution
- * version of the frame, which is then upscaled by the encoder to the
- * correct presentation resolution. This increases visual quality at
- * low data rates, at the expense of CPU time on the encoder/decoder.
- */
- unsigned int rc_resize_allowed;
-
-
- /*!\brief Spatial resampling up watermark.
- *
- * This threshold is described as a percentage of the target data buffer.
- * When the data buffer rises above this percentage of fullness, the
- * encoder will step up to a higher resolution version of the frame.
- */
- unsigned int rc_resize_up_thresh;
-
-
- /*!\brief Spatial resampling down watermark.
- *
- * This threshold is described as a percentage of the target data buffer.
- * When the data buffer falls below this percentage of fullness, the
- * encoder will step down to a lower resolution version of the frame.
- */
- unsigned int rc_resize_down_thresh;
-
-
- /*!\brief Rate control algorithm to use.
- *
- * Indicates whether the end usage of this stream is to be streamed over
- * a bandwidth constrained link, indicating that Constant Bit Rate (CBR)
- * mode should be used, or whether it will be played back on a high
- * bandwidth link, as from a local disk, where higher variations in
- * bitrate are acceptable.
- */
- enum vpx_rc_mode rc_end_usage;
-
-
- /*!\brief Two-pass stats buffer.
- *
- * A buffer containing all of the stats packets produced in the first
- * pass, concatenated.
- */
- struct vpx_fixed_buf rc_twopass_stats_in;
-
-
- /*!\brief Target data rate
- *
- * Target bandwidth to use for this stream, in kilobits per second.
- */
- unsigned int rc_target_bitrate;
-
-
- /*
- * quantizer settings
- */
-
-
- /*!\brief Minimum (Best Quality) Quantizer
- *
- * The quantizer is the most direct control over the quality of the
- * encoded image. The range of valid values for the quantizer is codec
- * specific. Consult the documentation for the codec to determine the
- * values to use. To determine the range programmatically, call
- * vpx_codec_enc_config_default() with a usage value of 0.
- */
- unsigned int rc_min_quantizer;
-
-
- /*!\brief Maximum (Worst Quality) Quantizer
- *
- * The quantizer is the most direct control over the quality of the
- * encoded image. The range of valid values for the quantizer is codec
- * specific. Consult the documentation for the codec to determine the
- * values to use. To determine the range programmatically, call
- * vpx_codec_enc_config_default() with a usage value of 0.
- */
- unsigned int rc_max_quantizer;
-
-
- /*
- * bitrate tolerance
- */
-
-
- /*!\brief Rate control adaptation undershoot control
- *
- * This value, expressed as a percentage of the target bitrate,
- * controls the maximum allowed adaptation speed of the codec.
- * This factor controls the maximum amount of bits that can
- * be subtracted from the target bitrate in order to compensate
- * for prior overshoot.
- *
- * Valid values in the range 0-1000.
- */
- unsigned int rc_undershoot_pct;
-
-
- /*!\brief Rate control adaptation overshoot control
- *
- * This value, expressed as a percentage of the target bitrate,
- * controls the maximum allowed adaptation speed of the codec.
- * This factor controls the maximum amount of bits that can
- * be added to the target bitrate in order to compensate for
- * prior undershoot.
- *
- * Valid values in the range 0-1000.
- */
- unsigned int rc_overshoot_pct;
-
-
- /*
- * decoder buffer model parameters
- */
-
-
- /*!\brief Decoder Buffer Size
- *
- * This value indicates the amount of data that may be buffered by the
- * decoding application. Note that this value is expressed in units of
- * time (milliseconds). For example, a value of 5000 indicates that the
- * client will buffer (at least) 5000ms worth of encoded data. Use the
- * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if
- * necessary.
- */
- unsigned int rc_buf_sz;
-
-
- /*!\brief Decoder Buffer Initial Size
- *
- * This value indicates the amount of data that will be buffered by the
- * decoding application prior to beginning playback. This value is
- * expressed in units of time (milliseconds). Use the target bitrate
- * (#rc_target_bitrate) to convert to bits/bytes, if necessary.
- */
- unsigned int rc_buf_initial_sz;
-
-
- /*!\brief Decoder Buffer Optimal Size
- *
- * This value indicates the amount of data that the encoder should try
- * to maintain in the decoder's buffer. This value is expressed in units
- * of time (milliseconds). Use the target bitrate (#rc_target_bitrate)
- * to convert to bits/bytes, if necessary.
- */
- unsigned int rc_buf_optimal_sz;
-
-
- /*
- * 2 pass rate control parameters
- */
-
-
- /*!\brief Two-pass mode CBR/VBR bias
- *
- * Bias, expressed on a scale of 0 to 100, for determining target size
- * for the current frame. The value 0 indicates the optimal CBR mode
- * value should be used. The value 100 indicates the optimal VBR mode
- * value should be used. Values in between indicate which way the
- * encoder should "lean."
- */
- unsigned int rc_2pass_vbr_bias_pct; /**< RC mode bias between CBR and VBR(0-100: 0->CBR, 100->VBR) */
-
-
- /*!\brief Two-pass mode per-GOP minimum bitrate
- *
- * This value, expressed as a percentage of the target bitrate, indicates
- * the minimum bitrate to be used for a single GOP (aka "section")
- */
- unsigned int rc_2pass_vbr_minsection_pct;
-
-
- /*!\brief Two-pass mode per-GOP maximum bitrate
- *
- * This value, expressed as a percentage of the target bitrate, indicates
- * the maximum bitrate to be used for a single GOP (aka "section")
- */
- unsigned int rc_2pass_vbr_maxsection_pct;
-
-
- /*
- * keyframing settings (kf)
- */
-
- /*!\brief Keyframe placement mode
- *
- * This value indicates whether the encoder should place keyframes at a
- * fixed interval, or determine the optimal placement automatically
- * (as governed by the #kf_min_dist and #kf_max_dist parameters)
- */
- enum vpx_kf_mode kf_mode;
-
-
- /*!\brief Keyframe minimum interval
- *
- * This value, expressed as a number of frames, prevents the encoder from
- * placing a keyframe nearer than kf_min_dist to the previous keyframe. At
- * least kf_min_dist frames non-keyframes will be coded before the next
- * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.
- */
- unsigned int kf_min_dist;
-
-
- /*!\brief Keyframe maximum interval
- *
- * This value, expressed as a number of frames, forces the encoder to code
- * a keyframe if one has not been coded in the last kf_max_dist frames.
- * A value of 0 implies all frames will be keyframes. Set kf_min_dist
- * equal to kf_max_dist for a fixed interval.
- */
- unsigned int kf_max_dist;
-
- /*
- * Spatial scalability settings (ss)
- */
-
- /*!\brief Number of spatial coding layers.
- *
- * This value specifies the number of spatial coding layers to be used.
- */
- unsigned int ss_number_layers;
-
- /*!\brief Target bitrate for each spatial layer.
- *
- * These values specify the target coding bitrate to be used for each
- * spatial layer.
- */
- unsigned int ss_target_bitrate[VPX_SS_MAX_LAYERS];
-
- /*!\brief Number of temporal coding layers.
- *
- * This value specifies the number of temporal layers to be used.
- */
- unsigned int ts_number_layers;
-
- /*!\brief Target bitrate for each temporal layer.
- *
- * These values specify the target coding bitrate to be used for each
- * temporal layer.
- */
- unsigned int ts_target_bitrate[VPX_TS_MAX_LAYERS];
-
- /*!\brief Frame rate decimation factor for each temporal layer.
- *
- * These values specify the frame rate decimation factors to apply
- * to each temporal layer.
- */
- unsigned int ts_rate_decimator[VPX_TS_MAX_LAYERS];
-
- /*!\brief Length of the sequence defining frame temporal layer membership.
- *
- * This value specifies the length of the sequence that defines the
- * membership of frames to temporal layers. For example, if the
- * ts_periodicity = 8, then the frames are assigned to coding layers with a
- * repeated sequence of length 8.
- */
- unsigned int ts_periodicity;
-
- /*!\brief Template defining the membership of frames to temporal layers.
- *
- * This array defines the membership of frames to temporal coding layers.
- * For a 2-layer encoding that assigns even numbered frames to one temporal
- * layer (0) and odd numbered frames to a second temporal layer (1) with
- * ts_periodicity=8, then ts_layer_id = (0,1,0,1,0,1,0,1).
- */
- unsigned int ts_layer_id[VPX_TS_MAX_PERIODICITY];
- } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */
-
-
- /*!\brief Initialize an encoder instance
- *
- * Initializes a encoder context using the given interface. Applications
- * should call the vpx_codec_enc_init convenience macro instead of this
- * function directly, to ensure that the ABI version number parameter
- * is properly initialized.
- *
- * If the library was configured with --disable-multithread, this call
- * is not thread safe and should be guarded with a lock if being used
- * in a multithreaded context.
- *
- * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
- * parameter), the storage pointed to by the cfg parameter must be
- * kept readable and stable until all memory maps have been set.
- *
- * \param[in] ctx Pointer to this instance's context.
- * \param[in] iface Pointer to the algorithm interface to use.
- * \param[in] cfg Configuration to use, if known. May be NULL.
- * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
- * \param[in] ver ABI version number. Must be set to
- * VPX_ENCODER_ABI_VERSION
- * \retval #VPX_CODEC_OK
- * The decoder algorithm initialized.
- * \retval #VPX_CODEC_MEM_ERROR
- * Memory allocation failed.
- */
- vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *cfg,
- vpx_codec_flags_t flags,
- int ver);
-
-
- /*!\brief Convenience macro for vpx_codec_enc_init_ver()
- *
- * Ensures the ABI version parameter is properly set.
- */
-#define vpx_codec_enc_init(ctx, iface, cfg, flags) \
- vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION)
-
-
- /*!\brief Initialize multi-encoder instance
- *
- * Initializes multi-encoder context using the given interface.
- * Applications should call the vpx_codec_enc_init_multi convenience macro
- * instead of this function directly, to ensure that the ABI version number
- * parameter is properly initialized.
- *
- * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
- * parameter), the storage pointed to by the cfg parameter must be
- * kept readable and stable until all memory maps have been set.
- *
- * \param[in] ctx Pointer to this instance's context.
- * \param[in] iface Pointer to the algorithm interface to use.
- * \param[in] cfg Configuration to use, if known. May be NULL.
- * \param[in] num_enc Total number of encoders.
- * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
- * \param[in] dsf Pointer to down-sampling factors.
- * \param[in] ver ABI version number. Must be set to
- * VPX_ENCODER_ABI_VERSION
- * \retval #VPX_CODEC_OK
- * The decoder algorithm initialized.
- * \retval #VPX_CODEC_MEM_ERROR
- * Memory allocation failed.
- */
- vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
- vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *cfg,
- int num_enc,
- vpx_codec_flags_t flags,
- vpx_rational_t *dsf,
- int ver);
-
-
- /*!\brief Convenience macro for vpx_codec_enc_init_multi_ver()
- *
- * Ensures the ABI version parameter is properly set.
- */
-#define vpx_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \
- vpx_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \
- VPX_ENCODER_ABI_VERSION)
-
-
- /*!\brief Get a default configuration
- *
- * Initializes a encoder configuration structure with default values. Supports
- * the notion of "usages" so that an algorithm may offer different default
- * settings depending on the user's intended goal. This function \ref SHOULD
- * be called by all applications to initialize the configuration structure
- * before specializing the configuration with application specific values.
- *
- * \param[in] iface Pointer to the algorithm interface to use.
- * \param[out] cfg Configuration buffer to populate
- * \param[in] usage End usage. Set to 0 or use codec specific values.
- *
- * \retval #VPX_CODEC_OK
- * The configuration was populated.
- * \retval #VPX_CODEC_INCAPABLE
- * Interface is not an encoder interface.
- * \retval #VPX_CODEC_INVALID_PARAM
- * A parameter was NULL, or the usage value was not recognized.
- */
- vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
- vpx_codec_enc_cfg_t *cfg,
- unsigned int usage);
-
-
- /*!\brief Set or change configuration
- *
- * Reconfigures an encoder instance according to the given configuration.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] cfg Configuration buffer to use
- *
- * \retval #VPX_CODEC_OK
- * The configuration was populated.
- * \retval #VPX_CODEC_INCAPABLE
- * Interface is not an encoder interface.
- * \retval #VPX_CODEC_INVALID_PARAM
- * A parameter was NULL, or the usage value was not recognized.
- */
- vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
- const vpx_codec_enc_cfg_t *cfg);
-
-
- /*!\brief Get global stream headers
- *
- * Retrieves a stream level global header packet, if supported by the codec.
- *
- * \param[in] ctx Pointer to this instance's context
- *
- * \retval NULL
- * Encoder does not support global header
- * \retval Non-NULL
- * Pointer to buffer containing global header packet
- */
- vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx);
-
-
-#define VPX_DL_REALTIME (1) /**< deadline parameter analogous to
- * VPx REALTIME mode. */
-#define VPX_DL_GOOD_QUALITY (1000000) /**< deadline parameter analogous to
- * VPx GOOD QUALITY mode. */
-#define VPX_DL_BEST_QUALITY (0) /**< deadline parameter analogous to
- * VPx BEST QUALITY mode. */
- /*!\brief Encode a frame
- *
- * Encodes a video frame at the given "presentation time." The presentation
- * time stamp (PTS) \ref MUST be strictly increasing.
- *
- * The encoder supports the notion of a soft real-time deadline. Given a
- * non-zero value to the deadline parameter, the encoder will make a "best
- * effort" guarantee to return before the given time slice expires. It is
- * implicit that limiting the available time to encode will degrade the
- * output quality. The encoder can be given an unlimited time to produce the
- * best possible frame by specifying a deadline of '0'. This deadline
- * supercedes the VPx notion of "best quality, good quality, realtime".
- * Applications that wish to map these former settings to the new deadline
- * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
- * and #VPX_DL_BEST_QUALITY.
- *
- * When the last frame has been passed to the encoder, this function should
- * continue to be called, with the img parameter set to NULL. This will
- * signal the end-of-stream condition to the encoder and allow it to encode
- * any held buffers. Encoding is complete when vpx_codec_encode() is called
- * and vpx_codec_get_cx_data() returns no data.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] img Image data to encode, NULL to flush.
- * \param[in] pts Presentation time stamp, in timebase units.
- * \param[in] duration Duration to show frame, in timebase units.
- * \param[in] flags Flags to use for encoding this frame.
- * \param[in] deadline Time to spend encoding, in microseconds. (0=infinite)
- *
- * \retval #VPX_CODEC_OK
- * The configuration was populated.
- * \retval #VPX_CODEC_INCAPABLE
- * Interface is not an encoder interface.
- * \retval #VPX_CODEC_INVALID_PARAM
- * A parameter was NULL, the image format is unsupported, etc.
- */
- vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
- const vpx_image_t *img,
- vpx_codec_pts_t pts,
- unsigned long duration,
- vpx_enc_frame_flags_t flags,
- unsigned long deadline);
-
- /*!\brief Set compressed data output buffer
- *
- * Sets the buffer that the codec should output the compressed data
- * into. This call effectively sets the buffer pointer returned in the
- * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be
- * appended into this buffer. The buffer is preserved across frames,
- * so applications must periodically call this function after flushing
- * the accumulated compressed data to disk or to the network to reset
- * the pointer to the buffer's head.
- *
- * `pad_before` bytes will be skipped before writing the compressed
- * data, and `pad_after` bytes will be appended to the packet. The size
- * of the packet will be the sum of the size of the actual compressed
- * data, pad_before, and pad_after. The padding bytes will be preserved
- * (not overwritten).
- *
- * Note that calling this function does not guarantee that the returned
- * compressed data will be placed into the specified buffer. In the
- * event that the encoded data will not fit into the buffer provided,
- * the returned packet \ref MAY point to an internal buffer, as it would
- * if this call were never used. In this event, the output packet will
- * NOT have any padding, and the application must free space and copy it
- * to the proper place. This is of particular note in configurations
- * that may output multiple packets for a single encoded frame (e.g., lagged
- * encoding) or if the application does not reset the buffer periodically.
- *
- * Applications may restore the default behavior of the codec providing
- * the compressed data buffer by calling this function with a NULL
- * buffer.
- *
- * Applications \ref MUSTNOT call this function during iteration of
- * vpx_codec_get_cx_data().
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in] buf Buffer to store compressed data into
- * \param[in] pad_before Bytes to skip before writing compressed data
- * \param[in] pad_after Bytes to skip after writing compressed data
- *
- * \retval #VPX_CODEC_OK
- * The buffer was set successfully.
- * \retval #VPX_CODEC_INVALID_PARAM
- * A parameter was NULL, the image format is unsupported, etc.
- */
- vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
- const vpx_fixed_buf_t *buf,
- unsigned int pad_before,
- unsigned int pad_after);
-
-
- /*!\brief Encoded data iterator
- *
- * Iterates over a list of data packets to be passed from the encoder to the
- * application. The different kinds of packets available are enumerated in
- * #vpx_codec_cx_pkt_kind.
- *
- * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's
- * muxer. Multiple compressed frames may be in the list.
- * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer.
- *
- * The application \ref MUST silently ignore any packet kinds that it does
- * not recognize or support.
- *
- * The data buffers returned from this function are only guaranteed to be
- * valid until the application makes another call to any vpx_codec_* function.
- *
- * \param[in] ctx Pointer to this instance's context
- * \param[in,out] iter Iterator storage, initialized to NULL
- *
- * \return Returns a pointer to an output data packet (compressed frame data,
- * two-pass statistics, etc.) or NULL to signal end-of-list.
- *
- */
- const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
- vpx_codec_iter_t *iter);
-
-
- /*!\brief Get Preview Frame
- *
- * Returns an image that can be used as a preview. Shows the image as it would
- * exist at the decompressor. The application \ref MUST NOT write into this
- * image buffer.
- *
- * \param[in] ctx Pointer to this instance's context
- *
- * \return Returns a pointer to a preview image, or NULL if no image is
- * available.
- *
- */
- const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx);
-
-
- /*!@} - end defgroup encoder*/
-#ifdef __cplusplus
-}
-#endif
-#endif // VPX_VPX_ENCODER_H_
-
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vpx_frame_buffer.h b/videocodec/libvpx_internal/libvpx/vpx/vpx_frame_buffer.h
deleted file mode 100644
index ae0db05..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vpx_frame_buffer.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_VPX_FRAME_BUFFER_H_
-#define VPX_VPX_FRAME_BUFFER_H_
-
-/*!\file
- * \brief Describes the decoder external frame buffer interface.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "./vpx_integer.h"
-
-/*!\brief The maximum number of work buffers used by libvpx.
- */
-#define VPX_MAXIMUM_WORK_BUFFERS 1
-
-/*!\brief The maximum number of reference buffers that a VP9 encoder may use.
- */
-#define VP9_MAXIMUM_REF_BUFFERS 8
-
-/*!\brief External frame buffer
- *
- * This structure holds allocated frame buffers used by the decoder.
- */
-typedef struct vpx_codec_frame_buffer {
- uint8_t *data; /**< Pointer to the data buffer */
- size_t size; /**< Size of data in bytes */
- void *priv; /**< Frame's private data */
-
- int fb_index;
- int fb_stride;
- int fb_height_stride;
-} vpx_codec_frame_buffer_t;
-
-/*!\brief get frame buffer callback prototype
- *
- * This callback is invoked by the decoder to retrieve data for the frame
- * buffer in order for the decode call to complete. The callback must
- * allocate at least min_size in bytes and assign it to fb->data. Then the
- * callback must set fb->size to the allocated size. The application does not
- * need to align the allocated data. The callback is triggered when the
- * decoder needs a frame buffer to decode a compressed image into. This
- * function may be called more than once for every call to vpx_codec_decode.
- * The application may set fb->priv to some data which will be passed
- * back in the ximage and the release function call. |fb| is guaranteed to
- * not be NULL. On success the callback must return 0. Any failure the
- * callback must return a value less than 0.
- *
- * \param[in] priv Callback's private data
- * \param[in] new_size Size in bytes needed by the buffer
- * \param[in,out] fb Pointer to vpx_codec_frame_buffer_t
- */
-typedef int (*vpx_get_frame_buffer_cb_fn_t)(
- void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb);
-
-/*!\brief release frame buffer callback prototype
- *
- * This callback is invoked by the decoder when the frame buffer is not
- * referenced by any other buffers. |fb| is guaranteed to not be NULL. On
- * success the callback must return 0. Any failure the callback must return
- * a value less than 0.
- *
- * \param[in] priv Callback's private data
- * \param[in] fb Pointer to vpx_codec_frame_buffer_t
- */
-typedef int (*vpx_release_frame_buffer_cb_fn_t)(
- void *priv, vpx_codec_frame_buffer_t *fb);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_VPX_FRAME_BUFFER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vpx_image.h b/videocodec/libvpx_internal/libvpx/vpx/vpx_image.h
deleted file mode 100644
index 44aa70d..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vpx_image.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*!\file
- * \brief Describes the vpx image descriptor and associated operations
- *
- */
-#ifndef VPX_VPX_IMAGE_H_
-#define VPX_VPX_IMAGE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /*!\brief Current ABI version number
- *
- * \internal
- * If this file is altered in any way that changes the ABI, this value
- * must be bumped. Examples include, but are not limited to, changing
- * types, removing or reassigning enums, adding/removing/rearranging
- * fields to structures
- */
-#define VPX_IMAGE_ABI_VERSION (2) /**<\hideinitializer*/
-
-
-#define VPX_IMG_FMT_PLANAR 0x100 /**< Image is a planar format */
-#define VPX_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */
-#define VPX_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel component */
-
-
- /*!\brief List of supported image formats */
- typedef enum vpx_img_fmt {
- VPX_IMG_FMT_NONE,
- VPX_IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
- VPX_IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
- VPX_IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
- VPX_IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
- VPX_IMG_FMT_UYVY, /**< UYVY packed YUV */
- VPX_IMG_FMT_YUY2, /**< YUYV packed YUV */
- VPX_IMG_FMT_YVYU, /**< YVYU packed YUV */
- VPX_IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
- VPX_IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
- VPX_IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
- VPX_IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
- VPX_IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
- VPX_IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
- VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1, /**< planar YVU */
- VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2,
- VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
- VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4,
- VPX_IMG_FMT_I422 = VPX_IMG_FMT_PLANAR | 5,
- VPX_IMG_FMT_I444 = VPX_IMG_FMT_PLANAR | 6,
- VPX_IMG_FMT_444A = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 7
- } vpx_img_fmt_t; /**< alias for enum vpx_img_fmt */
-
-#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
-#define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR /**< \deprecated Use #VPX_IMG_FMT_PLANAR */
-#define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP /**< \deprecated Use #VPX_IMG_FMT_UV_FLIP */
-#define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA /**< \deprecated Use #VPX_IMG_FMT_HAS_ALPHA */
-
- /*!\brief Deprecated list of supported image formats
- * \deprecated New code should use #vpx_img_fmt
- */
-#define img_fmt vpx_img_fmt
- /*!\brief alias for enum img_fmt.
- * \deprecated New code should use #vpx_img_fmt_t
- */
-#define img_fmt_t vpx_img_fmt_t
-
-#define IMG_FMT_NONE VPX_IMG_FMT_NONE /**< \deprecated Use #VPX_IMG_FMT_NONE */
-#define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24 /**< \deprecated Use #VPX_IMG_FMT_RGB24 */
-#define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32 /**< \deprecated Use #VPX_IMG_FMT_RGB32 */
-#define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565 /**< \deprecated Use #VPX_IMG_FMT_RGB565 */
-#define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555 /**< \deprecated Use #VPX_IMG_FMT_RGB555 */
-#define IMG_FMT_UYVY VPX_IMG_FMT_UYVY /**< \deprecated Use #VPX_IMG_FMT_UYVY */
-#define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2 /**< \deprecated Use #VPX_IMG_FMT_YUY2 */
-#define IMG_FMT_YVYU VPX_IMG_FMT_YVYU /**< \deprecated Use #VPX_IMG_FMT_YVYU */
-#define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24 /**< \deprecated Use #VPX_IMG_FMT_BGR24 */
-#define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE /**< \deprecated Use #VPX_IMG_FMT_RGB32_LE */
-#define IMG_FMT_ARGB VPX_IMG_FMT_ARGB /**< \deprecated Use #VPX_IMG_FMT_ARGB */
-#define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE /**< \deprecated Use #VPX_IMG_FMT_ARGB_LE */
-#define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE /**< \deprecated Use #VPX_IMG_FMT_RGB565_LE */
-#define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE /**< \deprecated Use #VPX_IMG_FMT_RGB555_LE */
-#define IMG_FMT_YV12 VPX_IMG_FMT_YV12 /**< \deprecated Use #VPX_IMG_FMT_YV12 */
-#define IMG_FMT_I420 VPX_IMG_FMT_I420 /**< \deprecated Use #VPX_IMG_FMT_I420 */
-#define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12 /**< \deprecated Use #VPX_IMG_FMT_VPXYV12 */
-#define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420 /**< \deprecated Use #VPX_IMG_FMT_VPXI420 */
-#endif /* VPX_CODEC_DISABLE_COMPAT */
-
- /**\brief Image Descriptor */
- typedef struct vpx_image {
- vpx_img_fmt_t fmt; /**< Image Format */
-
- /* Image storage dimensions */
- unsigned int w; /**< Stored image width */
- unsigned int h; /**< Stored image height */
-
- /* Image display dimensions */
- unsigned int d_w; /**< Displayed image width */
- unsigned int d_h; /**< Displayed image height */
-
- /* Chroma subsampling info */
- unsigned int x_chroma_shift; /**< subsampling order, X */
- unsigned int y_chroma_shift; /**< subsampling order, Y */
-
- /* Image data pointers. */
-#define VPX_PLANE_PACKED 0 /**< To be used for all packed formats */
-#define VPX_PLANE_Y 0 /**< Y (Luminance) plane */
-#define VPX_PLANE_U 1 /**< U (Chroma) plane */
-#define VPX_PLANE_V 2 /**< V (Chroma) plane */
-#define VPX_PLANE_ALPHA 3 /**< A (Transparency) plane */
-#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
-#define PLANE_PACKED VPX_PLANE_PACKED
-#define PLANE_Y VPX_PLANE_Y
-#define PLANE_U VPX_PLANE_U
-#define PLANE_V VPX_PLANE_V
-#define PLANE_ALPHA VPX_PLANE_ALPHA
-#endif
- unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */
- int stride[4]; /**< stride between rows for each plane */
-
- int bps; /**< bits per sample (for packed formats) */
-
- /* The following member may be set by the application to associate data
- * with this image.
- */
- void *user_priv; /**< may be set by the application to associate data
- * with this image. */
-
- /* The following members should be treated as private. */
- unsigned char *img_data; /**< private */
- int img_data_owner; /**< private */
- int self_allocd; /**< private */
-
- void *fb_priv; /**< Frame buffer data associated with the image. */
-
- int fb_index;
- } vpx_image_t; /**< alias for struct vpx_image */
-
- /**\brief Representation of a rectangle on a surface */
- typedef struct vpx_image_rect {
- unsigned int x; /**< leftmost column */
- unsigned int y; /**< topmost row */
- unsigned int w; /**< width */
- unsigned int h; /**< height */
- } vpx_image_rect_t; /**< alias for struct vpx_image_rect */
-
- /*!\brief Open a descriptor, allocating storage for the underlying image
- *
- * Returns a descriptor for storing an image of the given format. The
- * storage for the descriptor is allocated on the heap.
- *
- * \param[in] img Pointer to storage for descriptor. If this parameter
- * is NULL, the storage for the descriptor will be
- * allocated on the heap.
- * \param[in] fmt Format for the image
- * \param[in] d_w Width of the image
- * \param[in] d_h Height of the image
- * \param[in] align Alignment, in bytes, of the image buffer and
- * each row in the image(stride).
- *
- * \return Returns a pointer to the initialized image descriptor. If the img
- * parameter is non-null, the value of the img parameter will be
- * returned.
- */
- vpx_image_t *vpx_img_alloc(vpx_image_t *img,
- vpx_img_fmt_t fmt,
- unsigned int d_w,
- unsigned int d_h,
- unsigned int align);
-
- /*!\brief Open a descriptor, using existing storage for the underlying image
- *
- * Returns a descriptor for storing an image of the given format. The
- * storage for descriptor has been allocated elsewhere, and a descriptor is
- * desired to "wrap" that storage.
- *
- * \param[in] img Pointer to storage for descriptor. If this parameter
- * is NULL, the storage for the descriptor will be
- * allocated on the heap.
- * \param[in] fmt Format for the image
- * \param[in] d_w Width of the image
- * \param[in] d_h Height of the image
- * \param[in] align Alignment, in bytes, of each row in the image.
- * \param[in] img_data Storage to use for the image
- *
- * \return Returns a pointer to the initialized image descriptor. If the img
- * parameter is non-null, the value of the img parameter will be
- * returned.
- */
- vpx_image_t *vpx_img_wrap(vpx_image_t *img,
- vpx_img_fmt_t fmt,
- unsigned int d_w,
- unsigned int d_h,
- unsigned int align,
- unsigned char *img_data);
-
-
- /*!\brief Set the rectangle identifying the displayed portion of the image
- *
- * Updates the displayed rectangle (aka viewport) on the image surface to
- * match the specified coordinates and size.
- *
- * \param[in] img Image descriptor
- * \param[in] x leftmost column
- * \param[in] y topmost row
- * \param[in] w width
- * \param[in] h height
- *
- * \return 0 if the requested rectangle is valid, nonzero otherwise.
- */
- int vpx_img_set_rect(vpx_image_t *img,
- unsigned int x,
- unsigned int y,
- unsigned int w,
- unsigned int h);
-
-
- /*!\brief Flip the image vertically (top for bottom)
- *
- * Adjusts the image descriptor's pointers and strides to make the image
- * be referenced upside-down.
- *
- * \param[in] img Image descriptor
- */
- void vpx_img_flip(vpx_image_t *img);
-
- /*!\brief Close an image descriptor
- *
- * Frees all allocated storage associated with an image descriptor.
- *
- * \param[in] img Image descriptor
- */
- void vpx_img_free(vpx_image_t *img);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_VPX_IMAGE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx/vpx_integer.h b/videocodec/libvpx_internal/libvpx/vpx/vpx_integer.h
deleted file mode 100644
index 258618b..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx/vpx_integer.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_VPX_INTEGER_H_
-#define VPX_VPX_INTEGER_H_
-
-/* get ptrdiff_t, size_t, wchar_t, NULL */
-#include <stddef.h>
-
-#if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES)
-typedef signed char int8_t;
-typedef signed short int16_t;
-typedef signed int int32_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-
-#if (defined(_MSC_VER) && (_MSC_VER < 1600))
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#define INT64_MAX _I64_MAX
-#define INT16_MAX _I16_MAX
-#define INT16_MIN _I16_MIN
-#endif
-
-#ifndef _UINTPTR_T_DEFINED
-typedef size_t uintptr_t;
-#endif
-
-#else
-
-/* Most platforms have the C99 standard integer types. */
-
-#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
-#define __STDC_FORMAT_MACROS
-#endif
-#include <stdint.h>
-
-#endif
-
-/* VS2010 defines stdint.h, but not inttypes.h */
-#if defined(_MSC_VER) && _MSC_VER < 1800
-#define PRId64 "I64d"
-#else
-#include <inttypes.h>
-#endif
-
-#endif // VPX_VPX_INTEGER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_intrnl.h b/videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_intrnl.h
deleted file mode 100644
index 225a3ba..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_intrnl.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
-#define VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
-#include "./vpx_config.h"
-
-#ifndef CONFIG_MEM_MANAGER
-# if defined(VXWORKS)
-# define CONFIG_MEM_MANAGER 1 /*include heap manager functionality,*/
-/*default: enabled on vxworks*/
-# else
-# define CONFIG_MEM_MANAGER 0 /*include heap manager functionality*/
-# endif
-#endif /*CONFIG_MEM_MANAGER*/
-
-#ifndef CONFIG_MEM_TRACKER
-# define CONFIG_MEM_TRACKER 1 /*include xvpx_* calls in the lib*/
-#endif
-
-#ifndef CONFIG_MEM_CHECKS
-# define CONFIG_MEM_CHECKS 0 /*include some basic safety checks in
-vpx_memcpy, _memset, and _memmove*/
-#endif
-
-#ifndef USE_GLOBAL_FUNCTION_POINTERS
-# define USE_GLOBAL_FUNCTION_POINTERS 0 /*use function pointers instead of compiled functions.*/
-#endif
-
-#if CONFIG_MEM_TRACKER
-# include "vpx_mem_tracker.h"
-# if VPX_MEM_TRACKER_VERSION_CHIEF != 2 || VPX_MEM_TRACKER_VERSION_MAJOR != 5
-# error "vpx_mem requires memory tracker version 2.5 to track memory usage"
-# endif
-#endif
-
-#define ADDRESS_STORAGE_SIZE sizeof(size_t)
-
-#ifndef DEFAULT_ALIGNMENT
-# if defined(VXWORKS)
-# define DEFAULT_ALIGNMENT 32 /*default addr alignment to use in
-calls to vpx_* functions other
-than vpx_memalign*/
-# else
-# define DEFAULT_ALIGNMENT (2 * sizeof(void*)) /* NOLINT */
-# endif
-#endif
-
-#if CONFIG_MEM_TRACKER
-# define TRY_BOUNDS_CHECK 1 /*when set to 1 pads each allocation,
-integrity can be checked using
-vpx_memory_tracker_check_integrity
-or on free by defining*/
-/*TRY_BOUNDS_CHECK_ON_FREE*/
-#else
-# define TRY_BOUNDS_CHECK 0
-#endif /*CONFIG_MEM_TRACKER*/
-
-#if TRY_BOUNDS_CHECK
-# define TRY_BOUNDS_CHECK_ON_FREE 0 /*checks mem integrity on every
-free, very expensive*/
-# define BOUNDS_CHECK_VALUE 0xdeadbeef /*value stored before/after ea.
-mem addr for bounds checking*/
-# define BOUNDS_CHECK_PAD_SIZE 32 /*size of the padding before and
-after ea allocation to be filled
-with BOUNDS_CHECK_VALUE.
-this should be a multiple of 4*/
-#else
-# define BOUNDS_CHECK_VALUE 0
-# define BOUNDS_CHECK_PAD_SIZE 0
-#endif /*TRY_BOUNDS_CHECK*/
-
-#ifndef REMOVE_PRINTFS
-# define REMOVE_PRINTFS 0
-#endif
-
-/* Should probably use a vpx_mem logger function. */
-#if REMOVE_PRINTFS
-# define _P(x)
-#else
-# define _P(x) x
-#endif
-
-/*returns an addr aligned to the byte boundary specified by align*/
-#define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
-
-#endif // VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_tracker.h b/videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_tracker.h
deleted file mode 100644
index 1335e00..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/include/vpx_mem_tracker.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_MEM_INCLUDE_VPX_MEM_TRACKER_H_
-#define VPX_MEM_INCLUDE_VPX_MEM_TRACKER_H_
-
-/* vpx_mem_tracker version info */
-#define vpx_mem_tracker_version "2.5.1.1"
-
-#define VPX_MEM_TRACKER_VERSION_CHIEF 2
-#define VPX_MEM_TRACKER_VERSION_MAJOR 5
-#define VPX_MEM_TRACKER_VERSION_MINOR 1
-#define VPX_MEM_TRACKER_VERSION_PATCH 1
-/* END - vpx_mem_tracker version info */
-
-#include <stdarg.h>
-
-struct mem_block {
- size_t addr;
- unsigned int size,
- line;
- char *file;
- struct mem_block *prev,
- * next;
-
- int padded; // This mem_block has padding for integrity checks.
- // As of right now, this should only be 0 if
- // using vpx_mem_alloc to allocate cache memory.
- // 2005-01-11 tjf
-};
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
- /*
- vpx_memory_tracker_init(int padding_size, int pad_value)
- padding_size - the size of the padding before and after each mem addr.
- Values > 0 indicate that integrity checks can be performed
- by inspecting these areas.
- pad_value - the initial value within the padding area before and after
- each mem addr.
-
- Initializes the memory tracker interface. Should be called before any
- other calls to the memory tracker.
- */
- int vpx_memory_tracker_init(int padding_size, int pad_value);
-
- /*
- vpx_memory_tracker_destroy()
- Deinitializes the memory tracker interface
- */
- void vpx_memory_tracker_destroy();
-
- /*
- vpx_memory_tracker_add(size_t addr, unsigned int size,
- char * file, unsigned int line)
- addr - memory address to be added to list
- size - size of addr
- file - the file addr was referenced from
- line - the line in file addr was referenced from
- Adds memory address addr, it's size, file and line it came from
- to the memory tracker allocation table
- */
- void vpx_memory_tracker_add(size_t addr, unsigned int size,
- char *file, unsigned int line,
- int padded);
-
- /*
- vpx_memory_tracker_add(size_t addr, unsigned int size, char * file, unsigned int line)
- addr - memory address to be added to be removed
- padded - if 0, disables bounds checking on this memory block even if bounds
- checking is enabled. (for example, when allocating cache memory, we still want
- to check for memory leaks, but we do not waste cache space for bounds check padding)
- Removes the specified address from the memory tracker's allocation
- table
- Return:
- 0: on success
- -1: if memory allocation table's mutex could not be locked
- -2: if the addr was not found in the list
- */
- int vpx_memory_tracker_remove(size_t addr);
-
- /*
- vpx_memory_tracker_find(unsigned int addr)
- addr - address to be found in the memory tracker's
- allocation table
- Return:
- If found, pointer to the memory block that matches addr
- NULL otherwise
- */
- struct mem_block *vpx_memory_tracker_find(size_t addr);
-
- /*
- vpx_memory_tracker_dump()
- Dumps the current contents of the memory
- tracker allocation table
- */
- void vpx_memory_tracker_dump();
-
- /*
- vpx_memory_tracker_check_integrity()
- If a padding_size was provided to vpx_memory_tracker_init()
- This function will verify that the region before and after each
- memory address contains the specified pad_value. Should the check
- fail, the filename and line of the check will be printed out.
- */
- void vpx_memory_tracker_check_integrity(char *file, unsigned int line);
-
- /*
- vpx_memory_tracker_set_log_type
- type - value representing the logging type to use
- option - type specific option. This will be interpreted differently
- based on the type.
- Sets the logging type for the memory tracker.
- Values currently supported:
- 0: if option is NULL, log to stderr, otherwise interpret option as a
- filename and attempt to open it.
- 1: Use output_debug_string (WIN32 only), option ignored
- Return:
- 0: on success
- -1: if the logging type could not be set, because the value was invalid
- or because a file could not be opened
- */
- int vpx_memory_tracker_set_log_type(int type, char *option);
-
- /*
- vpx_memory_tracker_set_log_func
- userdata - ptr to be passed to the supplied logfunc, can be NULL
- logfunc - the logging function to be used to output data from
- vpx_memory_track_dump/check_integrity
- Sets a logging function to be used by the memory tracker.
- Return:
- 0: on success
- -1: if the logging type could not be set because logfunc was NULL
- */
- int vpx_memory_tracker_set_log_func(void *userdata,
- void(*logfunc)(void *userdata,
- const char *fmt, va_list args));
-
- /* Wrappers to standard library functions. */
- typedef void *(* mem_track_malloc_func)(size_t);
- typedef void *(* mem_track_calloc_func)(size_t, size_t);
- typedef void *(* mem_track_realloc_func)(void *, size_t);
- typedef void (* mem_track_free_func)(void *);
- typedef void *(* mem_track_memcpy_func)(void *, const void *, size_t);
- typedef void *(* mem_track_memset_func)(void *, int, size_t);
- typedef void *(* mem_track_memmove_func)(void *, const void *, size_t);
-
- /*
- vpx_memory_tracker_set_functions
-
- Sets the function pointers for the standard library functions.
-
- Return:
- 0: on success
- -1: if the use global function pointers is not set.
- */
- int vpx_memory_tracker_set_functions(mem_track_malloc_func g_malloc_l
-, mem_track_calloc_func g_calloc_l
-, mem_track_realloc_func g_realloc_l
-, mem_track_free_func g_free_l
-, mem_track_memcpy_func g_memcpy_l
-, mem_track_memset_func g_memset_l
-, mem_track_memmove_func g_memmove_l);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif // VPX_MEM_INCLUDE_VPX_MEM_TRACKER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_alloc.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_alloc.c
deleted file mode 100644
index ab3562d..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_alloc.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#include "hmm_intrnl.h"
-
-void *U(alloc)(U(descriptor) *desc, U(size_aau) n) {
-#ifdef HMM_AUDIT_FAIL
-
- if (desc->avl_tree_root)
- AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
-#endif
-
- if (desc->last_freed) {
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(desc->last_freed)
-#endif
-
- U(into_free_collection)(desc, (head_record *)(desc->last_freed));
-
- desc->last_freed = 0;
- }
-
- /* Add space for block header. */
- n += HEAD_AAUS;
-
- /* Convert n from number of address alignment units to block alignment
- ** units. */
- n = DIV_ROUND_UP(n, HMM_BLOCK_ALIGN_UNIT);
-
- if (n < MIN_BLOCK_BAUS)
- n = MIN_BLOCK_BAUS;
-
- {
- /* Search for the first node of the bin containing the smallest
- ** block big enough to satisfy request. */
- ptr_record *ptr_rec_ptr =
- U(avl_search)(
- (U(avl_avl) *) & (desc->avl_tree_root), (U(size_bau)) n,
- AVL_GREATER_EQUAL);
-
- /* If an approprate bin is found, satisfy the allocation request,
- ** otherwise return null pointer. */
- return(ptr_rec_ptr ?
- U(alloc_from_bin)(desc, ptr_rec_ptr, (U(size_bau)) n) : 0);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_base.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_base.c
deleted file mode 100644
index 0eff59d..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_base.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#include "hmm_intrnl.h"
-
-void U(init)(U(descriptor) *desc) {
- desc->avl_tree_root = 0;
- desc->last_freed = 0;
-}
-
-/* Remove a free block from a bin's doubly-linked list when it is not,
-** the first block in the bin.
-*/
-void U(dll_remove)(
- /* Pointer to pointer record in the block to be removed. */
- ptr_record *to_remove) {
- to_remove->prev->next = to_remove->next;
-
- if (to_remove->next)
- to_remove->next->prev = to_remove->prev;
-}
-
-/* Put a block into the free collection of a heap.
-*/
-void U(into_free_collection)(
- /* Pointer to heap descriptor. */
- U(descriptor) *desc,
- /* Pointer to head record of block. */
- head_record *head_ptr) {
- ptr_record *ptr_rec_ptr = HEAD_TO_PTR_REC(head_ptr);
-
- ptr_record *bin_front_ptr =
- U(avl_insert)((U(avl_avl) *) & (desc->avl_tree_root), ptr_rec_ptr);
-
- if (bin_front_ptr != ptr_rec_ptr) {
- /* The block was not inserted into the AVL tree because there is
- ** already a bin for the size of the block. */
-
- MARK_SUCCESSIVE_BLOCK_IN_FREE_BIN(head_ptr)
- ptr_rec_ptr->self = ptr_rec_ptr;
-
- /* Make the block the new second block in the bin's doubly-linked
- ** list. */
- ptr_rec_ptr->prev = bin_front_ptr;
- ptr_rec_ptr->next = bin_front_ptr->next;
- bin_front_ptr->next = ptr_rec_ptr;
-
- if (ptr_rec_ptr->next)
- ptr_rec_ptr->next->prev = ptr_rec_ptr;
- } else
- /* Block is first block in new bin. */
- ptr_rec_ptr->next = 0;
-}
-
-/* Allocate a block from a given bin. Returns a pointer to the payload
-** of the removed block. The "last freed" pointer must be null prior
-** to calling this function.
-*/
-void *U(alloc_from_bin)(
- /* Pointer to heap descriptor. */
- U(descriptor) *desc,
- /* Pointer to pointer record of first block in bin. */
- ptr_record *bin_front_ptr,
- /* Number of BAUs needed in the allocated block. If the block taken
- ** from the bin is significantly larger than the number of BAUs needed,
- ** the "extra" BAUs are split off to form a new free block. */
- U(size_bau) n_baus) {
- head_record *head_ptr;
- U(size_bau) rem_baus;
-
- if (bin_front_ptr->next) {
- /* There are multiple blocks in this bin. Use the 2nd block in
- ** the bin to avoid needless change to the AVL tree.
- */
-
- ptr_record *ptr_rec_ptr = bin_front_ptr->next;
- head_ptr = PTR_REC_TO_HEAD(ptr_rec_ptr);
-
-#ifdef AUDIT_FAIL
- AUDIT_BLOCK(head_ptr)
-#endif
-
- U(dll_remove)(ptr_rec_ptr);
- } else {
- /* There is only one block in the bin, so it has to be removed
- ** from the AVL tree.
- */
-
- head_ptr = PTR_REC_TO_HEAD(bin_front_ptr);
-
- U(avl_remove)(
- (U(avl_avl) *) & (desc->avl_tree_root), BLOCK_BAUS(head_ptr));
- }
-
- MARK_BLOCK_ALLOCATED(head_ptr)
-
- rem_baus = BLOCK_BAUS(head_ptr) - n_baus;
-
- if (rem_baus >= MIN_BLOCK_BAUS) {
- /* Since there are enough "extra" BAUs, split them off to form
- ** a new free block.
- */
-
- head_record *rem_head_ptr =
- (head_record *) BAUS_FORWARD(head_ptr, n_baus);
-
- /* Change the next block's header to reflect the fact that the
- ** block preceeding it is now smaller.
- */
- SET_PREV_BLOCK_BAUS(
- BAUS_FORWARD(head_ptr, head_ptr->block_size), rem_baus)
-
- head_ptr->block_size = n_baus;
-
- rem_head_ptr->previous_block_size = n_baus;
- rem_head_ptr->block_size = rem_baus;
-
- desc->last_freed = rem_head_ptr;
- }
-
- return(HEAD_TO_PTR_REC(head_ptr));
-}
-
-/* Take a block out of the free collection.
-*/
-void U(out_of_free_collection)(
- /* Descriptor of heap that block is in. */
- U(descriptor) *desc,
- /* Pointer to head of block to take out of free collection. */
- head_record *head_ptr) {
- ptr_record *ptr_rec_ptr = HEAD_TO_PTR_REC(head_ptr);
-
- if (ptr_rec_ptr->self == ptr_rec_ptr)
- /* Block is not the front block in its bin, so all we have to
- ** do is take it out of the bin's doubly-linked list. */
- U(dll_remove)(ptr_rec_ptr);
- else {
- ptr_record *next = ptr_rec_ptr->next;
-
- if (next)
- /* Block is the front block in its bin, and there is at least
- ** one other block in the bin. Substitute the next block for
- ** the front block. */
- U(avl_subst)((U(avl_avl) *) & (desc->avl_tree_root), next);
- else
- /* Block is the front block in its bin, but there is no other
- ** block in the bin. Eliminate the bin. */
- U(avl_remove)(
- (U(avl_avl) *) & (desc->avl_tree_root), BLOCK_BAUS(head_ptr));
- }
-}
-
-void U(free)(U(descriptor) *desc, void *payload_ptr) {
- /* Flags if coalesce with adjacent block. */
- int coalesce;
-
- head_record *fwd_head_ptr;
- head_record *free_head_ptr = PTR_REC_TO_HEAD(payload_ptr);
-
- desc->num_baus_can_shrink = 0;
-
-#ifdef HMM_AUDIT_FAIL
-
- AUDIT_BLOCK(free_head_ptr)
-
- /* Make sure not freeing an already free block. */
- if (!IS_BLOCK_ALLOCATED(free_head_ptr))
- HMM_AUDIT_FAIL
-
- if (desc->avl_tree_root)
- /* Audit root block in AVL tree. */
- AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
-
-#endif
-
- fwd_head_ptr =
- (head_record *) BAUS_FORWARD(free_head_ptr, free_head_ptr->block_size);
-
- if (free_head_ptr->previous_block_size) {
- /* Coalesce with backward block if possible. */
-
- head_record *bkwd_head_ptr =
- (head_record *) BAUS_BACKWARD(
- free_head_ptr, free_head_ptr->previous_block_size);
-
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(bkwd_head_ptr)
-#endif
-
- if (bkwd_head_ptr == (head_record *)(desc->last_freed)) {
- desc->last_freed = 0;
- coalesce = 1;
- } else if (IS_BLOCK_ALLOCATED(bkwd_head_ptr))
- coalesce = 0;
- else {
- U(out_of_free_collection)(desc, bkwd_head_ptr);
- coalesce = 1;
- }
-
- if (coalesce) {
- bkwd_head_ptr->block_size += free_head_ptr->block_size;
- SET_PREV_BLOCK_BAUS(fwd_head_ptr, BLOCK_BAUS(bkwd_head_ptr))
- free_head_ptr = bkwd_head_ptr;
- }
- }
-
- if (fwd_head_ptr->block_size == 0) {
- /* Block to be freed is last block before dummy end-of-chunk block. */
- desc->end_of_shrinkable_chunk =
- BAUS_FORWARD(fwd_head_ptr, DUMMY_END_BLOCK_BAUS);
- desc->num_baus_can_shrink = BLOCK_BAUS(free_head_ptr);
-
- if (PREV_BLOCK_BAUS(free_head_ptr) == 0)
- /* Free block is the entire chunk, so shrinking can eliminate
- ** entire chunk including dummy end block. */
- desc->num_baus_can_shrink += DUMMY_END_BLOCK_BAUS;
- } else {
- /* Coalesce with forward block if possible. */
-
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(fwd_head_ptr)
-#endif
-
- if (fwd_head_ptr == (head_record *)(desc->last_freed)) {
- desc->last_freed = 0;
- coalesce = 1;
- } else if (IS_BLOCK_ALLOCATED(fwd_head_ptr))
- coalesce = 0;
- else {
- U(out_of_free_collection)(desc, fwd_head_ptr);
- coalesce = 1;
- }
-
- if (coalesce) {
- free_head_ptr->block_size += fwd_head_ptr->block_size;
-
- fwd_head_ptr =
- (head_record *) BAUS_FORWARD(
- fwd_head_ptr, BLOCK_BAUS(fwd_head_ptr));
-
- SET_PREV_BLOCK_BAUS(fwd_head_ptr, BLOCK_BAUS(free_head_ptr))
-
- if (fwd_head_ptr->block_size == 0) {
- /* Coalesced block to be freed is last block before dummy
- ** end-of-chunk block. */
- desc->end_of_shrinkable_chunk =
- BAUS_FORWARD(fwd_head_ptr, DUMMY_END_BLOCK_BAUS);
- desc->num_baus_can_shrink = BLOCK_BAUS(free_head_ptr);
-
- if (PREV_BLOCK_BAUS(free_head_ptr) == 0)
- /* Free block is the entire chunk, so shrinking can
- ** eliminate entire chunk including dummy end block. */
- desc->num_baus_can_shrink += DUMMY_END_BLOCK_BAUS;
- }
- }
- }
-
- if (desc->last_freed) {
- /* There is a last freed block, but it is not adjacent to the
- ** block being freed by this call to free, so put the last
- ** freed block into the free collection.
- */
-
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(desc->last_freed)
-#endif
-
- U(into_free_collection)(desc, (head_record *)(desc->last_freed));
- }
-
- desc->last_freed = free_head_ptr;
-}
-
-void U(new_chunk)(U(descriptor) *desc, void *start, U(size_bau) n_baus) {
-#ifdef HMM_AUDIT_FAIL
-
- if (desc->avl_tree_root)
- /* Audit root block in AVL tree. */
- AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
-#endif
-
-#undef HEAD_PTR
-#define HEAD_PTR ((head_record *) start)
-
- /* Make the chunk one big free block followed by a dummy end block.
- */
-
- n_baus -= DUMMY_END_BLOCK_BAUS;
-
- HEAD_PTR->previous_block_size = 0;
- HEAD_PTR->block_size = n_baus;
-
- U(into_free_collection)(desc, HEAD_PTR);
-
- /* Set up the dummy end block. */
- start = BAUS_FORWARD(start, n_baus);
- HEAD_PTR->previous_block_size = n_baus;
- HEAD_PTR->block_size = 0;
-
-#undef HEAD_PTR
-}
-
-#ifdef HMM_AUDIT_FAIL
-
-/* Function that does audit fail actions defined my preprocessor symbol,
-** and returns a dummy integer value.
-*/
-int U(audit_block_fail_dummy_return)(void) {
- HMM_AUDIT_FAIL
-
- /* Dummy return. */
- return(0);
-}
-
-#endif
-
-/* AVL Tree instantiation. */
-
-#ifdef HMM_AUDIT_FAIL
-
-/* The AVL tree generic package passes an ACCESS of 1 when it "touches"
-** a child node for the first time during a particular operation. I use
-** this feature to audit only one time (per operation) the free blocks
-** that are tree nodes. Since the root node is not a child node, it has
-** to be audited directly.
-*/
-
-/* The pain you feel while reading these macros will not be in vain. It
-** will remove all doubt from you mind that C++ inline functions are
-** a very good thing.
-*/
-
-#define AVL_GET_LESS(H, ACCESS) \
- (((ACCESS) ? AUDIT_BLOCK_AS_EXPR(PTR_REC_TO_HEAD(H)) : 0), (H)->self)
-#define AVL_GET_GREATER(H, ACCESS) \
- (((ACCESS) ? AUDIT_BLOCK_AS_EXPR(PTR_REC_TO_HEAD(H)) : 0), (H)->prev)
-
-#else
-
-#define AVL_GET_LESS(H, ACCESS) ((H)->self)
-#define AVL_GET_GREATER(H, ACCESS) ((H)->prev)
-
-#endif
-
-#define AVL_SET_LESS(H, LH) (H)->self = (LH);
-#define AVL_SET_GREATER(H, GH) (H)->prev = (GH);
-
-/* high bit of high bit of
-** block_size previous_block_size balance factor
-** ----------- ------------------- --------------
-** 0 0 n/a (block allocated)
-** 0 1 1
-** 1 0 -1
-** 1 1 0
-*/
-
-#define AVL_GET_BALANCE_FACTOR(H) \
- ((((head_record *) (PTR_REC_TO_HEAD(H)))->block_size & \
- HIGH_BIT_BAU_SIZE) ? \
- (((head_record *) (PTR_REC_TO_HEAD(H)))->previous_block_size & \
- HIGH_BIT_BAU_SIZE ? 0 : -1) : 1)
-
-#define AVL_SET_BALANCE_FACTOR(H, BF) \
- { \
- register head_record *p = \
- (head_record *) PTR_REC_TO_HEAD(H); \
- register int bal_f = (BF); \
- \
- if (bal_f <= 0) \
- p->block_size |= HIGH_BIT_BAU_SIZE; \
- else \
- p->block_size &= ~HIGH_BIT_BAU_SIZE; \
- if (bal_f >= 0) \
- p->previous_block_size |= HIGH_BIT_BAU_SIZE; \
- else \
- p->previous_block_size &= ~HIGH_BIT_BAU_SIZE; \
- }
-
-#define COMPARE_KEY_KEY(K1, K2) ((K1) == (K2) ? 0 : ((K1) > (K2) ? 1 : -1))
-
-#define AVL_COMPARE_KEY_NODE(K, H) \
- COMPARE_KEY_KEY(K, BLOCK_BAUS(PTR_REC_TO_HEAD(H)))
-
-#define AVL_COMPARE_NODE_NODE(H1, H2) \
- COMPARE_KEY_KEY(BLOCK_BAUS(PTR_REC_TO_HEAD(H1)), \
- BLOCK_BAUS(PTR_REC_TO_HEAD(H2)))
-
-#define AVL_NULL ((ptr_record *) 0)
-
-#define AVL_IMPL_MASK \
- ( AVL_IMPL_INSERT | AVL_IMPL_SEARCH | AVL_IMPL_REMOVE | AVL_IMPL_SUBST )
-
-#include "cavl_impl.h"
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_dflt_abort.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_dflt_abort.c
deleted file mode 100644
index 51c3cc2..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_dflt_abort.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-/* The function in this file performs default actions if self-auditing
-** finds heap corruption. Don't rely on this code to handle the
-** case where HMM is being used to implement the malloc and free standard
-** library functions. Rewrite the function if necessary to avoid using
-** I/O and execution termination functions that call malloc or free.
-** In Unix, for example, you would replace the fputs calls with calls
-** to the write system call using file handle number 2.
-*/
-#include "hmm_intrnl.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-static int entered = 0;
-
-/* Print abort message, file and line. Terminate execution.
-*/
-void hmm_dflt_abort(const char *file, const char *line) {
- /* Avoid use of printf(), which is more likely to use heap. */
-
- if (entered)
-
- /* The standard I/O functions called a heap function and caused
- ** an indirect recursive call to this function. So we'll have
- ** to just exit without printing a message. */
- while (1);
-
- entered = 1;
-
- fputs("\n_abort - Heap corruption\n" "File: ", stderr);
- fputs(file, stderr);
- fputs(" Line: ", stderr);
- fputs(line, stderr);
- fputs("\n\n", stderr);
- fputs("hmm_dflt_abort: while(1)!!!\n", stderr);
- fflush(stderr);
-
- while (1);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_grow.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_grow.c
deleted file mode 100644
index 0e86373..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_grow.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#include "hmm_intrnl.h"
-
-void U(grow_chunk)(U(descriptor) *desc, void *end, U(size_bau) n_baus) {
-#undef HEAD_PTR
-#define HEAD_PTR ((head_record *) end)
-
- end = BAUS_BACKWARD(end, DUMMY_END_BLOCK_BAUS);
-
-#ifdef HMM_AUDIT_FAIL
-
- if (HEAD_PTR->block_size != 0)
- /* Chunk does not have valid dummy end block. */
- HMM_AUDIT_FAIL
-
-#endif
-
- /* Create a new block that absorbs the old dummy end block. */
- HEAD_PTR->block_size = n_baus;
-
- /* Set up the new dummy end block. */
- {
- head_record *dummy = (head_record *) BAUS_FORWARD(end, n_baus);
- dummy->previous_block_size = n_baus;
- dummy->block_size = 0;
- }
-
- /* Simply free the new block, allowing it to coalesce with any
- ** free block at that was the last block in the chunk prior to
- ** growth.
- */
- U(free)(desc, HEAD_TO_PTR_REC(end));
-
-#undef HEAD_PTR
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_largest.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_largest.c
deleted file mode 100644
index 192758d..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_largest.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#include "hmm_intrnl.h"
-
-U(size_aau) U(largest_available)(U(descriptor) *desc) {
- U(size_bau) largest;
-
- if (!(desc->avl_tree_root))
- largest = 0;
- else {
-#ifdef HMM_AUDIT_FAIL
- /* Audit root block in AVL tree. */
- AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
-#endif
-
- largest =
- BLOCK_BAUS(
- PTR_REC_TO_HEAD(
- U(avl_search)(
- (U(avl_avl) *) & (desc->avl_tree_root),
- (U(size_bau)) ~(U(size_bau)) 0, AVL_LESS)));
- }
-
- if (desc->last_freed) {
- /* Size of last freed block. */
- register U(size_bau) lf_size;
-
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(desc->last_freed)
-#endif
-
- lf_size = BLOCK_BAUS(desc->last_freed);
-
- if (lf_size > largest)
- largest = lf_size;
- }
-
- /* Convert largest size to AAUs and subract head size leaving payload
- ** size.
- */
- return(largest ?
- ((largest * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) - HEAD_AAUS) :
- 0);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_resize.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_resize.c
deleted file mode 100644
index baa5a8f..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_resize.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#include "hmm_intrnl.h"
-
-int U(resize)(U(descriptor) *desc, void *mem, U(size_aau) n) {
- U(size_aau) i;
- head_record *next_head_ptr;
- head_record *head_ptr = PTR_REC_TO_HEAD(mem);
-
- /* Flag. */
- int next_block_free;
-
- /* Convert n from desired block size in AAUs to BAUs. */
- n += HEAD_AAUS;
- n = DIV_ROUND_UP(n, HMM_BLOCK_ALIGN_UNIT);
-
- if (n < MIN_BLOCK_BAUS)
- n = MIN_BLOCK_BAUS;
-
-#ifdef HMM_AUDIT_FAIL
-
- AUDIT_BLOCK(head_ptr)
-
- if (!IS_BLOCK_ALLOCATED(head_ptr))
- HMM_AUDIT_FAIL
-
- if (desc->avl_tree_root)
- AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
-
-#endif
-
- i = head_ptr->block_size;
-
- next_head_ptr =
- (head_record *) BAUS_FORWARD(head_ptr, head_ptr->block_size);
-
- next_block_free =
- (next_head_ptr == desc->last_freed) ||
- !IS_BLOCK_ALLOCATED(next_head_ptr);
-
- if (next_block_free)
- /* Block can expand into next free block. */
- i += BLOCK_BAUS(next_head_ptr);
-
- if (n > i)
- /* Not enough room for block to expand. */
- return(-1);
-
- if (next_block_free) {
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(next_head_ptr)
-#endif
-
- if (next_head_ptr == desc->last_freed)
- desc->last_freed = 0;
- else
- U(out_of_free_collection)(desc, next_head_ptr);
-
- next_head_ptr =
- (head_record *) BAUS_FORWARD(head_ptr, (U(size_bau)) i);
- }
-
- /* Set i to number of "extra" BAUs. */
- i -= n;
-
- if (i < MIN_BLOCK_BAUS)
- /* Not enough extra BAUs to be a block on their own, so just keep them
- ** in the block being resized.
- */
- {
- n += i;
- i = n;
- } else {
- /* There are enough "leftover" BAUs in the next block to
- ** form a remainder block. */
-
- head_record *rem_head_ptr;
-
- rem_head_ptr = (head_record *) BAUS_FORWARD(head_ptr, n);
-
- rem_head_ptr->previous_block_size = (U(size_bau)) n;
- rem_head_ptr->block_size = (U(size_bau)) i;
-
- if (desc->last_freed) {
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(desc->last_freed)
-#endif
-
- U(into_free_collection)(desc, (head_record *)(desc->last_freed));
-
- desc->last_freed = 0;
- }
-
- desc->last_freed = rem_head_ptr;
- }
-
- head_ptr->block_size = (U(size_bau)) n;
- next_head_ptr->previous_block_size = (U(size_bau)) i;
-
- return(0);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_shrink.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_shrink.c
deleted file mode 100644
index f80aeea..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_shrink.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#include "hmm_intrnl.h"
-
-void U(shrink_chunk)(U(descriptor) *desc, U(size_bau) n_baus_to_shrink) {
- head_record *dummy_end_block = (head_record *)
- BAUS_BACKWARD(desc->end_of_shrinkable_chunk, DUMMY_END_BLOCK_BAUS);
-
-#ifdef HMM_AUDIT_FAIL
-
- if (dummy_end_block->block_size != 0)
- /* Chunk does not have valid dummy end block. */
- HMM_AUDIT_FAIL
-
-#endif
-
- if (n_baus_to_shrink) {
- head_record *last_block = (head_record *)
- BAUS_BACKWARD(
- dummy_end_block, dummy_end_block->previous_block_size);
-
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(last_block)
-#endif
-
- if (last_block == desc->last_freed) {
- U(size_bau) bs = BLOCK_BAUS(last_block);
-
- /* Chunk will not be shrunk out of existence if
- ** 1. There is at least one allocated block in the chunk
- ** and the amount to shrink is exactly the size of the
- ** last block, OR
- ** 2. After the last block is shrunk, there will be enough
- ** BAUs left in it to form a minimal size block. */
- int chunk_will_survive =
- (PREV_BLOCK_BAUS(last_block) && (n_baus_to_shrink == bs)) ||
- (n_baus_to_shrink <= (U(size_bau))(bs - MIN_BLOCK_BAUS));
-
- if (chunk_will_survive ||
- (!PREV_BLOCK_BAUS(last_block) &&
- (n_baus_to_shrink ==
- (U(size_bau))(bs + DUMMY_END_BLOCK_BAUS)))) {
- desc->last_freed = 0;
-
- if (chunk_will_survive) {
- bs -= n_baus_to_shrink;
-
- if (bs) {
- /* The last (non-dummy) block was not completely
- ** eliminated by the shrink. */
-
- last_block->block_size = bs;
-
- /* Create new dummy end record.
- */
- dummy_end_block =
- (head_record *) BAUS_FORWARD(last_block, bs);
- dummy_end_block->previous_block_size = bs;
- dummy_end_block->block_size = 0;
-
-#ifdef HMM_AUDIT_FAIL
-
- if (desc->avl_tree_root)
- AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
-#endif
-
- U(into_free_collection)(desc, last_block);
- } else {
- /* The last (non-dummy) block was completely
- ** eliminated by the shrink. Make its head
- ** the new dummy end block.
- */
- last_block->block_size = 0;
- last_block->previous_block_size &= ~HIGH_BIT_BAU_SIZE;
- }
- }
- }
-
-#ifdef HMM_AUDIT_FAIL
- else
- HMM_AUDIT_FAIL
-#endif
- }
-
-#ifdef HMM_AUDIT_FAIL
- else
- HMM_AUDIT_FAIL
-#endif
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_true.c b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_true.c
deleted file mode 100644
index 4428c3e..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/hmm_true.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#include "hmm_intrnl.h"
-
-U(size_aau) U(true_size)(void *payload_ptr) {
- register head_record *head_ptr = PTR_REC_TO_HEAD(payload_ptr);
-
-#ifdef HMM_AUDIT_FAIL
- AUDIT_BLOCK(head_ptr)
-#endif
-
- /* Convert block size from BAUs to AAUs. Subtract head size, leaving
- ** payload size.
- */
- return(
- (BLOCK_BAUS(head_ptr) * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) -
- HEAD_AAUS);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_if.h b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_if.h
deleted file mode 100644
index a5ced8b..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_if.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_MEM_MEMORY_MANAGER_INCLUDE_CAVL_IF_H_
-#define VPX_MEM_MEMORY_MANAGER_INCLUDE_CAVL_IF_H_
-
-/* Abstract AVL Tree Generic C Package.
-** Interface generation header file.
-**
-** This code is in the public domain. See cavl_tree.html for interface
-** documentation.
-**
-** Version: 1.5 Author: Walt Karas
-*/
-
-/* This header contains the definition of CHAR_BIT (number of bits in a
-** char). */
-#include <limits.h>
-
-#undef L_
-#undef L_EST_LONG_BIT
-#undef L_SIZE
-#undef L_SC
-#undef L_LONG_BIT
-#undef L_BIT_ARR_DEFN
-
-#ifndef AVL_SEARCH_TYPE_DEFINED_
-#define AVL_SEARCH_TYPE_DEFINED_
-
-typedef enum {
- AVL_EQUAL = 1,
- AVL_LESS = 2,
- AVL_GREATER = 4,
- AVL_LESS_EQUAL = AVL_EQUAL | AVL_LESS,
- AVL_GREATER_EQUAL = AVL_EQUAL | AVL_GREATER
-}
-avl_search_type;
-
-#endif
-
-#ifdef AVL_UNIQUE
-
-#define L_ AVL_UNIQUE
-
-#else
-
-#define L_(X) X
-
-#endif
-
-/* Determine storage class for function prototypes. */
-#ifdef AVL_PRIVATE
-
-#define L_SC static
-
-#else
-
-#define L_SC extern
-
-#endif
-
-#ifdef AVL_SIZE
-
-#define L_SIZE AVL_SIZE
-
-#else
-
-#define L_SIZE unsigned long
-
-#endif
-
-typedef struct {
-#ifdef AVL_INSIDE_STRUCT
-
- AVL_INSIDE_STRUCT
-
-#endif
-
- AVL_HANDLE root;
-}
-L_(avl);
-
-/* Function prototypes. */
-
-L_SC void L_(init)(L_(avl) *tree);
-
-L_SC int L_(is_empty)(L_(avl) *tree);
-
-L_SC AVL_HANDLE L_(insert)(L_(avl) *tree, AVL_HANDLE h);
-
-L_SC AVL_HANDLE L_(search)(L_(avl) *tree, AVL_KEY k, avl_search_type st);
-
-L_SC AVL_HANDLE L_(search_least)(L_(avl) *tree);
-
-L_SC AVL_HANDLE L_(search_greatest)(L_(avl) *tree);
-
-L_SC AVL_HANDLE L_(remove)(L_(avl) *tree, AVL_KEY k);
-
-L_SC AVL_HANDLE L_(subst)(L_(avl) *tree, AVL_HANDLE new_node);
-
-#ifdef AVL_BUILD_ITER_TYPE
-
-L_SC int L_(build)(
- L_(avl) *tree, AVL_BUILD_ITER_TYPE p, L_SIZE num_nodes);
-
-#endif
-
-/* ANSI C/ISO C++ require that a long have at least 32 bits. Set
-** L_EST_LONG_BIT to be the greatest multiple of 8 in the range
-** 32 - 64 (inclusive) that is less than or equal to the number of
-** bits in a long.
-*/
-
-#if (((LONG_MAX >> 31) >> 7) == 0)
-
-#define L_EST_LONG_BIT 32
-
-#elif (((LONG_MAX >> 31) >> 15) == 0)
-
-#define L_EST_LONG_BIT 40
-
-#elif (((LONG_MAX >> 31) >> 23) == 0)
-
-#define L_EST_LONG_BIT 48
-
-#elif (((LONG_MAX >> 31) >> 31) == 0)
-
-#define L_EST_LONG_BIT 56
-
-#else
-
-#define L_EST_LONG_BIT 64
-
-#endif
-
-/* Number of bits in a long. */
-#define L_LONG_BIT (sizeof(long) * CHAR_BIT)
-
-/* The macro L_BIT_ARR_DEFN defines a bit array whose index is a (0-based)
-** node depth. The definition depends on whether the maximum depth is more
-** or less than the number of bits in a single long.
-*/
-
-#if ((AVL_MAX_DEPTH) > L_EST_LONG_BIT)
-
-/* Maximum depth may be more than number of bits in a long. */
-
-#define L_BIT_ARR_DEFN(NAME) \
- unsigned long NAME[((AVL_MAX_DEPTH) + L_LONG_BIT - 1) / L_LONG_BIT];
-
-#else
-
-/* Maximum depth is definitely less than number of bits in a long. */
-
-#define L_BIT_ARR_DEFN(NAME) unsigned long NAME;
-
-#endif
-
-/* Iterator structure. */
-typedef struct {
- /* Tree being iterated over. */
- L_(avl) *tree_;
-
- /* Records a path into the tree. If bit n is true, indicates
- ** take greater branch from the nth node in the path, otherwise
- ** take the less branch. bit 0 gives branch from root, and
- ** so on. */
- L_BIT_ARR_DEFN(branch)
-
- /* Zero-based depth of path into tree. */
- unsigned depth;
-
- /* Handles of nodes in path from root to current node (returned by *). */
- AVL_HANDLE path_h[(AVL_MAX_DEPTH) - 1];
-}
-L_(iter);
-
-/* Iterator function prototypes. */
-
-L_SC void L_(start_iter)(
- L_(avl) *tree, L_(iter) *iter, AVL_KEY k, avl_search_type st);
-
-L_SC void L_(start_iter_least)(L_(avl) *tree, L_(iter) *iter);
-
-L_SC void L_(start_iter_greatest)(L_(avl) *tree, L_(iter) *iter);
-
-L_SC AVL_HANDLE L_(get_iter)(L_(iter) *iter);
-
-L_SC void L_(incr_iter)(L_(iter) *iter);
-
-L_SC void L_(decr_iter)(L_(iter) *iter);
-
-L_SC void L_(init_iter)(L_(iter) *iter);
-
-#define AVL_IMPL_INIT 1
-#define AVL_IMPL_IS_EMPTY (1 << 1)
-#define AVL_IMPL_INSERT (1 << 2)
-#define AVL_IMPL_SEARCH (1 << 3)
-#define AVL_IMPL_SEARCH_LEAST (1 << 4)
-#define AVL_IMPL_SEARCH_GREATEST (1 << 5)
-#define AVL_IMPL_REMOVE (1 << 6)
-#define AVL_IMPL_BUILD (1 << 7)
-#define AVL_IMPL_START_ITER (1 << 8)
-#define AVL_IMPL_START_ITER_LEAST (1 << 9)
-#define AVL_IMPL_START_ITER_GREATEST (1 << 10)
-#define AVL_IMPL_GET_ITER (1 << 11)
-#define AVL_IMPL_INCR_ITER (1 << 12)
-#define AVL_IMPL_DECR_ITER (1 << 13)
-#define AVL_IMPL_INIT_ITER (1 << 14)
-#define AVL_IMPL_SUBST (1 << 15)
-
-#define AVL_IMPL_ALL (~0)
-
-#undef L_
-#undef L_EST_LONG_BIT
-#undef L_SIZE
-#undef L_SC
-#undef L_LONG_BIT
-#undef L_BIT_ARR_DEFN
-
-#endif // VPX_MEM_MEMORY_MANAGER_INCLUDE_CAVL_IF_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_impl.h b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_impl.h
deleted file mode 100644
index 8b9ae27..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/cavl_impl.h
+++ /dev/null
@@ -1,1152 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_MEM_MEMORY_MANAGER_INCLUDE_CAVL_IMPL_H_
-#define VPX_MEM_MEMORY_MANAGER_INCLUDE_CAVL_IMPL_H_
-
-/* Abstract AVL Tree Generic C Package.
-** Implementation generation header file.
-**
-** This code is in the public domain. See cavl_tree.html for interface
-** documentation.
-**
-** Version: 1.5 Author: Walt Karas
-*/
-
-#undef L_
-#undef L_EST_LONG_BIT
-#undef L_SIZE
-#undef l_tree
-#undef L_MASK_HIGH_BIT
-#undef L_LONG_BIT
-#undef L_BIT_ARR_DEFN
-#undef L_BIT_ARR_VAL
-#undef L_BIT_ARR_0
-#undef L_BIT_ARR_1
-#undef L_BIT_ARR_ALL
-#undef L_BIT_ARR_LONGS
-#undef L_IMPL_MASK
-#undef L_CHECK_READ_ERROR
-#undef L_CHECK_READ_ERROR_INV_DEPTH
-#undef L_SC
-#undef L_BALANCE_PARAM_PREFIX
-
-#ifdef AVL_UNIQUE
-
-#define L_ AVL_UNIQUE
-
-#else
-
-#define L_(X) X
-
-#endif
-
-/* Determine correct storage class for functions */
-#ifdef AVL_PRIVATE
-
-#define L_SC static
-
-#else
-
-#define L_SC
-
-#endif
-
-#ifdef AVL_SIZE
-
-#define L_SIZE AVL_SIZE
-
-#else
-
-#define L_SIZE unsigned long
-
-#endif
-
-#define L_MASK_HIGH_BIT ((int) ~ ((~ (unsigned) 0) >> 1))
-
-/* ANSI C/ISO C++ require that a long have at least 32 bits. Set
-** L_EST_LONG_BIT to be the greatest multiple of 8 in the range
-** 32 - 64 (inclusive) that is less than or equal to the number of
-** bits in a long.
-*/
-
-#if (((LONG_MAX >> 31) >> 7) == 0)
-
-#define L_EST_LONG_BIT 32
-
-#elif (((LONG_MAX >> 31) >> 15) == 0)
-
-#define L_EST_LONG_BIT 40
-
-#elif (((LONG_MAX >> 31) >> 23) == 0)
-
-#define L_EST_LONG_BIT 48
-
-#elif (((LONG_MAX >> 31) >> 31) == 0)
-
-#define L_EST_LONG_BIT 56
-
-#else
-
-#define L_EST_LONG_BIT 64
-
-#endif
-
-#define L_LONG_BIT (sizeof(long) * CHAR_BIT)
-
-#if ((AVL_MAX_DEPTH) > L_EST_LONG_BIT)
-
-/* The maximum depth may be greater than the number of bits in a long,
-** so multiple longs are needed to hold a bit array indexed by node
-** depth. */
-
-#define L_BIT_ARR_LONGS (((AVL_MAX_DEPTH) + L_LONG_BIT - 1) / L_LONG_BIT)
-
-#define L_BIT_ARR_DEFN(NAME) unsigned long NAME[L_BIT_ARR_LONGS];
-
-#define L_BIT_ARR_VAL(BIT_ARR, BIT_NUM) \
- ((BIT_ARR)[(BIT_NUM) / L_LONG_BIT] & (1L << ((BIT_NUM) % L_LONG_BIT)))
-
-#define L_BIT_ARR_0(BIT_ARR, BIT_NUM) \
- (BIT_ARR)[(BIT_NUM) / L_LONG_BIT] &= ~(1L << ((BIT_NUM) % L_LONG_BIT));
-
-#define L_BIT_ARR_1(BIT_ARR, BIT_NUM) \
- (BIT_ARR)[(BIT_NUM) / L_LONG_BIT] |= 1L << ((BIT_NUM) % L_LONG_BIT);
-
-#define L_BIT_ARR_ALL(BIT_ARR, BIT_VAL) \
- { int i = L_BIT_ARR_LONGS; do (BIT_ARR)[--i] = 0L - (BIT_VAL); while(i); }
-
-#else /* The bit array can definitely fit in one long */
-
-#define L_BIT_ARR_DEFN(NAME) unsigned long NAME;
-
-#define L_BIT_ARR_VAL(BIT_ARR, BIT_NUM) ((BIT_ARR) & (1L << (BIT_NUM)))
-
-#define L_BIT_ARR_0(BIT_ARR, BIT_NUM) (BIT_ARR) &= ~(1L << (BIT_NUM));
-
-#define L_BIT_ARR_1(BIT_ARR, BIT_NUM) (BIT_ARR) |= 1L << (BIT_NUM);
-
-#define L_BIT_ARR_ALL(BIT_ARR, BIT_VAL) (BIT_ARR) = 0L - (BIT_VAL);
-
-#endif
-
-#ifdef AVL_READ_ERRORS_HAPPEN
-
-#define L_CHECK_READ_ERROR(ERROR_RETURN) \
- { if (AVL_READ_ERROR) return(ERROR_RETURN); }
-
-#else
-
-#define L_CHECK_READ_ERROR(ERROR_RETURN)
-
-#endif
-
-/* The presumed reason that an instantiation places additional fields
-** inside the AVL tree structure is that the SET_ and GET_ macros
-** need these fields. The "balance" function does not explicitly use
-** any fields in the AVL tree structure, so only pass an AVL tree
-** structure pointer to "balance" if it has instantiation-specific
-** fields that are (presumably) needed by the SET_/GET_ calls within
-** "balance".
-*/
-#ifdef AVL_INSIDE_STRUCT
-
-#define L_BALANCE_PARAM_CALL_PREFIX l_tree,
-#define L_BALANCE_PARAM_DECL_PREFIX L_(avl) *l_tree,
-
-#else
-
-#define L_BALANCE_PARAM_CALL_PREFIX
-#define L_BALANCE_PARAM_DECL_PREFIX
-
-#endif
-
-#ifdef AVL_IMPL_MASK
-
-#define L_IMPL_MASK (AVL_IMPL_MASK)
-
-#else
-
-/* Define all functions. */
-#define L_IMPL_MASK AVL_IMPL_ALL
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_INIT)
-
-L_SC void L_(init)(L_(avl) *l_tree) {
- l_tree->root = AVL_NULL;
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_IS_EMPTY)
-
-L_SC int L_(is_empty)(L_(avl) *l_tree) {
- return(l_tree->root == AVL_NULL);
-}
-
-#endif
-
-/* Put the private balance function in the same compilation module as
-** the insert function. */
-#if (L_IMPL_MASK & AVL_IMPL_INSERT)
-
-/* Balances subtree, returns handle of root node of subtree after balancing.
-*/
-L_SC AVL_HANDLE L_(balance)(L_BALANCE_PARAM_DECL_PREFIX AVL_HANDLE bal_h) {
- AVL_HANDLE deep_h;
-
- /* Either the "greater than" or the "less than" subtree of
- ** this node has to be 2 levels deeper (or else it wouldn't
- ** need balancing).
- */
- if (AVL_GET_BALANCE_FACTOR(bal_h) > 0) {
- /* "Greater than" subtree is deeper. */
-
- deep_h = AVL_GET_GREATER(bal_h, 1);
-
- L_CHECK_READ_ERROR(AVL_NULL)
-
- if (AVL_GET_BALANCE_FACTOR(deep_h) < 0) {
- int bf;
-
- AVL_HANDLE old_h = bal_h;
- bal_h = AVL_GET_LESS(deep_h, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
- AVL_SET_GREATER(old_h, AVL_GET_LESS(bal_h, 1))
- AVL_SET_LESS(deep_h, AVL_GET_GREATER(bal_h, 1))
- AVL_SET_LESS(bal_h, old_h)
- AVL_SET_GREATER(bal_h, deep_h)
-
- bf = AVL_GET_BALANCE_FACTOR(bal_h);
-
- if (bf != 0) {
- if (bf > 0) {
- AVL_SET_BALANCE_FACTOR(old_h, -1)
- AVL_SET_BALANCE_FACTOR(deep_h, 0)
- } else {
- AVL_SET_BALANCE_FACTOR(deep_h, 1)
- AVL_SET_BALANCE_FACTOR(old_h, 0)
- }
-
- AVL_SET_BALANCE_FACTOR(bal_h, 0)
- } else {
- AVL_SET_BALANCE_FACTOR(old_h, 0)
- AVL_SET_BALANCE_FACTOR(deep_h, 0)
- }
- } else {
- AVL_SET_GREATER(bal_h, AVL_GET_LESS(deep_h, 0))
- AVL_SET_LESS(deep_h, bal_h)
-
- if (AVL_GET_BALANCE_FACTOR(deep_h) == 0) {
- AVL_SET_BALANCE_FACTOR(deep_h, -1)
- AVL_SET_BALANCE_FACTOR(bal_h, 1)
- } else {
- AVL_SET_BALANCE_FACTOR(deep_h, 0)
- AVL_SET_BALANCE_FACTOR(bal_h, 0)
- }
-
- bal_h = deep_h;
- }
- } else {
- /* "Less than" subtree is deeper. */
-
- deep_h = AVL_GET_LESS(bal_h, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
-
- if (AVL_GET_BALANCE_FACTOR(deep_h) > 0) {
- int bf;
- AVL_HANDLE old_h = bal_h;
- bal_h = AVL_GET_GREATER(deep_h, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
- AVL_SET_LESS(old_h, AVL_GET_GREATER(bal_h, 0))
- AVL_SET_GREATER(deep_h, AVL_GET_LESS(bal_h, 0))
- AVL_SET_GREATER(bal_h, old_h)
- AVL_SET_LESS(bal_h, deep_h)
-
- bf = AVL_GET_BALANCE_FACTOR(bal_h);
-
- if (bf != 0) {
- if (bf < 0) {
- AVL_SET_BALANCE_FACTOR(old_h, 1)
- AVL_SET_BALANCE_FACTOR(deep_h, 0)
- } else {
- AVL_SET_BALANCE_FACTOR(deep_h, -1)
- AVL_SET_BALANCE_FACTOR(old_h, 0)
- }
-
- AVL_SET_BALANCE_FACTOR(bal_h, 0)
- } else {
- AVL_SET_BALANCE_FACTOR(old_h, 0)
- AVL_SET_BALANCE_FACTOR(deep_h, 0)
- }
- } else {
- AVL_SET_LESS(bal_h, AVL_GET_GREATER(deep_h, 0))
- AVL_SET_GREATER(deep_h, bal_h)
-
- if (AVL_GET_BALANCE_FACTOR(deep_h) == 0) {
- AVL_SET_BALANCE_FACTOR(deep_h, 1)
- AVL_SET_BALANCE_FACTOR(bal_h, -1)
- } else {
- AVL_SET_BALANCE_FACTOR(deep_h, 0)
- AVL_SET_BALANCE_FACTOR(bal_h, 0)
- }
-
- bal_h = deep_h;
- }
- }
-
- return(bal_h);
-}
-
-L_SC AVL_HANDLE L_(insert)(L_(avl) *l_tree, AVL_HANDLE h) {
- AVL_SET_LESS(h, AVL_NULL)
- AVL_SET_GREATER(h, AVL_NULL)
- AVL_SET_BALANCE_FACTOR(h, 0)
-
- if (l_tree->root == AVL_NULL)
- l_tree->root = h;
- else {
- /* Last unbalanced node encountered in search for insertion point. */
- AVL_HANDLE unbal = AVL_NULL;
- /* Parent of last unbalanced node. */
- AVL_HANDLE parent_unbal = AVL_NULL;
- /* Balance factor of last unbalanced node. */
- int unbal_bf;
-
- /* Zero-based depth in tree. */
- unsigned depth = 0, unbal_depth = 0;
-
- /* Records a path into the tree. If bit n is true, indicates
- ** take greater branch from the nth node in the path, otherwise
- ** take the less branch. bit 0 gives branch from root, and
- ** so on. */
- L_BIT_ARR_DEFN(branch)
-
- AVL_HANDLE hh = l_tree->root;
- AVL_HANDLE parent = AVL_NULL;
- int cmp;
-
- do {
- if (AVL_GET_BALANCE_FACTOR(hh) != 0) {
- unbal = hh;
- parent_unbal = parent;
- unbal_depth = depth;
- }
-
- cmp = AVL_COMPARE_NODE_NODE(h, hh);
-
- if (cmp == 0)
- /* Duplicate key. */
- return(hh);
-
- parent = hh;
-
- if (cmp > 0) {
- hh = AVL_GET_GREATER(hh, 1);
- L_BIT_ARR_1(branch, depth)
- } else {
- hh = AVL_GET_LESS(hh, 1);
- L_BIT_ARR_0(branch, depth)
- }
-
- L_CHECK_READ_ERROR(AVL_NULL)
- depth++;
- } while (hh != AVL_NULL);
-
- /* Add node to insert as leaf of tree. */
- if (cmp < 0)
- AVL_SET_LESS(parent, h)
- else
- AVL_SET_GREATER(parent, h)
-
- depth = unbal_depth;
-
- if (unbal == AVL_NULL)
- hh = l_tree->root;
- else {
- cmp = L_BIT_ARR_VAL(branch, depth) ? 1 : -1;
- depth++;
- unbal_bf = AVL_GET_BALANCE_FACTOR(unbal);
-
- if (cmp < 0)
- unbal_bf--;
- else /* cmp > 0 */
- unbal_bf++;
-
- hh = cmp < 0 ? AVL_GET_LESS(unbal, 1) : AVL_GET_GREATER(unbal, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
-
- if ((unbal_bf != -2) && (unbal_bf != 2)) {
- /* No rebalancing of tree is necessary. */
- AVL_SET_BALANCE_FACTOR(unbal, unbal_bf)
- unbal = AVL_NULL;
- }
- }
-
- if (hh != AVL_NULL)
- while (h != hh) {
- cmp = L_BIT_ARR_VAL(branch, depth) ? 1 : -1;
- depth++;
-
- if (cmp < 0) {
- AVL_SET_BALANCE_FACTOR(hh, -1)
- hh = AVL_GET_LESS(hh, 1);
- } else { /* cmp > 0 */
- AVL_SET_BALANCE_FACTOR(hh, 1)
- hh = AVL_GET_GREATER(hh, 1);
- }
-
- L_CHECK_READ_ERROR(AVL_NULL)
- }
-
- if (unbal != AVL_NULL) {
- unbal = L_(balance)(L_BALANCE_PARAM_CALL_PREFIX unbal);
- L_CHECK_READ_ERROR(AVL_NULL)
-
- if (parent_unbal == AVL_NULL)
- l_tree->root = unbal;
- else {
- depth = unbal_depth - 1;
- cmp = L_BIT_ARR_VAL(branch, depth) ? 1 : -1;
-
- if (cmp < 0)
- AVL_SET_LESS(parent_unbal, unbal)
- else /* cmp > 0 */
- AVL_SET_GREATER(parent_unbal, unbal)
- }
- }
-
- }
-
- return(h);
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_SEARCH)
-
-L_SC AVL_HANDLE L_(search)(L_(avl) *l_tree, AVL_KEY k, avl_search_type st) {
- int cmp, target_cmp;
- AVL_HANDLE match_h = AVL_NULL;
- AVL_HANDLE h = l_tree->root;
-
- if (st & AVL_LESS)
- target_cmp = 1;
- else if (st & AVL_GREATER)
- target_cmp = -1;
- else
- target_cmp = 0;
-
- while (h != AVL_NULL) {
- cmp = AVL_COMPARE_KEY_NODE(k, h);
-
- if (cmp == 0) {
- if (st & AVL_EQUAL) {
- match_h = h;
- break;
- }
-
- cmp = -target_cmp;
- } else if (target_cmp != 0)
- if (!((cmp ^ target_cmp) & L_MASK_HIGH_BIT))
- /* cmp and target_cmp are both positive or both negative. */
- match_h = h;
-
- h = cmp < 0 ? AVL_GET_LESS(h, 1) : AVL_GET_GREATER(h, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
- }
-
- return(match_h);
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_SEARCH_LEAST)
-
-L_SC AVL_HANDLE L_(search_least)(L_(avl) *l_tree) {
- AVL_HANDLE h = l_tree->root;
- AVL_HANDLE parent = AVL_NULL;
-
- while (h != AVL_NULL) {
- parent = h;
- h = AVL_GET_LESS(h, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
- }
-
- return(parent);
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_SEARCH_GREATEST)
-
-L_SC AVL_HANDLE L_(search_greatest)(L_(avl) *l_tree) {
- AVL_HANDLE h = l_tree->root;
- AVL_HANDLE parent = AVL_NULL;
-
- while (h != AVL_NULL) {
- parent = h;
- h = AVL_GET_GREATER(h, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
- }
-
- return(parent);
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_REMOVE)
-
-/* Prototype of balance function (called by remove) in case not in
-** same compilation unit.
-*/
-L_SC AVL_HANDLE L_(balance)(L_BALANCE_PARAM_DECL_PREFIX AVL_HANDLE bal_h);
-
-L_SC AVL_HANDLE L_(remove)(L_(avl) *l_tree, AVL_KEY k) {
- /* Zero-based depth in tree. */
- unsigned depth = 0, rm_depth;
-
- /* Records a path into the tree. If bit n is true, indicates
- ** take greater branch from the nth node in the path, otherwise
- ** take the less branch. bit 0 gives branch from root, and
- ** so on. */
- L_BIT_ARR_DEFN(branch)
-
- AVL_HANDLE h = l_tree->root;
- AVL_HANDLE parent = AVL_NULL;
- AVL_HANDLE child;
- AVL_HANDLE path;
- int cmp, cmp_shortened_sub_with_path;
- int reduced_depth;
- int bf;
- AVL_HANDLE rm;
- AVL_HANDLE parent_rm;
-
- for (;;) {
- if (h == AVL_NULL)
- /* No node in tree with given key. */
- return(AVL_NULL);
-
- cmp = AVL_COMPARE_KEY_NODE(k, h);
-
- if (cmp == 0)
- /* Found node to remove. */
- break;
-
- parent = h;
-
- if (cmp > 0) {
- h = AVL_GET_GREATER(h, 1);
- L_BIT_ARR_1(branch, depth)
- } else {
- h = AVL_GET_LESS(h, 1);
- L_BIT_ARR_0(branch, depth)
- }
-
- L_CHECK_READ_ERROR(AVL_NULL)
- depth++;
- cmp_shortened_sub_with_path = cmp;
- }
-
- rm = h;
- parent_rm = parent;
- rm_depth = depth;
-
- /* If the node to remove is not a leaf node, we need to get a
- ** leaf node, or a node with a single leaf as its child, to put
- ** in the place of the node to remove. We will get the greatest
- ** node in the less subtree (of the node to remove), or the least
- ** node in the greater subtree. We take the leaf node from the
- ** deeper subtree, if there is one. */
-
- if (AVL_GET_BALANCE_FACTOR(h) < 0) {
- child = AVL_GET_LESS(h, 1);
- L_BIT_ARR_0(branch, depth)
- cmp = -1;
- } else {
- child = AVL_GET_GREATER(h, 1);
- L_BIT_ARR_1(branch, depth)
- cmp = 1;
- }
-
- L_CHECK_READ_ERROR(AVL_NULL)
- depth++;
-
- if (child != AVL_NULL) {
- cmp = -cmp;
-
- do {
- parent = h;
- h = child;
-
- if (cmp < 0) {
- child = AVL_GET_LESS(h, 1);
- L_BIT_ARR_0(branch, depth)
- } else {
- child = AVL_GET_GREATER(h, 1);
- L_BIT_ARR_1(branch, depth)
- }
-
- L_CHECK_READ_ERROR(AVL_NULL)
- depth++;
- } while (child != AVL_NULL);
-
- if (parent == rm)
- /* Only went through do loop once. Deleted node will be replaced
- ** in the tree structure by one of its immediate children. */
- cmp_shortened_sub_with_path = -cmp;
- else
- cmp_shortened_sub_with_path = cmp;
-
- /* Get the handle of the opposite child, which may not be null. */
- child = cmp > 0 ? AVL_GET_LESS(h, 0) : AVL_GET_GREATER(h, 0);
- }
-
- if (parent == AVL_NULL)
- /* There were only 1 or 2 nodes in this tree. */
- l_tree->root = child;
- else if (cmp_shortened_sub_with_path < 0)
- AVL_SET_LESS(parent, child)
- else
- AVL_SET_GREATER(parent, child)
-
- /* "path" is the parent of the subtree being eliminated or reduced
- ** from a depth of 2 to 1. If "path" is the node to be removed, we
- ** set path to the node we're about to poke into the position of the
- ** node to be removed. */
- path = parent == rm ? h : parent;
-
- if (h != rm) {
- /* Poke in the replacement for the node to be removed. */
- AVL_SET_LESS(h, AVL_GET_LESS(rm, 0))
- AVL_SET_GREATER(h, AVL_GET_GREATER(rm, 0))
- AVL_SET_BALANCE_FACTOR(h, AVL_GET_BALANCE_FACTOR(rm))
-
- if (parent_rm == AVL_NULL)
- l_tree->root = h;
- else {
- depth = rm_depth - 1;
-
- if (L_BIT_ARR_VAL(branch, depth))
- AVL_SET_GREATER(parent_rm, h)
- else
- AVL_SET_LESS(parent_rm, h)
- }
- }
-
- if (path != AVL_NULL) {
- /* Create a temporary linked list from the parent of the path node
- ** to the root node. */
- h = l_tree->root;
- parent = AVL_NULL;
- depth = 0;
-
- while (h != path) {
- if (L_BIT_ARR_VAL(branch, depth)) {
- child = AVL_GET_GREATER(h, 1);
- AVL_SET_GREATER(h, parent)
- } else {
- child = AVL_GET_LESS(h, 1);
- AVL_SET_LESS(h, parent)
- }
-
- L_CHECK_READ_ERROR(AVL_NULL)
- depth++;
- parent = h;
- h = child;
- }
-
- /* Climb from the path node to the root node using the linked
- ** list, restoring the tree structure and rebalancing as necessary.
- */
- reduced_depth = 1;
- cmp = cmp_shortened_sub_with_path;
-
- for (;;) {
- if (reduced_depth) {
- bf = AVL_GET_BALANCE_FACTOR(h);
-
- if (cmp < 0)
- bf++;
- else /* cmp > 0 */
- bf--;
-
- if ((bf == -2) || (bf == 2)) {
- h = L_(balance)(L_BALANCE_PARAM_CALL_PREFIX h);
- L_CHECK_READ_ERROR(AVL_NULL)
- bf = AVL_GET_BALANCE_FACTOR(h);
- } else
- AVL_SET_BALANCE_FACTOR(h, bf)
- reduced_depth = (bf == 0);
- }
-
- if (parent == AVL_NULL)
- break;
-
- child = h;
- h = parent;
- depth--;
- cmp = L_BIT_ARR_VAL(branch, depth) ? 1 : -1;
-
- if (cmp < 0) {
- parent = AVL_GET_LESS(h, 1);
- AVL_SET_LESS(h, child)
- } else {
- parent = AVL_GET_GREATER(h, 1);
- AVL_SET_GREATER(h, child)
- }
-
- L_CHECK_READ_ERROR(AVL_NULL)
- }
-
- l_tree->root = h;
- }
-
- return(rm);
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_SUBST)
-
-L_SC AVL_HANDLE L_(subst)(L_(avl) *l_tree, AVL_HANDLE new_node) {
- AVL_HANDLE h = l_tree->root;
- AVL_HANDLE parent = AVL_NULL;
- int cmp, last_cmp;
-
- /* Search for node already in tree with same key. */
- for (;;) {
- if (h == AVL_NULL)
- /* No node in tree with same key as new node. */
- return(AVL_NULL);
-
- cmp = AVL_COMPARE_NODE_NODE(new_node, h);
-
- if (cmp == 0)
- /* Found the node to substitute new one for. */
- break;
-
- last_cmp = cmp;
- parent = h;
- h = cmp < 0 ? AVL_GET_LESS(h, 1) : AVL_GET_GREATER(h, 1);
- L_CHECK_READ_ERROR(AVL_NULL)
- }
-
- /* Copy tree housekeeping fields from node in tree to new node. */
- AVL_SET_LESS(new_node, AVL_GET_LESS(h, 0))
- AVL_SET_GREATER(new_node, AVL_GET_GREATER(h, 0))
- AVL_SET_BALANCE_FACTOR(new_node, AVL_GET_BALANCE_FACTOR(h))
-
- if (parent == AVL_NULL)
- /* New node is also new root. */
- l_tree->root = new_node;
- else {
- /* Make parent point to new node. */
- if (last_cmp < 0)
- AVL_SET_LESS(parent, new_node)
- else
- AVL_SET_GREATER(parent, new_node)
- }
-
- return(h);
-}
-
-#endif
-
-#ifdef AVL_BUILD_ITER_TYPE
-
-#if (L_IMPL_MASK & AVL_IMPL_BUILD)
-
-L_SC int L_(build)(
- L_(avl) *l_tree, AVL_BUILD_ITER_TYPE p, L_SIZE num_nodes) {
- /* Gives path to subtree being built. If bit n is false, branch
- ** less from the node at depth n, if true branch greater. */
- L_BIT_ARR_DEFN(branch)
-
- /* If bit n is true, then for the current subtree at depth n, its
- ** greater subtree has one more node than its less subtree. */
- L_BIT_ARR_DEFN(rem)
-
- /* Depth of root node of current subtree. */
- unsigned depth = 0;
-
- /* Number of nodes in current subtree. */
- L_SIZE num_sub = num_nodes;
-
- /* The algorithm relies on a stack of nodes whose less subtree has
- ** been built, but whose greater subtree has not yet been built.
- ** The stack is implemented as linked list. The nodes are linked
- ** together by having the "greater" handle of a node set to the
- ** next node in the list. "less_parent" is the handle of the first
- ** node in the list. */
- AVL_HANDLE less_parent = AVL_NULL;
-
- /* h is root of current subtree, child is one of its children. */
- AVL_HANDLE h;
- AVL_HANDLE child;
-
- if (num_nodes == 0) {
- l_tree->root = AVL_NULL;
- return(1);
- }
-
- for (;;) {
- while (num_sub > 2) {
- /* Subtract one for root of subtree. */
- num_sub--;
-
- if (num_sub & 1)
- L_BIT_ARR_1(rem, depth)
- else
- L_BIT_ARR_0(rem, depth)
- L_BIT_ARR_0(branch, depth)
- depth++;
-
- num_sub >>= 1;
- }
-
- if (num_sub == 2) {
- /* Build a subtree with two nodes, slanting to greater.
- ** I arbitrarily chose to always have the extra node in the
- ** greater subtree when there is an odd number of nodes to
- ** split between the two subtrees. */
-
- h = AVL_BUILD_ITER_VAL(p);
- L_CHECK_READ_ERROR(0)
- AVL_BUILD_ITER_INCR(p)
- child = AVL_BUILD_ITER_VAL(p);
- L_CHECK_READ_ERROR(0)
- AVL_BUILD_ITER_INCR(p)
- AVL_SET_LESS(child, AVL_NULL)
- AVL_SET_GREATER(child, AVL_NULL)
- AVL_SET_BALANCE_FACTOR(child, 0)
- AVL_SET_GREATER(h, child)
- AVL_SET_LESS(h, AVL_NULL)
- AVL_SET_BALANCE_FACTOR(h, 1)
- } else { /* num_sub == 1 */
- /* Build a subtree with one node. */
-
- h = AVL_BUILD_ITER_VAL(p);
- L_CHECK_READ_ERROR(0)
- AVL_BUILD_ITER_INCR(p)
- AVL_SET_LESS(h, AVL_NULL)
- AVL_SET_GREATER(h, AVL_NULL)
- AVL_SET_BALANCE_FACTOR(h, 0)
- }
-
- while (depth) {
- depth--;
-
- if (!L_BIT_ARR_VAL(branch, depth))
- /* We've completed a less subtree. */
- break;
-
- /* We've completed a greater subtree, so attach it to
- ** its parent (that is less than it). We pop the parent
- ** off the stack of less parents. */
- child = h;
- h = less_parent;
- less_parent = AVL_GET_GREATER(h, 1);
- L_CHECK_READ_ERROR(0)
- AVL_SET_GREATER(h, child)
- /* num_sub = 2 * (num_sub - rem[depth]) + rem[depth] + 1 */
- num_sub <<= 1;
- num_sub += L_BIT_ARR_VAL(rem, depth) ? 0 : 1;
-
- if (num_sub & (num_sub - 1))
- /* num_sub is not a power of 2. */
- AVL_SET_BALANCE_FACTOR(h, 0)
- else
- /* num_sub is a power of 2. */
- AVL_SET_BALANCE_FACTOR(h, 1)
- }
-
- if (num_sub == num_nodes)
- /* We've completed the full tree. */
- break;
-
- /* The subtree we've completed is the less subtree of the
- ** next node in the sequence. */
-
- child = h;
- h = AVL_BUILD_ITER_VAL(p);
- L_CHECK_READ_ERROR(0)
- AVL_BUILD_ITER_INCR(p)
- AVL_SET_LESS(h, child)
-
- /* Put h into stack of less parents. */
- AVL_SET_GREATER(h, less_parent)
- less_parent = h;
-
- /* Proceed to creating greater than subtree of h. */
- L_BIT_ARR_1(branch, depth)
- num_sub += L_BIT_ARR_VAL(rem, depth) ? 1 : 0;
- depth++;
-
- } /* end for (;; ) */
-
- l_tree->root = h;
-
- return(1);
-}
-
-#endif
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_INIT_ITER)
-
-/* Initialize depth to invalid value, to indicate iterator is
-** invalid. (Depth is zero-base.) It's not necessary to initialize
-** iterators prior to passing them to the "start" function.
-*/
-L_SC void L_(init_iter)(L_(iter) *iter) {
- iter->depth = ~0;
-}
-
-#endif
-
-#ifdef AVL_READ_ERRORS_HAPPEN
-
-#define L_CHECK_READ_ERROR_INV_DEPTH \
- { if (AVL_READ_ERROR) { iter->depth = ~0; return; } }
-
-#else
-
-#define L_CHECK_READ_ERROR_INV_DEPTH
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_START_ITER)
-
-L_SC void L_(start_iter)(
- L_(avl) *l_tree, L_(iter) *iter, AVL_KEY k, avl_search_type st) {
- AVL_HANDLE h = l_tree->root;
- unsigned d = 0;
- int cmp, target_cmp;
-
- /* Save the tree that we're going to iterate through in a
- ** member variable. */
- iter->tree_ = l_tree;
-
- iter->depth = ~0;
-
- if (h == AVL_NULL)
- /* Tree is empty. */
- return;
-
- if (st & AVL_LESS)
- /* Key can be greater than key of starting node. */
- target_cmp = 1;
- else if (st & AVL_GREATER)
- /* Key can be less than key of starting node. */
- target_cmp = -1;
- else
- /* Key must be same as key of starting node. */
- target_cmp = 0;
-
- for (;;) {
- cmp = AVL_COMPARE_KEY_NODE(k, h);
-
- if (cmp == 0) {
- if (st & AVL_EQUAL) {
- /* Equal node was sought and found as starting node. */
- iter->depth = d;
- break;
- }
-
- cmp = -target_cmp;
- } else if (target_cmp != 0)
- if (!((cmp ^ target_cmp) & L_MASK_HIGH_BIT))
- /* cmp and target_cmp are both negative or both positive. */
- iter->depth = d;
-
- h = cmp < 0 ? AVL_GET_LESS(h, 1) : AVL_GET_GREATER(h, 1);
- L_CHECK_READ_ERROR_INV_DEPTH
-
- if (h == AVL_NULL)
- break;
-
- if (cmp > 0)
- L_BIT_ARR_1(iter->branch, d)
- else
- L_BIT_ARR_0(iter->branch, d)
- iter->path_h[d++] = h;
- }
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_START_ITER_LEAST)
-
-L_SC void L_(start_iter_least)(L_(avl) *l_tree, L_(iter) *iter) {
- AVL_HANDLE h = l_tree->root;
-
- iter->tree_ = l_tree;
-
- iter->depth = ~0;
-
- L_BIT_ARR_ALL(iter->branch, 0)
-
- while (h != AVL_NULL) {
- if (iter->depth != ~0)
- iter->path_h[iter->depth] = h;
-
- iter->depth++;
- h = AVL_GET_LESS(h, 1);
- L_CHECK_READ_ERROR_INV_DEPTH
- }
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_START_ITER_GREATEST)
-
-L_SC void L_(start_iter_greatest)(L_(avl) *l_tree, L_(iter) *iter) {
- AVL_HANDLE h = l_tree->root;
-
- iter->tree_ = l_tree;
-
- iter->depth = ~0;
-
- L_BIT_ARR_ALL(iter->branch, 1)
-
- while (h != AVL_NULL) {
- if (iter->depth != ~0)
- iter->path_h[iter->depth] = h;
-
- iter->depth++;
- h = AVL_GET_GREATER(h, 1);
- L_CHECK_READ_ERROR_INV_DEPTH
- }
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_GET_ITER)
-
-L_SC AVL_HANDLE L_(get_iter)(L_(iter) *iter) {
- if (iter->depth == ~0)
- return(AVL_NULL);
-
- return(iter->depth == 0 ?
- iter->tree_->root : iter->path_h[iter->depth - 1]);
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_INCR_ITER)
-
-L_SC void L_(incr_iter)(L_(iter) *iter) {
-#define l_tree (iter->tree_)
-
- if (iter->depth != ~0) {
- AVL_HANDLE h =
- AVL_GET_GREATER((iter->depth == 0 ?
- iter->tree_->root : iter->path_h[iter->depth - 1]), 1);
- L_CHECK_READ_ERROR_INV_DEPTH
-
- if (h == AVL_NULL)
- do {
- if (iter->depth == 0) {
- iter->depth = ~0;
- break;
- }
-
- iter->depth--;
- } while (L_BIT_ARR_VAL(iter->branch, iter->depth));
- else {
- L_BIT_ARR_1(iter->branch, iter->depth)
- iter->path_h[iter->depth++] = h;
-
- for (;;) {
- h = AVL_GET_LESS(h, 1);
- L_CHECK_READ_ERROR_INV_DEPTH
-
- if (h == AVL_NULL)
- break;
-
- L_BIT_ARR_0(iter->branch, iter->depth)
- iter->path_h[iter->depth++] = h;
- }
- }
- }
-
-#undef l_tree
-}
-
-#endif
-
-#if (L_IMPL_MASK & AVL_IMPL_DECR_ITER)
-
-L_SC void L_(decr_iter)(L_(iter) *iter) {
-#define l_tree (iter->tree_)
-
- if (iter->depth != ~0) {
- AVL_HANDLE h =
- AVL_GET_LESS((iter->depth == 0 ?
- iter->tree_->root : iter->path_h[iter->depth - 1]), 1);
- L_CHECK_READ_ERROR_INV_DEPTH
-
- if (h == AVL_NULL)
- do {
- if (iter->depth == 0) {
- iter->depth = ~0;
- break;
- }
-
- iter->depth--;
- } while (!L_BIT_ARR_VAL(iter->branch, iter->depth));
- else {
- L_BIT_ARR_0(iter->branch, iter->depth)
- iter->path_h[iter->depth++] = h;
-
- for (;;) {
- h = AVL_GET_GREATER(h, 1);
- L_CHECK_READ_ERROR_INV_DEPTH
-
- if (h == AVL_NULL)
- break;
-
- L_BIT_ARR_1(iter->branch, iter->depth)
- iter->path_h[iter->depth++] = h;
- }
- }
- }
-
-#undef l_tree
-}
-
-#endif
-
-/* Tidy up the preprocessor symbol name space. */
-#undef L_
-#undef L_EST_LONG_BIT
-#undef L_SIZE
-#undef L_MASK_HIGH_BIT
-#undef L_LONG_BIT
-#undef L_BIT_ARR_DEFN
-#undef L_BIT_ARR_VAL
-#undef L_BIT_ARR_0
-#undef L_BIT_ARR_1
-#undef L_BIT_ARR_ALL
-#undef L_CHECK_READ_ERROR
-#undef L_CHECK_READ_ERROR_INV_DEPTH
-#undef L_BIT_ARR_LONGS
-#undef L_IMPL_MASK
-#undef L_CHECK_READ_ERROR
-#undef L_CHECK_READ_ERROR_INV_DEPTH
-#undef L_SC
-#undef L_BALANCE_PARAM_CALL_PREFIX
-#undef L_BALANCE_PARAM_DECL_PREFIX
-
-#endif // VPX_MEM_MEMORY_MANAGER_INCLUDE_CAVL_IMPL_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/heapmm.h b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/heapmm.h
deleted file mode 100644
index d584b19..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/heapmm.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_MEM_MEMORY_MANAGER_INCLUDE_HEAPMM_H_
-#define VPX_MEM_MEMORY_MANAGER_INCLUDE_HEAPMM_H_
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-/* External header file for Heap Memory Manager. See documentation in
-** heapmm.html.
-*/
-
-#undef HMM_PROCESS
-
-/* Include once per configuration in a particular translation unit. */
-
-#ifndef HMM_CNFG_NUM
-
-/* Default configuration. */
-
-#ifndef HMM_INC_CNFG_DFLT
-#define HMM_INC_CNFG_DFLT
-#define HMM_PROCESS
-#endif
-
-#elif HMM_CNFG_NUM == 0
-
-/* Test configuration. */
-
-#ifndef HMM_INC_CNFG_0
-#define HMM_INC_CNFG_0
-#define HMM_PROCESS
-#endif
-
-#elif HMM_CNFG_NUM == 1
-
-#ifndef HMM_INC_CNFG_1
-#define HMM_INC_CNFG_1
-#define HMM_PROCESS
-#endif
-
-#elif HMM_CNFG_NUM == 2
-
-#ifndef HMM_INC_CNFG_2
-#define HMM_INC_CNFG_2
-#define HMM_PROCESS
-#endif
-
-#elif HMM_CNFG_NUM == 3
-
-#ifndef HMM_INC_CNFG_3
-#define HMM_INC_CNFG_3
-#define HMM_PROCESS
-#endif
-
-#elif HMM_CNFG_NUM == 4
-
-#ifndef HMM_INC_CNFG_4
-#define HMM_INC_CNFG_4
-#define HMM_PROCESS
-#endif
-
-#elif HMM_CNFG_NUM == 5
-
-#ifndef HMM_INC_CNFG_5
-#define HMM_INC_CNFG_5
-#define HMM_PROCESS
-#endif
-
-#endif
-
-#ifdef HMM_PROCESS
-
-#include "hmm_cnfg.h"
-
-/* Heap descriptor. */
-typedef struct HMM_UNIQUE(structure) {
- /* private: */
-
- /* Pointer to (payload of) root node in AVL tree. This field should
- ** really be the AVL tree descriptor (type avl_avl). But (in the
- ** instantiation of the AVL tree generic package used in package) the
- ** AVL tree descriptor simply contains a pointer to the root. So,
- ** whenever a pointer to the AVL tree descriptor is needed, I use the
- ** cast:
- **
- ** (avl_avl *) &(heap_desc->avl_tree_root)
- **
- ** (where heap_desc is a pointer to a heap descriptor). This trick
- ** allows me to avoid including cavl_if.h in this external header. */
- void *avl_tree_root;
-
- /* Pointer to first byte of last block freed, after any coalescing. */
- void *last_freed;
-
- /* public: */
-
- HMM_UNIQUE(size_bau) num_baus_can_shrink;
- void *end_of_shrinkable_chunk;
-}
-HMM_UNIQUE(descriptor);
-
-/* Prototypes for externally-callable functions. */
-
-void HMM_UNIQUE(init)(HMM_UNIQUE(descriptor) *desc);
-
-void *HMM_UNIQUE(alloc)(
- HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) num_addr_align_units);
-
-/* NOT YET IMPLEMENTED */
-void *HMM_UNIQUE(greedy_alloc)(
- HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) needed_addr_align_units,
- HMM_UNIQUE(size_aau) coveted_addr_align_units);
-
-int HMM_UNIQUE(resize)(
- HMM_UNIQUE(descriptor) *desc, void *mem,
- HMM_UNIQUE(size_aau) num_addr_align_units);
-
-/* NOT YET IMPLEMENTED */
-int HMM_UNIQUE(greedy_resize)(
- HMM_UNIQUE(descriptor) *desc, void *mem,
- HMM_UNIQUE(size_aau) needed_addr_align_units,
- HMM_UNIQUE(size_aau) coveted_addr_align_units);
-
-void HMM_UNIQUE(free)(HMM_UNIQUE(descriptor) *desc, void *mem);
-
-HMM_UNIQUE(size_aau) HMM_UNIQUE(true_size)(void *mem);
-
-HMM_UNIQUE(size_aau) HMM_UNIQUE(largest_available)(
- HMM_UNIQUE(descriptor) *desc);
-
-void HMM_UNIQUE(new_chunk)(
- HMM_UNIQUE(descriptor) *desc, void *start_of_chunk,
- HMM_UNIQUE(size_bau) num_block_align_units);
-
-void HMM_UNIQUE(grow_chunk)(
- HMM_UNIQUE(descriptor) *desc, void *end_of_chunk,
- HMM_UNIQUE(size_bau) num_block_align_units);
-
-/* NOT YET IMPLEMENTED */
-void HMM_UNIQUE(shrink_chunk)(
- HMM_UNIQUE(descriptor) *desc,
- HMM_UNIQUE(size_bau) num_block_align_units);
-
-#endif /* defined HMM_PROCESS */
-#endif // VPX_MEM_MEMORY_MANAGER_INCLUDE_HEAPMM_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_cnfg.h b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_cnfg.h
deleted file mode 100644
index caa8713..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_cnfg.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_MEM_MEMORY_MANAGER_INCLUDE_HMM_CNFG_H_
-#define VPX_MEM_MEMORY_MANAGER_INCLUDE_HMM_CNFG_H_
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-/* Configure Heap Memory Manager for processor architecture, compiler,
-** and desired performance characteristics. This file is included
-** by heapmm.h, so these definitions can be used by code external to
-** HMM. You can change the default configuration, and/or create alternate
-** configuration(s).
-*/
-
-/* To allow for multiple configurations of HMM to be used in the same
-** compilation unit, undefine all preprocessor symbols that will be
-** defined below.
-*/
-#undef HMM_ADDR_ALIGN_UNIT
-#undef HMM_BLOCK_ALIGN_UNIT
-#undef HMM_UNIQUE
-#undef HMM_DESC_PARAM
-#undef HMM_SYM_TO_STRING
-#undef HMM_SYM_TO_STRING
-#undef HMM_AUDIT_FAIL
-
-/* Turn X into a string after one macro expansion pass of X. This trick
-** works with both GCC and Visual C++. */
-#define HMM_SYM_TO_STRING(X) HMM_SYM_TO_STRING(X)
-#define HMM_SYM_TO_STRING(X) #X
-
-#ifndef HMM_CNFG_NUM
-
-/* Default configuration. */
-
-/* Use hmm_ prefix to avoid identifier conflicts. */
-#define HMM_UNIQUE(BASE) hmm_ ## BASE
-
-/* Number of bytes in an Address Alignment Unit (AAU). */
-// fwg
-// #define HMM_ADDR_ALIGN_UNIT sizeof(int)
-#define HMM_ADDR_ALIGN_UNIT 32
-
-/* Number of AAUs in a Block Alignment Unit (BAU). */
-#define HMM_BLOCK_ALIGN_UNIT 1
-
-/* Type of unsigned integer big enough to hold the size of a Block in AAUs. */
-typedef unsigned long HMM_UNIQUE(size_aau);
-
-/* Type of unsigned integer big enough to hold the size of a Block/Chunk
-** in BAUs. The high bit will be robbed. */
-typedef unsigned long HMM_UNIQUE(size_bau);
-
-void hmm_dflt_abort(const char *, const char *);
-
-/* Actions upon a self-audit failure. Must expand to a single complete
-** statement. If you remove the definition of this macro, no self-auditing
-** will be performed. */
-#define HMM_AUDIT_FAIL \
- hmm_dflt_abort(__FILE__, HMM_SYM_TO_STRING(__LINE__));
-
-#elif HMM_CNFG_NUM == 0
-
-/* Definitions for testing. */
-
-#define HMM_UNIQUE(BASE) thmm_ ## BASE
-
-#define HMM_ADDR_ALIGN_UNIT sizeof(int)
-
-#define HMM_BLOCK_ALIGN_UNIT 3
-
-typedef unsigned HMM_UNIQUE(size_aau);
-
-typedef unsigned short HMM_UNIQUE(size_bau);
-
-/* Under this test setup, a long jump is done if there is a self-audit
-** failure.
-*/
-
-extern jmp_buf HMM_UNIQUE(jmp_buf);
-extern const char *HMM_UNIQUE(fail_file);
-extern unsigned HMM_UNIQUE(fail_line);
-
-#define HMM_AUDIT_FAIL \
- { HMM_UNIQUE(fail_file) = __FILE__; HMM_UNIQUE(fail_line) = __LINE__; \
- longjmp(HMM_UNIQUE(jmp_buf), 1); }
-
-#elif HMM_CNFG_NUM == 1
-
-/* Put configuration 1 definitions here (if there is a configuration 1). */
-
-#elif HMM_CNFG_NUM == 2
-
-/* Put configuration 2 definitions here. */
-
-#elif HMM_CNFG_NUM == 3
-
-/* Put configuration 3 definitions here. */
-
-#elif HMM_CNFG_NUM == 4
-
-/* Put configuration 4 definitions here. */
-
-#elif HMM_CNFG_NUM == 5
-
-/* Put configuration 5 definitions here. */
-
-#endif
-
-#endif // VPX_MEM_MEMORY_MANAGER_INCLUDE_HMM_CNFG_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_intrnl.h b/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_intrnl.h
deleted file mode 100644
index 7302aa2..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/memory_manager/include/hmm_intrnl.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/* This code is in the public domain.
-** Version: 1.1 Author: Walt Karas
-*/
-
-#ifndef VPX_MEM_MEMORY_MANAGER_INCLUDE_HMM_INTRNL_H_
-#define VPX_MEM_MEMORY_MANAGER_INCLUDE_HMM_INTRNL_H_
-
-#ifdef __uClinux__
-# include <lddk.h>
-#endif
-
-#include "heapmm.h"
-
-#define U(BASE) HMM_UNIQUE(BASE)
-
-/* Mask of high bit of variable of size_bau type. */
-#define HIGH_BIT_BAU_SIZE \
- ((U(size_bau)) ~ (((U(size_bau)) ~ (U(size_bau)) 0) >> 1))
-
-/* Add a given number of AAUs to pointer. */
-#define AAUS_FORWARD(PTR, AAU_OFFSET) \
- (((char *) (PTR)) + ((AAU_OFFSET) * ((U(size_aau)) HMM_ADDR_ALIGN_UNIT)))
-
-/* Subtract a given number of AAUs from pointer. */
-#define AAUS_BACKWARD(PTR, AAU_OFFSET) \
- (((char *) (PTR)) - ((AAU_OFFSET) * ((U(size_aau)) HMM_ADDR_ALIGN_UNIT)))
-
-/* Add a given number of BAUs to a pointer. */
-#define BAUS_FORWARD(PTR, BAU_OFFSET) \
- AAUS_FORWARD((PTR), (BAU_OFFSET) * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT))
-
-/* Subtract a given number of BAUs to a pointer. */
-#define BAUS_BACKWARD(PTR, BAU_OFFSET) \
- AAUS_BACKWARD((PTR), (BAU_OFFSET) * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT))
-
-typedef struct head_struct {
- /* Sizes in Block Alignment Units. */
- HMM_UNIQUE(size_bau) previous_block_size, block_size;
-}
-head_record;
-
-typedef struct ptr_struct {
- struct ptr_struct *self, *prev, *next;
-}
-ptr_record;
-
-/* Divide and round up any fraction to the next whole number. */
-#define DIV_ROUND_UP(NUMER, DENOM) (((NUMER) + (DENOM) - 1) / (DENOM))
-
-/* Number of AAUs in a block head. */
-#define HEAD_AAUS DIV_ROUND_UP(sizeof(head_record), HMM_ADDR_ALIGN_UNIT)
-
-/* Number of AAUs in a block pointer record. */
-#define PTR_RECORD_AAUS DIV_ROUND_UP(sizeof(ptr_record), HMM_ADDR_ALIGN_UNIT)
-
-/* Number of BAUs in a dummy end record (at end of chunk). */
-#define DUMMY_END_BLOCK_BAUS DIV_ROUND_UP(HEAD_AAUS, HMM_BLOCK_ALIGN_UNIT)
-
-/* Minimum number of BAUs in a block (allowing room for the pointer record. */
-#define MIN_BLOCK_BAUS \
- DIV_ROUND_UP(HEAD_AAUS + PTR_RECORD_AAUS, HMM_BLOCK_ALIGN_UNIT)
-
-/* Return number of BAUs in block (masking off high bit containing block
-** status). */
-#define BLOCK_BAUS(HEAD_PTR) \
- (((head_record *) (HEAD_PTR))->block_size & ~HIGH_BIT_BAU_SIZE)
-
-/* Return number of BAUs in previous block (masking off high bit containing
-** block status). */
-#define PREV_BLOCK_BAUS(HEAD_PTR) \
- (((head_record *) (HEAD_PTR))->previous_block_size & ~HIGH_BIT_BAU_SIZE)
-
-/* Set number of BAUs in previous block, preserving high bit containing
-** block status. */
-#define SET_PREV_BLOCK_BAUS(HEAD_PTR, N_BAUS) \
- { register head_record *h_ptr = (head_record *) (HEAD_PTR); \
- h_ptr->previous_block_size &= HIGH_BIT_BAU_SIZE; \
- h_ptr->previous_block_size |= (N_BAUS); }
-
-/* Convert pointer to pointer record of block to pointer to block's head
-** record. */
-#define PTR_REC_TO_HEAD(PTR_REC_PTR) \
- ((head_record *) AAUS_BACKWARD(PTR_REC_PTR, HEAD_AAUS))
-
-/* Convert pointer to block head to pointer to block's pointer record. */
-#define HEAD_TO_PTR_REC(HEAD_PTR) \
- ((ptr_record *) AAUS_FORWARD(HEAD_PTR, HEAD_AAUS))
-
-/* Returns non-zero if block is allocated. */
-#define IS_BLOCK_ALLOCATED(HEAD_PTR) \
- (((((head_record *) (HEAD_PTR))->block_size | \
- ((head_record *) (HEAD_PTR))->previous_block_size) & \
- HIGH_BIT_BAU_SIZE) == 0)
-
-#define MARK_BLOCK_ALLOCATED(HEAD_PTR) \
- { register head_record *h_ptr = (head_record *) (HEAD_PTR); \
- h_ptr->block_size &= ~HIGH_BIT_BAU_SIZE; \
- h_ptr->previous_block_size &= ~HIGH_BIT_BAU_SIZE; }
-
-/* Mark a block as free when it is not the first block in a bin (and
-** therefore not a node in the AVL tree). */
-#define MARK_SUCCESSIVE_BLOCK_IN_FREE_BIN(HEAD_PTR) \
- { register head_record *h_ptr = (head_record *) (HEAD_PTR); \
- h_ptr->block_size |= HIGH_BIT_BAU_SIZE; }
-
-/* Prototypes for internal functions implemented in one file and called in
-** another.
-*/
-
-void U(into_free_collection)(U(descriptor) *desc, head_record *head_ptr);
-
-void U(out_of_free_collection)(U(descriptor) *desc, head_record *head_ptr);
-
-void *U(alloc_from_bin)(
- U(descriptor) *desc, ptr_record *bin_front_ptr, U(size_bau) n_baus);
-
-#ifdef HMM_AUDIT_FAIL
-
-/* Simply contains a reference to the HMM_AUDIT_FAIL macro and a
-** dummy return. */
-int U(audit_block_fail_dummy_return)(void);
-
-
-/* Auditing a block consists of checking that the size in its head
-** matches the previous block size in the head of the next block. */
-#define AUDIT_BLOCK_AS_EXPR(HEAD_PTR) \
- ((BLOCK_BAUS(HEAD_PTR) == \
- PREV_BLOCK_BAUS(BAUS_FORWARD(HEAD_PTR, BLOCK_BAUS(HEAD_PTR)))) ? \
- 0 : U(audit_block_fail_dummy_return)())
-
-#define AUDIT_BLOCK(HEAD_PTR) \
- { void *h_ptr = (HEAD_PTR); AUDIT_BLOCK_AS_EXPR(h_ptr); }
-
-#endif
-
-/* Interface to AVL tree generic package instantiation. */
-
-#define AVL_UNIQUE(BASE) U(avl_ ## BASE)
-
-#define AVL_HANDLE ptr_record *
-
-#define AVL_KEY U(size_bau)
-
-#define AVL_MAX_DEPTH 64
-
-#include "cavl_if.h"
-
-#endif // VPX_MEM_MEMORY_MANAGER_INCLUDE_HMM_INTRNL_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.c b/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.c
deleted file mode 100644
index 059248b..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.c
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#define __VPX_MEM_C__
-
-#include "vpx_mem.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "include/vpx_mem_intrnl.h"
-
-#if CONFIG_MEM_TRACKER
-#ifndef VPX_NO_GLOBALS
-static unsigned long g_alloc_count = 0;
-#else
-#include "vpx_global_handling.h"
-#define g_alloc_count vpxglobalm(vpxmem,g_alloc_count)
-#endif
-#endif
-
-#if CONFIG_MEM_MANAGER
-# include "heapmm.h"
-# include "hmm_intrnl.h"
-
-# define SHIFT_HMM_ADDR_ALIGN_UNIT 5
-# define TOTAL_MEMORY_TO_ALLOCATE 20971520 /* 20 * 1024 * 1024 */
-
-# define MM_DYNAMIC_MEMORY 1
-# if MM_DYNAMIC_MEMORY
-static unsigned char *g_p_mng_memory_raw = NULL;
-static unsigned char *g_p_mng_memory = NULL;
-# else
-static unsigned char g_p_mng_memory[TOTAL_MEMORY_TO_ALLOCATE];
-# endif
-
-static size_t g_mm_memory_size = TOTAL_MEMORY_TO_ALLOCATE;
-
-static hmm_descriptor hmm_d;
-static int g_mng_memory_allocated = 0;
-
-static int vpx_mm_create_heap_memory();
-static void *vpx_mm_realloc(void *memblk, size_t size);
-#endif /*CONFIG_MEM_MANAGER*/
-
-#if USE_GLOBAL_FUNCTION_POINTERS
-struct GLOBAL_FUNC_POINTERS {
- g_malloc_func g_malloc;
- g_calloc_func g_calloc;
- g_realloc_func g_realloc;
- g_free_func g_free;
- g_memcpy_func g_memcpy;
- g_memset_func g_memset;
- g_memmove_func g_memmove;
-} *g_func = NULL;
-
-# define VPX_MALLOC_L g_func->g_malloc
-# define VPX_REALLOC_L g_func->g_realloc
-# define VPX_FREE_L g_func->g_free
-# define VPX_MEMCPY_L g_func->g_memcpy
-# define VPX_MEMSET_L g_func->g_memset
-# define VPX_MEMMOVE_L g_func->g_memmove
-#else
-# define VPX_MALLOC_L malloc
-# define VPX_REALLOC_L realloc
-# define VPX_FREE_L free
-# define VPX_MEMCPY_L memcpy
-# define VPX_MEMSET_L memset
-# define VPX_MEMMOVE_L memmove
-#endif /* USE_GLOBAL_FUNCTION_POINTERS */
-
-unsigned int vpx_mem_get_version() {
- unsigned int ver = ((unsigned int)(unsigned char)VPX_MEM_VERSION_CHIEF << 24 |
- (unsigned int)(unsigned char)VPX_MEM_VERSION_MAJOR << 16 |
- (unsigned int)(unsigned char)VPX_MEM_VERSION_MINOR << 8 |
- (unsigned int)(unsigned char)VPX_MEM_VERSION_PATCH);
- return ver;
-}
-
-int vpx_mem_set_heap_size(size_t size) {
- int ret = -1;
-
-#if CONFIG_MEM_MANAGER
-#if MM_DYNAMIC_MEMORY
-
- if (!g_mng_memory_allocated && size) {
- g_mm_memory_size = size;
- ret = 0;
- } else
- ret = -3;
-
-#else
- ret = -2;
-#endif
-#else
- (void)size;
-#endif
-
- return ret;
-}
-
-void *vpx_memalign(size_t align, size_t size) {
- void *addr,
- * x = NULL;
-
-#if CONFIG_MEM_MANAGER
- int number_aau;
-
- if (vpx_mm_create_heap_memory() < 0) {
- _P(printf("[vpx][mm] ERROR vpx_memalign() Couldn't create memory for Heap.\n");)
- }
-
- number_aau = ((size + align - 1 + ADDRESS_STORAGE_SIZE) >>
- SHIFT_HMM_ADDR_ALIGN_UNIT) + 1;
-
- addr = hmm_alloc(&hmm_d, number_aau);
-#else
- addr = VPX_MALLOC_L(size + align - 1 + ADDRESS_STORAGE_SIZE);
-#endif /*CONFIG_MEM_MANAGER*/
-
- if (addr) {
- x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, (int)align);
- /* save the actual malloc address */
- ((size_t *)x)[-1] = (size_t)addr;
- }
-
- return x;
-}
-
-void *vpx_malloc(size_t size) {
- return vpx_memalign(DEFAULT_ALIGNMENT, size);
-}
-
-void *vpx_calloc(size_t num, size_t size) {
- void *x;
-
- x = vpx_memalign(DEFAULT_ALIGNMENT, num * size);
-
- if (x)
- VPX_MEMSET_L(x, 0, num * size);
-
- return x;
-}
-
-void *vpx_realloc(void *memblk, size_t size) {
- void *addr,
- * new_addr = NULL;
- int align = DEFAULT_ALIGNMENT;
-
- /*
- The realloc() function changes the size of the object pointed to by
- ptr to the size specified by size, and returns a pointer to the
- possibly moved block. The contents are unchanged up to the lesser
- of the new and old sizes. If ptr is null, realloc() behaves like
- malloc() for the specified size. If size is zero (0) and ptr is
- not a null pointer, the object pointed to is freed.
- */
- if (!memblk)
- new_addr = vpx_malloc(size);
- else if (!size)
- vpx_free(memblk);
- else {
- addr = (void *)(((size_t *)memblk)[-1]);
- memblk = NULL;
-
-#if CONFIG_MEM_MANAGER
- new_addr = vpx_mm_realloc(addr, size + align + ADDRESS_STORAGE_SIZE);
-#else
- new_addr = VPX_REALLOC_L(addr, size + align + ADDRESS_STORAGE_SIZE);
-#endif
-
- if (new_addr) {
- addr = new_addr;
- new_addr = (void *)(((size_t)
- ((unsigned char *)new_addr + ADDRESS_STORAGE_SIZE) + (align - 1)) &
- (size_t) - align);
- /* save the actual malloc address */
- ((size_t *)new_addr)[-1] = (size_t)addr;
- }
- }
-
- return new_addr;
-}
-
-void vpx_free(void *memblk) {
- if (memblk) {
- void *addr = (void *)(((size_t *)memblk)[-1]);
-#if CONFIG_MEM_MANAGER
- hmm_free(&hmm_d, addr);
-#else
- VPX_FREE_L(addr);
-#endif
- }
-}
-
-#if CONFIG_MEM_TRACKER
-void *xvpx_memalign(size_t align, size_t size, char *file, int line) {
-#if TRY_BOUNDS_CHECK
- unsigned char *x_bounds;
-#endif
-
- void *x;
-
- if (g_alloc_count == 0) {
-#if TRY_BOUNDS_CHECK
- int i_rv = vpx_memory_tracker_init(BOUNDS_CHECK_PAD_SIZE, BOUNDS_CHECK_VALUE);
-#else
- int i_rv = vpx_memory_tracker_init(0, 0);
-#endif
-
- if (i_rv < 0) {
- _P(printf("ERROR xvpx_malloc MEM_TRACK_USAGE error vpx_memory_tracker_init().\n");)
- }
- }
-
-#if TRY_BOUNDS_CHECK
- {
- int i;
- unsigned int tempme = BOUNDS_CHECK_VALUE;
-
- x_bounds = vpx_memalign(align, size + (BOUNDS_CHECK_PAD_SIZE * 2));
-
- if (x_bounds) {
- /*we're aligning the address twice here but to keep things
- consistent we want to have the padding come before the stored
- address so no matter what free function gets called we will
- attempt to free the correct address*/
- x_bounds = (unsigned char *)(((size_t *)x_bounds)[-1]);
- x = align_addr(x_bounds + BOUNDS_CHECK_PAD_SIZE + ADDRESS_STORAGE_SIZE,
- (int)align);
- /* save the actual malloc address */
- ((size_t *)x)[-1] = (size_t)x_bounds;
-
- for (i = 0; i < BOUNDS_CHECK_PAD_SIZE; i += sizeof(unsigned int)) {
- VPX_MEMCPY_L(x_bounds + i, &tempme, sizeof(unsigned int));
- VPX_MEMCPY_L((unsigned char *)x + size + i,
- &tempme, sizeof(unsigned int));
- }
- } else
- x = NULL;
- }
-#else
- x = vpx_memalign(align, size);
-#endif /*TRY_BOUNDS_CHECK*/
-
- g_alloc_count++;
-
- vpx_memory_tracker_add((size_t)x, (unsigned int)size, file, line, 1);
-
- return x;
-}
-
-void *xvpx_malloc(size_t size, char *file, int line) {
- return xvpx_memalign(DEFAULT_ALIGNMENT, size, file, line);
-}
-
-void *xvpx_calloc(size_t num, size_t size, char *file, int line) {
- void *x = xvpx_memalign(DEFAULT_ALIGNMENT, num * size, file, line);
-
- if (x)
- VPX_MEMSET_L(x, 0, num * size);
-
- return x;
-}
-
-void *xvpx_realloc(void *memblk, size_t size, char *file, int line) {
- struct mem_block *p = NULL;
- int orig_size = 0,
- orig_line = 0;
- char *orig_file = NULL;
-
-#if TRY_BOUNDS_CHECK
- unsigned char *x_bounds = memblk ?
- (unsigned char *)(((size_t *)memblk)[-1]) :
- NULL;
-#endif
-
- void *x;
-
- if (g_alloc_count == 0) {
-#if TRY_BOUNDS_CHECK
-
- if (!vpx_memory_tracker_init(BOUNDS_CHECK_PAD_SIZE, BOUNDS_CHECK_VALUE))
-#else
- if (!vpx_memory_tracker_init(0, 0))
-#endif
- {
- _P(printf("ERROR xvpx_malloc MEM_TRACK_USAGE error vpx_memory_tracker_init().\n");)
- }
- }
-
- if ((p = vpx_memory_tracker_find((size_t)memblk))) {
- orig_size = p->size;
- orig_file = p->file;
- orig_line = p->line;
- }
-
-#if TRY_BOUNDS_CHECK_ON_FREE
- vpx_memory_tracker_check_integrity(file, line);
-#endif
-
- /* have to do this regardless of success, because
- * the memory that does get realloc'd may change
- * the bounds values of this block
- */
- vpx_memory_tracker_remove((size_t)memblk);
-
-#if TRY_BOUNDS_CHECK
- {
- int i;
- unsigned int tempme = BOUNDS_CHECK_VALUE;
-
- x_bounds = vpx_realloc(memblk, size + (BOUNDS_CHECK_PAD_SIZE * 2));
-
- if (x_bounds) {
- x_bounds = (unsigned char *)(((size_t *)x_bounds)[-1]);
- x = align_addr(x_bounds + BOUNDS_CHECK_PAD_SIZE + ADDRESS_STORAGE_SIZE,
- (int)DEFAULT_ALIGNMENT);
- /* save the actual malloc address */
- ((size_t *)x)[-1] = (size_t)x_bounds;
-
- for (i = 0; i < BOUNDS_CHECK_PAD_SIZE; i += sizeof(unsigned int)) {
- VPX_MEMCPY_L(x_bounds + i, &tempme, sizeof(unsigned int));
- VPX_MEMCPY_L((unsigned char *)x + size + i,
- &tempme, sizeof(unsigned int));
- }
- } else
- x = NULL;
- }
-#else
- x = vpx_realloc(memblk, size);
-#endif /*TRY_BOUNDS_CHECK*/
-
- if (!memblk) ++g_alloc_count;
-
- if (x)
- vpx_memory_tracker_add((size_t)x, (unsigned int)size, file, line, 1);
- else
- vpx_memory_tracker_add((size_t)memblk, orig_size, orig_file, orig_line, 1);
-
- return x;
-}
-
-void xvpx_free(void *p_address, char *file, int line) {
-#if TRY_BOUNDS_CHECK
- unsigned char *p_bounds_address = (unsigned char *)p_address;
- /*p_bounds_address -= BOUNDS_CHECK_PAD_SIZE;*/
-#endif
-
-#if !TRY_BOUNDS_CHECK_ON_FREE
- (void)file;
- (void)line;
-#endif
-
- if (p_address) {
-#if TRY_BOUNDS_CHECK_ON_FREE
- vpx_memory_tracker_check_integrity(file, line);
-#endif
-
- /* if the addr isn't found in the list, assume it was allocated via
- * vpx_ calls not xvpx_, therefore it does not contain any padding
- */
- if (vpx_memory_tracker_remove((size_t)p_address) == -2) {
- p_bounds_address = p_address;
- _P(fprintf(stderr, "[vpx_mem][xvpx_free] addr: %p not found in"
- " list; freed from file:%s"
- " line:%d\n", p_address, file, line));
- } else
- --g_alloc_count;
-
-#if TRY_BOUNDS_CHECK
- vpx_free(p_bounds_address);
-#else
- vpx_free(p_address);
-#endif
-
- if (!g_alloc_count)
- vpx_memory_tracker_destroy();
- }
-}
-
-#endif /*CONFIG_MEM_TRACKER*/
-
-#if CONFIG_MEM_CHECKS
-#if defined(VXWORKS)
-#include <task_lib.h> /*for task_delay()*/
-/* This function is only used to get a stack trace of the player
-object so we can se where we are having a problem. */
-static int get_my_tt(int task) {
- tt(task);
-
- return 0;
-}
-
-static void vx_sleep(int msec) {
- int ticks_to_sleep = 0;
-
- if (msec) {
- int msec_per_tick = 1000 / sys_clk_rate_get();
-
- if (msec < msec_per_tick)
- ticks_to_sleep++;
- else
- ticks_to_sleep = msec / msec_per_tick;
- }
-
- task_delay(ticks_to_sleep);
-}
-#endif
-#endif
-
-void *vpx_memcpy(void *dest, const void *source, size_t length) {
-#if CONFIG_MEM_CHECKS
-
- if (((int)dest < 0x4000) || ((int)source < 0x4000)) {
- _P(printf("WARNING: vpx_memcpy dest:0x%x source:0x%x len:%d\n", (int)dest, (int)source, length);)
-
-#if defined(VXWORKS)
- sp(get_my_tt, task_id_self(), 0, 0, 0, 0, 0, 0, 0, 0);
-
- vx_sleep(10000);
-#endif
- }
-
-#endif
-
- return VPX_MEMCPY_L(dest, source, length);
-}
-
-void *vpx_memset(void *dest, int val, size_t length) {
-#if CONFIG_MEM_CHECKS
-
- if ((int)dest < 0x4000) {
- _P(printf("WARNING: vpx_memset dest:0x%x val:%d len:%d\n", (int)dest, val, length);)
-
-#if defined(VXWORKS)
- sp(get_my_tt, task_id_self(), 0, 0, 0, 0, 0, 0, 0, 0);
-
- vx_sleep(10000);
-#endif
- }
-
-#endif
-
- return VPX_MEMSET_L(dest, val, length);
-}
-
-void *vpx_memmove(void *dest, const void *src, size_t count) {
-#if CONFIG_MEM_CHECKS
-
- if (((int)dest < 0x4000) || ((int)src < 0x4000)) {
- _P(printf("WARNING: vpx_memmove dest:0x%x src:0x%x count:%d\n", (int)dest, (int)src, count);)
-
-#if defined(VXWORKS)
- sp(get_my_tt, task_id_self(), 0, 0, 0, 0, 0, 0, 0, 0);
-
- vx_sleep(10000);
-#endif
- }
-
-#endif
-
- return VPX_MEMMOVE_L(dest, src, count);
-}
-
-#if CONFIG_MEM_MANAGER
-
-static int vpx_mm_create_heap_memory() {
- int i_rv = 0;
-
- if (!g_mng_memory_allocated) {
-#if MM_DYNAMIC_MEMORY
- g_p_mng_memory_raw =
- (unsigned char *)malloc(g_mm_memory_size + HMM_ADDR_ALIGN_UNIT);
-
- if (g_p_mng_memory_raw) {
- g_p_mng_memory = (unsigned char *)((((unsigned int)g_p_mng_memory_raw) +
- HMM_ADDR_ALIGN_UNIT - 1) &
- -(int)HMM_ADDR_ALIGN_UNIT);
-
- _P(printf("[vpx][mm] total memory size:%d g_p_mng_memory_raw:0x%x g_p_mng_memory:0x%x\n"
-, g_mm_memory_size + HMM_ADDR_ALIGN_UNIT
-, (unsigned int)g_p_mng_memory_raw
-, (unsigned int)g_p_mng_memory);)
- } else {
- _P(printf("[vpx][mm] Couldn't allocate memory:%d for vpx memory manager.\n"
-, g_mm_memory_size);)
-
- i_rv = -1;
- }
-
- if (g_p_mng_memory)
-#endif
- {
- int chunk_size = 0;
-
- g_mng_memory_allocated = 1;
-
- hmm_init(&hmm_d);
-
- chunk_size = g_mm_memory_size >> SHIFT_HMM_ADDR_ALIGN_UNIT;
-
- chunk_size -= DUMMY_END_BLOCK_BAUS;
-
- _P(printf("[vpx][mm] memory size:%d for vpx memory manager. g_p_mng_memory:0x%x chunk_size:%d\n"
-, g_mm_memory_size
-, (unsigned int)g_p_mng_memory
-, chunk_size);)
-
- hmm_new_chunk(&hmm_d, (void *)g_p_mng_memory, chunk_size);
- }
-
-#if MM_DYNAMIC_MEMORY
- else {
- _P(printf("[vpx][mm] Couldn't allocate memory:%d for vpx memory manager.\n"
-, g_mm_memory_size);)
-
- i_rv = -1;
- }
-
-#endif
- }
-
- return i_rv;
-}
-
-static void *vpx_mm_realloc(void *memblk, size_t size) {
- void *p_ret = NULL;
-
- if (vpx_mm_create_heap_memory() < 0) {
- _P(printf("[vpx][mm] ERROR vpx_mm_realloc() Couldn't create memory for Heap.\n");)
- } else {
- int i_rv = 0;
- int old_num_aaus;
- int new_num_aaus;
-
- old_num_aaus = hmm_true_size(memblk);
- new_num_aaus = (size >> SHIFT_HMM_ADDR_ALIGN_UNIT) + 1;
-
- if (old_num_aaus == new_num_aaus) {
- p_ret = memblk;
- } else {
- i_rv = hmm_resize(&hmm_d, memblk, new_num_aaus);
-
- if (i_rv == 0) {
- p_ret = memblk;
- } else {
- /* Error. Try to malloc and then copy data. */
- void *p_from_malloc;
-
- new_num_aaus = (size >> SHIFT_HMM_ADDR_ALIGN_UNIT) + 1;
- p_from_malloc = hmm_alloc(&hmm_d, new_num_aaus);
-
- if (p_from_malloc) {
- vpx_memcpy(p_from_malloc, memblk, size);
- hmm_free(&hmm_d, memblk);
-
- p_ret = p_from_malloc;
- }
- }
- }
- }
-
- return p_ret;
-}
-#endif /*CONFIG_MEM_MANAGER*/
-
-#if USE_GLOBAL_FUNCTION_POINTERS
-# if CONFIG_MEM_TRACKER
-extern int vpx_memory_tracker_set_functions(g_malloc_func g_malloc_l
-, g_calloc_func g_calloc_l
-, g_realloc_func g_realloc_l
-, g_free_func g_free_l
-, g_memcpy_func g_memcpy_l
-, g_memset_func g_memset_l
-, g_memmove_func g_memmove_l);
-# endif
-#endif /*USE_GLOBAL_FUNCTION_POINTERS*/
-int vpx_mem_set_functions(g_malloc_func g_malloc_l
-, g_calloc_func g_calloc_l
-, g_realloc_func g_realloc_l
-, g_free_func g_free_l
-, g_memcpy_func g_memcpy_l
-, g_memset_func g_memset_l
-, g_memmove_func g_memmove_l) {
-#if USE_GLOBAL_FUNCTION_POINTERS
-
- /* If use global functions is turned on then the
- application must set the global functions before
- it does anything else or vpx_mem will have
- unpredictable results. */
- if (!g_func) {
- g_func = (struct GLOBAL_FUNC_POINTERS *)
- g_malloc_l(sizeof(struct GLOBAL_FUNC_POINTERS));
-
- if (!g_func) {
- return -1;
- }
- }
-
-#if CONFIG_MEM_TRACKER
- {
- int rv = 0;
- rv = vpx_memory_tracker_set_functions(g_malloc_l
-, g_calloc_l
-, g_realloc_l
-, g_free_l
-, g_memcpy_l
-, g_memset_l
-, g_memmove_l);
-
- if (rv < 0) {
- return rv;
- }
- }
-#endif
-
- g_func->g_malloc = g_malloc_l;
- g_func->g_calloc = g_calloc_l;
- g_func->g_realloc = g_realloc_l;
- g_func->g_free = g_free_l;
- g_func->g_memcpy = g_memcpy_l;
- g_func->g_memset = g_memset_l;
- g_func->g_memmove = g_memmove_l;
-
- return 0;
-#else
- (void)g_malloc_l;
- (void)g_calloc_l;
- (void)g_realloc_l;
- (void)g_free_l;
- (void)g_memcpy_l;
- (void)g_memset_l;
- (void)g_memmove_l;
- return -1;
-#endif
-}
-
-int vpx_mem_unset_functions() {
-#if USE_GLOBAL_FUNCTION_POINTERS
-
- if (g_func) {
- g_free_func temp_free = g_func->g_free;
- temp_free(g_func);
- g_func = NULL;
- }
-
-#endif
- return 0;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.h b/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.h
deleted file mode 100644
index 33686b2..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_MEM_VPX_MEM_H_
-#define VPX_MEM_VPX_MEM_H_
-
-#include "vpx_config.h"
-#if defined(__uClinux__)
-# include <lddk.h>
-#endif
-
-/* vpx_mem version info */
-#define vpx_mem_version "2.2.1.5"
-
-#define VPX_MEM_VERSION_CHIEF 2
-#define VPX_MEM_VERSION_MAJOR 2
-#define VPX_MEM_VERSION_MINOR 1
-#define VPX_MEM_VERSION_PATCH 5
-/* end - vpx_mem version info */
-
-#ifndef VPX_TRACK_MEM_USAGE
-# define VPX_TRACK_MEM_USAGE 0 /* enable memory tracking/integrity checks */
-#endif
-#ifndef VPX_CHECK_MEM_FUNCTIONS
-# define VPX_CHECK_MEM_FUNCTIONS 0 /* enable basic safety checks in _memcpy,
-_memset, and _memmove */
-#endif
-#ifndef REPLACE_BUILTIN_FUNCTIONS
-# define REPLACE_BUILTIN_FUNCTIONS 0 /* replace builtin functions with their
-vpx_ equivalents */
-#endif
-
-#include <stdlib.h>
-#include <stddef.h>
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
- /*
- vpx_mem_get_version()
- provided for runtime version checking. Returns an unsigned int of the form
- CHIEF | MAJOR | MINOR | PATCH, where the chief version number is the high
- order byte.
- */
- unsigned int vpx_mem_get_version(void);
-
- /*
- vpx_mem_set_heap_size(size_t size)
- size - size in bytes for the memory manager to allocate for its heap
- Sets the memory manager's initial heap size
- Return:
- 0: on success
- -1: if memory manager calls have not been included in the vpx_mem lib
- -2: if the memory manager has been compiled to use static memory
- -3: if the memory manager has already allocated its heap
- */
- int vpx_mem_set_heap_size(size_t size);
-
- void *vpx_memalign(size_t align, size_t size);
- void *vpx_malloc(size_t size);
- void *vpx_calloc(size_t num, size_t size);
- void *vpx_realloc(void *memblk, size_t size);
- void vpx_free(void *memblk);
-
- void *vpx_memcpy(void *dest, const void *src, size_t length);
- void *vpx_memset(void *dest, int val, size_t length);
- void *vpx_memmove(void *dest, const void *src, size_t count);
-
- /* special memory functions */
- void *vpx_mem_alloc(int id, size_t size, size_t align);
- void vpx_mem_free(int id, void *mem, size_t size);
-
- /* Wrappers to standard library functions. */
- typedef void *(* g_malloc_func)(size_t);
- typedef void *(* g_calloc_func)(size_t, size_t);
- typedef void *(* g_realloc_func)(void *, size_t);
- typedef void (* g_free_func)(void *);
- typedef void *(* g_memcpy_func)(void *, const void *, size_t);
- typedef void *(* g_memset_func)(void *, int, size_t);
- typedef void *(* g_memmove_func)(void *, const void *, size_t);
-
- int vpx_mem_set_functions(g_malloc_func g_malloc_l
-, g_calloc_func g_calloc_l
-, g_realloc_func g_realloc_l
-, g_free_func g_free_l
-, g_memcpy_func g_memcpy_l
-, g_memset_func g_memset_l
-, g_memmove_func g_memmove_l);
- int vpx_mem_unset_functions(void);
-
-
- /* some defines for backward compatibility */
-#define DMEM_GENERAL 0
-
-// (*)<
-
-#if REPLACE_BUILTIN_FUNCTIONS
-# ifndef __VPX_MEM_C__
-# define memalign vpx_memalign
-# define malloc vpx_malloc
-# define calloc vpx_calloc
-# define realloc vpx_realloc
-# define free vpx_free
-# define memcpy vpx_memcpy
-# define memmove vpx_memmove
-# define memset vpx_memset
-# endif
-#endif
-
-#if CONFIG_MEM_TRACKER
-#include <stdarg.h>
- /*from vpx_mem/vpx_mem_tracker.c*/
- extern void vpx_memory_tracker_dump();
- extern void vpx_memory_tracker_check_integrity(char *file, unsigned int line);
- extern int vpx_memory_tracker_set_log_type(int type, char *option);
- extern int vpx_memory_tracker_set_log_func(void *userdata,
- void(*logfunc)(void *userdata,
- const char *fmt, va_list args));
-# ifndef __VPX_MEM_C__
-# define vpx_memalign(align, size) xvpx_memalign((align), (size), __FILE__, __LINE__)
-# define vpx_malloc(size) xvpx_malloc((size), __FILE__, __LINE__)
-# define vpx_calloc(num, size) xvpx_calloc(num, size, __FILE__, __LINE__)
-# define vpx_realloc(addr, size) xvpx_realloc(addr, size, __FILE__, __LINE__)
-# define vpx_free(addr) xvpx_free(addr, __FILE__, __LINE__)
-# define vpx_memory_tracker_check_integrity() vpx_memory_tracker_check_integrity(__FILE__, __LINE__)
-# define vpx_mem_alloc(id,size,align) xvpx_mem_alloc(id, size, align, __FILE__, __LINE__)
-# define vpx_mem_free(id,mem,size) xvpx_mem_free(id, mem, size, __FILE__, __LINE__)
-# endif
-
- void *xvpx_memalign(size_t align, size_t size, char *file, int line);
- void *xvpx_malloc(size_t size, char *file, int line);
- void *xvpx_calloc(size_t num, size_t size, char *file, int line);
- void *xvpx_realloc(void *memblk, size_t size, char *file, int line);
- void xvpx_free(void *memblk, char *file, int line);
- void *xvpx_mem_alloc(int id, size_t size, size_t align, char *file, int line);
- void xvpx_mem_free(int id, void *mem, size_t size, char *file, int line);
-
-#else
-# ifndef __VPX_MEM_C__
-# define vpx_memory_tracker_dump()
-# define vpx_memory_tracker_check_integrity()
-# define vpx_memory_tracker_set_log_type(t,o) 0
-# define vpx_memory_tracker_set_log_func(u,f) 0
-# endif
-#endif
-
-#if !VPX_CHECK_MEM_FUNCTIONS
-# ifndef __VPX_MEM_C__
-# include <string.h>
-# define vpx_memcpy memcpy
-# define vpx_memset memset
-# define vpx_memmove memmove
-# endif
-#endif
-
-#ifdef VPX_MEM_PLTFRM
-# include VPX_MEM_PLTFRM
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif // VPX_MEM_VPX_MEM_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.mk b/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.mk
deleted file mode 100644
index 4663c5a..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-MEM_SRCS-yes += vpx_mem.mk
-MEM_SRCS-yes += vpx_mem.c
-MEM_SRCS-yes += vpx_mem.h
-MEM_SRCS-yes += include/vpx_mem_intrnl.h
-
-MEM_SRCS-$(CONFIG_MEM_TRACKER) += vpx_mem_tracker.c
-MEM_SRCS-$(CONFIG_MEM_TRACKER) += include/vpx_mem_tracker.h
-
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_true.c
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_resize.c
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_shrink.c
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_largest.c
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_dflt_abort.c
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_base.c
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/include
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/include/hmm_intrnl.h
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/include/cavl_if.h
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/include/hmm_cnfg.h
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/include/heapmm.h
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/include/cavl_impl.h
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_grow.c
-MEM_SRCS-$(CONFIG_MEM_MANAGER) += memory_manager/hmm_alloc.c
diff --git a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem_tracker.c b/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem_tracker.c
deleted file mode 100644
index 613e8a1..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_mem/vpx_mem_tracker.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/*
- vpx_mem_tracker.c
-
- jwz 2003-09-30:
- Stores a list of addreses, their size, and file and line they came from.
- All exposed lib functions are prefaced by vpx_ and allow the global list
- to be thread safe.
- Current supported platforms are:
- Linux, Win32, win_ce and vx_works
- Further support can be added by defining the platform specific mutex
- in the memory_tracker struct as well as calls to create/destroy/lock/unlock
- the mutex in vpx_memory_tracker_init/Destroy and memory_tracker_lock_mutex/unlock_mutex
-*/
-#include "./vpx_config.h"
-
-#if defined(__uClinux__)
-# include <lddk.h>
-#endif
-
-#if HAVE_PTHREAD_H
-# include <pthread.h>
-#elif defined(WIN32) || defined(_WIN32_WCE)
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# include <winbase.h>
-#elif defined(VXWORKS)
-# include <sem_lib.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h> // VXWORKS doesn't have a malloc/memory.h file,
-// this should pull in malloc,free,etc.
-#include <stdarg.h>
-
-#include "include/vpx_mem_tracker.h"
-
-#undef vpx_malloc // undefine any vpx_mem macros that may affect calls to
-#undef vpx_free // memory functions in this file
-#undef vpx_memcpy
-#undef vpx_memset
-
-
-#ifndef USE_GLOBAL_FUNCTION_POINTERS
-# define USE_GLOBAL_FUNCTION_POINTERS 0 // use function pointers instead of compiled functions.
-#endif
-
-#if USE_GLOBAL_FUNCTION_POINTERS
-static mem_track_malloc_func g_malloc = malloc;
-static mem_track_calloc_func g_calloc = calloc;
-static mem_track_realloc_func g_realloc = realloc;
-static mem_track_free_func g_free = free;
-static mem_track_memcpy_func g_memcpy = memcpy;
-static mem_track_memset_func g_memset = memset;
-static mem_track_memmove_func g_memmove = memmove;
-# define MEM_TRACK_MALLOC g_malloc
-# define MEM_TRACK_FREE g_free
-# define MEM_TRACK_MEMCPY g_memcpy
-# define MEM_TRACK_MEMSET g_memset
-#else
-# define MEM_TRACK_MALLOC vpx_malloc
-# define MEM_TRACK_FREE vpx_free
-# define MEM_TRACK_MEMCPY vpx_memcpy
-# define MEM_TRACK_MEMSET vpx_memset
-#endif // USE_GLOBAL_FUNCTION_POINTERS
-
-/* prototypes for internal library functions */
-static void memtrack_log(const char *fmt, ...);
-static void memory_tracker_dump();
-static void memory_tracker_check_integrity(char *file, unsigned int line);
-static void memory_tracker_add(size_t addr, unsigned int size,
- char *file, unsigned int line,
- int padded);
-static int memory_tracker_remove(size_t addr);
-static struct mem_block *memory_tracker_find(size_t addr);
-
-#if defined(NO_MUTEX)
-# define memory_tracker_lock_mutex() (!g_b_mem_tracker_inited)
-# define memory_tracker_unlock_mutex()
-#else
-static int memory_tracker_lock_mutex();
-static int memory_tracker_unlock_mutex();
-#endif
-
-#ifndef VPX_NO_GLOBALS
-struct memory_tracker {
- struct mem_block *head,
- * tail;
- int len,
- totalsize;
- unsigned int current_allocated,
- max_allocated;
-
-#if HAVE_PTHREAD_H
- pthread_mutex_t mutex;
-#elif defined(WIN32) || defined(_WIN32_WCE)
- HANDLE mutex;
-#elif defined(VXWORKS)
- SEM_ID mutex;
-#elif defined(NO_MUTEX)
-#else
-#error "No mutex type defined for this platform!"
-#endif
-
- int padding_size,
- pad_value;
-};
-
-static struct memory_tracker memtrack; // our global memory allocation list
-static int g_b_mem_tracker_inited = 0; // indicates whether the global list has
-// been initialized (1:yes/0:no)
-static struct {
- FILE *file;
- int type;
- void (*func)(void *userdata, const char *fmt, va_list args);
- void *userdata;
-} g_logging = {NULL, 0, NULL, NULL};
-#else
-# include "vpx_global_handling.h"
-#define g_b_mem_tracker_inited vpxglobalm(vpxmem,g_b_mem_tracker_inited)
-#define g_logging vpxglobalm(vpxmem,g_logging)
-#define memtrack vpxglobalm(vpxmem,memtrack)
-#endif // #ifndef VPX_NO_GLOBALS
-
-extern void *vpx_malloc(size_t size);
-extern void vpx_free(void *memblk);
-extern void *vpx_memcpy(void *dest, const void *src, size_t length);
-extern void *vpx_memset(void *dest, int val, size_t length);
-
-/*
- *
- * Exposed library functions
- *
-*/
-
-/*
- vpx_memory_tracker_init(int padding_size, int pad_value)
- padding_size - the size of the padding before and after each mem addr.
- Values > 0 indicate that integrity checks can be performed
- by inspecting these areas.
- pad_value - the initial value within the padding area before and after
- each mem addr.
-
- Initializes global memory tracker structure
- Allocates the head of the list
-*/
-int vpx_memory_tracker_init(int padding_size, int pad_value) {
- if (!g_b_mem_tracker_inited) {
- if ((memtrack.head = (struct mem_block *)
- MEM_TRACK_MALLOC(sizeof(struct mem_block)))) {
- int ret;
-
- MEM_TRACK_MEMSET(memtrack.head, 0, sizeof(struct mem_block));
-
- memtrack.tail = memtrack.head;
-
- memtrack.current_allocated = 0;
- memtrack.max_allocated = 0;
-
- memtrack.padding_size = padding_size;
- memtrack.pad_value = pad_value;
-
-#if HAVE_PTHREAD_H
- ret = pthread_mutex_init(&memtrack.mutex,
- NULL); /*mutex attributes (NULL=default)*/
-#elif defined(WIN32) || defined(_WIN32_WCE)
- memtrack.mutex = CreateMutex(NULL, /*security attributes*/
- FALSE, /*we don't want initial ownership*/
- NULL); /*mutex name*/
- ret = !memtrack.mutex;
-#elif defined(VXWORKS)
- memtrack.mutex = sem_bcreate(SEM_Q_FIFO, /*SEM_Q_FIFO non-priority based mutex*/
- SEM_FULL); /*SEM_FULL initial state is unlocked*/
- ret = !memtrack.mutex;
-#elif defined(NO_MUTEX)
- ret = 0;
-#endif
-
- if (ret) {
- memtrack_log("vpx_memory_tracker_init: Error creating mutex!\n");
-
- MEM_TRACK_FREE(memtrack.head);
- memtrack.head = NULL;
- } else {
- memtrack_log("Memory Tracker init'd, v."vpx_mem_tracker_version" pad_size:%d pad_val:0x%x %d\n"
-, padding_size
-, pad_value
-, pad_value);
- g_b_mem_tracker_inited = 1;
- }
- }
- }
-
- return g_b_mem_tracker_inited;
-}
-
-/*
- vpx_memory_tracker_destroy()
- If our global struct was initialized zeros out all its members,
- frees memory and destroys it's mutex
-*/
-void vpx_memory_tracker_destroy() {
- if (!memory_tracker_lock_mutex()) {
- struct mem_block *p = memtrack.head,
- * p2 = memtrack.head;
-
- memory_tracker_dump();
-
- while (p) {
- p2 = p;
- p = p->next;
-
- MEM_TRACK_FREE(p2);
- }
-
- memtrack.head = NULL;
- memtrack.tail = NULL;
- memtrack.len = 0;
- memtrack.current_allocated = 0;
- memtrack.max_allocated = 0;
-
- if (!g_logging.type && g_logging.file && g_logging.file != stderr) {
- fclose(g_logging.file);
- g_logging.file = NULL;
- }
-
- memory_tracker_unlock_mutex();
-
- g_b_mem_tracker_inited = 0;
- }
-}
-
-/*
- vpx_memory_tracker_add(size_t addr, unsigned int size,
- char * file, unsigned int line)
- addr - memory address to be added to list
- size - size of addr
- file - the file addr was referenced from
- line - the line in file addr was referenced from
- Adds memory address addr, it's size, file and line it came from
- to the global list via the thread safe internal library function
-*/
-void vpx_memory_tracker_add(size_t addr, unsigned int size,
- char *file, unsigned int line,
- int padded) {
- memory_tracker_add(addr, size, file, line, padded);
-}
-
-/*
- vpx_memory_tracker_remove(size_t addr)
- addr - memory address to be removed from list
- Removes addr from the global list via the thread safe
- internal remove function
- Return:
- Same as described for memory_tracker_remove
-*/
-int vpx_memory_tracker_remove(size_t addr) {
- return memory_tracker_remove(addr);
-}
-
-/*
- vpx_memory_tracker_find(size_t addr)
- addr - address to be found in list
- Return:
- If found, pointer to the memory block that matches addr
- NULL otherwise
-*/
-struct mem_block *vpx_memory_tracker_find(size_t addr) {
- struct mem_block *p = NULL;
-
- if (!memory_tracker_lock_mutex()) {
- p = memory_tracker_find(addr);
- memory_tracker_unlock_mutex();
- }
-
- return p;
-}
-
-/*
- vpx_memory_tracker_dump()
- Locks the memory tracker's mutex and calls the internal
- library function to dump the current contents of the
- global memory allocation list
-*/
-void vpx_memory_tracker_dump() {
- if (!memory_tracker_lock_mutex()) {
- memory_tracker_dump();
- memory_tracker_unlock_mutex();
- }
-}
-
-/*
- vpx_memory_tracker_check_integrity(char* file, unsigned int line)
- file - The file name where the check was placed
- line - The line in file where the check was placed
- Locks the memory tracker's mutex and calls the internal
- integrity check function to inspect every address in the global
- memory allocation list
-*/
-void vpx_memory_tracker_check_integrity(char *file, unsigned int line) {
- if (!memory_tracker_lock_mutex()) {
- memory_tracker_check_integrity(file, line);
- memory_tracker_unlock_mutex();
- }
-}
-
-/*
- vpx_memory_tracker_set_log_type
- Sets the logging type for the memory tracker. Based on the value it will
- direct its output to the appropriate place.
- Return:
- 0: on success
- -1: if the logging type could not be set, because the value was invalid
- or because a file could not be opened
-*/
-int vpx_memory_tracker_set_log_type(int type, char *option) {
- int ret = -1;
-
- switch (type) {
- case 0:
- g_logging.type = 0;
-
- if (!option) {
- g_logging.file = stderr;
- ret = 0;
- } else {
- if ((g_logging.file = fopen((char *)option, "w")))
- ret = 0;
- }
-
- break;
-#if defined(WIN32) && !defined(_WIN32_WCE)
- case 1:
- g_logging.type = type;
- ret = 0;
- break;
-#endif
- default:
- break;
- }
-
- // output the version to the new logging destination
- if (!ret)
- memtrack_log("Memory Tracker logging initialized, "
- "Memory Tracker v."vpx_mem_tracker_version"\n");
-
- return ret;
-}
-
-/*
- vpx_memory_tracker_set_log_func
- Sets a logging function to be used by the memory tracker.
- Return:
- 0: on success
- -1: if the logging type could not be set because logfunc was NULL
-*/
-int vpx_memory_tracker_set_log_func(void *userdata,
- void(*logfunc)(void *userdata,
- const char *fmt, va_list args)) {
- int ret = -1;
-
- if (logfunc) {
- g_logging.type = -1;
- g_logging.userdata = userdata;
- g_logging.func = logfunc;
- ret = 0;
- }
-
- // output the version to the new logging destination
- if (!ret)
- memtrack_log("Memory Tracker logging initialized, "
- "Memory Tracker v."vpx_mem_tracker_version"\n");
-
- return ret;
-}
-
-/*
- *
- * END - Exposed library functions
- *
-*/
-
-
-/*
- *
- * Internal library functions
- *
-*/
-
-static void memtrack_log(const char *fmt, ...) {
- va_list list;
-
- va_start(list, fmt);
-
- switch (g_logging.type) {
- case -1:
-
- if (g_logging.func)
- g_logging.func(g_logging.userdata, fmt, list);
-
- break;
- case 0:
-
- if (g_logging.file) {
- vfprintf(g_logging.file, fmt, list);
- fflush(g_logging.file);
- }
-
- break;
-#if defined(WIN32) && !defined(_WIN32_WCE)
- case 1: {
- char temp[1024];
- _vsnprintf(temp, sizeof(temp) / sizeof(char) - 1, fmt, list);
- OutputDebugString(temp);
- }
- break;
-#endif
- default:
- break;
- }
-
- va_end(list);
-}
-
-/*
- memory_tracker_dump()
- Dumps the current contents of the global memory allocation list
-*/
-static void memory_tracker_dump() {
- int i = 0;
- struct mem_block *p = (memtrack.head ? memtrack.head->next : NULL);
-
- memtrack_log("\n_currently Allocated= %d; Max allocated= %d\n",
- memtrack.current_allocated, memtrack.max_allocated);
-
- while (p) {
-#if defined(WIN32) && !defined(_WIN32_WCE)
-
- /*when using outputdebugstring, output filenames so they
- can be clicked to be opened in visual studio*/
- if (g_logging.type == 1)
- memtrack_log("memblocks[%d].addr= 0x%.8x, memblocks[%d].size= %d, file:\n"
- " %s(%d):\n", i,
- p->addr, i, p->size,
- p->file, p->line);
- else
-#endif
- memtrack_log("memblocks[%d].addr= 0x%.8x, memblocks[%d].size= %d, file: %s, line: %d\n", i,
- p->addr, i, p->size,
- p->file, p->line);
-
- p = p->next;
- ++i;
- }
-
- memtrack_log("\n");
-}
-
-/*
- memory_tracker_check_integrity(char* file, unsigned int file)
- file - the file name where the check was placed
- line - the line in file where the check was placed
- If a padding_size was supplied to vpx_memory_tracker_init()
- this function will check ea. addr in the list verifying that
- addr-padding_size and addr+padding_size is filled with pad_value
-*/
-static void memory_tracker_check_integrity(char *file, unsigned int line) {
- if (memtrack.padding_size) {
- int i,
- index = 0;
- unsigned char *p_show_me,
- * p_show_me2;
- unsigned int tempme = memtrack.pad_value,
- dead1,
- dead2;
- unsigned char *x_bounds;
- struct mem_block *p = memtrack.head->next;
-
- while (p) {
- // x_bounds = (unsigned char*)p->addr;
- // back up VPX_BYTE_ALIGNMENT
- // x_bounds -= memtrack.padding_size;
-
- if (p->padded) { // can the bounds be checked?
- /*yes, move to the address that was actually allocated
- by the vpx_* calls*/
- x_bounds = (unsigned char *)(((size_t *)p->addr)[-1]);
-
- for (i = 0; i < memtrack.padding_size; i += sizeof(unsigned int)) {
- p_show_me = (x_bounds + i);
- p_show_me2 = (unsigned char *)(p->addr + p->size + i);
-
- MEM_TRACK_MEMCPY(&dead1, p_show_me, sizeof(unsigned int));
- MEM_TRACK_MEMCPY(&dead2, p_show_me2, sizeof(unsigned int));
-
- if ((dead1 != tempme) || (dead2 != tempme)) {
- memtrack_log("\n[vpx_mem integrity check failed]:\n"
- " index[%d,%d] {%s:%d} addr=0x%x, size=%d,"
- " file: %s, line: %d c0:0x%x c1:0x%x\n",
- index, i, file, line, p->addr, p->size, p->file,
- p->line, dead1, dead2);
- }
- }
- }
-
- ++index;
- p = p->next;
- }
- }
-}
-
-/*
- memory_tracker_add(size_t addr, unsigned int size,
- char * file, unsigned int line)
- Adds an address (addr), it's size, file and line number to our list.
- Adjusts the total bytes allocated and max bytes allocated if necessary.
- If memory cannot be allocated the list will be destroyed.
-*/
-void memory_tracker_add(size_t addr, unsigned int size,
- char *file, unsigned int line,
- int padded) {
- if (!memory_tracker_lock_mutex()) {
- struct mem_block *p;
-
- p = MEM_TRACK_MALLOC(sizeof(struct mem_block));
-
- if (p) {
- p->prev = memtrack.tail;
- p->prev->next = p;
- p->addr = addr;
- p->size = size;
- p->line = line;
- p->file = file;
- p->padded = padded;
- p->next = NULL;
-
- memtrack.tail = p;
-
- memtrack.current_allocated += size;
-
- if (memtrack.current_allocated > memtrack.max_allocated)
- memtrack.max_allocated = memtrack.current_allocated;
-
- // memtrack_log("memory_tracker_add: added addr=0x%.8x\n", addr);
-
- memory_tracker_unlock_mutex();
- } else {
- memtrack_log("memory_tracker_add: error allocating memory!\n");
- memory_tracker_unlock_mutex();
- vpx_memory_tracker_destroy();
- }
- }
-}
-
-/*
- memory_tracker_remove(size_t addr)
- Removes an address and its corresponding size (if they exist)
- from the memory tracker list and adjusts the current number
- of bytes allocated.
- Return:
- 0: on success
- -1: if the mutex could not be locked
- -2: if the addr was not found in the list
-*/
-int memory_tracker_remove(size_t addr) {
- int ret = -1;
-
- if (!memory_tracker_lock_mutex()) {
- struct mem_block *p;
-
- if ((p = memory_tracker_find(addr))) {
- memtrack.current_allocated -= p->size;
-
- p->prev->next = p->next;
-
- if (p->next)
- p->next->prev = p->prev;
- else
- memtrack.tail = p->prev;
-
- ret = 0;
- MEM_TRACK_FREE(p);
- } else {
- if (addr)
- memtrack_log("memory_tracker_remove(): addr not found in list,"
- " 0x%.8x\n", addr);
-
- ret = -2;
- }
-
- memory_tracker_unlock_mutex();
- }
-
- return ret;
-}
-
-/*
- memory_tracker_find(size_t addr)
- Finds an address in our addrs list
- NOTE: the mutex MUST be locked in the other internal
- functions before calling this one. This avoids
- the need for repeated locking and unlocking as in Remove
- Returns: pointer to the mem block if found, NULL otherwise
-*/
-static struct mem_block *memory_tracker_find(size_t addr) {
- struct mem_block *p = NULL;
-
- if (memtrack.head) {
- p = memtrack.head->next;
-
- while (p && (p->addr != addr))
- p = p->next;
- }
-
- return p;
-}
-
-
-#if !defined(NO_MUTEX)
-/*
- memory_tracker_lock_mutex()
- Locks the memory tracker mutex with a platform specific call
- Returns:
- 0: Success
- <0: Failure, either the mutex was not initialized
- or the call to lock the mutex failed
-*/
-static int memory_tracker_lock_mutex() {
- int ret = -1;
-
- if (g_b_mem_tracker_inited) {
-
-#if HAVE_PTHREAD_H
- ret = pthread_mutex_lock(&memtrack.mutex);
-#elif defined(WIN32) || defined(_WIN32_WCE)
- ret = WaitForSingleObject(memtrack.mutex, INFINITE);
-#elif defined(VXWORKS)
- ret = sem_take(memtrack.mutex, WAIT_FOREVER);
-#endif
-
- if (ret) {
- memtrack_log("memory_tracker_lock_mutex: mutex lock failed\n");
- }
- }
-
- return ret;
-}
-
-/*
- memory_tracker_unlock_mutex()
- Unlocks the memory tracker mutex with a platform specific call
- Returns:
- 0: Success
- <0: Failure, either the mutex was not initialized
- or the call to unlock the mutex failed
-*/
-static int memory_tracker_unlock_mutex() {
- int ret = -1;
-
- if (g_b_mem_tracker_inited) {
-
-#if HAVE_PTHREAD_H
- ret = pthread_mutex_unlock(&memtrack.mutex);
-#elif defined(WIN32) || defined(_WIN32_WCE)
- ret = !ReleaseMutex(memtrack.mutex);
-#elif defined(VXWORKS)
- ret = sem_give(memtrack.mutex);
-#endif
-
- if (ret) {
- memtrack_log("memory_tracker_unlock_mutex: mutex unlock failed\n");
- }
- }
-
- return ret;
-}
-#endif
-
-/*
- vpx_memory_tracker_set_functions
-
- Sets the function pointers for the standard library functions.
-
- Return:
- 0: on success
- -1: if the use global function pointers is not set.
-*/
-int vpx_memory_tracker_set_functions(mem_track_malloc_func g_malloc_l
-, mem_track_calloc_func g_calloc_l
-, mem_track_realloc_func g_realloc_l
-, mem_track_free_func g_free_l
-, mem_track_memcpy_func g_memcpy_l
-, mem_track_memset_func g_memset_l
-, mem_track_memmove_func g_memmove_l) {
-#if USE_GLOBAL_FUNCTION_POINTERS
-
- if (g_malloc_l)
- g_malloc = g_malloc_l;
-
- if (g_calloc_l)
- g_calloc = g_calloc_l;
-
- if (g_realloc_l)
- g_realloc = g_realloc_l;
-
- if (g_free_l)
- g_free = g_free_l;
-
- if (g_memcpy_l)
- g_memcpy = g_memcpy_l;
-
- if (g_memset_l)
- g_memset = g_memset_l;
-
- if (g_memmove_l)
- g_memmove = g_memmove_l;
-
- return 0;
-#else
- (void)g_malloc_l;
- (void)g_calloc_l;
- (void)g_realloc_l;
- (void)g_free_l;
- (void)g_memcpy_l;
- (void)g_memset_l;
- (void)g_memmove_l;
- return -1;
-#endif
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/arm.h b/videocodec/libvpx_internal/libvpx/vpx_ports/arm.h
deleted file mode 100644
index 1e4a8e2..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/arm.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_PORTS_ARM_H_
-#define VPX_PORTS_ARM_H_
-#include <stdlib.h>
-#include "vpx_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*ARMv5TE "Enhanced DSP" instructions.*/
-#define HAS_EDSP 0x01
-/*ARMv6 "Parallel" or "Media" instructions.*/
-#define HAS_MEDIA 0x02
-/*ARMv7 optional NEON instructions.*/
-#define HAS_NEON 0x04
-
-int arm_cpu_caps(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_PORTS_ARM_H_
-
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/arm_cpudetect.c b/videocodec/libvpx_internal/libvpx/vpx_ports/arm_cpudetect.c
deleted file mode 100644
index 542ff67..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/arm_cpudetect.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "arm.h"
-
-static int arm_cpu_env_flags(int *flags) {
- char *env;
- env = getenv("VPX_SIMD_CAPS");
- if (env && *env) {
- *flags = (int)strtol(env, NULL, 0);
- return 0;
- }
- *flags = 0;
- return -1;
-}
-
-static int arm_cpu_env_mask(void) {
- char *env;
- env = getenv("VPX_SIMD_CAPS_MASK");
- return env && *env ? (int)strtol(env, NULL, 0) : ~0;
-}
-
-#if !CONFIG_RUNTIME_CPU_DETECT
-
-int arm_cpu_caps(void) {
- /* This function should actually be a no-op. There is no way to adjust any of
- * these because the RTCD tables do not exist: the functions are called
- * statically */
- int flags;
- int mask;
- if (!arm_cpu_env_flags(&flags)) {
- return flags;
- }
- mask = arm_cpu_env_mask();
-#if HAVE_EDSP
- flags |= HAS_EDSP;
-#endif /* HAVE_EDSP */
-#if HAVE_MEDIA
- flags |= HAS_MEDIA;
-#endif /* HAVE_MEDIA */
-#if HAVE_NEON
- flags |= HAS_NEON;
-#endif /* HAVE_NEON */
- return flags & mask;
-}
-
-#elif defined(_MSC_VER) /* end !CONFIG_RUNTIME_CPU_DETECT */
-/*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/
-#define WIN32_LEAN_AND_MEAN
-#define WIN32_EXTRA_LEAN
-#include <windows.h>
-
-int arm_cpu_caps(void) {
- int flags;
- int mask;
- if (!arm_cpu_env_flags(&flags)) {
- return flags;
- }
- mask = arm_cpu_env_mask();
- /* MSVC has no inline __asm support for ARM, but it does let you __emit
- * instructions via their assembled hex code.
- * All of these instructions should be essentially nops.
- */
-#if HAVE_EDSP
- if (mask & HAS_EDSP) {
- __try {
- /*PLD [r13]*/
- __emit(0xF5DDF000);
- flags |= HAS_EDSP;
- } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
- /*Ignore exception.*/
- }
- }
-#if HAVE_MEDIA
- if (mask & HAS_MEDIA)
- __try {
- /*SHADD8 r3,r3,r3*/
- __emit(0xE6333F93);
- flags |= HAS_MEDIA;
- } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
- /*Ignore exception.*/
- }
-}
-#if HAVE_NEON
-if (mask &HAS_NEON) {
- __try {
- /*VORR q0,q0,q0*/
- __emit(0xF2200150);
- flags |= HAS_NEON;
- } __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
- /*Ignore exception.*/
- }
-}
-#endif /* HAVE_NEON */
-#endif /* HAVE_MEDIA */
-#endif /* HAVE_EDSP */
-return flags & mask;
-}
-
-#elif defined(__ANDROID__) /* end _MSC_VER */
-#include <cpu-features.h>
-
-int arm_cpu_caps(void) {
- int flags;
- int mask;
- uint64_t features;
- if (!arm_cpu_env_flags(&flags)) {
- return flags;
- }
- mask = arm_cpu_env_mask();
- features = android_getCpuFeatures();
-
-#if HAVE_EDSP
- flags |= HAS_EDSP;
-#endif /* HAVE_EDSP */
-#if HAVE_MEDIA
- flags |= HAS_MEDIA;
-#endif /* HAVE_MEDIA */
-#if HAVE_NEON
- if (features & ANDROID_CPU_ARM_FEATURE_NEON)
- flags |= HAS_NEON;
-#endif /* HAVE_NEON */
- return flags & mask;
-}
-
-#elif defined(__linux__) /* end __ANDROID__ */
-
-#include <stdio.h>
-
-int arm_cpu_caps(void) {
- FILE *fin;
- int flags;
- int mask;
- if (!arm_cpu_env_flags(&flags)) {
- return flags;
- }
- mask = arm_cpu_env_mask();
- /* Reading /proc/self/auxv would be easier, but that doesn't work reliably
- * on Android.
- * This also means that detection will fail in Scratchbox.
- */
- fin = fopen("/proc/cpuinfo", "r");
- if (fin != NULL) {
- /* 512 should be enough for anybody (it's even enough for all the flags
- * that x86 has accumulated... so far).
- */
- char buf[512];
- while (fgets(buf, 511, fin) != NULL) {
-#if HAVE_EDSP || HAVE_NEON
- if (memcmp(buf, "Features", 8) == 0) {
- char *p;
-#if HAVE_EDSP
- p = strstr(buf, " edsp");
- if (p != NULL && (p[5] == ' ' || p[5] == '\n')) {
- flags |= HAS_EDSP;
- }
-#if HAVE_NEON
- p = strstr(buf, " neon");
- if (p != NULL && (p[5] == ' ' || p[5] == '\n')) {
- flags |= HAS_NEON;
- }
-#endif /* HAVE_NEON */
-#endif /* HAVE_EDSP */
- }
-#endif /* HAVE_EDSP || HAVE_NEON */
-#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);
- }
- return flags & mask;
-}
-#else /* end __linux__ */
-#error "--enable-runtime-cpu-detect selected, but no CPU detection method " \
-"available for your platform. Reconfigure with --disable-runtime-cpu-detect."
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/asm_offsets.h b/videocodec/libvpx_internal/libvpx/vpx_ports/asm_offsets.h
deleted file mode 100644
index 317bbed..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/asm_offsets.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_PORTS_ASM_OFFSETS_H_
-#define VPX_PORTS_ASM_OFFSETS_H_
-
-#include <stddef.h>
-
-#define ct_assert(name,cond) \
- static void assert_##name(void) UNUSED;\
- static void assert_##name(void) {switch(0){case 0:case !!(cond):;}}
-
-#if INLINE_ASM
-#define DEFINE(sym, val) asm("\n" #sym " EQU %0" : : "i" (val))
-#define BEGIN int main(void) {
-#define END return 0; }
-#else
-#define DEFINE(sym, val) const int sym = val
-#define BEGIN
-#define END
-#endif
-
-#endif // VPX_PORTS_ASM_OFFSETS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/config.h b/videocodec/libvpx_internal/libvpx/vpx_ports/config.h
deleted file mode 100644
index 3c1ab99..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/config.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_PORTS_CONFIG_H_
-#define VPX_PORTS_CONFIG_H_
-
-#include "vpx_config.h"
-
-#endif // VPX_PORTS_CONFIG_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/emmintrin_compat.h b/videocodec/libvpx_internal/libvpx/vpx_ports/emmintrin_compat.h
deleted file mode 100644
index 1617638..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/emmintrin_compat.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_PORTS_EMMINTRIN_COMPAT_H_
-#define VPX_PORTS_EMMINTRIN_COMPAT_H_
-
-#if defined(__GNUC__) && __GNUC__ < 4
-/* From emmintrin.h (gcc 4.5.3) */
-/* Casts between various SP, DP, INT vector types. Note that these do no
- conversion of values, they just change the type. */
-extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_castpd_ps(__m128d __A)
-{
- return (__m128) __A;
-}
-
-extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_castpd_si128(__m128d __A)
-{
- return (__m128i) __A;
-}
-
-extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_castps_pd(__m128 __A)
-{
- return (__m128d) __A;
-}
-
-extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_castps_si128(__m128 __A)
-{
- return (__m128i) __A;
-}
-
-extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_castsi128_ps(__m128i __A)
-{
- return (__m128) __A;
-}
-
-extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_castsi128_pd(__m128i __A)
-{
- return (__m128d) __A;
-}
-#endif
-
-#endif // VPX_PORTS_EMMINTRIN_COMPAT_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/emms.asm b/videocodec/libvpx_internal/libvpx/vpx_ports/emms.asm
deleted file mode 100644
index db8da28..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/emms.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_ports/x86_abi_support.asm"
-
-section .text
-global sym(vpx_reset_mmx_state) PRIVATE
-sym(vpx_reset_mmx_state):
- emms
- ret
-
-
-%if LIBVPX_YASM_WIN64
-global sym(vpx_winx64_fldcw) PRIVATE
-sym(vpx_winx64_fldcw):
- sub rsp, 8
- mov [rsp], rcx ; win x64 specific
- fldcw [rsp]
- add rsp, 8
- ret
-
-
-global sym(vpx_winx64_fstcw) PRIVATE
-sym(vpx_winx64_fstcw):
- sub rsp, 8
- fstcw [rsp]
- mov rax, [rsp]
- add rsp, 8
- ret
-%endif
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/mem.h b/videocodec/libvpx_internal/libvpx/vpx_ports/mem.h
deleted file mode 100644
index e91d776..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/mem.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_PORTS_MEM_H_
-#define VPX_PORTS_MEM_H_
-
-#include "vpx_config.h"
-#include "vpx/vpx_integer.h"
-
-#if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
-#define DECLARE_ALIGNED(n,typ,val) typ val __attribute__ ((aligned (n)))
-#elif defined(_MSC_VER)
-#define DECLARE_ALIGNED(n,typ,val) __declspec(align(n)) typ val
-#else
-#warning No alignment directives known for this compiler.
-#define DECLARE_ALIGNED(n,typ,val) typ val
-#endif
-#endif
-
-
-/* Declare an aligned array on the stack, for situations where the stack
- * pointer may not have the alignment we expect. Creates an array with a
- * modified name, then defines val to be a pointer, and aligns that pointer
- * within the array.
- */
-#define DECLARE_ALIGNED_ARRAY(a,typ,val,n)\
- typ val##_[(n)+(a)/sizeof(typ)+1];\
- typ *val = (typ*)((((intptr_t)val##_)+(a)-1)&((intptr_t)-(a)))
-
-
-/* Indicates that the usage of the specified variable has been audited to assure
- * that it's safe to use uninitialized. Silences 'may be used uninitialized'
- * warnings on gcc.
- */
-#if defined(__GNUC__) && __GNUC__
-#define UNINITIALIZED_IS_SAFE(x) x=x
-#else
-#define UNINITIALIZED_IS_SAFE(x) x
-#endif // VPX_PORTS_MEM_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops.h b/videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops.h
deleted file mode 100644
index 8c8b526..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_PORTS_MEM_OPS_H_
-#define VPX_PORTS_MEM_OPS_H_
-
-/* \file
- * \brief Provides portable memory access primitives
- *
- * This function provides portable primitives for getting and setting of
- * signed and unsigned integers in 16, 24, and 32 bit sizes. The operations
- * can be performed on unaligned data regardless of hardware support for
- * unaligned accesses.
- *
- * The type used to pass the integral values may be changed by defining
- * MEM_VALUE_T with the appropriate type. The type given must be an integral
- * numeric type.
- *
- * The actual functions instantiated have the MEM_VALUE_T type name pasted
- * on to the symbol name. This allows the developer to instantiate these
- * operations for multiple types within the same translation unit. This is
- * of somewhat questionable utility, but the capability exists nonetheless.
- * Users not making use of this functionality should call the functions
- * without the type name appended, and the preprocessor will take care of
- * it.
- *
- * NOTE: This code is not supported on platforms where char > 1 octet ATM.
- */
-
-#ifndef MAU_T
-/* Minimum Access Unit for this target */
-#define MAU_T unsigned char
-#endif
-
-#ifndef MEM_VALUE_T
-#define MEM_VALUE_T int
-#endif
-
-#undef MEM_VALUE_T_SZ_BITS
-#define MEM_VALUE_T_SZ_BITS (sizeof(MEM_VALUE_T) << 3)
-
-#undef mem_ops_wrap_symbol
-#define mem_ops_wrap_symbol(fn) mem_ops_wrap_symbol2(fn, MEM_VALUE_T)
-#undef mem_ops_wrap_symbol2
-#define mem_ops_wrap_symbol2(fn,typ) mem_ops_wrap_symbol3(fn,typ)
-#undef mem_ops_wrap_symbol3
-#define mem_ops_wrap_symbol3(fn,typ) fn##_as_##typ
-
-/*
- * Include aligned access routines
- */
-#define INCLUDED_BY_MEM_OPS_H
-#include "mem_ops_aligned.h"
-#undef INCLUDED_BY_MEM_OPS_H
-
-#undef mem_get_be16
-#define mem_get_be16 mem_ops_wrap_symbol(mem_get_be16)
-static unsigned MEM_VALUE_T mem_get_be16(const void *vmem) {
- unsigned MEM_VALUE_T val;
- const MAU_T *mem = (const MAU_T *)vmem;
-
- val = mem[0] << 8;
- val |= mem[1];
- return val;
-}
-
-#undef mem_get_be24
-#define mem_get_be24 mem_ops_wrap_symbol(mem_get_be24)
-static unsigned MEM_VALUE_T mem_get_be24(const void *vmem) {
- unsigned MEM_VALUE_T val;
- const MAU_T *mem = (const MAU_T *)vmem;
-
- val = mem[0] << 16;
- val |= mem[1] << 8;
- val |= mem[2];
- return val;
-}
-
-#undef mem_get_be32
-#define mem_get_be32 mem_ops_wrap_symbol(mem_get_be32)
-static unsigned MEM_VALUE_T mem_get_be32(const void *vmem) {
- unsigned MEM_VALUE_T val;
- const MAU_T *mem = (const MAU_T *)vmem;
-
- val = mem[0] << 24;
- val |= mem[1] << 16;
- val |= mem[2] << 8;
- val |= mem[3];
- return val;
-}
-
-#undef mem_get_le16
-#define mem_get_le16 mem_ops_wrap_symbol(mem_get_le16)
-static unsigned MEM_VALUE_T mem_get_le16(const void *vmem) {
- unsigned MEM_VALUE_T val;
- const MAU_T *mem = (const MAU_T *)vmem;
-
- val = mem[1] << 8;
- val |= mem[0];
- return val;
-}
-
-#undef mem_get_le24
-#define mem_get_le24 mem_ops_wrap_symbol(mem_get_le24)
-static unsigned MEM_VALUE_T mem_get_le24(const void *vmem) {
- unsigned MEM_VALUE_T val;
- const MAU_T *mem = (const MAU_T *)vmem;
-
- val = mem[2] << 16;
- val |= mem[1] << 8;
- val |= mem[0];
- return val;
-}
-
-#undef mem_get_le32
-#define mem_get_le32 mem_ops_wrap_symbol(mem_get_le32)
-static unsigned MEM_VALUE_T mem_get_le32(const void *vmem) {
- unsigned MEM_VALUE_T val;
- const MAU_T *mem = (const MAU_T *)vmem;
-
- val = mem[3] << 24;
- val |= mem[2] << 16;
- val |= mem[1] << 8;
- val |= mem[0];
- return val;
-}
-
-#define mem_get_s_generic(end,sz) \
- static signed MEM_VALUE_T mem_get_s##end##sz(const void *vmem) {\
- const MAU_T *mem = (const MAU_T*)vmem;\
- signed MEM_VALUE_T val = mem_get_##end##sz(mem);\
- return (val << (MEM_VALUE_T_SZ_BITS - sz)) >> (MEM_VALUE_T_SZ_BITS - sz);\
- }
-
-#undef mem_get_sbe16
-#define mem_get_sbe16 mem_ops_wrap_symbol(mem_get_sbe16)
-mem_get_s_generic(be, 16)
-
-#undef mem_get_sbe24
-#define mem_get_sbe24 mem_ops_wrap_symbol(mem_get_sbe24)
-mem_get_s_generic(be, 24)
-
-#undef mem_get_sbe32
-#define mem_get_sbe32 mem_ops_wrap_symbol(mem_get_sbe32)
-mem_get_s_generic(be, 32)
-
-#undef mem_get_sle16
-#define mem_get_sle16 mem_ops_wrap_symbol(mem_get_sle16)
-mem_get_s_generic(le, 16)
-
-#undef mem_get_sle24
-#define mem_get_sle24 mem_ops_wrap_symbol(mem_get_sle24)
-mem_get_s_generic(le, 24)
-
-#undef mem_get_sle32
-#define mem_get_sle32 mem_ops_wrap_symbol(mem_get_sle32)
-mem_get_s_generic(le, 32)
-
-#undef mem_put_be16
-#define mem_put_be16 mem_ops_wrap_symbol(mem_put_be16)
-static void mem_put_be16(void *vmem, MEM_VALUE_T val) {
- MAU_T *mem = (MAU_T *)vmem;
-
- mem[0] = (val >> 8) & 0xff;
- mem[1] = (val >> 0) & 0xff;
-}
-
-#undef mem_put_be24
-#define mem_put_be24 mem_ops_wrap_symbol(mem_put_be24)
-static void mem_put_be24(void *vmem, MEM_VALUE_T val) {
- MAU_T *mem = (MAU_T *)vmem;
-
- mem[0] = (val >> 16) & 0xff;
- mem[1] = (val >> 8) & 0xff;
- mem[2] = (val >> 0) & 0xff;
-}
-
-#undef mem_put_be32
-#define mem_put_be32 mem_ops_wrap_symbol(mem_put_be32)
-static void mem_put_be32(void *vmem, MEM_VALUE_T val) {
- MAU_T *mem = (MAU_T *)vmem;
-
- mem[0] = (val >> 24) & 0xff;
- mem[1] = (val >> 16) & 0xff;
- mem[2] = (val >> 8) & 0xff;
- mem[3] = (val >> 0) & 0xff;
-}
-
-#undef mem_put_le16
-#define mem_put_le16 mem_ops_wrap_symbol(mem_put_le16)
-static void mem_put_le16(void *vmem, MEM_VALUE_T val) {
- MAU_T *mem = (MAU_T *)vmem;
-
- mem[0] = (val >> 0) & 0xff;
- mem[1] = (val >> 8) & 0xff;
-}
-
-#undef mem_put_le24
-#define mem_put_le24 mem_ops_wrap_symbol(mem_put_le24)
-static void mem_put_le24(void *vmem, MEM_VALUE_T val) {
- MAU_T *mem = (MAU_T *)vmem;
-
- mem[0] = (val >> 0) & 0xff;
- mem[1] = (val >> 8) & 0xff;
- mem[2] = (val >> 16) & 0xff;
-}
-
-#undef mem_put_le32
-#define mem_put_le32 mem_ops_wrap_symbol(mem_put_le32)
-static void mem_put_le32(void *vmem, MEM_VALUE_T val) {
- MAU_T *mem = (MAU_T *)vmem;
-
- mem[0] = (val >> 0) & 0xff;
- mem[1] = (val >> 8) & 0xff;
- mem[2] = (val >> 16) & 0xff;
- mem[3] = (val >> 24) & 0xff;
-}
-
-#endif // VPX_PORTS_MEM_OPS_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops_aligned.h b/videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops_aligned.h
deleted file mode 100644
index 24743c8..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/mem_ops_aligned.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_PORTS_MEM_OPS_ALIGNED_H_
-#define VPX_PORTS_MEM_OPS_ALIGNED_H_
-
-#include "vpx/vpx_integer.h"
-
-/* \file
- * \brief Provides portable memory access primitives for operating on aligned
- * data
- *
- * This file is split from mem_ops.h for easier maintenance. See mem_ops.h
- * for a more detailed description of these primitives.
- */
-#ifndef INCLUDED_BY_MEM_OPS_H
-#error Include mem_ops.h, not mem_ops_aligned.h directly.
-#endif
-
-/* Architectures that provide instructions for doing this byte swapping
- * could redefine these macros.
- */
-#define swap_endian_16(val,raw) do {\
- val = ((raw>>8) & 0x00ff) \
- | ((raw<<8) & 0xff00);\
- } while(0)
-#define swap_endian_32(val,raw) do {\
- val = ((raw>>24) & 0x000000ff) \
- | ((raw>>8) & 0x0000ff00) \
- | ((raw<<8) & 0x00ff0000) \
- | ((raw<<24) & 0xff000000); \
- } while(0)
-#define swap_endian_16_se(val,raw) do {\
- swap_endian_16(val,raw);\
- val = ((val << 16) >> 16);\
- } while(0)
-#define swap_endian_32_se(val,raw) swap_endian_32(val,raw)
-
-#define mem_get_ne_aligned_generic(end,sz) \
- static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\
- const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\
- return *mem;\
- }
-
-#define mem_get_sne_aligned_generic(end,sz) \
- static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\
- const int##sz##_t *mem = (const int##sz##_t *)vmem;\
- return *mem;\
- }
-
-#define mem_get_se_aligned_generic(end,sz) \
- static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\
- const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\
- unsigned MEM_VALUE_T val, raw = *mem;\
- swap_endian_##sz(val,raw);\
- return val;\
- }
-
-#define mem_get_sse_aligned_generic(end,sz) \
- static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\
- const int##sz##_t *mem = (const int##sz##_t *)vmem;\
- unsigned MEM_VALUE_T val, raw = *mem;\
- swap_endian_##sz##_se(val,raw);\
- return val;\
- }
-
-#define mem_put_ne_aligned_generic(end,sz) \
- static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
- uint##sz##_t *mem = (uint##sz##_t *)vmem;\
- *mem = (uint##sz##_t)val;\
- }
-
-#define mem_put_se_aligned_generic(end,sz) \
- static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
- uint##sz##_t *mem = (uint##sz##_t *)vmem, raw;\
- swap_endian_##sz(raw,val);\
- *mem = (uint##sz##_t)raw;\
- }
-
-#include "vpx_config.h"
-#if CONFIG_BIG_ENDIAN
-#define mem_get_be_aligned_generic(sz) mem_get_ne_aligned_generic(be,sz)
-#define mem_get_sbe_aligned_generic(sz) mem_get_sne_aligned_generic(be,sz)
-#define mem_get_le_aligned_generic(sz) mem_get_se_aligned_generic(le,sz)
-#define mem_get_sle_aligned_generic(sz) mem_get_sse_aligned_generic(le,sz)
-#define mem_put_be_aligned_generic(sz) mem_put_ne_aligned_generic(be,sz)
-#define mem_put_le_aligned_generic(sz) mem_put_se_aligned_generic(le,sz)
-#else
-#define mem_get_be_aligned_generic(sz) mem_get_se_aligned_generic(be,sz)
-#define mem_get_sbe_aligned_generic(sz) mem_get_sse_aligned_generic(be,sz)
-#define mem_get_le_aligned_generic(sz) mem_get_ne_aligned_generic(le,sz)
-#define mem_get_sle_aligned_generic(sz) mem_get_sne_aligned_generic(le,sz)
-#define mem_put_be_aligned_generic(sz) mem_put_se_aligned_generic(be,sz)
-#define mem_put_le_aligned_generic(sz) mem_put_ne_aligned_generic(le,sz)
-#endif
-
-#undef mem_get_be16_aligned
-#define mem_get_be16_aligned mem_ops_wrap_symbol(mem_get_be16_aligned)
-mem_get_be_aligned_generic(16)
-
-#undef mem_get_be32_aligned
-#define mem_get_be32_aligned mem_ops_wrap_symbol(mem_get_be32_aligned)
-mem_get_be_aligned_generic(32)
-
-#undef mem_get_le16_aligned
-#define mem_get_le16_aligned mem_ops_wrap_symbol(mem_get_le16_aligned)
-mem_get_le_aligned_generic(16)
-
-#undef mem_get_le32_aligned
-#define mem_get_le32_aligned mem_ops_wrap_symbol(mem_get_le32_aligned)
-mem_get_le_aligned_generic(32)
-
-#undef mem_get_sbe16_aligned
-#define mem_get_sbe16_aligned mem_ops_wrap_symbol(mem_get_sbe16_aligned)
-mem_get_sbe_aligned_generic(16)
-
-#undef mem_get_sbe32_aligned
-#define mem_get_sbe32_aligned mem_ops_wrap_symbol(mem_get_sbe32_aligned)
-mem_get_sbe_aligned_generic(32)
-
-#undef mem_get_sle16_aligned
-#define mem_get_sle16_aligned mem_ops_wrap_symbol(mem_get_sle16_aligned)
-mem_get_sle_aligned_generic(16)
-
-#undef mem_get_sle32_aligned
-#define mem_get_sle32_aligned mem_ops_wrap_symbol(mem_get_sle32_aligned)
-mem_get_sle_aligned_generic(32)
-
-#undef mem_put_be16_aligned
-#define mem_put_be16_aligned mem_ops_wrap_symbol(mem_put_be16_aligned)
-mem_put_be_aligned_generic(16)
-
-#undef mem_put_be32_aligned
-#define mem_put_be32_aligned mem_ops_wrap_symbol(mem_put_be32_aligned)
-mem_put_be_aligned_generic(32)
-
-#undef mem_put_le16_aligned
-#define mem_put_le16_aligned mem_ops_wrap_symbol(mem_put_le16_aligned)
-mem_put_le_aligned_generic(16)
-
-#undef mem_put_le32_aligned
-#define mem_put_le32_aligned mem_ops_wrap_symbol(mem_put_le32_aligned)
-mem_put_le_aligned_generic(32)
-
-#undef mem_get_ne_aligned_generic
-#undef mem_get_se_aligned_generic
-#undef mem_get_sne_aligned_generic
-#undef mem_get_sse_aligned_generic
-#undef mem_put_ne_aligned_generic
-#undef mem_put_se_aligned_generic
-#undef swap_endian_16
-#undef swap_endian_32
-#undef swap_endian_16_se
-#undef swap_endian_32_se
-
-#endif // VPX_PORTS_MEM_OPS_ALIGNED_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_once.h b/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_once.h
deleted file mode 100644
index 182892a..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_once.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_PORTS_VPX_ONCE_H_
-#define VPX_PORTS_VPX_ONCE_H_
-
-#include "vpx_config.h"
-
-#if CONFIG_MULTITHREAD && defined(_WIN32)
-#include <windows.h>
-#include <stdlib.h>
-static void once(void (*func)(void))
-{
- static CRITICAL_SECTION *lock;
- static LONG waiters;
- static int done;
- void *lock_ptr = &lock;
-
- /* If the initialization is complete, return early. This isn't just an
- * optimization, it prevents races on the destruction of the global
- * lock.
- */
- if(done)
- return;
-
- InterlockedIncrement(&waiters);
-
- /* Get a lock. We create one and try to make it the one-true-lock,
- * throwing it away if we lost the race.
- */
-
- {
- /* Scope to protect access to new_lock */
- CRITICAL_SECTION *new_lock = malloc(sizeof(CRITICAL_SECTION));
- InitializeCriticalSection(new_lock);
- if (InterlockedCompareExchangePointer(lock_ptr, new_lock, NULL) != NULL)
- {
- DeleteCriticalSection(new_lock);
- free(new_lock);
- }
- }
-
- /* At this point, we have a lock that can be synchronized on. We don't
- * care which thread actually performed the allocation.
- */
-
- EnterCriticalSection(lock);
-
- if (!done)
- {
- func();
- done = 1;
- }
-
- LeaveCriticalSection(lock);
-
- /* Last one out should free resources. The destructed objects are
- * protected by checking if(done) above.
- */
- if(!InterlockedDecrement(&waiters))
- {
- DeleteCriticalSection(lock);
- free(lock);
- lock = NULL;
- }
-}
-
-
-#elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H
-#include <pthread.h>
-static void once(void (*func)(void))
-{
- static pthread_once_t lock = PTHREAD_ONCE_INIT;
- pthread_once(&lock, func);
-}
-
-
-#else
-/* No-op version that performs no synchronization. vp8_rtcd() is idempotent,
- * so as long as your platform provides atomic loads/stores of pointers
- * no synchronization is strictly necessary.
- */
-
-static void once(void (*func)(void))
-{
- static int done;
-
- if(!done)
- {
- func();
- done = 1;
- }
-}
-#endif
-
-#endif // VPX_PORTS_VPX_ONCE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_ports.mk b/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_ports.mk
deleted file mode 100644
index 869a204..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_ports.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-##
-## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
-##
-## Use of this source code is governed by a BSD-style license
-## that can be found in the LICENSE file in the root of the source
-## tree. An additional intellectual property rights grant can be found
-## in the file PATENTS. All contributing project authors may
-## be found in the AUTHORS file in the root of the source tree.
-##
-
-
-PORTS_SRCS-yes += vpx_ports.mk
-
-PORTS_SRCS-$(BUILD_LIBVPX) += asm_offsets.h
-PORTS_SRCS-$(BUILD_LIBVPX) += mem.h
-PORTS_SRCS-$(BUILD_LIBVPX) += vpx_timer.h
-
-ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
-PORTS_SRCS-$(BUILD_LIBVPX) += emms.asm
-PORTS_SRCS-$(BUILD_LIBVPX) += x86.h
-PORTS_SRCS-$(BUILD_LIBVPX) += x86_abi_support.asm
-endif
-
-PORTS_SRCS-$(ARCH_ARM) += arm_cpudetect.c
-PORTS_SRCS-$(ARCH_ARM) += arm.h
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_timer.h b/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_timer.h
deleted file mode 100644
index 9e2015e..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/vpx_timer.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_PORTS_VPX_TIMER_H_
-#define VPX_PORTS_VPX_TIMER_H_
-#include "vpx/vpx_integer.h"
-
-#if CONFIG_OS_SUPPORT
-
-#if defined(_WIN32)
-/*
- * Win32 specific includes
- */
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#else
-/*
- * POSIX specific includes
- */
-#include <sys/time.h>
-
-/* timersub is not provided by msys at this time. */
-#ifndef timersub
-#define timersub(a, b, result) \
- do { \
- (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
- (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
- if ((result)->tv_usec < 0) { \
- --(result)->tv_sec; \
- (result)->tv_usec += 1000000; \
- } \
- } while (0)
-#endif
-#endif
-
-
-struct vpx_usec_timer {
-#if defined(_WIN32)
- LARGE_INTEGER begin, end;
-#else
- struct timeval begin, end;
-#endif
-};
-
-
-static void
-vpx_usec_timer_start(struct vpx_usec_timer *t) {
-#if defined(_WIN32)
- QueryPerformanceCounter(&t->begin);
-#else
- gettimeofday(&t->begin, NULL);
-#endif
-}
-
-
-static void
-vpx_usec_timer_mark(struct vpx_usec_timer *t) {
-#if defined(_WIN32)
- QueryPerformanceCounter(&t->end);
-#else
- gettimeofday(&t->end, NULL);
-#endif
-}
-
-
-static int64_t
-vpx_usec_timer_elapsed(struct vpx_usec_timer *t) {
-#if defined(_WIN32)
- LARGE_INTEGER freq, diff;
-
- diff.QuadPart = t->end.QuadPart - t->begin.QuadPart;
-
- QueryPerformanceFrequency(&freq);
- return diff.QuadPart * 1000000 / freq.QuadPart;
-#else
- struct timeval diff;
-
- timersub(&t->end, &t->begin, &diff);
- return diff.tv_sec * 1000000 + diff.tv_usec;
-#endif
-}
-
-#else /* CONFIG_OS_SUPPORT = 0*/
-
-/* Empty timer functions if CONFIG_OS_SUPPORT = 0 */
-#ifndef timersub
-#define timersub(a, b, result)
-#endif
-
-struct vpx_usec_timer {
- void *dummy;
-};
-
-static void
-vpx_usec_timer_start(struct vpx_usec_timer *t) { }
-
-static void
-vpx_usec_timer_mark(struct vpx_usec_timer *t) { }
-
-static long
-vpx_usec_timer_elapsed(struct vpx_usec_timer *t) {
- return 0;
-}
-
-#endif /* CONFIG_OS_SUPPORT */
-
-#endif // VPX_PORTS_VPX_TIMER_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/x86.h b/videocodec/libvpx_internal/libvpx/vpx_ports/x86.h
deleted file mode 100644
index bc99f89..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/x86.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_PORTS_X86_H_
-#define VPX_PORTS_X86_H_
-#include <stdlib.h>
-#include "vpx_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- VPX_CPU_UNKNOWN = -1,
- VPX_CPU_AMD,
- VPX_CPU_AMD_OLD,
- VPX_CPU_CENTAUR,
- VPX_CPU_CYRIX,
- VPX_CPU_INTEL,
- VPX_CPU_NEXGEN,
- VPX_CPU_NSC,
- VPX_CPU_RISE,
- VPX_CPU_SIS,
- VPX_CPU_TRANSMETA,
- VPX_CPU_TRANSMETA_OLD,
- VPX_CPU_UMC,
- VPX_CPU_VIA,
-
- VPX_CPU_LAST
-} vpx_cpu_t;
-
-#if defined(__GNUC__) && __GNUC__ || defined(__ANDROID__)
-#if ARCH_X86_64
-#define cpuid(func, func2, ax, bx, cx, dx)\
- __asm__ __volatile__ (\
- "cpuid \n\t" \
- : "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) \
- : "a" (func), "c" (func2));
-#else
-#define cpuid(func, func2, ax, bx, cx, dx)\
- __asm__ __volatile__ (\
- "mov %%ebx, %%edi \n\t" \
- "cpuid \n\t" \
- "xchg %%edi, %%ebx \n\t" \
- : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
- : "a" (func), "c" (func2));
-#endif
-#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* end __GNUC__ or __ANDROID__*/
-#if ARCH_X86_64
-#define cpuid(func, func2, ax, bx, cx, dx)\
- asm volatile (\
- "xchg %rsi, %rbx \n\t" \
- "cpuid \n\t" \
- "movl %ebx, %edi \n\t" \
- "xchg %rsi, %rbx \n\t" \
- : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
- : "a" (func), "c" (func2));
-#else
-#define cpuid(func, func2, ax, bx, cx, dx)\
- asm volatile (\
- "pushl %ebx \n\t" \
- "cpuid \n\t" \
- "movl %ebx, %edi \n\t" \
- "popl %ebx \n\t" \
- : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
- : "a" (func), "c" (func2));
-#endif
-#else /* end __SUNPRO__ */
-#if ARCH_X86_64
-#if defined(_MSC_VER) && _MSC_VER > 1500
-void __cpuidex(int CPUInfo[4], int info_type, int ecxvalue);
-#pragma intrinsic(__cpuidex)
-#define cpuid(func, func2, a, b, c, d) do {\
- int regs[4];\
- __cpuidex(regs, func, func2); \
- a = regs[0]; b = regs[1]; c = regs[2]; d = regs[3];\
- } while(0)
-#else
-void __cpuid(int CPUInfo[4], int info_type);
-#pragma intrinsic(__cpuid)
-#define cpuid(func, func2, a, b, c, d) do {\
- int regs[4];\
- __cpuid(regs, func); \
- a = regs[0]; b = regs[1]; c = regs[2]; d = regs[3];\
- } while (0)
-#endif
-#else
-#define cpuid(func, func2, a, b, c, d)\
- __asm mov eax, func\
- __asm mov ecx, func2\
- __asm cpuid\
- __asm mov a, eax\
- __asm mov b, ebx\
- __asm mov c, ecx\
- __asm mov d, edx
-#endif
-#endif /* end others */
-
-#define HAS_MMX 0x01
-#define HAS_SSE 0x02
-#define HAS_SSE2 0x04
-#define HAS_SSE3 0x08
-#define HAS_SSSE3 0x10
-#define HAS_SSE4_1 0x20
-#define HAS_AVX 0x40
-#define HAS_AVX2 0x80
-#ifndef BIT
-#define BIT(n) (1<<n)
-#endif
-
-static int
-x86_simd_caps(void) {
- unsigned int flags = 0;
- unsigned int mask = ~0;
- unsigned int reg_eax, reg_ebx, reg_ecx, reg_edx;
- char *env;
- (void)reg_ebx;
-
- /* See if the CPU capabilities are being overridden by the environment */
- env = getenv("VPX_SIMD_CAPS");
-
- if (env && *env)
- return (int)strtol(env, NULL, 0);
-
- env = getenv("VPX_SIMD_CAPS_MASK");
-
- if (env && *env)
- mask = strtol(env, NULL, 0);
-
- /* Ensure that the CPUID instruction supports extended features */
- cpuid(0, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
-
- if (reg_eax < 1)
- return 0;
-
- /* Get the standard feature flags */
- cpuid(1, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
-
- if (reg_edx & BIT(23)) flags |= HAS_MMX;
-
- if (reg_edx & BIT(25)) flags |= HAS_SSE; /* aka xmm */
-
- if (reg_edx & BIT(26)) flags |= HAS_SSE2; /* aka wmt */
-
- if (reg_ecx & BIT(0)) flags |= HAS_SSE3;
-
- if (reg_ecx & BIT(9)) flags |= HAS_SSSE3;
-
- if (reg_ecx & BIT(19)) flags |= HAS_SSE4_1;
-
- if (reg_ecx & BIT(28)) flags |= HAS_AVX;
-
- /* Get the leaf 7 feature flags. Needed to check for AVX2 support */
- reg_eax = 7;
- reg_ecx = 0;
- cpuid(7, 0, reg_eax, reg_ebx, reg_ecx, reg_edx);
-
- if (reg_ebx & BIT(5)) flags |= HAS_AVX2;
-
- return flags & mask;
-}
-
-#if ARCH_X86_64 && defined(_MSC_VER)
-unsigned __int64 __rdtsc(void);
-#pragma intrinsic(__rdtsc)
-#endif
-static unsigned int
-x86_readtsc(void) {
-#if defined(__GNUC__) && __GNUC__
- unsigned int tsc;
- __asm__ __volatile__("rdtsc\n\t":"=a"(tsc):);
- return tsc;
-#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
- unsigned int tsc;
- asm volatile("rdtsc\n\t":"=a"(tsc):);
- return tsc;
-#else
-#if ARCH_X86_64
- return (unsigned int)__rdtsc();
-#else
- __asm rdtsc;
-#endif
-#endif
-}
-
-
-#if defined(__GNUC__) && __GNUC__
-#define x86_pause_hint()\
- __asm__ __volatile__ ("pause \n\t")
-#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-#define x86_pause_hint()\
- asm volatile ("pause \n\t")
-#else
-#if ARCH_X86_64
-#define x86_pause_hint()\
- _mm_pause();
-#else
-#define x86_pause_hint()\
- __asm pause
-#endif
-#endif
-
-#if defined(__GNUC__) && __GNUC__
-static void
-x87_set_control_word(unsigned short mode) {
- __asm__ __volatile__("fldcw %0" : : "m"(*&mode));
-}
-static unsigned short
-x87_get_control_word(void) {
- unsigned short mode;
- __asm__ __volatile__("fstcw %0\n\t":"=m"(*&mode):);
- return mode;
-}
-#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-static void
-x87_set_control_word(unsigned short mode) {
- asm volatile("fldcw %0" : : "m"(*&mode));
-}
-static unsigned short
-x87_get_control_word(void) {
- unsigned short mode;
- asm volatile("fstcw %0\n\t":"=m"(*&mode):);
- return mode;
-}
-#elif ARCH_X86_64
-/* No fldcw intrinsics on Windows x64, punt to external asm */
-extern void vpx_winx64_fldcw(unsigned short mode);
-extern unsigned short vpx_winx64_fstcw(void);
-#define x87_set_control_word vpx_winx64_fldcw
-#define x87_get_control_word vpx_winx64_fstcw
-#else
-static void
-x87_set_control_word(unsigned short mode) {
- __asm { fldcw mode }
-}
-static unsigned short
-x87_get_control_word(void) {
- unsigned short mode;
- __asm { fstcw mode }
- return mode;
-}
-#endif
-
-static unsigned short
-x87_set_double_precision(void) {
- unsigned short mode = x87_get_control_word();
- x87_set_control_word((mode&~0x300) | 0x200);
- return mode;
-}
-
-
-extern void vpx_reset_mmx_state(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPX_PORTS_X86_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_ports/x86_abi_support.asm b/videocodec/libvpx_internal/libvpx/vpx_ports/x86_abi_support.asm
deleted file mode 100644
index eccbfa3..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_ports/x86_abi_support.asm
+++ /dev/null
@@ -1,395 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
-%include "vpx_config.asm"
-
-; 32/64 bit compatibility macros
-;
-; In general, we make the source use 64 bit syntax, then twiddle with it using
-; the preprocessor to get the 32 bit syntax on 32 bit platforms.
-;
-%ifidn __OUTPUT_FORMAT__,elf32
-%define ABI_IS_32BIT 1
-%elifidn __OUTPUT_FORMAT__,macho32
-%define ABI_IS_32BIT 1
-%elifidn __OUTPUT_FORMAT__,win32
-%define ABI_IS_32BIT 1
-%elifidn __OUTPUT_FORMAT__,aout
-%define ABI_IS_32BIT 1
-%else
-%define ABI_IS_32BIT 0
-%endif
-
-%if ABI_IS_32BIT
-%define rax eax
-%define rbx ebx
-%define rcx ecx
-%define rdx edx
-%define rsi esi
-%define rdi edi
-%define rsp esp
-%define rbp ebp
-%define movsxd mov
-%macro movq 2
- %ifidn %1,eax
- movd %1,%2
- %elifidn %2,eax
- movd %1,%2
- %elifidn %1,ebx
- movd %1,%2
- %elifidn %2,ebx
- movd %1,%2
- %elifidn %1,ecx
- movd %1,%2
- %elifidn %2,ecx
- movd %1,%2
- %elifidn %1,edx
- movd %1,%2
- %elifidn %2,edx
- movd %1,%2
- %elifidn %1,esi
- movd %1,%2
- %elifidn %2,esi
- movd %1,%2
- %elifidn %1,edi
- movd %1,%2
- %elifidn %2,edi
- movd %1,%2
- %elifidn %1,esp
- movd %1,%2
- %elifidn %2,esp
- movd %1,%2
- %elifidn %1,ebp
- movd %1,%2
- %elifidn %2,ebp
- movd %1,%2
- %else
- movq %1,%2
- %endif
-%endmacro
-%endif
-
-
-; LIBVPX_YASM_WIN64
-; Set LIBVPX_YASM_WIN64 if output is Windows 64bit so the code will work if x64
-; or win64 is defined on the Yasm command line.
-%ifidn __OUTPUT_FORMAT__,win64
-%define LIBVPX_YASM_WIN64 1
-%elifidn __OUTPUT_FORMAT__,x64
-%define LIBVPX_YASM_WIN64 1
-%else
-%define LIBVPX_YASM_WIN64 0
-%endif
-
-; sym()
-; Return the proper symbol name for the target ABI.
-;
-; Certain ABIs, notably MS COFF and Darwin MACH-O, require that symbols
-; with C linkage be prefixed with an underscore.
-;
-%ifidn __OUTPUT_FORMAT__,elf32
-%define sym(x) x
-%elifidn __OUTPUT_FORMAT__,elf64
-%define sym(x) x
-%elifidn __OUTPUT_FORMAT__,elfx32
-%define sym(x) x
-%elif LIBVPX_YASM_WIN64
-%define sym(x) x
-%else
-%define sym(x) _ %+ x
-%endif
-
-; PRIVATE
-; Macro for the attribute to hide a global symbol for the target ABI.
-; This is only active if CHROMIUM is defined.
-;
-; Chromium doesn't like exported global symbols due to symbol clashing with
-; plugins among other things.
-;
-; Requires Chromium's patched copy of yasm:
-; http://src.chromium.org/viewvc/chrome?view=rev&revision=73761
-; http://www.tortall.net/projects/yasm/ticket/236
-;
-%ifdef CHROMIUM
- %ifidn __OUTPUT_FORMAT__,elf32
- %define PRIVATE :hidden
- %elifidn __OUTPUT_FORMAT__,elf64
- %define PRIVATE :hidden
- %elifidn __OUTPUT_FORMAT__,elfx32
- %define PRIVATE :hidden
- %elif LIBVPX_YASM_WIN64
- %define PRIVATE
- %else
- %define PRIVATE :private_extern
- %endif
-%else
- %define PRIVATE
-%endif
-
-; arg()
-; Return the address specification of the given argument
-;
-%if ABI_IS_32BIT
- %define arg(x) [ebp+8+4*x]
-%else
- ; 64 bit ABI passes arguments in registers. This is a workaround to get up
- ; and running quickly. Relies on SHADOW_ARGS_TO_STACK
- %if LIBVPX_YASM_WIN64
- %define arg(x) [rbp+16+8*x]
- %else
- %define arg(x) [rbp-8-8*x]
- %endif
-%endif
-
-; REG_SZ_BYTES, REG_SZ_BITS
-; Size of a register
-%if ABI_IS_32BIT
-%define REG_SZ_BYTES 4
-%define REG_SZ_BITS 32
-%else
-%define REG_SZ_BYTES 8
-%define REG_SZ_BITS 64
-%endif
-
-
-; ALIGN_STACK <alignment> <register>
-; This macro aligns the stack to the given alignment (in bytes). The stack
-; is left such that the previous value of the stack pointer is the first
-; argument on the stack (ie, the inverse of this macro is 'pop rsp.')
-; This macro uses one temporary register, which is not preserved, and thus
-; must be specified as an argument.
-%macro ALIGN_STACK 2
- mov %2, rsp
- and rsp, -%1
- lea rsp, [rsp - (%1 - REG_SZ_BYTES)]
- push %2
-%endmacro
-
-
-;
-; The Microsoft assembler tries to impose a certain amount of type safety in
-; its register usage. YASM doesn't recognize these directives, so we just
-; %define them away to maintain as much compatibility as possible with the
-; original inline assembler we're porting from.
-;
-%idefine PTR
-%idefine XMMWORD
-%idefine MMWORD
-
-; PIC macros
-;
-%if ABI_IS_32BIT
- %if CONFIG_PIC=1
- %ifidn __OUTPUT_FORMAT__,elf32
- %define GET_GOT_SAVE_ARG 1
- %define WRT_PLT wrt ..plt
- %macro GET_GOT 1
- extern _GLOBAL_OFFSET_TABLE_
- push %1
- call %%get_got
- %%sub_offset:
- jmp %%exitGG
- %%get_got:
- mov %1, [esp]
- add %1, _GLOBAL_OFFSET_TABLE_ + $$ - %%sub_offset wrt ..gotpc
- ret
- %%exitGG:
- %undef GLOBAL
- %define GLOBAL(x) x + %1 wrt ..gotoff
- %undef RESTORE_GOT
- %define RESTORE_GOT pop %1
- %endmacro
- %elifidn __OUTPUT_FORMAT__,macho32
- %define GET_GOT_SAVE_ARG 1
- %macro GET_GOT 1
- push %1
- call %%get_got
- %%get_got:
- pop %1
- %undef GLOBAL
- %define GLOBAL(x) x + %1 - %%get_got
- %undef RESTORE_GOT
- %define RESTORE_GOT pop %1
- %endmacro
- %endif
- %endif
-
- %ifdef CHROMIUM
- %ifidn __OUTPUT_FORMAT__,macho32
- %define HIDDEN_DATA(x) x:private_extern
- %else
- %define HIDDEN_DATA(x) x
- %endif
- %else
- %define HIDDEN_DATA(x) x
- %endif
-%else
- %macro GET_GOT 1
- %endmacro
- %define GLOBAL(x) rel x
- %ifidn __OUTPUT_FORMAT__,elf64
- %define WRT_PLT wrt ..plt
- %define HIDDEN_DATA(x) x:data hidden
- %elifidn __OUTPUT_FORMAT__,elfx32
- %define WRT_PLT wrt ..plt
- %define HIDDEN_DATA(x) x:data hidden
- %elifidn __OUTPUT_FORMAT__,macho64
- %ifdef CHROMIUM
- %define HIDDEN_DATA(x) x:private_extern
- %else
- %define HIDDEN_DATA(x) x
- %endif
- %else
- %define HIDDEN_DATA(x) x
- %endif
-%endif
-%ifnmacro GET_GOT
- %macro GET_GOT 1
- %endmacro
- %define GLOBAL(x) x
-%endif
-%ifndef RESTORE_GOT
-%define RESTORE_GOT
-%endif
-%ifndef WRT_PLT
-%define WRT_PLT
-%endif
-
-%if ABI_IS_32BIT
- %macro SHADOW_ARGS_TO_STACK 1
- %endm
- %define UNSHADOW_ARGS
-%else
-%if LIBVPX_YASM_WIN64
- %macro SHADOW_ARGS_TO_STACK 1 ; argc
- %if %1 > 0
- mov arg(0),rcx
- %endif
- %if %1 > 1
- mov arg(1),rdx
- %endif
- %if %1 > 2
- mov arg(2),r8
- %endif
- %if %1 > 3
- mov arg(3),r9
- %endif
- %endm
-%else
- %macro SHADOW_ARGS_TO_STACK 1 ; argc
- %if %1 > 0
- push rdi
- %endif
- %if %1 > 1
- push rsi
- %endif
- %if %1 > 2
- push rdx
- %endif
- %if %1 > 3
- push rcx
- %endif
- %if %1 > 4
- push r8
- %endif
- %if %1 > 5
- push r9
- %endif
- %if %1 > 6
- %assign i %1-6
- %assign off 16
- %rep i
- mov rax,[rbp+off]
- push rax
- %assign off off+8
- %endrep
- %endif
- %endm
-%endif
- %define UNSHADOW_ARGS mov rsp, rbp
-%endif
-
-; Win64 ABI requires that XMM6:XMM15 are callee saved
-; SAVE_XMM n, [u]
-; store registers 6-n on the stack
-; if u is specified, use unaligned movs.
-; Win64 ABI requires 16 byte stack alignment, but then pushes an 8 byte return
-; value. Typically we follow this up with 'push rbp' - re-aligning the stack -
-; but in some cases this is not done and unaligned movs must be used.
-%if LIBVPX_YASM_WIN64
-%macro SAVE_XMM 1-2 a
- %if %1 < 6
- %error Only xmm registers 6-15 must be preserved
- %else
- %assign last_xmm %1
- %define movxmm movdq %+ %2
- %assign xmm_stack_space ((last_xmm - 5) * 16)
- sub rsp, xmm_stack_space
- %assign i 6
- %rep (last_xmm - 5)
- movxmm [rsp + ((i - 6) * 16)], xmm %+ i
- %assign i i+1
- %endrep
- %endif
-%endmacro
-%macro RESTORE_XMM 0
- %ifndef last_xmm
- %error RESTORE_XMM must be paired with SAVE_XMM n
- %else
- %assign i last_xmm
- %rep (last_xmm - 5)
- movxmm xmm %+ i, [rsp +((i - 6) * 16)]
- %assign i i-1
- %endrep
- add rsp, xmm_stack_space
- ; there are a couple functions which return from multiple places.
- ; otherwise, we could uncomment these:
- ; %undef last_xmm
- ; %undef xmm_stack_space
- ; %undef movxmm
- %endif
-%endmacro
-%else
-%macro SAVE_XMM 1-2
-%endmacro
-%macro RESTORE_XMM 0
-%endmacro
-%endif
-
-; Name of the rodata section
-;
-; .rodata seems to be an elf-ism, as it doesn't work on OSX.
-;
-%ifidn __OUTPUT_FORMAT__,macho64
-%define SECTION_RODATA section .text
-%elifidn __OUTPUT_FORMAT__,macho32
-%macro SECTION_RODATA 0
-section .text
-%endmacro
-%elifidn __OUTPUT_FORMAT__,aout
-%define SECTION_RODATA section .data
-%else
-%define SECTION_RODATA section .rodata
-%endif
-
-
-; Tell GNU ld that we don't require an executable stack.
-%ifidn __OUTPUT_FORMAT__,elf32
-section .note.GNU-stack noalloc noexec nowrite progbits
-section .text
-%elifidn __OUTPUT_FORMAT__,elf64
-section .note.GNU-stack noalloc noexec nowrite progbits
-section .text
-%elifidn __OUTPUT_FORMAT__,elfx32
-section .note.GNU-stack noalloc noexec nowrite progbits
-section .text
-%endif
-
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm b/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
deleted file mode 100644
index 696f47a..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
+++ /dev/null
@@ -1,233 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_yv12_copy_frame_func_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- INCLUDE vpx_scale_asm_offsets.asm
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-
-;void vp8_yv12_copy_frame_func_neon(const YV12_BUFFER_CONFIG *src_ybc,
-; YV12_BUFFER_CONFIG *dst_ybc);
-
-|vp8_yv12_copy_frame_func_neon| PROC
- push {r4 - r11, lr}
- vpush {d8 - d15}
-
- sub sp, sp, #16
-
- ;Copy Y plane
- ldr r8, [r0, #yv12_buffer_config_u_buffer] ;srcptr1
- ldr r9, [r1, #yv12_buffer_config_u_buffer] ;srcptr1
- ldr r10, [r0, #yv12_buffer_config_v_buffer] ;srcptr1
- ldr r11, [r1, #yv12_buffer_config_v_buffer] ;srcptr1
-
- ldr r4, [r0, #yv12_buffer_config_y_height]
- ldr r5, [r0, #yv12_buffer_config_y_width]
- ldr r6, [r0, #yv12_buffer_config_y_stride]
- ldr r7, [r1, #yv12_buffer_config_y_stride]
- ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1
- ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1
-
- str r8, [sp]
- str r9, [sp, #4]
- str r10, [sp, #8]
- str r11, [sp, #12]
-
- ; copy two rows at one time
- mov lr, r4, lsr #1
-
-cp_src_to_dst_height_loop
- mov r8, r2
- mov r9, r3
- add r10, r2, r6
- add r11, r3, r7
- movs r12, r5, lsr #7
- ble extra_cp_needed ; y_width < 128
-
-cp_src_to_dst_width_loop
- vld1.8 {q0, q1}, [r8]!
- vld1.8 {q8, q9}, [r10]!
- vld1.8 {q2, q3}, [r8]!
- vld1.8 {q10, q11}, [r10]!
- vld1.8 {q4, q5}, [r8]!
- vld1.8 {q12, q13}, [r10]!
- vld1.8 {q6, q7}, [r8]!
- vld1.8 {q14, q15}, [r10]!
-
- subs r12, r12, #1
-
- vst1.8 {q0, q1}, [r9]!
- vst1.8 {q8, q9}, [r11]!
- vst1.8 {q2, q3}, [r9]!
- vst1.8 {q10, q11}, [r11]!
- vst1.8 {q4, q5}, [r9]!
- vst1.8 {q12, q13}, [r11]!
- vst1.8 {q6, q7}, [r9]!
- vst1.8 {q14, q15}, [r11]!
-
- bne cp_src_to_dst_width_loop
-
- subs lr, lr, #1
- add r2, r2, r6, lsl #1
- add r3, r3, r7, lsl #1
-
- bne cp_src_to_dst_height_loop
-
-extra_cp_needed
- ands r10, r5, #0x7f ;check to see if extra copy is needed
- sub r11, r5, r10
- ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1
- ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1
- bne extra_cp_src_to_dst_width
-end_of_cp_src_to_dst
-
-;Copy U & V planes
- ldr r2, [sp] ;srcptr1
- ldr r3, [sp, #4] ;dstptr1
- mov r4, r4, lsr #1 ;src uv_height
- mov r5, r5, lsr #1 ;src uv_width
- mov r6, r6, lsr #1 ;src uv_stride
- mov r7, r7, lsr #1 ;dst uv_stride
-
- mov r1, #2
-
-cp_uv_loop
-
- ;copy two rows at one time
- mov lr, r4, lsr #1
-
-cp_src_to_dst_height_uv_loop
- mov r8, r2
- mov r9, r3
- add r10, r2, r6
- add r11, r3, r7
- movs r12, r5, lsr #6
- ble extra_uv_cp_needed
-
-cp_src_to_dst_width_uv_loop
- vld1.8 {q0, q1}, [r8]!
- vld1.8 {q8, q9}, [r10]!
- vld1.8 {q2, q3}, [r8]!
- vld1.8 {q10, q11}, [r10]!
-
- subs r12, r12, #1
-
- vst1.8 {q0, q1}, [r9]!
- vst1.8 {q8, q9}, [r11]!
- vst1.8 {q2, q3}, [r9]!
- vst1.8 {q10, q11}, [r11]!
-
- bne cp_src_to_dst_width_uv_loop
-
- subs lr, lr, #1
- add r2, r2, r6, lsl #1
- add r3, r3, r7, lsl #1
-
- bne cp_src_to_dst_height_uv_loop
-
-extra_uv_cp_needed
- ands r10, r5, #0x3f ;check to see if extra copy is needed
- sub r11, r5, r10
- ldr r2, [sp] ;srcptr1
- ldr r3, [sp, #4] ;dstptr1
- bne extra_cp_src_to_dst_uv_width
-end_of_cp_src_to_dst_uv
-
- subs r1, r1, #1
-
- addne sp, sp, #8
-
- ldrne r2, [sp] ;srcptr1
- ldrne r3, [sp, #4] ;dstptr1
-
- bne cp_uv_loop
-
- add sp, sp, #8
-
- vpop {d8 - d15}
- pop {r4 - r11, pc}
-
-;=============================
-extra_cp_src_to_dst_width
- add r2, r2, r11
- add r3, r3, r11
- add r0, r8, r6
- add r11, r9, r7
-
- mov lr, r4, lsr #1
-extra_cp_src_to_dst_height_loop
- mov r8, r2
- mov r9, r3
- add r0, r8, r6
- add r11, r9, r7
-
- mov r12, r10
-
-extra_cp_src_to_dst_width_loop
- vld1.8 {q0}, [r8]!
- vld1.8 {q1}, [r0]!
-
- subs r12, r12, #16
-
- vst1.8 {q0}, [r9]!
- vst1.8 {q1}, [r11]!
- bne extra_cp_src_to_dst_width_loop
-
- subs lr, lr, #1
-
- add r2, r2, r6, lsl #1
- add r3, r3, r7, lsl #1
-
- bne extra_cp_src_to_dst_height_loop
-
- b end_of_cp_src_to_dst
-
-;=================================
-extra_cp_src_to_dst_uv_width
- add r2, r2, r11
- add r3, r3, r11
- add r0, r8, r6
- add r11, r9, r7
-
- mov lr, r4, lsr #1
-extra_cp_src_to_dst_height_uv_loop
- mov r8, r2
- mov r9, r3
- add r0, r8, r6
- add r11, r9, r7
-
- mov r12, r10
-
-extra_cp_src_to_dst_width_uv_loop
- vld1.8 {d0}, [r8]!
- vld1.8 {d1}, [r0]!
-
- subs r12, r12, #8
-
- vst1.8 {d0}, [r9]!
- vst1.8 {d1}, [r11]!
- bne extra_cp_src_to_dst_width_uv_loop
-
- subs lr, lr, #1
-
- add r2, r2, r6, lsl #1
- add r3, r3, r7, lsl #1
-
- bne extra_cp_src_to_dst_height_uv_loop
-
- b end_of_cp_src_to_dst_uv
-
- ENDP
- END
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm b/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
deleted file mode 100644
index d3306b6..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
+++ /dev/null
@@ -1,259 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_yv12_copy_src_frame_func_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- INCLUDE vpx_scale_asm_offsets.asm
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-;Note: This function is used to copy source data in src_buffer[i] at beginning
-;of the encoding. The buffer has a width and height of cpi->oxcf.Width and
-;cpi->oxcf.Height, which can be ANY numbers(NOT always multiples of 16 or 4).
-
-;void vp8_yv12_copy_src_frame_func_neon(const YV12_BUFFER_CONFIG *src_ybc,
-; YV12_BUFFER_CONFIG *dst_ybc);
-
-|vp8_yv12_copy_src_frame_func_neon| PROC
- push {r4 - r11, lr}
- vpush {d8 - d15}
-
- ;Copy Y plane
- ldr r4, [r0, #yv12_buffer_config_y_height]
- ldr r5, [r0, #yv12_buffer_config_y_width]
- ldr r6, [r0, #yv12_buffer_config_y_stride]
- ldr r7, [r1, #yv12_buffer_config_y_stride]
- ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1
- ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1
-
- add r10, r2, r6 ;second row src
- add r11, r3, r7 ;second row dst
- mov r6, r6, lsl #1
- mov r7, r7, lsl #1
- sub r6, r6, r5 ;adjust stride
- sub r7, r7, r5
-
- ; copy two rows at one time
- mov lr, r4, lsr #1
-
-cp_src_to_dst_height_loop
- mov r12, r5
-
-cp_width_128_loop
- vld1.8 {q0, q1}, [r2]!
- vld1.8 {q4, q5}, [r10]!
- vld1.8 {q2, q3}, [r2]!
- vld1.8 {q6, q7}, [r10]!
- vld1.8 {q8, q9}, [r2]!
- vld1.8 {q12, q13}, [r10]!
- vld1.8 {q10, q11}, [r2]!
- vld1.8 {q14, q15}, [r10]!
- sub r12, r12, #128
- cmp r12, #128
- vst1.8 {q0, q1}, [r3]!
- vst1.8 {q4, q5}, [r11]!
- vst1.8 {q2, q3}, [r3]!
- vst1.8 {q6, q7}, [r11]!
- vst1.8 {q8, q9}, [r3]!
- vst1.8 {q12, q13}, [r11]!
- vst1.8 {q10, q11}, [r3]!
- vst1.8 {q14, q15}, [r11]!
- bhs cp_width_128_loop
-
- cmp r12, #0
- beq cp_width_done
-
-cp_width_8_loop
- vld1.8 {d0}, [r2]!
- vld1.8 {d1}, [r10]!
- sub r12, r12, #8
- cmp r12, #8
- vst1.8 {d0}, [r3]!
- vst1.8 {d1}, [r11]!
- bhs cp_width_8_loop
-
- cmp r12, #0
- beq cp_width_done
-
-cp_width_1_loop
- ldrb r8, [r2], #1
- subs r12, r12, #1
- strb r8, [r3], #1
- ldrb r8, [r10], #1
- strb r8, [r11], #1
- bne cp_width_1_loop
-
-cp_width_done
- subs lr, lr, #1
- add r2, r2, r6
- add r3, r3, r7
- add r10, r10, r6
- add r11, r11, r7
- bne cp_src_to_dst_height_loop
-
-;copy last line for Y if y_height is odd
- tst r4, #1
- beq cp_width_done_1
- mov r12, r5
-
-cp_width_128_loop_1
- vld1.8 {q0, q1}, [r2]!
- vld1.8 {q2, q3}, [r2]!
- vld1.8 {q8, q9}, [r2]!
- vld1.8 {q10, q11}, [r2]!
- sub r12, r12, #128
- cmp r12, #128
- vst1.8 {q0, q1}, [r3]!
- vst1.8 {q2, q3}, [r3]!
- vst1.8 {q8, q9}, [r3]!
- vst1.8 {q10, q11}, [r3]!
- bhs cp_width_128_loop_1
-
- cmp r12, #0
- beq cp_width_done_1
-
-cp_width_8_loop_1
- vld1.8 {d0}, [r2]!
- sub r12, r12, #8
- cmp r12, #8
- vst1.8 {d0}, [r3]!
- bhs cp_width_8_loop_1
-
- cmp r12, #0
- beq cp_width_done_1
-
-cp_width_1_loop_1
- ldrb r8, [r2], #1
- subs r12, r12, #1
- strb r8, [r3], #1
- bne cp_width_1_loop_1
-cp_width_done_1
-
-;Copy U & V planes
- ldr r4, [r0, #yv12_buffer_config_uv_height]
- ldr r5, [r0, #yv12_buffer_config_uv_width]
- ldr r6, [r0, #yv12_buffer_config_uv_stride]
- ldr r7, [r1, #yv12_buffer_config_uv_stride]
- ldr r2, [r0, #yv12_buffer_config_u_buffer] ;srcptr1
- ldr r3, [r1, #yv12_buffer_config_u_buffer] ;dstptr1
-
- add r10, r2, r6 ;second row src
- add r11, r3, r7 ;second row dst
- mov r6, r6, lsl #1
- mov r7, r7, lsl #1
- sub r6, r6, r5 ;adjust stride
- sub r7, r7, r5
-
- mov r9, #2
-
-cp_uv_loop
- ;copy two rows at one time
- mov lr, r4, lsr #1
-
-cp_src_to_dst_height_uv_loop
- mov r12, r5
-
-cp_width_uv_64_loop
- vld1.8 {q0, q1}, [r2]!
- vld1.8 {q4, q5}, [r10]!
- vld1.8 {q2, q3}, [r2]!
- vld1.8 {q6, q7}, [r10]!
- sub r12, r12, #64
- cmp r12, #64
- vst1.8 {q0, q1}, [r3]!
- vst1.8 {q4, q5}, [r11]!
- vst1.8 {q2, q3}, [r3]!
- vst1.8 {q6, q7}, [r11]!
- bhs cp_width_uv_64_loop
-
- cmp r12, #0
- beq cp_width_uv_done
-
-cp_width_uv_8_loop
- vld1.8 {d0}, [r2]!
- vld1.8 {d1}, [r10]!
- sub r12, r12, #8
- cmp r12, #8
- vst1.8 {d0}, [r3]!
- vst1.8 {d1}, [r11]!
- bhs cp_width_uv_8_loop
-
- cmp r12, #0
- beq cp_width_uv_done
-
-cp_width_uv_1_loop
- ldrb r8, [r2], #1
- subs r12, r12, #1
- strb r8, [r3], #1
- ldrb r8, [r10], #1
- strb r8, [r11], #1
- bne cp_width_uv_1_loop
-
-cp_width_uv_done
- subs lr, lr, #1
- add r2, r2, r6
- add r3, r3, r7
- add r10, r10, r6
- add r11, r11, r7
- bne cp_src_to_dst_height_uv_loop
-
-;copy last line for U & V if uv_height is odd
- tst r4, #1
- beq cp_width_uv_done_1
- mov r12, r5
-
-cp_width_uv_64_loop_1
- vld1.8 {q0, q1}, [r2]!
- vld1.8 {q2, q3}, [r2]!
- sub r12, r12, #64
- cmp r12, #64
- vst1.8 {q0, q1}, [r3]!
- vst1.8 {q2, q3}, [r3]!
- bhs cp_width_uv_64_loop_1
-
- cmp r12, #0
- beq cp_width_uv_done_1
-
-cp_width_uv_8_loop_1
- vld1.8 {d0}, [r2]!
- sub r12, r12, #8
- cmp r12, #8
- vst1.8 {d0}, [r3]!
- bhs cp_width_uv_8_loop_1
-
- cmp r12, #0
- beq cp_width_uv_done_1
-
-cp_width_uv_1_loop_1
- ldrb r8, [r2], #1
- subs r12, r12, #1
- strb r8, [r3], #1
- bne cp_width_uv_1_loop_1
-cp_width_uv_done_1
-
- subs r9, r9, #1
- ldrne r2, [r0, #yv12_buffer_config_v_buffer] ;srcptr1
- ldrne r3, [r1, #yv12_buffer_config_v_buffer] ;dstptr1
- ldrne r10, [r0, #yv12_buffer_config_uv_stride]
- ldrne r11, [r1, #yv12_buffer_config_uv_stride]
-
- addne r10, r2, r10 ;second row src
- addne r11, r3, r11 ;second row dst
-
- bne cp_uv_loop
-
- vpop {d8 - d15}
- pop {r4 - r11, pc}
-
- ENDP
- END
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm b/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
deleted file mode 100644
index b2eb9eb..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
+++ /dev/null
@@ -1,308 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_yv12_extend_frame_borders_neon|
- ARM
- REQUIRE8
- PRESERVE8
-
- INCLUDE vpx_scale_asm_offsets.asm
-
- AREA ||.text||, CODE, READONLY, ALIGN=2
-;void vp8_yv12_extend_frame_borders_neon (YV12_BUFFER_CONFIG *ybf);
-; we depend on VP8BORDERINPIXELS being 32
-
-|vp8_yv12_extend_frame_borders_neon| PROC
- push {r4 - r10, lr}
- vpush {d8 - d15}
-
- ; Border = 32
- ldr r3, [r0, #yv12_buffer_config_y_width] ; plane_width
- ldr r1, [r0, #yv12_buffer_config_y_buffer] ; src_ptr1
- ldr r4, [r0, #yv12_buffer_config_y_height] ; plane_height
- ldr lr, [r0, #yv12_buffer_config_y_stride] ; plane_stride
-
-; Border copy for Y plane
-; copy the left and right most columns out
- add r6, r1, r3 ; dest_ptr2 = src_ptr2 + 1 (src_ptr1 + plane_width)
- sub r2, r6, #1 ; src_ptr2 = src_ptr1 + plane_width - 1
- sub r5, r1, #32 ; dest_ptr1 = src_ptr1 - Border
-
- mov r12, r4, lsr #2 ; plane_height / 4
-
-copy_left_right_y
- vld1.8 {d0[], d1[]}, [r1], lr
- vld1.8 {d4[], d5[]}, [r2], lr
- vld1.8 {d8[], d9[]}, [r1], lr
- vld1.8 {d12[], d13[]}, [r2], lr
- vld1.8 {d16[], d17[]}, [r1], lr
- vld1.8 {d20[], d21[]}, [r2], lr
- vld1.8 {d24[], d25[]}, [r1], lr
- vld1.8 {d28[], d29[]}, [r2], lr
-
- vmov q1, q0
- vmov q3, q2
- vmov q5, q4
- vmov q7, q6
- vmov q9, q8
- vmov q11, q10
- vmov q13, q12
- vmov q15, q14
-
- subs r12, r12, #1
-
- vst1.8 {q0, q1}, [r5], lr
- vst1.8 {q2, q3}, [r6], lr
- vst1.8 {q4, q5}, [r5], lr
- vst1.8 {q6, q7}, [r6], lr
- vst1.8 {q8, q9}, [r5], lr
- vst1.8 {q10, q11}, [r6], lr
- vst1.8 {q12, q13}, [r5], lr
- vst1.8 {q14, q15}, [r6], lr
-
- bne copy_left_right_y
-
-;Now copy the top and bottom source lines into each line of the respective borders
- ldr r1, [r0, #yv12_buffer_config_y_buffer] ; y_buffer
- mul r8, r4, lr ; plane_height * plane_stride
-
- ; copy width is plane_stride
- movs r12, lr, lsr #7 ; plane_stride / 128
-
- sub r1, r1, #32 ; src_ptr1 = y_buffer - Border
- add r6, r1, r8 ; dest_ptr2 = src_ptr2 - plane_stride (src_ptr1 + (plane_height * plane_stride))
- sub r2, r6, lr ; src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride
- sub r5, r1, lr, asl #5 ; dest_ptr1 = src_ptr1 - (Border * plane_stride)
- ble extra_y_copy_needed ; plane stride < 128
-
-copy_top_bottom_y
- vld1.8 {q0, q1}, [r1]!
- vld1.8 {q8, q9}, [r2]!
- vld1.8 {q2, q3}, [r1]!
- vld1.8 {q10, q11}, [r2]!
- vld1.8 {q4, q5}, [r1]!
- vld1.8 {q12, q13}, [r2]!
- vld1.8 {q6, q7}, [r1]!
- vld1.8 {q14, q15}, [r2]!
-
- mov r7, #32 ; Border
-
-top_bottom_32
- subs r7, r7, #1
-
- vst1.8 {q0, q1}, [r5]!
- vst1.8 {q8, q9}, [r6]!
- vst1.8 {q2, q3}, [r5]!
- vst1.8 {q10, q11}, [r6]!
- vst1.8 {q4, q5}, [r5]!
- vst1.8 {q12, q13}, [r6]!
- vst1.8 {q6, q7}, [r5]!
- vst1.8 {q14, q15}, [r6]!
-
- add r5, r5, lr ; dest_ptr1 += plane_stride
- sub r5, r5, #128 ; dest_ptr1 -= 128
- add r6, r6, lr ; dest_ptr2 += plane_stride
- sub r6, r6, #128 ; dest_ptr2 -= 128
-
- bne top_bottom_32
-
- sub r5, r1, lr, asl #5 ; src_ptr1 - (Border* plane_stride)
- add r6, r2, lr ; src_ptr2 + plane_stride
-
- subs r12, r12, #1
- bne copy_top_bottom_y
-
-extra_y_copy_needed
- mov r7, lr, lsr #4 ; check to see if extra copy is needed
- ands r7, r7, #0x7
- bne extra_top_bottom_y
-end_of_border_copy_y
-
-;Border copy for U, V planes
-; Border = 16
- ldr r7, [r0, #yv12_buffer_config_u_buffer] ; src_ptr1
- ldr lr, [r0, #yv12_buffer_config_uv_stride] ; plane_stride
- ldr r3, [r0, #yv12_buffer_config_uv_width] ; plane_width
- ldr r4, [r0, #yv12_buffer_config_uv_height] ; plane_height
-
- mov r10, #2
-
-;copy the left and right most columns out
-border_copy_uv
- mov r1, r7 ; src_ptr1 needs to be saved for second half of loop
- sub r5, r1, #16 ; dest_ptr1 = src_ptr1 - Border
- add r6, r1, r3 ; dest_ptr2 = src_ptr2 + 1 (src_ptr1 + plane_width)
- sub r2, r6, #1 ; src_ptr2 = src_ptr1 + plane_width - 1
-
- mov r12, r4, lsr #3 ; plane_height / 8
-
-copy_left_right_uv
- vld1.8 {d0[], d1[]}, [r1], lr
- vld1.8 {d2[], d3[]}, [r2], lr
- vld1.8 {d4[], d5[]}, [r1], lr
- vld1.8 {d6[], d7[]}, [r2], lr
- vld1.8 {d8[], d9[]}, [r1], lr
- vld1.8 {d10[], d11[]}, [r2], lr
- vld1.8 {d12[], d13[]}, [r1], lr
- vld1.8 {d14[], d15[]}, [r2], lr
- vld1.8 {d16[], d17[]}, [r1], lr
- vld1.8 {d18[], d19[]}, [r2], lr
- vld1.8 {d20[], d21[]}, [r1], lr
- vld1.8 {d22[], d23[]}, [r2], lr
- vld1.8 {d24[], d25[]}, [r1], lr
- vld1.8 {d26[], d27[]}, [r2], lr
- vld1.8 {d28[], d29[]}, [r1], lr
- vld1.8 {d30[], d31[]}, [r2], lr
-
- subs r12, r12, #1
-
- vst1.8 {q0}, [r5], lr
- vst1.8 {q1}, [r6], lr
- vst1.8 {q2}, [r5], lr
- vst1.8 {q3}, [r6], lr
- vst1.8 {q4}, [r5], lr
- vst1.8 {q5}, [r6], lr
- vst1.8 {q6}, [r5], lr
- vst1.8 {q7}, [r6], lr
- vst1.8 {q8}, [r5], lr
- vst1.8 {q9}, [r6], lr
- vst1.8 {q10}, [r5], lr
- vst1.8 {q11}, [r6], lr
- vst1.8 {q12}, [r5], lr
- vst1.8 {q13}, [r6], lr
- vst1.8 {q14}, [r5], lr
- vst1.8 {q15}, [r6], lr
-
- bne copy_left_right_uv
-
-;Now copy the top and bottom source lines into each line of the respective borders
- mov r1, r7
- mul r8, r4, lr ; plane_height * plane_stride
- movs r12, lr, lsr #6 ; plane_stride / 64
-
- sub r1, r1, #16 ; src_ptr1 = u_buffer - Border
- add r6, r1, r8 ; dest_ptr2 = src_ptr2 + plane_stride (src_ptr1 + (plane_height * plane_stride)
- sub r2, r6, lr ; src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride
- sub r5, r1, lr, asl #4 ; dest_ptr1 = src_ptr1 - (Border * plane_stride)
- ble extra_uv_copy_needed ; plane_stride < 64
-
-copy_top_bottom_uv
- vld1.8 {q0, q1}, [r1]!
- vld1.8 {q8, q9}, [r2]!
- vld1.8 {q2, q3}, [r1]!
- vld1.8 {q10, q11}, [r2]!
-
- mov r7, #16 ; Border
-
-top_bottom_16
- subs r7, r7, #1
-
- vst1.8 {q0, q1}, [r5]!
- vst1.8 {q8, q9}, [r6]!
- vst1.8 {q2, q3}, [r5]!
- vst1.8 {q10, q11}, [r6]!
-
- add r5, r5, lr ; dest_ptr1 += plane_stride
- sub r5, r5, #64
- add r6, r6, lr ; dest_ptr2 += plane_stride
- sub r6, r6, #64
-
- bne top_bottom_16
-
- sub r5, r1, lr, asl #4 ; dest_ptr1 = src_ptr1 - (Border * plane_stride)
- add r6, r2, lr ; dest_ptr2 = src_ptr2 + plane_stride
-
- subs r12, r12, #1
- bne copy_top_bottom_uv
-extra_uv_copy_needed
- mov r7, lr, lsr #3 ; check to see if extra copy is needed
- ands r7, r7, #0x7
- bne extra_top_bottom_uv
-
-end_of_border_copy_uv
- subs r10, r10, #1
- ldrne r7, [r0, #yv12_buffer_config_v_buffer] ; src_ptr1
- bne border_copy_uv
-
- vpop {d8 - d15}
- pop {r4 - r10, pc}
-
-;;;;;;;;;;;;;;;;;;;;;;
-extra_top_bottom_y
- vld1.8 {q0}, [r1]!
- vld1.8 {q2}, [r2]!
-
- mov r9, #4 ; 32 >> 3
-
-extra_top_bottom_32
- subs r9, r9, #1
-
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- vst1.8 {q0}, [r5], lr
- vst1.8 {q2}, [r6], lr
- bne extra_top_bottom_32
-
- sub r5, r1, lr, asl #5 ; src_ptr1 - (Border * plane_stride)
- add r6, r2, lr ; src_ptr2 + plane_stride
- subs r7, r7, #1
- bne extra_top_bottom_y
-
- b end_of_border_copy_y
-
-extra_top_bottom_uv
- vld1.8 {d0}, [r1]!
- vld1.8 {d8}, [r2]!
-
- mov r9, #2 ; 16 >> 3
-
-extra_top_bottom_16
- subs r9, r9, #1
-
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- vst1.8 {d0}, [r5], lr
- vst1.8 {d8}, [r6], lr
- bne extra_top_bottom_16
-
- sub r5, r1, lr, asl #4 ; src_ptr1 - (Border * plane_stride)
- add r6, r2, lr ; src_ptr2 + plane_stride
- subs r7, r7, #1
- bne extra_top_bottom_uv
-
- b end_of_border_copy_uv
-
- ENDP
- END
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/yv12extend_arm.c b/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/yv12extend_arm.c
deleted file mode 100644
index fac7bbc..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/arm/neon/yv12extend_arm.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpx_scale_rtcd.h"
-
-extern void vp8_yv12_copy_frame_func_neon(
- const struct yv12_buffer_config *src_ybc,
- struct yv12_buffer_config *dst_ybc);
-
-void vp8_yv12_copy_frame_neon(const struct yv12_buffer_config *src_ybc,
- struct yv12_buffer_config *dst_ybc) {
- vp8_yv12_copy_frame_func_neon(src_ybc, dst_ybc);
- vp8_yv12_extend_frame_borders_neon(dst_ybc);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/gen_scalers.c b/videocodec/libvpx_internal/libvpx/vpx_scale/generic/gen_scalers.c
deleted file mode 100644
index 5f355c5..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/gen_scalers.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "vpx_scale/vpx_scale.h"
-#include "vpx_mem/vpx_mem.h"
-/****************************************************************************
-* Imports
-****************************************************************************/
-
-/****************************************************************************
- *
- *
- * INPUTS : const unsigned char *source : Pointer to source data.
- * unsigned int source_width : Stride of source.
- * unsigned char *dest : Pointer to destination data.
- * unsigned int dest_width : Stride of destination (NOT USED).
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Copies horizontal line of pixels from source to
- * destination scaling up by 4 to 5.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-void vp8_horizontal_line_5_4_scale_c(const unsigned char *source,
- unsigned int source_width,
- unsigned char *dest,
- unsigned int dest_width) {
- unsigned i;
- unsigned int a, b, c, d, e;
- unsigned char *des = dest;
- const unsigned char *src = source;
-
- (void) dest_width;
-
- for (i = 0; i < source_width; i += 5) {
- a = src[0];
- b = src[1];
- c = src[2];
- d = src[3];
- e = src[4];
-
- des[0] = (unsigned char) a;
- des[1] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
- des[2] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
- des[3] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
-
- src += 5;
- des += 4;
- }
-}
-
-
-
-
-void vp8_vertical_band_5_4_scale_c(unsigned char *source,
- unsigned int src_pitch,
- unsigned char *dest,
- unsigned int dest_pitch,
- unsigned int dest_width) {
- unsigned int i;
- unsigned int a, b, c, d, e;
- unsigned char *des = dest;
- unsigned char *src = source;
-
- for (i = 0; i < dest_width; i++) {
-
- a = src[0 * src_pitch];
- b = src[1 * src_pitch];
- c = src[2 * src_pitch];
- d = src[3 * src_pitch];
- e = src[4 * src_pitch];
-
- des[0 * dest_pitch] = (unsigned char) a;
- des[1 * dest_pitch] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
- des[2 * dest_pitch] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
- des[3 * dest_pitch] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
-
- src++;
- des++;
-
- }
-}
-
-
-/*7***************************************************************************
- *
- * ROUTINE : vp8_horizontal_line_3_5_scale_c
- *
- * INPUTS : const unsigned char *source : Pointer to source data.
- * unsigned int source_width : Stride of source.
- * unsigned char *dest : Pointer to destination data.
- * unsigned int dest_width : Stride of destination (NOT USED).
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Copies horizontal line of pixels from source to
- * destination scaling up by 3 to 5.
- *
- * SPECIAL NOTES : None.
- *
- *
- ****************************************************************************/
-void vp8_horizontal_line_5_3_scale_c(const unsigned char *source,
- unsigned int source_width,
- unsigned char *dest,
- unsigned int dest_width) {
- unsigned int i;
- unsigned int a, b, c, d, e;
- unsigned char *des = dest;
- const unsigned char *src = source;
-
- (void) dest_width;
-
- for (i = 0; i < source_width; i += 5) {
- a = src[0];
- b = src[1];
- c = src[2];
- d = src[3];
- e = src[4];
-
- des[0] = (unsigned char) a;
- des[1] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
- des[2] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
-
- src += 5;
- des += 3;
- }
-
-}
-
-void vp8_vertical_band_5_3_scale_c(unsigned char *source,
- unsigned int src_pitch,
- unsigned char *dest,
- unsigned int dest_pitch,
- unsigned int dest_width) {
- unsigned int i;
- unsigned int a, b, c, d, e;
- unsigned char *des = dest;
- unsigned char *src = source;
-
- for (i = 0; i < dest_width; i++) {
-
- a = src[0 * src_pitch];
- b = src[1 * src_pitch];
- c = src[2 * src_pitch];
- d = src[3 * src_pitch];
- e = src[4 * src_pitch];
-
- des[0 * dest_pitch] = (unsigned char) a;
- des[1 * dest_pitch] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
- des[2 * dest_pitch] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
-
- src++;
- des++;
-
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : vp8_horizontal_line_1_2_scale_c
- *
- * INPUTS : const unsigned char *source : Pointer to source data.
- * unsigned int source_width : Stride of source.
- * unsigned char *dest : Pointer to destination data.
- * unsigned int dest_width : Stride of destination (NOT USED).
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Copies horizontal line of pixels from source to
- * destination scaling up by 1 to 2.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-void vp8_horizontal_line_2_1_scale_c(const unsigned char *source,
- unsigned int source_width,
- unsigned char *dest,
- unsigned int dest_width) {
- unsigned int i;
- unsigned int a;
- unsigned char *des = dest;
- const unsigned char *src = source;
-
- (void) dest_width;
-
- for (i = 0; i < source_width; i += 2) {
- a = src[0];
- des [0] = (unsigned char)(a);
- src += 2;
- des += 1;
- }
-}
-
-void vp8_vertical_band_2_1_scale_c(unsigned char *source,
- unsigned int src_pitch,
- unsigned char *dest,
- unsigned int dest_pitch,
- unsigned int dest_width) {
- (void) dest_pitch;
- (void) src_pitch;
- vpx_memcpy(dest, source, dest_width);
-}
-
-void vp8_vertical_band_2_1_scale_i_c(unsigned char *source,
- unsigned int src_pitch,
- unsigned char *dest,
- unsigned int dest_pitch,
- unsigned int dest_width) {
- int i;
- int temp;
- int width = dest_width;
-
- (void) dest_pitch;
-
- for (i = 0; i < width; i++) {
- temp = 8;
- temp += source[i - (int)src_pitch] * 3;
- temp += source[i] * 10;
- temp += source[i + src_pitch] * 3;
- temp >>= 4;
- dest[i] = (unsigned char)(temp);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/vpx_scale.c b/videocodec/libvpx_internal/libvpx/vpx_scale/generic/vpx_scale.c
deleted file mode 100644
index 8044d2a..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/vpx_scale.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
- *
- * Module Title : scale.c
- *
- * Description : Image scaling functions.
- *
- ***************************************************************************/
-
-/****************************************************************************
-* Header Files
-****************************************************************************/
-#include "./vpx_scale_rtcd.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_scale/yv12config.h"
-
-typedef struct {
- int expanded_frame_width;
- int expanded_frame_height;
-
- int HScale;
- int HRatio;
- int VScale;
- int VRatio;
-
- YV12_BUFFER_CONFIG *src_yuv_config;
- YV12_BUFFER_CONFIG *dst_yuv_config;
-
-} SCALE_VARS;
-
-/****************************************************************************
- *
- * ROUTINE : scale1d_2t1_i
- *
- * INPUTS : const unsigned char *source : Pointer to data to be scaled.
- * int source_step : Number of pixels to step on in source.
- * unsigned int source_scale : Scale for source (UNUSED).
- * unsigned int source_length : Length of source (UNUSED).
- * unsigned char *dest : Pointer to output data array.
- * int dest_step : Number of pixels to step on in destination.
- * unsigned int dest_scale : Scale for destination (UNUSED).
- * unsigned int dest_length : Length of destination.
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Performs 2-to-1 interpolated scaling.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-static
-void scale1d_2t1_i
-(
- const unsigned char *source,
- int source_step,
- unsigned int source_scale,
- unsigned int source_length,
- unsigned char *dest,
- int dest_step,
- unsigned int dest_scale,
- unsigned int dest_length
-) {
- unsigned int i, j;
- unsigned int temp;
- int source_pitch = source_step;
- (void) source_length;
- (void) source_scale;
- (void) dest_scale;
-
- source_step *= 2;
- dest[0] = source[0];
-
- for (i = dest_step, j = source_step; i < dest_length * dest_step; i += dest_step, j += source_step) {
- temp = 8;
- temp += 3 * source[j - source_pitch];
- temp += 10 * source[j];
- temp += 3 * source[j + source_pitch];
- temp >>= 4;
- dest[i] = (char)(temp);
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : scale1d_2t1_ps
- *
- * INPUTS : const unsigned char *source : Pointer to data to be scaled.
- * int source_step : Number of pixels to step on in source.
- * unsigned int source_scale : Scale for source (UNUSED).
- * unsigned int source_length : Length of source (UNUSED).
- * unsigned char *dest : Pointer to output data array.
- * int dest_step : Number of pixels to step on in destination.
- * unsigned int dest_scale : Scale for destination (UNUSED).
- * unsigned int dest_length : Length of destination.
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Performs 2-to-1 point subsampled scaling.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-static
-void scale1d_2t1_ps
-(
- const unsigned char *source,
- int source_step,
- unsigned int source_scale,
- unsigned int source_length,
- unsigned char *dest,
- int dest_step,
- unsigned int dest_scale,
- unsigned int dest_length
-) {
- unsigned int i, j;
-
- (void) source_length;
- (void) source_scale;
- (void) dest_scale;
-
- source_step *= 2;
- j = 0;
-
- for (i = 0; i < dest_length * dest_step; i += dest_step, j += source_step)
- dest[i] = source[j];
-}
-/****************************************************************************
- *
- * ROUTINE : scale1d_c
- *
- * INPUTS : const unsigned char *source : Pointer to data to be scaled.
- * int source_step : Number of pixels to step on in source.
- * unsigned int source_scale : Scale for source.
- * unsigned int source_length : Length of source (UNUSED).
- * unsigned char *dest : Pointer to output data array.
- * int dest_step : Number of pixels to step on in destination.
- * unsigned int dest_scale : Scale for destination.
- * unsigned int dest_length : Length of destination.
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Performs linear interpolation in one dimension.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-static
-void scale1d_c
-(
- const unsigned char *source,
- int source_step,
- unsigned int source_scale,
- unsigned int source_length,
- unsigned char *dest,
- int dest_step,
- unsigned int dest_scale,
- unsigned int dest_length
-) {
- unsigned int i;
- unsigned int round_value = dest_scale / 2;
- unsigned int left_modifier = dest_scale;
- unsigned int right_modifier = 0;
- unsigned char left_pixel = *source;
- unsigned char right_pixel = *(source + source_step);
-
- (void) source_length;
-
- /* These asserts are needed if there are boundary issues... */
- /*assert ( dest_scale > source_scale );*/
- /*assert ( (source_length-1) * dest_scale >= (dest_length-1) * source_scale );*/
-
- for (i = 0; i < dest_length * dest_step; i += dest_step) {
- dest[i] = (char)((left_modifier * left_pixel + right_modifier * right_pixel + round_value) / dest_scale);
-
- right_modifier += source_scale;
-
- while (right_modifier > dest_scale) {
- right_modifier -= dest_scale;
- source += source_step;
- left_pixel = *source;
- right_pixel = *(source + source_step);
- }
-
- left_modifier = dest_scale - right_modifier;
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : Scale2D
- *
- * INPUTS : const unsigned char *source : Pointer to data to be scaled.
- * int source_pitch : Stride of source image.
- * unsigned int source_width : Width of input image.
- * unsigned int source_height : Height of input image.
- * unsigned char *dest : Pointer to output data array.
- * int dest_pitch : Stride of destination image.
- * unsigned int dest_width : Width of destination image.
- * unsigned int dest_height : Height of destination image.
- * unsigned char *temp_area : Pointer to temp work area.
- * unsigned char temp_area_height : Height of temp work area.
- * unsigned int hscale : Horizontal scale factor numerator.
- * unsigned int hratio : Horizontal scale factor denominator.
- * unsigned int vscale : Vertical scale factor numerator.
- * unsigned int vratio : Vertical scale factor denominator.
- * unsigned int interlaced : Interlace flag.
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Performs 2-tap linear interpolation in two dimensions.
- *
- * SPECIAL NOTES : Expansion is performed one band at a time to help with
- * caching.
- *
- ****************************************************************************/
-static
-void Scale2D
-(
- /*const*/
- unsigned char *source,
- int source_pitch,
- unsigned int source_width,
- unsigned int source_height,
- unsigned char *dest,
- int dest_pitch,
- unsigned int dest_width,
- unsigned int dest_height,
- unsigned char *temp_area,
- unsigned char temp_area_height,
- unsigned int hscale,
- unsigned int hratio,
- unsigned int vscale,
- unsigned int vratio,
- unsigned int interlaced
-) {
- /*unsigned*/
- int i, j, k;
- int bands;
- int dest_band_height;
- int source_band_height;
-
- typedef void (*Scale1D)(const unsigned char * source, int source_step, unsigned int source_scale, unsigned int source_length,
- unsigned char * dest, int dest_step, unsigned int dest_scale, unsigned int dest_length);
-
- Scale1D Scale1Dv = scale1d_c;
- Scale1D Scale1Dh = scale1d_c;
-
- void (*horiz_line_scale)(const unsigned char *, unsigned int, unsigned char *, unsigned int) = NULL;
- void (*vert_band_scale)(unsigned char *, unsigned int, unsigned char *, unsigned int, unsigned int) = NULL;
-
- int ratio_scalable = 1;
- int interpolation = 0;
-
- unsigned char *source_base; /* = (unsigned char *) ((source_pitch >= 0) ? source : (source + ((source_height-1) * source_pitch))); */
- unsigned char *line_src;
-
-
- source_base = (unsigned char *)source;
-
- if (source_pitch < 0) {
- int offset;
-
- offset = (source_height - 1);
- offset *= source_pitch;
-
- source_base += offset;
- }
-
- /* find out the ratio for each direction */
- switch (hratio * 10 / hscale) {
- case 8:
- /* 4-5 Scale in Width direction */
- horiz_line_scale = vp8_horizontal_line_5_4_scale;
- break;
- case 6:
- /* 3-5 Scale in Width direction */
- horiz_line_scale = vp8_horizontal_line_5_3_scale;
- break;
- case 5:
- /* 1-2 Scale in Width direction */
- horiz_line_scale = vp8_horizontal_line_2_1_scale;
- break;
- default:
- /* The ratio is not acceptable now */
- /* throw("The ratio is not acceptable for now!"); */
- ratio_scalable = 0;
- break;
- }
-
- switch (vratio * 10 / vscale) {
- case 8:
- /* 4-5 Scale in vertical direction */
- vert_band_scale = vp8_vertical_band_5_4_scale;
- source_band_height = 5;
- dest_band_height = 4;
- break;
- case 6:
- /* 3-5 Scale in vertical direction */
- vert_band_scale = vp8_vertical_band_5_3_scale;
- source_band_height = 5;
- dest_band_height = 3;
- break;
- case 5:
- /* 1-2 Scale in vertical direction */
-
- if (interlaced) {
- /* if the content is interlaced, point sampling is used */
- vert_band_scale = vp8_vertical_band_2_1_scale;
- } else {
-
- interpolation = 1;
- /* if the content is progressive, interplo */
- vert_band_scale = vp8_vertical_band_2_1_scale_i;
-
- }
-
- source_band_height = 2;
- dest_band_height = 1;
- break;
- default:
- /* The ratio is not acceptable now */
- /* throw("The ratio is not acceptable for now!"); */
- ratio_scalable = 0;
- break;
- }
-
- if (ratio_scalable) {
- if (source_height == dest_height) {
- /* for each band of the image */
- for (k = 0; k < (int)dest_height; k++) {
- horiz_line_scale(source, source_width, dest, dest_width);
- source += source_pitch;
- dest += dest_pitch;
- }
-
- return;
- }
-
- if (interpolation) {
- if (source < source_base)
- source = source_base;
-
- horiz_line_scale(source, source_width, temp_area, dest_width);
- }
-
- for (k = 0; k < (int)(dest_height + dest_band_height - 1) / dest_band_height; k++) {
- /* scale one band horizontally */
- for (i = 0; i < source_band_height; i++) {
- /* Trap case where we could read off the base of the source buffer */
-
- line_src = (unsigned char *)source + i * source_pitch;
-
- if (line_src < source_base)
- line_src = source_base;
-
- horiz_line_scale(line_src, source_width,
- temp_area + (i + 1)*dest_pitch, dest_width);
- }
-
- /* Vertical scaling is in place */
- vert_band_scale(temp_area + dest_pitch, dest_pitch, dest, dest_pitch, dest_width);
-
- if (interpolation)
- vpx_memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_width);
-
- /* Next band... */
- source += (unsigned long) source_band_height * source_pitch;
- dest += (unsigned long) dest_band_height * dest_pitch;
- }
-
- return;
- }
-
- if (hscale == 2 && hratio == 1)
- Scale1Dh = scale1d_2t1_ps;
-
- if (vscale == 2 && vratio == 1) {
- if (interlaced)
- Scale1Dv = scale1d_2t1_ps;
- else
- Scale1Dv = scale1d_2t1_i;
- }
-
- if (source_height == dest_height) {
- /* for each band of the image */
- for (k = 0; k < (int)dest_height; k++) {
- Scale1Dh(source, 1, hscale, source_width + 1, dest, 1, hratio, dest_width);
- source += source_pitch;
- dest += dest_pitch;
- }
-
- return;
- }
-
- if (dest_height > source_height) {
- dest_band_height = temp_area_height - 1;
- source_band_height = dest_band_height * source_height / dest_height;
- } else {
- source_band_height = temp_area_height - 1;
- dest_band_height = source_band_height * vratio / vscale;
- }
-
- /* first row needs to be done so that we can stay one row ahead for vertical zoom */
- Scale1Dh(source, 1, hscale, source_width + 1, temp_area, 1, hratio, dest_width);
-
- /* for each band of the image */
- bands = (dest_height + dest_band_height - 1) / dest_band_height;
-
- for (k = 0; k < bands; k++) {
- /* scale one band horizontally */
- for (i = 1; i < source_band_height + 1; i++) {
- if (k * source_band_height + i < (int) source_height) {
- Scale1Dh(source + i * source_pitch, 1, hscale, source_width + 1,
- temp_area + i * dest_pitch, 1, hratio, dest_width);
- } else { /* Duplicate the last row */
- /* copy temp_area row 0 over from last row in the past */
- vpx_memcpy(temp_area + i * dest_pitch, temp_area + (i - 1)*dest_pitch, dest_pitch);
- }
- }
-
- /* scale one band vertically */
- for (j = 0; j < (int)dest_width; j++) {
- Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1,
- &dest[j], dest_pitch, vratio, dest_band_height);
- }
-
- /* copy temp_area row 0 over from last row in the past */
- vpx_memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_pitch);
-
- /* move to the next band */
- source += source_band_height * source_pitch;
- dest += dest_band_height * dest_pitch;
- }
-}
-
-/****************************************************************************
- *
- * ROUTINE : vpx_scale_frame
- *
- * INPUTS : YV12_BUFFER_CONFIG *src : Pointer to frame to be scaled.
- * YV12_BUFFER_CONFIG *dst : Pointer to buffer to hold scaled frame.
- * unsigned char *temp_area : Pointer to temp work area.
- * unsigned char temp_area_height : Height of temp work area.
- * unsigned int hscale : Horizontal scale factor numerator.
- * unsigned int hratio : Horizontal scale factor denominator.
- * unsigned int vscale : Vertical scale factor numerator.
- * unsigned int vratio : Vertical scale factor denominator.
- * unsigned int interlaced : Interlace flag.
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Performs 2-tap linear interpolation in two dimensions.
- *
- * SPECIAL NOTES : Expansion is performed one band at a time to help with
- * caching.
- *
- ****************************************************************************/
-void vpx_scale_frame
-(
- YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst,
- unsigned char *temp_area,
- unsigned char temp_height,
- unsigned int hscale,
- unsigned int hratio,
- unsigned int vscale,
- unsigned int vratio,
- unsigned int interlaced
-) {
- int i;
- int dw = (hscale - 1 + src->y_width * hratio) / hscale;
- int dh = (vscale - 1 + src->y_height * vratio) / vscale;
-
- /* call our internal scaling routines!! */
- Scale2D((unsigned char *) src->y_buffer, src->y_stride, src->y_width, src->y_height,
- (unsigned char *) dst->y_buffer, dst->y_stride, dw, dh,
- temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
-
- if (dw < (int)dst->y_width)
- for (i = 0; i < dh; i++)
- vpx_memset(dst->y_buffer + i * dst->y_stride + dw - 1, dst->y_buffer[i * dst->y_stride + dw - 2], dst->y_width - dw + 1);
-
- if (dh < (int)dst->y_height)
- for (i = dh - 1; i < (int)dst->y_height; i++)
- vpx_memcpy(dst->y_buffer + i * dst->y_stride, dst->y_buffer + (dh - 2) * dst->y_stride, dst->y_width + 1);
-
- Scale2D((unsigned char *) src->u_buffer, src->uv_stride, src->uv_width, src->uv_height,
- (unsigned char *) dst->u_buffer, dst->uv_stride, dw / 2, dh / 2,
- temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
-
- if (dw / 2 < (int)dst->uv_width)
- for (i = 0; i < dst->uv_height; i++)
- vpx_memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1, dst->u_buffer[i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1);
-
- if (dh / 2 < (int)dst->uv_height)
- for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++)
- vpx_memcpy(dst->u_buffer + i * dst->uv_stride, dst->u_buffer + (dh / 2 - 2)*dst->uv_stride, dst->uv_width);
-
- Scale2D((unsigned char *) src->v_buffer, src->uv_stride, src->uv_width, src->uv_height,
- (unsigned char *) dst->v_buffer, dst->uv_stride, dw / 2, dh / 2,
- temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
-
- if (dw / 2 < (int)dst->uv_width)
- for (i = 0; i < dst->uv_height; i++)
- vpx_memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1, dst->v_buffer[i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1);
-
- if (dh / 2 < (int) dst->uv_height)
- for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++)
- vpx_memcpy(dst->v_buffer + i * dst->uv_stride, dst->v_buffer + (dh / 2 - 2)*dst->uv_stride, dst->uv_width);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12config.c b/videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12config.c
deleted file mode 100644
index 7eef85b..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12config.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "vpx_scale/yv12config.h"
-#include "vpx_mem/vpx_mem.h"
-
-#include "trace_conf.h"
-
-/****************************************************************************
-* Exports
-****************************************************************************/
-
-/****************************************************************************
- *
- ****************************************************************************/
-#define yv12_align_addr(addr, align) \
- (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
-
-int
-vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
- if (ybf) {
- // If libvpx is using frame buffer callbacks then buffer_alloc_sz must
- // not be set.
- if (ybf->buffer_alloc_sz > 0) {
- vpx_free(ybf->buffer_alloc);
- }
-
- /* buffer_alloc isn't accessed by most functions. Rather y_buffer,
- u_buffer and v_buffer point to buffer_alloc and are used. Clear out
- all of this so that a freed pointer isn't inadvertently used */
- vpx_memset(ybf, 0, sizeof(YV12_BUFFER_CONFIG));
- } else {
- return -1;
- }
-
- return 0;
-}
-
-int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border) {
- if (ybf) {
- int aligned_width = (width + 15) & ~15;
- int aligned_height = (height + 15) & ~15;
- int y_stride = ((aligned_width + 2 * border) + 31) & ~31;
- int yplane_size = (aligned_height + 2 * border) * y_stride;
- int uv_width = aligned_width >> 1;
- int uv_height = aligned_height >> 1;
- /** There is currently a bunch of code which assumes
- * uv_stride == y_stride/2, so enforce this here. */
- int uv_stride = y_stride >> 1;
- int uvplane_size = (uv_height + border) * uv_stride;
- const int frame_size = yplane_size + 2 * uvplane_size;
-
- if (!ybf->buffer_alloc) {
- ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, frame_size);
- ybf->buffer_alloc_sz = frame_size;
- }
-
- if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size)
- return -1;
-
- /* Only support allocating buffers that have a border that's a multiple
- * of 32. The border restriction is required to get 16-byte alignment of
- * the start of the chroma rows without introducing an arbitrary gap
- * between planes, which would break the semantics of things like
- * vpx_img_set_rect(). */
- if (border & 0x1f)
- return -3;
-
- ybf->y_crop_width = width;
- ybf->y_crop_height = height;
- ybf->y_width = aligned_width;
- ybf->y_height = aligned_height;
- ybf->y_stride = y_stride;
-
- ybf->uv_width = uv_width;
- ybf->uv_height = uv_height;
- ybf->uv_stride = uv_stride;
-
- ybf->alpha_width = 0;
- ybf->alpha_height = 0;
- ybf->alpha_stride = 0;
-
- ybf->border = border;
- ybf->frame_size = frame_size;
-
- ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
- ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
- ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2;
- ybf->alpha_buffer = NULL;
-
- ybf->corrupted = 0; /* assume not currupted by errors */
- return 0;
- }
- return -2;
-}
-
-int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border) {
- if (ybf) {
- vp8_yv12_de_alloc_frame_buffer(ybf);
- return vp8_yv12_realloc_frame_buffer(ybf, width, height, border);
- }
- return -2;
-}
-
-#if CONFIG_VP9
-// TODO(jkoleszar): Maybe replace this with struct vpx_image
-
-int vp9_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
- if (ybf) {
- if (ybf->buffer_alloc_sz > 0) {
- vpx_free(ybf->buffer_alloc);
- }
-
- /* buffer_alloc isn't accessed by most functions. Rather y_buffer,
- u_buffer and v_buffer point to buffer_alloc and are used. Clear out
- all of this so that a freed pointer isn't inadvertently used */
- vpx_memset(ybf, 0, sizeof(YV12_BUFFER_CONFIG));
- } else {
- return -1;
- }
-
- return 0;
-}
-
-int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height,
- int ss_x, int ss_y, int border,
- vpx_codec_frame_buffer_t *fb,
- vpx_get_frame_buffer_cb_fn_t cb,
- void *cb_priv) {
- if (ybf) {
- const int aligned_width = (width + 7) & ~7;
- //int aligned_height = (height + 7) & ~7;
- int aligned_height = (height + 31) & ~31;
- int y_stride = ((aligned_width + 2 * border) + 31) & ~31;
- int yplane_size = (aligned_height + 2 * border) * y_stride;
-
- const int uv_width = aligned_width >> ss_x;
- int uv_height = aligned_height >> ss_y;
- int uv_stride = y_stride >> ss_x;
- const int uv_border_w = border >> ss_x;
- const int uv_border_h = border >> ss_y;
- int uvplane_size = (uv_height + 2 * uv_border_h) * uv_stride;
-#if CONFIG_ALPHA
- const int alpha_width = aligned_width;
- int alpha_height = aligned_height;
- int alpha_stride = y_stride;
- const int alpha_border_w = border;
- const int alpha_border_h = border;
- int alpha_plane_size = (alpha_height + 2 * alpha_border_h) *
- alpha_stride;
- int frame_size = yplane_size + 2 * uvplane_size +
- alpha_plane_size;
-#else
- int frame_size = yplane_size + 2 * uvplane_size;
-#endif
- if (cb != NULL) {
- const int align_addr_extra_size = 0; //31;
- const size_t external_frame_size = frame_size + align_addr_extra_size;
-
- assert(fb != NULL);
-
- // Allocation to hold larger frame, or first allocation.
- if (cb(cb_priv, external_frame_size, fb) < 0)
- return -1;
-
- if (fb->data == NULL || fb->size < external_frame_size)
- return -1;
-
- // This memset is needed for fixing valgrind error from C loop filter
- // due to access uninitialized memory in frame border. It could be
- // removed if border is totally removed.
- //vpx_memset(fb->data, 0, fb->size);
-
- ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32);
-
- // extra info from external buffer
- ybf->fb_index = fb->fb_index;
- if (fb->fb_stride > 0) {
- if ((fb->fb_stride >= y_stride) && (fb->fb_height_stride >= aligned_height)) {
- // re-calculate stride/size stuff
- y_stride = fb->fb_stride;
- // external height is 32-bit align, align here either
- aligned_height = (aligned_height + 31) & ~31;
- aligned_height = fb->fb_height_stride;
-
- yplane_size = (aligned_height + 2 * border) * y_stride;
-
- uv_stride = y_stride >> ss_x;
- uv_height = aligned_height >> ss_y;
- uvplane_size = (uv_height + 2 * uv_border_h) * uv_stride;
-#if CONFIG_ALPHA
- alpha_stride = y_stride;
- alpha_height = aligned_height;
- alpha_plane_size = (alpha_height + 2 * alpha_border_h) *
- alpha_stride;
- frame_size = yplane_size + 2 * uvplane_size +
- alpha_plane_size;
-#else
- frame_size = yplane_size + 2 * uvplane_size;
-#endif
- } else {
- LOGD("buffer stride get from external should not less than calculated!");
- return -1;
- }
- }
- } else if (frame_size > ybf->buffer_alloc_sz) {
- // Allocation to hold larger frame, or first allocation.
- if (ybf->buffer_alloc)
- vpx_free(ybf->buffer_alloc);
- ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, frame_size);
- if (!ybf->buffer_alloc)
- return -1;
-
- ybf->buffer_alloc_sz = frame_size;
-
- // This memset is needed for fixing valgrind error from C loop filter
- // due to access uninitialized memory in frame border. It could be
- // removed if border is totally removed.
- //vpx_memset(ybf->buffer_alloc, 0, ybf->buffer_alloc_sz);
- }
-
- /* Only support allocating buffers that have a border that's a multiple
- * of 32. The border restriction is required to get 16-byte alignment of
- * the start of the chroma rows without introducing an arbitrary gap
- * between planes, which would break the semantics of things like
- * vpx_img_set_rect(). */
- if (border & 0x1f)
- return -3;
-
- ybf->y_crop_width = width;
- ybf->y_crop_height = height;
- ybf->y_width = aligned_width;
- ybf->y_height = aligned_height;
- ybf->y_stride = y_stride;
-
- ybf->uv_crop_width = (width + ss_x) >> ss_x;
- ybf->uv_crop_height = (height + ss_y) >> ss_y;
- ybf->uv_width = uv_width;
- ybf->uv_height = uv_height;
- ybf->uv_stride = uv_stride;
-
- ybf->border = border;
- ybf->frame_size = frame_size;
-
- ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
- ybf->v_buffer = ybf->buffer_alloc + yplane_size +
- (uv_border_h * uv_stride) + uv_border_w;
- ybf->u_buffer = ybf->buffer_alloc + yplane_size + uvplane_size +
- (uv_border_h * uv_stride) + uv_border_w;
-
-#if CONFIG_ALPHA
- ybf->alpha_width = alpha_width;
- ybf->alpha_height = alpha_height;
- ybf->alpha_stride = alpha_stride;
- ybf->alpha_buffer = ybf->buffer_alloc + yplane_size + 2 * uvplane_size +
- (alpha_border_h * alpha_stride) + alpha_border_w;
-#endif
- ybf->corrupted = 0; /* assume not corrupted by errors */
- return 0;
- }
- return -2;
-}
-
-int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height,
- int ss_x, int ss_y, int border) {
- if (ybf) {
- vp9_free_frame_buffer(ybf);
- return vp9_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, border,
- NULL, NULL, NULL);
- }
- return -2;
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12extend.c b/videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12extend.c
deleted file mode 100644
index 7b43eec..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/generic/yv12extend.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include "./vpx_config.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_scale/yv12config.h"
-
-static void extend_plane(uint8_t *const src, int src_stride,
- int width, int height,
- int extend_top, int extend_left,
- int extend_bottom, int extend_right) {
- int i;
- const int linesize = extend_left + extend_right + width;
-
- /* copy the left and right most columns out */
- uint8_t *src_ptr1 = src;
- uint8_t *src_ptr2 = src + width - 1;
- uint8_t *dst_ptr1 = src - extend_left;
- uint8_t *dst_ptr2 = src + width;
-
- for (i = 0; i < height; ++i) {
- vpx_memset(dst_ptr1, src_ptr1[0], extend_left);
- vpx_memset(dst_ptr2, src_ptr2[0], extend_right);
- src_ptr1 += src_stride;
- src_ptr2 += src_stride;
- dst_ptr1 += src_stride;
- dst_ptr2 += src_stride;
- }
-
- /* Now copy the top and bottom lines into each line of the respective
- * borders
- */
- src_ptr1 = src - extend_left;
- src_ptr2 = src + src_stride * (height - 1) - extend_left;
- dst_ptr1 = src + src_stride * -extend_top - extend_left;
- dst_ptr2 = src + src_stride * height - extend_left;
-
- for (i = 0; i < extend_top; ++i) {
- vpx_memcpy(dst_ptr1, src_ptr1, linesize);
- dst_ptr1 += src_stride;
- }
-
- for (i = 0; i < extend_bottom; ++i) {
- vpx_memcpy(dst_ptr2, src_ptr2, linesize);
- dst_ptr2 += src_stride;
- }
-}
-
-void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
- assert(ybf->y_height - ybf->y_crop_height < 16);
- assert(ybf->y_width - ybf->y_crop_width < 16);
- assert(ybf->y_height - ybf->y_crop_height >= 0);
- assert(ybf->y_width - ybf->y_crop_width >= 0);
-
- extend_plane(ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ybf->border, ybf->border,
- ybf->border + ybf->y_height - ybf->y_crop_height,
- ybf->border + ybf->y_width - ybf->y_crop_width);
-
- extend_plane(ybf->u_buffer, ybf->uv_stride,
- (ybf->y_crop_width + 1) / 2, (ybf->y_crop_height + 1) / 2,
- ybf->border / 2, ybf->border / 2,
- (ybf->border + ybf->y_height - ybf->y_crop_height + 1) / 2,
- (ybf->border + ybf->y_width - ybf->y_crop_width + 1) / 2);
-
- extend_plane(ybf->v_buffer, ybf->uv_stride,
- (ybf->y_crop_width + 1) / 2, (ybf->y_crop_height + 1) / 2,
- ybf->border / 2, ybf->border / 2,
- (ybf->border + ybf->y_height - ybf->y_crop_height + 1) / 2,
- (ybf->border + ybf->y_width - ybf->y_crop_width + 1) / 2);
-}
-
-#if CONFIG_VP9
-static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size) {
- const int c_w = ybf->uv_crop_width;
- const int c_h = ybf->uv_crop_height;
- const int c_ext_size = ext_size >> 1;
- const int c_et = c_ext_size;
- const int c_el = c_ext_size;
- const int c_eb = c_ext_size + ybf->uv_height - ybf->uv_crop_height;
- const int c_er = c_ext_size + ybf->uv_width - ybf->uv_crop_width;
-
- assert(ybf->y_height - ybf->y_crop_height < 16);
- assert(ybf->y_width - ybf->y_crop_width < 16);
- assert(ybf->y_height - ybf->y_crop_height >= 0);
- assert(ybf->y_width - ybf->y_crop_width >= 0);
-
- extend_plane(ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ext_size, ext_size,
- ext_size + ybf->y_height - ybf->y_crop_height,
- ext_size + ybf->y_width - ybf->y_crop_width);
-
- extend_plane(ybf->u_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
-
- extend_plane(ybf->v_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
-}
-
-void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
- extend_frame(ybf, ybf->border);
-}
-
-void vp9_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) {
- const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ?
- VP9INNERBORDERINPIXELS : ybf->border;
- extend_frame(ybf, inner_bw);
-}
-#endif // CONFIG_VP9
-
-// Copies the source image into the destination image and updates the
-// destination's UMV borders.
-// Note: The frames are assumed to be identical in size.
-void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc,
- YV12_BUFFER_CONFIG *dst_ybc) {
- int row;
- const uint8_t *src = src_ybc->y_buffer;
- uint8_t *dst = dst_ybc->y_buffer;
-
-#if 0
- /* These assertions are valid in the codec, but the libvpx-tester uses
- * this code slightly differently.
- */
- assert(src_ybc->y_width == dst_ybc->y_width);
- assert(src_ybc->y_height == dst_ybc->y_height);
-#endif
-
- for (row = 0; row < src_ybc->y_height; ++row) {
- vpx_memcpy(dst, src, src_ybc->y_width);
- src += src_ybc->y_stride;
- dst += dst_ybc->y_stride;
- }
-
- src = src_ybc->u_buffer;
- dst = dst_ybc->u_buffer;
-
- for (row = 0; row < src_ybc->uv_height; ++row) {
- vpx_memcpy(dst, src, src_ybc->uv_width);
- src += src_ybc->uv_stride;
- dst += dst_ybc->uv_stride;
- }
-
- src = src_ybc->v_buffer;
- dst = dst_ybc->v_buffer;
-
- for (row = 0; row < src_ybc->uv_height; ++row) {
- vpx_memcpy(dst, src, src_ybc->uv_width);
- src += src_ybc->uv_stride;
- dst += dst_ybc->uv_stride;
- }
-
- vp8_yv12_extend_frame_borders_c(dst_ybc);
-}
-
-void vpx_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc,
- YV12_BUFFER_CONFIG *dst_ybc) {
- int row;
- const uint8_t *src = src_ybc->y_buffer;
- uint8_t *dst = dst_ybc->y_buffer;
-
- for (row = 0; row < src_ybc->y_height; ++row) {
- vpx_memcpy(dst, src, src_ybc->y_width);
- src += src_ybc->y_stride;
- dst += dst_ybc->y_stride;
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/mips/dspr2/yv12extend_dspr2.c b/videocodec/libvpx_internal/libvpx/vpx_scale/mips/dspr2/yv12extend_dspr2.c
deleted file mode 100644
index 26558b0..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/mips/dspr2/yv12extend_dspr2.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-
-#include "./vpx_config.h"
-#include "vpx_scale/yv12config.h"
-#include "vpx_mem/vpx_mem.h"
-#include "vpx_scale/vpx_scale.h"
-
-#if HAVE_DSPR2
-static void extend_plane(uint8_t *const src, int src_stride,
- int width, int height,
- int extend_top, int extend_left,
- int extend_bottom, int extend_right) {
- int i, j;
- uint8_t *left_src, *right_src;
- uint8_t *left_dst_start, *right_dst_start;
- uint8_t *left_dst, *right_dst;
- uint8_t *top_src, *bot_src;
- uint8_t *top_dst, *bot_dst;
- uint32_t left_pix;
- uint32_t right_pix;
- uint32_t linesize;
-
- /* copy the left and right most columns out */
- left_src = src;
- right_src = src + width - 1;
- left_dst_start = src - extend_left;
- right_dst_start = src + width;
-
- for (i = height; i--; ) {
- left_dst = left_dst_start;
- right_dst = right_dst_start;
-
- __asm__ __volatile__ (
- "lb %[left_pix], 0(%[left_src]) \n\t"
- "lb %[right_pix], 0(%[right_src]) \n\t"
- "replv.qb %[left_pix], %[left_pix] \n\t"
- "replv.qb %[right_pix], %[right_pix] \n\t"
-
- : [left_pix] "=&r" (left_pix), [right_pix] "=&r" (right_pix)
- : [left_src] "r" (left_src), [right_src] "r" (right_src)
- );
-
- for (j = extend_left/4; j--; ) {
- __asm__ __volatile__ (
- "sw %[left_pix], 0(%[left_dst]) \n\t"
- "sw %[right_pix], 0(%[right_dst]) \n\t"
-
- :
- : [left_dst] "r" (left_dst), [left_pix] "r" (left_pix),
- [right_dst] "r" (right_dst), [right_pix] "r" (right_pix)
- );
-
- left_dst += 4;
- right_dst += 4;
- }
-
- for (j = extend_left%4; j--; ) {
- __asm__ __volatile__ (
- "sb %[left_pix], 0(%[left_dst]) \n\t"
- "sb %[right_pix], 0(%[right_dst]) \n\t"
-
- :
- : [left_dst] "r" (left_dst), [left_pix] "r" (left_pix),
- [right_dst] "r" (right_dst), [right_pix] "r" (right_pix)
- );
-
- left_dst += 1;
- right_dst += 1;
- }
-
- left_src += src_stride;
- right_src += src_stride;
- left_dst_start += src_stride;
- right_dst_start += src_stride;
- }
-
- /* Now copy the top and bottom lines into each line of the respective
- * borders
- */
- top_src = src - extend_left;
- bot_src = src + src_stride * (height - 1) - extend_left;
- top_dst = src + src_stride * (-extend_top) - extend_left;
- bot_dst = src + src_stride * (height) - extend_left;
- linesize = extend_left + extend_right + width;
-
- for (i = 0; i < extend_top; i++) {
- vpx_memcpy(top_dst, top_src, linesize);
- top_dst += src_stride;
- }
-
- for (i = 0; i < extend_bottom; i++) {
- vpx_memcpy(bot_dst, bot_src, linesize);
- bot_dst += src_stride;
- }
-}
-
-static void extend_frame(YV12_BUFFER_CONFIG *const ybf,
- int subsampling_x, int subsampling_y,
- int ext_size) {
- const int c_w = ybf->uv_crop_width;
- const int c_h = ybf->uv_crop_height;
- const int c_ext_size = ext_size >> 1;
- const int c_et = c_ext_size;
- const int c_el = c_ext_size;
- const int c_eb = c_ext_size + ybf->uv_height - ybf->uv_crop_height;
- const int c_er = c_ext_size + ybf->uv_width - ybf->uv_crop_width;
-
- assert(ybf->y_height - ybf->y_crop_height < 16);
- assert(ybf->y_width - ybf->y_crop_width < 16);
- assert(ybf->y_height - ybf->y_crop_height >= 0);
- assert(ybf->y_width - ybf->y_crop_width >= 0);
-
- extend_plane(ybf->y_buffer, ybf->y_stride,
- ybf->y_crop_width, ybf->y_crop_height,
- ext_size, ext_size,
- ext_size + ybf->y_height - ybf->y_crop_height,
- ext_size + ybf->y_width - ybf->y_crop_width);
-
- extend_plane(ybf->u_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
-
- extend_plane(ybf->v_buffer, ybf->uv_stride,
- c_w, c_h, c_et, c_el, c_eb, c_er);
-}
-
-void vp9_extend_frame_borders_dspr2(YV12_BUFFER_CONFIG *ybf,
- int subsampling_x, int subsampling_y) {
- extend_frame(ybf, subsampling_x, subsampling_y, ybf->border);
-}
-
-void vp9_extend_frame_inner_borders_dspr2(YV12_BUFFER_CONFIG *ybf,
- int subsampling_x,
- int subsampling_y) {
- const int inner_bw = (ybf->border > VP9INNERBORDERINPIXELS) ?
- VP9INNERBORDERINPIXELS : ybf->border;
- extend_frame(ybf, subsampling_x, subsampling_y, inner_bw);
-}
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.h b/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.h
deleted file mode 100644
index 43fcf9d..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#ifndef VPX_SCALE_VPX_SCALE_H_
-#define VPX_SCALE_VPX_SCALE_H_
-
-#include "vpx_scale/yv12config.h"
-
-extern void vpx_scale_frame(YV12_BUFFER_CONFIG *src,
- YV12_BUFFER_CONFIG *dst,
- unsigned char *temp_area,
- unsigned char temp_height,
- unsigned int hscale,
- unsigned int hratio,
- unsigned int vscale,
- unsigned int vratio,
- unsigned int interlaced);
-
-#endif // VPX_SCALE_VPX_SCALE_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.mk b/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.mk
deleted file mode 100644
index ded8e0b..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-SCALE_SRCS-yes += vpx_scale.mk
-SCALE_SRCS-yes += yv12config.h
-SCALE_SRCS-yes += vpx_scale.h
-SCALE_SRCS-yes += generic/vpx_scale.c
-SCALE_SRCS-yes += generic/yv12config.c
-SCALE_SRCS-yes += generic/yv12extend.c
-SCALE_SRCS-$(CONFIG_SPATIAL_RESAMPLING) += generic/gen_scalers.c
-SCALE_SRCS-yes += vpx_scale_asm_offsets.c
-SCALE_SRCS-yes += vpx_scale_rtcd.c
-SCALE_SRCS-yes += vpx_scale_rtcd.pl
-
-#neon
-SCALE_SRCS-$(HAVE_NEON) += arm/neon/vp8_vpxyv12_copyframe_func_neon$(ASM)
-SCALE_SRCS-$(HAVE_NEON) += arm/neon/vp8_vpxyv12_copysrcframe_func_neon$(ASM)
-SCALE_SRCS-$(HAVE_NEON) += arm/neon/vp8_vpxyv12_extendframeborders_neon$(ASM)
-SCALE_SRCS-$(HAVE_NEON) += arm/neon/yv12extend_arm.c
-
-#mips(dspr2)
-SCALE_SRCS-$(HAVE_DSPR2) += mips/dspr2/yv12extend_dspr2.c
-
-SCALE_SRCS-no += $(SCALE_SRCS_REMOVE-yes)
-
-$(eval $(call asm_offsets_template,\
- vpx_scale_asm_offsets.asm, vpx_scale/vpx_scale_asm_offsets.c))
-
-$(eval $(call rtcd_h_template,vpx_scale_rtcd,vpx_scale/vpx_scale_rtcd.pl))
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_asm_offsets.c b/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_asm_offsets.c
deleted file mode 100644
index caa9e80..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_asm_offsets.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "./vpx_config.h"
-#include "vpx/vpx_codec.h"
-#include "vpx_ports/asm_offsets.h"
-#include "vpx_scale/yv12config.h"
-
-BEGIN
-
-/* vpx_scale */
-DEFINE(yv12_buffer_config_y_width, offsetof(YV12_BUFFER_CONFIG, y_width));
-DEFINE(yv12_buffer_config_y_height, offsetof(YV12_BUFFER_CONFIG, y_height));
-DEFINE(yv12_buffer_config_y_stride, offsetof(YV12_BUFFER_CONFIG, y_stride));
-DEFINE(yv12_buffer_config_uv_width, offsetof(YV12_BUFFER_CONFIG, uv_width));
-DEFINE(yv12_buffer_config_uv_height, offsetof(YV12_BUFFER_CONFIG, uv_height));
-DEFINE(yv12_buffer_config_uv_stride, offsetof(YV12_BUFFER_CONFIG, uv_stride));
-DEFINE(yv12_buffer_config_y_buffer, offsetof(YV12_BUFFER_CONFIG, y_buffer));
-DEFINE(yv12_buffer_config_u_buffer, offsetof(YV12_BUFFER_CONFIG, u_buffer));
-DEFINE(yv12_buffer_config_v_buffer, offsetof(YV12_BUFFER_CONFIG, v_buffer));
-DEFINE(yv12_buffer_config_border, offsetof(YV12_BUFFER_CONFIG, border));
-DEFINE(VP8BORDERINPIXELS_VAL, VP8BORDERINPIXELS);
-
-END
-
-/* add asserts for any offset that is not supported by assembly code */
-/* add asserts for any size that is not supported by assembly code */
-
-#if HAVE_NEON
-/* vp8_yv12_extend_frame_borders_neon makes several assumptions based on this */
-ct_assert(VP8BORDERINPIXELS_VAL, VP8BORDERINPIXELS == 32)
-#endif
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.c b/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.c
deleted file mode 100644
index 656a22f..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2011 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "vpx_config.h"
-#define RTCD_C
-#include "vpx_scale_rtcd.h"
-#include "vpx_ports/vpx_once.h"
-
-void vpx_scale_rtcd()
-{
- once(setup_rtcd_internal);
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.pl b/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.pl
deleted file mode 100644
index 8c92570..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/vpx_scale_rtcd.pl
+++ /dev/null
@@ -1,34 +0,0 @@
-sub vpx_scale_forward_decls() {
-print <<EOF
-struct yv12_buffer_config;
-EOF
-}
-forward_decls qw/vpx_scale_forward_decls/;
-
-# Scaler functions
-if (vpx_config("CONFIG_SPATIAL_RESAMPLING") eq "yes") {
- add_proto qw/void vp8_horizontal_line_5_4_scale/, "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width";
- add_proto qw/void vp8_vertical_band_5_4_scale/, "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width";
- add_proto qw/void vp8_horizontal_line_5_3_scale/, "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width";
- add_proto qw/void vp8_vertical_band_5_3_scale/, "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width";
- add_proto qw/void vp8_horizontal_line_2_1_scale/, "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width";
- add_proto qw/void vp8_vertical_band_2_1_scale/, "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width";
- add_proto qw/void vp8_vertical_band_2_1_scale_i/, "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width";
-}
-
-add_proto qw/void vp8_yv12_extend_frame_borders/, "struct yv12_buffer_config *ybf";
-specialize qw/vp8_yv12_extend_frame_borders neon/;
-
-add_proto qw/void vp8_yv12_copy_frame/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
-specialize qw/vp8_yv12_copy_frame neon/;
-
-add_proto qw/void vpx_yv12_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
-
-if (vpx_config("CONFIG_VP9") eq "yes") {
- add_proto qw/void vp9_extend_frame_borders/, "struct yv12_buffer_config *ybf";
- specialize qw/vp9_extend_frame_borders dspr2/;
-
- add_proto qw/void vp9_extend_frame_inner_borders/, "struct yv12_buffer_config *ybf";
- specialize qw/vp9_extend_frame_inner_borders dspr2/;
-}
-1;
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/win32/scaleopt.c b/videocodec/libvpx_internal/libvpx/vpx_scale/win32/scaleopt.c
deleted file mode 100644
index 4336ece..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/win32/scaleopt.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
-*
-* Module Title : scaleopt.cpp
-*
-* Description : Optimized scaling functions
-*
-****************************************************************************/
-#include "pragmas.h"
-
-/****************************************************************************
-* Module Statics
-****************************************************************************/
-__declspec(align(16)) const static unsigned short round_values[] = { 128, 128, 128, 128 };
-
-#include "vpx_scale/vpx_scale.h"
-#include "vpx_mem/vpx_mem.h"
-
-__declspec(align(16)) const static unsigned short const54_2[] = { 0, 64, 128, 192 };
-__declspec(align(16)) const static unsigned short const54_1[] = {256, 192, 128, 64 };
-
-
-/****************************************************************************
- *
- * ROUTINE : horizontal_line_5_4_scale_mmx
- *
- * INPUTS : const unsigned char *source : Pointer to source data.
- * unsigned int source_width : Stride of source.
- * unsigned char *dest : Pointer to destination data.
- * unsigned int dest_width : Stride of destination (NOT USED).
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : Copies horizontal line of pixels from source to
- * destination scaling up by 4 to 5.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-static
-void horizontal_line_5_4_scale_mmx
-(
- const unsigned char *source,
- unsigned int source_width,
- unsigned char *dest,
- unsigned int dest_width
-) {
- /*
- unsigned i;
- unsigned int a, b, c, d, e;
- unsigned char *des = dest;
- const unsigned char *src = source;
-
- (void) dest_width;
-
- for ( i=0; i<source_width; i+=5 )
- {
- a = src[0];
- b = src[1];
- c = src[2];
- d = src[3];
- e = src[4];
-
- des[0] = a;
- des[1] = ((b*192 + c* 64 + 128)>>8);
- des[2] = ((c*128 + d*128 + 128)>>8);
- des[3] = ((d* 64 + e*192 + 128)>>8);
-
- src += 5;
- des += 4;
- }
- */
- (void) dest_width;
-
- __asm {
-
- mov esi, source;
- mov edi, dest;
-
- mov ecx, source_width;
- movq mm5, const54_1;
-
- pxor mm7, mm7;
- movq mm6, const54_2;
-
- movq mm4, round_values;
- lea edx, [esi+ecx];
- horizontal_line_5_4_loop:
-
- movq mm0, QWORD PTR [esi];
- 00 01 02 03 04 05 06 07
- movq mm1, mm0;
- 00 01 02 03 04 05 06 07
-
- psrlq mm0, 8;
- 01 02 03 04 05 06 07 xx
- punpcklbw mm1, mm7;
- xx 00 xx 01 xx 02 xx 03
-
- punpcklbw mm0, mm7;
- xx 01 xx 02 xx 03 xx 04
- pmullw mm1, mm5
-
- pmullw mm0, mm6
- add esi, 5
-
- add edi, 4
- paddw mm1, mm0
-
- paddw mm1, mm4
- psrlw mm1, 8
-
- cmp esi, edx
- packuswb mm1, mm7
-
- movd DWORD PTR [edi-4], mm1
-
- jl horizontal_line_5_4_loop
-
- }
-
-}
-__declspec(align(16)) const static unsigned short one_fourths[] = { 64, 64, 64, 64 };
-__declspec(align(16)) const static unsigned short two_fourths[] = { 128, 128, 128, 128 };
-__declspec(align(16)) const static unsigned short three_fourths[] = { 192, 192, 192, 192 };
-
-static
-void vertical_band_5_4_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
-
- __asm {
- push ebx
-
- mov esi, source // Get the source and destination pointer
- mov ecx, src_pitch // Get the pitch size
-
- mov edi, dest // tow lines below
- pxor mm7, mm7 // clear out mm7
-
- mov edx, dest_pitch // Loop counter
- mov ebx, dest_width
-
- vs_5_4_loop:
-
- movd mm0, DWORD ptr [esi] // src[0];
- movd mm1, DWORD ptr [esi+ecx] // src[1];
-
- movd mm2, DWORD ptr [esi+ecx*2]
- lea eax, [esi+ecx*2] //
-
- punpcklbw mm1, mm7
- punpcklbw mm2, mm7
-
- movq mm3, mm2
- pmullw mm1, three_fourths
-
- pmullw mm2, one_fourths
- movd mm4, [eax+ecx]
-
- pmullw mm3, two_fourths
- punpcklbw mm4, mm7
-
- movq mm5, mm4
- pmullw mm4, two_fourths
-
- paddw mm1, mm2
- movd mm6, [eax+ecx*2]
-
- pmullw mm5, one_fourths
- paddw mm1, round_values;
-
- paddw mm3, mm4
- psrlw mm1, 8
-
- punpcklbw mm6, mm7
- paddw mm3, round_values
-
- pmullw mm6, three_fourths
- psrlw mm3, 8
-
- packuswb mm1, mm7
- packuswb mm3, mm7
-
- movd DWORD PTR [edi], mm0
- movd DWORD PTR [edi+edx], mm1
-
-
- paddw mm5, mm6
- movd DWORD PTR [edi+edx*2], mm3
-
- lea eax, [edi+edx*2]
- paddw mm5, round_values
-
- psrlw mm5, 8
- add edi, 4
-
- packuswb mm5, mm7
- movd DWORD PTR [eax+edx], mm5
-
- add esi, 4
- sub ebx, 4
-
- jg vs_5_4_loop
-
- pop ebx
- }
-}
-
-
-__declspec(align(16)) const static unsigned short const53_1[] = { 0, 85, 171, 0 };
-__declspec(align(16)) const static unsigned short const53_2[] = {256, 171, 85, 0 };
-
-
-static
-void horizontal_line_5_3_scale_mmx
-(
- const unsigned char *source,
- unsigned int source_width,
- unsigned char *dest,
- unsigned int dest_width
-) {
-
- (void) dest_width;
- __asm {
-
- mov esi, source;
- mov edi, dest;
-
- mov ecx, source_width;
- movq mm5, const53_1;
-
- pxor mm7, mm7;
- movq mm6, const53_2;
-
- movq mm4, round_values;
- lea edx, [esi+ecx-5];
- horizontal_line_5_3_loop:
-
- movq mm0, QWORD PTR [esi];
- 00 01 02 03 04 05 06 07
- movq mm1, mm0;
- 00 01 02 03 04 05 06 07
-
- psllw mm0, 8;
- xx 00 xx 02 xx 04 xx 06
- psrlw mm1, 8;
- 01 xx 03 xx 05 xx 07 xx
-
- psrlw mm0, 8;
- 00 xx 02 xx 04 xx 06 xx
- psllq mm1, 16;
- xx xx 01 xx 03 xx 05 xx
-
- pmullw mm0, mm6
-
- pmullw mm1, mm5
- add esi, 5
-
- add edi, 3
- paddw mm1, mm0
-
- paddw mm1, mm4
- psrlw mm1, 8
-
- cmp esi, edx
- packuswb mm1, mm7
-
- movd DWORD PTR [edi-3], mm1
- jl horizontal_line_5_3_loop
-
-// exit condition
- movq mm0, QWORD PTR [esi];
- 00 01 02 03 04 05 06 07
- movq mm1, mm0;
- 00 01 02 03 04 05 06 07
-
- psllw mm0, 8;
- xx 00 xx 02 xx 04 xx 06
- psrlw mm1, 8;
- 01 xx 03 xx 05 xx 07 xx
-
- psrlw mm0, 8;
- 00 xx 02 xx 04 xx 06 xx
- psllq mm1, 16;
- xx xx 01 xx 03 xx 05 xx
-
- pmullw mm0, mm6
-
- pmullw mm1, mm5
- paddw mm1, mm0
-
- paddw mm1, mm4
- psrlw mm1, 8
-
- packuswb mm1, mm7
- movd eax, mm1
-
- mov edx, eax
- shr edx, 16
-
- mov WORD PTR[edi], ax
- mov BYTE PTR[edi+2], dl
-
- }
-
-}
-
-__declspec(align(16)) const static unsigned short one_thirds[] = { 85, 85, 85, 85 };
-__declspec(align(16)) const static unsigned short two_thirds[] = { 171, 171, 171, 171 };
-
-static
-void vertical_band_5_3_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
-
- __asm {
- push ebx
-
- mov esi, source // Get the source and destination pointer
- mov ecx, src_pitch // Get the pitch size
-
- mov edi, dest // tow lines below
- pxor mm7, mm7 // clear out mm7
-
- mov edx, dest_pitch // Loop counter
- movq mm5, one_thirds
-
- movq mm6, two_thirds
- mov ebx, dest_width;
-
- vs_5_3_loop:
-
- movd mm0, DWORD ptr [esi] // src[0];
- movd mm1, DWORD ptr [esi+ecx] // src[1];
-
- movd mm2, DWORD ptr [esi+ecx*2]
- lea eax, [esi+ecx*2] //
-
- punpcklbw mm1, mm7
- punpcklbw mm2, mm7
-
- pmullw mm1, mm5
- pmullw mm2, mm6
-
- movd mm3, DWORD ptr [eax+ecx]
- movd mm4, DWORD ptr [eax+ecx*2]
-
- punpcklbw mm3, mm7
- punpcklbw mm4, mm7
-
- pmullw mm3, mm6
- pmullw mm4, mm5
-
-
- movd DWORD PTR [edi], mm0
- paddw mm1, mm2
-
- paddw mm1, round_values
- psrlw mm1, 8
-
- packuswb mm1, mm7
- paddw mm3, mm4
-
- paddw mm3, round_values
- movd DWORD PTR [edi+edx], mm1
-
- psrlw mm3, 8
- packuswb mm3, mm7
-
- movd DWORD PTR [edi+edx*2], mm3
-
-
- add edi, 4
- add esi, 4
-
- sub ebx, 4
- jg vs_5_3_loop
-
- pop ebx
- }
-}
-
-
-
-
-/****************************************************************************
- *
- * ROUTINE : horizontal_line_2_1_scale
- *
- * INPUTS : const unsigned char *source :
- * unsigned int source_width :
- * unsigned char *dest :
- * unsigned int dest_width :
- *
- * OUTPUTS : None.
- *
- * RETURNS : void
- *
- * FUNCTION : 1 to 2 up-scaling of a horizontal line of pixels.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-static
-void horizontal_line_2_1_scale_mmx
-(
- const unsigned char *source,
- unsigned int source_width,
- unsigned char *dest,
- unsigned int dest_width
-) {
- (void) dest_width;
- (void) source_width;
- __asm {
- mov esi, source
- mov edi, dest
-
- pxor mm7, mm7
- mov ecx, dest_width
-
- xor edx, edx
- hs_2_1_loop:
-
- movq mm0, [esi+edx*2]
- psllw mm0, 8
-
- psrlw mm0, 8
- packuswb mm0, mm7
-
- movd DWORD Ptr [edi+edx], mm0;
- add edx, 4
-
- cmp edx, ecx
- jl hs_2_1_loop
-
- }
-}
-
-
-
-static
-void vertical_band_2_1_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
- (void) dest_pitch;
- (void) src_pitch;
- vpx_memcpy(dest, source, dest_width);
-}
-
-
-__declspec(align(16)) const static unsigned short three_sixteenths[] = { 48, 48, 48, 48 };
-__declspec(align(16)) const static unsigned short ten_sixteenths[] = { 160, 160, 160, 160 };
-
-static
-void vertical_band_2_1_scale_i_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) {
-
- (void) dest_pitch;
- __asm {
- mov esi, source
- mov edi, dest
-
- mov eax, src_pitch
- mov edx, dest_width
-
- pxor mm7, mm7
- sub esi, eax // back one line
-
-
- lea ecx, [esi+edx];
- movq mm6, round_values;
-
- movq mm5, three_sixteenths;
- movq mm4, ten_sixteenths;
-
- vs_2_1_i_loop:
- movd mm0, [esi] //
- movd mm1, [esi+eax] //
-
- movd mm2, [esi+eax*2] //
- punpcklbw mm0, mm7
-
- pmullw mm0, mm5
- punpcklbw mm1, mm7
-
- pmullw mm1, mm4
- punpcklbw mm2, mm7
-
- pmullw mm2, mm5
- paddw mm0, round_values
-
- paddw mm1, mm2
- paddw mm0, mm1
-
- psrlw mm0, 8
- packuswb mm0, mm7
-
- movd DWORD PTR [edi], mm0
- add esi, 4
-
- add edi, 4;
- cmp esi, ecx
- jl vs_2_1_i_loop
-
- }
-}
-
-
-
-void
-register_mmxscalers(void) {
- vp8_vertical_band_5_4_scale = vertical_band_5_4_scale_mmx;
- vp8_vertical_band_5_3_scale = vertical_band_5_3_scale_mmx;
- vp8_vertical_band_2_1_scale = vertical_band_2_1_scale_mmx;
- vp8_vertical_band_2_1_scale_i = vertical_band_2_1_scale_i_mmx;
- vp8_horizontal_line_2_1_scale = horizontal_line_2_1_scale_mmx;
- vp8_horizontal_line_5_3_scale = horizontal_line_5_3_scale_mmx;
- vp8_horizontal_line_5_4_scale = horizontal_line_5_4_scale_mmx;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpx_scale/yv12config.h b/videocodec/libvpx_internal/libvpx/vpx_scale/yv12config.h
deleted file mode 100644
index 3a8c7fd..0000000
--- a/videocodec/libvpx_internal/libvpx/vpx_scale/yv12config.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPX_SCALE_YV12CONFIG_H_
-#define VPX_SCALE_YV12CONFIG_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "vpx/vpx_frame_buffer.h"
-#include "vpx/vpx_integer.h"
-
-#define VP8BORDERINPIXELS 32
-#define VP9INNERBORDERINPIXELS 96
-#define VP9_INTERP_EXTEND 4
-#define VP9_ENC_BORDER_IN_PIXELS 160
-#define VP9_DEC_BORDER_IN_PIXELS 0
-
-typedef struct yv12_buffer_config {
- int y_width;
- int y_height;
- int y_crop_width;
- int y_crop_height;
- int y_stride;
-
- int uv_width;
- int uv_height;
- int uv_crop_width;
- int uv_crop_height;
- int uv_stride;
-
- int alpha_width;
- int alpha_height;
- int alpha_stride;
-
- uint8_t *y_buffer;
- uint8_t *u_buffer;
- uint8_t *v_buffer;
- uint8_t *alpha_buffer;
-
- uint8_t *buffer_alloc;
- int buffer_alloc_sz;
- int border;
- int frame_size;
-
- int corrupted;
- int flags;
-
- int fb_index;
-} YV12_BUFFER_CONFIG;
-
-int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border);
-int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border);
-int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf);
-
-int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int ss_x, int ss_y,
- int border);
-
-// Updates the yv12 buffer config with the frame buffer. If cb is not
-// NULL, then libvpx is using the frame buffer callbacks to handle memory.
-// If cb is not NULL, libvpx will call cb with minimum size in bytes needed
-// to decode the current frame. If cb is NULL, libvpx will allocate memory
-// internally to decode the current frame. Returns 0 on success. Returns < 0
-// on failure.
-int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int ss_x, int ss_y,
- int border,
- vpx_codec_frame_buffer_t *fb,
- vpx_get_frame_buffer_cb_fn_t cb,
- void *cb_priv);
-int vp9_free_frame_buffer(YV12_BUFFER_CONFIG *ybf);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // VPX_SCALE_YV12CONFIG_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpxdec.c b/videocodec/libvpx_internal/libvpx/vpxdec.c
deleted file mode 100644
index 4c37234..0000000
--- a/videocodec/libvpx_internal/libvpx/vpxdec.c
+++ /dev/null
@@ -1,994 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <limits.h>
-
-#include "third_party/libyuv/include/libyuv/scale.h"
-
-#include "./args.h"
-#include "./ivfdec.h"
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include "./vpx_config.h"
-#include "vpx/vpx_decoder.h"
-#include "vpx_ports/mem_ops.h"
-#include "vpx_ports/vpx_timer.h"
-
-#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
-#include "vpx/vp8dx.h"
-#endif
-
-#include "./md5_utils.h"
-
-#include "./tools_common.h"
-#include "./webmdec.h"
-#include "./y4menc.h"
-
-static const char *exec_name;
-
-struct VpxDecInputContext {
- struct VpxInputContext *vpx_input_ctx;
- struct WebmInputContext *webm_ctx;
-};
-
-static const arg_def_t looparg = ARG_DEF(NULL, "loops", 1,
- "Number of times to decode the file");
-static const arg_def_t codecarg = ARG_DEF(NULL, "codec", 1,
- "Codec to use");
-static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0,
- "Output raw YV12 frames");
-static const arg_def_t use_i420 = ARG_DEF(NULL, "i420", 0,
- "Output raw I420 frames");
-static const arg_def_t flipuvarg = ARG_DEF(NULL, "flipuv", 0,
- "Flip the chroma planes in the output");
-static const arg_def_t noblitarg = ARG_DEF(NULL, "noblit", 0,
- "Don't process the decoded frames");
-static const arg_def_t progressarg = ARG_DEF(NULL, "progress", 0,
- "Show progress after each frame decodes");
-static const arg_def_t limitarg = ARG_DEF(NULL, "limit", 1,
- "Stop decoding after n frames");
-static const arg_def_t skiparg = ARG_DEF(NULL, "skip", 1,
- "Skip the first n input frames");
-static const arg_def_t postprocarg = ARG_DEF(NULL, "postproc", 0,
- "Postprocess decoded frames");
-static const arg_def_t summaryarg = ARG_DEF(NULL, "summary", 0,
- "Show timing summary");
-static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
- "Output file name pattern (see below)");
-static const arg_def_t threadsarg = ARG_DEF("t", "threads", 1,
- "Max threads to use");
-static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0,
- "Show version string");
-static const arg_def_t error_concealment = ARG_DEF(NULL, "error-concealment", 0,
- "Enable decoder error-concealment");
-static const arg_def_t scalearg = ARG_DEF("S", "scale", 0,
- "Scale output frames uniformly");
-
-static const arg_def_t fb_arg =
- ARG_DEF(NULL, "frame-buffers", 1, "Number of frame buffers to use");
-
-static const arg_def_t md5arg = ARG_DEF(NULL, "md5", 0,
- "Compute the MD5 sum of the decoded frame");
-
-static const arg_def_t *all_args[] = {
- &codecarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg,
- &progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile,
- &threadsarg, &verbosearg, &scalearg, &fb_arg,
- &md5arg,
- &error_concealment,
- NULL
-};
-
-#if CONFIG_VP8_DECODER
-static const arg_def_t addnoise_level = ARG_DEF(NULL, "noise-level", 1,
- "Enable VP8 postproc add noise");
-static const arg_def_t deblock = ARG_DEF(NULL, "deblock", 0,
- "Enable VP8 deblocking");
-static const arg_def_t demacroblock_level = ARG_DEF(NULL, "demacroblock-level", 1,
- "Enable VP8 demacroblocking, w/ level");
-static const arg_def_t pp_debug_info = ARG_DEF(NULL, "pp-debug-info", 1,
- "Enable VP8 visible debug info");
-static const arg_def_t pp_disp_ref_frame = ARG_DEF(NULL, "pp-dbg-ref-frame", 1,
- "Display only selected reference frame per macro block");
-static const arg_def_t pp_disp_mb_modes = ARG_DEF(NULL, "pp-dbg-mb-modes", 1,
- "Display only selected macro block modes");
-static const arg_def_t pp_disp_b_modes = ARG_DEF(NULL, "pp-dbg-b-modes", 1,
- "Display only selected block modes");
-static const arg_def_t pp_disp_mvs = ARG_DEF(NULL, "pp-dbg-mvs", 1,
- "Draw only selected motion vectors");
-static const arg_def_t mfqe = ARG_DEF(NULL, "mfqe", 0,
- "Enable multiframe quality enhancement");
-
-static const arg_def_t *vp8_pp_args[] = {
- &addnoise_level, &deblock, &demacroblock_level, &pp_debug_info,
- &pp_disp_ref_frame, &pp_disp_mb_modes, &pp_disp_b_modes, &pp_disp_mvs, &mfqe,
- NULL
-};
-#endif
-
-static int vpx_image_scale(vpx_image_t *src, vpx_image_t *dst,
- FilterMode mode) {
- assert(src->fmt == VPX_IMG_FMT_I420);
- assert(dst->fmt == VPX_IMG_FMT_I420);
- return I420Scale(src->planes[VPX_PLANE_Y], src->stride[VPX_PLANE_Y],
- src->planes[VPX_PLANE_U], src->stride[VPX_PLANE_U],
- src->planes[VPX_PLANE_V], src->stride[VPX_PLANE_V],
- src->d_w, src->d_h,
- dst->planes[VPX_PLANE_Y], dst->stride[VPX_PLANE_Y],
- dst->planes[VPX_PLANE_U], dst->stride[VPX_PLANE_U],
- dst->planes[VPX_PLANE_V], dst->stride[VPX_PLANE_V],
- dst->d_w, dst->d_h,
- mode);
-}
-
-void usage_exit() {
- int i;
-
- fprintf(stderr, "Usage: %s <options> filename\n\n"
- "Options:\n", exec_name);
- arg_show_usage(stderr, all_args);
-#if CONFIG_VP8_DECODER
- fprintf(stderr, "\nVP8 Postprocessing Options:\n");
- arg_show_usage(stderr, vp8_pp_args);
-#endif
- fprintf(stderr,
- "\nOutput File Patterns:\n\n"
- " The -o argument specifies the name of the file(s) to "
- "write to. If the\n argument does not include any escape "
- "characters, the output will be\n written to a single file. "
- "Otherwise, the filename will be calculated by\n expanding "
- "the following escape characters:\n");
- fprintf(stderr,
- "\n\t%%w - Frame width"
- "\n\t%%h - Frame height"
- "\n\t%%<n> - Frame number, zero padded to <n> places (1..9)"
- "\n\n Pattern arguments are only supported in conjunction "
- "with the --yv12 and\n --i420 options. If the -o option is "
- "not specified, the output will be\n directed to stdout.\n"
- );
- fprintf(stderr, "\nIncluded decoders:\n\n");
-
- for (i = 0; i < get_vpx_decoder_count(); ++i) {
- const VpxInterface *const decoder = get_vpx_decoder_by_index(i);
- fprintf(stderr, " %-6s - %s\n",
- decoder->name, vpx_codec_iface_name(decoder->interface()));
- }
-
- exit(EXIT_FAILURE);
-}
-
-static int raw_read_frame(FILE *infile, uint8_t **buffer,
- size_t *bytes_read, size_t *buffer_size) {
- char raw_hdr[RAW_FRAME_HDR_SZ];
- size_t frame_size = 0;
-
- if (fread(raw_hdr, RAW_FRAME_HDR_SZ, 1, infile) != 1) {
- if (!feof(infile))
- warn("Failed to read RAW frame size\n");
- } else {
- const size_t kCorruptFrameThreshold = 256 * 1024 * 1024;
- const size_t kFrameTooSmallThreshold = 256 * 1024;
- frame_size = mem_get_le32(raw_hdr);
-
- if (frame_size > kCorruptFrameThreshold) {
- warn("Read invalid frame size (%u)\n", (unsigned int)frame_size);
- frame_size = 0;
- }
-
- if (frame_size < kFrameTooSmallThreshold) {
- warn("Warning: Read invalid frame size (%u) - not a raw file?\n",
- (unsigned int)frame_size);
- }
-
- if (frame_size > *buffer_size) {
- uint8_t *new_buf = realloc(*buffer, 2 * frame_size);
- if (new_buf) {
- *buffer = new_buf;
- *buffer_size = 2 * frame_size;
- } else {
- warn("Failed to allocate compressed data buffer\n");
- frame_size = 0;
- }
- }
- }
-
- if (!feof(infile)) {
- if (fread(*buffer, 1, frame_size, infile) != frame_size) {
- warn("Failed to read full frame\n");
- return 1;
- }
- *bytes_read = frame_size;
- }
-
- return 0;
-}
-
-static int read_frame(struct VpxDecInputContext *input, uint8_t **buf,
- size_t *bytes_in_buffer, size_t *buffer_size) {
- switch (input->vpx_input_ctx->file_type) {
-#if CONFIG_WEBM_IO
- case FILE_TYPE_WEBM:
- return webm_read_frame(input->webm_ctx,
- buf, bytes_in_buffer, buffer_size);
-#endif
- case FILE_TYPE_RAW:
- return raw_read_frame(input->vpx_input_ctx->file,
- buf, bytes_in_buffer, buffer_size);
- case FILE_TYPE_IVF:
- return ivf_read_frame(input->vpx_input_ctx->file,
- buf, bytes_in_buffer, buffer_size);
- default:
- return 1;
- }
-}
-
-static void update_image_md5(const vpx_image_t *img, const int planes[3],
- MD5Context *md5) {
- int i, y;
-
- for (i = 0; i < 3; ++i) {
- const int plane = planes[i];
- const unsigned char *buf = img->planes[plane];
- const int stride = img->stride[plane];
- const int w = vpx_img_plane_width(img, plane);
- const int h = vpx_img_plane_height(img, plane);
-
- for (y = 0; y < h; ++y) {
- MD5Update(md5, buf, w);
- buf += stride;
- }
- }
-}
-
-static void write_image_file(const vpx_image_t *img, const int planes[3],
- FILE *file) {
- int i, y;
-
- for (i = 0; i < 3; ++i) {
- const int plane = planes[i];
- const unsigned char *buf = img->planes[plane];
- const int stride = img->stride[plane];
- const int w = vpx_img_plane_width(img, plane);
- const int h = vpx_img_plane_height(img, plane);
-
- for (y = 0; y < h; ++y) {
- fwrite(buf, 1, w, file);
- buf += stride;
- }
- }
-}
-
-int file_is_raw(struct VpxInputContext *input) {
- uint8_t buf[32];
- int is_raw = 0;
- vpx_codec_stream_info_t si;
-
- si.sz = sizeof(si);
-
- if (fread(buf, 1, 32, input->file) == 32) {
- int i;
-
- if (mem_get_le32(buf) < 256 * 1024 * 1024) {
- for (i = 0; i < get_vpx_decoder_count(); ++i) {
- const VpxInterface *const decoder = get_vpx_decoder_by_index(i);
- if (!vpx_codec_peek_stream_info(decoder->interface(),
- buf + 4, 32 - 4, &si)) {
- is_raw = 1;
- input->fourcc = decoder->fourcc;
- input->width = si.w;
- input->height = si.h;
- input->framerate.numerator = 30;
- input->framerate.denominator = 1;
- break;
- }
- }
- }
- }
-
- rewind(input->file);
- return is_raw;
-}
-
-void show_progress(int frame_in, int frame_out, uint64_t dx_time) {
- fprintf(stderr,
- "%d decoded frames/%d showed frames in %"PRId64" us (%.2f fps)\r",
- frame_in, frame_out, dx_time,
- (double)frame_out * 1000000.0 / (double)dx_time);
-}
-
-struct ExternalFrameBuffer {
- uint8_t* data;
- size_t size;
- int in_use;
-};
-
-struct ExternalFrameBufferList {
- int num_external_frame_buffers;
- struct ExternalFrameBuffer *ext_fb;
-};
-
-// Callback used by libvpx to request an external frame buffer. |cb_priv|
-// Application private data passed into the set function. |min_size| is the
-// minimum size in bytes needed to decode the next frame. |fb| pointer to the
-// frame buffer.
-int get_vp9_frame_buffer(void *cb_priv, size_t min_size,
- vpx_codec_frame_buffer_t *fb) {
- int i;
- struct ExternalFrameBufferList *const ext_fb_list =
- (struct ExternalFrameBufferList *)cb_priv;
- if (ext_fb_list == NULL)
- return -1;
-
- // Find a free frame buffer.
- for (i = 0; i < ext_fb_list->num_external_frame_buffers; ++i) {
- if (!ext_fb_list->ext_fb[i].in_use)
- break;
- }
-
- if (i == ext_fb_list->num_external_frame_buffers)
- return -1;
-
- if (ext_fb_list->ext_fb[i].size < min_size) {
- free(ext_fb_list->ext_fb[i].data);
- ext_fb_list->ext_fb[i].data = (uint8_t *)malloc(min_size);
- if (!ext_fb_list->ext_fb[i].data)
- return -1;
-
- ext_fb_list->ext_fb[i].size = min_size;
- }
-
- fb->data = ext_fb_list->ext_fb[i].data;
- fb->size = ext_fb_list->ext_fb[i].size;
- ext_fb_list->ext_fb[i].in_use = 1;
-
- // Set the frame buffer's private data to point at the external frame buffer.
- fb->priv = &ext_fb_list->ext_fb[i];
- return 0;
-}
-
-// Callback used by libvpx when there are no references to the frame buffer.
-// |cb_priv| user private data passed into the set function. |fb| pointer
-// to the frame buffer.
-int release_vp9_frame_buffer(void *cb_priv,
- vpx_codec_frame_buffer_t *fb) {
- struct ExternalFrameBuffer *const ext_fb =
- (struct ExternalFrameBuffer *)fb->priv;
- (void)cb_priv;
- ext_fb->in_use = 0;
- return 0;
-}
-
-void generate_filename(const char *pattern, char *out, size_t q_len,
- unsigned int d_w, unsigned int d_h,
- unsigned int frame_in) {
- const char *p = pattern;
- char *q = out;
-
- do {
- char *next_pat = strchr(p, '%');
-
- if (p == next_pat) {
- size_t pat_len;
-
- /* parse the pattern */
- q[q_len - 1] = '\0';
- switch (p[1]) {
- case 'w':
- snprintf(q, q_len - 1, "%d", d_w);
- break;
- case 'h':
- snprintf(q, q_len - 1, "%d", d_h);
- break;
- case '1':
- snprintf(q, q_len - 1, "%d", frame_in);
- break;
- case '2':
- snprintf(q, q_len - 1, "%02d", frame_in);
- break;
- case '3':
- snprintf(q, q_len - 1, "%03d", frame_in);
- break;
- case '4':
- snprintf(q, q_len - 1, "%04d", frame_in);
- break;
- case '5':
- snprintf(q, q_len - 1, "%05d", frame_in);
- break;
- case '6':
- snprintf(q, q_len - 1, "%06d", frame_in);
- break;
- case '7':
- snprintf(q, q_len - 1, "%07d", frame_in);
- break;
- case '8':
- snprintf(q, q_len - 1, "%08d", frame_in);
- break;
- case '9':
- snprintf(q, q_len - 1, "%09d", frame_in);
- break;
- default:
- die("Unrecognized pattern %%%c\n", p[1]);
- }
-
- pat_len = strlen(q);
- if (pat_len >= q_len - 1)
- die("Output filename too long.\n");
- q += pat_len;
- p += 2;
- q_len -= pat_len;
- } else {
- size_t copy_len;
-
- /* copy the next segment */
- if (!next_pat)
- copy_len = strlen(p);
- else
- copy_len = next_pat - p;
-
- if (copy_len >= q_len - 1)
- die("Output filename too long.\n");
-
- memcpy(q, p, copy_len);
- q[copy_len] = '\0';
- q += copy_len;
- p += copy_len;
- q_len -= copy_len;
- }
- } while (*p);
-}
-
-static int is_single_file(const char *outfile_pattern) {
- const char *p = outfile_pattern;
-
- do {
- p = strchr(p, '%');
- if (p && p[1] >= '1' && p[1] <= '9')
- return 0; // pattern contains sequence number, so it's not unique
- if (p)
- p++;
- } while (p);
-
- return 1;
-}
-
-static void print_md5(unsigned char digest[16], const char *filename) {
- int i;
-
- for (i = 0; i < 16; ++i)
- printf("%02x", digest[i]);
- printf(" %s\n", filename);
-}
-
-static FILE *open_outfile(const char *name) {
- if (strcmp("-", name) == 0) {
- set_binary_mode(stdout);
- return stdout;
- } else {
- FILE *file = fopen(name, "wb");
- if (!file)
- fatal("Failed to output file %s", name);
- return file;
- }
-}
-
-int main_loop(int argc, const char **argv_) {
- vpx_codec_ctx_t decoder;
- char *fn = NULL;
- int i;
- uint8_t *buf = NULL;
- size_t bytes_in_buffer = 0, buffer_size = 0;
- FILE *infile;
- int frame_in = 0, frame_out = 0, flipuv = 0, noblit = 0;
- int do_md5 = 0, progress = 0;
- int stop_after = 0, postproc = 0, summary = 0, quiet = 1;
- int arg_skip = 0;
- int ec_enabled = 0;
- const VpxInterface *interface = NULL;
- const VpxInterface *fourcc_interface = NULL;
- uint64_t dx_time = 0;
- struct arg arg;
- char **argv, **argi, **argj;
-
- int single_file;
- int use_y4m = 1;
- vpx_codec_dec_cfg_t cfg = {0};
-#if CONFIG_VP8_DECODER
- vp8_postproc_cfg_t vp8_pp_cfg = {0};
- int vp8_dbg_color_ref_frame = 0;
- int vp8_dbg_color_mb_modes = 0;
- int vp8_dbg_color_b_modes = 0;
- int vp8_dbg_display_mv = 0;
-#endif
- int frames_corrupted = 0;
- int dec_flags = 0;
- int do_scale = 0;
- vpx_image_t *scaled_img = NULL;
- int frame_avail, got_data;
- int num_external_frame_buffers = 0;
- struct ExternalFrameBufferList ext_fb_list = {0};
-
- const char *outfile_pattern = NULL;
- char outfile_name[PATH_MAX] = {0};
- FILE *outfile = NULL;
-
- MD5Context md5_ctx;
- unsigned char md5_digest[16];
-
- struct VpxDecInputContext input = {0};
- struct VpxInputContext vpx_input_ctx = {0};
- struct WebmInputContext webm_ctx = {0};
- input.vpx_input_ctx = &vpx_input_ctx;
- input.webm_ctx = &webm_ctx;
-
- /* Parse command line */
- exec_name = argv_[0];
- argv = argv_dup(argc - 1, argv_ + 1);
-
- for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
- memset(&arg, 0, sizeof(arg));
- arg.argv_step = 1;
-
- if (arg_match(&arg, &codecarg, argi)) {
- interface = get_vpx_decoder_by_name(arg.val);
- if (!interface)
- die("Error: Unrecognized argument (%s) to --codec\n", arg.val);
- } else if (arg_match(&arg, &looparg, argi)) {
- // no-op
- } else if (arg_match(&arg, &outputfile, argi))
- outfile_pattern = arg.val;
- else if (arg_match(&arg, &use_yv12, argi)) {
- use_y4m = 0;
- flipuv = 1;
- } else if (arg_match(&arg, &use_i420, argi)) {
- use_y4m = 0;
- flipuv = 0;
- } else if (arg_match(&arg, &flipuvarg, argi))
- flipuv = 1;
- else if (arg_match(&arg, &noblitarg, argi))
- noblit = 1;
- else if (arg_match(&arg, &progressarg, argi))
- progress = 1;
- else if (arg_match(&arg, &limitarg, argi))
- stop_after = arg_parse_uint(&arg);
- else if (arg_match(&arg, &skiparg, argi))
- arg_skip = arg_parse_uint(&arg);
- else if (arg_match(&arg, &postprocarg, argi))
- postproc = 1;
- else if (arg_match(&arg, &md5arg, argi))
- do_md5 = 1;
- else if (arg_match(&arg, &summaryarg, argi))
- summary = 1;
- else if (arg_match(&arg, &threadsarg, argi))
- cfg.threads = arg_parse_uint(&arg);
- else if (arg_match(&arg, &verbosearg, argi))
- quiet = 0;
- else if (arg_match(&arg, &scalearg, argi))
- do_scale = 1;
- else if (arg_match(&arg, &fb_arg, argi))
- num_external_frame_buffers = arg_parse_uint(&arg);
-
-#if CONFIG_VP8_DECODER
- else if (arg_match(&arg, &addnoise_level, argi)) {
- postproc = 1;
- vp8_pp_cfg.post_proc_flag |= VP8_ADDNOISE;
- vp8_pp_cfg.noise_level = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &demacroblock_level, argi)) {
- postproc = 1;
- vp8_pp_cfg.post_proc_flag |= VP8_DEMACROBLOCK;
- vp8_pp_cfg.deblocking_level = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &deblock, argi)) {
- postproc = 1;
- vp8_pp_cfg.post_proc_flag |= VP8_DEBLOCK;
- } else if (arg_match(&arg, &mfqe, argi)) {
- postproc = 1;
- vp8_pp_cfg.post_proc_flag |= VP8_MFQE;
- } else if (arg_match(&arg, &pp_debug_info, argi)) {
- unsigned int level = arg_parse_uint(&arg);
-
- postproc = 1;
- vp8_pp_cfg.post_proc_flag &= ~0x7;
-
- if (level)
- vp8_pp_cfg.post_proc_flag |= level;
- } else if (arg_match(&arg, &pp_disp_ref_frame, argi)) {
- unsigned int flags = arg_parse_int(&arg);
- if (flags) {
- postproc = 1;
- vp8_dbg_color_ref_frame = flags;
- }
- } else if (arg_match(&arg, &pp_disp_mb_modes, argi)) {
- unsigned int flags = arg_parse_int(&arg);
- if (flags) {
- postproc = 1;
- vp8_dbg_color_mb_modes = flags;
- }
- } else if (arg_match(&arg, &pp_disp_b_modes, argi)) {
- unsigned int flags = arg_parse_int(&arg);
- if (flags) {
- postproc = 1;
- vp8_dbg_color_b_modes = flags;
- }
- } else if (arg_match(&arg, &pp_disp_mvs, argi)) {
- unsigned int flags = arg_parse_int(&arg);
- if (flags) {
- postproc = 1;
- vp8_dbg_display_mv = flags;
- }
- } else if (arg_match(&arg, &error_concealment, argi)) {
- ec_enabled = 1;
- }
-
-#endif
- else
- argj++;
- }
-
- /* Check for unrecognized options */
- for (argi = argv; *argi; argi++)
- if (argi[0][0] == '-' && strlen(argi[0]) > 1)
- die("Error: Unrecognized option %s\n", *argi);
-
- /* Handle non-option arguments */
- fn = argv[0];
-
- if (!fn)
- usage_exit();
-
- /* Open file */
- infile = strcmp(fn, "-") ? fopen(fn, "rb") : set_binary_mode(stdin);
-
- if (!infile) {
- fprintf(stderr, "Failed to open file '%s'", strcmp(fn, "-") ? fn : "stdin");
- return EXIT_FAILURE;
- }
-#if CONFIG_OS_SUPPORT
- /* Make sure we don't dump to the terminal, unless forced to with -o - */
- if (!outfile_pattern && isatty(fileno(stdout)) && !do_md5 && !noblit) {
- fprintf(stderr,
- "Not dumping raw video to your terminal. Use '-o -' to "
- "override.\n");
- return EXIT_FAILURE;
- }
-#endif
- input.vpx_input_ctx->file = infile;
- if (file_is_ivf(input.vpx_input_ctx))
- input.vpx_input_ctx->file_type = FILE_TYPE_IVF;
-#if CONFIG_WEBM_IO
- else if (file_is_webm(input.webm_ctx, input.vpx_input_ctx))
- input.vpx_input_ctx->file_type = FILE_TYPE_WEBM;
-#endif
- else if (file_is_raw(input.vpx_input_ctx))
- input.vpx_input_ctx->file_type = FILE_TYPE_RAW;
- else {
- fprintf(stderr, "Unrecognized input file type.\n");
-#if !CONFIG_WEBM_IO
- fprintf(stderr, "vpxdec was built without WebM container support.\n");
-#endif
- return EXIT_FAILURE;
- }
-
- outfile_pattern = outfile_pattern ? outfile_pattern : "-";
- single_file = is_single_file(outfile_pattern);
-
- if (!noblit && single_file) {
- generate_filename(outfile_pattern, outfile_name, PATH_MAX,
- vpx_input_ctx.width, vpx_input_ctx.height, 0);
- if (do_md5)
- MD5Init(&md5_ctx);
- else
- outfile = open_outfile(outfile_name);
- }
-
- if (use_y4m && !noblit) {
- if (!single_file) {
- fprintf(stderr, "YUV4MPEG2 not supported with output patterns,"
- " try --i420 or --yv12.\n");
- return EXIT_FAILURE;
- }
-
-#if CONFIG_WEBM_IO
- if (vpx_input_ctx.file_type == FILE_TYPE_WEBM) {
- if (webm_guess_framerate(input.webm_ctx, input.vpx_input_ctx)) {
- fprintf(stderr, "Failed to guess framerate -- error parsing "
- "webm file?\n");
- return EXIT_FAILURE;
- }
- }
-#endif
- }
-
- fourcc_interface = get_vpx_decoder_by_fourcc(vpx_input_ctx.fourcc);
- if (interface && fourcc_interface && interface != fourcc_interface)
- warn("Header indicates codec: %s\n", fourcc_interface->name);
- else
- interface = fourcc_interface;
-
- if (!interface)
- interface = get_vpx_decoder_by_index(0);
-
- dec_flags = (postproc ? VPX_CODEC_USE_POSTPROC : 0) |
- (ec_enabled ? VPX_CODEC_USE_ERROR_CONCEALMENT : 0);
- if (vpx_codec_dec_init(&decoder, interface->interface(), &cfg, dec_flags)) {
- fprintf(stderr, "Failed to initialize decoder: %s\n",
- vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-
- if (!quiet)
- fprintf(stderr, "%s\n", decoder.name);
-
-#if CONFIG_VP8_DECODER
-
- if (vp8_pp_cfg.post_proc_flag
- && vpx_codec_control(&decoder, VP8_SET_POSTPROC, &vp8_pp_cfg)) {
- fprintf(stderr, "Failed to configure postproc: %s\n", vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-
- if (vp8_dbg_color_ref_frame
- && vpx_codec_control(&decoder, VP8_SET_DBG_COLOR_REF_FRAME, vp8_dbg_color_ref_frame)) {
- fprintf(stderr, "Failed to configure reference block visualizer: %s\n", vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-
- if (vp8_dbg_color_mb_modes
- && vpx_codec_control(&decoder, VP8_SET_DBG_COLOR_MB_MODES, vp8_dbg_color_mb_modes)) {
- fprintf(stderr, "Failed to configure macro block visualizer: %s\n", vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-
- if (vp8_dbg_color_b_modes
- && vpx_codec_control(&decoder, VP8_SET_DBG_COLOR_B_MODES, vp8_dbg_color_b_modes)) {
- fprintf(stderr, "Failed to configure block visualizer: %s\n", vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-
- if (vp8_dbg_display_mv
- && vpx_codec_control(&decoder, VP8_SET_DBG_DISPLAY_MV, vp8_dbg_display_mv)) {
- fprintf(stderr, "Failed to configure motion vector visualizer: %s\n", vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-#endif
-
-
- if (arg_skip)
- fprintf(stderr, "Skipping first %d frames.\n", arg_skip);
- while (arg_skip) {
- if (read_frame(&input, &buf, &bytes_in_buffer, &buffer_size))
- break;
- arg_skip--;
- }
-
- if (num_external_frame_buffers > 0) {
- ext_fb_list.num_external_frame_buffers = num_external_frame_buffers;
- ext_fb_list.ext_fb = (struct ExternalFrameBuffer *)calloc(
- num_external_frame_buffers, sizeof(*ext_fb_list.ext_fb));
- if (vpx_codec_set_frame_buffer_functions(
- &decoder, get_vp9_frame_buffer, release_vp9_frame_buffer,
- &ext_fb_list)) {
- fprintf(stderr, "Failed to configure external frame buffers: %s\n",
- vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
- }
-
- frame_avail = 1;
- got_data = 0;
-
- /* Decode file */
- while (frame_avail || got_data) {
- vpx_codec_iter_t iter = NULL;
- vpx_image_t *img;
- struct vpx_usec_timer timer;
- int corrupted;
-
- frame_avail = 0;
- if (!stop_after || frame_in < stop_after) {
- if (!read_frame(&input, &buf, &bytes_in_buffer, &buffer_size)) {
- frame_avail = 1;
- frame_in++;
-
- vpx_usec_timer_start(&timer);
-
- if (vpx_codec_decode(&decoder, buf, (unsigned int)bytes_in_buffer,
- NULL, 0)) {
- const char *detail = vpx_codec_error_detail(&decoder);
- warn("Failed to decode frame %d: %s",
- frame_in, vpx_codec_error(&decoder));
-
- if (detail)
- warn("Additional information: %s", detail);
- goto fail;
- }
-
- vpx_usec_timer_mark(&timer);
- dx_time += vpx_usec_timer_elapsed(&timer);
- }
- }
-
- vpx_usec_timer_start(&timer);
-
- got_data = 0;
- if ((img = vpx_codec_get_frame(&decoder, &iter))) {
- ++frame_out;
- got_data = 1;
- }
-
- vpx_usec_timer_mark(&timer);
- dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer);
-
- if (vpx_codec_control(&decoder, VP8D_GET_FRAME_CORRUPTED, &corrupted)) {
- warn("Failed VP8_GET_FRAME_CORRUPTED: %s", vpx_codec_error(&decoder));
- goto fail;
- }
- frames_corrupted += corrupted;
-
- if (progress)
- show_progress(frame_in, frame_out, dx_time);
-
- if (!noblit && img) {
- const int PLANES_YUV[] = {VPX_PLANE_Y, VPX_PLANE_U, VPX_PLANE_V};
- const int PLANES_YVU[] = {VPX_PLANE_Y, VPX_PLANE_V, VPX_PLANE_U};
- const int *planes = flipuv ? PLANES_YVU : PLANES_YUV;
-
- if (do_scale) {
- if (frame_out == 1) {
- // If the output frames are to be scaled to a fixed display size then
- // use the width and height specified in the container. If either of
- // these is set to 0, use the display size set in the first frame
- // header. If that is unavailable, use the raw decoded size of the
- // first decoded frame.
- int display_width = vpx_input_ctx.width;
- int display_height = vpx_input_ctx.height;
- if (!display_width || !display_height) {
- int display_size[2];
- if (vpx_codec_control(&decoder, VP9D_GET_DISPLAY_SIZE,
- display_size)) {
- // As last resort use size of first frame as display size.
- display_width = img->d_w;
- display_height = img->d_h;
- } else {
- display_width = display_size[0];
- display_height = display_size[1];
- }
- }
- scaled_img = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, display_width,
- display_height, 16);
- }
-
- if (img->d_w != scaled_img->d_w || img->d_h != scaled_img->d_h) {
- vpx_image_scale(img, scaled_img, kFilterBox);
- img = scaled_img;
- }
- }
-
- if (single_file) {
- if (use_y4m) {
- char buf[Y4M_BUFFER_SIZE] = {0};
- size_t len = 0;
- if (frame_out == 1) {
- // Y4M file header
- len = y4m_write_file_header(buf, sizeof(buf),
- vpx_input_ctx.width,
- vpx_input_ctx.height,
- &vpx_input_ctx.framerate, img->fmt);
- if (do_md5) {
- MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
- } else {
- fputs(buf, outfile);
- }
- }
-
- // Y4M frame header
- len = y4m_write_frame_header(buf, sizeof(buf));
- if (do_md5) {
- MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
- } else {
- fputs(buf, outfile);
- }
- }
-
- if (do_md5) {
- update_image_md5(img, planes, &md5_ctx);
- } else {
- write_image_file(img, planes, outfile);
- }
- } else {
- generate_filename(outfile_pattern, outfile_name, PATH_MAX,
- img->d_w, img->d_h, frame_in);
- if (do_md5) {
- MD5Init(&md5_ctx);
- update_image_md5(img, planes, &md5_ctx);
- MD5Final(md5_digest, &md5_ctx);
- print_md5(md5_digest, outfile_name);
- } else {
- outfile = open_outfile(outfile_name);
- write_image_file(img, planes, outfile);
- fclose(outfile);
- }
- }
- }
-
- if (stop_after && frame_in >= stop_after)
- break;
- }
-
- if (summary || progress) {
- show_progress(frame_in, frame_out, dx_time);
- fprintf(stderr, "\n");
- }
-
- if (frames_corrupted)
- fprintf(stderr, "WARNING: %d frames corrupted.\n", frames_corrupted);
-
-fail:
-
- if (vpx_codec_destroy(&decoder)) {
- fprintf(stderr, "Failed to destroy decoder: %s\n",
- vpx_codec_error(&decoder));
- return EXIT_FAILURE;
- }
-
- if (!noblit && single_file) {
- if (do_md5) {
- MD5Final(md5_digest, &md5_ctx);
- print_md5(md5_digest, outfile_name);
- } else {
- fclose(outfile);
- }
- }
-
-#if CONFIG_WEBM_IO
- if (input.vpx_input_ctx->file_type == FILE_TYPE_WEBM)
- webm_free(input.webm_ctx);
-#endif
-
- if (input.vpx_input_ctx->file_type != FILE_TYPE_WEBM)
- free(buf);
-
- if (scaled_img) vpx_img_free(scaled_img);
-
- for (i = 0; i < ext_fb_list.num_external_frame_buffers; ++i) {
- free(ext_fb_list.ext_fb[i].data);
- }
- free(ext_fb_list.ext_fb);
-
- fclose(infile);
- free(argv);
-
- return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
-}
-
-int main(int argc, const char **argv_) {
- unsigned int loops = 1, i;
- char **argv, **argi, **argj;
- struct arg arg;
- int error = 0;
-
- argv = argv_dup(argc - 1, argv_ + 1);
- for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
- memset(&arg, 0, sizeof(arg));
- arg.argv_step = 1;
-
- if (arg_match(&arg, &looparg, argi)) {
- loops = arg_parse_uint(&arg);
- break;
- }
- }
- free(argv);
- for (i = 0; !error && i < loops; i++)
- error = main_loop(argc, argv_);
- return error;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpxenc.c b/videocodec/libvpx_internal/libvpx/vpxenc.c
deleted file mode 100644
index c4d77f1..0000000
--- a/videocodec/libvpx_internal/libvpx/vpxenc.c
+++ /dev/null
@@ -1,1815 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpxenc.h"
-#include "./vpx_config.h"
-
-#include <assert.h>
-#include <limits.h>
-#include <math.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vpx/vpx_encoder.h"
-#if CONFIG_DECODERS
-#include "vpx/vpx_decoder.h"
-#endif
-
-#include "third_party/libyuv/include/libyuv/scale.h"
-#include "./args.h"
-#include "./ivfenc.h"
-#include "./tools_common.h"
-
-#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
-#include "vpx/vp8cx.h"
-#endif
-#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
-#include "vpx/vp8dx.h"
-#endif
-
-#include "vpx/vpx_integer.h"
-#include "vpx_ports/mem_ops.h"
-#include "vpx_ports/vpx_timer.h"
-#include "./rate_hist.h"
-#include "./vpxstats.h"
-#include "./warnings.h"
-#include "./webmenc.h"
-#include "./y4minput.h"
-
-/* Swallow warnings about unused results of fread/fwrite */
-static size_t wrap_fread(void *ptr, size_t size, size_t nmemb,
- FILE *stream) {
- return fread(ptr, size, nmemb, stream);
-}
-#define fread wrap_fread
-
-static size_t wrap_fwrite(const void *ptr, size_t size, size_t nmemb,
- FILE *stream) {
- return fwrite(ptr, size, nmemb, stream);
-}
-#define fwrite wrap_fwrite
-
-
-static const char *exec_name;
-
-static void warn_or_exit_on_errorv(vpx_codec_ctx_t *ctx, int fatal,
- const char *s, va_list ap) {
- if (ctx->err) {
- const char *detail = vpx_codec_error_detail(ctx);
-
- vfprintf(stderr, s, ap);
- fprintf(stderr, ": %s\n", vpx_codec_error(ctx));
-
- if (detail)
- fprintf(stderr, " %s\n", detail);
-
- if (fatal)
- exit(EXIT_FAILURE);
- }
-}
-
-static void ctx_exit_on_error(vpx_codec_ctx_t *ctx, const char *s, ...) {
- va_list ap;
-
- va_start(ap, s);
- warn_or_exit_on_errorv(ctx, 1, s, ap);
- va_end(ap);
-}
-
-static void warn_or_exit_on_error(vpx_codec_ctx_t *ctx, int fatal,
- const char *s, ...) {
- va_list ap;
-
- va_start(ap, s);
- warn_or_exit_on_errorv(ctx, fatal, s, ap);
- va_end(ap);
-}
-
-int read_frame(struct VpxInputContext *input_ctx, vpx_image_t *img) {
- FILE *f = input_ctx->file;
- y4m_input *y4m = &input_ctx->y4m;
- int shortread = 0;
-
- if (input_ctx->file_type == FILE_TYPE_Y4M) {
- if (y4m_input_fetch_frame(y4m, f, img) < 1)
- return 0;
- } else {
- shortread = read_yuv_frame(input_ctx, img);
- }
-
- return !shortread;
-}
-
-int file_is_y4m(const char detect[4]) {
- if (memcmp(detect, "YUV4", 4) == 0) {
- return 1;
- }
- return 0;
-}
-
-int fourcc_is_ivf(const char detect[4]) {
- if (memcmp(detect, "DKIF", 4) == 0) {
- return 1;
- }
- return 0;
-}
-
-#if CONFIG_WEBM_IO
-/* Murmur hash derived from public domain reference implementation at
- * http:// sites.google.com/site/murmurhash/
- */
-static unsigned int murmur(const void *key, int len, unsigned int seed) {
- const unsigned int m = 0x5bd1e995;
- const int r = 24;
-
- unsigned int h = seed ^ len;
-
- const unsigned char *data = (const unsigned char *)key;
-
- while (len >= 4) {
- unsigned int k;
-
- k = (unsigned int)data[0];
- k |= (unsigned int)data[1] << 8;
- k |= (unsigned int)data[2] << 16;
- k |= (unsigned int)data[3] << 24;
-
- k *= m;
- k ^= k >> r;
- k *= m;
-
- h *= m;
- h ^= k;
-
- data += 4;
- len -= 4;
- }
-
- switch (len) {
- case 3:
- h ^= data[2] << 16;
- case 2:
- h ^= data[1] << 8;
- case 1:
- h ^= data[0];
- h *= m;
- };
-
- h ^= h >> 13;
- h *= m;
- h ^= h >> 15;
-
- return h;
-}
-#endif // CONFIG_WEBM_IO
-
-static const arg_def_t debugmode = ARG_DEF("D", "debug", 0,
- "Debug mode (makes output deterministic)");
-static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
- "Output filename");
-static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0,
- "Input file is YV12 ");
-static const arg_def_t use_i420 = ARG_DEF(NULL, "i420", 0,
- "Input file is I420 (default)");
-static const arg_def_t codecarg = ARG_DEF(NULL, "codec", 1,
- "Codec to use");
-static const arg_def_t passes = ARG_DEF("p", "passes", 1,
- "Number of passes (1/2)");
-static const arg_def_t pass_arg = ARG_DEF(NULL, "pass", 1,
- "Pass to execute (1/2)");
-static const arg_def_t fpf_name = ARG_DEF(NULL, "fpf", 1,
- "First pass statistics file name");
-static const arg_def_t limit = ARG_DEF(NULL, "limit", 1,
- "Stop encoding after n input frames");
-static const arg_def_t skip = ARG_DEF(NULL, "skip", 1,
- "Skip the first n input frames");
-static const arg_def_t deadline = ARG_DEF("d", "deadline", 1,
- "Deadline per frame (usec)");
-static const arg_def_t best_dl = ARG_DEF(NULL, "best", 0,
- "Use Best Quality Deadline");
-static const arg_def_t good_dl = ARG_DEF(NULL, "good", 0,
- "Use Good Quality Deadline");
-static const arg_def_t rt_dl = ARG_DEF(NULL, "rt", 0,
- "Use Realtime Quality Deadline");
-static const arg_def_t quietarg = ARG_DEF("q", "quiet", 0,
- "Do not print encode progress");
-static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0,
- "Show encoder parameters");
-static const arg_def_t psnrarg = ARG_DEF(NULL, "psnr", 0,
- "Show PSNR in status line");
-
-static const struct arg_enum_list test_decode_enum[] = {
- {"off", TEST_DECODE_OFF},
- {"fatal", TEST_DECODE_FATAL},
- {"warn", TEST_DECODE_WARN},
- {NULL, 0}
-};
-static const arg_def_t recontest = ARG_DEF_ENUM(NULL, "test-decode", 1,
- "Test encode/decode mismatch",
- test_decode_enum);
-static const arg_def_t framerate = ARG_DEF(NULL, "fps", 1,
- "Stream frame rate (rate/scale)");
-static const arg_def_t use_ivf = ARG_DEF(NULL, "ivf", 0,
- "Output IVF (default is WebM if WebM IO is enabled)");
-static const arg_def_t out_part = ARG_DEF("P", "output-partitions", 0,
- "Makes encoder output partitions. Requires IVF output!");
-static const arg_def_t q_hist_n = ARG_DEF(NULL, "q-hist", 1,
- "Show quantizer histogram (n-buckets)");
-static const arg_def_t rate_hist_n = ARG_DEF(NULL, "rate-hist", 1,
- "Show rate histogram (n-buckets)");
-static const arg_def_t disable_warnings =
- ARG_DEF(NULL, "disable-warnings", 0,
- "Disable warnings about potentially incorrect encode settings.");
-static const arg_def_t disable_warning_prompt =
- ARG_DEF("y", "disable-warning-prompt", 0,
- "Display warnings, but do not prompt user to continue.");
-static const arg_def_t experimental_bitstream =
- ARG_DEF(NULL, "experimental-bitstream", 0,
- "Allow experimental bitstream features.");
-
-
-static const arg_def_t *main_args[] = {
- &debugmode,
- &outputfile, &codecarg, &passes, &pass_arg, &fpf_name, &limit, &skip,
- &deadline, &best_dl, &good_dl, &rt_dl,
- &quietarg, &verbosearg, &psnrarg, &use_ivf, &out_part, &q_hist_n,
- &rate_hist_n, &disable_warnings, &disable_warning_prompt,
- NULL
-};
-
-static const arg_def_t usage = ARG_DEF("u", "usage", 1,
- "Usage profile number to use");
-static const arg_def_t threads = ARG_DEF("t", "threads", 1,
- "Max number of threads to use");
-static const arg_def_t profile = ARG_DEF(NULL, "profile", 1,
- "Bitstream profile number to use");
-static const arg_def_t width = ARG_DEF("w", "width", 1,
- "Frame width");
-static const arg_def_t height = ARG_DEF("h", "height", 1,
- "Frame height");
-static const struct arg_enum_list stereo_mode_enum[] = {
- {"mono", STEREO_FORMAT_MONO},
- {"left-right", STEREO_FORMAT_LEFT_RIGHT},
- {"bottom-top", STEREO_FORMAT_BOTTOM_TOP},
- {"top-bottom", STEREO_FORMAT_TOP_BOTTOM},
- {"right-left", STEREO_FORMAT_RIGHT_LEFT},
- {NULL, 0}
-};
-static const arg_def_t stereo_mode = ARG_DEF_ENUM(NULL, "stereo-mode", 1,
- "Stereo 3D video format", stereo_mode_enum);
-static const arg_def_t timebase = ARG_DEF(NULL, "timebase", 1,
- "Output timestamp precision (fractional seconds)");
-static const arg_def_t error_resilient = ARG_DEF(NULL, "error-resilient", 1,
- "Enable error resiliency features");
-static const arg_def_t lag_in_frames = ARG_DEF(NULL, "lag-in-frames", 1,
- "Max number of frames to lag");
-
-static const arg_def_t *global_args[] = {
- &use_yv12, &use_i420, &usage, &threads, &profile,
- &width, &height, &stereo_mode, &timebase, &framerate,
- &error_resilient,
- &lag_in_frames, NULL
-};
-
-static const arg_def_t dropframe_thresh = ARG_DEF(NULL, "drop-frame", 1,
- "Temporal resampling threshold (buf %)");
-static const arg_def_t resize_allowed = ARG_DEF(NULL, "resize-allowed", 1,
- "Spatial resampling enabled (bool)");
-static const arg_def_t resize_up_thresh = ARG_DEF(NULL, "resize-up", 1,
- "Upscale threshold (buf %)");
-static const arg_def_t resize_down_thresh = ARG_DEF(NULL, "resize-down", 1,
- "Downscale threshold (buf %)");
-static const struct arg_enum_list end_usage_enum[] = {
- {"vbr", VPX_VBR},
- {"cbr", VPX_CBR},
- {"cq", VPX_CQ},
- {"q", VPX_Q},
- {NULL, 0}
-};
-static const arg_def_t end_usage = ARG_DEF_ENUM(NULL, "end-usage", 1,
- "Rate control mode", end_usage_enum);
-static const arg_def_t target_bitrate = ARG_DEF(NULL, "target-bitrate", 1,
- "Bitrate (kbps)");
-static const arg_def_t min_quantizer = ARG_DEF(NULL, "min-q", 1,
- "Minimum (best) quantizer");
-static const arg_def_t max_quantizer = ARG_DEF(NULL, "max-q", 1,
- "Maximum (worst) quantizer");
-static const arg_def_t undershoot_pct = ARG_DEF(NULL, "undershoot-pct", 1,
- "Datarate undershoot (min) target (%)");
-static const arg_def_t overshoot_pct = ARG_DEF(NULL, "overshoot-pct", 1,
- "Datarate overshoot (max) target (%)");
-static const arg_def_t buf_sz = ARG_DEF(NULL, "buf-sz", 1,
- "Client buffer size (ms)");
-static const arg_def_t buf_initial_sz = ARG_DEF(NULL, "buf-initial-sz", 1,
- "Client initial buffer size (ms)");
-static const arg_def_t buf_optimal_sz = ARG_DEF(NULL, "buf-optimal-sz", 1,
- "Client optimal buffer size (ms)");
-static const arg_def_t *rc_args[] = {
- &dropframe_thresh, &resize_allowed, &resize_up_thresh, &resize_down_thresh,
- &end_usage, &target_bitrate, &min_quantizer, &max_quantizer,
- &undershoot_pct, &overshoot_pct, &buf_sz, &buf_initial_sz, &buf_optimal_sz,
- NULL
-};
-
-
-static const arg_def_t bias_pct = ARG_DEF(NULL, "bias-pct", 1,
- "CBR/VBR bias (0=CBR, 100=VBR)");
-static const arg_def_t minsection_pct = ARG_DEF(NULL, "minsection-pct", 1,
- "GOP min bitrate (% of target)");
-static const arg_def_t maxsection_pct = ARG_DEF(NULL, "maxsection-pct", 1,
- "GOP max bitrate (% of target)");
-static const arg_def_t *rc_twopass_args[] = {
- &bias_pct, &minsection_pct, &maxsection_pct, NULL
-};
-
-
-static const arg_def_t kf_min_dist = ARG_DEF(NULL, "kf-min-dist", 1,
- "Minimum keyframe interval (frames)");
-static const arg_def_t kf_max_dist = ARG_DEF(NULL, "kf-max-dist", 1,
- "Maximum keyframe interval (frames)");
-static const arg_def_t kf_disabled = ARG_DEF(NULL, "disable-kf", 0,
- "Disable keyframe placement");
-static const arg_def_t *kf_args[] = {
- &kf_min_dist, &kf_max_dist, &kf_disabled, NULL
-};
-
-
-static const arg_def_t noise_sens = ARG_DEF(NULL, "noise-sensitivity", 1,
- "Noise sensitivity (frames to blur)");
-static const arg_def_t sharpness = ARG_DEF(NULL, "sharpness", 1,
- "Filter sharpness (0-7)");
-static const arg_def_t static_thresh = ARG_DEF(NULL, "static-thresh", 1,
- "Motion detection threshold");
-static const arg_def_t cpu_used = ARG_DEF(NULL, "cpu-used", 1,
- "CPU Used (-16..16)");
-static const arg_def_t auto_altref = ARG_DEF(NULL, "auto-alt-ref", 1,
- "Enable automatic alt reference frames");
-static const arg_def_t arnr_maxframes = ARG_DEF(NULL, "arnr-maxframes", 1,
- "AltRef Max Frames");
-static const arg_def_t arnr_strength = ARG_DEF(NULL, "arnr-strength", 1,
- "AltRef Strength");
-static const arg_def_t arnr_type = ARG_DEF(NULL, "arnr-type", 1,
- "AltRef Type");
-static const struct arg_enum_list tuning_enum[] = {
- {"psnr", VP8_TUNE_PSNR},
- {"ssim", VP8_TUNE_SSIM},
- {NULL, 0}
-};
-static const arg_def_t tune_ssim = ARG_DEF_ENUM(NULL, "tune", 1,
- "Material to favor", tuning_enum);
-static const arg_def_t cq_level = ARG_DEF(NULL, "cq-level", 1,
- "Constant/Constrained Quality level");
-static const arg_def_t max_intra_rate_pct = ARG_DEF(NULL, "max-intra-rate", 1,
- "Max I-frame bitrate (pct)");
-
-#if CONFIG_VP8_ENCODER
-static const arg_def_t token_parts =
- ARG_DEF(NULL, "token-parts", 1, "Number of token partitions to use, log2");
-static const arg_def_t *vp8_args[] = {
- &cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh,
- &token_parts, &arnr_maxframes, &arnr_strength, &arnr_type,
- &tune_ssim, &cq_level, &max_intra_rate_pct,
- NULL
-};
-static const int vp8_arg_ctrl_map[] = {
- VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF,
- VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD,
- VP8E_SET_TOKEN_PARTITIONS,
- VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE,
- VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT,
- 0
-};
-#endif
-
-#if CONFIG_VP9_ENCODER
-static const arg_def_t tile_cols =
- ARG_DEF(NULL, "tile-columns", 1, "Number of tile columns to use, log2");
-static const arg_def_t tile_rows =
- ARG_DEF(NULL, "tile-rows", 1, "Number of tile rows to use, log2");
-static const arg_def_t lossless = ARG_DEF(NULL, "lossless", 1, "Lossless mode");
-static const arg_def_t frame_parallel_decoding = ARG_DEF(
- NULL, "frame-parallel", 1, "Enable frame parallel decodability features");
-static const arg_def_t aq_mode = ARG_DEF(
- NULL, "aq-mode", 1,
- "Adaptive q mode (0: off (by default), 1: variance 2: complexity, "
- "3: cyclic refresh)");
-static const arg_def_t frame_periodic_boost = ARG_DEF(
- NULL, "frame_boost", 1,
- "Enable frame periodic boost (0: off (by default), 1: on)");
-
-static const arg_def_t *vp9_args[] = {
- &cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh,
- &tile_cols, &tile_rows, &arnr_maxframes, &arnr_strength, &arnr_type,
- &tune_ssim, &cq_level, &max_intra_rate_pct, &lossless,
- &frame_parallel_decoding, &aq_mode, &frame_periodic_boost,
- NULL
-};
-static const int vp9_arg_ctrl_map[] = {
- VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF,
- VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD,
- VP9E_SET_TILE_COLUMNS, VP9E_SET_TILE_ROWS,
- VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE,
- VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT,
- VP9E_SET_LOSSLESS, VP9E_SET_FRAME_PARALLEL_DECODING, VP9E_SET_AQ_MODE,
- VP9E_SET_FRAME_PERIODIC_BOOST,
- 0
-};
-#endif
-
-static const arg_def_t *no_args[] = { NULL };
-
-void usage_exit() {
- int i;
-
- fprintf(stderr, "Usage: %s <options> -o dst_filename src_filename \n",
- exec_name);
-
- fprintf(stderr, "\nOptions:\n");
- arg_show_usage(stderr, main_args);
- fprintf(stderr, "\nEncoder Global Options:\n");
- arg_show_usage(stderr, global_args);
- fprintf(stderr, "\nRate Control Options:\n");
- arg_show_usage(stderr, rc_args);
- fprintf(stderr, "\nTwopass Rate Control Options:\n");
- arg_show_usage(stderr, rc_twopass_args);
- fprintf(stderr, "\nKeyframe Placement Options:\n");
- arg_show_usage(stderr, kf_args);
-#if CONFIG_VP8_ENCODER
- fprintf(stderr, "\nVP8 Specific Options:\n");
- arg_show_usage(stderr, vp8_args);
-#endif
-#if CONFIG_VP9_ENCODER
- fprintf(stderr, "\nVP9 Specific Options:\n");
- arg_show_usage(stderr, vp9_args);
-#endif
- fprintf(stderr, "\nStream timebase (--timebase):\n"
- " The desired precision of timestamps in the output, expressed\n"
- " in fractional seconds. Default is 1/1000.\n");
- fprintf(stderr, "\nIncluded encoders:\n\n");
-
- for (i = 0; i < get_vpx_encoder_count(); ++i) {
- const VpxInterface *const encoder = get_vpx_encoder_by_index(i);
- fprintf(stderr, " %-6s - %s\n",
- encoder->name, vpx_codec_iface_name(encoder->interface()));
- }
-
- exit(EXIT_FAILURE);
-}
-
-#define mmin(a, b) ((a) < (b) ? (a) : (b))
-static void find_mismatch(const vpx_image_t *const img1,
- const vpx_image_t *const img2,
- int yloc[4], int uloc[4], int vloc[4]) {
- const uint32_t bsize = 64;
- const uint32_t bsizey = bsize >> img1->y_chroma_shift;
- const uint32_t bsizex = bsize >> img1->x_chroma_shift;
- const uint32_t c_w =
- (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift;
- const uint32_t c_h =
- (img1->d_h + img1->y_chroma_shift) >> img1->y_chroma_shift;
- int match = 1;
- uint32_t i, j;
- yloc[0] = yloc[1] = yloc[2] = yloc[3] = -1;
- for (i = 0, match = 1; match && i < img1->d_h; i += bsize) {
- for (j = 0; match && j < img1->d_w; j += bsize) {
- int k, l;
- const int si = mmin(i + bsize, img1->d_h) - i;
- const int sj = mmin(j + bsize, img1->d_w) - j;
- for (k = 0; match && k < si; ++k) {
- for (l = 0; match && l < sj; ++l) {
- if (*(img1->planes[VPX_PLANE_Y] +
- (i + k) * img1->stride[VPX_PLANE_Y] + j + l) !=
- *(img2->planes[VPX_PLANE_Y] +
- (i + k) * img2->stride[VPX_PLANE_Y] + j + l)) {
- yloc[0] = i + k;
- yloc[1] = j + l;
- yloc[2] = *(img1->planes[VPX_PLANE_Y] +
- (i + k) * img1->stride[VPX_PLANE_Y] + j + l);
- yloc[3] = *(img2->planes[VPX_PLANE_Y] +
- (i + k) * img2->stride[VPX_PLANE_Y] + j + l);
- match = 0;
- break;
- }
- }
- }
- }
- }
-
- uloc[0] = uloc[1] = uloc[2] = uloc[3] = -1;
- for (i = 0, match = 1; match && i < c_h; i += bsizey) {
- for (j = 0; match && j < c_w; j += bsizex) {
- int k, l;
- const int si = mmin(i + bsizey, c_h - i);
- const int sj = mmin(j + bsizex, c_w - j);
- for (k = 0; match && k < si; ++k) {
- for (l = 0; match && l < sj; ++l) {
- if (*(img1->planes[VPX_PLANE_U] +
- (i + k) * img1->stride[VPX_PLANE_U] + j + l) !=
- *(img2->planes[VPX_PLANE_U] +
- (i + k) * img2->stride[VPX_PLANE_U] + j + l)) {
- uloc[0] = i + k;
- uloc[1] = j + l;
- uloc[2] = *(img1->planes[VPX_PLANE_U] +
- (i + k) * img1->stride[VPX_PLANE_U] + j + l);
- uloc[3] = *(img2->planes[VPX_PLANE_U] +
- (i + k) * img2->stride[VPX_PLANE_U] + j + l);
- match = 0;
- break;
- }
- }
- }
- }
- }
- vloc[0] = vloc[1] = vloc[2] = vloc[3] = -1;
- for (i = 0, match = 1; match && i < c_h; i += bsizey) {
- for (j = 0; match && j < c_w; j += bsizex) {
- int k, l;
- const int si = mmin(i + bsizey, c_h - i);
- const int sj = mmin(j + bsizex, c_w - j);
- for (k = 0; match && k < si; ++k) {
- for (l = 0; match && l < sj; ++l) {
- if (*(img1->planes[VPX_PLANE_V] +
- (i + k) * img1->stride[VPX_PLANE_V] + j + l) !=
- *(img2->planes[VPX_PLANE_V] +
- (i + k) * img2->stride[VPX_PLANE_V] + j + l)) {
- vloc[0] = i + k;
- vloc[1] = j + l;
- vloc[2] = *(img1->planes[VPX_PLANE_V] +
- (i + k) * img1->stride[VPX_PLANE_V] + j + l);
- vloc[3] = *(img2->planes[VPX_PLANE_V] +
- (i + k) * img2->stride[VPX_PLANE_V] + j + l);
- match = 0;
- break;
- }
- }
- }
- }
- }
-}
-
-static int compare_img(const vpx_image_t *const img1,
- const vpx_image_t *const img2) {
- const uint32_t c_w =
- (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift;
- const uint32_t c_h =
- (img1->d_h + img1->y_chroma_shift) >> img1->y_chroma_shift;
- uint32_t i;
- int match = 1;
-
- match &= (img1->fmt == img2->fmt);
- match &= (img1->d_w == img2->d_w);
- match &= (img1->d_h == img2->d_h);
-
- for (i = 0; i < img1->d_h; ++i)
- match &= (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
- img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
- img1->d_w) == 0);
-
- for (i = 0; i < c_h; ++i)
- match &= (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],
- img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],
- c_w) == 0);
-
- for (i = 0; i < c_h; ++i)
- match &= (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],
- img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],
- c_w) == 0);
-
- return match;
-}
-
-
-#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
-#define MAX(x,y) ((x)>(y)?(x):(y))
-#if CONFIG_VP8_ENCODER && !CONFIG_VP9_ENCODER
-#define ARG_CTRL_CNT_MAX NELEMENTS(vp8_arg_ctrl_map)
-#elif !CONFIG_VP8_ENCODER && CONFIG_VP9_ENCODER
-#define ARG_CTRL_CNT_MAX NELEMENTS(vp9_arg_ctrl_map)
-#else
-#define ARG_CTRL_CNT_MAX MAX(NELEMENTS(vp8_arg_ctrl_map), \
- NELEMENTS(vp9_arg_ctrl_map))
-#endif
-
-/* Per-stream configuration */
-struct stream_config {
- struct vpx_codec_enc_cfg cfg;
- const char *out_fn;
- const char *stats_fn;
- stereo_format_t stereo_fmt;
- int arg_ctrls[ARG_CTRL_CNT_MAX][2];
- int arg_ctrl_cnt;
- int write_webm;
- int have_kf_max_dist;
-};
-
-
-struct stream_state {
- int index;
- struct stream_state *next;
- struct stream_config config;
- FILE *file;
- struct rate_hist *rate_hist;
- struct EbmlGlobal ebml;
- uint32_t hash;
- uint64_t psnr_sse_total;
- uint64_t psnr_samples_total;
- double psnr_totals[4];
- int psnr_count;
- int counts[64];
- vpx_codec_ctx_t encoder;
- unsigned int frames_out;
- uint64_t cx_time;
- size_t nbytes;
- stats_io_t stats;
- struct vpx_image *img;
- vpx_codec_ctx_t decoder;
- int mismatch_seen;
-};
-
-
-void validate_positive_rational(const char *msg,
- struct vpx_rational *rat) {
- if (rat->den < 0) {
- rat->num *= -1;
- rat->den *= -1;
- }
-
- if (rat->num < 0)
- die("Error: %s must be positive\n", msg);
-
- if (!rat->den)
- die("Error: %s has zero denominator\n", msg);
-}
-
-
-static void parse_global_config(struct VpxEncoderConfig *global, char **argv) {
- char **argi, **argj;
- struct arg arg;
-
- /* Initialize default parameters */
- memset(global, 0, sizeof(*global));
- global->codec = get_vpx_encoder_by_index(0);
- global->passes = 0;
- global->use_i420 = 1;
- /* Assign default deadline to good quality */
- global->deadline = VPX_DL_GOOD_QUALITY;
-
- for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
- arg.argv_step = 1;
-
- if (arg_match(&arg, &codecarg, argi)) {
- global->codec = get_vpx_encoder_by_name(arg.val);
- if (!global->codec)
- die("Error: Unrecognized argument (%s) to --codec\n", arg.val);
- } else if (arg_match(&arg, &passes, argi)) {
- global->passes = arg_parse_uint(&arg);
-
- if (global->passes < 1 || global->passes > 2)
- die("Error: Invalid number of passes (%d)\n", global->passes);
- } else if (arg_match(&arg, &pass_arg, argi)) {
- global->pass = arg_parse_uint(&arg);
-
- if (global->pass < 1 || global->pass > 2)
- die("Error: Invalid pass selected (%d)\n",
- global->pass);
- } else if (arg_match(&arg, &usage, argi))
- global->usage = arg_parse_uint(&arg);
- else if (arg_match(&arg, &deadline, argi))
- global->deadline = arg_parse_uint(&arg);
- else if (arg_match(&arg, &best_dl, argi))
- global->deadline = VPX_DL_BEST_QUALITY;
- else if (arg_match(&arg, &good_dl, argi))
- global->deadline = VPX_DL_GOOD_QUALITY;
- else if (arg_match(&arg, &rt_dl, argi))
- global->deadline = VPX_DL_REALTIME;
- else if (arg_match(&arg, &use_yv12, argi))
- global->use_i420 = 0;
- else if (arg_match(&arg, &use_i420, argi))
- global->use_i420 = 1;
- else if (arg_match(&arg, &quietarg, argi))
- global->quiet = 1;
- else if (arg_match(&arg, &verbosearg, argi))
- global->verbose = 1;
- else if (arg_match(&arg, &limit, argi))
- global->limit = arg_parse_uint(&arg);
- else if (arg_match(&arg, &skip, argi))
- global->skip_frames = arg_parse_uint(&arg);
- else if (arg_match(&arg, &psnrarg, argi))
- global->show_psnr = 1;
- else if (arg_match(&arg, &recontest, argi))
- global->test_decode = arg_parse_enum_or_int(&arg);
- else if (arg_match(&arg, &framerate, argi)) {
- global->framerate = arg_parse_rational(&arg);
- validate_positive_rational(arg.name, &global->framerate);
- global->have_framerate = 1;
- } else if (arg_match(&arg, &out_part, argi))
- global->out_part = 1;
- else if (arg_match(&arg, &debugmode, argi))
- global->debug = 1;
- else if (arg_match(&arg, &q_hist_n, argi))
- global->show_q_hist_buckets = arg_parse_uint(&arg);
- else if (arg_match(&arg, &rate_hist_n, argi))
- global->show_rate_hist_buckets = arg_parse_uint(&arg);
- else if (arg_match(&arg, &disable_warnings, argi))
- global->disable_warnings = 1;
- else if (arg_match(&arg, &disable_warning_prompt, argi))
- global->disable_warning_prompt = 1;
- else if (arg_match(&arg, &experimental_bitstream, argi))
- global->experimental_bitstream = 1;
- else
- argj++;
- }
-
- if (global->pass) {
- /* DWIM: Assume the user meant passes=2 if pass=2 is specified */
- if (global->pass > global->passes) {
- warn("Assuming --pass=%d implies --passes=%d\n",
- global->pass, global->pass);
- global->passes = global->pass;
- }
- }
- /* Validate global config */
- if (global->passes == 0) {
-#if CONFIG_VP9_ENCODER
- // Make default VP9 passes = 2 until there is a better quality 1-pass
- // encoder
- global->passes = (strcmp(global->codec->name, "vp9") == 0 &&
- global->deadline != VPX_DL_REALTIME) ? 2 : 1;
-#else
- global->passes = 1;
-#endif
- }
-
- if (global->deadline == VPX_DL_REALTIME &&
- global->passes > 1) {
- warn("Enforcing one-pass encoding in realtime mode\n");
- global->passes = 1;
- }
-}
-
-
-void open_input_file(struct VpxInputContext *input) {
- /* Parse certain options from the input file, if possible */
- input->file = strcmp(input->filename, "-")
- ? fopen(input->filename, "rb") : set_binary_mode(stdin);
-
- if (!input->file)
- fatal("Failed to open input file");
-
- if (!fseeko(input->file, 0, SEEK_END)) {
- /* Input file is seekable. Figure out how long it is, so we can get
- * progress info.
- */
- input->length = ftello(input->file);
- rewind(input->file);
- }
-
- /* For RAW input sources, these bytes will applied on the first frame
- * in read_frame().
- */
- input->detect.buf_read = fread(input->detect.buf, 1, 4, input->file);
- input->detect.position = 0;
-
- if (input->detect.buf_read == 4
- && file_is_y4m(input->detect.buf)) {
- if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4,
- input->only_i420) >= 0) {
- input->file_type = FILE_TYPE_Y4M;
- input->width = input->y4m.pic_w;
- input->height = input->y4m.pic_h;
- input->framerate.numerator = input->y4m.fps_n;
- input->framerate.denominator = input->y4m.fps_d;
- input->use_i420 = 0;
- } else
- fatal("Unsupported Y4M stream.");
- } else if (input->detect.buf_read == 4 && fourcc_is_ivf(input->detect.buf)) {
- fatal("IVF is not supported as input.");
- } else {
- input->file_type = FILE_TYPE_RAW;
- }
-}
-
-
-static void close_input_file(struct VpxInputContext *input) {
- fclose(input->file);
- if (input->file_type == FILE_TYPE_Y4M)
- y4m_input_close(&input->y4m);
-}
-
-static struct stream_state *new_stream(struct VpxEncoderConfig *global,
- struct stream_state *prev) {
- struct stream_state *stream;
-
- stream = calloc(1, sizeof(*stream));
- if (!stream)
- fatal("Failed to allocate new stream.");
- if (prev) {
- memcpy(stream, prev, sizeof(*stream));
- stream->index++;
- prev->next = stream;
- } else {
- vpx_codec_err_t res;
-
- /* Populate encoder configuration */
- res = vpx_codec_enc_config_default(global->codec->interface(),
- &stream->config.cfg,
- global->usage);
- if (res)
- fatal("Failed to get config: %s\n", vpx_codec_err_to_string(res));
-
- /* Change the default timebase to a high enough value so that the
- * encoder will always create strictly increasing timestamps.
- */
- stream->config.cfg.g_timebase.den = 1000;
-
- /* Never use the library's default resolution, require it be parsed
- * from the file or set on the command line.
- */
- stream->config.cfg.g_w = 0;
- stream->config.cfg.g_h = 0;
-
- /* Initialize remaining stream parameters */
- stream->config.stereo_fmt = STEREO_FORMAT_MONO;
- stream->config.write_webm = 1;
-#if CONFIG_WEBM_IO
- stream->ebml.last_pts_ms = -1;
-#endif
-
- /* Allows removal of the application version from the EBML tags */
- stream->ebml.debug = global->debug;
-
- /* Default lag_in_frames is 0 in realtime mode */
- if (global->deadline == VPX_DL_REALTIME)
- stream->config.cfg.g_lag_in_frames = 0;
- }
-
- /* Output files must be specified for each stream */
- stream->config.out_fn = NULL;
-
- stream->next = NULL;
- return stream;
-}
-
-
-static int parse_stream_params(struct VpxEncoderConfig *global,
- struct stream_state *stream,
- char **argv) {
- char **argi, **argj;
- struct arg arg;
- static const arg_def_t **ctrl_args = no_args;
- static const int *ctrl_args_map = NULL;
- struct stream_config *config = &stream->config;
- int eos_mark_found = 0;
-
- // Handle codec specific options
- if (0) {
-#if CONFIG_VP8_ENCODER
- } else if (strcmp(global->codec->name, "vp8") == 0) {
- ctrl_args = vp8_args;
- ctrl_args_map = vp8_arg_ctrl_map;
-#endif
-#if CONFIG_VP9_ENCODER
- } else if (strcmp(global->codec->name, "vp9") == 0) {
- ctrl_args = vp9_args;
- ctrl_args_map = vp9_arg_ctrl_map;
-#endif
- }
-
- for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
- arg.argv_step = 1;
-
- /* Once we've found an end-of-stream marker (--) we want to continue
- * shifting arguments but not consuming them.
- */
- if (eos_mark_found) {
- argj++;
- continue;
- } else if (!strcmp(*argj, "--")) {
- eos_mark_found = 1;
- continue;
- }
-
- if (0) {
- } else if (arg_match(&arg, &outputfile, argi)) {
- config->out_fn = arg.val;
- } else if (arg_match(&arg, &fpf_name, argi)) {
- config->stats_fn = arg.val;
- } else if (arg_match(&arg, &use_ivf, argi)) {
- config->write_webm = 0;
- } else if (arg_match(&arg, &threads, argi)) {
- config->cfg.g_threads = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &profile, argi)) {
- config->cfg.g_profile = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &width, argi)) {
- config->cfg.g_w = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &height, argi)) {
- config->cfg.g_h = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &stereo_mode, argi)) {
- config->stereo_fmt = arg_parse_enum_or_int(&arg);
- } else if (arg_match(&arg, &timebase, argi)) {
- config->cfg.g_timebase = arg_parse_rational(&arg);
- validate_positive_rational(arg.name, &config->cfg.g_timebase);
- } else if (arg_match(&arg, &error_resilient, argi)) {
- config->cfg.g_error_resilient = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &lag_in_frames, argi)) {
- config->cfg.g_lag_in_frames = arg_parse_uint(&arg);
- if (global->deadline == VPX_DL_REALTIME &&
- config->cfg.g_lag_in_frames != 0) {
- warn("non-zero %s option ignored in realtime mode.\n", arg.name);
- config->cfg.g_lag_in_frames = 0;
- }
- } else if (arg_match(&arg, &dropframe_thresh, argi)) {
- config->cfg.rc_dropframe_thresh = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &resize_allowed, argi)) {
- config->cfg.rc_resize_allowed = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &resize_up_thresh, argi)) {
- config->cfg.rc_resize_up_thresh = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &resize_down_thresh, argi)) {
- config->cfg.rc_resize_down_thresh = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &end_usage, argi)) {
- config->cfg.rc_end_usage = arg_parse_enum_or_int(&arg);
- } else if (arg_match(&arg, &target_bitrate, argi)) {
- config->cfg.rc_target_bitrate = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &min_quantizer, argi)) {
- config->cfg.rc_min_quantizer = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &max_quantizer, argi)) {
- config->cfg.rc_max_quantizer = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &undershoot_pct, argi)) {
- config->cfg.rc_undershoot_pct = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &overshoot_pct, argi)) {
- config->cfg.rc_overshoot_pct = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &buf_sz, argi)) {
- config->cfg.rc_buf_sz = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &buf_initial_sz, argi)) {
- config->cfg.rc_buf_initial_sz = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &buf_optimal_sz, argi)) {
- config->cfg.rc_buf_optimal_sz = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &bias_pct, argi)) {
- config->cfg.rc_2pass_vbr_bias_pct = arg_parse_uint(&arg);
- if (global->passes < 2)
- warn("option %s ignored in one-pass mode.\n", arg.name);
- } else if (arg_match(&arg, &minsection_pct, argi)) {
- config->cfg.rc_2pass_vbr_minsection_pct = arg_parse_uint(&arg);
-
- if (global->passes < 2)
- warn("option %s ignored in one-pass mode.\n", arg.name);
- } else if (arg_match(&arg, &maxsection_pct, argi)) {
- config->cfg.rc_2pass_vbr_maxsection_pct = arg_parse_uint(&arg);
-
- if (global->passes < 2)
- warn("option %s ignored in one-pass mode.\n", arg.name);
- } else if (arg_match(&arg, &kf_min_dist, argi)) {
- config->cfg.kf_min_dist = arg_parse_uint(&arg);
- } else if (arg_match(&arg, &kf_max_dist, argi)) {
- config->cfg.kf_max_dist = arg_parse_uint(&arg);
- config->have_kf_max_dist = 1;
- } else if (arg_match(&arg, &kf_disabled, argi)) {
- config->cfg.kf_mode = VPX_KF_DISABLED;
- } else {
- int i, match = 0;
- for (i = 0; ctrl_args[i]; i++) {
- if (arg_match(&arg, ctrl_args[i], argi)) {
- int j;
- match = 1;
-
- /* Point either to the next free element or the first
- * instance of this control.
- */
- for (j = 0; j < config->arg_ctrl_cnt; j++)
- if (config->arg_ctrls[j][0] == ctrl_args_map[i])
- break;
-
- /* Update/insert */
- assert(j < ARG_CTRL_CNT_MAX);
- if (j < ARG_CTRL_CNT_MAX) {
- config->arg_ctrls[j][0] = ctrl_args_map[i];
- config->arg_ctrls[j][1] = arg_parse_enum_or_int(&arg);
- if (j == config->arg_ctrl_cnt)
- config->arg_ctrl_cnt++;
- }
-
- }
- }
- if (!match)
- argj++;
- }
- }
- return eos_mark_found;
-}
-
-
-#define FOREACH_STREAM(func) \
- do { \
- struct stream_state *stream; \
- for (stream = streams; stream; stream = stream->next) { \
- func; \
- } \
- } while (0)
-
-
-static void validate_stream_config(const struct stream_state *stream,
- const struct VpxEncoderConfig *global) {
- const struct stream_state *streami;
-
- if (!stream->config.cfg.g_w || !stream->config.cfg.g_h)
- fatal("Stream %d: Specify stream dimensions with --width (-w) "
- " and --height (-h)", stream->index);
-
- if (stream->config.cfg.g_profile != 0 && !global->experimental_bitstream) {
- fatal("Stream %d: profile %d is experimental and requires the --%s flag",
- stream->index, stream->config.cfg.g_profile,
- experimental_bitstream.long_name);
- }
-
- for (streami = stream; streami; streami = streami->next) {
- /* All streams require output files */
- if (!streami->config.out_fn)
- fatal("Stream %d: Output file is required (specify with -o)",
- streami->index);
-
- /* Check for two streams outputting to the same file */
- if (streami != stream) {
- const char *a = stream->config.out_fn;
- const char *b = streami->config.out_fn;
- if (!strcmp(a, b) && strcmp(a, "/dev/null") && strcmp(a, ":nul"))
- fatal("Stream %d: duplicate output file (from stream %d)",
- streami->index, stream->index);
- }
-
- /* Check for two streams sharing a stats file. */
- if (streami != stream) {
- const char *a = stream->config.stats_fn;
- const char *b = streami->config.stats_fn;
- if (a && b && !strcmp(a, b))
- fatal("Stream %d: duplicate stats file (from stream %d)",
- streami->index, stream->index);
- }
- }
-}
-
-
-static void set_stream_dimensions(struct stream_state *stream,
- unsigned int w,
- unsigned int h) {
- if (!stream->config.cfg.g_w) {
- if (!stream->config.cfg.g_h)
- stream->config.cfg.g_w = w;
- else
- stream->config.cfg.g_w = w * stream->config.cfg.g_h / h;
- }
- if (!stream->config.cfg.g_h) {
- stream->config.cfg.g_h = h * stream->config.cfg.g_w / w;
- }
-}
-
-
-static void set_default_kf_interval(struct stream_state *stream,
- struct VpxEncoderConfig *global) {
- /* Use a max keyframe interval of 5 seconds, if none was
- * specified on the command line.
- */
- if (!stream->config.have_kf_max_dist) {
- double framerate = (double)global->framerate.num / global->framerate.den;
- if (framerate > 0.0)
- stream->config.cfg.kf_max_dist = (unsigned int)(5.0 * framerate);
- }
-}
-
-
-static void show_stream_config(struct stream_state *stream,
- struct VpxEncoderConfig *global,
- struct VpxInputContext *input) {
-
-#define SHOW(field) \
- fprintf(stderr, " %-28s = %d\n", #field, stream->config.cfg.field)
-
- if (stream->index == 0) {
- fprintf(stderr, "Codec: %s\n",
- vpx_codec_iface_name(global->codec->interface()));
- fprintf(stderr, "Source file: %s Format: %s\n", input->filename,
- input->use_i420 ? "I420" : "YV12");
- }
- if (stream->next || stream->index)
- fprintf(stderr, "\nStream Index: %d\n", stream->index);
- fprintf(stderr, "Destination file: %s\n", stream->config.out_fn);
- fprintf(stderr, "Encoder parameters:\n");
-
- SHOW(g_usage);
- SHOW(g_threads);
- SHOW(g_profile);
- SHOW(g_w);
- SHOW(g_h);
- SHOW(g_timebase.num);
- SHOW(g_timebase.den);
- SHOW(g_error_resilient);
- SHOW(g_pass);
- SHOW(g_lag_in_frames);
- SHOW(rc_dropframe_thresh);
- SHOW(rc_resize_allowed);
- SHOW(rc_resize_up_thresh);
- SHOW(rc_resize_down_thresh);
- SHOW(rc_end_usage);
- SHOW(rc_target_bitrate);
- SHOW(rc_min_quantizer);
- SHOW(rc_max_quantizer);
- SHOW(rc_undershoot_pct);
- SHOW(rc_overshoot_pct);
- SHOW(rc_buf_sz);
- SHOW(rc_buf_initial_sz);
- SHOW(rc_buf_optimal_sz);
- SHOW(rc_2pass_vbr_bias_pct);
- SHOW(rc_2pass_vbr_minsection_pct);
- SHOW(rc_2pass_vbr_maxsection_pct);
- SHOW(kf_mode);
- SHOW(kf_min_dist);
- SHOW(kf_max_dist);
-}
-
-
-static void open_output_file(struct stream_state *stream,
- struct VpxEncoderConfig *global) {
- const char *fn = stream->config.out_fn;
- const struct vpx_codec_enc_cfg *const cfg = &stream->config.cfg;
-
- if (cfg->g_pass == VPX_RC_FIRST_PASS)
- return;
-
- stream->file = strcmp(fn, "-") ? fopen(fn, "wb") : set_binary_mode(stdout);
-
- if (!stream->file)
- fatal("Failed to open output file");
-
- if (stream->config.write_webm && fseek(stream->file, 0, SEEK_CUR))
- fatal("WebM output to pipes not supported.");
-
-#if CONFIG_WEBM_IO
- if (stream->config.write_webm) {
- stream->ebml.stream = stream->file;
- write_webm_file_header(&stream->ebml, cfg,
- &global->framerate,
- stream->config.stereo_fmt,
- global->codec->fourcc);
- }
-#endif
-
- if (!stream->config.write_webm) {
- ivf_write_file_header(stream->file, cfg, global->codec->fourcc, 0);
- }
-}
-
-
-static void close_output_file(struct stream_state *stream,
- unsigned int fourcc) {
- const struct vpx_codec_enc_cfg *const cfg = &stream->config.cfg;
-
- if (cfg->g_pass == VPX_RC_FIRST_PASS)
- return;
-
-#if CONFIG_WEBM_IO
- if (stream->config.write_webm) {
- write_webm_file_footer(&stream->ebml, stream->hash);
- free(stream->ebml.cue_list);
- stream->ebml.cue_list = NULL;
- }
-#endif
-
- if (!stream->config.write_webm) {
- if (!fseek(stream->file, 0, SEEK_SET))
- ivf_write_file_header(stream->file, &stream->config.cfg,
- fourcc,
- stream->frames_out);
- }
-
- fclose(stream->file);
-}
-
-
-static void setup_pass(struct stream_state *stream,
- struct VpxEncoderConfig *global,
- int pass) {
- if (stream->config.stats_fn) {
- if (!stats_open_file(&stream->stats, stream->config.stats_fn,
- pass))
- fatal("Failed to open statistics store");
- } else {
- if (!stats_open_mem(&stream->stats, pass))
- fatal("Failed to open statistics store");
- }
-
- stream->config.cfg.g_pass = global->passes == 2
- ? pass ? VPX_RC_LAST_PASS : VPX_RC_FIRST_PASS
- : VPX_RC_ONE_PASS;
- if (pass)
- stream->config.cfg.rc_twopass_stats_in = stats_get(&stream->stats);
-
- stream->cx_time = 0;
- stream->nbytes = 0;
- stream->frames_out = 0;
-}
-
-
-static void initialize_encoder(struct stream_state *stream,
- struct VpxEncoderConfig *global) {
- int i;
- int flags = 0;
-
- flags |= global->show_psnr ? VPX_CODEC_USE_PSNR : 0;
- flags |= global->out_part ? VPX_CODEC_USE_OUTPUT_PARTITION : 0;
-
- /* Construct Encoder Context */
- vpx_codec_enc_init(&stream->encoder, global->codec->interface(),
- &stream->config.cfg, flags);
- ctx_exit_on_error(&stream->encoder, "Failed to initialize encoder");
-
- /* Note that we bypass the vpx_codec_control wrapper macro because
- * we're being clever to store the control IDs in an array. Real
- * applications will want to make use of the enumerations directly
- */
- for (i = 0; i < stream->config.arg_ctrl_cnt; i++) {
- int ctrl = stream->config.arg_ctrls[i][0];
- int value = stream->config.arg_ctrls[i][1];
- if (vpx_codec_control_(&stream->encoder, ctrl, value))
- fprintf(stderr, "Error: Tried to set control %d = %d\n",
- ctrl, value);
-
- ctx_exit_on_error(&stream->encoder, "Failed to control codec");
- }
-
-#if CONFIG_DECODERS
- if (global->test_decode != TEST_DECODE_OFF) {
- const VpxInterface *decoder = get_vpx_decoder_by_name(global->codec->name);
- vpx_codec_dec_init(&stream->decoder, decoder->interface(), NULL, 0);
- }
-#endif
-}
-
-
-static void encode_frame(struct stream_state *stream,
- struct VpxEncoderConfig *global,
- struct vpx_image *img,
- unsigned int frames_in) {
- vpx_codec_pts_t frame_start, next_frame_start;
- struct vpx_codec_enc_cfg *cfg = &stream->config.cfg;
- struct vpx_usec_timer timer;
-
- frame_start = (cfg->g_timebase.den * (int64_t)(frames_in - 1)
- * global->framerate.den)
- / cfg->g_timebase.num / global->framerate.num;
- next_frame_start = (cfg->g_timebase.den * (int64_t)(frames_in)
- * global->framerate.den)
- / cfg->g_timebase.num / global->framerate.num;
-
- /* Scale if necessary */
- if (img && (img->d_w != cfg->g_w || img->d_h != cfg->g_h)) {
- if (!stream->img)
- stream->img = vpx_img_alloc(NULL, VPX_IMG_FMT_I420,
- cfg->g_w, cfg->g_h, 16);
- I420Scale(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y],
- img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U],
- img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V],
- img->d_w, img->d_h,
- stream->img->planes[VPX_PLANE_Y],
- stream->img->stride[VPX_PLANE_Y],
- stream->img->planes[VPX_PLANE_U],
- stream->img->stride[VPX_PLANE_U],
- stream->img->planes[VPX_PLANE_V],
- stream->img->stride[VPX_PLANE_V],
- stream->img->d_w, stream->img->d_h,
- kFilterBox);
-
- img = stream->img;
- }
-
- vpx_usec_timer_start(&timer);
- vpx_codec_encode(&stream->encoder, img, frame_start,
- (unsigned long)(next_frame_start - frame_start),
- 0, global->deadline);
- vpx_usec_timer_mark(&timer);
- stream->cx_time += vpx_usec_timer_elapsed(&timer);
- ctx_exit_on_error(&stream->encoder, "Stream %d: Failed to encode frame",
- stream->index);
-}
-
-
-static void update_quantizer_histogram(struct stream_state *stream) {
- if (stream->config.cfg.g_pass != VPX_RC_FIRST_PASS) {
- int q;
-
- vpx_codec_control(&stream->encoder, VP8E_GET_LAST_QUANTIZER_64, &q);
- ctx_exit_on_error(&stream->encoder, "Failed to read quantizer");
- stream->counts[q]++;
- }
-}
-
-
-static void get_cx_data(struct stream_state *stream,
- struct VpxEncoderConfig *global,
- int *got_data) {
- const vpx_codec_cx_pkt_t *pkt;
- const struct vpx_codec_enc_cfg *cfg = &stream->config.cfg;
- vpx_codec_iter_t iter = NULL;
-
- *got_data = 0;
- while ((pkt = vpx_codec_get_cx_data(&stream->encoder, &iter))) {
- static size_t fsize = 0;
- static off_t ivf_header_pos = 0;
-
- switch (pkt->kind) {
- case VPX_CODEC_CX_FRAME_PKT:
- if (!(pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT)) {
- stream->frames_out++;
- }
- if (!global->quiet)
- fprintf(stderr, " %6luF", (unsigned long)pkt->data.frame.sz);
-
- update_rate_histogram(stream->rate_hist, cfg, pkt);
-#if CONFIG_WEBM_IO
- if (stream->config.write_webm) {
- /* Update the hash */
- if (!stream->ebml.debug)
- stream->hash = murmur(pkt->data.frame.buf,
- (int)pkt->data.frame.sz,
- stream->hash);
-
- write_webm_block(&stream->ebml, cfg, pkt);
- }
-#endif
- if (!stream->config.write_webm) {
- if (pkt->data.frame.partition_id <= 0) {
- ivf_header_pos = ftello(stream->file);
- fsize = pkt->data.frame.sz;
-
- ivf_write_frame_header(stream->file, pkt->data.frame.pts, fsize);
- } else {
- fsize += pkt->data.frame.sz;
-
- if (!(pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT)) {
- off_t currpos = ftello(stream->file);
- fseeko(stream->file, ivf_header_pos, SEEK_SET);
- ivf_write_frame_size(stream->file, fsize);
- fseeko(stream->file, currpos, SEEK_SET);
- }
- }
-
- (void) fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz,
- stream->file);
- }
- stream->nbytes += pkt->data.raw.sz;
-
- *got_data = 1;
-#if CONFIG_DECODERS
- if (global->test_decode != TEST_DECODE_OFF && !stream->mismatch_seen) {
- vpx_codec_decode(&stream->decoder, pkt->data.frame.buf,
- (unsigned int)pkt->data.frame.sz, NULL, 0);
- if (stream->decoder.err) {
- warn_or_exit_on_error(&stream->decoder,
- global->test_decode == TEST_DECODE_FATAL,
- "Failed to decode frame %d in stream %d",
- stream->frames_out + 1, stream->index);
- stream->mismatch_seen = stream->frames_out + 1;
- }
- }
-#endif
- break;
- case VPX_CODEC_STATS_PKT:
- stream->frames_out++;
- stats_write(&stream->stats,
- pkt->data.twopass_stats.buf,
- pkt->data.twopass_stats.sz);
- stream->nbytes += pkt->data.raw.sz;
- break;
- case VPX_CODEC_PSNR_PKT:
-
- if (global->show_psnr) {
- int i;
-
- stream->psnr_sse_total += pkt->data.psnr.sse[0];
- stream->psnr_samples_total += pkt->data.psnr.samples[0];
- for (i = 0; i < 4; i++) {
- if (!global->quiet)
- fprintf(stderr, "%.3f ", pkt->data.psnr.psnr[i]);
- stream->psnr_totals[i] += pkt->data.psnr.psnr[i];
- }
- stream->psnr_count++;
- }
-
- break;
- default:
- break;
- }
- }
-}
-
-
-static void show_psnr(struct stream_state *stream) {
- int i;
- double ovpsnr;
-
- if (!stream->psnr_count)
- return;
-
- fprintf(stderr, "Stream %d PSNR (Overall/Avg/Y/U/V)", stream->index);
- ovpsnr = sse_to_psnr((double)stream->psnr_samples_total, 255.0,
- (double)stream->psnr_sse_total);
- fprintf(stderr, " %.3f", ovpsnr);
-
- for (i = 0; i < 4; i++) {
- fprintf(stderr, " %.3f", stream->psnr_totals[i] / stream->psnr_count);
- }
- fprintf(stderr, "\n");
-}
-
-
-static float usec_to_fps(uint64_t usec, unsigned int frames) {
- return (float)(usec > 0 ? frames * 1000000.0 / (float)usec : 0);
-}
-
-
-static void test_decode(struct stream_state *stream,
- enum TestDecodeFatality fatal,
- const VpxInterface *codec) {
- vpx_image_t enc_img, dec_img;
-
- if (stream->mismatch_seen)
- return;
-
- /* Get the internal reference frame */
- if (strcmp(codec->name, "vp8") == 0) {
- struct vpx_ref_frame ref_enc, ref_dec;
- int width, height;
-
- width = (stream->config.cfg.g_w + 15) & ~15;
- height = (stream->config.cfg.g_h + 15) & ~15;
- vpx_img_alloc(&ref_enc.img, VPX_IMG_FMT_I420, width, height, 1);
- enc_img = ref_enc.img;
- vpx_img_alloc(&ref_dec.img, VPX_IMG_FMT_I420, width, height, 1);
- dec_img = ref_dec.img;
-
- ref_enc.frame_type = VP8_LAST_FRAME;
- ref_dec.frame_type = VP8_LAST_FRAME;
- vpx_codec_control(&stream->encoder, VP8_COPY_REFERENCE, &ref_enc);
- vpx_codec_control(&stream->decoder, VP8_COPY_REFERENCE, &ref_dec);
- } else {
- struct vp9_ref_frame ref;
-
- ref.idx = 0;
- vpx_codec_control(&stream->encoder, VP9_GET_REFERENCE, &ref);
- enc_img = ref.img;
- vpx_codec_control(&stream->decoder, VP9_GET_REFERENCE, &ref);
- dec_img = ref.img;
- }
- ctx_exit_on_error(&stream->encoder, "Failed to get encoder reference frame");
- ctx_exit_on_error(&stream->decoder, "Failed to get decoder reference frame");
-
- if (!compare_img(&enc_img, &dec_img)) {
- int y[4], u[4], v[4];
- find_mismatch(&enc_img, &dec_img, y, u, v);
- stream->decoder.err = 1;
- warn_or_exit_on_error(&stream->decoder, fatal == TEST_DECODE_FATAL,
- "Stream %d: Encode/decode mismatch on frame %d at"
- " Y[%d, %d] {%d/%d},"
- " U[%d, %d] {%d/%d},"
- " V[%d, %d] {%d/%d}",
- stream->index, stream->frames_out,
- y[0], y[1], y[2], y[3],
- u[0], u[1], u[2], u[3],
- v[0], v[1], v[2], v[3]);
- stream->mismatch_seen = stream->frames_out;
- }
-
- vpx_img_free(&enc_img);
- vpx_img_free(&dec_img);
-}
-
-
-static void print_time(const char *label, int64_t etl) {
- int64_t hours;
- int64_t mins;
- int64_t secs;
-
- if (etl >= 0) {
- hours = etl / 3600;
- etl -= hours * 3600;
- mins = etl / 60;
- etl -= mins * 60;
- secs = etl;
-
- fprintf(stderr, "[%3s %2"PRId64":%02"PRId64": % 02"PRId64"] ",
- label, hours, mins, secs);
- } else {
- fprintf(stderr, "[%3s unknown] ", label);
- }
-}
-
-
-int main(int argc, const char **argv_) {
- int pass;
- vpx_image_t raw;
- int frame_avail, got_data;
-
- struct VpxInputContext input = {0};
- struct VpxEncoderConfig global;
- struct stream_state *streams = NULL;
- char **argv, **argi;
- uint64_t cx_time = 0;
- int stream_cnt = 0;
- int res = 0;
-
- exec_name = argv_[0];
-
- if (argc < 3)
- usage_exit();
-
- /* Setup default input stream settings */
- input.framerate.numerator = 30;
- input.framerate.denominator = 1;
- input.use_i420 = 1;
- input.only_i420 = 1;
-
- /* First parse the global configuration values, because we want to apply
- * other parameters on top of the default configuration provided by the
- * codec.
- */
- argv = argv_dup(argc - 1, argv_ + 1);
- parse_global_config(&global, argv);
-
-
- {
- /* Now parse each stream's parameters. Using a local scope here
- * due to the use of 'stream' as loop variable in FOREACH_STREAM
- * loops
- */
- struct stream_state *stream = NULL;
-
- do {
- stream = new_stream(&global, stream);
- stream_cnt++;
- if (!streams)
- streams = stream;
- } while (parse_stream_params(&global, stream, argv));
- }
-
- /* Check for unrecognized options */
- for (argi = argv; *argi; argi++)
- if (argi[0][0] == '-' && argi[0][1])
- die("Error: Unrecognized option %s\n", *argi);
-
- FOREACH_STREAM(check_encoder_config(global.disable_warning_prompt,
- &global, &stream->config.cfg););
-
- /* Handle non-option arguments */
- input.filename = argv[0];
-
- if (!input.filename)
- usage_exit();
-
- /* Decide if other chroma subsamplings than 4:2:0 are supported */
- if (global.codec->fourcc == VP9_FOURCC)
- input.only_i420 = 0;
-
- for (pass = global.pass ? global.pass - 1 : 0; pass < global.passes; pass++) {
- int frames_in = 0, seen_frames = 0;
- int64_t estimated_time_left = -1;
- int64_t average_rate = -1;
- off_t lagged_count = 0;
-
- open_input_file(&input);
-
- /* If the input file doesn't specify its w/h (raw files), try to get
- * the data from the first stream's configuration.
- */
- if (!input.width || !input.height)
- FOREACH_STREAM( {
- if (stream->config.cfg.g_w && stream->config.cfg.g_h) {
- input.width = stream->config.cfg.g_w;
- input.height = stream->config.cfg.g_h;
- break;
- }
- });
-
- /* Update stream configurations from the input file's parameters */
- if (!input.width || !input.height)
- fatal("Specify stream dimensions with --width (-w) "
- " and --height (-h)");
- FOREACH_STREAM(set_stream_dimensions(stream, input.width, input.height));
- FOREACH_STREAM(validate_stream_config(stream, &global));
-
- /* Ensure that --passes and --pass are consistent. If --pass is set and
- * --passes=2, ensure --fpf was set.
- */
- if (global.pass && global.passes == 2)
- FOREACH_STREAM( {
- if (!stream->config.stats_fn)
- die("Stream %d: Must specify --fpf when --pass=%d"
- " and --passes=2\n", stream->index, global.pass);
- });
-
-#if !CONFIG_WEBM_IO
- FOREACH_STREAM({
- stream->config.write_webm = 0;
- warn("vpxenc was compiled without WebM container support."
- "Producing IVF output");
- });
-#endif
-
- /* Use the frame rate from the file only if none was specified
- * on the command-line.
- */
- if (!global.have_framerate) {
- global.framerate.num = input.framerate.numerator;
- global.framerate.den = input.framerate.denominator;
- }
-
- FOREACH_STREAM(set_default_kf_interval(stream, &global));
-
- /* Show configuration */
- if (global.verbose && pass == 0)
- FOREACH_STREAM(show_stream_config(stream, &global, &input));
-
- if (pass == (global.pass ? global.pass - 1 : 0)) {
- if (input.file_type == FILE_TYPE_Y4M)
- /*The Y4M reader does its own allocation.
- Just initialize this here to avoid problems if we never read any
- frames.*/
- memset(&raw, 0, sizeof(raw));
- else
- vpx_img_alloc(&raw,
- input.use_i420 ? VPX_IMG_FMT_I420
- : VPX_IMG_FMT_YV12,
- input.width, input.height, 32);
-
- FOREACH_STREAM(stream->rate_hist =
- init_rate_histogram(&stream->config.cfg,
- &global.framerate));
- }
-
- FOREACH_STREAM(setup_pass(stream, &global, pass));
- FOREACH_STREAM(open_output_file(stream, &global));
- FOREACH_STREAM(initialize_encoder(stream, &global));
-
- frame_avail = 1;
- got_data = 0;
-
- while (frame_avail || got_data) {
- struct vpx_usec_timer timer;
-
- if (!global.limit || frames_in < global.limit) {
- frame_avail = read_frame(&input, &raw);
-
- if (frame_avail)
- frames_in++;
- seen_frames = frames_in > global.skip_frames ?
- frames_in - global.skip_frames : 0;
-
- if (!global.quiet) {
- float fps = usec_to_fps(cx_time, seen_frames);
- fprintf(stderr, "\rPass %d/%d ", pass + 1, global.passes);
-
- if (stream_cnt == 1)
- fprintf(stderr,
- "frame %4d/%-4d %7"PRId64"B ",
- frames_in, streams->frames_out, (int64_t)streams->nbytes);
- else
- fprintf(stderr, "frame %4d ", frames_in);
-
- fprintf(stderr, "%7"PRId64" %s %.2f %s ",
- cx_time > 9999999 ? cx_time / 1000 : cx_time,
- cx_time > 9999999 ? "ms" : "us",
- fps >= 1.0 ? fps : fps * 60,
- fps >= 1.0 ? "fps" : "fpm");
- print_time("ETA", estimated_time_left);
- fprintf(stderr, "\033[K");
- }
-
- } else
- frame_avail = 0;
-
- if (frames_in > global.skip_frames) {
- vpx_usec_timer_start(&timer);
- FOREACH_STREAM(encode_frame(stream, &global,
- frame_avail ? &raw : NULL,
- frames_in));
- vpx_usec_timer_mark(&timer);
- cx_time += vpx_usec_timer_elapsed(&timer);
-
- FOREACH_STREAM(update_quantizer_histogram(stream));
-
- got_data = 0;
- FOREACH_STREAM(get_cx_data(stream, &global, &got_data));
-
- if (!got_data && input.length && !streams->frames_out) {
- lagged_count = global.limit ? seen_frames : ftello(input.file);
- } else if (input.length) {
- int64_t remaining;
- int64_t rate;
-
- if (global.limit) {
- off_t frame_in_lagged = (seen_frames - lagged_count) * 1000;
-
- rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0;
- remaining = 1000 * (global.limit - global.skip_frames
- - seen_frames + lagged_count);
- } else {
- off_t input_pos = ftello(input.file);
- off_t input_pos_lagged = input_pos - lagged_count;
- int64_t limit = input.length;
-
- rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0;
- remaining = limit - input_pos + lagged_count;
- }
-
- average_rate = (average_rate <= 0)
- ? rate
- : (average_rate * 7 + rate) / 8;
- estimated_time_left = average_rate ? remaining / average_rate : -1;
- }
-
- if (got_data && global.test_decode != TEST_DECODE_OFF)
- FOREACH_STREAM(test_decode(stream, global.test_decode, global.codec));
- }
-
- fflush(stdout);
- }
-
- if (stream_cnt > 1)
- fprintf(stderr, "\n");
-
- if (!global.quiet)
- FOREACH_STREAM(fprintf(
- stderr,
- "\rPass %d/%d frame %4d/%-4d %7"PRId64"B %7lub/f %7"PRId64"b/s"
- " %7"PRId64" %s (%.2f fps)\033[K\n", pass + 1,
- global.passes, frames_in, stream->frames_out, (int64_t)stream->nbytes,
- seen_frames ? (unsigned long)(stream->nbytes * 8 / seen_frames) : 0,
- seen_frames ? (int64_t)stream->nbytes * 8
- * (int64_t)global.framerate.num / global.framerate.den
- / seen_frames
- : 0,
- stream->cx_time > 9999999 ? stream->cx_time / 1000 : stream->cx_time,
- stream->cx_time > 9999999 ? "ms" : "us",
- usec_to_fps(stream->cx_time, seen_frames));
- );
-
- if (global.show_psnr)
- FOREACH_STREAM(show_psnr(stream));
-
- FOREACH_STREAM(vpx_codec_destroy(&stream->encoder));
-
- if (global.test_decode != TEST_DECODE_OFF) {
- FOREACH_STREAM(vpx_codec_destroy(&stream->decoder));
- }
-
- close_input_file(&input);
-
- if (global.test_decode == TEST_DECODE_FATAL) {
- FOREACH_STREAM(res |= stream->mismatch_seen);
- }
- FOREACH_STREAM(close_output_file(stream, global.codec->fourcc));
-
- FOREACH_STREAM(stats_close(&stream->stats, global.passes - 1));
-
- if (global.pass)
- break;
- }
-
- if (global.show_q_hist_buckets)
- FOREACH_STREAM(show_q_histogram(stream->counts,
- global.show_q_hist_buckets));
-
- if (global.show_rate_hist_buckets)
- FOREACH_STREAM(show_rate_histogram(stream->rate_hist,
- &stream->config.cfg,
- global.show_rate_hist_buckets));
- FOREACH_STREAM(destroy_rate_histogram(stream->rate_hist));
-
-#if CONFIG_INTERNAL_STATS
- /* TODO(jkoleszar): This doesn't belong in this executable. Do it for now,
- * to match some existing utilities.
- */
- if (!(global.pass == 1 && global.passes == 2))
- FOREACH_STREAM({
- FILE *f = fopen("opsnr.stt", "a");
- if (stream->mismatch_seen) {
- fprintf(f, "First mismatch occurred in frame %d\n",
- stream->mismatch_seen);
- } else {
- fprintf(f, "No mismatch detected in recon buffers\n");
- }
- fclose(f);
- });
-#endif
-
- vpx_img_free(&raw);
- free(argv);
- free(streams);
- return res ? EXIT_FAILURE : EXIT_SUCCESS;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpxenc.h b/videocodec/libvpx_internal/libvpx/vpxenc.h
deleted file mode 100644
index a8c3722..0000000
--- a/videocodec/libvpx_internal/libvpx/vpxenc.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VPXENC_H_
-#define VPXENC_H_
-
-#include "vpx/vpx_encoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum TestDecodeFatality {
- TEST_DECODE_OFF,
- TEST_DECODE_FATAL,
- TEST_DECODE_WARN,
-};
-
-struct VpxInterface;
-
-/* Configuration elements common to all streams. */
-struct VpxEncoderConfig {
- const struct VpxInterface *codec;
- int passes;
- int pass;
- int usage;
- int deadline;
- int use_i420;
- int quiet;
- int verbose;
- int limit;
- int skip_frames;
- int show_psnr;
- enum TestDecodeFatality test_decode;
- int have_framerate;
- struct vpx_rational framerate;
- int out_part;
- int debug;
- int show_q_hist_buckets;
- int show_rate_hist_buckets;
- int disable_warnings;
- int disable_warning_prompt;
- int experimental_bitstream;
-};
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPXENC_H_
diff --git a/videocodec/libvpx_internal/libvpx/vpxstats.c b/videocodec/libvpx_internal/libvpx/vpxstats.c
deleted file mode 100644
index 5f88f8d..0000000
--- a/videocodec/libvpx_internal/libvpx/vpxstats.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./vpxstats.h"
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "./tools_common.h"
-
-int stats_open_file(stats_io_t *stats, const char *fpf, int pass) {
- int res;
- stats->pass = pass;
-
- if (pass == 0) {
- stats->file = fopen(fpf, "wb");
- stats->buf.sz = 0;
- stats->buf.buf = NULL;
- res = (stats->file != NULL);
- } else {
-#if USE_POSIX_MMAP
- struct stat stat_buf;
- int fd;
-
- fd = open(fpf, O_RDONLY);
- stats->file = fdopen(fd, "rb");
- fstat(fd, &stat_buf);
- stats->buf.sz = stat_buf.st_size;
- stats->buf.buf = mmap(NULL, stats->buf.sz, PROT_READ, MAP_PRIVATE, fd, 0);
- res = (stats->buf.buf != NULL);
-#else
- size_t nbytes;
-
- stats->file = fopen(fpf, "rb");
-
- if (fseek(stats->file, 0, SEEK_END))
- fatal("First-pass stats file must be seekable!");
-
- stats->buf.sz = stats->buf_alloc_sz = ftell(stats->file);
- rewind(stats->file);
-
- stats->buf.buf = malloc(stats->buf_alloc_sz);
-
- if (!stats->buf.buf)
- fatal("Failed to allocate first-pass stats buffer (%lu bytes)",
- (unsigned int)stats->buf_alloc_sz);
-
- nbytes = fread(stats->buf.buf, 1, stats->buf.sz, stats->file);
- res = (nbytes == stats->buf.sz);
-#endif /* USE_POSIX_MMAP */
- }
-
- return res;
-}
-
-int stats_open_mem(stats_io_t *stats, int pass) {
- int res;
- stats->pass = pass;
-
- if (!pass) {
- stats->buf.sz = 0;
- stats->buf_alloc_sz = 64 * 1024;
- stats->buf.buf = malloc(stats->buf_alloc_sz);
- }
-
- stats->buf_ptr = stats->buf.buf;
- res = (stats->buf.buf != NULL);
- return res;
-}
-
-void stats_close(stats_io_t *stats, int last_pass) {
- if (stats->file) {
- if (stats->pass == last_pass) {
-#if USE_POSIX_MMAP
- munmap(stats->buf.buf, stats->buf.sz);
-#else
- free(stats->buf.buf);
-#endif /* USE_POSIX_MMAP */
- }
-
- fclose(stats->file);
- stats->file = NULL;
- } else {
- if (stats->pass == last_pass)
- free(stats->buf.buf);
- }
-}
-
-void stats_write(stats_io_t *stats, const void *pkt, size_t len) {
- if (stats->file) {
- (void) fwrite(pkt, 1, len, stats->file);
- } else {
- if (stats->buf.sz + len > stats->buf_alloc_sz) {
- size_t new_sz = stats->buf_alloc_sz + 64 * 1024;
- char *new_ptr = realloc(stats->buf.buf, new_sz);
-
- if (new_ptr) {
- stats->buf_ptr = new_ptr + (stats->buf_ptr - (char *)stats->buf.buf);
- stats->buf.buf = new_ptr;
- stats->buf_alloc_sz = new_sz;
- } else {
- fatal("Failed to realloc firstpass stats buffer.");
- }
- }
-
- memcpy(stats->buf_ptr, pkt, len);
- stats->buf.sz += len;
- stats->buf_ptr += len;
- }
-}
-
-vpx_fixed_buf_t stats_get(stats_io_t *stats) {
- return stats->buf;
-}
diff --git a/videocodec/libvpx_internal/libvpx/vpxstats.h b/videocodec/libvpx_internal/libvpx/vpxstats.h
deleted file mode 100644
index 5c9ea34..0000000
--- a/videocodec/libvpx_internal/libvpx/vpxstats.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VPXSTATS_H_
-#define VPXSTATS_H_
-
-#include <stdio.h>
-
-#include "vpx/vpx_encoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This structure is used to abstract the different ways of handling
- * first pass statistics
- */
-typedef struct {
- vpx_fixed_buf_t buf;
- int pass;
- FILE *file;
- char *buf_ptr;
- size_t buf_alloc_sz;
-} stats_io_t;
-
-int stats_open_file(stats_io_t *stats, const char *fpf, int pass);
-int stats_open_mem(stats_io_t *stats, int pass);
-void stats_close(stats_io_t *stats, int last_pass);
-void stats_write(stats_io_t *stats, const void *pkt, size_t len);
-vpx_fixed_buf_t stats_get(stats_io_t *stats);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VPXSTATS_H_
diff --git a/videocodec/libvpx_internal/libvpx/warnings.c b/videocodec/libvpx_internal/libvpx/warnings.c
deleted file mode 100644
index 7ac678a..0000000
--- a/videocodec/libvpx_internal/libvpx/warnings.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./warnings.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vpx/vpx_encoder.h"
-
-#include "./tools_common.h"
-#include "./vpxenc.h"
-
-static const char quantizer_warning_string[] =
- "Bad quantizer values. Quantizer values should not be equal, and should "
- "differ by at least 8.";
-static const char lag_in_frames_with_realtime[] =
- "Lag in frames is ignored when deadline is set to realtime.";
-
-struct WarningListNode {
- const char *warning_string;
- struct WarningListNode *next_warning;
-};
-
-struct WarningList {
- struct WarningListNode *warning_node;
-};
-
-static void add_warning(const char *warning_string,
- struct WarningList *warning_list) {
- struct WarningListNode **node = &warning_list->warning_node;
-
- struct WarningListNode *new_node = malloc(sizeof(*new_node));
- if (new_node == NULL) {
- fatal("Unable to allocate warning node.");
- }
-
- new_node->warning_string = warning_string;
- new_node->next_warning = NULL;
-
- while (*node != NULL)
- node = &(*node)->next_warning;
-
- *node = new_node;
-}
-
-static void free_warning_list(struct WarningList *warning_list) {
- while (warning_list->warning_node != NULL) {
- struct WarningListNode *const node = warning_list->warning_node;
- warning_list->warning_node = node->next_warning;
- free(node);
- }
-}
-
-static int continue_prompt(int num_warnings) {
- int c;
- fprintf(stderr,
- "%d encoder configuration warning(s). Continue? (y to continue) ",
- num_warnings);
- c = getchar();
- return c == 'y';
-}
-
-static void check_quantizer(int min_q, int max_q,
- struct WarningList *warning_list) {
- const int lossless = min_q == 0 && max_q == 0;
- if (!lossless && (min_q == max_q || abs(max_q - min_q) < 8))
- add_warning(quantizer_warning_string, warning_list);
-}
-
-static void check_lag_in_frames_realtime_deadline(
- int lag_in_frames,
- int deadline,
- struct WarningList *warning_list) {
- if (deadline == VPX_DL_REALTIME && lag_in_frames != 0)
- add_warning(lag_in_frames_with_realtime, warning_list);
-}
-
-void check_encoder_config(int disable_prompt,
- const struct VpxEncoderConfig *global_config,
- const struct vpx_codec_enc_cfg *stream_config) {
- int num_warnings = 0;
- struct WarningListNode *warning = NULL;
- struct WarningList warning_list = {0};
-
- check_quantizer(stream_config->rc_min_quantizer,
- stream_config->rc_max_quantizer,
- &warning_list);
- check_lag_in_frames_realtime_deadline(stream_config->g_lag_in_frames,
- global_config->deadline,
- &warning_list);
- /* Count and print warnings. */
- for (warning = warning_list.warning_node;
- warning != NULL;
- warning = warning->next_warning,
- ++num_warnings) {
- warn(warning->warning_string);
- }
-
- free_warning_list(&warning_list);
-
- if (num_warnings) {
- if (!disable_prompt && !continue_prompt(num_warnings))
- exit(EXIT_FAILURE);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/warnings.h b/videocodec/libvpx_internal/libvpx/warnings.h
deleted file mode 100644
index 6b8ae67..0000000
--- a/videocodec/libvpx_internal/libvpx/warnings.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef WARNINGS_H_
-#define WARNINGS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct vpx_codec_enc_cfg;
-struct VpxEncoderConfig;
-
-/*
- * Checks config for improperly used settings. Warns user upon encountering
- * settings that will lead to poor output quality. Prompts user to continue
- * when warnings are issued.
- */
-void check_encoder_config(int disable_prompt,
- const struct VpxEncoderConfig *global_config,
- const struct vpx_codec_enc_cfg *stream_config);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // WARNINGS_H_
diff --git a/videocodec/libvpx_internal/libvpx/webmdec.c b/videocodec/libvpx_internal/libvpx/webmdec.c
deleted file mode 100644
index 7cacdf9..0000000
--- a/videocodec/libvpx_internal/libvpx/webmdec.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./webmdec.h"
-
-#include <stdarg.h>
-
-#include "third_party/nestegg/include/nestegg/nestegg.h"
-
-static int nestegg_read_cb(void *buffer, size_t length, void *userdata) {
- FILE *f = userdata;
-
- if (fread(buffer, 1, length, f) < length) {
- if (ferror(f))
- return -1;
- if (feof(f))
- return 0;
- }
- return 1;
-}
-
-static int nestegg_seek_cb(int64_t offset, int whence, void *userdata) {
- switch (whence) {
- case NESTEGG_SEEK_SET:
- whence = SEEK_SET;
- break;
- case NESTEGG_SEEK_CUR:
- whence = SEEK_CUR;
- break;
- case NESTEGG_SEEK_END:
- whence = SEEK_END;
- break;
- };
- return fseek(userdata, (int32_t)offset, whence) ? -1 : 0;
-}
-
-static int64_t nestegg_tell_cb(void *userdata) {
- return ftell(userdata);
-}
-
-static void nestegg_log_cb(nestegg *context,
- unsigned int severity,
- char const *format, ...) {
- va_list ap;
- va_start(ap, format);
- vfprintf(stderr, format, ap);
- fprintf(stderr, "\n");
- va_end(ap);
-}
-
-int file_is_webm(struct WebmInputContext *webm_ctx,
- struct VpxInputContext *vpx_ctx) {
- uint32_t i, n;
- int track_type = -1;
- int codec_id;
-
- nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb, 0};
- nestegg_video_params params;
-
- io.userdata = vpx_ctx->file;
- if (nestegg_init(&webm_ctx->nestegg_ctx, io, NULL, -1))
- goto fail;
-
- if (nestegg_track_count(webm_ctx->nestegg_ctx, &n))
- goto fail;
-
- for (i = 0; i < n; i++) {
- track_type = nestegg_track_type(webm_ctx->nestegg_ctx, i);
-
- if (track_type == NESTEGG_TRACK_VIDEO)
- break;
- else if (track_type < 0)
- goto fail;
- }
-
- codec_id = nestegg_track_codec_id(webm_ctx->nestegg_ctx, i);
- if (codec_id == NESTEGG_CODEC_VP8) {
- vpx_ctx->fourcc = VP8_FOURCC;
- } else if (codec_id == NESTEGG_CODEC_VP9) {
- vpx_ctx->fourcc = VP9_FOURCC;
- } else {
- fatal("Not VPx video, quitting.\n");
- }
-
- webm_ctx->video_track = i;
-
- if (nestegg_track_video_params(webm_ctx->nestegg_ctx, i, &params))
- goto fail;
-
- vpx_ctx->framerate.denominator = 0;
- vpx_ctx->framerate.numerator = 0;
- vpx_ctx->width = params.width;
- vpx_ctx->height = params.height;
-
- return 1;
-
- fail:
- webm_ctx->nestegg_ctx = NULL;
- rewind(vpx_ctx->file);
-
- return 0;
-}
-
-int webm_read_frame(struct WebmInputContext *webm_ctx,
- uint8_t **buffer,
- size_t *bytes_in_buffer,
- size_t *buffer_size) {
- if (webm_ctx->chunk >= webm_ctx->chunks) {
- uint32_t track;
-
- do {
- /* End of this packet, get another. */
- if (webm_ctx->pkt) {
- nestegg_free_packet(webm_ctx->pkt);
- webm_ctx->pkt = NULL;
- }
-
- if (nestegg_read_packet(webm_ctx->nestegg_ctx, &webm_ctx->pkt) <= 0 ||
- nestegg_packet_track(webm_ctx->pkt, &track)) {
- return 1;
- }
- } while (track != webm_ctx->video_track);
-
- if (nestegg_packet_count(webm_ctx->pkt, &webm_ctx->chunks))
- return 1;
-
- webm_ctx->chunk = 0;
- }
-
- if (nestegg_packet_data(webm_ctx->pkt, webm_ctx->chunk,
- buffer, bytes_in_buffer)) {
- return 1;
- }
-
- webm_ctx->chunk++;
- return 0;
-}
-
-int webm_guess_framerate(struct WebmInputContext *webm_ctx,
- struct VpxInputContext *vpx_ctx) {
- uint32_t i;
- uint64_t tstamp = 0;
-
- /* Check to see if we can seek before we parse any data. */
- if (nestegg_track_seek(webm_ctx->nestegg_ctx, webm_ctx->video_track, 0)) {
- warn("Failed to guess framerate (no Cues), set to 30fps.\n");
- vpx_ctx->framerate.numerator = 30;
- vpx_ctx->framerate.denominator = 1;
- return 0;
- }
-
- /* Guess the framerate. Read up to 1 second, or 50 video packets,
- * whichever comes first.
- */
- for (i = 0; tstamp < 1000000000 && i < 50;) {
- nestegg_packet *pkt;
- uint32_t track;
-
- if (nestegg_read_packet(webm_ctx->nestegg_ctx, &pkt) <= 0)
- break;
-
- nestegg_packet_track(pkt, &track);
- if (track == webm_ctx->video_track) {
- nestegg_packet_tstamp(pkt, &tstamp);
- ++i;
- }
-
- nestegg_free_packet(pkt);
- }
-
- if (nestegg_track_seek(webm_ctx->nestegg_ctx, webm_ctx->video_track, 0))
- goto fail;
-
- vpx_ctx->framerate.numerator = (i - 1) * 1000000;
- vpx_ctx->framerate.denominator = (int)(tstamp / 1000);
- return 0;
-
- fail:
- nestegg_destroy(webm_ctx->nestegg_ctx);
- webm_ctx->nestegg_ctx = NULL;
- rewind(vpx_ctx->file);
- return 1;
-}
-
-void webm_free(struct WebmInputContext *webm_ctx) {
- if (webm_ctx && webm_ctx->nestegg_ctx) {
- if (webm_ctx->pkt)
- nestegg_free_packet(webm_ctx->pkt);
- nestegg_destroy(webm_ctx->nestegg_ctx);
- }
-}
diff --git a/videocodec/libvpx_internal/libvpx/webmdec.h b/videocodec/libvpx_internal/libvpx/webmdec.h
deleted file mode 100644
index fa5a52e..0000000
--- a/videocodec/libvpx_internal/libvpx/webmdec.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef WEBMDEC_H_
-#define WEBMDEC_H_
-
-#include "./tools_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct nestegg;
-struct nestegg_packet;
-struct VpxInputContext;
-
-struct WebmInputContext {
- uint32_t chunk;
- uint32_t chunks;
- uint32_t video_track;
- struct nestegg *nestegg_ctx;
- struct nestegg_packet *pkt;
-};
-
-int file_is_webm(struct WebmInputContext *webm_ctx,
- struct VpxInputContext *vpx_ctx);
-
-int webm_read_frame(struct WebmInputContext *webm_ctx,
- uint8_t **buffer,
- size_t *bytes_in_buffer,
- size_t *buffer_size);
-
-int webm_guess_framerate(struct WebmInputContext *webm_ctx,
- struct VpxInputContext *vpx_ctx);
-
-void webm_free(struct WebmInputContext *webm_ctx);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // WEBMDEC_H_
diff --git a/videocodec/libvpx_internal/libvpx/webmenc.c b/videocodec/libvpx_internal/libvpx/webmenc.c
deleted file mode 100644
index 17bbeec..0000000
--- a/videocodec/libvpx_internal/libvpx/webmenc.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "webmenc.h"
-
-#include <limits.h>
-#include <string.h>
-
-#include "third_party/libmkv/EbmlWriter.h"
-#include "third_party/libmkv/EbmlIDs.h"
-
-void Ebml_Write(struct EbmlGlobal *glob,
- const void *buffer_in,
- unsigned long len) {
- (void) fwrite(buffer_in, 1, len, glob->stream);
-}
-
-#define WRITE_BUFFER(s) \
-for (i = len - 1; i >= 0; i--) { \
- x = (char)(*(const s *)buffer_in >> (i * CHAR_BIT)); \
- Ebml_Write(glob, &x, 1); \
-}
-
-void Ebml_Serialize(struct EbmlGlobal *glob,
- const void *buffer_in,
- int buffer_size,
- unsigned long len) {
- char x;
- int i;
-
- /* buffer_size:
- * 1 - int8_t;
- * 2 - int16_t;
- * 3 - int32_t;
- * 4 - int64_t;
- */
- switch (buffer_size) {
- case 1:
- WRITE_BUFFER(int8_t)
- break;
- case 2:
- WRITE_BUFFER(int16_t)
- break;
- case 4:
- WRITE_BUFFER(int32_t)
- break;
- case 8:
- WRITE_BUFFER(int64_t)
- break;
- default:
- break;
- }
-}
-#undef WRITE_BUFFER
-
-/* Need a fixed size serializer for the track ID. libmkv provides a 64 bit
- * one, but not a 32 bit one.
- */
-static void Ebml_SerializeUnsigned32(struct EbmlGlobal *glob,
- unsigned int class_id,
- uint64_t ui) {
- const unsigned char sizeSerialized = 4 | 0x80;
- Ebml_WriteID(glob, class_id);
- Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
- Ebml_Serialize(glob, &ui, sizeof(ui), 4);
-}
-
-static void Ebml_StartSubElement(struct EbmlGlobal *glob,
- EbmlLoc *ebmlLoc,
- unsigned int class_id) {
- const uint64_t kEbmlUnknownLength = LITERALU64(0x01FFFFFF, 0xFFFFFFFF);
- Ebml_WriteID(glob, class_id);
- *ebmlLoc = ftello(glob->stream);
- Ebml_Serialize(glob, &kEbmlUnknownLength, sizeof(kEbmlUnknownLength), 8);
-}
-
-static void Ebml_EndSubElement(struct EbmlGlobal *glob, EbmlLoc *ebmlLoc) {
- off_t pos;
- uint64_t size;
-
- /* Save the current stream pointer. */
- pos = ftello(glob->stream);
-
- /* Calculate the size of this element. */
- size = pos - *ebmlLoc - 8;
- size |= LITERALU64(0x01000000, 0x00000000);
-
- /* Seek back to the beginning of the element and write the new size. */
- fseeko(glob->stream, *ebmlLoc, SEEK_SET);
- Ebml_Serialize(glob, &size, sizeof(size), 8);
-
- /* Reset the stream pointer. */
- fseeko(glob->stream, pos, SEEK_SET);
-}
-
-void write_webm_seek_element(struct EbmlGlobal *ebml,
- unsigned int id,
- off_t pos) {
- uint64_t offset = pos - ebml->position_reference;
- EbmlLoc start;
- Ebml_StartSubElement(ebml, &start, Seek);
- Ebml_SerializeBinary(ebml, SeekID, id);
- Ebml_SerializeUnsigned64(ebml, SeekPosition, offset);
- Ebml_EndSubElement(ebml, &start);
-}
-
-void write_webm_seek_info(struct EbmlGlobal *ebml) {
- off_t pos;
- EbmlLoc start;
- EbmlLoc startInfo;
- uint64_t frame_time;
- char version_string[64];
-
- /* Save the current stream pointer. */
- pos = ftello(ebml->stream);
-
- if (ebml->seek_info_pos)
- fseeko(ebml->stream, ebml->seek_info_pos, SEEK_SET);
- else
- ebml->seek_info_pos = pos;
-
- Ebml_StartSubElement(ebml, &start, SeekHead);
- write_webm_seek_element(ebml, Tracks, ebml->track_pos);
- write_webm_seek_element(ebml, Cues, ebml->cue_pos);
- write_webm_seek_element(ebml, Info, ebml->segment_info_pos);
- Ebml_EndSubElement(ebml, &start);
-
- /* Create and write the Segment Info. */
- if (ebml->debug) {
- strcpy(version_string, "vpxenc");
- } else {
- strcpy(version_string, "vpxenc ");
- strncat(version_string,
- vpx_codec_version_str(),
- sizeof(version_string) - 1 - strlen(version_string));
- }
-
- frame_time = (uint64_t)1000 * ebml->framerate.den
- / ebml->framerate.num;
- ebml->segment_info_pos = ftello(ebml->stream);
- Ebml_StartSubElement(ebml, &startInfo, Info);
- Ebml_SerializeUnsigned(ebml, TimecodeScale, 1000000);
- Ebml_SerializeFloat(ebml, Segment_Duration,
- (double)(ebml->last_pts_ms + frame_time));
- Ebml_SerializeString(ebml, 0x4D80, version_string);
- Ebml_SerializeString(ebml, 0x5741, version_string);
- Ebml_EndSubElement(ebml, &startInfo);
-}
-
-void write_webm_file_header(struct EbmlGlobal *glob,
- const vpx_codec_enc_cfg_t *cfg,
- const struct vpx_rational *fps,
- stereo_format_t stereo_fmt,
- unsigned int fourcc) {
- EbmlLoc start;
- EbmlLoc trackStart;
- EbmlLoc videoStart;
- unsigned int trackNumber = 1;
- uint64_t trackID = 0;
- unsigned int pixelWidth = cfg->g_w;
- unsigned int pixelHeight = cfg->g_h;
-
- /* Write the EBML header. */
- Ebml_StartSubElement(glob, &start, EBML);
- Ebml_SerializeUnsigned(glob, EBMLVersion, 1);
- Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1);
- Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4);
- Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8);
- Ebml_SerializeString(glob, DocType, "webm");
- Ebml_SerializeUnsigned(glob, DocTypeVersion, 2);
- Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2);
- Ebml_EndSubElement(glob, &start);
-
- /* Open and begin writing the segment element. */
- Ebml_StartSubElement(glob, &glob->startSegment, Segment);
- glob->position_reference = ftello(glob->stream);
- glob->framerate = *fps;
- write_webm_seek_info(glob);
-
- /* Open and write the Tracks element. */
- glob->track_pos = ftello(glob->stream);
- Ebml_StartSubElement(glob, &trackStart, Tracks);
-
- /* Open and write the Track entry. */
- Ebml_StartSubElement(glob, &start, TrackEntry);
- Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
- glob->track_id_pos = ftello(glob->stream);
- Ebml_SerializeUnsigned32(glob, TrackUID, trackID);
- Ebml_SerializeUnsigned(glob, TrackType, 1);
- Ebml_SerializeString(glob, CodecID,
- fourcc == VP8_FOURCC ? "V_VP8" : "V_VP9");
- Ebml_StartSubElement(glob, &videoStart, Video);
- Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth);
- Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight);
- Ebml_SerializeUnsigned(glob, StereoMode, stereo_fmt);
- Ebml_EndSubElement(glob, &videoStart);
-
- /* Close Track entry. */
- Ebml_EndSubElement(glob, &start);
-
- /* Close Tracks element. */
- Ebml_EndSubElement(glob, &trackStart);
-
- /* Segment element remains open. */
-}
-
-void write_webm_block(struct EbmlGlobal *glob,
- const vpx_codec_enc_cfg_t *cfg,
- const vpx_codec_cx_pkt_t *pkt) {
- unsigned int block_length;
- unsigned char track_number;
- uint16_t block_timecode = 0;
- unsigned char flags;
- int64_t pts_ms;
- int start_cluster = 0, is_keyframe;
-
- /* Calculate the PTS of this frame in milliseconds. */
- pts_ms = pkt->data.frame.pts * 1000
- * (uint64_t)cfg->g_timebase.num / (uint64_t)cfg->g_timebase.den;
-
- if (pts_ms <= glob->last_pts_ms)
- pts_ms = glob->last_pts_ms + 1;
-
- glob->last_pts_ms = pts_ms;
-
- /* Calculate the relative time of this block. */
- if (pts_ms - glob->cluster_timecode > SHRT_MAX)
- start_cluster = 1;
- else
- block_timecode = (uint16_t)pts_ms - glob->cluster_timecode;
-
- is_keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY);
- if (start_cluster || is_keyframe) {
- if (glob->cluster_open)
- Ebml_EndSubElement(glob, &glob->startCluster);
-
- /* Open the new cluster. */
- block_timecode = 0;
- glob->cluster_open = 1;
- glob->cluster_timecode = (uint32_t)pts_ms;
- glob->cluster_pos = ftello(glob->stream);
- Ebml_StartSubElement(glob, &glob->startCluster, Cluster);
- Ebml_SerializeUnsigned(glob, Timecode, glob->cluster_timecode);
-
- /* Save a cue point if this is a keyframe. */
- if (is_keyframe) {
- struct cue_entry *cue, *new_cue_list;
-
- new_cue_list = realloc(glob->cue_list,
- (glob->cues + 1) * sizeof(struct cue_entry));
- if (new_cue_list)
- glob->cue_list = new_cue_list;
- else
- fatal("Failed to realloc cue list.");
-
- cue = &glob->cue_list[glob->cues];
- cue->time = glob->cluster_timecode;
- cue->loc = glob->cluster_pos;
- glob->cues++;
- }
- }
-
- /* Write the Simple Block. */
- Ebml_WriteID(glob, SimpleBlock);
-
- block_length = (unsigned int)pkt->data.frame.sz + 4;
- block_length |= 0x10000000;
- Ebml_Serialize(glob, &block_length, sizeof(block_length), 4);
-
- track_number = 1;
- track_number |= 0x80;
- Ebml_Write(glob, &track_number, 1);
-
- Ebml_Serialize(glob, &block_timecode, sizeof(block_timecode), 2);
-
- flags = 0;
- if (is_keyframe)
- flags |= 0x80;
- if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE)
- flags |= 0x08;
- Ebml_Write(glob, &flags, 1);
-
- Ebml_Write(glob, pkt->data.frame.buf, (unsigned int)pkt->data.frame.sz);
-}
-
-void write_webm_file_footer(struct EbmlGlobal *glob, int hash) {
- EbmlLoc start_cues;
- EbmlLoc start_cue_point;
- EbmlLoc start_cue_tracks;
- unsigned int i;
-
- if (glob->cluster_open)
- Ebml_EndSubElement(glob, &glob->startCluster);
-
- glob->cue_pos = ftello(glob->stream);
- Ebml_StartSubElement(glob, &start_cues, Cues);
-
- for (i = 0; i < glob->cues; i++) {
- struct cue_entry *cue = &glob->cue_list[i];
- Ebml_StartSubElement(glob, &start_cue_point, CuePoint);
- Ebml_SerializeUnsigned(glob, CueTime, cue->time);
-
- Ebml_StartSubElement(glob, &start_cue_tracks, CueTrackPositions);
- Ebml_SerializeUnsigned(glob, CueTrack, 1);
- Ebml_SerializeUnsigned64(glob, CueClusterPosition,
- cue->loc - glob->position_reference);
- Ebml_EndSubElement(glob, &start_cue_tracks);
-
- Ebml_EndSubElement(glob, &start_cue_point);
- }
-
- Ebml_EndSubElement(glob, &start_cues);
-
- /* Close the Segment. */
- Ebml_EndSubElement(glob, &glob->startSegment);
-
- /* Patch up the seek info block. */
- write_webm_seek_info(glob);
-
- /* Patch up the track id. */
- fseeko(glob->stream, glob->track_id_pos, SEEK_SET);
- Ebml_SerializeUnsigned32(glob, TrackUID, glob->debug ? 0xDEADBEEF : hash);
-
- fseeko(glob->stream, 0, SEEK_END);
-}
diff --git a/videocodec/libvpx_internal/libvpx/webmenc.h b/videocodec/libvpx_internal/libvpx/webmenc.h
deleted file mode 100644
index 362aa89..0000000
--- a/videocodec/libvpx_internal/libvpx/webmenc.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef WEBMENC_H_
-#define WEBMENC_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#if defined(_MSC_VER)
-/* MSVS doesn't define off_t */
-typedef __int64 off_t;
-#else
-#include <stdint.h>
-#endif
-
-#include "tools_common.h"
-#include "vpx/vpx_encoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef off_t EbmlLoc;
-
-struct cue_entry {
- unsigned int time;
- uint64_t loc;
-};
-
-struct EbmlGlobal {
- int debug;
-
- FILE *stream;
- int64_t last_pts_ms;
- vpx_rational_t framerate;
-
- /* These pointers are to the start of an element */
- off_t position_reference;
- off_t seek_info_pos;
- off_t segment_info_pos;
- off_t track_pos;
- off_t cue_pos;
- off_t cluster_pos;
-
- /* This pointer is to a specific element to be serialized */
- off_t track_id_pos;
-
- /* These pointers are to the size field of the element */
- EbmlLoc startSegment;
- EbmlLoc startCluster;
-
- uint32_t cluster_timecode;
- int cluster_open;
-
- struct cue_entry *cue_list;
- unsigned int cues;
-};
-
-/* Stereo 3D packed frame format */
-typedef enum stereo_format {
- STEREO_FORMAT_MONO = 0,
- STEREO_FORMAT_LEFT_RIGHT = 1,
- STEREO_FORMAT_BOTTOM_TOP = 2,
- STEREO_FORMAT_TOP_BOTTOM = 3,
- STEREO_FORMAT_RIGHT_LEFT = 11
-} stereo_format_t;
-
-void write_webm_seek_element(struct EbmlGlobal *ebml,
- unsigned int id,
- off_t pos);
-
-void write_webm_file_header(struct EbmlGlobal *glob,
- const vpx_codec_enc_cfg_t *cfg,
- const struct vpx_rational *fps,
- stereo_format_t stereo_fmt,
- unsigned int fourcc);
-
-void write_webm_block(struct EbmlGlobal *glob,
- const vpx_codec_enc_cfg_t *cfg,
- const vpx_codec_cx_pkt_t *pkt);
-
-void write_webm_file_footer(struct EbmlGlobal *glob, int hash);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // WEBMENC_H_
diff --git a/videocodec/libvpx_internal/libvpx/y4menc.c b/videocodec/libvpx_internal/libvpx/y4menc.c
deleted file mode 100644
index 8b1c95e..0000000
--- a/videocodec/libvpx_internal/libvpx/y4menc.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "./y4menc.h"
-
-int y4m_write_file_header(char *buf, size_t len, int width, int height,
- const struct VpxRational *framerate,
- vpx_img_fmt_t fmt) {
- const char *const color = fmt == VPX_IMG_FMT_444A ? "C444alpha\n" :
- fmt == VPX_IMG_FMT_I444 ? "C444\n" :
- fmt == VPX_IMG_FMT_I422 ? "C422\n" :
- "C420jpeg\n";
-
- return snprintf(buf, len, "YUV4MPEG2 W%u H%u F%u:%u I%c %s", width, height,
- framerate->numerator, framerate->denominator, 'p', color);
-}
-
-int y4m_write_frame_header(char *buf, size_t len) {
- return snprintf(buf, len, "FRAME\n");
-}
diff --git a/videocodec/libvpx_internal/libvpx/y4menc.h b/videocodec/libvpx_internal/libvpx/y4menc.h
deleted file mode 100644
index 0fabf56..0000000
--- a/videocodec/libvpx_internal/libvpx/y4menc.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef Y4MENC_H_
-#define Y4MENC_H_
-
-#include "./tools_common.h"
-
-#include "vpx/vpx_decoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define Y4M_BUFFER_SIZE 128
-
-int y4m_write_file_header(char *buf, size_t len, int width, int height,
- const struct VpxRational *framerate,
- vpx_img_fmt_t fmt);
-int y4m_write_frame_header(char *buf, size_t len);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // Y4MENC_H_
diff --git a/videocodec/libvpx_internal/libvpx/y4minput.c b/videocodec/libvpx_internal/libvpx/y4minput.c
deleted file mode 100644
index 90c5310..0000000
--- a/videocodec/libvpx_internal/libvpx/y4minput.c
+++ /dev/null
@@ -1,941 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- *
- * Based on code from the OggTheora software codec source code,
- * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors.
- */
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vpx/vpx_integer.h"
-#include "y4minput.h"
-
-// Reads 'size' bytes from 'file' into 'buf' with some fault tolerance.
-// Returns true on success.
-static int file_read(void *buf, size_t size, FILE *file) {
- const int kMaxRetries = 5;
- int retry_count = 0;
- int file_error;
- size_t len = 0;
- do {
- const size_t n = fread((uint8_t*)buf + len, 1, size - len, file);
- len += n;
- file_error = ferror(file);
- if (file_error) {
- if (errno == EINTR || errno == EAGAIN) {
- clearerr(file);
- continue;
- } else {
- fprintf(stderr, "Error reading file: %u of %u bytes read, %d: %s\n",
- (uint32_t)len, (uint32_t)size, errno, strerror(errno));
- return 0;
- }
- }
- } while (!feof(file) && len < size && ++retry_count < kMaxRetries);
-
- if (!feof(file) && len != size) {
- fprintf(stderr, "Error reading file: %u of %u bytes read,"
- " error: %d, retries: %d, %d: %s\n",
- (uint32_t)len, (uint32_t)size, file_error, retry_count,
- errno, strerror(errno));
- }
- return len == size;
-}
-
-static int y4m_parse_tags(y4m_input *_y4m, char *_tags) {
- int got_w;
- int got_h;
- int got_fps;
- int got_interlace;
- int got_par;
- int got_chroma;
- char *p;
- char *q;
- got_w = got_h = got_fps = got_interlace = got_par = got_chroma = 0;
- for (p = _tags;; p = q) {
- /*Skip any leading spaces.*/
- while (*p == ' ')p++;
- /*If that's all we have, stop.*/
- if (p[0] == '\0')break;
- /*Find the end of this tag.*/
- for (q = p + 1; *q != '\0' && *q != ' '; q++);
- /*Process the tag.*/
- switch (p[0]) {
- case 'W': {
- if (sscanf(p + 1, "%d", &_y4m->pic_w) != 1)return -1;
- got_w = 1;
- }
- break;
- case 'H': {
- if (sscanf(p + 1, "%d", &_y4m->pic_h) != 1)return -1;
- got_h = 1;
- }
- break;
- case 'F': {
- if (sscanf(p + 1, "%d:%d", &_y4m->fps_n, &_y4m->fps_d) != 2) {
- return -1;
- }
- got_fps = 1;
- }
- break;
- case 'I': {
- _y4m->interlace = p[1];
- got_interlace = 1;
- }
- break;
- case 'A': {
- if (sscanf(p + 1, "%d:%d", &_y4m->par_n, &_y4m->par_d) != 2) {
- return -1;
- }
- got_par = 1;
- }
- break;
- case 'C': {
- if (q - p > 16)return -1;
- memcpy(_y4m->chroma_type, p + 1, q - p - 1);
- _y4m->chroma_type[q - p - 1] = '\0';
- got_chroma = 1;
- }
- break;
- /*Ignore unknown tags.*/
- }
- }
- if (!got_w || !got_h || !got_fps)return -1;
- if (!got_interlace)_y4m->interlace = '?';
- if (!got_par)_y4m->par_n = _y4m->par_d = 0;
- /*Chroma-type is not specified in older files, e.g., those generated by
- mplayer.*/
- if (!got_chroma)strcpy(_y4m->chroma_type, "420");
- return 0;
-}
-
-
-
-/*All anti-aliasing filters in the following conversion functions are based on
- one of two window functions:
- The 6-tap Lanczos window (for down-sampling and shifts):
- sinc(\pi*t)*sinc(\pi*t/3), |t|<3 (sinc(t)==sin(t)/t)
- 0, |t|>=3
- The 4-tap Mitchell window (for up-sampling):
- 7|t|^3-12|t|^2+16/3, |t|<1
- -(7/3)|x|^3+12|x|^2-20|x|+32/3, |t|<2
- 0, |t|>=2
- The number of taps is intentionally kept small to reduce computational
- overhead and limit ringing.
-
- The taps from these filters are scaled so that their sum is 1, and the result
- is scaled by 128 and rounded to integers to create a filter whose
- intermediate values fit inside 16 bits.
- Coefficients are rounded in such a way as to ensure their sum is still 128,
- which is usually equivalent to normal rounding.
-
- Conversions which require both horizontal and vertical filtering could
- have these steps pipelined, for less memory consumption and better cache
- performance, but we do them separately for simplicity.*/
-
-#define OC_MINI(_a,_b) ((_a)>(_b)?(_b):(_a))
-#define OC_MAXI(_a,_b) ((_a)<(_b)?(_b):(_a))
-#define OC_CLAMPI(_a,_b,_c) (OC_MAXI(_a,OC_MINI(_b,_c)))
-
-/*420jpeg chroma samples are sited like:
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
-
- 420mpeg2 chroma samples are sited like:
- Y-------Y-------Y-------Y-------
- | | | |
- BR | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- BR | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
-
- We use a resampling filter to shift the site locations one quarter pixel (at
- the chroma plane's resolution) to the right.
- The 4:2:2 modes look exactly the same, except there are twice as many chroma
- lines, and they are vertically co-sited with the luma samples in both the
- mpeg2 and jpeg cases (thus requiring no vertical resampling).*/
-static void y4m_42xmpeg2_42xjpeg_helper(unsigned char *_dst,
- const unsigned char *_src, int _c_w, int _c_h) {
- int y;
- int x;
- for (y = 0; y < _c_h; y++) {
- /*Filter: [4 -17 114 35 -9 1]/128, derived from a 6-tap Lanczos
- window.*/
- for (x = 0; x < OC_MINI(_c_w, 2); x++) {
- _dst[x] = (unsigned char)OC_CLAMPI(0, (4 * _src[0] - 17 * _src[OC_MAXI(x - 1, 0)] +
- 114 * _src[x] + 35 * _src[OC_MINI(x + 1, _c_w - 1)] - 9 * _src[OC_MINI(x + 2, _c_w - 1)] +
- _src[OC_MINI(x + 3, _c_w - 1)] + 64) >> 7, 255);
- }
- for (; x < _c_w - 3; x++) {
- _dst[x] = (unsigned char)OC_CLAMPI(0, (4 * _src[x - 2] - 17 * _src[x - 1] +
- 114 * _src[x] + 35 * _src[x + 1] - 9 * _src[x + 2] + _src[x + 3] + 64) >> 7, 255);
- }
- for (; x < _c_w; x++) {
- _dst[x] = (unsigned char)OC_CLAMPI(0, (4 * _src[x - 2] - 17 * _src[x - 1] +
- 114 * _src[x] + 35 * _src[OC_MINI(x + 1, _c_w - 1)] - 9 * _src[OC_MINI(x + 2, _c_w - 1)] +
- _src[_c_w - 1] + 64) >> 7, 255);
- }
- _dst += _c_w;
- _src += _c_w;
- }
-}
-
-/*Handles both 422 and 420mpeg2 to 422jpeg and 420jpeg, respectively.*/
-static void y4m_convert_42xmpeg2_42xjpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- int c_w;
- int c_h;
- int c_sz;
- int pli;
- /*Skip past the luma data.*/
- _dst += _y4m->pic_w * _y4m->pic_h;
- /*Compute the size of each chroma plane.*/
- c_w = (_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
- c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
- c_sz = c_w * c_h;
- for (pli = 1; pli < 3; pli++) {
- y4m_42xmpeg2_42xjpeg_helper(_dst, _aux, c_w, c_h);
- _dst += c_sz;
- _aux += c_sz;
- }
-}
-
-/*This format is only used for interlaced content, but is included for
- completeness.
-
- 420jpeg chroma samples are sited like:
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
-
- 420paldv chroma samples are sited like:
- YR------Y-------YR------Y-------
- | | | |
- | | | |
- | | | |
- YB------Y-------YB------Y-------
- | | | |
- | | | |
- | | | |
- YR------Y-------YR------Y-------
- | | | |
- | | | |
- | | | |
- YB------Y-------YB------Y-------
- | | | |
- | | | |
- | | | |
-
- We use a resampling filter to shift the site locations one quarter pixel (at
- the chroma plane's resolution) to the right.
- Then we use another filter to move the C_r location down one quarter pixel,
- and the C_b location up one quarter pixel.*/
-static void y4m_convert_42xpaldv_42xjpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- unsigned char *tmp;
- int c_w;
- int c_h;
- int c_sz;
- int pli;
- int y;
- int x;
- /*Skip past the luma data.*/
- _dst += _y4m->pic_w * _y4m->pic_h;
- /*Compute the size of each chroma plane.*/
- c_w = (_y4m->pic_w + 1) / 2;
- c_h = (_y4m->pic_h + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
- c_sz = c_w * c_h;
- tmp = _aux + 2 * c_sz;
- for (pli = 1; pli < 3; pli++) {
- /*First do the horizontal re-sampling.
- This is the same as the mpeg2 case, except that after the horizontal
- case, we need to apply a second vertical filter.*/
- y4m_42xmpeg2_42xjpeg_helper(tmp, _aux, c_w, c_h);
- _aux += c_sz;
- switch (pli) {
- case 1: {
- /*Slide C_b up a quarter-pel.
- This is the same filter used above, but in the other order.*/
- for (x = 0; x < c_w; x++) {
- for (y = 0; y < OC_MINI(c_h, 3); y++) {
- _dst[y * c_w] = (unsigned char)OC_CLAMPI(0, (tmp[0]
- - 9 * tmp[OC_MAXI(y - 2, 0) * c_w] + 35 * tmp[OC_MAXI(y - 1, 0) * c_w]
- + 114 * tmp[y * c_w] - 17 * tmp[OC_MINI(y + 1, c_h - 1) * c_w]
- + 4 * tmp[OC_MINI(y + 2, c_h - 1) * c_w] + 64) >> 7, 255);
- }
- for (; y < c_h - 2; y++) {
- _dst[y * c_w] = (unsigned char)OC_CLAMPI(0, (tmp[(y - 3) * c_w]
- - 9 * tmp[(y - 2) * c_w] + 35 * tmp[(y - 1) * c_w] + 114 * tmp[y * c_w]
- - 17 * tmp[(y + 1) * c_w] + 4 * tmp[(y + 2) * c_w] + 64) >> 7, 255);
- }
- for (; y < c_h; y++) {
- _dst[y * c_w] = (unsigned char)OC_CLAMPI(0, (tmp[(y - 3) * c_w]
- - 9 * tmp[(y - 2) * c_w] + 35 * tmp[(y - 1) * c_w] + 114 * tmp[y * c_w]
- - 17 * tmp[OC_MINI(y + 1, c_h - 1) * c_w] + 4 * tmp[(c_h - 1) * c_w] + 64) >> 7, 255);
- }
- _dst++;
- tmp++;
- }
- _dst += c_sz - c_w;
- tmp -= c_w;
- }
- break;
- case 2: {
- /*Slide C_r down a quarter-pel.
- This is the same as the horizontal filter.*/
- for (x = 0; x < c_w; x++) {
- for (y = 0; y < OC_MINI(c_h, 2); y++) {
- _dst[y * c_w] = (unsigned char)OC_CLAMPI(0, (4 * tmp[0]
- - 17 * tmp[OC_MAXI(y - 1, 0) * c_w] + 114 * tmp[y * c_w]
- + 35 * tmp[OC_MINI(y + 1, c_h - 1) * c_w] - 9 * tmp[OC_MINI(y + 2, c_h - 1) * c_w]
- + tmp[OC_MINI(y + 3, c_h - 1) * c_w] + 64) >> 7, 255);
- }
- for (; y < c_h - 3; y++) {
- _dst[y * c_w] = (unsigned char)OC_CLAMPI(0, (4 * tmp[(y - 2) * c_w]
- - 17 * tmp[(y - 1) * c_w] + 114 * tmp[y * c_w] + 35 * tmp[(y + 1) * c_w]
- - 9 * tmp[(y + 2) * c_w] + tmp[(y + 3) * c_w] + 64) >> 7, 255);
- }
- for (; y < c_h; y++) {
- _dst[y * c_w] = (unsigned char)OC_CLAMPI(0, (4 * tmp[(y - 2) * c_w]
- - 17 * tmp[(y - 1) * c_w] + 114 * tmp[y * c_w] + 35 * tmp[OC_MINI(y + 1, c_h - 1) * c_w]
- - 9 * tmp[OC_MINI(y + 2, c_h - 1) * c_w] + tmp[(c_h - 1) * c_w] + 64) >> 7, 255);
- }
- _dst++;
- tmp++;
- }
- }
- break;
- }
- /*For actual interlaced material, this would have to be done separately on
- each field, and the shift amounts would be different.
- C_r moves down 1/8, C_b up 3/8 in the top field, and C_r moves down 3/8,
- C_b up 1/8 in the bottom field.
- The corresponding filters would be:
- Down 1/8 (reverse order for up): [3 -11 125 15 -4 0]/128
- Down 3/8 (reverse order for up): [4 -19 98 56 -13 2]/128*/
- }
-}
-
-/*Perform vertical filtering to reduce a single plane from 4:2:2 to 4:2:0.
- This is used as a helper by several converation routines.*/
-static void y4m_422jpeg_420jpeg_helper(unsigned char *_dst,
- const unsigned char *_src, int _c_w, int _c_h) {
- int y;
- int x;
- /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/
- for (x = 0; x < _c_w; x++) {
- for (y = 0; y < OC_MINI(_c_h, 2); y += 2) {
- _dst[(y >> 1)*_c_w] = OC_CLAMPI(0, (64 * _src[0]
- + 78 * _src[OC_MINI(1, _c_h - 1) * _c_w]
- - 17 * _src[OC_MINI(2, _c_h - 1) * _c_w]
- + 3 * _src[OC_MINI(3, _c_h - 1) * _c_w] + 64) >> 7, 255);
- }
- for (; y < _c_h - 3; y += 2) {
- _dst[(y >> 1)*_c_w] = OC_CLAMPI(0, (3 * (_src[(y - 2) * _c_w] + _src[(y + 3) * _c_w])
- - 17 * (_src[(y - 1) * _c_w] + _src[(y + 2) * _c_w])
- + 78 * (_src[y * _c_w] + _src[(y + 1) * _c_w]) + 64) >> 7, 255);
- }
- for (; y < _c_h; y += 2) {
- _dst[(y >> 1)*_c_w] = OC_CLAMPI(0, (3 * (_src[(y - 2) * _c_w]
- + _src[(_c_h - 1) * _c_w]) - 17 * (_src[(y - 1) * _c_w]
- + _src[OC_MINI(y + 2, _c_h - 1) * _c_w])
- + 78 * (_src[y * _c_w] + _src[OC_MINI(y + 1, _c_h - 1) * _c_w]) + 64) >> 7, 255);
- }
- _src++;
- _dst++;
- }
-}
-
-/*420jpeg chroma samples are sited like:
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
-
- 422jpeg chroma samples are sited like:
- Y---BR--Y-------Y---BR--Y-------
- | | | |
- | | | |
- | | | |
- Y---BR--Y-------Y---BR--Y-------
- | | | |
- | | | |
- | | | |
- Y---BR--Y-------Y---BR--Y-------
- | | | |
- | | | |
- | | | |
- Y---BR--Y-------Y---BR--Y-------
- | | | |
- | | | |
- | | | |
-
- We use a resampling filter to decimate the chroma planes by two in the
- vertical direction.*/
-static void y4m_convert_422jpeg_420jpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- int c_w;
- int c_h;
- int c_sz;
- int dst_c_w;
- int dst_c_h;
- int dst_c_sz;
- int pli;
- /*Skip past the luma data.*/
- _dst += _y4m->pic_w * _y4m->pic_h;
- /*Compute the size of each chroma plane.*/
- c_w = (_y4m->pic_w + _y4m->src_c_dec_h - 1) / _y4m->src_c_dec_h;
- c_h = _y4m->pic_h;
- dst_c_w = (_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
- dst_c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
- c_sz = c_w * c_h;
- dst_c_sz = dst_c_w * dst_c_h;
- for (pli = 1; pli < 3; pli++) {
- y4m_422jpeg_420jpeg_helper(_dst, _aux, c_w, c_h);
- _aux += c_sz;
- _dst += dst_c_sz;
- }
-}
-
-/*420jpeg chroma samples are sited like:
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
-
- 422 chroma samples are sited like:
- YBR-----Y-------YBR-----Y-------
- | | | |
- | | | |
- | | | |
- YBR-----Y-------YBR-----Y-------
- | | | |
- | | | |
- | | | |
- YBR-----Y-------YBR-----Y-------
- | | | |
- | | | |
- | | | |
- YBR-----Y-------YBR-----Y-------
- | | | |
- | | | |
- | | | |
-
- We use a resampling filter to shift the original site locations one quarter
- pixel (at the original chroma resolution) to the right.
- Then we use a second resampling filter to decimate the chroma planes by two
- in the vertical direction.*/
-static void y4m_convert_422_420jpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- unsigned char *tmp;
- int c_w;
- int c_h;
- int c_sz;
- int dst_c_h;
- int dst_c_sz;
- int pli;
- /*Skip past the luma data.*/
- _dst += _y4m->pic_w * _y4m->pic_h;
- /*Compute the size of each chroma plane.*/
- c_w = (_y4m->pic_w + _y4m->src_c_dec_h - 1) / _y4m->src_c_dec_h;
- c_h = _y4m->pic_h;
- dst_c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
- c_sz = c_w * c_h;
- dst_c_sz = c_w * dst_c_h;
- tmp = _aux + 2 * c_sz;
- for (pli = 1; pli < 3; pli++) {
- /*In reality, the horizontal and vertical steps could be pipelined, for
- less memory consumption and better cache performance, but we do them
- separately for simplicity.*/
- /*First do horizontal filtering (convert to 422jpeg)*/
- y4m_42xmpeg2_42xjpeg_helper(tmp, _aux, c_w, c_h);
- /*Now do the vertical filtering.*/
- y4m_422jpeg_420jpeg_helper(_dst, tmp, c_w, c_h);
- _aux += c_sz;
- _dst += dst_c_sz;
- }
-}
-
-/*420jpeg chroma samples are sited like:
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | BR | | BR |
- | | | |
- Y-------Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
-
- 411 chroma samples are sited like:
- YBR-----Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- YBR-----Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- YBR-----Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
- YBR-----Y-------Y-------Y-------
- | | | |
- | | | |
- | | | |
-
- We use a filter to resample at site locations one eighth pixel (at the source
- chroma plane's horizontal resolution) and five eighths of a pixel to the
- right.
- Then we use another filter to decimate the planes by 2 in the vertical
- direction.*/
-static void y4m_convert_411_420jpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- unsigned char *tmp;
- int c_w;
- int c_h;
- int c_sz;
- int dst_c_w;
- int dst_c_h;
- int dst_c_sz;
- int tmp_sz;
- int pli;
- int y;
- int x;
- /*Skip past the luma data.*/
- _dst += _y4m->pic_w * _y4m->pic_h;
- /*Compute the size of each chroma plane.*/
- c_w = (_y4m->pic_w + _y4m->src_c_dec_h - 1) / _y4m->src_c_dec_h;
- c_h = _y4m->pic_h;
- dst_c_w = (_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
- dst_c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
- c_sz = c_w * c_h;
- dst_c_sz = dst_c_w * dst_c_h;
- tmp_sz = dst_c_w * c_h;
- tmp = _aux + 2 * c_sz;
- for (pli = 1; pli < 3; pli++) {
- /*In reality, the horizontal and vertical steps could be pipelined, for
- less memory consumption and better cache performance, but we do them
- separately for simplicity.*/
- /*First do horizontal filtering (convert to 422jpeg)*/
- for (y = 0; y < c_h; y++) {
- /*Filters: [1 110 18 -1]/128 and [-3 50 86 -5]/128, both derived from a
- 4-tap Mitchell window.*/
- for (x = 0; x < OC_MINI(c_w, 1); x++) {
- tmp[x << 1] = (unsigned char)OC_CLAMPI(0, (111 * _aux[0]
- + 18 * _aux[OC_MINI(1, c_w - 1)] - _aux[OC_MINI(2, c_w - 1)] + 64) >> 7, 255);
- tmp[x << 1 | 1] = (unsigned char)OC_CLAMPI(0, (47 * _aux[0]
- + 86 * _aux[OC_MINI(1, c_w - 1)] - 5 * _aux[OC_MINI(2, c_w - 1)] + 64) >> 7, 255);
- }
- for (; x < c_w - 2; x++) {
- tmp[x << 1] = (unsigned char)OC_CLAMPI(0, (_aux[x - 1] + 110 * _aux[x]
- + 18 * _aux[x + 1] - _aux[x + 2] + 64) >> 7, 255);
- tmp[x << 1 | 1] = (unsigned char)OC_CLAMPI(0, (-3 * _aux[x - 1] + 50 * _aux[x]
- + 86 * _aux[x + 1] - 5 * _aux[x + 2] + 64) >> 7, 255);
- }
- for (; x < c_w; x++) {
- tmp[x << 1] = (unsigned char)OC_CLAMPI(0, (_aux[x - 1] + 110 * _aux[x]
- + 18 * _aux[OC_MINI(x + 1, c_w - 1)] - _aux[c_w - 1] + 64) >> 7, 255);
- if ((x << 1 | 1) < dst_c_w) {
- tmp[x << 1 | 1] = (unsigned char)OC_CLAMPI(0, (-3 * _aux[x - 1] + 50 * _aux[x]
- + 86 * _aux[OC_MINI(x + 1, c_w - 1)] - 5 * _aux[c_w - 1] + 64) >> 7, 255);
- }
- }
- tmp += dst_c_w;
- _aux += c_w;
- }
- tmp -= tmp_sz;
- /*Now do the vertical filtering.*/
- y4m_422jpeg_420jpeg_helper(_dst, tmp, dst_c_w, c_h);
- _dst += dst_c_sz;
- }
-}
-
-/*Convert 444 to 420jpeg.*/
-static void y4m_convert_444_420jpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- unsigned char *tmp;
- int c_w;
- int c_h;
- int c_sz;
- int dst_c_w;
- int dst_c_h;
- int dst_c_sz;
- int tmp_sz;
- int pli;
- int y;
- int x;
- /*Skip past the luma data.*/
- _dst += _y4m->pic_w * _y4m->pic_h;
- /*Compute the size of each chroma plane.*/
- c_w = (_y4m->pic_w + _y4m->src_c_dec_h - 1) / _y4m->src_c_dec_h;
- c_h = _y4m->pic_h;
- dst_c_w = (_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
- dst_c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
- c_sz = c_w * c_h;
- dst_c_sz = dst_c_w * dst_c_h;
- tmp_sz = dst_c_w * c_h;
- tmp = _aux + 2 * c_sz;
- for (pli = 1; pli < 3; pli++) {
- /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/
- for (y = 0; y < c_h; y++) {
- for (x = 0; x < OC_MINI(c_w, 2); x += 2) {
- tmp[x >> 1] = OC_CLAMPI(0, (64 * _aux[0] + 78 * _aux[OC_MINI(1, c_w - 1)]
- - 17 * _aux[OC_MINI(2, c_w - 1)]
- + 3 * _aux[OC_MINI(3, c_w - 1)] + 64) >> 7, 255);
- }
- for (; x < c_w - 3; x += 2) {
- tmp[x >> 1] = OC_CLAMPI(0, (3 * (_aux[x - 2] + _aux[x + 3])
- - 17 * (_aux[x - 1] + _aux[x + 2]) + 78 * (_aux[x] + _aux[x + 1]) + 64) >> 7, 255);
- }
- for (; x < c_w; x += 2) {
- tmp[x >> 1] = OC_CLAMPI(0, (3 * (_aux[x - 2] + _aux[c_w - 1]) -
- 17 * (_aux[x - 1] + _aux[OC_MINI(x + 2, c_w - 1)]) +
- 78 * (_aux[x] + _aux[OC_MINI(x + 1, c_w - 1)]) + 64) >> 7, 255);
- }
- tmp += dst_c_w;
- _aux += c_w;
- }
- tmp -= tmp_sz;
- /*Now do the vertical filtering.*/
- y4m_422jpeg_420jpeg_helper(_dst, tmp, dst_c_w, c_h);
- _dst += dst_c_sz;
- }
-}
-
-/*The image is padded with empty chroma components at 4:2:0.*/
-static void y4m_convert_mono_420jpeg(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
- int c_sz;
- _dst += _y4m->pic_w * _y4m->pic_h;
- c_sz = ((_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h) *
- ((_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v);
- memset(_dst, 128, c_sz * 2);
-}
-
-/*No conversion function needed.*/
-static void y4m_convert_null(y4m_input *_y4m, unsigned char *_dst,
- unsigned char *_aux) {
-}
-
-int y4m_input_open(y4m_input *_y4m, FILE *_fin, char *_skip, int _nskip,
- int only_420) {
- char buffer[80];
- int ret;
- int i;
- /*Read until newline, or 80 cols, whichever happens first.*/
- for (i = 0; i < 79; i++) {
- if (_nskip > 0) {
- buffer[i] = *_skip++;
- _nskip--;
- } else {
- if (!file_read(buffer + i, 1, _fin)) return -1;
- }
- if (buffer[i] == '\n')break;
- }
- /*We skipped too much header data.*/
- if (_nskip > 0)return -1;
- if (i == 79) {
- fprintf(stderr, "Error parsing header; not a YUV2MPEG2 file?\n");
- return -1;
- }
- buffer[i] = '\0';
- if (memcmp(buffer, "YUV4MPEG", 8)) {
- fprintf(stderr, "Incomplete magic for YUV4MPEG file.\n");
- return -1;
- }
- if (buffer[8] != '2') {
- fprintf(stderr, "Incorrect YUV input file version; YUV4MPEG2 required.\n");
- }
- ret = y4m_parse_tags(_y4m, buffer + 5);
- if (ret < 0) {
- fprintf(stderr, "Error parsing YUV4MPEG2 header.\n");
- return ret;
- }
- if (_y4m->interlace == '?') {
- fprintf(stderr, "Warning: Input video interlacing format unknown; "
- "assuming progressive scan.\n");
- } else if (_y4m->interlace != 'p') {
- fprintf(stderr, "Input video is interlaced; "
- "Only progressive scan handled.\n");
- return -1;
- }
- _y4m->vpx_fmt = VPX_IMG_FMT_I420;
- _y4m->vpx_bps = 12;
- if (strcmp(_y4m->chroma_type, "420") == 0 ||
- strcmp(_y4m->chroma_type, "420jpeg") == 0) {
- _y4m->src_c_dec_h = _y4m->dst_c_dec_h = _y4m->src_c_dec_v = _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h
- + 2 * ((_y4m->pic_w + 1) / 2) * ((_y4m->pic_h + 1) / 2);
- /*Natively supported: no conversion required.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 0;
- _y4m->convert = y4m_convert_null;
- } else if (strcmp(_y4m->chroma_type, "420mpeg2") == 0) {
- _y4m->src_c_dec_h = _y4m->dst_c_dec_h = _y4m->src_c_dec_v = _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*Chroma filter required: read into the aux buf first.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz =
- 2 * ((_y4m->pic_w + 1) / 2) * ((_y4m->pic_h + 1) / 2);
- _y4m->convert = y4m_convert_42xmpeg2_42xjpeg;
- } else if (strcmp(_y4m->chroma_type, "420paldv") == 0) {
- _y4m->src_c_dec_h = _y4m->dst_c_dec_h = _y4m->src_c_dec_v = _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*Chroma filter required: read into the aux buf first.
- We need to make two filter passes, so we need some extra space in the
- aux buffer.*/
- _y4m->aux_buf_sz = 3 * ((_y4m->pic_w + 1) / 2) * ((_y4m->pic_h + 1) / 2);
- _y4m->aux_buf_read_sz = 2 * ((_y4m->pic_w + 1) / 2) * ((_y4m->pic_h + 1) / 2);
- _y4m->convert = y4m_convert_42xpaldv_42xjpeg;
- } else if (strcmp(_y4m->chroma_type, "422jpeg") == 0) {
- _y4m->src_c_dec_h = _y4m->dst_c_dec_h = 2;
- _y4m->src_c_dec_v = 1;
- _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*Chroma filter required: read into the aux buf first.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 2 * ((_y4m->pic_w + 1) / 2) * _y4m->pic_h;
- _y4m->convert = y4m_convert_422jpeg_420jpeg;
- } else if (strcmp(_y4m->chroma_type, "422") == 0) {
- _y4m->src_c_dec_h = 2;
- _y4m->src_c_dec_v = 1;
- if (only_420) {
- _y4m->dst_c_dec_h = 2;
- _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*Chroma filter required: read into the aux buf first.
- We need to make two filter passes, so we need some extra space in the
- aux buffer.*/
- _y4m->aux_buf_read_sz = 2 * ((_y4m->pic_w + 1) / 2) * _y4m->pic_h;
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz +
- ((_y4m->pic_w + 1) / 2) * _y4m->pic_h;
- _y4m->convert = y4m_convert_422_420jpeg;
- } else {
- _y4m->vpx_fmt = VPX_IMG_FMT_I422;
- _y4m->vpx_bps = 16;
- _y4m->dst_c_dec_h = _y4m->src_c_dec_h;
- _y4m->dst_c_dec_v = _y4m->src_c_dec_v;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h
- + 2 * ((_y4m->pic_w + 1) / 2) * _y4m->pic_h;
- /*Natively supported: no conversion required.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 0;
- _y4m->convert = y4m_convert_null;
- }
- } else if (strcmp(_y4m->chroma_type, "411") == 0) {
- _y4m->src_c_dec_h = 4;
- _y4m->dst_c_dec_h = 2;
- _y4m->src_c_dec_v = 1;
- _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*Chroma filter required: read into the aux buf first.
- We need to make two filter passes, so we need some extra space in the
- aux buffer.*/
- _y4m->aux_buf_read_sz = 2 * ((_y4m->pic_w + 3) / 4) * _y4m->pic_h;
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz + ((_y4m->pic_w + 1) / 2) * _y4m->pic_h;
- _y4m->convert = y4m_convert_411_420jpeg;
- } else if (strcmp(_y4m->chroma_type, "444") == 0) {
- _y4m->src_c_dec_h = 1;
- _y4m->src_c_dec_v = 1;
- if (only_420) {
- _y4m->dst_c_dec_h = 2;
- _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*Chroma filter required: read into the aux buf first.
- We need to make two filter passes, so we need some extra space in the
- aux buffer.*/
- _y4m->aux_buf_read_sz = 2 * _y4m->pic_w * _y4m->pic_h;
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz +
- ((_y4m->pic_w + 1) / 2) * _y4m->pic_h;
- _y4m->convert = y4m_convert_444_420jpeg;
- } else {
- _y4m->vpx_fmt = VPX_IMG_FMT_I444;
- _y4m->vpx_bps = 24;
- _y4m->dst_c_dec_h = _y4m->src_c_dec_h;
- _y4m->dst_c_dec_v = _y4m->src_c_dec_v;
- _y4m->dst_buf_read_sz = 3 * _y4m->pic_w * _y4m->pic_h;
- /*Natively supported: no conversion required.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 0;
- _y4m->convert = y4m_convert_null;
- }
- } else if (strcmp(_y4m->chroma_type, "444alpha") == 0) {
- _y4m->src_c_dec_h = 1;
- _y4m->src_c_dec_v = 1;
- if (only_420) {
- _y4m->dst_c_dec_h = 2;
- _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*Chroma filter required: read into the aux buf first.
- We need to make two filter passes, so we need some extra space in the
- aux buffer.
- The extra plane also gets read into the aux buf.
- It will be discarded.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 3 * _y4m->pic_w * _y4m->pic_h;
- _y4m->convert = y4m_convert_444_420jpeg;
- } else {
- _y4m->vpx_fmt = VPX_IMG_FMT_444A;
- _y4m->vpx_bps = 32;
- _y4m->dst_c_dec_h = _y4m->src_c_dec_h;
- _y4m->dst_c_dec_v = _y4m->src_c_dec_v;
- _y4m->dst_buf_read_sz = 4 * _y4m->pic_w * _y4m->pic_h;
- /*Natively supported: no conversion required.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 0;
- _y4m->convert = y4m_convert_null;
- }
- } else if (strcmp(_y4m->chroma_type, "mono") == 0) {
- _y4m->src_c_dec_h = _y4m->src_c_dec_v = 0;
- _y4m->dst_c_dec_h = _y4m->dst_c_dec_v = 2;
- _y4m->dst_buf_read_sz = _y4m->pic_w * _y4m->pic_h;
- /*No extra space required, but we need to clear the chroma planes.*/
- _y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 0;
- _y4m->convert = y4m_convert_mono_420jpeg;
- } else {
- fprintf(stderr, "Unknown chroma sampling type: %s\n", _y4m->chroma_type);
- return -1;
- }
- /*The size of the final frame buffers is always computed from the
- destination chroma decimation type.*/
- _y4m->dst_buf_sz = _y4m->pic_w * _y4m->pic_h
- + 2 * ((_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h) *
- ((_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v);
- _y4m->dst_buf = (unsigned char *)malloc(_y4m->dst_buf_sz);
- _y4m->aux_buf = (unsigned char *)malloc(_y4m->aux_buf_sz);
- return 0;
-}
-
-void y4m_input_close(y4m_input *_y4m) {
- free(_y4m->dst_buf);
- free(_y4m->aux_buf);
-}
-
-int y4m_input_fetch_frame(y4m_input *_y4m, FILE *_fin, vpx_image_t *_img) {
- char frame[6];
- int pic_sz;
- int c_w;
- int c_h;
- int c_sz;
- /*Read and skip the frame header.*/
- if (!file_read(frame, 6, _fin)) return 0;
- if (memcmp(frame, "FRAME", 5)) {
- fprintf(stderr, "Loss of framing in Y4M input data\n");
- return -1;
- }
- if (frame[5] != '\n') {
- char c;
- int j;
- for (j = 0; j < 79 && file_read(&c, 1, _fin) && c != '\n'; j++) {}
- if (j == 79) {
- fprintf(stderr, "Error parsing Y4M frame header\n");
- return -1;
- }
- }
- /*Read the frame data that needs no conversion.*/
- if (!file_read(_y4m->dst_buf, _y4m->dst_buf_read_sz, _fin)) {
- fprintf(stderr, "Error reading Y4M frame data.\n");
- return -1;
- }
- /*Read the frame data that does need conversion.*/
- if (!file_read(_y4m->aux_buf, _y4m->aux_buf_read_sz, _fin)) {
- fprintf(stderr, "Error reading Y4M frame data.\n");
- return -1;
- }
- /*Now convert the just read frame.*/
- (*_y4m->convert)(_y4m, _y4m->dst_buf, _y4m->aux_buf);
- /*Fill in the frame buffer pointers.
- We don't use vpx_img_wrap() because it forces padding for odd picture
- sizes, which would require a separate fread call for every row.*/
- memset(_img, 0, sizeof(*_img));
- /*Y4M has the planes in Y'CbCr order, which libvpx calls Y, U, and V.*/
- _img->fmt = _y4m->vpx_fmt;
- _img->w = _img->d_w = _y4m->pic_w;
- _img->h = _img->d_h = _y4m->pic_h;
- _img->x_chroma_shift = _y4m->dst_c_dec_h >> 1;
- _img->y_chroma_shift = _y4m->dst_c_dec_v >> 1;
- _img->bps = _y4m->vpx_bps;
-
- /*Set up the buffer pointers.*/
- pic_sz = _y4m->pic_w * _y4m->pic_h;
- c_w = (_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
- c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
- c_sz = c_w * c_h;
- _img->stride[PLANE_Y] = _img->stride[PLANE_ALPHA] = _y4m->pic_w;
- _img->stride[PLANE_U] = _img->stride[PLANE_V] = c_w;
- _img->planes[PLANE_Y] = _y4m->dst_buf;
- _img->planes[PLANE_U] = _y4m->dst_buf + pic_sz;
- _img->planes[PLANE_V] = _y4m->dst_buf + pic_sz + c_sz;
- _img->planes[PLANE_ALPHA] = _y4m->dst_buf + pic_sz + 2 * c_sz;
- return 1;
-}
diff --git a/videocodec/libvpx_internal/libvpx/y4minput.h b/videocodec/libvpx_internal/libvpx/y4minput.h
deleted file mode 100644
index d53eb65..0000000
--- a/videocodec/libvpx_internal/libvpx/y4minput.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- *
- * Based on code from the OggTheora software codec source code,
- * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors.
- */
-
-#ifndef Y4MINPUT_H_
-#define Y4MINPUT_H_
-
-# include <stdio.h>
-# include "vpx/vpx_image.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-typedef struct y4m_input y4m_input;
-
-
-
-/*The function used to perform chroma conversion.*/
-typedef void (*y4m_convert_func)(y4m_input *_y4m,
- unsigned char *_dst, unsigned char *_src);
-
-
-
-struct y4m_input {
- int pic_w;
- int pic_h;
- int fps_n;
- int fps_d;
- int par_n;
- int par_d;
- char interlace;
- int src_c_dec_h;
- int src_c_dec_v;
- int dst_c_dec_h;
- int dst_c_dec_v;
- char chroma_type[16];
- /*The size of each converted frame buffer.*/
- size_t dst_buf_sz;
- /*The amount to read directly into the converted frame buffer.*/
- size_t dst_buf_read_sz;
- /*The size of the auxilliary buffer.*/
- size_t aux_buf_sz;
- /*The amount to read into the auxilliary buffer.*/
- size_t aux_buf_read_sz;
- y4m_convert_func convert;
- unsigned char *dst_buf;
- unsigned char *aux_buf;
- enum vpx_img_fmt vpx_fmt;
- int vpx_bps;
-};
-
-int y4m_input_open(y4m_input *_y4m, FILE *_fin, char *_skip, int _nskip,
- int only_420);
-void y4m_input_close(y4m_input *_y4m);
-int y4m_input_fetch_frame(y4m_input *_y4m, FILE *_fin, vpx_image_t *img);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // Y4MINPUT_H_
diff --git a/videocodec/libvpx_internal/libwebm.mk b/videocodec/libvpx_internal/libwebm.mk
deleted file mode 100644
index 0528cfb..0000000
--- a/videocodec/libvpx_internal/libwebm.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-# libwebm
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := libwebm/mkvparser.cpp
-
-LOCAL_MODULE := libwebm
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/videocodec/libvpx_internal/libwebm/mkvparser.cpp b/videocodec/libvpx_internal/libwebm/mkvparser.cpp
deleted file mode 100644
index 7150023..0000000
--- a/videocodec/libvpx_internal/libwebm/mkvparser.cpp
+++ /dev/null
@@ -1,8626 +0,0 @@
-// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#include "mkvparser.hpp"
-#include <cassert>
-#include <cstring>
-#include <new>
-#include <climits>
-
-mkvparser::IMkvReader::~IMkvReader()
-{
-}
-
-void mkvparser::GetVersion(int& major, int& minor, int& build, int& revision)
-{
- major = 1;
- minor = 0;
- build = 0;
- revision = 24;
-}
-
-long long mkvparser::ReadUInt(IMkvReader* pReader, long long pos, long& len)
-{
- assert(pReader);
- assert(pos >= 0);
-
- int status;
-
-//#ifdef _DEBUG
-// long long total, available;
-// status = pReader->Length(&total, &available);
-// assert(status >= 0);
-// assert((total < 0) || (available <= total));
-// assert(pos < available);
-// assert((available - pos) >= 1); //assume here max u-int len is 8
-//#endif
-
- len = 1;
-
- unsigned char b;
-
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0) //error or underflow
- return status;
-
- if (status > 0) //interpreted as "underflow"
- return E_BUFFER_NOT_FULL;
-
- if (b == 0) //we can't handle u-int values larger than 8 bytes
- return E_FILE_FORMAT_INVALID;
-
- unsigned char m = 0x80;
-
- while (!(b & m))
- {
- m >>= 1;
- ++len;
- }
-
-//#ifdef _DEBUG
-// assert((available - pos) >= len);
-//#endif
-
- long long result = b & (~m);
- ++pos;
-
- for (int i = 1; i < len; ++i)
- {
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- {
- len = 1;
- return status;
- }
-
- if (status > 0)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result <<= 8;
- result |= b;
-
- ++pos;
- }
-
- return result;
-}
-
-long long mkvparser::GetUIntLength(
- IMkvReader* pReader,
- long long pos,
- long& len)
-{
- assert(pReader);
- assert(pos >= 0);
-
- long long total, available;
-
- int status = pReader->Length(&total, &available);
- assert(status >= 0);
- assert((total < 0) || (available <= total));
-
- len = 1;
-
- if (pos >= available)
- return pos; //too few bytes available
-
- unsigned char b;
-
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- return status;
-
- assert(status == 0);
-
- if (b == 0) //we can't handle u-int values larger than 8 bytes
- return E_FILE_FORMAT_INVALID;
-
- unsigned char m = 0x80;
-
- while (!(b & m))
- {
- m >>= 1;
- ++len;
- }
-
- return 0; //success
-}
-
-
-long long mkvparser::UnserializeUInt(
- IMkvReader* pReader,
- long long pos,
- long long size)
-{
- assert(pReader);
- assert(pos >= 0);
-
- if ((size <= 0) || (size > 8))
- return E_FILE_FORMAT_INVALID;
-
- long long result = 0;
-
- for (long long i = 0; i < size; ++i)
- {
- unsigned char b;
-
- const long status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- return status;
-
- result <<= 8;
- result |= b;
-
- ++pos;
- }
-
- return result;
-}
-
-
-long mkvparser::UnserializeFloat(
- IMkvReader* pReader,
- long long pos,
- long long size_,
- double& result)
-{
- assert(pReader);
- assert(pos >= 0);
-
- if ((size_ != 4) && (size_ != 8))
- return E_FILE_FORMAT_INVALID;
-
- const long size = static_cast<long>(size_);
-
- unsigned char buf[8];
-
- const int status = pReader->Read(pos, size, buf);
-
- if (status < 0) //error
- return status;
-
- if (size == 4)
- {
- union
- {
- float f;
- unsigned long ff;
- };
-
- ff = 0;
-
- for (int i = 0;;)
- {
- ff |= buf[i];
-
- if (++i >= 4)
- break;
-
- ff <<= 8;
- }
-
- result = f;
- }
- else
- {
- assert(size == 8);
-
- union
- {
- double d;
- unsigned long long dd;
- };
-
- dd = 0;
-
- for (int i = 0;;)
- {
- dd |= buf[i];
-
- if (++i >= 8)
- break;
-
- dd <<= 8;
- }
-
- result = d;
- }
-
- return 0;
-}
-
-
-long mkvparser::UnserializeInt(
- IMkvReader* pReader,
- long long pos,
- long size,
- long long& result)
-{
- assert(pReader);
- assert(pos >= 0);
- assert(size > 0);
- assert(size <= 8);
-
- {
- signed char b;
-
- const long status = pReader->Read(pos, 1, (unsigned char*)&b);
-
- if (status < 0)
- return status;
-
- result = b;
-
- ++pos;
- }
-
- for (long i = 1; i < size; ++i)
- {
- unsigned char b;
-
- const long status = pReader->Read(pos, 1, &b);
-
- if (status < 0)
- return status;
-
- result <<= 8;
- result |= b;
-
- ++pos;
- }
-
- return 0; //success
-}
-
-
-long mkvparser::UnserializeString(
- IMkvReader* pReader,
- long long pos,
- long long size_,
- char*& str)
-{
- delete[] str;
- str = NULL;
-
- if (size_ >= LONG_MAX) //we need (size+1) chars
- return E_FILE_FORMAT_INVALID;
-
- const long size = static_cast<long>(size_);
-
- str = new (std::nothrow) char[size+1];
-
- if (str == NULL)
- return -1;
-
- unsigned char* const buf = reinterpret_cast<unsigned char*>(str);
-
- const long status = pReader->Read(pos, size, buf);
-
- if (status)
- {
- delete[] str;
- str = NULL;
-
- return status;
- }
-
- str[size] = '\0';
-
- return 0; //success
-}
-
-
-long mkvparser::ParseElementHeader(
- IMkvReader* pReader,
- long long& pos,
- long long stop,
- long long& id,
- long long& size)
-{
- if ((stop >= 0) && (pos >= stop))
- return E_FILE_FORMAT_INVALID;
-
- long len;
-
- id = ReadUInt(pReader, pos, len);
-
- if (id <= 0)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume id
-
- if ((stop >= 0) && (pos >= stop))
- return E_FILE_FORMAT_INVALID;
-
- size = ReadUInt(pReader, pos, len);
-
- if (size < 0)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume length of size
-
- //pos now designates payload
-
- if ((stop >= 0) && ((pos + size) > stop))
- return E_FILE_FORMAT_INVALID;
-
- return 0; //success
-}
-
-
-bool mkvparser::Match(
- IMkvReader* pReader,
- long long& pos,
- unsigned long id_,
- long long& val)
-{
- assert(pReader);
- assert(pos >= 0);
-
- long long total, available;
-
- const long status = pReader->Length(&total, &available);
- assert(status >= 0);
- assert((total < 0) || (available <= total));
-
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- if ((unsigned long)id != id_)
- return false;
-
- pos += len; //consume id
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert(size <= 8);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- pos += len; //consume length of size of payload
-
- val = UnserializeUInt(pReader, pos, size);
- assert(val >= 0);
-
- pos += size; //consume size of payload
-
- return true;
-}
-
-bool mkvparser::Match(
- IMkvReader* pReader,
- long long& pos,
- unsigned long id_,
- unsigned char*& buf,
- size_t& buflen)
-{
- assert(pReader);
- assert(pos >= 0);
-
- long long total, available;
-
- long status = pReader->Length(&total, &available);
- assert(status >= 0);
- assert((total < 0) || (available <= total));
-
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- if ((unsigned long)id != id_)
- return false;
-
- pos += len; //consume id
-
- const long long size_ = ReadUInt(pReader, pos, len);
- assert(size_ >= 0);
- assert(len > 0);
- assert(len <= 8);
- assert((pos + len) <= available);
-
- pos += len; //consume length of size of payload
- assert((pos + size_) <= available);
-
- const long buflen_ = static_cast<long>(size_);
-
- buf = new (std::nothrow) unsigned char[buflen_];
- assert(buf); //TODO
-
- status = pReader->Read(pos, buflen_, buf);
- assert(status == 0); //TODO
-
- buflen = buflen_;
-
- pos += size_; //consume size of payload
- return true;
-}
-
-
-namespace mkvparser
-{
-
-EBMLHeader::EBMLHeader() :
- m_docType(NULL)
-{
- Init();
-}
-
-EBMLHeader::~EBMLHeader()
-{
- delete[] m_docType;
-}
-
-void EBMLHeader::Init()
-{
- m_version = 1;
- m_readVersion = 1;
- m_maxIdLength = 4;
- m_maxSizeLength = 8;
-
- if (m_docType)
- {
- delete[] m_docType;
- m_docType = NULL;
- }
-
- m_docTypeVersion = 1;
- m_docTypeReadVersion = 1;
-}
-
-long long EBMLHeader::Parse(
- IMkvReader* pReader,
- long long& pos)
-{
- assert(pReader);
-
- long long total, available;
-
- long status = pReader->Length(&total, &available);
-
- if (status < 0) //error
- return status;
-
- pos = 0;
- long long end = (available >= 1024) ? 1024 : available;
-
- for (;;)
- {
- unsigned char b = 0;
-
- while (pos < end)
- {
- status = pReader->Read(pos, 1, &b);
-
- if (status < 0) //error
- return status;
-
- if (b == 0x1A)
- break;
-
- ++pos;
- }
-
- if (b != 0x1A)
- {
- if (pos >= 1024)
- return E_FILE_FORMAT_INVALID; //don't bother looking anymore
-
- if ((total >= 0) && ((total - available) < 5))
- return E_FILE_FORMAT_INVALID;
-
- return available + 5; //5 = 4-byte ID + 1st byte of size
- }
-
- if ((total >= 0) && ((total - pos) < 5))
- return E_FILE_FORMAT_INVALID;
-
- if ((available - pos) < 5)
- return pos + 5; //try again later
-
- long len;
-
- const long long result = ReadUInt(pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result == 0x0A45DFA3) //EBML Header ID
- {
- pos += len; //consume ID
- break;
- }
-
- ++pos; //throw away just the 0x1A byte, and try again
- }
-
- //pos designates start of size field
-
- //get length of size field
-
- long len;
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result > 0) //need more data
- return result;
-
- assert(len > 0);
- assert(len <= 8);
-
- if ((total >= 0) && ((total - pos) < len))
- return E_FILE_FORMAT_INVALID;
-
- if ((available - pos) < len)
- return pos + len; //try again later
-
- //get the EBML header size
-
- result = ReadUInt(pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- pos += len; //consume size field
-
- //pos now designates start of payload
-
- if ((total >= 0) && ((total - pos) < result))
- return E_FILE_FORMAT_INVALID;
-
- if ((available - pos) < result)
- return pos + result;
-
- end = pos + result;
-
- Init();
-
- while (pos < end)
- {
- long long id, size;
-
- status = ParseElementHeader(
- pReader,
- pos,
- end,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (size == 0) //weird
- return E_FILE_FORMAT_INVALID;
-
- if (id == 0x0286) //version
- {
- m_version = UnserializeUInt(pReader, pos, size);
-
- if (m_version <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x02F7) //read version
- {
- m_readVersion = UnserializeUInt(pReader, pos, size);
-
- if (m_readVersion <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x02F2) //max id length
- {
- m_maxIdLength = UnserializeUInt(pReader, pos, size);
-
- if (m_maxIdLength <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x02F3) //max size length
- {
- m_maxSizeLength = UnserializeUInt(pReader, pos, size);
-
- if (m_maxSizeLength <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0282) //doctype
- {
- if (m_docType)
- return E_FILE_FORMAT_INVALID;
-
- status = UnserializeString(pReader, pos, size, m_docType);
-
- if (status) //error
- return status;
- }
- else if (id == 0x0287) //doctype version
- {
- m_docTypeVersion = UnserializeUInt(pReader, pos, size);
-
- if (m_docTypeVersion <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0285) //doctype read version
- {
- m_docTypeReadVersion = UnserializeUInt(pReader, pos, size);
-
- if (m_docTypeReadVersion <= 0)
- return E_FILE_FORMAT_INVALID;
- }
-
- pos += size;
- }
-
- assert(pos == end);
- return 0;
-}
-
-
-Segment::Segment(
- IMkvReader* pReader,
- long long elem_start,
- //long long elem_size,
- long long start,
- long long size) :
- m_pReader(pReader),
- m_element_start(elem_start),
- //m_element_size(elem_size),
- m_start(start),
- m_size(size),
- m_pos(start),
- m_pUnknownSize(0),
- m_pSeekHead(NULL),
- m_pInfo(NULL),
- m_pTracks(NULL),
- m_pCues(NULL),
- m_clusters(NULL),
- m_clusterCount(0),
- m_clusterPreloadCount(0),
- m_clusterSize(0)
-{
-}
-
-
-Segment::~Segment()
-{
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- Cluster** i = m_clusters;
- Cluster** j = m_clusters + count;
-
- while (i != j)
- {
- Cluster* const p = *i++;
- assert(p);
-
- delete p;
- }
-
- delete[] m_clusters;
-
- delete m_pTracks;
- delete m_pInfo;
- delete m_pCues;
- delete m_pSeekHead;
-}
-
-
-long long Segment::CreateInstance(
- IMkvReader* pReader,
- long long pos,
- Segment*& pSegment)
-{
- assert(pReader);
- assert(pos >= 0);
-
- pSegment = NULL;
-
- long long total, available;
-
- const long status = pReader->Length(&total, &available);
-
- if (status < 0) //error
- return status;
-
- if (available < 0)
- return -1;
-
- if ((total >= 0) && (available > total))
- return -1;
-
- const long long end = (total >= 0) ? total : available;
- //TODO: this might need to be liberalized
-
- //I would assume that in practice this loop would execute
- //exactly once, but we allow for other elements (e.g. Void)
- //to immediately follow the EBML header. This is fine for
- //the source filter case (since the entire file is available),
- //but in the splitter case over a network we should probably
- //just give up early. We could for example decide only to
- //execute this loop a maximum of, say, 10 times.
- //TODO:
- //There is an implied "give up early" by only parsing up
- //to the available limit. We do do that, but only if the
- //total file size is unknown. We could decide to always
- //use what's available as our limit (irrespective of whether
- //we happen to know the total file length). This would have
- //as its sense "parse this much of the file before giving up",
- //which a slightly different sense from "try to parse up to
- //10 EMBL elements before giving up".
-
- while (pos < end)
- {
- //Read ID
-
- long len;
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result) //error, or too few available bytes
- return result;
-
- if ((pos + len) > end)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- const long long idpos = pos;
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return id;
-
- pos += len; //consume ID
-
- //Read Size
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result) //error, or too few available bytes
- return result;
-
- if ((pos + len) > end)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return size;
-
- pos += len; //consume length of size of element
-
- //Pos now points to start of payload
-
- //Handle "unknown size" for live streaming of webm files.
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (id == 0x08538067) //Segment ID
- {
- if (size == unknown_size)
- size = -1;
-
- else if (total < 0)
- size = -1;
-
- else if ((pos + size) > total)
- size = -1;
-
- pSegment = new (std::nothrow) Segment(
- pReader,
- idpos,
- //elem_size
- pos,
- size);
-
- if (pSegment == 0)
- return -1; //generic error
-
- return 0; //success
- }
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + size) > end)
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload
- }
-
- return E_FILE_FORMAT_INVALID; //there is no segment
- //TODO: this might need to be liberalized. See comments above.
-}
-
-
-long long Segment::ParseHeaders()
-{
- //Outermost (level 0) segment object has been constructed,
- //and pos designates start of payload. We need to find the
- //inner (level 1) elements.
- long long total, available;
-
- const int status = m_pReader->Length(&total, &available);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (available <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
- assert((segment_stop < 0) || (total < 0) || (segment_stop <= total));
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- for (;;)
- {
- if ((total >= 0) && (m_pos >= total))
- break;
-
- if ((segment_stop >= 0) && (m_pos >= segment_stop))
- break;
-
- long long pos = m_pos;
- const long long element_start = pos;
-
- if ((pos + 1) > available)
- return (pos + 1);
-
- long len;
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result > 0) //underflow (weird)
- return (pos + 1);
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error
- return id;
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- pos += len; //consume ID
-
- if ((pos + 1) > available)
- return (pos + 1);
-
- //Read Size
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return result;
-
- if (result > 0) //underflow (weird)
- return (pos + 1);
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > available)
- return pos + len;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return size;
-
- pos += len; //consume length of size of element
-
- const long long element_size = size + pos - element_start;
-
- //Pos now points to start of payload
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- //We read EBML elements either in total or nothing at all.
-
- if ((pos + size) > available)
- return pos + size;
-
- if (id == 0x0549A966) //Segment Info ID
- {
- if (m_pInfo)
- return E_FILE_FORMAT_INVALID;
-
- m_pInfo = new (std::nothrow) SegmentInfo(
- this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pInfo == NULL)
- return -1;
-
- const long status = m_pInfo->Parse();
-
- if (status)
- return status;
- }
- else if (id == 0x0654AE6B) //Tracks ID
- {
- if (m_pTracks)
- return E_FILE_FORMAT_INVALID;
-
- m_pTracks = new (std::nothrow) Tracks(this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pTracks == NULL)
- return -1;
-
- const long status = m_pTracks->Parse();
-
- if (status)
- return status;
- }
- else if (id == 0x0C53BB6B) //Cues ID
- {
- if (m_pCues == NULL)
- {
- m_pCues = new (std::nothrow) Cues(
- this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pCues == NULL)
- return -1;
- }
- }
- else if (id == 0x014D9B74) //SeekHead ID
- {
- if (m_pSeekHead == NULL)
- {
- m_pSeekHead = new (std::nothrow) SeekHead(
- this,
- pos,
- size,
- element_start,
- element_size);
-
- if (m_pSeekHead == NULL)
- return -1;
-
- const long status = m_pSeekHead->Parse();
-
- if (status)
- return status;
- }
- }
-
- m_pos = pos + size; //consume payload
- }
-
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- if (m_pInfo == NULL) //TODO: liberalize this behavior
- return E_FILE_FORMAT_INVALID;
-
- if (m_pTracks == NULL)
- return E_FILE_FORMAT_INVALID;
-
- return 0; //success
-}
-
-
-long Segment::LoadCluster(
- long long& pos,
- long& len)
-{
- for (;;)
- {
- const long result = DoLoadCluster(pos, len);
-
- if (result <= 1)
- return result;
- }
-}
-
-
-long Segment::DoLoadCluster(
- long long& pos,
- long& len)
-{
- if (m_pos < 0)
- return DoLoadClusterUnknownSize(pos, len);
-
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- long long cluster_off = -1; //offset relative to start of segment
- long long cluster_size = -1; //size of cluster payload
-
- for (;;)
- {
- if ((total >= 0) && (m_pos >= total))
- return 1; //no more clusters
-
- if ((segment_stop >= 0) && (m_pos >= segment_stop))
- return 1; //no more clusters
-
- pos = m_pos;
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- pos += len; //consume ID
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume length of size of element
-
- //pos now points to start of payload
-
- if (size == 0) //weird
- {
- m_pos = pos;
- continue;
- }
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
-#if 0 //we must handle this to support live webm
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //TODO: allow this
-#endif
-
- if ((segment_stop >= 0) &&
- (size != unknown_size) &&
- ((pos + size) > segment_stop))
- {
- return E_FILE_FORMAT_INVALID;
- }
-
-#if 0 //commented-out, to support incremental cluster parsing
- len = static_cast<long>(size);
-
- if ((pos + size) > avail)
- return E_BUFFER_NOT_FULL;
-#endif
-
- if (id == 0x0C53BB6B) //Cues ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //TODO: liberalize
-
- if (m_pCues == NULL)
- {
- const long long element_size = (pos - idpos) + size;
-
- m_pCues = new Cues(this,
- pos,
- size,
- idpos,
- element_size);
- assert(m_pCues); //TODO
- }
-
- m_pos = pos + size; //consume payload
- continue;
- }
-
- if (id != 0x0F43B675) //Cluster ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //TODO: liberalize
-
- m_pos = pos + size; //consume payload
- continue;
- }
-
- //We have a cluster.
-
- cluster_off = idpos - m_start; //relative pos
-
- if (size != unknown_size)
- cluster_size = size;
-
- break;
- }
-
- assert(cluster_off >= 0); //have cluster
-
- long long pos_;
- long len_;
-
- status = Cluster::HasBlockEntries(this, cluster_off, pos_, len_);
-
- if (status < 0) //error, or underflow
- {
- pos = pos_;
- len = len_;
-
- return status;
- }
-
- //status == 0 means "no block entries found"
- //status > 0 means "found at least one block entry"
-
- //TODO:
- //The issue here is that the segment increments its own
- //pos ptr past the most recent cluster parsed, and then
- //starts from there to parse the next cluster. If we
- //don't know the size of the current cluster, then we
- //must either parse its payload (as we do below), looking
- //for the cluster (or cues) ID to terminate the parse.
- //This isn't really what we want: rather, we really need
- //a way to create the curr cluster object immediately.
- //The pity is that cluster::parse can determine its own
- //boundary, and we largely duplicate that same logic here.
- //
- //Maybe we need to get rid of our look-ahead preloading
- //in source::parse???
- //
- //As we're parsing the blocks in the curr cluster
- //(in cluster::parse), we should have some way to signal
- //to the segment that we have determined the boundary,
- //so it can adjust its own segment::m_pos member.
- //
- //The problem is that we're asserting in asyncreadinit,
- //because we adjust the pos down to the curr seek pos,
- //and the resulting adjusted len is > 2GB. I'm suspicious
- //that this is even correct, but even if it is, we can't
- //be loading that much data in the cache anyway.
-
- const long idx = m_clusterCount;
-
- if (m_clusterPreloadCount > 0)
- {
- assert(idx < m_clusterSize);
-
- Cluster* const pCluster = m_clusters[idx];
- assert(pCluster);
- assert(pCluster->m_index < 0);
-
- const long long off = pCluster->GetPosition();
- assert(off >= 0);
-
- if (off == cluster_off) //preloaded already
- {
- if (status == 0) //no entries found
- return E_FILE_FORMAT_INVALID;
-
- if (cluster_size >= 0)
- pos += cluster_size;
- else
- {
- const long long element_size = pCluster->GetElementSize();
-
- if (element_size <= 0)
- return E_FILE_FORMAT_INVALID; //TODO: handle this case
-
- pos = pCluster->m_element_start + element_size;
- }
-
- pCluster->m_index = idx; //move from preloaded to loaded
- ++m_clusterCount;
- --m_clusterPreloadCount;
-
- m_pos = pos; //consume payload
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- return 0; //success
- }
- }
-
- if (status == 0) //no entries found
- {
- if (cluster_size < 0)
- return E_FILE_FORMAT_INVALID; //TODO: handle this
-
- pos += cluster_size;
-
- if ((total >= 0) && (pos >= total))
- {
- m_pos = total;
- return 1; //no more clusters
- }
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- {
- m_pos = segment_stop;
- return 1; //no more clusters
- }
-
- m_pos = pos;
- return 2; //try again
- }
-
- //status > 0 means we have an entry
-
- Cluster* const pCluster = Cluster::Create(this,
- idx,
- cluster_off);
- //element_size);
- assert(pCluster);
-
- AppendCluster(pCluster);
- assert(m_clusters);
- assert(idx < m_clusterSize);
- assert(m_clusters[idx] == pCluster);
-
- if (cluster_size >= 0)
- {
- pos += cluster_size;
-
- m_pos = pos;
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- return 0;
- }
-
- m_pUnknownSize = pCluster;
- m_pos = -pos;
-
- return 0; //partial success, since we have a new cluster
-
- //status == 0 means "no block entries found"
-
- //pos designates start of payload
- //m_pos has NOT been adjusted yet (in case we need to come back here)
-
-#if 0
-
- if (cluster_size < 0) //unknown size
- {
- const long long payload_pos = pos; //absolute pos of cluster payload
-
- for (;;) //determine cluster size
- {
- if ((total >= 0) && (pos >= total))
- break;
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- break; //no more clusters
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- if (id == 0x0C53BB6B) //Cues ID
- break;
-
- switch (id)
- {
- case 0x20: //BlockGroup
- case 0x23: //Simple Block
- case 0x67: //TimeCode
- case 0x2B: //PrevSize
- break;
-
- default:
- assert(false);
- break;
- }
-
- pos += len; //consume ID (of sub-element)
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field of element
-
- //pos now points to start of sub-element's payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not allowed for sub-elements
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop)) //weird
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload of sub-element
- assert((segment_stop < 0) || (pos <= segment_stop));
- } //determine cluster size
-
- cluster_size = pos - payload_pos;
- assert(cluster_size >= 0);
-
- pos = payload_pos; //reset and re-parse original cluster
- }
-
- if (m_clusterPreloadCount > 0)
- {
- assert(idx < m_clusterSize);
-
- Cluster* const pCluster = m_clusters[idx];
- assert(pCluster);
- assert(pCluster->m_index < 0);
-
- const long long off = pCluster->GetPosition();
- assert(off >= 0);
-
- if (off == cluster_off) //preloaded already
- return E_FILE_FORMAT_INVALID; //subtle
- }
-
- m_pos = pos + cluster_size; //consume payload
- assert((segment_stop < 0) || (m_pos <= segment_stop));
-
- return 2; //try to find another cluster
-
-#endif
-
-}
-
-
-long Segment::DoLoadClusterUnknownSize(
- long long& pos,
- long& len)
-{
- assert(m_pos < 0);
- assert(m_pUnknownSize);
-
-#if 0
- assert(m_pUnknownSize->GetElementSize() < 0); //TODO: verify this
-
- const long long element_start = m_pUnknownSize->m_element_start;
-
- pos = -m_pos;
- assert(pos > element_start);
-
- //We have already consumed the (cluster) ID and size fields.
- //We just need to consume the blocks and other sub-elements
- //of this cluster, until we discover the boundary.
-
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- long long element_size = -1;
-
- for (;;) //determine cluster size
- {
- if ((total >= 0) && (pos >= total))
- {
- element_size = total - element_start;
- assert(element_size > 0);
-
- break;
- }
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- {
- element_size = segment_stop - element_start;
- assert(element_size > 0);
-
- break;
- }
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if ((id == 0x0F43B675) || (id == 0x0C53BB6B)) //Cluster ID or Cues ID
- {
- element_size = pos - element_start;
- assert(element_size > 0);
-
- break;
- }
-
-#ifdef _DEBUG
- switch (id)
- {
- case 0x20: //BlockGroup
- case 0x23: //Simple Block
- case 0x67: //TimeCode
- case 0x2B: //PrevSize
- break;
-
- default:
- assert(false);
- break;
- }
-#endif
-
- pos += len; //consume ID (of sub-element)
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field of element
-
- //pos now points to start of sub-element's payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not allowed for sub-elements
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop)) //weird
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload of sub-element
- assert((segment_stop < 0) || (pos <= segment_stop));
- } //determine cluster size
-
- assert(element_size >= 0);
-
- m_pos = element_start + element_size;
- m_pUnknownSize = 0;
-
- return 2; //continue parsing
-#else
- const long status = m_pUnknownSize->Parse(pos, len);
-
- if (status < 0) //error or underflow
- return status;
-
- if (status == 0) //parsed a block
- return 2; //continue parsing
-
- assert(status > 0); //nothing left to parse of this cluster
-
- const long long start = m_pUnknownSize->m_element_start;
-
- const long long size = m_pUnknownSize->GetElementSize();
- assert(size >= 0);
-
- pos = start + size;
- m_pos = pos;
-
- m_pUnknownSize = 0;
-
- return 2; //continue parsing
-#endif
-}
-
-
-void Segment::AppendCluster(Cluster* pCluster)
-{
- assert(pCluster);
- assert(pCluster->m_index >= 0);
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- long& size = m_clusterSize;
- assert(size >= count);
-
- const long idx = pCluster->m_index;
- assert(idx == m_clusterCount);
-
- if (count >= size)
- {
- const long n = (size <= 0) ? 2048 : 2*size;
-
- Cluster** const qq = new Cluster*[n];
- Cluster** q = qq;
-
- Cluster** p = m_clusters;
- Cluster** const pp = p + count;
-
- while (p != pp)
- *q++ = *p++;
-
- delete[] m_clusters;
-
- m_clusters = qq;
- size = n;
- }
-
- if (m_clusterPreloadCount > 0)
- {
- assert(m_clusters);
-
- Cluster** const p = m_clusters + m_clusterCount;
- assert(*p);
- assert((*p)->m_index < 0);
-
- Cluster** q = p + m_clusterPreloadCount;
- assert(q < (m_clusters + size));
-
- for (;;)
- {
- Cluster** const qq = q - 1;
- assert((*qq)->m_index < 0);
-
- *q = *qq;
- q = qq;
-
- if (q == p)
- break;
- }
- }
-
- m_clusters[idx] = pCluster;
- ++m_clusterCount;
-}
-
-
-void Segment::PreloadCluster(Cluster* pCluster, ptrdiff_t idx)
-{
- assert(pCluster);
- assert(pCluster->m_index < 0);
- assert(idx >= m_clusterCount);
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- long& size = m_clusterSize;
- assert(size >= count);
-
- if (count >= size)
- {
- const long n = (size <= 0) ? 2048 : 2*size;
-
- Cluster** const qq = new Cluster*[n];
- Cluster** q = qq;
-
- Cluster** p = m_clusters;
- Cluster** const pp = p + count;
-
- while (p != pp)
- *q++ = *p++;
-
- delete[] m_clusters;
-
- m_clusters = qq;
- size = n;
- }
-
- assert(m_clusters);
-
- Cluster** const p = m_clusters + idx;
-
- Cluster** q = m_clusters + count;
- assert(q >= p);
- assert(q < (m_clusters + size));
-
- while (q > p)
- {
- Cluster** const qq = q - 1;
- assert((*qq)->m_index < 0);
-
- *q = *qq;
- q = qq;
- }
-
- m_clusters[idx] = pCluster;
- ++m_clusterPreloadCount;
-}
-
-
-long Segment::Load()
-{
- assert(m_clusters == NULL);
- assert(m_clusterSize == 0);
- assert(m_clusterCount == 0);
- //assert(m_size >= 0);
-
- //Outermost (level 0) segment object has been constructed,
- //and pos designates start of payload. We need to find the
- //inner (level 1) elements.
-
- const long long header_status = ParseHeaders();
-
- if (header_status < 0) //error
- return static_cast<long>(header_status);
-
- if (header_status > 0) //underflow
- return E_BUFFER_NOT_FULL;
-
- assert(m_pInfo);
- assert(m_pTracks);
-
- for (;;)
- {
- const int status = LoadCluster();
-
- if (status < 0) //error
- return status;
-
- if (status >= 1) //no more clusters
- return 0;
- }
-}
-
-
-SeekHead::SeekHead(
- Segment* pSegment,
- long long start,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_entries(0),
- m_entry_count(0),
- m_void_elements(0),
- m_void_element_count(0)
-{
-}
-
-
-SeekHead::~SeekHead()
-{
- delete[] m_entries;
- delete[] m_void_elements;
-}
-
-
-long SeekHead::Parse()
-{
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = m_start;
- const long long stop = m_start + m_size;
-
- //first count the seek head entries
-
- int entry_count = 0;
- int void_element_count = 0;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x0DBB) //SeekEntry ID
- ++entry_count;
- else if (id == 0x6C) //Void ID
- ++void_element_count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- m_entries = new (std::nothrow) Entry[entry_count];
-
- if (m_entries == NULL)
- return -1;
-
- m_void_elements = new (std::nothrow) VoidElement[void_element_count];
-
- if (m_void_elements == NULL)
- return -1;
-
- //now parse the entries and void elements
-
- Entry* pEntry = m_entries;
- VoidElement* pVoidElement = m_void_elements;
-
- pos = m_start;
-
- while (pos < stop)
- {
- const long long idpos = pos;
-
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x0DBB) //SeekEntry ID
- {
- if (ParseEntry(pReader, pos, size, pEntry))
- {
- Entry& e = *pEntry++;
-
- e.element_start = idpos;
- e.element_size = (pos + size) - idpos;
- }
- }
- else if (id == 0x6C) //Void ID
- {
- VoidElement& e = *pVoidElement++;
-
- e.element_start = idpos;
- e.element_size = (pos + size) - idpos;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- ptrdiff_t count_ = ptrdiff_t(pEntry - m_entries);
- assert(count_ >= 0);
- assert(count_ <= entry_count);
-
- m_entry_count = static_cast<int>(count_);
-
- count_ = ptrdiff_t(pVoidElement - m_void_elements);
- assert(count_ >= 0);
- assert(count_ <= void_element_count);
-
- m_void_element_count = static_cast<int>(count_);
-
- return 0;
-}
-
-
-int SeekHead::GetCount() const
-{
- return m_entry_count;
-}
-
-const SeekHead::Entry* SeekHead::GetEntry(int idx) const
-{
- if (idx < 0)
- return 0;
-
- if (idx >= m_entry_count)
- return 0;
-
- return m_entries + idx;
-}
-
-int SeekHead::GetVoidElementCount() const
-{
- return m_void_element_count;
-}
-
-const SeekHead::VoidElement* SeekHead::GetVoidElement(int idx) const
-{
- if (idx < 0)
- return 0;
-
- if (idx >= m_void_element_count)
- return 0;
-
- return m_void_elements + idx;
-}
-
-
-#if 0
-void Segment::ParseCues(long long off)
-{
- if (m_pCues)
- return;
-
- //odbgstream os;
- //os << "Segment::ParseCues (begin)" << endl;
-
- long long pos = m_start + off;
- const long long element_start = pos;
- const long long stop = m_start + m_size;
-
- long len;
-
- long long result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0);
- assert((pos + len) <= stop);
-
- const long long idpos = pos;
-
- const long long id = ReadUInt(m_pReader, idpos, len);
- assert(id == 0x0C53BB6B); //Cues ID
-
- pos += len; //consume ID
- assert(pos < stop);
-
- //Read Size
-
- result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0);
- assert((pos + len) <= stop);
-
- const long long size = ReadUInt(m_pReader, pos, len);
- assert(size >= 0);
-
- pos += len; //consume length of size of element
- assert((pos + size) <= stop);
-
- const long long element_size = size + pos - element_start;
-
- //Pos now points to start of payload
-
- m_pCues = new Cues(this, pos, size, element_start, element_size);
- assert(m_pCues); //TODO
-
- //os << "Segment::ParseCues (end)" << endl;
-}
-#else
-long Segment::ParseCues(
- long long off,
- long long& pos,
- long& len)
-{
- if (m_pCues)
- return 0; //success
-
- if (off < 0)
- return -1;
-
- long long total, avail;
-
- const int status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- pos = m_start + off;
-
- if ((total < 0) || (pos >= total))
- return 1; //don't bother parsing cues
-
- const long long element_start = pos;
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //underflow (weird)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
-
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id != 0x0C53BB6B) //Cues ID
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume ID
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //underflow (weird)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- if (size == 0) //weird, although technically not illegal
- return 1; //done
-
- pos += len; //consume length of size of element
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- //Pos now points to start of payload
-
- const long long element_stop = pos + size;
-
- if ((segment_stop >= 0) && (element_stop > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && (element_stop > total))
- return 1; //don't bother parsing anymore
-
- len = static_cast<long>(size);
-
- if (element_stop > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long element_size = element_stop - element_start;
-
- m_pCues = new (std::nothrow) Cues(
- this,
- pos,
- size,
- element_start,
- element_size);
- assert(m_pCues); //TODO
-
- return 0; //success
-}
-#endif
-
-
-#if 0
-void Segment::ParseSeekEntry(
- long long start,
- long long size_)
-{
- long long pos = start;
-
- const long long stop = start + size_;
-
- long len;
-
- const long long seekIdId = ReadUInt(m_pReader, pos, len);
- //seekIdId;
- assert(seekIdId == 0x13AB); //SeekID ID
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long seekIdSize = ReadUInt(m_pReader, pos, len);
- assert(seekIdSize >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume size
-
- const long long seekId = ReadUInt(m_pReader, pos, len); //payload
- assert(seekId >= 0);
- assert(len == seekIdSize);
- assert((pos + len) <= stop);
-
- pos += seekIdSize; //consume payload
-
- const long long seekPosId = ReadUInt(m_pReader, pos, len);
- //seekPosId;
- assert(seekPosId == 0x13AC); //SeekPos ID
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long seekPosSize = ReadUInt(m_pReader, pos, len);
- assert(seekPosSize >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume size
- assert((pos + seekPosSize) <= stop);
-
- const long long seekOff = UnserializeUInt(m_pReader, pos, seekPosSize);
- assert(seekOff >= 0);
- assert(seekOff < m_size);
-
- pos += seekPosSize; //consume payload
- assert(pos == stop);
-
- const long long seekPos = m_start + seekOff;
- assert(seekPos < (m_start + m_size));
-
- if (seekId == 0x0C53BB6B) //Cues ID
- ParseCues(seekOff);
-}
-#else
-bool SeekHead::ParseEntry(
- IMkvReader* pReader,
- long long start,
- long long size_,
- Entry* pEntry)
-{
- if (size_ <= 0)
- return false;
-
- long long pos = start;
- const long long stop = start + size_;
-
- long len;
-
- //parse the container for the level-1 element ID
-
- const long long seekIdId = ReadUInt(pReader, pos, len);
- //seekIdId;
-
- if (seekIdId != 0x13AB) //SeekID ID
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume SeekID id
-
- const long long seekIdSize = ReadUInt(pReader, pos, len);
-
- if (seekIdSize <= 0)
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume size of field
-
- if ((pos + seekIdSize) > stop)
- return false;
-
- //Note that the SeekId payload really is serialized
- //as a "Matroska integer", not as a plain binary value.
- //In fact, Matroska requires that ID values in the
- //stream exactly match the binary representation as listed
- //in the Matroska specification.
- //
- //This parser is more liberal, and permits IDs to have
- //any width. (This could make the representation in the stream
- //different from what's in the spec, but it doesn't matter here,
- //since we always normalize "Matroska integer" values.)
-
- pEntry->id = ReadUInt(pReader, pos, len); //payload
-
- if (pEntry->id <= 0)
- return false;
-
- if (len != seekIdSize)
- return false;
-
- pos += seekIdSize; //consume SeekID payload
-
- const long long seekPosId = ReadUInt(pReader, pos, len);
-
- if (seekPosId != 0x13AC) //SeekPos ID
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume id
-
- const long long seekPosSize = ReadUInt(pReader, pos, len);
-
- if (seekPosSize <= 0)
- return false;
-
- if ((pos + len) > stop)
- return false;
-
- pos += len; //consume size
-
- if ((pos + seekPosSize) > stop)
- return false;
-
- pEntry->pos = UnserializeUInt(pReader, pos, seekPosSize);
-
- if (pEntry->pos < 0)
- return false;
-
- pos += seekPosSize; //consume payload
-
- if (pos != stop)
- return false;
-
- return true;
-}
-#endif
-
-
-Cues::Cues(
- Segment* pSegment,
- long long start_,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start_),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_cue_points(NULL),
- m_count(0),
- m_preload_count(0),
- m_pos(start_)
-{
-}
-
-
-Cues::~Cues()
-{
- const long n = m_count + m_preload_count;
-
- CuePoint** p = m_cue_points;
- CuePoint** const q = p + n;
-
- while (p != q)
- {
- CuePoint* const pCP = *p++;
- assert(pCP);
-
- delete pCP;
- }
-
- delete[] m_cue_points;
-}
-
-
-long Cues::GetCount() const
-{
- if (m_cue_points == NULL)
- return -1;
-
- return m_count; //TODO: really ignore preload count?
-}
-
-
-bool Cues::DoneParsing() const
-{
- const long long stop = m_start + m_size;
- return (m_pos >= stop);
-}
-
-
-void Cues::Init() const
-{
- if (m_cue_points)
- return;
-
- assert(m_count == 0);
- assert(m_preload_count == 0);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- const long long stop = m_start + m_size;
- long long pos = m_start;
-
- long cue_points_size = 0;
-
- while (pos < stop)
- {
- const long long idpos = pos;
-
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x3B) //CuePoint ID
- PreloadCuePoint(cue_points_size, idpos);
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-}
-
-
-void Cues::PreloadCuePoint(
- long& cue_points_size,
- long long pos) const
-{
- assert(m_count == 0);
-
- if (m_preload_count >= cue_points_size)
- {
- const long n = (cue_points_size <= 0) ? 2048 : 2*cue_points_size;
-
- CuePoint** const qq = new CuePoint*[n];
- CuePoint** q = qq; //beginning of target
-
- CuePoint** p = m_cue_points; //beginning of source
- CuePoint** const pp = p + m_preload_count; //end of source
-
- while (p != pp)
- *q++ = *p++;
-
- delete[] m_cue_points;
-
- m_cue_points = qq;
- cue_points_size = n;
- }
-
- CuePoint* const pCP = new CuePoint(m_preload_count, pos);
- m_cue_points[m_preload_count++] = pCP;
-}
-
-
-bool Cues::LoadCuePoint() const
-{
- //odbgstream os;
- //os << "Cues::LoadCuePoint" << endl;
-
- const long long stop = m_start + m_size;
-
- if (m_pos >= stop)
- return false; //nothing else to do
-
- Init();
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- while (m_pos < stop)
- {
- const long long idpos = m_pos;
-
- long len;
-
- const long long id = ReadUInt(pReader, m_pos, len);
- assert(id >= 0); //TODO
- assert((m_pos + len) <= stop);
-
- m_pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, m_pos, len);
- assert(size >= 0);
- assert((m_pos + len) <= stop);
-
- m_pos += len; //consume Size field
- assert((m_pos + size) <= stop);
-
- if (id != 0x3B) //CuePoint ID
- {
- m_pos += size; //consume payload
- assert(m_pos <= stop);
-
- continue;
- }
-
- assert(m_preload_count > 0);
-
- CuePoint* const pCP = m_cue_points[m_count];
- assert(pCP);
- assert((pCP->GetTimeCode() >= 0) || (-pCP->GetTimeCode() == idpos));
-
- pCP->Load(pReader);
- ++m_count;
- --m_preload_count;
-
- m_pos += size; //consume payload
- assert(m_pos <= stop);
-
- return true; //yes, we loaded a cue point
- }
-
- //return (m_pos < stop);
- return false; //no, we did not load a cue point
-}
-
-
-bool Cues::Find(
- long long time_ns,
- const Track* pTrack,
- const CuePoint*& pCP,
- const CuePoint::TrackPosition*& pTP) const
-{
- assert(time_ns >= 0);
- assert(pTrack);
-
-#if 0
- LoadCuePoint(); //establish invariant
-
- assert(m_cue_points);
- assert(m_count > 0);
-
- CuePoint** const ii = m_cue_points;
- CuePoint** i = ii;
-
- CuePoint** const jj = ii + m_count + m_preload_count;
- CuePoint** j = jj;
-
- pCP = *i;
- assert(pCP);
-
- if (time_ns <= pCP->GetTime(m_pSegment))
- {
- pTP = pCP->Find(pTrack);
- return (pTP != NULL);
- }
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) <= time_ns
- //[i, j) ?
- //[j, jj) > time_ns
-
- CuePoint** const k = i + (j - i) / 2;
- assert(k < jj);
-
- CuePoint* const pCP = *k;
- assert(pCP);
-
- pCP->Load(pReader);
-
- const long long t = pCP->GetTime(m_pSegment);
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i <= jj);
- assert(i > ii);
-
- pCP = *--i;
- assert(pCP);
- assert(pCP->GetTime(m_pSegment) <= time_ns);
-#else
- if (m_cue_points == NULL)
- return false;
-
- if (m_count == 0)
- return false;
-
- CuePoint** const ii = m_cue_points;
- CuePoint** i = ii;
-
- CuePoint** const jj = ii + m_count;
- CuePoint** j = jj;
-
- pCP = *i;
- assert(pCP);
-
- if (time_ns <= pCP->GetTime(m_pSegment))
- {
- pTP = pCP->Find(pTrack);
- return (pTP != NULL);
- }
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) <= time_ns
- //[i, j) ?
- //[j, jj) > time_ns
-
- CuePoint** const k = i + (j - i) / 2;
- assert(k < jj);
-
- CuePoint* const pCP = *k;
- assert(pCP);
-
- const long long t = pCP->GetTime(m_pSegment);
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i <= jj);
- assert(i > ii);
-
- pCP = *--i;
- assert(pCP);
- assert(pCP->GetTime(m_pSegment) <= time_ns);
-#endif
-
- //It's probably not correct to search for the cue point with this
- //time, and then search for a matching track. In principle, the
- //matching track could be on some earlier cue point. So we recheck
- //the earlier cue point if the track doesn't match.
- long index = pCP->GetIndex();
- while (index >= 0) {
- pTP = pCP->Find(pTrack);
- if (pTP == NULL)
- pCP = m_cue_points[index--];
- else
- break;
- }
- return (pTP != NULL);
-}
-
-
-#if 0
-bool Cues::FindNext(
- long long time_ns,
- const Track* pTrack,
- const CuePoint*& pCP,
- const CuePoint::TrackPosition*& pTP) const
-{
- pCP = 0;
- pTP = 0;
-
- if (m_count == 0)
- return false;
-
- assert(m_cue_points);
-
- const CuePoint* const* const ii = m_cue_points;
- const CuePoint* const* i = ii;
-
- const CuePoint* const* const jj = ii + m_count;
- const CuePoint* const* j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) <= time_ns
- //[i, j) ?
- //[j, jj) > time_ns
-
- const CuePoint* const* const k = i + (j - i) / 2;
- assert(k < jj);
-
- pCP = *k;
- assert(pCP);
-
- const long long t = pCP->GetTime(m_pSegment);
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i <= jj);
-
- if (i >= jj) //time_ns is greater than max cue point
- return false;
-
- pCP = *i;
- assert(pCP);
- assert(pCP->GetTime(m_pSegment) > time_ns);
-
- pTP = pCP->Find(pTrack);
- return (pTP != NULL);
-}
-#endif
-
-
-const CuePoint* Cues::GetFirst() const
-{
- if (m_cue_points == NULL)
- return NULL;
-
- if (m_count == 0)
- return NULL;
-
-#if 0
- LoadCuePoint(); //init cues
-
- const size_t count = m_count + m_preload_count;
-
- if (count == 0) //weird
- return NULL;
-#endif
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
-
- CuePoint* const pCP = pp[0];
- assert(pCP);
- assert(pCP->GetTimeCode() >= 0);
-
- return pCP;
-}
-
-
-const CuePoint* Cues::GetLast() const
-{
- if (m_cue_points == NULL)
- return NULL;
-
- if (m_count <= 0)
- return NULL;
-
-#if 0
- LoadCuePoint(); //init cues
-
- const size_t count = m_count + m_preload_count;
-
- if (count == 0) //weird
- return NULL;
-
- const size_t index = count - 1;
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
-
- CuePoint* const pCP = pp[index];
- assert(pCP);
-
- pCP->Load(m_pSegment->m_pReader);
- assert(pCP->GetTimeCode() >= 0);
-#else
- const long index = m_count - 1;
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
-
- CuePoint* const pCP = pp[index];
- assert(pCP);
- assert(pCP->GetTimeCode() >= 0);
-#endif
-
- return pCP;
-}
-
-
-const CuePoint* Cues::GetNext(const CuePoint* pCurr) const
-{
- if (pCurr == NULL)
- return NULL;
-
- assert(pCurr->GetTimeCode() >= 0);
- assert(m_cue_points);
- assert(m_count >= 1);
-
-#if 0
- const size_t count = m_count + m_preload_count;
-
- size_t index = pCurr->m_index;
- assert(index < count);
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
- assert(pp[index] == pCurr);
-
- ++index;
-
- if (index >= count)
- return NULL;
-
- CuePoint* const pNext = pp[index];
- assert(pNext);
-
- pNext->Load(m_pSegment->m_pReader);
-#else
- long index = pCurr->m_index;
- assert(index < m_count);
-
- CuePoint* const* const pp = m_cue_points;
- assert(pp);
- assert(pp[index] == pCurr);
-
- ++index;
-
- if (index >= m_count)
- return NULL;
-
- CuePoint* const pNext = pp[index];
- assert(pNext);
- assert(pNext->GetTimeCode() >= 0);
-#endif
-
- return pNext;
-}
-
-
-const BlockEntry* Cues::GetBlock(
- const CuePoint* pCP,
- const CuePoint::TrackPosition* pTP) const
-{
- if (pCP == NULL)
- return NULL;
-
- if (pTP == NULL)
- return NULL;
-
- return m_pSegment->GetBlock(*pCP, *pTP);
-}
-
-
-const BlockEntry* Segment::GetBlock(
- const CuePoint& cp,
- const CuePoint::TrackPosition& tp)
-{
- Cluster** const ii = m_clusters;
- Cluster** i = ii;
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- Cluster** const jj = ii + count;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) < pTP->m_pos
- //[i, j) ?
- //[j, jj) > pTP->m_pos
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- Cluster* const pCluster = *k;
- assert(pCluster);
-
- //const long long pos_ = pCluster->m_pos;
- //assert(pos_);
- //const long long pos = pos_ * ((pos_ < 0) ? -1 : 1);
-
- const long long pos = pCluster->GetPosition();
- assert(pos >= 0);
-
- if (pos < tp.m_pos)
- i = k + 1;
- else if (pos > tp.m_pos)
- j = k;
- else
- return pCluster->GetEntry(cp, tp);
- }
-
- assert(i == j);
- //assert(Cluster::HasBlockEntries(this, tp.m_pos));
-
- Cluster* const pCluster = Cluster::Create(this, -1, tp.m_pos); //, -1);
- assert(pCluster);
-
- const ptrdiff_t idx = i - m_clusters;
-
- PreloadCluster(pCluster, idx);
- assert(m_clusters);
- assert(m_clusterPreloadCount > 0);
- assert(m_clusters[idx] == pCluster);
-
- return pCluster->GetEntry(cp, tp);
-}
-
-
-const Cluster* Segment::FindOrPreloadCluster(long long requested_pos)
-{
- if (requested_pos < 0)
- return 0;
-
- Cluster** const ii = m_clusters;
- Cluster** i = ii;
-
- const long count = m_clusterCount + m_clusterPreloadCount;
-
- Cluster** const jj = ii + count;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[ii, i) < pTP->m_pos
- //[i, j) ?
- //[j, jj) > pTP->m_pos
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- Cluster* const pCluster = *k;
- assert(pCluster);
-
- //const long long pos_ = pCluster->m_pos;
- //assert(pos_);
- //const long long pos = pos_ * ((pos_ < 0) ? -1 : 1);
-
- const long long pos = pCluster->GetPosition();
- assert(pos >= 0);
-
- if (pos < requested_pos)
- i = k + 1;
- else if (pos > requested_pos)
- j = k;
- else
- return pCluster;
- }
-
- assert(i == j);
- //assert(Cluster::HasBlockEntries(this, tp.m_pos));
-
- Cluster* const pCluster = Cluster::Create(
- this,
- -1,
- requested_pos);
- //-1);
- assert(pCluster);
-
- const ptrdiff_t idx = i - m_clusters;
-
- PreloadCluster(pCluster, idx);
- assert(m_clusters);
- assert(m_clusterPreloadCount > 0);
- assert(m_clusters[idx] == pCluster);
-
- return pCluster;
-}
-
-
-CuePoint::CuePoint(long idx, long long pos) :
- m_element_start(0),
- m_element_size(0),
- m_index(idx),
- m_timecode(-1 * pos),
- m_track_positions(NULL),
- m_track_positions_count(0)
-{
- assert(pos > 0);
-}
-
-
-CuePoint::~CuePoint()
-{
- delete[] m_track_positions;
-}
-
-
-void CuePoint::Load(IMkvReader* pReader)
-{
- //odbgstream os;
- //os << "CuePoint::Load(begin): timecode=" << m_timecode << endl;
-
- if (m_timecode >= 0) //already loaded
- return;
-
- assert(m_track_positions == NULL);
- assert(m_track_positions_count == 0);
-
- long long pos_ = -m_timecode;
- const long long element_start = pos_;
-
- long long stop;
-
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos_, len);
- assert(id == 0x3B); //CuePoint ID
- //assert((pos + len) <= stop);
-
- pos_ += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos_, len);
- assert(size >= 0);
- //assert((pos + len) <= stop);
-
- pos_ += len; //consume Size field
- //assert((pos + size) <= stop);
-
- //pos_ now points to start of payload
-
- stop = pos_ + size;
- }
-
- const long long element_size = stop - element_start;
-
- long long pos = pos_;
-
- //First count number of track positions
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x33) //CueTime ID
- m_timecode = UnserializeUInt(pReader, pos, size);
-
- else if (id == 0x37) //CueTrackPosition(s) ID
- ++m_track_positions_count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(m_timecode >= 0);
- assert(m_track_positions_count > 0);
-
- //os << "CuePoint::Load(cont'd): idpos=" << idpos
- // << " timecode=" << m_timecode
- // << endl;
-
- m_track_positions = new TrackPosition[m_track_positions_count];
-
- //Now parse track positions
-
- TrackPosition* p = m_track_positions;
- pos = pos_;
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x37) //CueTrackPosition(s) ID
- {
- TrackPosition& tp = *p++;
- tp.Parse(pReader, pos, size);
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(size_t(p - m_track_positions) == m_track_positions_count);
-
- m_element_start = element_start;
- m_element_size = element_size;
-}
-
-
-
-void CuePoint::TrackPosition::Parse(
- IMkvReader* pReader,
- long long start_,
- long long size_)
-{
- const long long stop = start_ + size_;
- long long pos = start_;
-
- m_track = -1;
- m_pos = -1;
- m_block = 1; //default
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume Size field
- assert((pos + size) <= stop);
-
- if (id == 0x77) //CueTrack ID
- m_track = UnserializeUInt(pReader, pos, size);
-
- else if (id == 0x71) //CueClusterPos ID
- m_pos = UnserializeUInt(pReader, pos, size);
-
- else if (id == 0x1378) //CueBlockNumber
- m_block = UnserializeUInt(pReader, pos, size);
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(m_pos >= 0);
- assert(m_track > 0);
- //assert(m_block > 0);
-}
-
-
-const CuePoint::TrackPosition* CuePoint::Find(const Track* pTrack) const
-{
- assert(pTrack);
-
- const long long n = pTrack->GetNumber();
-
- const TrackPosition* i = m_track_positions;
- const TrackPosition* const j = i + m_track_positions_count;
-
- while (i != j)
- {
- const TrackPosition& p = *i++;
-
- if (p.m_track == n)
- return &p;
- }
-
- return NULL; //no matching track number found
-}
-
-
-long long CuePoint::GetTimeCode() const
-{
- return m_timecode;
-}
-
-long long CuePoint::GetTime(const Segment* pSegment) const
-{
- assert(pSegment);
- assert(m_timecode >= 0);
-
- const SegmentInfo* const pInfo = pSegment->GetInfo();
- assert(pInfo);
-
- const long long scale = pInfo->GetTimeCodeScale();
- assert(scale >= 1);
-
- const long long time = scale * m_timecode;
-
- return time;
-}
-
-long CuePoint::GetIndex() const
-{
- return m_index;
-}
-
-#if 0
-long long Segment::Unparsed() const
-{
- if (m_size < 0)
- return LLONG_MAX;
-
- const long long stop = m_start + m_size;
-
- const long long result = stop - m_pos;
- assert(result >= 0);
-
- return result;
-}
-#else
-bool Segment::DoneParsing() const
-{
- if (m_size < 0)
- {
- long long total, avail;
-
- const int status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return true; //must assume done
-
- if (total < 0)
- return false; //assume live stream
-
- return (m_pos >= total);
- }
-
- const long long stop = m_start + m_size;
-
- return (m_pos >= stop);
-}
-#endif
-
-
-const Cluster* Segment::GetFirst() const
-{
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return &m_eos;
-
- Cluster* const pCluster = m_clusters[0];
- assert(pCluster);
-
- return pCluster;
-}
-
-
-const Cluster* Segment::GetLast() const
-{
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return &m_eos;
-
- const long idx = m_clusterCount - 1;
-
- Cluster* const pCluster = m_clusters[idx];
- assert(pCluster);
-
- return pCluster;
-}
-
-
-unsigned long Segment::GetCount() const
-{
- return m_clusterCount;
-}
-
-
-const Cluster* Segment::GetNext(const Cluster* pCurr)
-{
- assert(pCurr);
- assert(pCurr != &m_eos);
- assert(m_clusters);
-
- long idx = pCurr->m_index;
-
- if (idx >= 0)
- {
- assert(m_clusterCount > 0);
- assert(idx < m_clusterCount);
- assert(pCurr == m_clusters[idx]);
-
- ++idx;
-
- if (idx >= m_clusterCount)
- return &m_eos; //caller will LoadCluster as desired
-
- Cluster* const pNext = m_clusters[idx];
- assert(pNext);
- assert(pNext->m_index >= 0);
- assert(pNext->m_index == idx);
-
- return pNext;
- }
-
- assert(m_clusterPreloadCount > 0);
-
- //const long long off_ = pCurr->m_pos;
- //const long long off = off_ * ((off_ < 0) ? -1 : 1);
- //long long pos = m_start + off;
-
- long long pos = pCurr->m_element_start;
-
- assert(m_size >= 0); //TODO
- const long long stop = m_start + m_size; //end of segment
-
- {
- long len;
-
- long long result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0); //TODO
- assert((pos + len) <= stop); //TODO
-
- const long long id = ReadUInt(m_pReader, pos, len);
- assert(id == 0x0F43B675); //Cluster ID //TODO
-
- pos += len; //consume ID
-
- //Read Size
- result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0); //TODO
- assert((pos + len) <= stop); //TODO
-
- const long long size = ReadUInt(m_pReader, pos, len);
- assert(size > 0); //TODO
- //assert((pCurr->m_size <= 0) || (pCurr->m_size == size));
-
- pos += len; //consume length of size of element
- assert((pos + size) <= stop); //TODO
-
- //Pos now points to start of payload
-
- pos += size; //consume payload
- }
-
- long long off_next = 0;
- //long long element_start_next = 0;
- long long element_size_next = 0;
-
- while (pos < stop)
- {
- long len;
-
- long long result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0); //TODO
- assert((pos + len) <= stop); //TODO
-
- const long long idpos = pos; //pos of next (potential) cluster
-
- const long long id = ReadUInt(m_pReader, idpos, len);
- assert(id > 0); //TODO
-
- pos += len; //consume ID
-
- //Read Size
- result = GetUIntLength(m_pReader, pos, len);
- assert(result == 0); //TODO
- assert((pos + len) <= stop); //TODO
-
- const long long size = ReadUInt(m_pReader, pos, len);
- assert(size >= 0); //TODO
-
- pos += len; //consume length of size of element
- assert((pos + size) <= stop); //TODO
-
- const long long element_size = size + pos - idpos;
-
- //Pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- if (id == 0x0F43B675) //Cluster ID
- {
- const long long off_next_ = idpos - m_start;
-
- long long pos_;
- long len_;
-
- const long status = Cluster::HasBlockEntries(
- this,
- off_next_,
- pos_,
- len_);
-
- assert(status >= 0);
-
- if (status > 0)
- {
- off_next = off_next_;
- //element_start_next = idpos;
- element_size_next = element_size;
- break;
- }
- }
-
- pos += size; //consume payload
- }
-
- if (off_next <= 0)
- return 0;
-
- Cluster** const ii = m_clusters + m_clusterCount;
- Cluster** i = ii;
-
- Cluster** const jj = ii + m_clusterPreloadCount;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[0, i) < pos_next
- //[i, j) ?
- //[j, jj) > pos_next
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- Cluster* const pNext = *k;
- assert(pNext);
- assert(pNext->m_index < 0);
-
- //const long long pos_ = pNext->m_pos;
- //assert(pos_);
- //pos = pos_ * ((pos_ < 0) ? -1 : 1);
-
- pos = pNext->GetPosition();
-
- if (pos < off_next)
- i = k + 1;
- else if (pos > off_next)
- j = k;
- else
- return pNext;
- }
-
- assert(i == j);
-
- Cluster* const pNext = Cluster::Create(this,
- -1,
- off_next);
- //element_size_next);
- assert(pNext);
-
- const ptrdiff_t idx_next = i - m_clusters; //insertion position
-
- PreloadCluster(pNext, idx_next);
- assert(m_clusters);
- assert(idx_next < m_clusterSize);
- assert(m_clusters[idx_next] == pNext);
-
- return pNext;
-}
-
-
-long Segment::ParseNext(
- const Cluster* pCurr,
- const Cluster*& pResult,
- long long& pos,
- long& len)
-{
- assert(pCurr);
- assert(!pCurr->EOS());
- assert(m_clusters);
-
- pResult = 0;
-
- if (pCurr->m_index >= 0) //loaded (not merely preloaded)
- {
- assert(m_clusters[pCurr->m_index] == pCurr);
-
- const long next_idx = pCurr->m_index + 1;
-
- if (next_idx < m_clusterCount)
- {
- pResult = m_clusters[next_idx];
- return 0; //success
- }
-
- //curr cluster is last among loaded
-
- const long result = LoadCluster(pos, len);
-
- if (result < 0) //error or underflow
- return result;
-
- if (result > 0) //no more clusters
- {
- //pResult = &m_eos;
- return 1;
- }
-
- pResult = GetLast();
- return 0; //success
- }
-
- assert(m_pos > 0);
-
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- //interrogate curr cluster
-
- pos = pCurr->m_element_start;
-
- if (pCurr->m_element_size >= 0)
- pos += pCurr->m_element_size;
- else
- {
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(m_pReader, pos, len);
-
- if (id != 0x0F43B675) //weird: not Cluster ID
- return -1;
-
- pos += len; //consume ID
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size) //TODO: should never happen
- return E_FILE_FORMAT_INVALID; //TODO: resolve this
-
- //assert((pCurr->m_size <= 0) || (pCurr->m_size == size));
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- //Pos now points to start of payload
-
- pos += size; //consume payload (that is, the current cluster)
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- //By consuming the payload, we are assuming that the curr
- //cluster isn't interesting. That is, we don't bother checking
- //whether the payload of the curr cluster is less than what
- //happens to be available (obtained via IMkvReader::Length).
- //Presumably the caller has already dispensed with the current
- //cluster, and really does want the next cluster.
- }
-
- //pos now points to just beyond the last fully-loaded cluster
-
- for (;;)
- {
- const long status = DoParseNext(pResult, pos, len);
-
- if (status <= 1)
- return status;
- }
-}
-
-
-long Segment::DoParseNext(
- const Cluster*& pResult,
- long long& pos,
- long& len)
-{
- long long total, avail;
-
- long status = m_pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
-
- //Parse next cluster. This is strictly a parsing activity.
- //Creation of a new cluster object happens later, after the
- //parsing is done.
-
- long long off_next = 0;
- long long cluster_size = -1;
-
- for (;;)
- {
- if ((total >= 0) && (pos >= total))
- return 1; //EOF
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- return 1; //EOF
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos; //absolute
- const long long idoff = pos - m_start; //relative
-
- const long long id = ReadUInt(m_pReader, idpos, len); //absolute
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0) //weird
- return -1; //generic error
-
- pos += len; //consume ID
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume length of size of element
-
- //Pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if ((segment_stop >= 0) &&
- (size != unknown_size) &&
- ((pos + size) > segment_stop))
- {
- return E_FILE_FORMAT_INVALID;
- }
-
- if (id == 0x0C53BB6B) //Cues ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- const long long element_stop = pos + size;
-
- if ((segment_stop >= 0) && (element_stop > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- const long long element_start = idpos;
- const long long element_size = element_stop - element_start;
-
- if (m_pCues == NULL)
- {
- m_pCues = new Cues(this,
- pos,
- size,
- element_start,
- element_size);
- assert(m_pCues); //TODO
- }
-
- pos += size; //consume payload
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- continue;
- }
-
- if (id != 0x0F43B675) //not a Cluster ID
- {
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- continue;
- }
-
-#if 0 //this is commented-out to support incremental cluster parsing
- len = static_cast<long>(size);
-
- if (element_stop > avail)
- return E_BUFFER_NOT_FULL;
-#endif
-
- //We have a cluster.
-
- off_next = idoff;
-
- if (size != unknown_size)
- cluster_size = size;
-
- break;
- }
-
- assert(off_next > 0); //have cluster
-
- //We have parsed the next cluster.
- //We have not created a cluster object yet. What we need
- //to do now is determine whether it has already be preloaded
- //(in which case, an object for this cluster has already been
- //created), and if not, create a new cluster object.
-
- Cluster** const ii = m_clusters + m_clusterCount;
- Cluster** i = ii;
-
- Cluster** const jj = ii + m_clusterPreloadCount;
- Cluster** j = jj;
-
- while (i < j)
- {
- //INVARIANT:
- //[0, i) < pos_next
- //[i, j) ?
- //[j, jj) > pos_next
-
- Cluster** const k = i + (j - i) / 2;
- assert(k < jj);
-
- const Cluster* const pNext = *k;
- assert(pNext);
- assert(pNext->m_index < 0);
-
- pos = pNext->GetPosition();
- assert(pos >= 0);
-
- if (pos < off_next)
- i = k + 1;
- else if (pos > off_next)
- j = k;
- else
- {
- pResult = pNext;
- return 0; //success
- }
- }
-
- assert(i == j);
-
- long long pos_;
- long len_;
-
- status = Cluster::HasBlockEntries(this, off_next, pos_, len_);
-
- if (status < 0) //error or underflow
- {
- pos = pos_;
- len = len_;
-
- return status;
- }
-
- if (status > 0) //means "found at least one block entry"
- {
- Cluster* const pNext = Cluster::Create(this,
- -1, //preloaded
- off_next);
- //element_size);
- assert(pNext);
-
- const ptrdiff_t idx_next = i - m_clusters; //insertion position
-
- PreloadCluster(pNext, idx_next);
- assert(m_clusters);
- assert(idx_next < m_clusterSize);
- assert(m_clusters[idx_next] == pNext);
-
- pResult = pNext;
- return 0; //success
- }
-
- //status == 0 means "no block entries found"
-
- if (cluster_size < 0) //unknown size
- {
- const long long payload_pos = pos; //absolute pos of cluster payload
-
- for (;;) //determine cluster size
- {
- if ((total >= 0) && (pos >= total))
- break;
-
- if ((segment_stop >= 0) && (pos >= segment_stop))
- break; //no more clusters
-
- //Read ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long idpos = pos;
- const long long id = ReadUInt(m_pReader, idpos, len);
-
- if (id < 0) //error (or underflow)
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- if (id == 0x0C53BB6B) //Cues ID
- break;
-
- pos += len; //consume ID (of sub-element)
-
- //Read Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(m_pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(m_pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field of element
-
- //pos now points to start of sub-element's payload
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not allowed for sub-elements
-
- if ((segment_stop >= 0) && ((pos + size) > segment_stop)) //weird
- return E_FILE_FORMAT_INVALID;
-
- pos += size; //consume payload of sub-element
- assert((segment_stop < 0) || (pos <= segment_stop));
- } //determine cluster size
-
- cluster_size = pos - payload_pos;
- assert(cluster_size >= 0); //TODO: handle cluster_size = 0
-
- pos = payload_pos; //reset and re-parse original cluster
- }
-
- pos += cluster_size; //consume payload
- assert((segment_stop < 0) || (pos <= segment_stop));
-
- return 2; //try to find a cluster that follows next
-}
-
-
-const Cluster* Segment::FindCluster(long long time_ns) const
-{
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return &m_eos;
-
- {
- Cluster* const pCluster = m_clusters[0];
- assert(pCluster);
- assert(pCluster->m_index == 0);
-
- if (time_ns <= pCluster->GetTime())
- return pCluster;
- }
-
- //Binary search of cluster array
-
- long i = 0;
- long j = m_clusterCount;
-
- while (i < j)
- {
- //INVARIANT:
- //[0, i) <= time_ns
- //[i, j) ?
- //[j, m_clusterCount) > time_ns
-
- const long k = i + (j - i) / 2;
- assert(k < m_clusterCount);
-
- Cluster* const pCluster = m_clusters[k];
- assert(pCluster);
- assert(pCluster->m_index == k);
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- i = k + 1;
- else
- j = k;
-
- assert(i <= j);
- }
-
- assert(i == j);
- assert(i > 0);
- assert(i <= m_clusterCount);
-
- const long k = i - 1;
-
- Cluster* const pCluster = m_clusters[k];
- assert(pCluster);
- assert(pCluster->m_index == k);
- assert(pCluster->GetTime() <= time_ns);
-
- return pCluster;
-}
-
-
-#if 0
-const BlockEntry* Segment::Seek(
- long long time_ns,
- const Track* pTrack) const
-{
- assert(pTrack);
-
- if ((m_clusters == NULL) || (m_clusterCount <= 0))
- return pTrack->GetEOS();
-
- Cluster** const i = m_clusters;
- assert(i);
-
- {
- Cluster* const pCluster = *i;
- assert(pCluster);
- assert(pCluster->m_index == 0); //m_clusterCount > 0
- assert(pCluster->m_pSegment == this);
-
- if (time_ns <= pCluster->GetTime())
- return pCluster->GetEntry(pTrack);
- }
-
- Cluster** const j = i + m_clusterCount;
-
- if (pTrack->GetType() == 2) //audio
- {
- //TODO: we could decide to use cues for this, as we do for video.
- //But we only use it for video because looking around for a keyframe
- //can get expensive. Audio doesn't require anything special so a
- //straight cluster search is good enough (we assume).
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- Cluster* const pCluster = *mid;
- assert(pCluster);
- assert(pCluster->m_index == long(mid - m_clusters));
- assert(pCluster->m_pSegment == this);
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- while (lo > i)
- {
- Cluster* const pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- const BlockEntry* const pBE = pCluster->GetEntry(pTrack);
-
- if ((pBE != 0) && !pBE->EOS())
- return pBE;
-
- //landed on empty cluster (no entries)
- }
-
- return pTrack->GetEOS(); //weird
- }
-
- assert(pTrack->GetType() == 1); //video
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- Cluster* const pCluster = *mid;
- assert(pCluster);
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- Cluster* pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- {
- const BlockEntry* const pBE = pCluster->GetEntry(pTrack, time_ns);
-
- if ((pBE != 0) && !pBE->EOS()) //found a keyframe
- return pBE;
- }
-
- const VideoTrack* const pVideo = static_cast<const VideoTrack*>(pTrack);
-
- while (lo != i)
- {
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- const BlockEntry* const pBlockEntry = pCluster->GetMaxKey(pVideo);
-
- if ((pBlockEntry != 0) && !pBlockEntry->EOS())
- return pBlockEntry;
- }
-
- //weird: we're on the first cluster, but no keyframe found
- //should never happen but we must return something anyway
-
- return pTrack->GetEOS();
-}
-#endif
-
-
-#if 0
-bool Segment::SearchCues(
- long long time_ns,
- Track* pTrack,
- Cluster*& pCluster,
- const BlockEntry*& pBlockEntry,
- const CuePoint*& pCP,
- const CuePoint::TrackPosition*& pTP)
-{
- if (pTrack->GetType() != 1) //not video
- return false; //TODO: for now, just handle video stream
-
- if (m_pCues == NULL)
- return false;
-
- if (!m_pCues->Find(time_ns, pTrack, pCP, pTP))
- return false; //weird
-
- assert(pCP);
- assert(pTP);
- assert(pTP->m_track == pTrack->GetNumber());
-
- //We have the cue point and track position we want,
- //so we now need to search for the cluster having
- //the indicated position.
-
- return GetCluster(pCP, pTP, pCluster, pBlockEntry);
-}
-#endif
-
-
-const Tracks* Segment::GetTracks() const
-{
- return m_pTracks;
-}
-
-
-const SegmentInfo* Segment::GetInfo() const
-{
- return m_pInfo;
-}
-
-
-const Cues* Segment::GetCues() const
-{
- return m_pCues;
-}
-
-
-const SeekHead* Segment::GetSeekHead() const
-{
- return m_pSeekHead;
-}
-
-
-long long Segment::GetDuration() const
-{
- assert(m_pInfo);
- return m_pInfo->GetDuration();
-}
-
-
-SegmentInfo::SegmentInfo(
- Segment* pSegment,
- long long start,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_pMuxingAppAsUTF8(NULL),
- m_pWritingAppAsUTF8(NULL),
- m_pTitleAsUTF8(NULL)
-{
-}
-
-SegmentInfo::~SegmentInfo()
-{
- delete[] m_pMuxingAppAsUTF8;
- m_pMuxingAppAsUTF8 = NULL;
-
- delete[] m_pWritingAppAsUTF8;
- m_pWritingAppAsUTF8 = NULL;
-
- delete[] m_pTitleAsUTF8;
- m_pTitleAsUTF8 = NULL;
-}
-
-
-long SegmentInfo::Parse()
-{
- assert(m_pMuxingAppAsUTF8 == NULL);
- assert(m_pWritingAppAsUTF8 == NULL);
- assert(m_pTitleAsUTF8 == NULL);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = m_start;
- const long long stop = m_start + m_size;
-
- m_timecodeScale = 1000000;
- m_duration = -1;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x0AD7B1) //Timecode Scale
- {
- m_timecodeScale = UnserializeUInt(pReader, pos, size);
-
- if (m_timecodeScale <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0489) //Segment duration
- {
- const long status = UnserializeFloat(
- pReader,
- pos,
- size,
- m_duration);
-
- if (status < 0)
- return status;
-
- if (m_duration < 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0D80) //MuxingApp
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- m_pMuxingAppAsUTF8);
-
- if (status)
- return status;
- }
- else if (id == 0x1741) //WritingApp
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- m_pWritingAppAsUTF8);
-
- if (status)
- return status;
- }
- else if (id == 0x3BA9) //Title
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- m_pTitleAsUTF8);
-
- if (status)
- return status;
- }
-
- pos += size;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- return 0;
-}
-
-
-long long SegmentInfo::GetTimeCodeScale() const
-{
- return m_timecodeScale;
-}
-
-
-long long SegmentInfo::GetDuration() const
-{
- if (m_duration < 0)
- return -1;
-
- assert(m_timecodeScale >= 1);
-
- const double dd = double(m_duration) * double(m_timecodeScale);
- const long long d = static_cast<long long>(dd);
-
- return d;
-}
-
-const char* SegmentInfo::GetMuxingAppAsUTF8() const
-{
- return m_pMuxingAppAsUTF8;
-}
-
-
-const char* SegmentInfo::GetWritingAppAsUTF8() const
-{
- return m_pWritingAppAsUTF8;
-}
-
-const char* SegmentInfo::GetTitleAsUTF8() const
-{
- return m_pTitleAsUTF8;
-}
-
-///////////////////////////////////////////////////////////////
-// ContentEncoding element
-ContentEncoding::ContentCompression::ContentCompression()
- : algo(0),
- settings(NULL) {
-}
-
-ContentEncoding::ContentCompression::~ContentCompression() {
- delete [] settings;
-}
-
-ContentEncoding::ContentEncryption::ContentEncryption()
- : algo(0),
- key_id(NULL),
- key_id_len(0),
- signature(NULL),
- signature_len(0),
- sig_key_id(NULL),
- sig_key_id_len(0),
- sig_algo(0),
- sig_hash_algo(0) {
-}
-
-ContentEncoding::ContentEncryption::~ContentEncryption() {
- delete [] key_id;
- delete [] signature;
- delete [] sig_key_id;
-}
-
-ContentEncoding::ContentEncoding()
- : compression_entries_(NULL),
- compression_entries_end_(NULL),
- encryption_entries_(NULL),
- encryption_entries_end_(NULL),
- encoding_order_(0),
- encoding_scope_(1),
- encoding_type_(0) {
-}
-
-ContentEncoding::~ContentEncoding() {
- ContentCompression** comp_i = compression_entries_;
- ContentCompression** const comp_j = compression_entries_end_;
-
- while (comp_i != comp_j) {
- ContentCompression* const comp = *comp_i++;
- delete comp;
- }
-
- delete [] compression_entries_;
-
- ContentEncryption** enc_i = encryption_entries_;
- ContentEncryption** const enc_j = encryption_entries_end_;
-
- while (enc_i != enc_j) {
- ContentEncryption* const enc = *enc_i++;
- delete enc;
- }
-
- delete [] encryption_entries_;
-}
-
-
-const ContentEncoding::ContentCompression*
-ContentEncoding::GetCompressionByIndex(unsigned long idx) const {
- const ptrdiff_t count = compression_entries_end_ - compression_entries_;
- assert(count >= 0);
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return compression_entries_[idx];
-}
-
-unsigned long ContentEncoding::GetCompressionCount() const {
- const ptrdiff_t count = compression_entries_end_ - compression_entries_;
- assert(count >= 0);
-
- return static_cast<unsigned long>(count);
-}
-
-const ContentEncoding::ContentEncryption*
-ContentEncoding::GetEncryptionByIndex(unsigned long idx) const {
- const ptrdiff_t count = encryption_entries_end_ - encryption_entries_;
- assert(count >= 0);
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return encryption_entries_[idx];
-}
-
-unsigned long ContentEncoding::GetEncryptionCount() const {
- const ptrdiff_t count = encryption_entries_end_ - encryption_entries_;
- assert(count >= 0);
-
- return static_cast<unsigned long>(count);
-}
-
-void ContentEncoding::ParseEncryptionEntry(
- long long start,
- long long size,
- IMkvReader* const pReader,
- ContentEncryption* const encryption) {
- assert(pReader);
- assert(encryption);
-
- long long pos = start;
- const long long stop = start + size;
-
- while (pos < stop) {
-#ifdef _DEBUG
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO: handle error case
- assert((pos + len) <= stop);
-#endif
-
- long long value;
- unsigned char* buf;
- size_t buf_len;
-
- if (Match(pReader, pos, 0x7E1, value)) {
- // ContentEncAlgo
- encryption->algo = value;
- } else if (Match(pReader, pos, 0x7E2, buf, buf_len)) {
- // ContentEncKeyID
- encryption->key_id = buf;
- encryption->key_id_len = buf_len;
- } else if (Match(pReader, pos, 0x7E3, buf, buf_len)) {
- // ContentSignature
- encryption->signature = buf;
- encryption->signature_len = buf_len;
- } else if (Match(pReader, pos, 0x7E4, buf, buf_len)) {
- // ContentSigKeyID
- encryption->sig_key_id = buf;
- encryption->sig_key_id_len = buf_len;
- } else if (Match(pReader, pos, 0x7E5, value)) {
- // ContentSigAlgo
- encoding_type_ = value;
- } else if (Match(pReader, pos, 0x7E6, value)) {
- // ContentSigHashAlgo
- encoding_type_ = value;
- } else {
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO: handle error case
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0); //TODO: handle error case
- assert((pos + len) <= stop);
-
- pos += len; //consume length of size
- assert((pos + size) <= stop);
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
- }
-}
-
-bool ContentEncoding::ParseContentEncodingEntry(long long start,
- long long size,
- IMkvReader* const pReader) {
- assert(pReader);
-
- long long pos = start;
- const long long stop = start + size;
-
- // Count ContentCompression and ContentEncryption elements.
- long long pos1 = start;
- int compression_count = 0;
- int encryption_count = 0;
-
- while (pos1 < stop) {
- long len;
- const long long id = ReadUInt(pReader, pos1, len);
- assert(id >= 0);
- assert((pos1 + len) <= stop);
-
- pos1 += len; //consume id
-
- const long long size = ReadUInt(pReader, pos1, len);
- assert(size >= 0);
- assert((pos1 + len) <= stop);
-
- pos1 += len; //consume length of size
-
- //pos now designates start of element
- if (id == 0x1034) // ContentCompression ID
- ++compression_count;
-
- if (id == 0x1035) // ContentEncryption ID
- ++encryption_count;
-
- pos1 += size; //consume payload
- assert(pos1 <= stop);
- }
-
- if (compression_count <= 0 && encryption_count <= 0)
- return false;
-
- if (compression_count > 0) {
- compression_entries_ = new ContentCompression*[compression_count];
- compression_entries_end_ = compression_entries_;
- }
-
- if (encryption_count > 0) {
- encryption_entries_ = new ContentEncryption*[encryption_count];
- encryption_entries_end_ = encryption_entries_;
- }
-
- while (pos < stop) {
-#ifdef _DEBUG
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO: handle error case
- assert((pos + len) <= stop);
-#endif
-
- long long value;
- if (Match(pReader, pos, 0x1031, value)) {
- // ContentEncodingOrder
- encoding_order_ = value;
- } else if (Match(pReader, pos, 0x1032, value)) {
- // ContentEncodingScope
- encoding_scope_ = value;
- assert(encoding_scope_ > 0);
- } else if (Match(pReader, pos, 0x1033, value)) {
- // ContentEncodingType
- encoding_type_ = value;
- } else {
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO: handle error case
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0); //TODO: handle error case
- assert((pos + len) <= stop);
-
- pos += len; //consume length of size
- assert((pos + size) <= stop);
-
- //pos now designates start of payload
-
- if (id == 0x1034) {
- // ContentCompression ID
- // TODO(fgaligan): Add code to parse ContentCompression elements.
- } else if (id == 0x1035) {
- // ContentEncryption ID
- ContentEncryption* const encryption = new ContentEncryption();
-
- ParseEncryptionEntry(pos, size, pReader, encryption);
- *encryption_entries_end_ = encryption;
- ++encryption_entries_end_;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
- }
-
- assert(pos == stop);
-
- return true;
-}
-
-Track::Track(
- Segment* pSegment,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_element_start(element_start),
- m_element_size(element_size),
- content_encoding_entries_(NULL),
- content_encoding_entries_end_(NULL)
-{
-}
-
-Track::~Track()
-{
- Info& info = const_cast<Info&>(m_info);
- info.Clear();
-
- ContentEncoding** i = content_encoding_entries_;
- ContentEncoding** const j = content_encoding_entries_end_;
-
- while (i != j) {
- ContentEncoding* const encoding = *i++;
- delete encoding;
- }
-
- delete [] content_encoding_entries_;
-}
-
-Track::Info::Info():
- nameAsUTF8(NULL),
- codecId(NULL),
- codecNameAsUTF8(NULL),
- codecPrivate(NULL),
- codecPrivateSize(0)
-{
-}
-
-Track::Info::~Info()
-{
- Clear();
-}
-
-void Track::Info::Clear()
-{
- delete[] nameAsUTF8;
- nameAsUTF8 = NULL;
-
- delete[] codecId;
- codecId = NULL;
-
- delete[] codecPrivate;
- codecPrivate = NULL;
- codecPrivateSize = 0;
-
- delete[] codecNameAsUTF8;
- codecNameAsUTF8 = NULL;
-}
-
-int Track::Info::CopyStr(char* Info::*str, Info& dst_) const
-{
- if (str == static_cast<char* Info::*>(NULL))
- return -1;
-
- char*& dst = dst_.*str;
-
- if (dst) //should be NULL already
- return -1;
-
- const char* const src = this->*str;
-
- if (src == NULL)
- return 0;
-
- const size_t len = strlen(src);
-
- dst = new (std::nothrow) char[len+1];
-
- if (dst == NULL)
- return -1;
-
- strcpy(dst, src);
-
- return 0;
-}
-
-
-int Track::Info::Copy(Info& dst) const
-{
- if (&dst == this)
- return 0;
-
- dst.type = type;
- dst.number = number;
- dst.uid = uid;
- dst.lacing = lacing;
- dst.settings = settings;
-
- //We now copy the string member variables from src to dst.
- //This involves memory allocation so in principle the operation
- //can fail (indeed, that's why we have Info::Copy), so we must
- //report this to the caller. An error return from this function
- //therefore implies that the copy was only partially successful.
-
- if (int status = CopyStr(&Info::nameAsUTF8, dst))
- return status;
-
- if (int status = CopyStr(&Info::codecId, dst))
- return status;
-
- if (int status = CopyStr(&Info::codecNameAsUTF8, dst))
- return status;
-
- if (codecPrivateSize > 0)
- {
- if (codecPrivate == NULL)
- return -1;
-
- if (dst.codecPrivate)
- return -1;
-
- if (dst.codecPrivateSize != 0)
- return -1;
-
- dst.codecPrivate = new (std::nothrow) unsigned char[codecPrivateSize];
-
- if (dst.codecPrivate == NULL)
- return -1;
-
- memcpy(dst.codecPrivate, codecPrivate, codecPrivateSize);
- dst.codecPrivateSize = codecPrivateSize;
- }
-
- return 0;
-}
-
-const BlockEntry* Track::GetEOS() const
-{
- return &m_eos;
-}
-
-long Track::GetType() const
-{
- return m_info.type;
-}
-
-long Track::GetNumber() const
-{
- return m_info.number;
-}
-
-unsigned long long Track::GetUid() const
-{
- return m_info.uid;
-}
-
-const char* Track::GetNameAsUTF8() const
-{
- return m_info.nameAsUTF8;
-}
-
-const char* Track::GetCodecNameAsUTF8() const
-{
- return m_info.codecNameAsUTF8;
-}
-
-
-const char* Track::GetCodecId() const
-{
- return m_info.codecId;
-}
-
-const unsigned char* Track::GetCodecPrivate(size_t& size) const
-{
- size = m_info.codecPrivateSize;
- return m_info.codecPrivate;
-}
-
-
-bool Track::GetLacing() const
-{
- return m_info.lacing;
-}
-
-
-long Track::GetFirst(const BlockEntry*& pBlockEntry) const
-{
- const Cluster* pCluster = m_pSegment->GetFirst();
-
- for (int i = 0; ; )
- {
- if (pCluster == NULL)
- {
- pBlockEntry = GetEOS();
- return 1;
- }
-
- if (pCluster->EOS())
- {
-#if 0
- if (m_pSegment->Unparsed() <= 0) //all clusters have been loaded
- {
- pBlockEntry = GetEOS();
- return 1;
- }
-#else
- if (m_pSegment->DoneParsing())
- {
- pBlockEntry = GetEOS();
- return 1;
- }
-#endif
-
- pBlockEntry = 0;
- return E_BUFFER_NOT_FULL;
- }
-
- long status = pCluster->GetFirst(pBlockEntry);
-
- if (status < 0) //error
- return status;
-
- if (pBlockEntry == 0) //empty cluster
- {
- pCluster = m_pSegment->GetNext(pCluster);
- continue;
- }
-
- for (;;)
- {
- const Block* const pBlock = pBlockEntry->GetBlock();
- assert(pBlock);
-
- const long long tn = pBlock->GetTrackNumber();
-
- if ((tn == m_info.number) && VetEntry(pBlockEntry))
- return 0;
-
- const BlockEntry* pNextEntry;
-
- status = pCluster->GetNext(pBlockEntry, pNextEntry);
-
- if (status < 0) //error
- return status;
-
- if (pNextEntry == 0)
- break;
-
- pBlockEntry = pNextEntry;
- }
-
- ++i;
-
- if (i >= 100)
- break;
-
- pCluster = m_pSegment->GetNext(pCluster);
- }
-
- //NOTE: if we get here, it means that we didn't find a block with
- //a matching track number. We interpret that as an error (which
- //might be too conservative).
-
- pBlockEntry = GetEOS(); //so we can return a non-NULL value
- return 1;
-}
-
-
-long Track::GetNext(
- const BlockEntry* pCurrEntry,
- const BlockEntry*& pNextEntry) const
-{
- assert(pCurrEntry);
- assert(!pCurrEntry->EOS()); //?
-
- const Block* const pCurrBlock = pCurrEntry->GetBlock();
- assert(pCurrBlock->GetTrackNumber() == m_info.number);
-
- const Cluster* pCluster = pCurrEntry->GetCluster();
- assert(pCluster);
- assert(!pCluster->EOS());
-
- long status = pCluster->GetNext(pCurrEntry, pNextEntry);
-
- if (status < 0) //error
- return status;
-
- for (int i = 0; ; )
- {
- while (pNextEntry)
- {
- const Block* const pNextBlock = pNextEntry->GetBlock();
- assert(pNextBlock);
-
- if (pNextBlock->GetTrackNumber() == m_info.number)
- return 0;
-
- pCurrEntry = pNextEntry;
-
- status = pCluster->GetNext(pCurrEntry, pNextEntry);
-
- if (status < 0) //error
- return status;
- }
-
- pCluster = m_pSegment->GetNext(pCluster);
-
- if (pCluster == NULL)
- {
- pNextEntry = GetEOS();
- return 1;
- }
-
- if (pCluster->EOS())
- {
-#if 0
- if (m_pSegment->Unparsed() <= 0) //all clusters have been loaded
- {
- pNextEntry = GetEOS();
- return 1;
- }
-#else
- if (m_pSegment->DoneParsing())
- {
- pNextEntry = GetEOS();
- return 1;
- }
-#endif
-
- //TODO: there is a potential O(n^2) problem here: we tell the
- //caller to (pre)load another cluster, which he does, but then he
- //calls GetNext again, which repeats the same search. This is
- //a pathological case, since the only way it can happen is if
- //there exists a long sequence of clusters none of which contain a
- // block from this track. One way around this problem is for the
- //caller to be smarter when he loads another cluster: don't call
- //us back until you have a cluster that contains a block from this
- //track. (Of course, that's not cheap either, since our caller
- //would have to scan the each cluster as it's loaded, so that
- //would just push back the problem.)
-
- pNextEntry = NULL;
- return E_BUFFER_NOT_FULL;
- }
-
- status = pCluster->GetFirst(pNextEntry);
-
- if (status < 0) //error
- return status;
-
- if (pNextEntry == NULL) //empty cluster
- continue;
-
- ++i;
-
- if (i >= 100)
- break;
- }
-
- //NOTE: if we get here, it means that we didn't find a block with
- //a matching track number after lots of searching, so we give
- //up trying.
-
- pNextEntry = GetEOS(); //so we can return a non-NULL value
- return 1;
-}
-
-const ContentEncoding*
-Track::GetContentEncodingByIndex(unsigned long idx) const {
- const ptrdiff_t count =
- content_encoding_entries_end_ - content_encoding_entries_;
- assert(count >= 0);
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return content_encoding_entries_[idx];
-}
-
-unsigned long Track::GetContentEncodingCount() const {
- const ptrdiff_t count =
- content_encoding_entries_end_ - content_encoding_entries_;
- assert(count >= 0);
-
- return static_cast<unsigned long>(count);
-}
-
-void Track::ParseContentEncodingsEntry(long long start, long long size) {
- IMkvReader* const pReader = m_pSegment->m_pReader;
- assert(pReader);
-
- long long pos = start;
- const long long stop = start + size;
-
- // Count ContentEncoding elements.
- long long pos1 = start;
- int count = 0;
-
- while (pos1 < stop) {
- long len;
- const long long id = ReadUInt(pReader, pos1, len);
- assert(id >= 0);
- assert((pos1 + len) <= stop);
-
- pos1 += len; //consume id
-
- const long long size = ReadUInt(pReader, pos1, len);
- assert(size >= 0);
- assert((pos1 + len) <= stop);
-
- pos1 += len; //consume length of size
-
- //pos now designates start of element
- if (id == 0x2240) // ContentEncoding ID
- ++count;
-
- pos1 += size; //consume payload
- assert(pos1 <= stop);
- }
-
- if (count <= 0)
- return;
-
- content_encoding_entries_ = new ContentEncoding*[count];
- content_encoding_entries_end_ = content_encoding_entries_;
-
- while (pos < stop) {
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long size1 = ReadUInt(pReader, pos, len);
- assert(size1 >= 0);
- assert((pos + len) <= stop);
-
- pos += len; //consume length of size
-
- //pos now designates start of element
- if (id == 0x2240) { // ContentEncoding ID
- ContentEncoding* const content_encoding = new ContentEncoding();
-
- if (!content_encoding->ParseContentEncodingEntry(pos, size1, pReader)) {
- delete content_encoding;
- } else {
- *content_encoding_entries_end_ = content_encoding;
- ++content_encoding_entries_end_;
- }
- }
-
- pos += size1; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- return;
-}
-
-Track::EOSBlock::EOSBlock() :
- BlockEntry(NULL, LONG_MIN)
-{
-}
-
-BlockEntry::Kind Track::EOSBlock::GetKind() const
-{
- return kBlockEOS;
-}
-
-
-const Block* Track::EOSBlock::GetBlock() const
-{
- return NULL;
-}
-
-
-VideoTrack::VideoTrack(
- Segment* pSegment,
- long long element_start,
- long long element_size) :
- Track(pSegment, element_start, element_size)
-{
-}
-
-
-long VideoTrack::Parse(
- Segment* pSegment,
- const Info& i,
- long long elem_st,
- long long elem_sz,
- VideoTrack*& pTrack)
-{
- if (pTrack)
- return -1;
-
- if (i.type != Track::kVideo)
- return -1;
-
- long long width = 0;
- long long height = 0;
- double rate = 0.0;
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- const Settings& s = i.settings;
- assert(s.start >= 0);
- assert(s.size >= 0);
-
- long long pos = s.start;
- assert(pos >= 0);
-
- const long long stop = pos + s.size;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x30) //pixel width
- {
- width = UnserializeUInt(pReader, pos, size);
-
- if (width <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x3A) //pixel height
- {
- height = UnserializeUInt(pReader, pos, size);
-
- if (height <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x0383E3) //frame rate
- {
- const long status = UnserializeFloat(
- pReader,
- pos,
- size,
- rate);
-
- if (status < 0)
- return status;
-
- if (rate <= 0)
- return E_FILE_FORMAT_INVALID;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- pTrack = new (std::nothrow) VideoTrack(pSegment, elem_st, elem_sz);
-
- if (pTrack == NULL)
- return -1; //generic error
-
- const int status = i.Copy(pTrack->m_info);
-
- if (status)
- return status;
-
- pTrack->m_width = width;
- pTrack->m_height = height;
- pTrack->m_rate = rate;
-
- return 0; //success
-}
-
-
-bool VideoTrack::VetEntry(const BlockEntry* pBlockEntry) const
-{
- assert(pBlockEntry);
-
- const Block* const pBlock = pBlockEntry->GetBlock();
- assert(pBlock);
- assert(pBlock->GetTrackNumber() == m_info.number);
-
- return pBlock->IsKey();
-}
-
-
-long VideoTrack::Seek(
- long long time_ns,
- const BlockEntry*& pResult) const
-{
- const long status = GetFirst(pResult);
-
- if (status < 0) //buffer underflow, etc
- return status;
-
- assert(pResult);
-
- if (pResult->EOS())
- return 0;
-
- const Cluster* pCluster = pResult->GetCluster();
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
-
- if (time_ns <= pResult->GetBlock()->GetTime(pCluster))
- return 0;
-
- Cluster** const clusters = m_pSegment->m_clusters;
- assert(clusters);
-
- const long count = m_pSegment->GetCount(); //loaded only, not pre-loaded
- assert(count > 0);
-
- Cluster** const i = clusters + pCluster->GetIndex();
- assert(i);
- assert(*i == pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- Cluster** const j = clusters + count;
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- pCluster = *mid;
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
- assert(pCluster->GetIndex() == long(mid - m_pSegment->m_clusters));
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- pResult = pCluster->GetEntry(this, time_ns);
-
- if ((pResult != 0) && !pResult->EOS()) //found a keyframe
- return 0;
-
- while (lo != i)
- {
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
-#if 0
- //TODO:
- //We need to handle the case when a cluster
- //contains multiple keyframes. Simply returning
- //the largest keyframe on the cluster isn't
- //good enough.
- pResult = pCluster->GetMaxKey(this);
-#else
- pResult = pCluster->GetEntry(this, time_ns);
-#endif
-
- if ((pResult != 0) && !pResult->EOS())
- return 0;
- }
-
- //weird: we're on the first cluster, but no keyframe found
- //should never happen but we must return something anyway
-
- pResult = GetEOS();
- return 0;
-}
-
-
-long long VideoTrack::GetWidth() const
-{
- return m_width;
-}
-
-
-long long VideoTrack::GetHeight() const
-{
- return m_height;
-}
-
-
-double VideoTrack::GetFrameRate() const
-{
- return m_rate;
-}
-
-
-AudioTrack::AudioTrack(
- Segment* pSegment,
- long long element_start,
- long long element_size) :
- Track(pSegment, element_start, element_size)
-{
-}
-
-
-long AudioTrack::Parse(
- Segment* pSegment,
- const Info& i,
- long long elem_st,
- long long elem_sz,
- AudioTrack*& pTrack)
-{
- if (pTrack)
- return -1;
-
- if (i.type != Track::kAudio)
- return -1;
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- const Settings& s = i.settings;
- assert(s.start >= 0);
- assert(s.size >= 0);
-
- long long pos = s.start;
- assert(pos >= 0);
-
- const long long stop = pos + s.size;
-
- double rate = 8000.0;
- long long channels = 1;
- long long bit_depth = 0;
-
- while (pos < stop)
- {
- long long id, size;
-
- long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (id == 0x35) //Sample Rate
- {
- status = UnserializeFloat(pReader, pos, size, rate);
-
- if (status < 0)
- return status;
-
- if (rate <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x1F) //Channel Count
- {
- channels = UnserializeUInt(pReader, pos, size);
-
- if (channels <= 0)
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x2264) //Bit Depth
- {
- bit_depth = UnserializeUInt(pReader, pos, size);
-
- if (bit_depth <= 0)
- return E_FILE_FORMAT_INVALID;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- pTrack = new (std::nothrow) AudioTrack(pSegment, elem_st, elem_sz);
-
- if (pTrack == NULL)
- return -1; //generic error
-
- const int status = i.Copy(pTrack->m_info);
-
- if (status)
- return status;
-
- pTrack->m_rate = rate;
- pTrack->m_channels = channels;
- pTrack->m_bitDepth = bit_depth;
-
- return 0; //success
-}
-
-
-bool AudioTrack::VetEntry(const BlockEntry* pBlockEntry) const
-{
- assert(pBlockEntry);
-
- const Block* const pBlock = pBlockEntry->GetBlock();
- assert(pBlock);
- assert(pBlock->GetTrackNumber() == m_info.number);
-
- return true;
-}
-
-
-long AudioTrack::Seek(
- long long time_ns,
- const BlockEntry*& pResult) const
-{
- const long status = GetFirst(pResult);
-
- if (status < 0) //buffer underflow, etc
- return status;
-
- assert(pResult);
-
- if (pResult->EOS())
- return 0;
-
- const Cluster* pCluster = pResult->GetCluster();
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
-
- if (time_ns <= pResult->GetBlock()->GetTime(pCluster))
- return 0;
-
- Cluster** const clusters = m_pSegment->m_clusters;
- assert(clusters);
-
- const long count = m_pSegment->GetCount(); //loaded only, not preloaded
- assert(count > 0);
-
- Cluster** const i = clusters + pCluster->GetIndex();
- assert(i);
- assert(*i == pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- Cluster** const j = clusters + count;
-
- Cluster** lo = i;
- Cluster** hi = j;
-
- while (lo < hi)
- {
- //INVARIANT:
- //[i, lo) <= time_ns
- //[lo, hi) ?
- //[hi, j) > time_ns
-
- Cluster** const mid = lo + (hi - lo) / 2;
- assert(mid < hi);
-
- pCluster = *mid;
- assert(pCluster);
- assert(pCluster->GetIndex() >= 0);
- assert(pCluster->GetIndex() == long(mid - m_pSegment->m_clusters));
-
- const long long t = pCluster->GetTime();
-
- if (t <= time_ns)
- lo = mid + 1;
- else
- hi = mid;
-
- assert(lo <= hi);
- }
-
- assert(lo == hi);
- assert(lo > i);
- assert(lo <= j);
-
- while (lo > i)
- {
- pCluster = *--lo;
- assert(pCluster);
- assert(pCluster->GetTime() <= time_ns);
-
- pResult = pCluster->GetEntry(this);
-
- if ((pResult != 0) && !pResult->EOS())
- return 0;
-
- //landed on empty cluster (no entries)
- }
-
- pResult = GetEOS(); //weird
- return 0;
-}
-
-
-double AudioTrack::GetSamplingRate() const
-{
- return m_rate;
-}
-
-
-long long AudioTrack::GetChannels() const
-{
- return m_channels;
-}
-
-long long AudioTrack::GetBitDepth() const
-{
- return m_bitDepth;
-}
-
-Tracks::Tracks(
- Segment* pSegment,
- long long start,
- long long size_,
- long long element_start,
- long long element_size) :
- m_pSegment(pSegment),
- m_start(start),
- m_size(size_),
- m_element_start(element_start),
- m_element_size(element_size),
- m_trackEntries(NULL),
- m_trackEntriesEnd(NULL)
-{
-}
-
-
-long Tracks::Parse()
-{
- assert(m_trackEntries == NULL);
- assert(m_trackEntriesEnd == NULL);
-
- const long long stop = m_start + m_size;
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- int count = 0;
- long long pos = m_start;
-
- while (pos < stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- if (size == 0) //weird
- continue;
-
- if (id == 0x2E) //TrackEntry ID
- ++count;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- if (count <= 0)
- return 0; //success
-
- m_trackEntries = new (std::nothrow) Track*[count];
-
- if (m_trackEntries == NULL)
- return -1;
-
- m_trackEntriesEnd = m_trackEntries;
-
- pos = m_start;
-
- while (pos < stop)
- {
- const long long element_start = pos;
-
- long long id, payload_size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- stop,
- id,
- payload_size);
-
- if (status < 0) //error
- return status;
-
- if (payload_size == 0) //weird
- continue;
-
- const long long payload_stop = pos + payload_size;
- assert(payload_stop <= stop); //checked in ParseElement
-
- const long long element_size = payload_stop - element_start;
-
- if (id == 0x2E) //TrackEntry ID
- {
- Track*& pTrack = *m_trackEntriesEnd;
- pTrack = NULL;
-
- const long status = ParseTrackEntry(
- pos,
- payload_size,
- element_start,
- element_size,
- pTrack);
-
- if (status)
- return status;
-
- if (pTrack)
- ++m_trackEntriesEnd;
- }
-
- pos = payload_stop;
- assert(pos <= stop);
- }
-
- assert(pos == stop);
-
- return 0; //success
-}
-
-
-unsigned long Tracks::GetTracksCount() const
-{
- const ptrdiff_t result = m_trackEntriesEnd - m_trackEntries;
- assert(result >= 0);
-
- return static_cast<unsigned long>(result);
-}
-
-long Tracks::ParseTrackEntry(
- long long track_start,
- long long track_size,
- long long elem_st,
- long long elem_sz,
- Track*& pTrack) const
-{
- if (pTrack)
- return -1;
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = track_start;
- const long long track_stop = track_start + track_size;
-
- Track::Info i;
-
- i.type = 0;
- i.number = 0;
- i.uid = 0;
-
- Track::Settings v;
- v.start = -1;
- v.size = -1;
-
- Track::Settings a;
- a.start = -1;
- a.size = -1;
-
- Track::Settings e; //content_encodings_settings;
- e.start = -1;
- e.size = -1;
-
- long long lacing = 1; //default is true
-
- while (pos < track_stop)
- {
- long long id, size;
-
- const long status = ParseElementHeader(
- pReader,
- pos,
- track_stop,
- id,
- size);
-
- if (status < 0) //error
- return status;
-
- const long long start = pos;
-
- if (id == 0x60) // VideoSettings ID
- {
- if (size < 0)
- return E_FILE_FORMAT_INVALID;
-
- v.start = start;
- v.size = size;
- }
- else if (id == 0x61) // AudioSettings ID
- {
- if (size < 0)
- return E_FILE_FORMAT_INVALID;
-
- a.start = start;
- a.size = size;
- }
- else if (id == 0x2D80) // ContentEncodings ID
- {
- if (size < 0)
- return E_FILE_FORMAT_INVALID;
-
- e.start = start;
- e.size = size;
- }
- else if (id == 0x33C5) //Track UID
- {
- if ((size <= 0) || (size > 8))
- return E_FILE_FORMAT_INVALID;
-
- i.uid = 0;
-
- long long pos_ = start;
- const long long pos_end = start + size;
-
- while (pos_ != pos_end)
- {
- unsigned char b;
-
- const int status = pReader->Read(pos_, 1, &b);
-
- if (status)
- return status;
-
- i.uid <<= 8;
- i.uid |= b;
-
- ++pos_;
- }
- }
- else if (id == 0x57) //Track Number
- {
- const long long num = UnserializeUInt(pReader, pos, size);
-
- if ((num <= 0) || (num > 127))
- return E_FILE_FORMAT_INVALID;
-
- i.number = static_cast<long>(num);
- }
- else if (id == 0x03) //Track Type
- {
- const long long type = UnserializeUInt(pReader, pos, size);
-
- if ((type <= 0) || (type > 254))
- return E_FILE_FORMAT_INVALID;
-
- i.type = static_cast<long>(type);
- }
- else if (id == 0x136E) //Track Name
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- i.nameAsUTF8);
-
- if (status)
- return status;
- }
- else if (id == 0x06) //CodecID
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- i.codecId);
-
- if (status)
- return status;
- }
- else if (id == 0x1C) //lacing
- {
- lacing = UnserializeUInt(pReader, pos, size);
-
- if ((lacing < 0) || (lacing > 1))
- return E_FILE_FORMAT_INVALID;
- }
- else if (id == 0x23A2) //Codec Private
- {
- delete[] i.codecPrivate;
- i.codecPrivate = NULL;
- i.codecPrivateSize = 0;
-
- if (size <= 0)
- return E_FILE_FORMAT_INVALID;
-
- const size_t buflen = static_cast<size_t>(size);
-
- typedef unsigned char* buf_t;
-
- const buf_t buf = new (std::nothrow) unsigned char[buflen];
-
- if (buf == NULL)
- return -1;
-
- const int status = pReader->Read(pos, buflen, buf);
-
- if (status)
- {
- delete[] buf;
- return status;
- }
-
- i.codecPrivate = buf;
- i.codecPrivateSize = buflen;
- }
- else if (id == 0x058688) //Codec Name
- {
- const long status = UnserializeString(
- pReader,
- pos,
- size,
- i.codecNameAsUTF8);
-
- if (status)
- return status;
- }
-
- pos += size; //consume payload
- assert(pos <= track_stop);
- }
-
- assert(pos == track_stop);
-
- if (i.number <= 0) //not specified
- return E_FILE_FORMAT_INVALID;
-
- if (GetTrackByNumber(i.number))
- return E_FILE_FORMAT_INVALID;
-
- if (i.type <= 0) //not specified
- return E_FILE_FORMAT_INVALID;
-
- if ((i.type != Track::kVideo) && (i.type != Track::kAudio))
- {
- //TODO(matthewjheaney): go ahead and create a "generic" track
- //object, so that GetTrackByXXX always returns something, even
- //if the object it returns has a type that is not kVideo or kAudio.
-
- return 0; //no error
- }
-
- i.lacing = (lacing > 0) ? true : false;
-
- long status;
-
- if (i.type == Track::kVideo)
- {
- if (v.start < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (a.start >= 0)
- return E_FILE_FORMAT_INVALID;
-
- i.settings = v;
-
- VideoTrack* p = NULL;
-
- status = VideoTrack::Parse(m_pSegment, i, elem_st, elem_sz, p);
- pTrack = p;
- }
- else
- {
- assert(i.type == Track::kAudio);
-
- if (a.start < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (v.start >= 0)
- return E_FILE_FORMAT_INVALID;
-
- i.settings = a;
-
- AudioTrack* p = NULL;
-
- status = AudioTrack::Parse(m_pSegment, i, elem_st, elem_sz, p);
- pTrack = p;
- }
-
- if (status)
- return status;
-
- assert(pTrack);
-
- if (e.start >= 0)
- pTrack->ParseContentEncodingsEntry(e.start, e.size);
-
- return 0; //success
-}
-
-
-Tracks::~Tracks()
-{
- Track** i = m_trackEntries;
- Track** const j = m_trackEntriesEnd;
-
- while (i != j)
- {
- Track* const pTrack = *i++;
- delete pTrack;
- }
-
- delete[] m_trackEntries;
-}
-
-const Track* Tracks::GetTrackByNumber(long tn) const
-{
- if (tn < 0)
- return NULL;
-
- Track** i = m_trackEntries;
- Track** const j = m_trackEntriesEnd;
-
- while (i != j)
- {
- Track* const pTrack = *i++;
-
- if (pTrack == NULL)
- continue;
-
- if (tn == pTrack->GetNumber())
- return pTrack;
- }
-
- return NULL; //not found
-}
-
-
-const Track* Tracks::GetTrackByIndex(unsigned long idx) const
-{
- const ptrdiff_t count = m_trackEntriesEnd - m_trackEntries;
-
- if (idx >= static_cast<unsigned long>(count))
- return NULL;
-
- return m_trackEntries[idx];
-}
-
-#if 0
-long long Cluster::Unparsed() const
-{
- if (m_timecode < 0) //not even partially loaded
- return LLONG_MAX;
-
- assert(m_pos >= m_element_start);
- //assert(m_element_size > m_size);
-
- const long long element_stop = m_element_start + m_element_size;
- assert(m_pos <= element_stop);
-
- const long long result = element_stop - m_pos;
- assert(result >= 0);
-
- return result;
-}
-#endif
-
-
-long Cluster::Load(long long& pos, long& len) const
-{
- assert(m_pSegment);
- assert(m_pos >= m_element_start);
-
- if (m_timecode >= 0) //at least partially loaded
- return 0;
-
- assert(m_pos == m_element_start);
- assert(m_element_size < 0);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- const int status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
- assert((total < 0) || (m_pos <= total)); //TODO: verify this
-
- pos = m_pos;
-
- long long cluster_size = -1;
-
- {
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error or underflow
- return static_cast<long>(result);
-
- if (result > 0) //underflow (weird)
- return E_BUFFER_NOT_FULL;
-
- //if ((pos + len) > segment_stop)
- // return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id_ = ReadUInt(pReader, pos, len);
-
- if (id_ < 0) //error
- return static_cast<long>(id_);
-
- if (id_ != 0x0F43B675) //Cluster ID
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume id
-
- //read cluster size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- //if ((pos + len) > segment_stop)
- // return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(cluster_size);
-
- if (size == 0)
- return E_FILE_FORMAT_INVALID; //TODO: verify this
-
- pos += len; //consume length of size of element
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size != unknown_size)
- cluster_size = size;
- }
-
- //pos points to start of payload
-
-#if 0
- len = static_cast<long>(size_);
-
- if (cluster_stop > avail)
- return E_BUFFER_NOT_FULL;
-#endif
-
- long long timecode = -1;
- long long new_pos = -1;
- bool bBlock = false;
-
- long long cluster_stop = (cluster_size < 0) ? -1 : pos + cluster_size;
-
- for (;;)
- {
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- break;
-
- //Parse ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0)
- return E_FILE_FORMAT_INVALID;
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- break;
-
- if (id == 0x0C53BB6B) //Cues ID
- break;
-
- pos += len; //consume ID field
-
- //Parse Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume size field
-
- if ((cluster_stop >= 0) && (pos > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- //pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- if ((cluster_stop >= 0) && ((pos + size) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if (id == 0x67) //TimeCode ID
- {
- len = static_cast<long>(size);
-
- if ((pos + size) > avail)
- return E_BUFFER_NOT_FULL;
-
- timecode = UnserializeUInt(pReader, pos, size);
-
- if (timecode < 0) //error (or underflow)
- return static_cast<long>(timecode);
-
- new_pos = pos + size;
-
- if (bBlock)
- break;
- }
- else if (id == 0x20) //BlockGroup ID
- {
- bBlock = true;
- break;
- }
- else if (id == 0x23) //SimpleBlock ID
- {
- bBlock = true;
- break;
- }
-
- pos += size; //consume payload
- assert((cluster_stop < 0) || (pos <= cluster_stop));
- }
-
- assert((cluster_stop < 0) || (pos <= cluster_stop));
-
- if (timecode < 0) //no timecode found
- return E_FILE_FORMAT_INVALID;
-
- if (!bBlock)
- return E_FILE_FORMAT_INVALID;
-
- m_pos = new_pos; //designates position just beyond timecode payload
- m_timecode = timecode; // m_timecode >= 0 means we're partially loaded
-
- if (cluster_size >= 0)
- m_element_size = cluster_stop - m_element_start;
-
- return 0;
-}
-
-
-long Cluster::Parse(long long& pos, long& len) const
-{
- long status = Load(pos, len);
-
- if (status < 0)
- return status;
-
- assert(m_pos >= m_element_start);
- assert(m_timecode >= 0);
- //assert(m_size > 0);
- //assert(m_element_size > m_size);
-
- const long long cluster_stop =
- (m_element_size < 0) ? -1 : m_element_start + m_element_size;
-
- if ((cluster_stop >= 0) && (m_pos >= cluster_stop))
- return 1; //nothing else to do
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- pos = m_pos;
-
- for (;;)
- {
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- break;
-
- if ((total >= 0) && (pos >= total))
- {
- if (m_element_size < 0)
- m_element_size = pos - m_element_start;
-
- break;
- }
-
- //Parse ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0) //weird
- return E_FILE_FORMAT_INVALID;
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if ((id == 0x0F43B675) || (id == 0x0C53BB6B)) //Cluster or Cues ID
- {
- if (m_element_size < 0)
- m_element_size = pos - m_element_start;
-
- break;
- }
-
- pos += len; //consume ID field
-
- //Parse Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume size field
-
- if ((cluster_stop >= 0) && (pos > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- //pos now points to start of payload
-
- if (size == 0) //weird
- continue;
-
- //const long long block_start = pos;
- const long long block_stop = pos + size;
-
- if (cluster_stop >= 0)
- {
- if (block_stop > cluster_stop)
- return E_FILE_FORMAT_INVALID;
- }
- else if ((total >= 0) && (block_stop > total))
- {
- m_element_size = total - m_element_start;
- pos = total;
- break;
- }
- else if (block_stop > avail)
- {
- len = static_cast<long>(size);
- return E_BUFFER_NOT_FULL;
- }
-
- Cluster* const this_ = const_cast<Cluster*>(this);
-
- if (id == 0x20) //BlockGroup
- return this_->ParseBlockGroup(size, pos, len);
-
- if (id == 0x23) //SimpleBlock
- return this_->ParseSimpleBlock(size, pos, len);
-
- pos += size; //consume payload
- assert((cluster_stop < 0) || (pos <= cluster_stop));
- }
-
- assert(m_element_size > 0);
-
- m_pos = pos;
- assert((cluster_stop < 0) || (m_pos <= cluster_stop));
-
- if (m_entries_count > 0)
- {
- const long idx = m_entries_count - 1;
-
- const BlockEntry* const pLast = m_entries[idx];
- assert(pLast);
-
- const Block* const pBlock = pLast->GetBlock();
- assert(pBlock);
-
- const long long start = pBlock->m_start;
-
- if ((total >= 0) && (start > total))
- return -1; //defend against trucated stream
-
- const long long size = pBlock->m_size;
-
- const long long stop = start + size;
- assert((cluster_stop < 0) || (stop <= cluster_stop));
-
- if ((total >= 0) && (stop > total))
- return -1; //defend against trucated stream
- }
-
- return 1; //no more entries
-}
-
-
-long Cluster::ParseSimpleBlock(
- long long block_size,
- long long& pos,
- long& len)
-{
- const long long block_start = pos;
- const long long block_stop = pos + block_size;
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- long status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- //parse track number
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long track = ReadUInt(pReader, pos, len);
-
- if (track < 0) //error
- return static_cast<long>(track);
-
- if (track == 0)
- return E_FILE_FORMAT_INVALID;
-
-#if 0
- //TODO(matthewjheaney)
- //This turned out to be too conservative. The problem is that
- //if we see a track header in the tracks element with an unsupported
- //track type, we throw that track header away, so it is not present
- //in the track map. But even though we don't understand the track
- //header, there are still blocks in the cluster with that track
- //number. It was our decision to ignore that track header, so it's
- //up to us to deal with blocks associated with that track -- we
- //cannot simply report an error since technically there's nothing
- //wrong with the file.
- //
- //For now we go ahead and finish the parse, creating a block entry
- //for this block. This is somewhat wasteful, because without a
- //track header there's nothing you can do with the block. What
- //we really need here is a special return value that indicates to
- //the caller that he should ignore this particular block, and
- //continue parsing.
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(track);
-
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return E_FILE_FORMAT_INVALID;
-#endif
-
- pos += len; //consume track number
-
- if ((pos + 2) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 2) > avail)
- {
- len = 2;
- return E_BUFFER_NOT_FULL;
- }
-
- pos += 2; //consume timecode
-
- if ((pos + 1) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- unsigned char flags;
-
- status = pReader->Read(pos, 1, &flags);
-
- if (status < 0) //error or underflow
- {
- len = 1;
- return status;
- }
-
- ++pos; //consume flags byte
- assert(pos <= avail);
-
- if (pos >= block_stop)
- return E_FILE_FORMAT_INVALID;
-
- const int lacing = int(flags & 0x06) >> 1;
-
- if ((lacing != 0) && (block_stop > avail))
- {
- len = static_cast<long>(block_stop - pos);
- return E_BUFFER_NOT_FULL;
- }
-
- status = CreateBlock(0x23, block_start, block_size); //simple block id
-
- if (status != 0)
- return status;
-
- m_pos = block_stop;
-
- return 0; //success
-}
-
-
-long Cluster::ParseBlockGroup(
- long long payload_size,
- long long& pos,
- long& len)
-{
- const long long payload_start = pos;
- const long long payload_stop = pos + payload_size;
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long total, avail;
-
- long status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- if ((total >= 0) && (payload_stop > total))
- return E_FILE_FORMAT_INVALID;
-
- if (payload_stop > avail)
- {
- len = static_cast<long>(payload_size);
- return E_BUFFER_NOT_FULL;
- }
-
- while (pos < payload_stop)
- {
- //parse sub-block element ID
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id == 0) //not a value ID
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume ID field
-
- //Parse Size
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field
-
- //pos now points to start of sub-block group payload
-
- if (pos > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID;
-
- if (id != 0x21) //sub-part of BlockGroup is not a Block
- {
- pos += size; //consume sub-part of block group
-
- if (pos > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- continue;
- }
-
- const long long block_stop = pos + size;
-
- if (block_stop > payload_stop)
- return E_FILE_FORMAT_INVALID;
-
- //parse track number
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((pos + len) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long track = ReadUInt(pReader, pos, len);
-
- if (track < 0) //error
- return static_cast<long>(track);
-
- if (track == 0)
- return E_FILE_FORMAT_INVALID;
-
-#if 0
- //TODO(matthewjheaney)
- //This turned out to be too conservative. The problem is that
- //if we see a track header in the tracks element with an unsupported
- //track type, we throw that track header away, so it is not present
- //in the track map. But even though we don't understand the track
- //header, there are still blocks in the cluster with that track
- //number. It was our decision to ignore that track header, so it's
- //up to us to deal with blocks associated with that track -- we
- //cannot simply report an error since technically there's nothing
- //wrong with the file.
- //
- //For now we go ahead and finish the parse, creating a block entry
- //for this block. This is somewhat wasteful, because without a
- //track header there's nothing you can do with the block. What
- //we really need here is a special return value that indicates to
- //the caller that he should ignore this particular block, and
- //continue parsing.
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(track);
-
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return E_FILE_FORMAT_INVALID;
-#endif
-
- pos += len; //consume track number
-
- if ((pos + 2) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 2) > avail)
- {
- len = 2;
- return E_BUFFER_NOT_FULL;
- }
-
- pos += 2; //consume timecode
-
- if ((pos + 1) > block_stop)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- unsigned char flags;
-
- status = pReader->Read(pos, 1, &flags);
-
- if (status < 0) //error or underflow
- {
- len = 1;
- return status;
- }
-
- ++pos; //consume flags byte
- assert(pos <= avail);
-
- if (pos >= block_stop)
- return E_FILE_FORMAT_INVALID;
-
- const int lacing = int(flags & 0x06) >> 1;
-
- if ((lacing != 0) && (block_stop > avail))
- {
- len = static_cast<long>(block_stop - pos);
- return E_BUFFER_NOT_FULL;
- }
-
- pos = block_stop; //consume block-part of block group
- assert(pos <= payload_stop);
- }
-
- assert(pos == payload_stop);
-
- status = CreateBlock(0x20, payload_start, payload_size); //BlockGroup ID
-
- if (status != 0)
- return status;
-
- m_pos = payload_stop;
-
- return 0; //success
-}
-
-
-long Cluster::GetEntry(long index, const mkvparser::BlockEntry*& pEntry) const
-{
- assert(m_pos >= m_element_start);
-
- pEntry = NULL;
-
- if (index < 0)
- return -1; //generic error
-
- if (m_entries_count < 0)
- return E_BUFFER_NOT_FULL;
-
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count <= m_entries_size);
-
- if (index < m_entries_count)
- {
- pEntry = m_entries[index];
- assert(pEntry);
-
- return 1; //found entry
- }
-
- if (m_element_size < 0) //we don't know cluster end yet
- return E_BUFFER_NOT_FULL; //underflow
-
- const long long element_stop = m_element_start + m_element_size;
-
- if (m_pos >= element_stop)
- return 0; //nothing left to parse
-
- return E_BUFFER_NOT_FULL; //underflow, since more remains to be parsed
-}
-
-
-Cluster* Cluster::Create(
- Segment* pSegment,
- long idx,
- long long off)
- //long long element_size)
-{
- assert(pSegment);
- assert(off >= 0);
-
- const long long element_start = pSegment->m_start + off;
-
- Cluster* const pCluster = new Cluster(pSegment,
- idx,
- element_start);
- //element_size);
- assert(pCluster);
-
- return pCluster;
-}
-
-
-Cluster::Cluster() :
- m_pSegment(NULL),
- m_element_start(0),
- m_index(0),
- m_pos(0),
- m_element_size(0),
- m_timecode(0),
- m_entries(NULL),
- m_entries_size(0),
- m_entries_count(0) //means "no entries"
-{
-}
-
-
-Cluster::Cluster(
- Segment* pSegment,
- long idx,
- long long element_start
- /* long long element_size */ ) :
- m_pSegment(pSegment),
- m_element_start(element_start),
- m_index(idx),
- m_pos(element_start),
- m_element_size(-1 /* element_size */ ),
- m_timecode(-1),
- m_entries(NULL),
- m_entries_size(0),
- m_entries_count(-1) //means "has not been parsed yet"
-{
-}
-
-
-Cluster::~Cluster()
-{
- if (m_entries_count <= 0)
- return;
-
- BlockEntry** i = m_entries;
- BlockEntry** const j = m_entries + m_entries_count;
-
- while (i != j)
- {
- BlockEntry* p = *i++;
- assert(p);
-
- delete p;
- }
-
- delete[] m_entries;
-}
-
-
-bool Cluster::EOS() const
-{
- return (m_pSegment == NULL);
-}
-
-
-long Cluster::GetIndex() const
-{
- return m_index;
-}
-
-
-long long Cluster::GetPosition() const
-{
- const long long pos = m_element_start - m_pSegment->m_start;
- assert(pos >= 0);
-
- return pos;
-}
-
-
-long long Cluster::GetElementSize() const
-{
- return m_element_size;
-}
-
-
-#if 0
-bool Cluster::HasBlockEntries(
- const Segment* pSegment,
- long long off) //relative to start of segment payload
-{
- assert(pSegment);
- assert(off >= 0); //relative to segment
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- long long pos = pSegment->m_start + off; //absolute
- long long size;
-
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- (void)id;
- assert(id >= 0);
- assert(id == 0x0F43B675); //Cluster ID
-
- pos += len; //consume id
-
- size = ReadUInt(pReader, pos, len);
- assert(size > 0);
-
- pos += len; //consume size
-
- //pos now points to start of payload
- }
-
- const long long stop = pos + size;
-
- while (pos < stop)
- {
- long len;
-
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume id
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume size
-
- if (id == 0x20) //BlockGroup ID
- return true;
-
- if (id == 0x23) //SimpleBlock ID
- return true;
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- return false;
-}
-#endif
-
-
-long Cluster::HasBlockEntries(
- const Segment* pSegment,
- long long off, //relative to start of segment payload
- long long& pos,
- long& len)
-{
- assert(pSegment);
- assert(off >= 0); //relative to segment
-
- IMkvReader* const pReader = pSegment->m_pReader;
-
- long long total, avail;
-
- long status = pReader->Length(&total, &avail);
-
- if (status < 0) //error
- return status;
-
- assert((total < 0) || (avail <= total));
-
- pos = pSegment->m_start + off; //absolute
-
- if ((total >= 0) && (pos >= total))
- return 0; //we don't even have a complete cluster
-
- const long long segment_stop =
- (pSegment->m_size < 0) ? -1 : pSegment->m_start + pSegment->m_size;
-
- long long cluster_stop = -1; //interpreted later to mean "unknown size"
-
- {
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //need more data
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && ((pos + len) > total))
- return 0;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- if (id != 0x0F43B675) //weird: not cluster ID
- return -1; //generic error
-
- pos += len; //consume Cluster ID field
-
- //read size field
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //weird
- return E_BUFFER_NOT_FULL;
-
- if ((segment_stop >= 0) && ((pos + len) > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && ((pos + len) > total))
- return 0;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- if (size == 0)
- return 0; //cluster does not have entries
-
- pos += len; //consume size field
-
- //pos now points to start of payload
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size != unknown_size)
- {
- cluster_stop = pos + size;
- assert(cluster_stop >= 0);
-
- if ((segment_stop >= 0) && (cluster_stop > segment_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((total >= 0) && (cluster_stop > total))
- //return E_FILE_FORMAT_INVALID; //too conservative
- return 0; //cluster does not have any entries
- }
- }
-
- for (;;)
- {
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- return 0; //no entries detected
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- long long result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //need more data
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long id = ReadUInt(pReader, pos, len);
-
- if (id < 0) //error
- return static_cast<long>(id);
-
- //This is the distinguished set of ID's we use to determine
- //that we have exhausted the sub-element's inside the cluster
- //whose ID we parsed earlier.
-
- if (id == 0x0F43B675) //Cluster ID
- return 0; //no entries found
-
- if (id == 0x0C53BB6B) //Cues ID
- return 0; //no entries found
-
- pos += len; //consume id field
-
- if ((cluster_stop >= 0) && (pos >= cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- //read size field
-
- if ((pos + 1) > avail)
- {
- len = 1;
- return E_BUFFER_NOT_FULL;
- }
-
- result = GetUIntLength(pReader, pos, len);
-
- if (result < 0) //error
- return static_cast<long>(result);
-
- if (result > 0) //underflow
- return E_BUFFER_NOT_FULL;
-
- if ((cluster_stop >= 0) && ((pos + len) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > avail)
- return E_BUFFER_NOT_FULL;
-
- const long long size = ReadUInt(pReader, pos, len);
-
- if (size < 0) //error
- return static_cast<long>(size);
-
- pos += len; //consume size field
-
- //pos now points to start of payload
-
- if ((cluster_stop >= 0) && (pos > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if (size == 0) //weird
- continue;
-
- const long long unknown_size = (1LL << (7 * len)) - 1;
-
- if (size == unknown_size)
- return E_FILE_FORMAT_INVALID; //not supported inside cluster
-
- if ((cluster_stop >= 0) && ((pos + size) > cluster_stop))
- return E_FILE_FORMAT_INVALID;
-
- if (id == 0x20) //BlockGroup ID
- return 1; //have at least one entry
-
- if (id == 0x23) //SimpleBlock ID
- return 1; //have at least one entry
-
- pos += size; //consume payload
- assert((cluster_stop < 0) || (pos <= cluster_stop));
- }
-}
-
-
-long long Cluster::GetTimeCode() const
-{
- long long pos;
- long len;
-
- const long status = Load(pos, len);
-
- if (status < 0) //error
- return status;
-
- return m_timecode;
-}
-
-
-long long Cluster::GetTime() const
-{
- const long long tc = GetTimeCode();
-
- if (tc < 0)
- return tc;
-
- const SegmentInfo* const pInfo = m_pSegment->GetInfo();
- assert(pInfo);
-
- const long long scale = pInfo->GetTimeCodeScale();
- assert(scale >= 1);
-
- const long long t = m_timecode * scale;
-
- return t;
-}
-
-
-long long Cluster::GetFirstTime() const
-{
- const BlockEntry* pEntry;
-
- const long status = GetFirst(pEntry);
-
- if (status < 0) //error
- return status;
-
- if (pEntry == NULL) //empty cluster
- return GetTime();
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- return pBlock->GetTime(this);
-}
-
-
-long long Cluster::GetLastTime() const
-{
- const BlockEntry* pEntry;
-
- const long status = GetLast(pEntry);
-
- if (status < 0) //error
- return status;
-
- if (pEntry == NULL) //empty cluster
- return GetTime();
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- return pBlock->GetTime(this);
-}
-
-
-long Cluster::CreateBlock(
- long long id,
- long long pos, //absolute pos of payload
- long long size)
-{
- assert((id == 0x20) || (id == 0x23)); //BlockGroup or SimpleBlock
-
- if (m_entries_count < 0) //haven't parsed anything yet
- {
- assert(m_entries == NULL);
- assert(m_entries_size == 0);
-
- m_entries_size = 1024;
- m_entries = new BlockEntry*[m_entries_size];
-
- m_entries_count = 0;
- }
- else
- {
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count <= m_entries_size);
-
- if (m_entries_count >= m_entries_size)
- {
- const long entries_size = 2 * m_entries_size;
-
- BlockEntry** const entries = new BlockEntry*[entries_size];
- assert(entries);
-
- BlockEntry** src = m_entries;
- BlockEntry** const src_end = src + m_entries_count;
-
- BlockEntry** dst = entries;
-
- while (src != src_end)
- *dst++ = *src++;
-
- delete[] m_entries;
-
- m_entries = entries;
- m_entries_size = entries_size;
- }
- }
-
- if (id == 0x20) //BlockGroup ID
- return CreateBlockGroup(pos, size);
- else //SimpleBlock ID
- return CreateSimpleBlock(pos, size);
-}
-
-
-long Cluster::CreateBlockGroup(
- long long st,
- long long sz)
-{
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count >= 0);
- assert(m_entries_count < m_entries_size);
-
- IMkvReader* const pReader = m_pSegment->m_pReader;
-
- long long pos = st;
- const long long stop = st + sz;
-
- //For WebM files, there is a bias towards previous reference times
- //(in order to support alt-ref frames, which refer back to the previous
- //keyframe). Normally a 0 value is not possible, but here we tenatively
- //allow 0 as the value of a reference frame, with the interpretation
- //that this is a "previous" reference time.
-
- long long prev = 1; //nonce
- long long next = 0; //nonce
- long long duration = -1; //really, this is unsigned
-
- long long bpos = -1;
- long long bsize = -1;
-
- while (pos < stop)
- {
- long len;
- const long long id = ReadUInt(pReader, pos, len);
- assert(id >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume ID
-
- const long long size = ReadUInt(pReader, pos, len);
- assert(size >= 0); //TODO
- assert((pos + len) <= stop);
-
- pos += len; //consume size
-
- if (id == 0x21) //Block ID
- {
- if (bpos < 0) //Block ID
- {
- bpos = pos;
- bsize = size;
- }
- }
- else if (id == 0x1B) //Duration ID
- {
- assert(size <= 8);
-
- duration = UnserializeUInt(pReader, pos, size);
- assert(duration >= 0); //TODO
- }
- else if (id == 0x7B) //ReferenceBlock
- {
- assert(size <= 8);
- const long size_ = static_cast<long>(size);
-
- long long time;
-
- long status = UnserializeInt(pReader, pos, size_, time);
- assert(status == 0); //TODO
-
- if (time <= 0) //see note above
- prev = time;
- else //weird
- next = time;
- }
-
- pos += size; //consume payload
- assert(pos <= stop);
- }
-
- assert(pos == stop);
- assert(bpos >= 0);
- assert(bsize >= 0);
-
- const long idx = m_entries_count;
-
- BlockEntry** const ppEntry = m_entries + idx;
- BlockEntry*& pEntry = *ppEntry;
-
- pEntry = new (std::nothrow) BlockGroup(
- this,
- idx,
- bpos,
- bsize,
- prev,
- next,
- duration);
-
- if (pEntry == NULL)
- return -1; //generic error
-
- BlockGroup* const p = static_cast<BlockGroup*>(pEntry);
-
- const long status = p->Parse();
-
- if (status == 0) //success
- {
- ++m_entries_count;
- return 0;
- }
-
- delete pEntry;
- pEntry = 0;
-
- return status;
-}
-
-
-
-long Cluster::CreateSimpleBlock(
- long long st,
- long long sz)
-{
- assert(m_entries);
- assert(m_entries_size > 0);
- assert(m_entries_count >= 0);
- assert(m_entries_count < m_entries_size);
-
- const long idx = m_entries_count;
-
- BlockEntry** const ppEntry = m_entries + idx;
- BlockEntry*& pEntry = *ppEntry;
-
- pEntry = new (std::nothrow) SimpleBlock(this, idx, st, sz);
-
- if (pEntry == NULL)
- return -1; //generic error
-
- SimpleBlock* const p = static_cast<SimpleBlock*>(pEntry);
-
- const long status = p->Parse();
-
- if (status == 0)
- {
- ++m_entries_count;
- return 0;
- }
-
- delete pEntry;
- pEntry = 0;
-
- return status;
-}
-
-
-long Cluster::GetFirst(const BlockEntry*& pFirst) const
-{
- if (m_entries_count <= 0)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //error
- {
- pFirst = NULL;
- return status;
- }
-
- if (m_entries_count <= 0) //empty cluster
- {
- pFirst = NULL;
- return 0;
- }
- }
-
- assert(m_entries);
-
- pFirst = m_entries[0];
- assert(pFirst);
-
- return 0; //success
-}
-
-long Cluster::GetLast(const BlockEntry*& pLast) const
-{
- for (;;)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //error
- {
- pLast = NULL;
- return status;
- }
-
- if (status > 0) //no new block
- break;
- }
-
- if (m_entries_count <= 0)
- {
- pLast = NULL;
- return 0;
- }
-
- assert(m_entries);
-
- const long idx = m_entries_count - 1;
-
- pLast = m_entries[idx];
- assert(pLast);
-
- return 0;
-}
-
-
-long Cluster::GetNext(
- const BlockEntry* pCurr,
- const BlockEntry*& pNext) const
-{
- assert(pCurr);
- assert(m_entries);
- assert(m_entries_count > 0);
-
- size_t idx = pCurr->GetIndex();
- assert(idx < size_t(m_entries_count));
- assert(m_entries[idx] == pCurr);
-
- ++idx;
-
- if (idx >= size_t(m_entries_count))
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //error
- {
- pNext = NULL;
- return status;
- }
-
- if (status > 0)
- {
- pNext = NULL;
- return 0;
- }
-
- assert(m_entries);
- assert(m_entries_count > 0);
- assert(idx < size_t(m_entries_count));
- }
-
- pNext = m_entries[idx];
- assert(pNext);
-
- return 0;
-}
-
-
-long Cluster::GetEntryCount() const
-{
- return m_entries_count;
-}
-
-
-const BlockEntry* Cluster::GetEntry(
- const Track* pTrack,
- long long time_ns) const
-{
- assert(pTrack);
-
- if (m_pSegment == NULL) //this is the special EOS cluster
- return pTrack->GetEOS();
-
-#if 0
-
- LoadBlockEntries();
-
- if ((m_entries == NULL) || (m_entries_count <= 0))
- return NULL; //return EOS here?
-
- const BlockEntry* pResult = pTrack->GetEOS();
-
- BlockEntry** i = m_entries;
- assert(i);
-
- BlockEntry** const j = i + m_entries_count;
-
- while (i != j)
- {
- const BlockEntry* const pEntry = *i++;
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != pTrack->GetNumber())
- continue;
-
- if (pTrack->VetEntry(pEntry))
- {
- if (time_ns < 0) //just want first candidate block
- return pEntry;
-
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- break;
-
- pResult = pEntry;
- }
- else if (time_ns >= 0)
- {
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- break;
- }
- }
-
- return pResult;
-
-#else
-
- const BlockEntry* pResult = pTrack->GetEOS();
-
- long index = 0;
-
- for (;;)
- {
- if (index >= m_entries_count)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
- assert(status >= 0);
-
- if (status > 0) //completely parsed, and no more entries
- return pResult;
-
- if (status < 0) //should never happen
- return 0;
-
- assert(m_entries);
- assert(index < m_entries_count);
- }
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != pTrack->GetNumber())
- {
- ++index;
- continue;
- }
-
- if (pTrack->VetEntry(pEntry))
- {
- if (time_ns < 0) //just want first candidate block
- return pEntry;
-
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- return pResult;
-
- pResult = pEntry; //have a candidate
- }
- else if (time_ns >= 0)
- {
- const long long ns = pBlock->GetTime(this);
-
- if (ns > time_ns)
- return pResult;
- }
-
- ++index;
- }
-
-#endif
-}
-
-
-const BlockEntry*
-Cluster::GetEntry(
- const CuePoint& cp,
- const CuePoint::TrackPosition& tp) const
-{
- assert(m_pSegment);
-
-#if 0
-
- LoadBlockEntries();
-
- if (m_entries == NULL)
- return NULL;
-
- const long long count = m_entries_count;
-
- if (count <= 0)
- return NULL;
-
- const long long tc = cp.GetTimeCode();
-
- if ((tp.m_block > 0) && (tp.m_block <= count))
- {
- const size_t block = static_cast<size_t>(tp.m_block);
- const size_t index = block - 1;
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if ((pBlock->GetTrackNumber() == tp.m_track) &&
- (pBlock->GetTimeCode(this) == tc))
- {
- return pEntry;
- }
- }
-
- const BlockEntry* const* i = m_entries;
- const BlockEntry* const* const j = i + count;
-
- while (i != j)
- {
-#ifdef _DEBUG
- const ptrdiff_t idx = i - m_entries;
- idx;
-#endif
-
- const BlockEntry* const pEntry = *i++;
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != tp.m_track)
- continue;
-
- const long long tc_ = pBlock->GetTimeCode(this);
- assert(tc_ >= 0);
-
- if (tc_ < tc)
- continue;
-
- if (tc_ > tc)
- return NULL;
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(tp.m_track);
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return NULL;
-
- const long long type = pTrack->GetType();
-
- if (type == 2) //audio
- return pEntry;
-
- if (type != 1) //not video
- return NULL;
-
- if (!pBlock->IsKey())
- return NULL;
-
- return pEntry;
- }
-
- return NULL;
-
-#else
-
- const long long tc = cp.GetTimeCode();
-
- if (tp.m_block > 0)
- {
- const long block = static_cast<long>(tp.m_block);
- const long index = block - 1;
-
- while (index >= m_entries_count)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //TODO: can this happen?
- return NULL;
-
- if (status > 0) //nothing remains to be parsed
- return NULL;
- }
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if ((pBlock->GetTrackNumber() == tp.m_track) &&
- (pBlock->GetTimeCode(this) == tc))
- {
- return pEntry;
- }
- }
-
- long index = 0;
-
- for (;;)
- {
- if (index >= m_entries_count)
- {
- long long pos;
- long len;
-
- const long status = Parse(pos, len);
-
- if (status < 0) //TODO: can this happen?
- return NULL;
-
- if (status > 0) //nothing remains to be parsed
- return NULL;
-
- assert(m_entries);
- assert(index < m_entries_count);
- }
-
- const BlockEntry* const pEntry = m_entries[index];
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != tp.m_track)
- {
- ++index;
- continue;
- }
-
- const long long tc_ = pBlock->GetTimeCode(this);
- assert(tc_ >= 0);
-
- if (tc_ < tc)
- {
- ++index;
- continue;
- }
-
- if (tc_ > tc)
- return NULL;
-
- const Tracks* const pTracks = m_pSegment->GetTracks();
- assert(pTracks);
-
- const long tn = static_cast<long>(tp.m_track);
- const Track* const pTrack = pTracks->GetTrackByNumber(tn);
-
- if (pTrack == NULL)
- return NULL;
-
- const long long type = pTrack->GetType();
-
- if (type == 2) //audio
- return pEntry;
-
- if (type != 1) //not video
- return NULL;
-
- if (!pBlock->IsKey())
- return NULL;
-
- return pEntry;
- }
-
-#endif
-
-}
-
-
-#if 0
-const BlockEntry* Cluster::GetMaxKey(const VideoTrack* pTrack) const
-{
- assert(pTrack);
-
- if (m_pSegment == NULL) //EOS
- return pTrack->GetEOS();
-
- LoadBlockEntries();
-
- if ((m_entries == NULL) || (m_entries_count <= 0))
- return pTrack->GetEOS();
-
- BlockEntry** i = m_entries + m_entries_count;
- BlockEntry** const j = m_entries;
-
- while (i != j)
- {
- const BlockEntry* const pEntry = *--i;
- assert(pEntry);
- assert(!pEntry->EOS());
-
- const Block* const pBlock = pEntry->GetBlock();
- assert(pBlock);
-
- if (pBlock->GetTrackNumber() != pTrack->GetNumber())
- continue;
-
- if (pBlock->IsKey())
- return pEntry;
- }
-
- return pTrack->GetEOS(); //no satisfactory block found
-}
-#endif
-
-
-BlockEntry::BlockEntry(Cluster* p, long idx) :
- m_pCluster(p),
- m_index(idx)
-{
-}
-
-
-BlockEntry::~BlockEntry()
-{
-}
-
-
-bool BlockEntry::EOS() const
-{
- return (GetKind() == kBlockEOS);
-}
-
-
-const Cluster* BlockEntry::GetCluster() const
-{
- return m_pCluster;
-}
-
-
-long BlockEntry::GetIndex() const
-{
- return m_index;
-}
-
-
-SimpleBlock::SimpleBlock(
- Cluster* pCluster,
- long idx,
- long long start,
- long long size) :
- BlockEntry(pCluster, idx),
- m_block(start, size)
-{
-}
-
-
-long SimpleBlock::Parse()
-{
- return m_block.Parse(m_pCluster->m_pSegment->m_pReader);
-}
-
-
-BlockEntry::Kind SimpleBlock::GetKind() const
-{
- return kBlockSimple;
-}
-
-
-const Block* SimpleBlock::GetBlock() const
-{
- return &m_block;
-}
-
-
-BlockGroup::BlockGroup(
- Cluster* pCluster,
- long idx,
- long long block_start,
- long long block_size,
- long long prev,
- long long next,
- long long duration) :
- BlockEntry(pCluster, idx),
- m_block(block_start, block_size),
- m_prev(prev),
- m_next(next),
- m_duration(duration)
-{
-}
-
-
-long BlockGroup::Parse()
-{
- const long status = m_block.Parse(m_pCluster->m_pSegment->m_pReader);
-
- if (status)
- return status;
-
- m_block.SetKey((m_prev > 0) && (m_next <= 0));
-
- return 0;
-}
-
-
-#if 0
-void BlockGroup::ParseBlock(long long start, long long size)
-{
- IMkvReader* const pReader = m_pCluster->m_pSegment->m_pReader;
-
- Block* const pBlock = new Block(start, size, pReader);
- assert(pBlock); //TODO
-
- //TODO: the Matroska spec says you have multiple blocks within the
- //same block group, with blocks ranked by priority (the flag bits).
-
- assert(m_pBlock == NULL);
- m_pBlock = pBlock;
-}
-#endif
-
-
-BlockEntry::Kind BlockGroup::GetKind() const
-{
- return kBlockGroup;
-}
-
-
-const Block* BlockGroup::GetBlock() const
-{
- return &m_block;
-}
-
-
-long long BlockGroup::GetPrevTimeCode() const
-{
- return m_prev;
-}
-
-
-long long BlockGroup::GetNextTimeCode() const
-{
- return m_next;
-}
-
-
-Block::Block(long long start, long long size_) :
- m_start(start),
- m_size(size_),
- m_track(0),
- m_timecode(-1),
- m_flags(0),
- m_frames(NULL),
- m_frame_count(-1)
-{
-}
-
-
-Block::~Block()
-{
- delete[] m_frames;
-}
-
-
-long Block::Parse(IMkvReader* pReader)
-{
- assert(pReader);
- assert(m_start >= 0);
- assert(m_size >= 0);
- assert(m_track <= 0);
- assert(m_frames == NULL);
- assert(m_frame_count <= 0);
-
- long long pos = m_start;
- const long long stop = m_start + m_size;
-
- long len;
-
- m_track = ReadUInt(pReader, pos, len);
-
- if (m_track <= 0)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > stop)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume track number
-
- if ((stop - pos) < 2)
- return E_FILE_FORMAT_INVALID;
-
- long status;
- long long value;
-
- status = UnserializeInt(pReader, pos, 2, value);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- if (value < SHRT_MIN)
- return E_FILE_FORMAT_INVALID;
-
- if (value > SHRT_MAX)
- return E_FILE_FORMAT_INVALID;
-
- m_timecode = static_cast<short>(value);
-
- pos += 2;
-
- if ((stop - pos) <= 0)
- return E_FILE_FORMAT_INVALID;
-
- status = pReader->Read(pos, 1, &m_flags);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- const int lacing = int(m_flags & 0x06) >> 1;
-
- ++pos; //consume flags byte
-
- if (lacing == 0) //no lacing
- {
- if (pos > stop)
- return E_FILE_FORMAT_INVALID;
-
- m_frame_count = 1;
- m_frames = new Frame[m_frame_count];
-
- Frame& f = m_frames[0];
- f.pos = pos;
-
- const long long frame_size = stop - pos;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- f.len = static_cast<long>(frame_size);
-
- return 0; //success
- }
-
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- unsigned char biased_count;
-
- status = pReader->Read(pos, 1, &biased_count);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- ++pos; //consume frame count
- assert(pos <= stop);
-
- m_frame_count = int(biased_count) + 1;
-
- m_frames = new Frame[m_frame_count];
- assert(m_frames);
-
- if (lacing == 1) //Xiph
- {
- Frame* pf = m_frames;
- Frame* const pf_end = pf + m_frame_count;
-
- long size = 0;
- int frame_count = m_frame_count;
-
- while (frame_count > 1)
- {
- long frame_size = 0;
-
- for (;;)
- {
- unsigned char val;
-
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- status = pReader->Read(pos, 1, &val);
-
- if (status)
- return E_FILE_FORMAT_INVALID;
-
- ++pos; //consume xiph size byte
-
- frame_size += val;
-
- if (val < 255)
- break;
- }
-
- Frame& f = *pf++;
- assert(pf < pf_end);
-
- f.pos = 0; //patch later
-
- f.len = frame_size;
- size += frame_size; //contribution of this frame
-
- --frame_count;
- }
-
- assert(pf < pf_end);
- assert(pos <= stop);
-
- {
- Frame& f = *pf++;
-
- if (pf != pf_end)
- return E_FILE_FORMAT_INVALID;
-
- f.pos = 0; //patch later
-
- const long long total_size = stop - pos;
-
- if (total_size < size)
- return E_FILE_FORMAT_INVALID;
-
- const long long frame_size = total_size - size;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- f.len = static_cast<long>(frame_size);
- }
-
- pf = m_frames;
- while (pf != pf_end)
- {
- Frame& f = *pf++;
- assert((pos + f.len) <= stop);
-
- f.pos = pos;
- pos += f.len;
- }
-
- assert(pos == stop);
- }
- else if (lacing == 2) //fixed-size lacing
- {
- const long long total_size = stop - pos;
-
- if ((total_size % m_frame_count) != 0)
- return E_FILE_FORMAT_INVALID;
-
- const long long frame_size = total_size / m_frame_count;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- Frame* pf = m_frames;
- Frame* const pf_end = pf + m_frame_count;
-
- while (pf != pf_end)
- {
- assert((pos + frame_size) <= stop);
-
- Frame& f = *pf++;
-
- f.pos = pos;
- f.len = static_cast<long>(frame_size);
-
- pos += frame_size;
- }
-
- assert(pos == stop);
- }
- else
- {
- assert(lacing == 3); //EBML lacing
-
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- long size = 0;
- int frame_count = m_frame_count;
-
- long long frame_size = ReadUInt(pReader, pos, len);
-
- if (frame_size < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > stop)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume length of size of first frame
-
- if ((pos + frame_size) > stop)
- return E_FILE_FORMAT_INVALID;
-
- Frame* pf = m_frames;
- Frame* const pf_end = pf + m_frame_count;
-
- {
- Frame& curr = *pf;
-
- curr.pos = 0; //patch later
-
- curr.len = static_cast<long>(frame_size);
- size += curr.len; //contribution of this frame
- }
-
- --frame_count;
-
- while (frame_count > 1)
- {
- if (pos >= stop)
- return E_FILE_FORMAT_INVALID;
-
- assert(pf < pf_end);
-
- const Frame& prev = *pf++;
- assert(prev.len == frame_size);
-
- assert(pf < pf_end);
-
- Frame& curr = *pf;
-
- curr.pos = 0; //patch later
-
- const long long delta_size_ = ReadUInt(pReader, pos, len);
-
- if (delta_size_ < 0)
- return E_FILE_FORMAT_INVALID;
-
- if ((pos + len) > stop)
- return E_FILE_FORMAT_INVALID;
-
- pos += len; //consume length of (delta) size
- assert(pos <= stop);
-
- const int exp = 7*len - 1;
- const long long bias = (1LL << exp) - 1LL;
- const long long delta_size = delta_size_ - bias;
-
- frame_size += delta_size;
-
- if (frame_size < 0)
- return E_FILE_FORMAT_INVALID;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- curr.len = static_cast<long>(frame_size);
- size += curr.len; //contribution of this frame
-
- --frame_count;
- }
-
- {
- assert(pos <= stop);
- assert(pf < pf_end);
-
- const Frame& prev = *pf++;
- assert(prev.len == frame_size);
-
- assert(pf < pf_end);
-
- Frame& curr = *pf++;
- assert(pf == pf_end);
-
- curr.pos = 0; //patch later
-
- const long long total_size = stop - pos;
-
- if (total_size < size)
- return E_FILE_FORMAT_INVALID;
-
- frame_size = total_size - size;
-
- if (frame_size > LONG_MAX)
- return E_FILE_FORMAT_INVALID;
-
- curr.len = static_cast<long>(frame_size);
- }
-
- pf = m_frames;
- while (pf != pf_end)
- {
- Frame& f = *pf++;
- assert((pos + f.len) <= stop);
-
- f.pos = pos;
- pos += f.len;
- }
-
- assert(pos == stop);
- }
-
- return 0; //success
-}
-
-
-long long Block::GetTimeCode(const Cluster* pCluster) const
-{
- if (pCluster == 0)
- return m_timecode;
-
- const long long tc0 = pCluster->GetTimeCode();
- assert(tc0 >= 0);
-
- const long long tc = tc0 + m_timecode;
- assert(tc >= 0);
-
- return tc; //unscaled timecode units
-}
-
-
-long long Block::GetTime(const Cluster* pCluster) const
-{
- assert(pCluster);
-
- const long long tc = GetTimeCode(pCluster);
-
- const Segment* const pSegment = pCluster->m_pSegment;
- const SegmentInfo* const pInfo = pSegment->GetInfo();
- assert(pInfo);
-
- const long long scale = pInfo->GetTimeCodeScale();
- assert(scale >= 1);
-
- const long long ns = tc * scale;
-
- return ns;
-}
-
-
-long long Block::GetTrackNumber() const
-{
- return m_track;
-}
-
-
-bool Block::IsKey() const
-{
- return ((m_flags & static_cast<unsigned char>(1 << 7)) != 0);
-}
-
-
-void Block::SetKey(bool bKey)
-{
- if (bKey)
- m_flags |= static_cast<unsigned char>(1 << 7);
- else
- m_flags &= 0x7F;
-}
-
-
-bool Block::IsInvisible() const
-{
- return bool(int(m_flags & 0x08) != 0);
-}
-
-
-Block::Lacing Block::GetLacing() const
-{
- const int value = int(m_flags & 0x06) >> 1;
- return static_cast<Lacing>(value);
-}
-
-
-int Block::GetFrameCount() const
-{
- return m_frame_count;
-}
-
-
-const Block::Frame& Block::GetFrame(int idx) const
-{
- assert(idx >= 0);
- assert(idx < m_frame_count);
-
- const Frame& f = m_frames[idx];
- assert(f.pos > 0);
- assert(f.len > 0);
-
- return f;
-}
-
-
-long Block::Frame::Read(IMkvReader* pReader, unsigned char* buf) const
-{
- assert(pReader);
- assert(buf);
-
- const long status = pReader->Read(pos, len, buf);
- return status;
-}
-
-
-} //end namespace mkvparser
diff --git a/videocodec/libvpx_internal/libwebm/mkvparser.hpp b/videocodec/libvpx_internal/libwebm/mkvparser.hpp
deleted file mode 100644
index 5cb640b..0000000
--- a/videocodec/libvpx_internal/libwebm/mkvparser.hpp
+++ /dev/null
@@ -1,896 +0,0 @@
-// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree. An additional intellectual property rights grant can be found
-// in the file PATENTS. All contributing project authors may
-// be found in the AUTHORS file in the root of the source tree.
-
-#ifndef MKVPARSER_HPP
-#define MKVPARSER_HPP
-
-#include <cstdlib>
-#include <cstdio>
-#include <cstddef>
-
-namespace mkvparser
-{
-
-const int E_FILE_FORMAT_INVALID = -2;
-const int E_BUFFER_NOT_FULL = -3;
-
-class IMkvReader
-{
-public:
- virtual int Read(long long pos, long len, unsigned char* buf) = 0;
- virtual int Length(long long* total, long long* available) = 0;
-protected:
- virtual ~IMkvReader();
-};
-
-long long GetUIntLength(IMkvReader*, long long, long&);
-long long ReadUInt(IMkvReader*, long long, long&);
-long long UnserializeUInt(IMkvReader*, long long pos, long long size);
-
-long UnserializeFloat(IMkvReader*, long long pos, long long size, double&);
-long UnserializeInt(IMkvReader*, long long pos, long len, long long& result);
-
-long UnserializeString(
- IMkvReader*,
- long long pos,
- long long size,
- char*& str);
-
-long ParseElementHeader(
- IMkvReader* pReader,
- long long& pos, //consume id and size fields
- long long stop, //if you know size of element's parent
- long long& id,
- long long& size);
-
-bool Match(IMkvReader*, long long&, unsigned long, long long&);
-bool Match(IMkvReader*, long long&, unsigned long, unsigned char*&, size_t&);
-
-void GetVersion(int& major, int& minor, int& build, int& revision);
-
-struct EBMLHeader
-{
- EBMLHeader();
- ~EBMLHeader();
- long long m_version;
- long long m_readVersion;
- long long m_maxIdLength;
- long long m_maxSizeLength;
- char* m_docType;
- long long m_docTypeVersion;
- long long m_docTypeReadVersion;
-
- long long Parse(IMkvReader*, long long&);
- void Init();
-};
-
-
-class Segment;
-class Track;
-class Cluster;
-
-class Block
-{
- Block(const Block&);
- Block& operator=(const Block&);
-
-public:
- const long long m_start;
- const long long m_size;
-
- Block(long long start, long long size);
- ~Block();
-
- long Parse(IMkvReader*);
-
- long long GetTrackNumber() const;
- long long GetTimeCode(const Cluster*) const; //absolute, but not scaled
- long long GetTime(const Cluster*) const; //absolute, and scaled (ns)
- bool IsKey() const;
- void SetKey(bool);
- bool IsInvisible() const;
-
- enum Lacing { kLacingNone, kLacingXiph, kLacingFixed, kLacingEbml };
- Lacing GetLacing() const;
-
- int GetFrameCount() const; //to index frames: [0, count)
-
- struct Frame
- {
- long long pos; //absolute offset
- long len;
-
- long Read(IMkvReader*, unsigned char*) const;
- };
-
- const Frame& GetFrame(int frame_index) const;
-
-private:
- long long m_track; //Track::Number()
- short m_timecode; //relative to cluster
- unsigned char m_flags;
-
- Frame* m_frames;
- int m_frame_count;
-
-};
-
-
-class BlockEntry
-{
- BlockEntry(const BlockEntry&);
- BlockEntry& operator=(const BlockEntry&);
-
-protected:
- BlockEntry(Cluster*, long index);
-
-public:
- virtual ~BlockEntry();
-
- bool EOS() const;
- const Cluster* GetCluster() const;
- long GetIndex() const;
- virtual const Block* GetBlock() const = 0;
-
- enum Kind { kBlockEOS, kBlockSimple, kBlockGroup };
- virtual Kind GetKind() const = 0;
-
-protected:
- Cluster* const m_pCluster;
- const long m_index;
-
-};
-
-
-class SimpleBlock : public BlockEntry
-{
- SimpleBlock(const SimpleBlock&);
- SimpleBlock& operator=(const SimpleBlock&);
-
-public:
- SimpleBlock(Cluster*, long index, long long start, long long size);
- long Parse();
-
- Kind GetKind() const;
- const Block* GetBlock() const;
-
-protected:
- Block m_block;
-
-};
-
-
-class BlockGroup : public BlockEntry
-{
- BlockGroup(const BlockGroup&);
- BlockGroup& operator=(const BlockGroup&);
-
-public:
- BlockGroup(
- Cluster*,
- long index,
- long long block_start, //absolute pos of block's payload
- long long block_size, //size of block's payload
- long long prev,
- long long next,
- long long duration);
-
- long Parse();
-
- Kind GetKind() const;
- const Block* GetBlock() const;
-
- long long GetPrevTimeCode() const; //relative to block's time
- long long GetNextTimeCode() const; //as above
- long long GetDuration() const;
-
-private:
- Block m_block;
- const long long m_prev;
- const long long m_next;
- const long long m_duration;
-
-};
-
-///////////////////////////////////////////////////////////////
-// ContentEncoding element
-// Elements used to describe if the track data has been encrypted or
-// compressed with zlib or header stripping.
-class ContentEncoding {
-public:
- ContentEncoding();
- ~ContentEncoding();
-
- // ContentCompression element names
- struct ContentCompression {
- ContentCompression();
- ~ContentCompression();
-
- unsigned long long algo;
- unsigned char* settings;
- };
-
- // ContentEncryption element names
- struct ContentEncryption {
- ContentEncryption();
- ~ContentEncryption();
-
- unsigned long long algo;
- unsigned char* key_id;
- long long key_id_len;
- unsigned char* signature;
- long long signature_len;
- unsigned char* sig_key_id;
- long long sig_key_id_len;
- unsigned long long sig_algo;
- unsigned long long sig_hash_algo;
- };
-
- // Returns ContentCompression represented by |idx|. Returns NULL if |idx|
- // is out of bounds.
- const ContentCompression* GetCompressionByIndex(unsigned long idx) const;
-
- // Returns number of ContentCompression elements in this ContentEncoding
- // element.
- unsigned long GetCompressionCount() const;
-
- // Returns ContentEncryption represented by |idx|. Returns NULL if |idx|
- // is out of bounds.
- const ContentEncryption* GetEncryptionByIndex(unsigned long idx) const;
-
- // Returns number of ContentEncryption elements in this ContentEncoding
- // element.
- unsigned long GetEncryptionCount() const;
-
- // Parses the ContentEncoding element from |pReader|. |start| is the
- // starting offset of the ContentEncoding payload. |size| is the size in
- // bytes of the ContentEncoding payload. Returns true on success.
- bool ParseContentEncodingEntry(long long start,
- long long size,
- IMkvReader* const pReader);
-
- // Parses the ContentEncryption element from |pReader|. |start| is the
- // starting offset of the ContentEncryption payload. |size| is the size in
- // bytes of the ContentEncryption payload. |encryption| is where the parsed
- // values will be stored.
- void ParseEncryptionEntry(long long start,
- long long size,
- IMkvReader* const pReader,
- ContentEncryption* const encryption);
-
- unsigned long long encoding_order() const { return encoding_order_; }
- unsigned long long encoding_scope() const { return encoding_scope_; }
- unsigned long long encoding_type() const { return encoding_type_; }
-
-private:
- // Member variables for list of ContentCompression elements.
- ContentCompression** compression_entries_;
- ContentCompression** compression_entries_end_;
-
- // Member variables for list of ContentEncryption elements.
- ContentEncryption** encryption_entries_;
- ContentEncryption** encryption_entries_end_;
-
- // ContentEncoding element names
- unsigned long long encoding_order_;
- unsigned long long encoding_scope_;
- unsigned long long encoding_type_;
-
- // LIBWEBM_DISALLOW_COPY_AND_ASSIGN(ContentEncoding);
- ContentEncoding(const ContentEncoding&);
- ContentEncoding& operator=(const ContentEncoding&);
-};
-
-class Track
-{
- Track(const Track&);
- Track& operator=(const Track&);
-
-public:
- enum Type { kVideo = 1, kAudio = 2 };
-
- Segment* const m_pSegment;
- const long long m_element_start;
- const long long m_element_size;
- virtual ~Track();
-
- long GetType() const;
- long GetNumber() const;
- unsigned long long GetUid() const;
- const char* GetNameAsUTF8() const;
- const char* GetCodecNameAsUTF8() const;
- const char* GetCodecId() const;
- const unsigned char* GetCodecPrivate(size_t&) const;
- bool GetLacing() const;
-
- const BlockEntry* GetEOS() const;
-
- struct Settings
- {
- long long start;
- long long size;
- };
-
- class Info
- {
- public:
- Info();
- ~Info();
- int Copy(Info&) const;
- void Clear();
- private:
- Info(const Info&);
- Info& operator=(const Info&);
- public:
- long type;
- long number;
- unsigned long long uid;
- char* nameAsUTF8;
- char* codecId;
- char* codecNameAsUTF8;
- unsigned char* codecPrivate;
- size_t codecPrivateSize;
- bool lacing;
- Settings settings;
- private:
- int CopyStr(char* Info::*str, Info&) const;
- };
-
- long GetFirst(const BlockEntry*&) const;
- long GetNext(const BlockEntry* pCurr, const BlockEntry*& pNext) const;
- virtual bool VetEntry(const BlockEntry*) const = 0;
- virtual long Seek(long long time_ns, const BlockEntry*&) const = 0;
-
- const ContentEncoding* GetContentEncodingByIndex(unsigned long idx) const;
- unsigned long GetContentEncodingCount() const;
-
- void ParseContentEncodingsEntry(long long start, long long size);
-
-protected:
- Track(
- Segment*,
- long long element_start,
- long long element_size);
-
- Info m_info;
-
- class EOSBlock : public BlockEntry
- {
- public:
- EOSBlock();
-
- Kind GetKind() const;
- const Block* GetBlock() const;
- };
-
- EOSBlock m_eos;
-
-private:
- ContentEncoding** content_encoding_entries_;
- ContentEncoding** content_encoding_entries_end_;
-};
-
-
-class VideoTrack : public Track
-{
- VideoTrack(const VideoTrack&);
- VideoTrack& operator=(const VideoTrack&);
-
- VideoTrack(
- Segment*,
- long long element_start,
- long long element_size);
-
-public:
- static long Parse(
- Segment*,
- const Info&,
- long long element_start,
- long long element_size,
- VideoTrack*&);
-
- long long GetWidth() const;
- long long GetHeight() const;
- double GetFrameRate() const;
-
- bool VetEntry(const BlockEntry*) const;
- long Seek(long long time_ns, const BlockEntry*&) const;
-
-private:
- long long m_width;
- long long m_height;
- double m_rate;
-
-};
-
-
-class AudioTrack : public Track
-{
- AudioTrack(const AudioTrack&);
- AudioTrack& operator=(const AudioTrack&);
-
- AudioTrack(
- Segment*,
- long long element_start,
- long long element_size);
-public:
- static long Parse(
- Segment*,
- const Info&,
- long long element_start,
- long long element_size,
- AudioTrack*&);
-
- double GetSamplingRate() const;
- long long GetChannels() const;
- long long GetBitDepth() const;
- bool VetEntry(const BlockEntry*) const;
- long Seek(long long time_ns, const BlockEntry*&) const;
-
-private:
- double m_rate;
- long long m_channels;
- long long m_bitDepth;
-};
-
-
-class Tracks
-{
- Tracks(const Tracks&);
- Tracks& operator=(const Tracks&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- Tracks(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
-
- ~Tracks();
-
- long Parse();
-
- unsigned long GetTracksCount() const;
-
- const Track* GetTrackByNumber(long tn) const;
- const Track* GetTrackByIndex(unsigned long idx) const;
-
-private:
- Track** m_trackEntries;
- Track** m_trackEntriesEnd;
-
- long ParseTrackEntry(
- long long payload_start,
- long long payload_size,
- long long element_start,
- long long element_size,
- Track*&) const;
-
-};
-
-
-class SegmentInfo
-{
- SegmentInfo(const SegmentInfo&);
- SegmentInfo& operator=(const SegmentInfo&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- SegmentInfo(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
-
- ~SegmentInfo();
-
- long Parse();
-
- long long GetTimeCodeScale() const;
- long long GetDuration() const; //scaled
- const char* GetMuxingAppAsUTF8() const;
- const char* GetWritingAppAsUTF8() const;
- const char* GetTitleAsUTF8() const;
-
-private:
- long long m_timecodeScale;
- double m_duration;
- char* m_pMuxingAppAsUTF8;
- char* m_pWritingAppAsUTF8;
- char* m_pTitleAsUTF8;
-};
-
-
-class SeekHead
-{
- SeekHead(const SeekHead&);
- SeekHead& operator=(const SeekHead&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- SeekHead(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
-
- ~SeekHead();
-
- long Parse();
-
- struct Entry
- {
- //the SeekHead entry payload
- long long id;
- long long pos;
-
- //absolute pos of SeekEntry ID
- long long element_start;
-
- //SeekEntry ID size + size size + payload
- long long element_size;
- };
-
- int GetCount() const;
- const Entry* GetEntry(int idx) const;
-
- struct VoidElement
- {
- //absolute pos of Void ID
- long long element_start;
-
- //ID size + size size + payload size
- long long element_size;
- };
-
- int GetVoidElementCount() const;
- const VoidElement* GetVoidElement(int idx) const;
-
-private:
- Entry* m_entries;
- int m_entry_count;
-
- VoidElement* m_void_elements;
- int m_void_element_count;
-
- static bool ParseEntry(
- IMkvReader*,
- long long pos, //payload
- long long size,
- Entry*);
-
-};
-
-class Cues;
-class CuePoint
-{
- friend class Cues;
-
- CuePoint(long, long long);
- ~CuePoint();
-
- CuePoint(const CuePoint&);
- CuePoint& operator=(const CuePoint&);
-
-public:
- long long m_element_start;
- long long m_element_size;
-
- void Load(IMkvReader*);
-
- long long GetTimeCode() const; //absolute but unscaled
- long long GetTime(const Segment*) const; //absolute and scaled (ns units)
- long GetIndex() const;
-
- struct TrackPosition
- {
- long long m_track;
- long long m_pos; //of cluster
- long long m_block;
- //codec_state //defaults to 0
- //reference = clusters containing req'd referenced blocks
- // reftime = timecode of the referenced block
-
- void Parse(IMkvReader*, long long, long long);
- };
-
- const TrackPosition* Find(const Track*) const;
-
-private:
- const long m_index;
- long long m_timecode;
- TrackPosition* m_track_positions;
- size_t m_track_positions_count;
-
-};
-
-
-class Cues
-{
- friend class Segment;
-
- Cues(
- Segment*,
- long long start,
- long long size,
- long long element_start,
- long long element_size);
- ~Cues();
-
- Cues(const Cues&);
- Cues& operator=(const Cues&);
-
-public:
- Segment* const m_pSegment;
- const long long m_start;
- const long long m_size;
- const long long m_element_start;
- const long long m_element_size;
-
- bool Find( //lower bound of time_ns
- long long time_ns,
- const Track*,
- const CuePoint*&,
- const CuePoint::TrackPosition*&) const;
-
-#if 0
- bool FindNext( //upper_bound of time_ns
- long long time_ns,
- const Track*,
- const CuePoint*&,
- const CuePoint::TrackPosition*&) const;
-#endif
-
- const CuePoint* GetFirst() const;
- const CuePoint* GetLast() const;
- const CuePoint* GetNext(const CuePoint*) const;
-
- const BlockEntry* GetBlock(
- const CuePoint*,
- const CuePoint::TrackPosition*) const;
-
- bool LoadCuePoint() const;
- long GetCount() const; //loaded only
- //long GetTotal() const; //loaded + preloaded
- bool DoneParsing() const;
-
-private:
- void Init() const;
- void PreloadCuePoint(long&, long long) const;
-
- mutable CuePoint** m_cue_points;
- mutable long m_count;
- mutable long m_preload_count;
- mutable long long m_pos;
-
-};
-
-
-class Cluster
-{
- friend class Segment;
-
- Cluster(const Cluster&);
- Cluster& operator=(const Cluster&);
-
-public:
- Segment* const m_pSegment;
-
-public:
- static Cluster* Create(
- Segment*,
- long index, //index in segment
- long long off); //offset relative to segment
- //long long element_size);
-
- Cluster(); //EndOfStream
- ~Cluster();
-
- bool EOS() const;
-
- long long GetTimeCode() const; //absolute, but not scaled
- long long GetTime() const; //absolute, and scaled (nanosecond units)
- long long GetFirstTime() const; //time (ns) of first (earliest) block
- long long GetLastTime() const; //time (ns) of last (latest) block
-
- long GetFirst(const BlockEntry*&) const;
- long GetLast(const BlockEntry*&) const;
- long GetNext(const BlockEntry* curr, const BlockEntry*& next) const;
-
- const BlockEntry* GetEntry(const Track*, long long ns = -1) const;
- const BlockEntry* GetEntry(
- const CuePoint&,
- const CuePoint::TrackPosition&) const;
- //const BlockEntry* GetMaxKey(const VideoTrack*) const;
-
-// static bool HasBlockEntries(const Segment*, long long);
-
- static long HasBlockEntries(
- const Segment*,
- long long idoff,
- long long& pos,
- long& size);
-
- long GetEntryCount() const;
-
- long Load(long long& pos, long& size) const;
-
- long Parse(long long& pos, long& size) const;
- long GetEntry(long index, const mkvparser::BlockEntry*&) const;
-
-protected:
- Cluster(
- Segment*,
- long index,
- long long element_start);
- //long long element_size);
-
-public:
- const long long m_element_start;
- long long GetPosition() const; //offset relative to segment
-
- long GetIndex() const;
- long long GetElementSize() const;
- //long long GetPayloadSize() const;
-
- //long long Unparsed() const;
-
-private:
- long m_index;
- mutable long long m_pos;
- //mutable long long m_size;
- mutable long long m_element_size;
- mutable long long m_timecode;
- mutable BlockEntry** m_entries;
- mutable long m_entries_size;
- mutable long m_entries_count;
-
- long ParseSimpleBlock(long long, long long&, long&);
- long ParseBlockGroup(long long, long long&, long&);
-
- long CreateBlock(long long id, long long pos, long long size);
- long CreateBlockGroup(long long, long long);
- long CreateSimpleBlock(long long, long long);
-
-};
-
-
-class Segment
-{
- friend class Cues;
- friend class VideoTrack;
- friend class AudioTrack;
-
- Segment(const Segment&);
- Segment& operator=(const Segment&);
-
-private:
- Segment(
- IMkvReader*,
- long long elem_start,
- //long long elem_size,
- long long pos,
- long long size);
-
-public:
- IMkvReader* const m_pReader;
- const long long m_element_start;
- //const long long m_element_size;
- const long long m_start; //posn of segment payload
- const long long m_size; //size of segment payload
- Cluster m_eos; //TODO: make private?
-
- static long long CreateInstance(IMkvReader*, long long, Segment*&);
- ~Segment();
-
- long Load(); //loads headers and all clusters
-
- //for incremental loading
- //long long Unparsed() const;
- bool DoneParsing() const;
- long long ParseHeaders(); //stops when first cluster is found
- //long FindNextCluster(long long& pos, long& size) const;
- long LoadCluster(long long& pos, long& size); //load one cluster
- long LoadCluster();
-
- long ParseNext(
- const Cluster* pCurr,
- const Cluster*& pNext,
- long long& pos,
- long& size);
-
-#if 0
- //This pair parses one cluster, but only changes the state of the
- //segment object when the cluster is actually added to the index.
- long ParseCluster(long long& cluster_pos, long long& new_pos) const;
- bool AddCluster(long long cluster_pos, long long new_pos);
-#endif
-
- const SeekHead* GetSeekHead() const;
- const Tracks* GetTracks() const;
- const SegmentInfo* GetInfo() const;
- const Cues* GetCues() const;
-
- long long GetDuration() const;
-
- unsigned long GetCount() const;
- const Cluster* GetFirst() const;
- const Cluster* GetLast() const;
- const Cluster* GetNext(const Cluster*);
-
- const Cluster* FindCluster(long long time_nanoseconds) const;
- //const BlockEntry* Seek(long long time_nanoseconds, const Track*) const;
-
- const Cluster* FindOrPreloadCluster(long long pos);
-
- long ParseCues(
- long long cues_off, //offset relative to start of segment
- long long& parse_pos,
- long& parse_len);
-
-private:
-
- long long m_pos; //absolute file posn; what has been consumed so far
- Cluster* m_pUnknownSize;
-
- SeekHead* m_pSeekHead;
- SegmentInfo* m_pInfo;
- Tracks* m_pTracks;
- Cues* m_pCues;
- Cluster** m_clusters;
- long m_clusterCount; //number of entries for which m_index >= 0
- long m_clusterPreloadCount; //number of entries for which m_index < 0
- long m_clusterSize; //array size
-
- long DoLoadCluster(long long&, long&);
- long DoLoadClusterUnknownSize(long long&, long&);
- long DoParseNext(const Cluster*&, long long&, long&);
-
- void AppendCluster(Cluster*);
- void PreloadCluster(Cluster*, ptrdiff_t);
-
- //void ParseSeekHead(long long pos, long long size);
- //void ParseSeekEntry(long long pos, long long size);
- //void ParseCues(long long);
-
- const BlockEntry* GetBlock(
- const CuePoint&,
- const CuePoint::TrackPosition&);
-
-};
-
-} //end namespace mkvparser
-
-inline long mkvparser::Segment::LoadCluster()
-{
- long long pos;
- long size;
-
- return LoadCluster(pos, size);
-}
-
-#endif //MKVPARSER_HPP
diff --git a/videocodec/libvpx_internal/mips-dspr2/libvpx_srcs.txt b/videocodec/libvpx_internal/mips-dspr2/libvpx_srcs.txt
deleted file mode 100644
index e723074..0000000
--- a/videocodec/libvpx_internal/mips-dspr2/libvpx_srcs.txt
+++ /dev/null
@@ -1,275 +0,0 @@
-build/make/rtcd.sh
-build/make/version.sh
-CHANGELOG
-libs.mk
-vp8/common/alloccommon.c
-vp8/common/alloccommon.h
-vp8/common/blockd.c
-vp8/common/blockd.h
-vp8/common/coefupdateprobs.h
-vp8/common/common.h
-vp8/common/debugmodes.c
-vp8/common/default_coef_probs.h
-vp8/common/dequantize.c
-vp8/common/entropy.c
-vp8/common/entropy.h
-vp8/common/entropymode.c
-vp8/common/entropymode.h
-vp8/common/entropymv.c
-vp8/common/entropymv.h
-vp8/common/extend.c
-vp8/common/extend.h
-vp8/common/filter.c
-vp8/common/filter.h
-vp8/common/findnearmv.c
-vp8/common/findnearmv.h
-vp8/common/generic/systemdependent.c
-vp8/common/header.h
-vp8/common/idct_blk.c
-vp8/common/idctllm.c
-vp8/common/invtrans.h
-vp8/common/loopfilter.c
-vp8/common/loopfilter_filters.c
-vp8/common/loopfilter.h
-vp8/common/mbpitch.c
-vp8/common/mips/dspr2/dequantize_dspr2.c
-vp8/common/mips/dspr2/filter_dspr2.c
-vp8/common/mips/dspr2/idct_blk_dspr2.c
-vp8/common/mips/dspr2/idctllm_dspr2.c
-vp8/common/mips/dspr2/loopfilter_filters_dspr2.c
-vp8/common/mips/dspr2/reconinter_dspr2.c
-vp8/common/modecont.c
-vp8/common/modecont.h
-vp8/common/mv.h
-vp8/common/onyxc_int.h
-vp8/common/onyxd.h
-vp8/common/onyx.h
-vp8/common/ppflags.h
-vp8/common/pragmas.h
-vp8/common/quant_common.c
-vp8/common/quant_common.h
-vp8/common/reconinter.c
-vp8/common/reconinter.h
-vp8/common/reconintra4x4.c
-vp8/common/reconintra4x4.h
-vp8/common/reconintra.c
-vp8/common/rtcd.c
-vp8/common/rtcd_defs.sh
-vp8/common/sad_c.c
-vp8/common/setupintrarecon.c
-vp8/common/setupintrarecon.h
-vp8/common/swapyv12buffer.c
-vp8/common/swapyv12buffer.h
-vp8/common/systemdependent.h
-vp8/common/threading.h
-vp8/common/treecoder.c
-vp8/common/treecoder.h
-vp8/common/variance_c.c
-vp8/common/variance.h
-vp8/common/vp8_entropymodedata.h
-vp8/decoder/dboolhuff.c
-vp8/decoder/dboolhuff.h
-vp8/decoder/decodemv.c
-vp8/decoder/decodemv.h
-vp8/decoder/decoderthreading.h
-vp8/decoder/decodframe.c
-vp8/decoder/detokenize.c
-vp8/decoder/detokenize.h
-vp8/decoder/onyxd_if.c
-vp8/decoder/onyxd_int.h
-vp8/decoder/threading.c
-vp8/decoder/treereader.h
-vp8/encoder/bitstream.c
-vp8/encoder/bitstream.h
-vp8/encoder/block.h
-vp8/encoder/boolhuff.c
-vp8/encoder/boolhuff.h
-vp8/encoder/dct.c
-vp8/encoder/dct_value_cost.h
-vp8/encoder/dct_value_tokens.h
-vp8/encoder/defaultcoefcounts.h
-vp8/encoder/denoising.c
-vp8/encoder/denoising.h
-vp8/encoder/encodeframe.c
-vp8/encoder/encodeframe.h
-vp8/encoder/encodeintra.c
-vp8/encoder/encodeintra.h
-vp8/encoder/encodemb.c
-vp8/encoder/encodemb.h
-vp8/encoder/encodemv.c
-vp8/encoder/encodemv.h
-vp8/encoder/ethreading.c
-vp8/encoder/firstpass.h
-vp8/encoder/lookahead.c
-vp8/encoder/lookahead.h
-vp8/encoder/mcomp.c
-vp8/encoder/mcomp.h
-vp8/encoder/modecosts.c
-vp8/encoder/modecosts.h
-vp8/encoder/onyx_if.c
-vp8/encoder/onyx_int.h
-vp8/encoder/pickinter.c
-vp8/encoder/pickinter.h
-vp8/encoder/picklpf.c
-vp8/encoder/psnr.c
-vp8/encoder/psnr.h
-vp8/encoder/quantize.c
-vp8/encoder/quantize.h
-vp8/encoder/ratectrl.c
-vp8/encoder/ratectrl.h
-vp8/encoder/rdopt.c
-vp8/encoder/rdopt.h
-vp8/encoder/segmentation.c
-vp8/encoder/segmentation.h
-vp8/encoder/tokenize.c
-vp8/encoder/tokenize.h
-vp8/encoder/treewriter.c
-vp8/encoder/treewriter.h
-vp8/encoder/vp8_asm_enc_offsets.c
-vp8/vp8_common.mk
-vp8/vp8_cx_iface.c
-vp8/vp8cx.mk
-vp8/vp8_dx_iface.c
-vp8/vp8dx.mk
-vp9/common/generic/vp9_systemdependent.c
-vp9/common/mips/dspr2/vp9_common_dspr2.h
-vp9/common/mips/dspr2/vp9_convolve2_avg_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve2_avg_horiz_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve2_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve2_horiz_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve2_vert_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve8_avg_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve8_avg_horiz_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve8_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve8_horiz_dspr2.c
-vp9/common/mips/dspr2/vp9_convolve8_vert_dspr2.c
-vp9/common/mips/dspr2/vp9_intrapred16_dspr2.c
-vp9/common/mips/dspr2/vp9_intrapred4_dspr2.c
-vp9/common/mips/dspr2/vp9_intrapred8_dspr2.c
-vp9/common/mips/dspr2/vp9_itrans16_dspr2.c
-vp9/common/mips/dspr2/vp9_itrans32_cols_dspr2.c
-vp9/common/mips/dspr2/vp9_itrans32_dspr2.c
-vp9/common/mips/dspr2/vp9_itrans4_dspr2.c
-vp9/common/mips/dspr2/vp9_itrans8_dspr2.c
-vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.c
-vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h
-vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h
-vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h
-vp9/common/mips/dspr2/vp9_mbloop_loopfilter_dspr2.c
-vp9/common/mips/dspr2/vp9_mblpf_horiz_loopfilter_dspr2.c
-vp9/common/mips/dspr2/vp9_mblpf_vert_loopfilter_dspr2.c
-vp9/common/vp9_alloccommon.c
-vp9/common/vp9_alloccommon.h
-vp9/common/vp9_blockd.h
-vp9/common/vp9_common_data.c
-vp9/common/vp9_common_data.h
-vp9/common/vp9_common.h
-vp9/common/vp9_convolve.c
-vp9/common/vp9_convolve.h
-vp9/common/vp9_debugmodes.c
-vp9/common/vp9_default_coef_probs.h
-vp9/common/vp9_entropy.c
-vp9/common/vp9_entropy.h
-vp9/common/vp9_entropymode.c
-vp9/common/vp9_entropymode.h
-vp9/common/vp9_entropymv.c
-vp9/common/vp9_entropymv.h
-vp9/common/vp9_enums.h
-vp9/common/vp9_extend.c
-vp9/common/vp9_extend.h
-vp9/common/vp9_filter.c
-vp9/common/vp9_filter.h
-vp9/common/vp9_findnearmv.c
-vp9/common/vp9_findnearmv.h
-vp9/common/vp9_idct.c
-vp9/common/vp9_idct.h
-vp9/common/vp9_loopfilter.c
-vp9/common/vp9_loopfilter_filters.c
-vp9/common/vp9_loopfilter.h
-vp9/common/vp9_mv.h
-vp9/common/vp9_mvref_common.c
-vp9/common/vp9_mvref_common.h
-vp9/common/vp9_onyxc_int.h
-vp9/common/vp9_onyx.h
-vp9/common/vp9_ppflags.h
-vp9/common/vp9_pragmas.h
-vp9/common/vp9_pred_common.c
-vp9/common/vp9_pred_common.h
-vp9/common/vp9_quant_common.c
-vp9/common/vp9_quant_common.h
-vp9/common/vp9_reconinter.c
-vp9/common/vp9_reconinter.h
-vp9/common/vp9_reconintra.c
-vp9/common/vp9_reconintra.h
-vp9/common/vp9_rtcd.c
-vp9/common/vp9_rtcd_defs.sh
-vp9/common/vp9_sadmxn.h
-vp9/common/vp9_scale.c
-vp9/common/vp9_scale.h
-vp9/common/vp9_scan.c
-vp9/common/vp9_scan.h
-vp9/common/vp9_seg_common.c
-vp9/common/vp9_seg_common.h
-vp9/common/vp9_systemdependent.h
-vp9/common/vp9_textblit.h
-vp9/common/vp9_tile_common.c
-vp9/common/vp9_tile_common.h
-vp9/common/vp9_treecoder.c
-vp9/common/vp9_treecoder.h
-vp9/decoder/vp9_dboolhuff.c
-vp9/decoder/vp9_dboolhuff.h
-vp9/decoder/vp9_decodemv.c
-vp9/decoder/vp9_decodemv.h
-vp9/decoder/vp9_decodframe.c
-vp9/decoder/vp9_decodframe.h
-vp9/decoder/vp9_detokenize.c
-vp9/decoder/vp9_detokenize.h
-vp9/decoder/vp9_dsubexp.c
-vp9/decoder/vp9_dsubexp.h
-vp9/decoder/vp9_onyxd.h
-vp9/decoder/vp9_onyxd_if.c
-vp9/decoder/vp9_onyxd_int.h
-vp9/decoder/vp9_read_bit_buffer.h
-vp9/decoder/vp9_thread.c
-vp9/decoder/vp9_thread.h
-vp9/decoder/vp9_treereader.h
-vp9/vp9_common.mk
-vp9/vp9_dx_iface.c
-vp9/vp9dx.mk
-vp9/vp9_iface_common.h
-vpx_config.c
-vpx/internal/vpx_codec_internal.h
-vpx_mem/include/vpx_mem_intrnl.h
-vpx_mem/vpx_mem.c
-vpx_mem/vpx_mem.h
-vpx_mem/vpx_mem.mk
-vpx_ports/asm_offsets.h
-vpx_ports/emmintrin_compat.h
-vpx_ports/mem.h
-vpx_ports/vpx_once.h
-vpx_ports/vpx_ports.mk
-vpx_ports/vpx_timer.h
-vpx_scale/generic/gen_scalers.c
-vpx_scale/generic/vpx_scale.c
-vpx_scale/generic/yv12config.c
-vpx_scale/generic/yv12extend.c
-vpx_scale/mips/dspr2/yv12extend_dspr2.c
-vpx_scale/vpx_scale_asm_offsets.c
-vpx_scale/vpx_scale.h
-vpx_scale/vpx_scale.mk
-vpx_scale/vpx_scale_rtcd.c
-vpx_scale/vpx_scale_rtcd.sh
-vpx_scale/yv12config.h
-vpx/src/vpx_codec.c
-vpx/src/vpx_decoder.c
-vpx/src/vpx_encoder.c
-vpx/src/vpx_image.c
-vpx/vp8cx.h
-vpx/vp8dx.h
-vpx/vp8.h
-vpx/vpx_codec.h
-vpx/vpx_codec.mk
-vpx/vpx_decoder.h
-vpx/vpx_encoder.h
-vpx/vpx_image.h
-vpx/vpx_integer.h
diff --git a/videocodec/libvpx_internal/mips-dspr2/vp8_rtcd.h b/videocodec/libvpx_internal/mips-dspr2/vp8_rtcd.h
deleted file mode 100644
index 3208494..0000000
--- a/videocodec/libvpx_internal/mips-dspr2/vp8_rtcd.h
+++ /dev/null
@@ -1,329 +0,0 @@
-#ifndef VP8_RTCD_H_
-#define VP8_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP8
- */
-
-struct blockd;
-struct macroblockd;
-struct loop_filter_info;
-
-/* Encoder forward decls */
-struct block;
-struct macroblock;
-struct variance_vtable;
-union int_mv;
-struct yv12_buffer_config;
-
-void vp8_clear_system_state_c();
-#define vp8_clear_system_state vp8_clear_system_state_c
-
-void vp8_dequantize_b_c(struct blockd*, short *dqc);
-#define vp8_dequantize_b vp8_dequantize_b_c
-
-void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *output, int stride);
-void vp8_dequant_idct_add_dspr2(short *input, short *dq, unsigned char *output, int stride);
-#define vp8_dequant_idct_add vp8_dequant_idct_add_dspr2
-
-void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-void vp8_dequant_idct_add_y_block_dspr2(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_dspr2
-
-void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-void vp8_dequant_idct_add_uv_block_dspr2(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_dspr2
-
-void vp8_loop_filter_mbv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbv_dspr2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbv vp8_loop_filter_mbv_dspr2
-
-void vp8_loop_filter_bv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bv_dspr2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bv vp8_loop_filter_bv_dspr2
-
-void vp8_loop_filter_mbh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbh_dspr2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbh vp8_loop_filter_mbh_dspr2
-
-void vp8_loop_filter_bh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bh_dspr2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bh vp8_loop_filter_bh_dspr2
-
-void vp8_loop_filter_simple_vertical_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbv vp8_loop_filter_simple_vertical_edge_c
-
-void vp8_loop_filter_simple_horizontal_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbh vp8_loop_filter_simple_horizontal_edge_c
-
-void vp8_loop_filter_bvs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bv vp8_loop_filter_bvs_c
-
-void vp8_loop_filter_bhs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bh vp8_loop_filter_bhs_c
-
-void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-void vp8_short_idct4x4llm_dspr2(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-#define vp8_short_idct4x4llm vp8_short_idct4x4llm_dspr2
-
-void vp8_short_inv_walsh4x4_1_c(short *input, short *output);
-void vp8_short_inv_walsh4x4_1_dspr2(short *input, short *output);
-#define vp8_short_inv_walsh4x4_1 vp8_short_inv_walsh4x4_1_dspr2
-
-void vp8_short_inv_walsh4x4_c(short *input, short *output);
-void vp8_short_inv_walsh4x4_dspr2(short *input, short *output);
-#define vp8_short_inv_walsh4x4 vp8_short_inv_walsh4x4_dspr2
-
-void vp8_dc_only_idct_add_c(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-void vp8_dc_only_idct_add_dspr2(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-#define vp8_dc_only_idct_add vp8_dc_only_idct_add_dspr2
-
-void vp8_copy_mem16x16_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem16x16_dspr2(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem16x16 vp8_copy_mem16x16_dspr2
-
-void vp8_copy_mem8x8_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x8_dspr2(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x8 vp8_copy_mem8x8_dspr2
-
-void vp8_copy_mem8x4_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x4_dspr2(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x4 vp8_copy_mem8x4_dspr2
-
-void vp8_build_intra_predictors_mby_s_c(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-#define vp8_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_c
-
-void vp8_build_intra_predictors_mbuv_s_c(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-#define vp8_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s_c
-
-void vp8_intra4x4_predict_c(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-#define vp8_intra4x4_predict vp8_intra4x4_predict_c
-
-void vp8_sixtap_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict16x16_dspr2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict16x16 vp8_sixtap_predict16x16_dspr2
-
-void vp8_sixtap_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x8_dspr2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x8 vp8_sixtap_predict8x8_dspr2
-
-void vp8_sixtap_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x4_dspr2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x4 vp8_sixtap_predict8x4_dspr2
-
-void vp8_sixtap_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict4x4_dspr2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict4x4 vp8_sixtap_predict4x4_dspr2
-
-void vp8_bilinear_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict16x16 vp8_bilinear_predict16x16_c
-
-void vp8_bilinear_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x8 vp8_bilinear_predict8x8_c
-
-void vp8_bilinear_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x4 vp8_bilinear_predict8x4_c
-
-void vp8_bilinear_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict4x4 vp8_bilinear_predict4x4_c
-
-unsigned int vp8_variance4x4_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance4x4 vp8_variance4x4_c
-
-unsigned int vp8_variance8x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x8 vp8_variance8x8_c
-
-unsigned int vp8_variance8x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x16 vp8_variance8x16_c
-
-unsigned int vp8_variance16x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x8 vp8_variance16x8_c
-
-unsigned int vp8_variance16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x16 vp8_variance16x16_c
-
-unsigned int vp8_sub_pixel_variance4x4_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance4x4 vp8_sub_pixel_variance4x4_c
-
-unsigned int vp8_sub_pixel_variance8x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x8 vp8_sub_pixel_variance8x8_c
-
-unsigned int vp8_sub_pixel_variance8x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x16 vp8_sub_pixel_variance8x16_c
-
-unsigned int vp8_sub_pixel_variance16x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x8 vp8_sub_pixel_variance16x8_c
-
-unsigned int vp8_sub_pixel_variance16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x16 vp8_sub_pixel_variance16x16_c
-
-unsigned int vp8_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_h vp8_variance_halfpixvar16x16_h_c
-
-unsigned int vp8_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_v vp8_variance_halfpixvar16x16_v_c
-
-unsigned int vp8_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_hv vp8_variance_halfpixvar16x16_hv_c
-
-unsigned int vp8_sad4x4_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad4x4 vp8_sad4x4_c
-
-unsigned int vp8_sad8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x8 vp8_sad8x8_c
-
-unsigned int vp8_sad8x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x16 vp8_sad8x16_c
-
-unsigned int vp8_sad16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x8 vp8_sad16x8_c
-
-unsigned int vp8_sad16x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x16 vp8_sad16x16_c
-
-void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x3 vp8_sad4x4x3_c
-
-void vp8_sad8x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x3 vp8_sad8x8x3_c
-
-void vp8_sad8x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x3 vp8_sad8x16x3_c
-
-void vp8_sad16x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x3 vp8_sad16x8x3_c
-
-void vp8_sad16x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x3 vp8_sad16x16x3_c
-
-void vp8_sad4x4x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad4x4x8 vp8_sad4x4x8_c
-
-void vp8_sad8x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x8x8 vp8_sad8x8x8_c
-
-void vp8_sad8x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x16x8 vp8_sad8x16x8_c
-
-void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x8x8 vp8_sad16x8x8_c
-
-void vp8_sad16x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x16x8 vp8_sad16x16x8_c
-
-void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x4d vp8_sad4x4x4d_c
-
-void vp8_sad8x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x4d vp8_sad8x8x4d_c
-
-void vp8_sad8x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x4d vp8_sad8x16x4d_c
-
-void vp8_sad16x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x4d vp8_sad16x8x4d_c
-
-void vp8_sad16x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x4d vp8_sad16x16x4d_c
-
-unsigned int vp8_get_mb_ss_c(const short *);
-#define vp8_get_mb_ss vp8_get_mb_ss_c
-
-unsigned int vp8_sub_pixel_mse16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_mse16x16 vp8_sub_pixel_mse16x16_c
-
-unsigned int vp8_mse16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_mse16x16 vp8_mse16x16_c
-
-unsigned int vp8_get4x4sse_cs_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-#define vp8_get4x4sse_cs vp8_get4x4sse_cs_c
-
-void vp8_short_fdct4x4_c(short *input, short *output, int pitch);
-#define vp8_short_fdct4x4 vp8_short_fdct4x4_c
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch);
-#define vp8_short_fdct8x4 vp8_short_fdct8x4_c
-
-void vp8_short_walsh4x4_c(short *input, short *output, int pitch);
-#define vp8_short_walsh4x4 vp8_short_walsh4x4_c
-
-void vp8_regular_quantize_b_c(struct block *, struct blockd *);
-#define vp8_regular_quantize_b vp8_regular_quantize_b_c
-
-void vp8_fast_quantize_b_c(struct block *, struct blockd *);
-#define vp8_fast_quantize_b vp8_fast_quantize_b_c
-
-void vp8_regular_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_regular_quantize_b_pair vp8_regular_quantize_b_pair_c
-
-void vp8_fast_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_fast_quantize_b_pair vp8_fast_quantize_b_pair_c
-
-void vp8_quantize_mb_c(struct macroblock *);
-#define vp8_quantize_mb vp8_quantize_mb_c
-
-void vp8_quantize_mby_c(struct macroblock *);
-#define vp8_quantize_mby vp8_quantize_mby_c
-
-void vp8_quantize_mbuv_c(struct macroblock *);
-#define vp8_quantize_mbuv vp8_quantize_mbuv_c
-
-int vp8_block_error_c(short *coeff, short *dqcoeff);
-#define vp8_block_error vp8_block_error_c
-
-int vp8_mbblock_error_c(struct macroblock *mb, int dc);
-#define vp8_mbblock_error vp8_mbblock_error_c
-
-int vp8_mbuverror_c(struct macroblock *mb);
-#define vp8_mbuverror vp8_mbuverror_c
-
-void vp8_subtract_b_c(struct block *be, struct blockd *bd, int pitch);
-#define vp8_subtract_b vp8_subtract_b_c
-
-void vp8_subtract_mby_c(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-#define vp8_subtract_mby vp8_subtract_mby_c
-
-void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-#define vp8_subtract_mbuv vp8_subtract_mbuv_c
-
-int vp8_full_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_full_search_sad vp8_full_search_sad_c
-
-int vp8_refining_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_refining_search_sad vp8_refining_search_sad_c
-
-int vp8_diamond_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_diamond_search_sad vp8_diamond_search_sad_c
-
-void vp8_yv12_copy_partial_frame_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_partial_frame vp8_yv12_copy_partial_frame_c
-
-int vp8_denoiser_filter_c(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-#define vp8_denoiser_filter vp8_denoiser_filter_c
-
-void vp8_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-#if HAVE_DSPR2
-#if CONFIG_VP8
-void dsputil_static_init();
-dsputil_static_init();
-#endif
-#if CONFIG_VP9
-void vp9_dsputil_static_init();
-vp9_dsputil_static_init();
-#endif
-#endif
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/mips-dspr2/vp9_rtcd.h b/videocodec/libvpx_internal/mips-dspr2/vp9_rtcd.h
deleted file mode 100644
index ded4c59..0000000
--- a/videocodec/libvpx_internal/mips-dspr2/vp9_rtcd.h
+++ /dev/null
@@ -1,337 +0,0 @@
-#ifndef VP9_RTCD_H_
-#define VP9_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP9
- */
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_enums.h"
-
-struct macroblockd;
-
-/* Encoder forward decls */
-struct macroblock;
-struct vp9_variance_vtable;
-
-#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
-union int_mv;
-struct yv12_buffer_config;
-
-void vp9_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_4x4 vp9_d207_predictor_4x4_c
-
-void vp9_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_4x4 vp9_d45_predictor_4x4_c
-
-void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_4x4 vp9_d63_predictor_4x4_c
-
-void vp9_h_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_h_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_4x4 vp9_h_predictor_4x4_dspr2
-
-void vp9_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_4x4 vp9_d117_predictor_4x4_c
-
-void vp9_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_4x4 vp9_d135_predictor_4x4_c
-
-void vp9_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_4x4 vp9_d153_predictor_4x4_c
-
-void vp9_v_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_4x4 vp9_v_predictor_4x4_c
-
-void vp9_tm_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_tm_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_4x4 vp9_tm_predictor_4x4_dspr2
-
-void vp9_dc_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_dc_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_4x4 vp9_dc_predictor_4x4_dspr2
-
-void vp9_dc_top_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_4x4 vp9_dc_top_predictor_4x4_c
-
-void vp9_dc_left_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_4x4 vp9_dc_left_predictor_4x4_c
-
-void vp9_dc_128_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_4x4 vp9_dc_128_predictor_4x4_c
-
-void vp9_d207_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_8x8 vp9_d207_predictor_8x8_c
-
-void vp9_d45_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_8x8 vp9_d45_predictor_8x8_c
-
-void vp9_d63_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_8x8 vp9_d63_predictor_8x8_c
-
-void vp9_h_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_h_predictor_8x8_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_8x8 vp9_h_predictor_8x8_dspr2
-
-void vp9_d117_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_8x8 vp9_d117_predictor_8x8_c
-
-void vp9_d135_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_8x8 vp9_d135_predictor_8x8_c
-
-void vp9_d153_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_8x8 vp9_d153_predictor_8x8_c
-
-void vp9_v_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_8x8 vp9_v_predictor_8x8_c
-
-void vp9_tm_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_tm_predictor_8x8_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_8x8 vp9_tm_predictor_8x8_dspr2
-
-void vp9_dc_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_dc_predictor_8x8_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_8x8 vp9_dc_predictor_8x8_dspr2
-
-void vp9_dc_top_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_8x8 vp9_dc_top_predictor_8x8_c
-
-void vp9_dc_left_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_8x8 vp9_dc_left_predictor_8x8_c
-
-void vp9_dc_128_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_8x8 vp9_dc_128_predictor_8x8_c
-
-void vp9_d207_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_16x16 vp9_d207_predictor_16x16_c
-
-void vp9_d45_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_16x16 vp9_d45_predictor_16x16_c
-
-void vp9_d63_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_16x16 vp9_d63_predictor_16x16_c
-
-void vp9_h_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_h_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_16x16 vp9_h_predictor_16x16_dspr2
-
-void vp9_d117_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_16x16 vp9_d117_predictor_16x16_c
-
-void vp9_d135_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_16x16 vp9_d135_predictor_16x16_c
-
-void vp9_d153_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_16x16 vp9_d153_predictor_16x16_c
-
-void vp9_v_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_16x16 vp9_v_predictor_16x16_c
-
-void vp9_tm_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_16x16 vp9_tm_predictor_16x16_c
-
-void vp9_dc_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_dc_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_16x16 vp9_dc_predictor_16x16_dspr2
-
-void vp9_dc_top_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_16x16 vp9_dc_top_predictor_16x16_c
-
-void vp9_dc_left_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_16x16 vp9_dc_left_predictor_16x16_c
-
-void vp9_dc_128_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_16x16 vp9_dc_128_predictor_16x16_c
-
-void vp9_d207_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_32x32 vp9_d207_predictor_32x32_c
-
-void vp9_d45_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_32x32 vp9_d45_predictor_32x32_c
-
-void vp9_d63_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_32x32 vp9_d63_predictor_32x32_c
-
-void vp9_h_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_32x32 vp9_h_predictor_32x32_c
-
-void vp9_d117_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_32x32 vp9_d117_predictor_32x32_c
-
-void vp9_d135_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_32x32 vp9_d135_predictor_32x32_c
-
-void vp9_d153_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_32x32 vp9_d153_predictor_32x32_c
-
-void vp9_v_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_32x32 vp9_v_predictor_32x32_c
-
-void vp9_tm_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_32x32 vp9_tm_predictor_32x32_c
-
-void vp9_dc_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_32x32 vp9_dc_predictor_32x32_c
-
-void vp9_dc_top_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_32x32 vp9_dc_top_predictor_32x32_c
-
-void vp9_dc_left_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_32x32 vp9_dc_left_predictor_32x32_c
-
-void vp9_dc_128_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_32x32 vp9_dc_128_predictor_32x32_c
-
-void vp9_mb_lpf_vertical_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-void vp9_mb_lpf_vertical_edge_w_dspr2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-#define vp9_mb_lpf_vertical_edge_w vp9_mb_lpf_vertical_edge_w_dspr2
-
-void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_mbloop_filter_vertical_edge_dspr2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_vertical_edge vp9_mbloop_filter_vertical_edge_dspr2
-
-void vp9_loop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_loop_filter_vertical_edge_dspr2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_vertical_edge vp9_loop_filter_vertical_edge_dspr2
-
-void vp9_mb_lpf_horizontal_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_mb_lpf_horizontal_edge_w_dspr2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mb_lpf_horizontal_edge_w vp9_mb_lpf_horizontal_edge_w_dspr2
-
-void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_mbloop_filter_horizontal_edge_dspr2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_horizontal_edge vp9_mbloop_filter_horizontal_edge_dspr2
-
-void vp9_loop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_loop_filter_horizontal_edge_dspr2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_horizontal_edge vp9_loop_filter_horizontal_edge_dspr2
-
-void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_inner vp9_blend_mb_inner_c
-
-void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_outer vp9_blend_mb_outer_c
-
-void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_b vp9_blend_b_c
-
-void vp9_convolve_copy_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);
-void vp9_convolve_copy_dspr2(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);
-#define vp9_convolve_copy vp9_convolve_copy_dspr2
-
-void vp9_convolve_avg_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);
-void vp9_convolve_avg_dspr2(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);
-#define vp9_convolve_avg vp9_convolve_avg_dspr2
-
-void vp9_convolve8_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);
-void vp9_convolve8_dspr2(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);
-#define vp9_convolve8 vp9_convolve8_dspr2
-
-void vp9_convolve8_horiz_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);
-void vp9_convolve8_horiz_dspr2(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);
-#define vp9_convolve8_horiz vp9_convolve8_horiz_dspr2
-
-void vp9_convolve8_vert_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);
-void vp9_convolve8_vert_dspr2(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);
-#define vp9_convolve8_vert vp9_convolve8_vert_dspr2
-
-void vp9_convolve8_avg_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);
-void vp9_convolve8_avg_dspr2(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);
-#define vp9_convolve8_avg vp9_convolve8_avg_dspr2
-
-void vp9_convolve8_avg_horiz_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);
-void vp9_convolve8_avg_horiz_dspr2(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);
-#define vp9_convolve8_avg_horiz vp9_convolve8_avg_horiz_dspr2
-
-void vp9_convolve8_avg_vert_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);
-void vp9_convolve8_avg_vert_dspr2(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);
-#define vp9_convolve8_avg_vert vp9_convolve8_avg_vert_dspr2
-
-void vp9_idct4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct4x4_1_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_1_add vp9_idct4x4_1_add_dspr2
-
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct4x4_16_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_16_add vp9_idct4x4_16_add_dspr2
-
-void vp9_idct8x8_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_1_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_1_add vp9_idct8x8_1_add_dspr2
-
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_64_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_64_add vp9_idct8x8_64_add_dspr2
-
-void vp9_idct8x8_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_10_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_10_add vp9_idct8x8_10_add_dspr2
-
-void vp9_idct16x16_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_1_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_1_add vp9_idct16x16_1_add_dspr2
-
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_256_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_256_add vp9_idct16x16_256_add_dspr2
-
-void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_10_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_10_add vp9_idct16x16_10_add_dspr2
-
-void vp9_idct32x32_1024_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_1024_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1024_add vp9_idct32x32_1024_add_dspr2
-
-void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_34_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_34_add vp9_idct32x32_34_add_dspr2
-
-void vp9_idct32x32_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_1_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1_add vp9_idct32x32_1_add_dspr2
-
-void vp9_iht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-void vp9_iht4x4_16_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht4x4_16_add vp9_iht4x4_16_add_dspr2
-
-void vp9_iht8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-void vp9_iht8x8_64_add_dspr2(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht8x8_64_add vp9_iht8x8_64_add_dspr2
-
-void vp9_iht16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-void vp9_iht16x16_256_add_dspr2(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-#define vp9_iht16x16_256_add vp9_iht16x16_256_add_dspr2
-
-void vp9_iwht4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_1_add vp9_iwht4x4_1_add_c
-
-void vp9_iwht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_16_add vp9_iwht4x4_16_add_c
-
-void vp9_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-#if HAVE_DSPR2
-#if CONFIG_VP8
-void dsputil_static_init();
-dsputil_static_init();
-#endif
-#if CONFIG_VP9
-void vp9_dsputil_static_init();
-vp9_dsputil_static_init();
-#endif
-#endif
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/mips-dspr2/vpx_config.c b/videocodec/libvpx_internal/mips-dspr2/vpx_config.c
deleted file mode 100644
index 1036456..0000000
--- a/videocodec/libvpx_internal/mips-dspr2/vpx_config.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-static const char* const cfg = "--force-target=mips32-android-gcc --disable-runtime-cpu-detect --sdk-path=/usr/local/google/home/hkuang/Downloads/android-ndk-r8e --disable-vp9-encoder --enable-dspr2 --disable-examples --disable-docs --enable-realtime-only";
-const char *vpx_codec_build_config(void) {return cfg;}
diff --git a/videocodec/libvpx_internal/mips-dspr2/vpx_config.h b/videocodec/libvpx_internal/mips-dspr2/vpx_config.h
deleted file mode 100644
index d8a7dba..0000000
--- a/videocodec/libvpx_internal/mips-dspr2/vpx_config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-/* This file automatically generated by configure. Do not edit! */
-#ifndef VPX_CONFIG_H
-#define VPX_CONFIG_H
-#define RESTRICT
-#define INLINE __inline__ __attribute__((always_inline))
-#define ARCH_ARM 0
-#define ARCH_MIPS 1
-#define ARCH_X86_32 0
-#define ARCH_X86_64 0
-#define ARCH_PPC32 0
-#define ARCH_PPC64 0
-#define HAVE_EDSP 0
-#define HAVE_MEDIA 0
-#define HAVE_NEON 0
-#define HAVE_MIPS32 1
-#define HAVE_DSPR2 1
-#define HAVE_MMX 0
-#define HAVE_SSE 0
-#define HAVE_SSE2 0
-#define HAVE_SSE3 0
-#define HAVE_SSSE3 0
-#define HAVE_SSE4_1 0
-#define HAVE_AVX 0
-#define HAVE_AVX2 0
-#define HAVE_ALTIVEC 0
-#define HAVE_VPX_PORTS 1
-#define HAVE_STDINT_H 1
-#define HAVE_ALT_TREE_LAYOUT 0
-#define HAVE_PTHREAD_H 1
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_UNISTD_H 1
-#define CONFIG_EXTERNAL_BUILD 0
-#define CONFIG_INSTALL_DOCS 0
-#define CONFIG_INSTALL_BINS 1
-#define CONFIG_INSTALL_LIBS 1
-#define CONFIG_INSTALL_SRCS 0
-#define CONFIG_USE_X86INC 1
-#define CONFIG_DEBUG 0
-#define CONFIG_GPROF 0
-#define CONFIG_GCOV 0
-#define CONFIG_RVCT 0
-#define CONFIG_GCC 1
-#define CONFIG_MSVS 0
-#define CONFIG_PIC 0
-#define CONFIG_BIG_ENDIAN 0
-#define CONFIG_CODEC_SRCS 0
-#define CONFIG_DEBUG_LIBS 0
-#define CONFIG_FAST_UNALIGNED 0
-#define CONFIG_MEM_MANAGER 0
-#define CONFIG_MEM_TRACKER 0
-#define CONFIG_MEM_CHECKS 0
-#define CONFIG_MD5 1
-#define CONFIG_DEQUANT_TOKENS 1
-#define CONFIG_DC_RECON 1
-#define CONFIG_RUNTIME_CPU_DETECT 0
-#define CONFIG_POSTPROC 0
-#define CONFIG_VP9_POSTPROC 0
-#define CONFIG_MULTITHREAD 1
-#define CONFIG_INTERNAL_STATS 0
-#define CONFIG_VP8_ENCODER 1
-#define CONFIG_VP8_DECODER 1
-#define CONFIG_VP9_ENCODER 0
-#define CONFIG_VP9_DECODER 1
-#define CONFIG_VP8 1
-#define CONFIG_VP9 1
-#define CONFIG_ENCODERS 1
-#define CONFIG_DECODERS 1
-#define CONFIG_STATIC_MSVCRT 0
-#define CONFIG_SPATIAL_RESAMPLING 1
-#define CONFIG_REALTIME_ONLY 1
-#define CONFIG_ONTHEFLY_BITPACKING 0
-#define CONFIG_ERROR_CONCEALMENT 0
-#define CONFIG_SHARED 0
-#define CONFIG_STATIC 1
-#define CONFIG_SMALL 0
-#define CONFIG_POSTPROC_VISUALIZER 0
-#define CONFIG_OS_SUPPORT 1
-#define CONFIG_UNIT_TESTS 0
-#define CONFIG_MULTI_RES_ENCODING 0
-#define CONFIG_TEMPORAL_DENOISING 1
-#define CONFIG_EXPERIMENTAL 0
-#define CONFIG_DECRYPT 0
-#define CONFIG_MULTIPLE_ARF 0
-#define CONFIG_NON420 0
-#define CONFIG_ALPHA 0
-#endif /* VPX_CONFIG_H */
diff --git a/videocodec/libvpx_internal/mips-dspr2/vpx_scale_rtcd.h b/videocodec/libvpx_internal/mips-dspr2/vpx_scale_rtcd.h
deleted file mode 100644
index 483a0d2..0000000
--- a/videocodec/libvpx_internal/mips-dspr2/vpx_scale_rtcd.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef VPX_SCALE_RTCD_H_
-#define VPX_SCALE_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-struct yv12_buffer_config;
-
-void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
-
-void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
-
-void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
-
-void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
-
-void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
-
-void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
-#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_c
-
-void vp8_yv12_copy_frame_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_frame vp8_yv12_copy_frame_c
-
-void vpx_yv12_copy_y_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vpx_yv12_copy_y vpx_yv12_copy_y_c
-
-void vp9_extend_frame_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-void vp9_extend_frame_borders_dspr2(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_borders vp9_extend_frame_borders_dspr2
-
-void vp9_extend_frame_inner_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-void vp9_extend_frame_inner_borders_dspr2(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_inner_borders vp9_extend_frame_inner_borders_dspr2
-
-void vpx_scale_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-#if HAVE_DSPR2
-#if CONFIG_VP8
-void dsputil_static_init();
-dsputil_static_init();
-#endif
-#if CONFIG_VP9
-void vp9_dsputil_static_init();
-vp9_dsputil_static_init();
-#endif
-#endif
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/mips-dspr2/vpx_version.h b/videocodec/libvpx_internal/mips-dspr2/vpx_version.h
deleted file mode 100644
index 9a354bb..0000000
--- a/videocodec/libvpx_internal/mips-dspr2/vpx_version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 2
-#define VERSION_PATCH 0
-#define VERSION_EXTRA "5082-g58f7543"
-#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define VERSION_STRING_NOSP "v1.2.0-5082-g58f7543"
-#define VERSION_STRING " v1.2.0-5082-g58f7543"
diff --git a/videocodec/libvpx_internal/mips/libvpx_srcs.txt b/videocodec/libvpx_internal/mips/libvpx_srcs.txt
deleted file mode 100644
index e07d5af..0000000
--- a/videocodec/libvpx_internal/mips/libvpx_srcs.txt
+++ /dev/null
@@ -1,242 +0,0 @@
-build/make/rtcd.sh
-build/make/version.sh
-CHANGELOG
-libs.mk
-vp8/common/alloccommon.c
-vp8/common/alloccommon.h
-vp8/common/blockd.c
-vp8/common/blockd.h
-vp8/common/coefupdateprobs.h
-vp8/common/common.h
-vp8/common/debugmodes.c
-vp8/common/default_coef_probs.h
-vp8/common/dequantize.c
-vp8/common/entropy.c
-vp8/common/entropy.h
-vp8/common/entropymode.c
-vp8/common/entropymode.h
-vp8/common/entropymv.c
-vp8/common/entropymv.h
-vp8/common/extend.c
-vp8/common/extend.h
-vp8/common/filter.c
-vp8/common/filter.h
-vp8/common/findnearmv.c
-vp8/common/findnearmv.h
-vp8/common/generic/systemdependent.c
-vp8/common/header.h
-vp8/common/idct_blk.c
-vp8/common/idctllm.c
-vp8/common/invtrans.h
-vp8/common/loopfilter.c
-vp8/common/loopfilter_filters.c
-vp8/common/loopfilter.h
-vp8/common/mbpitch.c
-vp8/common/modecont.c
-vp8/common/modecont.h
-vp8/common/mv.h
-vp8/common/onyxc_int.h
-vp8/common/onyxd.h
-vp8/common/onyx.h
-vp8/common/ppflags.h
-vp8/common/pragmas.h
-vp8/common/quant_common.c
-vp8/common/quant_common.h
-vp8/common/reconinter.c
-vp8/common/reconinter.h
-vp8/common/reconintra4x4.c
-vp8/common/reconintra4x4.h
-vp8/common/reconintra.c
-vp8/common/rtcd.c
-vp8/common/rtcd_defs.sh
-vp8/common/sad_c.c
-vp8/common/setupintrarecon.c
-vp8/common/setupintrarecon.h
-vp8/common/swapyv12buffer.c
-vp8/common/swapyv12buffer.h
-vp8/common/systemdependent.h
-vp8/common/threading.h
-vp8/common/treecoder.c
-vp8/common/treecoder.h
-vp8/common/variance_c.c
-vp8/common/variance.h
-vp8/common/vp8_entropymodedata.h
-vp8/decoder/dboolhuff.c
-vp8/decoder/dboolhuff.h
-vp8/decoder/decodemv.c
-vp8/decoder/decodemv.h
-vp8/decoder/decoderthreading.h
-vp8/decoder/decodframe.c
-vp8/decoder/detokenize.c
-vp8/decoder/detokenize.h
-vp8/decoder/onyxd_if.c
-vp8/decoder/onyxd_int.h
-vp8/decoder/threading.c
-vp8/decoder/treereader.h
-vp8/encoder/bitstream.c
-vp8/encoder/bitstream.h
-vp8/encoder/block.h
-vp8/encoder/boolhuff.c
-vp8/encoder/boolhuff.h
-vp8/encoder/dct.c
-vp8/encoder/dct_value_cost.h
-vp8/encoder/dct_value_tokens.h
-vp8/encoder/defaultcoefcounts.h
-vp8/encoder/denoising.c
-vp8/encoder/denoising.h
-vp8/encoder/encodeframe.c
-vp8/encoder/encodeframe.h
-vp8/encoder/encodeintra.c
-vp8/encoder/encodeintra.h
-vp8/encoder/encodemb.c
-vp8/encoder/encodemb.h
-vp8/encoder/encodemv.c
-vp8/encoder/encodemv.h
-vp8/encoder/ethreading.c
-vp8/encoder/firstpass.h
-vp8/encoder/lookahead.c
-vp8/encoder/lookahead.h
-vp8/encoder/mcomp.c
-vp8/encoder/mcomp.h
-vp8/encoder/modecosts.c
-vp8/encoder/modecosts.h
-vp8/encoder/onyx_if.c
-vp8/encoder/onyx_int.h
-vp8/encoder/pickinter.c
-vp8/encoder/pickinter.h
-vp8/encoder/picklpf.c
-vp8/encoder/psnr.c
-vp8/encoder/psnr.h
-vp8/encoder/quantize.c
-vp8/encoder/quantize.h
-vp8/encoder/ratectrl.c
-vp8/encoder/ratectrl.h
-vp8/encoder/rdopt.c
-vp8/encoder/rdopt.h
-vp8/encoder/segmentation.c
-vp8/encoder/segmentation.h
-vp8/encoder/tokenize.c
-vp8/encoder/tokenize.h
-vp8/encoder/treewriter.c
-vp8/encoder/treewriter.h
-vp8/encoder/vp8_asm_enc_offsets.c
-vp8/vp8_common.mk
-vp8/vp8_cx_iface.c
-vp8/vp8cx.mk
-vp8/vp8_dx_iface.c
-vp8/vp8dx.mk
-vp9/common/generic/vp9_systemdependent.c
-vp9/common/vp9_alloccommon.c
-vp9/common/vp9_alloccommon.h
-vp9/common/vp9_blockd.h
-vp9/common/vp9_common_data.c
-vp9/common/vp9_common_data.h
-vp9/common/vp9_common.h
-vp9/common/vp9_convolve.c
-vp9/common/vp9_convolve.h
-vp9/common/vp9_debugmodes.c
-vp9/common/vp9_default_coef_probs.h
-vp9/common/vp9_entropy.c
-vp9/common/vp9_entropy.h
-vp9/common/vp9_entropymode.c
-vp9/common/vp9_entropymode.h
-vp9/common/vp9_entropymv.c
-vp9/common/vp9_entropymv.h
-vp9/common/vp9_enums.h
-vp9/common/vp9_extend.c
-vp9/common/vp9_extend.h
-vp9/common/vp9_filter.c
-vp9/common/vp9_filter.h
-vp9/common/vp9_findnearmv.c
-vp9/common/vp9_findnearmv.h
-vp9/common/vp9_idct.c
-vp9/common/vp9_idct.h
-vp9/common/vp9_loopfilter.c
-vp9/common/vp9_loopfilter_filters.c
-vp9/common/vp9_loopfilter.h
-vp9/common/vp9_mv.h
-vp9/common/vp9_mvref_common.c
-vp9/common/vp9_mvref_common.h
-vp9/common/vp9_onyxc_int.h
-vp9/common/vp9_onyx.h
-vp9/common/vp9_ppflags.h
-vp9/common/vp9_pragmas.h
-vp9/common/vp9_pred_common.c
-vp9/common/vp9_pred_common.h
-vp9/common/vp9_quant_common.c
-vp9/common/vp9_quant_common.h
-vp9/common/vp9_reconinter.c
-vp9/common/vp9_reconinter.h
-vp9/common/vp9_reconintra.c
-vp9/common/vp9_reconintra.h
-vp9/common/vp9_rtcd.c
-vp9/common/vp9_rtcd_defs.sh
-vp9/common/vp9_sadmxn.h
-vp9/common/vp9_scale.c
-vp9/common/vp9_scale.h
-vp9/common/vp9_scan.c
-vp9/common/vp9_scan.h
-vp9/common/vp9_seg_common.c
-vp9/common/vp9_seg_common.h
-vp9/common/vp9_systemdependent.h
-vp9/common/vp9_textblit.h
-vp9/common/vp9_tile_common.c
-vp9/common/vp9_tile_common.h
-vp9/common/vp9_treecoder.c
-vp9/common/vp9_treecoder.h
-vp9/decoder/vp9_dboolhuff.c
-vp9/decoder/vp9_dboolhuff.h
-vp9/decoder/vp9_decodemv.c
-vp9/decoder/vp9_decodemv.h
-vp9/decoder/vp9_decodframe.c
-vp9/decoder/vp9_decodframe.h
-vp9/decoder/vp9_detokenize.c
-vp9/decoder/vp9_detokenize.h
-vp9/decoder/vp9_dsubexp.c
-vp9/decoder/vp9_dsubexp.h
-vp9/decoder/vp9_onyxd.h
-vp9/decoder/vp9_onyxd_if.c
-vp9/decoder/vp9_onyxd_int.h
-vp9/decoder/vp9_read_bit_buffer.h
-vp9/decoder/vp9_thread.c
-vp9/decoder/vp9_thread.h
-vp9/decoder/vp9_treereader.h
-vp9/vp9_common.mk
-vp9/vp9_dx_iface.c
-vp9/vp9dx.mk
-vp9/vp9_iface_common.h
-vpx_config.c
-vpx/internal/vpx_codec_internal.h
-vpx_mem/include/vpx_mem_intrnl.h
-vpx_mem/vpx_mem.c
-vpx_mem/vpx_mem.h
-vpx_mem/vpx_mem.mk
-vpx_ports/asm_offsets.h
-vpx_ports/emmintrin_compat.h
-vpx_ports/mem.h
-vpx_ports/vpx_once.h
-vpx_ports/vpx_ports.mk
-vpx_ports/vpx_timer.h
-vpx_scale/generic/gen_scalers.c
-vpx_scale/generic/vpx_scale.c
-vpx_scale/generic/yv12config.c
-vpx_scale/generic/yv12extend.c
-vpx_scale/vpx_scale_asm_offsets.c
-vpx_scale/vpx_scale.h
-vpx_scale/vpx_scale.mk
-vpx_scale/vpx_scale_rtcd.c
-vpx_scale/vpx_scale_rtcd.sh
-vpx_scale/yv12config.h
-vpx/src/vpx_codec.c
-vpx/src/vpx_decoder.c
-vpx/src/vpx_encoder.c
-vpx/src/vpx_image.c
-vpx/vp8cx.h
-vpx/vp8dx.h
-vpx/vp8.h
-vpx/vpx_codec.h
-vpx/vpx_codec.mk
-vpx/vpx_decoder.h
-vpx/vpx_encoder.h
-vpx/vpx_image.h
-vpx/vpx_integer.h
diff --git a/videocodec/libvpx_internal/mips/vp8_rtcd.h b/videocodec/libvpx_internal/mips/vp8_rtcd.h
deleted file mode 100644
index 1a16643..0000000
--- a/videocodec/libvpx_internal/mips/vp8_rtcd.h
+++ /dev/null
@@ -1,311 +0,0 @@
-#ifndef VP8_RTCD_H_
-#define VP8_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP8
- */
-
-struct blockd;
-struct macroblockd;
-struct loop_filter_info;
-
-/* Encoder forward decls */
-struct block;
-struct macroblock;
-struct variance_vtable;
-union int_mv;
-struct yv12_buffer_config;
-
-void vp8_clear_system_state_c();
-#define vp8_clear_system_state vp8_clear_system_state_c
-
-void vp8_dequantize_b_c(struct blockd*, short *dqc);
-#define vp8_dequantize_b vp8_dequantize_b_c
-
-void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *output, int stride);
-#define vp8_dequant_idct_add vp8_dequant_idct_add_c
-
-void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_c
-
-void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_c
-
-void vp8_loop_filter_mbv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbv vp8_loop_filter_mbv_c
-
-void vp8_loop_filter_bv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bv vp8_loop_filter_bv_c
-
-void vp8_loop_filter_mbh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_mbh vp8_loop_filter_mbh_c
-
-void vp8_loop_filter_bh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-#define vp8_loop_filter_bh vp8_loop_filter_bh_c
-
-void vp8_loop_filter_simple_vertical_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbv vp8_loop_filter_simple_vertical_edge_c
-
-void vp8_loop_filter_simple_horizontal_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_mbh vp8_loop_filter_simple_horizontal_edge_c
-
-void vp8_loop_filter_bvs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bv vp8_loop_filter_bvs_c
-
-void vp8_loop_filter_bhs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-#define vp8_loop_filter_simple_bh vp8_loop_filter_bhs_c
-
-void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-#define vp8_short_idct4x4llm vp8_short_idct4x4llm_c
-
-void vp8_short_inv_walsh4x4_1_c(short *input, short *output);
-#define vp8_short_inv_walsh4x4_1 vp8_short_inv_walsh4x4_1_c
-
-void vp8_short_inv_walsh4x4_c(short *input, short *output);
-#define vp8_short_inv_walsh4x4 vp8_short_inv_walsh4x4_c
-
-void vp8_dc_only_idct_add_c(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-#define vp8_dc_only_idct_add vp8_dc_only_idct_add_c
-
-void vp8_copy_mem16x16_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem16x16 vp8_copy_mem16x16_c
-
-void vp8_copy_mem8x8_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x8 vp8_copy_mem8x8_c
-
-void vp8_copy_mem8x4_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-#define vp8_copy_mem8x4 vp8_copy_mem8x4_c
-
-void vp8_build_intra_predictors_mby_s_c(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-#define vp8_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_c
-
-void vp8_build_intra_predictors_mbuv_s_c(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-#define vp8_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s_c
-
-void vp8_intra4x4_predict_c(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-#define vp8_intra4x4_predict vp8_intra4x4_predict_c
-
-void vp8_sixtap_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict16x16 vp8_sixtap_predict16x16_c
-
-void vp8_sixtap_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x8 vp8_sixtap_predict8x8_c
-
-void vp8_sixtap_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict8x4 vp8_sixtap_predict8x4_c
-
-void vp8_sixtap_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_sixtap_predict4x4 vp8_sixtap_predict4x4_c
-
-void vp8_bilinear_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict16x16 vp8_bilinear_predict16x16_c
-
-void vp8_bilinear_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x8 vp8_bilinear_predict8x8_c
-
-void vp8_bilinear_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict8x4 vp8_bilinear_predict8x4_c
-
-void vp8_bilinear_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-#define vp8_bilinear_predict4x4 vp8_bilinear_predict4x4_c
-
-unsigned int vp8_variance4x4_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance4x4 vp8_variance4x4_c
-
-unsigned int vp8_variance8x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x8 vp8_variance8x8_c
-
-unsigned int vp8_variance8x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance8x16 vp8_variance8x16_c
-
-unsigned int vp8_variance16x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x8 vp8_variance16x8_c
-
-unsigned int vp8_variance16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance16x16 vp8_variance16x16_c
-
-unsigned int vp8_sub_pixel_variance4x4_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance4x4 vp8_sub_pixel_variance4x4_c
-
-unsigned int vp8_sub_pixel_variance8x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x8 vp8_sub_pixel_variance8x8_c
-
-unsigned int vp8_sub_pixel_variance8x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance8x16 vp8_sub_pixel_variance8x16_c
-
-unsigned int vp8_sub_pixel_variance16x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x8 vp8_sub_pixel_variance16x8_c
-
-unsigned int vp8_sub_pixel_variance16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_variance16x16 vp8_sub_pixel_variance16x16_c
-
-unsigned int vp8_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_h vp8_variance_halfpixvar16x16_h_c
-
-unsigned int vp8_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_v vp8_variance_halfpixvar16x16_v_c
-
-unsigned int vp8_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_variance_halfpixvar16x16_hv vp8_variance_halfpixvar16x16_hv_c
-
-unsigned int vp8_sad4x4_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad4x4 vp8_sad4x4_c
-
-unsigned int vp8_sad8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x8 vp8_sad8x8_c
-
-unsigned int vp8_sad8x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad8x16 vp8_sad8x16_c
-
-unsigned int vp8_sad16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x8 vp8_sad16x8_c
-
-unsigned int vp8_sad16x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-#define vp8_sad16x16 vp8_sad16x16_c
-
-void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x3 vp8_sad4x4x3_c
-
-void vp8_sad8x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x3 vp8_sad8x8x3_c
-
-void vp8_sad8x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x3 vp8_sad8x16x3_c
-
-void vp8_sad16x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x3 vp8_sad16x8x3_c
-
-void vp8_sad16x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x3 vp8_sad16x16x3_c
-
-void vp8_sad4x4x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad4x4x8 vp8_sad4x4x8_c
-
-void vp8_sad8x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x8x8 vp8_sad8x8x8_c
-
-void vp8_sad8x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad8x16x8 vp8_sad8x16x8_c
-
-void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x8x8 vp8_sad16x8x8_c
-
-void vp8_sad16x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-#define vp8_sad16x16x8 vp8_sad16x16x8_c
-
-void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad4x4x4d vp8_sad4x4x4d_c
-
-void vp8_sad8x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x8x4d vp8_sad8x8x4d_c
-
-void vp8_sad8x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad8x16x4d vp8_sad8x16x4d_c
-
-void vp8_sad16x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x8x4d vp8_sad16x8x4d_c
-
-void vp8_sad16x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-#define vp8_sad16x16x4d vp8_sad16x16x4d_c
-
-unsigned int vp8_get_mb_ss_c(const short *);
-#define vp8_get_mb_ss vp8_get_mb_ss_c
-
-unsigned int vp8_sub_pixel_mse16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-#define vp8_sub_pixel_mse16x16 vp8_sub_pixel_mse16x16_c
-
-unsigned int vp8_mse16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-#define vp8_mse16x16 vp8_mse16x16_c
-
-unsigned int vp8_get4x4sse_cs_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-#define vp8_get4x4sse_cs vp8_get4x4sse_cs_c
-
-void vp8_short_fdct4x4_c(short *input, short *output, int pitch);
-#define vp8_short_fdct4x4 vp8_short_fdct4x4_c
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch);
-#define vp8_short_fdct8x4 vp8_short_fdct8x4_c
-
-void vp8_short_walsh4x4_c(short *input, short *output, int pitch);
-#define vp8_short_walsh4x4 vp8_short_walsh4x4_c
-
-void vp8_regular_quantize_b_c(struct block *, struct blockd *);
-#define vp8_regular_quantize_b vp8_regular_quantize_b_c
-
-void vp8_fast_quantize_b_c(struct block *, struct blockd *);
-#define vp8_fast_quantize_b vp8_fast_quantize_b_c
-
-void vp8_regular_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_regular_quantize_b_pair vp8_regular_quantize_b_pair_c
-
-void vp8_fast_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_fast_quantize_b_pair vp8_fast_quantize_b_pair_c
-
-void vp8_quantize_mb_c(struct macroblock *);
-#define vp8_quantize_mb vp8_quantize_mb_c
-
-void vp8_quantize_mby_c(struct macroblock *);
-#define vp8_quantize_mby vp8_quantize_mby_c
-
-void vp8_quantize_mbuv_c(struct macroblock *);
-#define vp8_quantize_mbuv vp8_quantize_mbuv_c
-
-int vp8_block_error_c(short *coeff, short *dqcoeff);
-#define vp8_block_error vp8_block_error_c
-
-int vp8_mbblock_error_c(struct macroblock *mb, int dc);
-#define vp8_mbblock_error vp8_mbblock_error_c
-
-int vp8_mbuverror_c(struct macroblock *mb);
-#define vp8_mbuverror vp8_mbuverror_c
-
-void vp8_subtract_b_c(struct block *be, struct blockd *bd, int pitch);
-#define vp8_subtract_b vp8_subtract_b_c
-
-void vp8_subtract_mby_c(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-#define vp8_subtract_mby vp8_subtract_mby_c
-
-void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-#define vp8_subtract_mbuv vp8_subtract_mbuv_c
-
-int vp8_full_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_full_search_sad vp8_full_search_sad_c
-
-int vp8_refining_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_refining_search_sad vp8_refining_search_sad_c
-
-int vp8_diamond_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-#define vp8_diamond_search_sad vp8_diamond_search_sad_c
-
-void vp8_yv12_copy_partial_frame_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_partial_frame vp8_yv12_copy_partial_frame_c
-
-int vp8_denoiser_filter_c(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-#define vp8_denoiser_filter vp8_denoiser_filter_c
-
-void vp8_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-#if HAVE_DSPR2
-#if CONFIG_VP8
-void dsputil_static_init();
-dsputil_static_init();
-#endif
-#if CONFIG_VP9
-void vp9_dsputil_static_init();
-vp9_dsputil_static_init();
-#endif
-#endif
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/mips/vp9_rtcd.h b/videocodec/libvpx_internal/mips/vp9_rtcd.h
deleted file mode 100644
index 5ac697a..0000000
--- a/videocodec/libvpx_internal/mips/vp9_rtcd.h
+++ /dev/null
@@ -1,301 +0,0 @@
-#ifndef VP9_RTCD_H_
-#define VP9_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP9
- */
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_enums.h"
-
-struct macroblockd;
-
-/* Encoder forward decls */
-struct macroblock;
-struct vp9_variance_vtable;
-
-#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
-union int_mv;
-struct yv12_buffer_config;
-
-void vp9_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_4x4 vp9_d207_predictor_4x4_c
-
-void vp9_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_4x4 vp9_d45_predictor_4x4_c
-
-void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_4x4 vp9_d63_predictor_4x4_c
-
-void vp9_h_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_4x4 vp9_h_predictor_4x4_c
-
-void vp9_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_4x4 vp9_d117_predictor_4x4_c
-
-void vp9_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_4x4 vp9_d135_predictor_4x4_c
-
-void vp9_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_4x4 vp9_d153_predictor_4x4_c
-
-void vp9_v_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_4x4 vp9_v_predictor_4x4_c
-
-void vp9_tm_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_4x4 vp9_tm_predictor_4x4_c
-
-void vp9_dc_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_4x4 vp9_dc_predictor_4x4_c
-
-void vp9_dc_top_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_4x4 vp9_dc_top_predictor_4x4_c
-
-void vp9_dc_left_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_4x4 vp9_dc_left_predictor_4x4_c
-
-void vp9_dc_128_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_4x4 vp9_dc_128_predictor_4x4_c
-
-void vp9_d207_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_8x8 vp9_d207_predictor_8x8_c
-
-void vp9_d45_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_8x8 vp9_d45_predictor_8x8_c
-
-void vp9_d63_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_8x8 vp9_d63_predictor_8x8_c
-
-void vp9_h_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_8x8 vp9_h_predictor_8x8_c
-
-void vp9_d117_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_8x8 vp9_d117_predictor_8x8_c
-
-void vp9_d135_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_8x8 vp9_d135_predictor_8x8_c
-
-void vp9_d153_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_8x8 vp9_d153_predictor_8x8_c
-
-void vp9_v_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_8x8 vp9_v_predictor_8x8_c
-
-void vp9_tm_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_8x8 vp9_tm_predictor_8x8_c
-
-void vp9_dc_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_8x8 vp9_dc_predictor_8x8_c
-
-void vp9_dc_top_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_8x8 vp9_dc_top_predictor_8x8_c
-
-void vp9_dc_left_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_8x8 vp9_dc_left_predictor_8x8_c
-
-void vp9_dc_128_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_8x8 vp9_dc_128_predictor_8x8_c
-
-void vp9_d207_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_16x16 vp9_d207_predictor_16x16_c
-
-void vp9_d45_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_16x16 vp9_d45_predictor_16x16_c
-
-void vp9_d63_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_16x16 vp9_d63_predictor_16x16_c
-
-void vp9_h_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_16x16 vp9_h_predictor_16x16_c
-
-void vp9_d117_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_16x16 vp9_d117_predictor_16x16_c
-
-void vp9_d135_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_16x16 vp9_d135_predictor_16x16_c
-
-void vp9_d153_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_16x16 vp9_d153_predictor_16x16_c
-
-void vp9_v_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_16x16 vp9_v_predictor_16x16_c
-
-void vp9_tm_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_16x16 vp9_tm_predictor_16x16_c
-
-void vp9_dc_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_16x16 vp9_dc_predictor_16x16_c
-
-void vp9_dc_top_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_16x16 vp9_dc_top_predictor_16x16_c
-
-void vp9_dc_left_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_16x16 vp9_dc_left_predictor_16x16_c
-
-void vp9_dc_128_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_16x16 vp9_dc_128_predictor_16x16_c
-
-void vp9_d207_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d207_predictor_32x32 vp9_d207_predictor_32x32_c
-
-void vp9_d45_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d45_predictor_32x32 vp9_d45_predictor_32x32_c
-
-void vp9_d63_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d63_predictor_32x32 vp9_d63_predictor_32x32_c
-
-void vp9_h_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_h_predictor_32x32 vp9_h_predictor_32x32_c
-
-void vp9_d117_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_32x32 vp9_d117_predictor_32x32_c
-
-void vp9_d135_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_32x32 vp9_d135_predictor_32x32_c
-
-void vp9_d153_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_32x32 vp9_d153_predictor_32x32_c
-
-void vp9_v_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_v_predictor_32x32 vp9_v_predictor_32x32_c
-
-void vp9_tm_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_32x32 vp9_tm_predictor_32x32_c
-
-void vp9_dc_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_predictor_32x32 vp9_dc_predictor_32x32_c
-
-void vp9_dc_top_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_32x32 vp9_dc_top_predictor_32x32_c
-
-void vp9_dc_left_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_32x32 vp9_dc_left_predictor_32x32_c
-
-void vp9_dc_128_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_32x32 vp9_dc_128_predictor_32x32_c
-
-void vp9_mb_lpf_vertical_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-#define vp9_mb_lpf_vertical_edge_w vp9_mb_lpf_vertical_edge_w_c
-
-void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_vertical_edge vp9_mbloop_filter_vertical_edge_c
-
-void vp9_loop_filter_vertical_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_vertical_edge vp9_loop_filter_vertical_edge_c
-
-void vp9_mb_lpf_horizontal_edge_w_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mb_lpf_horizontal_edge_w vp9_mb_lpf_horizontal_edge_w_c
-
-void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_mbloop_filter_horizontal_edge vp9_mbloop_filter_horizontal_edge_c
-
-void vp9_loop_filter_horizontal_edge_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-#define vp9_loop_filter_horizontal_edge vp9_loop_filter_horizontal_edge_c
-
-void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_inner vp9_blend_mb_inner_c
-
-void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_outer vp9_blend_mb_outer_c
-
-void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_b vp9_blend_b_c
-
-void vp9_convolve_copy_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);
-#define vp9_convolve_copy vp9_convolve_copy_c
-
-void vp9_convolve_avg_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);
-#define vp9_convolve_avg vp9_convolve_avg_c
-
-void vp9_convolve8_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);
-#define vp9_convolve8 vp9_convolve8_c
-
-void vp9_convolve8_horiz_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);
-#define vp9_convolve8_horiz vp9_convolve8_horiz_c
-
-void vp9_convolve8_vert_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);
-#define vp9_convolve8_vert vp9_convolve8_vert_c
-
-void vp9_convolve8_avg_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);
-#define vp9_convolve8_avg vp9_convolve8_avg_c
-
-void vp9_convolve8_avg_horiz_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);
-#define vp9_convolve8_avg_horiz vp9_convolve8_avg_horiz_c
-
-void vp9_convolve8_avg_vert_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);
-#define vp9_convolve8_avg_vert vp9_convolve8_avg_vert_c
-
-void vp9_idct4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_1_add vp9_idct4x4_1_add_c
-
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct4x4_16_add vp9_idct4x4_16_add_c
-
-void vp9_idct8x8_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_1_add vp9_idct8x8_1_add_c
-
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_64_add vp9_idct8x8_64_add_c
-
-void vp9_idct8x8_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct8x8_10_add vp9_idct8x8_10_add_c
-
-void vp9_idct16x16_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_1_add vp9_idct16x16_1_add_c
-
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_256_add vp9_idct16x16_256_add_c
-
-void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct16x16_10_add vp9_idct16x16_10_add_c
-
-void vp9_idct32x32_1024_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1024_add vp9_idct32x32_1024_add_c
-
-void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_34_add vp9_idct32x32_34_add_c
-
-void vp9_idct32x32_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_idct32x32_1_add vp9_idct32x32_1_add_c
-
-void vp9_iht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht4x4_16_add vp9_iht4x4_16_add_c
-
-void vp9_iht8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-#define vp9_iht8x8_64_add vp9_iht8x8_64_add_c
-
-void vp9_iht16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-#define vp9_iht16x16_256_add vp9_iht16x16_256_add_c
-
-void vp9_iwht4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_1_add vp9_iwht4x4_1_add_c
-
-void vp9_iwht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_16_add vp9_iwht4x4_16_add_c
-
-void vp9_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-#if HAVE_DSPR2
-#if CONFIG_VP8
-void dsputil_static_init();
-dsputil_static_init();
-#endif
-#if CONFIG_VP9
-void vp9_dsputil_static_init();
-vp9_dsputil_static_init();
-#endif
-#endif
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/mips/vpx_config.c b/videocodec/libvpx_internal/mips/vpx_config.c
deleted file mode 100644
index 8c995fb..0000000
--- a/videocodec/libvpx_internal/mips/vpx_config.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-static const char* const cfg = "--force-target=mips32-android-gcc --disable-runtime-cpu-detect --sdk-path=/usr/local/google/home/hkuang/Downloads/android-ndk-r8e --disable-vp9-encoder --disable-examples --disable-docs --enable-realtime-only";
-const char *vpx_codec_build_config(void) {return cfg;}
diff --git a/videocodec/libvpx_internal/mips/vpx_config.h b/videocodec/libvpx_internal/mips/vpx_config.h
deleted file mode 100644
index d0a3d11..0000000
--- a/videocodec/libvpx_internal/mips/vpx_config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-/* This file automatically generated by configure. Do not edit! */
-#ifndef VPX_CONFIG_H
-#define VPX_CONFIG_H
-#define RESTRICT
-#define INLINE __inline__ __attribute__((always_inline))
-#define ARCH_ARM 0
-#define ARCH_MIPS 1
-#define ARCH_X86_32 0
-#define ARCH_X86_64 0
-#define ARCH_PPC32 0
-#define ARCH_PPC64 0
-#define HAVE_EDSP 0
-#define HAVE_MEDIA 0
-#define HAVE_NEON 0
-#define HAVE_MIPS32 1
-#define HAVE_DSPR2 0
-#define HAVE_MMX 0
-#define HAVE_SSE 0
-#define HAVE_SSE2 0
-#define HAVE_SSE3 0
-#define HAVE_SSSE3 0
-#define HAVE_SSE4_1 0
-#define HAVE_AVX 0
-#define HAVE_AVX2 0
-#define HAVE_ALTIVEC 0
-#define HAVE_VPX_PORTS 1
-#define HAVE_STDINT_H 1
-#define HAVE_ALT_TREE_LAYOUT 0
-#define HAVE_PTHREAD_H 1
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_UNISTD_H 1
-#define CONFIG_EXTERNAL_BUILD 0
-#define CONFIG_INSTALL_DOCS 0
-#define CONFIG_INSTALL_BINS 1
-#define CONFIG_INSTALL_LIBS 1
-#define CONFIG_INSTALL_SRCS 0
-#define CONFIG_USE_X86INC 1
-#define CONFIG_DEBUG 0
-#define CONFIG_GPROF 0
-#define CONFIG_GCOV 0
-#define CONFIG_RVCT 0
-#define CONFIG_GCC 1
-#define CONFIG_MSVS 0
-#define CONFIG_PIC 0
-#define CONFIG_BIG_ENDIAN 0
-#define CONFIG_CODEC_SRCS 0
-#define CONFIG_DEBUG_LIBS 0
-#define CONFIG_FAST_UNALIGNED 1
-#define CONFIG_MEM_MANAGER 0
-#define CONFIG_MEM_TRACKER 0
-#define CONFIG_MEM_CHECKS 0
-#define CONFIG_MD5 1
-#define CONFIG_DEQUANT_TOKENS 1
-#define CONFIG_DC_RECON 1
-#define CONFIG_RUNTIME_CPU_DETECT 0
-#define CONFIG_POSTPROC 0
-#define CONFIG_VP9_POSTPROC 0
-#define CONFIG_MULTITHREAD 1
-#define CONFIG_INTERNAL_STATS 0
-#define CONFIG_VP8_ENCODER 1
-#define CONFIG_VP8_DECODER 1
-#define CONFIG_VP9_ENCODER 0
-#define CONFIG_VP9_DECODER 1
-#define CONFIG_VP8 1
-#define CONFIG_VP9 1
-#define CONFIG_ENCODERS 1
-#define CONFIG_DECODERS 1
-#define CONFIG_STATIC_MSVCRT 0
-#define CONFIG_SPATIAL_RESAMPLING 1
-#define CONFIG_REALTIME_ONLY 1
-#define CONFIG_ONTHEFLY_BITPACKING 0
-#define CONFIG_ERROR_CONCEALMENT 0
-#define CONFIG_SHARED 0
-#define CONFIG_STATIC 1
-#define CONFIG_SMALL 0
-#define CONFIG_POSTPROC_VISUALIZER 0
-#define CONFIG_OS_SUPPORT 1
-#define CONFIG_UNIT_TESTS 0
-#define CONFIG_MULTI_RES_ENCODING 0
-#define CONFIG_TEMPORAL_DENOISING 1
-#define CONFIG_EXPERIMENTAL 0
-#define CONFIG_DECRYPT 0
-#define CONFIG_MULTIPLE_ARF 0
-#define CONFIG_NON420 0
-#define CONFIG_ALPHA 0
-#endif /* VPX_CONFIG_H */
diff --git a/videocodec/libvpx_internal/mips/vpx_scale_rtcd.h b/videocodec/libvpx_internal/mips/vpx_scale_rtcd.h
deleted file mode 100644
index 53c3be0..0000000
--- a/videocodec/libvpx_internal/mips/vpx_scale_rtcd.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef VPX_SCALE_RTCD_H_
-#define VPX_SCALE_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-struct yv12_buffer_config;
-
-void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
-
-void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
-
-void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
-
-void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
-
-void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
-
-void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
-#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_c
-
-void vp8_yv12_copy_frame_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_frame vp8_yv12_copy_frame_c
-
-void vpx_yv12_copy_y_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vpx_yv12_copy_y vpx_yv12_copy_y_c
-
-void vp9_extend_frame_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_borders vp9_extend_frame_borders_c
-
-void vp9_extend_frame_inner_borders_c(struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y);
-#define vp9_extend_frame_inner_borders vp9_extend_frame_inner_borders_c
-
-void vpx_scale_rtcd(void);
-#include "vpx_config.h"
-
-#ifdef RTCD_C
-static void setup_rtcd_internal(void)
-{
-
-#if HAVE_DSPR2
-#if CONFIG_VP8
-void dsputil_static_init();
-dsputil_static_init();
-#endif
-#if CONFIG_VP9
-void vp9_dsputil_static_init();
-vp9_dsputil_static_init();
-#endif
-#endif
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/mips/vpx_version.h b/videocodec/libvpx_internal/mips/vpx_version.h
deleted file mode 100644
index 9a354bb..0000000
--- a/videocodec/libvpx_internal/mips/vpx_version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 2
-#define VERSION_PATCH 0
-#define VERSION_EXTRA "5082-g58f7543"
-#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define VERSION_STRING_NOSP "v1.2.0-5082-g58f7543"
-#define VERSION_STRING " v1.2.0-5082-g58f7543"
diff --git a/videocodec/libvpx_internal/x86/cpu-features.h b/videocodec/libvpx_internal/x86/cpu-features.h
deleted file mode 100644
index f20c0bc..0000000
--- a/videocodec/libvpx_internal/x86/cpu-features.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// You can download Android source at
-// http://source.android.com/source/downloading.html
-// Original files are in ndk/sources/android/cpufeatures
-// Revision is Change-Id: I9a0629efba36a6023f05e5f092e7addcc1b7d2a9
-
-#ifndef CPU_FEATURES_H
-#define CPU_FEATURES_H
-
-#include <sys/cdefs.h>
-#include <stdint.h>
-
-__BEGIN_DECLS
-
-typedef enum {
- ANDROID_CPU_FAMILY_UNKNOWN = 0,
- ANDROID_CPU_FAMILY_ARM,
- ANDROID_CPU_FAMILY_X86,
-
- ANDROID_CPU_FAMILY_MAX /* do not remove */
-
-} AndroidCpuFamily;
-
-/* Return family of the device's CPU */
-extern AndroidCpuFamily android_getCpuFamily(void);
-
-enum {
- ANDROID_CPU_ARM_FEATURE_ARMv7 = (1 << 0),
- ANDROID_CPU_ARM_FEATURE_VFPv3 = (1 << 1),
- ANDROID_CPU_ARM_FEATURE_NEON = (1 << 2),
- ANDROID_CPU_ARM_FEATURE_LDREX_STREX = (1 << 3),
-};
-
-enum {
- ANDROID_CPU_X86_FEATURE_SSSE3 = (1 << 0),
- ANDROID_CPU_X86_FEATURE_POPCNT = (1 << 1),
- ANDROID_CPU_X86_FEATURE_MOVBE = (1 << 2),
-};
-
-extern uint64_t android_getCpuFeatures(void);
-
-/* Return the number of CPU cores detected on this device. */
-extern int android_getCpuCount(void);
-
-__END_DECLS
-
-#endif /* CPU_FEATURES_H */
diff --git a/videocodec/libvpx_internal/x86/libvpx_srcs.txt b/videocodec/libvpx_internal/x86/libvpx_srcs.txt
deleted file mode 100644
index f205c82..0000000
--- a/videocodec/libvpx_internal/x86/libvpx_srcs.txt
+++ /dev/null
@@ -1,310 +0,0 @@
-build/make/rtcd.pl
-build/make/version.sh
-CHANGELOG
-libs.mk
-third_party/x86inc/x86inc.asm
-vp8/common/alloccommon.c
-vp8/common/alloccommon.h
-vp8/common/blockd.c
-vp8/common/blockd.h
-vp8/common/coefupdateprobs.h
-vp8/common/common.h
-vp8/common/debugmodes.c
-vp8/common/default_coef_probs.h
-vp8/common/dequantize.c
-vp8/common/entropy.c
-vp8/common/entropy.h
-vp8/common/entropymode.c
-vp8/common/entropymode.h
-vp8/common/entropymv.c
-vp8/common/entropymv.h
-vp8/common/extend.c
-vp8/common/extend.h
-vp8/common/filter.c
-vp8/common/filter.h
-vp8/common/findnearmv.c
-vp8/common/findnearmv.h
-vp8/common/generic/systemdependent.c
-vp8/common/header.h
-vp8/common/idct_blk.c
-vp8/common/idctllm.c
-vp8/common/invtrans.h
-vp8/common/loopfilter.c
-vp8/common/loopfilter_filters.c
-vp8/common/loopfilter.h
-vp8/common/mbpitch.c
-vp8/common/mfqe.c
-vp8/common/modecont.c
-vp8/common/modecont.h
-vp8/common/mv.h
-vp8/common/onyxc_int.h
-vp8/common/onyxd.h
-vp8/common/onyx.h
-vp8/common/postproc.c
-vp8/common/postproc.h
-vp8/common/ppflags.h
-vp8/common/pragmas.h
-vp8/common/quant_common.c
-vp8/common/quant_common.h
-vp8/common/reconinter.c
-vp8/common/reconinter.h
-vp8/common/reconintra4x4.c
-vp8/common/reconintra4x4.h
-vp8/common/reconintra.c
-vp8/common/rtcd.c
-vp8/common/rtcd_defs.pl
-vp8/common/sad_c.c
-vp8/common/setupintrarecon.c
-vp8/common/setupintrarecon.h
-vp8/common/swapyv12buffer.c
-vp8/common/swapyv12buffer.h
-vp8/common/systemdependent.h
-vp8/common/threading.h
-vp8/common/treecoder.c
-vp8/common/treecoder.h
-vp8/common/variance_c.c
-vp8/common/variance.h
-vp8/common/vp8_entropymodedata.h
-vp8/common/x86/dequantize_mmx.asm
-vp8/common/x86/filter_x86.c
-vp8/common/x86/filter_x86.h
-vp8/common/x86/idct_blk_mmx.c
-vp8/common/x86/idct_blk_sse2.c
-vp8/common/x86/idctllm_mmx.asm
-vp8/common/x86/idctllm_sse2.asm
-vp8/common/x86/iwalsh_mmx.asm
-vp8/common/x86/iwalsh_sse2.asm
-vp8/common/x86/loopfilter_mmx.asm
-vp8/common/x86/loopfilter_sse2.asm
-vp8/common/x86/loopfilter_x86.c
-vp8/common/x86/mfqe_sse2.asm
-vp8/common/x86/postproc_mmx.asm
-vp8/common/x86/postproc_sse2.asm
-vp8/common/x86/postproc_x86.c
-vp8/common/x86/recon_mmx.asm
-vp8/common/x86/recon_sse2.asm
-vp8/common/x86/recon_wrapper_sse2.c
-vp8/common/x86/sad_mmx.asm
-vp8/common/x86/sad_sse2.asm
-vp8/common/x86/sad_sse3.asm
-vp8/common/x86/sad_sse4.asm
-vp8/common/x86/sad_ssse3.asm
-vp8/common/x86/subpixel_mmx.asm
-vp8/common/x86/subpixel_sse2.asm
-vp8/common/x86/subpixel_ssse3.asm
-vp8/common/x86/variance_impl_mmx.asm
-vp8/common/x86/variance_impl_sse2.asm
-vp8/common/x86/variance_impl_ssse3.asm
-vp8/common/x86/variance_mmx.c
-vp8/common/x86/variance_sse2.c
-vp8/common/x86/variance_ssse3.c
-vp8/common/x86/vp8_asm_stubs.c
-vp8/decoder/dboolhuff.c
-vp8/decoder/dboolhuff.h
-vp8/decoder/decodeframe.c
-vp8/decoder/decodemv.c
-vp8/decoder/decodemv.h
-vp8/decoder/decoderthreading.h
-vp8/decoder/detokenize.c
-vp8/decoder/detokenize.h
-vp8/decoder/onyxd_if.c
-vp8/decoder/onyxd_int.h
-vp8/decoder/threading.c
-vp8/decoder/treereader.h
-vp8/encoder/bitstream.c
-vp8/encoder/bitstream.h
-vp8/encoder/block.h
-vp8/encoder/boolhuff.c
-vp8/encoder/boolhuff.h
-vp8/encoder/dct.c
-vp8/encoder/dct_value_cost.h
-vp8/encoder/dct_value_tokens.h
-vp8/encoder/defaultcoefcounts.h
-vp8/encoder/denoising.c
-vp8/encoder/denoising.h
-vp8/encoder/encodeframe.c
-vp8/encoder/encodeframe.h
-vp8/encoder/encodeintra.c
-vp8/encoder/encodeintra.h
-vp8/encoder/encodemb.c
-vp8/encoder/encodemb.h
-vp8/encoder/encodemv.c
-vp8/encoder/encodemv.h
-vp8/encoder/ethreading.c
-vp8/encoder/firstpass.c
-vp8/encoder/firstpass.h
-vp8/encoder/lookahead.c
-vp8/encoder/lookahead.h
-vp8/encoder/mcomp.c
-vp8/encoder/mcomp.h
-vp8/encoder/modecosts.c
-vp8/encoder/modecosts.h
-vp8/encoder/onyx_if.c
-vp8/encoder/onyx_int.h
-vp8/encoder/pickinter.c
-vp8/encoder/pickinter.h
-vp8/encoder/picklpf.c
-vp8/encoder/quantize.c
-vp8/encoder/quantize.h
-vp8/encoder/ratectrl.c
-vp8/encoder/ratectrl.h
-vp8/encoder/rdopt.c
-vp8/encoder/rdopt.h
-vp8/encoder/segmentation.c
-vp8/encoder/segmentation.h
-vp8/encoder/temporal_filter.c
-vp8/encoder/tokenize.c
-vp8/encoder/tokenize.h
-vp8/encoder/treewriter.c
-vp8/encoder/treewriter.h
-vp8/encoder/vp8_asm_enc_offsets.c
-vp8/encoder/x86/dct_mmx.asm
-vp8/encoder/x86/dct_sse2.asm
-vp8/encoder/x86/denoising_sse2.c
-vp8/encoder/x86/encodeopt.asm
-vp8/encoder/x86/fwalsh_sse2.asm
-vp8/encoder/x86/quantize_mmx.asm
-vp8/encoder/x86/quantize_sse2.c
-vp8/encoder/x86/quantize_sse4.asm
-vp8/encoder/x86/quantize_ssse3.asm
-vp8/encoder/x86/subtract_mmx.asm
-vp8/encoder/x86/subtract_sse2.asm
-vp8/encoder/x86/temporal_filter_apply_sse2.asm
-vp8/encoder/x86/vp8_enc_stubs_mmx.c
-vp8/encoder/x86/vp8_enc_stubs_sse2.c
-vp8/vp8_common.mk
-vp8/vp8_cx_iface.c
-vp8/vp8cx.mk
-vp8/vp8_dx_iface.c
-vp8/vp8dx.mk
-vp9/common/vp9_alloccommon.c
-vp9/common/vp9_alloccommon.h
-vp9/common/vp9_blockd.c
-vp9/common/vp9_blockd.h
-vp9/common/vp9_common_data.c
-vp9/common/vp9_common_data.h
-vp9/common/vp9_common.h
-vp9/common/vp9_convolve.c
-vp9/common/vp9_convolve.h
-vp9/common/vp9_debugmodes.c
-vp9/common/vp9_entropy.c
-vp9/common/vp9_entropy.h
-vp9/common/vp9_entropymode.c
-vp9/common/vp9_entropymode.h
-vp9/common/vp9_entropymv.c
-vp9/common/vp9_entropymv.h
-vp9/common/vp9_enums.h
-vp9/common/vp9_filter.c
-vp9/common/vp9_filter.h
-vp9/common/vp9_frame_buffers.c
-vp9/common/vp9_frame_buffers.h
-vp9/common/vp9_idct.c
-vp9/common/vp9_idct.h
-vp9/common/vp9_loopfilter.c
-vp9/common/vp9_loopfilter_filters.c
-vp9/common/vp9_loopfilter.h
-vp9/common/vp9_mv.h
-vp9/common/vp9_mvref_common.c
-vp9/common/vp9_mvref_common.h
-vp9/common/vp9_onyxc_int.h
-vp9/common/vp9_ppflags.h
-vp9/common/vp9_pragmas.h
-vp9/common/vp9_pred_common.c
-vp9/common/vp9_pred_common.h
-vp9/common/vp9_prob.c
-vp9/common/vp9_prob.h
-vp9/common/vp9_quant_common.c
-vp9/common/vp9_quant_common.h
-vp9/common/vp9_reconinter.c
-vp9/common/vp9_reconinter.h
-vp9/common/vp9_reconintra.c
-vp9/common/vp9_reconintra.h
-vp9/common/vp9_rtcd.c
-vp9/common/vp9_rtcd_defs.pl
-vp9/common/vp9_scale.c
-vp9/common/vp9_scale.h
-vp9/common/vp9_scan.c
-vp9/common/vp9_scan.h
-vp9/common/vp9_seg_common.c
-vp9/common/vp9_seg_common.h
-vp9/common/vp9_systemdependent.h
-vp9/common/vp9_textblit.h
-vp9/common/vp9_tile_common.c
-vp9/common/vp9_tile_common.h
-vp9/common/x86/vp9_asm_stubs.c
-vp9/common/x86/vp9_copy_sse2.asm
-vp9/common/x86/vp9_idct_intrin_sse2.c
-vp9/common/x86/vp9_intrapred_sse2.asm
-vp9/common/x86/vp9_intrapred_ssse3.asm
-vp9/common/x86/vp9_loopfilter_intrin_sse2.c
-vp9/common/x86/vp9_loopfilter_mmx.asm
-vp9/common/x86/vp9_postproc_x86.h
-vp9/common/x86/vp9_subpixel_8t_sse2.asm
-vp9/common/x86/vp9_subpixel_8t_ssse3.asm
-vp9/common/x86/vp9_subpixel_bilinear_sse2.asm
-vp9/common/x86/vp9_subpixel_bilinear_ssse3.asm
-vp9/decoder/vp9_decodeframe.c
-vp9/decoder/vp9_decodeframe.h
-vp9/decoder/vp9_decodemv.c
-vp9/decoder/vp9_decodemv.h
-vp9/decoder/vp9_decoder.c
-vp9/decoder/vp9_decoder.h
-vp9/decoder/vp9_detokenize.c
-vp9/decoder/vp9_detokenize.h
-vp9/decoder/vp9_dsubexp.c
-vp9/decoder/vp9_dsubexp.h
-vp9/decoder/vp9_dthread.c
-vp9/decoder/vp9_dthread.h
-vp9/decoder/vp9_read_bit_buffer.c
-vp9/decoder/vp9_read_bit_buffer.h
-vp9/decoder/vp9_reader.c
-vp9/decoder/vp9_reader.h
-vp9/decoder/vp9_thread.c
-vp9/decoder/vp9_thread.h
-vp9/vp9_common.mk
-vp9/vp9_dx_iface.c
-vp9/vp9dx.mk
-vp9/vp9_iface_common.h
-vpx_config.c
-vpx/internal/vpx_codec_internal.h
-vpx/internal/vpx_psnr.h
-vpx_mem/include/vpx_mem_intrnl.h
-vpx_mem/vpx_mem.c
-vpx_mem/vpx_mem.h
-vpx_mem/vpx_mem.mk
-vpx_ports/asm_offsets.h
-vpx_ports/emmintrin_compat.h
-vpx_ports/emms.asm
-vpx_ports/mem.h
-vpx_ports/mem_ops_aligned.h
-vpx_ports/mem_ops.h
-vpx_ports/vpx_once.h
-vpx_ports/vpx_ports.mk
-vpx_ports/vpx_timer.h
-vpx_ports/x86_abi_support.asm
-vpx_ports/x86.h
-vpx_scale/generic/gen_scalers.c
-vpx_scale/generic/vpx_scale.c
-vpx_scale/generic/yv12config.c
-vpx_scale/generic/yv12extend.c
-vpx_scale/vpx_scale_asm_offsets.c
-vpx_scale/vpx_scale.h
-vpx_scale/vpx_scale.mk
-vpx_scale/vpx_scale_rtcd.c
-vpx_scale/vpx_scale_rtcd.pl
-vpx_scale/yv12config.h
-vpx/src/vpx_codec.c
-vpx/src/vpx_decoder.c
-vpx/src/vpx_encoder.c
-vpx/src/vpx_image.c
-vpx/src/vpx_psnr.c
-vpx/vp8cx.h
-vpx/vp8dx.h
-vpx/vp8.h
-vpx/vpx_codec.h
-vpx/vpx_codec.mk
-vpx/vpx_decoder.h
-vpx/vpx_encoder.h
-vpx/vpx_frame_buffer.h
-vpx/vpx_image.h
-vpx/vpx_integer.h
diff --git a/videocodec/libvpx_internal/x86/trace_conf.h b/videocodec/libvpx_internal/x86/trace_conf.h
deleted file mode 100644
index f204647..0000000
--- a/videocodec/libvpx_internal/x86/trace_conf.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef TRACE_CONF_H
-#define TRACE_CONF_H
-
-#define LOG_TAG "libvpx"
-#define LOGD(fmt_str, ...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "[%s:%d] "fmt_str, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-
-#include <android/log.h>
-
-#endif
diff --git a/videocodec/libvpx_internal/x86/vp8_asm_enc_offsets.asm b/videocodec/libvpx_internal/x86/vp8_asm_enc_offsets.asm
deleted file mode 100644
index d2b667f..0000000
--- a/videocodec/libvpx_internal/x86/vp8_asm_enc_offsets.asm
+++ /dev/null
@@ -1,44 +0,0 @@
-vp8_block_coeff EQU 4
-vp8_block_zbin EQU 20
-vp8_block_round EQU 28
-vp8_block_quant EQU 8
-vp8_block_quant_fast EQU 12
-vp8_block_zbin_extra EQU 32
-vp8_block_zrun_zbin_boost EQU 24
-vp8_block_quant_shift EQU 16
-vp8_blockd_qcoeff EQU 0
-vp8_blockd_dequant EQU 12
-vp8_blockd_dqcoeff EQU 4
-vp8_blockd_eob EQU 20
-vp8_block_base_src EQU 36
-vp8_block_src EQU 40
-vp8_block_src_diff EQU 0
-vp8_block_src_stride EQU 44
-vp8_blockd_predictor EQU 8
-vp8_writer_lowvalue EQU 0
-vp8_writer_range EQU 4
-vp8_writer_count EQU 8
-vp8_writer_pos EQU 12
-vp8_writer_buffer EQU 16
-vp8_writer_buffer_end EQU 20
-vp8_writer_error EQU 24
-tokenextra_token EQU 6
-tokenextra_extra EQU 4
-tokenextra_context_tree EQU 0
-tokenextra_skip_eob_node EQU 7
-TOKENEXTRA_SZ EQU 8
-vp8_extra_bit_struct_sz EQU 16
-vp8_token_value EQU 0
-vp8_token_len EQU 4
-vp8_extra_bit_struct_tree EQU 0
-vp8_extra_bit_struct_prob EQU 4
-vp8_extra_bit_struct_len EQU 8
-vp8_extra_bit_struct_base_val EQU 12
-vp8_comp_tplist EQU 146892
-vp8_comp_common EQU 106432
-vp8_comp_bc EQU 117872
-vp8_writer_sz EQU 36
-tokenlist_start EQU 0
-tokenlist_stop EQU 4
-TOKENLIST_SZ EQU 8
-vp8_common_mb_rows EQU 2548
diff --git a/videocodec/libvpx_internal/x86/vp8_rtcd.h b/videocodec/libvpx_internal/x86/vp8_rtcd.h
deleted file mode 100644
index b957362..0000000
--- a/videocodec/libvpx_internal/x86/vp8_rtcd.h
+++ /dev/null
@@ -1,843 +0,0 @@
-#ifndef VP8_RTCD_H_
-#define VP8_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * VP8
- */
-
-struct blockd;
-struct macroblockd;
-struct loop_filter_info;
-
-/* Encoder forward decls */
-struct block;
-struct macroblock;
-struct variance_vtable;
-union int_mv;
-struct yv12_buffer_config;
-
-void vp8_bilinear_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict16x16_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict16x16_sse2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict16x16_ssse3(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_bilinear_predict16x16)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-void vp8_bilinear_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict4x4_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_bilinear_predict4x4)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-void vp8_bilinear_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x4_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_bilinear_predict8x4)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-void vp8_bilinear_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x8_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x8_sse2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_bilinear_predict8x8_ssse3(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_bilinear_predict8x8)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-void vp8_blend_b_c(unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp8_blend_b vp8_blend_b_c
-
-void vp8_blend_mb_inner_c(unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp8_blend_mb_inner vp8_blend_mb_inner_c
-
-void vp8_blend_mb_outer_c(unsigned char *y, unsigned char *u, unsigned char *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp8_blend_mb_outer vp8_blend_mb_outer_c
-
-int vp8_block_error_c(short *coeff, short *dqcoeff);
-int vp8_block_error_mmx(short *coeff, short *dqcoeff);
-int vp8_block_error_xmm(short *coeff, short *dqcoeff);
-RTCD_EXTERN int (*vp8_block_error)(short *coeff, short *dqcoeff);
-
-void vp8_build_intra_predictors_mbuv_s_c(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-void vp8_build_intra_predictors_mbuv_s_sse2(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-void vp8_build_intra_predictors_mbuv_s_ssse3(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-RTCD_EXTERN void (*vp8_build_intra_predictors_mbuv_s)(struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride);
-
-void vp8_build_intra_predictors_mby_s_c(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-void vp8_build_intra_predictors_mby_s_sse2(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-void vp8_build_intra_predictors_mby_s_ssse3(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-RTCD_EXTERN void (*vp8_build_intra_predictors_mby_s)(struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride);
-
-void vp8_clear_system_state_c();
-void vpx_reset_mmx_state();
-RTCD_EXTERN void (*vp8_clear_system_state)();
-
-void vp8_copy32xn_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, int n);
-void vp8_copy32xn_sse2(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, int n);
-void vp8_copy32xn_sse3(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, int n);
-RTCD_EXTERN void (*vp8_copy32xn)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, int n);
-
-void vp8_copy_mem16x16_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem16x16_mmx(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem16x16_sse2(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_copy_mem16x16)(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-
-void vp8_copy_mem8x4_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x4_mmx(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_copy_mem8x4)(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-
-void vp8_copy_mem8x8_c(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-void vp8_copy_mem8x8_mmx(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_copy_mem8x8)(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch);
-
-void vp8_dc_only_idct_add_c(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-void vp8_dc_only_idct_add_mmx(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-RTCD_EXTERN void (*vp8_dc_only_idct_add)(short input, unsigned char *pred, int pred_stride, unsigned char *dst, int dst_stride);
-
-int vp8_denoiser_filter_c(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-int vp8_denoiser_filter_sse2(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-RTCD_EXTERN int (*vp8_denoiser_filter)(struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset);
-
-void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *output, int stride);
-void vp8_dequant_idct_add_mmx(short *input, short *dq, unsigned char *output, int stride);
-RTCD_EXTERN void (*vp8_dequant_idct_add)(short *input, short *dq, unsigned char *output, int stride);
-
-void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-void vp8_dequant_idct_add_uv_block_mmx(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-void vp8_dequant_idct_add_uv_block_sse2(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-RTCD_EXTERN void (*vp8_dequant_idct_add_uv_block)(short *q, short *dq, unsigned char *dst_u, unsigned char *dst_v, int stride, char *eobs);
-
-void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-void vp8_dequant_idct_add_y_block_mmx(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-void vp8_dequant_idct_add_y_block_sse2(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-RTCD_EXTERN void (*vp8_dequant_idct_add_y_block)(short *q, short *dq, unsigned char *dst, int stride, char *eobs);
-
-void vp8_dequantize_b_c(struct blockd*, short *dqc);
-void vp8_dequantize_b_mmx(struct blockd*, short *dqc);
-RTCD_EXTERN void (*vp8_dequantize_b)(struct blockd*, short *dqc);
-
-int vp8_diamond_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-int vp8_diamond_search_sadx4(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-RTCD_EXTERN int (*vp8_diamond_search_sad)(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-
-void vp8_fast_quantize_b_c(struct block *, struct blockd *);
-void vp8_fast_quantize_b_sse2(struct block *, struct blockd *);
-void vp8_fast_quantize_b_ssse3(struct block *, struct blockd *);
-RTCD_EXTERN void (*vp8_fast_quantize_b)(struct block *, struct blockd *);
-
-void vp8_fast_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_fast_quantize_b_pair vp8_fast_quantize_b_pair_c
-
-void vp8_filter_by_weight16x16_c(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight);
-void vp8_filter_by_weight16x16_sse2(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight);
-RTCD_EXTERN void (*vp8_filter_by_weight16x16)(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight);
-
-void vp8_filter_by_weight4x4_c(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight);
-#define vp8_filter_by_weight4x4 vp8_filter_by_weight4x4_c
-
-void vp8_filter_by_weight8x8_c(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight);
-void vp8_filter_by_weight8x8_sse2(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight);
-RTCD_EXTERN void (*vp8_filter_by_weight8x8)(unsigned char *src, int src_stride, unsigned char *dst, int dst_stride, int src_weight);
-
-int vp8_full_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-int vp8_full_search_sadx3(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-int vp8_full_search_sadx8(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-RTCD_EXTERN int (*vp8_full_search_sad)(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-
-unsigned int vp8_get4x4sse_cs_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-unsigned int vp8_get4x4sse_cs_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-RTCD_EXTERN unsigned int (*vp8_get4x4sse_cs)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride);
-
-unsigned int vp8_get_mb_ss_c(const short *);
-unsigned int vp8_get_mb_ss_mmx(const short *);
-unsigned int vp8_get_mb_ss_sse2(const short *);
-RTCD_EXTERN unsigned int (*vp8_get_mb_ss)(const short *);
-
-void vp8_intra4x4_predict_c(unsigned char *Above, unsigned char *yleft, int left_stride, int b_mode, unsigned char *dst, int dst_stride, unsigned char top_left);
-#define vp8_intra4x4_predict vp8_intra4x4_predict_c
-
-void vp8_loop_filter_bh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bh_mmx(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bh_sse2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-RTCD_EXTERN void (*vp8_loop_filter_bh)(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-
-void vp8_loop_filter_bv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bv_mmx(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_bv_sse2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-RTCD_EXTERN void (*vp8_loop_filter_bv)(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-
-void vp8_loop_filter_mbh_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbh_mmx(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbh_sse2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-RTCD_EXTERN void (*vp8_loop_filter_mbh)(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-
-void vp8_loop_filter_mbv_c(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbv_mmx(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-void vp8_loop_filter_mbv_sse2(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-RTCD_EXTERN void (*vp8_loop_filter_mbv)(unsigned char *y, unsigned char *u, unsigned char *v, int ystride, int uv_stride, struct loop_filter_info *lfi);
-
-void vp8_loop_filter_bhs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bhs_mmx(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bhs_sse2(unsigned char *y, int ystride, const unsigned char *blimit);
-RTCD_EXTERN void (*vp8_loop_filter_simple_bh)(unsigned char *y, int ystride, const unsigned char *blimit);
-
-void vp8_loop_filter_bvs_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bvs_mmx(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_bvs_sse2(unsigned char *y, int ystride, const unsigned char *blimit);
-RTCD_EXTERN void (*vp8_loop_filter_simple_bv)(unsigned char *y, int ystride, const unsigned char *blimit);
-
-void vp8_loop_filter_simple_horizontal_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_horizontal_edge_mmx(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_horizontal_edge_sse2(unsigned char *y, int ystride, const unsigned char *blimit);
-RTCD_EXTERN void (*vp8_loop_filter_simple_mbh)(unsigned char *y, int ystride, const unsigned char *blimit);
-
-void vp8_loop_filter_simple_vertical_edge_c(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_vertical_edge_mmx(unsigned char *y, int ystride, const unsigned char *blimit);
-void vp8_loop_filter_simple_vertical_edge_sse2(unsigned char *y, int ystride, const unsigned char *blimit);
-RTCD_EXTERN void (*vp8_loop_filter_simple_mbv)(unsigned char *y, int ystride, const unsigned char *blimit);
-
-int vp8_mbblock_error_c(struct macroblock *mb, int dc);
-int vp8_mbblock_error_mmx(struct macroblock *mb, int dc);
-int vp8_mbblock_error_xmm(struct macroblock *mb, int dc);
-RTCD_EXTERN int (*vp8_mbblock_error)(struct macroblock *mb, int dc);
-
-void vp8_mbpost_proc_across_ip_c(unsigned char *dst, int pitch, int rows, int cols,int flimit);
-void vp8_mbpost_proc_across_ip_xmm(unsigned char *dst, int pitch, int rows, int cols,int flimit);
-RTCD_EXTERN void (*vp8_mbpost_proc_across_ip)(unsigned char *dst, int pitch, int rows, int cols,int flimit);
-
-void vp8_mbpost_proc_down_c(unsigned char *dst, int pitch, int rows, int cols,int flimit);
-void vp8_mbpost_proc_down_mmx(unsigned char *dst, int pitch, int rows, int cols,int flimit);
-void vp8_mbpost_proc_down_xmm(unsigned char *dst, int pitch, int rows, int cols,int flimit);
-RTCD_EXTERN void (*vp8_mbpost_proc_down)(unsigned char *dst, int pitch, int rows, int cols,int flimit);
-
-int vp8_mbuverror_c(struct macroblock *mb);
-int vp8_mbuverror_mmx(struct macroblock *mb);
-int vp8_mbuverror_xmm(struct macroblock *mb);
-RTCD_EXTERN int (*vp8_mbuverror)(struct macroblock *mb);
-
-unsigned int vp8_mse16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_mse16x16_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_mse16x16_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_mse16x16)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-void vp8_plane_add_noise_c(unsigned char *s, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int w, unsigned int h, int pitch);
-void vp8_plane_add_noise_mmx(unsigned char *s, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int w, unsigned int h, int pitch);
-void vp8_plane_add_noise_wmt(unsigned char *s, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int w, unsigned int h, int pitch);
-RTCD_EXTERN void (*vp8_plane_add_noise)(unsigned char *s, char *noise, char blackclamp[16], char whiteclamp[16], char bothclamp[16], unsigned int w, unsigned int h, int pitch);
-
-void vp8_post_proc_down_and_across_mb_row_c(unsigned char *src, unsigned char *dst, int src_pitch, int dst_pitch, int cols, unsigned char *flimits, int size);
-void vp8_post_proc_down_and_across_mb_row_sse2(unsigned char *src, unsigned char *dst, int src_pitch, int dst_pitch, int cols, unsigned char *flimits, int size);
-RTCD_EXTERN void (*vp8_post_proc_down_and_across_mb_row)(unsigned char *src, unsigned char *dst, int src_pitch, int dst_pitch, int cols, unsigned char *flimits, int size);
-
-void vp8_quantize_mb_c(struct macroblock *);
-#define vp8_quantize_mb vp8_quantize_mb_c
-
-void vp8_quantize_mbuv_c(struct macroblock *);
-#define vp8_quantize_mbuv vp8_quantize_mbuv_c
-
-void vp8_quantize_mby_c(struct macroblock *);
-#define vp8_quantize_mby vp8_quantize_mby_c
-
-int vp8_refining_search_sad_c(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-int vp8_refining_search_sadx4(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-RTCD_EXTERN int (*vp8_refining_search_sad)(struct macroblock *x, struct block *b, struct blockd *d, union int_mv *ref_mv, int sad_per_bit, int distance, struct variance_vtable *fn_ptr, int *mvcost[2], union int_mv *center_mv);
-
-void vp8_regular_quantize_b_c(struct block *, struct blockd *);
-void vp8_regular_quantize_b_sse2(struct block *, struct blockd *);
-RTCD_EXTERN void (*vp8_regular_quantize_b)(struct block *, struct blockd *);
-
-void vp8_regular_quantize_b_pair_c(struct block *b1, struct block *b2, struct blockd *d1, struct blockd *d2);
-#define vp8_regular_quantize_b_pair vp8_regular_quantize_b_pair_c
-
-unsigned int vp8_sad16x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x16_mmx(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x16_wmt(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x16_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-RTCD_EXTERN unsigned int (*vp8_sad16x16)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-
-void vp8_sad16x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-void vp8_sad16x16x3_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-void vp8_sad16x16x3_ssse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad16x16x3)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-
-void vp8_sad16x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-void vp8_sad16x16x4d_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad16x16x4d)(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-
-void vp8_sad16x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-void vp8_sad16x16x8_sse4(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-RTCD_EXTERN void (*vp8_sad16x16x8)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-
-unsigned int vp8_sad16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x8_mmx(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad16x8_wmt(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-RTCD_EXTERN unsigned int (*vp8_sad16x8)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-
-void vp8_sad16x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-void vp8_sad16x8x3_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-void vp8_sad16x8x3_ssse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad16x8x3)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-
-void vp8_sad16x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-void vp8_sad16x8x4d_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad16x8x4d)(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-
-void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-void vp8_sad16x8x8_sse4(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-RTCD_EXTERN void (*vp8_sad16x8x8)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-
-unsigned int vp8_sad4x4_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad4x4_mmx(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad4x4_wmt(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-RTCD_EXTERN unsigned int (*vp8_sad4x4)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-
-void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-void vp8_sad4x4x3_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad4x4x3)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-
-void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-void vp8_sad4x4x4d_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad4x4x4d)(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-
-void vp8_sad4x4x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-void vp8_sad4x4x8_sse4(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-RTCD_EXTERN void (*vp8_sad4x4x8)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-
-unsigned int vp8_sad8x16_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad8x16_mmx(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad8x16_wmt(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-RTCD_EXTERN unsigned int (*vp8_sad8x16)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-
-void vp8_sad8x16x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-void vp8_sad8x16x3_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad8x16x3)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-
-void vp8_sad8x16x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-void vp8_sad8x16x4d_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad8x16x4d)(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-
-void vp8_sad8x16x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-void vp8_sad8x16x8_sse4(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-RTCD_EXTERN void (*vp8_sad8x16x8)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-
-unsigned int vp8_sad8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad8x8_mmx(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-unsigned int vp8_sad8x8_wmt(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-RTCD_EXTERN unsigned int (*vp8_sad8x8)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int max_sad);
-
-void vp8_sad8x8x3_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-void vp8_sad8x8x3_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad8x8x3)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sad_array);
-
-void vp8_sad8x8x4d_c(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-void vp8_sad8x8x4d_sse3(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-RTCD_EXTERN void (*vp8_sad8x8x4d)(const unsigned char *src_ptr, int src_stride, const unsigned char * const ref_ptr[], int ref_stride, unsigned int *sad_array);
-
-void vp8_sad8x8x8_c(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-void vp8_sad8x8x8_sse4(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-RTCD_EXTERN void (*vp8_sad8x8x8)(const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, unsigned short *sad_array);
-
-void vp8_short_fdct4x4_c(short *input, short *output, int pitch);
-void vp8_short_fdct4x4_mmx(short *input, short *output, int pitch);
-void vp8_short_fdct4x4_sse2(short *input, short *output, int pitch);
-RTCD_EXTERN void (*vp8_short_fdct4x4)(short *input, short *output, int pitch);
-
-void vp8_short_fdct8x4_c(short *input, short *output, int pitch);
-void vp8_short_fdct8x4_mmx(short *input, short *output, int pitch);
-void vp8_short_fdct8x4_sse2(short *input, short *output, int pitch);
-RTCD_EXTERN void (*vp8_short_fdct8x4)(short *input, short *output, int pitch);
-
-void vp8_short_idct4x4llm_c(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-void vp8_short_idct4x4llm_mmx(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-RTCD_EXTERN void (*vp8_short_idct4x4llm)(short *input, unsigned char *pred, int pitch, unsigned char *dst, int dst_stride);
-
-void vp8_short_inv_walsh4x4_c(short *input, short *output);
-void vp8_short_inv_walsh4x4_mmx(short *input, short *output);
-void vp8_short_inv_walsh4x4_sse2(short *input, short *output);
-RTCD_EXTERN void (*vp8_short_inv_walsh4x4)(short *input, short *output);
-
-void vp8_short_inv_walsh4x4_1_c(short *input, short *output);
-#define vp8_short_inv_walsh4x4_1 vp8_short_inv_walsh4x4_1_c
-
-void vp8_short_walsh4x4_c(short *input, short *output, int pitch);
-void vp8_short_walsh4x4_sse2(short *input, short *output, int pitch);
-RTCD_EXTERN void (*vp8_short_walsh4x4)(short *input, short *output, int pitch);
-
-void vp8_sixtap_predict16x16_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict16x16_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict16x16_sse2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict16x16_ssse3(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_sixtap_predict16x16)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-void vp8_sixtap_predict4x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict4x4_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict4x4_ssse3(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_sixtap_predict4x4)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-void vp8_sixtap_predict8x4_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x4_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x4_sse2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x4_ssse3(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_sixtap_predict8x4)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-void vp8_sixtap_predict8x8_c(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x8_mmx(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x8_sse2(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-void vp8_sixtap_predict8x8_ssse3(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-RTCD_EXTERN void (*vp8_sixtap_predict8x8)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
-
-unsigned int vp8_sub_pixel_mse16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_mse16x16_mmx(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_mse16x16_wmt(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_sub_pixel_mse16x16)(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-
-unsigned int vp8_sub_pixel_variance16x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x16_mmx(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x16_wmt(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x16_ssse3(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_sub_pixel_variance16x16)(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-
-unsigned int vp8_sub_pixel_variance16x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x8_mmx(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x8_wmt(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance16x8_ssse3(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_sub_pixel_variance16x8)(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-
-unsigned int vp8_sub_pixel_variance4x4_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance4x4_mmx(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance4x4_wmt(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_sub_pixel_variance4x4)(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-
-unsigned int vp8_sub_pixel_variance8x16_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance8x16_mmx(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance8x16_wmt(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_sub_pixel_variance8x16)(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-
-unsigned int vp8_sub_pixel_variance8x8_c(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance8x8_mmx(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-unsigned int vp8_sub_pixel_variance8x8_wmt(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_sub_pixel_variance8x8)(const unsigned char *src_ptr, int source_stride, int xoffset, int yoffset, const unsigned char *ref_ptr, int Refstride, unsigned int *sse);
-
-void vp8_subtract_b_c(struct block *be, struct blockd *bd, int pitch);
-void vp8_subtract_b_mmx(struct block *be, struct blockd *bd, int pitch);
-void vp8_subtract_b_sse2(struct block *be, struct blockd *bd, int pitch);
-RTCD_EXTERN void (*vp8_subtract_b)(struct block *be, struct blockd *bd, int pitch);
-
-void vp8_subtract_mbuv_c(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-void vp8_subtract_mbuv_mmx(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-void vp8_subtract_mbuv_sse2(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-RTCD_EXTERN void (*vp8_subtract_mbuv)(short *diff, unsigned char *usrc, unsigned char *vsrc, int src_stride, unsigned char *upred, unsigned char *vpred, int pred_stride);
-
-void vp8_subtract_mby_c(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-void vp8_subtract_mby_mmx(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-void vp8_subtract_mby_sse2(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-RTCD_EXTERN void (*vp8_subtract_mby)(short *diff, unsigned char *src, int src_stride, unsigned char *pred, int pred_stride);
-
-void vp8_temporal_filter_apply_c(unsigned char *frame1, unsigned int stride, unsigned char *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, unsigned short *count);
-void vp8_temporal_filter_apply_sse2(unsigned char *frame1, unsigned int stride, unsigned char *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, unsigned short *count);
-RTCD_EXTERN void (*vp8_temporal_filter_apply)(unsigned char *frame1, unsigned int stride, unsigned char *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, unsigned short *count);
-
-unsigned int vp8_variance16x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x16_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x16_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance16x16)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-unsigned int vp8_variance16x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x8_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance16x8_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance16x8)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-unsigned int vp8_variance4x4_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance4x4_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance4x4_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance4x4)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-unsigned int vp8_variance8x16_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x16_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x16_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance8x16)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-unsigned int vp8_variance8x8_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x8_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance8x8_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance8x8)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-unsigned int vp8_variance_halfpixvar16x16_h_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_h_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_h_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance_halfpixvar16x16_h)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-unsigned int vp8_variance_halfpixvar16x16_hv_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_hv_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_hv_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance_halfpixvar16x16_hv)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-unsigned int vp8_variance_halfpixvar16x16_v_c(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_v_mmx(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-unsigned int vp8_variance_halfpixvar16x16_v_wmt(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-RTCD_EXTERN unsigned int (*vp8_variance_halfpixvar16x16_v)(const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, unsigned int *sse);
-
-void vp8_yv12_copy_partial_frame_c(struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_partial_frame vp8_yv12_copy_partial_frame_c
-
-void vp8_rtcd(void);
-
-#ifdef RTCD_C
-#include "vpx_ports/x86.h"
-static void setup_rtcd_internal(void)
-{
- int flags = x86_simd_caps();
-
- (void)flags;
-
- vp8_bilinear_predict16x16 = vp8_bilinear_predict16x16_c;
- if (flags & HAS_MMX) vp8_bilinear_predict16x16 = vp8_bilinear_predict16x16_mmx;
- if (flags & HAS_SSE2) vp8_bilinear_predict16x16 = vp8_bilinear_predict16x16_sse2;
- if (flags & HAS_SSSE3) vp8_bilinear_predict16x16 = vp8_bilinear_predict16x16_ssse3;
-
- vp8_bilinear_predict4x4 = vp8_bilinear_predict4x4_c;
- if (flags & HAS_MMX) vp8_bilinear_predict4x4 = vp8_bilinear_predict4x4_mmx;
-
- vp8_bilinear_predict8x4 = vp8_bilinear_predict8x4_c;
- if (flags & HAS_MMX) vp8_bilinear_predict8x4 = vp8_bilinear_predict8x4_mmx;
-
- vp8_bilinear_predict8x8 = vp8_bilinear_predict8x8_c;
- if (flags & HAS_MMX) vp8_bilinear_predict8x8 = vp8_bilinear_predict8x8_mmx;
- if (flags & HAS_SSE2) vp8_bilinear_predict8x8 = vp8_bilinear_predict8x8_sse2;
- if (flags & HAS_SSSE3) vp8_bilinear_predict8x8 = vp8_bilinear_predict8x8_ssse3;
-
-
-
-
- vp8_block_error = vp8_block_error_c;
- if (flags & HAS_MMX) vp8_block_error = vp8_block_error_mmx;
- if (flags & HAS_SSE2) vp8_block_error = vp8_block_error_xmm;
-
- vp8_build_intra_predictors_mbuv_s = vp8_build_intra_predictors_mbuv_s_c;
- if (flags & HAS_SSE2) vp8_build_intra_predictors_mbuv_s = vp8_build_intra_predictors_mbuv_s_sse2;
- if (flags & HAS_SSSE3) vp8_build_intra_predictors_mbuv_s = vp8_build_intra_predictors_mbuv_s_ssse3;
-
- vp8_build_intra_predictors_mby_s = vp8_build_intra_predictors_mby_s_c;
- if (flags & HAS_SSE2) vp8_build_intra_predictors_mby_s = vp8_build_intra_predictors_mby_s_sse2;
- if (flags & HAS_SSSE3) vp8_build_intra_predictors_mby_s = vp8_build_intra_predictors_mby_s_ssse3;
-
- vp8_clear_system_state = vp8_clear_system_state_c;
- if (flags & HAS_MMX) vp8_clear_system_state = vpx_reset_mmx_state;
-
- vp8_copy32xn = vp8_copy32xn_c;
- if (flags & HAS_SSE2) vp8_copy32xn = vp8_copy32xn_sse2;
- if (flags & HAS_SSE3) vp8_copy32xn = vp8_copy32xn_sse3;
-
- vp8_copy_mem16x16 = vp8_copy_mem16x16_c;
- if (flags & HAS_MMX) vp8_copy_mem16x16 = vp8_copy_mem16x16_mmx;
- if (flags & HAS_SSE2) vp8_copy_mem16x16 = vp8_copy_mem16x16_sse2;
-
- vp8_copy_mem8x4 = vp8_copy_mem8x4_c;
- if (flags & HAS_MMX) vp8_copy_mem8x4 = vp8_copy_mem8x4_mmx;
-
- vp8_copy_mem8x8 = vp8_copy_mem8x8_c;
- if (flags & HAS_MMX) vp8_copy_mem8x8 = vp8_copy_mem8x8_mmx;
-
- vp8_dc_only_idct_add = vp8_dc_only_idct_add_c;
- if (flags & HAS_MMX) vp8_dc_only_idct_add = vp8_dc_only_idct_add_mmx;
-
- vp8_denoiser_filter = vp8_denoiser_filter_c;
- if (flags & HAS_SSE2) vp8_denoiser_filter = vp8_denoiser_filter_sse2;
-
- vp8_dequant_idct_add = vp8_dequant_idct_add_c;
- if (flags & HAS_MMX) vp8_dequant_idct_add = vp8_dequant_idct_add_mmx;
-
- vp8_dequant_idct_add_uv_block = vp8_dequant_idct_add_uv_block_c;
- if (flags & HAS_MMX) vp8_dequant_idct_add_uv_block = vp8_dequant_idct_add_uv_block_mmx;
- if (flags & HAS_SSE2) vp8_dequant_idct_add_uv_block = vp8_dequant_idct_add_uv_block_sse2;
-
- vp8_dequant_idct_add_y_block = vp8_dequant_idct_add_y_block_c;
- if (flags & HAS_MMX) vp8_dequant_idct_add_y_block = vp8_dequant_idct_add_y_block_mmx;
- if (flags & HAS_SSE2) vp8_dequant_idct_add_y_block = vp8_dequant_idct_add_y_block_sse2;
-
- vp8_dequantize_b = vp8_dequantize_b_c;
- if (flags & HAS_MMX) vp8_dequantize_b = vp8_dequantize_b_mmx;
-
- vp8_diamond_search_sad = vp8_diamond_search_sad_c;
- if (flags & HAS_SSE3) vp8_diamond_search_sad = vp8_diamond_search_sadx4;
-
- vp8_fast_quantize_b = vp8_fast_quantize_b_c;
- if (flags & HAS_SSE2) vp8_fast_quantize_b = vp8_fast_quantize_b_sse2;
- if (flags & HAS_SSSE3) vp8_fast_quantize_b = vp8_fast_quantize_b_ssse3;
-
-
- vp8_filter_by_weight16x16 = vp8_filter_by_weight16x16_c;
- if (flags & HAS_SSE2) vp8_filter_by_weight16x16 = vp8_filter_by_weight16x16_sse2;
-
-
- vp8_filter_by_weight8x8 = vp8_filter_by_weight8x8_c;
- if (flags & HAS_SSE2) vp8_filter_by_weight8x8 = vp8_filter_by_weight8x8_sse2;
-
- vp8_full_search_sad = vp8_full_search_sad_c;
- if (flags & HAS_SSE3) vp8_full_search_sad = vp8_full_search_sadx3;
- if (flags & HAS_SSE4_1) vp8_full_search_sad = vp8_full_search_sadx8;
-
- vp8_get4x4sse_cs = vp8_get4x4sse_cs_c;
- if (flags & HAS_MMX) vp8_get4x4sse_cs = vp8_get4x4sse_cs_mmx;
-
- vp8_get_mb_ss = vp8_get_mb_ss_c;
- if (flags & HAS_MMX) vp8_get_mb_ss = vp8_get_mb_ss_mmx;
- if (flags & HAS_SSE2) vp8_get_mb_ss = vp8_get_mb_ss_sse2;
-
-
- vp8_loop_filter_bh = vp8_loop_filter_bh_c;
- if (flags & HAS_MMX) vp8_loop_filter_bh = vp8_loop_filter_bh_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_bh = vp8_loop_filter_bh_sse2;
-
- vp8_loop_filter_bv = vp8_loop_filter_bv_c;
- if (flags & HAS_MMX) vp8_loop_filter_bv = vp8_loop_filter_bv_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_bv = vp8_loop_filter_bv_sse2;
-
- vp8_loop_filter_mbh = vp8_loop_filter_mbh_c;
- if (flags & HAS_MMX) vp8_loop_filter_mbh = vp8_loop_filter_mbh_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_mbh = vp8_loop_filter_mbh_sse2;
-
- vp8_loop_filter_mbv = vp8_loop_filter_mbv_c;
- if (flags & HAS_MMX) vp8_loop_filter_mbv = vp8_loop_filter_mbv_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_mbv = vp8_loop_filter_mbv_sse2;
-
- vp8_loop_filter_simple_bh = vp8_loop_filter_bhs_c;
- if (flags & HAS_MMX) vp8_loop_filter_simple_bh = vp8_loop_filter_bhs_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_simple_bh = vp8_loop_filter_bhs_sse2;
-
- vp8_loop_filter_simple_bv = vp8_loop_filter_bvs_c;
- if (flags & HAS_MMX) vp8_loop_filter_simple_bv = vp8_loop_filter_bvs_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_simple_bv = vp8_loop_filter_bvs_sse2;
-
- vp8_loop_filter_simple_mbh = vp8_loop_filter_simple_horizontal_edge_c;
- if (flags & HAS_MMX) vp8_loop_filter_simple_mbh = vp8_loop_filter_simple_horizontal_edge_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_simple_mbh = vp8_loop_filter_simple_horizontal_edge_sse2;
-
- vp8_loop_filter_simple_mbv = vp8_loop_filter_simple_vertical_edge_c;
- if (flags & HAS_MMX) vp8_loop_filter_simple_mbv = vp8_loop_filter_simple_vertical_edge_mmx;
- if (flags & HAS_SSE2) vp8_loop_filter_simple_mbv = vp8_loop_filter_simple_vertical_edge_sse2;
-
- vp8_mbblock_error = vp8_mbblock_error_c;
- if (flags & HAS_MMX) vp8_mbblock_error = vp8_mbblock_error_mmx;
- if (flags & HAS_SSE2) vp8_mbblock_error = vp8_mbblock_error_xmm;
-
- vp8_mbpost_proc_across_ip = vp8_mbpost_proc_across_ip_c;
- if (flags & HAS_SSE2) vp8_mbpost_proc_across_ip = vp8_mbpost_proc_across_ip_xmm;
-
- vp8_mbpost_proc_down = vp8_mbpost_proc_down_c;
- if (flags & HAS_MMX) vp8_mbpost_proc_down = vp8_mbpost_proc_down_mmx;
- if (flags & HAS_SSE2) vp8_mbpost_proc_down = vp8_mbpost_proc_down_xmm;
-
- vp8_mbuverror = vp8_mbuverror_c;
- if (flags & HAS_MMX) vp8_mbuverror = vp8_mbuverror_mmx;
- if (flags & HAS_SSE2) vp8_mbuverror = vp8_mbuverror_xmm;
-
- vp8_mse16x16 = vp8_mse16x16_c;
- if (flags & HAS_MMX) vp8_mse16x16 = vp8_mse16x16_mmx;
- if (flags & HAS_SSE2) vp8_mse16x16 = vp8_mse16x16_wmt;
-
- vp8_plane_add_noise = vp8_plane_add_noise_c;
- if (flags & HAS_MMX) vp8_plane_add_noise = vp8_plane_add_noise_mmx;
- if (flags & HAS_SSE2) vp8_plane_add_noise = vp8_plane_add_noise_wmt;
-
- vp8_post_proc_down_and_across_mb_row = vp8_post_proc_down_and_across_mb_row_c;
- if (flags & HAS_SSE2) vp8_post_proc_down_and_across_mb_row = vp8_post_proc_down_and_across_mb_row_sse2;
-
-
-
-
- vp8_refining_search_sad = vp8_refining_search_sad_c;
- if (flags & HAS_SSE3) vp8_refining_search_sad = vp8_refining_search_sadx4;
-
- vp8_regular_quantize_b = vp8_regular_quantize_b_c;
- if (flags & HAS_SSE2) vp8_regular_quantize_b = vp8_regular_quantize_b_sse2;
-
-
- vp8_sad16x16 = vp8_sad16x16_c;
- if (flags & HAS_MMX) vp8_sad16x16 = vp8_sad16x16_mmx;
- if (flags & HAS_SSE2) vp8_sad16x16 = vp8_sad16x16_wmt;
- if (flags & HAS_SSE3) vp8_sad16x16 = vp8_sad16x16_sse3;
-
- vp8_sad16x16x3 = vp8_sad16x16x3_c;
- if (flags & HAS_SSE3) vp8_sad16x16x3 = vp8_sad16x16x3_sse3;
- if (flags & HAS_SSSE3) vp8_sad16x16x3 = vp8_sad16x16x3_ssse3;
-
- vp8_sad16x16x4d = vp8_sad16x16x4d_c;
- if (flags & HAS_SSE3) vp8_sad16x16x4d = vp8_sad16x16x4d_sse3;
-
- vp8_sad16x16x8 = vp8_sad16x16x8_c;
- if (flags & HAS_SSE4_1) vp8_sad16x16x8 = vp8_sad16x16x8_sse4;
-
- vp8_sad16x8 = vp8_sad16x8_c;
- if (flags & HAS_MMX) vp8_sad16x8 = vp8_sad16x8_mmx;
- if (flags & HAS_SSE2) vp8_sad16x8 = vp8_sad16x8_wmt;
-
- vp8_sad16x8x3 = vp8_sad16x8x3_c;
- if (flags & HAS_SSE3) vp8_sad16x8x3 = vp8_sad16x8x3_sse3;
- if (flags & HAS_SSSE3) vp8_sad16x8x3 = vp8_sad16x8x3_ssse3;
-
- vp8_sad16x8x4d = vp8_sad16x8x4d_c;
- if (flags & HAS_SSE3) vp8_sad16x8x4d = vp8_sad16x8x4d_sse3;
-
- vp8_sad16x8x8 = vp8_sad16x8x8_c;
- if (flags & HAS_SSE4_1) vp8_sad16x8x8 = vp8_sad16x8x8_sse4;
-
- vp8_sad4x4 = vp8_sad4x4_c;
- if (flags & HAS_MMX) vp8_sad4x4 = vp8_sad4x4_mmx;
- if (flags & HAS_SSE2) vp8_sad4x4 = vp8_sad4x4_wmt;
-
- vp8_sad4x4x3 = vp8_sad4x4x3_c;
- if (flags & HAS_SSE3) vp8_sad4x4x3 = vp8_sad4x4x3_sse3;
-
- vp8_sad4x4x4d = vp8_sad4x4x4d_c;
- if (flags & HAS_SSE3) vp8_sad4x4x4d = vp8_sad4x4x4d_sse3;
-
- vp8_sad4x4x8 = vp8_sad4x4x8_c;
- if (flags & HAS_SSE4_1) vp8_sad4x4x8 = vp8_sad4x4x8_sse4;
-
- vp8_sad8x16 = vp8_sad8x16_c;
- if (flags & HAS_MMX) vp8_sad8x16 = vp8_sad8x16_mmx;
- if (flags & HAS_SSE2) vp8_sad8x16 = vp8_sad8x16_wmt;
-
- vp8_sad8x16x3 = vp8_sad8x16x3_c;
- if (flags & HAS_SSE3) vp8_sad8x16x3 = vp8_sad8x16x3_sse3;
-
- vp8_sad8x16x4d = vp8_sad8x16x4d_c;
- if (flags & HAS_SSE3) vp8_sad8x16x4d = vp8_sad8x16x4d_sse3;
-
- vp8_sad8x16x8 = vp8_sad8x16x8_c;
- if (flags & HAS_SSE4_1) vp8_sad8x16x8 = vp8_sad8x16x8_sse4;
-
- vp8_sad8x8 = vp8_sad8x8_c;
- if (flags & HAS_MMX) vp8_sad8x8 = vp8_sad8x8_mmx;
- if (flags & HAS_SSE2) vp8_sad8x8 = vp8_sad8x8_wmt;
-
- vp8_sad8x8x3 = vp8_sad8x8x3_c;
- if (flags & HAS_SSE3) vp8_sad8x8x3 = vp8_sad8x8x3_sse3;
-
- vp8_sad8x8x4d = vp8_sad8x8x4d_c;
- if (flags & HAS_SSE3) vp8_sad8x8x4d = vp8_sad8x8x4d_sse3;
-
- vp8_sad8x8x8 = vp8_sad8x8x8_c;
- if (flags & HAS_SSE4_1) vp8_sad8x8x8 = vp8_sad8x8x8_sse4;
-
- vp8_short_fdct4x4 = vp8_short_fdct4x4_c;
- if (flags & HAS_MMX) vp8_short_fdct4x4 = vp8_short_fdct4x4_mmx;
- if (flags & HAS_SSE2) vp8_short_fdct4x4 = vp8_short_fdct4x4_sse2;
-
- vp8_short_fdct8x4 = vp8_short_fdct8x4_c;
- if (flags & HAS_MMX) vp8_short_fdct8x4 = vp8_short_fdct8x4_mmx;
- if (flags & HAS_SSE2) vp8_short_fdct8x4 = vp8_short_fdct8x4_sse2;
-
- vp8_short_idct4x4llm = vp8_short_idct4x4llm_c;
- if (flags & HAS_MMX) vp8_short_idct4x4llm = vp8_short_idct4x4llm_mmx;
-
- vp8_short_inv_walsh4x4 = vp8_short_inv_walsh4x4_c;
- if (flags & HAS_MMX) vp8_short_inv_walsh4x4 = vp8_short_inv_walsh4x4_mmx;
- if (flags & HAS_SSE2) vp8_short_inv_walsh4x4 = vp8_short_inv_walsh4x4_sse2;
-
-
- vp8_short_walsh4x4 = vp8_short_walsh4x4_c;
- if (flags & HAS_SSE2) vp8_short_walsh4x4 = vp8_short_walsh4x4_sse2;
-
- vp8_sixtap_predict16x16 = vp8_sixtap_predict16x16_c;
- if (flags & HAS_MMX) vp8_sixtap_predict16x16 = vp8_sixtap_predict16x16_mmx;
- if (flags & HAS_SSE2) vp8_sixtap_predict16x16 = vp8_sixtap_predict16x16_sse2;
- if (flags & HAS_SSSE3) vp8_sixtap_predict16x16 = vp8_sixtap_predict16x16_ssse3;
-
- vp8_sixtap_predict4x4 = vp8_sixtap_predict4x4_c;
- if (flags & HAS_MMX) vp8_sixtap_predict4x4 = vp8_sixtap_predict4x4_mmx;
- if (flags & HAS_SSSE3) vp8_sixtap_predict4x4 = vp8_sixtap_predict4x4_ssse3;
-
- vp8_sixtap_predict8x4 = vp8_sixtap_predict8x4_c;
- if (flags & HAS_MMX) vp8_sixtap_predict8x4 = vp8_sixtap_predict8x4_mmx;
- if (flags & HAS_SSE2) vp8_sixtap_predict8x4 = vp8_sixtap_predict8x4_sse2;
- if (flags & HAS_SSSE3) vp8_sixtap_predict8x4 = vp8_sixtap_predict8x4_ssse3;
-
- vp8_sixtap_predict8x8 = vp8_sixtap_predict8x8_c;
- if (flags & HAS_MMX) vp8_sixtap_predict8x8 = vp8_sixtap_predict8x8_mmx;
- if (flags & HAS_SSE2) vp8_sixtap_predict8x8 = vp8_sixtap_predict8x8_sse2;
- if (flags & HAS_SSSE3) vp8_sixtap_predict8x8 = vp8_sixtap_predict8x8_ssse3;
-
- vp8_sub_pixel_mse16x16 = vp8_sub_pixel_mse16x16_c;
- if (flags & HAS_MMX) vp8_sub_pixel_mse16x16 = vp8_sub_pixel_mse16x16_mmx;
- if (flags & HAS_SSE2) vp8_sub_pixel_mse16x16 = vp8_sub_pixel_mse16x16_wmt;
-
- vp8_sub_pixel_variance16x16 = vp8_sub_pixel_variance16x16_c;
- if (flags & HAS_MMX) vp8_sub_pixel_variance16x16 = vp8_sub_pixel_variance16x16_mmx;
- if (flags & HAS_SSE2) vp8_sub_pixel_variance16x16 = vp8_sub_pixel_variance16x16_wmt;
- if (flags & HAS_SSSE3) vp8_sub_pixel_variance16x16 = vp8_sub_pixel_variance16x16_ssse3;
-
- vp8_sub_pixel_variance16x8 = vp8_sub_pixel_variance16x8_c;
- if (flags & HAS_MMX) vp8_sub_pixel_variance16x8 = vp8_sub_pixel_variance16x8_mmx;
- if (flags & HAS_SSE2) vp8_sub_pixel_variance16x8 = vp8_sub_pixel_variance16x8_wmt;
- if (flags & HAS_SSSE3) vp8_sub_pixel_variance16x8 = vp8_sub_pixel_variance16x8_ssse3;
-
- vp8_sub_pixel_variance4x4 = vp8_sub_pixel_variance4x4_c;
- if (flags & HAS_MMX) vp8_sub_pixel_variance4x4 = vp8_sub_pixel_variance4x4_mmx;
- if (flags & HAS_SSE2) vp8_sub_pixel_variance4x4 = vp8_sub_pixel_variance4x4_wmt;
-
- vp8_sub_pixel_variance8x16 = vp8_sub_pixel_variance8x16_c;
- if (flags & HAS_MMX) vp8_sub_pixel_variance8x16 = vp8_sub_pixel_variance8x16_mmx;
- if (flags & HAS_SSE2) vp8_sub_pixel_variance8x16 = vp8_sub_pixel_variance8x16_wmt;
-
- vp8_sub_pixel_variance8x8 = vp8_sub_pixel_variance8x8_c;
- if (flags & HAS_MMX) vp8_sub_pixel_variance8x8 = vp8_sub_pixel_variance8x8_mmx;
- if (flags & HAS_SSE2) vp8_sub_pixel_variance8x8 = vp8_sub_pixel_variance8x8_wmt;
-
- vp8_subtract_b = vp8_subtract_b_c;
- if (flags & HAS_MMX) vp8_subtract_b = vp8_subtract_b_mmx;
- if (flags & HAS_SSE2) vp8_subtract_b = vp8_subtract_b_sse2;
-
- vp8_subtract_mbuv = vp8_subtract_mbuv_c;
- if (flags & HAS_MMX) vp8_subtract_mbuv = vp8_subtract_mbuv_mmx;
- if (flags & HAS_SSE2) vp8_subtract_mbuv = vp8_subtract_mbuv_sse2;
-
- vp8_subtract_mby = vp8_subtract_mby_c;
- if (flags & HAS_MMX) vp8_subtract_mby = vp8_subtract_mby_mmx;
- if (flags & HAS_SSE2) vp8_subtract_mby = vp8_subtract_mby_sse2;
-
- vp8_temporal_filter_apply = vp8_temporal_filter_apply_c;
- if (flags & HAS_SSE2) vp8_temporal_filter_apply = vp8_temporal_filter_apply_sse2;
-
- vp8_variance16x16 = vp8_variance16x16_c;
- if (flags & HAS_MMX) vp8_variance16x16 = vp8_variance16x16_mmx;
- if (flags & HAS_SSE2) vp8_variance16x16 = vp8_variance16x16_wmt;
-
- vp8_variance16x8 = vp8_variance16x8_c;
- if (flags & HAS_MMX) vp8_variance16x8 = vp8_variance16x8_mmx;
- if (flags & HAS_SSE2) vp8_variance16x8 = vp8_variance16x8_wmt;
-
- vp8_variance4x4 = vp8_variance4x4_c;
- if (flags & HAS_MMX) vp8_variance4x4 = vp8_variance4x4_mmx;
- if (flags & HAS_SSE2) vp8_variance4x4 = vp8_variance4x4_wmt;
-
- vp8_variance8x16 = vp8_variance8x16_c;
- if (flags & HAS_MMX) vp8_variance8x16 = vp8_variance8x16_mmx;
- if (flags & HAS_SSE2) vp8_variance8x16 = vp8_variance8x16_wmt;
-
- vp8_variance8x8 = vp8_variance8x8_c;
- if (flags & HAS_MMX) vp8_variance8x8 = vp8_variance8x8_mmx;
- if (flags & HAS_SSE2) vp8_variance8x8 = vp8_variance8x8_wmt;
-
- vp8_variance_halfpixvar16x16_h = vp8_variance_halfpixvar16x16_h_c;
- if (flags & HAS_MMX) vp8_variance_halfpixvar16x16_h = vp8_variance_halfpixvar16x16_h_mmx;
- if (flags & HAS_SSE2) vp8_variance_halfpixvar16x16_h = vp8_variance_halfpixvar16x16_h_wmt;
-
- vp8_variance_halfpixvar16x16_hv = vp8_variance_halfpixvar16x16_hv_c;
- if (flags & HAS_MMX) vp8_variance_halfpixvar16x16_hv = vp8_variance_halfpixvar16x16_hv_mmx;
- if (flags & HAS_SSE2) vp8_variance_halfpixvar16x16_hv = vp8_variance_halfpixvar16x16_hv_wmt;
-
- vp8_variance_halfpixvar16x16_v = vp8_variance_halfpixvar16x16_v_c;
- if (flags & HAS_MMX) vp8_variance_halfpixvar16x16_v = vp8_variance_halfpixvar16x16_v_mmx;
- if (flags & HAS_SSE2) vp8_variance_halfpixvar16x16_v = vp8_variance_halfpixvar16x16_v_wmt;
-}
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif
diff --git a/videocodec/libvpx_internal/x86/vp9_rtcd.h b/videocodec/libvpx_internal/x86/vp9_rtcd.h
deleted file mode 100644
index cd0bd34..0000000
--- a/videocodec/libvpx_internal/x86/vp9_rtcd.h
+++ /dev/null
@@ -1,614 +0,0 @@
-#ifndef VP9_RTCD_H_
-#define VP9_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-/*
- * VP9
- */
-
-#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_enums.h"
-#include "trace_conf.h"
-
-struct macroblockd;
-
-/* Encoder forward decls */
-struct macroblock;
-struct vp9_variance_vtable;
-
-#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
-struct mv;
-union int_mv;
-struct yv12_buffer_config;
-
-void vp9_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d207_predictor_4x4_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d207_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d45_predictor_4x4_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d45_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d63_predictor_4x4_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d63_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_h_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_h_predictor_4x4_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_h_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_4x4 vp9_d117_predictor_4x4_c
-
-void vp9_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_4x4 vp9_d135_predictor_4x4_c
-
-void vp9_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d153_predictor_4x4_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d153_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_v_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_v_predictor_4x4_sse(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_v_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_tm_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_tm_predictor_4x4_sse(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_tm_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_dc_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_dc_predictor_4x4_sse(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_dc_predictor_4x4)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_dc_top_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_4x4 vp9_dc_top_predictor_4x4_c
-
-void vp9_dc_left_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_4x4 vp9_dc_left_predictor_4x4_c
-
-void vp9_dc_128_predictor_4x4_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_4x4 vp9_dc_128_predictor_4x4_c
-
-void vp9_d207_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d207_predictor_8x8_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d207_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d45_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d45_predictor_8x8_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d45_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d63_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d63_predictor_8x8_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d63_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_h_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_h_predictor_8x8_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_h_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d117_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_8x8 vp9_d117_predictor_8x8_c
-
-void vp9_d135_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_8x8 vp9_d135_predictor_8x8_c
-
-void vp9_d153_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d153_predictor_8x8_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d153_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_v_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_v_predictor_8x8_sse(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_v_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_tm_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_tm_predictor_8x8_sse2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_tm_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_dc_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_dc_predictor_8x8_sse(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_dc_predictor_8x8)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_dc_top_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_8x8 vp9_dc_top_predictor_8x8_c
-
-void vp9_dc_left_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_8x8 vp9_dc_left_predictor_8x8_c
-
-void vp9_dc_128_predictor_8x8_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_8x8 vp9_dc_128_predictor_8x8_c
-
-void vp9_d207_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d207_predictor_16x16_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d207_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d45_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d45_predictor_16x16_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d45_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d63_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d63_predictor_16x16_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d63_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_h_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_h_predictor_16x16_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_h_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d117_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_16x16 vp9_d117_predictor_16x16_c
-
-void vp9_d135_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_16x16 vp9_d135_predictor_16x16_c
-
-void vp9_d153_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d153_predictor_16x16_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d153_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_v_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_v_predictor_16x16_sse2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_v_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_tm_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_tm_predictor_16x16_sse2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_tm_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_dc_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_dc_predictor_16x16_sse2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_dc_predictor_16x16)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_dc_top_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_16x16 vp9_dc_top_predictor_16x16_c
-
-void vp9_dc_left_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_16x16 vp9_dc_left_predictor_16x16_c
-
-void vp9_dc_128_predictor_16x16_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_16x16 vp9_dc_128_predictor_16x16_c
-
-void vp9_d207_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d207_predictor_32x32_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d207_predictor_32x32)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d45_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d45_predictor_32x32_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d45_predictor_32x32)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d63_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_d63_predictor_32x32_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_d63_predictor_32x32)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_h_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_h_predictor_32x32_ssse3(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_h_predictor_32x32)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_d117_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d117_predictor_32x32 vp9_d117_predictor_32x32_c
-
-void vp9_d135_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d135_predictor_32x32 vp9_d135_predictor_32x32_c
-
-void vp9_d153_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_d153_predictor_32x32 vp9_d153_predictor_32x32_c
-
-void vp9_v_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_v_predictor_32x32_sse2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_v_predictor_32x32)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_tm_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_tm_predictor_32x32 vp9_tm_predictor_32x32_c
-
-void vp9_dc_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-void vp9_dc_predictor_32x32_sse2(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-RTCD_EXTERN void (*vp9_dc_predictor_32x32)(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-
-void vp9_dc_top_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_top_predictor_32x32 vp9_dc_top_predictor_32x32_c
-
-void vp9_dc_left_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_left_predictor_32x32 vp9_dc_left_predictor_32x32_c
-
-void vp9_dc_128_predictor_32x32_c(uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left);
-#define vp9_dc_128_predictor_32x32 vp9_dc_128_predictor_32x32_c
-
-void vp9_lpf_vertical_16_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-void vp9_lpf_vertical_16_sse2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-RTCD_EXTERN void (*vp9_lpf_vertical_16)(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-
-void vp9_lpf_vertical_16_dual_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-void vp9_lpf_vertical_16_dual_sse2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-RTCD_EXTERN void (*vp9_lpf_vertical_16_dual)(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh);
-
-void vp9_lpf_vertical_8_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_lpf_vertical_8_sse2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-RTCD_EXTERN void (*vp9_lpf_vertical_8)(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-
-void vp9_lpf_vertical_8_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-void vp9_lpf_vertical_8_dual_sse2(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-RTCD_EXTERN void (*vp9_lpf_vertical_8_dual)(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-
-void vp9_lpf_vertical_4_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_lpf_vertical_4_mmx(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-RTCD_EXTERN void (*vp9_lpf_vertical_4)(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-
-void vp9_lpf_vertical_4_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-void vp9_lpf_vertical_4_dual_sse2(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-RTCD_EXTERN void (*vp9_lpf_vertical_4_dual)(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-
-void vp9_lpf_horizontal_16_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_lpf_horizontal_16_sse2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-RTCD_EXTERN void (*vp9_lpf_horizontal_16)(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-
-void vp9_lpf_horizontal_8_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_lpf_horizontal_8_sse2(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-RTCD_EXTERN void (*vp9_lpf_horizontal_8)(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-
-void vp9_lpf_horizontal_8_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-void vp9_lpf_horizontal_8_dual_sse2(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-RTCD_EXTERN void (*vp9_lpf_horizontal_8_dual)(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-
-void vp9_lpf_horizontal_4_c(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-void vp9_lpf_horizontal_4_mmx(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-RTCD_EXTERN void (*vp9_lpf_horizontal_4)(uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int count);
-
-void vp9_lpf_horizontal_4_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-void vp9_lpf_horizontal_4_dual_sse2(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-RTCD_EXTERN void (*vp9_lpf_horizontal_4_dual)(uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1);
-
-void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_inner vp9_blend_mb_inner_c
-
-void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_mb_outer vp9_blend_mb_outer_c
-
-void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v, int y1, int u1, int v1, int alpha, int stride);
-#define vp9_blend_b vp9_blend_b_c
-
-void vp9_convolve_copy_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);
-void vp9_convolve_copy_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);
-RTCD_EXTERN void (*vp9_convolve_copy)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_convolve_avg_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);
-void vp9_convolve_avg_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);
-RTCD_EXTERN void (*vp9_convolve_avg)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_convolve8_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);
-void vp9_convolve8_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);
-void vp9_convolve8_ssse3(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);
-RTCD_EXTERN void (*vp9_convolve8)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_convolve8_horiz_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);
-void vp9_convolve8_horiz_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);
-void vp9_convolve8_horiz_ssse3(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);
-RTCD_EXTERN void (*vp9_convolve8_horiz)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_convolve8_vert_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);
-void vp9_convolve8_vert_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);
-void vp9_convolve8_vert_ssse3(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);
-RTCD_EXTERN void (*vp9_convolve8_vert)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_convolve8_avg_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);
-void vp9_convolve8_avg_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);
-void vp9_convolve8_avg_ssse3(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);
-RTCD_EXTERN void (*vp9_convolve8_avg)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_convolve8_avg_horiz_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);
-void vp9_convolve8_avg_horiz_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);
-void vp9_convolve8_avg_horiz_ssse3(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);
-RTCD_EXTERN void (*vp9_convolve8_avg_horiz)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_convolve8_avg_vert_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);
-void vp9_convolve8_avg_vert_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);
-void vp9_convolve8_avg_vert_ssse3(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);
-RTCD_EXTERN void (*vp9_convolve8_avg_vert)(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h);
-
-void vp9_idct4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct4x4_1_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct4x4_1_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct4x4_16_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct4x4_16_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct8x8_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_1_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct8x8_1_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_64_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct8x8_64_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct8x8_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct8x8_10_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct8x8_10_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct16x16_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_1_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct16x16_1_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_256_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct16x16_256_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct16x16_10_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct16x16_10_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct16x16_10_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct32x32_1024_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_1024_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct32x32_1024_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct32x32_34_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_34_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct32x32_34_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_idct32x32_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-void vp9_idct32x32_1_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride);
-RTCD_EXTERN void (*vp9_idct32x32_1_add)(const int16_t *input, uint8_t *dest, int dest_stride);
-
-void vp9_iht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-void vp9_iht4x4_16_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-RTCD_EXTERN void (*vp9_iht4x4_16_add)(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-
-void vp9_iht8x8_64_add_c(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-void vp9_iht8x8_64_add_sse2(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-RTCD_EXTERN void (*vp9_iht8x8_64_add)(const int16_t *input, uint8_t *dest, int dest_stride, int tx_type);
-
-void vp9_iht16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-void vp9_iht16x16_256_add_sse2(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-RTCD_EXTERN void (*vp9_iht16x16_256_add)(const int16_t *input, uint8_t *output, int pitch, int tx_type);
-
-void vp9_iwht4x4_1_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_1_add vp9_iwht4x4_1_add_c
-
-void vp9_iwht4x4_16_add_c(const int16_t *input, uint8_t *dest, int dest_stride);
-#define vp9_iwht4x4_16_add vp9_iwht4x4_16_add_c
-
-void vp9_rtcd(void);
-
-#ifdef RTCD_C
-#include "vpx_ports/x86.h"
-static void setup_rtcd_internal(void)
-{
- int flags = x86_simd_caps();
-
- (void)flags;
- if (flags & HAS_SSSE3) {
- LOGD("HAS_SSSE3");
- }
- if (flags & HAS_SSE3) {
- LOGD("HAS_SSE3");
- }
- if (flags & HAS_SSE) {
- LOGD("HAS_SSE");
- }
- if (flags & HAS_SSE2) {
- LOGD("HAS_SSE2");
- }
- if (flags & HAS_MMX) {
- LOGD("HAS_MMX");
- }
-
- vp9_d207_predictor_4x4 = vp9_d207_predictor_4x4_c;
- if (flags & HAS_SSSE3) vp9_d207_predictor_4x4 = vp9_d207_predictor_4x4_ssse3;
-
- vp9_d45_predictor_4x4 = vp9_d45_predictor_4x4_c;
- if (flags & HAS_SSSE3) vp9_d45_predictor_4x4 = vp9_d45_predictor_4x4_ssse3;
-
- vp9_d63_predictor_4x4 = vp9_d63_predictor_4x4_c;
- if (flags & HAS_SSSE3) vp9_d63_predictor_4x4 = vp9_d63_predictor_4x4_ssse3;
-
- vp9_h_predictor_4x4 = vp9_h_predictor_4x4_c;
- if (flags & HAS_SSSE3) vp9_h_predictor_4x4 = vp9_h_predictor_4x4_ssse3;
-
-
-
- vp9_d153_predictor_4x4 = vp9_d153_predictor_4x4_c;
- if (flags & HAS_SSSE3) vp9_d153_predictor_4x4 = vp9_d153_predictor_4x4_ssse3;
-
- vp9_v_predictor_4x4 = vp9_v_predictor_4x4_c;
- if (flags & HAS_SSE) vp9_v_predictor_4x4 = vp9_v_predictor_4x4_sse;
-
- vp9_tm_predictor_4x4 = vp9_tm_predictor_4x4_c;
- if (flags & HAS_SSE) vp9_tm_predictor_4x4 = vp9_tm_predictor_4x4_sse;
-
- vp9_dc_predictor_4x4 = vp9_dc_predictor_4x4_c;
- if (flags & HAS_SSE) vp9_dc_predictor_4x4 = vp9_dc_predictor_4x4_sse;
-
-
-
-
- vp9_d207_predictor_8x8 = vp9_d207_predictor_8x8_c;
- if (flags & HAS_SSSE3) vp9_d207_predictor_8x8 = vp9_d207_predictor_8x8_ssse3;
-
- vp9_d45_predictor_8x8 = vp9_d45_predictor_8x8_c;
- if (flags & HAS_SSSE3) vp9_d45_predictor_8x8 = vp9_d45_predictor_8x8_ssse3;
-
- vp9_d63_predictor_8x8 = vp9_d63_predictor_8x8_c;
- if (flags & HAS_SSSE3) vp9_d63_predictor_8x8 = vp9_d63_predictor_8x8_ssse3;
-
- vp9_h_predictor_8x8 = vp9_h_predictor_8x8_c;
- if (flags & HAS_SSSE3) vp9_h_predictor_8x8 = vp9_h_predictor_8x8_ssse3;
-
-
-
- vp9_d153_predictor_8x8 = vp9_d153_predictor_8x8_c;
- if (flags & HAS_SSSE3) vp9_d153_predictor_8x8 = vp9_d153_predictor_8x8_ssse3;
-
- vp9_v_predictor_8x8 = vp9_v_predictor_8x8_c;
- if (flags & HAS_SSE) vp9_v_predictor_8x8 = vp9_v_predictor_8x8_sse;
-
- vp9_tm_predictor_8x8 = vp9_tm_predictor_8x8_c;
- if (flags & HAS_SSE2) vp9_tm_predictor_8x8 = vp9_tm_predictor_8x8_sse2;
-
- vp9_dc_predictor_8x8 = vp9_dc_predictor_8x8_c;
- if (flags & HAS_SSE) vp9_dc_predictor_8x8 = vp9_dc_predictor_8x8_sse;
-
-
-
-
- vp9_d207_predictor_16x16 = vp9_d207_predictor_16x16_c;
- if (flags & HAS_SSSE3) vp9_d207_predictor_16x16 = vp9_d207_predictor_16x16_ssse3;
-
- vp9_d45_predictor_16x16 = vp9_d45_predictor_16x16_c;
- if (flags & HAS_SSSE3) vp9_d45_predictor_16x16 = vp9_d45_predictor_16x16_ssse3;
-
- vp9_d63_predictor_16x16 = vp9_d63_predictor_16x16_c;
- if (flags & HAS_SSSE3) vp9_d63_predictor_16x16 = vp9_d63_predictor_16x16_ssse3;
-
- vp9_h_predictor_16x16 = vp9_h_predictor_16x16_c;
- if (flags & HAS_SSSE3) vp9_h_predictor_16x16 = vp9_h_predictor_16x16_ssse3;
-
-
-
- vp9_d153_predictor_16x16 = vp9_d153_predictor_16x16_c;
- if (flags & HAS_SSSE3) vp9_d153_predictor_16x16 = vp9_d153_predictor_16x16_ssse3;
-
- vp9_v_predictor_16x16 = vp9_v_predictor_16x16_c;
- if (flags & HAS_SSE2) vp9_v_predictor_16x16 = vp9_v_predictor_16x16_sse2;
-
- vp9_tm_predictor_16x16 = vp9_tm_predictor_16x16_c;
- if (flags & HAS_SSE2) vp9_tm_predictor_16x16 = vp9_tm_predictor_16x16_sse2;
-
- vp9_dc_predictor_16x16 = vp9_dc_predictor_16x16_c;
- if (flags & HAS_SSE2) vp9_dc_predictor_16x16 = vp9_dc_predictor_16x16_sse2;
-
-
-
-
- vp9_d207_predictor_32x32 = vp9_d207_predictor_32x32_c;
- if (flags & HAS_SSSE3) vp9_d207_predictor_32x32 = vp9_d207_predictor_32x32_ssse3;
-
- vp9_d45_predictor_32x32 = vp9_d45_predictor_32x32_c;
- if (flags & HAS_SSSE3) vp9_d45_predictor_32x32 = vp9_d45_predictor_32x32_ssse3;
-
- vp9_d63_predictor_32x32 = vp9_d63_predictor_32x32_c;
- if (flags & HAS_SSSE3) vp9_d63_predictor_32x32 = vp9_d63_predictor_32x32_ssse3;
-
- vp9_h_predictor_32x32 = vp9_h_predictor_32x32_c;
- if (flags & HAS_SSSE3) vp9_h_predictor_32x32 = vp9_h_predictor_32x32_ssse3;
-
-
-
-
- vp9_v_predictor_32x32 = vp9_v_predictor_32x32_c;
- if (flags & HAS_SSE2) vp9_v_predictor_32x32 = vp9_v_predictor_32x32_sse2;
-
-
- vp9_dc_predictor_32x32 = vp9_dc_predictor_32x32_c;
- if (flags & HAS_SSE2) vp9_dc_predictor_32x32 = vp9_dc_predictor_32x32_sse2;
-
-
-
-
- vp9_lpf_vertical_16 = vp9_lpf_vertical_16_c;
- if (flags & HAS_SSE2) vp9_lpf_vertical_16 = vp9_lpf_vertical_16_sse2;
-
- vp9_lpf_vertical_16_dual = vp9_lpf_vertical_16_dual_c;
- if (flags & HAS_SSE2) vp9_lpf_vertical_16_dual = vp9_lpf_vertical_16_dual_sse2;
-
- vp9_lpf_vertical_8 = vp9_lpf_vertical_8_c;
- if (flags & HAS_SSE2) vp9_lpf_vertical_8 = vp9_lpf_vertical_8_sse2;
-
- vp9_lpf_vertical_8_dual = vp9_lpf_vertical_8_dual_c;
- if (flags & HAS_SSE2) vp9_lpf_vertical_8_dual = vp9_lpf_vertical_8_dual_sse2;
-
- vp9_lpf_vertical_4 = vp9_lpf_vertical_4_c;
- if (flags & HAS_MMX) vp9_lpf_vertical_4 = vp9_lpf_vertical_4_mmx;
-
- vp9_lpf_vertical_4_dual = vp9_lpf_vertical_4_dual_c;
- if (flags & HAS_SSE2) vp9_lpf_vertical_4_dual = vp9_lpf_vertical_4_dual_sse2;
-
- vp9_lpf_horizontal_16 = vp9_lpf_horizontal_16_c;
- if (flags & HAS_SSE2) vp9_lpf_horizontal_16 = vp9_lpf_horizontal_16_sse2;
-
- vp9_lpf_horizontal_8 = vp9_lpf_horizontal_8_c;
- if (flags & HAS_SSE2) vp9_lpf_horizontal_8 = vp9_lpf_horizontal_8_sse2;
-
- vp9_lpf_horizontal_8_dual = vp9_lpf_horizontal_8_dual_c;
- if (flags & HAS_SSE2) vp9_lpf_horizontal_8_dual = vp9_lpf_horizontal_8_dual_sse2;
-
- vp9_lpf_horizontal_4 = vp9_lpf_horizontal_4_c;
- if (flags & HAS_MMX) vp9_lpf_horizontal_4 = vp9_lpf_horizontal_4_mmx;
-
- vp9_lpf_horizontal_4_dual = vp9_lpf_horizontal_4_dual_c;
- if (flags & HAS_SSE2) vp9_lpf_horizontal_4_dual = vp9_lpf_horizontal_4_dual_sse2;
-
-
-
-
- vp9_convolve_copy = vp9_convolve_copy_c;
- if (flags & HAS_SSE2) vp9_convolve_copy = vp9_convolve_copy_sse2;
-
- vp9_convolve_avg = vp9_convolve_avg_c;
- if (flags & HAS_SSE2) vp9_convolve_avg = vp9_convolve_avg_sse2;
-
- vp9_convolve8 = vp9_convolve8_c;
- if (flags & HAS_SSE2) vp9_convolve8 = vp9_convolve8_sse2;
- if (flags & HAS_SSSE3) vp9_convolve8 = vp9_convolve8_ssse3;
-
- vp9_convolve8_horiz = vp9_convolve8_horiz_c;
- if (flags & HAS_SSE2) vp9_convolve8_horiz = vp9_convolve8_horiz_sse2;
- if (flags & HAS_SSSE3) vp9_convolve8_horiz = vp9_convolve8_horiz_ssse3;
-
- vp9_convolve8_vert = vp9_convolve8_vert_c;
- if (flags & HAS_SSE2) vp9_convolve8_vert = vp9_convolve8_vert_sse2;
- if (flags & HAS_SSSE3) vp9_convolve8_vert = vp9_convolve8_vert_ssse3;
-
- vp9_convolve8_avg = vp9_convolve8_avg_c;
- if (flags & HAS_SSE2) vp9_convolve8_avg = vp9_convolve8_avg_sse2;
- if (flags & HAS_SSSE3) vp9_convolve8_avg = vp9_convolve8_avg_ssse3;
-
- vp9_convolve8_avg_horiz = vp9_convolve8_avg_horiz_c;
- if (flags & HAS_SSE2) vp9_convolve8_avg_horiz = vp9_convolve8_avg_horiz_sse2;
- if (flags & HAS_SSSE3) vp9_convolve8_avg_horiz = vp9_convolve8_avg_horiz_ssse3;
-
- vp9_convolve8_avg_vert = vp9_convolve8_avg_vert_c;
- if (flags & HAS_SSE2) vp9_convolve8_avg_vert = vp9_convolve8_avg_vert_sse2;
- if (flags & HAS_SSSE3) vp9_convolve8_avg_vert = vp9_convolve8_avg_vert_ssse3;
-
- vp9_idct4x4_1_add = vp9_idct4x4_1_add_c;
- if (flags & HAS_SSE2) vp9_idct4x4_1_add = vp9_idct4x4_1_add_sse2;
-
- vp9_idct4x4_16_add = vp9_idct4x4_16_add_c;
- if (flags & HAS_SSE2) vp9_idct4x4_16_add = vp9_idct4x4_16_add_sse2;
-
- vp9_idct8x8_1_add = vp9_idct8x8_1_add_c;
- if (flags & HAS_SSE2) vp9_idct8x8_1_add = vp9_idct8x8_1_add_sse2;
-
- vp9_idct8x8_64_add = vp9_idct8x8_64_add_c;
- if (flags & HAS_SSE2) vp9_idct8x8_64_add = vp9_idct8x8_64_add_sse2;
-
- vp9_idct8x8_10_add = vp9_idct8x8_10_add_c;
- if (flags & HAS_SSE2) vp9_idct8x8_10_add = vp9_idct8x8_10_add_sse2;
-
- vp9_idct16x16_1_add = vp9_idct16x16_1_add_c;
- if (flags & HAS_SSE2) vp9_idct16x16_1_add = vp9_idct16x16_1_add_sse2;
-
- vp9_idct16x16_256_add = vp9_idct16x16_256_add_c;
- if (flags & HAS_SSE2) vp9_idct16x16_256_add = vp9_idct16x16_256_add_sse2;
-
- vp9_idct16x16_10_add = vp9_idct16x16_10_add_c;
- if (flags & HAS_SSE2) vp9_idct16x16_10_add = vp9_idct16x16_10_add_sse2;
-
- vp9_idct32x32_1024_add = vp9_idct32x32_1024_add_c;
- if (flags & HAS_SSE2) vp9_idct32x32_1024_add = vp9_idct32x32_1024_add_sse2;
-
- vp9_idct32x32_34_add = vp9_idct32x32_34_add_c;
- if (flags & HAS_SSE2) vp9_idct32x32_34_add = vp9_idct32x32_34_add_sse2;
-
- vp9_idct32x32_1_add = vp9_idct32x32_1_add_c;
- if (flags & HAS_SSE2) vp9_idct32x32_1_add = vp9_idct32x32_1_add_sse2;
-
- vp9_iht4x4_16_add = vp9_iht4x4_16_add_c;
- if (flags & HAS_SSE2) vp9_iht4x4_16_add = vp9_iht4x4_16_add_sse2;
-
- vp9_iht8x8_64_add = vp9_iht8x8_64_add_c;
- if (flags & HAS_SSE2) vp9_iht8x8_64_add = vp9_iht8x8_64_add_sse2;
-
- vp9_iht16x16_256_add = vp9_iht16x16_256_add_c;
- if (flags & HAS_SSE2) vp9_iht16x16_256_add = vp9_iht16x16_256_add_sse2;
-}
-#endif
-#endif
diff --git a/videocodec/libvpx_internal/x86/vpx_config.asm b/videocodec/libvpx_internal/x86/vpx_config.asm
deleted file mode 100644
index cfa7b9c..0000000
--- a/videocodec/libvpx_internal/x86/vpx_config.asm
+++ /dev/null
@@ -1,80 +0,0 @@
-ARCH_ARM equ 0
-ARCH_MIPS equ 0
-ARCH_X86 equ 1
-ARCH_X86_64 equ 0
-ARCH_PPC32 equ 0
-ARCH_PPC64 equ 0
-HAVE_EDSP equ 0
-HAVE_MEDIA equ 0
-HAVE_NEON equ 0
-HAVE_MIPS32 equ 0
-HAVE_DSPR2 equ 0
-HAVE_MMX equ 1
-HAVE_SSE equ 1
-HAVE_SSE2 equ 1
-HAVE_SSE3 equ 1
-HAVE_SSSE3 equ 1
-HAVE_SSE4_1 equ 1
-HAVE_AVX equ 1
-HAVE_AVX2 equ 0
-HAVE_ALTIVEC equ 0
-HAVE_VPX_PORTS equ 1
-HAVE_STDINT_H equ 1
-HAVE_ALT_TREE_LAYOUT equ 0
-HAVE_PTHREAD_H equ 1
-HAVE_SYS_MMAN_H equ 1
-HAVE_UNISTD_H equ 1
-CONFIG_EXTERNAL_BUILD equ 0
-CONFIG_INSTALL_DOCS equ 1
-CONFIG_INSTALL_BINS equ 1
-CONFIG_INSTALL_LIBS equ 1
-CONFIG_INSTALL_SRCS equ 0
-CONFIG_USE_X86INC equ 1
-CONFIG_DEBUG equ 0
-CONFIG_GPROF equ 0
-CONFIG_GCOV equ 0
-CONFIG_RVCT equ 0
-CONFIG_GCC equ 1
-CONFIG_MSVS equ 0
-CONFIG_PIC equ 1
-CONFIG_BIG_ENDIAN equ 0
-CONFIG_CODEC_SRCS equ 0
-CONFIG_DEBUG_LIBS equ 0
-CONFIG_FAST_UNALIGNED equ 1
-CONFIG_MEM_MANAGER equ 0
-CONFIG_MEM_TRACKER equ 0
-CONFIG_MEM_CHECKS equ 0
-CONFIG_DEQUANT_TOKENS equ 0
-CONFIG_DC_RECON equ 0
-CONFIG_RUNTIME_CPU_DETECT equ 1
-CONFIG_POSTPROC equ 1
-CONFIG_VP9_POSTPROC equ 0
-CONFIG_MULTITHREAD equ 1
-CONFIG_INTERNAL_STATS equ 0
-CONFIG_VP8_ENCODER equ 1
-CONFIG_VP8_DECODER equ 1
-CONFIG_VP9_ENCODER equ 0
-CONFIG_VP9_DECODER equ 1
-CONFIG_VP8 equ 1
-CONFIG_VP9 equ 1
-CONFIG_ENCODERS equ 1
-CONFIG_DECODERS equ 1
-CONFIG_STATIC_MSVCRT equ 0
-CONFIG_SPATIAL_RESAMPLING equ 1
-CONFIG_REALTIME_ONLY equ 0
-CONFIG_ONTHEFLY_BITPACKING equ 0
-CONFIG_ERROR_CONCEALMENT equ 0
-CONFIG_SHARED equ 0
-CONFIG_STATIC equ 1
-CONFIG_SMALL equ 0
-CONFIG_POSTPROC_VISUALIZER equ 0
-CONFIG_OS_SUPPORT equ 1
-CONFIG_UNIT_TESTS equ 0
-CONFIG_WEBM_IO equ 1
-CONFIG_DECODE_PERF_TESTS equ 0
-CONFIG_MULTI_RES_ENCODING equ 0
-CONFIG_TEMPORAL_DENOISING equ 1
-CONFIG_EXPERIMENTAL equ 0
-CONFIG_DECRYPT equ 0
-CONFIG_MULTIPLE_ARF equ 0
-CONFIG_ALPHA equ 0
diff --git a/videocodec/libvpx_internal/x86/vpx_config.c b/videocodec/libvpx_internal/x86/vpx_config.c
deleted file mode 100644
index 3dd2a21..0000000
--- a/videocodec/libvpx_internal/x86/vpx_config.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-static const char* const cfg = "--target=x86-android-gcc --disable-docs --disable-unit-tests --disable-vp9-encoder";
-const char *vpx_codec_build_config(void) {return cfg;}
diff --git a/videocodec/libvpx_internal/x86/vpx_config.h b/videocodec/libvpx_internal/x86/vpx_config.h
deleted file mode 100644
index 8073181..0000000
--- a/videocodec/libvpx_internal/x86/vpx_config.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2011 The WebM project authors. All Rights Reserved. */
-/* */
-/* Use of this source code is governed by a BSD-style license */
-/* that can be found in the LICENSE file in the root of the source */
-/* tree. An additional intellectual property rights grant can be found */
-/* in the file PATENTS. All contributing project authors may */
-/* be found in the AUTHORS file in the root of the source tree. */
-/* This file automatically generated by configure. Do not edit! */
-#ifndef VPX_CONFIG_H
-#define VPX_CONFIG_H
-#define RESTRICT
-#define INLINE __inline__ __attribute__((always_inline))
-#define ARCH_ARM 0
-#define ARCH_MIPS 0
-#define ARCH_X86_32 1
-#define ARCH_X86_64 0
-#define ARCH_PPC32 0
-#define ARCH_PPC64 0
-#define HAVE_EDSP 0
-#define HAVE_MEDIA 0
-#define HAVE_NEON 0
-#define HAVE_MIPS32 0
-#define HAVE_DSPR2 0
-#define HAVE_MMX 1
-#define HAVE_SSE 1
-#define HAVE_SSE2 1
-#define HAVE_SSE3 1
-#define HAVE_SSSE3 1
-#define HAVE_SSE4_1 1
-#define HAVE_AVX 1
-#define HAVE_AVX2 0
-#define HAVE_ALTIVEC 0
-#define HAVE_VPX_PORTS 1
-#define HAVE_STDINT_H 1
-#define HAVE_ALT_TREE_LAYOUT 0
-#define HAVE_PTHREAD_H 1
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_UNISTD_H 1
-#define CONFIG_EXTERNAL_BUILD 0
-#define CONFIG_INSTALL_DOCS 1
-#define CONFIG_INSTALL_BINS 1
-#define CONFIG_INSTALL_LIBS 1
-#define CONFIG_INSTALL_SRCS 0
-#define CONFIG_USE_X86INC 1
-#define CONFIG_DEBUG 0
-#define CONFIG_GPROF 0
-#define CONFIG_GCOV 0
-#define CONFIG_RVCT 0
-#define CONFIG_GCC 1
-#define CONFIG_MSVS 0
-#define CONFIG_PIC 1
-#define CONFIG_BIG_ENDIAN 0
-#define CONFIG_CODEC_SRCS 0
-#define CONFIG_DEBUG_LIBS 0
-#define CONFIG_FAST_UNALIGNED 1
-#define CONFIG_MEM_MANAGER 0
-#define CONFIG_MEM_TRACKER 0
-#define CONFIG_MEM_CHECKS 0
-#define CONFIG_DEQUANT_TOKENS 0
-#define CONFIG_DC_RECON 0
-#define CONFIG_RUNTIME_CPU_DETECT 1
-#define CONFIG_POSTPROC 1
-#define CONFIG_VP9_POSTPROC 0
-#define CONFIG_MULTITHREAD 1
-#define CONFIG_INTERNAL_STATS 0
-#define CONFIG_VP8_ENCODER 0
-#define CONFIG_VP8_DECODER 0
-#define CONFIG_VP9_ENCODER 0
-#define CONFIG_VP9_DECODER 1
-#define CONFIG_VP8 0
-#define CONFIG_VP9 1
-#define CONFIG_ENCODERS 1
-#define CONFIG_DECODERS 1
-#define CONFIG_STATIC_MSVCRT 0
-#define CONFIG_SPATIAL_RESAMPLING 1
-#define CONFIG_REALTIME_ONLY 0
-#define CONFIG_ONTHEFLY_BITPACKING 0
-#define CONFIG_ERROR_CONCEALMENT 0
-#define CONFIG_SHARED 0
-#define CONFIG_STATIC 1
-#define CONFIG_SMALL 0
-#define CONFIG_POSTPROC_VISUALIZER 0
-#define CONFIG_OS_SUPPORT 1
-#define CONFIG_UNIT_TESTS 0
-#define CONFIG_WEBM_IO 1
-#define CONFIG_DECODE_PERF_TESTS 0
-#define CONFIG_MULTI_RES_ENCODING 0
-#define CONFIG_TEMPORAL_DENOISING 1
-#define CONFIG_EXPERIMENTAL 0
-#define CONFIG_DECRYPT 0
-#define CONFIG_MULTIPLE_ARF 0
-#define CONFIG_ALPHA 0
-#endif /* VPX_CONFIG_H */
diff --git a/videocodec/libvpx_internal/x86/vpx_scale_rtcd.h b/videocodec/libvpx_internal/x86/vpx_scale_rtcd.h
deleted file mode 100644
index 0ecbf39..0000000
--- a/videocodec/libvpx_internal/x86/vpx_scale_rtcd.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef VPX_SCALE_RTCD_H_
-#define VPX_SCALE_RTCD_H_
-
-#ifdef RTCD_C
-#define RTCD_EXTERN
-#else
-#define RTCD_EXTERN extern
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct yv12_buffer_config;
-
-void vp8_horizontal_line_2_1_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_2_1_scale vp8_horizontal_line_2_1_scale_c
-
-void vp8_horizontal_line_5_3_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_3_scale vp8_horizontal_line_5_3_scale_c
-
-void vp8_horizontal_line_5_4_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width);
-#define vp8_horizontal_line_5_4_scale vp8_horizontal_line_5_4_scale_c
-
-void vp8_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale vp8_vertical_band_2_1_scale_c
-
-void vp8_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_2_1_scale_i vp8_vertical_band_2_1_scale_i_c
-
-void vp8_vertical_band_5_3_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_3_scale vp8_vertical_band_5_3_scale_c
-
-void vp8_vertical_band_5_4_scale_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width);
-#define vp8_vertical_band_5_4_scale vp8_vertical_band_5_4_scale_c
-
-void vp8_yv12_copy_frame_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vp8_yv12_copy_frame vp8_yv12_copy_frame_c
-
-void vp8_yv12_extend_frame_borders_c(struct yv12_buffer_config *ybf);
-#define vp8_yv12_extend_frame_borders vp8_yv12_extend_frame_borders_c
-
-void vp9_extend_frame_borders_c(struct yv12_buffer_config *ybf);
-#define vp9_extend_frame_borders vp9_extend_frame_borders_c
-
-void vp9_extend_frame_inner_borders_c(struct yv12_buffer_config *ybf);
-#define vp9_extend_frame_inner_borders vp9_extend_frame_inner_borders_c
-
-void vpx_yv12_copy_y_c(const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc);
-#define vpx_yv12_copy_y vpx_yv12_copy_y_c
-
-void vpx_scale_rtcd(void);
-
-#ifdef RTCD_C
-#include "vpx_ports/x86.h"
-static void setup_rtcd_internal(void)
-{
- int flags = x86_simd_caps();
-
- (void)flags;
-}
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif
diff --git a/videocodec/libvpx_internal/x86/vpx_version.h b/videocodec/libvpx_internal/x86/vpx_version.h
deleted file mode 100644
index 4ec2413..0000000
--- a/videocodec/libvpx_internal/x86/vpx_version.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define VERSION_MAJOR 1
-#define VERSION_MINOR 3
-#define VERSION_PATCH 0
-#define VERSION_EXTRA "2156-g3b39d75"
-#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
-#define VERSION_STRING_NOSP "v1.3.0-2156-g3b39d75"
-#define VERSION_STRING " v1.3.0-2156-g3b39d75"